gameplay: the game now pauses while the door opening animation is playing.
authorLukas Krickl <lukas@krickl.dev>
Sun, 10 Aug 2025 06:28:22 +0000 (08:28 +0200)
committerLukas Krickl <lukas@krickl.dev>
Sun, 10 Aug 2025 06:28:22 +0000 (08:28 +0200)
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.

src/defs.s
src/objanim.s
src/unit.s

index a2a6990027800dd52198cf61f47704dd672e8364..7c44c45b8144c8c848b4e07ae9ba6af880b5a6c6 100644 (file)
 
   ; 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 
index 3d1e81b393db0c71dc1fb33e685450475a11b880..eaa0f0059177d7dcc7a347f167e37c53d16b321d 100644 (file)
@@ -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
index 9a5933c4f8e2d3dfd4caa326547ced825c44f5f8..39337c39a36d807f9c34b7cb5b43e27169f82bfa 100644 (file)
@@ -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