Added collision tile lut
authorLukas Krickl <lukas@krickl.dev>
Thu, 10 Oct 2024 14:52:34 +0000 (16:52 +0200)
committerLukas Krickl <lukas@krickl.dev>
Thu, 10 Oct 2024 14:52:34 +0000 (16:52 +0200)
src/collision.s

index d62cd87b527221b0df75034eceeb8e72641ca8f4..bb544289d2c41d881a797d4af42e5ef36b0b271a 100644 (file)
@@ -29,6 +29,9 @@ collision_player:
   ; center right
   col_point 0, 10 
 
+collision_tile_lut:
+  .rep cti, ROOM_H, 1, .db cti * ROOM_W 
+
   ; checks a collision ptr 
   ; with a map's meta tile
   ; if the tile has collision flag set 
@@ -42,4 +45,20 @@ collision_player:
   ;   a = 1 -> collision
   ;   hl += 2
 collision_tile:
+  ; y pos / 16 -> tile pos
+  sra d ; / 2
+  sra d ; / 4
+  sra d ; / 8
+  sra d ; / 16
+
+  ; x pos / 16 -> tile pos 
+  sra e ; / 2
+  sra e ; / 4
+  sra e ; / 8
+  sra e ; / 16
+
+  ; -> now convert position to 
+  ; map flag index using a simple lut
+  ; for y position + x
+
   ret