; checks collision
; inputs:
; $1: point to check
- ; $2: label to jump to (jr)
+ ; $2: y offset
+ ; $3: x offset
+ ; $4: label to jump to (jr)
#macro _act_tile_col_check
_act_col_load_pt $1
+ ld a, b
+ add a, $2
+ ld b, a
+
+ ld a, c
+ add a, $3
+ ld c, a
div16 b
div16 c
add hl, de
ld a, [hl]
and a, TF_WALL
- jr nz, $2 REL
+ jr nz, $4 REL
#endmacro
; test direction routines:
push de
; top left point
- _act_tile_col_check col_point_tl, @collision
+ _act_tile_col_check col_point_tl, (-1 & 0xFF), 0, @collision
; bottom left point
- _act_tile_col_check col_point_bl, @collision
+ _act_tile_col_check col_point_bl, (-1 & 0xFF), 0, @collision
pop de
ret
push de
; top right point
- _act_tile_col_check col_point_tr, @collision
+ _act_tile_col_check col_point_tr, (-1 & 0xFF), 0, @collision
; bottom right point
- _act_tile_col_check col_point_br, @collision
+ _act_tile_col_check col_point_br, (-1 & 0xFF), 0, @collision
pop de
ret
push de
; top left point
- _act_tile_col_check col_point_tl, @collision
+ _act_tile_col_check col_point_tl, 0, (-1 & 0xFF), @collision
; top right point
- _act_tile_col_check col_point_tr, @collision
+ _act_tile_col_check col_point_tr, 0, (-1 & 0xFF), @collision
pop de
ret
push de
; bottom left point
- _act_tile_col_check col_point_bl, @collision
+ _act_tile_col_check col_point_bl, 0, (-1 & 0xFF), @collision
; bottom rihgt point
- _act_tile_col_check col_point_br, @collision
+ _act_tile_col_check col_point_br, 0, (-1 & 0xFF), @collision
pop de
ret
.db TWL, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS
.db TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS
.db TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS
- .db TGS, TGS, TGS, TGS, TWL, TGS, TGS, TGS, TGS, TGS
+ .db TGS, TGS, TGS, TWL, TWL, TWL, TGS, TGS, TGS, TGS
.db TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS
.db TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS
.db TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TWL