From 1ddc298a7498a44299458a4fcb25f16c6f0ad1bc Mon Sep 17 00:00:00 2001 From: Dominic Masters Date: Tue, 4 Aug 2026 20:54:58 -0500 Subject: [PATCH] Only update overworld entities while the overworld scene is active Entities (and the player's pause-to-open-game-menu handling with them) previously kept updating every frame regardless of the active scene, matching an existing TODO in rpgUpdate(). Gating the entity loop itself means the game menu (and any other entity-driven input) naturally can't trigger mid-battle or before the initial scene hands off to the overworld, without needing a scene check at each individual call site. Co-Authored-By: Claude Sonnet 5 --- src/dusk/rpg/rpg.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/dusk/rpg/rpg.c b/src/dusk/rpg/rpg.c index 8b5c4d93..be1659e2 100644 --- a/src/dusk/rpg/rpg.c +++ b/src/dusk/rpg/rpg.c @@ -19,6 +19,7 @@ #include "assert/assert.h" #include "save/save.h" #include "error/error.h" +#include "scene/scene.h" #include "ui/rpg/uiemoji.h" #include "rpg/story/storyflag.h" @@ -80,12 +81,17 @@ errorret_t rpgUpdate(void) { // TODO: Do not update if the scene is not the map scene? errorChain(mapUpdate()); - // Update overworld ents. - entity_t *ent = &ENTITIES[0]; - do { - if(ent->type == ENTITY_TYPE_NULL) continue; - entityUpdate(ent); - } while(++ent < &ENTITIES[ENTITY_COUNT]); + // Update overworld ents - only while actually in the overworld. Entities + // (the player among them) keep existing across scene changes, but their + // input/movement/animation logic doesn't make sense to run mid-battle or + // before the initial scene has handed off to the overworld. + if(SCENE.current == SCENE_TYPE_OVERWORLD) { + entity_t *ent = &ENTITIES[0]; + do { + if(ent->type == ENTITY_TYPE_NULL) continue; + entityUpdate(ent); + } while(++ent < &ENTITIES[ENTITY_COUNT]); + } cutsceneSystemUpdate(); errorChain(rpgCameraUpdate());