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-info/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] & (0x00000001U << 4))
27 option_flag[5] &= ~(0x00000001U << 4);
29 option_flag[5] |= (0x00000001U << 4);
31 if (option_flag[2] & (0x00000001U << 5))
32 option_flag[2] &= ~(0x00000001U << 5);
34 option_flag[2] |= (0x00000001U << 5);
36 if (option_flag[4] & (0x00000001U << 5))
37 option_flag[4] &= ~(0x00000001U << 5);
39 option_flag[4] |= (0x00000001U << 5);
41 if (option_flag[5] & (0x00000001U << 0))
42 option_flag[5] &= ~(0x00000001U << 0);
44 option_flag[5] |= (0x00000001U << 0);
46 if (option_flag[5] & (0x00000001U << 12))
47 option_flag[5] &= ~(0x00000001U << 12);
49 option_flag[5] |= (0x00000001U << 12);
51 if (option_flag[1] & (0x00000001U << 0))
52 option_flag[1] &= ~(0x00000001U << 0);
54 option_flag[1] |= (0x00000001U << 0);
56 if (option_flag[1] & (0x00000001U << 18))
57 option_flag[1] &= ~(0x00000001U << 18);
59 option_flag[1] |= (0x00000001U << 18);
61 if (option_flag[1] & (0x00000001U << 19))
62 option_flag[1] &= ~(0x00000001U << 19);
64 option_flag[1] |= (0x00000001U << 19);
66 if (option_flag[5] & (0x00000001U << 3))
67 option_flag[1] &= ~(0x00000001U << 3);
69 option_flag[5] |= (0x00000001U << 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;
122 void set_zangband_mimic(player_type *creature_ptr)
124 creature_ptr->tim_res_time = 0;
125 creature_ptr->mimic_form = 0;
126 creature_ptr->tim_mimic = 0;
127 creature_ptr->tim_sh_fire = 0;
130 void set_zangband_holy_aura(player_type *creature_ptr)
132 creature_ptr->tim_sh_holy = 0;
133 creature_ptr->tim_eyeeye = 0;
136 void set_zangband_reflection(player_type *creature_ptr)
138 creature_ptr->tim_reflect = 0;
139 creature_ptr->multishadow = 0;
140 creature_ptr->dustrobe = 0;
143 void rd_zangband_dungeon()
147 max_dlv[DUNGEON_ANGBAND] = tmp16s;
150 void set_zangband_game_turns(player_type *creature_ptr)
152 creature_ptr->current_floor_ptr->generated_turn /= 2;
153 creature_ptr->feeling_turn /= 2;
154 current_world_ptr->game_turn /= 2;
155 current_world_ptr->dungeon_turn /= 2;
158 void set_zangband_gambling_monsters(int i)
162 mon_odds[i] = tmp16s;
165 void set_zangband_special_attack(player_type *creature_ptr)
170 creature_ptr->special_attack = ATTACK_CONFUSE;
172 creature_ptr->ele_attack = 0;
175 void set_zangband_special_defense(player_type *creature_ptr)
177 creature_ptr->ele_immune = 0;
178 creature_ptr->special_defense = 0;
181 void set_zangband_action(player_type *creature_ptr)
186 creature_ptr->action = ACTION_LEARN;
189 void set_zangband_visited_towns(player_type *creature_ptr)
193 creature_ptr->visit = 1L;
196 void set_zangband_quest(player_type *creature_ptr, quest_type *const q_ptr, int loading_quest_index, const QUEST_IDX old_inside_quest)
198 if (q_ptr->flags & QUEST_FLAG_PRESET) {
203 init_flags = INIT_ASSIGN;
204 creature_ptr->current_floor_ptr->inside_quest = (QUEST_IDX)loading_quest_index;
205 parse_fixed_map(creature_ptr, "q_info.txt", 0, 0, 0, 0);
206 creature_ptr->current_floor_ptr->inside_quest = old_inside_quest;
209 void set_zangband_class(player_type *creature_ptr)
211 if (h_older_than(0, 2, 2) && (creature_ptr->pclass == CLASS_BEASTMASTER) && !creature_ptr->is_dead) {
212 creature_ptr->hitdie = rp_ptr->r_mhp + cp_ptr->c_mhp + ap_ptr->a_mhp;
213 roll_hitdice(creature_ptr, SPOP_NONE);
216 if (h_older_than(0, 3, 2) && (creature_ptr->pclass == CLASS_ARCHER) && !creature_ptr->is_dead) {
217 creature_ptr->hitdie = rp_ptr->r_mhp + cp_ptr->c_mhp + ap_ptr->a_mhp;
218 roll_hitdice(creature_ptr, SPOP_NONE);
221 if (h_older_than(0, 2, 6) && (creature_ptr->pclass == CLASS_SORCERER) && !creature_ptr->is_dead) {
222 creature_ptr->hitdie = rp_ptr->r_mhp / 2 + cp_ptr->c_mhp + ap_ptr->a_mhp;
223 roll_hitdice(creature_ptr, SPOP_NONE);
226 if (h_older_than(0, 4, 7) && (creature_ptr->pclass == CLASS_BLUE_MAGE) && !creature_ptr->is_dead) {
227 creature_ptr->hitdie = rp_ptr->r_mhp + cp_ptr->c_mhp + ap_ptr->a_mhp;
228 roll_hitdice(creature_ptr, SPOP_NONE);
232 void set_zangband_learnt_spells(player_type *creature_ptr)
234 creature_ptr->learned_spells = 0;
235 for (int i = 0; i < 64; i++)
236 if ((i < 32) ? (creature_ptr->spell_learned1 & (1UL << i)) : (creature_ptr->spell_learned2 & (1UL << (i - 32))))
237 creature_ptr->learned_spells++;
240 void set_zangband_pet(player_type *creature_ptr)
242 creature_ptr->pet_extra_flags = 0;
246 creature_ptr->pet_extra_flags |= PF_OPEN_DOORS;
250 creature_ptr->pet_extra_flags |= PF_PICKUP_ITEMS;
252 if (h_older_than(0, 0, 4))
253 creature_ptr->pet_extra_flags |= PF_TELEPORT;
257 creature_ptr->pet_extra_flags |= PF_TELEPORT;
260 if (h_older_than(0, 0, 7))
261 creature_ptr->pet_extra_flags |= PF_ATTACK_SPELL;
265 creature_ptr->pet_extra_flags |= PF_ATTACK_SPELL;
268 if (h_older_than(0, 0, 8))
269 creature_ptr->pet_extra_flags |= PF_SUMMON_SPELL;
273 creature_ptr->pet_extra_flags |= PF_SUMMON_SPELL;
276 if (h_older_than(0, 0, 8))
281 creature_ptr->pet_extra_flags |= PF_BALL_SPELL;