From 405b7e28b9d6eaf5147c48991d24844966350dfa Mon Sep 17 00:00:00 2001 From: Lukas Krickl Date: Thu, 10 Oct 2024 13:18:18 +0200 Subject: [PATCH] Added basic layout for map collision and room flags --- src/collision.s | 20 +++++++++++++++++++- src/map.s | 12 +++++++++++- src/video.s | 6 ++++++ src/wram.s | 5 +++++ 4 files changed, 41 insertions(+), 2 deletions(-) diff --git a/src/collision.s b/src/collision.s index de0d74b..d62cd87 100644 --- a/src/collision.s +++ b/src/collision.s @@ -24,4 +24,22 @@ collision_player: col_head 1 - col_point 1, 1 + ; center left + col_point 0, 0 + ; center right + col_point 0, 10 + + ; 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) + ; d : y pos + ; e : x pos + ; returns: + ; a = 0 -> no collision + ; a = 1 -> collision + ; hl += 2 +collision_tile: + ret diff --git a/src/map.s b/src/map.s index 1d2c65f..96f169b 100644 --- a/src/map.s +++ b/src/map.s @@ -154,4 +154,14 @@ base_room: .db TDOORRR, TFLOOR1, TFLOOR1, TFLOOR1, TFLOOR1, TFLOOR1, TFLOOR1, TFLOOR1, TFLOOR1, TDOORLR .db TWALLL1, TFLOOR1, TFLOOR1, TFLOOR1, TFLOOR1, TFLOOR1, TFLOOR1, TFLOOR1, TFLOOR1, TWALLR1 .db TWALLL1, TFLOOR1, TFLOOR1, TFLOOR1, TFLOOR1, TFLOOR1, TFLOOR1, TFLOOR1, TFLOOR1, TWALLR1 -.db TCORNBOL, TWALLD1, TWALLD1, TWALLD1, TDOORDL, TDOORDR, TWALLD1, TWALLD1, TWALLD1, TCORNBOR +.db TCORNBOL, TWALLD1, TWALLD1, TWALLD1, TDOORDL, TDOORDR, TWALLD1, TWALLD1, TWALLD1, TCORNBOR + ; tile flags for the room +base_room_flags: +.db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +.db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +.db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +.db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +.db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +.db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +.db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +.db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 diff --git a/src/video.s b/src/video.s index 619840c..c8871ee 100644 --- a/src/video.s +++ b/src/video.s @@ -87,6 +87,12 @@ video_init: ld [curr_room], a ldhi a, base_room ld [curr_room+1], a + + ldlo a, base_room_flags + ld [curr_room_flags], a + ldhi a, base_room_flags + ld [curr_room_flags+1], a + call room_draw diff --git a/src/wram.s b/src/wram.s index aa2346a..d69c799 100644 --- a/src/wram.s +++ b/src/wram.s @@ -79,9 +79,14 @@ damage_anim: .adv 1 .de tiles, ROOM_W * ROOM_H .de room_size, 0 +; room flags +.se 1 +.de ROOM_F_WALL, 1 ; pointer to current room struct curr_room: .adv 2 + ; flags for current tiles +curr_room_flags: .adv 2 ; drawing related flags -- 2.30.2