1 #include "main/scene-table.h"
2 #include "dungeon/quest.h"
3 #include "main/music-definitions-table.h"
4 #include "system/floor-type-definition.h"
6 static bool scene_basic(player_type *player_ptr, scene_type *value)
8 if (player_ptr->ambush_flag) {
9 value->type = TERM_XTRA_MUSIC_BASIC;
10 value->val = MUSIC_BASIC_AMBUSH;
14 if (player_ptr->wild_mode) {
15 value->type = TERM_XTRA_MUSIC_BASIC;
16 value->val = MUSIC_BASIC_WILD;
20 if (player_ptr->current_floor_ptr->inside_arena) {
21 value->type = TERM_XTRA_MUSIC_BASIC;
22 value->val = MUSIC_BASIC_ARENA;
26 if (player_ptr->phase_out) {
27 value->type = TERM_XTRA_MUSIC_BASIC;
28 value->val = MUSIC_BASIC_BATTLE;
35 static bool scene_quest(player_type *player_ptr, scene_type *value)
37 const QUEST_IDX quest_id = quest_number(player_ptr, player_ptr->current_floor_ptr->dun_level);
38 const bool enable = (quest_id > 0);
40 value->type = TERM_XTRA_MUSIC_QUEST;
41 value->val = quest_id;
47 static bool scene_quest_basic(player_type *player_ptr, scene_type *value)
49 const QUEST_IDX quest_id = quest_number(player_ptr, player_ptr->current_floor_ptr->dun_level);
50 const bool enable = (quest_id > 0);
52 value->type = TERM_XTRA_MUSIC_BASIC;
53 value->val = MUSIC_BASIC_QUEST;
59 static bool scene_town(player_type *player_ptr, scene_type *value)
61 const bool enable = !is_in_dungeon(player_ptr) && (player_ptr->town_num > 0);
63 value->type = TERM_XTRA_MUSIC_TOWN;
64 value->val = player_ptr->town_num;
69 static bool scene_town_basic(player_type *player_ptr, scene_type *value)
71 const bool enable = !is_in_dungeon(player_ptr) && (player_ptr->town_num > 0);
73 value->type = TERM_XTRA_MUSIC_BASIC;
74 value->val = MUSIC_BASIC_TOWN;
79 static bool scene_field(player_type *player_ptr, scene_type *value)
81 const bool enable = !is_in_dungeon(player_ptr);
83 value->type = TERM_XTRA_MUSIC_BASIC;
85 if (player_ptr->lev >= 45)
86 value->val = MUSIC_BASIC_FIELD3;
87 else if (player_ptr->lev >= 25)
88 value->val = MUSIC_BASIC_FIELD2;
90 value->val = MUSIC_BASIC_FIELD1;
95 static bool scene_dungeon_feeling(player_type *player_ptr, scene_type *value)
97 const bool enable = (player_ptr->feeling >= 2);
99 value->type = TERM_XTRA_MUSIC_BASIC;
101 if (player_ptr->feeling == 2)
102 value->val = MUSIC_BASIC_DUN_FEEL2;
104 value->val = MUSIC_BASIC_DUN_FEEL1;
109 static bool scene_dungeon(player_type *player_ptr, scene_type *value)
111 const bool enable = (player_ptr->dungeon_idx > 0);
113 value->type = TERM_XTRA_MUSIC_DUNGEON;
114 value->val = player_ptr->dungeon_idx;
119 static bool scene_dungeon_basic(player_type *player_ptr, scene_type *value)
121 const bool enable = is_in_dungeon(player_ptr);
123 value->type = TERM_XTRA_MUSIC_BASIC;
125 const auto dun_level = player_ptr->current_floor_ptr->dun_level;
127 value->val = MUSIC_BASIC_DUN_HIGH;
128 else if (dun_level >= 40)
129 value->val = MUSIC_BASIC_DUN_MED;
131 value->val = MUSIC_BASIC_DUN_LOW;
136 static bool scene_mute(player_type *player_ptr, scene_type *value)
139 value->type = TERM_XTRA_MUSIC_MUTE;
144 /*! シチュエーション選択のフォールバック設定。
145 * 先頭から適用する(先にある方を優先する)。
147 std::vector<scene_type> playfallback = {
148 // scene_basic : ambush, wild, arena, battleの判定
150 // scene_quest : questの判定(クエストの個別BGMを指定)
152 // scene_quest_basic : questの判定 (Basicのquest指定)
153 { scene_quest_basic },
154 // scene_town : townの判定(町の個別BGMを指定)
156 // scene_town_basic : townの判定 (Basicのtown指定)
157 { scene_town_basic },
158 // scene_field : field1/2/3の判定(プレイヤーレベル25未満、25以上45未満、45以上時の荒野)
160 // scene_dungeon_feeling : feed1/2の判定(ダンジョンの雰囲気が「悪い予感」~「とても危険」、「死の幻」)
161 { scene_dungeon_feeling },
162 // scene_dungeon : dungeonの判定(ダンジョンの個別BGMを指定)
164 // scene_dungeon_basic : dun_low/med/highの判定(ダンジョンレベルが40未満、40以上80未満、80以上)
165 { scene_dungeon_basic },
166 // scene_mute : 最後にミュートを配置する
170 void refresh_scene_table(player_type *player_ptr)
172 for (auto &item : playfallback) {
173 if (!item.update(player_ptr, &item)) {
174 // Note -- 特に定義を設けていないが、type = 0は無効な値とする。
181 std::vector<scene_type>::iterator get_scene_table_iterator()
183 return playfallback.begin();