mirror of
https://github.com/thornAvery/kep-hack.git
synced 2025-09-17 02:40:50 +12:00
Rename random number function and hram labels.
GenRandom -> Random GenRandomInBattle -> BattleRandom H_RAND1 -> hRandomAdd H_RAND2 -> hRandomSub
This commit is contained in:
parent
8f8281fe6e
commit
64479cd642
|
@ -132,10 +132,10 @@ Func_13870: ; 13870 (4:7870)
|
|||
ld a, [W_GRASSRATE] ; $d887
|
||||
.asm_138c4
|
||||
ld b, a
|
||||
ld a, [H_RAND1] ; $ffd3
|
||||
ld a, [hRandomAdd]
|
||||
cp b
|
||||
jr nc, .asm_13912
|
||||
ld a, [H_RAND2] ; $ffd4
|
||||
ld a, [hRandomSub]
|
||||
ld b, a
|
||||
ld hl, WildMonEncounterSlotChances ; $7918
|
||||
.asm_138d0
|
||||
|
|
|
@ -280,7 +280,7 @@ Func_3c11e: ; 3c11e (f:411e)
|
|||
jr nc, .asm_3c1a0
|
||||
ld b, $ff
|
||||
.asm_3c1a0
|
||||
call GenRandom
|
||||
call Random
|
||||
cp b
|
||||
jr nc, .asm_3c14f
|
||||
jr asm_3c202
|
||||
|
@ -475,12 +475,12 @@ MainInBattleLoop: ; 3c233 (f:4233)
|
|||
ld a, [$ffaa]
|
||||
cp $2
|
||||
jr z, .invertOutcome
|
||||
call GenRandomInBattle
|
||||
call BattleRandom
|
||||
cp $80
|
||||
jr c, .playerMovesFirst
|
||||
jr .enemyMovesFirst
|
||||
.invertOutcome
|
||||
call GenRandomInBattle
|
||||
call BattleRandom
|
||||
cp $80
|
||||
jr c, .enemyMovesFirst
|
||||
jr .playerMovesFirst
|
||||
|
@ -1595,7 +1595,7 @@ Func_3cab9: ; 3cab9 (f:4ab9)
|
|||
jr c, .asm_3cb5c
|
||||
jr .asm_3cb2b
|
||||
.asm_3cb39
|
||||
call GenRandomInBattle
|
||||
call BattleRandom
|
||||
ld b, a
|
||||
ld a, [$ff98]
|
||||
cp b
|
||||
|
@ -2992,7 +2992,7 @@ SelectEnemyMove: ; 3d564 (f:5564)
|
|||
callab AIEnemyTrainerChooseMoves
|
||||
.chooseRandomMove
|
||||
push hl
|
||||
call GenRandomInBattle ; get random
|
||||
call BattleRandom
|
||||
ld b, $1
|
||||
cp $3f ; select move 1 in [0,3e] (63/256 chance)
|
||||
jr c, .moveChosen
|
||||
|
@ -3415,7 +3415,7 @@ HyperBeamCheck: ; 3d8c2 (f:58c2)
|
|||
ld [$CC5B],a
|
||||
ld a,CONF_ANIM - 1
|
||||
call PlayMoveAnimation
|
||||
call GenRandomInBattle
|
||||
call BattleRandom
|
||||
cp a,$80
|
||||
jr c,.next3
|
||||
ld hl,W_PLAYERBATTSTATUS1
|
||||
|
@ -3438,7 +3438,7 @@ HyperBeamCheck: ; 3d8c2 (f:58c2)
|
|||
ld hl,W_PLAYERMONSTATUS
|
||||
bit PAR,[hl]
|
||||
jr z,.next7 ; 5975
|
||||
call GenRandomInBattle ; random number
|
||||
call BattleRandom
|
||||
cp a,$3F
|
||||
jr nc,.next7
|
||||
ld hl,FullyParalyzedText
|
||||
|
@ -3526,7 +3526,7 @@ HyperBeamCheck: ; 3d8c2 (f:58c2)
|
|||
ld hl,W_PLAYERBATTSTATUS1
|
||||
res 1,[hl]
|
||||
set 7,[hl]
|
||||
call GenRandomInBattle ; random number
|
||||
call BattleRandom
|
||||
and a,3
|
||||
inc a
|
||||
inc a
|
||||
|
@ -3984,14 +3984,14 @@ Func_3dc88: ; 3dc88 (f:5c88)
|
|||
cp d
|
||||
jp nc, Func_3ddb0
|
||||
.asm_3dcdf
|
||||
call GenRandomInBattle
|
||||
call BattleRandom
|
||||
swap a
|
||||
cp b
|
||||
jr nc, .asm_3dcdf
|
||||
cp c
|
||||
jp c, Func_3ddb0
|
||||
.asm_3dceb
|
||||
call GenRandomInBattle
|
||||
call BattleRandom
|
||||
cp b
|
||||
jr nc, .asm_3dceb
|
||||
cp c
|
||||
|
@ -3999,7 +3999,7 @@ Func_3dc88: ; 3dc88 (f:5c88)
|
|||
ld a, d
|
||||
sub c
|
||||
ld b, a
|
||||
call GenRandomInBattle
|
||||
call BattleRandom
|
||||
swap a
|
||||
sub b
|
||||
jr c, .asm_3dd0e
|
||||
|
@ -4010,7 +4010,7 @@ Func_3dc88: ; 3dc88 (f:5c88)
|
|||
call PrintHurtItselfText
|
||||
jp Func_3ddb4
|
||||
.asm_3dd0e
|
||||
call GenRandomInBattle
|
||||
call BattleRandom
|
||||
add a
|
||||
swap a
|
||||
and $7
|
||||
|
@ -4019,7 +4019,7 @@ Func_3dc88: ; 3dc88 (f:5c88)
|
|||
ld hl, BeganToNapText
|
||||
jr .asm_3dd3a
|
||||
.asm_3dd20
|
||||
call GenRandomInBattle
|
||||
call BattleRandom
|
||||
and $3
|
||||
ld hl, LoafingAroundText
|
||||
and a
|
||||
|
@ -4079,7 +4079,7 @@ Func_3dc88: ; 3dc88 (f:5c88)
|
|||
ld a, [wCurrentMenuItem] ; $cc26
|
||||
ld c, a
|
||||
.asm_3dd86
|
||||
call GenRandomInBattle
|
||||
call BattleRandom
|
||||
and $3
|
||||
cp b
|
||||
jr nc, .asm_3dd86
|
||||
|
@ -4606,7 +4606,7 @@ CriticalHitTest: ; 3e023 (f:6023)
|
|||
jr nc, .SkipHighCritical
|
||||
ld b, $ff
|
||||
.SkipHighCritical
|
||||
call GenRandomInBattle ; generates a random value, in "a"
|
||||
call BattleRandom ; generates a random value, in "a"
|
||||
rlc a
|
||||
rlc a
|
||||
rlc a
|
||||
|
@ -4736,7 +4736,7 @@ ApplyAttackToEnemyPokemon: ; 3e0df (f:60df)
|
|||
ld b,a ; b = level * 1.5
|
||||
; loop until a random number in the range [1, b) is found
|
||||
.loop
|
||||
call GenRandomInBattle ; random number
|
||||
call BattleRandom
|
||||
and a
|
||||
jr z,.loop
|
||||
cp b
|
||||
|
@ -4859,7 +4859,7 @@ ApplyAttackToPlayerPokemon: ; 3e1a0 (f:61a0)
|
|||
; this differs from the range when the player attacks, which is [1, b)
|
||||
; it's possible for the enemy to do 0 damage with Psywave, but the player always does at least 1 damage
|
||||
.loop
|
||||
call GenRandomInBattle ; random number
|
||||
call BattleRandom
|
||||
cp b
|
||||
jr nc,.loop
|
||||
ld b,a
|
||||
|
@ -5090,7 +5090,7 @@ MetronomePickMove: ; 3e348 (f:6348)
|
|||
ld hl,wEnemySelectedMove
|
||||
; loop to pick a random number in the range [1, $a5) to be the move used by Metronome
|
||||
.pickMoveLoop
|
||||
call GenRandomInBattle ; random number
|
||||
call BattleRandom
|
||||
and a
|
||||
jr z,.pickMoveLoop
|
||||
cp a,NUM_MOVES + 1 ; max normal move number + 1 (this is Struggle's move number)
|
||||
|
@ -5385,7 +5385,7 @@ MoveHitTest: ; 3e56b (f:656b)
|
|||
.doAccuracyCheck
|
||||
; if the random number generated is greater than or equal to the scaled accuracy, the move misses
|
||||
; note that this means that even the highest accuracy is still just a 255/256 chance, not 100%
|
||||
call GenRandomInBattle ; random number
|
||||
call BattleRandom
|
||||
cp b
|
||||
jr nc,.moveMissed
|
||||
ret
|
||||
|
@ -5494,7 +5494,7 @@ Func_3e687: ; 3e687 (f:6687)
|
|||
ld a, [hl]
|
||||
ld [$ff98], a
|
||||
.asm_3e69c
|
||||
call GenRandomInBattle
|
||||
call BattleRandom
|
||||
rrca
|
||||
cp $d9
|
||||
jr c, .asm_3e69c
|
||||
|
@ -5821,7 +5821,7 @@ Func_3e8fd: ; 3e8fd (f:68fd)
|
|||
ld [$cc5b], a
|
||||
ld a,CONF_ANIM
|
||||
call PlayMoveAnimation
|
||||
call GenRandomInBattle
|
||||
call BattleRandom
|
||||
cp $80
|
||||
jr c, Func_3e9aa
|
||||
ld hl, W_ENEMYBATTSTATUS1 ; $d067
|
||||
|
@ -5884,7 +5884,7 @@ Func_3e9aa: ; 3e9aa (f:69aa)
|
|||
ld hl, W_ENEMYMONSTATUS ; $cfe9
|
||||
bit 6, [hl]
|
||||
jr z, asm_3e9f6
|
||||
call GenRandomInBattle
|
||||
call BattleRandom
|
||||
cp $3f
|
||||
jr nc, asm_3e9f6
|
||||
ld hl, FullyParalyzedText
|
||||
|
@ -5973,7 +5973,7 @@ asm_3e9f6: ; 3e9f6 (f:69f6)
|
|||
ld hl, W_ENEMYBATTSTATUS1 ; $d067
|
||||
res 1, [hl] ; mon is no longer using thrash or petal dance
|
||||
set 7, [hl] ; mon is now confused
|
||||
call GenRandomInBattle
|
||||
call BattleRandom
|
||||
and $3
|
||||
inc a
|
||||
inc a
|
||||
|
@ -6062,9 +6062,9 @@ Func_3eb01: ; 3eb01 (f:6b01)
|
|||
ld a, $98
|
||||
ld b, $88
|
||||
jr z, .asm_3eb33
|
||||
call GenRandomInBattle
|
||||
call BattleRandom
|
||||
ld b, a
|
||||
call GenRandomInBattle
|
||||
call BattleRandom
|
||||
.asm_3eb33
|
||||
ld hl, $cff1
|
||||
ld [hli], a
|
||||
|
@ -6578,34 +6578,39 @@ Func_3ee94: ; 3ee94 (f:6e94)
|
|||
TerminatorText_3ee9a: ; 3ee9a (f:6e9a)
|
||||
db "@"
|
||||
|
||||
; generates a random number unless in link battle
|
||||
; stores random number in A
|
||||
GenRandomInBattle: ; 3ee9b (f:6e9b)
|
||||
|
||||
BattleRandom:
|
||||
; Link battles use a shared PRNG.
|
||||
|
||||
ld a, [W_ISLINKBATTLE]
|
||||
cp $4
|
||||
jp nz, GenRandom
|
||||
jp nz, Random
|
||||
|
||||
push hl
|
||||
push bc
|
||||
ld a, [$ccde]
|
||||
ld c, a
|
||||
ld b, $0
|
||||
ld b, 0
|
||||
ld hl, $d148
|
||||
add hl, bc
|
||||
inc a
|
||||
ld [$ccde], a
|
||||
cp $9
|
||||
cp 9
|
||||
ld a, [hl]
|
||||
pop bc
|
||||
pop hl
|
||||
ret c
|
||||
|
||||
push hl
|
||||
push bc
|
||||
push af
|
||||
|
||||
xor a
|
||||
ld [$ccde], a
|
||||
|
||||
ld hl, $d148
|
||||
ld b, $9
|
||||
.asm_3eec5
|
||||
ld b, 9
|
||||
.loop
|
||||
ld a, [hl]
|
||||
ld c, a
|
||||
add a
|
||||
|
@ -6614,12 +6619,14 @@ GenRandomInBattle: ; 3ee9b (f:6e9b)
|
|||
inc a
|
||||
ld [hli], a
|
||||
dec b
|
||||
jr nz, .asm_3eec5 ; 0x3eecd $f6
|
||||
jr nz, .loop
|
||||
|
||||
pop af
|
||||
pop bc
|
||||
pop hl
|
||||
ret
|
||||
|
||||
|
||||
Func_3eed3: ; 3eed3 (f:6ed3)
|
||||
ld a, [H_WHOSETURN] ; $fff3
|
||||
and a
|
||||
|
@ -7089,7 +7096,7 @@ SleepEffect: ; 3f1fc (f:71fc)
|
|||
and a
|
||||
jr nz, .asm_3f242
|
||||
.asm_3f231
|
||||
call GenRandomInBattle
|
||||
call BattleRandom
|
||||
and $7
|
||||
jr z, .asm_3f231
|
||||
ld [de], a
|
||||
|
@ -7145,7 +7152,7 @@ PoisonEffect: ; 3f24f (f:724f)
|
|||
jr nz, .asm_3f2d7
|
||||
jr .asm_3f295
|
||||
.asm_3f290
|
||||
call GenRandomInBattle
|
||||
call BattleRandom
|
||||
cp b
|
||||
ret nc
|
||||
.asm_3f295
|
||||
|
@ -7253,7 +7260,7 @@ FreezeBurnParalyzeEffect: ; 3f30c (f:730c)
|
|||
sub a, $1e ;subtract $1E to map to equivalent 10% chance effects
|
||||
.next1
|
||||
push af ;push effect...
|
||||
call GenRandomInBattle ;get random 8bit value for probability test
|
||||
call BattleRandom ;get random 8bit value for probability test
|
||||
cp b ;success?
|
||||
pop bc ;...pop effect into C
|
||||
ret nc ;do nothing if random value is >= 1A or 4D [no status applied]
|
||||
|
@ -7305,7 +7312,7 @@ opponentAttacker: ; 3f382 (f:7382)
|
|||
sub a, $1e
|
||||
.next1
|
||||
push af
|
||||
call GenRandomInBattle
|
||||
call BattleRandom
|
||||
cp b
|
||||
pop bc
|
||||
ret nc
|
||||
|
@ -7571,7 +7578,7 @@ StatModifierDownEffect: ; 3f54c (f:754c)
|
|||
ld a, [W_ISLINKBATTLE] ; $d12b
|
||||
cp $4
|
||||
jr z, .asm_3f572
|
||||
call GenRandomInBattle
|
||||
call BattleRandom
|
||||
cp $40
|
||||
jp c, Func_3f65a
|
||||
.asm_3f572
|
||||
|
@ -7580,7 +7587,7 @@ StatModifierDownEffect: ; 3f54c (f:754c)
|
|||
ld a, [de]
|
||||
cp ATTACK_DOWN_SIDE_EFFECT
|
||||
jr c, .asm_3f58a
|
||||
call GenRandomInBattle
|
||||
call BattleRandom
|
||||
cp SPLASH_EFFECT
|
||||
jp nc, Func_3f650
|
||||
ld a, [de]
|
||||
|
@ -7813,7 +7820,7 @@ BideEffect: ; 3f6e5 (f:76e5)
|
|||
ld [de], a
|
||||
ld [W_PLAYERMOVEEFFECT], a
|
||||
ld [W_ENEMYMOVEEFFECT], a
|
||||
call GenRandomInBattle
|
||||
call BattleRandom
|
||||
and $1
|
||||
inc a
|
||||
inc a
|
||||
|
@ -7832,7 +7839,7 @@ ThrashPetalDanceEffect: ; 3f717 (f:7717)
|
|||
ld de, $d06f
|
||||
.asm_3f728
|
||||
set 1, [hl] ; mon is now using thrash/petal dance
|
||||
call GenRandomInBattle
|
||||
call BattleRandom
|
||||
and $1
|
||||
inc a
|
||||
inc a
|
||||
|
@ -7857,7 +7864,7 @@ SwitchAndTeleportEffect: ; 3f739 (f:7739)
|
|||
ld c, a
|
||||
inc c
|
||||
.asm_3f751
|
||||
call GenRandomInBattle
|
||||
call BattleRandom
|
||||
cp c
|
||||
jr nc, .asm_3f751
|
||||
srl b
|
||||
|
@ -7899,7 +7906,7 @@ SwitchAndTeleportEffect: ; 3f739 (f:7739)
|
|||
ld c, a
|
||||
inc c
|
||||
.asm_3f7a4
|
||||
call GenRandomInBattle
|
||||
call BattleRandom
|
||||
cp c
|
||||
jr nc, .asm_3f7a4
|
||||
srl b
|
||||
|
@ -7982,11 +7989,11 @@ TwoToFiveAttacksEffect: ; 3f811 (f:7811)
|
|||
cp ATTACK_TWICE_EFFECT
|
||||
ld a, $2
|
||||
jr z, .asm_3f853
|
||||
call GenRandomInBattle
|
||||
call BattleRandom
|
||||
and $3
|
||||
cp $2
|
||||
jr c, .asm_3f851
|
||||
call GenRandomInBattle
|
||||
call BattleRandom
|
||||
and $3
|
||||
.asm_3f851
|
||||
inc a
|
||||
|
@ -8017,7 +8024,7 @@ FlichSideEffect: ; 3f85b (f:785b)
|
|||
jr z, .asm_3f879
|
||||
ld b, $4d ; ~30% chance of flinch
|
||||
.asm_3f879
|
||||
call GenRandomInBattle
|
||||
call BattleRandom
|
||||
cp b
|
||||
ret nc
|
||||
set 3, [hl] ; set mon's status to flinching
|
||||
|
@ -8124,11 +8131,11 @@ TrappingEffect: ; 3f917 (f:7917)
|
|||
ret nz
|
||||
call Func_3f9cf
|
||||
set 5, [hl]
|
||||
call GenRandomInBattle
|
||||
call BattleRandom
|
||||
and $3
|
||||
cp $2
|
||||
jr c, .asm_3f93e
|
||||
call GenRandomInBattle
|
||||
call BattleRandom
|
||||
and $3
|
||||
.asm_3f93e
|
||||
inc a
|
||||
|
@ -8151,7 +8158,7 @@ RecoilEffect: ; 3f951 (f:7951)
|
|||
jp Bankswitch
|
||||
|
||||
ConfusionSideEffect: ; 3f959 (f:7959)
|
||||
call GenRandomInBattle
|
||||
call BattleRandom
|
||||
cp $19
|
||||
ret nc
|
||||
jr Func_3f96f
|
||||
|
@ -8179,7 +8186,7 @@ Func_3f96f: ; 3f96f (f:796f)
|
|||
jr nz, Func_3f9a6
|
||||
set 7, [hl] ; mon is now confused
|
||||
push af
|
||||
call GenRandomInBattle
|
||||
call BattleRandom
|
||||
and $3
|
||||
inc a
|
||||
inc a
|
||||
|
@ -8265,7 +8272,7 @@ MimicEffect: ; 3f9ed (f:79ed)
|
|||
jr nz, .asm_3fa74
|
||||
.asm_3fa17
|
||||
push hl
|
||||
call GenRandomInBattle
|
||||
call BattleRandom
|
||||
and $3
|
||||
ld c, a
|
||||
ld b, $0
|
||||
|
@ -8346,7 +8353,7 @@ DisableEffect: ; 3fa8a (f:7a8a)
|
|||
jr nz, .asm_3fb06
|
||||
.asm_3faa8
|
||||
push hl
|
||||
call GenRandomInBattle
|
||||
call BattleRandom
|
||||
and $3
|
||||
ld c, a
|
||||
ld b, $0
|
||||
|
@ -8384,7 +8391,7 @@ DisableEffect: ; 3fa8a (f:7a8a)
|
|||
and a
|
||||
jr z, .asm_3faa8
|
||||
.asm_3fae1
|
||||
call GenRandomInBattle
|
||||
call BattleRandom
|
||||
and $7
|
||||
inc a
|
||||
inc c
|
||||
|
|
|
@ -898,7 +898,7 @@ TrainerAI: ; 3a52e (e:652e)
|
|||
ld a,[hli]
|
||||
ld h,[hl]
|
||||
ld l,a
|
||||
call GenRandom
|
||||
call Random
|
||||
jp [hl]
|
||||
|
||||
TrainerAIPointers: ; 3a55c (e:655c)
|
||||
|
|
|
@ -37,7 +37,7 @@ Func_5345: ; 5345
|
|||
jr nz, .asm_5357
|
||||
ld b, $a
|
||||
.asm_535d
|
||||
call GenRandom
|
||||
call Random
|
||||
cp $fd
|
||||
jr nc, .asm_535d
|
||||
ld [hli], a
|
||||
|
|
|
@ -362,7 +362,7 @@ GymTrashScript: ; 5ddfc (17:5dfc)
|
|||
|
||||
ld [$ffdb], a
|
||||
push hl
|
||||
call GenRandom
|
||||
call Random
|
||||
swap a
|
||||
ld b, a
|
||||
ld a, [$ffdb]
|
||||
|
@ -390,7 +390,7 @@ GymTrashScript: ; 5ddfc (17:5dfc)
|
|||
; Reset the cans.
|
||||
ld hl, $d773
|
||||
res 1, [hl]
|
||||
call GenRandom
|
||||
call Random
|
||||
|
||||
and $e
|
||||
ld [$d743], a
|
||||
|
|
|
@ -189,8 +189,8 @@ Func_71cc1: ; 71cc1 (1c:5cc1)
|
|||
ld de, $cd4c
|
||||
ld bc, $2
|
||||
call Func_71d11
|
||||
call GenRandom
|
||||
ld hl, H_RAND1 ; $ffd3
|
||||
call Random
|
||||
ld hl, hRandomAdd
|
||||
ld de, $cd59
|
||||
jp CopyData
|
||||
|
||||
|
|
|
@ -156,7 +156,7 @@ ItemUseBall: ; d687 (3:5687)
|
|||
; if not fighting ghost Marowak, loop until a random number in the current
|
||||
; pokeball's allowed range is found
|
||||
.loop ;$56fa
|
||||
call GenRandom
|
||||
call Random
|
||||
ld b,a
|
||||
ld hl,$cf91
|
||||
ld a,[hl]
|
||||
|
@ -243,7 +243,7 @@ ItemUseBall: ; d687 (3:5687)
|
|||
ld a,[H_QUOTIENT + 2]
|
||||
and a
|
||||
jr nz,.BallSuccess ; if ((MaxHP * 255) / BallFactor) / (CurHP / 4) > 0x255, automatic success
|
||||
call GenRandom
|
||||
call Random
|
||||
ld b,a
|
||||
ld a,[H_QUOTIENT + 3]
|
||||
cp b
|
||||
|
@ -1344,7 +1344,7 @@ BaitRockCommon: ; df7f (3:5f7f)
|
|||
ld [H_WHOSETURN],a
|
||||
ld [de],a ; zero escape factor (for bait), zero bait factor (for rock)
|
||||
.randomLoop ; loop until a random number less than 5 is generated
|
||||
call GenRandom
|
||||
call Random
|
||||
and a,7
|
||||
cp a,5
|
||||
jr nc,.randomLoop
|
||||
|
@ -1767,7 +1767,7 @@ GoodRodCode: ; e259 (3:6259)
|
|||
call FishingInit
|
||||
jp c,ItemUseNotTime
|
||||
.RandomLoop
|
||||
call GenRandom
|
||||
call Random
|
||||
srl a
|
||||
jr c, .SetBite
|
||||
and %11
|
||||
|
@ -2814,7 +2814,7 @@ ReadSuperRodData: ; e8ea (3:68ea)
|
|||
ld e, $0 ; no bite yet
|
||||
|
||||
.RandomLoop ; 0xe90c
|
||||
call GenRandom
|
||||
call Random
|
||||
srl a
|
||||
ret c ; 50% chance of no battle
|
||||
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
GenRandom_: ; 13a8f (4:7a8f)
|
||||
; generate a random 16-bit integer and store it at $FFD3,$FFD4
|
||||
ld a,[rDIV]
|
||||
ld b,a
|
||||
ld a,[H_RAND1]
|
||||
Random_::
|
||||
; Generate a random 16-bit value.
|
||||
ld a, [rDIV]
|
||||
ld b, a
|
||||
ld a, [hRandomAdd]
|
||||
adc b
|
||||
ld [H_RAND1],a
|
||||
ld a,[rDIV]
|
||||
ld b,a
|
||||
ld a,[H_RAND2]
|
||||
ld [hRandomAdd], a
|
||||
ld a, [rDIV]
|
||||
ld b, a
|
||||
ld a, [hRandomSub]
|
||||
sbc b
|
||||
ld [H_RAND2],a
|
||||
ld [hRandomSub], a
|
||||
ret
|
||||
|
|
|
@ -179,7 +179,7 @@ SlotMachine_37480: ; 37480 (d:7480)
|
|||
ld a, [W_SUBANIMSUBENTRYADDR]
|
||||
and a
|
||||
jr nz, .skip1
|
||||
call GenRandom
|
||||
call Random
|
||||
and a
|
||||
jr z, .skip2
|
||||
ld b, a
|
||||
|
@ -578,7 +578,7 @@ SlotReward300Func: ; 37702 (d:7702)
|
|||
call PrintText
|
||||
ld a, (SFX_1f_3b - SFX_Headers_1f) / 3
|
||||
call PlaySound
|
||||
call GenRandom
|
||||
call Random
|
||||
cp $80
|
||||
ld a, $0
|
||||
jr c, .skip
|
||||
|
|
|
@ -256,7 +256,7 @@ Func_4496: ; 4496 (1:4496)
|
|||
|
||||
.new
|
||||
; Generate a new TitleMon.
|
||||
call GenRandom
|
||||
call Random
|
||||
and $f
|
||||
ld c, a
|
||||
ld b, 0
|
||||
|
|
4
hram.asm
4
hram.asm
|
@ -98,8 +98,8 @@ REDRAWROW EQU 2
|
|||
|
||||
H_SCREENEDGEREDRAWADDR EQU $FFD1
|
||||
|
||||
H_RAND1 EQU $FFD3
|
||||
H_RAND2 EQU $FFD4
|
||||
hRandomAdd EQU $FFD3
|
||||
hRandomSub EQU $FFD4
|
||||
|
||||
H_FRAMECOUNTER EQU $FFD5 ; decremented every V-blank (used for delays)
|
||||
|
||||
|
|
55
main.asm
55
main.asm
|
@ -5033,7 +5033,7 @@ VBlank::
|
|||
|
||||
; VBlank-sensitive operations end.
|
||||
|
||||
call GenRandom
|
||||
call Random
|
||||
|
||||
ld a, [H_VBLANKOCCURRED]
|
||||
and a
|
||||
|
@ -9907,12 +9907,12 @@ GoPAL_SET:: ; 3def (0:3def)
|
|||
ld a,$45
|
||||
jp Predef
|
||||
|
||||
; hl points to where the color gets stored
|
||||
; e contains the number of pixels filled in the health bar (out of 48)
|
||||
GetHealthBarColor:: ; 3df9 (0:3df9)
|
||||
GetHealthBarColor::
|
||||
; Return at hl the palette of
|
||||
; an HP bar e pixels long.
|
||||
ld a, e
|
||||
cp 27
|
||||
ld d, $0 ; green
|
||||
ld d, 0 ; green
|
||||
jr nc, .gotColor
|
||||
cp 10
|
||||
inc d ; yellow
|
||||
|
@ -9940,9 +9940,11 @@ Func_3e08:: ; 3e08 (0:3e08)
|
|||
call LoadFontTilePatterns
|
||||
jp UpdateSprites
|
||||
|
||||
GiveItem:: ; 3e2e (0:3e2e)
|
||||
; Give player quantity c of item b, and copy item name to $cf4b.
|
||||
; Set carry on success. If no room in bag, reset carry.
|
||||
|
||||
GiveItem::
|
||||
; Give player quantity c of item b,
|
||||
; and copy the item's name to $cf4b.
|
||||
; Return carry on success.
|
||||
ld a, b
|
||||
ld [$d11e], a
|
||||
ld [$cf91], a
|
||||
|
@ -9951,12 +9953,13 @@ GiveItem:: ; 3e2e (0:3e2e)
|
|||
ld hl,wNumBagItems
|
||||
call AddItemToInventory
|
||||
ret nc
|
||||
call GetItemName ; $2fcf
|
||||
call GetItemName
|
||||
call CopyStringToCF4B
|
||||
scf
|
||||
ret
|
||||
|
||||
GivePokemon:: ; 3e48 (0:3e48)
|
||||
GivePokemon::
|
||||
; Give the player monster b at level c.
|
||||
ld a, b
|
||||
ld [$cf91], a
|
||||
ld a, c
|
||||
|
@ -9967,13 +9970,15 @@ GivePokemon:: ; 3e48 (0:3e48)
|
|||
ld hl, _GivePokemon
|
||||
jp Bankswitch
|
||||
|
||||
GenRandom:: ; 3e5c (0:3e5c)
|
||||
; store a random 8-bit value in a
|
||||
|
||||
Random::
|
||||
; Return a random number in a.
|
||||
; For battles, use BattleRandom.
|
||||
push hl
|
||||
push de
|
||||
push bc
|
||||
callba GenRandom_
|
||||
ld a,[H_RAND1]
|
||||
callba Random_
|
||||
ld a,[hRandomAdd]
|
||||
pop bc
|
||||
pop de
|
||||
pop hl
|
||||
|
@ -11075,7 +11080,7 @@ Func_4ed1: ; 4ed1 (1:4ed1)
|
|||
jr .asm_4f5f
|
||||
.asm_4f59
|
||||
call getTileSpriteStandsOn
|
||||
call GenRandom
|
||||
call Random
|
||||
.asm_4f5f
|
||||
ld b, a
|
||||
ld a, [wCurSpriteMovement2]
|
||||
|
@ -11235,11 +11240,11 @@ UpdateSpriteInWalkingAnimation: ; 4ffe (1:4ffe)
|
|||
ld [hl], $1 ; c1x1 = 1 (movement status ready)
|
||||
ret
|
||||
.initNextMovementCounter
|
||||
call GenRandom
|
||||
call Random
|
||||
ld a, [H_CURRENTSPRITEOFFSET]
|
||||
add $8
|
||||
ld l, a
|
||||
ld a, [H_RAND1] ; $ffd3
|
||||
ld a, [hRandomAdd]
|
||||
and $7f
|
||||
ld [hl], a ; c2x8: set next movement delay to a random value in [0,$7f]
|
||||
dec h ; note that value 0 actually makes the delay $100 (bug?)
|
||||
|
@ -11559,8 +11564,8 @@ CanWalkOntoTile: ; 516e (1:516e)
|
|||
ld a, [H_CURRENTSPRITEOFFSET]
|
||||
add $8
|
||||
ld l, a
|
||||
call GenRandom
|
||||
ld a, [H_RAND1] ; $ffd3
|
||||
call Random
|
||||
ld a, [hRandomAdd]
|
||||
and $7f
|
||||
ld [hl], a ; c2x8: set next movement delay to a random value in [0,$7f] (again with delay $100 if value is 0)
|
||||
scf ; set carry (marking failure to walk)
|
||||
|
@ -14846,9 +14851,9 @@ _AddPokemonToParty: ; f2e5 (3:72e5)
|
|||
ld a, [W_ISINBATTLE] ; $d057
|
||||
and a
|
||||
jr nz, .copyEnemyMonData
|
||||
call GenRandom ; generate random IVs
|
||||
call Random ; generate random IVs
|
||||
ld b, a
|
||||
call GenRandom
|
||||
call Random
|
||||
.writeFreshMonData ; f3b3
|
||||
push bc
|
||||
ld bc, $1b
|
||||
|
@ -15602,11 +15607,11 @@ Func_f839: ; f839 (3:7839)
|
|||
ret
|
||||
|
||||
InitializePlayerData: ; f850 (3:7850)
|
||||
call GenRandom
|
||||
ld a, [H_RAND2]
|
||||
call Random
|
||||
ld a, [hRandomSub]
|
||||
ld [wPlayerID], a ; set player trainer id
|
||||
call GenRandom
|
||||
ld a, [H_RAND1]
|
||||
call Random
|
||||
ld a, [hRandomAdd]
|
||||
ld [wPlayerID + 1], a
|
||||
ld a, $ff
|
||||
ld [$d71b], a ; XXX what's this?
|
||||
|
|
|
@ -11,7 +11,7 @@ CeladonGameCornerScript_48bcf: ; 48bcf (12:4bcf)
|
|||
bit 6, [hl]
|
||||
res 6, [hl]
|
||||
ret z
|
||||
call GenRandom
|
||||
call Random
|
||||
ld a, [$ffd3]
|
||||
cp $7
|
||||
jr nc, .asm_48be2
|
||||
|
|
|
@ -14,7 +14,7 @@ VermilionCityScript: ; 197a1 (6:57a1)
|
|||
jp CallFunctionInTable
|
||||
|
||||
VermilionCityScript_197c0: ; 197c0 (6:57c0)
|
||||
call GenRandom
|
||||
call Random
|
||||
ld a, [$ffd4]
|
||||
and $e
|
||||
ld [$d743], a
|
||||
|
|
Loading…
Reference in a new issue