cells: Added basic setup for cell templates
authorLukas Krickl <lukas@krickl.dev>
Wed, 2 Apr 2025 07:40:30 +0000 (09:40 +0200)
committerLukas Krickl <lukas@krickl.dev>
Wed, 2 Apr 2025 07:40:30 +0000 (09:40 +0200)
This allows updating cells

src/buildings.s
src/cells.s [new file with mode: 0644]
src/defs.s
src/macros.inc
src/main.s

index bd117e16498a9fcabb2f8d588bc3253e1e466534..c601cbde603eb79e6a36a6957c1d159ff94c7e39 100644 (file)
@@ -23,3 +23,4 @@ build_farm:
 build_lumber:
   ldnull bc
   ret
+
diff --git a/src/cells.s b/src/cells.s
new file mode 100644 (file)
index 0000000..31f0c6d
--- /dev/null
@@ -0,0 +1,8 @@
+
+  ; default road update state
+cell_road_head:
+  ldnull bc
+  ret
+
+cell_template_road:
+  c_def C_ROAD, cell_road_head, 0, 0
index 8f9f21a445239eabc40306f7c3cd589543e29106..05706ffbfd287aad606eea0a95c33ba41265b693 100644 (file)
   ; a warehouse is always connected
 .de CF_CONNECTED, 1
 
+  ; cell types 
+.se 0
+.de C_ROAD, 1
+
   ; game state cell struct 
   ; this holds all the information 
   ; a cell on the map has 
index 12d26ac478dc74d92fe88f6242336cc6a9526d42..4f42bbb392c3e6f14ee3d57a1a04e995aff4b557 100644 (file)
   dw $3
 #endmacro
 
+  ; defines a new cell template
+  ; inputs:
+  ;   $1: c_type
+  ;   $2: c_st_routine
+  ;   $3: c_flags
+  ;   $4: c_head_offset
+#macro c_def
+  .db $1
+  dw $2
+  .db $3
+  .db $4
+#endmacro
+
   ; loads NULL into a 16 bit register
   ; inputs:
   ;   $1: register
index 67da84008f17d46e3dcaf07fc1331dc0380607b1..c441af6739168c92ecb0937a281b63affaf91984 100644 (file)
@@ -65,6 +65,7 @@ main:
 #include "map.s"
 #include "simulation.s"
 #include "state.s"
+#include "cells.s"
 #include "buildings.s"
 #include "tiles.inc"