You've already forked pokecrystal-board
mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2025-09-08 08:13:02 -07:00
Use labels instead of constants for HRAM
Use explicit ldh instruction to access HRAM locations, don't rely on optimizing ld
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
Function_LoadOpponentTrainerAndPokemons:
|
||||
ld a, [rSVBK]
|
||||
ldh a, [rSVBK]
|
||||
push af
|
||||
ld a, BANK(wBT_OTTrainer)
|
||||
ld [rSVBK], a
|
||||
ldh [rSVBK], a
|
||||
|
||||
; Fill wBT_OTTrainer with zeros
|
||||
xor a
|
||||
@@ -19,11 +19,11 @@ Function_LoadOpponentTrainerAndPokemons:
|
||||
; Set wBT_OTTrainer as start address to write the following data to
|
||||
ld de, wBT_OTTrainer
|
||||
|
||||
ld a, [hRandomAdd]
|
||||
ldh a, [hRandomAdd]
|
||||
ld b, a
|
||||
.resample ; loop to find a random trainer
|
||||
call Random
|
||||
ld a, [hRandomAdd]
|
||||
ldh a, [hRandomAdd]
|
||||
add b
|
||||
ld b, a ; b contains the nr of the trainer
|
||||
if DEF(_CRYSTAL11)
|
||||
@@ -87,7 +87,7 @@ endc
|
||||
jr nz, .copy_bt_trainer_data_loop
|
||||
|
||||
pop af
|
||||
ld [rSVBK], a
|
||||
ldh [rSVBK], a
|
||||
|
||||
ret
|
||||
|
||||
@@ -107,11 +107,11 @@ Function_LoadRandomBattleTowerMon:
|
||||
ld bc, BattleTowerMons2 - BattleTowerMons1 ; size of one level group
|
||||
call AddNTimes
|
||||
|
||||
ld a, [hRandomAdd]
|
||||
ldh a, [hRandomAdd]
|
||||
ld b, a
|
||||
.resample
|
||||
call Random
|
||||
ld a, [hRandomAdd]
|
||||
ldh a, [hRandomAdd]
|
||||
add b
|
||||
ld b, a
|
||||
maskbits BATTLETOWER_NUM_UNIQUE_MON
|
||||
|
||||
Reference in New Issue
Block a user