player: stub for building buildigs
authorLukas Krickl <lukas@krickl.dev>
Thu, 10 Apr 2025 11:05:04 +0000 (13:05 +0200)
committerLukas Krickl <lukas@krickl.dev>
Thu, 10 Apr 2025 11:05:04 +0000 (13:05 +0200)
src/player.s
src/simulation.s

index aa75cb0a5a7e022405782664c23d7b02b309380c..3330c899a84583235613522ec27d318fdbda2577 100644 (file)
@@ -151,6 +151,16 @@ handle_inputs:
     ld bc, st_ui_building_selector 
     ret
 @not_select:
+
+  input_just BTNA
+  jr z, @not_a REL
+    
+    ; place tile at cursor position
+    call cursor_place_tile
+
+    ldnull bc
+    ret 
+@not_a:
 @done:
   ldnull bc
   ret
@@ -203,3 +213,10 @@ try_abort_move_at:
   ld a, [hl]
   cp a, b
   ret
+
+  ; places the current selection 
+  ; at cursor_y/x 
+  ; aborts if the tiel will not fit 
+cursor_place_tile:
+
+  ret
index fb8420333315e858747dbc912a640f88feab11a2..eb0d4702face9c541d9a3a2bce0ad416575f8cbd 100644 (file)
@@ -6,14 +6,6 @@
   ; increments cell_idx every iteration
   ; resets cell_idx to 0 when end of cells is reached
 sim_update:
-  ld a, 0 ; max loop counter 
-
-  ; load back cell ptr from last iteration
-  ld a, [cell_ptr]
-  ld e, a
-  ld a, [cell_ptr+1]
-  ld d, a
-
   ; TODO
   ; for now we just iterate all 
   ; cells in a single go
@@ -31,11 +23,5 @@ sim_update:
     ld a, state_cells_end HI
     cp a, d
     jp nz, @loop
-    
-  ; finally store cell ptr
-  ld e, a
-  ld [cell_ptr], a
-  ld d, a
-  ld [cell_ptr+1], a
 
   ret