pokecrystal-board/mobile/mobile_46.asm

7703 lines
115 KiB
NASM
Raw Normal View History

2018-06-24 07:09:41 -07:00
Function118000:
2015-11-04 04:35:41 -08:00
ld a, $1
ld [wcd38], a
jr asm_11800b
2018-06-24 07:09:41 -07:00
Function118007:
2015-11-04 04:35:41 -08:00
xor a
ld [wcd38], a
2018-10-24 12:33:18 -07:00
asm_11800b:
call BattleTowerRoomMenu_InitRAM
2015-11-04 04:35:41 -08:00
ld a, $18
ld [wcd33], a
ld a, $19
ld [wcd34], a
ld a, $4
ld [wc3f0], a
ldh a, [rSVBK]
2015-11-04 04:35:41 -08:00
push af
ld a, $3
ldh [rSVBK], a
2015-12-25 20:34:33 -08:00
.loop
2015-11-04 04:35:41 -08:00
call JoyTextDelay
call Function118473
ld a, [wBattleTowerRoomMenuJumptableIndex]
2015-11-04 04:35:41 -08:00
cp $1b
2015-12-25 20:34:33 -08:00
jr c, .skip
2015-11-04 04:35:41 -08:00
ld a, [wcd34]
ld [wBattleTowerRoomMenuJumptableIndex], a
2015-11-04 04:35:41 -08:00
2015-12-25 20:34:33 -08:00
.skip
2015-11-04 04:35:41 -08:00
call Function1184a5
call BattleTowerRoomMenu_WriteMessage
2017-12-24 09:47:30 -08:00
farcall Function115dd3
farcall Function11619d
2015-11-04 04:35:41 -08:00
call DelayFrame
ld a, [wBattleTowerRoomMenuJumptableIndex]
2015-11-04 04:35:41 -08:00
ld hl, wcd33
cp [hl]
2015-12-25 20:34:33 -08:00
jr nz, .loop
2015-11-04 04:35:41 -08:00
pop af
ldh [rSVBK], a
call BattleTowerRoomMenu_Cleanup
2015-11-11 20:38:57 -08:00
call ReturnToMapFromSubmenu
2018-06-24 07:09:41 -07:00
BattleTowerRoomMenu_DoNothing:
2015-11-04 04:35:41 -08:00
ret
2018-06-24 07:09:41 -07:00
Function11805f:
2015-11-04 04:35:41 -08:00
ld a, $1
ld [wcd38], a
call BattleTowerRoomMenu_InitRAM
2015-11-04 04:35:41 -08:00
ld a, $18
ld [wcd33], a
ld a, $19
ld [wcd34], a
ld a, $4
ld [wc3f0], a
ldh a, [rSVBK]
2015-11-04 04:35:41 -08:00
push af
ld a, $3
ldh [rSVBK], a
2015-11-04 04:35:41 -08:00
.asm_11807d
call JoyTextDelay
call Function118473
ld a, [wBattleTowerRoomMenuJumptableIndex]
2015-11-04 04:35:41 -08:00
cp $1b
jr c, .asm_118090
ld a, [wcd34]
ld [wBattleTowerRoomMenuJumptableIndex], a
2015-11-04 04:35:41 -08:00
.asm_118090
call Function11857c
call BattleTowerRoomMenu_WriteMessage
2017-12-24 09:47:30 -08:00
farcall Function115dd3
farcall Function11619d
2015-11-04 04:35:41 -08:00
call DelayFrame
ld a, [wBattleTowerRoomMenuJumptableIndex]
2015-11-04 04:35:41 -08:00
ld hl, wcd33
cp [hl]
jr nz, .asm_11807d
pop af
ldh [rSVBK], a
call BattleTowerRoomMenu_Cleanup
2015-11-11 20:38:57 -08:00
call ReturnToMapFromSubmenu
2015-11-04 04:35:41 -08:00
ret
2018-06-24 07:09:41 -07:00
Function1180b8:
call BattleTowerRoomMenu_InitRAM
2015-11-04 04:35:41 -08:00
ld a, $22
ld [wcd33], a
ld a, $23
ld [wcd34], a
ld a, $4
ld [wc3f0], a
ldh a, [rSVBK]
2015-11-04 04:35:41 -08:00
push af
ld a, $3
ldh [rSVBK], a
2015-11-04 04:35:41 -08:00
.asm_1180d1
call JoyTextDelay
call Function118473
ld a, [wBattleTowerRoomMenuJumptableIndex]
2015-11-04 04:35:41 -08:00
cp $28
jr c, .asm_1180e4
ld a, [wcd34]
ld [wBattleTowerRoomMenuJumptableIndex], a
2015-11-04 04:35:41 -08:00
.asm_1180e4
ld a, [wBattleTowerRoomMenuJumptableIndex]
2015-11-04 04:35:41 -08:00
cp $10
jr c, .asm_1180f2
cp $16
jr nc, .asm_1180f2
call Function11884c
.asm_1180f2
call Function1184ec
call BattleTowerRoomMenu_WriteMessage
2017-12-24 09:47:30 -08:00
farcall Function115dd3
farcall Function11619d
2015-11-04 04:35:41 -08:00
call DelayFrame
ld a, [wBattleTowerRoomMenuJumptableIndex]
2015-11-04 04:35:41 -08:00
ld hl, wcd33
cp [hl]
jr nz, .asm_1180d1
pop af
ldh [rSVBK], a
call BattleTowerRoomMenu_Cleanup
2015-11-11 20:38:57 -08:00
call ReturnToMapFromSubmenu
2015-11-04 04:35:41 -08:00
ret
2018-06-24 07:09:41 -07:00
Function11811a:
2015-11-04 04:35:41 -08:00
ld a, 1
ld [wcd38], a
jr Function118125
2018-06-24 07:09:41 -07:00
_BattleTowerRoomMenu:
2015-11-04 04:35:41 -08:00
xor a
ld [wcd38], a
2018-06-24 07:09:41 -07:00
Function118125:
call BattleTowerRoomMenu_InitRAM
2015-11-04 04:35:41 -08:00
ld a, $3
ld [wcd33], a
ld a, $d
ld [wcd34], a
ld a, $4
ld [wc3f0], a
ldh a, [rSVBK]
2015-11-04 04:35:41 -08:00
push af
ld a, $3
ldh [rSVBK], a
2015-12-28 14:09:53 -08:00
.loop
2015-11-04 04:35:41 -08:00
call JoyTextDelay
call Function118473
ld a, [wBattleTowerRoomMenuJumptableIndex]
2015-11-04 04:35:41 -08:00
cp $f
2015-12-28 14:09:53 -08:00
jr c, .skip
2015-11-04 04:35:41 -08:00
ld a, [wcd34]
ld [wBattleTowerRoomMenuJumptableIndex], a
2015-12-28 14:09:53 -08:00
.skip
call BattleTowerRoomMenu_Jumptable
call BattleTowerRoomMenu_WriteMessage
2017-12-24 09:47:30 -08:00
farcall Function115dd3
farcall Function11619d
2015-11-04 04:35:41 -08:00
call DelayFrame
ld a, [wBattleTowerRoomMenuJumptableIndex]
2015-11-04 04:35:41 -08:00
ld hl, wcd33
cp [hl]
2015-12-28 14:09:53 -08:00
jr nz, .loop
2015-11-04 04:35:41 -08:00
xor a
ld [w3_d000], a
2015-11-04 04:35:41 -08:00
pop af
ldh [rSVBK], a
call BattleTowerRoomMenu_Cleanup
2015-11-04 04:35:41 -08:00
call Function118180
2015-11-11 20:38:57 -08:00
call ReturnToMapFromSubmenu
2015-11-04 04:35:41 -08:00
ret
2018-06-24 07:09:41 -07:00
Function118180:
2018-01-23 14:39:09 -08:00
ld a, [wScriptVar]
2015-11-04 04:35:41 -08:00
and a
ret nz
ld a, [wcd38]
and a
ret z
2020-02-28 08:51:42 -08:00
ld a, BANK(s5_a89c) ; aka BANK(s5_a8b2)
call OpenSRAM
2015-11-04 04:35:41 -08:00
ld hl, wcd69
ld de, s5_a89c
ld bc, 22
2015-11-04 04:35:41 -08:00
call CopyBytes
ldh a, [rSVBK]
2015-11-04 04:35:41 -08:00
push af
ld a, BANK(w3_d202)
ldh [rSVBK], a
ld de, w3_d202
2015-11-04 04:35:41 -08:00
ld c, $96
2017-12-24 09:47:30 -08:00
farcall CheckStringForErrors_IgnoreTerminator
jr c, .return_d3
ld de, w3_d202
lb bc, 1, $96
2017-12-24 09:47:30 -08:00
farcall CheckStringContainsLessThanBNextCharacters
jr c, .return_d3
ld hl, w3_d202
ld de, s5_a8b2
ld bc, 150
2015-11-04 04:35:41 -08:00
call CopyBytes
.reset_banks
2015-11-04 04:35:41 -08:00
pop af
ldh [rSVBK], a
2015-11-04 04:35:41 -08:00
call CloseSRAM
ret
.return_d3
2015-11-04 04:35:41 -08:00
ld a, $d3
ld [wMobileErrorCodeBuffer], a
2018-01-23 14:39:09 -08:00
ld [wScriptVar], a
jr .reset_banks
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
Function1181da:
call BattleTowerRoomMenu_InitRAM
2015-11-04 04:35:41 -08:00
ld a, $2
ld [wcd38], a
ld a, $21
ld [wcd33], a
ld a, $22
ld [wcd34], a
ld a, $4
ld [wc3f0], a
ldh a, [rSVBK]
2015-11-04 04:35:41 -08:00
push af
ld a, $3
ldh [rSVBK], a
2015-11-04 04:35:41 -08:00
.asm_1181f8
call JoyTextDelay
call Function118473
ld a, [wBattleTowerRoomMenuJumptableIndex]
2015-11-04 04:35:41 -08:00
cp $28
jr c, .asm_11820b
ld a, [wcd34]
ld [wBattleTowerRoomMenuJumptableIndex], a
2015-11-04 04:35:41 -08:00
.asm_11820b
call Function1185c3
call BattleTowerRoomMenu_WriteMessage
2017-12-24 09:47:30 -08:00
farcall Function115dd3
farcall Function11619d
2015-11-04 04:35:41 -08:00
call DelayFrame
ld a, [wBattleTowerRoomMenuJumptableIndex]
2015-11-04 04:35:41 -08:00
ld hl, wcd33
cp [hl]
jr nz, .asm_1181f8
pop af
ldh [rSVBK], a
call BattleTowerRoomMenu_Cleanup
2015-11-11 20:38:57 -08:00
call ReturnToMapFromSubmenu
2015-11-04 04:35:41 -08:00
ret
2018-06-24 07:09:41 -07:00
Function118233:
call BattleTowerRoomMenu_InitRAM
2015-11-04 04:35:41 -08:00
ld a, $1b
ld [wcd33], a
ld a, $1c
ld [wcd34], a
ld a, $6
ld [wc3f0], a
ldh a, [rSVBK]
2015-11-04 04:35:41 -08:00
push af
ld a, $3
ldh [rSVBK], a
2015-11-04 04:35:41 -08:00
.asm_11824c
call JoyTextDelay
call Function118473
ld a, [wBattleTowerRoomMenuJumptableIndex]
2015-11-04 04:35:41 -08:00
cp $1e
jr c, .asm_11825f
ld a, [wcd34]
ld [wBattleTowerRoomMenuJumptableIndex], a
2015-11-04 04:35:41 -08:00
.asm_11825f
call Function118624
call BattleTowerRoomMenu_WriteMessage
2017-12-24 09:47:30 -08:00
farcall Function115dd3
farcall Function11619d
2015-11-04 04:35:41 -08:00
call DelayFrame
ld a, [wBattleTowerRoomMenuJumptableIndex]
2015-11-04 04:35:41 -08:00
ld hl, wcd33
cp [hl]
jr nz, .asm_11824c
pop af
ldh [rSVBK], a
call BattleTowerRoomMenu_Cleanup
2015-11-04 04:35:41 -08:00
ret
2018-06-24 07:09:41 -07:00
Function118284:
call BattleTowerRoomMenu_InitRAM
2015-11-04 04:35:41 -08:00
ld a, $19
ld [wcd33], a
ld a, $1e
ld [wcd34], a
ld a, $5
ld [wc3f0], a
ldh a, [rSVBK]
2015-11-04 04:35:41 -08:00
push af
ld a, $3
ldh [rSVBK], a
2015-11-04 04:35:41 -08:00
.asm_11829d
call JoyTextDelay
call Function118473
ld a, [wBattleTowerRoomMenuJumptableIndex]
2015-11-04 04:35:41 -08:00
cp $20
jr c, .asm_1182b0
ld a, [wcd34]
ld [wBattleTowerRoomMenuJumptableIndex], a
2015-11-04 04:35:41 -08:00
.asm_1182b0
call Function1186f5
call BattleTowerRoomMenu_WriteMessage
2017-12-24 09:47:30 -08:00
farcall Function115dd3
farcall Function11619d
2015-11-04 04:35:41 -08:00
call DelayFrame
ld a, [wBattleTowerRoomMenuJumptableIndex]
2015-11-04 04:35:41 -08:00
ld hl, wcd33
cp [hl]
jr nz, .asm_11829d
pop af
ldh [rSVBK], a
call BattleTowerRoomMenu_Cleanup
2015-11-04 04:35:41 -08:00
ret
2018-06-24 07:09:41 -07:00
Function1182d5:
call BattleTowerRoomMenu_InitRAM
2015-11-04 04:35:41 -08:00
ld a, $18
ld [wcd33], a
ld a, $19
ld [wcd34], a
ld a, $4
ld [wc3f0], a
ldh a, [rSVBK]
2015-11-04 04:35:41 -08:00
push af
ld a, $3
ldh [rSVBK], a
2015-11-04 04:35:41 -08:00
.asm_1182ee
call JoyTextDelay
call Function118473
ld a, [wBattleTowerRoomMenuJumptableIndex]
2015-11-04 04:35:41 -08:00
cp $1b
jr c, .asm_118301
ld a, [wcd34]
ld [wBattleTowerRoomMenuJumptableIndex], a
2015-11-04 04:35:41 -08:00
.asm_118301
call Function118746
call BattleTowerRoomMenu_WriteMessage
2017-12-24 09:47:30 -08:00
farcall Function115dd3
farcall Function11619d
2015-11-04 04:35:41 -08:00
call DelayFrame
ld a, [wBattleTowerRoomMenuJumptableIndex]
2015-11-04 04:35:41 -08:00
ld hl, wcd33
cp [hl]
jr nz, .asm_1182ee
pop af
ldh [rSVBK], a
call BattleTowerRoomMenu_Cleanup
2015-11-11 20:38:57 -08:00
call ReturnToMapFromSubmenu
2015-11-04 04:35:41 -08:00
ret
2018-06-24 07:09:41 -07:00
Function118329:
call BattleTowerRoomMenu_InitRAM
2015-11-04 04:35:41 -08:00
ld a, $15
ld [wcd33], a
ld a, $16
ld [wcd34], a
ld a, $6
ld [wc3f0], a
ldh a, [rSVBK]
2015-11-04 04:35:41 -08:00
push af
ld a, $3
ldh [rSVBK], a
2015-11-04 04:35:41 -08:00
.asm_118342
call JoyTextDelay
call Function118473
ld a, [wBattleTowerRoomMenuJumptableIndex]
2015-11-04 04:35:41 -08:00
cp $18
jr c, .asm_118355
ld a, [wcd34]
ld [wBattleTowerRoomMenuJumptableIndex], a
2015-11-04 04:35:41 -08:00
.asm_118355
call Function118671
call BattleTowerRoomMenu_WriteMessage
2017-12-24 09:47:30 -08:00
farcall Function115dd3
farcall Function11619d
2015-11-04 04:35:41 -08:00
call DelayFrame
ld a, [wBattleTowerRoomMenuJumptableIndex]
2015-11-04 04:35:41 -08:00
ld hl, wcd33
cp [hl]
jr nz, .asm_118342
pop af
ldh [rSVBK], a
call BattleTowerRoomMenu_Cleanup
2015-11-04 04:35:41 -08:00
ret
2018-06-24 07:09:41 -07:00
Function11837a:
call BattleTowerRoomMenu_InitRAM
2015-11-04 04:35:41 -08:00
ld a, $16
ld [wcd33], a
ld a, $17
ld [wcd34], a
ld a, $6
ld [wc3f0], a
ldh a, [rSVBK]
2015-11-04 04:35:41 -08:00
push af
ld a, $3
ldh [rSVBK], a
2015-11-04 04:35:41 -08:00
.asm_118393
call JoyTextDelay
call Function118473
ld a, [wBattleTowerRoomMenuJumptableIndex]
2015-11-04 04:35:41 -08:00
cp $19
jr c, .asm_1183a6
ld a, [wcd34]
ld [wBattleTowerRoomMenuJumptableIndex], a
2015-11-04 04:35:41 -08:00
.asm_1183a6
call Function1186b2
call BattleTowerRoomMenu_WriteMessage
2017-12-24 09:47:30 -08:00
farcall Function115dd3
farcall Function11619d
2015-11-04 04:35:41 -08:00
call DelayFrame
ld a, [wBattleTowerRoomMenuJumptableIndex]
2015-11-04 04:35:41 -08:00
ld hl, wcd33
cp [hl]
jr nz, .asm_118393
pop af
ldh [rSVBK], a
call BattleTowerRoomMenu_Cleanup
2015-11-04 04:35:41 -08:00
ret
2018-06-24 07:09:41 -07:00
BattleTowerRoomMenu_InitRAM:
2015-11-04 04:35:41 -08:00
di
ldh a, [rIE]
2015-11-04 04:35:41 -08:00
ld [wcd32], a
call DoubleSpeed
xor a
ldh [rIF], a
ld [wMobileErrorCodeBuffer], a
ld [wMobileErrorCodeBuffer + 1], a
ld [wMobileErrorCodeBuffer + 2], a
2015-11-04 04:35:41 -08:00
ld [wcd80], a
ld [wcd65], a
ld [wcd66], a
ld [wcd67], a
ld [wcd68], a
ld [wc31a], a
2015-11-04 04:35:41 -08:00
ld [wcd89], a
ld [wcd8a], a
ld [wcd8b], a
ld [wc3ec], a
ld [wc3ed], a
ld [wc3ee], a
ld [wc3ef], a
2018-01-23 14:39:09 -08:00
ld hl, wVramState
2015-11-04 04:35:41 -08:00
ld a, [hl]
ld [wcd7f], a
set 1, [hl]
2019-05-05 09:14:46 -07:00
ld a, (1 << SERIAL) | (1 << TIMER) | (1 << LCD_STAT) | (1 << VBLANK)
ldh [rIE], a
2015-11-04 04:35:41 -08:00
ld a, $1
ldh [hMobileReceive], a
ldh [hMobile], a
2015-11-04 04:35:41 -08:00
ei
farcall Stubbed_Function106462
2017-12-24 09:47:30 -08:00
farcall Function106464
farcall Function115d99
farcall Function11615a
ld a, BANK(s5_bfff)
call OpenSRAM
2015-11-04 04:35:41 -08:00
xor a
ld [s5_bfff], a
2015-11-04 04:35:41 -08:00
call CloseSRAM
ret
2018-06-24 07:09:41 -07:00
Function118440:
2015-11-04 04:35:41 -08:00
push af
ld a, BANK(s5_bfff)
call OpenSRAM
ld a, [s5_bfff]
2015-11-04 04:35:41 -08:00
inc a
ld [s5_bfff], a
2015-11-04 04:35:41 -08:00
call CloseSRAM
pop af
ret
2018-06-24 07:09:41 -07:00
BattleTowerRoomMenu_Cleanup:
2015-11-04 04:35:41 -08:00
di
xor a
ldh [hMobileReceive], a
ldh [hMobile], a
ldh [hVBlank], a
2015-11-04 04:35:41 -08:00
call NormalSpeed
xor a
ldh [rIF], a
2015-11-04 04:35:41 -08:00
ld a, [wcd32]
ldh [rIE], a
2015-11-04 04:35:41 -08:00
ei
ld a, [wcd7f]
2018-01-23 14:39:09 -08:00
ld [wVramState], a
ld a, [wMobileErrorCodeBuffer]
2018-01-23 14:39:09 -08:00
ld [wScriptVar], a
2015-11-04 04:35:41 -08:00
ret
2018-06-24 07:09:41 -07:00
Function118473:
2015-11-04 04:35:41 -08:00
ld a, [wcd65]
and a
ret z
ld a, [wcd66]
inc a
ld [wcd66], a
2015-12-25 20:34:33 -08:00
cp 60
2015-11-04 04:35:41 -08:00
ret nz
xor a
ld [wcd66], a
ld a, [wcd67]
inc a
ld [wcd67], a
2015-12-25 20:34:33 -08:00
cp 60
2015-11-04 04:35:41 -08:00
ret nz
ld a, [wcd68]
inc a
ld [wcd68], a
2015-12-25 20:34:33 -08:00
cp 99
2015-12-28 14:09:53 -08:00
jr z, .ninety_nine
2015-11-04 04:35:41 -08:00
xor a
ld [wcd67], a
ret
2015-12-28 14:09:53 -08:00
.ninety_nine
2015-11-04 04:35:41 -08:00
xor a
ld [wcd65], a
ret
2018-06-24 07:09:41 -07:00
Function1184a5:
jumptable .Jumptable, wBattleTowerRoomMenuJumptableIndex
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
.Jumptable:
2015-11-04 04:35:41 -08:00
dw Function11886e
dw Function118880
dw Function11878d
dw Function1188b0
dw Function11878d
dw Function1188b8
dw Function11878d
dw Function1188c0
dw Function11878d
dw Function1188c8
dw Function11878d
dw Function118903
dw Function118a8f
dw Function11878d
dw Function118d80
dw Function118d9b
dw Function11878d
dw Function118ded
dw Function118e6d
dw Function11878d
dw Function11984e
dw Function118e76
dw Function118e7e
dw Function11878d
dw BattleTowerRoomMenu_DoNothing
2015-11-04 04:35:41 -08:00
dw Function118e76
dw BattleTowerRoomMenu_CallRoomMenu2
2015-11-04 04:35:41 -08:00
dw Function118e76
2018-06-24 07:09:41 -07:00
Function1184ec:
jumptable .Jumptable, wBattleTowerRoomMenuJumptableIndex
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
.Jumptable:
2015-11-04 04:35:41 -08:00
dw Function11886e
dw Function118880
dw Function11878d
dw Function1188b0
dw Function11878d
dw Function1188b8
dw Function11878d
dw Function1188c0
dw Function11878d
dw Function1188c8
dw Function11878d
dw Function118903
dw Function119954
dw Function11878d
dw Function119973
dw Function11878d
dw Function119987
dw Function11878d
dw Function1199b4
dw Function1199ca
dw Function11878d
dw Function1199e2
dw Function119b0d
dw Function11878d
dw Function119b6b
dw Function119b3b
dw Function11878d
dw Function119b52
dw Function11878d
dw Function118e6d
dw Function11878d
dw Function118e76
dw Function118e7e
dw Function11878d
dw BattleTowerRoomMenu_DoNothing
2015-11-04 04:35:41 -08:00
dw Function118e76
dw BattleTowerRoomMenu_CallRoomMenu2
2015-11-04 04:35:41 -08:00
dw Function119b45
dw Function11878d
dw Function119ac9
dw Function118e76
2018-06-24 07:09:41 -07:00
BattleTowerRoomMenu_Jumptable:
jumptable .Jumptable, wBattleTowerRoomMenuJumptableIndex
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
.Jumptable:
dw BattleTowerRoomMenu_PickLevelMessage
dw BattleTowerRoomMenu_PlacePickLevelMenu
dw BattleTowerRoomMenu_UpdatePickLevelMenu
dw BattleTowerRoomMenu_DoNothing
dw BattleTowerRoomMenu_PartyMonTopsThisLevelMessage
dw BattleTowerRoomMenu_WaitForMessage
dw BattleTowerRoomMenu_DelayRestartMenu
dw BattleTowerRoomMenu_QuitMessage
dw BattleTowerRoomMenu_PlaceYesNoMenu
dw BattleTowerRoomMenu_UpdateYesNoMenu
dw BattleTowerRoomMenu_UberRestrictionMessage
dw BattleTowerRoomMenu_WaitForMessage
dw BattleTowerRoomMenu_DelayRestartMenu
dw Function118e76 ; mobile
dw BattleTowerRoomMenu_CallRoomMenu2 ; mobile
dw Function118e76 ; mobile
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
Function11857c:
jumptable .Jumptable, wBattleTowerRoomMenuJumptableIndex
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
.Jumptable:
2015-11-04 04:35:41 -08:00
dw Function11886e
dw Function118880
dw Function11878d
dw Function1188b0
dw Function11878d
dw Function1188b8
dw Function11878d
dw Function1188c0
dw Function11878d
dw Function1188c8
dw Function11878d
dw Function118903
dw Function118a7a
dw Function11878d
dw Function11891c
dw Function1198ee
dw Function1198f7
dw Function11878d
dw Function119937
dw Function118e6d
dw Function11878d
dw Function118e76
dw Function118e7e
dw Function11878d
dw BattleTowerRoomMenu_DoNothing
2015-11-04 04:35:41 -08:00
dw Function118e76
dw BattleTowerRoomMenu_CallRoomMenu2
2015-11-04 04:35:41 -08:00
dw Function118e76
2018-06-24 07:09:41 -07:00
Function1185c3:
jumptable .Jumptable, wBattleTowerRoomMenuJumptableIndex
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
.Jumptable:
2015-11-04 04:35:41 -08:00
dw Function11886e
dw Function118880
dw Function11878d
dw Function1188b0
dw Function11878d
dw Function1188b8
dw Function11878d
dw Function1188c0
dw Function11878d
dw Function1188c8
dw Function11878d
dw Function118903
dw Function118aa4
dw Function11878d
dw Function118e92
dw Function11878d
dw Function118eb0
dw Function118ec6
dw Function118f0d
dw Function118f14
dw Function118f5e
dw Function11878d
dw Function118fc0
dw Function11878d
dw Function119054
dw Function1190d0
dw Function11878d
dw Function1190ec
dw Function118e6d
dw Function11878d
dw Function118e76
dw Function118e7e
dw Function11878d
dw BattleTowerRoomMenu_DoNothing
2015-11-04 04:35:41 -08:00
dw Function118e76
dw BattleTowerRoomMenu_CallRoomMenu2
dw BattleTowerRoomMenu_QuitMessage
dw BattleTowerRoomMenu_PlaceYesNoMenu
dw BattleTowerRoomMenu_UpdateYesNoMenu
2015-11-04 04:35:41 -08:00
dw Function11914e
dw Function118e76
2018-06-24 07:09:41 -07:00
Function118624:
jumptable .Jumptable, wBattleTowerRoomMenuJumptableIndex
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
.Jumptable:
2015-11-04 04:35:41 -08:00
dw Function118866
dw Function118880
dw Function11878d
dw Function1188b0
dw Function11878d
dw Function1188b8
dw Function11878d
dw Function1188c0
dw Function11878d
dw Function1188c8
dw Function11878d
dw Function118903
dw Function118aa4
dw Function11878d
dw Function118e92
dw Function11878d
dw Function11915d
dw Function118f68
dw Function11878d
dw Function119009
dw Function11878d
dw Function119054
dw Function118e6d
dw Function11878d
dw Function118e76
dw Function118e7e
dw Function11878d
dw BattleTowerRoomMenu_DoNothing
2015-11-04 04:35:41 -08:00
dw Function118e76
dw BattleTowerRoomMenu_CallRoomMenu2
2015-11-04 04:35:41 -08:00
dw Function118e76
2018-06-24 07:09:41 -07:00
Function118671:
jumptable .Jumptable, wBattleTowerRoomMenuJumptableIndex
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
.Jumptable:
2015-11-04 04:35:41 -08:00
dw Function118866
dw Function118880
dw Function11878d
dw Function1188b0
dw Function11878d
dw Function1188b8
dw Function11878d
dw Function1188c0
dw Function11878d
dw Function1188c8
dw Function11878d
dw Function118903
dw Function119380
dw Function119388
dw Function1193a0
dw Function11878d
dw Function118e6d
dw Function11878d
dw Function118e76
dw Function118e7e
dw Function11878d
dw BattleTowerRoomMenu_DoNothing
2015-11-04 04:35:41 -08:00
dw Function118e76
dw BattleTowerRoomMenu_CallRoomMenu2
2015-11-04 04:35:41 -08:00
dw Function118e76
2018-06-24 07:09:41 -07:00
Function1186b2:
jumptable .Jumptable, wBattleTowerRoomMenuJumptableIndex
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
.Jumptable:
2015-11-04 04:35:41 -08:00
dw Function118866
dw Function118880
dw Function11878d
dw Function1188b0
dw Function11878d
dw Function1188b8
dw Function11878d
dw Function1188c0
dw Function11878d
dw Function1188c8
dw Function11878d
dw Function118903
dw Function119380
dw Function1193e3
dw Function1193fb
dw Function11878d
dw Function119413
dw Function118e6d
dw Function11878d
dw Function118e76
dw Function118e7e
dw Function11878d
dw BattleTowerRoomMenu_DoNothing
2015-11-04 04:35:41 -08:00
dw Function118e76
dw BattleTowerRoomMenu_CallRoomMenu2
2015-11-04 04:35:41 -08:00
dw Function118e76
2018-06-24 07:09:41 -07:00
Function1186f5:
jumptable .Jumptable, wBattleTowerRoomMenuJumptableIndex
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
.Jumptable:
2015-11-04 04:35:41 -08:00
dw Function11886a
dw Function118880
dw Function11878d
dw Function1188b0
dw Function11878d
dw Function1188b8
dw Function11878d
dw Function1188c0
dw Function11878d
dw Function1188c8
dw Function11878d
dw Function118903
dw Function118abc
dw Function11878d
dw Function119451
dw Function1195f8
dw Function119612
dw Function119629
dw Function119648
dw Function11878d
dw Function118e6d
dw Function11878d
dw Function118e76
dw Function118e7e
dw Function11878d
dw BattleTowerRoomMenu_DoNothing
2015-11-04 04:35:41 -08:00
dw Function11967d
dw Function119685
dw Function119665
dw Function11966d
dw Function118e76
dw BattleTowerRoomMenu_CallRoomMenu2
2015-11-04 04:35:41 -08:00
dw Function118e76
2018-06-24 07:09:41 -07:00
Function118746:
jumptable .Jumptable, wBattleTowerRoomMenuJumptableIndex
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
.Jumptable:
2015-11-04 04:35:41 -08:00
dw Function11886e
dw Function118880
dw Function11878d
dw Function1188b0
dw Function11878d
dw Function1188b8
dw Function11878d
dw Function1188c0
dw Function11878d
dw Function1188c8
dw Function11878d
dw Function118903
dw Function118ad0
dw Function11878d
dw Function1196f2
dw Function1197c9
dw Function1197dc
dw Function11878d
dw Function118e6d
dw Function11878d
dw Function119800
dw Function118e76
dw Function118e7e
dw Function11878d
dw BattleTowerRoomMenu_DoNothing
2015-11-04 04:35:41 -08:00
dw Function118e76
dw BattleTowerRoomMenu_CallRoomMenu2
2015-11-04 04:35:41 -08:00
dw Function118e76
2018-06-24 07:09:41 -07:00
Function11878d:
2015-11-04 04:35:41 -08:00
ld a, [wc821]
bit 1, a
jr nz, .asm_1187af
bit 2, a
jr nz, .asm_1187d1
bit 0, a
jr nz, .asm_1187aa
ld a, [wcd89]
and $1
jr z, .asm_1187a7
ld a, $3
ldh [rSVBK], a
2015-11-04 04:35:41 -08:00
.asm_1187a7
jp BattleTowerRoomMenu_IncrementJumptable
2015-11-04 04:35:41 -08:00
.asm_1187aa
call Function118821
ret c
ret
.asm_1187af
ld a, $0
call Function3e32
ld [wMobileErrorCodeBuffer], a
2015-11-04 04:35:41 -08:00
ld a, l
ld [wMobileErrorCodeBuffer + 1], a
2015-11-04 04:35:41 -08:00
ld a, h
ld [wMobileErrorCodeBuffer + 2], a
2015-11-04 04:35:41 -08:00
ld a, $a
call Function3e32
ld a, [wc3f0]
ld [wc319], a
2015-11-04 04:35:41 -08:00
ld a, [wcd34]
ld [wBattleTowerRoomMenuJumptableIndex], a
2015-11-04 04:35:41 -08:00
ret
.asm_1187d1
ld hl, wcd89
bit 0, [hl]
jr nz, .asm_118803
set 0, [hl]
ld a, BANK(w6_d000)
ldh [rSVBK], a
ld de, w6_d000
2015-11-04 04:35:41 -08:00
ld bc, $1000
ld a, [hl]
sla a
jr c, .asm_1187f9
sla a
jr c, .asm_1187fd
sla a
jr c, .asm_1187f5
ld a, $24
jr .asm_1187ff
.asm_1187f5
ld a, $28
jr .asm_1187ff
.asm_1187f9
ld a, $2a
jr .asm_1187ff
.asm_1187fd
ld a, $2c
.asm_1187ff
call Function3e32
ret
.asm_118803
ld a, $d3
SetMobileErrorCode:
ld [wMobileErrorCodeBuffer], a
2015-11-04 04:35:41 -08:00
xor a
ld [wMobileErrorCodeBuffer + 1], a
ld [wMobileErrorCodeBuffer + 2], a
2015-11-04 04:35:41 -08:00
ld a, $a
call Function3e32
ld a, [wc3f0]
ld [wc319], a
2015-11-04 04:35:41 -08:00
ld a, [wcd34]
ld [wBattleTowerRoomMenuJumptableIndex], a
2015-11-04 04:35:41 -08:00
ret
2018-06-24 07:09:41 -07:00
Function118821:
ld a, [wc319]
2015-11-04 04:35:41 -08:00
cp $3
jr c, .asm_11884a
cp $4
jr z, .asm_11884a
ldh a, [hJoyDown]
2015-11-04 04:35:41 -08:00
cp $5
jr nz, .asm_11884a
ld a, $a
call Function3e32
ld a, $a
ld [wMobileErrorCodeBuffer], a
2015-11-04 04:35:41 -08:00
ld a, [wc3f0]
ld [wc319], a
2015-11-04 04:35:41 -08:00
ld a, [wcd34]
ld [wBattleTowerRoomMenuJumptableIndex], a
2015-11-04 04:35:41 -08:00
scf
ret
.asm_11884a
and a
ret
2018-06-24 07:09:41 -07:00
Function11884c:
ldh a, [hJoyDown]
2015-11-04 04:35:41 -08:00
cp $5
jr nz, .asm_118864
ld a, $a
call Function3e32
ld a, $a
ld [wMobileErrorCodeBuffer], a
2015-11-04 04:35:41 -08:00
ld a, [wcd34]
ld [wBattleTowerRoomMenuJumptableIndex], a
2015-11-04 04:35:41 -08:00
scf
ret
.asm_118864
and a
ret
Function118866:
ld a, 2
jr asm_11886f
2018-06-24 07:09:41 -07:00
Function11886a:
2015-11-04 04:35:41 -08:00
ld a, 1
jr asm_11886f
Function11886e:
xor a
2018-10-24 12:33:18 -07:00
asm_11886f:
2018-01-23 14:39:09 -08:00
ld [wBGMapPalBuffer], a
2015-11-04 04:35:41 -08:00
ld a, $0
ld [wBattleTowerRoomMenu2JumptableIndex], a
call BattleTowerRoomMenu_IncrementJumptable
2015-11-04 04:35:41 -08:00
ld a, [wcd33]
ld [wMobileInactivityTimerSeconds], a
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
Function118880:
call BattleTowerRoomMenu2
2015-11-04 04:35:41 -08:00
ret c
xor a
ld [wcf64], a
ld [wc807], a
ld de, wcd81
ld hl, $46
ld a, $2
jp Function119e2b
2018-06-24 07:09:41 -07:00
Function118896:
2015-11-04 04:35:41 -08:00
ld a, [wc821]
bit 1, a
jr nz, .asm_1188a5
bit 2, a
jr nz, .asm_1188a5
bit 0, a
jr z, .asm_1188aa
.asm_1188a5
ld a, $34
jp Function119e2b
.asm_1188aa
call BattleTowerRoomMenu_IncrementJumptable
jp BattleTowerRoomMenu_IncrementJumptable
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
Function1188b0:
ld de, wc346
2015-11-04 04:35:41 -08:00
ld a, $c
jp Function119e2b
2018-06-24 07:09:41 -07:00
Function1188b8:
2015-11-04 04:35:41 -08:00
ld de, wc3ac
ld a, $e
jp Function119e2b
2018-06-24 07:09:41 -07:00
Function1188c0:
2015-11-04 04:35:41 -08:00
ld de, wc3cd
ld a, $10
jp Function119e2b
2018-06-24 07:09:41 -07:00
Function1188c8:
2015-11-04 04:35:41 -08:00
ld a, $1
ld [wcd65], a
call Function1188e7
ld hl, wc708
2015-11-04 04:35:41 -08:00
.asm_1188d3
ld a, [de]
inc de
ld [hli], a
and a
jr nz, .asm_1188d3
call Function119eb4
call Function119ec2
ld hl, wc708
2015-11-04 04:35:41 -08:00
ld a, $6
jp Function119e2b
2018-06-24 07:09:41 -07:00
Function1188e7:
ld de, wc346
ld a, BANK(s5_aa4a)
call OpenSRAM
ld a, [s5_aa4a]
2015-11-04 04:35:41 -08:00
call CloseSRAM
and a
ret z
sla a
ld c, a
.asm_1188fa
ld a, [de]
inc de
and a
jr nz, .asm_1188fa
dec c
jr nz, .asm_1188fa
ret
2018-06-24 07:09:41 -07:00
Function118903:
2015-11-04 04:35:41 -08:00
ld a, [wc3f0]
ld [wc319], a
2015-11-04 04:35:41 -08:00
ld c, $1
2017-12-24 09:47:30 -08:00
farcall Function115e18
2015-11-04 04:35:41 -08:00
ld a, $8
ld [wBattleTowerRoomMenu2JumptableIndex], a
call BattleTowerRoomMenu2
jp BattleTowerRoomMenu_IncrementJumptable
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
Function11891c:
2015-11-04 04:35:41 -08:00
call Function118b42
jp BattleTowerRoomMenu_IncrementJumptable
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
BattleTowerRoomMenu_PickLevelMessage:
2015-11-04 04:35:41 -08:00
ld a, [wcd38]
and a
jr nz, .asm_11892d
ld hl, Text_WhatLevelDoYouWantToChallenge
jr .asm_118930
.asm_11892d
ld hl, Text_CheckBattleRoomListByMaxLevel
.asm_118930
call BattleTowerRoomMenu_SetMessage
call BattleTowerRoomMenu_IncrementJumptable
2015-11-04 04:35:41 -08:00
BattleTowerRoomMenu_PlacePickLevelMenu:
ld a, [wc31a]
2015-11-04 04:35:41 -08:00
and a
ret nz
ld hl, MenuHeader_119cf7
call LoadMenuHeader
2015-11-04 11:02:11 -08:00
call MenuBox
call MenuBoxCoord2Tile
2015-11-25 07:16:29 -08:00
call ApplyTilemap
hlcoord 16, 8, wAttrmap
2015-11-04 04:35:41 -08:00
ld a, $40
or [hl]
ld [hl], a
2015-12-11 13:59:40 -08:00
call WaitBGMap2
2015-11-04 04:35:41 -08:00
ld a, $1
ld [wcd4f], a
ld a, $1
ldh [rSVBK], a
ld a, [wStatusFlags]
2018-01-22 12:40:43 -08:00
bit STATUSFLAGS_HALL_OF_FAME_F, a
2015-11-04 04:35:41 -08:00
jr nz, .asm_11896b
2018-01-22 12:40:43 -08:00
ld hl, Strings_Ll0ToL40 ; Address to list of strings with the choosable levels
ld a, 5 ; 4 levels to choose from, including 'Cancel'-option
2015-11-04 04:35:41 -08:00
jr .asm_118970
.asm_11896b
2018-01-22 12:40:43 -08:00
ld hl, Strings_L10ToL100 ; Address to list of strings with the choosable levels
ld a, 11 ; 10 levels to choose from, including 'Cancel'-option
2015-11-04 04:35:41 -08:00
.asm_118970
ld [wcd4a], a
ld a, l
ld [wcd4b], a
ld a, h
ld [wcd4c], a
ld a, $3
ldh [rSVBK], a
call BattleTowerRoomMenu_IncrementJumptable
2015-11-04 04:35:41 -08:00
BattleTowerRoomMenu_UpdatePickLevelMenu:
2015-11-04 04:35:41 -08:00
hlcoord 13, 8
ld de, String_119d07
call PlaceString
hlcoord 13, 10
ld de, String_119d07
call PlaceString
ld a, [wcd4b]
ld l, a
ld a, [wcd4c]
ld h, a
ld d, $0
ld a, [wcd4f]
dec a
rlca
rlca
rlca
ld e, a
add hl, de
ld a, l
ld e, a
ld a, h
ld d, a
ldh a, [rSVBK]
2015-11-04 04:35:41 -08:00
push af
ld a, $1
ldh [rSVBK], a
2018-01-23 14:39:09 -08:00
ld bc, wStringBuffer3
2015-11-04 04:35:41 -08:00
.asm_1189b5
ld a, [hli]
cp $50
jr z, .asm_1189c4
cp $7f
jr z, .asm_1189c2
ld [bc], a
inc bc
jr .asm_1189b5
.asm_1189c2
ld a, $50
.asm_1189c4
ld [bc], a
pop af
ldh [rSVBK], a
2015-11-04 04:35:41 -08:00
hlcoord 13, 9
call PlaceString
ld hl, hJoyPressed
ld a, [hl]
and B_BUTTON
jr nz, .b_button
2015-11-04 04:35:41 -08:00
ld a, [hl]
and A_BUTTON
jr nz, .a_button
2015-11-04 04:35:41 -08:00
ld a, [hl]
and D_DOWN
jr nz, .d_down
2015-11-04 04:35:41 -08:00
ld a, [hl]
and D_UP
jr nz, .d_up
2015-11-04 04:35:41 -08:00
.asm_1189e5
ret
.d_down
2015-11-04 04:35:41 -08:00
ld hl, wcd4f
dec [hl]
jr nz, .asm_1189e5
ld a, [wcd4a]
ld [hl], a
jr .asm_1189e5
.d_up
2015-11-04 04:35:41 -08:00
ld a, [wcd4a]
ld hl, wcd4f
inc [hl]
cp [hl]
jr nc, .asm_1189e5
ld a, $1
ld [hl], a
jr .asm_1189e5
.a_button
2015-11-04 04:35:41 -08:00
call PlayClickSFX
ld a, [wcd4f]
ld hl, wcd4a
cp [hl]
jr z, .asm_118a3c
dec a
and $fe
srl a
ld [wcf65], a
ldh a, [rSVBK]
2015-11-04 04:35:41 -08:00
push af
ld a, $1
ldh [rSVBK], a
call CloseWindow
2015-11-04 04:35:41 -08:00
pop af
ldh [rSVBK], a
2015-11-04 04:35:41 -08:00
ld a, [wcd38]
and a
jr nz, .asm_118a30
call BattleTower_LevelCheck
2015-11-04 04:35:41 -08:00
ret c
call BattleTower_UbersCheck
2015-11-04 04:35:41 -08:00
ret c
.asm_118a30
ld a, [wcd4f]
ld [w3_d800], a
jp BattleTowerRoomMenu_IncrementJumptable
2015-11-04 04:35:41 -08:00
.b_button
2015-11-04 04:35:41 -08:00
call PlayClickSFX
.asm_118a3c
ldh a, [rSVBK]
2015-11-04 04:35:41 -08:00
push af
ld a, $1
ldh [rSVBK], a
call CloseWindow
2015-11-04 04:35:41 -08:00
pop af
ldh [rSVBK], a
2015-11-04 04:35:41 -08:00
ld a, $7
ld [wBattleTowerRoomMenuJumptableIndex], a
2015-11-04 04:35:41 -08:00
ld a, $0
ld [wMobileInactivityTimerFrames], a
2015-11-04 04:35:41 -08:00
ret
2018-06-24 07:09:41 -07:00
Function118a54:
2015-11-04 04:35:41 -08:00
ld a, [wcd55]
ld l, a
ld a, [wcd56]
ld h, a
ld de, wc3ec
ld bc, $0004
jp Function118ae4
2018-06-24 07:09:41 -07:00
Function118a65:
2015-11-04 04:35:41 -08:00
ld hl, BattleDownloadURL
ld de, wcc60
ld bc, $80
call CopyBytes
2015-12-08 13:06:13 -08:00
ld de, w3_d000
2015-11-04 04:35:41 -08:00
ld bc, $1000
jp Function118b10
2018-06-24 07:09:41 -07:00
Function118a7a:
2015-11-04 04:35:41 -08:00
ld hl, BattleDownloadURL
ld de, wcc60
ld bc, $80
call CopyBytes
2015-12-08 13:06:13 -08:00
ld de, w3_d000
2015-11-04 04:35:41 -08:00
ld bc, $1000
jp Function118b10
2018-06-24 07:09:41 -07:00
Function118a8f:
2015-11-04 04:35:41 -08:00
ld hl, ExchangeDownloadURL
ld de, wcc60
ld bc, $80
call CopyBytes
2015-12-08 13:06:13 -08:00
ld de, w3_d000
2015-11-04 04:35:41 -08:00
ld bc, $1000
jp Function118b10
2018-06-24 07:09:41 -07:00
Function118aa4:
2015-11-04 04:35:41 -08:00
ld hl, NewsDownloadURL
ld de, wcc60
ld bc, $80
call CopyBytes
ld a, $5
ldh [rSVBK], a
2015-12-08 13:06:13 -08:00
ld de, w3_d100
2015-11-04 04:35:41 -08:00
ld bc, $e00
jr Function118b10
2018-06-24 07:09:41 -07:00
Function118abc:
2015-11-04 04:35:41 -08:00
ld hl, MenuDownloadURL
ld de, wcc60
ld bc, $80
call CopyBytes
2015-12-08 13:06:13 -08:00
ld de, w3_d000
2015-11-04 04:35:41 -08:00
ld bc, $1000
jr Function118b10
Function118ad0:
ld hl, IndexDownloadURL
ld de, wcc60
ld bc, $80
call CopyBytes
2015-12-08 13:06:13 -08:00
ld de, w3_d000
2015-11-04 04:35:41 -08:00
ld bc, $1000
jr Function118b10
Function118ae4:
push bc
push de
push hl
ld a, $8
ld [wBattleTowerRoomMenu2JumptableIndex], a
call BattleTowerRoomMenu2
2015-11-04 04:35:41 -08:00
pop hl
ld c, $0
ld de, wcc60
.asm_118af5
ld a, [hli]
ld [de], a
inc de
and a
jr z, .asm_118b06
inc c
ld a, c
cp $a6
jr c, .asm_118af5
ld a, $da
jp SetMobileErrorCode
2015-11-04 04:35:41 -08:00
.asm_118b06
call Function118b24
pop de
pop bc
ld a, $2a
jp Function119e2b
Function118b10:
push de
push bc
ld a, $8
ld [wBattleTowerRoomMenu2JumptableIndex], a
call BattleTowerRoomMenu2
2015-11-04 04:35:41 -08:00
call Function118b24
pop bc
pop de
ld a, $2a
jp Function119e2b
2018-06-24 07:09:41 -07:00
Function118b24:
ld hl, wc346
2015-11-04 04:35:41 -08:00
ld a, $8
ld [hli], a
ld a, $c7
ld [hli], a
ld a, $60
ld [hli], a
ld a, $cc
ld [hli], a
call Function119eb4
call Function119ec2
ld a, $80
ld [wcd89], a
ld hl, wc346
2015-11-04 04:35:41 -08:00
ret
2018-06-24 07:09:41 -07:00
Function118b42:
2015-11-10 16:51:13 -08:00
ld hl, wd002
2015-11-04 04:35:41 -08:00
ld a, l
ld [wcd51], a
ld a, h
ld [wcd52], a
call Function118b8c
ld a, l
ld [wcd55], a
ld [wcd59], a
ld a, h
ld [wcd56], a
ld [wcd5a], a
call Function118b8c
ld a, l
ld [wcd53], a
ld [wcd5d], a
ld a, h
ld [wcd54], a
ld [wcd5e], a
call Function118b8c
ld a, l
ld [wcd57], a
ld [wcd5b], a
ld a, h
ld [wcd58], a
ld [wcd5c], a
call Function118b8c
ld a, l
ld [wcd5f], a
ld a, h
ld [wcd60], a
ret
2018-06-24 07:09:41 -07:00
Function118b8c:
2015-11-04 04:35:41 -08:00
.asm_118b8c
call Function118b9a
ret nc
ld a, [hli]
cp $d
jr nz, .asm_118b8c
dec hl
xor a
ld [hli], a
2015-12-26 18:59:03 -08:00
ld [hli], a
2015-11-04 04:35:41 -08:00
ret
2018-06-24 07:09:41 -07:00
Function118b9a:
2015-11-04 04:35:41 -08:00
ld a, h
cp $e0
ret c
ld a, $d3
call SetMobileErrorCode
2015-11-04 04:35:41 -08:00
and a
ret
2019-11-18 15:48:39 -08:00
pushc
setcharmap ascii
2015-11-04 04:35:41 -08:00
ExchangeDownloadURL:
2015-11-04 04:35:41 -08:00
db "http://gameboy.datacenter.ne.jp/cgb/download?name=/01/CGB-BXTJ/exchange/index.txt", 0
BattleDownloadURL:
2015-11-04 04:35:41 -08:00
db "http://gameboy.datacenter.ne.jp/cgb/download?name=/01/CGB-BXTJ/battle/index.txt", 0
NewsDownloadURL:
2015-11-04 04:35:41 -08:00
db "http://gameboy.datacenter.ne.jp/cgb/download?name=/01/CGB-BXTJ/news/index.txt", 0
MenuDownloadURL:
2015-11-04 04:35:41 -08:00
db "http://gameboy.datacenter.ne.jp/cgb/download?name=/01/CGB-BXTJ/POKESTA/menu.cgb", 0
IndexDownloadURL:
2015-11-04 04:35:41 -08:00
db "http://gameboy.datacenter.ne.jp/cgb/download?name=/01/CGB-BXTJ/tamago/index.txt", 0
2019-11-18 15:48:39 -08:00
popc
Function118d35: ; unreferenced
2015-12-08 13:06:13 -08:00
ld hl, $d200
2015-11-04 04:35:41 -08:00
ld a, [wcd38]
and a
jr nz, .asm_118d6e
ld a, [hli]
cp $94
jr nz, .asm_118d7b
ld a, [hl]
cp $5
jr nz, .asm_118d7b
ld a, [wcd4f]
sla a
ld b, a
sla a
sla a
add b
ld b, a
ld a, BANK(s5_b2fb)
call OpenSRAM
2015-11-04 04:35:41 -08:00
ld a, b
ld [s5_b2fb], a
2015-11-04 04:35:41 -08:00
call CloseSRAM
2017-12-24 09:47:30 -08:00
farcall Function170be4
farcall Function1700c4
2015-11-04 04:35:41 -08:00
jr .asm_118d78
.asm_118d6e
ld a, [hli]
cp $96
jr nz, .asm_118d7b
ld a, [hl]
cp $0
jr nz, .asm_118d7b
.asm_118d78
jp BattleTowerRoomMenu_IncrementJumptable
2015-11-04 04:35:41 -08:00
.asm_118d7b
ld a, $d3
jp SetMobileErrorCode
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
Function118d80:
2015-11-04 04:35:41 -08:00
call Function118e06
ld a, [wcd38]
and a
jr z, .asm_118d8e
call BattleTowerRoomMenu_IncrementJumptable
2015-11-04 04:35:41 -08:00
jr asm_118d9f
.asm_118d8e
ld a, $9
ld [wBattleTowerRoomMenu2JumptableIndex], a
2015-11-04 04:35:41 -08:00
ld a, $12
ld [wMobileInactivityTimerSeconds], a
call BattleTowerRoomMenu_IncrementJumptable
2015-11-04 04:35:41 -08:00
Function118d9b:
call BattleTowerRoomMenu2
2015-11-04 04:35:41 -08:00
ret c
2018-10-24 12:33:18 -07:00
asm_118d9f:
ld hl, wc608
2015-11-04 04:35:41 -08:00
call Function119940
ld a, [wcd38]
and a
jr nz, .asm_118db2
ld a, $8f
ld [wcd3b], a
jr .asm_118db7
.asm_118db2
ld a, $26
ld [wcd3b], a
.asm_118db7
2015-12-08 13:06:13 -08:00
ld hl, w3_d800
2015-11-04 04:35:41 -08:00
ld a, $8
ld [hli], a
ld a, $c6
ld [hli], a
ld a, [wcd3b]
ld [hli], a
xor a
ld [hli], a
ld a, $8
ld [hli], a
ld a, $c7
ld [hli], a
ld a, [wcd39]
ld [hli], a
ld a, [wcd3a]
ld [hli], a
call Function119eb4
call Function119ec2
ld a, $40
ld [wcd89], a
2015-12-08 13:06:13 -08:00
ld hl, w3_d800
ld de, w3_de00
ld bc, $200
2015-11-04 04:35:41 -08:00
ld a, $2c
jp Function119e2b
2018-06-24 07:09:41 -07:00
Function118ded:
2015-11-04 04:35:41 -08:00
ld a, [wcd38]
and a
jr z, .asm_118e03
ldh a, [rSVBK]
2015-11-04 04:35:41 -08:00
push af
ld a, $1
ldh [rSVBK], a
farcall Function11b93b
2015-11-04 04:35:41 -08:00
pop af
ldh [rSVBK], a
2015-11-04 04:35:41 -08:00
.asm_118e03
jp BattleTowerRoomMenu_IncrementJumptable
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
Function118e06:
2015-11-10 16:51:13 -08:00
ld hl, wd002
2015-11-04 04:35:41 -08:00
ld a, [wcd38]
and a
jr z, .asm_118e1d
.asm_118e0f
call Function118b9a
ret nc
ld a, [hli]
cp $d
jr nz, .asm_118e0f
ld a, [hli]
cp $a
jr nz, .asm_118e0f
.asm_118e1d
ld a, l
ld [wcd39], a
ld a, h
ld [wcd3a], a
.asm_118e25
call Function118b9a
ret nc
ld a, [hli]
cp $d
jr nz, .asm_118e25
ld a, [hli]
cp $a
jr nz, .asm_118e25
dec hl
xor a
ld [hld], a
ld [hl], a
jr asm_118e3e
2018-06-24 07:09:41 -07:00
Function118e39:
2015-11-04 04:35:41 -08:00
ld a, [hli]
and a
2018-10-24 12:33:18 -07:00
jr nz, Function118e39
2015-11-04 04:35:41 -08:00
dec hl
2018-10-24 12:33:18 -07:00
asm_118e3e:
2015-11-04 04:35:41 -08:00
ld a, [hld]
cp $2f
2018-10-24 12:33:18 -07:00
jr nz, asm_118e3e
2015-11-04 04:35:41 -08:00
inc hl
2015-12-26 18:59:03 -08:00
inc hl
2015-11-04 04:35:41 -08:00
ld de, wcd85
ld c, $4
.asm_118e4a
ld a, [hli]
cp $2e
jr z, .asm_118e63
cp $30
jr c, .asm_118e67
cp $3a
jr nc, .asm_118e67
sub $30
add $f6
ld [de], a
inc de
dec c
jr nz, .asm_118e4a
ld de, wcd85
.asm_118e63
ld a, $50
ld [de], a
ret
.asm_118e67
ld a, $f3
ld [de], a
inc de
jr .asm_118e63
2018-06-24 07:09:41 -07:00
Function118e6d:
2015-11-04 04:35:41 -08:00
xor a
ld [wcd65], a
ld a, $a
jp Function119e2b
2018-06-24 07:09:41 -07:00
Function118e76:
; Call $c in BattleTowerRoomMenu2
2015-11-04 04:35:41 -08:00
ld a, $c
ld [wBattleTowerRoomMenu2JumptableIndex], a
jp BattleTowerRoomMenu_IncrementJumptable
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
Function118e7e:
call BattleTowerRoomMenu2
2015-11-04 04:35:41 -08:00
ret c
ld a, $36
jp Function119e2b
2018-06-24 07:09:41 -07:00
BattleTowerRoomMenu_CallRoomMenu2:
call BattleTowerRoomMenu2
2015-11-04 04:35:41 -08:00
ret c
ld a, [wcd33]
ld [wBattleTowerRoomMenuJumptableIndex], a
2015-11-04 04:35:41 -08:00
ret
2018-06-24 07:09:41 -07:00
Function118e92:
2015-11-04 04:35:41 -08:00
call Function118440
call Function1191d3
ld a, [wcd53]
ld l, a
ld a, [wcd54]
ld h, a
ld de, wcc60
call Function1191ad
ret c
2015-12-08 13:06:13 -08:00
ld de, w3_d800
2015-11-04 04:35:41 -08:00
ld bc, $0800
jp Function118b10
2018-06-24 07:09:41 -07:00
Function118eb0:
2015-11-04 04:35:41 -08:00
call Function118440
ld hl, w3_d802
2018-01-23 14:39:09 -08:00
ld de, wBGMapBuffer
2015-11-04 04:35:41 -08:00
ld bc, $000c
call CopyBytes
call Function1192cc
ret c
jp BattleTowerRoomMenu_IncrementJumptable
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
Function118ec6:
2015-11-04 04:35:41 -08:00
call Function118440
2019-04-08 05:15:10 -07:00
call SpeechTextbox
ld hl, w3_d80e
ld de, wc320
2015-11-04 04:35:41 -08:00
ld bc, $0026
call CopyBytes
xor a
ld [wc31f], a
2015-11-04 04:35:41 -08:00
ld a, $20
ld [wc31b], a
2015-11-04 04:35:41 -08:00
ld a, $c3
ld [wc31c], a
2015-11-04 04:35:41 -08:00
hlcoord 1, 14
ld a, l
ld [wc31d], a
2015-11-04 04:35:41 -08:00
ld a, h
ld [wc31e], a
2015-11-04 04:35:41 -08:00
ld a, $2
ld [wc31a], a
2015-11-04 04:35:41 -08:00
ld a, $1d
ld [wBattleTowerRoomMenu2JumptableIndex], a
2015-11-04 04:35:41 -08:00
ld a, $24
ld [wMobileInactivityTimerSeconds], a
2015-11-04 04:35:41 -08:00
ld a, $11
ld [wMobileInactivityTimerFrames], a
2015-11-04 04:35:41 -08:00
ld a, $1c
ld [wcd47], a
jp BattleTowerRoomMenu_IncrementJumptable
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
Function118f0d:
call BattleTowerRoomMenu2
2015-11-04 04:35:41 -08:00
ret c
call Function118440
Function118f14:
call Function118440
ld a, [wcd51]
ld l, a
ld a, [wcd52]
ld h, a
ld de, wcc60
call Function1191ad
ret c
ld a, [wcc60]
and a
jr z, .DontSendSaveFile
ld hl, Text_SaveFileWillBeSent
call BattleTowerRoomMenu_SetMessage
2015-11-04 04:35:41 -08:00
.DontSendSaveFile:
2015-11-04 04:35:41 -08:00
ld a, [wcd57]
ld l, a
ld a, [wcd58]
ld h, a
ld de, wcc60
call Function1191ad
ret c
ld hl, wcc60
call Function118e39
ld a, $9
ld [wBattleTowerRoomMenu2JumptableIndex], a
2015-11-04 04:35:41 -08:00
ld a, $24
ld [wMobileInactivityTimerSeconds], a
2015-11-04 04:35:41 -08:00
ld a, $13
ld [wMobileInactivityTimerFrames], a
2015-11-04 04:35:41 -08:00
ld a, $1c
ld [wcd47], a
jp BattleTowerRoomMenu_IncrementJumptable
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
Function118f5e:
call BattleTowerRoomMenu2
2015-11-04 04:35:41 -08:00
ret c
call Function118440
call DelayFrame
Function118f68:
call Function119223
ret c
call Function118440
ld a, [wcd51]
ld l, a
ld a, [wcd52]
ld h, a
ld de, wcc60
call Function1191ad
ret c
ld a, [wcc60]
and a
jr z, .asm_118fba
ld hl, wc346
ld a, LOW($c608)
2015-11-04 04:35:41 -08:00
ld [hli], a
ld a, HIGH($c608)
2015-11-04 04:35:41 -08:00
ld [hli], a
ld a, [wcd4b]
ld [hli], a
ld a, [wcd4c]
ld [hli], a
ld a, LOW($c708)
2015-11-04 04:35:41 -08:00
ld [hli], a
ld a, HIGH($c708)
2015-11-04 04:35:41 -08:00
ld [hli], a
ld a, $60
ld [hli], a
ld a, $cc
ld [hli], a
call Function119eb4
call Function119ec2
ld a, $40
ld [wcd89], a
ld hl, wc346
ld de, w3_de00
ld bc, $200
2015-11-04 04:35:41 -08:00
ld a, $2c
jp Function119e2b
.asm_118fba
call BattleTowerRoomMenu_IncrementJumptable
jp BattleTowerRoomMenu_IncrementJumptable
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
Function118fc0:
2015-11-04 04:35:41 -08:00
call Function118440
ld a, [wcd55]
ld l, a
ld a, [wcd56]
ld h, a
ld de, wcc60
call Function1191ad
ret c
ld a, [wcc60]
and a
jr z, .asm_118ffa
ld a, [wcd51]
ld l, a
ld a, [wcd52]
ld h, a
ld de, wcc60
call Function1191ad
ret c
ld a, [wcc60]
and a
jr z, .asm_118ff2
ld hl, Text_SentSaveFileReadingNews
2015-11-04 04:35:41 -08:00
jr .asm_118ff5
.asm_118ff2
ld hl, Text_ReadingNews
2015-11-04 04:35:41 -08:00
.asm_118ff5
call BattleTowerRoomMenu_SetMessage
2015-11-04 04:35:41 -08:00
jr Function119009
.asm_118ffa
ld hl, Text_ReadingNews
call BattleTowerRoomMenu_SetMessage
call BattleTowerRoomMenu_IncrementJumptable
call BattleTowerRoomMenu_IncrementJumptable
jp BattleTowerRoomMenu_IncrementJumptable
2015-11-04 04:35:41 -08:00
Function119009:
call Function118440
call Function119300
ld a, [wcd55]
ld l, a
ld a, [wcd56]
ld h, a
ld de, wcc60
call Function1191ad
ret c
ld hl, wc346
2015-11-04 04:35:41 -08:00
ld a, $8
ld [hli], a
ld a, $c6
ld [hli], a
ld a, [wcd4b]
ld [hli], a
ld a, [wcd4c]
ld [hli], a
ld a, $8
ld [hli], a
ld a, $c7
ld [hli], a
ld a, $60
ld [hli], a
ld a, $cc
ld [hli], a
call Function119eb4
call Function119ec2
ld a, $40
ld [wcd89], a
ld hl, wc346
2015-12-08 13:06:13 -08:00
ld de, w3_d000
2015-11-04 04:35:41 -08:00
ld bc, $1000
ld a, $2c
jp Function119e2b
2018-06-24 07:09:41 -07:00
Function119054:
2015-11-04 04:35:41 -08:00
ld a, $6
call OpenSRAM
2015-11-10 16:51:13 -08:00
ld hl, wd002
2015-11-04 04:35:41 -08:00
ld a, [wcd4f]
ld e, a
ld a, [wcd50]
ld d, a
2015-12-08 13:06:13 -08:00
ld a, [w3_d000]
2015-11-04 04:35:41 -08:00
ld c, a
2015-12-08 13:06:13 -08:00
ld a, [w3_d000 + 1]
2015-11-04 04:35:41 -08:00
ld b, a
call Function119192
ret c
ld a, [wcd89]
and $1
jr z, .asm_11908a
ld a, $6
ldh [rSVBK], a
2015-11-10 16:51:13 -08:00
ld hl, wd002
2015-12-08 13:06:13 -08:00
ld a, [w3_d000]
2015-11-04 04:35:41 -08:00
ld c, a
2015-12-08 13:06:13 -08:00
ld a, [w3_d000 + 1]
2015-11-04 04:35:41 -08:00
ld b, a
call Function119192
ret c
.asm_11908a
call CloseSRAM
ld a, $3 ; ???
ldh [rSVBK], a
ld a, BANK(s5_b1b3) ; aka BANK(s5_b1b4) and BANK(s5_aa7f) and BANK(s5_b2f3) and BANK(s5_b2f4)
call OpenSRAM
2015-11-04 04:35:41 -08:00
ld a, [wcd4f]
ld [s5_b1b3], a
2015-11-04 04:35:41 -08:00
ld a, [wcd50]
ld [s5_b1b4], a
ld hl, wcd20
ld de, s5_aa7f
ld bc, 12
2015-11-04 04:35:41 -08:00
call CopyBytes
ldh a, [rSVBK]
2015-11-04 04:35:41 -08:00
push af
ld a, BANK(wd474) ; aka BANK(wd475)
ldh [rSVBK], a
2015-11-04 04:35:41 -08:00
ld a, [wd474]
ld [s5_b2f3], a
2015-11-04 04:35:41 -08:00
ld hl, wd475
ld de, s5_b2f4
ld bc, 4
2015-11-04 04:35:41 -08:00
call CopyBytes
pop af
ldh [rSVBK], a
2015-11-04 04:35:41 -08:00
call CloseSRAM
jp BattleTowerRoomMenu_IncrementJumptable
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
Function1190d0:
ld a, BANK(w3_d000)
ldh [rSVBK], a
2015-11-04 04:35:41 -08:00
ld a, [wcd57]
ld l, a
ld a, [wcd58]
ld h, a
ld de, wcc60
call Function1191ad
ret c
2015-12-08 13:06:13 -08:00
ld de, w3_d000
2015-11-04 04:35:41 -08:00
ld bc, $1000
jp Function118b10
2018-06-24 07:09:41 -07:00
Function1190ec:
ld a, BANK(s5_aa73)
call OpenSRAM
2018-01-23 14:39:09 -08:00
ld hl, wBGMapBuffer
ld de, s5_aa73
ld bc, 12
2015-11-04 04:35:41 -08:00
call CopyBytes
call CloseSRAM
ld a, BANK(s5_aa72)
call OpenSRAM
2015-11-04 04:35:41 -08:00
ld a, $1
ld [s5_aa72], a
2015-11-04 04:35:41 -08:00
call CloseSRAM
ld a, BANK(s6_a000)
call OpenSRAM
2015-12-08 13:06:13 -08:00
ld a, [w3_d000]
2015-11-04 04:35:41 -08:00
ld c, a
2015-12-08 13:06:13 -08:00
ld a, [w3_d000 + 1]
2015-11-04 04:35:41 -08:00
ld b, a
2015-11-10 16:51:13 -08:00
ld hl, wd002
ld de, s6_a000
2015-11-04 04:35:41 -08:00
call Function119192
ret c
ld a, [wcd89]
and $1
jr z, .asm_11913e
ld a, BANK(w6_d000)
ldh [rSVBK], a
ld a, [w6_d000]
2015-11-04 04:35:41 -08:00
ld c, a
ld a, [w6_d000 + 1]
2015-11-04 04:35:41 -08:00
ld b, a
ld hl, w6_d000 + 2
2015-11-04 04:35:41 -08:00
call Function119192
ret c
.asm_11913e
ld a, BANK("Battle Tower RAM")
ldh [rSVBK], a
2015-11-04 04:35:41 -08:00
call CloseSRAM
ld hl, Text_ReceivedNews
call BattleTowerRoomMenu_SetMessage
jp BattleTowerRoomMenu_IncrementJumptable
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
Function11914e:
call BattleTowerRoomMenu2
2015-11-04 04:35:41 -08:00
ret c
ld a, $1c
ld [wBattleTowerRoomMenuJumptableIndex], a
2015-11-04 04:35:41 -08:00
ld a, $a
ld [wMobileErrorCodeBuffer], a
2015-11-04 04:35:41 -08:00
ret
2018-06-24 07:09:41 -07:00
Function11915d:
ld hl, w3_d802
ld de, wcd20
ld bc, 12
2015-11-04 04:35:41 -08:00
call CopyBytes
ld a, BANK(s5_aa7f)
call OpenSRAM
2018-01-23 14:39:09 -08:00
ld hl, wBGMapBuffer
ld de, s5_aa7f
ld c, 12
2015-11-04 04:35:41 -08:00
.asm_119176
ld a, [de]
inc de
cp [hl]
jr nz, .asm_119184
inc hl
dec c
jr nz, .asm_119176
call BattleTowerRoomMenu_IncrementJumptable
2015-11-04 04:35:41 -08:00
jr .asm_11918e
.asm_119184
ld a, $16
ld [wBattleTowerRoomMenuJumptableIndex], a
2015-11-04 04:35:41 -08:00
ld a, $b
ld [wMobileErrorCodeBuffer], a
2015-11-04 04:35:41 -08:00
.asm_11918e
call CloseSRAM
ret
2018-06-24 07:09:41 -07:00
Function119192:
2015-11-04 04:35:41 -08:00
inc b
inc c
jr .asm_11919e
.asm_119196
ld a, [hli]
ld [de], a
inc de
ld a, $bf
cp d
jr c, .asm_1191a6
.asm_11919e
dec c
jr nz, .asm_119196
dec b
jr nz, .asm_119196
and a
ret
.asm_1191a6
ld a, $d3
call SetMobileErrorCode
2015-11-04 04:35:41 -08:00
scf
ret
2018-06-24 07:09:41 -07:00
Function1191ad:
2015-11-04 04:35:41 -08:00
push bc
ld c, $0
ld a, $5
ldh [rSVBK], a
2015-11-04 04:35:41 -08:00
.asm_1191b4
ld a, [hli]
ld [de], a
inc de
and a
jr z, .asm_1191cc
inc c
ld a, c
cp $a6
jr c, .asm_1191b4
ld a, $da
call SetMobileErrorCode
ld a, BANK("Battle Tower RAM")
ldh [rSVBK], a
2015-11-04 04:35:41 -08:00
pop bc
scf
ret
.asm_1191cc
ld a, BANK("Battle Tower RAM")
ldh [rSVBK], a
2015-11-04 04:35:41 -08:00
pop bc
and a
ret
2018-06-24 07:09:41 -07:00
Function1191d3:
2015-12-08 13:06:13 -08:00
ld hl, w3_d100 + 2
2015-11-04 04:35:41 -08:00
ld a, l
ld [wcd53], a
ld a, h
ld [wcd54], a
call Function11920f
ld a, l
ld [wcd51], a
ld a, [wcd4a]
ld a, h
ld [wcd52], a
call Function11920f
ld a, l
ld [wcd55], a
ld a, [wcd4a]
ld a, h
ld [wcd56], a
call Function11920f
ld a, [wcd49]
ld a, l
ld [wcd57], a
ld a, [wcd4a]
ld a, h
ld [wcd58], a
call Function11920f
ret
2018-06-24 07:09:41 -07:00
Function11920f:
2015-11-04 04:35:41 -08:00
.asm_11920f
call Function118b9a
ret nc
ld a, [hli]
cp $d
jr nz, .asm_11920f
ld a, [hli]
cp $a
jr nz, .asm_11920f
dec hl
xor a
ld [hld], a
ld [hli], a
inc hl
ret
2018-06-24 07:09:41 -07:00
Function119223:
2015-11-04 04:35:41 -08:00
xor a
ld [wcd4b], a
ld [wcd4c], a
ld a, BANK(s5_b092) ; aka BANK(s5_b1b1) and BANK(s5_b1b2) and BANK(s5_b1d3)
call OpenSRAM
2015-11-04 04:35:41 -08:00
ld hl, wc3cd
ld de, s5_b092
ld bc, 31
2015-11-04 04:35:41 -08:00
call CopyBytes
dec de
xor a
ld [de], a
ld hl, w3_d810
2015-11-04 04:35:41 -08:00
.asm_119241
ld a, [hli]
cp $50
jr nz, .asm_119241
ld a, [hli]
ld [wcd4f], a
ld a, [hli]
ld [wcd50], a
ld a, [hli]
ld [s5_b1b1], a
2015-11-04 04:35:41 -08:00
ld c, a
ld a, [hli]
ld [s5_b1b2], a
2015-11-04 04:35:41 -08:00
ld b, a
ld de, s5_b1d3
2015-11-04 04:35:41 -08:00
call CopyBytes
call CloseSRAM
ld e, l
ld d, h
ld hl, wc608
2015-11-04 04:35:41 -08:00
.asm_119266
ld a, [de]
inc de
cp $ff
jr z, .asm_1192c2
cp $fe
jr z, .asm_1192a5
call OpenSRAM
2015-11-04 04:35:41 -08:00
ld a, [de]
inc de
ld c, a
ld a, [de]
inc de
ld b, a
ld a, [de]
inc de
push de
push af
ld a, [wcd4b]
ld e, a
ld a, [wcd4c]
ld d, a
pop af
.asm_119286
push af
ld a, [bc]
inc bc
ld [hli], a
inc de
pop af
dec a
jr nz, .asm_119286
call CloseSRAM
ld a, e
ld [wcd4b], a
ld a, d
ld [wcd4c], a
pop de
.asm_11929b
and a
jr z, .asm_119266
ld a, $d3
call SetMobileErrorCode
2015-11-04 04:35:41 -08:00
scf
ret
.asm_1192a5
ld a, [wcd4b]
ld c, a
ld a, [wcd4c]
ld b, a
ld a, [de]
inc de
.asm_1192af
push af
ld a, [de]
inc de
ld [hli], a
inc bc
pop af
dec a
jr nz, .asm_1192af
ld a, c
ld [wcd4b], a
ld a, b
ld [wcd4c], a
jr .asm_11929b
.asm_1192c2
ld a, e
ld [wcd4d], a
ld a, d
ld [wcd4e], a
and a
ret
2018-06-24 07:09:41 -07:00
Function1192cc:
ld a, BANK(s5_aa73)
call OpenSRAM
ld hl, s5_aa73
ld de, wc608
ld bc, 12
2015-11-04 04:35:41 -08:00
call CopyBytes
call CloseSRAM
ld hl, wc608
ld de, wcd20
2015-11-04 04:35:41 -08:00
ld c, $c
.asm_1192e8
ld a, [de]
inc de
ld b, a
ld a, [hli]
cp b
jr nz, .asm_1192fe
dec c
jr nz, .asm_1192e8
ld a, $1f
ld [wBattleTowerRoomMenu2JumptableIndex], a
2015-11-04 04:35:41 -08:00
ld a, $27
ld [wBattleTowerRoomMenuJumptableIndex], a
2015-11-04 04:35:41 -08:00
scf
ret
.asm_1192fe
and a
ret
2018-06-24 07:09:41 -07:00
Function119300:
2015-11-04 04:35:41 -08:00
xor a
ld [wcd4b], a
ld [wcd4c], a
ld a, [wcd4d]
ld e, a
ld a, [wcd4e]
ld d, a
ld hl, wc608
2015-11-04 04:35:41 -08:00
ld a, [wcd4b]
ld c, a
ld a, [wcd4c]
ld b, a
.asm_11931a
ld a, [de]
inc de
cp $50
jr z, .asm_119324
ld [hli], a
inc bc
jr .asm_11931a
.asm_119324
ld a, $3d
ld [hli], a
inc bc
ld a, c
ld [wcd4b], a
ld a, b
ld [wcd4c], a
ld a, [de]
inc de
call OpenSRAM
2015-11-04 04:35:41 -08:00
ld a, [de]
inc de
ld c, a
ld a, [de]
inc de
ld b, a
ld a, [de]
inc de
push de
push af
ld a, [wcd4b]
ld e, a
ld a, [wcd4c]
ld d, a
pop af
.asm_119348
push af
ld a, [bc]
and $f0
swap a
call Function1197bf
ld [hli], a
inc de
ld a, [bc]
inc bc
and $f
call Function1197bf
ld [hli], a
inc de
pop af
dec a
jr nz, .asm_119348
call CloseSRAM
ld a, e
ld [wcd4b], a
ld a, d
ld [wcd4c], a
pop de
ld a, [de]
cp $50
jr z, .asm_11937f
ld a, [wcd4b]
ld c, a
ld a, [wcd4c]
ld b, a
ld a, $26
ld [hli], a
inc bc
jr .asm_11931a
.asm_11937f
ret
2018-06-24 07:09:41 -07:00
Function119380:
2015-11-04 04:35:41 -08:00
ld a, $80
ld [wcd49], a
jp BattleTowerRoomMenu_IncrementJumptable
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
Function119388:
2015-11-04 04:35:41 -08:00
ld hl, wcd49
dec [hl]
ret nz
ld hl, wcc60
call Function118e39
ld a, $9
ld [wBattleTowerRoomMenu2JumptableIndex], a
2015-11-04 04:35:41 -08:00
ld a, $10
ld [wMobileInactivityTimerSeconds], a
call BattleTowerRoomMenu_IncrementJumptable
2015-11-04 04:35:41 -08:00
Function1193a0:
call BattleTowerRoomMenu2
2015-11-04 04:35:41 -08:00
ret c
call DelayFrame
ld a, $8
ld [wBattleTowerRoomMenu2JumptableIndex], a
call BattleTowerRoomMenu2
ld hl, wc346
ld a, LOW(w3_d000)
2015-11-04 04:35:41 -08:00
ld [hli], a
ld a, HIGH(w3_d000)
2015-11-04 04:35:41 -08:00
ld [hli], a
ld a, [wcd3b]
ld [hli], a
xor a
ld [hli], a
ld a, LOW(wc708)
2015-11-04 04:35:41 -08:00
ld [hli], a
ld a, HIGH(wc708)
2015-11-04 04:35:41 -08:00
ld [hli], a
ld a, $60
ld [hli], a
ld a, $cc
ld [hli], a
call Function119eb4
call Function119ec2
ld a, $40
ld [wcd89], a
ld hl, wc346
ld de, w3_de00
ld bc, $200
2015-11-04 04:35:41 -08:00
ld a, $2c
jp Function119e2b
2018-06-24 07:09:41 -07:00
Function1193e3:
2015-11-04 04:35:41 -08:00
ld hl, wcd49
dec [hl]
ret nz
ld hl, wcc60
call Function118e39
ld a, $9
ld [wBattleTowerRoomMenu2JumptableIndex], a
2015-11-04 04:35:41 -08:00
ld a, $11
ld [wMobileInactivityTimerSeconds], a
call BattleTowerRoomMenu_IncrementJumptable
2015-11-04 04:35:41 -08:00
Function1193fb:
call BattleTowerRoomMenu2
2015-11-04 04:35:41 -08:00
ret c
call DelayFrame
ld a, $8
ld [wBattleTowerRoomMenu2JumptableIndex], a
call BattleTowerRoomMenu2
2015-12-08 13:06:13 -08:00
ld de, w3_d000
2015-11-04 04:35:41 -08:00
ld bc, $1000
jp Function118b10
2018-06-24 07:09:41 -07:00
Function119413:
ld a, $6 ; ???
call OpenSRAM
2015-12-08 13:06:13 -08:00
ld a, [w3_d000]
2015-11-04 04:35:41 -08:00
ld c, a
2015-12-08 13:06:13 -08:00
ld a, [w3_d000 + 1]
2015-11-04 04:35:41 -08:00
ld b, a
dec bc
2015-12-26 18:59:03 -08:00
dec bc
2015-11-04 04:35:41 -08:00
ld hl, wd002
ld a, [hli]
ld e, a
ld a, [hli]
ld d, a
call Function119192
ret c
ld a, [wcd89]
and $1
jr z, .asm_119447
ld a, BANK(w6_d000)
ldh [rSVBK], a
ld a, [w6_d000]
2015-11-04 04:35:41 -08:00
ld c, a
ld a, [w6_d000 + 1]
2015-11-04 04:35:41 -08:00
ld b, a
ld hl, w6_d000 + 2
2015-11-04 04:35:41 -08:00
call Function119192
ret c
.asm_119447
ld a, BANK("Battle Tower RAM")
ldh [rSVBK], a
2015-11-04 04:35:41 -08:00
call CloseSRAM
jp BattleTowerRoomMenu_IncrementJumptable
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
Function119451:
2015-11-04 04:35:41 -08:00
ld a, [wcd89]
and $1
jr z, .asm_11945d
ld a, $d3
jp SetMobileErrorCode
2015-11-04 04:35:41 -08:00
.asm_11945d
xor a
ld [wcd50], a
call Function119694
ld a, b
ld [wcd49], a
call Function1196cd
2015-11-10 16:51:13 -08:00
ld a, [wd002]
2015-11-04 04:35:41 -08:00
ld hl, wd003
2018-06-24 07:09:41 -07:00
Function119471:
2015-11-04 04:35:41 -08:00
push af
ld a, [hli]
ld [wc608], a
2015-11-04 04:35:41 -08:00
ld a, [hli]
ld [wc608 + 3], a
2015-11-04 04:35:41 -08:00
ld a, [hli]
ld [wc608 + 1], a
2015-11-04 04:35:41 -08:00
ld a, [hli]
ld [wc608 + 2], a
2015-11-04 04:35:41 -08:00
ld a, [hli]
ld [wc608 + 4], a
2015-11-04 04:35:41 -08:00
ld a, [hli]
ld [wc608 + 5], a
2015-11-04 04:35:41 -08:00
push hl
ld a, [wc608]
2015-11-04 04:35:41 -08:00
cp $ff
jr z, .asm_1194a7
ld a, [wc608 + 2]
2015-11-04 04:35:41 -08:00
cp $ff
jr z, .asm_1194a7
ld a, [wc608 + 1]
2015-11-04 04:35:41 -08:00
cp $ff
jr nz, .asm_1194a7
call Function119584
jr c, .asm_11950c
jr .asm_1194f0
.asm_1194a7
ld hl, wc608
ld de, wc608 + 3
2015-11-04 04:35:41 -08:00
ld c, $3
.asm_1194af
ld a, [de]
inc de
cp [hl]
inc hl
jr c, .asm_1194f3
jr z, .asm_1194b9
jr nc, .asm_1194bc
.asm_1194b9
dec c
jr nz, .asm_1194af
.asm_1194bc
ld c, $3
ld hl, wcd49
ld de, wc608
2015-11-04 04:35:41 -08:00
.asm_1194c4
ld a, [de]
inc de
cp $ff
jr z, .asm_1194d1
cp [hl]
jr z, .asm_1194d1
jr c, .asm_1194d5
jr nc, .asm_1194f0
.asm_1194d1
inc hl
dec c
jr nz, .asm_1194c4
.asm_1194d5
ld c, $3
ld hl, wcd49
ld de, wc608 + 3
2015-11-04 04:35:41 -08:00
.asm_1194dd
ld a, [de]
inc de
cp $ff
jr z, .asm_1194ea
cp [hl]
jr c, .asm_1194f0
jr z, .asm_1194ea
jr nc, .asm_11950c
.asm_1194ea
inc hl
dec c
jr nz, .asm_1194dd
jr .asm_11950c
.asm_1194f0
pop hl
jr .asm_119557
.asm_1194f3
ld c, $3
ld hl, wcd49
ld de, wc608
2015-11-04 04:35:41 -08:00
.asm_1194fb
ld a, [de]
inc de
cp $ff
jr z, .asm_119508
cp [hl]
jr c, .asm_11950c
jr z, .asm_119508
jr nc, .asm_1194d5
.asm_119508
inc hl
dec c
jr nz, .asm_1194fb
.asm_11950c
pop hl
ld a, $1
ld [wcd50], a
ld a, l
ld [wc608], a
2015-11-04 04:35:41 -08:00
ld a, h
ld [wc608 + 1], a
2015-11-04 04:35:41 -08:00
ld de, wcd69
ld c, $10
ld b, $0
.asm_119521
ld a, [de]
inc de
cp [hl]
inc hl
jr nz, .asm_119528
inc b
.asm_119528
dec c
jr nz, .asm_119521
ld a, $10
cp b
jr z, .asm_119536
rept 4
inc hl
endr
jr .asm_11957a
.asm_119536
ld a, [hli]
cp $50
jr nz, .asm_119552
ld a, [hli]
cp $33
jr nz, .asm_119553
ld a, [hli]
ld c, a
ld a, [hli]
ld b, a
ld a, [wcd83]
cp c
jr nz, .asm_119576
ld a, [wcd84]
cp b
jr nz, .asm_119576
jr .asm_11955b
.asm_119552
inc hl
.asm_119553
inc hl
2015-12-26 18:59:03 -08:00
inc hl
2015-11-04 04:35:41 -08:00
jr .asm_11955b
.asm_119557
ld de, $14
add hl, de
.asm_11955b
ld a, [hli]
ld e, a
ld a, [hli]
ld d, a
add hl, de
pop af
dec a
jp nz, Function119471
ld a, [wcd50]
and a
jr z, .asm_119571
ld a, $1a
ld [wBattleTowerRoomMenuJumptableIndex], a
2015-11-04 04:35:41 -08:00
ret
.asm_119571
ld a, $d8
jp SetMobileErrorCode
2015-11-04 04:35:41 -08:00
.asm_119576
ld a, $10
jr .asm_11957c
.asm_11957a
ld a, $f
.asm_11957c
ld [wBattleTowerRoomMenuJumptableIndex], a
2015-11-04 04:35:41 -08:00
pop af
call Function1195c4
ret
2018-06-24 07:09:41 -07:00
Function119584:
ld a, [wc608]
2015-11-04 04:35:41 -08:00
ld b, a
ld a, [wc608 + 3]
2015-11-04 04:35:41 -08:00
ld c, a
cp b
jr c, .asm_11959c
ld a, [wcd49]
cp b
jr c, .asm_1195c2
.asm_119595
cp c
jr c, .asm_1195a2
jr z, .asm_1195a2
jr .asm_1195c2
.asm_11959c
ld a, [wcd49]
cp b
jr c, .asm_119595
.asm_1195a2
ld a, [wc608 + 2]
2015-11-04 04:35:41 -08:00
ld b, a
ld a, [wc608 + 5]
2015-11-04 04:35:41 -08:00
ld c, a
cp b
jr c, .asm_1195ba
ld a, [wcd4b]
cp b
jr c, .asm_1195c2
.asm_1195b3
cp c
jr c, .asm_1195c0
jr z, .asm_1195c0
jr .asm_1195c2
.asm_1195ba
ld a, [wcd4b]
cp b
jr c, .asm_1195b3
.asm_1195c0
scf
ret
.asm_1195c2
and a
ret
2018-06-24 07:09:41 -07:00
Function1195c4:
2015-11-04 04:35:41 -08:00
ld a, [hli]
ld c, a
ld a, [hli]
ld b, a
ld de, $a5
ld a, b
cp d
jr c, .asm_1195d9
jr z, .asm_1195d3
jr nc, .asm_1195f3
.asm_1195d3
ld a, c
cp e
jr z, .asm_1195d9
jr nc, .asm_1195f3
.asm_1195d9
ld de, wcc60
call CopyBytes
xor a
ld [de], a
ld a, [wc608]
2015-11-04 04:35:41 -08:00
ld l, a
ld a, [wc608 + 1]
2015-11-04 04:35:41 -08:00
ld h, a
ld de, wcd69
ld bc, $10
call CopyBytes
ret
.asm_1195f3
ld a, $d8
jp SetMobileErrorCode
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
Function1195f8:
2015-11-04 04:35:41 -08:00
ld a, $11
ld [wBattleTowerRoomMenu2JumptableIndex], a
2015-11-04 04:35:41 -08:00
ld a, $1c
ld [wMobileInactivityTimerSeconds], a
2015-11-04 04:35:41 -08:00
ld a, $f
ld [wMobileInactivityTimerFrames], a
2015-11-04 04:35:41 -08:00
ld a, $14
ld [wcd47], a
call BattleTowerRoomMenu_IncrementJumptable
jp BattleTowerRoomMenu_IncrementJumptable
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
Function119612:
2015-11-04 04:35:41 -08:00
ld a, $14
ld [wBattleTowerRoomMenu2JumptableIndex], a
2015-11-04 04:35:41 -08:00
ld a, $1c
ld [wMobileInactivityTimerSeconds], a
2015-11-04 04:35:41 -08:00
ld a, $10
ld [wMobileInactivityTimerFrames], a
2015-11-04 04:35:41 -08:00
ld a, $14
ld [wcd47], a
jp BattleTowerRoomMenu_IncrementJumptable
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
Function119629:
call BattleTowerRoomMenu2
2015-11-04 04:35:41 -08:00
ret c
ld a, $60
ld l, a
ld a, $cc
ld h, a
call Function118e39
ld a, $9
ld [wBattleTowerRoomMenu2JumptableIndex], a
2015-11-04 04:35:41 -08:00
ld a, $1c
ld [wMobileInactivityTimerSeconds], a
2015-11-04 04:35:41 -08:00
ld a, $14
ld [wcd47], a
call BattleTowerRoomMenu_IncrementJumptable
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
Function119648:
call BattleTowerRoomMenu2
2015-11-04 04:35:41 -08:00
ret c
call DelayFrame
ld a, $8
ld [wBattleTowerRoomMenu2JumptableIndex], a
call BattleTowerRoomMenu2
2015-11-04 04:35:41 -08:00
call Function118b24
2015-12-08 13:06:13 -08:00
ld de, w3_d000
2015-11-04 04:35:41 -08:00
ld bc, $1000
ld a, $2a
jp Function119e2b
2018-06-24 07:09:41 -07:00
Function119665:
2015-11-04 04:35:41 -08:00
ld a, $1a
ld [wBattleTowerRoomMenu2JumptableIndex], a
call BattleTowerRoomMenu_IncrementJumptable
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
Function11966d:
call BattleTowerRoomMenu2
2015-11-04 04:35:41 -08:00
ret c
ld a, [wcd47]
ld [wBattleTowerRoomMenuJumptableIndex], a
2015-11-04 04:35:41 -08:00
ld a, $a
ld [wMobileErrorCodeBuffer], a
2015-11-04 04:35:41 -08:00
ret
2018-06-24 07:09:41 -07:00
Function11967d:
2015-11-04 04:35:41 -08:00
ld a, $18
ld [wBattleTowerRoomMenu2JumptableIndex], a
call BattleTowerRoomMenu_IncrementJumptable
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
Function119685:
call BattleTowerRoomMenu2
2015-11-04 04:35:41 -08:00
ret c
ld a, $14
ld [wBattleTowerRoomMenuJumptableIndex], a
2015-11-04 04:35:41 -08:00
ld a, $a
ld [wMobileErrorCodeBuffer], a
2015-11-04 04:35:41 -08:00
ret
2018-06-24 07:09:41 -07:00
Function119694:
2015-11-04 04:35:41 -08:00
ld b, 0
ld hl, Unknown_1196b8
.asm_119699
ld de, wc708
2015-11-04 04:35:41 -08:00
ld a, [de]
inc de
cp [hl]
inc hl
jr nz, .asm_1196af
ld a, [de]
inc de
cp [hl]
inc hl
jr nz, .asm_1196b0
ld a, [de]
inc de
cp [hl]
inc hl
jr nz, .asm_1196b1
ret
.asm_1196af
inc hl
.asm_1196b0
inc hl
.asm_1196b1
inc b
ld a, b
cp $7
jr nz, .asm_119699
ret
pushc
setcharmap ascii
2018-06-24 07:09:41 -07:00
Unknown_1196b8:
2015-11-04 04:35:41 -08:00
db "Mon"
db "Tue"
db "Wed"
db "Thu"
db "Fri"
db "Sat"
db "Sun"
popc
2018-06-24 07:09:41 -07:00
Function1196cd:
ld de, wc719
2015-11-04 04:35:41 -08:00
call Function1196de
ld [wcd4a], a
inc de
call Function1196de
ld [wcd4b], a
ret
2018-06-24 07:09:41 -07:00
Function1196de:
2015-11-04 04:35:41 -08:00
ld a, [de]
inc de
2016-01-12 09:46:18 -08:00
; b = ([de] - 48) * 2
; c = ([de] - 48) * 10
2015-11-04 04:35:41 -08:00
sub $30
sla a
ld b, a
sla a
sla a
add b
ld c, a
add hl, bc
ld a, [de]
inc de
sub $30
add c
ret
2018-06-24 07:09:41 -07:00
Function1196f2:
2015-11-10 16:51:13 -08:00
ld hl, wd002
2015-11-04 04:35:41 -08:00
.asm_1196f5
call Function118b9a
ret nc
ld a, [hli]
cp $d
jr nz, .asm_1196f5
ld a, [hl]
cp $a
jr nz, .asm_1196f5
xor a
ld [hld], a
ld [hli], a
ld a, l
ld [wcd5b], a
ld a, h
ld [wcd5c], a
inc hl
ld e, l
ld d, h
ld a, [de]
inc de
cp $d
jr nz, .asm_119722
ld a, [de]
inc de
cp $a
jr nz, .asm_119722
ld a, $b
jp SetMobileErrorCode
2015-11-04 04:35:41 -08:00
.asm_119722
call Random
ld c, $0
ld b, c
.asm_119728
call Function119798
ld a, d
cp $ff
jr nz, .asm_119735
ld a, e
cp $ff
jr z, .asm_11974c
.asm_119735
ldh a, [hRandomSub]
2015-11-04 04:35:41 -08:00
cp d
jr c, .asm_11974c
jr z, .asm_11973e
jr .asm_119745
.asm_11973e
ldh a, [hRandomAdd]
2015-11-04 04:35:41 -08:00
cp e
jr c, .asm_11974c
jr z, .asm_11974c
.asm_119745
inc bc
ld a, c
or b
jr z, .asm_119770
jr .asm_119728
.asm_11974c
ld a, [wcd5b]
ld l, a
ld a, [wcd5c]
ld h, a
.asm_119754
ld a, [hld]
cp $58
jr nz, .asm_119754
ld d, $0
.asm_11975b
inc d
ld a, [hld]
cp $58
jr z, .asm_11975b
inc hl
2015-12-26 18:59:03 -08:00
inc hl
2015-11-04 04:35:41 -08:00
ld a, d
dec a
jr z, .asm_11978e
dec a
jr z, .asm_119785
dec a
jr z, .asm_11977e
dec a
jr z, .asm_119775
.asm_119770
ld a, $d3
jp SetMobileErrorCode
2015-11-04 04:35:41 -08:00
.asm_119775
ld a, b
and $f0
swap a
call Function1197bf
ld [hli], a
.asm_11977e
ld a, b
and $f
call Function1197bf
ld [hli], a
.asm_119785
ld a, c
and $f0
swap a
call Function1197bf
ld [hli], a
.asm_11978e
ld a, c
and $f
call Function1197bf
ld [hli], a
jp BattleTowerRoomMenu_IncrementJumptable
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
Function119798:
2015-11-04 04:35:41 -08:00
ld d, $0
ld e, d
call Function1197b4
swap a
or d
ld d, a
call Function1197b4
or d
ld d, a
call Function1197b4
swap a
or e
ld e, a
call Function1197b4
or e
ld e, a
ret
2018-06-24 07:09:41 -07:00
Function1197b4:
2015-11-04 04:35:41 -08:00
ld a, [hli]
cp $61
jr nc, .asm_1197bc
sub $30
ret
.asm_1197bc
sub $57
ret
2018-06-24 07:09:41 -07:00
Function1197bf:
2015-11-04 04:35:41 -08:00
cp $a
jr nc, .asm_1197c6
add $30
ret
.asm_1197c6
add $57
ret
2018-06-24 07:09:41 -07:00
Function1197c9:
2015-11-10 16:51:13 -08:00
ld hl, wd002
2015-11-04 04:35:41 -08:00
call Function118e39
ld a, $9
ld [wBattleTowerRoomMenu2JumptableIndex], a
2015-11-04 04:35:41 -08:00
ld a, $12
ld [wMobileInactivityTimerSeconds], a
call BattleTowerRoomMenu_IncrementJumptable
2015-11-04 04:35:41 -08:00
Function1197dc:
call BattleTowerRoomMenu2
2015-11-04 04:35:41 -08:00
ret c
call DelayFrame
2015-11-10 16:51:13 -08:00
ld hl, wd002
2015-11-04 04:35:41 -08:00
ld de, wcc60
ld bc, $0080
call CopyBytes
dec de
xor a
ld [de], a
call Function118b24
2015-12-08 13:06:13 -08:00
ld de, w3_d000
2015-11-04 04:35:41 -08:00
ld bc, $1000
ld a, $2a
jp Function119e2b
2018-06-24 07:09:41 -07:00
Function119800:
2015-11-04 04:35:41 -08:00
ld a, $fd
ld [wc6d0], a
ld [wOTTrademonSpecies], a
2015-11-04 04:35:41 -08:00
ld a, [wcd81]
ld [wc74e], a
ld a, [wJumptableIndex]
push af
ld a, [wcf64]
push af
ld a, [wcf65]
push af
ld a, [wBattleTowerRoomMenuJumptableIndex]
2015-11-04 04:35:41 -08:00
push af
ld a, $1
ldh [rSVBK], a
2015-11-04 04:35:41 -08:00
call FadeToMenu
2017-12-24 09:47:30 -08:00
farcall Function10803d
2015-11-04 04:35:41 -08:00
call Function11a9ce
call RestartMapMusic
ld a, BANK("Battle Tower RAM")
ldh [rSVBK], a
2015-11-04 04:35:41 -08:00
pop af
ld [wBattleTowerRoomMenuJumptableIndex], a
2015-11-04 04:35:41 -08:00
pop af
ld [wcf65], a
pop af
ld [wcf64], a
pop af
ld [wJumptableIndex], a
2017-12-24 09:47:30 -08:00
farcall Function115dc3
jp BattleTowerRoomMenu_IncrementJumptable
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
Function11984e:
2015-11-04 04:35:41 -08:00
ld a, [wcd80]
and a
jr nz, .asm_1198a0
ld a, [wcd38]
and a
jr nz, .asm_1198a8
2017-12-24 09:47:30 -08:00
farcall Function170000
2015-11-04 04:35:41 -08:00
ld a, [wJumptableIndex]
push af
ld a, [wcf64]
push af
ld a, [wcf65]
push af
ld a, [wBattleTowerRoomMenuJumptableIndex]
2015-11-04 04:35:41 -08:00
push af
ld a, $1
ldh [rSVBK], a
2015-11-04 04:35:41 -08:00
call FadeToMenu
2017-12-24 09:47:30 -08:00
farcall MobileTradeAnimation_SendGivemonToGTS
2015-11-04 04:35:41 -08:00
call Function11a9ce
call RestartMapMusic
ld a, BANK("Battle Tower RAM")
ldh [rSVBK], a
2015-11-04 04:35:41 -08:00
pop af
ld [wBattleTowerRoomMenuJumptableIndex], a
2015-11-04 04:35:41 -08:00
pop af
ld [wcf65], a
pop af
ld [wcf64], a
pop af
ld [wJumptableIndex], a
2017-12-24 09:47:30 -08:00
farcall Function115dc3
jp BattleTowerRoomMenu_IncrementJumptable
2015-11-04 04:35:41 -08:00
.asm_1198a0
ld a, $a
ld [wMobileErrorCodeBuffer], a
jp BattleTowerRoomMenu_IncrementJumptable
2015-11-04 04:35:41 -08:00
.asm_1198a8
2017-12-24 09:47:30 -08:00
farcall Function17005a
2015-11-04 04:35:41 -08:00
ld a, [wJumptableIndex]
push af
ld a, [wcf64]
push af
ld a, [wcf65]
push af
ld a, [wBattleTowerRoomMenuJumptableIndex]
2015-11-04 04:35:41 -08:00
push af
ld a, $1
ldh [rSVBK], a
2015-11-04 04:35:41 -08:00
call FadeToMenu
2017-12-24 09:47:30 -08:00
farcall MobileTradeAnimation_RetrieveGivemonFromGTS
2015-11-04 04:35:41 -08:00
call Function11a9ce
call RestartMapMusic
ld a, BANK("Battle Tower RAM")
ldh [rSVBK], a
2015-11-04 04:35:41 -08:00
pop af
ld [wBattleTowerRoomMenuJumptableIndex], a
2015-11-04 04:35:41 -08:00
pop af
ld [wcf65], a
pop af
ld [wcf64], a
pop af
ld [wJumptableIndex], a
2017-12-24 09:47:30 -08:00
farcall Function115dc3
jp BattleTowerRoomMenu_IncrementJumptable
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
Function1198ee:
ld hl, Text_RegisteringRecord
call BattleTowerRoomMenu_SetMessage
call BattleTowerRoomMenu_IncrementJumptable
2015-11-04 04:35:41 -08:00
Function1198f7:
ld a, [wc31a]
2015-11-04 04:35:41 -08:00
and a
ret nz
ld hl, wc608 + 2
2015-11-04 04:35:41 -08:00
call Function119940
2015-12-08 13:06:13 -08:00
ld hl, w3_d800
ld a, LOW(wc608)
2015-11-04 04:35:41 -08:00
ld [hli], a
ld a, HIGH(wc608)
2015-11-04 04:35:41 -08:00
ld [hli], a
ld a, $f6
ld [hli], a
xor a
ld [hli], a
ld a, LOW(wc708)
2015-11-04 04:35:41 -08:00
ld [hli], a
ld a, HIGH(wc708)
2015-11-04 04:35:41 -08:00
ld [hli], a
ld a, [wcd51]
ld [hli], a
ld a, [wcd52]
ld [hli], a
call Function119eb4
call Function119ec2
ld a, $40
ld [wcd89], a
2015-12-08 13:06:13 -08:00
ld hl, w3_d800
ld de, w3_de00
ld bc, $200
2015-11-04 04:35:41 -08:00
ld a, $2c
jp Function119e2b
2018-06-24 07:09:41 -07:00
Function119937:
2017-12-24 09:47:30 -08:00
farcall Function1707f4
jp BattleTowerRoomMenu_IncrementJumptable
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
Function119940:
2015-11-04 04:35:41 -08:00
ld de, wc3cd
ld c, $1e
.asm_119945
ld a, [de]
inc de
ld [hli], a
dec c
jr z, .asm_119953
and a
jr nz, .asm_119945
xor a
.asm_11994f
ld [hli], a
dec c
jr nz, .asm_11994f
.asm_119953
ret
2018-06-24 07:09:41 -07:00
Function119954:
2015-11-04 04:35:41 -08:00
ld a, $1c
ld [wBattleTowerRoomMenu2JumptableIndex], a
call BattleTowerRoomMenu2
ld hl, wc608
2015-11-04 04:35:41 -08:00
ld de, wc3cd
.asm_119962
ld a, [de]
inc de
ld [hli], a
and a
jr nz, .asm_119962
call Function119ec2
ld hl, wc608
2015-11-04 04:35:41 -08:00
ld a, $1e
jp Function119e2b
2018-06-24 07:09:41 -07:00
Function119973:
2015-11-04 04:35:41 -08:00
ld a, $1
ld [wcf64], a
xor a
ld [wcf65], a
2015-12-08 13:06:13 -08:00
ld [w3_d090], a
ld de, w3_d000
2015-11-04 04:35:41 -08:00
ld a, $20
jp Function119e2b
2018-06-24 07:09:41 -07:00
Function119987:
2015-12-08 13:06:13 -08:00
ld hl, w3_d000 + 1
ld a, [w3_d000]
2015-11-04 04:35:41 -08:00
or [hl]
jr z, .asm_1199a0
ld a, [wcf64]
ld l, a
ld a, [wcf65]
ld h, a
2018-01-01 06:08:21 -08:00
ld de, wBGPals2
2015-11-04 04:35:41 -08:00
ld a, $22
jp Function119e2b
.asm_1199a0
2015-12-08 13:06:13 -08:00
ld a, [w3_d090]
2015-11-04 04:35:41 -08:00
and a
jr z, .asm_1199ae
ld a, $16
ld [wBattleTowerRoomMenuJumptableIndex], a
2015-11-04 04:35:41 -08:00
jp Function119b0d
.asm_1199ae
ld a, $1b
ld [wBattleTowerRoomMenuJumptableIndex], a
2015-11-04 04:35:41 -08:00
ret
2018-06-24 07:09:41 -07:00
Function1199b4:
ld a, [w3_d081 + 1]
2015-11-04 04:35:41 -08:00
and a
jr nz, .asm_1199c7
2018-01-17 22:25:19 -08:00
ld a, [w3_d081]
2015-11-04 04:35:41 -08:00
cp $7
jr nc, .asm_1199c7
call BattleTowerRoomMenu_IncrementJumptable
2015-11-04 04:35:41 -08:00
jp Function1199ca
.asm_1199c7
jp Function119ac9
2018-06-24 07:09:41 -07:00
Function1199ca:
2015-11-04 04:35:41 -08:00
ld a, $20
ld [wcd89], a
ld a, [wcf64]
ld l, a
ld a, [wcf65]
ld h, a
2015-12-08 13:06:13 -08:00
ld de, w3_d100
2015-11-04 04:35:41 -08:00
ld bc, $0700
ld a, $28
jp Function119e2b
2018-06-24 07:09:41 -07:00
Function1199e2:
2015-11-04 04:35:41 -08:00
ld c, $c
ld de, XGameCodePrefix
2015-11-04 04:35:41 -08:00
call Function119e4f
jp c, Function119ac9
ld a, c
cp $1
jp nz, Function119ac9
ld hl, w3_d880
ld bc, XGameCode
.loop
2015-11-04 04:35:41 -08:00
ld a, [bc]
and a
jr z, .game_result_prefix
2015-11-04 04:35:41 -08:00
cp [hl]
jp nz, Function119ac9
inc bc
inc hl
jr .loop
2015-11-04 04:35:41 -08:00
.game_result_prefix
2015-11-04 04:35:41 -08:00
ld c, $17
ld de, XGameResultPrefix
2015-11-04 04:35:41 -08:00
call Function119e4f
jp c, .asm_119aa7
ld a, c
cp $1
jp nz, .asm_119aa7
ld a, [w3_d880]
2015-11-04 04:35:41 -08:00
cp $31
jp nz, .asm_119aa7
ld a, [w3_d881]
2015-11-04 04:35:41 -08:00
cp $20
jp nz, .asm_119aa7
ld a, [w3_d88a]
2015-11-04 04:35:41 -08:00
cp $20
jp nz, .asm_119aa7
ld a, [w3_d894]
2015-11-04 04:35:41 -08:00
cp $20
jp nz, .asm_119aa7
xor a
ld [w3_d8a0], a
ld [w3_d8a1], a
ld [w3_d8a2], a
ld [w3_d8a3], a
2018-01-02 22:38:59 -08:00
ld hl, w3_d8a0
ld bc, w3_d889
2015-11-04 04:35:41 -08:00
call Function119e98
call Function119e98
2018-01-02 22:38:59 -08:00
ld hl, w3_d8a0
2015-11-04 04:35:41 -08:00
ld a, [wcd2d]
cp [hl]
jr nz, Function119ac9
inc hl
ld a, [wcd2c]
cp [hl]
jr nz, Function119ac9
inc hl
ld a, [wcd2b]
cp [hl]
jr nz, Function119ac9
inc hl
ld a, [wcd2a]
cp [hl]
jr nz, Function119ac9
xor a
ld [w3_d8a0], a
ld [w3_d8a1], a
ld [w3_d8a2], a
ld [w3_d8a3], a
2018-01-02 22:38:59 -08:00
ld hl, w3_d8a0
ld bc, w3_d88e
2015-11-04 04:35:41 -08:00
call Function119e98
ld bc, w3_d893
2015-11-04 04:35:41 -08:00
call Function119e98
2018-01-02 22:38:59 -08:00
ld hl, w3_d8a0
2015-11-04 04:35:41 -08:00
ld a, [wcd2f]
cp [hl]
jr nz, .asm_119aa7
inc hl
ld a, [wcd2e]
cp [hl]
jr nz, .asm_119aa7
inc hl
ld a, [wcd31]
cp [hl]
jr nz, .asm_119aa7
inc hl
ld a, [wcd30]
cp [hl]
jr z, .asm_119aaf
.asm_119aa7
ld a, $25
ld [wBattleTowerRoomMenuJumptableIndex], a
2015-11-04 04:35:41 -08:00
jp Function119b45
.asm_119aaf
2015-12-08 13:06:13 -08:00
ld a, [w3_d090]
2015-11-04 04:35:41 -08:00
and a
jr nz, .asm_119aa7
2015-12-08 13:06:13 -08:00
ld a, [w3_d895]
2015-11-04 04:35:41 -08:00
sub $30
2015-12-08 13:06:13 -08:00
ld [w3_d090], a
2015-11-04 04:35:41 -08:00
ld a, [wcf64]
2015-12-08 13:06:13 -08:00
ld [w3_d090 + 1], a
2015-11-04 04:35:41 -08:00
ld a, [wcf65]
2015-12-08 13:06:13 -08:00
ld [w3_d090 + 2], a
2015-11-04 04:35:41 -08:00
Function119ac9:
2015-12-08 13:06:13 -08:00
ld a, [w3_d000]
2015-11-04 04:35:41 -08:00
ld l, a
2015-12-08 13:06:13 -08:00
ld a, [w3_d000 + 1]
2015-11-04 04:35:41 -08:00
ld h, a
dec hl
ld a, l
2015-12-08 13:06:13 -08:00
ld [w3_d000], a
2015-11-04 04:35:41 -08:00
ld a, h
2015-12-08 13:06:13 -08:00
ld [w3_d000 + 1], a
2015-11-04 04:35:41 -08:00
ld a, [wcf64]
ld l, a
ld a, [wcf65]
ld h, a
inc hl
ld a, l
ld [wcf64], a
ld a, h
ld [wcf65], a
ld a, $10
ld [wBattleTowerRoomMenuJumptableIndex], a
2015-11-04 04:35:41 -08:00
ret
pushc
setcharmap ascii
XGameCode:
db "CGB-BXTJ-00", $0
XGameResult:
db "pokemon_crystal", $0
popc
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
Function119b0d:
2015-11-04 04:35:41 -08:00
ld a, $8
ld [wBattleTowerRoomMenu2JumptableIndex], a
call BattleTowerRoomMenu2
2015-12-08 13:06:13 -08:00
ld a, [w3_d090]
2015-11-04 04:35:41 -08:00
cp $1
jr z, .asm_119b23
ld a, $19
ld [wBattleTowerRoomMenuJumptableIndex], a
2015-11-04 04:35:41 -08:00
jr Function119b3b
.asm_119b23
ld a, $10
ld [wcd89], a
2015-12-08 13:06:13 -08:00
ld a, [w3_d090 + 1]
2015-11-04 04:35:41 -08:00
ld l, a
2015-12-08 13:06:13 -08:00
ld a, [w3_d090 + 2]
2015-11-04 04:35:41 -08:00
ld h, a
2015-12-08 13:06:13 -08:00
ld de, w3_d100
2015-11-04 04:35:41 -08:00
ld bc, $0700
ld a, $24
jp Function119e2b
Function119b3b:
2015-12-08 13:06:13 -08:00
ld a, [w3_d090 + 1]
2015-11-04 04:35:41 -08:00
ld l, a
2015-12-08 13:06:13 -08:00
ld a, [w3_d090 + 2]
2015-11-04 04:35:41 -08:00
ld h, a
jr asm_119b4d
Function119b45:
ld a, [wcf64]
ld l, a
ld a, [wcf65]
ld h, a
2018-10-24 12:33:18 -07:00
asm_119b4d:
2015-11-04 04:35:41 -08:00
ld a, $26
jp Function119e2b
2018-06-24 07:09:41 -07:00
Function119b52:
2015-12-08 13:06:13 -08:00
ld a, [w3_d090]
2015-11-04 04:35:41 -08:00
cp $1
jr nz, .asm_119b66
2019-09-01 08:51:15 -07:00
ld a, BANK(s5_a800)
call OpenSRAM
2015-11-04 04:35:41 -08:00
ld a, $4
2019-09-01 08:51:15 -07:00
ld [s5_a800], a
2015-11-04 04:35:41 -08:00
call CloseSRAM
.asm_119b66
ld a, $1c
jp Function119e2b
2018-06-24 07:09:41 -07:00
Function119b6b:
2015-12-08 13:06:13 -08:00
ld a, [w3_d090]
2015-11-04 04:35:41 -08:00
cp $1
jr z, .asm_119b75
jp BattleTowerRoomMenu_IncrementJumptable
2015-11-04 04:35:41 -08:00
.asm_119b75
2015-12-08 13:06:13 -08:00
ld a, [w3_d100]
2015-11-04 04:35:41 -08:00
ld b, a
2015-12-08 13:06:13 -08:00
ld a, [w3_d100 + 1]
2015-11-04 04:35:41 -08:00
or b
jr z, .asm_119be3
2015-12-08 13:06:13 -08:00
ld hl, w3_d800
ld de, w3_d100 + 2
2015-11-04 04:35:41 -08:00
.asm_119b85
ld a, [de]
inc de
cp $d
jr nz, .asm_119b85
inc de
ld a, [de]
cp $d
jr nz, .asm_119b85
inc de
2015-12-26 18:59:03 -08:00
inc de
2015-11-04 04:35:41 -08:00
.asm_119b93
ld a, [de]
inc de
cp $d
jr z, .asm_119bfa
call .decodeBase64Character
2015-11-04 04:35:41 -08:00
ret c
ld [hli], a
ld a, [de]
inc de
call .decodeBase64Character
2015-11-04 04:35:41 -08:00
ret c
ld [hli], a
ld a, [de]
inc de
call .decodeBase64Character
2015-11-04 04:35:41 -08:00
ret c
ld [hli], a
ld a, [de]
inc de
call .decodeBase64Character
2015-11-04 04:35:41 -08:00
ret c
ld [hl], a
push de
ld d, [hl]
dec hl
ld c, [hl]
dec hl
ld b, [hl]
dec hl
ld a, [hl]
sla b
sla b
sla b
rla
sla b
rla
ld [hli], a
ld [hl], b
inc hl
rrc c
rrc c
ld [hl], c
dec hl
ld a, $f
and c
or [hl]
ld [hli], a
ld a, [hli]
and $c0
or [hl]
dec hl
ld [hld], a
dec hl
pop de
inc hl
inc hl
inc hl
2015-11-04 04:35:41 -08:00
ld a, h
cp $e0
jr c, .asm_119b93
.asm_119be3
ld a, $19
ld [wBattleTowerRoomMenuJumptableIndex], a
2019-09-01 08:51:15 -07:00
ld a, BANK(s5_a800)
call OpenSRAM
2015-11-04 04:35:41 -08:00
ld a, $1
2019-09-01 08:51:15 -07:00
ld [s5_a800], a
2015-11-04 04:35:41 -08:00
call CloseSRAM
xor a
2015-12-08 13:06:13 -08:00
ld [w3_d090], a
2015-11-04 04:35:41 -08:00
ret
.asm_119bfa
inc de
ld a, [de]
cp $d
jr nz, .asm_119b93
ld a, l
cp LOW(w3_d869)
2015-11-04 04:35:41 -08:00
jr nz, .asm_119be3
ld a, h
cp HIGH(w3_d869)
2015-11-04 04:35:41 -08:00
jr nz, .asm_119be3
ld a, BANK(s5_b090) ; aka BANK(s5_b091) and BANK(s5_b023)
call OpenSRAM
2015-11-04 04:35:41 -08:00
ld a, [wcf64]
ld [s5_b090], a
2015-11-04 04:35:41 -08:00
ld a, [wcf65]
ld [s5_b091], a
2015-12-08 13:06:13 -08:00
ld hl, w3_d800
ld de, s5_b023
ld bc, 105
2015-11-04 04:35:41 -08:00
call CopyBytes
ld a, $3
ld [s5_a800], a
2015-11-04 04:35:41 -08:00
call CloseSRAM
2015-12-08 13:06:13 -08:00
ld hl, w3_d800
ld de, wc608
ld bc, 105
2015-11-04 04:35:41 -08:00
call CopyBytes
jp BattleTowerRoomMenu_IncrementJumptable
2015-11-04 04:35:41 -08:00
pushc
setcharmap ascii
.decodeBase64Character
cp "+"
2015-11-04 04:35:41 -08:00
jr c, .asm_119c68
jr z, .asm_119c80
cp "/"
2015-11-04 04:35:41 -08:00
jr c, .asm_119c68
jr z, .asm_119c84
cp "0"
2015-11-04 04:35:41 -08:00
jr c, .asm_119c68
cp "9" + 1
2015-11-04 04:35:41 -08:00
jr c, .asm_119c88
cp "="
2015-11-04 04:35:41 -08:00
jr c, .asm_119c68
jr z, .asm_119c8c
cp "A"
2015-11-04 04:35:41 -08:00
jr c, .asm_119c68
cp "Z" + 1
2015-11-04 04:35:41 -08:00
jr c, .asm_119c8f
cp "a"
2015-11-04 04:35:41 -08:00
jr c, .asm_119c68
cp "z" + 1
2015-11-04 04:35:41 -08:00
jr c, .asm_119c93
popc
2015-11-04 04:35:41 -08:00
.asm_119c68
ld a, $19
ld [wBattleTowerRoomMenuJumptableIndex], a
2019-09-01 08:51:15 -07:00
ld a, BANK(s5_a800)
call OpenSRAM
2015-11-04 04:35:41 -08:00
ld a, $1
2019-09-01 08:51:15 -07:00
ld [s5_a800], a
2015-11-04 04:35:41 -08:00
call CloseSRAM
xor a
2015-12-08 13:06:13 -08:00
ld [w3_d090], a
2015-11-04 04:35:41 -08:00
scf
ret
.asm_119c80
ld a, $3e
and a
ret
.asm_119c84
ld a, $3f
and a
ret
.asm_119c88
add $4
and a
ret
.asm_119c8c
xor a
and a
ret
.asm_119c8f
sub $41
and a
ret
.asm_119c93
sub $47
and a
ret
2018-06-24 07:09:41 -07:00
BattleTowerRoomMenu_UberRestrictionMessage:
ld hl, Text_UberRestriction
call BattleTowerRoomMenu_SetMessage
call BattleTowerRoomMenu_IncrementJumptable
jr BattleTowerRoomMenu_WaitForMessage
2015-11-04 04:35:41 -08:00
BattleTowerRoomMenu_PartyMonTopsThisLevelMessage:
ld hl, Text_PartyMonTopsThisLevel
call BattleTowerRoomMenu_SetMessage
call BattleTowerRoomMenu_IncrementJumptable
2015-11-04 04:35:41 -08:00
BattleTowerRoomMenu_WaitForMessage:
ld a, [wc31a]
2015-11-04 04:35:41 -08:00
and a
ret nz
ld a, $80
ld [wcd50], a
call BattleTowerRoomMenu_IncrementJumptable
2015-11-04 04:35:41 -08:00
BattleTowerRoomMenu_DelayRestartMenu:
2019-06-04 04:31:22 -07:00
; Loops while (--[wcd50] != 0),
; to create some sort of "delay" after the message is written on the screen,
; before starting the menu again.
2015-11-04 04:35:41 -08:00
ld hl, wcd50
dec [hl]
ret nz
ld a, $0
ld [wBattleTowerRoomMenuJumptableIndex], a
2015-11-04 04:35:41 -08:00
ret
2018-06-24 07:09:41 -07:00
BattleTowerRoomMenu_QuitMessage:
2015-11-04 04:35:41 -08:00
ld a, [wcd38]
and a
jr z, .asm_119cd1
dec a
jr z, .asm_119cd6
ld hl, Text_QuitReadingNews
2015-11-04 04:35:41 -08:00
jr .asm_119cd9
.asm_119cd1
ld hl, Text_CancelBattleRoomChallenge
2015-11-04 04:35:41 -08:00
jr .asm_119cd9
.asm_119cd6
ld hl, Text_ExitGymLeaderHonorRoll
2015-11-04 04:35:41 -08:00
.asm_119cd9
call BattleTowerRoomMenu_SetMessage
call BattleTowerRoomMenu_IncrementJumptable
2015-11-04 04:35:41 -08:00
BattleTowerRoomMenu_PlaceYesNoMenu:
ld a, [wc31a]
2015-11-04 04:35:41 -08:00
and a
ret nz
ld a, $f
ld [wBattleTowerRoomMenu2JumptableIndex], a
call BattleTowerRoomMenu_IncrementJumptable
2015-11-04 04:35:41 -08:00
BattleTowerRoomMenu_UpdateYesNoMenu:
; Only ever called when [wBattleTowerRoomMenu2JumptableIndex] is $10
call BattleTowerRoomMenu2
2015-11-04 04:35:41 -08:00
ret c
ld a, [wMobileInactivityTimerFrames]
ld [wBattleTowerRoomMenuJumptableIndex], a
2015-11-04 04:35:41 -08:00
ret
2018-06-24 07:09:41 -07:00
MenuHeader_119cf7:
db MENU_BACKUP_TILES ; flags
menu_coords 12, 7, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
2015-11-04 04:35:41 -08:00
dw NULL
db 0 ; default option
2018-06-24 07:09:41 -07:00
MenuData_119cff:
db MENU_BACKUP_TILES ; flags
menu_coords 15, 7, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
2015-11-04 04:35:41 -08:00
dw NULL
db 0 ; default option
String_119d07:
db " ▼@"
2018-06-24 07:09:41 -07:00
Strings_L10ToL100:
2015-11-04 04:35:41 -08:00
db " L:10 @@"
db " L:20 @@"
db " L:30 @@"
db " L:40 @@"
db " L:50 @@"
db " L:60 @@"
db " L:70 @@"
db " L:80 @@"
db " L:90 @@"
db " L:100@@"
db "CANCEL@@"
2018-06-24 07:09:41 -07:00
Strings_Ll0ToL40:
2015-11-04 04:35:41 -08:00
db " L:10 @@"
db " L:20 @@"
db " L:30 @@"
db " L:40 @@"
db "CANCEL@@"
BattleTowerCancelString: ; unreferenced
2015-11-04 04:35:41 -08:00
db "CANCEL@"
2018-06-24 07:09:41 -07:00
BattleTower_LevelCheck:
ldh a, [rSVBK]
2015-11-04 04:35:41 -08:00
push af
ld a, BANK(wPartyMons)
ldh [rSVBK], a
2015-11-04 04:35:41 -08:00
ld a, [wcd4f]
ld c, 10
call SimpleMultiply
ld hl, wcd50
ld [hl], a
ld bc, PARTYMON_STRUCT_LENGTH
2018-01-23 14:39:09 -08:00
ld de, wPartyMon1Level
ld a, [wPartyCount]
2015-11-26 18:05:32 -08:00
.party_loop
2015-11-04 04:35:41 -08:00
push af
ld a, [de]
push hl
push de
pop hl
add hl, bc
push hl
pop de
pop hl
cp [hl]
2015-11-26 18:05:32 -08:00
jr z, .equal
jr nc, .exceeds
.equal
2015-11-04 04:35:41 -08:00
pop af
dec a
2015-11-26 18:05:32 -08:00
jr nz, .party_loop
2015-11-04 04:35:41 -08:00
pop af
ldh [rSVBK], a
2015-11-04 04:35:41 -08:00
and a
ret
2015-11-26 18:05:32 -08:00
.exceeds
2015-11-04 04:35:41 -08:00
pop af
ld a, $4
ld [wBattleTowerRoomMenuJumptableIndex], a
2015-11-04 04:35:41 -08:00
pop af
ldh [rSVBK], a
2015-11-04 04:35:41 -08:00
scf
ret
2018-06-24 07:09:41 -07:00
BattleTower_UbersCheck:
ldh a, [rSVBK]
2015-11-04 04:35:41 -08:00
push af
ld a, [wcd4f]
cp 70 / 10
2015-11-26 18:05:32 -08:00
jr nc, .level_70_or_more
ld a, BANK(wPartyMons)
ldh [rSVBK], a
2018-01-23 14:39:09 -08:00
ld hl, wPartyMon1Level
ld bc, PARTYMON_STRUCT_LENGTH
2018-01-23 14:39:09 -08:00
ld de, wPartySpecies
ld a, [wPartyCount]
2015-11-26 18:05:32 -08:00
.loop
2015-11-04 04:35:41 -08:00
push af
ld a, [de]
cp MEWTWO
2015-11-26 18:05:32 -08:00
jr z, .uber
2015-11-04 04:35:41 -08:00
cp MEW
2015-11-26 18:05:32 -08:00
jr z, .uber
2015-11-04 04:35:41 -08:00
cp LUGIA
2015-11-26 18:05:32 -08:00
jr c, .next
2015-11-04 04:35:41 -08:00
cp NUM_POKEMON + 1
2015-11-26 18:05:32 -08:00
jr nc, .next
.uber
2015-11-04 04:35:41 -08:00
ld a, [hl]
cp 70
2015-11-26 18:05:32 -08:00
jr c, .uber_under_70
.next
2015-11-04 04:35:41 -08:00
add hl, bc
inc de
pop af
dec a
2015-11-26 18:05:32 -08:00
jr nz, .loop
.level_70_or_more
2015-11-04 04:35:41 -08:00
pop af
ldh [rSVBK], a
2015-11-04 04:35:41 -08:00
and a
ret
2015-11-26 18:05:32 -08:00
.uber_under_70
2015-11-04 04:35:41 -08:00
pop af
ld a, [de]
ld [wNamedObjectIndexBuffer], a
2015-11-04 04:35:41 -08:00
call GetPokemonName
2018-01-23 14:39:09 -08:00
ld hl, wStringBuffer1
2015-11-04 04:35:41 -08:00
ld de, wcd49
2018-01-20 09:25:55 -08:00
ld bc, MON_NAME_LENGTH
2015-11-04 04:35:41 -08:00
call CopyBytes
ld a, $a
ld [wBattleTowerRoomMenuJumptableIndex], a
2015-11-04 04:35:41 -08:00
pop af
ldh [rSVBK], a
2015-11-04 04:35:41 -08:00
scf
ret
2018-06-24 07:09:41 -07:00
Function119e2b:
2015-11-04 04:35:41 -08:00
call Function3e32
2018-06-24 07:09:41 -07:00
BattleTowerRoomMenu_IncrementJumptable:
ld hl, wBattleTowerRoomMenuJumptableIndex
2015-11-04 04:35:41 -08:00
inc [hl]
ret
pushc
setcharmap ascii
2018-06-24 07:09:41 -07:00
XGameCodePrefix:
db "X-Game-code:\n"
2018-06-24 07:09:41 -07:00
XGameResultPrefix:
db "X-Game-result:\n"
popc
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
Function119e4f:
2015-11-04 04:35:41 -08:00
push bc
2015-12-08 13:06:13 -08:00
ld hl, w3_d100
2015-11-04 04:35:41 -08:00
ld a, [hli]
ld c, a
ld a, [hli]
ld b, a
.loop
2015-11-04 04:35:41 -08:00
ld a, [de]
cp [hl]
jr z, .found_equality
.next
2015-11-04 04:35:41 -08:00
inc hl
dec bc
ld a, b
or c
jr nz, .loop
.return_carry
2015-11-04 04:35:41 -08:00
pop bc
scf
ret
.found_equality
2015-11-04 04:35:41 -08:00
push de
.loop2
2015-11-04 04:35:41 -08:00
ld a, [de]
inc de
cp "\n"
jr z, .newline
2015-11-04 04:35:41 -08:00
cp [hl]
jr nz, .unequal
2015-11-04 04:35:41 -08:00
inc hl
dec bc
ld a, b
or c
jr nz, .loop2
2015-11-04 04:35:41 -08:00
pop de
jr .return_carry
2015-11-04 04:35:41 -08:00
.unequal
2015-11-04 04:35:41 -08:00
pop de
jr .next
2015-11-04 04:35:41 -08:00
.newline
2015-11-04 04:35:41 -08:00
pop de
pop bc
inc hl
ld de, w3_d880
.loop3
2015-11-04 04:35:41 -08:00
ld a, [hli]
ld [de], a
inc de
cp $d
jr z, .finish
2015-11-04 04:35:41 -08:00
dec c
jr nz, .loop3
2015-11-04 04:35:41 -08:00
scf
ret
.finish
2015-11-04 04:35:41 -08:00
and a
ret
2018-06-24 07:09:41 -07:00
Function119e8e:
2015-11-04 04:35:41 -08:00
cp $60
jr c, .less_than_0x60
2015-11-04 04:35:41 -08:00
sub $57
ret
.less_than_0x60
2015-11-04 04:35:41 -08:00
sub $30
ret
2018-06-24 07:09:41 -07:00
Function119e98:
2015-11-04 04:35:41 -08:00
ld a, $2
.loop
2015-11-04 04:35:41 -08:00
push af
ld a, [bc]
dec bc
call Function119e8e
or [hl]
ld [hl], a
ld a, [bc]
dec bc
call Function119e8e
rlca
rlca
rlca
rlca
or [hl]
ld [hl], a
inc hl
pop af
dec a
and a
jr nz, .loop
2015-11-04 04:35:41 -08:00
ret
2018-06-24 07:09:41 -07:00
Function119eb4:
2015-11-04 04:35:41 -08:00
xor a
ld [wc3cc], a
ld de, wc3ac
.loop
2015-11-04 04:35:41 -08:00
ld a, [de]
inc de
ld [hli], a
and a
jr nz, .loop
2015-11-04 04:35:41 -08:00
ret
2018-06-24 07:09:41 -07:00
Function119ec2:
ld a, BANK(sMobileLoginPassword)
call OpenSRAM
2015-11-04 04:35:41 -08:00
xor a
ld [sMobileLoginPassword + MOBILE_LOGIN_PASSWORD_LENGTH], a
ld de, sMobileLoginPassword + 1
.loop
2015-11-04 04:35:41 -08:00
ld a, [de]
inc de
ld [hli], a
and a
jr nz, .loop
2015-11-04 04:35:41 -08:00
call CloseSRAM
ret
2018-06-24 07:09:41 -07:00
BattleTowerRoomMenu2:
ldh a, [rSVBK]
2015-11-04 04:35:41 -08:00
ld [wcd8c], a
ld a, $1
ldh [rSVBK], a
2015-12-26 18:59:03 -08:00
call .RunJumptable
2015-11-04 04:35:41 -08:00
ld a, [wcd8c]
ldh [rSVBK], a
2015-11-04 04:35:41 -08:00
ld a, $1
ldh [hBGMapMode], a
2015-11-04 04:35:41 -08:00
ret
.RunJumptable:
jumptable .Jumptable, wBattleTowerRoomMenu2JumptableIndex
2015-11-04 04:35:41 -08:00
.Jumptable:
2015-11-04 04:35:41 -08:00
dw Function119f3f
dw Function119f45
dw Function119f56
dw Function119f76
dw Function119f98
dw Function11a113
dw Function11a129
dw Function11a131
dw Function11a13d
dw Function11a14b
dw Function11a16d
dw Function11a192
dw Function11a2e6
dw Function11a302
dw Function11a33a
dw BattleTowerRoomMenu2_PlaceYesNoMenu
dw BattleTowerRoomMenu2_UpdateYesNoMenu
2015-11-04 04:35:41 -08:00
dw Function11a357
dw Function11a36b
dw Function11a38d
dw Function11a3c5
dw Function11a3d9
dw Function11a3f9
dw Function11a41b
dw Function11a452
dw Function11a47a
dw Function11a488
dw Function11a49e
dw Function11a4db
dw Function11a4e8
dw Function11a4fe
dw Function11a466
dw Function11a47a
2018-06-24 07:09:41 -07:00
Function119f3f:
2015-11-04 04:35:41 -08:00
call Function11a5b9
jp BattleTowerRoomMenu2_IncrementJumptable
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
Function119f45:
2015-11-04 04:35:41 -08:00
hlcoord 4, 2
ld de, String_11a661
call PlaceString
ld a, $80
ld [wMobileInactivityTimerMinutes], a
jp BattleTowerRoomMenu2_IncrementJumptable
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
Function119f56:
ld a, [wMobileInactivityTimerMinutes]
2015-11-04 04:35:41 -08:00
and a
jr z, .asm_119f62
dec a
ld [wMobileInactivityTimerMinutes], a
2015-11-04 04:35:41 -08:00
scf
ret
.asm_119f62
call Function11a63c
hlcoord 4, 2
ld de, String_11a6aa
call PlaceString
ld a, $80
ld [wMobileInactivityTimerMinutes], a
jp BattleTowerRoomMenu2_IncrementJumptable
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
Function119f76:
ld a, [wMobileInactivityTimerMinutes]
2015-11-04 04:35:41 -08:00
and a
jr z, .asm_119f82
dec a
ld [wMobileInactivityTimerMinutes], a
2015-11-04 04:35:41 -08:00
scf
ret
.asm_119f82
call Function11a63c
hlcoord 4, 2
ld de, String_11a679
call PlaceString
call Function11a5f5
xor a
ld [wMobileInactivityTimerMinutes], a
jp BattleTowerRoomMenu2_IncrementJumptable
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
Function119f98:
2015-11-04 04:35:41 -08:00
call Function11a536
ret c
call PlayClickSFX
ld a, [wMobileInactivityTimerMinutes]
2015-11-04 04:35:41 -08:00
and a
jr nz, .asm_119fef
call ExitMenu
call Function11a63c
xor a
2018-01-23 14:39:09 -08:00
ld [wScriptVar], a
2015-11-04 04:35:41 -08:00
call Function11a00e
2018-01-23 14:39:09 -08:00
ld a, [wScriptVar]
2015-11-04 04:35:41 -08:00
and a
jr z, .asm_119fd4
call ExitMenu
2017-12-24 09:47:30 -08:00
farcall ReloadMapPart
farcall Function115dc3
2015-11-04 04:35:41 -08:00
ld a, [wcd33]
ld [wcf66], a
ld a, $a
ld [wMobileErrorCodeBuffer], a
2015-11-04 04:35:41 -08:00
scf
ret
.asm_119fd4
hlcoord 4, 2
ld de, String_11a692
call PlaceString
ld a, $1
ld [wc30d], a
ld a, $1
2015-11-11 11:12:46 -08:00
ld [wc314], a
2017-12-24 09:47:30 -08:00
farcall ReloadMapPart
2015-11-04 04:35:41 -08:00
and a
ret
.asm_119fef
call ExitMenu
call ExitMenu
2017-12-24 09:47:30 -08:00
farcall ReloadMapPart
ld a, [wMobileInactivityTimerSeconds]
2015-11-04 04:35:41 -08:00
ld [wcf66], a
2017-12-24 09:47:30 -08:00
farcall Function115dc3
2015-11-04 04:35:41 -08:00
ld a, $a
ld [wMobileErrorCodeBuffer], a
2015-11-04 04:35:41 -08:00
scf
ret
2018-06-24 07:09:41 -07:00
Function11a00e:
ld a, BANK(sMobileLoginPassword)
call OpenSRAM
ld a, [sMobileLoginPassword]
2015-11-04 04:35:41 -08:00
and a
jr z, .asm_11a02a
ld a, [sMobileLoginPassword + 1]
2015-11-04 04:35:41 -08:00
call CloseSRAM
and a
ret nz
ld a, BANK(sMobileLoginPassword)
call OpenSRAM
2015-11-04 04:35:41 -08:00
xor a
ld [sMobileLoginPassword], a
2015-11-04 04:35:41 -08:00
.asm_11a02a
call CloseSRAM
2018-01-23 14:39:09 -08:00
ld a, [wBGMapPalBuffer]
2015-11-04 04:35:41 -08:00
and a
jr z, .asm_11a039
dec a
jr z, .asm_11a081
jp Function11a0ca
.asm_11a039
ld a, BANK(w3_d800)
ldh [rSVBK], a
ld hl, wc608
2015-12-08 13:06:13 -08:00
ld de, w3_d800
ld bc, 246
2015-11-04 04:35:41 -08:00
call CopyBytes
ld a, $1
ldh [rSVBK], a
2015-11-04 04:35:41 -08:00
call FadeToMenu
2017-12-24 09:47:30 -08:00
farcall Function11765d
2015-11-04 04:35:41 -08:00
call Function11a9ce
ld a, BANK(w3_d800)
ldh [rSVBK], a
2015-12-08 13:06:13 -08:00
ld hl, w3_d800
ld de, wc608
ld bc, 246
2015-11-04 04:35:41 -08:00
call CopyBytes
ld a, $1
ldh [rSVBK], a
2017-12-24 09:47:30 -08:00
farcall Function115d99
2015-11-04 04:35:41 -08:00
ld c, $0
2017-12-24 09:47:30 -08:00
farcall Function115e18
2015-11-04 04:35:41 -08:00
ld a, $1
ld [wc305], a
ret
.asm_11a081
xor a
ld [wMenuBorderLeftCoord], a
ld [wMenuBorderTopCoord], a
ld a, $13
ld [wMenuBorderRightCoord], a
ld a, $5
ld [wMenuBorderBottomCoord], a
2015-12-22 19:19:33 -08:00
call PushWindow
2017-12-24 09:47:30 -08:00
farcall Function11765d
farcall Function117ab4
farcall Stubbed_Function106462
2017-12-24 09:47:30 -08:00
farcall Function106464
2015-11-04 04:35:41 -08:00
call ExitMenu
2017-12-24 09:47:30 -08:00
farcall ReloadMapPart
farcall Function115d99
2015-11-04 04:35:41 -08:00
ld c, $0
2017-12-24 09:47:30 -08:00
farcall Function115e18
2015-11-04 04:35:41 -08:00
ld a, $1
ld [wc305], a
ret
2018-06-24 07:09:41 -07:00
Function11a0ca:
2015-11-04 04:35:41 -08:00
xor a
ld [wMenuBorderLeftCoord], a
ld [wMenuBorderTopCoord], a
ld a, $13
ld [wMenuBorderRightCoord], a
ld a, $11
ld [wMenuBorderBottomCoord], a
2015-12-22 19:19:33 -08:00
call PushWindow
2017-12-24 09:47:30 -08:00
farcall Function11765d
farcall Function17d3f6
farcall Stubbed_Function106462
2017-12-24 09:47:30 -08:00
farcall Function106464
2015-11-04 04:35:41 -08:00
call ExitMenu
2017-12-24 09:47:30 -08:00
farcall ReloadMapPart
farcall Function115d99
2015-11-04 04:35:41 -08:00
ld c, $0
2017-12-24 09:47:30 -08:00
farcall Function115e18
2015-11-04 04:35:41 -08:00
ld a, $1
ld [wc305], a
ret
2018-06-24 07:09:41 -07:00
Function11a113:
2015-11-04 04:35:41 -08:00
call Function11a63c
ld c, $1
2017-12-24 09:47:30 -08:00
farcall Function115e18
2015-11-04 04:35:41 -08:00
hlcoord 4, 2
ld de, String_11a6c8
call PlaceString
and a
ret
2018-06-24 07:09:41 -07:00
Function11a129:
2015-11-04 04:35:41 -08:00
ld a, $80
ld [wMobileInactivityTimerMinutes], a
jp BattleTowerRoomMenu2_IncrementJumptable
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
Function11a131:
ld hl, wMobileInactivityTimerMinutes
2015-11-04 04:35:41 -08:00
dec [hl]
ret nz
ld a, [wBattleTowerRoomMenu2JumptableIndex]
2015-11-04 04:35:41 -08:00
inc a
ld [wBattleTowerRoomMenu2JumptableIndex], a
2015-11-04 04:35:41 -08:00
Function11a13d:
call Function11a63c
hlcoord 4, 2
ld de, String_11a6d2
call PlaceString
and a
ret
2018-06-24 07:09:41 -07:00
Function11a14b:
2015-11-04 04:35:41 -08:00
ld hl, wcd85
ld a, [hl]
cp $f3
jr nz, .asm_11a155
and a
ret
.asm_11a155
call Function11a1d6
ret c
call Function11a63c
hlcoord 4, 2
ld de, String_11a6f1
call PlaceString
ld a, $80
ld [wMobileInactivityTimerMinutes], a
jp BattleTowerRoomMenu2_IncrementJumptable
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
Function11a16d:
ld a, [wMobileInactivityTimerMinutes]
2015-11-04 04:35:41 -08:00
and a
jr z, .asm_11a179
dec a
ld [wMobileInactivityTimerMinutes], a
2015-11-04 04:35:41 -08:00
scf
ret
.asm_11a179
call Function11a63c
call Function11a1e6
hlcoord 4, 2
ld de, wc346
2015-11-04 04:35:41 -08:00
call PlaceString
call Function11a5f5
xor a
ld [wMobileInactivityTimerMinutes], a
jp BattleTowerRoomMenu2_IncrementJumptable
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
Function11a192:
2015-11-04 04:35:41 -08:00
call Function11a536
ret c
call PlayClickSFX
ld a, [wMobileInactivityTimerMinutes]
2015-11-04 04:35:41 -08:00
and a
jr nz, .asm_11a1b6
call ExitMenu
2017-12-24 09:47:30 -08:00
farcall ReloadMapPart
2015-11-04 04:35:41 -08:00
call Function11a63c
hlcoord 4, 2
ld de, String_11a6d2
call PlaceString
and a
ret
.asm_11a1b6
call ExitMenu
2017-12-24 09:47:30 -08:00
farcall ReloadMapPart
ld a, [wMobileInactivityTimerSeconds]
2015-11-04 04:35:41 -08:00
ld [wcf66], a
ld [wcd80], a
call Function11a63c
hlcoord 4, 2
ld de, String_11a6d2
call PlaceString
scf
ret
2018-06-24 07:09:41 -07:00
Function11a1d6:
2015-11-04 04:35:41 -08:00
ld a, [wcd85]
cp $50
jr nz, .asm_11a1e4
ld a, $d3
call SetMobileErrorCode
2015-11-04 04:35:41 -08:00
scf
ret
.asm_11a1e4
and a
ret
2018-06-24 07:09:41 -07:00
Function11a1e6:
2015-11-04 04:35:41 -08:00
ld hl, String_11a706
ld de, wc346
2015-11-04 04:35:41 -08:00
call Function11a1ff
ld hl, wcd85
call Function11a1ff
ld hl, String_11a70b
call Function11a1ff
ld a, $50
ld [de], a
ret
2018-06-24 07:09:41 -07:00
Function11a1ff:
2015-11-04 04:35:41 -08:00
.asm_11a1ff
ld a, [hli]
cp $50
ret z
ld [de], a
inc de
jr .asm_11a1ff
2018-06-24 07:09:41 -07:00
BattleTowerRoomMenu2_PlaceYesNoMenu:
ld hl, MenuHeader_11a2de
call LoadMenuHeader
2015-11-04 11:02:11 -08:00
call MenuBox
call MenuBoxCoord2Tile
2015-11-25 07:16:29 -08:00
call ApplyTilemap
2015-11-04 04:35:41 -08:00
hlcoord 16, 8
ld de, String_11a2cf
call PlaceString
hlcoord 16, 10
ld de, String_11a2d3
call PlaceString
hlcoord 15, 8
ld a, $ed
ld [hl], a
xor a
ld [wMobileInactivityTimerMinutes], a
jp BattleTowerRoomMenu2_IncrementJumptable
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
BattleTowerRoomMenu2_UpdateYesNoMenu:
2015-11-04 04:35:41 -08:00
ld hl, hJoyPressed
ld a, [hl]
and A_BUTTON
jr nz, .a_button
2015-11-04 04:35:41 -08:00
ld a, [hl]
and B_BUTTON
jr nz, .b_button
2015-11-04 04:35:41 -08:00
ld a, [hl]
and D_UP
jr nz, .d_up
2015-11-04 04:35:41 -08:00
ld a, [hl]
and D_DOWN
jr nz, .d_down
2015-11-04 04:35:41 -08:00
.asm_11a24c
call Function11a9f0
scf
ret
.d_up
2015-11-04 04:35:41 -08:00
xor a
ld [wcd8a], a
ld [wcd8b], a
ld a, [wMobileInactivityTimerMinutes]
2015-11-04 04:35:41 -08:00
and a
jr z, .asm_11a24c
xor a
ld [wMobileInactivityTimerMinutes], a
2015-11-04 04:35:41 -08:00
hlcoord 15, 8
ld a, $ed
ld [hl], a
hlcoord 15, 10
ld a, $7f
ld [hl], a
jr .asm_11a24c
.d_down
2015-11-04 04:35:41 -08:00
xor a
ld [wcd8a], a
ld [wcd8b], a
ld a, [wMobileInactivityTimerMinutes]
2015-11-04 04:35:41 -08:00
and a
jr nz, .asm_11a24c
inc a
ld [wMobileInactivityTimerMinutes], a
2015-11-04 04:35:41 -08:00
hlcoord 15, 8
ld a, $7f
ld [hl], a
hlcoord 15, 10
ld a, $ed
ld [hl], a
jr .asm_11a24c
.a_button
2015-11-04 04:35:41 -08:00
xor a
ld [wcd8a], a
ld [wcd8b], a
call PlayClickSFX
ld a, [wMobileInactivityTimerMinutes]
2015-11-04 04:35:41 -08:00
and a
jr nz, .exit_no_carry
2015-11-04 04:35:41 -08:00
call ExitMenu
2017-12-24 09:47:30 -08:00
farcall ReloadMapPart
ld a, [wMobileInactivityTimerFrames]
2015-11-04 04:35:41 -08:00
cp $0
jr z, .asm_11a2b4
ld a, [wcd47]
jr .exit_carry
2015-11-04 04:35:41 -08:00
.asm_11a2b4
ld a, [wcd33]
.exit_carry
2015-11-04 04:35:41 -08:00
ld [wcf66], a
ld a, $a
ld [wMobileErrorCodeBuffer], a
2015-11-04 04:35:41 -08:00
scf
ret
.b_button
2015-11-04 04:35:41 -08:00
call PlayClickSFX
.exit_no_carry
2015-11-04 04:35:41 -08:00
call ExitMenu
2017-12-24 09:47:30 -08:00
farcall ReloadMapPart
2015-11-04 04:35:41 -08:00
and a
ret
2018-06-24 07:09:41 -07:00
String_11a2cf:
2015-11-04 04:35:41 -08:00
db "YES@"
2018-06-24 07:09:41 -07:00
String_11a2d3:
2015-11-04 04:35:41 -08:00
db "NO@"
2018-06-24 07:09:41 -07:00
MenuHeader_11a2d6:
db MENU_BACKUP_TILES ; flags
menu_coords 14, 6, SCREEN_WIDTH - 1, 10
2015-11-04 04:35:41 -08:00
dw NULL
db 0 ; default option
2018-06-24 07:09:41 -07:00
MenuHeader_11a2de:
db MENU_BACKUP_TILES ; flags
menu_coords 14, 7, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
2015-11-04 04:35:41 -08:00
dw NULL
db 0 ; default option
2018-06-24 07:09:41 -07:00
Function11a2e6:
2015-11-04 04:35:41 -08:00
call Function11a63c
ld c, $2
2017-12-24 09:47:30 -08:00
farcall Function115e18
2015-11-04 04:35:41 -08:00
hlcoord 4, 2
ld de, String_11a71e
call PlaceString
ld a, $80
ld [wMobileInactivityTimerMinutes], a
jp BattleTowerRoomMenu2_IncrementJumptable
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
Function11a302:
ld a, [wMobileInactivityTimerMinutes]
2015-11-04 04:35:41 -08:00
and a
jr z, .asm_11a30e
dec a
ld [wMobileInactivityTimerMinutes], a
2015-11-04 04:35:41 -08:00
scf
ret
.asm_11a30e
call Function11a63c
hlcoord 4, 2
ld de, String_11a72a
call PlaceString
hlcoord 9, 4
ld de, wcd68
lb bc, PRINTNUM_LEADINGZEROS | 1, 2
call PrintNum
hlcoord 14, 4
ld de, wcd67
lb bc, PRINTNUM_LEADINGZEROS | 1, 2
call PrintNum
ld a, $80
ld [wMobileInactivityTimerMinutes], a
jp BattleTowerRoomMenu2_IncrementJumptable
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
Function11a33a:
ld a, [wMobileInactivityTimerMinutes]
2015-11-04 04:35:41 -08:00
and a
jr z, .asm_11a346
dec a
ld [wMobileInactivityTimerMinutes], a
2015-11-04 04:35:41 -08:00
scf
ret
.asm_11a346
call ExitMenu
2017-12-24 09:47:30 -08:00
farcall ReloadMapPart
farcall Function115dc3
2015-11-04 04:35:41 -08:00
and a
ret
2018-06-24 07:09:41 -07:00
Function11a357:
2015-11-04 04:35:41 -08:00
call Function11a63c
hlcoord 4, 2
ld de, String_11a743
call PlaceString
ld a, $80
ld [wMobileInactivityTimerMinutes], a
jp BattleTowerRoomMenu2_IncrementJumptable
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
Function11a36b:
ld a, [wMobileInactivityTimerMinutes]
2015-11-04 04:35:41 -08:00
and a
jr z, .asm_11a377
dec a
ld [wMobileInactivityTimerMinutes], a
2015-11-04 04:35:41 -08:00
scf
ret
.asm_11a377
call Function11a63c
hlcoord 4, 2
ld de, String_11a755
call PlaceString
call Function11a5f5
xor a
ld [wMobileInactivityTimerMinutes], a
jp BattleTowerRoomMenu2_IncrementJumptable
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
Function11a38d:
2015-11-04 04:35:41 -08:00
call Function11a536
ret c
call PlayClickSFX
ld a, [wMobileInactivityTimerMinutes]
2015-11-04 04:35:41 -08:00
and a
jr nz, .asm_11a3b1
call ExitMenu
2017-12-24 09:47:30 -08:00
farcall ReloadMapPart
2015-11-04 04:35:41 -08:00
call Function11a63c
hlcoord 4, 2
ld de, String_11a6d2
call PlaceString
and a
ret
.asm_11a3b1
call ExitMenu
2017-12-24 09:47:30 -08:00
farcall ReloadMapPart
ld a, [wMobileInactivityTimerSeconds]
2015-11-04 04:35:41 -08:00
ld [wcf66], a
ld [wcd80], a
scf
ret
2018-06-24 07:09:41 -07:00
Function11a3c5:
2015-11-04 04:35:41 -08:00
call Function11a63c
hlcoord 4, 2
ld de, String_11a762
call PlaceString
ld a, $80
ld [wMobileInactivityTimerMinutes], a
jp BattleTowerRoomMenu2_IncrementJumptable
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
Function11a3d9:
ld a, [wMobileInactivityTimerMinutes]
2015-11-04 04:35:41 -08:00
and a
jr z, .asm_11a3e5
dec a
ld [wMobileInactivityTimerMinutes], a
2015-11-04 04:35:41 -08:00
scf
ret
.asm_11a3e5
call Function11a63c
hlcoord 4, 2
ld de, String_11a779
call PlaceString
ld a, $80
ld [wMobileInactivityTimerMinutes], a
jp BattleTowerRoomMenu2_IncrementJumptable
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
Function11a3f9:
ld a, [wMobileInactivityTimerMinutes]
2015-11-04 04:35:41 -08:00
and a
jr z, .asm_11a405
dec a
ld [wMobileInactivityTimerMinutes], a
2015-11-04 04:35:41 -08:00
scf
ret
.asm_11a405
call Function11a63c
hlcoord 4, 2
ld de, String_11a755
call PlaceString
call Function11a5f5
xor a
ld [wMobileInactivityTimerMinutes], a
jp BattleTowerRoomMenu2_IncrementJumptable
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
Function11a41b:
2015-11-04 04:35:41 -08:00
call Function11a536
ret c
call PlayClickSFX
ld a, [wMobileInactivityTimerMinutes]
2015-11-04 04:35:41 -08:00
and a
jr nz, .asm_11a43f
call ExitMenu
2017-12-24 09:47:30 -08:00
farcall ReloadMapPart
2015-11-04 04:35:41 -08:00
call Function11a63c
hlcoord 4, 2
ld de, String_11a6d2
call PlaceString
and a
ret
.asm_11a43f
call ExitMenu
2017-12-24 09:47:30 -08:00
farcall ReloadMapPart
2015-11-04 04:35:41 -08:00
ld a, $1c
ld [wcf66], a
ld [wcd80], a
scf
ret
2018-06-24 07:09:41 -07:00
Function11a452:
2015-11-04 04:35:41 -08:00
call Function11a63c
hlcoord 4, 2
ld de, String_11a791
call PlaceString
ld a, $80
ld [wMobileInactivityTimerMinutes], a
jp BattleTowerRoomMenu2_IncrementJumptable
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
Function11a466:
2015-11-04 04:35:41 -08:00
call Function11a63c
hlcoord 4, 2
ld de, String_11a7c1
call PlaceString
ld a, $80
ld [wMobileInactivityTimerMinutes], a
jp BattleTowerRoomMenu2_IncrementJumptable
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
Function11a47a:
ld a, [wMobileInactivityTimerMinutes]
2015-11-04 04:35:41 -08:00
and a
jr z, .asm_11a486
dec a
ld [wMobileInactivityTimerMinutes], a
2015-11-04 04:35:41 -08:00
scf
ret
.asm_11a486
and a
ret
2018-06-24 07:09:41 -07:00
Function11a488:
2015-11-04 04:35:41 -08:00
call Function11a63c
hlcoord 4, 2
ld de, String_11a7ac
call PlaceString
call Function11a5f5
xor a
ld [wMobileInactivityTimerMinutes], a
jp BattleTowerRoomMenu2_IncrementJumptable
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
Function11a49e:
2015-11-04 04:35:41 -08:00
call Function11a536
ret c
call PlayClickSFX
ld a, [wMobileInactivityTimerMinutes]
2015-11-04 04:35:41 -08:00
and a
jr nz, .asm_11a4c7
call ExitMenu
2017-12-24 09:47:30 -08:00
farcall ReloadMapPart
2015-11-04 04:35:41 -08:00
call Function11a63c
hlcoord 4, 2
ld de, String_11a6d2
call PlaceString
ld a, $14
ld [wcf66], a
and a
ret
.asm_11a4c7
call ExitMenu
2017-12-24 09:47:30 -08:00
farcall ReloadMapPart
ld a, [wMobileInactivityTimerFrames]
2015-11-04 04:35:41 -08:00
ld [wcf66], a
ld [wcd80], a
scf
ret
2018-06-24 07:09:41 -07:00
Function11a4db:
2015-11-04 04:35:41 -08:00
call Function11a63c
ld de, String_11a6db
hlcoord 4, 2
call PlaceString
ret
2018-06-24 07:09:41 -07:00
Function11a4e8:
2015-11-04 04:35:41 -08:00
call Function11a63c
hlcoord 4, 2
ld de, String_11a7d7
call PlaceString
call Function11a5f5
xor a
ld [wMobileInactivityTimerMinutes], a
jp BattleTowerRoomMenu2_IncrementJumptable
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
Function11a4fe:
2015-11-04 04:35:41 -08:00
call Function11a536
ret c
call PlayClickSFX
ld a, [wMobileInactivityTimerMinutes]
2015-11-04 04:35:41 -08:00
and a
jr nz, .asm_11a522
call ExitMenu
2017-12-24 09:47:30 -08:00
farcall ReloadMapPart
2015-11-04 04:35:41 -08:00
call Function11a63c
hlcoord 4, 2
ld de, String_11a6d2
call PlaceString
and a
ret
.asm_11a522
call ExitMenu
2017-12-24 09:47:30 -08:00
farcall ReloadMapPart
ld a, [wMobileInactivityTimerSeconds]
2015-11-04 04:35:41 -08:00
ld [wcf66], a
ld [wcd80], a
scf
ret
2018-06-24 07:09:41 -07:00
Function11a536:
2015-11-04 04:35:41 -08:00
ld hl, hJoyPressed
ld a, [hl]
and A_BUTTON
2015-11-04 04:35:41 -08:00
jr nz, .asm_11a5a7
ld a, [hl]
and B_BUTTON
2015-11-04 04:35:41 -08:00
jr nz, .asm_11a5a2
ld a, [hl]
and D_UP
2015-11-04 04:35:41 -08:00
jr nz, .asm_11a564
ld a, [hl]
and D_DOWN
2015-11-04 04:35:41 -08:00
jr nz, .asm_11a583
.asm_11a54d
ld a, [wBattleTowerRoomMenu2JumptableIndex]
2015-11-04 04:35:41 -08:00
cp $4
jr z, .asm_11a562
call Function11a9f0
jr nz, .asm_11a562
call ExitMenu
2017-12-24 09:47:30 -08:00
farcall ReloadMapPart
2015-11-04 04:35:41 -08:00
.asm_11a562
scf
ret
.asm_11a564
xor a
ld [wcd8a], a
ld [wcd8b], a
ld a, [wMobileInactivityTimerMinutes]
2015-11-04 04:35:41 -08:00
and a
jr z, .asm_11a54d
xor a
ld [wMobileInactivityTimerMinutes], a
2015-11-04 04:35:41 -08:00
hlcoord 15, 7
ld a, $ed
ld [hl], a
hlcoord 15, 9
ld a, $7f
ld [hl], a
jr .asm_11a54d
.asm_11a583
xor a
ld [wcd8a], a
ld [wcd8b], a
ld a, [wMobileInactivityTimerMinutes]
2015-11-04 04:35:41 -08:00
and a
jr nz, .asm_11a54d
inc a
ld [wMobileInactivityTimerMinutes], a
2015-11-04 04:35:41 -08:00
hlcoord 15, 7
ld a, $7f
ld [hl], a
hlcoord 15, 9
ld a, $ed
ld [hl], a
jr .asm_11a54d
.asm_11a5a2
ld a, $1
ld [wMobileInactivityTimerMinutes], a
2015-11-04 04:35:41 -08:00
.asm_11a5a7
xor a
ld [wcd8a], a
ld [wcd8b], a
and a
ret
2018-06-24 07:09:41 -07:00
BattleTowerRoomMenu2_IncrementJumptable:
ld a, [wBattleTowerRoomMenu2JumptableIndex]
2015-11-04 04:35:41 -08:00
inc a
ld [wBattleTowerRoomMenu2JumptableIndex], a
2015-11-04 04:35:41 -08:00
scf
ret
2018-06-24 07:09:41 -07:00
Function11a5b9:
2015-11-04 04:35:41 -08:00
xor a
ld [wMenuBorderLeftCoord], a
ld [wMenuBorderTopCoord], a
ld a, $13
ld [wMenuBorderRightCoord], a
ld a, $5
ld [wMenuBorderBottomCoord], a
2015-12-22 19:19:33 -08:00
call PushWindow
hlcoord 0, 0, wAttrmap
2015-11-04 04:35:41 -08:00
ld b, $6
ld c, $14
hlcoord 0, 0
ld b, $4
ld c, $12
call Function3eea
2017-12-24 09:47:30 -08:00
farcall ReloadMapPart
2015-11-04 04:35:41 -08:00
call UpdateSprites
ld c, $0
2017-12-24 09:47:30 -08:00
farcall Function115e18
2015-11-04 04:35:41 -08:00
ld a, $1
ld [wc305], a
ret
2018-06-24 07:09:41 -07:00
Function11a5f5:
2015-11-04 04:35:41 -08:00
ld a, $e
ld [wMenuBorderLeftCoord], a
ld a, $13
ld [wMenuBorderRightCoord], a
ld a, $6
ld [wMenuBorderTopCoord], a
ld a, $a
ld [wMenuBorderBottomCoord], a
2015-12-22 19:19:33 -08:00
call PushWindow
hlcoord 14, 6, wAttrmap
2015-11-04 04:35:41 -08:00
ld b, $5
ld c, $6
hlcoord 14, 6
ld b, $3
ld c, $4
call Function3eea
hlcoord 16, 7
ld de, String_11a2cf
call PlaceString
hlcoord 16, 9
ld de, String_11a2d3
call PlaceString
hlcoord 15, 7
ld a, $ed
ld [hl], a
2017-12-24 09:47:30 -08:00
farcall ReloadMapPart
2015-11-04 04:35:41 -08:00
ret
2018-06-24 07:09:41 -07:00
Function11a63c:
2015-11-04 04:35:41 -08:00
hlcoord 4, 1
ld de, String_11a7f4
call PlaceString
hlcoord 4, 2
ld de, String_11a7f4
call PlaceString
hlcoord 4, 3
ld de, String_11a7f4
call PlaceString
hlcoord 4, 4
ld de, String_11a7f4
call PlaceString
ret
2018-06-24 07:09:41 -07:00
String_11a661:
db "これから モバイルセンターに"
next "でんわ<WO>かけます@"
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
String_11a679:
db "モバイルアダプタ<NO>じゅんびは"
next "できて いますか?@"
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
String_11a692:
db "でんわ<WO>かけています"
next "しばらく おまちください@"
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
String_11a6aa:
db "でんわをかけると つうわりょう"
next "せつぞくりょう<GA>かかります@"
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
String_11a6c8:
db "せつぞく しました@"
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
String_11a6d2:
db "つうしん ちゅう@"
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
String_11a6db:
db "つうしん ちゅう"
next "セレクト エーでちゅうし@"
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
String_11a6f1:
db "この サービスには"
next "つうわりょう<NO>ほかに@"
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
String_11a706:
db "おかね<GA>@"
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
String_11a70b:
2015-11-04 04:35:41 -08:00
db "えん"
next "かかります よろしい ですか?@"
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
String_11a71e:
db "つうしん しゅうりょう@"
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
String_11a72a:
db "つないだ じかん"
next "  やく   ふん   びょう@"
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
String_11a743:
db "もっていない データが"
next "あります!@"
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
String_11a755:
db "データ<WO>よみこみますか?@"
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
String_11a762:
db "おなじ データ<WO>よみこんだ"
next "こと<GA>ありますが@"
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
String_11a779:
db "そのデータ<WA>なくなっているか"
next "こわれて います@"
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
String_11a791:
db "もっている データと"
next "おなじデータしか ありません!@"
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
String_11a7ac:
db "データ<NO>よみこみを"
next "ちゅうし しますか?@"
2015-11-04 04:35:41 -08:00
2018-06-24 18:39:23 -07:00
String_11a7c1:
db "あたらしい ニュースは"
next "ありません でした@"
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
String_11a7d7:
db "あたらしいニュース<GA>あります"
next "ニュース<WO>よみこみますか?@"
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
String_11a7f4:
db "               @"
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
MenuHeader_11a804:
db MENU_BACKUP_TILES ; flags
menu_coords 0, 0, SCREEN_WIDTH - 1, 5
2015-11-04 04:35:41 -08:00
dw NULL
db 0 ; default option
2018-06-24 07:09:41 -07:00
Function11a80c:
2015-11-04 04:35:41 -08:00
ld de, hDivisor
ld bc, hDividend
ld hl, Unknown_11a89a
call Function11a88c
ld bc, hQuotient + 1
2015-11-04 04:35:41 -08:00
ld hl, Unknown_11a8ba
call Function11a88c
ld bc, hPrintNumBuffer + 2
2015-11-04 04:35:41 -08:00
ld hl, Unknown_11a8da
call Function11a88c
xor a
ld b, a
ldh a, [hDivisor]
2015-11-04 04:35:41 -08:00
and $f
ld e, a
ldh a, [hPrintNumBuffer + 6]
2015-11-04 04:35:41 -08:00
and $f
call Function11a884
ld e, a
ldh a, [hPrintNumBuffer + 8]
2015-11-04 04:35:41 -08:00
and $f
call Function11a884
ld [wcd62], a
ld e, b
xor a
ld b, a
ldh a, [hDivisor]
2015-11-04 04:35:41 -08:00
and $f0
swap a
call Function11a884
ld e, a
ldh a, [hPrintNumBuffer + 6]
2015-11-04 04:35:41 -08:00
and $f0
swap a
call Function11a884
ld e, a
ldh a, [hPrintNumBuffer + 8]
2015-11-04 04:35:41 -08:00
and $f0
swap a
call Function11a884
ld [wcd63], a
ld e, b
xor a
ld b, a
ldh a, [hMathBuffer]
2015-11-04 04:35:41 -08:00
and $f
call Function11a884
ld e, a
ldh a, [hPrintNumBuffer + 7]
2015-11-04 04:35:41 -08:00
and $f
call Function11a884
ld e, a
ldh a, [hPrintNumBuffer + 9]
2015-11-04 04:35:41 -08:00
and $f
call Function11a884
ld [wcd64], a
ret
2018-06-24 07:09:41 -07:00
Function11a884:
2015-11-04 04:35:41 -08:00
add e
cp $a
ret c
sub $a
inc b
ret
2018-06-24 07:09:41 -07:00
Function11a88c:
2015-11-04 04:35:41 -08:00
ld a, [bc]
sla a
ld c, a
xor a
ld b, a
add hl, bc
ld a, [hli]
ld [de], a
inc de
ld a, [hl]
ld [de], a
inc de
ret
2018-06-24 07:09:41 -07:00
Unknown_11a89a:
2015-11-04 04:35:41 -08:00
x = 0
rept 16
bcd x % 100, x / 100
x = x + 1
endr
2018-06-24 07:09:41 -07:00
Unknown_11a8ba:
2015-11-04 04:35:41 -08:00
x = 0
rept 16
bcd x % 100, x / 100
x = x + 16
endr
2018-06-24 07:09:41 -07:00
Unknown_11a8da:
2015-11-04 04:35:41 -08:00
x = 0
rept 16
bcd x % 100, x / 100
x = x + 256
endr
2018-06-24 07:09:41 -07:00
BattleTowerRoomMenu_WriteMessage:
jumptable .Jumptable, wc31a
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
.Jumptable:
dw BattleTowerRoomMenu_WriteMessage_DoNothing
2015-11-04 04:35:41 -08:00
dw Function11a90f
dw Function11a971
2018-06-24 07:09:41 -07:00
Function11a90f:
2015-11-04 04:35:41 -08:00
ld a, $1
ldh [rSVBK], a
2019-04-08 05:15:10 -07:00
call SpeechTextbox
2015-11-04 04:35:41 -08:00
ld a, $50
ld hl, wc320
2015-11-04 04:35:41 -08:00
ld bc, $008c
call ByteFill
ld a, [wc31b]
2015-11-04 04:35:41 -08:00
ld l, a
ld a, [wc31c]
2015-11-04 04:35:41 -08:00
ld h, a
ld de, wc320
2015-11-04 04:35:41 -08:00
.asm_11a92c
ld a, [hli]
cp $57
jr z, .asm_11a94f
cp $0
jr z, .asm_11a92c
cp $50
jr z, .asm_11a92c
cp $1
jr z, .asm_11a941
ld [de], a
inc de
jr .asm_11a92c
.asm_11a941
ld a, [hli]
ld c, a
ld a, [hli]
ld b, a
.asm_11a945
ld a, [bc]
inc bc
cp $50
jr z, .asm_11a92c
ld [de], a
inc de
jr .asm_11a945
.asm_11a94f
xor a
ld [wc31f], a
ld a, LOW(wc320)
ld [wc31b], a
ld a, HIGH(wc320)
ld [wc31c], a
2015-11-04 04:35:41 -08:00
hlcoord 1, 14
ld a, l
ld [wc31d], a
2015-11-04 04:35:41 -08:00
ld a, h
ld [wc31e], a
ld hl, wc31a
2015-11-04 04:35:41 -08:00
inc [hl]
ld a, $3
ldh [rSVBK], a
2015-11-04 04:35:41 -08:00
BattleTowerRoomMenu_WriteMessage_DoNothing:
2015-11-04 04:35:41 -08:00
ret
2018-06-24 07:09:41 -07:00
Function11a971:
ld hl, wc31f
ldh a, [hJoyDown]
2015-11-04 04:35:41 -08:00
and a
jr nz, .asm_11a97f
ld a, [hl]
and a
jr z, .asm_11a97f
dec [hl]
ret
.asm_11a97f
2018-01-23 14:39:09 -08:00
ld a, [wOptions]
2015-11-04 04:35:41 -08:00
and $7
ld [hl], a
ld hl, wcd8d
ld a, [wc31b]
2015-11-04 04:35:41 -08:00
ld e, a
ld a, [wc31c]
2015-11-04 04:35:41 -08:00
ld d, a
ld a, [de]
inc de
ld [hli], a
ld a, e
ld [wc31b], a
2015-11-04 04:35:41 -08:00
ld a, d
ld [wc31c], a
2015-11-04 04:35:41 -08:00
ld a, $50
ld [hl], a
ld a, [wc31d]
2015-11-04 04:35:41 -08:00
ld l, a
ld a, [wc31e]
2015-11-04 04:35:41 -08:00
ld h, a
ld de, wcd8d
call PlaceString
ld a, c
ld [wc31d], a
2015-11-04 04:35:41 -08:00
ld a, b
ld [wc31e], a
2015-11-04 04:35:41 -08:00
ld a, [wcd8d]
cp $50
jr nz, .asm_11a9bf
xor a
ld [wc31a], a
2015-11-04 04:35:41 -08:00
.asm_11a9bf
ret
2018-06-24 07:09:41 -07:00
BattleTowerRoomMenu_SetMessage:
2015-11-04 04:35:41 -08:00
ld a, l
ld [wc31b], a
2015-11-04 04:35:41 -08:00
ld a, h
ld [wc31c], a
2015-11-04 04:35:41 -08:00
ld a, $1
ld [wc31a], a
2015-11-04 04:35:41 -08:00
ret
2018-06-24 07:09:41 -07:00
Function11a9ce:
2015-11-11 20:38:57 -08:00
call ClearBGPalettes
2015-12-18 17:07:09 -08:00
call ReloadTilesetAndPalettes
2015-11-04 04:35:41 -08:00
call Call_ExitMenu
farcall Stubbed_Function106462
2017-12-24 09:47:30 -08:00
farcall Function106464
call GSReloadPalettes
2017-12-24 09:47:30 -08:00
farcall FinishExitMenu
2015-11-04 04:35:41 -08:00
call UpdateSprites
ret
2018-06-24 07:09:41 -07:00
Function11a9f0:
2015-11-04 04:35:41 -08:00
ld a, $1
and a
ret
2018-06-24 07:09:41 -07:00
Function11a9f4:
2015-11-04 04:35:41 -08:00
ld a, [wcd8a]
ld l, a
ld a, [wcd8b]
ld h, a
inc hl
ld a, l
ld [wcd8a], a
ld a, h
ld [wcd8b], a
ld de, $d5d0
add hl, de
bit 7, h
ret nz
ld a, $d6
call SetMobileErrorCode
2015-11-04 04:35:41 -08:00
and a
ret
Text_SaveFileWillBeSent:
2015-11-04 04:35:41 -08:00
text "SAVE FILE will be"
line "sent."
done
Text_SentSaveFileReadingNews:
2015-11-04 04:35:41 -08:00
text "Sent SAVE FILE."
line "Reading NEWS…"
done
Text_ReadingNews:
2015-11-04 04:35:41 -08:00
text "Reading NEWS…"
done
Text_ReceivedNews:
2015-11-04 04:35:41 -08:00
text "Received NEWS!"
done
Text_QuitReadingNews:
2015-11-04 04:35:41 -08:00
text "Quit reading NEWS?"
done
Text_CanceledSendingSaveFile:
2015-11-04 04:35:41 -08:00
text "Canceled sending"
line "SAVE FILE."
done
Text_ReceivedOddEgg:
2015-11-04 04:35:41 -08:00
text "ODD EGG"
line "was received!"
done
Text_RegisteringRecord:
2015-11-04 04:35:41 -08:00
text "Registering your"
line "record…"
done
Text_BattleRoomVisitLimit:
2015-11-04 04:35:41 -08:00
text "One visit per day"
line "per BATTLE ROOM!"
done
Text_PartyMonTopsThisLevel:
2015-11-04 04:35:41 -08:00
text "A party #MON"
line "tops this level."
done
Text_UberRestriction:
text_ram wcd49
2015-11-04 04:35:41 -08:00
text " may go"
line "only to BATTLE"
para "ROOMS that are"
line "Lv.70 or higher."
done
Text_CancelBattleRoomChallenge:
2015-11-04 04:35:41 -08:00
text "Cancel your BATTLE"
line "ROOM challenge?"
done
Text_ExitGymLeaderHonorRoll:
2015-11-04 04:35:41 -08:00
text "Exit GYM LEADER"
line "HONOR ROLL?"
done
Text_LinkingWithCenter:
2015-11-04 04:35:41 -08:00
text "Linking with the"
line "CENTER…"
done
Text_WhatLevelDoYouWantToChallenge:
2015-11-04 04:35:41 -08:00
text "What level do you"
line "want to challenge?"
done
Text_CheckBattleRoomListByMaxLevel:
2015-11-04 04:35:41 -08:00
text "Check BATTLE ROOM"
line "list by max level?"
done
Text_EnterWhichBattleRoom:
2015-11-04 04:35:41 -08:00
text "Enter which"
line "BATTLE ROOM?"
done
Text_WhichBattleRoom:
2015-11-04 04:35:41 -08:00
text "Which BATTLE ROOM?"
done
Text_ThisBattleRoomPleaseWait:
text_ram wStringBuffer3
2015-11-04 04:35:41 -08:00
text "'s ROOM"
line "@"
text_ram wStringBuffer4
2015-11-04 04:35:41 -08:00
text "?"
cont "Please wait…"
done
2018-06-24 07:09:41 -07:00
Function11ac3e:
2019-04-08 05:15:10 -07:00
call SpeechTextbox
2015-11-04 04:35:41 -08:00
call FadeToMenu
2017-12-24 09:47:30 -08:00
callfar ClearSpriteAnims2
2015-11-04 04:35:41 -08:00
call Function11ac51
call CloseSubmenu
2015-11-04 04:35:41 -08:00
ret
2018-06-24 07:09:41 -07:00
Function11ac51:
2015-11-04 04:35:41 -08:00
xor a
ldh [hBGMapMode], a
2018-01-23 14:39:09 -08:00
ld hl, wOptions
2015-11-04 04:35:41 -08:00
ld a, [hl]
push af
set 4, [hl]
2018-01-23 14:39:09 -08:00
ld a, [wVramState]
2015-11-04 04:35:41 -08:00
push af
xor a
2018-01-23 14:39:09 -08:00
ld [wVramState], a
ldh a, [hInMenu]
2015-11-04 04:35:41 -08:00
push af
ld a, $1
ldh [hInMenu], a
2015-11-04 04:35:41 -08:00
xor a
ldh [hMapAnims], a
2015-11-04 04:35:41 -08:00
ld [wcd49], a
ld [wcd4a], a
ld [wcd4c], a
ld [wcd4d], a
ld [wcd4e], a
call Function11ad1b
call DelayFrame
2015-12-25 20:34:33 -08:00
.loop
2015-11-04 04:35:41 -08:00
call JoyTextDelay
ld a, [wJumptableIndex]
bit 7, a
jr nz, .asm_11aca8
call Function11b314
call Function11acb7
call Function11ad6e
2018-07-15 08:58:01 -07:00
ld a, 30 * SPRITEOAMSTRUCT_LENGTH
2018-09-09 12:09:51 -07:00
ld [wCurSpriteOAMAddr], a
2017-12-24 09:47:30 -08:00
farcall DoNextFrameForAllSprites
farcall ReloadMapPart
2015-12-25 20:34:33 -08:00
jr .loop
2015-11-04 04:35:41 -08:00
.asm_11aca8
call ClearSprites
pop af
ldh [hInMenu], a
2015-11-04 04:35:41 -08:00
pop af
2018-01-23 14:39:09 -08:00
ld [wVramState], a
2015-11-04 04:35:41 -08:00
pop af
2018-01-23 14:39:09 -08:00
ld [wOptions], a
2015-11-04 04:35:41 -08:00
ret
2018-06-24 07:09:41 -07:00
Function11acb7:
2015-12-25 20:34:33 -08:00
ld hl, TilemapPack_11ba44
2015-11-04 04:35:41 -08:00
ld a, [wcd49]
ld c, a
ld b, $0
sla c
rl b
sla c
rl b
sla c
rl b
add hl, bc
decoord 6, 6
ld a, [hli]
ld [de], a
decoord 0, 7
2015-12-25 20:34:33 -08:00
ld bc, 7
2015-11-04 04:35:41 -08:00
call CopyBytes
ld a, [wcd49]
inc a
ld [wcd49], a
ld a, [hl]
cp $ff
2015-12-25 20:34:33 -08:00
jr nz, .get_the_other
2015-11-04 04:35:41 -08:00
xor a
ld [wcd49], a
2015-12-25 20:34:33 -08:00
.get_the_other
ld hl, TilemapPack_11bb7d
2015-11-04 04:35:41 -08:00
ld a, [wcd4a]
ld c, a
ld b, $0
sla c
rl b
sla c
rl b
sla c
rl b
add hl, bc
decoord 3, 9
2015-12-25 20:34:33 -08:00
ld bc, 7
2015-11-04 04:35:41 -08:00
call CopyBytes
ld a, [wcd4a]
inc a
ld [wcd4a], a
inc hl
ld a, [hl]
cp $ff
ret nz
xor a
ld [wcd4a], a
ret
2018-06-24 07:09:41 -07:00
Function11ad1b:
2015-11-11 20:38:57 -08:00
call ClearBGPalettes
2015-11-04 04:35:41 -08:00
call ClearSprites
call ClearTilemap
2017-12-24 09:47:30 -08:00
farcall Function17c000
2015-12-15 15:59:49 -08:00
ld a, [wMenuCursorY]
2015-11-04 04:35:41 -08:00
ld [wcd82], a
dec a
ldh [hObjectStructIndexBuffer], a
2015-11-04 04:35:41 -08:00
ld a, $10
2015-12-04 05:46:11 -08:00
ld [wCurIconTile], a
2016-03-01 19:31:21 -08:00
ld hl, LoadMenuMonIcon
ld a, BANK(LoadMenuMonIcon)
ld e, MONICON_MOBILE1
2015-11-04 04:35:41 -08:00
rst FarCall
2016-03-01 19:31:21 -08:00
ld hl, LoadMenuMonIcon
ld a, BANK(LoadMenuMonIcon)
ld e, MONICON_MOBILE2
2015-11-04 04:35:41 -08:00
rst FarCall
ld hl, wPokedexOrder
2015-11-04 04:35:41 -08:00
ld bc, $0115
xor a
call ByteFill
xor a
ld [wJumptableIndex], a
ld [wcf64], a
ld [wcf65], a
ld [wcf66], a
ld [wcd30], a
ld a, DEXMODE_ABC
ld [wCurDexMode], a
2017-12-24 09:47:30 -08:00
farcall Pokedex_OrderMonsByMode
2015-11-04 04:35:41 -08:00
ret
2018-06-24 07:09:41 -07:00
Function11ad6e:
2015-11-04 04:35:41 -08:00
ld a, [wJumptableIndex]
ld hl, Jumptable_11ad78
call Function11b239
jp hl
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
Jumptable_11ad78:
2015-11-04 04:35:41 -08:00
dw Function11b082
dw Function11b0ff
dw Function11ad95
dw Function11adc4
dw Function11ae4e
dw Function11ae98
dw Function11ad8f
dw Function11af04
dw Function11af4e
2018-06-24 07:09:41 -07:00
Function11ad8a:
2015-11-04 04:35:41 -08:00
ld hl, wJumptableIndex
inc [hl]
ret
2018-06-24 07:09:41 -07:00
Function11ad8f:
2015-11-04 04:35:41 -08:00
ld hl, wJumptableIndex
set 7, [hl]
ret
2018-06-24 07:09:41 -07:00
Function11ad95:
ld hl, MenuHeader_11ae38
call LoadMenuHeader
2015-11-04 11:02:11 -08:00
call MenuBox
2015-11-04 04:35:41 -08:00
hlcoord 12, 12
ld de, String_11ae40
call PlaceString
hlcoord 10, 10, wAttrmap
2015-12-09 08:38:40 -08:00
lb bc, 8, 8
2015-11-04 04:35:41 -08:00
call Function11afd6
2017-12-24 09:47:30 -08:00
farcall ReloadMapPart
2015-11-04 04:35:41 -08:00
call Function11ad8a
ld a, $1
2015-12-15 15:59:49 -08:00
ld [wMenuCursorY], a
2015-11-04 04:35:41 -08:00
ld hl, Unknown_11afcc
call Function11afb7
Function11adc4:
ld hl, hJoyPressed
ld a, [hl]
and a
ret z
ld a, [hl]
and D_UP
2015-11-04 04:35:41 -08:00
jr nz, .asm_11ade6
ld a, [hl]
and D_DOWN
2015-11-04 04:35:41 -08:00
jr nz, .asm_11aded
ld a, [hl]
and A_BUTTON
2015-11-04 04:35:41 -08:00
jr nz, .asm_11ae06
ld a, [hl]
and B_BUTTON
2015-11-04 04:35:41 -08:00
ret z
call PlayClickSFX
xor a
ld [wJumptableIndex], a
jr .asm_11ae2e
.asm_11ade6
2015-12-15 15:59:49 -08:00
ld a, [wMenuCursorY]
2015-11-04 04:35:41 -08:00
dec a
ret z
jr .asm_11adf4
.asm_11aded
2015-12-15 15:59:49 -08:00
ld a, [wMenuCursorY]
2015-11-04 04:35:41 -08:00
inc a
cp $4
ret z
.asm_11adf4
push af
ld hl, Unknown_11afcc
call Function11afbb
pop af
2015-12-15 15:59:49 -08:00
ld [wMenuCursorY], a
2015-11-04 04:35:41 -08:00
ld hl, Unknown_11afcc
call Function11afb7
ret
.asm_11ae06
call PlayClickSFX
2015-12-15 15:59:49 -08:00
ld a, [wMenuCursorY]
2015-11-04 04:35:41 -08:00
dec a
ld hl, wcd30
ld [hl], a
and a
jr z, .asm_11ae28
hlcoord 2, 14
2015-12-15 15:59:49 -08:00
ld a, [wMenuCursorY]
2015-11-04 04:35:41 -08:00
cp $2
jr z, .asm_11ae23
call Function11b272
jr .asm_11ae2b
.asm_11ae23
call Function11b267
jr .asm_11ae2b
.asm_11ae28
ld a, $3
ld [hl], a
.asm_11ae2b
call Function11ad8a
.asm_11ae2e
call ExitMenu
2017-12-24 09:47:30 -08:00
farcall ReloadMapPart
2015-11-04 04:35:41 -08:00
ret
2018-06-24 07:09:41 -07:00
MenuHeader_11ae38:
db MENU_BACKUP_TILES ; flags
menu_coords 10, 10, 17, SCREEN_HEIGHT - 1
2015-11-04 04:35:41 -08:00
dw NULL
db 0 ; default option
2018-06-24 07:09:41 -07:00
String_11ae40:
2015-11-04 04:35:41 -08:00
db "どちらでも"
2018-01-19 17:48:33 -08:00
next "♂オス"
2015-11-04 04:35:41 -08:00
next "♀メス"
db "@"
2018-06-24 07:09:41 -07:00
Function11ae4e:
ld hl, MenuHeader_11afe8
call LoadMenuHeader
2015-11-04 11:02:11 -08:00
call MenuBox
2015-11-04 04:35:41 -08:00
hlcoord 10, 14
ld de, String_11aff0
call PlaceString
ld hl, MenuHeader_11b013
call LoadMenuHeader
2015-11-04 11:02:11 -08:00
call MenuBox
2015-11-04 04:35:41 -08:00
hlcoord 16, 8
ld de, String_11b01b
call PlaceString
hlcoord 14, 7, wAttrmap
2015-11-04 04:35:41 -08:00
lb bc, 5, 6
call Function11afd6
hlcoord 9, 12, wAttrmap
2015-11-04 04:35:41 -08:00
lb bc, 6, 11
call Function11afd6
2017-12-24 09:47:30 -08:00
farcall ReloadMapPart
2015-11-04 04:35:41 -08:00
call Function11ad8a
ld a, $1
2015-12-15 15:59:49 -08:00
ld [wMenuCursorY], a
2015-11-04 04:35:41 -08:00
ld hl, Unknown_11afd2
call Function11afb7
Function11ae98:
ld hl, hJoyPressed
ld a, [hl]
and a
ret z
ld a, [hl]
and D_UP
jr nz, .asm_11aec1
ld a, [hl]
and D_DOWN
jr nz, .asm_11aec8
ld a, [hl]
and A_BUTTON
jr nz, .asm_11aee1
ld a, [hl]
and B_BUTTON
ret z
call PlayClickSFX
.asm_11aeb4
hlcoord 2, 14
ld a, $7f
ld [hl], a
ld a, $1
ld [wJumptableIndex], a
jr .asm_11aef7
.asm_11aec1
2015-12-15 15:59:49 -08:00
ld a, [wMenuCursorY]
2015-11-04 04:35:41 -08:00
dec a
ret z
jr .asm_11aecf
.asm_11aec8
2015-12-15 15:59:49 -08:00
ld a, [wMenuCursorY]
2015-11-04 04:35:41 -08:00
inc a
cp $3
ret z
.asm_11aecf
push af
ld hl, Unknown_11afd2
call Function11afbb
pop af
2015-12-15 15:59:49 -08:00
ld [wMenuCursorY], a
2015-11-04 04:35:41 -08:00
ld hl, Unknown_11afd2
call Function11afb7
ret
.asm_11aee1
call PlayClickSFX
2015-12-15 15:59:49 -08:00
ld a, [wMenuCursorY]
2015-11-04 04:35:41 -08:00
cp $2
jr z, .asm_11aeb4
ld a, [wcd4b]
2018-01-23 14:39:09 -08:00
ld [wScriptVar], a
2015-11-04 04:35:41 -08:00
call Function11b022
call Function11ad8a
.asm_11aef7
call ExitMenu
call ExitMenu
2017-12-24 09:47:30 -08:00
farcall ReloadMapPart
2015-11-04 04:35:41 -08:00
ret
2018-06-24 07:09:41 -07:00
Function11af04:
ld hl, MenuHeader_11afe8
call LoadMenuHeader
2015-11-04 11:02:11 -08:00
call MenuBox
2015-11-04 04:35:41 -08:00
hlcoord 10, 14
ld de, String_11b003
call PlaceString
ld hl, MenuHeader_11b013
call LoadMenuHeader
2015-11-04 11:02:11 -08:00
call MenuBox
2015-11-04 04:35:41 -08:00
hlcoord 16, 8
ld de, String_11b01b
call PlaceString
hlcoord 14, 7, wAttrmap
2015-11-04 04:35:41 -08:00
lb bc, 5, 6
call Function11afd6
hlcoord 9, 12, wAttrmap
2015-11-04 04:35:41 -08:00
lb bc, 6, 11
call Function11afd6
2017-12-24 09:47:30 -08:00
farcall ReloadMapPart
2015-11-04 04:35:41 -08:00
call Function11ad8a
ld a, $2
2015-12-15 15:59:49 -08:00
ld [wMenuCursorY], a
2015-11-04 04:35:41 -08:00
ld hl, Unknown_11afd2
call Function11afb7
Function11af4e:
ld hl, hJoyPressed
ld a, [hl]
and a
ret z
ld a, [hl]
and D_UP
jr nz, .asm_11af77
ld a, [hl]
and D_DOWN
jr nz, .asm_11af7e
ld a, [hl]
and A_BUTTON
jr nz, .asm_11af97
ld a, [hl]
and B_BUTTON
ret z
call PlayClickSFX
.asm_11af6a
hlcoord 2, 14
ld a, $7f
ld [hl], a
ld a, $1
ld [wJumptableIndex], a
jr .asm_11afaa
.asm_11af77
2015-12-15 15:59:49 -08:00
ld a, [wMenuCursorY]
2015-11-04 04:35:41 -08:00
dec a
ret z
jr .asm_11af85
.asm_11af7e
2015-12-15 15:59:49 -08:00
ld a, [wMenuCursorY]
2015-11-04 04:35:41 -08:00
inc a
cp $3
ret z
.asm_11af85
push af
ld hl, Unknown_11afd2
call Function11afbb
pop af
2015-12-15 15:59:49 -08:00
ld [wMenuCursorY], a
2015-11-04 04:35:41 -08:00
ld hl, Unknown_11afd2
call Function11afb7
ret
.asm_11af97
call PlayClickSFX
2015-12-15 15:59:49 -08:00
ld a, [wMenuCursorY]
2015-11-04 04:35:41 -08:00
cp $2
jr z, .asm_11af6a
ld a, $6
ld [wJumptableIndex], a
xor a
2018-01-23 14:39:09 -08:00
ld [wScriptVar], a
2015-11-04 04:35:41 -08:00
.asm_11afaa
call ExitMenu
call ExitMenu
2017-12-24 09:47:30 -08:00
farcall ReloadMapPart
2015-11-04 04:35:41 -08:00
ret
2018-06-24 07:09:41 -07:00
Function11afb7:
2015-11-04 04:35:41 -08:00
ld e, $ed
jr asm_11afbd
Function11afbb:
ld e, $7f
asm_11afbd:
2015-12-15 15:59:49 -08:00
ld a, [wMenuCursorY]
2015-11-04 04:35:41 -08:00
dec a
ld c, a
ld b, 0
add hl, bc
2015-12-26 18:59:03 -08:00
add hl, bc
2015-11-04 04:35:41 -08:00
ld a, e
ld e, [hl]
inc hl
ld d, [hl]
ld [de], a
ret
Unknown_11afcc:
dwcoord 11, 12
dwcoord 11, 14
dwcoord 11, 16
Unknown_11afd2:
dwcoord 15, 8
dwcoord 15, 10
2018-06-24 07:09:41 -07:00
Function11afd6:
2015-12-09 08:38:40 -08:00
ld de, SCREEN_WIDTH
2015-11-04 04:35:41 -08:00
ld a, $3
2015-12-09 08:38:40 -08:00
.row
2015-11-04 04:35:41 -08:00
push bc
push hl
2015-12-09 08:38:40 -08:00
.col
2015-11-04 04:35:41 -08:00
ld [hli], a
dec c
2015-12-09 08:38:40 -08:00
jr nz, .col
2015-11-04 04:35:41 -08:00
pop hl
add hl, de
pop bc
dec b
2015-12-09 08:38:40 -08:00
jr nz, .row
2015-11-04 04:35:41 -08:00
ret
2018-06-24 07:09:41 -07:00
MenuHeader_11afe8:
db MENU_BACKUP_TILES ; flags
menu_coords 9, 12, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1
2015-11-04 04:35:41 -08:00
dw NULL
db 0 ; default option
2018-06-24 07:09:41 -07:00
String_11aff0:
db "この じょうけんで"
2015-11-04 04:35:41 -08:00
next "よろしいですか?@"
2018-06-24 07:09:41 -07:00
String_11b003:
2015-11-04 04:35:41 -08:00
db "こうかんを"
next "ちゅうししますか?@"
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
MenuHeader_11b013:
db MENU_BACKUP_TILES ; flags
menu_coords 14, 7, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
2015-11-04 04:35:41 -08:00
dw NULL
db 1 ; default option
String_11b01b:
db "はい"
next "いいえ@"
2018-06-24 07:09:41 -07:00
Function11b022:
2015-11-04 04:35:41 -08:00
ld a, [wcd2e]
and a
jr z, .asm_11b02e
2018-01-23 14:39:09 -08:00
ld hl, wStringBuffer3
2015-11-04 04:35:41 -08:00
call Function11b03d
.asm_11b02e
ld a, [wcd30]
and a
ret z
cp $3
ret z
2018-01-23 14:39:09 -08:00
ld hl, wStringBuffer4
2015-11-04 04:35:41 -08:00
call Function11b03d
ret
2018-06-24 07:09:41 -07:00
Function11b03d:
2015-11-04 04:35:41 -08:00
push hl
push af
ld c, $1
2015-12-09 08:38:40 -08:00
.loop
2015-11-04 04:35:41 -08:00
ld a, [hli]
2015-12-09 08:38:40 -08:00
cp "♂"
jr z, .gender
cp "♀"
jr z, .gender
cp "@"
jr z, .done
2015-11-04 04:35:41 -08:00
inc c
2015-12-09 08:38:40 -08:00
jr .loop
2015-11-04 04:35:41 -08:00
2015-12-09 08:38:40 -08:00
.gender
2015-11-04 04:35:41 -08:00
dec hl
2015-12-09 08:38:40 -08:00
ld a, "@"
2015-11-04 04:35:41 -08:00
ld [hli], a
2015-12-09 08:38:40 -08:00
.done
2015-11-04 04:35:41 -08:00
dec hl
push hl
2015-12-09 08:38:40 -08:00
ld e, 4
ld d, 0
2015-11-04 04:35:41 -08:00
add hl, de
ld e, l
ld d, h
pop hl
2015-12-09 08:38:40 -08:00
.loop2
2015-11-04 04:35:41 -08:00
ld a, [hld]
ld [de], a
dec de
dec c
2015-12-09 08:38:40 -08:00
jr nz, .loop2
2015-11-04 04:35:41 -08:00
pop af
pop de
cp $1
2015-12-09 08:38:40 -08:00
jr nz, .female
ld hl, .MaleString
jr .got_string
2015-11-04 04:35:41 -08:00
2015-12-09 08:38:40 -08:00
.female
ld hl, .FemaleString
2015-11-04 04:35:41 -08:00
2015-12-09 08:38:40 -08:00
.got_string
ld bc, 4 ; string length
2015-11-04 04:35:41 -08:00
call CopyBytes
ret
.MaleString: db "オスの "
.FemaleString: db "メスの "
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
Function11b082:
2015-11-04 04:35:41 -08:00
call Function11b242
ld a, $7
ld [wc7d3], a
call Function11b099
call Function11b295
call Function11b275
call SetPalettes
jp Function11ad8a
2018-06-24 07:09:41 -07:00
Function11b099:
2015-11-04 04:35:41 -08:00
ld c, $6
hlcoord 11, 1
ld a, [wc7d3]
add a
ld b, a
xor a
call Function11b236
ld a, [wc7d0]
ld e, a
ld d, $0
ld hl, wPokedexOrder
2015-11-04 04:35:41 -08:00
add hl, de
ld e, l
ld d, h
hlcoord 11, 2
ld a, [wc7d3]
2015-12-09 08:38:40 -08:00
.loop
2015-11-04 04:35:41 -08:00
push af
ld a, [de]
ld [wTempSpecies], a
2015-11-04 04:35:41 -08:00
push de
push hl
2015-12-09 08:38:40 -08:00
call .PlaceMonNameOrPlaceholderString
2015-11-04 04:35:41 -08:00
pop hl
2015-12-09 08:38:40 -08:00
ld de, 2 * SCREEN_WIDTH
2015-11-04 04:35:41 -08:00
add hl, de
pop de
inc de
pop af
dec a
2015-12-09 08:38:40 -08:00
jr nz, .loop
2015-11-04 04:35:41 -08:00
ret
2018-06-24 07:09:41 -07:00
.PlaceMonNameOrPlaceholderString:
2015-11-04 04:35:41 -08:00
and a
ret z
2015-12-09 08:38:40 -08:00
call .CheckSeenFlag
2015-11-04 04:35:41 -08:00
ret c
2015-12-09 08:38:40 -08:00
call .SetCaughtFlag
2015-11-04 04:35:41 -08:00
push hl
call GetPokemonName
pop hl
call PlaceString
ret
2018-06-24 07:09:41 -07:00
.SetCaughtFlag:
2015-12-09 08:38:40 -08:00
call CheckCaughtMemMon
jr nz, .okay
2015-11-04 04:35:41 -08:00
inc hl
ret
2015-12-09 08:38:40 -08:00
.okay
2015-11-04 04:35:41 -08:00
ld a, $1
ld [hli], a
ret
2018-06-24 07:09:41 -07:00
.CheckSeenFlag:
2015-12-09 08:38:40 -08:00
call CheckSeenMemMon
2015-11-04 04:35:41 -08:00
ret nz
2015-12-09 08:38:40 -08:00
2015-11-04 04:35:41 -08:00
inc hl
2015-12-09 08:38:40 -08:00
ld de, .EmptySlot
2015-11-04 04:35:41 -08:00
call PlaceString
scf
ret
2018-06-24 07:09:41 -07:00
.EmptySlot:
2015-11-04 04:35:41 -08:00
db "ーーーーー@"
2018-06-24 07:09:41 -07:00
Function11b0ff:
2015-11-04 04:35:41 -08:00
ld hl, hJoyPressed
ld a, [hl]
and B_BUTTON
2015-11-04 04:35:41 -08:00
jr nz, .asm_11b141
ld a, [hl]
and A_BUTTON
2015-11-04 04:35:41 -08:00
jr nz, .asm_11b131
call Function11b175
jr nc, .asm_11b125
ld a, [wcd4c]
inc a
and $3
ld [wcd4c], a
xor a
ldh [hBGMapMode], a
2015-11-04 04:35:41 -08:00
call Function11b099
ld a, $1
ldh [hBGMapMode], a
2015-11-04 04:35:41 -08:00
ret
.asm_11b125
ld a, [wcd4c]
and a
ret z
inc a
and $3
ld [wcd4c], a
ret
.asm_11b131
call Function11b20b
2015-12-09 08:38:40 -08:00
call CheckSeenMemMon
2015-11-04 04:35:41 -08:00
jr z, .asm_11b13d
ld a, $1
jr .asm_11b148
.asm_11b13d
ld a, $2
jr .asm_11b148
.asm_11b141
ld hl, wJumptableIndex
ld a, $7
ld [hl], a
ret
.asm_11b148
call PlayClickSFX
ld [wcd4b], a
and a
jr z, .asm_11b16c
ld a, [wcf65]
cp $0
jr z, .asm_11b163
cp $fe
jr z, .asm_11b167
cp $ff
jr z, .asm_11b16b
jp Function11ad8a
.asm_11b163
ld a, $1
jr .asm_11b16c
.asm_11b167
ld a, $2
jr .asm_11b16c
.asm_11b16b
xor a
.asm_11b16c
ld [wcd30], a
ld a, $4
ld [wJumptableIndex], a
ret
2018-06-24 07:09:41 -07:00
Function11b175:
2015-11-04 04:35:41 -08:00
ld a, [wc7d3]
ld d, a
ld a, [wc7d2]
ld e, a
ld hl, hJoyLast
ld a, [hl]
and D_UP
2015-11-04 04:35:41 -08:00
jr nz, .asm_11b19a
ld a, [hl]
and D_DOWN
2015-11-04 04:35:41 -08:00
jr nz, .asm_11b1ae
ld a, d
cp e
jr nc, .asm_11b1ed
ld a, [hl]
and D_LEFT
2015-11-04 04:35:41 -08:00
jr nz, .asm_11b1c6
ld a, [hl]
and D_RIGHT
2015-11-04 04:35:41 -08:00
jr nz, .asm_11b1d8
jr .asm_11b1ed
.asm_11b19a
ld hl, wc7d1
ld a, [hl]
and a
jr z, .asm_11b1a4
dec [hl]
jr .asm_11b1ef
.asm_11b1a4
ld hl, wc7d0
ld a, [hl]
and a
jr z, .asm_11b1ed
dec [hl]
jr .asm_11b1ef
.asm_11b1ae
ld hl, wc7d1
ld a, [hl]
inc a
cp e
jr nc, .asm_11b1ed
cp d
jr nc, .asm_11b1bc
inc [hl]
jr .asm_11b1ef
.asm_11b1bc
ld hl, wc7d0
add [hl]
cp e
jr nc, .asm_11b1ed
inc [hl]
jr .asm_11b1ef
.asm_11b1c6
ld hl, wc7d0
ld a, [hl]
and a
jr z, .asm_11b1ed
cp d
jr nc, .asm_11b1d4
xor a
ld [hl], a
jr .asm_11b1ef
.asm_11b1d4
sub d
ld [hl], a
jr .asm_11b1ef
.asm_11b1d8
ld hl, wc7d0
ld a, d
add a
add [hl]
jr c, .asm_11b1e3
cp e
jr c, .asm_11b1e8
.asm_11b1e3
ld a, e
sub d
ld [hl], a
jr .asm_11b1ef
.asm_11b1e8
ld a, [hl]
add d
ld [hl], a
jr .asm_11b1ef
.asm_11b1ed
and a
ret
.asm_11b1ef
call Function11b295
call Function11b275
scf
ret
2018-06-24 07:09:41 -07:00
Function11b1f7:
2015-11-04 04:35:41 -08:00
hlcoord 0, 0
ld a, $32
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
call ByteFill
ret
2018-06-24 07:09:41 -07:00
Function11b203:
2015-11-04 04:35:41 -08:00
.asm_11b203
ld a, [de]
cp $ff
ret z
inc de
ld [hli], a
jr .asm_11b203
2018-06-24 07:09:41 -07:00
Function11b20b:
2015-11-04 04:35:41 -08:00
ld a, [wc7d1]
ld hl, wc7d0
add [hl]
ld e, a
ld d, $0
ld hl, $c6d0
add hl, de
ld a, [hl]
ld [wTempSpecies], a
2015-11-04 04:35:41 -08:00
ret
2018-06-24 07:09:41 -07:00
CheckCaughtMemMon:
2015-11-04 04:35:41 -08:00
push de
push hl
ld a, [wTempSpecies]
2015-11-04 04:35:41 -08:00
dec a
call CheckCaughtMon
pop hl
pop de
ret
2018-06-24 07:09:41 -07:00
CheckSeenMemMon:
2015-11-04 04:35:41 -08:00
push de
push hl
ld a, [wTempSpecies]
2015-11-04 04:35:41 -08:00
dec a
call CheckSeenMon
pop hl
pop de
ret
2018-06-24 07:09:41 -07:00
Function11b236:
2015-11-04 04:35:41 -08:00
jp FillBoxWithByte
2018-06-24 07:09:41 -07:00
Function11b239:
2015-11-04 04:35:41 -08:00
ld e, a
ld d, 0
add hl, de
2015-12-26 18:59:03 -08:00
add hl, de
2015-11-04 04:35:41 -08:00
ld a, [hli]
ld h, [hl]
ld l, a
ret
2018-06-24 07:09:41 -07:00
Function11b242:
2015-11-04 04:35:41 -08:00
hlcoord 3, 4
2018-01-23 14:39:09 -08:00
ld de, wStringBuffer3
2015-11-04 04:35:41 -08:00
call PlaceString
xor a
2018-01-23 14:39:09 -08:00
ld [wMonType], a
farcall GetGender
2015-11-04 04:35:41 -08:00
hlcoord 1, 4
2018-01-23 14:39:09 -08:00
ld a, [wCurPartySpecies]
2015-11-04 04:35:41 -08:00
ld bc, wcd2f
ld [bc], a
dec bc
jr c, asm_11b26a
jr z, asm_11b26f
ld a, $1
ld [bc], a
Function11b267:
ld [hl], $ef
ret
2018-10-24 12:33:18 -07:00
asm_11b26a:
2015-11-04 04:35:41 -08:00
xor a
ld [bc], a
ld [hl], $7f
ret
2018-10-24 12:33:18 -07:00
asm_11b26f:
2015-11-04 04:35:41 -08:00
ld a, $2
ld [bc], a
Function11b272:
ld [hl], $f5
ret
2018-06-24 07:09:41 -07:00
Function11b275:
2015-11-04 04:35:41 -08:00
call Function11b279
ret
2018-06-24 07:09:41 -07:00
Function11b279:
ld a, [wTempSpecies]
2018-01-23 14:39:09 -08:00
ld [wCurSpecies], a
2015-12-09 08:38:40 -08:00
call CheckSeenMemMon
2015-11-04 04:35:41 -08:00
jr z, .asm_11b28f
call GetBaseData
2018-01-23 14:39:09 -08:00
ld a, [wBaseGender]
2015-11-04 04:35:41 -08:00
ld [wcf65], a
jr .asm_11b294
.asm_11b28f
ld a, $ff
ld [wcf65], a
.asm_11b294
ret
2018-06-24 07:09:41 -07:00
Function11b295:
2015-11-04 04:35:41 -08:00
hlcoord 4, 13
ld de, String_11b308
call PlaceString
hlcoord 4, 14
ld de, String_11b308
call PlaceString
call Function11b20b
2015-12-09 08:38:40 -08:00
call CheckSeenMemMon
2015-11-04 04:35:41 -08:00
jr z, .asm_11b2d1
ld a, [$c608]
ld c, a
ld a, [$c608 + 1]
ld b, a
ld hl, $0007
add hl, bc
xor a
ld [hl], a
ld hl, $0003
add hl, bc
ld e, [hl]
2017-12-24 09:47:30 -08:00
farcall FlyFunction_GetMonIcon
2015-11-04 04:35:41 -08:00
hlcoord 4, 14
push hl
call GetPokemonName
jr .asm_11b2e7
.asm_11b2d1
ld a, [$c608]
ld c, a
ld a, [$c608 + 1]
ld b, a
ld hl, $0007
add hl, bc
ld a, $50
ld [hl], a
hlcoord 4, 13
push hl
ld de, String_11b30e
.asm_11b2e7
ld a, $6
2018-01-23 14:39:09 -08:00
ld bc, wStringBuffer4
2015-11-04 04:35:41 -08:00
.asm_11b2ec
push af
ld a, [de]
ld [bc], a
inc de
inc bc
pop af
dec a
and a
jr nz, .asm_11b2ec
pop hl
2018-01-23 14:39:09 -08:00
ld de, wStringBuffer4
2015-11-04 04:35:41 -08:00
call PlaceString
ret
2018-06-24 07:09:41 -07:00
String_11b2fe:
2015-11-04 04:35:41 -08:00
db "あげる#@"
2018-06-24 07:09:41 -07:00
String_11b303:
2015-11-04 04:35:41 -08:00
db "ほしい#@"
2018-06-24 07:09:41 -07:00
String_11b308:
db "     @"
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
String_11b30e:
2015-11-04 04:35:41 -08:00
db "みはっけん@"
2018-06-24 07:09:41 -07:00
Function11b314:
2015-11-04 04:35:41 -08:00
call Function11b31b
call Function11b3d9
ret
2018-06-24 07:09:41 -07:00
Function11b31b:
2015-12-09 08:38:40 -08:00
ld hl, .Coords
2015-11-04 04:35:41 -08:00
ld a, [wJumptableIndex]
2015-12-09 08:38:40 -08:00
cp 2
jr c, .tilemap_1
2015-11-04 04:35:41 -08:00
ld a, [wc7d1]
2015-12-09 08:38:40 -08:00
cp 4
jr nc, .tilemap_3
cp 3
jr c, .tilemap_1
2015-11-04 04:35:41 -08:00
ld a, [wJumptableIndex]
2015-12-09 08:38:40 -08:00
cp 2
jr z, .tilemap_1
cp 3
jr z, .tilemap_1
cp 6
jr z, .tilemap_1
2015-11-04 04:35:41 -08:00
2015-12-09 08:38:40 -08:00
ld bc, .Tilemap2
jr .load_sprites
2015-11-04 04:35:41 -08:00
2015-12-09 08:38:40 -08:00
.tilemap_3
ld bc, .Tilemap3
jr .load_sprites
2015-11-04 04:35:41 -08:00
2015-12-09 08:38:40 -08:00
.tilemap_1
ld bc, .Tilemap1
2015-11-04 04:35:41 -08:00
2015-12-09 08:38:40 -08:00
.load_sprites
2015-11-04 04:35:41 -08:00
call Function11b397
ret
2015-12-09 08:38:40 -08:00
.Coords:
dbpixel 3, 11, 2, 6 ; 0
dbpixel 3, 12, 2, 6 ; 1
dbpixel 3, 13, 2, 6 ; 2
dbpixel 3, 14, 2, 6 ; 3
dbpixel 3, 15, 2, 6 ; 4
dbpixel 3, 16, 2, 6 ; 5
dbpixel 3, 17, 2, 6 ; 6
dbpixel 4, 11, 2, 6 ; 7
dbpixel 4, 12, 2, 6 ; 8
dbpixel 4, 13, 2, 6 ; 9
dbpixel 4, 14, 2, 6 ; 10
dbpixel 4, 15, 2, 6 ; 11
dbpixel 4, 16, 2, 6 ; 12
dbpixel 4, 17, 2, 6 ; 13
2015-12-08 13:06:13 -08:00
db -1
2015-11-04 04:35:41 -08:00
2015-12-09 08:38:40 -08:00
.Tilemap1: ; vtiles
db $30 ; 0
db $31 ; 1
db $31 ; 2
db $31 ; 3
db $31 ; 4
db $31 ; 5
db $32 ; 6
db $40 ; 7
db $41 ; 8
db $41 ; 9
db $41 ; 10
db $41 ; 11
db $41 ; 12
db $42 ; 13
.Tilemap2: ; vtiles
db $30 ; 0
db $31 ; 1
db $31 ; 2
db $39 ; 3
db $39 ; 4
db $39 ; 5
db $39 ; 6
db $40 ; 7
db $41 ; 8
db $41 ; 9
db $39 ; 10
db $39 ; 11
db $39 ; 12
db $39 ; 13
.Tilemap3: ; vtiles
db $39 ; 0
db $39 ; 1
db $39 ; 2
db $39 ; 3
db $39 ; 4
db $39 ; 5
db $39 ; 6
db $39 ; 7
db $39 ; 8
db $39 ; 9
db $39 ; 10
db $39 ; 11
db $39 ; 12
db $39 ; 13
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
Function11b397:
2018-01-30 11:52:46 -08:00
ld de, wVirtualOAMSprite00
2015-12-09 08:38:40 -08:00
.loop
2015-11-04 04:35:41 -08:00
ld a, [hl]
cp $ff
ret z
ld a, [wc7d1]
and $7
swap a
add [hl]
2018-01-10 10:47:57 -08:00
inc hl
ld [de], a ; y
2015-11-04 04:35:41 -08:00
inc de
2015-12-08 13:06:13 -08:00
2018-01-10 10:47:57 -08:00
ld a, [hli]
ld [de], a ; x
2015-11-04 04:35:41 -08:00
inc de
2015-12-08 13:06:13 -08:00
2015-11-04 04:35:41 -08:00
ld a, [bc]
inc bc
2018-01-10 10:47:57 -08:00
ld [de], a ; tile id
2015-11-04 04:35:41 -08:00
inc de
2018-01-10 10:47:57 -08:00
ld a, $5
ld [de], a ; attributes
2015-11-04 04:35:41 -08:00
inc de
2015-12-09 08:38:40 -08:00
jr .loop
2015-11-04 04:35:41 -08:00
Function11b3b6: ; unreferenced
2015-12-09 08:38:40 -08:00
.loop
2015-11-04 04:35:41 -08:00
ld a, [hl]
2015-12-09 08:38:40 -08:00
cp -1
2015-11-04 04:35:41 -08:00
ret z
ld a, [wcd4d]
and $7
swap a
add [hl]
inc hl
ld [de], a
inc de
ld a, [hli]
ld [de], a
inc de
push hl
ld l, c
ld h, b
ld a, [wcd4e]
add [hl]
inc bc
ld [de], a
inc de
pop hl
ld a, $5
ld [de], a
inc de
2015-12-09 08:38:40 -08:00
jr .loop
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
Function11b3d9:
2018-01-30 11:52:46 -08:00
ld de, wVirtualOAMSprite28
2015-11-04 04:35:41 -08:00
push de
ld a, [wc7d2]
dec a
ld e, a
ld a, [wc7d1]
ld hl, wc7d0
add [hl]
cp e
2015-12-09 08:38:40 -08:00
jr z, .skip
2015-11-04 04:35:41 -08:00
ld hl, 0
2015-12-09 08:38:40 -08:00
ld bc, $70
2015-11-04 04:35:41 -08:00
call AddNTimes
ld e, l
ld d, h
2015-12-09 08:38:40 -08:00
ld b, 0
2015-11-04 04:35:41 -08:00
ld a, d
or e
2015-12-09 08:38:40 -08:00
jr z, .load_sprites
2015-11-04 04:35:41 -08:00
ld a, [wc7d2]
ld c, a
2015-12-09 08:38:40 -08:00
.loop1
2015-11-04 04:35:41 -08:00
ld a, e
sub c
ld e, a
ld a, d
sbc $0
ld d, a
2015-12-09 08:38:40 -08:00
jr c, .load_sprites
2015-11-04 04:35:41 -08:00
inc b
2015-12-09 08:38:40 -08:00
jr .loop1
2015-11-04 04:35:41 -08:00
2015-12-09 08:38:40 -08:00
.skip
ld b, 14 * 8
2015-11-04 04:35:41 -08:00
2015-12-09 08:38:40 -08:00
.load_sprites
ld a, 2 * 8 + 5
2015-11-04 04:35:41 -08:00
add b
pop hl
ld [hli], a
cp $41
2015-12-09 08:38:40 -08:00
jr c, .version1
2015-11-04 04:35:41 -08:00
ld a, [wJumptableIndex]
2015-12-09 08:38:40 -08:00
cp 4
jr z, .version2
cp 5
jr z, .version2
cp 7
jr z, .version2
cp 8
jr z, .version2
.version1
ld a, 19 * 8 + 3
2015-11-04 04:35:41 -08:00
ld [hli], a
ld a, [wcd4c]
add $3c
ld [hli], a
ld a, [wcd4c]
add $1
ld [hl], a
ret
2015-12-09 08:38:40 -08:00
.version2
ld a, 19 * 8 + 3
2015-11-04 04:35:41 -08:00
ld [hli], a
ld a, $39
ld [hli], a
xor a
ld [hl], a
ret
2018-06-24 07:09:41 -07:00
Function11b444:
2015-12-28 07:57:04 -08:00
; special
call Mobile46_InitJumptable
call Mobile46_RunJumptable
2015-11-04 04:35:41 -08:00
ret
2018-06-24 07:09:41 -07:00
Mobile46_InitJumptable:
2015-11-04 04:35:41 -08:00
xor a
ld [wJumptableIndex], a
ld [wcf64], a
ld [wcf65], a
ld [wcf66], a
call UpdateTime
ret
2018-06-24 07:09:41 -07:00
Mobile46_RunJumptable:
2015-12-09 08:38:40 -08:00
.loop
2015-12-28 07:57:04 -08:00
call .IterateJumptable
2015-11-04 04:35:41 -08:00
call DelayFrame
ld a, [wJumptableIndex]
2015-12-09 08:38:40 -08:00
cp 4
jr nz, .loop
2015-11-04 04:35:41 -08:00
ret
2018-06-24 07:09:41 -07:00
.IterateJumptable:
2015-12-26 18:59:03 -08:00
jumptable .Jumptable, wJumptableIndex
2015-11-04 04:35:41 -08:00
.Jumptable:
2015-11-04 04:35:41 -08:00
dw Function11b483
dw Function11b570
dw Function11b5c0
dw Function11b5e0
2015-12-09 08:38:40 -08:00
dw Function11b5e7 ; unused
2015-11-04 04:35:41 -08:00
2018-06-24 07:09:41 -07:00
Function11b483:
2015-12-26 18:59:03 -08:00
call .InitRAM
2018-01-23 14:39:09 -08:00
ld hl, wPlayerName
2017-12-21 08:56:33 -08:00
ld a, NAME_LENGTH_JAPANESE - 1
2015-12-09 08:38:40 -08:00
.loop1
2015-11-04 04:35:41 -08:00
push af
ld a, [hli]
ld [bc], a
inc bc
pop af
dec a
and a
2015-12-09 08:38:40 -08:00
jr nz, .loop1
ld de, PARTYMON_STRUCT_LENGTH
2018-01-23 14:39:09 -08:00
ld hl, wPartyMon1Species
2015-11-04 04:35:41 -08:00
ld a, [wcd82]
dec a
push af
2015-12-09 08:38:40 -08:00
.loop2
2015-11-04 04:35:41 -08:00
and a
2015-12-09 08:38:40 -08:00
jr z, .okay
2015-11-04 04:35:41 -08:00
add hl, de
dec a
2015-12-09 08:38:40 -08:00
jr .loop2
2015-11-04 04:35:41 -08:00
2015-12-09 08:38:40 -08:00
.okay
2015-11-04 04:35:41 -08:00
push bc
2015-12-09 08:38:40 -08:00
ld a, PARTYMON_STRUCT_LENGTH
.loop3
2015-11-04 04:35:41 -08:00
push af
ld a, [hli]
ld [bc], a
inc bc
pop af
dec a
and a
2015-12-09 08:38:40 -08:00
jr nz, .loop3
2015-11-04 04:35:41 -08:00
pop de
push bc
ld a, [de]
2018-01-23 14:39:09 -08:00
ld [wCurSpecies], a
2015-11-04 04:35:41 -08:00
call GetBaseData
2015-12-09 08:38:40 -08:00
ld hl, MON_LEVEL
2015-11-04 04:35:41 -08:00
add hl, de
ld a, [hl]
2018-01-23 14:39:09 -08:00
ld [wCurPartyLevel], a
2015-12-09 08:38:40 -08:00
ld hl, MON_MAXHP
2015-11-04 04:35:41 -08:00
add hl, de
push hl
2015-12-21 11:10:16 -08:00
ld hl, MON_STAT_EXP - 1
2015-11-04 04:35:41 -08:00
add hl, de
pop de
push de
ld b, TRUE
predef CalcMonStats
2015-11-04 04:35:41 -08:00
pop de
ld h, d
ld l, e
dec hl
2015-12-26 18:59:03 -08:00
dec hl
2015-11-04 04:35:41 -08:00
ld a, [de]
ld [hli], a
inc de
ld a, [de]
ld [hl], a
pop bc
2015-12-09 08:38:40 -08:00
ld de, NAME_LENGTH
2018-01-23 14:39:09 -08:00
ld hl, wPartyMonOT
2015-11-04 04:35:41 -08:00
pop af
push af
2015-12-09 08:38:40 -08:00
.loop4
2015-11-04 04:35:41 -08:00
and a
2015-12-09 08:38:40 -08:00
jr z, .okay2
2015-11-04 04:35:41 -08:00
add hl, de
dec a
2015-12-09 08:38:40 -08:00
jr .loop4
2015-11-04 04:35:41 -08:00
2015-12-09 08:38:40 -08:00
.okay2
ld a, NAME_LENGTH - 1
.loop5
2015-11-04 04:35:41 -08:00
push af
ld a, [hli]
ld [bc], a
inc bc
pop af
dec a
and a
2015-12-09 08:38:40 -08:00
jr nz, .loop5
ld de, NAME_LENGTH
2018-01-23 14:39:09 -08:00
ld hl, wPartyMonNicknames
2015-11-04 04:35:41 -08:00
pop af
push af
2015-12-09 08:38:40 -08:00
.loop6
2015-11-04 04:35:41 -08:00
and a
2015-12-09 08:38:40 -08:00
jr z, .okay3
2015-11-04 04:35:41 -08:00
add hl, de
dec a
2015-12-09 08:38:40 -08:00
jr .loop6
2015-11-04 04:35:41 -08:00
2015-12-09 08:38:40 -08:00
.okay3
ld a, NAME_LENGTH - 1
.loop7
2015-11-04 04:35:41 -08:00
push af
ld a, [hli]
ld [bc], a
inc bc
pop af
dec a
and a
2015-12-09 08:38:40 -08:00
jr nz, .loop7
ld de, MAIL_STRUCT_LENGTH
ld hl, sPartyMail
2015-11-04 04:35:41 -08:00
pop af
2015-12-09 08:38:40 -08:00
.loop8
2015-11-04 04:35:41 -08:00
and a
2015-12-09 08:38:40 -08:00
jr z, .okay4
2015-11-04 04:35:41 -08:00
add hl, de
dec a
2015-12-09 08:38:40 -08:00
jr .loop8
2015-11-04 04:35:41 -08:00
2015-12-09 08:38:40 -08:00
.okay4
ld a, BANK(sPartyMail)
call OpenSRAM
2015-12-09 08:38:40 -08:00
ld a, MAIL_STRUCT_LENGTH
.loop9
2015-11-04 04:35:41 -08:00
push af
ld a, [hli]
ld [bc], a
inc bc
pop af
dec a
and a
2015-12-09 08:38:40 -08:00
jr nz, .loop9
2015-11-04 04:35:41 -08:00
call CloseSRAM
jp Function11ad8a
.InitRAM:
2016-01-12 09:46:18 -08:00
ld bc, $c626
2018-01-23 14:39:09 -08:00
ld a, [wPlayerID]
2015-11-04 04:35:41 -08:00
ld [wcd2a], a
ld [bc], a
inc bc
2015-12-09 08:38:40 -08:00
2018-01-23 14:39:09 -08:00
ld a, [wPlayerID + 1]
2015-11-04 04:35:41 -08:00
ld [wcd2b], a
ld [bc], a
inc bc
2015-12-09 08:38:40 -08:00
2015-11-04 04:35:41 -08:00
ld a, [wSecretID]
ld [wcd2c], a
ld [bc], a
inc bc
2015-12-09 08:38:40 -08:00
2015-11-04 04:35:41 -08:00
ld a, [wSecretID + 1]
ld [wcd2d], a
ld [bc], a
inc bc
2015-12-09 08:38:40 -08:00
2015-11-04 04:35:41 -08:00
ld a, [wcd2e]
ld [bc], a
inc bc
2015-12-09 08:38:40 -08:00
2015-11-04 04:35:41 -08:00
ld a, [wcd2f]
ld [bc], a
inc bc
2015-12-09 08:38:40 -08:00
2015-11-04 04:35:41 -08:00
ld a, [wcd30]
ld [bc], a
inc bc
2015-12-09 08:38:40 -08:00
2015-11-04 04:35:41 -08:00
ld a, [wd265]
ld [bc], a
inc bc
ret
2018-06-24 07:09:41 -07:00
Function11b570:
2015-11-04 04:35:41 -08:00
call Function118007
2018-01-23 14:39:09 -08:00
ld a, [wScriptVar]
2015-11-04 04:35:41 -08:00
and a
2015-12-09 08:38:40 -08:00
jr nz, .exit
2015-12-26 18:59:03 -08:00
call .SaveData
2015-11-04 04:35:41 -08:00
jp Function11ad8a
2015-12-09 08:38:40 -08:00
.exit
2015-11-04 04:35:41 -08:00
ld a, $4
ld [wJumptableIndex], a
ret
.SaveData:
2015-11-04 04:35:41 -08:00
ld a, $3
ldh [rSVBK], a
2015-12-26 18:59:03 -08:00
2015-12-08 13:06:13 -08:00
ld hl, w3_d800
2015-11-04 04:35:41 -08:00
ld de, $c608
2015-12-09 08:38:40 -08:00
ld bc, w3_d88f - w3_d800
2015-11-04 04:35:41 -08:00
call CopyBytes
2015-12-26 18:59:03 -08:00
2015-11-04 04:35:41 -08:00
ld a, $1
ldh [rSVBK], a
2019-09-01 08:51:15 -07:00
ld a, BANK(s5_a800)
call OpenSRAM
2015-12-26 18:59:03 -08:00
2019-09-01 08:51:15 -07:00
ld de, s5_a800
2015-11-04 04:35:41 -08:00
ld a, $1
ld [de], a
inc de
ld hl, $c608
2015-12-09 08:38:40 -08:00
ld bc, w3_d88f - w3_d800
2015-11-04 04:35:41 -08:00
call CopyBytes
2015-12-26 18:59:03 -08:00
2015-11-04 04:35:41 -08:00
push de
pop hl
2015-12-26 18:59:03 -08:00
ldh a, [hRTCMinutes]
2015-11-04 04:35:41 -08:00
ld [hli], a
ldh a, [hRTCHours]
2015-11-04 04:35:41 -08:00
ld [hli], a
ldh a, [hRTCDayLo]
2015-11-04 04:35:41 -08:00
ld [hli], a
ldh a, [hRTCDayHi]
2015-11-04 04:35:41 -08:00
ld [hl], a
2015-12-26 18:59:03 -08:00
2015-11-04 04:35:41 -08:00
call CloseSRAM
ret
2018-06-24 07:09:41 -07:00
Function11b5c0:
2015-11-04 04:35:41 -08:00
ld a, [wcd82]
dec a
2018-01-23 14:39:09 -08:00
ld [wCurPartyMon], a
xor a ; REMOVE_PARTY
2015-12-09 08:38:40 -08:00
ld [wPokemonWithdrawDepositParameter], a
2017-12-24 09:47:30 -08:00
farcall RemoveMonFromPartyOrBox
farcall Function170807
farcall SaveAfterLinkTrade
2015-11-04 04:35:41 -08:00
jp Function11ad8a
2018-06-24 07:09:41 -07:00
Function11b5e0:
2015-11-04 04:35:41 -08:00
xor a
2018-01-23 14:39:09 -08:00
ld [wScriptVar], a
2015-11-04 04:35:41 -08:00
jp Function11ad8a
2018-06-24 07:09:41 -07:00
Function11b5e7:
2015-11-04 04:35:41 -08:00
ret
2018-06-24 07:09:41 -07:00
Function11b5e8:
2015-11-04 04:35:41 -08:00
ld a, $0
call OpenSRAM
2015-11-04 04:35:41 -08:00
ld hl, wRTC
ld de, $c608
2015-12-26 18:59:03 -08:00
ld bc, 4
2015-11-04 04:35:41 -08:00
call CopyBytes
call CloseSRAM
ld a, $5
call OpenSRAM
2015-11-04 04:35:41 -08:00
ld hl, $c608
ld de, $b08c
2015-12-26 18:59:03 -08:00
ld bc, 4
2015-11-04 04:35:41 -08:00
call CopyBytes
ld a, $2
ld [$a800], a
ld a, [$a81f]
ld [wcd2a], a
ld a, [$a820]
ld [wcd2b], a
ld a, [$a821]
ld [wcd2c], a
ld a, [$a822]
ld [wcd2d], a
ld a, [$a823]
ld [wcd2e], a
ld a, [$a824]
ld [wcd2f], a
ld a, [$a825]
ld [wcd30], a
ld a, [$a826]
ld [wcd31], a
call CloseSRAM
2015-12-28 07:57:04 -08:00
call Mobile46_InitJumptable
2015-12-26 18:59:03 -08:00
call .loop
2015-11-04 04:35:41 -08:00
ret
2015-12-26 18:59:03 -08:00
.loop
call .RunJumptable
2015-11-04 04:35:41 -08:00
call DelayFrame
ld a, [wJumptableIndex]
cp $1
2015-12-26 18:59:03 -08:00
jr nz, .loop
2015-11-04 04:35:41 -08:00
ret
.RunJumptable:
2015-12-26 18:59:03 -08:00
jumptable .Jumptable, wJumptableIndex
2017-12-29 04:52:42 -08:00
.Jumptable:
2015-11-04 04:35:41 -08:00
dw Function11b66d
dw Function11b6b3
2018-06-24 07:09:41 -07:00
Function11b66d:
2015-11-04 04:35:41 -08:00
call Function1180b8
2018-01-23 14:39:09 -08:00
ld a, [wScriptVar]
2015-11-04 04:35:41 -08:00
and a
jr nz, .asm_11b6b0
ldh a, [rSVBK]
2015-11-04 04:35:41 -08:00
push af
ld a, $3
ldh [rSVBK], a
2015-12-08 13:06:13 -08:00
ld a, [w3_d090]
2015-11-04 04:35:41 -08:00
ld b, a
pop af
ldh [rSVBK], a
2015-11-04 04:35:41 -08:00
ld a, b
and a
jr z, .asm_11b691
cp $1
jr nz, .asm_11b6b0
call Function11b6b4
jr .asm_11b6b0
.asm_11b691
2017-12-24 09:47:30 -08:00
farcall Function17081d
2018-01-23 14:39:09 -08:00
ld a, [wScriptVar]
2015-11-04 04:35:41 -08:00
and a
jr z, .asm_11b6b0
xor a
2018-01-23 14:39:09 -08:00
ld [wScriptVar], a
ldh a, [rSVBK]
2015-11-04 04:35:41 -08:00
push af
ld a, $3
ldh [rSVBK], a
2015-11-04 04:35:41 -08:00
ld a, $2
2015-12-08 13:06:13 -08:00
ld [w3_d090], a
2015-11-04 04:35:41 -08:00
pop af
ldh [rSVBK], a
2015-11-04 04:35:41 -08:00
.asm_11b6b0
jp Function11ad8a
2018-06-24 07:09:41 -07:00
Function11b6b3:
2015-11-04 04:35:41 -08:00
ret
2018-06-24 07:09:41 -07:00
Function11b6b4:
2015-11-04 04:35:41 -08:00
ld a, $5
call OpenSRAM
2015-11-04 04:35:41 -08:00
ld a, [wcd30]
2016-01-12 09:46:18 -08:00
ld [$c708], a
2015-11-04 04:35:41 -08:00
ld a, [wcd31]
2016-01-12 09:46:18 -08:00
ld [$c709], a
ld a, LOW($c708) ; Species
2015-12-25 20:34:33 -08:00
ld [wMobileMonSpeciesPointerBuffer], a
ld a, HIGH($c708)
2015-12-25 20:34:33 -08:00
ld [wMobileMonSpeciesPointerBuffer + 1], a
ld a, LOW($c60d) ; Partymon Struct
2015-12-25 20:34:33 -08:00
ld [wMobileMonStructurePointerBuffer], a
ld a, HIGH($c60d)
2015-12-25 20:34:33 -08:00
ld [wMobileMonStructurePointerBuffer + 1], a
ld a, LOW($c63d) ; OT
2015-12-25 20:34:33 -08:00
ld [wMobileMonOTNamePointerBuffer], a
ld a, HIGH($c63d)
2015-12-25 20:34:33 -08:00
ld [wMobileMonOTNamePointerBuffer + 1], a
ld a, LOW($c642) ; Nickname
2015-12-25 20:34:33 -08:00
ld [wMobileMonNicknamePointerBuffer], a
ld a, HIGH($c642)
2015-12-25 20:34:33 -08:00
ld [wMobileMonNicknamePointerBuffer + 1], a
ld a, LOW($c647) ; Mail
2015-12-25 20:34:33 -08:00
ld [wMobileMonMailPointerBuffer], a
ld a, HIGH($c647)
2015-12-25 20:34:33 -08:00
ld [wMobileMonMailPointerBuffer + 1], a
2015-11-04 04:35:41 -08:00
ld a, $46
ld [$c628], a
2015-12-25 20:34:33 -08:00
2015-11-04 04:35:41 -08:00
ld de, $c63d
2015-12-25 20:34:33 -08:00
ld c, 5
2017-12-24 09:47:30 -08:00
farcall CheckStringForErrors
2015-12-25 20:34:33 -08:00
jr nc, .length_check_OT
2017-12-24 09:47:30 -08:00
farcall Mobile_CopyDefaultOTName
2015-11-04 04:35:41 -08:00
2015-12-25 20:34:33 -08:00
.length_check_OT
2015-11-04 04:35:41 -08:00
ld de, $c63d
lb bc, 1, 5
2017-12-24 09:47:30 -08:00
farcall CheckStringContainsLessThanBNextCharacters
2015-12-25 20:34:33 -08:00
jr nc, .error_check_nick
2017-12-24 09:47:30 -08:00
farcall Mobile_CopyDefaultOTName
2015-11-04 04:35:41 -08:00
2015-12-25 20:34:33 -08:00
.error_check_nick
2015-11-04 04:35:41 -08:00
ld de, $c642
2015-12-25 20:34:33 -08:00
ld c, 5
2017-12-24 09:47:30 -08:00
farcall CheckStringForErrors
2015-12-25 20:34:33 -08:00
jr nc, .length_check_nick
2017-12-24 09:47:30 -08:00
farcall Mobile_CopyDefaultNickname
2015-11-04 04:35:41 -08:00
2015-12-25 20:34:33 -08:00
.length_check_nick
2015-11-04 04:35:41 -08:00
ld de, $c642
lb bc, 1, 5
2017-12-24 09:47:30 -08:00
farcall CheckStringContainsLessThanBNextCharacters
2015-12-25 20:34:33 -08:00
jr nc, .error_check_mail
2017-12-24 09:47:30 -08:00
farcall Mobile_CopyDefaultNickname
2015-11-04 04:35:41 -08:00
2015-12-25 20:34:33 -08:00
.error_check_mail
2015-11-04 04:35:41 -08:00
ld de, $c647
2015-12-25 20:34:33 -08:00
ld c, MAIL_MSG_LENGTH + 1
2017-12-24 09:47:30 -08:00
farcall CheckStringForErrors
2015-12-25 20:34:33 -08:00
jr nc, .length_check_mail
2017-12-24 09:47:30 -08:00
farcall Mobile_CopyDefaultMail
2015-11-04 04:35:41 -08:00
2015-12-25 20:34:33 -08:00
.length_check_mail
2015-11-04 04:35:41 -08:00
ld de, $c647
2015-12-25 20:34:33 -08:00
lb bc, 2, MAIL_MSG_LENGTH + 1
2017-12-24 09:47:30 -08:00
farcall CheckStringContainsLessThanBNextCharacters
2015-12-25 20:34:33 -08:00
jr c, .fix_mail
2015-11-04 04:35:41 -08:00
ld a, b
cp $2
2015-12-25 20:34:33 -08:00
jr nz, .mail_ok
2015-11-04 04:35:41 -08:00
2015-12-25 20:34:33 -08:00
.fix_mail
2017-12-24 09:47:30 -08:00
farcall Mobile_CopyDefaultMail
2015-11-04 04:35:41 -08:00
2015-12-25 20:34:33 -08:00
.mail_ok
2015-11-04 04:35:41 -08:00
ld de, $c668
ld c, $5
2017-12-24 09:47:30 -08:00
farcall CheckStringForErrors
2015-12-25 20:34:33 -08:00
jr nc, .length_check_author
2017-12-24 09:47:30 -08:00
farcall Mobile_CopyDefaultMailAuthor
2015-11-04 04:35:41 -08:00
2015-12-25 20:34:33 -08:00
.length_check_author
2015-11-04 04:35:41 -08:00
ld de, $c668
lb bc, 1, 5
2017-12-24 09:47:30 -08:00
farcall CheckStringContainsLessThanBNextCharacters
2015-12-25 20:34:33 -08:00
jr nc, .author_okay
2017-12-24 09:47:30 -08:00
farcall Mobile_CopyDefaultMailAuthor
2015-11-04 04:35:41 -08:00
2015-12-25 20:34:33 -08:00
.author_okay
ld a, [$c60e]
cp -1
jr nz, .item_okay
2015-11-04 04:35:41 -08:00
xor a
2015-12-25 20:34:33 -08:00
ld [$c60e], a
2015-11-04 04:35:41 -08:00
2015-12-25 20:34:33 -08:00
.item_okay
2015-11-04 04:35:41 -08:00
ld a, [wcd31]
2015-12-25 20:34:33 -08:00
ld [$c60d], a
2018-01-23 14:39:09 -08:00
ld [wCurSpecies], a
2015-11-04 04:35:41 -08:00
call GetBaseData
2015-12-25 20:34:33 -08:00
ld hl, $c60d + MON_LEVEL
2015-11-04 04:35:41 -08:00
ld a, [hl]
cp MIN_LEVEL
ld a, MIN_LEVEL
jr c, .replace_level
2015-11-04 04:35:41 -08:00
ld a, [hl]
cp MAX_LEVEL
jr c, .done_level
2015-11-04 04:35:41 -08:00
ld a, MAX_LEVEL
.replace_level
2015-11-04 04:35:41 -08:00
ld [hl], a
.done_level
2018-01-23 14:39:09 -08:00
ld [wCurPartyLevel], a
2015-11-04 04:35:41 -08:00
2015-12-25 20:34:33 -08:00
ld hl, $c60d + MON_STAT_EXP - 1
ld de, $c60d + MON_MAXHP
ld b, TRUE
predef CalcMonStats
2015-12-25 20:34:33 -08:00
ld de, $c60d + MON_MAXHP
ld hl, $c60d + MON_HP
2015-11-04 04:35:41 -08:00
ld a, [de]
ld [hli], a
inc de
ld a, [de]
ld [hl], a
2015-12-25 20:34:33 -08:00
call AddMobileMonToParty
2015-11-04 04:35:41 -08:00
ret
2018-06-24 07:09:41 -07:00
Function11b7e5:
ld a, [$c60d] ; species
ld [wOTTrademonSpecies], a
2018-01-23 14:39:09 -08:00
ld [wCurPartySpecies], a
2015-11-04 04:35:41 -08:00
ld a, [wcd81]
ld [wc74e], a
ld hl, $c63d ; OT
ld de, wOTTrademonOTName
2015-12-25 20:34:33 -08:00
ld bc, 5
2015-11-04 04:35:41 -08:00
call CopyBytes
ld a, "@"
2015-11-04 04:35:41 -08:00
ld [de], a
2015-12-25 20:34:33 -08:00
ld a, [$c60d + MON_ID] ; id
ld [wOTTrademonID], a
2015-12-25 20:34:33 -08:00
ld a, [$c60d + MON_ID + 1]
ld [wOTTrademonID + 1], a
2015-12-25 20:34:33 -08:00
ld hl, $c60d + MON_DVS ; dvs
2015-11-04 04:35:41 -08:00
ld a, [hli]
ld [wOTTrademonDVs], a
2015-11-04 04:35:41 -08:00
ld a, [hl]
ld [wOTTrademonDVs + 1], a
ld bc, $c60d ; pokemon_data_start
2017-12-24 09:47:30 -08:00
farcall GetCaughtGender
2015-11-04 04:35:41 -08:00
ld a, c
ld [wOTTrademonCaughtData], a
2019-04-08 05:15:10 -07:00
call SpeechTextbox
2015-11-04 04:35:41 -08:00
call FadeToMenu
2017-12-24 09:47:30 -08:00
farcall MobileTradeAnimation_ReceiveGetmonFromGTS
farcall Function17d1f1
2015-11-04 04:35:41 -08:00
ld a, $1
ld [wForceEvolution], a
2019-11-08 13:03:08 -08:00
ld a, LINK_TRADECENTER
2015-11-04 04:35:41 -08:00
ld [wLinkMode], a
2017-12-24 09:47:30 -08:00
farcall EvolvePokemon
2015-11-04 04:35:41 -08:00
xor a
ld [wLinkMode], a
2017-12-24 09:47:30 -08:00
farcall SaveAfterLinkTrade
2015-11-04 04:35:41 -08:00
ld a, $5
call OpenSRAM
2015-11-04 04:35:41 -08:00
ld a, $5
ld [$a800], a
call CloseSRAM
2018-01-23 14:39:09 -08:00
ld a, [wMapGroup]
2015-11-04 04:35:41 -08:00
ld b, a
2018-01-23 14:39:09 -08:00
ld a, [wMapNumber]
2015-11-04 04:35:41 -08:00
ld c, a
call GetMapSceneID
2015-11-04 04:35:41 -08:00
ld a, d
or e
jr z, .asm_11b872
ld a, $1
ld [de], a
.asm_11b872
call CloseSubmenu
2015-11-04 04:35:41 -08:00
call RestartMapMusic
ret
2018-06-24 07:09:41 -07:00
Function11b879:
2017-12-24 09:47:30 -08:00
farcall BattleTower_CheckSaveFileExistsAndIsYours
2018-01-23 14:39:09 -08:00
ld a, [wScriptVar]
2015-11-04 04:35:41 -08:00
and a
ret z
ld a, $5
call OpenSRAM
2015-11-04 04:35:41 -08:00
ld a, [$a800]
2018-01-23 14:39:09 -08:00
ld [wScriptVar], a
2015-11-04 04:35:41 -08:00
ld a, [$a890]
ld [wcd49], a
ld a, [$a891]
ld [wcd4a], a
ld a, [$a892]
ld [wcd4b], a
ld a, [$a893]
ld [wcd4c], a
call CloseSRAM
2018-01-23 14:39:09 -08:00
ld a, [wScriptVar]
2015-11-04 04:35:41 -08:00
and a
ret z
ld hl, wcd4c
ldh a, [hRTCDayHi]
2015-11-04 04:35:41 -08:00
cp [hl]
ret nz
dec hl
ldh a, [hRTCDayLo]
2015-11-04 04:35:41 -08:00
cp [hl]
ret nz
ld hl, wcd4a
ldh a, [hRTCHours]
2015-11-04 04:35:41 -08:00
cp [hl]
jr nc, .asm_11b8d8
ld a, $18
sub [hl]
ld hl, hRTCHours
add [hl]
ld [wcd4c], a
ldh a, [hRTCMinutes]
2015-11-04 04:35:41 -08:00
ld [wcd4b], a
xor a
ld [wcd4a], a
jr .asm_11b8e2
.asm_11b8d8
ldh a, [hRTCMinutes]
2015-11-04 04:35:41 -08:00
ld [wcd4b], a
ldh a, [hRTCHours]
2015-11-04 04:35:41 -08:00
ld [wcd4c], a
.asm_11b8e2
xor a
ld l, a
ld h, a
ld b, a
ld d, a
ld a, [wcd4b]
ld e, a
ld a, [wcd4c]
ld c, $3c
call AddNTimes
add hl, de
push hl
xor a
ld l, a
ld h, a
ld b, a
ld d, a
ld a, [wcd49]
ld e, a
ld a, [wcd4a]
ld c, $3c
call AddNTimes
add hl, de
ld a, l
cpl
add $1
ld e, a
ld a, h
cpl
2018-02-04 10:16:40 -08:00
adc 0
2015-11-04 04:35:41 -08:00
ld d, a
pop hl
add hl, de
ld de, $ff88
add hl, de
bit 7, h
ret z
ld a, $2
2018-01-23 14:39:09 -08:00
ld [wScriptVar], a
2015-11-04 04:35:41 -08:00
ret
2018-06-24 07:09:41 -07:00
Function11b920:
2015-12-28 07:57:04 -08:00
call Mobile46_InitJumptable
2015-11-04 04:35:41 -08:00
ld a, $5
call OpenSRAM
2015-11-04 04:35:41 -08:00
ld hl, $a81f
2016-01-12 09:46:18 -08:00
ld de, $c626
ld bc, 8
2015-11-04 04:35:41 -08:00
call CopyBytes
call CloseSRAM
call Function118000
ret
2018-06-24 07:09:41 -07:00
Function11b93b:
2015-11-04 04:35:41 -08:00
ld a, $5
call OpenSRAM
2015-11-04 04:35:41 -08:00
xor a
ld [$a800], a
ld hl, $a823
2015-12-25 20:34:33 -08:00
ld de, $c608
2015-11-04 04:35:41 -08:00
ld bc, $008f
call CopyBytes
call CloseSRAM
2015-12-25 20:34:33 -08:00
ld a, LOW($c608)
2015-12-25 20:34:33 -08:00
ld [wMobileMonSpeciesPointerBuffer], a
ld a, HIGH($c608)
2015-12-25 20:34:33 -08:00
ld [wMobileMonSpeciesPointerBuffer + 1], a
ld a, LOW($c611)
2015-12-25 20:34:33 -08:00
ld [wMobileMonStructurePointerBuffer], a
ld a, HIGH($c611)
2015-12-25 20:34:33 -08:00
ld [wMobileMonStructurePointerBuffer + 1], a
ld a, LOW($c641)
2015-12-25 20:34:33 -08:00
ld [wMobileMonOTNamePointerBuffer], a
ld a, HIGH($c641)
2015-12-25 20:34:33 -08:00
ld [wMobileMonOTNamePointerBuffer + 1], a
ld a, LOW($c646)
2015-12-25 20:34:33 -08:00
ld [wMobileMonNicknamePointerBuffer], a
ld a, HIGH($c646)
2015-12-25 20:34:33 -08:00
ld [wMobileMonNicknamePointerBuffer + 1], a
ld a, LOW($c64b)
2015-12-25 20:34:33 -08:00
ld [wMobileMonMailPointerBuffer], a
ld a, HIGH($c64b)
2015-12-25 20:34:33 -08:00
ld [wMobileMonMailPointerBuffer + 1], a
call AddMobileMonToParty
2017-12-24 09:47:30 -08:00
farcall SaveAfterLinkTrade
2015-11-04 04:35:41 -08:00
ret
2018-06-24 07:09:41 -07:00
AddMobileMonToParty:
2018-01-23 14:39:09 -08:00
ld hl, wPartyCount
2015-11-04 04:35:41 -08:00
ld a, [hl]
ld e, a
inc [hl]
2015-12-25 20:34:33 -08:00
ld a, [wMobileMonSpeciesPointerBuffer]
2015-11-04 04:35:41 -08:00
ld l, a
2015-12-25 20:34:33 -08:00
ld a, [wMobileMonSpeciesPointerBuffer + 1]
2015-11-04 04:35:41 -08:00
ld h, a
inc hl
2018-01-23 14:39:09 -08:00
ld bc, wPartySpecies
2015-11-04 04:35:41 -08:00
ld d, e
.loop1
inc bc
dec d
jr nz, .loop1
ld a, e
2018-01-23 14:39:09 -08:00
ld [wCurPartyMon], a
2015-11-04 04:35:41 -08:00
ld a, [hl]
ld [bc], a
inc bc
2015-12-25 20:34:33 -08:00
ld a, -1
2015-11-04 04:35:41 -08:00
ld [bc], a
2015-12-25 20:34:33 -08:00
2018-01-23 14:39:09 -08:00
ld hl, wPartyMon1Species
ld bc, PARTYMON_STRUCT_LENGTH
2015-11-04 04:35:41 -08:00
ld a, e
2015-12-25 20:34:33 -08:00
ld [wMobileMonSpeciesBuffer], a
2015-11-04 04:35:41 -08:00
.loop2
add hl, bc
dec a
and a
jr nz, .loop2
ld e, l
ld d, h
2015-12-25 20:34:33 -08:00
ld a, [wMobileMonStructurePointerBuffer]
2015-11-04 04:35:41 -08:00
ld l, a
2015-12-25 20:34:33 -08:00
ld a, [wMobileMonStructurePointerBuffer + 1]
2015-11-04 04:35:41 -08:00
ld h, a
ld bc, PARTYMON_STRUCT_LENGTH
2015-11-04 04:35:41 -08:00
call CopyBytes
2015-12-25 20:34:33 -08:00
2018-01-23 14:39:09 -08:00
ld hl, wPartyMonOT
2015-11-04 04:35:41 -08:00
ld bc, NAME_LENGTH
2015-12-25 20:34:33 -08:00
ld a, [wMobileMonSpeciesBuffer]
2015-11-04 04:35:41 -08:00
.loop3
add hl, bc
dec a
and a
jr nz, .loop3
ld e, l
ld d, h
2015-12-25 20:34:33 -08:00
ld a, [wMobileMonOTNamePointerBuffer]
2015-11-04 04:35:41 -08:00
ld l, a
2015-12-25 20:34:33 -08:00
ld a, [wMobileMonOTNamePointerBuffer + 1]
2015-11-04 04:35:41 -08:00
ld h, a
2018-01-20 09:25:55 -08:00
ld bc, MON_NAME_LENGTH - 1
2015-11-04 04:35:41 -08:00
call CopyBytes
ld a, "@"
ld [de], a
2015-12-25 20:34:33 -08:00
2018-01-23 14:39:09 -08:00
ld hl, wPartyMonNicknames
2018-01-20 09:25:55 -08:00
ld bc, MON_NAME_LENGTH
2015-12-25 20:34:33 -08:00
ld a, [wMobileMonSpeciesBuffer]
2015-11-04 04:35:41 -08:00
.loop4
add hl, bc
dec a
and a
jr nz, .loop4
ld e, l
ld d, h
2015-12-25 20:34:33 -08:00
ld a, [wMobileMonNicknamePointerBuffer]
2015-11-04 04:35:41 -08:00
ld l, a
2015-12-25 20:34:33 -08:00
ld a, [wMobileMonNicknamePointerBuffer + 1]
2015-11-04 04:35:41 -08:00
ld h, a
2018-01-20 09:25:55 -08:00
ld bc, MON_NAME_LENGTH - 1
2015-11-04 04:35:41 -08:00
call CopyBytes
ld a, "@"
ld [de], a
2015-12-25 20:34:33 -08:00
2015-11-17 14:56:49 -08:00
ld hl, sPartyMail
2015-12-25 20:34:33 -08:00
ld bc, MAIL_STRUCT_LENGTH
ld a, [wMobileMonSpeciesBuffer]
2015-11-04 04:35:41 -08:00
.loop5
add hl, bc
dec a
and a
jr nz, .loop5
2015-12-25 20:34:33 -08:00
ld a, BANK(sPartyMail)
call OpenSRAM
2015-11-04 04:35:41 -08:00
ld e, l
ld d, h
2015-12-25 20:34:33 -08:00
ld a, [wMobileMonMailPointerBuffer]
2015-11-04 04:35:41 -08:00
ld l, a
2015-12-25 20:34:33 -08:00
ld a, [wMobileMonMailPointerBuffer + 1]
2015-11-04 04:35:41 -08:00
ld h, a
2015-12-25 20:34:33 -08:00
ld bc, MAIL_STRUCT_LENGTH
2015-11-04 04:35:41 -08:00
call CopyBytes
2015-12-25 20:34:33 -08:00
2015-11-04 04:35:41 -08:00
call CloseSRAM
ret
2018-06-24 07:09:41 -07:00
Function11ba38:
2017-12-24 09:47:30 -08:00
farcall CheckCurPartyMonFainted
2015-11-04 04:35:41 -08:00
ret c
xor a
2018-01-23 14:39:09 -08:00
ld [wScriptVar], a
2015-11-04 04:35:41 -08:00
ret
2015-12-25 20:34:33 -08:00
TilemapPack_11ba44:
db $47, $30, $0a, $0a, $0a, $0a, $0a, $56 ; 00
db $46, $2f, $0a, $0a, $0a, $0a, $0a, $55 ; 01
db $45, $3d, $0a, $0a, $0a, $0a, $0a, $54 ; 02
db $44, $30, $0a, $0a, $0a, $0a, $0a, $53 ; 03
db $43, $2f, $0a, $0a, $0a, $0a, $0a, $52 ; 04
db $4a, $3d, $0a, $0a, $0a, $0a, $0a, $51 ; 05
db $4a, $30, $0a, $0a, $0a, $0a, $0a, $50 ; 06
db $4a, $2f, $0a, $0a, $0a, $0a, $0a, $4f ; 07
db $4a, $3d, $0a, $0a, $0a, $0a, $0a, $4e ; 08
db $4a, $30, $0a, $0a, $0a, $0a, $4d, $42 ; 09
db $4a, $2f, $0a, $0a, $0a, $0a, $6b, $58 ; 0a
db $4a, $3d, $0a, $0a, $0a, $0a, $6a, $58 ; 0b
db $4a, $30, $0a, $0a, $0a, $0a, $69, $58 ; 0c
db $4a, $2f, $0a, $0a, $0a, $0a, $68, $58 ; 0d
db $4a, $3d, $0a, $0a, $0a, $66, $67, $58 ; 0e
db $4a, $30, $0a, $0a, $0a, $65, $0a, $58 ; 0f
db $4a, $2f, $0a, $0a, $0a, $64, $0a, $58 ; 10
db $4a, $3d, $0a, $0a, $0a, $63, $0a, $58 ; 11
db $4a, $30, $0a, $0a, $61, $62, $0a, $58 ; 12
db $4a, $2f, $0a, $0a, $5f, $60, $0a, $58 ; 13
db $4a, $3d, $0a, $61, $62, $0a, $0a, $58 ; 14
db $4a, $30, $0a, $63, $0a, $0a, $0a, $58 ; 15
db $4a, $2f, $69, $0a, $0a, $0a, $0a, $58 ; 16
db $4a, $3d, $81, $0a, $0a, $0a, $0a, $58 ; 17
db $4a, $30, $80, $0a, $0a, $0a, $0a, $58 ; 18
db $4a, $2f, $7f, $0a, $0a, $0a, $0a, $58 ; 19
db $4a, $3d, $0a, $0a, $0a, $0a, $0a, $58 ; 1a
db $4a, $30, $0a, $0a, $0a, $0a, $0a, $58 ; 1b
db $4a, $2f, $68, $87, $88, $89, $0a, $58 ; 1c
db $4a, $3d, $6e, $6f, $70, $75, $76, $58 ; 1d
db $4a, $30, $75, $76, $5c, $5d, $5e, $58 ; 1e
db $4a, $2f, $71, $72, $73, $74, $6d, $58 ; 1f
db $4a, $3d, $75, $76, $77, $8a, $8b, $58 ; 20
db $4a, $30, $66, $67, $65, $0a, $6a, $58 ; 21
db $4a, $2f, $83, $84, $0a, $83, $84, $58 ; 22
db $4a, $3d, $0a, $85, $82, $84, $0a, $58 ; 23
db $4a, $30, $41, $80, $40, $0a, $0a, $58 ; 24
db $4a, $2f, $83, $0a, $0a, $0a, $0a, $58 ; 25
db $4a, $3d, $40, $0a, $0a, $0a, $0a, $58 ; 26
db -1
TilemapPack_11bb7d:
db $0a, $0a, $0a, $0a, $0a, $0a, $16, $00 ; 00
db $78, $0a, $0a, $0a, $0a, $0a, $8c, $00 ; 01
db $79, $0a, $0a, $0a, $0a, $0a, $8d, $00 ; 02
db $7a, $0a, $0a, $0a, $0a, $0a, $8e, $00 ; 03
db $7b, $0a, $0a, $0a, $0a, $0a, $8c, $00 ; 04
db $7c, $0a, $0a, $0a, $0a, $0a, $8d, $00 ; 05
db $7d, $0a, $0a, $0a, $0a, $0a, $8e, $00 ; 06
db $2e, $7e, $0a, $0a, $0a, $0a, $8c, $00 ; 07
db $2e, $80, $0a, $0a, $0a, $0a, $8d, $00 ; 08
db $2e, $81, $0a, $0a, $0a, $0a, $8e, $00 ; 09
db $2e, $82, $0a, $0a, $0a, $0a, $8c, $00 ; 0a
db $2e, $69, $0a, $0a, $0a, $0a, $8d, $00 ; 0b
db $2e, $6a, $0a, $0a, $0a, $0a, $8e, $00 ; 0c
db $2e, $6b, $0a, $0a, $0a, $0a, $8c, $00 ; 0d
db $2e, $0a, $68, $0a, $0a, $0a, $8d, $00 ; 0e
db $2e, $0a, $69, $0a, $0a, $0a, $8e, $00 ; 0f
db $2e, $0a, $0a, $6a, $0a, $0a, $8c, $00 ; 10
db $2e, $0a, $0a, $6b, $0a, $0a, $8d, $00 ; 11
db $2e, $0a, $0a, $0a, $80, $0a, $8e, $00 ; 12
db $2e, $0a, $0a, $0a, $82, $0a, $8c, $00 ; 13
db $2e, $0a, $0a, $0a, $6c, $0a, $8d, $00 ; 14
db $2e, $0a, $0a, $0a, $0a, $83, $8e, $00 ; 15
db $2e, $0a, $6b, $0a, $0a, $0a, $8c, $00 ; 16
db $2e, $0a, $0a, $69, $0a, $0a, $8d, $00 ; 17
db $2e, $0a, $0a, $6a, $0a, $0a, $8e, $00 ; 18
db $2e, $0a, $0a, $0a, $68, $0a, $8c, $00 ; 19
db $2e, $0a, $0a, $0a, $63, $0a, $8d, $00 ; 1a
db $2e, $0a, $0a, $61, $62, $0a, $8e, $00 ; 1b
db $2e, $0a, $0a, $0a, $5f, $60, $8c, $00 ; 1c
db $2e, $0a, $0a, $0a, $63, $0a, $8d, $00 ; 1d
db $2e, $0a, $0a, $0a, $0a, $69, $8c, $00 ; 1e
db $2e, $0a, $0a, $0a, $0a, $6b, $8d, $00 ; 1f
db $2e, $0a, $0a, $0a, $0a, $83, $8e, $00 ; 20
db $2e, $0a, $0a, $0a, $0a, $86, $8c, $00 ; 21
db $2e, $0a, $85, $0a, $0a, $0a, $8d, $00 ; 22
db $2e, $0a, $0a, $84, $0a, $0a, $8e, $00 ; 23
db -1