ref: 2184b60a0cb5e3d1c2b64f7787f3fc0da5efbcab
parent: ec8869584ff7a02ab1ca12fe8b5e6652034f2f17
author: Rangi <remy.oukaour+rangi42@gmail.com>
date: Mon Apr 8 14:50:10 EDT 2019
Identify and eliminate wEngineBuffer1-5
--- a/constants/phone_constants.asm
+++ b/constants/phone_constants.asm
@@ -65,7 +65,7 @@
const PHONE_CONTACT_SCRIPT2_BANK
const PHONE_CONTACT_SCRIPT2_ADDR_LO
const PHONE_CONTACT_SCRIPT2_ADDR_HI
-PHONE_TABLE_WIDTH EQU const_value
+PHONE_CONTACT_SIZE EQU const_value
; maximum number of pokegear contacts
CONTACT_LIST_SIZE EQU 10
--- a/docs/bugs_and_glitches.md
+++ b/docs/bugs_and_glitches.md
@@ -1276,7 +1276,7 @@
.CheckWarp:
-; Bug: Since no case is made for STANDING here, it will check
-; [.edgewarps + $ff]. This resolves to $3e at $8035a.
--; This causes wd041 to be nonzero when standing on tile $3e,
+-; This causes wWalkingIntoEdgeWarp to be nonzero when standing on tile $3e,
-; making bumps silent.
-
ld a, [wWalkingDirection]
@@ -1292,8 +1292,8 @@
cp [hl]
jr nz, .not_warp
- ld a, 1
- ld [wd041], a
+ ld a, TRUE
+ ld [wWalkingIntoEdgeWarp], a
ld a, [wWalkingDirection]
- ; This is in the wrong place.
- cp STANDING
--- a/docs/event_commands.md
+++ b/docs/event_commands.md
@@ -489,7 +489,7 @@
## `$93`: `endall`
-## `$94`: <code>pokemart <i>dialog_id</i>, <i>mart_id</i></code>
+## `$94`: <code>pokemart <i>mart_type</i>, <i>mart_id</i></code>
## `$95`: <code>elevator <i>floor_list</i></code>
--- a/engine/events/elevator.asm
+++ b/engine/events/elevator.asm
@@ -28,7 +28,7 @@
.LoadFloors:
ld de, wCurElevator
- ld bc, 4
+ ld bc, wElevatorDataEnd - wElevatorData
ld hl, wElevatorPointer
ld a, [hli]
ld h, [hl]
@@ -104,12 +104,12 @@
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
--- a/engine/events/misc_scripts.asm
+++ b/engine/events/misc_scripts.asm
@@ -40,14 +40,14 @@
.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
--- a/engine/events/misc_scripts_2.asm
+++ b/engine/events/misc_scripts_2.asm
@@ -12,7 +12,7 @@
HiddenItemScript::
opentext
- readmem wEngineBuffer3
+ readmem wHiddenItemID
getitemname STRING_BUFFER_3, USE_SCRIPT_VAR
writetext .found_text
giveitem ITEM_FROM_MEM
@@ -42,7 +42,7 @@
text_end
SetMemEvent:
- ld hl, wEngineBuffer1
+ ld hl, wHiddenItemEvent
ld a, [hli]
ld d, [hl]
ld e, a
--- a/engine/events/mom_phone.asm
+++ b/engine/events/mom_phone.asm
@@ -39,13 +39,13 @@
.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
--- a/engine/events/overworld.asm
+++ b/engine/events/overworld.asm
@@ -500,7 +500,7 @@
jr z, .quit
; Must be facing water.
- ld a, [wEngineBuffer1]
+ ld a, [wFacingTileID]
call GetTileCollision
cp WATERTILE
jr nz, .quit
--- a/engine/events/poisonstep.asm
+++ b/engine/events/poisonstep.asm
@@ -4,12 +4,12 @@
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
@@ -16,17 +16,17 @@
.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 @@
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 @@
.CheckWhitedOut:
xor a
ld [wCurPartyMon], a
- ld de, wEngineBuffer2
+ ld de, wPoisonStepPartyFlags
.party_loop
push de
ld a, [de]
--- a/engine/items/mart.asm
+++ b/engine/items/mart.asm
@@ -9,9 +9,9 @@
OpenMartDialog::
call GetMart
ld a, c
- ld [wEngineBuffer1], a
+ ld [wMartType], a
call LoadMartPointer
- ld a, [wEngineBuffer1]
+ ld a, [wMartType]
ld hl, .dialogs
rst JumpTable
ret
@@ -24,10 +24,10 @@
dw RooftopSale
MartDialog:
- ld a, 0
- ld [wEngineBuffer1], a
+ ld a, MARTTYPE_STANDARD
+ ld [wMartType], a
xor a ; STANDARDMART_HOWMAYIHELPYOU
- ld [wEngineBuffer5], a
+ ld [wMartJumptableIndex], a
call StandardMart
ret
@@ -105,8 +105,8 @@
xor a
ld bc, wCurMartEnd - wCurMart
call ByteFill
- xor a
- ld [wEngineBuffer5], a
+ xor a ; STANDARDMART_HOWMAYIHELPYOU
+ ld [wMartJumptableIndex], a
ld [wBargainShopFlags], a
ld [wFacingDirection], a
ret
@@ -138,13 +138,15 @@
const STANDARDMART_QUIT ; 4
const STANDARDMART_ANYTHINGELSE ; 5
+STANDARDMART_EXIT EQU -1
+
StandardMart:
.loop
- ld a, [wEngineBuffer5]
+ ld a, [wMartJumptableIndex]
ld hl, .MartFunctions
rst JumpTable
- ld [wEngineBuffer5], a
- cp -1
+ ld [wMartJumptableIndex], a
+ cp STANDARDMART_EXIT
jr nz, .loop
ret
@@ -202,7 +204,7 @@
call ExitMenu
ld hl, Text_Mart_ComeAgain
call MartTextBox
- ld a, -1
+ ld a, STANDARDMART_EXIT
ret
.AnythingElse:
@@ -346,7 +348,7 @@
LoadBuyMenuText:
; load text from a nested table
-; which table is in wEngineBuffer1
+; which table is in wMartType
; which entry is in register a
push af
call GetMartDialogGroup ; gets a pointer from GetMartDialogGroup.MartTextFunctionPointers
@@ -376,7 +378,7 @@
jp RooftopSaleAskPurchaseQuantity
GetMartDialogGroup:
- ld a, [wEngineBuffer1]
+ ld a, [wMartType]
ld e, a
ld d, 0
ld hl, .MartTextFunctionPointers
--- a/engine/overworld/events.asm
+++ b/engine/overworld/events.asm
@@ -602,8 +602,8 @@
ld h, [hl]
ld l, a
call GetMapScriptsBank
- ld de, wEngineBuffer1
- ld bc, 2
+ ld de, wItemBallData
+ ld bc, wItemBallDataEnd - wItemBallData
call FarCopyBytes
ld a, PLAYEREVENT_ITEMBALL
scf
@@ -638,7 +638,7 @@
ret
.is_bg_event:
- ld a, [wEngineBuffer3]
+ ld a, [wCurBGEventType]
ld hl, .bg_events
rst JumpTable
ret
@@ -675,7 +675,7 @@
.read
call PlayTalkObject
- ld hl, wEngineBuffer4
+ ld hl, wCurBGEventScriptAddr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -689,8 +689,8 @@
jp nz, .dontread
call PlayTalkObject
call GetMapScriptsBank
- ld de, wEngineBuffer1
- ld bc, 3
+ ld de, wHiddenItemData
+ ld bc, wHiddenItemDataEnd - wHiddenItemData
call FarCopyBytes
ld a, BANK(HiddenItemScript)
ld hl, HiddenItemScript
@@ -702,8 +702,8 @@
call CheckBGEventFlag
jr nz, .dontread
call GetMapScriptsBank
- ld de, wEngineBuffer1
- ld bc, 3
+ ld de, wHiddenItemData
+ ld bc, wHiddenItemDataEnd - wHiddenItemData
call FarCopyBytes
jr .dontread
@@ -734,7 +734,7 @@
ret
CheckBGEventFlag:
- ld hl, wEngineBuffer4
+ ld hl, wCurBGEventScriptAddr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -1076,7 +1076,7 @@
TryTileCollisionEvent::
call GetFacingTileCoord
- ld [wEngineBuffer1], a
+ ld [wFacingTileID], a
ld c, a
farcall CheckFacingTileForStdScript
jr c, .done
@@ -1087,7 +1087,7 @@
jr .done
.whirlpool
- ld a, [wEngineBuffer1]
+ ld a, [wFacingTileID]
call CheckWhirlpoolTile
jr nz, .waterfall
farcall TryWhirlpoolOW
@@ -1094,7 +1094,7 @@
jr .done
.waterfall
- ld a, [wEngineBuffer1]
+ ld a, [wFacingTileID]
call CheckWaterfallTile
jr nz, .headbutt
farcall TryWaterfallOW
@@ -1101,7 +1101,7 @@
jr .done
.headbutt
- ld a, [wEngineBuffer1]
+ ld a, [wFacingTileID]
call CheckHeadbuttTreeTile
jr nz, .surf
farcall TryHeadbuttOW
--- a/engine/overworld/player_movement.asm
+++ b/engine/overworld/player_movement.asm
@@ -4,7 +4,7 @@
ld a, movement_step_sleep
ld [wMovementAnimation], a
xor a
- ld [wd041], a
+ ld [wWalkingIntoEdgeWarp], a
call .TranslateIntoMovement
ld c, a
ld a, [wMovementAnimation]
@@ -98,7 +98,7 @@
jr z, .Standing
; Walking into an edge warp won't bump.
- ld a, [wEngineBuffer4]
+ ld a, [wWalkingIntoEdgeWarp]
and a
jr nz, .CantMove
call .BumpSound
@@ -321,17 +321,17 @@
.TrySurf:
call .CheckSurfPerms
- ld [wd040], a
+ ld [wWalkingIntoLand], a
jr c, .surf_bump
call .CheckNPC
- ld [wd03f], a
+ ld [wWalkingIntoNPC], a
and a
jr z, .surf_bump
cp 2
jr z, .surf_bump
- ld a, [wd040]
+ ld a, [wWalkingIntoLand]
and a
jr nz, .ExitWater
@@ -395,7 +395,7 @@
.CheckWarp:
; Bug: Since no case is made for STANDING here, it will check
; [.edgewarps + $ff]. This resolves to $3e at $8035a.
-; This causes wd041 to be nonzero when standing on tile $3e,
+; This causes wWalkingIntoEdgeWarp to be nonzero when standing on tile $3e,
; making bumps silent.
ld a, [wWalkingDirection]
@@ -409,8 +409,8 @@
cp [hl]
jr nz, .not_warp
- ld a, 1
- ld [wd041], a
+ ld a, TRUE
+ ld [wWalkingIntoEdgeWarp], a
ld a, [wWalkingDirection]
; This is in the wrong place.
cp STANDING
--- a/engine/overworld/player_object.asm
+++ b/engine/overworld/player_object.asm
@@ -518,7 +518,7 @@
call InitMovementBuffer
ld a, movement_step_sleep
call AppendToMovementBuffer
- ld a, [wd03f]
+ ld a, [wWalkingIntoNPC]
dec a
jr z, .TerminateStep
ldh a, [hLastTalked]
--- a/engine/overworld/scripting.asm
+++ b/engine/overworld/scripting.asm
@@ -637,7 +637,7 @@
Script_pokemart:
; script command 0x94
-; parameters: dialog_id, mart_id
+; parameters: mart_type, mart_id
call GetScriptByte
ld c, a
@@ -765,7 +765,7 @@
ld a, [hli]
ld h, [hl]
ld l, a
- ld a, [wEngineBuffer1]
+ ld a, [wSeenTrainerBank]
ld b, a
call MapTextbox
ret
@@ -777,7 +777,7 @@
ld a, [hli]
ld h, [hl]
ld l, a
- ld a, [wEngineBuffer1]
+ ld a, [wSeenTrainerBank]
ld b, a
jp ScriptJump
@@ -787,7 +787,7 @@
xor a
ld [wScriptVar], a
- ld hl, wd041
+ ld hl, wTempTrainerEventFlag
ld e, [hl]
inc hl
ld d, [hl]
--- a/engine/phone/phone.asm
+++ b/engine/phone/phone.asm
@@ -163,12 +163,13 @@
ChooseRandomCaller:
; If no one is available to call, don't return anything.
- ld a, [wEngineBuffer3]
+ ld a, [wNumAvailableCallers]
and a
jr z, .NothingToSample
-; Sample a random number between 0 and 31.
+; Store the number of available callers in c.
ld c, a
+; Sample a random number between 0 and 31.
call Random
ldh a, [hRandomAdd]
swap a
@@ -178,7 +179,7 @@
; Return the caller ID you just sampled.
ld c, a
ld b, 0
- ld hl, wEngineBuffer4
+ ld hl, wAvailableCallers
add hl, bc
ld a, [hl]
scf
@@ -191,9 +192,9 @@
GetAvailableCallers:
farcall CheckTime
ld a, c
- ld [wEngineBuffer1], a
- ld hl, wEngineBuffer3
- ld bc, 11
+ ld [wCheckedTime], a
+ ld hl, wNumAvailableCallers
+ ld bc, CONTACT_LIST_SIZE + 1
xor a
call ByteFill
ld de, wPhoneList
@@ -200,14 +201,14 @@
ld a, CONTACT_LIST_SIZE
.loop
- ld [wEngineBuffer2], a
+ ld [wPhoneListIndex], a
ld a, [de]
and a
jr z, .not_good_for_call
ld hl, PhoneContacts + PHONE_CONTACT_SCRIPT2_TIME
- ld bc, PHONE_TABLE_WIDTH
+ ld bc, PHONE_CONTACT_SIZE
call AddNTimes
- ld a, [wEngineBuffer1]
+ ld a, [wCheckedTime]
and [hl]
jr z, .not_good_for_call
ld bc, PHONE_CONTACT_MAP_GROUP - PHONE_CONTACT_SCRIPT2_TIME
@@ -220,18 +221,18 @@
cp [hl]
jr z, .not_good_for_call
.different_map
- ld a, [wEngineBuffer3]
+ ld a, [wNumAvailableCallers]
ld c, a
ld b, $0
inc a
- ld [wEngineBuffer3], a
- ld hl, wEngineBuffer4
+ ld [wNumAvailableCallers], a
+ ld hl, wAvailableCallers
add hl, bc
ld a, [de]
ld [hl], a
.not_good_for_call
inc de
- ld a, [wEngineBuffer2]
+ ld a, [wPhoneListIndex]
dec a
jr nz, .loop
ret
@@ -261,7 +262,7 @@
push hl
call LoadCallerScript
pop hl
- ld de, wPhoneScriptPointer
+ ld de, wCallerContact + PHONE_CONTACT_SCRIPT2_BANK
ld a, [hli]
ld [de], a
inc de
@@ -323,7 +324,7 @@
ld a, b
ld [wCurCaller], a
ld hl, PhoneContacts
- ld bc, PHONE_TABLE_WIDTH
+ ld bc, PHONE_CONTACT_SIZE
call AddNTimes
ld d, h
ld e, l
@@ -398,13 +399,13 @@
.actualcaller
ld hl, PhoneContacts
- ld bc, 12
+ ld bc, PHONE_CONTACT_SIZE
ld a, e
call AddNTimes
ld a, BANK(PhoneContacts)
.proceed
- ld de, wEngineBuffer2
- ld bc, 12
+ ld de, wCallerContact
+ ld bc, PHONE_CONTACT_SIZE
call FarCopyBytes
ret
@@ -422,7 +423,7 @@
Script_ReceivePhoneCall:
refreshscreen
callasm RingTwice_StartCall
- memcall wPhoneScriptPointer
+ memcall wCallerContact + PHONE_CONTACT_SCRIPT2_BANK
waitbutton
callasm HangUp
closetext
@@ -620,7 +621,7 @@
GetCallerTrainerClass:
push hl
ld hl, PhoneContacts + PHONE_CONTACT_TRAINER_CLASS
- ld bc, PHONE_TABLE_WIDTH
+ ld bc, PHONE_CONTACT_SIZE
call AddNTimes
ld a, [hli]
ld b, [hl]
@@ -687,7 +688,7 @@
push de
ld a, [wCurCaller]
ld hl, PhoneContacts + PHONE_CONTACT_MAP_GROUP
- ld bc, PHONE_TABLE_WIDTH
+ ld bc, PHONE_CONTACT_SIZE
call AddNTimes
ld b, [hl]
inc hl
--- a/home/map.asm
+++ b/home/map.asm
@@ -1782,7 +1782,7 @@
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 @@
.copysign
pop hl
- ld de, wCurBGEventYCoord
+ ld de, wCurBGEvent
ld bc, BG_EVENT_SIZE
call CopyBytes
scf
@@ -1836,7 +1836,7 @@
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 @@
.copy_coord_event
pop hl
- ld de, wCurCoordEventSceneID
+ ld de, wCurCoordEvent
ld bc, COORD_EVENT_SIZE
call CopyBytes
scf
--- a/home/trainers.asm
+++ b/home/trainers.asm
@@ -95,20 +95,20 @@
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
@@ -115,11 +115,11 @@
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::
; 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
--- a/mobile/mobile_5c.asm
+++ b/mobile/mobile_5c.asm
@@ -692,10 +692,10 @@
ld de, wBGPals1
ld bc, 8 palettes
call CopyBytes
- ld hl, wEngineBuffer5
- ld a, $ff
+ ld hl, wOBPals1 palette 0 color 1
+ ld a, LOW(PALRGB_WHITE)
ld [hli], a
- ld a, $7f
+ ld a, HIGH(PALRGB_WHITE)
ld [hl], a
call SetPalettes
pop af
--- a/wram.asm
+++ b/wram.asm
@@ -755,7 +755,6 @@
wc688:: ds 2
wc68a:: ds 4
ds 66
-
ENDU ; c6d0
; This union spans 280 bytes from c6d0 to c7e8.
@@ -1765,12 +1764,20 @@
ds 6
UNION ; d03e
-; engine buffers
-wEngineBuffer1:: db
-wEngineBuffer2:: db
-wEngineBuffer3:: db
-wEngineBuffer4:: db
-wEngineBuffer5:: db
+; trainer data
+wSeenTrainerBank:: db
+wSeenTrainerDistance:: db
+wSeenTrainerDirection:: db
+wTempTrainer::
+wTempTrainerEventFlag:: dw
+wTempTrainerClass:: db
+wTempTrainerID:: db
+wSeenTextPointer:: dw
+wWinTextPointer:: dw
+wLossTextPointer:: dw
+wScriptAfterPointer:: dw
+wRunningTrainerBattleScript:: db
+wTempTrainerEnd::
NEXTU ; d03e
; menu items list
@@ -1783,13 +1790,30 @@
wCurFruit:: db
NEXTU ; d03e
+; item ball data
+wItemBallData::
+wItemBallItemID:: db
+wItemBallQuantity:: db
+wItemBallDataEnd::
+
+NEXTU ; d03e
+; hidden item data
+wHiddenItemData::
+wHiddenItemEvent:: dw
+wHiddenItemID:: db
+wHiddenItemDataEnd::
+
+NEXTU ; d03e
; elevator data
+wElevatorData::
wElevatorPointerBank:: db
wElevatorPointer:: dw
wElevatorOriginFloor:: db
+wElevatorDataEnd::
NEXTU ; d03e
; coord event data
+wCurCoordEvent::
wCurCoordEventSceneID:: db
wCurCoordEventMapY:: db
wCurCoordEventMapX:: db
@@ -1798,6 +1822,7 @@
NEXTU ; d03e
; BG event data
+wCurBGEvent::
wCurBGEventYCoord:: db
wCurBGEventXCoord:: db
wCurBGEventType:: db
@@ -1805,32 +1830,19 @@
NEXTU ; d03e
; mart data
- ds 1
+wMartType:: db
wMartPointerBank:: db
wMartPointer:: dw
- ds 1
+wMartJumptableIndex:: db
wBargainShopFlags:: db
NEXTU ; d03e
-; trainer data
- ds 3
-wTempTrainer::
-wTempTrainerEventFlag:: dw
-wTempTrainerClass:: db
-wTempTrainerID:: db
-wSeenTextPointer:: dw
-wWinTextPointer:: dw
-wLossTextPointer:: dw
-wScriptAfterPointer:: dw
-wRunningTrainerBattleScript:: db
-wTempTrainerEnd::
-
-NEXTU ; d03e
; player movement data
-wCurInput:: db
-wd03f:: db
-wd040:: db
-wd041:: db
+wCurInput::
+wFacingTileID:: db
+wWalkingIntoNPC:: db
+wWalkingIntoLand:: db
+wWalkingIntoEdgeWarp:: db
wMovementAnimation:: db
wWalkingDirection:: db
wFacingDirection:: db
@@ -1846,17 +1858,32 @@
wJumpStdScriptBuffer:: ds 3
NEXTU ; d03e
-; phone script pointer
- ds 10
-wPhoneScriptPointer:: dw
+; phone script data
+wCheckedTime:: db
+wPhoneListIndex:: db
+wNumAvailableCallers:: db
+wAvailableCallers:: ds CONTACT_LIST_SIZE
NEXTU ; d03e
+; phone caller contact
+ ds 1
+wCallerContact:: ds PHONE_CONTACT_SIZE
+
+NEXTU ; d03e
; backup menu data
ds 7
wMenuCursorBufferBackup:: db
wMenuScrollPositionBackup:: db
- ds 31
-ENDU ; d066
+
+NEXTU ; d03e
+; poison step data
+wPoisonStepData::
+wPoisonStepFlagSum:: db
+wPoisonStepPartyFlags:: ds PARTY_LENGTH
+wPoisonStepDataEnd::
+ENDU ; d04f
+
+ ds 23
ENDU ; d066
wTMHMMoveNameBackup:: ds MOVE_NAME_LENGTH ; d066