mirror of
https://github.com/phoboslab/wipeout-rewrite
synced 2025-01-13 20:01:54 +01:00
Allow for A_MENU_START to select in menu; add A_MENU_QUIT to go back
This commit is contained in:
parent
24b6efd3ea
commit
0ded93de55
2 changed files with 14 additions and 11 deletions
|
@ -182,14 +182,14 @@ void menu_update(menu_t *menu) {
|
||||||
if (entry->type == MENU_ENTRY_TOGGLE) {
|
if (entry->type == MENU_ENTRY_TOGGLE) {
|
||||||
vec2i_t toggle_pos = items_pos;
|
vec2i_t toggle_pos = items_pos;
|
||||||
toggle_pos.x += page->block_width - ui_text_width(entry->options[entry->data], UI_SIZE_8);
|
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;
|
items_pos.y += 12;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle back buttons
|
// Handle back buttons
|
||||||
if (input_pressed(A_MENU_BACK)) {
|
if (input_pressed(A_MENU_BACK) || input_pressed(A_MENU_QUIT)) {
|
||||||
if (menu->index != 0) {
|
if (menu->index != 0) {
|
||||||
menu_pop(menu);
|
menu_pop(menu);
|
||||||
sfx_play(SFX_MENU_SELECT);
|
sfx_play(SFX_MENU_SELECT);
|
||||||
|
@ -216,7 +216,7 @@ void menu_update(menu_t *menu) {
|
||||||
entry->select_func(menu, entry->data);
|
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);
|
sfx_play(SFX_MENU_SELECT);
|
||||||
entry->data = (entry->data + 1) % entry->options_len;
|
entry->data = (entry->data + 1) % entry->options_len;
|
||||||
if (entry->select_func) {
|
if (entry->select_func) {
|
||||||
|
@ -227,7 +227,7 @@ void menu_update(menu_t *menu) {
|
||||||
|
|
||||||
// Handle buttons
|
// Handle buttons
|
||||||
else {
|
else {
|
||||||
if (input_pressed(A_MENU_SELECT)) {
|
if (input_pressed(A_MENU_SELECT) || input_pressed(A_MENU_START)) {
|
||||||
if (entry->select_func) {
|
if (entry->select_func) {
|
||||||
sfx_play(SFX_MENU_SELECT);
|
sfx_play(SFX_MENU_SELECT);
|
||||||
if (entry->type == MENU_ENTRY_TOGGLE) {
|
if (entry->type == MENU_ENTRY_TOGGLE) {
|
||||||
|
|
|
@ -68,7 +68,15 @@ void race_init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void race_update() {
|
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();
|
ships_update();
|
||||||
droid_update(&g.droid, &g.ships[g.pilot]);
|
droid_update(&g.droid, &g.ships[g.pilot]);
|
||||||
camera_update(&g.camera, &g.ships[g.pilot], &g.droid);
|
camera_update(&g.camera, &g.ships[g.pilot], &g.droid);
|
||||||
|
@ -88,14 +96,10 @@ void race_update() {
|
||||||
game_set_scene(GAME_SCENE_TITLE);
|
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();
|
race_pause();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (input_pressed(A_MENU_START)) {
|
|
||||||
race_unpause();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Draw 3D
|
// Draw 3D
|
||||||
|
@ -259,7 +263,6 @@ void race_release_control() {
|
||||||
void race_pause() {
|
void race_pause() {
|
||||||
sfx_pause();
|
sfx_pause();
|
||||||
is_paused = true;
|
is_paused = true;
|
||||||
active_menu = pause_menu_init();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void race_unpause() {
|
void race_unpause() {
|
||||||
|
|
Loading…
Reference in a new issue