Pause and equipment menu now available in adventures.
This commit is contained in:
@@ -53,18 +53,21 @@ int run_main_menu() {
|
||||
wait(5);
|
||||
|
||||
if (key_pressed(KEY_DOWN)) {
|
||||
play_menu_move_sound();
|
||||
selection++;
|
||||
if (selection >= options.length()) selection = 0;
|
||||
speak_with_history(options[selection], true);
|
||||
}
|
||||
|
||||
if (key_pressed(KEY_UP)) {
|
||||
play_menu_move_sound();
|
||||
selection--;
|
||||
if (selection < 0) selection = options.length() - 1;
|
||||
speak_with_history(options[selection], true);
|
||||
}
|
||||
|
||||
if (key_pressed(KEY_RETURN)) {
|
||||
play_menu_select_sound();
|
||||
return selection;
|
||||
}
|
||||
|
||||
|
||||
BIN
sounds/menu/menu_move.ogg
LFS
Normal file
BIN
sounds/menu/menu_move.ogg
LFS
Normal file
Binary file not shown.
BIN
sounds/menu/menu_select.ogg
LFS
Normal file
BIN
sounds/menu/menu_select.ogg
LFS
Normal file
Binary file not shown.
@@ -59,18 +59,21 @@ void run_adventure_menu(int player_x) {
|
||||
}
|
||||
|
||||
if (key_pressed(KEY_DOWN)) {
|
||||
play_menu_move_sound();
|
||||
selection++;
|
||||
if (selection >= options.length()) selection = 0;
|
||||
speak_with_history(options[selection], true);
|
||||
}
|
||||
|
||||
if (key_pressed(KEY_UP)) {
|
||||
play_menu_move_sound();
|
||||
selection--;
|
||||
if (selection < 0) selection = options.length() - 1;
|
||||
speak_with_history(options[selection], true);
|
||||
}
|
||||
|
||||
if (key_pressed(KEY_RETURN)) {
|
||||
play_menu_select_sound();
|
||||
start_adventure(adventure_ids[selection]);
|
||||
// Adventure has finished (it blocks until done)
|
||||
// Resume main game ambience
|
||||
@@ -82,9 +85,11 @@ void run_adventure_menu(int player_x) {
|
||||
|
||||
void start_adventure(int adventure_id) {
|
||||
last_adventure_day = current_day;
|
||||
menuBackgroundUpdatesEnabled = false;
|
||||
if (adventure_id == 1) {
|
||||
run_unicorn_adventure();
|
||||
} else if (adventure_id == ADVENTURE_BANDIT_HIDEOUT) {
|
||||
run_bandit_hideout_adventure();
|
||||
}
|
||||
menuBackgroundUpdatesEnabled = true;
|
||||
}
|
||||
|
||||
@@ -55,6 +55,22 @@ timer hideoutSearchDelayTimer;
|
||||
timer hideoutJumpTimer;
|
||||
bool hideoutSearching = false;
|
||||
|
||||
void restart_hideout_adventure_timers() {
|
||||
hideoutWalkTimer.restart();
|
||||
hideoutAttackTimer.restart();
|
||||
hideoutSearchTimer.restart();
|
||||
hideoutSearchDelayTimer.restart();
|
||||
hideoutJumpTimer.restart();
|
||||
bow_draw_timer.restart();
|
||||
bow_shot_timer.restart();
|
||||
sling_charge_timer.restart();
|
||||
|
||||
for (uint i = 0; i < hideoutBandits.length(); i++) {
|
||||
hideoutBandits[i].moveTimer.restart();
|
||||
hideoutBandits[i].attackTimer.restart();
|
||||
}
|
||||
}
|
||||
|
||||
string pick_hideout_terrain() {
|
||||
int roll = random(0, 2);
|
||||
if (roll == 0) return "grass";
|
||||
@@ -215,6 +231,7 @@ void init_bandit_hideout_adventure() {
|
||||
build_hideout_terrain();
|
||||
clear_hideout_bandits();
|
||||
spawn_hideout_bandits_initial();
|
||||
restart_hideout_adventure_timers();
|
||||
}
|
||||
|
||||
void cleanup_bandit_hideout_adventure() {
|
||||
@@ -241,9 +258,28 @@ void run_bandit_hideout_adventure() {
|
||||
intro.insert_last("Bandits will, of course, not take this lying down.");
|
||||
text_reader_lines(intro, "Adventure", true);
|
||||
|
||||
bool adventurePaused = false;
|
||||
while (true) {
|
||||
wait(5);
|
||||
|
||||
if (key_pressed(KEY_BACK)) {
|
||||
adventurePaused = !adventurePaused;
|
||||
if (adventurePaused) {
|
||||
p.pause_all();
|
||||
speak_with_history("Paused. Press backspace to resume.", true);
|
||||
} else {
|
||||
p.resume_all();
|
||||
restart_hideout_adventure_timers();
|
||||
restart_all_timers();
|
||||
speak_with_history("Resumed.", true);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (adventurePaused) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (key_pressed(KEY_ESCAPE)) {
|
||||
cleanup_bandit_hideout_adventure();
|
||||
speak_with_history("You flee the hideout.", true);
|
||||
@@ -252,6 +288,7 @@ void run_bandit_hideout_adventure() {
|
||||
|
||||
// Standard game keys
|
||||
check_quick_slot_keys();
|
||||
check_equipment_menu();
|
||||
check_notification_keys();
|
||||
check_speech_history_keys();
|
||||
|
||||
|
||||
@@ -52,6 +52,16 @@ bool unicorn_defeated = false;
|
||||
bool unicorn_defeated_by_fall = false;
|
||||
bool unicorn_in_weapon_range = false;
|
||||
|
||||
void restart_unicorn_adventure_timers() {
|
||||
arena_jump_timer.restart();
|
||||
arena_walk_timer.restart();
|
||||
arena_attack_timer.restart();
|
||||
unicorn.move_timer.restart();
|
||||
bow_draw_timer.restart();
|
||||
bow_shot_timer.restart();
|
||||
sling_charge_timer.restart();
|
||||
}
|
||||
|
||||
void init_unicorn_adventure() {
|
||||
unicorn.reset();
|
||||
unicorn.x = UNICORN_ARENA_SIZE - 1; // Start at east end
|
||||
@@ -70,6 +80,7 @@ void init_unicorn_adventure() {
|
||||
bridge_supports_health.resize(2);
|
||||
bridge_supports_health[0] = BRIDGE_SUPPORT_MAX_HEALTH; // Left support at BRIDGE_START
|
||||
bridge_supports_health[1] = BRIDGE_SUPPORT_MAX_HEALTH; // Right support at BRIDGE_END
|
||||
restart_unicorn_adventure_timers();
|
||||
}
|
||||
|
||||
void cleanup_unicorn_adventure() {
|
||||
@@ -108,9 +119,28 @@ void run_unicorn_adventure() {
|
||||
text_reader_lines(intro, "Adventure", true);
|
||||
|
||||
// Adventure Loop
|
||||
bool adventurePaused = false;
|
||||
while (true) {
|
||||
wait(5);
|
||||
|
||||
|
||||
if (key_pressed(KEY_BACK)) {
|
||||
adventurePaused = !adventurePaused;
|
||||
if (adventurePaused) {
|
||||
p.pause_all();
|
||||
speak_with_history("Paused. Press backspace to resume.", true);
|
||||
} else {
|
||||
p.resume_all();
|
||||
restart_unicorn_adventure_timers();
|
||||
restart_all_timers();
|
||||
speak_with_history("Resumed.", true);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (adventurePaused) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Input Handling
|
||||
if (key_pressed(KEY_ESCAPE)) {
|
||||
cleanup_unicorn_adventure();
|
||||
@@ -120,6 +150,7 @@ void run_unicorn_adventure() {
|
||||
|
||||
// Standard game keys
|
||||
check_quick_slot_keys();
|
||||
check_equipment_menu();
|
||||
check_notification_keys();
|
||||
check_speech_history_keys();
|
||||
|
||||
|
||||
@@ -42,18 +42,21 @@ void run_barricade_menu() {
|
||||
}
|
||||
|
||||
if (key_pressed(KEY_DOWN)) {
|
||||
play_menu_move_sound();
|
||||
selection++;
|
||||
if (selection >= options.length()) selection = 0;
|
||||
speak_with_history(options[selection], true);
|
||||
}
|
||||
|
||||
if (key_pressed(KEY_UP)) {
|
||||
play_menu_move_sound();
|
||||
selection--;
|
||||
if (selection < 0) selection = options.length() - 1;
|
||||
speak_with_history(options[selection], true);
|
||||
}
|
||||
|
||||
if (key_pressed(KEY_RETURN)) {
|
||||
play_menu_select_sound();
|
||||
int action = action_types[selection];
|
||||
if (action == 0) reinforce_barricade_with_sticks();
|
||||
else if (action == 1) reinforce_barricade_with_vines();
|
||||
@@ -63,6 +66,7 @@ void run_barricade_menu() {
|
||||
}
|
||||
|
||||
if (key_pressed(KEY_TAB)) {
|
||||
play_menu_select_sound();
|
||||
int action = action_types[selection];
|
||||
if (action == 0) reinforce_barricade_max_with_sticks();
|
||||
else if (action == 1) reinforce_barricade_max_with_vines();
|
||||
|
||||
@@ -102,18 +102,21 @@ void run_buildings_menu() {
|
||||
}
|
||||
|
||||
if (key_pressed(KEY_DOWN)) {
|
||||
play_menu_move_sound();
|
||||
selection++;
|
||||
if (selection >= options.length()) selection = 0;
|
||||
speak_with_history(options[selection], true);
|
||||
}
|
||||
|
||||
if (key_pressed(KEY_UP)) {
|
||||
play_menu_move_sound();
|
||||
selection--;
|
||||
if (selection < 0) selection = options.length() - 1;
|
||||
speak_with_history(options[selection], true);
|
||||
}
|
||||
|
||||
if (key_pressed(KEY_RETURN)) {
|
||||
play_menu_select_sound();
|
||||
int building = building_types[selection];
|
||||
if (building == 0) craft_firepit();
|
||||
else if (building == 1) craft_campfire();
|
||||
|
||||
@@ -65,18 +65,21 @@ void run_clothing_menu() {
|
||||
}
|
||||
|
||||
if (key_pressed(KEY_DOWN)) {
|
||||
play_menu_move_sound();
|
||||
selection++;
|
||||
if (selection >= options.length()) selection = 0;
|
||||
speak_with_history(options[selection], true);
|
||||
}
|
||||
|
||||
if (key_pressed(KEY_UP)) {
|
||||
play_menu_move_sound();
|
||||
selection--;
|
||||
if (selection < 0) selection = options.length() - 1;
|
||||
speak_with_history(options[selection], true);
|
||||
}
|
||||
|
||||
if (key_pressed(KEY_RETURN)) {
|
||||
play_menu_select_sound();
|
||||
if (selection == 0) craft_skin_hat();
|
||||
else if (selection == 1) craft_skin_gloves();
|
||||
else if (selection == 2) craft_skin_pants();
|
||||
@@ -88,6 +91,7 @@ void run_clothing_menu() {
|
||||
}
|
||||
|
||||
if (key_pressed(KEY_TAB)) {
|
||||
play_menu_select_sound();
|
||||
if (selection == 0) craft_skin_hat_max();
|
||||
else if (selection == 1) craft_skin_gloves_max();
|
||||
else if (selection == 2) craft_skin_pants_max();
|
||||
|
||||
@@ -20,18 +20,21 @@ void run_materials_menu() {
|
||||
}
|
||||
|
||||
if (key_pressed(KEY_DOWN)) {
|
||||
play_menu_move_sound();
|
||||
selection++;
|
||||
if (selection >= options.length()) selection = 0;
|
||||
speak_with_history(options[selection], true);
|
||||
}
|
||||
|
||||
if (key_pressed(KEY_UP)) {
|
||||
play_menu_move_sound();
|
||||
selection--;
|
||||
if (selection < 0) selection = options.length() - 1;
|
||||
speak_with_history(options[selection], true);
|
||||
}
|
||||
|
||||
if (key_pressed(KEY_RETURN)) {
|
||||
play_menu_select_sound();
|
||||
if (selection == 0) butcher_small_game();
|
||||
else if (selection == 1) craft_smoke_fish();
|
||||
else if (selection == 2) craft_arrows();
|
||||
@@ -41,6 +44,7 @@ void run_materials_menu() {
|
||||
}
|
||||
|
||||
if (key_pressed(KEY_TAB)) {
|
||||
play_menu_select_sound();
|
||||
if (selection == 0) butcher_small_game_max();
|
||||
else if (selection == 1) craft_smoke_fish_max();
|
||||
else if (selection == 2) craft_arrows_max();
|
||||
|
||||
@@ -105,18 +105,21 @@ void run_runes_menu() {
|
||||
}
|
||||
|
||||
if (key_pressed(KEY_DOWN)) {
|
||||
play_menu_move_sound();
|
||||
selection++;
|
||||
if (selection >= int(rune_options.length())) selection = 0;
|
||||
speak_with_history(rune_options[selection], true);
|
||||
}
|
||||
|
||||
if (key_pressed(KEY_UP)) {
|
||||
play_menu_move_sound();
|
||||
selection--;
|
||||
if (selection < 0) selection = int(rune_options.length()) - 1;
|
||||
speak_with_history(rune_options[selection], true);
|
||||
}
|
||||
|
||||
if (key_pressed(KEY_RETURN)) {
|
||||
play_menu_select_sound();
|
||||
int rune_type = rune_types[selection];
|
||||
run_rune_equipment_menu(rune_type);
|
||||
break;
|
||||
@@ -158,24 +161,28 @@ void run_rune_equipment_menu(int rune_type) {
|
||||
}
|
||||
|
||||
if (key_pressed(KEY_DOWN)) {
|
||||
play_menu_move_sound();
|
||||
selection++;
|
||||
if (selection >= int(equipment_options.length())) selection = 0;
|
||||
speak_with_history(equipment_options[selection], true);
|
||||
}
|
||||
|
||||
if (key_pressed(KEY_UP)) {
|
||||
play_menu_move_sound();
|
||||
selection--;
|
||||
if (selection < 0) selection = int(equipment_options.length()) - 1;
|
||||
speak_with_history(equipment_options[selection], true);
|
||||
}
|
||||
|
||||
if (key_pressed(KEY_RETURN)) {
|
||||
play_menu_select_sound();
|
||||
int equip_type = equipment_types[selection];
|
||||
engrave_rune(equip_type, rune_type);
|
||||
break;
|
||||
}
|
||||
|
||||
if (key_pressed(KEY_TAB)) {
|
||||
play_menu_select_sound();
|
||||
int equip_type = equipment_types[selection];
|
||||
engrave_rune_max(equip_type, rune_type);
|
||||
break;
|
||||
|
||||
@@ -24,18 +24,21 @@ void run_tools_menu() {
|
||||
}
|
||||
|
||||
if (key_pressed(KEY_DOWN)) {
|
||||
play_menu_move_sound();
|
||||
selection++;
|
||||
if (selection >= options.length()) selection = 0;
|
||||
speak_with_history(options[selection], true);
|
||||
}
|
||||
|
||||
if (key_pressed(KEY_UP)) {
|
||||
play_menu_move_sound();
|
||||
selection--;
|
||||
if (selection < 0) selection = options.length() - 1;
|
||||
speak_with_history(options[selection], true);
|
||||
}
|
||||
|
||||
if (key_pressed(KEY_RETURN)) {
|
||||
play_menu_select_sound();
|
||||
if (selection == 0) craft_knife();
|
||||
else if (selection == 1) craft_snare();
|
||||
else if (selection == 2) craft_axe();
|
||||
@@ -49,6 +52,7 @@ void run_tools_menu() {
|
||||
}
|
||||
|
||||
if (key_pressed(KEY_TAB)) {
|
||||
play_menu_select_sound();
|
||||
if (selection == 0) craft_knife_max();
|
||||
else if (selection == 1) craft_snare_max();
|
||||
else if (selection == 2) craft_axe_max();
|
||||
|
||||
@@ -18,18 +18,21 @@ void run_weapons_menu() {
|
||||
}
|
||||
|
||||
if (key_pressed(KEY_DOWN)) {
|
||||
play_menu_move_sound();
|
||||
selection++;
|
||||
if (selection >= options.length()) selection = 0;
|
||||
speak_with_history(options[selection], true);
|
||||
}
|
||||
|
||||
if (key_pressed(KEY_UP)) {
|
||||
play_menu_move_sound();
|
||||
selection--;
|
||||
if (selection < 0) selection = options.length() - 1;
|
||||
speak_with_history(options[selection], true);
|
||||
}
|
||||
|
||||
if (key_pressed(KEY_RETURN)) {
|
||||
play_menu_select_sound();
|
||||
if (selection == 0) craft_spear();
|
||||
else if (selection == 1) craft_sling();
|
||||
else if (selection == 2) craft_bow();
|
||||
@@ -37,6 +40,7 @@ void run_weapons_menu() {
|
||||
}
|
||||
|
||||
if (key_pressed(KEY_TAB)) {
|
||||
play_menu_select_sound();
|
||||
if (selection == 0) craft_spear_max();
|
||||
else if (selection == 1) craft_sling_max();
|
||||
else if (selection == 2) craft_bow_max();
|
||||
|
||||
@@ -45,18 +45,21 @@ void run_crafting_menu() {
|
||||
}
|
||||
|
||||
if (key_pressed(KEY_DOWN)) {
|
||||
play_menu_move_sound();
|
||||
selection++;
|
||||
if (selection >= int(categories.length())) selection = 0;
|
||||
speak_with_history(categories[selection], true);
|
||||
}
|
||||
|
||||
if (key_pressed(KEY_UP)) {
|
||||
play_menu_move_sound();
|
||||
selection--;
|
||||
if (selection < 0) selection = int(categories.length()) - 1;
|
||||
speak_with_history(categories[selection], true);
|
||||
}
|
||||
|
||||
if (key_pressed(KEY_RETURN)) {
|
||||
play_menu_select_sound();
|
||||
int category = category_types[selection];
|
||||
if (category == 0) run_weapons_menu();
|
||||
else if (category == 1) run_tools_menu();
|
||||
|
||||
@@ -143,18 +143,21 @@ void run_fylgja_menu() {
|
||||
}
|
||||
|
||||
if (key_pressed(KEY_DOWN)) {
|
||||
play_menu_move_sound();
|
||||
selection++;
|
||||
if (selection >= int(options.length())) selection = 0;
|
||||
speak_with_history(options[selection], true);
|
||||
}
|
||||
|
||||
if (key_pressed(KEY_UP)) {
|
||||
play_menu_move_sound();
|
||||
selection--;
|
||||
if (selection < 0) selection = int(options.length()) - 1;
|
||||
speak_with_history(options[selection], true);
|
||||
}
|
||||
|
||||
if (key_pressed(KEY_RETURN)) {
|
||||
play_menu_select_sound();
|
||||
int chosenIndex = fylgjaIndices[selection];
|
||||
if (activate_fylgja(chosenIndex)) {
|
||||
lastFylgjaDay = current_day;
|
||||
|
||||
@@ -284,6 +284,7 @@ void run_action_menu(int x) {
|
||||
|
||||
if (key_pressed(KEY_DOWN)) {
|
||||
if (filtered_options.length() > 0) {
|
||||
play_menu_move_sound();
|
||||
selection++;
|
||||
if (selection >= int(filtered_options.length())) selection = 0;
|
||||
speak_with_history(filtered_options[selection], true);
|
||||
@@ -292,6 +293,7 @@ void run_action_menu(int x) {
|
||||
|
||||
if (key_pressed(KEY_UP)) {
|
||||
if (filtered_options.length() > 0) {
|
||||
play_menu_move_sound();
|
||||
selection--;
|
||||
if (selection < 0) selection = int(filtered_options.length()) - 1;
|
||||
speak_with_history(filtered_options[selection], true);
|
||||
@@ -302,6 +304,7 @@ void run_action_menu(int x) {
|
||||
if (filtered_indices.length() == 0) {
|
||||
continue;
|
||||
}
|
||||
play_menu_select_sound();
|
||||
int action = action_types[filtered_indices[selection]];
|
||||
if (action == 0) {
|
||||
try_place_snare(x);
|
||||
@@ -327,6 +330,7 @@ void run_action_menu(int x) {
|
||||
if (filtered_indices.length() == 0) {
|
||||
continue;
|
||||
}
|
||||
play_menu_select_sound();
|
||||
int action = action_types[filtered_indices[selection]];
|
||||
if (action == 0) {
|
||||
speak_with_history("Can't do that.", true);
|
||||
|
||||
@@ -109,6 +109,7 @@ void run_altar_menu() {
|
||||
|
||||
if (key_pressed(KEY_DOWN)) {
|
||||
if (filtered_options.length() > 0) {
|
||||
play_menu_move_sound();
|
||||
selection++;
|
||||
if (selection >= int(filtered_options.length())) selection = 0;
|
||||
speak_with_history(filtered_options[selection], true);
|
||||
@@ -117,6 +118,7 @@ void run_altar_menu() {
|
||||
|
||||
if (key_pressed(KEY_UP)) {
|
||||
if (filtered_options.length() > 0) {
|
||||
play_menu_move_sound();
|
||||
selection--;
|
||||
if (selection < 0) selection = int(filtered_options.length()) - 1;
|
||||
speak_with_history(filtered_options[selection], true);
|
||||
@@ -125,6 +127,7 @@ void run_altar_menu() {
|
||||
|
||||
if (key_pressed(KEY_RETURN)) {
|
||||
if (filtered_indices.length() > 0) {
|
||||
play_menu_select_sound();
|
||||
sacrifice_item(item_types[filtered_indices[selection]]);
|
||||
build_personal_inventory_options(options, item_types);
|
||||
apply_menu_filter(filter_text, options, filtered_indices, filtered_options);
|
||||
@@ -139,6 +142,7 @@ void run_altar_menu() {
|
||||
|
||||
if (key_pressed(KEY_TAB)) {
|
||||
if (filtered_indices.length() > 0) {
|
||||
play_menu_select_sound();
|
||||
sacrifice_item_max(item_types[filtered_indices[selection]]);
|
||||
build_personal_inventory_options(options, item_types);
|
||||
apply_menu_filter(filter_text, options, filtered_indices, filtered_options);
|
||||
|
||||
@@ -77,6 +77,7 @@ void run_base_info_menu() {
|
||||
|
||||
if (key_pressed(KEY_DOWN)) {
|
||||
if (filtered_options.length() > 0) {
|
||||
play_menu_move_sound();
|
||||
selection++;
|
||||
if (selection >= int(filtered_options.length())) selection = 0;
|
||||
speak_with_history(filtered_options[selection], true);
|
||||
@@ -85,6 +86,7 @@ void run_base_info_menu() {
|
||||
|
||||
if (key_pressed(KEY_UP)) {
|
||||
if (filtered_options.length() > 0) {
|
||||
play_menu_move_sound();
|
||||
selection--;
|
||||
if (selection < 0) selection = int(filtered_options.length()) - 1;
|
||||
speak_with_history(filtered_options[selection], true);
|
||||
|
||||
@@ -181,6 +181,7 @@ void run_equipment_menu() {
|
||||
|
||||
if (key_pressed(KEY_DOWN)) {
|
||||
if (filtered_options.length() > 0) {
|
||||
play_menu_move_sound();
|
||||
selection++;
|
||||
if (selection >= int(filtered_options.length())) selection = 0;
|
||||
speak_with_history(filtered_options[selection], true);
|
||||
@@ -189,6 +190,7 @@ void run_equipment_menu() {
|
||||
|
||||
if (key_pressed(KEY_UP)) {
|
||||
if (filtered_options.length() > 0) {
|
||||
play_menu_move_sound();
|
||||
selection--;
|
||||
if (selection < 0) selection = int(filtered_options.length()) - 1;
|
||||
speak_with_history(filtered_options[selection], true);
|
||||
@@ -211,6 +213,7 @@ void run_equipment_menu() {
|
||||
if (filtered_indices.length() == 0) {
|
||||
continue;
|
||||
}
|
||||
play_menu_select_sound();
|
||||
int equip_type = equipment_types[filtered_indices[selection]];
|
||||
int rune_type = rune_types[filtered_indices[selection]];
|
||||
string name = get_full_equipment_name(equip_type, rune_type);
|
||||
|
||||
@@ -88,18 +88,21 @@ void run_inventory_root_menu() {
|
||||
}
|
||||
|
||||
if (key_pressed(KEY_DOWN)) {
|
||||
play_menu_move_sound();
|
||||
selection++;
|
||||
if (selection >= options.length()) selection = 0;
|
||||
speak_with_history(options[selection], true);
|
||||
}
|
||||
|
||||
if (key_pressed(KEY_UP)) {
|
||||
play_menu_move_sound();
|
||||
selection--;
|
||||
if (selection < 0) selection = options.length() - 1;
|
||||
speak_with_history(options[selection], true);
|
||||
}
|
||||
|
||||
if (key_pressed(KEY_RETURN)) {
|
||||
play_menu_select_sound();
|
||||
if (selection == 0) run_inventory_menu(true);
|
||||
else run_storage_menu();
|
||||
break;
|
||||
@@ -142,6 +145,7 @@ void run_inventory_menu(bool allow_deposit) {
|
||||
|
||||
if (key_pressed(KEY_DOWN)) {
|
||||
if (filtered_options.length() > 0) {
|
||||
play_menu_move_sound();
|
||||
selection++;
|
||||
if (selection >= int(filtered_options.length())) selection = 0;
|
||||
speak_with_history(filtered_options[selection], true);
|
||||
@@ -150,6 +154,7 @@ void run_inventory_menu(bool allow_deposit) {
|
||||
|
||||
if (key_pressed(KEY_UP)) {
|
||||
if (filtered_options.length() > 0) {
|
||||
play_menu_move_sound();
|
||||
selection--;
|
||||
if (selection < 0) selection = int(filtered_options.length()) - 1;
|
||||
speak_with_history(filtered_options[selection], true);
|
||||
@@ -168,6 +173,7 @@ void run_inventory_menu(bool allow_deposit) {
|
||||
|
||||
if (allow_deposit && key_pressed(KEY_RETURN)) {
|
||||
if (filtered_indices.length() > 0) {
|
||||
play_menu_select_sound();
|
||||
deposit_item(item_types[filtered_indices[selection]]);
|
||||
build_personal_inventory_options(options, item_types);
|
||||
apply_menu_filter(filter_text, options, filtered_indices, filtered_options);
|
||||
@@ -182,6 +188,7 @@ void run_inventory_menu(bool allow_deposit) {
|
||||
|
||||
if (allow_deposit && key_pressed(KEY_TAB)) {
|
||||
if (filtered_indices.length() > 0) {
|
||||
play_menu_select_sound();
|
||||
deposit_item_max(item_types[filtered_indices[selection]]);
|
||||
build_personal_inventory_options(options, item_types);
|
||||
apply_menu_filter(filter_text, options, filtered_indices, filtered_options);
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
// Helper functions used across multiple menu systems
|
||||
|
||||
void menu_background_tick() {
|
||||
if (!menuBackgroundUpdatesEnabled) {
|
||||
return;
|
||||
}
|
||||
// Keep this list in sync with the main game loop to avoid pausing ambience/weather/time.
|
||||
update_time();
|
||||
update_crossfade();
|
||||
@@ -49,6 +52,18 @@ void menu_background_tick() {
|
||||
}
|
||||
}
|
||||
|
||||
void play_menu_move_sound() {
|
||||
string soundFile = "sounds/menu/menu_move.ogg";
|
||||
if (!file_exists(soundFile)) return;
|
||||
p.play_stationary(soundFile, false);
|
||||
}
|
||||
|
||||
void play_menu_select_sound() {
|
||||
string soundFile = "sounds/menu/menu_select.ogg";
|
||||
if (!file_exists(soundFile)) return;
|
||||
p.play_stationary(soundFile, false);
|
||||
}
|
||||
|
||||
string join_string_list(const string[]@ items) {
|
||||
if (@items == null || items.length() == 0) return "";
|
||||
string result = items[0];
|
||||
|
||||
@@ -326,6 +326,7 @@ void run_storage_menu() {
|
||||
|
||||
if (key_pressed(KEY_DOWN)) {
|
||||
if (filtered_options.length() > 0) {
|
||||
play_menu_move_sound();
|
||||
selection++;
|
||||
if (selection >= int(filtered_options.length())) selection = 0;
|
||||
speak_with_history(filtered_options[selection], true);
|
||||
@@ -334,6 +335,7 @@ void run_storage_menu() {
|
||||
|
||||
if (key_pressed(KEY_UP)) {
|
||||
if (filtered_options.length() > 0) {
|
||||
play_menu_move_sound();
|
||||
selection--;
|
||||
if (selection < 0) selection = int(filtered_options.length()) - 1;
|
||||
speak_with_history(filtered_options[selection], true);
|
||||
@@ -342,6 +344,7 @@ void run_storage_menu() {
|
||||
|
||||
if (key_pressed(KEY_RETURN)) {
|
||||
if (filtered_indices.length() > 0) {
|
||||
play_menu_select_sound();
|
||||
withdraw_item(item_types[filtered_indices[selection]]);
|
||||
build_storage_inventory_options(options, item_types);
|
||||
apply_menu_filter(filter_text, options, filtered_indices, filtered_options);
|
||||
@@ -356,6 +359,7 @@ void run_storage_menu() {
|
||||
|
||||
if (key_pressed(KEY_TAB)) {
|
||||
if (filtered_indices.length() > 0) {
|
||||
play_menu_select_sound();
|
||||
withdraw_item_max(item_types[filtered_indices[selection]]);
|
||||
build_storage_inventory_options(options, item_types);
|
||||
apply_menu_filter(filter_text, options, filtered_indices, filtered_options);
|
||||
|
||||
@@ -95,6 +95,7 @@ int last_adventure_day = -1;
|
||||
|
||||
// Pause state
|
||||
bool game_paused = false;
|
||||
bool menuBackgroundUpdatesEnabled = true;
|
||||
|
||||
// Restart all game timers when resuming from pause
|
||||
// Prevents time from accumulating while paused
|
||||
|
||||
@@ -187,6 +187,7 @@ void run_quest_menu() {
|
||||
string count_str = " " + (selection + 1) + " of " + options.length();
|
||||
|
||||
if (key_pressed(KEY_DOWN)) {
|
||||
play_menu_move_sound();
|
||||
selection++;
|
||||
if (selection >= options.length()) selection = 0;
|
||||
count_str = " " + (selection + 1) + " of " + options.length();
|
||||
@@ -194,6 +195,7 @@ void run_quest_menu() {
|
||||
}
|
||||
|
||||
if (key_pressed(KEY_UP)) {
|
||||
play_menu_move_sound();
|
||||
selection--;
|
||||
if (selection < 0) selection = options.length() - 1;
|
||||
count_str = " " + (selection + 1) + " of " + options.length();
|
||||
@@ -201,6 +203,7 @@ void run_quest_menu() {
|
||||
}
|
||||
|
||||
if (key_pressed(KEY_RETURN)) {
|
||||
play_menu_select_sound();
|
||||
int quest_type = quest_queue[selection];
|
||||
quest_queue.remove_at(selection);
|
||||
run_quest(quest_type);
|
||||
|
||||
@@ -362,16 +362,19 @@ bool select_player_sex(int &out sex) {
|
||||
while (true) {
|
||||
wait(5);
|
||||
if (key_pressed(KEY_DOWN)) {
|
||||
play_menu_move_sound();
|
||||
selection++;
|
||||
if (selection >= options.length()) selection = 0;
|
||||
speak_with_history(prompt + " " + options[selection], true);
|
||||
}
|
||||
if (key_pressed(KEY_UP)) {
|
||||
play_menu_move_sound();
|
||||
selection--;
|
||||
if (selection < 0) selection = options.length() - 1;
|
||||
speak_with_history(prompt + " " + options[selection], true);
|
||||
}
|
||||
if (key_pressed(KEY_RETURN)) {
|
||||
play_menu_select_sound();
|
||||
sex = (selection == 1) ? SEX_FEMALE : SEX_MALE;
|
||||
return true;
|
||||
}
|
||||
@@ -435,16 +438,19 @@ bool select_save_file(string &out filename) {
|
||||
while (true) {
|
||||
wait(5);
|
||||
if (key_pressed(KEY_DOWN)) {
|
||||
play_menu_move_sound();
|
||||
selection++;
|
||||
if (selection >= options.length()) selection = 0;
|
||||
speak_with_history(options[selection], true);
|
||||
}
|
||||
if (key_pressed(KEY_UP)) {
|
||||
play_menu_move_sound();
|
||||
selection--;
|
||||
if (selection < 0) selection = int(options.length()) - 1;
|
||||
speak_with_history(options[selection], true);
|
||||
}
|
||||
if (key_pressed(KEY_RETURN)) {
|
||||
play_menu_select_sound();
|
||||
filename = files[selection];
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user