; ptr to actor table for this map
.de map_acts, 2
; ptr to exit table
+ ; in the following order: up, down, left, right
.de map_exits, 2
; pointers to tile banks to be loaded
; maps to map property tile_bank0, tile_bank1, tile_bank2, tile_bank3
; where each tile has values and its current state. The map can be drawn from this.
l1:
- mapdef MAP_F_DO_FULL_REDRAW, map_r_nop, 0, 0, bank8000, bank8800, bank8C00, bank9000, tile_id_table
+ mapdef MAP_F_DO_FULL_REDRAW, map_r_nop, 0, l1_exits, bank8000, bank8800, bank8C00, bank9000, tile_id_table
#include "spawn.inc"
+
+l1_exits:
+ dw l1
+ dw l1
+ dw l1
+ dw l1
push de
call map_tiles_load
pop de
+
+ ; exit table
+ ld hl, map_exits
+ add hl, de
+ ld a, [hl+]
+ ld h, [hl]
+ ld l, a
+
+ ; load exits in the following order:
+ ; up, down, left, right
+ ld bc, map_exit_up
+
+ ; up
+ ld a, [hl+]
+ ld [bc], a
+ inc bc
+ ld a, [hl+]
+ ld [bc], a
+ inc bc
+
+ ; down
+ ld a, [hl+]
+ ld [bc], a
+ inc bc
+ ld a, [hl+]
+ ld [bc], a
+ inc bc
+
+ ; left
+ ld a, [hl+]
+ ld [bc], a
+ inc bc
+ ld a, [hl+]
+ ld [bc], a
+ inc bc
+
+ ; right
+ ld a, [hl+]
+ ld [bc], a
+ inc bc
+ ld a, [hl]
+ ld [bc], a
+
+
; TODO:
; load actors
- ; encounter table
- ; exit table
ret
; loads a tileset
and a, MAP_F_DO_FULL_REDRAW
ret z
- BREAK
- ret
+ pop hl ; remove previous caller from call stack
+ jp map_load
; map transition routines
; gets the down exit and sets transition state
ld a, [hl+]
ld d, [hl]
ld e, a ; de = new map
+
+ ; this call does not return
+ ; if a full load is needed
call map_try_full_reload
ld hl, update_map_load_down