From 8961b3731728d5016b0cdd2383587fd4d8563e46 Mon Sep 17 00:00:00 2001 From: Lukas Krickl Date: Mon, 12 May 2025 16:37:38 +0200 Subject: [PATCH] actors: Added states to actor templates --- src/defs.s | 10 ++++++++++ src/macros.inc | 13 +++++++++++++ src/unit.s | 3 ++- 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/defs.s b/src/defs.s index ee02818..9a7eba9 100644 --- a/src/defs.s +++ b/src/defs.s @@ -7,6 +7,8 @@ #define WRAM 0xC000 #define WRAMLEN 0xFFF +#define NULL 0 + #define UNITS_MAX 8 #define STACK_BEGIN 0xDFFF @@ -93,6 +95,14 @@ .de act_pos_x, 1 ; custom parameter .de act_p0, 1 + + ; actor states + ; used for state switching + ; set to 0000 to disable the state +.de act_st_attack, 2 +.de act_st_interact, 2 +.de act_st_active, 2 +.de act_st_idle, 2 .de act_size, 0 ; max bge queue size diff --git a/src/macros.inc b/src/macros.inc index d6620fd..632dfee 100644 --- a/src/macros.inc +++ b/src/macros.inc @@ -161,6 +161,19 @@ .db $10 ; p0 #endmacro + ; defines actor state callbacks + ; inputs: + ; $1: st_attack + ; $2: st_interact + ; $3: st_active + ; $4: st_idle +#macro act_st_def + dw $1 + dw $2 + dw $3 + dw $4 +#endmacro + ; loads NULL into a 16 bit register ; inputs: ; $1: register diff --git a/src/unit.s b/src/unit.s index 288de36..eaed647 100644 --- a/src/unit.s +++ b/src/unit.s @@ -150,6 +150,7 @@ unit_scroll_center: unit_demo_1: st_def 0x00, unit_demo_1_init, st_unit_demo_1_update act_def ACT_T_DEMO_1, 0, 1, 1, 1, 1, 1, 2, 2, 0 - + act_st_def NULL, st_unit_demo_1_update, NULL, NULL + st_unit_demo_1_update: st_def 0x00, unit_demo_1_update, st_unit_demo_1_update -- 2.30.2