Labels for Trainer Rankings stat tracking functions

This commit is contained in:
hatschky 2017-01-16 21:11:34 +00:00
parent 5a9701ddc8
commit f0209d6ed6
33 changed files with 322 additions and 241 deletions

View File

@ -2623,7 +2623,7 @@ AddBattleMoneyToAccount: ; 3d0be
push bc push bc
ld b, h ld b, h
ld c, l ld c, l
callba MobileFn_106008 callba TrainerRankings_AddToBattlePayouts
pop bc pop bc
pop hl pop hl
.loop .loop
@ -8401,7 +8401,7 @@ _DoBattle: ; 3f4d9
; 3f4dd ; 3f4dd
BattleIntro: ; 3f4dd BattleIntro: ; 3f4dd
callba MobileFn_106050 ; mobile callba TrainerRankings_Battles ; mobile
call LoadTrainerOrWildMonPic call LoadTrainerOrWildMonPic
xor a xor a
ld [TempBattleMonSpecies], a ld [TempBattleMonSpecies], a
@ -8486,7 +8486,7 @@ BackUpVBGMap2: ; 3f568
InitEnemyTrainer: ; 3f594 InitEnemyTrainer: ; 3f594
ld [TrainerClass], a ld [TrainerClass], a
callba MobileFn_10606a callba TrainerRankings_TrainerBattles
xor a xor a
ld [TempEnemyMonSpecies], a ld [TempEnemyMonSpecies], a
callab GetTrainerAttributes callab GetTrainerAttributes
@ -8542,7 +8542,7 @@ InitEnemyTrainer: ; 3f594
InitEnemyWildmon: ; 3f607 InitEnemyWildmon: ; 3f607
ld a, WILD_BATTLE ld a, WILD_BATTLE
ld [wBattleMode], a ld [wBattleMode], a
callba MobileFn_10605d callba TrainerRankings_WildBattles
call LoadEnemyMon call LoadEnemyMon
ld hl, EnemyMonMoves ld hl, EnemyMonMoves
ld de, wWildMonMoves ld de, wWildMonMoves
@ -8725,7 +8725,7 @@ CheckPayDay: ; 3f71d
; 3f759 ; 3f759
ShowLinkBattleParticipantsAfterEnd: ; 3f759 ShowLinkBattleParticipantsAfterEnd: ; 3f759
callba MobileFn_1060df callba TrainerRankings_LinkBattles
callba BackupMobileEventIndex callba BackupMobileEventIndex
ld a, [CurOTMon] ld a, [CurOTMon]
ld hl, OTPartyMon1Status ld hl, OTPartyMon1Status
@ -8755,17 +8755,17 @@ DetermineMobileBattleResult: ; 3f77c
cp $1 cp $1
jr c, .victory jr c, .victory
jr z, .loss jr z, .loss
callba MobileFn_SaveBattleResult_Draw callba TrainerRankings_ColosseumDraws
ld de, .Draw ld de, .Draw
jr .store_result jr .store_result
.victory .victory
callba MobileFn_SaveBattleResult_Win callba TrainerRankings_ColosseumWins
ld de, .Win ld de, .Win
jr .store_result jr .store_result
.loss .loss
callba MobileFn_SaveBattleResult_Lose callba TrainerRankings_ColosseumLosses
ld de, .Lose ld de, .Lose
jr .store_result jr .store_result
@ -9513,7 +9513,7 @@ BattleStartMessage: ; 3fc8b
cp BATTLETYPE_FISH cp BATTLETYPE_FISH
jr nz, .NotFishing jr nz, .NotFishing
callba MobileFn_106086 ; update fishing records? callba TrainerRankings_HookedEncounters
ld hl, HookedPokemonAttackedText ld hl, HookedPokemonAttackedText
jr .PlaceBattleStartText jr .PlaceBattleStartText

View File

@ -8073,7 +8073,7 @@ BattleCommand_LeechSeed: ; 36f9d
BattleCommand_Splash: ; 36fe1 BattleCommand_Splash: ; 36fe1
call AnimateCurrentMove call AnimateCurrentMove
callba MobileFn_1060e5 callba TrainerRankings_Splash
jp PrintNothingHappened jp PrintNothingHappened
; 36fed ; 36fed
@ -8600,7 +8600,7 @@ CheckSubstituteOpp: ; 37378
BattleCommand_SelfDestruct: ; 37380 BattleCommand_SelfDestruct: ; 37380
callba MobileFn_10610d callba TrainerRankings_SelfDestruct
ld a, BATTLEANIM_PLAYER_DAMAGE ld a, BATTLEANIM_PLAYER_DAMAGE
ld [wNumHits], a ld [wNumHits], a
ld c, 3 ld c, 3

View File

@ -1,3 +1,53 @@
; Mobile bank 5 ; Mobile bank 5
; sMobileEventIndex EQU $a000 ; moved to 1:BE3C in English
sTrainerRankings EQU $a001
sTrainerRankingGameTimeHOF EQU $a001
sTrainerRankingStepCountHOF EQU $a005
sTrainerRankingHealingsHOF EQU $a009
sTrainerRankingBattlesHOF EQU $a00d
sTrainerRankingStepCount EQU $a010
sTrainerRankingBattleTowerWins EQU $a014
sTrainerRankingTMsHMsTaught EQU $a018
sTrainerRankingBattles EQU $a01b
sTrainerRankingWildBattles EQU $a01e
sTrainerRankingTrainerBattles EQU $a021
sTrainerRankingUnused1 EQU $a024
sTrainerRankingHOFEntries EQU $a027
sTrainerRankingWildMonsCaught EQU $a02a
sTrainerRankingHookedEncounters EQU $a02d
sTrainerRankingEggsHatched EQU $a030
sTrainerRankingMonsEvolved EQU $a033
sTrainerRankingFruitPicked EQU $a036
sTrainerRankingHealings EQU $a039
sTrainerRankingMysteryGift EQU $a03c
sTrainerRankingTrades EQU $a03f
sTrainerRankingFly EQU $a042
sTrainerRankingSurf EQU $a045
sTrainerRankingWaterfall EQU $a048
sTrainerRankingWhiteOuts EQU $a04b
sTrainerRankingLuckyNumberShow EQU $a04e
sTrainerRankingPhoneCalls EQU $a051
sTrainerRankingUnused2 EQU $a054
sTrainerRankingLinkBattles EQU $a057
sTrainerRankingSplash EQU $a05a
sTrainerRankingTreeEncounters EQU $a05d
sTrainerRankingUnused3 EQU $a060
sTrainerRankingColosseumWins EQU $a063
sTrainerRankingColosseumLosses EQU $a066
sTrainerRankingColosseumDraws EQU $a069
sTrainerRankingSelfDestruct EQU $a06c
sTrainerRankingCurrentSlotsStreak EQU $a06f
sTrainerRankingLongestSlotsStreak EQU $a071
sTrainerRankingTotalSlotsPayouts EQU $a073
sTrainerRankingTotalBattlePayouts EQU $a077
sTrainerRankingLongestMagikarp EQU $a07b
sTrainerRankingShortestMagikarp EQU $a07d
sTrainerRankingBugContestScore EQU $a07f
sTrainerRankingsChecksum EQU $a081
sTrainerRankingsEnd EQU $a083
; sMobileEventIndexBackup EQU $a083 ; moved to 1:BE44 in English
sTrainerRankingsBackup EQU $a084
sMobileLoginPassword EQU $aa4b sMobileLoginPassword EQU $aa4b
LOGIN_PASSWORD_LENGTH EQU 17 LOGIN_PASSWORD_LENGTH EQU 17

View File

@ -232,7 +232,7 @@ HatchEggs: ; 16f70 (5:6f70)
push de push de
callba SetEggMonCaughtData callba SetEggMonCaughtData
callba MobileFn_10608d callba TrainerRankings_EggsHatched
ld a, [CurPartyMon] ld a, [CurPartyMon]
ld hl, PartyMons ; wdcdf (aliases: PartyMon1, PartyMon1Species) ld hl, PartyMons ; wdcdf (aliases: PartyMon1, PartyMon1Species)
ld bc, PARTYMON_STRUCT_LENGTH ld bc, PARTYMON_STRUCT_LENGTH

View File

@ -360,7 +360,7 @@ CheckForHiddenItems: ; b8172
TreeMonEncounter: ; b81ea TreeMonEncounter: ; b81ea
callba MobileFn_1060ef callba TrainerRankings_TreeEncounters
xor a xor a
ld [TempWildMonSpecies], a ld [TempWildMonSpecies], a

View File

@ -247,7 +247,7 @@ EvolveAfterBattle_MasterLoop
push hl push hl
ld hl, Text_EvolvedIntoPKMN ld hl, Text_EvolvedIntoPKMN
call PrintTextBoxText call PrintTextBoxText
callba MobileFn_106094 callba TrainerRankings_MonsEvolved
ld de, MUSIC_NONE ld de, MUSIC_NONE
call PlayMusic call PlayMusic

View File

@ -58,7 +58,7 @@ CheckFruitTree: ; 44055
; 4405f ; 4405f
PickedFruitTree: ; 4405f PickedFruitTree: ; 4405f
callba MobileFn_10609b ; empty function callba TrainerRankings_FruitPicked
ld b, 1 ld b, 1
jp GetFruitTreeFlag jp GetFruitTreeFlag
; 4406a ; 4406a

View File

@ -1973,7 +1973,7 @@ LinkTrade: ; 28b87
.save .save
callba SaveAfterLinkTrade callba SaveAfterLinkTrade
callba MobileFn_1060af callba TrainerRankings_Trades
callba BackupMobileEventIndex callba BackupMobileEventIndex
ld c, 40 ld c, 40
call DelayFrames call DelayFrames

View File

@ -63,7 +63,7 @@ DoMysteryGift: ; 1048ba (41:48ba)
jr z, .skip_append_save jr z, .skip_append_save
call .SaveMysteryGiftTrainerName call .SaveMysteryGiftTrainerName
callba RestoreMobileEventIndex callba RestoreMobileEventIndex
callba MobileFn_1060a9 callba TrainerRankings_MysteryGift
callba BackupMobileEventIndex callba BackupMobileEventIndex
.skip_append_save .skip_append_save
ld a, [wMysteryGiftPartnerSentDeco] ld a, [wMysteryGiftPartnerSentDeco]

View File

@ -471,7 +471,7 @@ UnknownScript_0x90261: ; 0x90261
RingTwice_StartCall: ; 9026f RingTwice_StartCall: ; 9026f
call .Ring call .Ring
call .Ring call .Ring
callba MobileFn_1060d3 callba TrainerRankings_PhoneCalls
ret ret
; 9027c ; 9027c
@ -500,7 +500,7 @@ PhoneCall:: ; 9029a
ld [PhoneCallerHi], a ld [PhoneCallerHi], a
call Phone_FirstOfTwoRings call Phone_FirstOfTwoRings
call Phone_FirstOfTwoRings call Phone_FirstOfTwoRings
callba MobileFn_1060d3 callba TrainerRankings_PhoneCalls
ret ret
; 902b3 ; 902b3

View File

@ -77,7 +77,7 @@ HandlePlayerStep: ; d4e5 (3:54e5)
ret ret
.mobile ; d509 (3:5509) .mobile ; d509 (3:5509)
callba MobileFn_10602e callba TrainerRankings_StepCount
ret ret
.fail2 ; d510 (3:5510) .fail2 ; d510 (3:5510)

View File

@ -3199,8 +3199,8 @@ Script_halloffame: ; 97bd5
ld hl, GameTimerPause ld hl, GameTimerPause
res 0, [hl] res 0, [hl]
callba Mobile_HallOfFame callba TrainerRankings_HallOfFame
callba Mobile_HallOfFame2 callba TrainerRankings_HallOfFame2
callba HallOfFame callba HallOfFame
ld hl, GameTimerPause ld hl, GameTimerPause
set 0, [hl] set 0, [hl]

View File

@ -20,7 +20,7 @@ _SlotMachine:
call PlaySFX call PlaySFX
call WaitSFX call WaitSFX
call ClearBGPalettes call ClearBGPalettes
callba MobileFn_105fd0 callba TrainerRankings_EndSlotsWinStreak
ld hl, Options ld hl, Options
res NO_TEXT_SCROLL, [hl] res NO_TEXT_SCROLL, [hl]
ld hl, rLCDC ; $ff40 ld hl, rLCDC ; $ff40
@ -1812,7 +1812,7 @@ SlotGetPayout: ; 93124 (24:7124)
ld a, [hl] ld a, [hl]
ld [wPayout], a ld [wPayout], a
ld d, a ld d, a
callba MobileFn_105fe3 callba TrainerRankings_AddToSlotsPayouts
ret ret
.PayoutTable: .PayoutTable:
@ -1836,7 +1836,7 @@ SlotPayoutText: ; 93158 (24:7158)
jr nz, .MatchedSomething jr nz, .MatchedSomething
ld hl, .Text_Darn ld hl, .Text_Darn
call PrintText call PrintText
callba MobileFn_105fd0 callba TrainerRankings_EndSlotsWinStreak
ret ret
.MatchedSomething: .MatchedSomething:
@ -1860,7 +1860,7 @@ SlotPayoutText: ; 93158 (24:7158)
.return .return
ld hl, .Text_PrintPayout ld hl, .Text_PrintPayout
call PrintText call PrintText
callba MobileFn_105f9f callba TrainerRankings_AddToSlotsWinStreak
ret ret
; 93195 (24:7195) ; 93195 (24:7195)

View File

@ -179,7 +179,7 @@ SpecialsPointers:: ; c029
add_special Mobile_SelectThreeMons add_special Mobile_SelectThreeMons
add_special Function1037eb add_special Function1037eb
add_special Function10383c add_special Function10383c
add_special Mobile_HealParty add_special TrainerRankings_Healings
add_special RefreshSprites add_special RefreshSprites
add_special Function1037c2 add_special Function1037c2
add_special Mobile_DummyReturnFalse add_special Mobile_DummyReturnFalse

View File

@ -1255,7 +1255,7 @@ MonMenu_Fly: ; 12e30
jr z, .Fail jr z, .Fail
cp $0 cp $0
jr z, .Error jr z, .Error
callba MobileFn_1060b5 callba TrainerRankings_Fly
ld b, $4 ld b, $4
ld a, $2 ld a, $2
ret ret

View File

@ -107,7 +107,7 @@ PokeCenterNurseScript:
farwritetext NurseTakePokemonText farwritetext NurseTakePokemonText
pause 20 pause 20
special Mobile_HealParty special TrainerRankings_Healings
spriteface LAST_TALKED, LEFT spriteface LAST_TALKED, LEFT
pause 10 pause 10
special HealParty special HealParty

View File

@ -146,7 +146,7 @@ TeachTMHM: ; 2c867
and a and a
jr z, .nope jr z, .nope
callba MobileFn_106049 callba TrainerRankings_TMsHMsTaught
ld a, [CurItem] ld a, [CurItem]
call IsHM call IsHM
ret c ret c

View File

@ -1,6 +1,6 @@
_BugContestJudging: ; 1369d _BugContestJudging: ; 1369d
call ContestScore call ContestScore
callba MobileFn_105f79 callba TrainerRankings_BugContestScore
call BugContest_JudgeContestants call BugContest_JudgeContestants
ld a, [wBugContestThirdPlacePersonID] ld a, [wBugContestThirdPlacePersonID]
call LoadContestantName call LoadContestantName

View File

@ -28,7 +28,7 @@ Special_CheckMagikarpLength: ; fbb32
ld c, l ld c, l
call CalcMagikarpLength call CalcMagikarpLength
call PrintMagikarpLength call PrintMagikarpLength
callba MagikarpLength_Mobile callba TrainerRankings_MagikarpLength
ld hl, .MeasureItText ld hl, .MeasureItText
call PrintText call PrintText

View File

@ -472,7 +472,7 @@ UsedSurfScript: ; c986
end end
.empty_fn ; c9a2 .empty_fn ; c9a2
callba MobileFn_1060bb ; empty callba TrainerRankings_Surf
ret ret
UsedSurfText: ; c9a9 UsedSurfText: ; c9a9
@ -745,7 +745,7 @@ Script_UsedWaterfall: ; 0xcb20
ld a, [PlayerStandingTile] ld a, [PlayerStandingTile]
call CheckWaterfallTile call CheckWaterfallTile
ret z ret z
callba MobileFn_1060c1 callba TrainerRankings_Waterfall
ld a, $1 ld a, $1
ld [ScriptVar], a ld [ScriptVar], a
ret ret

View File

@ -49,9 +49,7 @@ BattleBGMap: ; 1250a
; 12513 ; 12513
HalveMoney: ; 12513 HalveMoney: ; 12513
callba TrainerRankings_WhiteOuts
; Empty function...
callba MobileFn_1060c7
; Halve the player's money. ; Halve the player's money.
ld hl, Money ld hl, Money

View File

@ -512,7 +512,7 @@ ParkBall: ; e8a2
cp BATTLETYPE_TUTORIAL cp BATTLETYPE_TUTORIAL
jp z, .FinishTutorial jp z, .FinishTutorial
callba MobileFn_10607f callba TrainerRankings_WildMonsCaught
ld hl, Text_GotchaMonWasCaught ld hl, Text_GotchaMonWasCaught
call PrintText call PrintText

View File

@ -2830,7 +2830,7 @@ Special_CheckForLuckyNumberWinners: ; 4d87a
ld a, [ScriptVar] ld a, [ScriptVar]
and a and a
ret z ; found nothing ret z ; found nothing
callba MobileFn_1060cd callba TrainerRankings_LuckyNumberShow
ld a, [wFoundMatchingIDInParty] ld a, [wFoundMatchingIDInParty]
and a and a
push af push af

View File

@ -313,7 +313,7 @@ ElmsLabHealingMachine:
end end
ElmsLabHealingMachine_HealParty: ElmsLabHealingMachine_HealParty:
special Mobile_HealParty special TrainerRankings_Healings
special HealParty special HealParty
playmusic MUSIC_NONE playmusic MUSIC_NONE
writebyte 1 ; Machine is in Elm's Lab writebyte 1 ; Machine is in Elm's Lab

View File

@ -71,7 +71,7 @@ FastShipBed:
closetext closetext
special Special_FadeBlackQuickly special Special_FadeBlackQuickly
special Special_ReloadSpritesNoPalettes special Special_ReloadSpritesNoPalettes
special Mobile_HealParty special TrainerRankings_Healings
special HealParty special HealParty
playmusic MUSIC_HEAL playmusic MUSIC_HEAL
pause 60 pause 60

View File

@ -43,7 +43,7 @@ MapMobileBattleRoomSignpost0Script:
special RestartMapMusic special RestartMapMusic
refreshscreen $0 refreshscreen $0
.two_ .two_
special Mobile_HealParty special TrainerRankings_Healings
special HealParty special HealParty
special Function10383c special Function10383c
iftrue .false iftrue .false

View File

@ -115,7 +115,7 @@ MrPokemonsHouse_OakScript:
special Special_FadeBlackQuickly special Special_FadeBlackQuickly
special Special_ReloadSpritesNoPalettes special Special_ReloadSpritesNoPalettes
playmusic MUSIC_HEAL playmusic MUSIC_HEAL
special Mobile_HealParty special TrainerRankings_Healings
special HealParty special HealParty
pause 60 pause 60
special Special_FadeInQuickly special Special_FadeInQuickly

View File

@ -16,7 +16,7 @@ TeacherScript_0x7b125:
closetext closetext
special Special_FadeBlackQuickly special Special_FadeBlackQuickly
special Special_ReloadSpritesNoPalettes special Special_ReloadSpritesNoPalettes
special Mobile_HealParty special TrainerRankings_Healings
playmusic MUSIC_HEAL playmusic MUSIC_HEAL
special HealParty special HealParty
pause 60 pause 60

View File

@ -172,7 +172,7 @@ LanceHealsCommon:
waitbutton waitbutton
closetext closetext
special FadeOutPalettes special FadeOutPalettes
special Mobile_HealParty special TrainerRankings_Healings
playsound SFX_FULL_HEAL playsound SFX_FULL_HEAL
special HealParty special HealParty
special FadeInPalettes special FadeInPalettes

View File

@ -243,7 +243,7 @@ RunBattleTowerTrainer: ; 17024d
xor a xor a
ld [wLinkMode], a ld [wLinkMode], a
callba Mobile_HealParty callba TrainerRankings_Healings
callba HealParty callba HealParty
call ReadBTTrainerParty call ReadBTTrainerParty
call Clears5_a89a call Clears5_a89a

View File

@ -5452,7 +5452,7 @@ Function102423: ; 102423
call Function102921 call Function102921
ret nc ret nc
callba SaveAfterLinkTrade callba SaveAfterLinkTrade
callba MobileFn_1060af callba TrainerRankings_Trades
callba BackupMobileEventIndex callba BackupMobileEventIndex
ld hl, wcd4b ld hl, wcd4b
set 1, [hl] set 1, [hl]

View File

@ -1,50 +1,63 @@
SECTION "bank41_2", ROMX, BANK[$41] SECTION "bank41_2", ROMX, BANK[$41]
Mobile_HallOfFame2:: mobile ; 0x105ef6 ; These functions deal with miscellaneous statistics
; which were used for Trainer Rankings in Pokémon News.
; Copies certain values at the time the player enters the Hall of Fame.
TrainerRankings_HallOfFame2:: mobile ; 0x105ef6
ld a, $5 ld a, $5
call GetSRAMBank call GetSRAMBank
ld hl, GameTimeHours ld hl, GameTimeHours
ld de, $a001 ld de, sTrainerRankingGameTimeHOF
ld bc, 4 ld bc, 4
call CopyBytes call CopyBytes
ld hl, $a010
ld de, $a005 ld hl, sTrainerRankingStepCount
ld de, sTrainerRankingStepCountHOF
ld bc, 4 ld bc, 4
call CopyBytes call CopyBytes
ld hl, $a039
ld de, $a009 ; sTrainerRankingHealings is only a 3-byte value.
; One extraneous byte is copied from sTrainerRankingMysteryGift.
ld hl, sTrainerRankingHealings
ld de, sTrainerRankingHealingsHOF
ld bc, 4 ld bc, 4
call CopyBytes call CopyBytes
ld hl, $a01b
ld de, $a00d ld hl, sTrainerRankingBattles
ld de, sTrainerRankingBattlesHOF
ld bc, 3 ld bc, 3
call CopyBytes call CopyBytes
call Function106162
call UpdateTrainerRankingsChecksum
call CloseSRAM call CloseSRAM
ret ret
; 105f33 ; 105f33
MagikarpLength_Mobile: mobile ; 105f33 TrainerRankings_MagikarpLength: mobile ; 105f33
ld a, $5 ld a, $5
call GetSRAMBank call GetSRAMBank
ld de, Buffer1 ld de, Buffer1
ld hl, $a07b ld hl, sTrainerRankingLongestMagikarp
; Is this Magikarp the longest measured?
ld a, [de] ld a, [de]
cp [hl] cp [hl]
jr z, .asm_105f47 jr z, .isLowByteHigher
jr nc, .asm_105f4f jr nc, .newRecordLongest
jr .asm_105f55 jr .checkShortest
.asm_105f47 .isLowByteHigher
inc hl inc hl
inc de inc de
ld a, [de] ld a, [de]
cp [hl] cp [hl]
dec hl dec hl
dec de dec de
jr c, .asm_105f55 jr c, .checkShortest
.asm_105f4f .newRecordLongest
ld a, [de] ld a, [de]
inc de inc de
ld [hli], a ld [hli], a
@ -52,150 +65,157 @@ MagikarpLength_Mobile: mobile ; 105f33
dec de dec de
ld [hl], a ld [hl], a
.asm_105f55 .checkShortest
ld hl, $a07d ; First, check if the record for shortest Magikarp is 0.
; This seems unnecessary, because the value is initialized to 100.0 cm.
ld hl, sTrainerRankingShortestMagikarp
ld a, [hli] ld a, [hli]
or [hl] or [hl]
dec hl dec hl
jr z, .asm_105f6d jr z, .newRecordShortest
; Now check if this Magikarp is the shortest
ld a, [de] ld a, [de]
cp [hl] cp [hl]
jr z, .asm_105f65 jr z, .isLowByteLower
jr c, .asm_105f6d jr c, .newRecordShortest
jr .asm_105f72 jr .done
.asm_105f65 .isLowByteLower
inc hl inc hl
inc de inc de
ld a, [de] ld a, [de]
cp [hl] cp [hl]
jr nc, .asm_105f72 jr nc, .done
dec hl dec hl
dec de dec de
.asm_105f6d .newRecordShortest
ld a, [de] ld a, [de]
inc de inc de
ld [hli], a ld [hli], a
ld a, [de] ld a, [de]
ld [hl], a ld [hl], a
.asm_105f72 .done
call Function106162 call UpdateTrainerRankingsChecksum
call CloseSRAM call CloseSRAM
ret ret
; 105f79 ; 105f79
MobileFn_105f79: mobile ; 105f79 TrainerRankings_BugContestScore: mobile ; 105f79
ld a, $5 ld a, $5
call GetSRAMBank call GetSRAMBank
ld a, [hProduct] ld a, [hProduct]
ld hl, $a07f ld hl, sTrainerRankingBugContestScore
cp [hl] cp [hl]
jr z, .asm_105f8b jr z, .isLowByteHigher
jr nc, .asm_105f92 jr nc, .newHighScore
jr .asm_105f98 jr .done
.asm_105f8b .isLowByteHigher
inc hl inc hl
ld a, [hMultiplicand] ld a, [hMultiplicand]
cp [hl] cp [hl]
jr c, .asm_105f98 jr c, .done
dec hl dec hl
.asm_105f92 .newHighScore
ld a, [hProduct] ld a, [hProduct]
ld [hli], a ld [hli], a
ld a, [hMultiplicand] ld a, [hMultiplicand]
ld [hl], a ld [hl], a
.asm_105f98 .done
call Function106162 call UpdateTrainerRankingsChecksum
call CloseSRAM call CloseSRAM
ret ret
; 105f9f ; 105f9f
MobileFn_105f9f: mobile ; 105f9f TrainerRankings_AddToSlotsWinStreak: mobile ; 105f9f
ld a, $5 ld a, $5
call GetSRAMBank call GetSRAMBank
ld hl, $a070
; Increment the current streak
ld hl, sTrainerRankingCurrentSlotsStreak + 1
inc [hl] inc [hl]
jr nz, .asm_105fae jr nz, .noCarry
dec hl dec hl
inc [hl] inc [hl]
inc hl inc hl
.asm_105fae .noCarry
dec hl dec hl
ld a, [$a071] ; Now check if this is a new record for longest streak
ld a, [sTrainerRankingLongestSlotsStreak]
cp [hl] cp [hl]
jr z, .asm_105fb9 jr z, .isLowByteHigher
jr c, .asm_105fc1 jr c, .newRecordStreak
jr .asm_105fc9 jr .done
.asm_105fb9 .isLowByteHigher
inc hl inc hl
ld a, [$a072] ld a, [sTrainerRankingLongestSlotsStreak + 1]
cp [hl] cp [hl]
jr nc, .asm_105fc9 jr nc, .done
dec hl dec hl
.asm_105fc1 .newRecordStreak
ld a, [hli] ld a, [hli]
ld [$a071], a ld [sTrainerRankingLongestSlotsStreak], a
ld a, [hl] ld a, [hl]
ld [$a072], a ld [sTrainerRankingLongestSlotsStreak + 1], a
.asm_105fc9 .done
call Function106162 call UpdateTrainerRankingsChecksum
call CloseSRAM call CloseSRAM
ret ret
; 105fd0 ; 105fd0
MobileFn_105fd0: mobile ; 105fd0 TrainerRankings_EndSlotsWinStreak: mobile ; 105fd0
ld a, $5 ld a, $5
call GetSRAMBank call GetSRAMBank
ld hl, $a06f ld hl, sTrainerRankingCurrentSlotsStreak
xor a xor a
ld [hli], a ld [hli], a
ld [hl], a ld [hl], a
call Function106162 call UpdateTrainerRankingsChecksum
call CloseSRAM call CloseSRAM
ret ret
; 105fe3 ; 105fe3
MobileFn_105fe3: mobile ; 105fe3 TrainerRankings_AddToSlotsPayouts: mobile ; 105fe3
ld a, $5 ld a, $5
call GetSRAMBank call GetSRAMBank
ld hl, $a076 ld hl, sTrainerRankingTotalSlotsPayouts + 3
ld a, e ld a, e
add [hl] add [hl]
ld [hld], a ld [hld], a
ld a, d ld a, d
adc [hl] adc [hl]
ld [hld], a ld [hld], a
jr nc, .asm_106001 jr nc, .done
inc [hl] inc [hl]
jr nz, .asm_106001 jr nz, .done
dec hl dec hl
inc [hl] inc [hl]
jr nz, .asm_106001 jr nz, .done
ld a, $ff ld a, $ff
ld [hli], a ld [hli], a
ld [hli], a ld [hli], a
ld [hli], a ld [hli], a
ld [hl], a ld [hl], a
.asm_106001 .done
call Function106162 call UpdateTrainerRankingsChecksum
call CloseSRAM call CloseSRAM
ret ret
; 106008 ; 106008
MobileFn_106008: mobile ; 106008 TrainerRankings_AddToBattlePayouts: mobile ; 106008
ld a, $5 ld a, $5
call GetSRAMBank call GetSRAMBank
ld hl, $a07a ld hl, sTrainerRankingTotalBattlePayouts + 3
ld a, [bc] ld a, [bc]
dec bc dec bc
add [hl] add [hl]
@ -207,189 +227,195 @@ MobileFn_106008: mobile ; 106008
ld a, [bc] ld a, [bc]
adc [hl] adc [hl]
ld [hld], a ld [hld], a
jr nc, .asm_106027 jr nc, .done
inc [hl] inc [hl]
jr nz, .asm_106027 jr nz, .done
ld a, $ff ld a, $ff
ld [hli], a ld [hli], a
ld [hli], a ld [hli], a
ld [hli], a ld [hli], a
ld [hl], a ld [hl], a
.asm_106027 .done
call Function106162 call UpdateTrainerRankingsChecksum
call CloseSRAM call CloseSRAM
ret ret
; 10602e ; 10602e
MobileFn_10602e: mobile ; 10602e (41:602e) TrainerRankings_StepCount: mobile ; 10602e (41:602e)
ld hl, $a010 ld hl, sTrainerRankingStepCount
jp MobileFn_106117 jp TrainerRankings_Increment4Byte
MobileFn_106035: mobile ; 106035 ; Unreferenced in English version.
TrainerRankings_BattleTowerWins: mobile ; 106035
ld a, $5 ld a, $5
call GetSRAMBank call GetSRAMBank
ld a, [$aa8d] ld a, [$aa8d]
and a and a
call CloseSRAM call CloseSRAM
ret nz ret nz
ld hl, $a014 ld hl, sTrainerRankingBattleTowerWins
jp Function106123 jp TrainerRankings_Increment2Byte
MobileFn_106049: mobile ; 106049 TrainerRankings_TMsHMsTaught: mobile ; 106049
ld hl, $a018 ld hl, sTrainerRankingTMsHMsTaught
jp Function10611d jp TrainerRankings_Increment3Byte
MobileFn_106050: mobile ; 106050 TrainerRankings_Battles: mobile ; 106050
ld a, [BattleType] ld a, [BattleType]
cp BATTLETYPE_TUTORIAL cp BATTLETYPE_TUTORIAL ; Exclude the Dudes tutorial battle
ret z ret z
ld hl, $a01b ld hl, sTrainerRankingBattles
jp Function10611d jp TrainerRankings_Increment3Byte
MobileFn_10605d: mobile ; 10605d TrainerRankings_WildBattles: mobile ; 10605d
ld a, [BattleType] ld a, [BattleType]
cp BATTLETYPE_TUTORIAL cp BATTLETYPE_TUTORIAL ; Exclude the Dudes tutorial battle
ret z ret z
ld hl, $a01e ld hl, sTrainerRankingWildBattles
jp Function10611d jp TrainerRankings_Increment3Byte
MobileFn_10606a: mobile ; 10606a TrainerRankings_TrainerBattles: mobile ; 10606a
ld hl, $a021 ld hl, sTrainerRankingTrainerBattles
jp Function10611d jp TrainerRankings_Increment3Byte
MobileFn_106071: mobile ; 106071 TrainerRankings_Unused1: mobile ; 106071
ld hl, $a024 ld hl, sTrainerRankingUnused1
jp Function10611d jp TrainerRankings_Increment3Byte
Mobile_HallOfFame:: mobile ; 0x106078 TrainerRankings_HallOfFame:: mobile ; 0x106078
ld hl, $a027 ld hl, sTrainerRankingHOFEntries
jp Function10611d jp TrainerRankings_Increment3Byte
MobileFn_10607f: mobile ; 10607f (41:607f) TrainerRankings_WildMonsCaught: mobile ; 10607f (41:607f)
ld hl, $a02a ld hl, sTrainerRankingWildMonsCaught
jp Function10611d jp TrainerRankings_Increment3Byte
MobileFn_106086: mobile ; 106086 TrainerRankings_HookedEncounters: mobile ; 106086
ld hl, $a02d ld hl, sTrainerRankingHookedEncounters
jp Function10611d jp TrainerRankings_Increment3Byte
MobileFn_10608d: mobile ; 10608d (41:608d) TrainerRankings_EggsHatched: mobile ; 10608d (41:608d)
ld hl, $a030 ld hl, sTrainerRankingEggsHatched
jp Function10611d jp TrainerRankings_Increment3Byte
MobileFn_106094: mobile ; 106094 TrainerRankings_MonsEvolved: mobile ; 106094
ld hl, $a033 ld hl, sTrainerRankingMonsEvolved
jp Function10611d jp TrainerRankings_Increment3Byte
MobileFn_10609b: mobile ; 10609b TrainerRankings_FruitPicked: mobile ; 10609b
ld hl, $a036 ld hl, sTrainerRankingFruitPicked
jp Function10611d jp TrainerRankings_Increment3Byte
Mobile_HealParty: mobile ; 1060a2 TrainerRankings_Healings: mobile ; 1060a2
ld hl, $a039 ld hl, sTrainerRankingHealings
jp Function10611d jp TrainerRankings_Increment3Byte
MobileFn_1060a9: mobile ; 1060a9 (41:60a9) TrainerRankings_MysteryGift: mobile ; 1060a9 (41:60a9)
ld hl, $a03c ld hl, sTrainerRankingMysteryGift
jr Function10611d jr TrainerRankings_Increment3Byte
MobileFn_1060af: mobile ; 1060af TrainerRankings_Trades: mobile ; 1060af
ld hl, $a03f ld hl, sTrainerRankingTrades
jr Function10611d jr TrainerRankings_Increment3Byte
MobileFn_1060b5: mobile ; 1060b5 TrainerRankings_Fly: mobile ; 1060b5
ld hl, $a042 ld hl, sTrainerRankingFly
jr Function10611d jr TrainerRankings_Increment3Byte
MobileFn_1060bb: mobile ; 1060bb TrainerRankings_Surf: mobile ; 1060bb
ld hl, $a045 ld hl, sTrainerRankingSurf
jr Function10611d jr TrainerRankings_Increment3Byte
MobileFn_1060c1: mobile ; 1060c1 TrainerRankings_Waterfall: mobile ; 1060c1
ld hl, $a048 ld hl, sTrainerRankingWaterfall
jr Function10611d jr TrainerRankings_Increment3Byte
MobileFn_1060c7: mobile ; 1060c7 TrainerRankings_WhiteOuts: mobile ; 1060c7
ld hl, $a04b ld hl, sTrainerRankingWhiteOuts
jr Function10611d jr TrainerRankings_Increment3Byte
MobileFn_1060cd: mobile ; 1060cd TrainerRankings_LuckyNumberShow: mobile ; 1060cd
ld hl, $a04e ld hl, sTrainerRankingLuckyNumberShow
jr Function106123 jr TrainerRankings_Increment2Byte
MobileFn_1060d3: mobile ; 1060d3 TrainerRankings_PhoneCalls: mobile ; 1060d3
ld hl, $a051 ld hl, sTrainerRankingPhoneCalls
jr Function10611d jr TrainerRankings_Increment3Byte
MobileFn_1060d9: mobile ; 1060df TrainerRankings_Unused2: mobile ; 1060df
ld hl, $a054 ld hl, sTrainerRankingUnused2
jr Function10611d jr TrainerRankings_Increment3Byte
MobileFn_1060df: mobile ; 1060df TrainerRankings_LinkBattles: mobile ; 1060df
ld hl, $a057 ld hl, sTrainerRankingLinkBattles
jr Function10611d jr TrainerRankings_Increment3Byte
MobileFn_1060e5: mobile ; 1060e5 TrainerRankings_Splash: mobile ; 1060e5
; Only counts if its the players turn
ld a, [hBattleTurn] ld a, [hBattleTurn]
and a and a
ret nz ret nz
ld hl, $a05a ld hl, sTrainerRankingSplash
jr Function10611d jr TrainerRankings_Increment3Byte
MobileFn_1060ef: mobile ; 1060ef TrainerRankings_TreeEncounters: mobile ; 1060ef
ld hl, $a05d ld hl, sTrainerRankingTreeEncounters
jr Function10611d jr TrainerRankings_Increment3Byte
MobileFn_1060f5: mobile ; 1060f5 TrainerRankings_Unused3: mobile ; 1060f5
ld hl, $a060 ld hl, sTrainerRankingUnused3
jr Function10611d jr TrainerRankings_Increment3Byte
MobileFn_SaveBattleResult_Win: mobile ; win TrainerRankings_ColosseumWins: mobile ; win
ld hl, $a063 ld hl, sTrainerRankingColosseumWins
jr Function10611d jr TrainerRankings_Increment3Byte
MobileFn_SaveBattleResult_Lose: mobile ; lose TrainerRankings_ColosseumLosses: mobile ; lose
ld hl, $a066 ld hl, sTrainerRankingColosseumLosses
jr Function10611d jr TrainerRankings_Increment3Byte
; 106107 ; 106107
MobileFn_SaveBattleResult_Draw: mobile ; draw TrainerRankings_ColosseumDraws: mobile ; draw
ld hl, $a069 ld hl, sTrainerRankingColosseumDraws
jr Function10611d jr TrainerRankings_Increment3Byte
; 10610d ; 10610d
MobileFn_10610d: mobile ; 10610d ; Counts uses of both SelfDestruct and Explosion.
TrainerRankings_SelfDestruct: mobile ; 10610d
; Only counts if its the players turn
ld a, [hBattleTurn] ld a, [hBattleTurn]
and a and a
ret nz ret nz
ld hl, $a06c ld hl, sTrainerRankingSelfDestruct
jr Function10611d jr TrainerRankings_Increment3Byte
; 106117 ; 106117
MobileFn_106117: ; 106117 TrainerRankings_Increment4Byte: ; 106117
push bc push bc
ld bc, 3 ld bc, 3
jr Function10612d jr TrainerRankings_Increment
; 10611d ; 10611d
Function10611d: ; 10611d TrainerRankings_Increment3Byte: ; 10611d
push bc push bc
ld bc, 2 ld bc, 2
jr Function10612d jr TrainerRankings_Increment
; 106123 ; 106123
Function106123: ; 106123 TrainerRankings_Increment2Byte: ; 106123
push bc push bc
ld bc, 1 ld bc, 1
jr Function10612d jr TrainerRankings_Increment
; 106129 ; 106129
Function106129: ; 106129 ; unused
TrainerRankings_Increment1Byte: ; 106129
push bc push bc
ld bc, 0 ld bc, 0
Function10612d: ; 10612d ; Increments a big-endian value of bc + 1 bytes at hl
TrainerRankings_Increment: ; 10612d
ld a, $5 ld a, $5
call GetSRAMBank call GetSRAMBank
push hl push hl
@ -419,24 +445,25 @@ Function10612d: ; 10612d
jr .asm_106142 jr .asm_106142
.asm_10614d .asm_10614d
call Function106162 call UpdateTrainerRankingsChecksum
call CloseSRAM call CloseSRAM
pop bc pop bc
ret ret
; 106155 ; 106155
MobileFn_106155: mobile ; 106155 ; Used when SRAM bank 5 isnt already loaded — whats the point of this?
UpdateTrainerRankingsChecksum2: mobile ; 106155
ld a, $5 ld a, $5
call GetSRAMBank call GetSRAMBank
call Function106162 call UpdateTrainerRankingsChecksum
call CloseSRAM call CloseSRAM
ret ret
; 106162 ; 106162
Function106162: ; 106162 UpdateTrainerRankingsChecksum: ; 106162
push de push de
call Function10616e call CalculateTrainerRankingsChecksum
ld hl, $a081 ; s5_a081 ld hl, sTrainerRankingsChecksum
ld [hl], d ld [hl], d
inc hl inc hl
ld [hl], e ld [hl], e
@ -444,10 +471,10 @@ Function106162: ; 106162
ret ret
; 10616e ; 10616e
Function10616e: ; 10616e CalculateTrainerRankingsChecksum: ; 10616e
push bc push bc
ld hl, $a001 ; s5_a001 ld hl, sTrainerRankings
ld bc, $80 ld bc, sTrainerRankingsChecksum - sTrainerRankings
xor a xor a
ld de, 0 ld de, 0
.asm_106179 .asm_106179
@ -495,9 +522,10 @@ RestoreMobileEventIndex: ; 10619d (41:619d)
ret ret
; 1061b3 (41:61b3) ; 1061b3 (41:61b3)
Function1061b3: ; 1061b3 ; Unreferenced in English version.
call Function10616e VerifyTrainerRankingsChecksum: ; 1061b3
ld hl, $a081 ; s5_a081 call CalculateTrainerRankingsChecksum
ld hl, sTrainerRankingsChecksum
ld a, d ld a, d
cp [hl] cp [hl]
ret nz ret nz
@ -516,19 +544,24 @@ DeleteMobileEventIndex: ; 1061c0 (41:61c0)
ret ret
; 1061cd (41:61cd) ; 1061cd (41:61cd)
Function1061cd: ; unreferenced ; Used in the Japanese version to initialize Trainer Rankings data
ld hl, $a001 ; for a new save file. Unreferenced in the English version.
ld bc, $82 InitializeTrainerRankings:
ld hl, sTrainerRankings
ld bc, sTrainerRankingsEnd - sTrainerRankings
xor a xor a
call ByteFill call ByteFill
ld hl, $a07d
; Initialize the shortest Magikarp to 100.0 cm
ld hl, sTrainerRankingShortestMagikarp
ld a, $3 ld a, $3
ld [hli], a ld [hli], a
ld [hl], $e8 ld [hl], $e8
call Function106162
ld hl, $a001 call UpdateTrainerRankingsChecksum
ld de, $a084 ld hl, sTrainerRankings
ld bc, $82 ld de, sTrainerRankingsBackup
ld bc, sTrainerRankingsEnd - sTrainerRankings
call CopyBytes call CopyBytes
ret ret
; 1061ef ; 1061ef

View File

@ -3098,7 +3098,7 @@ Function17e3c3: ; 17e3c3
push af push af
ld a, $1 ld a, $1
ld [rSVBK], a ld [rSVBK], a
callba MobileFn_106155 callba UpdateTrainerRankingsChecksum2
callba BackupMobileEventIndex callba BackupMobileEventIndex
pop af pop af
ld [rSVBK], a ld [rSVBK], a