1 #include "load/load-zangband.h"
2 #include "cmd-building/cmd-building.h"
3 #include "dungeon/dungeon.h"
4 #include "game-option/option-flags.h"
5 #include "info-reader/fixed-map-parser.h"
6 #include "load/angband-version-comparer.h"
7 #include "load/load-util.h"
8 #include "market/bounty.h"
9 #include "monster-race/monster-race.h"
10 #include "pet/pet-util.h"
11 #include "player/attack-defense-types.h"
12 #include "player/avatar.h"
13 #include "player/patron.h"
14 #include "player/player-class.h"
15 #include "player/player-personality.h"
16 #include "player/player-race.h"
17 #include "player/player-skill.h"
18 #include "realm/realm-types.h"
19 #include "spell/spells-status.h"
20 #include "system/floor-type-definition.h"
21 #include "system/system-variables.h"
22 #include "world/world.h"
24 void load_zangband_options(void)
26 if (option_flag[5] & (0x00000001 << 4))
27 option_flag[5] &= ~(0x00000001 << 4);
29 option_flag[5] |= (0x00000001 << 4);
31 if (option_flag[2] & (0x00000001 << 5))
32 option_flag[2] &= ~(0x00000001 << 5);
34 option_flag[2] |= (0x00000001 << 5);
36 if (option_flag[4] & (0x00000001 << 5))
37 option_flag[4] &= ~(0x00000001 << 5);
39 option_flag[4] |= (0x00000001 << 5);
41 if (option_flag[5] & (0x00000001 << 0))
42 option_flag[5] &= ~(0x00000001 << 0);
44 option_flag[5] |= (0x00000001 << 0);
46 if (option_flag[5] & (0x00000001 << 12))
47 option_flag[5] &= ~(0x00000001 << 12);
49 option_flag[5] |= (0x00000001 << 12);
51 if (option_flag[1] & (0x00000001 << 0))
52 option_flag[1] &= ~(0x00000001 << 0);
54 option_flag[1] |= (0x00000001 << 0);
56 if (option_flag[1] & (0x00000001 << 18))
57 option_flag[1] &= ~(0x00000001 << 18);
59 option_flag[1] |= (0x00000001 << 18);
61 if (option_flag[1] & (0x00000001 << 19))
62 option_flag[1] &= ~(0x00000001 << 19);
64 option_flag[1] |= (0x00000001 << 19);
66 if (option_flag[5] & (0x00000001 << 3))
67 option_flag[1] &= ~(0x00000001 << 3);
69 option_flag[5] |= (0x00000001 << 3);
72 void set_zangband_realm(player_type* creature_ptr)
74 if (creature_ptr->realm1 == 9)
75 creature_ptr->realm1 = REALM_MUSIC;
77 if (creature_ptr->realm2 == 9)
78 creature_ptr->realm2 = REALM_MUSIC;
80 if (creature_ptr->realm1 == 10)
81 creature_ptr->realm1 = REALM_HISSATSU;
83 if (creature_ptr->realm2 == 10)
84 creature_ptr->realm2 = REALM_HISSATSU;
87 void set_zangband_skill(player_type *creature_ptr)
89 if (creature_ptr->pclass != CLASS_BEASTMASTER)
90 creature_ptr->skill_exp[GINOU_RIDING] /= 2;
92 creature_ptr->skill_exp[GINOU_RIDING] = MIN(creature_ptr->skill_exp[GINOU_RIDING], s_info[creature_ptr->pclass].s_max[GINOU_RIDING]);
95 void set_zangband_spells(player_type* creature_ptr)
97 for (int i = 0; i < MAX_SPELLS; i++)
98 creature_ptr->magic_num1[i] = 0;
100 for (int i = 0; i < MAX_SPELLS; i++)
101 creature_ptr->magic_num2[i] = 0;
104 void set_zangband_race(player_type *creature_ptr)
106 creature_ptr->start_race = creature_ptr->prace;
107 creature_ptr->old_race1 = 0L;
108 creature_ptr->old_race2 = 0L;
109 creature_ptr->old_realm = 0;
112 void set_zangband_bounty_uniques(player_type *creature_ptr)
114 determine_bounty_uniques(creature_ptr);
115 for (int i = 0; i < MAX_BOUNTY; i++) {
116 /* Is this bounty unique already dead? */
117 if (!r_info[current_world_ptr->bounty_r_idx[i]].max_num)
118 current_world_ptr->bounty_r_idx[i] += 10000;
123 * @brief ZAngband v2.0.6に存在しない時限効果を0で初期化する / Old savefiles do not have the following fields...
124 * @param creature_ptr プレーヤーへの参照ポインタ
126 * @details 厳密にv2.0.6しか見ていないため、ZAngband v2.0.5 以前のセーブデータは非対応
128 void set_zangband_timed_effects(player_type *creature_ptr)
130 creature_ptr->tim_esp = 0;
131 creature_ptr->wraith_form = 0;
132 creature_ptr->resist_magic = 0;
133 creature_ptr->tim_regen = 0;
134 creature_ptr->tim_pass_wall = 0;
135 creature_ptr->tim_stealth = 0;
136 creature_ptr->tim_levitation = 0;
137 creature_ptr->tim_sh_touki = 0;
138 creature_ptr->lightspeed = 0;
139 creature_ptr->tsubureru = 0;
140 creature_ptr->tim_res_nether = 0;
141 creature_ptr->tim_res_time = 0;
142 creature_ptr->mimic_form = 0;
143 creature_ptr->tim_mimic = 0;
144 creature_ptr->tim_sh_fire = 0;
145 creature_ptr->tim_reflect = 0;
146 creature_ptr->multishadow = 0;
147 creature_ptr->dustrobe = 0;
148 creature_ptr->chaos_patron = ((creature_ptr->age + creature_ptr->sc) % MAX_PATRON);
149 creature_ptr->muta1 = 0;
150 creature_ptr->muta2 = 0;
151 creature_ptr->muta3 = 0;
152 get_virtues(creature_ptr);
155 void set_zangband_mimic(player_type *creature_ptr)
157 creature_ptr->tim_res_time = 0;
158 creature_ptr->mimic_form = 0;
159 creature_ptr->tim_mimic = 0;
160 creature_ptr->tim_sh_fire = 0;
163 void set_zangband_holy_aura(player_type *creature_ptr)
165 creature_ptr->tim_sh_holy = 0;
166 creature_ptr->tim_eyeeye = 0;
169 void set_zangband_reflection(player_type *creature_ptr)
171 creature_ptr->tim_reflect = 0;
172 creature_ptr->multishadow = 0;
173 creature_ptr->dustrobe = 0;
176 void rd_zangband_dungeon()
180 max_dlv[DUNGEON_ANGBAND] = tmp16s;
183 void set_zangband_game_turns(player_type *creature_ptr)
185 creature_ptr->current_floor_ptr->generated_turn /= 2;
186 creature_ptr->feeling_turn /= 2;
187 current_world_ptr->game_turn /= 2;
188 current_world_ptr->dungeon_turn /= 2;
191 void set_zangband_gambling_monsters(int i)
195 mon_odds[i] = tmp16s;
198 void set_zangband_special_attack(player_type *creature_ptr)
203 creature_ptr->special_attack = ATTACK_CONFUSE;
205 creature_ptr->ele_attack = 0;
208 void set_zangband_special_defense(player_type *creature_ptr)
210 creature_ptr->ele_immune = 0;
211 creature_ptr->special_defense = 0;
214 void set_zangband_action(player_type *creature_ptr)
219 creature_ptr->action = ACTION_LEARN;
222 void set_zangband_visited_towns(player_type *creature_ptr)
226 creature_ptr->visit = 1L;
229 void set_zangband_quest(player_type *creature_ptr, quest_type *const q_ptr, int loading_quest_index, const QUEST_IDX old_inside_quest)
231 if (q_ptr->flags & QUEST_FLAG_PRESET) {
236 init_flags = INIT_ASSIGN;
237 creature_ptr->current_floor_ptr->inside_quest = (QUEST_IDX)loading_quest_index;
238 parse_fixed_map(creature_ptr, "q_info.txt", 0, 0, 0, 0);
239 creature_ptr->current_floor_ptr->inside_quest = old_inside_quest;
242 void set_zangband_class(player_type *creature_ptr)
244 if (z_older_than(10, 2, 2) && (creature_ptr->pclass == CLASS_BEASTMASTER) && !creature_ptr->is_dead) {
245 creature_ptr->hitdie = rp_ptr->r_mhp + cp_ptr->c_mhp + ap_ptr->a_mhp;
246 roll_hitdice(creature_ptr, 0L);
249 if (z_older_than(10, 3, 2) && (creature_ptr->pclass == CLASS_ARCHER) && !creature_ptr->is_dead) {
250 creature_ptr->hitdie = rp_ptr->r_mhp + cp_ptr->c_mhp + ap_ptr->a_mhp;
251 roll_hitdice(creature_ptr, 0L);
254 if (z_older_than(10, 2, 6) && (creature_ptr->pclass == CLASS_SORCERER) && !creature_ptr->is_dead) {
255 creature_ptr->hitdie = rp_ptr->r_mhp / 2 + cp_ptr->c_mhp + ap_ptr->a_mhp;
256 roll_hitdice(creature_ptr, 0L);
259 if (z_older_than(10, 4, 7) && (creature_ptr->pclass == CLASS_BLUE_MAGE) && !creature_ptr->is_dead) {
260 creature_ptr->hitdie = rp_ptr->r_mhp + cp_ptr->c_mhp + ap_ptr->a_mhp;
261 roll_hitdice(creature_ptr, 0L);
265 void set_zangband_learnt_spells(player_type *creature_ptr)
267 creature_ptr->learned_spells = 0;
268 for (int i = 0; i < 64; i++)
269 if ((i < 32) ? (creature_ptr->spell_learned1 & (1L << i)) : (creature_ptr->spell_learned2 & (1L << (i - 32))))
270 creature_ptr->learned_spells++;
273 void set_zangband_pet(player_type *creature_ptr)
275 creature_ptr->pet_extra_flags = 0;
279 creature_ptr->pet_extra_flags |= PF_OPEN_DOORS;
283 creature_ptr->pet_extra_flags |= PF_PICKUP_ITEMS;
285 if (z_older_than(10, 0, 4))
286 creature_ptr->pet_extra_flags |= PF_TELEPORT;
290 creature_ptr->pet_extra_flags |= PF_TELEPORT;
293 if (z_older_than(10, 0, 7))
294 creature_ptr->pet_extra_flags |= PF_ATTACK_SPELL;
298 creature_ptr->pet_extra_flags |= PF_ATTACK_SPELL;
301 if (z_older_than(10, 0, 8))
302 creature_ptr->pet_extra_flags |= PF_SUMMON_SPELL;
306 creature_ptr->pet_extra_flags |= PF_SUMMON_SPELL;
309 if (z_older_than(10, 0, 8))
314 creature_ptr->pet_extra_flags |= PF_BALL_SPELL;