EXIT to menu (including after last level)

This commit is contained in:
Lephenixnoir 2021-08-22 01:09:46 +02:00
parent 81f316eae6
commit 07301f1b8d
Signed by: Lephenixnoir
GPG Key ID: 1BBA026E13FC0495
1 changed files with 25 additions and 11 deletions

View File

@ -80,17 +80,8 @@ int strcount(char const *str, int c)
return count;
}
int main(void)
void game_loop(int current_episode, int current_level)
{
__printf_enable_fp();
/* Azur trickz for less tearing */
r61524_set(0x010, 0x0010);
int current_episode = 0;
int current_level = 0;
main_menu(&current_episode, &current_level);
game_t game;
memset(&game, 0x00, sizeof game);
@ -164,9 +155,13 @@ int main(void)
bool rotate_left=false, rotate_right=false;
key_event_t e;
bool stop_playing=false;
while ((e = pollevent()).type != KEYEV_NONE) {
if (e.type == KEYEV_DOWN && e.key == KEY_MENU)
gint_osmenu();
if (e.type == KEYEV_DOWN && e.key == KEY_EXIT)
stop_playing = true;
}
if (keydown(KEY_7)) {
rotate_left = true;
@ -174,6 +169,8 @@ int main(void)
if (keydown(KEY_0)) {
rotate_right = true;
}
if (stop_playing)
break;
/* Level transitions */
@ -286,5 +283,22 @@ int main(void)
}
timer_stop(timer);
return (1);
}
int main(void)
{
__printf_enable_fp();
/* Azur trickz for less tearing */
r61524_set(0x010, 0x0010);
int current_episode = 0;
int current_level = 0;
while(1) {
main_menu(&current_episode, &current_level);
game_loop(current_episode, current_level);
}
return 1;
}