Added better docs for savegame storage
authorLukas Krickl <lukas@krickl.dev>
Fri, 27 Dec 2024 09:16:47 +0000 (10:16 +0100)
committerLukas Krickl <lukas@krickl.dev>
Fri, 27 Dec 2024 09:16:47 +0000 (10:16 +0100)
src/sram.s
src/wram.s

index dd3786d0287c6678ed7f6b96658b01207aa12533..b0edd899a625cfbe292904a27c19125121916796 100644 (file)
@@ -12,10 +12,15 @@ sram_magic: .adv 1
 
   ; checksum of save game
   ; this is simply all bytes in the save game added 
-save_game_chksm: .adv 1
+save_game1_chksm: .adv 1
 
-save_game: .adv SAVE_GAME_SIZE
+  ; saving rng seed
+save_game1_seed: .adv 1
+  ; saving all rooms
+save_game1_rooms: .adv ROOM_SIZE_TOTAL * ROOMS_TOTAL
+  ; saving player state
+save_game1_player: .adv player_size
 
   ; this is a canary value to detect out of bounds reads in sram
   ; if this value is not SRAM_MAGIC then the save game is corrupted
-save_game_overflow_canary: .adv 1
+save_game1_overflow_canary: .adv 1
index 870a4cf6e3e9b6c368f7763a4510b86982db6c20..3db3cd8550caaf433b670768ed4b2c87a5a616e5 100644 (file)
@@ -137,10 +137,10 @@ curr_room_init_act: .adv 2
 curr_room_exits: .adv 2
 
   ; total size of a room including the struct header 
-  ; tiles, flags, actors and exits 
-#define ROOM_SIZE_TOTAL ROOM_TILES_SIZE + ROOM_FLAGS_SIZE + ACTOR_TABLE_SIZE + ROOM_EXIT_TABLE_SIZE 
-
-#define SAVE_GAME_SIZE ROOM_SIZE_TOTAL * ROOMS_TOTAL + player_size
+  ; tiles, flags, actors and exits
+  ; rooms are always in the order specified here:
+  ; room_struct, tiles, flags, actor_table, exit_table
+#define ROOM_SIZE_TOTAL room_size + ROOM_TILES_SIZE + ROOM_FLAGS_SIZE + ACTOR_TABLE_SIZE + ROOM_EXIT_TABLE_SIZE 
 
   ; drawing related flags