Beispiel #1
0
/*
 * Dump the random artifacts
 */
void wr_randarts(void)
{
	size_t i, j, k;

	if (!OPT(birth_randarts))
		return;

	wr_u16b(z_info->a_max);

	for (i = 0; i < z_info->a_max; i++)
	{
		artifact_type *a_ptr = &a_info[i];

		wr_byte(a_ptr->tval);
		wr_byte(a_ptr->sval);
		for (j = 0; j < MAX_PVALS; j++)
			wr_s16b(a_ptr->pval[j]);
		wr_byte(a_ptr->num_pvals);

		wr_s16b(a_ptr->to_h);
		wr_s16b(a_ptr->to_d);
		wr_s16b(a_ptr->to_a);
		wr_s16b(a_ptr->ac);

		wr_byte(a_ptr->dd);
		wr_byte(a_ptr->ds);

		wr_s16b(a_ptr->weight);

		wr_s32b(a_ptr->cost);

		for (j = 0; j < OF_BYTES && j < OF_SIZE; j++)
			wr_byte(a_ptr->flags[j]);
		if (j < OF_BYTES) pad_bytes(OF_BYTES - j);

		for (k = 0; k < MAX_PVALS; k++) {
			for (j = 0; j < OF_BYTES && j < OF_SIZE; j++)
				wr_byte(a_ptr->pval_flags[k][j]);
			if (j < OF_BYTES) pad_bytes(OF_BYTES - j);
		}

		wr_byte(a_ptr->level);
		wr_byte(a_ptr->rarity);
		wr_byte(a_ptr->alloc_prob);
		wr_byte(a_ptr->alloc_min);
		wr_byte(a_ptr->alloc_max);

		wr_u16b(a_ptr->effect);
		wr_u16b(a_ptr->time.base);
		wr_u16b(a_ptr->time.dice);
		wr_u16b(a_ptr->time.sides);
	}
}
Beispiel #2
0
void wr_monster_memory(void)
{
	size_t i;
	int r_idx;

	wr_u16b(z_info->r_max);
	for (r_idx = 0; r_idx < z_info->r_max; r_idx++)
	{
		monster_race *r_ptr = &r_info[r_idx];
		monster_lore *l_ptr = &l_list[r_idx];

		/* Count sights/deaths/kills */
		wr_s16b(l_ptr->sights);
		wr_s16b(l_ptr->deaths);
		wr_s16b(l_ptr->pkills);
		wr_s16b(l_ptr->tkills);

		/* Count wakes and ignores */
		wr_byte(l_ptr->wake);
		wr_byte(l_ptr->ignore);

		/* Count drops */
		wr_byte(l_ptr->drop_gold);
		wr_byte(l_ptr->drop_item);

		/* Count spells */
		wr_byte(l_ptr->cast_innate);
		wr_byte(l_ptr->cast_spell);

		/* Count blows of each type */
		for (i = 0; i < MONSTER_BLOW_MAX; i++)
			wr_byte(l_ptr->blows[i]);

		/* Memorize flags */
		for (i = 0; i < RF_BYTES && i < RF_SIZE; i++)
			wr_byte(l_ptr->flags[i]);
		if (i < RF_BYTES) pad_bytes(RF_BYTES - i);

		for (i = 0; i < RF_BYTES && i < RSF_SIZE; i++)
			wr_byte(l_ptr->spell_flags[i]);
		if (i < RF_BYTES) pad_bytes(RF_BYTES - i);

		/* Monster limit per level */
		wr_byte(r_ptr->max_num);

		/* XXX */
		wr_byte(0);
		wr_byte(0);
		wr_byte(0);
	}
}
Beispiel #3
0
void wr_monsters(void)
{
	int i;
	size_t j;

	if (p_ptr->is_dead)
		return;

	/* Total monsters */
	wr_u16b(cave_monster_max(cave));

	/* Dump the monsters */
	for (i = 1; i < cave_monster_max(cave); i++) {
		byte unaware = 0;
	
		const monster_type *m_ptr = cave_monster(cave, i);

		wr_s16b(m_ptr->r_idx);
		wr_byte(m_ptr->fy);
		wr_byte(m_ptr->fx);
		wr_s16b(m_ptr->hp);
		wr_s16b(m_ptr->maxhp);
		wr_byte(m_ptr->mspeed);
		wr_byte(m_ptr->energy);
		wr_byte(MON_TMD_MAX);

		for (j = 0; j < MON_TMD_MAX; j++)
			wr_s16b(m_ptr->m_timed[j]);

		if (m_ptr->unaware) unaware |= 0x01;
		wr_byte(unaware);

		for (j = 0; j < OF_BYTES && j < OF_SIZE; j++)
			wr_byte(m_ptr->known_pflags[j]);
		if (j < OF_BYTES) pad_bytes(OF_BYTES - j);
		
		wr_byte(0);
	}
}
Beispiel #4
0
/*
 * Write an "item" record
 */
static void wr_item(const object_type *o_ptr)
{
	size_t i, j;

	wr_u16b(0xffff);
	wr_byte(ITEM_VERSION);

	wr_s16b(0);

	/* Location */
	wr_byte(o_ptr->iy);
	wr_byte(o_ptr->ix);

	wr_byte(o_ptr->tval);
	wr_byte(o_ptr->sval);

        for (i = 0; i < MAX_PVALS; i++) {
		wr_s16b(o_ptr->pval[i]);
        }
        wr_byte(o_ptr->num_pvals);

	wr_byte(0);

	wr_byte(o_ptr->number);
	wr_s16b(o_ptr->weight);

	if (o_ptr->artifact) wr_byte(o_ptr->artifact->aidx);
	else wr_byte(0);

	if (o_ptr->ego) wr_byte(o_ptr->ego->eidx);
	else wr_byte(0);

	wr_s16b(o_ptr->timeout);

	wr_s16b(o_ptr->to_h);
	wr_s16b(o_ptr->to_d);
	wr_s16b(o_ptr->to_a);
	wr_s16b(o_ptr->ac);
	wr_byte(o_ptr->dd);
	wr_byte(o_ptr->ds);

	wr_u16b(o_ptr->ident);

	wr_byte(o_ptr->marked);

	wr_byte(o_ptr->origin);
	wr_byte(o_ptr->origin_depth);
	wr_u16b(o_ptr->origin_xtra);

	for (i = 0; i < OF_BYTES && i < OF_SIZE; i++)
		wr_byte(o_ptr->flags[i]);
	if (i < OF_BYTES) pad_bytes(OF_BYTES - i);

	for (i = 0; i < OF_BYTES && i < OF_SIZE; i++)
		wr_byte(o_ptr->known_flags[i]);
	if (i < OF_BYTES) pad_bytes(OF_BYTES - i);

	for (j = 0; j < MAX_PVALS; j++) {
		for (i = 0; i < OF_BYTES && i < OF_SIZE; i++)
			wr_byte(o_ptr->pval_flags[j][i]);
		if (i < OF_BYTES) pad_bytes(OF_BYTES - i);
	}

	/* Held by monster index */
	wr_s16b(o_ptr->held_m_idx);

	/* Save the inscription (if any) */
	if (o_ptr->note)
	{
		wr_string(quark_str(o_ptr->note));
	}
	else
	{
		wr_string("");
	}
}