1 #include "save/player-writer.h"
2 #include "cmd-building/cmd-building.h"
3 #include "dungeon/dungeon.h"
4 #include "game-option/birth-options.h"
5 #include "save/info-writer.h"
6 #include "save/save-util.h"
7 #include "system/building-type-definition.h"
8 #include "system/floor-type-definition.h"
9 #include "system/player-type-definition.h"
10 #include "world/world.h"
13 * @brief セーブデータに領域情報を書き込む / Write player realms
14 * @param creature_ptr プレーヤーへの参照ポインタ
16 static void wr_relams(player_type *creature_ptr)
18 if (creature_ptr->pclass == CLASS_ELEMENTALIST)
19 wr_byte((byte)creature_ptr->element);
21 wr_byte((byte)creature_ptr->realm1);
22 wr_byte((byte)creature_ptr->realm2);
26 * @brief セーブデータにプレーヤー情報を書き込む / Write some "player" info
27 * @param creature_ptr プレーヤーへの参照ポインタ
29 void wr_player(player_type *creature_ptr)
31 wr_string(creature_ptr->name);
32 wr_string(creature_ptr->died_from);
33 wr_string(creature_ptr->last_message ? creature_ptr->last_message : "");
36 for (int i = 0; i < 4; i++)
37 wr_string(creature_ptr->history[i]);
39 wr_byte((byte)creature_ptr->prace);
40 wr_byte((byte)creature_ptr->pclass);
41 wr_byte((byte)creature_ptr->pseikaku);
42 wr_byte((byte)creature_ptr->psex);
43 wr_relams(creature_ptr);
46 wr_byte((byte)creature_ptr->hitdie);
47 wr_u16b(creature_ptr->expfact);
49 wr_s16b(creature_ptr->age);
50 wr_s16b(creature_ptr->ht);
51 wr_s16b(creature_ptr->wt);
53 for (int i = 0; i < A_MAX; ++i)
54 wr_s16b(creature_ptr->stat_max[i]);
56 for (int i = 0; i < A_MAX; ++i)
57 wr_s16b(creature_ptr->stat_max_max[i]);
59 for (int i = 0; i < A_MAX; ++i)
60 wr_s16b(creature_ptr->stat_cur[i]);
62 for (int i = 0; i < 12; ++i)
65 wr_u32b(creature_ptr->au);
66 wr_u32b(creature_ptr->max_exp);
67 wr_u32b(creature_ptr->max_max_exp);
68 wr_u32b(creature_ptr->exp);
69 wr_u32b(creature_ptr->exp_frac);
70 wr_s16b(creature_ptr->lev);
72 for (int i = 0; i < 64; i++)
73 wr_s16b(creature_ptr->spell_exp[i]);
75 for (int i = 0; i < 5; i++)
76 for (int j = 0; j < 64; j++)
77 wr_s16b(creature_ptr->weapon_exp[i][j]);
79 for (int i = 0; i < MAX_SKILLS; i++)
80 wr_s16b(creature_ptr->skill_exp[i]);
82 for (int i = 0; i < MAX_SPELLS; i++)
83 wr_s32b(creature_ptr->magic_num1[i]);
85 for (int i = 0; i < MAX_SPELLS; i++)
86 wr_byte(creature_ptr->magic_num2[i]);
88 wr_byte((byte)creature_ptr->start_race);
89 wr_s32b(creature_ptr->old_race1);
90 wr_s32b(creature_ptr->old_race2);
91 wr_s16b(creature_ptr->old_realm);
92 for (int i = 0; i < MAX_MANE; i++) {
93 wr_s16b((s16b)creature_ptr->mane_spell[i]);
94 wr_s16b((s16b)creature_ptr->mane_dam[i]);
97 wr_s16b(creature_ptr->mane_num);
98 for (int i = 0; i < MAX_BOUNTY; i++)
99 wr_s16b(current_world_ptr->bounty_r_idx[i]);
101 for (int i = 0; i < 4; i++) {
102 wr_s16b(battle_mon[i]);
103 wr_u32b(mon_odds[i]);
106 wr_s16b(creature_ptr->town_num);
108 wr_s16b(creature_ptr->arena_number);
109 wr_s16b(creature_ptr->current_floor_ptr->inside_arena);
110 wr_s16b(creature_ptr->current_floor_ptr->inside_quest);
111 wr_s16b(creature_ptr->phase_out);
112 wr_byte(creature_ptr->exit_bldg);
113 wr_byte(0); /* Unused */
115 wr_s16b((s16b)creature_ptr->oldpx);
116 wr_s16b((s16b)creature_ptr->oldpy);
119 wr_s32b(creature_ptr->mhp);
120 wr_s32b(creature_ptr->chp);
121 wr_u32b(creature_ptr->chp_frac);
122 wr_s32b(creature_ptr->msp);
123 wr_s32b(creature_ptr->csp);
124 wr_u32b(creature_ptr->csp_frac);
125 wr_s16b(creature_ptr->max_plv);
127 byte tmp8u = (byte)current_world_ptr->max_d_idx;
129 for (int i = 0; i < tmp8u; i++)
130 wr_s16b((s16b)max_dlv[i]);
136 wr_s16b(creature_ptr->sc);
137 wr_s16b(creature_ptr->concent);
139 wr_s16b(0); /* old "rest" */
140 wr_s16b(creature_ptr->blind);
141 wr_s16b(creature_ptr->paralyzed);
142 wr_s16b(creature_ptr->confused);
143 wr_s16b(creature_ptr->food);
144 wr_s16b(0); /* old "food_digested" */
145 wr_s16b(0); /* old "protection" */
146 wr_s16b(creature_ptr->energy_need);
147 wr_s16b(creature_ptr->enchant_energy_need);
148 wr_s16b(creature_ptr->fast);
149 wr_s16b(creature_ptr->slow);
150 wr_s16b(creature_ptr->afraid);
151 wr_s16b(creature_ptr->cut);
152 wr_s16b(creature_ptr->stun);
153 wr_s16b(creature_ptr->poisoned);
154 wr_s16b(creature_ptr->image);
155 wr_s16b(creature_ptr->protevil);
156 wr_s16b(creature_ptr->invuln);
157 wr_s16b(creature_ptr->ult_res);
158 wr_s16b(creature_ptr->hero);
159 wr_s16b(creature_ptr->shero);
160 wr_s16b(creature_ptr->shield);
161 wr_s16b(creature_ptr->blessed);
162 wr_s16b(creature_ptr->tim_invis);
163 wr_s16b(creature_ptr->word_recall);
164 wr_s16b(creature_ptr->recall_dungeon);
165 wr_s16b(creature_ptr->alter_reality);
166 wr_s16b(creature_ptr->see_infra);
167 wr_s16b(creature_ptr->tim_infra);
168 wr_s16b(creature_ptr->oppose_fire);
169 wr_s16b(creature_ptr->oppose_cold);
170 wr_s16b(creature_ptr->oppose_acid);
171 wr_s16b(creature_ptr->oppose_elec);
172 wr_s16b(creature_ptr->oppose_pois);
173 wr_s16b(creature_ptr->tsuyoshi);
174 wr_s16b(creature_ptr->tim_esp);
175 wr_s16b(creature_ptr->wraith_form);
176 wr_s16b(creature_ptr->resist_magic);
177 wr_s16b(creature_ptr->tim_regen);
178 wr_s16b(creature_ptr->tim_pass_wall);
179 wr_s16b(creature_ptr->tim_stealth);
180 wr_s16b(creature_ptr->tim_levitation);
181 wr_s16b(creature_ptr->tim_sh_touki);
182 wr_s16b(creature_ptr->lightspeed);
183 wr_s16b(creature_ptr->tsubureru);
184 wr_s16b(creature_ptr->magicdef);
185 wr_s16b(creature_ptr->tim_res_nether);
186 wr_s16b(creature_ptr->tim_res_time);
187 wr_byte((byte)creature_ptr->mimic_form);
188 wr_s16b(creature_ptr->tim_mimic);
189 wr_s16b(creature_ptr->tim_sh_fire);
190 wr_s16b(creature_ptr->tim_sh_holy);
191 wr_s16b(creature_ptr->tim_eyeeye);
193 wr_s16b(creature_ptr->tim_reflect);
194 wr_s16b(creature_ptr->multishadow);
195 wr_s16b(creature_ptr->dustrobe);
197 wr_s16b(creature_ptr->chaos_patron);
198 wr_FlagGroup(creature_ptr->muta, wr_byte);
200 for (int i = 0; i < 8; i++)
201 wr_s16b(creature_ptr->virtues[i]);
203 for (int i = 0; i < 8; i++)
204 wr_s16b(creature_ptr->vir_types[i]);
206 wr_s16b(creature_ptr->ele_attack);
207 wr_u32b(creature_ptr->special_attack);
208 wr_s16b(creature_ptr->ele_immune);
209 wr_u32b(creature_ptr->special_defense);
210 wr_byte(creature_ptr->knowledge);
211 wr_byte(creature_ptr->autopick_autoregister);
213 wr_byte((byte)creature_ptr->action);
215 wr_byte(preserve_mode);
216 wr_byte(creature_ptr->wait_report_score);
218 for (int i = 0; i < 12; i++)
221 /* Ignore some flags */
226 wr_u32b(current_world_ptr->seed_flavor);
227 wr_u32b(current_world_ptr->seed_town);
228 wr_u16b(creature_ptr->panic_save);
229 wr_u16b(current_world_ptr->total_winner);
230 wr_u16b(current_world_ptr->noscore);
231 wr_byte(creature_ptr->is_dead);
232 wr_byte(creature_ptr->feeling);
233 wr_s32b(creature_ptr->current_floor_ptr->generated_turn);
234 wr_s32b(creature_ptr->feeling_turn);
235 wr_s32b(current_world_ptr->game_turn);
236 wr_s32b(current_world_ptr->dungeon_turn);
237 wr_s32b(current_world_ptr->arena_start_turn);
238 wr_s16b(current_world_ptr->today_mon);
239 wr_s16b(creature_ptr->today_mon);
240 wr_s16b(creature_ptr->riding);
241 wr_s16b(creature_ptr->floor_id);
243 /* Save temporary preserved pets (obsolated) */
245 wr_u32b(current_world_ptr->play_time);
246 wr_s32b(creature_ptr->visit);
247 wr_u32b(creature_ptr->count);