shithub: pokecrystal

Download patch

ref: b5a7e7de3e6b75e95967edd28b9c2af5959cd136
parent: 212846af57d1878bb2c6964fbeababd9de03a195
author: Rangi <remy.oukaour+rangi42@gmail.com>
date: Wed Jul 22 11:22:58 EDT 2020

Factor out tables into data/overworld/

Fixes #749

diff: cannot open b/data/overworld//null: file does not exist: 'b/data/overworld//null'
--- a/constants/collision_constants.asm
+++ b/constants/collision_constants.asm
@@ -1,4 +1,4 @@
-; collision permissions (see data/collision_permissions.asm)
+; collision permissions (see data/overworld/collision_permissions.asm)
 LAND_TILE  EQU $00
 WATER_TILE EQU $01
 WALL_TILE  EQU $0f
@@ -5,7 +5,7 @@
 TALK       EQU $10
 
 ; collision data types (see data/tilesets/*_collision.asm)
-; TileCollisionTable indexes (see data/collision_permissions.asm)
+; TileCollisionTable indexes (see data/overworld/collision_permissions.asm)
 COLL_FLOOR             EQU $00
 COLL_01                EQU $01 ; garbage
 COLL_03                EQU $03 ; garbage
--- a/constants/engine_flags.asm
+++ b/constants/engine_flags.asm
@@ -1,4 +1,4 @@
-; EngineFlags indexes (see data/engine_flags.asm)
+; EngineFlags indexes (see data/events/engine_flags.asm)
 	const_def
 ; wPokegearFlags
 	const ENGINE_RADIO_CARD
--- a/constants/script_constants.asm
+++ b/constants/script_constants.asm
@@ -41,7 +41,7 @@
 	const TRAINERTEXT_LOSS
 
 ; readvar/writevar/loadvar arguments
-; _GetVarAction.VarActionTable indexes (see engine/overworld/variables.asm)
+; VarActionTable indexes (see data/overworld/variables.asm)
 	const_def
 	const VAR_STRINGBUFFER2    ; 00
 	const VAR_PARTYCOUNT       ; 01
--- a/constants/tileset_constants.asm
+++ b/constants/tileset_constants.asm
@@ -1,4 +1,4 @@
-; Tilesets indexes (see data/tilesets.asm)
+; Tilesets indexes (see data/overworld/tilesets.asm)
 	const_def 1
 	const TILESET_JOHTO                ; 01
 	const TILESET_JOHTO_MODERN         ; 02
--- a/data/collision_permissions.asm
+++ /dev/null
@@ -1,258 +1,0 @@
-TileCollisionTable::
-; entries correspond to COLL_* constants
-	db LAND_TILE         ; COLL_FLOOR
-	db LAND_TILE         ; COLL_01
-	db LAND_TILE         ; 02
-	db LAND_TILE         ; COLL_03
-	db LAND_TILE         ; COLL_04
-	db LAND_TILE         ; 05
-	db LAND_TILE         ; 06
-	db WALL_TILE         ; COLL_WALL
-	db LAND_TILE         ; COLL_CUT_08
-	db LAND_TILE         ; 09
-	db LAND_TILE         ; 0a
-	db LAND_TILE         ; 0b
-	db LAND_TILE         ; 0c
-	db LAND_TILE         ; 0d
-	db LAND_TILE         ; 0e
-	db WALL_TILE         ; 0f
-	db LAND_TILE         ; COLL_TALL_GRASS_10
-	db LAND_TILE         ; 11
-	db WALL_TILE | TALK  ; COLL_CUT_TREE
-	db LAND_TILE         ; 13
-	db LAND_TILE         ; COLL_LONG_GRASS
-	db WALL_TILE | TALK  ; COLL_HEADBUTT_TREE
-	db LAND_TILE         ; 16
-	db LAND_TILE         ; 17
-	db LAND_TILE         ; COLL_TALL_GRASS
-	db LAND_TILE         ; 19
-	db WALL_TILE | TALK  ; COLL_CUT_TREE_1A
-	db LAND_TILE         ; 1b
-	db LAND_TILE         ; COLL_LONG_GRASS_1C
-	db WALL_TILE | TALK  ; COLL_HEADBUTT_TREE_1D
-	db LAND_TILE         ; 1e
-	db LAND_TILE         ; 1f
-	db WATER_TILE        ; 20
-	db WATER_TILE        ; COLL_WATER_21
-	db WATER_TILE | TALK ; 22
-	db LAND_TILE         ; COLL_ICE
-	db WATER_TILE | TALK ; COLL_WHIRLPOOL
-	db WATER_TILE        ; 25
-	db WATER_TILE        ; 26
-	db WALL_TILE         ; COLL_BUOY
-	db WATER_TILE        ; COLL_CUT_28
-	db WATER_TILE        ; COLL_WATER
-	db WATER_TILE | TALK ; 2a
-	db LAND_TILE         ; COLL_ICE_2B
-	db WATER_TILE | TALK ; COLL_WHIRLPOOL_2C
-	db WATER_TILE        ; 2d
-	db WATER_TILE        ; 2e
-	db WALL_TILE         ; 2f
-	db WATER_TILE        ; COLL_WATERFALL_RIGHT
-	db WATER_TILE        ; COLL_WATERFALL_LEFT
-	db WATER_TILE        ; COLL_WATERFALL_UP
-	db WATER_TILE        ; COLL_WATERFALL
-	db WATER_TILE        ; 34
-	db WATER_TILE        ; 35
-	db WATER_TILE        ; 36
-	db WATER_TILE        ; 37
-	db WATER_TILE        ; COLL_CURRENT_RIGHT
-	db WATER_TILE        ; COLL_CURRENT_LEFT
-	db WATER_TILE        ; COLL_CURRENT_UP
-	db WATER_TILE        ; COLL_CURRENT_DOWN
-	db WATER_TILE        ; 3c
-	db WATER_TILE        ; 3d
-	db WATER_TILE        ; 3e
-	db WATER_TILE        ; 3f
-	db LAND_TILE         ; COLL_BRAKE
-	db LAND_TILE         ; COLL_WALK_RIGHT
-	db LAND_TILE         ; COLL_WALK_LEFT
-	db LAND_TILE         ; COLL_WALK_UP
-	db LAND_TILE         ; COLL_WALK_DOWN
-	db LAND_TILE         ; COLL_BRAKE_45
-	db LAND_TILE         ; COLL_BRAKE_46
-	db LAND_TILE         ; COLL_BRAKE_47
-	db LAND_TILE         ; COLL_GRASS_48
-	db LAND_TILE         ; COLL_GRASS_49
-	db LAND_TILE         ; COLL_GRASS_4A
-	db LAND_TILE         ; COLL_GRASS_4B
-	db LAND_TILE         ; COLL_GRASS_4C
-	db LAND_TILE         ; 4d
-	db LAND_TILE         ; 4e
-	db LAND_TILE         ; 4f
-	db LAND_TILE         ; COLL_WALK_RIGHT_ALT
-	db LAND_TILE         ; COLL_WALK_LEFT_ALT
-	db LAND_TILE         ; COLL_WALK_UP_ALT
-	db LAND_TILE         ; COLL_WALK_DOWN_ALT
-	db LAND_TILE         ; COLL_BRAKE_ALT
-	db LAND_TILE         ; COLL_BRAKE_55
-	db LAND_TILE         ; COLL_BRAKE_56
-	db LAND_TILE         ; COLL_BRAKE_57
-	db LAND_TILE         ; 58
-	db LAND_TILE         ; 59
-	db LAND_TILE         ; 5a
-	db LAND_TILE         ; COLL_5B
-	db LAND_TILE         ; 5c
-	db LAND_TILE         ; 5d
-	db LAND_TILE         ; 5e
-	db LAND_TILE         ; 5f
-	db LAND_TILE         ; COLL_PIT
-	db LAND_TILE         ; COLL_VIRTUAL_BOY
-	db WALL_TILE         ; 62
-	db LAND_TILE         ; 63
-	db LAND_TILE         ; COLL_64
-	db LAND_TILE         ; COLL_65
-	db LAND_TILE         ; 66
-	db LAND_TILE         ; 67
-	db LAND_TILE         ; COLL_PIT_68
-	db LAND_TILE         ; 69
-	db WALL_TILE         ; 6a
-	db LAND_TILE         ; 6b
-	db LAND_TILE         ; 6c
-	db LAND_TILE         ; 6d
-	db LAND_TILE         ; 6e
-	db LAND_TILE         ; 6f
-	db LAND_TILE         ; COLL_WARP_CARPET_DOWN
-	db LAND_TILE         ; COLL_DOOR
-	db LAND_TILE         ; COLL_LADDER
-	db LAND_TILE         ; COLL_STAIRCASE_73
-	db LAND_TILE         ; COLL_CAVE_74
-	db LAND_TILE         ; COLL_DOOR_75
-	db LAND_TILE         ; COLL_WARP_CARPET_LEFT
-	db LAND_TILE         ; COLL_WARP_77
-	db LAND_TILE         ; COLL_WARP_CARPET_UP
-	db LAND_TILE         ; COLL_DOOR_79
-	db LAND_TILE         ; COLL_STAIRCASE
-	db LAND_TILE         ; COLL_CAVE
-	db LAND_TILE         ; COLL_WARP_PANEL
-	db LAND_TILE         ; COLL_DOOR_7D
-	db LAND_TILE         ; COLL_WARP_CARPET_RIGHT
-	db LAND_TILE         ; COLL_WARP_7F
-	db WALL_TILE         ; 80
-	db WALL_TILE         ; 81
-	db WALL_TILE         ; 82
-	db WALL_TILE         ; 83
-	db WALL_TILE         ; 84
-	db LAND_TILE         ; 85
-	db LAND_TILE         ; 86
-	db LAND_TILE         ; 87
-	db WALL_TILE         ; 88
-	db WALL_TILE         ; 89
-	db WALL_TILE         ; 8a
-	db WALL_TILE         ; 8b
-	db WALL_TILE         ; 8c
-	db LAND_TILE         ; 8d
-	db LAND_TILE         ; 8e
-	db LAND_TILE         ; 8f
-	db WALL_TILE         ; COLL_COUNTER
-	db WALL_TILE         ; COLL_BOOKSHELF
-	db WALL_TILE         ; 92
-	db WALL_TILE         ; COLL_PC
-	db WALL_TILE         ; COLL_RADIO
-	db WALL_TILE         ; COLL_TOWN_MAP
-	db WALL_TILE         ; COLL_MART_SHELF
-	db WALL_TILE         ; COLL_TV
-	db WALL_TILE         ; COLL_COUNTER_98
-	db WALL_TILE         ; 99
-	db WALL_TILE         ; 9a
-	db WALL_TILE         ; 9b
-	db WALL_TILE         ; COLL_9C
-	db WALL_TILE         ; COLL_WINDOW
-	db WALL_TILE         ; 9e
-	db WALL_TILE         ; COLL_INCENSE_BURNER
-	db LAND_TILE         ; COLL_HOP_RIGHT
-	db LAND_TILE         ; COLL_HOP_LEFT
-	db LAND_TILE         ; COLL_HOP_UP
-	db LAND_TILE         ; COLL_HOP_DOWN
-	db LAND_TILE         ; COLL_HOP_DOWN_RIGHT
-	db LAND_TILE         ; COLL_HOP_DOWN_LEFT
-	db LAND_TILE         ; COLL_HOP_UP_RIGHT
-	db LAND_TILE         ; COLL_HOP_UP_LEFT
-	db LAND_TILE         ; a8
-	db LAND_TILE         ; a9
-	db LAND_TILE         ; aa
-	db LAND_TILE         ; ab
-	db LAND_TILE         ; ac
-	db LAND_TILE         ; ad
-	db LAND_TILE         ; ae
-	db LAND_TILE         ; af
-	db LAND_TILE         ; COLL_RIGHT_WALL
-	db LAND_TILE         ; COLL_LEFT_WALL
-	db LAND_TILE         ; COLL_UP_WALL
-	db LAND_TILE         ; COLL_DOWN_WALL
-	db LAND_TILE         ; COLL_DOWN_RIGHT_WALL
-	db LAND_TILE         ; COLL_DOWN_LEFT_WALL
-	db LAND_TILE         ; COLL_UP_RIGHT_WALL
-	db LAND_TILE         ; COLL_UP_LEFT_WALL
-	db LAND_TILE         ; b8
-	db LAND_TILE         ; b9
-	db LAND_TILE         ; ba
-	db LAND_TILE         ; bb
-	db LAND_TILE         ; bc
-	db LAND_TILE         ; bd
-	db LAND_TILE         ; be
-	db LAND_TILE         ; bf
-	db WATER_TILE        ; COLL_RIGHT_BUOY
-	db WATER_TILE        ; COLL_LEFT_BUOY
-	db WATER_TILE        ; COLL_UP_BUOY
-	db WATER_TILE        ; COLL_DOWN_BUOY
-	db WATER_TILE        ; COLL_DOWN_RIGHT_BUOY
-	db WATER_TILE        ; COLL_DOWN_LEFT_BUOY
-	db WATER_TILE        ; COLL_UP_RIGHT_BUOY
-	db WATER_TILE        ; COLL_UP_LEFT_BUOY
-	db WATER_TILE        ; c8
-	db WATER_TILE        ; c9
-	db WATER_TILE        ; ca
-	db WATER_TILE        ; cb
-	db WATER_TILE        ; cc
-	db WATER_TILE        ; cd
-	db WATER_TILE        ; ce
-	db WATER_TILE        ; cf
-	db LAND_TILE         ; d0
-	db LAND_TILE         ; d1
-	db LAND_TILE         ; d2
-	db LAND_TILE         ; d3
-	db LAND_TILE         ; d4
-	db LAND_TILE         ; d5
-	db LAND_TILE         ; d6
-	db LAND_TILE         ; d7
-	db LAND_TILE         ; d8
-	db LAND_TILE         ; d9
-	db LAND_TILE         ; da
-	db LAND_TILE         ; db
-	db LAND_TILE         ; dc
-	db LAND_TILE         ; dd
-	db LAND_TILE         ; de
-	db LAND_TILE         ; df
-	db LAND_TILE         ; e0
-	db LAND_TILE         ; e1
-	db LAND_TILE         ; e2
-	db LAND_TILE         ; e3
-	db LAND_TILE         ; e4
-	db LAND_TILE         ; e5
-	db LAND_TILE         ; e6
-	db LAND_TILE         ; e7
-	db LAND_TILE         ; e8
-	db LAND_TILE         ; e9
-	db LAND_TILE         ; ea
-	db LAND_TILE         ; eb
-	db LAND_TILE         ; ec
-	db LAND_TILE         ; ed
-	db LAND_TILE         ; ee
-	db LAND_TILE         ; ef
-	db LAND_TILE         ; f0
-	db LAND_TILE         ; f1
-	db LAND_TILE         ; f2
-	db LAND_TILE         ; f3
-	db LAND_TILE         ; f4
-	db LAND_TILE         ; f5
-	db LAND_TILE         ; f6
-	db LAND_TILE         ; f7
-	db LAND_TILE         ; f8
-	db LAND_TILE         ; f9
-	db LAND_TILE         ; fa
-	db LAND_TILE         ; fb
-	db LAND_TILE         ; fc
-	db LAND_TILE         ; fd
-	db LAND_TILE         ; fe
-	db WALL_TILE         ; COLL_FF
--- a/data/engine_flags.asm
+++ /dev/null
@@ -1,199 +1,0 @@
-engine_flag: MACRO
-; location, bit
-; (all locations are in WRAM bank 1)
-	dwb \1 + (\2 / 8), 1 << (\2 % 8)
-ENDM
-
-EngineFlags:
-; entries correspond to ENGINE_* constants
-
-	; pokegear
-	engine_flag wPokegearFlags, POKEGEAR_RADIO_CARD_F
-	engine_flag wPokegearFlags, POKEGEAR_MAP_CARD_F
-	engine_flag wPokegearFlags, POKEGEAR_PHONE_CARD_F
-	engine_flag wPokegearFlags, POKEGEAR_EXPN_CARD_F
-	engine_flag wPokegearFlags, POKEGEAR_OBTAINED_F
-
-	; day-care
-	engine_flag wDayCareMan, DAYCAREMAN_HAS_EGG_F
-	engine_flag wDayCareMan, DAYCAREMAN_HAS_MON_F
-	engine_flag wDayCareLady, DAYCARELADY_HAS_MON_F
-
-	engine_flag wMomSavingMoney, MOM_SAVING_SOME_MONEY_F
-	engine_flag wMomSavingMoney, MOM_ACTIVE_F
-
-	engine_flag wUnusedTwoDayTimerOn, 0 ; unused, possibly related to a 2-day timer
-
-	engine_flag wStatusFlags, STATUSFLAGS_POKEDEX_F
-	engine_flag wStatusFlags, STATUSFLAGS_UNOWN_DEX_F
-	engine_flag wStatusFlags, STATUSFLAGS_CAUGHT_POKERUS_F
-	engine_flag wStatusFlags, STATUSFLAGS_ROCKET_SIGNAL_F
-	engine_flag wStatusFlags, STATUSFLAGS_HALL_OF_FAME_F
-	engine_flag wStatusFlags, STATUSFLAGS_MAIN_MENU_MOBILE_CHOICES_F
-
-	engine_flag wStatusFlags2, STATUSFLAGS2_BUG_CONTEST_TIMER_F
-	engine_flag wStatusFlags2, STATUSFLAGS2_SAFARI_GAME_F
-	engine_flag wStatusFlags2, STATUSFLAGS2_ROCKETS_IN_RADIO_TOWER_F
-	engine_flag wStatusFlags2, STATUSFLAGS2_BIKE_SHOP_CALL_F
-	engine_flag wStatusFlags2, STATUSFLAGS2_UNUSED_5_F
-	engine_flag wStatusFlags2, STATUSFLAGS2_REACHED_GOLDENROD_F
-	engine_flag wStatusFlags2, STATUSFLAGS2_ROCKETS_IN_MAHOGANY_F
-
-	engine_flag wBikeFlags, BIKEFLAGS_STRENGTH_ACTIVE_F
-	engine_flag wBikeFlags, BIKEFLAGS_ALWAYS_ON_BIKE_F
-	engine_flag wBikeFlags, BIKEFLAGS_DOWNHILL_F
-
-	engine_flag wJohtoBadges, ZEPHYRBADGE
-	engine_flag wJohtoBadges, HIVEBADGE
-	engine_flag wJohtoBadges, PLAINBADGE
-	engine_flag wJohtoBadges, FOGBADGE
-	engine_flag wJohtoBadges, MINERALBADGE
-	engine_flag wJohtoBadges, STORMBADGE
-	engine_flag wJohtoBadges, GLACIERBADGE
-	engine_flag wJohtoBadges, RISINGBADGE
-
-	engine_flag wKantoBadges, BOULDERBADGE
-	engine_flag wKantoBadges, CASCADEBADGE
-	engine_flag wKantoBadges, THUNDERBADGE
-	engine_flag wKantoBadges, RAINBOWBADGE
-	engine_flag wKantoBadges, SOULBADGE
-	engine_flag wKantoBadges, MARSHBADGE
-	engine_flag wKantoBadges, VOLCANOBADGE
-	engine_flag wKantoBadges, EARTHBADGE
-
-	; unown sets (see data/wild/unlocked_unowns.asm)
-	engine_flag wUnlockedUnowns, 0 ; A-K
-	engine_flag wUnlockedUnowns, 1 ; L-R
-	engine_flag wUnlockedUnowns, 2 ; S-W
-	engine_flag wUnlockedUnowns, 3 ; X-Z
-	engine_flag wUnlockedUnowns, 4 ; unused
-	engine_flag wUnlockedUnowns, 5 ; unused
-	engine_flag wUnlockedUnowns, 6 ; unused
-	engine_flag wUnlockedUnowns, 7 ; unused
-
-	; fly
-	engine_flag wVisitedSpawns, SPAWN_HOME
-	engine_flag wVisitedSpawns, SPAWN_DEBUG
-	engine_flag wVisitedSpawns, SPAWN_PALLET
-	engine_flag wVisitedSpawns, SPAWN_VIRIDIAN
-	engine_flag wVisitedSpawns, SPAWN_PEWTER
-	engine_flag wVisitedSpawns, SPAWN_CERULEAN
-	engine_flag wVisitedSpawns, SPAWN_ROCK_TUNNEL
-	engine_flag wVisitedSpawns, SPAWN_VERMILION
-	engine_flag wVisitedSpawns, SPAWN_LAVENDER
-	engine_flag wVisitedSpawns, SPAWN_SAFFRON
-	engine_flag wVisitedSpawns, SPAWN_CELADON
-	engine_flag wVisitedSpawns, SPAWN_FUCHSIA
-	engine_flag wVisitedSpawns, SPAWN_CINNABAR
-	engine_flag wVisitedSpawns, SPAWN_INDIGO
-	engine_flag wVisitedSpawns, SPAWN_NEW_BARK
-	engine_flag wVisitedSpawns, SPAWN_CHERRYGROVE
-	engine_flag wVisitedSpawns, SPAWN_VIOLET
-	engine_flag wVisitedSpawns, SPAWN_AZALEA
-	engine_flag wVisitedSpawns, SPAWN_CIANWOOD
-	engine_flag wVisitedSpawns, SPAWN_GOLDENROD
-	engine_flag wVisitedSpawns, SPAWN_OLIVINE
-	engine_flag wVisitedSpawns, SPAWN_ECRUTEAK
-	engine_flag wVisitedSpawns, SPAWN_MAHOGANY
-	engine_flag wVisitedSpawns, SPAWN_LAKE_OF_RAGE
-	engine_flag wVisitedSpawns, SPAWN_BLACKTHORN
-	engine_flag wVisitedSpawns, SPAWN_MT_SILVER
-	engine_flag wVisitedSpawns, NUM_SPAWNS ; unused
-
-	engine_flag wLuckyNumberShowFlag, LUCKYNUMBERSHOW_GAME_OVER_F
-
-	engine_flag wStatusFlags2, STATUSFLAGS2_UNUSED_3_F
-
-	engine_flag wDailyFlags1, DAILYFLAGS1_KURT_MAKING_BALLS_F
-	engine_flag wDailyFlags1, DAILYFLAGS1_BUG_CONTEST_F
-	engine_flag wDailyFlags1, DAILYFLAGS1_FISH_SWARM_F
-	engine_flag wDailyFlags1, DAILYFLAGS1_TIME_CAPSULE_F
-	engine_flag wDailyFlags1, DAILYFLAGS1_ALL_FRUIT_TREES_F
-	engine_flag wDailyFlags1, DAILYFLAGS1_GOT_SHUCKIE_TODAY_F
-	engine_flag wDailyFlags1, DAILYFLAGS1_GOLDENROD_UNDERGROUND_BARGAIN_F
-	engine_flag wDailyFlags1, DAILYFLAGS1_TRAINER_HOUSE_F
-
-	engine_flag wDailyFlags2, DAILYFLAGS2_MT_MOON_SQUARE_CLEFAIRY_F
-	engine_flag wDailyFlags2, DAILYFLAGS2_UNION_CAVE_LAPRAS_F
-	engine_flag wDailyFlags2, DAILYFLAGS2_GOLDENROD_UNDERGROUND_GOT_HAIRCUT_F
-	engine_flag wDailyFlags2, DAILYFLAGS2_GOLDENROD_DEPT_STORE_TM27_RETURN_F
-	engine_flag wDailyFlags2, DAILYFLAGS2_DAISYS_GROOMING_F
-	engine_flag wDailyFlags2, DAILYFLAGS2_INDIGO_PLATEAU_RIVAL_FIGHT_F
-	engine_flag wDailyFlags2, DAILYFLAGS2_MOVE_TUTOR_F
-	engine_flag wDailyFlags2, DAILYFLAGS2_BUENAS_PASSWORD_F
-
-	engine_flag wSwarmFlags, SWARMFLAGS_BUENAS_PASSWORD_F
-	engine_flag wSwarmFlags, SWARMFLAGS_GOLDENROD_DEPT_STORE_SALE_F
-
-	engine_flag wGameTimerPause, GAMETIMERPAUSE_MOBILE_7_F
-
-	engine_flag wPlayerGender, PLAYERGENDER_FEMALE_F
-
-	engine_flag wCelebiEvent, CELEBIEVENT_FOREST_IS_RESTLESS_F
-
-	; rematches
-	engine_flag wDailyRematchFlags,  0 ; jack
-	engine_flag wDailyRematchFlags,  1 ; huey
-	engine_flag wDailyRematchFlags,  2 ; gaven
-	engine_flag wDailyRematchFlags,  3 ; beth
-	engine_flag wDailyRematchFlags,  4 ; jose
-	engine_flag wDailyRematchFlags,  5 ; reena
-	engine_flag wDailyRematchFlags,  6 ; joey
-	engine_flag wDailyRematchFlags,  7 ; wade
-	engine_flag wDailyRematchFlags,  8 ; ralph
-	engine_flag wDailyRematchFlags,  9 ; liz
-	engine_flag wDailyRematchFlags, 10 ; anthony
-	engine_flag wDailyRematchFlags, 11 ; todd
-	engine_flag wDailyRematchFlags, 12 ; gina
-	engine_flag wDailyRematchFlags, 13 ; arnie
-	engine_flag wDailyRematchFlags, 14 ; alan
-	engine_flag wDailyRematchFlags, 15 ; dana
-	engine_flag wDailyRematchFlags, 16 ; chad
-	engine_flag wDailyRematchFlags, 17 ; tully
-	engine_flag wDailyRematchFlags, 18 ; brent
-	engine_flag wDailyRematchFlags, 19 ; tiffany
-	engine_flag wDailyRematchFlags, 20 ; vance
-	engine_flag wDailyRematchFlags, 21 ; wilton
-	engine_flag wDailyRematchFlags, 22 ; parry
-	engine_flag wDailyRematchFlags, 23 ; erin
-
-	engine_flag wDailyPhoneItemFlags, 0 ; beverly has nugget
-	engine_flag wDailyPhoneItemFlags, 1 ; jose has star piece
-	engine_flag wDailyPhoneItemFlags, 2 ; wade has item (see EVENT_WADE_HAS_*** in constants/event_flags.asm)
-	engine_flag wDailyPhoneItemFlags, 3 ; gina has leaf stone
-	engine_flag wDailyPhoneItemFlags, 4 ; alan has fire stone
-	engine_flag wDailyPhoneItemFlags, 5 ; liz has thunderstone
-	engine_flag wDailyPhoneItemFlags, 6 ; derek has nugget
-	engine_flag wDailyPhoneItemFlags, 7 ; tully has water stone
-	engine_flag wDailyPhoneItemFlags, 8 ; tiffany has pink bow
-	engine_flag wDailyPhoneItemFlags, 9 ; wilton has item (see EVENT_WILTON_HAS_*** in constants/event_flags.asm)
-
-	engine_flag wDailyPhoneTimeOfDayFlags,  0 ; jack
-	engine_flag wDailyPhoneTimeOfDayFlags,  1 ; huey
-	engine_flag wDailyPhoneTimeOfDayFlags,  2 ; gaven
-	engine_flag wDailyPhoneTimeOfDayFlags,  3 ; beth
-	engine_flag wDailyPhoneTimeOfDayFlags,  4 ; jose
-	engine_flag wDailyPhoneTimeOfDayFlags,  5 ; reena
-	engine_flag wDailyPhoneTimeOfDayFlags,  6 ; joey
-	engine_flag wDailyPhoneTimeOfDayFlags,  7 ; wade
-	engine_flag wDailyPhoneTimeOfDayFlags,  8 ; ralph
-	engine_flag wDailyPhoneTimeOfDayFlags,  9 ; liz
-	engine_flag wDailyPhoneTimeOfDayFlags, 10 ; anthony
-	engine_flag wDailyPhoneTimeOfDayFlags, 11 ; todd
-	engine_flag wDailyPhoneTimeOfDayFlags, 12 ; gina
-	engine_flag wDailyPhoneTimeOfDayFlags, 13 ; arnie
-	engine_flag wDailyPhoneTimeOfDayFlags, 14 ; alan
-	engine_flag wDailyPhoneTimeOfDayFlags, 15 ; dana
-	engine_flag wDailyPhoneTimeOfDayFlags, 16 ; chad
-	engine_flag wDailyPhoneTimeOfDayFlags, 17 ; tully
-	engine_flag wDailyPhoneTimeOfDayFlags, 18 ; brent
-	engine_flag wDailyPhoneTimeOfDayFlags, 19 ; tiffany
-	engine_flag wDailyPhoneTimeOfDayFlags, 20 ; vance
-	engine_flag wDailyPhoneTimeOfDayFlags, 21 ; wilton
-	engine_flag wDailyPhoneTimeOfDayFlags, 22 ; parry
-	engine_flag wDailyPhoneTimeOfDayFlags, 23 ; erin
-
-	engine_flag wPlayerSpriteSetupFlags, PLAYERSPRITESETUP_FEMALE_TO_MALE_F
-
-	engine_flag wSwarmFlags, SWARMFLAGS_DUNSPARCE_SWARM_F
-	engine_flag wSwarmFlags, SWARMFLAGS_YANMA_SWARM_F
--- /dev/null
+++ b/data/events/engine_flags.asm
@@ -1,0 +1,199 @@
+engine_flag: MACRO
+; location, bit
+; (all locations are in WRAM bank 1)
+	dwb \1 + (\2 / 8), 1 << (\2 % 8)
+ENDM
+
+EngineFlags:
+; entries correspond to ENGINE_* constants
+
+	; pokegear
+	engine_flag wPokegearFlags, POKEGEAR_RADIO_CARD_F
+	engine_flag wPokegearFlags, POKEGEAR_MAP_CARD_F
+	engine_flag wPokegearFlags, POKEGEAR_PHONE_CARD_F
+	engine_flag wPokegearFlags, POKEGEAR_EXPN_CARD_F
+	engine_flag wPokegearFlags, POKEGEAR_OBTAINED_F
+
+	; day-care
+	engine_flag wDayCareMan, DAYCAREMAN_HAS_EGG_F
+	engine_flag wDayCareMan, DAYCAREMAN_HAS_MON_F
+	engine_flag wDayCareLady, DAYCARELADY_HAS_MON_F
+
+	engine_flag wMomSavingMoney, MOM_SAVING_SOME_MONEY_F
+	engine_flag wMomSavingMoney, MOM_ACTIVE_F
+
+	engine_flag wUnusedTwoDayTimerOn, 0 ; unused, possibly related to a 2-day timer
+
+	engine_flag wStatusFlags, STATUSFLAGS_POKEDEX_F
+	engine_flag wStatusFlags, STATUSFLAGS_UNOWN_DEX_F
+	engine_flag wStatusFlags, STATUSFLAGS_CAUGHT_POKERUS_F
+	engine_flag wStatusFlags, STATUSFLAGS_ROCKET_SIGNAL_F
+	engine_flag wStatusFlags, STATUSFLAGS_HALL_OF_FAME_F
+	engine_flag wStatusFlags, STATUSFLAGS_MAIN_MENU_MOBILE_CHOICES_F
+
+	engine_flag wStatusFlags2, STATUSFLAGS2_BUG_CONTEST_TIMER_F
+	engine_flag wStatusFlags2, STATUSFLAGS2_SAFARI_GAME_F
+	engine_flag wStatusFlags2, STATUSFLAGS2_ROCKETS_IN_RADIO_TOWER_F
+	engine_flag wStatusFlags2, STATUSFLAGS2_BIKE_SHOP_CALL_F
+	engine_flag wStatusFlags2, STATUSFLAGS2_UNUSED_5_F
+	engine_flag wStatusFlags2, STATUSFLAGS2_REACHED_GOLDENROD_F
+	engine_flag wStatusFlags2, STATUSFLAGS2_ROCKETS_IN_MAHOGANY_F
+
+	engine_flag wBikeFlags, BIKEFLAGS_STRENGTH_ACTIVE_F
+	engine_flag wBikeFlags, BIKEFLAGS_ALWAYS_ON_BIKE_F
+	engine_flag wBikeFlags, BIKEFLAGS_DOWNHILL_F
+
+	engine_flag wJohtoBadges, ZEPHYRBADGE
+	engine_flag wJohtoBadges, HIVEBADGE
+	engine_flag wJohtoBadges, PLAINBADGE
+	engine_flag wJohtoBadges, FOGBADGE
+	engine_flag wJohtoBadges, MINERALBADGE
+	engine_flag wJohtoBadges, STORMBADGE
+	engine_flag wJohtoBadges, GLACIERBADGE
+	engine_flag wJohtoBadges, RISINGBADGE
+
+	engine_flag wKantoBadges, BOULDERBADGE
+	engine_flag wKantoBadges, CASCADEBADGE
+	engine_flag wKantoBadges, THUNDERBADGE
+	engine_flag wKantoBadges, RAINBOWBADGE
+	engine_flag wKantoBadges, SOULBADGE
+	engine_flag wKantoBadges, MARSHBADGE
+	engine_flag wKantoBadges, VOLCANOBADGE
+	engine_flag wKantoBadges, EARTHBADGE
+
+	; unown sets (see data/wild/unlocked_unowns.asm)
+	engine_flag wUnlockedUnowns, 0 ; A-K
+	engine_flag wUnlockedUnowns, 1 ; L-R
+	engine_flag wUnlockedUnowns, 2 ; S-W
+	engine_flag wUnlockedUnowns, 3 ; X-Z
+	engine_flag wUnlockedUnowns, 4 ; unused
+	engine_flag wUnlockedUnowns, 5 ; unused
+	engine_flag wUnlockedUnowns, 6 ; unused
+	engine_flag wUnlockedUnowns, 7 ; unused
+
+	; fly
+	engine_flag wVisitedSpawns, SPAWN_HOME
+	engine_flag wVisitedSpawns, SPAWN_DEBUG
+	engine_flag wVisitedSpawns, SPAWN_PALLET
+	engine_flag wVisitedSpawns, SPAWN_VIRIDIAN
+	engine_flag wVisitedSpawns, SPAWN_PEWTER
+	engine_flag wVisitedSpawns, SPAWN_CERULEAN
+	engine_flag wVisitedSpawns, SPAWN_ROCK_TUNNEL
+	engine_flag wVisitedSpawns, SPAWN_VERMILION
+	engine_flag wVisitedSpawns, SPAWN_LAVENDER
+	engine_flag wVisitedSpawns, SPAWN_SAFFRON
+	engine_flag wVisitedSpawns, SPAWN_CELADON
+	engine_flag wVisitedSpawns, SPAWN_FUCHSIA
+	engine_flag wVisitedSpawns, SPAWN_CINNABAR
+	engine_flag wVisitedSpawns, SPAWN_INDIGO
+	engine_flag wVisitedSpawns, SPAWN_NEW_BARK
+	engine_flag wVisitedSpawns, SPAWN_CHERRYGROVE
+	engine_flag wVisitedSpawns, SPAWN_VIOLET
+	engine_flag wVisitedSpawns, SPAWN_AZALEA
+	engine_flag wVisitedSpawns, SPAWN_CIANWOOD
+	engine_flag wVisitedSpawns, SPAWN_GOLDENROD
+	engine_flag wVisitedSpawns, SPAWN_OLIVINE
+	engine_flag wVisitedSpawns, SPAWN_ECRUTEAK
+	engine_flag wVisitedSpawns, SPAWN_MAHOGANY
+	engine_flag wVisitedSpawns, SPAWN_LAKE_OF_RAGE
+	engine_flag wVisitedSpawns, SPAWN_BLACKTHORN
+	engine_flag wVisitedSpawns, SPAWN_MT_SILVER
+	engine_flag wVisitedSpawns, NUM_SPAWNS ; unused
+
+	engine_flag wLuckyNumberShowFlag, LUCKYNUMBERSHOW_GAME_OVER_F
+
+	engine_flag wStatusFlags2, STATUSFLAGS2_UNUSED_3_F
+
+	engine_flag wDailyFlags1, DAILYFLAGS1_KURT_MAKING_BALLS_F
+	engine_flag wDailyFlags1, DAILYFLAGS1_BUG_CONTEST_F
+	engine_flag wDailyFlags1, DAILYFLAGS1_FISH_SWARM_F
+	engine_flag wDailyFlags1, DAILYFLAGS1_TIME_CAPSULE_F
+	engine_flag wDailyFlags1, DAILYFLAGS1_ALL_FRUIT_TREES_F
+	engine_flag wDailyFlags1, DAILYFLAGS1_GOT_SHUCKIE_TODAY_F
+	engine_flag wDailyFlags1, DAILYFLAGS1_GOLDENROD_UNDERGROUND_BARGAIN_F
+	engine_flag wDailyFlags1, DAILYFLAGS1_TRAINER_HOUSE_F
+
+	engine_flag wDailyFlags2, DAILYFLAGS2_MT_MOON_SQUARE_CLEFAIRY_F
+	engine_flag wDailyFlags2, DAILYFLAGS2_UNION_CAVE_LAPRAS_F
+	engine_flag wDailyFlags2, DAILYFLAGS2_GOLDENROD_UNDERGROUND_GOT_HAIRCUT_F
+	engine_flag wDailyFlags2, DAILYFLAGS2_GOLDENROD_DEPT_STORE_TM27_RETURN_F
+	engine_flag wDailyFlags2, DAILYFLAGS2_DAISYS_GROOMING_F
+	engine_flag wDailyFlags2, DAILYFLAGS2_INDIGO_PLATEAU_RIVAL_FIGHT_F
+	engine_flag wDailyFlags2, DAILYFLAGS2_MOVE_TUTOR_F
+	engine_flag wDailyFlags2, DAILYFLAGS2_BUENAS_PASSWORD_F
+
+	engine_flag wSwarmFlags, SWARMFLAGS_BUENAS_PASSWORD_F
+	engine_flag wSwarmFlags, SWARMFLAGS_GOLDENROD_DEPT_STORE_SALE_F
+
+	engine_flag wGameTimerPause, GAMETIMERPAUSE_MOBILE_7_F
+
+	engine_flag wPlayerGender, PLAYERGENDER_FEMALE_F
+
+	engine_flag wCelebiEvent, CELEBIEVENT_FOREST_IS_RESTLESS_F
+
+	; rematches
+	engine_flag wDailyRematchFlags,  0 ; jack
+	engine_flag wDailyRematchFlags,  1 ; huey
+	engine_flag wDailyRematchFlags,  2 ; gaven
+	engine_flag wDailyRematchFlags,  3 ; beth
+	engine_flag wDailyRematchFlags,  4 ; jose
+	engine_flag wDailyRematchFlags,  5 ; reena
+	engine_flag wDailyRematchFlags,  6 ; joey
+	engine_flag wDailyRematchFlags,  7 ; wade
+	engine_flag wDailyRematchFlags,  8 ; ralph
+	engine_flag wDailyRematchFlags,  9 ; liz
+	engine_flag wDailyRematchFlags, 10 ; anthony
+	engine_flag wDailyRematchFlags, 11 ; todd
+	engine_flag wDailyRematchFlags, 12 ; gina
+	engine_flag wDailyRematchFlags, 13 ; arnie
+	engine_flag wDailyRematchFlags, 14 ; alan
+	engine_flag wDailyRematchFlags, 15 ; dana
+	engine_flag wDailyRematchFlags, 16 ; chad
+	engine_flag wDailyRematchFlags, 17 ; tully
+	engine_flag wDailyRematchFlags, 18 ; brent
+	engine_flag wDailyRematchFlags, 19 ; tiffany
+	engine_flag wDailyRematchFlags, 20 ; vance
+	engine_flag wDailyRematchFlags, 21 ; wilton
+	engine_flag wDailyRematchFlags, 22 ; parry
+	engine_flag wDailyRematchFlags, 23 ; erin
+
+	engine_flag wDailyPhoneItemFlags, 0 ; beverly has nugget
+	engine_flag wDailyPhoneItemFlags, 1 ; jose has star piece
+	engine_flag wDailyPhoneItemFlags, 2 ; wade has item (see EVENT_WADE_HAS_*** in constants/event_flags.asm)
+	engine_flag wDailyPhoneItemFlags, 3 ; gina has leaf stone
+	engine_flag wDailyPhoneItemFlags, 4 ; alan has fire stone
+	engine_flag wDailyPhoneItemFlags, 5 ; liz has thunderstone
+	engine_flag wDailyPhoneItemFlags, 6 ; derek has nugget
+	engine_flag wDailyPhoneItemFlags, 7 ; tully has water stone
+	engine_flag wDailyPhoneItemFlags, 8 ; tiffany has pink bow
+	engine_flag wDailyPhoneItemFlags, 9 ; wilton has item (see EVENT_WILTON_HAS_*** in constants/event_flags.asm)
+
+	engine_flag wDailyPhoneTimeOfDayFlags,  0 ; jack
+	engine_flag wDailyPhoneTimeOfDayFlags,  1 ; huey
+	engine_flag wDailyPhoneTimeOfDayFlags,  2 ; gaven
+	engine_flag wDailyPhoneTimeOfDayFlags,  3 ; beth
+	engine_flag wDailyPhoneTimeOfDayFlags,  4 ; jose
+	engine_flag wDailyPhoneTimeOfDayFlags,  5 ; reena
+	engine_flag wDailyPhoneTimeOfDayFlags,  6 ; joey
+	engine_flag wDailyPhoneTimeOfDayFlags,  7 ; wade
+	engine_flag wDailyPhoneTimeOfDayFlags,  8 ; ralph
+	engine_flag wDailyPhoneTimeOfDayFlags,  9 ; liz
+	engine_flag wDailyPhoneTimeOfDayFlags, 10 ; anthony
+	engine_flag wDailyPhoneTimeOfDayFlags, 11 ; todd
+	engine_flag wDailyPhoneTimeOfDayFlags, 12 ; gina
+	engine_flag wDailyPhoneTimeOfDayFlags, 13 ; arnie
+	engine_flag wDailyPhoneTimeOfDayFlags, 14 ; alan
+	engine_flag wDailyPhoneTimeOfDayFlags, 15 ; dana
+	engine_flag wDailyPhoneTimeOfDayFlags, 16 ; chad
+	engine_flag wDailyPhoneTimeOfDayFlags, 17 ; tully
+	engine_flag wDailyPhoneTimeOfDayFlags, 18 ; brent
+	engine_flag wDailyPhoneTimeOfDayFlags, 19 ; tiffany
+	engine_flag wDailyPhoneTimeOfDayFlags, 20 ; vance
+	engine_flag wDailyPhoneTimeOfDayFlags, 21 ; wilton
+	engine_flag wDailyPhoneTimeOfDayFlags, 22 ; parry
+	engine_flag wDailyPhoneTimeOfDayFlags, 23 ; erin
+
+	engine_flag wPlayerSpriteSetupFlags, PLAYERSPRITESETUP_FEMALE_TO_MALE_F
+
+	engine_flag wSwarmFlags, SWARMFLAGS_DUNSPARCE_SWARM_F
+	engine_flag wSwarmFlags, SWARMFLAGS_YANMA_SWARM_F
--- /dev/null
+++ b/data/events/special_pointers.asm
@@ -1,0 +1,184 @@
+; Special routines can be used with the "special" map script command.
+; They often use wScriptVar for arguments and return values.
+
+add_special: MACRO
+\1Special::
+	dba \1
+ENDM
+
+SpecialsPointers::
+	add_special WarpToSpawnPoint
+
+; Communications
+	add_special SetBitsForLinkTradeRequest
+	add_special WaitForLinkedFriend
+	add_special CheckLinkTimeout
+	add_special TryQuickSave
+	add_special CheckBothSelectedSameRoom
+	add_special FailedLinkToPast
+	add_special CloseLink
+	add_special WaitForOtherPlayerToExit
+	add_special SetBitsForBattleRequest
+	add_special SetBitsForTimeCapsuleRequest
+	add_special CheckTimeCapsuleCompatibility
+	add_special EnterTimeCapsule
+	add_special TradeCenter
+	add_special Colosseum
+	add_special TimeCapsule
+	add_special CableClubCheckWhichChris
+	add_special CheckMysteryGift
+	add_special GetMysteryGiftItem
+	add_special UnlockMysteryGift
+
+; Map events
+	add_special BugContestJudging
+	add_special CheckPartyFullAfterContest
+	add_special ContestDropOffMons
+	add_special ContestReturnMons
+	add_special GiveParkBalls
+	add_special CheckMagikarpLength
+	add_special MagikarpHouseSign
+	add_special HealParty ; this is both a special and a predef
+	add_special PokemonCenterPC
+	add_special PlayersHousePC
+	add_special DayCareMan
+	add_special DayCareLady
+	add_special DayCareManOutside
+	add_special MoveDeletion
+	add_special BankOfMom
+	add_special MagnetTrain
+	add_special NameRival
+	add_special SetDayOfWeek
+	add_special OverworldTownMap
+	add_special UnownPrinter
+	add_special MapRadio
+	add_special UnownPuzzle
+	add_special SlotMachine
+	add_special CardFlip
+	add_special DummyNonfunctionalGameCornerGame
+	add_special ClearBGPalettesBufferScreen
+	add_special FadeOutPalettes
+	add_special BattleTowerFade
+	add_special FadeBlackQuickly
+	add_special FadeInPalettes
+	add_special FadeInQuickly
+	add_special ReloadSpritesNoPalettes ; bank 0
+	add_special ClearBGPalettes ; bank 0
+	add_special UpdateTimePals ; bank 0
+	add_special ClearTilemap ; bank 0
+	add_special UpdateSprites ; bank 0
+	add_special UpdatePlayerSprite ; bank 0
+	add_special GameCornerPrizeMonCheckDex
+	add_special UnusedSetSeenMon
+	add_special WaitSFX ; bank 0
+	add_special PlayMapMusic ; bank 0
+	add_special RestartMapMusic ; bank 0
+	add_special HealMachineAnim
+	add_special SurfStartStep
+	add_special FindPartyMonAboveLevel
+	add_special FindPartyMonAtLeastThatHappy
+	add_special FindPartyMonThatSpecies
+	add_special FindPartyMonThatSpeciesYourTrainerID
+	add_special UnusedCheckUnusedTwoDayTimer
+	add_special DayCareMon1
+	add_special DayCareMon2
+	add_special SelectRandomBugContestContestants
+	add_special ActivateFishingSwarm
+	add_special ToggleMaptileDecorations
+	add_special ToggleDecorationsVisibility
+	add_special GiveShuckle
+	add_special ReturnShuckle
+	add_special BillsGrandfather
+	add_special CheckPokerus
+	add_special DisplayCoinCaseBalance
+	add_special DisplayMoneyAndCoinBalance
+	add_special PlaceMoneyTopRight
+	add_special CheckForLuckyNumberWinners
+	add_special CheckLuckyNumberShowFlag
+	add_special ResetLuckyNumberShowFlag
+	add_special PrintTodaysLuckyNumber
+	add_special SelectApricornForKurt
+	add_special NameRater
+	add_special DisplayLinkRecord
+	add_special GetFirstPokemonHappiness
+	add_special CheckFirstMonIsEgg
+	add_special RandomUnseenWildMon
+	add_special RandomPhoneWildMon
+	add_special RandomPhoneMon
+	add_special LoadUsedSpritesGFX
+	add_special PlaySlowCry
+	add_special SnorlaxAwake
+	add_special OlderHaircutBrother
+	add_special YoungerHaircutBrother
+	add_special DaisysGrooming
+	add_special PlayCurMonCry
+	add_special ProfOaksPCBoot
+	add_special GameboyCheck
+	add_special TrainerHouse
+	add_special PhotoStudio
+	add_special InitRoamMons
+	add_special FadeOutMusic
+	add_special Diploma
+	add_special PrintDiploma
+
+; Crystal only
+	add_special Function11ac3e
+	add_special Function11b444
+	add_special Function11b5e8
+	add_special Function11b7e5
+	add_special Function11b879
+	add_special Function11b920
+	add_special Function11b93b
+	add_special BattleTowerRoomMenu
+	add_special Function1700ba
+	add_special Function170114
+	add_special BattleTowerBattle
+	add_special Function1704e1
+	add_special DummySpecial_17021d
+	add_special LoadOpponentTrainerAndPokemonWithOTSprite
+	add_special Function11ba38
+	add_special CheckForBattleTowerRules
+	add_special GiveOddEgg
+	add_special Reset ; bank 0
+	add_special Function1011f1
+	add_special Function101220
+	add_special Function101225
+	add_special Function101231
+	add_special MoveTutor
+	add_special OmanyteChamber
+	add_special Function11c1ab
+	add_special BattleTowerAction
+	add_special DisplayUnownWords
+	add_special Menu_ChallengeExplanationCancel
+	add_special Function17d2b6
+	add_special Function17d2ce
+	add_special BattleTowerMobileError
+	add_special AskMobileOrCable
+	add_special HoOhChamber
+	add_special Function102142
+	add_special CelebiShrineEvent
+	add_special CheckCaughtCelebi
+	add_special PokeSeer
+	add_special BuenasPassword
+	add_special BuenaPrize
+	add_special GiveDratini
+	add_special SampleKenjiBreakCountdown
+	add_special BeastsCheck
+	add_special MonCheck
+	add_special SetPlayerPalette
+	add_special DummySpecial_170bd2
+	add_special Mobile_SelectThreeMons
+	add_special Function1037eb
+	add_special Function10383c
+	add_special StubbedTrainerRankings_Healings
+	add_special RefreshSprites
+	add_special Function1037c2
+	add_special Mobile_DummyReturnFalse
+	add_special Function103780
+	add_special Function10387b
+	add_special AskRememberPassword
+	add_special LoadMapPalettes
+	add_special UnusedFindItemInPCOrBag
+	add_special InitialSetDSTFlag
+	add_special InitialClearDSTFlag
+	add_special DummySpecial_c224
--- /dev/null
+++ b/data/events/std_scripts.asm
@@ -1,0 +1,58 @@
+add_stdscript: MACRO
+\1StdScript::
+	dba \1
+ENDM
+
+StdScripts::
+	add_stdscript PokecenterNurseScript
+	add_stdscript DifficultBookshelfScript
+	add_stdscript PictureBookshelfScript
+	add_stdscript MagazineBookshelfScript
+	add_stdscript TeamRocketOathScript
+	add_stdscript IncenseBurnerScript
+	add_stdscript MerchandiseShelfScript
+	add_stdscript TownMapScript
+	add_stdscript WindowScript
+	add_stdscript TVScript
+	add_stdscript HomepageScript ; unused
+	add_stdscript Radio1Script
+	add_stdscript Radio2Script
+	add_stdscript TrashCanScript
+	add_stdscript StrengthBoulderScript
+	add_stdscript SmashRockScript
+	add_stdscript PokecenterSignScript
+	add_stdscript MartSignScript
+	add_stdscript GoldenrodRocketsScript
+	add_stdscript RadioTowerRocketsScript
+	add_stdscript ElevatorButtonScript
+	add_stdscript DayToTextScript
+	add_stdscript BugContestResultsWarpScript
+	add_stdscript BugContestResultsScript
+	add_stdscript InitializeEventsScript
+	add_stdscript AskNumber1MScript
+	add_stdscript AskNumber2MScript
+	add_stdscript RegisteredNumberMScript
+	add_stdscript NumberAcceptedMScript
+	add_stdscript NumberDeclinedMScript
+	add_stdscript PhoneFullMScript
+	add_stdscript RematchMScript
+	add_stdscript GiftMScript
+	add_stdscript PackFullMScript
+	add_stdscript RematchGiftMScript
+	add_stdscript AskNumber1FScript
+	add_stdscript AskNumber2FScript
+	add_stdscript RegisteredNumberFScript
+	add_stdscript NumberAcceptedFScript
+	add_stdscript NumberDeclinedFScript
+	add_stdscript PhoneFullFScript
+	add_stdscript RematchFScript
+	add_stdscript GiftFScript
+	add_stdscript PackFullFScript
+	add_stdscript RematchGiftFScript
+	add_stdscript GymStatue1Script
+	add_stdscript GymStatue2Script
+	add_stdscript ReceiveItemScript
+	add_stdscript ReceiveTogepiEggScript
+	add_stdscript PCScript
+	add_stdscript GameCornerCoinVendorScript
+	add_stdscript HappinessCheckScript
--- /dev/null
+++ b/data/overworld/collision_permissions.asm
@@ -1,0 +1,258 @@
+TileCollisionTable::
+; entries correspond to COLL_* constants
+	db LAND_TILE         ; COLL_FLOOR
+	db LAND_TILE         ; COLL_01
+	db LAND_TILE         ; 02
+	db LAND_TILE         ; COLL_03
+	db LAND_TILE         ; COLL_04
+	db LAND_TILE         ; 05
+	db LAND_TILE         ; 06
+	db WALL_TILE         ; COLL_WALL
+	db LAND_TILE         ; COLL_CUT_08
+	db LAND_TILE         ; 09
+	db LAND_TILE         ; 0a
+	db LAND_TILE         ; 0b
+	db LAND_TILE         ; 0c
+	db LAND_TILE         ; 0d
+	db LAND_TILE         ; 0e
+	db WALL_TILE         ; 0f
+	db LAND_TILE         ; COLL_TALL_GRASS_10
+	db LAND_TILE         ; 11
+	db WALL_TILE | TALK  ; COLL_CUT_TREE
+	db LAND_TILE         ; 13
+	db LAND_TILE         ; COLL_LONG_GRASS
+	db WALL_TILE | TALK  ; COLL_HEADBUTT_TREE
+	db LAND_TILE         ; 16
+	db LAND_TILE         ; 17
+	db LAND_TILE         ; COLL_TALL_GRASS
+	db LAND_TILE         ; 19
+	db WALL_TILE | TALK  ; COLL_CUT_TREE_1A
+	db LAND_TILE         ; 1b
+	db LAND_TILE         ; COLL_LONG_GRASS_1C
+	db WALL_TILE | TALK  ; COLL_HEADBUTT_TREE_1D
+	db LAND_TILE         ; 1e
+	db LAND_TILE         ; 1f
+	db WATER_TILE        ; 20
+	db WATER_TILE        ; COLL_WATER_21
+	db WATER_TILE | TALK ; 22
+	db LAND_TILE         ; COLL_ICE
+	db WATER_TILE | TALK ; COLL_WHIRLPOOL
+	db WATER_TILE        ; 25
+	db WATER_TILE        ; 26
+	db WALL_TILE         ; COLL_BUOY
+	db WATER_TILE        ; COLL_CUT_28
+	db WATER_TILE        ; COLL_WATER
+	db WATER_TILE | TALK ; 2a
+	db LAND_TILE         ; COLL_ICE_2B
+	db WATER_TILE | TALK ; COLL_WHIRLPOOL_2C
+	db WATER_TILE        ; 2d
+	db WATER_TILE        ; 2e
+	db WALL_TILE         ; 2f
+	db WATER_TILE        ; COLL_WATERFALL_RIGHT
+	db WATER_TILE        ; COLL_WATERFALL_LEFT
+	db WATER_TILE        ; COLL_WATERFALL_UP
+	db WATER_TILE        ; COLL_WATERFALL
+	db WATER_TILE        ; 34
+	db WATER_TILE        ; 35
+	db WATER_TILE        ; 36
+	db WATER_TILE        ; 37
+	db WATER_TILE        ; COLL_CURRENT_RIGHT
+	db WATER_TILE        ; COLL_CURRENT_LEFT
+	db WATER_TILE        ; COLL_CURRENT_UP
+	db WATER_TILE        ; COLL_CURRENT_DOWN
+	db WATER_TILE        ; 3c
+	db WATER_TILE        ; 3d
+	db WATER_TILE        ; 3e
+	db WATER_TILE        ; 3f
+	db LAND_TILE         ; COLL_BRAKE
+	db LAND_TILE         ; COLL_WALK_RIGHT
+	db LAND_TILE         ; COLL_WALK_LEFT
+	db LAND_TILE         ; COLL_WALK_UP
+	db LAND_TILE         ; COLL_WALK_DOWN
+	db LAND_TILE         ; COLL_BRAKE_45
+	db LAND_TILE         ; COLL_BRAKE_46
+	db LAND_TILE         ; COLL_BRAKE_47
+	db LAND_TILE         ; COLL_GRASS_48
+	db LAND_TILE         ; COLL_GRASS_49
+	db LAND_TILE         ; COLL_GRASS_4A
+	db LAND_TILE         ; COLL_GRASS_4B
+	db LAND_TILE         ; COLL_GRASS_4C
+	db LAND_TILE         ; 4d
+	db LAND_TILE         ; 4e
+	db LAND_TILE         ; 4f
+	db LAND_TILE         ; COLL_WALK_RIGHT_ALT
+	db LAND_TILE         ; COLL_WALK_LEFT_ALT
+	db LAND_TILE         ; COLL_WALK_UP_ALT
+	db LAND_TILE         ; COLL_WALK_DOWN_ALT
+	db LAND_TILE         ; COLL_BRAKE_ALT
+	db LAND_TILE         ; COLL_BRAKE_55
+	db LAND_TILE         ; COLL_BRAKE_56
+	db LAND_TILE         ; COLL_BRAKE_57
+	db LAND_TILE         ; 58
+	db LAND_TILE         ; 59
+	db LAND_TILE         ; 5a
+	db LAND_TILE         ; COLL_5B
+	db LAND_TILE         ; 5c
+	db LAND_TILE         ; 5d
+	db LAND_TILE         ; 5e
+	db LAND_TILE         ; 5f
+	db LAND_TILE         ; COLL_PIT
+	db LAND_TILE         ; COLL_VIRTUAL_BOY
+	db WALL_TILE         ; 62
+	db LAND_TILE         ; 63
+	db LAND_TILE         ; COLL_64
+	db LAND_TILE         ; COLL_65
+	db LAND_TILE         ; 66
+	db LAND_TILE         ; 67
+	db LAND_TILE         ; COLL_PIT_68
+	db LAND_TILE         ; 69
+	db WALL_TILE         ; 6a
+	db LAND_TILE         ; 6b
+	db LAND_TILE         ; 6c
+	db LAND_TILE         ; 6d
+	db LAND_TILE         ; 6e
+	db LAND_TILE         ; 6f
+	db LAND_TILE         ; COLL_WARP_CARPET_DOWN
+	db LAND_TILE         ; COLL_DOOR
+	db LAND_TILE         ; COLL_LADDER
+	db LAND_TILE         ; COLL_STAIRCASE_73
+	db LAND_TILE         ; COLL_CAVE_74
+	db LAND_TILE         ; COLL_DOOR_75
+	db LAND_TILE         ; COLL_WARP_CARPET_LEFT
+	db LAND_TILE         ; COLL_WARP_77
+	db LAND_TILE         ; COLL_WARP_CARPET_UP
+	db LAND_TILE         ; COLL_DOOR_79
+	db LAND_TILE         ; COLL_STAIRCASE
+	db LAND_TILE         ; COLL_CAVE
+	db LAND_TILE         ; COLL_WARP_PANEL
+	db LAND_TILE         ; COLL_DOOR_7D
+	db LAND_TILE         ; COLL_WARP_CARPET_RIGHT
+	db LAND_TILE         ; COLL_WARP_7F
+	db WALL_TILE         ; 80
+	db WALL_TILE         ; 81
+	db WALL_TILE         ; 82
+	db WALL_TILE         ; 83
+	db WALL_TILE         ; 84
+	db LAND_TILE         ; 85
+	db LAND_TILE         ; 86
+	db LAND_TILE         ; 87
+	db WALL_TILE         ; 88
+	db WALL_TILE         ; 89
+	db WALL_TILE         ; 8a
+	db WALL_TILE         ; 8b
+	db WALL_TILE         ; 8c
+	db LAND_TILE         ; 8d
+	db LAND_TILE         ; 8e
+	db LAND_TILE         ; 8f
+	db WALL_TILE         ; COLL_COUNTER
+	db WALL_TILE         ; COLL_BOOKSHELF
+	db WALL_TILE         ; 92
+	db WALL_TILE         ; COLL_PC
+	db WALL_TILE         ; COLL_RADIO
+	db WALL_TILE         ; COLL_TOWN_MAP
+	db WALL_TILE         ; COLL_MART_SHELF
+	db WALL_TILE         ; COLL_TV
+	db WALL_TILE         ; COLL_COUNTER_98
+	db WALL_TILE         ; 99
+	db WALL_TILE         ; 9a
+	db WALL_TILE         ; 9b
+	db WALL_TILE         ; COLL_9C
+	db WALL_TILE         ; COLL_WINDOW
+	db WALL_TILE         ; 9e
+	db WALL_TILE         ; COLL_INCENSE_BURNER
+	db LAND_TILE         ; COLL_HOP_RIGHT
+	db LAND_TILE         ; COLL_HOP_LEFT
+	db LAND_TILE         ; COLL_HOP_UP
+	db LAND_TILE         ; COLL_HOP_DOWN
+	db LAND_TILE         ; COLL_HOP_DOWN_RIGHT
+	db LAND_TILE         ; COLL_HOP_DOWN_LEFT
+	db LAND_TILE         ; COLL_HOP_UP_RIGHT
+	db LAND_TILE         ; COLL_HOP_UP_LEFT
+	db LAND_TILE         ; a8
+	db LAND_TILE         ; a9
+	db LAND_TILE         ; aa
+	db LAND_TILE         ; ab
+	db LAND_TILE         ; ac
+	db LAND_TILE         ; ad
+	db LAND_TILE         ; ae
+	db LAND_TILE         ; af
+	db LAND_TILE         ; COLL_RIGHT_WALL
+	db LAND_TILE         ; COLL_LEFT_WALL
+	db LAND_TILE         ; COLL_UP_WALL
+	db LAND_TILE         ; COLL_DOWN_WALL
+	db LAND_TILE         ; COLL_DOWN_RIGHT_WALL
+	db LAND_TILE         ; COLL_DOWN_LEFT_WALL
+	db LAND_TILE         ; COLL_UP_RIGHT_WALL
+	db LAND_TILE         ; COLL_UP_LEFT_WALL
+	db LAND_TILE         ; b8
+	db LAND_TILE         ; b9
+	db LAND_TILE         ; ba
+	db LAND_TILE         ; bb
+	db LAND_TILE         ; bc
+	db LAND_TILE         ; bd
+	db LAND_TILE         ; be
+	db LAND_TILE         ; bf
+	db WATER_TILE        ; COLL_RIGHT_BUOY
+	db WATER_TILE        ; COLL_LEFT_BUOY
+	db WATER_TILE        ; COLL_UP_BUOY
+	db WATER_TILE        ; COLL_DOWN_BUOY
+	db WATER_TILE        ; COLL_DOWN_RIGHT_BUOY
+	db WATER_TILE        ; COLL_DOWN_LEFT_BUOY
+	db WATER_TILE        ; COLL_UP_RIGHT_BUOY
+	db WATER_TILE        ; COLL_UP_LEFT_BUOY
+	db WATER_TILE        ; c8
+	db WATER_TILE        ; c9
+	db WATER_TILE        ; ca
+	db WATER_TILE        ; cb
+	db WATER_TILE        ; cc
+	db WATER_TILE        ; cd
+	db WATER_TILE        ; ce
+	db WATER_TILE        ; cf
+	db LAND_TILE         ; d0
+	db LAND_TILE         ; d1
+	db LAND_TILE         ; d2
+	db LAND_TILE         ; d3
+	db LAND_TILE         ; d4
+	db LAND_TILE         ; d5
+	db LAND_TILE         ; d6
+	db LAND_TILE         ; d7
+	db LAND_TILE         ; d8
+	db LAND_TILE         ; d9
+	db LAND_TILE         ; da
+	db LAND_TILE         ; db
+	db LAND_TILE         ; dc
+	db LAND_TILE         ; dd
+	db LAND_TILE         ; de
+	db LAND_TILE         ; df
+	db LAND_TILE         ; e0
+	db LAND_TILE         ; e1
+	db LAND_TILE         ; e2
+	db LAND_TILE         ; e3
+	db LAND_TILE         ; e4
+	db LAND_TILE         ; e5
+	db LAND_TILE         ; e6
+	db LAND_TILE         ; e7
+	db LAND_TILE         ; e8
+	db LAND_TILE         ; e9
+	db LAND_TILE         ; ea
+	db LAND_TILE         ; eb
+	db LAND_TILE         ; ec
+	db LAND_TILE         ; ed
+	db LAND_TILE         ; ee
+	db LAND_TILE         ; ef
+	db LAND_TILE         ; f0
+	db LAND_TILE         ; f1
+	db LAND_TILE         ; f2
+	db LAND_TILE         ; f3
+	db LAND_TILE         ; f4
+	db LAND_TILE         ; f5
+	db LAND_TILE         ; f6
+	db LAND_TILE         ; f7
+	db LAND_TILE         ; f8
+	db LAND_TILE         ; f9
+	db LAND_TILE         ; fa
+	db LAND_TILE         ; fb
+	db LAND_TILE         ; fc
+	db LAND_TILE         ; fd
+	db LAND_TILE         ; fe
+	db WALL_TILE         ; COLL_FF
--- /dev/null
+++ b/data/overworld/scripting.asm
@@ -1,0 +1,172 @@
+ScriptCommandTable:
+; entries correspond to *_command constants (see macros/scripts/events.asm)
+	dw Script_scall                      ; 00
+	dw Script_farscall                   ; 01
+	dw Script_memcall                    ; 02
+	dw Script_sjump                      ; 03
+	dw Script_farsjump                   ; 04
+	dw Script_memjump                    ; 05
+	dw Script_ifequal                    ; 06
+	dw Script_ifnotequal                 ; 07
+	dw Script_iffalse                    ; 08
+	dw Script_iftrue                     ; 09
+	dw Script_ifgreater                  ; 0a
+	dw Script_ifless                     ; 0b
+	dw Script_jumpstd                    ; 0c
+	dw Script_callstd                    ; 0d
+	dw Script_callasm                    ; 0e
+	dw Script_special                    ; 0f
+	dw Script_memcallasm                 ; 10
+	dw Script_checkmapscene              ; 11
+	dw Script_setmapscene                ; 12
+	dw Script_checkscene                 ; 13
+	dw Script_setscene                   ; 14
+	dw Script_setval                     ; 15
+	dw Script_addval                     ; 16
+	dw Script_random                     ; 17
+	dw Script_checkver                   ; 18
+	dw Script_readmem                    ; 19
+	dw Script_writemem                   ; 1a
+	dw Script_loadmem                    ; 1b
+	dw Script_readvar                    ; 1c
+	dw Script_writevar                   ; 1d
+	dw Script_loadvar                    ; 1e
+	dw Script_giveitem                   ; 1f
+	dw Script_takeitem                   ; 20
+	dw Script_checkitem                  ; 21
+	dw Script_givemoney                  ; 22
+	dw Script_takemoney                  ; 23
+	dw Script_checkmoney                 ; 24
+	dw Script_givecoins                  ; 25
+	dw Script_takecoins                  ; 26
+	dw Script_checkcoins                 ; 27
+	dw Script_addcellnum                 ; 28
+	dw Script_delcellnum                 ; 29
+	dw Script_checkcellnum               ; 2a
+	dw Script_checktime                  ; 2b
+	dw Script_checkpoke                  ; 2c
+	dw Script_givepoke                   ; 2d
+	dw Script_giveegg                    ; 2e
+	dw Script_givepokemail               ; 2f
+	dw Script_checkpokemail              ; 30
+	dw Script_checkevent                 ; 31
+	dw Script_clearevent                 ; 32
+	dw Script_setevent                   ; 33
+	dw Script_checkflag                  ; 34
+	dw Script_clearflag                  ; 35
+	dw Script_setflag                    ; 36
+	dw Script_wildon                     ; 37
+	dw Script_wildoff                    ; 38
+	dw Script_xycompare                  ; 39
+	dw Script_warpmod                    ; 3a
+	dw Script_blackoutmod                ; 3b
+	dw Script_warp                       ; 3c
+	dw Script_getmoney                   ; 3d
+	dw Script_getcoins                   ; 3e
+	dw Script_getnum                     ; 3f
+	dw Script_getmonname                 ; 40
+	dw Script_getitemname                ; 41
+	dw Script_getcurlandmarkname         ; 42
+	dw Script_gettrainername             ; 43
+	dw Script_getstring                  ; 44
+	dw Script_itemnotify                 ; 45
+	dw Script_pocketisfull               ; 46
+	dw Script_opentext                   ; 47
+	dw Script_refreshscreen              ; 48
+	dw Script_closetext                  ; 49
+	dw Script_writeunusedbytebuffer      ; 4a
+	dw Script_farwritetext               ; 4b
+	dw Script_writetext                  ; 4c
+	dw Script_repeattext                 ; 4d
+	dw Script_yesorno                    ; 4e
+	dw Script_loadmenu                   ; 4f
+	dw Script_closewindow                ; 50
+	dw Script_jumptextfaceplayer         ; 51
+	dw Script_farjumptext                ; 52
+	dw Script_jumptext                   ; 53
+	dw Script_waitbutton                 ; 54
+	dw Script_promptbutton               ; 55
+	dw Script_pokepic                    ; 56
+	dw Script_closepokepic               ; 57
+	dw Script__2dmenu                    ; 58
+	dw Script_verticalmenu               ; 59
+	dw Script_loadpikachudata            ; 5a
+	dw Script_randomwildmon              ; 5b
+	dw Script_loadtemptrainer            ; 5c
+	dw Script_loadwildmon                ; 5d
+	dw Script_loadtrainer                ; 5e
+	dw Script_startbattle                ; 5f
+	dw Script_reloadmapafterbattle       ; 60
+	dw Script_catchtutorial              ; 61
+	dw Script_trainertext                ; 62
+	dw Script_trainerflagaction          ; 63
+	dw Script_winlosstext                ; 64
+	dw Script_scripttalkafter            ; 65
+	dw Script_endifjustbattled           ; 66
+	dw Script_checkjustbattled           ; 67
+	dw Script_setlasttalked              ; 68
+	dw Script_applymovement              ; 69
+	dw Script_applymovementlasttalked    ; 6a
+	dw Script_faceplayer                 ; 6b
+	dw Script_faceobject                 ; 6c
+	dw Script_variablesprite             ; 6d
+	dw Script_disappear                  ; 6e
+	dw Script_appear                     ; 6f
+	dw Script_follow                     ; 70
+	dw Script_stopfollow                 ; 71
+	dw Script_moveobject                 ; 72
+	dw Script_writeobjectxy              ; 73
+	dw Script_loademote                  ; 74
+	dw Script_showemote                  ; 75
+	dw Script_turnobject                 ; 76
+	dw Script_follownotexact             ; 77
+	dw Script_earthquake                 ; 78
+	dw Script_changemapblocks            ; 79
+	dw Script_changeblock                ; 7a
+	dw Script_reloadmap                  ; 7b
+	dw Script_reloadmappart              ; 7c
+	dw Script_writecmdqueue              ; 7d
+	dw Script_delcmdqueue                ; 7e
+	dw Script_playmusic                  ; 7f
+	dw Script_encountermusic             ; 80
+	dw Script_musicfadeout               ; 81
+	dw Script_playmapmusic               ; 82
+	dw Script_dontrestartmapmusic        ; 83
+	dw Script_cry                        ; 84
+	dw Script_playsound                  ; 85
+	dw Script_waitsfx                    ; 86
+	dw Script_warpsound                  ; 87
+	dw Script_specialsound               ; 88
+	dw Script_autoinput                  ; 89
+	dw Script_newloadmap                 ; 8a
+	dw Script_pause                      ; 8b
+	dw Script_deactivatefacing           ; 8c
+	dw Script_prioritysjump              ; 8d
+	dw Script_warpcheck                  ; 8e
+	dw Script_stopandsjump               ; 8f
+	dw Script_endcallback                ; 90
+	dw Script_end                        ; 91
+	dw Script_reloadend                  ; 92
+	dw Script_endall                     ; 93
+	dw Script_pokemart                   ; 94
+	dw Script_elevator                   ; 95
+	dw Script_trade                      ; 96
+	dw Script_askforphonenumber          ; 97
+	dw Script_phonecall                  ; 98
+	dw Script_hangup                     ; 99
+	dw Script_describedecoration         ; 9a
+	dw Script_fruittree                  ; 9b
+	dw Script_specialphonecall           ; 9c
+	dw Script_checkphonecall             ; 9d
+	dw Script_verbosegiveitem            ; 9e
+	dw Script_verbosegiveitemvar         ; 9f
+	dw Script_swarm                      ; a0
+	dw Script_halloffame                 ; a1
+	dw Script_credits                    ; a2
+	dw Script_warpfacing                 ; a3
+	dw Script_battletowertext            ; a4
+	dw Script_getlandmarkname            ; a5
+	dw Script_gettrainerclassname        ; a6
+	dw Script_getname                    ; a7
+	dw Script_wait                       ; a8
+	dw Script_checksave                  ; a9
--- /dev/null
+++ b/data/overworld/tilesets.asm
@@ -1,0 +1,51 @@
+tileset: MACRO
+	dba \1GFX, \1Meta, \1Coll
+	dw \1Anim
+	dw NULL
+	dw \1PalMap
+ENDM
+
+; Associated data:
+; - The *GFX, *Meta, and *Coll are defined in gfx/tilesets.asm
+; - The *PalMap are defined in gfx/tileset_palette_maps.asm
+; - The *Anim are defined in engine/tilesets/tileset_anims.asm
+
+Tilesets::
+; entries correspond to TILESET_* constants
+	tileset Tileset0
+	tileset TilesetJohto
+	tileset TilesetJohtoModern
+	tileset TilesetKanto
+	tileset TilesetBattleTowerOutside
+	tileset TilesetHouse
+	tileset TilesetPlayersHouse
+	tileset TilesetPokecenter
+	tileset TilesetGate
+	tileset TilesetPort
+	tileset TilesetLab
+	tileset TilesetFacility
+	tileset TilesetMart
+	tileset TilesetMansion
+	tileset TilesetGameCorner
+	tileset TilesetEliteFourRoom
+	tileset TilesetTraditionalHouse
+	tileset TilesetTrainStation
+	tileset TilesetChampionsRoom
+	tileset TilesetLighthouse
+	tileset TilesetPlayersRoom
+	tileset TilesetPokeComCenter
+	tileset TilesetBattleTowerInside
+	tileset TilesetTower
+	tileset TilesetCave
+	tileset TilesetPark
+	tileset TilesetRuinsOfAlph
+	tileset TilesetRadioTower
+	tileset TilesetUnderground
+	tileset TilesetIcePath
+	tileset TilesetDarkCave
+	tileset TilesetForest
+	tileset TilesetBetaWordRoom
+	tileset TilesetHoOhWordRoom
+	tileset TilesetKabutoWordRoom
+	tileset TilesetOmanyteWordRoom
+	tileset TilesetAerodactylWordRoom
--- /dev/null
+++ b/data/overworld/variables.asm
@@ -1,0 +1,33 @@
+VarActionTable:
+; entries correspond to VAR_* constants
+	; RETVAR_STRBUF2: copy [de] to wStringBuffer2
+	; RETVAR_ADDR_DE: return address in de
+	; RETVAR_EXECUTE: call function
+	dwb wStringBuffer2,                 RETVAR_STRBUF2
+	dwb wPartyCount,                    RETVAR_STRBUF2
+	dwb Var_BattleResult,               RETVAR_EXECUTE
+	dwb wBattleType,                    RETVAR_ADDR_DE
+	dwb wTimeOfDay,                     RETVAR_STRBUF2
+	dwb Var_CountCaughtMons,            RETVAR_EXECUTE
+	dwb Var_CountSeenMons,              RETVAR_EXECUTE
+	dwb Var_CountBadges,                RETVAR_EXECUTE
+	dwb wPlayerState,                   RETVAR_ADDR_DE
+	dwb Var_PlayerFacing,               RETVAR_EXECUTE
+	dwb hHours,                         RETVAR_STRBUF2
+	dwb Var_DayOfWeek,                  RETVAR_EXECUTE
+	dwb wMapGroup,                      RETVAR_STRBUF2
+	dwb wMapNumber,                     RETVAR_STRBUF2
+	dwb Var_UnownCaught,                RETVAR_EXECUTE
+	dwb wEnvironment,                   RETVAR_STRBUF2
+	dwb Var_BoxFreeSpace,               RETVAR_EXECUTE
+	dwb wBugContestMinsRemaining,       RETVAR_STRBUF2
+	dwb wXCoord,                        RETVAR_STRBUF2
+	dwb wYCoord,                        RETVAR_STRBUF2
+	dwb wSpecialPhoneCallID,            RETVAR_STRBUF2
+	dwb wNrOfBeatenBattleTowerTrainers, RETVAR_STRBUF2
+	dwb wKurtApricornQuantity,          RETVAR_STRBUF2
+	dwb wCurCaller,                     RETVAR_ADDR_DE
+	dwb wBlueCardBalance,               RETVAR_ADDR_DE
+	dwb wBuenasPassword,                RETVAR_ADDR_DE
+	dwb wKenjiBreakTimer,               RETVAR_STRBUF2
+	dwb NULL,                           RETVAR_STRBUF2
--- a/data/special_pointers.asm
+++ /dev/null
@@ -1,184 +1,0 @@
-; Special routines can be used with the "special" map script command.
-; They often use wScriptVar for arguments and return values.
-
-add_special: MACRO
-\1Special::
-	dba \1
-ENDM
-
-SpecialsPointers::
-	add_special WarpToSpawnPoint
-
-; Communications
-	add_special SetBitsForLinkTradeRequest
-	add_special WaitForLinkedFriend
-	add_special CheckLinkTimeout
-	add_special TryQuickSave
-	add_special CheckBothSelectedSameRoom
-	add_special FailedLinkToPast
-	add_special CloseLink
-	add_special WaitForOtherPlayerToExit
-	add_special SetBitsForBattleRequest
-	add_special SetBitsForTimeCapsuleRequest
-	add_special CheckTimeCapsuleCompatibility
-	add_special EnterTimeCapsule
-	add_special TradeCenter
-	add_special Colosseum
-	add_special TimeCapsule
-	add_special CableClubCheckWhichChris
-	add_special CheckMysteryGift
-	add_special GetMysteryGiftItem
-	add_special UnlockMysteryGift
-
-; Map events
-	add_special BugContestJudging
-	add_special CheckPartyFullAfterContest
-	add_special ContestDropOffMons
-	add_special ContestReturnMons
-	add_special GiveParkBalls
-	add_special CheckMagikarpLength
-	add_special MagikarpHouseSign
-	add_special HealParty ; this is both a special and a predef
-	add_special PokemonCenterPC
-	add_special PlayersHousePC
-	add_special DayCareMan
-	add_special DayCareLady
-	add_special DayCareManOutside
-	add_special MoveDeletion
-	add_special BankOfMom
-	add_special MagnetTrain
-	add_special NameRival
-	add_special SetDayOfWeek
-	add_special OverworldTownMap
-	add_special UnownPrinter
-	add_special MapRadio
-	add_special UnownPuzzle
-	add_special SlotMachine
-	add_special CardFlip
-	add_special DummyNonfunctionalGameCornerGame
-	add_special ClearBGPalettesBufferScreen
-	add_special FadeOutPalettes
-	add_special BattleTowerFade
-	add_special FadeBlackQuickly
-	add_special FadeInPalettes
-	add_special FadeInQuickly
-	add_special ReloadSpritesNoPalettes ; bank 0
-	add_special ClearBGPalettes ; bank 0
-	add_special UpdateTimePals ; bank 0
-	add_special ClearTilemap ; bank 0
-	add_special UpdateSprites ; bank 0
-	add_special UpdatePlayerSprite ; bank 0
-	add_special GameCornerPrizeMonCheckDex
-	add_special UnusedSetSeenMon
-	add_special WaitSFX ; bank 0
-	add_special PlayMapMusic ; bank 0
-	add_special RestartMapMusic ; bank 0
-	add_special HealMachineAnim
-	add_special SurfStartStep
-	add_special FindPartyMonAboveLevel
-	add_special FindPartyMonAtLeastThatHappy
-	add_special FindPartyMonThatSpecies
-	add_special FindPartyMonThatSpeciesYourTrainerID
-	add_special UnusedCheckUnusedTwoDayTimer
-	add_special DayCareMon1
-	add_special DayCareMon2
-	add_special SelectRandomBugContestContestants
-	add_special ActivateFishingSwarm
-	add_special ToggleMaptileDecorations
-	add_special ToggleDecorationsVisibility
-	add_special GiveShuckle
-	add_special ReturnShuckle
-	add_special BillsGrandfather
-	add_special CheckPokerus
-	add_special DisplayCoinCaseBalance
-	add_special DisplayMoneyAndCoinBalance
-	add_special PlaceMoneyTopRight
-	add_special CheckForLuckyNumberWinners
-	add_special CheckLuckyNumberShowFlag
-	add_special ResetLuckyNumberShowFlag
-	add_special PrintTodaysLuckyNumber
-	add_special SelectApricornForKurt
-	add_special NameRater
-	add_special DisplayLinkRecord
-	add_special GetFirstPokemonHappiness
-	add_special CheckFirstMonIsEgg
-	add_special RandomUnseenWildMon
-	add_special RandomPhoneWildMon
-	add_special RandomPhoneMon
-	add_special LoadUsedSpritesGFX
-	add_special PlaySlowCry
-	add_special SnorlaxAwake
-	add_special OlderHaircutBrother
-	add_special YoungerHaircutBrother
-	add_special DaisysGrooming
-	add_special PlayCurMonCry
-	add_special ProfOaksPCBoot
-	add_special GameboyCheck
-	add_special TrainerHouse
-	add_special PhotoStudio
-	add_special InitRoamMons
-	add_special FadeOutMusic
-	add_special Diploma
-	add_special PrintDiploma
-
-; Crystal only
-	add_special Function11ac3e
-	add_special Function11b444
-	add_special Function11b5e8
-	add_special Function11b7e5
-	add_special Function11b879
-	add_special Function11b920
-	add_special Function11b93b
-	add_special BattleTowerRoomMenu
-	add_special Function1700ba
-	add_special Function170114
-	add_special BattleTowerBattle
-	add_special Function1704e1
-	add_special DummySpecial_17021d
-	add_special LoadOpponentTrainerAndPokemonWithOTSprite
-	add_special Function11ba38
-	add_special CheckForBattleTowerRules
-	add_special GiveOddEgg
-	add_special Reset ; bank 0
-	add_special Function1011f1
-	add_special Function101220
-	add_special Function101225
-	add_special Function101231
-	add_special MoveTutor
-	add_special OmanyteChamber
-	add_special Function11c1ab
-	add_special BattleTowerAction
-	add_special DisplayUnownWords
-	add_special Menu_ChallengeExplanationCancel
-	add_special Function17d2b6
-	add_special Function17d2ce
-	add_special BattleTowerMobileError
-	add_special AskMobileOrCable
-	add_special HoOhChamber
-	add_special Function102142
-	add_special CelebiShrineEvent
-	add_special CheckCaughtCelebi
-	add_special PokeSeer
-	add_special BuenasPassword
-	add_special BuenaPrize
-	add_special GiveDratini
-	add_special SampleKenjiBreakCountdown
-	add_special BeastsCheck
-	add_special MonCheck
-	add_special SetPlayerPalette
-	add_special DummySpecial_170bd2
-	add_special Mobile_SelectThreeMons
-	add_special Function1037eb
-	add_special Function10383c
-	add_special StubbedTrainerRankings_Healings
-	add_special RefreshSprites
-	add_special Function1037c2
-	add_special Mobile_DummyReturnFalse
-	add_special Function103780
-	add_special Function10387b
-	add_special AskRememberPassword
-	add_special LoadMapPalettes
-	add_special UnusedFindItemInPCOrBag
-	add_special InitialSetDSTFlag
-	add_special InitialClearDSTFlag
-	add_special DummySpecial_c224
--- a/data/tilesets.asm
+++ /dev/null
@@ -1,51 +1,0 @@
-tileset: MACRO
-	dba \1GFX, \1Meta, \1Coll
-	dw \1Anim
-	dw NULL
-	dw \1PalMap
-ENDM
-
-; Associated data:
-; - The *GFX, *Meta, and *Coll are defined in gfx/tilesets.asm
-; - The *PalMap are defined in gfx/tileset_palette_maps.asm
-; - The *Anim are defined in engine/tilesets/tileset_anims.asm
-
-Tilesets::
-; entries correspond to TILESET_* constants
-	tileset Tileset0
-	tileset TilesetJohto
-	tileset TilesetJohtoModern
-	tileset TilesetKanto
-	tileset TilesetBattleTowerOutside
-	tileset TilesetHouse
-	tileset TilesetPlayersHouse
-	tileset TilesetPokecenter
-	tileset TilesetGate
-	tileset TilesetPort
-	tileset TilesetLab
-	tileset TilesetFacility
-	tileset TilesetMart
-	tileset TilesetMansion
-	tileset TilesetGameCorner
-	tileset TilesetEliteFourRoom
-	tileset TilesetTraditionalHouse
-	tileset TilesetTrainStation
-	tileset TilesetChampionsRoom
-	tileset TilesetLighthouse
-	tileset TilesetPlayersRoom
-	tileset TilesetPokeComCenter
-	tileset TilesetBattleTowerInside
-	tileset TilesetTower
-	tileset TilesetCave
-	tileset TilesetPark
-	tileset TilesetRuinsOfAlph
-	tileset TilesetRadioTower
-	tileset TilesetUnderground
-	tileset TilesetIcePath
-	tileset TilesetDarkCave
-	tileset TilesetForest
-	tileset TilesetBetaWordRoom
-	tileset TilesetHoOhWordRoom
-	tileset TilesetKabutoWordRoom
-	tileset TilesetOmanyteWordRoom
-	tileset TilesetAerodactylWordRoom
--- a/docs/event_commands.md
+++ b/docs/event_commands.md
@@ -1,6 +1,6 @@
 # Event Commands
 
-Defined in [macros/scripts/events.asm](https://github.com/pret/pokecrystal/blob/master/macros/scripts/events.asm) and [engine/overworld/scripting.asm:ScriptCommandTable](https://github.com/pret/pokecrystal/blob/master/engine/overworld/scripting.asm).
+Defined in [macros/scripts/events.asm](https://github.com/pret/pokecrystal/blob/master/macros/scripts/events.asm) and [data/overworld/scripting.asm:ScriptCommandTable](https://github.com/pret/pokecrystal/blob/master/data/overworld/scripting.asm).
 
 Until this document is filled out, the [G/S Scripting Compendium](https://hax.iimarckus.org/files/scriptingcodes_eng.htm) has descriptions for most of these commands. It was written for G/S binary hacking and not Crystal assembly hacking, so it's not 100% accurate for pokecrystal.
 
--- a/docs/index.md
+++ b/docs/index.md
@@ -13,7 +13,6 @@
 - [event_commands.md](event_commands.md)
 - [movement_commands.md](movement_commands.md)
 - [text_commands.md](text_commands.md)
-- [map_setup_scripts.md](map_setup_scripts.md)
 
 
 ## Other types of scripts
--- a/docs/map_setup_scripts.md
+++ /dev/null
@@ -1,144 +1,0 @@
-# Map Setup Commands
-
-Defined in [macros/scripts/map_setup.asm](https://github.com/pret/pokecrystal/blob/master/macros/scripts/map_setup.asm) and [data/maps/setup_script_pointers.asm:MapSetupCommands](https://github.com/pret/pokecrystal/blob/master/data/maps/setup_script_pointers.asm).
-
-
-## `$00`: `map_enable_lcd`
-
-
-## `$01`: `map_disable_lcd`
-
-
-## `$02`: `map_init_sound`
-
-
-## `$03`: `map_play_music`
-
-
-## `$04`: `map_restart_music`
-
-
-## `$05`: `map_fade_to_music`
-
-
-## `$06`: `map_fade_music_and_palettes`
-
-
-## `$07`: `map_play_music_bike`
-
-
-## `$08`: `map_force_music`
-
-
-## `$09`: `map_fade_in_to_music`
-
-
-## `$0A`: `map_load_block_data`
-
-
-## `$0B`: `map_load_connection_block_data`
-
-
-## `$0C`: `map_save_screen`
-
-
-## `$0D`: `map_buffer_screen`
-
-
-## `$0E`: `map_load_graphics`
-
-
-## `$0F`: `map_load_tileset`
-
-
-## `$10`: `map_load_time_of_day`
-
-
-## `$11`: `map_load_palettes`
-
-
-## `$12`: `map_load_wild_mon_data`
-
-
-## `$13`: `map_refresh_sprites`
-
-
-## `$14`: `map_handle_new`
-
-
-## `$15`: `map_handle_continue`
-
-
-## `$16`: `map_load_objects`
-
-
-## `$17`: `map_enter_spawn_point`
-
-
-## `$18`: `map_enter_connection`
-
-
-## `$19`: `map_enter_warp`
-
-
-## `$1A`: `map_load_attributes`
-
-
-## `$1B`: `map_load_attributes_no_objects`
-
-
-## `$1C`: `map_clear_bg_palettes`
-
-
-## `$1D`: `map_fade_out_palettes`
-
-
-## `$1E`: `map_fade_in_palettes`
-
-
-## `$1F`: `map_get_screen_coords`
-
-
-## `$20`: `map_get_warp_dest_coords`
-
-
-## `$21`: `map_spawn_in_facing_down`
-
-
-## `$22`: `map_spawn_player`
-
-
-## `$23`: `map_refresh_player_coords`
-
-
-## `$24`: `map_reset_player_object_action`
-
-
-## `$25`: `map_skip_update_sprites`
-
-
-## `$26`: `map_update_roam_mons`
-
-
-## `$27`: `map_jump_roam_mons`
-
-
-## `$28`: `map_fade_out_music`
-
-
-## `$29`: `map_activate_anims`
-
-
-## `$2A`: `map_suspend_anims`
-
-
-## `$2B`: `map_apply_palettes`
-
-
-## `$2C`: `map_enable_text_acceleration`
-
-
-## `$2D`: `map_init_name_sign`
-
-
-## `$FF`: `map_end`
--- a/engine/events/engine_flags.asm
+++ b/engine/events/engine_flags.asm
@@ -80,4 +80,4 @@
 	ld [de], a
 	ret
 
-INCLUDE "data/engine_flags.asm"
+INCLUDE "data/events/engine_flags.asm"
--- a/engine/events/specials.asm
+++ b/engine/events/specials.asm
@@ -13,7 +13,7 @@
 	rst FarCall
 	ret
 
-INCLUDE "data/special_pointers.asm"
+INCLUDE "data/events/special_pointers.asm"
 
 DummySpecial_c224:
 	ret
--- a/engine/events/std_scripts.asm
+++ b/engine/events/std_scripts.asm
@@ -1,61 +1,4 @@
-add_stdscript: MACRO
-\1StdScript::
-	dba \1
-ENDM
-
-StdScripts::
-	add_stdscript PokecenterNurseScript
-	add_stdscript DifficultBookshelfScript
-	add_stdscript PictureBookshelfScript
-	add_stdscript MagazineBookshelfScript
-	add_stdscript TeamRocketOathScript
-	add_stdscript IncenseBurnerScript
-	add_stdscript MerchandiseShelfScript
-	add_stdscript TownMapScript
-	add_stdscript WindowScript
-	add_stdscript TVScript
-	add_stdscript HomepageScript ; unused
-	add_stdscript Radio1Script
-	add_stdscript Radio2Script
-	add_stdscript TrashCanScript
-	add_stdscript StrengthBoulderScript
-	add_stdscript SmashRockScript
-	add_stdscript PokecenterSignScript
-	add_stdscript MartSignScript
-	add_stdscript GoldenrodRocketsScript
-	add_stdscript RadioTowerRocketsScript
-	add_stdscript ElevatorButtonScript
-	add_stdscript DayToTextScript
-	add_stdscript BugContestResultsWarpScript
-	add_stdscript BugContestResultsScript
-	add_stdscript InitializeEventsScript
-	add_stdscript AskNumber1MScript
-	add_stdscript AskNumber2MScript
-	add_stdscript RegisteredNumberMScript
-	add_stdscript NumberAcceptedMScript
-	add_stdscript NumberDeclinedMScript
-	add_stdscript PhoneFullMScript
-	add_stdscript RematchMScript
-	add_stdscript GiftMScript
-	add_stdscript PackFullMScript
-	add_stdscript RematchGiftMScript
-	add_stdscript AskNumber1FScript
-	add_stdscript AskNumber2FScript
-	add_stdscript RegisteredNumberFScript
-	add_stdscript NumberAcceptedFScript
-	add_stdscript NumberDeclinedFScript
-	add_stdscript PhoneFullFScript
-	add_stdscript RematchFScript
-	add_stdscript GiftFScript
-	add_stdscript PackFullFScript
-	add_stdscript RematchGiftFScript
-	add_stdscript GymStatue1Script
-	add_stdscript GymStatue2Script
-	add_stdscript ReceiveItemScript
-	add_stdscript ReceiveTogepiEggScript
-	add_stdscript PCScript
-	add_stdscript GameCornerCoinVendorScript
-	add_stdscript HappinessCheckScript
+INCLUDE "data/events/std_scripts.asm"
 
 PokecenterNurseScript:
 ; EVENT_WELCOMED_TO_POKECOM_CENTER is never set
--- a/engine/overworld/scripting.asm
+++ b/engine/overworld/scripting.asm
@@ -61,178 +61,7 @@
 	rst JumpTable
 	ret
 
-ScriptCommandTable:
-; entries correspond to *_command constants (see macros/scripts/events.asm)
-	dw Script_scall                      ; 00
-	dw Script_farscall                   ; 01
-	dw Script_memcall                    ; 02
-	dw Script_sjump                      ; 03
-	dw Script_farsjump                   ; 04
-	dw Script_memjump                    ; 05
-	dw Script_ifequal                    ; 06
-	dw Script_ifnotequal                 ; 07
-	dw Script_iffalse                    ; 08
-	dw Script_iftrue                     ; 09
-	dw Script_ifgreater                  ; 0a
-	dw Script_ifless                     ; 0b
-	dw Script_jumpstd                    ; 0c
-	dw Script_callstd                    ; 0d
-	dw Script_callasm                    ; 0e
-	dw Script_special                    ; 0f
-	dw Script_memcallasm                 ; 10
-	dw Script_checkmapscene              ; 11
-	dw Script_setmapscene                ; 12
-	dw Script_checkscene                 ; 13
-	dw Script_setscene                   ; 14
-	dw Script_setval                     ; 15
-	dw Script_addval                     ; 16
-	dw Script_random                     ; 17
-	dw Script_checkver                   ; 18
-	dw Script_readmem                    ; 19
-	dw Script_writemem                   ; 1a
-	dw Script_loadmem                    ; 1b
-	dw Script_readvar                    ; 1c
-	dw Script_writevar                   ; 1d
-	dw Script_loadvar                    ; 1e
-	dw Script_giveitem                   ; 1f
-	dw Script_takeitem                   ; 20
-	dw Script_checkitem                  ; 21
-	dw Script_givemoney                  ; 22
-	dw Script_takemoney                  ; 23
-	dw Script_checkmoney                 ; 24
-	dw Script_givecoins                  ; 25
-	dw Script_takecoins                  ; 26
-	dw Script_checkcoins                 ; 27
-	dw Script_addcellnum                 ; 28
-	dw Script_delcellnum                 ; 29
-	dw Script_checkcellnum               ; 2a
-	dw Script_checktime                  ; 2b
-	dw Script_checkpoke                  ; 2c
-	dw Script_givepoke                   ; 2d
-	dw Script_giveegg                    ; 2e
-	dw Script_givepokemail               ; 2f
-	dw Script_checkpokemail              ; 30
-	dw Script_checkevent                 ; 31
-	dw Script_clearevent                 ; 32
-	dw Script_setevent                   ; 33
-	dw Script_checkflag                  ; 34
-	dw Script_clearflag                  ; 35
-	dw Script_setflag                    ; 36
-	dw Script_wildon                     ; 37
-	dw Script_wildoff                    ; 38
-	dw Script_xycompare                  ; 39
-	dw Script_warpmod                    ; 3a
-	dw Script_blackoutmod                ; 3b
-	dw Script_warp                       ; 3c
-	dw Script_getmoney                   ; 3d
-	dw Script_getcoins                   ; 3e
-	dw Script_getnum                     ; 3f
-	dw Script_getmonname                 ; 40
-	dw Script_getitemname                ; 41
-	dw Script_getcurlandmarkname         ; 42
-	dw Script_gettrainername             ; 43
-	dw Script_getstring                  ; 44
-	dw Script_itemnotify                 ; 45
-	dw Script_pocketisfull               ; 46
-	dw Script_opentext                   ; 47
-	dw Script_refreshscreen              ; 48
-	dw Script_closetext                  ; 49
-	dw Script_writeunusedbytebuffer      ; 4a
-	dw Script_farwritetext               ; 4b
-	dw Script_writetext                  ; 4c
-	dw Script_repeattext                 ; 4d
-	dw Script_yesorno                    ; 4e
-	dw Script_loadmenu                   ; 4f
-	dw Script_closewindow                ; 50
-	dw Script_jumptextfaceplayer         ; 51
-	dw Script_farjumptext                ; 52
-	dw Script_jumptext                   ; 53
-	dw Script_waitbutton                 ; 54
-	dw Script_promptbutton               ; 55
-	dw Script_pokepic                    ; 56
-	dw Script_closepokepic               ; 57
-	dw Script__2dmenu                    ; 58
-	dw Script_verticalmenu               ; 59
-	dw Script_loadpikachudata            ; 5a
-	dw Script_randomwildmon              ; 5b
-	dw Script_loadtemptrainer            ; 5c
-	dw Script_loadwildmon                ; 5d
-	dw Script_loadtrainer                ; 5e
-	dw Script_startbattle                ; 5f
-	dw Script_reloadmapafterbattle       ; 60
-	dw Script_catchtutorial              ; 61
-	dw Script_trainertext                ; 62
-	dw Script_trainerflagaction          ; 63
-	dw Script_winlosstext                ; 64
-	dw Script_scripttalkafter            ; 65
-	dw Script_endifjustbattled           ; 66
-	dw Script_checkjustbattled           ; 67
-	dw Script_setlasttalked              ; 68
-	dw Script_applymovement              ; 69
-	dw Script_applymovementlasttalked    ; 6a
-	dw Script_faceplayer                 ; 6b
-	dw Script_faceobject                 ; 6c
-	dw Script_variablesprite             ; 6d
-	dw Script_disappear                  ; 6e
-	dw Script_appear                     ; 6f
-	dw Script_follow                     ; 70
-	dw Script_stopfollow                 ; 71
-	dw Script_moveobject                 ; 72
-	dw Script_writeobjectxy              ; 73
-	dw Script_loademote                  ; 74
-	dw Script_showemote                  ; 75
-	dw Script_turnobject                 ; 76
-	dw Script_follownotexact             ; 77
-	dw Script_earthquake                 ; 78
-	dw Script_changemapblocks            ; 79
-	dw Script_changeblock                ; 7a
-	dw Script_reloadmap                  ; 7b
-	dw Script_reloadmappart              ; 7c
-	dw Script_writecmdqueue              ; 7d
-	dw Script_delcmdqueue                ; 7e
-	dw Script_playmusic                  ; 7f
-	dw Script_encountermusic             ; 80
-	dw Script_musicfadeout               ; 81
-	dw Script_playmapmusic               ; 82
-	dw Script_dontrestartmapmusic        ; 83
-	dw Script_cry                        ; 84
-	dw Script_playsound                  ; 85
-	dw Script_waitsfx                    ; 86
-	dw Script_warpsound                  ; 87
-	dw Script_specialsound               ; 88
-	dw Script_autoinput                  ; 89
-	dw Script_newloadmap                 ; 8a
-	dw Script_pause                      ; 8b
-	dw Script_deactivatefacing           ; 8c
-	dw Script_prioritysjump              ; 8d
-	dw Script_warpcheck                  ; 8e
-	dw Script_stopandsjump               ; 8f
-	dw Script_endcallback                ; 90
-	dw Script_end                        ; 91
-	dw Script_reloadend                  ; 92
-	dw Script_endall                     ; 93
-	dw Script_pokemart                   ; 94
-	dw Script_elevator                   ; 95
-	dw Script_trade                      ; 96
-	dw Script_askforphonenumber          ; 97
-	dw Script_phonecall                  ; 98
-	dw Script_hangup                     ; 99
-	dw Script_describedecoration         ; 9a
-	dw Script_fruittree                  ; 9b
-	dw Script_specialphonecall           ; 9c
-	dw Script_checkphonecall             ; 9d
-	dw Script_verbosegiveitem            ; 9e
-	dw Script_verbosegiveitemvar         ; 9f
-	dw Script_swarm                      ; a0
-	dw Script_halloffame                 ; a1
-	dw Script_credits                    ; a2
-	dw Script_warpfacing                 ; a3
-	dw Script_battletowertext            ; a4
-	dw Script_getlandmarkname            ; a5
-	dw Script_gettrainerclassname        ; a6
-	dw Script_getname                    ; a7
-	dw Script_wait                       ; a8
-	dw Script_checksave                  ; a9
+INCLUDE "data/overworld/scripting.asm"
 
 StartScript:
 	ld hl, wScriptFlags
--- a/engine/overworld/variables.asm
+++ b/engine/overworld/variables.asm
@@ -6,7 +6,7 @@
 .valid
 	ld c, a
 	ld b, 0
-	ld hl, .VarActionTable
+	ld hl, VarActionTable
 	add hl, bc
 	add hl, bc
 	add hl, bc
@@ -17,100 +17,68 @@
 	ld b, [hl]
 	ld a, b
 	and RETVAR_EXECUTE
-	jr nz, .call
+	jr nz, .call_de
 	ld a, b
 	and RETVAR_ADDR_DE
 	ret nz
 	ld a, [de]
-	jr .loadstringbuffer2
+	jr LoadStringBuffer2
 
-.call
+.call_de
 	call _de_
 	ret
 
-.loadstringbuffer2
+LoadStringBuffer2:
 	ld de, wStringBuffer2
 	ld [de], a
 	ret
 
-.VarActionTable:
-; entries correspond to VAR_* constants
-	; RETVAR_STRBUF2: copy [de] to wStringBuffer2
-	; RETVAR_ADDR_DE: return address in de
-	; RETVAR_EXECUTE: call function
-	dwb wStringBuffer2,                 RETVAR_STRBUF2
-	dwb wPartyCount,                    RETVAR_STRBUF2
-	dwb .BattleResult,                  RETVAR_EXECUTE
-	dwb wBattleType,                    RETVAR_ADDR_DE
-	dwb wTimeOfDay,                     RETVAR_STRBUF2
-	dwb .CountCaughtMons,               RETVAR_EXECUTE
-	dwb .CountSeenMons,                 RETVAR_EXECUTE
-	dwb .CountBadges,                   RETVAR_EXECUTE
-	dwb wPlayerState,                   RETVAR_ADDR_DE
-	dwb .PlayerFacing,                  RETVAR_EXECUTE
-	dwb hHours,                         RETVAR_STRBUF2
-	dwb .DayOfWeek,                     RETVAR_EXECUTE
-	dwb wMapGroup,                      RETVAR_STRBUF2
-	dwb wMapNumber,                     RETVAR_STRBUF2
-	dwb .UnownCaught,                   RETVAR_EXECUTE
-	dwb wEnvironment,                   RETVAR_STRBUF2
-	dwb .BoxFreeSpace,                  RETVAR_EXECUTE
-	dwb wBugContestMinsRemaining,       RETVAR_STRBUF2
-	dwb wXCoord,                        RETVAR_STRBUF2
-	dwb wYCoord,                        RETVAR_STRBUF2
-	dwb wSpecialPhoneCallID,            RETVAR_STRBUF2
-	dwb wNrOfBeatenBattleTowerTrainers, RETVAR_STRBUF2
-	dwb wKurtApricornQuantity,          RETVAR_STRBUF2
-	dwb wCurCaller,                     RETVAR_ADDR_DE
-	dwb wBlueCardBalance,               RETVAR_ADDR_DE
-	dwb wBuenasPassword,                RETVAR_ADDR_DE
-	dwb wKenjiBreakTimer,               RETVAR_STRBUF2
-	dwb NULL,                           RETVAR_STRBUF2
+INCLUDE "data/overworld/variables.asm"
 
-.CountCaughtMons:
+Var_CountCaughtMons:
 ; Caught mons.
 	ld hl, wPokedexCaught
 	ld b, wEndPokedexCaught - wPokedexCaught
 	call CountSetBits
 	ld a, [wNumSetBits]
-	jp .loadstringbuffer2
+	jp LoadStringBuffer2
 
-.CountSeenMons:
+Var_CountSeenMons:
 ; Seen mons.
 	ld hl, wPokedexSeen
 	ld b, wEndPokedexSeen - wPokedexSeen
 	call CountSetBits
 	ld a, [wNumSetBits]
-	jp .loadstringbuffer2
+	jp LoadStringBuffer2
 
-.CountBadges:
+Var_CountBadges:
 ; Number of owned badges.
 	ld hl, wBadges
 	ld b, 2
 	call CountSetBits
 	ld a, [wNumSetBits]
-	jp .loadstringbuffer2
+	jp LoadStringBuffer2
 
-.PlayerFacing:
+Var_PlayerFacing:
 ; The direction the player is facing.
 	ld a, [wPlayerDirection]
 	and $c
 	rrca
 	rrca
-	jp .loadstringbuffer2
+	jp LoadStringBuffer2
 
-.DayOfWeek:
+Var_DayOfWeek:
 ; The day of the week.
 	call GetWeekday
-	jp .loadstringbuffer2
+	jp LoadStringBuffer2
 
-.UnownCaught:
+Var_UnownCaught:
 ; Number of unique Unown caught.
 	call .count_unown
 	ld a, b
-	jp .loadstringbuffer2
+	jp LoadStringBuffer2
 
-.count_unown
+.count_unown:
 	ld hl, wUnownDex
 	ld b, 0
 .loop
@@ -123,7 +91,7 @@
 	jr c, .loop
 	ret
 
-.BoxFreeSpace:
+Var_BoxFreeSpace:
 ; Remaining slots in the current box.
 	ld a, BANK(sBoxCount)
 	call OpenSRAM
@@ -133,9 +101,10 @@
 	ld b, a
 	call CloseSRAM
 	ld a, b
-	jp .loadstringbuffer2
+	jp LoadStringBuffer2
 
-.BattleResult:
+Var_BattleResult:
+; Outcome of the last battle.
 	ld a, [wBattleResult]
 	and $ff ^ BATTLERESULT_BITMASK
-	jp .loadstringbuffer2
+	jp LoadStringBuffer2
--- a/macros/scripts/events.asm
+++ b/macros/scripts/events.asm
@@ -1,4 +1,4 @@
-; ScriptCommandTable indexes (see engine/overworld/scripting.asm)
+; ScriptCommandTable indexes (see data/overworld/scripting.asm)
 	const_def
 
 	const scall_command ; $00
--- a/main.asm
+++ b/main.asm
@@ -203,7 +203,7 @@
 
 INCLUDE "engine/tilesets/map_palettes.asm"
 INCLUDE "gfx/tileset_palette_maps.asm"
-INCLUDE "data/collision_permissions.asm"
+INCLUDE "data/overworld/collision_permissions.asm"
 INCLUDE "engine/menus/empty_sram.asm"
 INCLUDE "engine/menus/savemenu_copytilemapatonce.asm"
 INCLUDE "engine/events/checksave.asm"
@@ -220,7 +220,7 @@
 INCLUDE "engine/link/link_2.asm"
 INCLUDE "engine/rtc/reset_password.asm"
 INCLUDE "engine/menus/delete_save.asm"
-INCLUDE "data/tilesets.asm"
+INCLUDE "data/overworld/tilesets.asm"
 INCLUDE "engine/smallflag.asm"
 INCLUDE "engine/gfx/trademon_frontpic.asm"
 INCLUDE "engine/events/pokerus/check_pokerus.asm"