From b17c083ffb68ceb0e6e1445229cba64fe98a80bb Mon Sep 17 00:00:00 2001 From: Lukas Krickl Date: Thu, 10 Oct 2024 19:51:26 +0200 Subject: [PATCH] wip: added static location for collision check inputs --- src/collision.s | 21 ++++++++++++++++++++- src/wram.s | 6 ++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/collision.s b/src/collision.s index bb54428..d1bca5e 100644 --- a/src/collision.s +++ b/src/collision.s @@ -32,12 +32,31 @@ collision_player: collision_tile_lut: .rep cti, ROOM_H, 1, .db cti * ROOM_W + ; collision-tile call + ; but using static + ; params in wram: + ; inputs: + ; ct_pty/ct_ptx: collision tile y/x + ; ct_pox/ct_poy: position y/x +collision_tile_stat: + ld a, [ct_pty] + ld b, a ; b = pty + + ld a, [ct_ptx] + ld c, a ; c = ptx + + ld a, [ct_poy] + ld d, a ; d = poy + + ld a, [ct_poy] + ld e, a ; e = pox + ; checks a collision ptr ; with a map's meta tile ; if the tile has collision flag set ; returns 1 otherwise 0 ; inputs: - ; [hl]: collision point (y/x) + ; b/c: collision point (y/x) ; d : y pos ; e : x pos ; returns: diff --git a/src/wram.s b/src/wram.s index 86eb108..376b85f 100644 --- a/src/wram.s +++ b/src/wram.s @@ -121,3 +121,9 @@ game_over_timer: .adv 1 .de GAME_OVER, 1 game_mode: .adv 1 + + ; collision tile params +ct_pty: .adv 1 +ct_ptx: .adv 1 +ct_poy: .adv 1 +ct_pox: .adv 1 -- 2.30.2