shithub: wipeout

Download patch

ref: 0ded93de55bac828276e8a16877d6edf1f924d95
parent: 24b6efd3ea9d12661a96bfbed6bc86241e30aa70
author: Dominic Szablewski <dominic@phoboslab.org>
date: Tue Aug 15 19:37:05 EDT 2023

Allow for A_MENU_START to select in menu; add A_MENU_QUIT to go back

--- a/src/wipeout/menu.c
+++ b/src/wipeout/menu.c
@@ -182,7 +182,7 @@
 			if (entry->type == MENU_ENTRY_TOGGLE) {
 				vec2i_t toggle_pos = items_pos;
 				toggle_pos.x += page->block_width - ui_text_width(entry->options[entry->data], UI_SIZE_8);
-				ui_draw_text(entry->options[entry->data], ui_scaled_pos(page->items_anchor, toggle_pos), UI_SIZE_8, text_color);	
+				ui_draw_text(entry->options[entry->data], ui_scaled_pos(page->items_anchor, toggle_pos), UI_SIZE_8, text_color);
 			}
 			items_pos.y += 12;
 		}
@@ -189,7 +189,7 @@
 	}
 
 	// Handle back buttons
-	if (input_pressed(A_MENU_BACK)) {
+	if (input_pressed(A_MENU_BACK) || input_pressed(A_MENU_QUIT)) {
 		if (menu->index != 0) {
 			menu_pop(menu);
 			sfx_play(SFX_MENU_SELECT);
@@ -216,7 +216,7 @@
 				entry->select_func(menu, entry->data);
 			}
 		}
-		else if (input_pressed(A_MENU_RIGHT) || input_pressed(A_MENU_SELECT)) {
+		else if (input_pressed(A_MENU_RIGHT) || input_pressed(A_MENU_SELECT) || input_pressed(A_MENU_START)) {
 			sfx_play(SFX_MENU_SELECT);
 			entry->data = (entry->data + 1) % entry->options_len;
 			if (entry->select_func) {
@@ -227,7 +227,7 @@
 
 	// Handle buttons
 	else {
-		if (input_pressed(A_MENU_SELECT)) {
+		if (input_pressed(A_MENU_SELECT) || input_pressed(A_MENU_START)) {
 			if (entry->select_func) {
 				sfx_play(SFX_MENU_SELECT);
 				if (entry->type == MENU_ENTRY_TOGGLE) {
--- a/src/wipeout/race.c
+++ b/src/wipeout/race.c
@@ -68,7 +68,15 @@
 }
 
 void race_update() {
-	if (!is_paused) {
+	if (is_paused) {
+		if (!active_menu) {
+			active_menu = pause_menu_init();
+		}
+		if (input_pressed(A_MENU_QUIT)) {
+			race_unpause();
+		}
+	}
+	else {
 		ships_update();
 		droid_update(&g.droid, &g.ships[g.pilot]);
 		camera_update(&g.camera, &g.ships[g.pilot], &g.droid);
@@ -88,14 +96,10 @@
 				game_set_scene(GAME_SCENE_TITLE);
 			}
 		}
-		else if (active_menu == NULL && input_pressed(A_MENU_START)) {
+		else if (active_menu == NULL && (input_pressed(A_MENU_START) || input_pressed(A_MENU_QUIT))) {
 			race_pause();
-
 		}
 	}
-	else if (input_pressed(A_MENU_START)) {
-		race_unpause();
-	}
 
 
 	// Draw 3D
@@ -259,7 +263,6 @@
 void race_pause() {
 	sfx_pause();
 	is_paused = true;
-	active_menu = pause_menu_init();
 }
 
 void race_unpause() {