ref: 97ef590f9ec7a7ae38d98b7cf1fd6947b10b711e
parent: 73905420f8a4646fadb6049e9979df8e0a23b3d4
parent: 2acccc3ea5d5ebdd54cddc6cb7a3c888428be286
author: Bryan Bishop <[email protected]>
date: Sat Aug 31 03:20:25 EDT 2013
Merge pull request #180 from yenatch/master label renaming
--- a/battle/ai/scoring.asm
+++ b/battle/ai/scoring.asm
@@ -129,7 +129,7 @@
jr .checkmove
.discourage
- call RNG
+ call Random
cp 30
jr c, .checkmove
inc [hl]
@@ -430,7 +430,7 @@
ret
.asm_38815
- call RNG
+ call Random
cp $64
ret c
@@ -575,7 +575,7 @@
call AICheckEnemyQuarterHP
ret nc
- call RNG
+ call Random
cp 20
ret c
@@ -588,7 +588,7 @@
AIScoring_DreamEater: ; 388ca
- call RNG
+ call Random
cp $19
ret c
@@ -612,7 +612,7 @@
bit 0, a
jr nz, .asm_388ef
- call RNG
+ call Random
cp $b2
jr nc, .asm_38911
@@ -628,7 +628,7 @@
jr nc, .asm_3890f
- call RNG
+ call Random
cp $a
jr c, .asm_388ef
@@ -683,7 +683,7 @@
ret
.asm_38938
- call RNG
+ call Random
cp $50
ret c
dec [hl]
@@ -744,7 +744,7 @@
call AICompareSpeed
ret nc
- call RNG
+ call Random
cp $19
ret c
@@ -766,7 +766,7 @@
bit 0, a
jr nz, .asm_3899d
- call RNG
+ call Random
cp $b2
jr nc, .asm_389bf
@@ -782,7 +782,7 @@
jr nc, .asm_389bd
- call RNG
+ call Random
cp $a
jr c, .asm_3899d
@@ -837,7 +837,7 @@
ret
.asm_389e6
- call RNG
+ call Random
cp $50
ret c
dec [hl]
@@ -878,7 +878,7 @@
.asm_38a12
pop hl
- call RNG
+ call Random
cp $28
ret c
dec [hl]
@@ -894,7 +894,7 @@
AIScoring_Bide: ; 38a1e
call AICheckEnemyMaxHP
ret c
- call RNG
+ call Random
cp $19
ret c
inc [hl]
@@ -926,7 +926,7 @@
ret
.asm_38a45
- call RNG
+ call Random
cp $19
ret c
dec [hl]
@@ -948,7 +948,7 @@
AIScoring_Reflect: ; 38a54
call AICheckEnemyMaxHP
ret c
- call RNG
+ call Random
cp $14
ret c
inc [hl]
@@ -1041,7 +1041,7 @@
ret c
.asm_38acd
- call RNG
+ call Random
cp $c8
ret c
@@ -1061,7 +1061,7 @@
AIScoring_Confuse: ; 38adb
call AICheckPlayerHalfHP
ret c
- call RNG
+ call Random
cp $19
jr c, .asm_38ae7
inc [hl]
@@ -1156,7 +1156,7 @@
ret nz
call AICompareSpeed
ret c
- call RNG
+ call Random
cp 30
ret c
dec [hl]
@@ -1183,7 +1183,7 @@
ret
.asm_38b72
- call RNG
+ call Random
cp 40
ret c
inc [hl]
@@ -1334,7 +1334,7 @@
.asm_38c30
- call RNG
+ call Random
cp $64
jr c, .asm_38c38
@@ -1388,7 +1388,7 @@
jr nc, .asm_38c81
.asm_38c78
- call RNG
+ call Random
cp $46
ret c
dec [hl]
@@ -1527,7 +1527,7 @@
cp $f
jr nc, .asm_38d0b
- call RNG
+ call Random
cp $64
ret nc
@@ -1536,7 +1536,7 @@
ret
.asm_38d0d
- call RNG
+ call Random
cp $64
ret c
dec [hl]
@@ -1700,7 +1700,7 @@
ret
.asm_38dc9
- call RNG
+ call Random
cp $19
ret c
@@ -1722,7 +1722,7 @@
pop hl
jr nc, .asm_38dee
- call RNG
+ call Random
cp 100
ret c
dec [hl]
@@ -1734,7 +1734,7 @@
ret nz
.asm_38df3
- call RNG
+ call Random
cp 20
ret c
inc [hl]
@@ -1961,7 +1961,7 @@
inc [hl]
.asm_38f14
- call RNG
+ call Random
cp 20
ret c
inc [hl]
@@ -1985,7 +1985,7 @@
cp GHOST
jr z, .asm_38f41
- call RNG
+ call Random
cp 20
ret c
inc [hl]
@@ -1992,7 +1992,7 @@
ret
.asm_38f41
- call RNG
+ call Random
cp 100
ret c
dec [hl]
@@ -2169,7 +2169,7 @@
cp 8
jr nc, .asm_39020
- call RNG
+ call Random
cp 200
ret nc
dec [hl]
@@ -2196,7 +2196,7 @@
ret
.asm_39032
- call RNG
+ call Random
cp 200
ret nc
dec [hl]
@@ -2558,7 +2558,7 @@
.asm_391ca
- call RNG
+ call Random
cp 100
jr c, .asm_391d2
dec [hl]
@@ -2634,7 +2634,7 @@
cp WEATHER_RAIN
ret nz
- call RNG
+ call Random
cp 25 ; 1/10
ret c
@@ -2657,7 +2657,7 @@
cp WEATHER_SUN
ret nz
- call RNG
+ call Random
cp 25 ; 1/10
ret c
@@ -3150,7 +3150,7 @@
pop hl
jr nc, .asm_39425
- call RNG
+ call Random
cp 230
ret nc
@@ -3274,7 +3274,7 @@
call AICheckEnemyMaxHP
jr c, .nextmove
- call RNG
+ call Random
cp 200 ; 1/5
jr c, .nextmove
@@ -3347,7 +3347,7 @@
Function_0x39521: ; 39521
- call RNG
+ call Random
cp 50 ; 1/5
ret
; 39527
@@ -3354,7 +3354,7 @@
Function_0x39527: ; 39527
- call RNG
+ call Random
cp $80 ; 1/2
ret
; 3952d
--- a/battle/effect_commands.asm
+++ b/battle/effect_commands.asm
@@ -154,7 +154,7 @@
; 'must recharge!'
ld hl, MustRechargeText
- call FarBattleTextBox
+ call StdBattleTextBox
call CantMove
jp Function0x34385
@@ -179,7 +179,7 @@
.WokeUp
; 'woke up!'
ld hl, WokeUpText
- call FarBattleTextBox
+ call StdBattleTextBox
call CantMove
call UpdateBattleMonInParty
@@ -195,7 +195,7 @@
.FastAsleep
; 'fast asleep!'
ld hl, FastAsleepText
- call FarBattleTextBox
+ call StdBattleTextBox
; Snore and Sleep Talk bypass sleep.
ld a, [CurPlayerMove]
@@ -221,7 +221,7 @@
; 'frozen solid!'
ld hl, FrozenSolidText
- call FarBattleTextBox
+ call StdBattleTextBox
call CantMove
jp Function0x34385
@@ -236,7 +236,7 @@
; 'flinched!'
ld hl, FlinchedText
- call FarBattleTextBox
+ call StdBattleTextBox
call CantMove
jp Function0x34385
@@ -256,7 +256,7 @@
; 'disabled no more!'
ld hl, DisabledNoMoreText
- call FarBattleTextBox
+ call StdBattleTextBox
.CheckConfused
@@ -272,7 +272,7 @@
; 'confused no more!'
ld hl, ConfusedNoMoreText
- call FarBattleTextBox
+ call StdBattleTextBox
jr .CheckAttract
@@ -280,7 +280,7 @@
.Confused
; 'confused!'
ld hl, IsConfusedText
- call FarBattleTextBox
+ call StdBattleTextBox
xor a
ld [$cfca], a
@@ -288,7 +288,7 @@
call FarPlayBattleAnimation
; 50% chance of hitting itself
- call FarBattleRNG
+ call BattleRandom
cp $80
jr nc, .CheckAttract
@@ -310,7 +310,7 @@
; 'in love with'
ld hl, InLoveWithText
- call FarBattleTextBox
+ call StdBattleTextBox
xor a
ld [$cfca], a
@@ -319,13 +319,13 @@
call FarPlayBattleAnimation
; 50% chance of infatuation
- call FarBattleRNG
+ call BattleRandom
cp $80
jr c, .CheckDisabledMove
; 'infatuation kept it from attacking!'
ld hl, InfatuationText
- call FarBattleTextBox
+ call StdBattleTextBox
call CantMove
jp Function0x34385
@@ -353,13 +353,13 @@
ret z
; 25% chance to be fully paralyzed
- call FarBattleRNG
+ call BattleRandom
cp $3f
ret nc
; 'fully paralyzed!'
ld hl, FullyParalyzedText
- call FarBattleTextBox
+ call StdBattleTextBox
call CantMove
jp Function0x34385
; 341f0
@@ -412,7 +412,7 @@
; 'must recharge!'
ld hl, MustRechargeText
- call FarBattleTextBox
+ call StdBattleTextBox
call CantMove
jp Function0x34385
@@ -429,7 +429,7 @@
; 'fast asleep!'
ld hl, FastAsleepText
- call FarBattleTextBox
+ call StdBattleTextBox
xor a
ld [$cfca], a
ld de, ANIM_SLEEP
@@ -440,7 +440,7 @@
.WokeUp
; 'woke up!'
ld hl, WokeUpText
- call FarBattleTextBox
+ call StdBattleTextBox
call CantMove
call UpdateEnemyMonInParty
ld hl, $6036
@@ -475,7 +475,7 @@
; 'frozen solid!'
ld hl, FrozenSolidText
- call FarBattleTextBox
+ call StdBattleTextBox
call CantMove
jp Function0x34385
@@ -489,7 +489,7 @@
; 'flinched!'
ld hl, FlinchedText
- call FarBattleTextBox
+ call StdBattleTextBox
call CantMove
jp Function0x34385
@@ -511,7 +511,7 @@
; 'disabled no more!'
ld hl, DisabledNoMoreText
- call FarBattleTextBox
+ call StdBattleTextBox
.CheckConfused
@@ -528,7 +528,7 @@
; 'confused no more!'
ld hl, ConfusedNoMoreText
- call FarBattleTextBox
+ call StdBattleTextBox
jr .CheckAttract
@@ -536,7 +536,7 @@
.Confused
; 'confused!'
ld hl, IsConfusedText
- call FarBattleTextBox
+ call StdBattleTextBox
xor a
ld [$cfca], a
@@ -544,7 +544,7 @@
call FarPlayBattleAnimation
; 50% chance of hitting itself
- call FarBattleRNG
+ call BattleRandom
cp $80
jr nc, .CheckAttract
@@ -555,7 +555,7 @@
; 'hurt itself in its confusion!'
ld hl, HurtItselfText
- call FarBattleTextBox
+ call StdBattleTextBox
call Function0x355dd
@@ -589,7 +589,7 @@
; 'in love with'
ld hl, InLoveWithText
- call FarBattleTextBox
+ call StdBattleTextBox
xor a
ld [$cfca], a
@@ -598,13 +598,13 @@
call FarPlayBattleAnimation
; 50% chance of infatuation
- call FarBattleRNG
+ call BattleRandom
cp $80
jr c, .CheckDisabledMove
; 'infatuation kept it from attacking!'
ld hl, InfatuationText
- call FarBattleTextBox
+ call StdBattleTextBox
call CantMove
jp Function0x34385
@@ -633,13 +633,13 @@
ret z
; 25% chance to be fully paralyzed
- call FarBattleRNG
+ call BattleRandom
cp $3f
ret nc
; 'fully paralyzed!'
ld hl, FullyParalyzedText
- call FarBattleTextBox
+ call StdBattleTextBox
call CantMove
@@ -668,7 +668,7 @@
; 'disabled!'
ld hl, DisabledMoveText
- jp FarBattleTextBox
+ jp StdBattleTextBox
; 343a5
@@ -676,7 +676,7 @@
; 'hurt itself in its confusion!'
ld hl, HurtItselfText
- call FarBattleTextBox
+ call StdBattleTextBox
xor a
ld [CriticalHit], a
@@ -808,7 +808,7 @@
; Random number from 0 to obedience level + monster level
.rand1
- call FarBattleRNG
+ call BattleRandom
swap a
cp b
jr nc, .rand1
@@ -826,7 +826,7 @@
; Another random number from 0 to obedience level + monster level
.rand2
- call FarBattleRNG
+ call BattleRandom
cp b
jr nc, .rand2
@@ -843,7 +843,7 @@
ld b, a
; The chance of napping is the difference out of 256.
- call FarBattleRNG
+ call BattleRandom
swap a
sub b
jr c, .Nap
@@ -854,7 +854,7 @@
; 'won't obey!'
ld hl, WontObeyText
- call FarBattleTextBox
+ call StdBattleTextBox
call HitConfusion
@@ -862,7 +862,7 @@
.Nap
- call FarBattleRNG
+ call BattleRandom
add a
swap a
and 7
@@ -876,7 +876,7 @@
.DoNothing
- call FarBattleRNG
+ call BattleRandom
and 3
; 'loafing around!'
@@ -898,7 +898,7 @@
ld hl, IgnoredOrdersText
- call FarBattleTextBox
+ call StdBattleTextBox
jp Function0x3450c
@@ -964,7 +964,7 @@
.RandomMove
- call FarBattleRNG
+ call BattleRandom
and 3
cp b
@@ -1043,7 +1043,7 @@
; 'ignored orders…sleeping!'
ld hl, IgnoredSleepingText
- call FarBattleTextBox
+ call StdBattleTextBox
call EndMoveEffect
@@ -1192,7 +1192,7 @@
; 'but no pp is left for the move'
ld hl, NoPPLeftText
- call FarBattleTextBox
+ call StdBattleTextBox
ld b, 1
ret
; 34602
@@ -1324,7 +1324,7 @@
ld hl, .Chances
ld b, 0
add hl, bc
- call FarBattleRNG
+ call BattleRandom
cp [hl]
ret nc
ld a, 1
@@ -2338,7 +2338,7 @@
; Multiply by 85-100%...
.loop
- call FarBattleRNG
+ call BattleRandom
rrca
cp $d9 ; 85%
jr c, .loop
@@ -2423,7 +2423,7 @@
cp $ff
jr z, .Hit
- call FarBattleRNG
+ call BattleRandom
cp b
jr nc, .Miss
@@ -2471,7 +2471,7 @@
; 'protecting itself!'
ld hl, ProtectingItselfText
- call FarBattleTextBox
+ call StdBattleTextBox
ld c, 40
call DelayFrames
@@ -2701,7 +2701,7 @@
ld hl, EnemyMoveEffectChance
.asm_34ee1
- call FarBattleRNG
+ call BattleRandom
cp [hl]
pop hl
ret c
@@ -2986,7 +2986,7 @@
cp HELD_FOCUS_BAND
ld b, $0
jr nz, .asm_3508b ; 3507a $f
- call FarBattleRNG
+ call BattleRandom
cp c
jr nc, .asm_3508b ; 35080 $9
call BattleCommand4b
@@ -3014,7 +3014,7 @@
dec a
jr nz, .asm_350ab ; 350a3 $6
ld hl, EnduredText
- jp FarBattleTextBox
+ jp StdBattleTextBox
.asm_350ab
call GetOpponentItem
@@ -3023,7 +3023,7 @@
call GetItemName
ld hl, HungOnText
- jp FarBattleTextBox
+ jp StdBattleTextBox
.asm_50bb
ld a, BATTLE_VARS_SUBSTATUS4_OPP
@@ -3105,7 +3105,7 @@
ld [hl], a
.asm_3513e
ld hl, CrashedText
- call FarBattleTextBox
+ call StdBattleTextBox
ld a, $1
ld [$c689], a
call Function0x37e36
@@ -3123,7 +3123,7 @@
ld h, d
ld l, e
.asm_35162
- jp FarBattleTextBox
+ jp StdBattleTextBox
; 35165
@@ -3157,7 +3157,7 @@
ld a, [hli]
ld h, [hl]
ld l, a
- call FarBattleTextBox
+ call StdBattleTextBox
xor a
ld [CriticalHit], a
@@ -3211,7 +3211,7 @@
jr nc, .print
ld hl, NotVeryEffectiveText ; 'not very effective'
- jp FarBattleTextBox
+ jp StdBattleTextBox
; 351c0
@@ -3237,7 +3237,7 @@
jr z, .asm_35231
ld hl, TookDownWithItText
- call FarBattleTextBox
+ call StdBattleTextBox
ld a, [hBattleTurn]
and a
@@ -3332,7 +3332,7 @@
call SwitchTurn
ld hl, RageBuildingText
- call FarBattleTextBox
+ call StdBattleTextBox
jp SwitchTurn
; 3527b
@@ -3822,7 +3822,7 @@
ld a, $1
ld [$c72d], a
ld hl, BeatUpAttackText
- call FarBattleTextBox
+ call StdBattleTextBox
ld a, [EnemyMonSpecies]
ld [CurSpecies], a
call $3856
@@ -3923,11 +3923,11 @@
ld [$d265], a
call $343b
ld hl, BeatUpAttackText
- call FarBattleTextBox
+ call StdBattleTextBox
jp EnemyAttackDamage
.asm_3557d
ld hl, BeatUpAttackText
- call FarBattleTextBox
+ call StdBattleTextBox
ld a, [BattleMonSpecies]
ld [CurSpecies], a
call GetBaseData
@@ -4332,7 +4332,7 @@
add b
ld b, a
.asm_3575d
- call FarBattleRNG
+ call BattleRandom
and a
jr z, .asm_3575d ; 35761 $fa
cp b
@@ -4555,7 +4555,7 @@
bit 4, [hl]
jp nz, Function0x35923
set 4, [hl]
- call FarBattleRNG
+ call BattleRandom
and $3
inc a
inc a
@@ -4626,7 +4626,7 @@
call Function0x37e01
ld hl, GotAnEncoreText
- jp FarBattleTextBox
+ jp StdBattleTextBox
; 35923
@@ -4673,7 +4673,7 @@
rst FarCall
ld hl, SharedPainText
- jp FarBattleTextBox
+ jp StdBattleTextBox
.asm_3597d
ld a, [hld]
@@ -4782,7 +4782,7 @@
call SwitchTurn
.asm_35a13
- call FarBattleRNG
+ call BattleRandom
and $1f
cp $a
jr c, .asm_35a24 ; 35a1a $8
@@ -4815,7 +4815,7 @@
ld a, $29
call Predef
ld hl, $5452
- jp FarBattleTextBox
+ jp StdBattleTextBox
.asm_35a50
jp Function0x37354
; 35a53
@@ -4835,7 +4835,7 @@
call Function0x37e01
ld hl, TookAimText
- jp FarBattleTextBox
+ jp StdBattleTextBox
.asm_35a6e
call Function0x37e77
@@ -4938,7 +4938,7 @@
call Function0x37e01
ld hl, SketchedText
- jp FarBattleTextBox
+ jp StdBattleTextBox
.asm_35b10
call Function0x37e77
@@ -5005,7 +5005,7 @@
dec hl
.asm_35b62
push hl
- call FarBattleRNG
+ call BattleRandom
and $3
ld c, a
ld b, $0
@@ -5131,7 +5131,7 @@
set 6, [hl]
call Function0x37e01
ld hl, DestinyBondEffectText
- jp FarBattleTextBox
+ jp StdBattleTextBox
; 35c0f
@@ -5173,7 +5173,7 @@
jr z, .asm_35c91 ; 35c46 $49
push bc
call GetMoveName
- call FarBattleRNG
+ call BattleRandom
and $3
inc a
inc a
@@ -5216,7 +5216,7 @@
ld a, d
ld [$d265], a
ld hl, SpiteEffectText
- jp FarBattleTextBox
+ jp StdBattleTextBox
.asm_35c91
jp PrintDidntAffect2
; 35c94
@@ -5294,7 +5294,7 @@
call Function0x37e01
ld hl, BellChimedText
- call FarBattleTextBox
+ call StdBattleTextBox
ld a, [hBattleTurn]
and a
@@ -5452,7 +5452,7 @@
Function0x35de0: ; 35de0
ld hl, SubTookDamageText
- call FarBattleTextBox
+ call StdBattleTextBox
ld de, $c6e0
ld a, [hBattleTurn]
@@ -5479,7 +5479,7 @@
res 4, [hl]
ld hl, SubFadedText
- call FarBattleTextBox
+ call StdBattleTextBox
call SwitchTurn
call BattleCommanda7
@@ -5576,7 +5576,7 @@
ld b, $3
.asm_35ea4
- call FarBattleRNG
+ call BattleRandom
and b
jr z, .asm_35ea4
cp 7
@@ -5587,7 +5587,7 @@
call RefreshBattleHuds
ld hl, FellAsleepText
- call FarBattleTextBox
+ call StdBattleTextBox
ld a, $f
ld hl, $5de9
@@ -5600,7 +5600,7 @@
push hl
call Function0x37e77
pop hl
- jp FarBattleTextBox
+ jp StdBattleTextBox
; 35ece
@@ -5625,7 +5625,7 @@
bit 5, a
jr nz, .asm_35eec
- call FarBattleRNG
+ call BattleRandom
cp $40
ret c
@@ -5664,7 +5664,7 @@
call RefreshBattleHuds
ld hl, WasPoisonedText
- call FarBattleTextBox
+ call StdBattleTextBox
ld a, $f
ld hl, $5de9
@@ -5715,7 +5715,7 @@
ld a, [PlayerSubStatus5]
bit 5, a
jr nz, .asm_35f89 ; 35f80 $7
- call FarBattleRNG
+ call BattleRandom
cp $40
jr c, .asm_35fb8 ; 35f87 $2f
.asm_35f89
@@ -5729,7 +5729,7 @@
call Function0x35fc0
ld hl, WasPoisonedText
- call FarBattleTextBox
+ call StdBattleTextBox
jr .asm_35fb1 ; 35fa2 $d
.asm_35fa4
@@ -5739,7 +5739,7 @@
call Function0x35fc0
ld hl, BadlyPoisonedText
- call FarBattleTextBox
+ call StdBattleTextBox
.asm_35fb1
ld a, $f
@@ -5751,7 +5751,7 @@
push hl
call Function0x37e77
pop hl
- jp FarBattleTextBox
+ jp StdBattleTextBox
; 35fc0
@@ -5807,7 +5807,7 @@
; draintarget
call Function0x36011
ld hl, SuckedHealthText
- jp FarBattleTextBox
+ jp StdBattleTextBox
; 36008
@@ -5815,7 +5815,7 @@
; eatdream
call Function0x36011
ld hl, DreamEatenText
- jp FarBattleTextBox
+ jp StdBattleTextBox
; 36011
@@ -5938,7 +5938,7 @@
call RefreshBattleHuds
ld hl, WasBurnedText
- call FarBattleTextBox
+ call StdBattleTextBox
ld a, $f
ld hl, $5de9
@@ -5970,7 +5970,7 @@
call UpdateOpponentInParty
ld hl, DefrostedOpponentText
- jp FarBattleTextBox
+ jp StdBattleTextBox
; 36102
@@ -6011,7 +6011,7 @@
call RefreshBattleHuds
ld hl, WasFrozenText
- call FarBattleTextBox
+ call StdBattleTextBox
ld a, $f
ld hl, $5de9
@@ -6375,7 +6375,7 @@
cp EFFECT_ACCURACY_DOWN_HIT
jr z, .DidntMiss
- call FarBattleRNG
+ call BattleRandom
cp $40
jr c, .Failed
@@ -6596,7 +6596,7 @@
inc b
call GetStatName
ld hl, WontRiseAnymoreText
- jp FarBattleTextBox
+ jp StdBattleTextBox
; 3646a
@@ -6612,7 +6612,7 @@
jp z, TryPrintButItFailed
dec a
ld hl, ProtectedByMistText
- jp z, FarBattleTextBox
+ jp z, StdBattleTextBox
ld a, [LoweredStat]
and $f
ld b, a
@@ -6619,7 +6619,7 @@
inc b
call GetStatName
ld hl, WontDropAnymoreText
- jp FarBattleTextBox
+ jp StdBattleTextBox
; 3648f
@@ -6789,7 +6789,7 @@
; 1/3 chance of each status
.loop
- call FarBattleRNG
+ call BattleRandom
swap a
and 3
jr z, .loop
@@ -6972,7 +6972,7 @@
res 0, [hl]
ld hl, UnleashedEnergyText
- call FarBattleTextBox
+ call StdBattleTextBox
ld a, BATTLE_VARS_MOVE_POWER
call GetBattleVarPair
@@ -7018,7 +7018,7 @@
.asm_366dc
ld hl, StoringEnergyText
- call FarBattleTextBox
+ call StdBattleTextBox
jp EndMoveEffect
; 366e5
@@ -7043,7 +7043,7 @@
ld [de], a
ld [PlayerMoveEffect], a
ld [EnemyMoveEffect], a
- call FarBattleRNG
+ call BattleRandom
and $1
inc a
inc a
@@ -7080,7 +7080,7 @@
pop af
jr nz, .asm_3674c ; 3673f $b
set 7, [hl]
- call FarBattleRNG
+ call BattleRandom
and $1
inc a
inc a
@@ -7110,7 +7110,7 @@
ld a, BATTLE_VARS_SUBSTATUS3
call GetBattleVarPair
set 1, [hl]
- call FarBattleRNG
+ call BattleRandom
and $1
inc a
ld [de], a
@@ -7152,7 +7152,7 @@
ld c, a
inc c
.asm_367ac
- call FarBattleRNG
+ call BattleRandom
cp c
jr nc, .asm_367ac ; 367b0 $fa
srl b
@@ -7177,7 +7177,7 @@
ld c, a
inc c
.asm_367d2
- call FarBattleRNG
+ call BattleRandom
cp c
jr nc, .asm_367d2 ; 367d6 $fa
srl b
@@ -7199,7 +7199,7 @@
call Function0x36804
ld hl, FledFromBattleText
- jp FarBattleTextBox
+ jp StdBattleTextBox
; 36804
@@ -7242,7 +7242,7 @@
ld c, a
inc c
.asm_36845
- call FarBattleRNG
+ call BattleRandom
cp c
jr nc, .asm_36845 ; 36849 $fa
srl b
@@ -7282,7 +7282,7 @@
ld a, [CurOTMon]
ld c, a
.asm_3689a
- call FarBattleRNG
+ call BattleRandom
and $7
cp b
jr nc, .asm_3689a ; 368a0 $f8
@@ -7305,7 +7305,7 @@
rst FarCall
ld hl, DraggedOutText
- call FarBattleTextBox
+ call StdBattleTextBox
ld hl, $5c23
jp CallBankF
@@ -7332,7 +7332,7 @@
ld c, a
inc c
.asm_368e6
- call FarBattleRNG
+ call BattleRandom
cp c
jr nc, .asm_368e6
@@ -7378,7 +7378,7 @@
ld a, [CurBattleMon]
ld c, a
.asm_3693a
- call FarBattleRNG
+ call BattleRandom
and $7
cp b
jr nc, .asm_3693a
@@ -7402,7 +7402,7 @@
call CallBankF
ld hl, DraggedOutText
- call FarBattleTextBox
+ call StdBattleTextBox
ld hl, $5c23
jp CallBankF
@@ -7428,7 +7428,7 @@
jr z, .asm_36991
ld hl, BlownAwayText
.asm_36991
- jp FarBattleTextBox
+ jp StdBattleTextBox
; 36994
@@ -7496,7 +7496,7 @@
cp EFFECT_TRIPLE_KICK
jr nz, .asm_36a2b
.asm_369ec
- call FarBattleRNG
+ call BattleRandom
and $3
jr z, .asm_369ec
dec a
@@ -7530,11 +7530,11 @@
call BattleCommanda8
jp EndMoveEffect
.asm_36a2b
- call FarBattleRNG
+ call BattleRandom
and $3
cp $2
jr c, .asm_36a39 ; 36a32 $5
- call FarBattleRNG
+ call BattleRandom
and $3
.asm_36a39
inc a
@@ -7569,7 +7569,7 @@
call CleanGetBattleVarPair
cp EFFECT_BEAT_UP
jr z, .asm_36a67
- call FarBattleTextBox
+ call StdBattleTextBox
.asm_36a67
pop bc
@@ -7670,7 +7670,7 @@
ld d, h
ld e, l
call GetUserItem
- call FarBattleRNG
+ call BattleRandom
cp c
ret nc
call EndRechargeOpp
@@ -7767,7 +7767,7 @@
ld hl, IgnoredOrders2Text
ld a, [AlreadyDisobeyed]
and a
- call nz, FarBattleTextBox
+ call nz, StdBattleTextBox
call BattleCommand0a
xor a
@@ -7917,7 +7917,7 @@
call CleanGetBattleVarPair
bit 4, a
ret nz
- call FarBattleRNG
+ call BattleRandom
and 3
inc a
inc a
@@ -7941,7 +7941,7 @@
ld a, [hli]
ld h, [hl]
ld l, a
- jp FarBattleTextBox
+ jp StdBattleTextBox
.Traps
dbw BIND, UsedBindText ; 'used BIND on'
@@ -7962,7 +7962,7 @@
set 1, [hl]
call Function0x37e01
ld hl, MistText
- jp FarBattleTextBox
+ jp StdBattleTextBox
.asm_36c92
call Function0x37e77
jp PrintButItFailed
@@ -7979,7 +7979,7 @@
set 2, [hl]
call Function0x37e01
ld hl, GettingPumpedText
- jp FarBattleTextBox
+ jp StdBattleTextBox
.asm_36cac
call Function0x37e77
jp PrintButItFailed
@@ -8048,7 +8048,7 @@
call Predef
call RefreshBattleHuds
ld hl, RecoilText
- jp FarBattleTextBox
+ jp StdBattleTextBox
; 36d1d
@@ -8085,7 +8085,7 @@
call GetItemName
call Function0x37e77
ld hl, ProtectedByText
- jp FarBattleTextBox
+ jp StdBattleTextBox
.asm_36d53
ld a, BATTLE_VARS_SUBSTATUS3_OPP
@@ -8094,7 +8094,7 @@
jr z, .asm_36d65
call Function0x37e77
ld hl, AlreadyConfusedText
- jp FarBattleTextBox
+ jp StdBattleTextBox
.asm_36d65
call CheckSubstituteOpp
@@ -8116,7 +8116,7 @@
.asm_36d7b
set 7, [hl]
- call FarBattleRNG
+ call BattleRandom
and 3
inc a
inc a
@@ -8137,7 +8137,7 @@
call Function0x37e54
ld hl, BecameConfusedText
- call FarBattleTextBox
+ call StdBattleTextBox
call GetOpponentItem
ld a, b
@@ -8182,7 +8182,7 @@
call GetItemName
call Function0x37e77
ld hl, ProtectedByText
- jp FarBattleTextBox
+ jp StdBattleTextBox
.asm_36def
ld a, [hBattleTurn]
and a
@@ -8196,7 +8196,7 @@
ld a, [PlayerSubStatus5]
bit 5, a
jr nz, .asm_36e0e ; 36e05 $7
- call FarBattleRNG
+ call BattleRandom
cp $40
jr c, .asm_36e52 ; 36e0c $44
.asm_36e0e
@@ -8227,7 +8227,7 @@
.asm_36e49
call Function0x37e77
ld hl, AlreadyParalyzedText
- jp FarBattleTextBox
+ jp StdBattleTextBox
.asm_36e52
jp PrintDidntAffect2
.asm_36e55
@@ -8338,7 +8338,7 @@
call BattleCommanda6
.asm_36eeb
ld hl, MadeSubstituteText
- call FarBattleTextBox
+ call StdBattleTextBox
jp RefreshBattleHuds
.asm_36ef4
call Function0x34548
@@ -8350,7 +8350,7 @@
call nz, BattleCommand0c
ld hl, TooWeakSubText
.asm_36f08
- jp FarBattleTextBox
+ jp StdBattleTextBox
; 36f0b
BattleCommand32: ; 36f0b
@@ -8463,7 +8463,7 @@
call GetMoveName
call Function0x37e01
ld hl, LearnedMoveText
- jp FarBattleTextBox
+ jp StdBattleTextBox
.asm_36f9a
jp Function0x37357
; 36f9d
@@ -8496,7 +8496,7 @@
set 7, [hl]
call Function0x37e01
ld hl, WasSeededText
- jp FarBattleTextBox
+ jp StdBattleTextBox
.asm_36fd2
call Function0x37e77
jp PrintDoesntAffect
@@ -8503,7 +8503,7 @@
.asm_36fd8
call Function0x37e77
ld hl, EvadedText
- jp FarBattleTextBox
+ jp StdBattleTextBox
; 36fe1
@@ -8558,7 +8558,7 @@
and a
jr z, .asm_37059 ; 3702c $2b
.asm_3702e
- call FarBattleRNG
+ call BattleRandom
and $7
jr z, .asm_3702e ; 37033 $f9
inc a
@@ -8579,7 +8579,7 @@
ld [$d265], a
call GetMoveName
ld hl, WasDisabledText
- jp FarBattleTextBox
+ jp StdBattleTextBox
.asm_37059
jp Function0x37354
; 3705c
@@ -8608,7 +8608,7 @@
inc [hl]
.asm_37079
ld hl, CoinsScatteredText
- jp FarBattleTextBox
+ jp StdBattleTextBox
; 3707f
@@ -8677,7 +8677,7 @@
call Function0x37e77
jp PrintButItFailed
.asm_370d9
- call FarBattleRNG
+ call BattleRandom
and $3
ld c, a
ld b, $0
@@ -8706,7 +8706,7 @@
rst FarCall
call Function0x37e01
ld hl, TransformedTypeText
- jp FarBattleTextBox
+ jp StdBattleTextBox
; 3710e
@@ -8733,7 +8733,7 @@
call Function0x37e01
ld hl, EliminatedStatsText
- jp FarBattleTextBox
+ jp StdBattleTextBox
.Fill
ld b, PlayerStatLevelsEnd - PlayerStatLevels
@@ -8787,7 +8787,7 @@
jr z, .asm_37186 ; 37181 $3
ld hl, RestedText
.asm_37186
- call FarBattleTextBox
+ call StdBattleTextBox
ld a, [hBattleTurn]
and a
jr nz, .asm_37193 ; 3718c $5
@@ -8816,12 +8816,12 @@
call UpdateUserInParty
call RefreshBattleHuds
ld hl, RegainedHealthText
- jp FarBattleTextBox
+ jp StdBattleTextBox
.asm_371c4
call Function0x37e77
ld hl, HPIsFullText
- jp FarBattleTextBox
+ jp StdBattleTextBox
; 371cd
@@ -8958,7 +8958,7 @@
ld a, $a4
call nz, Function0x37e44
ld hl, TransformedText
- jp FarBattleTextBox
+ jp StdBattleTextBox
; 372c6
@@ -9056,7 +9056,7 @@
.asm_37331
call Function0x37e01
- jp FarBattleTextBox
+ jp StdBattleTextBox
.asm_37337
call Function0x37e77
@@ -9067,7 +9067,7 @@
PrintDoesntAffect: ; 3733d
; 'it doesn't affect'
ld hl, DoesntAffectText
- jp FarBattleTextBox
+ jp StdBattleTextBox
; 37343
@@ -9074,7 +9074,7 @@
PrintNothingHappened: ; 37343
; 'but nothing happened!'
ld hl, NothingHappenedText
- jp FarBattleTextBox
+ jp StdBattleTextBox
; 37349
@@ -9090,7 +9090,7 @@
PrintButItFailed: ; 3734e
; 'but it failed!'
ld hl, ButItFailedText
- jp FarBattleTextBox
+ jp StdBattleTextBox
; 37354
@@ -9109,7 +9109,7 @@
PrintDidntAffect: ; 37360
; 'it didn't affect'
ld hl, DidntAffect1Text
- jp FarBattleTextBox
+ jp StdBattleTextBox
; 37366
@@ -9124,7 +9124,7 @@
PrintParalyze: ; 37372
; 'paralyzed! maybe it can't attack!'
ld hl, ParalyzedText
- jp FarBattleTextBox
+ jp StdBattleTextBox
; 37378
@@ -9189,7 +9189,7 @@
.asm_373de
call Function0x37e77
ld hl, MirrorMoveFailedText
- call FarBattleTextBox
+ call StdBattleTextBox
jp EndMoveEffect
.asm_373ea
ld a, b
@@ -9235,7 +9235,7 @@
call Function0x37e36
.GetMove
- call FarBattleRNG
+ call BattleRandom
; No invalid moves.
cp BEAT_UP + 1
@@ -9391,7 +9391,7 @@
.asm_374f8
call GetItemName
ld hl, StoleText
- jp FarBattleTextBox
+ jp StdBattleTextBox
.asm_37501
ld a, 1
@@ -9422,7 +9422,7 @@
set 7, [hl]
call Function0x37e01
ld hl, CantEscapeNowText
- jp FarBattleTextBox
+ jp StdBattleTextBox
.asm_37530
call Function0x37e77
jp PrintButItFailed
@@ -9447,7 +9447,7 @@
set 0, [hl]
call Function0x37e01
ld hl, StartedNightmareText
- jp FarBattleTextBox
+ jp StdBattleTextBox
.asm_3755d
call Function0x37e77
jp PrintButItFailed
@@ -9475,7 +9475,7 @@
.asm_3757f
call RefreshBattleHuds
ld hl, WasDefrostedText
- jp FarBattleTextBox
+ jp StdBattleTextBox
; 37588
@@ -9536,7 +9536,7 @@
call CallBankF
call UpdateUserInParty
ld hl, PutACurseText
- jp FarBattleTextBox
+ jp StdBattleTextBox
.asm_37604
call Function0x37e77
jp PrintButItFailed
@@ -9545,7 +9545,7 @@
call GetStatName
call Function0x37e77
ld hl, WontRiseAnymoreText
- jp FarBattleTextBox
+ jp StdBattleTextBox
; 37618
@@ -9559,7 +9559,7 @@
set 2, [hl]
call Function0x37e01
ld hl, ProtectedItselfText
- jp FarBattleTextBox
+ jp StdBattleTextBox
; 3762c
@@ -9596,7 +9596,7 @@
jr .asm_37665
.asm_37656
- call FarBattleRNG
+ call BattleRandom
and a
jr z, .asm_37656
@@ -9631,7 +9631,7 @@
set SUBSTATUS_ENDURE, [hl]
call Function0x37e01
ld hl, BracedItselfText
- jp FarBattleTextBox
+ jp StdBattleTextBox
; 37683
@@ -9651,7 +9651,7 @@
set 0, [hl]
call Function0x37e01
ld hl, SpikesText
- jp FarBattleTextBox
+ jp StdBattleTextBox
.failed
jp Function0x37354
@@ -9673,7 +9673,7 @@
set SUBSTATUS_IDENTIFIED, [hl]
call Function0x37e01
ld hl, IdentifiedText
- jp FarBattleTextBox
+ jp StdBattleTextBox
.asm_376bf
jp Function0x37354
; 376c2
@@ -9706,7 +9706,7 @@
.asm_376e9
call Function0x37e01
ld hl, StartPerishText
- jp FarBattleTextBox
+ jp StdBattleTextBox
.asm_376f2
call Function0x37e77
jp PrintButItFailed
@@ -9725,7 +9725,7 @@
ld [WeatherCount], a
call Function0x37e01
ld hl, SandstormBrewedText
- jp FarBattleTextBox
+ jp StdBattleTextBox
.asm_37712
call Function0x37e77
jp PrintButItFailed
@@ -9911,7 +9911,7 @@
; 'fell in love!'
ld hl, FellInLoveText
- jp FarBattleTextBox
+ jp StdBattleTextBox
.asm_377f2
jp Function0x37354
@@ -10029,7 +10029,7 @@
and a
jp nz, Function0x37e77
push bc
- call FarBattleRNG
+ call BattleRandom
ld b, a
ld hl, .table_37907
ld c, 0
@@ -10071,7 +10071,7 @@
call CallBankF
call SwitchTurn
ld hl, RegainedHealthText
- call FarBattleTextBox
+ call StdBattleTextBox
call SwitchTurn
call UpdateOpponentInParty
jr .asm_37904 ; 378f1 $11
@@ -10081,7 +10081,7 @@
jr nc, .asm_37904 ; 378f9 $9
call Function0x37e77
ld hl, RefusedGiftText
- call FarBattleTextBox
+ call StdBattleTextBox
.asm_37904
jp EndMoveEffect
@@ -10141,7 +10141,7 @@
ld [de], a
call Function0x37e01
ld hl, CoveredByVeilText
- jp FarBattleTextBox
+ jp StdBattleTextBox
.asm_3795c
call Function0x37e77
jp PrintButItFailed
@@ -10177,7 +10177,7 @@
ld [AttackMissed], a
call BattleCommandaa
ld hl, SafeguardProtectText
- call FarBattleTextBox
+ call StdBattleTextBox
jp EndMoveEffect
; 37991
@@ -10186,7 +10186,7 @@
; getmagnitude
push bc
- call FarBattleRNG
+ call BattleRandom
ld b, a
ld hl, .Magnitudes
.asm_37999
@@ -10204,7 +10204,7 @@
ld [$d265], a
call BattleCommandaa
ld hl, MagnitudeText
- call FarBattleTextBox
+ call StdBattleTextBox
pop de
pop bc
ret
@@ -10485,7 +10485,7 @@
jr z, .asm_37b4a ; 37b40 $8
res 7, [hl]
ld hl, ShedLeechSeedText
- call FarBattleTextBox
+ call StdBattleTextBox
.asm_37b4a
ld hl, PlayerScreens
ld de, $c730
@@ -10500,7 +10500,7 @@
res 0, [hl]
ld hl, BlewSpikesText
push de
- call FarBattleTextBox
+ call StdBattleTextBox
pop de
.asm_37b69
ld a, [de]
@@ -10509,7 +10509,7 @@
xor a
ld [de], a
ld hl, ReleasedByText
- jp FarBattleTextBox
+ jp StdBattleTextBox
; 37b74
@@ -10600,7 +10600,7 @@
; 'regained health!'
ld hl, RegainedHealthText
- jp FarBattleTextBox
+ jp StdBattleTextBox
.Full
call Function0x37e77
@@ -10607,7 +10607,7 @@
; 'hp is full!'
ld hl, HPIsFullText
- jp FarBattleTextBox
+ jp StdBattleTextBox
.Multipliers
dw GetEighthMaxHP
@@ -10636,7 +10636,7 @@
ld [WeatherCount], a
call Function0x37e01
ld hl, DownpourText
- jp FarBattleTextBox
+ jp StdBattleTextBox
; 37c07
@@ -10648,7 +10648,7 @@
ld [WeatherCount], a
call Function0x37e01
ld hl, SunGotBrightText
- jp FarBattleTextBox
+ jp StdBattleTextBox
; 37c1a
@@ -10685,7 +10685,7 @@
jr nz, .asm_37c41 ; 37c47 $f8
ld hl, BellyDrumText
- jp FarBattleTextBox
+ jp StdBattleTextBox
.asm_37c4f
call Function0x37e77
jp PrintButItFailed
@@ -10735,7 +10735,7 @@
.asm_37c8c
call Function0x37e01
ld hl, CopiedStatsText
- jp FarBattleTextBox
+ jp StdBattleTextBox
; 37c95
@@ -10884,7 +10884,7 @@
call BattleCommand0a
call BattleCommandaa
ld hl, ForesawAttackText
- call FarBattleTextBox
+ call StdBattleTextBox
call BattleCommand0c
ld de, $c727
ld a, [hBattleTurn]
--- a/constants/pokemon_constants.asm
+++ b/constants/pokemon_constants.asm
@@ -1,3 +1,5 @@
+NUM_POKEMON EQU 251
+
BULBASAUR EQU 1
IVYSAUR EQU 2
VENUSAUR EQU 3
--- a/engine/scripting.asm
+++ b/engine/scripting.asm
@@ -1988,7 +1988,7 @@
ld b, a
.asm_97653
push bc
- call RNG
+ call Random
pop bc
ld a, [$ffe1]
cp b
@@ -1996,7 +1996,7 @@
jr .asm_97666 ; 0x9765d $7
.asm_9765f
push bc
- call RNG
+ call Random
pop bc
ld a, [$ffe1]
.asm_97666
@@ -2217,7 +2217,7 @@
call Unknown_0x97771
ld hl, StringBuffer1
- ld de, $d855
+ ld de, Coins
ld bc, $4206
call PrintNum
ld de, StringBuffer1
@@ -2363,7 +2363,7 @@
call GetScriptByte
ld [$d106], a
ld hl, $d892
- call Function2f79
+ call PickUpItem
ret nc
ld a, $1
ld [$c2dd], a
--- a/items/item_effects.asm
+++ b/items/item_effects.asm
@@ -166,7 +166,7 @@
.asm_e98e
ld b, a
ld [MagikarpLength], a
- call RNG
+ call Random
cp b
ld a, $0
@@ -1212,7 +1212,7 @@
call $7789
ld hl, $4d81
- call FarBattleTextBox
+ call StdBattleTextBox
ld a, $0
--- a/main.asm
+++ b/main.asm
@@ -1574,9 +1574,7 @@
ret
Function1c10: ; 0x1c10
- ld hl, $446d
- ld a, $9
- rst $8
+ callab Function2446d
ret
Function1c17: ; 0x1c17
@@ -4630,9 +4628,7 @@
call Function3200
ld b, $9
call GetSGBLayout
- ld a, $12
- ld hl, $5409
- rst $8
+ callba Function49409
call Function485
call DelayFrame
ld a, $1
@@ -5553,20 +5549,20 @@
ret
; 2f79
-Function2f79: ; 2f79
+PickUpItem: ; 2f79
push hl
push de
push bc
ld a, [hROMBank]
push af
- ld a, BANK(Functiond244)
+ ld a, BANK(_PickUpItem)
rst Bankswitch
- call Functiond244
+ call _PickUpItem
+
pop bc
ld a, b
rst Bankswitch
-
pop bc
pop de
pop hl
@@ -5574,50 +5570,50 @@
; 2f8c
-RNG: ; 2f8c
+Random: ; 2f8c
+; A simple hardware-based random number generator (RNG).
+
; Two random numbers are generated by adding and subtracting
; the divider to the respective values every time it's called.
-; The divider is a value that increments at a rate of 16384Hz.
+; The divider is a register that increments at a rate of 16384Hz.
; For comparison, the Game Boy operates at a clock speed of 4.2MHz.
-; Additionally, an equivalent function is called every frame.
+; Additionally, an equivalent function is executed in VBlank.
-; output:
-; a: rand2
-; ffe1: rand1
-; ffe2: rand2
+; This leaves a with the value in hRandomSub.
push bc
-; Added value
+
ld a, [rDIV]
ld b, a
ld a, [hRandomAdd]
adc b
ld [hRandomAdd], a
-; Subtracted value
+
ld a, [rDIV]
ld b, a
ld a, [hRandomSub]
sbc b
ld [hRandomSub], a
+
pop bc
ret
; 2f9f
-FarBattleRNG: ; 2f9f
-; BattleRNG lives in another bank.
-; It handles all RNG calls in the battle engine,
-; allowing link battles to remain in sync using a shared PRNG.
+BattleRandom: ; 2f9f
+; _BattleRandom lives in another bank.
-; Save bank
- ld a, [hROMBank] ; bank
+; It handles all RNG calls in the battle engine, allowing
+; link battles to remain in sync using a shared PRNG.
+
+ ld a, [hROMBank]
push af
-; Bankswitch
- ld a, BANK(BattleRNG)
+ ld a, BANK(_BattleRandom)
rst Bankswitch
- call BattleRNG
-; Restore bank
+
+ call _BattleRandom
+
ld [$cfb6], a
pop af
rst Bankswitch
@@ -5638,7 +5634,7 @@
ld b, a
push bc
.asm_2fbb
- call RNG
+ call Random
ld a, [hRandomAdd]
ld c, a
add b
@@ -7378,19 +7374,20 @@
-Function3741: ; 3741
+IsAPokemon: ; 3741
+; Return carry if species a is not a Pokemon.
and a
- jr z, .asm_374c
- cp $fd
- jr z, .asm_374e
- cp $fc
- jr c, .asm_374e
+ jr z, .NotAPokemon
+ cp EGG
+ jr z, .Pokemon
+ cp NUM_POKEMON + 1
+ jr c, .Pokemon
-.asm_374c
+.NotAPokemon
scf
ret
-.asm_374e
+.Pokemon
and a
ret
; 3750
@@ -7464,7 +7461,7 @@
Function378b: ; 378b
ld a, [CurPartySpecies]
- call Function3741
+ call IsAPokemon
jr c, .asm_37ad
push hl
ld de, VTiles2
@@ -8181,11 +8178,12 @@
BattleTextBox: ; 3ac3
+; Open a textbox and print text at hl.
push hl
call SpeechTextBox
call MobileTextBorder
- call Function1ad2 ; UpdateSprites
- call Function321c ; refresh?
+ call Function1ad2
+ call Function321c
pop hl
call PrintTextBoxText
ret
@@ -8192,13 +8190,13 @@
; 3ad5
-FarBattleTextBox: ; 3ad5
-; Open a textbox and print text at 20:hl.
+StdBattleTextBox: ; 3ad5
+; Open a textbox and print battle text at 20:hl.
ld a, [hROMBank]
push af
- ld a, $20
+ ld a, BANK(BattleText)
rst Bankswitch
call BattleTextBox
@@ -10419,7 +10417,7 @@
; 4822
Function4822: ; 4822
- call RNG
+ call Random
ld a, [hRandomAdd]
and 1
jp Function4af0
@@ -10426,7 +10424,7 @@
; 482c
Function482c: ; 482c
- call RNG
+ call Random
ld a, [hRandomAdd]
and 1
or 2
@@ -10434,7 +10432,7 @@
; 4838
Function4838: ; 4838
- call RNG
+ call Random
ld a, [hRandomAdd]
and 3
jp Function4af0
@@ -10441,7 +10439,7 @@
; 4842
Function4842: ; 4842
- call RNG
+ call Random
ld a, [hRandomAdd]
and $c
ld hl, $0008
@@ -10456,7 +10454,7 @@
ld a, [hl]
and $c
ld d, a
- call RNG
+ call Random
ld a, [hRandomAdd]
and $c
cp d
@@ -10959,7 +10957,7 @@
; 4b1d
Function4b1d: ; 4b1d
- call RNG
+ call Random
ld a, [hRandomAdd]
and $7f
jr Function4b2d
@@ -10966,7 +10964,7 @@
; 4b26
Function4b26: ; 4b26
- call RNG
+ call Random
ld a, [hRandomAdd]
and $1f
; fallthrough
@@ -13251,10 +13249,10 @@
ld a, [hRandomAdd]
ld [PlayerID + 1], a
- call RNG
+ call Random
ld [$d84a], a
call DelayFrame
- call RNG
+ call Random
ld [$d84b], a
ld hl, PartyCount
@@ -13314,8 +13312,8 @@
ld [JohtoBadges], a
ld [KantoBadges], a
- ld [$d855], a
- ld [$d856], a
+ ld [Coins], a
+ ld [Coins + 1], a
ld [Money], a
ld a, 3000 >> 8
@@ -13463,9 +13461,9 @@
jr z, .asm_5d55
ld a, b
ld [$ac68], a
- call RNG
+ call Random
ld c, a
- call RNG
+ call Random
.asm_5d55
ld [$dc9f], a
@@ -13996,9 +13994,11 @@
; 610f
Function610f: ; 610f
+
ld a, [hROMBank]
push af
- ld a, $20
+
+ ld a, 0 << 7 | 32 ; fade out
ld [MusicFade], a
ld de, MUSIC_NONE
ld a, e
@@ -14005,33 +14005,43 @@
ld [MusicFadeIDLo], a
ld a, d
ld [MusicFadeIDHi], a
+
ld de, SFX_ESCAPE_ROPE
call StartSFX
pop af
rst Bankswitch
- ld c, $8
+ ld c, 8
call DelayFrames
+
ld hl, $5249
ld b, $13
call Function61b4
- ld c, $8
+
+ ld c, 8
call DelayFrames
+
ld hl, $52d9
ld b, $13
call Function61b4
- ld c, $8
+
+ ld c, 8
call DelayFrames
+
ld hl, $c50a
- ld b, $7
- ld c, $7
+ ld b, 7
+ ld c, 7
call ClearBox
- ld c, $3
+
+ ld c, 3
call DelayFrames
+
call Function61cd
call Functione5f
- ld c, $32
+
+ ld c, 50
call DelayFrames
+
call Function4b6
call ClearTileMap
ret
@@ -14039,11 +14049,11 @@
Function616a: ; 616a
ld hl, IntroFadePalettes
- ld b, $6
+ ld b, IntroFadePalettesEnd - IntroFadePalettes
.asm_616f
ld a, [hli]
call DmgToCgbBGPals
- ld c, $a
+ ld c, 10
call DelayFrames
dec b
jr nz, .asm_616f
@@ -14057,6 +14067,7 @@
db %11111000
db %11110100
db %11100100
+IntroFadePalettesEnd
; 6182
Function6182: ; 6182
@@ -14102,14 +14113,17 @@
; 61cd
Function61cd: ; 61cd
+
callba GetPlayerIcon
ld c, $c
ld hl, VTiles0
call Request2bpp
+
ld hl, Sprites
ld de, .data_61fe
ld a, [de]
inc de
+
ld c, a
.asm_61e4
ld a, [de]
@@ -14121,14 +14135,15 @@
ld a, [de]
inc de
ld [hli], a
- ld b, $0
+
+ ld b, 0
ld a, [PlayerGender]
bit 0, a
jr z, .asm_61f8
- ld b, $1
-
+ ld b, 1
.asm_61f8
ld a, b
+
ld [hli], a
dec c
jr nz, .asm_61e4
@@ -14158,7 +14173,7 @@
push af
ld a, $5
ld [rSVBK], a
- call FarStartTitleScreen
+ call TitleScreen
call DelayFrame
.asm_6226
call Function627b
@@ -14186,7 +14201,6 @@
cp $5
jr c, .asm_625e
xor a
-
.asm_625e
ld e, a
ld d, 0
@@ -14208,8 +14222,8 @@
; 6274
-FarStartTitleScreen: ; 6274
- callba StartTitleScreen
+TitleScreen: ; 6274
+ callba _TitleScreen
ret
; 627b
@@ -15950,7 +15964,7 @@
dec [hl]
ret nz
- call RNG
+ call Random
ld [hl], a
ld hl, $6e1d
ld a, $5
@@ -15970,7 +15984,7 @@
ld b, $a
.asm_72f8
- call RNG
+ call Random
cp b
ret nc
ld hl, DaycareMan
@@ -16167,7 +16181,7 @@
call GetCurNick
call Function746e
pop hl
- call RNG
+ call Random
.next
sub [hl]
jr c, .asm_7444
@@ -19499,7 +19513,7 @@
ld a, [Buffer2]
cp $2
jr nz, .asm_cbf7
- ld hl, $4c35
+ ld hl, UnknownScript_0xcc35
call Function31cd
ld a, $81
ret
@@ -20262,7 +20276,7 @@
jp Functiond2ff
; d244
-Functiond244: ; d244
+_PickUpItem: ; d244
call Functiond27b
jr nz, .asm_d278
push hl
@@ -20982,9 +20996,9 @@
ld a, [IsInBattle]
and a
jr nz, .asm_d9f3
- call RNG
+ call Random
ld b, a
- call RNG
+ call Random
ld c, a
.asm_d9b5
@@ -22011,9 +22025,9 @@
call GetFarByte
ld b, a
ld hl, $ad2c
- call RNG
+ call Random
ld [hli], a
- call RNG
+ call Random
ld [hl], a
call CloseSRAM
ld a, $13
@@ -23576,9 +23590,7 @@
call .DrawBugContestStatusBox
call Function2e31
call Function2e20
- ld a, $1
- ld hl, $64bf
- rst $8
+ callba Function64bf
call .DrawBugContestStatus
call Function485
jr .Select
@@ -24918,7 +24930,7 @@
Function12fba: ; 12fba
ld a, [CurPartySpecies]
- cp $fd
+ cp EGG
jr z, .asm_12fd2
ld hl, Options
ld a, [hl]
@@ -25031,13 +25043,13 @@
inc a
ld [CurPartyMon], a
ld c, a
- ld b, $0
+ ld b, 0
ld hl, PartySpecies
add hl, bc
ld a, [hl]
cp $ff
jr z, .asm_130a7
- cp $fd
+ cp EGG
ret nz
jr .asm_1308f
@@ -25050,11 +25062,11 @@
dec a
ld [CurPartyMon], a
ld c, a
- ld b, $0
+ ld b, 0
ld hl, PartySpecies
add hl, bc
ld a, [hl]
- cp $fd
+ cp EGG
ret nz
ld a, [CurPartyMon]
and a
@@ -25308,7 +25320,7 @@
ret z
ld c, a
ld e, a
- ld d, $0
+ ld d, 0
ld hl, PartyCount
add hl, de
.asm_132e7
@@ -25315,9 +25327,9 @@
ld a, [hl]
and a
jr z, .asm_132f3
- cp $fd
+ cp EGG
jr z, .asm_132f3
- cp $fc
+ cp NUM_POKEMON + 1
jr c, .asm_132f8
.asm_132f3
@@ -25340,7 +25352,7 @@
cp c
ret z
ld e, c
- ld d, $0
+ ld d, 0
ld hl, PartySpecies
add hl, de
.asm_1330f
@@ -25349,9 +25361,9 @@
ret z
and a
jr z, .asm_1331e
- cp $fd
+ cp EGG
jr z, .asm_1331e
- cp $fc
+ cp NUM_POKEMON + 1
jr c, .asm_13321
.asm_1331e
@@ -25359,8 +25371,8 @@
jr .asm_1330f
.asm_13321
- ld hl, $c4b2
- ld [hl], $ed
+ hlcoord 18, 0
+ ld [hl], "▶"
ret
; 13327
@@ -28453,9 +28465,7 @@
.askquantity
ld hl, .HowManyText
call Function1d4f
- ld a, $9
- ld hl, $4fbf
- rst $8
+ callba Function24fbf
call Function1c07
call Function1c07
jr c, .done
@@ -28550,20 +28560,14 @@
jr c, .asm_158b6
call Function2ed3
call Function1d6e
- ld a, $4
- ld hl, $46a5
- rst $8
+ callba Function106a5
.asm_1589c
- ld a, $4
- ld hl, $46be
- rst $8
+ callba Function106be
ld a, [$cf66]
and a
jr z, .asm_158b3
call Function158cc
- ld a, $4
- ld hl, CheckRegisteredItem
- rst $8
+ callba CheckRegisteredItem
jr .asm_1589c
.asm_158b3
@@ -28595,9 +28599,7 @@
push af
ld a, $0
ld [$c2ce], a
- ld a, $3
- ld hl, $5453
- rst $8
+ callba CheckItemMenu
ld a, [$d142]
ld hl, JumpTable158e7
rst JumpTable
@@ -28631,9 +28633,7 @@
; 0x1590a
Function1590a: ; 0x1590a
- ld a, $3
- ld hl, $5427
- rst $8
+ callba _CheckTossableItem
ld a, [$d142]
and a
jr z, .asm_1591d
@@ -28644,9 +28644,7 @@
.asm_1591d
ld hl, .HowManyText
call Function1d4f
- ld a, $9
- ld hl, $4fbf
- rst $8
+ callba Function24fbf
push af
call Function1c07
call Function1c07
@@ -28698,9 +28696,7 @@
KrisMailBoxMenu: ; 0x1597d
- ld a, $11
- ld hl, $47a0
- rst $8
+ callba _KrisMailBoxMenu
xor a
ret
; 0x15985
@@ -29656,7 +29652,7 @@
Function1606f: ; 1606f
ld a, $2
- ld de, $d855
+ ld de, Coins
call $6055
ld a, $2
ld bc, $608d
@@ -29681,7 +29677,7 @@
Function1608f: ; 1608f
ld a, $2
- ld de, $d855
+ ld de, Coins
call $6037
jr nc, .asm_1609f
xor a
@@ -29698,7 +29694,7 @@
Function160a1: ; 160a1
ld a, $2
- ld de, $d855
+ ld de, Coins
jp $600d
; 160a9
@@ -32087,7 +32083,7 @@
ld hl, $c4c5
ld de, String24b8e
call PlaceString
- ld de, $d855
+ ld de, Coins
ld bc, $0204
ld hl, $c4c1
call PrintNum
@@ -32110,7 +32106,7 @@
ld de, CoinString
call PlaceString
ld hl, $c4eb
- ld de, $d855
+ ld de, Coins
ld bc, $0204
call PrintNum
ret
@@ -32240,7 +32236,7 @@
push hl
ld [CurItem], a
ld hl, NumItems
- call Function2f79
+ call PickUpItem
pop hl
jr nc, .asm_24c89
ld a, [hl]
@@ -33730,7 +33726,7 @@
call Function2a111
call Function2a124
call Function2a138
- call RNG
+ call Random
cp b
ret
; 2a111
@@ -33809,7 +33805,7 @@
.asm_2a174
push hl
.asm_2a175
- call RNG
+ call Random
cp 100
jr nc, .asm_2a175
inc a
@@ -33833,7 +33829,7 @@
call Function1852
jr nz, .asm_2a1aa
- call RNG
+ call Random
cp 89
jr c, .asm_2a1aa
inc b
@@ -34078,7 +34074,7 @@
call Function1852
jr z, .asm_2a30a
call Function2a27f
- call RNG
+ call Random
cp 100
jr nc, .asm_2a30a
and 3
@@ -34187,7 +34183,7 @@
.asm_2a36e
ld h, d
ld l, e
- call RNG
+ call Random
and $1f
jr z, .asm_2a3cd
and $3
@@ -34248,7 +34244,7 @@
.asm_2a3cd
ld hl, $640f
.asm_2a3d0
- call RNG
+ call Random
and $f
cp $10
jr nc, .asm_2a3d0
@@ -34882,7 +34878,7 @@
callba PartyMenuSelect
push af
ld a, [CurPartySpecies]
- cp $fd
+ cp EGG
pop bc
jr z, .asm_2c854
push bc
@@ -34949,7 +34945,7 @@
ld hl, StatusFlags2
bit 6, [hl]
ret z
- call RNG
+ call Random
ld a, [hRandomAdd]
and a
ret nz
@@ -34959,7 +34955,7 @@
ld a, [PartyCount]
ld b, a
.asm_2ed70
- call RNG
+ call Random
and $7
cp b
jr nc, .asm_2ed70
@@ -34969,7 +34965,7 @@
and $f0
ret nz
.asm_2ed82
- call RNG
+ call Random
and a
jr z, .asm_2ed82
ld b, a
@@ -34989,7 +34985,7 @@
ret
.asm_2ed9a
- call RNG
+ call Random
cp $55
ret nc
ld a, [PartyCount]
@@ -34999,7 +34995,7 @@
ld a, b
cp $2
jr c, .asm_2edc3
- call RNG
+ call Random
cp $80
jr c, .asm_2edc3
.asm_2edb3
@@ -35052,7 +35048,7 @@
ld hl, StatusFlags2
bit 6, [hl]
ret z
- call RNG
+ call Random
cp $10
ret nc
ld hl, PartyMons
@@ -35510,7 +35506,7 @@
jp z, Function38041
cp $10
jr nz, .asm_38061
- call RNG
+ call Random
cp $80
jr c, .asm_38077
jp Function38041
@@ -35518,13 +35514,13 @@
.asm_38061
cp $20
jr nz, .asm_3806f
- call RNG
+ call Random
cp $c8
jr c, .asm_38077
jp Function38041
.asm_3806f
- call RNG
+ call Random
cp $a
jp c, Function38041
@@ -35543,7 +35539,7 @@
jp z, Function38041
cp $10
jr nz, .asm_3809f
- call RNG
+ call Random
cp $14
jr c, .asm_380b5
jp Function38041
@@ -35551,13 +35547,13 @@
.asm_3809f
cp $20
jr nz, .asm_380ad
- call RNG
+ call Random
cp $1e
jr c, .asm_380b5
jp Function38041
.asm_380ad
- call RNG
+ call Random
cp $c8
jp c, Function38041
@@ -35576,7 +35572,7 @@
jp z, Function38041
cp $10
jr nz, .asm_380dd
- call RNG
+ call Random
cp $32
jr c, .asm_380f3
jp Function38041
@@ -35584,13 +35580,13 @@
.asm_380dd
cp $20
jr nz, .asm_380eb
- call RNG
+ call Random
cp $80
jr c, .asm_380f3
jp Function38041
.asm_380eb
- call RNG
+ call Random
cp $32
jp c, Function38041
@@ -36366,7 +36362,7 @@
ld hl, $5863
.asm_3c115
- call FarBattleTextBox
+ call StdBattleTextBox
.asm_3c118
call Function3ceec
@@ -36629,7 +36625,7 @@
ld [hl], a
call GetItemName
ld hl, $4bde
- call FarBattleTextBox
+ call StdBattleTextBox
callab BattleCommand8c
pop af
bit 7, a
@@ -36640,7 +36636,7 @@
call Function3ee0f
call Function3c8e4
ld hl, $4d97
- jp FarBattleTextBox
+ jp StdBattleTextBox
; 3c300
Function3c300: ; 3c300
@@ -36678,13 +36674,13 @@
ld a, [$ffcb]
cp $2
jr z, .asm_3c341
- call FarBattleRNG
+ call BattleRandom
cp $80
jp c, $43f1
jp Function3c3f3
.asm_3c341
- call FarBattleRNG
+ call BattleRandom
cp $80
jp c, Function3c3f3
jp $43f1
@@ -36716,7 +36712,7 @@
ld a, b
cp $4a
jr z, .asm_3c39f
- call FarBattleRNG
+ call BattleRandom
cp e
jr nc, .asm_3c3c5
jp $43f1
@@ -36725,7 +36721,7 @@
ld a, b
cp $4a
jr nz, .asm_3c3c5
- call FarBattleRNG
+ call BattleRandom
cp c
jr nc, .asm_3c3c5
jp Function3c3f3
@@ -36734,19 +36730,19 @@
ld a, [$ffcb]
cp $2
jr z, .asm_3c3b5
- call FarBattleRNG
+ call BattleRandom
cp c
jp c, Function3c3f3
- call FarBattleRNG
+ call BattleRandom
cp e
jp c, $43f1
jr .asm_3c3c5
.asm_3c3b5
- call FarBattleRNG
+ call BattleRandom
cp e
jp c, $43f1
- call FarBattleRNG
+ call BattleRandom
cp c
jp c, Function3c3f3
jr .asm_3c3c5
@@ -36764,13 +36760,13 @@
ld a, [$ffcb]
cp $2
jr z, .asm_3c3e9
- call FarBattleRNG
+ call BattleRandom
cp $80
jp c, $43f1
jp Function3c3f3
.asm_3c3e9
- call FarBattleRNG
+ call BattleRandom
cp $80
jp c, Function3c3f3
scf
@@ -36950,7 +36946,7 @@
res 4, [hl]
call SetEnemyTurn
ld hl, $4c8a
- jp FarBattleTextBox
+ jp StdBattleTextBox
.asm_3c518
ld hl, EnemySubStatus5
@@ -36974,7 +36970,7 @@
res 4, [hl]
call SetPlayerTurn
ld hl, $4c8a
- jp FarBattleTextBox
+ jp StdBattleTextBox
; 3c543
@@ -37001,7 +36997,7 @@
call IsInArray
jr c, .Flee
- call FarBattleRNG
+ call BattleRandom
ld b, a
cp $80
jr nc, .Stay
@@ -37283,7 +37279,7 @@
.asm_3c733
push de
- call FarBattleTextBox
+ call StdBattleTextBox
pop de
xor a
ld [$cfca], a
@@ -37337,7 +37333,7 @@
ld [hBGMapMode], a
call Function3ccef
ld hl, $480e
- call FarBattleTextBox
+ call StdBattleTextBox
.asm_3c7a1
call Function3c706
@@ -37353,7 +37349,7 @@
call GetQuarterMaxHP
call Function3cc3f
ld hl, $4822
- call FarBattleTextBox
+ call StdBattleTextBox
.asm_3c7c5
call Function3c706
@@ -37369,7 +37365,7 @@
call GetQuarterMaxHP
call Function3cc3f
ld hl, $4836
- call FarBattleTextBox
+ call StdBattleTextBox
.asm_3c7e9
ld hl, BattleMonHP
@@ -37420,7 +37416,7 @@
ld [$d265], a
push af
ld hl, $4864
- call FarBattleTextBox
+ call StdBattleTextBox
pop af
ret nz
ld a, $0
@@ -37515,7 +37511,7 @@
ld hl, $4df5
.asm_3c8e1
- jp FarBattleTextBox
+ jp StdBattleTextBox
; 3c8e4
Function3c8e4: ; 3c8e4
@@ -37568,7 +37564,7 @@
call Function3c8e4
call Function3ccef
ld hl, $4880
- jp FarBattleTextBox
+ jp StdBattleTextBox
; 3c93c
Function3c93c: ; 3c93c
@@ -37707,7 +37703,7 @@
call Function3ddc8
call Function3c8e4
ld hl, $4899
- jp FarBattleTextBox
+ jp StdBattleTextBox
; 3ca26
Function3ca26: ; 3ca26
@@ -37738,7 +37734,7 @@
cp $1
ret nz
ld hl, $48b6
- call FarBattleTextBox
+ call StdBattleTextBox
ld a, $10
call GetBattleVarPair
push af
@@ -37777,7 +37773,7 @@
ld a, [$c73f]
and a
ret nz
- call FarBattleRNG
+ call BattleRandom
cp $19
ret nc
xor a
@@ -37789,7 +37785,7 @@
call UpdateBattleHuds
call SetEnemyTurn
ld hl, $524b
- jp FarBattleTextBox
+ jp StdBattleTextBox
.asm_3cac9
ld a, [EnemyMonStatus]
@@ -37798,7 +37794,7 @@
ld a, [$c740]
and a
ret nz
- call FarBattleRNG
+ call BattleRandom
cp $19
ret nc
xor a
@@ -37815,7 +37811,7 @@
call UpdateBattleHuds
call SetPlayerTurn
ld hl, $524b
- jp FarBattleTextBox
+ jp StdBattleTextBox
; 3cafb
Function3cafb: ; 3cafb
@@ -37852,7 +37848,7 @@
.asm_3cb2e
ld [hBattleTurn], a
ld hl, $48d2
- jp FarBattleTextBox
+ jp StdBattleTextBox
; 3cb36
@@ -37909,7 +37905,7 @@
push hl
push de
ld hl, BattleText_0x808e7
- call FarBattleTextBox
+ call StdBattleTextBox
pop de
pop hl
ret
@@ -37923,7 +37919,7 @@
ret nz
res SCREENS_REFLECT, [hl]
ld hl, BattleText_0x80905
- jp FarBattleTextBox
+ jp StdBattleTextBox
; 3cb9e
HandleWeather: ; 3cb9e
@@ -37996,7 +37992,7 @@
call Function3cc3f
ld hl, BattleText_0x8084d
- jp FarBattleTextBox
+ jp StdBattleTextBox
.asm_3cc13
ld hl, .WeatherEndedMessages
@@ -38015,7 +38011,7 @@
ld a, [hli]
ld h, [hl]
ld l, a
- jp FarBattleTextBox
+ jp StdBattleTextBox
; 3cc2d
.WeatherMessages
@@ -38526,7 +38522,7 @@
ld bc, $050b
call ClearBox
ld hl, BattleText_0x80a75
- jp FarBattleTextBox
+ jp StdBattleTextBox
; 3cf14
Function3cf14: ; 3cf14
@@ -38540,7 +38536,7 @@
ld bc, $040a
call ClearBox
ld hl, BattleText_0x809a8
- jp FarBattleTextBox
+ jp StdBattleTextBox
; 3cf35
Function3cf35: ; 3cf35
@@ -38625,7 +38621,7 @@
call z, Function3d0ea
callab Function39939
ld hl, BattleText_0x809da
- call FarBattleTextBox
+ call StdBattleTextBox
call Function3d2f1
jr z, .asm_3cff5
ld a, [InLinkBattle]
@@ -38734,11 +38730,11 @@
ld a, [hli]
ld h, [hl]
ld l, a
- jp FarBattleTextBox
+ jp StdBattleTextBox
.asm_3d07b
ld hl, BattleText_0x809be
- jp FarBattleTextBox
+ jp StdBattleTextBox
; 3d081
Function3d081: ; 3d081
@@ -39018,7 +39014,7 @@
dec a
ret nz
ld hl, BattleText_0x80a83
- call FarBattleTextBox
+ call StdBattleTextBox
.asm_3d20a
ld bc, $0107
call Function1dd2
@@ -39193,7 +39189,7 @@
cp [hl]
jr nz, .asm_3d360
ld hl, BattleText_0x80c0d
- call FarBattleTextBox
+ call StdBattleTextBox
scf
ret
@@ -39314,7 +39310,7 @@
jr z, .asm_3d417
.asm_3d412
- call FarBattleTextBox
+ call StdBattleTextBox
.end
scf
@@ -39736,7 +39732,7 @@
.asm_3d6a7
ld a, [OTPartyCount]
ld b, a
- call FarBattleRNG
+ call BattleRandom
and $7
cp b
jr nc, .asm_3d6a7
@@ -39832,7 +39828,7 @@
push af
callab Function39939
ld hl, BattleText_0x80aca
- call FarBattleTextBox
+ call StdBattleTextBox
ld bc, $0107
call Function1dd2
ld a, [$cfa9]
@@ -39883,7 +39879,7 @@
Function3d7b8: ; 3d7b8
callab Function39939
ld hl, BattleText_0x80af8
- call FarBattleTextBox
+ call StdBattleTextBox
jp WaitBGMap
; 3d7c7
@@ -40005,16 +40001,16 @@
ld hl, PartySpecies
ld a, [CurPartyMon]
ld c, a
- ld b, $0
+ ld b, 0
add hl, bc
ld a, [hl]
- cp $fd
+ cp EGG
ld hl, BattleText_0x80b26
jr z, .asm_3d8ae
ld hl, BattleText_0x80b0b
.asm_3d8ae
- call FarBattleTextBox
+ call StdBattleTextBox
.asm_3d8b1
xor a
@@ -40068,7 +40064,7 @@
call SetPlayerTurn
call GetItemName
ld hl, BattleText_0x80b89
- call FarBattleTextBox
+ call StdBattleTextBox
jp .asm_3d9a2
.asm_3d916
@@ -40127,7 +40123,7 @@
jr .asm_3d96c
.asm_3d97a
- call FarBattleRNG
+ call BattleRandom
ld b, a
ld a, [$ffb6]
cp b
@@ -40145,7 +40141,7 @@
ld hl, BattleText_0x80b49
.asm_3d995
- call FarBattleTextBox
+ call StdBattleTextBox
ld a, $1
ld [$d266], a
call Function309d
@@ -40188,7 +40184,7 @@
pop de
call WaitSFX
ld hl, BattleText_0x80b77
- call FarBattleTextBox
+ call StdBattleTextBox
call WaitSFX
call Function309d
scf
@@ -40200,7 +40196,7 @@
bit 4, [hl]
jr nz, .asm_3da05
ld hl, BattleText_0x81863
- call FarBattleTextBox
+ call StdBattleTextBox
.asm_3da05
call WaitSFX
@@ -40493,7 +40489,7 @@
ret z
push bc
ld hl, BattleText_0x80bae
- call FarBattleTextBox
+ call StdBattleTextBox
call GetEighthMaxHP
call Function3cc39
pop hl
@@ -40570,7 +40566,7 @@
ld hl, BattleText_0x809a8
.asm_3dcdf
- call FarBattleTextBox
+ call StdBattleTextBox
scf
ret
@@ -40706,7 +40702,7 @@
ld a, $9
rst FarCall
ld hl, RecoveredUsingText
- jp FarBattleTextBox
+ jp StdBattleTextBox
; 3ddc8
@@ -40817,7 +40813,7 @@
call GetItemName
call Function3ddc8
ld hl, BattleText_0x80dab
- call FarBattleTextBox
+ call StdBattleTextBox
ld a, [hBattleTurn]
and a
jr nz, .asm_3de90
@@ -40897,7 +40893,7 @@
ld [de], a
call GetItemName
ld hl, BattleText_0x80bde
- call FarBattleTextBox
+ call StdBattleTextBox
callab BattleCommand8c
ret
@@ -41333,7 +41329,7 @@
bit 4, [hl]
jr nz, .asm_3e1c5
ld hl, $5863
- call FarBattleTextBox
+ call StdBattleTextBox
ld c, $3c
call DelayFrames
@@ -41396,7 +41392,7 @@
Function3e22b: ; 3e22b
ld hl, BattleText_0x80bf3
- call FarBattleTextBox
+ call StdBattleTextBox
jp Function3e139
; 3e234
@@ -41551,7 +41547,7 @@
cp d
jr nz, .asm_3e36b
ld hl, BattleText_0x80c0d
- call FarBattleTextBox
+ call StdBattleTextBox
jp $6299
.asm_3e36b
@@ -41564,7 +41560,7 @@
.asm_3e378
ld hl, BattleText_0x80c22
- call FarBattleTextBox
+ call StdBattleTextBox
jp $6299
.asm_3e381
@@ -41924,7 +41920,7 @@
ld hl, Function3cc39
.asm_3e613
- call FarBattleTextBox
+ call StdBattleTextBox
call Function30b4
jp Function3e4bc
; 3e61c
@@ -42173,7 +42169,7 @@
.asm_3e7b4
ld hl, BattleText_0x80c72
- call FarBattleTextBox
+ call StdBattleTextBox
ld c, $3c
call DelayFrames
xor a
@@ -42263,7 +42259,7 @@
jr nz, .asm_3e882
.asm_3e855
ld hl, EnemyMonMove1
- call FarBattleRNG
+ call BattleRandom
and $3
ld c, a
ld b, $0
@@ -42365,7 +42361,7 @@
; To do this we pull the species from TempEnemyMonSpecies
; Notes:
-; FarBattleRNG is used to ensure sync between Game Boys
+; BattleRandom is used to ensure sync between Game Boys
; Clear the whole EnemyMon struct
xor a
@@ -42424,13 +42420,13 @@
; 2% Item2
; 25% chance of getting an item
- call FarBattleRNG
+ call BattleRandom
cp a, $c0
ld a, NO_ITEM
jr c, .UpdateItem
; From there, an 8% chance for Item2
- call FarBattleRNG
+ call BattleRandom
cp a, $14 ; 8% of 25% = 2% Item2
ld a, [BaseItems]
jr nc, .UpdateItem
@@ -42510,10 +42506,10 @@
; (HP is initialized at the end of the battle)
call GetRoamMonDVs
inc hl
- call FarBattleRNG
+ call BattleRandom
ld [hld], a
ld c, a
- call FarBattleRNG
+ call BattleRandom
ld [hl], a
ld b, a
; We're done with DVs
@@ -42534,9 +42530,9 @@
.GenerateDVs
; Generate new random DVs
- call FarBattleRNG
+ call BattleRandom
ld b, a
- call FarBattleRNG
+ call BattleRandom
ld c, a
.UpdateDVs
@@ -42589,7 +42585,7 @@
jr nz, .CheckMagikarpArea
; 5% chance of skipping size checks
- call RNG
+ call Random
cp a, $0c ; / $100
jr c, .CheckMagikarpArea
; Try again if > 1614
@@ -42598,7 +42594,7 @@
jr nc, .GenerateDVs
; 20% chance of skipping this check
- call RNG
+ call Random
cp a, $32 ; / $100
jr c, .CheckMagikarpArea
; Try again if > 1598
@@ -42623,7 +42619,7 @@
cp a, MAP_LAKE_OF_RAGE
jr z, .Happiness
; 40% chance of not flooring
- call RNG
+ call Random
cp a, $64 ; / $100
jr c, .Happiness
; Floor at length 1024
@@ -43394,7 +43390,7 @@
; 3edd8
-BattleRNG: ; 3edd8
+_BattleRandom: ; 3edd8
; If the normal RNG is used in a link battle it'll desync.
; To circumvent this a shared PRNG is used instead.
@@ -43401,7 +43397,7 @@
; But if we're in a non-link battle we're safe to use it
ld a, [InLinkBattle]
and a
- jp z, RNG
+ jp z, Random
; The PRNG operates in streams of 10 values.
@@ -43816,7 +43812,7 @@
call StartSFX
call WaitSFX
ld hl, BattleText_0x80c9c
- call FarBattleTextBox
+ call StdBattleTextBox
call Function309d
.asm_3f057
@@ -44069,7 +44065,7 @@
rst FarCall
call WaitSFX
ld hl, BattleText_0x80c9c
- call FarBattleTextBox
+ call StdBattleTextBox
pop de
inc e
ld b, $0
@@ -44358,7 +44354,7 @@
push hl
call Function30b4
pop hl
- jp FarBattleTextBox
+ jp StdBattleTextBox
; 3f390
@@ -44917,7 +44913,7 @@
ld de, $d850
call Function3d0be
ld hl, BattleText_0x80730
- call FarBattleTextBox
+ call StdBattleTextBox
ld a, [$cfc0]
bit 0, a
ret z
@@ -45213,7 +45209,7 @@
ret
.asm_3f9c4
- call FarBattleRNG
+ call BattleRandom
and $f
ret nz
@@ -45757,7 +45753,7 @@
ld hl, $4000
rst FarCall
pop hl
- call FarBattleTextBox
+ call StdBattleTextBox
call Function3f830
ret nz
@@ -46790,7 +46786,7 @@
.asm_425a2
inc c
ld a, c
- cp CELEBI
+ cp NUM_POKEMON
jr c, .asm_42583
and a
ret
@@ -47152,7 +47148,7 @@
.asm_44197
ld hl, Buffer1
- call RNG
+ call Random
and 3
ld c, a
ld b, 0
@@ -47638,32 +47634,20 @@
ld [PartyMenuActionText], a
call WhiteBGMap
.asm_448dc
- ld a, $14
- ld hl, $404f
- rst $8
- ld a, $14
- ld hl, $4405
- rst $8
- ld a, $14
- ld hl, $43e0
- rst $8
- ld a, $14
- ld hl, PickedFruitTree
- rst $8
- ld a, $14
- ld hl, $449a
- rst $8
+ callba Function5004f
+ callba Function50405
+ callba Function503e0
+ callba WritePartyMenuTilemap
+ callba PrintPartyMenuText
call WaitBGMap
call Function32f9
call DelayFrame
- ld a, $14
- ld hl, $4457
- rst $8
+ callba PartyMenuSelect
jr c, .asm_44939
ld a, [CurPartySpecies]
- cp $fd
+ cp EGG
jr z, .asm_44923
- ld a, $1
+ ld a, PartyMon1Item - PartyMon1
call GetPartyParamLocation
ld a, [hl]
and a
@@ -51438,14 +51422,14 @@
Function50389: ; 50389
- ld a, $d8
+ ld a, PartySpecies & $ff
add b
ld e, a
- ld a, $dc
- adc $0
+ ld a, PartySpecies >> 8
+ adc 0
ld d, a
ld a, [de]
- cp $fd
+ cp EGG
ret
; 50396
@@ -51456,7 +51440,7 @@
ld a, [PartyMenuActionText]
and $f
ld e, a
- ld d, $0
+ ld d, 0
ld hl, $43b2
add hl, de
add hl, de
@@ -54128,6 +54112,7 @@
INCBIN "baserom.gbc", $80648, $80730-$80648
+BattleText:
INCLUDE "text/battle.asm"
INCBIN "baserom.gbc", $818ac, $81fe3-$818ac
@@ -54832,12 +54817,12 @@
ld [de], a
inc de
ld hl, PartySpecies
- ld c, $0
+ ld c, 0
.asm_86556
ld a, [hli]
cp $ff
jr z, .asm_865b1
- cp $fd
+ cp EGG
jr nz, .asm_86562
inc c
jr .asm_86556
@@ -55055,7 +55040,7 @@
ld hl, $c50a
call Function378b
ld a, [CurPartySpecies]
- cp $fd
+ cp EGG
jr z, .asm_867f8
ld hl, $c5a5
ld a, $74
@@ -55502,7 +55487,7 @@
ld a, WATER_STONE
ld [CurItem], a
ld hl, NumItems
- call Function2f79
+ call PickUpItem
jr c, .asm_8ae24
ld a, [PartyCount]
@@ -56192,7 +56177,7 @@
Function8c20f: ; 8c20f
- call $426d
+ call Function8c26d
ld a, [rBGP]
ld [$cfc7], a
ld a, [rOBP0]
@@ -56208,7 +56193,7 @@
ld a, [$cf63]
bit 7, a
jr nz, .asm_8c23a
- call $4314
+ call Function8c314
call DelayFrame
jr .asm_8c22b
@@ -56247,12 +56232,12 @@
callba Function6454
call Function1ad2
call DelayFrame
- call $42a0
- call $4f4f
+ call Function8c2a0
+ call Function8cf4f
jr .asm_8c28b
.asm_8c288
- call $42aa
+ call Function8c2aa
.asm_8c28b
ld a, $90
@@ -56265,14 +56250,14 @@
ld [hli], a
ld [hli], a
ld [hl], a
- call $46d8
+ call Function8c6d8
ret
; 8c2a0
Function8c2a0: ; 8c2a0
- call $42aa
+ call Function8c2aa
ld hl, VBGMap0
- call $42cf
+ call Function8c2cf
ret
; 8c2aa
@@ -56344,9 +56329,9 @@
ld a, $5
ld [rSVBK], a
ld hl, $d100
- call $46ef
+ call Function8c6ef
ld hl, $d200
- call $46ef
+ call Function8c6ef
pop af
ld [rSVBK], a
ret
@@ -56378,7 +56363,7 @@
ld a, e
and $1
ld [$cf63], a
- call $496d
+ call Function8c96d
call WaitSFX
ld de, $001e
call StartSFX
@@ -56388,10 +56373,10 @@
jr nz, .asm_8c96c
ld a, $90
ld [$c3b5], a
- ld hl, $4f7a
+ ld hl, Function8cf7a
ld a, $23
rst FarCall
- call $4a0c
+ call Function8ca0c
call DelayFrame
jr .asm_8c952
@@ -56400,7 +56385,7 @@
; 8c96d
Function8c96d: ; 8c96d
- ld hl, $4f53
+ ld hl, Function8cf53
ld a, $23
rst FarCall
ld de, $49cc
@@ -56605,9 +56590,9 @@
Function8d04c: ; 8d04c
call Function8d0ec
call Function8d132
- cp $fd
+ cp EGG
jr z, .asm_8d0b9
- cp $fc
+ cp NUM_POKEMON + 1
jr z, .asm_8d0b6
call Function8d1a2
ld a, [$c3ba]
@@ -59844,7 +59829,7 @@
Function97d31: ; 97d31
.asm_97d31
- call RNG
+ call Random
cp 100 << 1
jr nc, .asm_97d31
srl a
@@ -59871,7 +59856,7 @@
.asm_97d54
ld c, a
inc c
- call RNG
+ call Random
ld a, [hRandomAdd]
call SimpleDivide
add d
@@ -59896,7 +59881,7 @@
ld a, $a
ld hl, $6138
rst FarCall
- call RNG
+ call Random
ld a, [hRandomAdd]
cp b
ret c
@@ -63353,9 +63338,9 @@
Functioncca09: ; cca09
call Functionccaaa
call Functionce7d1
- cp $fd
+ cp EGG
jp z, $4aa5
- cp $fc
+ cp NUM_POKEMON + 1
jp z, $4aa2
push af
ld hl, $d419
@@ -64197,7 +64182,7 @@
Options_Print: ; e4424
- call $4491
+ call Functione4491
ld a, [hJoyPressed]
bit 5, a
jr nz, .asm_e443c
@@ -68027,7 +68012,7 @@
ld hl, $4c39
.asm_100c6b
- call FarBattleTextBox
+ call StdBattleTextBox
call Function30b4
jp Function100bc2
; 100c74
@@ -69699,7 +69684,7 @@
INCBIN "baserom.gbc", $10c000, $10ed67 - $10c000
-StartTitleScreen: ; 10ed67
+_TitleScreen: ; 10ed67
call WhiteBGMap
call ClearSprites
--- a/stats/battle_tower.asm
+++ b/stats/battle_tower.asm
@@ -15,7 +15,7 @@
ld a, [hRandomAdd]
ld b, a
.asm_1f8022
- call RNG
+ call Random
ld a, [hRandomAdd]
add b
ld b, a
@@ -83,7 +83,7 @@
ld a, [hRandomAdd]
ld b, a
.asm_1f8099
- call RNG
+ call Random
ld a, [hRandomAdd]
add b
ld b, a
--- a/stats/odd_eggs.asm
+++ b/stats/odd_eggs.asm
@@ -1,7 +1,7 @@
GiveOddEgg: ; 1fb4b6
; Figure out which egg to give.
- call RNG
+ call Random
ld hl, .Probabilities
ld c, 0
ld b, c
--- a/stats/wild/fish.asm
+++ b/stats/wild/fish.asm
@@ -39,7 +39,7 @@
; Fish for monsters with rod b from encounter data in FishGroup at hl.
; Return monster e at level d.
- call RNG
+ call Random
; Got a bite?
cp [hl]
@@ -59,7 +59,7 @@
ld l, a
; Encounter chance for this monster:
- call RNG
+ call Random
.CheckEncounter
cp [hl]
--- a/wram.asm
+++ b/wram.asm
@@ -1712,7 +1712,10 @@
Money: ; d84e
ds 3
- ds 6
+ ds 4
+
+Coins: ; d855
+ ds 2
Badges:
JohtoBadges: ; d857