OSDN Git Service

In the default preferences, use the keys, FontName-0 and FontSize-0, since those...
[hengbandforosx/hengbandosx.git] / src / floor-events.c
1 #include "angband.h"
2 #include "grid.h"
3
4 void day_break()
5 {
6         POSITION y, x;
7         msg_print(_("夜が明けた。", "The sun has risen."));
8
9         if (!p_ptr->wild_mode)
10         {
11                 /* Hack -- Scan the town */
12                 for (y = 0; y < current_floor_ptr->height; y++)
13                 {
14                         for (x = 0; x < current_floor_ptr->width; x++)
15                         {
16                                 grid_type *g_ptr = &current_floor_ptr->grid_array[y][x];
17
18                                 /* Assume lit */
19                                 g_ptr->info |= (CAVE_GLOW);
20
21                                 /* Hack -- Memorize lit grids if allowed */
22                                 if (view_perma_grids) g_ptr->info |= (CAVE_MARK);
23
24                                 /* Hack -- Notice spot */
25                                 note_spot(y, x);
26                         }
27                 }
28         }
29
30         p_ptr->update |= (PU_MONSTERS | PU_MON_LITE);
31         p_ptr->redraw |= (PR_MAP);
32         p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
33
34         if (p_ptr->special_defense & NINJA_S_STEALTH)
35         {
36                 if (current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
37         }
38
39 }
40
41 void night_falls(void)
42 {
43         POSITION y, x;
44         msg_print(_("日が沈んだ。", "The sun has fallen."));
45
46         if (!p_ptr->wild_mode)
47         {
48                 /* Hack -- Scan the town */
49                 for (y = 0; y < current_floor_ptr->height; y++)
50                 {
51                         for (x = 0; x < current_floor_ptr->width; x++)
52                         {
53                                 grid_type *g_ptr = &current_floor_ptr->grid_array[y][x];
54
55                                 /* Feature code (applying "mimic" field) */
56                                 feature_type *f_ptr = &f_info[get_feat_mimic(g_ptr)];
57
58                                 if (!is_mirror_grid(g_ptr) && !have_flag(f_ptr->flags, FF_QUEST_ENTER) &&
59                                         !have_flag(f_ptr->flags, FF_ENTRANCE))
60                                 {
61                                         /* Assume dark */
62                                         g_ptr->info &= ~(CAVE_GLOW);
63
64                                         if (!have_flag(f_ptr->flags, FF_REMEMBER))
65                                         {
66                                                 /* Forget the normal floor grid */
67                                                 g_ptr->info &= ~(CAVE_MARK);
68
69                                                 /* Hack -- Notice spot */
70                                                 note_spot(y, x);
71                                         }
72                                 }
73                         }
74
75                         /* Glow deep lava and building entrances */
76                         glow_deep_lava_and_bldg();
77                 }
78         }
79
80         p_ptr->update |= (PU_MONSTERS | PU_MON_LITE);
81         p_ptr->redraw |= (PR_MAP);
82         p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
83
84         if (p_ptr->special_defense & NINJA_S_STEALTH)
85         {
86                 if (current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
87         }
88
89 }
90
91 /*!
92  * @brief 現在フロアに残っている敵モンスターの数を返す /
93  * @return 現在の敵モンスターの数
94  */
95 MONSTER_NUMBER count_all_hostile_monsters(void)
96 {
97         POSITION x, y;
98         MONSTER_NUMBER number_mon = 0;
99
100         for (x = 0; x < current_floor_ptr->width; ++x)
101         {
102                 for (y = 0; y < current_floor_ptr->height; ++y)
103                 {
104                         MONSTER_IDX m_idx = current_floor_ptr->grid_array[y][x].m_idx;
105
106                         if (m_idx > 0 && is_hostile(&current_floor_ptr->m_list[m_idx]))
107                         {
108                                 ++number_mon;
109                         }
110                 }
111         }
112
113         return number_mon;
114 }
115