summaryrefslogtreecommitdiff
path: root/wram.asm
diff options
context:
space:
mode:
Diffstat (limited to 'wram.asm')
-rwxr-xr-xwram.asm2398
1 files changed, 1667 insertions, 731 deletions
diff --git a/wram.asm b/wram.asm
index ee7d2afe..47502613 100755
--- a/wram.asm
+++ b/wram.asm
@@ -50,6 +50,7 @@ battle_struct: MACRO
\1Moves:: ds NUM_MOVES
\1DVs:: ds 2
\1Level:: db
+\1Stats::
\1MaxHP:: dw
\1Attack:: dw
\1Defense:: dw
@@ -59,72 +60,154 @@ battle_struct: MACRO
ENDM
-SECTION "WRAM Bank 0", WRAM0
-
-wc000:: ds 1
-wc001:: ds 1
-wc002:: ds 1
-wc003:: ds 1
-wc004:: ds 1
-wc005:: ds 1
-wc006:: ds 8
-wc00e:: ds 4
-wc012:: ds 4
-wc016:: ds 16
-wc026:: ds 1
-wc027:: ds 1
-wc028:: ds 2
-wc02a:: ds 1
-wc02b:: ds 1
-wc02c:: ds 1
-wc02d:: ds 1
-wc02e:: ds 8
-wc036:: ds 8
-wc03e:: ds 8
-wc046:: ds 8
-wc04e:: ds 8
-wc056:: ds 8
-wc05e:: ds 8
-wc066:: ds 8
-wc06e:: ds 8
-wc076:: ds 8
-wc07e:: ds 8
-wc086:: ds 8
-wc08e:: ds 8
-wc096:: ds 8
-wc09e:: ds 8
-wc0a6:: ds 8
-wc0ae:: ds 8
-wc0b6:: ds 8
-wc0be:: ds 8
-wc0c6:: ds 8
-wc0ce:: ds 1
-wc0cf:: ds 1
-wc0d0:: ds 1
-wc0d1:: ds 1
-wc0d2:: ds 1
-wc0d3:: ds 1
-wc0d4:: ds 1
-wc0d5:: ds 1
-wc0d6:: ds 8
-wc0de:: ds 8
-wc0e6:: ds 1
-wc0e7:: ds 1
-wc0e8:: ds 1
-wc0e9:: ds 1
-wc0ea:: ds 1
-wc0eb:: ds 1
-wc0ec:: ds 1
-wc0ed:: ds 1
-wc0ee:: ds 1
-wc0ef:: ds 1
-wc0f0:: ds 1
-wc0f1:: ds 1
-wc0f2:: ds 14
+SECTION "WRAM Bank 0", WRAM0 [$c000]
+
+wUnusedC000:: ; c000
+ ds 1
+
+wSoundID:: ; c001
+ ds 1
+
+wMuteAudioAndPauseMusic:: ; c002
+; bit 7: whether sound has been muted
+; all bits: whether the effective is active
+; Store 1 to activate effect (any value in the range [1, 127] works).
+; All audio is muted and music is paused. Sfx continues playing until it
+; ends normally.
+; Store 0 to resume music.
+ ds 1
+
+wDisableChannelOutputWhenSfxEnds:: ; c003
+ ds 1
+
+wStereoPanning:: ; c004
+ ds 1
+
+wSavedVolume:: ; c005
+ ds 1
+
+wChannelCommandPointers:: ; c006
+ ds 16
+
+wChannelReturnAddresses:: ; c016
+ ds 16
+
+wChannelSoundIDs:: ; c026
+ ds 8
+
+wChannelFlags1:: ; c02e
+ ds 8
+
+wChannelFlags2:: ; c036
+ ds 8
+
+wChannelDuties:: ; c03e
+ ds 8
+
+wChannelDutyCycles:: ; c046
+ ds 8
+
+wChannelVibratoDelayCounters:: ; c04e
+; reloaded at the beginning of a note. counts down until the vibrato begins.
+ ds 8
+
+wChannelVibratoExtents:: ; c056
+ ds 8
+
+wChannelVibratoRates:: ; c05e
+; high nybble is rate (counter reload value) and low nybble is counter.
+; time between applications of vibrato.
+ ds 8
+
+wChannelFrequencyLowBytes:: ; c066
+ ds 8
+
+wChannelVibratoDelayCounterReloadValues:: ; c06e
+; delay of the beginning of the vibrato from the start of the note
+ ds 8
+
+wChannelPitchBendLengthModifiers:: ; c076
+ ds 8
+
+wChannelPitchBendFrequencySteps:: ; c07e
+ ds 8
+
+wChannelPitchBendFrequencyStepsFractionalPart:: ; c086
+ ds 8
+
+wChannelPitchBendCurrentFrequencyFractionalPart:: ; c08e
+ ds 8
+
+wChannelPitchBendCurrentFrequencyHighBytes:: ; c096
+ ds 8
+
+wChannelPitchBendCurrentFrequencyLowBytes:: ; c09e
+ ds 8
+
+wChannelPitchBendTargetFrequencyHighBytes:: ; c0a6
+ ds 8
+
+wChannelPitchBendTargetFrequencyLowBytes:: ; c0ae
+ ds 8
+
+wChannelNoteDelayCounters:: ; c0b6
+; Note delays are stored as 16-bit fixed-point numbers where the integer part
+; is 8 bits and the fractional part is 8 bits.
+ ds 8
+
+wChannelLoopCounters:: ; c0be
+ ds 8
+
+wChannelNoteSpeeds:: ; c0c6
+ ds 8
+
+wChannelNoteDelayCountersFractionalPart:: ; c0ce
+ ds 8
+
+wChannelOctaves:: ; c0d6
+ ds 8
+
+wChannelVolumes:: ; c0de
+; also includes fade for hardware channels that support it
+ ds 8
+
+wMusicWaveInstrument::
+ ds 1
+
+wSfxWaveInstrument::
+ ds 1
+
+wMusicTempo:: ; c0e8
+ ds 2
+
+wSfxTempo:: ; c0ea
+ ds 2
+
+wSfxHeaderPointer:: ; c0ec
+ ds 2
+
+wNewSoundID:: ; c0ee
+ ds 1
+
+wAudioROMBank:: ; c0ef
+ ds 1
+
+wAudioSavedROMBank:: ; c0f0
+ ds 1
+
+wFrequencyModifier:: ; c0f1
+ ds 1
+
+wTempoModifier:: ; c0f2
+ ds 1
+
+ ds 13
SECTION "Sprite State Data", WRAM0[$c100]
+wSpriteDataStart::
+
wSpriteStateData1:: ; c100
; data for all sprites on the current map
; holds info for 16 sprites with $10 bytes each
@@ -145,10 +228,42 @@ wSpriteStateData1:: ; c100
; C1xD
; C1xE
; C1xF
- ds $10 * $10
-
-
-SECTION "Sprite State Data 2", WRAM0[$c200]
+spritestatedata1: MACRO
+\1SpriteStateData1::
+\1PictureID:: db
+\1MovementStatus:: db
+\1SpriteImageIdx:: db
+\1YStepVector:: db
+\1YPixels:: db
+\1XStepVector:: db
+\1XPixels:: db
+\1IntraAnimFrameCounter:: db
+\1AnimFrameCounter:: db
+\1FacingDirection:: db
+ ds 6
+\1SpriteStateData1End::
+endm
+
+ spritestatedata1 Player
+ spritestatedata1 Sprite01
+ spritestatedata1 Sprite02
+ spritestatedata1 Sprite03
+ spritestatedata1 Sprite04
+ spritestatedata1 Sprite05
+ spritestatedata1 Sprite06
+ spritestatedata1 Sprite07
+ spritestatedata1 Sprite08
+ spritestatedata1 Sprite09
+ spritestatedata1 Sprite10
+ spritestatedata1 Sprite11
+ spritestatedata1 Sprite12
+ spritestatedata1 Sprite13
+ spritestatedata1 Sprite14
+ spritestatedata1 Sprite15
+ ; ds $10 * $10
+
+
+;SECTION "Sprite State Data 2", WRAM0[$c200]
wSpriteStateData2:: ; c200
; more data for all sprites on the current map
@@ -170,7 +285,42 @@ wSpriteStateData2:: ; c200
; C2xD
; C2xE: sprite image base offset (in video ram, player always has value 1, used to compute c1x2)
; C2xF
- ds $10 * $10
+spritestatedata2: MACRO
+\1SpriteStateData2::
+\1WalkAnimationCounter:: db
+ ds 1
+\1YDisplacement:: db
+\1XDisplacement:: db
+\1MapY:: db
+\1MapX:: db
+\1MovementByte1:: db
+\1GrassPriority:: db
+\1MovementDelay:: db
+ ds 5
+\1SpriteImageBaseOffset:: db
+ ds 1
+\1SpriteStateData2End::
+endm
+
+ spritestatedata2 Player
+ spritestatedata2 Sprite01
+ spritestatedata2 Sprite02
+ spritestatedata2 Sprite03
+ spritestatedata2 Sprite04
+ spritestatedata2 Sprite05
+ spritestatedata2 Sprite06
+ spritestatedata2 Sprite07
+ spritestatedata2 Sprite08
+ spritestatedata2 Sprite09
+ spritestatedata2 Sprite10
+ spritestatedata2 Sprite11
+ spritestatedata2 Sprite12
+ spritestatedata2 Sprite13
+ spritestatedata2 Sprite14
+ spritestatedata2 Sprite15
+ ; ds $10 * $10
+
+wSpriteDataEnd::
SECTION "OAM Buffer", WRAM0[$c300]
@@ -203,9 +353,9 @@ wTempPic::
wOverworldMap:: ; c6e8
ds 1300
-wScreenEdgeTiles:: ; cbfc
-; the tiles of the row or column to be redrawn by RedrawExposedScreenEdge
- ds 20 * 2
+wRedrawRowOrColumnSrcTiles:: ; cbfc
+; the tiles of the row or column to be redrawn by RedrawRowOrColumn
+ ds SCREEN_WIDTH * 2
; coordinates of the position of the cursor for the top menu item (id 0)
wTopMenuItemY:: ; cc24
@@ -236,14 +386,32 @@ wLastMenuItem:: ; cc2a
; id of previously selected menu item
ds 1
-wcc2b:: ds 1
-wcc2c:: ds 1
-wcc2d:: ds 1
+wPartyAndBillsPCSavedMenuItem:: ; cc2b
+; It is mainly used by the party menu to remember the cursor position while the
+; menu isn't active.
+; It is also used to remember the cursor position of mon lists (for the
+; withdraw/deposit/release actions) in Bill's PC so that it doesn't get lost
+; when you choose a mon from the list and a sub-menu is shown. It's reset when
+; you return to the main Bill's PC menu.
+ ds 1
+
+wBagSavedMenuItem:: ; cc2c
+; It is used by the bag list to remember the cursor position while the menu
+; isn't active.
+ ds 1
+
+wBattleAndStartSavedMenuItem:: ; cc2d
+; It is used by the start menu to remember the cursor position while the menu
+; isn't active.
+; The battle menu uses it so that the cursor position doesn't get lost when
+; a sub-menu is shown. It's reset at the start of each battle.
+ ds 1
wPlayerMoveListIndex:: ; cc2e
ds 1
wPlayerMonNumber:: ; cc2f
+; index in party of currently battling mon
ds 1
wMenuCursorLocation:: ; cc30
@@ -265,15 +433,22 @@ wListScrollOffset:: ; cc36
; keeps track of what section of the list is on screen
ds 1
-wcc37:: ds 1
+wMenuWatchMovingOutOfBounds:: ; cc37
+; If non-zero, then when wrapping is disabled and the player tries to go past
+; the top or bottom of the menu, return from HandleMenuInput. This is useful for
+; menus that have too many items to display at once on the screen because it
+; allows the caller to scroll the entire menu up or down when this happens.
+ ds 1
wTradeCenterPointerTableIndex:: ; cc38
ds 1
ds 1
-wcc3a:: ds 1
-wcc3b:: ds 1
+wTextDest:: ; cc3a
+; destination pointer for text output
+; this variable is written to, but is never read from
+ ds 2
wDoNotWaitForButtonPressAfterDisplayingText:: ; cc3c
; if non-zero, skip waiting for a button press after displaying text in DisplayTextID
@@ -288,8 +463,7 @@ wSerialExchangeNybbleTempReceiveData:: ; cc3d
wLinkMenuSelectionReceiveBuffer:: ; cc3d
; two byte buffer
; the received menu selection is stored twice
-
-wcc3d:: ds 1
+ ds 1
wSerialExchangeNybbleReceiveData:: ; cc3e
; the final received nybble is stored here by Serial_ExchangeNybble
@@ -312,22 +486,40 @@ wLinkTimeoutCounter:: ; cc47
wUnknownSerialCounter:: ; cc47
; 2 bytes
-wcc47:: ds 1
-wcc48:: ds 1
+wEnteringCableClub:: ; cc47
+ ds 1
+
+ ds 1
wWhichTradeMonSelectionMenu:: ; cc49
; $00 = player mons
; $01 = enemy mons
-wcc49:: ds 1
+wMonDataLocation:: ; cc49
+; 0 = player's party
+; 1 = enemy party
+; 2 = current box
+; 3 = daycare
+; 4 = in-battle mon
+;
+; AddPartyMon uses it slightly differently.
+; If the lower nybble is 0, the mon is added to the player's party, else the enemy's.
+; If the entire value is 0, then the player is allowed to name the mon.
+ ds 1
wMenuWrappingEnabled:: ; cc4a
; set to 1 if you can go from the bottom to the top or top to bottom of a menu
; set to 0 if you can't go past the top or bottom of the menu
ds 1
-wcc4b:: ds 2
-wcc4d:: ds 1
+wCheckFor180DegreeTurn:: ; cc4b
+; whether to check for 180-degree turn (0 = don't, 1 = do)
+ ds 1
+
+ ds 1
+
+wMissableObjectIndex:: ; cc4d
+ ds 1
wPredefID:: ; cc4e
ds 1
@@ -350,18 +542,60 @@ wNPCMovementScriptBank:: ; cc58
ds 2
+wUnusedCC5B:: ; cc5b
+
+wVermilionDockTileMapBuffer:: ; cc5b
+; 180 bytes
+
+wOaksAideRewardItemName:: ; cc5b
+
+wDexRatingNumMonsSeen:: ; cc5b
+
+wFilteredBagItems:: ; cc5b
+; List of bag items that has been filtered to a certain type of items,
+; such as drinks or fossils.
+
+wElevatorWarpMaps:: ; cc5b
+
+wMonPartySpritesSavedOAM:: ; cc5b
+; Saved copy of OAM for the first frame of the animation to make it easy to
+; flip back from the second frame.
+; $60 bytes
+
+wTrainerCardBlkPacket:: ; cc5b
+; $40 bytes
+
+wSlotMachineSevenAndBarModeChance:: ; cc5b
+; If a random number greater than this value is generated, then the player is
+; allowed to have three 7 symbols or bar symbols line up.
+; So, this value is actually the chance of NOT entering that mode.
+; If the slot is lucky, it equals 250, giving a 5/256 (~2%) chance.
+; Otherwise, it equals 253, giving a 2/256 (~0.8%) chance.
+
wHallOfFame:: ; cc5b
wBoostExpByExpAll:: ; cc5b
wAnimationType:: ; cc5b
; values between 0-6. Shake screen horizontally, shake screen vertically, blink Pokemon...
-wcc5b:: ds 1
-wcc5c:: ds 1
-wcc5d:: ds 1
-wcc5e:: ds 13
+wNPCMovementDirections:: ; cc5b
+ ds 1
+
+wDexRatingNumMonsOwned:: ; cc5c
+ ds 1
+
+wDexRatingText:: ; cc5d
+ ds 1
+
+wSlotMachineSavedROMBank:: ; cc5e
+; ROM back to return to when the player is done with the slot machine
+ ds 1
+
+ ds 26
+
+wAnimPalette:: ; cc79
+ ds 1
-wcc6b:: ds 14
-wcc79:: ds 30
+ ds 29
wNPCMovementDirections2:: ; cc97
@@ -369,18 +603,33 @@ wSwitchPartyMonTempBuffer:: ; cc97
; temporary buffer when swapping party mon data
ds 10
-wcca1:: ds 49
+wNumStepsToTake:: ; cca1
+; used in Pallet Town scripted movement
+ ds 49
wRLEByteCount:: ; ccd2
ds 1
+wAddedToParty:: ; ccd3
+; 0 = not added
+; 1 = added
+
wSimulatedJoypadStatesEnd:: ; ccd3
; this is the end of the joypad states
; the list starts above this address and extends downwards in memory until here
; overloaded with below labels
-wccd3:: ds 1
-wccd4:: ds 1
+wParentMenuItem:: ; ccd3
+
+wCanEvolveFlags:: ; ccd3
+; 1 flag for each party member indicating whether it can evolve
+; The purpose of these flags is to track which mons levelled up during the
+; current battle at the end of the battle when evolution occurs.
+; Other methods of evolution simply set it by calling TryEvolvingMon.
+ ds 1
+
+wForceEvolution:: ; ccd4
+ ds 1
; if [ccd5] != 1, the second AI layer is not applied
wAILayer2Encouragement:: ; ccd5
@@ -393,7 +642,12 @@ wPlayerSubstituteHP:: ; ccd7
wEnemySubstituteHP:: ; ccd8
ds 1
-wccd9:: ds 2
+wTestBattlePlayerSelectedMove:: ; ccd9
+; The player's selected move during a test battle.
+; InitBattleVariables sets it to the move Pound.
+ ds 1
+
+ ds 1
wMoveMenuType:: ; ccdb
; 0=regular, 1=mimic, 2=above message box (relearn, heal pp..)
@@ -416,8 +670,11 @@ wAICount:: ; ccdf
wEnemyMoveListIndex:: ; cce2
ds 1
-wcce3:: ds 1
-wcce4:: ds 1
+wLastSwitchInEnemyMonHP:: ; cce3
+; The enemy mon's HP when it was switched in or when the current player mon
+; was switched in, which was more recent.
+; It's used to determine the message to print when switching out the player mon.
+ ds 2
wTotalPayDayMoney:: ; cce5
; total amount of money made using Pay Day during the current battle
@@ -430,25 +687,41 @@ wSafariBaitFactor:: ; cce9
ds 1
-wcceb:: ds 1
-wccec:: ds 1
-wMonIsDisobedient:: ds 1
-wccee:: ds 1
-wccef:: ds 1
-wccf0:: ds 1
-wPlayerUsedMove:: ds 1
-wEnemyUsedMove:: ds 1
-wccf3:: ds 1
-wMoveDidntMiss:: ds 1
+wTransformedEnemyMonOriginalDVs:: ; cceb
+ ds 2
+
+wMonIsDisobedient:: ds 1 ; cced
+
+wPlayerDisabledMoveNumber:: ds 1 ; ccee
+wEnemyDisabledMoveNumber:: ds 1 ; ccef
+
+wInHandlePlayerMonFainted:: ; ccf0
+; When running in the scope of HandlePlayerMonFainted, it equals 1.
+; When running in the scope of HandleEnemyMonFainted, it equals 0.
+ ds 1
+
+wPlayerUsedMove:: ds 1 ; ccf1
+wEnemyUsedMove:: ds 1 ; ccf2
+
+wEnemyMonMinimized:: ds 1 ; ccf3
-wPartyFoughtCurrentEnemyFlags::
+wMoveDidntMiss:: ds 1 ; ccf4
+
+wPartyFoughtCurrentEnemyFlags:: ; ccf5
; flags that indicate which party members have fought the current enemy mon
flag_array 6
-wccf6:: ds 1
-wccf7:: ds 14
+wLowHealthAlarmDisabled:: ; ccf6
+; Whether the low health alarm has been disabled due to the player winning the
+; battle.
+ ds 1
-wUnknownSlotVar:: ; cd05
+wPlayerMonMinimized:: ; ccf7
+ ds 1
+
+ ds 13
+
+wLuckySlotHiddenObjectIndex:: ; cd05
wEnemyNumHits:: ; cd05
; number of hits by enemy in attacks like Double Slap, etc.
@@ -456,11 +729,11 @@ wEnemyNumHits:: ; cd05
wEnemyBideAccumulatedDamage:: ; cd05
; the amount of damage accumulated by the enemy while biding (2 bytes)
-ds 10
+ ds 10
wInGameTradeGiveMonSpecies:: ; cd0f
-wPlayerMonUnmodifiedLevel:: ; cd0f
+wPlayerMonUnmodifiedLevel:: ; cd0f
ds 1
wInGameTradeTextPointerTablePointer:: ; cd10
@@ -551,7 +824,11 @@ wInGameTradeReceiveMonSpecies::
wNPCMovementDirections2Index:: ; cd37
-wcd37:: ds 1
+wUnusedCD37:: ; cd37
+
+wFilteredBagItemsCount:: ; cd37
+; number of items in wFilteredBagItems list
+ ds 1
wSimulatedJoypadStatesIndex:: ; cd38
; the next simulated joypad state is at wSimulatedJoypadStatesEnd plus this value minus 1
@@ -573,6 +850,93 @@ wOverrideSimulatedJoypadStatesMask:: ; cd3b
ds 1
+wFallingObjectsMovementData:: ; cd3d
+; up to 20 bytes (one byte for each falling object)
+
+wSavedY:: ; cd3d
+
+wTempSCX:: ; cd3d
+
+wBattleTransitionCircleScreenQuadrantY:: ; cd3d
+; 0 = upper half (Y < 9)
+; 1 = lower half (Y >= 9)
+
+wBattleTransitionCopyTilesOffset:: ; cd3d
+; 2 bytes
+; after 1 row/column has been copied, the offset to the next one to copy from
+
+wInwardSpiralUpdateScreenCounter:: ; cd3d
+; counts down from 7 so that every time 7 more tiles of the spiral have been
+; placed, the tile map buffer is copied to VRAM so that progress is visible
+
+wHoFTeamIndex:: ; cd3d
+
+wSSAnneSmokeDriftAmount:: ; cd3d
+; multiplied by 16 to get the number of times to go right by 2 pixels
+
+wRivalStarterTemp:: ; cd3d
+
+wBoxMonCounts:: ; cd3d
+; 12 bytes
+; array of the number of mons in each box
+
+wDexMaxSeenMon:: ; cd3d
+
+wPPRestoreItem:: ; cd3d
+
+wWereAnyMonsAsleep:: ; cd3d
+
+wCanPlaySlots:: ; cd3d
+
+wNumShakes:: ; cd3d
+
+wDayCareStartLevel:: ; cd3d
+; the level of the mon at the time it entered day care
+
+wWhichBadge:: ; cd3d
+
+wPriceTemp:: ; cd3d
+; 3-byte BCD number
+
+wTitleMonSpecies:: ; cd3d
+
+wPlayerCharacterOAMTile:: ; cd3d
+
+wMoveDownSmallStarsOAMCount:: ; cd3d
+; the number of small stars OAM entries to move down
+
+wChargeMoveNum:: ; cd3d
+
+wCoordIndex:: ; cd3d
+
+wOptionsTextSpeedCursorX:: ; cd3d
+
+wBoxNumString:: ; cd3d
+
+wTrainerInfoTextBoxWidthPlus1:: ; cd3d
+
+wSwappedMenuItem:: ; cd3d
+
+wHoFMonSpecies:: ; cd3d
+
+wFieldMoves:: ; cd3d
+; 4 bytes
+; the current mon's field moves
+
+wBadgeNumberTile:: ; cd3d
+; tile ID of the badge number being drawn
+
+wRodResponse:: ; cd3d
+; 0 = no bite
+; 1 = bite
+; 2 = no fish on map
+
+wWhichTownMapLocation:: ; cd3d
+
+wStoppingWhichSlotMachineWheel:: ; cd3d
+; which wheel the player is trying to stop
+; 0 = none, 1 = wheel 1, 2 = wheel 2, 3 or greater = wheel 3
+
wTradedPlayerMonSpecies:: ; cd3d
wTradingWhichPlayerMon:: ; cd3d
@@ -587,15 +951,44 @@ wPlayerSpinWhileMovingUpOrDownAnimDeltaY:: ; cd3d
wHiddenObjectFunctionArgument:: ; cd3d
-wSubtrahend:: ; cd3d
-; subtract (BCD) wSubtrahend, wSubtrahend+1, wSubtrahend+2
-
wWhichTrade:: ; cd3d
; which entry from TradeMons to select
wTrainerSpriteOffset:: ; cd3d
+
+wUnusedCD3D:: ; cd3d
ds 1
+wHUDPokeballGfxOffsetX:: ; cd3e
+; difference in X between the next ball and the current one
+
+wBattleTransitionCircleScreenQuadrantX:: ; cd3e
+; 0 = left half (X < 10)
+; 1 = right half (X >= 10)
+
+wSSAnneSmokeX:: ; cd3e
+
+wRivalStarterBallSpriteIndex:: ; cd3e
+
+wDayCareNumLevelsGrown:: ; cd3e
+
+wOptionsBattleAnimCursorX:: ; cd3e
+
+wTrainerInfoTextBoxWidth:: ; cd3e
+
+wHoFPartyMonIndex:: ; cd3e
+
+wNumCreditsMonsDisplayed:: ; cd3e
+; the number of credits mons that have been displayed so far
+
+wBadgeNameTile:: ; cd3e
+; first tile ID of the name being drawn
+
+wFlyLocationsList:: ; cd3e
+; 11 bytes plus $ff sentinel values at each end
+
+wSlotMachineWheel1Offset:: ; cd3e
+
wTradedEnemyMonSpecies:: ; cd3e
wTradingWhichEnemyMon:: ; cd3e
@@ -611,6 +1004,27 @@ wHiddenObjectFunctionRomBank:: ; cd3e
wTrainerEngageDistance:: ; cd3e
ds 1
+wHUDGraphicsTiles:: ; cd3f
+; 3 bytes
+
+wDayCareTotalCost:: ; cd3f
+; 2-byte BCD number
+
+wJigglypuffFacingDirections:: ; cd3f
+
+wOptionsBattleStyleCursorX:: ; cd3f
+
+wTrainerInfoTextBoxNextRowOffset:: ; cd3f
+
+wHoFMonLevel:: ; cd3f
+
+wBadgeOrFaceTiles:: ; cd3f
+; 8 bytes
+; a list of the first tile IDs of each badge or face (depending on whether the
+; badge is owned) to be drawn on the trainer screen
+
+wSlotMachineWheel2Offset:: ; cd3f
+
wNameOfPlayerMonToBeTraded:: ; cd3f
wFlyAnimBirdSpriteImageIndex:: ; cd3f
@@ -622,50 +1036,160 @@ wPlayerSpinWhileMovingUpOrDownAnimFrameDelay:: ; cd3f
wHiddenObjectIndex:: ; cd3f
wTrainerFacingDirection:: ; cd3f
-wcd3f::
ds 1
+wHoFMonOrPlayer:: ; cd40
+; show mon or show player?
+; 0 = mon
+; 1 = player
+
+wSlotMachineWheel3Offset:: ; cd40
+
wPlayerSpinInPlaceAnimSoundID:: ; cd40
wHiddenObjectY:: ; cd40
wTrainerScreenY:: ; cd40
+
+wUnusedCD40:: ; cd40
ds 1
+wDayCarePerLevelCost:: ; cd41
+; 2-byte BCD number (always set to $0100)
+
+wHoFTeamIndex2:: ; cd41
+
+wHiddenItemOrCoinsIndex:: ; cd41
+
wTradedPlayerMonOT:: ; cd41
wHiddenObjectX:: ; cd41
+wSlotMachineWinningSymbol:: ; cd41
+; the OAM tile number of the upper left corner of the winning symbol minus 2
+
+wNumFieldMoves:: ; cd41
+
+wSlotMachineWheel1BottomTile:: ; cd41
+
wTrainerScreenX:: ; cd41
ds 1
+; a lot of the uses for these values use more than the said address
-wcd42:: ds 1
-wcd43:: ds 1
-wcd44:: ds 1
-wcd45:: ds 1
-wcd46:: ds 1
-wcd47:: ds 1
-wcd48:: ds 1
-wcd49:: ds 1
-wcd4a:: ds 1
-wcd4b:: ds 1
+wHoFTeamNo:: ; cd42
+
+wSlotMachineWheel1MiddleTile:: ; cd42
+
+wFieldMovesLeftmostXCoord:: ; cd42
+ ds 1
+
+wLastFieldMoveID:: ; cd43
+; unused
+
+wSlotMachineWheel1TopTile:: ; cd43
+ ds 1
+
+wSlotMachineWheel2BottomTile:: ; cd44
+ ds 1
+
+wSlotMachineWheel2MiddleTile:: ; cd45
+ ds 1
+
+wTempCoins1:: ; cd46
+; 2 bytes
+; temporary variable used to add payout amount to the player's coins
+
+wSlotMachineWheel2TopTile:: ; cd46
+ ds 1
+
+wBattleTransitionSpiralDirection:: ; cd47
+; 0 = outward, 1 = inward
+
+wSlotMachineWheel3BottomTile:: ; cd47
+ ds 1
+
+wSlotMachineWheel3MiddleTile:: ; cd48
+
+wFacingDirectionList:: ; cd48
+; 4 bytes (also, the byte before the start of the list (cd47) is used a temp
+; variable when the list is rotated)
+; used when spinning the player's sprite
+ ds 1
+
+wSlotMachineWheel3TopTile:: ; cd49
+
+wTempObtainedBadgesBooleans::
+; 8 bytes
+; temporary list created when displaying the badges on the trainer screen
+; one byte for each badge; 0 = not obtained, 1 = obtained
+ ds 1
+
+wTempCoins2:: ; cd4a
+; 2 bytes
+; temporary variable used to subtract the bet amount from the player's coins
+
+wPayoutCoins:: ; cd4a
+; 2 bytes
+ ds 2
wTradedPlayerMonOTID:: ; cd4c
-wcd4c:: ds 1
-wcd4d:: ds 1
+wSlotMachineFlags:: ; cd4c
+; These flags are set randomly and control when the wheels stop.
+; bit 6: allow the player to win in general
+; bit 7: allow the player to win with 7 or bar (plus the effect of bit 6)
+ ds 1
+
+wSlotMachineWheel1SlipCounter:: ; cd4d
+; wheel 1 can "slip" while this is non-zero
+
+wCutTile:: ; cd4d
+; $3d = tree tile
+; $52 = grass tile
+ ds 1
+
+wSlotMachineWheel2SlipCounter:: ; cd4e
+; wheel 2 can "slip" while this is non-zero
wTradedEnemyMonOT:: ; cd4e
+ ds 1
+
+wSavedPlayerScreenY:: ; cd4f
+
+wSlotMachineRerollCounter:: ; cd4f
+; The remaining number of times wheel 3 will roll down a symbol until a match is
+; found, when winning is enabled. It's initialized to 4 each bet.
+
+wEmotionBubbleSpriteIndex:: ; cd4f
+; the index of the sprite the emotion bubble is to be displayed above
+ ds 1
+
+wWhichEmotionBubble:: ; cd50
-wcd4e:: ds 1
-wcd4f:: ds 1
-wcd50:: ds 9
+wSlotMachineBet:: ; cd50
+; how many coins the player bet on the slot machine (1 to 3)
+
+wSavedPlayerFacingDirection:: ; cd50
+
+wWhichAnimationOffsets:: ; cd50
+; 0 = cut animation, 1 = boulder dust animation
+ ds 9
wTradedEnemyMonOTID:: ; cd59
ds 2
-wcd5b:: ds 1
-wcd5c:: ds 1
+wStandingOnWarpPadOrHole:: ; cd5b
+; 0 = neither
+; 1 = warp pad
+; 2 = hole
+
+wOAMBaseTile:: ; cd5b
+
+wGymTrashCanIndex:: ; cd5b
+ ds 1
+
+wSymmetricSpriteOAMAttributes:: ; cd5c
+ ds 1
wMonPartySpriteSpecies:: ; cd5d
ds 1
@@ -681,24 +1205,49 @@ wRightGBMonSpecies:: ; cd5f
wFlags_0xcd60:: ; cd60
; bit 0: is player engaged by trainer (to avoid being engaged by multiple trainers simultaneously)
; bit 1: boulder dust animation (from using Strength) pending
+; bit 3: using generic PC
; bit 5: don't play sound when A or B is pressed in menu
; bit 6: tried pushing against boulder once (you need to push twice before it will move)
ds 1
ds 9
-wcd6a:: ds 1
+wActionResultOrTookBattleTurn:: ; cd6a
+; This has overlapping related uses.
+; When the player tries to use an item or use certain field moves, 0 is stored
+; when the attempt fails and 1 is stored when the attempt succeeds.
+; In addition, some items store 2 for certain types of failures, but this
+; cannot happen in battle.
+; In battle, a non-zero value indicates the player has taken their turn using
+; something other than a move (e.g. using an item or switching pokemon).
+; So, when an item is successfully used in battle, this value becomes non-zero
+; and the player is not allowed to make a move and the two uses are compatible.
+ ds 1
wJoyIgnore:: ; cd6b
; Set buttons are ignored.
ds 1
-wcd6c:: ds 1
-wcd6d:: ds 4
-wcd71:: ds 1
-wcd72:: ds 5
-wcd77:: ds 1
-wcd78:: ds 9
+wDownscaledMonSize:: ; cd6c
+; size of downscaled mon pic used in pokeball entering/exiting animation
+; $00 = 5×5
+; $01 = 3×3
+
+wNumMovesMinusOne:: ; cd6c
+; FormatMovesString stores the number of moves minus one here
+ ds 1
+
+wcd6d:: ds 4 ; buffer for various data
+
+wStatusScreenCurrentPP:: ; cd71
+; temp variable used to print a move's current PP on the status screen
+ ds 1
+
+ ds 6
+
+wNormalMaxPPList:: ; cd78
+; list of normal max PP (without PP up) values
+ ds 9
wSerialOtherGameboyRandomNumberListBlock:: ; cd81
; buffer for transferring the random number list generated by the other gameboy
@@ -707,34 +1256,86 @@ wTileMapBackup2:: ; cd81
; second buffer for temporarily saving and restoring current screen's tiles (e.g. if menus are drawn on top)
ds 20 * 18
+wNamingScreenNameLength:: ; cee9
+
+wEvoOldSpecies:: ; cee9
+
wBuffer:: ; cee9
; Temporary storage area of 30 bytes.
+
+wTownMapCoords:: ; cee9
+; lower nybble is x, upper nybble is y
+
+wLearningMovesFromDayCare:: ; cee9
+; whether WriteMonMoves is being used to make a mon learn moves from day care
+; non-zero if so
+
+wChangeMonPicEnemyTurnSpecies:: ; cee9
+
wHPBarMaxHP:: ; cee9
- ds 2
+ ds 1
+
+wNamingScreenSubmitName:: ; ceea
+; non-zero when the player has chosen to submit the name
+
+wChangeMonPicPlayerTurnSpecies:: ; ceea
+
+wEvoNewSpecies:: ; ceea
+ ds 1
+
+wAlphabetCase:: ; ceeb
+; 0 = upper case
+; 1 = lower case
+
+wEvoMonTileOffset:: ; ceeb
+
wHPBarOldHP:: ; ceeb
- ds 2
+ ds 1
+
+wEvoCancelled:: ; ceec
+ ds 1
+
+wNamingScreenLetter:: ; ceed
+
wHPBarNewHP:: ; ceed
ds 2
wHPBarDelta:: ; ceef
ds 1
-wcef0:: ds 1
-wcef1:: ds 12
+wHPBarTempHP:: ; cef0
+ ds 2
+
+ ds 11
wHPBarHPDifference:: ; cefd
ds 1
ds 7
-wcf05:: ds 1
-wcf06:: ds 1
+wAIItem:: ; cf05
+; the item that the AI used
+ ds 1
+
+wUsedItemOnWhichPokemon:: ; cf05
+ ds 1
wAnimSoundID:: ; cf07
; sound ID during battle animations
ds 1
-wcf08:: ds 1
-wcf09:: ds 1
-wcf0a:: ds 1
+wBankswitchHomeSavedROMBank:: ; cf08
+; used as a storage value for the bank to return to after a BankswitchHome (bankswitch in homebank)
+ ds 1
+
+wBankswitchHomeTemp:: ; cf09
+; used as a temp storage value for the bank to switch to
+ ds 1
+
+wBoughtOrSoldItemInMart:: ; cf0a
+; 0 = nothing bought or sold in pokemart
+; 1 = bought or sold something in pokemart
+; this value is not used for anything
+ ds 1
+
wBattleResult:: ; cf0b
; $00 - win
; $01 - lose
@@ -745,16 +1346,23 @@ wAutoTextBoxDrawingControl:: ; cf0c
; bit 0: if set, DisplayTextID automatically draws a text box
ds 1
-wcf0d:: ds 1
-wcf0e:: ds 1
-wcf0f:: ds 1
+wcf0d:: ds 1 ; used with some overworld scripts (not exactly sure what it's used for)
+
+wTilePlayerStandingOn:: ; cf0e
+; used in CheckForTilePairCollisions2 to store the tile the player is on
+ ds 1
+
+wNPCNumScriptedSteps:: ds 1 ; cf0f
wNPCMovementScriptFunctionNum:: ; cf10
; which script function within the pointer table indicated by
; wNPCMovementScriptPointerTableNum
ds 1
-wcf11:: ds 1
+wTextPredefFlag:: ; cf11
+; bit 0: set when printing a text predef so that DisplayTextID doesn't switch
+; to the current map's bank
+ ds 1
wPredefParentBank:: ; cf12
ds 1
@@ -771,7 +1379,10 @@ wNPCMovementScriptSpriteOffset:: ; cf17
; sprite offset of sprite being controlled by NPC movement script
ds 1
-wcf18:: ds 2
+wScriptedNPCWalkCounter:: ; cf18
+ ds 1
+
+ ds 1
wGBC:: ; cf1a
ds 1
@@ -780,46 +1391,80 @@ wOnSGB:: ; cf1b
; if running on SGB, it's 1, else it's 0
ds 1
-wcf1c:: ds 1
-wcf1d:: ds 1
-wcf1e:: ds 1
-wcf1f:: ds 6
-wcf25:: ds 8
-wcf2d:: ds 1
-wcf2e:: ds 2
-wcf30:: ds 7
-wcf37:: ds 20
-wcf4b:: ds 1
-wcf4c:: ds 1
+wDefaultPaletteCommand:: ; cf1c
+ ds 1
+
+wPlayerHPBarColor:: ; cf1d
+
+wWholeScreenPaletteMonSpecies:: ; cf1d
+; species of the mon whose palette is used for the whole screen
+ ds 1
+
+wEnemyHPBarColor:: ; cf1e
+ ds 1
+
+; 0: green
+; 1: yellow
+; 2: red
+wPartyMenuHPBarColors:: ; cf1f
+ ds 6
+
+wStatusScreenHPBarColor:: ; cf25
+ ds 1
+
+ ds 7
+
+wCopyingSGBTileData:: ; cf2d
+
+wWhichPartyMenuHPBar:: ; cf2d
+
+wPalPacket:: ; cf2d
+ ds 1
+
+wPartyMenuBlkPacket:: ; cf2e
+; $30 bytes
+ ds 29
+
+wExpAmountGained:: ; cf4b
+; 2-byte big-endian number
+; the total amount of exp a mon gained
+
+wcf4b:: ds 2 ; storage buffer for various strings
+
wGainBoostedExp:: ; cf4d
- ds 1
+ ds 1
+
ds 17
wGymCityName:: ; cf5f
-wStringBuffer1:: ; cf5f
- ds 16 + 1
+ ds 17
+
wGymLeaderName:: ; cf70
-wStringBuffer2:: ; cf70
- ds 16 + 1
-wStringBuffer3:: ; cf81
- ds 9 + 1
+ ds NAME_LENGTH
-wList:: ; cf8b
+wItemList:: ; cf7b
+ ds 16
+
+wListPointer:: ; cf8b
ds 2
-wcf8d:: ds 1
-wcf8e:: ds 1
+wUnusedCF8D:: ; cf8d
+; 2 bytes
+; used to store pointers, but never read
+ ds 2
wItemPrices:: ; cf8f
ds 2
-wcf91:: ds 1
+wcf91:: ds 1 ; used with a lot of things (too much to list here)
wWhichPokemon:: ; cf92
; which pokemon you selected
ds 1
-wcf93:: ds 1
+wPrintItemPrices:: ; cf93
+; if non-zero, then print item prices when displaying lists
+ ds 1
wHPBarType:: ; cf94
; type of HP bar
@@ -831,9 +1476,22 @@ wListMenuID:: ; cf94
; ID used by DisplayListMenuID
ds 1
-wcf95:: ds 1
-wcf96:: ds 1
-wcf97:: ds 1
+wRemoveMonFromBox:: ; cf95
+; if non-zero, RemovePokemon will remove the mon from the current box,
+; else it will remove the mon from the party
+
+wMoveMonType:: ; cf95
+; 0 = move from box to party
+; 1 = move from party to box
+; 2 = move from daycare to party
+; 3 = move from party to daycare
+ ds 1
+
+wItemQuantity:: ; cf96
+ ds 1
+
+wMaxItemQuantity:: ; cf97
+ ds 1
; LoadMonData copies mon data here
wLoadedMon:: party_struct wLoadedMon ; cf98
@@ -853,41 +1511,66 @@ wTileInFrontOfPlayer:: ; cfc6
; background tile number in front of the player (either 1 or 2 steps ahead)
ds 1
-wMusicHeaderPointer:: ; cfc7
-; (the current music channel address - $4000) / 3
+wAudioFadeOutControl:: ; cfc7
+; The desired fade counter reload value is stored here prior to calling
+; PlaySound in order to cause the current music to fade out before the new
+; music begins playing. Storing 0 causes no fade out to occur and the new music
+; to begin immediately.
+; This variable has another use related to fade-out, as well. PlaySound stores
+; the sound ID of the music that should be played after the fade-out is finished
+; in this variable. FadeOutAudio checks if it's non-zero every V-Blank and
+; fades out the current audio if it is. Once it has finished fading out the
+; audio, it zeroes this variable and starts playing the sound ID stored in it.
ds 1
-wcfc8:: ds 1
-wcfc9:: ds 1
-wcfca:: ds 1
+wAudioFadeOutCounterReloadValue:: ; cfc8
+ ds 1
+
+wAudioFadeOutCounter:: ; cfc9
+ ds 1
+
+wLastMusicSoundID:: ; cfca
+; This is used to determine whether the default music is already playing when
+; attempting to play the default music (in order to avoid restarting the same
+; music) and whether the music has already been stopped when attempting to
+; fade out the current music (so that the new music can be begin immediately
+; instead of waiting).
+; It sometimes contains the sound ID of the last music played, but it may also
+; contain $ff (if the music has been stopped) or 0 (because some routines zero
+; it in order to prevent assumptions from being made about the current state of
+; the music).
+ ds 1
wUpdateSpritesEnabled:: ; cfcb
-; $01 enables UpdateSprites; anything else disables it
+; $00 = causes sprites to be hidden and the value to change to $ff
+; $01 = enabled
+; $ff = disabled
+; other values aren't used
ds 1
-W_ENEMYMOVENUM:: ; cfcc
+wEnemyMoveNum:: ; cfcc
ds 1
-W_ENEMYMOVEEFFECT:: ; cfcd
+wEnemyMoveEffect:: ; cfcd
ds 1
-W_ENEMYMOVEPOWER:: ; cfce
+wEnemyMovePower:: ; cfce
ds 1
-W_ENEMYMOVETYPE:: ; cfcf
+wEnemyMoveType:: ; cfcf
ds 1
-W_ENEMYMOVEACCURACY:: ; cfd0
+wEnemyMoveAccuracy:: ; cfd0
ds 1
-W_ENEMYMOVEMAXPP:: ; cfd1
+wEnemyMoveMaxPP:: ; cfd1
ds 1
-W_PLAYERMOVENUM:: ; cfd2
+wPlayerMoveNum:: ; cfd2
ds 1
-W_PLAYERMOVEEFFECT:: ; cfd3
+wPlayerMoveEffect:: ; cfd3
ds 1
-W_PLAYERMOVEPOWER:: ; cfd4
+wPlayerMovePower:: ; cfd4
ds 1
-W_PLAYERMOVETYPE:: ; cfd5
+wPlayerMoveType:: ; cfd5
ds 1
-W_PLAYERMOVEACCURACY:: ; cfd6
+wPlayerMoveAccuracy:: ; cfd6
ds 1
-W_PLAYERMOVEMAXPP:: ; cfd7
+wPlayerMoveMaxPP:: ; cfd7
ds 1
@@ -896,7 +1579,7 @@ wEnemyMonSpecies2:: ; cfd8
wBattleMonSpecies2:: ; cfd9
ds 1
-wEnemyMonNick:: ds 11 ; cfda
+wEnemyMonNick:: ds NAME_LENGTH ; cfda
wEnemyMon:: ; cfe5
; The wEnemyMon struct reaches past 0xcfff,
@@ -927,36 +1610,50 @@ wEnemyMonDefense:: dw
wEnemyMonSpeed:: dw
wEnemyMonSpecial:: dw
wEnemyMonPP:: ds 2 ; NUM_MOVES - 2
-SECTION "WRAM Bank 1", WRAMX, BANK[1]
+SECTION "WRAM Bank 1", WRAMX[$d000], BANK[1]
ds 2 ; NUM_MOVES - 2
wEnemyMonBaseStats:: ds 5
wEnemyMonCatchRate:: ds 1
wEnemyMonBaseExp:: ds 1
-wBattleMonNick:: ds 11 ; d009
+wBattleMonNick:: ds NAME_LENGTH ; d009
wBattleMon:: battle_struct wBattleMon ; d014
-W_TRAINERCLASS:: ; d031
+wTrainerClass:: ; d031
+ ds 1
+
+ ds 1
+
+wTrainerPicPointer:: ; d033
+ ds 2
ds 1
+wTempMoveNameBuffer:: ; d036
+
+wLearnMoveMonName:: ; d036
+; The name of the mon that is learning a move.
+ ds 16
+
+wTrainerBaseMoney:: ; d046
+; 2-byte BCD number
+; money received after battle = base money × level of highest-level enemy mon
+ ds 2
+
+wMissableObjectCounter:: ; d048
ds 1
-wd033:: ds 1
-wd034:: ds 2
-wd036:: ds 16
-wd046:: ds 1
-wd047:: ds 1
-wd048:: ds 2
+ ds 1
-W_TRAINERNAME:: ; d04a
+wTrainerName:: ; d04a
; 13 bytes for the letters of the opposing trainer
; the name is terminated with $50 with possible
; unused trailing letters
ds 13
-W_ISINBATTLE:: ; d057
+wIsInBattle:: ; d057
+; lost battle, this is -1
; no battle, this is 0
; wild battle, this is 1
; trainer battle, this is 2
@@ -966,12 +1663,12 @@ wPartyGainExpFlags:: ; d058
; flags that indicate which party members should be be given exp when GainExperience is called
flag_array 6
-W_CUROPPONENT:: ; d059
+wCurOpponent:: ; d059
; in a wild battle, this is the species of pokemon
-; in a trainer battle, this is the trainer class + $C8
+; in a trainer battle, this is the trainer class + 200
ds 1
-W_BATTLETYPE:: ; d05a
+wBattleType:: ; d05a
; in normal battle, this is 0
; in old man battle, this is 1
; in safari battle, this is 2
@@ -984,14 +1681,14 @@ wDamageMultipliers:: ; d05b
; $a = neutral
; $14 = super-effective
; bit 7: STAB
- ds 1
+ ds 1
-W_LONEATTACKNO:: ; d05c
+wLoneAttackNo:: ; d05c
; which entry in LoneAttacks to use
-W_GYMLEADERNO:: ; d05c
+wGymLeaderNo:: ; d05c
; it's actually the same thing as ^
ds 1
-W_TRAINERNO:: ; d05d
+wTrainerNo:: ; d05d
; which instance of [youngster, lass, etc] is this?
ds 1
@@ -1002,7 +1699,7 @@ wCriticalHitOrOHKO:: ; d05e
; $ff = failed OHKO
ds 1
-W_MOVEMISSED:: ; d05f
+wMoveMissed:: ; d05f
ds 1
wPlayerStatsToDouble:: ; d060
@@ -1013,7 +1710,7 @@ wPlayerStatsToHalve:: ; d061
; always 0
ds 1
-W_PLAYERBATTSTATUS1:: ; d062
+wPlayerBattleStatus1:: ; d062
; bit 0 - bide
; bit 1 - thrash / petal dance
; bit 2 - attacking multiple times (e.g. double kick)
@@ -1024,7 +1721,7 @@ W_PLAYERBATTSTATUS1:: ; d062
; bit 7 - confusion
ds 1
-W_PLAYERBATTSTATUS2:: ; d063
+wPlayerBattleStatus2:: ; d063
; bit 0 - X Accuracy effect
; bit 1 - protected by "mist"
; bit 2 - focus energy effect
@@ -1034,7 +1731,7 @@ W_PLAYERBATTSTATUS2:: ; d063
; bit 7 - leech seeded
ds 1
-W_PLAYERBATTSTATUS3:: ; d064
+wPlayerBattleStatus3:: ; d064
; bit 0 - toxic
; bit 1 - light screen
; bit 2 - reflect
@@ -1049,37 +1746,43 @@ wEnemyStatsToHalve:: ; d066
; always 0
ds 1
-W_ENEMYBATTSTATUS1:: ; d067
+wEnemyBattleStatus1:: ; d067
ds 1
-W_ENEMYBATTSTATUS2:: ; d068
+wEnemyBattleStatus2:: ; d068
ds 1
-W_ENEMYBATTSTATUS3:: ; d069
+wEnemyBattleStatus3:: ; d069
ds 1
wPlayerNumAttacksLeft::
; when the player is attacking multiple times, the number of attacks left
ds 1
-W_PLAYERCONFUSEDCOUNTER:: ; wd06b
+wPlayerConfusedCounter:: ; d06b
ds 1
-W_PLAYERTOXICCOUNTER:: ; d06c
+wPlayerToxicCounter:: ; d06c
ds 1
-W_PLAYERDISABLEDMOVE:: ; d06d
+
+wPlayerDisabledMove:: ; d06d
+; high nibble: which move is disabled (1-4)
+; low nibble: disable turns left
ds 1
ds 1
-wEnemyNumAttacksLeft::
+wEnemyNumAttacksLeft:: ; d06f
; when the enemy is attacking multiple times, the number of attacks left
ds 1
-W_ENEMYCONFUSEDCOUNTER:: ; wd070
+wEnemyConfusedCounter:: ; d070
ds 1
-W_ENEMYTOXICCOUNTER:: ; d071
+wEnemyToxicCounter:: ; d071
ds 1
-W_ENEMYDISABLEDMOVE:: ; d072
+
+wEnemyDisabledMove:: ; d072
+; high nibble: which move is disabled (1-4)
+; low nibble: disable turns left
ds 1
ds 1
@@ -1093,62 +1796,113 @@ wPlayerBideAccumulatedDamage:: ; d074
wUnknownSerialCounter2:: ; d075
; 2 bytes
-ds 4
+ ds 4
wEscapedFromBattle::
; non-zero when an item or move that allows escape from battle was used
ds 1
-wd079:: ds 1
-wd07a:: ds 1
-wd07b:: ds 1
+wAmountMoneyWon:: ; d079
+; 3-byte BCD number
+
+wObjectToHide:: ; d079
+ ds 1
+
+wObjectToShow:: ; d07a
+ ds 1
+
+ ds 1
+
+wDefaultMap:: ; d07c
+; the map you will start at when the debug bit is set
+
+wMenuItemOffset:: ; d07c
-W_ANIMATIONID:: ; d07c
+wAnimationID:: ; d07c
; ID number of the current battle animation
ds 1
-wd07d:: ds 1
-wd07e:: ds 3
+wNamingScreenType:: ; d07d
+
+wPartyMenuTypeOrMessageID:: ; d07d
+
+wTempTilesetNumTiles:: ; d07d
+; temporary storage for the number of tiles in a tileset
+ ds 1
+
+wSavedListScrollOffset:: ; d07e
+; used by the pokemart code to save the existing value of wListScrollOffset
+; so that it can be restored when the player is done with the pokemart NPC
+ ds 1
+
+ ds 2
; base coordinates of frame block
-W_BASECOORDX:: ; d081
+wBaseCoordX:: ; d081
ds 1
-W_BASECOORDY:: ; d082
+wBaseCoordY:: ; d082
ds 1
; low health alarm counter/enable
; high bit = enable, others = timer to cycle frequencies
wLowHealthAlarm:: ds 1 ; d083
-W_FBTILECOUNTER:: ; d084
+wFBTileCounter:: ; d084
; counts how many tiles of the current frame block have been drawn
ds 1
-wd085:: ds 1
+wMovingBGTilesCounter2:: ; d085
+ ds 1
-W_SUBANIMFRAMEDELAY:: ; d086
+wSubAnimFrameDelay:: ; d086
; duration of each frame of the current subanimation in terms of screen refreshes
ds 1
-W_SUBANIMCOUNTER:: ; d087
+wSubAnimCounter:: ; d087
; counts the number of subentries left in the current subanimation
ds 1
-wd088:: ds 1
+wSaveFileStatus:: ; d088
+; 1 = no save file or save file is corrupted
+; 2 = save file exists and no corruption has been detected
+ ds 1
-W_NUMFBTILES:: ; d089
+wNumFBTiles:: ; d089
; number of tiles in current battle animation frame block
ds 1
+wFlashScreenLongCounter:: ; d08a
+
+wSpiralBallsBaseY:: ; d08a
+
+wFallingObjectMovementByte:: ; d08a
+; bits 0-6: index into FallingObjects_DeltaXs array (0 - 8)
+; bit 7: direction; 0 = right, 1 = left
+
+wNumShootingBalls:: ; d08a
+
wTradedMonMovingRight:: ; d08a
; $01 if mon is moving from left gameboy to right gameboy; $00 if vice versa
-wd08a:: ds 1
+wOptionsInitialized:: ; d08a
+
+wNewSlotMachineBallTile:: ; d08a
+
+wCoordAdjustmentAmount:: ; d08a
+; how much to add to the X/Y coord
+
+wUnusedD08A:: ; d08a
+ ds 1
+
+wSpiralBallsBaseX:: ; d08b
-wTownMapSpriteBlinkingCounter:: ; d08b
+wNumFallingObjects:: ; d08b
-wPartyMonAnimCounter:: ; d08b
+wSlideMonDelay:: ; d08b
-W_SUBANIMTRANSFORM:: ; d08b
+wAnimCounter:: ; d08b
+; generic counter variable for various animations
+
+wSubAnimTransform:: ; d08b
; controls what transformations are applied to the subanimation
; 01: flip horizontally and vertically
; 02: flip horizontally and translate downwards 40 pixels
@@ -1169,92 +1923,119 @@ wEndBattleTextRomBank:: ; d092
ds 1
-W_SUBANIMADDRPTR:: ; d094
+wSubAnimAddrPtr:: ; d094
; the address _of the address_ of the current subanimation entry
ds 2
-W_SUBANIMSUBENTRYADDR:: ; d096
+
+wSlotMachineAllowMatchesCounter:: ; d096
+; If non-zero, the allow matches flag is always set.
+; There is a 1/256 (~0.4%) chance that this value will be set to 60, which is
+; the only way it can increase. Winning certain payout amounts will decrement it
+; or zero it.
+
+wSubAnimSubEntryAddr:: ; d096
; the address of the current subentry of the current subanimation
ds 2
ds 2
-wd09a:: ds 1
+wOutwardSpiralTileMapPointer:: ; d09a
+ ds 1
+
+wPartyMenuAnimMonEnabled:: ; d09b
wTownMapSpriteBlinkingEnabled:: ; d09b
; non-zero when enabled. causes nest locations to blink on and off.
; the town selection cursor will blink regardless of what this value is
-wd09b:: ds 1
+wUnusedD09B:: ; d09b
+ ds 1
-W_FBDESTADDR:: ; d09c
+wFBDestAddr:: ; d09c
; current destination address in OAM for frame blocks (big endian)
ds 2
-W_FBMODE:: ; d09e
+wFBMode:: ; d09e
; controls how the frame blocks are put together to form frames
; specifically, after finishing drawing the frame block, the frame block's mode determines what happens
; 00: clean OAM buffer and delay
; 02: move onto the next frame block with no delay and no cleaning OAM buffer
; 03: delay, but don't clean OAM buffer
-; 04: delay, without cleaning OAM buffer, and do not advance [W_FBDESTADDR], so that the next frame block will overwrite this one
-; sprite data is written column by column, each byte contains 8 columns (one for ech bit)
-; for 2bpp sprites, pairs of two consecutive bytes (i.e. pairs of consecutive rows of sprite data)
-; contain the upper and lower bit of each of the 8 pixels, respectively
+; 04: delay, without cleaning OAM buffer, and do not advance [wFBDestAddr], so that the next frame block will overwrite this one
ds 1
+wLinkCableAnimBulgeToggle:: ; d09f
+; 0 = small
+; 1 = big
+
+wIntroNidorinoBaseTile:: ; d09f
+
+wOutwardSpiralCurrentDirection:: ; d09f
+
+wDropletTile:: ; d09f
+
wNewTileBlockID:: ; d09f
-wd09f:: ds 1
-wd0a0:: ds 1
+wWhichBattleAnimTileset:: ; d09f
-W_SPRITECURPOSX:: ; d0a1
+wSquishMonCurrentDirection:: ; d09f
+; 0 = left
+; 1 = right
+
+wSlideMonUpBottomRowLeftTile:: ; d09f
+; the tile ID of the leftmost tile in the bottom row in AnimationSlideMonUp_
ds 1
-W_SPRITECURPOSY:: ; d0a2
+
+wDisableVBlankWYUpdate:: ds 1 ; if non-zero, don't update WY during V-blank
+
+wSpriteCurPosX:: ; d0a1
ds 1
-W_SPRITEWITDH:: ; d0a3
+wSpriteCurPosY:: ; d0a2
ds 1
-W_SPRITEHEIGHT:: ; d0a4
+wSpriteWidth:: ; d0a3
ds 1
-W_SPRITEINPUTCURBYTE:: ; d0a5
+wSpriteHeight:: ; d0a4
+ ds 1
+wSpriteInputCurByte:: ; d0a5
; current input byte
ds 1
-W_SPRITEINPUTBITCOUNTER:: ; d0a6
+wSpriteInputBitCounter:: ; d0a6
; bit offset of last read input bit
ds 1
-W_SPRITEOUTPUTBITOFFSET:: ; d0a7; determines where in the output byte the two bits are placed. Each byte contains four columns (2bpp data)
+wSpriteOutputBitOffset:: ; d0a7; determines where in the output byte the two bits are placed. Each byte contains four columns (2bpp data)
; 3 -> XX000000 1st column
; 2 -> 00XX0000 2nd column
; 1 -> 0000XX00 3rd column
; 0 -> 000000XX 4th column
ds 1
-W_SPRITELOADFLAGS:: ; d0a8
+wSpriteLoadFlags:: ; d0a8
; bit 0 determines used buffer (0 -> $a188, 1 -> $a310)
; bit 1 loading last sprite chunk? (there are at most 2 chunks per load operation)
ds 1
-W_SPRITEUNPACKMODE:: ; d0a9
+wSpriteUnpackMode:: ; d0a9
ds 1
-W_SPRITEFLIPPED:: ; d0aa
+wSpriteFlipped:: ; d0aa
ds 1
-W_SPRITEINPUTPTR:: ; d0ab
+wSpriteInputPtr:: ; d0ab
; pointer to next input byte
ds 2
-W_SPRITEOUTPUTPTR:: ; d0ad
+wSpriteOutputPtr:: ; d0ad
; pointer to current output byte
ds 2
-W_SPRITEOUTPUTPTRCACHED:: ; d0af
+wSpriteOutputPtrCached:: ; d0af
; used to revert pointer for different bit offsets
ds 2
-W_SPRITEDECODETABLE0PTR:: ; d0b1
+wSpriteDecodeTable0Ptr:: ; d0b1
; pointer to differential decoding table (assuming initial value 0)
ds 2
-W_SPRITEDECODETABLE1PTR:: ; d0b3
+wSpriteDecodeTable1Ptr:: ; d0b3
; pointer to differential decoding table (assuming initial value 1)
ds 2
-wd0b5:: ds 1
+wd0b5:: ds 1 ; used as a temp storage area for Pokemon Species, and other Pokemon/Battle related things
wNameListType:: ; d0b6
ds 1
@@ -1262,64 +2043,69 @@ wNameListType:: ; d0b6
wPredefBank:: ; d0b7
ds 1
-W_MONHEADER:: ; d0b8
-W_MONHDEXNUM:: ; d0b8
+wMonHeader:: ; d0b8
+
+wMonHIndex:: ; d0b8
+; In the ROM base stats data stucture, this is the dex number, but it is
+; overwritten with the internal index number after the header is copied to WRAM.
ds 1
-W_MONHBASESTATS:: ; d0b9
-W_MONHBASEHP:: ; d0b9
+wMonHBaseStats:: ; d0b9
+wMonHBaseHP:: ; d0b9
ds 1
-W_MONHBASEATTACK:: ; d0ba
+wMonHBaseAttack:: ; d0ba
ds 1
-W_MONHBASEDEFENSE:: ; d0bb
+wMonHBaseDefense:: ; d0bb
ds 1
-W_MONHBASESPEED:: ; d0bc
+wMonHBaseSpeed:: ; d0bc
ds 1
-W_MONHBASESPECIAL:: ; d0bd
+wMonHBaseSpecial:: ; d0bd
ds 1
-W_MONHTYPES:: ; d0be
-W_MONHTYPE1:: ; d0be
+wMonHTypes:: ; d0be
+wMonHType1:: ; d0be
ds 1
-W_MONHTYPE2:: ; d0bf
+wMonHType2:: ; d0bf
ds 1
-W_MONHCATCHRATE:: ; d0c0
+wMonHCatchRate:: ; d0c0
ds 1
-W_MONHBASEXP:: ; d0c1
+wMonHBaseEXP:: ; d0c1
ds 1
-W_MONHSPRITEDIM:: ; d0c2
+wMonHSpriteDim:: ; d0c2
ds 1
-W_MONHFRONTSPRITE:: ; d0c3
+wMonHFrontSprite:: ; d0c3
ds 2
-W_MONHBACKSPRITE:: ; d0c5
+wMonHBackSprite:: ; d0c5
ds 2
-W_MONHMOVES:: ; d0c7
- ds 4
+wMonHMoves:: ; d0c7
+ ds NUM_MOVES
-W_MONHGROWTHRATE:: ; d0cb
+wMonHGrowthRate:: ; d0cb
ds 1
-W_MONHLEARNSET:: ; d0cc
+wMonHLearnset:: ; d0cc
; bit field
flag_array 50 + 5
ds 1
-wd0d4:: ds 3
+wSavedTilesetType:: ; d0d4
+; saved at the start of a battle and then written back at the end of the battle
+ ds 1
-W_MONHPADDING:: ; d0d7
+ ds 2
-W_DAMAGE:: ; d0d7
+wDamage:: ; d0d7
ds 2
-ds 2
+ ds 2
-wRepelRemainingSteps:: ; wd0db
- ds 1
+wRepelRemainingSteps:: ; d0db
+ ds 1
-wMoves:: ; wd0dc
+wMoves:: ; d0dc
; list of moves for FormatMovesString
ds 4
@@ -1329,50 +2115,139 @@ wMoveNum:: ; d0e0
wMovesString:: ; d0e1
ds 56
-wd119:: ds 1
+wUnusedD119:: ; d119
+ ds 1
wWalkBikeSurfStateCopy:: ; d11a
; wWalkBikeSurfState is sometimes copied here, but it doesn't seem to be used for anything
ds 1
-wd11b:: ds 1
-wd11c:: ds 1
-wd11d:: ds 1
-wd11e:: ds 1
-wd11f:: ds 1
+wInitListType:: ; d11b
+; the type of list for InitList to init
+ ds 1
+
+wCapturedMonSpecies:: ; d11c
+; 0 if no mon was captured
+ ds 1
+
+wFirstMonsNotOutYet:: ; d11d
+; Non-zero when the first player mon and enemy mon haven't been sent out yet.
+; It prevents the game from asking if the player wants to choose another mon
+; when the enemy sends out their first mon and suppresses the "no will to fight"
+; message when the game searches for the first non-fainted mon in the party,
+; which will be the first mon sent out.
+ ds 1
+
+wPokeBallCaptureCalcTemp:: ; d11e
+
+; lower nybble: number of shakes
+; upper nybble: number of animations to play
+wPokeBallAnimData:: ; d11e
+
+wUsingPPUp:: ; d11e
+
+wMaxPP:: ; d11e
+
+; 0 for player, non-zero for enemy
+wCalculateWhoseStats:: ; d11e
+
+wTypeEffectiveness:: ; d11e
+
+wMoveType:: ; d11e
+
+wNumSetBits:: ; d11e
+
+wd11e:: ds 1 ; used as a Pokemon and Item storage value. Also used as an output value for CountSetBits
+
+wForcePlayerToChooseMon:: ; d11f
+; When this value is non-zero, the player isn't allowed to exit the party menu
+; by pressing B and not choosing a mon.
+ ds 1
wNumRunAttempts::
; number of times the player has tried to run from battle
ds 1
-wd121:: ds 1
-wd122:: ds 2
-wd124:: ds 1
+wEvolutionOccurred:: ; d121
+ ds 1
+
+wVBlankSavedROMBank:: ; d122
+ ds 1
+
+ ds 1
+
+wIsKeyItem:: ; d124
+ ds 1
wTextBoxID:: ; d125
ds 1
-wd126:: ds 1
+wCurrentMapScriptFlags:: ds 1 ; not exactly sure what this is used for, but it seems to be used as a multipurpose temp flag value
-W_CURENEMYLVL:: ; d127
+wCurEnemyLVL:: ; d127
ds 1
-wd128:: ds 1
-wd129:: ds 1
-wd12a:: ds 1
+wItemListPointer:: ; d128
+; pointer to list of items terminated by $FF
+ ds 2
+
+wListCount::
+; number of entries in a list
+ ds 1
wLinkState:: ; d12b
ds 1
-wTwoOptionMenuID:: ds 1
-wd12d:: ds 1
-wd12e:: ds 1
-wd12f:: ds 1
-wd130:: ds 1
-wd131:: ds 1
-wd132:: ds 1
-wd133:: ds 6
-wd139:: ds 1
+wTwoOptionMenuID:: ; d12c
+ ds 1
+
+wChosenMenuItem:: ; d12d
+; the id of the menu item the player ultimately chose
+
+wOutOfBattleBlackout:: ; d12d
+; non-zero when the whole party has fainted due to out-of-battle poison damage
+ ds 1
+
+wMenuExitMethod:: ; d12e
+; the way the user exited a menu
+; for list menus and the buy/sell/quit menu:
+; $01 = the user pressed A to choose a menu item
+; $02 = the user pressed B to cancel
+; for two-option menus:
+; $01 = the user pressed A with the first menu item selected
+; $02 = the user pressed B or pressed A with the second menu item selected
+ ds 1
+
+wDungeonWarpDataEntrySize:: ; d12f
+; the size is always 6, so they didn't need a variable in RAM for this
+
+wWhichPewterGuy:: ; d12f
+; 0 = museum guy
+; 1 = gym guy
+
+wWhichPrizeWindow:: ; d12f
+; there are 3 windows, from 0 to 2
+
+wGymGateTileBlock:: ; d12f
+; a horizontal or vertical gate block
+ ds 1
+
+wSavedSpriteScreenY:: ; d130
+ ds 1
+
+wSavedSpriteScreenX:: ; d131
+ ds 1
+
+wSavedSpriteMapY:: ; d132
+ ds 1
+
+wSavedSpriteMapX:: ; d133
+ ds 1
+
+ ds 5
+
+wWhichPrize:: ; d139
+ ds 1
wIgnoreInputCounter:: ; d13a
; counts downward each frame
@@ -1387,11 +2262,11 @@ wNumberOfNoRandomBattleStepsLeft:: ; d13c
; after a battle, you have at least 3 steps before a random battle can occur
ds 1
-W_PRIZE1:: ; d13d
+wPrize1:: ; d13d
ds 1
-W_PRIZE2:: ; d13e
+wPrize2:: ; d13e
ds 1
-W_PRIZE3:: ; d13f
+wPrize3:: ; d13f
ds 1
ds 1
@@ -1399,9 +2274,16 @@ W_PRIZE3:: ; d13f
wSerialRandomNumberListBlock:: ; d141
; the first 7 bytes are the preamble
-wd141:: ds 2
-wd143:: ds 2
-wd145:: ds 3
+wPrize1Price:: ; d141
+ ds 2
+
+wPrize2Price:: ; d143
+ ds 2
+
+wPrize3Price:: ; d145
+ ds 2
+
+ ds 1
wLinkBattleRandomNumberList:: ; d148
; shared list of 9 random numbers, indexed by wLinkBattleRandomNumberListIndex
@@ -1410,14 +2292,29 @@ wLinkBattleRandomNumberList:: ; d148
wSerialPlayerDataBlock:: ; d152
; the first 6 bytes are the preamble
-wd152:: ds 1
-wd153:: ds 3
-wd156:: ds 1
-wd157:: ds 1
+wPseudoItemID:: ; d152
+; When a real item is being used, this is 0.
+; When a move is acting as an item, this is the ID of the item it's acting as.
+; For example, out-of-battle Dig is executed using a fake Escape Rope item. In
+; that case, this would be ESCAPE_ROPE.
+ ds 1
+
+wUnusedD153:: ; d153
+ ds 1
+ ds 2
+
+wEvoStoneItemID:: ; d156
+ ds 1
+
+wSavedNPCMovementDirections2Index:: ; d157
+ ds 1
wPlayerName:: ; d158
- ds 11
+ ds NAME_LENGTH
+
+
+wPartyDataStart::
wPartyCount:: ds 1 ; d163
wPartySpecies:: ds PARTY_LENGTH ; d164
@@ -1431,10 +2328,14 @@ wPartyMon4:: party_struct wPartyMon4 ; d1ef
wPartyMon5:: party_struct wPartyMon5 ; d21b
wPartyMon6:: party_struct wPartyMon6 ; d247
-wPartyMonOT:: ds 11 * PARTY_LENGTH ; d273
-wPartyMonNicks:: ds 11 * PARTY_LENGTH ; d2b5
+wPartyMonOT:: ds NAME_LENGTH * PARTY_LENGTH ; d273
+wPartyMonNicks:: ds NAME_LENGTH * PARTY_LENGTH ; d2b5
+
+wPartyDataEnd::
+wMainDataStart::
+
wPokedexOwned:: ; d2f7
flag_array NUM_POKEMON
wPokedexOwnedEnd::
@@ -1448,16 +2349,16 @@ wNumBagItems:: ; d31d
ds 1
wBagItems:: ; d31e
; item, quantity
- ds 20 * 2
+ ds BAG_ITEM_CAPACITY * 2
ds 1 ; end
wPlayerMoney:: ; d347
ds 3 ; BCD
-W_RIVALNAME:: ; d34a
- ds 11
+wRivalName:: ; d34a
+ ds NAME_LENGTH
-W_OPTIONS:: ; d355
+wOptions:: ; d355
; bit 7 = battle animation
; 0: On
; 1: Off
@@ -1470,141 +2371,195 @@ W_OPTIONS:: ; d355
; 5: Slow
ds 1
-W_OBTAINEDBADGES:: ; d356
- ds 1
+wObtainedBadges:: ; d356
+ flag_array 8
ds 1
-wd358:: ds 1
+wLetterPrintingDelayFlags:: ; d358
+; bit 0: If 0, limit the delay to 1 frame. Note that this has no effect if
+; the delay has been disabled entirely through bit 1 of this variable
+; or bit 6 of wd730.
+; bit 1: If 0, no delay.
+ ds 1
wPlayerID:: ; d359
ds 2
-wd35b:: ds 1
-wd35c:: ds 1
+wMapMusicSoundID:: ; d35b
+ ds 1
+
+wMapMusicROMBank:: ; d35c
+ ds 1
wMapPalOffset:: ; d35d
; offset subtracted from FadePal4 to get the background and object palettes for the current map
; normally, it is 0. it is 6 when Flash is needed, causing FadePal2 to be used instead of FadePal4
ds 1
-W_CURMAP:: ; d35e
+wCurMap:: ; d35e
ds 1
wCurrentTileBlockMapViewPointer:: ; d35f
; pointer to the upper left corner of the current view in the tile block map
ds 2
-W_YCOORD:: ; d361
+wYCoord:: ; d361
; player’s position on the current map
ds 1
-W_XCOORD:: ; d362
+wXCoord:: ; d362
ds 1
-W_YBLOCKCOORD:: ; d363
+wYBlockCoord:: ; d363
; player's y position (by block)
ds 1
-W_XBLOCKCOORD:: ; d364
+wXBlockCoord:: ; d364
ds 1
wLastMap:: ; d365
ds 1
-wd366:: ds 1
+wUnusedD366:: ; d366
+ ds 1
-W_CURMAPTILESET:: ; d367
+wCurMapTileset:: ; d367
ds 1
-W_CURMAPHEIGHT:: ; d368
+wCurMapHeight:: ; d368
; blocks
ds 1
-W_CURMAPWIDTH:: ; d369
+wCurMapWidth:: ; d369
; blocks
ds 1
-W_MAPDATAPTR:: ; d36a
+wMapDataPtr:: ; d36a
ds 2
-W_MAPTEXTPTR:: ; d36c
+wMapTextPtr:: ; d36c
ds 2
-W_MAPSCRIPTPTR:: ; d36e
+wMapScriptPtr:: ; d36e
ds 2
-W_MAPCONNECTIONS:: ; d370
+wMapConnections:: ; d370
; connection byte
ds 1
-W_MAPCONN1PTR:: ; d371
+wMapConn1Ptr:: ; d371
+ ds 1
+
+wNorthConnectionStripSrc:: ; d372
+ ds 2
+
+wNorthConnectionStripDest:: ; d374
+ ds 2
+
+wNorthConnectionStripWidth:: ; d376
+ ds 1
+
+wNorthConnectedMapWidth:: ; d377
+ ds 1
+
+wNorthConnectedMapYAlignment:: ; d378
+ ds 1
+
+wNorthConnectedMapXAlignment:: ; d379
+ ds 1
+
+wNorthConnectedMapViewPointer:: ; d37a
+ ds 2
+
+wMapConn2Ptr:: ; d37c
ds 1
-wd372:: ds 1
-wd373:: ds 1
-wd374:: ds 1
-wd375:: ds 1
-wd376:: ds 1
-wd377:: ds 1
-wd378:: ds 1
-wd379:: ds 1
-wd37a:: ds 1
-wd37b:: ds 1
+wSouthConnectionStripSrc:: ; d37d
+ ds 2
+
+wSouthConnectionStripDest:: ; d37f:
+ ds 2
+
+wSouthConnectionStripWidth:: ; d381
+ ds 1
-W_MAPCONN2PTR:: ; d37c
+wSouthConnectedMapWidth:: ; d382
ds 1
-wd37d:: ds 1
-wd37e:: ds 1
-wd37f:: ds 1
-wd380:: ds 1
-wd381:: ds 1
-wd382:: ds 1
-wd383:: ds 1
-wd384:: ds 1
-wd385:: ds 1
-wd386:: ds 1
+wSouthConnectedMapYAlignment:: ; d383
+ ds 1
-W_MAPCONN3PTR:: ; d387
+wSouthConnectedMapXAlignment:: ; d384
ds 1
-wd388:: ds 1
-wd389:: ds 1
-wd38a:: ds 1
-wd38b:: ds 1
-wd38c:: ds 1
-wd38d:: ds 1
-wd38e:: ds 1
-wd38f:: ds 1
-wd390:: ds 1
-wd391:: ds 1
+wSouthConnectedMapViewPointer:: ; d385
+ ds 2
-W_MAPCONN4PTR:: ; d392
+wMapConn3Ptr:: ; d387
ds 1
-wd393:: ds 1
-wd394:: ds 1
-wd395:: ds 1
-wd396:: ds 1
-wd397:: ds 1
-wd398:: ds 1
-wd399:: ds 1
-wd39a:: ds 1
-wd39b:: ds 1
-wd39c:: ds 1
+wWestConnectionStripSrc:: ; d388
+ ds 2
-W_SPRITESET:: ; d39d
+wWestConnectionStripDest:: ; d38a
+ ds 2
+
+wWestConnectionStripHeight:: ; d38c
+ ds 1
+
+wWestConnectedMapWidth:: ; d38d
+ ds 1
+
+wWestConnectedMapYAlignment:: ; d38e
+ ds 1
+
+wWestConnectedMapXAlignment:: ; d38f
+ ds 1
+
+wWestConnectedMapViewPointer:: ; d390
+ ds 2
+
+wMapConn4Ptr:: ; d392
+ ds 1
+
+wEastConnectionStripSrc:: ; d393
+ ds 2
+
+wEastConnectionStripDest:: ; d395
+ ds 2
+
+wEastConnectionStripHeight:: ; d397
+ ds 1
+
+wEastConnectedMapWidth:: ; d398
+ ds 1
+
+wEastConnectedMapYAlignment:: ; d399
+ ds 1
+
+wEastConnectedMapXAlignment:: ; d39a
+ ds 1
+
+wEastConnectedMapViewPointer:: ; d39b
+ ds 2
+
+wSpriteSet:: ; d39d
; sprite set for the current map (11 sprite picture ID's)
ds 11
-W_SPRITESETID:: ; d3a8
+wSpriteSetID:: ; d3a8
; sprite set ID for the current map
ds 1
-wd3a9:: ds 1
-wd3aa:: ds 3
-wd3ad:: ds 1
+wObjectDataPointerTemp:: ; d3a9
+ ds 2
+
+ ds 2
+
+wMapBackgroundTile:: ; d3ad
+; the tile shown outside the boundaries of the map
+ ds 1
wNumberOfWarps:: ; d3ae
; number of warps in current map
@@ -1620,11 +2575,19 @@ wDestinationWarpID:: ; d42f
ds 128
-wd4b0:: ds 1
-wd4b1:: ds 32
-wd4d1:: ds 16
+wNumSigns:: ; d4b0
+; number of signs in the current map (up to 16)
+ ds 1
+
+wSignCoords:: ; d4b1
+; 2 bytes each
+; Y, X
+ ds 32
+
+wSignTextIDs:: ; d4d1
+ ds 16
-W_NUMSPRITES:: ; d4e1
+wNumSprites:: ; d4e1
; number of sprites on the current map
ds 1
@@ -1635,43 +2598,62 @@ wYOffsetSinceLastSpecialWarp:: ; d4e2
wXOffsetSinceLastSpecialWarp:: ; d4e3
ds 1
-W_MAPSPRITEDATA:: ; d4e4
+wMapSpriteData:: ; d4e4
; two bytes per sprite (movement byte 2, text ID)
ds 32
-W_MAPSPRITEEXTRADATA:: ; d504
+wMapSpriteExtraData:: ; d504
; two bytes per sprite (trainer class/item ID, trainer set ID)
ds 32
-wd524:: ds 1
-wd525:: ds 1
+wCurrentMapHeight2:: ; d524
+; map height in 2x2 meta-tiles
+ ds 1
+
+wCurrentMapWidth2:: ; d525
+; map width in 2x2 meta-tiles
+ ds 1
wMapViewVRAMPointer:: ; d526
; the address of the upper left corner of the visible portion of the BG tile map in VRAM
ds 2
-wd528:: ds 1
-wd529:: ds 1
-wd52a:: ds 1
+; In the comments for the player direction variables below, "moving" refers to
+; both walking and changing facing direction without taking a step.
+
+wPlayerMovingDirection:: ; d528
+; if the player is moving, the current direction
+; if the player is not moving, zero
+; map scripts write to this in order to change the player's facing direction
+ ds 1
+
+wPlayerLastStopDirection:: ; d529
+; the direction in which the player was moving before the player last stopped
+ ds 1
+
+wPlayerDirection:: ; d52a
+; if the player is moving, the current direction
+; if the player is not moving, the last the direction in which the player moved
+ ds 1
-W_TILESETBANK:: ; d52b
+wTilesetBank:: ; d52b
ds 1
-W_TILESETBLOCKSPTR:: ; d52c
+wTilesetBlocksPtr:: ; d52c
; maps blocks (4x4 tiles) to tiles
ds 2
-W_TILESETGFXPTR:: ; d52e
+wTilesetGfxPtr:: ; d52e
ds 2
-W_TILESETCOLLISIONPTR:: ; d530
+wTilesetCollisionPtr:: ; d530
; list of all walkable tiles
ds 2
-W_TILESETTALKINGOVERTILES:: ; d532
+wTilesetTalkingOverTiles:: ; d532
ds 3
-W_GRASSTILE:: ; d535
+wGrassTile:: ; d535
ds 1
ds 4
@@ -1680,247 +2662,264 @@ wNumBoxItems:: ; d53a
ds 1
wBoxItems:: ; d53b
; item, quantity
- ds 50 * 2
+ ds PC_ITEM_CAPACITY * 2
ds 1 ; end
-wd5a0:: ds 2
-wd5a2:: ds 1
-wd5a3:: ds 1
+wCurrentBoxNum:: ; d5a0
+; bits 0-6: box number
+; bit 7: whether the player has changed boxes before
+ ds 2
+
+wNumHoFTeams:: ; d5a2
+; number of HOF teams
+ ds 1
+
+wUnusedD5A3:: ; d5a3
+ ds 1
wPlayerCoins:: ; d5a4
ds 2 ; BCD
-W_MISSABLEOBJECTFLAGS:: ; d5a6
+wMissableObjectFlags:: ; d5a6
; bit array of missable objects. set = removed
- ds 39
+ ds 32
+wMissableObjectFlagsEnd::
+
+ ds 7
-wd5cd:: ds 1
+wd5cd:: ds 1 ; temp copy of c1x2 (sprite facing/anim)
-W_MISSABLEOBJECTLIST:: ; d5ce
+wMissableObjectList:: ; d5ce
; each entry consists of 2 bytes
; * the sprite ID (depending on the current map)
-; * the missable object index (global, used for W_MISSABLEOBJECTFLAGS)
+; * the missable object index (global, used for wMissableObjectFlags)
; terminated with $FF
ds 17 * 2
-W_GAMEPROGRESSFLAGS:: ; d5f0
+wGameProgressFlags:: ; d5f0
; $c8 bytes
ds 0
-W_OAKSLABCURSCRIPT:: ; d5f0
+wOaksLabCurScript:: ; d5f0
ds 1
-W_PALLETTOWNCURSCRIPT:: ; d5f1
+wPalletTownCurScript:: ; d5f1
ds 1
ds 1
-W_BLUESHOUSECURSCRIPT:: ; d5f3
+wBluesHouseCurScript:: ; d5f3
ds 1
-W_VIRIDIANCITYCURSCRIPT:: ; d5f4
+wViridianCityCurScript:: ; d5f4
ds 1
ds 2
-W_PEWTERCITYCURSCRIPT:: ; d5f7
+wPewterCityCurScript:: ; d5f7
ds 1
-W_ROUTE3CURSCRIPT:: ; d5f8
+wRoute3CurScript:: ; d5f8
ds 1
-W_ROUTE4CURSCRIPT:: ; d5f9
+wRoute4CurScript:: ; d5f9
ds 1
ds 1
-W_VIRIDIANGYMCURSCRIPT:: ; d5fb
+wViridianGymCurScript:: ; d5fb
ds 1
-W_PEWTERGYMCURSCRIPT:: ; d5fc
+wPewterGymCurScript:: ; d5fc
ds 1
-W_CERULEANGYMCURSCRIPT:: ; d5fd
+wCeruleanGymCurScript:: ; d5fd
ds 1
-W_VERMILIONGYMCURSCRIPT:: ; d5fe
+wVermilionGymCurScript:: ; d5fe
ds 1
-W_CELADONGYMCURSCRIPT:: ; d5ff
+wCeladonGymCurScript:: ; d5ff
ds 1
-W_ROUTE6CURSCRIPT:: ; d600
+wRoute6CurScript:: ; d600
ds 1
-W_ROUTE8CURSCRIPT:: ; d601
+wRoute8CurScript:: ; d601
ds 1
-W_ROUTE24CURSCRIPT:: ; d602
+wRoute24CurScript:: ; d602
ds 1
-W_ROUTE25CURSCRIPT:: ; d603
+wRoute25CurScript:: ; d603
ds 1
-W_ROUTE9CURSCRIPT:: ; d604
+wRoute9CurScript:: ; d604
ds 1
-W_ROUTE10CURSCRIPT:: ; d605
+wRoute10CurScript:: ; d605
ds 1
-W_MTMOON1CURSCRIPT:: ; d606
+wMtMoon1CurScript:: ; d606
ds 1
-W_MTMOON3CURSCRIPT:: ; d607
+wMtMoon3CurScript:: ; d607
ds 1
-W_SSANNE8CURSCRIPT:: ; d608
+wSSAnne8CurScript:: ; d608
ds 1
-W_SSANNE9CURSCRIPT:: ; d609
+wSSAnne9CurScript:: ; d609
ds 1
-W_ROUTE22CURSCRIPT:: ; d60a
+wRoute22CurScript:: ; d60a
ds 1
ds 1
-W_REDSHOUSE2CURSCRIPT:: ; d60c
+wRedsHouse2CurScript:: ; d60c
ds 1
-W_VIRIDIANMARKETCURSCRIPT:: ; d60d
+wViridianMarketCurScript:: ; d60d
ds 1
-W_ROUTE22GATECURSCRIPT:: ; d60e
+wRoute22GateCurScript:: ; d60e
ds 1
-W_CERULEANCITYCURSCRIPT:: ; d60f
+wCeruleanCityCurScript:: ; d60f
ds 1
ds 7
-W_SSANNE5CURSCRIPT:: ; d617
+wSSAnne5CurScript:: ; d617
ds 1
-W_VIRIDIANFORESTCURSCRIPT:: ; d618
+wViridianForestCurScript:: ; d618
ds 1
-W_MUSEUM1FCURSCRIPT:: ; d619
+wMuseum1fCurScript:: ; d619
ds 1
-W_ROUTE13CURSCRIPT:: ; d61a
+wRoute13CurScript:: ; d61a
ds 1
-W_ROUTE14CURSCRIPT:: ; d61b
+wRoute14CurScript:: ; d61b
ds 1
-W_ROUTE17CURSCRIPT:: ; d61c
+wRoute17CurScript:: ; d61c
ds 1
-W_ROUTE19CURSCRIPT:: ; d61d
+wRoute19CurScript:: ; d61d
ds 1
-W_ROUTE21CURSCRIPT:: ; d61e
+wRoute21CurScript:: ; d61e
ds 1
-W_SAFARIZONEENTRANCECURSCRIPT:: ; d61f
+wSafariZoneEntranceCurScript:: ; d61f
ds 1
-W_ROCKTUNNEL2CURSCRIPT:: ; d620
+wRockTunnel2CurScript:: ; d620
ds 1
-W_ROCKTUNNEL1CURSCRIPT:: ; d621
+wRockTunnel1CurScript:: ; d621
ds 1
ds 1
-W_ROUTE11CURSCRIPT:: ; d623
+wRoute11CurScript:: ; d623
ds 1
-W_ROUTE12CURSCRIPT:: ; d624
+wRoute12CurScript:: ; d624
ds 1
-W_ROUTE15CURSCRIPT:: ; d625
+wRoute15CurScript:: ; d625
ds 1
-W_ROUTE16CURSCRIPT:: ; d626
+wRoute16CurScript:: ; d626
ds 1
-W_ROUTE18CURSCRIPT:: ; d627
+wRoute18CurScript:: ; d627
ds 1
-W_ROUTE20CURSCRIPT:: ; d628
+wRoute20CurScript:: ; d628
ds 1
-W_SSANNE10CURSCRIPT:: ; d629
+wSSAnne10CurScript:: ; d629
ds 1
-W_VERMILIONCITYCURSCRIPT:: ; d62a
+wVermilionCityCurScript:: ; d62a
ds 1
-W_POKEMONTOWER2CURSCRIPT:: ; d62b
+wPokemonTower2CurScript:: ; d62b
ds 1
-W_POKEMONTOWER3CURSCRIPT:: ; d62c
+wPokemonTower3CurScript:: ; d62c
ds 1
-W_POKEMONTOWER4CURSCRIPT:: ; d62d
+wPokemonTower4CurScript:: ; d62d
ds 1
-W_POKEMONTOWER5CURSCRIPT:: ; d62e
+wPokemonTower5CurScript:: ; d62e
ds 1
-W_POKEMONTOWER6CURSCRIPT:: ; d62f
+wPokemonTower6CurScript:: ; d62f
ds 1
-W_POKEMONTOWER7CURSCRIPT:: ; d630
+wPokemonTower7CurScript:: ; d630
ds 1
-W_ROCKETHIDEOUT1CURSCRIPT:: ; d631
+wRocketHideout1CurScript:: ; d631
ds 1
-W_ROCKETHIDEOUT2CURSCRIPT:: ; d632
+wRocketHideout2CurScript:: ; d632
ds 1
-W_ROCKETHIDEOUT3CURSCRIPT:: ; d633
+wRocketHideout3CurScript:: ; d633
ds 1
-W_ROCKETHIDEOUT4CURSCRIPT:: ; d634
+wRocketHideout4CurScript:: ; d634
ds 2
-W_ROUTE6GATECURSCRIPT:: ; d636
+wRoute6GateCurScript:: ; d636
ds 1
-W_ROUTE8GATECURSCRIPT:: ; d637
+wRoute8GateCurScript:: ; d637
ds 2
-W_CINNABARISLANDCURSCRIPT:: ; d639
+wCinnabarIslandCurScript:: ; d639
ds 1
-W_MANSION1CURSCRIPT:: ; d63a
+wMansion1CurScript:: ; d63a
ds 2
-W_MANSION2CURSCRIPT:: ; d63c
+wMansion2CurScript:: ; d63c
ds 1
-W_MANSION3CURSCRIPT:: ; d63d
+wMansion3CurScript:: ; d63d
ds 1
-W_MANSION4CURSCRIPT:: ; d63e
+wMansion4CurScript:: ; d63e
ds 1
-W_VICTORYROAD2CURSCRIPT:: ; d63f
+wVictoryRoad2CurScript:: ; d63f
ds 1
-W_VICTORYROAD3CURSCRIPT:: ; d640
+wVictoryRoad3CurScript:: ; d640
ds 2
-W_FIGHTINGDOJOCURSCRIPT:: ; d642
+wFightingDojoCurScript:: ; d642
ds 1
-W_SILPHCO2CURSCRIPT:: ; d643
+wSilphCo2CurScript:: ; d643
ds 1
-W_SILPHCO3CURSCRIPT:: ; d644
+wSilphCo3CurScript:: ; d644
ds 1
-W_SILPHCO4CURSCRIPT:: ; d645
+wSilphCo4CurScript:: ; d645
ds 1
-W_SILPHCO5CURSCRIPT:: ; d646
+wSilphCo5CurScript:: ; d646
ds 1
-W_SILPHCO6CURSCRIPT:: ; d647
+wSilphCo6CurScript:: ; d647
ds 1
-W_SILPHCO7CURSCRIPT:: ; d648
+wSilphCo7CurScript:: ; d648
ds 1
-W_SILPHCO8CURSCRIPT:: ; d649
+wSilphCo8CurScript:: ; d649
ds 1
-W_SILPHCO9CURSCRIPT:: ; d64a
+wSilphCo9CurScript:: ; d64a
ds 1
-W_HALLOFFAMEROOMCURSCRIPT:: ; d64b
+wHallOfFameRoomCurScript:: ; d64b
ds 1
-W_GARYCURSCRIPT:: ; d64c
+wGaryCurScript:: ; d64c
ds 1
-W_LORELEICURSCRIPT:: ; d64d
+wLoreleiCurScript:: ; d64d
ds 1
-W_BRUNOCURSCRIPT:: ; d64e
+wBrunoCurScript:: ; d64e
ds 1
-W_AGATHACURSCRIPT:: ; d64f
+wAgathaCurScript:: ; d64f
ds 1
-W_UNKNOWNDUNGEON3CURSCRIPT:: ; d650
+wUnknownDungeon3CurScript:: ; d650
ds 1
-W_VICTORYROAD1CURSCRIPT:: ; d651
+wVictoryRoad1CurScript:: ; d651
ds 1
ds 1
-W_LANCECURSCRIPT:: ; d653
+wLanceCurScript:: ; d653
ds 1
ds 4
-W_SILPHCO10CURSCRIPT:: ; d658
+wSilphCo10CurScript:: ; d658
ds 1
-W_SILPHCO11CURSCRIPT:: ; d659
+wSilphCo11CurScript:: ; d659
ds 1
ds 1
-W_FUCHSIAGYMCURSCRIPT:: ; d65b
+wFuchsiaGymCurScript:: ; d65b
ds 1
-W_SAFFRONGYMCURSCRIPT:: ; d65c
+wSaffronGymCurScript:: ; d65c
ds 1
ds 1
-W_CINNABARGYMCURSCRIPT:: ; d65e
+wCinnabarGymCurScript:: ; d65e
ds 1
-W_CELADONGAMECORNERCURSCRIPT:: ; d65f
+wCeladonGameCornerCurScript:: ; d65f
ds 1
-W_ROUTE16GATECURSCRIPT:: ; d660
+wRoute16GateCurScript:: ; d660
ds 1
-W_BILLSHOUSECURSCRIPT:: ; d661
+wBillsHouseCurScript:: ; d661
ds 1
-W_ROUTE5GATECURSCRIPT:: ; d662
+wRoute5GateCurScript:: ; d662
ds 1
-W_POWERPLANTCURSCRIPT:: ; d663
+wPowerPlantCurScript:: ; d663
; overload
ds 0
-W_ROUTE7GATECURSCRIPT:: ; d663
+wRoute7GateCurScript:: ; d663
; overload
ds 1
ds 1
-W_SSANNE2CURSCRIPT:: ; d665
+wSSAnne2CurScript:: ; d665
ds 1
-W_SEAFOAMISLANDS4CURSCRIPT:: ; d666
+wSeafoamIslands4CurScript:: ; d666
ds 1
-W_ROUTE23CURSCRIPT:: ; d667
+wRoute23CurScript:: ; d667
ds 1
-W_SEAFOAMISLANDS5CURSCRIPT:: ; d668
+wSeafoamIslands5CurScript:: ; d668
ds 1
-W_ROUTE18GATECURSCRIPT:: ; d669
+wRoute18GateCurScript:: ; d669
ds 1
- ds 134
+ ds 78
+wGameProgressFlagsEnd::
+
+ ds 56
+
+wObtainedHiddenItemsFlags::
+ ds 14
-wd6f0:: ds 14
-wd6fe:: ds 2
+wObtainedHiddenCoinsFlags::
+ ds 2
wWalkBikeSurfState:: ; d700
; $00 = walking
@@ -1930,36 +2929,36 @@ wWalkBikeSurfState:: ; d700
ds 10
-W_TOWNVISITEDFLAG:: ; d70b
+wTownVisitedFlag:: ; d70b
flag_array 13
wSafariSteps:: ; d70d
; starts at 502
ds 2
-W_FOSSILITEM:: ; d70f
+wFossilItem:: ; d70f
; item given to cinnabar lab
ds 1
-W_FOSSILMON:: ; d710
+wFossilMon:: ; d710
; mon that will result from the item
ds 1
ds 2
-W_ENEMYMONORTRAINERCLASS:: ; d713
-; trainer classes start at $c8
+wEnemyMonOrTrainerClass:: ; d713
+; trainer classes start at 200
ds 1
wPlayerJumpingYScreenCoordsIndex:: ; d714
ds 1
-W_RIVALSTARTER:: ; d715
+wRivalStarter:: ; d715
ds 1
ds 1
-W_PLAYERSTARTER:: ; d717
+wPlayerStarter:: ; d717
ds 1
wBoulderSpriteIndex:: ; d718
@@ -1973,7 +2972,8 @@ wDestinationMap:: ; d71a
; destination map (for certain types of special warps, not ordinary walking)
ds 1
-wd71b:: ds 1
+wUnusedD71B:: ; d71b
+ ds 1
wTileInFrontOfBoulderAndBoulderCollisionResult:: ; d71c
; used to store the tile in front of the boulder when trying to push a boulder
@@ -1988,28 +2988,66 @@ wWhichDungeonWarp:: ; d71e
; which dungeon warp within the source map was used
ds 1
-wd71f:: ds 9
+wUnusedD71F:: ; d71f
+ ds 1
-wd728::
+ ds 8
+
+wd728:: ; d728
; bit 0: using Strength outside of battle
+; bit 1: set by IsSurfingAllowed when surfing's allowed, but the caller resets it after checking the result
+; bit 3: received Old Rod
+; bit 4: received Good Rod
+; bit 5: received Super Rod
+; bit 6: gave one of the Saffron guards a drink
+; bit 7: set by ItemUseCardKey, which is leftover code from a previous implementation of the Card Key
+ ds 1
+
ds 1
+wBeatGymFlags:: ; d72a
+; redundant because it matches wObtainedBadges
+; used to determine whether to show name on statue and in two NPC text scripts
ds 1
-wd72a:: ds 2
+ ds 1
wd72c:: ; d72c
; bit 0: if not set, the 3 minimum steps between random battles have passed
+; bit 1: prevent audio fade out
ds 1
-wd72d:: ds 1
-wd72e:: ds 2
+wd72d:: ; d72d
+; This variable is used for temporary flags and as the destination map when
+; warping to the Trade Center or Colosseum.
+; bit 0: sprite facing directions have been initialised in the Trade Center
+; bit 3: do scripted warp (used to warp back to Lavender Town from the top of the pokemon tower)
+; bit 4: on a dungeon warp
+; bit 5: don't make NPCs face the player when spoken to
+; Bits 6 and 7 are set by scripts when starting major battles in the storyline,
+; but they do not appear to affect anything. Bit 6 is reset after all battles
+; and bit 7 is reset after trainer battles (but it's only set before trainer
+; battles anyway).
+ ds 1
+
+wd72e:: ; d72e
+; bit 0: the player has received Lapras in the Silph Co. building
+; bit 1: set in various places, but doesn't appear to have an effect
+; bit 2: the player has healed pokemon at a pokemon center at least once
+; bit 3: the player has a received a pokemon from Prof. Oak
+; bit 4: disable battles
+; bit 5: set when a battle ends and when the player blacks out in the overworld due to poison
+; bit 6: using the link feature
+; bit 7: set if scripted NPC movement has been initialised
+ ds 1
+
+ ds 1
-wd730::
+wd730:: ; d730
; bit 0: NPC sprite being moved by script
; bit 5: ignore joypad input
; bit 6: print text with no delay between each letter
-; bit 7: set if joypad states are being simulated in the overworld
+; bit 7: set if joypad states are being simulated in the overworld or an NPC's movement is being scripted
ds 1
ds 1
@@ -2028,18 +3066,26 @@ wd732:: ; d732
; bit 6: map destination is [wLastBlackoutMap] (usually the last used pokemon center, but could be the player's house)
ds 1
-W_FLAGS_D733:: ; d733
-; bit 4: use variable [W_CURMAPSCRIPT] instead of the provided index for next frame's map script (used to start battle when talking to trainers)
+wFlags_D733:: ; d733
+; bit 0: running a test battle
+; bit 1: prevent music from changing when entering new map
+; bit 2: skip the joypad check in CheckWarpsNoCollision (used for the forced warp down the waterfall in the Seafoam Islands)
+; bit 3: trainer wants to battle
+; bit 4: use variable [wCurMapScript] instead of the provided index for next frame's map script (used to start battle when talking to trainers)
; bit 7: used fly out of battle
ds 1
-wd734:: ds 2
+wBeatLorelei:: ; d734
+; bit 1: set when you beat Lorelei and reset in Indigo Plateau lobby
+; the game uses this to tell when Elite 4 events need to be reset
+ ds 2
wd736:: ; d736
; bit 0: check if the player is standing on a door and make him walk down a step if so
; bit 1: the player is currently stepping down from a door
; bit 2: standing on a warp
-; bit 6: jumping down a ledge
+; bit 6: jumping down a ledge / fishing animation
+; bit 7: player sprite spinning due to spin tiles (Rocket hidehout / Viridian Gym)
ds 1
wCompletedInGameTradeFlags:: ; d737
@@ -2047,8 +3093,13 @@ wCompletedInGameTradeFlags:: ; d737
ds 2
-wd73b:: ds 1
-wd73c:: ds 3
+wWarpedFromWhichWarp:: ; d73b
+ ds 1
+
+wWarpedFromWhichMap:: ; d73c
+ ds 1
+
+ ds 2
wCardKeyDoorY:: ; d73f
ds 1
@@ -2058,158 +3109,39 @@ wCardKeyDoorX:: ; d740
ds 2
-wd743:: ds 1
-wd744:: ds 3
-wd747:: ds 3
-wd74a:: ds 1
-
-wd74b:: ; d74b
-; bit 0: Prof. Oak has lead the player to the north end of his lab
-; bit 1: Prof. Oak has asked the player to choose a pokemon
-; bit 2: the player and the rival have received their pokemon
-; bit 3: the player has battled the rival in Oak's lab
-; bit 4: Prof. Oak has given the player 5 pokeballs
-; bit 5: received pokedex
- ds 1
-
-wd74c:: ds 2
-wd74e:: ds 3
-wd751:: ds 1
-wd752:: ds 2
-wd754:: ds 1
-wd755:: ds 5
-wd75a:: ds 1
-wd75b:: ds 3
-wd75e:: ds 1
-wd75f:: ds 5
-wd764:: ds 1
-wd765:: ds 1
-wd766:: ds 1
-wd767:: ds 1
-wd768:: ds 1
-wd769:: ds 3
-wd76c:: ds 5
-wd771:: ds 2
-wd773:: ds 4
-wd777:: ds 1
-wd778:: ds 4
-wd77c:: ds 1
-wd77d:: ds 1
-wd77e:: ds 5
-wd783:: ds 11
-wd78e:: ds 2
-wd790:: ds 2
-wd792:: ds 4
-wd796:: ds 2
-wd798:: ds 2
-wd79a:: ds 1
-wd79b:: ds 1
-wd79c:: ds 5
-wd7a1:: ds 2
-wd7a3:: ds 12
-wd7af:: ds 2
-wd7b1:: ds 2
-wd7b3:: ds 1
-wd7b4:: ds 5
-wd7b9:: ds 4
-wd7bd:: ds 2
-wd7bf:: ds 3
-wd7c2:: ds 1
-wd7c3:: ds 2
-wd7c5:: ds 1
-wd7c6:: ds 3
-wd7c9:: ds 4
-wd7cd:: ds 2
-wd7cf:: ds 2
-wd7d1:: ds 1
-wd7d2:: ds 1
-wd7d3:: ds 2
-wd7d5:: ds 1
-wd7d6:: ds 1
-wd7d7:: ds 1
-wd7d8:: ds 1
-wd7d9:: ds 2
-wd7db:: ds 2
-wd7dd:: ds 2
-wd7df:: ds 1
-wd7e0:: ds 1
-wd7e1:: ds 2
-wd7e3:: ds 2
-wd7e5:: ds 2
-wd7e7:: ds 1
-wd7e8:: ds 1
-wd7e9:: ds 2
-wd7eb:: ds 2
-wd7ed:: ds 1
-wd7ee:: ds 1
-wd7ef:: ds 1
-wd7f0:: ds 1
-wd7f1:: ds 1
-wd7f2:: ds 1
-wd7f3:: ds 2
-wd7f5:: ds 1
-wd7f6:: ds 9
-wd7ff:: ds 4
-wd803:: ds 2
-wd805:: ds 2
-wd807:: ds 2
-wd809:: ds 10
-wd813:: ds 2
-wd815:: ds 1
-wd816:: ds 1
-wd817:: ds 2
-wd819:: ds 2
-wd81b:: ds 10
-wd825:: ds 1
-wd826:: ds 1
-wd827:: ds 1
-wd828:: ds 1
-wd829:: ds 1
-wd82a:: ds 1
-wd82b:: ds 1
-wd82c:: ds 1
-wd82d:: ds 1
-wd82e:: ds 1
-wd82f:: ds 1
-wd830:: ds 1
-wd831:: ds 1
-wd832:: ds 1
-wd833:: ds 1
-wd834:: ds 1
-wd835:: ds 1
-wd836:: ds 1
-wd837:: ds 1
-wd838:: ds 15
-wd847:: ds 2
-wd849:: ds 2
-wd84b:: ds 12
-wd857:: ds 8
-wd85f:: ds 4
-wd863:: ds 1
-wd864:: ds 1
-wd865:: ds 1
-wd866:: ds 1
-wd867:: ds 2
-wd869:: ds 20
-wd87d:: ds 2
-wd87f:: ds 1
-wd880:: ds 1
-wd881:: ds 1
-wd882:: ds 5
+wFirstLockTrashCanIndex:: ; d743
+ ds 1
+
+wSecondLockTrashCanIndex:: ; d743
+ ds 1
+
+ ds 2
+wEventFlags:: ; d747
+ ds 320
wLinkEnemyTrainerName:: ; d887
; linked game's trainer name
-W_GRASSRATE:: ; d887
+wGrassRate:: ; d887
ds 1
-W_GRASSMONS:: ; d888
- ds 20
+wGrassMons:: ; d888
+ ;ds 20
+ ds 11
+; Overload wGrassMons
+wSerialEnemyDataBlock:: ; d893
+ ds 9
wEnemyPartyCount:: ds 1 ; d89c
wEnemyPartyMons:: ds PARTY_LENGTH + 1 ; d89d
+; Overload enemy party data
+wWaterRate:: db ; d8a4
+wWaterMons:: db ; d8a5
+
+ ds wWaterRate - @
+
wEnemyMons:: ; d8a4
wEnemyMon1:: party_struct wEnemyMon1
wEnemyMon2:: party_struct wEnemyMon2
@@ -2218,75 +3150,79 @@ wEnemyMon4:: party_struct wEnemyMon4
wEnemyMon5:: party_struct wEnemyMon5
wEnemyMon6:: party_struct wEnemyMon6
-wEnemyMonOT:: ds 11 * PARTY_LENGTH ; d9ac
-wEnemyMonNicks:: ds 11 * PARTY_LENGTH ; d9ee
+wEnemyMonOT:: ds NAME_LENGTH * PARTY_LENGTH ; d9ac
+wEnemyMonNicks:: ds NAME_LENGTH * PARTY_LENGTH ; d9ee
-W_TRAINERHEADERPTR:: ; da30
+wTrainerHeaderPtr:: ; da30
ds 2
ds 6
-wda38:: ds 1
+wOpponentAfterWrongAnswer:: ; da38
+; the trainer the player must face after getting a wrong answer in the Cinnabar
+; gym quiz
-W_CURMAPSCRIPT:: ; da39
+wUnusedDA38:: ; da38
+ ds 1
+
+wCurMapScript:: ; da39
; index of current map script, mostly used as index for function pointer array
; mostly copied from map-specific map script pointer and wirtten back later
ds 1
- ds 6
+ ds 7
-W_PLAYTIMEHOURS:: ; da40
- ds 2
-W_PLAYTIMEMINUTES:: ; da42
- ds 2
-W_PLAYTIMESECONDS:: ; da44
+wPlayTimeHours:: ; da41
+ ds 1
+wPlayTimeMaxed:: ; da42
ds 1
-W_PLAYTIMEFRAMES:: ; da45
+wPlayTimeMinutes:: ; da43
+ ds 1
+wPlayTimeSeconds:: ; da44
+ ds 1
+wPlayTimeFrames:: ; da45
ds 1
wSafariZoneGameOver:: ; da46
ds 1
-W_NUMSAFARIBALLS:: ; da47
+wNumSafariBalls:: ; da47
ds 1
-W_DAYCARE_IN_USE:: ; da48
+wDayCareInUse:: ; da48
; 0 if no pokemon is in the daycare
; 1 if pokemon is in the daycare
ds 1
-W_DAYCAREMONNAME:: ds 11 ; da49
-W_DAYCAREMONOT:: ds 11 ; da54
+wDayCareMonName:: ds NAME_LENGTH ; da49
+wDayCareMonOT:: ds NAME_LENGTH ; da54
wDayCareMon:: box_struct wDayCareMon ; da5f
+wMainDataEnd::
+
-W_NUMINBOX:: ds 1 ; da80
+wBoxDataStart::
+
+wNumInBox:: ds 1 ; da80
wBoxSpecies:: ds MONS_PER_BOX + 1
wBoxMons::
wBoxMon1:: box_struct wBoxMon1 ; da96
wBoxMon2:: ds box_struct_length * (MONS_PER_BOX + -1) ; dab7
-wBoxMonOT:: ds 11 * MONS_PER_BOX ; dd2a
-wBoxMonNicks:: ds 11 * MONS_PER_BOX ; de06
+wBoxMonOT:: ds NAME_LENGTH * MONS_PER_BOX ; dd2a
+wBoxMonNicks:: ds NAME_LENGTH * MONS_PER_BOX ; de06
wBoxMonNicksEnd:: ; dee2
+wBoxDataEnd::
+
SECTION "Stack", WRAMX[$dfff], BANK[1]
wStack:: ; dfff
ds -$100
-SECTION "Sprite Buffers", SRAM, BANK[0]
-
-S_SPRITEBUFFER0:: ds SPRITEBUFFERSIZE ; a000
-S_SPRITEBUFFER1:: ds SPRITEBUFFERSIZE ; a188
-S_SPRITEBUFFER2:: ds SPRITEBUFFERSIZE ; a310
-
- ds $100
-
-sHallOfFame:: ds HOF_TEAM * NUM_HOF_TEAMS ; a598
-
+INCLUDE "sram.asm"