single stage mode: act like a practice mode; ability to save replays
This commit is contained in:
parent
dc52106888
commit
80e2328e18
4 changed files with 35 additions and 22 deletions
|
@ -15,6 +15,7 @@
|
|||
#include "audio.h"
|
||||
#include "stage.h"
|
||||
#include "menu/mainmenu.h"
|
||||
#include "menu/savereplay.h"
|
||||
#include "gamepad.h"
|
||||
#include "resource/bgm.h"
|
||||
#include "progress.h"
|
||||
|
@ -281,6 +282,7 @@ int main(int argc, char **argv) {
|
|||
assert(stg); // properly checked before this
|
||||
|
||||
global.diff = stg->difficulty;
|
||||
global.is_practice_mode = (stg->type != STAGE_EXTRA);
|
||||
|
||||
if(a.diff) {
|
||||
global.diff = a.diff;
|
||||
|
@ -302,6 +304,7 @@ int main(int argc, char **argv) {
|
|||
stage_loop(stg);
|
||||
} while(global.game_over == GAMEOVER_RESTART);
|
||||
|
||||
ask_save_replay();
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -89,22 +89,7 @@ static void start_game_internal(MenuData *menu, StageInfo *info, bool difficulty
|
|||
} while(restart);
|
||||
|
||||
free_resources(false);
|
||||
assert(global.replay_stage != NULL);
|
||||
|
||||
switch(config_get_int(CONFIG_SAVE_RPY)) {
|
||||
case 0: break;
|
||||
|
||||
case 1: {
|
||||
save_rpy(menu, NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
case 2: {
|
||||
create_saverpy_menu(&m);
|
||||
menu_loop(&m);
|
||||
break;
|
||||
}
|
||||
}
|
||||
ask_save_replay();
|
||||
|
||||
global.replay_stage = NULL;
|
||||
|
||||
|
|
|
@ -16,8 +16,7 @@
|
|||
#include "plrmodes.h"
|
||||
#include "common.h"
|
||||
|
||||
void save_rpy(MenuData *menu, void *a) {
|
||||
Replay *rpy = &global.replay;
|
||||
static void do_save_replay(Replay *rpy) {
|
||||
char strtime[128], name[128];
|
||||
time_t rawtime;
|
||||
struct tm * timeinfo;
|
||||
|
@ -40,7 +39,11 @@ void save_rpy(MenuData *menu, void *a) {
|
|||
replay_save(rpy, name);
|
||||
}
|
||||
|
||||
void draw_saverpy_menu(MenuData *m) {
|
||||
static void save_rpy(MenuData *menu, void *a) {
|
||||
do_save_replay(&global.replay);
|
||||
}
|
||||
|
||||
static void draw_saverpy_menu(MenuData *m) {
|
||||
int i;
|
||||
|
||||
draw_options_menu_bg(m);
|
||||
|
@ -75,7 +78,7 @@ void draw_saverpy_menu(MenuData *m) {
|
|||
glPopMatrix();
|
||||
}
|
||||
|
||||
bool savepry_input_handler(SDL_Event *event, void *arg) {
|
||||
static bool savepry_input_handler(SDL_Event *event, void *arg) {
|
||||
if(event->type == MAKE_TAISEI_EVENT(TE_MENU_CURSOR_LEFT)) {
|
||||
event->type = MAKE_TAISEI_EVENT(TE_MENU_CURSOR_UP);
|
||||
} else if(event->type == MAKE_TAISEI_EVENT(TE_MENU_CURSOR_RIGHT)) {
|
||||
|
@ -85,7 +88,7 @@ bool savepry_input_handler(SDL_Event *event, void *arg) {
|
|||
return false;
|
||||
}
|
||||
|
||||
void saverpy_menu_input(MenuData *menu) {
|
||||
static void saverpy_menu_input(MenuData *menu) {
|
||||
events_poll((EventHandler[]){
|
||||
{ .proc = savepry_input_handler, .arg = menu },
|
||||
{ .proc = menu_input_handler, .arg = menu },
|
||||
|
@ -103,3 +106,25 @@ void create_saverpy_menu(MenuData *m) {
|
|||
add_menu_entry(m, "Yes", save_rpy, NULL);
|
||||
add_menu_entry(m, "No", menu_commonaction_close, NULL);
|
||||
}
|
||||
|
||||
void ask_save_replay(void) {
|
||||
assert(global.replay_stage != NULL);
|
||||
|
||||
switch(config_get_int(CONFIG_SAVE_RPY)) {
|
||||
case 0: {
|
||||
break;
|
||||
}
|
||||
|
||||
case 1: {
|
||||
do_save_replay(&global.replay);
|
||||
break;
|
||||
}
|
||||
|
||||
case 2: {
|
||||
MenuData m;
|
||||
create_saverpy_menu(&m);
|
||||
menu_loop(&m);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,5 +11,5 @@
|
|||
|
||||
#include "menu.h"
|
||||
|
||||
void save_rpy(MenuData *menu, void*);
|
||||
void create_saverpy_menu(MenuData*);
|
||||
void ask_save_replay(void);
|
||||
|
|
Loading…
Reference in a new issue