; returns:
; bc: null
.de act_draw, 2
+
+ ; act_oam_tile + flags
+ ; if using generic draw:
+ ; 2 tiles are used
+ ; tile 1 is the tile specified here
+ ; tile 2 is the tile following tile 1
+ ; flags are used for both tiles
+ ; optional:
+ ; tile + flags may be a pointer to a
+ ; tile table. This can be implemented as needed
.de act_oam_tile, 1
.de act_oam_flags, 1
ld b, a ; tile
ld a, [hl]
ld c, a ; flags
+ ld a, 0 ; no x-offset
+ push bc
call unit_generic_draw
+
+ ; draw same tile again
+ pop bc
pop de
+ push de
+ inc b ; b++
+ ld a, 8 ; 8 x-offset
+ call unit_generic_draw
+ pop de
+
ldnull bc
ret
; draws any unit
; inputs:
; de: actor
- ; b: tile
+ ; a: x-offset for tiles
+ ; b: tile1
; c: flags
unit_generic_draw:
#define TMP_OAMFLAG_PRIO scratch
+#define TMP_X_OFFSET scratch+1
+ ld [TMP_X_OFFSET], a ; save for later
+
push de ; save actor
xor a, a
mul16 a
add a, OBJ_OFF_X
sub a, c
+ ld c, a
+ ld a, [TMP_X_OFFSET]
+ add a, c
ld [hl+], a
pop bc ; bc = inputs again
ldnull bc
ret
#undefine TMP_OAMFLAG_PRIO
+#undefine TMP_X_OFFSET
; generic unit input handler
; inputs: