From 7ca15b440f10c87fac1b9c7bbbbbcad1edfc4ffd Mon Sep 17 00:00:00 2001 From: "Juan J. Martinez" Date: Thu, 3 Aug 2023 21:07:51 +0100 Subject: Improved ready and stage clear transitions --- src/game.c | 46 ++++++++++++++++++++-------------------------- 1 file changed, 20 insertions(+), 26 deletions(-) diff --git a/src/game.c b/src/game.c index d440cb8..8f97a3b 100644 --- a/src/game.c +++ b/src/game.c @@ -225,9 +225,17 @@ static uint8_t run_gameover() static void run_stageclear() { + blit_target(TARGET_BUFFER); + blit_erase(0); + + hud = HUD_ALL; + hud_render(); + put_text(116, 90, "STAGE", 1); + put_text(164, 90, "CLEAR", 1); + wait_vsync(); - put_text(116, 100, "STAGE", 1); - put_text(164, 100, "CLEAR", 1); + blit_copy_all(); + blit_target(TARGET_SCREEN); sound_music_pattern(PAT_STAGE); @@ -249,16 +257,6 @@ static void run_stageclear() /* wait some time */ wait_frames(64); - - wait_vsync(); - blit_erase(0); - - /* restore the HUD after erasing the screen */ - hud = HUD_ALL; - wait_vsync(); - hud_render(); - - wait_frames(32); } void run_game() @@ -290,31 +288,27 @@ next_stage: blit_target(TARGET_BUFFER); blit_erase(0); - map_init(stages[stage]); - - map_render(); hud_render(); + put_text(136, 90, "READY?", 1); wait_vsync(); blit_copy_all(); - entities_sort(); + sound_music_pattern(PAT_READY); - blit_target(TARGET_SCREEN); - wait_vsync(); + /* wait some time */ + wait_frames(164); - entities_draw(); - put_text(136, 100, "READY?", 1); + map_init(stages[stage]); + map_render(); - sound_music_pattern(PAT_READY); + entities_sort(); - /* wait some time */ - wait_frames(128); + wait_vsync(); + blit_copy_all(); - /* erase the READY? text */ - Rect ready = { 136, 100, 184, 8 }; + blit_target(TARGET_SCREEN); wait_vsync(); - blit_copy(&ready); entities_draw(); timer_start(GAME_TIME_MAX, &clock_updated); -- cgit v1.2.3