mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2024-09-09 09:51:34 -07:00
Give a name to RandomRange.
This commit is contained in:
parent
a7a95e59f7
commit
dbb7431cde
@ -50,26 +50,35 @@ BattleRandom:: ; 2f9f
|
|||||||
; 2fb1
|
; 2fb1
|
||||||
|
|
||||||
|
|
||||||
Function2fb1:: ; 2fb1
|
RandomRange:: ; 2fb1
|
||||||
|
; Return a random number between 0 and a (non-inclusive).
|
||||||
|
|
||||||
push bc
|
push bc
|
||||||
ld c, a
|
ld c, a
|
||||||
|
|
||||||
|
; b = $100 % c
|
||||||
xor a
|
xor a
|
||||||
sub c
|
sub c
|
||||||
.asm_2fb5
|
.mod
|
||||||
sub c
|
sub c
|
||||||
jr nc, .asm_2fb5
|
jr nc, .mod
|
||||||
add c
|
add c
|
||||||
ld b, a
|
ld b, a
|
||||||
|
|
||||||
|
; Get a random number
|
||||||
|
; from 0 to $ff - b.
|
||||||
push bc
|
push bc
|
||||||
.asm_2fbb
|
.loop
|
||||||
call Random
|
call Random
|
||||||
ld a, [hRandomAdd]
|
ld a, [hRandomAdd]
|
||||||
ld c, a
|
ld c, a
|
||||||
add b
|
add b
|
||||||
jr c, .asm_2fbb
|
jr c, .loop
|
||||||
ld a, c
|
ld a, c
|
||||||
pop bc
|
pop bc
|
||||||
|
|
||||||
call SimpleDivide
|
call SimpleDivide
|
||||||
|
|
||||||
pop bc
|
pop bc
|
||||||
ret
|
ret
|
||||||
; 2fcb
|
; 2fcb
|
||||||
|
24
main.asm
24
main.asm
@ -87348,7 +87348,7 @@ Functionb8219: ; b8219
|
|||||||
jr nc, .quit
|
jr nc, .quit
|
||||||
|
|
||||||
ld a, 10
|
ld a, 10
|
||||||
call Function2fb1
|
call RandomRange
|
||||||
cp 4
|
cp 4
|
||||||
jr nc, .quit
|
jr nc, .quit
|
||||||
|
|
||||||
@ -87631,23 +87631,23 @@ Functionb83e5: ; b83e5
|
|||||||
ret
|
ret
|
||||||
|
|
||||||
.asm_b83f6
|
.asm_b83f6
|
||||||
ld a, $a
|
ld a, 10
|
||||||
call Function2fb1
|
call RandomRange
|
||||||
and a
|
and a
|
||||||
jr nz, Functionb843b
|
jr nz, Functionb843b
|
||||||
jr Functionb841f
|
jr Functionb841f
|
||||||
|
|
||||||
.asm_b8400
|
.asm_b8400
|
||||||
ld a, $a
|
ld a, 10
|
||||||
call Function2fb1
|
call RandomRange
|
||||||
cp $5
|
cp 5
|
||||||
jr nc, Functionb843b
|
jr nc, Functionb843b
|
||||||
jr Functionb841f
|
jr Functionb841f
|
||||||
|
|
||||||
.asm_b840b
|
.asm_b840b
|
||||||
ld a, $a
|
ld a, 10
|
||||||
call Function2fb1
|
call RandomRange
|
||||||
cp $8
|
cp 8
|
||||||
jr nc, Functionb843b
|
jr nc, Functionb843b
|
||||||
jr .asm_b8416
|
jr .asm_b8416
|
||||||
|
|
||||||
@ -87663,7 +87663,7 @@ Functionb841f: ; b841f
|
|||||||
; Read a TreeMons table.
|
; Read a TreeMons table.
|
||||||
|
|
||||||
ld a, 100
|
ld a, 100
|
||||||
call Function2fb1
|
call RandomRange
|
||||||
.asm_b8424
|
.asm_b8424
|
||||||
sub [hl]
|
sub [hl]
|
||||||
jr c, .asm_b842c
|
jr c, .asm_b842c
|
||||||
@ -99806,8 +99806,8 @@ Functionfd044: ; fd044
|
|||||||
|
|
||||||
.asm_fd08b
|
.asm_fd08b
|
||||||
call Functionfd099
|
call Functionfd099
|
||||||
ld a, $5
|
ld a, 5
|
||||||
call Function2fb1
|
call RandomRange
|
||||||
inc a
|
inc a
|
||||||
ld [$dc18], a
|
ld [$dc18], a
|
||||||
scf
|
scf
|
||||||
|
Loading…
Reference in New Issue
Block a user