objanim: renamed door open animation to allow room for more animations in different...
authorLukas Krickl <lukas@krickl.dev>
Tue, 12 Aug 2025 15:14:05 +0000 (17:14 +0200)
committerLukas Krickl <lukas@krickl.dev>
Tue, 12 Aug 2025 15:14:05 +0000 (17:14 +0200)
src/objanim.s

index 5057a209d73753074f063118dd402ff3440179f7..34bb5abae69cced13536bd40c9e448667ef32cd7 100644 (file)
@@ -20,7 +20,7 @@ objanim_init:
 objanim_door_open:
        push de
        push bc
-       ld de, st_objanim_door_open
+       ld de, st_objanim_door_open_down
        ld hl, objanim
        ld bc, st_size
        call memcpy
@@ -61,9 +61,10 @@ objanim_door_open:
        ret
 
        ; state function for door opening animation
+       ; down
        ; inputs:
        ;               de: objanim
-objanim_door_open_fn:
+objanim_door_open_down_fn:
 #define TMP_Y, scratch
 #define TMP_X, scratch+1
 
@@ -94,11 +95,6 @@ objanim_door_open_fn:
        xor a, a
        ld [hl+], a  ; no flags
 
-       ld de, objanim+obja_timer
-       ld a, [de]
-       dec a
-       ld [de], a ; timer--
-       jr z, @timer_done REL
 
        ; set up second object
        call load_unit_obj
@@ -120,11 +116,22 @@ objanim_door_open_fn:
        xor a, a
        ld [hl], a
 
+       ; check if we are done
+       ld de, objanim+obja_timer
+       ld a, [de]
+       dec a
+       ld [de], a ; timer--
+       jr z, @timer_done REL
 
        ldnull bc
        ret
 @timer_done:
+       call door_open_done
+#undefine TMP_X
+#undefine TMP_Y
 
+       ; completes the door opening animation  
+door_open_done:
        ; unset pause object update
        ld a, [gameplay_flags]
        and a, ~GPF_PAUSE_UPDATE & 0xFF
@@ -132,8 +139,6 @@ objanim_door_open_fn:
 
        ld bc, st_null
        ret
-#undefine TMP_X
-#undefine TMP_Y
 
-st_objanim_door_open:
-       st_def 0x00, objanim_door_open_fn, st_objanim_door_ope
+st_objanim_door_open_down:
+       st_def 0x00, objanim_door_open_down_fn, st_objanim_door_open_dow