From e88ae62c08f84a61e6645b3eda6a9f034c28df79 Mon Sep 17 00:00:00 2001 From: Nunuhara Cabbage Date: Tue, 5 Apr 2022 19:31:13 -0700 Subject: [PATCH] Remove scene_flip function It was a bug to call this function outside of sact_Update, because it set scene_is_dirty to false without first rendering the scene. This can cause the scene to not be rendered in a timely manner. --- include/scene.h | 1 - src/hll/SACT2.c | 3 ++- src/input.c | 4 ++-- src/scene.c | 6 ------ 4 files changed, 4 insertions(+), 10 deletions(-) diff --git a/include/scene.h b/include/scene.h index d141f09..cbc581f 100644 --- a/include/scene.h +++ b/include/scene.h @@ -44,7 +44,6 @@ extern bool scene_is_dirty; void scene_register_sprite(struct sprite *sp); void scene_unregister_sprite(struct sprite *sp); void scene_render(void); -void scene_flip(void); int scene_set_wp(int cg_no); int scene_set_wp_color(int r, int g, int b); void scene_set_sprite_z(struct sprite *sp, int z); diff --git a/src/hll/SACT2.c b/src/hll/SACT2.c index 39135e0..0e7f912 100644 --- a/src/hll/SACT2.c +++ b/src/hll/SACT2.c @@ -138,7 +138,8 @@ int sact_Update(void) dungeon_update(); if (scene_is_dirty) { scene_render(); - scene_flip(); + gfx_swap(); + scene_is_dirty = false; } return 1; } diff --git a/src/input.c b/src/input.c index 75317f8..72ce11b 100644 --- a/src/input.c +++ b/src/input.c @@ -298,7 +298,7 @@ void handle_events(void) case SDL_WINDOWEVENT: switch (e.window.event) { case SDL_WINDOWEVENT_EXPOSED: - scene_flip(); + gfx_swap(); break; case SDL_WINDOWEVENT_ENTER: mouse_focus = true; @@ -314,7 +314,7 @@ void handle_events(void) break; case SDL_WINDOWEVENT_SIZE_CHANGED: gfx_update_screen_scale(); - scene_flip(); + gfx_swap(); break; } break; diff --git a/src/scene.c b/src/scene.c index 3feecbe..26e16e9 100644 --- a/src/scene.c +++ b/src/scene.c @@ -81,12 +81,6 @@ void scene_render(void) } } -void scene_flip(void) -{ - gfx_swap(); - scene_is_dirty = false; -} - int scene_set_wp(int cg_no) { if (!cg_no) { gfx_delete_texture(&wp);