Identify and eliminate wEngineBuffer1-5

This commit is contained in:
Rangi
2019-04-08 18:50:10 -04:00
parent ec8869584f
commit 2184b60a0c
19 changed files with 194 additions and 164 deletions

View File

@@ -28,7 +28,7 @@ Elevator::
.LoadFloors:
ld de, wCurElevator
ld bc, 4
ld bc, wElevatorDataEnd - wElevatorData
ld hl, wElevatorPointer
ld a, [hli]
ld h, [hl]
@@ -104,12 +104,12 @@ Elevator_GoToFloor:
ld l, a
inc hl
pop af
ld bc, 4
ld bc, wElevatorDataEnd - wElevatorData
call AddNTimes
inc hl
ld de, wBackupWarpNumber
ld a, [wElevatorPointerBank]
ld bc, 3
ld bc, wElevatorDataEnd - wElevatorData - 1
call FarCopyBytes
ret

View File

@@ -40,14 +40,14 @@ FindItemInBallScript::
.TryReceiveItem:
xor a
ld [wScriptVar], a
ld a, [wEngineBuffer1]
ld a, [wItemBallItemID]
ld [wNamedObjectIndexBuffer], a
call GetItemName
ld hl, wStringBuffer3
call CopyName2
ld a, [wEngineBuffer1]
ld a, [wItemBallItemID]
ld [wCurItem], a
ld a, [wCurFruit]
ld a, [wItemBallQuantity]
ld [wItemQuantityChangeBuffer], a
ld hl, wNumItems
call ReceiveItem

View File

@@ -12,7 +12,7 @@ RepelWoreOffScript::
HiddenItemScript::
opentext
readmem wEngineBuffer3
readmem wHiddenItemID
getitemname STRING_BUFFER_3, USE_SCRIPT_VAR
writetext .found_text
giveitem ITEM_FROM_MEM
@@ -42,7 +42,7 @@ HiddenItemScript::
text_end
SetMemEvent:
ld hl, wEngineBuffer1
ld hl, wHiddenItemEvent
ld a, [hli]
ld d, [hl]
ld e, a

View File

@@ -39,13 +39,13 @@ MomTriesToBuySomething::
.ok
ld a, PHONE_MOM
ld [wCurCaller], a
ld bc, wEngineBuffer2
ld hl, 0
ld bc, wCallerContact
ld hl, PHONE_CONTACT_TRAINER_CLASS
add hl, bc
ld [hl], 0
ld [hl], TRAINER_NONE
inc hl
ld [hl], 1
ld hl, wPhoneScriptPointer - wEngineBuffer2
ld [hl], PHONE_MOM
ld hl, PHONE_CONTACT_SCRIPT2_BANK
add hl, bc
ld a, BANK(Mom_GetScriptPointer)
ld [hli], a

View File

@@ -500,7 +500,7 @@ TrySurfOW::
jr z, .quit
; Must be facing water.
ld a, [wEngineBuffer1]
ld a, [wFacingTileID]
call GetTileCollision
cp WATERTILE
jr nz, .quit

View File

@@ -4,29 +4,29 @@ DoPoisonStep::
jr z, .no_faint
xor a
ld c, 7
ld hl, wEngineBuffer1
.loop_clearEngineBuffer1
ld c, wPoisonStepDataEnd - wPoisonStepData
ld hl, wPoisonStepData
.loop_clearPoisonStepData
ld [hli], a
dec c
jr nz, .loop_clearEngineBuffer1
jr nz, .loop_clearPoisonStepData
xor a
ld [wCurPartyMon], a
.loop_check_poison
call .DamageMonIfPoisoned
jr nc, .not_poisoned
; the output flag is stored in c, copy it to the ([wCurPartyMon] + 2)nd EngineBuffer
; and set the corresponding flag in wEngineBuffer1
; the output flag is stored in c, copy it to [wPoisonStepPartyFlags + [wCurPartyMon]]
; and set the corresponding flag in wPoisonStepFlagSum
ld a, [wCurPartyMon]
ld e, a
ld d, 0
ld hl, wEngineBuffer2
ld hl, wPoisonStepPartyFlags
add hl, de
ld [hl], c
ld a, [wEngineBuffer1]
ld a, [wPoisonStepFlagSum]
or c
ld [wEngineBuffer1], a
ld [wPoisonStepFlagSum], a
.not_poisoned
ld a, [wPartyCount]
@@ -35,10 +35,10 @@ DoPoisonStep::
cp [hl]
jr nz, .loop_check_poison
ld a, [wEngineBuffer1]
ld a, [wPoisonStepFlagSum]
and %10
jr nz, .someone_has_fainted
ld a, [wEngineBuffer1]
ld a, [wPoisonStepFlagSum]
and %01
jr z, .no_faint
call .PlayPoisonSFX
@@ -120,7 +120,7 @@ DoPoisonStep::
.CheckWhitedOut:
xor a
ld [wCurPartyMon], a
ld de, wEngineBuffer2
ld de, wPoisonStepPartyFlags
.party_loop
push de
ld a, [de]