From: Lukas Krickl Date: Sun, 26 Jan 2025 17:53:00 +0000 (+0100) Subject: animation: added basic setup for new animation system X-Git-Url: https://git.krickl.dev/?a=commitdiff_plain;h=7ace3e786a4aa16d587d579ff1e274e2d2fbf377;p=gbrg%2F.git animation: added basic setup for new animation system --- diff --git a/src/animation.s b/src/animation.s index 704ba67..7f42aca 100644 --- a/src/animation.s +++ b/src/animation.s @@ -2,13 +2,39 @@ ; each frame the latest animation is ; updated + + ; animation update calls + ; inputs for all: + ; bc: current animation ptr animation_table: dw anim_nop - + dw anim_walk_up + dw anim_walk_down + dw anim_walk_left + dw anim_walk_right + + ; empty animation used as default value anim_nop: ret + ; anim walk_ + ; inputs: + ; anim_p0/p1: ptr to y/x position + +anim_walk_up: + ret + +anim_walk_right: + ret + +anim_walk_left: + ret + +anim_walk_down: + ret + + ; updates the current animation ; an animation is a simple pointer ; to an update function @@ -17,12 +43,14 @@ anim_nop: ; to set itself to 0000 when the animation is finisehd ; this is how anim_finished performs its check anim_update: - ld a, [curr_anim_flags] + ld hl, curr_anim ; hl = anim_flags + ld a, [hl+] ; a = flag and a, ANIM_FREADY ret z + ld a, [hl] ld hl, animation_table - ld a, [curr_anim_type] + ld bc, curr_anim call call_tbl ret diff --git a/src/defs.s b/src/defs.s index 4dfaf44..dc30b06 100644 --- a/src/defs.s +++ b/src/defs.s @@ -205,8 +205,17 @@ ; animation table entries .se 0 .de ANIM_TNOP, 1 +.de ANIM_TWALK_UP, 1 +.de ANIM_TWALK_DOWN, 1 +.de ANIM_TWALK_LEFT, 1 +.de ANIM_TWALK_RIGHT, 1 ; anim entry struct .se 0 .de anim_flags, 1 .de anim_type, 1 +.de anim_p0, 1 +.de anim_p1, 1 +.de anim_p2, 1 +.de anim_p3, 1 +.de anim_size, 0 diff --git a/src/wram.s b/src/wram.s index 2264b6a..9c76d17 100644 --- a/src/wram.s +++ b/src/wram.s @@ -97,12 +97,7 @@ anim_step_x: .adv 1 anim_target_y: .adv 1 anim_target_x: .adv 1 - ; animation flags - ; ANIM_READY is set if the animation can play -curr_anim_flags: .adv 1 - ; animation table index -curr_anim_type: .adv 2 - +curr_anim: .adv anim_size ; collision tile tmp values ct_poy: .adv 1