ref: 2ffcb4b49036b8bcd9a37cdc9305f7ee5567fe6c
parent: 91068077f05afbbfd6571ceadada2c03ac7c8038
author: PikalaxALT <PikalaxALT@gmail.com>
date: Wed Nov 11 18:38:57 EST 2015
More splits; map setup labels
--- a/audio/engine.asm
+++ b/audio/engine.asm
@@ -6,7 +6,7 @@
; FadeMusic
; PlayStereoSFX
-_SoundRestart:: ; e8000
+_MapSetup_Sound_Off:: ; e8000
; restart sound operation
; clear all relevant hardware registers & wram
push hl
@@ -63,7 +63,7 @@
push af
ld a, [MusicFadeIDLo]
push af
- call _SoundRestart
+ call _MapSetup_Sound_Off
pop af
ld [MusicFadeIDLo], a
pop af
@@ -3161,7 +3161,7 @@
ClearChannels:: ; e8fe9
; runs ClearChannel for all 4 channels
-; doesn't seem to be used, but functionally identical to SoundRestart
+; doesn't seem to be used, but functionally identical to MapSetup_Sound_Off
ld hl, rNR50
xor a
rept 2
--- a/battle/core.asm
+++ b/battle/core.asm
@@ -2527,7 +2527,7 @@
or [hl]
ret nz
call ClearTileMap
- call WhiteBGMap
+ call ClearBGPalettes
ret
; 3d02b
@@ -2911,7 +2911,7 @@
.enemy_fainted_mobile_error
call ClearSprites
- call WhiteBGMap
+ call ClearBGPalettes
call _LoadHPBar
call ExitMenu
call LoadTileMapToTempTileMap
@@ -2995,7 +2995,7 @@
; 3d2f7
Function3d2f7: ; 3d2f7
- call WhiteBGMap
+ call ClearBGPalettes
Function3d2fa: ; switch to fullscreen menu?
callba Function5004f
callba Function50405
@@ -3137,7 +3137,7 @@
callba BattleTowerText
call WaitPressAorB_BlinkCursor
call ClearTileMap
- call WhiteBGMap
+ call ClearBGPalettes
ret
.not_canlose
@@ -5290,7 +5290,7 @@
ld a, [wItemAttributeParamBuffer]
cp $3
jr z, .asm_3e24a
- call WhiteBGMap
+ call ClearBGPalettes
.asm_3e24a
xor a
@@ -5332,7 +5332,7 @@
Function3e290:
call ExitMenu
call LoadStandardMenuDataHeader
- call WhiteBGMap
+ call ClearBGPalettes
Function3e299:
call Function3d2fa
xor a
@@ -8816,7 +8816,7 @@
bit 0, a
ret z
call ClearTileMap
- call WhiteBGMap
+ call ClearBGPalettes
ret
; 3f759
--- a/constants/map_constants.asm
+++ b/constants/map_constants.asm
@@ -540,7 +540,7 @@
const OBJECT_SPRITE_Y
const OBJECT_SPRITE_X_OFFSET
const OBJECT_SPRITE_Y_OFFSET
- const OBJECT_27
+ const OBJECT_MOVEMENT_BYTE_INDEX
const OBJECT_28
const OBJECT_29
const OBJECT_30
--- a/constants/map_setup_constants.asm
+++ b/constants/map_setup_constants.asm
@@ -1,16 +1,16 @@
const_value SET $f1
const MAPSETUP_WARP
- const MAPSETUP_02
+ const MAPSETUP_CONTINUE
const MAPSETUP_RELOADMAP
- const MAPSETUP_04
- const MAPSETUP_05
- const MAPSETUP_06
- const MAPSETUP_07
- const MAPSETUP_08
- const MAPSETUP_09
- const MAPSETUP_10
+ const MAPSETUP_TELEPORT
+ const MAPSETUP_DOOR
+ const MAPSETUP_FALL
+ const MAPSETUP_CONNECTION
+ const MAPSETUP_LINKRETURN
+ const MAPSETUP_TRAIN
+ const MAPSETUP_SUBMENU
const MAPSETUP_BADWARP
- const MAPSETUP_12
+ const MAPSETUP_FLY
; Command descriptions from Condensation water's scripting compendium. const_def
const_def
--- a/constants/script_constants.asm
+++ b/constants/script_constants.asm
@@ -42,10 +42,10 @@
const PLAYEREVENT_SEENBYTRAINER
const PLAYEREVENT_TALKTOTRAINER
const PLAYEREVENT_ITEMBALL
- const PLAYEREVENT_4
+ const PLAYEREVENT_CONNECTION
const PLAYEREVENT_WARP
const PLAYEREVENT_FALL
const PLAYEREVENT_WHITEOUT
const PLAYEREVENT_HATCH
- const PLAYEREVENT_9
+ const PLAYEREVENT_JOYCHANGEFACING
NUM_PLAYER_EVENTS EQU const_value
--- /dev/null
+++ b/engine/billspc.asm
@@ -1,0 +1,2667 @@
+_DepositPKMN: ; e2391 (38:6391)
+ ld hl, Options
+ ld a, [hl]
+ push af
+ set 4, [hl]
+ ld a, [VramState]
+ push af
+ xor a
+ ld [VramState], a
+ ld a, [hInMenu]
+ push af
+ ld a, $1
+ ld [hInMenu], a
+ xor a
+ ld [hMapAnims], a
+ call Functione2963
+ xor a
+ ld [wcb2e], a
+ call DelayFrame
+.asm_e23b4
+ call JoyTextDelay
+ ld a, [wJumptableIndex]
+ bit 7, a
+ jr nz, .asm_e23c6
+ call Functione23d5
+ call DelayFrame
+ jr .asm_e23b4
+.asm_e23c6
+ call ClearSprites
+ pop af
+ ld [hInMenu], a
+ pop af
+ ld [VramState], a
+ pop af
+ ld [Options], a
+ ret
+
+Functione23d5: ; e23d5 (38:63d5)
+ ld a, [wJumptableIndex]
+ ld hl, Jumptable_e23df
+ call Functione33df
+ jp [hl]
+
+Jumptable_e23df: ; e23df (38:63df)
+ dw Functione23e9
+ dw Functione241a
+ dw Functione245d
+ dw Functione247d
+ dw Functione2992
+
+
+Functione23e9: ; e23e9 (38:63e9)
+ xor a
+ ld [hBGMapMode], a
+ call ClearSprites
+ call Functione2d30
+ call Functione2a8e
+ ld de, PCString_ChooseaPKMN
+ call Functione2a6e
+ ld a, $5
+ ld [wcb2d], a
+ call Functione2c2c
+ call PCMonInfo
+ ld a, $ff
+ ld [CurPartySpecies], a
+ ld a, $17
+ call Functione33d0
+ call WaitBGMap
+ call Functione2e01
+ call Functione298d
+ ret
+
+Functione241a: ; e241a (38:641a)
+ ld hl, hJoyPressed ; $ffa7
+ ld a, [hl]
+ and B_BUTTON
+ jr nz, .asm_e2457
+ ld a, [hl]
+ and A_BUTTON
+ jr nz, .asm_e2443
+ call Functione29b5
+ and a
+ ret z
+ call Functione2e01
+ xor a
+ ld [hBGMapMode], a
+ call Functione2c2c
+ call PCMonInfo
+ ld a, $1
+ ld [hBGMapMode], a
+ call DelayFrame
+ call DelayFrame
+ ret
+.asm_e2443
+ call Functione2def
+ and a
+ ret z
+ cp $ff
+ jr z, .asm_e2457
+ ld a, $2
+ ld [wJumptableIndex], a
+ ret
+; e2452 (38:6452)
+
+.asm_e2452
+ ld hl, wJumptableIndex
+ dec [hl]
+ ret
+
+.asm_e2457
+ ld a, $4
+ ld [wJumptableIndex], a
+ ret
+
+Functione245d: ; e245d (38:645d)
+ xor a
+ ld [hBGMapMode], a
+ call ClearSprites
+ call Functione2def
+ ld [CurPartySpecies], a
+ ld a, $17
+ call Functione33d0
+ ld de, PCString_WhatsUp
+ call Functione2a6e
+ ld a, $1
+ ld [MenuSelection2], a
+ call Functione298d
+ ret
+
+Functione247d: ; e247d (38:647d)
+ ld hl, BillsPCDepositMenuDataHeader
+ call CopyMenuDataHeader
+ ld a, [MenuSelection2]
+ call Function1d4b
+ call InterpretMenu2
+ jp c, BillsPCDepositFuncCancel
+ ld a, [MenuSelection2]
+ dec a
+ and $3
+ ld e, a
+ ld d, 0
+ ld hl, BillsPCDepositJumptable
+rept 2
+ add hl, de
+endr
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ jp [hl]
+
+BillsPCDepositJumptable: ; e24a1 (38:64a1)
+ dw BillsPCDepositFuncDeposit ; Deposit Pokemon
+ dw BillsPCDepositFuncStats ; Pokemon Stats
+ dw BillsPCDepositFuncRelease ; Release Pokemon
+ dw BillsPCDepositFuncCancel ; Cancel
+
+
+BillsPCDepositFuncDeposit: ; e24a9 (38:64a9)
+ call Functione2f18
+ jp c, BillsPCDepositFuncCancel
+ call Functione307c
+ jr c, .no_overflow_31
+ ld a, $0
+ ld [wJumptableIndex], a
+ xor a
+ ld [wcb2b], a
+ ld [wcb2a], a
+ ret
+.no_overflow_31
+ ld de, PCString_WhatsUp
+ call Functione2a6e
+ ret
+
+BillsPCDepositFuncStats: ; e24c8 (38:64c8)
+ call LoadStandardMenuDataHeader
+ call Functione2f7e
+ call ExitMenu
+ call PCMonInfo
+ call Functione2def
+ ld [CurPartySpecies], a
+ ld a, $17
+ call Functione33d0
+ ret
+
+BillsPCDepositFuncRelease: ; e24e0 (38:64e0)
+ call Functione2f18
+ jr c, BillsPCDepositFuncCancel
+ call Functione2f5f
+ jr c, BillsPCDepositFuncCancel
+ ld a, [MenuSelection2]
+ push af
+ ld de, PCString_ReleasePKMN
+ call Functione2a6e
+ call LoadStandardMenuDataHeader
+ lb bc, 14, 11
+ call PlaceYesNoBox
+ ld a, [MenuSelection2]
+ dec a
+ call ExitMenu
+ and a
+ jr nz, .asm_e252c
+ ld a, [wcb2b]
+ ld hl, wcb2a
+ add [hl]
+ ld [CurPartyMon], a
+ xor a
+ ld [wPokemonWithdrawDepositParameter], a
+ callba Functione039
+ call Functione3180
+ ld a, $0
+ ld [wJumptableIndex], a
+ xor a
+ ld [wcb2b], a
+ ld [wcb2a], a
+ pop af
+ ret
+.asm_e252c
+ ld de, PCString_WhatsUp
+ call Functione2a6e
+ pop af
+ ld [MenuSelection2], a
+ ret
+
+BillsPCDepositFuncCancel: ; e2537 (38:6537)
+ ld a, $0
+ ld [wJumptableIndex], a
+ ret
+; e253d (38:653d)
+
+BillsPCDepositMenuDataHeader: ; 0xe253d (38:653d)
+ db $40 ; flags
+ db 04, 09 ; start coords
+ db 13, 19 ; end coords
+ dw BillsPCDepositMenuData
+ db 1 ; default option
+; 0xe2545
+
+BillsPCDepositMenuData: ; 0xe2545 (38:6545)
+ db $80 ; flags
+ db 4 ; items
+ db "DEPOSIT@"
+ db "STATS@"
+ db "RELEASE@"
+ db "CANCEL@"
+; 0xe2564 (38:6564)
+
+Functione2564: ; e2564
+ hlcoord 0, 0
+ ld b, $4
+ ld c, $8
+ call ClearBox
+ hlcoord 0, 4
+ ld b, $a
+ ld c, $9
+ call ClearBox
+ hlcoord 0, 14
+ ld b, $2
+ ld c, $8
+ call ClearBox
+ ret
+; e2583
+
+_WithdrawPKMN: ; e2583 (38:6583)
+ ld hl, Options
+ ld a, [hl]
+ push af
+ set 4, [hl]
+ ld a, [VramState]
+ push af
+ xor a
+ ld [VramState], a
+ ld a, [hInMenu]
+ push af
+ ld a, $1
+ ld [hInMenu], a
+ xor a
+ ld [hMapAnims], a
+ call Functione2963
+ ld a, $f
+ ld [wcb2e], a
+ call DelayFrame
+.asm_e25a7
+ call JoyTextDelay
+ ld a, [wJumptableIndex]
+ bit 7, a
+ jr nz, .no_overflow_49
+ call Functione25c8
+ call DelayFrame
+ jr .asm_e25a7
+.no_overflow_49
+ call ClearSprites
+ pop af
+ ld [hInMenu], a
+ pop af
+ ld [VramState], a
+ pop af
+ ld [Options], a
+ ret
+
+Functione25c8: ; e25c8 (38:65c8)
+ ld a, [wJumptableIndex]
+ ld hl, .jumptable
+ call Functione33df
+ jp [hl]
+
+.jumptable: ; e25d2 (38:65d2)
+ dw Functione25dc
+ dw Functione2612
+ dw Functione2655
+ dw BillsPC_Withdraw
+ dw Functione2992
+
+
+Functione25dc: ; e25dc (38:65dc)
+ ld a, $f
+ ld [wcb2e], a
+ xor a
+ ld [hBGMapMode], a
+ call ClearSprites
+ call Functione2d30
+ call Functione2a8e
+ ld de, PCString_ChooseaPKMN
+ call Functione2a6e
+ ld a, $5
+ ld [wcb2d], a
+ call Functione2c2c
+ call PCMonInfo
+ ld a, $ff
+ ld [CurPartySpecies], a
+ ld a, $17
+ call Functione33d0
+ call WaitBGMap
+ call Functione2e01
+ call Functione298d
+ ret
+
+Functione2612: ; e2612 (38:6612)
+ ld hl, hJoyPressed ; $ffa7
+ ld a, [hl]
+ and B_BUTTON
+ jr nz, .asm_e264f
+ ld a, [hl]
+ and A_BUTTON
+ jr nz, .asm_e263b
+ call Functione29b5
+ and a
+ ret z
+ call Functione2e01
+ xor a
+ ld [hBGMapMode], a
+ call Functione2c2c
+ call PCMonInfo
+ ld a, $1
+ ld [hBGMapMode], a
+ call DelayFrame
+ call DelayFrame
+ ret
+.asm_e263b
+ call Functione2def
+ and a
+ ret z
+ cp $ff
+ jr z, .asm_e264f
+ ld a, $2
+ ld [wJumptableIndex], a
+ ret
+; e264a (38:664a)
+
+.asm_e264a
+ ld hl, wJumptableIndex
+ dec [hl]
+ ret
+
+.asm_e264f
+ ld a, $4
+ ld [wJumptableIndex], a
+ ret
+; e2655
+
+Functione2655: ; e2655 (38:6655)
+ xor a
+ ld [hBGMapMode], a
+ call ClearSprites
+ call Functione2def
+ ld [CurPartySpecies], a
+ ld a, $17
+ call Functione33d0
+ ld de, PCString_WhatsUp
+ call Functione2a6e
+ ld a, $1
+ ld [MenuSelection2], a
+ call Functione298d
+ ret
+
+BillsPC_Withdraw: ; e2675 (38:6675)
+ ld hl, .MenuDataHeader
+ call CopyMenuDataHeader
+ ld a, [MenuSelection2]
+ call Function1d4b
+ call InterpretMenu2
+ jp c, .cancel
+ ld a, [MenuSelection2]
+ dec a
+ and 3
+ ld e, a
+ ld d, 0
+ ld hl, .jumptable
+rept 2
+ add hl, de
+endr
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ jp [hl]
+
+.jumptable: ; e2699 (38:6699) #mark
+ dw .withdraw ; Withdraw
+ dw .stats ; Stats
+ dw .release ; Release
+ dw .cancel ; Cancel
+
+
+.withdraw: ; e26a1 (38:66a1)
+ call Functione2f18
+ jp c, .cancel
+ call TryWithdrawPokemon
+ jr c, .FailedWithdraw
+ ld a, $0
+ ld [wJumptableIndex], a
+ xor a
+ ld [wcb2b], a
+ ld [wcb2a], a
+ ret
+.FailedWithdraw
+ ld de, PCString_WhatsUp
+ call Functione2a6e
+ ret
+
+.stats: ; e26c0 (38:66c0)
+ call LoadStandardMenuDataHeader
+ call Functione2f7e
+ call ExitMenu
+ call PCMonInfo
+ call Functione2def
+ ld [CurPartySpecies], a
+ ld a, $17
+ call Functione33d0
+ ret
+
+.release: ; e26d8 (38:66d8)
+ ld a, [MenuSelection2]
+ push af
+ call Functione2f5f
+ jr c, .FailedRelease
+ ld de, PCString_ReleasePKMN
+ call Functione2a6e
+ call LoadStandardMenuDataHeader
+ lb bc, 14, 11
+ call PlaceYesNoBox
+ ld a, [MenuSelection2]
+ dec a
+ call ExitMenu
+ and a
+ jr nz, .FailedRelease
+ ld a, [wcb2b]
+ ld hl, wcb2a
+ add [hl]
+ ld [CurPartyMon], a
+ ld a, PC_DEPOSIT
+ ld [wPokemonWithdrawDepositParameter], a
+ callba Functione039
+ call Functione3180
+ ld a, $0
+ ld [wJumptableIndex], a
+ xor a
+ ld [wcb2b], a
+ ld [wcb2a], a
+ pop af
+ ret
+.FailedRelease
+ ld de, PCString_WhatsUp
+ call Functione2a6e
+ pop af
+ ld [MenuSelection2], a
+ ret
+
+.cancel: ; e272b (38:672b)
+ ld a, $0
+ ld [wJumptableIndex], a
+ ret
+; e2731 (38:6731)
+
+.MenuDataHeader: ; 0xe2731
+ db $40 ; flags
+ db 04, 09 ; start coords
+ db 13, 19 ; end coords
+ dw .MenuData
+ db 1 ; default option
+; 0xe2739
+
+.MenuData: ; 0xe2739
+ db $80 ; flags
+ db 4 ; items
+ db "WITHDRAW@"
+ db "STATS@"
+ db "RELEASE@"
+ db "CANCEL@"
+; 0xe2759
+
+_MovePKMNWithoutMail: ; e2759
+ ld hl, Options
+ ld a, [hl]
+ push af
+ set 4, [hl]
+ ld a, [VramState]
+ push af
+ xor a
+ ld [VramState], a
+ ld a, [hInMenu]
+ push af
+ ld a, $1
+ ld [hInMenu], a
+ xor a
+ ld [hMapAnims], a
+ call Functione2963
+ ld a, [wCurBox]
+ and $f
+ inc a
+ ld [wcb2e], a
+ call DelayFrame
+.asm_e2781
+ call JoyTextDelay
+ ld a, [wJumptableIndex]
+ bit 7, a
+ jr nz, .asm_e2793
+ call Functione27a2
+ call DelayFrame
+ jr .asm_e2781
+
+.asm_e2793
+ call ClearSprites
+ pop af
+ ld [hInMenu], a
+ pop af
+ ld [VramState], a
+ pop af
+ ld [Options], a
+ ret
+; e27a2
+
+Functione27a2: ; e27a2
+ ld a, [wJumptableIndex]
+ ld hl, Jumptable_e27ac
+ call Functione33df
+ jp [hl]
+; e27ac
+
+Jumptable_e27ac: ; e27ac
+ dw Functione27ba
+ dw Functione27eb
+ dw Functione283d
+ dw Functione285d
+ dw Functione28df
+ dw Functione2903
+ dw Functione2992
+; e27ba
+
+Functione27ba: ; e27ba
+ xor a
+ ld [hBGMapMode], a
+ call ClearSprites
+ call Functione2d30
+ ld de, PCString_ChooseaPKMN
+ call Functione2a6e
+ ld a, $5
+ ld [wcb2d], a
+ call Functione2c2c
+ call Functione2a80
+ call PCMonInfo
+ ld a, $ff
+ ld [CurPartySpecies], a
+ ld a, $17
+ call Functione33d0
+ call WaitBGMap
+ call Functione2e01
+ call Functione298d
+ ret
+; e27eb
+
+Functione27eb: ; e27eb
+ ld hl, hJoyPressed
+ ld a, [hl]
+ and B_BUTTON
+ jr nz, .asm_e2837
+ ld a, [hl]
+ and A_BUTTON
+ jr nz, .asm_e2823
+ call Functione29d0
+ jr c, .asm_e2816
+ and a
+ ret z
+ call Functione2e01
+ xor a
+ ld [hBGMapMode], a
+ call Functione2c2c
+ call PCMonInfo
+ ld a, $1
+ ld [hBGMapMode], a
+ call DelayFrame
+ call DelayFrame
+ ret
+
+.asm_e2816
+ xor a
+ ld [wcb2b], a
+ ld [wcb2a], a
+ ld a, $0
+ ld [wJumptableIndex], a
+ ret
+
+.asm_e2823
+ call Functione2def
+ and a
+ ret z
+ cp $ff
+ jr z, .asm_e2837
+ ld a, $2
+ ld [wJumptableIndex], a
+ ret
+
+ ld hl, wJumptableIndex
+ dec [hl]
+ ret
+
+.asm_e2837
+ ld a, $6
+ ld [wJumptableIndex], a
+ ret
+; e283d
+
+Functione283d: ; e283d
+ xor a
+ ld [hBGMapMode], a
+ call ClearSprites
+ call Functione2def
+ ld [CurPartySpecies], a
+ ld a, $17
+ call Functione33d0
+ ld de, PCString_WhatsUp
+ call Functione2a6e
+ ld a, $1
+ ld [MenuSelection2], a
+ call Functione298d
+ ret
+; e285d
+
+Functione285d: ; e285d
+ ld hl, MenuDataHeader_0xe28c3
+ call CopyMenuDataHeader
+ ld a, [MenuSelection2]
+ call Function1d4b
+ call InterpretMenu2
+ jp c, Functione28bd
+ ld a, [MenuSelection2]
+ dec a
+ and 3
+ ld e, a
+ ld d, 0
+ ld hl, Jumptable_e2881
+rept 2
+ add hl, de
+endr
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ jp [hl]
+; e2881
+
+Jumptable_e2881: ; e2881
+ dw Functione2887
+ dw Functione28a5
+ dw Functione28bd
+; e2887
+
+Functione2887: ; e2887
+ call Functione2f18
+ jp c, Functione28bd
+ ld a, [wcb2a]
+ ld [wcb2f], a
+ ld a, [wcb2b]
+ ld [wcb30], a
+ ld a, [wcb2e]
+ ld [wcb31], a
+ ld a, $4
+ ld [wJumptableIndex], a
+ ret
+; e28a5
+
+Functione28a5: ; e28a5
+ call LoadStandardMenuDataHeader
+ call Functione2f7e
+ call ExitMenu
+ call PCMonInfo
+ call Functione2def
+ ld [CurPartySpecies], a
+ ld a, $17
+ call Functione33d0
+ ret
+; e28bd
+
+Functione28bd: ; e28bd
+ ld a, $0
+ ld [wJumptableIndex], a
+ ret
+; e28c3
+
+MenuDataHeader_0xe28c3: ; 0xe28c3
+ db $40 ; flags
+ db 04, 09 ; start coords
+ db 13, 19 ; end coords
+ dw MenuData2_0xe28cb
+ db 1 ; default option
+; 0xe28cb
+
+MenuData2_0xe28cb: ; 0xe28cb
+ db $80 ; flags
+ db 3 ; items
+ db "MOVE@"
+ db "STATS@"
+ db "CANCEL@"
+; 0xe28df
+
+Functione28df: ; e28df
+ xor a
+ ld [hBGMapMode], a
+ call Functione2d30
+ ld de, PCString_MoveToWhere
+ call Functione2a6e
+ ld a, $5
+ ld [wcb2d], a
+ call Functione2c2c
+ call Functione2a80
+ call ClearSprites
+ call Functione2e8c
+ call WaitBGMap
+ call Functione298d
+ ret
+; e2903
+
+Functione2903: ; e2903
+ ld hl, hJoyPressed
+ ld a, [hl]
+ and B_BUTTON
+ jr nz, .asm_e294b
+ ld a, [hl]
+ and A_BUTTON
+ jr nz, .asm_e2938
+ call Functione29f4
+ jr c, .asm_e292b
+ and a
+ ret z
+ call Functione2e8c
+ xor a
+ ld [hBGMapMode], a
+ call Functione2c2c
+ ld a, $1
+ ld [hBGMapMode], a
+ call DelayFrame
+ call DelayFrame
+ ret
+
+.asm_e292b
+ xor a
+ ld [wcb2b], a
+ ld [wcb2a], a
+ ld a, $4
+ ld [wJumptableIndex], a
+ ret
+
+.asm_e2938
+ call Functione2ee5
+ jr c, .asm_e2946
+ call Functione31e7
+ ld a, $0
+ ld [wJumptableIndex], a
+ ret
+
+.asm_e2946
+ ld hl, wJumptableIndex
+ dec [hl]
+ ret
+
+.asm_e294b
+ ld a, [wcb2f]
+ ld [wcb2a], a
+ ld a, [wcb30]
+ ld [wcb2b], a
+ ld a, [wcb31]
+ ld [wcb2e], a
+ ld a, $0
+ ld [wJumptableIndex], a
+ ret
+; e2963
+
+Functione2963: ; e2963 (38:6963)
+ call ClearBGPalettes
+ call ClearSprites
+ call ClearTileMap
+ call Functione33e8
+ ld hl, OverworldMap
+ ld bc, $338
+ xor a
+ call ByteFill
+ xor a
+ ld [wJumptableIndex], a
+ ld [wcf64], a
+ ld [wcf65], a
+ ld [wcf66], a
+ ld [wcb2b], a
+ ld [wcb2a], a
+ ret
+
+Functione298d: ; e298d (38:698d)
+ ld hl, wJumptableIndex
+ inc [hl]
+ ret
+
+Functione2992: ; e2992 (38:6992)
+ ld hl, wJumptableIndex
+ set 7, [hl]
+ ret
+
+Functione2998: ; e2998 (38:6998)
+ ld a, [wcb2d]
+ ld d, a
+ ld a, [wcb2c]
+ and a
+ jr z, .asm_e29b2
+ dec a
+ cp $1
+ jr z, .asm_e29b2
+ ld e, a
+ ld a, [hl]
+ and D_UP
+ jr nz, Functione2a18
+ ld a, [hl]
+ and D_DOWN
+ jr nz, Functione2a2c
+.asm_e29b2
+ jp Functione2a65
+
+Functione29b5: ; e29b5 (38:69b5)
+ ld hl, hJoyLast
+ ld a, [wcb2d]
+ ld d, a
+ ld a, [wcb2c]
+ ld e, a
+ and a
+ jr z, .asm_e29cd
+ ld a, [hl]
+ and D_UP
+ jr nz, Functione2a18
+ ld a, [hl]
+ and D_DOWN
+ jr nz, Functione2a2c
+.asm_e29cd
+ jp Functione2a65
+; e29d0 (38:69d0)
+
+Functione29d0: ; e29d0
+ ld hl, hJoyLast
+ ld a, [wcb2d]
+ ld d, a
+ ld a, [wcb2c]
+ ld e, a
+ and a
+ jr z, .asm_e29e8
+ ld a, [hl]
+ and D_UP
+ jr nz, Functione2a18
+ ld a, [hl]
+ and D_DOWN
+ jr nz, Functione2a2c
+
+.asm_e29e8
+ ld a, [hl]
+ and D_LEFT
+ jr nz, Functione2a48
+ ld a, [hl]
+ and D_RIGHT
+ jr nz, Functione2a56
+ jr Functione2a65
+
+Functione29f4: ; e29f4
+ ld hl, hJoyLast
+ ld a, [wcb2d]
+ ld d, a
+ ld a, [wcb2c]
+ ld e, a
+ and a
+ jr z, .asm_e2a0c
+
+ ld a, [hl]
+ and D_UP
+ jr nz, Functione2a18
+ ld a, [hl]
+ and D_DOWN
+ jr nz, Functione2a2c
+
+.asm_e2a0c
+ ld a, [hl]
+ and D_LEFT
+ jr nz, Functione2a48
+ ld a, [hl]
+ and D_RIGHT
+ jr nz, Functione2a56
+ jr Functione2a65
+
+Functione2a18: ; e2a18 (38:6a18)
+ ld hl, wcb2b
+ ld a, [hl]
+ and a
+ jr z, .asm_e2a22
+ dec [hl]
+ jr Functione2a68
+
+.asm_e2a22
+ ld hl, wcb2a
+ ld a, [hl]
+ and a
+ jr z, Functione2a65
+ dec [hl]
+ jr Functione2a68
+
+Functione2a2c: ; e2a2c (38:6a2c)
+ ld a, [wcb2b]
+ ld hl, wcb2a
+ add [hl]
+ inc a
+ cp e
+ jr nc, Functione2a65
+
+ ld hl, wcb2b
+ ld a, [hl]
+ inc a
+ cp d
+ jr nc, .asm_e2a42
+ inc [hl]
+ jr Functione2a68
+
+.asm_e2a42
+ ld hl, wcb2a
+ inc [hl]
+ jr Functione2a68
+; e2a48 (38:6a48)
+
+Functione2a48: ; e2a48
+ ld hl, wcb2e
+ ld a, [hl]
+ and a
+ jr z, .asm_e2a52
+ dec [hl]
+ jr Functione2a6c
+
+.asm_e2a52
+ ld [hl], $e
+ jr Functione2a6c
+
+Functione2a56: ; e2a56
+ ld hl, wcb2e
+ ld a, [hl]
+ cp $e
+ jr z, .asm_e2a61
+ inc [hl]
+ jr Functione2a6c
+
+.asm_e2a61
+ ld [hl], $0
+ jr Functione2a6c
+
+Functione2a65: ; e2a65 (38:6a65)
+ xor a
+ and a
+ ret
+
+Functione2a68: ; e2a68 (38:6a68)
+ ld a, $1
+ and a
+ ret
+; e2a6c (38:6a6c)
+
+Functione2a6c: ; e2a6c
+ scf
+ ret
+; e2a6e
+
+Functione2a6e: ; e2a6e (38:6a6e)
+ push de
+ hlcoord 0, 15
+ lb bc, 1, 18
+ call TextBox
+ pop de
+ hlcoord 1, 16
+ call PlaceString
+ ret
+; e2a80 (38:6a80)
+
+Functione2a80: ; e2a80
+ call Functione2a8e
+ hlcoord 8, 1
+ ld [hl], $5f
+ hlcoord 19, 1
+ ld [hl], $5e
+ ret
+; e2a8e
+
+Functione2a8e: ; e2a8e (38:6a8e)
+ hlcoord 8, 0
+ lb bc, 1, 10
+ call TextBox
+
+ ld a, [wcb2e]
+ and a
+ jr z, .party
+
+ cp NUM_BOXES + 1
+ jr nz, .gotbox
+
+ ld a, [wCurBox]
+ inc a
+.gotbox
+ dec a
+ ld hl, wBoxNames
+ ld bc, BOX_NAME_LENGTH
+ call AddNTimes
+ ld e, l
+ ld d, h
+ jr .print
+
+.party
+ ld de, String_e2abd
+ hlcoord 10, 1
+ call PlaceString
+ ret
+; e2abd (38:6abd)
+
+String_e2abd:
+ db "PARTY <PK><MN>@"
+; e2ac6
+
+PCMonInfo: ; e2ac6 (38:6ac6)
+; Display a monster's pic and
+; attributes when highlighting
+; it in a PC menu.
+
+; Includes the neat cascading
+; effect when showing the pic.
+
+; Example: Species, level, gender,
+; whether it's holding an item.
+
+ hlcoord 0, 0
+ lb bc, 15, 8
+ call ClearBox
+
+ hlcoord 8, 14
+ lb bc, 1, 3
+ call ClearBox
+
+ call Functione2def
+ and a
+ ret z
+ cp $ff
+ ret z
+
+ ld [wd265], a
+ hlcoord 1, 4
+ xor a
+ ld b, 7
+.asm_e2ae9
+ ld c, 7
+ push af
+ push hl
+.asm_e2aed
+ ld [hli], a
+ add 7
+ dec c
+ jr nz, .asm_e2aed
+ pop hl
+ ld de, 20
+ add hl, de
+ pop af
+ inc a
+ dec b
+ jr nz, .asm_e2ae9
+
+ call Functione2b6d
+ ld a, [wd265]
+ ld [CurPartySpecies], a
+ ld [CurSpecies], a
+ ld hl, TempMonDVs
+ predef GetUnownLetter
+ call GetBaseData
+ ld de, VTiles2 tile $00
+ predef GetFrontpic
+ xor a
+ ld [wcb32], a
+ ld a, [CurPartySpecies]
+ ld [wd265], a
+
+ cp EGG
+ ret z
+
+ call GetBasePokemonName
+ hlcoord 1, 14
+ call PlaceString
+
+ hlcoord 1, 12
+ call PrintLevel
+
+ ld a, $3
+ ld [MonType], a
+ callba GetGender
+ jr c, .asm_e2b4f
+ ld a, "♂"
+ jr nz, .printgender
+ ld a, "♀"
+.printgender
+ hlcoord 5, 12
+ ld [hl], a
+.asm_e2b4f
+
+ ld a, [TempMonItem]
+ and a
+ ret z
+
+ ld d, a
+ callab ItemIsMail
+ jr c, .mail
+ ld a, $5d ; item icon
+ jr .printitem
+ ld a, $1
+ ld [wcb32], a
+ ld a, $5c ; mail icon
+.printitem
+ hlcoord 7, 12
+ ld [hl], a
+ ret
+
+Functione2b6d: ; e2b6d (38:6b6d)
+ ld a, [wcb2b]
+ ld hl, wcb2a
+ add [hl]
+ ld e, a
+ ld d, $0
+ ld hl, wc801
+rept 3
+ add hl, de
+endr
+ ld a, [hl]
+ and a
+ jr z, .asm_e2bc6
+ cp $f
+ jr z, .asm_e2bf5
+ ld b, a
+ call Functione3396
+ ld a, b
+ call GetSRAMBank
+ push hl
+ ld bc, $35
+ add hl, bc
+ ld bc, $20
+ ld a, e
+ call AddNTimes
+ ld a, [hl]
+ ld [TempMonLevel], a
+ pop hl
+ push hl
+ ld bc, $17
+ add hl, bc
+ ld bc, $20
+ ld a, e
+ call AddNTimes
+ ld a, [hl]
+ ld [TempMonItem], a
+ pop hl
+ ld bc, $2b
+ add hl, bc
+ ld bc, $20
+ ld a, e
+ call AddNTimes
+ ld de, TempMonDVs
+ ld a, [hli]
+ ld [de], a
+ inc de
+ ld a, [hl]
+ ld [de], a
+ call CloseSRAM
+ ret
+.asm_e2bc6
+ ld hl, PartyMon1Level
+ ld bc, $30
+ ld a, e
+ call AddNTimes
+ ld a, [hl]
+ ld [TempMonLevel], a
+ ld hl, PartyMon1Item
+ ld bc, $30
+ ld a, e
+ call AddNTimes
+ ld a, [hl]
+ ld [TempMonItem], a
+ ld hl, PartyMon1DVs
+ ld bc, $30
+ ld a, e
+ call AddNTimes
+ ld de, TempMonDVs
+ ld a, [hli]
+ ld [de], a
+ inc de
+ ld a, [hl]
+ ld [de], a
+ ret
+
+.asm_e2bf5
+ ld a, BANK(sBox)
+ call GetSRAMBank
+ ld hl, sBoxMon1Level
+ ld bc, $20
+ ld a, e
+ call AddNTimes
+ ld a, [hl]
+ ld [TempMonLevel], a
+
+ ld hl, sBoxMon1Item
+ ld bc, $20
+ ld a, e
+ call AddNTimes
+ ld a, [hl]
+ ld [TempMonItem], a
+
+ ld hl, sBoxMon1DVs
+ ld bc, $20
+ ld a, e
+ call AddNTimes
+ ld de, TempMonDVs
+ ld a, [hli]
+ ld [de], a
+ inc de
+ ld a, [hl]
+ ld [de], a
+
+ call CloseSRAM
+ ret
+
+Functione2c2c: ; e2c2c (38:6c2c)
+ hlcoord 8, 2
+ lb bc, 10, 10
+ call TextBox
+
+ hlcoord 8, 2
+ ld [hl], "└"
+ hlcoord 19, 2
+ ld [hl], "┘"
+
+ ld a, [wcb2a]
+ ld e, a
+ ld d, 0
+ ld hl, OverworldMap
+rept 3
+ add hl, de
+endr
+ ld e, l
+ ld d, h
+ hlcoord 9, 4
+ ld a, [wcb2d]
+.asm_e2c53
+ push af
+ push de
+ push hl
+ call Functione2c6e
+ pop hl
+ ld de, $28
+ add hl, de
+ pop de
+rept 3
+ inc de
+endr
+ pop af
+ dec a
+ jr nz, .asm_e2c53
+ ret
+; e2c67 (38:6c67)
+
+String_e2c67:
+ db "CANCEL@"
+; e2c6e
+
+Functione2c6e: ; e2c6e (38:6c6e)
+ ld a, [de]
+ and a
+ ret z
+ cp $ff
+ jr nz, .asm_e2c7c
+ ld de, String_e2c67
+ call PlaceString
+ ret
+.asm_e2c7c
+ inc de
+ ld a, [de]
+ ld b, a
+ inc de
+ ld a, [de]
+ ld e, a
+ ld a, b
+ and a
+ jr z, .asm_e2cc8
+ cp $f
+ jr z, .asm_e2cf1
+ push hl
+ call Functione3396
+ ld a, b
+ call GetSRAMBank
+ push hl
+ ld bc, $16
+ add hl, bc
+ ld bc, $20
+ ld a, e
+ call AddNTimes
+ ld a, [hl]
+ pop hl
+ and a
+ jr z, .asm_e2cc2
+ ld bc, $372
+ add hl, bc
+ ld bc, $b
+ ld a, e
+ call AddNTimes
+ ld de, StringBuffer1
+ ld bc, $b
+ call CopyBytes
+ call CloseSRAM
+ pop hl
+ ld de, StringBuffer1
+ call PlaceString
+ ret
+.asm_e2cc2
+ call CloseSRAM
+ pop hl
+ jr .asm_e2d23
+.asm_e2cc8
+ push hl
+ ld hl, PartySpecies
+ ld d, $0
+ add hl, de
+ ld a, [hl]
+ and a
+ jr z, .asm_e2cee
+ ld hl, PartyMonNicknames
+ ld bc, $b
+ ld a, e
+ call AddNTimes
+ ld de, StringBuffer1
+ ld bc, $b
+ call CopyBytes
+ pop hl
+ ld de, StringBuffer1
+ call PlaceString
+ ret
+.asm_e2cee
+ pop hl
+ jr .asm_e2d23
+.asm_e2cf1
+ push hl
+ ld a, BANK(sBox)
+ call GetSRAMBank
+ ld hl, sBoxSpecies
+ ld d, $0
+ add hl, de
+ ld a, [hl]
+ and a
+ jr z, .asm_e2d1f
+ ld hl, sBoxMonNicknames
+ ld bc, PKMN_NAME_LENGTH
+ ld a, e
+ call AddNTimes
+ ld de, StringBuffer1
+ ld bc, PKMN_NAME_LENGTH
+ call CopyBytes
+ call CloseSRAM
+ pop hl
+ ld de, StringBuffer1
+ call PlaceString
+ ret
+.asm_e2d1f
+ call CloseSRAM
+ pop hl
+.asm_e2d23
+ ld de, String_e2d2a
+ call PlaceString
+ ret
+; e2d2a (38:6d2a)
+
+String_e2d2a:
+ db "-----@"
+; e2d30
+
+Functione2d30: ; e2d30 (38:6d30)
+ xor a
+ ld hl, OverworldMap
+ ld bc, $5a
+ call ByteFill
+ ld de, OverworldMap
+ xor a
+ ld [wd003], a
+ ld [wd004], a
+ ld a, [wcb2e]
+ and a
+ jr z, .asm_e2d87
+ cp $f
+ jr z, .asm_e2db7
+ ld b, a
+ call Functione3396
+ ld a, b
+ call GetSRAMBank
+ inc hl
+.asm_e2d57
+ ld a, [hl]
+ cp $ff
+ jr z, .asm_e2d79
+ and a
+ jr z, .asm_e2d79
+ ld [de], a
+ inc de
+ ld a, [wcb2e]
+ ld [de], a
+ inc de
+ ld a, [wd003]
+ ld [de], a
+ inc a
+ ld [wd003], a
+ inc de
+ inc hl
+ ld a, [wd004]
+ inc a
+ ld [wd004], a
+ jr .asm_e2d57
+.asm_e2d79
+ call CloseSRAM
+ ld a, $ff
+ ld [de], a
+ ld a, [wd004]
+ inc a
+ ld [wcb2c], a
+ ret
+.asm_e2d87
+ ld hl, PartySpecies
+.asm_e2d8a
+ ld a, [hl]
+ cp $ff
+ jr z, .asm_e2dac
+ and a
+ jr z, .asm_e2dac
+ ld [de], a
+ inc de
+ ld a, [wcb2e]
+ ld [de], a
+ inc de
+ ld a, [wd003]
+ ld [de], a
+ inc a
+ ld [wd003], a
+ inc de
+ inc hl
+ ld a, [wd004]
+ inc a
+ ld [wd004], a
+ jr .asm_e2d8a
+.asm_e2dac
+ ld a, $ff
+ ld [de], a
+ ld a, [wd004]
+ inc a
+ ld [wcb2c], a
+ ret
+.asm_e2db7
+ ld a, BANK(sBox)
+ call GetSRAMBank
+ ld hl, sBoxSpecies
+.asm_e2dbf
+ ld a, [hl]
+ cp $ff
+ jr z, .asm_e2de1
+ and a
+ jr z, .asm_e2de1
+ ld [de], a
+ inc de
+ ld a, [wcb2e]
+ ld [de], a
+ inc de
+ ld a, [wd003]
+ ld [de], a
+ inc a
+ ld [wd003], a
+ inc de
+ inc hl
+ ld a, [wd004]
+ inc a
+ ld [wd004], a
+ jr .asm_e2dbf
+.asm_e2de1
+ call CloseSRAM
+ ld a, $ff
+ ld [de], a
+ ld a, [wd004]
+ inc a
+ ld [wcb2c], a
+ ret
+
+Functione2def: ; e2def (38:6def)
+ ld a, [wcb2b]
+ ld hl, wcb2a
+ add [hl]
+ ld e, a
+ ld d, $0
+ ld hl, OverworldMap
+rept 3
+ add hl, de
+endr
+ ld a, [hl]
+ ret
+
+Functione2e01: ; e2e01 (38:6e01)
+ ld a, [wcb2c]
+ and a
+ jr nz, .asm_e2e0b
+ call ClearSprites
+ ret
+.asm_e2e0b
+ ld hl, Unknown_e2e2b
+ ld de, Sprites
+.done1
+ ld a, [hl]
+ cp $ff
+ ret z
+ ld a, [wcb2b]
+ and $7
+ swap a
+ add [hl]
+ inc hl
+ ld [de], a
+ inc de
+ ld a, [hli]
+ ld [de], a
+ inc de
+ ld a, [hli]
+ ld [de], a
+ inc de
+ ld a, [hli]
+ ld [de], a
+ inc de
+ jr .done1
+; e2e2b (38:6e2b)
+
+Unknown_e2e2b: ; e2e2b
+ db $26, $50, $00, $00
+ db $26, $58, $00, $00
+ db $26, $60, $00, $00
+ db $26, $68, $00, $00
+ db $26, $70, $00, $00
+ db $26, $78, $00, $00
+ db $26, $80, $00, $00
+ db $26, $88, $00, $00
+ db $26, $90, $00, $00
+ db $26, $97, $00, $00
+ db $39, $50, $00, $40
+ db $39, $58, $00, $40
+ db $39, $60, $00, $40
+ db $39, $68, $00, $40
+ db $39, $70, $00, $40
+ db $39, $78, $00, $40
+ db $39, $80, $00, $40
+ db $39, $88, $00, $40
+ db $39, $90, $00, $40
+ db $39, $97, $00, $40
+ db $2e, $4e, $01, $00
+ db $31, $4e, $01, $40
+ db $2e, $99, $01, $20
+ db $31, $99, $01, $60
+ db $ff
+; e2e8c
+
+Functione2e8c: ; e2e8c
+ ld hl, Unknown_e2eac
+ ld de, Sprites
+.asm_e2e92
+ ld a, [hl]
+ cp $ff
+ ret z
+ ld a, [wcb2b]
+ and $7
+ swap a
+ add [hl]
+ inc hl
+ ld [de], a
+ inc de
+ ld a, [hli]
+ ld [de], a
+ inc de
+ ld a, [hli]
+ ld [de], a
+ inc de
+ ld a, [hli]
+ ld [de], a
+ inc de
+ jr .asm_e2e92
+; e2eac
+
+Unknown_e2eac: ; e2eac
+ db $27, $50, $06, $00
+ db $2b, $58, $00, $40
+ db $2b, $60, $00, $40
+ db $2b, $68, $00, $40
+ db $2b, $70, $00, $40
+ db $2b, $78, $00, $40
+ db $2b, $80, $00, $40
+ db $2b, $88, $00, $40
+ db $2b, $90, $00, $40
+ db $27, $98, $07, $00
+ db $ff
+; e2ed5
+
+Functione2ed5: ; e2ed5
+.asm_e2ed5
+ push bc
+ push hl
+.asm_e2ed7
+ ld [hli], a
+ dec c
+ jr nz, .asm_e2ed7
+ pop hl
+ ld bc, SCREEN_WIDTH
+ add hl, bc
+ pop bc
+ dec b
+ jr nz, .asm_e2ed5
+ ret
+; e2ee5
+
+Functione2ee5: ; e2ee5
+ ld hl, wcb2e
+ ld a, [wcb31]
+ cp [hl]
+ jr z, .asm_e2f00
+ ld a, [wcb2e]
+ and a
+ jr z, .asm_e2ef8
+ ld e, $15
+ jr .asm_e2efa
+
+.asm_e2ef8
+ ld e, $7
+
+.asm_e2efa
+ ld a, [wcb2c]
+ cp e
+ jr nc, .asm_e2f02
+
+.asm_e2f00
+ and a
+ ret
+
+.asm_e2f02
+ ld de, PCString_TheresNoRoom
+ call Functione2a6e
+ ld de, SFX_WRONG
+ call WaitPlaySFX
+ call WaitSFX
+ ld c, 50
+ call DelayFrames
+ scf
+ ret
+; e2f18
+
+Functione2f18: ; e2f18 (38:6f18)
+ ld a, [wcb2e]
+ and a
+ jr nz, .Okay
+ ld a, [wcb2c]
+ cp $3
+ jr c, .ItsYourLastPokemon
+ ld a, [wcb2b]
+ ld hl, wcb2a
+ add [hl]
+ ld [CurPartyMon], a
+ callba CheckCurPartyMonFainted
+ jr c, .AllOthersFainted
+ ld a, [wcb32]
+ and a
+ jr nz, .HasMail
+.Okay
+ and a
+ ret
+.HasMail
+ ld de, PCString_RemoveMail
+ jr .NotOkay
+.AllOthersFainted
+ ld de, PCString_NoMoreUsablePKMN
+ jr .NotOkay
+.ItsYourLastPokemon
+ ld de, PCString_ItsYourLastPKMN
+.NotOkay
+ call Functione2a6e
+ ld de, SFX_WRONG
+ call WaitPlaySFX
+ call WaitSFX
+ ld c, 50
+ call DelayFrames
+ scf
+ ret
+
+Functione2f5f: ; e2f5f (38:6f5f)
+ ld a, [CurPartySpecies]
+ cp EGG
+ jr z, .asm_e2f68
+ and a
+ ret
+.asm_e2f68
+ ld de, PCString_NoReleasingEGGS
+ call Functione2a6e
+ ld de, SFX_WRONG
+ call WaitPlaySFX
+ call WaitSFX
+ ld c, 50
+ call DelayFrames
+ scf
+ ret
+
+Functione2f7e: ; e2f7e (38:6f7e)
+ call LowVolume
+ call Functione2fd6
+ ld a, $3
+ ld [MonType], a
+ predef StatsScreenInit
+ call Functione33e8
+ call MaxVolume
+ ret
+
+Functione2f95: ; e2f95 (38:6f95)
+ ld hl, hJoyPressed ; $ffa7
+ ld a, [hl]
+ and A_BUTTON | B_BUTTON | D_RIGHT | D_LEFT
+ ld [wcf73], a
+ jr nz, .pressed_a_b_right_left
+ ld a, [hl]
+ and D_DOWN | D_UP
+ ld [wcf73], a
+ jr nz, .pressed_down_up
+ jr .pressed_a_b_right_left
+
+.pressed_down_up
+ call Functione2998
+ and a
+ jr z, .asm_e2fd1
+ call Functione2def
+ ld [wd265], a
+ call Functione2b6d
+ ld a, [wd265]
+ ld [CurPartySpecies], a
+ ld [CurSpecies], a
+ ld hl, TempMonDVs
+ predef GetUnownLetter
+ call GetBaseData
+ call Functione2fd6
+.pressed_a_b_right_left
+ ret
+
+.asm_e2fd1
+ xor a
+ ld [wcf73], a
+ ret
+
+Functione2fd6: ; e2fd6 (38:6fd6)
+ ld a, [wcb2b]
+ ld hl, wcb2a
+ add [hl]
+ ld [CurPartyMon], a
+ ld a, [wcb2e]
+ and a
+ jr z, .asm_e3020
+ cp $f
+ jr nz, .asm_e3048
+ ld a, BANK(sBox)
+ call GetSRAMBank
+ ld hl, sBoxSpecies
+ call Functione3357
+ ld hl, sBoxMonNicknames
+ call Functione3363
+ ld hl, sBoxMonOT
+ call Functione3376
+ ld hl, sBoxMons
+ ld bc, BOXMON_STRUCT_LENGTH
+ ld a, [CurPartyMon]
+ call AddNTimes
+ ld de, wd018_Mon
+ ld bc, PARTYMON_STRUCT_LENGTH
+ call CopyBytes
+ call CloseSRAM
+ callba Function5088b
+ ret
+
+.asm_e3020
+ ld hl, PartySpecies
+ call Functione3357
+ ld hl, PartyMonNicknames
+ call Functione3363
+ ld hl, PartyMonOT
+ call Functione3376
+ ld hl, PartyMons ; wdcdf (aliases: PartyMon1, PartyMon1Species)
+ ld bc, PARTYMON_STRUCT_LENGTH
+ ld a, [CurPartyMon]
+ call AddNTimes
+ ld de, wd018_Mon
+ ld bc, PARTYMON_STRUCT_LENGTH
+ call CopyBytes
+ ret
+
+.asm_e3048
+ ld b, a
+ call Functione3396
+ ld a, b
+ call GetSRAMBank
+ push hl
+ inc hl
+ call Functione3357
+ pop hl
+ push hl
+ ld bc, $372
+ add hl, bc
+ call Functione3363
+ pop hl
+ push hl
+ ld bc, $296
+ add hl, bc
+ call Functione3376
+ pop hl
+ ld bc, $16
+ add hl, bc
+ ld bc, $20
+ call Functione3389
+ call CloseSRAM
+ callba Function5088b
+ ret
+
+Functione307c: ; e307c (38:707c)
+ ld a, [wcb2b]
+ ld hl, wcb2a
+ add [hl]
+ ld [CurPartyMon], a
+ ld hl, PartyMonNicknames
+ ld a, [CurPartyMon]
+ call GetNick
+ ld a, PC_DEPOSIT
+ ld [wPokemonWithdrawDepositParameter], a
+ predef SentGetPkmnIntoFromBox
+ jr c, .asm_boxisfull
+ xor a
+ ld [wPokemonWithdrawDepositParameter], a
+ callba Functione039
+ ld a, [CurPartySpecies]
+ call PlayCry
+ hlcoord 0, 0
+ lb bc, 15, 8
+ call ClearBox
+ hlcoord 8, 14
+ lb bc, 1, 3
+ call ClearBox
+ hlcoord 0, 15
+ lb bc, 1, 18
+ call TextBox
+ call WaitBGMap
+ hlcoord 1, 16
+ ld de, PCString_Stored
+ call PlaceString
+ ld l, c
+ ld h, b
+ ld de, StringBuffer1
+ call PlaceString
+ ld a, "!"
+ ld [bc], a
+ ld c, 50
+ call DelayFrames
+ and a
+ ret
+
+.asm_boxisfull
+ ld de, PCString_BoxFull
+ call Functione2a6e
+ ld de, SFX_WRONG
+ call WaitPlaySFX
+ call WaitSFX
+ ld c, 50
+ call DelayFrames
+ scf
+ ret
+
+TryWithdrawPokemon: ; e30fa (38:70fa)
+ ld a, [wcb2b]
+ ld hl, wcb2a
+ add [hl]
+ ld [CurPartyMon], a
+ ld a, BANK(sBoxMonNicknames)
+ call GetSRAMBank
+ ld a, [CurPartyMon]
+ ld hl, sBoxMonNicknames
+ call GetNick
+ call CloseSRAM
+ xor a
+ ld [wPokemonWithdrawDepositParameter], a
+ predef SentGetPkmnIntoFromBox
+ jr c, .PartyFull
+ ld a, PC_DEPOSIT
+ ld [wPokemonWithdrawDepositParameter], a
+ callba Functione039
+ ld a, [CurPartySpecies]
+ call PlayCry
+ hlcoord 0, 0
+ lb bc, 15, 8
+ call ClearBox
+ hlcoord 8, 14
+ lb bc, 1, 3
+ call ClearBox
+ hlcoord 0, 15
+ lb bc, 1, 18
+ call TextBox
+ call WaitBGMap
+ hlcoord 1, 16
+ ld de, PCString_Got
+ call PlaceString
+ ld l, c
+ ld h, b
+ ld de, StringBuffer1
+ call PlaceString
+ ld a, $e7
+ ld [bc], a
+ ld c, 50
+ call DelayFrames
+ and a
+ ret
+
+.PartyFull
+ ld de, PCString_PartyFull
+ call Functione2a6e
+ ld de, SFX_WRONG
+ call WaitPlaySFX
+ call WaitSFX
+ ld c, 50
+ call DelayFrames
+ scf
+ ret
+
+
+Functione3180: ; e3180 (38:7180)
+ hlcoord 0, 0
+ lb bc, 15, 8
+ call ClearBox
+ hlcoord 8, 14
+ lb bc, 1, 3
+ call ClearBox
+ hlcoord 0, 15
+ lb bc, 1, 18
+ call TextBox
+
+ call WaitBGMap
+ ld a, [CurPartySpecies]
+ call GetCryIndex
+ jr c, .asm_e31ab
+ ld e, c
+ ld d, b
+ call PlayCryHeader
+.asm_e31ab
+
+ ld a, [CurPartySpecies]
+ ld [wd265], a
+ call GetPokemonName
+ hlcoord 1, 16
+ ld de, PCString_ReleasedPKMN
+ call PlaceString
+ ld c, 80
+ call DelayFrames
+ hlcoord 0, 15
+ lb bc, 1, 18
+ call TextBox
+ hlcoord 1, 16
+ ld de, PCString_Bye
+ call PlaceString
+ ld l, c
+ ld h, b
+ inc hl
+ ld de, StringBuffer1
+ call PlaceString
+ ld l, c
+ ld h, b
+ ld [hl], $e7
+ ld c, 50
+ call DelayFrames
+ ret
+; e31e7 (38:71e7)
+
+Functione31e7: ; e31e7
+ push hl
+ push de
+ push bc
+ push af
+ hlcoord 0, 15
+ lb bc, 1, 18
+ call TextBox
+ hlcoord 1, 16
+ ld de, String_e3233
+ call PlaceString
+ ld c, 20
+ call DelayFrames
+ pop af
+ pop bc
+ pop de
+ pop hl
+ ld a, [wCurBox]
+ push af
+ ld bc, 0
+ ld a, [wcb31]
+ and a
+ jr nz, .asm_e3215
+ set 0, c
+
+.asm_e3215
+ ld a, [wcb2e]
+ and a
+ jr nz, .asm_e321d
+ set 1, c
+
+.asm_e321d
+ ld hl, Jumptable_e3245
+rept 2
+ add hl, bc
+endr
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ ld de, Functione322a
+ push de
+ jp [hl]
+; e322a
+
+Functione322a: ; e322a
+ pop af
+ ld e, a
+ callba Function14ad5
+ ret
+; e3233
+
+String_e3233:
+ db "Saving… Leave ON!@"
+; e3245
+
+Jumptable_e3245: ; e3245
+ dw Functione324d
+ dw Functione3267
+ dw Functione327d
+ dw Functione3284
+; e324d
+
+Functione324d: ; e324d
+ ld hl, wcb31
+ ld a, [wcb2e]
+ cp [hl]
+ jr z, .asm_e325d
+ call Functione32b0
+ call Functione32fa
+ ret
+
+.asm_e325d
+ call Functione32b0
+ call Functione328e
+ call Functione32fa
+ ret
+; e3267
+
+Functione3267: ; e3267
+ call Functione3316
+ ld a, $1
+ ld [wc2cd], a
+ callba SaveGameData
+ xor a
+ ld [wc2cd], a
+ call Functione32fa
+ ret
+; e327d
+
+Functione327d: ; e327d
+ call Functione32b0
+ call Functione3346
+ ret
+; e3284
+
+Functione3284: ; e3284
+ call Functione3316
+ call Functione328e
+ call Functione3346
+ ret
+; e328e
+
+Functione328e: ; e328e
+ ld a, [wcb2b]
+ ld hl, wcb2a
+ add [hl]
+ ld e, a
+ ld a, [wcb30]
+ ld hl, wcb2f
+ add [hl]
+ cp e
+ ret nc
+ ld hl, wcb2b
+ ld a, [hl]
+ and a
+ jr z, .asm_e32a8
+ dec [hl]
+ ret
+
+.asm_e32a8
+ ld hl, wcb2a
+ ld a, [hl]
+ and a
+ ret z
+ dec [hl]
+ ret
+; e32b0
+
+Functione32b0: ; e32b0
+ ld a, [wcb31]
+ dec a
+ ld e, a
+ callba Function14ac2
+ ld a, [wcb30]
+ ld hl, wcb2f
+ add [hl]
+ ld [CurPartyMon], a
+ ld a, $1
+ call GetSRAMBank
+ ld hl, sBoxSpecies
+ call Functione3357
+ ld hl, sBoxMonNicknames
+ call Functione3363
+ ld hl, sBoxMonOT
+ call Functione3376
+ ld hl, sBoxMons
+ ld bc, BOXMON_STRUCT_LENGTH
+ call Functione3389
+ call CloseSRAM
+ callba Function5088b
+ ld a, PC_DEPOSIT
+ ld [wPokemonWithdrawDepositParameter], a
+ callba Functione039
+ ret
+; e32fa
+
+Functione32fa: ; e32fa
+ ld a, [wcb2e]
+ dec a
+ ld e, a
+ callba Function14ac2
+ ld a, [wcb2b]
+ ld hl, wcb2a
+ add [hl]
+ ld [CurPartyMon], a
+ callba Function51322
+ ret
+; e3316
+
+Functione3316: ; e3316
+ ld a, [wcb30]
+ ld hl, wcb2f
+ add [hl]
+ ld [CurPartyMon], a
+ ld hl, PartySpecies
+ call Functione3357
+ ld hl, PartyMonNicknames
+ call Functione3363
+ ld hl, PartyMonOT
+ call Functione3376
+ ld hl, PartyMon1Species
+ ld bc, PARTYMON_STRUCT_LENGTH
+ call Functione3389
+ xor a
+ ld [wPokemonWithdrawDepositParameter], a
+ callba Functione039
+ ret
+; e3346
+
+Functione3346: ; e3346
+ ld a, [wcb2b]
+ ld hl, wcb2a
+ add [hl]
+ ld [CurPartyMon], a
+ callba Function5138b
+ ret
+; e3357
+
+Functione3357: ; e3357 (38:7357)
+ ld a, [CurPartyMon]
+ ld c, a
+ ld b, $0
+ add hl, bc
+ ld a, [hl]
+ ld [CurPartySpecies], a
+ ret
+
+Functione3363: ; e3363 (38:7363)
+ ld bc, $b
+ ld a, [CurPartyMon]
+ call AddNTimes
+ ld de, wd002
+ ld bc, $b
+ call CopyBytes
+ ret
+
+Functione3376: ; e3376 (38:7376)
+ ld bc, $b
+ ld a, [CurPartyMon]
+ call AddNTimes
+ ld de, wd00d
+ ld bc, $b
+ call CopyBytes
+ ret
+
+Functione3389: ; e3389 (38:7389)
+ ld a, [CurPartyMon]
+ call AddNTimes
+ ld de, wd018
+ call CopyBytes
+ ret
+
+Functione3396: ; e3396 (38:7396)
+ dec b
+ ld c, b
+ ld b, 0
+ ld hl, Unknown_e33a6
+rept 3
+ add hl, bc
+endr
+ ld a, [hli]
+ ld b, a
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ ret
+; e33a6 (38:73a6)
+
+Unknown_e33a6: ; e33a6
+ ; bank, address
+ dba sBox1
+ dba sBox2
+ dba sBox3
+ dba sBox4
+ dba sBox5
+ dba sBox6
+ dba sBox7
+ dba sBox8
+ dba sBox9
+ dba sBox10
+ dba sBox11
+ dba sBox12
+ dba sBox13
+ dba sBox14
+; e33d0
+
+Functione33d0: ; e33d0 (38:73d0)
+ ld b, a
+ call GetSGBLayout
+ ld a, $e4
+ call DmgToCgbBGPals
+ ld a, $fc
+ call Functioncf8
+ ret
+
+Functione33df: ; e33df (38:73df)
+ ld e, a
+ ld d, $0
+rept 2
+ add hl, de
+endr
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ ret
+
+Functione33e8: ; e33e8 (38:73e8)
+ call DisableLCD
+ ld hl, VTiles2 tile $00
+ ld bc, $310
+ xor a
+ call ByteFill
+ call LoadStandardFont
+ call LoadFontsBattleExtra
+ ld hl, PCMailGFX
+ ld de, VTiles2 tile $5c
+ ld bc, $40
+ call CopyBytes
+ ld hl, PCSelectLZ
+ ld de, VTiles0 tile $00
+ call Decompress
+ ld a, 6
+ call SkipMusic
+ call EnableLCD
+ ret
+; e3419 (38:7419)
+
+PCSelectLZ: INCBIN "gfx/pc.2bpp.lz"
+PCMailGFX: INCBIN "gfx/pc_mail.2bpp"
+; e34dd
+
+PCString_ChooseaPKMN: db "Choose a <PK><MN>.@"
+PCString_WhatsUp: db "What's up?@"
+PCString_ReleasePKMN: db "Release <PK><MN>?@"
+PCString_MoveToWhere: db "Move to where?@"
+PCString_ItsYourLastPKMN: db "It's your last <PK><MN>!@"
+PCString_TheresNoRoom: db "There's no room!@"
+PCString_NoMoreUsablePKMN: db "No more usable <PK><MN>!@"
+PCString_RemoveMail: db "Remove MAIL.@"
+PCString_ReleasedPKMN: db "Released <PK><MN>.@"
+PCString_Bye: db "Bye,@"
+PCString_Stored: db "Stored @"
+PCString_Got: db "Got @"
+PCString_Non: db "Non.@"
+PCString_BoxFull: db "The BOX is full.@"
+PCString_PartyFull: db "The party's full!@"
+PCString_NoReleasingEGGS: db "No releasing EGGS!@"
+; e35aa
+
+
+_ChangeBox: ; e35aa (38:75aa)
+ call LoadStandardMenuDataHeader
+ call Functione35e2
+.loop
+ xor a
+ ld [hBGMapMode], a
+ call Functione36cf
+ call Functione379c
+ ld hl, _ChangeBox_menudataheader
+ call CopyMenuDataHeader
+ xor a
+ ld [wd0e4], a
+ hlcoord 0, 4
+ lb bc, 8, 9
+ call TextBox
+ call HandleScrollingMenu
+ ld a, [wcf73]
+ cp $2
+ jr z, .done
+ call Functione37af
+ call Functione36f9
+ jr .loop
+.done
+ call WriteBackup
+ ret
+
+Functione35e2: ; e35e2 (38:75e2)
+ xor a
+ ld [hBGMapMode], a
+ hlcoord 0, 0
+ ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
+ ld a, " "
+ call ByteFill
+ ret
+; e35f1 (38:75f1)
+
+_ChangeBox_menudataheader: ; 0xe35f1
+ db $40 ; flags
+ db 05, 01 ; start coords
+ db 12, 09 ; end coords
+ dw .menudata2
+ db 1 ; default option
+; 0xe35f9
+
+.menudata2: ; 0xe35f9
+ db $22 ; flags
+ db 4, 0
+ db 1
+ dba .boxes
+ dba .boxnames
+ dba NULL
+ dba Functione3632
+; e3609
+
+.boxes: ; e3609
+ db NUM_BOXES
+x = 1
+rept NUM_BOXES
+ db x
+x = x + 1
+endr
+ db -1
+; e3619
+
+.boxnames: ; e3619
+ push de
+ ld a, [MenuSelection]
+ dec a
+ call GetBoxName
+ pop hl
+ call PlaceString
+ ret
+; e3626
+
+GetBoxName: ; e3626 (38:7626)
+ ld bc, BOX_NAME_LENGTH
+ ld hl, wBoxNames
+ call AddNTimes
+ ld d, h
+ ld e, l
+ ret
+; e3632 (38:7632)
+
+Functione3632: ; e3632
+ hlcoord 11, 7
+ lb bc, 5, 7
+ call TextBox
+ ld a, [MenuSelection]
+ cp -1
+ ret z
+ hlcoord 12, 9
+ ld de, String_e3663
+ call PlaceString
+ call GetBoxCount
+ ld [wd265], a
+ hlcoord 13, 11
+ ld de, wd265
+ lb bc, 1, 2
+ call PrintNum
+ ld de, String_e3668
+ call PlaceString
+ ret
+; e3663
+
+String_e3663: ; e3663
+ db "#MON@"
+; e3668
+
+String_e3668: ; e3668
+ ; db "/20@"
+ db "/"
+ db "0" + MONS_PER_BOX / 10 ; "2"
+ db "0" + MONS_PER_BOX % 10 ; "0"
+ db "@"
+; e366c
+
+GetBoxCount: ; e366c (38:766c)
+ ld a, [wCurBox]
+ ld c, a
+ ld a, [MenuSelection]
+ dec a
+ cp c
+ jr z, .activebox
+ ld c, a
+ ld b, 0
+ ld hl, .boxbanks
+rept 3
+ add hl, bc
+endr
+ ld a, [hli]
+ ld b, a
+ call GetSRAMBank
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ ld a, [hl]
+ call CloseSRAM
+ ld c, a
+ ld a, [wSavedAtLeastOnce]
+ and a
+ jr z, .newfile
+ ld a, c
+ ret
+
+.newfile
+ xor a
+ ret
+
+.activebox
+ ld a, BANK(sBoxCount)
+ ld b, a
+ call GetSRAMBank
+ ld hl, sBoxCount
+ ld a, [hl]
+ call CloseSRAM
+ ret
+; e36a5 (38:76a5)
+
+.boxbanks: ; e36a5
+ dba sBox1
+ dba sBox2
+ dba sBox3
+ dba sBox4
+ dba sBox5
+ dba sBox6
+ dba sBox7
+ dba sBox8
+ dba sBox9
+ dba sBox10
+ dba sBox11
+ dba sBox12
+ dba sBox13
+ dba sBox14
+; e36cf
+
+Functione36cf: ; e36cf (38:76cf)
+ hlcoord 0, 0
+ ld b, 2
+ ld c, 18
+ call TextBox
+ hlcoord 1, 2
+ ld de, String_e36f1
+ call PlaceString
+ ld a, [wCurBox]
+ and $f
+ call GetBoxName
+ hlcoord 11, 2
+ call PlaceString
+ ret
+; e36f1 (38:76f1)
+
+String_e36f1: ; e36f1
+ db "CURRENT@"
+; e36f9
+
+Functione36f9: ; e36f9 (38:76f9)
+ ld hl, MenuDataHeader_0xe377b
+ call LoadMenuDataHeader
+ call InterpretMenu2
+ call ExitMenu
+ ret c
+ ld a, [MenuSelection2]
+ cp $1
+ jr z, .asm_e3734
+ cp $2
+ jr z, .asm_e3745
+ cp $3
+ jr z, .asm_e3717
+ and a
+ ret
+
+.asm_e3717
+ call GetBoxCount
+ and a
+ jr z, .asm_e372f
+ ld e, l
+ ld d, h
+ ld a, [MenuSelection]
+ dec a
+ ld c, a
+ callba Function844bc
+ call Functione35e2
+ and a
+ ret
+
+.asm_e372f
+ call Functione37be
+ and a
+ ret
+
+.asm_e3734
+ ld a, [MenuSelection]
+ dec a
+ ld e, a
+ ld a, [wCurBox]
+ cp e
+ ret z
+ callba Function14a83
+ ret
+
+.asm_e3745
+ ld b, $4
+ ld de, wd002
+ callba NamingScreen
+ call ClearTileMap
+ call LoadStandardFont
+ call LoadFontsBattleExtra
+ ld a, [MenuSelection]
+ dec a
+ call GetBoxName
+ ld e, l
+ ld d, h
+ ld hl, wd002
+ ld c, $8
+ call InitString
+ ld a, [MenuSelection]
+ dec a
+ call GetBoxName
+ ld de, wd002
+ call CopyName2
+ ret
+; e3778 (38:7778)
+
+ hlcoord 11, 7 ; XXX
+
+MenuDataHeader_0xe377b: ; 0xe377b
+ db $40 ; flags
+ db 04, 11 ; start coords
+ db 13, 19 ; end coords
+ dw MenuData2_0xe3783
+ db 1 ; default option
+; 0xe3783
+
+MenuData2_0xe3783: ; 0xe3783
+ db $80 ; flags
+ db 4 ; items
+ db "SWITCH@"
+ db "NAME@"
+ db "PRINT@"
+ db "QUIT@"
+; 0xe379c
+
+Functione379c: ; e379c (38:779c)
+ ld de, String_e37a1
+ jr Functione37e3
+; e37a1 (38:77a1)
+
+String_e37a1: ; e37a1
+ db "Choose a BOX.@"
+; e37af
+
+Functione37af: ; e37af (38:77af)
+ ld de, String_e37b4
+ jr Functione37e3
+; e37b4 (38:77b4)
+
+String_e37b4: ; e37b4
+ db "What's up?@"
+; e37be
+
+Functione37be: ; e37be (38:77be)
+ ld de, String_e37d3
+ call Functione37e3
+ ld de, SFX_WRONG
+ call WaitPlaySFX
+ call WaitSFX
+ ld c, 50
+ call DelayFrames
+ ret
+; e37d3 (38:77d3)
+
+String_e37d3: ; e37d3
+ db "There's no #MON.@"
+; e37e3
+
+Functione37e3: ; e37e3 (38:77e3)
+ push de
+ hlcoord 0, 14
+ lb bc, 2, 18
+ call TextBox
+ pop de
+ hlcoord 1, 16
+ call PlaceString
+ ld a, $1
+ ld [hBGMapMode], a
+ ret
--- /dev/null
+++ b/engine/card_flip.asm
@@ -1,0 +1,2560 @@
+_CardFlip: ; e00ee (38:40ee)
+ ld hl, Options
+ set 4, [hl]
+ call ClearBGPalettes
+ call ClearTileMap
+ call ClearSprites
+ ld de, MUSIC_NONE
+ call PlayMusic
+ call DelayFrame
+ call DisableLCD
+ call LoadStandardFont
+ call LoadFontsExtra
+ ld hl, LZ_e0d16
+ ld de, VTiles2 tile $00
+ call Decompress
+ ld hl, LZ_e0ea8
+ ld de, VTiles2 tile $3e
+ call Decompress
+ ld hl, LZ_e0cdb
+ ld de, VTiles0 tile $00
+ call Decompress
+ ld hl, GFX_e0cf6
+ ld de, VTiles1 tile $6f
+ ld bc, $10
+ call CopyBytes
+ ld hl, GFX_e0d06
+ ld de, VTiles1 tile $75
+ ld bc, $10
+ call CopyBytes
+ call Functione0521
+ call Functione04c1
+ call Functione0c37
+ call EnableLCD
+ call Function3200
+ ld a, $e4
+ call DmgToCgbBGPals
+ ld de, $e4e4
+ call DmgToCgbObjPals
+ call DelayFrame
+ xor a
+ ld [wJumptableIndex], a
+ ld a, $2
+ ld [wcf64], a
+ ld [wcf65], a
+ ld de, MUSIC_GAME_CORNER
+ call PlayMusic
+.MasterLoop
+ ld a, [wJumptableIndex]
+ bit 7, a
+ jr nz, .leavethegame
+ call .CardFlip
+ jr .MasterLoop
+.leavethegame
+ call WaitSFX
+ ld de, SFX_QUIT_SLOTS
+ call PlaySFX
+ call WaitSFX
+ call ClearBGPalettes
+ ld hl, Options
+ res 4, [hl]
+ ret
+
+.CardFlip: ; e0191 (38:4191)
+ ld a, [wJumptableIndex]
+ ld e, a
+ ld d, 0
+ ld hl, .Jumptable
+rept 2
+ add hl, de
+endr
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ jp [hl]
+; e01a0 (38:41a0)
+
+.Jumptable: ; e01a0
+ dw .AskPlayWithThree
+ dw .DeductCoins
+ dw .ChooseACard
+ dw .PlaceYourBet
+ dw .CheckTheCard
+ dw .TabulateTheResult
+ dw .PlayAgain
+ dw .Quit
+; e01b0
+
+.Increment: ; e01b0
+ ld hl, wJumptableIndex
+ inc [hl]
+ ret
+; e01b5
+
+.AskPlayWithThree: ; e01b5
+ ld hl, .PlayWithThreeCoinsText
+ call Functione0489
+ call YesNoBox
+ jr c, .SaidNo
+ call Functione0366
+ call .Increment
+ ret
+
+.SaidNo
+ ld a, $7
+ ld [wJumptableIndex], a
+ ret
+; e01cd
+
+.PlayWithThreeCoinsText: ; 0xe01cd
+ ; Play with three coins?
+ text_jump UnknownText_0x1c5793
+ db "@"
+; 0xe01d2
+
+.DeductCoins: ; e01d2
+ ld a, [Coins]
+ ld h, a
+ ld a, [Coins + 1]
+ ld l, a
+ ld a, h
+ and a
+ jr nz, .deduct ; You have at least 256 coins.
+ ld a, l
+ cp 3
+ jr nc, .deduct ; You have at least 3 coins.
+ ld hl, .NotEnoughCoinsText
+ call Functione0489
+ ld a, $7
+ ld [wJumptableIndex], a
+ ret
+
+.deduct
+ ld de, -3
+ add hl, de
+ ld a, h
+ ld [Coins], a
+ ld a, l
+ ld [Coins + 1], a
+ ld de, SFX_TRANSACTION
+ call PlaySFX
+ xor a
+ ld [hBGMapMode], a
+ call Functione049c
+ ld a, $1
+ ld [hBGMapMode], a
+ call WaitSFX
+ call .Increment
+ ret
+; e0212
+
+.NotEnoughCoinsText: ; 0xe0212
+ ; Not enough coins…
+ text_jump UnknownText_0x1c57ab
+ db "@"
+; 0xe0217
+
+.ChooseACard: ; e0217
+ xor a
+ ld [hBGMapMode], a
+ hlcoord 0, 0
+ lb bc, 12, 9
+ call Functione04e5
+ hlcoord 9, 0
+ ld bc, SCREEN_WIDTH
+ ld a, [wc6e8]
+ call AddNTimes
+ ld [hl], $f5
+ ld a, $1
+ ld [hBGMapMode], a
+ ld c, 20
+ call DelayFrames
+ hlcoord 2, 0
+ call Functione03c1
+ ld a, $1
+ ld [hBGMapMode], a
+ ld c, 20
+ call DelayFrames
+ hlcoord 2, 6
+ call Functione03c1
+ call WaitBGMap
+ ld hl, .ChooseACardText
+ call Functione0489
+ xor a
+ ld [wcf66], a
+.loop
+ call JoyTextDelay
+ ld a, [hJoyLast]
+ and A_BUTTON
+ jr nz, .next
+ ld de, SFX_KINESIS
+ call PlaySFX
+ call Functione0849
+ ld c, 4
+ call DelayFrames
+ ld hl, wcf66
+ ld a, [hl]
+ xor $1
+ ld [hl], a
+ jr .loop
+
+.next
+ ld de, SFX_SLOT_MACHINE_START
+ call PlaySFX
+ ld a, $3
+.loop2
+ push af
+ call Functione0849
+ ld c, 4
+ call DelayFrames
+ call ClearSprites
+ ld c, 4
+ call DelayFrames
+ pop af
+ dec a
+ jr nz, .loop2
+ ld hl, wcf66
+ ld a, [hl]
+ push af
+ xor $1
+ ld [hl], a
+ call Functione03ac
+ lb bc, 6, 5
+ call Functione04e5
+ pop af
+ ld [wcf66], a
+ call .Increment
+ ret
+; e02b2
+
+.ChooseACardText: ; 0xe02b2
+ ; Choose a card.
+ text_jump UnknownText_0x1c57be
+ db "@"
+; 0xe02b7
+
+.PlaceYourBet: ; e02b7
+ ld hl, .PlaceYourBetText
+ call Functione0489
+.betloop
+ call JoyTextDelay
+ ld a, [hJoyLast]
+ and A_BUTTON
+ jr nz, .betdone
+ call Functione089c
+ call Functione0960
+ call DelayFrame
+ jr .betloop
+
+.betdone
+ call .Increment
+ ret
+; e02d5
+
+.PlaceYourBetText: ; 0xe02d5
+ ; Place your bet.
+ text_jump UnknownText_0x1c57ce
+ db "@"
+; 0xe02da
+
+.CheckTheCard: ; e02da
+ xor a
+ ld [hVBlankCounter], a
+ call Functione0960
+ call WaitSFX
+ ld de, SFX_CHOOSE_A_CARD
+ call PlaySFX
+ call WaitSFX
+ ld a, [wc6e8]
+ ld e, a
+ ld d, 0
+ ld hl, wc6d0
+rept 2
+ add hl, de
+endr
+ ld a, [wcf66]
+ ld e, a
+ add hl, de
+ ld a, [hl]
+ ld [CurEnemyMoveNum], a
+ ld e, a
+ ld hl, wc6ea
+ add hl, de
+ ld [hl], $1
+ call Functione03ac
+ call Functione03ec
+ call Function3200
+ call .Increment
+ ret
+; e0314
+
+.TabulateTheResult: ; e0314
+ call Functione0637
+ call WaitPressAorB_BlinkCursor
+ call .Increment
+ ret
+; e031e
+
+.PlayAgain: ; e031e
+ call ClearSprites
+ ld hl, .PlayAgainText
+ call Functione0489
+ call YesNoBox
+ jr nc, .Continue
+ call .Increment
+ ret
+
+.Continue
+ ld a, [wc6e8]
+ inc a
+ ld [wc6e8], a
+ cp $c
+ jr c, .KeepTheCurrentDeck
+ call Functione04c1
+ ld a, $1
+ ld [hBGMapMode], a
+ call Functione0366
+ ld hl, .CardsShuffledText
+ call PrintText
+ jr .LoopAround
+
+.KeepTheCurrentDeck
+ call Functione0534
+
+.LoopAround
+ ld a, $1
+ ld [wJumptableIndex], a
+ ret
+; e0356
+
+.PlayAgainText: ; 0xe0356
+ ; Want to play again?
+ text_jump UnknownText_0x1c57df
+ db "@"
+; 0xe035b
+
+.CardsShuffledText: ; 0xe035b
+ ; The cards have been shuffled.
+ text_jump UnknownText_0x1c57f4
+ db "@"
+; 0xe0360
+
+.Quit: ; e0360
+ ld hl, wJumptableIndex
+ set 7, [hl]
+ ret
+; e0366
+
+Functione0366: ; e0366
+ ld hl, wc6d0
+ ld bc, $18
+ xor a
+ call ByteFill
+ ld de, wc6d0
+ ld c, $17
+.asm_e0375
+ call Random
+ and $1f
+ cp $18
+ jr nc, .asm_e0375
+ ld l, a
+ ld h, $0
+ add hl, de
+ ld a, [hl]
+ and a
+ jr nz, .asm_e0375
+ ld [hl], c
+ dec c
+ jr nz, .asm_e0375
+ xor a
+ ld [wc6e8], a
+ ld hl, wc6ea
+ ld bc, $18
+ call ByteFill
+ ret
+; e0398
+
+Functione0398: ; e0398
+ ld hl, 0
+ ld bc, 6
+ ld a, [wcf64]
+ call AddNTimes
+ ld b, $0
+ ld a, [wcf65]
+ ld c, a
+ add hl, bc
+ ret
+; e03ac
+
+Functione03ac: ; e03ac
+ ld a, [wcf66]
+ and a
+ jr nz, .asm_e03ba
+ hlcoord 2, 0
+ ld bc, $1018
+ jr .asm_e03c0
+
+.asm_e03ba
+ hlcoord 2, 6
+ ld bc, $4018
+
+.asm_e03c0
+ ret
+; e03c1
+
+Functione03c1: ; e03c1
+ xor a
+ ld [hBGMapMode], a
+ ld de, Unknown_e03ce
+ lb bc, 6, 5
+ call Functione04f7
+ ret
+; e03ce
+
+Unknown_e03ce: ; e03ce
+ db $08, $09, $09, $09, $0a
+ db $0b, $28, $2b, $28, $0c
+ db $0b, $2c, $2d, $2e, $0c
+ db $0b, $2f, $30, $31, $0c
+ db $0b, $32, $33, $34, $0c
+ db $0d, $0e, $0e, $0e, $0f
+; e03ec
+
+Functione03ec: ; e03ec
+ xor a
+ ld [hBGMapMode], a
+ push hl
+ push hl
+ ld de, Unknown_e043b
+ lb bc, 6, 5
+ call Functione04f7
+ ld a, [CurEnemyMoveNum]
+ ld e, a
+ ld d, 0
+ ld hl, Unknown_e0459
+rept 2
+ add hl, de
+endr
+ ld a, [hli]
+ ld e, a
+ ld d, [hl]
+ pop hl
+ ld bc, $17
+ add hl, bc
+ ld [hl], e
+ ld bc, SCREEN_HEIGHT
+ add hl, bc
+ ld a, d
+ ld de, SCREEN_WIDTH
+ ld b, $3
+.asm_e0418
+ push hl
+ ld c, $3
+.asm_e041b
+ ld [hli], a
+ inc a
+ dec c
+ jr nz, .asm_e041b
+ pop hl
+ add hl, de
+ dec b
+ jr nz, .asm_e0418
+ pop hl
+ ld a, [hCGB]
+ and a
+ ret z
+ ld de, AttrMap - TileMap
+ add hl, de
+ ld a, [CurEnemyMoveNum]
+ and 3
+ inc a
+ lb bc, 6, 5
+ call Functione04e7
+ ret
+; e043b
+
+Unknown_e043b: ; e043b
+ db $18, $19, $19, $19, $1a
+ db $1b, $35, $7f, $7f, $1c
+ db $0b, $28, $28, $28, $0c
+ db $0b, $28, $28, $28, $0c
+ db $0b, $28, $28, $28, $0c
+ db $1d, $1e, $1e, $1e, $1f
+; e0459
+
+Unknown_e0459: ; e0459
+ db $f7,$4e, $f7,$57, $f7,$69, $f7,$60
+ db $f8,$4e, $f8,$57, $f8,$69, $f8,$60
+ db $f9,$4e, $f9,$57, $f9,$69, $f9,$60
+ db $fa,$4e, $fa,$57, $fa,$69, $fa,$60
+ db $fb,$4e, $fb,$57, $fb,$69, $fb,$60
+ db $fc,$4e, $fc,$57, $fc,$69, $fc,$60
+; e0489
+
+Functione0489: ; e0489
+ push hl
+ hlcoord 0, 12
+ ld b, $4
+ ld c, $12
+ call TextBox
+ pop hl
+ call PrintTextBoxText
+ call Functione049c
+ ret
+; e049c
+
+Functione049c: ; e049c
+ hlcoord 9, 15
+ ld b, $1
+ ld c, $9
+ call TextBox
+ hlcoord 10, 16
+ ld de, String_e04bc
+ call PlaceString
+ hlcoord 15, 16
+ ld de, Coins
+ lb bc, PRINTNUM_LEADINGZEROS | 2, 4
+ call PrintNum
+ ret
+; e04bc
+
+String_e04bc:
+ db "COIN@"
+; e04c1
+
+Functione04c1: ; e04c1 (38:44c1)
+ xor a
+ ld [hBGMapMode], a
+ hlcoord 0, 0
+ ld bc, SCREEN_HEIGHT * SCREEN_WIDTH
+ ld a, $29
+ call ByteFill
+ hlcoord 9, 0
+ ld de, Unknown_e110c
+ lb bc, 12, 11
+ call Functione04f7
+ hlcoord 0, 12
+ lb bc, 4, 18
+ call TextBox
+ ret
+; e04e5 (38:44e5)
+
+Functione04e5: ; e04e5
+ ld a, $29
+
+Functione04e7: ; e04e7 (38:44e7)
+ push bc
+ push hl
+.asm_e04e9
+ ld [hli], a
+ dec c
+ jr nz, .asm_e04e9
+ pop hl
+ ld bc, $14
+ add hl, bc
+ pop bc
+ dec b
+ jr nz, Functione04e7
+ ret
+
+Functione04f7: ; e04f7 (38:44f7)
+ push bc
+ push hl
+.asm_e04f9
+ ld a, [de]
+ inc de
+ ld [hli], a
+ dec c
+ jr nz, .asm_e04f9
+ pop hl
+ ld bc, $14
+ add hl, bc
+ pop bc
+ dec b
+ jr nz, Functione04f7
+ ret
+; e0509 (38:4509)
+
+Functione0509: ; e0509
+ ld de, Sprites
+ ld a, [hli]
+.asm_e050d
+ push af
+ ld a, [hli]
+ add b
+ ld [de], a
+ inc de
+ ld a, [hli]
+ add c
+ ld [de], a
+ inc de
+ ld a, [hli]
+ ld [de], a
+ inc de
+ ld a, [hli]
+ ld [de], a
+ inc de
+ pop af
+ dec a
+ jr nz, .asm_e050d
+ ret
+; e0521
+
+Functione0521: ; e0521 (38:4521)
+ ld de, VTiles1 tile $76
+ ld hl, $8f62
+ ld bc, $9e
+ call CopyBytes
+ ld hl, $8ffe
+ xor a
+ ld [hli], a
+ ld [hl], a
+ ret
+; e0534 (38:4534)
+
+Functione0534: ; e0534
+ xor a
+ ld [hBGMapMode], a
+ ld a, [CurEnemyMoveNum]
+ ld e, a
+ ld d, 0
+ and 3
+ ld c, a
+ ld b, 0
+ ld a, e
+ and $1c
+ srl a
+ add Jumptable_e0553 % $100
+ ld l, a
+ ld a, 0
+ adc Jumptable_e0553 / $100
+ ld h, a
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ jp [hl]
+; e0553
+
+Jumptable_e0553: ; e0553
+ dw Functione055f
+ dw Functione0583
+ dw Functione05a7
+ dw Functione05cb
+ dw Functione05ef
+ dw Functione0613
+; e055f
+
+Functione055f: ; e055f
+ ld hl, wc6e6 + 8
+ add hl, de
+ ld a, [hl]
+ and a
+ jr nz, .asm_e0575
+ hlcoord 13, 3
+rept 2
+ add hl, bc
+endr
+ ld [hl], $36
+ ld bc, SCREEN_WIDTH
+ add hl, bc
+ ld [hl], $37
+ ret
+
+.asm_e0575
+ hlcoord 13, 3
+rept 2
+ add hl, bc
+endr
+ ld [hl], $36
+ ld bc, SCREEN_WIDTH
+ add hl, bc
+ ld [hl], $3d
+ ret
+; e0583
+
+Functione0583: ; e0583
+ ld hl, wc6e6
+ add hl, de
+ ld a, [hl]
+ and a
+ jr nz, .asm_e0599
+ hlcoord 13, 4
+rept 2
+ add hl, bc
+endr
+ ld [hl], $3b
+ ld bc, SCREEN_WIDTH
+ add hl, bc
+ ld [hl], $3a
+ ret
+
+.asm_e0599
+ hlcoord 13, 4
+rept 2
+ add hl, bc
+endr
+ ld [hl], $3d
+ ld bc, SCREEN_WIDTH
+ add hl, bc
+ ld [hl], $3a
+ ret
+; e05a7
+
+Functione05a7: ; e05a7
+ ld hl, wc6e6 + 8
+ add hl, de
+ ld a, [hl]
+ and a
+ jr nz, .asm_e05bd
+ hlcoord 13, 6
+rept 2
+ add hl, bc
+endr
+ ld [hl], $36
+ ld bc, SCREEN_WIDTH
+ add hl, bc
+ ld [hl], $38
+ ret
+
+.asm_e05bd
+ hlcoord 13, 6
+rept 2
+ add hl, bc
+endr
+ ld [hl], $36
+ ld bc, SCREEN_WIDTH
+ add hl, bc
+ ld [hl], $3d
+ ret
+; e05cb
+
+Functione05cb: ; e05cb
+ ld hl, wc6e6
+ add hl, de
+ ld a, [hl]
+ and a
+ jr nz, .asm_e05e1
+ hlcoord 13, 7
+rept 2
+ add hl, bc
+endr
+ ld [hl], $3c
+ ld bc, SCREEN_WIDTH
+ add hl, bc
+ ld [hl], $3a
+ ret
+
+.asm_e05e1
+ hlcoord 13, 7
+rept 2
+ add hl, bc
+endr
+ ld [hl], $3d
+ ld bc, SCREEN_WIDTH
+ add hl, bc
+ ld [hl], $3a
+ ret
+; e05ef
+
+Functione05ef: ; e05ef
+ ld hl, wc6e6 + 8
+ add hl, de
+ ld a, [hl]
+ and a
+ jr nz, .asm_e0605
+ hlcoord 13, 9
+rept 2
+ add hl, bc
+endr
+ ld [hl], $36
+ ld bc, SCREEN_WIDTH
+ add hl, bc
+ ld [hl], $39
+ ret
+
+.asm_e0605
+ hlcoord 13, 9
+rept 2
+ add hl, bc
+endr
+ ld [hl], $36
+ ld bc, SCREEN_WIDTH
+ add hl, bc
+ ld [hl], $3d
+ ret
+; e0613
+
+Functione0613: ; e0613
+ ld hl, wc6e6
+ add hl, de
+ ld a, [hl]
+ and a
+ jr nz, .asm_e0629
+ hlcoord 13, 10
+rept 2
+ add hl, bc
+endr
+ ld [hl], $3c
+ ld bc, SCREEN_WIDTH
+ add hl, bc
+ ld [hl], $3a
+ ret
+
+.asm_e0629
+ hlcoord 13, 10
+rept 2
+ add hl, bc
+endr
+ ld [hl], $3d
+ ld bc, SCREEN_WIDTH
+ add hl, bc
+ ld [hl], $3a
+ ret
+; e0637
+
+Functione0637: ; e0637
+ call Functione0398
+ add hl, hl
+ ld de, Jumptable_e0643
+ add hl, de
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ jp [hl]
+; e0643
+
+Jumptable_e0643: ; e0643
+ dw Functione06a3
+ dw Functione06a3
+ dw Functione06a6
+ dw Functione06a6
+ dw Functione06b0
+ dw Functione06b0
+ dw Functione06a3
+ dw Functione06a3
+ dw Functione06ec
+ dw Functione06f6
+ dw Functione0702
+ dw Functione070e
+ dw Functione06c2
+ dw Functione0722
+ dw Functione0770
+ dw Functione0774
+ dw Functione0778
+ dw Functione077c
+ dw Functione06c2
+ dw Functione072c
+ dw Functione0780
+ dw Functione0784
+ dw Functione0788
+ dw Functione078c
+ dw Functione06cc
+ dw Functione0738
+ dw Functione0790
+ dw Functione0794
+ dw Functione0798
+ dw Functione079c
+ dw Functione06cc
+ dw Functione0744
+ dw Functione07a0
+ dw Functione07a4
+ dw Functione07a8
+ dw Functione07ac
+ dw Functione06d8
+ dw Functione0750
+ dw Functione07b0
+ dw Functione07b4
+ dw Functione07b8
+ dw Functione07bc
+ dw Functione06d8
+ dw Functione075c
+ dw Functione07c0
+ dw Functione07c4
+ dw Functione07c8
+ dw Functione07cc
+; e06a3
+
+Functione06a3: ; e06a3
+ jp Functione07db
+; e06a6
+
+Functione06a6: ; e06a6
+ ld a, [CurEnemyMoveNum]
+ and $2
+ jp nz, Functione07db
+ jr Functione06ba
+
+Functione06b0: ; e06b0
+ ld a, [CurEnemyMoveNum]
+ and $2
+ jr nz, Functione06ba
+ jp Functione07db
+
+Functione06ba: ; e06ba
+ ld c, $6
+ ld de, SFX_2ND_PLACE
+ jp Functione07eb
+; e06c2
+
+Functione06c2: ; e06c2
+ ld a, [CurEnemyMoveNum]
+ and $18
+ jr z, Functione06e4
+ jp Functione07db
+
+Functione06cc: ; e06cc
+ ld a, [CurEnemyMoveNum]
+ and $18
+ cp $8
+ jr z, Functione06e4
+ jp Functione07db
+
+Functione06d8: ; e06d8
+ ld a, [CurEnemyMoveNum]
+ and $18
+ cp $10
+ jr z, Functione06e4
+ jp Functione07db
+
+Functione06e4: ; e06e4
+ ld c, $9
+ ld de, SFX_2ND_PLACE
+ jp Functione07eb
+; e06ec
+
+Functione06ec: ; e06ec
+ ld a, [CurEnemyMoveNum]
+ and $3
+ jr z, Functione071a
+ jp Functione07db
+
+Functione06f6: ; e06f6
+ ld a, [CurEnemyMoveNum]
+ and $3
+ cp $1
+ jr z, Functione071a
+ jp Functione07db
+
+Functione0702: ; e0702
+ ld a, [CurEnemyMoveNum]
+ and $3
+ cp $2
+ jr z, Functione071a
+ jp Functione07db
+
+Functione070e: ; e070e
+ ld a, [CurEnemyMoveNum]
+ and $3
+ cp $3
+ jr z, Functione071a
+ jp Functione07db
+
+Functione071a: ; e071a
+ ld c, $c
+ ld de, SFX_2ND_PLACE
+ jp Functione07eb
+; e0722
+
+Functione0722: ; e0722
+ ld a, [CurEnemyMoveNum]
+ and $1c
+ jr z, Functione0768
+ jp Functione07db
+
+Functione072c: ; e072c
+ ld a, [CurEnemyMoveNum]
+ and $1c
+ cp $4
+ jr z, Functione0768
+ jp Functione07db
+
+Functione0738: ; e0738
+ ld a, [CurEnemyMoveNum]
+ and $1c
+ cp $8
+ jr z, Functione0768
+ jp Functione07db
+
+Functione0744: ; e0744
+ ld a, [CurEnemyMoveNum]
+ and $1c
+ cp $c
+ jr z, Functione0768
+ jp Functione07db
+
+Functione0750: ; e0750
+ ld a, [CurEnemyMoveNum]
+ and $1c
+ cp $10
+ jr z, Functione0768
+ jp Functione07db
+
+Functione075c: ; e075c
+ ld a, [CurEnemyMoveNum]
+ and $1c
+ cp $14
+ jr z, Functione0768
+ jp Functione07db
+
+Functione0768: ; e0768
+ ld c, $12
+ ld de, SFX_2ND_PLACE
+ jp Functione07eb
+; e0770
+
+
+Functione0770: ; e0770
+ ld e, $0
+ jr Functione07ce
+
+Functione0774: ; e0774
+ ld e, $1
+ jr Functione07ce
+
+Functione0778: ; e0778
+ ld e, $2
+ jr Functione07ce
+
+Functione077c: ; e077c
+ ld e, $3
+ jr Functione07ce
+
+Functione0780: ; e0780
+ ld e, $4
+ jr Functione07ce
+
+Functione0784: ; e0784
+ ld e, $5
+ jr Functione07ce
+
+Functione0788: ; e0788
+ ld e, $6
+ jr Functione07ce
+
+Functione078c: ; e078c
+ ld e, $7
+ jr Functione07ce
+
+Functione0790: ; e0790
+ ld e, $8
+ jr Functione07ce
+
+Functione0794: ; e0794
+ ld e, $9
+ jr Functione07ce
+
+Functione0798: ; e0798
+ ld e, $a
+ jr Functione07ce
+
+Functione079c: ; e079c
+ ld e, $b
+ jr Functione07ce
+
+Functione07a0: ; e07a0
+ ld e, $c
+ jr Functione07ce
+
+Functione07a4: ; e07a4
+ ld e, $d
+ jr Functione07ce
+
+Functione07a8: ; e07a8
+ ld e, $e
+ jr Functione07ce
+
+Functione07ac: ; e07ac
+ ld e, $f
+ jr Functione07ce
+
+Functione07b0: ; e07b0
+ ld e, $10
+ jr Functione07ce
+
+Functione07b4: ; e07b4
+ ld e, $11
+ jr Functione07ce
+
+Functione07b8: ; e07b8
+ ld e, $12
+ jr Functione07ce
+
+Functione07bc: ; e07bc
+ ld e, $13
+ jr Functione07ce
+
+Functione07c0: ; e07c0
+ ld e, $14
+ jr Functione07ce
+
+Functione07c4: ; e07c4
+ ld e, $15
+ jr Functione07ce
+
+Functione07c8: ; e07c8
+ ld e, $16
+ jr Functione07ce
+
+Functione07cc: ; e07cc
+ ld e, $17
+
+Functione07ce: ; e07ce
+ ld a, [CurEnemyMoveNum]
+ cp e
+ jr nz, Functione07db
+ ld c, $48
+ ld de, SFX_2ND_PLACE
+ jr Functione07eb
+
+Functione07db: ; e07db
+ ld de, SFX_WRONG
+ call PlaySFX
+ ld hl, UnknownText_0xe0816
+ call Functione0489
+ call WaitSFX
+ ret
+
+Functione07eb: ; e07eb
+ push bc
+ push de
+ ld hl, UnknownText_0xe0811
+ call Functione0489
+ pop de
+ call PlaySFX
+ call WaitSFX
+ pop bc
+.asm_e07fb
+ push bc
+ call Functione0833
+ jr c, .asm_e0804
+ call Functione081b
+
+.asm_e0804
+ call Functione049c
+ ld c, 2
+ call DelayFrames
+ pop bc
+ dec c
+ jr nz, .asm_e07fb
+ ret
+; e0811
+
+UnknownText_0xe0811: ; 0xe0811
+ ; Yeah!
+ text_jump UnknownText_0x1c5813
+ db "@"
+; 0xe0816
+
+UnknownText_0xe0816: ; 0xe0816
+ ; Darn…
+ text_jump UnknownText_0x1c581a
+ db "@"
+; 0xe081b
+
+Functione081b: ; e081b
+ ld a, [Coins]
+ ld h, a
+ ld a, [Coins + 1]
+ ld l, a
+ inc hl
+ ld a, h
+ ld [Coins], a
+ ld a, l
+ ld [Coins + 1], a
+ ld de, SFX_PAY_DAY
+ call PlaySFX
+ ret
+; e0833
+
+Functione0833: ; e0833
+ ld a, [Coins]
+ cp 9999 / $100
+ jr c, .asm_e0847
+ jr z, .asm_e083e
+ jr .asm_e0845
+
+.asm_e083e
+ ld a, [Coins + 1]
+ cp 9999 % $100
+ jr c, .asm_e0847
+
+.asm_e0845
+ scf
+ ret
+
+.asm_e0847
+ and a
+ ret
+; e0849
+
+Functione0849: ; e0849
+ call Functione03ac
+ ld hl, Unknown_e0853
+ call Functione0509
+ ret
+; e0853
+
+Unknown_e0853: ; e0853
+ db 18
+ db $00, $00, $04, $00
+ db $00, $08, $06, $00
+ db $00, $10, $06, $00
+ db $00, $18, $06, $00
+ db $00, $20, $04, $20
+ db $08, $00, $05, $00
+ db $08, $20, $05, $20
+ db $10, $00, $05, $00
+ db $10, $20, $05, $20
+ db $18, $00, $05, $00
+ db $18, $20, $05, $20
+ db $20, $00, $05, $00
+ db $20, $20, $05, $20
+ db $28, $00, $04, $40
+ db $28, $08, $06, $40
+ db $28, $10, $06, $40
+ db $28, $18, $06, $40
+ db $28, $20, $04, $60
+; e089c
+
+Functione089c: ; e089c
+ ld hl, hJoyLast
+ ld a, [hl]
+ and D_LEFT
+ jp nz, Functione08b8
+ ld a, [hl]
+ and D_RIGHT
+ jp nz, Functione08ef
+ ld a, [hl]
+ and D_UP
+ jp nz, Functione090a
+ ld a, [hl]
+ and D_DOWN
+ jp nz, Functione093d
+ ret
+; e08b8
+
+Functione08b8: ; e08b8
+ ld hl, wcf65
+ ld a, [wcf64]
+ and a
+ jr z, .asm_e08d5
+ cp $1
+ jr z, .asm_e08cc
+ ld a, [hl]
+ and a
+ ret z
+ dec [hl]
+ jp Functione0959
+
+.asm_e08cc
+ ld a, [hl]
+ cp $3
+ jr c, .asm_e08e2
+ dec [hl]
+ jp Functione0959
+
+.asm_e08d5
+ ld a, [hl]
+ and $e
+ ld [hl], a
+ cp $3
+ jr c, .asm_e08e2
+rept 2
+ dec [hl]
+endr
+ jp Functione0959
+
+.asm_e08e2
+ ld a, $2
+ ld [wcf64], a
+ ld a, $1
+ ld [wcf65], a
+ jp Functione0959
+; e08ef
+
+Functione08ef: ; e08ef
+ ld hl, wcf65
+ ld a, [wcf64]
+ and a
+ jr z, .asm_e08ff
+ ld a, [hl]
+ cp $5
+ ret nc
+ inc [hl]
+ jr Functione0959
+
+.asm_e08ff
+ ld a, [hl]
+ and $e
+ ld [hl], a
+ cp $4
+ ret nc
+rept 2
+ inc [hl]
+endr
+ jr Functione0959
+
+Functione090a: ; e090a
+ ld hl, wcf64
+ ld a, [wcf65]
+ and a
+ jr z, .asm_e0925
+ cp $1
+ jr z, .asm_e091d
+ ld a, [hl]
+ and a
+ ret z
+ dec [hl]
+ jr Functione0959
+
+.asm_e091d
+ ld a, [hl]
+ cp $3
+ jr c, .asm_e0931
+ dec [hl]
+ jr Functione0959
+
+.asm_e0925
+ ld a, [hl]
+ and $e
+ ld [hl], a
+ cp $3
+ jr c, .asm_e0931
+rept 2
+ dec [hl]
+endr
+ jr Functione0959
+
+.asm_e0931
+ ld a, $1
+ ld [wcf64], a
+ ld a, $2
+ ld [wcf65], a
+ jr Functione0959
+
+Functione093d: ; e093d
+ ld hl, wcf64
+ ld a, [wcf65]
+ and a
+ jr z, .asm_e0950
+ ld hl, wcf64
+ ld a, [hl]
+ cp $7
+ ret nc
+ inc [hl]
+ jr Functione0959
+
+.asm_e0950
+ ld a, [hl]
+ and $e
+ ld [hl], a
+ cp $6
+ ret nc
+rept 2
+ inc [hl]
+endr
+
+Functione0959: ; e0959
+ ld de, SFX_POKEBALLS_PLACED_ON_TABLE
+ call PlaySFX
+ ret
+; e0960
+
+Functione0960: ; e0960
+ call ClearSprites
+ ld a, [hCGB]
+ and a
+ jr nz, .asm_e096d
+ ld a, [hVBlankCounter]
+ and $4
+ ret nz
+
+.asm_e096d
+ call Functione0398
+rept 2
+ add hl, hl
+endr
+ ld de, Unknown_e0981
+ add hl, de
+ ld a, [hli]
+ ld c, a
+ ld a, [hli]
+ ld b, a
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ call Functione0509
+ ret
+; e0981
+
+Unknown_e0981: ; e0981
+ dbbw $58, $10, Unknown_e0c26
+ dbbw $60, $10, Unknown_e0c26
+ dbbw $68, $10, Unknown_e0b8d
+ dbbw $68, $10, Unknown_e0b8d
+ dbbw $88, $10, Unknown_e0b8d
+ dbbw $88, $10, Unknown_e0b8d
+
+ dbbw $58, $18, Unknown_e0c26
+ dbbw $60, $18, Unknown_e0c26
+ dbbw $68, $18, Unknown_e0a5a
+ dbbw $78, $18, Unknown_e0a5a
+ dbbw $88, $18, Unknown_e0a5a
+ dbbw $98, $18, Unknown_e0a5a
+
+ dbbw $58, $28, Unknown_e0b14
+ dbbw $60, $28, Unknown_e0ac3
+ dbbw $68, $28, Unknown_e0a41
+ dbbw $78, $28, Unknown_e0a41
+ dbbw $88, $28, Unknown_e0a41
+ dbbw $98, $28, Unknown_e0a41
+ dbbw $58, $28, Unknown_e0b14
+
+ dbbw $60, $34, Unknown_e0ac3
+ dbbw $68, $34, Unknown_e0a41
+ dbbw $78, $34, Unknown_e0a41
+ dbbw $88, $34, Unknown_e0a41
+ dbbw $98, $34, Unknown_e0a41
+
+ dbbw $58, $40, Unknown_e0b14
+ dbbw $60, $40, Unknown_e0ac3
+ dbbw $68, $40, Unknown_e0a41
+ dbbw $78, $40, Unknown_e0a41
+ dbbw $88, $40, Unknown_e0a41
+ dbbw $98, $40, Unknown_e0a41
+ dbbw $58, $40, Unknown_e0b14
+
+ dbbw $60, $4c, Unknown_e0ac3
+ dbbw $68, $4c, Unknown_e0a41
+ dbbw $78, $4c, Unknown_e0a41
+ dbbw $88, $4c, Unknown_e0a41
+ dbbw $98, $4c, Unknown_e0a41
+
+ dbbw $58, $58, Unknown_e0b14
+ dbbw $60, $58, Unknown_e0ac3
+ dbbw $68, $58, Unknown_e0a41
+ dbbw $78, $58, Unknown_e0a41
+ dbbw $88, $58, Unknown_e0a41
+ dbbw $98, $58, Unknown_e0a41
+ dbbw $58, $58, Unknown_e0b14
+
+ dbbw $60, $64, Unknown_e0ac3
+ dbbw $68, $64, Unknown_e0a41
+ dbbw $78, $64, Unknown_e0a41
+ dbbw $88, $64, Unknown_e0a41
+ dbbw $98, $64, Unknown_e0a41
+; e0a41
+
+Unknown_e0a41: ; e0a41
+ db 6
+ db $00, $ff, $00, $80
+ db $00, $00, $02, $80
+ db $00, $08, $03, $80
+ db $05, $ff, $00, $c0
+ db $05, $00, $02, $c0
+ db $05, $08, $03, $80
+
+Unknown_e0a5a: ; e0a5a
+ db 26
+ db $00, $ff, $00, $80
+ db $00, $00, $02, $80
+ db $00, $08, $00, $a0
+ db $08, $ff, $01, $80
+ db $08, $08, $01, $a0
+ db $10, $ff, $01, $80
+ db $10, $08, $03, $80
+ db $18, $ff, $01, $80
+ db $18, $08, $03, $80
+ db $20, $ff, $01, $80
+ db $20, $08, $03, $80
+ db $28, $ff, $01, $80
+ db $28, $08, $03, $80
+ db $30, $ff, $01, $80
+ db $30, $08, $03, $80
+ db $38, $ff, $01, $80
+ db $38, $08, $03, $80
+ db $40, $ff, $01, $80
+ db $40, $08, $03, $80
+ db $48, $ff, $01, $80
+ db $48, $08, $03, $80
+ db $50, $ff, $01, $80
+ db $50, $08, $03, $80
+ db $51, $ff, $00, $c0
+ db $51, $00, $02, $c0
+ db $51, $08, $03, $80
+
+Unknown_e0ac3: ; e0ac3
+ db 20
+ db $00, $ff, $00, $80
+ db $00, $00, $02, $80
+ db $00, $08, $02, $80
+ db $00, $10, $03, $80
+ db $00, $18, $02, $80
+ db $00, $20, $03, $80
+ db $00, $28, $02, $80
+ db $00, $30, $03, $80
+ db $00, $38, $02, $80
+ db $00, $40, $03, $80
+ db $05, $ff, $00, $c0
+ db $05, $00, $02, $c0
+ db $05, $08, $02, $c0
+ db $05, $10, $03, $80
+ db $05, $18, $02, $c0
+ db $05, $20, $03, $80
+ db $05, $28, $02, $c0
+ db $05, $30, $03, $80
+ db $05, $38, $02, $c0
+ db $05, $40, $03, $80
+
+Unknown_e0b14: ; e0b14
+ db 30
+ db $00, $00, $00, $80
+ db $00, $08, $02, $80
+ db $00, $10, $02, $80
+ db $00, $18, $03, $80
+ db $00, $20, $02, $80
+ db $00, $28, $03, $80
+ db $00, $30, $02, $80
+ db $00, $38, $03, $80
+ db $00, $40, $02, $80
+ db $00, $48, $03, $80
+ db $08, $00, $01, $80
+ db $08, $18, $03, $80
+ db $08, $28, $03, $80
+ db $08, $38, $03, $80
+ db $08, $48, $03, $80
+ db $10, $00, $01, $80
+ db $10, $18, $03, $80
+ db $10, $28, $03, $80
+ db $10, $38, $03, $80
+ db $10, $48, $03, $80
+ db $11, $00, $00, $c0
+ db $11, $08, $02, $c0
+ db $11, $10, $02, $c0
+ db $11, $18, $03, $80
+ db $11, $20, $03, $80
+ db $11, $28, $03, $80
+ db $11, $30, $03, $80
+ db $11, $38, $03, $80
+ db $11, $40, $03, $80
+ db $11, $48, $03, $80
+
+Unknown_e0b8d: ; e0b8d
+ db 38
+ db $00, $ff, $00, $80
+ db $00, $18, $00, $a0
+ db $08, $ff, $01, $80
+ db $08, $18, $01, $a0
+ db $10, $ff, $01, $80
+ db $10, $18, $01, $a0
+ db $18, $ff, $01, $80
+ db $18, $08, $03, $80
+ db $18, $18, $03, $80
+ db $20, $ff, $01, $80
+ db $20, $08, $03, $80
+ db $20, $18, $03, $80
+ db $28, $ff, $01, $80
+ db $28, $08, $03, $80
+ db $28, $18, $03, $80
+ db $30, $ff, $01, $80
+ db $30, $08, $03, $80
+ db $30, $18, $03, $80
+ db $38, $ff, $01, $80
+ db $38, $08, $03, $80
+ db $38, $18, $03, $80
+ db $40, $ff, $01, $80
+ db $40, $08, $03, $80
+ db $40, $18, $03, $80
+ db $48, $ff, $01, $80
+ db $48, $08, $03, $80
+ db $48, $18, $03, $80
+ db $50, $ff, $01, $80
+ db $50, $08, $03, $80
+ db $50, $18, $03, $80
+ db $58, $ff, $01, $80
+ db $58, $08, $03, $80
+ db $58, $18, $03, $80
+ db $59, $ff, $00, $c0
+ db $59, $00, $02, $c0
+ db $59, $08, $03, $c0
+ db $59, $10, $02, $c0
+ db $59, $18, $03, $e0
+
+Unknown_e0c26: ; e0c26
+ db 4
+ db $00, $00, $00, $80
+ db $00, $08, $00, $a0
+ db $08, $00, $00, $c0
+ db $08, $08, $00, $e0
+; e0c37
+
+Functione0c37: ; e0c37 (38:4c37)
+ ld a, [hCGB]
+ and a
+ ret z
+ hlcoord 0, 0, AttrMap
+ ld bc, SCREEN_HEIGHT * SCREEN_WIDTH
+ xor a
+ call ByteFill
+ hlcoord 12, 1, AttrMap
+ lb bc, 2, 2
+ ld a, $1
+ call Functione04e7
+ hlcoord 14, 1, AttrMap
+ lb bc, 2, 2
+ ld a, $2
+ call Functione04e7
+ hlcoord 16, 1, AttrMap
+ lb bc, 2, 2
+ ld a, $3
+ call Functione04e7
+ hlcoord 18, 1, AttrMap
+ lb bc, 2, 2
+ ld a, $4
+ call Functione04e7
+ hlcoord 9, 0, AttrMap
+ lb bc, 12, 1
+ ld a, $1
+ call Functione04e7
+ ld a, [rSVBK]
+ push af
+ ld a, $5
+ ld [rSVBK], a
+ ld hl, Palette_e0c93
+ ld de, Unkn1Pals
+ ld bc, $48
+ call CopyBytes
+ pop af
+ ld [rSVBK], a
+ ret
+; e0c93 (38:4c93)
+
+Palette_e0c93: ; e0c93
+ RGB 31, 31, 31
+ RGB 17, 07, 31
+ RGB 06, 19, 08
+ RGB 00, 00, 00
+
+ RGB 31, 31, 31
+ RGB 29, 25, 00
+ RGB 06, 19, 08
+ RGB 00, 00, 00
+
+ RGB 31, 31, 31
+ RGB 31, 13, 30
+ RGB 06, 19, 08
+ RGB 00, 00, 00
+
+ RGB 31, 31, 31
+ RGB 08, 17, 30
+ RGB 06, 19, 08
+ RGB 00, 00, 00
+
+ RGB 31, 31, 31
+ RGB 08, 31, 08
+ RGB 06, 19, 08
+ RGB 00, 00, 00
+
+ RGB 31, 31, 31
+ RGB 17, 07, 31
+ RGB 06, 19, 08
+ RGB 00, 00, 00
+
+ RGB 31, 31, 31
+ RGB 17, 07, 31
+ RGB 06, 19, 08
+ RGB 00, 00, 00
+
+ RGB 31, 31, 31
+ RGB 17, 07, 31
+ RGB 06, 19, 08
+ RGB 00, 00, 00
+
+ RGB 31, 31, 31
+ RGB 31, 31, 31
+ RGB 31, 00, 00
+ RGB 31, 00, 00
+; e0cdb
+
+LZ_e0cdb: ; e0cdb
+INCBIN "gfx/unknown/0e0cdb.2bpp.lz"
+
+GFX_e0cf6: ; e0cf6
+INCBIN "gfx/unknown/0e0cf6.2bpp"
+
+GFX_e0d06: ; e0d06
+INCBIN "gfx/unknown/0e0d06.2bpp"
+
+LZ_e0d16: ; e0d16
+INCBIN "gfx/unknown/0e0d16.2bpp.lz"
+
+LZ_e0ea8: ; e0ea8
+INCBIN "gfx/unknown/0e0ea8.2bpp.lz"
+
+Unknown_e110c: ; e110c
+ db $ef, $15, $27, $2a, $2a, $06, $27, $2a, $2a, $06, $27
+ db $ef, $07, $27, $3e, $3f, $42, $43, $46, $47, $4a, $4b
+ db $ef, $17, $26, $40, $41, $44, $45, $48, $49, $4c, $4d
+ db $ef, $25, $04, $00, $01, $00, $01, $00, $01, $00, $01
+ db $ef, $05, $14, $10, $11, $10, $11, $10, $11, $10, $11
+ db $ef, $16, $24, $20, $21, $20, $21, $20, $21, $20, $21
+ db $ef, $25, $04, $00, $02, $00, $02, $00, $02, $00, $02
+ db $ef, $05, $14, $10, $12, $10, $12, $10, $12, $10, $12
+ db $ef, $16, $24, $20, $22, $20, $22, $20, $22, $20, $22
+ db $ef, $25, $04, $00, $03, $00, $03, $00, $03, $00, $03
+ db $ef, $05, $14, $10, $13, $10, $13, $10, $13, $10, $13
+ db $ef, $16, $24, $20, $23, $20, $23, $20, $23, $20, $23
+; e1190
+
+Functione1190: ; e1190
+ ld a, [hInMenu]
+ push af
+ ld a, $1
+ ld [hInMenu], a
+ call ClearBGPalettes
+ call ClearTileMap
+ call ClearSprites
+ xor a
+ ld [hBGMapMode], a
+ call DisableLCD
+ ld hl, wc608
+ ld bc, $1e0
+ xor a
+ call ByteFill
+ ld hl, GFX_e17c5
+ ld de, VTiles1 tile $60
+ ld bc, $40
+ call CopyBytes
+ ld hl, LZ_e1805
+ ld de, VTiles1 tile $6d
+ call Decompress
+ call Functione17a3
+ hlcoord 0, 0
+ ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
+ ld a, $ee
+ call ByteFill
+ hlcoord 4, 3
+ lb bc, 12, 12
+ ld a, $ef
+ call Functione13ee
+ call Functione124e
+ call Functione13fe
+ call Functione127d
+ xor a
+ ld [hSCY], a
+ ld [hSCX], a
+ ld [rWY], a
+ ld [wJumptableIndex], a
+ ld [wcf64], a
+ ld [wcf65], a
+ ld [wcf66], a
+ ld a, $93
+ ld [rLCDC], a
+ call WaitBGMap
+ ld b, $18
+ call GetSGBLayout
+ ld a, $e4
+ call DmgToCgbBGPals
+ ld a, $24
+ call Functioncf8
+ xor a
+ ld [wd0ec], a
+ call DelayFrame
+.asm_e1217
+ call JoyTextDelay
+ ld a, [wJumptableIndex]
+ bit 7, a
+ jr nz, .asm_e123d
+ call Functione12ca
+ ld a, [wcf64]
+ and a
+ jr nz, .asm_e1230
+ ld a, [hVBlankCounter]
+ and $10
+ jr z, .asm_e1235
+
+.asm_e1230
+ call Functione14d9
+ jr .asm_e1238
+
+.asm_e1235
+ call ClearSprites
+
+.asm_e1238
+ call DelayFrame
+ jr .asm_e1217
+
+.asm_e123d
+ pop af
+ ld [hInMenu], a
+ call ClearBGPalettes
+ call ClearTileMap
+ call ClearSprites
+ ld a, $e3
+ ld [rLCDC], a
+ ret
+; e124e
+
+Functione124e: ; e124e
+ ld c, $1
+ ld b, $10
+.asm_e1252
+ call Random
+ and $f
+ ld hl, Unknown_e126d
+ ld e, a
+ ld d, $0
+ add hl, de
+ ld e, [hl]
+ ld hl, wc6d0
+ add hl, de
+ ld a, [hl]
+ and a
+ jr nz, .asm_e1252
+ ld [hl], c
+ inc c
+ dec b
+ jr nz, .asm_e1252
+ ret
+; e126d
+
+Unknown_e126d: ; e126d
+ db $00, $01, $02, $03
+ db $04, $05, $06, $0b
+ db $0c, $11, $12, $17
+ db $18, $1d, $1e, $23
+; e127d
+
+Functione127d: ; e127d
+ call Functione128d
+ hlcoord 5, 16
+ ld a, $f6
+ ld c, $a
+.asm_e1287
+ ld [hli], a
+ inc a
+ dec c
+ jr nz, .asm_e1287
+ ret
+; e128d
+
+Functione128d: ; e128d
+ hlcoord 4, 15
+ ld a, $f0
+ ld [hli], a
+ ld bc, $a
+ ld a, $f1
+ call ByteFill
+ hlcoord 15, 15
+ ld a, $f2
+ ld [hli], a
+ hlcoord 4, 16
+ ld a, $f3
+ ld [hli], a
+ ld bc, $a
+ ld a, $ef
+ call ByteFill
+ hlcoord 15, 16
+ ld a, $f3
+ ld [hli], a
+ hlcoord 4, 17
+ ld a, $f4
+ ld [hli], a
+ ld bc, $a
+ ld a, $f1
+ call ByteFill
+ hlcoord 15, 17
+ ld a, $f5
+ ld [hl], a
+ ret
+; e12ca
+
+Functione12ca: ; e12ca
+ ld a, [wJumptableIndex]
+ ld e, a
+ ld d, 0
+ ld hl, Jumptable_e12d9
+rept 2
+ add hl, de
+endr
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ jp [hl]
+; e12d9
+
+Jumptable_e12d9: ; e12d9
+ dw Functione12db
+; e12db
+
+Functione12db: ; e12db
+ ld a, [hJoyPressed]
+ and START
+ jp nz, Functione13de
+ ld a, [hJoyPressed]
+ and A_BUTTON
+ jp nz, Functione1376
+ ld hl, hJoyLast
+ ld a, [hl]
+ and D_UP
+ jr nz, .asm_e1301
+ ld a, [hl]
+ and D_DOWN
+ jr nz, .asm_e130d
+ ld a, [hl]
+ and D_LEFT
+ jr nz, .asm_e1325
+ ld a, [hl]
+ and D_RIGHT
+ jr nz, .asm_e1345
+ ret
+
+.asm_e1301
+ ld hl, wcf65
+ ld a, [hl]
+ cp $6
+ ret c
+ sub $6
+ ld [hl], a
+ jr .asm_e1364
+
+.asm_e130d
+ ld hl, wcf65
+ ld a, [hl]
+ cp $19
+ ret z
+ cp $1a
+ ret z
+ cp $1b
+ ret z
+ cp $1c
+ ret z
+ cp $1e
+ ret nc
+ add $6
+ ld [hl], a
+ jr .asm_e1364
+
+.asm_e1325
+ ld hl, wcf65
+ ld a, [hl]
+ and a
+ ret z
+ cp $6
+ ret z
+ cp $c
+ ret z
+ cp $12
+ ret z
+ cp $18
+ ret z
+ cp $1e
+ ret z
+ cp $23
+ jr z, .asm_e1341
+ dec [hl]
+ jr .asm_e1364
+
+.asm_e1341
+ ld [hl], $1e
+ jr .asm_e1364
+
+.asm_e1345
+ ld hl, wcf65
+ ld a, [hl]
+ cp $5
+ ret z
+ cp $b
+ ret z
+ cp $11
+ ret z
+ cp $17
+ ret z
+ cp $1d
+ ret z
+ cp $23
+ ret z
+ cp $1e
+ jr z, .asm_e1362
+ inc [hl]
+ jr .asm_e1364
+
+.asm_e1362
+ ld [hl], $23
+
+.asm_e1364
+ ld a, [wcf64]
+ and a
+ jr nz, .asm_e136f
+ ld de, SFX_POUND
+ jr .asm_e1372
+
+.asm_e136f
+ ld de, SFX_MOVE_PUZZLE_PIECE
+
+.asm_e1372
+ call PlaySFX
+ ret
+; e1376
+
+Functione1376: ; e1376
+ ld a, [wcf64]
+ and a
+ jr nz, .asm_e139f
+ call Functione1475
+ and a
+ jr z, Functione13e4
+ ld de, SFX_MEGA_KICK
+ call PlaySFX
+ ld [hl], $0
+ ld [wcf66], a
+ call Functione14d9
+ call Functione1441
+ call WaitBGMap
+ call WaitSFX
+ ld a, $1
+ ld [wcf64], a
+ ret
+
+.asm_e139f
+ call Functione1475
+ and a
+ jr nz, Functione13e4
+ ld de, SFX_PLACE_PUZZLE_PIECE_DOWN
+ call PlaySFX
+ ld a, [wcf66]
+ ld [hl], a
+ call Functione141f
+ call WaitBGMap
+ xor a
+ ld [wcf66], a
+ call Functione14d9
+ xor a
+ ld [wcf64], a
+ call WaitSFX
+ call Functione14a0
+ ret nc
+ call Functione128d
+ call ClearSprites
+ ld de, SFX_1ST_PLACE
+ call PlaySFX
+ call WaitSFX
+ call SimpleWaitPressAorB
+ ld a, $1
+ ld [wd0ec], a
+
+Functione13de: ; e13de
+ ld hl, wJumptableIndex
+ set 7, [hl]
+ ret
+
+Functione13e4: ; e13e4
+ ld de, SFX_WRONG
+ call PlaySFX
+ call WaitSFX
+ ret
+; e13ee
+
+Functione13ee: ; e13ee
+ ld de, SCREEN_WIDTH
+.asm_e13f1
+ push bc
+ push hl
+.asm_e13f3
+ ld [hli], a
+ dec c
+ jr nz, .asm_e13f3
+ pop hl
+ add hl, de
+ pop bc
+ dec b
+ jr nz, .asm_e13f1
+ ret
+; e13fe
+
+Functione13fe: ; e13fe
+ xor a
+ ld [wcf65], a
+ ld c, $24
+.asm_e1404
+ push bc
+ call Functione1475
+ ld [wcf66], a
+ and a
+ jr z, .asm_e1413
+ call Functione141f
+ jr .asm_e1416
+
+.asm_e1413
+ call Functione1441
+
+.asm_e1416
+ ld hl, wcf65
+ inc [hl]
+ pop bc
+ dec c
+ jr nz, .asm_e1404
+ ret
+; e141f
+
+Functione141f: ; e141f
+ ld a, $2
+ call Functione1463
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ push hl
+ call Functione1481
+ pop hl
+ ld de, SCREEN_WIDTH
+ ld b, $3
+.asm_e1431
+ ld c, $3
+ push hl
+.asm_e1434
+ ld [hli], a
+ inc a
+ dec c
+ jr nz, .asm_e1434
+ add $9
+ pop hl
+ add hl, de
+ dec b
+ jr nz, .asm_e1431
+ ret
+; e1441
+
+Functione1441: ; e1441
+ ld a, $2
+ call Functione1463
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ push hl
+ ld a, $4
+ call Functione1463
+ ld a, [hl]
+ pop hl
+ ld de, SCREEN_WIDTH
+ ld b, $3
+.asm_e1456
+ ld c, $3
+ push hl
+.asm_e1459
+ ld [hli], a
+ dec c
+ jr nz, .asm_e1459
+ pop hl
+ add hl, de
+ dec b
+ jr nz, .asm_e1456
+ ret
+; e1463
+
+Functione1463: ; e1463
+ ld e, a
+ ld d, 0
+ ld hl, Unknown_e1559
+ add hl, de
+ ld a, [wcf65]
+ ld e, a
+rept 4
+ add hl, de
+endr
+rept 2
+ add hl, de
+endr
+ ret
+; e1475
+
+Functione1475: ; e1475
+ ld hl, wc6d0
+ ld a, [wcf65]
+ ld e, a
+ ld d, $0
+ add hl, de
+ ld a, [hl]
+ ret
+; e1481
+
+Functione1481: ; e1481
+ ld a, [wcf66]
+ ld hl, Unknown_e148f
+ add l
+ ld l, a
+ ld a, $0
+ adc h
+ ld h, a
+ ld a, [hl]
+ ret
+; e148f
+
+Unknown_e148f: ; e148f
+ db $e0
+ db $00, $03, $06, $09
+ db $24, $27, $2a, $2d
+ db $48, $4b, $4e, $51
+ db $6c, $6f, $72, $75
+; e14a0
+
+Functione14a0: ; e14a0
+ ld hl, Unknown_e14b5
+ ld de, wc6d0
+ ld c, $24
+.asm_e14a8
+ ld a, [de]
+ cp [hl]
+ jr nz, .asm_e14b3
+ inc de
+ inc hl
+ dec c
+ jr nz, .asm_e14a8
+ scf
+ ret
+
+.asm_e14b3
+ and a
+ ret
+; e14b5
+
+Unknown_e14b5: ; e14b5
+ db $00, $00, $00, $00, $00, $00
+ db $00, $01, $02, $03, $04, $00
+ db $00, $05, $06, $07, $08, $00
+ db $00, $09, $0a, $0b, $0c, $00
+ db $00, $0d, $0e, $0f, $10, $00
+ db $00, $00, $00, $00, $00, $00
+; e14d9
+
+Functione14d9: ; e14d9
+ call Functione1481
+ ld [wd002], a
+ xor a
+ call Functione1463
+ ld a, [hli]
+ ld b, [hl]
+ ld c, a
+ ld a, [wd002]
+ cp $e0
+ jr z, .asm_e14f2
+ ld hl, Unknown_e150f
+ jr .asm_e14f5
+
+.asm_e14f2
+ ld hl, Unknown_e1534
+
+.asm_e14f5
+ ld de, Sprites
+.asm_e14f8
+ ld a, [hli]
+ cp $ff
+ ret z
+ add b
+ ld [de], a
+ inc de
+ ld a, [hli]
+ add c
+ ld [de], a
+ inc de
+ ld a, [wd002]
+ add [hl]
+ ld [de], a
+ inc hl
+ inc de
+ ld a, [hli]
+ ld [de], a
+ inc de
+ jr .asm_e14f8
+; e150f
+
+Unknown_e150f: ; e150f
+ db $f4, $f4, $00, $00
+ db $f4, $fc, $01, $00
+ db $f4, $04, $02, $00
+ db $fc, $f4, $0c, $00
+ db $fc, $fc, $0d, $00
+ db $fc, $04, $0e, $00
+ db $04, $f4, $18, $00
+ db $04, $fc, $19, $00
+ db $04, $04, $1a, $00
+ db $ff
+
+Unknown_e1534: ; e1534
+ db $f4, $f4, $00, $00
+ db $f4, $fc, $01, $00
+ db $f4, $04, $00, $20
+ db $fc, $f4, $02, $00
+ db $fc, $fc, $03, $00
+ db $fc, $04, $02, $20
+ db $04, $f4, $00, $40
+ db $04, $fc, $01, $40
+ db $04, $04, $00, $60
+ db $ff
+
+Unknown_e1559: ; e1559
+
+macro_e1559: macro
+ db \1, \2
+ dwcoord \3, \4
+ db \5, \6
+endm
+
+ macro_e1559 $1c, $1c, 1, 0, $ee, $00
+ macro_e1559 $34, $1c, 4, 0, $ee, $00
+ macro_e1559 $4c, $1c, 7, 0, $ee, $00
+ macro_e1559 $64, $1c, 10, 0, $ee, $00
+ macro_e1559 $7c, $1c, 13, 0, $ee, $00
+ macro_e1559 $94, $1c, 16, 0, $ee, $00
+ macro_e1559 $1c, $34, 1, 3, $ee, $00
+ macro_e1559 $34, $34, 4, 3, $ef, $00
+ macro_e1559 $4c, $34, 7, 3, $ef, $00
+ macro_e1559 $64, $34, 10, 3, $ef, $00
+ macro_e1559 $7c, $34, 13, 3, $ef, $00
+ macro_e1559 $94, $34, 16, 3, $ee, $00
+ macro_e1559 $1c, $4c, 1, 6, $ee, $00
+ macro_e1559 $34, $4c, 4, 6, $ef, $00
+ macro_e1559 $4c, $4c, 7, 6, $ef, $00
+ macro_e1559 $64, $4c, 10, 6, $ef, $00
+ macro_e1559 $7c, $4c, 13, 6, $ef, $00
+ macro_e1559 $94, $4c, 16, 6, $ee, $00
+ macro_e1559 $1c, $64, 1, 9, $ee, $00
+ macro_e1559 $34, $64, 4, 9, $ef, $00
+ macro_e1559 $4c, $64, 7, 9, $ef, $00
+ macro_e1559 $64, $64, 10, 9, $ef, $00
+ macro_e1559 $7c, $64, 13, 9, $ef, $00
+ macro_e1559 $94, $64, 16, 9, $ee, $00
+ macro_e1559 $1c, $7c, 1, 12, $ee, $00
+ macro_e1559 $34, $7c, 4, 12, $ef, $00
+ macro_e1559 $4c, $7c, 7, 12, $ef, $00
+ macro_e1559 $64, $7c, 10, 12, $ef, $00
+ macro_e1559 $7c, $7c, 13, 12, $ef, $00
+ macro_e1559 $94, $7c, 16, 12, $ee, $00
+ macro_e1559 $1c, $94, 1, 15, $ee, $00
+ macro_e1559 $34, $94, 4, 15, $ee, $00
+ macro_e1559 $4c, $94, 7, 15, $ee, $00
+ macro_e1559 $64, $94, 10, 15, $ee, $00
+ macro_e1559 $7c, $94, 13, 15, $ee, $00
+ macro_e1559 $94, $94, 16, 15, $ee, $00
+
+Functione1631: ; e1631
+ ld hl, VTiles2
+ ld de, VTiles0
+ ld b, $6
+.asm_e1639
+ push bc
+ push hl
+ push hl
+ call Functione1654
+ pop hl
+ ld bc, 8
+ add hl, bc
+ call Functione1654
+ pop hl
+ ld bc, $60
+ add hl, bc
+ pop bc
+ dec b
+ jr nz, .asm_e1639
+ call Functione16c7
+ ret
+; e1654
+
+Functione1654: ; e1654
+ ld c, $6
+.asm_e1656
+ push bc
+ push hl
+ push hl
+ ld c, $4
+.asm_e165b
+ push bc
+ ld a, [hli]
+ and $f0
+ swap a
+ call Functione16aa
+ ld c, a
+ ld a, [hli]
+ and $f0
+ swap a
+ call Functione16aa
+ ld b, a
+ ld a, c
+ ld [de], a
+ inc de
+ ld a, b
+ ld [de], a
+ inc de
+ ld a, c
+ ld [de], a
+ inc de
+ ld a, b
+ ld [de], a
+ inc de
+ pop bc
+ dec c
+ jr nz, .asm_e165b
+ pop hl
+ ld c, $4
+.asm_e1681
+ push bc
+ ld a, [hli]
+ and $f
+ call Functione16aa
+ ld c, a
+ ld a, [hli]
+ and $f
+ call Functione16aa
+ ld b, a
+ ld a, c
+ ld [de], a
+ inc de
+ ld a, b
+ ld [de], a
+ inc de
+ ld a, c
+ ld [de], a
+ inc de
+ ld a, b
+ ld [de], a
+ inc de
+ pop bc
+ dec c
+ jr nz, .asm_e1681
+ pop hl
+ ld bc, $10
+ add hl, bc
+ pop bc
+ dec c
+ jr nz, .asm_e1656
+ ret
+; e16aa
+
+Functione16aa: ; e16aa
+ push hl
+ ld hl, Unknown_e16b7
+ add l
+ ld l, a
+ ld a, 0
+ adc h
+ ld h, a
+ ld a, [hl]
+ pop hl
+ ret
+; e16b7
+
+Unknown_e16b7: ; e16b7
+ db $00, $03, $0c, $0f
+ db $30, $33, $3c, $3f
+ db $c0, $c3, $cc, $cf
+ db $f0, $f3, $fc, $ff
+; e16c7
+
+Functione16c7: ; e16c7
+ ld hl, Unknown_e1703
+ ld a, $8
+.asm_e16cc
+ push af
+ push hl
+ ld a, [hli]
+ ld e, a
+ ld a, [hli]
+ ld d, a
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ call Functione16e2
+ pop hl
+rept 4
+ inc hl
+endr
+ pop af
+ dec a
+ jr nz, .asm_e16cc
+ ret
+; e16e2
+
+Functione16e2: ; e16e2
+ lb bc, 4, 4
+.asm_e16e5
+ push bc
+.asm_e16e6
+ push de
+ push hl
+ ld b, $10
+.asm_e16ea
+ ld a, [de]
+ or [hl]
+ ld [hli], a
+ inc de
+ dec b
+ jr nz, .asm_e16ea
+ pop hl
+ ld de, $30
+ add hl, de
+ pop de
+ dec c
+ jr nz, .asm_e16e6
+ ld bc, $180
+ add hl, bc
+ pop bc
+ dec b
+ jr nz, .asm_e16e5
+ ret
+; e1703
+
+Unknown_e1703: ; e1703
+ dw GFX_e1723 + $00, $8000
+ dw GFX_e1723 + $10, $8010
+ dw GFX_e1723 + $20, $8020
+ dw GFX_e1723 + $30, $80c0
+ dw GFX_e1723 + $40, $80e0
+ dw GFX_e1723 + $50, $8180
+ dw GFX_e1723 + $60, $8190
+ dw GFX_e1723 + $70, $81a0
+; e1723
+
+GFX_e1723: ; e1723
+INCBIN "gfx/unknown/0e1723.2bpp"
+
+Functione17a3: ; e17a3
+ ld a, [ScriptVar]
+ and 3
+ ld e, a
+ ld d, 0
+ ld hl, Unknown_e17bd
+rept 2
+ add hl, de
+endr
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ ld de, VTiles2
+ call Decompress
+ call Functione1631
+ ret
+; e17bd
+
+Unknown_e17bd: ; e17bd
+ dw LZ_e1bab
+ dw LZ_e1c9b
+ dw LZ_e19fb
+ dw LZ_e18ab
+; e17c5
+
+GFX_e17c5: ; e17c5
+INCBIN "gfx/unknown/0e17c5.2bpp"
+
+LZ_e1805: ; e1805
+INCBIN "gfx/unknown/0e1805.2bpp.lz"
+
+LZ_e18ab: ; e18ab
+INCBIN "gfx/unknown/0e18ab.2bpp.lz"
+
+LZ_e19fb: ; e19fb
+INCBIN "gfx/unknown/0e19fb.2bpp.lz"
+
+LZ_e1bab: ; e1bab
+INCBIN "gfx/unknown/0e1bab.2bpp.lz"
+
+LZ_e1c9b: ; e1c9b
+INCBIN "gfx/unknown/0e1c9b.2bpp.lz"
--- a/engine/credits.asm
+++ b/engine/credits.asm
@@ -131,7 +131,7 @@
ld a, $5
ld [rSVBK], a
- call WhiteBGMap
+ call ClearBGPalettes
call ClearTileMap
call ClearSprites
@@ -210,7 +210,7 @@
jr .asm_1098de
.asm_1098ee
- call WhiteBGMap
+ call ClearBGPalettes
xor a
ld [hLCDStatCustom], a
ld [hBGMapAddress], a
--- a/engine/diploma.asm
+++ b/engine/diploma.asm
@@ -6,7 +6,7 @@
; 1dd709
Function1dd709: ; 1dd709
- call WhiteBGMap
+ call ClearBGPalettes
call ClearTileMap
call ClearSprites
call DisableLCD
--- /dev/null
+++ b/engine/dummy_game.asm
@@ -1,0 +1,615 @@
+_DummyGame: ; e1e5b (38:5e5b)
+ call Functione1e67
+ call DelayFrame
+.asm_e1e61
+ call Functione1ebb
+ jr nc, .asm_e1e61
+ ret
+
+Functione1e67: ; e1e67 (38:5e67)
+ call DisableLCD
+ ld b, $8
+ call GetSGBLayout
+ callab Function8cf53
+ ld hl, LZ_e2221
+ ld de, VTiles2 tile $00
+ call Decompress
+ ld hl, Unknown_e00ed
+ ld de, VTiles0 tile $00
+ ld bc, $40
+ ld a, BANK(Unknown_e00ed)
+ call FarCopyBytes
+ ld a, $8
+ ld hl, wc300
+ ld [hli], a
+ ld [hl], $0
+ hlcoord 0, 0
+ ld bc, SCREEN_HEIGHT * SCREEN_WIDTH
+ xor a
+ call ByteFill
+ xor a
+ ld [hSCY], a
+ ld [hSCX], a
+ ld [rWY], a
+ ld [wJumptableIndex], a
+ ld a, $1
+ ld [hBGMapMode], a
+ ld a, $e3
+ ld [rLCDC], a
+ ld a, $e4
+ call DmgToCgbBGPals
+ ld a, $e0
+ call Functioncf8
+ ret
+
+Functione1ebb: ; e1ebb (38:5ebb)
+ ld a, [wJumptableIndex]
+ bit 7, a
+ jr nz, .asm_e1ed0
+ call Functione1ed2
+ callab Function8cf69
+ call DelayFrame
+ and a
+ ret
+.asm_e1ed0
+ scf
+ ret
+
+Functione1ed2: ; e1ed2 (38:5ed2)
+ ld a, [wJumptableIndex]
+ ld e, a
+ ld d, 0
+ ld hl, Jumptable_e1ee1
+rept 2
+ add hl, de
+endr
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ jp [hl]
+; e1ee1 (38:5ee1)
+
+Jumptable_e1ee1: ; e1ee1
+ dw Functione1ef3
+ dw Functione1efb
+ dw Functione1f1c
+ dw Functione1f42
+ dw Functione1f61
+ dw Functione1f8b
+ dw Functione1fba
+ dw Functione1fcc
+ dw Functione2000
+; e1ef3
+
+Functione1ef3: ; e1ef3
+ call Functione2152
+ ld hl, wJumptableIndex
+ inc [hl]
+ ret
+; e1efb
+
+Functione1efb: ; e1efb
+ call Functione00ed
+ jr nc, .asm_e1f06
+ ld hl, wJumptableIndex
+ set 7, [hl]
+ ret
+
+.asm_e1f06
+ call Functione209d
+ ld hl, wJumptableIndex
+ inc [hl]
+ xor a
+ ld [wc708], a
+ ld hl, wc703
+rept 4
+ ld [hli], a
+endr
+ ld [hl], a
+ ld [wc709], a
+
+Functione1f1c: ; e1f1c
+ ld hl, wc708
+ ld a, [hl]
+ cp $2d
+ jr nc, .asm_e1f30
+ inc [hl]
+ call Functione2183
+ xor a
+ ld [wc6fd], a
+ call Functione2128
+ ret
+
+.asm_e1f30
+ ld de, $341c
+ ld a, $c
+ call Function3b2a
+ ld a, $5
+ ld [wc702], a
+ ld hl, wJumptableIndex
+ inc [hl]
+ ret
+; e1f42
+
+Functione1f42: ; e1f42
+ ld a, [wc702]
+ hlcoord 17, 0
+ add $f6
+ ld [hl], a
+ ld hl, wc702
+ ld a, [hl]
+ and a
+ jr nz, .asm_e1f58
+ ld a, $7
+ ld [wJumptableIndex], a
+ ret
+
+.asm_e1f58
+ dec [hl]
+ xor a
+ ld [wcf64], a
+ ld hl, wJumptableIndex
+ inc [hl]
+
+Functione1f61: ; e1f61
+ ld a, [wcf64]
+ and a
+ ret z
+ dec a
+ ld e, a
+ ld d, $0
+ ld hl, wc6d0
+ add hl, de
+ ld a, [hl]
+ cp $ff
+ ret z
+ ld [wc6fd], a
+ ld [wPlayerMinimized], a
+ ld a, e
+ ld [EnemyScreens], a
+ call Functione2183
+ call Functione2128
+ xor a
+ ld [wcf64], a
+ ld hl, wJumptableIndex
+ inc [hl]
+ ret
+; e1f8b
+
+Functione1f8b: ; e1f8b
+ ld a, [wcf64]
+ and a
+ ret z
+ dec a
+ ld hl, EnemyScreens
+ cp [hl]
+ ret z
+ ld e, a
+ ld d, $0
+ ld hl, wc6d0
+ add hl, de
+ ld a, [hl]
+ cp $ff
+ ret z
+ ld [wc6fd], a
+ ld [PlayerScreens], a
+ ld a, e
+ ld [wc701], a
+ call Functione2183
+ call Functione2128
+ ld a, $40
+ ld [wc708], a
+ ld hl, wJumptableIndex
+ inc [hl]
+
+Functione1fba: ; e1fba
+ ld hl, wc708
+ ld a, [hl]
+ and a
+ jr z, .asm_e1fc3
+ dec [hl]
+ ret
+
+.asm_e1fc3
+ call Functione2010
+ ld a, $3
+ ld [wJumptableIndex], a
+ ret
+; e1fcc
+
+Functione1fcc: ; e1fcc
+ ld a, [hJoypadPressed]
+ and A_BUTTON
+ ret z
+ xor a
+ ld [wc708], a
+.asm_e1fd5
+ ld hl, wc708
+ ld a, [hl]
+ cp $2d
+ jr nc, .asm_e1ff9
+ inc [hl]
+ push af
+ call Functione2183
+ pop af
+ push hl
+ ld e, a
+ ld d, $0
+ ld hl, wc6d0
+ add hl, de
+ ld a, [hl]
+ pop hl
+ cp $ff
+ jr z, .asm_e1fd5
+ ld [wc6fd], a
+ call Functione2128
+ jr .asm_e1fd5
+
+.asm_e1ff9
+ call WaitPressAorB_BlinkCursor
+ ld hl, wJumptableIndex
+ inc [hl]
+
+Functione2000: ; e2000
+ call Functione00ed
+ jr nc, .asm_e200b
+ ld hl, wJumptableIndex
+ set 7, [hl]
+ ret
+
+.asm_e200b
+ xor a
+ ld [wJumptableIndex], a
+ ret
+; e2010
+
+Functione2010: ; e2010
+ ld hl, wPlayerMinimized
+ ld a, [hli]
+ cp [hl]
+ jr nz, .asm_e2066
+ ld a, [EnemyScreens]
+ call Functione2183
+ call Functione2142
+ ld a, [wc701]
+ call Functione2183
+ call Functione2142
+ ld a, [EnemyScreens]
+ ld e, a
+ ld d, $0
+ ld hl, wc6d0
+ add hl, de
+ ld [hl], $ff
+ ld a, [wc701]
+ ld e, a
+ ld d, $0
+ ld hl, wc6d0
+ add hl, de
+ ld [hl], $ff
+ ld hl, wc703
+.asm_e2044
+ ld a, [hli]
+ and a
+ jr nz, .asm_e2044
+ dec hl
+ ld a, [wPlayerMinimized]
+ ld [hl], a
+ ld [wc6fd], a
+ ld hl, wc709
+ ld e, [hl]
+rept 2
+ inc [hl]
+endr
+ ld d, $0
+ hlcoord 5, 0
+ add hl, de
+ call Functione2128
+ ld hl, UnknownText_0xe2083
+ call PrintText
+ ret
+
+.asm_e2066
+ xor a
+ ld [wc6fd], a
+ ld a, [EnemyScreens]
+ call Functione2183
+ call Functione2128
+ ld a, [wc701]
+ call Functione2183
+ call Functione2128
+ ld hl, UnknownText_0xe2098
+ call PrintText
+ ret
+; e2083
+
+UnknownText_0xe2083: ; 0xe2083
+ start_asm
+; 0xe2084
+
+Functione2084: ; e2084
+ push bc
+ hlcoord 2, 13
+ call Functione2128
+ ld hl, UnknownText_0xe2093
+ pop bc
+rept 3
+ inc bc
+endr
+ ret
+; e2093
+
+UnknownText_0xe2093: ; 0xe2093
+ ; , yeah!
+ text_jump UnknownText_0x1c1a5b
+ db "@"
+; 0xe2098
+
+UnknownText_0xe2098: ; 0xe2098
+ ; Darn…
+ text_jump UnknownText_0x1c1a65
+ db "@"
+; 0xe209d
+
+Functione209d: ; e209d
+ ld hl, wc6d0
+ ld bc, $2d
+ xor a
+ call ByteFill
+ call Functione2101
+ ld c, $2
+ ld b, [hl]
+ call Functione20e5
+ ld c, $8
+ ld b, [hl]
+ call Functione20e5
+ ld c, $4
+ ld b, [hl]
+ call Functione20e5
+ ld c, $7
+ ld b, [hl]
+ call Functione20e5
+ ld c, $3
+ ld b, [hl]
+ call Functione20e5
+ ld c, $6
+ ld b, [hl]
+ call Functione20e5
+ ld c, $1
+ ld b, [hl]
+ call Functione20e5
+ ld c, $5
+ ld hl, wc6d0
+ ld b, $2d
+.asm_e20db
+ ld a, [hl]
+ and a
+ jr nz, .asm_e20e0
+ ld [hl], c
+
+.asm_e20e0
+ inc hl
+ dec b
+ jr nz, .asm_e20db
+ ret
+; e20e5
+
+Functione20e5: ; e20e5
+ push hl
+ ld de, wc6d0
+.asm_e20e9
+ call Random
+ and $3f
+ cp $2d
+ jr nc, .asm_e20e9
+ ld l, a
+ ld h, $0
+ add hl, de
+ ld a, [hl]
+ and a
+ jr nz, .asm_e20e9
+ ld [hl], c
+ dec b
+ jr nz, .asm_e20e9
+ pop hl
+ inc hl
+ ret
+; e2101
+
+Functione2101: ; e2101
+ ld a, [MenuSelection2]
+ dec a
+ ld l, a
+ ld h, 0
+rept 3
+ add hl, hl
+endr
+ ld de, Unknown_e2110
+ add hl, de
+ ret
+; e2110
+
+Unknown_e2110: ; e2110
+ db $02, $03, $06, $06, $06, $08, $08, $06
+ db $02, $02, $04, $06, $06, $08, $08, $09
+ db $02, $02, $02, $04, $07, $08, $08, $0c
+; e2128
+
+Functione2128: ; e2128
+ ld a, [wc6fd]
+ sla a
+ sla a
+ add $4
+ ld [hli], a
+ inc a
+ ld [hld], a
+ inc a
+ ld bc, SCREEN_WIDTH
+ add hl, bc
+ ld [hli], a
+ inc a
+ ld [hl], a
+ ld c, 3
+ call DelayFrames
+ ret
+; e2142
+
+Functione2142: ; e2142
+ ld a, $1
+ ld [hli], a
+ ld [hld], a
+ ld bc, SCREEN_WIDTH
+ add hl, bc
+ ld [hli], a
+ ld [hl], a
+ ld c, 3
+ call DelayFrames
+ ret
+; e2152
+
+Functione2152: ; e2152
+ hlcoord 0, 0
+ ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
+ ld a, $1
+ call ByteFill
+ hlcoord 0, 0
+ ld de, String_e2177
+ call PlaceString
+ hlcoord 15, 0
+ ld de, String_e217d
+ call PlaceString
+ ld hl, UnknownText_0xe2176
+ call PrintText
+ ret
+; e2176
+
+UnknownText_0xe2176: ; 0xe2176
+ db "@"
+; 0xe2177
+
+String_e2177: db "とったもの@"
+String_e217d: db "あと かい@"
+; e2183
+
+Functione2183: ; e2183
+ ld d, $0
+.asm_e2185
+ sub $9
+ jr c, .asm_e218c
+ inc d
+ jr .asm_e2185
+
+.asm_e218c
+ add $9
+ ld e, a
+ hlcoord 1, 2
+ ld bc, $28
+.asm_e2195
+ ld a, d
+ and a
+ jr z, .asm_e219d
+ add hl, bc
+ dec d
+ jr .asm_e2195
+
+.asm_e219d
+ sla e
+ add hl, de
+ ret
+; e21a1
+
+Functione21a1: ; e21a1 (38:61a1)
+ ld a, [wJumptableIndex]
+ cp $7
+ jr nc, .quit
+ call JoyTextDelay
+ ld hl, hJoypadPressed ; $ffa3
+ ld a, [hl]
+ and A_BUTTON
+ jr nz, .pressed_a
+ ld a, [hl]
+ and D_LEFT
+ jr nz, .pressed_left
+ ld a, [hl]
+ and D_RIGHT
+ jr nz, .pressed_right
+ ld a, [hl]
+ and D_UP
+ jr nz, .pressed_up
+ ld a, [hl]
+ and D_DOWN
+ jr nz, .pressed_down
+ ret
+
+.quit
+ ld hl, 0
+ add hl, bc
+ ld [hl], $0
+ ret
+
+.pressed_a
+ ld hl, $c
+ add hl, bc
+ ld a, [hl]
+ inc a
+ ld [wcf64], a
+ ret
+
+.pressed_left
+ ld hl, $6
+ add hl, bc
+ ld a, [hl]
+ and a
+ ret z
+ sub $10
+ ld [hl], a
+ ld hl, $c
+ add hl, bc
+ dec [hl]
+ ret
+
+.pressed_right
+ ld hl, $6
+ add hl, bc
+ ld a, [hl]
+ cp $80
+ ret z
+ add $10
+ ld [hl], a
+ ld hl, $c
+ add hl, bc
+ inc [hl]
+ ret
+
+.pressed_up
+ ld hl, $7
+ add hl, bc
+ ld a, [hl]
+ and a
+ ret z
+ sub $10
+ ld [hl], a
+ ld hl, $c
+ add hl, bc
+ ld a, [hl]
+ sub $9
+ ld [hl], a
+ ret
+
+.pressed_down
+ ld hl, $7
+ add hl, bc
+ ld a, [hl]
+ cp $40
+ ret z
+ add $10
+ ld [hl], a
+ ld hl, $c
+ add hl, bc
+ ld a, [hl]
+ add $9
+ ld [hl], a
+ ret
+; e2221 (38:6221)
+
+LZ_e2221: ; e2221
+INCBIN "gfx/unknown/0e2221.2bpp.lz"
--- a/engine/events.asm
+++ b/engine/events.asm
@@ -138,7 +138,7 @@
call ClearAllScriptFlags3
ld a, [hMapEntryMethod]
- cp MAPSETUP_07
+ cp MAPSETUP_CONNECTION
jr nz, .dontset
call SetAll_ScriptFlags3
.dontset
@@ -322,9 +322,9 @@
ld [ScriptRunning], a
call DoPlayerEvent
ld a, [ScriptRunning]
- cp PLAYEREVENT_4
+ cp PLAYEREVENT_CONNECTION
jr z, .ok2
- cp PLAYEREVENT_9
+ cp PLAYEREVENT_JOYCHANGEFACING
jr z, .ok2
xor a
@@ -1050,8 +1050,10 @@
ld a, [ScriptRunning]
and a
ret z
+
cp PLAYEREVENT_MAPSCRIPT ; run script
ret z
+
cp NUM_PLAYER_EVENTS
ret nc
@@ -1071,17 +1073,17 @@
; 96c0c
PlayerEventScriptPointers: ; 96c0c
- dba Invalid_0x96c2d ; 0
- dba SeenByTrainerScript ; 1
- dba TalkToTrainerScript ; 2
- dba FindItemInBallScript ; 3
- dba UnknownScript_0x96c4d ; 4
- dba WarpToNewMapScript ; 5
- dba FallIntoMapScript ; 6
- dba Script_OverworldWhiteout ; 7
- dba HatchEggScript ; 8
- dba UnknownScript_0x96c4f ; 9
- dba Invalid_0x96c2d ; 10
+ dba Invalid_0x96c2d ; 0
+ dba SeenByTrainerScript ; 1
+ dba TalkToTrainerScript ; 2
+ dba FindItemInBallScript ; 3
+ dba UnknownScript_0x96c4d ; 4
+ dba WarpToNewMapScript ; 5
+ dba FallIntoMapScript ; 6
+ dba Script_OverworldWhiteout ; 7
+ dba HatchEggScript ; 8
+ dba UnknownScript_0x96c4f ; 9
+ dba Invalid_0x96c2d ; 10
; 96c2d
Invalid_0x96c2d: ; 96c2d
@@ -1088,7 +1090,7 @@
end
; 96c2e
-UnknownScript_0x96c2e: ; 96c2e
+; unreferenced
end
; 96c2f
@@ -1099,12 +1101,12 @@
WarpToNewMapScript: ; 96c34
warpsound
- newloadmap MAPSETUP_05
+ newloadmap MAPSETUP_DOOR
end
; 96c38
FallIntoMapScript: ; 96c38
- newloadmap MAPSETUP_06
+ newloadmap MAPSETUP_FALL
playsound SFX_KINESIS
applymovement PLAYER, MovementData_0x96c48
playsound SFX_STRENGTH
@@ -1123,7 +1125,7 @@
; 96c4d
UnknownScript_0x96c4d: ; 4
- reloadandreturn MAPSETUP_07
+ reloadandreturn MAPSETUP_CONNECTION
; 96c4f
UnknownScript_0x96c4f: ; 9
--- /dev/null
+++ b/engine/events_3.asm
@@ -1,0 +1,863 @@
+ReturnFromMapSetupScript:: ; b8000
+ xor a
+ ld [hBGMapMode], a
+ ; For some reson, GameFreak chose to use a callba here instead of just falling through.
+ ; No other function in the game references the function at 2E:400A, here labeled
+ ; ReturnFromMapSetupScript.inefficientcallba.
+ callba .inefficientcallba ; this is a waste of 6 ROM bytes and 2 stack bytes
+ ret
+; b800a
+
+.inefficientcallba: ; b800a
+ ld a, [MapGroup]
+ ld b, a
+ ld a, [MapNumber]
+ ld c, a
+ call GetWorldMapLocation
+ ld [wCurrentLandmark], a
+ call .CheckNationalParkGate
+ jr z, .nationalparkgate
+
+ call GetMapPermission
+ cp GATE
+ jr nz, .not_gate
+
+.nationalparkgate
+ ld a, -1
+ ld [wCurrentLandmark], a
+
+.not_gate
+ ld hl, wEnteredMapFromContinue
+ bit 1, [hl]
+ res 1, [hl]
+ jr nz, .dont_do_map_sign
+
+ call .CheckMovingWithinLandmark
+ jr z, .dont_do_map_sign
+ ld a, [wCurrentLandmark]
+ ld [wPreviousLandmark], a
+
+ call .CheckSpecialMap
+ jr z, .dont_do_map_sign
+
+; Display for 60 frames
+ ld a, 60
+ ld [wLandmarkSignTimer], a
+ call LoadMapNameSignGFX
+ call InitMapNameFrame
+ callba Function104303
+ ret
+
+.dont_do_map_sign
+ ld a, [wCurrentLandmark]
+ ld [wPreviousLandmark], a
+ ld a, $90
+ ld [rWY], a
+ ld [hWY], a
+ xor a
+ ld [hLCDStatCustom], a
+ ret
+; b8064
+
+.CheckMovingWithinLandmark: ; b8064
+ ld a, [wCurrentLandmark]
+ ld c, a
+ ld a, [wPreviousLandmark]
+ cp c
+ ret z
+ cp $0
+ ret
+; b8070
+
+.CheckSpecialMap: ; b8070
+ cp -1
+ ret z
+ cp SPECIAL_MAP
+ ret z
+ cp RADIO_TOWER
+ ret z
+ cp LAV_RADIO_TOWER
+ ret z
+ cp UNDERGROUND
+ ret z
+ cp INDIGO_PLATEAU
+ ret z
+ cp POWER_PLANT
+ ret z
+ ld a, $1
+ and a
+ ret
+; b8089
+
+.CheckNationalParkGate: ; b8089
+ ld a, [MapGroup]
+ cp GROUP_ROUTE_35_NATIONAL_PARK_GATE
+ ret nz
+ ld a, [MapNumber]
+ cp MAP_ROUTE_35_NATIONAL_PARK_GATE
+ ret z
+ cp MAP_ROUTE_36_NATIONAL_PARK_GATE
+ ret
+; b8098
+
+
+PlaceMapNameSign:: ; b8098 (2e:4098)
+ ld hl, wLandmarkSignTimer
+ ld a, [hl]
+ and a
+ jr z, .disappear
+ dec [hl]
+ cp 60
+ ret z
+ cp 59
+ jr nz, .skip2
+ call InitMapNameFrame
+ call PlaceMapNameCenterAlign
+ callba Function104303
+.skip2
+ ld a, $80
+ ld a, $70
+ ld [rWY], a
+ ld [hWY], a
+ ret
+
+.disappear
+ ld a, $90
+ ld [rWY], a
+ ld [hWY], a
+ xor a
+ ld [hLCDStatCustom], a
+ ret
+
+
+LoadMapNameSignGFX: ; b80c6
+ ld de, MapEntryFrameGFX
+ ld hl, VTiles2 tile $60
+ lb bc, BANK(MapEntryFrameGFX), $e
+ call Get2bpp
+ ret
+; b80d3
+
+InitMapNameFrame: ; b80d3
+ hlcoord 0, 0
+ ld b, 2
+ ld c, 18
+ call InitMapSignAttrMap
+ call PlaceMapNameFrame
+ ret
+; b80e1
+
+
+PlaceMapNameCenterAlign: ; b80e1 (2e:40e1)
+ ld a, [wCurrentLandmark]
+ ld e, a
+ callba GetLandmarkName
+ call .GetNameLength
+ ld a, SCREEN_WIDTH
+ sub c
+ srl a
+ ld b, $0
+ ld c, a
+ hlcoord 0, 2
+ add hl, bc
+ ld de, StringBuffer1
+ call PlaceString
+ ret
+
+.GetNameLength: ; b8101 (2e:4101)
+ ld c, 0
+ push hl
+ ld hl, StringBuffer1
+.loop
+ ld a, [hli]
+ cp "@"
+ jr z, .stop
+ cp "%"
+ jr z, .loop
+ inc c
+ jr .loop
+.stop
+ pop hl
+ ret
+
+
+InitMapSignAttrMap: ; b8115
+ ld de, AttrMap - TileMap
+ add hl, de
+rept 2
+ inc b
+endr
+rept 2
+ inc c
+endr
+ ld a, $87
+.loop
+ push bc
+ push hl
+.inner_loop
+ ld [hli], a
+ dec c
+ jr nz, .inner_loop
+ pop hl
+ ld de, SCREEN_WIDTH
+ add hl, de
+ pop bc
+ dec b
+ jr nz, .loop
+ ret
+; b812f
+
+PlaceMapNameFrame: ; b812f
+ hlcoord 0, 0
+ ; top left
+ ld a, $61
+ ld [hli], a
+ ; top row
+ ld a, $62
+ call .FillTopBottom
+ ; top right
+ ld a, $64
+ ld [hli], a
+ ; left, first line
+ ld a, $65
+ ld [hli], a
+ ; first line
+ call .FillMiddle
+ ; right, first line
+ ld a, $6b
+ ld [hli], a
+ ; left, second line
+ ld a, $66
+ ld [hli], a
+ ; second line
+ call .FillMiddle
+ ; right, second line
+ ld a, $6c
+ ld [hli], a
+ ; bottom left
+ ld a, $67
+ ld [hli], a
+ ; bottom
+ ld a, $68
+ call .FillTopBottom
+ ; bottom right
+ ld a, $6a
+ ld [hl], a
+ ret
+; b815b
+
+.FillMiddle: ; b815b
+ ld c, 18
+ ld a, $6d
+.loop
+ ld [hli], a
+ dec c
+ jr nz, .loop
+ ret
+; b8164
+
+.FillTopBottom: ; b8164
+ ld c, 5
+ jr .enterloop
+
+.continueloop
+rept 2
+ ld [hli], a
+endr
+
+.enterloop
+ inc a
+rept 2
+ ld [hli], a
+endr
+ dec a
+ dec c
+ jr nz, .continueloop
+ ret
+; b8172
+
+CheckForSignpostItems: ; b8172
+; Checks to see if there are hidden items on the screen that have not yet been found. If it finds one, returns carry.
+ call GetMapScriptHeaderBank
+ ld [Buffer1], a
+; Get the coordinate of the bottom right corner of the screen, and load it in wd1ec/wd1ed.
+ ld a, [XCoord]
+ add SCREEN_WIDTH / 4
+ ld [wd1ed], a
+ ld a, [YCoord]
+ add SCREEN_HEIGHT / 4
+ ld [wd1ec], a
+; Get the pointer for the first signpost header in the map...
+ ld hl, wdc02
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+; ... before even checking to see if there are any signposts on this map.
+ ld a, [wCurrentMapSignpostCount]
+ and a
+ jr z, .nosignpostitems
+; For i = 1:wCurrentMapSignpostCount...
+.loop
+; Store the counter in Buffer2, and store the signpost header pointer in the stack.
+ ld [Buffer2], a
+ push hl
+; Get the Y coordinate of the signpost.
+ call .GetFarByte
+ ld e, a
+; Is the Y coordinate of the signpost on the screen? If not, go to the next signpost.
+ ld a, [wd1ec]
+ sub e
+ jr c, .next
+ cp SCREEN_HEIGHT / 2
+ jr nc, .next
+; Is the X coordinate of the signpost on the screen? If not, go to the next signpost.
+ call .GetFarByte
+ ld d, a
+ ld a, [wd1ed]
+ sub d
+ jr c, .next
+ cp SCREEN_WIDTH / 2
+ jr nc, .next
+; Is this signpost a hidden item? If not, go to the next signpost.
+ call .GetFarByte
+ cp SIGNPOST_ITEM
+ jr nz, .next
+; Has this item already been found? If not, set off the Itemfinder.
+ ld a, [Buffer1]
+ call GetFarHalfword
+ ld a, [Buffer1]
+ call GetFarHalfword
+ ld d, h
+ ld e, l
+ ld b, CHECK_FLAG
+ call EventFlagAction
+ ld a, c
+ and a
+ jr z, .itemnearby
+
+.next
+; Restore the signpost header pointer and increment it by the length of a signpost header.
+ pop hl
+ ld bc, 5
+ add hl, bc
+; Restore the signpost counter and decrement it. If it hits zero, there are no hidden items in range.
+ ld a, [Buffer2]
+ dec a
+ jr nz, .loop
+
+.nosignpostitems
+ xor a
+ ret
+
+.itemnearby
+ pop hl
+ scf
+ ret
+; b81e2
+
+.GetFarByte: ; b81e2
+ ld a, [Buffer1]
+ call GetFarByte
+ inc hl
+ ret
+; b81ea
+
+
+TreeMonEncounter: ; b81ea
+ callba MobileFn_1060ef
+
+ xor a
+ ld [TempWildMonSpecies], a
+ ld [CurPartyLevel], a
+
+ ld hl, TreeMonMaps
+ call GetTreeMonSet
+ jr nc, .no_battle
+
+ call GetTreeMons
+ jr nc, .no_battle
+
+ call GetTreeMon
+ jr nc, .no_battle
+
+ ld a, BATTLETYPE_TREE
+ ld [BattleType], a
+ ld a, 1
+ ld [ScriptVar], a
+ ret
+
+.no_battle
+ xor a
+ ld [ScriptVar], a
+ ret
+; b8219
+
+RockMonEncounter: ; b8219
+
+ xor a
+ ld [TempWildMonSpecies], a
+ ld [CurPartyLevel], a
+
+ ld hl, RockMonMaps
+ call GetTreeMonSet
+ jr nc, .no_battle
+
+ call GetTreeMons
+ jr nc, .no_battle
+
+ ld a, 10
+ call RandomRange
+ cp 4
+ jr nc, .no_battle
+
+ call SelectTreeMon
+ jr nc, .no_battle
+
+ ret
+
+.no_battle
+ xor a
+ ret
+; b823e
+
+ db $05 ; ????
+
+GetTreeMonSet: ; b823f
+; Return carry and treemon set in a
+; if the current map is in table hl.
+ ld a, [MapNumber]
+ ld e, a
+ ld a, [MapGroup]
+ ld d, a
+.loop
+ ld a, [hli]
+ cp -1
+ jr z, .not_in_table
+
+ cp d
+ jr nz, .skip2
+
+ ld a, [hli]
+ cp e
+ jr nz, .skip1
+
+ jr .in_table
+
+.skip2
+ inc hl
+.skip1
+ inc hl
+ jr .loop
+
+.not_in_table
+ xor a
+ ret
+
+.in_table
+ ld a, [hl]
+ scf
+ ret
+; b825e
+
+TreeMonMaps: ; b825e
+treemon_map: macro
+ map \1
+ db \2 ; treemon set
+endm
+ treemon_map ROUTE_26, 4
+ treemon_map ROUTE_27, 4
+ treemon_map ROUTE_28, 0
+ treemon_map ROUTE_29, 3
+ treemon_map ROUTE_30, 3
+ treemon_map ROUTE_31, 3
+ treemon_map ROUTE_32, 4
+ treemon_map ROUTE_33, 2
+ treemon_map ROUTE_34, 3
+ treemon_map ROUTE_35, 3
+ treemon_map ROUTE_36, 3
+ treemon_map ROUTE_37, 3
+ treemon_map ROUTE_38, 3
+ treemon_map ROUTE_39, 3
+ treemon_map ROUTE_40, 0
+ treemon_map ROUTE_41, 0
+ treemon_map ROUTE_42, 2
+ treemon_map ROUTE_43, 5
+ treemon_map ROUTE_44, 1
+ treemon_map ROUTE_45, 1
+ treemon_map ROUTE_46, 1
+ treemon_map NEW_BARK_TOWN, 0
+ treemon_map CHERRYGROVE_CITY, 0
+ treemon_map VIOLET_CITY, 0
+ treemon_map AZALEA_TOWN, 2
+ treemon_map CIANWOOD_CITY, 0
+ treemon_map GOLDENROD_CITY, 0
+ treemon_map OLIVINE_CITY, 0
+ treemon_map ECRUTEAK_CITY, 0
+ treemon_map MAHOGANY_TOWN, 0
+ treemon_map LAKE_OF_RAGE, 5
+ treemon_map BLACKTHORN_CITY, 0
+ treemon_map SILVER_CAVE_OUTSIDE, 0
+ treemon_map ILEX_FOREST, 6
+ db -1
+; b82c5
+
+RockMonMaps: ; b82c5
+ treemon_map CIANWOOD_CITY, 7
+ treemon_map ROUTE_40, 7
+ treemon_map DARK_CAVE_VIOLET_ENTRANCE, 7
+ treemon_map SLOWPOKE_WELL_B1F, 7
+ db -1
+; b82d2
+
+GetTreeMons: ; b82d2
+; Return the address of TreeMon table a in hl.
+; Return nc if table a doesn't exist.
+
+ cp 8
+ jr nc, .quit
+
+ and a
+ jr z, .quit
+
+ ld e, a
+ ld d, 0
+ ld hl, TreeMons
+rept 2
+ add hl, de
+endr
+
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+
+ scf
+ ret
+
+.quit
+ xor a
+ ret
+; b82e8
+
+TreeMons: ; b82e8
+ dw TreeMons1
+ dw TreeMons1
+ dw TreeMons2
+ dw TreeMons3
+ dw TreeMons4
+ dw TreeMons5
+ dw TreeMons6
+ dw RockMons
+ dw TreeMons1
+
+; Two tables each (normal, rare).
+; Structure:
+; db %, species, level
+
+TreeMons1: ; b82fa
+ db 50, SPEAROW, 10
+ db 15, SPEAROW, 10
+ db 15, SPEAROW, 10
+ db 10, AIPOM, 10
+ db 5, AIPOM, 10
+ db 5, AIPOM, 10
+ db -1
+
+ db 50, SPEAROW, 10
+ db 15, HERACROSS, 10
+ db 15, HERACROSS, 10
+ db 10, AIPOM, 10
+ db 5, AIPOM, 10
+ db 5, AIPOM, 10
+ db -1
+
+TreeMons2: ; b8320
+ db 50, SPEAROW, 10
+ db 15, EKANS, 10
+ db 15, SPEAROW, 10
+ db 10, AIPOM, 10
+ db 5, AIPOM, 10
+ db 5, AIPOM, 10
+ db -1
+
+ db 50, SPEAROW, 10
+ db 15, HERACROSS, 10
+ db 15, HERACROSS, 10
+ db 10, AIPOM, 10
+ db 5, AIPOM, 10
+ db 5, AIPOM, 10
+ db -1
+
+TreeMons3: ; b8346
+ db 50, HOOTHOOT, 10
+ db 15, SPINARAK, 10
+ db 15, LEDYBA, 10
+ db 10, EXEGGCUTE, 10
+ db 5, EXEGGCUTE, 10
+ db 5, EXEGGCUTE, 10
+ db -1
+
+ db 50, HOOTHOOT, 10
+ db 15, PINECO, 10
+ db 15, PINECO, 10
+ db 10, EXEGGCUTE, 10
+ db 5, EXEGGCUTE, 10
+ db 5, EXEGGCUTE, 10
+ db -1
+
+TreeMons4: ; b836c
+ db 50, HOOTHOOT, 10
+ db 15, EKANS, 10
+ db 15, HOOTHOOT, 10
+ db 10, EXEGGCUTE, 10
+ db 5, EXEGGCUTE, 10
+ db 5, EXEGGCUTE, 10
+ db -1
+
+ db 50, HOOTHOOT, 10
+ db 15, PINECO, 10
+ db 15, PINECO, 10
+ db 10, EXEGGCUTE, 10
+ db 5, EXEGGCUTE, 10
+ db 5, EXEGGCUTE, 10
+ db -1
+
+TreeMons5: ; b8392
+ db 50, HOOTHOOT, 10
+ db 15, VENONAT, 10
+ db 15, HOOTHOOT, 10
+ db 10, EXEGGCUTE, 10
+ db 5, EXEGGCUTE, 10
+ db 5, EXEGGCUTE, 10
+ db -1
+
+ db 50, HOOTHOOT, 10
+ db 15, PINECO, 10
+ db 15, PINECO, 10
+ db 10, EXEGGCUTE, 10
+ db 5, EXEGGCUTE, 10
+ db 5, EXEGGCUTE, 10
+ db -1
+
+TreeMons6: ; b83b8
+ db 50, HOOTHOOT, 10
+ db 15, PINECO, 10
+ db 15, PINECO, 10
+ db 10, NOCTOWL, 10
+ db 5, BUTTERFREE, 10
+ db 5, BEEDRILL, 10
+ db -1
+
+ db 50, HOOTHOOT, 10
+ db 15, CATERPIE, 10
+ db 15, WEEDLE, 10
+ db 10, HOOTHOOT, 10
+ db 5, METAPOD, 10
+ db 5, KAKUNA, 10
+ db -1
+
+RockMons: ; b83de
+ db 90, KRABBY, 15
+ db 10, SHUCKLE, 15
+ db -1
+; b83e5
+
+GetTreeMon: ; b83e5
+ push hl
+ call GetTreeScore
+ pop hl
+ and a
+ jr z, .bad
+ cp 1
+ jr z, .good
+ cp 2
+ jr z, .rare
+ ret
+
+.bad
+ ld a, 10
+ call RandomRange
+ and a
+ jr nz, NoTreeMon
+ jr SelectTreeMon
+
+.good
+ ld a, 10
+ call RandomRange
+ cp 5
+ jr nc, NoTreeMon
+ jr SelectTreeMon
+
+.rare
+ ld a, 10
+ call RandomRange
+ cp 8
+ jr nc, NoTreeMon
+ jr .skip
+.skip
+ ld a, [hli]
+ cp -1
+ jr nz, .skip
+ call SelectTreeMon
+ ret
+; b841f
+
+SelectTreeMon: ; b841f
+; Read a TreeMons table and pick one monster at random.
+
+ ld a, 100
+ call RandomRange
+.loop
+ sub [hl]
+ jr c, .ok
+rept 3
+ inc hl
+endr
+ jr .loop
+
+.ok
+ ld a, [hli]
+ cp $ff
+ jr z, NoTreeMon
+
+ ld a, [hli]
+ ld [TempWildMonSpecies], a
+ ld a, [hl]
+ ld [CurPartyLevel], a
+ scf
+ ret
+
+NoTreeMon: ; b843b
+ xor a
+ ld [TempWildMonSpecies], a
+ ld [CurPartyLevel], a
+ ret
+; b8443
+
+GetTreeScore: ; b8443
+ call .CoordScore
+ ld [Buffer1], a
+ call .OTIDScore
+ ld [Buffer2], a
+ ld c, a
+ ld a, [Buffer1]
+ sub c
+ jr z, .rare
+ jr nc, .ok
+ add 10
+.ok
+ cp 5
+ jr c, .good
+
+.bad
+ xor a
+ ret
+
+.good
+ ld a, 1
+ ret
+
+.rare
+ ld a, 2
+ ret
+; b8466
+
+.CoordScore: ; b8466
+ call GetFacingTileCoord
+ ld hl, 0
+ ld c, e
+ ld b, 0
+ ld a, d
+
+ and a
+ jr z, .next
+.loop
+ add hl, bc
+ dec a
+ jr nz, .loop
+.next
+
+ add hl, bc
+ ld c, d
+ add hl, bc
+
+ ld a, h
+ ld [hDividend], a
+ ld a, l
+ ld [hDividend + 1], a
+ ld a, 5
+ ld [hDivisor], a
+ ld b, 2
+ call Divide
+
+ ld a, [hQuotient + 1]
+ ld [hDividend], a
+ ld a, [hQuotient + 2]
+ ld [hDividend + 1], a
+ ld a, 10
+ ld [hDivisor], a
+ ld b, 2
+ call Divide
+
+ ld a, [hQuotient + 3]
+ ret
+; b849d
+
+.OTIDScore: ; b849d
+ ld a, [PlayerID]
+ ld [hDividend], a
+ ld a, [PlayerID + 1]
+ ld [hDividend + 1], a
+ ld a, 10
+ ld [hDivisor], a
+ ld b, 2
+ call Divide
+ ld a, [hQuotient + 3]
+ ret
+; b84b3
+
+LoadFishingGFX: ; b84b3
+ ld a, [rVBK]
+ push af
+ ld a, $1
+ ld [rVBK], a
+
+ ld de, FishingGFX
+ ld a, [PlayerGender]
+ bit 0, a
+ jr z, .got_gender
+ ld de, KrisFishingGFX
+.got_gender
+
+ ld hl, VTiles0 tile $02
+ call .LoadGFX
+ ld hl, VTiles0 tile $06
+ call .LoadGFX
+ ld hl, VTiles0 tile $0a
+ call .LoadGFX
+ ld hl, VTiles1 tile $7c
+ call .LoadGFX
+
+ pop af
+ ld [rVBK], a
+ ret
+; b84e3
+
+.LoadGFX: ; b84e3
+ lb bc, BANK(FishingGFX), 2
+ push de
+ call Get2bpp
+ pop de
+ ld hl, 2 tiles
+ add hl, de
+ ld d, h
+ ld e, l
+ ret
+; b84f2
+
+FishingGFX: ; b84f2
+INCBIN "gfx/overworld/chris_fish.2bpp"
+; b8582
+
+KrisFishingGFX: ; b8582
+INCBIN "gfx/overworld/kris_fish.2bpp"
+; b8612
--- a/engine/evolution_animation.asm
+++ b/engine/evolution_animation.asm
@@ -372,7 +372,7 @@
INCBIN "gfx/evo/bubble.2bpp"
Function4e881: ; 4e881
- call WhiteBGMap
+ call ClearBGPalettes
call ClearTileMap
call ClearSprites
call DisableLCD
@@ -405,7 +405,7 @@
Function4e8c2: ; 4e8c2
- call WhiteBGMap
+ call ClearBGPalettes
call ClearTileMap
call ClearSprites
call DisableLCD
--- /dev/null
+++ b/engine/flypoints.asm
@@ -1,0 +1,916 @@
+_FlyMap: ; 91af3
+ call ClearBGPalettes
+ call ClearTileMap
+ call ClearSprites
+ ld hl, hInMenu
+ ld a, [hl]
+ push af
+ ld [hl], $1
+ xor a
+ ld [hBGMapMode], a
+ callba Function8cf53
+ call Function91ff2
+ ld de, GFX_922e1
+ ld hl, VTiles2 tile $30
+ lb bc, BANK(GFX_922e1), 6
+ call Request1bpp
+ call FlyMap
+ call Function91c8f
+ ld b, $2
+ call GetSGBLayout
+ call SetPalettes
+.loop
+ call JoyTextDelay
+ ld hl, hJoyPressed
+ ld a, [hl]
+ and B_BUTTON
+ jr nz, .pressedB
+ ld a, [hl]
+ and A_BUTTON
+ jr nz, .pressedA
+ call FlyMapScroll
+ call GetMapCursorCoordinates
+ callba Function8cf69
+ call DelayFrame
+ jr .loop
+
+.pressedB
+ ld a, -1
+ jr .exit
+
+.pressedA
+ ld a, [wd002]
+ ld l, a
+ ld h, 0
+ add hl, hl
+ ld de, Flypoints + 1
+ add hl, de
+ ld a, [hl]
+
+.exit
+ ld [wd002], a
+ pop af
+ ld [hInMenu], a
+ call ClearBGPalettes
+ ld a, $90
+ ld [hWY], a
+ xor a
+ ld [hBGMapAddress], a
+ ld a, VBGMap0 / $100
+ ld [hBGMapAddress + 1], a
+ ld a, [wd002]
+ ld e, a
+ ret
+; 91b73
+
+FlyMapScroll: ; 91b73
+ ld a, [StartFlypoint]
+ ld e, a
+ ld a, [EndFlypoint]
+ ld d, a
+ ld hl, hJoyLast
+ ld a, [hl]
+ and D_UP
+ jr nz, .ScrollNext
+ ld a, [hl]
+ and D_DOWN
+ jr nz, .ScrollPrev
+ ret
+
+.ScrollNext
+ ld hl, wd002
+ ld a, [hl]
+ cp d
+ jr nz, .NotAtEndYet
+ ld a, e
+ dec a
+ ld [hl], a
+
+.NotAtEndYet
+ inc [hl]
+ call CheckIfVisitedFlypoint
+ jr z, .ScrollNext
+ jr .Finally
+
+.ScrollPrev
+ ld hl, wd002
+ ld a, [hl]
+ cp e
+ jr nz, .NotAtStartYet
+ ld a, d
+ inc a
+ ld [hl], a
+
+.NotAtStartYet
+ dec [hl]
+ call CheckIfVisitedFlypoint
+ jr z, .ScrollPrev
+
+.Finally
+ call TownMapBubble
+ call WaitBGMap
+ xor a
+ ld [hBGMapMode], a
+ ret
+; 91bb5
+
+TownMapBubble: ; 91bb5
+; Draw the bubble containing the location text in the town map HUD
+
+; Top-left corner
+ hlcoord 1, 0
+ ld a, $30
+ ld [hli], a
+
+; Top row
+ ld bc, 16
+ ld a, " "
+ call ByteFill
+
+; Top-right corner
+ ld a, $31
+ ld [hl], a
+ hlcoord 1, 1
+
+
+; Middle row
+ ld bc, 18
+ ld a, " "
+ call ByteFill
+
+
+; Bottom-left corner
+ hlcoord 1, 2
+ ld a, $32
+ ld [hli], a
+
+; Bottom row
+ ld bc, 16
+ ld a, " "
+ call ByteFill
+
+; Bottom-right corner
+ ld a, $33
+ ld [hl], a
+
+
+; Print "Where?"
+ hlcoord 2, 0
+ ld de, .Where
+ call PlaceString
+
+; Print the name of the default flypoint
+ call .Name
+
+; Up/down arrows
+ hlcoord 18, 1
+ ld [hl], $34
+ ret
+
+.Where
+ db "Where?@"
+
+.Name
+; We need the map location of the default flypoint
+ ld a, [wd002]
+ ld l, a
+ ld h, 0
+ add hl, hl ; two bytes per flypoint
+ ld de, Flypoints
+ add hl, de
+ ld e, [hl]
+
+ callba GetLandmarkName
+
+ hlcoord 2, 1
+ ld de, StringBuffer1
+ call PlaceString
+ ret
+; 91c17
+
+GetMapCursorCoordinates: ; 91c17
+ ld a, [wd002]
+ ld l, a
+ ld h, $0
+ add hl, hl
+ ld de, Flypoints
+ add hl, de
+ ld e, [hl]
+ callba GetLandmarkCoords
+ ld a, [wd003]
+ ld c, a
+ ld a, [wd004]
+ ld b, a
+ ld hl, $4
+ add hl, bc
+ ld [hl], e
+ ld hl, $5
+ add hl, bc
+ ld [hl], d
+ ret
+; 91c3c
+
+CheckIfVisitedFlypoint: ; 91c3c
+; Check if the flypoint loaded in [hl] has been visited yet.
+ push bc
+ push de
+ push hl
+ ld l, [hl]
+ ld h, 0
+ add hl, hl
+ ld de, Flypoints + 1
+ add hl, de
+ ld c, [hl]
+ call HasVisitedSpawn
+ pop hl
+ pop de
+ pop bc
+ and a
+ ret
+; 91c50
+
+HasVisitedSpawn: ; 91c50
+; Check if spawn point c has been visited.
+ ld hl, VisitedSpawns
+ ld b, CHECK_FLAG
+ ld d, 0
+ predef FlagPredef
+ ld a, c
+ ret
+; 91c5e
+
+Flypoints: ; 91c5e
+; landmark, spawn point
+
+ const_def
+
+flypoint: MACRO
+; \1\@FLY EQUS "FLY_\1"
+; \1\@SPAWN EQUS "SPAWN_\1"
+ ; const \1\@FLY
+ ; db \2, \1\@SPAWN
+ const FLY_\1
+ db \2, SPAWN_\1
+ENDM
+
+; Johto
+ flypoint NEW_BARK, NEW_BARK_TOWN
+ flypoint CHERRYGROVE, CHERRYGROVE_CITY
+ flypoint VIOLET, VIOLET_CITY
+ flypoint AZALEA, AZALEA_TOWN
+ flypoint GOLDENROD, GOLDENROD_CITY
+ flypoint ECRUTEAK, ECRUTEAK_CITY
+ flypoint OLIVINE, OLIVINE_CITY
+ flypoint CIANWOOD, CIANWOOD_CITY
+ flypoint MAHOGANY, MAHOGANY_TOWN
+ flypoint LAKE, LAKE_OF_RAGE
+ flypoint BLACKTHORN, BLACKTHORN_CITY
+ flypoint MT_SILVER, SILVER_CAVE
+
+; Kanto
+KANTO_FLYPOINT EQU const_value
+
+ flypoint PALLET, PALLET_TOWN
+ flypoint VIRIDIAN, VIRIDIAN_CITY
+ flypoint PEWTER, PEWTER_CITY
+ flypoint CERULEAN, CERULEAN_CITY
+ flypoint VERMILION, VERMILION_CITY
+ flypoint ROCK_TUNNEL, ROCK_TUNNEL
+ flypoint LAVENDER, LAVENDER_TOWN
+ flypoint CELADON, CELADON_CITY
+ flypoint SAFFRON, SAFFRON_CITY
+ flypoint FUCHSIA, FUCHSIA_CITY
+ flypoint CINNABAR, CINNABAR_ISLAND
+ flypoint INDIGO, INDIGO_PLATEAU
+
+ db -1
+; 91c8f
+
+Function91c8f: ; 91c8f
+ ret
+; 91c90
+
+FlyMap: ; 91c90
+
+ ld a, [MapGroup]
+ ld b, a
+ ld a, [MapNumber]
+ ld c, a
+ call GetWorldMapLocation
+
+; If we're not in a valid location, i.e. Pokecenter floor 2F,
+; the backup map information is used
+
+ cp SPECIAL_MAP
+ jr nz, .CheckRegion
+
+ ld a, [BackupMapGroup]
+ ld b, a
+ ld a, [BackupMapNumber]
+ ld c, a
+ call GetWorldMapLocation
+
+.CheckRegion
+; The first 46 locations are part of Johto. The rest are in Kanto
+ cp KANTO_LANDMARK
+ jr nc, .KantoFlyMap
+
+.JohtoFlyMap
+; Note that .NoKanto should be modified in tandem with this branch
+
+ push af
+
+; Start from New Bark Town
+ ld a, FLY_NEW_BARK
+ ld [wd002], a
+
+; Flypoints begin at New Bark Town...
+ ld [StartFlypoint], a
+; ..and end at Silver Cave
+ ld a, FLY_MT_SILVER
+ ld [EndFlypoint], a
+
+; Fill out the map
+ call FillJohtoMap
+ call .MapHud
+ pop af
+ call TownMapPlayerIcon
+ ret
+
+.KantoFlyMap
+
+; The event that there are no flypoints enabled in a map is not
+; accounted for. As a result, if you attempt to select a flypoint
+; when there are none enabled, the game will crash. Additionally,
+; the flypoint selection has a default starting point that
+; can be flown to even if none are enabled
+
+; To prevent both of these things from happening when the player
+; enters Kanto, fly access is restricted until Indigo Plateau is
+; visited and its flypoint enabled
+
+ push af
+ ld c, SPAWN_INDIGO
+ call HasVisitedSpawn
+ and a
+ jr z, .NoKanto
+
+; Kanto's map is only loaded if we've visited Indigo Plateau
+
+; Flypoints begin at Pallet Town...
+ ld a, FLY_PALLET
+ ld [StartFlypoint], a
+; ...and end at Indigo Plateau
+ ld a, FLY_INDIGO
+ ld [EndFlypoint], a
+
+; Because Indigo Plateau is the first flypoint the player
+; visits, it's made the default flypoint
+ ld [wd002], a
+
+; Fill out the map
+ call FillKantoMap
+ call .MapHud
+ pop af
+ call TownMapPlayerIcon
+ ret
+
+.NoKanto
+; If Indigo Plateau hasn't been visited, we use Johto's map instead
+
+; Start from New Bark Town
+ ld a, FLY_NEW_BARK
+ ld [wd002], a
+
+; Flypoints begin at New Bark Town...
+ ld [StartFlypoint], a
+; ..and end at Silver Cave
+ ld a, FLY_MT_SILVER
+ ld [EndFlypoint], a
+
+ call FillJohtoMap
+
+ pop af
+
+.MapHud
+ call TownMapBubble
+ call TownMapPals
+
+ ld hl, VBGMap0 ; BG Map 0
+ call TownMapBGUpdate
+
+ call TownMapMon
+ ld a, c
+ ld [wd003], a
+ ld a, b
+ ld [wd004], a
+ ret
+; 91d11
+
+Function91d11: ; 91d11
+ ld a, [wd002]
+ push af
+ ld a, [wd003]
+ push af
+ ld a, e
+ ld [wd002], a
+ call ClearSprites
+ xor a
+ ld [hBGMapMode], a
+ ld a, $1
+ ld [hInMenu], a
+ ld de, GFX_922d1
+ ld hl, VTiles0 tile $7f
+ lb bc, BANK(GFX_922d1), 1
+ call Request2bpp ; actually 1bpp
+ call Function91ed0
+ ld hl, VTiles0 tile $78
+ ld c, $4
+ call Request2bpp
+ call Function91ff2
+ call FillKantoMap
+ call Function91de9
+ call TownMapPals
+ ld hl, VBGMap1
+ call TownMapBGUpdate
+ call FillJohtoMap
+ call Function91de9
+ call TownMapPals
+ ld hl, VBGMap0
+ call TownMapBGUpdate
+ ld b, $2
+ call GetSGBLayout
+ call SetPalettes
+ xor a
+ ld [hBGMapMode], a
+ xor a
+ call Function91e1e
+.asm_91d6e
+ call JoyTextDelay
+ ld hl, hJoyPressed
+ ld a, [hl]
+ and A_BUTTON | B_BUTTON
+ jr nz, .asm_91d8f
+ ld a, [hJoypadDown]
+ and SELECT
+ jr nz, .asm_91d87
+ call Function91d9b
+ call Function91dcd
+ jr .asm_91d8a
+
+.asm_91d87
+ call Function91e5a
+
+.asm_91d8a
+ call DelayFrame
+ jr .asm_91d6e
+
+.asm_91d8f
+ call ClearSprites
+ pop af
+ ld [wd003], a
+ pop af
+ ld [wd002], a
+ ret
+; 91d9b
+
+Function91d9b: ; 91d9b
+ ld a, [hl]
+ and $20
+ jr nz, .asm_91da6
+ ld a, [hl]
+ and $10
+ jr nz, .asm_91db7
+ ret
+
+.asm_91da6
+ ld a, [hWY]
+ cp $90
+ ret z
+ call ClearSprites
+ ld a, $90
+ ld [hWY], a
+ xor a
+ call Function91e1e
+ ret
+
+.asm_91db7
+ ld a, [StatusFlags]
+ bit 6, a
+ ret z
+ ld a, [hWY]
+ and a
+ ret z
+ call ClearSprites
+ xor a
+ ld [hWY], a
+ ld a, $1
+ call Function91e1e
+ ret
+; 91dcd
+
+Function91dcd: ; 91dcd
+ ld a, [hVBlankCounter]
+ ld e, a
+ and $f
+ ret nz
+ ld a, e
+ and $10
+ jr nz, .asm_91ddc
+ call ClearSprites
+ ret
+
+.asm_91ddc
+ hlcoord 0, 0
+ ld de, Sprites
+ ld bc, $a0
+ call CopyBytes
+ ret
+; 91de9
+
+Function91de9: ; 91de9
+ hlcoord 0, 0
+ ld bc, SCREEN_WIDTH
+ ld a, $7f
+ call ByteFill
+ hlcoord 0, 1
+ ld a, $6
+ ld [hli], a
+ ld bc, SCREEN_HEIGHT
+ ld a, $7
+ call ByteFill
+ ld [hl], $17
+ call GetPokemonName
+ hlcoord 2, 0
+ call PlaceString
+ ld h, b
+ ld l, c
+ ld de, String_91e16
+ call PlaceString
+ ret
+; 91e16
+
+String_91e16:
+ db "'S NEST@"
+; 91e1e
+
+Function91e1e: ; 91e1e
+ ld [wd003], a
+ ld e, a
+ callba Function2a01f
+ decoord 0, 0
+ ld hl, Sprites
+.asm_91e2e
+ ld a, [de]
+ and a
+ jr z, .asm_91e4d
+ push de
+ ld e, a
+ push hl
+ callba GetLandmarkCoords
+ pop hl
+ ld a, d
+ sub $4
+ ld [hli], a
+ ld a, e
+ sub $4
+ ld [hli], a
+ ld a, $7f
+ ld [hli], a
+ xor a
+ ld [hli], a
+ pop de
+ inc de
+ jr .asm_91e2e
+
+.asm_91e4d
+ ld hl, Sprites
+ decoord 0, 0
+ ld bc, $a0
+ call CopyBytes
+ ret
+; 91e5a
+
+Function91e5a: ; 91e5a
+ call Function91ea9
+ ret c
+
+ ld a, [wd002]
+ ld e, a
+ callba GetLandmarkCoords
+ ld c, e
+ ld b, d
+ ld de, Unknown_91e9c
+ ld hl, Sprites
+.asm_91e70
+ ld a, [de]
+ cp $80
+ jr z, .asm_91e91
+
+ add b
+ ld [hli], a
+ inc de
+
+ ld a, [de]
+ add c
+ ld [hli], a
+ inc de
+
+ ld a, [de]
+ add $78
+ ld [hli], a
+ inc de
+
+ push bc
+ ld c, 0
+ ld a, [PlayerGender]
+ bit 0, a
+ jr z, .asm_91e8c
+ inc c
+.asm_91e8c
+ ld a, c
+ ld [hli], a
+ pop bc
+
+ jr .asm_91e70
+
+.asm_91e91
+ ld hl, Sprites + $10
+ ld bc, SpritesEnd - (Sprites + $10)
+ xor a
+ call ByteFill
+ ret
+; 91e9c
+
+Unknown_91e9c: ; 91e9c
+ db -8, -8, 0
+ db -8, 0, 1
+ db 0, -8, 2
+ db 0, 0, 3
+ db $80 ; terminator
+; 91ea9
+
+Function91ea9: ; 91ea9
+ ld a, [wd002]
+ cp FAST_SHIP
+ jr z, .johto
+ cp KANTO_LANDMARK
+ jr c, .johto
+
+.kanto
+ ld a, [wd003]
+ and a
+ jr z, .clear
+ jr .ok
+
+.johto
+ ld a, [wd003]
+ and a
+ jr nz, .clear
+
+.ok
+ and a
+ ret
+
+.clear
+ ld hl, Sprites
+ ld bc, SpritesEnd - Sprites
+ xor a
+ call ByteFill
+ scf
+ ret
+; 91ed0
+
+Function91ed0: ; 91ed0
+ ld a, [wd002]
+ cp FAST_SHIP
+ jr z, .asm_91ede
+ callba GetPlayerIcon
+ ret
+
+.asm_91ede
+ ld de, FastShipGFX
+ ld b, BANK(FastShipGFX)
+ ret
+; 91ee4
+
+TownMapBGUpdate: ; 91ee4
+; Update BG Map tiles and attributes
+
+; BG Map address
+ ld a, l
+ ld [hBGMapAddress], a
+ ld a, h
+ ld [hBGMapAddress + 1], a
+
+; Only update palettes on CGB
+ ld a, [hCGB]
+ and a
+ jr z, .tiles
+
+; BG Map mode 2 (palettes)
+ ld a, 2
+ ld [hBGMapMode], a
+
+; The BG Map is updated in thirds, so we wait
+; 3 frames to update the whole screen's palettes.
+ ld c, 3
+ call DelayFrames
+
+.tiles
+; Update BG Map tiles
+ call WaitBGMap
+
+; Turn off BG Map update
+ xor a
+ ld [hBGMapMode], a
+ ret
+; 91eff
+
+FillJohtoMap: ; 91eff
+ ld de, JohtoMap
+ jr FillTownMap
+
+FillKantoMap: ; 91f04
+ ld de, KantoMap
+
+FillTownMap: ; 91f07
+ hlcoord 0, 0
+.loop
+ ld a, [de]
+ cp $ff
+ ret z
+ ld a, [de]
+ ld [hli], a
+ inc de
+ jr .loop
+; 91f13
+
+TownMapPals: ; 91f13
+; Assign palettes based on tile ids
+
+ hlcoord 0, 0
+ decoord 0, 0, AttrMap
+ ld bc, 360
+.loop
+; Current tile
+ ld a, [hli]
+ push hl
+
+; HP/borders use palette 0
+ cp $60
+ jr nc, .pal0
+
+; The palette data is condensed to nybbles,
+; least-significant first.
+ ld hl, TownMapPalMap
+ srl a
+ jr c, .odd
+
+; Even-numbered tile ids take the bottom nybble...
+ add l
+ ld l, a
+ ld a, h
+ adc 0
+ ld h, a
+ ld a, [hl]
+ and %111
+ jr .update
+
+.odd
+; ...and odd ids take the top.
+ add l
+ ld l, a
+ ld a, h
+ adc 0
+ ld h, a
+ ld a, [hl]
+ swap a
+ and %111
+ jr .update
+
+.pal0
+ xor a
+
+.update
+ pop hl
+ ld [de], a
+ inc de
+ dec bc
+ ld a, b
+ or c
+ jr nz, .loop
+ ret
+
+TownMapPalMap:
+ db $11, $21, $22, $00, $11, $13, $54, $54, $11, $21, $22, $00
+ db $11, $10, $01, $00, $11, $21, $22, $00, $00, $00, $00, $00
+ db $00, $00, $44, $04, $00, $00, $00, $00, $33, $33, $33, $33
+ db $33, $33, $33, $03, $33, $33, $33, $33, $00, $00, $00, $00
+; 91f7b
+
+TownMapMon: ; 91f7b
+; Draw the FlyMon icon at town map location in
+
+; Get FlyMon species
+ ld a, [CurPartyMon]
+ ld hl, PartySpecies
+ ld e, a
+ ld d, $0
+ add hl, de
+ ld a, [hl]
+ ld [wd265], a
+
+; Get FlyMon icon
+ ld e, 8 ; starting tile in VRAM
+ callba GetSpeciesIcon
+
+; Animation/palette
+ ld de, 0
+ ld a, $0
+ call Function3b2a
+
+ ld hl, 3
+ add hl, bc
+ ld [hl], 8
+ ld hl, 2
+ add hl, bc
+ ld [hl], 0
+ ret
+; 91fa6
+
+TownMapPlayerIcon: ; 91fa6
+; Draw the player icon at town map location in a
+ push af
+
+ callba GetPlayerIcon
+
+; Standing icon
+ ld hl, VTiles0 tile $10
+ ld c, 4 ; # tiles
+ call Request2bpp
+
+; Walking icon
+ ld hl, $c0
+ add hl, de
+ ld d, h
+ ld e, l
+ ld hl, VTiles0 tile $14
+ ld c, 4 ; # tiles
+ ld a, BANK(ChrisSpriteGFX) ; does nothing
+ call Request2bpp
+
+; Animation/palette
+ ld de, 0
+ ld b, $0a ; Male
+ ld a, [PlayerGender]
+ bit 0, a
+ jr z, .asm_91fd3
+ ld b, $1e ; Female
+.asm_91fd3
+ ld a, b
+ call Function3b2a
+
+ ld hl, $3
+ add hl, bc
+ ld [hl], $10
+
+ pop af
+ ld e, a
+ push bc
+ callba GetLandmarkCoords
+ pop bc
+
+ ld hl, 4
+ add hl, bc
+ ld [hl], e
+ ld hl, 5
+ add hl, bc
+ ld [hl], d
+ ret
+; 0x91ff2
+
+Function91ff2: ; 91ff2
+ ld hl, TownMapGFX
+ ld de, VTiles2
+ lb bc, BANK(TownMapGFX), $30
+ call DecompressRequest2bpp
+ ret
+; 91fff
+
+
+JohtoMap: ; 91fff
+INCBIN "gfx/misc/johto.bin"
+; 92168
+
+KantoMap: ; 92168
+INCBIN "gfx/misc/kanto.bin"
+; 922d1
+
+
+GFX_922d1: ; 922d1
+INCBIN "gfx/unknown/0922d1.2bpp"
+GFX_922e1: ; 922e1
+INCBIN "gfx/unknown/0922e1.2bpp"
+GFX_92301: ; 92301
+INCBIN "gfx/unknown/092301.2bpp"
--- a/engine/link.asm
+++ b/engine/link.asm
@@ -1,6 +1,6 @@
LinkCommunications: ; 28000
- call WhiteBGMap
- ld c, $50
+ call ClearBGPalettes
+ ld c, 80
call DelayFrames
call ClearScreen
call ClearSprites
@@ -8,7 +8,7 @@
xor a
ld [hSCX], a
ld [hSCY], a
- ld c, $50
+ ld c, 80
call DelayFrames
call ClearScreen
call UpdateSprites
@@ -431,7 +431,7 @@
ld de, OTName
ld bc, NAME_LENGTH
call CopyBytes
- call Function222a
+ call ReturnToMapFromSubmenu
ld a, [wc2d7]
push af
ld a, $1
@@ -509,7 +509,7 @@
Function283f2: ; 283f2
ld a, $1
- ld [$ffcc], a
+ ld [hFFCC], a
.asm_283f6
ld a, [hl]
ld [hSerialSend], a
@@ -521,7 +521,7 @@
.asm_28401
dec a
jr nz, .asm_28401
- ld a, [$ffcc]
+ ld a, [hFFCC]
and a
ld a, b
pop bc
@@ -528,7 +528,7 @@
jr z, .asm_28411
dec hl
xor a
- ld [$ffcc], a
+ ld [hFFCC], a
jr .asm_283f6
.asm_28411
@@ -2172,7 +2172,7 @@
Function28fdb: ; 28fdb
xor a
ld [wJumptableIndex], a
- call WhiteBGMap
+ call ClearBGPalettes
call ClearSprites
call ClearTileMap
call DisableLCD
@@ -2495,7 +2495,7 @@
; 29229
Function29229: ; 29229
- call WhiteBGMap
+ call ClearBGPalettes
call ClearTileMap
call ClearSprites
call DisableLCD
@@ -2623,7 +2623,7 @@
Function292f6: ; 292f6
push af
- call WhiteBGMap
+ call ClearBGPalettes
call WaitTop
ld a, VBGMap1 / $100
ld [hBGMapAddress + 1], a
@@ -3902,7 +3902,7 @@
Function29e0c: ; 29e0c
xor a
- ld [$ffca], a
+ ld [hFFCA], a
ld a, [wcf5b]
ld h, a
ld a, [wcf5c]
--- a/engine/map_objects.asm
+++ b/engine/map_objects.asm
@@ -655,7 +655,7 @@
ld hl, OBJECT_12
add hl, bc
ld [hl], a
- ld hl, OBJECT_27
+ ld hl, OBJECT_MOVEMENT_BYTE_INDEX
add hl, bc
rept 3
ld [hli], a
@@ -848,7 +848,7 @@
; 4780
ClearObjectStructField27: ; 4780
- ld hl, OBJECT_27
+ ld hl, OBJECT_MOVEMENT_BYTE_INDEX
add hl, bc
ld [hl], 0
ret
@@ -855,7 +855,7 @@
; 4787
IncrementObjectStructField27: ; 4787
- ld hl, OBJECT_27
+ ld hl, OBJECT_MOVEMENT_BYTE_INDEX
add hl, bc
inc [hl]
ret
@@ -862,7 +862,7 @@
; 478d
DecrementObjectStructField27: ; 478d
- ld hl, OBJECT_27
+ ld hl, OBJECT_MOVEMENT_BYTE_INDEX
add hl, bc
dec [hl]
ret
@@ -869,7 +869,7 @@
; 4793
JumptoObjectStructField27: ; 4793
- ld hl, OBJECT_27
+ ld hl, OBJECT_MOVEMENT_BYTE_INDEX
add hl, bc
ld a, [hl]
pop hl
@@ -1043,17 +1043,17 @@
.ObeyDPad: ; 487c
ld hl, Function5000
- jp Function5041
+ jp HandleMovementData
; 4882
.Movement08: ; 4882
ld hl, Function5015
- jp Function5041
+ jp HandleMovementData
; 4888
.Movement09: ; 4888
ld hl, Function5026
- jp Function5041
+ jp HandleMovementData
; 488e
.Movement0a: ; 488e
@@ -1070,7 +1070,7 @@
.Movement0d: ; 4897
ld hl, Function5000
- jp Function5041
+ jp HandleMovementData
; 489d
.Movement0e: ; 489d
@@ -1079,12 +1079,12 @@
.Follow: ; 48a0
ld hl, Function54e6
- jp Function5041
+ jp HandleMovementData
; 48a6
.Script: ; 48a6
ld hl, Function500e
- jp Function5041
+ jp HandleMovementData
; 48ac
.Strength: ; 48ac
@@ -1149,12 +1149,15 @@
ld hl, OBJECT_MAP_X
add hl, bc
ld d, [hl]
+
ld hl, OBJECT_MAP_Y
add hl, bc
ld e, [hl]
+
ld hl, OBJECT_32
add hl, bc
ld a, [hl]
+
push bc
call GetObjectStruct
ld hl, OBJECT_DIRECTION_WALKING
@@ -1162,6 +1165,7 @@
ld a, [hl]
cp STANDING
jr z, .standing
+
ld hl, OBJECT_NEXT_MAP_X
add hl, bc
ld a, [hl]
@@ -2400,11 +2404,14 @@
; 5000
Function5000: ; unscripted?
+; copy [wc3de] to [wc2df]
ld a, [wc2de]
ld hl, wc2df
ld [hl], a
- ld a, $3e
+; load [wc2de] with movement_step_sleep_1
+ ld a, movement_step_sleep_1
ld [wc2de], a
+; recover the previous value of [wc2de]
ld a, [hl]
ret
; 500e
@@ -2416,7 +2423,7 @@
; 5015
Function5015: ; 5015
- ld hl, OBJECT_27
+ ld hl, OBJECT_MOVEMENT_BYTE_INDEX
add hl, bc
ld e, [hl]
inc [hl]
@@ -2431,7 +2438,7 @@
; 5026
Function5026: ; 5026
- ld hl, OBJECT_27
+ ld hl, OBJECT_MOVEMENT_BYTE_INDEX
add hl, bc
ld e, [hl]
inc [hl]
@@ -2446,16 +2453,16 @@
; 5037
Function5037: ; 5037
- ld hl, Function503d
- jp Function5041
+ ld hl, GetMovementPerson
+ jp HandleMovementData
; 503d
-Function503d: ; 503d
+GetMovementPerson: ; 503d
ld a, [wMovementPerson]
ret
; 5041
-Function5041: ; 5041
+HandleMovementData: ; 5041
call CopyMovementPointer
.loop
xor a
@@ -2484,7 +2491,7 @@
jp [hl]
; 5065
-Function5065: ; 5065
+ContinueReadingMovement: ; 5065
ld a, 1
ld [wc2ea], a
ret
@@ -2563,7 +2570,8 @@
.done
call Function550a
ret c
- ld a, $3e
+
+ ld a, movement_step_sleep_1
ret
; 550a
@@ -2585,7 +2593,7 @@
.nope
ld a, $ff
ld [wObjectFollow_Follower], a
- ld a, $47
+ ld a, movement_step_end
scf
ret
; 5529
@@ -2696,6 +2704,7 @@
Function55ac: ; 55ac
call FindFirstEmptyObjectStruct
ret nc
+
ld d, h
ld e, l
callba Function8286
@@ -2703,11 +2712,14 @@
; 55b9
Function55b9: ; 55b9
+; load into wc2f0:
+; -1, -1, [de], [de + 1], [de + 2], [hMapObjectIndexBuffer], [MapX], [MapY], -1
ld hl, wc2f0
ld [hl], -1
inc hl
ld [hl], -1
inc hl
+
ld a, [de]
inc de
ld [hli], a
@@ -2716,8 +2728,10 @@
ld [hli], a
ld a, [de]
ld [hli], a
+
ld a, [hMapObjectIndexBuffer]
ld [hli], a
+
push hl
ld hl, OBJECT_MAP_X
add hl, bc
@@ -2726,6 +2740,7 @@
add hl, bc
ld e, [hl]
pop hl
+
ld [hl], d
inc hl
ld [hl], e
@@ -2786,6 +2801,7 @@
Function5629: ; 5629
cp NUM_OBJECTS
ret nc
+
call GetMapObject
ld hl, MAPOBJECT_OBJECT_STRUCT_ID
add hl, bc
@@ -2792,11 +2808,14 @@
ld a, [hl]
cp -1
ret z
+
cp NUM_OBJECT_STRUCTS
ret nc
+
call GetObjectStruct
call GetObjectSprite
ret z
+
call Function5673
ret
; 5645
@@ -2977,9 +2996,9 @@
.ok7
ld a, d
- ld [$ffbf], a
+ ld [hFFBF], a
.loop
- ld a, [$ffbf]
+ ld a, [hFFBF]
ld d, a
ld a, [hUsedSpriteTile]
add e
@@ -3180,7 +3199,7 @@
cp -1
ret z
call GetObjectStruct
- callba Function58e3
+ callba Function58e3 ; no need to bankswitch
ld a, -1
ld [wObjectFollow_Follower], a
ret
@@ -3294,7 +3313,8 @@
add hl, bc
ld a, [hl]
cp -1
- jp z, Function5903
+ jp z, Function5903 ; a jr would have been appropriate here
+
push bc
call GetMapObject
ld hl, MAPOBJECT_MOVEMENT
@@ -3301,9 +3321,11 @@
add hl, bc
ld a, [hl]
pop bc
+
ld hl, OBJECT_MOVEMENTTYPE
add hl, bc
ld [hl], a
+
ld hl, OBJECT_09
add hl, bc
ld [hl], 0
@@ -3322,6 +3344,7 @@
ld hl, OBJECT_MOVEMENTTYPE
add hl, bc
ld [hl], a
+
ld hl, OBJECT_09
add hl, bc
ld [hl], 0
@@ -3495,7 +3518,7 @@
.next
ld a, [hli]
ld d, a
- and %11110000
+ and $f0
ret z
cp c
jr nz, .next
@@ -3503,20 +3526,20 @@
push bc
push hl
ld a, d
- and %00001111
- call Function5ac2
- call Function5a0d
+ and $f
+ call .GetObjectStructPointer
+ call .asm_5a0d
pop hl
pop bc
jr .next
; 5a0d
-Function5a0d: ; 5a0d
+.asm_5a0d: ; 5a0d
ld hl, OBJECT_SPRITE_TILE
add hl, bc
ld a, [hl]
and %01111111
- ld [$ffc1], a
+ ld [hFFC1], a
xor a
bit 7, [hl]
@@ -3550,7 +3573,7 @@
jr z, .skip4
or %10000000
.skip4
- ld [$ffc2], a
+ ld [hFFC2], a
ld hl, OBJECT_SPRITE_X
add hl, bc
@@ -3565,7 +3588,7 @@
ld e, a
ld a, [wd14c]
add e
- ld [$ffbf], a
+ ld [hFFBF], a
ld hl, OBJECT_SPRITE_Y
add hl, bc
@@ -3580,7 +3603,7 @@
ld e, a
ld a, [wd14d]
add e
- ld [$ffc0], a
+ ld [hFFC0], a
ld hl, OBJECT_FACING_STEP
add hl, bc
@@ -3609,7 +3632,7 @@
jr nc, .full
.addsprite
- ld a, [$ffc0]
+ ld a, [hFFC0]
add [hl]
inc hl
@@ -3616,7 +3639,7 @@
ld [bc], a
inc c
- ld a, [$ffbf]
+ ld a, [hFFBF]
add [hl]
inc hl
@@ -3626,7 +3649,7 @@
ld e, [hl]
inc hl
- ld a, [$ffc1]
+ ld a, [hFFC1]
bit 2, e
jr z, .nope1
xor a
@@ -3640,7 +3663,7 @@
ld a, e
bit 1, a
jr z, .nope2
- ld a, [$ffc2]
+ ld a, [hFFC2]
or e
.nope2
and %11110000
@@ -3665,7 +3688,7 @@
ret
; 5ac2
-Function5ac2: ; 5ac2
+.GetObjectStructPointer: ; 5ac2
ld c, a
ld b, 0
ld hl, .Addresses
--- a/engine/map_setup.asm
+++ b/engine/map_setup.asm
@@ -17,28 +17,28 @@
; 15377
MapSetupScripts: ; 15377
- dw MapSetupScript1
- dw MapSetupScript2
- dw MapSetupScript3
- dw MapSetupScript4
- dw MapSetupScript5
- dw MapSetupScript6
- dw MapSetupScript7
- dw MapSetupScript8
- dw MapSetupScript9
- dw MapSetupScript10
- dw MapSetupScript11
- dw MapSetupScript12
+ dw MapSetupScript_Warp
+ dw MapSetupScript_Continue
+ dw MapSetupScript_ReloadMap
+ dw MapSetupScript_Teleport
+ dw MapSetupScript_Door
+ dw MapSetupScript_Fall
+ dw MapSetupScript_Connection
+ dw MapSetupScript_LinkReturn
+ dw MapSetupScript_Train
+ dw MapSetupScript_Submenu
+ dw MapSetupScript_BadWarp
+ dw MapSetupScript_Fly
; 1538f
-MapSetupScript4: ; 1538f
+MapSetupScript_Teleport: ; 1538f
db map_prolong_sprites
-MapSetupScript12: ; 15390
+MapSetupScript_Fly: ; 15390
db map_fade_out_palettes
db map_keep_roam
-MapSetupScript1: ; 15392
+MapSetupScript_Warp: ; 15392
db map_lcd_off
db map_sound_off
db map_load_spawn
@@ -63,7 +63,7 @@
db map_wildmons
db map_end_setup_script
-MapSetupScript11: ; 153a9
+MapSetupScript_BadWarp: ; 153a9
db map_load_spawn
db map_attributes
db map_change_callback
@@ -87,7 +87,7 @@
db map_wildmons
db map_end_setup_script
-MapSetupScript7: ; 153bf
+MapSetupScript_Connection: ; 153bf
db map_animations_off
db map_load_connection
db map_attributes
@@ -106,13 +106,13 @@
db map_animations_on
db map_end_setup_script
-MapSetupScript6: ; 153d0
+MapSetupScript_Fall: ; 153d0
db map_prolong_sprites
-MapSetupScript5: ; 153d1
+MapSetupScript_Door: ; 153d1
db map_fade_out_palettes
-MapSetupScript9: ; 153d2
+MapSetupScript_Train: ; 153d2
db map_load_warp
db map_attributes
db map_warp_face
@@ -135,7 +135,7 @@
db map_update_roam
db map_end_setup_script
-MapSetupScript3: ; 153e7
+MapSetupScript_ReloadMap: ; 153e7
db map_fade
db map_clear_bg_palettes
db map_lcd_off
@@ -153,7 +153,7 @@
db map_wildmons
db map_end_setup_script
-MapSetupScript8: ; 153f7
+MapSetupScript_LinkReturn: ; 153f7
db map_fade
db map_lcd_off
db map_sound_off
@@ -172,7 +172,7 @@
db map_text_scroll_off
db map_end_setup_script
-MapSetupScript2: ; 15408
+MapSetupScript_Continue: ; 15408
db map_lcd_off
db map_sound_off
db map_attributes_2
@@ -192,7 +192,7 @@
db map_wildmons
db map_end_setup_script
-MapSetupScript10: ; 1541a
+MapSetupScript_Submenu: ; 1541a
db map_load_blocks
db map_connection_blocks
db map_end_setup_script
@@ -245,7 +245,7 @@
MapSetupCommands: ; 15440
dba EnableLCD ; 00
dba DisableLCD ; 01
- dba SoundRestart ; 02
+ dba MapSetup_Sound_Off ; 02
dba PlayMapMusic ; 03
dba RestartMapMusic ; 04
dba FadeToMapMusic ; 05
@@ -271,9 +271,9 @@
dba LoadWarpData ; 19
dba LoadMapAttributes ; 1a
dba LoadMapAttributes_IgnoreHidden ; 1b
- dba WhiteBGMap ; 1c
- dba FadeBlackBGMap ; 1d
- dba FadeInBGMap ; 1e
+ dba ClearBGPalettes ; 1c
+ dba FadeOutPalettes ; 1d
+ dba FadeInPalettes ; 1e
dba GetCoordOfUpperLeftCorner ; 1f
dba RestoreFacingAfterWarp ; 20
dba SpawnInFacingDown ; 21
--- a/engine/movement.asm
+++ b/engine/movement.asm
@@ -61,19 +61,19 @@
dw Movement_fix_facing ; 3b
dw Movement_3c ; 3c
dw Movement_hide_person ; 3d
- dw Movement_show_person ; 3e
- dw Movement_3f ; 3f
- dw Movement_40 ; 40
- dw Movement_41 ; 41
- dw Movement_42 ; 42
- dw Movement_43 ; 43
- dw Movement_44 ; 44
- dw Movement_accelerate_last ; 45
+ dw Movement_step_sleep_1 ; 3e
+ dw Movement_step_sleep_2 ; 3f
+ dw Movement_step_sleep_3 ; 40
+ dw Movement_step_sleep_4 ; 41
+ dw Movement_step_sleep_5 ; 42
+ dw Movement_step_sleep_6 ; 43
+ dw Movement_step_sleep_7 ; 44
+ dw Movement_step_sleep_8 ; 45
dw Movement_step_sleep ; 46
dw Movement_step_end ; 47
dw Movement_48 ; 48
dw Movement_remove_person ; 49
- dw Movement_4a ; 4a
+ dw Movement_step_loop ; 4a
dw Movement_4b ; 4b
dw Movement_teleport_from ; 4c
dw Movement_teleport_to ; 4d
@@ -80,13 +80,13 @@
dw Movement_skyfall ; 4e
dw Movement_step_wait5 ; 4f
dw Movement_50 ; 50
- dw Movement_51 ; 51
- dw Movement_52 ; 52
+ dw Movement_fish_got_bite ; 51
+ dw Movement_fish_cast_rod ; 52
dw Movement_hide_emote ; 53
dw Movement_show_emote ; 54
dw Movement_step_shake ; 55
dw Movement_56 ; 56
- dw Movement_57 ; 57
+ dw Movement_rock_smash ; 57
dw Movement_58 ; 58
dw Movement_59 ; 59
; 5129
@@ -139,7 +139,7 @@
ld [hl], $3
ld hl, OBJECT_DIRECTION_WALKING
add hl, bc
- ld [hl], $ff
+ ld [hl], STANDING
ret
; 516a
@@ -156,7 +156,7 @@
ld [hl], a
ld hl, OBJECT_DIRECTION_WALKING
add hl, bc
- ld [hl], $ff
+ ld [hl], STANDING
ld hl, OBJECT_09
add hl, bc
ld [hl], $12
@@ -163,7 +163,7 @@
ret
; 5189
-Movement_51: ; 5189
+Movement_fish_got_bite: ; 5189
ld hl, OBJECT_11
add hl, bc
ld [hl], $6
@@ -173,7 +173,7 @@
ret
; 5196
-Movement_57: ; 5196
+Movement_rock_smash: ; 5196
call GetMovementByte
ld hl, OBJECT_STEP_DURATION
add hl, bc
@@ -187,7 +187,7 @@
ret
; 51ab
-Movement_52: ; 51ab
+Movement_fish_cast_rod: ; 51ab
ld hl, OBJECT_11
add hl, bc
ld [hl], $6
@@ -197,11 +197,11 @@
ret
; 51b8
-Movement_4a: ; 51b8
- ld hl, OBJECT_27
+Movement_step_loop: ; 51b8
+ ld hl, OBJECT_MOVEMENT_BYTE_INDEX
add hl, bc
ld [hl], $0
- jp Function5065
+ jp ContinueReadingMovement
; 51c1
Movement_step_end: ; 51c1
@@ -209,11 +209,14 @@
ld hl, OBJECT_MOVEMENTTYPE
add hl, bc
ld [hl], a
- ld hl, OBJECT_27
+
+ ld hl, OBJECT_MOVEMENT_BYTE_INDEX
add hl, bc
ld [hl], $0
+
ld hl, VramState
res 7, [hl]
+
ld hl, OBJECT_09
add hl, bc
ld [hl], $1
@@ -225,16 +228,20 @@
ld hl, OBJECT_MOVEMENTTYPE
add hl, bc
ld [hl], a
- ld hl, OBJECT_27
+
+ ld hl, OBJECT_MOVEMENT_BYTE_INDEX
add hl, bc
ld [hl], $0
+
call GetMovementByte
ld hl, OBJECT_STEP_DURATION
add hl, bc
ld [hl], a
+
ld hl, OBJECT_09
add hl, bc
ld [hl], $3
+
ld hl, VramState
res 7, [hl]
ret
@@ -245,10 +252,10 @@
ld hl, wObjectFollow_Leader
ld a, [hMapObjectIndexBuffer]
cp [hl]
- jr nz, .asm_520a
- ld [hl], $ff
+ jr nz, .not_leading
+ ld [hl], -1
-.asm_520a
+.not_leading
ld hl, VramState
res 7, [hl]
ret
@@ -258,43 +265,45 @@
ld hl, OBJECT_11
add hl, bc
ld [hl], $1
+
ld hl, OBJECT_09
add hl, bc
ld [hl], $4
+
ld hl, VramState
res 7, [hl]
ret
; 5222
-Movement_show_person: ; 5222
+Movement_step_sleep_1: ; 5222
ld a, $1
jr Function5247
-Movement_3f: ; 5226
+Movement_step_sleep_2: ; 5226
ld a, $2
jr Function5247
-Movement_40: ; 522a
+Movement_step_sleep_3: ; 522a
ld a, $3
jr Function5247
-Movement_41: ; 522e
+Movement_step_sleep_4: ; 522e
ld a, $4
jr Function5247
-Movement_42: ; 5232
+Movement_step_sleep_5: ; 5232
ld a, $5
jr Function5247
-Movement_43: ; 5236
+Movement_step_sleep_6: ; 5236
ld a, $6
jr Function5247
-Movement_44: ; 523a
+Movement_step_sleep_7: ; 523a
ld a, $7
jr Function5247
-Movement_accelerate_last: ; 523e
+Movement_step_sleep_8: ; 523e
ld a, $8
jr Function5247
@@ -309,15 +318,18 @@
ld hl, OBJECT_STEP_DURATION
add hl, bc
ld [hl], a
+
ld hl, OBJECT_09
add hl, bc
ld [hl], $3
+
ld hl, OBJECT_11
add hl, bc
ld [hl], $1
+
ld hl, OBJECT_DIRECTION_WALKING
add hl, bc
- ld [hl], $ff
+ ld [hl], STANDING
ret
; 525f
@@ -334,7 +346,7 @@
ld [hl], $3
ld hl, OBJECT_DIRECTION_WALKING
add hl, bc
- ld [hl], $ff
+ ld [hl], STANDING
ret
; 5279
@@ -351,7 +363,7 @@
ld [hl], $b
ld hl, OBJECT_DIRECTION_WALKING
add hl, bc
- ld [hl], $ff
+ ld [hl], STANDING
ret
; 5293
@@ -359,7 +371,7 @@
ld hl, OBJECT_FLAGS1
add hl, bc
res 3, [hl]
- jp Function5065
+ jp ContinueReadingMovement
; 529c
Movement_39: ; 529c
@@ -366,7 +378,7 @@
ld hl, OBJECT_FLAGS1
add hl, bc
set 3, [hl]
- jp Function5065
+ jp ContinueReadingMovement
; 52a5
Movement_remove_fixed_facing: ; 52a5
@@ -373,7 +385,7 @@
ld hl, OBJECT_FLAGS1
add hl, bc
res 2, [hl]
- jp Function5065
+ jp ContinueReadingMovement
; 52ae
Movement_fix_facing: ; 52ae
@@ -380,7 +392,7 @@
ld hl, OBJECT_FLAGS1
add hl, bc
set 2, [hl]
- jp Function5065
+ jp ContinueReadingMovement
; 52b7
Movement_3c: ; 52b7
@@ -387,7 +399,7 @@
ld hl, OBJECT_FLAGS1
add hl, bc
res 0, [hl]
- jp Function5065
+ jp ContinueReadingMovement
; 52c0
Movement_hide_person: ; 52c0
@@ -394,17 +406,17 @@
ld hl, OBJECT_FLAGS1
add hl, bc
set 0, [hl]
- jp Function5065
+ jp ContinueReadingMovement
; 52c9
Movement_hide_emote: ; 52c9
call Function5579
- jp Function5065
+ jp ContinueReadingMovement
; 52cf
Movement_show_emote: ; 52cf
call Function5547
- jp Function5065
+ jp ContinueReadingMovement
; 52d5
Movement_step_shake: ; 52d5
@@ -413,7 +425,7 @@
call GetMovementByte
call Function5565
- jp Function5065
+ jp ContinueReadingMovement
; 52de
Movement_turn_head_down: ; 52de
@@ -441,7 +453,7 @@
ld [hl], $1
ld hl, OBJECT_DIRECTION_WALKING
add hl, bc
- ld [hl], $ff
+ ld [hl], STANDING
ret
; 5300
--- a/engine/namingscreen.asm
+++ b/engine/namingscreen.asm
@@ -40,7 +40,7 @@
; 116f8
Function116f8: ; 116f8
- call WhiteBGMap
+ call ClearBGPalettes
ld b, $8
call GetSGBLayout
call DisableLCD
--- a/engine/pack.asm
+++ b/engine/pack.asm
@@ -594,7 +594,7 @@
ld [Options], a
ld a, $8
ld [PartyMenuActionText], a
- call WhiteBGMap
+ call ClearBGPalettes
callba Function5004f
callba Function50405
callba Function503e0
@@ -922,7 +922,7 @@
ret
.asm_1066c: ; 1066c (4:466c)
- call WhiteBGMap
+ call ClearBGPalettes
jr .asm_1067e
.BattleOnly: ; 10671 (4:4671)
@@ -1401,7 +1401,7 @@
Function10955: ; 10955
- call WhiteBGMap
+ call ClearBGPalettes
call ClearTileMap
call ClearSprites
call DisableLCD
--- a/engine/party_menu.asm
+++ b/engine/party_menu.asm
@@ -2,10 +2,10 @@
call DisableSpriteUpdates
xor a
ld [PartyMenuActionText], a
- call WhiteBGMap
+ call ClearBGPalettes
call Function5003f
call WaitBGMap
- call Function32f9
+ call SetPalettes
call DelayFrame
call PartyMenuSelect
call Function2b74
@@ -17,12 +17,12 @@
ld a, b
ld [PartyMenuActionText], a
call DisableSpriteUpdates
- call WhiteBGMap
+ call ClearBGPalettes
call Function5003f
call WaitBGMap
ld b, $a
call GetSGBLayout
- call Function32f9
+ call SetPalettes
call DelayFrame
call PartyMenuSelect
call Function2b74
@@ -57,43 +57,42 @@
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
ld a, " "
call ByteFill ; blank the tilemap
- call Function50396 ; This reads from a pointer table???
+ call GetPartyMenuTilemapPointers ; This reads from a pointer table???
.loop
ld a, [hli]
- cp -1
- jr z, .asm_50084 ; 0x5007a $8
+ cp $ff
+ jr z, .end ; 0x5007a $8
push hl
- ld hl, .jumptable
+ ld hl, .Jumptable
rst JumpTable
pop hl
jr .loop ; 0x50082 $f3
-
-.asm_50084
+.end
pop af
ld [Options], a
ret
; 0x50089
-.jumptable: ; 50089
- dw .displaynicks ; 0
- dw .drawhpbars ; 1
- dw Function50138 ; 2
- dw Function50176 ; 3
- dw Function501b2 ; 4
- dw Function501e0 ; 5
- dw Function5022f ; 6
- dw Function502b1 ; 7
- dw Function50307 ; 8
+.Jumptable: ; 50089
+ dw PlacePartyNicknames
+ dw PlacePartyHPBar
+ dw PlacePartyMenuHPDigits
+ dw PlacePartyMonLevel
+ dw PlacePartyMonStatus
+ dw PlacePartyMonTMHMCompatibility
+ dw PlacePartyMonEvoStoneCompatibility
+ dw PlacePartyMonGender
+ dw PlacePartyMonMobileBattleSelection
; 5009b
-.displaynicks: ; 5009b
+PlacePartyNicknames: ; 5009b
hlcoord 3, 1
ld a, [PartyCount]
and a
- jr z, .done
+ jr z, .end
ld c, a
ld b, $0
-.loop2
+.loop
push bc
push hl
push hl
@@ -103,28 +102,28 @@
pop hl
call PlaceString
pop hl
- ld de, $0028
+ ld de, 2 * SCREEN_WIDTH
add hl, de
pop bc
inc b
dec c
- jr nz, .loop2
+ jr nz, .loop
-.done
+.end
rept 2
dec hl
endr
- ld de, .cancelstring
+ ld de, .CANCEL
call PlaceString
ret
; 500c8
-.cancelstring: ; 500c8
+.CANCEL: ; 500c8
db "CANCEL@"
; 500cf
-.drawhpbars: ; 500cf
+PlacePartyHPBar: ; 500cf
xor a
ld [wcda9], a
ld a, [PartyCount]
@@ -133,17 +132,17 @@
ld c, a
ld b, $0
hlcoord 11, 2
-.loop3
+.loop
push bc
push hl
- call Function50389
+ call PartyMenuCheckEgg
jr z, .skip
push hl
- call _fillhpbar
+ call PlacePartymonHPBar
pop hl
- ld d, 6
- ld b, 0
- call DrawHPBar
+ ld d, $6
+ ld b, $0
+ call DrawBattleHPBar
ld hl, wcd9b
ld a, [wcda9]
ld c, a
@@ -157,31 +156,31 @@
ld hl, wcda9
inc [hl]
pop hl
- ld de, $0028
+ ld de, 2 * SCREEN_WIDTH
add hl, de
pop bc
inc b
dec c
- jr nz, .loop3
+ jr nz, .loop
ld b, $a
call GetSGBLayout
ret
; 50117
-_fillhpbar: ; 50117
+PlacePartymonHPBar: ; 50117
ld a, b
- ld bc, PartyMon2 - PartyMon1
+ ld bc, PARTYMON_STRUCT_LENGTH
ld hl, PartyMon1HP
call AddNTimes
ld a, [hli]
or [hl]
- jr nz, .notfainted
+ jr nz, .not_fainted
xor a
ld e, a
ld c, a
ret
-.notfainted
+.not_fainted
dec hl
ld a, [hli]
ld b, a
@@ -191,11 +190,11 @@
ld d, a
ld a, [hli]
ld e, a
- predef ComputeHPBarLength
+ predef DrawPartyMenuHPBar
ret
; 50138
-Function50138: ; 50138
+PlacePartyMenuHPDigits: ; 50138
ld a, [PartyCount]
and a
ret z
@@ -202,14 +201,14 @@
ld c, a
ld b, $0
hlcoord 13, 1
-.asm_50143
+.loop
push bc
push hl
- call Function50389
- jr z, .asm_5016b
+ call PartyMenuCheckEgg
+ jr z, .next
push hl
ld a, b
- ld bc, PartyMon2 - PartyMon1
+ ld bc, PARTYMON_STRUCT_LENGTH
ld hl, PartyMon1HP
call AddNTimes
ld e, l
@@ -219,7 +218,7 @@
lb bc, 2, 3
call PrintNum
pop de
- ld a, $f3
+ ld a, "/"
ld [hli], a
rept 2
inc de
@@ -227,18 +226,18 @@
lb bc, 2, 3
call PrintNum
-.asm_5016b
+.next
pop hl
- ld de, $0028
+ ld de, 2 * SCREEN_WIDTH
add hl, de
pop bc
inc b
dec c
- jr nz, .asm_50143
+ jr nz, .loop
ret
; 50176
-Function50176: ; 50176
+PlacePartyMonLevel: ; 50176
ld a, [PartyCount]
and a
ret z
@@ -245,14 +244,14 @@
ld c, a
ld b, 0
hlcoord 8, 2
-.asm_50181
+.loop
push bc
push hl
- call Function50389
- jr z, .asm_501a7
+ call PartyMenuCheckEgg
+ jr z, .next
push hl
ld a, b
- ld bc, PartyMon2 - PartyMon1
+ ld bc, PARTYMON_STRUCT_LENGTH
ld hl, PartyMon1Level
call AddNTimes
ld e, l
@@ -260,15 +259,17 @@
pop hl
ld a, [de]
cp 100 ; This is distinct from MAX_LEVEL.
- jr nc, .asm_501a1
+ jr nc, .ThreeDigits
ld a, "<LV>"
ld [hli], a
- ld bc, $4102
-.asm_501a1
+ lb bc, PRINTNUM_RIGHTALIGN | 1, 2
+ ; jr .okay
+.ThreeDigits
lb bc, PRINTNUM_RIGHTALIGN | 1, 3
+; .okay
call PrintNum
-.asm_501a7
+.next
pop hl
ld de, SCREEN_WIDTH * 2
add hl, de
@@ -275,11 +276,11 @@
pop bc
inc b
dec c
- jr nz, .asm_50181
+ jr nz, .loop
ret
; 501b2
-Function501b2: ; 501b2
+PlacePartyMonStatus: ; 501b2
ld a, [PartyCount]
and a
ret z
@@ -286,22 +287,22 @@
ld c, a
ld b, 0
hlcoord 5, 2
-.asm_501bd
+.loop
push bc
push hl
- call Function50389
- jr z, .asm_501d5
+ call PartyMenuCheckEgg
+ jr z, .next
push hl
ld a, b
- ld bc, PartyMon2 - PartyMon1
+ ld bc, PARTYMON_STRUCT_LENGTH
ld hl, PartyMon1Status
call AddNTimes
ld e, l
ld d, h
pop hl
- call Function50d0a
+ call PlaceStatusString
-.asm_501d5
+.next
pop hl
ld de, SCREEN_WIDTH * 2
add hl, de
@@ -308,11 +309,11 @@
pop bc
inc b
dec c
- jr nz, .asm_501bd
+ jr nz, .loop
ret
; 501e0
-Function501e0: ; 501e0
+PlacePartyMonTMHMCompatibility: ; 501e0
ld a, [PartyCount]
and a
ret z
@@ -319,11 +320,11 @@
ld c, a
ld b, 0
hlcoord 12, 2
-.asm_501eb
+.loop
push bc
push hl
- call Function50389
- jr z, .asm_5020a
+ call PartyMenuCheckEgg
+ jr z, .next
push hl
ld hl, PartySpecies
ld e, b
@@ -333,10 +334,10 @@
ld [CurPartySpecies], a
predef CanLearnTMHMMove
pop hl
- call Function50215
+ call .PlaceAbleNotAble
call PlaceString
-.asm_5020a
+.next
pop hl
ld de, SCREEN_WIDTH * 2
add hl, de
@@ -343,32 +344,32 @@
pop bc
inc b
dec c
- jr nz, .asm_501eb
+ jr nz, .loop
ret
; 50215
-Function50215: ; 50215
+.PlaceAbleNotAble: ; 50215
ld a, c
and a
- jr nz, .asm_5021d
- ld de, String_50226
+ jr nz, .able
+ ld de, .string_not_able
ret
-.asm_5021d
- ld de, String_50221
+.able
+ ld de, .string_able
ret
; 50221
-String_50221: ; 50221
+.string_able: ; 50221
db "ABLE@"
; 50226
-String_50226: ; 50226
+.string_not_able: ; 50226
db "NOT ABLE@"
; 5022f
-Function5022f: ; 5022f
+PlacePartyMonEvoStoneCompatibility: ; 5022f
ld a, [PartyCount]
and a
ret z
@@ -375,14 +376,14 @@
ld c, a
ld b, 0
hlcoord 12, 2
-.asm_5023a
+.loop
push bc
push hl
- call Function50389
- jr z, .asm_5025d
+ call PartyMenuCheckEgg
+ jr z, .next
push hl
ld a, b
- ld bc, PartyMon2 - PartyMon1
+ ld bc, PARTYMON_STRUCT_LENGTH
ld hl, PartyMon1Species
call AddNTimes
ld a, [hl]
@@ -393,22 +394,22 @@
rept 2
add hl, de
endr
- call Function50268
+ call .DetermineCompatibility
pop hl
call PlaceString
-.asm_5025d
+.next
pop hl
- ld de, $0028
+ ld de, 2 * SCREEN_WIDTH
add hl, de
pop bc
inc b
dec c
- jr nz, .asm_5023a
+ jr nz, .loop
ret
; 50268
-Function50268: ; 50268
+.DetermineCompatibility: ; 50268
ld de, StringBuffer1
ld a, BANK(EvosAttacksPointers)
ld bc, 2
@@ -422,15 +423,15 @@
ld bc, $a
call FarCopyBytes
ld hl, StringBuffer1
-.asm_50287
+.loop2
ld a, [hli]
and a
- jr z, .asm_5029f
+ jr z, .nope
rept 2
inc hl
endr
cp EVOLVE_ITEM
- jr nz, .asm_50287
+ jr nz, .loop2
rept 2
dec hl
endr
@@ -439,24 +440,24 @@
rept 2
inc hl
endr
- jr nz, .asm_50287
- ld de, String_502a3
+ jr nz, .loop2
+ ld de, .string_able
ret
-.asm_5029f
- ld de, String_502a8
+.nope
+ ld de, .string_not_able
ret
; 502a3
-String_502a3: ; 502a3
+.string_able: ; 502a3
db "ABLE@"
; 502a8
-String_502a8: ; 502a8
+.string_not_able: ; 502a8
db "NOT ABLE@"
; 502b1
-Function502b1: ; 502b1
+PlacePartyMonGender: ; 502b1
ld a, [PartyCount]
and a
ret z
@@ -463,11 +464,11 @@
ld c, a
ld b, 0
hlcoord 12, 2
-.asm_502bc
+.loop
push bc
push hl
- call Function50389
- jr z, .asm_502e3
+ call PartyMenuCheckEgg
+ jr z, .next
ld [CurPartySpecies], a
push hl
ld a, b
@@ -475,41 +476,41 @@
xor a
ld [MonType], a
call GetGender
- ld de, String_502fe
- jr c, .asm_502df
- ld de, String_502ee
- jr nz, .asm_502df
- ld de, String_502f5
+ ld de, .unknown
+ jr c, .got_gender
+ ld de, .male
+ jr nz, .got_gender
+ ld de, .female
-.asm_502df
+.got_gender
pop hl
call PlaceString
-.asm_502e3
+.next
pop hl
- ld de, $0028
+ ld de, 2 * SCREEN_WIDTH
add hl, de
pop bc
inc b
dec c
- jr nz, .asm_502bc
+ jr nz, .loop
ret
; 502ee
-String_502ee: ; 502ee
+.male: ; 502ee
db "♂…MALE@"
; 502f5
-String_502f5: ; 502f5
+.female: ; 502f5
db "♀…FEMALE@"
; 502fe
-String_502fe: ; 502fe
+.unknown: ; 502fe
db "…UNKNOWN@"
; 50307
-Function50307: ; 50307
+PlacePartyMonMobileBattleSelection: ; 50307
ld a, [PartyCount]
and a
ret z
@@ -516,45 +517,45 @@
ld c, a
ld b, 0
hlcoord 12, 1
-.asm_50312
+.loop
push bc
push hl
- ld de, String_50372
+ ld de, .String_Sanka_Shinai
call PlaceString
pop hl
- ld de, $0028
+ ld de, 2 * SCREEN_WIDTH
add hl, de
pop bc
inc b
dec c
- jr nz, .asm_50312
+ jr nz, .loop
ld a, l
- ld e, $b
+ ld e, PKMN_NAME_LENGTH
sub e
ld l, a
ld a, h
sbc $0
ld h, a
- ld de, String_50379
+ ld de, .String_Kettei_Yameru
call PlaceString
ld b, $3
ld c, $0
ld hl, wd002
ld a, [hl]
-.asm_5033b
+.loop2
push hl
push bc
hlcoord 12, 1
-.asm_50340
+.loop3
and a
- jr z, .asm_5034a
- ld de, $0028
+ jr z, .done
+ ld de, 2 * SCREEN_WIDTH
add hl, de
dec a
- jr .asm_50340
+ jr .loop3
-.asm_5034a
- ld de, String_5036b
+.done
+ ld de, .String_Banme
push hl
call PlaceString
pop hl
@@ -562,7 +563,7 @@
push bc
push hl
ld a, c
- ld hl, Strings_50383
+ ld hl, .Strings_1_2_3
call GetNthString
ld d, h
ld e, l
@@ -575,24 +576,24 @@
inc c
dec b
ret z
- jr .asm_5033b
+ jr .loop2
; 5036b
-String_5036b: ; 5036b
+.String_Banme: ; 5036b
db " ばんめ @" ; Place
; 50372
-String_50372: ; 50372
+.String_Sanka_Shinai: ; 50372
db "さんかしない@" ; Cancel
; 50379
-String_50379: ; 50379
+.String_Kettei_Yameru: ; 50379
db "けってい やめる@" ; Quit
; 50383
-Strings_50383: ; 50383
+.Strings_1_2_3: ; 50383
db "1@", "2@", "3@" ; 1st, 2nd, 3rd
; 50389
-Function50389: ; 50389
+PartyMenuCheckEgg: ; 50389
ld a, PartySpecies % $100
add b
ld e, a
@@ -604,15 +605,15 @@
ret
; 50396
-Function50396: ; 50396
+GetPartyMenuTilemapPointers: ; 50396
ld a, [PartyMenuActionText]
and $f0
- jr nz, .override
+ jr nz, .skip
ld a, [PartyMenuActionText]
and $f
ld e, a
ld d, 0
- ld hl, .selectmonmenuoptions
+ ld hl, .Pointers
rept 2
add hl, de
endr
@@ -621,31 +622,32 @@
ld l, a
ret
-.override
- ld hl, .default
+.skip
+ ld hl, .Default
ret
; 503b2
-.selectmonmenuoptions: ; 503b2
- dw .default
- dw .default
- dw .default
- dw .unknown1
- dw .default
- dw .unknown2
- dw .trade
- dw .trade
- dw .default
- dw .unknown3
+.Pointers: ; 503b2
+ dw .Default
+ dw .Default
+ dw .Default
+ dw .TMHM
+ dw .Default
+ dw .EvoStone
+ dw .Gender
+ dw .Gender
+ dw .Default
+ dw .Mobile
; 503c6
-.default: db 0, 1, 2, 3, 4, -1
-.unknown1: db 0, 5, 3, 4, -1
-.unknown2: db 0, 6, 3, 4, -1
-.trade: db 0, 7, 3, 4, -1
-.unknown3: db 0, 8, 3, 4, -1
+.Default: db 0, 1, 2, 3, 4, $ff
+.TMHM: db 0, 5, 3, 4, $ff
+.EvoStone: db 0, 6, 3, 4, $ff
+.Gender: db 0, 7, 3, 4, $ff
+.Mobile: db 0, 8, 3, 4, $ff
; 503e0
+
Function503e0: ; 503e0
ld hl, PartyCount
ld a, [hli]
@@ -653,7 +655,7 @@
ret z
ld c, a
xor a
- ld [hConnectedMapWidth], a
+ ld [hObjectStructIndexBuffer], a
.asm_503ea
push bc
push hl
@@ -661,9 +663,9 @@
ld a, BANK(Function8e83f)
ld e, $0
rst FarCall
- ld a, [hConnectedMapWidth]
+ ld a, [hObjectStructIndexBuffer]
inc a
- ld [hConnectedMapWidth], a
+ ld [hObjectStructIndexBuffer], a
pop hl
pop bc
dec c
@@ -671,6 +673,7 @@
callab Function8cf69
ret
; 50405
+
Function50405: ; 50405
xor a
ld [wd0e3], a
@@ -692,7 +695,7 @@
ld a, $1
.asm_50424
- ld [wcfa9], a
+ ld [MenuSelection2], a
ld a, $3
ld [wcfa8], a
ret
@@ -713,7 +716,7 @@
.asm_50444
ld a, $1
.asm_50446
- ld [wcfa9], a
+ ld [MenuSelection2], a
ld a, $3
ld [wcfa8], a
ret
@@ -738,7 +741,7 @@
ld a, [PartyCount]
inc a
ld b, a
- ld a, [wcfa9] ; menu selection?
+ ld a, [MenuSelection2] ; menu selection?
cp b
jr z, .exitmenu ; CANCEL
ld [wd0d8], a
@@ -746,7 +749,7 @@
ld b, a
bit 1, b
jr nz, .exitmenu ; B button?
- ld a, [wcfa9]
+ ld a, [MenuSelection2]
dec a
ld [CurPartyMon], a
ld c, a
@@ -773,7 +776,7 @@
PrintPartyMenuText: ; 5049a
hlcoord 0, 14
- ld bc, $0212
+ lb bc, 2, 18
call TextBox
ld a, [PartyCount]
and a
@@ -919,6 +922,7 @@
text_jump UnknownText_0x1bc16e
db "@"
; 0x505c1
+
Function505c1: ; 505c1
ld e, a
--- a/engine/pokedex.asm
+++ b/engine/pokedex.asm
@@ -60,7 +60,7 @@
; 40063
InitPokedex: ; 40063
- call WhiteBGMap
+ call ClearBGPalettes
call ClearSprites
call ClearTileMap
call Function414b7
@@ -487,7 +487,7 @@
ld [wcf64], a
pop af
ld [wcf65], a
- call WhiteBGMap
+ call ClearBGPalettes
call DisableLCD
call Function414fb
call Function4038d
--- a/engine/scripting.asm
+++ b/engine/scripting.asm
@@ -1079,9 +1079,11 @@
ld a, c
callba SetFlagsForMovement_1
pop bc
+
push bc
call SetFlagsForMovement_2
pop bc
+
call GetScriptByte
ld l, a
call GetScriptByte
@@ -1090,6 +1092,7 @@
ld b, a
call GetMovementData
ret c
+
ld a, SCRIPT_WAIT_MOVEMENT
ld [ScriptMode], a
call StopScript
@@ -1102,6 +1105,7 @@
; 0x97228
Script_applymovement2: ; 0x97228
+; apply movement to last talked
; script command 0x6a
; parameters:
; data (MovementPointerLabelParam)
@@ -1426,12 +1430,12 @@
.Show
show_emote
- show_person
+ step_sleep_1
step_end
.Hide
hide_emote
- show_person
+ step_sleep_1
step_end
; 973c7
@@ -1460,8 +1464,8 @@
; 973eb
EarthquakeMovement: ; 973eb
- step_shake 16
- step_sleep 16
+ step_shake 16 ; the 16 gets overwritten with the script byte
+ step_sleep 16 ; the 16 gets overwritten with the lower 6 bits of the script byte
step_end
EarthquakeMovementEnd
; 973f0
@@ -2847,6 +2851,7 @@
call LoadMapStatus
call StopScript
ret
+
.not_ok
call GetScriptByte
call GetScriptByte
@@ -3117,6 +3122,7 @@
call ExitScriptSubroutine
jr c, .resume
ret
+
.resume
xor a
ld [ScriptRunning], a
--- /dev/null
+++ b/engine/slot_machine.asm
@@ -1,0 +1,2112 @@
+_SlotMachine:
+ ld hl, Options
+ set 4, [hl]
+ call Function926f7
+ call DelayFrame
+.asm_926d2
+ call Function927af
+ jr nc, .asm_926d2
+ call WaitSFX
+ ld de, SFX_QUIT_SLOTS
+ call PlaySFX
+ call WaitSFX
+ call ClearBGPalettes
+ callba MobileFn_105fd0
+ ld hl, Options
+ res 4, [hl]
+ ld hl, rLCDC ; $ff40
+ res 2, [hl]
+ ret
+
+Function926f7: ; 926f7 (24:66f7)
+ call ClearBGPalettes
+ call ClearTileMap
+ call ClearSprites
+ ld de, MUSIC_NONE
+ call PlayMusic
+ call DelayFrame
+ call DisableLCD
+ ld hl, VBGMap0 tile $00
+ lb bc, 4, 0
+ ld a, $7f
+ call ByteFill
+ ld b, $5
+ call GetSGBLayout
+ callab Function8cf53
+ ld hl, wc6d0
+ ld bc, $48
+ xor a
+ call ByteFill
+ ld hl, Slots2LZ
+ ld de, VTiles0 tile $00
+ call Decompress
+ ld hl, Slots3LZ
+ ld de, VTiles0 tile $40
+ call Decompress
+ ld hl, Slots1LZ
+ ld de, VTiles2 tile $00
+ call Decompress
+ ld hl, Slots2LZ
+ ld de, VTiles2 tile $25
+ call Decompress
+ ld hl, SlotsTilemap
+ decoord 0, 0
+ ld bc, 20 * 12
+ call CopyBytes
+ ld hl, rLCDC ; $ff40
+ set 2, [hl]
+ call EnableLCD
+ ld hl, wc6d0
+ ld bc, $64
+ xor a
+ call ByteFill
+ call Function92a98
+ call Function9279b
+ ld a, $7
+ ld hl, wc300
+ ld [hli], a
+ ld [hl], $40
+ xor a
+ ld [wJumptableIndex], a
+ ld a, $ff
+ ld [wc709], a
+ ld de, MUSIC_GAME_CORNER
+ call PlayMusic
+ xor a
+ ld [wd002], a
+ call Random
+ and $2a
+ ret nz
+ ld a, $1
+ ld [wd002], a
+ ret
+
+Function9279b: ; 9279b (24:679b)
+ ld a, $e4
+ call DmgToCgbBGPals
+ lb de, $e4, $e4
+ ld a, [hCGB]
+ and a
+ jr nz, .asm_927ab
+ lb de, $c0, $e4
+.asm_927ab
+ call DmgToCgbObjPals
+ ret
+
+Function927af: ; 927af (24:67af)
+ ld a, [wJumptableIndex]
+ bit 7, a
+ jr nz, .asm_927d1
+ call Function92844
+ call Function92b0f
+ xor a
+ ld [wc3b5], a
+ callab Function8cfa8
+ call Function927f8
+ call Function927d3
+ call DelayFrame
+ and a
+ ret
+.asm_927d1
+ scf
+ ret
+
+Function927d3: ; 927d3 (24:67d3)
+ ret
+; 927d4 (24:67d4)
+
+Function927d4: ; 927d4
+ ld a, [wc6d0]
+ and a
+ ret nz
+ ld a, [wc6e0]
+ and a
+ ret nz
+ ld a, [wc70c]
+ and a
+ jr nz, .asm_927ea
+ ld a, $e4
+ call DmgToCgbBGPals
+ ret
+
+.asm_927ea
+ ld a, [TextDelayFrames]
+ and $7
+ ret nz
+ ld a, [rBGP]
+ xor %1100
+ call DmgToCgbBGPals
+ ret
+; 927f8
+
+Function927f8: ; 927f8 (24:67f8)
+ hlcoord 5, 1
+ ld de, Coins
+ lb bc, PRINTNUM_LEADINGZEROS | 2, 4
+ call PrintNum
+ hlcoord 11, 1
+ ld de, wc711
+ lb bc, PRINTNUM_LEADINGZEROS | 2, 4
+ call PrintNum
+ ret
+; 92811 (24:6811)
+
+Function92811: ; 92811
+ ld a, [wc709]
+ add 0
+ daa
+ ld e, a
+ and $f
+ add "0"
+ hlcoord 1, 0
+ ld [hl], a
+ ld a, e
+ swap a
+ and $f
+ add "0"
+ hlcoord 0, 0
+ ld [hl], a
+ ret
+; 9282c
+
+Function9282c: ; 9282c
+ ld hl, wcf66
+ ld a, [hl]
+ inc [hl]
+ and $7
+ ret nz
+ ld hl, Sprites + $42
+ ld c, $18
+.asm_92839
+ ld a, [hl]
+ xor $20
+ ld [hli], a
+rept 3
+ inc hl
+endr
+ dec c
+ jr nz, .asm_92839
+ ret
+; 92844
+
+Function92844: ; 92844 (24:6844)
+ ld a, [wJumptableIndex]
+ ld e, a
+ ld d, 0
+ ld hl, Jumptable_92853
+rept 2
+ add hl, de
+endr
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ jp [hl]
+; 92853 (24:6853)
+
+
+Jumptable_92853: ; 92853 (24:6853)
+ dw Function9287e
+ dw Function9288e
+ dw Function928c6
+ dw Function928d6
+ dw Function928e6
+ dw Function92900
+ dw Function92910
+ dw Function9292a
+ dw Function9293a
+ dw Function92879
+ dw Function92879
+ dw Function92879
+ dw Function92955
+ dw Function9296b
+ dw Function92987
+ dw Function9299e
+ dw Function929a4
+ dw Function929d9
+ dw Function929f0
+
+
+Function92879: ; 92879 (24:6879)
+ ld hl, wJumptableIndex
+ inc [hl]
+ ret
+
+Function9287e: ; 9287e (24:687e)
+ call Function92879
+ xor a
+ ld [wc70b], a
+ ld [wc70c], a
+ ld a, $ff
+ ld [wc70d], a
+ ret
+
+Function9288e: ; 9288e (24:688e)
+ call Function9307c
+ jr nc, .asm_92899
+ ld a, $12
+ ld [wJumptableIndex], a
+ ret
+.asm_92899
+ call Function92879
+ call Function9303f
+ call Function93002
+ ld a, $20
+ ld [wcf64], a
+ ld a, $4
+ ld [wc6d0], a
+ ld [wc6e0], a
+ ld [wc6f0], a
+ ld a, $4
+ ld [wc6d9], a
+ ld [wc6e9], a
+ ld [wc6f9], a
+ call WaitSFX
+ ld a, SFX_SLOT_MACHINE_START
+ call Function9331e
+ ret
+
+Function928c6: ; 928c6 (24:68c6)
+ ld hl, wcf64
+ ld a, [hl]
+ and a
+ jr z, .asm_928cf
+ dec [hl]
+ ret
+.asm_928cf
+ call Function92879
+ xor a
+ ld [hJoypadSum], a
+ ret
+
+Function928d6: ; 928d6 (24:68d6)
+ ld hl, hJoypadSum ; $ffa5
+ ld a, [hl]
+ and A_BUTTON
+ ret z
+ call Function92879
+ call Function92a2b
+ ld [wc6d0], a
+
+Function928e6: ; 928e6 (24:68e6)
+ ld a, [wc6d0]
+ cp $0
+ ret nz
+ ld a, SFX_STOP_SLOT
+ call Function9331e
+ ld bc, wc6d0
+ ld de, wc700
+ call Function929f6
+ call Function92879
+ xor a
+ ld [hJoypadSum], a
+
+Function92900: ; 92900 (24:6900)
+ ld hl, hJoypadSum ; $ffa5
+ ld a, [hl]
+ and A_BUTTON
+ ret z
+ call Function92879
+ call Function92a2e
+ ld [wc6e0], a
+
+Function92910: ; 92910 (24:6910)
+ ld a, [wc6e0]
+ cp $0
+ ret nz
+ ld a, SFX_STOP_SLOT
+ call Function9331e
+ ld bc, wc6e0
+ ld de, wc703
+ call Function929f6
+ call Function92879
+ xor a
+ ld [hJoypadSum], a
+
+Function9292a: ; 9292a (24:692a)
+ ld hl, hJoypadSum ; $ffa5
+ ld a, [hl]
+ and A_BUTTON
+ ret z
+ call Function92879
+ call Function92a60
+ ld [wc6f0], a
+
+Function9293a: ; 9293a (24:693a)
+ ld a, [wc6f0]
+ cp $0
+ ret nz
+ ld a, SFX_STOP_SLOT
+ call Function9331e
+ ld bc, wc6f0
+ ld de, wc706
+ call Function929f6
+ call Function92879
+ xor a
+ ld [hJoypadSum], a
+ ret
+
+Function92955: ; 92955 (24:6955)
+ ld a, [wc70d]
+ cp $ff
+ jr nz, .asm_92963
+ call Function92879
+ call Function92879
+ ret
+.asm_92963
+ call Function92879
+ ld a, $10
+ ld [wcf64], a
+
+Function9296b: ; 9296b (24:696b)
+ ld hl, wcf64
+ ld a, [hl]
+ and a
+ jr z, .asm_92980
+ dec [hl]
+ srl a
+ ret z
+ ld a, [rOBP0]
+ xor $ff
+ ld e, a
+ ld d, a
+ call DmgToCgbObjPals
+ ret
+.asm_92980
+ call Function9279b
+ call Function92879
+ ret
+
+Function92987: ; 92987 (24:6987)
+ xor a
+ ld [wc70b], a
+ ld [wc70c], a
+ ld a, $e4
+ call DmgToCgbBGPals
+ call Function93124
+ xor a
+ ld [wcf64], a
+ call Function92879
+ ret
+
+Function9299e: ; 9299e (24:699e)
+ call Function93158
+ call Function92879
+
+Function929a4: ; 929a4 (24:69a4)
+ ld hl, wcf64
+ ld a, [hl]
+ inc [hl]
+ and $1
+ ret z
+ ld hl, wc711
+ ld a, [hli]
+ ld d, a
+ or [hl]
+ jr z, .asm_929d5
+ ld e, [hl]
+ dec de
+ ld [hl], e
+ dec hl
+ ld [hl], d
+ ld hl, Coins
+ ld d, [hl]
+ inc hl
+ ld e, [hl]
+ call Function92a04
+ jr c, .asm_929c5
+ inc de
+.asm_929c5
+ ld [hl], e
+ dec hl
+ ld [hl], d
+ ld a, [wcf64]
+ and $7
+ ret z
+ ld de, SFX_GET_COIN_FROM_SLOTS
+ call PlaySFX
+ ret
+.asm_929d5
+ call Function92879
+ ret
+
+Function929d9: ; 929d9 (24:69d9)
+ call Function9304c
+ call WaitPressAorB_BlinkCursor
+ call Function930e9
+ jr c, .asm_929ea
+ ld a, $0
+ ld [wJumptableIndex], a
+ ret
+.asm_929ea
+ ld a, $12
+ ld [wJumptableIndex], a
+ ret
+
+Function929f0: ; 929f0 (24:69f0)
+ ld hl, wJumptableIndex
+ set 7, [hl]
+ ret
+
+Function929f6: ; 929f6 (24:69f6)
+ push de
+ call Function92a12
+ pop de
+ ld a, [hli]
+ ld [de], a
+ inc de
+ ld a, [hli]
+ ld [de], a
+ inc de
+ ld a, [hli]
+ ld [de], a
+ ret
+
+Function92a04: ; 92a04 (24:6a04)
+ ld a, d
+ cp 9999 / $100
+ jr c, .asm_92a10
+ ld a, e
+ cp 9999 % $100
+ jr c, .asm_92a10
+ scf
+ ret
+.asm_92a10
+ and a
+ ret
+
+Function92a12: ; 92a12 (24:6a12)
+ ld hl, $3
+ add hl, bc
+ ld a, [hl]
+ and a
+ jr nz, .asm_92a1c
+ ld a, $f
+.asm_92a1c
+ dec a
+ and $f
+ ld e, a
+ ld d, $0
+ ld hl, $1
+ add hl, bc
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ add hl, de
+ ret
+
+Function92a2b: ; 92a2b (24:6a2b)
+ ld a, $7
+ ret
+
+Function92a2e: ; 92a2e (24:6a2e)
+ ld a, [wc70a]
+ cp $2
+ jr c, .asm_92a4e
+ ld a, [wc709]
+ and a
+ jr z, .asm_92a3f
+ cp $ff
+ jr nz, .asm_92a4e
+.asm_92a3f
+ call Function92a51
+ jr nz, .asm_92a4e
+ call Random
+ cp $50
+ jr nc, .asm_92a4e
+ ld a, $a
+ ret
+.asm_92a4e
+ ld a, $8
+ ret
+
+Function92a51: ; 92a51 (24:6a51)
+ ld a, [wc700]
+ and a
+ ret z
+ ld a, [wc701]
+ and a
+ ret z
+ ld a, [wc702]
+ and a
+ ret
+
+Function92a60: ; 92a60 (24:6a60)
+ ld a, [wc70b]
+ and a
+ jr z, .asm_92a95
+ ld a, [wc70c]
+ and a
+ jr z, .asm_92a95
+ ld a, [wc709]
+ and a
+ jr nz, .asm_92a84
+ call Random
+ cp 180
+ jr nc, .asm_92a95
+ cp 120
+ jr nc, .asm_92a92
+ cp 60
+ jr nc, .asm_92a8f
+ ld a, $15
+ ret
+.asm_92a84
+ call Random
+ cp $a0
+ jr nc, .asm_92a95
+ cp $50
+ jr nc, .asm_92a92
+.asm_92a8f
+ ld a, $12
+ ret
+.asm_92a92
+ ld a, $10
+ ret
+.asm_92a95
+ ld a, $9
+ ret
+
+Function92a98: ; 92a98 (24:6a98)
+ ld bc, wc6d0
+ ld hl, $6
+ add hl, bc
+ ld de, Sprites + $40
+ ld [hl], e
+ inc hl
+ ld [hl], d
+ ld hl, $1
+ add hl, bc
+ ld de, Unknown_93327
+ ld [hl], e
+ inc hl
+ ld [hl], d
+ ld hl, $8
+ add hl, bc
+ ld [hl], $30
+ call Function92af9
+ ld bc, wc6e0
+ ld hl, $6
+ add hl, bc
+ ld de, Sprites + $60
+ ld [hl], e
+ inc hl
+ ld [hl], d
+ ld hl, $1
+ add hl, bc
+ ld de, Unknown_93339
+ ld [hl], e
+ inc hl
+ ld [hl], d
+ ld hl, $8
+ add hl, bc
+ ld [hl], $50
+ call Function92af9
+ ld bc, wc6f0
+ ld hl, $6
+ add hl, bc
+ ld de, Sprites + $80
+ ld [hl], e
+ inc hl
+ ld [hl], d
+ ld hl, $1
+ add hl, bc
+ ld de, Unknown_9334b
+ ld [hl], e
+ inc hl
+ ld [hl], d
+ ld hl, $8
+ add hl, bc
+ ld [hl], $70
+ call Function92af9
+ ret
+
+Function92af9: ; 92af9 (24:6af9)
+ ld hl, 0
+ add hl, bc
+ ld [hl], $0
+ ld hl, $3
+ add hl, bc
+ ld [hl], $e
+ ld hl, $4
+ add hl, bc
+ ld [hl], $0
+ call Function92b53
+ ret
+
+Function92b0f: ; 92b0f (24:6b0f)
+ ld bc, wc6d0
+ call Function92b22
+ ld bc, wc6e0
+ call Function92b22
+ ld bc, wc6f0
+ call Function92b22
+ ret
+
+Function92b22: ; 92b22 (24:6b22)
+ ld hl, $4
+ add hl, bc
+ ld a, [hl]
+ and $f
+ jr nz, .asm_92b2e
+ call Function92bd4
+.asm_92b2e
+ ld hl, $5
+ add hl, bc
+ ld a, [hl]
+ and a
+ ret z
+ ld d, a
+ ld hl, $4
+ add hl, bc
+ add [hl]
+ ld [hl], a
+ and $f
+ jr z, Function92b53
+ ld hl, $6
+ add hl, bc
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ ld e, $8
+.asm_92b49
+ ld a, [hl]
+ add d
+ ld [hli], a
+rept 3
+ inc hl
+endr
+ dec e
+ jr nz, .asm_92b49
+ ret
+
+Function92b53: ; 92b53 (24:6b53)
+ ld hl, $8
+ add hl, bc
+ ld a, [hl]
+ ld [wc712 + 1], a
+ ld a, $50
+ ld [wc712 + 2], a
+ ld hl, $3
+ add hl, bc
+ ld e, [hl]
+ ld d, $0
+ ld hl, $1
+ add hl, bc
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ add hl, de
+ ld e, l
+ ld d, h
+ call Function92b83
+ ld hl, $3
+ add hl, bc
+ ld a, [hl]
+ inc a
+ and $f
+ cp $f
+ jr nz, .asm_92b81
+ xor a
+.asm_92b81
+ ld [hl], a
+ ret
+
+Function92b83: ; 92b83 (24:6b83)
+ ld hl, $6
+ add hl, bc
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+.asm_92b8a
+ ld a, [wc712 + 2]
+ ld [hli], a
+ ld a, [wc712 + 1]
+ ld [hli], a
+ ld a, [de]
+ ld [hli], a
+ srl a
+ srl a
+ set 7, a
+ ld [hli], a
+ ld a, [wc712 + 2]
+ ld [hli], a
+ ld a, [wc712 + 1]
+ add $8
+ ld [hli], a
+ ld a, [de]
+rept 2
+ inc a
+endr
+ ld [hli], a
+ srl a
+ srl a
+ set 7, a
+ ld [hli], a
+ inc de
+ ld a, [wc712 + 2]
+ sub $10
+ ld [wc712 + 2], a
+ cp $10
+ jr nz, .asm_92b8a
+ ret
+; 92bbe (24:6bbe)
+
+Function92bbe: ; 92bbe
+ push hl
+ srl a
+ srl a
+ add Unknown_92bce % $100
+ ld l, a
+ ld a, 0
+ adc Unknown_92bce / $100
+ ld h, a
+ ld a, [hl]
+ pop hl
+ ret
+; 92bce
+
+Unknown_92bce: ; 92bce
+ db 0, 1, 2, 3, 4, 5
+; 92bd4
+
+Function92bd4: ; 92bd4 (24:6bd4)
+ ld hl, 0
+ add hl, bc
+ ld e, [hl]
+ ld d, 0
+ ld hl, Jumptable_92be4
+rept 2
+ add hl, de
+endr
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ jp [hl]
+; 92be4 (24:6be4)
+
+Jumptable_92be4: ; 92be4
+ dw Function92c16
+ dw Function92c4c
+ dw Function92c17
+ dw Function92c1e
+ dw Function92c25
+ dw Function92c2c
+ dw Function92c33
+ dw Function92c5e
+ dw Function92c86
+ dw Function92ca9
+ dw Function92cd2
+ dw Function92cf8
+ dw Function92d13
+ dw Function92df7
+ dw Function92e10
+ dw Function92e31
+ dw Function92e47
+ dw Function92e64
+ dw Function92d20
+ dw Function92d4f
+ dw Function92d6e
+ dw Function92d7e
+ dw Function92da4
+ dw Function92db3
+ dw Function92dca
+; 92c16
+
+Function92c16: ; 92c16
+ ret
+; 92c17
+
+Function92c17: ; 92c17
+ ld hl, $5
+ add hl, bc
+ ld [hl], $10
+ ret
+; 92c1e
+
+Function92c1e: ; 92c1e
+ ld hl, $5
+ add hl, bc
+ ld [hl], $8
+ ret
+; 92c25
+
+Function92c25: ; 92c25
+ ld hl, $5
+ add hl, bc
+ ld [hl], $4
+ ret
+; 92c2c
+
+Function92c2c: ; 92c2c
+ ld hl, $5
+ add hl, bc
+ ld [hl], $2
+ ret
+; 92c33
+
+Function92c33: ; 92c33
+ ld hl, $5
+ add hl, bc
+ ld [hl], $1
+ ret
+; 92c3a
+
+Function92c3a: ; 92c3a
+ ld hl, $5
+ add hl, bc
+ ld [hl], $0
+ ld hl, 0
+ add hl, bc
+ ld [hl], $1
+ ld hl, $f
+ add hl, bc
+ ld [hl], $3
+
+Function92c4c: ; 92c4c
+ ld hl, $f
+ add hl, bc
+ ld a, [hl]
+ and a
+ jr z, .asm_92c56
+ dec [hl]
+ ret
+
+.asm_92c56
+ ld hl, 0
+ add hl, bc
+ ld a, $0
+ ld [hl], a
+ ret
+; 92c5e
+
+Function92c5e: ; 92c5e
+ ld a, [wc709]
+ cp $ff
+ jr z, .asm_92c72
+ ld hl, $9
+ add hl, bc
+ ld a, [hl]
+ and a
+ jr z, .asm_92c72
+ dec [hl]
+ call Function92c76
+ ret nz
+
+.asm_92c72
+ call Function92c3a
+ ret
+; 92c76
+
+Function92c76: ; 92c76
+ call Function92a12
+ ld a, [wc709]
+ ld e, a
+ ld a, [hli]
+ cp e
+ ret z
+ ld a, [hli]
+ cp e
+ ret z
+ ld a, [hl]
+ cp e
+ ret
+; 92c86
+
+Function92c86: ; 92c86
+ call Function92e94
+ jr nc, .asm_92c94
+ ld a, [wc717]
+ ld hl, wc709
+ cp [hl]
+ jr z, .asm_92ca5
+
+.asm_92c94
+ ld a, [wc709]
+ cp $ff
+ jr z, .asm_92ca5
+ ld hl, $9
+ add hl, bc
+ ld a, [hl]
+ and a
+ jr z, .asm_92ca5
+ dec [hl]
+ ret
+
+.asm_92ca5
+ call Function92c3a
+ ret
+; 92ca9
+
+Function92ca9: ; 92ca9
+ call Function92f1d
+ jr nc, .asm_92cbd
+ ld hl, wc709
+ cp [hl]
+ jr z, .asm_92cce
+ ld hl, $9
+ add hl, bc
+ ld a, [hl]
+ and a
+ ret z
+ dec [hl]
+ ret
+
+.asm_92cbd
+ ld a, [wc709]
+ cp $ff
+ jr z, .asm_92cce
+ ld hl, $9
+ add hl, bc
+ ld a, [hl]
+ and a
+ jr z, .asm_92cce
+ dec [hl]
+ ret
+
+.asm_92cce
+ call Function92c3a
+ ret
+; 92cd2
+
+Function92cd2: ; 92cd2
+ call Function92e94
+ jr nc, .asm_92ce1
+ ld a, [wc70c]
+ and a
+ jr z, .asm_92ce1
+ call Function92c3a
+ ret
+
+.asm_92ce1
+ ld a, SFX_STOP_SLOT
+ call Function9331e
+ ld hl, 0
+ add hl, bc
+ inc [hl]
+ ld hl, $a
+ add hl, bc
+ ld [hl], $20
+ ld hl, $5
+ add hl, bc
+ ld [hl], $0
+ ret
+; 92cf8
+
+Function92cf8: ; 92cf8
+ ld hl, $a
+ add hl, bc
+ ld a, [hl]
+ and a
+ jr z, .asm_92d02
+ dec [hl]
+ ret
+
+.asm_92d02
+ ld a, SFX_THROW_BALL
+ call Function9331e
+ ld hl, 0
+ add hl, bc
+ inc [hl]
+ ld hl, $5
+ add hl, bc
+ ld [hl], $8
+ ret
+; 92d13
+
+Function92d13: ; 92d13
+ call Function92e94
+ ret nc
+ ld a, [wc70c]
+ and a
+ ret z
+ call Function92c3a
+ ret
+; 92d20
+
+Function92d20: ; 92d20
+ call Function92f1d
+ ret c
+ ld a, SFX_STOP_SLOT
+ call Function9331e
+ call Function93316
+ ld hl, 0
+ add hl, bc
+ inc [hl]
+ ld hl, $5
+ add hl, bc
+ ld [hl], $0
+ call Function92fc0
+ push bc
+ push af
+ ld de, $6068
+ ld a, $6
+ call Function3b2a
+ ld hl, $e
+ add hl, bc
+ pop af
+ ld [hl], a
+ pop bc
+ xor a
+ ld [wcf64], a
+
+Function92d4f: ; 92d4f
+ ld a, [wcf64]
+ cp $2
+ jr z, .asm_92d5b
+ cp $1
+ jr z, .asm_92d62
+ ret
+
+.asm_92d5b
+ call Function92f1d
+ call Function92c3a
+ ret
+
+.asm_92d62
+ ld hl, 0
+ add hl, bc
+ inc [hl]
+ ld hl, $5
+ add hl, bc
+ ld [hl], $8
+ ret
+; 92d6e
+
+Function92d6e: ; 92d6e
+ xor a
+ ld [wcf64], a
+ ld hl, 0
+ add hl, bc
+ dec [hl]
+ ld hl, $5
+ add hl, bc
+ ld [hl], $0
+ ret
+; 92d7e
+
+Function92d7e: ; 92d7e
+ call Function92f1d
+ ret c
+ ld a, SFX_STOP_SLOT
+ call Function9331e
+ call Function93316
+ ld hl, 0
+ add hl, bc
+ inc [hl]
+ ld hl, $5
+ add hl, bc
+ ld [hl], $0
+ push bc
+ ld de, $6000
+ ld a, $7
+ call Function3b2a
+ pop bc
+ xor a
+ ld [wcf64], a
+ ret
+; 92da4
+
+Function92da4: ; 92da4
+ ld a, [wcf64]
+ and a
+ ret z
+ ld hl, 0
+ add hl, bc
+ inc [hl]
+ ld a, $2
+ ld [wcf64], a
+
+Function92db3: ; 92db3
+ ld a, [wcf64]
+ cp $4
+ ret c
+ ld hl, 0
+ add hl, bc
+ inc [hl]
+ ld hl, $5
+ add hl, bc
+ ld [hl], $10
+ ld hl, $a
+ add hl, bc
+ ld [hl], $11
+
+Function92dca: ; 92dca
+ ld hl, $a
+ add hl, bc
+ ld a, [hl]
+ and a
+ jr z, .asm_92dd4
+ dec [hl]
+ ret
+
+.asm_92dd4
+ call Function92f1d
+ jr nc, .asm_92de5
+ and a
+ jr nz, .asm_92de5
+ ld a, $5
+ ld [wcf64], a
+ call Function92c3a
+ ret
+
+.asm_92de5
+ ld hl, $5
+ add hl, bc
+ ld [hl], $0
+ ld hl, 0
+ add hl, bc
+rept 2
+ dec [hl]
+endr
+ ld a, $1
+ ld [wcf64], a
+ ret
+; 92df7
+
+Function92df7: ; 92df7
+ call Function92f1d
+ ret c
+ ld a, SFX_STOP_SLOT
+ call Function9331e
+ call Function93316
+ ld hl, 0
+ add hl, bc
+ inc [hl]
+ call Function92fc0
+ ld hl, $a
+ add hl, bc
+ ld [hl], a
+
+Function92e10: ; 92e10
+ ld hl, $a
+ add hl, bc
+ ld a, [hl]
+ and a
+ jr nz, .asm_92e1f
+ call Function92f1d
+ call Function92c3a
+ ret
+
+.asm_92e1f
+ dec [hl]
+ ld hl, 0
+ add hl, bc
+ inc [hl]
+ ld hl, $b
+ add hl, bc
+ ld [hl], $20
+ ld hl, $5
+ add hl, bc
+ ld [hl], $0
+
+Function92e31: ; 92e31
+ ld hl, $b
+ add hl, bc
+ ld a, [hl]
+ and a
+ jr z, .asm_92e3b
+ dec [hl]
+ ret
+
+.asm_92e3b
+ ld hl, 0
+ add hl, bc
+ dec [hl]
+ ld hl, $5
+ add hl, bc
+ ld [hl], $8
+ ret
+; 92e47
+
+Function92e47: ; 92e47
+ call Function92f1d
+ ret c
+ ld a, SFX_STOP_SLOT
+ call Function9331e
+ call Function93316
+ ld hl, $5
+ add hl, bc
+ ld [hl], $1
+ ld hl, 0
+ add hl, bc
+ inc [hl]
+ ld hl, $a
+ add hl, bc
+ ld [hl], $10
+
+Function92e64: ; 92e64
+ ld hl, $a
+ add hl, bc
+ ld a, [hl]
+ and a
+ jr z, .asm_92e73
+ dec [hl]
+.asm_92e6d
+ ld a, SFX_GOT_SAFARI_BALLS
+ call Function9331e
+ ret
+
+.asm_92e73
+ ld a, [wc709]
+ and a
+ jr nz, .asm_92e88
+ call Function92f1d
+ jr nc, .asm_92e6d
+ and a
+ jr nz, .asm_92e6d
+ call Function92c3a
+ call WaitSFX
+ ret
+
+.asm_92e88
+ call Function92f1d
+ jr c, .asm_92e6d
+ call Function92c3a
+ call WaitSFX
+ ret
+; 92e94
+
+Function92e94: ; 92e94
+ xor a
+ ld [wc70b], a
+ ld [wc70c], a
+ call Function92a12
+ call Function92fb4
+ ld a, [wc70a]
+ and 3
+ ld e, a
+ ld d, 0
+ ld hl, Jumptable_92ebd
+rept 2
+ add hl, de
+endr
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ ld de, .asm_92eb6
+ push de
+ jp [hl]
+
+.asm_92eb6
+ ld a, [wc70b]
+ and a
+ ret z
+ scf
+ ret
+; 92ebd
+
+Jumptable_92ebd: ; 92ebd
+ dw Function92ed4
+ dw Function92ed1
+ dw Function92ecb
+ dw Function92ec5
+; 92ec5
+
+Function92ec5: ; 92ec5
+ call Function92ee0
+ call Function92ef6
+
+Function92ecb: ; 92ecb
+ call Function92ed5
+ call Function92f01
+
+Function92ed1: ; 92ed1
+ call Function92eeb
+
+Function92ed4: ; 92ed4
+ ret
+; 92ed5
+
+Function92ed5: ; 92ed5
+ ld hl, wc70e
+ ld a, [EnemyScreens]
+ cp [hl]
+ call z, Function92f0c
+ ret
+; 92ee0
+
+Function92ee0: ; 92ee0
+ ld hl, wEnemyGoesFirst
+ ld a, [wc700]
+ cp [hl]
+ call z, Function92f0c
+ ret
+; 92eeb
+
+Function92eeb: ; 92eeb
+ ld hl, wEnemyGoesFirst
+ ld a, [wc701]
+ cp [hl]
+ call z, Function92f0c
+ ret
+; 92ef6
+
+Function92ef6: ; 92ef6
+ ld hl, wEnemyGoesFirst
+ ld a, [wc702]
+ cp [hl]
+ call z, Function92f0c
+ ret
+; 92f01
+
+Function92f01: ; 92f01
+ ld hl, wc710
+ ld a, [wc702]
+ cp [hl]
+ call z, Function92f0c
+ ret
+; 92f0c
+
+Function92f0c: ; 92f0c
+ ld [wc717], a
+ and a
+ jr nz, .asm_92f17
+ ld a, $1
+ ld [wc70c], a
+
+.asm_92f17
+ ld a, $1
+ ld [wc70b], a
+ ret
+; 92f1d
+
+Function92f1d: ; 92f1d
+ ld a, $ff
+ ld [EffectFailed], a
+ call Function92a12
+ call Function92fb4
+ ld a, [wc70a]
+ and 3
+ ld e, a
+ ld d, 0
+ ld hl, Jumptable_92f48
+rept 2
+ add hl, de
+endr
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ ld de, .asm_92f3d
+ push de
+ jp [hl]
+
+.asm_92f3d
+ ld a, [wc70d]
+ cp $ff
+ jr nz, .asm_92f46
+ and a
+ ret
+
+.asm_92f46
+ scf
+ ret
+; 92f48
+
+Jumptable_92f48: ; 92f48
+ dw Function92f5f
+ dw Function92f5c
+ dw Function92f56
+ dw Function92f50
+; 92f50
+
+Function92f50: ; 92f50
+ call Function92f70
+ call Function92f90
+
+Function92f56: ; 92f56
+ call Function92f60
+ call Function92fa0
+
+Function92f5c: ; 92f5c
+ call Function92f80
+
+Function92f5f: ; 92f5f
+ ret
+; 92f60
+
+Function92f60: ; 92f60
+ ld hl, wc70e
+ ld a, [wc700]
+ cp [hl]
+ ret nz
+ ld hl, wc703
+ cp [hl]
+ call z, Function92fb0
+ ret
+; 92f70
+
+Function92f70: ; 92f70
+ ld hl, wc710
+ ld a, [wc700]
+ cp [hl]
+ ret nz
+ ld hl, wc704
+ cp [hl]
+ call z, Function92fb0
+ ret
+; 92f80
+
+Function92f80: ; 92f80
+ ld hl, wEnemyGoesFirst
+ ld a, [wc701]
+ cp [hl]
+ ret nz
+ ld hl, wc704
+ cp [hl]
+ call z, Function92fb0
+ ret
+; 92f90
+
+Function92f90: ; 92f90
+ ld hl, wc70e
+ ld a, [wc702]
+ cp [hl]
+ ret nz
+ ld hl, wc704
+ cp [hl]
+ call z, Function92fb0
+ ret
+; 92fa0
+
+Function92fa0: ; 92fa0
+ ld hl, wc710
+ ld a, [wc702]
+ cp [hl]
+ ret nz
+ ld hl, wc705
+ cp [hl]
+ call z, Function92fb0
+ ret
+; 92fb0
+
+Function92fb0: ; 92fb0
+ ld [wc70d], a
+ ret
+; 92fb4
+
+Function92fb4: ; 92fb4
+ ld de, wc70e
+ ld a, [hli]
+ ld [de], a
+ inc de
+ ld a, [hli]
+ ld [de], a
+ inc de
+ ld a, [hl]
+ ld [de], a
+ ret
+; 92fc0
+
+Function92fc0: ; 92fc0
+ ld hl, $3
+ add hl, bc
+ ld a, [hl]
+ push af
+ push hl
+ call Function92fcf
+ pop hl
+ pop af
+ ld [hl], a
+ ld a, e
+ ret
+; 92fcf
+
+Function92fcf: ; 92fcf
+ ld a, [wc709]
+ and a
+ jr nz, .asm_92fe8
+ ld e, $0
+.asm_92fd7
+ ld hl, $3
+ add hl, bc
+ inc [hl]
+ inc e
+ push de
+ call Function92f1d
+ pop de
+ jr nc, .asm_92fd7
+ and a
+ jr nz, .asm_92fd7
+ ret
+
+.asm_92fe8
+ call Random
+ and $7
+ cp $4
+ jr c, .asm_92fe8
+ ld e, a
+.asm_92ff2
+ ld a, e
+ inc e
+ ld hl, $3
+ add hl, bc
+ add [hl]
+ ld [hl], a
+ push de
+ call Function92f1d
+ pop de
+ jr c, .asm_92ff2
+ ret
+; 93002
+
+Function93002: ; 93002 (24:7002)
+ ld a, [wc709]
+ and a
+ ret z
+ ld hl, Unknown_93023
+ ld a, [ScriptVar]
+ and a
+ jr z, .asm_93013
+ ld hl, Unknown_93031
+.asm_93013
+ call Random
+ ld c, a
+.asm_93017
+ ld a, [hli]
+ cp c
+ jr nc, .asm_9301e
+ inc hl
+ jr .asm_93017
+.asm_9301e
+ ld a, [hl]
+ ld [wc709], a
+ ret
+; 93023 (24:7023)
+
+Unknown_93023: ; 93023
+ db $01, $00
+ db $03, $04
+ db $0a, $14
+ db $14, $10
+ db $28, $0c
+ db $30, $08
+ db $ff, $ff
+; 93031
+
+Unknown_93031: ; 93031
+ db $02, $00
+ db $03, $04
+ db $08, $14
+ db $10, $10
+ db $1e, $0c
+ db $50, $08
+ db $ff, $ff
+; 9303f
+
+Function9303f: ; 9303f (24:703f)
+ ld b, $14
+ ld a, [wc70a]
+ dec a
+ jr z, asm_93066
+ dec a
+ jr z, asm_9305a
+ jr asm_9304e
+
+Function9304c: ; 9304c (24:704c)
+ ld b, $23
+asm_9304e: ; 9304e (24:704e)
+ hlcoord 3, 2
+ call Function93069
+ hlcoord 3, 10
+ call Function93069
+asm_9305a: ; 9305a (24:705a)
+ hlcoord 3, 4
+ call Function93069
+ hlcoord 3, 8
+ call Function93069
+asm_93066: ; 93066 (24:7066)
+ hlcoord 3, 6
+
+Function93069: ; 93069 (24:7069)
+ ld a, b
+ ld [hl], a
+ ld de, $d
+ add hl, de
+ ld [hl], a
+ ld de, $7
+ add hl, de
+ inc a
+ ld [hl], a
+ ld de, $d
+ add hl, de
+ ld [hl], a
+ ret
+
+Function9307c: ; 9307c (24:707c)
+ ld hl, UnknownText_0x930c7
+ call PrintText
+ ld hl, MenuDataHeader_0x930d6
+ call LoadMenuDataHeader
+ call InterpretMenu2
+ call WriteBackup
+ ret c
+ ld a, [MenuSelection2]
+ ld b, a
+ ld a, $4
+ sub b
+ ld [wc70a], a
+ ld hl, Coins
+ ld c, a
+ ld a, [hli]
+ and a
+ jr nz, .asm_930ad
+ ld a, [hl]
+ cp c
+ jr nc, .asm_930ad
+ ld hl, UnknownText_0x930d1
+ call PrintText
+ jr Function9307c
+.asm_930ad
+ ld hl, Coins + 1
+ ld a, [hl]
+ sub c
+ ld [hld], a
+ jr nc, .asm_930b6
+ dec [hl]
+.asm_930b6
+ call WaitSFX
+ ld de, SFX_PAY_DAY
+ call PlaySFX
+ ld hl, UnknownText_0x930cc
+ call PrintText
+ and a
+ ret
+; 930c7 (24:70c7)
+
+UnknownText_0x930c7: ; 0x930c7
+ ; Bet how many coins?
+ text_jump UnknownText_0x1c5049
+ db "@"
+; 0x930cc
+
+UnknownText_0x930cc: ; 0x930cc
+ ; Start!
+ text_jump UnknownText_0x1c505e
+ db "@"
+; 0x930d1
+
+UnknownText_0x930d1: ; 0x930d1
+ ; Not enough coins.
+ text_jump UnknownText_0x1c5066
+ db "@"
+; 0x930d6
+
+MenuDataHeader_0x930d6: ; 0x930d6
+ db $40 ; flags
+ db 10, 14 ; start coords
+ db 17, 19 ; end coords
+ dw MenuData2_0x930de
+ db 1 ; default option
+; 0x930de
+
+MenuData2_0x930de: ; 0x930de
+ db $80 ; flags
+ db 3 ; items
+ db " 3@"
+ db " 2@"
+ db " 1@"
+; 0x930e9
+
+Function930e9: ; 930e9 (24:70e9)
+ ld hl, Coins
+ ld a, [hli]
+ or [hl]
+ jr nz, .asm_930fd
+ ld hl, UnknownText_9311a
+ call PrintText
+ ld c, 60
+ call DelayFrames
+ jr .asm_93118
+.asm_930fd
+ ld hl, UnknownText_9311f
+ call PrintText
+ call LoadMenuTextBox
+ lb bc, 14, 12
+ call PlaceYesNoBox
+ ld a, [MenuSelection2]
+ dec a
+ call WriteBackup
+ and a
+ jr nz, .asm_93118
+ and a
+ ret
+.asm_93118
+ scf
+ ret
+; 9311a (24:711a)
+
+UnknownText_9311a: ; 9311a
+ text_jump UnknownText_0x1c5079
+ db "@"
+
+UnknownText_9311f: ; 9311f
+ text_jump UnknownText_0x1c5092
+ db "@"
+
+Function93124: ; 93124 (24:7124)
+ ld a, [EffectFailed]
+ cp $ff
+ jr z, .asm_93151
+ srl a
+ ld e, a
+ ld d, 0
+ ld hl, .data_93145
+ add hl, de
+ ld a, [hli]
+ ld [PlayerUsedMoves], a
+ ld e, a
+ ld a, [hl]
+ ld [wc711], a
+ ld d, a
+ callba MobileFn_105fe3
+ ret
+
+.data_93145
+ db $2c, $01
+ db $32, $00
+ db $06, $00
+ db $08, $00
+ db $0a, $00
+ db $0f, $00
+
+.asm_93151
+ ld hl, wc711
+ xor a
+ ld [hli], a
+ ld [hl], a
+ ret
+
+Function93158: ; 93158 (24:7158)
+ ld a, [EffectFailed]
+ cp $ff
+ jr nz, .asm_9316c
+ ld hl, UnknownText_0x931e0
+ call PrintText
+ callba MobileFn_105fd0
+ ret
+.asm_9316c
+ srl a
+ ld e, a
+ ld d, 0
+ ld hl, Unknown_93195
+rept 3
+ add hl, de
+endr
+ ld de, StringBuffer2
+ ld bc, $4
+ call CopyBytes
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ ld de, .asm_93188
+ push de
+ jp [hl]
+.asm_93188
+ ld hl, UnknownText_0x931b9
+ call PrintText
+ callba MobileFn_105f9f
+ ret
+; 93195 (24:7195)
+
+Unknown_93195: ; 93195
+ db "300@"
+ dw Function931e5
+ db "50@@"
+ dw Function9320b
+ db "6@@@"
+ dw Function93214
+ db "8@@@"
+ dw Function93214
+ db "10@@"
+ dw Function93214
+ db "15@@"
+ dw Function93214
+; 931b9
+
+UnknownText_0x931b9: ; 0x931b9
+ start_asm
+; 0x931ba
+
+Function931ba: ; 931ba
+ ld a, [EffectFailed]
+ add $25
+ ldcoord_a 2, 13
+ inc a
+ ldcoord_a 2, 14
+ inc a
+ ldcoord_a 3, 13
+ inc a
+ ldcoord_a 3, 14
+ hlcoord 18, 17
+ ld [hl], $ee
+ ld hl, UnknownText_0x931db
+rept 4
+ inc bc
+endr
+ ret
+; 931db
+
+UnknownText_0x931db: ; 0x931db
+ ; lined up! Won @ coins!
+ text_jump UnknownText_0x1c509f
+ db "@"
+; 0x931e0
+
+UnknownText_0x931e0: ; 0x931e0
+ ; Darn!
+ text_jump UnknownText_0x1c50bb
+ db "@"
+; 0x931e5
+
+Function931e5: ; 931e5
+ ld a, SFX_2ND_PLACE
+ call Function9331e
+ call WaitSFX
+ ld a, [wd002]
+ and a
+ jr nz, .asm_931ff
+ call Random
+ and $14
+ ret z
+ ld a, $ff
+ ld [wc709], a
+ ret
+
+.asm_931ff
+ call Random
+ and $1c
+ ret z
+ ld a, $ff
+ ld [wc709], a
+ ret
+; 9320b
+
+Function9320b: ; 9320b
+ ld a, SFX_3RD_PLACE
+ call Function9331e
+ call WaitSFX
+ ret
+; 93214
+
+Function93214: ; 93214
+ ld a, SFX_PRESENT
+ call Function9331e
+ call WaitSFX
+ ret
+; 9321d
+
+Function9321d: ; 9321d (24:721d)
+ ld hl, $b
+ add hl, bc
+ ld e, [hl]
+ ld d, 0
+ ld hl, Jumptable_9322d
+rept 2
+ add hl, de
+endr
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ jp [hl]
+
+Jumptable_9322d: ; 9322d (24:722d)
+ dw Function93233
+ dw Function93259
+ dw Function93289
+
+
+Function93233: ; 93233 (24:7233)
+ ld hl, $e
+ add hl, bc
+ ld a, [hl]
+ and a
+ jr nz, .asm_93247
+ ld a, $2
+ ld [wcf64], a
+ ld hl, 0
+ add hl, bc
+ ld [hl], $0
+ ret
+.asm_93247
+ dec [hl]
+ ld hl, $b
+ add hl, bc
+ inc [hl]
+ ld hl, $c
+ add hl, bc
+ ld [hl], $30
+ ld hl, $6
+ add hl, bc
+ ld [hl], $0
+
+Function93259: ; 93259 (24:7259)
+ ld hl, $c
+ add hl, bc
+ ld a, [hl]
+ cp $20
+ jr c, .asm_93273
+ dec [hl]
+ ld e, a
+ ld d, $70
+ callba Functionce765
+ ld a, e
+ ld hl, $7
+ add hl, bc
+ ld [hl], a
+ ret
+.asm_93273
+ ld hl, $b
+ add hl, bc
+ inc [hl]
+ ld hl, $d
+ add hl, bc
+ ld [hl], $2
+ ld a, $1
+ ld [wcf64], a
+ ld a, SFX_PLACE_PUZZLE_PIECE_DOWN
+ call Function9331e
+ ret
+
+Function93289: ; 93289 (24:7289)
+ ld hl, $6
+ add hl, bc
+ ld a, [hl]
+rept 2
+ inc [hl]
+endr
+ cp $48
+ jr nc, .asm_932a3
+ and $3
+ ret nz
+ ld hl, $d
+ add hl, bc
+ ld a, [hl]
+ xor $ff
+ inc a
+ ld [hl], a
+ ld [hSCY], a
+ ret
+.asm_932a3
+ ld hl, $b
+ add hl, bc
+ xor a
+ ld [hl], a
+ ld [hSCY], a
+ ret
+
+Function932ac: ; 932ac (24:72ac)
+ ld hl, $b
+ add hl, bc
+ ld e, [hl]
+ ld d, 0
+ ld hl, Jumptable_932bc
+rept 2
+ add hl, de
+endr
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ jp [hl]
+
+Jumptable_932bc: ; 932bc (24:72bc)
+ dw Function932c2
+ dw Function932e0
+ dw Function932fc
+
+
+Function932c2: ; 932c2 (24:72c2)
+ ld hl, $4
+ add hl, bc
+ ld a, [hl]
+ inc [hl]
+ cp $68
+ jr z, .asm_932d6
+ and $f
+ ret nz
+ ld de, SFX_JUMP_OVER_LEDGE
+ call PlaySFX
+ ret
+.asm_932d6
+ ld hl, $b
+ add hl, bc
+ inc [hl]
+ ld a, $1
+ ld [wcf64], a
+
+Function932e0: ; 932e0 (24:72e0)
+ ld a, [wcf64]
+ cp $2
+ jr z, .asm_932f1
+ cp $5
+ ret nz
+ ld hl, 0
+ add hl, bc
+ ld [hl], $0
+ ret
+.asm_932f1
+ ld hl, $b
+ add hl, bc
+ inc [hl]
+ ld hl, $c
+ add hl, bc
+ ld [hl], $8
+
+Function932fc: ; 932fc (24:72fc)
+ ld hl, $c
+ add hl, bc
+ ld a, [hl]
+ and a
+ jr z, .asm_93306
+ dec [hl]
+ ret
+.asm_93306
+ ld hl, $b
+ add hl, bc
+ dec [hl]
+ push bc
+ ld de, $606c
+ ld a, $8
+ call Function3b2a
+ pop bc
+ ret
+; 93316 (24:7316)
+
+Function93316: ; 93316
+ push bc
+ ld c, 16
+ call DelayFrames
+ pop bc
+ ret
+; 9331e
+
+Function9331e: ; 9331e (24:731e)
+ push de
+ ld e, a
+ ld d, 0
+ call PlaySFX
+ pop de
+ ret
+; 93327 (24:7327)
+
+Unknown_93327: ; 93327
+ db $00, $08, $14, $0c, $10, $00, $08, $14, $0c, $10, $04, $08, $14, $0c, $10, $00, $08, $14
+Unknown_93339: ; 93339
+ db $00, $0c, $08, $10, $14, $04, $0c, $08, $10, $14, $04, $0c, $08, $10, $14, $00, $0c, $08
+Unknown_9334b: ; 9334b
+ db $00, $0c, $08, $10, $14, $0c, $08, $10, $14, $0c, $04, $08, $10, $14, $0c, $00, $0c, $08
+; 9335d
+
+SlotsTilemap: ; 9335d
+INCBIN "gfx/slots.tilemap"
+; 9344d
+
+Slots1LZ: ; 9344d
+INCBIN "gfx/slots_1.2bpp.lz"
+; 935cd
+
+Slots2LZ: ; 935cd
+INCBIN "gfx/slots_2.2bpp.lz"
+; 9382d
+
+Slots3LZ: ; 9382d
+INCBIN "gfx/slots_3.2bpp.lz"
+; 93a3d
--- a/engine/specials.asm
+++ b/engine/specials.asm
@@ -65,14 +65,14 @@
add_special Special_SlotMachine
add_special Special_CardFlip
add_special Special_DummyNonfunctionalGameCornerGame
- add_special Special_WhiteBGMapBufferScreen
- add_special FadeBlackBGMap
+ add_special Special_ClearBGPalettesBufferScreen
+ add_special FadeOutPalettes
add_special Special_BattleTowerFade
add_special Special_FadeBlackQuickly
- add_special FadeInBGMap
+ add_special FadeInPalettes
add_special Special_FadeInQuickly
add_special Special_ReloadSpritesNoPalettes
- add_special WhiteBGMap
+ add_special ClearBGPalettes
add_special UpdateTimePals
add_special ClearTileMap
add_special UpdateSprites
@@ -465,8 +465,8 @@
db "@"
; 0xc3db
-Special_WhiteBGMapBufferScreen: ; c3db
- call WhiteBGMap
+Special_ClearBGPalettesBufferScreen: ; c3db
+ call ClearBGPalettes
call BufferScreen
ret
; c3e2
--- a/engine/startmenu.asm
+++ b/engine/startmenu.asm
@@ -139,7 +139,7 @@
; 126b7
.Clear ; 126b7
- call WhiteBGMap
+ call ClearBGPalettes
call Call_ExitMenu
call Function2bae
call .DrawMenuAccount_
@@ -529,7 +529,7 @@
.choosemenu
xor a
ld [PartyMenuActionText], a ; Choose a POKéMON.
- call WhiteBGMap
+ call ClearBGPalettes
.menu
callba Function5004f
@@ -1449,7 +1449,7 @@
; 12f50
MonMenu_SweetScent: ; 12f50
- callba DoMovementFunctionc
+ callba SweetScentFromMenu
ld b, $4
ld a, $2
ret
@@ -1466,7 +1466,7 @@
ld a, b
ld [Options], a
push af
- call WhiteBGMap
+ call ClearBGPalettes
pop af
ret
; 12f73
@@ -1527,7 +1527,7 @@
call MoveScreenLoop
pop af
ld [Options], a
- call WhiteBGMap
+ call ClearBGPalettes
.egg
ld a, $0
@@ -1753,7 +1753,7 @@
; 13172
SetUpMoveScreenBG: ; 13172
- call WhiteBGMap
+ call ClearBGPalettes
call ClearTileMap
call ClearSprites
xor a
--- a/engine/std_scripts.asm
+++ b/engine/std_scripts.asm
@@ -302,7 +302,7 @@
end
BugContestResultsWarpScript:
- special WhiteBGMap
+ special ClearBGPalettes
scall BugContestResults_CopyContestantsToResults
setevent EVENT_ROUTE_36_NATIONAL_PARK_GATE_OFFICER_CONTEST_DAY
clearevent EVENT_ROUTE_36_NATIONAL_PARK_GATE_OFFICER_NOT_CONTEST_DAY
--- a/engine/timeofdaypals.asm
+++ b/engine/timeofdaypals.asm
@@ -116,7 +116,7 @@
ret
; 8c079
-FadeInBGMap:: ; 8c079
+FadeInPalettes:: ; 8c079
ld c, $12
call GetTimePalFade
ld b, $4
@@ -124,7 +124,7 @@
ret
; 8c084
-FadeBlackBGMap:: ; 8c084
+FadeOutPalettes:: ; 8c084
call Function8c0c1
ld c, $9
call GetTimePalFade
--- a/engine/title.asm
+++ b/engine/title.asm
@@ -1,6 +1,6 @@
_TitleScreen: ; 10ed67
- call WhiteBGMap
+ call ClearBGPalettes
call ClearSprites
call ClearTileMap
--- /dev/null
+++ b/event/basement_key.asm
@@ -1,0 +1,34 @@
+_BasementKey: ; 507b4
+; Are we even in the right map to use this?
+ ld a, [MapGroup]
+ cp GROUP_WAREHOUSE_ENTRANCE
+ jr nz, .nope
+
+ ld a, [MapNumber]
+ cp MAP_WAREHOUSE_ENTRANCE
+ jr nz, .nope
+; Are we on the tile in front of the door?
+ call GetFacingTileCoord
+ ld a, d
+ cp 22
+ jr nz, .nope
+ ld a, e
+ cp 10
+ jr nz, .nope
+; Let's use the Basement Key
+ ld hl, .BasementKeyScript
+ call QueueScript
+ ld a, 1
+ ld [wd0ec], a
+ ret
+
+.nope
+ ld a, $0
+ ld [wd0ec], a
+ ret
+; 507e1
+
+.BasementKeyScript: ; 0x507e1
+ loadmovesprites
+ farjump BasementDoorScript
+; 0x507e6
--- /dev/null
+++ b/event/card_key.asm
@@ -1,0 +1,39 @@
+_CardKey: ; 50779
+; Are we even in the right map to use this?
+ ld a, [MapGroup]
+ cp GROUP_RADIO_TOWER_3F
+ jr nz, .nope
+
+ ld a, [MapNumber]
+ cp MAP_RADIO_TOWER_3F
+ jr nz, .nope
+; Are we facing the slot?
+ ld a, [PlayerDirection]
+ and $c
+ cp OW_UP
+ jr nz, .nope
+
+ call GetFacingTileCoord
+ ld a, d
+ cp 18
+ jr nz, .nope
+ ld a, e
+ cp 6
+ jr nz, .nope
+; Let's use the Card Key.
+ ld hl, .CardKeyScript
+ call QueueScript
+ ld a, $1
+ ld [wd0ec], a
+ ret
+
+.nope
+ ld a, $0
+ ld [wd0ec], a
+ ret
+; 507af
+
+.CardKeyScript: ; 0x507af
+ loadmovesprites
+ farjump MapRadioTower3FSignpost2Script
+; 0x507b4
--- /dev/null
+++ b/event/poisonstep.asm
@@ -1,0 +1,162 @@
+DoPoisonStep:: ; 505da
+ ld a, [PartyCount]
+ and a
+ jr z, .no_faint
+
+ xor a
+ ld c, 7
+ ld hl, EngineBuffer1
+.loop_clearEngineBuffer1
+ ld [hli], a
+ dec c
+ jr nz, .loop_clearEngineBuffer1
+
+ xor a
+ ld [CurPartyMon], a
+.loop_check_poison
+ call .DamageMonIfPoisoned
+ jr nc, .not_poisoned
+; the output flag is stored in c, copy it to the ([CurPartyMon] + 2)nd EngineBuffer
+; and set the corresponding flag in EngineBuffer1
+ ld a, [CurPartyMon]
+ ld e, a
+ ld d, 0
+ ld hl, EngineBuffer2
+ add hl, de
+ ld [hl], c
+ ld a, [EngineBuffer1]
+ or c
+ ld [EngineBuffer1], a
+
+.not_poisoned
+ ld a, [PartyCount]
+ ld hl, CurPartyMon
+ inc [hl]
+ cp [hl]
+ jr nz, .loop_check_poison
+
+ ld a, [EngineBuffer1]
+ and %10
+ jr nz, .someone_has_fainted
+ ld a, [EngineBuffer1]
+ and %01
+ jr z, .no_faint
+ call .PlayPoisonSFX
+ xor a
+ ret
+
+.someone_has_fainted
+ ld a, BANK(.Script_MonFaintedToPoison)
+ ld hl, .Script_MonFaintedToPoison
+ call CallScript
+ scf
+ ret
+
+.no_faint
+ xor a
+ ret
+; 5062e
+
+.DamageMonIfPoisoned: ; 5062e
+; check if mon is poisoned, return if not
+ ld a, MON_STATUS
+ call GetPartyParamLocation
+ ld a, [hl]
+ and 1 << PSN
+ ret z
+
+; check if mon is already fainted, return if so
+ ld a, MON_HP
+ call GetPartyParamLocation
+ ld a, [hli]
+ ld b, a
+ ld c, [hl]
+ or c
+ ret z
+
+; do 1 HP damage
+ dec bc
+ ld [hl], c
+ dec hl
+ ld [hl], b
+
+; check if mon has fainted as a result of poison damage
+ ld a, b
+ or c
+ jr nz, .not_fainted
+
+; the mon has fainted, reset its status, set carry, and return %10
+ ld a, MON_STATUS
+ call GetPartyParamLocation
+ ld [hl], 0
+ ld c, %10
+ scf
+ ret
+
+.not_fainted
+; set carry and return %01
+ ld c, %01
+ scf
+ ret
+; 50658
+
+.PlayPoisonSFX: ; 50658
+ ld de, SFX_POISON
+ call PlaySFX
+ ld b, $2
+ predef Functioncbcdd
+ call DelayFrame
+ ret
+; 50669
+
+.Script_MonFaintedToPoison: ; 50669
+ callasm .PlayPoisonSFX
+ loadfont
+ callasm .CheckWhitedOut
+ iffalse .whiteout
+ loadmovesprites
+ end
+; 50677
+
+.whiteout: ; 50677
+ farjump Script_OverworldWhiteout
+; 5067b
+
+.CheckWhitedOut: ; 5067b
+ xor a
+ ld [CurPartyMon], a
+ ld de, EngineBuffer2
+.party_loop
+ push de
+ ld a, [de]
+ and %10
+ jr z, .mon_not_fainted
+ ld c, HAPPINESS_POISONFAINT
+ callba ChangeHappiness
+ callba GetPartyNick
+ ld hl, .PoisonFaintText
+ call PrintText
+
+.mon_not_fainted
+ pop de
+ inc de
+ ld hl, CurPartyMon
+ inc [hl]
+ ld a, [PartyCount]
+ cp [hl]
+ jr nz, .party_loop
+ predef CheckPlayerPartyForFitPkmn
+ ld a, d
+ ld [ScriptVar], a
+ ret
+; 506b2
+
+.PoisonFaintText: ; 506b2
+ text_jump UnknownText_0x1c0acc
+ db "@"
+; 506b7
+
+.PoisonWhiteOutText: ; 506b7
+ text_jump UnknownText_0x1c0ada
+ db "@"
+; 506bc
--- /dev/null
+++ b/event/sacred_ash.asm
@@ -1,0 +1,74 @@
+
+_SacredAsh: ; 507e6
+ ld a, $0
+ ld [wd0ec], a
+ call CheckAnyFaintedMon
+ ret nc
+
+ ld hl, SacredAshScript
+ call QueueScript
+ ld a, $1
+ ld [wd0ec], a
+ ret
+; 507fb
+
+CheckAnyFaintedMon: ; 507fb
+ ld de, PARTYMON_STRUCT_LENGTH
+ ld bc, PartySpecies
+ ld hl, PartyMon1HP
+ ld a, [PartyCount]
+ and a
+ ret z
+
+.loop
+ push af
+ push hl
+ ld a, [bc]
+ inc bc
+ cp EGG
+ jr z, .next
+
+ ld a, [hli]
+ or [hl]
+ jr z, .done
+
+.next
+ pop hl
+ add hl, de
+ pop af
+ dec a
+ jr nz, .loop
+ xor a
+ ret
+
+.done
+ pop hl
+ pop af
+ scf
+ ret
+; 50821
+
+SacredAshScript: ; 0x50821
+ special HealParty
+ reloadmappart
+ playsound SFX_WARP_TO
+ special FadeOutPalettes
+ special FadeInPalettes
+ special FadeOutPalettes
+ special FadeInPalettes
+ special FadeOutPalettes
+ special FadeInPalettes
+ waitbutton
+ writetext UnknownText_0x50845
+ playsound SFX_CAUGHT_MON
+ waitbutton
+ closetext
+ loadmovesprites
+ end
+; 0x50845
+
+UnknownText_0x50845: ; 0x50845
+ ; 's #MON were all healed!
+ text_jump UnknownText_0x1c0b65
+ db "@"
+; 0x5084a
--- /dev/null
+++ b/event/squirtbottle.asm
@@ -1,0 +1,51 @@
+_Squirtbottle: ; 50730
+ ld hl, UnknownScript_0x5073c
+ call QueueScript
+ ld a, $1
+ ld [wd0ec], a
+ ret
+; 5073c
+
+UnknownScript_0x5073c: ; 0x5073c
+ reloadmappart
+ special UpdateTimePals
+ callasm Function50753
+ iffalse UnknownScript_0x5074b
+ farjump WateredWeirdTreeScript
+; 0x5074b
+
+UnknownScript_0x5074b: ; 0x5074b
+ jumptext UnknownText_0x5074e
+; 0x5074e
+
+UnknownText_0x5074e: ; 0x5074e
+ ; sprinkled water. But nothing happened…
+ text_jump UnknownText_0x1c0b3b
+ db "@"
+; 0x50753
+
+Function50753: ; 50753
+ ld a, [MapGroup]
+ cp GROUP_ROUTE_36
+ jr nz, .asm_50774
+
+ ld a, [MapNumber]
+ cp MAP_ROUTE_36
+ jr nz, .asm_50774
+
+ callba GetFacingObject
+ jr c, .asm_50774
+
+ ld a, d
+ cp $17
+ jr nz, .asm_50774
+
+ ld a, $1
+ ld [ScriptVar], a
+ ret
+
+.asm_50774
+ xor a
+ ld [ScriptVar], a
+ ret
+; 50779
--- /dev/null
+++ b/event/sweet_scent.asm
@@ -1,0 +1,75 @@
+SweetScentFromMenu: ; 506bc
+ ld hl, UnknownScript_0x506c8
+ call QueueScript
+ ld a, $1
+ ld [wd0ec], a
+ ret
+; 506c8
+
+UnknownScript_0x506c8: ; 0x506c8
+ reloadmappart
+ special UpdateTimePals
+ callasm GetPartyNick
+ writetext UnknownText_0x50726
+ closetext
+ callasm SweetScentEncounter
+ iffalse UnknownScript_0x506e9
+ checkflag ENGINE_BUG_CONTEST_TIMER
+ iftrue UnknownScript_0x506e5
+ battlecheck
+ startbattle
+ returnafterbattle
+ end
+; 0x506e5
+
+UnknownScript_0x506e5: ; 0x506e5
+ farjump BugCatchingContestBattleScript
+; 0x506e9
+
+UnknownScript_0x506e9: ; 0x506e9
+ writetext UnknownText_0x5072b
+ closetext
+ loadmovesprites
+ end
+; 0x506ef
+
+SweetScentEncounter: ; 506ef
+ callba CanUseSweetScent
+ jr nc, .no_battle
+ ld hl, StatusFlags2
+ bit 2, [hl]
+ jr nz, .not_in_bug_contest
+ callba GetMapEncounterRate
+ ld a, b
+ and a
+ jr z, .no_battle
+ callba ChooseWildEncounter
+ jr nz, .no_battle
+ jr .start_battle
+
+.not_in_bug_contest
+ callba ChooseWildEncounter_BugContest
+
+.start_battle
+ ld a, $1
+ ld [ScriptVar], a
+ ret
+
+.no_battle
+ xor a
+ ld [ScriptVar], a
+ ld [BattleType], a
+ ret
+; 50726
+
+UnknownText_0x50726: ; 0x50726
+ ; used SWEET SCENT!
+ text_jump UnknownText_0x1c0b03
+ db "@"
+; 0x5072b
+
+UnknownText_0x5072b: ; 0x5072b
+ ; Looks like there's nothing here…
+ text_jump UnknownText_0x1c0b1a
+ db "@"
+; 0x50730
--- a/event/whiteout.asm
+++ b/event/whiteout.asm
@@ -10,7 +10,7 @@
Script_Whiteout: ; 0x124ce
writetext .WhitedOutText
closetext
- special FadeBlackBGMap
+ special FadeOutPalettes
pause 40
special HealParty
checkflag ENGINE_BUG_CONTEST_TIMER
binary files /dev/null b/gfx/overworld/chris_fish.2bpp differ
binary files /dev/null b/gfx/overworld/kris_fish.2bpp differ
binary files a/gfx/unknown/0b84f2.2bpp /dev/null differ
binary files a/gfx/unknown/0b8582.2bpp /dev/null differ
--- a/home.asm
+++ b/home.asm
@@ -530,7 +530,7 @@
; 31f3
-WhiteBGMap:: ; 31f3
+ClearBGPalettes:: ; 31f3
call ClearPalettes
WaitBGMap:: ; 31f6
; Tell VBlank to update BG Map
--- a/home/audio.asm
+++ b/home/audio.asm
@@ -1,6 +1,6 @@
; Audio interfaces.
-SoundRestart:: ; 3b4e
+MapSetup_Sound_Off:: ; 3b4e
push hl
push de
@@ -9,11 +9,11 @@
ld a, [hROMBank]
push af
- ld a, BANK(_SoundRestart)
+ ld a, BANK(_MapSetup_Sound_Off)
ld [hROMBank], a
ld [MBC3RomBank], a
- call _SoundRestart
+ call _MapSetup_Sound_Off
pop af
ld [hROMBank], a
@@ -81,7 +81,7 @@
ld a, [hROMBank]
push af
- ld a, BANK(_PlayMusic) ; and BANK(_SoundRestart)
+ ld a, BANK(_PlayMusic) ; and BANK(_MapSetup_Sound_Off)
ld [hROMBank], a
ld [MBC3RomBank], a
@@ -93,7 +93,7 @@
jr .end
.nomusic
- call _SoundRestart
+ call _MapSetup_Sound_Off
.end
pop af
--- a/home/init.asm
+++ b/home/init.asm
@@ -1,6 +1,6 @@
Reset:: ; 150
di
- call SoundRestart
+ call MapSetup_Sound_Off
xor a
ld [hMapAnims], a
call ClearPalettes
@@ -168,7 +168,7 @@
predef Function9853
- call SoundRestart
+ call MapSetup_Sound_Off
xor a
ld [wMapMusic], a
jp GameInit
--- a/home/map.asm
+++ b/home/map.asm
@@ -209,8 +209,8 @@
ret
; 222a
-Function222a:: ; 222a
- ld a, MAPSETUP_10
+ReturnToMapFromSubmenu:: ; 222a
+ ld a, MAPSETUP_SUBMENU
ld [hMapEntryMethod], a
callba RunMapSetupScript
xor a
@@ -1099,6 +1099,7 @@
; 26c7
GetMovementData:: ; 26c7
+; Initialize the movement data for person c at b:hl
ld a, [hROMBank]
push af
ld a, b
@@ -1105,7 +1106,7 @@
rst Bankswitch
ld a, c
- call Function19e9
+ call LoadMovementDataPointer
pop hl
ld a, h
@@ -1964,7 +1965,7 @@
xor a
ld [hBGMapMode], a
call LoadStandardMenuDataHeader
- callba FadeBlackBGMap
+ callba FadeOutPalettes
call ClearSprites
call DisableSpriteUpdates
ret
@@ -1972,7 +1973,7 @@
Function2b3c:: ; 2b3c
- call WhiteBGMap
+ call ClearBGPalettes
call Function2bae
call UpdateSprites
call Call_ExitMenu
@@ -1981,7 +1982,7 @@
; 2b4d
Function2b4d:: ; 2b4d
- call WhiteBGMap
+ call ClearBGPalettes
call Call_ExitMenu
call Function2bae
call UpdateSprites
@@ -1993,7 +1994,7 @@
call GetSGBLayout
callba Function49409
call Function3200
- callba FadeInBGMap
+ callba FadeInPalettes
call EnableSpriteUpdates
ret
; 2b74
@@ -2003,7 +2004,7 @@
push af
ld a, $1
ld [wc2ce], a
- call WhiteBGMap
+ call ClearBGPalettes
call ClearSprites
call Function2bae
hlcoord 0, 12
--- a/home/map_objects.asm
+++ b/home/map_objects.asm
@@ -428,7 +428,8 @@
-Function19e9:: ; 19e9
+LoadMovementDataPointer:: ; 19e9
+; Load the movement data pointer for person a.
ld [wMovementPerson], a
ld a, [hROMBank]
ld [wMovementDataPointer], a
@@ -439,12 +440,15 @@
ld a, [wMovementPerson]
call CheckObjectVisibility
ret c
+
ld hl, OBJECT_MOVEMENTTYPE
add hl, bc
ld [hl], SPRITEMOVEDATA_SCRIPTED
+
ld hl, OBJECT_09
add hl, bc
ld [hl], 0
+
ld hl, VramState
set 7, [hl]
and a
@@ -589,14 +593,15 @@
; 1aae
Function1aae:: ; 1aae
+; Switch to the movement data bank
ld a, [hROMBank]
push af
ld a, [hli]
rst Bankswitch
-
+; Load the current script byte as given by OBJECT_MOVEMENT_BYTE_INDEX, and increment OBJECT_MOVEMENT_BYTE_INDEX
ld a, [hli]
ld d, [hl]
- ld hl, OBJECT_27
+ ld hl, OBJECT_MOVEMENT_BYTE_INDEX
add hl, bc
add [hl]
ld e, a
--- a/home/serial.asm
+++ b/home/serial.asm
@@ -6,7 +6,7 @@
push de
push hl
- ld a, [$ffc9]
+ ld a, [hFFC9]
and a
jr nz, .asm_71c
@@ -77,7 +77,7 @@
.asm_752
ld a, $1
- ld [$ffca], a
+ ld [hFFCA], a
ld a, $fe
ld [hSerialSend], a
@@ -91,7 +91,7 @@
Function75f:: ; 75f
ld a, $1
- ld [$ffcc], a
+ ld [hFFCC], a
.asm_763
ld a, [hl]
ld [hSerialSend], a
@@ -103,7 +103,7 @@
.asm_76e
dec a
jr nz, .asm_76e
- ld a, [$ffcc]
+ ld a, [hFFCC]
and a
ld a, b
pop bc
@@ -112,7 +112,7 @@
cp $fd
jr nz, .asm_763
xor a
- ld [$ffcc], a
+ ld [hFFCC], a
jr .asm_763
.asm_782
@@ -127,7 +127,7 @@
Function78a:: ; 78a
xor a
- ld [$ffca], a
+ ld [hFFCA], a
ld a, [hLinkPlayerNumber]
cp $2
jr nz, .asm_79b
@@ -137,7 +137,7 @@
ld [rSC], a
.asm_79b
- ld a, [$ffca]
+ ld a, [hFFCA]
and a
jr nz, .asm_7e5
ld a, [hLinkPlayerNumber]
@@ -182,7 +182,7 @@
.asm_7e5
xor a
- ld [$ffca], a
+ ld [hFFCA], a
ld a, [rIE]
and $f
sub $8
@@ -251,7 +251,7 @@
ld de, wcf51
ld c, $2
ld a, $1
- ld [$ffcc], a
+ ld [hFFCC], a
.asm_847
call DelayFrame
ld a, [hl]
@@ -259,10 +259,10 @@
call Function78a
ld b, a
inc hl
- ld a, [$ffcc]
+ ld a, [hFFCC]
and a
ld a, $0
- ld [$ffcc], a
+ ld [hFFCC], a
jr nz, .asm_847
ld a, b
ld [de], a
--- a/hram.asm
+++ b/hram.asm
@@ -68,14 +68,18 @@
hUsedSpriteIndex EQU $ffbd
hUsedSpriteTile EQU $ffbe
+hFFBF EQU $ffbf
+hFFC0 EQU $ffc0
+hFFC1 EQU $ffc1
+hFFC2 EQU $ffc2
hMoneyTemp EQU $ffc3
hLCDStatCustom EQU $ffc6
hFFC9 EQU $ffc9
-
+hFFCA EQU $ffca
hLinkPlayerNumber EQU $ffcb
-
+hFFCC EQU $ffcc
hSerialSend EQU $ffcd
hSerialReceive EQU $ffce
--- a/items/item_effects.asm
+++ b/items/item_effects.asm
@@ -714,7 +714,7 @@
and a
jr z, .toss
- call WhiteBGMap
+ call ClearBGPalettes
call ClearTileMap
.toss
@@ -1866,7 +1866,7 @@
push hl
push de
push bc
- call WhiteBGMap
+ call ClearBGPalettes
call Functionf21c
pop bc
pop de
--- a/macros/movement.asm
+++ b/macros/movement.asm
@@ -303,18 +303,46 @@
db movement_hide_person ; $3d
endm
- enum movement_show_person
-show_person: macro
- db movement_show_person ; $3e
+ enum movement_step_sleep_1
+step_sleep_1: macro
+ db movement_step_sleep_1 ; $3e
endm
-__enum__ = $45
+ enum movement_step_sleep_2
+step_sleep_2: macro
+ db movement_step_sleep_2 ; $3f
+ endm
- enum movement_accelerate_last
-accelerate_last: macro
- db movement_accelerate_last ; $45
+ enum movement_step_sleep_3
+step_sleep_3: macro
+ db movement_step_sleep_3 ; $40
endm
+ enum movement_step_sleep_4
+step_sleep_4: macro
+ db movement_step_sleep_4 ; $41
+ endm
+
+ enum movement_step_sleep_5
+step_sleep_5: macro
+ db movement_step_sleep_5 ; $42
+ endm
+
+ enum movement_step_sleep_6
+step_sleep_6: macro
+ db movement_step_sleep_6 ; $43
+ endm
+
+ enum movement_step_sleep_7
+step_sleep_7: macro
+ db movement_step_sleep_7 ; $44
+ endm
+
+ enum movement_step_sleep_8
+step_sleep_8: macro
+ db movement_step_sleep_8 ; $45
+ endm
+
enum movement_step_sleep
step_sleep: macro
db movement_step_sleep ; $46
@@ -333,6 +361,11 @@
db movement_remove_person ; $49
endm
+ enum movement_step_loop
+step_loop: macro
+ db movement_step_loop ; $4a
+ endm
+
__enum__ = $4c
enum movement_teleport_from
@@ -362,9 +395,9 @@
db movement_fish_got_bite ; $51
endm
- enum movement_fish_got_bite_2
-fish_got_bite_2: macro
- db movement_fish_got_bite_2 ; $52
+ enum movement_fish_cast_rod
+fish_cast_rod: macro
+ db movement_fish_cast_rod ; $52
endm
enum movement_hide_emote
--- a/main.asm
+++ b/main.asm
@@ -439,7 +439,7 @@
ld [MusicFadeIDLo], a
ld a, MUSIC_NONE / $100
ld [MusicFadeIDHi], a
- call WhiteBGMap
+ call ClearBGPalettes
call Function5df0
call WriteBackup
call ClearTileMap
@@ -451,7 +451,7 @@
ld a, [wSpawnAfterChampion]
cp SPAWN_LANCE
jr z, .SpawnAfterE4
- ld a, MAPSETUP_02
+ ld a, MAPSETUP_CONTINUE
ld [hMapEntryMethod], a
jp FinishContinueFunction
@@ -1085,7 +1085,7 @@
jr nc, .loop
call ClearSprites
- call WhiteBGMap
+ call ClearBGPalettes
pop af
ld [rSVBK], a
@@ -1467,7 +1467,7 @@
GameInit:: ; 642e
callba Function14f1c
call ResetTextRelatedRAM
- call WhiteBGMap
+ call ClearBGPalettes
call ClearTileMap
ld a, VBGMap0 / $100
ld [hBGMapAddress + 1], a
@@ -3186,7 +3186,7 @@
call DisableSpriteUpdates
xor a
ld [hBGMapMode], a
- call WhiteBGMap
+ call ClearBGPalettes
call ClearSprites
hlcoord 0, 0
ld bc, TileMapEnd - TileMap
@@ -3603,6 +3603,7 @@
ld hl, OBJECT_MAP_OBJECT_INDEX
add hl, de
ld [hl], a
+
ld a, [wc2f4]
call Function1a61
ld a, [wc2f3]
@@ -3610,30 +3611,39 @@
add hl, de
or [hl]
ld [hl], a
+
ld a, [wc2f7]
call Function82d5
+
ld a, [wc2f6]
call Function82f1
+
ld a, [wc2f1]
ld hl, OBJECT_SPRITE
add hl, de
ld [hl], a
+
ld a, [wc2f2]
ld hl, OBJECT_SPRITE_TILE
add hl, de
ld [hl], a
+
ld hl, OBJECT_09
add hl, de
ld [hl], $0
+
ld hl, OBJECT_FACING_STEP
add hl, de
ld [hl], $ff
+
ld a, [wc2f8]
call Function830d
+
ld a, [wc2f5]
ld hl, OBJECT_32
add hl, de
ld [hl], a
+
and a
ret
; 82d5
@@ -3694,7 +3704,7 @@
TrainerWalkToPlayer: ; 831e
ld a, [hLastTalked]
call InitMovementBuffer
- ld a, movement_show_person
+ ld a, movement_step_sleep_1
call AppendToMovementBuffer
ld a, [wd03f]
dec a
@@ -5269,7 +5279,7 @@
special WarpToSpawnPoint
callasm DelayLoadingNewSprites
writecode VAR_MOVEMENT, $0
- newloadmap MAPSETUP_12
+ newloadmap MAPSETUP_FLY
callasm Function8cb33
special WaitSFX
callasm Functioncacb
@@ -5537,7 +5547,7 @@
farscall Script_AbortBugContest
special WarpToSpawnPoint
writecode VAR_MOVEMENT, $0
- newloadmap MAPSETUP_05
+ newloadmap MAPSETUP_DOOR
playsound SFX_WARP_FROM
applymovement PLAYER, MovementData_0xcc5d
end
@@ -5635,7 +5645,7 @@
farscall Script_AbortBugContest
special WarpToSpawnPoint
writecode VAR_MOVEMENT, $0
- newloadmap MAPSETUP_04
+ newloadmap MAPSETUP_TELEPORT
playsound SFX_WARP_FROM
applymovement PLAYER, MovementData_0xcce3
end
@@ -6333,7 +6343,7 @@
fish_got_bite
fish_got_bite
fish_got_bite
- show_person
+ step_sleep_1
show_emote
step_end
; d069
@@ -6340,7 +6350,7 @@
MovementData_0xd069: ; d069
hide_emote
- fish_got_bite_2
+ fish_cast_rod
step_end
; d06c
@@ -6362,7 +6372,7 @@
loadvar hBGMapMode, $0
special UpdateTimePals
loademote EMOTE_09
- callasm Functionb84b3
+ callasm LoadFishingGFX
loademote EMOTE_SHOCK
applymovement PLAYER, MovementData_0xd093
pause 40
@@ -6370,7 +6380,7 @@
; 0xd093
MovementData_0xd093: ; d093
- fish_got_bite_2
+ fish_cast_rod
step_end
; d095
@@ -9801,7 +9811,7 @@
ret
Functione443: ; e443 (3:6443)
- ld hl, MenuDataHeader_0xe46f
+ ld hl, .MenuDataHeader
call LoadMenuDataHeader
ld a, $1
.loop
@@ -9815,7 +9825,7 @@
ld a, [wMenuCursorBuffer]
push af
ld a, [MenuSelection]
- ld hl, Jumptable_e4ba
+ ld hl, .Jumptable
rst JumpTable
pop bc
ld a, b
@@ -9825,23 +9835,23 @@
ret
; e46f (3:646f)
-MenuDataHeader_0xe46f: ; 0xe46f
+.MenuDataHeader: ; 0xe46f
db $40 ; flags
db 00, 00 ; start coords
db 17, 19 ; end coords
- dw MenuData2_0xe477
+ dw .MenuData2
db 1 ; default option
; 0xe477
-MenuData2_0xe477: ; 0xe477
+.MenuData2: ; 0xe477
db $80 ; flags
db 0 ; items
- dw MenuItems_e4c4
+ dw .items
dw Function1f79
- dw Strings_e47f
+ dw .strings
; 0xe47f
-Strings_e47f: ; e47f
+.strings: ; e47f
db "WITHDRAW <PK><MN>@"
db "DEPOSIT <PK><MN>@"
db "CHANGE BOX@"
@@ -9848,15 +9858,15 @@
db "MOVE <PK><MN> W/O MAIL@"
db "SEE YA!@"
-Jumptable_e4ba: ; e4ba (3:64ba)
- dw Functione559
- dw Functione4fe
- dw Functione583
- dw Functione4cd
- dw Functione4cb
+.Jumptable: ; e4ba (3:64ba)
+ dw BillsPC_WithdrawMenu
+ dw BillsPC_DepositMenu
+ dw BillsPC_ChangeBoxMenu
+ dw BillsPC_MovePKMNMenu
+ dw BillsPC_SeeYa
; e4c4
-MenuItems_e4c4: ; e4c4
+.items: ; e4c4
db 5
db 0 ; WITHDRAW
db 1; DEPOSIT
@@ -9866,27 +9876,27 @@
db -1
; e4cb
-Functione4cb: ; e4cb
+BillsPC_SeeYa: ; e4cb
scf
ret
; e4cd
-Functione4cd: ; e4cd
+BillsPC_MovePKMNMenu: ; e4cd
call LoadStandardMenuDataHeader
callba Function44781
- jr nc, .asm_e4e0
+ jr nc, .no_mail
ld hl, UnknownText_0xe4f9
call PrintText
- jr .asm_e4f4
+ jr .quit
-.asm_e4e0
+.no_mail
callba Function14b34
- jr c, .asm_e4f4
- callba Functione2759
- call Function222a
+ jr c, .quit
+ callba _MovePKMNWithoutMail
+ call ReturnToMapFromSubmenu
call ClearPCItemScreen
-.asm_e4f4
+.quit
call WriteBackup
and a
ret
@@ -9898,10 +9908,10 @@
db "@"
; 0xe4fe
-Functione4fe: ; e4fe (3:64fe)
+BillsPC_DepositMenu: ; e4fe (3:64fe)
call LoadStandardMenuDataHeader
- callba Functione2391
- call Function222a
+ callba _DepositPKMN
+ call ReturnToMapFromSubmenu
call ClearPCItemScreen
call WriteBackup
and a
@@ -9974,10 +9984,10 @@
; e559
-Functione559: ; e559 (3:6559)
+BillsPC_WithdrawMenu: ; e559 (3:6559)
call LoadStandardMenuDataHeader
- callba Functione2583
- call Function222a
+ callba _WithdrawPKMN
+ call ReturnToMapFromSubmenu
call ClearPCItemScreen
call WriteBackup
and a
@@ -10004,8 +10014,8 @@
db "@"
; 0xe583
-Functione583: ; e583 (3:6583)
- callba Functione35aa
+BillsPC_ChangeBoxMenu: ; e583 (3:6583)
+ callba _ChangeBox
and a
ret
@@ -10013,7 +10023,7 @@
call DisableSpriteUpdates
xor a
ld [hBGMapMode], a
- call WhiteBGMap
+ call ClearBGPalettes
call ClearSprites
hlcoord 0, 0
ld bc, SCREEN_HEIGHT * SCREEN_WIDTH
@@ -10395,7 +10405,7 @@
ret
Function11e9a: ; 11e9a (4:5e9a)
- call WhiteBGMap
+ call ClearBGPalettes
call DisableLCD
call Function11c51
ld de, VTiles0 tile $00
@@ -11635,7 +11645,7 @@
ret
.asm_156f9
- call WhiteBGMap
+ call ClearBGPalettes
ld c, $1
ret
; 156ff
@@ -13144,7 +13154,7 @@
push af
set NO_TEXT_SCROLL, a
ld [Options], a
- call WhiteBGMap
+ call ClearBGPalettes
call ClearTileMap
ld de, UnownDexATile
@@ -13225,7 +13235,7 @@
ld [Options], a
pop af
ld [hInMenu], a
- call Function222a
+ call ReturnToMapFromSubmenu
ret
; 16ca0
@@ -15710,7 +15720,7 @@
ret
Function2513b: ; 2513b (9:513b)
- call WhiteBGMap
+ call ClearBGPalettes
call ClearSprites
call ClearTileMap
call DisableLCD
@@ -17997,7 +18007,7 @@
INCLUDE "trainers/dvs.asm"
Function2715c: ; 2715c
- call WhiteBGMap
+ call ClearBGPalettes
call ClearTileMap
ld a, [BattleType]
cp BATTLETYPE_TUTORIAL
@@ -19614,7 +19624,7 @@
; 2c1b2
_ShowLinkBattleParticipants: ; 2c1b2
- call WhiteBGMap
+ call ClearBGPalettes
call LoadFontsExtra
hlcoord 2, 3
ld b, 9
@@ -20222,7 +20232,7 @@
ld de, wd066
ld bc, $c
call CopyBytes
- call WhiteBGMap
+ call ClearBGPalettes
Function2c80a: ; 2c80a
callba Function5004f
@@ -23442,7 +23452,7 @@
call FadeToMenu
xor a
ld [PartyMenuActionText], a
- call WhiteBGMap
+ call ClearBGPalettes
.asm_448dc
callba Function5004f
callba Function50405
@@ -23564,7 +23574,7 @@
ld a, c
and a
call z, Function48000
- call WhiteBGMap
+ call ClearBGPalettes
call Function48d3d
ld a, [wd479]
bit 1, a
@@ -23587,7 +23597,7 @@
lb bc, BANK(GFX_488cb), 1
call Request1bpp
call Function4a3a7
- call WhiteBGMap
+ call ClearBGPalettes
ld a, [wd002]
bit 6, a
jr z, .asm_4808a
@@ -23604,7 +23614,7 @@
call DelayFrames
ld b, $1
call Function4930f
- call WhiteBGMap
+ call ClearBGPalettes
hlcoord 0, 0
ld b, $2
ld c, $14
@@ -23698,7 +23708,7 @@
.asm_48177
jp Function48272
.asm_4817a
- call WhiteBGMap
+ call ClearBGPalettes
call Function48d30
pop bc
call ClearTileMap
@@ -23811,7 +23821,7 @@
call DelayFrames
.asm_4825c
- call WhiteBGMap
+ call ClearBGPalettes
call Function48d30
pop bc
call ClearTileMap
@@ -24223,7 +24233,7 @@
call DelayFrames
ld b, $1
call Function4930f
- call WhiteBGMap
+ call ClearBGPalettes
hlcoord 0, 0
ld b, $4
ld c, $14
@@ -25436,7 +25446,7 @@
ld [MusicFadeIDHi], a
ld c, 8
call DelayFrames
- call WhiteBGMap
+ call ClearBGPalettes
call Function48000
call LoadFontsExtra
hlcoord 0, 0
@@ -25505,7 +25515,7 @@
Function4925b: ; 4925b
call FadeToMenu
- call WhiteBGMap
+ call ClearBGPalettes
call ClearScreen
call DelayFrame
ld b, $14
@@ -26955,16 +26965,16 @@
; 49efc
MainMenu_Mobile: ; 49efc
- call WhiteBGMap
+ call ClearBGPalettes
ld a, MUSIC_MOBILE_ADAPTER_MENU
ld [wMapMusic], a
ld de, MUSIC_MOBILE_ADAPTER_MENU
call Function4a6c5
Function49f0a: ; 49f0a
- call WhiteBGMap
+ call ClearBGPalettes
call Function4a3a7
call Function4a492
- call WhiteBGMap
+ call ClearBGPalettes
Function49f16: ; 49f16
call Function4a071
ld c, 12
@@ -27021,7 +27031,7 @@
.asm_49f84
pop bc
- call WhiteBGMap
+ call ClearBGPalettes
call ClearTileMap
ld a, MUSIC_MAIN_MENU
ld [wMapMusic], a
@@ -27160,7 +27170,7 @@
ld c, $1
call Function4802f
push af
- call WhiteBGMap
+ call ClearBGPalettes
pop af
and a
jr nz, .asm_4a0f9
@@ -27173,9 +27183,9 @@
Function4a100: ; 4a100 (12:6100)
ld a, $2
call Function1ff8
- call WhiteBGMap
+ call ClearBGPalettes
call Function4a13b
- call WhiteBGMap
+ call ClearBGPalettes
call ClearTileMap
asm_4a111: ; 4a111 (12:6111)
@@ -27308,7 +27318,7 @@
ld a, $1
call Function1ff8
callba Function1719c8
- call WhiteBGMap
+ call ClearBGPalettes
call DelayFrame
jr Function4a239
@@ -27378,7 +27388,7 @@
jr z, .asm_4a33b
.asm_4a2df
callba Function11765d
- call WhiteBGMap
+ call ClearBGPalettes
call Call_ExitMenu
call LoadFontsExtra
scf
@@ -27610,7 +27620,7 @@
push bc
push de
callba MobileStudium
- call WhiteBGMap
+ call ClearBGPalettes
pop de
pop bc
ld a, b
@@ -27626,11 +27636,11 @@
Function4a4c4: ; 4a4c4 (12:64c4)
- call WhiteBGMap
+ call ClearBGPalettes
call Function4a3a7
call Function4a492
call Function4a680
- call WhiteBGMap
+ call ClearBGPalettes
ld c, 20
call DelayFrames
hlcoord 2, 0
@@ -27704,7 +27714,7 @@
call Function1ff8
.asm_4a574
pop bc
- call WhiteBGMap
+ call ClearBGPalettes
call ClearTileMap
jp Function49f0a
.asm_4a57e
@@ -27805,7 +27815,7 @@
Function4a6ab: ; 4a6ab (12:66ab)
ld a, $2
call Function1ff8
- call WhiteBGMap
+ call ClearBGPalettes
ld b, $8
call GetSGBLayout
callba Function11c1ab
@@ -28429,7 +28439,7 @@
; 0x4aa22
Function4aa22: ; 4aa22
- call WhiteBGMap
+ call ClearBGPalettes
Function4aa25: ; 4aa25
callba Function5004f
@@ -29524,7 +29534,7 @@
inc a
ld [MenuSelection2], a
call ClearScreen
- call WhiteBGMap
+ call ClearBGPalettes
call MaxVolume
callba Function28ef8
callba Function4d354
@@ -30745,13 +30755,13 @@
push bc
push hl
- call WhiteBGMap
+ call ClearBGPalettes
call ClearTileMap
call UpdateSprites
callba Functionfb53e
pop hl
call _hl_
- call WhiteBGMap
+ call ClearBGPalettes
call ClearTileMap
pop bc
@@ -30860,7 +30870,7 @@
MonStatsInit: ; 4dd72 (13:5d72)
ld hl, wcf64
res 6, [hl]
- call WhiteBGMap
+ call ClearBGPalettes
call ClearTileMap
callba Function10402d
call Function4ddf2
@@ -32140,1386 +32150,14 @@
SECTION "bank14", ROMX, BANK[$14]
-SelectMonFromParty: ; 50000
- call DisableSpriteUpdates
- xor a
- ld [PartyMenuActionText], a
- call WhiteBGMap
- call Function5003f
- call WaitBGMap
- call SetPalettes
- call DelayFrame
- call PartyMenuSelect
- call Function2b74
- ret
-; 5001d
+INCLUDE "engine/party_menu.asm"
+INCLUDE "event/poisonstep.asm"
+INCLUDE "event/sweet_scent.asm"
+INCLUDE "event/squirtbottle.asm"
+INCLUDE "event/card_key.asm"
+INCLUDE "event/basement_key.asm"
+INCLUDE "event/sacred_ash.asm"
-
-Function5001d: ; 5001d
- ld a, b
- ld [PartyMenuActionText], a
- call DisableSpriteUpdates
- call WhiteBGMap
- call Function5003f
- call WaitBGMap
- ld b, $a
- call GetSGBLayout
- call SetPalettes
- call DelayFrame
- call PartyMenuSelect
- call Function2b74
- ret
-; 5003f
-
-Function5003f: ; 5003f
- call Function5004f
- call Function50405
- call Function503e0
- call WritePartyMenuTilemap
- call PrintPartyMenuText
- ret
-; 5004f
-
-Function5004f: ; 5004f
- call LoadFontsBattleExtra
- callab Function8ad1 ; engine/color.asm
- callab InefficientlyClear121BytesAtwc300
- ret
-; 5005f
-
-
-WritePartyMenuTilemap: ; 0x5005f
- ld hl, Options
- ld a, [hl]
- push af
- set 4, [hl] ; Disable text delay
- xor a
- ld [hBGMapMode], a
- hlcoord 0, 0
- ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
- ld a, " "
- call ByteFill ; blank the tilemap
- call GetPartyMenuTilemapPointers ; This reads from a pointer table???
-.loop
- ld a, [hli]
- cp $ff
- jr z, .end ; 0x5007a $8
- push hl
- ld hl, .Jumptable
- rst JumpTable
- pop hl
- jr .loop ; 0x50082 $f3
-.end
- pop af
- ld [Options], a
- ret
-; 0x50089
-
-.Jumptable: ; 50089
- dw PlacePartyNicknames
- dw PlacePartyHPBar
- dw PlacePartyMenuHPDigits
- dw PlacePartyMonLevel
- dw PlacePartyMonStatus
- dw PlacePartyMonTMHMCompatibility
- dw PlacePartyMonEvoStoneCompatibility
- dw PlacePartyMonGender
- dw PlacePartyMonMobileBattleSelection
-; 5009b
-
-PlacePartyNicknames: ; 5009b
- hlcoord 3, 1
- ld a, [PartyCount]
- and a
- jr z, .end
- ld c, a
- ld b, $0
-.loop
- push bc
- push hl
- push hl
- ld hl, PartyMonNicknames
- ld a, b
- call GetNick
- pop hl
- call PlaceString
- pop hl
- ld de, 2 * SCREEN_WIDTH
- add hl, de
- pop bc
- inc b
- dec c
- jr nz, .loop
-
-.end
-rept 2
- dec hl
-endr
- ld de, .CANCEL
- call PlaceString
- ret
-; 500c8
-
-.CANCEL: ; 500c8
- db "CANCEL@"
-; 500cf
-
-
-PlacePartyHPBar: ; 500cf
- xor a
- ld [wcda9], a
- ld a, [PartyCount]
- and a
- ret z
- ld c, a
- ld b, $0
- hlcoord 11, 2
-.loop
- push bc
- push hl
- call PartyMenuCheckEgg
- jr z, .skip
- push hl
- call PlacePartymonHPBar
- pop hl
- ld d, $6
- ld b, $0
- call DrawBattleHPBar
- ld hl, wcd9b
- ld a, [wcda9]
- ld c, a
- ld b, $0
- add hl, bc
- call SetHPPal
- ld b, $fc
- call GetSGBLayout
-
-.skip
- ld hl, wcda9
- inc [hl]
- pop hl
- ld de, 2 * SCREEN_WIDTH
- add hl, de
- pop bc
- inc b
- dec c
- jr nz, .loop
- ld b, $a
- call GetSGBLayout
- ret
-; 50117
-
-PlacePartymonHPBar: ; 50117
- ld a, b
- ld bc, PARTYMON_STRUCT_LENGTH
- ld hl, PartyMon1HP
- call AddNTimes
- ld a, [hli]
- or [hl]
- jr nz, .not_fainted
- xor a
- ld e, a
- ld c, a
- ret
-
-.not_fainted
- dec hl
- ld a, [hli]
- ld b, a
- ld a, [hli]
- ld c, a
- ld a, [hli]
- ld d, a
- ld a, [hli]
- ld e, a
- predef DrawPartyMenuHPBar
- ret
-; 50138
-
-PlacePartyMenuHPDigits: ; 50138
- ld a, [PartyCount]
- and a
- ret z
- ld c, a
- ld b, $0
- hlcoord 13, 1
-.loop
- push bc
- push hl
- call PartyMenuCheckEgg
- jr z, .next
- push hl
- ld a, b
- ld bc, PARTYMON_STRUCT_LENGTH
- ld hl, PartyMon1HP
- call AddNTimes
- ld e, l
- ld d, h
- pop hl
- push de
- lb bc, 2, 3
- call PrintNum
- pop de
- ld a, "/"
- ld [hli], a
-rept 2
- inc de
-endr
- lb bc, 2, 3
- call PrintNum
-
-.next
- pop hl
- ld de, 2 * SCREEN_WIDTH
- add hl, de
- pop bc
- inc b
- dec c
- jr nz, .loop
- ret
-; 50176
-
-PlacePartyMonLevel: ; 50176
- ld a, [PartyCount]
- and a
- ret z
- ld c, a
- ld b, 0
- hlcoord 8, 2
-.loop
- push bc
- push hl
- call PartyMenuCheckEgg
- jr z, .next
- push hl
- ld a, b
- ld bc, PARTYMON_STRUCT_LENGTH
- ld hl, PartyMon1Level
- call AddNTimes
- ld e, l
- ld d, h
- pop hl
- ld a, [de]
- cp 100 ; This is distinct from MAX_LEVEL.
- jr nc, .ThreeDigits
- ld a, "<LV>"
- ld [hli], a
- lb bc, PRINTNUM_RIGHTALIGN | 1, 2
- ; jr .okay
-.ThreeDigits
- lb bc, PRINTNUM_RIGHTALIGN | 1, 3
-; .okay
- call PrintNum
-
-.next
- pop hl
- ld de, SCREEN_WIDTH * 2
- add hl, de
- pop bc
- inc b
- dec c
- jr nz, .loop
- ret
-; 501b2
-
-PlacePartyMonStatus: ; 501b2
- ld a, [PartyCount]
- and a
- ret z
- ld c, a
- ld b, 0
- hlcoord 5, 2
-.loop
- push bc
- push hl
- call PartyMenuCheckEgg
- jr z, .next
- push hl
- ld a, b
- ld bc, PARTYMON_STRUCT_LENGTH
- ld hl, PartyMon1Status
- call AddNTimes
- ld e, l
- ld d, h
- pop hl
- call PlaceStatusString
-
-.next
- pop hl
- ld de, SCREEN_WIDTH * 2
- add hl, de
- pop bc
- inc b
- dec c
- jr nz, .loop
- ret
-; 501e0
-
-PlacePartyMonTMHMCompatibility: ; 501e0
- ld a, [PartyCount]
- and a
- ret z
- ld c, a
- ld b, 0
- hlcoord 12, 2
-.loop
- push bc
- push hl
- call PartyMenuCheckEgg
- jr z, .next
- push hl
- ld hl, PartySpecies
- ld e, b
- ld d, 0
- add hl, de
- ld a, [hl]
- ld [CurPartySpecies], a
- predef CanLearnTMHMMove
- pop hl
- call .PlaceAbleNotAble
- call PlaceString
-
-.next
- pop hl
- ld de, SCREEN_WIDTH * 2
- add hl, de
- pop bc
- inc b
- dec c
- jr nz, .loop
- ret
-; 50215
-
-.PlaceAbleNotAble: ; 50215
- ld a, c
- and a
- jr nz, .able
- ld de, .string_not_able
- ret
-
-.able
- ld de, .string_able
- ret
-; 50221
-
-.string_able: ; 50221
- db "ABLE@"
-; 50226
-
-.string_not_able: ; 50226
- db "NOT ABLE@"
-; 5022f
-
-
-PlacePartyMonEvoStoneCompatibility: ; 5022f
- ld a, [PartyCount]
- and a
- ret z
- ld c, a
- ld b, 0
- hlcoord 12, 2
-.loop
- push bc
- push hl
- call PartyMenuCheckEgg
- jr z, .next
- push hl
- ld a, b
- ld bc, PARTYMON_STRUCT_LENGTH
- ld hl, PartyMon1Species
- call AddNTimes
- ld a, [hl]
- dec a
- ld e, a
- ld d, 0
- ld hl, EvosAttacksPointers
-rept 2
- add hl, de
-endr
- call .DetermineCompatibility
- pop hl
- call PlaceString
-
-.next
- pop hl
- ld de, 2 * SCREEN_WIDTH
- add hl, de
- pop bc
- inc b
- dec c
- jr nz, .loop
- ret
-; 50268
-
-.DetermineCompatibility: ; 50268
- ld de, StringBuffer1
- ld a, BANK(EvosAttacksPointers)
- ld bc, 2
- call FarCopyBytes
- ld hl, StringBuffer1
- ld a, [hli]
- ld h, [hl]
- ld l, a
- ld de, StringBuffer1
- ld a, BANK(EvosAttacks)
- ld bc, $a
- call FarCopyBytes
- ld hl, StringBuffer1
-.loop2
- ld a, [hli]
- and a
- jr z, .nope
-rept 2
- inc hl
-endr
- cp EVOLVE_ITEM
- jr nz, .loop2
-rept 2
- dec hl
-endr
- ld a, [CurItem]
- cp [hl]
-rept 2
- inc hl
-endr
- jr nz, .loop2
- ld de, .string_able
- ret
-
-.nope
- ld de, .string_not_able
- ret
-; 502a3
-
-.string_able: ; 502a3
- db "ABLE@"
-; 502a8
-.string_not_able: ; 502a8
- db "NOT ABLE@"
-; 502b1
-
-
-PlacePartyMonGender: ; 502b1
- ld a, [PartyCount]
- and a
- ret z
- ld c, a
- ld b, 0
- hlcoord 12, 2
-.loop
- push bc
- push hl
- call PartyMenuCheckEgg
- jr z, .next
- ld [CurPartySpecies], a
- push hl
- ld a, b
- ld [CurPartyMon], a
- xor a
- ld [MonType], a
- call GetGender
- ld de, .unknown
- jr c, .got_gender
- ld de, .male
- jr nz, .got_gender
- ld de, .female
-
-.got_gender
- pop hl
- call PlaceString
-
-.next
- pop hl
- ld de, 2 * SCREEN_WIDTH
- add hl, de
- pop bc
- inc b
- dec c
- jr nz, .loop
- ret
-; 502ee
-
-.male: ; 502ee
- db "♂…MALE@"
-; 502f5
-
-.female: ; 502f5
- db "♀…FEMALE@"
-; 502fe
-
-.unknown: ; 502fe
- db "…UNKNOWN@"
-; 50307
-
-
-PlacePartyMonMobileBattleSelection: ; 50307
- ld a, [PartyCount]
- and a
- ret z
- ld c, a
- ld b, 0
- hlcoord 12, 1
-.loop
- push bc
- push hl
- ld de, .String_Sanka_Shinai
- call PlaceString
- pop hl
- ld de, 2 * SCREEN_WIDTH
- add hl, de
- pop bc
- inc b
- dec c
- jr nz, .loop
- ld a, l
- ld e, PKMN_NAME_LENGTH
- sub e
- ld l, a
- ld a, h
- sbc $0
- ld h, a
- ld de, .String_Kettei_Yameru
- call PlaceString
- ld b, $3
- ld c, $0
- ld hl, wd002
- ld a, [hl]
-.loop2
- push hl
- push bc
- hlcoord 12, 1
-.loop3
- and a
- jr z, .done
- ld de, 2 * SCREEN_WIDTH
- add hl, de
- dec a
- jr .loop3
-
-.done
- ld de, .String_Banme
- push hl
- call PlaceString
- pop hl
- pop bc
- push bc
- push hl
- ld a, c
- ld hl, .Strings_1_2_3
- call GetNthString
- ld d, h
- ld e, l
- pop hl
- call PlaceString
- pop bc
- pop hl
- inc hl
- ld a, [hl]
- inc c
- dec b
- ret z
- jr .loop2
-; 5036b
-
-.String_Banme: ; 5036b
- db " ばんめ @" ; Place
-; 50372
-.String_Sanka_Shinai: ; 50372
- db "さんかしない@" ; Cancel
-; 50379
-.String_Kettei_Yameru: ; 50379
- db "けってい やめる@" ; Quit
-; 50383
-.Strings_1_2_3: ; 50383
- db "1@", "2@", "3@" ; 1st, 2nd, 3rd
-; 50389
-
-
-PartyMenuCheckEgg: ; 50389
- ld a, PartySpecies % $100
- add b
- ld e, a
- ld a, PartySpecies / $100
- adc 0
- ld d, a
- ld a, [de]
- cp EGG
- ret
-; 50396
-
-GetPartyMenuTilemapPointers: ; 50396
- ld a, [PartyMenuActionText]
- and $f0
- jr nz, .skip
- ld a, [PartyMenuActionText]
- and $f
- ld e, a
- ld d, 0
- ld hl, .Pointers
-rept 2
- add hl, de
-endr
- ld a, [hli]
- ld h, [hl]
- ld l, a
- ret
-
-.skip
- ld hl, .Default
- ret
-; 503b2
-
-.Pointers: ; 503b2
- dw .Default
- dw .Default
- dw .Default
- dw .TMHM
- dw .Default
- dw .EvoStone
- dw .Gender
- dw .Gender
- dw .Default
- dw .Mobile
-; 503c6
-
-.Default: db 0, 1, 2, 3, 4, $ff
-.TMHM: db 0, 5, 3, 4, $ff
-.EvoStone: db 0, 6, 3, 4, $ff
-.Gender: db 0, 7, 3, 4, $ff
-.Mobile: db 0, 8, 3, 4, $ff
-; 503e0
-
-
-Function503e0: ; 503e0
- ld hl, PartyCount
- ld a, [hli]
- and a
- ret z
- ld c, a
- xor a
- ld [hObjectStructIndexBuffer], a
-.asm_503ea
- push bc
- push hl
- ld hl, Function8e83f
- ld a, BANK(Function8e83f)
- ld e, $0
- rst FarCall
- ld a, [hObjectStructIndexBuffer]
- inc a
- ld [hObjectStructIndexBuffer], a
- pop hl
- pop bc
- dec c
- jr nz, .asm_503ea
- callab Function8cf69
- ret
-; 50405
-
-Function50405: ; 50405
- xor a
- ld [wd0e3], a
- ld de, Unknown_5044f
- call Function1bb1
- ld a, [PartyCount]
- inc a
- ld [wcfa3], a
- dec a
- ld b, a
- ld a, [wd0d8]
- and a
- jr z, .asm_50422
- inc b
- cp b
- jr c, .asm_50424
-
-.asm_50422
- ld a, $1
-
-.asm_50424
- ld [MenuSelection2], a
- ld a, $3
- ld [wcfa8], a
- ret
-; 5042d
-
-Function5042d: ; 0x5042d
- ld de, Unknown_5044f
- call Function1bb1
- ld a, [PartyCount]
- ld [wcfa3], a
- ld b, a
- ld a, [wd0d8]
- and a
- jr z, .asm_50444
- inc b
- cp b
- jr c, .asm_50446
-.asm_50444
- ld a, $1
-.asm_50446
- ld [MenuSelection2], a
- ld a, $3
- ld [wcfa8], a
- ret
-; 5044f (14:444f)
-
-Unknown_5044f: ; 5044f
-; cursor y
-; cursor x
-; list length
-; ?
-; bit 6: animate sprites bit 5: wrap around
-; ?
-; distance between items (hi: y, lo: x)
-; allowed buttons (mask)
- db $01, $00, $00, $01, $60, $00, $20, $00
-; 50457
-
-PartyMenuSelect: ; 0x50457
-; sets carry if exitted menu.
- call Function1bc9
- call Function1bee
- ld a, [PartyCount]
- inc a
- ld b, a
- ld a, [MenuSelection2] ; menu selection?
- cp b
- jr z, .exitmenu ; CANCEL
- ld [wd0d8], a
- ld a, [hJoyLast]
- ld b, a
- bit 1, b
- jr nz, .exitmenu ; B button?
- ld a, [MenuSelection2]
- dec a
- ld [CurPartyMon], a
- ld c, a
- ld b, $0
- ld hl, PartySpecies
- add hl, bc
- ld a, [hl]
- ld [CurPartySpecies], a
-
- ld de, SFX_READ_TEXT_2
- call PlaySFX
- call WaitSFX
- and a
- ret
-
-.exitmenu
- ld de, SFX_READ_TEXT_2
- call PlaySFX
- call WaitSFX
- scf
- ret
-; 0x5049a
-
-
-PrintPartyMenuText: ; 5049a
- hlcoord 0, 14
- lb bc, 2, 18
- call TextBox
- ld a, [PartyCount]
- and a
- jr nz, .haspokemon
- ld de, YouHaveNoPKMNString
- jr .gotstring
-.haspokemon ; 504ae
- ld a, [PartyMenuActionText]
- and $f ; drop high nibble
- ld hl, PartyMenuStrings
- ld e, a
- ld d, $0
-rept 2
- add hl, de
-endr
- ld a, [hli]
- ld d, [hl]
- ld e, a
-.gotstring ; 504be
- ld a, [Options]
- push af
- set 4, a ; disable text delay
- ld [Options], a
- hlcoord 1, 16 ; Coord
- call PlaceString
- pop af
- ld [Options], a
- ret
-; 0x504d2
-
-PartyMenuStrings: ; 0x504d2
- dw ChooseAMonString
- dw UseOnWhichPKMNString
- dw WhichPKMNString
- dw TeachWhichPKMNString
- dw MoveToWhereString
- dw UseOnWhichPKMNString
- dw ChooseAMonString ; Probably used to be ChooseAFemalePKMNString
- dw ChooseAMonString ; Probably used to be ChooseAMalePKMNString
- dw ToWhichPKMNString
-
-ChooseAMonString: ; 0x504e4
- db "Choose a #MON.@"
-UseOnWhichPKMNString: ; 0x504f3
- db "Use on which <PK><MN>?@"
-WhichPKMNString: ; 0x50504
- db "Which <PK><MN>?@"
-TeachWhichPKMNString: ; 0x5050e
- db "Teach which <PK><MN>?@"
-MoveToWhereString: ; 0x5051e
- db "Move to where?@"
-ChooseAFemalePKMNString: ; 0x5052d ; UNUSED
- db "Choose a ♀<PK><MN>.@"
-ChooseAMalePKMNString: ; 0x5053b ; UNUSED
- db "Choose a ♂<PK><MN>.@"
-ToWhichPKMNString: ; 0x50549
- db "To which <PK><MN>?@"
-
-YouHaveNoPKMNString: ; 0x50556
- db "You have no <PK><MN>!@"
-
-
-Function50566: ; 50566
- ld a, [CurPartyMon]
- ld hl, PartyMonNicknames
- call GetNick
- ld a, [PartyMenuActionText]
- and $f
- ld hl, Unknown_5057b
- call Function505c1
- ret
-; 5057b
-
-Unknown_5057b: ; 5057b
- dw UnknownText_0x50594
- dw UnknownText_0x5059e
- dw UnknownText_0x505a3
- dw UnknownText_0x505a8
- dw UnknownText_0x50599
- dw UnknownText_0x5058f
- dw UnknownText_0x505ad
- dw UnknownText_0x505b2
- dw UnknownText_0x505b7
- dw UnknownText_0x505bc
-; 5058f
-
-UnknownText_0x5058f: ; 0x5058f
- ; recovered @ HP!
- text_jump UnknownText_0x1bc0a2
- db "@"
-; 0x50594
-
-UnknownText_0x50594: ; 0x50594
- ; 's cured of poison.
- text_jump UnknownText_0x1bc0bb
- db "@"
-; 0x50599
-
-UnknownText_0x50599: ; 0x50599
- ; 's rid of paralysis.
- text_jump UnknownText_0x1bc0d2
- db "@"
-; 0x5059e
-
-UnknownText_0x5059e: ; 0x5059e
- ; 's burn was healed.
- text_jump UnknownText_0x1bc0ea
- db "@"
-; 0x505a3
-
-UnknownText_0x505a3: ; 0x505a3
- ; was defrosted.
- text_jump UnknownText_0x1bc101
- db "@"
-; 0x505a8
-
-UnknownText_0x505a8: ; 0x505a8
- ; woke up.
- text_jump UnknownText_0x1bc115
- db "@"
-; 0x505ad
-
-UnknownText_0x505ad: ; 0x505ad
- ; 's health returned.
- text_jump UnknownText_0x1bc123
- db "@"
-; 0x505b2
-
-UnknownText_0x505b2: ; 0x505b2
- ; is revitalized.
- text_jump UnknownText_0x1bc13a
- db "@"
-; 0x505b7
-
-UnknownText_0x505b7: ; 0x505b7
- ; grew to level @ !@ @
- text_jump UnknownText_0x1bc14f
- db "@"
-; 0x505bc
-
-UnknownText_0x505bc: ; 0x505bc
- ; came to its senses.
- text_jump UnknownText_0x1bc16e
- db "@"
-; 0x505c1
-
-
-Function505c1: ; 505c1
- ld e, a
- ld d, 0
-rept 2
- add hl, de
-endr
- ld a, [hli]
- ld h, [hl]
- ld l, a
- ld a, [Options]
- push af
- set 4, a
- ld [Options], a
- call PrintText
- pop af
- ld [Options], a
- ret
-; 505da
-
-DoPoisonStep:: ; 505da
- ld a, [PartyCount]
- and a
- jr z, .asm_5062c
- xor a
- ld c, 7
- ld hl, EngineBuffer1
-.asm_505e6
- ld [hli], a
- dec c
- jr nz, .asm_505e6
- xor a
- ld [CurPartyMon], a
-.asm_505ee
- call Function5062e
- jr nc, .asm_50605
- ld a, [CurPartyMon]
- ld e, a
- ld d, 0
- ld hl, wd03f
- add hl, de
- ld [hl], c
- ld a, [EngineBuffer1]
- or c
- ld [EngineBuffer1], a
-
-.asm_50605
- ld a, [PartyCount]
- ld hl, CurPartyMon
- inc [hl]
- cp [hl]
- jr nz, .asm_505ee
- ld a, [EngineBuffer1]
- and $2
- jr nz, .asm_50622
- ld a, [EngineBuffer1]
- and $1
- jr z, .asm_5062c
- call Function50658
- xor a
- ret
-
-.asm_50622
- ld a, BANK(UnknownScript_0x50669)
- ld hl, UnknownScript_0x50669
- call CallScript
- scf
- ret
-
-.asm_5062c
- xor a
- ret
-; 5062e
-
-Function5062e: ; 5062e
- ld a, MON_STATUS
- call GetPartyParamLocation
- ld a, [hl]
- and 1 << PSN
- ret z
-
- ld a, MON_HP
- call GetPartyParamLocation
- ld a, [hli]
- ld b, a
- ld c, [hl]
-
- or c
- ret z
-
- dec bc
- ld [hl], c
- dec hl
- ld [hl], b
-
- ld a, b
- or c
- jr nz, .not_fainted
-
- ld a, MON_STATUS
- call GetPartyParamLocation
- ld [hl], 0
- ld c, 2
- scf
- ret
-
-.not_fainted
- ld c, 1
- scf
- ret
-; 50658
-
-Function50658: ; 50658
- ld de, SFX_POISON
- call PlaySFX
- ld b, $2
- predef Functioncbcdd
- call DelayFrame
- ret
-; 50669
-
-UnknownScript_0x50669: ; 50669
- callasm Function50658
- loadfont
- callasm Function5067b
- iffalse UnknownScript_0x50677
- loadmovesprites
- end
-; 50677
-
-UnknownScript_0x50677: ; 50677
- farjump Script_OverworldWhiteout
-; 5067b
-
-Function5067b: ; 5067b
- xor a
- ld [CurPartyMon], a
- ld de, wd03f
-.asm_50682
- push de
- ld a, [de]
- and 2
- jr z, .asm_5069c
- ld c, HAPPINESS_POISONFAINT
- callba ChangeHappiness
- callba GetPartyNick
- ld hl, PoisonFaintText
- call PrintText
-
-.asm_5069c
- pop de
- inc de
- ld hl, CurPartyMon
- inc [hl]
- ld a, [PartyCount]
- cp [hl]
- jr nz, .asm_50682
- predef CheckPlayerPartyForFitPkmn
- ld a, d
- ld [ScriptVar], a
- ret
-; 506b2
-
-PoisonFaintText: ; 506b2
- text_jump UnknownText_0x1c0acc
- db "@"
-; 506b7
-
-PoisonWhiteOutText: ; 506b7
- text_jump UnknownText_0x1c0ada
- db "@"
-; 506bc
-
-
-DoMovementFunctionc: ; 506bc
- ld hl, UnknownScript_0x506c8
- call QueueScript
- ld a, $1
- ld [wd0ec], a
- ret
-; 506c8
-
-UnknownScript_0x506c8: ; 0x506c8
- reloadmappart
- special UpdateTimePals
- callasm GetPartyNick
- writetext UnknownText_0x50726
- closetext
- callasm SweetScentEncounter
- iffalse UnknownScript_0x506e9
- checkflag ENGINE_BUG_CONTEST_TIMER
- iftrue UnknownScript_0x506e5
- battlecheck
- startbattle
- returnafterbattle
- end
-; 0x506e5
-
-UnknownScript_0x506e5: ; 0x506e5
- farjump BugCatchingContestBattleScript
-; 0x506e9
-
-UnknownScript_0x506e9: ; 0x506e9
- writetext UnknownText_0x5072b
- closetext
- loadmovesprites
- end
-; 0x506ef
-
-SweetScentEncounter: ; 506ef
- callba CanUseSweetScent
- jr nc, .no_battle
- ld hl, StatusFlags2
- bit 2, [hl]
- jr nz, .not_in_bug_contest
- callba GetMapEncounterRate
- ld a, b
- and a
- jr z, .no_battle
- callba ChooseWildEncounter
- jr nz, .no_battle
- jr .start_battle
-
-.not_in_bug_contest
- callba ChooseWildEncounter_BugContest
-
-.start_battle
- ld a, $1
- ld [ScriptVar], a
- ret
-
-.no_battle
- xor a
- ld [ScriptVar], a
- ld [BattleType], a
- ret
-; 50726
-
-UnknownText_0x50726: ; 0x50726
- ; used SWEET SCENT!
- text_jump UnknownText_0x1c0b03
- db "@"
-; 0x5072b
-
-UnknownText_0x5072b: ; 0x5072b
- ; Looks like there's nothing here…
- text_jump UnknownText_0x1c0b1a
- db "@"
-; 0x50730
-
-
-_Squirtbottle: ; 50730
- ld hl, UnknownScript_0x5073c
- call QueueScript
- ld a, $1
- ld [wd0ec], a
- ret
-; 5073c
-
-UnknownScript_0x5073c: ; 0x5073c
- reloadmappart
- special UpdateTimePals
- callasm Function50753
- iffalse UnknownScript_0x5074b
- farjump WateredWeirdTreeScript
-; 0x5074b
-
-UnknownScript_0x5074b: ; 0x5074b
- jumptext UnknownText_0x5074e
-; 0x5074e
-
-UnknownText_0x5074e: ; 0x5074e
- ; sprinkled water. But nothing happened…
- text_jump UnknownText_0x1c0b3b
- db "@"
-; 0x50753
-
-Function50753: ; 50753
- ld a, [MapGroup]
- cp GROUP_ROUTE_36
- jr nz, .asm_50774
-
- ld a, [MapNumber]
- cp MAP_ROUTE_36
- jr nz, .asm_50774
-
- callba GetFacingObject
- jr c, .asm_50774
-
- ld a, d
- cp $17
- jr nz, .asm_50774
-
- ld a, $1
- ld [ScriptVar], a
- ret
-
-.asm_50774
- xor a
- ld [ScriptVar], a
- ret
-; 50779
-
-
-_CardKey: ; 50779
-; Are we even in the right map to use this?
- ld a, [MapGroup]
- cp GROUP_RADIO_TOWER_3F
- jr nz, .nope
-
- ld a, [MapNumber]
- cp MAP_RADIO_TOWER_3F
- jr nz, .nope
-; Are we facing the slot?
- ld a, [PlayerDirection]
- and $c
- cp OW_UP
- jr nz, .nope
-
- call GetFacingTileCoord
- ld a, d
- cp 18
- jr nz, .nope
- ld a, e
- cp 6
- jr nz, .nope
-; Let's use the Card Key.
- ld hl, .CardKeyScript
- call QueueScript
- ld a, $1
- ld [wd0ec], a
- ret
-
-.nope
- ld a, $0
- ld [wd0ec], a
- ret
-; 507af
-
-.CardKeyScript: ; 0x507af
- loadmovesprites
- farjump MapRadioTower3FSignpost2Script
-; 0x507b4
-
-
-_BasementKey: ; 507b4
-; Are we even in the right map to use this?
- ld a, [MapGroup]
- cp GROUP_WAREHOUSE_ENTRANCE
- jr nz, .nope
-
- ld a, [MapNumber]
- cp MAP_WAREHOUSE_ENTRANCE
- jr nz, .nope
-; Are we on the tile in front of the door?
- call GetFacingTileCoord
- ld a, d
- cp 22
- jr nz, .nope
- ld a, e
- cp 10
- jr nz, .nope
-; Let's use the Basement Key
- ld hl, .BasementKeyScript
- call QueueScript
- ld a, 1
- ld [wd0ec], a
- ret
-
-.nope
- ld a, $0
- ld [wd0ec], a
- ret
-; 507e1
-
-.BasementKeyScript: ; 0x507e1
- loadmovesprites
- farjump BasementDoorScript
-; 0x507e6
-
-
-_SacredAsh: ; 507e6
- ld a, $0
- ld [wd0ec], a
- call CheckAnyFaintedMon
- ret nc
-
- ld hl, SacredAshScript
- call QueueScript
- ld a, $1
- ld [wd0ec], a
- ret
-; 507fb
-
-CheckAnyFaintedMon: ; 507fb
- ld de, PARTYMON_STRUCT_LENGTH
- ld bc, PartySpecies
- ld hl, PartyMon1HP
- ld a, [PartyCount]
- and a
- ret z
-
-.loop
- push af
- push hl
- ld a, [bc]
- inc bc
- cp EGG
- jr z, .next
-
- ld a, [hli]
- or [hl]
- jr z, .done
-
-.next
- pop hl
- add hl, de
- pop af
- dec a
- jr nz, .loop
- xor a
- ret
-
-.done
- pop hl
- pop af
- scf
- ret
-; 50821
-
-SacredAshScript: ; 0x50821
- special HealParty
- reloadmappart
- playsound SFX_WARP_TO
- special FadeBlackBGMap
- special FadeInBGMap
- special FadeBlackBGMap
- special FadeInBGMap
- special FadeBlackBGMap
- special FadeInBGMap
- waitbutton
- writetext UnknownText_0x50845
- playsound SFX_CAUGHT_MON
- waitbutton
- closetext
- loadmovesprites
- end
-; 0x50845
-
-UnknownText_0x50845: ; 0x50845
- ; 's #MON were all healed!
- text_jump UnknownText_0x1c0b65
- db "@"
-; 0x5084a
-
CopyPkmnToTempMon: ; 5084a
; gets the BaseData of a Pkmn
; and copys the PkmnStructure to TempMon
@@ -33567,21 +32205,21 @@
; 50893
Function50893: ; 50893
- ld hl, TempMonLevel - TempMon
+ ld hl, MON_LEVEL
add hl, bc
ld a, [hl]
ld [CurPartyLevel], a
- ld hl, TempMonMaxHP - TempMon
+ ld hl, MON_MAXHP
add hl, bc
ld d, h
ld e, l
- ld hl, TempMonExp + 2 - TempMon
+ ld hl, MON_EXP + 2
add hl, bc
push bc
ld b, $1
predef CalcPkmnStats
pop bc
- ld hl, TempMonHP - TempMon
+ ld hl, MON_HP
add hl, bc
ld d, h
ld e, l
@@ -33596,7 +32234,7 @@
.asm_508c1
push bc
- ld hl, TempMonMaxHP - TempMon
+ ld hl, MON_MAXHP
add hl, bc
ld bc, 2
call CopyBytes
@@ -33603,7 +32241,7 @@
pop bc
.asm_508cd
- ld hl, TempMonStatus - TempMon
+ ld hl, MON_STATUS
add hl, bc
xor a
ld [hli], a
@@ -38609,7 +37247,7 @@
; 84425
Function84425: ; 84425
- call Function222a
+ call ReturnToMapFromSubmenu
call Function84753
ret
; 8442c
@@ -39499,7 +38137,7 @@
ld [MusicFadeIDHi], a
ld a, $a
ld [MusicFade], a
- callba FadeBlackBGMap
+ callba FadeOutPalettes
xor a
ld [VramState], a
ld [hMapAnims], a
@@ -39522,7 +38160,7 @@
ld [MusicFadeIDHi], a
ld a, 10
ld [MusicFade], a
- callba FadeBlackBGMap
+ callba FadeOutPalettes
xor a
ld [VramState], a
ld [hMapAnims], a
@@ -39688,7 +38326,7 @@
Function865b5: ; 865b5
push hl
- call WhiteBGMap
+ call ClearBGPalettes
callba Function4e906
pop hl
ld a, [hli]
@@ -39833,7 +38471,7 @@
.asm_866a9
push hl
- call WhiteBGMap
+ call ClearBGPalettes
pop hl
call Function86748
ld a, [wc608]
@@ -39997,7 +38635,7 @@
; 86810
Function86810: ; 86810
- call WhiteBGMap
+ call ClearBGPalettes
ld hl, VTiles2 tile $63
ld de, FontExtra + $d0
lb bc, BANK(FontExtra), 1
@@ -40420,7 +39058,7 @@
; 8c7e1
BlindingFlash: ; 8c7e1
- callba FadeBlackBGMap
+ callba FadeOutPalettes
ld hl, StatusFlags
set 2, [hl]
callba Function8c0e5
@@ -40428,7 +39066,7 @@
ld b, $9
call GetSGBLayout
callba Function49409
- callba FadeInBGMap
+ callba FadeInPalettes
ret
; 8c80a
@@ -40929,7 +39567,7 @@
.done
pop af
ld [hVBlank], a
- call WhiteBGMap
+ call ClearBGPalettes
xor a
ld [hLCDStatCustom], a
ld [hLCDStatCustom + 1], a
@@ -40986,7 +39624,7 @@
; 8ccc9
Function8ccc9: ; 8ccc9
- call WhiteBGMap
+ call ClearBGPalettes
call ClearSprites
call DisableLCD
callab Function8cf53
@@ -45602,7 +44240,7 @@
ld [hInMenu], a
pop af
ld [Options], a
- call WhiteBGMap
+ call ClearBGPalettes
xor a
ld [hBGMapAddress], a
ld a, VBGMap0 / $100
@@ -45613,7 +44251,7 @@
ret
Function90bea: ; 90bea (24:4bea)
- call WhiteBGMap
+ call ClearBGPalettes
call ClearTileMap
call ClearSprites
call DisableLCD
@@ -47002,7 +45640,7 @@
push af
xor a
ld [VramState], a
- call WhiteBGMap
+ call ClearBGPalettes
call ClearTileMap
call ClearSprites
call DisableLCD
@@ -47057,7 +45695,7 @@
ld [hInMenu], a
pop af
ld [Options], a
- call WhiteBGMap
+ call ClearBGPalettes
ret
; 919b0
@@ -47263,927 +45901,12 @@
; 91af3
-_FlyMap: ; 91af3
- call WhiteBGMap
- call ClearTileMap
- call ClearSprites
- ld hl, hInMenu
- ld a, [hl]
- push af
- ld [hl], $1
- xor a
- ld [hBGMapMode], a
- callba Function8cf53
- call Function91ff2
- ld de, GFX_922e1
- ld hl, VTiles2 tile $30
- lb bc, BANK(GFX_922e1), 6
- call Request1bpp
- call FlyMap
- call Function91c8f
- ld b, $2
- call GetSGBLayout
- call SetPalettes
-.loop
- call JoyTextDelay
- ld hl, hJoyPressed
- ld a, [hl]
- and B_BUTTON
- jr nz, .pressedB
- ld a, [hl]
- and A_BUTTON
- jr nz, .pressedA
- call FlyMapScroll
- call GetMapCursorCoordinates
- callba Function8cf69
- call DelayFrame
- jr .loop
+INCLUDE "engine/flypoints.asm"
-.pressedB
- ld a, -1
- jr .exit
-
-.pressedA
- ld a, [wd002]
- ld l, a
- ld h, 0
- add hl, hl
- ld de, Flypoints + 1
- add hl, de
- ld a, [hl]
-
-.exit
- ld [wd002], a
- pop af
- ld [hInMenu], a
- call WhiteBGMap
- ld a, $90
- ld [hWY], a
+Function92311: ; unreferenced
xor a
- ld [hBGMapAddress], a
- ld a, VBGMap0 / $100
- ld [hBGMapAddress + 1], a
- ld a, [wd002]
- ld e, a
- ret
-; 91b73
-
-FlyMapScroll: ; 91b73
- ld a, [StartFlypoint]
- ld e, a
- ld a, [EndFlypoint]
- ld d, a
- ld hl, hJoyLast
- ld a, [hl]
- and D_UP
- jr nz, .ScrollNext
- ld a, [hl]
- and D_DOWN
- jr nz, .ScrollPrev
- ret
-
-.ScrollNext
- ld hl, wd002
- ld a, [hl]
- cp d
- jr nz, .NotAtEndYet
- ld a, e
- dec a
- ld [hl], a
-
-.NotAtEndYet
- inc [hl]
- call CheckIfVisitedFlypoint
- jr z, .ScrollNext
- jr .Finally
-
-.ScrollPrev
- ld hl, wd002
- ld a, [hl]
- cp e
- jr nz, .NotAtStartYet
- ld a, d
- inc a
- ld [hl], a
-
-.NotAtStartYet
- dec [hl]
- call CheckIfVisitedFlypoint
- jr z, .ScrollPrev
-
-.Finally
- call TownMapBubble
- call WaitBGMap
- xor a
- ld [hBGMapMode], a
- ret
-; 91bb5
-
-TownMapBubble: ; 91bb5
-; Draw the bubble containing the location text in the town map HUD
-
-; Top-left corner
- hlcoord 1, 0
- ld a, $30
- ld [hli], a
-
-; Top row
- ld bc, 16
- ld a, " "
- call ByteFill
-
-; Top-right corner
- ld a, $31
- ld [hl], a
- hlcoord 1, 1
-
-
-; Middle row
- ld bc, 18
- ld a, " "
- call ByteFill
-
-
-; Bottom-left corner
- hlcoord 1, 2
- ld a, $32
- ld [hli], a
-
-; Bottom row
- ld bc, 16
- ld a, " "
- call ByteFill
-
-; Bottom-right corner
- ld a, $33
- ld [hl], a
-
-
-; Print "Where?"
- hlcoord 2, 0
- ld de, .Where
- call PlaceString
-
-; Print the name of the default flypoint
- call .Name
-
-; Up/down arrows
- hlcoord 18, 1
- ld [hl], $34
- ret
-
-.Where
- db "Where?@"
-
-.Name
-; We need the map location of the default flypoint
- ld a, [wd002]
- ld l, a
- ld h, 0
- add hl, hl ; two bytes per flypoint
- ld de, Flypoints
- add hl, de
- ld e, [hl]
-
- callba GetLandmarkName
-
- hlcoord 2, 1
- ld de, StringBuffer1
- call PlaceString
- ret
-; 91c17
-
-GetMapCursorCoordinates: ; 91c17
- ld a, [wd002]
- ld l, a
- ld h, $0
- add hl, hl
- ld de, Flypoints
- add hl, de
- ld e, [hl]
- callba GetLandmarkCoords
- ld a, [wd003]
- ld c, a
- ld a, [wd004]
- ld b, a
- ld hl, $4
- add hl, bc
- ld [hl], e
- ld hl, $5
- add hl, bc
- ld [hl], d
- ret
-; 91c3c
-
-CheckIfVisitedFlypoint: ; 91c3c
-; Check if the flypoint loaded in [hl] has been visited yet.
- push bc
- push de
- push hl
- ld l, [hl]
- ld h, 0
- add hl, hl
- ld de, Flypoints + 1
- add hl, de
- ld c, [hl]
- call HasVisitedSpawn
- pop hl
- pop de
- pop bc
- and a
- ret
-; 91c50
-
-HasVisitedSpawn: ; 91c50
-; Check if spawn point c has been visited.
- ld hl, VisitedSpawns
- ld b, CHECK_FLAG
- ld d, 0
- predef FlagPredef
- ld a, c
- ret
-; 91c5e
-
-Flypoints: ; 91c5e
-; landmark, spawn point
-
- const_def
-
-flypoint: MACRO
-; \1\@FLY EQUS "FLY_\1"
-; \1\@SPAWN EQUS "SPAWN_\1"
- ; const \1\@FLY
- ; db \2, \1\@SPAWN
- const FLY_\1
- db \2, SPAWN_\1
-ENDM
-
-; Johto
- flypoint NEW_BARK, NEW_BARK_TOWN
- flypoint CHERRYGROVE, CHERRYGROVE_CITY
- flypoint VIOLET, VIOLET_CITY
- flypoint AZALEA, AZALEA_TOWN
- flypoint GOLDENROD, GOLDENROD_CITY
- flypoint ECRUTEAK, ECRUTEAK_CITY
- flypoint OLIVINE, OLIVINE_CITY
- flypoint CIANWOOD, CIANWOOD_CITY
- flypoint MAHOGANY, MAHOGANY_TOWN
- flypoint LAKE, LAKE_OF_RAGE
- flypoint BLACKTHORN, BLACKTHORN_CITY
- flypoint MT_SILVER, SILVER_CAVE
-
-; Kanto
-KANTO_FLYPOINT EQU const_value
-
- flypoint PALLET, PALLET_TOWN
- flypoint VIRIDIAN, VIRIDIAN_CITY
- flypoint PEWTER, PEWTER_CITY
- flypoint CERULEAN, CERULEAN_CITY
- flypoint VERMILION, VERMILION_CITY
- flypoint ROCK_TUNNEL, ROCK_TUNNEL
- flypoint LAVENDER, LAVENDER_TOWN
- flypoint CELADON, CELADON_CITY
- flypoint SAFFRON, SAFFRON_CITY
- flypoint FUCHSIA, FUCHSIA_CITY
- flypoint CINNABAR, CINNABAR_ISLAND
- flypoint INDIGO, INDIGO_PLATEAU
-
- db -1
-; 91c8f
-
-Function91c8f: ; 91c8f
- ret
-; 91c90
-
-FlyMap: ; 91c90
-
- ld a, [MapGroup]
- ld b, a
- ld a, [MapNumber]
- ld c, a
- call GetWorldMapLocation
-
-; If we're not in a valid location, i.e. Pokecenter floor 2F,
-; the backup map information is used
-
- cp SPECIAL_MAP
- jr nz, .CheckRegion
-
- ld a, [BackupMapGroup]
- ld b, a
- ld a, [BackupMapNumber]
- ld c, a
- call GetWorldMapLocation
-
-.CheckRegion
-; The first 46 locations are part of Johto. The rest are in Kanto
- cp KANTO_LANDMARK
- jr nc, .KantoFlyMap
-
-.JohtoFlyMap
-; Note that .NoKanto should be modified in tandem with this branch
-
- push af
-
-; Start from New Bark Town
- ld a, FLY_NEW_BARK
ld [wd002], a
-
-; Flypoints begin at New Bark Town...
- ld [StartFlypoint], a
-; ..and end at Silver Cave
- ld a, FLY_MT_SILVER
- ld [EndFlypoint], a
-
-; Fill out the map
- call FillJohtoMap
- call .MapHud
- pop af
- call TownMapPlayerIcon
- ret
-
-.KantoFlyMap
-
-; The event that there are no flypoints enabled in a map is not
-; accounted for. As a result, if you attempt to select a flypoint
-; when there are none enabled, the game will crash. Additionally,
-; the flypoint selection has a default starting point that
-; can be flown to even if none are enabled
-
-; To prevent both of these things from happening when the player
-; enters Kanto, fly access is restricted until Indigo Plateau is
-; visited and its flypoint enabled
-
- push af
- ld c, SPAWN_INDIGO
- call HasVisitedSpawn
- and a
- jr z, .NoKanto
-
-; Kanto's map is only loaded if we've visited Indigo Plateau
-
-; Flypoints begin at Pallet Town...
- ld a, FLY_PALLET
- ld [StartFlypoint], a
-; ...and end at Indigo Plateau
- ld a, FLY_INDIGO
- ld [EndFlypoint], a
-
-; Because Indigo Plateau is the first flypoint the player
-; visits, it's made the default flypoint
- ld [wd002], a
-
-; Fill out the map
- call FillKantoMap
- call .MapHud
- pop af
- call TownMapPlayerIcon
- ret
-
-.NoKanto
-; If Indigo Plateau hasn't been visited, we use Johto's map instead
-
-; Start from New Bark Town
- ld a, FLY_NEW_BARK
- ld [wd002], a
-
-; Flypoints begin at New Bark Town...
- ld [StartFlypoint], a
-; ..and end at Silver Cave
- ld a, FLY_MT_SILVER
- ld [EndFlypoint], a
-
- call FillJohtoMap
-
- pop af
-
-.MapHud
- call TownMapBubble
- call TownMapPals
-
- ld hl, VBGMap0 ; BG Map 0
- call TownMapBGUpdate
-
- call TownMapMon
- ld a, c
- ld [wd003], a
- ld a, b
- ld [wd004], a
- ret
-; 91d11
-
-Function91d11: ; 91d11
- ld a, [wd002]
- push af
- ld a, [wd003]
- push af
- ld a, e
- ld [wd002], a
- call ClearSprites
- xor a
- ld [hBGMapMode], a
- ld a, $1
- ld [hInMenu], a
- ld de, GFX_922d1
- ld hl, VTiles0 tile $7f
- lb bc, BANK(GFX_922d1), 1
- call Request2bpp ; actually 1bpp
- call Function91ed0
- ld hl, VTiles0 tile $78
- ld c, $4
- call Request2bpp
- call Function91ff2
- call FillKantoMap
- call Function91de9
- call TownMapPals
- ld hl, VBGMap1
- call TownMapBGUpdate
- call FillJohtoMap
- call Function91de9
- call TownMapPals
- ld hl, VBGMap0
- call TownMapBGUpdate
- ld b, $2
- call GetSGBLayout
- call SetPalettes
- xor a
- ld [hBGMapMode], a
- xor a
- call Function91e1e
-.asm_91d6e
- call JoyTextDelay
- ld hl, hJoyPressed
- ld a, [hl]
- and A_BUTTON | B_BUTTON
- jr nz, .asm_91d8f
- ld a, [hJoypadDown]
- and SELECT
- jr nz, .asm_91d87
- call Function91d9b
- call Function91dcd
- jr .asm_91d8a
-
-.asm_91d87
- call Function91e5a
-
-.asm_91d8a
- call DelayFrame
- jr .asm_91d6e
-
-.asm_91d8f
- call ClearSprites
- pop af
- ld [wd003], a
- pop af
- ld [wd002], a
- ret
-; 91d9b
-
-Function91d9b: ; 91d9b
- ld a, [hl]
- and $20
- jr nz, .asm_91da6
- ld a, [hl]
- and $10
- jr nz, .asm_91db7
- ret
-
-.asm_91da6
- ld a, [hWY]
- cp $90
- ret z
- call ClearSprites
- ld a, $90
- ld [hWY], a
- xor a
- call Function91e1e
- ret
-
-.asm_91db7
- ld a, [StatusFlags]
- bit 6, a
- ret z
- ld a, [hWY]
- and a
- ret z
- call ClearSprites
- xor a
- ld [hWY], a
- ld a, $1
- call Function91e1e
- ret
-; 91dcd
-
-Function91dcd: ; 91dcd
- ld a, [hVBlankCounter]
- ld e, a
- and $f
- ret nz
- ld a, e
- and $10
- jr nz, .asm_91ddc
- call ClearSprites
- ret
-
-.asm_91ddc
- hlcoord 0, 0
- ld de, Sprites
- ld bc, $a0
- call CopyBytes
- ret
-; 91de9
-
-Function91de9: ; 91de9
- hlcoord 0, 0
- ld bc, SCREEN_WIDTH
- ld a, $7f
- call ByteFill
- hlcoord 0, 1
- ld a, $6
- ld [hli], a
- ld bc, SCREEN_HEIGHT
- ld a, $7
- call ByteFill
- ld [hl], $17
- call GetPokemonName
- hlcoord 2, 0
- call PlaceString
- ld h, b
- ld l, c
- ld de, String_91e16
- call PlaceString
- ret
-; 91e16
-
-String_91e16:
- db "'S NEST@"
-; 91e1e
-
-Function91e1e: ; 91e1e
- ld [wd003], a
- ld e, a
- callba Function2a01f
- decoord 0, 0
- ld hl, Sprites
-.asm_91e2e
- ld a, [de]
- and a
- jr z, .asm_91e4d
- push de
- ld e, a
- push hl
- callba GetLandmarkCoords
- pop hl
- ld a, d
- sub $4
- ld [hli], a
- ld a, e
- sub $4
- ld [hli], a
- ld a, $7f
- ld [hli], a
- xor a
- ld [hli], a
- pop de
- inc de
- jr .asm_91e2e
-
-.asm_91e4d
- ld hl, Sprites
- decoord 0, 0
- ld bc, $a0
- call CopyBytes
- ret
-; 91e5a
-
-Function91e5a: ; 91e5a
- call Function91ea9
- ret c
-
- ld a, [wd002]
- ld e, a
- callba GetLandmarkCoords
- ld c, e
- ld b, d
- ld de, Unknown_91e9c
- ld hl, Sprites
-.asm_91e70
- ld a, [de]
- cp $80
- jr z, .asm_91e91
-
- add b
- ld [hli], a
- inc de
-
- ld a, [de]
- add c
- ld [hli], a
- inc de
-
- ld a, [de]
- add $78
- ld [hli], a
- inc de
-
- push bc
- ld c, 0
- ld a, [PlayerGender]
- bit 0, a
- jr z, .asm_91e8c
- inc c
-.asm_91e8c
- ld a, c
- ld [hli], a
- pop bc
-
- jr .asm_91e70
-
-.asm_91e91
- ld hl, Sprites + $10
- ld bc, SpritesEnd - (Sprites + $10)
- xor a
- call ByteFill
- ret
-; 91e9c
-
-Unknown_91e9c: ; 91e9c
- db -8, -8, 0
- db -8, 0, 1
- db 0, -8, 2
- db 0, 0, 3
- db $80 ; terminator
-; 91ea9
-
-Function91ea9: ; 91ea9
- ld a, [wd002]
- cp FAST_SHIP
- jr z, .johto
- cp KANTO_LANDMARK
- jr c, .johto
-
-.kanto
- ld a, [wd003]
- and a
- jr z, .clear
- jr .ok
-
-.johto
- ld a, [wd003]
- and a
- jr nz, .clear
-
-.ok
- and a
- ret
-
-.clear
- ld hl, Sprites
- ld bc, SpritesEnd - Sprites
- xor a
- call ByteFill
- scf
- ret
-; 91ed0
-
-Function91ed0: ; 91ed0
- ld a, [wd002]
- cp FAST_SHIP
- jr z, .asm_91ede
- callba GetPlayerIcon
- ret
-
-.asm_91ede
- ld de, FastShipGFX
- ld b, BANK(FastShipGFX)
- ret
-; 91ee4
-
-TownMapBGUpdate: ; 91ee4
-; Update BG Map tiles and attributes
-
-; BG Map address
- ld a, l
- ld [hBGMapAddress], a
- ld a, h
- ld [hBGMapAddress + 1], a
-
-; Only update palettes on CGB
- ld a, [hCGB]
- and a
- jr z, .tiles
-
-; BG Map mode 2 (palettes)
- ld a, 2
- ld [hBGMapMode], a
-
-; The BG Map is updated in thirds, so we wait
-; 3 frames to update the whole screen's palettes.
- ld c, 3
- call DelayFrames
-
-.tiles
-; Update BG Map tiles
- call WaitBGMap
-
-; Turn off BG Map update
- xor a
- ld [hBGMapMode], a
- ret
-; 91eff
-
-FillJohtoMap: ; 91eff
- ld de, JohtoMap
- jr FillTownMap
-
-FillKantoMap: ; 91f04
- ld de, KantoMap
-
-FillTownMap: ; 91f07
- hlcoord 0, 0
-.loop
- ld a, [de]
- cp $ff
- ret z
- ld a, [de]
- ld [hli], a
- inc de
- jr .loop
-; 91f13
-
-TownMapPals: ; 91f13
-; Assign palettes based on tile ids
-
- hlcoord 0, 0
- decoord 0, 0, AttrMap
- ld bc, 360
-.loop
-; Current tile
- ld a, [hli]
- push hl
-
-; HP/borders use palette 0
- cp $60
- jr nc, .pal0
-
-; The palette data is condensed to nybbles,
-; least-significant first.
- ld hl, TownMapPalMap
- srl a
- jr c, .odd
-
-; Even-numbered tile ids take the bottom nybble...
- add l
- ld l, a
- ld a, h
- adc 0
- ld h, a
- ld a, [hl]
- and %111
- jr .update
-
-.odd
-; ...and odd ids take the top.
- add l
- ld l, a
- ld a, h
- adc 0
- ld h, a
- ld a, [hl]
- swap a
- and %111
- jr .update
-
-.pal0
- xor a
-
-.update
- pop hl
- ld [de], a
- inc de
- dec bc
- ld a, b
- or c
- jr nz, .loop
- ret
-
-TownMapPalMap:
- db $11, $21, $22, $00, $11, $13, $54, $54, $11, $21, $22, $00
- db $11, $10, $01, $00, $11, $21, $22, $00, $00, $00, $00, $00
- db $00, $00, $44, $04, $00, $00, $00, $00, $33, $33, $33, $33
- db $33, $33, $33, $03, $33, $33, $33, $33, $00, $00, $00, $00
-; 91f7b
-
-TownMapMon: ; 91f7b
-; Draw the FlyMon icon at town map location in
-
-; Get FlyMon species
- ld a, [CurPartyMon]
- ld hl, PartySpecies
- ld e, a
- ld d, $0
- add hl, de
- ld a, [hl]
- ld [wd265], a
-
-; Get FlyMon icon
- ld e, 8 ; starting tile in VRAM
- callba GetSpeciesIcon
-
-; Animation/palette
- ld de, 0
- ld a, $0
- call Function3b2a
-
- ld hl, 3
- add hl, bc
- ld [hl], 8
- ld hl, 2
- add hl, bc
- ld [hl], 0
- ret
-; 91fa6
-
-TownMapPlayerIcon: ; 91fa6
-; Draw the player icon at town map location in a
- push af
-
- callba GetPlayerIcon
-
-; Standing icon
- ld hl, VTiles0 tile $10
- ld c, 4 ; # tiles
- call Request2bpp
-
-; Walking icon
- ld hl, $c0
- add hl, de
- ld d, h
- ld e, l
- ld hl, VTiles0 tile $14
- ld c, 4 ; # tiles
- ld a, BANK(ChrisSpriteGFX) ; does nothing
- call Request2bpp
-
-; Animation/palette
- ld de, 0
- ld b, $0a ; Male
- ld a, [PlayerGender]
- bit 0, a
- jr z, .asm_91fd3
- ld b, $1e ; Female
-.asm_91fd3
- ld a, b
- call Function3b2a
-
- ld hl, $3
- add hl, bc
- ld [hl], $10
-
- pop af
- ld e, a
- push bc
- callba GetLandmarkCoords
- pop bc
-
- ld hl, 4
- add hl, bc
- ld [hl], e
- ld hl, 5
- add hl, bc
- ld [hl], d
- ret
-; 0x91ff2
-
-Function91ff2: ; 91ff2
- ld hl, TownMapGFX
- ld de, VTiles2
- lb bc, BANK(TownMapGFX), $30
- call DecompressRequest2bpp
- ret
-; 91fff
-
-
-JohtoMap: ; 91fff
-INCBIN "gfx/misc/johto.bin"
-; 92168
-
-KantoMap: ; 92168
-INCBIN "gfx/misc/kanto.bin"
-; 922d1
-
-
-GFX_922d1: ; 922d1
-INCBIN "gfx/unknown/0922d1.2bpp"
-GFX_922e1: ; 922e1
-INCBIN "gfx/unknown/0922e1.2bpp"
-GFX_92301: ; 92301
-INCBIN "gfx/unknown/092301.2bpp"
-
-Function92311: ; 92311
- xor a
- ld [wd002], a
- call WhiteBGMap
+ call ClearBGPalettes
call ClearTileMap
call ClearSprites
ld hl, hInMenu
@@ -48248,7 +45971,7 @@
ld [wd002], a
pop af
ld [hInMenu], a
- call WhiteBGMap
+ call ClearBGPalettes
ld a, $90
ld [hWY], a
xor a
@@ -48317,2123 +46040,9 @@
INCLUDE "data/wild/fish.asm"
+INCLUDE "engine/slot_machine.asm"
-_SlotMachine:
- ld hl, Options
- set 4, [hl]
- call Function926f7
- call DelayFrame
-.asm_926d2
- call Function927af
- jr nc, .asm_926d2
- call WaitSFX
- ld de, SFX_QUIT_SLOTS
- call PlaySFX
- call WaitSFX
- call WhiteBGMap
- callba MobileFn_105fd0
- ld hl, Options
- res 4, [hl]
- ld hl, rLCDC ; $ff40
- res 2, [hl]
- ret
-
-Function926f7: ; 926f7 (24:66f7)
- call WhiteBGMap
- call ClearTileMap
- call ClearSprites
- ld de, MUSIC_NONE
- call PlayMusic
- call DelayFrame
- call DisableLCD
- ld hl, VBGMap0 tile $00
- lb bc, 4, 0
- ld a, $7f
- call ByteFill
- ld b, $5
- call GetSGBLayout
- callab Function8cf53
- ld hl, wc6d0
- ld bc, $48
- xor a
- call ByteFill
- ld hl, Slots2LZ
- ld de, VTiles0 tile $00
- call Decompress
- ld hl, Slots3LZ
- ld de, VTiles0 tile $40
- call Decompress
- ld hl, Slots1LZ
- ld de, VTiles2 tile $00
- call Decompress
- ld hl, Slots2LZ
- ld de, VTiles2 tile $25
- call Decompress
- ld hl, SlotsTilemap
- decoord 0, 0
- ld bc, 20 * 12
- call CopyBytes
- ld hl, rLCDC ; $ff40
- set 2, [hl]
- call EnableLCD
- ld hl, wc6d0
- ld bc, $64
- xor a
- call ByteFill
- call Function92a98
- call Function9279b
- ld a, $7
- ld hl, wc300
- ld [hli], a
- ld [hl], $40
- xor a
- ld [wJumptableIndex], a
- ld a, $ff
- ld [wc709], a
- ld de, MUSIC_GAME_CORNER
- call PlayMusic
- xor a
- ld [wd002], a
- call Random
- and $2a
- ret nz
- ld a, $1
- ld [wd002], a
- ret
-
-Function9279b: ; 9279b (24:679b)
- ld a, $e4
- call DmgToCgbBGPals
- lb de, $e4, $e4
- ld a, [hCGB]
- and a
- jr nz, .asm_927ab
- lb de, $c0, $e4
-.asm_927ab
- call DmgToCgbObjPals
- ret
-
-Function927af: ; 927af (24:67af)
- ld a, [wJumptableIndex]
- bit 7, a
- jr nz, .asm_927d1
- call Function92844
- call Function92b0f
- xor a
- ld [wc3b5], a
- callab Function8cfa8
- call Function927f8
- call Function927d3
- call DelayFrame
- and a
- ret
-.asm_927d1
- scf
- ret
-
-Function927d3: ; 927d3 (24:67d3)
- ret
-; 927d4 (24:67d4)
-
-Function927d4: ; 927d4
- ld a, [wc6d0]
- and a
- ret nz
- ld a, [wc6e0]
- and a
- ret nz
- ld a, [wc70c]
- and a
- jr nz, .asm_927ea
- ld a, $e4
- call DmgToCgbBGPals
- ret
-
-.asm_927ea
- ld a, [TextDelayFrames]
- and $7
- ret nz
- ld a, [rBGP]
- xor %1100
- call DmgToCgbBGPals
- ret
-; 927f8
-
-Function927f8: ; 927f8 (24:67f8)
- hlcoord 5, 1
- ld de, Coins
- lb bc, PRINTNUM_LEADINGZEROS | 2, 4
- call PrintNum
- hlcoord 11, 1
- ld de, wc711
- lb bc, PRINTNUM_LEADINGZEROS | 2, 4
- call PrintNum
- ret
-; 92811 (24:6811)
-
-Function92811: ; 92811
- ld a, [wc709]
- add 0
- daa
- ld e, a
- and $f
- add "0"
- hlcoord 1, 0
- ld [hl], a
- ld a, e
- swap a
- and $f
- add "0"
- hlcoord 0, 0
- ld [hl], a
- ret
-; 9282c
-
-Function9282c: ; 9282c
- ld hl, wcf66
- ld a, [hl]
- inc [hl]
- and $7
- ret nz
- ld hl, Sprites + $42
- ld c, $18
-.asm_92839
- ld a, [hl]
- xor $20
- ld [hli], a
-rept 3
- inc hl
-endr
- dec c
- jr nz, .asm_92839
- ret
-; 92844
-
-Function92844: ; 92844 (24:6844)
- ld a, [wJumptableIndex]
- ld e, a
- ld d, 0
- ld hl, Jumptable_92853
-rept 2
- add hl, de
-endr
- ld a, [hli]
- ld h, [hl]
- ld l, a
- jp [hl]
-; 92853 (24:6853)
-
-
-Jumptable_92853: ; 92853 (24:6853)
- dw Function9287e
- dw Function9288e
- dw Function928c6
- dw Function928d6
- dw Function928e6
- dw Function92900
- dw Function92910
- dw Function9292a
- dw Function9293a
- dw Function92879
- dw Function92879
- dw Function92879
- dw Function92955
- dw Function9296b
- dw Function92987
- dw Function9299e
- dw Function929a4
- dw Function929d9
- dw Function929f0
-
-
-Function92879: ; 92879 (24:6879)
- ld hl, wJumptableIndex
- inc [hl]
- ret
-
-Function9287e: ; 9287e (24:687e)
- call Function92879
- xor a
- ld [wc70b], a
- ld [wc70c], a
- ld a, $ff
- ld [wc70d], a
- ret
-
-Function9288e: ; 9288e (24:688e)
- call Function9307c
- jr nc, .asm_92899
- ld a, $12
- ld [wJumptableIndex], a
- ret
-.asm_92899
- call Function92879
- call Function9303f
- call Function93002
- ld a, $20
- ld [wcf64], a
- ld a, $4
- ld [wc6d0], a
- ld [wc6e0], a
- ld [wc6f0], a
- ld a, $4
- ld [wc6d9], a
- ld [wc6e9], a
- ld [wc6f9], a
- call WaitSFX
- ld a, SFX_SLOT_MACHINE_START
- call Function9331e
- ret
-
-Function928c6: ; 928c6 (24:68c6)
- ld hl, wcf64
- ld a, [hl]
- and a
- jr z, .asm_928cf
- dec [hl]
- ret
-.asm_928cf
- call Function92879
- xor a
- ld [hJoypadSum], a
- ret
-
-Function928d6: ; 928d6 (24:68d6)
- ld hl, hJoypadSum ; $ffa5
- ld a, [hl]
- and A_BUTTON
- ret z
- call Function92879
- call Function92a2b
- ld [wc6d0], a
-
-Function928e6: ; 928e6 (24:68e6)
- ld a, [wc6d0]
- cp $0
- ret nz
- ld a, SFX_STOP_SLOT
- call Function9331e
- ld bc, wc6d0
- ld de, wc700
- call Function929f6
- call Function92879
- xor a
- ld [hJoypadSum], a
-
-Function92900: ; 92900 (24:6900)
- ld hl, hJoypadSum ; $ffa5
- ld a, [hl]
- and A_BUTTON
- ret z
- call Function92879
- call Function92a2e
- ld [wc6e0], a
-
-Function92910: ; 92910 (24:6910)
- ld a, [wc6e0]
- cp $0
- ret nz
- ld a, SFX_STOP_SLOT
- call Function9331e
- ld bc, wc6e0
- ld de, wc703
- call Function929f6
- call Function92879
- xor a
- ld [hJoypadSum], a
-
-Function9292a: ; 9292a (24:692a)
- ld hl, hJoypadSum ; $ffa5
- ld a, [hl]
- and A_BUTTON
- ret z
- call Function92879
- call Function92a60
- ld [wc6f0], a
-
-Function9293a: ; 9293a (24:693a)
- ld a, [wc6f0]
- cp $0
- ret nz
- ld a, SFX_STOP_SLOT
- call Function9331e
- ld bc, wc6f0
- ld de, wc706
- call Function929f6
- call Function92879
- xor a
- ld [hJoypadSum], a
- ret
-
-Function92955: ; 92955 (24:6955)
- ld a, [wc70d]
- cp $ff
- jr nz, .asm_92963
- call Function92879
- call Function92879
- ret
-.asm_92963
- call Function92879
- ld a, $10
- ld [wcf64], a
-
-Function9296b: ; 9296b (24:696b)
- ld hl, wcf64
- ld a, [hl]
- and a
- jr z, .asm_92980
- dec [hl]
- srl a
- ret z
- ld a, [rOBP0]
- xor $ff
- ld e, a
- ld d, a
- call DmgToCgbObjPals
- ret
-.asm_92980
- call Function9279b
- call Function92879
- ret
-
-Function92987: ; 92987 (24:6987)
- xor a
- ld [wc70b], a
- ld [wc70c], a
- ld a, $e4
- call DmgToCgbBGPals
- call Function93124
- xor a
- ld [wcf64], a
- call Function92879
- ret
-
-Function9299e: ; 9299e (24:699e)
- call Function93158
- call Function92879
-
-Function929a4: ; 929a4 (24:69a4)
- ld hl, wcf64
- ld a, [hl]
- inc [hl]
- and $1
- ret z
- ld hl, wc711
- ld a, [hli]
- ld d, a
- or [hl]
- jr z, .asm_929d5
- ld e, [hl]
- dec de
- ld [hl], e
- dec hl
- ld [hl], d
- ld hl, Coins
- ld d, [hl]
- inc hl
- ld e, [hl]
- call Function92a04
- jr c, .asm_929c5
- inc de
-.asm_929c5
- ld [hl], e
- dec hl
- ld [hl], d
- ld a, [wcf64]
- and $7
- ret z
- ld de, SFX_GET_COIN_FROM_SLOTS
- call PlaySFX
- ret
-.asm_929d5
- call Function92879
- ret
-
-Function929d9: ; 929d9 (24:69d9)
- call Function9304c
- call WaitPressAorB_BlinkCursor
- call Function930e9
- jr c, .asm_929ea
- ld a, $0
- ld [wJumptableIndex], a
- ret
-.asm_929ea
- ld a, $12
- ld [wJumptableIndex], a
- ret
-
-Function929f0: ; 929f0 (24:69f0)
- ld hl, wJumptableIndex
- set 7, [hl]
- ret
-
-Function929f6: ; 929f6 (24:69f6)
- push de
- call Function92a12
- pop de
- ld a, [hli]
- ld [de], a
- inc de
- ld a, [hli]
- ld [de], a
- inc de
- ld a, [hli]
- ld [de], a
- ret
-
-Function92a04: ; 92a04 (24:6a04)
- ld a, d
- cp 9999 / $100
- jr c, .asm_92a10
- ld a, e
- cp 9999 % $100
- jr c, .asm_92a10
- scf
- ret
-.asm_92a10
- and a
- ret
-
-Function92a12: ; 92a12 (24:6a12)
- ld hl, $3
- add hl, bc
- ld a, [hl]
- and a
- jr nz, .asm_92a1c
- ld a, $f
-.asm_92a1c
- dec a
- and $f
- ld e, a
- ld d, $0
- ld hl, $1
- add hl, bc
- ld a, [hli]
- ld h, [hl]
- ld l, a
- add hl, de
- ret
-
-Function92a2b: ; 92a2b (24:6a2b)
- ld a, $7
- ret
-
-Function92a2e: ; 92a2e (24:6a2e)
- ld a, [wc70a]
- cp $2
- jr c, .asm_92a4e
- ld a, [wc709]
- and a
- jr z, .asm_92a3f
- cp $ff
- jr nz, .asm_92a4e
-.asm_92a3f
- call Function92a51
- jr nz, .asm_92a4e
- call Random
- cp $50
- jr nc, .asm_92a4e
- ld a, $a
- ret
-.asm_92a4e
- ld a, $8
- ret
-
-Function92a51: ; 92a51 (24:6a51)
- ld a, [wc700]
- and a
- ret z
- ld a, [wc701]
- and a
- ret z
- ld a, [wc702]
- and a
- ret
-
-Function92a60: ; 92a60 (24:6a60)
- ld a, [wc70b]
- and a
- jr z, .asm_92a95
- ld a, [wc70c]
- and a
- jr z, .asm_92a95
- ld a, [wc709]
- and a
- jr nz, .asm_92a84
- call Random
- cp 180
- jr nc, .asm_92a95
- cp 120
- jr nc, .asm_92a92
- cp 60
- jr nc, .asm_92a8f
- ld a, $15
- ret
-.asm_92a84
- call Random
- cp $a0
- jr nc, .asm_92a95
- cp $50
- jr nc, .asm_92a92
-.asm_92a8f
- ld a, $12
- ret
-.asm_92a92
- ld a, $10
- ret
-.asm_92a95
- ld a, $9
- ret
-
-Function92a98: ; 92a98 (24:6a98)
- ld bc, wc6d0
- ld hl, $6
- add hl, bc
- ld de, Sprites + $40
- ld [hl], e
- inc hl
- ld [hl], d
- ld hl, $1
- add hl, bc
- ld de, Unknown_93327
- ld [hl], e
- inc hl
- ld [hl], d
- ld hl, $8
- add hl, bc
- ld [hl], $30
- call Function92af9
- ld bc, wc6e0
- ld hl, $6
- add hl, bc
- ld de, Sprites + $60
- ld [hl], e
- inc hl
- ld [hl], d
- ld hl, $1
- add hl, bc
- ld de, Unknown_93339
- ld [hl], e
- inc hl
- ld [hl], d
- ld hl, $8
- add hl, bc
- ld [hl], $50
- call Function92af9
- ld bc, wc6f0
- ld hl, $6
- add hl, bc
- ld de, Sprites + $80
- ld [hl], e
- inc hl
- ld [hl], d
- ld hl, $1
- add hl, bc
- ld de, Unknown_9334b
- ld [hl], e
- inc hl
- ld [hl], d
- ld hl, $8
- add hl, bc
- ld [hl], $70
- call Function92af9
- ret
-
-Function92af9: ; 92af9 (24:6af9)
- ld hl, 0
- add hl, bc
- ld [hl], $0
- ld hl, $3
- add hl, bc
- ld [hl], $e
- ld hl, $4
- add hl, bc
- ld [hl], $0
- call Function92b53
- ret
-
-Function92b0f: ; 92b0f (24:6b0f)
- ld bc, wc6d0
- call Function92b22
- ld bc, wc6e0
- call Function92b22
- ld bc, wc6f0
- call Function92b22
- ret
-
-Function92b22: ; 92b22 (24:6b22)
- ld hl, $4
- add hl, bc
- ld a, [hl]
- and $f
- jr nz, .asm_92b2e
- call Function92bd4
-.asm_92b2e
- ld hl, $5
- add hl, bc
- ld a, [hl]
- and a
- ret z
- ld d, a
- ld hl, $4
- add hl, bc
- add [hl]
- ld [hl], a
- and $f
- jr z, Function92b53
- ld hl, $6
- add hl, bc
- ld a, [hli]
- ld h, [hl]
- ld l, a
- ld e, $8
-.asm_92b49
- ld a, [hl]
- add d
- ld [hli], a
-rept 3
- inc hl
-endr
- dec e
- jr nz, .asm_92b49
- ret
-
-Function92b53: ; 92b53 (24:6b53)
- ld hl, $8
- add hl, bc
- ld a, [hl]
- ld [wc712 + 1], a
- ld a, $50
- ld [wc712 + 2], a
- ld hl, $3
- add hl, bc
- ld e, [hl]
- ld d, $0
- ld hl, $1
- add hl, bc
- ld a, [hli]
- ld h, [hl]
- ld l, a
- add hl, de
- ld e, l
- ld d, h
- call Function92b83
- ld hl, $3
- add hl, bc
- ld a, [hl]
- inc a
- and $f
- cp $f
- jr nz, .asm_92b81
- xor a
-.asm_92b81
- ld [hl], a
- ret
-
-Function92b83: ; 92b83 (24:6b83)
- ld hl, $6
- add hl, bc
- ld a, [hli]
- ld h, [hl]
- ld l, a
-.asm_92b8a
- ld a, [wc712 + 2]
- ld [hli], a
- ld a, [wc712 + 1]
- ld [hli], a
- ld a, [de]
- ld [hli], a
- srl a
- srl a
- set 7, a
- ld [hli], a
- ld a, [wc712 + 2]
- ld [hli], a
- ld a, [wc712 + 1]
- add $8
- ld [hli], a
- ld a, [de]
-rept 2
- inc a
-endr
- ld [hli], a
- srl a
- srl a
- set 7, a
- ld [hli], a
- inc de
- ld a, [wc712 + 2]
- sub $10
- ld [wc712 + 2], a
- cp $10
- jr nz, .asm_92b8a
- ret
-; 92bbe (24:6bbe)
-
-Function92bbe: ; 92bbe
- push hl
- srl a
- srl a
- add Unknown_92bce % $100
- ld l, a
- ld a, 0
- adc Unknown_92bce / $100
- ld h, a
- ld a, [hl]
- pop hl
- ret
-; 92bce
-
-Unknown_92bce: ; 92bce
- db 0, 1, 2, 3, 4, 5
-; 92bd4
-
-Function92bd4: ; 92bd4 (24:6bd4)
- ld hl, 0
- add hl, bc
- ld e, [hl]
- ld d, 0
- ld hl, Jumptable_92be4
-rept 2
- add hl, de
-endr
- ld a, [hli]
- ld h, [hl]
- ld l, a
- jp [hl]
-; 92be4 (24:6be4)
-
-Jumptable_92be4: ; 92be4
- dw Function92c16
- dw Function92c4c
- dw Function92c17
- dw Function92c1e
- dw Function92c25
- dw Function92c2c
- dw Function92c33
- dw Function92c5e
- dw Function92c86
- dw Function92ca9
- dw Function92cd2
- dw Function92cf8
- dw Function92d13
- dw Function92df7
- dw Function92e10
- dw Function92e31
- dw Function92e47
- dw Function92e64
- dw Function92d20
- dw Function92d4f
- dw Function92d6e
- dw Function92d7e
- dw Function92da4
- dw Function92db3
- dw Function92dca
-; 92c16
-
-Function92c16: ; 92c16
- ret
-; 92c17
-
-Function92c17: ; 92c17
- ld hl, $5
- add hl, bc
- ld [hl], $10
- ret
-; 92c1e
-
-Function92c1e: ; 92c1e
- ld hl, $5
- add hl, bc
- ld [hl], $8
- ret
-; 92c25
-
-Function92c25: ; 92c25
- ld hl, $5
- add hl, bc
- ld [hl], $4
- ret
-; 92c2c
-
-Function92c2c: ; 92c2c
- ld hl, $5
- add hl, bc
- ld [hl], $2
- ret
-; 92c33
-
-Function92c33: ; 92c33
- ld hl, $5
- add hl, bc
- ld [hl], $1
- ret
-; 92c3a
-
-Function92c3a: ; 92c3a
- ld hl, $5
- add hl, bc
- ld [hl], $0
- ld hl, 0
- add hl, bc
- ld [hl], $1
- ld hl, $f
- add hl, bc
- ld [hl], $3
-
-Function92c4c: ; 92c4c
- ld hl, $f
- add hl, bc
- ld a, [hl]
- and a
- jr z, .asm_92c56
- dec [hl]
- ret
-
-.asm_92c56
- ld hl, 0
- add hl, bc
- ld a, $0
- ld [hl], a
- ret
-; 92c5e
-
-Function92c5e: ; 92c5e
- ld a, [wc709]
- cp $ff
- jr z, .asm_92c72
- ld hl, $9
- add hl, bc
- ld a, [hl]
- and a
- jr z, .asm_92c72
- dec [hl]
- call Function92c76
- ret nz
-
-.asm_92c72
- call Function92c3a
- ret
-; 92c76
-
-Function92c76: ; 92c76
- call Function92a12
- ld a, [wc709]
- ld e, a
- ld a, [hli]
- cp e
- ret z
- ld a, [hli]
- cp e
- ret z
- ld a, [hl]
- cp e
- ret
-; 92c86
-
-Function92c86: ; 92c86
- call Function92e94
- jr nc, .asm_92c94
- ld a, [wc717]
- ld hl, wc709
- cp [hl]
- jr z, .asm_92ca5
-
-.asm_92c94
- ld a, [wc709]
- cp $ff
- jr z, .asm_92ca5
- ld hl, $9
- add hl, bc
- ld a, [hl]
- and a
- jr z, .asm_92ca5
- dec [hl]
- ret
-
-.asm_92ca5
- call Function92c3a
- ret
-; 92ca9
-
-Function92ca9: ; 92ca9
- call Function92f1d
- jr nc, .asm_92cbd
- ld hl, wc709
- cp [hl]
- jr z, .asm_92cce
- ld hl, $9
- add hl, bc
- ld a, [hl]
- and a
- ret z
- dec [hl]
- ret
-
-.asm_92cbd
- ld a, [wc709]
- cp $ff
- jr z, .asm_92cce
- ld hl, $9
- add hl, bc
- ld a, [hl]
- and a
- jr z, .asm_92cce
- dec [hl]
- ret
-
-.asm_92cce
- call Function92c3a
- ret
-; 92cd2
-
-Function92cd2: ; 92cd2
- call Function92e94
- jr nc, .asm_92ce1
- ld a, [wc70c]
- and a
- jr z, .asm_92ce1
- call Function92c3a
- ret
-
-.asm_92ce1
- ld a, SFX_STOP_SLOT
- call Function9331e
- ld hl, 0
- add hl, bc
- inc [hl]
- ld hl, $a
- add hl, bc
- ld [hl], $20
- ld hl, $5
- add hl, bc
- ld [hl], $0
- ret
-; 92cf8
-
-Function92cf8: ; 92cf8
- ld hl, $a
- add hl, bc
- ld a, [hl]
- and a
- jr z, .asm_92d02
- dec [hl]
- ret
-
-.asm_92d02
- ld a, SFX_THROW_BALL
- call Function9331e
- ld hl, 0
- add hl, bc
- inc [hl]
- ld hl, $5
- add hl, bc
- ld [hl], $8
- ret
-; 92d13
-
-Function92d13: ; 92d13
- call Function92e94
- ret nc
- ld a, [wc70c]
- and a
- ret z
- call Function92c3a
- ret
-; 92d20
-
-Function92d20: ; 92d20
- call Function92f1d
- ret c
- ld a, SFX_STOP_SLOT
- call Function9331e
- call Function93316
- ld hl, 0
- add hl, bc
- inc [hl]
- ld hl, $5
- add hl, bc
- ld [hl], $0
- call Function92fc0
- push bc
- push af
- ld de, $6068
- ld a, $6
- call Function3b2a
- ld hl, $e
- add hl, bc
- pop af
- ld [hl], a
- pop bc
- xor a
- ld [wcf64], a
-
-Function92d4f: ; 92d4f
- ld a, [wcf64]
- cp $2
- jr z, .asm_92d5b
- cp $1
- jr z, .asm_92d62
- ret
-
-.asm_92d5b
- call Function92f1d
- call Function92c3a
- ret
-
-.asm_92d62
- ld hl, 0
- add hl, bc
- inc [hl]
- ld hl, $5
- add hl, bc
- ld [hl], $8
- ret
-; 92d6e
-
-Function92d6e: ; 92d6e
- xor a
- ld [wcf64], a
- ld hl, 0
- add hl, bc
- dec [hl]
- ld hl, $5
- add hl, bc
- ld [hl], $0
- ret
-; 92d7e
-
-Function92d7e: ; 92d7e
- call Function92f1d
- ret c
- ld a, SFX_STOP_SLOT
- call Function9331e
- call Function93316
- ld hl, 0
- add hl, bc
- inc [hl]
- ld hl, $5
- add hl, bc
- ld [hl], $0
- push bc
- ld de, $6000
- ld a, $7
- call Function3b2a
- pop bc
- xor a
- ld [wcf64], a
- ret
-; 92da4
-
-Function92da4: ; 92da4
- ld a, [wcf64]
- and a
- ret z
- ld hl, 0
- add hl, bc
- inc [hl]
- ld a, $2
- ld [wcf64], a
-
-Function92db3: ; 92db3
- ld a, [wcf64]
- cp $4
- ret c
- ld hl, 0
- add hl, bc
- inc [hl]
- ld hl, $5
- add hl, bc
- ld [hl], $10
- ld hl, $a
- add hl, bc
- ld [hl], $11
-
-Function92dca: ; 92dca
- ld hl, $a
- add hl, bc
- ld a, [hl]
- and a
- jr z, .asm_92dd4
- dec [hl]
- ret
-
-.asm_92dd4
- call Function92f1d
- jr nc, .asm_92de5
- and a
- jr nz, .asm_92de5
- ld a, $5
- ld [wcf64], a
- call Function92c3a
- ret
-
-.asm_92de5
- ld hl, $5
- add hl, bc
- ld [hl], $0
- ld hl, 0
- add hl, bc
-rept 2
- dec [hl]
-endr
- ld a, $1
- ld [wcf64], a
- ret
-; 92df7
-
-Function92df7: ; 92df7
- call Function92f1d
- ret c
- ld a, SFX_STOP_SLOT
- call Function9331e
- call Function93316
- ld hl, 0
- add hl, bc
- inc [hl]
- call Function92fc0
- ld hl, $a
- add hl, bc
- ld [hl], a
-
-Function92e10: ; 92e10
- ld hl, $a
- add hl, bc
- ld a, [hl]
- and a
- jr nz, .asm_92e1f
- call Function92f1d
- call Function92c3a
- ret
-
-.asm_92e1f
- dec [hl]
- ld hl, 0
- add hl, bc
- inc [hl]
- ld hl, $b
- add hl, bc
- ld [hl], $20
- ld hl, $5
- add hl, bc
- ld [hl], $0
-
-Function92e31: ; 92e31
- ld hl, $b
- add hl, bc
- ld a, [hl]
- and a
- jr z, .asm_92e3b
- dec [hl]
- ret
-
-.asm_92e3b
- ld hl, 0
- add hl, bc
- dec [hl]
- ld hl, $5
- add hl, bc
- ld [hl], $8
- ret
-; 92e47
-
-Function92e47: ; 92e47
- call Function92f1d
- ret c
- ld a, SFX_STOP_SLOT
- call Function9331e
- call Function93316
- ld hl, $5
- add hl, bc
- ld [hl], $1
- ld hl, 0
- add hl, bc
- inc [hl]
- ld hl, $a
- add hl, bc
- ld [hl], $10
-
-Function92e64: ; 92e64
- ld hl, $a
- add hl, bc
- ld a, [hl]
- and a
- jr z, .asm_92e73
- dec [hl]
-.asm_92e6d
- ld a, SFX_GOT_SAFARI_BALLS
- call Function9331e
- ret
-
-.asm_92e73
- ld a, [wc709]
- and a
- jr nz, .asm_92e88
- call Function92f1d
- jr nc, .asm_92e6d
- and a
- jr nz, .asm_92e6d
- call Function92c3a
- call WaitSFX
- ret
-
-.asm_92e88
- call Function92f1d
- jr c, .asm_92e6d
- call Function92c3a
- call WaitSFX
- ret
-; 92e94
-
-Function92e94: ; 92e94
- xor a
- ld [wc70b], a
- ld [wc70c], a
- call Function92a12
- call Function92fb4
- ld a, [wc70a]
- and 3
- ld e, a
- ld d, 0
- ld hl, Jumptable_92ebd
-rept 2
- add hl, de
-endr
- ld a, [hli]
- ld h, [hl]
- ld l, a
- ld de, .asm_92eb6
- push de
- jp [hl]
-
-.asm_92eb6
- ld a, [wc70b]
- and a
- ret z
- scf
- ret
-; 92ebd
-
-Jumptable_92ebd: ; 92ebd
- dw Function92ed4
- dw Function92ed1
- dw Function92ecb
- dw Function92ec5
-; 92ec5
-
-Function92ec5: ; 92ec5
- call Function92ee0
- call Function92ef6
-
-Function92ecb: ; 92ecb
- call Function92ed5
- call Function92f01
-
-Function92ed1: ; 92ed1
- call Function92eeb
-
-Function92ed4: ; 92ed4
- ret
-; 92ed5
-
-Function92ed5: ; 92ed5
- ld hl, wc70e
- ld a, [EnemyScreens]
- cp [hl]
- call z, Function92f0c
- ret
-; 92ee0
-
-Function92ee0: ; 92ee0
- ld hl, wEnemyGoesFirst
- ld a, [wc700]
- cp [hl]
- call z, Function92f0c
- ret
-; 92eeb
-
-Function92eeb: ; 92eeb
- ld hl, wEnemyGoesFirst
- ld a, [wc701]
- cp [hl]
- call z, Function92f0c
- ret
-; 92ef6
-
-Function92ef6: ; 92ef6
- ld hl, wEnemyGoesFirst
- ld a, [wc702]
- cp [hl]
- call z, Function92f0c
- ret
-; 92f01
-
-Function92f01: ; 92f01
- ld hl, wc710
- ld a, [wc702]
- cp [hl]
- call z, Function92f0c
- ret
-; 92f0c
-
-Function92f0c: ; 92f0c
- ld [wc717], a
- and a
- jr nz, .asm_92f17
- ld a, $1
- ld [wc70c], a
-
-.asm_92f17
- ld a, $1
- ld [wc70b], a
- ret
-; 92f1d
-
-Function92f1d: ; 92f1d
- ld a, $ff
- ld [EffectFailed], a
- call Function92a12
- call Function92fb4
- ld a, [wc70a]
- and 3
- ld e, a
- ld d, 0
- ld hl, Jumptable_92f48
-rept 2
- add hl, de
-endr
- ld a, [hli]
- ld h, [hl]
- ld l, a
- ld de, .asm_92f3d
- push de
- jp [hl]
-
-.asm_92f3d
- ld a, [wc70d]
- cp $ff
- jr nz, .asm_92f46
- and a
- ret
-
-.asm_92f46
- scf
- ret
-; 92f48
-
-Jumptable_92f48: ; 92f48
- dw Function92f5f
- dw Function92f5c
- dw Function92f56
- dw Function92f50
-; 92f50
-
-Function92f50: ; 92f50
- call Function92f70
- call Function92f90
-
-Function92f56: ; 92f56
- call Function92f60
- call Function92fa0
-
-Function92f5c: ; 92f5c
- call Function92f80
-
-Function92f5f: ; 92f5f
- ret
-; 92f60
-
-Function92f60: ; 92f60
- ld hl, wc70e
- ld a, [wc700]
- cp [hl]
- ret nz
- ld hl, wc703
- cp [hl]
- call z, Function92fb0
- ret
-; 92f70
-
-Function92f70: ; 92f70
- ld hl, wc710
- ld a, [wc700]
- cp [hl]
- ret nz
- ld hl, wc704
- cp [hl]
- call z, Function92fb0
- ret
-; 92f80
-
-Function92f80: ; 92f80
- ld hl, wEnemyGoesFirst
- ld a, [wc701]
- cp [hl]
- ret nz
- ld hl, wc704
- cp [hl]
- call z, Function92fb0
- ret
-; 92f90
-
-Function92f90: ; 92f90
- ld hl, wc70e
- ld a, [wc702]
- cp [hl]
- ret nz
- ld hl, wc704
- cp [hl]
- call z, Function92fb0
- ret
-; 92fa0
-
-Function92fa0: ; 92fa0
- ld hl, wc710
- ld a, [wc702]
- cp [hl]
- ret nz
- ld hl, wc705
- cp [hl]
- call z, Function92fb0
- ret
-; 92fb0
-
-Function92fb0: ; 92fb0
- ld [wc70d], a
- ret
-; 92fb4
-
-Function92fb4: ; 92fb4
- ld de, wc70e
- ld a, [hli]
- ld [de], a
- inc de
- ld a, [hli]
- ld [de], a
- inc de
- ld a, [hl]
- ld [de], a
- ret
-; 92fc0
-
-Function92fc0: ; 92fc0
- ld hl, $3
- add hl, bc
- ld a, [hl]
- push af
- push hl
- call Function92fcf
- pop hl
- pop af
- ld [hl], a
- ld a, e
- ret
-; 92fcf
-
-Function92fcf: ; 92fcf
- ld a, [wc709]
- and a
- jr nz, .asm_92fe8
- ld e, $0
-.asm_92fd7
- ld hl, $3
- add hl, bc
- inc [hl]
- inc e
- push de
- call Function92f1d
- pop de
- jr nc, .asm_92fd7
- and a
- jr nz, .asm_92fd7
- ret
-
-.asm_92fe8
- call Random
- and $7
- cp $4
- jr c, .asm_92fe8
- ld e, a
-.asm_92ff2
- ld a, e
- inc e
- ld hl, $3
- add hl, bc
- add [hl]
- ld [hl], a
- push de
- call Function92f1d
- pop de
- jr c, .asm_92ff2
- ret
-; 93002
-
-Function93002: ; 93002 (24:7002)
- ld a, [wc709]
- and a
- ret z
- ld hl, Unknown_93023
- ld a, [ScriptVar]
- and a
- jr z, .asm_93013
- ld hl, Unknown_93031
-.asm_93013
- call Random
- ld c, a
-.asm_93017
- ld a, [hli]
- cp c
- jr nc, .asm_9301e
- inc hl
- jr .asm_93017
-.asm_9301e
- ld a, [hl]
- ld [wc709], a
- ret
-; 93023 (24:7023)
-
-Unknown_93023: ; 93023
- db $01, $00
- db $03, $04
- db $0a, $14
- db $14, $10
- db $28, $0c
- db $30, $08
- db $ff, $ff
-; 93031
-
-Unknown_93031: ; 93031
- db $02, $00
- db $03, $04
- db $08, $14
- db $10, $10
- db $1e, $0c
- db $50, $08
- db $ff, $ff
-; 9303f
-
-Function9303f: ; 9303f (24:703f)
- ld b, $14
- ld a, [wc70a]
- dec a
- jr z, asm_93066
- dec a
- jr z, asm_9305a
- jr asm_9304e
-
-Function9304c: ; 9304c (24:704c)
- ld b, $23
-asm_9304e: ; 9304e (24:704e)
- hlcoord 3, 2
- call Function93069
- hlcoord 3, 10
- call Function93069
-asm_9305a: ; 9305a (24:705a)
- hlcoord 3, 4
- call Function93069
- hlcoord 3, 8
- call Function93069
-asm_93066: ; 93066 (24:7066)
- hlcoord 3, 6
-
-Function93069: ; 93069 (24:7069)
- ld a, b
- ld [hl], a
- ld de, $d
- add hl, de
- ld [hl], a
- ld de, $7
- add hl, de
- inc a
- ld [hl], a
- ld de, $d
- add hl, de
- ld [hl], a
- ret
-
-Function9307c: ; 9307c (24:707c)
- ld hl, UnknownText_0x930c7
- call PrintText
- ld hl, MenuDataHeader_0x930d6
- call LoadMenuDataHeader
- call InterpretMenu2
- call WriteBackup
- ret c
- ld a, [MenuSelection2]
- ld b, a
- ld a, $4
- sub b
- ld [wc70a], a
- ld hl, Coins
- ld c, a
- ld a, [hli]
- and a
- jr nz, .asm_930ad
- ld a, [hl]
- cp c
- jr nc, .asm_930ad
- ld hl, UnknownText_0x930d1
- call PrintText
- jr Function9307c
-.asm_930ad
- ld hl, Coins + 1
- ld a, [hl]
- sub c
- ld [hld], a
- jr nc, .asm_930b6
- dec [hl]
-.asm_930b6
- call WaitSFX
- ld de, SFX_PAY_DAY
- call PlaySFX
- ld hl, UnknownText_0x930cc
- call PrintText
- and a
- ret
-; 930c7 (24:70c7)
-
-UnknownText_0x930c7: ; 0x930c7
- ; Bet how many coins?
- text_jump UnknownText_0x1c5049
- db "@"
-; 0x930cc
-
-UnknownText_0x930cc: ; 0x930cc
- ; Start!
- text_jump UnknownText_0x1c505e
- db "@"
-; 0x930d1
-
-UnknownText_0x930d1: ; 0x930d1
- ; Not enough coins.
- text_jump UnknownText_0x1c5066
- db "@"
-; 0x930d6
-
-MenuDataHeader_0x930d6: ; 0x930d6
- db $40 ; flags
- db 10, 14 ; start coords
- db 17, 19 ; end coords
- dw MenuData2_0x930de
- db 1 ; default option
-; 0x930de
-
-MenuData2_0x930de: ; 0x930de
- db $80 ; flags
- db 3 ; items
- db " 3@"
- db " 2@"
- db " 1@"
-; 0x930e9
-
-Function930e9: ; 930e9 (24:70e9)
- ld hl, Coins
- ld a, [hli]
- or [hl]
- jr nz, .asm_930fd
- ld hl, UnknownText_9311a
- call PrintText
- ld c, 60
- call DelayFrames
- jr .asm_93118
-.asm_930fd
- ld hl, UnknownText_9311f
- call PrintText
- call LoadMenuTextBox
- lb bc, 14, 12
- call PlaceYesNoBox
- ld a, [MenuSelection2]
- dec a
- call WriteBackup
- and a
- jr nz, .asm_93118
- and a
- ret
-.asm_93118
- scf
- ret
-; 9311a (24:711a)
-
-UnknownText_9311a: ; 9311a
- text_jump UnknownText_0x1c5079
- db "@"
-
-UnknownText_9311f: ; 9311f
- text_jump UnknownText_0x1c5092
- db "@"
-
-Function93124: ; 93124 (24:7124)
- ld a, [EffectFailed]
- cp $ff
- jr z, .asm_93151
- srl a
- ld e, a
- ld d, 0
- ld hl, .data_93145
- add hl, de
- ld a, [hli]
- ld [PlayerUsedMoves], a
- ld e, a
- ld a, [hl]
- ld [wc711], a
- ld d, a
- callba MobileFn_105fe3
- ret
-
-.data_93145
- db $2c, $01
- db $32, $00
- db $06, $00
- db $08, $00
- db $0a, $00
- db $0f, $00
-
-.asm_93151
- ld hl, wc711
- xor a
- ld [hli], a
- ld [hl], a
- ret
-
-Function93158: ; 93158 (24:7158)
- ld a, [EffectFailed]
- cp $ff
- jr nz, .asm_9316c
- ld hl, UnknownText_0x931e0
- call PrintText
- callba MobileFn_105fd0
- ret
-.asm_9316c
- srl a
- ld e, a
- ld d, 0
- ld hl, Unknown_93195
-rept 3
- add hl, de
-endr
- ld de, StringBuffer2
- ld bc, $4
- call CopyBytes
- ld a, [hli]
- ld h, [hl]
- ld l, a
- ld de, .asm_93188
- push de
- jp [hl]
-.asm_93188
- ld hl, UnknownText_0x931b9
- call PrintText
- callba MobileFn_105f9f
- ret
-; 93195 (24:7195)
-
-Unknown_93195: ; 93195
- db "300@"
- dw Function931e5
- db "50@@"
- dw Function9320b
- db "6@@@"
- dw Function93214
- db "8@@@"
- dw Function93214
- db "10@@"
- dw Function93214
- db "15@@"
- dw Function93214
-; 931b9
-
-UnknownText_0x931b9: ; 0x931b9
- start_asm
-; 0x931ba
-
-Function931ba: ; 931ba
- ld a, [EffectFailed]
- add $25
- ldcoord_a 2, 13
- inc a
- ldcoord_a 2, 14
- inc a
- ldcoord_a 3, 13
- inc a
- ldcoord_a 3, 14
- hlcoord 18, 17
- ld [hl], $ee
- ld hl, UnknownText_0x931db
-rept 4
- inc bc
-endr
- ret
-; 931db
-
-UnknownText_0x931db: ; 0x931db
- ; lined up! Won @ coins!
- text_jump UnknownText_0x1c509f
- db "@"
-; 0x931e0
-
-UnknownText_0x931e0: ; 0x931e0
- ; Darn!
- text_jump UnknownText_0x1c50bb
- db "@"
-; 0x931e5
-
-Function931e5: ; 931e5
- ld a, SFX_2ND_PLACE
- call Function9331e
- call WaitSFX
- ld a, [wd002]
- and a
- jr nz, .asm_931ff
- call Random
- and $14
- ret z
- ld a, $ff
- ld [wc709], a
- ret
-
-.asm_931ff
- call Random
- and $1c
- ret z
- ld a, $ff
- ld [wc709], a
- ret
-; 9320b
-
-Function9320b: ; 9320b
- ld a, SFX_3RD_PLACE
- call Function9331e
- call WaitSFX
- ret
-; 93214
-
-Function93214: ; 93214
- ld a, SFX_PRESENT
- call Function9331e
- call WaitSFX
- ret
-; 9321d
-
-Function9321d: ; 9321d (24:721d)
- ld hl, $b
- add hl, bc
- ld e, [hl]
- ld d, 0
- ld hl, Jumptable_9322d
-rept 2
- add hl, de
-endr
- ld a, [hli]
- ld h, [hl]
- ld l, a
- jp [hl]
-
-Jumptable_9322d: ; 9322d (24:722d)
- dw Function93233
- dw Function93259
- dw Function93289
-
-
-Function93233: ; 93233 (24:7233)
- ld hl, $e
- add hl, bc
- ld a, [hl]
- and a
- jr nz, .asm_93247
- ld a, $2
- ld [wcf64], a
- ld hl, 0
- add hl, bc
- ld [hl], $0
- ret
-.asm_93247
- dec [hl]
- ld hl, $b
- add hl, bc
- inc [hl]
- ld hl, $c
- add hl, bc
- ld [hl], $30
- ld hl, $6
- add hl, bc
- ld [hl], $0
-
-Function93259: ; 93259 (24:7259)
- ld hl, $c
- add hl, bc
- ld a, [hl]
- cp $20
- jr c, .asm_93273
- dec [hl]
- ld e, a
- ld d, $70
- callba Functionce765
- ld a, e
- ld hl, $7
- add hl, bc
- ld [hl], a
- ret
-.asm_93273
- ld hl, $b
- add hl, bc
- inc [hl]
- ld hl, $d
- add hl, bc
- ld [hl], $2
- ld a, $1
- ld [wcf64], a
- ld a, SFX_PLACE_PUZZLE_PIECE_DOWN
- call Function9331e
- ret
-
-Function93289: ; 93289 (24:7289)
- ld hl, $6
- add hl, bc
- ld a, [hl]
-rept 2
- inc [hl]
-endr
- cp $48
- jr nc, .asm_932a3
- and $3
- ret nz
- ld hl, $d
- add hl, bc
- ld a, [hl]
- xor $ff
- inc a
- ld [hl], a
- ld [hSCY], a
- ret
-.asm_932a3
- ld hl, $b
- add hl, bc
- xor a
- ld [hl], a
- ld [hSCY], a
- ret
-
-Function932ac: ; 932ac (24:72ac)
- ld hl, $b
- add hl, bc
- ld e, [hl]
- ld d, 0
- ld hl, Jumptable_932bc
-rept 2
- add hl, de
-endr
- ld a, [hli]
- ld h, [hl]
- ld l, a
- jp [hl]
-
-Jumptable_932bc: ; 932bc (24:72bc)
- dw Function932c2
- dw Function932e0
- dw Function932fc
-
-
-Function932c2: ; 932c2 (24:72c2)
- ld hl, $4
- add hl, bc
- ld a, [hl]
- inc [hl]
- cp $68
- jr z, .asm_932d6
- and $f
- ret nz
- ld de, SFX_JUMP_OVER_LEDGE
- call PlaySFX
- ret
-.asm_932d6
- ld hl, $b
- add hl, bc
- inc [hl]
- ld a, $1
- ld [wcf64], a
-
-Function932e0: ; 932e0 (24:72e0)
- ld a, [wcf64]
- cp $2
- jr z, .asm_932f1
- cp $5
- ret nz
- ld hl, 0
- add hl, bc
- ld [hl], $0
- ret
-.asm_932f1
- ld hl, $b
- add hl, bc
- inc [hl]
- ld hl, $c
- add hl, bc
- ld [hl], $8
-
-Function932fc: ; 932fc (24:72fc)
- ld hl, $c
- add hl, bc
- ld a, [hl]
- and a
- jr z, .asm_93306
- dec [hl]
- ret
-.asm_93306
- ld hl, $b
- add hl, bc
- dec [hl]
- push bc
- ld de, $606c
- ld a, $8
- call Function3b2a
- pop bc
- ret
-; 93316 (24:7316)
-
-Function93316: ; 93316
- push bc
- ld c, 16
- call DelayFrames
- pop bc
- ret
-; 9331e
-
-Function9331e: ; 9331e (24:731e)
- push de
- ld e, a
- ld d, 0
- call PlaySFX
- pop de
- ret
-; 93327 (24:7327)
-
-Unknown_93327: ; 93327
- db $00, $08, $14, $0c, $10, $00, $08, $14, $0c, $10, $04, $08, $14, $0c, $10, $00, $08, $14
-Unknown_93339: ; 93339
- db $00, $0c, $08, $10, $14, $04, $0c, $08, $10, $14, $04, $0c, $08, $10, $14, $00, $0c, $08
-Unknown_9334b: ; 9334b
- db $00, $0c, $08, $10, $14, $0c, $08, $10, $14, $0c, $04, $08, $10, $14, $0c, $00, $0c, $08
-; 9335d
-
-SlotsTilemap: ; 9335d
-INCBIN "gfx/slots.tilemap"
-; 9344d
-
-Slots1LZ: ; 9344d
-INCBIN "gfx/slots_1.2bpp.lz"
-; 935cd
-
-Slots2LZ: ; 935cd
-INCBIN "gfx/slots_2.2bpp.lz"
-; 9382d
-
-Slots3LZ: ; 9382d
-INCBIN "gfx/slots_3.2bpp.lz"
-; 93a3d
-
-
-
SECTION "bank28", ROMX, BANK[$28]
INCLUDE "engine/more_phone_scripts.asm"
@@ -50468,871 +46077,8 @@
SECTION "bank2E", ROMX, BANK[$2E]
-ReturnFromMapSetupScript:: ; b8000
- xor a
- ld [hBGMapMode], a
- ; For some reson, GameFreak chose to use a callba here instead of just falling through.
- ; No other function in the game references the function at 2E:400A, here labeled
- ; ReturnFromMapSetupScript.inefficientcallba.
- callba .inefficientcallba ; this is a waste of 6 ROM bytes and 2 stack bytes
- ret
-; b800a
+INCLUDE "engine/events_3.asm"
-.inefficientcallba: ; b800a
- ld a, [MapGroup]
- ld b, a
- ld a, [MapNumber]
- ld c, a
- call GetWorldMapLocation
- ld [wCurrentLandmark], a
- call .CheckNationalParkGate
- jr z, .nationalparkgate
-
- call GetMapPermission
- cp GATE
- jr nz, .not_gate
-
-.nationalparkgate
- ld a, -1
- ld [wCurrentLandmark], a
-
-.not_gate
- ld hl, wEnteredMapFromContinue
- bit 1, [hl]
- res 1, [hl]
- jr nz, .dont_do_map_sign
-
- call .CheckMovingWithinLandmark
- jr z, .dont_do_map_sign
- ld a, [wCurrentLandmark]
- ld [wPreviousLandmark], a
-
- call .CheckSpecialMap
- jr z, .dont_do_map_sign
-
-; Display for 60 frames
- ld a, 60
- ld [wLandmarkSignTimer], a
- call LoadMapNameSignGFX
- call InitMapNameFrame
- callba Function104303
- ret
-
-.dont_do_map_sign
- ld a, [wCurrentLandmark]
- ld [wPreviousLandmark], a
- ld a, $90
- ld [rWY], a
- ld [hWY], a
- xor a
- ld [hLCDStatCustom], a
- ret
-; b8064
-
-.CheckMovingWithinLandmark: ; b8064
- ld a, [wCurrentLandmark]
- ld c, a
- ld a, [wPreviousLandmark]
- cp c
- ret z
- cp $0
- ret
-; b8070
-
-.CheckSpecialMap: ; b8070
- cp -1
- ret z
- cp SPECIAL_MAP
- ret z
- cp RADIO_TOWER
- ret z
- cp LAV_RADIO_TOWER
- ret z
- cp UNDERGROUND
- ret z
- cp INDIGO_PLATEAU
- ret z
- cp POWER_PLANT
- ret z
- ld a, $1
- and a
- ret
-; b8089
-
-.CheckNationalParkGate: ; b8089
- ld a, [MapGroup]
- cp GROUP_ROUTE_35_NATIONAL_PARK_GATE
- ret nz
- ld a, [MapNumber]
- cp MAP_ROUTE_35_NATIONAL_PARK_GATE
- ret z
- cp MAP_ROUTE_36_NATIONAL_PARK_GATE
- ret
-; b8098
-
-
-PlaceMapNameSign:: ; b8098 (2e:4098)
- ld hl, wLandmarkSignTimer
- ld a, [hl]
- and a
- jr z, .disappear
- dec [hl]
- cp 60
- ret z
- cp 59
- jr nz, .skip2
- call InitMapNameFrame
- call PlaceMapNameCenterAlign
- callba Function104303
-.skip2
- ld a, $80
- ld a, $70
- ld [rWY], a
- ld [hWY], a
- ret
-
-.disappear
- ld a, $90
- ld [rWY], a
- ld [hWY], a
- xor a
- ld [hLCDStatCustom], a
- ret
-
-
-LoadMapNameSignGFX: ; b80c6
- ld de, MapEntryFrameGFX
- ld hl, VTiles2 tile $60
- lb bc, BANK(MapEntryFrameGFX), $e
- call Get2bpp
- ret
-; b80d3
-
-InitMapNameFrame: ; b80d3
- hlcoord 0, 0
- ld b, 2
- ld c, 18
- call InitMapSignAttrMap
- call PlaceMapNameFrame
- ret
-; b80e1
-
-
-PlaceMapNameCenterAlign: ; b80e1 (2e:40e1)
- ld a, [wCurrentLandmark]
- ld e, a
- callba GetLandmarkName
- call .GetNameLength
- ld a, SCREEN_WIDTH
- sub c
- srl a
- ld b, $0
- ld c, a
- hlcoord 0, 2
- add hl, bc
- ld de, StringBuffer1
- call PlaceString
- ret
-
-.GetNameLength: ; b8101 (2e:4101)
- ld c, 0
- push hl
- ld hl, StringBuffer1
-.loop
- ld a, [hli]
- cp "@"
- jr z, .stop
- cp "%"
- jr z, .loop
- inc c
- jr .loop
-.stop
- pop hl
- ret
-
-
-InitMapSignAttrMap: ; b8115
- ld de, AttrMap - TileMap
- add hl, de
-rept 2
- inc b
-endr
-rept 2
- inc c
-endr
- ld a, $87
-.loop
- push bc
- push hl
-.inner_loop
- ld [hli], a
- dec c
- jr nz, .inner_loop
- pop hl
- ld de, SCREEN_WIDTH
- add hl, de
- pop bc
- dec b
- jr nz, .loop
- ret
-; b812f
-
-PlaceMapNameFrame: ; b812f
- hlcoord 0, 0
- ; top left
- ld a, $61
- ld [hli], a
- ; top row
- ld a, $62
- call .FillTopBottom
- ; top right
- ld a, $64
- ld [hli], a
- ; left, first line
- ld a, $65
- ld [hli], a
- ; first line
- call .FillMiddle
- ; right, first line
- ld a, $6b
- ld [hli], a
- ; left, second line
- ld a, $66
- ld [hli], a
- ; second line
- call .FillMiddle
- ; right, second line
- ld a, $6c
- ld [hli], a
- ; bottom left
- ld a, $67
- ld [hli], a
- ; bottom
- ld a, $68
- call .FillTopBottom
- ; bottom right
- ld a, $6a
- ld [hl], a
- ret
-; b815b
-
-.FillMiddle: ; b815b
- ld c, 18
- ld a, $6d
-.loop
- ld [hli], a
- dec c
- jr nz, .loop
- ret
-; b8164
-
-.FillTopBottom: ; b8164
- ld c, 5
- jr .enterloop
-
-.continueloop
-rept 2
- ld [hli], a
-endr
-
-.enterloop
- inc a
-rept 2
- ld [hli], a
-endr
- dec a
- dec c
- jr nz, .continueloop
- ret
-; b8172
-
-CheckForSignpostItems: ; b8172
-; Checks to see if there are hidden items on the screen that have not yet been found. If it finds one, returns carry.
- call GetMapScriptHeaderBank
- ld [Buffer1], a
-; Get the coordinate of the bottom right corner of the screen, and load it in wd1ec/wd1ed.
- ld a, [XCoord]
- add SCREEN_WIDTH / 4
- ld [wd1ed], a
- ld a, [YCoord]
- add SCREEN_HEIGHT / 4
- ld [wd1ec], a
-; Get the pointer for the first signpost header in the map...
- ld hl, wdc02
- ld a, [hli]
- ld h, [hl]
- ld l, a
-; ... before even checking to see if there are any signposts on this map.
- ld a, [wCurrentMapSignpostCount]
- and a
- jr z, .nosignpostitems
-; For i = 1:wCurrentMapSignpostCount...
-.loop
-; Store the counter in Buffer2, and store the signpost header pointer in the stack.
- ld [Buffer2], a
- push hl
-; Get the Y coordinate of the signpost.
- call .GetFarByte
- ld e, a
-; Is the Y coordinate of the signpost on the screen? If not, go to the next signpost.
- ld a, [wd1ec]
- sub e
- jr c, .next
- cp SCREEN_HEIGHT / 2
- jr nc, .next
-; Is the X coordinate of the signpost on the screen? If not, go to the next signpost.
- call .GetFarByte
- ld d, a
- ld a, [wd1ed]
- sub d
- jr c, .next
- cp SCREEN_WIDTH / 2
- jr nc, .next
-; Is this signpost a hidden item? If not, go to the next signpost.
- call .GetFarByte
- cp SIGNPOST_ITEM
- jr nz, .next
-; Has this item already been found? If not, set off the Itemfinder.
- ld a, [Buffer1]
- call GetFarHalfword
- ld a, [Buffer1]
- call GetFarHalfword
- ld d, h
- ld e, l
- ld b, CHECK_FLAG
- call EventFlagAction
- ld a, c
- and a
- jr z, .itemnearby
-
-.next
-; Restore the signpost header pointer and increment it by the length of a signpost header.
- pop hl
- ld bc, 5
- add hl, bc
-; Restore the signpost counter and decrement it. If it hits zero, there are no hidden items in range.
- ld a, [Buffer2]
- dec a
- jr nz, .loop
-
-.nosignpostitems
- xor a
- ret
-
-.itemnearby
- pop hl
- scf
- ret
-; b81e2
-
-.GetFarByte: ; b81e2
- ld a, [Buffer1]
- call GetFarByte
- inc hl
- ret
-; b81ea
-
-
-TreeMonEncounter: ; b81ea
- callba MobileFn_1060ef
-
- xor a
- ld [TempWildMonSpecies], a
- ld [CurPartyLevel], a
-
- ld hl, TreeMonMaps
- call GetTreeMonSet
- jr nc, .no_battle
-
- call GetTreeMons
- jr nc, .no_battle
-
- call GetTreeMon
- jr nc, .no_battle
-
- ld a, BATTLETYPE_TREE
- ld [BattleType], a
- ld a, 1
- ld [ScriptVar], a
- ret
-
-.no_battle
- xor a
- ld [ScriptVar], a
- ret
-; b8219
-
-RockMonEncounter: ; b8219
-
- xor a
- ld [TempWildMonSpecies], a
- ld [CurPartyLevel], a
-
- ld hl, RockMonMaps
- call GetTreeMonSet
- jr nc, .no_battle
-
- call GetTreeMons
- jr nc, .no_battle
-
- ld a, 10
- call RandomRange
- cp 4
- jr nc, .no_battle
-
- call SelectTreeMon
- jr nc, .no_battle
-
- ret
-
-.no_battle
- xor a
- ret
-; b823e
-
- db $05 ; ????
-
-GetTreeMonSet: ; b823f
-; Return carry and treemon set in a
-; if the current map is in table hl.
- ld a, [MapNumber]
- ld e, a
- ld a, [MapGroup]
- ld d, a
-.loop
- ld a, [hli]
- cp -1
- jr z, .not_in_table
-
- cp d
- jr nz, .skip2
-
- ld a, [hli]
- cp e
- jr nz, .skip1
-
- jr .in_table
-
-.skip2
- inc hl
-.skip1
- inc hl
- jr .loop
-
-.not_in_table
- xor a
- ret
-
-.in_table
- ld a, [hl]
- scf
- ret
-; b825e
-
-TreeMonMaps: ; b825e
-treemon_map: macro
- map \1
- db \2 ; treemon set
-endm
- treemon_map ROUTE_26, 4
- treemon_map ROUTE_27, 4
- treemon_map ROUTE_28, 0
- treemon_map ROUTE_29, 3
- treemon_map ROUTE_30, 3
- treemon_map ROUTE_31, 3
- treemon_map ROUTE_32, 4
- treemon_map ROUTE_33, 2
- treemon_map ROUTE_34, 3
- treemon_map ROUTE_35, 3
- treemon_map ROUTE_36, 3
- treemon_map ROUTE_37, 3
- treemon_map ROUTE_38, 3
- treemon_map ROUTE_39, 3
- treemon_map ROUTE_40, 0
- treemon_map ROUTE_41, 0
- treemon_map ROUTE_42, 2
- treemon_map ROUTE_43, 5
- treemon_map ROUTE_44, 1
- treemon_map ROUTE_45, 1
- treemon_map ROUTE_46, 1
- treemon_map NEW_BARK_TOWN, 0
- treemon_map CHERRYGROVE_CITY, 0
- treemon_map VIOLET_CITY, 0
- treemon_map AZALEA_TOWN, 2
- treemon_map CIANWOOD_CITY, 0
- treemon_map GOLDENROD_CITY, 0
- treemon_map OLIVINE_CITY, 0
- treemon_map ECRUTEAK_CITY, 0
- treemon_map MAHOGANY_TOWN, 0
- treemon_map LAKE_OF_RAGE, 5
- treemon_map BLACKTHORN_CITY, 0
- treemon_map SILVER_CAVE_OUTSIDE, 0
- treemon_map ILEX_FOREST, 6
- db -1
-; b82c5
-
-RockMonMaps: ; b82c5
- treemon_map CIANWOOD_CITY, 7
- treemon_map ROUTE_40, 7
- treemon_map DARK_CAVE_VIOLET_ENTRANCE, 7
- treemon_map SLOWPOKE_WELL_B1F, 7
- db -1
-; b82d2
-
-GetTreeMons: ; b82d2
-; Return the address of TreeMon table a in hl.
-; Return nc if table a doesn't exist.
-
- cp 8
- jr nc, .quit
-
- and a
- jr z, .quit
-
- ld e, a
- ld d, 0
- ld hl, TreeMons
-rept 2
- add hl, de
-endr
-
- ld a, [hli]
- ld h, [hl]
- ld l, a
-
- scf
- ret
-
-.quit
- xor a
- ret
-; b82e8
-
-TreeMons: ; b82e8
- dw TreeMons1
- dw TreeMons1
- dw TreeMons2
- dw TreeMons3
- dw TreeMons4
- dw TreeMons5
- dw TreeMons6
- dw RockMons
- dw TreeMons1
-
-; Two tables each (normal, rare).
-; Structure:
-; db %, species, level
-
-TreeMons1: ; b82fa
- db 50, SPEAROW, 10
- db 15, SPEAROW, 10
- db 15, SPEAROW, 10
- db 10, AIPOM, 10
- db 5, AIPOM, 10
- db 5, AIPOM, 10
- db -1
-
- db 50, SPEAROW, 10
- db 15, HERACROSS, 10
- db 15, HERACROSS, 10
- db 10, AIPOM, 10
- db 5, AIPOM, 10
- db 5, AIPOM, 10
- db -1
-
-TreeMons2: ; b8320
- db 50, SPEAROW, 10
- db 15, EKANS, 10
- db 15, SPEAROW, 10
- db 10, AIPOM, 10
- db 5, AIPOM, 10
- db 5, AIPOM, 10
- db -1
-
- db 50, SPEAROW, 10
- db 15, HERACROSS, 10
- db 15, HERACROSS, 10
- db 10, AIPOM, 10
- db 5, AIPOM, 10
- db 5, AIPOM, 10
- db -1
-
-TreeMons3: ; b8346
- db 50, HOOTHOOT, 10
- db 15, SPINARAK, 10
- db 15, LEDYBA, 10
- db 10, EXEGGCUTE, 10
- db 5, EXEGGCUTE, 10
- db 5, EXEGGCUTE, 10
- db -1
-
- db 50, HOOTHOOT, 10
- db 15, PINECO, 10
- db 15, PINECO, 10
- db 10, EXEGGCUTE, 10
- db 5, EXEGGCUTE, 10
- db 5, EXEGGCUTE, 10
- db -1
-
-TreeMons4: ; b836c
- db 50, HOOTHOOT, 10
- db 15, EKANS, 10
- db 15, HOOTHOOT, 10
- db 10, EXEGGCUTE, 10
- db 5, EXEGGCUTE, 10
- db 5, EXEGGCUTE, 10
- db -1
-
- db 50, HOOTHOOT, 10
- db 15, PINECO, 10
- db 15, PINECO, 10
- db 10, EXEGGCUTE, 10
- db 5, EXEGGCUTE, 10
- db 5, EXEGGCUTE, 10
- db -1
-
-TreeMons5: ; b8392
- db 50, HOOTHOOT, 10
- db 15, VENONAT, 10
- db 15, HOOTHOOT, 10
- db 10, EXEGGCUTE, 10
- db 5, EXEGGCUTE, 10
- db 5, EXEGGCUTE, 10
- db -1
-
- db 50, HOOTHOOT, 10
- db 15, PINECO, 10
- db 15, PINECO, 10
- db 10, EXEGGCUTE, 10
- db 5, EXEGGCUTE, 10
- db 5, EXEGGCUTE, 10
- db -1
-
-TreeMons6: ; b83b8
- db 50, HOOTHOOT, 10
- db 15, PINECO, 10
- db 15, PINECO, 10
- db 10, NOCTOWL, 10
- db 5, BUTTERFREE, 10
- db 5, BEEDRILL, 10
- db -1
-
- db 50, HOOTHOOT, 10
- db 15, CATERPIE, 10
- db 15, WEEDLE, 10
- db 10, HOOTHOOT, 10
- db 5, METAPOD, 10
- db 5, KAKUNA, 10
- db -1
-
-RockMons: ; b83de
- db 90, KRABBY, 15
- db 10, SHUCKLE, 15
- db -1
-; b83e5
-
-GetTreeMon: ; b83e5
- push hl
- call GetTreeScore
- pop hl
- and a
- jr z, .bad
- cp 1
- jr z, .good
- cp 2
- jr z, .rare
- ret
-
-.bad
- ld a, 10
- call RandomRange
- and a
- jr nz, NoTreeMon
- jr SelectTreeMon
-
-.good
- ld a, 10
- call RandomRange
- cp 5
- jr nc, NoTreeMon
- jr SelectTreeMon
-
-.rare
- ld a, 10
- call RandomRange
- cp 8
- jr nc, NoTreeMon
- jr .skip
-.skip
- ld a, [hli]
- cp -1
- jr nz, .skip
- call SelectTreeMon
- ret
-; b841f
-
-SelectTreeMon: ; b841f
-; Read a TreeMons table and pick one monster at random.
-
- ld a, 100
- call RandomRange
-.loop
- sub [hl]
- jr c, .ok
-rept 3
- inc hl
-endr
- jr .loop
-
-.ok
- ld a, [hli]
- cp $ff
- jr z, NoTreeMon
-
- ld a, [hli]
- ld [TempWildMonSpecies], a
- ld a, [hl]
- ld [CurPartyLevel], a
- scf
- ret
-
-NoTreeMon: ; b843b
- xor a
- ld [TempWildMonSpecies], a
- ld [CurPartyLevel], a
- ret
-; b8443
-
-GetTreeScore: ; b8443
- call .CoordScore
- ld [Buffer1], a
- call .OTIDScore
- ld [Buffer2], a
- ld c, a
- ld a, [Buffer1]
- sub c
- jr z, .rare
- jr nc, .ok
- add 10
-.ok
- cp 5
- jr c, .good
-
-.bad
- xor a
- ret
-
-.good
- ld a, 1
- ret
-
-.rare
- ld a, 2
- ret
-; b8466
-
-.CoordScore: ; b8466
- call GetFacingTileCoord
- ld hl, 0
- ld c, e
- ld b, 0
- ld a, d
-
- and a
- jr z, .next
-.loop
- add hl, bc
- dec a
- jr nz, .loop
-.next
-
- add hl, bc
- ld c, d
- add hl, bc
-
- ld a, h
- ld [hDividend], a
- ld a, l
- ld [hDividend + 1], a
- ld a, 5
- ld [hDivisor], a
- ld b, 2
- call Divide
-
- ld a, [hQuotient + 1]
- ld [hDividend], a
- ld a, [hQuotient + 2]
- ld [hDividend + 1], a
- ld a, 10
- ld [hDivisor], a
- ld b, 2
- call Divide
-
- ld a, [hQuotient + 3]
- ret
-; b849d
-
-.OTIDScore: ; b849d
- ld a, [PlayerID]
- ld [hDividend], a
- ld a, [PlayerID + 1]
- ld [hDividend + 1], a
- ld a, 10
- ld [hDivisor], a
- ld b, 2
- call Divide
- ld a, [hQuotient + 3]
- ret
-; b84b3
-
-
-Functionb84b3: ; b84b3
- ld a, [rVBK]
- push af
- ld a, $1
- ld [rVBK], a
-
- ld de, FishingGFX
- ld a, [PlayerGender]
- bit 0, a
- jr z, .asm_b84c7
- ld de, KrisFishingGFX
-.asm_b84c7
-
- ld hl, VTiles0 tile $02
- call Functionb84e3
- ld hl, VTiles0 tile $06
- call Functionb84e3
- ld hl, VTiles0 tile $0a
- call Functionb84e3
- ld hl, VTiles2 tile $00 - $40
- call Functionb84e3
-
- pop af
- ld [rVBK], a
- ret
-; b84e3
-
-Functionb84e3: ; b84e3
- lb bc, BANK(FishingGFX), 2
- push de
- call Get2bpp
- pop de
- ld hl, $20
- add hl, de
- ld d, h
- ld e, l
- ret
-; b84f2
-
-FishingGFX: ; b84f2
-INCBIN "gfx/unknown/0b84f2.2bpp"
-; b8582
-
-KrisFishingGFX: ; b8582
-INCBIN "gfx/unknown/0b8582.2bpp"
-; b8612
-
INCLUDE "engine/radio.asm"
ReadPartyMonMail: ; b9229
@@ -51344,7 +46090,7 @@
ld e, l
ReadAnyMail: ; b9237
push de
- call WhiteBGMap
+ call ClearBGPalettes
call ClearSprites
call ClearTileMap
call DisableLCD
@@ -51379,7 +46125,7 @@
xor a
ld [hJoyPressed], a
call Functionb929a
- call WhiteBGMap
+ call ClearBGPalettes
call DisableLCD
call LoadStandardFont
jp EnableLCD
@@ -52543,7 +47289,7 @@
DisplayCaughtContestMonStats: ; cc000
- call WhiteBGMap
+ call ClearBGPalettes
call ClearTileMap
call ClearSprites
call LoadFontsBattleExtra
@@ -52845,5847 +47591,10 @@
ret
; e00ee (38:40ee)
-_CardFlip: ; e00ee (38:40ee)
- ld hl, Options
- set 4, [hl]
- call WhiteBGMap
- call ClearTileMap
- call ClearSprites
- ld de, MUSIC_NONE
- call PlayMusic
- call DelayFrame
- call DisableLCD
- call LoadStandardFont
- call LoadFontsExtra
- ld hl, LZ_e0d16
- ld de, VTiles2 tile $00
- call Decompress
- ld hl, LZ_e0ea8
- ld de, VTiles2 tile $3e
- call Decompress
- ld hl, LZ_e0cdb
- ld de, VTiles0 tile $00
- call Decompress
- ld hl, GFX_e0cf6
- ld de, VTiles1 tile $6f
- ld bc, $10
- call CopyBytes
- ld hl, GFX_e0d06
- ld de, VTiles1 tile $75
- ld bc, $10
- call CopyBytes
- call Functione0521
- call Functione04c1
- call Functione0c37
- call EnableLCD
- call Function3200
- ld a, $e4
- call DmgToCgbBGPals
- ld de, $e4e4
- call DmgToCgbObjPals
- call DelayFrame
- xor a
- ld [wJumptableIndex], a
- ld a, $2
- ld [wcf64], a
- ld [wcf65], a
- ld de, MUSIC_GAME_CORNER
- call PlayMusic
-.MasterLoop
- ld a, [wJumptableIndex]
- bit 7, a
- jr nz, .leavethegame
- call .CardFlip
- jr .MasterLoop
-.leavethegame
- call WaitSFX
- ld de, SFX_QUIT_SLOTS
- call PlaySFX
- call WaitSFX
- call WhiteBGMap
- ld hl, Options
- res 4, [hl]
- ret
-
-.CardFlip: ; e0191 (38:4191)
- ld a, [wJumptableIndex]
- ld e, a
- ld d, 0
- ld hl, .Jumptable
-rept 2
- add hl, de
-endr
- ld a, [hli]
- ld h, [hl]
- ld l, a
- jp [hl]
-; e01a0 (38:41a0)
-
-.Jumptable: ; e01a0
- dw .AskPlayWithThree
- dw .DeductCoins
- dw .ChooseACard
- dw .PlaceYourBet
- dw .CheckTheCard
- dw .TabulateTheResult
- dw .PlayAgain
- dw .Quit
-; e01b0
-
-.Increment: ; e01b0
- ld hl, wJumptableIndex
- inc [hl]
- ret
-; e01b5
-
-.AskPlayWithThree: ; e01b5
- ld hl, .PlayWithThreeCoinsText
- call Functione0489
- call YesNoBox
- jr c, .SaidNo
- call Functione0366
- call .Increment
- ret
-
-.SaidNo
- ld a, $7
- ld [wJumptableIndex], a
- ret
-; e01cd
-
-.PlayWithThreeCoinsText: ; 0xe01cd
- ; Play with three coins?
- text_jump UnknownText_0x1c5793
- db "@"
-; 0xe01d2
-
-.DeductCoins: ; e01d2
- ld a, [Coins]
- ld h, a
- ld a, [Coins + 1]
- ld l, a
- ld a, h
- and a
- jr nz, .deduct ; You have at least 256 coins.
- ld a, l
- cp 3
- jr nc, .deduct ; You have at least 3 coins.
- ld hl, .NotEnoughCoinsText
- call Functione0489
- ld a, $7
- ld [wJumptableIndex], a
- ret
-
-.deduct
- ld de, -3
- add hl, de
- ld a, h
- ld [Coins], a
- ld a, l
- ld [Coins + 1], a
- ld de, SFX_TRANSACTION
- call PlaySFX
- xor a
- ld [hBGMapMode], a
- call Functione049c
- ld a, $1
- ld [hBGMapMode], a
- call WaitSFX
- call .Increment
- ret
-; e0212
-
-.NotEnoughCoinsText: ; 0xe0212
- ; Not enough coins…
- text_jump UnknownText_0x1c57ab
- db "@"
-; 0xe0217
-
-.ChooseACard: ; e0217
- xor a
- ld [hBGMapMode], a
- hlcoord 0, 0
- lb bc, 12, 9
- call Functione04e5
- hlcoord 9, 0
- ld bc, SCREEN_WIDTH
- ld a, [wc6e8]
- call AddNTimes
- ld [hl], $f5
- ld a, $1
- ld [hBGMapMode], a
- ld c, 20
- call DelayFrames
- hlcoord 2, 0
- call Functione03c1
- ld a, $1
- ld [hBGMapMode], a
- ld c, 20
- call DelayFrames
- hlcoord 2, 6
- call Functione03c1
- call WaitBGMap
- ld hl, .ChooseACardText
- call Functione0489
- xor a
- ld [wcf66], a
-.loop
- call JoyTextDelay
- ld a, [hJoyLast]
- and A_BUTTON
- jr nz, .next
- ld de, SFX_KINESIS
- call PlaySFX
- call Functione0849
- ld c, 4
- call DelayFrames
- ld hl, wcf66
- ld a, [hl]
- xor $1
- ld [hl], a
- jr .loop
-
-.next
- ld de, SFX_SLOT_MACHINE_START
- call PlaySFX
- ld a, $3
-.loop2
- push af
- call Functione0849
- ld c, 4
- call DelayFrames
- call ClearSprites
- ld c, 4
- call DelayFrames
- pop af
- dec a
- jr nz, .loop2
- ld hl, wcf66
- ld a, [hl]
- push af
- xor $1
- ld [hl], a
- call Functione03ac
- lb bc, 6, 5
- call Functione04e5
- pop af
- ld [wcf66], a
- call .Increment
- ret
-; e02b2
-
-.ChooseACardText: ; 0xe02b2
- ; Choose a card.
- text_jump UnknownText_0x1c57be
- db "@"
-; 0xe02b7
-
-.PlaceYourBet: ; e02b7
- ld hl, .PlaceYourBetText
- call Functione0489
-.betloop
- call JoyTextDelay
- ld a, [hJoyLast]
- and A_BUTTON
- jr nz, .betdone
- call Functione089c
- call Functione0960
- call DelayFrame
- jr .betloop
-
-.betdone
- call .Increment
- ret
-; e02d5
-
-.PlaceYourBetText: ; 0xe02d5
- ; Place your bet.
- text_jump UnknownText_0x1c57ce
- db "@"
-; 0xe02da
-
-.CheckTheCard: ; e02da
- xor a
- ld [hVBlankCounter], a
- call Functione0960
- call WaitSFX
- ld de, SFX_CHOOSE_A_CARD
- call PlaySFX
- call WaitSFX
- ld a, [wc6e8]
- ld e, a
- ld d, 0
- ld hl, wc6d0
-rept 2
- add hl, de
-endr
- ld a, [wcf66]
- ld e, a
- add hl, de
- ld a, [hl]
- ld [CurEnemyMoveNum], a
- ld e, a
- ld hl, wc6ea
- add hl, de
- ld [hl], $1
- call Functione03ac
- call Functione03ec
- call Function3200
- call .Increment
- ret
-; e0314
-
-.TabulateTheResult: ; e0314
- call Functione0637
- call WaitPressAorB_BlinkCursor
- call .Increment
- ret
-; e031e
-
-.PlayAgain: ; e031e
- call ClearSprites
- ld hl, .PlayAgainText
- call Functione0489
- call YesNoBox
- jr nc, .Continue
- call .Increment
- ret
-
-.Continue
- ld a, [wc6e8]
- inc a
- ld [wc6e8], a
- cp $c
- jr c, .KeepTheCurrentDeck
- call Functione04c1
- ld a, $1
- ld [hBGMapMode], a
- call Functione0366
- ld hl, .CardsShuffledText
- call PrintText
- jr .LoopAround
-
-.KeepTheCurrentDeck
- call Functione0534
-
-.LoopAround
- ld a, $1
- ld [wJumptableIndex], a
- ret
-; e0356
-
-.PlayAgainText: ; 0xe0356
- ; Want to play again?
- text_jump UnknownText_0x1c57df
- db "@"
-; 0xe035b
-
-.CardsShuffledText: ; 0xe035b
- ; The cards have been shuffled.
- text_jump UnknownText_0x1c57f4
- db "@"
-; 0xe0360
-
-.Quit: ; e0360
- ld hl, wJumptableIndex
- set 7, [hl]
- ret
-; e0366
-
-Functione0366: ; e0366
- ld hl, wc6d0
- ld bc, $18
- xor a
- call ByteFill
- ld de, wc6d0
- ld c, $17
-.asm_e0375
- call Random
- and $1f
- cp $18
- jr nc, .asm_e0375
- ld l, a
- ld h, $0
- add hl, de
- ld a, [hl]
- and a
- jr nz, .asm_e0375
- ld [hl], c
- dec c
- jr nz, .asm_e0375
- xor a
- ld [wc6e8], a
- ld hl, wc6ea
- ld bc, $18
- call ByteFill
- ret
-; e0398
-
-Functione0398: ; e0398
- ld hl, 0
- ld bc, 6
- ld a, [wcf64]
- call AddNTimes
- ld b, $0
- ld a, [wcf65]
- ld c, a
- add hl, bc
- ret
-; e03ac
-
-Functione03ac: ; e03ac
- ld a, [wcf66]
- and a
- jr nz, .asm_e03ba
- hlcoord 2, 0
- ld bc, $1018
- jr .asm_e03c0
-
-.asm_e03ba
- hlcoord 2, 6
- ld bc, $4018
-
-.asm_e03c0
- ret
-; e03c1
-
-Functione03c1: ; e03c1
- xor a
- ld [hBGMapMode], a
- ld de, Unknown_e03ce
- lb bc, 6, 5
- call Functione04f7
- ret
-; e03ce
-
-Unknown_e03ce: ; e03ce
- db $08, $09, $09, $09, $0a
- db $0b, $28, $2b, $28, $0c
- db $0b, $2c, $2d, $2e, $0c
- db $0b, $2f, $30, $31, $0c
- db $0b, $32, $33, $34, $0c
- db $0d, $0e, $0e, $0e, $0f
-; e03ec
-
-Functione03ec: ; e03ec
- xor a
- ld [hBGMapMode], a
- push hl
- push hl
- ld de, Unknown_e043b
- lb bc, 6, 5
- call Functione04f7
- ld a, [CurEnemyMoveNum]
- ld e, a
- ld d, 0
- ld hl, Unknown_e0459
-rept 2
- add hl, de
-endr
- ld a, [hli]
- ld e, a
- ld d, [hl]
- pop hl
- ld bc, $17
- add hl, bc
- ld [hl], e
- ld bc, SCREEN_HEIGHT
- add hl, bc
- ld a, d
- ld de, SCREEN_WIDTH
- ld b, $3
-.asm_e0418
- push hl
- ld c, $3
-.asm_e041b
- ld [hli], a
- inc a
- dec c
- jr nz, .asm_e041b
- pop hl
- add hl, de
- dec b
- jr nz, .asm_e0418
- pop hl
- ld a, [hCGB]
- and a
- ret z
- ld de, AttrMap - TileMap
- add hl, de
- ld a, [CurEnemyMoveNum]
- and 3
- inc a
- lb bc, 6, 5
- call Functione04e7
- ret
-; e043b
+INCLUDE "engine/card_flip.asm"
+INCLUDE "engine/dummy_game.asm"
+INCLUDE "engine/billspc.asm"
-Unknown_e043b: ; e043b
- db $18, $19, $19, $19, $1a
- db $1b, $35, $7f, $7f, $1c
- db $0b, $28, $28, $28, $0c
- db $0b, $28, $28, $28, $0c
- db $0b, $28, $28, $28, $0c
- db $1d, $1e, $1e, $1e, $1f
-; e0459
-
-Unknown_e0459: ; e0459
- db $f7,$4e, $f7,$57, $f7,$69, $f7,$60
- db $f8,$4e, $f8,$57, $f8,$69, $f8,$60
- db $f9,$4e, $f9,$57, $f9,$69, $f9,$60
- db $fa,$4e, $fa,$57, $fa,$69, $fa,$60
- db $fb,$4e, $fb,$57, $fb,$69, $fb,$60
- db $fc,$4e, $fc,$57, $fc,$69, $fc,$60
-; e0489
-
-Functione0489: ; e0489
- push hl
- hlcoord 0, 12
- ld b, $4
- ld c, $12
- call TextBox
- pop hl
- call PrintTextBoxText
- call Functione049c
- ret
-; e049c
-
-Functione049c: ; e049c
- hlcoord 9, 15
- ld b, $1
- ld c, $9
- call TextBox
- hlcoord 10, 16
- ld de, String_e04bc
- call PlaceString
- hlcoord 15, 16
- ld de, Coins
- lb bc, PRINTNUM_LEADINGZEROS | 2, 4
- call PrintNum
- ret
-; e04bc
-
-String_e04bc:
- db "COIN@"
-; e04c1
-
-Functione04c1: ; e04c1 (38:44c1)
- xor a
- ld [hBGMapMode], a
- hlcoord 0, 0
- ld bc, SCREEN_HEIGHT * SCREEN_WIDTH
- ld a, $29
- call ByteFill
- hlcoord 9, 0
- ld de, Unknown_e110c
- lb bc, 12, 11
- call Functione04f7
- hlcoord 0, 12
- lb bc, 4, 18
- call TextBox
- ret
-; e04e5 (38:44e5)
-
-Functione04e5: ; e04e5
- ld a, $29
-
-Functione04e7: ; e04e7 (38:44e7)
- push bc
- push hl
-.asm_e04e9
- ld [hli], a
- dec c
- jr nz, .asm_e04e9
- pop hl
- ld bc, $14
- add hl, bc
- pop bc
- dec b
- jr nz, Functione04e7
- ret
-
-Functione04f7: ; e04f7 (38:44f7)
- push bc
- push hl
-.asm_e04f9
- ld a, [de]
- inc de
- ld [hli], a
- dec c
- jr nz, .asm_e04f9
- pop hl
- ld bc, $14
- add hl, bc
- pop bc
- dec b
- jr nz, Functione04f7
- ret
-; e0509 (38:4509)
-
-Functione0509: ; e0509
- ld de, Sprites
- ld a, [hli]
-.asm_e050d
- push af
- ld a, [hli]
- add b
- ld [de], a
- inc de
- ld a, [hli]
- add c
- ld [de], a
- inc de
- ld a, [hli]
- ld [de], a
- inc de
- ld a, [hli]
- ld [de], a
- inc de
- pop af
- dec a
- jr nz, .asm_e050d
- ret
-; e0521
-
-Functione0521: ; e0521 (38:4521)
- ld de, VTiles1 tile $76
- ld hl, $8f62
- ld bc, $9e
- call CopyBytes
- ld hl, $8ffe
- xor a
- ld [hli], a
- ld [hl], a
- ret
-; e0534 (38:4534)
-
-Functione0534: ; e0534
- xor a
- ld [hBGMapMode], a
- ld a, [CurEnemyMoveNum]
- ld e, a
- ld d, 0
- and 3
- ld c, a
- ld b, 0
- ld a, e
- and $1c
- srl a
- add Jumptable_e0553 % $100
- ld l, a
- ld a, 0
- adc Jumptable_e0553 / $100
- ld h, a
- ld a, [hli]
- ld h, [hl]
- ld l, a
- jp [hl]
-; e0553
-
-Jumptable_e0553: ; e0553
- dw Functione055f
- dw Functione0583
- dw Functione05a7
- dw Functione05cb
- dw Functione05ef
- dw Functione0613
-; e055f
-
-Functione055f: ; e055f
- ld hl, wc6e6 + 8
- add hl, de
- ld a, [hl]
- and a
- jr nz, .asm_e0575
- hlcoord 13, 3
-rept 2
- add hl, bc
-endr
- ld [hl], $36
- ld bc, SCREEN_WIDTH
- add hl, bc
- ld [hl], $37
- ret
-
-.asm_e0575
- hlcoord 13, 3
-rept 2
- add hl, bc
-endr
- ld [hl], $36
- ld bc, SCREEN_WIDTH
- add hl, bc
- ld [hl], $3d
- ret
-; e0583
-
-Functione0583: ; e0583
- ld hl, wc6e6
- add hl, de
- ld a, [hl]
- and a
- jr nz, .asm_e0599
- hlcoord 13, 4
-rept 2
- add hl, bc
-endr
- ld [hl], $3b
- ld bc, SCREEN_WIDTH
- add hl, bc
- ld [hl], $3a
- ret
-
-.asm_e0599
- hlcoord 13, 4
-rept 2
- add hl, bc
-endr
- ld [hl], $3d
- ld bc, SCREEN_WIDTH
- add hl, bc
- ld [hl], $3a
- ret
-; e05a7
-
-Functione05a7: ; e05a7
- ld hl, wc6e6 + 8
- add hl, de
- ld a, [hl]
- and a
- jr nz, .asm_e05bd
- hlcoord 13, 6
-rept 2
- add hl, bc
-endr
- ld [hl], $36
- ld bc, SCREEN_WIDTH
- add hl, bc
- ld [hl], $38
- ret
-
-.asm_e05bd
- hlcoord 13, 6
-rept 2
- add hl, bc
-endr
- ld [hl], $36
- ld bc, SCREEN_WIDTH
- add hl, bc
- ld [hl], $3d
- ret
-; e05cb
-
-Functione05cb: ; e05cb
- ld hl, wc6e6
- add hl, de
- ld a, [hl]
- and a
- jr nz, .asm_e05e1
- hlcoord 13, 7
-rept 2
- add hl, bc
-endr
- ld [hl], $3c
- ld bc, SCREEN_WIDTH
- add hl, bc
- ld [hl], $3a
- ret
-
-.asm_e05e1
- hlcoord 13, 7
-rept 2
- add hl, bc
-endr
- ld [hl], $3d
- ld bc, SCREEN_WIDTH
- add hl, bc
- ld [hl], $3a
- ret
-; e05ef
-
-Functione05ef: ; e05ef
- ld hl, wc6e6 + 8
- add hl, de
- ld a, [hl]
- and a
- jr nz, .asm_e0605
- hlcoord 13, 9
-rept 2
- add hl, bc
-endr
- ld [hl], $36
- ld bc, SCREEN_WIDTH
- add hl, bc
- ld [hl], $39
- ret
-
-.asm_e0605
- hlcoord 13, 9
-rept 2
- add hl, bc
-endr
- ld [hl], $36
- ld bc, SCREEN_WIDTH
- add hl, bc
- ld [hl], $3d
- ret
-; e0613
-
-Functione0613: ; e0613
- ld hl, wc6e6
- add hl, de
- ld a, [hl]
- and a
- jr nz, .asm_e0629
- hlcoord 13, 10
-rept 2
- add hl, bc
-endr
- ld [hl], $3c
- ld bc, SCREEN_WIDTH
- add hl, bc
- ld [hl], $3a
- ret
-
-.asm_e0629
- hlcoord 13, 10
-rept 2
- add hl, bc
-endr
- ld [hl], $3d
- ld bc, SCREEN_WIDTH
- add hl, bc
- ld [hl], $3a
- ret
-; e0637
-
-Functione0637: ; e0637
- call Functione0398
- add hl, hl
- ld de, Jumptable_e0643
- add hl, de
- ld a, [hli]
- ld h, [hl]
- ld l, a
- jp [hl]
-; e0643
-
-Jumptable_e0643: ; e0643
- dw Functione06a3
- dw Functione06a3
- dw Functione06a6
- dw Functione06a6
- dw Functione06b0
- dw Functione06b0
- dw Functione06a3
- dw Functione06a3
- dw Functione06ec
- dw Functione06f6
- dw Functione0702
- dw Functione070e
- dw Functione06c2
- dw Functione0722
- dw Functione0770
- dw Functione0774
- dw Functione0778
- dw Functione077c
- dw Functione06c2
- dw Functione072c
- dw Functione0780
- dw Functione0784
- dw Functione0788
- dw Functione078c
- dw Functione06cc
- dw Functione0738
- dw Functione0790
- dw Functione0794
- dw Functione0798
- dw Functione079c
- dw Functione06cc
- dw Functione0744
- dw Functione07a0
- dw Functione07a4
- dw Functione07a8
- dw Functione07ac
- dw Functione06d8
- dw Functione0750
- dw Functione07b0
- dw Functione07b4
- dw Functione07b8
- dw Functione07bc
- dw Functione06d8
- dw Functione075c
- dw Functione07c0
- dw Functione07c4
- dw Functione07c8
- dw Functione07cc
-; e06a3
-
-Functione06a3: ; e06a3
- jp Functione07db
-; e06a6
-
-Functione06a6: ; e06a6
- ld a, [CurEnemyMoveNum]
- and $2
- jp nz, Functione07db
- jr Functione06ba
-
-Functione06b0: ; e06b0
- ld a, [CurEnemyMoveNum]
- and $2
- jr nz, Functione06ba
- jp Functione07db
-
-Functione06ba: ; e06ba
- ld c, $6
- ld de, SFX_2ND_PLACE
- jp Functione07eb
-; e06c2
-
-Functione06c2: ; e06c2
- ld a, [CurEnemyMoveNum]
- and $18
- jr z, Functione06e4
- jp Functione07db
-
-Functione06cc: ; e06cc
- ld a, [CurEnemyMoveNum]
- and $18
- cp $8
- jr z, Functione06e4
- jp Functione07db
-
-Functione06d8: ; e06d8
- ld a, [CurEnemyMoveNum]
- and $18
- cp $10
- jr z, Functione06e4
- jp Functione07db
-
-Functione06e4: ; e06e4
- ld c, $9
- ld de, SFX_2ND_PLACE
- jp Functione07eb
-; e06ec
-
-Functione06ec: ; e06ec
- ld a, [CurEnemyMoveNum]
- and $3
- jr z, Functione071a
- jp Functione07db
-
-Functione06f6: ; e06f6
- ld a, [CurEnemyMoveNum]
- and $3
- cp $1
- jr z, Functione071a
- jp Functione07db
-
-Functione0702: ; e0702
- ld a, [CurEnemyMoveNum]
- and $3
- cp $2
- jr z, Functione071a
- jp Functione07db
-
-Functione070e: ; e070e
- ld a, [CurEnemyMoveNum]
- and $3
- cp $3
- jr z, Functione071a
- jp Functione07db
-
-Functione071a: ; e071a
- ld c, $c
- ld de, SFX_2ND_PLACE
- jp Functione07eb
-; e0722
-
-Functione0722: ; e0722
- ld a, [CurEnemyMoveNum]
- and $1c
- jr z, Functione0768
- jp Functione07db
-
-Functione072c: ; e072c
- ld a, [CurEnemyMoveNum]
- and $1c
- cp $4
- jr z, Functione0768
- jp Functione07db
-
-Functione0738: ; e0738
- ld a, [CurEnemyMoveNum]
- and $1c
- cp $8
- jr z, Functione0768
- jp Functione07db
-
-Functione0744: ; e0744
- ld a, [CurEnemyMoveNum]
- and $1c
- cp $c
- jr z, Functione0768
- jp Functione07db
-
-Functione0750: ; e0750
- ld a, [CurEnemyMoveNum]
- and $1c
- cp $10
- jr z, Functione0768
- jp Functione07db
-
-Functione075c: ; e075c
- ld a, [CurEnemyMoveNum]
- and $1c
- cp $14
- jr z, Functione0768
- jp Functione07db
-
-Functione0768: ; e0768
- ld c, $12
- ld de, SFX_2ND_PLACE
- jp Functione07eb
-; e0770
-
-
-Functione0770: ; e0770
- ld e, $0
- jr Functione07ce
-
-Functione0774: ; e0774
- ld e, $1
- jr Functione07ce
-
-Functione0778: ; e0778
- ld e, $2
- jr Functione07ce
-
-Functione077c: ; e077c
- ld e, $3
- jr Functione07ce
-
-Functione0780: ; e0780
- ld e, $4
- jr Functione07ce
-
-Functione0784: ; e0784
- ld e, $5
- jr Functione07ce
-
-Functione0788: ; e0788
- ld e, $6
- jr Functione07ce
-
-Functione078c: ; e078c
- ld e, $7
- jr Functione07ce
-
-Functione0790: ; e0790
- ld e, $8
- jr Functione07ce
-
-Functione0794: ; e0794
- ld e, $9
- jr Functione07ce
-
-Functione0798: ; e0798
- ld e, $a
- jr Functione07ce
-
-Functione079c: ; e079c
- ld e, $b
- jr Functione07ce
-
-Functione07a0: ; e07a0
- ld e, $c
- jr Functione07ce
-
-Functione07a4: ; e07a4
- ld e, $d
- jr Functione07ce
-
-Functione07a8: ; e07a8
- ld e, $e
- jr Functione07ce
-
-Functione07ac: ; e07ac
- ld e, $f
- jr Functione07ce
-
-Functione07b0: ; e07b0
- ld e, $10
- jr Functione07ce
-
-Functione07b4: ; e07b4
- ld e, $11
- jr Functione07ce
-
-Functione07b8: ; e07b8
- ld e, $12
- jr Functione07ce
-
-Functione07bc: ; e07bc
- ld e, $13
- jr Functione07ce
-
-Functione07c0: ; e07c0
- ld e, $14
- jr Functione07ce
-
-Functione07c4: ; e07c4
- ld e, $15
- jr Functione07ce
-
-Functione07c8: ; e07c8
- ld e, $16
- jr Functione07ce
-
-Functione07cc: ; e07cc
- ld e, $17
-
-Functione07ce: ; e07ce
- ld a, [CurEnemyMoveNum]
- cp e
- jr nz, Functione07db
- ld c, $48
- ld de, SFX_2ND_PLACE
- jr Functione07eb
-
-Functione07db: ; e07db
- ld de, SFX_WRONG
- call PlaySFX
- ld hl, UnknownText_0xe0816
- call Functione0489
- call WaitSFX
- ret
-
-Functione07eb: ; e07eb
- push bc
- push de
- ld hl, UnknownText_0xe0811
- call Functione0489
- pop de
- call PlaySFX
- call WaitSFX
- pop bc
-.asm_e07fb
- push bc
- call Functione0833
- jr c, .asm_e0804
- call Functione081b
-
-.asm_e0804
- call Functione049c
- ld c, 2
- call DelayFrames
- pop bc
- dec c
- jr nz, .asm_e07fb
- ret
-; e0811
-
-UnknownText_0xe0811: ; 0xe0811
- ; Yeah!
- text_jump UnknownText_0x1c5813
- db "@"
-; 0xe0816
-
-UnknownText_0xe0816: ; 0xe0816
- ; Darn…
- text_jump UnknownText_0x1c581a
- db "@"
-; 0xe081b
-
-Functione081b: ; e081b
- ld a, [Coins]
- ld h, a
- ld a, [Coins + 1]
- ld l, a
- inc hl
- ld a, h
- ld [Coins], a
- ld a, l
- ld [Coins + 1], a
- ld de, SFX_PAY_DAY
- call PlaySFX
- ret
-; e0833
-
-Functione0833: ; e0833
- ld a, [Coins]
- cp 9999 / $100
- jr c, .asm_e0847
- jr z, .asm_e083e
- jr .asm_e0845
-
-.asm_e083e
- ld a, [Coins + 1]
- cp 9999 % $100
- jr c, .asm_e0847
-
-.asm_e0845
- scf
- ret
-
-.asm_e0847
- and a
- ret
-; e0849
-
-Functione0849: ; e0849
- call Functione03ac
- ld hl, Unknown_e0853
- call Functione0509
- ret
-; e0853
-
-Unknown_e0853: ; e0853
- db 18
- db $00, $00, $04, $00
- db $00, $08, $06, $00
- db $00, $10, $06, $00
- db $00, $18, $06, $00
- db $00, $20, $04, $20
- db $08, $00, $05, $00
- db $08, $20, $05, $20
- db $10, $00, $05, $00
- db $10, $20, $05, $20
- db $18, $00, $05, $00
- db $18, $20, $05, $20
- db $20, $00, $05, $00
- db $20, $20, $05, $20
- db $28, $00, $04, $40
- db $28, $08, $06, $40
- db $28, $10, $06, $40
- db $28, $18, $06, $40
- db $28, $20, $04, $60
-; e089c
-
-Functione089c: ; e089c
- ld hl, hJoyLast
- ld a, [hl]
- and D_LEFT
- jp nz, Functione08b8
- ld a, [hl]
- and D_RIGHT
- jp nz, Functione08ef
- ld a, [hl]
- and D_UP
- jp nz, Functione090a
- ld a, [hl]
- and D_DOWN
- jp nz, Functione093d
- ret
-; e08b8
-
-Functione08b8: ; e08b8
- ld hl, wcf65
- ld a, [wcf64]
- and a
- jr z, .asm_e08d5
- cp $1
- jr z, .asm_e08cc
- ld a, [hl]
- and a
- ret z
- dec [hl]
- jp Functione0959
-
-.asm_e08cc
- ld a, [hl]
- cp $3
- jr c, .asm_e08e2
- dec [hl]
- jp Functione0959
-
-.asm_e08d5
- ld a, [hl]
- and $e
- ld [hl], a
- cp $3
- jr c, .asm_e08e2
-rept 2
- dec [hl]
-endr
- jp Functione0959
-
-.asm_e08e2
- ld a, $2
- ld [wcf64], a
- ld a, $1
- ld [wcf65], a
- jp Functione0959
-; e08ef
-
-Functione08ef: ; e08ef
- ld hl, wcf65
- ld a, [wcf64]
- and a
- jr z, .asm_e08ff
- ld a, [hl]
- cp $5
- ret nc
- inc [hl]
- jr Functione0959
-
-.asm_e08ff
- ld a, [hl]
- and $e
- ld [hl], a
- cp $4
- ret nc
-rept 2
- inc [hl]
-endr
- jr Functione0959
-
-Functione090a: ; e090a
- ld hl, wcf64
- ld a, [wcf65]
- and a
- jr z, .asm_e0925
- cp $1
- jr z, .asm_e091d
- ld a, [hl]
- and a
- ret z
- dec [hl]
- jr Functione0959
-
-.asm_e091d
- ld a, [hl]
- cp $3
- jr c, .asm_e0931
- dec [hl]
- jr Functione0959
-
-.asm_e0925
- ld a, [hl]
- and $e
- ld [hl], a
- cp $3
- jr c, .asm_e0931
-rept 2
- dec [hl]
-endr
- jr Functione0959
-
-.asm_e0931
- ld a, $1
- ld [wcf64], a
- ld a, $2
- ld [wcf65], a
- jr Functione0959
-
-Functione093d: ; e093d
- ld hl, wcf64
- ld a, [wcf65]
- and a
- jr z, .asm_e0950
- ld hl, wcf64
- ld a, [hl]
- cp $7
- ret nc
- inc [hl]
- jr Functione0959
-
-.asm_e0950
- ld a, [hl]
- and $e
- ld [hl], a
- cp $6
- ret nc
-rept 2
- inc [hl]
-endr
-
-Functione0959: ; e0959
- ld de, SFX_POKEBALLS_PLACED_ON_TABLE
- call PlaySFX
- ret
-; e0960
-
-Functione0960: ; e0960
- call ClearSprites
- ld a, [hCGB]
- and a
- jr nz, .asm_e096d
- ld a, [hVBlankCounter]
- and $4
- ret nz
-
-.asm_e096d
- call Functione0398
-rept 2
- add hl, hl
-endr
- ld de, Unknown_e0981
- add hl, de
- ld a, [hli]
- ld c, a
- ld a, [hli]
- ld b, a
- ld a, [hli]
- ld h, [hl]
- ld l, a
- call Functione0509
- ret
-; e0981
-
-Unknown_e0981: ; e0981
- dbbw $58, $10, Unknown_e0c26
- dbbw $60, $10, Unknown_e0c26
- dbbw $68, $10, Unknown_e0b8d
- dbbw $68, $10, Unknown_e0b8d
- dbbw $88, $10, Unknown_e0b8d
- dbbw $88, $10, Unknown_e0b8d
-
- dbbw $58, $18, Unknown_e0c26
- dbbw $60, $18, Unknown_e0c26
- dbbw $68, $18, Unknown_e0a5a
- dbbw $78, $18, Unknown_e0a5a
- dbbw $88, $18, Unknown_e0a5a
- dbbw $98, $18, Unknown_e0a5a
-
- dbbw $58, $28, Unknown_e0b14
- dbbw $60, $28, Unknown_e0ac3
- dbbw $68, $28, Unknown_e0a41
- dbbw $78, $28, Unknown_e0a41
- dbbw $88, $28, Unknown_e0a41
- dbbw $98, $28, Unknown_e0a41
- dbbw $58, $28, Unknown_e0b14
-
- dbbw $60, $34, Unknown_e0ac3
- dbbw $68, $34, Unknown_e0a41
- dbbw $78, $34, Unknown_e0a41
- dbbw $88, $34, Unknown_e0a41
- dbbw $98, $34, Unknown_e0a41
-
- dbbw $58, $40, Unknown_e0b14
- dbbw $60, $40, Unknown_e0ac3
- dbbw $68, $40, Unknown_e0a41
- dbbw $78, $40, Unknown_e0a41
- dbbw $88, $40, Unknown_e0a41
- dbbw $98, $40, Unknown_e0a41
- dbbw $58, $40, Unknown_e0b14
-
- dbbw $60, $4c, Unknown_e0ac3
- dbbw $68, $4c, Unknown_e0a41
- dbbw $78, $4c, Unknown_e0a41
- dbbw $88, $4c, Unknown_e0a41
- dbbw $98, $4c, Unknown_e0a41
-
- dbbw $58, $58, Unknown_e0b14
- dbbw $60, $58, Unknown_e0ac3
- dbbw $68, $58, Unknown_e0a41
- dbbw $78, $58, Unknown_e0a41
- dbbw $88, $58, Unknown_e0a41
- dbbw $98, $58, Unknown_e0a41
- dbbw $58, $58, Unknown_e0b14
-
- dbbw $60, $64, Unknown_e0ac3
- dbbw $68, $64, Unknown_e0a41
- dbbw $78, $64, Unknown_e0a41
- dbbw $88, $64, Unknown_e0a41
- dbbw $98, $64, Unknown_e0a41
-; e0a41
-
-Unknown_e0a41: ; e0a41
- db 6
- db $00, $ff, $00, $80
- db $00, $00, $02, $80
- db $00, $08, $03, $80
- db $05, $ff, $00, $c0
- db $05, $00, $02, $c0
- db $05, $08, $03, $80
-
-Unknown_e0a5a: ; e0a5a
- db 26
- db $00, $ff, $00, $80
- db $00, $00, $02, $80
- db $00, $08, $00, $a0
- db $08, $ff, $01, $80
- db $08, $08, $01, $a0
- db $10, $ff, $01, $80
- db $10, $08, $03, $80
- db $18, $ff, $01, $80
- db $18, $08, $03, $80
- db $20, $ff, $01, $80
- db $20, $08, $03, $80
- db $28, $ff, $01, $80
- db $28, $08, $03, $80
- db $30, $ff, $01, $80
- db $30, $08, $03, $80
- db $38, $ff, $01, $80
- db $38, $08, $03, $80
- db $40, $ff, $01, $80
- db $40, $08, $03, $80
- db $48, $ff, $01, $80
- db $48, $08, $03, $80
- db $50, $ff, $01, $80
- db $50, $08, $03, $80
- db $51, $ff, $00, $c0
- db $51, $00, $02, $c0
- db $51, $08, $03, $80
-
-Unknown_e0ac3: ; e0ac3
- db 20
- db $00, $ff, $00, $80
- db $00, $00, $02, $80
- db $00, $08, $02, $80
- db $00, $10, $03, $80
- db $00, $18, $02, $80
- db $00, $20, $03, $80
- db $00, $28, $02, $80
- db $00, $30, $03, $80
- db $00, $38, $02, $80
- db $00, $40, $03, $80
- db $05, $ff, $00, $c0
- db $05, $00, $02, $c0
- db $05, $08, $02, $c0
- db $05, $10, $03, $80
- db $05, $18, $02, $c0
- db $05, $20, $03, $80
- db $05, $28, $02, $c0
- db $05, $30, $03, $80
- db $05, $38, $02, $c0
- db $05, $40, $03, $80
-
-Unknown_e0b14: ; e0b14
- db 30
- db $00, $00, $00, $80
- db $00, $08, $02, $80
- db $00, $10, $02, $80
- db $00, $18, $03, $80
- db $00, $20, $02, $80
- db $00, $28, $03, $80
- db $00, $30, $02, $80
- db $00, $38, $03, $80
- db $00, $40, $02, $80
- db $00, $48, $03, $80
- db $08, $00, $01, $80
- db $08, $18, $03, $80
- db $08, $28, $03, $80
- db $08, $38, $03, $80
- db $08, $48, $03, $80
- db $10, $00, $01, $80
- db $10, $18, $03, $80
- db $10, $28, $03, $80
- db $10, $38, $03, $80
- db $10, $48, $03, $80
- db $11, $00, $00, $c0
- db $11, $08, $02, $c0
- db $11, $10, $02, $c0
- db $11, $18, $03, $80
- db $11, $20, $03, $80
- db $11, $28, $03, $80
- db $11, $30, $03, $80
- db $11, $38, $03, $80
- db $11, $40, $03, $80
- db $11, $48, $03, $80
-
-Unknown_e0b8d: ; e0b8d
- db 38
- db $00, $ff, $00, $80
- db $00, $18, $00, $a0
- db $08, $ff, $01, $80
- db $08, $18, $01, $a0
- db $10, $ff, $01, $80
- db $10, $18, $01, $a0
- db $18, $ff, $01, $80
- db $18, $08, $03, $80
- db $18, $18, $03, $80
- db $20, $ff, $01, $80
- db $20, $08, $03, $80
- db $20, $18, $03, $80
- db $28, $ff, $01, $80
- db $28, $08, $03, $80
- db $28, $18, $03, $80
- db $30, $ff, $01, $80
- db $30, $08, $03, $80
- db $30, $18, $03, $80
- db $38, $ff, $01, $80
- db $38, $08, $03, $80
- db $38, $18, $03, $80
- db $40, $ff, $01, $80
- db $40, $08, $03, $80
- db $40, $18, $03, $80
- db $48, $ff, $01, $80
- db $48, $08, $03, $80
- db $48, $18, $03, $80
- db $50, $ff, $01, $80
- db $50, $08, $03, $80
- db $50, $18, $03, $80
- db $58, $ff, $01, $80
- db $58, $08, $03, $80
- db $58, $18, $03, $80
- db $59, $ff, $00, $c0
- db $59, $00, $02, $c0
- db $59, $08, $03, $c0
- db $59, $10, $02, $c0
- db $59, $18, $03, $e0
-
-Unknown_e0c26: ; e0c26
- db 4
- db $00, $00, $00, $80
- db $00, $08, $00, $a0
- db $08, $00, $00, $c0
- db $08, $08, $00, $e0
-; e0c37
-
-Functione0c37: ; e0c37 (38:4c37)
- ld a, [hCGB]
- and a
- ret z
- hlcoord 0, 0, AttrMap
- ld bc, SCREEN_HEIGHT * SCREEN_WIDTH
- xor a
- call ByteFill
- hlcoord 12, 1, AttrMap
- lb bc, 2, 2
- ld a, $1
- call Functione04e7
- hlcoord 14, 1, AttrMap
- lb bc, 2, 2
- ld a, $2
- call Functione04e7
- hlcoord 16, 1, AttrMap
- lb bc, 2, 2
- ld a, $3
- call Functione04e7
- hlcoord 18, 1, AttrMap
- lb bc, 2, 2
- ld a, $4
- call Functione04e7
- hlcoord 9, 0, AttrMap
- lb bc, 12, 1
- ld a, $1
- call Functione04e7
- ld a, [rSVBK]
- push af
- ld a, $5
- ld [rSVBK], a
- ld hl, Palette_e0c93
- ld de, Unkn1Pals
- ld bc, $48
- call CopyBytes
- pop af
- ld [rSVBK], a
- ret
-; e0c93 (38:4c93)
-
-Palette_e0c93: ; e0c93
- RGB 31, 31, 31
- RGB 17, 07, 31
- RGB 06, 19, 08
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 29, 25, 00
- RGB 06, 19, 08
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 31, 13, 30
- RGB 06, 19, 08
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 08, 17, 30
- RGB 06, 19, 08
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 08, 31, 08
- RGB 06, 19, 08
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 17, 07, 31
- RGB 06, 19, 08
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 17, 07, 31
- RGB 06, 19, 08
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 17, 07, 31
- RGB 06, 19, 08
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 31, 00, 00
- RGB 31, 00, 00
-; e0cdb
-
-LZ_e0cdb: ; e0cdb
-INCBIN "gfx/unknown/0e0cdb.2bpp.lz"
-
-GFX_e0cf6: ; e0cf6
-INCBIN "gfx/unknown/0e0cf6.2bpp"
-
-GFX_e0d06: ; e0d06
-INCBIN "gfx/unknown/0e0d06.2bpp"
-
-LZ_e0d16: ; e0d16
-INCBIN "gfx/unknown/0e0d16.2bpp.lz"
-
-LZ_e0ea8: ; e0ea8
-INCBIN "gfx/unknown/0e0ea8.2bpp.lz"
-
-Unknown_e110c: ; e110c
- db $ef, $15, $27, $2a, $2a, $06, $27, $2a, $2a, $06, $27
- db $ef, $07, $27, $3e, $3f, $42, $43, $46, $47, $4a, $4b
- db $ef, $17, $26, $40, $41, $44, $45, $48, $49, $4c, $4d
- db $ef, $25, $04, $00, $01, $00, $01, $00, $01, $00, $01
- db $ef, $05, $14, $10, $11, $10, $11, $10, $11, $10, $11
- db $ef, $16, $24, $20, $21, $20, $21, $20, $21, $20, $21
- db $ef, $25, $04, $00, $02, $00, $02, $00, $02, $00, $02
- db $ef, $05, $14, $10, $12, $10, $12, $10, $12, $10, $12
- db $ef, $16, $24, $20, $22, $20, $22, $20, $22, $20, $22
- db $ef, $25, $04, $00, $03, $00, $03, $00, $03, $00, $03
- db $ef, $05, $14, $10, $13, $10, $13, $10, $13, $10, $13
- db $ef, $16, $24, $20, $23, $20, $23, $20, $23, $20, $23
-; e1190
-
-Functione1190: ; e1190
- ld a, [hInMenu]
- push af
- ld a, $1
- ld [hInMenu], a
- call WhiteBGMap
- call ClearTileMap
- call ClearSprites
- xor a
- ld [hBGMapMode], a
- call DisableLCD
- ld hl, wc608
- ld bc, $1e0
- xor a
- call ByteFill
- ld hl, GFX_e17c5
- ld de, VTiles1 tile $60
- ld bc, $40
- call CopyBytes
- ld hl, LZ_e1805
- ld de, VTiles1 tile $6d
- call Decompress
- call Functione17a3
- hlcoord 0, 0
- ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
- ld a, $ee
- call ByteFill
- hlcoord 4, 3
- lb bc, 12, 12
- ld a, $ef
- call Functione13ee
- call Functione124e
- call Functione13fe
- call Functione127d
- xor a
- ld [hSCY], a
- ld [hSCX], a
- ld [rWY], a
- ld [wJumptableIndex], a
- ld [wcf64], a
- ld [wcf65], a
- ld [wcf66], a
- ld a, $93
- ld [rLCDC], a
- call WaitBGMap
- ld b, $18
- call GetSGBLayout
- ld a, $e4
- call DmgToCgbBGPals
- ld a, $24
- call Functioncf8
- xor a
- ld [wd0ec], a
- call DelayFrame
-.asm_e1217
- call JoyTextDelay
- ld a, [wJumptableIndex]
- bit 7, a
- jr nz, .asm_e123d
- call Functione12ca
- ld a, [wcf64]
- and a
- jr nz, .asm_e1230
- ld a, [hVBlankCounter]
- and $10
- jr z, .asm_e1235
-
-.asm_e1230
- call Functione14d9
- jr .asm_e1238
-
-.asm_e1235
- call ClearSprites
-
-.asm_e1238
- call DelayFrame
- jr .asm_e1217
-
-.asm_e123d
- pop af
- ld [hInMenu], a
- call WhiteBGMap
- call ClearTileMap
- call ClearSprites
- ld a, $e3
- ld [rLCDC], a
- ret
-; e124e
-
-Functione124e: ; e124e
- ld c, $1
- ld b, $10
-.asm_e1252
- call Random
- and $f
- ld hl, Unknown_e126d
- ld e, a
- ld d, $0
- add hl, de
- ld e, [hl]
- ld hl, wc6d0
- add hl, de
- ld a, [hl]
- and a
- jr nz, .asm_e1252
- ld [hl], c
- inc c
- dec b
- jr nz, .asm_e1252
- ret
-; e126d
-
-Unknown_e126d: ; e126d
- db $00, $01, $02, $03
- db $04, $05, $06, $0b
- db $0c, $11, $12, $17
- db $18, $1d, $1e, $23
-; e127d
-
-Functione127d: ; e127d
- call Functione128d
- hlcoord 5, 16
- ld a, $f6
- ld c, $a
-.asm_e1287
- ld [hli], a
- inc a
- dec c
- jr nz, .asm_e1287
- ret
-; e128d
-
-Functione128d: ; e128d
- hlcoord 4, 15
- ld a, $f0
- ld [hli], a
- ld bc, $a
- ld a, $f1
- call ByteFill
- hlcoord 15, 15
- ld a, $f2
- ld [hli], a
- hlcoord 4, 16
- ld a, $f3
- ld [hli], a
- ld bc, $a
- ld a, $ef
- call ByteFill
- hlcoord 15, 16
- ld a, $f3
- ld [hli], a
- hlcoord 4, 17
- ld a, $f4
- ld [hli], a
- ld bc, $a
- ld a, $f1
- call ByteFill
- hlcoord 15, 17
- ld a, $f5
- ld [hl], a
- ret
-; e12ca
-
-Functione12ca: ; e12ca
- ld a, [wJumptableIndex]
- ld e, a
- ld d, 0
- ld hl, Jumptable_e12d9
-rept 2
- add hl, de
-endr
- ld a, [hli]
- ld h, [hl]
- ld l, a
- jp [hl]
-; e12d9
-
-Jumptable_e12d9: ; e12d9
- dw Functione12db
-; e12db
-
-Functione12db: ; e12db
- ld a, [hJoyPressed]
- and START
- jp nz, Functione13de
- ld a, [hJoyPressed]
- and A_BUTTON
- jp nz, Functione1376
- ld hl, hJoyLast
- ld a, [hl]
- and D_UP
- jr nz, .asm_e1301
- ld a, [hl]
- and D_DOWN
- jr nz, .asm_e130d
- ld a, [hl]
- and D_LEFT
- jr nz, .asm_e1325
- ld a, [hl]
- and D_RIGHT
- jr nz, .asm_e1345
- ret
-
-.asm_e1301
- ld hl, wcf65
- ld a, [hl]
- cp $6
- ret c
- sub $6
- ld [hl], a
- jr .asm_e1364
-
-.asm_e130d
- ld hl, wcf65
- ld a, [hl]
- cp $19
- ret z
- cp $1a
- ret z
- cp $1b
- ret z
- cp $1c
- ret z
- cp $1e
- ret nc
- add $6
- ld [hl], a
- jr .asm_e1364
-
-.asm_e1325
- ld hl, wcf65
- ld a, [hl]
- and a
- ret z
- cp $6
- ret z
- cp $c
- ret z
- cp $12
- ret z
- cp $18
- ret z
- cp $1e
- ret z
- cp $23
- jr z, .asm_e1341
- dec [hl]
- jr .asm_e1364
-
-.asm_e1341
- ld [hl], $1e
- jr .asm_e1364
-
-.asm_e1345
- ld hl, wcf65
- ld a, [hl]
- cp $5
- ret z
- cp $b
- ret z
- cp $11
- ret z
- cp $17
- ret z
- cp $1d
- ret z
- cp $23
- ret z
- cp $1e
- jr z, .asm_e1362
- inc [hl]
- jr .asm_e1364
-
-.asm_e1362
- ld [hl], $23
-
-.asm_e1364
- ld a, [wcf64]
- and a
- jr nz, .asm_e136f
- ld de, SFX_POUND
- jr .asm_e1372
-
-.asm_e136f
- ld de, SFX_MOVE_PUZZLE_PIECE
-
-.asm_e1372
- call PlaySFX
- ret
-; e1376
-
-Functione1376: ; e1376
- ld a, [wcf64]
- and a
- jr nz, .asm_e139f
- call Functione1475
- and a
- jr z, Functione13e4
- ld de, SFX_MEGA_KICK
- call PlaySFX
- ld [hl], $0
- ld [wcf66], a
- call Functione14d9
- call Functione1441
- call WaitBGMap
- call WaitSFX
- ld a, $1
- ld [wcf64], a
- ret
-
-.asm_e139f
- call Functione1475
- and a
- jr nz, Functione13e4
- ld de, SFX_PLACE_PUZZLE_PIECE_DOWN
- call PlaySFX
- ld a, [wcf66]
- ld [hl], a
- call Functione141f
- call WaitBGMap
- xor a
- ld [wcf66], a
- call Functione14d9
- xor a
- ld [wcf64], a
- call WaitSFX
- call Functione14a0
- ret nc
- call Functione128d
- call ClearSprites
- ld de, SFX_1ST_PLACE
- call PlaySFX
- call WaitSFX
- call SimpleWaitPressAorB
- ld a, $1
- ld [wd0ec], a
-
-Functione13de: ; e13de
- ld hl, wJumptableIndex
- set 7, [hl]
- ret
-
-Functione13e4: ; e13e4
- ld de, SFX_WRONG
- call PlaySFX
- call WaitSFX
- ret
-; e13ee
-
-Functione13ee: ; e13ee
- ld de, SCREEN_WIDTH
-.asm_e13f1
- push bc
- push hl
-.asm_e13f3
- ld [hli], a
- dec c
- jr nz, .asm_e13f3
- pop hl
- add hl, de
- pop bc
- dec b
- jr nz, .asm_e13f1
- ret
-; e13fe
-
-Functione13fe: ; e13fe
- xor a
- ld [wcf65], a
- ld c, $24
-.asm_e1404
- push bc
- call Functione1475
- ld [wcf66], a
- and a
- jr z, .asm_e1413
- call Functione141f
- jr .asm_e1416
-
-.asm_e1413
- call Functione1441
-
-.asm_e1416
- ld hl, wcf65
- inc [hl]
- pop bc
- dec c
- jr nz, .asm_e1404
- ret
-; e141f
-
-Functione141f: ; e141f
- ld a, $2
- call Functione1463
- ld a, [hli]
- ld h, [hl]
- ld l, a
- push hl
- call Functione1481
- pop hl
- ld de, SCREEN_WIDTH
- ld b, $3
-.asm_e1431
- ld c, $3
- push hl
-.asm_e1434
- ld [hli], a
- inc a
- dec c
- jr nz, .asm_e1434
- add $9
- pop hl
- add hl, de
- dec b
- jr nz, .asm_e1431
- ret
-; e1441
-
-Functione1441: ; e1441
- ld a, $2
- call Functione1463
- ld a, [hli]
- ld h, [hl]
- ld l, a
- push hl
- ld a, $4
- call Functione1463
- ld a, [hl]
- pop hl
- ld de, SCREEN_WIDTH
- ld b, $3
-.asm_e1456
- ld c, $3
- push hl
-.asm_e1459
- ld [hli], a
- dec c
- jr nz, .asm_e1459
- pop hl
- add hl, de
- dec b
- jr nz, .asm_e1456
- ret
-; e1463
-
-Functione1463: ; e1463
- ld e, a
- ld d, 0
- ld hl, Unknown_e1559
- add hl, de
- ld a, [wcf65]
- ld e, a
-rept 4
- add hl, de
-endr
-rept 2
- add hl, de
-endr
- ret
-; e1475
-
-Functione1475: ; e1475
- ld hl, wc6d0
- ld a, [wcf65]
- ld e, a
- ld d, $0
- add hl, de
- ld a, [hl]
- ret
-; e1481
-
-Functione1481: ; e1481
- ld a, [wcf66]
- ld hl, Unknown_e148f
- add l
- ld l, a
- ld a, $0
- adc h
- ld h, a
- ld a, [hl]
- ret
-; e148f
-
-Unknown_e148f: ; e148f
- db $e0
- db $00, $03, $06, $09
- db $24, $27, $2a, $2d
- db $48, $4b, $4e, $51
- db $6c, $6f, $72, $75
-; e14a0
-
-Functione14a0: ; e14a0
- ld hl, Unknown_e14b5
- ld de, wc6d0
- ld c, $24
-.asm_e14a8
- ld a, [de]
- cp [hl]
- jr nz, .asm_e14b3
- inc de
- inc hl
- dec c
- jr nz, .asm_e14a8
- scf
- ret
-
-.asm_e14b3
- and a
- ret
-; e14b5
-
-Unknown_e14b5: ; e14b5
- db $00, $00, $00, $00, $00, $00
- db $00, $01, $02, $03, $04, $00
- db $00, $05, $06, $07, $08, $00
- db $00, $09, $0a, $0b, $0c, $00
- db $00, $0d, $0e, $0f, $10, $00
- db $00, $00, $00, $00, $00, $00
-; e14d9
-
-Functione14d9: ; e14d9
- call Functione1481
- ld [wd002], a
- xor a
- call Functione1463
- ld a, [hli]
- ld b, [hl]
- ld c, a
- ld a, [wd002]
- cp $e0
- jr z, .asm_e14f2
- ld hl, Unknown_e150f
- jr .asm_e14f5
-
-.asm_e14f2
- ld hl, Unknown_e1534
-
-.asm_e14f5
- ld de, Sprites
-.asm_e14f8
- ld a, [hli]
- cp $ff
- ret z
- add b
- ld [de], a
- inc de
- ld a, [hli]
- add c
- ld [de], a
- inc de
- ld a, [wd002]
- add [hl]
- ld [de], a
- inc hl
- inc de
- ld a, [hli]
- ld [de], a
- inc de
- jr .asm_e14f8
-; e150f
-
-Unknown_e150f: ; e150f
- db $f4, $f4, $00, $00
- db $f4, $fc, $01, $00
- db $f4, $04, $02, $00
- db $fc, $f4, $0c, $00
- db $fc, $fc, $0d, $00
- db $fc, $04, $0e, $00
- db $04, $f4, $18, $00
- db $04, $fc, $19, $00
- db $04, $04, $1a, $00
- db $ff
-
-Unknown_e1534: ; e1534
- db $f4, $f4, $00, $00
- db $f4, $fc, $01, $00
- db $f4, $04, $00, $20
- db $fc, $f4, $02, $00
- db $fc, $fc, $03, $00
- db $fc, $04, $02, $20
- db $04, $f4, $00, $40
- db $04, $fc, $01, $40
- db $04, $04, $00, $60
- db $ff
-
-Unknown_e1559: ; e1559
-
-macro_e1559: macro
- db \1, \2
- dwcoord \3, \4
- db \5, \6
-endm
-
- macro_e1559 $1c, $1c, 1, 0, $ee, $00
- macro_e1559 $34, $1c, 4, 0, $ee, $00
- macro_e1559 $4c, $1c, 7, 0, $ee, $00
- macro_e1559 $64, $1c, 10, 0, $ee, $00
- macro_e1559 $7c, $1c, 13, 0, $ee, $00
- macro_e1559 $94, $1c, 16, 0, $ee, $00
- macro_e1559 $1c, $34, 1, 3, $ee, $00
- macro_e1559 $34, $34, 4, 3, $ef, $00
- macro_e1559 $4c, $34, 7, 3, $ef, $00
- macro_e1559 $64, $34, 10, 3, $ef, $00
- macro_e1559 $7c, $34, 13, 3, $ef, $00
- macro_e1559 $94, $34, 16, 3, $ee, $00
- macro_e1559 $1c, $4c, 1, 6, $ee, $00
- macro_e1559 $34, $4c, 4, 6, $ef, $00
- macro_e1559 $4c, $4c, 7, 6, $ef, $00
- macro_e1559 $64, $4c, 10, 6, $ef, $00
- macro_e1559 $7c, $4c, 13, 6, $ef, $00
- macro_e1559 $94, $4c, 16, 6, $ee, $00
- macro_e1559 $1c, $64, 1, 9, $ee, $00
- macro_e1559 $34, $64, 4, 9, $ef, $00
- macro_e1559 $4c, $64, 7, 9, $ef, $00
- macro_e1559 $64, $64, 10, 9, $ef, $00
- macro_e1559 $7c, $64, 13, 9, $ef, $00
- macro_e1559 $94, $64, 16, 9, $ee, $00
- macro_e1559 $1c, $7c, 1, 12, $ee, $00
- macro_e1559 $34, $7c, 4, 12, $ef, $00
- macro_e1559 $4c, $7c, 7, 12, $ef, $00
- macro_e1559 $64, $7c, 10, 12, $ef, $00
- macro_e1559 $7c, $7c, 13, 12, $ef, $00
- macro_e1559 $94, $7c, 16, 12, $ee, $00
- macro_e1559 $1c, $94, 1, 15, $ee, $00
- macro_e1559 $34, $94, 4, 15, $ee, $00
- macro_e1559 $4c, $94, 7, 15, $ee, $00
- macro_e1559 $64, $94, 10, 15, $ee, $00
- macro_e1559 $7c, $94, 13, 15, $ee, $00
- macro_e1559 $94, $94, 16, 15, $ee, $00
-
-Functione1631: ; e1631
- ld hl, VTiles2
- ld de, VTiles0
- ld b, $6
-.asm_e1639
- push bc
- push hl
- push hl
- call Functione1654
- pop hl
- ld bc, 8
- add hl, bc
- call Functione1654
- pop hl
- ld bc, $60
- add hl, bc
- pop bc
- dec b
- jr nz, .asm_e1639
- call Functione16c7
- ret
-; e1654
-
-Functione1654: ; e1654
- ld c, $6
-.asm_e1656
- push bc
- push hl
- push hl
- ld c, $4
-.asm_e165b
- push bc
- ld a, [hli]
- and $f0
- swap a
- call Functione16aa
- ld c, a
- ld a, [hli]
- and $f0
- swap a
- call Functione16aa
- ld b, a
- ld a, c
- ld [de], a
- inc de
- ld a, b
- ld [de], a
- inc de
- ld a, c
- ld [de], a
- inc de
- ld a, b
- ld [de], a
- inc de
- pop bc
- dec c
- jr nz, .asm_e165b
- pop hl
- ld c, $4
-.asm_e1681
- push bc
- ld a, [hli]
- and $f
- call Functione16aa
- ld c, a
- ld a, [hli]
- and $f
- call Functione16aa
- ld b, a
- ld a, c
- ld [de], a
- inc de
- ld a, b
- ld [de], a
- inc de
- ld a, c
- ld [de], a
- inc de
- ld a, b
- ld [de], a
- inc de
- pop bc
- dec c
- jr nz, .asm_e1681
- pop hl
- ld bc, $10
- add hl, bc
- pop bc
- dec c
- jr nz, .asm_e1656
- ret
-; e16aa
-
-Functione16aa: ; e16aa
- push hl
- ld hl, Unknown_e16b7
- add l
- ld l, a
- ld a, 0
- adc h
- ld h, a
- ld a, [hl]
- pop hl
- ret
-; e16b7
-
-Unknown_e16b7: ; e16b7
- db $00, $03, $0c, $0f
- db $30, $33, $3c, $3f
- db $c0, $c3, $cc, $cf
- db $f0, $f3, $fc, $ff
-; e16c7
-
-Functione16c7: ; e16c7
- ld hl, Unknown_e1703
- ld a, $8
-.asm_e16cc
- push af
- push hl
- ld a, [hli]
- ld e, a
- ld a, [hli]
- ld d, a
- ld a, [hli]
- ld h, [hl]
- ld l, a
- call Functione16e2
- pop hl
-rept 4
- inc hl
-endr
- pop af
- dec a
- jr nz, .asm_e16cc
- ret
-; e16e2
-
-Functione16e2: ; e16e2
- lb bc, 4, 4
-.asm_e16e5
- push bc
-.asm_e16e6
- push de
- push hl
- ld b, $10
-.asm_e16ea
- ld a, [de]
- or [hl]
- ld [hli], a
- inc de
- dec b
- jr nz, .asm_e16ea
- pop hl
- ld de, $30
- add hl, de
- pop de
- dec c
- jr nz, .asm_e16e6
- ld bc, $180
- add hl, bc
- pop bc
- dec b
- jr nz, .asm_e16e5
- ret
-; e1703
-
-Unknown_e1703: ; e1703
- dw GFX_e1723 + $00, $8000
- dw GFX_e1723 + $10, $8010
- dw GFX_e1723 + $20, $8020
- dw GFX_e1723 + $30, $80c0
- dw GFX_e1723 + $40, $80e0
- dw GFX_e1723 + $50, $8180
- dw GFX_e1723 + $60, $8190
- dw GFX_e1723 + $70, $81a0
-; e1723
-
-GFX_e1723: ; e1723
-INCBIN "gfx/unknown/0e1723.2bpp"
-
-Functione17a3: ; e17a3
- ld a, [ScriptVar]
- and 3
- ld e, a
- ld d, 0
- ld hl, Unknown_e17bd
-rept 2
- add hl, de
-endr
- ld a, [hli]
- ld h, [hl]
- ld l, a
- ld de, VTiles2
- call Decompress
- call Functione1631
- ret
-; e17bd
-
-Unknown_e17bd: ; e17bd
- dw LZ_e1bab
- dw LZ_e1c9b
- dw LZ_e19fb
- dw LZ_e18ab
-; e17c5
-
-GFX_e17c5: ; e17c5
-INCBIN "gfx/unknown/0e17c5.2bpp"
-
-LZ_e1805: ; e1805
-INCBIN "gfx/unknown/0e1805.2bpp.lz"
-
-LZ_e18ab: ; e18ab
-INCBIN "gfx/unknown/0e18ab.2bpp.lz"
-
-LZ_e19fb: ; e19fb
-INCBIN "gfx/unknown/0e19fb.2bpp.lz"
-
-LZ_e1bab: ; e1bab
-INCBIN "gfx/unknown/0e1bab.2bpp.lz"
-
-LZ_e1c9b: ; e1c9b
-INCBIN "gfx/unknown/0e1c9b.2bpp.lz"
-
-_DummyGame: ; e1e5b (38:5e5b)
- call Functione1e67
- call DelayFrame
-.asm_e1e61
- call Functione1ebb
- jr nc, .asm_e1e61
- ret
-
-Functione1e67: ; e1e67 (38:5e67)
- call DisableLCD
- ld b, $8
- call GetSGBLayout
- callab Function8cf53
- ld hl, LZ_e2221
- ld de, VTiles2 tile $00
- call Decompress
- ld hl, Unknown_e00ed
- ld de, VTiles0 tile $00
- ld bc, $40
- ld a, BANK(Unknown_e00ed)
- call FarCopyBytes
- ld a, $8
- ld hl, wc300
- ld [hli], a
- ld [hl], $0
- hlcoord 0, 0
- ld bc, SCREEN_HEIGHT * SCREEN_WIDTH
- xor a
- call ByteFill
- xor a
- ld [hSCY], a
- ld [hSCX], a
- ld [rWY], a
- ld [wJumptableIndex], a
- ld a, $1
- ld [hBGMapMode], a
- ld a, $e3
- ld [rLCDC], a
- ld a, $e4
- call DmgToCgbBGPals
- ld a, $e0
- call Functioncf8
- ret
-
-Functione1ebb: ; e1ebb (38:5ebb)
- ld a, [wJumptableIndex]
- bit 7, a
- jr nz, .asm_e1ed0
- call Functione1ed2
- callab Function8cf69
- call DelayFrame
- and a
- ret
-.asm_e1ed0
- scf
- ret
-
-Functione1ed2: ; e1ed2 (38:5ed2)
- ld a, [wJumptableIndex]
- ld e, a
- ld d, 0
- ld hl, Jumptable_e1ee1
-rept 2
- add hl, de
-endr
- ld a, [hli]
- ld h, [hl]
- ld l, a
- jp [hl]
-; e1ee1 (38:5ee1)
-
-Jumptable_e1ee1: ; e1ee1
- dw Functione1ef3
- dw Functione1efb
- dw Functione1f1c
- dw Functione1f42
- dw Functione1f61
- dw Functione1f8b
- dw Functione1fba
- dw Functione1fcc
- dw Functione2000
-; e1ef3
-
-Functione1ef3: ; e1ef3
- call Functione2152
- ld hl, wJumptableIndex
- inc [hl]
- ret
-; e1efb
-
-Functione1efb: ; e1efb
- call Functione00ed
- jr nc, .asm_e1f06
- ld hl, wJumptableIndex
- set 7, [hl]
- ret
-
-.asm_e1f06
- call Functione209d
- ld hl, wJumptableIndex
- inc [hl]
- xor a
- ld [wc708], a
- ld hl, wc703
-rept 4
- ld [hli], a
-endr
- ld [hl], a
- ld [wc709], a
-
-Functione1f1c: ; e1f1c
- ld hl, wc708
- ld a, [hl]
- cp $2d
- jr nc, .asm_e1f30
- inc [hl]
- call Functione2183
- xor a
- ld [wc6fd], a
- call Functione2128
- ret
-
-.asm_e1f30
- ld de, $341c
- ld a, $c
- call Function3b2a
- ld a, $5
- ld [wc702], a
- ld hl, wJumptableIndex
- inc [hl]
- ret
-; e1f42
-
-Functione1f42: ; e1f42
- ld a, [wc702]
- hlcoord 17, 0
- add $f6
- ld [hl], a
- ld hl, wc702
- ld a, [hl]
- and a
- jr nz, .asm_e1f58
- ld a, $7
- ld [wJumptableIndex], a
- ret
-
-.asm_e1f58
- dec [hl]
- xor a
- ld [wcf64], a
- ld hl, wJumptableIndex
- inc [hl]
-
-Functione1f61: ; e1f61
- ld a, [wcf64]
- and a
- ret z
- dec a
- ld e, a
- ld d, $0
- ld hl, wc6d0
- add hl, de
- ld a, [hl]
- cp $ff
- ret z
- ld [wc6fd], a
- ld [wPlayerMinimized], a
- ld a, e
- ld [EnemyScreens], a
- call Functione2183
- call Functione2128
- xor a
- ld [wcf64], a
- ld hl, wJumptableIndex
- inc [hl]
- ret
-; e1f8b
-
-Functione1f8b: ; e1f8b
- ld a, [wcf64]
- and a
- ret z
- dec a
- ld hl, EnemyScreens
- cp [hl]
- ret z
- ld e, a
- ld d, $0
- ld hl, wc6d0
- add hl, de
- ld a, [hl]
- cp $ff
- ret z
- ld [wc6fd], a
- ld [PlayerScreens], a
- ld a, e
- ld [wc701], a
- call Functione2183
- call Functione2128
- ld a, $40
- ld [wc708], a
- ld hl, wJumptableIndex
- inc [hl]
-
-Functione1fba: ; e1fba
- ld hl, wc708
- ld a, [hl]
- and a
- jr z, .asm_e1fc3
- dec [hl]
- ret
-
-.asm_e1fc3
- call Functione2010
- ld a, $3
- ld [wJumptableIndex], a
- ret
-; e1fcc
-
-Functione1fcc: ; e1fcc
- ld a, [hJoypadPressed]
- and A_BUTTON
- ret z
- xor a
- ld [wc708], a
-.asm_e1fd5
- ld hl, wc708
- ld a, [hl]
- cp $2d
- jr nc, .asm_e1ff9
- inc [hl]
- push af
- call Functione2183
- pop af
- push hl
- ld e, a
- ld d, $0
- ld hl, wc6d0
- add hl, de
- ld a, [hl]
- pop hl
- cp $ff
- jr z, .asm_e1fd5
- ld [wc6fd], a
- call Functione2128
- jr .asm_e1fd5
-
-.asm_e1ff9
- call WaitPressAorB_BlinkCursor
- ld hl, wJumptableIndex
- inc [hl]
-
-Functione2000: ; e2000
- call Functione00ed
- jr nc, .asm_e200b
- ld hl, wJumptableIndex
- set 7, [hl]
- ret
-
-.asm_e200b
- xor a
- ld [wJumptableIndex], a
- ret
-; e2010
-
-Functione2010: ; e2010
- ld hl, wPlayerMinimized
- ld a, [hli]
- cp [hl]
- jr nz, .asm_e2066
- ld a, [EnemyScreens]
- call Functione2183
- call Functione2142
- ld a, [wc701]
- call Functione2183
- call Functione2142
- ld a, [EnemyScreens]
- ld e, a
- ld d, $0
- ld hl, wc6d0
- add hl, de
- ld [hl], $ff
- ld a, [wc701]
- ld e, a
- ld d, $0
- ld hl, wc6d0
- add hl, de
- ld [hl], $ff
- ld hl, wc703
-.asm_e2044
- ld a, [hli]
- and a
- jr nz, .asm_e2044
- dec hl
- ld a, [wPlayerMinimized]
- ld [hl], a
- ld [wc6fd], a
- ld hl, wc709
- ld e, [hl]
-rept 2
- inc [hl]
-endr
- ld d, $0
- hlcoord 5, 0
- add hl, de
- call Functione2128
- ld hl, UnknownText_0xe2083
- call PrintText
- ret
-
-.asm_e2066
- xor a
- ld [wc6fd], a
- ld a, [EnemyScreens]
- call Functione2183
- call Functione2128
- ld a, [wc701]
- call Functione2183
- call Functione2128
- ld hl, UnknownText_0xe2098
- call PrintText
- ret
-; e2083
-
-UnknownText_0xe2083: ; 0xe2083
- start_asm
-; 0xe2084
-
-Functione2084: ; e2084
- push bc
- hlcoord 2, 13
- call Functione2128
- ld hl, UnknownText_0xe2093
- pop bc
-rept 3
- inc bc
-endr
- ret
-; e2093
-
-UnknownText_0xe2093: ; 0xe2093
- ; , yeah!
- text_jump UnknownText_0x1c1a5b
- db "@"
-; 0xe2098
-
-UnknownText_0xe2098: ; 0xe2098
- ; Darn…
- text_jump UnknownText_0x1c1a65
- db "@"
-; 0xe209d
-
-Functione209d: ; e209d
- ld hl, wc6d0
- ld bc, $2d
- xor a
- call ByteFill
- call Functione2101
- ld c, $2
- ld b, [hl]
- call Functione20e5
- ld c, $8
- ld b, [hl]
- call Functione20e5
- ld c, $4
- ld b, [hl]
- call Functione20e5
- ld c, $7
- ld b, [hl]
- call Functione20e5
- ld c, $3
- ld b, [hl]
- call Functione20e5
- ld c, $6
- ld b, [hl]
- call Functione20e5
- ld c, $1
- ld b, [hl]
- call Functione20e5
- ld c, $5
- ld hl, wc6d0
- ld b, $2d
-.asm_e20db
- ld a, [hl]
- and a
- jr nz, .asm_e20e0
- ld [hl], c
-
-.asm_e20e0
- inc hl
- dec b
- jr nz, .asm_e20db
- ret
-; e20e5
-
-Functione20e5: ; e20e5
- push hl
- ld de, wc6d0
-.asm_e20e9
- call Random
- and $3f
- cp $2d
- jr nc, .asm_e20e9
- ld l, a
- ld h, $0
- add hl, de
- ld a, [hl]
- and a
- jr nz, .asm_e20e9
- ld [hl], c
- dec b
- jr nz, .asm_e20e9
- pop hl
- inc hl
- ret
-; e2101
-
-Functione2101: ; e2101
- ld a, [MenuSelection2]
- dec a
- ld l, a
- ld h, 0
-rept 3
- add hl, hl
-endr
- ld de, Unknown_e2110
- add hl, de
- ret
-; e2110
-
-Unknown_e2110: ; e2110
- db $02, $03, $06, $06, $06, $08, $08, $06
- db $02, $02, $04, $06, $06, $08, $08, $09
- db $02, $02, $02, $04, $07, $08, $08, $0c
-; e2128
-
-Functione2128: ; e2128
- ld a, [wc6fd]
- sla a
- sla a
- add $4
- ld [hli], a
- inc a
- ld [hld], a
- inc a
- ld bc, SCREEN_WIDTH
- add hl, bc
- ld [hli], a
- inc a
- ld [hl], a
- ld c, 3
- call DelayFrames
- ret
-; e2142
-
-Functione2142: ; e2142
- ld a, $1
- ld [hli], a
- ld [hld], a
- ld bc, SCREEN_WIDTH
- add hl, bc
- ld [hli], a
- ld [hl], a
- ld c, 3
- call DelayFrames
- ret
-; e2152
-
-Functione2152: ; e2152
- hlcoord 0, 0
- ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
- ld a, $1
- call ByteFill
- hlcoord 0, 0
- ld de, String_e2177
- call PlaceString
- hlcoord 15, 0
- ld de, String_e217d
- call PlaceString
- ld hl, UnknownText_0xe2176
- call PrintText
- ret
-; e2176
-
-UnknownText_0xe2176: ; 0xe2176
- db "@"
-; 0xe2177
-
-String_e2177: db "とったもの@"
-String_e217d: db "あと かい@"
-; e2183
-
-Functione2183: ; e2183
- ld d, $0
-.asm_e2185
- sub $9
- jr c, .asm_e218c
- inc d
- jr .asm_e2185
-
-.asm_e218c
- add $9
- ld e, a
- hlcoord 1, 2
- ld bc, $28
-.asm_e2195
- ld a, d
- and a
- jr z, .asm_e219d
- add hl, bc
- dec d
- jr .asm_e2195
-
-.asm_e219d
- sla e
- add hl, de
- ret
-; e21a1
-
-Functione21a1: ; e21a1 (38:61a1)
- ld a, [wJumptableIndex]
- cp $7
- jr nc, .quit
- call JoyTextDelay
- ld hl, hJoypadPressed ; $ffa3
- ld a, [hl]
- and A_BUTTON
- jr nz, .pressed_a
- ld a, [hl]
- and D_LEFT
- jr nz, .pressed_left
- ld a, [hl]
- and D_RIGHT
- jr nz, .pressed_right
- ld a, [hl]
- and D_UP
- jr nz, .pressed_up
- ld a, [hl]
- and D_DOWN
- jr nz, .pressed_down
- ret
-
-.quit
- ld hl, 0
- add hl, bc
- ld [hl], $0
- ret
-
-.pressed_a
- ld hl, $c
- add hl, bc
- ld a, [hl]
- inc a
- ld [wcf64], a
- ret
-
-.pressed_left
- ld hl, $6
- add hl, bc
- ld a, [hl]
- and a
- ret z
- sub $10
- ld [hl], a
- ld hl, $c
- add hl, bc
- dec [hl]
- ret
-
-.pressed_right
- ld hl, $6
- add hl, bc
- ld a, [hl]
- cp $80
- ret z
- add $10
- ld [hl], a
- ld hl, $c
- add hl, bc
- inc [hl]
- ret
-
-.pressed_up
- ld hl, $7
- add hl, bc
- ld a, [hl]
- and a
- ret z
- sub $10
- ld [hl], a
- ld hl, $c
- add hl, bc
- ld a, [hl]
- sub $9
- ld [hl], a
- ret
-
-.pressed_down
- ld hl, $7
- add hl, bc
- ld a, [hl]
- cp $40
- ret z
- add $10
- ld [hl], a
- ld hl, $c
- add hl, bc
- ld a, [hl]
- add $9
- ld [hl], a
- ret
-; e2221 (38:6221)
-
-LZ_e2221: ; e2221
-INCBIN "gfx/unknown/0e2221.2bpp.lz"
-
-Functione2391: ; e2391 (38:6391)
- ld hl, Options
- ld a, [hl]
- push af
- set 4, [hl]
- ld a, [VramState]
- push af
- xor a
- ld [VramState], a
- ld a, [hInMenu]
- push af
- ld a, $1
- ld [hInMenu], a
- xor a
- ld [hMapAnims], a
- call Functione2963
- xor a
- ld [wcb2e], a
- call DelayFrame
-.asm_e23b4
- call JoyTextDelay
- ld a, [wJumptableIndex]
- bit 7, a
- jr nz, .asm_e23c6
- call Functione23d5
- call DelayFrame
- jr .asm_e23b4
-.asm_e23c6
- call ClearSprites
- pop af
- ld [hInMenu], a
- pop af
- ld [VramState], a
- pop af
- ld [Options], a
- ret
-
-Functione23d5: ; e23d5 (38:63d5)
- ld a, [wJumptableIndex]
- ld hl, Jumptable_e23df
- call Functione33df
- jp [hl]
-
-Jumptable_e23df: ; e23df (38:63df)
- dw Functione23e9
- dw Functione241a
- dw Functione245d
- dw Functione247d
- dw Functione2992
-
-
-Functione23e9: ; e23e9 (38:63e9)
- xor a
- ld [hBGMapMode], a
- call ClearSprites
- call Functione2d30
- call Functione2a8e
- ld de, PCString_ChooseaPKMN
- call Functione2a6e
- ld a, $5
- ld [wcb2d], a
- call Functione2c2c
- call PCMonInfo
- ld a, $ff
- ld [CurPartySpecies], a
- ld a, $17
- call Functione33d0
- call WaitBGMap
- call Functione2e01
- call Functione298d
- ret
-
-Functione241a: ; e241a (38:641a)
- ld hl, hJoyPressed ; $ffa7
- ld a, [hl]
- and B_BUTTON
- jr nz, .asm_e2457
- ld a, [hl]
- and A_BUTTON
- jr nz, .asm_e2443
- call Functione29b5
- and a
- ret z
- call Functione2e01
- xor a
- ld [hBGMapMode], a
- call Functione2c2c
- call PCMonInfo
- ld a, $1
- ld [hBGMapMode], a
- call DelayFrame
- call DelayFrame
- ret
-.asm_e2443
- call Functione2def
- and a
- ret z
- cp $ff
- jr z, .asm_e2457
- ld a, $2
- ld [wJumptableIndex], a
- ret
-; e2452 (38:6452)
-
-.asm_e2452
- ld hl, wJumptableIndex
- dec [hl]
- ret
-
-.asm_e2457
- ld a, $4
- ld [wJumptableIndex], a
- ret
-
-Functione245d: ; e245d (38:645d)
- xor a
- ld [hBGMapMode], a
- call ClearSprites
- call Functione2def
- ld [CurPartySpecies], a
- ld a, $17
- call Functione33d0
- ld de, PCString_WhatsUp
- call Functione2a6e
- ld a, $1
- ld [MenuSelection2], a
- call Functione298d
- ret
-
-Functione247d: ; e247d (38:647d)
- ld hl, BillsPCDepositMenuDataHeader
- call CopyMenuDataHeader
- ld a, [MenuSelection2]
- call Function1d4b
- call InterpretMenu2
- jp c, BillsPCDepositFuncCancel
- ld a, [MenuSelection2]
- dec a
- and $3
- ld e, a
- ld d, 0
- ld hl, BillsPCDepositJumptable
-rept 2
- add hl, de
-endr
- ld a, [hli]
- ld h, [hl]
- ld l, a
- jp [hl]
-
-BillsPCDepositJumptable: ; e24a1 (38:64a1)
- dw BillsPCDepositFuncDeposit ; Deposit Pokemon
- dw BillsPCDepositFuncStats ; Pokemon Stats
- dw BillsPCDepositFuncRelease ; Release Pokemon
- dw BillsPCDepositFuncCancel ; Cancel
-
-
-BillsPCDepositFuncDeposit: ; e24a9 (38:64a9)
- call Functione2f18
- jp c, BillsPCDepositFuncCancel
- call Functione307c
- jr c, .no_overflow_31
- ld a, $0
- ld [wJumptableIndex], a
- xor a
- ld [wcb2b], a
- ld [wcb2a], a
- ret
-.no_overflow_31
- ld de, PCString_WhatsUp
- call Functione2a6e
- ret
-
-BillsPCDepositFuncStats: ; e24c8 (38:64c8)
- call LoadStandardMenuDataHeader
- call Functione2f7e
- call ExitMenu
- call PCMonInfo
- call Functione2def
- ld [CurPartySpecies], a
- ld a, $17
- call Functione33d0
- ret
-
-BillsPCDepositFuncRelease: ; e24e0 (38:64e0)
- call Functione2f18
- jr c, BillsPCDepositFuncCancel
- call Functione2f5f
- jr c, BillsPCDepositFuncCancel
- ld a, [MenuSelection2]
- push af
- ld de, PCString_ReleasePKMN
- call Functione2a6e
- call LoadStandardMenuDataHeader
- lb bc, 14, 11
- call PlaceYesNoBox
- ld a, [MenuSelection2]
- dec a
- call ExitMenu
- and a
- jr nz, .asm_e252c
- ld a, [wcb2b]
- ld hl, wcb2a
- add [hl]
- ld [CurPartyMon], a
- xor a
- ld [wPokemonWithdrawDepositParameter], a
- callba Functione039
- call Functione3180
- ld a, $0
- ld [wJumptableIndex], a
- xor a
- ld [wcb2b], a
- ld [wcb2a], a
- pop af
- ret
-.asm_e252c
- ld de, PCString_WhatsUp
- call Functione2a6e
- pop af
- ld [MenuSelection2], a
- ret
-
-BillsPCDepositFuncCancel: ; e2537 (38:6537)
- ld a, $0
- ld [wJumptableIndex], a
- ret
-; e253d (38:653d)
-
-BillsPCDepositMenuDataHeader: ; 0xe253d (38:653d)
- db $40 ; flags
- db 04, 09 ; start coords
- db 13, 19 ; end coords
- dw BillsPCDepositMenuData
- db 1 ; default option
-; 0xe2545
-
-BillsPCDepositMenuData: ; 0xe2545 (38:6545)
- db $80 ; flags
- db 4 ; items
- db "DEPOSIT@"
- db "STATS@"
- db "RELEASE@"
- db "CANCEL@"
-; 0xe2564 (38:6564)
-
-Functione2564: ; e2564
- hlcoord 0, 0
- ld b, $4
- ld c, $8
- call ClearBox
- hlcoord 0, 4
- ld b, $a
- ld c, $9
- call ClearBox
- hlcoord 0, 14
- ld b, $2
- ld c, $8
- call ClearBox
- ret
-; e2583
-
-Functione2583: ; e2583 (38:6583)
- ld hl, Options
- ld a, [hl]
- push af
- set 4, [hl]
- ld a, [VramState]
- push af
- xor a
- ld [VramState], a
- ld a, [hInMenu]
- push af
- ld a, $1
- ld [hInMenu], a
- xor a
- ld [hMapAnims], a
- call Functione2963
- ld a, $f
- ld [wcb2e], a
- call DelayFrame
-.asm_e25a7
- call JoyTextDelay
- ld a, [wJumptableIndex]
- bit 7, a
- jr nz, .no_overflow_49
- call Functione25c8
- call DelayFrame
- jr .asm_e25a7
-.no_overflow_49
- call ClearSprites
- pop af
- ld [hInMenu], a
- pop af
- ld [VramState], a
- pop af
- ld [Options], a
- ret
-
-Functione25c8: ; e25c8 (38:65c8)
- ld a, [wJumptableIndex]
- ld hl, .jumptable
- call Functione33df
- jp [hl]
-
-.jumptable: ; e25d2 (38:65d2)
- dw Functione25dc
- dw Functione2612
- dw Functione2655
- dw BillsPC_Withdraw
- dw Functione2992
-
-
-Functione25dc: ; e25dc (38:65dc)
- ld a, $f
- ld [wcb2e], a
- xor a
- ld [hBGMapMode], a
- call ClearSprites
- call Functione2d30
- call Functione2a8e
- ld de, PCString_ChooseaPKMN
- call Functione2a6e
- ld a, $5
- ld [wcb2d], a
- call Functione2c2c
- call PCMonInfo
- ld a, $ff
- ld [CurPartySpecies], a
- ld a, $17
- call Functione33d0
- call WaitBGMap
- call Functione2e01
- call Functione298d
- ret
-
-Functione2612: ; e2612 (38:6612)
- ld hl, hJoyPressed ; $ffa7
- ld a, [hl]
- and B_BUTTON
- jr nz, .asm_e264f
- ld a, [hl]
- and A_BUTTON
- jr nz, .asm_e263b
- call Functione29b5
- and a
- ret z
- call Functione2e01
- xor a
- ld [hBGMapMode], a
- call Functione2c2c
- call PCMonInfo
- ld a, $1
- ld [hBGMapMode], a
- call DelayFrame
- call DelayFrame
- ret
-.asm_e263b
- call Functione2def
- and a
- ret z
- cp $ff
- jr z, .asm_e264f
- ld a, $2
- ld [wJumptableIndex], a
- ret
-; e264a (38:664a)
-
-.asm_e264a
- ld hl, wJumptableIndex
- dec [hl]
- ret
-
-.asm_e264f
- ld a, $4
- ld [wJumptableIndex], a
- ret
-; e2655
-
-Functione2655: ; e2655 (38:6655)
- xor a
- ld [hBGMapMode], a
- call ClearSprites
- call Functione2def
- ld [CurPartySpecies], a
- ld a, $17
- call Functione33d0
- ld de, PCString_WhatsUp
- call Functione2a6e
- ld a, $1
- ld [MenuSelection2], a
- call Functione298d
- ret
-
-BillsPC_Withdraw: ; e2675 (38:6675)
- ld hl, .MenuDataHeader
- call CopyMenuDataHeader
- ld a, [MenuSelection2]
- call Function1d4b
- call InterpretMenu2
- jp c, .cancel
- ld a, [MenuSelection2]
- dec a
- and 3
- ld e, a
- ld d, 0
- ld hl, .jumptable
-rept 2
- add hl, de
-endr
- ld a, [hli]
- ld h, [hl]
- ld l, a
- jp [hl]
-
-.jumptable: ; e2699 (38:6699) #mark
- dw .withdraw ; Withdraw
- dw .stats ; Stats
- dw .release ; Release
- dw .cancel ; Cancel
-
-
-.withdraw: ; e26a1 (38:66a1)
- call Functione2f18
- jp c, .cancel
- call TryWithdrawPokemon
- jr c, .FailedWithdraw
- ld a, $0
- ld [wJumptableIndex], a
- xor a
- ld [wcb2b], a
- ld [wcb2a], a
- ret
-.FailedWithdraw
- ld de, PCString_WhatsUp
- call Functione2a6e
- ret
-
-.stats: ; e26c0 (38:66c0)
- call LoadStandardMenuDataHeader
- call Functione2f7e
- call ExitMenu
- call PCMonInfo
- call Functione2def
- ld [CurPartySpecies], a
- ld a, $17
- call Functione33d0
- ret
-
-.release: ; e26d8 (38:66d8)
- ld a, [MenuSelection2]
- push af
- call Functione2f5f
- jr c, .FailedRelease
- ld de, PCString_ReleasePKMN
- call Functione2a6e
- call LoadStandardMenuDataHeader
- lb bc, 14, 11
- call PlaceYesNoBox
- ld a, [MenuSelection2]
- dec a
- call ExitMenu
- and a
- jr nz, .FailedRelease
- ld a, [wcb2b]
- ld hl, wcb2a
- add [hl]
- ld [CurPartyMon], a
- ld a, PC_DEPOSIT
- ld [wPokemonWithdrawDepositParameter], a
- callba Functione039
- call Functione3180
- ld a, $0
- ld [wJumptableIndex], a
- xor a
- ld [wcb2b], a
- ld [wcb2a], a
- pop af
- ret
-.FailedRelease
- ld de, PCString_WhatsUp
- call Functione2a6e
- pop af
- ld [MenuSelection2], a
- ret
-
-.cancel: ; e272b (38:672b)
- ld a, $0
- ld [wJumptableIndex], a
- ret
-; e2731 (38:6731)
-
-.MenuDataHeader: ; 0xe2731
- db $40 ; flags
- db 04, 09 ; start coords
- db 13, 19 ; end coords
- dw .MenuData
- db 1 ; default option
-; 0xe2739
-
-.MenuData: ; 0xe2739
- db $80 ; flags
- db 4 ; items
- db "WITHDRAW@"
- db "STATS@"
- db "RELEASE@"
- db "CANCEL@"
-; 0xe2759
-
-Functione2759: ; e2759
- ld hl, Options
- ld a, [hl]
- push af
- set 4, [hl]
- ld a, [VramState]
- push af
- xor a
- ld [VramState], a
- ld a, [hInMenu]
- push af
- ld a, $1
- ld [hInMenu], a
- xor a
- ld [hMapAnims], a
- call Functione2963
- ld a, [wCurBox]
- and $f
- inc a
- ld [wcb2e], a
- call DelayFrame
-.asm_e2781
- call JoyTextDelay
- ld a, [wJumptableIndex]
- bit 7, a
- jr nz, .asm_e2793
- call Functione27a2
- call DelayFrame
- jr .asm_e2781
-
-.asm_e2793
- call ClearSprites
- pop af
- ld [hInMenu], a
- pop af
- ld [VramState], a
- pop af
- ld [Options], a
- ret
-; e27a2
-
-Functione27a2: ; e27a2
- ld a, [wJumptableIndex]
- ld hl, Jumptable_e27ac
- call Functione33df
- jp [hl]
-; e27ac
-
-Jumptable_e27ac: ; e27ac
- dw Functione27ba
- dw Functione27eb
- dw Functione283d
- dw Functione285d
- dw Functione28df
- dw Functione2903
- dw Functione2992
-; e27ba
-
-Functione27ba: ; e27ba
- xor a
- ld [hBGMapMode], a
- call ClearSprites
- call Functione2d30
- ld de, PCString_ChooseaPKMN
- call Functione2a6e
- ld a, $5
- ld [wcb2d], a
- call Functione2c2c
- call Functione2a80
- call PCMonInfo
- ld a, $ff
- ld [CurPartySpecies], a
- ld a, $17
- call Functione33d0
- call WaitBGMap
- call Functione2e01
- call Functione298d
- ret
-; e27eb
-
-Functione27eb: ; e27eb
- ld hl, hJoyPressed
- ld a, [hl]
- and B_BUTTON
- jr nz, .asm_e2837
- ld a, [hl]
- and A_BUTTON
- jr nz, .asm_e2823
- call Functione29d0
- jr c, .asm_e2816
- and a
- ret z
- call Functione2e01
- xor a
- ld [hBGMapMode], a
- call Functione2c2c
- call PCMonInfo
- ld a, $1
- ld [hBGMapMode], a
- call DelayFrame
- call DelayFrame
- ret
-
-.asm_e2816
- xor a
- ld [wcb2b], a
- ld [wcb2a], a
- ld a, $0
- ld [wJumptableIndex], a
- ret
-
-.asm_e2823
- call Functione2def
- and a
- ret z
- cp $ff
- jr z, .asm_e2837
- ld a, $2
- ld [wJumptableIndex], a
- ret
-
- ld hl, wJumptableIndex
- dec [hl]
- ret
-
-.asm_e2837
- ld a, $6
- ld [wJumptableIndex], a
- ret
-; e283d
-
-Functione283d: ; e283d
- xor a
- ld [hBGMapMode], a
- call ClearSprites
- call Functione2def
- ld [CurPartySpecies], a
- ld a, $17
- call Functione33d0
- ld de, PCString_WhatsUp
- call Functione2a6e
- ld a, $1
- ld [MenuSelection2], a
- call Functione298d
- ret
-; e285d
-
-Functione285d: ; e285d
- ld hl, MenuDataHeader_0xe28c3
- call CopyMenuDataHeader
- ld a, [MenuSelection2]
- call Function1d4b
- call InterpretMenu2
- jp c, Functione28bd
- ld a, [MenuSelection2]
- dec a
- and 3
- ld e, a
- ld d, 0
- ld hl, Jumptable_e2881
-rept 2
- add hl, de
-endr
- ld a, [hli]
- ld h, [hl]
- ld l, a
- jp [hl]
-; e2881
-
-Jumptable_e2881: ; e2881
- dw Functione2887
- dw Functione28a5
- dw Functione28bd
-; e2887
-
-Functione2887: ; e2887
- call Functione2f18
- jp c, Functione28bd
- ld a, [wcb2a]
- ld [wcb2f], a
- ld a, [wcb2b]
- ld [wcb30], a
- ld a, [wcb2e]
- ld [wcb31], a
- ld a, $4
- ld [wJumptableIndex], a
- ret
-; e28a5
-
-Functione28a5: ; e28a5
- call LoadStandardMenuDataHeader
- call Functione2f7e
- call ExitMenu
- call PCMonInfo
- call Functione2def
- ld [CurPartySpecies], a
- ld a, $17
- call Functione33d0
- ret
-; e28bd
-
-Functione28bd: ; e28bd
- ld a, $0
- ld [wJumptableIndex], a
- ret
-; e28c3
-
-MenuDataHeader_0xe28c3: ; 0xe28c3
- db $40 ; flags
- db 04, 09 ; start coords
- db 13, 19 ; end coords
- dw MenuData2_0xe28cb
- db 1 ; default option
-; 0xe28cb
-
-MenuData2_0xe28cb: ; 0xe28cb
- db $80 ; flags
- db 3 ; items
- db "MOVE@"
- db "STATS@"
- db "CANCEL@"
-; 0xe28df
-
-Functione28df: ; e28df
- xor a
- ld [hBGMapMode], a
- call Functione2d30
- ld de, PCString_MoveToWhere
- call Functione2a6e
- ld a, $5
- ld [wcb2d], a
- call Functione2c2c
- call Functione2a80
- call ClearSprites
- call Functione2e8c
- call WaitBGMap
- call Functione298d
- ret
-; e2903
-
-Functione2903: ; e2903
- ld hl, hJoyPressed
- ld a, [hl]
- and B_BUTTON
- jr nz, .asm_e294b
- ld a, [hl]
- and A_BUTTON
- jr nz, .asm_e2938
- call Functione29f4
- jr c, .asm_e292b
- and a
- ret z
- call Functione2e8c
- xor a
- ld [hBGMapMode], a
- call Functione2c2c
- ld a, $1
- ld [hBGMapMode], a
- call DelayFrame
- call DelayFrame
- ret
-
-.asm_e292b
- xor a
- ld [wcb2b], a
- ld [wcb2a], a
- ld a, $4
- ld [wJumptableIndex], a
- ret
-
-.asm_e2938
- call Functione2ee5
- jr c, .asm_e2946
- call Functione31e7
- ld a, $0
- ld [wJumptableIndex], a
- ret
-
-.asm_e2946
- ld hl, wJumptableIndex
- dec [hl]
- ret
-
-.asm_e294b
- ld a, [wcb2f]
- ld [wcb2a], a
- ld a, [wcb30]
- ld [wcb2b], a
- ld a, [wcb31]
- ld [wcb2e], a
- ld a, $0
- ld [wJumptableIndex], a
- ret
-; e2963
-
-Functione2963: ; e2963 (38:6963)
- call WhiteBGMap
- call ClearSprites
- call ClearTileMap
- call Functione33e8
- ld hl, OverworldMap
- ld bc, $338
- xor a
- call ByteFill
- xor a
- ld [wJumptableIndex], a
- ld [wcf64], a
- ld [wcf65], a
- ld [wcf66], a
- ld [wcb2b], a
- ld [wcb2a], a
- ret
-
-Functione298d: ; e298d (38:698d)
- ld hl, wJumptableIndex
- inc [hl]
- ret
-
-Functione2992: ; e2992 (38:6992)
- ld hl, wJumptableIndex
- set 7, [hl]
- ret
-
-Functione2998: ; e2998 (38:6998)
- ld a, [wcb2d]
- ld d, a
- ld a, [wcb2c]
- and a
- jr z, .asm_e29b2
- dec a
- cp $1
- jr z, .asm_e29b2
- ld e, a
- ld a, [hl]
- and D_UP
- jr nz, Functione2a18
- ld a, [hl]
- and D_DOWN
- jr nz, Functione2a2c
-.asm_e29b2
- jp Functione2a65
-
-Functione29b5: ; e29b5 (38:69b5)
- ld hl, hJoyLast
- ld a, [wcb2d]
- ld d, a
- ld a, [wcb2c]
- ld e, a
- and a
- jr z, .asm_e29cd
- ld a, [hl]
- and D_UP
- jr nz, Functione2a18
- ld a, [hl]
- and D_DOWN
- jr nz, Functione2a2c
-.asm_e29cd
- jp Functione2a65
-; e29d0 (38:69d0)
-
-Functione29d0: ; e29d0
- ld hl, hJoyLast
- ld a, [wcb2d]
- ld d, a
- ld a, [wcb2c]
- ld e, a
- and a
- jr z, .asm_e29e8
- ld a, [hl]
- and D_UP
- jr nz, Functione2a18
- ld a, [hl]
- and D_DOWN
- jr nz, Functione2a2c
-
-.asm_e29e8
- ld a, [hl]
- and D_LEFT
- jr nz, Functione2a48
- ld a, [hl]
- and D_RIGHT
- jr nz, Functione2a56
- jr Functione2a65
-
-Functione29f4: ; e29f4
- ld hl, hJoyLast
- ld a, [wcb2d]
- ld d, a
- ld a, [wcb2c]
- ld e, a
- and a
- jr z, .asm_e2a0c
-
- ld a, [hl]
- and D_UP
- jr nz, Functione2a18
- ld a, [hl]
- and D_DOWN
- jr nz, Functione2a2c
-
-.asm_e2a0c
- ld a, [hl]
- and D_LEFT
- jr nz, Functione2a48
- ld a, [hl]
- and D_RIGHT
- jr nz, Functione2a56
- jr Functione2a65
-
-Functione2a18: ; e2a18 (38:6a18)
- ld hl, wcb2b
- ld a, [hl]
- and a
- jr z, .asm_e2a22
- dec [hl]
- jr Functione2a68
-
-.asm_e2a22
- ld hl, wcb2a
- ld a, [hl]
- and a
- jr z, Functione2a65
- dec [hl]
- jr Functione2a68
-
-Functione2a2c: ; e2a2c (38:6a2c)
- ld a, [wcb2b]
- ld hl, wcb2a
- add [hl]
- inc a
- cp e
- jr nc, Functione2a65
-
- ld hl, wcb2b
- ld a, [hl]
- inc a
- cp d
- jr nc, .asm_e2a42
- inc [hl]
- jr Functione2a68
-
-.asm_e2a42
- ld hl, wcb2a
- inc [hl]
- jr Functione2a68
-; e2a48 (38:6a48)
-
-Functione2a48: ; e2a48
- ld hl, wcb2e
- ld a, [hl]
- and a
- jr z, .asm_e2a52
- dec [hl]
- jr Functione2a6c
-
-.asm_e2a52
- ld [hl], $e
- jr Functione2a6c
-
-Functione2a56: ; e2a56
- ld hl, wcb2e
- ld a, [hl]
- cp $e
- jr z, .asm_e2a61
- inc [hl]
- jr Functione2a6c
-
-.asm_e2a61
- ld [hl], $0
- jr Functione2a6c
-
-Functione2a65: ; e2a65 (38:6a65)
- xor a
- and a
- ret
-
-Functione2a68: ; e2a68 (38:6a68)
- ld a, $1
- and a
- ret
-; e2a6c (38:6a6c)
-
-Functione2a6c: ; e2a6c
- scf
- ret
-; e2a6e
-
-Functione2a6e: ; e2a6e (38:6a6e)
- push de
- hlcoord 0, 15
- lb bc, 1, 18
- call TextBox
- pop de
- hlcoord 1, 16
- call PlaceString
- ret
-; e2a80 (38:6a80)
-
-Functione2a80: ; e2a80
- call Functione2a8e
- hlcoord 8, 1
- ld [hl], $5f
- hlcoord 19, 1
- ld [hl], $5e
- ret
-; e2a8e
-
-Functione2a8e: ; e2a8e (38:6a8e)
- hlcoord 8, 0
- lb bc, 1, 10
- call TextBox
-
- ld a, [wcb2e]
- and a
- jr z, .party
-
- cp NUM_BOXES + 1
- jr nz, .gotbox
-
- ld a, [wCurBox]
- inc a
-.gotbox
- dec a
- ld hl, wBoxNames
- ld bc, BOX_NAME_LENGTH
- call AddNTimes
- ld e, l
- ld d, h
- jr .print
-
-.party
- ld de, String_e2abd
- hlcoord 10, 1
- call PlaceString
- ret
-; e2abd (38:6abd)
-
-String_e2abd:
- db "PARTY <PK><MN>@"
-; e2ac6
-
-PCMonInfo: ; e2ac6 (38:6ac6)
-; Display a monster's pic and
-; attributes when highlighting
-; it in a PC menu.
-
-; Includes the neat cascading
-; effect when showing the pic.
-
-; Example: Species, level, gender,
-; whether it's holding an item.
-
- hlcoord 0, 0
- lb bc, 15, 8
- call ClearBox
-
- hlcoord 8, 14
- lb bc, 1, 3
- call ClearBox
-
- call Functione2def
- and a
- ret z
- cp $ff
- ret z
-
- ld [wd265], a
- hlcoord 1, 4
- xor a
- ld b, 7
-.asm_e2ae9
- ld c, 7
- push af
- push hl
-.asm_e2aed
- ld [hli], a
- add 7
- dec c
- jr nz, .asm_e2aed
- pop hl
- ld de, 20
- add hl, de
- pop af
- inc a
- dec b
- jr nz, .asm_e2ae9
-
- call Functione2b6d
- ld a, [wd265]
- ld [CurPartySpecies], a
- ld [CurSpecies], a
- ld hl, TempMonDVs
- predef GetUnownLetter
- call GetBaseData
- ld de, VTiles2 tile $00
- predef GetFrontpic
- xor a
- ld [wcb32], a
- ld a, [CurPartySpecies]
- ld [wd265], a
-
- cp EGG
- ret z
-
- call GetBasePokemonName
- hlcoord 1, 14
- call PlaceString
-
- hlcoord 1, 12
- call PrintLevel
-
- ld a, $3
- ld [MonType], a
- callba GetGender
- jr c, .asm_e2b4f
- ld a, "♂"
- jr nz, .printgender
- ld a, "♀"
-.printgender
- hlcoord 5, 12
- ld [hl], a
-.asm_e2b4f
-
- ld a, [TempMonItem]
- and a
- ret z
-
- ld d, a
- callab ItemIsMail
- jr c, .mail
- ld a, $5d ; item icon
- jr .printitem
- ld a, $1
- ld [wcb32], a
- ld a, $5c ; mail icon
-.printitem
- hlcoord 7, 12
- ld [hl], a
- ret
-
-Functione2b6d: ; e2b6d (38:6b6d)
- ld a, [wcb2b]
- ld hl, wcb2a
- add [hl]
- ld e, a
- ld d, $0
- ld hl, wc801
-rept 3
- add hl, de
-endr
- ld a, [hl]
- and a
- jr z, .asm_e2bc6
- cp $f
- jr z, .asm_e2bf5
- ld b, a
- call Functione3396
- ld a, b
- call GetSRAMBank
- push hl
- ld bc, $35
- add hl, bc
- ld bc, $20
- ld a, e
- call AddNTimes
- ld a, [hl]
- ld [TempMonLevel], a
- pop hl
- push hl
- ld bc, $17
- add hl, bc
- ld bc, $20
- ld a, e
- call AddNTimes
- ld a, [hl]
- ld [TempMonItem], a
- pop hl
- ld bc, $2b
- add hl, bc
- ld bc, $20
- ld a, e
- call AddNTimes
- ld de, TempMonDVs
- ld a, [hli]
- ld [de], a
- inc de
- ld a, [hl]
- ld [de], a
- call CloseSRAM
- ret
-.asm_e2bc6
- ld hl, PartyMon1Level
- ld bc, $30
- ld a, e
- call AddNTimes
- ld a, [hl]
- ld [TempMonLevel], a
- ld hl, PartyMon1Item
- ld bc, $30
- ld a, e
- call AddNTimes
- ld a, [hl]
- ld [TempMonItem], a
- ld hl, PartyMon1DVs
- ld bc, $30
- ld a, e
- call AddNTimes
- ld de, TempMonDVs
- ld a, [hli]
- ld [de], a
- inc de
- ld a, [hl]
- ld [de], a
- ret
-
-.asm_e2bf5
- ld a, BANK(sBox)
- call GetSRAMBank
- ld hl, sBoxMon1Level
- ld bc, $20
- ld a, e
- call AddNTimes
- ld a, [hl]
- ld [TempMonLevel], a
-
- ld hl, sBoxMon1Item
- ld bc, $20
- ld a, e
- call AddNTimes
- ld a, [hl]
- ld [TempMonItem], a
-
- ld hl, sBoxMon1DVs
- ld bc, $20
- ld a, e
- call AddNTimes
- ld de, TempMonDVs
- ld a, [hli]
- ld [de], a
- inc de
- ld a, [hl]
- ld [de], a
-
- call CloseSRAM
- ret
-
-Functione2c2c: ; e2c2c (38:6c2c)
- hlcoord 8, 2
- lb bc, 10, 10
- call TextBox
-
- hlcoord 8, 2
- ld [hl], "└"
- hlcoord 19, 2
- ld [hl], "┘"
-
- ld a, [wcb2a]
- ld e, a
- ld d, 0
- ld hl, OverworldMap
-rept 3
- add hl, de
-endr
- ld e, l
- ld d, h
- hlcoord 9, 4
- ld a, [wcb2d]
-.asm_e2c53
- push af
- push de
- push hl
- call Functione2c6e
- pop hl
- ld de, $28
- add hl, de
- pop de
-rept 3
- inc de
-endr
- pop af
- dec a
- jr nz, .asm_e2c53
- ret
-; e2c67 (38:6c67)
-
-String_e2c67:
- db "CANCEL@"
-; e2c6e
-
-Functione2c6e: ; e2c6e (38:6c6e)
- ld a, [de]
- and a
- ret z
- cp $ff
- jr nz, .asm_e2c7c
- ld de, String_e2c67
- call PlaceString
- ret
-.asm_e2c7c
- inc de
- ld a, [de]
- ld b, a
- inc de
- ld a, [de]
- ld e, a
- ld a, b
- and a
- jr z, .asm_e2cc8
- cp $f
- jr z, .asm_e2cf1
- push hl
- call Functione3396
- ld a, b
- call GetSRAMBank
- push hl
- ld bc, $16
- add hl, bc
- ld bc, $20
- ld a, e
- call AddNTimes
- ld a, [hl]
- pop hl
- and a
- jr z, .asm_e2cc2
- ld bc, $372
- add hl, bc
- ld bc, $b
- ld a, e
- call AddNTimes
- ld de, StringBuffer1
- ld bc, $b
- call CopyBytes
- call CloseSRAM
- pop hl
- ld de, StringBuffer1
- call PlaceString
- ret
-.asm_e2cc2
- call CloseSRAM
- pop hl
- jr .asm_e2d23
-.asm_e2cc8
- push hl
- ld hl, PartySpecies
- ld d, $0
- add hl, de
- ld a, [hl]
- and a
- jr z, .asm_e2cee
- ld hl, PartyMonNicknames
- ld bc, $b
- ld a, e
- call AddNTimes
- ld de, StringBuffer1
- ld bc, $b
- call CopyBytes
- pop hl
- ld de, StringBuffer1
- call PlaceString
- ret
-.asm_e2cee
- pop hl
- jr .asm_e2d23
-.asm_e2cf1
- push hl
- ld a, BANK(sBox)
- call GetSRAMBank
- ld hl, sBoxSpecies
- ld d, $0
- add hl, de
- ld a, [hl]
- and a
- jr z, .asm_e2d1f
- ld hl, sBoxMonNicknames
- ld bc, PKMN_NAME_LENGTH
- ld a, e
- call AddNTimes
- ld de, StringBuffer1
- ld bc, PKMN_NAME_LENGTH
- call CopyBytes
- call CloseSRAM
- pop hl
- ld de, StringBuffer1
- call PlaceString
- ret
-.asm_e2d1f
- call CloseSRAM
- pop hl
-.asm_e2d23
- ld de, String_e2d2a
- call PlaceString
- ret
-; e2d2a (38:6d2a)
-
-String_e2d2a:
- db "-----@"
-; e2d30
-
-Functione2d30: ; e2d30 (38:6d30)
- xor a
- ld hl, OverworldMap
- ld bc, $5a
- call ByteFill
- ld de, OverworldMap
- xor a
- ld [wd003], a
- ld [wd004], a
- ld a, [wcb2e]
- and a
- jr z, .asm_e2d87
- cp $f
- jr z, .asm_e2db7
- ld b, a
- call Functione3396
- ld a, b
- call GetSRAMBank
- inc hl
-.asm_e2d57
- ld a, [hl]
- cp $ff
- jr z, .asm_e2d79
- and a
- jr z, .asm_e2d79
- ld [de], a
- inc de
- ld a, [wcb2e]
- ld [de], a
- inc de
- ld a, [wd003]
- ld [de], a
- inc a
- ld [wd003], a
- inc de
- inc hl
- ld a, [wd004]
- inc a
- ld [wd004], a
- jr .asm_e2d57
-.asm_e2d79
- call CloseSRAM
- ld a, $ff
- ld [de], a
- ld a, [wd004]
- inc a
- ld [wcb2c], a
- ret
-.asm_e2d87
- ld hl, PartySpecies
-.asm_e2d8a
- ld a, [hl]
- cp $ff
- jr z, .asm_e2dac
- and a
- jr z, .asm_e2dac
- ld [de], a
- inc de
- ld a, [wcb2e]
- ld [de], a
- inc de
- ld a, [wd003]
- ld [de], a
- inc a
- ld [wd003], a
- inc de
- inc hl
- ld a, [wd004]
- inc a
- ld [wd004], a
- jr .asm_e2d8a
-.asm_e2dac
- ld a, $ff
- ld [de], a
- ld a, [wd004]
- inc a
- ld [wcb2c], a
- ret
-.asm_e2db7
- ld a, BANK(sBox)
- call GetSRAMBank
- ld hl, sBoxSpecies
-.asm_e2dbf
- ld a, [hl]
- cp $ff
- jr z, .asm_e2de1
- and a
- jr z, .asm_e2de1
- ld [de], a
- inc de
- ld a, [wcb2e]
- ld [de], a
- inc de
- ld a, [wd003]
- ld [de], a
- inc a
- ld [wd003], a
- inc de
- inc hl
- ld a, [wd004]
- inc a
- ld [wd004], a
- jr .asm_e2dbf
-.asm_e2de1
- call CloseSRAM
- ld a, $ff
- ld [de], a
- ld a, [wd004]
- inc a
- ld [wcb2c], a
- ret
-
-Functione2def: ; e2def (38:6def)
- ld a, [wcb2b]
- ld hl, wcb2a
- add [hl]
- ld e, a
- ld d, $0
- ld hl, OverworldMap
-rept 3
- add hl, de
-endr
- ld a, [hl]
- ret
-
-Functione2e01: ; e2e01 (38:6e01)
- ld a, [wcb2c]
- and a
- jr nz, .asm_e2e0b
- call ClearSprites
- ret
-.asm_e2e0b
- ld hl, Unknown_e2e2b
- ld de, Sprites
-.done1
- ld a, [hl]
- cp $ff
- ret z
- ld a, [wcb2b]
- and $7
- swap a
- add [hl]
- inc hl
- ld [de], a
- inc de
- ld a, [hli]
- ld [de], a
- inc de
- ld a, [hli]
- ld [de], a
- inc de
- ld a, [hli]
- ld [de], a
- inc de
- jr .done1
-; e2e2b (38:6e2b)
-
-Unknown_e2e2b: ; e2e2b
- db $26, $50, $00, $00
- db $26, $58, $00, $00
- db $26, $60, $00, $00
- db $26, $68, $00, $00
- db $26, $70, $00, $00
- db $26, $78, $00, $00
- db $26, $80, $00, $00
- db $26, $88, $00, $00
- db $26, $90, $00, $00
- db $26, $97, $00, $00
- db $39, $50, $00, $40
- db $39, $58, $00, $40
- db $39, $60, $00, $40
- db $39, $68, $00, $40
- db $39, $70, $00, $40
- db $39, $78, $00, $40
- db $39, $80, $00, $40
- db $39, $88, $00, $40
- db $39, $90, $00, $40
- db $39, $97, $00, $40
- db $2e, $4e, $01, $00
- db $31, $4e, $01, $40
- db $2e, $99, $01, $20
- db $31, $99, $01, $60
- db $ff
-; e2e8c
-
-Functione2e8c: ; e2e8c
- ld hl, Unknown_e2eac
- ld de, Sprites
-.asm_e2e92
- ld a, [hl]
- cp $ff
- ret z
- ld a, [wcb2b]
- and $7
- swap a
- add [hl]
- inc hl
- ld [de], a
- inc de
- ld a, [hli]
- ld [de], a
- inc de
- ld a, [hli]
- ld [de], a
- inc de
- ld a, [hli]
- ld [de], a
- inc de
- jr .asm_e2e92
-; e2eac
-
-Unknown_e2eac: ; e2eac
- db $27, $50, $06, $00
- db $2b, $58, $00, $40
- db $2b, $60, $00, $40
- db $2b, $68, $00, $40
- db $2b, $70, $00, $40
- db $2b, $78, $00, $40
- db $2b, $80, $00, $40
- db $2b, $88, $00, $40
- db $2b, $90, $00, $40
- db $27, $98, $07, $00
- db $ff
-; e2ed5
-
-Functione2ed5: ; e2ed5
-.asm_e2ed5
- push bc
- push hl
-.asm_e2ed7
- ld [hli], a
- dec c
- jr nz, .asm_e2ed7
- pop hl
- ld bc, SCREEN_WIDTH
- add hl, bc
- pop bc
- dec b
- jr nz, .asm_e2ed5
- ret
-; e2ee5
-
-Functione2ee5: ; e2ee5
- ld hl, wcb2e
- ld a, [wcb31]
- cp [hl]
- jr z, .asm_e2f00
- ld a, [wcb2e]
- and a
- jr z, .asm_e2ef8
- ld e, $15
- jr .asm_e2efa
-
-.asm_e2ef8
- ld e, $7
-
-.asm_e2efa
- ld a, [wcb2c]
- cp e
- jr nc, .asm_e2f02
-
-.asm_e2f00
- and a
- ret
-
-.asm_e2f02
- ld de, PCString_TheresNoRoom
- call Functione2a6e
- ld de, SFX_WRONG
- call WaitPlaySFX
- call WaitSFX
- ld c, 50
- call DelayFrames
- scf
- ret
-; e2f18
-
-Functione2f18: ; e2f18 (38:6f18)
- ld a, [wcb2e]
- and a
- jr nz, .Okay
- ld a, [wcb2c]
- cp $3
- jr c, .ItsYourLastPokemon
- ld a, [wcb2b]
- ld hl, wcb2a
- add [hl]
- ld [CurPartyMon], a
- callba CheckCurPartyMonFainted
- jr c, .AllOthersFainted
- ld a, [wcb32]
- and a
- jr nz, .HasMail
-.Okay
- and a
- ret
-.HasMail
- ld de, PCString_RemoveMail
- jr .NotOkay
-.AllOthersFainted
- ld de, PCString_NoMoreUsablePKMN
- jr .NotOkay
-.ItsYourLastPokemon
- ld de, PCString_ItsYourLastPKMN
-.NotOkay
- call Functione2a6e
- ld de, SFX_WRONG
- call WaitPlaySFX
- call WaitSFX
- ld c, 50
- call DelayFrames
- scf
- ret
-
-Functione2f5f: ; e2f5f (38:6f5f)
- ld a, [CurPartySpecies]
- cp EGG
- jr z, .asm_e2f68
- and a
- ret
-.asm_e2f68
- ld de, PCString_NoReleasingEGGS
- call Functione2a6e
- ld de, SFX_WRONG
- call WaitPlaySFX
- call WaitSFX
- ld c, 50
- call DelayFrames
- scf
- ret
-
-Functione2f7e: ; e2f7e (38:6f7e)
- call LowVolume
- call Functione2fd6
- ld a, $3
- ld [MonType], a
- predef StatsScreenInit
- call Functione33e8
- call MaxVolume
- ret
-
-Functione2f95: ; e2f95 (38:6f95)
- ld hl, hJoyPressed ; $ffa7
- ld a, [hl]
- and A_BUTTON | B_BUTTON | D_RIGHT + D_LEFT
- ld [wcf73], a
- jr nz, .asm_e2fd0
- ld a, [hl]
- and D_DOWN | D_UP
- ld [wcf73], a
- jr nz, .asm_e2faa
- jr .asm_e2fd0
-.asm_e2faa
- call Functione2998
- and a
- jr z, .asm_e2fd1
- call Functione2def
- ld [wd265], a
- call Functione2b6d
- ld a, [wd265]
- ld [CurPartySpecies], a
- ld [CurSpecies], a
- ld hl, TempMonDVs
- predef GetUnownLetter
- call GetBaseData
- call Functione2fd6
-.asm_e2fd0
- ret
-.asm_e2fd1
- xor a
- ld [wcf73], a
- ret
-
-Functione2fd6: ; e2fd6 (38:6fd6)
- ld a, [wcb2b]
- ld hl, wcb2a
- add [hl]
- ld [CurPartyMon], a
- ld a, [wcb2e]
- and a
- jr z, .asm_e3020
- cp $f
- jr nz, .asm_e3048
- ld a, BANK(sBox)
- call GetSRAMBank
- ld hl, sBoxSpecies
- call Functione3357
- ld hl, sBoxMonNicknames
- call Functione3363
- ld hl, sBoxMonOT
- call Functione3376
- ld hl, sBoxMons
- ld bc, BOXMON_STRUCT_LENGTH
- ld a, [CurPartyMon]
- call AddNTimes
- ld de, wd018
- ld bc, $30
- call CopyBytes
- call CloseSRAM
- callba Function5088b
- ret
-.asm_e3020
- ld hl, PartySpecies
- call Functione3357
- ld hl, PartyMonNicknames
- call Functione3363
- ld hl, PartyMonOT
- call Functione3376
- ld hl, PartyMons ; wdcdf (aliases: PartyMon1, PartyMon1Species)
- ld bc, $30
- ld a, [CurPartyMon]
- call AddNTimes
- ld de, wd018
- ld bc, $30
- call CopyBytes
- ret
-.asm_e3048
- ld b, a
- call Functione3396
- ld a, b
- call GetSRAMBank
- push hl
- inc hl
- call Functione3357
- pop hl
- push hl
- ld bc, $372
- add hl, bc
- call Functione3363
- pop hl
- push hl
- ld bc, $296
- add hl, bc
- call Functione3376
- pop hl
- ld bc, $16
- add hl, bc
- ld bc, $20
- call Functione3389
- call CloseSRAM
- callba Function5088b
- ret
-
-Functione307c: ; e307c (38:707c)
- ld a, [wcb2b]
- ld hl, wcb2a
- add [hl]
- ld [CurPartyMon], a
- ld hl, PartyMonNicknames
- ld a, [CurPartyMon]
- call GetNick
- ld a, PC_DEPOSIT
- ld [wPokemonWithdrawDepositParameter], a
- predef SentGetPkmnIntoFromBox
- jr c, .asm_boxisfull
- xor a
- ld [wPokemonWithdrawDepositParameter], a
- callba Functione039
- ld a, [CurPartySpecies]
- call PlayCry
- hlcoord 0, 0
- lb bc, 15, 8
- call ClearBox
- hlcoord 8, 14
- lb bc, 1, 3
- call ClearBox
- hlcoord 0, 15
- lb bc, 1, 18
- call TextBox
- call WaitBGMap
- hlcoord 1, 16
- ld de, PCString_Stored
- call PlaceString
- ld l, c
- ld h, b
- ld de, StringBuffer1
- call PlaceString
- ld a, "!"
- ld [bc], a
- ld c, 50
- call DelayFrames
- and a
- ret
-
-.asm_boxisfull
- ld de, PCString_BoxFull
- call Functione2a6e
- ld de, SFX_WRONG
- call WaitPlaySFX
- call WaitSFX
- ld c, 50
- call DelayFrames
- scf
- ret
-
-TryWithdrawPokemon: ; e30fa (38:70fa)
- ld a, [wcb2b]
- ld hl, wcb2a
- add [hl]
- ld [CurPartyMon], a
- ld a, BANK(sBoxMonNicknames)
- call GetSRAMBank
- ld a, [CurPartyMon]
- ld hl, sBoxMonNicknames
- call GetNick
- call CloseSRAM
- xor a
- ld [wPokemonWithdrawDepositParameter], a
- predef SentGetPkmnIntoFromBox
- jr c, .PartyFull
- ld a, PC_DEPOSIT
- ld [wPokemonWithdrawDepositParameter], a
- callba Functione039
- ld a, [CurPartySpecies]
- call PlayCry
- hlcoord 0, 0
- lb bc, 15, 8
- call ClearBox
- hlcoord 8, 14
- lb bc, 1, 3
- call ClearBox
- hlcoord 0, 15
- lb bc, 1, 18
- call TextBox
- call WaitBGMap
- hlcoord 1, 16
- ld de, PCString_Got
- call PlaceString
- ld l, c
- ld h, b
- ld de, StringBuffer1
- call PlaceString
- ld a, $e7
- ld [bc], a
- ld c, 50
- call DelayFrames
- and a
- ret
-
-.PartyFull
- ld de, PCString_PartyFull
- call Functione2a6e
- ld de, SFX_WRONG
- call WaitPlaySFX
- call WaitSFX
- ld c, 50
- call DelayFrames
- scf
- ret
-
-
-Functione3180: ; e3180 (38:7180)
- hlcoord 0, 0
- lb bc, 15, 8
- call ClearBox
- hlcoord 8, 14
- lb bc, 1, 3
- call ClearBox
- hlcoord 0, 15
- lb bc, 1, 18
- call TextBox
-
- call WaitBGMap
- ld a, [CurPartySpecies]
- call GetCryIndex
- jr c, .asm_e31ab
- ld e, c
- ld d, b
- call PlayCryHeader
-.asm_e31ab
-
- ld a, [CurPartySpecies]
- ld [wd265], a
- call GetPokemonName
- hlcoord 1, 16
- ld de, PCString_ReleasedPKMN
- call PlaceString
- ld c, 80
- call DelayFrames
- hlcoord 0, 15
- lb bc, 1, 18
- call TextBox
- hlcoord 1, 16
- ld de, PCString_Bye
- call PlaceString
- ld l, c
- ld h, b
- inc hl
- ld de, StringBuffer1
- call PlaceString
- ld l, c
- ld h, b
- ld [hl], $e7
- ld c, 50
- call DelayFrames
- ret
-; e31e7 (38:71e7)
-
-Functione31e7: ; e31e7
- push hl
- push de
- push bc
- push af
- hlcoord 0, 15
- lb bc, 1, 18
- call TextBox
- hlcoord 1, 16
- ld de, String_e3233
- call PlaceString
- ld c, 20
- call DelayFrames
- pop af
- pop bc
- pop de
- pop hl
- ld a, [wCurBox]
- push af
- ld bc, 0
- ld a, [wcb31]
- and a
- jr nz, .asm_e3215
- set 0, c
-
-.asm_e3215
- ld a, [wcb2e]
- and a
- jr nz, .asm_e321d
- set 1, c
-
-.asm_e321d
- ld hl, Jumptable_e3245
-rept 2
- add hl, bc
-endr
- ld a, [hli]
- ld h, [hl]
- ld l, a
- ld de, Functione322a
- push de
- jp [hl]
-; e322a
-
-Functione322a: ; e322a
- pop af
- ld e, a
- callba Function14ad5
- ret
-; e3233
-
-String_e3233:
- db "Saving… Leave ON!@"
-; e3245
-
-Jumptable_e3245: ; e3245
- dw Functione324d
- dw Functione3267
- dw Functione327d
- dw Functione3284
-; e324d
-
-Functione324d: ; e324d
- ld hl, wcb31
- ld a, [wcb2e]
- cp [hl]
- jr z, .asm_e325d
- call Functione32b0
- call Functione32fa
- ret
-
-.asm_e325d
- call Functione32b0
- call Functione328e
- call Functione32fa
- ret
-; e3267
-
-Functione3267: ; e3267
- call Functione3316
- ld a, $1
- ld [wc2cd], a
- callba SaveGameData
- xor a
- ld [wc2cd], a
- call Functione32fa
- ret
-; e327d
-
-Functione327d: ; e327d
- call Functione32b0
- call Functione3346
- ret
-; e3284
-
-Functione3284: ; e3284
- call Functione3316
- call Functione328e
- call Functione3346
- ret
-; e328e
-
-Functione328e: ; e328e
- ld a, [wcb2b]
- ld hl, wcb2a
- add [hl]
- ld e, a
- ld a, [wcb30]
- ld hl, wcb2f
- add [hl]
- cp e
- ret nc
- ld hl, wcb2b
- ld a, [hl]
- and a
- jr z, .asm_e32a8
- dec [hl]
- ret
-
-.asm_e32a8
- ld hl, wcb2a
- ld a, [hl]
- and a
- ret z
- dec [hl]
- ret
-; e32b0
-
-Functione32b0: ; e32b0
- ld a, [wcb31]
- dec a
- ld e, a
- callba Function14ac2
- ld a, [wcb30]
- ld hl, wcb2f
- add [hl]
- ld [CurPartyMon], a
- ld a, $1
- call GetSRAMBank
- ld hl, sBoxSpecies
- call Functione3357
- ld hl, sBoxMonNicknames
- call Functione3363
- ld hl, sBoxMonOT
- call Functione3376
- ld hl, sBoxMons
- ld bc, BOXMON_STRUCT_LENGTH
- call Functione3389
- call CloseSRAM
- callba Function5088b
- ld a, PC_DEPOSIT
- ld [wPokemonWithdrawDepositParameter], a
- callba Functione039
- ret
-; e32fa
-
-Functione32fa: ; e32fa
- ld a, [wcb2e]
- dec a
- ld e, a
- callba Function14ac2
- ld a, [wcb2b]
- ld hl, wcb2a
- add [hl]
- ld [CurPartyMon], a
- callba Function51322
- ret
-; e3316
-
-Functione3316: ; e3316
- ld a, [wcb30]
- ld hl, wcb2f
- add [hl]
- ld [CurPartyMon], a
- ld hl, PartySpecies
- call Functione3357
- ld hl, PartyMonNicknames
- call Functione3363
- ld hl, PartyMonOT
- call Functione3376
- ld hl, PartyMon1Species
- ld bc, PARTYMON_STRUCT_LENGTH
- call Functione3389
- xor a
- ld [wPokemonWithdrawDepositParameter], a
- callba Functione039
- ret
-; e3346
-
-Functione3346: ; e3346
- ld a, [wcb2b]
- ld hl, wcb2a
- add [hl]
- ld [CurPartyMon], a
- callba Function5138b
- ret
-; e3357
-
-Functione3357: ; e3357 (38:7357)
- ld a, [CurPartyMon]
- ld c, a
- ld b, $0
- add hl, bc
- ld a, [hl]
- ld [CurPartySpecies], a
- ret
-
-Functione3363: ; e3363 (38:7363)
- ld bc, $b
- ld a, [CurPartyMon]
- call AddNTimes
- ld de, wd002
- ld bc, $b
- call CopyBytes
- ret
-
-Functione3376: ; e3376 (38:7376)
- ld bc, $b
- ld a, [CurPartyMon]
- call AddNTimes
- ld de, wd00d
- ld bc, $b
- call CopyBytes
- ret
-
-Functione3389: ; e3389 (38:7389)
- ld a, [CurPartyMon]
- call AddNTimes
- ld de, wd018
- call CopyBytes
- ret
-
-Functione3396: ; e3396 (38:7396)
- dec b
- ld c, b
- ld b, 0
- ld hl, Unknown_e33a6
-rept 3
- add hl, bc
-endr
- ld a, [hli]
- ld b, a
- ld a, [hli]
- ld h, [hl]
- ld l, a
- ret
-; e33a6 (38:73a6)
-
-Unknown_e33a6: ; e33a6
- ; bank, address
- dba sBox1
- dba sBox2
- dba sBox3
- dba sBox4
- dba sBox5
- dba sBox6
- dba sBox7
- dba sBox8
- dba sBox9
- dba sBox10
- dba sBox11
- dba sBox12
- dba sBox13
- dba sBox14
-; e33d0
-
-Functione33d0: ; e33d0 (38:73d0)
- ld b, a
- call GetSGBLayout
- ld a, $e4
- call DmgToCgbBGPals
- ld a, $fc
- call Functioncf8
- ret
-
-Functione33df: ; e33df (38:73df)
- ld e, a
- ld d, $0
-rept 2
- add hl, de
-endr
- ld a, [hli]
- ld h, [hl]
- ld l, a
- ret
-
-Functione33e8: ; e33e8 (38:73e8)
- call DisableLCD
- ld hl, VTiles2 tile $00
- ld bc, $310
- xor a
- call ByteFill
- call LoadStandardFont
- call LoadFontsBattleExtra
- ld hl, PCMailGFX
- ld de, VTiles2 tile $5c
- ld bc, $40
- call CopyBytes
- ld hl, PCSelectLZ
- ld de, VTiles0 tile $00
- call Decompress
- ld a, 6
- call SkipMusic
- call EnableLCD
- ret
-; e3419 (38:7419)
-
-PCSelectLZ: INCBIN "gfx/pc.2bpp.lz"
-PCMailGFX: INCBIN "gfx/pc_mail.2bpp"
-; e34dd
-
-PCString_ChooseaPKMN: db "Choose a <PK><MN>.@"
-PCString_WhatsUp: db "What's up?@"
-PCString_ReleasePKMN: db "Release <PK><MN>?@"
-PCString_MoveToWhere: db "Move to where?@"
-PCString_ItsYourLastPKMN: db "It's your last <PK><MN>!@"
-PCString_TheresNoRoom: db "There's no room!@"
-PCString_NoMoreUsablePKMN: db "No more usable <PK><MN>!@"
-PCString_RemoveMail: db "Remove MAIL.@"
-PCString_ReleasedPKMN: db "Released <PK><MN>.@"
-PCString_Bye: db "Bye,@"
-PCString_Stored: db "Stored @"
-PCString_Got: db "Got @"
-PCString_Non: db "Non.@"
-PCString_BoxFull: db "The BOX is full.@"
-PCString_PartyFull: db "The party's full!@"
-PCString_NoReleasingEGGS: db "No releasing EGGS!@"
-; e35aa
-
-Functione35aa: ; e35aa (38:75aa)
- call LoadStandardMenuDataHeader
- call Functione35e2
-.loop
- xor a
- ld [hBGMapMode], a
- call Functione36cf
- call Functione379c
- ld hl, Functione35aa_menudataheader
- call CopyMenuDataHeader
- xor a
- ld [wd0e4], a
- hlcoord 0, 4
- lb bc, 8, 9
- call TextBox
- call HandleScrollingMenu
- ld a, [wcf73]
- cp $2
- jr z, .done
- call Functione37af
- call Functione36f9
- jr .loop
-.done
- call WriteBackup
- ret
-
-Functione35e2: ; e35e2 (38:75e2)
- xor a
- ld [hBGMapMode], a
- hlcoord 0, 0
- ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
- ld a, " "
- call ByteFill
- ret
-; e35f1 (38:75f1)
-
-Functione35aa_menudataheader: ; 0xe35f1
- db $40 ; flags
- db 05, 01 ; start coords
- db 12, 09 ; end coords
- dw .menudata2
- db 1 ; default option
-; 0xe35f9
-
-.menudata2: ; 0xe35f9
- db $22 ; flags
- db 4, 0
- db 1
- dba .boxes
- dba .boxnames
- dba NULL
- dba Functione3632
-; e3609
-
-.boxes: ; e3609
- db NUM_BOXES
-x = 1
-rept NUM_BOXES
- db x
-x = x + 1
-endr
- db -1
-; e3619
-
-.boxnames: ; e3619
- push de
- ld a, [MenuSelection]
- dec a
- call GetBoxName
- pop hl
- call PlaceString
- ret
-; e3626
-
-GetBoxName: ; e3626 (38:7626)
- ld bc, BOX_NAME_LENGTH
- ld hl, wBoxNames
- call AddNTimes
- ld d, h
- ld e, l
- ret
-; e3632 (38:7632)
-
-Functione3632: ; e3632
- hlcoord 11, 7
- lb bc, 5, 7
- call TextBox
- ld a, [MenuSelection]
- cp -1
- ret z
- hlcoord 12, 9
- ld de, String_e3663
- call PlaceString
- call GetBoxCount
- ld [wd265], a
- hlcoord 13, 11
- ld de, wd265
- lb bc, 1, 2
- call PrintNum
- ld de, String_e3668
- call PlaceString
- ret
-; e3663
-
-String_e3663: ; e3663
- db "#MON@"
-; e3668
-
-String_e3668: ; e3668
- ; db "/20@"
- db "/"
- db "0" + MONS_PER_BOX / 10 ; "2"
- db "0" + MONS_PER_BOX % 10 ; "0"
- db "@"
-; e366c
-
-GetBoxCount: ; e366c (38:766c)
- ld a, [wCurBox]
- ld c, a
- ld a, [MenuSelection]
- dec a
- cp c
- jr z, .activebox
- ld c, a
- ld b, 0
- ld hl, .boxbanks
-rept 3
- add hl, bc
-endr
- ld a, [hli]
- ld b, a
- call GetSRAMBank
- ld a, [hli]
- ld h, [hl]
- ld l, a
- ld a, [hl]
- call CloseSRAM
- ld c, a
- ld a, [wSavedAtLeastOnce]
- and a
- jr z, .newfile
- ld a, c
- ret
-
-.newfile
- xor a
- ret
-
-.activebox
- ld a, BANK(sBoxCount)
- ld b, a
- call GetSRAMBank
- ld hl, sBoxCount
- ld a, [hl]
- call CloseSRAM
- ret
-; e36a5 (38:76a5)
-
-.boxbanks: ; e36a5
- dba sBox1
- dba sBox2
- dba sBox3
- dba sBox4
- dba sBox5
- dba sBox6
- dba sBox7
- dba sBox8
- dba sBox9
- dba sBox10
- dba sBox11
- dba sBox12
- dba sBox13
- dba sBox14
-; e36cf
-
-Functione36cf: ; e36cf (38:76cf)
- hlcoord 0, 0
- ld b, 2
- ld c, 18
- call TextBox
- hlcoord 1, 2
- ld de, String_e36f1
- call PlaceString
- ld a, [wCurBox]
- and $f
- call GetBoxName
- hlcoord 11, 2
- call PlaceString
- ret
-; e36f1 (38:76f1)
-
-String_e36f1: ; e36f1
- db "CURRENT@"
-; e36f9
-
-Functione36f9: ; e36f9 (38:76f9)
- ld hl, MenuDataHeader_0xe377b
- call LoadMenuDataHeader
- call InterpretMenu2
- call ExitMenu
- ret c
- ld a, [MenuSelection2]
- cp $1
- jr z, .asm_e3734
- cp $2
- jr z, .asm_e3745
- cp $3
- jr z, .asm_e3717
- and a
- ret
-
-.asm_e3717
- call GetBoxCount
- and a
- jr z, .asm_e372f
- ld e, l
- ld d, h
- ld a, [MenuSelection]
- dec a
- ld c, a
- callba Function844bc
- call Functione35e2
- and a
- ret
-
-.asm_e372f
- call Functione37be
- and a
- ret
-
-.asm_e3734
- ld a, [MenuSelection]
- dec a
- ld e, a
- ld a, [wCurBox]
- cp e
- ret z
- callba Function14a83
- ret
-
-.asm_e3745
- ld b, $4
- ld de, wd002
- callba NamingScreen
- call ClearTileMap
- call LoadStandardFont
- call LoadFontsBattleExtra
- ld a, [MenuSelection]
- dec a
- call GetBoxName
- ld e, l
- ld d, h
- ld hl, wd002
- ld c, $8
- call InitString
- ld a, [MenuSelection]
- dec a
- call GetBoxName
- ld de, wd002
- call CopyName2
- ret
-; e3778 (38:7778)
-
- hlcoord 11, 7 ; XXX
-
-MenuDataHeader_0xe377b: ; 0xe377b
- db $40 ; flags
- db 04, 11 ; start coords
- db 13, 19 ; end coords
- dw MenuData2_0xe3783
- db 1 ; default option
-; 0xe3783
-
-MenuData2_0xe3783: ; 0xe3783
- db $80 ; flags
- db 4 ; items
- db "SWITCH@"
- db "NAME@"
- db "PRINT@"
- db "QUIT@"
-; 0xe379c
-
-Functione379c: ; e379c (38:779c)
- ld de, String_e37a1
- jr Functione37e3
-; e37a1 (38:77a1)
-
-String_e37a1: ; e37a1
- db "Choose a BOX.@"
-; e37af
-
-Functione37af: ; e37af (38:77af)
- ld de, String_e37b4
- jr Functione37e3
-; e37b4 (38:77b4)
-
-String_e37b4: ; e37b4
- db "What's up?@"
-; e37be
-
-Functione37be: ; e37be (38:77be)
- ld de, String_e37d3
- call Functione37e3
- ld de, SFX_WRONG
- call WaitPlaySFX
- call WaitSFX
- ld c, 50
- call DelayFrames
- ret
-; e37d3 (38:77d3)
-
-String_e37d3: ; e37d3
- db "There's no #MON.@"
-; e37e3
-
-Functione37e3: ; e37e3 (38:77e3)
- push de
- hlcoord 0, 14
- lb bc, 2, 18
- call TextBox
- pop de
- hlcoord 1, 16
- call PlaceString
- ld a, $1
- ld [hBGMapMode], a
- ret
-
-
SECTION "bank39", ROMX, BANK[$39]
CopyrightGFX:: ; e4000
@@ -58697,7 +47606,7 @@
ld a, [hl]
push af
ld [hl], $1
- call WhiteBGMap
+ call ClearBGPalettes
hlcoord 0, 0
ld b, $10
ld c, $12
@@ -59279,7 +48188,7 @@
Functione4579: ; e4579
ld de, MUSIC_NONE
call PlayMusic
- call WhiteBGMap
+ call ClearBGPalettes
call ClearTileMap
ld a, VBGMap0 / $100
ld [hBGMapAddress + 1], a
@@ -59669,7 +48578,7 @@
call PlayMusic
.done
- call WhiteBGMap
+ call ClearBGPalettes
call ClearSprites
call ClearTileMap
xor a
@@ -60690,7 +49599,7 @@
IntroScene26: ; e50bb (39:50bb)
; Load the final scene.
- call WhiteBGMap
+ call ClearBGPalettes
call ClearSprites
call ClearTileMap
xor a
@@ -60779,7 +49688,7 @@
ret
.clear
- call WhiteBGMap
+ call ClearBGPalettes
ret
.done
@@ -62369,7 +51278,7 @@
xor a
ld [hMapAnims], a
call LowVolume
- call WhiteBGMap
+ call ClearBGPalettes
call ClearTileMap
call UpdateSprites
call ClearSprites
@@ -66036,7 +54945,7 @@
jp CloseSRAM
Function105153: ; 105153 (41:5153)
- call WhiteBGMap
+ call ClearBGPalettes
call DisableLCD
ld hl, MysteryGiftGFX
ld de, VTiles2 tile $00
@@ -66335,7 +55244,7 @@
ret
Function1057d7: ; 1057d7 (41:57d7)
- call WhiteBGMap
+ call ClearBGPalettes
call DisableLCD
ld hl, MysteryGiftJP_GFX
ld de, VTiles2 tile $00
@@ -67101,7 +56010,7 @@
; 1dc381
Function1dc381: ; 1dc381
- call WhiteBGMap
+ call ClearBGPalettes
call ClearTileMap
call ClearSprites
xor a
@@ -67201,7 +56110,7 @@
; 1dc47b
Function1dc47b: ; 1dc47b
- call WhiteBGMap
+ call ClearBGPalettes
call ClearTileMap
call ClearSprites
xor a
--- a/maps/BattleTowerBattleRoom.asm
+++ b/maps/BattleTowerBattleRoom.asm
@@ -31,7 +31,7 @@
keeptextopen
loadmovesprites
special BattleTowerBattle ; calls predef startbattle
- special FadeBlackBGMap
+ special FadeOutPalettes
reloadmap
if_not_equal $0, Script_FailedBattleTowerChallenge
copybytetovar wNrOfBeatenBattleTowerTrainers ; wcf64
@@ -46,10 +46,10 @@
closetext
loadmovesprites
playmusic MUSIC_HEAL
- special FadeBlackBGMap
+ special FadeOutPalettes
special LoadMapPalettes
pause 60
- special FadeInBGMap
+ special FadeInPalettes
special RestartMapMusic
loadfont
writetext Text_NextUpOpponentNo
@@ -73,7 +73,7 @@
special BattleTowerAction
playsound SFX_SAVE
waitbutton
- special FadeBlackBGMap
+ special FadeOutPalettes
special Reset
Script_DontSaveAndEndTheSession: ; 0x9f4a3
writetext Text_CancelYourBattleRoomChallenge
@@ -84,7 +84,7 @@
writebyte BATTLE_TOWER_ACTION_06
special BattleTowerAction
loadmovesprites
- special FadeBlackBGMap
+ special FadeOutPalettes
warpfacing UP, BATTLE_TOWER_1F, $7, $7
loadfont
jump UnknownScript_0x9e4b0
--- a/maps/BluesHouse.asm
+++ b/maps/BluesHouse.asm
@@ -30,10 +30,10 @@
writetext UnknownText_0x19b266
closetext
loadmovesprites
- special FadeBlackBGMap
+ special FadeOutPalettes
playmusic MUSIC_HEAL
pause 60
- special FadeInBGMap
+ special FadeInPalettes
special RestartMapMusic
loadfont
writetext UnknownText_0x19b296
--- a/maps/CeruleanGym.asm
+++ b/maps/CeruleanGym.asm
@@ -176,8 +176,8 @@
jump_step_up
db $38 ; movement
remove_fixed_facing
- accelerate_last
- accelerate_last
+ step_sleep_8
+ step_sleep_8
step_down
step_down
step_end
--- a/maps/Colosseum.asm
+++ b/maps/Colosseum.asm
@@ -49,7 +49,7 @@
MapColosseumSignpost1Script:
special Special_Colosseum
- newloadmap MAPSETUP_08
+ newloadmap MAPSETUP_LINKRETURN
end
ChrisScript_0x193499:
--- a/maps/EcruteakGym.asm
+++ b/maps/EcruteakGym.asm
@@ -84,7 +84,7 @@
follow PLAYER, $8
applymovement PLAYER, MovementData_0x99e5f
stopfollow
- special FadeBlackBGMap
+ special FadeOutPalettes
playsound SFX_ENTER_DOOR
waitbutton
warp ECRUTEAK_CITY, $6, $1b
--- a/maps/FastShip1F.asm
+++ b/maps/FastShip1F.asm
@@ -64,7 +64,7 @@
loadmovesprites
scall .LetThePlayerOut
playsound SFX_EXIT_BUILDING
- special FadeBlackBGMap
+ special FadeOutPalettes
waitbutton
setevent EVENT_VERMILION_PORT_SAILOR_AT_GANGWAY
domaptrigger VERMILION_PORT, $1
@@ -77,7 +77,7 @@
loadmovesprites
scall .LetThePlayerOut
playsound SFX_EXIT_BUILDING
- special FadeBlackBGMap
+ special FadeOutPalettes
waitbutton
setevent EVENT_OLIVINE_PORT_SAILOR_AT_GANGWAY
domaptrigger OLIVINE_PORT, $1
--- a/maps/GoldenrodMagnetTrainStation.asm
+++ b/maps/GoldenrodMagnetTrainStation.asm
@@ -35,7 +35,7 @@
writebyte $0
special Special_MagnetTrain
warpcheck
- newloadmap MAPSETUP_09
+ newloadmap MAPSETUP_TRAIN
applymovement PLAYER, .MovementBoardTheTrain
wait $14
end
--- a/maps/IlexForest.asm
+++ b/maps/IlexForest.asm
@@ -572,8 +572,8 @@
big_step_down
fix_facing
jump_step_up
- accelerate_last
- accelerate_last
+ step_sleep_8
+ step_sleep_8
remove_fixed_facing
big_step_up
big_step_up
@@ -664,8 +664,8 @@
big_step_left
fix_facing
jump_step_right
- accelerate_last
- accelerate_last
+ step_sleep_8
+ step_sleep_8
remove_fixed_facing
big_step_left
big_step_left
@@ -694,8 +694,8 @@
big_step_left
fix_facing
jump_step_right
- accelerate_last
- accelerate_last
+ step_sleep_8
+ step_sleep_8
remove_fixed_facing
big_step_right
big_step_right
--- a/maps/IndigoPlateauPokeCenter1F.asm
+++ b/maps/IndigoPlateauPokeCenter1F.asm
@@ -154,7 +154,7 @@
closetext
loadmovesprites
playsound SFX_WARP_TO
- special FadeBlackBGMap
+ special FadeOutPalettes
waitbutton
warp NEW_BARK_TOWN, $d, $6
end
--- a/maps/LancesRoom.asm
+++ b/maps/LancesRoom.asm
@@ -125,7 +125,7 @@
pause 30
loadmovesprites
applymovement $3, MovementData_0x180f5b
- special FadeBlackBGMap
+ special FadeOutPalettes
pause 15
warpfacing UP, HALL_OF_FAME, $4, $d
end
--- a/maps/MobileBattleRoom.asm
+++ b/maps/MobileBattleRoom.asm
@@ -35,11 +35,11 @@
writetext MobileBattleRoom_HealText
pause 20
loadmovesprites
- special FadeBlackBGMap
+ special FadeOutPalettes
playmusic MUSIC_HEAL
special LoadMapPalettes
pause 60
- special FadeInBGMap
+ special FadeInPalettes
special RestartMapMusic
refreshscreen $0
.two_:
--- a/maps/OlivineLighthouse6F.asm
+++ b/maps/OlivineLighthouse6F.asm
@@ -42,9 +42,9 @@
loadmovesprites
special RestartMapMusic
cry AMPHAROS
- special FadeBlackBGMap
+ special FadeOutPalettes
pause 10
- special FadeInBGMap
+ special FadeInPalettes
loadfont
writetext UnknownText_0x60f3d
closetext
@@ -116,10 +116,10 @@
cry AMPHAROS
closetext
loadmovesprites
- special FadeBlackBGMap
- special FadeInBGMap
- special FadeBlackBGMap
- special FadeInBGMap
+ special FadeOutPalettes
+ special FadeInPalettes
+ special FadeOutPalettes
+ special FadeInPalettes
end
ItemFragment_0x60c66:
@@ -131,8 +131,8 @@
slow_step_right
slow_step_up
slow_step_up
- accelerate_last
- accelerate_last
+ step_sleep_8
+ step_sleep_8
step_end
MovementData_0x60c70:
@@ -153,7 +153,7 @@
slow_step_up
slow_step_up
slow_step_up
- accelerate_last
+ step_sleep_8
step_end
UnknownText_0x60c81:
--- a/maps/OlivinePort.asm
+++ b/maps/OlivinePort.asm
@@ -39,7 +39,7 @@
waitbutton
applymovement PLAYER, MovementData_0x74a30
playsound SFX_EXIT_BUILDING
- special FadeBlackBGMap
+ special FadeOutPalettes
waitbutton
checkevent EVENT_FAST_SHIP_FIRST_TIME
iffalse UnknownScript_0x7490a
--- a/maps/Route35NationalParkgate.asm
+++ b/maps/Route35NationalParkgate.asm
@@ -75,7 +75,7 @@
loadmovesprites
scall Route35NationalParkgate_EnterContest
playsound SFX_ENTER_DOOR
- special FadeBlackBGMap
+ special FadeOutPalettes
waitbutton
warpfacing UP, NATIONAL_PARK_BUG_CONTEST, $a, $2f
end
@@ -112,7 +112,7 @@
special Special_GiveParkBalls
scall Route35NationalParkgate_EnterContest
playsound SFX_ENTER_DOOR
- special FadeBlackBGMap
+ special FadeOutPalettes
waitbutton
special Special_SelectRandomBugContestContestants
warpfacing UP, NATIONAL_PARK_BUG_CONTEST, $a, $2f
--- a/maps/Route36NationalParkgate.asm
+++ b/maps/Route36NationalParkgate.asm
@@ -83,7 +83,7 @@
loadmovesprites
spriteface PLAYER, LEFT
playsound SFX_EXIT_BUILDING
- special FadeBlackBGMap
+ special FadeOutPalettes
waitbutton
warpfacing LEFT, NATIONAL_PARK_BUG_CONTEST, $21, $12
end
@@ -166,7 +166,7 @@
special Special_GiveParkBalls
spriteface PLAYER, LEFT
playsound SFX_EXIT_BUILDING
- special FadeBlackBGMap
+ special FadeOutPalettes
waitbutton
special Special_SelectRandomBugContestContestants
warpfacing LEFT, NATIONAL_PARK_BUG_CONTEST, $21, $12
--- a/maps/SaffronTrainStation.asm
+++ b/maps/SaffronTrainStation.asm
@@ -35,7 +35,7 @@
writebyte $1
special Special_MagnetTrain
warpcheck
- newloadmap MAPSETUP_09
+ newloadmap MAPSETUP_TRAIN
applymovement PLAYER, .MovementBoardTheTrain
wait $14
end
--- a/maps/SlowpokeWellB1F.asm
+++ b/maps/SlowpokeWellB1F.asm
@@ -56,7 +56,7 @@
clearevent EVENT_AZALEA_TOWN_SLOWPOKES
clearevent EVENT_KURTS_HOUSE_SLOWPOKE
clearevent EVENT_KURTS_HOUSE_KURT_1
- special FadeBlackBGMap
+ special FadeOutPalettes
special HealParty
pause 15
warp KURTS_HOUSE, $3, $3
@@ -121,15 +121,15 @@
step_left
step_left
step_up
- accelerate_last
- accelerate_last
- accelerate_last
+ step_sleep_8
+ step_sleep_8
+ step_sleep_8
step_left
step_up
step_up
- accelerate_last
- accelerate_last
- accelerate_last
+ step_sleep_8
+ step_sleep_8
+ step_sleep_8
turn_head_left
step_end
--- a/maps/TeamRocketBaseB1F.asm
+++ b/maps/TeamRocketBaseB1F.asm
@@ -445,9 +445,9 @@
end
VoltorbExplodingTrap:
- special FadeBlackBGMap
+ special FadeOutPalettes
cry VOLTORB
- special FadeInBGMap
+ special FadeInPalettes
setlasttalked $ff
writecode VAR_BATTLETYPE, BATTLETYPE_TRAP
loadpokedata VOLTORB, 23
@@ -455,9 +455,9 @@
end
GeodudeExplodingTrap:
- special FadeBlackBGMap
+ special FadeOutPalettes
cry GEODUDE
- special FadeInBGMap
+ special FadeInPalettes
setlasttalked $ff
writecode VAR_BATTLETYPE, BATTLETYPE_TRAP
loadpokedata GEODUDE, 21
@@ -465,9 +465,9 @@
end
KoffingExplodingTrap:
- special FadeBlackBGMap
+ special FadeOutPalettes
cry KOFFING
- special FadeInBGMap
+ special FadeInPalettes
setlasttalked $ff
writecode VAR_BATTLETYPE, BATTLETYPE_TRAP
loadpokedata KOFFING, 21
--- a/maps/TeamRocketBaseB2F.asm
+++ b/maps/TeamRocketBaseB2F.asm
@@ -155,11 +155,11 @@
writetext UnknownText_0x6da97
closetext
loadmovesprites
- special FadeBlackBGMap
+ special FadeOutPalettes
special Mobile_HealParty
playsound SFX_FULL_HEAL
special HealParty
- special FadeInBGMap
+ special FadeInPalettes
loadfont
writetext UnknownText_0x6daf7
closetext
@@ -449,17 +449,17 @@
step_end
MovementData_0x6d258:
- accelerate_last
+ step_sleep_8
step_left
step_left
turn_head_up
- accelerate_last
+ step_sleep_8
step_right
step_right
step_right
step_right
turn_head_up
- accelerate_last
+ step_sleep_8
step_left
step_left
turn_head_down
--- a/maps/TeamRocketBaseB3F.asm
+++ b/maps/TeamRocketBaseB3F.asm
@@ -254,8 +254,8 @@
fix_facing
fast_jump_step_left
remove_fixed_facing
- accelerate_last
- accelerate_last
+ step_sleep_8
+ step_sleep_8
slow_step_right
big_step_down
big_step_down
--- a/maps/TimeCapsule.asm
+++ b/maps/TimeCapsule.asm
@@ -39,7 +39,7 @@
MapTimeCapsuleSignpost1Script:
special Special_TimeCapsule
- newloadmap MAPSETUP_08
+ newloadmap MAPSETUP_LINKRETURN
end
ChrisScript_0x19351a:
--- a/maps/TradeCenter.asm
+++ b/maps/TradeCenter.asm
@@ -39,7 +39,7 @@
MapTradeCenterSignpost1Script:
special Special_TradeCenter
- newloadmap MAPSETUP_08
+ newloadmap MAPSETUP_LINKRETURN
end
ChrisScript_0x19340b:
--- a/maps/VermilionPort.asm
+++ b/maps/VermilionPort.asm
@@ -51,7 +51,7 @@
waitbutton
applymovement PLAYER, MovementData_0x74ef1
playsound SFX_EXIT_BUILDING
- special FadeBlackBGMap
+ special FadeOutPalettes
waitbutton
setevent EVENT_FAST_SHIP_PASSENGERS_EASTBOUND
clearevent EVENT_FAST_SHIP_PASSENGERS_WESTBOUND
--- a/maps/WarehouseEntrance.asm
+++ b/maps/WarehouseEntrance.asm
@@ -226,10 +226,10 @@
writetext UnknownText_0x7c6b8
closetext
loadmovesprites
- special FadeBlackBGMap
+ special FadeOutPalettes
playmusic MUSIC_HEAL
pause 60
- special FadeInBGMap
+ special FadeInPalettes
special RestartMapMusic
loadfont
writetext UnknownText_0x7c6d8
@@ -309,10 +309,10 @@
writetext UnknownText_0x7c80e
closetext
loadmovesprites
- special FadeBlackBGMap
+ special FadeOutPalettes
playmusic MUSIC_HEAL
pause 60
- special FadeInBGMap
+ special FadeInPalettes
special RestartMapMusic
loadfont
writetext UnknownText_0x7c82a
--- a/misc/battle_tower_47.asm
+++ b/misc/battle_tower_47.asm
@@ -371,7 +371,7 @@
ld a, [MenuSelection2]
dec a
call Function11c254
- call WhiteBGMap
+ call ClearBGPalettes
call ClearSprites
call ClearScreen
call Function11d323
--- a/misc/mobile_22.asm
+++ b/misc/mobile_22.asm
@@ -1801,7 +1801,7 @@
; 89b14
Function89b14: ; 89b14
- call WhiteBGMap
+ call ClearBGPalettes
call Function89b07
call Function89b00
ret
@@ -1814,7 +1814,7 @@
Function89b28: ; 89b28 (22:5b28)
call Function891de
- call WhiteBGMap
+ call ClearBGPalettes
call Function893e2
call Call_ExitMenu
call Function891ab
@@ -2414,7 +2414,7 @@
jp Function89e36
Function89ee1: ; 89ee1 (22:5ee1)
- call WhiteBGMap
+ call ClearBGPalettes
call Function893e2
call Function8923c
callba Function4a3a7
@@ -2602,7 +2602,7 @@
Function89ff6: ; 89ff6 (22:5ff6)
call Function891fe
- call WhiteBGMap
+ call ClearBGPalettes
call Function893cc
call Function89807
call Function89492
@@ -2937,7 +2937,7 @@
ret
.asm_8a254
call Function891de
- call WhiteBGMap
+ call ClearBGPalettes
call Call_ExitMenu
call Function891de
and a
@@ -2944,7 +2944,7 @@
ret
Function8a262: ; 8a262 (22:6262)
- call WhiteBGMap
+ call ClearBGPalettes
call Function893e2
call Function8923c
callba Function4a3a7
@@ -3501,7 +3501,7 @@
Function8a679: ; 8a679 (22:6679)
call Function891de
- call WhiteBGMap
+ call ClearBGPalettes
call Function893cc
call OpenSRAMBank4
call Function8931b
@@ -3546,7 +3546,7 @@
Function8a6cd: ; 8a6cd (22:66cd)
call Function891de
- call WhiteBGMap
+ call ClearBGPalettes
call Function893cc
call OpenSRAMBank4
call Function8931b
@@ -3594,7 +3594,7 @@
.asm_8a73f
call CloseSRAM
.asm_8a742
- call WhiteBGMap
+ call ClearBGPalettes
call Function89448
call Function891d3
call Function8b677
@@ -3657,7 +3657,7 @@
call DelayFrame
call JoyTextDelay
call Function891de
- call WhiteBGMap
+ call ClearBGPalettes
call Function893cc
call OpenSRAMBank4
pop bc
@@ -3687,7 +3687,7 @@
pop af
ld [MenuSelection], a
call Function891de
- call WhiteBGMap
+ call ClearBGPalettes
call Function893cc
call OpenSRAMBank4
call Function8931b
@@ -3781,7 +3781,7 @@
Function8a8c3: ; 8a8c3 (22:68c3)
call Function891de
- call WhiteBGMap
+ call ClearBGPalettes
call Function893cc
call OpenSRAMBank4
call Function8931b
@@ -3969,7 +3969,7 @@
call Function89381
call CloseSRAM
call Function891fe
- call WhiteBGMap
+ call ClearBGPalettes
call Function893cc
call Function89807
call Function89492
@@ -4027,7 +4027,7 @@
call Function89193
.asm_8aa9d
call Function891fe
- call WhiteBGMap
+ call ClearBGPalettes
call Function893cc
call Function89807
call Function89492
@@ -4101,7 +4101,7 @@
Function8ab3b: ; 8ab3b (22:6b3b)
call Function891fe
- call WhiteBGMap
+ call ClearBGPalettes
call Function893cc
call Function89807
call Function89492
@@ -4140,7 +4140,7 @@
ret
Function8ab93: ; 8ab93 (22:6b93)
- call WhiteBGMap
+ call ClearBGPalettes
call LoadStandardMenuDataHeader
callba Function105688
call ClearSprites
@@ -4183,7 +4183,7 @@
call PlayClickSFX
.asm_8abe5
call Function891de
- call WhiteBGMap
+ call ClearBGPalettes
call Function893cc
call OpenSRAMBank4
call Function8931b
@@ -4228,7 +4228,7 @@
ld [MenuSelection], a
push de
call Function891de
- call WhiteBGMap
+ call ClearBGPalettes
call Function893cc
pop bc
call Function89844
@@ -4337,7 +4337,7 @@
ld a, [MenuSelection]
ld [wd02f], a
call Function891de
- call WhiteBGMap
+ call ClearBGPalettes
call Function893cc
call OpenSRAMBank4
call Function8931b
--- a/misc/mobile_22_2.asm
+++ b/misc/mobile_22_2.asm
@@ -574,7 +574,7 @@
ret
Function8b677: ; 8b677
- call WhiteBGMap
+ call ClearBGPalettes
call DisableLCD
call Function8b690
call Function8b6bb
--- a/misc/mobile_40.asm
+++ b/misc/mobile_40.asm
@@ -48,7 +48,7 @@
Function100057: ; 100057
call Function1000a4
- call Function222a
+ call ReturnToMapFromSubmenu
ld hl, VramState
res 1, [hl]
ret
@@ -74,7 +74,7 @@
Function100082: ; 100082
xor a
ld hl, OverworldMap
- ld bc, 1300
+ ld bc, OverworldMapEnd - OverworldMap
call ByteFill
di
call DoubleSpeed
@@ -312,7 +312,7 @@
Function10020b: ; 10020b
xor a
ld [wc303], a
- callba FadeBlackBGMap
+ callba FadeOutPalettes
callba Function106464
call HideSprites
call DelayFrame
@@ -412,7 +412,7 @@
; 1002dc
Function1002dc: ; 1002dc
- ld a, MAPSETUP_08
+ ld a, MAPSETUP_LINKRETURN
ld [hMapEntryMethod], a
callba RunMapSetupScript
xor a
@@ -3048,7 +3048,7 @@
; 1013aa
Function1013aa: ; 1013aa
- call WhiteBGMap
+ call ClearBGPalettes
call Call_ExitMenu
call Function2bae
callba Function106464
--- a/misc/mobile_41.asm
+++ b/misc/mobile_41.asm
@@ -951,7 +951,7 @@
call Function3e32
xor a
ld [hMobile], a
- ld [$ffc9], a
+ ld [hFFC9], a
ld a, [wcd25]
inc a
ld [wcd25], a
--- a/misc/mobile_42.asm
+++ b/misc/mobile_42.asm
@@ -125,7 +125,7 @@
Function1080b7: ; 1080b7
xor a
ld [wJumptableIndex], a
- call WhiteBGMap
+ call ClearBGPalettes
call ClearSprites
call ClearTileMap
call DisableLCD
@@ -188,7 +188,7 @@
Function108157: ; 108157
xor a
ld [wJumptableIndex], a
- call WhiteBGMap
+ call ClearBGPalettes
call ClearSprites
call ClearTileMap
call DisableLCD
@@ -508,7 +508,7 @@
; 10839b
Function10839b: ; 10839b
- call WhiteBGMap
+ call ClearBGPalettes
call ClearSprites
call ClearTileMap
call DisableLCD
@@ -643,7 +643,7 @@
; 1084d7
Function1084d7: ; 1084d7
- call WhiteBGMap
+ call ClearBGPalettes
call ClearSprites
call ClearTileMap
call DisableLCD
@@ -712,7 +712,7 @@
; 108589
Function108589: ; 108589
- call WhiteBGMap
+ call ClearBGPalettes
call ClearSprites
call ClearTileMap
call DisableLCD
@@ -781,7 +781,7 @@
Function108638: ; 108638
callba Function8d03d
- call WhiteBGMap
+ call ClearBGPalettes
call ClearSprites
call ClearTileMap
xor a
@@ -817,7 +817,7 @@
Function108689: ; 108689
callba Function8d03d
- call WhiteBGMap
+ call ClearBGPalettes
call ClearSprites
call ClearTileMap
xor a
@@ -862,7 +862,7 @@
; 1086f4
Function1086f4: ; 1086f4
- call WhiteBGMap
+ call ClearBGPalettes
call ClearSprites
call ClearTileMap
xor a
@@ -1162,7 +1162,7 @@
ld c, $28
call Function1082cc
callba Function8d03d
- call WhiteBGMap
+ call ClearBGPalettes
call ClearSprites
call ClearTileMap
call DisableLCD
--- a/misc/mobile_45.asm
+++ b/misc/mobile_45.asm
@@ -7708,7 +7708,7 @@
ld hl, wc708
ld bc, $11
call ByteFill
- call WhiteBGMap
+ call ClearBGPalettes
call ClearSprites
callba Function171c87
callba Function104061
@@ -7726,7 +7726,7 @@
jr Function1176ee
.asm_117709
callba Function8cf53
- call WhiteBGMap
+ call ClearBGPalettes
call ClearScreen
call ClearSprites
ret
@@ -8172,7 +8172,7 @@
ld [wcf64], a
ld [wcf65], a
ld [wcf66], a
- call WhiteBGMap
+ call ClearBGPalettes
call ClearSprites
callba Function172e78
callba Function104000
@@ -8180,7 +8180,7 @@
; 0x117ab4
Function117ab4: ; 0x117ab4
- call WhiteBGMap
+ call ClearBGPalettes
call ClearSprites
callba Function172e78
callba Function172eb9
@@ -8197,7 +8197,7 @@
callba Function104000
jr Function117acd
.asm_117ae2
- call WhiteBGMap
+ call ClearBGPalettes
call ClearSprites
ret
--- a/misc/mobile_46.asm
+++ b/misc/mobile_46.asm
@@ -43,7 +43,7 @@
pop af
ld [rSVBK], a
call Function118452
- call Function222a
+ call ReturnToMapFromSubmenu
Function11805e: ; 11805e (46:405e)
ret
; 11805f
@@ -84,7 +84,7 @@
pop af
ld [rSVBK], a
call Function118452
- call Function222a
+ call ReturnToMapFromSubmenu
ret
; 1180b8
@@ -130,7 +130,7 @@
pop af
ld [rSVBK], a
call Function118452
- call Function222a
+ call ReturnToMapFromSubmenu
ret
; 11811a
@@ -180,7 +180,7 @@
ld [rSVBK], a
call Function118452
call Function118180
- call Function222a
+ call ReturnToMapFromSubmenu
ret
; 118180
@@ -262,7 +262,7 @@
pop af
ld [rSVBK], a
call Function118452
- call Function222a
+ call ReturnToMapFromSubmenu
ret
; 118233
@@ -374,7 +374,7 @@
pop af
ld [rSVBK], a
call Function118452
- call Function222a
+ call ReturnToMapFromSubmenu
ret
; 118329
@@ -482,7 +482,7 @@
ld a, $f
ld [rIE], a
ld a, $1
- ld [$ffc9], a
+ ld [hFFC9], a
ld [hMobile], a
ei
callba Function106462
@@ -512,7 +512,7 @@
Function118452: ; 118452
di
xor a
- ld [$ffc9], a
+ ld [hFFC9], a
ld [hMobile], a
ld [hVBlank], a
call NormalSpeed
@@ -5682,7 +5682,7 @@
; 11a9ce
Function11a9ce: ; 11a9ce
- call WhiteBGMap
+ call ClearBGPalettes
call Function2bae
call Call_ExitMenu
callba Function106462
@@ -5950,7 +5950,7 @@
; 11ad1b
Function11ad1b: ; 11ad1b
- call WhiteBGMap
+ call ClearBGPalettes
call ClearSprites
call ClearTileMap
callba Function17c000
--- a/misc/mobile_5b.asm
+++ b/misc/mobile_5b.asm
@@ -140,7 +140,7 @@
; 16c0ec
Function16c0ec: ; 16c0ec
- call WhiteBGMap
+ call ClearBGPalettes
call ClearScreen
push af
ld a, $ff
@@ -885,7 +885,7 @@
Function16d43b: ; 16d43b
call LoadStandardMenuDataHeader
- call WhiteBGMap
+ call ClearBGPalettes
call ClearTileMap
call ClearSprites
callba Function16d421
--- a/misc/mobile_5c.asm
+++ b/misc/mobile_5c.asm
@@ -283,7 +283,7 @@
; 1704f1
Function1704f1: ; 1704f1
- call WhiteBGMap
+ call ClearBGPalettes
call ClearSprites
call ClearScreen
.asm_1704fa
@@ -1590,7 +1590,7 @@
ld [wcd4a], a
dec a
ld [wcd4b], a
- call WhiteBGMap
+ call ClearBGPalettes
call ClearSprites
callba Function171d2b
callba Function104061
@@ -1883,7 +1883,7 @@
dec [hl]
ret nz
call ExitMenu
- call WhiteBGMap
+ call ClearBGPalettes
jr asm_171c60
Function171c39: ; 171c39 (5c:5c39)
@@ -1895,7 +1895,7 @@
ld hl, wcd4c
dec [hl]
ret nz
- call WhiteBGMap
+ call ClearBGPalettes
callba Function106462
callba Function106464
ld a, $2
--- a/misc/mobile_5f.asm
+++ b/misc/mobile_5f.asm
@@ -561,7 +561,7 @@
ld a, d
ld [MusicFadeIDHi], a
call PlayMusic
- call Function222a
+ call ReturnToMapFromSubmenu
call Function2b3c
ret
; 17d314
@@ -626,7 +626,7 @@
ld [wcd79], a
dec a
ld [wcd6c], a
- call WhiteBGMap
+ call ClearBGPalettes
call ClearSprites
call ClearScreen
callba Function104061
@@ -672,7 +672,7 @@
; 17d3f6
Function17d3f6: ; 17d3f6
- call WhiteBGMap
+ call ClearBGPalettes
call ClearSprites
call ClearScreen
callba Function104061
@@ -1245,7 +1245,7 @@
call CloseSRAM
xor a
ld [wcd77], a
- call WhiteBGMap
+ call ClearBGPalettes
ret
; 17d7b4
--- a/misc/unused_title.asm
+++ b/misc/unused_title.asm
@@ -3,7 +3,7 @@
UnusedTitleScreen: ; 10c000
- call WhiteBGMap
+ call ClearBGPalettes
call ClearTileMap
call DisableLCD
xor a
--- a/wram.asm
+++ b/wram.asm
@@ -321,10 +321,10 @@
wc2de:: ds 1
wc2df:: ds 3
wMovementPerson:: ds 1
-wMovementDataPointer:: ds 3
+wMovementDataPointer:: ds 3 ; dba
wc2e6:: ds 4
wc2ea:: ds 1
-wMovementPointer:: ds 2
+wMovementPointer:: ds 2 ; c2eb
ds 3
wc2f0:: ds 1
wc2f1:: ds 1
@@ -334,7 +334,8 @@
wc2f5:: ds 1
wc2f6:: ds 1
wc2f7:: ds 1
-wc2f8:: ds 2
+wc2f8:: ds 1
+ ds 1
TileDown:: ; c2fa
ds 1
@@ -1478,6 +1479,10 @@
wd016:: ds 1
wMartItem8BCD::
wd017:: ds 1
+
+wd018_Mon:: party_struct wd018_Mon
+ ds wd018_Mon - @
+
wd018:: ds 1
wd019:: ds 1
wMartItem9BCD::
@@ -1506,6 +1511,7 @@
CurInput::
EngineBuffer1:: ; d03e
ds 1
+
wd03f::
wJumpStdScriptBuffer::
CurFruit:: ; d03f
@@ -2153,7 +2159,7 @@
\1Palette:: ds 1
\1Walking:: ds 1
\1Direction:: ds 1
- ds 1
+\1Object09:: ds 1
\1StepDuration:: ds 1
\1Action:: ds 1
\1Object12:: ds 1