From e4a9a6948dc927c4bfd6e0c14219ff55f96bc9b1 Mon Sep 17 00:00:00 2001 From: Lukas Krickl Date: Fri, 8 Aug 2025 06:38:09 +0200 Subject: [PATCH] object animation: added stub for object animations This system will allow playing simple animations e.g. when a door opens. --- src/defs.s | 18 +++++++++++++----- src/main.s | 1 + src/mem.s | 3 ++- src/objanim.s | 4 ++++ src/wram.s | 5 +++-- 5 files changed, 23 insertions(+), 8 deletions(-) create mode 100644 src/objanim.s diff --git a/src/defs.s b/src/defs.s index ce128fd..b12ada4 100644 --- a/src/defs.s +++ b/src/defs.s @@ -316,6 +316,19 @@ ; pointer to new map struct .de exit_to, 2 .de exit_size, 0 + + ; object animation struct + ; simple call in update code + ; with a single state + ; intended for use with short-term map animations + ; e.g. door opening +.se 0 +.de obja_st, st_size +.de obja_flags, 1 +.de obja_pos_y, 1 +.de obja_pos_x, 1 +.de obja_dat, 1 +.de obja_size, 0 ; special text commands @@ -324,12 +337,7 @@ ; byte as a number #define TEXT_NUMBER 0x80 - ; dice display - ; constants -#define DD_TIME 90 -#define DD_D0_TILE 0x90 -#define DD_CROSS_TILE 0xA0 #define DISTANCE_BGTA 1 #define DISTANCE_AGTB 0 diff --git a/src/main.s b/src/main.s index 2972f72..677a7f4 100644 --- a/src/main.s +++ b/src/main.s @@ -76,6 +76,7 @@ main: #include "demos.s" #include "mainmenu.s" #include "actsave.s" +#include "objanim.s" ; fill bank .fill 0xFF, 0x4000 - $ diff --git a/src/mem.s b/src/mem.s index cd99e3e..7ffb0e1 100644 --- a/src/mem.s +++ b/src/mem.s @@ -32,7 +32,8 @@ mem_init: ld hl, st_unit_delay_to_active ld bc, st_size call memcpy - + + call objanim_init ; set up default game speed ld a, GAME_SPEED_DEFAULT diff --git a/src/objanim.s b/src/objanim.s new file mode 100644 index 0000000..d13fca2 --- /dev/null +++ b/src/objanim.s @@ -0,0 +1,4 @@ + + ; sets up object animation state +objanim_init: + ret diff --git a/src/wram.s b/src/wram.s index 65491e1..e3c7990 100644 --- a/src/wram.s +++ b/src/wram.s @@ -73,8 +73,6 @@ redraw_steps: .adv 1 ; same memory as empty_unit empty_oam: .adv oamsize - ; ptr to actor for next UI update -ui_draw_actor: .adv 2 ; can be used for custom state transtions ; simple write state info to this location @@ -94,6 +92,9 @@ scroll_x: .adv 1 ; allows us to move scroll when needed scroll_move_y: .adv 1 scroll_move_x: .adv 1 + + ; state for object animation +objanim: .adv obja_size ; game state ; this region holds the entire game state -- 2.30.2