Fixes COMPLETED state for quick games
This commit is contained in:
parent
aea9995c68
commit
7991e7c1ce
16
src/main.c
16
src/main.c
|
@ -355,6 +355,12 @@ exitGame(void *unused)
|
||||||
gGameState = QUIT;
|
gGameState = QUIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool
|
||||||
|
gameCompleted(void)
|
||||||
|
{
|
||||||
|
return cLevel >= 20 || (quickGame && cLevel >= 12);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
toggleInGameMenu(void *unused)
|
toggleInGameMenu(void *unused)
|
||||||
{
|
{
|
||||||
|
@ -365,7 +371,7 @@ toggleInGameMenu(void *unused)
|
||||||
gGameState = IN_GAME_MENU;
|
gGameState = IN_GAME_MENU;
|
||||||
else if (is_player_dead())
|
else if (is_player_dead())
|
||||||
gGameState = GAME_OVER;
|
gGameState = GAME_OVER;
|
||||||
else if (cLevel >= 20)
|
else if (gameCompleted())
|
||||||
gGameState = COMPLETED;
|
gGameState = COMPLETED;
|
||||||
else
|
else
|
||||||
gGameState = PLAYING;
|
gGameState = PLAYING;
|
||||||
|
@ -740,7 +746,7 @@ end_game_details(void)
|
||||||
static void
|
static void
|
||||||
check_next_level(void)
|
check_next_level(void)
|
||||||
{
|
{
|
||||||
if (cLevel >= 20) {
|
if (gameCompleted()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -764,7 +770,7 @@ check_next_level(void)
|
||||||
mixer_play_music(GAME_MUSIC0 + get_random(2));
|
mixer_play_music(GAME_MUSIC0 + get_random(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cLevel < 20) {
|
if (!gameCompleted()) {
|
||||||
resetGame();
|
resetGame();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -965,7 +971,7 @@ run_game(void)
|
||||||
{
|
{
|
||||||
run_game_update();
|
run_game_update();
|
||||||
|
|
||||||
if (cLevel >= 20) {
|
if (gameCompleted()) {
|
||||||
SDL_SetRenderDrawColor(gRenderer, 0, 0, 0, 255);
|
SDL_SetRenderDrawColor(gRenderer, 0, 0, 0, 255);
|
||||||
SDL_RenderClear(gRenderer);
|
SDL_RenderClear(gRenderer);
|
||||||
render_game_completed();
|
render_game_completed();
|
||||||
|
@ -992,7 +998,7 @@ run_game(void)
|
||||||
check_next_level();
|
check_next_level();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gGameState == PLAYING && (cLevel >= 20 || (quickGame && cLevel >= 12))) {
|
if (gGameState == PLAYING && (gameCompleted())) {
|
||||||
gGameState = COMPLETED;
|
gGameState = COMPLETED;
|
||||||
createInGameGameOverMenu();
|
createInGameGameOverMenu();
|
||||||
gui_event_message("Your break is over!");
|
gui_event_message("Your break is over!");
|
||||||
|
|
Loading…
Reference in New Issue