diff options
Diffstat (limited to 'src/q_dragons.cc')
-rw-r--r-- | src/q_dragons.cc | 50 |
1 files changed, 31 insertions, 19 deletions
diff --git a/src/q_dragons.cc b/src/q_dragons.cc index 6c6084d1..9f89089c 100644 --- a/src/q_dragons.cc +++ b/src/q_dragons.cc @@ -2,7 +2,10 @@ #include "cave.hpp" #include "cave_type.hpp" +#include "dungeon_flag.hpp" +#include "feature_flag.hpp" #include "feature_type.hpp" +#include "game.hpp" #include "hook_quest_finish_in.hpp" #include "hooks.hpp" #include "init1.hpp" @@ -16,8 +19,10 @@ #define cquest (quest[QUEST_DRAGONS]) -static bool_ quest_dragons_gen_hook(void *, void *, void *) +static bool quest_dragons_gen_hook(void *, void *, void *) { + auto const &f_info = game->edit_data.f_info; + int x, y, i; int xstart = 2; int ystart = 2; @@ -47,18 +52,17 @@ static bool_ quest_dragons_gen_hook(void *, void *, void *) init_flags = INIT_CREATE_DUNGEON; process_dungeon_file("dragons.map", &ystart, &xstart, cur_hgt, cur_wid, TRUE, FALSE); - dungeon_flags2 |= DF2_NO_GENO; + dungeon_flags |= DF_NO_GENO; /* Place some columns */ for (i = 35; i > 0; ) { - int flags; y = rand_int(21) + 3; x = rand_int(31) + 3; /* Bar columns on even squares so the whole level is guaranteed to be accessible */ - flags = f_info[cave[y][x].feat].flags1; - if (!(flags % 2) && !(flags & FF1_PERMANENT) && (flags & FF1_FLOOR)) + auto const flags = f_info[cave[y][x].feat].flags; + if (!(x % 2) && !(flags & FF_PERMANENT) && (flags & FF_FLOOR)) { --i; cave_set_feat(y, x, FEAT_MOUNTAIN); @@ -68,11 +72,10 @@ static bool_ quest_dragons_gen_hook(void *, void *, void *) /* Place some random dragons */ for (i = 25; i > 0; ) { - int m_idx, flags; y = rand_int(21) + 3; x = rand_int(31) + 3; - flags = f_info[cave[y][x].feat].flags1; - if (!(flags & FF1_PERMANENT) && (flags & FF1_FLOOR)) + auto const flags = f_info[cave[y][x].feat].flags; + if (!(flags & FF_PERMANENT) && (flags & FF_FLOOR)) { /* blue, white, red, black, bronze, gold, green, multi-hued */ int baby_dragons[8] = {163, 164, 167, 166, 218, 219, 165, 204}; @@ -94,7 +97,7 @@ static bool_ quest_dragons_gen_hook(void *, void *, void *) dragon = mature_dragons[color]; --i; - m_idx = place_monster_one(y, x, dragon, 0, magik(33), MSTATUS_ENEMY); + int m_idx = place_monster_one(y, x, dragon, 0, magik(33), MSTATUS_ENEMY); if (m_idx) m_list[m_idx].mflag |= MFLAG_QUEST; } } @@ -104,7 +107,7 @@ static bool_ quest_dragons_gen_hook(void *, void *, void *) return TRUE; } -static bool_ quest_dragons_death_hook(void *, void *, void *) +static bool quest_dragons_death_hook(void *, void *, void *) { int i, mcnt = 0; @@ -117,9 +120,15 @@ static bool_ quest_dragons_death_hook(void *, void *, void *) monster_type *m_ptr = &m_list[i]; /* Ignore "dead" monsters */ - if (!m_ptr->r_idx) continue; + if (!m_ptr->r_idx) + { + continue; + } - if (m_ptr->status <= MSTATUS_ENEMY) mcnt++; + if (m_ptr->status <= MSTATUS_ENEMY) + { + mcnt++; + } } /* Nobody left ? */ @@ -131,17 +140,21 @@ static bool_ quest_dragons_death_hook(void *, void *, void *) process_hooks_restart = TRUE; cmsg_print(TERM_YELLOW, "Gondolin is safer now."); - return (FALSE); + return false; } - return FALSE; + + return false; } -static bool_ quest_dragons_finish_hook(void *, void *in_, void *) +static bool quest_dragons_finish_hook(void *, void *in_, void *) { struct hook_quest_finish_in *in = static_cast<struct hook_quest_finish_in *>(in_); s32b q_idx = in->q_idx; - if (q_idx != QUEST_DRAGONS) return FALSE; + if (q_idx != QUEST_DRAGONS) + { + return false; + } c_put_str(TERM_YELLOW, "Thank you for killing the dragons!", 8, 0); c_put_str(TERM_YELLOW, "You can use the cave as your house as a reward.", 9, 0); @@ -149,10 +162,10 @@ static bool_ quest_dragons_finish_hook(void *, void *in_, void *) /* Continue the plot */ *(quest[q_idx].plot) = QUEST_EOL; - return TRUE; + return true; } -bool_ quest_dragons_init_hook(int q_idx) +void quest_dragons_init_hook() { if ((cquest.status >= QUEST_STATUS_UNTAKEN) && (cquest.status < QUEST_STATUS_FINISHED)) { @@ -160,5 +173,4 @@ bool_ quest_dragons_init_hook(int q_idx) add_hook_new(HOOK_QUEST_FINISH, quest_dragons_finish_hook, "dragons_finish", NULL); add_hook_new(HOOK_GEN_QUEST, quest_dragons_gen_hook, "dragons_geb", NULL); } - return (FALSE); } |