From c7cf9c90084af553bb62a6ed4bcda99f997eea94 Mon Sep 17 00:00:00 2001 From: Deskull Date: Sat, 17 Nov 2018 17:12:46 +0900 Subject: [PATCH] =?utf8?q?[Refactor]=20#37353=E3=80=80=E6=97=A5=E3=81=AE?= =?utf8?q?=E5=87=BA=E3=80=81=E6=97=A5=E6=B2=A1=E5=87=A6=E7=90=86=E3=82=92?= =?utf8?q?=20process=5Fworld()=20=E3=81=8B=E3=82=89=20day=5Fbreak()=20?= =?utf8?q?=E3=81=A8=20night=5Ffalls()=20=E3=81=B8=E5=88=86=E9=9B=A2?= =?utf8?q?=E3=80=82=20Separate=20day=5Fbreak()=20and=20night=5Ffalls()=20f?= =?utf8?q?rom=20process=5Fworld().?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- Hengband_vcs2015/Hengband/Hengband.vcxproj | 2 + Hengband_vcs2015/Hengband/Hengband.vcxproj.filters | 6 ++ src/Makefile.am | 3 +- src/dungeon.c | 90 +------------------ src/floor-events.c | 100 +++++++++++++++++++++ src/floor-events.h | 2 + 6 files changed, 115 insertions(+), 88 deletions(-) create mode 100644 src/floor-events.c create mode 100644 src/floor-events.h diff --git a/Hengband_vcs2015/Hengband/Hengband.vcxproj b/Hengband_vcs2015/Hengband/Hengband.vcxproj index 7421a44d6..a93fffee2 100644 --- a/Hengband_vcs2015/Hengband/Hengband.vcxproj +++ b/Hengband_vcs2015/Hengband/Hengband.vcxproj @@ -144,6 +144,7 @@ + @@ -256,6 +257,7 @@ + diff --git a/Hengband_vcs2015/Hengband/Hengband.vcxproj.filters b/Hengband_vcs2015/Hengband/Hengband.vcxproj.filters index ccfdd2327..11caa9c6a 100644 --- a/Hengband_vcs2015/Hengband/Hengband.vcxproj.filters +++ b/Hengband_vcs2015/Hengband/Hengband.vcxproj.filters @@ -319,6 +319,9 @@ Source + + Source + @@ -513,6 +516,9 @@ Header + + Header + diff --git a/src/Makefile.am b/src/Makefile.am index 93c2b65de..6675a15cf 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -11,7 +11,8 @@ hengband_SOURCES = \ cmd-quaff.c cmd-quaff.h cmd-read.c cmd-read.h cmd-spell.c cmd-spell.h \ cmd-usestaff.c cmd-usestaff.h cmd-zaprod.c cmd-zaprod.h cmd-zapwand.c \ cmd-zapwand.h defines.h dungeon.c effects.c externs.h files.c flavor.c \ - floor-generate.c floor-save.c floor-streams.c floor-streams.h \ + floor-events.c floor-events.h floor-generate.c floor-save.c \ + floor-streams.c floor-streams.h \ gameoption.c gameoption.h gamevalue.h \ generate.h grid.c grid.h h-basic.h h-config.h h-define.h hissatsu.c \ history.h history.c \ diff --git a/src/dungeon.c b/src/dungeon.c index bcab26b3d..059210ec9 100644 --- a/src/dungeon.c +++ b/src/dungeon.c @@ -21,6 +21,7 @@ #include "cmd-zaprod.h" #include "cmd-zapwand.h" #include "cmd-pet.h" +#include "floor-events.h" static bool load = TRUE; /*!<ロード処理中の分岐フラグ*/ static int wild_regen = 20; /*!<広域マップ移動時の自然回復処理カウンタ(広域マップ1マス毎に20回処理を基本とする)*/ @@ -3461,94 +3462,9 @@ static void process_world(void) /* Check for dawn */ dawn = (!(turn % (TURNS_PER_TICK * TOWN_DAWN))); - /* Day breaks */ - if (dawn) - { - POSITION y, x; - - /* Message */ - msg_print(_("夜が明けた。", "The sun has risen.")); - - if (!p_ptr->wild_mode) - { - /* Hack -- Scan the town */ - for (y = 0; y < cur_hgt; y++) - { - for (x = 0; x < cur_wid; x++) - { - /* Get the cave grid */ - cave_type *c_ptr = &cave[y][x]; - - /* Assume lit */ - c_ptr->info |= (CAVE_GLOW); - - /* Hack -- Memorize lit grids if allowed */ - if (view_perma_grids) c_ptr->info |= (CAVE_MARK); + if (dawn) day_break(); + else night_falls(); - /* Hack -- Notice spot */ - note_spot(y, x); - } - } - } - } - - /* Night falls */ - else - { - POSITION y, x; - - /* Message */ - msg_print(_("日が沈んだ。", "The sun has fallen.")); - - if (!p_ptr->wild_mode) - { - /* Hack -- Scan the town */ - for (y = 0; y < cur_hgt; y++) - { - for (x = 0; x < cur_wid; x++) - { - /* Get the cave grid */ - cave_type *c_ptr = &cave[y][x]; - - /* Feature code (applying "mimic" field) */ - feature_type *f_ptr = &f_info[get_feat_mimic(c_ptr)]; - - if (!is_mirror_grid(c_ptr) && !have_flag(f_ptr->flags, FF_QUEST_ENTER) && - !have_flag(f_ptr->flags, FF_ENTRANCE)) - { - /* Assume dark */ - c_ptr->info &= ~(CAVE_GLOW); - - if (!have_flag(f_ptr->flags, FF_REMEMBER)) - { - /* Forget the normal floor grid */ - c_ptr->info &= ~(CAVE_MARK); - - /* Hack -- Notice spot */ - note_spot(y, x); - } - } - } - - /* Glow deep lava and building entrances */ - glow_deep_lava_and_bldg(); - } - } - } - - /* Update the monsters */ - p_ptr->update |= (PU_MONSTERS | PU_MON_LITE); - - /* Redraw map */ - p_ptr->redraw |= (PR_MAP); - - /* Window stuff */ - p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON); - - if (p_ptr->special_defense & NINJA_S_STEALTH) - { - if (cave[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE); - } } } diff --git a/src/floor-events.c b/src/floor-events.c new file mode 100644 index 000000000..75bb835da --- /dev/null +++ b/src/floor-events.c @@ -0,0 +1,100 @@ +#include "angband.h" + +void day_break() +{ + POSITION y, x; + msg_print(_("夜が明けた。", "The sun has risen.")); + + if (!p_ptr->wild_mode) + { + /* Hack -- Scan the town */ + for (y = 0; y < cur_hgt; y++) + { + for (x = 0; x < cur_wid; x++) + { + /* Get the cave grid */ + cave_type *c_ptr = &cave[y][x]; + + /* Assume lit */ + c_ptr->info |= (CAVE_GLOW); + + /* Hack -- Memorize lit grids if allowed */ + if (view_perma_grids) c_ptr->info |= (CAVE_MARK); + + /* Hack -- Notice spot */ + note_spot(y, x); + } + } + } + + /* Update the monsters */ + p_ptr->update |= (PU_MONSTERS | PU_MON_LITE); + + /* Redraw map */ + p_ptr->redraw |= (PR_MAP); + + /* Window stuff */ + p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON); + + if (p_ptr->special_defense & NINJA_S_STEALTH) + { + if (cave[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE); + } + +} + +void night_falls(void) +{ + POSITION y, x; + msg_print(_("日が沈んだ。", "The sun has fallen.")); + + if (!p_ptr->wild_mode) + { + /* Hack -- Scan the town */ + for (y = 0; y < cur_hgt; y++) + { + for (x = 0; x < cur_wid; x++) + { + /* Get the cave grid */ + cave_type *c_ptr = &cave[y][x]; + + /* Feature code (applying "mimic" field) */ + feature_type *f_ptr = &f_info[get_feat_mimic(c_ptr)]; + + if (!is_mirror_grid(c_ptr) && !have_flag(f_ptr->flags, FF_QUEST_ENTER) && + !have_flag(f_ptr->flags, FF_ENTRANCE)) + { + /* Assume dark */ + c_ptr->info &= ~(CAVE_GLOW); + + if (!have_flag(f_ptr->flags, FF_REMEMBER)) + { + /* Forget the normal floor grid */ + c_ptr->info &= ~(CAVE_MARK); + + /* Hack -- Notice spot */ + note_spot(y, x); + } + } + } + + /* Glow deep lava and building entrances */ + glow_deep_lava_and_bldg(); + } + } + + /* Update the monsters */ + p_ptr->update |= (PU_MONSTERS | PU_MON_LITE); + + /* Redraw map */ + p_ptr->redraw |= (PR_MAP); + + /* Window stuff */ + p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON); + + if (p_ptr->special_defense & NINJA_S_STEALTH) + { + if (cave[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE); + } + +} diff --git a/src/floor-events.h b/src/floor-events.h new file mode 100644 index 000000000..7b022f340 --- /dev/null +++ b/src/floor-events.h @@ -0,0 +1,2 @@ +void day_break(void); +void night_falls(void); -- 2.11.0