--- /dev/null
+# Map
+
+Maps are the building blokc of the world
+
+Each map has a header containg data about what kind of map it is,
+what tiles to load, what encounter to load etc.
+
+## Tiles
+
+Each map can point to a table of tiles.
+Tiles can hold information such as tiles to render and event pointers.
+
+## Events
+
+Events can be anything that happens when a player touches the tile.
+Common events are exits, scripted encounters or cutscenes.
+
+## Exits
+
+Each map can point to a table of exits.
+This table is referenced by exit events.
+
.de map_acts, 2
; ptr to encounter table
.de map_encounters, 2
- ; ptr to exit table
+ ; ptr to exit table
.de map_exits, 2
; pointers to tile banks to be loaded
; maps to map property tile_bank0, tile_bank1, tile_bank2, tile_bank3
.de t_tile, 1
.de t_size, 0
+ ; tile event types
+.se 0
+ ; exit on touch
+ ; p0: exit table entry
+ ; p1: new y pos
+ ; p2: new x pos
+.de TE_EXIT, 1
+
+
; tile event struct
.se 0
.de te_type, 1
.de te_flags, 1
- ; pointer to map
- ; that should be loaded on
- ; event trigger
- ; if it is 0000
- ; the current map remains
-.de te_target_map, 2
-.de te_y, 1
-.de te_x, 1
+.de te_p0, 1
+.de te_p1, 1
+.de te_p2, 1
+.de te_size, 0
+
+ ; exit table entry
+.se 0
+ ; pointer to new map header
+.de map_exit_entry, 2
+