Finally got around to returning to menu on death or exit. I shouldn't have put this off for so long, was painful. Also quest system future proofed if I decide to add anything that might cause death in one of them.
This commit is contained in:
+364
-352
@@ -90,400 +90,412 @@ void run_game()
|
|||||||
init_item_registry();
|
init_item_registry();
|
||||||
init_search_pools();
|
init_search_pools();
|
||||||
|
|
||||||
bool game_started = false;
|
while (true) {
|
||||||
while (!game_started) {
|
bool game_started = false;
|
||||||
int selection = run_main_menu();
|
while (!game_started) {
|
||||||
|
int selection = run_main_menu();
|
||||||
|
|
||||||
if (selection == 0) {
|
if (selection == 0) {
|
||||||
if (!setup_new_character()) {
|
if (!setup_new_character()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
start_new_game();
|
start_new_game();
|
||||||
speak_with_history("New game started.", true);
|
speak_with_history("New game started.", true);
|
||||||
game_started = true;
|
|
||||||
} else if (selection == 1) {
|
|
||||||
if (!has_save_game()) {
|
|
||||||
ui_info_box("Draugnorak", "Load Game", "No saves found.");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
string selectedFile;
|
|
||||||
if (!select_save_file(selectedFile)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (load_game_state_from_file(selectedFile)) {
|
|
||||||
speak_with_history("Game loaded.", true);
|
|
||||||
game_started = true;
|
game_started = true;
|
||||||
|
} else if (selection == 1) {
|
||||||
|
if (!has_save_game()) {
|
||||||
|
ui_info_box("Draugnorak", "Load Game", "No saves found.");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
string selectedFile;
|
||||||
|
if (!select_save_file(selectedFile)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (load_game_state_from_file(selectedFile)) {
|
||||||
|
speak_with_history("Game loaded.", true);
|
||||||
|
game_started = true;
|
||||||
|
} else {
|
||||||
|
string message = last_save_error;
|
||||||
|
if (message == "") message = "Unable to load save.";
|
||||||
|
ui_info_box("Draugnorak", "Load Game", message);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
string message = last_save_error;
|
exit();
|
||||||
if (message == "") message = "Unable to load save.";
|
|
||||||
ui_info_box("Draugnorak", "Load Game", message);
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
exit();
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
while(true)
|
while (game_started) {
|
||||||
{
|
wait(5);
|
||||||
wait(5);
|
|
||||||
|
if (return_to_main_menu_requested) {
|
||||||
// Pause toggle
|
game_paused = false;
|
||||||
if(key_pressed(KEY_BACK))
|
menuBackgroundUpdatesEnabled = true;
|
||||||
{
|
|
||||||
game_paused = !game_paused;
|
|
||||||
if (game_paused) {
|
|
||||||
p.pause_all();
|
|
||||||
speak_with_history("Paused. Press backspace to resume.", true);
|
|
||||||
} else {
|
|
||||||
p.resume_all();
|
p.resume_all();
|
||||||
// Restart all timers to prevent time from accumulating while paused
|
reset_game_state();
|
||||||
restart_all_timers();
|
return_to_main_menu_requested = false;
|
||||||
speak_with_history("Resumed.", true);
|
break;
|
||||||
}
|
}
|
||||||
continue;
|
|
||||||
}
|
// Pause toggle
|
||||||
|
if(key_pressed(KEY_BACK))
|
||||||
// Skip all game logic while paused
|
{
|
||||||
if (game_paused) {
|
game_paused = !game_paused;
|
||||||
continue;
|
if (game_paused) {
|
||||||
}
|
p.pause_all();
|
||||||
|
speak_with_history("Paused. Press backspace to resume.", true);
|
||||||
|
} else {
|
||||||
|
p.resume_all();
|
||||||
|
// Restart all timers to prevent time from accumulating while paused
|
||||||
|
restart_all_timers();
|
||||||
|
speak_with_history("Resumed.", true);
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Skip all game logic while paused
|
||||||
|
if (game_paused) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if(key_pressed(KEY_ESCAPE))
|
if(key_pressed(KEY_ESCAPE))
|
||||||
{
|
{
|
||||||
int really_exit = ui_question("", "Really exit?");
|
int really_exit = ui_question("", "Really exit?");
|
||||||
if (really_exit == 1) {
|
if (really_exit == 1) {
|
||||||
exit();
|
return_to_main_menu_requested = true;
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Time & Environment updates
|
// Time & Environment updates
|
||||||
update_time();
|
update_time();
|
||||||
update_crossfade();
|
update_crossfade();
|
||||||
update_weather();
|
update_weather();
|
||||||
update_environment();
|
update_environment();
|
||||||
update_snares();
|
update_snares();
|
||||||
update_streams();
|
update_streams();
|
||||||
update_fires();
|
update_fires();
|
||||||
update_zombies();
|
update_zombies();
|
||||||
update_bandits();
|
update_bandits();
|
||||||
update_boars();
|
update_boars();
|
||||||
update_flying_creatures();
|
update_flying_creatures();
|
||||||
update_weapon_range_audio_all();
|
update_weapon_range_audio_all();
|
||||||
update_world_drops();
|
update_world_drops();
|
||||||
update_blessings();
|
update_blessings();
|
||||||
update_notifications();
|
update_notifications();
|
||||||
|
|
||||||
// Fire damage check (only if not jumping)
|
// Fire damage check (only if not jumping)
|
||||||
WorldFire@ fire_on_tile = get_fire_at(x);
|
WorldFire@ fire_on_tile = get_fire_at(x);
|
||||||
if (fire_on_tile != null && !jumping && fire_damage_timer.elapsed > 1000) {
|
if (fire_on_tile != null && !jumping && fire_damage_timer.elapsed > 1000) {
|
||||||
player_health--;
|
player_health--;
|
||||||
fire_damage_timer.restart();
|
fire_damage_timer.restart();
|
||||||
speak_with_history("Burning! " + player_health + " health remaining.", true);
|
speak_with_history("Burning! " + player_health + " health remaining.", true);
|
||||||
}
|
|
||||||
|
|
||||||
// Healing in base area
|
|
||||||
if (x <= BASE_END && player_health < max_health) {
|
|
||||||
WorldHerbGarden@ herb_garden = get_herb_garden_at_base();
|
|
||||||
int heal_interval = (herb_garden != null) ? 30000 : 150000; // 30 seconds with garden, 2.5 minutes without
|
|
||||||
|
|
||||||
if (healing_timer.elapsed > heal_interval) {
|
|
||||||
player_health++;
|
|
||||||
healing_timer.restart();
|
|
||||||
speak_with_history(player_health + " health.", true);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
// Healing in base area
|
||||||
// Death check
|
if (x <= BASE_END && player_health < max_health) {
|
||||||
if (player_health <= 0) {
|
WorldHerbGarden@ herb_garden = get_herb_garden_at_base();
|
||||||
if (!try_consume_heal_scroll()) {
|
int heal_interval = (herb_garden != null) ? 30000 : 150000; // 30 seconds with garden, 2.5 minutes without
|
||||||
speak_with_history("You have died.", true);
|
|
||||||
wait(2000);
|
if (healing_timer.elapsed > heal_interval) {
|
||||||
exit();
|
player_health++;
|
||||||
}
|
healing_timer.restart();
|
||||||
}
|
speak_with_history(player_health + " health.", true);
|
||||||
|
|
||||||
if (fylgjaCharging) {
|
|
||||||
update_fylgja_charge();
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Inventory & Actions
|
|
||||||
check_inventory_keys(x);
|
|
||||||
check_action_menu(x);
|
|
||||||
check_adventure_menu(x);
|
|
||||||
check_crafting_menu(x, BASE_END);
|
|
||||||
check_altar_menu(x);
|
|
||||||
check_equipment_menu();
|
|
||||||
check_quest_menu();
|
|
||||||
check_fylgja_menu();
|
|
||||||
check_quick_slot_keys();
|
|
||||||
check_time_input();
|
|
||||||
check_notification_keys();
|
|
||||||
check_speech_history_keys();
|
|
||||||
|
|
||||||
// Health Key
|
|
||||||
if (key_pressed(KEY_H)) {
|
|
||||||
speak_with_history(player_health + " health of " + max_health, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Coordinates Key
|
|
||||||
if (key_pressed(KEY_X)) {
|
|
||||||
string direction_label = (facing == 1) ? "east" : "west";
|
|
||||||
string terrain = get_terrain_at_position(x);
|
|
||||||
if (get_mountain_at(x) !is null) {
|
|
||||||
terrain += ". Mountains";
|
|
||||||
}
|
|
||||||
speak_with_history(direction_label + ", x " + x + ", y " + y + ", terrain " + terrain, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Base Info Key (base only)
|
|
||||||
if (key_pressed(KEY_B)) {
|
|
||||||
run_base_info_menu();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Climbing and Falling Updates
|
|
||||||
update_climbing();
|
|
||||||
update_falling();
|
|
||||||
update_rope_climbing();
|
|
||||||
check_rope_climb_fall();
|
|
||||||
update_mountains();
|
|
||||||
|
|
||||||
// Down arrow to climb down from tree or start rope climb down
|
|
||||||
if (key_pressed(KEY_DOWN)) {
|
|
||||||
// Check for pending rope climb (going down)
|
|
||||||
if (pending_rope_climb_x != -1 && !rope_climbing && !climbing && !falling && !jumping) {
|
|
||||||
int elevation_change = pending_rope_climb_elevation - y;
|
|
||||||
if (elevation_change < 0) {
|
|
||||||
start_rope_climb(false, pending_rope_climb_x, pending_rope_climb_elevation);
|
|
||||||
pending_rope_climb_x = -1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Tree climbing down
|
|
||||||
else {
|
// Death check
|
||||||
Tree@ tree = get_tree_at(x);
|
if (player_health <= 0) {
|
||||||
if (tree != null && !tree.is_chopped && y > 0 && !jumping && !climbing && !falling && !rope_climbing) {
|
if (!try_consume_heal_scroll()) {
|
||||||
climb_down_tree();
|
speak_with_history("You have died.", true);
|
||||||
|
wait(2000);
|
||||||
|
return_to_main_menu_requested = true;
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
if (fylgjaCharging) {
|
||||||
// Jumping Logic
|
update_fylgja_charge();
|
||||||
if(key_pressed(KEY_UP))
|
continue;
|
||||||
{
|
}
|
||||||
// Check for pending rope climb (going up)
|
|
||||||
if (pending_rope_climb_x != -1 && !rope_climbing && !climbing && !falling && !jumping) {
|
// Inventory & Actions
|
||||||
int elevation_change = pending_rope_climb_elevation - y;
|
check_inventory_keys(x);
|
||||||
if (elevation_change > 0) {
|
check_action_menu(x);
|
||||||
start_rope_climb(true, pending_rope_climb_x, pending_rope_climb_elevation);
|
check_adventure_menu(x);
|
||||||
pending_rope_climb_x = -1;
|
check_crafting_menu(x, BASE_END);
|
||||||
|
check_altar_menu(x);
|
||||||
|
check_equipment_menu();
|
||||||
|
check_quest_menu();
|
||||||
|
check_fylgja_menu();
|
||||||
|
check_quick_slot_keys();
|
||||||
|
check_time_input();
|
||||||
|
check_notification_keys();
|
||||||
|
check_speech_history_keys();
|
||||||
|
|
||||||
|
// Health Key
|
||||||
|
if (key_pressed(KEY_H)) {
|
||||||
|
speak_with_history(player_health + " health of " + max_health, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Coordinates Key
|
||||||
|
if (key_pressed(KEY_X)) {
|
||||||
|
string direction_label = (facing == 1) ? "east" : "west";
|
||||||
|
string terrain = get_terrain_at_position(x);
|
||||||
|
if (get_mountain_at(x) !is null) {
|
||||||
|
terrain += ". Mountains";
|
||||||
|
}
|
||||||
|
speak_with_history(direction_label + ", x " + x + ", y " + y + ", terrain " + terrain, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Base Info Key (base only)
|
||||||
|
if (key_pressed(KEY_B)) {
|
||||||
|
run_base_info_menu();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Climbing and Falling Updates
|
||||||
|
update_climbing();
|
||||||
|
update_falling();
|
||||||
|
update_rope_climbing();
|
||||||
|
check_rope_climb_fall();
|
||||||
|
update_mountains();
|
||||||
|
|
||||||
|
// Down arrow to climb down from tree or start rope climb down
|
||||||
|
if (key_pressed(KEY_DOWN)) {
|
||||||
|
// Check for pending rope climb (going down)
|
||||||
|
if (pending_rope_climb_x != -1 && !rope_climbing && !climbing && !falling && !jumping) {
|
||||||
|
int elevation_change = pending_rope_climb_elevation - y;
|
||||||
|
if (elevation_change < 0) {
|
||||||
|
start_rope_climb(false, pending_rope_climb_x, pending_rope_climb_elevation);
|
||||||
|
pending_rope_climb_x = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Tree climbing down
|
||||||
|
else {
|
||||||
|
Tree@ tree = get_tree_at(x);
|
||||||
|
if (tree != null && !tree.is_chopped && y > 0 && !jumping && !climbing && !falling && !rope_climbing) {
|
||||||
|
climb_down_tree();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(!jumping && !climbing && !falling && !rope_climbing)
|
|
||||||
|
// Jumping Logic
|
||||||
|
if(key_pressed(KEY_UP))
|
||||||
{
|
{
|
||||||
// Get ground elevation at current position
|
// Check for pending rope climb (going up)
|
||||||
int ground_elevation = get_mountain_elevation_at(x);
|
if (pending_rope_climb_x != -1 && !rope_climbing && !climbing && !falling && !jumping) {
|
||||||
|
int elevation_change = pending_rope_climb_elevation - y;
|
||||||
// Check if on tree tile
|
if (elevation_change > 0) {
|
||||||
Tree@ tree = get_tree_at(x);
|
start_rope_climb(true, pending_rope_climb_x, pending_rope_climb_elevation);
|
||||||
if (tree != null && !tree.is_chopped && y == ground_elevation) {
|
pending_rope_climb_x = -1;
|
||||||
// Start climbing the tree
|
}
|
||||||
start_climbing_tree(x);
|
}
|
||||||
} else if (y == ground_elevation) {
|
else if(!jumping && !climbing && !falling && !rope_climbing)
|
||||||
// Normal jump (only if on the ground)
|
{
|
||||||
p.play_stationary("sounds/jump.ogg", false);
|
// Get ground elevation at current position
|
||||||
jumping = true;
|
int ground_elevation = get_mountain_elevation_at(x);
|
||||||
jumptimer.restart();
|
|
||||||
|
// Check if on tree tile
|
||||||
|
Tree@ tree = get_tree_at(x);
|
||||||
|
if (tree != null && !tree.is_chopped && y == ground_elevation) {
|
||||||
|
// Start climbing the tree
|
||||||
|
start_climbing_tree(x);
|
||||||
|
} else if (y == ground_elevation) {
|
||||||
|
// Normal jump (only if on the ground)
|
||||||
|
p.play_stationary("sounds/jump.ogg", false);
|
||||||
|
jumping = true;
|
||||||
|
jumptimer.restart();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
if(jumping && jumptimer.elapsed > 850)
|
||||||
if(jumping && jumptimer.elapsed > 850)
|
|
||||||
{
|
|
||||||
jumping = false;
|
|
||||||
// Reset y to ground elevation after jump
|
|
||||||
y = get_mountain_elevation_at(x);
|
|
||||||
play_land_sound(x, BASE_END, GRASS_END);
|
|
||||||
// Check for snare on landing?
|
|
||||||
check_snare_collision(x);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set y to 3 above ground during jump
|
|
||||||
if(jumping && y == get_mountain_elevation_at(x)) {
|
|
||||||
y = get_mountain_elevation_at(x) + 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
movetime = jumping ? jump_speed : walk_speed;
|
|
||||||
|
|
||||||
bool left_active = key_down(KEY_LEFT);
|
|
||||||
bool right_active = key_down(KEY_RIGHT);
|
|
||||||
|
|
||||||
// Movement Logic
|
|
||||||
if (key_pressed(KEY_LEFT) && facing != 0 && !climbing && !falling && !rope_climbing) {
|
|
||||||
facing = 0;
|
|
||||||
speak_with_history("west", true);
|
|
||||||
walktimer.restart();
|
|
||||||
// Cancel pending rope climb when changing direction
|
|
||||||
pending_rope_climb_x = -1;
|
|
||||||
}
|
|
||||||
if (key_pressed(KEY_RIGHT) && facing != 1 && !climbing && !falling && !rope_climbing) {
|
|
||||||
facing = 1;
|
|
||||||
speak_with_history("east", true);
|
|
||||||
walktimer.restart();
|
|
||||||
// Cancel pending rope climb when changing direction
|
|
||||||
pending_rope_climb_x = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(walktimer.elapsed > movetime)
|
|
||||||
{
|
|
||||||
int old_x = x;
|
|
||||||
|
|
||||||
// Check if trying to move left/right while in tree (not in mountain)
|
|
||||||
MountainRange@ current_mountain = get_mountain_at(x);
|
|
||||||
Tree@ current_tree = get_tree_at(x);
|
|
||||||
int ground_elevation = get_mountain_elevation_at(x);
|
|
||||||
if((left_active || right_active) && y > ground_elevation && !jumping && !falling && !rope_climbing && current_mountain is null && current_tree !is null) {
|
|
||||||
// Fall out of tree
|
|
||||||
climbing = false;
|
|
||||||
start_falling();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(left_active && x > 0 && !climbing && !falling && !rope_climbing)
|
|
||||||
{
|
{
|
||||||
|
jumping = false;
|
||||||
|
// Reset y to ground elevation after jump
|
||||||
|
y = get_mountain_elevation_at(x);
|
||||||
|
play_land_sound(x, BASE_END, GRASS_END);
|
||||||
|
// Check for snare on landing?
|
||||||
|
check_snare_collision(x);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set y to 3 above ground during jump
|
||||||
|
if(jumping && y == get_mountain_elevation_at(x)) {
|
||||||
|
y = get_mountain_elevation_at(x) + 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
movetime = jumping ? jump_speed : walk_speed;
|
||||||
|
|
||||||
|
bool left_active = key_down(KEY_LEFT);
|
||||||
|
bool right_active = key_down(KEY_RIGHT);
|
||||||
|
|
||||||
|
// Movement Logic
|
||||||
|
if (key_pressed(KEY_LEFT) && facing != 0 && !climbing && !falling && !rope_climbing) {
|
||||||
facing = 0;
|
facing = 0;
|
||||||
int target_x = x - 1;
|
speak_with_history("west", true);
|
||||||
// Check mountain movement and deep water
|
walktimer.restart();
|
||||||
if (can_move_mountain(x, target_x) && can_enter_stream_tile(target_x)) {
|
// Cancel pending rope climb when changing direction
|
||||||
x = target_x;
|
pending_rope_climb_x = -1;
|
||||||
// Always update elevation to match ground (0 if not in mountain)
|
|
||||||
int new_elevation = get_mountain_elevation_at(x);
|
|
||||||
if (new_elevation != y) {
|
|
||||||
y = new_elevation;
|
|
||||||
}
|
|
||||||
walktimer.restart();
|
|
||||||
if(!jumping) {
|
|
||||||
play_footstep(x, BASE_END, GRASS_END);
|
|
||||||
check_snare_collision(x);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if(right_active && x < MAP_SIZE - 1 && !climbing && !falling && !rope_climbing)
|
if (key_pressed(KEY_RIGHT) && facing != 1 && !climbing && !falling && !rope_climbing) {
|
||||||
{
|
|
||||||
facing = 1;
|
facing = 1;
|
||||||
int target_x = x + 1;
|
speak_with_history("east", true);
|
||||||
// Check mountain movement and deep water
|
walktimer.restart();
|
||||||
if (can_move_mountain(x, target_x) && can_enter_stream_tile(target_x)) {
|
// Cancel pending rope climb when changing direction
|
||||||
x = target_x;
|
pending_rope_climb_x = -1;
|
||||||
// Always update elevation to match ground (0 if not in mountain)
|
}
|
||||||
int new_elevation = get_mountain_elevation_at(x);
|
|
||||||
if (new_elevation != y) {
|
if(walktimer.elapsed > movetime)
|
||||||
y = new_elevation;
|
{
|
||||||
|
int old_x = x;
|
||||||
|
|
||||||
|
// Check if trying to move left/right while in tree (not in mountain)
|
||||||
|
MountainRange@ current_mountain = get_mountain_at(x);
|
||||||
|
Tree@ current_tree = get_tree_at(x);
|
||||||
|
int ground_elevation = get_mountain_elevation_at(x);
|
||||||
|
if((left_active || right_active) && y > ground_elevation && !jumping && !falling && !rope_climbing && current_mountain is null && current_tree !is null) {
|
||||||
|
// Fall out of tree
|
||||||
|
climbing = false;
|
||||||
|
start_falling();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(left_active && x > 0 && !climbing && !falling && !rope_climbing)
|
||||||
|
{
|
||||||
|
facing = 0;
|
||||||
|
int target_x = x - 1;
|
||||||
|
// Check mountain movement and deep water
|
||||||
|
if (can_move_mountain(x, target_x) && can_enter_stream_tile(target_x)) {
|
||||||
|
x = target_x;
|
||||||
|
// Always update elevation to match ground (0 if not in mountain)
|
||||||
|
int new_elevation = get_mountain_elevation_at(x);
|
||||||
|
if (new_elevation != y) {
|
||||||
|
y = new_elevation;
|
||||||
|
}
|
||||||
|
walktimer.restart();
|
||||||
|
if(!jumping) {
|
||||||
|
play_footstep(x, BASE_END, GRASS_END);
|
||||||
|
check_snare_collision(x);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
walktimer.restart();
|
}
|
||||||
if(!jumping) {
|
else if(right_active && x < MAP_SIZE - 1 && !climbing && !falling && !rope_climbing)
|
||||||
play_footstep(x, BASE_END, GRASS_END);
|
{
|
||||||
check_snare_collision(x);
|
facing = 1;
|
||||||
|
int target_x = x + 1;
|
||||||
|
// Check mountain movement and deep water
|
||||||
|
if (can_move_mountain(x, target_x) && can_enter_stream_tile(target_x)) {
|
||||||
|
x = target_x;
|
||||||
|
// Always update elevation to match ground (0 if not in mountain)
|
||||||
|
int new_elevation = get_mountain_elevation_at(x);
|
||||||
|
if (new_elevation != y) {
|
||||||
|
y = new_elevation;
|
||||||
|
}
|
||||||
|
walktimer.restart();
|
||||||
|
if(!jumping) {
|
||||||
|
play_footstep(x, BASE_END, GRASS_END);
|
||||||
|
check_snare_collision(x);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
// Reset search timer if shift is used with other keys
|
||||||
// Reset search timer if shift is used with other keys
|
if((key_down(KEY_LSHIFT) || key_down(KEY_RSHIFT))) {
|
||||||
if((key_down(KEY_LSHIFT) || key_down(KEY_RSHIFT))) {
|
if(key_pressed(KEY_COMMA) || key_pressed(KEY_PERIOD)) {
|
||||||
if(key_pressed(KEY_COMMA) || key_pressed(KEY_PERIOD)) {
|
searching = false;
|
||||||
searching = false;
|
search_delay_timer.restart();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Searching Logic
|
||||||
|
bool shift_down = (key_down(KEY_LSHIFT) || key_down(KEY_RSHIFT));
|
||||||
|
bool search_key_down = shift_down || key_down(KEY_SLASH) || key_down(KEY_Z);
|
||||||
|
if (!search_key_down && !searching) {
|
||||||
|
search_timer.restart();
|
||||||
|
}
|
||||||
|
// Apply rune gathering bonus to search time
|
||||||
|
int search_time = apply_rune_gather_bonus(2000);
|
||||||
|
if (search_key_down && search_timer.elapsed > search_time && !searching)
|
||||||
|
{
|
||||||
|
searching = true;
|
||||||
search_delay_timer.restart();
|
search_delay_timer.restart();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
// Complete search after delay
|
||||||
// Searching Logic
|
if(searching && search_delay_timer.elapsed >= 1000)
|
||||||
bool shift_down = (key_down(KEY_LSHIFT) || key_down(KEY_RSHIFT));
|
{
|
||||||
bool search_key_down = shift_down || key_down(KEY_SLASH) || key_down(KEY_Z);
|
searching = false;
|
||||||
if (!search_key_down && !searching) {
|
search_timer.restart();
|
||||||
search_timer.restart();
|
perform_search(x);
|
||||||
}
|
}
|
||||||
// Apply rune gathering bonus to search time
|
|
||||||
int search_time = apply_rune_gather_bonus(2000);
|
update_fishing();
|
||||||
if (search_key_down && search_timer.elapsed > search_time && !searching)
|
update_bow_shot();
|
||||||
{
|
|
||||||
searching = true;
|
bool ctrl_down = (key_down(KEY_LCTRL) || key_down(KEY_RCTRL));
|
||||||
search_delay_timer.restart();
|
|
||||||
}
|
// Bow draw detection
|
||||||
|
if (bow_equipped) {
|
||||||
// Complete search after delay
|
if (ctrl_down && !bow_drawing) {
|
||||||
if(searching && search_delay_timer.elapsed >= 1000)
|
if (get_personal_count(ITEM_ARROWS) > 0) {
|
||||||
{
|
bow_drawing = true;
|
||||||
searching = false;
|
bow_draw_timer.restart();
|
||||||
search_timer.restart();
|
p.play_stationary("sounds/weapons/bow_draw.ogg", false);
|
||||||
perform_search(x);
|
} else {
|
||||||
}
|
speak_ammo_blocked("No arrows.");
|
||||||
|
}
|
||||||
update_fishing();
|
}
|
||||||
update_bow_shot();
|
|
||||||
|
if (bow_drawing && !ctrl_down) {
|
||||||
bool ctrl_down = (key_down(KEY_LCTRL) || key_down(KEY_RCTRL));
|
release_bow_attack(x);
|
||||||
|
bow_drawing = false;
|
||||||
// Bow draw detection
|
|
||||||
if (bow_equipped) {
|
|
||||||
if (ctrl_down && !bow_drawing) {
|
|
||||||
if (get_personal_count(ITEM_ARROWS) > 0) {
|
|
||||||
bow_drawing = true;
|
|
||||||
bow_draw_timer.restart();
|
|
||||||
p.play_stationary("sounds/weapons/bow_draw.ogg", false);
|
|
||||||
} else {
|
|
||||||
speak_ammo_blocked("No arrows.");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!bow_equipped && bow_drawing) {
|
||||||
if (bow_drawing && !ctrl_down) {
|
|
||||||
release_bow_attack(x);
|
|
||||||
bow_drawing = false;
|
bow_drawing = false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (!bow_equipped && bow_drawing) {
|
// Sling charge detection
|
||||||
bow_drawing = false;
|
if (!bow_equipped && sling_equipped && ctrl_down && !sling_charging) {
|
||||||
}
|
if (get_personal_count(ITEM_STONES) > 0) {
|
||||||
|
sling_charging = true;
|
||||||
// Sling charge detection
|
sling_charge_timer.restart();
|
||||||
if (!bow_equipped && sling_equipped && ctrl_down && !sling_charging) {
|
sling_sound_handle = p.play_stationary("sounds/weapons/sling_swing.ogg", true);
|
||||||
if (get_personal_count(ITEM_STONES) > 0) {
|
last_sling_stage = -1;
|
||||||
sling_charging = true;
|
} else {
|
||||||
sling_charge_timer.restart();
|
speak_ammo_blocked("No stones.");
|
||||||
sling_sound_handle = p.play_stationary("sounds/weapons/sling_swing.ogg", true);
|
}
|
||||||
last_sling_stage = -1;
|
|
||||||
} else {
|
|
||||||
speak_ammo_blocked("No stones.");
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
// Update sling charge state while holding
|
||||||
// Update sling charge state while holding
|
if (sling_charging && ctrl_down) {
|
||||||
if (sling_charging && ctrl_down) {
|
update_sling_charge();
|
||||||
update_sling_charge();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Sling release detection
|
|
||||||
if (sling_charging && !ctrl_down) {
|
|
||||||
release_sling_attack(x);
|
|
||||||
sling_charging = false;
|
|
||||||
if (sling_sound_handle != -1) {
|
|
||||||
p.destroy_sound(sling_sound_handle);
|
|
||||||
sling_sound_handle = -1;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
// Sling release detection
|
||||||
// Non-sling weapon attacks (existing pattern)
|
if (sling_charging && !ctrl_down) {
|
||||||
if (!bow_equipped && !bow_drawing && !sling_equipped && !sling_charging) {
|
release_sling_attack(x);
|
||||||
int attack_cooldown = 1000;
|
sling_charging = false;
|
||||||
if (spear_equipped) attack_cooldown = 800;
|
if (sling_sound_handle != -1) {
|
||||||
if (axe_equipped) attack_cooldown = 1600;
|
p.destroy_sound(sling_sound_handle);
|
||||||
|
sling_sound_handle = -1;
|
||||||
if (!fishing_pole_equipped && ctrl_down && attack_timer.elapsed > attack_cooldown) {
|
}
|
||||||
attack_timer.restart();
|
|
||||||
perform_attack(x);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Non-sling weapon attacks (existing pattern)
|
||||||
|
if (!bow_equipped && !bow_drawing && !sling_equipped && !sling_charging) {
|
||||||
|
int attack_cooldown = 1000;
|
||||||
|
if (spear_equipped) attack_cooldown = 800;
|
||||||
|
if (axe_equipped) attack_cooldown = 1600;
|
||||||
|
|
||||||
|
if (!fishing_pole_equipped && ctrl_down && attack_timer.elapsed > attack_cooldown) {
|
||||||
|
attack_timer.restart();
|
||||||
|
perform_attack(x);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Audio Listener Update
|
||||||
|
p.update_listener_1d(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Audio Listener Update
|
|
||||||
p.update_listener_1d(x);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,9 @@ void run_barricade_menu() {
|
|||||||
|
|
||||||
while(true) {
|
while(true) {
|
||||||
wait(5);
|
wait(5);
|
||||||
menu_background_tick();
|
if (menu_background_tick()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (key_pressed(KEY_ESCAPE)) {
|
if (key_pressed(KEY_ESCAPE)) {
|
||||||
speak_with_history("Closed.", true);
|
speak_with_history("Closed.", true);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -98,7 +98,9 @@ void run_buildings_menu() {
|
|||||||
|
|
||||||
while(true) {
|
while(true) {
|
||||||
wait(5);
|
wait(5);
|
||||||
menu_background_tick();
|
if (menu_background_tick()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (key_pressed(KEY_ESCAPE)) {
|
if (key_pressed(KEY_ESCAPE)) {
|
||||||
speak_with_history("Closed.", true);
|
speak_with_history("Closed.", true);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -58,7 +58,9 @@ void run_clothing_menu() {
|
|||||||
|
|
||||||
while(true) {
|
while(true) {
|
||||||
wait(5);
|
wait(5);
|
||||||
menu_background_tick();
|
if (menu_background_tick()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (key_pressed(KEY_ESCAPE)) {
|
if (key_pressed(KEY_ESCAPE)) {
|
||||||
speak_with_history("Closed.", true);
|
speak_with_history("Closed.", true);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -13,7 +13,9 @@ void run_materials_menu() {
|
|||||||
|
|
||||||
while(true) {
|
while(true) {
|
||||||
wait(5);
|
wait(5);
|
||||||
menu_background_tick();
|
if (menu_background_tick()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (key_pressed(KEY_ESCAPE)) {
|
if (key_pressed(KEY_ESCAPE)) {
|
||||||
speak_with_history("Closed.", true);
|
speak_with_history("Closed.", true);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -98,7 +98,9 @@ void run_runes_menu() {
|
|||||||
|
|
||||||
while(true) {
|
while(true) {
|
||||||
wait(5);
|
wait(5);
|
||||||
menu_background_tick();
|
if (menu_background_tick()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (key_pressed(KEY_ESCAPE)) {
|
if (key_pressed(KEY_ESCAPE)) {
|
||||||
speak_with_history("Closed.", true);
|
speak_with_history("Closed.", true);
|
||||||
break;
|
break;
|
||||||
@@ -154,7 +156,9 @@ void run_rune_equipment_menu(int rune_type) {
|
|||||||
|
|
||||||
while(true) {
|
while(true) {
|
||||||
wait(5);
|
wait(5);
|
||||||
menu_background_tick();
|
if (menu_background_tick()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (key_pressed(KEY_ESCAPE)) {
|
if (key_pressed(KEY_ESCAPE)) {
|
||||||
speak_with_history("Closed.", true);
|
speak_with_history("Closed.", true);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -17,7 +17,9 @@ void run_tools_menu() {
|
|||||||
|
|
||||||
while(true) {
|
while(true) {
|
||||||
wait(5);
|
wait(5);
|
||||||
menu_background_tick();
|
if (menu_background_tick()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (key_pressed(KEY_ESCAPE)) {
|
if (key_pressed(KEY_ESCAPE)) {
|
||||||
speak_with_history("Closed.", true);
|
speak_with_history("Closed.", true);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -11,7 +11,9 @@ void run_weapons_menu() {
|
|||||||
|
|
||||||
while(true) {
|
while(true) {
|
||||||
wait(5);
|
wait(5);
|
||||||
menu_background_tick();
|
if (menu_background_tick()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (key_pressed(KEY_ESCAPE)) {
|
if (key_pressed(KEY_ESCAPE)) {
|
||||||
speak_with_history("Closed.", true);
|
speak_with_history("Closed.", true);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -38,7 +38,9 @@ void run_crafting_menu() {
|
|||||||
|
|
||||||
while(true) {
|
while(true) {
|
||||||
wait(5);
|
wait(5);
|
||||||
menu_background_tick();
|
if (menu_background_tick()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (key_pressed(KEY_ESCAPE)) {
|
if (key_pressed(KEY_ESCAPE)) {
|
||||||
speak_with_history("Closed.", true);
|
speak_with_history("Closed.", true);
|
||||||
break;
|
break;
|
||||||
@@ -86,7 +88,9 @@ void simulate_crafting(int item_count) {
|
|||||||
timer t;
|
timer t;
|
||||||
while(t.elapsed < 800) {
|
while(t.elapsed < 800) {
|
||||||
wait(5);
|
wait(5);
|
||||||
menu_background_tick();
|
if (menu_background_tick()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
p.play_stationary("sounds/crafting_complete.ogg", false);
|
p.play_stationary("sounds/crafting_complete.ogg", false);
|
||||||
|
|||||||
@@ -136,7 +136,9 @@ void run_fylgja_menu() {
|
|||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
wait(5);
|
wait(5);
|
||||||
menu_background_tick();
|
if (menu_background_tick()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (key_pressed(KEY_ESCAPE)) {
|
if (key_pressed(KEY_ESCAPE)) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -263,7 +263,9 @@ void run_action_menu(int x) {
|
|||||||
|
|
||||||
while(true) {
|
while(true) {
|
||||||
wait(5);
|
wait(5);
|
||||||
menu_background_tick();
|
if (menu_background_tick()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (key_pressed(KEY_ESCAPE)) {
|
if (key_pressed(KEY_ESCAPE)) {
|
||||||
speak_with_history("Closed.", true);
|
speak_with_history("Closed.", true);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -88,7 +88,9 @@ void run_altar_menu() {
|
|||||||
|
|
||||||
while(true) {
|
while(true) {
|
||||||
wait(5);
|
wait(5);
|
||||||
menu_background_tick();
|
if (menu_background_tick()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (key_pressed(KEY_ESCAPE)) {
|
if (key_pressed(KEY_ESCAPE)) {
|
||||||
speak_with_history("Closed.", true);
|
speak_with_history("Closed.", true);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -56,7 +56,9 @@ void run_base_info_menu() {
|
|||||||
|
|
||||||
while(true) {
|
while(true) {
|
||||||
wait(5);
|
wait(5);
|
||||||
menu_background_tick();
|
if (menu_background_tick()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (key_pressed(KEY_ESCAPE)) {
|
if (key_pressed(KEY_ESCAPE)) {
|
||||||
speak_with_history("Closed.", true);
|
speak_with_history("Closed.", true);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -160,7 +160,9 @@ void run_equipment_menu() {
|
|||||||
|
|
||||||
while(true) {
|
while(true) {
|
||||||
wait(5);
|
wait(5);
|
||||||
menu_background_tick();
|
if (menu_background_tick()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (key_pressed(KEY_ESCAPE)) {
|
if (key_pressed(KEY_ESCAPE)) {
|
||||||
speak_with_history("Closed.", true);
|
speak_with_history("Closed.", true);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -81,7 +81,9 @@ void run_inventory_root_menu() {
|
|||||||
|
|
||||||
while(true) {
|
while(true) {
|
||||||
wait(5);
|
wait(5);
|
||||||
menu_background_tick();
|
if (menu_background_tick()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (key_pressed(KEY_ESCAPE)) {
|
if (key_pressed(KEY_ESCAPE)) {
|
||||||
speak_with_history("Closed.", true);
|
speak_with_history("Closed.", true);
|
||||||
break;
|
break;
|
||||||
@@ -124,7 +126,9 @@ void run_inventory_menu(bool allow_deposit) {
|
|||||||
|
|
||||||
while(true) {
|
while(true) {
|
||||||
wait(5);
|
wait(5);
|
||||||
menu_background_tick();
|
if (menu_background_tick()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (key_pressed(KEY_ESCAPE)) {
|
if (key_pressed(KEY_ESCAPE)) {
|
||||||
speak_with_history("Closed.", true);
|
speak_with_history("Closed.", true);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
// Menu utility functions
|
// Menu utility functions
|
||||||
// Helper functions used across multiple menu systems
|
// Helper functions used across multiple menu systems
|
||||||
|
|
||||||
void menu_background_tick() {
|
bool menu_background_tick() {
|
||||||
|
if (return_to_main_menu_requested) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (!menuBackgroundUpdatesEnabled) {
|
if (!menuBackgroundUpdatesEnabled) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
// Keep this list in sync with the main game loop to avoid pausing ambience/weather/time.
|
// Keep this list in sync with the main game loop to avoid pausing ambience/weather/time.
|
||||||
update_time();
|
update_time();
|
||||||
@@ -47,9 +50,12 @@ void menu_background_tick() {
|
|||||||
if (!try_consume_heal_scroll()) {
|
if (!try_consume_heal_scroll()) {
|
||||||
speak_with_history("You have died.", true);
|
speak_with_history("You have died.", true);
|
||||||
wait(2000);
|
wait(2000);
|
||||||
exit();
|
return_to_main_menu_requested = true;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void play_menu_move_sound() {
|
void play_menu_move_sound() {
|
||||||
|
|||||||
@@ -305,7 +305,9 @@ void run_storage_menu() {
|
|||||||
|
|
||||||
while(true) {
|
while(true) {
|
||||||
wait(5);
|
wait(5);
|
||||||
menu_background_tick();
|
if (menu_background_tick()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (key_pressed(KEY_ESCAPE)) {
|
if (key_pressed(KEY_ESCAPE)) {
|
||||||
speak_with_history("Closed.", true);
|
speak_with_history("Closed.", true);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -96,6 +96,7 @@ int last_adventure_day = -1;
|
|||||||
// Pause state
|
// Pause state
|
||||||
bool game_paused = false;
|
bool game_paused = false;
|
||||||
bool menuBackgroundUpdatesEnabled = true;
|
bool menuBackgroundUpdatesEnabled = true;
|
||||||
|
bool return_to_main_menu_requested = false;
|
||||||
|
|
||||||
// Restart all game timers when resuming from pause
|
// Restart all game timers when resuming from pause
|
||||||
// Prevents time from accumulating while paused
|
// Prevents time from accumulating while paused
|
||||||
|
|||||||
@@ -50,8 +50,8 @@ int get_quest_chance_from_favor() {
|
|||||||
return chance;
|
return chance;
|
||||||
}
|
}
|
||||||
|
|
||||||
void quest_menu_background_tick() {
|
bool quest_menu_background_tick() {
|
||||||
menu_background_tick();
|
return menu_background_tick();
|
||||||
}
|
}
|
||||||
|
|
||||||
void quest_boomerang_hit_sound() {
|
void quest_boomerang_hit_sound() {
|
||||||
@@ -163,6 +163,10 @@ void run_quest(int quest_type) {
|
|||||||
else if (quest_type == QUEST_ENCHANTED_MELODY) score = run_enchanted_melody();
|
else if (quest_type == QUEST_ENCHANTED_MELODY) score = run_enchanted_melody();
|
||||||
else if (quest_type == QUEST_ESCAPE_FROM_HEL) score = run_escape_from_hel();
|
else if (quest_type == QUEST_ESCAPE_FROM_HEL) score = run_escape_from_hel();
|
||||||
else if (quest_type == QUEST_SKELETAL_BARD) score = run_skeletal_bard();
|
else if (quest_type == QUEST_SKELETAL_BARD) score = run_skeletal_bard();
|
||||||
|
if (return_to_main_menu_requested) {
|
||||||
|
p.resume_all();
|
||||||
|
return;
|
||||||
|
}
|
||||||
apply_quest_reward(score);
|
apply_quest_reward(score);
|
||||||
p.resume_all();
|
p.resume_all();
|
||||||
}
|
}
|
||||||
@@ -178,7 +182,9 @@ void run_quest_menu() {
|
|||||||
|
|
||||||
while(true) {
|
while(true) {
|
||||||
wait(5);
|
wait(5);
|
||||||
menu_background_tick();
|
if (menu_background_tick()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (key_pressed(KEY_ESCAPE)) {
|
if (key_pressed(KEY_ESCAPE)) {
|
||||||
speak_with_history("Closed.", true);
|
speak_with_history("Closed.", true);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -21,7 +21,9 @@ int select_note_count(int minNotes, int maxNotes, int startValue) {
|
|||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
wait(5);
|
wait(5);
|
||||||
quest_menu_background_tick();
|
if (quest_menu_background_tick()) {
|
||||||
|
return selection;
|
||||||
|
}
|
||||||
|
|
||||||
if (key_pressed(KEY_UP)) {
|
if (key_pressed(KEY_UP)) {
|
||||||
if (selection < maxNotes) selection++;
|
if (selection < maxNotes) selection++;
|
||||||
@@ -72,6 +74,9 @@ int run_skeletal_bard() {
|
|||||||
wait(400);
|
wait(400);
|
||||||
|
|
||||||
int guess = select_note_count(5, 20, 5);
|
int guess = select_note_count(5, 20, 5);
|
||||||
|
if (return_to_main_menu_requested) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
int diff = length - guess;
|
int diff = length - guess;
|
||||||
if (diff < 0) diff = -diff;
|
if (diff < 0) diff = -diff;
|
||||||
|
|
||||||
@@ -82,6 +87,9 @@ int run_skeletal_bard() {
|
|||||||
speak_with_history("You entered " + guess + " notes and the actual number was " + length + ". " + points + " points. Press Enter to continue.", true);
|
speak_with_history("You entered " + guess + " notes and the actual number was " + length + ". " + points + " points. Press Enter to continue.", true);
|
||||||
while (true) {
|
while (true) {
|
||||||
wait(5);
|
wait(5);
|
||||||
|
if (return_to_main_menu_requested) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
if (key_pressed(KEY_RETURN)) {
|
if (key_pressed(KEY_RETURN)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user