Skip to content

Commit 8ff7606

Browse files
committed
rpg: migrate to MAPLOAD (drop BASIC level builders from runtime)
rpg.bas now calls `MAPLOAD "level1_overworld.json"` / `MAPLOAD "level1_cave.json"` instead of `#INCLUDE level1_*.bas` + `LoadOverworld()` / `LoadCave()`. Validates docs/map-format.md v1 end-to-end via the Zelda-lite MVP-2 game loop. The .bas builders stay in the repo as authoring reference (they remain byte-equivalent to the JSON), but they're no longer wired into the runtime — only the JSON files are loaded at play time.
1 parent f072461 commit 8ff7606

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

examples/rpg/rpg.bas

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,11 @@
1818
' ============================================================
1919

2020
#INCLUDE "../maplib.bas"
21-
#INCLUDE "level1_overworld.bas"
22-
#INCLUDE "level1_cave.bas"
21+
' Level data lives in level1_overworld.json and level1_cave.json,
22+
' loaded at runtime by MAPLOAD (docs/map-format.md v1). The legacy
23+
' BASIC builders level1_overworld.bas and level1_cave.bas are kept in
24+
' git as authoring reference but no longer #INCLUDEd — MAPLOAD fills
25+
' the same MAP_* globals from JSON.
2326

2427
SCREEN 2
2528
DOUBLEBUFFER ON
@@ -53,6 +56,8 @@ DIM MAP_OBJ_Y(15)
5356
DIM MAP_OBJ_W(15)
5457
DIM MAP_OBJ_H(15)
5558
DIM MAP_OBJ_ID(15)
59+
DIM MAP_TILESET_ID$(7)
60+
DIM MAP_TILESET_SRC$(7)
5661

5762
' Tile slot used by RenderTiles(). Swapped on level change.
5863
TILE_SLOT = 0
@@ -98,7 +103,7 @@ PREV_SPACE = 0
98103
' to the previous level.
99104
JUST_WARPED = 0
100105

101-
LoadOverworld()
106+
MAPLOAD "level1_overworld.json"
102107
SetSpawn()
103108

104109
DO
@@ -219,12 +224,12 @@ FUNCTION SwapLevel(target$)
219224
IF target$ = "cave" THEN
220225
LEVEL$ = "cave"
221226
TILE_SLOT = 3
222-
LoadCave()
227+
MAPLOAD "level1_cave.json"
223228
SetSpawn()
224229
ELSE
225230
LEVEL$ = "overworld"
226231
TILE_SLOT = 0
227-
LoadOverworld()
232+
MAPLOAD "level1_overworld.json"
228233
' Spawn next to overworld door instead of default spawn.
229234
PX = 16 * 16
230235
PY = 9 * 16

0 commit comments

Comments
 (0)