From 1bd3105df9023802edbf1665ae80daa7e7141c4b Mon Sep 17 00:00:00 2001 From: Lukas Krickl Date: Sun, 16 Mar 2025 21:13:33 +0100 Subject: [PATCH] defs: Added struct def for cells --- TODO.md | 1 + src/defs.s | 22 +++++++++++++++++----- src/wram.s | 36 ++++++++++++++++++------------------ 3 files changed, 36 insertions(+), 23 deletions(-) diff --git a/TODO.md b/TODO.md index 5b0e7a1..1aa51c4 100644 --- a/TODO.md +++ b/TODO.md @@ -21,6 +21,7 @@ [ ] industry demand (0-3) [ ] total population (24 bit) [ ] money (24 bit) +[ ] debt (24 bit) ### per tile diff --git a/src/defs.s b/src/defs.s index 20afdc3..472bc9c 100644 --- a/src/defs.s +++ b/src/defs.s @@ -12,6 +12,7 @@ #define TILE_SIZE 8 #define MAP_W 32 #define MAP_H 28 +#define MAP_SIZE (MAP_W * MAP_H) ; seed for the rng ; 8 bit signed int @@ -19,11 +20,6 @@ #define SRAND_INITIAL 0x19 - ; engine flags -.se 1 - ; if set to 1, call room_goto_player_pos in next blank -.de EG_FLOAD_ROOM, 1 - ; game modes ; this is a direct index ; into a pointer array @@ -32,3 +28,19 @@ .de GM_GAME, 1 .de GM_PAUSE, 1 + ; game state cell struct + ; this holds all the information + ; a cell on the map has +.se 0 +.de c_type, 1 +.de c_tile, 1 +.de c_flags, 2 + + ; power that this tile can pass on + ; to adjacent tiles +.de c_power, 1 +.de c_crime, 1 +.de c_fire, 1 +.de c_occupation, 1 +.de c_other, 2 +.de c_size, 0 diff --git a/src/wram.s b/src/wram.s index 57dfc44..4fa2a5e 100644 --- a/src/wram.s +++ b/src/wram.s @@ -12,24 +12,6 @@ curr_inputs: .adv 1 prev_inputs: .adv 1 -ui_flags: .adv 1 -draw_flags: .adv 1 - -cursor_x: .adv 1 -cursor_y: .adv 1 - -engine_flags: .adv 1 - - ; tmp can be used by routines as - ; they see fit -tmp: .adv 16 - ; itmp is the same as tmp but - ; for use during an interrupt -itmp: .adv 16 - - ; timer for game over. when - ; it reaches 0 re-start game -game_over_timer: .adv 1 game_mode: .adv 1 @@ -37,4 +19,22 @@ game_mode: .adv 1 ; seed must never be 0 srand: .adv 2 + ; game state + ; this region holds the entire game state + ; everything thats needed for a savme game should be + ; contained here +state: + +cursor_x: .adv 1 +cursor_y: .adv 1 + +money: .adv 3 +debt: .adv 3 +demand_house: .adv 1 +demand_shop: .adv 1 +demand_factory: .adv 1 +population: .adv 3 + +state_map: .adv c_size * MAP_SIZE +state_end: -- 2.30.2