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

@@ -1782,7 +1782,7 @@ CheckFacingBGEvent::
ret
CheckIfFacingTileCoordIsBGEvent::
; Checks to see if you are facing a BG event. If so, copies it into wEngineBuffer1 and sets carry.
; Checks to see if you are facing a BG event. If so, copies it into wCurBGEvent and sets carry.
ld hl, wCurMapBGEventsPointer
ld a, [hli]
ld h, [hl]
@@ -1813,7 +1813,7 @@ CheckIfFacingTileCoordIsBGEvent::
.copysign
pop hl
ld de, wCurBGEventYCoord
ld de, wCurBGEvent
ld bc, BG_EVENT_SIZE
call CopyBytes
scf
@@ -1836,7 +1836,7 @@ CheckCurrentMapCoordEvents::
ret
.CoordEventCheck:
; Checks to see if you are standing on a coord event. If yes, copies the event to wEngineBuffer1 and sets carry.
; Checks to see if you are standing on a coord event. If yes, copies the event to wCurCoordEvent and sets carry.
ld hl, wCurMapCoordEventsPointer
ld a, [hli]
ld h, [hl]
@@ -1885,7 +1885,7 @@ CheckCurrentMapCoordEvents::
.copy_coord_event
pop hl
ld de, wCurCoordEventSceneID
ld de, wCurCoordEvent
ld bc, COORD_EVENT_SIZE
call CopyBytes
scf

View File

@@ -95,31 +95,31 @@ _CheckTrainerBattle::
pop af
ldh [hLastTalked], a
ld a, b
ld [wEngineBuffer2], a
ld [wSeenTrainerDistance], a
ld a, c
ld [wEngineBuffer3], a
ld [wSeenTrainerDirection], a
jr LoadTrainer_continue
TalkToTrainer::
ld a, 1
ld [wEngineBuffer2], a
ld [wSeenTrainerDistance], a
ld a, -1
ld [wEngineBuffer3], a
ld [wSeenTrainerDirection], a
LoadTrainer_continue::
call GetMapScriptsBank
ld [wEngineBuffer1], a
ld [wSeenTrainerBank], a
ldh a, [hLastTalked]
call GetMapObject
ld hl, MAPOBJECT_SCRIPT_POINTER
add hl, bc
ld a, [wEngineBuffer1]
ld a, [wSeenTrainerBank]
call GetFarHalfword
ld de, wTempTrainer
ld bc, wTempTrainerEnd - wTempTrainer
ld a, [wEngineBuffer1]
ld a, [wSeenTrainerBank]
call FarCopyBytes
xor a
ld [wRunningTrainerBattleScript], a
@@ -136,7 +136,7 @@ FacingPlayerDistance_bc::
FacingPlayerDistance::
; Return carry if the sprite at bc is facing the player,
; and its distance in d.
; its distance in d, and its direction in e.
ld hl, OBJECT_NEXT_MAP_X ; x
add hl, bc