2017-01-16 21:11:34 +00:00
|
|
|
|
; 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.
|
2018-06-25 00:10:37 +00:00
|
|
|
|
StubbedTrainerRankings_HallOfFame2::
|
2018-01-02 19:00:14 +00:00
|
|
|
|
ret
|
2017-11-20 18:50:54 +00:00
|
|
|
|
ld a, BANK(sTrainerRankingGameTimeHOF)
|
2015-11-11 04:23:28 +00:00
|
|
|
|
call GetSRAMBank
|
2017-01-16 21:11:34 +00:00
|
|
|
|
|
2018-01-23 22:39:09 +00:00
|
|
|
|
ld hl, wGameTimeHours
|
2017-01-16 21:11:34 +00:00
|
|
|
|
ld de, sTrainerRankingGameTimeHOF
|
2015-11-11 04:23:28 +00:00
|
|
|
|
ld bc, 4
|
|
|
|
|
call CopyBytes
|
2017-01-16 21:11:34 +00:00
|
|
|
|
|
|
|
|
|
ld hl, sTrainerRankingStepCount
|
|
|
|
|
ld de, sTrainerRankingStepCountHOF
|
2015-11-11 04:23:28 +00:00
|
|
|
|
ld bc, 4
|
|
|
|
|
call CopyBytes
|
2017-01-16 21:11:34 +00:00
|
|
|
|
|
|
|
|
|
; sTrainerRankingHealings is only a 3-byte value.
|
|
|
|
|
; One extraneous byte is copied from sTrainerRankingMysteryGift.
|
|
|
|
|
ld hl, sTrainerRankingHealings
|
|
|
|
|
ld de, sTrainerRankingHealingsHOF
|
2015-11-11 04:23:28 +00:00
|
|
|
|
ld bc, 4
|
|
|
|
|
call CopyBytes
|
2017-01-16 21:11:34 +00:00
|
|
|
|
|
|
|
|
|
ld hl, sTrainerRankingBattles
|
|
|
|
|
ld de, sTrainerRankingBattlesHOF
|
2015-11-11 04:23:28 +00:00
|
|
|
|
ld bc, 3
|
|
|
|
|
call CopyBytes
|
2017-01-16 21:11:34 +00:00
|
|
|
|
|
|
|
|
|
call UpdateTrainerRankingsChecksum
|
2015-11-11 04:23:28 +00:00
|
|
|
|
call CloseSRAM
|
|
|
|
|
ret
|
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
StubbedTrainerRankings_MagikarpLength:
|
2018-01-02 19:00:14 +00:00
|
|
|
|
ret
|
2017-11-20 18:50:54 +00:00
|
|
|
|
ld a, BANK(sTrainerRankingLongestMagikarp)
|
2015-11-11 04:23:28 +00:00
|
|
|
|
call GetSRAMBank
|
2018-01-23 22:39:09 +00:00
|
|
|
|
ld de, wBuffer1
|
2017-01-16 21:11:34 +00:00
|
|
|
|
ld hl, sTrainerRankingLongestMagikarp
|
|
|
|
|
|
|
|
|
|
; Is this Magikarp the longest measured?
|
2015-11-11 04:23:28 +00:00
|
|
|
|
ld a, [de]
|
|
|
|
|
cp [hl]
|
2017-01-16 21:11:34 +00:00
|
|
|
|
jr z, .isLowByteHigher
|
|
|
|
|
jr nc, .newRecordLongest
|
|
|
|
|
jr .checkShortest
|
2015-11-11 04:23:28 +00:00
|
|
|
|
|
2017-01-16 21:11:34 +00:00
|
|
|
|
.isLowByteHigher
|
2015-11-11 04:23:28 +00:00
|
|
|
|
inc hl
|
|
|
|
|
inc de
|
|
|
|
|
ld a, [de]
|
|
|
|
|
cp [hl]
|
|
|
|
|
dec hl
|
|
|
|
|
dec de
|
2017-01-16 21:11:34 +00:00
|
|
|
|
jr c, .checkShortest
|
2015-11-11 04:23:28 +00:00
|
|
|
|
|
2017-01-16 21:11:34 +00:00
|
|
|
|
.newRecordLongest
|
2015-11-11 04:23:28 +00:00
|
|
|
|
ld a, [de]
|
|
|
|
|
inc de
|
|
|
|
|
ld [hli], a
|
|
|
|
|
ld a, [de]
|
|
|
|
|
dec de
|
|
|
|
|
ld [hl], a
|
|
|
|
|
|
2017-01-16 21:11:34 +00:00
|
|
|
|
.checkShortest
|
|
|
|
|
; 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
|
2015-11-11 04:23:28 +00:00
|
|
|
|
ld a, [hli]
|
|
|
|
|
or [hl]
|
|
|
|
|
dec hl
|
2017-01-16 21:11:34 +00:00
|
|
|
|
jr z, .newRecordShortest
|
|
|
|
|
|
|
|
|
|
; Now check if this Magikarp is the shortest
|
2015-11-11 04:23:28 +00:00
|
|
|
|
ld a, [de]
|
|
|
|
|
cp [hl]
|
2017-01-16 21:11:34 +00:00
|
|
|
|
jr z, .isLowByteLower
|
|
|
|
|
jr c, .newRecordShortest
|
|
|
|
|
jr .done
|
2015-11-11 04:23:28 +00:00
|
|
|
|
|
2017-01-16 21:11:34 +00:00
|
|
|
|
.isLowByteLower
|
2015-11-11 04:23:28 +00:00
|
|
|
|
inc hl
|
|
|
|
|
inc de
|
|
|
|
|
ld a, [de]
|
|
|
|
|
cp [hl]
|
2017-01-16 21:11:34 +00:00
|
|
|
|
jr nc, .done
|
2015-11-11 04:23:28 +00:00
|
|
|
|
dec hl
|
|
|
|
|
dec de
|
|
|
|
|
|
2017-01-16 21:11:34 +00:00
|
|
|
|
.newRecordShortest
|
2015-11-11 04:23:28 +00:00
|
|
|
|
ld a, [de]
|
|
|
|
|
inc de
|
|
|
|
|
ld [hli], a
|
|
|
|
|
ld a, [de]
|
|
|
|
|
ld [hl], a
|
|
|
|
|
|
2017-01-16 21:11:34 +00:00
|
|
|
|
.done
|
|
|
|
|
call UpdateTrainerRankingsChecksum
|
2015-11-11 04:23:28 +00:00
|
|
|
|
call CloseSRAM
|
|
|
|
|
ret
|
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
StubbedTrainerRankings_BugContestScore:
|
2018-01-02 19:00:14 +00:00
|
|
|
|
ret
|
2017-11-20 18:50:54 +00:00
|
|
|
|
ld a, BANK(sTrainerRankingBugContestScore)
|
2015-11-11 04:23:28 +00:00
|
|
|
|
call GetSRAMBank
|
|
|
|
|
ld a, [hProduct]
|
2017-01-16 21:11:34 +00:00
|
|
|
|
ld hl, sTrainerRankingBugContestScore
|
2015-11-11 04:23:28 +00:00
|
|
|
|
cp [hl]
|
2017-01-16 21:11:34 +00:00
|
|
|
|
jr z, .isLowByteHigher
|
|
|
|
|
jr nc, .newHighScore
|
|
|
|
|
jr .done
|
2015-11-11 04:23:28 +00:00
|
|
|
|
|
2017-01-16 21:11:34 +00:00
|
|
|
|
.isLowByteHigher
|
2015-11-11 04:23:28 +00:00
|
|
|
|
inc hl
|
|
|
|
|
ld a, [hMultiplicand]
|
|
|
|
|
cp [hl]
|
2017-01-16 21:11:34 +00:00
|
|
|
|
jr c, .done
|
2015-11-11 04:23:28 +00:00
|
|
|
|
dec hl
|
|
|
|
|
|
2017-01-16 21:11:34 +00:00
|
|
|
|
.newHighScore
|
2015-11-11 04:23:28 +00:00
|
|
|
|
ld a, [hProduct]
|
|
|
|
|
ld [hli], a
|
|
|
|
|
ld a, [hMultiplicand]
|
|
|
|
|
ld [hl], a
|
|
|
|
|
|
2017-01-16 21:11:34 +00:00
|
|
|
|
.done
|
|
|
|
|
call UpdateTrainerRankingsChecksum
|
2015-11-11 04:23:28 +00:00
|
|
|
|
call CloseSRAM
|
|
|
|
|
ret
|
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
StubbedTrainerRankings_AddToSlotsWinStreak:
|
2018-01-02 19:00:14 +00:00
|
|
|
|
ret
|
2017-11-20 18:50:54 +00:00
|
|
|
|
ld a, BANK(sTrainerRankingCurrentSlotsStreak)
|
2015-11-11 04:23:28 +00:00
|
|
|
|
call GetSRAMBank
|
2017-01-16 21:11:34 +00:00
|
|
|
|
|
|
|
|
|
; Increment the current streak
|
|
|
|
|
ld hl, sTrainerRankingCurrentSlotsStreak + 1
|
2015-11-11 04:23:28 +00:00
|
|
|
|
inc [hl]
|
2017-01-16 21:11:34 +00:00
|
|
|
|
jr nz, .noCarry
|
2015-11-11 04:23:28 +00:00
|
|
|
|
dec hl
|
|
|
|
|
inc [hl]
|
|
|
|
|
inc hl
|
|
|
|
|
|
2017-01-16 21:11:34 +00:00
|
|
|
|
.noCarry
|
2015-11-11 04:23:28 +00:00
|
|
|
|
dec hl
|
2017-01-16 21:11:34 +00:00
|
|
|
|
; Now check if this is a new record for longest streak
|
|
|
|
|
ld a, [sTrainerRankingLongestSlotsStreak]
|
2015-11-11 04:23:28 +00:00
|
|
|
|
cp [hl]
|
2017-01-16 21:11:34 +00:00
|
|
|
|
jr z, .isLowByteHigher
|
|
|
|
|
jr c, .newRecordStreak
|
|
|
|
|
jr .done
|
2015-11-11 04:23:28 +00:00
|
|
|
|
|
2017-01-16 21:11:34 +00:00
|
|
|
|
.isLowByteHigher
|
2015-11-11 04:23:28 +00:00
|
|
|
|
inc hl
|
2017-01-16 21:11:34 +00:00
|
|
|
|
ld a, [sTrainerRankingLongestSlotsStreak + 1]
|
2015-11-11 04:23:28 +00:00
|
|
|
|
cp [hl]
|
2017-01-16 21:11:34 +00:00
|
|
|
|
jr nc, .done
|
2015-11-11 04:23:28 +00:00
|
|
|
|
dec hl
|
|
|
|
|
|
2017-01-16 21:11:34 +00:00
|
|
|
|
.newRecordStreak
|
2015-11-11 04:23:28 +00:00
|
|
|
|
ld a, [hli]
|
2017-01-16 21:11:34 +00:00
|
|
|
|
ld [sTrainerRankingLongestSlotsStreak], a
|
2015-11-11 04:23:28 +00:00
|
|
|
|
ld a, [hl]
|
2017-01-16 21:11:34 +00:00
|
|
|
|
ld [sTrainerRankingLongestSlotsStreak + 1], a
|
2015-11-11 04:23:28 +00:00
|
|
|
|
|
2017-01-16 21:11:34 +00:00
|
|
|
|
.done
|
|
|
|
|
call UpdateTrainerRankingsChecksum
|
2015-11-11 04:23:28 +00:00
|
|
|
|
call CloseSRAM
|
|
|
|
|
ret
|
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
StubbedTrainerRankings_EndSlotsWinStreak:
|
2018-01-02 19:00:14 +00:00
|
|
|
|
ret
|
2017-11-20 18:50:54 +00:00
|
|
|
|
ld a, BANK(sTrainerRankingCurrentSlotsStreak)
|
2015-11-11 04:23:28 +00:00
|
|
|
|
call GetSRAMBank
|
2017-01-16 21:11:34 +00:00
|
|
|
|
ld hl, sTrainerRankingCurrentSlotsStreak
|
2015-11-11 04:23:28 +00:00
|
|
|
|
xor a
|
|
|
|
|
ld [hli], a
|
|
|
|
|
ld [hl], a
|
2017-01-16 21:11:34 +00:00
|
|
|
|
call UpdateTrainerRankingsChecksum
|
2015-11-11 04:23:28 +00:00
|
|
|
|
call CloseSRAM
|
|
|
|
|
ret
|
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
StubbedTrainerRankings_AddToSlotsPayouts:
|
2018-01-02 19:00:14 +00:00
|
|
|
|
ret
|
2017-11-20 18:50:54 +00:00
|
|
|
|
ld a, BANK(sTrainerRankingTotalSlotsPayouts)
|
2015-11-11 04:23:28 +00:00
|
|
|
|
call GetSRAMBank
|
2017-01-16 21:11:34 +00:00
|
|
|
|
ld hl, sTrainerRankingTotalSlotsPayouts + 3
|
2015-11-11 04:23:28 +00:00
|
|
|
|
ld a, e
|
|
|
|
|
add [hl]
|
|
|
|
|
ld [hld], a
|
|
|
|
|
ld a, d
|
|
|
|
|
adc [hl]
|
|
|
|
|
ld [hld], a
|
2017-01-16 21:11:34 +00:00
|
|
|
|
jr nc, .done
|
2015-11-11 04:23:28 +00:00
|
|
|
|
inc [hl]
|
2017-01-16 21:11:34 +00:00
|
|
|
|
jr nz, .done
|
2015-11-11 04:23:28 +00:00
|
|
|
|
dec hl
|
|
|
|
|
inc [hl]
|
2017-01-16 21:11:34 +00:00
|
|
|
|
jr nz, .done
|
2015-11-11 04:23:28 +00:00
|
|
|
|
ld a, $ff
|
|
|
|
|
ld [hli], a
|
2016-05-10 16:31:49 +00:00
|
|
|
|
ld [hli], a
|
|
|
|
|
ld [hli], a
|
2015-11-11 04:23:28 +00:00
|
|
|
|
ld [hl], a
|
|
|
|
|
|
2017-01-16 21:11:34 +00:00
|
|
|
|
.done
|
|
|
|
|
call UpdateTrainerRankingsChecksum
|
2015-11-11 04:23:28 +00:00
|
|
|
|
call CloseSRAM
|
|
|
|
|
ret
|
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
StubbedTrainerRankings_AddToBattlePayouts:
|
2018-01-02 19:00:14 +00:00
|
|
|
|
ret
|
2017-11-20 18:50:54 +00:00
|
|
|
|
ld a, BANK(sTrainerRankingTotalBattlePayouts)
|
2015-11-11 04:23:28 +00:00
|
|
|
|
call GetSRAMBank
|
2017-01-16 21:11:34 +00:00
|
|
|
|
ld hl, sTrainerRankingTotalBattlePayouts + 3
|
2015-11-11 04:23:28 +00:00
|
|
|
|
ld a, [bc]
|
|
|
|
|
dec bc
|
|
|
|
|
add [hl]
|
|
|
|
|
ld [hld], a
|
|
|
|
|
ld a, [bc]
|
|
|
|
|
dec bc
|
|
|
|
|
adc [hl]
|
|
|
|
|
ld [hld], a
|
|
|
|
|
ld a, [bc]
|
|
|
|
|
adc [hl]
|
|
|
|
|
ld [hld], a
|
2017-01-16 21:11:34 +00:00
|
|
|
|
jr nc, .done
|
2015-11-11 04:23:28 +00:00
|
|
|
|
inc [hl]
|
2017-01-16 21:11:34 +00:00
|
|
|
|
jr nz, .done
|
2015-11-11 04:23:28 +00:00
|
|
|
|
ld a, $ff
|
|
|
|
|
ld [hli], a
|
2016-05-10 16:31:49 +00:00
|
|
|
|
ld [hli], a
|
|
|
|
|
ld [hli], a
|
2015-11-11 04:23:28 +00:00
|
|
|
|
ld [hl], a
|
|
|
|
|
|
2017-01-16 21:11:34 +00:00
|
|
|
|
.done
|
|
|
|
|
call UpdateTrainerRankingsChecksum
|
2015-11-11 04:23:28 +00:00
|
|
|
|
call CloseSRAM
|
|
|
|
|
ret
|
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
StubbedTrainerRankings_StepCount:
|
2018-01-02 19:00:14 +00:00
|
|
|
|
ret
|
2017-01-16 21:11:34 +00:00
|
|
|
|
ld hl, sTrainerRankingStepCount
|
2018-01-02 19:00:14 +00:00
|
|
|
|
jp StubbedTrainerRankings_Increment4Byte
|
2015-11-11 04:23:28 +00:00
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
Unreferenced_StubbedTrainerRankings_BattleTowerWins:
|
2018-01-02 19:00:14 +00:00
|
|
|
|
ret
|
2015-11-11 04:23:28 +00:00
|
|
|
|
ld a, $5
|
|
|
|
|
call GetSRAMBank
|
|
|
|
|
ld a, [$aa8d]
|
|
|
|
|
and a
|
|
|
|
|
call CloseSRAM
|
|
|
|
|
ret nz
|
2017-01-16 21:11:34 +00:00
|
|
|
|
ld hl, sTrainerRankingBattleTowerWins
|
2018-01-02 19:00:14 +00:00
|
|
|
|
jp StubbedTrainerRankings_Increment2Byte
|
2015-11-11 04:23:28 +00:00
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
StubbedTrainerRankings_TMsHMsTaught:
|
2018-01-02 19:00:14 +00:00
|
|
|
|
ret
|
2017-01-16 21:11:34 +00:00
|
|
|
|
ld hl, sTrainerRankingTMsHMsTaught
|
2018-01-02 19:00:14 +00:00
|
|
|
|
jp StubbedTrainerRankings_Increment3Byte
|
2015-11-11 04:23:28 +00:00
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
StubbedTrainerRankings_Battles:
|
2018-01-02 19:00:14 +00:00
|
|
|
|
ret
|
2018-01-23 22:39:09 +00:00
|
|
|
|
ld a, [wBattleType]
|
2017-01-16 21:11:34 +00:00
|
|
|
|
cp BATTLETYPE_TUTORIAL ; Exclude the Dude’s tutorial battle
|
2015-11-11 04:23:28 +00:00
|
|
|
|
ret z
|
2017-01-16 21:11:34 +00:00
|
|
|
|
ld hl, sTrainerRankingBattles
|
2018-01-02 19:00:14 +00:00
|
|
|
|
jp StubbedTrainerRankings_Increment3Byte
|
2015-11-11 04:23:28 +00:00
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
StubbedTrainerRankings_WildBattles:
|
2018-01-02 19:00:14 +00:00
|
|
|
|
ret
|
2018-01-23 22:39:09 +00:00
|
|
|
|
ld a, [wBattleType]
|
2017-01-16 21:11:34 +00:00
|
|
|
|
cp BATTLETYPE_TUTORIAL ; Exclude the Dude’s tutorial battle
|
2015-11-11 04:23:28 +00:00
|
|
|
|
ret z
|
2017-01-16 21:11:34 +00:00
|
|
|
|
ld hl, sTrainerRankingWildBattles
|
2018-01-02 19:00:14 +00:00
|
|
|
|
jp StubbedTrainerRankings_Increment3Byte
|
2015-11-11 04:23:28 +00:00
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
StubbedTrainerRankings_TrainerBattles:
|
2018-01-02 19:00:14 +00:00
|
|
|
|
ret
|
2017-01-16 21:11:34 +00:00
|
|
|
|
ld hl, sTrainerRankingTrainerBattles
|
2018-01-02 19:00:14 +00:00
|
|
|
|
jp StubbedTrainerRankings_Increment3Byte
|
2015-11-11 04:23:28 +00:00
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
StubbedTrainerRankings_Unused1:
|
2018-01-02 19:00:14 +00:00
|
|
|
|
ret
|
2017-01-16 21:11:34 +00:00
|
|
|
|
ld hl, sTrainerRankingUnused1
|
2018-01-02 19:00:14 +00:00
|
|
|
|
jp StubbedTrainerRankings_Increment3Byte
|
2015-11-11 04:23:28 +00:00
|
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
|
StubbedTrainerRankings_HallOfFame::
|
2018-01-02 19:00:14 +00:00
|
|
|
|
ret
|
2017-01-16 21:11:34 +00:00
|
|
|
|
ld hl, sTrainerRankingHOFEntries
|
2018-01-02 19:00:14 +00:00
|
|
|
|
jp StubbedTrainerRankings_Increment3Byte
|
2015-11-11 04:23:28 +00:00
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
StubbedTrainerRankings_WildMonsCaught:
|
2018-01-02 19:00:14 +00:00
|
|
|
|
ret
|
2017-01-16 21:11:34 +00:00
|
|
|
|
ld hl, sTrainerRankingWildMonsCaught
|
2018-01-02 19:00:14 +00:00
|
|
|
|
jp StubbedTrainerRankings_Increment3Byte
|
2015-11-11 04:23:28 +00:00
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
StubbedTrainerRankings_HookedEncounters:
|
2018-01-02 19:00:14 +00:00
|
|
|
|
ret
|
2017-01-16 21:11:34 +00:00
|
|
|
|
ld hl, sTrainerRankingHookedEncounters
|
2018-01-02 19:00:14 +00:00
|
|
|
|
jp StubbedTrainerRankings_Increment3Byte
|
2015-11-11 04:23:28 +00:00
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
StubbedTrainerRankings_EggsHatched:
|
2018-01-02 19:00:14 +00:00
|
|
|
|
ret
|
2017-01-16 21:11:34 +00:00
|
|
|
|
ld hl, sTrainerRankingEggsHatched
|
2018-01-02 19:00:14 +00:00
|
|
|
|
jp StubbedTrainerRankings_Increment3Byte
|
2015-11-11 04:23:28 +00:00
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
StubbedTrainerRankings_MonsEvolved:
|
2018-01-02 19:00:14 +00:00
|
|
|
|
ret
|
2017-01-16 21:11:34 +00:00
|
|
|
|
ld hl, sTrainerRankingMonsEvolved
|
2018-01-02 19:00:14 +00:00
|
|
|
|
jp StubbedTrainerRankings_Increment3Byte
|
2015-11-11 04:23:28 +00:00
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
StubbedTrainerRankings_FruitPicked:
|
2018-01-02 19:00:14 +00:00
|
|
|
|
ret
|
2017-01-16 21:11:34 +00:00
|
|
|
|
ld hl, sTrainerRankingFruitPicked
|
2018-01-02 19:00:14 +00:00
|
|
|
|
jp StubbedTrainerRankings_Increment3Byte
|
2015-11-11 04:23:28 +00:00
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
StubbedTrainerRankings_Healings:
|
2018-01-02 19:00:14 +00:00
|
|
|
|
ret
|
2017-01-16 21:11:34 +00:00
|
|
|
|
ld hl, sTrainerRankingHealings
|
2018-01-02 19:00:14 +00:00
|
|
|
|
jp StubbedTrainerRankings_Increment3Byte
|
2015-11-11 04:23:28 +00:00
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
StubbedTrainerRankings_MysteryGift:
|
2018-01-02 19:00:14 +00:00
|
|
|
|
ret
|
2017-01-16 21:11:34 +00:00
|
|
|
|
ld hl, sTrainerRankingMysteryGift
|
2018-01-02 19:00:14 +00:00
|
|
|
|
jr StubbedTrainerRankings_Increment3Byte
|
2015-11-11 04:23:28 +00:00
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
StubbedTrainerRankings_Trades:
|
2018-01-02 19:00:14 +00:00
|
|
|
|
ret
|
2017-01-16 21:11:34 +00:00
|
|
|
|
ld hl, sTrainerRankingTrades
|
2018-01-02 19:00:14 +00:00
|
|
|
|
jr StubbedTrainerRankings_Increment3Byte
|
2015-11-11 04:23:28 +00:00
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
StubbedTrainerRankings_Fly:
|
2018-01-02 19:00:14 +00:00
|
|
|
|
ret
|
2017-01-16 21:11:34 +00:00
|
|
|
|
ld hl, sTrainerRankingFly
|
2018-01-02 19:00:14 +00:00
|
|
|
|
jr StubbedTrainerRankings_Increment3Byte
|
2015-11-11 04:23:28 +00:00
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
StubbedTrainerRankings_Surf:
|
2018-01-02 19:00:14 +00:00
|
|
|
|
ret
|
2017-01-16 21:11:34 +00:00
|
|
|
|
ld hl, sTrainerRankingSurf
|
2018-01-02 19:00:14 +00:00
|
|
|
|
jr StubbedTrainerRankings_Increment3Byte
|
2015-11-11 04:23:28 +00:00
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
StubbedTrainerRankings_Waterfall:
|
2018-01-02 19:00:14 +00:00
|
|
|
|
ret
|
2017-01-16 21:11:34 +00:00
|
|
|
|
ld hl, sTrainerRankingWaterfall
|
2018-01-02 19:00:14 +00:00
|
|
|
|
jr StubbedTrainerRankings_Increment3Byte
|
2015-11-11 04:23:28 +00:00
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
StubbedTrainerRankings_WhiteOuts:
|
2018-01-02 19:00:14 +00:00
|
|
|
|
ret
|
2017-01-16 21:11:34 +00:00
|
|
|
|
ld hl, sTrainerRankingWhiteOuts
|
2018-01-02 19:00:14 +00:00
|
|
|
|
jr StubbedTrainerRankings_Increment3Byte
|
2015-11-11 04:23:28 +00:00
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
StubbedTrainerRankings_LuckyNumberShow:
|
2018-01-02 19:00:14 +00:00
|
|
|
|
ret
|
2017-01-16 21:11:34 +00:00
|
|
|
|
ld hl, sTrainerRankingLuckyNumberShow
|
2018-01-02 19:00:14 +00:00
|
|
|
|
jr StubbedTrainerRankings_Increment2Byte
|
2015-11-11 04:23:28 +00:00
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
StubbedTrainerRankings_PhoneCalls:
|
2018-01-02 19:00:14 +00:00
|
|
|
|
ret
|
2017-01-16 21:11:34 +00:00
|
|
|
|
ld hl, sTrainerRankingPhoneCalls
|
2018-01-02 19:00:14 +00:00
|
|
|
|
jr StubbedTrainerRankings_Increment3Byte
|
2015-11-11 04:23:28 +00:00
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
StubbedTrainerRankings_Unused2:
|
2018-01-02 19:00:14 +00:00
|
|
|
|
ret
|
2017-01-16 21:11:34 +00:00
|
|
|
|
ld hl, sTrainerRankingUnused2
|
2018-01-02 19:00:14 +00:00
|
|
|
|
jr StubbedTrainerRankings_Increment3Byte
|
2015-11-11 04:23:28 +00:00
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
StubbedTrainerRankings_LinkBattles:
|
2018-01-02 19:00:14 +00:00
|
|
|
|
ret
|
2017-01-16 21:11:34 +00:00
|
|
|
|
ld hl, sTrainerRankingLinkBattles
|
2018-01-02 19:00:14 +00:00
|
|
|
|
jr StubbedTrainerRankings_Increment3Byte
|
2015-11-11 04:23:28 +00:00
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
StubbedTrainerRankings_Splash:
|
2018-01-02 19:00:14 +00:00
|
|
|
|
ret
|
2017-01-16 21:11:34 +00:00
|
|
|
|
; Only counts if it’s the player’s turn
|
2015-11-11 04:23:28 +00:00
|
|
|
|
ld a, [hBattleTurn]
|
|
|
|
|
and a
|
|
|
|
|
ret nz
|
2017-01-16 21:11:34 +00:00
|
|
|
|
ld hl, sTrainerRankingSplash
|
2018-01-02 19:00:14 +00:00
|
|
|
|
jr StubbedTrainerRankings_Increment3Byte
|
2015-11-11 04:23:28 +00:00
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
StubbedTrainerRankings_TreeEncounters:
|
2018-01-02 19:00:14 +00:00
|
|
|
|
ret
|
2017-01-16 21:11:34 +00:00
|
|
|
|
ld hl, sTrainerRankingTreeEncounters
|
2018-01-02 19:00:14 +00:00
|
|
|
|
jr StubbedTrainerRankings_Increment3Byte
|
2015-11-11 04:23:28 +00:00
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
StubbedTrainerRankings_Unused3:
|
2018-01-02 19:00:14 +00:00
|
|
|
|
ret
|
2017-01-16 21:11:34 +00:00
|
|
|
|
ld hl, sTrainerRankingUnused3
|
2018-01-02 19:00:14 +00:00
|
|
|
|
jr StubbedTrainerRankings_Increment3Byte
|
2015-11-11 04:23:28 +00:00
|
|
|
|
|
2018-01-02 19:00:14 +00:00
|
|
|
|
StubbedTrainerRankings_ColosseumWins: ; win
|
|
|
|
|
ret
|
2017-01-16 21:11:34 +00:00
|
|
|
|
ld hl, sTrainerRankingColosseumWins
|
2018-01-02 19:00:14 +00:00
|
|
|
|
jr StubbedTrainerRankings_Increment3Byte
|
2015-11-11 04:23:28 +00:00
|
|
|
|
|
2018-01-02 19:00:14 +00:00
|
|
|
|
StubbedTrainerRankings_ColosseumLosses: ; lose
|
|
|
|
|
ret
|
2017-01-16 21:11:34 +00:00
|
|
|
|
ld hl, sTrainerRankingColosseumLosses
|
2018-01-02 19:00:14 +00:00
|
|
|
|
jr StubbedTrainerRankings_Increment3Byte
|
2015-11-11 04:23:28 +00:00
|
|
|
|
|
2018-01-02 19:00:14 +00:00
|
|
|
|
StubbedTrainerRankings_ColosseumDraws: ; draw
|
|
|
|
|
ret
|
2017-01-16 21:11:34 +00:00
|
|
|
|
ld hl, sTrainerRankingColosseumDraws
|
2018-01-02 19:00:14 +00:00
|
|
|
|
jr StubbedTrainerRankings_Increment3Byte
|
2015-11-11 04:23:28 +00:00
|
|
|
|
|
2017-11-18 16:28:12 +00:00
|
|
|
|
; Counts uses of both Selfdestruct and Explosion.
|
2018-06-24 14:09:41 +00:00
|
|
|
|
StubbedTrainerRankings_Selfdestruct:
|
2018-01-02 19:00:14 +00:00
|
|
|
|
ret
|
2017-01-16 21:11:34 +00:00
|
|
|
|
; Only counts if it’s the player’s turn
|
2015-11-11 04:23:28 +00:00
|
|
|
|
ld a, [hBattleTurn]
|
|
|
|
|
and a
|
|
|
|
|
ret nz
|
2017-11-18 16:28:12 +00:00
|
|
|
|
ld hl, sTrainerRankingSelfdestruct
|
2018-01-02 19:00:14 +00:00
|
|
|
|
jr StubbedTrainerRankings_Increment3Byte
|
2015-11-11 04:23:28 +00:00
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
StubbedTrainerRankings_Increment4Byte:
|
2015-11-11 04:23:28 +00:00
|
|
|
|
push bc
|
|
|
|
|
ld bc, 3
|
2018-01-02 19:00:14 +00:00
|
|
|
|
jr StubbedTrainerRankings_Increment
|
2015-11-11 04:23:28 +00:00
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
StubbedTrainerRankings_Increment3Byte:
|
2015-11-11 04:23:28 +00:00
|
|
|
|
push bc
|
|
|
|
|
ld bc, 2
|
2018-01-02 19:00:14 +00:00
|
|
|
|
jr StubbedTrainerRankings_Increment
|
2015-11-11 04:23:28 +00:00
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
StubbedTrainerRankings_Increment2Byte:
|
2015-11-11 04:23:28 +00:00
|
|
|
|
push bc
|
|
|
|
|
ld bc, 1
|
2018-01-02 19:00:14 +00:00
|
|
|
|
jr StubbedTrainerRankings_Increment
|
2015-11-11 04:23:28 +00:00
|
|
|
|
|
2017-01-16 21:11:34 +00:00
|
|
|
|
; unused
|
2018-06-24 14:09:41 +00:00
|
|
|
|
StubbedTrainerRankings_Increment1Byte:
|
2015-11-11 04:23:28 +00:00
|
|
|
|
push bc
|
|
|
|
|
ld bc, 0
|
|
|
|
|
|
2017-01-16 21:11:34 +00:00
|
|
|
|
; Increments a big-endian value of bc + 1 bytes at hl
|
2018-06-24 14:09:41 +00:00
|
|
|
|
StubbedTrainerRankings_Increment:
|
2017-11-20 18:50:54 +00:00
|
|
|
|
ld a, BANK(sTrainerRankings)
|
2015-11-11 04:23:28 +00:00
|
|
|
|
call GetSRAMBank
|
|
|
|
|
push hl
|
|
|
|
|
push de
|
|
|
|
|
ld e, c
|
|
|
|
|
inc e
|
|
|
|
|
.asm_106136
|
|
|
|
|
ld a, [hli]
|
|
|
|
|
inc a
|
|
|
|
|
jr nz, .asm_10613d
|
|
|
|
|
dec e
|
|
|
|
|
jr nz, .asm_106136
|
|
|
|
|
|
|
|
|
|
.asm_10613d
|
|
|
|
|
pop de
|
|
|
|
|
pop hl
|
|
|
|
|
jr z, .asm_10614d
|
|
|
|
|
add hl, bc
|
|
|
|
|
.asm_106142
|
|
|
|
|
inc [hl]
|
|
|
|
|
jr nz, .asm_10614d
|
|
|
|
|
ld a, c
|
|
|
|
|
and a
|
|
|
|
|
jr z, .asm_10614d
|
|
|
|
|
dec hl
|
|
|
|
|
dec c
|
|
|
|
|
jr .asm_106142
|
|
|
|
|
|
|
|
|
|
.asm_10614d
|
2017-01-16 21:11:34 +00:00
|
|
|
|
call UpdateTrainerRankingsChecksum
|
2015-11-11 04:23:28 +00:00
|
|
|
|
call CloseSRAM
|
|
|
|
|
pop bc
|
|
|
|
|
ret
|
|
|
|
|
|
2017-01-16 21:11:34 +00:00
|
|
|
|
; Used when SRAM bank 5 isn’t already loaded — what’s the point of this?
|
2018-06-24 14:09:41 +00:00
|
|
|
|
UpdateTrainerRankingsChecksum2:
|
2018-01-02 19:00:14 +00:00
|
|
|
|
ret
|
2017-11-20 18:50:54 +00:00
|
|
|
|
ld a, BANK(sTrainerRankings)
|
2015-11-11 04:23:28 +00:00
|
|
|
|
call GetSRAMBank
|
2017-01-16 21:11:34 +00:00
|
|
|
|
call UpdateTrainerRankingsChecksum
|
2015-11-11 04:23:28 +00:00
|
|
|
|
call CloseSRAM
|
|
|
|
|
ret
|
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
UpdateTrainerRankingsChecksum:
|
2015-11-11 04:23:28 +00:00
|
|
|
|
push de
|
2017-01-16 21:11:34 +00:00
|
|
|
|
call CalculateTrainerRankingsChecksum
|
|
|
|
|
ld hl, sTrainerRankingsChecksum
|
2015-11-11 04:23:28 +00:00
|
|
|
|
ld [hl], d
|
|
|
|
|
inc hl
|
|
|
|
|
ld [hl], e
|
|
|
|
|
pop de
|
|
|
|
|
ret
|
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
CalculateTrainerRankingsChecksum:
|
2015-11-11 04:23:28 +00:00
|
|
|
|
push bc
|
2017-01-16 21:11:34 +00:00
|
|
|
|
ld hl, sTrainerRankings
|
|
|
|
|
ld bc, sTrainerRankingsChecksum - sTrainerRankings
|
2015-11-11 04:23:28 +00:00
|
|
|
|
xor a
|
|
|
|
|
ld de, 0
|
|
|
|
|
.asm_106179
|
|
|
|
|
ld a, e
|
|
|
|
|
add [hl]
|
|
|
|
|
ld e, a
|
|
|
|
|
jr nc, .asm_10617f
|
|
|
|
|
inc d
|
|
|
|
|
|
|
|
|
|
.asm_10617f
|
|
|
|
|
inc hl
|
|
|
|
|
dec bc
|
|
|
|
|
ld a, b
|
|
|
|
|
or c
|
|
|
|
|
jr nz, .asm_106179
|
|
|
|
|
pop bc
|
|
|
|
|
ret
|
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
BackupMobileEventIndex:
|
2015-11-11 04:23:28 +00:00
|
|
|
|
ld a, BANK(sMobileEventIndex)
|
|
|
|
|
call GetSRAMBank
|
|
|
|
|
ld a, [sMobileEventIndex]
|
|
|
|
|
push af
|
|
|
|
|
ld a, BANK(sMobileEventIndexBackup)
|
|
|
|
|
call GetSRAMBank
|
|
|
|
|
pop af
|
|
|
|
|
ld [sMobileEventIndexBackup], a
|
|
|
|
|
call CloseSRAM
|
|
|
|
|
ret
|
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
RestoreMobileEventIndex:
|
2015-11-11 04:23:28 +00:00
|
|
|
|
ld a, BANK(sMobileEventIndexBackup)
|
|
|
|
|
call GetSRAMBank
|
|
|
|
|
ld a, [sMobileEventIndexBackup]
|
|
|
|
|
push af
|
|
|
|
|
ld a, BANK(sMobileEventIndex)
|
|
|
|
|
call GetSRAMBank
|
|
|
|
|
pop af
|
|
|
|
|
ld [sMobileEventIndex], a
|
|
|
|
|
call CloseSRAM
|
|
|
|
|
ret
|
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
Unreferenced_VerifyTrainerRankingsChecksum:
|
2017-01-16 21:11:34 +00:00
|
|
|
|
call CalculateTrainerRankingsChecksum
|
|
|
|
|
ld hl, sTrainerRankingsChecksum
|
2015-11-11 04:23:28 +00:00
|
|
|
|
ld a, d
|
|
|
|
|
cp [hl]
|
|
|
|
|
ret nz
|
|
|
|
|
inc hl
|
|
|
|
|
ld a, e
|
|
|
|
|
cp [hl]
|
|
|
|
|
ret
|
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
DeleteMobileEventIndex:
|
2015-11-11 04:23:28 +00:00
|
|
|
|
ld a, BANK(sMobileEventIndex)
|
|
|
|
|
call GetSRAMBank
|
|
|
|
|
xor a
|
|
|
|
|
ld [sMobileEventIndex], a
|
|
|
|
|
call CloseSRAM
|
|
|
|
|
ret
|
|
|
|
|
|
2017-01-16 21:11:34 +00:00
|
|
|
|
; Used in the Japanese version to initialize Trainer Rankings data
|
|
|
|
|
; for a new save file. Unreferenced in the English version.
|
|
|
|
|
InitializeTrainerRankings:
|
|
|
|
|
ld hl, sTrainerRankings
|
|
|
|
|
ld bc, sTrainerRankingsEnd - sTrainerRankings
|
2015-11-11 04:23:28 +00:00
|
|
|
|
xor a
|
|
|
|
|
call ByteFill
|
2017-01-16 21:11:34 +00:00
|
|
|
|
|
|
|
|
|
; Initialize the shortest Magikarp to 100.0 cm
|
|
|
|
|
ld hl, sTrainerRankingShortestMagikarp
|
2015-11-11 04:23:28 +00:00
|
|
|
|
ld a, $3
|
|
|
|
|
ld [hli], a
|
|
|
|
|
ld [hl], $e8
|
2017-01-16 21:11:34 +00:00
|
|
|
|
|
|
|
|
|
call UpdateTrainerRankingsChecksum
|
|
|
|
|
ld hl, sTrainerRankings
|
|
|
|
|
ld de, sTrainerRankingsBackup
|
|
|
|
|
ld bc, sTrainerRankingsEnd - sTrainerRankings
|
2015-11-11 04:23:28 +00:00
|
|
|
|
call CopyBytes
|
|
|
|
|
ret
|
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
_MobilePrintNum::
|
2015-11-11 04:23:28 +00:00
|
|
|
|
; Supports signed 31-bit integers (up to 10 digits)
|
|
|
|
|
; b: Bits 0-4 = # bytes
|
|
|
|
|
; Bit 7 = set if negative
|
|
|
|
|
; c: Number of digits
|
|
|
|
|
; de: highest byte of number to convert
|
|
|
|
|
; hl: where to print the converted string
|
|
|
|
|
push bc
|
|
|
|
|
xor a
|
|
|
|
|
ld [hPrintNum1], a
|
|
|
|
|
ld [hPrintNum2], a
|
|
|
|
|
ld [hPrintNum3], a
|
|
|
|
|
ld a, b
|
|
|
|
|
and $f
|
|
|
|
|
cp $1
|
|
|
|
|
jr z, .one_byte
|
|
|
|
|
cp $2
|
|
|
|
|
jr z, .two_bytes
|
|
|
|
|
cp $3
|
|
|
|
|
jr z, .three_bytes
|
|
|
|
|
; four bytes
|
|
|
|
|
ld a, [de]
|
|
|
|
|
ld [hPrintNum1], a
|
|
|
|
|
inc de
|
|
|
|
|
|
|
|
|
|
.three_bytes
|
|
|
|
|
ld a, [de]
|
|
|
|
|
ld [hPrintNum2], a
|
|
|
|
|
inc de
|
|
|
|
|
|
|
|
|
|
.two_bytes
|
|
|
|
|
ld a, [de]
|
|
|
|
|
ld [hPrintNum3], a
|
|
|
|
|
inc de
|
|
|
|
|
|
|
|
|
|
.one_byte
|
|
|
|
|
ld a, [de]
|
|
|
|
|
ld [hPrintNum4], a
|
|
|
|
|
inc de
|
|
|
|
|
|
|
|
|
|
push de
|
|
|
|
|
xor a
|
|
|
|
|
ld [hPrintNum9], a
|
|
|
|
|
ld a, b
|
|
|
|
|
ld [hPrintNum10], a
|
|
|
|
|
ld a, c
|
|
|
|
|
cp 2
|
|
|
|
|
jr z, .two_digits
|
|
|
|
|
ld de, ._2
|
|
|
|
|
cp 3
|
|
|
|
|
jr z, .three_to_nine_digits
|
|
|
|
|
ld de, ._3
|
|
|
|
|
cp 4
|
|
|
|
|
jr z, .three_to_nine_digits
|
|
|
|
|
ld de, ._4
|
|
|
|
|
cp 5
|
|
|
|
|
jr z, .three_to_nine_digits
|
|
|
|
|
ld de, ._5
|
|
|
|
|
cp 6
|
|
|
|
|
jr z, .three_to_nine_digits
|
|
|
|
|
ld de, ._6
|
|
|
|
|
cp 7
|
|
|
|
|
jr z, .three_to_nine_digits
|
|
|
|
|
ld de, ._7
|
|
|
|
|
cp 8
|
|
|
|
|
jr z, .three_to_nine_digits
|
|
|
|
|
ld de, ._8
|
|
|
|
|
cp 9
|
|
|
|
|
jr z, .three_to_nine_digits
|
|
|
|
|
ld de, ._9
|
|
|
|
|
|
|
|
|
|
.three_to_nine_digits
|
|
|
|
|
inc de
|
2016-05-10 16:31:49 +00:00
|
|
|
|
inc de
|
|
|
|
|
inc de
|
2015-11-11 04:23:28 +00:00
|
|
|
|
dec a
|
2016-05-04 15:46:23 +00:00
|
|
|
|
dec a
|
2015-11-11 04:23:28 +00:00
|
|
|
|
|
|
|
|
|
.digit_loop
|
|
|
|
|
push af
|
|
|
|
|
call .Function1062b2
|
|
|
|
|
call .Function1062ff
|
|
|
|
|
rept 4
|
|
|
|
|
inc de
|
|
|
|
|
endr
|
|
|
|
|
pop af
|
|
|
|
|
dec a
|
|
|
|
|
jr nz, .digit_loop
|
|
|
|
|
|
|
|
|
|
.two_digits
|
|
|
|
|
ld c, 0
|
|
|
|
|
ld a, [hPrintNum4]
|
|
|
|
|
.mod_ten_loop
|
|
|
|
|
cp 10
|
|
|
|
|
jr c, .simple_divide_done
|
|
|
|
|
sub 10
|
|
|
|
|
inc c
|
|
|
|
|
jr .mod_ten_loop
|
|
|
|
|
|
|
|
|
|
.simple_divide_done
|
|
|
|
|
ld b, a
|
|
|
|
|
ld a, [hPrintNum9]
|
|
|
|
|
or c
|
|
|
|
|
ld [hPrintNum9], a
|
|
|
|
|
jr nz, .create_digit
|
|
|
|
|
call .LoadMinusTenIfNegative
|
|
|
|
|
jr .done
|
|
|
|
|
|
|
|
|
|
.create_digit
|
|
|
|
|
ld a, "0"
|
|
|
|
|
add c
|
|
|
|
|
ld [hl], a
|
|
|
|
|
|
|
|
|
|
.done
|
|
|
|
|
call .Function1062ff
|
|
|
|
|
ld a, "0"
|
|
|
|
|
add b
|
|
|
|
|
ld [hli], a
|
|
|
|
|
pop de
|
|
|
|
|
pop bc
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
._9 dd 1000000000
|
|
|
|
|
._8 dd 100000000
|
|
|
|
|
._7 dd 10000000
|
|
|
|
|
._6 dd 1000000
|
|
|
|
|
._5 dd 100000
|
|
|
|
|
._4 dd 10000
|
|
|
|
|
._3 dd 1000
|
|
|
|
|
._2 dd 100
|
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
.Function1062b2:
|
2015-11-11 04:23:28 +00:00
|
|
|
|
ld c, $0
|
|
|
|
|
.asm_1062b4
|
|
|
|
|
ld a, [de]
|
|
|
|
|
dec de
|
|
|
|
|
ld b, a
|
|
|
|
|
ld a, [hPrintNum4]
|
|
|
|
|
sub b
|
|
|
|
|
ld [hPrintNum8], a
|
|
|
|
|
ld a, [de]
|
|
|
|
|
dec de
|
|
|
|
|
ld b, a
|
|
|
|
|
ld a, [hPrintNum3]
|
|
|
|
|
sbc b
|
|
|
|
|
ld [hPrintNum7], a
|
|
|
|
|
ld a, [de]
|
|
|
|
|
dec de
|
|
|
|
|
ld b, a
|
|
|
|
|
ld a, [hPrintNum2]
|
|
|
|
|
sbc b
|
|
|
|
|
ld [hPrintNum6], a
|
|
|
|
|
ld a, [de]
|
|
|
|
|
inc de
|
2016-05-10 16:31:49 +00:00
|
|
|
|
inc de
|
|
|
|
|
inc de
|
2015-11-11 04:23:28 +00:00
|
|
|
|
ld b, a
|
|
|
|
|
ld a, [hPrintNum1]
|
|
|
|
|
sbc b
|
|
|
|
|
ld [hPrintNum5], a
|
|
|
|
|
jr c, .asm_1062eb
|
|
|
|
|
ld a, [hPrintNum5]
|
|
|
|
|
ld [hPrintNum1], a
|
|
|
|
|
ld a, [hPrintNum6]
|
|
|
|
|
ld [hPrintNum2], a
|
|
|
|
|
ld a, [hPrintNum7]
|
|
|
|
|
ld [hPrintNum3], a
|
|
|
|
|
ld a, [hPrintNum8]
|
|
|
|
|
ld [hPrintNum4], a
|
|
|
|
|
inc c
|
|
|
|
|
jr .asm_1062b4
|
|
|
|
|
|
|
|
|
|
.asm_1062eb
|
|
|
|
|
ld a, [hPrintNum9]
|
|
|
|
|
or c
|
|
|
|
|
jr z, .LoadMinusTenIfNegative
|
|
|
|
|
ld a, -10
|
|
|
|
|
add c
|
|
|
|
|
ld [hl], a
|
|
|
|
|
ld [hPrintNum9], a
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
.LoadMinusTenIfNegative:
|
|
|
|
|
ld a, [hPrintNum10]
|
|
|
|
|
bit 7, a
|
|
|
|
|
ret z
|
|
|
|
|
|
|
|
|
|
ld [hl], -10
|
|
|
|
|
ret
|
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
.Function1062ff:
|
2015-11-11 04:23:28 +00:00
|
|
|
|
ld a, [hPrintNum10]
|
|
|
|
|
bit 7, a
|
|
|
|
|
jr nz, .asm_10630d
|
|
|
|
|
bit 6, a
|
|
|
|
|
jr z, .asm_10630d
|
|
|
|
|
ld a, [hPrintNum9]
|
|
|
|
|
and a
|
|
|
|
|
ret z
|
|
|
|
|
|
|
|
|
|
.asm_10630d
|
|
|
|
|
inc hl
|
|
|
|
|
ret
|
|
|
|
|
|
2018-01-02 19:00:14 +00:00
|
|
|
|
; functions related to the cable club and various NPC scripts referencing communications
|
2015-11-16 21:01:45 +00:00
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
Mobile_DummyReturnFalse:
|
2015-11-11 04:23:28 +00:00
|
|
|
|
xor a
|
2018-01-23 22:39:09 +00:00
|
|
|
|
ld [wScriptVar], a
|
2015-11-11 04:23:28 +00:00
|
|
|
|
ret
|
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
Stubbed_Function106314:
|
2018-01-02 19:00:14 +00:00
|
|
|
|
ret
|
2015-11-11 04:23:28 +00:00
|
|
|
|
ld a, $4
|
|
|
|
|
call GetSRAMBank
|
|
|
|
|
ld a, c
|
|
|
|
|
cpl
|
|
|
|
|
ld [$b000], a
|
|
|
|
|
call CloseSRAM
|
|
|
|
|
ld a, $7
|
|
|
|
|
call GetSRAMBank
|
|
|
|
|
ld a, c
|
|
|
|
|
ld [$a800], a
|
|
|
|
|
call CloseSRAM
|
|
|
|
|
ret
|
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
Mobile_AlwaysReturnNotCarry:
|
2015-11-11 04:23:28 +00:00
|
|
|
|
or a
|
2015-11-16 21:01:45 +00:00
|
|
|
|
ret
|
2015-11-11 04:23:28 +00:00
|
|
|
|
|
2018-06-25 01:39:23 +00:00
|
|
|
|
Function106331:
|
|
|
|
|
; called by Mobile_DummyReturnFalse in Crystal-J
|
2015-11-16 21:01:45 +00:00
|
|
|
|
; check ~[4:b000] == [7:a800]
|
2015-11-11 04:23:28 +00:00
|
|
|
|
ld a, $4
|
|
|
|
|
call GetSRAMBank
|
|
|
|
|
ld a, [$b000]
|
|
|
|
|
cpl
|
|
|
|
|
ld b, a
|
|
|
|
|
call CloseSRAM
|
|
|
|
|
ld a, $7
|
|
|
|
|
call GetSRAMBank
|
|
|
|
|
ld a, [$a800]
|
|
|
|
|
ld c, a
|
|
|
|
|
call CloseSRAM
|
|
|
|
|
ld a, c
|
|
|
|
|
cp b
|
2015-11-16 21:01:45 +00:00
|
|
|
|
jr nz, .nope
|
|
|
|
|
|
|
|
|
|
; check [7:a800] != 0
|
2015-11-11 04:23:28 +00:00
|
|
|
|
and a
|
2015-11-16 21:01:45 +00:00
|
|
|
|
jr z, .nope
|
|
|
|
|
|
|
|
|
|
; check !([7:a800] & %01110000)
|
|
|
|
|
and %10001111
|
2015-11-11 04:23:28 +00:00
|
|
|
|
cp c
|
2015-11-16 21:01:45 +00:00
|
|
|
|
jr nz, .nope
|
|
|
|
|
|
2015-11-11 04:23:28 +00:00
|
|
|
|
ld c, a
|
|
|
|
|
scf
|
|
|
|
|
ret
|
|
|
|
|
|
2015-11-16 21:01:45 +00:00
|
|
|
|
.nope
|
2015-11-11 04:23:28 +00:00
|
|
|
|
xor a
|
|
|
|
|
ld c, a
|
|
|
|
|
ret
|
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
Function10635c:
|
2016-05-05 19:07:37 +00:00
|
|
|
|
ld a, [wMobileCommsJumptableIndex]
|
2015-11-11 04:23:28 +00:00
|
|
|
|
bit 7, a
|
|
|
|
|
ret nz
|
2016-05-05 19:07:37 +00:00
|
|
|
|
ld a, [wMobileCommsJumptableIndex]
|
|
|
|
|
ld hl, .Jumptable
|
2015-11-11 04:23:28 +00:00
|
|
|
|
rst JumpTable
|
|
|
|
|
ret
|
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
.Jumptable:
|
2016-05-05 19:07:37 +00:00
|
|
|
|
dw .init
|
2015-11-11 04:23:28 +00:00
|
|
|
|
dw Function106392
|
|
|
|
|
dw Function1063cc
|
|
|
|
|
dw Function1063d8
|
|
|
|
|
dw Function1063e5
|
|
|
|
|
dw Function1063f3
|
|
|
|
|
dw Function106403
|
|
|
|
|
dw Function106442
|
|
|
|
|
dw Function106453
|
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
.init:
|
2015-11-11 04:23:28 +00:00
|
|
|
|
ld de, wcd30
|
|
|
|
|
ld hl, $41
|
|
|
|
|
ld bc, $41
|
|
|
|
|
ld a, $40
|
|
|
|
|
call Function3e32
|
2016-05-05 19:07:37 +00:00
|
|
|
|
ld a, [wMobileCommsJumptableIndex]
|
2015-11-11 04:23:28 +00:00
|
|
|
|
inc a
|
2016-05-05 19:07:37 +00:00
|
|
|
|
ld [wMobileCommsJumptableIndex], a
|
2015-11-11 04:23:28 +00:00
|
|
|
|
ret
|
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
Function106392:
|
2015-11-11 04:23:28 +00:00
|
|
|
|
xor a
|
|
|
|
|
ld [wcf64], a
|
|
|
|
|
ld a, [wc821]
|
|
|
|
|
bit 1, a
|
|
|
|
|
jr nz, .asm_1063a2
|
|
|
|
|
bit 0, a
|
|
|
|
|
jr z, .asm_1063bf
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
.asm_1063a2
|
2015-12-26 23:11:55 +00:00
|
|
|
|
call Mobile_AlwaysReturnNotCarry
|
2015-11-11 04:23:28 +00:00
|
|
|
|
ld a, c
|
|
|
|
|
and a
|
|
|
|
|
jr nz, .asm_1063b4
|
|
|
|
|
ld a, $b
|
|
|
|
|
ld [wcf64], a
|
|
|
|
|
ld a, $7
|
2016-05-05 19:07:37 +00:00
|
|
|
|
ld [wMobileCommsJumptableIndex], a
|
2015-11-11 04:23:28 +00:00
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
.asm_1063b4
|
|
|
|
|
ld a, $7
|
|
|
|
|
ld [wcf64], a
|
|
|
|
|
ld a, $7
|
2016-05-05 19:07:37 +00:00
|
|
|
|
ld [wMobileCommsJumptableIndex], a
|
2015-11-11 04:23:28 +00:00
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
.asm_1063bf
|
|
|
|
|
ld a, $1
|
|
|
|
|
ld [wcf64], a
|
2016-05-05 19:07:37 +00:00
|
|
|
|
ld a, [wMobileCommsJumptableIndex]
|
2015-11-11 04:23:28 +00:00
|
|
|
|
inc a
|
2016-05-05 19:07:37 +00:00
|
|
|
|
ld [wMobileCommsJumptableIndex], a
|
2015-11-11 04:23:28 +00:00
|
|
|
|
ret
|
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
Function1063cc:
|
2015-11-11 04:23:28 +00:00
|
|
|
|
ld a, $78
|
|
|
|
|
ld [wcd42], a
|
2016-05-05 19:07:37 +00:00
|
|
|
|
ld a, [wMobileCommsJumptableIndex]
|
2015-11-11 04:23:28 +00:00
|
|
|
|
inc a
|
2016-05-05 19:07:37 +00:00
|
|
|
|
ld [wMobileCommsJumptableIndex], a
|
2015-11-11 04:23:28 +00:00
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
Function1063d8:
|
2015-11-11 04:23:28 +00:00
|
|
|
|
ld hl, wcd42
|
|
|
|
|
dec [hl]
|
|
|
|
|
ret nz
|
2016-05-05 19:07:37 +00:00
|
|
|
|
ld a, [wMobileCommsJumptableIndex]
|
2015-11-11 04:23:28 +00:00
|
|
|
|
inc a
|
2016-05-05 19:07:37 +00:00
|
|
|
|
ld [wMobileCommsJumptableIndex], a
|
2015-11-11 04:23:28 +00:00
|
|
|
|
ret
|
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
Function1063e5:
|
2015-11-11 04:23:28 +00:00
|
|
|
|
ld a, [wcf64]
|
|
|
|
|
cp $3
|
|
|
|
|
ret nz
|
2016-05-05 19:07:37 +00:00
|
|
|
|
ld a, [wMobileCommsJumptableIndex]
|
2015-11-11 04:23:28 +00:00
|
|
|
|
inc a
|
2016-05-05 19:07:37 +00:00
|
|
|
|
ld [wMobileCommsJumptableIndex], a
|
2015-11-11 04:23:28 +00:00
|
|
|
|
ret
|
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
Function1063f3:
|
2015-11-11 04:23:28 +00:00
|
|
|
|
ld de, wcd31
|
|
|
|
|
ld a, $32
|
|
|
|
|
call Function3e32
|
2016-05-05 19:07:37 +00:00
|
|
|
|
ld a, [wMobileCommsJumptableIndex]
|
2015-11-11 04:23:28 +00:00
|
|
|
|
inc a
|
2016-05-05 19:07:37 +00:00
|
|
|
|
ld [wMobileCommsJumptableIndex], a
|
2015-11-11 04:23:28 +00:00
|
|
|
|
ret
|
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
Function106403:
|
2015-11-11 04:23:28 +00:00
|
|
|
|
ld a, [wc821]
|
|
|
|
|
bit 1, a
|
|
|
|
|
jr nz, .asm_106426
|
|
|
|
|
bit 0, a
|
|
|
|
|
jr z, .asm_10640f
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
.asm_10640f
|
|
|
|
|
ld a, [wcd31]
|
|
|
|
|
and $80
|
|
|
|
|
ld c, a
|
|
|
|
|
ld a, [wcd30]
|
|
|
|
|
or c
|
|
|
|
|
inc a
|
|
|
|
|
ld c, a
|
2018-01-02 19:00:14 +00:00
|
|
|
|
call Stubbed_Function106314
|
2016-05-05 19:07:37 +00:00
|
|
|
|
ld a, [wMobileCommsJumptableIndex]
|
2015-11-11 04:23:28 +00:00
|
|
|
|
inc a
|
2016-05-05 19:07:37 +00:00
|
|
|
|
ld [wMobileCommsJumptableIndex], a
|
2015-11-11 04:23:28 +00:00
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
.asm_106426
|
2015-12-26 23:11:55 +00:00
|
|
|
|
call Mobile_AlwaysReturnNotCarry
|
2015-11-11 04:23:28 +00:00
|
|
|
|
ld a, c
|
|
|
|
|
and a
|
|
|
|
|
jr z, .asm_106435
|
2016-05-05 19:07:37 +00:00
|
|
|
|
ld a, [wMobileCommsJumptableIndex]
|
2015-11-11 04:23:28 +00:00
|
|
|
|
inc a
|
2016-05-05 19:07:37 +00:00
|
|
|
|
ld [wMobileCommsJumptableIndex], a
|
2015-11-11 04:23:28 +00:00
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
.asm_106435
|
|
|
|
|
ld c, $0
|
2018-01-02 19:00:14 +00:00
|
|
|
|
call Stubbed_Function106314
|
2016-05-05 19:07:37 +00:00
|
|
|
|
ld a, [wMobileCommsJumptableIndex]
|
2015-11-11 04:23:28 +00:00
|
|
|
|
inc a
|
2016-05-05 19:07:37 +00:00
|
|
|
|
ld [wMobileCommsJumptableIndex], a
|
2015-11-11 04:23:28 +00:00
|
|
|
|
ret
|
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
Function106442:
|
2015-11-11 04:23:28 +00:00
|
|
|
|
ld a, $36
|
|
|
|
|
call Function3e32
|
|
|
|
|
xor a
|
|
|
|
|
ld [hMobile], a
|
2015-12-15 23:59:49 +00:00
|
|
|
|
ld [hMobileReceive], a
|
2016-05-05 19:07:37 +00:00
|
|
|
|
ld a, [wMobileCommsJumptableIndex]
|
2015-11-11 04:23:28 +00:00
|
|
|
|
inc a
|
2016-05-05 19:07:37 +00:00
|
|
|
|
ld [wMobileCommsJumptableIndex], a
|
2015-11-11 04:23:28 +00:00
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
Function106453:
|
2016-05-05 19:07:37 +00:00
|
|
|
|
ld a, [wMobileCommsJumptableIndex]
|
2015-11-11 04:23:28 +00:00
|
|
|
|
set 7, a
|
2016-05-05 19:07:37 +00:00
|
|
|
|
ld [wMobileCommsJumptableIndex], a
|
2015-11-11 04:23:28 +00:00
|
|
|
|
nop
|
|
|
|
|
ld a, $4
|
|
|
|
|
ld [wcf64], a
|
|
|
|
|
ret
|
|
|
|
|
|
2018-01-02 19:00:14 +00:00
|
|
|
|
Stubbed_Function106462:
|
|
|
|
|
ret
|
2015-11-11 04:23:28 +00:00
|
|
|
|
ret
|
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
Function106464::
|
2018-01-12 03:16:17 +00:00
|
|
|
|
ld de, FontsExtra_SolidBlackGFX
|
2018-01-19 07:30:19 +00:00
|
|
|
|
ld hl, vTiles2 tile "■" ; $60
|
2018-01-12 03:16:17 +00:00
|
|
|
|
lb bc, BANK(FontsExtra_SolidBlackGFX), 1
|
2015-11-11 04:23:28 +00:00
|
|
|
|
call Get2bpp
|
2016-05-08 18:11:24 +00:00
|
|
|
|
ld de, FontsExtra2_UpArrowGFX
|
2018-01-12 03:16:17 +00:00
|
|
|
|
ld hl, vTiles2 tile "▲" ; $61
|
2016-05-08 18:11:24 +00:00
|
|
|
|
lb bc, BANK(FontsExtra2_UpArrowGFX), 1
|
2015-11-11 04:23:28 +00:00
|
|
|
|
call Get2bpp
|
|
|
|
|
ld de, GFX_106514
|
2018-01-19 07:30:19 +00:00
|
|
|
|
ld hl, vTiles2 tile "☎" ; $62
|
2015-11-11 04:23:28 +00:00
|
|
|
|
ld c, 9
|
|
|
|
|
ld b, BANK(GFX_106514)
|
|
|
|
|
call Get2bpp
|
|
|
|
|
ld de, $40b0
|
2017-12-28 12:32:33 +00:00
|
|
|
|
ld hl, vTiles2 tile $6b
|
2015-11-11 04:23:28 +00:00
|
|
|
|
ld b, $f ; XXX no graphics at 0f:40b0
|
|
|
|
|
call Get2bpp
|
2017-12-24 17:47:30 +00:00
|
|
|
|
farcall LoadFrame
|
2015-11-11 04:23:28 +00:00
|
|
|
|
ret
|
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
Function10649b:
|
2018-01-23 22:39:09 +00:00
|
|
|
|
ld a, [wTextBoxFrame]
|
2018-01-16 22:27:50 +00:00
|
|
|
|
maskbits NUM_FRAMES
|
2018-01-12 04:04:50 +00:00
|
|
|
|
ld bc, 6 * LEN_1BPP_TILE
|
2015-11-11 04:23:28 +00:00
|
|
|
|
ld hl, Frames
|
|
|
|
|
call AddNTimes
|
|
|
|
|
ld d, h
|
|
|
|
|
ld e, l
|
2018-01-12 04:04:50 +00:00
|
|
|
|
ld hl, vTiles2 tile "┌" ; $79
|
|
|
|
|
ld c, 6 ; "┌" to "┘"
|
2015-11-11 04:23:28 +00:00
|
|
|
|
ld b, BANK(Frames)
|
|
|
|
|
call Function1064c3
|
2018-01-12 04:04:50 +00:00
|
|
|
|
ld hl, vTiles2 tile " " ; $7f
|
2015-11-11 04:23:28 +00:00
|
|
|
|
ld de, TextBoxSpaceGFX
|
|
|
|
|
ld c, 1
|
|
|
|
|
ld b, BANK(TextBoxSpaceGFX)
|
|
|
|
|
call Function1064c3
|
|
|
|
|
ret
|
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
Function1064c3:
|
2015-11-11 04:23:28 +00:00
|
|
|
|
ld a, [rSVBK]
|
|
|
|
|
push af
|
|
|
|
|
ld a, $6
|
|
|
|
|
ld [rSVBK], a
|
|
|
|
|
push bc
|
|
|
|
|
push hl
|
|
|
|
|
ld hl, Function3f88
|
|
|
|
|
ld a, b
|
|
|
|
|
rst FarCall
|
|
|
|
|
pop hl
|
|
|
|
|
pop bc
|
|
|
|
|
pop af
|
|
|
|
|
ld [rSVBK], a
|
|
|
|
|
jr asm_1064ed
|
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
Function1064d8:
|
2015-11-11 04:23:28 +00:00
|
|
|
|
ld a, [rSVBK]
|
|
|
|
|
push af
|
|
|
|
|
ld a, $6
|
|
|
|
|
ld [rSVBK], a
|
|
|
|
|
push bc
|
|
|
|
|
push hl
|
|
|
|
|
ld hl, Function3f9f
|
|
|
|
|
ld a, b
|
|
|
|
|
rst FarCall
|
|
|
|
|
pop hl
|
|
|
|
|
pop bc
|
|
|
|
|
pop af
|
|
|
|
|
ld [rSVBK], a
|
|
|
|
|
jr asm_1064ed
|
|
|
|
|
|
|
|
|
|
asm_1064ed
|
2015-12-19 19:48:30 +00:00
|
|
|
|
ld de, wDecompressScratch
|
2015-11-11 04:23:28 +00:00
|
|
|
|
ld b, $0
|
|
|
|
|
ld a, [rSVBK]
|
|
|
|
|
push af
|
|
|
|
|
ld a, $6
|
|
|
|
|
ld [rSVBK], a
|
|
|
|
|
ld a, [rVBK]
|
|
|
|
|
push af
|
|
|
|
|
ld a, $1
|
|
|
|
|
ld [rVBK], a
|
|
|
|
|
call Get2bpp
|
|
|
|
|
pop af
|
|
|
|
|
ld [rVBK], a
|
|
|
|
|
pop af
|
|
|
|
|
ld [rSVBK], a
|
|
|
|
|
ret
|
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
Function10650a:
|
2018-01-12 03:16:17 +00:00
|
|
|
|
ld de, MobilePhoneTilesGFX
|
|
|
|
|
lb bc, BANK(MobilePhoneTilesGFX), 17
|
2015-11-11 04:23:28 +00:00
|
|
|
|
call Get2bpp
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
GFX_106514:
|
|
|
|
|
INCBIN "gfx/unknown/106514.2bpp"
|