From: Lukas Krickl Date: Sun, 10 Aug 2025 06:28:22 +0000 (+0200) Subject: gameplay: the game now pauses while the door opening animation is playing. X-Git-Url: https://git.krickl.dev/?a=commitdiff_plain;h=e7c192d871569922505ff62a400f1538d31f3e4f;p=gbrg%2F.git gameplay: the game now pauses while the door opening animation is playing. For this a new special flag to pause update was added. This pause needs to be handeled in update routines. This is done to keep rendering some objects while not processing gameplay code. --- diff --git a/src/defs.s b/src/defs.s index a2a6990..7c44c45 100644 --- a/src/defs.s +++ b/src/defs.s @@ -69,6 +69,10 @@ ; gameplay flags .se 1 + ; if this is set units do not update + ; but draw calls still happen + ; this is useful when waiting for an animation +.de GPF_PAUSE_UPDATE, 1 ; cell flags .se 1 diff --git a/src/objanim.s b/src/objanim.s index 3d1e81b..eaa0f00 100644 --- a/src/objanim.s +++ b/src/objanim.s @@ -53,6 +53,11 @@ objanim_door_open: ld a, 0x40 ld [de], a + ; set gameplay flag to pause object updates + ld a, [gameplay_flags] + or a, GPF_PAUSE_UPDATE + ld [gameplay_flags], a + ret ; state function for door opening animation @@ -118,8 +123,13 @@ objanim_door_open_fn: ldnull bc ret -@timer_done: +@timer_done: ld bc, st_null + + ; unset pause object update + ld a, [gameplay_flags] + and a, ~GPF_PAUSE_UPDATE & 0xFF + ld [gameplay_flags], a ret #undefine TMP_X #undefine TMP_Y diff --git a/src/unit.s b/src/unit.s index 9a5933c..39337c3 100644 --- a/src/unit.s +++ b/src/unit.s @@ -25,7 +25,9 @@ units_update: push hl push hl pop de ; need hl in de for parameter - call st_update + ld a, [gameplay_flags] + and a, GPF_PAUSE_UPDATE + call z, st_update pop hl