This can be used for simple cursor actions
#define CURSOR_MIN_X 0
#define CURSOR_MAX_X 0xF8
#define CURSOR_MIN_Y 0
-#define CURSOR_MAX_Y 0xB8
+#define CURSOR_MAX_Y 0xB8
+
+ ; state struct
+.se 0
+ ; time until next state
+.de st_time, 1
+ ; state routine
+.de st_routine, 2
+ ; next state
+.de st_next, 2
+.de st_size, 0
+
+ ; actor struct
+.se 0
+ ; current state
+.de act_state, 2
+ ; state timer
+ ; when it hits 0
+ ; goto next
+.de act_time, 1
+ ; custom parameter
+.de act_p0, 1
+.de act_size, 0
ld [$1], a
#endmacro
+ ; defines a state
+ ; to be used by actors
+ ; inputs:
+ ; $1 timer
+ ; $2 routine
+ ; $3 next
+#macro st_def
+ .db $1
+ dw $2
+ dw $3
+#endmacro
#include "audio.s"
#include "map.s"
#include "simulation.s"
-
+#include "state.s"
#include "tiles.inc"
; fill bank
--- /dev/null
+ ; updates the state of an actor
+ ; inputs:
+ ; hl: actor
+st_update:
+ ret
+
+st_null_fn:
+ ret
+
+st_null:
+ st_def 0xFF, st_null_fn, st_null
; seed must never be 0
srand: .adv 2
+ ; actors
+ ; actors are state machines
+ ; they get updated once a frame
+actor_player: .adv act_size
+
; game state
; this region holds the entire game state
; everything thats needed for a savme game should be