Merge pull request #623 from mid-kid/patch-1

Create some battle tower SRAM labels
This commit is contained in:
Rangi 2019-04-13 11:50:43 -04:00 committed by GitHub
commit 5cdf4f9ae0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 291 additions and 224 deletions

View File

@ -1133,28 +1133,28 @@ UnknownText_0x1c5962::
line "you're ready." line "you're ready."
done done
UnknownText_0x1c5983:: _NeedAtLeastThreeMonText::
text "You need at least" text "You need at least"
line "three #MON." line "three #MON."
para "" para ""
done done
UnknownText_0x1c59a3:: _EggDoesNotQualifyText::
text "Sorry, an EGG" text "Sorry, an EGG"
line "doesn't qualify." line "doesn't qualify."
para "" para ""
done done
Text_OnlyThreeMonMayBeEntered:: _OnlyThreeMonMayBeEnteredText::
text "Only three #MON" text "Only three #MON"
line "may be entered." line "may be entered."
para "" para ""
done done
Text_TheMonMustAllBeDifferentKinds:: _TheMonMustAllBeDifferentKindsText::
text "The @" text "The @"
text_ram wStringBuffer2 text_ram wStringBuffer2
text " #MON" text " #MON"
@ -1164,7 +1164,7 @@ Text_TheMonMustAllBeDifferentKinds::
para "" para ""
done done
Text_TheMonMustNotHoldTheSameItems:: _TheMonMustNotHoldTheSameItemsText::
text "The @" text "The @"
text_ram wStringBuffer2 text_ram wStringBuffer2
text " #MON" text " #MON"
@ -1174,7 +1174,7 @@ Text_TheMonMustNotHoldTheSameItems::
para "" para ""
done done
Text_YouCantTakeAnEgg:: _YouCantTakeAnEggText::
text "You can't take an" text "You can't take an"
line "EGG!" line "EGG!"

View File

@ -152,7 +152,7 @@ BattleAnimRestoreHuds:
ldh a, [rSVBK] ldh a, [rSVBK]
push af push af
ld a, BANK(wCurBattleMon) ; alternatively: BANK(wTempMon), BANK(wPartyMon1), several others ld a, BANK(wCurBattleMon) ; aka BANK(wTempMon) and BANK(wPartyMon1) and several others
ldh [rSVBK], a ldh [rSVBK], a
ld hl, UpdateBattleHuds ld hl, UpdateBattleHuds

View File

@ -12,33 +12,33 @@ Function1700ba:
Function1700c4: Function1700c4:
ldh a, [rSVBK] ldh a, [rSVBK]
push af push af
ld a, $3 ld a, BANK(w3_d202TrainerData) ; aka BANK(w3_dffc) and BANK(w3_d202Name)
ldh [rSVBK], a ldh [rSVBK], a
call Function17042c call Function17042c
ld a, $5 ld a, BANK(s5_be45) ; aka BANK(s5_be46) and BANK(s5_aa41) and BANK(s5_aa5d)
call GetSRAMBank call GetSRAMBank
ld a, $1 ld a, 1
ld [$be45], a ld [s5_be45], a
xor a xor a
ld [$be46], a ld [s5_be46], a
ld hl, w3_dffc ld hl, w3_dffc
ld de, $aa41 ld de, s5_aa41
ld bc, 4 ld bc, 4
call CopyBytes call CopyBytes
ld hl, w3_d202Name ld hl, w3_d202Name
ld de, $aa8e ld de, s5_aa8e
ld bc, 7 * $cc ; length of battle tower struct from japanese games? ld bc, 7 * $cc ; length of battle tower struct from japanese games?
call CopyBytes call CopyBytes
ld hl, $aa5d ; some sort of count ld hl, s5_aa5d ; some sort of count
ld a, [hl] ld a, [hl]
inc [hl] inc [hl]
inc hl inc hl
sla a sla a
sla a sla a
ld e, a ld e, a
ld d, $0 ld d, 0
add hl, de add hl, de
ld e, l ld e, l
ld d, h ld d, h
@ -57,11 +57,11 @@ Function170114:
ret ret
.Function170121: .Function170121:
ld a, $5 ld a, BANK(s5_a948)
call GetSRAMBank call GetSRAMBank
ld hl, $a948 ld hl, s5_a948
ld de, wc608 ld de, wc608
ld bc, $f6 ; 246 ld bc, 246
call CopyBytes call CopyBytes
call CloseSRAM call CloseSRAM
call Function170c8b call Function170c8b
@ -69,10 +69,10 @@ Function170114:
Function170139: Function170139:
; Convert the 4-digit decimal number at 5:aa41 into binary ; Convert the 4-digit decimal number at 5:aa41 into binary
ld a, $5 ld a, BANK(s5_aa41)
call GetSRAMBank call GetSRAMBank
ld de, $aa41 ld de, s5_aa41
ld h, $0 ld h, 0
ld l, h ld l, h
ld bc, 1000 ld bc, 1000
call .DecToBin call .DecToBin
@ -82,7 +82,7 @@ Function170139:
call .DecToBin call .DecToBin
ld a, [de] ld a, [de]
ld c, a ld c, a
ld b, $0 ld b, 0
add hl, bc add hl, bc
call CloseSRAM call CloseSRAM
; Store that number in wc608 ; Store that number in wc608
@ -145,20 +145,22 @@ Function170139:
pop af pop af
dec a dec a
jr nz, .CopyLoop jr nz, .CopyLoop
ld a, $4
ld a, BANK(s4_a013)
call GetSRAMBank call GetSRAMBank
ld hl, $a013 ld hl, s4_a013
ld bc, $24 ld bc, 36
call CopyBytes call CopyBytes
call CloseSRAM call CloseSRAM
ld a, $5
ld a, BANK(s5_a894) ; aka BANK(s5_a948)
call GetSRAMBank call GetSRAMBank
ld hl, $a894 ld hl, s5_a894
ld bc, NAME_LENGTH_JAPANESE ld bc, NAME_LENGTH_JAPANESE
call CopyBytes call CopyBytes
ld hl, wc608 ld hl, wc608
ld de, $a948 ld de, s5_a948
ld bc, $f6 ld bc, 246
call CopyBytes call CopyBytes
call CloseSRAM call CloseSRAM
ret ret
@ -176,7 +178,7 @@ Function170139:
ret ret
BattleTowerBattle: BattleTowerBattle:
xor a xor a ; FALSE
ld [wBattleTowerBattleEnded], a ld [wBattleTowerBattleEnded], a
call _BattleTowerBattle call _BattleTowerBattle
ret ret
@ -197,7 +199,7 @@ _BattleTowerBattle:
call .do_dw call .do_dw
call DelayFrame call DelayFrame
ld a, [wBattleTowerBattleEnded] ld a, [wBattleTowerBattleEnded]
cp $1 cp TRUE
jr nz, .loop jr nz, .loop
ret ret
@ -225,7 +227,7 @@ RunBattleTowerTrainer:
ld a, [wInBattleTowerBattle] ld a, [wInBattleTowerBattle]
push af push af
or $1 or 1
ld [wInBattleTowerBattle], a ld [wInBattleTowerBattle], a
xor a xor a
@ -260,7 +262,7 @@ RunBattleTowerTrainer:
ld [wInBattleTowerBattle], a ld [wInBattleTowerBattle], a
pop af pop af
ld [wOptions], a ld [wOptions], a
ld a, $1 ld a, TRUE
ld [wBattleTowerBattleEnded], a ld [wBattleTowerBattleEnded], a
ret ret
@ -407,9 +409,9 @@ endr
.valid .valid
ld [wCurSpecies], a ld [wCurSpecies], a
call GetBaseData call GetBaseData
ld a, $5 ld a, BANK(s5_b2fb)
call GetSRAMBank call GetSRAMBank
ld a, [$b2fb] ; s5_b2fb ; max level? ld a, [s5_b2fb] ; s5_b2fb ; max level?
call CloseSRAM call CloseSRAM
ld e, a ld e, a
ld hl, MON_LEVEL ld hl, MON_LEVEL
@ -640,17 +642,17 @@ Function1704e1:
dw .Jumptable_2 dw .Jumptable_2
.Jumptable_0: .Jumptable_0:
ld a, $5 ld a, BANK(s5_a89c)
call GetSRAMBank call GetSRAMBank
ld hl, $a89c ld hl, s5_a89c
ld de, wStringBuffer3 ld de, wStringBuffer3
ld bc, $16 ld bc, 22
call CopyBytes call CopyBytes
ld hl, $a8b2 ld hl, s5_a8b2
ld de, wc608 ld de, wc608
ld bc, $0096 ld bc, 150
call CopyBytes call CopyBytes
call CloseSRAM call CloseSRAM
@ -879,41 +881,41 @@ BattleTowerAction:
jp hl jp hl
.dw .dw
dw BattleTowerAction_CheckExplanationRead ; 0x00 dw BattleTowerAction_CheckExplanationRead
dw BattleTowerAction_SetExplanationRead ; 0x01 dw BattleTowerAction_SetExplanationRead
dw BattleTowerAction_GetChallengeState ; 0x02 dw BattleTowerAction_GetChallengeState
dw BattleTowerAction_SetByteToQuickSaveChallenge ; 0x03 dw BattleTowerAction_SetByteToQuickSaveChallenge
dw BattleTowerAction_SetByteToCancelChallenge ; 0x04 dw BattleTowerAction_SetByteToCancelChallenge
dw Function1707ac ; 0x05 dw Function1707ac
dw Function1707f4 ; 0x06 dw Function1707f4
dw SaveBattleTowerLevelGroup ; 0x07 dw SaveBattleTowerLevelGroup
dw LoadBattleTowerLevelGroup ; 0x08 dw LoadBattleTowerLevelGroup
dw BattleTower_CheckSaveFileExistsAndIsYours ; 0x09 dw BattleTower_CheckSaveFileExistsAndIsYours
dw Function1708b1 ; 0x0a dw Function1708b1
dw CheckMobileEventIndex ; 0x0b dw CheckMobileEventIndex
dw Function1708c8 ; 0x0c dw Function1708c8
dw Function1708f0 ; 0x0d dw Function1708f0
dw BattleTowerAction_EggTicket ; 0x0e dw BattleTowerAction_EggTicket
dw Function1709aa ; 0x0f dw Function1709aa
dw Function1709bb ; 0x10 dw Function1709bb
dw Function170a9c ; 0x11 dw Function170a9c
dw Function170aa0 ; 0x12 dw Function170aa0
dw Function170aaf ; 0x13 dw Function170aaf
dw Function170abe ; 0x14 dw Function170abe
dw Function170ad7 ; 0x15 dw Function170ad7
dw Function170807 ; 0x16 dw Function170807
dw Function17081d ; 0x17 dw Function17081d
dw BattleTowerAction_LevelCheck ; 0x18 dw BattleTowerAction_LevelCheck
dw BattleTowerAction_UbersCheck ; 0x19 dw BattleTowerAction_UbersCheck
dw ResetBattleTowerTrainersSRAM ; 0x1a dw ResetBattleTowerTrainersSRAM
dw BattleTower_GiveReward ; 0x1b dw BattleTower_GiveReward
dw Function17071b ; 0x1c dw Function17071b
dw Function170729 ; 0x1d dw Function170729
dw BattleTower_RandomlyChooseReward ; 0x1e dw BattleTower_RandomlyChooseReward
dw BattleTower_SaveOptions ; 0x1f dw BattleTower_SaveOptions
; Reset the save memory for BattleTower-Trainers (Counter and all 7 TrainerBytes) ; Reset the save memory for BattleTower-Trainers (Counter and all 7 TrainerBytes)
ResetBattleTowerTrainersSRAM: ; BattleTowerAction $1a ResetBattleTowerTrainersSRAM:
ld a, BANK(sBTTrainers) ld a, BANK(sBTTrainers)
call GetSRAMBank call GetSRAMBank
@ -929,7 +931,7 @@ ResetBattleTowerTrainersSRAM: ; BattleTowerAction $1a
ret ret
BattleTower_GiveReward: ; BattleTowerAction $1b BattleTower_GiveReward:
ld a, BANK(sBattleTowerReward) ld a, BANK(sBattleTowerReward)
call GetSRAMBank call GetSRAMBank
@ -958,7 +960,7 @@ BattleTower_GiveReward: ; BattleTowerAction $1b
ld [wScriptVar], a ld [wScriptVar], a
ret ret
Function17071b: ; BattleTowerAction $1c Function17071b:
ld a, BANK(sBattleTowerChallengeState) ld a, BANK(sBattleTowerChallengeState)
call GetSRAMBank call GetSRAMBank
ld a, BATTLETOWER_WON_CHALLENGE ld a, BATTLETOWER_WON_CHALLENGE
@ -966,7 +968,7 @@ Function17071b: ; BattleTowerAction $1c
call CloseSRAM call CloseSRAM
ret ret
Function170729: ; BattleTowerAction $1d Function170729:
ld a, BANK(sBattleTowerChallengeState) ld a, BANK(sBattleTowerChallengeState)
call GetSRAMBank call GetSRAMBank
ld a, BATTLETOWER_RECEIVED_REWARD ld a, BATTLETOWER_RECEIVED_REWARD
@ -974,11 +976,11 @@ Function170729: ; BattleTowerAction $1d
call CloseSRAM call CloseSRAM
ret ret
BattleTower_SaveOptions: ; BattleTowerAction $1f BattleTower_SaveOptions:
farcall SaveOptions farcall SaveOptions
ret ret
BattleTower_RandomlyChooseReward: ; BattleTowerAction $1e BattleTower_RandomlyChooseReward:
; Generate a random stat boosting item. ; Generate a random stat boosting item.
.loop .loop
call Random call Random
@ -999,7 +1001,7 @@ BattleTower_RandomlyChooseReward: ; BattleTowerAction $1e
call CloseSRAM call CloseSRAM
ret ret
BattleTowerAction_CheckExplanationRead: ; BattleTowerAction $00 BattleTowerAction_CheckExplanationRead:
call BattleTower_CheckSaveFileExistsAndIsYours call BattleTower_CheckSaveFileExistsAndIsYours
ld a, [wScriptVar] ld a, [wScriptVar]
and a and a
@ -1008,12 +1010,12 @@ BattleTowerAction_CheckExplanationRead: ; BattleTowerAction $00
ld a, BANK(sBattleTowerSaveFileFlags) ld a, BANK(sBattleTowerSaveFileFlags)
call GetSRAMBank call GetSRAMBank
ld a, [sBattleTowerSaveFileFlags] ld a, [sBattleTowerSaveFileFlags]
and $2 and 2
ld [wScriptVar], a ld [wScriptVar], a
call CloseSRAM call CloseSRAM
ret ret
BattleTowerAction_GetChallengeState: ; BattleTowerAction $02 BattleTowerAction_GetChallengeState:
ld hl, sBattleTowerChallengeState ld hl, sBattleTowerChallengeState
ld a, BANK(sBattleTowerChallengeState) ld a, BANK(sBattleTowerChallengeState)
call GetSRAMBank call GetSRAMBank
@ -1022,20 +1024,20 @@ BattleTowerAction_GetChallengeState: ; BattleTowerAction $02
call CloseSRAM call CloseSRAM
ret ret
BattleTowerAction_SetExplanationRead: ; BattleTowerAction $01 BattleTowerAction_SetExplanationRead:
ld a, BANK(sBattleTowerSaveFileFlags) ld a, BANK(sBattleTowerSaveFileFlags)
call GetSRAMBank call GetSRAMBank
ld a, [sBattleTowerSaveFileFlags] ld a, [sBattleTowerSaveFileFlags]
or $2 or 2
ld [sBattleTowerSaveFileFlags], a ld [sBattleTowerSaveFileFlags], a
call CloseSRAM call CloseSRAM
ret ret
BattleTowerAction_SetByteToQuickSaveChallenge: ; BattleTowerAction $03 BattleTowerAction_SetByteToQuickSaveChallenge:
ld c, BATTLETOWER_SAVED_AND_LEFT ld c, BATTLETOWER_SAVED_AND_LEFT
jr asm_17079f jr asm_17079f
BattleTowerAction_SetByteToCancelChallenge: ; BattleTowerAction $04 BattleTowerAction_SetByteToCancelChallenge:
ld c, BATTLETOWER_NO_CHALLENGE ld c, BATTLETOWER_NO_CHALLENGE
asm_17079f: asm_17079f:
ld a, BANK(sBattleTowerChallengeState) ld a, BANK(sBattleTowerChallengeState)
@ -1045,31 +1047,31 @@ asm_17079f:
call CloseSRAM call CloseSRAM
ret ret
Function1707ac: ; BattleTowerAction $05 Function1707ac:
ld a, $5 ld a, BANK(s5_aa8c) ; aka BANK(s5_be46)
call GetSRAMBank call GetSRAMBank
ld a, [$aa8c] ld a, [s5_aa8c]
ld b, a ld b, a
ld a, [$be46] ld a, [s5_be46]
ld [wScriptVar], a ld [wScriptVar], a
call CloseSRAM call CloseSRAM
and a and a
ret z ret z
ld a, b ld a, b
cp $2 cp 2
jr nc, .asm_1707ef jr nc, .asm_1707ef
push bc push bc
call UpdateTime call UpdateTime
pop bc pop bc
ld a, $5 ld a, BANK(s5_aa8c)
call GetSRAMBank call GetSRAMBank
ld a, [$aa8b] ld a, [s5_aa8b]
call CloseSRAM call CloseSRAM
ld c, a ld c, a
ld a, [wCurDay] ld a, [wCurDay]
sub c sub c
jr c, .asm_1707e5 jr c, .asm_1707e5
cp $8 cp 8
jr nc, .asm_1707ef jr nc, .asm_1707ef
ld a, b ld a, b
and a and a
@ -1080,44 +1082,44 @@ Function1707ac: ; BattleTowerAction $05
ld a, $8c ld a, $8c
sub c sub c
add [hl] add [hl]
cp $8 cp 8
ret c ret c
.asm_1707ef .asm_1707ef
ld a, $8 ld a, 8
ld [wScriptVar], a ld [wScriptVar], a
Function1707f4: ; BattleTowerAction $06 Function1707f4:
ld a, $5 ld a, BANK(s5_be46) ; aka BANK(s5_aa8b) and BANK(s5_aa8c)
call GetSRAMBank call GetSRAMBank
xor a xor a
ld [$be46], a ld [s5_be46], a
ld [$aa8b], a ld [s5_aa8b], a
ld [$aa8c], a ld [s5_aa8c], a
call CloseSRAM call CloseSRAM
ret ret
Function170807: ; BattleTowerAction $16 Function170807:
call UpdateTime call UpdateTime
ld a, $5 ld a, BANK(s5_b2f9) ; aka BANK(s5_b2fa)
call GetSRAMBank call GetSRAMBank
ld a, [wCurDay] ld a, [wCurDay]
ld [$b2f9], a ld [s5_b2f9], a
xor a xor a
ld [$b2fa], a ld [s5_b2fa], a
call CloseSRAM call CloseSRAM
ret ret
Function17081d: ; BattleTowerAction $17 Function17081d:
xor a xor a
ld [wScriptVar], a ld [wScriptVar], a
ld a, $5 ld a, BANK(s5_b2f9) ; aka BANK(s5_b2fa)
call GetSRAMBank call GetSRAMBank
ld a, [$b2f9] ld a, [s5_b2f9]
ld c, a ld c, a
ld a, [$b2fa] ld a, [s5_b2fa]
ld b, a ld b, a
call CloseSRAM call CloseSRAM
cp $2 cp 2
jr nc, .asm_170853 jr nc, .asm_170853
push bc push bc
call UpdateTime call UpdateTime
@ -1125,7 +1127,7 @@ Function17081d: ; BattleTowerAction $17
ld a, [wCurDay] ld a, [wCurDay]
sub c sub c
jr c, .asm_170849 jr c, .asm_170849
cp $b cp 11
jr nc, .asm_170853 jr nc, .asm_170853
ld a, b ld a, b
and a and a
@ -1137,25 +1139,25 @@ Function17081d: ; BattleTowerAction $17
ld a, 140 ld a, 140
sub c sub c
add [hl] add [hl]
cp $b cp 11
ret c ret c
.asm_170853 .asm_170853
ld a, $1 ld a, 1
ld [wScriptVar], a ld [wScriptVar], a
ld a, $5 ld a, BANK(s5_b2f9) ; aka BANK(s5_b2fa)
call GetSRAMBank call GetSRAMBank
xor a xor a
ld [$b2f9], a ld [s5_b2f9], a
ld [$b2fa], a ld [s5_b2fa], a
call CloseSRAM call CloseSRAM
ret ret
SaveBattleTowerLevelGroup: ; BattleTowerAction $07 SaveBattleTowerLevelGroup:
ld a, BANK(sBTChoiceOfLevelGroup) ld a, BANK(sBTChoiceOfLevelGroup)
call GetSRAMBank call GetSRAMBank
ldh a, [rSVBK] ldh a, [rSVBK]
push af push af
ld a, $3 ld a, BANK(wBTChoiceOfLvlGroup)
ldh [rSVBK], a ldh [rSVBK], a
ld a, [wBTChoiceOfLvlGroup] ld a, [wBTChoiceOfLvlGroup]
ld [sBTChoiceOfLevelGroup], a ld [sBTChoiceOfLevelGroup], a
@ -1164,12 +1166,12 @@ SaveBattleTowerLevelGroup: ; BattleTowerAction $07
call CloseSRAM call CloseSRAM
ret ret
LoadBattleTowerLevelGroup: ; BattleTowerAction $08 ; Load level group choice LoadBattleTowerLevelGroup: ; Load level group choice
ld a, BANK(sBTChoiceOfLevelGroup) ld a, BANK(sBTChoiceOfLevelGroup)
call GetSRAMBank call GetSRAMBank
ldh a, [rSVBK] ldh a, [rSVBK]
push af push af
ld a, $3 ld a, BANK(wBTChoiceOfLvlGroup)
ldh [rSVBK], a ldh [rSVBK], a
ld a, [sBTChoiceOfLevelGroup] ld a, [sBTChoiceOfLevelGroup]
ld [wBTChoiceOfLvlGroup], a ld [wBTChoiceOfLvlGroup], a
@ -1178,17 +1180,17 @@ LoadBattleTowerLevelGroup: ; BattleTowerAction $08 ; Load level group choice
call CloseSRAM call CloseSRAM
ret ret
BattleTower_CheckSaveFileExistsAndIsYours: ; BattleTowerAction $09 BattleTower_CheckSaveFileExistsAndIsYours:
ld a, [wSaveFileExists] ld a, [wSaveFileExists]
and a and a
jr z, .nope jr z, .nope
farcall CompareLoadedAndSavedPlayerID farcall CompareLoadedAndSavedPlayerID
jr z, .yes jr z, .yes
xor a xor a ; FALSE
jr .nope jr .nope
.yes .yes
ld a, $1 ld a, TRUE
.nope .nope
ld [wScriptVar], a ld [wScriptVar], a
@ -1210,32 +1212,32 @@ CheckMobileEventIndex: ; BattleTowerAction $0b something to do with GS Ball
Function1708c8: ; BattleTowerAction $0c Function1708c8: ; BattleTowerAction $0c
call UpdateTime call UpdateTime
ld a, $5 ld a, BANK(s5_aa8b) ; aka BANK(s5_aa8c) and BANK(s5_aa5d) and BANK(s5_aa48) and BANK(s5_aa47)
call GetSRAMBank call GetSRAMBank
ld a, [wCurDay] ld a, [wCurDay]
ld [$aa8b], a ld [s5_aa8b], a
xor a xor a
ld [$aa8c], a ld [s5_aa8c], a
ld a, [$aa5d] ld a, [s5_aa5d]
cp $2 cp 2
jr nc, .asm_1708ec jr nc, .asm_1708ec
ld a, [wCurDay] ld a, [wCurDay]
ld [$aa48], a ld [s5_aa48], a
ld a, $1 ld a, 1
ld [$aa47], a ld [s5_aa47], a
.asm_1708ec .asm_1708ec
call CloseSRAM call CloseSRAM
ret ret
Function1708f0: ; BattleTowerAction $0d Function1708f0: ; BattleTowerAction $0d
xor a xor a ; FALSE
ld [wScriptVar], a ld [wScriptVar], a
call UpdateTime call UpdateTime
ld a, $5 ld a, BANK(s5_aa48) ; aka BANK(s5_aa47)
call GetSRAMBank call GetSRAMBank
ld a, [$aa48] ld a, [s5_aa48]
ld c, a ld c, a
ld a, [$aa47] ld a, [s5_aa47]
call CloseSRAM call CloseSRAM
and a and a
ret z ret z
@ -1243,30 +1245,30 @@ Function1708f0: ; BattleTowerAction $0d
ld a, c ld a, c
cp [hl] cp [hl]
jr nz, Function170923 jr nz, Function170923
ld a, $5 ld a, BANK(s5_aa5d)
call GetSRAMBank call GetSRAMBank
ld a, [$aa5d] ld a, [s5_aa5d]
call CloseSRAM call CloseSRAM
cp $5 cp 5
ret c ret c
ld a, $1 ld a, TRUE
ld [wScriptVar], a ld [wScriptVar], a
ret ret
Function170923: Function170923:
ld a, $5 ld a, BANK(s5_aa48) ; aka BANK(s5_aa47) and BANK(s5_aa5d)
call GetSRAMBank call GetSRAMBank
xor a xor a
ld [$aa48], a ld [s5_aa48], a
ld [$aa47], a ld [s5_aa47], a
ld hl, $aa5d ld hl, s5_aa5d
ld bc, $0011 ld bc, MOBILE_LOGIN_PASSWORD_LENGTH
call ByteFill call ByteFill
call CloseSRAM call CloseSRAM
ret ret
BattleTowerAction_EggTicket: ; BattleTowerAction $0e BattleTowerAction_EggTicket: ; BattleTowerAction $0e
xor a xor a ; FALSE
ld [wScriptVar], a ld [wScriptVar], a
ld a, EGG_TICKET ld a, EGG_TICKET
ld [wCurItem], a ld [wCurItem], a
@ -1319,7 +1321,7 @@ endr
ld [wCurItemQuantity], a ld [wCurItemQuantity], a
ld hl, wNumItems ld hl, wNumItems
call TossItem call TossItem
ld a, $1 ld a, TRUE
ld [wScriptVar], a ld [wScriptVar], a
ret ret
@ -1347,11 +1349,11 @@ Function1709aa: ; BattleTowerAction $0f
ret ret
Function1709bb: ; BattleTowerAction $10 Function1709bb: ; BattleTowerAction $10
xor a xor a ; FALSE
ld [wScriptVar], a ld [wScriptVar], a
ld a, $5 ld a, BANK(s5_a800)
call GetSRAMBank call GetSRAMBank
ld a, [$a800] ld a, [s5_a800]
call CloseSRAM call CloseSRAM
cp 6 cp 6
jr nc, .invalid jr nc, .invalid
@ -1366,10 +1368,10 @@ Function1709bb: ; BattleTowerAction $10
jp hl jp hl
.invalid .invalid
ld a, $5 ld a, BANK(s5_a800)
call GetSRAMBank call GetSRAMBank
xor a xor a
ld [$a800], a ld [s5_a800], a
call CloseSRAM call CloseSRAM
ret ret
@ -1382,46 +1384,46 @@ Function1709bb: ; BattleTowerAction $10
dw .Action5 dw .Action5
.DoAction1: .DoAction1:
ld a, $5 ld a, BANK(s5_a800)
call GetSRAMBank call GetSRAMBank
ld a, $1 ld a, 1
ld [$a800], a ld [s5_a800], a
call CloseSRAM call CloseSRAM
.NoAction: .NoAction:
ret ret
.Action4: .Action4:
ld a, $5 ld a, BANK(s5_b023) ; aka BANK(s5_a825) and BANK(s5_a826)
call GetSRAMBank call GetSRAMBank
ld hl, $b023 ld hl, s5_b023
ld de, wc608 ld de, wc608
ld bc, $0069 ld bc, 105
call CopyBytes call CopyBytes
ld a, [$a825] ld a, [s5_a825]
ld [wcd30], a ld [wcd30], a
ld a, [$a826] ld a, [s5_a826]
ld [wcd31], a ld [wcd31], a
call CloseSRAM call CloseSRAM
farcall Function11b6b4 farcall Function11b6b4
farcall Function17d0f3 farcall Function17d0f3
ld a, $1 ld a, TRUE
ld [wScriptVar], a ld [wScriptVar], a
ret ret
.Action5: .Action5:
ld a, $0 ld a, 0 ; ???
call GetSRAMBank call GetSRAMBank
ld hl, wRTC ld hl, wRTC
ld de, wc608 ld de, wc608
ld bc, $0004 ld bc, 4
call CopyBytes call CopyBytes
call CloseSRAM call CloseSRAM
ld a, $5 ld a, BANK(s5_b08c)
call GetSRAMBank call GetSRAMBank
ld hl, $b08c ld hl, s5_b08c
ld de, wc608 ld de, wc608
ld c, $4 ld c, 4
.compare_loop .compare_loop
ld a, [de] ld a, [de]
inc de inc de
@ -1444,16 +1446,16 @@ Function1709bb: ; BattleTowerAction $10
ret nz ret nz
.no_scene .no_scene
ld a, $1 ld a, TRUE
ld [wScriptVar], a ld [wScriptVar], a
ret ret
.different .different
call CloseSRAM call CloseSRAM
ld a, $5 ld a, BANK(s5_a800)
call GetSRAMBank call GetSRAMBank
xor a xor a
ld [$a800], a ld [s5_a800], a
call CloseSRAM call CloseSRAM
ld [wScriptVar], a ld [wScriptVar], a
ld a, [wMapGroup] ld a, [wMapGroup]
@ -1470,29 +1472,29 @@ Function1709bb: ; BattleTowerAction $10
.no_scene_2 .no_scene_2
ret ret
Function170a9c: ; BattleTowerAction $11 Function170a9c:
ld c, FALSE ld c, FALSE
jr asm_170aa2 jr asm_170aa2
Function170aa0: ; BattleTowerAction $12 Function170aa0:
ld c, TRUE ld c, TRUE
asm_170aa2: asm_170aa2:
ld a, $5 ld a, BANK(s5_aa8d)
call GetSRAMBank call GetSRAMBank
ld a, c ld a, c
ld [$aa8d], a ld [s5_aa8d], a
call CloseSRAM call CloseSRAM
ret ret
Function170aaf: ; BattleTowerAction $13 Function170aaf:
ld a, $5 ld a, BANK(s5_aa8d)
call GetSRAMBank call GetSRAMBank
ld a, [$aa8d] ld a, [s5_aa8d]
ld [wScriptVar], a ld [wScriptVar], a
call CloseSRAM call CloseSRAM
ret ret
Function170abe: ; BattleTowerAction $14 Function170abe:
call BattleTower_CheckSaveFileExistsAndIsYours call BattleTower_CheckSaveFileExistsAndIsYours
ld a, [wScriptVar] ld a, [wScriptVar]
and a and a
@ -1501,24 +1503,24 @@ Function170abe: ; BattleTowerAction $14
ld a, BANK(sBattleTowerSaveFileFlags) ld a, BANK(sBattleTowerSaveFileFlags)
call GetSRAMBank call GetSRAMBank
ld a, [sBattleTowerSaveFileFlags] ld a, [sBattleTowerSaveFileFlags]
and $1 and 1
ld [wScriptVar], a ld [wScriptVar], a
call CloseSRAM call CloseSRAM
ret ret
Function170ad7: ; BattleTowerAction $15 Function170ad7:
ld a, BANK(sBattleTowerSaveFileFlags) ld a, BANK(sBattleTowerSaveFileFlags)
call GetSRAMBank call GetSRAMBank
ld a, [sBattleTowerSaveFileFlags] ld a, [sBattleTowerSaveFileFlags]
or $1 or 1
ld [sBattleTowerSaveFileFlags], a ld [sBattleTowerSaveFileFlags], a
call CloseSRAM call CloseSRAM
ret ret
BattleTowerAction_LevelCheck: ; BattleTowerAction $18 BattleTowerAction_LevelCheck:
ld a, $5 ld a, BANK(s5_b2fb)
call GetSRAMBank call GetSRAMBank
ld a, [$b2fb] ld a, [s5_b2fb]
call CloseSRAM call CloseSRAM
ld c, 10 ld c, 10
call SimpleDivide call SimpleDivide
@ -1526,19 +1528,19 @@ BattleTowerAction_LevelCheck: ; BattleTowerAction $18
ld [wcd4f], a ld [wcd4f], a
xor a xor a
ld [wScriptVar], a ld [wScriptVar], a
farcall BattleTower_LevelCheck ; level check farcall BattleTower_LevelCheck
ret nc ret nc
ld a, $5 ld a, BANK(s5_b2fb)
call GetSRAMBank call GetSRAMBank
ld a, [$b2fb] ld a, [s5_b2fb]
call CloseSRAM call CloseSRAM
ld [wScriptVar], a ld [wScriptVar], a
ret ret
BattleTowerAction_UbersCheck: ; BattleTowerAction $19 BattleTowerAction_UbersCheck:
ld a, $5 ld a, BANK(s5_b2fb)
call GetSRAMBank call GetSRAMBank
ld a, [$b2fb] ld a, [s5_b2fb]
call CloseSRAM call CloseSRAM
ld c, 10 ld c, 10
call SimpleDivide call SimpleDivide
@ -1548,9 +1550,9 @@ BattleTowerAction_UbersCheck: ; BattleTowerAction $19
ld [wScriptVar], a ld [wScriptVar], a
farcall BattleTower_UbersCheck farcall BattleTower_UbersCheck
ret nc ret nc
ld a, $5 ld a, BANK(s5_b2fb)
call GetSRAMBank call GetSRAMBank
ld a, [$b2fb] ld a, [s5_b2fb]
call CloseSRAM call CloseSRAM
ld [wScriptVar], a ld [wScriptVar], a
ret ret
@ -1559,13 +1561,13 @@ LoadOpponentTrainerAndPokemonWithOTSprite:
farcall Function_LoadOpponentTrainerAndPokemons farcall Function_LoadOpponentTrainerAndPokemons
ldh a, [rSVBK] ldh a, [rSVBK]
push af push af
ld a, $3 ld a, BANK(wBT_OTTrainerClass)
ldh [rSVBK], a ldh [rSVBK], a
ld hl, wBT_OTTrainerClass ld hl, wBT_OTTrainerClass
ld a, [hl] ld a, [hl]
dec a dec a
ld c, a ld c, a
ld b, $0 ld b, 0
pop af pop af
ldh [rSVBK], a ldh [rSVBK], a
ld hl, BTTrainerClassSprites ld hl, BTTrainerClassSprites
@ -1606,13 +1608,13 @@ DummySpecial_170bd2:
CheckForBattleTowerRules: CheckForBattleTowerRules:
farcall _CheckForBattleTowerRules farcall _CheckForBattleTowerRules
jr c, .asm_170bde jr c, .ready
xor a ; FALSE xor a ; FALSE
jr .asm_170be0 jr .end
.asm_170bde .ready
ld a, TRUE ld a, TRUE
.asm_170be0 .end
ld [wScriptVar], a ld [wScriptVar], a
ret ret

View File

@ -17,8 +17,8 @@ CheckForMobileBattleRules:
.TextPointers: .TextPointers:
dw .ExcuseMeText dw .ExcuseMeText
dw JumpText_NeedAtLeastThreeMon dw NeedAtLeastThreeMonText
dw JumpText_EggDoesNotQualify dw EggDoesNotQualifyText
.ExcuseMeText: .ExcuseMeText:
; Excuse me! ; Excuse me!
@ -50,10 +50,10 @@ _CheckForBattleTowerRules:
.TextPointers: .TextPointers:
dw JumpText_ExcuseMeYoureNotReady dw JumpText_ExcuseMeYoureNotReady
dw JumpText_OnlyThreeMonMayBeEntered dw OnlyThreeMonMayBeEnteredText
dw JumpText_TheMonMustAllBeDifferentKinds dw TheMonMustAllBeDifferentKindsText
dw JumpText_TheMonMustNotHoldTheSameItems dw TheMonMustNotHoldTheSameItemsText
dw JumpText_YouCantTakeAnEgg dw YouCantTakeAnEggText
JumpText_ExcuseMeYoureNotReady: JumpText_ExcuseMeYoureNotReady:
; Excuse me. You're not ready. ; Excuse me. You're not ready.
@ -70,34 +70,34 @@ BattleTower_PleaseReturnWhenReady:
text_far UnknownText_0x1c5962 text_far UnknownText_0x1c5962
text_end text_end
JumpText_NeedAtLeastThreeMon: NeedAtLeastThreeMonText:
; You need at least three #MON. ; You need at least three #MON.
text_far UnknownText_0x1c5983 text_far _NeedAtLeastThreeMonText
text_end text_end
JumpText_EggDoesNotQualify: EggDoesNotQualifyText:
; Sorry, an EGG doesn't qualify. ; Sorry, an EGG doesn't qualify.
text_far UnknownText_0x1c59a3 text_far _EggDoesNotQualifyText
text_end text_end
JumpText_OnlyThreeMonMayBeEntered: OnlyThreeMonMayBeEnteredText:
; Only three #MON may be entered. ; Only three #MON may be entered.
text_far Text_OnlyThreeMonMayBeEntered text_far _OnlyThreeMonMayBeEnteredText
text_end text_end
JumpText_TheMonMustAllBeDifferentKinds: TheMonMustAllBeDifferentKindsText:
; The @ #MON must all be different kinds. ; The @ #MON must all be different kinds.
text_far Text_TheMonMustAllBeDifferentKinds text_far _TheMonMustAllBeDifferentKindsText
text_end text_end
JumpText_TheMonMustNotHoldTheSameItems: TheMonMustNotHoldTheSameItemsText:
; The @ #MON must not hold the same items. ; The @ #MON must not hold the same items.
text_far Text_TheMonMustNotHoldTheSameItems text_far _TheMonMustNotHoldTheSameItemsText
text_end text_end
JumpText_YouCantTakeAnEgg: YouCantTakeAnEggText:
; You can't take an EGG! ; You can't take an EGG!
text_far Text_YouCantTakeAnEgg text_far _YouCantTakeAnEggText
text_end text_end
BattleTower_ExecuteJumptable: BattleTower_ExecuteJumptable:
@ -161,7 +161,7 @@ BattleTower_ExecuteJumptable:
call z, .PrintFirstText call z, .PrintFirstText
pop bc pop bc
call .PrintNthText call .PrintNthText
ld b, $1 ld b, 1
pop de pop de
ret ret
@ -178,7 +178,7 @@ BattleTower_ExecuteJumptable:
call .GetTextPointers call .GetTextPointers
inc hl inc hl
inc hl inc hl
ld b, $0 ld b, 0
add hl, bc add hl, bc
add hl, bc add hl, bc
call .LoadTextPointer call .LoadTextPointer
@ -194,7 +194,7 @@ BattleTower_CheckPartyLengthIs3:
BattleTower_CheckPartyHasThreeMonsThatAreNotEggs: BattleTower_CheckPartyHasThreeMonsThatAreNotEggs:
ld hl, wPartyCount ld hl, wPartyCount
ld a, [hli] ld a, [hli]
ld b, $0 ld b, 0
ld c, a ld c, a
.loop .loop
ld a, [hli] ld a, [hli]

View File

@ -361,7 +361,9 @@ SRAM $02
"Boxes 1-7" "Boxes 1-7"
SRAM $03 SRAM $03
"Boxes 8-14" "Boxes 8-14"
SRAM $04
"SRAM Mobile 1"
SRAM $05 SRAM $05
"SRAM Mobile" "SRAM Mobile 2"
HRAM HRAM
"HRAM" "HRAM"

View File

@ -239,8 +239,13 @@ sBox12:: box sBox12
sBox13:: box sBox13 sBox13:: box sBox13
sBox14:: box sBox14 sBox14:: box sBox14
SECTION "SRAM Mobile 1", SRAM
SECTION "SRAM Mobile", SRAM, BANK [5] ds $13
s4_a013:: ds 36 ; a013
SECTION "SRAM Mobile 2", SRAM
ds 1 ; former location for sMobileEventIndex, moved to 1:BE3C in English ds 1 ; former location for sMobileEventIndex, moved to 1:BE3C in English
@ -292,9 +297,64 @@ sTrainerRankingsEnd:: ; a083
ds 1 ; Former location for sMobileEventIndexBackup, moved to 1:BE44 in English ds 1 ; Former location for sMobileEventIndexBackup, moved to 1:BE44 in English
sTrainerRankingsBackup:: ds sTrainerRankingsEnd - sTrainerRankings sTrainerRankingsBackup:: ds sTrainerRankingsEnd - sTrainerRankings ; a084
ds $945 ds $6fa
; aa4b
sMobileLoginPassword:: ds MOBILE_LOGIN_PASSWORD_LENGTH s5_a800:: db ; a800
ds $24
s5_a825:: db ; a825
s5_a826:: db ; a826
ds $6d
s5_a894:: ds NAME_LENGTH_JAPANESE ; a894
ds $2
s5_a89c:: ds 22 ; a89c
s5_a8b2:: ds 150 ; a8b2
s5_a948:: ds 246 ; a948
ds $3
s5_aa41:: ds 4 ; aa41
ds $2
s5_aa47:: db ; aa47
s5_aa48:: db ; aa48
ds $2
sMobileLoginPassword:: ds MOBILE_LOGIN_PASSWORD_LENGTH ; aa4b
ds $1
s5_aa5d:: ds MOBILE_LOGIN_PASSWORD_LENGTH ; aa5d
ds $1d
s5_aa8b:: db ; aa8b
s5_aa8c:: db ; aa8c
s5_aa8d:: db ; aa8d
s5_aa8e:: ds 7 * $cc ; aa8e
ds $1
s5_b023:: ds 105 ; b023
s5_b08c:: ds 4 ; b08c
ds $269
s5_b2f9:: db ; b2f9
s5_b2fa:: db ; b2fa
s5_b2fb:: db ; b2fb
ds $b49
s5_be45:: db ; be45
s5_be46:: db ; be46

View File

@ -2409,7 +2409,10 @@ wStartHour:: db ; d4b7
wStartMinute:: db ; d4b8 wStartMinute:: db ; d4b8
wStartSecond:: db ; d4b9 wStartSecond:: db ; d4b9
wRTC:: ds 8 ; d4ba wRTC:: ds 4 ; d4ba
ds 4
wDST:: ; d4c2 wDST:: ; d4c2
; bit 7: dst ; bit 7: dst
db db