From: Lukas Krickl Date: Mon, 27 Jan 2025 12:31:16 +0000 (+0100) Subject: anim: added static animation step variable X-Git-Url: https://git.krickl.dev/?a=commitdiff_plain;h=4b6e78eae18dc6796e7e853058ca3d7c502c380c;p=gbrg%2F.git anim: added static animation step variable --- diff --git a/src/animation.s b/src/animation.s index ff8359e..b573d73 100644 --- a/src/animation.s +++ b/src/animation.s @@ -28,15 +28,28 @@ anim_nop: ; inputs: ; anim_p0/p1: ptr to y/x position ; anim_p2: direction - ; anim_p3: frames of movemnet + ; anim_step: frames of movemnet anim_walk_simple: ; 1) check direction ; bc = anim type inc bc - inc bc + ; bc = anim step + push bc ; we need the step ptr again + ld a, [bc] ; a = anim_step + ld d, a ; d = step counter + cp a, 0 + dec bc ; bc = anim type + ; finish animation if step counter is 0 + jp z, anim_finish + + ; go to p0 + inc bc + inc bc + inc bc ; bc = p0 + ; load ptr to y/x inc bc ld a, [bc] @@ -48,7 +61,8 @@ anim_walk_simple: ; bc = p2 ld a, [bc] - + pop bc ; bc = anim_step ptr + ; jump to direction cp a, NORTH jr z, @north REL diff --git a/src/defs.s b/src/defs.s index 9100bdb..3321db4 100644 --- a/src/defs.s +++ b/src/defs.s @@ -208,6 +208,7 @@ ; anim entry struct .se 0 .de anim_type, 1 +.de anim_step, 1 .de anim_flags, 1 .de anim_p0, 1 .de anim_p1, 1