1 #include "load/load-zangband.h"
2 #include "avatar/avatar.h"
3 #include "cmd-building/cmd-building.h"
4 #include "dungeon/dungeon.h"
5 #include "dungeon/quest.h"
6 #include "game-option/option-flags.h"
7 #include "info-reader/fixed-map-parser.h"
8 #include "load/angband-version-comparer.h"
9 #include "load/load-util.h"
10 #include "market/bounty.h"
11 #include "monster-race/monster-race.h"
12 #include "pet/pet-util.h"
13 #include "player-info/class-info.h"
14 #include "player-info/race-info.h"
15 #include "player/attack-defense-types.h"
16 #include "player/patron.h"
17 #include "player/player-personality.h"
18 #include "player/player-skill.h"
19 #include "realm/realm-types.h"
20 #include "spell/spells-status.h"
21 #include "system/floor-type-definition.h"
22 #include "system/monster-race-definition.h"
23 #include "system/player-type-definition.h"
24 #include "system/system-variables.h"
25 #include "world/world.h"
27 void load_zangband_options(void)
29 if (option_flag[5] & (0x00000001U << 4))
30 option_flag[5] &= ~(0x00000001U << 4);
32 option_flag[5] |= (0x00000001U << 4);
34 if (option_flag[2] & (0x00000001U << 5))
35 option_flag[2] &= ~(0x00000001U << 5);
37 option_flag[2] |= (0x00000001U << 5);
39 if (option_flag[4] & (0x00000001U << 5))
40 option_flag[4] &= ~(0x00000001U << 5);
42 option_flag[4] |= (0x00000001U << 5);
44 if (option_flag[5] & (0x00000001U << 0))
45 option_flag[5] &= ~(0x00000001U << 0);
47 option_flag[5] |= (0x00000001U << 0);
49 if (option_flag[5] & (0x00000001U << 12))
50 option_flag[5] &= ~(0x00000001U << 12);
52 option_flag[5] |= (0x00000001U << 12);
54 if (option_flag[1] & (0x00000001U << 0))
55 option_flag[1] &= ~(0x00000001U << 0);
57 option_flag[1] |= (0x00000001U << 0);
59 if (option_flag[1] & (0x00000001U << 18))
60 option_flag[1] &= ~(0x00000001U << 18);
62 option_flag[1] |= (0x00000001U << 18);
64 if (option_flag[1] & (0x00000001U << 19))
65 option_flag[1] &= ~(0x00000001U << 19);
67 option_flag[1] |= (0x00000001U << 19);
69 if (option_flag[5] & (0x00000001U << 3))
70 option_flag[1] &= ~(0x00000001U << 3);
72 option_flag[5] |= (0x00000001U << 3);
75 void set_zangband_realm(player_type *player_ptr)
77 if (player_ptr->realm1 == 9)
78 player_ptr->realm1 = REALM_MUSIC;
80 if (player_ptr->realm2 == 9)
81 player_ptr->realm2 = REALM_MUSIC;
83 if (player_ptr->realm1 == 10)
84 player_ptr->realm1 = REALM_HISSATSU;
86 if (player_ptr->realm2 == 10)
87 player_ptr->realm2 = REALM_HISSATSU;
90 void set_zangband_skill(player_type *player_ptr)
92 if (player_ptr->pclass != PlayerClassType::BEASTMASTER)
93 player_ptr->skill_exp[SKILL_RIDING] /= 2;
95 player_ptr->skill_exp[SKILL_RIDING] = std::min(player_ptr->skill_exp[SKILL_RIDING], s_info[enum2i(player_ptr->pclass)].s_max[SKILL_RIDING]);
98 void set_zangband_race(player_type *player_ptr)
100 player_ptr->start_race = player_ptr->prace;
101 player_ptr->old_race1 = 0L;
102 player_ptr->old_race2 = 0L;
103 player_ptr->old_realm = 0;
106 void set_zangband_bounty_uniques(player_type *player_ptr)
108 determine_bounty_uniques(player_ptr);
109 for (int i = 0; i < MAX_BOUNTY; i++) {
110 /* Is this bounty unique already dead? */
111 if (!r_info[w_ptr->bounty_r_idx[i]].max_num)
112 w_ptr->bounty_r_idx[i] += 10000;
116 void set_zangband_mimic(player_type *player_ptr)
118 player_ptr->tim_res_time = 0;
119 player_ptr->mimic_form = 0;
120 player_ptr->tim_mimic = 0;
121 player_ptr->tim_sh_fire = 0;
124 void set_zangband_holy_aura(player_type *player_ptr)
126 player_ptr->tim_sh_holy = 0;
127 player_ptr->tim_eyeeye = 0;
130 void set_zangband_reflection(player_type *player_ptr)
132 player_ptr->tim_reflect = 0;
133 player_ptr->multishadow = 0;
134 player_ptr->dustrobe = 0;
137 void rd_zangband_dungeon()
139 max_dlv[DUNGEON_ANGBAND] = rd_s16b();
142 void set_zangband_game_turns(player_type *player_ptr)
144 player_ptr->current_floor_ptr->generated_turn /= 2;
145 player_ptr->feeling_turn /= 2;
146 w_ptr->game_turn /= 2;
147 w_ptr->dungeon_turn /= 2;
150 void set_zangband_gambling_monsters(int i)
152 mon_odds[i] = rd_s16b();
155 void set_zangband_special_attack(player_type *player_ptr)
158 player_ptr->special_attack = ATTACK_CONFUSE;
160 player_ptr->ele_attack = 0;
163 void set_zangband_special_defense(player_type *player_ptr)
165 player_ptr->ele_immune = 0;
166 player_ptr->special_defense = 0;
169 void set_zangband_action(player_type *player_ptr)
172 player_ptr->action = ACTION_LEARN;
175 void set_zangband_visited_towns(player_type *player_ptr)
178 player_ptr->visit = 1L;
181 void set_zangband_quest(player_type *player_ptr, quest_type *const q_ptr, int loading_quest_index, const QUEST_IDX old_inside_quest)
183 if (q_ptr->flags & QUEST_FLAG_PRESET) {
188 init_flags = INIT_ASSIGN;
189 player_ptr->current_floor_ptr->inside_quest = (QUEST_IDX)loading_quest_index;
190 parse_fixed_map(player_ptr, "q_info.txt", 0, 0, 0, 0);
191 player_ptr->current_floor_ptr->inside_quest = old_inside_quest;
194 void set_zangband_class(player_type *player_ptr)
196 if (h_older_than(0, 2, 2) && (player_ptr->pclass == PlayerClassType::BEASTMASTER) && !player_ptr->is_dead) {
197 player_ptr->hitdie = rp_ptr->r_mhp + cp_ptr->c_mhp + ap_ptr->a_mhp;
198 roll_hitdice(player_ptr, SPOP_NONE);
201 if (h_older_than(0, 3, 2) && (player_ptr->pclass == PlayerClassType::ARCHER) && !player_ptr->is_dead) {
202 player_ptr->hitdie = rp_ptr->r_mhp + cp_ptr->c_mhp + ap_ptr->a_mhp;
203 roll_hitdice(player_ptr, SPOP_NONE);
206 if (h_older_than(0, 2, 6) && (player_ptr->pclass == PlayerClassType::SORCERER) && !player_ptr->is_dead) {
207 player_ptr->hitdie = rp_ptr->r_mhp / 2 + cp_ptr->c_mhp + ap_ptr->a_mhp;
208 roll_hitdice(player_ptr, SPOP_NONE);
211 if (h_older_than(0, 4, 7) && (player_ptr->pclass == PlayerClassType::BLUE_MAGE) && !player_ptr->is_dead) {
212 player_ptr->hitdie = rp_ptr->r_mhp + cp_ptr->c_mhp + ap_ptr->a_mhp;
213 roll_hitdice(player_ptr, SPOP_NONE);
217 void set_zangband_learnt_spells(player_type *player_ptr)
219 player_ptr->learned_spells = 0;
220 for (int i = 0; i < 64; i++)
221 if ((i < 32) ? (player_ptr->spell_learned1 & (1UL << i)) : (player_ptr->spell_learned2 & (1UL << (i - 32))))
222 player_ptr->learned_spells++;
225 void set_zangband_pet(player_type *player_ptr)
227 player_ptr->pet_extra_flags = 0;
229 player_ptr->pet_extra_flags |= PF_OPEN_DOORS;
232 player_ptr->pet_extra_flags |= PF_PICKUP_ITEMS;
234 if (h_older_than(0, 0, 4))
235 player_ptr->pet_extra_flags |= PF_TELEPORT;
238 player_ptr->pet_extra_flags |= PF_TELEPORT;
241 if (h_older_than(0, 0, 7))
242 player_ptr->pet_extra_flags |= PF_ATTACK_SPELL;
245 player_ptr->pet_extra_flags |= PF_ATTACK_SPELL;
248 if (h_older_than(0, 0, 8))
249 player_ptr->pet_extra_flags |= PF_SUMMON_SPELL;
252 player_ptr->pet_extra_flags |= PF_SUMMON_SPELL;
255 if (h_older_than(0, 0, 8))
259 player_ptr->pet_extra_flags |= PF_BALL_SPELL;