static void wr_lore(savefile_ptr file, int r_idx)
{
    monster_race *r_ptr = &r_info[r_idx];

    savefile_write_s16b(file, r_ptr->r_sights);
    savefile_write_s16b(file, r_ptr->r_deaths);
    savefile_write_s16b(file, r_ptr->r_pkills);
    savefile_write_s16b(file, r_ptr->r_akills);
    savefile_write_s16b(file, r_ptr->r_skills);
    savefile_write_s16b(file, r_ptr->r_tkills);
    savefile_write_byte(file, r_ptr->r_wake);
    savefile_write_byte(file, r_ptr->r_ignore);
    savefile_write_byte(file, r_ptr->r_xtra1);
    savefile_write_byte(file, r_ptr->r_xtra2);
    savefile_write_byte(file, r_ptr->r_drop_gold);
    savefile_write_byte(file, r_ptr->r_drop_item);
    savefile_write_byte(file, r_ptr->r_cast_spell);
    savefile_write_u32b(file, r_ptr->r_spell_turns);
    savefile_write_u32b(file, r_ptr->r_move_turns);
    savefile_write_byte(file, r_ptr->r_blows[0]);
    savefile_write_byte(file, r_ptr->r_blows[1]);
    savefile_write_byte(file, r_ptr->r_blows[2]);
    savefile_write_byte(file, r_ptr->r_blows[3]);
    savefile_write_u32b(file, r_ptr->r_flags1);
    savefile_write_u32b(file, r_ptr->r_flags2);
    savefile_write_u32b(file, r_ptr->r_flags3);
    savefile_write_u32b(file, r_ptr->r_flags4);
    savefile_write_u32b(file, r_ptr->r_flags5);
    savefile_write_u32b(file, r_ptr->r_flags6);
    savefile_write_u32b(file, r_ptr->r_flagsr);
    savefile_write_byte(file, r_ptr->max_num);
    savefile_write_s16b(file, r_ptr->floor_id);
    savefile_write_byte(file, r_ptr->stolen_ct);
    savefile_write_u32b(file, r_ptr->flagsx);
}
static void wr_options(savefile_ptr file)
{
    int i;
    u16b c;

    savefile_write_byte(file, delay_factor);
    savefile_write_byte(file, hitpoint_warn);
    savefile_write_byte(file, mana_warn);
    savefile_write_byte(file, random_artifact_pct);
    savefile_write_byte(file, reduce_uniques_pct);

    /*** Cheating options ***/
    c = 0;
    if (p_ptr->wizard) c |= 0x0002;
    if (cheat_peek) c |= 0x0100;
    if (cheat_hear) c |= 0x0200;
    if (cheat_room) c |= 0x0400;
    if (cheat_xtra) c |= 0x0800;
    if (cheat_live) c |= 0x2000;
    if (cheat_save) c |= 0x4000;
    savefile_write_u16b(file, c);

    /* Autosave info */
    savefile_write_byte(file, autosave_l);
    savefile_write_byte(file, autosave_t);
    savefile_write_s16b(file, autosave_freq);

    /*** Extract options ***/
    for (i = 0; option_info[i].o_desc; i++)
    {
        int os = option_info[i].o_set;
        int ob = option_info[i].o_bit;

        if (option_info[i].o_var)
        {
            if (*option_info[i].o_var)
                option_flag[os] |= (1L << ob);
            else
                option_flag[os] &= ~(1L << ob);
        }
    }

    for (i = 0; i < 8; i++) savefile_write_u32b(file, option_flag[i]);
    for (i = 0; i < 8; i++) savefile_write_u32b(file, option_mask[i]);


    /*** Window options ***/
    for (i = 0; i < 8; i++) savefile_write_u32b(file, window_flag[i]);
    for (i = 0; i < 8; i++) savefile_write_u32b(file, window_mask[i]);
}
static void wr_randomizer(savefile_ptr file)
{
    int i;

    savefile_write_u16b(file, Rand_place);

    for (i = 0; i < RAND_DEG; i++)
        savefile_write_u32b(file, Rand_state[i]);
}
static void wr_xtra_art(savefile_ptr file, int a_idx)
{
    int            i;
    artifact_type *a_ptr = &a_info[a_idx];

    savefile_write_byte(file, OF_ARRAY_SIZE);
    for (i = 0; i < OF_ARRAY_SIZE; i++)
        savefile_write_u32b(file, a_ptr->known_flags[i]);
}
static void wr_xtra_ego(savefile_ptr file, int e_idx)
{
    int       i;
    ego_type *e_ptr = &e_info[e_idx];

    savefile_write_byte(file, OF_ARRAY_SIZE);
    for (i = 0; i < OF_ARRAY_SIZE; i++)
        savefile_write_u32b(file, e_ptr->known_flags[i]);

    savefile_write_byte(file, OF_ARRAY_SIZE);
    for (i = 0; i < OF_ARRAY_SIZE; i++)
        savefile_write_u32b(file, e_ptr->xtra_flags[i]);

    savefile_write_s32b(file, e_ptr->counts.generated);
    savefile_write_s32b(file, e_ptr->counts.found);
    savefile_write_s32b(file, e_ptr->counts.bought);
    /*savefile_write_s32b(file, e_ptr->counts.used);*/
    savefile_write_s32b(file, e_ptr->counts.destroyed);
}
Exemplo n.º 6
0
void spell_stats_on_save(savefile_ptr file)
{
    str_map_ptr      map = _spell_stats_map();
    str_map_iter_ptr iter;
    
    savefile_write_s32b(file, str_map_count(map));

    for (iter = str_map_iter_alloc(map); 
            str_map_iter_is_valid(iter); 
            str_map_iter_next(iter))
    {
        spell_stats_ptr stats = str_map_iter_current(iter);

        savefile_write_cptr(file, str_map_iter_current_key(iter));
        savefile_write_u32b(file, stats->flags);
        savefile_write_s32b(file, stats->ct_cast);
        savefile_write_s32b(file, stats->ct_fail);
        savefile_write_s32b(file, stats->skill);
        savefile_write_s32b(file, stats->max_skill);
        savefile_write_s32b(file, stats->last_turn);
    }
    str_map_iter_free(iter);
}
static void wr_extra(savefile_ptr file)
{
    int i,j;
    byte tmp8u;

    savefile_write_cptr(file, player_name);
    savefile_write_cptr(file, p_ptr->died_from);
    savefile_write_cptr(file, p_ptr->last_message ? p_ptr->last_message : "");
    wr_quick_start(file);

    savefile_write_s32b(file, game_mode);
    savefile_write_byte(file, p_ptr->prace);
    savefile_write_byte(file, p_ptr->pclass);
    savefile_write_byte(file, p_ptr->personality);
    savefile_write_byte(file, p_ptr->psex);
    savefile_write_byte(file, p_ptr->realm1);
    savefile_write_byte(file, p_ptr->realm2);
    savefile_write_byte(file, p_ptr->dragon_realm);
    savefile_write_byte(file, p_ptr->psubclass);
    savefile_write_byte(file, p_ptr->psubrace);
    savefile_write_s16b(file, p_ptr->current_r_idx);
    savefile_write_u16b(file, p_ptr->expfact);

    for (i = 0; i < 6; ++i) savefile_write_s16b(file, p_ptr->stat_max[i]);
    for (i = 0; i < 6; ++i) savefile_write_s16b(file, p_ptr->stat_max_max[i]);
    for (i = 0; i < 6; ++i) savefile_write_s16b(file, p_ptr->stat_cur[i]);

    savefile_write_u32b(file, p_ptr->au);
    savefile_write_s16b(file, p_ptr->fame);
    savefile_write_u32b(file, p_ptr->max_exp);
    savefile_write_u32b(file, p_ptr->max_max_exp);
    savefile_write_u32b(file, p_ptr->exp);
    savefile_write_u32b(file, p_ptr->exp_frac);
    savefile_write_s16b(file, p_ptr->lev);

    for (i = 0; i < 64; i++) savefile_write_s16b(file, p_ptr->spell_exp[i]);
    for (i = 0; i < 5; i++) for (j = 0; j < 64; j++) savefile_write_s16b(file, p_ptr->weapon_exp[i][j]);
    for (i = 0; i < 10; i++) savefile_write_s16b(file, p_ptr->skill_exp[i]);
    for (i = 0; i < MAX_MAGIC_NUM; i++) savefile_write_s32b(file, p_ptr->magic_num1[i]);
    for (i = 0; i < MAX_MAGIC_NUM; i++) savefile_write_byte(file, p_ptr->magic_num2[i]);

    savefile_write_byte(file, p_ptr->start_race);
    savefile_write_s32b(file, p_ptr->old_race1);
    savefile_write_s32b(file, p_ptr->old_race2);
    savefile_write_s16b(file, p_ptr->old_realm);

    for (i = 0; i < MAX_MANE; i++)
    {
        savefile_write_s16b(file, p_ptr->mane_spell[i]);
        savefile_write_s16b(file, p_ptr->mane_dam[i]);
    }
    savefile_write_s16b(file, p_ptr->mane_num);

    for (i = 0; i < MAX_KUBI; i++)
        savefile_write_s16b(file, kubi_r_idx[i]);

    for (i = 0; i < 4; i++)
    {
        savefile_write_s16b(file, battle_mon[i]);
        savefile_write_u32b(file, mon_odds[i]);
    }

    savefile_write_s16b(file, p_ptr->town_num);
    savefile_write_s16b(file, p_ptr->arena_number);
    savefile_write_s16b(file, p_ptr->inside_arena);
    savefile_write_s16b(file, p_ptr->inside_battle);
    savefile_write_byte(file, p_ptr->exit_bldg);
    savefile_write_s16b(file, p_ptr->oldpx);
    savefile_write_s16b(file, p_ptr->oldpy);
    savefile_write_s32b(file, p_ptr->mhp);
    savefile_write_s32b(file, p_ptr->chp);
    savefile_write_u32b(file, p_ptr->chp_frac);
    savefile_write_s32b(file, p_ptr->msp);
    savefile_write_s32b(file, p_ptr->csp);
    savefile_write_u32b(file, p_ptr->csp_frac);
    savefile_write_s16b(file, p_ptr->max_plv);

    tmp8u = (byte)max_d_idx;
    savefile_write_byte(file, tmp8u);
    for (i = 0; i < tmp8u; i++)
        savefile_write_s16b(file, max_dlv[i]);
    for (i = 0; i < tmp8u; i++)
        savefile_write_u32b(file, dungeon_flags[i]);

    savefile_write_s16b(file, p_ptr->concent);
    savefile_write_s16b(file, p_ptr->blind);
    savefile_write_s16b(file, p_ptr->paralyzed);
    savefile_write_s16b(file, p_ptr->confused);
    savefile_write_s16b(file, p_ptr->food);
    savefile_write_s16b(file, p_ptr->energy_need);
    savefile_write_s16b(file, p_ptr->fast);
    savefile_write_s16b(file, p_ptr->slow);
    savefile_write_s16b(file, p_ptr->afraid);
    savefile_write_s16b(file, p_ptr->cut);
    savefile_write_s16b(file, p_ptr->stun);
    savefile_write_s16b(file, p_ptr->poisoned);
    savefile_write_s16b(file, p_ptr->image);

    savefile_write_s16b(file, p_ptr->protevil);
    savefile_write_s16b(file, p_ptr->invuln);
    savefile_write_s16b(file, p_ptr->ult_res);
    savefile_write_s16b(file, p_ptr->hero);
    savefile_write_s16b(file, p_ptr->shero);
    savefile_write_s16b(file, p_ptr->shield);
    savefile_write_s16b(file, p_ptr->blessed);
    savefile_write_s16b(file, p_ptr->tim_invis);
    savefile_write_s16b(file, p_ptr->word_recall);
    savefile_write_s16b(file, p_ptr->recall_dungeon);
    savefile_write_s16b(file, p_ptr->alter_reality);
    savefile_write_s16b(file, p_ptr->see_infra);
    savefile_write_s16b(file, p_ptr->tim_infra);
    savefile_write_s16b(file, p_ptr->oppose_fire);
    savefile_write_s16b(file, p_ptr->oppose_cold);
    savefile_write_s16b(file, p_ptr->oppose_acid);
    savefile_write_s16b(file, p_ptr->oppose_elec);
    savefile_write_s16b(file, p_ptr->oppose_pois);
    savefile_write_s16b(file, p_ptr->tsuyoshi);
    savefile_write_s16b(file, p_ptr->tim_esp);
    savefile_write_s16b(file, p_ptr->tim_esp_magical);
    savefile_write_s16b(file, p_ptr->wraith_form);
    savefile_write_s16b(file, p_ptr->resist_magic);
    savefile_write_s16b(file, p_ptr->tim_regen);
    savefile_write_s16b(file, p_ptr->kabenuke);
    savefile_write_s16b(file, p_ptr->tim_stealth);
    savefile_write_s16b(file, p_ptr->tim_levitation);
    savefile_write_s16b(file, p_ptr->tim_sh_touki);
    savefile_write_s16b(file, p_ptr->lightspeed);
    savefile_write_s16b(file, p_ptr->tsubureru);
    savefile_write_s16b(file, p_ptr->magicdef);
    savefile_write_s16b(file, p_ptr->tim_res_nether);
    savefile_write_s16b(file, p_ptr->tim_res_time);
    savefile_write_s16b(file, p_ptr->tim_res_disenchantment);
    savefile_write_s16b(file, p_ptr->mimic_form);
    savefile_write_s16b(file, p_ptr->tim_mimic);
    savefile_write_s16b(file, p_ptr->tim_sh_fire);
    savefile_write_s16b(file, p_ptr->tim_sh_elements);
    savefile_write_s16b(file, p_ptr->tim_sh_shards);
    savefile_write_s16b(file, p_ptr->tim_sh_domination);
    savefile_write_s16b(file, p_ptr->tim_weaponmastery);
    savefile_write_s16b(file, p_ptr->tim_sh_holy);
    savefile_write_s16b(file, p_ptr->tim_eyeeye);

    savefile_write_s16b(file, p_ptr->tim_spurt);
    savefile_write_s16b(file, p_ptr->tim_no_spells);
    savefile_write_s16b(file, p_ptr->tim_no_device);
    savefile_write_s16b(file, p_ptr->tim_blood_shield);
    savefile_write_s16b(file, p_ptr->tim_blood_sight);
    savefile_write_s16b(file, p_ptr->tim_blood_feast);
    savefile_write_s16b(file, p_ptr->tim_blood_revenge);
    savefile_write_s16b(file, p_ptr->tim_blood_seek);
    savefile_write_s16b(file, p_ptr->tim_blood_rite);
    savefile_write_s16b(file, p_ptr->tim_force);
    savefile_write_s16b(file, p_ptr->tim_building_up);
    savefile_write_s16b(file, p_ptr->tim_vicious_strike);
    savefile_write_s16b(file, p_ptr->tim_enlarge_weapon);

    savefile_write_s16b(file, p_ptr->tim_spell_reaction);
    savefile_write_s16b(file, p_ptr->tim_resist_curses);
    savefile_write_s16b(file, p_ptr->tim_armor_of_fury);
    savefile_write_s16b(file, p_ptr->tim_spell_turning);

    savefile_write_s16b(file, p_ptr->tim_dark_stalker);
    savefile_write_s16b(file, p_ptr->tim_nimble_dodge);
    savefile_write_s16b(file, p_ptr->tim_stealthy_snipe);

    savefile_write_s16b(file, p_ptr->tim_killing_spree);
    savefile_write_s16b(file, p_ptr->tim_slay_sentient);

    {
        int i;
        savefile_write_s16b(file, MAX_WILD_COUNTERS);
        for (i = 0; i < MAX_WILD_COUNTERS; i++)
        {
            savefile_write_s16b(file, p_ptr->wild_counters[i].type);
            savefile_write_s16b(file, p_ptr->wild_counters[i].counter);
        }
    }
    /* Remember the Monkey Clone */
    {
        int i;
        monster_race *r_ptr = &r_info[MON_MONKEY_CLONE];
        savefile_write_byte(file, r_ptr->cur_num);
        if (r_ptr->cur_num)
        {
            savefile_write_byte(file, r_ptr->hdice); /* Probably not required ... */
            savefile_write_byte(file, r_ptr->hside); /* Probably not required ... */
            savefile_write_s16b(file, r_ptr->ac);
            savefile_write_byte(file, r_ptr->speed); /* Probably not required ... */
            for (i = 0; i < 4; i++)
            {
                savefile_write_byte(file, r_ptr->blow[i].method);
                savefile_write_byte(file, r_ptr->blow[i].effect);
                savefile_write_byte(file, r_ptr->blow[i].d_dice);
                savefile_write_byte(file, r_ptr->blow[i].d_side);
            }
            savefile_write_u32b(file, r_ptr->flags3);
            savefile_write_u32b(file, r_ptr->flagsr);
            savefile_write_u32b(file, r_ptr->flags2);
            savefile_write_u32b(file, r_ptr->flags7);
        }
    }
    savefile_write_s16b(file, p_ptr->entrench_x);
    savefile_write_s16b(file, p_ptr->entrench_y);
    savefile_write_s16b(file, p_ptr->entrench_ct);
    savefile_write_byte(file, p_ptr->sense_artifact);
    savefile_write_s16b(file, p_ptr->duelist_target_idx);

    /* by henkma */
    savefile_write_s16b(file, p_ptr->tim_reflect);
    savefile_write_s16b(file, p_ptr->multishadow);
    savefile_write_s16b(file, p_ptr->dustrobe);

    savefile_write_s16b(file, p_ptr->tim_superstealth);

    savefile_write_bool(file, p_ptr->fasting);
    savefile_write_s16b(file, p_ptr->tim_sustain_str);
    savefile_write_s16b(file, p_ptr->tim_sustain_int);
    savefile_write_s16b(file, p_ptr->tim_sustain_wis);
    savefile_write_s16b(file, p_ptr->tim_sustain_dex);
    savefile_write_s16b(file, p_ptr->tim_sustain_con);
    savefile_write_s16b(file, p_ptr->tim_sustain_chr);
    savefile_write_s16b(file, p_ptr->tim_hold_life);
    savefile_write_s16b(file, p_ptr->tim_transcendence);
    savefile_write_s16b(file, p_ptr->tim_quick_walk);
    savefile_write_s16b(file, p_ptr->tim_inven_prot);
    savefile_write_s16b(file, p_ptr->tim_device_power);
    savefile_write_s16b(file, p_ptr->tim_sh_time);
    savefile_write_s16b(file, p_ptr->free_turns);
    savefile_write_s16b(file, p_ptr->tim_foresight);

    savefile_write_s16b(file, p_ptr->chaos_patron);
    for (i = 0; i < MUT_FLAG_SIZE; ++i)
        savefile_write_u32b(file, p_ptr->muta[i]);
    for (i = 0; i < MUT_FLAG_SIZE; ++i)
        savefile_write_u32b(file, p_ptr->muta_lock[i]);
    for (i = 0; i < MAX_DEMIGOD_POWERS; ++i)
        savefile_write_s16b(file, p_ptr->demigod_power[i]);
    savefile_write_s16b(file, p_ptr->draconian_power);

    for (i = 0; i<8; i++)
        savefile_write_s16b(file, p_ptr->virtues[i]);
    for (i = 0; i<8; i++)
        savefile_write_s16b(file, p_ptr->vir_types[i]);

    savefile_write_s16b(file, p_ptr->ele_attack);
    savefile_write_u32b(file, p_ptr->special_attack);
    savefile_write_s16b(file, p_ptr->ele_immune);
    savefile_write_u32b(file, p_ptr->special_defense);
    savefile_write_byte(file, p_ptr->knowledge);
    savefile_write_byte(file, p_ptr->autopick_autoregister);
    savefile_write_byte(file, p_ptr->action);
    savefile_write_byte(file, preserve_mode);
    savefile_write_byte(file, p_ptr->wait_report_score);
    savefile_write_u32b(file, seed_flavor);
    savefile_write_u32b(file, seed_town);
    savefile_write_u16b(file, p_ptr->panic_save);
    savefile_write_u16b(file, p_ptr->total_winner);
    savefile_write_u16b(file, p_ptr->noscore);
    savefile_write_byte(file, p_ptr->is_dead);
    savefile_write_byte(file, p_ptr->feeling);
    savefile_write_s32b(file, old_turn);
    savefile_write_s32b(file, p_ptr->feeling_turn);
    savefile_write_s32b(file, game_turn);
    savefile_write_s32b(file, player_turn);
    savefile_write_s32b(file, dungeon_turn);
    savefile_write_s32b(file, old_battle);
    savefile_write_s16b(file, today_mon);
    savefile_write_s16b(file, p_ptr->today_mon);
    savefile_write_s16b(file, p_ptr->riding);
    savefile_write_s16b(file, p_ptr->floor_id);
    savefile_write_u32b(file, playtime);
    savefile_write_u32b(file, p_ptr->count);

    {
    race_t  *race_ptr = get_true_race();
    class_t *class_ptr = get_class();

        if (race_ptr->save_player)
            race_ptr->save_player(file);
        if (class_ptr->save_player)
            class_ptr->save_player(file);
    }
}
static void wr_monster(savefile_ptr file, monster_type *m_ptr)
{
    int i;

    savefile_write_s16b(file, m_ptr->r_idx);
    savefile_write_byte(file, m_ptr->fy);
    savefile_write_byte(file, m_ptr->fx);
    savefile_write_s16b(file, m_ptr->hp);
    savefile_write_s16b(file, m_ptr->maxhp);
    savefile_write_s16b(file, m_ptr->max_maxhp);
    savefile_write_byte(file, m_ptr->mspeed);
    savefile_write_s16b(file, m_ptr->energy_need);

    if (!is_original_ap(m_ptr))
    {
        savefile_write_byte(file, SAVE_MON_AP_R_IDX);
        savefile_write_s16b(file, m_ptr->ap_r_idx);
    }
    if (m_ptr->sub_align)
    {
        savefile_write_byte(file, SAVE_MON_SUB_ALIGN);
        savefile_write_byte(file, m_ptr->sub_align);
    }
    for (i = 0; i < MTIMED_MAX; i++)
    {
        if (m_ptr->mtimed[i])
        {
            savefile_write_byte(file, SAVE_MON_TIMER);
            savefile_write_byte(file, i);
            savefile_write_s16b(file, m_ptr->mtimed[i]);
        }
    }
    if (m_ptr->target_y)
    {
        savefile_write_byte(file, SAVE_MON_TARGET_Y);
        savefile_write_s16b(file, m_ptr->target_y);
    }
    if (m_ptr->target_x)
    {
        savefile_write_byte(file, SAVE_MON_TARGET_X);
        savefile_write_s16b(file, m_ptr->target_x);
    }
    if (m_ptr->smart)
    {
        savefile_write_byte(file, SAVE_MON_SMART);
        savefile_write_u32b(file, m_ptr->smart);
    }
    if (m_ptr->exp)
    {
        savefile_write_byte(file, SAVE_MON_EXP);
        savefile_write_u32b(file, m_ptr->exp);
    }
    if (m_ptr->mflag2)
    {
        savefile_write_byte(file, SAVE_MON_MFLAG2);
        savefile_write_u32b(file, m_ptr->mflag2);
    }
    if (m_ptr->nickname)
    {
        savefile_write_byte(file, SAVE_MON_NICKNAME);
        savefile_write_cptr(file, quark_str(m_ptr->nickname));
    }
    if (m_ptr->parent_m_idx)
    {
        savefile_write_byte(file, SAVE_MON_PARENT);
        savefile_write_s16b(file, m_ptr->parent_m_idx);
    }
    if (m_ptr->pack_idx)
    {
        savefile_write_byte(file, SAVE_MON_PACK_IDX);
        savefile_write_s16b(file, m_ptr->pack_idx);
    }
    if (m_ptr->ac_adj)
    {
        savefile_write_byte(file, SAVE_MON_AC);
        savefile_write_s16b(file, m_ptr->ac_adj);
    }
    if (m_ptr->melee_adj)
    {
        savefile_write_byte(file, SAVE_MON_MELEE);
        savefile_write_s16b(file, m_ptr->melee_adj);
    }
    if (m_ptr->drop_ct)
    {
        savefile_write_byte(file, SAVE_MON_DROP_CT);
        savefile_write_byte(file, m_ptr->drop_ct);
    }
    if (m_ptr->stolen_ct)
    {
        savefile_write_byte(file, SAVE_MON_STOLEN_CT);
        savefile_write_byte(file, m_ptr->stolen_ct);
    }
    if (m_ptr->summon_ct)
    {
        savefile_write_byte(file, SAVE_MON_SUMMON_CT);
        savefile_write_u16b(file, m_ptr->summon_ct);
    }
    if (m_ptr->ego_whip_ct)
    {
        savefile_write_byte(file, SAVE_MON_EGO_WHIP);
        savefile_write_byte(file, m_ptr->ego_whip_ct);
        savefile_write_byte(file, m_ptr->ego_whip_pow);
    }
    if (m_ptr->anti_magic_ct)
    {
        savefile_write_byte(file, SAVE_MON_ANTI_MAGIC);
        savefile_write_byte(file, m_ptr->anti_magic_ct);
    }
    if (m_ptr->pexp)
    {
        savefile_write_byte(file, SAVE_MON_PEXP);
        savefile_write_s32b(file, m_ptr->pexp);
    }
    if (m_ptr->paralyzed)
    {
        savefile_write_byte(file, SAVE_MON_PARALYZED);
        savefile_write_s16b(file, m_ptr->paralyzed);
    }
    if (m_ptr->anger_ct)
    {
        savefile_write_byte(file, SAVE_MON_ANGER_CT);
        savefile_write_byte(file, m_ptr->anger_ct);
    }

    savefile_write_byte(file, SAVE_MON_DONE);
}