Added basic layout for map collision and room flags
authorLukas Krickl <lukas@krickl.dev>
Thu, 10 Oct 2024 11:18:18 +0000 (13:18 +0200)
committerLukas Krickl <lukas@krickl.dev>
Thu, 10 Oct 2024 11:18:18 +0000 (13:18 +0200)
src/collision.s
src/map.s
src/video.s
src/wram.s

index de0d74b51feccfcdbf8d84955514e80004c7b08d..d62cd87b527221b0df75034eceeb8e72641ca8f4 100644 (file)
 
 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
index 1d2c65fda15b4506538335fe62e2dca2e0f701ef..96f169b310c878b31cb03577957a4722c178cd88 100644 (file)
--- 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 
index 619840c684effdd8e190eba0778b0d3331b277c6..c8871ee4243b54c7763d54c6bff434f510e0e0c3 100644 (file)
@@ -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
 
   
index aa2346adf2d929b1d02df839604935a5928ac079..d69c7992bb713c52a6c1a39f9075a0c0f81bf6da 100644 (file)
@@ -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