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:
Rangi
2018-08-25 14:28:22 -04:00
parent 376c64468b
commit eb1e3636bb
243 changed files with 4706 additions and 4661 deletions

View File

@@ -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