#include "game_common.h"
#include "st_done.h"
-#include "st_start.h"
+#include "st_level.h"
#include "st_name.h"
#include "st_shared.h"
switch (i)
{
case DONE_OK:
- return goto_state(&st_start);
+ return goto_state(&st_exit);
case GUI_NAME:
return goto_name(&st_done, &st_done, 0);
#include "game_server.h"
#include "game_client.h"
-#include "st_over.h"
-#include "st_start.h"
#include "st_save.h"
#include "st_fail.h"
#include "st_level.h"
case FAIL_OVER:
progress_stop();
- return goto_state(&st_over);
+ return goto_state(&st_exit);
case FAIL_SAVE:
progress_stop();
#include "st_goal.h"
#include "st_save.h"
-#include "st_over.h"
-#include "st_done.h"
-#include "st_start.h"
#include "st_level.h"
#include "st_name.h"
#include "st_shared.h"
case GOAL_OVER:
progress_stop();
- return goto_state(&st_over);
+ return goto_state(&st_exit);
case GOAL_SAVE:
progress_stop();
case GOAL_DONE:
progress_stop();
progress_exit();
- return goto_state(&st_done);
+ return goto_state(&st_exit);
case GOAL_LAST:
progress_stop();
- return goto_state(&st_start);
+ return goto_state(&st_exit);
case GUI_SCORE_COIN:
case GUI_SCORE_TIME:
#include "st_play.h"
#include "st_start.h"
#include "st_over.h"
+#include "st_done.h"
#include "st_shared.h"
/*---------------------------------------------------------------------------*/
if (config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, b))
{
progress_stop();
- return goto_state(&st_over);
+ return goto_state(&st_exit);
}
}
return 1;
return 1;
}
+
+/*---------------------------------------------------------------------------*/
+
+static int exit_enter(struct state *st, struct state *prev)
+{
+ struct state *dst;
+
+ if (progress_done())
+ dst = &st_done;
+ else if (curr_mode() == MODE_CHALLENGE)
+ dst = &st_over;
+ else
+ dst = &st_start;
+
+ /* Visit the auxilliary screen or exit to level selection. */
+
+ goto_state(dst != prev ? dst : &st_start);
+
+ return 0;
+}
+
/*---------------------------------------------------------------------------*/
struct state st_level = {
nodemo_buttn,
1, 0
};
+
+struct state st_exit = {
+ exit_enter,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ 1, 0
+};
#include "state.h"
extern struct state st_level;
+extern struct state st_exit;
extern struct state st_poser;
extern struct state st_nodemo;
#include "game_common.h"
#include "st_over.h"
-#include "st_start.h"
+#include "st_level.h"
#include "st_shared.h"
/*---------------------------------------------------------------------------*/
static int over_enter(struct state *st, struct state *prev)
{
- if (curr_mode() != MODE_CHALLENGE)
- return 0;
-
audio_music_fade_out(2.0f);
audio_play(AUD_OVER, 1.f);
static void over_timer(int id, float dt)
{
- if (curr_mode() != MODE_CHALLENGE || time_state() > 3.f)
- goto_state(&st_start);
+ if (time_state() > 3.f)
+ goto_state(&st_exit);
gui_timer(id, dt);
}
static int over_click(int b, int d)
{
- return (b == SDL_BUTTON_LEFT && d == 1) ? goto_state(&st_start) : 1;
+ return (b == SDL_BUTTON_LEFT && d == 1) ? goto_state(&st_exit) : 1;
}
static int over_buttn(int b, int d)
{
if (config_tst_d(CONFIG_JOYSTICK_BUTTON_A, b) ||
config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, b))
- return goto_state(&st_start);
+ return goto_state(&st_exit);
}
return 1;
}
#include "game_common.h"
#include "st_play.h"
-#include "st_over.h"
+#include "st_level.h"
#include "st_pause.h"
#include "st_shared.h"
progress_stop();
SDL_PauseAudio(0);
audio_music_stop();
- return goto_state(&st_over);
+ return goto_state(&st_exit);
}
return 1;
#include "st_play.h"
#include "st_goal.h"
#include "st_fail.h"
-#include "st_over.h"
#include "st_pause.h"
#include "st_level.h"
#include "st_shared.h"
video_clr_grab();
- return goto_state(&st_over);
+ return goto_state(&st_exit);
}
}
#include "game_common.h"
#include "st_set.h"
-#include "st_over.h"
#include "st_level.h"
#include "st_start.h"
#include "st_title.h"