shithub: pokecrystal

Download patch

ref: 91068077f05afbbfd6571ceadada2c03ac7c8038
parent: b522b0f165b6aae278ca9b4b18bada606d4ae737
author: PikalaxALT <PikalaxALT@gmail.com>
date: Wed Nov 11 11:11:08 EST 2015

Further split bank 4

--- a/battle/core.asm
+++ b/battle/core.asm
@@ -2889,7 +2889,7 @@
 
 ForcePlayerMonChoice: ; 3d227
 	call EmptyBattleTextBox
-	call LoadPartyMenuDataHeader
+	call LoadStandardMenuDataHeader
 	call Function3d2f7
 	call ForcePickPartyMonInBattle
 	ld a, [wLinkMode]
@@ -2996,7 +2996,7 @@
 
 Function3d2f7: ; 3d2f7
 	call WhiteBGMap
-Function3d2fa: ; 3d2fa
+Function3d2fa: ; switch to fullscreen menu?
 	callba Function5004f
 	callba Function50405
 	callba Function8e85
@@ -3415,7 +3415,7 @@
 	ld a, $8
 	call Function3d490
 	call EmptyBattleTextBox
-	jp LoadPartyMenuDataHeader
+	jp LoadStandardMenuDataHeader
 ; 3d57a
 
 ResetBattleParticipants: ; 3d57a
@@ -5233,7 +5233,7 @@
 	and a
 	jp nz, ItemsCantBeUsed
 
-	call LoadPartyMenuDataHeader
+	call LoadStandardMenuDataHeader
 
 	ld a, [BattleType]
 	cp BATTLETYPE_TUTORIAL
@@ -5328,10 +5328,10 @@
 ; 3e28d
 
 BattleMenu_PKMN: ; 3e28d
-	call LoadPartyMenuDataHeader
+	call LoadStandardMenuDataHeader
 Function3e290:
 	call ExitMenu
-	call LoadPartyMenuDataHeader
+	call LoadStandardMenuDataHeader
 	call WhiteBGMap
 Function3e299:
 	call Function3d2fa
@@ -5467,7 +5467,7 @@
 	ld a, [wLinkMode]
 	and a
 	jr z, .not_linked
-	call LoadPartyMenuDataHeader
+	call LoadStandardMenuDataHeader
 	call Function3e8e4
 	call WriteBackup
 
--- a/battle/effect_commands.asm
+++ b/battle/effect_commands.asm
@@ -8953,7 +8953,7 @@
 	call DelayFrames
 
 ; Transition into switchmon menu
-	call LoadPartyMenuDataHeader
+	call LoadStandardMenuDataHeader
 	callba Function3d2f7
 
 	callba ForcePickSwitchMonInBattle
@@ -9027,7 +9027,7 @@
 	ld a, 1
 	ld [wd0ec], a
 
-	call LoadPartyMenuDataHeader
+	call LoadStandardMenuDataHeader
 	ld hl, Function3e8e4
 	call CallBattleCore
 	call WriteBackup
@@ -9043,7 +9043,7 @@
 	and a
 	ret z
 
-	call LoadPartyMenuDataHeader
+	call LoadStandardMenuDataHeader
 	ld hl, Function3e8e4
 	call CallBattleCore
 
--- a/constants/script_constants.asm
+++ b/constants/script_constants.asm
@@ -45,7 +45,7 @@
 	const PLAYEREVENT_4
 	const PLAYEREVENT_WARP
 	const PLAYEREVENT_FALL
-	const PLAYEREVENT_7
+	const PLAYEREVENT_WHITEOUT
 	const PLAYEREVENT_HATCH
 	const PLAYEREVENT_9
 NUM_PLAYER_EVENTS EQU const_value
--- a/engine/breeding/egg.asm
+++ b/engine/breeding/egg.asm
@@ -190,7 +190,7 @@
 
 OverworldHatchEgg:: ; 16f5e
 	call ResetWindow
-	call LoadPartyMenuDataHeader
+	call LoadStandardMenuDataHeader
 	call Function16f70
 	call Function2b4d
 	call RestartMapMusic
@@ -324,7 +324,7 @@
 	ld [MonType], a
 	push de
 	ld b, $0
-	callba Function116c1
+	callba NamingScreen
 	pop hl
 	ld de, StringBuffer1
 	call InitName
--- a/engine/clock_reset.asm
+++ b/engine/clock_reset.asm
@@ -38,7 +38,7 @@
 	ld a, [hl]
 	push af
 	set NO_TEXT_SCROLL, [hl]
-	call LoadPartyMenuDataHeader
+	call LoadStandardMenuDataHeader
 	call ClearTileMap
 	ld hl, .Text_SetWithControlPad
 	call PrintText
--- a/engine/events.asm
+++ b/engine/events.asm
@@ -1078,7 +1078,7 @@
 	dba UnknownScript_0x96c4d   ; 4
 	dba WarpToNewMapScript      ; 5
 	dba FallIntoMapScript       ; 6
-	dba UnknownScript_0x124c8   ; 7
+	dba Script_OverworldWhiteout   ; 7
 	dba HatchEggScript          ; 8
 	dba UnknownScript_0x96c4f   ; 9
 	dba Invalid_0x96c2d         ; 10
--- a/engine/evolution_animation.asm
+++ b/engine/evolution_animation.asm
@@ -161,7 +161,7 @@
 Function4e708: ; 4e708
 	call GetBaseData
 	hlcoord 7, 2
-	jp Function3786
+	jp PrepMonFrontpic
 ; 4e711
 
 Function4e711: ; 4e711
--- /dev/null
+++ b/engine/healmachineanim.asm
@@ -1,0 +1,266 @@
+HealMachineAnim: ; 12324
+	; If you have no Pokemon, don't change the buffer.  This can lead to some glitchy effects if you have no Pokemon.
+	ld a, [PartyCount]
+	and a
+	ret z
+	; The location of the healing machine relative to the player is stored in ScriptVar.
+	; 0: Up and left (Pokemon Center)
+	; 1: Left (Elm's Lab)
+	; 2: Up (Hall of Fame)
+	ld a, [ScriptVar]
+	ld [Buffer1], a
+	ld a, [rOBP1]
+	ld [Buffer2], a
+	call .DoJumptableFunctions
+	ld a, [Buffer2]
+	call Functiond24
+	ret
+; 1233e
+
+.DoJumptableFunctions: ; 1233e
+	xor a
+	ld [wd1ec], a
+.jumpable_loop
+	ld a, [Buffer1]
+	ld e, a
+	ld d, 0
+	ld hl, .Pointers
+rept 2
+	add hl, de
+endr
+	ld a, [hli]
+	ld h, [hl]
+	ld l, a
+	ld a, [wd1ec]
+	ld e, a
+	inc a
+	ld [wd1ec], a
+	add hl, de
+	ld a, [hl]
+	cp 5
+	jr z, .finish
+	ld hl, .Jumptable
+	rst JumpTable
+	jr .jumpable_loop
+
+.finish
+	ret
+; 12365
+
+.Pointers: ; 12365
+	dw .Pokecenter
+	dw .ElmLab
+	dw .HallOfFame
+; 1236b
+
+.Pokecenter: ; 1236b
+	db 0, 1, 3, 5
+.ElmLab: ; 1236f
+	db 0, 1, 3, 5
+.HallOfFame: ; 12373
+	db 0, 2, 4, 5
+; 12377
+
+.Jumptable: ; 12377
+	dw .LoadGFX
+	dw .PC_LoadBallsOntoMachine
+	dw .HOF_LoadBallsOntoMachine
+	dw .PlayHealMusic
+	dw .HOF_PlaySFX
+	dw .dummy_5 ; never encountered
+; 12383
+
+.LoadGFX: ; 12383
+	call .LoadPalettes
+	ld de, .HealMachineGFX
+	ld hl, VTiles0 tile $7c
+	lb bc, BANK(.HealMachineGFX), $2
+	call Request2bpp
+	ret
+; 12393
+
+.PC_LoadBallsOntoMachine: ; 12393
+	ld hl, Sprites + $80
+	ld de, .PC_ElmsLab_TileMap
+	call .PlaceHealingMachineTile
+	call .PlaceHealingMachineTile
+	jr .LoadBallsOntoMachine
+
+.HOF_LoadBallsOntoMachine: ; 123a1
+	ld hl, Sprites + $80
+	ld de, .HOF_TileMap
+
+.LoadBallsOntoMachine: ; 123a7
+	ld a, [PartyCount]
+	ld b, a
+.party_loop
+	call .PlaceHealingMachineTile
+	push de
+	ld de, SFX_SECOND_PART_OF_ITEMFINDER
+	call PlaySFX
+	pop de
+	ld c, 30
+	call DelayFrames
+	dec b
+	jr nz, .party_loop
+	ret
+; 123bf
+
+.PlayHealMusic: ; 123bf
+	ld de, MUSIC_HEAL
+	call PlayMusic
+	jp .FlashPalettes8Times
+; 123c8
+
+.HOF_PlaySFX: ; 123c8
+	ld de, SFX_GAME_FREAK_LOGO_GS
+	call PlaySFX
+	call .FlashPalettes8Times
+	call WaitSFX
+	ld de, SFX_BOOT_PC
+	call PlaySFX
+	ret
+; 123db
+
+.dummy_5: ; 123db
+	ret
+; 123dc
+
+.PC_ElmsLab_TileMap: ; 123dc
+	db $20, $22, $7c, $16
+	db $20, $26, $7c, $16
+	db $26, $20, $7d, $16
+	db $26, $28, $7d, $36
+	db $2b, $20, $7d, $16
+	db $2b, $28, $7d, $36
+	db $30, $20, $7d, $16
+	db $30, $28, $7d, $36
+; 123fc
+
+.HealMachineGFX: ; 123fc
+INCBIN "gfx/unknown/0123fc.2bpp"
+; 1241c
+
+.HOF_TileMap: ; 1241c
+	db $3c, $51, $7d, $16
+	db $3c, $56, $7d, $16
+	db $3b, $4d, $7d, $16
+	db $3b, $5a, $7d, $16
+	db $39, $49, $7d, $16
+	db $39, $5d, $7d, $16
+; 12434
+
+.LoadPalettes: ; 12434
+	call IsCGB
+	jr nz, .cgb
+	ld a, %11100000
+	ld [rOBP1], a
+	ret
+
+.cgb
+	ld hl, .palettes
+	ld de, OBPals + 8 * 6
+	ld bc, 8
+	ld a, $5
+	call FarCopyWRAM
+	ld a, $1
+	ld [hCGBPalUpdate], a
+	ret
+; 12451
+
+.palettes: ; 12451
+	RGB 31, 31, 31
+	RGB 31, 19, 10
+	RGB 31, 07, 01
+	RGB 00, 00, 00
+; 12459
+
+.FlashPalettes8Times: ; 12459
+	ld c, $8
+.palette_loop
+	push bc
+	call .FlashPalettes
+	ld c, 10
+	call DelayFrames
+	pop bc
+	dec c
+	jr nz, .palette_loop
+	ret
+; 12469
+
+.FlashPalettes: ; 12469
+	call IsCGB
+	jr nz, .go
+	ld a, [rOBP1]
+	xor %00101000
+	ld [rOBP1], a
+	ret
+
+.go
+	ld a, [rSVBK]
+	push af
+	ld a, $5
+	ld [rSVBK], a
+
+	ld hl, OBPals + 8 * 6
+	ld a, [hli]
+	ld e, a
+	ld a, [hli]
+	ld d, a
+	push de
+	ld c, $3
+.palette_loop_2
+	ld a, [hli]
+	ld e, a
+	ld a, [hld]
+	ld d, a
+	dec hl
+	ld a, d
+	ld [hld], a
+	ld a, e
+	ld [hli], a
+rept 3
+	inc hl
+endr
+	dec c
+	jr nz, .palette_loop_2
+	pop de
+	dec hl
+	ld a, d
+	ld [hld], a
+	ld a, e
+	ld [hl], a
+
+	pop af
+	ld [rSVBK], a
+	ld a, $1
+	ld [hCGBPalUpdate], a
+	ret
+; 124a3
+
+.PlaceHealingMachineTile: ; 124a3
+	push bc
+	ld a, [Buffer1]
+	lb bc, $10, $20
+	cp $1 ; ElmsLab
+	jr z, .okay
+	lb bc, $00, $00
+
+.okay
+	ld a, [de]
+	add c
+	inc de
+	ld [hli], a
+	ld a, [de]
+	add b
+	inc de
+	ld [hli], a
+	ld a, [de]
+	inc de
+	ld [hli], a
+	ld a, [de]
+	inc de
+	ld [hli], a
+	pop bc
+	ret
+; 124c1
--- a/engine/link.asm
+++ b/engine/link.asm
@@ -1676,7 +1676,7 @@
 	ld hl, UnknownText_0x28eb8
 	bccoord 1, 14
 	call PlaceWholeStringInBoxAtOnce
-	call LoadPartyMenuDataHeader
+	call LoadStandardMenuDataHeader
 	hlcoord 10, 7
 	ld b, $3
 	ld c, $7
--- a/engine/mart.asm
+++ b/engine/mart.asm
@@ -36,7 +36,7 @@
 
 HerbShop: ; 15a6e
 	call FarReadMart
-	call LoadPartyMenuDataHeader
+	call LoadStandardMenuDataHeader
 	ld hl, Text_HerbShop_Intro
 	call MartTextBox
 	call BuyMenu
@@ -50,7 +50,7 @@
 	ld de, BargainShopData
 	call LoadMartPointer
 	call ReadMart
-	call LoadPartyMenuDataHeader
+	call LoadStandardMenuDataHeader
 	ld hl, Text_BargainShop_Intro
 	call MartTextBox
 	call BuyMenu
@@ -69,7 +69,7 @@
 
 Pharmacist: ; 15aae
 	call FarReadMart
-	call LoadPartyMenuDataHeader
+	call LoadStandardMenuDataHeader
 	ld hl, UnknownText_0x15e90
 	call MartTextBox
 	call BuyMenu
@@ -90,7 +90,7 @@
 .ok
 	call LoadMartPointer
 	call ReadMart
-	call LoadPartyMenuDataHeader
+	call LoadStandardMenuDataHeader
 	ld hl, Text_Mart_HowMayIHelpYou
 	call MartTextBox
 	call BuyMenu
@@ -175,7 +175,7 @@
 ; 15b62
 
 .HowMayIHelpYou: ; 15b62
-	call LoadPartyMenuDataHeader
+	call LoadStandardMenuDataHeader
 	ld hl, Text_Mart_HowMayIHelpYou
 	call PrintText
 	ld a, $1 ; top menu
@@ -183,7 +183,7 @@
 ; 15b6e
 
 .TopMenu: ; 15b6e
-	ld hl, MenuDataHeader_0x15f88
+	ld hl, MenuDataHeader_BuySell
 	call CopyMenuDataHeader
 	call InterpretMenu2
 	jr c, .quit
@@ -228,7 +228,7 @@
 ; 15baf
 
 .AnythingElse: ; 15baf
-	call LoadPartyMenuDataHeader
+	call LoadStandardMenuDataHeader
 	ld hl, Text_Mart_AnythingElse
 	call PrintText
 	ld a, $1 ; top menu
@@ -472,7 +472,7 @@
 BuyMenuLoop: ; 15cef
 	callba Function24ae8
 	call UpdateSprites
-	ld hl, MenuDataHeader_0x15e18
+	ld hl, MenuDataHeader_Buy
 	call CopyMenuDataHeader
 	ld a, [wd045]
 	ld [wMenuCursorBuffer], a
@@ -643,19 +643,19 @@
 	db "@"
 ; 0x15e18
 
-MenuDataHeader_0x15e18: ; 0x15e18
+MenuDataHeader_Buy: ; 0x15e18
 	db $40 ; flags
 	db 03, 01 ; start coords
 	db 11, 19 ; end coords
-	dw MenuData2_0x15e20
+	dw .menudata2
 	db 1 ; default option
 ; 0x15e20
 
-MenuData2_0x15e20: ; 0x15e20
-	db $30 ; flags
+.menudata2: ; 0x15e20
+	db $30 ; pointers
 	db 4, 8 ; rows, columns
 	db 1 ; horizontal spacing
-	dbw 0, OBPals + 8 * 6
+	dbw 0, CurMart
 	dba PlaceMenuItemName
 	dba .PrintBCDPrices
 	dba Function244c3
@@ -929,16 +929,16 @@
 	db "@"
 ; 0x15f88
 
-MenuDataHeader_0x15f88: ; 0x15f88
+MenuDataHeader_BuySell: ; 0x15f88
 	db $40 ; flags
 	db 00, 00 ; start coords
 	db 08, 07 ; end coords
-	dw MenuData2_0x15f90
+	dw .menudata2
 	db 1 ; default option
 ; 0x15f90
 
-MenuData2_0x15f90: ; 0x15f90
-	db $80 ; flags
+.menudata2: ; 0x15f90
+	db $80 ; strings
 	db 3 ; items
 	db "BUY@"
 	db "SELL@"
--- /dev/null
+++ b/engine/namingscreen.asm
@@ -1,0 +1,959 @@
+_NamingScreen: ; 0x116b7
+	call DisableSpriteUpdates
+	call NamingScreen
+	call Function2b74
+	ret
+; 0x116c1
+
+NamingScreen: ; 116c1
+	ld hl, wc6d0
+	ld [hl], e
+	inc hl
+	ld [hl], d
+	ld hl, wc6d4
+	ld [hl], b
+	ld hl, Options
+	ld a, [hl]
+	push af
+	set NO_TEXT_SCROLL, [hl]
+	ld a, [hMapAnims]
+	push af
+	xor a
+	ld [hMapAnims], a
+	ld a, [hInMenu]
+	push af
+	ld a, $1
+	ld [hInMenu], a
+	call Function116f8
+	call DelayFrame
+.asm_116e5
+	call Function11915
+	jr nc, .asm_116e5
+	pop af
+	ld [hInMenu], a
+	pop af
+	ld [hMapAnims], a
+	pop af
+	ld [Options], a
+	call ClearJoypad
+	ret
+; 116f8
+
+Function116f8: ; 116f8
+	call WhiteBGMap
+	ld b, $8
+	call GetSGBLayout
+	call DisableLCD
+	call Function11c51
+	call Function118a8
+	ld a, $e3
+	ld [rLCDC], a
+	call Function1171d
+	call WaitBGMap
+	call WaitTop
+	call SetPalettes
+	call Function11be0
+	ret
+; 1171d
+
+Function1171d: ; 1171d
+	ld a, [wc6d4]
+	and 7
+	ld e, a
+	ld d, 0
+	ld hl, Jumptable_1172e
+rept 2
+	add hl, de
+endr
+	ld a, [hli]
+	ld h, [hl]
+	ld l, a
+	jp [hl]
+; 1172e
+
+
+Jumptable_1172e: ; 1172e (4:572e)
+	dw Function1173e
+	dw Function1178d
+	dw Function117ae
+	dw Function117d1
+	dw Function117f5
+	dw Function1182c
+	dw Function1173e
+	dw Function1173e
+
+
+Function1173e: ; 1173e (4:573e)
+	ld a, [CurPartySpecies]
+	ld [wd265], a
+	ld hl, Function8e83f
+	ld a, BANK(Function8e83f)
+	ld e, $1
+	rst FarCall ;  ; indirect jump to Function8e83f (8e83f (23:683f))
+	ld a, [CurPartySpecies]
+	ld [wd265], a
+	call GetPokemonName
+	hlcoord 5, 2
+	call PlaceString
+	ld l, c
+	ld h, b
+	ld de, Strings_11780
+	call PlaceString
+	inc de
+	hlcoord 5, 4
+	call PlaceString
+	callba GetGender
+	jr c, .asm_1177c
+	ld a, $ef
+	jr nz, .asm_11778
+	ld a, $f5
+.asm_11778
+	hlcoord 1, 2
+	ld [hl], a
+.asm_1177c
+	call Function1187b
+	ret
+; 11780 (4:5780)
+
+Strings_11780: ; 11780
+	db "'S@"
+	db "NICKNAME?@"
+; 1178d
+
+Function1178d: ; 1178d (4:578d)
+	callba GetPlayerIcon
+	call Function11847
+	hlcoord 5, 2
+	ld de, String_117a3
+	call PlaceString
+	call Function11882
+	ret
+; 117a3 (4:57a3)
+
+String_117a3: ; 117a3
+	db "YOUR NAME?@"
+; 117ae
+
+Function117ae: ; 117ae (4:57ae)
+	ld de, SilverSpriteGFX
+	ld b, BANK(SilverSpriteGFX)
+	call Function11847
+	hlcoord 5, 2
+	ld de, String_117c3
+	call PlaceString
+	call Function11882
+	ret
+; 117c3 (4:57c3)
+
+String_117c3: ; 117c3
+	db "RIVAL'S NAME?@"
+; 117d1
+
+Function117d1: ; 117d1 (4:57d1)
+	ld de, MomSpriteGFX
+	ld b, BANK(MomSpriteGFX)
+	call Function11847
+	hlcoord 5, 2
+	ld de, String_117e6
+	call PlaceString
+	call Function11882
+	ret
+; 117e6 (4:57e6)
+
+String_117e6: ; 117e6
+	db "MOTHER'S NAME?@"
+; 117f5
+
+Function117f5: ; 117f5 (4:57f5)
+	ld de, PokeBallSpriteGFX
+	ld hl, VTiles0 tile $00
+	lb bc, BANK(PokeBallSpriteGFX), $4
+	call Request2bpp
+	xor a
+	ld hl, wc300
+	ld [hli], a
+	ld [hl], a
+	ld de, $2420
+	ld a, $a
+	call Function3b2a
+	ld hl, $1
+	add hl, bc
+	ld [hl], $0
+	hlcoord 5, 2
+	ld de, String_11822
+	call PlaceString
+	call Function11889
+	ret
+; 11822 (4:5822)
+
+String_11822: ; 11822
+	db "BOX NAME?@"
+; 1182c
+
+Function1182c: ; 1182c (4:582c)
+	hlcoord 3, 2
+	ld de, String_11839
+	call PlaceString
+	call Function11882
+	ret
+; 11839 (4:5839)
+
+String_11839: ; 11839
+	db "おともだち の なまえは?@"
+; 11847
+
+Function11847: ; 11847 (4:5847)
+	push de
+	ld hl, VTiles0 tile $00
+	ld c, $4
+	push bc
+	call Request2bpp
+	pop bc
+	ld hl, $c0
+	add hl, de
+	ld e, l
+	ld d, h
+	ld hl, VTiles0 tile $04
+	call Request2bpp
+	xor a
+	ld hl, wc300
+	ld [hli], a
+	ld [hl], a
+	pop de
+	ld b, $a
+	ld a, d
+	cp $7a
+	jr nz, .asm_11873
+	ld a, e
+	cp $40
+	jr nz, .asm_11873
+	ld b, $1e
+.asm_11873
+	ld a, b
+	ld de, $2420
+	call Function3b2a
+	ret
+
+Function1187b: ; 1187b (4:587b)
+	ld a, $a
+	hlcoord 5, 6
+	jr Function11890
+
+Function11882: ; 11882 (4:5882)
+	ld a, $7
+	hlcoord 5, 6
+	jr Function11890
+
+Function11889: ; 11889 (4:5889)
+	ld a, $8
+	hlcoord 5, 4
+	jr Function11890
+
+Function11890: ; 11890 (4:5890)
+	ld [wc6d3], a
+	ld a, l
+	ld [wc6d8], a
+	ld a, h
+	ld [wc6d9], a
+	ret
+
+
+Function1189c: ; 1189c
+	push bc
+	push af
+	ld a, [wc6d4]
+	sub $3
+	ld b, a
+	pop af
+	dec b
+	pop bc
+	ret
+; 118a8
+
+Function118a8: ; 118a8
+	call WaitTop
+	hlcoord 0, 0
+	ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
+	ld a, $60
+	call ByteFill
+	hlcoord 1, 1
+	lb bc, 6, 18
+	call Function1189c
+	jr nz, .asm_118c4
+	lb bc, 4, 18
+
+.asm_118c4
+	call ClearBox
+	ld de, NameInputUpper
+Function118ca: ; 118ca
+	call Function1189c
+	jr nz, .asm_118d5
+	ld hl, BoxNameInputLower - NameInputLower
+	add hl, de
+	ld d, h
+	ld e, l
+
+.asm_118d5
+	push de
+	hlcoord 1, 8
+	lb bc, 7, 18
+	call Function1189c
+	jr nz, .asm_118e7
+	hlcoord 1, 6
+	lb bc, 9, 18
+
+.asm_118e7
+	call ClearBox
+	hlcoord 1, 16
+	lb bc, 1, 18
+	call ClearBox
+	pop de
+	hlcoord 2, 8
+	ld b, $5
+	call Function1189c
+	jr nz, .asm_11903
+	hlcoord 2, 6
+	ld b, $6
+
+.asm_11903
+	ld c, $11
+.asm_11905
+	ld a, [de]
+	ld [hli], a
+	inc de
+	dec c
+	jr nz, .asm_11905
+	push de
+	ld de, $17
+	add hl, de
+	pop de
+	dec b
+	jr nz, .asm_11903
+	ret
+; 11915
+
+Function11915: ; 11915
+	call JoyTextDelay
+	ld a, [wJumptableIndex]
+	bit 7, a
+	jr nz, .asm_11930
+	call Function11968
+	callba Function8cf62
+	call Function11940
+	call DelayFrame
+	and a
+	ret
+
+.asm_11930
+	callab Function8cf53
+	call ClearSprites
+	xor a
+	ld [hSCX], a
+	ld [hSCY], a
+	scf
+	ret
+; 11940
+
+Function11940: ; 11940
+	xor a
+	ld [hBGMapMode], a
+	hlcoord 1, 5
+	call Function1189c
+	jr nz, .asm_1194e
+	hlcoord 1, 3
+
+.asm_1194e
+	lb bc, 1, 18
+	call ClearBox
+	ld hl, wc6d0
+	ld e, [hl]
+	inc hl
+	ld d, [hl]
+	ld hl, wc6d8
+	ld a, [hli]
+	ld h, [hl]
+	ld l, a
+	call PlaceString
+	ld a, $1
+	ld [hBGMapMode], a
+	ret
+; 11968
+
+Function11968: ; 11968
+	ld a, [wJumptableIndex]
+	ld e, a
+	ld d, $0
+	ld hl, Jumptable_11977
+rept 2
+	add hl, de
+endr
+	ld a, [hli]
+	ld h, [hl]
+	ld l, a
+	jp [hl]
+; 11977
+
+
+Jumptable_11977: ; 11977 (4:5977)
+	dw Function1197b
+	dw Function119a1
+
+
+Function1197b: ; 1197b (4:597b)
+	lb de, $50, $18
+	call Function1189c
+	jr nz, .asm_11985
+	ld d, $40
+.asm_11985
+	ld a, $2
+	call Function3b2a
+	ld a, c
+	ld [wc6d5], a
+	ld a, b
+	ld [wc6d6], a
+	ld hl, $1
+	add hl, bc
+	ld a, [hl]
+	ld hl, $e
+	add hl, bc
+	ld [hl], a
+	ld hl, wJumptableIndex
+	inc [hl]
+	ret
+
+Function119a1: ; 119a1 (4:59a1)
+	ld hl, hJoyPressed ; $ffa7
+	ld a, [hl]
+	and A_BUTTON
+	jr nz, .a
+	ld a, [hl]
+	and B_BUTTON
+	jr nz, .b
+	ld a, [hl]
+	and START
+	jr nz, .start
+	ld a, [hl]
+	and SELECT
+	jr nz, .select
+	ret
+
+.a
+	call Function11a0b
+	cp $1
+	jr z, .select
+	cp $2
+	jr z, .b
+	cp $3
+	jr z, .asm_119eb
+	call Function11c11
+	call Function11b14
+	ret nc
+
+.start
+	ld hl, wc6d5
+	ld c, [hl]
+	inc hl
+	ld b, [hl]
+	ld hl, $c
+	add hl, bc
+	ld [hl], $8
+	ld hl, $d
+	add hl, bc
+	ld [hl], $4
+	call Function1189c
+	ret nz
+	inc [hl]
+	ret
+
+.b
+	call Function11bbc
+	ret
+
+.asm_119eb
+	call Function11bf7
+	ld hl, wJumptableIndex
+	set 7, [hl]
+	ret
+
+.select
+	ld hl, wcf64
+	ld a, [hl]
+	xor 1
+	ld [hl], a
+	jr z, .asm_11a04
+	ld de, NameInputLower
+	call Function118ca
+	ret
+
+.asm_11a04
+	ld de, NameInputUpper
+	call Function118ca
+	ret
+
+Function11a0b: ; 11a0b (4:5a0b)
+	ld hl, wc6d5
+	ld c, [hl]
+	inc hl
+	ld b, [hl]
+
+Function11a11: ; 11a11 (4:5a11)
+	ld hl, $d
+	add hl, bc
+	ld a, [hl]
+	push bc
+	ld b, $4
+	call Function1189c
+	jr nz, .asm_11a1f
+	inc b
+.asm_11a1f
+	cp b
+	pop bc
+	jr nz, .asm_11a39
+	ld hl, $c
+	add hl, bc
+	ld a, [hl]
+	cp $3
+	jr c, .asm_11a33
+	cp $6
+	jr c, .asm_11a36
+	ld a, $3
+	ret
+.asm_11a33
+	ld a, $1
+	ret
+.asm_11a36
+	ld a, $2
+	ret
+.asm_11a39
+	xor a
+	ret
+
+Function11a3b: ; 11a3b (4:5a3b)
+	call Function11a8b
+	ld hl, $d
+	add hl, bc
+	ld a, [hl]
+	ld e, a
+	swap e
+	ld hl, $7
+	add hl, bc
+	ld [hl], e
+	ld d, $4
+	call Function1189c
+	jr nz, .asm_11a53
+	inc d
+.asm_11a53
+	cp d
+	ld de, Unknown_11a79
+	ld a, $0
+	jr nz, .asm_11a60
+	ld de, Unknown_11a82
+	ld a, $1
+.asm_11a60
+	ld hl, $e
+	add hl, bc
+	add [hl]
+	ld hl, $1
+	add hl, bc
+	ld [hl], a
+	ld hl, $c
+	add hl, bc
+	ld l, [hl]
+	ld h, $0
+	add hl, de
+	ld a, [hl]
+	ld hl, $6
+	add hl, bc
+	ld [hl], a
+	ret
+; 11a79 (4:5a79)
+
+Unknown_11a79: ; 11a79
+	db $00, $10, $20, $30, $40, $50, $60, $70, $80
+Unknown_11a82: ; 11a82
+	db $00, $00, $00, $30, $30, $30, $60, $60, $60
+; 11a8b
+
+Function11a8b: ; 11a8b (4:5a8b)
+	ld hl, hJoyLast
+	ld a, [hl]
+	and D_UP
+	jr nz, .up
+	ld a, [hl]
+	and D_DOWN
+	jr nz, .down
+	ld a, [hl]
+	and D_LEFT
+	jr nz, .left
+	ld a, [hl]
+	and D_RIGHT
+	jr nz, .right
+	ret
+.right
+	call Function11a11
+	and a
+	jr nz, .asm_11ab7
+	ld hl, $c
+	add hl, bc
+	ld a, [hl]
+	cp $8
+	jr nc, .asm_11ab4
+	inc [hl]
+	ret
+.asm_11ab4
+	ld [hl], $0
+	ret
+.asm_11ab7
+	cp $3
+	jr nz, .asm_11abc
+	xor a
+.asm_11abc
+	ld e, a
+	add a
+	add e
+	ld hl, $c
+	add hl, bc
+	ld [hl], a
+	ret
+.left
+	call Function11a11
+	and a
+	jr nz, .asm_11ad8
+	ld hl, $c
+	add hl, bc
+	ld a, [hl]
+	and a
+	jr z, .asm_11ad5
+	dec [hl]
+	ret
+.asm_11ad5
+	ld [hl], $8
+	ret
+.asm_11ad8
+	cp $1
+	jr nz, .asm_11ade
+	ld a, $4
+.asm_11ade
+rept 2
+	dec a
+endr
+	ld e, a
+	add a
+	add e
+	ld hl, $c
+	add hl, bc
+	ld [hl], a
+	ret
+.down
+	ld hl, $d
+	add hl, bc
+	ld a, [hl]
+	call Function1189c
+	jr nz, .asm_11af9
+	cp $5
+	jr nc, .asm_11aff
+	inc [hl]
+	ret
+.asm_11af9
+	cp $4
+	jr nc, .asm_11aff
+	inc [hl]
+	ret
+.asm_11aff
+	ld [hl], $0
+	ret
+.up
+	ld hl, $d
+	add hl, bc
+	ld a, [hl]
+	and a
+	jr z, .asm_11b0c
+	dec [hl]
+	ret
+.asm_11b0c
+	ld [hl], $4
+	call Function1189c
+	ret nz
+	inc [hl]
+	ret
+
+Function11b14: ; 11b14 (4:5b14)
+	ld a, [wc6d7]
+
+Function11b17: ; 11b17 (4:5b17)
+	ld a, [wc6d3]
+	ld c, a
+	ld a, [wc6d2]
+	cp c
+	ret nc
+
+	ld a, [wc6d7]
+
+Function11b23: ; 11b23
+	call Function11bd0
+	ld [hl], a
+
+Function11b27: ; 11b27
+	ld hl, wc6d2
+	inc [hl]
+	call Function11bd0
+	ld a, [hl]
+	cp $50
+	jr z, .asm_11b37
+	ld [hl], $f2
+	and a
+	ret
+.asm_11b37
+	scf
+	ret
+; 11b39 (4:5b39)
+
+Function11b39: ; 11b39
+	ld a, [wc6d2]
+	and a
+	ret z
+	push hl
+	ld hl, wc6d2
+	dec [hl]
+	call Function11bd0
+	ld c, [hl]
+	pop hl
+
+.asm_11b48
+	ld a, [hli]
+	cp $ff
+	jr z, Function11b27
+	cp c
+	jr z, .asm_11b53
+	inc hl
+	jr .asm_11b48
+
+.asm_11b53
+	ld a, [hl]
+	jr Function11b23
+; 11b56
+
+Dakutens: ; Dummied out
+	db "かが", "きぎ", "くぐ", "けげ", "こご"
+	db "さざ", "しじ", "すず", "せぜ", "そぞ"
+	db "ただ", "ちぢ", "つづ", "てで", "とど"
+	db "はば", "ひび", "ふぶ", "へべ", "ほぼ"
+	db "カガ", "キギ", "クグ", "ケゲ", "コゴ"
+	db "サザ", "シジ", "スズ", "セゼ", "ソゾ"
+	db "タダ", "チヂ", "ツヅ", "テデ", "トド"
+	db "ハバ", "ヒビ", "フブ", "へべ", "ホボ"
+	db $ff
+
+Handakutens: ; Dummied out
+	db "はぱ", "ひぴ", "ふぷ", "へぺ", "ほぽ"
+	db "ハパ", "ヒピ", "フプ", "へぺ", "ホポ"
+	db $ff
+; 11bbc
+
+Function11bbc: ; 11bbc (4:5bbc)
+	ld hl, wc6d2
+	ld a, [hl]
+	and a
+	ret z
+	dec [hl]
+	call Function11bd0
+	ld [hl], $f2
+	inc hl
+	ld a, [hl]
+	cp $f2
+	ret nz
+	ld [hl], $eb
+	ret
+
+Function11bd0: ; 11bd0 (4:5bd0)
+	push af
+	ld hl, wc6d0
+	ld a, [hli]
+	ld h, [hl]
+	ld l, a
+	ld a, [wc6d2]
+	ld e, a
+	ld d, 0
+	add hl, de
+	pop af
+	ret
+; 11be0
+
+Function11be0: ; 11be0
+; load $f2, ($eb * [wc6d3]), $50 into the dw address at wc6d0
+	ld hl, wc6d0
+	ld a, [hli]
+	ld h, [hl]
+	ld l, a
+	ld [hl], "·"
+	inc hl
+	ld a, [wc6d3]
+	dec a
+	ld c, a
+	ld a, "→"
+.loop
+	ld [hli], a
+	dec c
+	jr nz, .loop
+	ld [hl], "@"
+	ret
+; 11bf7
+
+
+Function11bf7: ; 11bf7 (4:5bf7)
+	ld hl, wc6d0
+	ld a, [hli]
+	ld h, [hl]
+	ld l, a
+	ld a, [wc6d3]
+	ld c, a
+.asm_11c01
+	ld a, [hl]
+	cp $eb
+	jr z, .asm_11c0a
+	cp $f2
+	jr nz, .asm_11c0c
+.asm_11c0a
+	ld [hl], $50
+.asm_11c0c
+	inc hl
+	dec c
+	jr nz, .asm_11c01
+	ret
+
+Function11c11: ; 11c11 (4:5c11)
+	ld hl, wc6d5
+	ld c, [hl]
+	inc hl
+	ld b, [hl]
+	ld hl, $6
+	add hl, bc
+	ld a, [hl]
+	ld hl, $4
+	add hl, bc
+	add [hl]
+	sub $8
+	srl a
+	srl a
+	srl a
+	ld e, a
+	ld hl, $7
+	add hl, bc
+	ld a, [hl]
+	ld hl, $5
+	add hl, bc
+	add [hl]
+	sub $10
+	srl a
+	srl a
+	srl a
+	ld d, a
+	hlcoord 0, 0
+	ld bc, $14
+.asm_11c43
+	ld a, d
+	and a
+	jr z, .asm_11c4b
+	add hl, bc
+	dec d
+	jr .asm_11c43
+.asm_11c4b
+	add hl, de
+	ld a, [hl]
+	ld [wc6d7], a
+	ret
+
+
+Function11c51: ; 11c51
+	call ClearSprites
+	callab Function8cf53
+	call LoadStandardFont
+	call LoadFontsExtra
+
+	ld de, GFX_11e65
+	ld hl, VTiles1 tile $6b
+	lb bc, BANK(GFX_11e65), 1
+	call Get1bpp
+
+	ld de, GFX_11e6d
+	ld hl, VTiles1 tile $72
+	lb bc, BANK(GFX_11e6d), 1
+	call Get1bpp
+
+	ld de, VTiles2 tile $60
+	ld hl, GFX_11cb7
+	ld bc, $10
+	ld a, BANK(GFX_11cb7)
+	call FarCopyBytes
+
+	ld de, VTiles0 tile $7e
+	ld hl, GFX_11cc7
+	ld bc, $20
+	ld a, BANK(GFX_11cc7)
+	call FarCopyBytes
+
+	ld a, $5
+	ld hl, wc312
+	ld [hli], a
+	ld [hl], $7e
+	xor a
+	ld [hSCY], a
+	ld [wc3bf], a
+	ld [hSCX], a
+	ld [wc3c0], a
+	ld [wJumptableIndex], a
+	ld [wcf64], a
+	ld [hBGMapMode], a
+	ld [wc6d2], a
+	ld a, $7
+	ld [hWX], a
+	ret
+; 11cb7
+
+GFX_11cb7: ; 11cb7
+INCBIN "gfx/unknown/011cb7.2bpp"
+; 11cc7
+
+GFX_11cc7: ; 11cc7
+INCBIN "gfx/unknown/011cc7.2bpp"
+; 11ce7
+
+NameInputLower:
+	db "a b c d e f g h i"
+	db "j k l m n o p q r"
+	db "s t u v w x y z  "
+	db "× ( ) : ; [ ] <PK> <MN>"
+	db "UPPER  DEL   END "
+BoxNameInputLower:
+	db "a b c d e f g h i"
+	db "j k l m n o p q r"
+	db "s t u v w x y z  "
+	db "é 'd 'l 'm 'r 's 't 'v 0"
+	db "1 2 3 4 5 6 7 8 9"
+	db "UPPER  DEL   END "
+NameInputUpper: ; Unreferenced?
+	db "A B C D E F G H I"
+	db "J K L M N O P Q R"
+	db "S T U V W X Y Z  "
+	db "- ? ! / . ,      "
+	db "lower  DEL   END "
+BoxNameInputUpper:
+	db "A B C D E F G H I"
+	db "J K L M N O P Q R"
+	db "S T U V W X Y Z  "
+	db "× ( ) : ; [ ] <PK> <MN>"
+	db "- ? ! ♂ ♀ / . , &"
+	db "lower  DEL   END "
+; 11e5d
+
+GFX_11e5d: ; ????
+INCBIN "gfx/unknown/011e5d.2bpp"
+; 11e6d
+
+GFX_11e65:
+INCBIN "gfx/unknown/011e65.2bpp"
+; 11e6d
+
+GFX_11e6d: ; 11e6d
+INCBIN "gfx/unknown/011e6d.2bpp"
+; 11e75
--- a/engine/save.asm
+++ b/engine/save.asm
@@ -1,5 +1,5 @@
 Function14a1a: ; 14a1a
-	call LoadPartyMenuDataHeader
+	call LoadStandardMenuDataHeader
 	callba Function5e9a
 	call SpeechTextBox
 	call UpdateSprites
--- a/engine/scripting.asm
+++ b/engine/scripting.asm
@@ -1560,8 +1560,8 @@
 	and $3f
 	cp $1
 	jr nz, .notblackedout ; 0x97466 $8
-	ld b, BANK(UnknownScript_0x124c1)
-	ld hl, UnknownScript_0x124c1
+	ld b, BANK(Script_BattleWhiteout)
+	ld hl, Script_BattleWhiteout
 	jp ScriptJump
 
 .notblackedout
@@ -2884,9 +2884,9 @@
 ;     map_id (MapIdParam)
 
 	call GetScriptByte
-	ld [wdcb2], a
+	ld [wLastSpawnMapGroup], a
 	call GetScriptByte
-	ld [wdcb3], a
+	ld [wLastSpawnMapNumber], a
 	ret
 ; 0x97a85
 
--- /dev/null
+++ b/engine/selectmenu.asm
@@ -1,0 +1,191 @@
+SelectMenu:: ; 13327
+
+	call CheckRegisteredItem
+	jr c, .NotRegistered
+	jp UseRegisteredItem
+
+.NotRegistered
+	call LoadFont
+	ld b, BANK(ItemMayBeRegisteredText)
+	ld hl, ItemMayBeRegisteredText
+	call MapTextbox
+	call CloseText
+	jp LoadMoveSprites
+; 13340
+
+
+ItemMayBeRegisteredText: ; 13340
+	text_jump UnknownText_0x1c1cf3
+	db "@"
+; 13345
+
+
+CheckRegisteredItem: ; 13345
+
+	ld a, [WhichRegisteredItem]
+	and a
+	jr z, .NoRegisteredItem
+	and REGISTERED_POCKET
+	rlca
+	rlca
+	ld hl, .Pockets
+	rst JumpTable
+	ret
+
+.Pockets
+	dw .CheckItem
+	dw .CheckBall
+	dw .CheckKeyItem
+	dw .CheckTMHM
+
+.CheckItem
+	ld hl, NumItems
+	call .CheckRegisteredNo
+	jr c, .NoRegisteredItem
+	inc hl
+	ld e, a
+	ld d, 0
+rept 2
+	add hl, de
+endr
+	call .IsSameItem
+	jr c, .NoRegisteredItem
+	and a
+	ret
+
+.CheckKeyItem
+	ld a, [RegisteredItem]
+	ld hl, KeyItems
+	ld de, 1
+	call IsInArray
+	jr nc, .NoRegisteredItem
+	ld a, [RegisteredItem]
+	ld [CurItem], a
+	and a
+	ret
+
+.CheckBall
+	ld hl, NumBalls
+	call .CheckRegisteredNo
+	jr nc, .NoRegisteredItem
+	inc hl
+	ld e, a
+	ld d, 0
+rept 2
+	add hl, de
+endr
+	call .IsSameItem
+	jr c, .NoRegisteredItem
+	ret
+
+.CheckTMHM
+	jr .NoRegisteredItem
+
+.NoRegisteredItem
+	xor a
+	ld [WhichRegisteredItem], a
+	ld [RegisteredItem], a
+	scf
+	ret
+; 133a6
+
+
+.CheckRegisteredNo ; 133a6
+	ld a, [WhichRegisteredItem]
+	and REGISTERED_NUMBER
+	dec a
+	cp [hl]
+	jr nc, .NotEnoughItems
+	ld [wd107], a
+	and a
+	ret
+
+.NotEnoughItems
+	scf
+	ret
+; 133b6
+
+
+.IsSameItem ; 133b6
+	ld a, [RegisteredItem]
+	cp [hl]
+	jr nz, .NotSameItem
+	ld [CurItem], a
+	and a
+	ret
+
+.NotSameItem
+	scf
+	ret
+; 133c3
+
+
+UseRegisteredItem: ; 133c3
+
+	callba CheckItemMenu
+	ld a, [wItemAttributeParamBuffer]
+	ld hl, .SwitchTo
+	rst JumpTable
+	ret
+
+.SwitchTo
+	dw .CantUse
+	dw .NoFunction
+	dw .NoFunction
+	dw .NoFunction
+	dw .Current
+	dw .Party
+	dw .Overworld
+; 133df
+
+.NoFunction ; 133df
+	call LoadFont
+	call CantUseItem
+	call LoadMoveSprites
+	and a
+	ret
+; 133ea
+
+.Current ; 133ea
+	call LoadFont
+	call DoItemEffect
+	call LoadMoveSprites
+	and a
+	ret
+; 133f5
+
+.Party ; 133f5
+	call ResetWindow
+	call FadeToMenu
+	call DoItemEffect
+	call Function2b3c
+	call LoadMoveSprites
+	and a
+	ret
+; 13406
+
+.Overworld ; 13406
+	call ResetWindow
+	ld a, 1
+	ld [wd0ef], a
+	call DoItemEffect
+	xor a
+	ld [wd0ef], a
+	ld a, [wd0ec]
+	cp 1
+	jr nz, ._cantuse
+	scf
+	ld a, HMENURETURN_SCRIPT
+	ld [hMenuReturn], a
+	ret
+; 13422
+
+.CantUse ; 13422
+	call ResetWindow
+
+._cantuse
+	call CantUseItem
+	call LoadMoveSprites
+	and a
+	ret
+; 1342d
--- a/engine/specials.asm
+++ b/engine/specials.asm
@@ -42,7 +42,7 @@
 ; Map Events
 	add_special BugContestJudging
 	add_special CheckPartyFullAfterContest
-	add_special CheckFirstMonFainted
+	add_special ContestDropOffMons
 	add_special ContestReturnMons
 	add_special Special_GiveParkBalls
 	add_special Special_CheckMagikarpLength
--- /dev/null
+++ b/engine/startmenu.asm
@@ -1,0 +1,1970 @@
+StartMenu:: ; 125cd
+
+	call ResetTextRelatedRAM
+
+	ld de, SFX_MENU
+	call PlaySFX
+
+	callba Function6454
+
+	ld hl, StatusFlags2
+	bit 2, [hl] ; bug catching contest
+	ld hl, .MenuDataHeader
+	jr z, .GotMenuData
+	ld hl, .ContestMenuDataHeader
+.GotMenuData
+
+	call LoadMenuDataHeader
+	call .SetUpMenuItems
+	ld a, [wd0d2]
+	ld [wMenuCursorBuffer], a
+	call .DrawMenuAccount_
+	call MenuFunc_1e7f
+	call .DrawBugContestStatusBox
+	call Function2e31
+	call Function2e20
+	callba Function64bf
+	call .DrawBugContestStatus
+	call UpdateTimePals
+	jr .Select
+
+.Reopen
+	call UpdateSprites
+	call UpdateTimePals
+	call .SetUpMenuItems
+	ld a, [wd0d2]
+	ld [wMenuCursorBuffer], a
+
+.Select
+	call .GetInput
+	jr c, .Exit
+	call .DrawMenuAccount
+	ld a, [wMenuCursorBuffer]
+	ld [wd0d2], a
+	call PlayClickSFX
+	call Function1bee
+	call .OpenMenu
+
+; Menu items have different return functions.
+; For example, saving exits the menu.
+	ld hl, .MenuReturns
+	ld e, a
+	ld d, 0
+rept 2
+	add hl, de
+endr
+	ld a, [hli]
+	ld h, [hl]
+	ld l, a
+	jp [hl]
+
+.MenuReturns
+	dw .Reopen
+	dw .Exit
+	dw .ExitMenuCallFuncLoadMoveSprites
+	dw .ExitMenuRunScriptLoadMoveSprites
+	dw .ExitMenuRunScript
+	dw .ReturnEnd
+	dw .ReturnRedraw
+
+.Exit
+	ld a, [hOAMUpdate]
+	push af
+	ld a, 1
+	ld [hOAMUpdate], a
+	call LoadFontsExtra
+	pop af
+	ld [hOAMUpdate], a
+.ReturnEnd
+	call ExitMenu
+.ReturnEnd2
+	call LoadMoveSprites
+	call UpdateTimePals
+	ret
+
+.GetInput
+; Return carry on exit, and no-carry on selection.
+	xor a
+	ld [hBGMapMode], a
+	call .DrawMenuAccount
+	call SetUpMenu
+	ld a, $ff
+	ld [MenuSelection], a
+.loop
+	call .PrintMenuAccount
+	call Function1f1a
+	ld a, [wcf73]
+	cp B_BUTTON
+	jr z, .b
+	cp A_BUTTON
+	jr z, .a
+	jr .loop
+.a
+	call PlayClickSFX
+	and a
+	ret
+.b
+	scf
+	ret
+; 12691
+
+.ExitMenuRunScript ; 12691
+	call ExitMenu
+	ld a, HMENURETURN_SCRIPT
+	ld [hMenuReturn], a
+	ret
+; 12699
+
+.ExitMenuRunScriptLoadMoveSprites ; 12699
+	call ExitMenu
+	ld a, HMENURETURN_SCRIPT
+	ld [hMenuReturn], a
+	jr .ReturnEnd2
+; 126a2
+
+.ExitMenuCallFuncLoadMoveSprites ; 126a2
+	call ExitMenu
+	ld hl, wQueuedScriptAddr
+	ld a, [hli]
+	ld h, [hl]
+	ld l, a
+	ld a, [wQueuedScriptBank]
+	rst FarCall
+	jr .ReturnEnd2
+; 126b1
+
+.ReturnRedraw ; 126b1
+	call .Clear
+	jp .Reopen
+; 126b7
+
+.Clear ; 126b7
+	call WhiteBGMap
+	call Call_ExitMenu
+	call Function2bae
+	call .DrawMenuAccount_
+	call MenuFunc_1e7f
+	call .DrawBugContestStatus
+	call UpdateSprites
+	call Functiond90
+	call Function2b5c
+	ret
+; 126d3
+
+
+.MenuDataHeader
+	db $40 ; tile backup
+	db 0, 10 ; start coords
+	db 17, 19 ; end coords
+	dw .MenuData
+	db 1 ; default selection
+
+.ContestMenuDataHeader
+	db $40 ; tile backup
+	db 2, 10 ; start coords
+	db 17, 19 ; end coords
+	dw .MenuData
+	db 1 ; default selection
+
+.MenuData
+	db %10101000 ; x padding, wrap around, start can close
+	dn 0, 0 ; rows, columns
+	dw MenuItemsList
+	dw .MenuString
+	dw .Items
+
+.Items
+	dw StartMenu_Pokedex,  .PokedexString,  .PokedexDesc
+	dw StartMenu_Pokemon,  .PartyString,    .PartyDesc
+	dw StartMenu_Pack,     .PackString,     .PackDesc
+	dw StartMenu_Status,   .StatusString,   .StatusDesc
+	dw StartMenu_Save,     .SaveString,     .SaveDesc
+	dw StartMenu_Option,   .OptionString,   .OptionDesc
+	dw StartMenu_Exit,     .ExitString,     .ExitDesc
+	dw StartMenu_Pokegear, .PokegearString, .PokegearDesc
+	dw StartMenu_Quit,     .QuitString,     .QuitDesc
+
+.PokedexString 	db "#DEX@"
+.PartyString   	db "#MON@"
+.PackString    	db "PACK@"
+.StatusString  	db "<PLAYER>@"
+.SaveString    	db "SAVE@"
+.OptionString  	db "OPTION@"
+.ExitString    	db "EXIT@"
+.PokegearString	db $24, "GEAR@"
+.QuitString    	db "QUIT@"
+
+.PokedexDesc  db   "#MON"
+              next "database@"
+
+.PartyDesc    db   "Party ", $4a
+              next "status@"
+
+.PackDesc     db   "Contains"
+              next "items@"
+
+.PokegearDesc db   "Trainer's"
+              next "key device@"
+
+.StatusDesc   db   "Your own"
+              next "status@"
+
+.SaveDesc     db   "Save your"
+              next "progress@"
+
+.OptionDesc   db   "Change"
+              next "settings@"
+
+.ExitDesc     db   "Close this"
+              next "menu@"
+
+.QuitDesc     db   "Quit and"
+              next "be judged.@"
+
+
+.OpenMenu ; 127e5
+	ld a, [MenuSelection]
+	call .GetMenuAccountTextPointer
+	ld a, [hli]
+	ld h, [hl]
+	ld l, a
+	jp [hl]
+; 127ef
+
+.MenuString ; 127ef
+	push de
+	ld a, [MenuSelection]
+	call .GetMenuAccountTextPointer
+rept 2
+	inc hl
+endr
+	ld a, [hli]
+	ld d, [hl]
+	ld e, a
+	pop hl
+	call PlaceString
+	ret
+; 12800
+
+.MenuDesc ; 12800
+	push de
+	ld a, [MenuSelection]
+	cp $ff
+	jr z, .none
+	call .GetMenuAccountTextPointer
+rept 4
+	inc hl
+endr
+	ld a, [hli]
+	ld d, [hl]
+	ld e, a
+	pop hl
+	call PlaceString
+	ret
+.none
+	pop de
+	ret
+; 12819
+
+
+.GetMenuAccountTextPointer ; 12819
+	ld e, a
+	ld d, 0
+	ld hl, wcf97
+	ld a, [hli]
+	ld h, [hl]
+	ld l, a
+rept 6
+	add hl, de
+endr
+	ret
+; 12829
+
+
+.SetUpMenuItems ; 12829
+	xor a
+	ld [wcf76], a
+	call .FillMenuList
+
+	ld hl, StatusFlags
+	bit 0, [hl]
+	jr z, .no_pokedex
+	ld a, 0 ; pokedex
+	call .AppendMenuList
+.no_pokedex
+
+	ld a, [PartyCount]
+	and a
+	jr z, .no_pokemon
+	ld a, 1 ; pokemon
+	call .AppendMenuList
+.no_pokemon
+
+	ld a, [wLinkMode]
+	and a
+	jr nz, .no_pack
+	ld hl, StatusFlags2
+	bit 2, [hl] ; bug catching contest
+	jr nz, .no_pack
+	ld a, 2 ; pack
+	call .AppendMenuList
+.no_pack
+
+	ld hl, wPokegearFlags
+	bit 7, [hl]
+	jr z, .no_pokegear
+	ld a, 7 ; pokegear
+	call .AppendMenuList
+.no_pokegear
+
+	ld a, 3 ; status
+	call .AppendMenuList
+
+	ld a, [wLinkMode]
+	and a
+	jr nz, .no_save
+	ld hl, StatusFlags2
+	bit 2, [hl] ; bug catching contest
+	ld a, 8 ; quit
+	jr nz, .write
+	ld a, 4 ; save
+.write
+	call .AppendMenuList
+.no_save
+
+	ld a, 5 ; option
+	call .AppendMenuList
+	ld a, 6 ; exit
+	call .AppendMenuList
+	ld a, c
+	ld [MenuItemsList], a
+	ret
+; 1288d
+
+
+.FillMenuList ; 1288d
+	xor a
+	ld hl, MenuItemsList
+	ld [hli], a
+	ld a, -1
+	ld bc, MenuItemsListEnd - (MenuItemsList + 1)
+	call ByteFill
+	ld de, MenuItemsList + 1
+	ld c, 0
+	ret
+; 128a0
+
+.AppendMenuList ; 128a0
+	ld [de], a
+	inc de
+	inc c
+	ret
+; 128a4
+
+.DrawMenuAccount_ ; 128a4
+	jp .DrawMenuAccount
+; 128a7
+
+.PrintMenuAccount ; 128a7
+	call .IsMenuAccountOn
+	ret z
+	call .DrawMenuAccount
+	decoord 0, 14
+	jp .MenuDesc
+; 128b4
+
+.DrawMenuAccount ; 128b4
+	call .IsMenuAccountOn
+	ret z
+	hlcoord 0, 13
+	lb bc, 5, 10
+	call ClearBox
+	hlcoord 0, 13
+	ld b, 3
+	ld c, 8
+	jp TextBoxPalette
+; 128cb
+
+.IsMenuAccountOn ; 128cb
+	ld a, [Options2]
+	and 1
+	ret
+; 128d1
+
+.DrawBugContestStatusBox ; 128d1
+	ld hl, StatusFlags2
+	bit 2, [hl] ; bug catching contest
+	ret z
+	callba Function24bdc
+	ret
+; 128de
+
+.DrawBugContestStatus ; 128de
+	ld hl, StatusFlags2
+	bit 2, [hl] ; bug catching contest
+	jr nz, .contest
+	ret
+.contest
+	callba Function24be7
+	ret
+; 128ed
+
+
+StartMenu_Exit: ; 128ed
+; Exit the menu.
+
+	ld a, 1
+	ret
+; 128f0
+
+
+StartMenu_Quit: ; 128f0
+; Retire from the bug catching contest.
+
+	ld hl, .EndTheContestText
+	call Function12cf5
+	jr c, .DontEndContest
+	ld a, BANK(BugCatchingContestReturnToGateScript)
+	ld hl, BugCatchingContestReturnToGateScript
+	call FarQueueScript
+	ld a, 4
+	ret
+
+.DontEndContest
+	ld a, 0
+	ret
+
+.EndTheContestText
+	text_jump UnknownText_0x1c1a6c
+	db "@"
+; 1290b
+
+
+StartMenu_Save: ; 1290b
+; Save the game.
+
+	call BufferScreen
+	callba Function14a1a
+	jr nc, .asm_12919
+	ld a, 0
+	ret
+.asm_12919
+	ld a, 1
+	ret
+; 1291c
+
+
+StartMenu_Option: ; 1291c
+; Game options.
+
+	call FadeToMenu
+	callba OptionsMenu
+	ld a, 6
+	ret
+; 12928
+
+
+StartMenu_Status: ; 12928
+; Player status.
+
+	call FadeToMenu
+	callba Function25105
+	call Function2b3c
+	ld a, 0
+	ret
+; 12937
+
+
+StartMenu_Pokedex: ; 12937
+
+	ld a, [PartyCount]
+	and a
+	jr z, .asm_12949
+
+	call FadeToMenu
+	callba Pokedex
+	call Function2b3c
+
+.asm_12949
+	ld a, 0
+	ret
+; 1294c
+
+
+StartMenu_Pokegear: ; 1294c
+
+	call FadeToMenu
+	callba Function90b8d
+	call Function2b3c
+	ld a, 0
+	ret
+; 1295b
+
+
+StartMenu_Pack: ; 1295b
+
+	call FadeToMenu
+	callba Pack
+	ld a, [wcf66]
+	and a
+	jr nz, .asm_12970
+	call Function2b3c
+	ld a, 0
+	ret
+.asm_12970
+	call Function2b4d
+	ld a, 4
+	ret
+; 12976
+
+
+StartMenu_Pokemon: ; 12976
+
+	ld a, [PartyCount]
+	and a
+	jr z, .return
+
+	call FadeToMenu
+
+.choosemenu
+	xor a
+	ld [PartyMenuActionText], a ; Choose a POKéMON.
+	call WhiteBGMap
+
+.menu
+	callba Function5004f
+	callba Function50405
+	callba Function503e0
+
+.menunoreload
+	callba WritePartyMenuTilemap
+	callba PrintPartyMenuText
+	call WaitBGMap
+	call SetPalettes ; load regular palettes?
+	call DelayFrame
+	callba PartyMenuSelect
+	jr c, .return ; if cancelled or pressed B
+
+	call PokemonActionSubmenu
+	cp 3
+	jr z, .menu
+	cp 0
+	jr z, .choosemenu
+	cp 1
+	jr z, .menunoreload
+	cp 2
+	jr z, .quit
+
+.return
+	call Function2b3c
+	ld a, 0
+	ret
+
+.quit
+	ld a, b
+	push af
+	call Function2b4d
+	pop af
+	ret
+; 129d5
+
+Function129d5: ; 129d5
+	ld a, [NumItems]
+	and a
+	ret nz
+	ld a, [NumKeyItems]
+	and a
+	ret nz
+	ld a, [NumBalls]
+	and a
+	ret nz
+	ld hl, TMsHMs
+	ld b, NUM_TMS + NUM_HMS
+.asm_129e9
+	ld a, [hli]
+	and a
+	jr nz, .asm_129f2
+	dec b
+	jr nz, .asm_129e9
+	scf
+	ret
+.asm_129f2
+	and a
+	ret
+
+Function129f4: ; 129f4
+	push de
+	call PartyMonItemName
+	callba _CheckTossableItem
+	ld a, [wItemAttributeParamBuffer]
+	and a
+	jr nz, .asm_12a3f
+	ld hl, UnknownText_0x12a45
+	call MenuTextBox
+	callba Function24fbf
+	push af
+	call WriteBackup
+	call ExitMenu
+	pop af
+	jr c, .asm_12a42
+	ld hl, UnknownText_0x12a4a
+	call MenuTextBox
+	call YesNoBox
+	push af
+	call ExitMenu
+	pop af
+	jr c, .asm_12a42
+	pop hl
+	ld a, [wd107]
+	call TossItem
+	call PartyMonItemName
+	ld hl, UnknownText_0x12a4f
+	call MenuTextBox
+	call ExitMenu
+	and a
+	ret
+.asm_12a3f
+	call Function12a54
+.asm_12a42
+	pop hl
+	scf
+	ret
+; 12a45 (4:6a45)
+
+UnknownText_0x12a45: ; 0x12a45
+	; Toss out how many @ (S)?
+	text_jump UnknownText_0x1c1a90
+	db "@"
+; 0x12a4a
+
+UnknownText_0x12a4a: ; 0x12a4a
+	; Throw away @ @ (S)?
+	text_jump UnknownText_0x1c1aad
+	db "@"
+; 0x12a4f
+
+UnknownText_0x12a4f: ; 0x12a4f
+	; Discarded @ (S).
+	text_jump UnknownText_0x1c1aca
+	db "@"
+; 0x12a54
+
+Function12a54: ; 12a54 (4:6a54)
+	ld hl, UnknownText_0x12a5b
+	call MenuTextBoxBackup
+	ret
+; 12a5b (4:6a5b)
+
+UnknownText_0x12a5b: ; 0x12a5b
+	; That's too impor- tant to toss out!
+	text_jump UnknownText_0x1c1adf
+	db "@"
+; 0x12a60
+
+CantUseItem: ; 12a60
+	ld hl, CantUseItemText
+	call Function2012
+	ret
+; 12a67
+
+CantUseItemText: ; 12a67
+	text_jump UnknownText_0x1c1b03
+	db "@"
+; 12a6c
+
+
+PartyMonItemName: ; 12a6c
+	ld a, [CurItem]
+	ld [wd265], a
+	call GetItemName
+	call CopyName1
+	ret
+; 12a79
+
+
+CancelPokemonAction: ; 12a79
+	callba Function50405
+	callba Function8ea71
+	ld a, 1
+	ret
+; 12a88
+
+
+PokemonActionSubmenu: ; 12a88
+	hlcoord 1, 15
+	lb bc, 2, 18
+	call ClearBox
+	callba MonSubmenu
+	call GetCurNick
+	ld a, [MenuSelection]
+	ld hl, .Actions
+	ld de, 3
+	call IsInArray
+	jr nc, .nothing
+
+	inc hl
+	ld a, [hli]
+	ld h, [hl]
+	ld l, a
+	jp [hl]
+
+.nothing
+	ld a, 0
+	ret
+
+.Actions
+	dbw MONMENU_CUT,        MonMenu_Cut ; Cut
+	dbw MONMENU_FLY,        MonMenu_Fly ; Fly
+	dbw MONMENU_SURF,       MonMenu_Surf ; Surf
+	dbw MONMENU_STRENGTH,   MonMenu_Strength ; Strength
+	dbw MONMENU_FLASH,      MonMenu_Flash ; Flash
+	dbw MONMENU_WHIRLPOOL,  MonMenu_Whirlpool ; Whirlpool
+	dbw MONMENU_DIG,        MonMenu_Dig ; Dig
+	dbw MONMENU_TELEPORT,   MonMenu_Teleport ; Teleport
+	dbw MONMENU_SOFTBOILED, MonMenu_Softboiled_MilkDrink ; Softboiled
+	dbw MONMENU_MILKDRINK,  MonMenu_Softboiled_MilkDrink ; MilkDrink
+	dbw MONMENU_HEADBUTT,   MonMenu_Headbutt ; Headbutt
+	dbw MONMENU_WATERFALL,  MonMenu_Waterfall ; Waterfall
+	dbw MONMENU_ROCKSMASH,  MonMenu_RockSmash ; RockSmash
+	dbw MONMENU_SWEETSCENT, MonMenu_SweetScent ; SweetScent
+	dbw MONMENU_STATS,      OpenPartyStats
+	dbw MONMENU_SWITCH,     SwitchPartyMons
+	dbw MONMENU_ITEM,       GiveTakePartyMonItem
+	dbw MONMENU_CANCEL,     CancelPokemonAction
+	dbw MONMENU_MOVE,       ManagePokemonMoves ; move
+	dbw MONMENU_MAIL,       MonMailAction ; mail
+; 12aec
+
+
+SwitchPartyMons: ; 12aec
+
+; Don't try if there's nothing to switch!
+	ld a, [PartyCount]
+	cp 2
+	jr c, .DontSwitch
+
+	ld a, [CurPartyMon]
+	inc a
+	ld [wd0e3], a
+
+	callba Function8ea8c
+	callba Function5042d
+
+	ld a, 4
+	ld [PartyMenuActionText], a
+	callba WritePartyMenuTilemap
+	callba PrintPartyMenuText
+
+	hlcoord 0, 1
+	ld bc, 20 * 2
+	ld a, [wd0e3]
+	dec a
+	call AddNTimes
+	ld [hl], "▷"
+	call WaitBGMap
+	call SetPalettes
+	call DelayFrame
+
+	callba PartyMenuSelect
+	bit 1, b
+	jr c, .DontSwitch
+
+	callba _SwitchPartyMons
+
+	xor a
+	ld [PartyMenuActionText], a
+
+	callba Function5004f
+	callba Function50405
+	callba Function503e0
+
+	ld a, 1
+	ret
+
+.DontSwitch
+	xor a
+	ld [PartyMenuActionText], a
+	call CancelPokemonAction
+	ret
+; 12b60
+
+
+GiveTakePartyMonItem: ; 12b60
+
+; Eggs can't hold items!
+	ld a, [CurPartySpecies]
+	cp EGG
+	jr z, .asm_12ba6
+
+	ld hl, GiveTakeItemMenuData
+	call LoadMenuDataHeader
+	call InterpretMenu2
+	call ExitMenu
+	jr c, .asm_12ba6
+
+	call GetCurNick
+	ld hl, StringBuffer1
+	ld de, wd050
+	ld bc, $b
+	call CopyBytes
+	ld a, [MenuSelection2]
+	cp 1
+	jr nz, .asm_12ba0
+
+	call LoadStandardMenuDataHeader
+	call ClearPalettes
+	call Function12ba9
+	call ClearPalettes
+	call LoadFontsBattleExtra
+	call ExitMenu
+	ld a, 0
+	ret
+
+.asm_12ba0
+	call TakePartyItem
+	ld a, 3
+	ret
+
+.asm_12ba6
+	ld a, 3
+	ret
+; 12ba9
+
+
+Function12ba9: ; 12ba9
+
+	callba Function106a5
+
+.loop
+	callba Function106be
+
+	ld a, [wcf66]
+	and a
+	jr z, .quit
+
+	ld a, [wcf65]
+	cp 2
+	jr z, .next
+
+	call CheckTossableItem
+	ld a, [wItemAttributeParamBuffer]
+	and a
+	jr nz, .next
+
+	call Function12bd9
+	jr .quit
+
+.next
+	ld hl, CantBeHeldText
+	call MenuTextBoxBackup
+	jr .loop
+
+.quit
+	ret
+; 12bd9
+
+
+Function12bd9: ; 12bd9
+
+	call SpeechTextBox
+	call PartyMonItemName
+	call GetPartyItemLocation
+	ld a, [hl]
+	and a
+	jr z, .asm_12bf4
+
+	push hl
+	ld d, a
+	callba ItemIsMail
+	pop hl
+	jr c, .asm_12c01
+	ld a, [hl]
+	jr .asm_12c08
+
+.asm_12bf4
+	call Function12cea
+	ld hl, MadeHoldText
+	call MenuTextBoxBackup
+	call GivePartyItem
+	ret
+
+.asm_12c01
+	ld hl, PleaseRemoveMailText
+	call MenuTextBoxBackup
+	ret
+
+.asm_12c08
+	ld [wd265], a
+	call GetItemName
+	ld hl, SwitchAlreadyHoldingText
+	call Function12cf5
+	jr c, .asm_12c4b
+
+	call Function12cea
+	ld a, [wd265]
+	push af
+	ld a, [CurItem]
+	ld [wd265], a
+	pop af
+	ld [CurItem], a
+	call Function12cdf
+	jr nc, .asm_12c3c
+
+	ld hl, TookAndMadeHoldText
+	call MenuTextBoxBackup
+	ld a, [wd265]
+	ld [CurItem], a
+	call GivePartyItem
+	ret
+
+.asm_12c3c
+	ld a, [wd265]
+	ld [CurItem], a
+	call Function12cdf
+	ld hl, ItemStorageIsFullText
+	call MenuTextBoxBackup
+
+.asm_12c4b
+	ret
+; 12c4c
+
+
+GivePartyItem: ; 12c4c
+
+	call GetPartyItemLocation
+	ld a, [CurItem]
+	ld [hl], a
+	ld d, a
+	callba ItemIsMail
+	jr nc, .asm_12c5f
+	call Function12cfe
+
+.asm_12c5f
+	ret
+; 12c60
+
+
+TakePartyItem: ; 12c60
+
+	call SpeechTextBox
+	call GetPartyItemLocation
+	ld a, [hl]
+	and a
+	jr z, .asm_12c8c
+
+	ld [CurItem], a
+	call Function12cdf
+	jr nc, .asm_12c94
+
+	callba ItemIsMail
+	call GetPartyItemLocation
+	ld a, [hl]
+	ld [wd265], a
+	ld [hl], NO_ITEM
+	call GetItemName
+	ld hl, TookFromText
+	call MenuTextBoxBackup
+	jr .asm_12c9a
+
+.asm_12c8c
+	ld hl, IsntHoldingAnythingText
+	call MenuTextBoxBackup
+	jr .asm_12c9a
+
+.asm_12c94
+	ld hl, ItemStorageIsFullText
+	call MenuTextBoxBackup
+
+.asm_12c9a
+	ret
+; 12c9b
+
+
+GiveTakeItemMenuData: ; 12c9b
+	db %01010000
+	db 12, 12 ; start coords
+	db 17, 19 ; end coords
+	dw .Items
+	db 1 ; default option
+
+.Items
+	db %10000000 ; x padding
+	db 2 ; # items
+	db "GIVE@"
+	db "TAKE@"
+; 12caf
+
+
+TookAndMadeHoldText: ; 12caf
+	text_jump UnknownText_0x1c1b2c
+	db "@"
+; 12cb4
+
+MadeHoldText: ; 12cb4
+	text_jump UnknownText_0x1c1b57
+	db "@"
+; 12cb9
+
+PleaseRemoveMailText: ; 12cb9
+	text_jump UnknownText_0x1c1b6f
+	db "@"
+; 12cbe
+
+IsntHoldingAnythingText: ; 12cbe
+	text_jump UnknownText_0x1c1b8e
+	db "@"
+; 12cc3
+
+ItemStorageIsFullText: ; 12cc3
+	text_jump UnknownText_0x1c1baa
+	db "@"
+; 12cc8
+
+TookFromText: ; 12cc8
+	text_jump UnknownText_0x1c1bc4
+	db "@"
+; 12ccd
+
+SwitchAlreadyHoldingText: ; 12ccd
+	text_jump UnknownText_0x1c1bdc
+	db "@"
+; 12cd2
+
+CantBeHeldText: ; 12cd2
+	text_jump UnknownText_0x1c1c09
+	db "@"
+; 12cd7
+
+
+GetPartyItemLocation: ; 12cd7
+	push af
+	ld a, MON_ITEM
+	call GetPartyParamLocation
+	pop af
+	ret
+; 12cdf
+
+
+Function12cdf: ; 12cdf
+	ld a, $1
+	ld [wItemQuantityChangeBuffer], a
+	ld hl, NumItems
+	jp ReceiveItem
+; 12cea
+
+
+Function12cea: ; 12cea (4:6cea)
+	ld a, $1
+	ld [wItemQuantityChangeBuffer], a
+	ld hl, NumItems
+	jp TossItem
+
+Function12cf5: ; 12cf5
+	call MenuTextBox
+	call YesNoBox
+	jp ExitMenu
+; 12cfe
+
+
+Function12cfe: ; 12cfe (4:6cfe)
+	ld de, wd002
+	callba Function11e75
+	ld hl, PlayerName
+	ld de, wd023
+	ld bc, $a
+	call CopyBytes
+	ld hl, PlayerID
+	ld bc, $2
+	call CopyBytes
+	ld a, [CurPartySpecies]
+	ld [de], a
+	inc de
+	ld a, [CurItem]
+	ld [de], a
+	ld a, [CurPartyMon]
+	ld hl, sPartyScratch1
+	ld bc, SCRATCHMON_STRUCT_LENGTH
+	call AddNTimes
+	ld d, h
+	ld e, l
+	ld hl, wd002
+	ld bc, SCRATCHMON_STRUCT_LENGTH
+	ld a, BANK(sPartyScratch1)
+	call GetSRAMBank
+	call CopyBytes
+	call CloseSRAM
+	ret
+
+MonMailAction: ; 12d45
+; If in the time capsule or trade center,
+; selecting the mail only allows you to
+; read the mail.
+	ld a, [wLinkMode]
+	cp LINK_TIMECAPSULE
+	jr z, .read
+	cp LINK_TRADECENTER
+	jr z, .read
+
+; Show the READ/TAKE/QUIT menu.
+	ld hl, .MenuDataHeader
+	call LoadMenuDataHeader
+	call InterpretMenu2
+	call ExitMenu
+
+; Interpret the menu.
+	jp c, .done
+	ld a, [MenuSelection2]
+	cp $1
+	jr z, .read
+	cp $2
+	jr z, .take
+	jp .done
+
+.read
+	callba ReadPartyMonMail
+	ld a, $0
+	ret
+
+.take
+	ld hl, .sendmailtopctext
+	call Function12cf5
+	jr c, .RemoveMailToBag
+	ld a, [CurPartyMon]
+	ld b, a
+	callba Function4456e
+	jr c, .MailboxFull
+	ld hl, .sentmailtopctext
+	call MenuTextBoxBackup
+	jr .done
+
+.MailboxFull
+	ld hl, .mailboxfulltext
+	call MenuTextBoxBackup
+	jr .done
+
+.RemoveMailToBag
+	ld hl, .mailwilllosemessagetext
+	call Function12cf5
+	jr c, .done
+	call GetPartyItemLocation
+	ld a, [hl]
+	ld [CurItem], a
+	call Function12cdf
+	jr nc, .BagIsFull
+	call GetPartyItemLocation
+	ld [hl], $0
+	call GetCurNick
+	ld hl, .tookmailfrommontext
+	call MenuTextBoxBackup
+	jr .done
+
+.BagIsFull
+	ld hl, .bagfulltext
+	call MenuTextBoxBackup
+	jr .done
+
+.done
+	ld a, $3
+	ret
+; 12dc9
+
+
+.MenuDataHeader: ; 0x12dc9
+	db $40 ; flags
+	db 10, 12 ; start coords
+	db 17, 19 ; end coords
+	dw .MenuData2
+	db 1 ; default option
+; 0x12dd1
+
+.MenuData2: ; 0x12dd1
+	db $80 ; flags
+	db 3 ; items
+	db "READ@"
+	db "TAKE@"
+	db "QUIT@"
+; 0x12de2
+
+
+.mailwilllosemessagetext: ; 0x12de2
+; The MAIL will lose its message. OK?
+	text_jump UnknownText_0x1c1c22
+	db "@"
+; 0x12de7
+
+.tookmailfrommontext: ; 0x12de7
+; MAIL detached from <POKEMON>.
+	text_jump UnknownText_0x1c1c47
+	db "@"
+; 0x12dec
+
+.bagfulltext: ; 0x12dec
+; There's no space for removing MAIL.
+	text_jump UnknownText_0x1c1c62
+	db "@"
+; 0x12df1
+
+.sendmailtopctext: ; 0x12df1
+; Send the removed MAIL to your PC?
+	text_jump UnknownText_0x1c1c86
+	db "@"
+; 0x12df6
+
+.mailboxfulltext: ; 0x12df6
+; Your PC's MAILBOX is full.
+	text_jump UnknownText_0x1c1ca9
+	db "@"
+; 0x12dfb
+
+.sentmailtopctext: ; 0x12dfb
+; The MAIL was sent to your PC.
+	text_jump UnknownText_0x1c1cc4
+	db "@"
+; 0x12e00
+
+
+OpenPartyStats: ; 12e00
+	call LoadStandardMenuDataHeader
+	call ClearSprites
+; PartyMon
+	xor a
+	ld [MonType], a
+	call LowVolume
+	predef StatsScreenInit
+	call MaxVolume
+	call Call_ExitMenu
+	ld a, 0
+	ret
+; 12e1b
+
+
+MonMenu_Cut: ; 12e1b
+	callba CutFunction
+	ld a, [wd0ec]
+	cp $1
+	jr nz, .asm_12e2d
+	ld b, $4
+	ld a, $2
+	ret
+
+.asm_12e2d
+	ld a, $3
+	ret
+; 12e30
+
+
+MonMenu_Fly: ; 12e30
+	callba FlyFunction
+	ld a, [wd0ec]
+	cp $2
+	jr z, .asm_12e4c
+	cp $0
+	jr z, .asm_12e4f
+	callba MobileFn_1060b5
+	ld b, $4
+	ld a, $2
+	ret
+
+.asm_12e4c
+	ld a, $3
+	ret
+
+.asm_12e4f
+	ld a, $0
+	ret
+
+.asm_12e52
+	ld a, $1
+	ret
+; 12e55
+
+MonMenu_Flash: ; 12e55
+	callba Functionc8ac
+	ld a, [wd0ec]
+	cp $1
+	jr nz, .asm_12e67
+	ld b, $4
+	ld a, $2
+	ret
+
+.asm_12e67
+	ld a, $3
+	ret
+; 12e6a
+
+MonMenu_Strength: ; 12e6a
+	callba StrengthFunction
+	ld a, [wd0ec]
+	cp $1
+	jr nz, .asm_12e7c
+	ld b, $4
+	ld a, $2
+	ret
+
+.asm_12e7c
+	ld a, $3
+	ret
+; 12e7f
+
+MonMenu_Whirlpool: ; 12e7f
+	callba WhirlpoolFunction
+	ld a, [wd0ec]
+	cp $1
+	jr nz, .asm_12e91
+	ld b, $4
+	ld a, $2
+	ret
+
+.asm_12e91
+	ld a, $3
+	ret
+; 12e94
+
+MonMenu_Waterfall: ; 12e94
+	callba Functioncade
+	ld a, [wd0ec]
+	cp $1
+	jr nz, .asm_12ea6
+	ld b, $4
+	ld a, $2
+	ret
+
+.asm_12ea6
+	ld a, $3
+	ret
+; 12ea9
+
+MonMenu_Teleport: ; 12ea9
+	callba TeleportFunction
+	ld a, [wd0ec]
+	and a
+	jr z, .asm_12eba
+	ld b, $4
+	ld a, $2
+	ret
+
+.asm_12eba
+	ld a, $3
+	ret
+; 12ebd
+
+MonMenu_Surf: ; 12ebd
+	callba SurfFunction
+	ld a, [wd0ec]
+	and a
+	jr z, .asm_12ece
+	ld b, $4
+	ld a, $2
+	ret
+
+.asm_12ece
+	ld a, $3
+	ret
+; 12ed1
+
+MonMenu_Dig: ; 12ed1
+	callba DigFunction
+	ld a, [wd0ec]
+	cp $1
+	jr nz, .asm_12ee3
+	ld b, $4
+	ld a, $2
+	ret
+
+.asm_12ee3
+	ld a, $3
+	ret
+; 12ee6
+
+MonMenu_Softboiled_MilkDrink: ; 12ee6
+	call Function12f05
+	jr nc, .asm_12ef3
+	callba Functionf3df
+	jr .asm_12ef9
+
+.asm_12ef3
+	ld hl, UnknownText_0x12f00
+	call PrintText
+
+.asm_12ef9
+	xor a
+	ld [PartyMenuActionText], a
+	ld a, $3
+	ret
+; 12f00
+
+UnknownText_0x12f00: ; 0x12f00
+	; Not enough HP!
+	text_jump UnknownText_0x1c1ce3
+	db "@"
+; 0x12f05
+
+Function12f05: ; 12f05
+	ld a, MON_MAXHP
+	call GetPartyParamLocation
+	ld a, [hli]
+	ld [hDividend + 0], a
+	ld a, [hl]
+	ld [hDividend + 1], a
+	ld a, $5
+	ld [hDivisor], a
+	ld b, $2
+	call Divide
+	ld a, MON_HP + 1
+	call GetPartyParamLocation
+	ld a, [hQuotient + 2]
+	sub [hl]
+	dec hl
+	ld a, [hQuotient + 1]
+	sbc [hl]
+	ret
+; 12f26
+
+MonMenu_Headbutt: ; 12f26
+	callba HeadbuttFunction
+	ld a, [wd0ec]
+	cp $1
+	jr nz, .asm_12f38
+	ld b, $4
+	ld a, $2
+	ret
+
+.asm_12f38
+	ld a, $3
+	ret
+; 12f3b
+
+MonMenu_RockSmash: ; 12f3b
+	callba RockSmashFunction
+	ld a, [wd0ec]
+	cp $1
+	jr nz, .asm_12f4d
+	ld b, $4
+	ld a, $2
+	ret
+
+.asm_12f4d
+	ld a, $3
+	ret
+; 12f50
+
+MonMenu_SweetScent: ; 12f50
+	callba DoMovementFunctionc
+	ld b, $4
+	ld a, $2
+	ret
+; 12f5b
+
+Function12f5b: ; 12f5b
+	ld hl, Options
+	ld a, [hl]
+	push af
+	set NO_TEXT_SCROLL, [hl]
+	call LoadFontsBattleExtra
+	call Function12f73
+	pop bc
+	ld a, b
+	ld [Options], a
+	push af
+	call WhiteBGMap
+	pop af
+	ret
+; 12f73
+
+Function12f73: ; 12f73
+	call SetUpMoveScreenBG
+	ld de, Unknown_12fb2
+	call Function1bb1
+	call Function131ef
+	ld hl, wcfa5
+	set 6, [hl]
+	jr Function12f93
+
+Function12f86: ; 12f86
+	call Function1bd3
+	bit 1, a
+	jp nz, Function12f9f
+	bit 0, a
+	jp nz, Function12f9c
+
+Function12f93: ; 12f93
+	call PrepareToPlaceMoveData
+	call PlaceMoveData
+	jp Function12f86
+; 12f9c
+
+Function12f9c: ; 12f9c
+	and a
+	jr Function12fa0
+
+Function12f9f: ; 12f9f
+	scf
+
+Function12fa0: ; 12fa0
+	push af
+	xor a
+	ld [wd0e3], a
+	ld hl, wcfa5
+	res 6, [hl]
+	call ClearSprites
+	call ClearTileMap
+	pop af
+	ret
+; 12fb2
+
+Unknown_12fb2: ; 12fb2
+	db $03, $01, $03, $01, $40, $00, $20, $c3
+; 12fba
+
+ManagePokemonMoves: ; 12fba
+	ld a, [CurPartySpecies]
+	cp EGG
+	jr z, .egg
+	ld hl, Options
+	ld a, [hl]
+	push af
+	set NO_TEXT_SCROLL, [hl]
+	call MoveScreenLoop
+	pop af
+	ld [Options], a
+	call WhiteBGMap
+
+.egg
+	ld a, $0
+	ret
+; 12fd5
+
+MoveScreenLoop: ; 12fd5
+	ld a, [CurPartyMon]
+	inc a
+	ld [wd0d8], a
+	call SetUpMoveScreenBG
+	call Function132d3
+	ld de, Unknown_13163
+	call Function1bb1
+.loop
+	call Function131ef
+	ld hl, wcfa5
+	set 6, [hl]
+	jr .skip_joy
+
+.joy_loop
+	call Function1bd3
+	bit 1, a
+	jp nz, .b_button
+	bit 0, a
+	jp nz, .a_button
+	bit 4, a
+	jp nz, .d_right
+	bit 5, a
+	jp nz, .d_left
+
+.skip_joy
+	call PrepareToPlaceMoveData
+	ld a, [wMoveSwapBuffer]
+	and a
+	jr nz, .moving_move
+	call PlaceMoveData
+	jp .joy_loop
+
+.moving_move
+	ld a, " "
+	hlcoord 1, 11
+	ld bc, 5
+	call ByteFill
+	hlcoord 1, 12
+	lb bc, 5, SCREEN_WIDTH - 2
+	call ClearBox
+	hlcoord 1, 12
+	ld de, String_1316b
+	call PlaceString
+	jp .joy_loop
+.b_button: ; 13038
+	call PlayClickSFX
+	call WaitSFX
+	ld a, [wMoveSwapBuffer]
+	and a
+	jp z, .exit
+
+	ld a, [wMoveSwapBuffer]
+	ld [MenuSelection2], a
+	xor a
+	ld [wMoveSwapBuffer], a
+	hlcoord 1, 2
+	lb bc, 8, SCREEN_WIDTH - 2
+	call ClearBox
+	jp .loop
+; 1305b
+
+.d_right: ; 1305b
+	ld a, [wMoveSwapBuffer]
+	and a
+	jp nz, .joy_loop
+
+	ld a, [CurPartyMon]
+	ld b, a
+	push bc
+	call .cycle_right
+	pop bc
+	ld a, [CurPartyMon]
+	cp b
+	jp z, .joy_loop
+	jp MoveScreenLoop
+
+.d_left: ; 13075
+	ld a, [wMoveSwapBuffer]
+	and a
+	jp nz, .joy_loop
+	ld a, [CurPartyMon]
+	ld b, a
+	push bc
+	call .cycle_left
+	pop bc
+	ld a, [CurPartyMon]
+	cp b
+	jp z, .joy_loop
+	jp MoveScreenLoop
+
+.cycle_right
+	ld a, [CurPartyMon]
+	inc a
+	ld [CurPartyMon], a
+	ld c, a
+	ld b, 0
+	ld hl, PartySpecies
+	add hl, bc
+	ld a, [hl]
+	cp -1
+	jr z, .cycle_left
+	cp EGG
+	ret nz
+	jr .cycle_right
+
+.cycle_left
+	ld a, [CurPartyMon]
+	and a
+	ret z
+.cycle_left_loop
+	ld a, [CurPartyMon]
+	dec a
+	ld [CurPartyMon], a
+	ld c, a
+	ld b, 0
+	ld hl, PartySpecies
+	add hl, bc
+	ld a, [hl]
+	cp EGG
+	ret nz
+	ld a, [CurPartyMon]
+	and a
+	jr z, .cycle_right
+	jr .cycle_left_loop
+; 130c6
+
+.a_button: ; 130c6
+	call PlayClickSFX
+	call WaitSFX
+	ld a, [wMoveSwapBuffer]
+	and a
+	jr nz, .place_move
+	ld a, [MenuSelection2]
+	ld [wMoveSwapBuffer], a
+	call Function1bee
+	jp .moving_move
+
+.place_move
+	ld hl, PartyMon1Moves
+	ld bc, PARTYMON_STRUCT_LENGTH
+	ld a, [CurPartyMon]
+	call AddNTimes
+	push hl
+	call .copy_move
+	pop hl
+	ld bc, $15
+	add hl, bc
+	call .copy_move
+	ld a, [wBattleMode]
+	jr z, .swap_moves
+	ld hl, BattleMonMoves
+	ld bc, $20
+	ld a, [CurPartyMon]
+	call AddNTimes
+	push hl
+	call .copy_move
+	pop hl
+	ld bc, 6
+	add hl, bc
+	call .copy_move
+
+.swap_moves
+	ld de, SFX_SWITCH_POKEMON
+	call PlaySFX
+	call WaitSFX
+	ld de, SFX_SWITCH_POKEMON
+	call PlaySFX
+	call WaitSFX
+	hlcoord 1, 2
+	lb bc, 8, 18
+	call ClearBox
+	hlcoord 10, 10
+	lb bc, 1, 9
+	call ClearBox
+	jp .loop
+; 1313a
+
+.copy_move: ; 1313a
+	push hl
+	ld a, [MenuSelection2]
+	dec a
+	ld c, a
+	ld b, $0
+	add hl, bc
+	ld d, h
+	ld e, l
+	pop hl
+	ld a, [wMoveSwapBuffer]
+	dec a
+	ld c, a
+	ld b, $0
+	add hl, bc
+	ld a, [de]
+	ld b, [hl]
+	ld [hl], a
+	ld a, b
+	ld [de], a
+	ret
+; 13154
+
+.exit: ; 13154
+	xor a
+	ld [wMoveSwapBuffer], a
+	ld hl, wcfa5
+	res 6, [hl]
+	call ClearSprites
+	jp ClearTileMap
+; 13163
+
+Unknown_13163: ; 13163
+	db $03, $01, $03, $01, $40, $00, $20, $f3
+; 1316b
+
+String_1316b: ; 1316b
+	db "Where?@"
+; 13172
+
+SetUpMoveScreenBG: ; 13172
+	call WhiteBGMap
+	call ClearTileMap
+	call ClearSprites
+	xor a
+	ld [hBGMapMode], a
+	callba Functionfb571
+	callba InefficientlyClear121BytesAtwc300
+	ld a, [CurPartyMon]
+	ld e, a
+	ld d, $0
+	ld hl, PartySpecies
+	add hl, de
+	ld a, [hl]
+	ld [wd265], a
+	ld e, $2
+	callba Function8e83f
+	hlcoord 0, 1
+	ld b, 9
+	ld c, 18
+	call TextBox
+	hlcoord 0, 11
+	ld b, 5
+	ld c, 18
+	call TextBox
+	hlcoord 2, 0
+	lb bc, 2, 3
+	call ClearBox
+	xor a
+	ld [MonType], a
+	ld hl, PartyMonNicknames
+	ld a, [CurPartyMon]
+	call GetNick
+	hlcoord 5, 1
+	call PlaceString
+	push bc
+	callba CopyPkmnToTempMon
+	pop hl
+	call PrintLevel
+	ld hl, PlayerHPPal
+	call SetHPPal
+	ld b, $e
+	call GetSGBLayout
+	hlcoord 16, 0
+	lb bc, 1, 3
+	jp ClearBox
+; 131ef
+
+Function131ef: ; 131ef
+	xor a
+	ld [hBGMapMode], a
+	ld [wMoveSwapBuffer], a
+	ld [MonType], a
+	predef CopyPkmnToTempMon
+	ld hl, TempMonMoves
+	ld de, wListMoves_MoveIndicesBuffer
+	ld bc, NUM_MOVES
+	call CopyBytes
+	ld a, SCREEN_WIDTH * 2
+	ld [Buffer1], a
+	hlcoord 2, 3
+	predef ListMoves
+	hlcoord 10, 4
+	predef Function50c50
+	call WaitBGMap
+	call SetPalettes
+	ld a, [wd0eb]
+	inc a
+	ld [wcfa3], a
+	hlcoord 0, 11
+	ld b, 5
+	ld c, 18
+	jp TextBox
+; 13235
+
+PrepareToPlaceMoveData: ; 13235
+	ld hl, PartyMon1Moves
+	ld bc, PARTYMON_STRUCT_LENGTH
+	ld a, [CurPartyMon]
+	call AddNTimes
+	ld a, [MenuSelection2]
+	dec a
+	ld c, a
+	ld b, $0
+	add hl, bc
+	ld a, [hl]
+	ld [CurMove], a
+	hlcoord 1, 12
+	lb bc, 5, 18
+	jp ClearBox
+; 13256
+
+PlaceMoveData: ; 13256
+	xor a
+	ld [hBGMapMode], a
+	hlcoord 0, 10
+	ld de, String_132ba
+	call PlaceString
+	hlcoord 0, 11
+	ld de, String_132c2
+	call PlaceString
+	hlcoord 12, 12
+	ld de, String_132ca
+	call PlaceString
+	ld a, [CurMove]
+	ld b, a
+	hlcoord 2, 12
+	predef PrintMoveType
+	ld a, [CurMove]
+	dec a
+	ld hl, Moves + MOVE_POWER
+	ld bc, MOVE_LENGTH
+	call AddNTimes
+	ld a, BANK(Moves)
+	call GetFarByte
+	hlcoord 16, 12
+	cp 2
+	jr c, .no_power
+	ld [wd265], a
+	ld de, wd265
+	lb bc, 1, 3
+	call PrintNum
+	jr .description
+
+.no_power
+	ld de, String_132cf
+	call PlaceString
+
+.description
+	hlcoord 1, 14
+	predef PrintMoveDesc
+	ld a, $1
+	ld [hBGMapMode], a
+	ret
+; 132ba
+
+String_132ba: ; 132ba
+	db "┌─────┐@"
+; 132c2
+String_132c2: ; 132c2
+	db "│TYPE/└@"
+; 132ca
+String_132ca: ; 132ca
+	db "ATK/@"
+; 132cf
+String_132cf: ; 132cf
+	db "---@"
+; 132d3
+
+Function132d3: ; 132d3
+	call Function132da
+	call Function132fe
+	ret
+; 132da
+
+Function132da: ; 132da
+	ld a, [CurPartyMon]
+	and a
+	ret z
+	ld c, a
+	ld e, a
+	ld d, 0
+	ld hl, PartyCount
+	add hl, de
+.loop
+	ld a, [hl]
+	and a
+	jr z, .prev
+	cp EGG
+	jr z, .prev
+	cp NUM_POKEMON + 1
+	jr c, .legal
+
+.prev
+	dec hl
+	dec c
+	jr nz, .loop
+	ret
+
+.legal
+	hlcoord 16, 0
+	ld [hl], "◀"
+	ret
+; 132fe
+
+Function132fe: ; 132fe
+	ld a, [CurPartyMon]
+	inc a
+	ld c, a
+	ld a, [PartyCount]
+	cp c
+	ret z
+	ld e, c
+	ld d, 0
+	ld hl, PartySpecies
+	add hl, de
+.loop
+	ld a, [hl]
+	cp -1
+	ret z
+	and a
+	jr z, .next
+	cp EGG
+	jr z, .next
+	cp NUM_POKEMON + 1
+	jr c, .legal
+
+.next
+	inc hl
+	jr .loop
+
+.legal
+	hlcoord 18, 0
+	ld [hl], "▶"
+	ret
+; 13327
--- /dev/null
+++ b/engine/tmhm.asm
@@ -1,0 +1,113 @@
+CanLearnTMHMMove: ; 11639
+	ld a, [CurPartySpecies]
+	ld [CurSpecies], a
+	call GetBaseData
+	ld hl, BaseTMHM
+	push hl
+
+	ld a, [wd262]
+	ld b, a
+	ld c, 0
+	ld hl, TMHMMoves
+.loop
+	ld a, [hli]
+	and a
+	jr z, .end
+	cp b
+	jr z, .asm_11659
+	inc c
+	jr .loop
+
+.asm_11659
+	pop hl
+	ld b, CHECK_FLAG
+	push de
+	ld d, 0
+	predef FlagPredef
+	pop de
+	ret
+
+.end
+	pop hl
+	ld c, 0
+	ret
+; 1166a
+
+GetTMHMMove: ; 1166a
+	ld a, [wd265]
+	dec a
+	ld hl, TMHMMoves
+	ld b, 0
+	ld c, a
+	add hl, bc
+	ld a, [hl]
+	ld [wd265], a
+	ret
+; 1167a
+
+TMHMMoves: ; 1167a
+	db DYNAMICPUNCH
+	db HEADBUTT
+	db CURSE
+	db ROLLOUT
+	db ROAR
+	db TOXIC
+	db ZAP_CANNON
+	db ROCK_SMASH
+	db PSYCH_UP
+	db HIDDEN_POWER
+	db SUNNY_DAY
+	db SWEET_SCENT
+	db SNORE
+	db BLIZZARD
+	db HYPER_BEAM
+	db ICY_WIND
+	db PROTECT
+	db RAIN_DANCE
+	db GIGA_DRAIN
+	db ENDURE
+	db FRUSTRATION
+	db SOLARBEAM
+	db IRON_TAIL
+	db DRAGONBREATH
+	db THUNDER
+	db EARTHQUAKE
+	db RETURN
+	db DIG
+	db PSYCHIC_M
+	db SHADOW_BALL
+	db MUD_SLAP
+	db DOUBLE_TEAM
+	db ICE_PUNCH
+	db SWAGGER
+	db SLEEP_TALK
+	db SLUDGE_BOMB
+	db SANDSTORM
+	db FIRE_BLAST
+	db SWIFT
+	db DEFENSE_CURL
+	db THUNDERPUNCH
+	db DREAM_EATER
+	db DETECT
+	db REST
+	db ATTRACT
+	db THIEF
+	db STEEL_WING
+	db FIRE_PUNCH
+	db FURY_CUTTER
+	db NIGHTMARE
+	db CUT
+	db FLY
+	db SURF
+	db STRENGTH
+	db FLASH
+	db WHIRLPOOL
+	db WATERFALL
+
+; Move tutor
+	db FLAMETHROWER
+	db THUNDERBOLT
+	db ICE_BEAM
+
+	db 0 ; end
+; 116b7
--- /dev/null
+++ b/event/bug_contest_2.asm
@@ -1,0 +1,136 @@
+Special_SelectRandomBugContestContestants: ; 139a8
+; Select five random people to participate in the current contest.
+
+; First we have to make sure that any old data is cleared away.
+	ld c, 10 ; Number of people to choose from.
+	ld hl, BugCatchingContestantEventFlagTable
+.loop1
+	push bc
+	push hl
+	ld e, [hl]
+	inc hl
+	ld d, [hl]
+	ld b, RESET_FLAG
+	call EventFlagAction
+	pop hl
+rept 2
+	inc hl
+endr
+	pop bc
+	dec c
+	jr nz, .loop1
+
+; Now that that's out of the way, we can get on to the good stuff.
+	ld c, 5
+.loop2
+	push bc
+.next
+; Choose a flag at uniform random to be set.
+	call Random
+	cp $fa ; 250
+	jr nc, .next
+	ld c, $19 ; 25
+	call SimpleDivide
+	ld e, b
+	ld d, 0
+	ld hl, BugCatchingContestantEventFlagTable
+rept 2
+	add hl, de
+endr
+	ld e, [hl]
+	inc hl
+	ld d, [hl]
+	push de
+; If we've already set it, it doesn't count.
+	ld b, CHECK_FLAG
+	call EventFlagAction
+	pop de
+	ld a, c
+	and a
+	jr nz, .next
+; Set the flag.  This will cause that sprite to not be visible in the contest.
+	ld b, SET_FLAG
+	call EventFlagAction
+	pop bc
+; Check if we're done.  If so, return.  Otherwise, choose the next victim.
+	dec c
+	jr nz, .loop2
+	ret
+; 139ed
+
+Special_CheckBugContestContestantFlag: ; 139ed
+; Checks the flag of the Bug Catching Contestant whose index is loaded in a.
+
+; Bug: If a >= 10 when this is called, it will read beyond the table.
+
+	ld hl, BugCatchingContestantEventFlagTable
+	ld e, a
+	ld d, 0
+rept 2
+	add hl, de
+endr
+	ld e, [hl]
+	inc hl
+	ld d, [hl]
+	ld b, CHECK_FLAG
+	call EventFlagAction
+	ret
+; 139fe
+
+BugCatchingContestantEventFlagTable: ; 139fe
+	dw EVENT_BUG_CATCHING_CONTESTANT_1A
+	dw EVENT_BUG_CATCHING_CONTESTANT_2A
+	dw EVENT_BUG_CATCHING_CONTESTANT_3A
+	dw EVENT_BUG_CATCHING_CONTESTANT_4A
+	dw EVENT_BUG_CATCHING_CONTESTANT_5A
+	dw EVENT_BUG_CATCHING_CONTESTANT_6A
+	dw EVENT_BUG_CATCHING_CONTESTANT_7A
+	dw EVENT_BUG_CATCHING_CONTESTANT_8A
+	dw EVENT_BUG_CATCHING_CONTESTANT_9A
+	dw EVENT_BUG_CATCHING_CONTESTANT_10A
+; 13a12
+
+ContestDropOffMons: ; 13a12
+	ld hl, PartyMon1HP
+	ld a, [hli]
+	or [hl]
+	jr z, .fainted
+; Mask the rest of your party by setting the count to 1...
+	ld hl, PartyCount
+	ld a, 1
+	ld [hli], a
+	inc hl
+; ... backing up the second mon index somewhere...
+	ld a, [hl]
+	ld [wBugContestSecondPartySpecies], a
+; ... and replacing it with the terminator byte
+	ld [hl], $ff
+	xor a
+	ld [ScriptVar], a
+	ret
+
+.fainted
+	ld a, $1
+	ld [ScriptVar], a
+	ret
+; 13a31
+
+ContestReturnMons: ; 13a31
+; Restore the species of the second mon.
+	ld hl, PartySpecies + 1
+	ld a, [wBugContestSecondPartySpecies]
+	ld [hl], a
+; Restore the party count, which must be recomputed.
+	ld b, $1
+.loop
+	ld a, [hli]
+	cp $ff
+	jr z, .done
+	inc b
+	jr .loop
+
+.done
+	ld a, b
+	ld [PartyCount], a
+	ret
+; 13a47
--- /dev/null
+++ b/event/bug_contest_judging.asm
@@ -1,0 +1,480 @@
+_BugContestJudging: ; 1369d
+	call ContestScore
+	callba MobileFn_105f79
+	call Function13819
+	ld a, [wd00a]
+	call LoadContestantName
+	ld a, [wd00b]
+	ld [wd265], a
+	call GetPokemonName
+	ld hl, BugContest_ThirdPlaceText
+	call PrintText
+	ld a, [EndFlypoint]
+	call LoadContestantName
+	ld a, [MovementBuffer]
+	ld [wd265], a
+	call GetPokemonName
+	ld hl, BugContest_SecondPlaceText
+	call PrintText
+	ld a, [wd002]
+	call LoadContestantName
+	ld a, [wd003]
+	ld [wd265], a
+	call GetPokemonName
+	ld hl, BugContest_FirstPlaceText
+	call PrintText
+	jp Function13807
+; 136eb
+
+BugContest_FirstPlaceText: ; 0x136eb
+	text_jump ContestJudging_FirstPlaceText
+	start_asm
+BugContest_FirstPlace: ; 136f0
+	ld de, SFX_1ST_PLACE
+	call PlaySFX
+	call WaitSFX
+	ld hl, BugContest_FirstPlaceScoreText
+	ret
+; 136fd
+
+BugContest_FirstPlaceScoreText: ; 0x136fd
+	; The winning score was @  points!
+	text_jump ContestJudging_FirstPlaceScoreText
+	db "@"
+; 0x13702
+
+BugContest_SecondPlaceText: ; 0x13702
+	; Placing second was @ , who caught a @ !@ @
+	text_jump ContestJudging_SecondPlaceText
+	start_asm
+BugContest_SecondPlace: ; 13707
+	ld de, SFX_2ND_PLACE
+	call PlaySFX
+	call WaitSFX
+	ld hl, BugContest_SecondPlaceScoreText
+	ret
+; 13714
+
+BugContest_SecondPlaceScoreText: ; 0x13714
+	; The score was @  points!
+	text_jump ContestJudging_SecondPlaceScoreText
+	db "@"
+; 0x13719
+
+BugContest_ThirdPlaceText: ; 0x13719
+	; Placing third was @ , who caught a @ !@ @
+	text_jump ContestJudging_ThirdPlaceText
+	start_asm
+; 0x1371e
+
+BugContest_ThirdPlace: ; 1371e
+	ld de, SFX_3RD_PLACE
+	call PlaySFX
+	call WaitSFX
+	ld hl, BugContest_ThirdPlaceScoreText
+	ret
+; 1372b
+
+BugContest_ThirdPlaceScoreText: ; 0x1372b
+	; The score was @  points!
+	text_jump ContestJudging_ThirdPlaceScoreText
+	db "@"
+; 0x13730
+
+LoadContestantName: ; 13730
+
+; If a = 0, get your name.
+	dec a
+	jr z, .done
+; Find the pointer for the trainer class of the Bug Catching Contestant whose ID is in a.
+	ld c, a
+	ld b, 0
+	ld hl, BugContestantPointers
+rept 2
+	add hl, bc
+endr
+	ld a, [hli]
+	ld h, [hl]
+	ld l, a
+; Copy the Trainer Class to c.
+	ld a, [hli]
+	ld c, a
+; Save hl and bc for later.
+	push hl
+	push bc
+; Get the Trainer Class name and copy it into wd016.
+	callab GetTrainerClassName
+	ld hl, StringBuffer1
+	ld de, wd016
+	ld bc, TRAINER_CLASS_NAME_LENGTH
+	call CopyBytes
+	ld hl, wd016
+; Delete the trailing terminator and replace it with a space.
+.next
+	ld a, [hli]
+	cp "@"
+	jr nz, .next
+	dec hl
+	ld [hl], " "
+	inc hl
+	ld d, h
+	ld e, l
+; Restore the Trainer Class ID and Trainer ID pointer.  Save de for later.
+	pop bc
+	pop hl
+	push de
+; Get the name of the trainer with class c and ID b.
+	ld a, [hl]
+	ld b, a
+	callab GetTrainerName
+; Append the name to wd016.
+	ld hl, StringBuffer1
+	pop de
+	ld bc, NAME_LENGTH - 1
+	jp CopyBytes
+
+.done
+	ld hl, PlayerName
+	ld de, wd016
+	ld bc, NAME_LENGTH
+	jp CopyBytes
+; 13783
+
+BugContestantPointers: ; 13783
+	dw BugContestant_BugCatcherDon ; This reverts back to the player
+	dw BugContestant_BugCatcherDon
+	dw BugContestant_BugCatcherEd
+	dw BugContestant_CooltrainerMNick
+	dw BugContestant_PokefanMWilliam
+	dw BugContestant_BugCatcherBenny
+	dw BugContestant_CamperBarry
+	dw BugContestant_PicnickerCindy
+	dw BugContestant_BugCatcherJosh
+	dw BugContestant_YoungsterSamuel
+	dw BugContestant_SchoolboyKipp
+; 13799
+
+BugContestant_BugCatcherDon:
+	db BUG_CATCHER, DON
+	dbw KAKUNA,     300
+	dbw METAPOD,    285
+	dbw CATERPIE,   226
+
+BugContestant_BugCatcherEd:
+	db BUG_CATCHER, ED
+	dbw BUTTERFREE, 286
+	dbw BUTTERFREE, 251
+	dbw CATERPIE,   237
+
+BugContestant_CooltrainerMNick:
+	db COOLTRAINERM, NICK
+	dbw SCYTHER,    357
+	dbw BUTTERFREE, 349
+	dbw PINSIR,     368
+
+BugContestant_PokefanMWilliam:
+	db POKEFANM, WILLIAM
+	dbw PINSIR,     332
+	dbw BUTTERFREE, 324
+	dbw VENONAT,    321
+
+BugContestant_BugCatcherBenny:
+	db BUG_CATCHER, BUG_CATCHER_BENNY
+	dbw BUTTERFREE, 318
+	dbw WEEDLE,     295
+	dbw CATERPIE,   285
+
+BugContestant_CamperBarry:
+	db CAMPER, BARRY
+	dbw PINSIR,     366
+	dbw VENONAT,    329
+	dbw KAKUNA,     314
+
+BugContestant_PicnickerCindy:
+	db PICNICKER, CINDY
+	dbw BUTTERFREE, 341
+	dbw METAPOD,    301
+	dbw CATERPIE,   264
+
+BugContestant_BugCatcherJosh:
+	db BUG_CATCHER, JOSH
+	dbw SCYTHER,    326
+	dbw BUTTERFREE, 292
+	dbw METAPOD,    282
+
+BugContestant_YoungsterSamuel:
+	db YOUNGSTER, SAMUEL
+	dbw WEEDLE,     270
+	dbw PINSIR,     282
+	dbw CATERPIE,   251
+
+BugContestant_SchoolboyKipp:
+	db SCHOOLBOY, KIPP
+	dbw VENONAT,    267
+	dbw PARAS,      254
+	dbw KAKUNA,     259
+; 13807
+
+Function13807: ; 13807
+	ld hl, wd00a
+	ld de, -4
+	ld b, 3
+.loop
+	ld a, [hl]
+	cp 1
+	jr z, .done
+	add hl, de
+	dec b
+	jr nz, .loop
+
+.done
+	ret
+; 13819
+
+Function13819: ; 13819
+	call Function13833
+	call Function138b0
+	ld hl, wd00e
+	ld a, 1
+	ld [hli], a
+	ld a, [wContestMon]
+	ld [hli], a
+	ld a, [hProduct]
+	ld [hli], a
+	ld a, [hMultiplicand]
+	ld [hl], a
+	call Function1383e
+	ret
+; 13833
+
+Function13833: ; 13833
+	ld hl, wd002
+	ld b, 12
+	xor a
+.loop
+	ld [hli], a
+	dec b
+	jr nz, .loop
+	ret
+; 1383e
+
+Function1383e: ; 1383e
+	ld de, wd010
+	ld hl, wd004
+	ld c, 2
+	call StringCmp
+	jr c, .next
+	ld hl, EndFlypoint
+	ld de, wd00a
+	ld bc, 4
+	call CopyBytes
+	ld hl, wd002
+	ld de, EndFlypoint
+	ld bc, 4
+	call CopyBytes
+	ld hl, wd002
+	call Function138a0
+	jr .done
+
+.next
+	ld de, wd010
+	ld hl, wd008
+	ld c, 2
+	call StringCmp
+	jr c, .next2
+	ld hl, EndFlypoint
+	ld de, wd00a
+	ld bc, 4
+	call CopyBytes
+	ld hl, EndFlypoint
+	call Function138a0
+	jr .done
+
+.next2
+	ld de, wd010
+	ld hl, wd00c
+	ld c, 2
+	call StringCmp
+	jr c, .done
+	ld hl, wd00a
+	call Function138a0
+
+.done
+	ret
+; 138a0
+
+Function138a0: ; 138a0
+	ld de, wd00e
+	ld a, [de]
+	inc de
+	ld [hli], a
+	ld a, [de]
+	inc de
+	ld [hli], a
+	ld a, [de]
+	inc de
+	ld [hli], a
+	ld a, [de]
+	inc de
+	ld [hl], a
+	ret
+; 138b0
+
+Function138b0: ; 138b0
+	ld e, 0
+.loop
+	push de
+	call Special_CheckBugContestContestantFlag
+	pop de
+	jr nz, .done
+	ld a, e
+rept 2
+	inc a
+endr
+	ld [wd00e], a
+	dec a
+	ld c, a
+	ld b, 0
+	ld hl, BugContestantPointers
+rept 2
+	add hl, bc
+endr
+	ld a, [hli]
+	ld h, [hl]
+	ld l, a
+rept 2
+	inc hl
+endr
+.loop2
+	call Random
+	and 3
+	cp 3
+	jr z, .loop2
+	ld c, a
+	ld b, 0
+rept 3
+	add hl, bc
+endr
+	ld a, [hli]
+	ld [wd00f], a
+	ld a, [hli]
+	ld h, [hl]
+	ld l, a
+	call Random
+	and 7
+	ld c, a
+	ld b, 0
+	add hl, bc
+	ld a, h
+	ld [wd010], a
+	ld a, l
+	ld [wd011], a
+	push de
+	call Function1383e
+	pop de
+
+.done
+	inc e
+	ld a, e
+	cp 10
+	jr nz, .loop
+	ret
+; 13900
+
+ContestScore: ; 13900
+; Determine the player's score in the Bug Catching Contest.
+
+	xor a
+	ld [hProduct], a
+	ld [hMultiplicand], a
+
+	ld a, [wContestMonSpecies] ; Species
+	and a
+	jr z, .done
+
+	; Tally the following:
+
+	; Max HP * 4
+	ld a, [wContestMonMaxHP + 1]
+	call .AddContestStat
+	ld a, [wContestMonMaxHP + 1]
+	call .AddContestStat
+	ld a, [wContestMonMaxHP + 1]
+	call .AddContestStat
+	ld a, [wContestMonMaxHP + 1]
+	call .AddContestStat
+
+	; Stats
+	ld a, [wContestMonAttack  + 1]
+	call .AddContestStat
+	ld a, [wContestMonDefense + 1]
+	call .AddContestStat
+	ld a, [wContestMonSpeed   + 1]
+	call .AddContestStat
+	ld a, [wContestMonSpclAtk + 1]
+	call .AddContestStat
+	ld a, [wContestMonSpclDef + 1]
+	call .AddContestStat
+
+	; DVs
+	ld a, [wContestMonDVs + 0]
+	ld b, a
+	and 2
+rept 2
+	add a
+endr
+	ld c, a
+
+	swap b
+	ld a, b
+	and 2
+	add a
+	add c
+	ld d, a
+
+	ld a, [wContestMonDVs + 1]
+	ld b, a
+	and 2
+	ld c, a
+
+	swap b
+	ld a, b
+	and 2
+	srl a
+rept 2
+	add c
+endr
+rept 2
+	add d
+endr
+
+	call .AddContestStat
+
+	; Remaining HP / 8
+	ld a, [wContestMonHP + 1]
+	srl a
+	srl a
+	srl a
+	call .AddContestStat
+
+	; Whether it's holding an item
+	ld a, [wContestMonItem]
+	and a
+	jr z, .done
+
+	ld a, 1
+	call .AddContestStat
+
+.done
+	ret
+; 1397f
+
+.AddContestStat: ; 1397f
+	ld hl, hMultiplicand
+	add [hl]
+	ld [hl], a
+	ret nc
+	dec hl
+	inc [hl]
+	ret
+; 13988
--- /dev/null
+++ b/event/elevator.asm
@@ -1,0 +1,287 @@
+Elevator:: ; 1342d
+	call Function1344a
+	call Function1347d
+	jr c, .asm_13448
+	ld [wd041], a
+	call Function134dd
+	jr c, .asm_13448
+	ld hl, wd041
+	cp [hl]
+	jr z, .asm_13448
+	call Function134c0
+	and a
+	ret
+
+.asm_13448
+	scf
+	ret
+; 1344a
+
+Function1344a: ; 1344a
+	ld a, b
+	ld [EngineBuffer1], a
+	ld a, e
+	ld [wd03f], a
+	ld a, d
+	ld [wd040], a
+	call Function1345a
+	ret
+; 1345a
+
+Function1345a: ; 1345a
+	ld de, OBPals + 8 * 6
+	ld bc, 4
+	ld hl, wd03f
+	ld a, [hli]
+	ld h, [hl]
+	ld l, a
+	ld a, [EngineBuffer1]
+	call GetFarByte
+	inc hl
+	ld [de], a
+	inc de
+.asm_1346f
+	ld a, [EngineBuffer1]
+	call GetFarByte
+	ld [de], a
+	inc de
+	add hl, bc
+	cp $ff
+	jr nz, .asm_1346f
+	ret
+; 1347d
+
+Function1347d: ; 1347d
+	ld hl, wd03f
+	ld a, [hli]
+	ld h, [hl]
+	ld l, a
+	ld a, [EngineBuffer1]
+	call GetFarByte
+	ld c, a
+	inc hl
+	ld a, [BackupMapGroup]
+	ld d, a
+	ld a, [BackupMapNumber]
+	ld e, a
+	ld b, $0
+.asm_13495
+	ld a, [EngineBuffer1]
+	call GetFarByte
+	cp $ff
+	jr z, .asm_134be
+rept 2
+	inc hl
+endr
+	ld a, [EngineBuffer1]
+	call GetFarByte
+	inc hl
+	cp d
+	jr nz, .asm_134b7
+	ld a, [EngineBuffer1]
+	call GetFarByte
+	inc hl
+	cp e
+	jr nz, .asm_134b8
+	jr .asm_134bb
+
+.asm_134b7
+	inc hl
+
+.asm_134b8
+	inc b
+	jr .asm_13495
+
+.asm_134bb
+	xor a
+	ld a, b
+	ret
+
+.asm_134be
+	scf
+	ret
+; 134c0
+
+Function134c0: ; 134c0
+	push af
+	ld hl, wd03f
+	ld a, [hli]
+	ld h, [hl]
+	ld l, a
+	inc hl
+	pop af
+	ld bc, 4
+	call AddNTimes
+	inc hl
+	ld de, wdcac
+	ld a, [EngineBuffer1]
+	ld bc, 3
+	call FarCopyBytes
+	ret
+; 134dd
+
+Function134dd: ; 134dd
+	call LoadStandardMenuDataHeader
+	ld hl, Elevator_WhichFloorText
+	call PrintText
+	call Elevator_GetCurrentFloorText
+	ld hl, Elevator_MenuDataHeader
+	call CopyMenuDataHeader
+	call Function352f
+	call UpdateSprites
+	xor a
+	ld [wd0e4], a
+	call HandleScrollingMenu
+	call WriteBackup
+	ld a, [wcf73]
+	cp $2
+	jr z, .asm_1350b
+	xor a
+	ld a, [wcf77]
+	ret
+
+.asm_1350b
+	scf
+	ret
+; 1350d
+
+Elevator_WhichFloorText: ; 0x1350d
+	; Which floor?
+	text_jump UnknownText_0x1bd2bc
+	db "@"
+; 0x13512
+
+
+Elevator_GetCurrentFloorText: ; 13512
+	ld hl, Options
+	ld a, [hl]
+	push af
+	set NO_TEXT_SCROLL, [hl]
+	hlcoord 0, 0
+	ld b, 4
+	ld c, 8
+	call TextBox
+	hlcoord 1, 2
+	ld de, Elevator_CurrentFloorText
+	call PlaceString
+	hlcoord 4, 4
+	call Elevator_GetCurrentFloorString
+	pop af
+	ld [Options], a
+	ret
+; 13537
+
+Elevator_CurrentFloorText: ; 13537
+	db "Now on:@"
+; 1353f
+
+
+Elevator_GetCurrentFloorString: ; 1353f
+	push hl
+	ld a, [wd041]
+	ld e, a
+	ld d, 0
+	ld hl, wd0f1
+	add hl, de
+	ld a, [hl]
+	pop de
+	call GetFloorString
+	ret
+; 13550
+
+Elevator_MenuDataHeader: ; 0x13550
+	db $40 ; flags
+	db 01, 12 ; start coords
+	db 09, 18 ; end coords
+	dw Elevator_MenuData2
+	db 1 ; default option
+; 0x13558
+
+Elevator_MenuData2: ; 0x13558
+	db $10 ; flags
+	db 4, 0 ; rows, columns
+	db 1 ; horizontal spacing
+	dbw 0, OBPals + 8 * 6
+	dba GetElevatorFlorStrings
+	dba NULL
+	dba NULL
+; 13568
+
+GetElevatorFlorStrings: ; 13568
+	ld a, [MenuSelection]
+
+GetFloorString: ; 1356b
+	push de
+	call FloorToString
+	ld d, h
+	ld e, l
+	pop hl
+	jp PlaceString
+; 13575
+
+FloorToString: ; 13575
+	push de
+	ld e, a
+	ld d, 0
+	ld hl, .floors
+rept 2
+	add hl, de
+endr
+	ld a, [hli]
+	ld h, [hl]
+	ld l, a
+	pop de
+	ret
+; 13583
+
+.floors
+	dw .b4f
+	dw .b3f
+	dw .b2f
+	dw .b1f
+	dw ._1f
+	dw ._2f
+	dw ._3f
+	dw ._4f
+	dw ._5f
+	dw ._6f
+	dw ._7f
+	dw ._8f
+	dw ._9f
+	dw ._10f
+	dw ._11f
+	dw .roof
+
+.b4f
+	db "B4F@"
+.b3f
+	db "B3F@"
+.b2f
+	db "B2F@"
+.b1f
+	db "B1F@"
+._1f
+	db "1F@"
+._2f
+	db "2F@"
+._3f
+	db "3F@"
+._4f
+	db "4F@"
+._5f
+	db "5F@"
+._6f
+	db "6F@"
+._7f
+	db "7F@"
+._8f
+	db "8F@"
+._9f
+	db "9F@"
+._10f
+	db "10F@"
+._11f
+	db "11F@"
+.roof
+	db "ROOF@"
+; 135db
--- /dev/null
+++ b/event/forced_movement.asm
@@ -1,0 +1,68 @@
+Script_ForcedMovement:: ; 0x1253d
+	checkcode VAR_FACING
+	if_equal DOWN, .down
+	if_equal UP, .up
+	if_equal LEFT, .left
+	if_equal RIGHT, .right
+	end
+; 0x12550
+
+.up: ; 0x12550
+	applymovement PLAYER, .MovementData_up
+	end
+; 0x12555
+
+.down: ; 0x12555
+	applymovement PLAYER, .MovementData_down
+	end
+; 0x1255a
+
+.right: ; 0x1255a
+	applymovement PLAYER, .MovementData_right
+	end
+; 0x1255f
+
+.left: ; 0x1255f
+	applymovement PLAYER, .MovementData_left
+	end
+; 0x12564
+
+.MovementData_up: ; 0x12564
+	step_wait5
+	big_step_down
+	turn_in_down
+	step_wait5
+	big_step_down
+	turn_head_down
+	step_end
+; 0x1256b
+
+.MovementData_down: ; 0x1256b
+	step_wait5
+	big_step_down
+	turn_in_up
+	step_wait5
+	big_step_down
+	turn_head_up
+	step_end
+; 0x12572
+
+.MovementData_right: ; 0x12572
+	step_wait5
+	big_step_down
+	turn_in_left
+	step_wait5
+	big_step_down
+	turn_head_left
+	step_end
+; 0x12579
+
+.MovementData_left: ; 0x12579
+	step_wait5
+	big_step_down
+	turn_in_right
+	step_wait5
+	big_step_down
+	turn_head_right
+	step_end
+; 0x12580
--- /dev/null
+++ b/event/itemball.asm
@@ -1,0 +1,54 @@
+FindItemInBallScript:: ; 0x122ce
+	callasm .TryReceiveItem
+	iffalse .no_room
+	disappear LAST_TALKED
+	loadfont
+	writetext .text_found
+	playsound SFX_ITEM
+	pause 60
+	itemnotify
+	loadmovesprites
+	end
+; 0x122e3
+
+.no_room: ; 0x122e3
+	loadfont
+	writetext .text_found
+	closetext
+	writetext .text_bag_full
+	closetext
+	loadmovesprites
+	end
+; 0x122ee
+
+.text_found: ; 0x122ee
+	; found @ !
+	text_jump UnknownText_0x1c0a1c
+	db "@"
+; 0x122f3
+
+.text_bag_full: ; 0x122f3
+	; But   can't carry any more items.
+	text_jump UnknownText_0x1c0a2c
+	db "@"
+; 0x122f8
+
+.TryReceiveItem: ; 122f8
+	xor a
+	ld [ScriptVar], a
+	ld a, [EngineBuffer1]
+	ld [wd265], a
+	call GetItemName
+	ld hl, StringBuffer3
+	call CopyName2
+	ld a, [EngineBuffer1]
+	ld [CurItem], a
+	ld a, [CurFruit]
+	ld [wItemQuantityChangeBuffer], a
+	ld hl, NumItems
+	call ReceiveItem
+	ret nc
+	ld a, $1
+	ld [ScriptVar], a
+	ret
+; 12324
--- /dev/null
+++ b/event/itemfinder.asm
@@ -1,0 +1,58 @@
+ItemFinder: ; 12580
+	callba CheckForSignpostItems
+	jr c, .found_something
+	ld hl, .Script_FoundNothing
+	jr .resume
+
+.found_something
+	ld hl, .Script_FoundSomething
+
+.resume
+	call QueueScript
+	ld a, $1
+	ld [wd0ec], a
+	ret
+; 12599
+
+.ItemfinderSound: ; 12599
+	ld c, $4
+.sfx_loop
+	push bc
+	ld de, SFX_SECOND_PART_OF_ITEMFINDER
+	call WaitPlaySFX
+	ld de, SFX_TRANSACTION
+	call WaitPlaySFX
+	pop bc
+	dec c
+	jr nz, .sfx_loop
+	ret
+; 125ad
+
+.Script_FoundSomething: ; 0x125ad
+	reloadmappart
+	special UpdateTimePals
+	callasm .ItemfinderSound
+	writetext .Text_FoundSomething
+	loadmovesprites
+	end
+; 0x125ba
+
+.Script_FoundNothing: ; 0x125ba
+	reloadmappart
+	special UpdateTimePals
+	writetext .Text_FoundNothing
+	loadmovesprites
+	end
+; 0x125c3
+
+.Text_FoundSomething: ; 0x125c3
+	; Yes! ITEMFINDER indicates there's an item nearby.
+	text_jump UnknownText_0x1c0a77
+	db "@"
+; 0x125c8
+
+.Text_FoundNothing: ; 0x125c8
+	; Nope! ITEMFINDER isn't responding.
+	text_jump UnknownText_0x1c0aa9
+	db "@"
+; 0x125cd
--- a/event/kurt.asm
+++ b/event/kurt.asm
@@ -23,7 +23,7 @@
 ; 0x88018
 
 Special_SelectApricornForKurt: ; 88018
-	call LoadPartyMenuDataHeader
+	call LoadStandardMenuDataHeader
 	ld c, $1
 	xor a
 	ld [wd0e4], a
--- a/event/mom.asm
+++ b/event/mom.asm
@@ -103,7 +103,7 @@
 .AccessBankOfMom: ; 162a8
 	ld hl, UnknownText_0x1665d
 	call PrintText
-	call LoadPartyMenuDataHeader
+	call LoadStandardMenuDataHeader
 	ld hl, MenuDataHeader_0x166b5
 	call CopyMenuDataHeader
 	call InterpretMenu2
@@ -148,7 +148,7 @@
 	ld [hl], a
 	ld a, $5
 	ld [wcf64], a
-	call LoadPartyMenuDataHeader
+	call LoadStandardMenuDataHeader
 	call Function16517
 	call Function1656b
 	call Function16571
@@ -216,7 +216,7 @@
 	ld [hl], a
 	ld a, $5
 	ld [wcf64], a
-	call LoadPartyMenuDataHeader
+	call LoadStandardMenuDataHeader
 	call Function16512
 	call Function1656b
 	call Function16571
--- a/event/move_deleter.asm
+++ b/event/move_deleter.asm
@@ -19,7 +19,7 @@
 	jr z, .asm_2c5ca
 	ld hl, UnknownText_0x2c5ea
 	call PrintText
-	call LoadPartyMenuDataHeader
+	call LoadStandardMenuDataHeader
 	callba Function12f5b
 	push af
 	call Function2b74
--- /dev/null
+++ b/event/whiteout.asm
@@ -1,0 +1,84 @@
+Script_BattleWhiteout:: ; 0x124c1
+	callasm BattleBGMap
+	jump Script_Whiteout
+; 0x124c8
+
+Script_OverworldWhiteout:: ; 0x124c8
+	refreshscreen $0
+	callasm OverworldBGMap
+
+Script_Whiteout: ; 0x124ce
+	writetext .WhitedOutText
+	closetext
+	special FadeBlackBGMap
+	pause 40
+	special HealParty
+	checkflag ENGINE_BUG_CONTEST_TIMER
+	iftrue .bug_contest
+	callasm HalveMoney
+	callasm GetWhiteoutSpawn
+	farscall Script_AbortBugContest
+	special WarpToSpawnPoint
+	newloadmap MAPSETUP_WARP
+	resetfuncs
+
+.bug_contest
+	jumpstd bugcontestresultswarp
+; 0x124f5
+
+.WhitedOutText: ; 0x124f5
+	; is out of useable #MON!  whited out!
+	text_jump UnknownText_0x1c0a4e
+	db "@"
+; 0x124fa
+
+OverworldBGMap: ; 124fa
+	call ClearPalettes
+	call ClearScreen
+	call Function3200
+	call HideSprites
+	call Function4f0
+	ret
+; 1250a
+
+BattleBGMap: ; 1250a
+	ld b, $0
+	call GetSGBLayout
+	call SetPalettes
+	ret
+; 12513
+
+HalveMoney: ; 12513
+
+; Empty function...
+	callba MobileFn_1060c7
+
+; Halve the player's money.
+	ld hl, Money
+	ld a, [hl]
+	srl a
+	ld [hli], a
+	ld a, [hl]
+	rra
+	ld [hli], a
+	ld a, [hl]
+	rra
+	ld [hl], a
+	ret
+; 12527
+
+
+GetWhiteoutSpawn: ; 12527
+	ld a, [wLastSpawnMapGroup]
+	ld d, a
+	ld a, [wLastSpawnMapNumber]
+	ld e, a
+	callba IsSpawnPoint
+	ld a, c
+	jr c, .yes
+	xor a ; SPAWN_HOME
+
+.yes
+	ld [wd001], a
+	ret
+; 1253d
--- a/home.asm
+++ b/home.asm
@@ -1711,11 +1711,11 @@
 ; 3786
 
 
-Function3786:: ; 3786
+PrepMonFrontpic:: ; 3786
 	ld a, $1
 	ld [wc2c6], a
 
-Function378b:: ; 378b
+_PrepMonFrontpic:: ; 378b
 	ld a, [CurPartySpecies]
 	call IsAPokemon
 	jr c, .not_pokemon
--- a/home/map.asm
+++ b/home/map.asm
@@ -1963,7 +1963,7 @@
 FadeToMenu:: ; 2b29
 	xor a
 	ld [hBGMapMode], a
-	call LoadPartyMenuDataHeader
+	call LoadStandardMenuDataHeader
 	callba FadeBlackBGMap
 	call ClearSprites
 	call DisableSpriteUpdates
--- a/home/menu.asm
+++ b/home/menu.asm
@@ -52,7 +52,7 @@
 	ret
 ; 1d6e
 
-LoadPartyMenuDataHeader:: ; 1d6e
+LoadStandardMenuDataHeader:: ; 1d6e
 	ld hl, MenuDataHeader_0x1d75
 	call LoadMenuDataHeader
 	ret
--- a/items/item_effects.asm
+++ b/items/item_effects.asm
@@ -603,7 +603,7 @@
 	xor a ; PARTYMON
 	ld [MonType], a
 	ld b, 0
-	callba Function116c1
+	callba NamingScreen
 
 	call FadeToWhite
 
@@ -656,7 +656,7 @@
 	ld [MonType], a
 	ld de, wd050
 	ld b, $0
-	callba Function116c1
+	callba NamingScreen
 
 	ld a, BANK(sBoxMonNicknames)
 	call GetSRAMBank
--- a/macros/charmap.asm
+++ b/macros/charmap.asm
@@ -42,6 +42,8 @@
 	charmap "<PO>",     $70
 	charmap "<KE>",     $71
 	charmap "◀",        $71
+	charmap "<``>",     $72
+	charmap "<''>",     $73
 	charmap "<ID>",     $73
 	charmap "№",        $74
 	charmap "…",        $75
--- a/main.asm
+++ b/main.asm
@@ -415,7 +415,7 @@
 	callba TryLoadSaveFile
 	jr c, .FailToLoad
 	callba Function150b9
-	call LoadPartyMenuDataHeader
+	call LoadStandardMenuDataHeader
 	call Function5e85
 	ld a, $1
 	ld [hBGMapMode], a
@@ -740,7 +740,7 @@
 	ld [CurPartySpecies], a
 	ld a, POKEMON_PROF
 	ld [TrainerClass], a
-	call Function619c
+	call Intro_PrepTrainerPic
 
 	ld b, $1c
 	call GetSGBLayout
@@ -757,7 +757,7 @@
 	call GetBaseData
 
 	hlcoord 6, 4
-	call Function3786
+	call PrepMonFrontpic
 
 	xor a
 	ld [TempMonDVs], a
@@ -778,7 +778,7 @@
 	ld [CurPartySpecies], a
 	ld a, POKEMON_PROF
 	ld [TrainerClass], a
-	call Function619c
+	call Intro_PrepTrainerPic
 
 	ld b, $1c
 	call GetSGBLayout
@@ -811,10 +811,10 @@
 OakText2: ; 0x604a
 	text_jump _OakText2
 	start_asm
-	ld a,WOOPER
+	ld a, WOOPER
 	call PlayCry
 	call WaitSFX
-	ld hl,OakText3
+	ld hl, OakText3
 	ret
 
 OakText3: ; 0x605b
@@ -851,7 +851,7 @@
 .NewName
 	ld b, 1
 	ld de, PlayerName
-	callba Function116c1
+	callba NamingScreen
 
 	call FadeToWhite
 	call ClearTileMap
@@ -997,7 +997,7 @@
 	jr .loop
 ; 619c
 
-Function619c: ; 619c
+Intro_PrepTrainerPic: ; 619c
 	ld de, VTiles2
 	callba GetTrainerPic
 	xor a
@@ -5218,7 +5218,7 @@
 .outdoors
 	xor a
 	ld [hMapAnims], a
-	call LoadPartyMenuDataHeader
+	call LoadStandardMenuDataHeader
 	call ClearSprites
 	callba _FlyMap
 	ld a, e
@@ -5265,7 +5265,7 @@
 	callasm HideSprites
 	special UpdateTimePals
 	callasm Function8caed
-	farscall UnknownScript_0x122c1
+	farscall Script_AbortBugContest
 	special WarpToSpawnPoint
 	callasm DelayLoadingNewSprites
 	writecode VAR_MOVEMENT, $0
@@ -5534,7 +5534,7 @@
 	loadmovesprites
 	playsound SFX_WARP_TO
 	applymovement PLAYER, MovementData_0xcc59
-	farscall UnknownScript_0x122c1
+	farscall Script_AbortBugContest
 	special WarpToSpawnPoint
 	writecode VAR_MOVEMENT, $0
 	newloadmap MAPSETUP_05
@@ -5632,7 +5632,7 @@
 	loadmovesprites
 	playsound SFX_WARP_TO
 	applymovement PLAYER, MovementData_0xcce1
-	farscall UnknownScript_0x122c1
+	farscall Script_AbortBugContest
 	special WarpToSpawnPoint
 	writecode VAR_MOVEMENT, $0
 	newloadmap MAPSETUP_04
@@ -9735,12 +9735,12 @@
 
 InitNickname: ; e3de
 	push de
-	call LoadPartyMenuDataHeader
+	call LoadStandardMenuDataHeader
 	call DisableSpriteUpdates
 	pop de
 	push de
 	ld b, $0
-	callba Function116c1
+	callba NamingScreen
 	pop hl
 	ld de, StringBuffer1
 	call InitName
@@ -9776,7 +9776,7 @@
 Functione41c: ; e41c (3:641c)
 	xor a
 	ld [hBGMapMode], a
-	call LoadPartyMenuDataHeader
+	call LoadStandardMenuDataHeader
 	call ClearPCItemScreen
 	ld hl, Options
 	ld a, [hl]
@@ -9872,7 +9872,7 @@
 ; e4cd
 
 Functione4cd: ; e4cd
-	call LoadPartyMenuDataHeader
+	call LoadStandardMenuDataHeader
 	callba Function44781
 	jr nc, .asm_e4e0
 	ld hl, UnknownText_0xe4f9
@@ -9899,7 +9899,7 @@
 ; 0xe4fe
 
 Functione4fe: ; e4fe (3:64fe)
-	call LoadPartyMenuDataHeader
+	call LoadStandardMenuDataHeader
 	callba Functione2391
 	call Function222a
 	call ClearPCItemScreen
@@ -9975,7 +9975,7 @@
 
 
 Functione559: ; e559 (3:6559)
-	call LoadPartyMenuDataHeader
+	call LoadStandardMenuDataHeader
 	callba Functione2583
 	call Function222a
 	call ClearPCItemScreen
@@ -10362,1085 +10362,14 @@
 
 SECTION "bank4", ROMX, BANK[$4]
 
-
 INCLUDE "engine/pack.asm"
 
 INCLUDE "engine/time.asm"
 
-CanLearnTMHMMove: ; 11639
-	ld a, [CurPartySpecies]
-	ld [CurSpecies], a
-	call GetBaseData
-	ld hl, BaseTMHM
-	push hl
+INCLUDE "engine/tmhm.asm"
 
-	ld a, [wd262]
-	ld b, a
-	ld c, 0
-	ld hl, TMHMMoves
-.loop
-	ld a, [hli]
-	and a
-	jr z, .end
-	cp b
-	jr z, .asm_11659
-	inc c
-	jr .loop
+INCLUDE "engine/namingscreen.asm"
 
-.asm_11659
-	pop hl
-	ld b, CHECK_FLAG
-	push de
-	ld d, 0
-	predef FlagPredef
-	pop de
-	ret
-
-.end
-	pop hl
-	ld c, 0
-	ret
-; 1166a
-
-GetTMHMMove: ; 1166a
-	ld a, [wd265]
-	dec a
-	ld hl, TMHMMoves
-	ld b, 0
-	ld c, a
-	add hl, bc
-	ld a, [hl]
-	ld [wd265], a
-	ret
-; 1167a
-
-TMHMMoves: ; 1167a
-	db DYNAMICPUNCH
-	db HEADBUTT
-	db CURSE
-	db ROLLOUT
-	db ROAR
-	db TOXIC
-	db ZAP_CANNON
-	db ROCK_SMASH
-	db PSYCH_UP
-	db HIDDEN_POWER
-	db SUNNY_DAY
-	db SWEET_SCENT
-	db SNORE
-	db BLIZZARD
-	db HYPER_BEAM
-	db ICY_WIND
-	db PROTECT
-	db RAIN_DANCE
-	db GIGA_DRAIN
-	db ENDURE
-	db FRUSTRATION
-	db SOLARBEAM
-	db IRON_TAIL
-	db DRAGONBREATH
-	db THUNDER
-	db EARTHQUAKE
-	db RETURN
-	db DIG
-	db PSYCHIC_M
-	db SHADOW_BALL
-	db MUD_SLAP
-	db DOUBLE_TEAM
-	db ICE_PUNCH
-	db SWAGGER
-	db SLEEP_TALK
-	db SLUDGE_BOMB
-	db SANDSTORM
-	db FIRE_BLAST
-	db SWIFT
-	db DEFENSE_CURL
-	db THUNDERPUNCH
-	db DREAM_EATER
-	db DETECT
-	db REST
-	db ATTRACT
-	db THIEF
-	db STEEL_WING
-	db FIRE_PUNCH
-	db FURY_CUTTER
-	db NIGHTMARE
-	db CUT
-	db FLY
-	db SURF
-	db STRENGTH
-	db FLASH
-	db WHIRLPOOL
-	db WATERFALL
-
-; Move tutor
-	db FLAMETHROWER
-	db THUNDERBOLT
-	db ICE_BEAM
-
-	db 0 ; end
-; 116b7
-
-_NamingScreen: ; 0x116b7
-	call DisableSpriteUpdates
-	call Function116c1
-	call Function2b74
-	ret
-; 0x116c1
-
-Function116c1: ; 116c1
-	ld hl, wc6d0
-	ld [hl], e
-	inc hl
-	ld [hl], d
-	ld hl, wc6d4
-	ld [hl], b
-	ld hl, Options
-	ld a, [hl]
-	push af
-	set NO_TEXT_SCROLL, [hl]
-	ld a, [hMapAnims]
-	push af
-	xor a
-	ld [hMapAnims], a
-	ld a, [hInMenu]
-	push af
-	ld a, $1
-	ld [hInMenu], a
-	call Function116f8
-	call DelayFrame
-.asm_116e5
-	call Function11915
-	jr nc, .asm_116e5
-	pop af
-	ld [hInMenu], a
-	pop af
-	ld [hMapAnims], a
-	pop af
-	ld [Options], a
-	call ClearJoypad
-	ret
-; 116f8
-
-Function116f8: ; 116f8
-	call WhiteBGMap
-	ld b, $8
-	call GetSGBLayout
-	call DisableLCD
-	call Function11c51
-	call Function118a8
-	ld a, $e3
-	ld [rLCDC], a
-	call Function1171d
-	call WaitBGMap
-	call WaitTop
-	call SetPalettes
-	call Function11be0
-	ret
-; 1171d
-
-Function1171d: ; 1171d
-	ld a, [wc6d4]
-	and 7
-	ld e, a
-	ld d, 0
-	ld hl, Jumptable_1172e
-rept 2
-	add hl, de
-endr
-	ld a, [hli]
-	ld h, [hl]
-	ld l, a
-	jp [hl]
-; 1172e
-
-
-Jumptable_1172e: ; 1172e (4:572e)
-	dw Function1173e
-	dw Function1178d
-	dw Function117ae
-	dw Function117d1
-	dw Function117f5
-	dw Function1182c
-	dw Function1173e
-	dw Function1173e
-
-
-Function1173e: ; 1173e (4:573e)
-	ld a, [CurPartySpecies]
-	ld [wd265], a
-	ld hl, Function8e83f
-	ld a, BANK(Function8e83f)
-	ld e, $1
-	rst FarCall ;  ; indirect jump to Function8e83f (8e83f (23:683f))
-	ld a, [CurPartySpecies]
-	ld [wd265], a
-	call GetPokemonName
-	hlcoord 5, 2
-	call PlaceString
-	ld l, c
-	ld h, b
-	ld de, Strings_11780
-	call PlaceString
-	inc de
-	hlcoord 5, 4
-	call PlaceString
-	callba GetGender
-	jr c, .asm_1177c
-	ld a, $ef
-	jr nz, .asm_11778
-	ld a, $f5
-.asm_11778
-	hlcoord 1, 2
-	ld [hl], a
-.asm_1177c
-	call Function1187b
-	ret
-; 11780 (4:5780)
-
-Strings_11780: ; 11780
-	db "'S@"
-	db "NICKNAME?@"
-; 1178d
-
-Function1178d: ; 1178d (4:578d)
-	callba GetPlayerIcon
-	call Function11847
-	hlcoord 5, 2
-	ld de, String_117a3
-	call PlaceString
-	call Function11882
-	ret
-; 117a3 (4:57a3)
-
-String_117a3: ; 117a3
-	db "YOUR NAME?@"
-; 117ae
-
-Function117ae: ; 117ae (4:57ae)
-	ld de, SilverSpriteGFX
-	ld b, BANK(SilverSpriteGFX)
-	call Function11847
-	hlcoord 5, 2
-	ld de, String_117c3
-	call PlaceString
-	call Function11882
-	ret
-; 117c3 (4:57c3)
-
-String_117c3: ; 117c3
-	db "RIVAL'S NAME?@"
-; 117d1
-
-Function117d1: ; 117d1 (4:57d1)
-	ld de, MomSpriteGFX
-	ld b, BANK(MomSpriteGFX)
-	call Function11847
-	hlcoord 5, 2
-	ld de, String_117e6
-	call PlaceString
-	call Function11882
-	ret
-; 117e6 (4:57e6)
-
-String_117e6: ; 117e6
-	db "MOTHER'S NAME?@"
-; 117f5
-
-Function117f5: ; 117f5 (4:57f5)
-	ld de, PokeBallSpriteGFX
-	ld hl, VTiles0 tile $00
-	lb bc, BANK(PokeBallSpriteGFX), $4
-	call Request2bpp
-	xor a
-	ld hl, wc300
-	ld [hli], a
-	ld [hl], a
-	ld de, $2420
-	ld a, $a
-	call Function3b2a
-	ld hl, $1
-	add hl, bc
-	ld [hl], $0
-	hlcoord 5, 2
-	ld de, String_11822
-	call PlaceString
-	call Function11889
-	ret
-; 11822 (4:5822)
-
-String_11822: ; 11822
-	db "BOX NAME?@"
-; 1182c
-
-Function1182c: ; 1182c (4:582c)
-	hlcoord 3, 2
-	ld de, String_11839
-	call PlaceString
-	call Function11882
-	ret
-; 11839 (4:5839)
-
-String_11839: ; 11839
-	db "おともだち の なまえは?@"
-; 11847
-
-Function11847: ; 11847 (4:5847)
-	push de
-	ld hl, VTiles0 tile $00
-	ld c, $4
-	push bc
-	call Request2bpp
-	pop bc
-	ld hl, $c0
-	add hl, de
-	ld e, l
-	ld d, h
-	ld hl, VTiles0 tile $04
-	call Request2bpp
-	xor a
-	ld hl, wc300
-	ld [hli], a
-	ld [hl], a
-	pop de
-	ld b, $a
-	ld a, d
-	cp $7a
-	jr nz, .asm_11873
-	ld a, e
-	cp $40
-	jr nz, .asm_11873
-	ld b, $1e
-.asm_11873
-	ld a, b
-	ld de, $2420
-	call Function3b2a
-	ret
-
-Function1187b: ; 1187b (4:587b)
-	ld a, $a
-	hlcoord 5, 6
-	jr Function11890
-
-Function11882: ; 11882 (4:5882)
-	ld a, $7
-	hlcoord 5, 6
-	jr Function11890
-
-Function11889: ; 11889 (4:5889)
-	ld a, $8
-	hlcoord 5, 4
-	jr Function11890
-
-Function11890: ; 11890 (4:5890)
-	ld [wc6d3], a
-	ld a, l
-	ld [wc6d8], a
-	ld a, h
-	ld [wc6d9], a
-	ret
-
-
-Function1189c: ; 1189c
-	push bc
-	push af
-	ld a, [wc6d4]
-	sub $3
-	ld b, a
-	pop af
-	dec b
-	pop bc
-	ret
-; 118a8
-
-Function118a8: ; 118a8
-	call WaitTop
-	hlcoord 0, 0
-	ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
-	ld a, $60
-	call ByteFill
-	hlcoord 1, 1
-	lb bc, 6, 18
-	call Function1189c
-	jr nz, .asm_118c4
-	lb bc, 4, 18
-
-.asm_118c4
-	call ClearBox
-	ld de, NameInputUpper
-Function118ca: ; 118ca
-	call Function1189c
-	jr nz, .asm_118d5
-	ld hl, BoxNameInputLower - NameInputLower
-	add hl, de
-	ld d, h
-	ld e, l
-
-.asm_118d5
-	push de
-	hlcoord 1, 8
-	lb bc, 7, 18
-	call Function1189c
-	jr nz, .asm_118e7
-	hlcoord 1, 6
-	lb bc, 9, 18
-
-.asm_118e7
-	call ClearBox
-	hlcoord 1, 16
-	lb bc, 1, 18
-	call ClearBox
-	pop de
-	hlcoord 2, 8
-	ld b, $5
-	call Function1189c
-	jr nz, .asm_11903
-	hlcoord 2, 6
-	ld b, $6
-
-.asm_11903
-	ld c, $11
-.asm_11905
-	ld a, [de]
-	ld [hli], a
-	inc de
-	dec c
-	jr nz, .asm_11905
-	push de
-	ld de, $17
-	add hl, de
-	pop de
-	dec b
-	jr nz, .asm_11903
-	ret
-; 11915
-
-Function11915: ; 11915
-	call JoyTextDelay
-	ld a, [wJumptableIndex]
-	bit 7, a
-	jr nz, .asm_11930
-	call Function11968
-	callba Function8cf62
-	call Function11940
-	call DelayFrame
-	and a
-	ret
-
-.asm_11930
-	callab Function8cf53
-	call ClearSprites
-	xor a
-	ld [hSCX], a
-	ld [hSCY], a
-	scf
-	ret
-; 11940
-
-Function11940: ; 11940
-	xor a
-	ld [hBGMapMode], a
-	hlcoord 1, 5
-	call Function1189c
-	jr nz, .asm_1194e
-	hlcoord 1, 3
-
-.asm_1194e
-	lb bc, 1, 18
-	call ClearBox
-	ld hl, wc6d0
-	ld e, [hl]
-	inc hl
-	ld d, [hl]
-	ld hl, wc6d8
-	ld a, [hli]
-	ld h, [hl]
-	ld l, a
-	call PlaceString
-	ld a, $1
-	ld [hBGMapMode], a
-	ret
-; 11968
-
-Function11968: ; 11968
-	ld a, [wJumptableIndex]
-	ld e, a
-	ld d, $0
-	ld hl, Jumptable_11977
-rept 2
-	add hl, de
-endr
-	ld a, [hli]
-	ld h, [hl]
-	ld l, a
-	jp [hl]
-; 11977
-
-
-Jumptable_11977: ; 11977 (4:5977)
-	dw Function1197b
-	dw Function119a1
-
-
-Function1197b: ; 1197b (4:597b)
-	lb de, $50, $18
-	call Function1189c
-	jr nz, .asm_11985
-	ld d, $40
-.asm_11985
-	ld a, $2
-	call Function3b2a
-	ld a, c
-	ld [wc6d5], a
-	ld a, b
-	ld [wc6d6], a
-	ld hl, $1
-	add hl, bc
-	ld a, [hl]
-	ld hl, $e
-	add hl, bc
-	ld [hl], a
-	ld hl, wJumptableIndex
-	inc [hl]
-	ret
-
-Function119a1: ; 119a1 (4:59a1)
-	ld hl, hJoyPressed ; $ffa7
-	ld a, [hl]
-	and A_BUTTON
-	jr nz, .a
-	ld a, [hl]
-	and B_BUTTON
-	jr nz, .b
-	ld a, [hl]
-	and START
-	jr nz, .start
-	ld a, [hl]
-	and SELECT
-	jr nz, .select
-	ret
-
-.a
-	call Function11a0b
-	cp $1
-	jr z, .select
-	cp $2
-	jr z, .b
-	cp $3
-	jr z, .asm_119eb
-	call Function11c11
-	call Function11b14
-	ret nc
-
-.start
-	ld hl, wc6d5
-	ld c, [hl]
-	inc hl
-	ld b, [hl]
-	ld hl, $c
-	add hl, bc
-	ld [hl], $8
-	ld hl, $d
-	add hl, bc
-	ld [hl], $4
-	call Function1189c
-	ret nz
-	inc [hl]
-	ret
-
-.b
-	call Function11bbc
-	ret
-
-.asm_119eb
-	call Function11bf7
-	ld hl, wJumptableIndex
-	set 7, [hl]
-	ret
-
-.select
-	ld hl, wcf64
-	ld a, [hl]
-	xor 1
-	ld [hl], a
-	jr z, .asm_11a04
-	ld de, NameInputLower
-	call Function118ca
-	ret
-
-.asm_11a04
-	ld de, NameInputUpper
-	call Function118ca
-	ret
-
-Function11a0b: ; 11a0b (4:5a0b)
-	ld hl, wc6d5
-	ld c, [hl]
-	inc hl
-	ld b, [hl]
-
-Function11a11: ; 11a11 (4:5a11)
-	ld hl, $d
-	add hl, bc
-	ld a, [hl]
-	push bc
-	ld b, $4
-	call Function1189c
-	jr nz, .asm_11a1f
-	inc b
-.asm_11a1f
-	cp b
-	pop bc
-	jr nz, .asm_11a39
-	ld hl, $c
-	add hl, bc
-	ld a, [hl]
-	cp $3
-	jr c, .asm_11a33
-	cp $6
-	jr c, .asm_11a36
-	ld a, $3
-	ret
-.asm_11a33
-	ld a, $1
-	ret
-.asm_11a36
-	ld a, $2
-	ret
-.asm_11a39
-	xor a
-	ret
-
-Function11a3b: ; 11a3b (4:5a3b)
-	call Function11a8b
-	ld hl, $d
-	add hl, bc
-	ld a, [hl]
-	ld e, a
-	swap e
-	ld hl, $7
-	add hl, bc
-	ld [hl], e
-	ld d, $4
-	call Function1189c
-	jr nz, .asm_11a53
-	inc d
-.asm_11a53
-	cp d
-	ld de, Unknown_11a79
-	ld a, $0
-	jr nz, .asm_11a60
-	ld de, Unknown_11a82
-	ld a, $1
-.asm_11a60
-	ld hl, $e
-	add hl, bc
-	add [hl]
-	ld hl, $1
-	add hl, bc
-	ld [hl], a
-	ld hl, $c
-	add hl, bc
-	ld l, [hl]
-	ld h, $0
-	add hl, de
-	ld a, [hl]
-	ld hl, $6
-	add hl, bc
-	ld [hl], a
-	ret
-; 11a79 (4:5a79)
-
-Unknown_11a79: ; 11a79
-	db $00, $10, $20, $30, $40, $50, $60, $70, $80
-Unknown_11a82: ; 11a82
-	db $00, $00, $00, $30, $30, $30, $60, $60, $60
-; 11a8b
-
-Function11a8b: ; 11a8b (4:5a8b)
-	ld hl, hJoyLast
-	ld a, [hl]
-	and D_UP
-	jr nz, .up
-	ld a, [hl]
-	and D_DOWN
-	jr nz, .down
-	ld a, [hl]
-	and D_LEFT
-	jr nz, .left
-	ld a, [hl]
-	and D_RIGHT
-	jr nz, .right
-	ret
-.right
-	call Function11a11
-	and a
-	jr nz, .asm_11ab7
-	ld hl, $c
-	add hl, bc
-	ld a, [hl]
-	cp $8
-	jr nc, .asm_11ab4
-	inc [hl]
-	ret
-.asm_11ab4
-	ld [hl], $0
-	ret
-.asm_11ab7
-	cp $3
-	jr nz, .asm_11abc
-	xor a
-.asm_11abc
-	ld e, a
-	add a
-	add e
-	ld hl, $c
-	add hl, bc
-	ld [hl], a
-	ret
-.left
-	call Function11a11
-	and a
-	jr nz, .asm_11ad8
-	ld hl, $c
-	add hl, bc
-	ld a, [hl]
-	and a
-	jr z, .asm_11ad5
-	dec [hl]
-	ret
-.asm_11ad5
-	ld [hl], $8
-	ret
-.asm_11ad8
-	cp $1
-	jr nz, .asm_11ade
-	ld a, $4
-.asm_11ade
-rept 2
-	dec a
-endr
-	ld e, a
-	add a
-	add e
-	ld hl, $c
-	add hl, bc
-	ld [hl], a
-	ret
-.down
-	ld hl, $d
-	add hl, bc
-	ld a, [hl]
-	call Function1189c
-	jr nz, .asm_11af9
-	cp $5
-	jr nc, .asm_11aff
-	inc [hl]
-	ret
-.asm_11af9
-	cp $4
-	jr nc, .asm_11aff
-	inc [hl]
-	ret
-.asm_11aff
-	ld [hl], $0
-	ret
-.up
-	ld hl, $d
-	add hl, bc
-	ld a, [hl]
-	and a
-	jr z, .asm_11b0c
-	dec [hl]
-	ret
-.asm_11b0c
-	ld [hl], $4
-	call Function1189c
-	ret nz
-	inc [hl]
-	ret
-
-Function11b14: ; 11b14 (4:5b14)
-	ld a, [wc6d7]
-
-Function11b17: ; 11b17 (4:5b17)
-	ld a, [wc6d3]
-	ld c, a
-	ld a, [wc6d2]
-	cp c
-	ret nc
-
-	ld a, [wc6d7]
-
-Function11b23: ; 11b23
-	call Function11bd0
-	ld [hl], a
-
-Function11b27: ; 11b27
-	ld hl, wc6d2
-	inc [hl]
-	call Function11bd0
-	ld a, [hl]
-	cp $50
-	jr z, .asm_11b37
-	ld [hl], $f2
-	and a
-	ret
-.asm_11b37
-	scf
-	ret
-; 11b39 (4:5b39)
-
-Function11b39: ; 11b39
-	ld a, [wc6d2]
-	and a
-	ret z
-	push hl
-	ld hl, wc6d2
-	dec [hl]
-	call Function11bd0
-	ld c, [hl]
-	pop hl
-
-.asm_11b48
-	ld a, [hli]
-	cp $ff
-	jr z, Function11b27
-	cp c
-	jr z, .asm_11b53
-	inc hl
-	jr .asm_11b48
-
-.asm_11b53
-	ld a, [hl]
-	jr Function11b23
-; 11b56
-
-Dakutens: ; Dummied out
-	db "かが", "きぎ", "くぐ", "けげ", "こご"
-	db "さざ", "しじ", "すず", "せぜ", "そぞ"
-	db "ただ", "ちぢ", "つづ", "てで", "とど"
-	db "はば", "ひび", "ふぶ", "へべ", "ほぼ"
-	db "カガ", "キギ", "クグ", "ケゲ", "コゴ"
-	db "サザ", "シジ", "スズ", "セゼ", "ソゾ"
-	db "タダ", "チヂ", "ツヅ", "テデ", "トド"
-	db "ハバ", "ヒビ", "フブ", "へべ", "ホボ"
-	db $ff
-
-Handakutens: ; Dummied out
-	db "はぱ", "ひぴ", "ふぷ", "へぺ", "ほぽ"
-	db "ハパ", "ヒピ", "フプ", "へぺ", "ホポ"
-	db $ff
-; 11bbc
-
-Function11bbc: ; 11bbc (4:5bbc)
-	ld hl, wc6d2
-	ld a, [hl]
-	and a
-	ret z
-	dec [hl]
-	call Function11bd0
-	ld [hl], $f2
-	inc hl
-	ld a, [hl]
-	cp $f2
-	ret nz
-	ld [hl], $eb
-	ret
-
-Function11bd0: ; 11bd0 (4:5bd0)
-	push af
-	ld hl, wc6d0
-	ld a, [hli]
-	ld h, [hl]
-	ld l, a
-	ld a, [wc6d2]
-	ld e, a
-	ld d, 0
-	add hl, de
-	pop af
-	ret
-; 11be0
-
-Function11be0: ; 11be0
-; load $f2, ($eb * [wc6d3]), $50 into the dw address at wc6d0
-	ld hl, wc6d0
-	ld a, [hli]
-	ld h, [hl]
-	ld l, a
-	ld [hl], "·"
-	inc hl
-	ld a, [wc6d3]
-	dec a
-	ld c, a
-	ld a, "→"
-.loop
-	ld [hli], a
-	dec c
-	jr nz, .loop
-	ld [hl], "@"
-	ret
-; 11bf7
-
-
-Function11bf7: ; 11bf7 (4:5bf7)
-	ld hl, wc6d0
-	ld a, [hli]
-	ld h, [hl]
-	ld l, a
-	ld a, [wc6d3]
-	ld c, a
-.asm_11c01
-	ld a, [hl]
-	cp $eb
-	jr z, .asm_11c0a
-	cp $f2
-	jr nz, .asm_11c0c
-.asm_11c0a
-	ld [hl], $50
-.asm_11c0c
-	inc hl
-	dec c
-	jr nz, .asm_11c01
-	ret
-
-Function11c11: ; 11c11 (4:5c11)
-	ld hl, wc6d5
-	ld c, [hl]
-	inc hl
-	ld b, [hl]
-	ld hl, $6
-	add hl, bc
-	ld a, [hl]
-	ld hl, $4
-	add hl, bc
-	add [hl]
-	sub $8
-	srl a
-	srl a
-	srl a
-	ld e, a
-	ld hl, $7
-	add hl, bc
-	ld a, [hl]
-	ld hl, $5
-	add hl, bc
-	add [hl]
-	sub $10
-	srl a
-	srl a
-	srl a
-	ld d, a
-	hlcoord 0, 0
-	ld bc, $14
-.asm_11c43
-	ld a, d
-	and a
-	jr z, .asm_11c4b
-	add hl, bc
-	dec d
-	jr .asm_11c43
-.asm_11c4b
-	add hl, de
-	ld a, [hl]
-	ld [wc6d7], a
-	ret
-
-
-Function11c51: ; 11c51
-	call ClearSprites
-	callab Function8cf53
-	call LoadStandardFont
-	call LoadFontsExtra
-
-	ld de, GFX_11e65
-	ld hl, VTiles1 tile $6b
-	lb bc, BANK(GFX_11e65), 1
-	call Get1bpp
-
-	ld de, GFX_11e6d
-	ld hl, VTiles1 tile $72
-	lb bc, BANK(GFX_11e6d), 1
-	call Get1bpp
-
-	ld de, VTiles2 tile $60
-	ld hl, GFX_11cb7
-	ld bc, $10
-	ld a, BANK(GFX_11cb7)
-	call FarCopyBytes
-
-	ld de, VTiles0 tile $7e
-	ld hl, GFX_11cc7
-	ld bc, $20
-	ld a, BANK(GFX_11cc7)
-	call FarCopyBytes
-
-	ld a, $5
-	ld hl, wc312
-	ld [hli], a
-	ld [hl], $7e
-	xor a
-	ld [hSCY], a
-	ld [wc3bf], a
-	ld [hSCX], a
-	ld [wc3c0], a
-	ld [wJumptableIndex], a
-	ld [wcf64], a
-	ld [hBGMapMode], a
-	ld [wc6d2], a
-	ld a, $7
-	ld [hWX], a
-	ret
-; 11cb7
-
-GFX_11cb7: ; 11cb7
-INCBIN "gfx/unknown/011cb7.2bpp"
-; 11cc7
-
-GFX_11cc7: ; 11cc7
-INCBIN "gfx/unknown/011cc7.2bpp"
-; 11ce7
-
-NameInputLower:
-	db "a b c d e f g h i"
-	db "j k l m n o p q r"
-	db "s t u v w x y z  "
-	db "× ( ) : ; [ ] <PK> <MN>"
-	db "UPPER  DEL   END "
-BoxNameInputLower:
-	db "a b c d e f g h i"
-	db "j k l m n o p q r"
-	db "s t u v w x y z  "
-	db "é 'd 'l 'm 'r 's 't 'v 0"
-	db "1 2 3 4 5 6 7 8 9"
-	db "UPPER  DEL   END "
-NameInputUpper: ; Unreferenced?
-	db "A B C D E F G H I"
-	db "J K L M N O P Q R"
-	db "S T U V W X Y Z  "
-	db "- ? ! / . ,      "
-	db "lower  DEL   END "
-BoxNameInputUpper:
-	db "A B C D E F G H I"
-	db "J K L M N O P Q R"
-	db "S T U V W X Y Z  "
-	db "× ( ) : ; [ ] <PK> <MN>"
-	db "- ? ! ♂ ♀ / . , &"
-	db "lower  DEL   END "
-; 11e5d
-
-GFX_11e5d: ; ????
-INCBIN "gfx/unknown/011e5d.2bpp"
-; 11e6d
-
-GFX_11e65:
-INCBIN "gfx/unknown/011e65.2bpp"
-; 11e6d
-
-GFX_11e6d: ; 11e6d
-INCBIN "gfx/unknown/011e6d.2bpp"
-; 11e75
-
 Function11e75: ; 11e75 (4:5e75)
 	ld hl, wc6d0
 	ld [hl], e
@@ -11922,7 +10851,7 @@
 	db "K L M N O P Q R S T"
 	db "U V W X Y Z   , ? !"
 	db "1 2 3 4 5 6 7 8 9 0"
-	db "ゅ ょ ", $70, " ", $71, " é ♂ ♀ ¥ … ×"
+	db "<PK> <MN> <PO> <KE> é ♂ ♀ ¥ … ×"
 	db "lower  DEL   END   "
 ; 1224f
 
@@ -11931,3010 +10860,28 @@
 	db "k l m n o p q r s t"
 	db "u v w x y z   . - /"
 	db "'d 'l 'm 'r 's 't 'v & ( )"
-	db $72, " ", $73, " [ ] ' : ;      "
+	db "<``> <''> [ ] ' : ;      "
 	db "UPPER  DEL   END   "
 ; 122c1
 
-UnknownScript_0x122c1: ; 0x122c1
+Script_AbortBugContest: ; 0x122c1
 	checkflag ENGINE_BUG_CONTEST_TIMER
-	iffalse .script_122cd
+	iffalse .finish
 	setflag ENGINE_DAILY_BUG_CONTEST
 	special ContestReturnMons
-.script_122cd
+.finish
 	end
 ; 0x122ce
 
-FindItemInBallScript:: ; 0x122ce
-	callasm Function122f8
-	iffalse NoRoomForItemInBallScript
-	disappear LAST_TALKED
-	loadfont
-	writetext UnknownText_0x122ee
-	playsound SFX_ITEM
-	pause 60
-	itemnotify
-	loadmovesprites
-	end
-; 0x122e3
-
-NoRoomForItemInBallScript: ; 0x122e3
-	loadfont
-	writetext UnknownText_0x122ee
-	closetext
-	writetext UnknownText_0x122f3
-	closetext
-	loadmovesprites
-	end
-; 0x122ee
-
-UnknownText_0x122ee: ; 0x122ee
-	; found @ !
-	text_jump UnknownText_0x1c0a1c
-	db "@"
-; 0x122f3
-
-UnknownText_0x122f3: ; 0x122f3
-	; But   can't carry any more items.
-	text_jump UnknownText_0x1c0a2c
-	db "@"
-; 0x122f8
-
-Function122f8: ; 122f8
-	xor a
-	ld [ScriptVar], a
-	ld a, [EngineBuffer1]
-	ld [wd265], a
-	call GetItemName
-	ld hl, StringBuffer3
-	call CopyName2
-	ld a, [EngineBuffer1]
-	ld [CurItem], a
-	ld a, [CurFruit]
-	ld [wItemQuantityChangeBuffer], a
-	ld hl, NumItems
-	call ReceiveItem
-	ret nc
-	ld a, $1
-	ld [ScriptVar], a
-	ret
-; 12324
-
-HealMachineAnim: ; 12324
-	; If you have no Pokemon, don't change the buffer.  This can lead to some glitchy effects if you have no Pokemon.
-	ld a, [PartyCount]
-	and a
-	ret z
-	; The location of the healing machine relative to the player is stored in ScriptVar.
-	; 0: Up and left (Pokemon Center)
-	; 1: Left (Elm's Lab)
-	; 2: Up (Hall of Fame)
-	ld a, [ScriptVar]
-	ld [Buffer1], a
-	ld a, [rOBP1]
-	ld [Buffer2], a
-	call Function1233e
-	ld a, [Buffer2]
-	call Functiond24
-	ret
-; 1233e
-
-Function1233e: ; 1233e
-	xor a
-	ld [wd1ec], a
-.asm_12342
-	ld a, [Buffer1]
-	ld e, a
-	ld d, 0
-	ld hl, Unknown_12365
-rept 2
-	add hl, de
-endr
-	ld a, [hli]
-	ld h, [hl]
-	ld l, a
-	ld a, [wd1ec]
-	ld e, a
-	inc a
-	ld [wd1ec], a
-	add hl, de
-	ld a, [hl]
-	cp 5
-	jr z, .asm_12364
-	ld hl, Jumptable_12377
-	rst JumpTable
-	jr .asm_12342
-
-.asm_12364
-	ret
-; 12365
-
-Unknown_12365: ; 12365
-	dw Unknown_1236b
-	dw Unknown_1236f
-	dw Unknown_12373
-; 1236b
-
-Unknown_1236b: ; 1236b
-	db 0, 1, 3, 5
-Unknown_1236f: ; 1236f
-	db 0, 1, 3, 5
-Unknown_12373: ; 12373
-	db 0, 2, 4, 5
-; 12377
-
-Jumptable_12377: ; 12377
-	dw Function12383
-	dw Function12393
-	dw Function123a1
-	dw Function123bf
-	dw Function123c8
-	dw Function123db
-; 12383
-
-Function12383: ; 12383
-	call Function12434
-	ld de, GFX_123fc
-	ld hl, VTiles0 tile $7c
-	lb bc, BANK(GFX_123fc), $2
-	call Request2bpp
-	ret
-; 12393
-
-Function12393: ; 12393
-	ld hl, Sprites + $80
-	ld de, Unknown_123dc
-	call Function124a3
-	call Function124a3
-	jr Function123a7
-
-Function123a1: ; 123a1
-	ld hl, Sprites + $80
-	ld de, Unknown_1241c
-
-Function123a7: ; 123a7
-	ld a, [PartyCount]
-	ld b, a
-.asm_123ab
-	call Function124a3
-	push de
-	ld de, SFX_SECOND_PART_OF_ITEMFINDER
-	call PlaySFX
-	pop de
-	ld c, 30
-	call DelayFrames
-	dec b
-	jr nz, .asm_123ab
-	ret
-; 123bf
-
-Function123bf: ; 123bf
-	ld de, MUSIC_HEAL
-	call PlayMusic
-	jp Function12459
-; 123c8
-
-Function123c8: ; 123c8
-	ld de, SFX_GAME_FREAK_LOGO_GS
-	call PlaySFX
-	call Function12459
-	call WaitSFX
-	ld de, SFX_BOOT_PC
-	call PlaySFX
-	ret
-; 123db
-
-Function123db: ; 123db
-	ret
-; 123dc
-
-Unknown_123dc: ; 123dc
-	db $20, $22, $7c, $16
-	db $20, $26, $7c, $16
-	db $26, $20, $7d, $16
-	db $26, $28, $7d, $36
-	db $2b, $20, $7d, $16
-	db $2b, $28, $7d, $36
-	db $30, $20, $7d, $16
-	db $30, $28, $7d, $36
-; 123fc
-
-GFX_123fc: ; 123fc
-INCBIN "gfx/unknown/0123fc.2bpp"
-; 1241c
-
-Unknown_1241c: ; 1241c
-	db $3c, $51, $7d, $16
-	db $3c, $56, $7d, $16
-	db $3b, $4d, $7d, $16
-	db $3b, $5a, $7d, $16
-	db $39, $49, $7d, $16
-	db $39, $5d, $7d, $16
-; 12434
-
-Function12434: ; 12434
-	call IsCGB
-	jr nz, .asm_1243e
-	ld a, $e0
-	ld [rOBP1], a
-	ret
-
-.asm_1243e
-	ld hl, Palette_12451
-	ld de, OBPals + 8 * 6
-	ld bc, 8
-	ld a, $5
-	call FarCopyWRAM
-	ld a, $1
-	ld [hCGBPalUpdate], a
-	ret
-; 12451
-
-Palette_12451: ; 12451
-	RGB 31, 31, 31
-	RGB 31, 19, 10
-	RGB 31, 07, 01
-	RGB 00, 00, 00
-; 12459
-
-Function12459: ; 12459
-	ld c, $8
-.asm_1245b
-	push bc
-	call Function12469
-	ld c, 10
-	call DelayFrames
-	pop bc
-	dec c
-	jr nz, .asm_1245b
-	ret
-; 12469
-
-Function12469: ; 12469
-	call IsCGB
-	jr nz, .asm_12475
-	ld a, [rOBP1]
-	xor $28
-	ld [rOBP1], a
-	ret
-
-.asm_12475
-	ld a, [rSVBK]
-	push af
-	ld a, $5
-	ld [rSVBK], a
-
-	ld hl, OBPals + 8 * 6
-	ld a, [hli]
-	ld e, a
-	ld a, [hli]
-	ld d, a
-	push de
-	ld c, $3
-.asm_12486
-	ld a, [hli]
-	ld e, a
-	ld a, [hld]
-	ld d, a
-	dec hl
-	ld a, d
-	ld [hld], a
-	ld a, e
-	ld [hli], a
-rept 3
-	inc hl
-endr
-	dec c
-	jr nz, .asm_12486
-	pop de
-	dec hl
-	ld a, d
-	ld [hld], a
-	ld a, e
-	ld [hl], a
-
-	pop af
-	ld [rSVBK], a
-	ld a, $1
-	ld [hCGBPalUpdate], a
-	ret
-; 124a3
-
-Function124a3: ; 124a3
-	push bc
-	ld a, [Buffer1]
-	lb bc, $10, $20
-	cp $1
-	jr z, .asm_124b1
-	lb bc, $00, $00
-
-.asm_124b1
-	ld a, [de]
-	add c
-	inc de
-	ld [hli], a
-	ld a, [de]
-	add b
-	inc de
-	ld [hli], a
-	ld a, [de]
-	inc de
-	ld [hli], a
-	ld a, [de]
-	inc de
-	ld [hli], a
-	pop bc
-	ret
-; 124c1
-
-UnknownScript_0x124c1:: ; 0x124c1
-	callasm Function1250a
-	jump UnknownScript_0x124ce
-; 0x124c8
-
-UnknownScript_0x124c8:: ; 0x124c8
-	refreshscreen $0
-	callasm Function124fa
-
-UnknownScript_0x124ce: ; 0x124ce
-	writetext UnknownText_0x124f5
-	closetext
-	special FadeBlackBGMap
-	pause 40
-	special HealParty
-	checkflag ENGINE_BUG_CONTEST_TIMER
-	iftrue .script_64f2
-	callasm HalveMoney
-	callasm Function12527
-	farscall UnknownScript_0x122c1
-	special WarpToSpawnPoint
-	newloadmap MAPSETUP_WARP
-	resetfuncs
-
-.script_64f2
-	jumpstd bugcontestresultswarp
-; 0x124f5
-
-UnknownText_0x124f5: ; 0x124f5
-	; is out of useable #MON!  whited out!
-	text_jump UnknownText_0x1c0a4e
-	db "@"
-; 0x124fa
-
-Function124fa: ; 124fa
-	call ClearPalettes
-	call ClearScreen
-	call Function3200
-	call HideSprites
-	call Function4f0
-	ret
-; 1250a
-
-Function1250a: ; 1250a
-	ld b, $0
-	call GetSGBLayout
-	call SetPalettes
-	ret
-; 12513
-
-HalveMoney: ; 12513
-
-; Empty function...
-	callba MobileFn_1060c7
-
-; Halve the player's money.
-	ld hl, Money
-	ld a, [hl]
-	srl a
-	ld [hli], a
-	ld a, [hl]
-	rra
-	ld [hli], a
-	ld a, [hl]
-	rra
-	ld [hl], a
-	ret
-; 12527
-
-
-Function12527: ; 12527
-	ld a, [wdcb2]
-	ld d, a
-	ld a, [wdcb3]
-	ld e, a
-	callba IsSpawnPoint
-	ld a, c
-	jr c, .yes
-	xor a
-
-.yes
-	ld [wd001], a
-	ret
-; 1253d
-
-Script_ForcedMovement:: ; 0x1253d
-	checkcode VAR_FACING
-	if_equal DOWN, UnknownScript_0x12555
-	if_equal UP, UnknownScript_0x12550
-	if_equal LEFT, UnknownScript_0x1255f
-	if_equal RIGHT, UnknownScript_0x1255a
-	end
-; 0x12550
-
-UnknownScript_0x12550: ; 0x12550
-	applymovement PLAYER, MovementData_0x12564
-	end
-; 0x12555
-
-UnknownScript_0x12555: ; 0x12555
-	applymovement PLAYER, MovementData_0x1256b
-	end
-; 0x1255a
-
-UnknownScript_0x1255a: ; 0x1255a
-	applymovement PLAYER, MovementData_0x12572
-	end
-; 0x1255f
-
-UnknownScript_0x1255f: ; 0x1255f
-	applymovement PLAYER, MovementData_0x12579
-	end
-; 0x12564
-
-MovementData_0x12564: ; 0x12564
-	step_wait5
-	big_step_down
-	turn_in_down
-	step_wait5
-	big_step_down
-	turn_head_down
-	step_end
-; 0x1256b
-
-MovementData_0x1256b: ; 0x1256b
-	step_wait5
-	big_step_down
-	turn_in_up
-	step_wait5
-	big_step_down
-	turn_head_up
-	step_end
-; 0x12572
-
-MovementData_0x12572: ; 0x12572
-	step_wait5
-	big_step_down
-	turn_in_left
-	step_wait5
-	big_step_down
-	turn_head_left
-	step_end
-; 0x12579
-
-MovementData_0x12579: ; 0x12579
-	step_wait5
-	big_step_down
-	turn_in_right
-	step_wait5
-	big_step_down
-	turn_head_right
-	step_end
-; 0x12580
-
-
-ItemFinder: ; 12580
-	callba CheckForSignpostItems
-	jr c, .asm_1258d
-	ld hl, UnknownScript_0x125ba
-	jr .asm_12590
-
-.asm_1258d
-	ld hl, UnknownScript_0x125ad
-
-.asm_12590
-	call QueueScript
-	ld a, $1
-	ld [wd0ec], a
-	ret
-; 12599
-
-Function12599: ; 12599
-	ld c, $4
-.asm_1259b
-	push bc
-	ld de, SFX_SECOND_PART_OF_ITEMFINDER
-	call WaitPlaySFX
-	ld de, SFX_TRANSACTION
-	call WaitPlaySFX
-	pop bc
-	dec c
-	jr nz, .asm_1259b
-	ret
-; 125ad
-
-UnknownScript_0x125ad: ; 0x125ad
-	reloadmappart
-	special UpdateTimePals
-	callasm Function12599
-	writetext UnknownText_0x125c3
-	loadmovesprites
-	end
-; 0x125ba
-
-UnknownScript_0x125ba: ; 0x125ba
-	reloadmappart
-	special UpdateTimePals
-	writetext UnknownText_0x125c8
-	loadmovesprites
-	end
-; 0x125c3
-
-UnknownText_0x125c3: ; 0x125c3
-	; Yes! ITEMFINDER indicates there's an item nearby.
-	text_jump UnknownText_0x1c0a77
-	db "@"
-; 0x125c8
-
-UnknownText_0x125c8: ; 0x125c8
-	; Nope! ITEMFINDER isn't responding.
-	text_jump UnknownText_0x1c0aa9
-	db "@"
-; 0x125cd
-
-
-StartMenu:: ; 125cd
-
-	call ResetTextRelatedRAM
-
-	ld de, SFX_MENU
-	call PlaySFX
-
-	callba Function6454
-
-	ld hl, StatusFlags2
-	bit 2, [hl] ; bug catching contest
-	ld hl, .MenuDataHeader
-	jr z, .GotMenuData
-	ld hl, .ContestMenuDataHeader
-.GotMenuData
-
-	call LoadMenuDataHeader
-	call .SetUpMenuItems
-	ld a, [wd0d2]
-	ld [wMenuCursorBuffer], a
-	call .DrawMenuAccount_
-	call MenuFunc_1e7f
-	call .DrawBugContestStatusBox
-	call Function2e31
-	call Function2e20
-	callba Function64bf
-	call .DrawBugContestStatus
-	call UpdateTimePals
-	jr .Select
-
-.Reopen
-	call UpdateSprites
-	call UpdateTimePals
-	call .SetUpMenuItems
-	ld a, [wd0d2]
-	ld [wMenuCursorBuffer], a
-
-.Select
-	call .GetInput
-	jr c, .Exit
-	call .DrawMenuAccount
-	ld a, [wMenuCursorBuffer]
-	ld [wd0d2], a
-	call PlayClickSFX
-	call Function1bee
-	call .OpenMenu
-
-; Menu items have different return functions.
-; For example, saving exits the menu.
-	ld hl, .MenuReturns
-	ld e, a
-	ld d, 0
-rept 2
-	add hl, de
-endr
-	ld a, [hli]
-	ld h, [hl]
-	ld l, a
-	jp [hl]
-
-.MenuReturns
-	dw .Reopen
-	dw .Exit
-	dw .ExitMenuCallFuncLoadMoveSprites
-	dw .ExitMenuRunScriptLoadMoveSprites
-	dw .ExitMenuRunScript
-	dw .ReturnEnd
-	dw .ReturnRedraw
-
-.Exit
-	ld a, [hOAMUpdate]
-	push af
-	ld a, 1
-	ld [hOAMUpdate], a
-	call LoadFontsExtra
-	pop af
-	ld [hOAMUpdate], a
-.ReturnEnd
-	call ExitMenu
-.ReturnEnd2
-	call LoadMoveSprites
-	call UpdateTimePals
-	ret
-
-.GetInput
-; Return carry on exit, and no-carry on selection.
-	xor a
-	ld [hBGMapMode], a
-	call .DrawMenuAccount
-	call SetUpMenu
-	ld a, $ff
-	ld [MenuSelection], a
-.loop
-	call .PrintMenuAccount
-	call Function1f1a
-	ld a, [wcf73]
-	cp B_BUTTON
-	jr z, .b
-	cp A_BUTTON
-	jr z, .a
-	jr .loop
-.a
-	call PlayClickSFX
-	and a
-	ret
-.b
-	scf
-	ret
-; 12691
-
-.ExitMenuRunScript ; 12691
-	call ExitMenu
-	ld a, HMENURETURN_SCRIPT
-	ld [hMenuReturn], a
-	ret
-; 12699
-
-.ExitMenuRunScriptLoadMoveSprites ; 12699
-	call ExitMenu
-	ld a, HMENURETURN_SCRIPT
-	ld [hMenuReturn], a
-	jr .ReturnEnd2
-; 126a2
-
-.ExitMenuCallFuncLoadMoveSprites ; 126a2
-	call ExitMenu
-	ld hl, wQueuedScriptAddr
-	ld a, [hli]
-	ld h, [hl]
-	ld l, a
-	ld a, [wQueuedScriptBank]
-	rst FarCall
-	jr .ReturnEnd2
-; 126b1
-
-.ReturnRedraw ; 126b1
-	call .Clear
-	jp .Reopen
-; 126b7
-
-.Clear ; 126b7
-	call WhiteBGMap
-	call Call_ExitMenu
-	call Function2bae
-	call .DrawMenuAccount_
-	call MenuFunc_1e7f
-	call .DrawBugContestStatus
-	call UpdateSprites
-	call Functiond90
-	call Function2b5c
-	ret
-; 126d3
-
-
-.MenuDataHeader
-	db $40 ; tile backup
-	db 0, 10 ; start coords
-	db 17, 19 ; end coords
-	dw .MenuData
-	db 1 ; default selection
-
-.ContestMenuDataHeader
-	db $40 ; tile backup
-	db 2, 10 ; start coords
-	db 17, 19 ; end coords
-	dw .MenuData
-	db 1 ; default selection
-
-.MenuData
-	db %10101000 ; x padding, wrap around, start can close
-	dn 0, 0 ; rows, columns
-	dw MenuItemsList
-	dw .MenuString
-	dw .Items
-
-.Items
-	dw StartMenu_Pokedex,  .PokedexString,  .PokedexDesc
-	dw StartMenu_Pokemon,  .PartyString,    .PartyDesc
-	dw StartMenu_Pack,     .PackString,     .PackDesc
-	dw StartMenu_Status,   .StatusString,   .StatusDesc
-	dw StartMenu_Save,     .SaveString,     .SaveDesc
-	dw StartMenu_Option,   .OptionString,   .OptionDesc
-	dw StartMenu_Exit,     .ExitString,     .ExitDesc
-	dw StartMenu_Pokegear, .PokegearString, .PokegearDesc
-	dw StartMenu_Quit,     .QuitString,     .QuitDesc
-
-.PokedexString 	db "#DEX@"
-.PartyString   	db "#MON@"
-.PackString    	db "PACK@"
-.StatusString  	db "<PLAYER>@"
-.SaveString    	db "SAVE@"
-.OptionString  	db "OPTION@"
-.ExitString    	db "EXIT@"
-.PokegearString	db $24, "GEAR@"
-.QuitString    	db "QUIT@"
-
-.PokedexDesc  db   "#MON"
-              next "database@"
-
-.PartyDesc    db   "Party ", $4a
-              next "status@"
-
-.PackDesc     db   "Contains"
-              next "items@"
-
-.PokegearDesc db   "Trainer's"
-              next "key device@"
-
-.StatusDesc   db   "Your own"
-              next "status@"
-
-.SaveDesc     db   "Save your"
-              next "progress@"
-
-.OptionDesc   db   "Change"
-              next "settings@"
-
-.ExitDesc     db   "Close this"
-              next "menu@"
-
-.QuitDesc     db   "Quit and"
-              next "be judged.@"
-
-
-.OpenMenu ; 127e5
-	ld a, [MenuSelection]
-	call .GetMenuAccountTextPointer
-	ld a, [hli]
-	ld h, [hl]
-	ld l, a
-	jp [hl]
-; 127ef
-
-.MenuString ; 127ef
-	push de
-	ld a, [MenuSelection]
-	call .GetMenuAccountTextPointer
-rept 2
-	inc hl
-endr
-	ld a, [hli]
-	ld d, [hl]
-	ld e, a
-	pop hl
-	call PlaceString
-	ret
-; 12800
-
-.MenuDesc ; 12800
-	push de
-	ld a, [MenuSelection]
-	cp $ff
-	jr z, .none
-	call .GetMenuAccountTextPointer
-rept 4
-	inc hl
-endr
-	ld a, [hli]
-	ld d, [hl]
-	ld e, a
-	pop hl
-	call PlaceString
-	ret
-.none
-	pop de
-	ret
-; 12819
-
-
-.GetMenuAccountTextPointer ; 12819
-	ld e, a
-	ld d, 0
-	ld hl, wcf97
-	ld a, [hli]
-	ld h, [hl]
-	ld l, a
-rept 6
-	add hl, de
-endr
-	ret
-; 12829
-
-
-.SetUpMenuItems ; 12829
-	xor a
-	ld [wcf76], a
-	call .FillMenuList
-
-	ld hl, StatusFlags
-	bit 0, [hl]
-	jr z, .no_pokedex
-	ld a, 0 ; pokedex
-	call .AppendMenuList
-.no_pokedex
-
-	ld a, [PartyCount]
-	and a
-	jr z, .no_pokemon
-	ld a, 1 ; pokemon
-	call .AppendMenuList
-.no_pokemon
-
-	ld a, [wLinkMode]
-	and a
-	jr nz, .no_pack
-	ld hl, StatusFlags2
-	bit 2, [hl] ; bug catching contest
-	jr nz, .no_pack
-	ld a, 2 ; pack
-	call .AppendMenuList
-.no_pack
-
-	ld hl, wPokegearFlags
-	bit 7, [hl]
-	jr z, .no_pokegear
-	ld a, 7 ; pokegear
-	call .AppendMenuList
-.no_pokegear
-
-	ld a, 3 ; status
-	call .AppendMenuList
-
-	ld a, [wLinkMode]
-	and a
-	jr nz, .no_save
-	ld hl, StatusFlags2
-	bit 2, [hl] ; bug catching contest
-	ld a, 8 ; quit
-	jr nz, .write
-	ld a, 4 ; save
-.write
-	call .AppendMenuList
-.no_save
-
-	ld a, 5 ; option
-	call .AppendMenuList
-	ld a, 6 ; exit
-	call .AppendMenuList
-	ld a, c
-	ld [MenuItemsList], a
-	ret
-; 1288d
-
-
-.FillMenuList ; 1288d
-	xor a
-	ld hl, MenuItemsList
-	ld [hli], a
-	ld a, -1
-	ld bc, MenuItemsListEnd - (MenuItemsList + 1)
-	call ByteFill
-	ld de, MenuItemsList + 1
-	ld c, 0
-	ret
-; 128a0
-
-.AppendMenuList ; 128a0
-	ld [de], a
-	inc de
-	inc c
-	ret
-; 128a4
-
-.DrawMenuAccount_ ; 128a4
-	jp .DrawMenuAccount
-; 128a7
-
-.PrintMenuAccount ; 128a7
-	call .IsMenuAccountOn
-	ret z
-	call .DrawMenuAccount
-	decoord 0, 14
-	jp .MenuDesc
-; 128b4
-
-.DrawMenuAccount ; 128b4
-	call .IsMenuAccountOn
-	ret z
-	hlcoord 0, 13
-	lb bc, 5, 10
-	call ClearBox
-	hlcoord 0, 13
-	ld b, 3
-	ld c, 8
-	jp TextBoxPalette
-; 128cb
-
-.IsMenuAccountOn ; 128cb
-	ld a, [Options2]
-	and 1
-	ret
-; 128d1
-
-.DrawBugContestStatusBox ; 128d1
-	ld hl, StatusFlags2
-	bit 2, [hl] ; bug catching contest
-	ret z
-	callba Function24bdc
-	ret
-; 128de
-
-.DrawBugContestStatus ; 128de
-	ld hl, StatusFlags2
-	bit 2, [hl] ; bug catching contest
-	jr nz, .contest
-	ret
-.contest
-	callba Function24be7
-	ret
-; 128ed
-
-
-StartMenu_Exit: ; 128ed
-; Exit the menu.
-
-	ld a, 1
-	ret
-; 128f0
-
-
-StartMenu_Quit: ; 128f0
-; Retire from the bug catching contest.
-
-	ld hl, .EndTheContestText
-	call Function12cf5
-	jr c, .DontEndContest
-	ld a, BANK(BugCatchingContestReturnToGateScript)
-	ld hl, BugCatchingContestReturnToGateScript
-	call FarQueueScript
-	ld a, 4
-	ret
-
-.DontEndContest
-	ld a, 0
-	ret
-
-.EndTheContestText
-	text_jump UnknownText_0x1c1a6c
-	db "@"
-; 1290b
-
-
-StartMenu_Save: ; 1290b
-; Save the game.
-
-	call BufferScreen
-	callba Function14a1a
-	jr nc, .asm_12919
-	ld a, 0
-	ret
-.asm_12919
-	ld a, 1
-	ret
-; 1291c
-
-
-StartMenu_Option: ; 1291c
-; Game options.
-
-	call FadeToMenu
-	callba OptionsMenu
-	ld a, 6
-	ret
-; 12928
-
-
-StartMenu_Status: ; 12928
-; Player status.
-
-	call FadeToMenu
-	callba Function25105
-	call Function2b3c
-	ld a, 0
-	ret
-; 12937
-
-
-StartMenu_Pokedex: ; 12937
-
-	ld a, [PartyCount]
-	and a
-	jr z, .asm_12949
-
-	call FadeToMenu
-	callba Pokedex
-	call Function2b3c
-
-.asm_12949
-	ld a, 0
-	ret
-; 1294c
-
-
-StartMenu_Pokegear: ; 1294c
-
-	call FadeToMenu
-	callba Function90b8d
-	call Function2b3c
-	ld a, 0
-	ret
-; 1295b
-
-
-StartMenu_Pack: ; 1295b
-
-	call FadeToMenu
-	callba Pack
-	ld a, [wcf66]
-	and a
-	jr nz, .asm_12970
-	call Function2b3c
-	ld a, 0
-	ret
-.asm_12970
-	call Function2b4d
-	ld a, 4
-	ret
-; 12976
-
-
-StartMenu_Pokemon: ; 12976
-
-	ld a, [PartyCount]
-	and a
-	jr z, .return
-
-	call FadeToMenu
-
-.choosemenu
-	xor a
-	ld [PartyMenuActionText], a ; Choose a POKéMON.
-	call WhiteBGMap
-
-.menu
-	callba Function5004f
-	callba Function50405
-	callba Function503e0
-
-.menunoreload
-	callba WritePartyMenuTilemap
-	callba PrintPartyMenuText
-	call WaitBGMap
-	call SetPalettes ; load regular palettes?
-	call DelayFrame
-	callba PartyMenuSelect
-	jr c, .return ; if cancelled or pressed B
-
-	call PokemonActionSubmenu
-	cp 3
-	jr z, .menu
-	cp 0
-	jr z, .choosemenu
-	cp 1
-	jr z, .menunoreload
-	cp 2
-	jr z, .quit
-
-.return
-	call Function2b3c
-	ld a, 0
-	ret
-
-.quit
-	ld a, b
-	push af
-	call Function2b4d
-	pop af
-	ret
-; 129d5
-
-Function129d5: ; 129d5
-	ld a, [NumItems]
-	and a
-	ret nz
-	ld a, [NumKeyItems]
-	and a
-	ret nz
-	ld a, [NumBalls]
-	and a
-	ret nz
-	ld hl, TMsHMs
-	ld b, NUM_TMS + NUM_HMS
-.asm_129e9
-	ld a, [hli]
-	and a
-	jr nz, .asm_129f2
-	dec b
-	jr nz, .asm_129e9
-	scf
-	ret
-.asm_129f2
-	and a
-	ret
-
-Function129f4: ; 129f4
-	push de
-	call PartyMonItemName
-	callba _CheckTossableItem
-	ld a, [wItemAttributeParamBuffer]
-	and a
-	jr nz, .asm_12a3f
-	ld hl, UnknownText_0x12a45
-	call MenuTextBox
-	callba Function24fbf
-	push af
-	call WriteBackup
-	call ExitMenu
-	pop af
-	jr c, .asm_12a42
-	ld hl, UnknownText_0x12a4a
-	call MenuTextBox
-	call YesNoBox
-	push af
-	call ExitMenu
-	pop af
-	jr c, .asm_12a42
-	pop hl
-	ld a, [wd107]
-	call TossItem
-	call PartyMonItemName
-	ld hl, UnknownText_0x12a4f
-	call MenuTextBox
-	call ExitMenu
-	and a
-	ret
-.asm_12a3f
-	call Function12a54
-.asm_12a42
-	pop hl
-	scf
-	ret
-; 12a45 (4:6a45)
-
-UnknownText_0x12a45: ; 0x12a45
-	; Toss out how many @ (S)?
-	text_jump UnknownText_0x1c1a90
-	db "@"
-; 0x12a4a
-
-UnknownText_0x12a4a: ; 0x12a4a
-	; Throw away @ @ (S)?
-	text_jump UnknownText_0x1c1aad
-	db "@"
-; 0x12a4f
-
-UnknownText_0x12a4f: ; 0x12a4f
-	; Discarded @ (S).
-	text_jump UnknownText_0x1c1aca
-	db "@"
-; 0x12a54
-
-Function12a54: ; 12a54 (4:6a54)
-	ld hl, UnknownText_0x12a5b
-	call MenuTextBoxBackup
-	ret
-; 12a5b (4:6a5b)
-
-UnknownText_0x12a5b: ; 0x12a5b
-	; That's too impor- tant to toss out!
-	text_jump UnknownText_0x1c1adf
-	db "@"
-; 0x12a60
-
-CantUseItem: ; 12a60
-	ld hl, CantUseItemText
-	call Function2012
-	ret
-; 12a67
-
-CantUseItemText: ; 12a67
-	text_jump UnknownText_0x1c1b03
-	db "@"
-; 12a6c
-
-
-PartyMonItemName: ; 12a6c
-	ld a, [CurItem]
-	ld [wd265], a
-	call GetItemName
-	call CopyName1
-	ret
-; 12a79
-
-
-CancelPokemonAction: ; 12a79
-	callba Function50405
-	callba Function8ea71
-	ld a, 1
-	ret
-; 12a88
-
-
-PokemonActionSubmenu: ; 12a88
-	hlcoord 1, 15
-	lb bc, 2, 18
-	call ClearBox
-	callba MonSubmenu
-	call GetCurNick
-	ld a, [MenuSelection]
-	ld hl, .Actions
-	ld de, 3
-	call IsInArray
-	jr nc, .nothing
-
-	inc hl
-	ld a, [hli]
-	ld h, [hl]
-	ld l, a
-	jp [hl]
-
-.nothing
-	ld a, 0
-	ret
-
-.Actions
-	dbw MONMENU_CUT,        MonMenu_Cut ; Cut
-	dbw MONMENU_FLY,        MonMenu_Fly ; Fly
-	dbw MONMENU_SURF,       MonMenu_Surf ; Surf
-	dbw MONMENU_STRENGTH,   MonMenu_Strength ; Strength
-	dbw MONMENU_FLASH,      MonMenu_Flash ; Flash
-	dbw MONMENU_WHIRLPOOL,  MonMenu_Whirlpool ; Whirlpool
-	dbw MONMENU_DIG,        MonMenu_Dig ; Dig
-	dbw MONMENU_TELEPORT,   MonMenu_Teleport ; Teleport
-	dbw MONMENU_SOFTBOILED, MonMenu_Softboiled_MilkDrink ; Softboiled
-	dbw MONMENU_MILKDRINK,  MonMenu_Softboiled_MilkDrink ; MilkDrink
-	dbw MONMENU_HEADBUTT,   MonMenu_Headbutt ; Headbutt
-	dbw MONMENU_WATERFALL,  MonMenu_Waterfall ; Waterfall
-	dbw MONMENU_ROCKSMASH,  MonMenu_RockSmash ; RockSmash
-	dbw MONMENU_SWEETSCENT, MonMenu_SweetScent ; SweetScent
-	dbw MONMENU_STATS,      OpenPartyStats
-	dbw MONMENU_SWITCH,     SwitchPartyMons
-	dbw MONMENU_ITEM,       GiveTakePartyMonItem
-	dbw MONMENU_CANCEL,     CancelPokemonAction
-	dbw MONMENU_MOVE,       ManagePokemonMoves ; move
-	dbw MONMENU_MAIL,       MonMailAction ; mail
-; 12aec
-
-
-SwitchPartyMons: ; 12aec
-
-; Don't try if there's nothing to switch!
-	ld a, [PartyCount]
-	cp 2
-	jr c, .DontSwitch
-
-	ld a, [CurPartyMon]
-	inc a
-	ld [wd0e3], a
-
-	callba Function8ea8c
-	callba Function5042d
-
-	ld a, 4
-	ld [PartyMenuActionText], a
-	callba WritePartyMenuTilemap
-	callba PrintPartyMenuText
-
-	hlcoord 0, 1
-	ld bc, 20 * 2
-	ld a, [wd0e3]
-	dec a
-	call AddNTimes
-	ld [hl], "▷"
-	call WaitBGMap
-	call SetPalettes
-	call DelayFrame
-
-	callba PartyMenuSelect
-	bit 1, b
-	jr c, .DontSwitch
-
-	callba _SwitchPartyMons
-
-	xor a
-	ld [PartyMenuActionText], a
-
-	callba Function5004f
-	callba Function50405
-	callba Function503e0
-
-	ld a, 1
-	ret
-
-.DontSwitch
-	xor a
-	ld [PartyMenuActionText], a
-	call CancelPokemonAction
-	ret
-; 12b60
-
-
-GiveTakePartyMonItem: ; 12b60
-
-; Eggs can't hold items!
-	ld a, [CurPartySpecies]
-	cp EGG
-	jr z, .asm_12ba6
-
-	ld hl, GiveTakeItemMenuData
-	call LoadMenuDataHeader
-	call InterpretMenu2
-	call ExitMenu
-	jr c, .asm_12ba6
-
-	call GetCurNick
-	ld hl, StringBuffer1
-	ld de, wd050
-	ld bc, $b
-	call CopyBytes
-	ld a, [MenuSelection2]
-	cp 1
-	jr nz, .asm_12ba0
-
-	call LoadPartyMenuDataHeader
-	call ClearPalettes
-	call Function12ba9
-	call ClearPalettes
-	call LoadFontsBattleExtra
-	call ExitMenu
-	ld a, 0
-	ret
-
-.asm_12ba0
-	call TakePartyItem
-	ld a, 3
-	ret
-
-.asm_12ba6
-	ld a, 3
-	ret
-; 12ba9
-
-
-Function12ba9: ; 12ba9
-
-	callba Function106a5
-
-.loop
-	callba Function106be
-
-	ld a, [wcf66]
-	and a
-	jr z, .quit
-
-	ld a, [wcf65]
-	cp 2
-	jr z, .next
-
-	call CheckTossableItem
-	ld a, [wItemAttributeParamBuffer]
-	and a
-	jr nz, .next
-
-	call Function12bd9
-	jr .quit
-
-.next
-	ld hl, CantBeHeldText
-	call MenuTextBoxBackup
-	jr .loop
-
-.quit
-	ret
-; 12bd9
-
-
-Function12bd9: ; 12bd9
-
-	call SpeechTextBox
-	call PartyMonItemName
-	call GetPartyItemLocation
-	ld a, [hl]
-	and a
-	jr z, .asm_12bf4
-
-	push hl
-	ld d, a
-	callba ItemIsMail
-	pop hl
-	jr c, .asm_12c01
-	ld a, [hl]
-	jr .asm_12c08
-
-.asm_12bf4
-	call Function12cea
-	ld hl, MadeHoldText
-	call MenuTextBoxBackup
-	call GivePartyItem
-	ret
-
-.asm_12c01
-	ld hl, PleaseRemoveMailText
-	call MenuTextBoxBackup
-	ret
-
-.asm_12c08
-	ld [wd265], a
-	call GetItemName
-	ld hl, SwitchAlreadyHoldingText
-	call Function12cf5
-	jr c, .asm_12c4b
-
-	call Function12cea
-	ld a, [wd265]
-	push af
-	ld a, [CurItem]
-	ld [wd265], a
-	pop af
-	ld [CurItem], a
-	call Function12cdf
-	jr nc, .asm_12c3c
-
-	ld hl, TookAndMadeHoldText
-	call MenuTextBoxBackup
-	ld a, [wd265]
-	ld [CurItem], a
-	call GivePartyItem
-	ret
-
-.asm_12c3c
-	ld a, [wd265]
-	ld [CurItem], a
-	call Function12cdf
-	ld hl, ItemStorageIsFullText
-	call MenuTextBoxBackup
-
-.asm_12c4b
-	ret
-; 12c4c
-
-
-GivePartyItem: ; 12c4c
-
-	call GetPartyItemLocation
-	ld a, [CurItem]
-	ld [hl], a
-	ld d, a
-	callba ItemIsMail
-	jr nc, .asm_12c5f
-	call Function12cfe
-
-.asm_12c5f
-	ret
-; 12c60
-
-
-TakePartyItem: ; 12c60
-
-	call SpeechTextBox
-	call GetPartyItemLocation
-	ld a, [hl]
-	and a
-	jr z, .asm_12c8c
-
-	ld [CurItem], a
-	call Function12cdf
-	jr nc, .asm_12c94
-
-	callba ItemIsMail
-	call GetPartyItemLocation
-	ld a, [hl]
-	ld [wd265], a
-	ld [hl], NO_ITEM
-	call GetItemName
-	ld hl, TookFromText
-	call MenuTextBoxBackup
-	jr .asm_12c9a
-
-.asm_12c8c
-	ld hl, IsntHoldingAnythingText
-	call MenuTextBoxBackup
-	jr .asm_12c9a
-
-.asm_12c94
-	ld hl, ItemStorageIsFullText
-	call MenuTextBoxBackup
-
-.asm_12c9a
-	ret
-; 12c9b
-
-
-GiveTakeItemMenuData: ; 12c9b
-	db %01010000
-	db 12, 12 ; start coords
-	db 17, 19 ; end coords
-	dw .Items
-	db 1 ; default option
-
-.Items
-	db %10000000 ; x padding
-	db 2 ; # items
-	db "GIVE@"
-	db "TAKE@"
-; 12caf
-
-
-TookAndMadeHoldText: ; 12caf
-	text_jump UnknownText_0x1c1b2c
-	db "@"
-; 12cb4
-
-MadeHoldText: ; 12cb4
-	text_jump UnknownText_0x1c1b57
-	db "@"
-; 12cb9
-
-PleaseRemoveMailText: ; 12cb9
-	text_jump UnknownText_0x1c1b6f
-	db "@"
-; 12cbe
-
-IsntHoldingAnythingText: ; 12cbe
-	text_jump UnknownText_0x1c1b8e
-	db "@"
-; 12cc3
-
-ItemStorageIsFullText: ; 12cc3
-	text_jump UnknownText_0x1c1baa
-	db "@"
-; 12cc8
-
-TookFromText: ; 12cc8
-	text_jump UnknownText_0x1c1bc4
-	db "@"
-; 12ccd
-
-SwitchAlreadyHoldingText: ; 12ccd
-	text_jump UnknownText_0x1c1bdc
-	db "@"
-; 12cd2
-
-CantBeHeldText: ; 12cd2
-	text_jump UnknownText_0x1c1c09
-	db "@"
-; 12cd7
-
-
-GetPartyItemLocation: ; 12cd7
-	push af
-	ld a, MON_ITEM
-	call GetPartyParamLocation
-	pop af
-	ret
-; 12cdf
-
-
-Function12cdf: ; 12cdf
-	ld a, $1
-	ld [wItemQuantityChangeBuffer], a
-	ld hl, NumItems
-	jp ReceiveItem
-; 12cea
-
-
-Function12cea: ; 12cea (4:6cea)
-	ld a, $1
-	ld [wItemQuantityChangeBuffer], a
-	ld hl, NumItems
-	jp TossItem
-
-Function12cf5: ; 12cf5
-	call MenuTextBox
-	call YesNoBox
-	jp ExitMenu
-; 12cfe
-
-
-Function12cfe: ; 12cfe (4:6cfe)
-	ld de, wd002
-	callba Function11e75
-	ld hl, PlayerName
-	ld de, wd023
-	ld bc, $a
-	call CopyBytes
-	ld hl, PlayerID
-	ld bc, $2
-	call CopyBytes
-	ld a, [CurPartySpecies]
-	ld [de], a
-	inc de
-	ld a, [CurItem]
-	ld [de], a
-	ld a, [CurPartyMon]
-	ld hl, sPartyScratch1
-	ld bc, SCRATCHMON_STRUCT_LENGTH
-	call AddNTimes
-	ld d, h
-	ld e, l
-	ld hl, wd002
-	ld bc, SCRATCHMON_STRUCT_LENGTH
-	ld a, BANK(sPartyScratch1)
-	call GetSRAMBank
-	call CopyBytes
-	call CloseSRAM
-	ret
-
-MonMailAction: ; 12d45
-; If in the time capsule or trade center,
-; selecting the mail only allows you to
-; read the mail.
-	ld a, [wLinkMode]
-	cp LINK_TIMECAPSULE
-	jr z, .read
-	cp LINK_TRADECENTER
-	jr z, .read
-
-; Show the READ/TAKE/QUIT menu.
-	ld hl, .MenuDataHeader
-	call LoadMenuDataHeader
-	call InterpretMenu2
-	call ExitMenu
-
-; Interpret the menu.
-	jp c, .done
-	ld a, [MenuSelection2]
-	cp $1
-	jr z, .read
-	cp $2
-	jr z, .take
-	jp .done
-
-.read
-	callba ReadPartyMonMail
-	ld a, $0
-	ret
-
-.take
-	ld hl, .sendmailtopctext
-	call Function12cf5
-	jr c, .RemoveMailToBag
-	ld a, [CurPartyMon]
-	ld b, a
-	callba Function4456e
-	jr c, .MailboxFull
-	ld hl, .sentmailtopctext
-	call MenuTextBoxBackup
-	jr .done
-
-.MailboxFull
-	ld hl, .mailboxfulltext
-	call MenuTextBoxBackup
-	jr .done
-
-.RemoveMailToBag
-	ld hl, .mailwilllosemessagetext
-	call Function12cf5
-	jr c, .done
-	call GetPartyItemLocation
-	ld a, [hl]
-	ld [CurItem], a
-	call Function12cdf
-	jr nc, .BagIsFull
-	call GetPartyItemLocation
-	ld [hl], $0
-	call GetCurNick
-	ld hl, .tookmailfrommontext
-	call MenuTextBoxBackup
-	jr .done
-
-.BagIsFull
-	ld hl, .bagfulltext
-	call MenuTextBoxBackup
-	jr .done
-
-.done
-	ld a, $3
-	ret
-; 12dc9
-
-
-.MenuDataHeader: ; 0x12dc9
-	db $40 ; flags
-	db 10, 12 ; start coords
-	db 17, 19 ; end coords
-	dw .MenuData2
-	db 1 ; default option
-; 0x12dd1
-
-.MenuData2: ; 0x12dd1
-	db $80 ; flags
-	db 3 ; items
-	db "READ@"
-	db "TAKE@"
-	db "QUIT@"
-; 0x12de2
-
-
-.mailwilllosemessagetext: ; 0x12de2
-; The MAIL will lose its message. OK?
-	text_jump UnknownText_0x1c1c22
-	db "@"
-; 0x12de7
-
-.tookmailfrommontext: ; 0x12de7
-; MAIL detached from <POKEMON>.
-	text_jump UnknownText_0x1c1c47
-	db "@"
-; 0x12dec
-
-.bagfulltext: ; 0x12dec
-; There's no space for removing MAIL.
-	text_jump UnknownText_0x1c1c62
-	db "@"
-; 0x12df1
-
-.sendmailtopctext: ; 0x12df1
-; Send the removed MAIL to your PC?
-	text_jump UnknownText_0x1c1c86
-	db "@"
-; 0x12df6
-
-.mailboxfulltext: ; 0x12df6
-; Your PC's MAILBOX is full.
-	text_jump UnknownText_0x1c1ca9
-	db "@"
-; 0x12dfb
-
-.sentmailtopctext: ; 0x12dfb
-; The MAIL was sent to your PC.
-	text_jump UnknownText_0x1c1cc4
-	db "@"
-; 0x12e00
-
-
-OpenPartyStats: ; 12e00
-	call LoadPartyMenuDataHeader
-	call ClearSprites
-; PartyMon
-	xor a
-	ld [MonType], a
-	call LowVolume
-	predef StatsScreenInit
-	call MaxVolume
-	call Call_ExitMenu
-	ld a, 0
-	ret
-; 12e1b
-
-
-MonMenu_Cut: ; 12e1b
-	callba CutFunction
-	ld a, [wd0ec]
-	cp $1
-	jr nz, .asm_12e2d
-	ld b, $4
-	ld a, $2
-	ret
-
-.asm_12e2d
-	ld a, $3
-	ret
-; 12e30
-
-
-MonMenu_Fly: ; 12e30
-	callba FlyFunction
-	ld a, [wd0ec]
-	cp $2
-	jr z, .asm_12e4c
-	cp $0
-	jr z, .asm_12e4f
-	callba MobileFn_1060b5
-	ld b, $4
-	ld a, $2
-	ret
-
-.asm_12e4c
-	ld a, $3
-	ret
-
-.asm_12e4f
-	ld a, $0
-	ret
-
-.asm_12e52
-	ld a, $1
-	ret
-; 12e55
-
-MonMenu_Flash: ; 12e55
-	callba Functionc8ac
-	ld a, [wd0ec]
-	cp $1
-	jr nz, .asm_12e67
-	ld b, $4
-	ld a, $2
-	ret
-
-.asm_12e67
-	ld a, $3
-	ret
-; 12e6a
-
-MonMenu_Strength: ; 12e6a
-	callba StrengthFunction
-	ld a, [wd0ec]
-	cp $1
-	jr nz, .asm_12e7c
-	ld b, $4
-	ld a, $2
-	ret
-
-.asm_12e7c
-	ld a, $3
-	ret
-; 12e7f
-
-MonMenu_Whirlpool: ; 12e7f
-	callba WhirlpoolFunction
-	ld a, [wd0ec]
-	cp $1
-	jr nz, .asm_12e91
-	ld b, $4
-	ld a, $2
-	ret
-
-.asm_12e91
-	ld a, $3
-	ret
-; 12e94
-
-MonMenu_Waterfall: ; 12e94
-	callba Functioncade
-	ld a, [wd0ec]
-	cp $1
-	jr nz, .asm_12ea6
-	ld b, $4
-	ld a, $2
-	ret
-
-.asm_12ea6
-	ld a, $3
-	ret
-; 12ea9
-
-MonMenu_Teleport: ; 12ea9
-	callba TeleportFunction
-	ld a, [wd0ec]
-	and a
-	jr z, .asm_12eba
-	ld b, $4
-	ld a, $2
-	ret
-
-.asm_12eba
-	ld a, $3
-	ret
-; 12ebd
-
-MonMenu_Surf: ; 12ebd
-	callba SurfFunction
-	ld a, [wd0ec]
-	and a
-	jr z, .asm_12ece
-	ld b, $4
-	ld a, $2
-	ret
-
-.asm_12ece
-	ld a, $3
-	ret
-; 12ed1
-
-MonMenu_Dig: ; 12ed1
-	callba DigFunction
-	ld a, [wd0ec]
-	cp $1
-	jr nz, .asm_12ee3
-	ld b, $4
-	ld a, $2
-	ret
-
-.asm_12ee3
-	ld a, $3
-	ret
-; 12ee6
-
-MonMenu_Softboiled_MilkDrink: ; 12ee6
-	call Function12f05
-	jr nc, .asm_12ef3
-	callba Functionf3df
-	jr .asm_12ef9
-
-.asm_12ef3
-	ld hl, UnknownText_0x12f00
-	call PrintText
-
-.asm_12ef9
-	xor a
-	ld [PartyMenuActionText], a
-	ld a, $3
-	ret
-; 12f00
-
-UnknownText_0x12f00: ; 0x12f00
-	; Not enough HP!
-	text_jump UnknownText_0x1c1ce3
-	db "@"
-; 0x12f05
-
-Function12f05: ; 12f05
-	ld a, MON_MAXHP
-	call GetPartyParamLocation
-	ld a, [hli]
-	ld [hDividend + 0], a
-	ld a, [hl]
-	ld [hDividend + 1], a
-	ld a, $5
-	ld [hDivisor], a
-	ld b, $2
-	call Divide
-	ld a, MON_HP + 1
-	call GetPartyParamLocation
-	ld a, [hQuotient + 2]
-	sub [hl]
-	dec hl
-	ld a, [hQuotient + 1]
-	sbc [hl]
-	ret
-; 12f26
-
-MonMenu_Headbutt: ; 12f26
-	callba HeadbuttFunction
-	ld a, [wd0ec]
-	cp $1
-	jr nz, .asm_12f38
-	ld b, $4
-	ld a, $2
-	ret
-
-.asm_12f38
-	ld a, $3
-	ret
-; 12f3b
-
-MonMenu_RockSmash: ; 12f3b
-	callba RockSmashFunction
-	ld a, [wd0ec]
-	cp $1
-	jr nz, .asm_12f4d
-	ld b, $4
-	ld a, $2
-	ret
-
-.asm_12f4d
-	ld a, $3
-	ret
-; 12f50
-
-MonMenu_SweetScent: ; 12f50
-	callba DoMovementFunctionc
-	ld b, $4
-	ld a, $2
-	ret
-; 12f5b
-
-Function12f5b: ; 12f5b
-	ld hl, Options
-	ld a, [hl]
-	push af
-	set NO_TEXT_SCROLL, [hl]
-	call LoadFontsBattleExtra
-	call Function12f73
-	pop bc
-	ld a, b
-	ld [Options], a
-	push af
-	call WhiteBGMap
-	pop af
-	ret
-; 12f73
-
-Function12f73: ; 12f73
-	call SetUpMoveScreenBG
-	ld de, Unknown_12fb2
-	call Function1bb1
-	call Function131ef
-	ld hl, wcfa5
-	set 6, [hl]
-	jr Function12f93
-
-Function12f86: ; 12f86
-	call Function1bd3
-	bit 1, a
-	jp nz, Function12f9f
-	bit 0, a
-	jp nz, Function12f9c
-
-Function12f93: ; 12f93
-	call PrepareToPlaceMoveData
-	call PlaceMoveData
-	jp Function12f86
-; 12f9c
-
-Function12f9c: ; 12f9c
-	and a
-	jr Function12fa0
-
-Function12f9f: ; 12f9f
-	scf
-
-Function12fa0: ; 12fa0
-	push af
-	xor a
-	ld [wd0e3], a
-	ld hl, wcfa5
-	res 6, [hl]
-	call ClearSprites
-	call ClearTileMap
-	pop af
-	ret
-; 12fb2
-
-Unknown_12fb2: ; 12fb2
-	db $03, $01, $03, $01, $40, $00, $20, $c3
-; 12fba
-
-ManagePokemonMoves: ; 12fba
-	ld a, [CurPartySpecies]
-	cp EGG
-	jr z, .egg
-	ld hl, Options
-	ld a, [hl]
-	push af
-	set NO_TEXT_SCROLL, [hl]
-	call MoveScreenLoop
-	pop af
-	ld [Options], a
-	call WhiteBGMap
-
-.egg
-	ld a, $0
-	ret
-; 12fd5
-
-MoveScreenLoop: ; 12fd5
-	ld a, [CurPartyMon]
-	inc a
-	ld [wd0d8], a
-	call SetUpMoveScreenBG
-	call Function132d3
-	ld de, Unknown_13163
-	call Function1bb1
-.loop
-	call Function131ef
-	ld hl, wcfa5
-	set 6, [hl]
-	jr .skip_joy
-
-.joy_loop
-	call Function1bd3
-	bit 1, a
-	jp nz, .b_button
-	bit 0, a
-	jp nz, .a_button
-	bit 4, a
-	jp nz, .d_right
-	bit 5, a
-	jp nz, .d_left
-
-.skip_joy
-	call PrepareToPlaceMoveData
-	ld a, [wMoveSwapBuffer]
-	and a
-	jr nz, .moving_move
-	call PlaceMoveData
-	jp .joy_loop
-
-.moving_move
-	ld a, " "
-	hlcoord 1, 11
-	ld bc, 5
-	call ByteFill
-	hlcoord 1, 12
-	lb bc, 5, SCREEN_WIDTH - 2
-	call ClearBox
-	hlcoord 1, 12
-	ld de, String_1316b
-	call PlaceString
-	jp .joy_loop
-.b_button: ; 13038
-	call PlayClickSFX
-	call WaitSFX
-	ld a, [wMoveSwapBuffer]
-	and a
-	jp z, .exit
-
-	ld a, [wMoveSwapBuffer]
-	ld [MenuSelection2], a
-	xor a
-	ld [wMoveSwapBuffer], a
-	hlcoord 1, 2
-	lb bc, 8, SCREEN_WIDTH - 2
-	call ClearBox
-	jp .loop
-; 1305b
-
-.d_right: ; 1305b
-	ld a, [wMoveSwapBuffer]
-	and a
-	jp nz, .joy_loop
-
-	ld a, [CurPartyMon]
-	ld b, a
-	push bc
-	call .cycle_right
-	pop bc
-	ld a, [CurPartyMon]
-	cp b
-	jp z, .joy_loop
-	jp MoveScreenLoop
-
-.d_left: ; 13075
-	ld a, [wMoveSwapBuffer]
-	and a
-	jp nz, .joy_loop
-	ld a, [CurPartyMon]
-	ld b, a
-	push bc
-	call .cycle_left
-	pop bc
-	ld a, [CurPartyMon]
-	cp b
-	jp z, .joy_loop
-	jp MoveScreenLoop
-
-.cycle_right
-	ld a, [CurPartyMon]
-	inc a
-	ld [CurPartyMon], a
-	ld c, a
-	ld b, 0
-	ld hl, PartySpecies
-	add hl, bc
-	ld a, [hl]
-	cp -1
-	jr z, .cycle_left
-	cp EGG
-	ret nz
-	jr .cycle_right
-
-.cycle_left
-	ld a, [CurPartyMon]
-	and a
-	ret z
-.cycle_left_loop
-	ld a, [CurPartyMon]
-	dec a
-	ld [CurPartyMon], a
-	ld c, a
-	ld b, 0
-	ld hl, PartySpecies
-	add hl, bc
-	ld a, [hl]
-	cp EGG
-	ret nz
-	ld a, [CurPartyMon]
-	and a
-	jr z, .cycle_right
-	jr .cycle_left_loop
-; 130c6
-
-.a_button: ; 130c6
-	call PlayClickSFX
-	call WaitSFX
-	ld a, [wMoveSwapBuffer]
-	and a
-	jr nz, .place_move
-	ld a, [MenuSelection2]
-	ld [wMoveSwapBuffer], a
-	call Function1bee
-	jp .moving_move
-
-.place_move
-	ld hl, PartyMon1Moves
-	ld bc, PARTYMON_STRUCT_LENGTH
-	ld a, [CurPartyMon]
-	call AddNTimes
-	push hl
-	call .copy_move
-	pop hl
-	ld bc, $15
-	add hl, bc
-	call .copy_move
-	ld a, [wBattleMode]
-	jr z, .swap_moves
-	ld hl, BattleMonMoves
-	ld bc, $20
-	ld a, [CurPartyMon]
-	call AddNTimes
-	push hl
-	call .copy_move
-	pop hl
-	ld bc, 6
-	add hl, bc
-	call .copy_move
-
-.swap_moves
-	ld de, SFX_SWITCH_POKEMON
-	call PlaySFX
-	call WaitSFX
-	ld de, SFX_SWITCH_POKEMON
-	call PlaySFX
-	call WaitSFX
-	hlcoord 1, 2
-	lb bc, 8, 18
-	call ClearBox
-	hlcoord 10, 10
-	lb bc, 1, 9
-	call ClearBox
-	jp .loop
-; 1313a
-
-.copy_move: ; 1313a
-	push hl
-	ld a, [MenuSelection2]
-	dec a
-	ld c, a
-	ld b, $0
-	add hl, bc
-	ld d, h
-	ld e, l
-	pop hl
-	ld a, [wMoveSwapBuffer]
-	dec a
-	ld c, a
-	ld b, $0
-	add hl, bc
-	ld a, [de]
-	ld b, [hl]
-	ld [hl], a
-	ld a, b
-	ld [de], a
-	ret
-; 13154
-
-.exit: ; 13154
-	xor a
-	ld [wMoveSwapBuffer], a
-	ld hl, wcfa5
-	res 6, [hl]
-	call ClearSprites
-	jp ClearTileMap
-; 13163
-
-Unknown_13163: ; 13163
-	db $03, $01, $03, $01, $40, $00, $20, $f3
-; 1316b
-
-String_1316b: ; 1316b
-	db "Where?@"
-; 13172
-
-SetUpMoveScreenBG: ; 13172
-	call WhiteBGMap
-	call ClearTileMap
-	call ClearSprites
-	xor a
-	ld [hBGMapMode], a
-	callba Functionfb571
-	callba InefficientlyClear121BytesAtwc300
-	ld a, [CurPartyMon]
-	ld e, a
-	ld d, $0
-	ld hl, PartySpecies
-	add hl, de
-	ld a, [hl]
-	ld [wd265], a
-	ld e, $2
-	callba Function8e83f
-	hlcoord 0, 1
-	ld b, 9
-	ld c, 18
-	call TextBox
-	hlcoord 0, 11
-	ld b, 5
-	ld c, 18
-	call TextBox
-	hlcoord 2, 0
-	lb bc, 2, 3
-	call ClearBox
-	xor a
-	ld [MonType], a
-	ld hl, PartyMonNicknames
-	ld a, [CurPartyMon]
-	call GetNick
-	hlcoord 5, 1
-	call PlaceString
-	push bc
-	callba CopyPkmnToTempMon
-	pop hl
-	call PrintLevel
-	ld hl, PlayerHPPal
-	call SetHPPal
-	ld b, $e
-	call GetSGBLayout
-	hlcoord 16, 0
-	lb bc, 1, 3
-	jp ClearBox
-; 131ef
-
-Function131ef: ; 131ef
-	xor a
-	ld [hBGMapMode], a
-	ld [wMoveSwapBuffer], a
-	ld [MonType], a
-	predef CopyPkmnToTempMon
-	ld hl, TempMonMoves
-	ld de, wListMoves_MoveIndicesBuffer
-	ld bc, NUM_MOVES
-	call CopyBytes
-	ld a, SCREEN_WIDTH * 2
-	ld [Buffer1], a
-	hlcoord 2, 3
-	predef ListMoves
-	hlcoord 10, 4
-	predef Function50c50
-	call WaitBGMap
-	call SetPalettes
-	ld a, [wd0eb]
-	inc a
-	ld [wcfa3], a
-	hlcoord 0, 11
-	ld b, 5
-	ld c, 18
-	jp TextBox
-; 13235
-
-PrepareToPlaceMoveData: ; 13235
-	ld hl, PartyMon1Moves
-	ld bc, PARTYMON_STRUCT_LENGTH
-	ld a, [CurPartyMon]
-	call AddNTimes
-	ld a, [MenuSelection2]
-	dec a
-	ld c, a
-	ld b, $0
-	add hl, bc
-	ld a, [hl]
-	ld [CurMove], a
-	hlcoord 1, 12
-	lb bc, 5, 18
-	jp ClearBox
-; 13256
-
-PlaceMoveData: ; 13256
-	xor a
-	ld [hBGMapMode], a
-	hlcoord 0, 10
-	ld de, String_132ba
-	call PlaceString
-	hlcoord 0, 11
-	ld de, String_132c2
-	call PlaceString
-	hlcoord 12, 12
-	ld de, String_132ca
-	call PlaceString
-	ld a, [CurMove]
-	ld b, a
-	hlcoord 2, 12
-	predef PrintMoveType
-	ld a, [CurMove]
-	dec a
-	ld hl, Moves + MOVE_POWER
-	ld bc, MOVE_LENGTH
-	call AddNTimes
-	ld a, BANK(Moves)
-	call GetFarByte
-	hlcoord 16, 12
-	cp 2
-	jr c, .no_power
-	ld [wd265], a
-	ld de, wd265
-	lb bc, 1, 3
-	call PrintNum
-	jr .description
-
-.no_power
-	ld de, String_132cf
-	call PlaceString
-
-.description
-	hlcoord 1, 14
-	predef PrintMoveDesc
-	ld a, $1
-	ld [hBGMapMode], a
-	ret
-; 132ba
-
-String_132ba: ; 132ba
-	db "┌─────┐@"
-; 132c2
-String_132c2: ; 132c2
-	db "│TYPE/└@"
-; 132ca
-String_132ca: ; 132ca
-	db "ATK/@"
-; 132cf
-String_132cf: ; 132cf
-	db "---@"
-; 132d3
-
-Function132d3: ; 132d3
-	call Function132da
-	call Function132fe
-	ret
-; 132da
-
-Function132da: ; 132da
-	ld a, [CurPartyMon]
-	and a
-	ret z
-	ld c, a
-	ld e, a
-	ld d, 0
-	ld hl, PartyCount
-	add hl, de
-.loop
-	ld a, [hl]
-	and a
-	jr z, .prev
-	cp EGG
-	jr z, .prev
-	cp NUM_POKEMON + 1
-	jr c, .legal
-
-.prev
-	dec hl
-	dec c
-	jr nz, .loop
-	ret
-
-.legal
-	hlcoord 16, 0
-	ld [hl], "◀"
-	ret
-; 132fe
-
-Function132fe: ; 132fe
-	ld a, [CurPartyMon]
-	inc a
-	ld c, a
-	ld a, [PartyCount]
-	cp c
-	ret z
-	ld e, c
-	ld d, 0
-	ld hl, PartySpecies
-	add hl, de
-.loop
-	ld a, [hl]
-	cp -1
-	ret z
-	and a
-	jr z, .next
-	cp EGG
-	jr z, .next
-	cp NUM_POKEMON + 1
-	jr c, .legal
-
-.next
-	inc hl
-	jr .loop
-
-.legal
-	hlcoord 18, 0
-	ld [hl], "▶"
-	ret
-; 13327
-
-
-SelectMenu:: ; 13327
-
-	call CheckRegisteredItem
-	jr c, .NotRegistered
-	jp UseRegisteredItem
-
-.NotRegistered
-	call LoadFont
-	ld b, BANK(ItemMayBeRegisteredText)
-	ld hl, ItemMayBeRegisteredText
-	call MapTextbox
-	call CloseText
-	jp LoadMoveSprites
-; 13340
-
-
-ItemMayBeRegisteredText: ; 13340
-	text_jump UnknownText_0x1c1cf3
-	db "@"
-; 13345
-
-
-CheckRegisteredItem: ; 13345
-
-	ld a, [WhichRegisteredItem]
-	and a
-	jr z, .NoRegisteredItem
-	and REGISTERED_POCKET
-	rlca
-	rlca
-	ld hl, .Pockets
-	rst JumpTable
-	ret
-
-.Pockets
-	dw .CheckItem
-	dw .CheckBall
-	dw .CheckKeyItem
-	dw .CheckTMHM
-
-.CheckItem
-	ld hl, NumItems
-	call .CheckRegisteredNo
-	jr c, .NoRegisteredItem
-	inc hl
-	ld e, a
-	ld d, 0
-rept 2
-	add hl, de
-endr
-	call .IsSameItem
-	jr c, .NoRegisteredItem
-	and a
-	ret
-
-.CheckKeyItem
-	ld a, [RegisteredItem]
-	ld hl, KeyItems
-	ld de, 1
-	call IsInArray
-	jr nc, .NoRegisteredItem
-	ld a, [RegisteredItem]
-	ld [CurItem], a
-	and a
-	ret
-
-.CheckBall
-	ld hl, NumBalls
-	call .CheckRegisteredNo
-	jr nc, .NoRegisteredItem
-	inc hl
-	ld e, a
-	ld d, 0
-rept 2
-	add hl, de
-endr
-	call .IsSameItem
-	jr c, .NoRegisteredItem
-	ret
-
-.CheckTMHM
-	jr .NoRegisteredItem
-
-.NoRegisteredItem
-	xor a
-	ld [WhichRegisteredItem], a
-	ld [RegisteredItem], a
-	scf
-	ret
-; 133a6
-
-
-.CheckRegisteredNo ; 133a6
-	ld a, [WhichRegisteredItem]
-	and REGISTERED_NUMBER
-	dec a
-	cp [hl]
-	jr nc, .NotEnoughItems
-	ld [wd107], a
-	and a
-	ret
-
-.NotEnoughItems
-	scf
-	ret
-; 133b6
-
-
-.IsSameItem ; 133b6
-	ld a, [RegisteredItem]
-	cp [hl]
-	jr nz, .NotSameItem
-	ld [CurItem], a
-	and a
-	ret
-
-.NotSameItem
-	scf
-	ret
-; 133c3
-
-
-UseRegisteredItem: ; 133c3
-
-	callba CheckItemMenu
-	ld a, [wItemAttributeParamBuffer]
-	ld hl, .SwitchTo
-	rst JumpTable
-	ret
-
-.SwitchTo
-	dw .CantUse
-	dw .NoFunction
-	dw .NoFunction
-	dw .NoFunction
-	dw .Current
-	dw .Party
-	dw .Overworld
-; 133df
-
-.NoFunction ; 133df
-	call LoadFont
-	call CantUseItem
-	call LoadMoveSprites
-	and a
-	ret
-; 133ea
-
-.Current ; 133ea
-	call LoadFont
-	call DoItemEffect
-	call LoadMoveSprites
-	and a
-	ret
-; 133f5
-
-.Party ; 133f5
-	call ResetWindow
-	call FadeToMenu
-	call DoItemEffect
-	call Function2b3c
-	call LoadMoveSprites
-	and a
-	ret
-; 13406
-
-.Overworld ; 13406
-	call ResetWindow
-	ld a, 1
-	ld [wd0ef], a
-	call DoItemEffect
-	xor a
-	ld [wd0ef], a
-	ld a, [wd0ec]
-	cp 1
-	jr nz, ._cantuse
-	scf
-	ld a, HMENURETURN_SCRIPT
-	ld [hMenuReturn], a
-	ret
-; 13422
-
-.CantUse ; 13422
-	call ResetWindow
-
-._cantuse
-	call CantUseItem
-	call LoadMoveSprites
-	and a
-	ret
-; 1342d
-
-
-Elevator:: ; 1342d
-	call Function1344a
-	call Function1347d
-	jr c, .asm_13448
-	ld [wd041], a
-	call Function134dd
-	jr c, .asm_13448
-	ld hl, wd041
-	cp [hl]
-	jr z, .asm_13448
-	call Function134c0
-	and a
-	ret
-
-.asm_13448
-	scf
-	ret
-; 1344a
-
-Function1344a: ; 1344a
-	ld a, b
-	ld [EngineBuffer1], a
-	ld a, e
-	ld [wd03f], a
-	ld a, d
-	ld [wd040], a
-	call Function1345a
-	ret
-; 1345a
-
-Function1345a: ; 1345a
-	ld de, OBPals + 8 * 6
-	ld bc, 4
-	ld hl, wd03f
-	ld a, [hli]
-	ld h, [hl]
-	ld l, a
-	ld a, [EngineBuffer1]
-	call GetFarByte
-	inc hl
-	ld [de], a
-	inc de
-.asm_1346f
-	ld a, [EngineBuffer1]
-	call GetFarByte
-	ld [de], a
-	inc de
-	add hl, bc
-	cp $ff
-	jr nz, .asm_1346f
-	ret
-; 1347d
-
-Function1347d: ; 1347d
-	ld hl, wd03f
-	ld a, [hli]
-	ld h, [hl]
-	ld l, a
-	ld a, [EngineBuffer1]
-	call GetFarByte
-	ld c, a
-	inc hl
-	ld a, [BackupMapGroup]
-	ld d, a
-	ld a, [BackupMapNumber]
-	ld e, a
-	ld b, $0
-.asm_13495
-	ld a, [EngineBuffer1]
-	call GetFarByte
-	cp $ff
-	jr z, .asm_134be
-rept 2
-	inc hl
-endr
-	ld a, [EngineBuffer1]
-	call GetFarByte
-	inc hl
-	cp d
-	jr nz, .asm_134b7
-	ld a, [EngineBuffer1]
-	call GetFarByte
-	inc hl
-	cp e
-	jr nz, .asm_134b8
-	jr .asm_134bb
-
-.asm_134b7
-	inc hl
-
-.asm_134b8
-	inc b
-	jr .asm_13495
-
-.asm_134bb
-	xor a
-	ld a, b
-	ret
-
-.asm_134be
-	scf
-	ret
-; 134c0
-
-Function134c0: ; 134c0
-	push af
-	ld hl, wd03f
-	ld a, [hli]
-	ld h, [hl]
-	ld l, a
-	inc hl
-	pop af
-	ld bc, 4
-	call AddNTimes
-	inc hl
-	ld de, wdcac
-	ld a, [EngineBuffer1]
-	ld bc, 3
-	call FarCopyBytes
-	ret
-; 134dd
-
-Function134dd: ; 134dd
-	call LoadPartyMenuDataHeader
-	ld hl, Elevator_WhichFloorText
-	call PrintText
-	call Elevator_GetCurrentFloorText
-	ld hl, Elevator_MenuDataHeader
-	call CopyMenuDataHeader
-	call Function352f
-	call UpdateSprites
-	xor a
-	ld [wd0e4], a
-	call HandleScrollingMenu
-	call WriteBackup
-	ld a, [wcf73]
-	cp $2
-	jr z, .asm_1350b
-	xor a
-	ld a, [wcf77]
-	ret
-
-.asm_1350b
-	scf
-	ret
-; 1350d
-
-Elevator_WhichFloorText: ; 0x1350d
-	; Which floor?
-	text_jump UnknownText_0x1bd2bc
-	db "@"
-; 0x13512
-
-
-Elevator_GetCurrentFloorText: ; 13512
-	ld hl, Options
-	ld a, [hl]
-	push af
-	set NO_TEXT_SCROLL, [hl]
-	hlcoord 0, 0
-	ld b, 4
-	ld c, 8
-	call TextBox
-	hlcoord 1, 2
-	ld de, Elevator_CurrentFloorText
-	call PlaceString
-	hlcoord 4, 4
-	call Elevator_GetCurrentFloorString
-	pop af
-	ld [Options], a
-	ret
-; 13537
-
-Elevator_CurrentFloorText: ; 13537
-	db "Now on:@"
-; 1353f
-
-
-Elevator_GetCurrentFloorString: ; 1353f
-	push hl
-	ld a, [wd041]
-	ld e, a
-	ld d, 0
-	ld hl, wd0f1
-	add hl, de
-	ld a, [hl]
-	pop de
-	call GetFloorString
-	ret
-; 13550
-
-Elevator_MenuDataHeader: ; 0x13550
-	db $40 ; flags
-	db 01, 12 ; start coords
-	db 09, 18 ; end coords
-	dw Elevator_MenuData2
-	db 1 ; default option
-; 0x13558
-
-Elevator_MenuData2: ; 0x13558
-	db $10 ; flags
-	db 4, 0 ; rows, columns
-	db 1 ; horizontal spacing
-	dbw 0, OBPals + 8 * 6
-	dba GetElevatorFlorStrings
-	dba NULL
-	dba NULL
-; 13568
-
-GetElevatorFlorStrings: ; 13568
-	ld a, [MenuSelection]
-
-GetFloorString: ; 1356b
-	push de
-	call FloorToString
-	ld d, h
-	ld e, l
-	pop hl
-	jp PlaceString
-; 13575
-
-FloorToString: ; 13575
-	push de
-	ld e, a
-	ld d, 0
-	ld hl, .floors
-rept 2
-	add hl, de
-endr
-	ld a, [hli]
-	ld h, [hl]
-	ld l, a
-	pop de
-	ret
-; 13583
-
-.floors
-	dw .b4f
-	dw .b3f
-	dw .b2f
-	dw .b1f
-	dw ._1f
-	dw ._2f
-	dw ._3f
-	dw ._4f
-	dw ._5f
-	dw ._6f
-	dw ._7f
-	dw ._8f
-	dw ._9f
-	dw ._10f
-	dw ._11f
-	dw .roof
-
-.b4f
-	db "B4F@"
-.b3f
-	db "B3F@"
-.b2f
-	db "B2F@"
-.b1f
-	db "B1F@"
-._1f
-	db "1F@"
-._2f
-	db "2F@"
-._3f
-	db "3F@"
-._4f
-	db "4F@"
-._5f
-	db "5F@"
-._6f
-	db "6F@"
-._7f
-	db "7F@"
-._8f
-	db "8F@"
-._9f
-	db "9F@"
-._10f
-	db "10F@"
-._11f
-	db "11F@"
-.roof
-	db "ROOF@"
-; 135db
+INCLUDE "event/itemball.asm"
+INCLUDE "engine/healmachineanim.asm"
+INCLUDE "event/whiteout.asm"
+INCLUDE "event/forced_movement.asm"
+INCLUDE "event/itemfinder.asm"
+INCLUDE "engine/startmenu.asm"
+INCLUDE "engine/selectmenu.asm"
+INCLUDE "event/elevator.asm"
 
-
 Special_GiveParkBalls: ; 135db
 	xor a
 	ld [wContestMon], a
@@ -14987,13 +10934,13 @@
 
 RepelWoreOffScript:: ; 0x13619
 	loadfont
-	writetext UnknownText_0x13620
+	writetext .text
 	closetext
 	loadmovesprites
 	end
 ; 0x13620
 
-UnknownText_0x13620: ; 0x13620
+.text: ; 0x13620
 	; REPEL's effect wore off.
 	text_jump UnknownText_0x1bd308
 	db "@"
@@ -15003,32 +10950,32 @@
 	loadfont
 	copybytetovar Unkn2Pals
 	itemtotext 0, 0
-	writetext UnknownText_0x13645
-	giveitem -1
-	iffalse UnknownScript_0x1363e
+	writetext .found_text
+	giveitem ITEM_FROM_MEM
+	iffalse .bag_full
 	callasm SetMemEvent
 	specialsound
 	itemnotify
-	jump UnknownScript_0x13643
+	jump .finish
 ; 0x1363e
 
-UnknownScript_0x1363e: ; 0x1363e
+.bag_full: ; 0x1363e
 	keeptextopen
-	writetext UnknownText_0x1364a
+	writetext .no_room_text
 	closetext
 
-UnknownScript_0x13643: ; 13643
+.finish: ; 13643
 	loadmovesprites
 	end
 ; 0x13645
 
-UnknownText_0x13645: ; 0x13645
+.found_text: ; 0x13645
 	; found @ !
 	text_jump UnknownText_0x1bd321
 	db "@"
 ; 0x1364a
 
-UnknownText_0x1364a: ; 0x1364a
+.no_room_text: ; 0x1364a
 	; But   has no space left…
 	text_jump UnknownText_0x1bd331
 	db "@"
@@ -15053,12 +11000,12 @@
 	jr nc, .notintable
 
 	ld a, jumpstd_command
-	ld [wd03f], a
+	ld [wJumpStdScriptBuffer], a
 	inc hl
 	ld a, [hli]
-	ld [wd03f + 1], a
+	ld [wJumpStdScriptBuffer + 1], a
 	ld a, [hli]
-	ld [wd03f + 2], a
+	ld [wJumpStdScriptBuffer + 2], a
 	ld a, BANK(Script_JumpStdFromRAM)
 	ld hl, Script_JumpStdFromRAM
 	call CallScript
@@ -15083,491 +11030,11 @@
 ; 1369a
 
 Script_JumpStdFromRAM: ; 0x1369a
-	jump wd03f
+	jump wJumpStdScriptBuffer
 ; 0x1369d
 
+INCLUDE "event/bug_contest_judging.asm"
 
-_BugContestJudging: ; 1369d
-	call ContestScore
-	callba MobileFn_105f79
-	call Function13819
-	ld a, [wd00a]
-	call LoadContestantName
-	ld a, [wd00b]
-	ld [wd265], a
-	call GetPokemonName
-	ld hl, BugContest_ThirdPlaceText
-	call PrintText
-	ld a, [EndFlypoint]
-	call LoadContestantName
-	ld a, [MovementBuffer]
-	ld [wd265], a
-	call GetPokemonName
-	ld hl, BugContest_SecondPlaceText
-	call PrintText
-	ld a, [wd002]
-	call LoadContestantName
-	ld a, [wd003]
-	ld [wd265], a
-	call GetPokemonName
-	ld hl, BugContest_FirstPlaceText
-	call PrintText
-	jp Function13807
-; 136eb
-
-BugContest_FirstPlaceText: ; 0x136eb
-	text_jump ContestJudging_FirstPlaceText
-	start_asm
-BugContest_FirstPlace: ; 136f0
-	ld de, SFX_1ST_PLACE
-	call PlaySFX
-	call WaitSFX
-	ld hl, BugContest_FirstPlaceScoreText
-	ret
-; 136fd
-
-BugContest_FirstPlaceScoreText: ; 0x136fd
-	; The winning score was @  points!
-	text_jump ContestJudging_FirstPlaceScoreText
-	db "@"
-; 0x13702
-
-BugContest_SecondPlaceText: ; 0x13702
-	; Placing second was @ , who caught a @ !@ @
-	text_jump ContestJudging_SecondPlaceText
-	start_asm
-BugContest_SecondPlace: ; 13707
-	ld de, SFX_2ND_PLACE
-	call PlaySFX
-	call WaitSFX
-	ld hl, BugContest_SecondPlaceScoreText
-	ret
-; 13714
-
-BugContest_SecondPlaceScoreText: ; 0x13714
-	; The score was @  points!
-	text_jump ContestJudging_SecondPlaceScoreText
-	db "@"
-; 0x13719
-
-BugContest_ThirdPlaceText: ; 0x13719
-	; Placing third was @ , who caught a @ !@ @
-	text_jump ContestJudging_ThirdPlaceText
-	start_asm
-; 0x1371e
-
-BugContest_ThirdPlace: ; 1371e
-	ld de, SFX_3RD_PLACE
-	call PlaySFX
-	call WaitSFX
-	ld hl, BugContest_ThirdPlaceScoreText
-	ret
-; 1372b
-
-BugContest_ThirdPlaceScoreText: ; 0x1372b
-	; The score was @  points!
-	text_jump ContestJudging_ThirdPlaceScoreText
-	db "@"
-; 0x13730
-
-LoadContestantName: ; 13730
-
-; If a = 0, get your name.
-	dec a
-	jr z, .done
-; Find the pointer for the trainer class of the Bug Catching Contestant whose ID is in a.
-	ld c, a
-	ld b, 0
-	ld hl, BugContestantPointers
-rept 2
-	add hl, bc
-endr
-	ld a, [hli]
-	ld h, [hl]
-	ld l, a
-; Copy the Trainer Class to c.
-	ld a, [hli]
-	ld c, a
-; Save hl and bc for later.
-	push hl
-	push bc
-; Get the Trainer Class name and copy it into wd016.
-	callab GetTrainerClassName
-	ld hl, StringBuffer1
-	ld de, wd016
-	ld bc, TRAINER_CLASS_NAME_LENGTH
-	call CopyBytes
-	ld hl, wd016
-; Delete the trailing terminator and replace it with a space.
-.next
-	ld a, [hli]
-	cp "@"
-	jr nz, .next
-	dec hl
-	ld [hl], " "
-	inc hl
-	ld d, h
-	ld e, l
-; Restore the Trainer Class ID and Trainer ID pointer.  Save de for later.
-	pop bc
-	pop hl
-	push de
-; Get the name of the trainer with class c and ID b.
-	ld a, [hl]
-	ld b, a
-	callab GetTrainerName
-; Append the name to wd016.
-	ld hl, StringBuffer1
-	pop de
-	ld bc, NAME_LENGTH - 1
-	jp CopyBytes
-
-.done
-	ld hl, PlayerName
-	ld de, wd016
-	ld bc, NAME_LENGTH
-	jp CopyBytes
-; 13783
-
-BugContestantPointers: ; 13783
-	dw BugContestant_BugCatcherDon ; This reverts back to the player
-	dw BugContestant_BugCatcherDon
-	dw BugContestant_BugCatcherEd
-	dw BugContestant_CooltrainerMNick
-	dw BugContestant_PokefanMWilliam
-	dw BugContestant_BugCatcherBenny
-	dw BugContestant_CamperBarry
-	dw BugContestant_PicnickerCindy
-	dw BugContestant_BugCatcherJosh
-	dw BugContestant_YoungsterSamuel
-	dw BugContestant_SchoolboyKipp
-; 13799
-
-BugContestant_BugCatcherDon:
-	db BUG_CATCHER, DON
-	dbw KAKUNA,     300
-	dbw METAPOD,    285
-	dbw CATERPIE,   226
-
-BugContestant_BugCatcherEd:
-	db BUG_CATCHER, ED
-	dbw BUTTERFREE, 286
-	dbw BUTTERFREE, 251
-	dbw CATERPIE,   237
-
-BugContestant_CooltrainerMNick:
-	db COOLTRAINERM, NICK
-	dbw SCYTHER,    357
-	dbw BUTTERFREE, 349
-	dbw PINSIR,     368
-
-BugContestant_PokefanMWilliam:
-	db POKEFANM, WILLIAM
-	dbw PINSIR,     332
-	dbw BUTTERFREE, 324
-	dbw VENONAT,    321
-
-BugContestant_BugCatcherBenny:
-	db BUG_CATCHER, BUG_CATCHER_BENNY
-	dbw BUTTERFREE, 318
-	dbw WEEDLE,     295
-	dbw CATERPIE,   285
-
-BugContestant_CamperBarry:
-	db CAMPER, BARRY
-	dbw PINSIR,     366
-	dbw VENONAT,    329
-	dbw KAKUNA,     314
-
-BugContestant_PicnickerCindy:
-	db PICNICKER, CINDY
-	dbw BUTTERFREE, 341
-	dbw METAPOD,    301
-	dbw CATERPIE,   264
-
-BugContestant_BugCatcherJosh:
-	db BUG_CATCHER, JOSH
-	dbw SCYTHER,    326
-	dbw BUTTERFREE, 292
-	dbw METAPOD,    282
-
-BugContestant_YoungsterSamuel:
-	db YOUNGSTER, SAMUEL
-	dbw WEEDLE,     270
-	dbw PINSIR,     282
-	dbw CATERPIE,   251
-
-BugContestant_SchoolboyKipp:
-	db SCHOOLBOY, KIPP
-	dbw VENONAT,    267
-	dbw PARAS,      254
-	dbw KAKUNA,     259
-; 13807
-
-Function13807: ; 13807
-	ld hl, wd00a
-	ld de, -4
-	ld b, 3
-.loop
-	ld a, [hl]
-	cp 1
-	jr z, .done
-	add hl, de
-	dec b
-	jr nz, .loop
-
-.done
-	ret
-; 13819
-
-Function13819: ; 13819
-	call Function13833
-	call Function138b0
-	ld hl, wd00e
-	ld a, 1
-	ld [hli], a
-	ld a, [wContestMon]
-	ld [hli], a
-	ld a, [hProduct]
-	ld [hli], a
-	ld a, [hMultiplicand]
-	ld [hl], a
-	call Function1383e
-	ret
-; 13833
-
-Function13833: ; 13833
-	ld hl, wd002
-	ld b, 12
-	xor a
-.loop
-	ld [hli], a
-	dec b
-	jr nz, .loop
-	ret
-; 1383e
-
-Function1383e: ; 1383e
-	ld de, wd010
-	ld hl, wd004
-	ld c, 2
-	call StringCmp
-	jr c, .next
-	ld hl, EndFlypoint
-	ld de, wd00a
-	ld bc, 4
-	call CopyBytes
-	ld hl, wd002
-	ld de, EndFlypoint
-	ld bc, 4
-	call CopyBytes
-	ld hl, wd002
-	call Function138a0
-	jr .done
-
-.next
-	ld de, wd010
-	ld hl, wd008
-	ld c, 2
-	call StringCmp
-	jr c, .next2
-	ld hl, EndFlypoint
-	ld de, wd00a
-	ld bc, 4
-	call CopyBytes
-	ld hl, EndFlypoint
-	call Function138a0
-	jr .done
-
-.next2
-	ld de, wd010
-	ld hl, wd00c
-	ld c, 2
-	call StringCmp
-	jr c, .done
-	ld hl, wd00a
-	call Function138a0
-
-.done
-	ret
-; 138a0
-
-Function138a0: ; 138a0
-	ld de, wd00e
-	ld a, [de]
-	inc de
-	ld [hli], a
-	ld a, [de]
-	inc de
-	ld [hli], a
-	ld a, [de]
-	inc de
-	ld [hli], a
-	ld a, [de]
-	inc de
-	ld [hl], a
-	ret
-; 138b0
-
-Function138b0: ; 138b0
-	ld e, 0
-.loop
-	push de
-	call Special_CheckBugContestContestantFlag
-	pop de
-	jr nz, .done
-	ld a, e
-rept 2
-	inc a
-endr
-	ld [wd00e], a
-	dec a
-	ld c, a
-	ld b, 0
-	ld hl, BugContestantPointers
-rept 2
-	add hl, bc
-endr
-	ld a, [hli]
-	ld h, [hl]
-	ld l, a
-rept 2
-	inc hl
-endr
-.loop2
-	call Random
-	and 3
-	cp 3
-	jr z, .loop2
-	ld c, a
-	ld b, 0
-rept 3
-	add hl, bc
-endr
-	ld a, [hli]
-	ld [wd00f], a
-	ld a, [hli]
-	ld h, [hl]
-	ld l, a
-	call Random
-	and 7
-	ld c, a
-	ld b, 0
-	add hl, bc
-	ld a, h
-	ld [wd010], a
-	ld a, l
-	ld [wd011], a
-	push de
-	call Function1383e
-	pop de
-
-.done
-	inc e
-	ld a, e
-	cp 10
-	jr nz, .loop
-	ret
-; 13900
-
-ContestScore: ; 13900
-; Determine the player's score in the Bug Catching Contest.
-
-	xor a
-	ld [hProduct], a
-	ld [hMultiplicand], a
-
-	ld a, [wContestMonSpecies] ; Species
-	and a
-	jr z, .done
-
-	; Tally the following:
-
-	; Max HP * 4
-	ld a, [wContestMonMaxHP + 1]
-	call .AddContestStat
-	ld a, [wContestMonMaxHP + 1]
-	call .AddContestStat
-	ld a, [wContestMonMaxHP + 1]
-	call .AddContestStat
-	ld a, [wContestMonMaxHP + 1]
-	call .AddContestStat
-
-	; Stats
-	ld a, [wContestMonAttack  + 1]
-	call .AddContestStat
-	ld a, [wContestMonDefense + 1]
-	call .AddContestStat
-	ld a, [wContestMonSpeed   + 1]
-	call .AddContestStat
-	ld a, [wContestMonSpclAtk + 1]
-	call .AddContestStat
-	ld a, [wContestMonSpclDef + 1]
-	call .AddContestStat
-
-	; DVs
-	ld a, [wContestMonDVs + 0]
-	ld b, a
-	and 2
-rept 2
-	add a
-endr
-	ld c, a
-
-	swap b
-	ld a, b
-	and 2
-	add a
-	add c
-	ld d, a
-
-	ld a, [wContestMonDVs + 1]
-	ld b, a
-	and 2
-	ld c, a
-
-	swap b
-	ld a, b
-	and 2
-	srl a
-rept 2
-	add c
-endr
-rept 2
-	add d
-endr
-
-	call .AddContestStat
-
-	; Remaining HP / 8
-	ld a, [wContestMonHP + 1]
-	srl a
-	srl a
-	srl a
-	call .AddContestStat
-
-	; Whether it's holding an item
-	ld a, [wContestMonItem]
-	and a
-	jr z, .done
-
-	ld a, 1
-	call .AddContestStat
-
-.done
-	ret
-; 1397f
-
-.AddContestStat: ; 1397f
-	ld hl, hMultiplicand
-	add [hl]
-	ld [hl], a
-	ret nc
-	dec hl
-	inc [hl]
-	ret
-; 13988
-
 ; decreases all pokemon's pokerus counter by b. if the lower nybble reaches zero, the pokerus is cured.
 ApplyPokerusTick: ; 13988
 	ld hl, PartyMon1PokerusStatus ; PartyMon1 + MON_PKRS
@@ -15598,370 +11065,10 @@
 	ret
 ; 139a8
 
-Special_SelectRandomBugContestContestants: ; 139a8
-; Select five random people to participate in the current contest.
+INCLUDE "event/bug_contest_2.asm"
 
-; First we have to make sure that any old data is cleared away.
-	ld c, 10 ; Number of people to choose from.
-	ld hl, BugCatchingContestantEventFlagTable
-.loop1
-	push bc
-	push hl
-	ld e, [hl]
-	inc hl
-	ld d, [hl]
-	ld b, RESET_FLAG
-	call EventFlagAction
-	pop hl
-rept 2
-	inc hl
-endr
-	pop bc
-	dec c
-	jr nz, .loop1
+INCLUDE "unknown/013a47.asm"
 
-; Now that that's out of the way, we can get on to the good stuff.
-	ld c, 5
-.loop2
-	push bc
-.next
-; Choose a flag at uniform random to be set.
-	call Random
-	cp $fa ; 250
-	jr nc, .next
-	ld c, $19 ; 25
-	call SimpleDivide
-	ld e, b
-	ld d, 0
-	ld hl, BugCatchingContestantEventFlagTable
-rept 2
-	add hl, de
-endr
-	ld e, [hl]
-	inc hl
-	ld d, [hl]
-	push de
-; If we've already set it, it doesn't count.
-	ld b, CHECK_FLAG
-	call EventFlagAction
-	pop de
-	ld a, c
-	and a
-	jr nz, .next
-; Set the flag.  This will cause that sprite to not be visible in the contest.
-	ld b, SET_FLAG
-	call EventFlagAction
-	pop bc
-; Check if we're done.  If so, return.  Otherwise, choose the next victim.
-	dec c
-	jr nz, .loop2
-	ret
-; 139ed
-
-Special_CheckBugContestContestantFlag: ; 139ed
-; Checks the flag of the Bug Catching Contestant whose index is loaded in a.
-
-; Bug: If a >= 10 when this is called, it will read beyond the table.
-
-	ld hl, BugCatchingContestantEventFlagTable
-	ld e, a
-	ld d, 0
-rept 2
-	add hl, de
-endr
-	ld e, [hl]
-	inc hl
-	ld d, [hl]
-	ld b, CHECK_FLAG
-	call EventFlagAction
-	ret
-; 139fe
-
-BugCatchingContestantEventFlagTable: ; 139fe
-	dw EVENT_BUG_CATCHING_CONTESTANT_1A
-	dw EVENT_BUG_CATCHING_CONTESTANT_2A
-	dw EVENT_BUG_CATCHING_CONTESTANT_3A
-	dw EVENT_BUG_CATCHING_CONTESTANT_4A
-	dw EVENT_BUG_CATCHING_CONTESTANT_5A
-	dw EVENT_BUG_CATCHING_CONTESTANT_6A
-	dw EVENT_BUG_CATCHING_CONTESTANT_7A
-	dw EVENT_BUG_CATCHING_CONTESTANT_8A
-	dw EVENT_BUG_CATCHING_CONTESTANT_9A
-	dw EVENT_BUG_CATCHING_CONTESTANT_10A
-; 13a12
-
-CheckFirstMonFainted: ; 13a12
-	ld hl, PartyMon1HP
-	ld a, [hli]
-	or [hl]
-	jr z, .fainted
-	ld hl, PartyCount
-	ld a, 1
-	ld [hli], a
-	inc hl
-	ld a, [hl]
-	ld [wdf9b], a
-	ld [hl], $ff
-	xor a
-	ld [ScriptVar], a
-	ret
-
-.fainted
-	ld a, $1
-	ld [ScriptVar], a
-	ret
-; 13a31
-
-ContestReturnMons: ; 13a31
-	ld hl, PartySpecies + 1
-	ld a, [wdf9b]
-	ld [hl], a
-	ld b, $1
-.asm_13a3a
-	ld a, [hli]
-	cp $ff
-	jr z, .asm_13a42
-	inc b
-	jr .asm_13a3a
-
-.asm_13a42
-	ld a, b
-	ld [PartyCount], a
-	ret
-; 13a47
-
-Function13a47: ; unreferenced
-	ld hl, PartyCount
-	ld a, [hl]
-	and a
-	ret z
-
-	cp PARTY_LENGTH + 1
-	jr c, .asm_13a54
-	ld a, PARTY_LENGTH
-	ld [hl], a
-.asm_13a54
-	inc hl
-
-	ld b, a
-	ld c, 0
-.asm_13a58
-	ld a, [hl]
-	and a
-	jr z, .asm_13a64
-	cp $fc
-	jr z, .asm_13a64
-	cp $fe
-	jr c, .asm_13a73
-
-.asm_13a64
-	ld [hl], SMEARGLE
-	push hl
-	push bc
-	ld a, c
-	ld hl, PartyMon1Species
-	call GetPartyLocation
-	ld [hl], SMEARGLE
-	pop bc
-	pop hl
-
-.asm_13a73
-	inc hl
-	inc c
-	dec b
-	jr nz, .asm_13a58
-	ld [hl], $ff
-
-	ld hl, PartyMon1
-	ld a, [PartyCount]
-	ld d, a
-	ld e, 0
-.asm_13a83
-	push de
-	push hl
-	ld b, h
-	ld c, l
-	ld a, [hl]
-	and a
-	jr z, .asm_13a8f
-	cp NUM_POKEMON + 1
-	jr c, .asm_13a9c
-
-.asm_13a8f
-	ld [hl], SMEARGLE
-	push de
-	ld d, 0
-	ld hl, PartySpecies
-	add hl, de
-	pop de
-	ld a, SMEARGLE
-	ld [hl], a
-
-.asm_13a9c
-	ld [CurSpecies], a
-	call GetBaseData
-	ld hl, MON_LEVEL
-	add hl, bc
-	ld a, [hl]
-	cp MIN_LEVEL
-	ld a, MIN_LEVEL
-	jr c, .asm_13ab4
-	ld a, [hl]
-	cp MAX_LEVEL
-	jr c, .asm_13ab5
-	ld a, MAX_LEVEL
-.asm_13ab4
-	ld [hl], a
-.asm_13ab5
-	ld [CurPartyLevel], a
-
-	ld hl, MON_MAXHP
-	add hl, bc
-	ld d, h
-	ld e, l
-	ld hl, MON_EXP + 2
-	add hl, bc
-	ld b, $1
-	predef CalcPkmnStats
-	pop hl
-	ld bc, PARTYMON_STRUCT_LENGTH
-	add hl, bc
-	pop de
-	inc e
-	dec d
-	jr nz, .asm_13a83
-
-	ld de, PartyMonNicknames
-	ld a, [PartyCount]
-	ld b, a
-	ld c, 0
-.asm_13adc
-	push bc
-	call Function13b71
-	push de
-	callba CheckStringForErrors
-	pop hl
-	pop bc
-	jr nc, .asm_13b0e
-
-	push bc
-	push hl
-	ld hl, PartySpecies
-	push bc
-	ld b, 0
-	add hl, bc
-	pop bc
-	ld a, [hl]
-	cp EGG
-	ld hl, String_13b6b
-	jr z, .asm_13b06
-	ld [wd265], a
-	call GetPokemonName
-	ld hl, StringBuffer1
-.asm_13b06
-	pop de
-	ld bc, PKMN_NAME_LENGTH
-	call CopyBytes
-	pop bc
-
-.asm_13b0e
-	inc c
-	dec b
-	jr nz, .asm_13adc
-
-	ld de, PartyMonOT
-	ld a, [PartyCount]
-	ld b, a
-	ld c, 0
-.asm_13b1b
-	push bc
-	call Function13b71
-	push de
-	callba CheckStringForErrors
-	pop hl
-	jr nc, .asm_13b34
-	ld d, h
-	ld e, l
-	ld hl, PlayerName
-	ld bc, NAME_LENGTH
-	call CopyBytes
-.asm_13b34
-	pop bc
-	inc c
-	dec b
-	jr nz, .asm_13b1b
-
-	ld hl, PartyMon1Moves
-	ld a, [PartyCount]
-	ld b, a
-.asm_13b40
-	push hl
-	ld c, NUM_MOVES
-	ld a, [hl]
-	and a
-	jr z, .asm_13b4b
-	cp NUM_ATTACKS + 1
-	jr c, .asm_13b4d
-.asm_13b4b
-	ld [hl], POUND
-
-.asm_13b4d
-	ld a, [hl]
-	and a
-	jr z, .asm_13b55
-	cp NUM_ATTACKS + 1
-	jr c, .asm_13b5c
-
-.asm_13b55
-	xor a
-	ld [hli], a
-	dec c
-	jr nz, .asm_13b55
-	jr .asm_13b60
-
-.asm_13b5c
-	inc hl
-	dec c
-	jr nz, .asm_13b4d
-
-.asm_13b60
-	pop hl
-	push bc
-	ld bc, PARTYMON_STRUCT_LENGTH
-	add hl, bc
-	pop bc
-	dec b
-	jr nz, .asm_13b40
-	ret
-; 13b6b
-
-String_13b6b: ; 13b6b
-	db "タマゴ@@@"
-; 13b71
-
-Function13b71: ; 13b71
-	push de
-	ld c, 1
-	ld b, 6
-.asm_13b76
-	ld a, [de]
-	cp "@"
-	jr z, .asm_13b85
-	inc de
-	inc c
-	dec b
-	jr nz, .asm_13b76
-	dec c
-	dec de
-	ld a, "@"
-	ld [de], a
-
-.asm_13b85
-	pop de
-	ret
-; 13b87
-
-
 GetSquareRoot: ; 13b87
 ; Return the square root of de in b.
 
@@ -16647,7 +11754,7 @@
 ; 0x157d1
 
 KrisWithdrawItemMenu: ; 0x157d1
-	call LoadPartyMenuDataHeader
+	call LoadStandardMenuDataHeader
 	callba ClearPCItemScreen
 .asm_157da
 	call Function15985
@@ -16726,7 +11833,7 @@
 
 
 KrisTossItemMenu: ; 0x1585f
-	call LoadPartyMenuDataHeader
+	call LoadStandardMenuDataHeader
 	callba ClearPCItemScreen
 .asm_15868
 	call Function15985
@@ -16763,7 +11870,7 @@
 	call Function158b8
 	jr c, .asm_158b6
 	call DisableSpriteUpdates
-	call LoadPartyMenuDataHeader
+	call LoadStandardMenuDataHeader
 	callba Function106a5
 .asm_1589c
 	callba Function106be
@@ -21809,7 +16916,7 @@
 	ld d, 0
 	add hl, de
 	ld [hl], -1
-	call LoadPartyMenuDataHeader
+	call LoadStandardMenuDataHeader
 	ld hl, MenuDataHeader_0x269c5
 	call CopyMenuDataHeader
 	xor a
@@ -22906,7 +18013,7 @@
 	callba _LoadBattleFontsHPBar
 	call ClearSGB
 	call WriteBackup
-	call LoadPartyMenuDataHeader
+	call LoadStandardMenuDataHeader
 	call WaitBGMap
 	jp SetPalettes
 ; 27192
@@ -28149,7 +23256,7 @@
 _KrisMailBoxMenu: ; 0x447a0
 	call InitMail
 	jr z, .nomail
-	call LoadPartyMenuDataHeader
+	call LoadStandardMenuDataHeader
 	call Function44806
 	jp WriteBackup
 
@@ -32023,7 +27130,7 @@
 	call Function1ff8
 	call Function1bee
 	call WaitBGMap
-	call LoadPartyMenuDataHeader
+	call LoadStandardMenuDataHeader
 	callba Function89de0
 	call Call_ExitMenu
 	call Function49351
@@ -32242,7 +27349,7 @@
 	call Function4a6d8
 	call Function1bee
 	call WaitBGMap
-	call LoadPartyMenuDataHeader
+	call LoadStandardMenuDataHeader
 	ld a, $5
 	call GetSRAMBank
 	ld a, [$aa4b]
@@ -36427,13 +31534,13 @@
 	cp UNOWN
 	jr z, .asm_4e266
 	hlcoord 0, 0
-	call Function3786
+	call PrepMonFrontpic
 	ret
 .asm_4e266
 	xor a
 	ld [wc2c6], a
 	hlcoord 0, 0
-	call Function378b
+	call _PrepMonFrontpic
 	ret
 
 Function4e271: ; 4e271 (13:6271)
@@ -36601,7 +31708,7 @@
 	call SetPalettes ; pals
 	call DelayFrame
 	hlcoord 0, 0
-	call Function3786
+	call PrepMonFrontpic
 	callba Function10402d
 	call Function4e497
 
@@ -38089,7 +33196,7 @@
 ; 50677
 
 UnknownScript_0x50677: ; 50677
-	farjump UnknownScript_0x124c8
+	farjump Script_OverworldWhiteout
 ; 5067b
 
 Function5067b: ; 5067b
@@ -41730,7 +36837,7 @@
 	xor a
 	ld [wc2c6], a
 	hlcoord 12, 3
-	call Function378b
+	call _PrepMonFrontpic
 	ld de, VTiles2 tile $31
 	predef GetBackpic
 	ld a, $31
@@ -44625,7 +39732,7 @@
 	ld a, " "
 	call ByteFill
 	hlcoord 6, 5
-	call Function378b
+	call _PrepMonFrontpic
 	call WaitBGMap
 	xor a
 	ld [hBGMapMode], a
@@ -44840,7 +39947,7 @@
 	xor a
 	ld [wc2c6], a
 	hlcoord 6, 5
-	call Function378b
+	call _PrepMonFrontpic
 	ld a, [CurPartySpecies]
 	cp EGG
 	jr z, .asm_867f8
@@ -50111,7 +45218,7 @@
 	hlcoord 0, 12
 	lb bc, 4, 18
 	call TextBox
-	call LoadPartyMenuDataHeader
+	call LoadStandardMenuDataHeader
 	ld hl, UnknownText_0x90a3f
 	call PrintText
 	hlcoord 9, 3
@@ -56796,7 +51903,7 @@
 	ld a, $1
 	ld [UnownLetter], a
 	hlcoord 1, 10
-	call Function3786
+	call PrepMonFrontpic
 	pop hl
 	jp Functionb9803
 ; b9710
@@ -61089,7 +56196,7 @@
 	ret
 
 BillsPCDepositFuncStats: ; e24c8 (38:64c8)
-	call LoadPartyMenuDataHeader
+	call LoadStandardMenuDataHeader
 	call Functione2f7e
 	call ExitMenu
 	call PCMonInfo
@@ -61108,7 +56215,7 @@
 	push af
 	ld de, PCString_ReleasePKMN
 	call Functione2a6e
-	call LoadPartyMenuDataHeader
+	call LoadStandardMenuDataHeader
 	lb bc, 14, 11
 	call PlaceYesNoBox
 	ld a, [MenuSelection2]
@@ -61354,7 +56461,7 @@
 	ret
 
 .stats: ; e26c0 (38:66c0)
-	call LoadPartyMenuDataHeader
+	call LoadStandardMenuDataHeader
 	call Functione2f7e
 	call ExitMenu
 	call PCMonInfo
@@ -61371,7 +56478,7 @@
 	jr c, .FailedRelease
 	ld de, PCString_ReleasePKMN
 	call Functione2a6e
-	call LoadPartyMenuDataHeader
+	call LoadStandardMenuDataHeader
 	lb bc, 14, 11
 	call PlaceYesNoBox
 	ld a, [MenuSelection2]
@@ -61614,7 +56721,7 @@
 ; e28a5
 
 Functione28a5: ; e28a5
-	call LoadPartyMenuDataHeader
+	call LoadStandardMenuDataHeader
 	call Functione2f7e
 	call ExitMenu
 	call PCMonInfo
@@ -63252,7 +58359,7 @@
 ; e35aa
 
 Functione35aa: ; e35aa (38:75aa)
-	call LoadPartyMenuDataHeader
+	call LoadStandardMenuDataHeader
 	call Functione35e2
 .loop
 	xor a
@@ -63494,7 +58601,7 @@
 .asm_e3745
 	ld b, $4
 	ld de, wd002
-	callba Function116c1
+	callba NamingScreen
 	call ClearTileMap
 	call LoadStandardFont
 	call LoadFontsBattleExtra
@@ -72085,7 +67192,7 @@
 
 .asm_1dc469
 	hlcoord 0, 0
-	call Function378b
+	call _PrepMonFrontpic
 	call WaitBGMap
 	ld b, $3
 	call GetSGBLayout
--- a/maps/Route35NationalParkgate.asm
+++ b/maps/Route35NationalParkgate.asm
@@ -96,7 +96,7 @@
 	iffalse Route35NationalParkgate_DeclinedToParticipate
 	checkcode VAR_PARTYCOUNT
 	if_greater_than $1, Route35NationalParkgate_LeaveTheRestBehind
-	special CheckFirstMonFainted
+	special ContestDropOffMons
 	clearevent EVENT_LEFT_MONS_WITH_CONTEST_OFFICER
 Route35NationalParkgate_OkayToProceed:
 	setflag ENGINE_BUG_CONTEST_TIMER
@@ -140,7 +140,7 @@
 	writetext UnknownText_0x6a4c6
 	yesorno
 	iffalse Route35NationalParkgate_DeclinedToLeaveMonsBehind
-	special CheckFirstMonFainted
+	special ContestDropOffMons
 	iftrue Route35NationalParkgate_FirstMonIsFainted
 	setevent EVENT_LEFT_MONS_WITH_CONTEST_OFFICER
 	writetext UnknownText_0x6a537
--- a/maps/Route36NationalParkgate.asm
+++ b/maps/Route36NationalParkgate.asm
@@ -148,7 +148,7 @@
 	iffalse .DecidedNotToJoinContest
 	checkcode VAR_PARTYCOUNT
 	if_greater_than $1, .LeaveMonsWithOfficer
-	special CheckFirstMonFainted
+	special ContestDropOffMons
 	clearevent EVENT_LEFT_MONS_WITH_CONTEST_OFFICER
 .ResumeStartingContest:
 	setflag ENGINE_BUG_CONTEST_TIMER
@@ -183,7 +183,7 @@
 	writetext UnknownText_0x6afb0
 	yesorno
 	iffalse .RefusedToLeaveMons
-	special CheckFirstMonFainted
+	special ContestDropOffMons
 	iftrue .FirstMonIsFainted
 	setevent EVENT_LEFT_MONS_WITH_CONTEST_OFFICER
 	writetext UnknownText_0x6b021
--- a/misc/crystal_misc.asm
+++ b/misc/crystal_misc.asm
@@ -430,7 +430,7 @@
 	ret
 
 .asm_17a92c
-	call LoadPartyMenuDataHeader
+	call LoadStandardMenuDataHeader
 	call Function17a99e
 	ld hl, $d088
 	set 7, [hl]
--- a/misc/mobile_22.asm
+++ b/misc/mobile_22.asm
@@ -2927,7 +2927,7 @@
 ; 0x8a241
 
 Function8a241: ; 8a241 (22:6241)
-	call LoadPartyMenuDataHeader
+	call LoadStandardMenuDataHeader
 	call Function891fe
 	call Function8a262
 	jr nc, .asm_8a254
@@ -3455,7 +3455,7 @@
 ; 8a62c
 
 Function8a62c: ; 8a62c (22:662c)
-	call LoadPartyMenuDataHeader
+	call LoadStandardMenuDataHeader
 	call Function891fe
 	xor a
 	call Function8b94a
@@ -3643,7 +3643,7 @@
 	call Function891fe
 	ld de, wd002
 	ld b, $5
-	callba Function116c1
+	callba NamingScreen
 	call OpenSRAMBank4
 	call Function8931b
 	push bc
@@ -3885,7 +3885,7 @@
 	jr c, .asm_8a9bb
 	push bc
 	push de
-	call LoadPartyMenuDataHeader
+	call LoadStandardMenuDataHeader
 	pop de
 	dec e
 	ld a, e
@@ -4141,7 +4141,7 @@
 
 Function8ab93: ; 8ab93 (22:6b93)
 	call WhiteBGMap
-	call LoadPartyMenuDataHeader
+	call LoadStandardMenuDataHeader
 	callba Function105688
 	call ClearSprites
 	call Function891fe
--- a/misc/mobile_40.asm
+++ b/misc/mobile_40.asm
@@ -4519,7 +4519,7 @@
 
 Function101d95: ; 101d95
 	call Function101ee2
-	call LoadPartyMenuDataHeader
+	call LoadStandardMenuDataHeader
 	ld e, $e
 	call Function101ee4
 	ld hl, wcd29
@@ -6292,7 +6292,7 @@
 ; 1029cf
 
 Function1029cf: ; 1029cf
-	call LoadPartyMenuDataHeader
+	call LoadStandardMenuDataHeader
 	hlcoord 10, 7
 	ld b, $3
 	ld c, $8
--- a/misc/mobile_5b.asm
+++ b/misc/mobile_5b.asm
@@ -884,7 +884,7 @@
 ; 16d43b
 
 Function16d43b: ; 16d43b
-	call LoadPartyMenuDataHeader
+	call LoadStandardMenuDataHeader
 	call WhiteBGMap
 	call ClearTileMap
 	call ClearSprites
@@ -1034,7 +1034,7 @@
 ; 16d6ce
 
 Function16d6ce: ; 16d6ce
-	call LoadPartyMenuDataHeader
+	call LoadStandardMenuDataHeader
 	call Function16d6e1
 	callba Function87d
 	call Call_ExitMenu
--- /dev/null
+++ b/unknown/013a47.asm
@@ -1,0 +1,230 @@
+Function13a47: ; unreferenced
+	ld hl, PartyCount
+	ld a, [hl]
+	and a
+	ret z
+
+	cp PARTY_LENGTH + 1
+	jr c, .asm_13a54
+	ld a, PARTY_LENGTH
+	ld [hl], a
+.asm_13a54
+	inc hl
+
+	ld b, a
+	ld c, 0
+.asm_13a58
+	ld a, [hl]
+	and a
+	jr z, .asm_13a64
+	cp $fc
+	jr z, .asm_13a64
+	cp $fe
+	jr c, .asm_13a73
+
+.asm_13a64
+	ld [hl], SMEARGLE
+	push hl
+	push bc
+	ld a, c
+	ld hl, PartyMon1Species
+	call GetPartyLocation
+	ld [hl], SMEARGLE
+	pop bc
+	pop hl
+
+.asm_13a73
+	inc hl
+	inc c
+	dec b
+	jr nz, .asm_13a58
+	ld [hl], $ff
+
+	ld hl, PartyMon1
+	ld a, [PartyCount]
+	ld d, a
+	ld e, 0
+.asm_13a83
+	push de
+	push hl
+	ld b, h
+	ld c, l
+	ld a, [hl]
+	and a
+	jr z, .asm_13a8f
+	cp NUM_POKEMON + 1
+	jr c, .asm_13a9c
+
+.asm_13a8f
+	ld [hl], SMEARGLE
+	push de
+	ld d, 0
+	ld hl, PartySpecies
+	add hl, de
+	pop de
+	ld a, SMEARGLE
+	ld [hl], a
+
+.asm_13a9c
+	ld [CurSpecies], a
+	call GetBaseData
+	ld hl, MON_LEVEL
+	add hl, bc
+	ld a, [hl]
+	cp MIN_LEVEL
+	ld a, MIN_LEVEL
+	jr c, .asm_13ab4
+	ld a, [hl]
+	cp MAX_LEVEL
+	jr c, .asm_13ab5
+	ld a, MAX_LEVEL
+.asm_13ab4
+	ld [hl], a
+.asm_13ab5
+	ld [CurPartyLevel], a
+
+	ld hl, MON_MAXHP
+	add hl, bc
+	ld d, h
+	ld e, l
+	ld hl, MON_EXP + 2
+	add hl, bc
+	ld b, $1
+	predef CalcPkmnStats
+	pop hl
+	ld bc, PARTYMON_STRUCT_LENGTH
+	add hl, bc
+	pop de
+	inc e
+	dec d
+	jr nz, .asm_13a83
+
+	ld de, PartyMonNicknames
+	ld a, [PartyCount]
+	ld b, a
+	ld c, 0
+.asm_13adc
+	push bc
+	call Function13b71
+	push de
+	callba CheckStringForErrors
+	pop hl
+	pop bc
+	jr nc, .asm_13b0e
+
+	push bc
+	push hl
+	ld hl, PartySpecies
+	push bc
+	ld b, 0
+	add hl, bc
+	pop bc
+	ld a, [hl]
+	cp EGG
+	ld hl, .TAMAGO
+	jr z, .asm_13b06
+	ld [wd265], a
+	call GetPokemonName
+	ld hl, StringBuffer1
+.asm_13b06
+	pop de
+	ld bc, PKMN_NAME_LENGTH
+	call CopyBytes
+	pop bc
+
+.asm_13b0e
+	inc c
+	dec b
+	jr nz, .asm_13adc
+
+	ld de, PartyMonOT
+	ld a, [PartyCount]
+	ld b, a
+	ld c, 0
+.asm_13b1b
+	push bc
+	call Function13b71
+	push de
+	callba CheckStringForErrors
+	pop hl
+	jr nc, .asm_13b34
+	ld d, h
+	ld e, l
+	ld hl, PlayerName
+	ld bc, NAME_LENGTH
+	call CopyBytes
+.asm_13b34
+	pop bc
+	inc c
+	dec b
+	jr nz, .asm_13b1b
+
+	ld hl, PartyMon1Moves
+	ld a, [PartyCount]
+	ld b, a
+.asm_13b40
+	push hl
+	ld c, NUM_MOVES
+	ld a, [hl]
+	and a
+	jr z, .asm_13b4b
+	cp NUM_ATTACKS + 1
+	jr c, .asm_13b4d
+.asm_13b4b
+	ld [hl], POUND
+
+.asm_13b4d
+	ld a, [hl]
+	and a
+	jr z, .asm_13b55
+	cp NUM_ATTACKS + 1
+	jr c, .asm_13b5c
+
+.asm_13b55
+	xor a
+	ld [hli], a
+	dec c
+	jr nz, .asm_13b55
+	jr .asm_13b60
+
+.asm_13b5c
+	inc hl
+	dec c
+	jr nz, .asm_13b4d
+
+.asm_13b60
+	pop hl
+	push bc
+	ld bc, PARTYMON_STRUCT_LENGTH
+	add hl, bc
+	pop bc
+	dec b
+	jr nz, .asm_13b40
+	ret
+; 13b6b
+
+.TAMAGO: ; 13b6b
+	db "タマゴ@@@"
+; 13b71
+
+Function13b71: ; 13b71
+	push de
+	ld c, 1
+	ld b, 6
+.loop
+	ld a, [de]
+	cp "@"
+	jr z, .done
+	inc de
+	inc c
+	dec b
+	jr nz, .loop
+	dec c
+	dec de
+	ld a, "@"
+	ld [de], a
+
+.done
+	pop de
+	ret
+; 13b87
--- a/wram.asm
+++ b/wram.asm
@@ -1507,6 +1507,7 @@
 EngineBuffer1:: ; d03e
 	ds 1
 wd03f::
+wJumpStdScriptBuffer::
 CurFruit:: ; d03f
 MartPointerBank::
 EngineBuffer2::
@@ -2593,7 +2594,9 @@
 
 	ds 3
 
+wLastSpawnMapGroup::
 wdcb2:: ds 1
+wLastSpawnMapNumber::
 wdcb3:: ds 1
 
 WarpNumber:: ; dcb4
@@ -2691,7 +2694,8 @@
 wEggOT::   ds NAME_LENGTH ; df70
 wEggMon::  box_struct wEggMon ; df7b
 
-wdf9b:: ds 1
+wdf9b::
+wBugContestSecondPartySpecies:: ds 1
 
 
 wdf9c::