ingame menu improvements, for replays in particular

This commit is contained in:
Andrei "Akari" Alexeyev 2017-04-21 00:50:33 +03:00
parent e09581adba
commit 4611a2077f
5 changed files with 41 additions and 9 deletions

View file

@ -11,8 +11,7 @@
#include "ingamemenu.h"
#include "global.h"
void continue_game(MenuData *m, void *arg)
{
static void continue_game(MenuData *m, void *arg) {
log_info("The game is being continued...");
if(global.replaymode == REPLAY_RECORD) { // actually... I'd be strange if REPLAY_PLAY ever got there
@ -28,12 +27,10 @@ void continue_game(MenuData *m, void *arg)
delete_projectiles(&global.particles);
}
void give_up(MenuData *m, void *arg) {
static void give_up(MenuData *m, void *arg) {
global.game_over = (MAX_CONTINUES - global.continues)? GAMEOVER_ABORT : GAMEOVER_DEFEAT;
}
void restart_game(MenuData *m, void *arg);
void create_gameover_menu(MenuData *m) {
create_menu(m);
m->draw = draw_ingame_menu;

View file

@ -34,10 +34,32 @@ void create_ingame_menu(MenuData *m) {
m->draw = draw_ingame_menu;
m->flags = MF_Abortable | MF_AlwaysProcessInput;
m->transition = TransEmpty;
m->cursor = 1;
m->context = "Game Paused";
add_menu_entry(m, "Options", enter_options, NULL)->transition = TransMenuDark;
add_menu_entry(m, "Return to Game", menu_commonaction_close, NULL);
add_menu_entry(m, "Restart the Game", restart_game, NULL)->transition = TransFadeBlack;
add_menu_entry(m, "Return to Title", return_to_title, NULL)->transition = TransFadeBlack;
add_menu_entry(m, "Stop the Game", return_to_title, NULL)->transition = TransFadeBlack;
set_transition(TransEmpty, 0, m->transition_out_time);
}
static void skip_stage(MenuData *m, void *arg) {
global.game_over = GAMEOVER_WIN;
menu_commonaction_close(m, arg);
}
void create_ingame_menu_replay(MenuData *m) {
create_menu(m);
m->draw = draw_ingame_menu;
m->flags = MF_Abortable | MF_AlwaysProcessInput;
m->transition = TransEmpty;
m->cursor = 1;
m->context = "Replay Paused";
add_menu_entry(m, "Options", enter_options, NULL)->transition = TransMenuDark;
add_menu_entry(m, "Continue Watching", menu_commonaction_close, NULL);
add_menu_entry(m, "Restart the Stage", restart_game, NULL)->transition = TransFadeBlack;
add_menu_entry(m, "Skip the Stage", skip_stage, NULL)->transition = TransFadeBlack;
add_menu_entry(m, "Stop Watching", return_to_title, NULL)->transition = TransFadeBlack;
m->cursor = 1;
set_transition(TransEmpty, 0, m->transition_out_time);
}

View file

@ -11,8 +11,11 @@
#include "menu.h"
void draw_ingame_menu_bg(MenuData *menu, float f);
void create_ingame_menu(MenuData *menu);
void draw_ingame_menu(MenuData *menu);
void create_ingame_menu(MenuData *menu);
void create_ingame_menu_replay(MenuData *m);
void restart_game(MenuData *m, void *arg);
#endif

View file

@ -680,6 +680,10 @@ void replay_play(Replay *rpy, int firstidx) {
break;
}
if(global.game_over == GAMEOVER_RESTART) {
--i;
}
global.game_over = 0;
}

View file

@ -202,7 +202,13 @@ static void stage_start(StageInfo *stage) {
void stage_pause(void) {
MenuData menu;
stop_bgm(false);
create_ingame_menu(&menu);
if(global.replaymode == REPLAY_PLAY) {
create_ingame_menu_replay(&menu);
} else {
create_ingame_menu(&menu);
}
menu_loop(&menu);
resume_bgm();
}