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/race-info.h"
14 #include "player/attack-defense-types.h"
15 #include "player/patron.h"
16 #include "player/player-class.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 *creature_ptr)
77 if (creature_ptr->realm1 == 9)
78 creature_ptr->realm1 = REALM_MUSIC;
80 if (creature_ptr->realm2 == 9)
81 creature_ptr->realm2 = REALM_MUSIC;
83 if (creature_ptr->realm1 == 10)
84 creature_ptr->realm1 = REALM_HISSATSU;
86 if (creature_ptr->realm2 == 10)
87 creature_ptr->realm2 = REALM_HISSATSU;
90 void set_zangband_skill(player_type *creature_ptr)
92 if (creature_ptr->pclass != CLASS_BEASTMASTER)
93 creature_ptr->skill_exp[SKILL_RIDING] /= 2;
95 creature_ptr->skill_exp[SKILL_RIDING] = MIN(creature_ptr->skill_exp[SKILL_RIDING], s_info[creature_ptr->pclass].s_max[SKILL_RIDING]);
98 void set_zangband_spells(player_type *creature_ptr)
100 for (int i = 0; i < MAX_SPELLS; i++)
101 creature_ptr->magic_num1[i] = 0;
103 for (int i = 0; i < MAX_SPELLS; i++)
104 creature_ptr->magic_num2[i] = 0;
107 void set_zangband_race(player_type *creature_ptr)
109 creature_ptr->start_race = creature_ptr->prace;
110 creature_ptr->old_race1 = 0L;
111 creature_ptr->old_race2 = 0L;
112 creature_ptr->old_realm = 0;
115 void set_zangband_bounty_uniques(player_type *creature_ptr)
117 determine_bounty_uniques(creature_ptr);
118 for (int i = 0; i < MAX_BOUNTY; i++) {
119 /* Is this bounty unique already dead? */
120 if (!r_info[current_world_ptr->bounty_r_idx[i]].max_num)
121 current_world_ptr->bounty_r_idx[i] += 10000;
125 void set_zangband_mimic(player_type *creature_ptr)
127 creature_ptr->tim_res_time = 0;
128 creature_ptr->mimic_form = 0;
129 creature_ptr->tim_mimic = 0;
130 creature_ptr->tim_sh_fire = 0;
133 void set_zangband_holy_aura(player_type *creature_ptr)
135 creature_ptr->tim_sh_holy = 0;
136 creature_ptr->tim_eyeeye = 0;
139 void set_zangband_reflection(player_type *creature_ptr)
141 creature_ptr->tim_reflect = 0;
142 creature_ptr->multishadow = 0;
143 creature_ptr->dustrobe = 0;
146 void rd_zangband_dungeon()
150 max_dlv[DUNGEON_ANGBAND] = tmp16s;
153 void set_zangband_game_turns(player_type *creature_ptr)
155 creature_ptr->current_floor_ptr->generated_turn /= 2;
156 creature_ptr->feeling_turn /= 2;
157 current_world_ptr->game_turn /= 2;
158 current_world_ptr->dungeon_turn /= 2;
161 void set_zangband_gambling_monsters(int i)
165 mon_odds[i] = tmp16s;
168 void set_zangband_special_attack(player_type *creature_ptr)
173 creature_ptr->special_attack = ATTACK_CONFUSE;
175 creature_ptr->ele_attack = 0;
178 void set_zangband_special_defense(player_type *creature_ptr)
180 creature_ptr->ele_immune = 0;
181 creature_ptr->special_defense = 0;
184 void set_zangband_action(player_type *creature_ptr)
189 creature_ptr->action = ACTION_LEARN;
192 void set_zangband_visited_towns(player_type *creature_ptr)
196 creature_ptr->visit = 1L;
199 void set_zangband_quest(player_type *creature_ptr, quest_type *const q_ptr, int loading_quest_index, const QUEST_IDX old_inside_quest)
201 if (q_ptr->flags & QUEST_FLAG_PRESET) {
206 init_flags = INIT_ASSIGN;
207 creature_ptr->current_floor_ptr->inside_quest = (QUEST_IDX)loading_quest_index;
208 parse_fixed_map(creature_ptr, "q_info.txt", 0, 0, 0, 0);
209 creature_ptr->current_floor_ptr->inside_quest = old_inside_quest;
212 void set_zangband_class(player_type *creature_ptr)
214 if (h_older_than(0, 2, 2) && (creature_ptr->pclass == CLASS_BEASTMASTER) && !creature_ptr->is_dead) {
215 creature_ptr->hitdie = rp_ptr->r_mhp + cp_ptr->c_mhp + ap_ptr->a_mhp;
216 roll_hitdice(creature_ptr, SPOP_NONE);
219 if (h_older_than(0, 3, 2) && (creature_ptr->pclass == CLASS_ARCHER) && !creature_ptr->is_dead) {
220 creature_ptr->hitdie = rp_ptr->r_mhp + cp_ptr->c_mhp + ap_ptr->a_mhp;
221 roll_hitdice(creature_ptr, SPOP_NONE);
224 if (h_older_than(0, 2, 6) && (creature_ptr->pclass == CLASS_SORCERER) && !creature_ptr->is_dead) {
225 creature_ptr->hitdie = rp_ptr->r_mhp / 2 + cp_ptr->c_mhp + ap_ptr->a_mhp;
226 roll_hitdice(creature_ptr, SPOP_NONE);
229 if (h_older_than(0, 4, 7) && (creature_ptr->pclass == CLASS_BLUE_MAGE) && !creature_ptr->is_dead) {
230 creature_ptr->hitdie = rp_ptr->r_mhp + cp_ptr->c_mhp + ap_ptr->a_mhp;
231 roll_hitdice(creature_ptr, SPOP_NONE);
235 void set_zangband_learnt_spells(player_type *creature_ptr)
237 creature_ptr->learned_spells = 0;
238 for (int i = 0; i < 64; i++)
239 if ((i < 32) ? (creature_ptr->spell_learned1 & (1UL << i)) : (creature_ptr->spell_learned2 & (1UL << (i - 32))))
240 creature_ptr->learned_spells++;
243 void set_zangband_pet(player_type *creature_ptr)
245 creature_ptr->pet_extra_flags = 0;
249 creature_ptr->pet_extra_flags |= PF_OPEN_DOORS;
253 creature_ptr->pet_extra_flags |= PF_PICKUP_ITEMS;
255 if (h_older_than(0, 0, 4))
256 creature_ptr->pet_extra_flags |= PF_TELEPORT;
260 creature_ptr->pet_extra_flags |= PF_TELEPORT;
263 if (h_older_than(0, 0, 7))
264 creature_ptr->pet_extra_flags |= PF_ATTACK_SPELL;
268 creature_ptr->pet_extra_flags |= PF_ATTACK_SPELL;
271 if (h_older_than(0, 0, 8))
272 creature_ptr->pet_extra_flags |= PF_SUMMON_SPELL;
276 creature_ptr->pet_extra_flags |= PF_SUMMON_SPELL;
279 if (h_older_than(0, 0, 8))
284 creature_ptr->pet_extra_flags |= PF_BALL_SPELL;