From 5c73cffee6b854e4e08db04a776aa8a71d3a82cd Mon Sep 17 00:00:00 2001 From: Rangi Date: Mon, 31 May 2021 15:04:28 -0400 Subject: Start reformatting WRAM labels wLabel:: ; comment ds N becomes ; comment wLabel:: ds N --- wram.asm | 996 +++++++++++++++++++++++---------------------------------------- 1 file changed, 365 insertions(+), 631 deletions(-) (limited to 'wram.asm') diff --git a/wram.asm b/wram.asm index 47c40101..4a83a8e8 100644 --- a/wram.asm +++ b/wram.asm @@ -12,14 +12,13 @@ wUnusedC000:: db wSoundID:: db -wMuteAudioAndPauseMusic:: ; 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 +wMuteAudioAndPauseMusic:: db wDisableChannelOutputWhenSfxEnds:: db @@ -27,90 +26,64 @@ wStereoPanning:: db wSavedVolume:: db -wChannelCommandPointers:: - ds 16 +wChannelCommandPointers:: ds 16 -wChannelReturnAddresses:: - ds 16 +wChannelReturnAddresses:: ds 16 -wChannelSoundIDs:: - ds 8 +wChannelSoundIDs:: ds 8 -wChannelFlags1:: - ds 8 +wChannelFlags1:: ds 8 -wChannelFlags2:: - ds 8 +wChannelFlags2:: ds 8 -wChannelDutyCycles:: - ds 8 +wChannelDutyCycles:: ds 8 -wChannelDutyCyclePatterns:: - ds 8 +wChannelDutyCyclePatterns:: ds 8 -wChannelVibratoDelayCounters:: ; reloaded at the beginning of a note. counts down until the vibrato begins. - ds 8 +wChannelVibratoDelayCounters:: ds 8 -wChannelVibratoExtents:: - ds 8 +wChannelVibratoExtents:: ds 8 -wChannelVibratoRates:: ; high nybble is rate (counter reload value) and low nybble is counter. ; time between applications of vibrato. - ds 8 +wChannelVibratoRates:: ds 8 -wChannelFrequencyLowBytes:: - ds 8 +wChannelFrequencyLowBytes:: ds 8 -wChannelVibratoDelayCounterReloadValues:: ; delay of the beginning of the vibrato from the start of the note - ds 8 +wChannelVibratoDelayCounterReloadValues:: ds 8 -wChannelPitchSlideLengthModifiers:: - ds 8 +wChannelPitchSlideLengthModifiers:: ds 8 -wChannelPitchSlideFrequencySteps:: - ds 8 +wChannelPitchSlideFrequencySteps:: ds 8 -wChannelPitchSlideFrequencyStepsFractionalPart:: - ds 8 +wChannelPitchSlideFrequencyStepsFractionalPart:: ds 8 -wChannelPitchSlideCurrentFrequencyFractionalPart:: - ds 8 +wChannelPitchSlideCurrentFrequencyFractionalPart:: ds 8 -wChannelPitchSlideCurrentFrequencyHighBytes:: - ds 8 +wChannelPitchSlideCurrentFrequencyHighBytes:: ds 8 -wChannelPitchSlideCurrentFrequencyLowBytes:: - ds 8 +wChannelPitchSlideCurrentFrequencyLowBytes:: ds 8 -wChannelPitchSlideTargetFrequencyHighBytes:: - ds 8 +wChannelPitchSlideTargetFrequencyHighBytes:: ds 8 -wChannelPitchSlideTargetFrequencyLowBytes:: - ds 8 +wChannelPitchSlideTargetFrequencyLowBytes:: ds 8 -wChannelNoteDelayCounters:: ; 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 +wChannelNoteDelayCounters:: ds 8 -wChannelLoopCounters:: - ds 8 +wChannelLoopCounters:: ds 8 -wChannelNoteSpeeds:: - ds 8 +wChannelNoteSpeeds:: ds 8 -wChannelNoteDelayCountersFractionalPart:: - ds 8 +wChannelNoteDelayCountersFractionalPart:: ds 8 -wChannelOctaves:: - ds 8 +wChannelOctaves:: ds 8 -wChannelVolumes:: ; also includes fade for hardware channels that support it - ds 8 +wChannelVolumes:: ds 8 wMusicWaveInstrument:: db @@ -139,10 +112,9 @@ SECTION "Sprite State Data", WRAM0 wSpriteDataStart:: -wSpriteStateData1:: ; data for all sprites on the current map ; holds info for 16 sprites with $10 bytes each -; player sprite is always sprite 0 +wSpriteStateData1:: ; struct fields: ; - 0: picture ID (fixed, loaded at map init) ; - 1: movement status (0: uninitialized, 1: ready, 2: delayed, 3: moving) @@ -166,10 +138,9 @@ FOR n, 1, NUM_SPRITESTATEDATA_STRUCTS wSprite{02d:n}StateData1:: spritestatedata1 wSprite{02d:n}StateData1 ENDR -wSpriteStateData2:: ; more data for all sprites on the current map ; holds info for 16 sprites with $10 bytes each -; player sprite is always sprite 0 +wSpriteStateData2:: ; struct fields: ; - 0: walk animation counter (counting from $10 backwards when moving) ; - 1: @@ -203,184 +174,157 @@ wSpriteDataEnd:: SECTION "OAM Buffer", WRAM0 -wOAMBuffer:: ; buffer for OAM data. Copied to OAM by DMA +wOAMBuffer:: ; wOAMBufferSprite00 - wOAMBufferSprite39 FOR n, NUM_SPRITE_OAM_STRUCTS wOAMBufferSprite{02d:n}:: sprite_oam_struct wOAMBufferSprite{02d:n} ENDR wOAMBufferEnd:: -wTileMap:: ; buffer for tiles that are visible on screen (20 columns by 18 rows) - ds SCREEN_WIDTH * SCREEN_HEIGHT +wTileMap:: ds SCREEN_WIDTH * SCREEN_HEIGHT UNION -wTileMapBackup:: ; buffer for temporarily saving and restoring current screen's tiles ; (e.g. if menus are drawn on top) - ds SCREEN_WIDTH * SCREEN_HEIGHT +wTileMapBackup:: ds SCREEN_WIDTH * SCREEN_HEIGHT NEXTU -wSerialPartyMonsPatchList:: ; list of indexes to patch with SERIAL_NO_DATA_BYTE after transfer - ds 200 +wSerialPartyMonsPatchList:: ds 200 -wSerialEnemyMonsPatchList:: ; list of indexes to patch with SERIAL_NO_DATA_BYTE after transfer - ds 200 +wSerialEnemyMonsPatchList:: ds 200 ENDU ds 80 UNION -wOverworldMap:: - ds 1300 +wOverworldMap:: ds 1300 wOverworldMapEnd:: NEXTU -wTempPic:: - ds 7 * 7 tiles +wTempPic:: ds 7 * 7 tiles ENDU -wRedrawRowOrColumnSrcTiles:: ; the tiles of the row or column to be redrawn by RedrawRowOrColumn - ds SCREEN_WIDTH * 2 +wRedrawRowOrColumnSrcTiles:: ds SCREEN_WIDTH * 2 ; coordinates of the position of the cursor for the top menu item (id 0) wTopMenuItemY:: db wTopMenuItemX:: db -wCurrentMenuItem:: ; the id of the currently selected menu item ; the top item has id 0, the one below that has id 1, etc. ; note that the "top item" means the top item currently visible on the screen ; add this value to [wListScrollOffset] to get the item's position within the list - ds 1 +wCurrentMenuItem:: db -wTileBehindCursor:: ; the tile that was behind the menu cursor's current location - ds 1 +wTileBehindCursor:: db -wMaxMenuItem:: ; id of the bottom menu item - ds 1 +wMaxMenuItem:: db -wMenuWatchedKeys:: ; bit mask of keys that the menu will respond to - ds 1 +wMenuWatchedKeys:: db -wLastMenuItem:: ; id of previously selected menu item - ds 1 +wLastMenuItem:: db -wPartyAndBillsPCSavedMenuItem:: ; 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 +wPartyAndBillsPCSavedMenuItem:: db -wBagSavedMenuItem:: ; It is used by the bag list to remember the cursor position while the menu ; isn't active. - ds 1 +wBagSavedMenuItem:: db -wBattleAndStartSavedMenuItem:: ; 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 +wBattleAndStartSavedMenuItem:: db wPlayerMoveListIndex:: db -wPlayerMonNumber:: ; index in party of currently battling mon - ds 1 +wPlayerMonNumber:: db -wMenuCursorLocation:: ; the address of the menu cursor's current location within wTileMap - ds 2 +wMenuCursorLocation:: dw ds 2 -wMenuJoypadPollCount:: ; how many times should HandleMenuInput poll the joypad state before it returns? - ds 1 +wMenuJoypadPollCount:: db -wMenuItemToSwap:: ; id of menu item selected for swapping (counts from 1) (0 means that no menu item has been selected for swapping) - ds 1 +wMenuItemToSwap:: db -wListScrollOffset:: ; offset of the current top menu item from the beginning of the list ; keeps track of what section of the list is on screen - ds 1 +wListScrollOffset:: db -wMenuWatchMovingOutOfBounds:: ; 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 +wMenuWatchMovingOutOfBounds:: db wTradeCenterPointerTableIndex:: db ds 1 -wTextDest:: ; destination pointer for text output ; this variable is written to, but is never read from - ds 2 +wTextDest:: dw -wDoNotWaitForButtonPressAfterDisplayingText:: ; if non-zero, skip waiting for a button press after displaying text in DisplayTextID - ds 1 +wDoNotWaitForButtonPressAfterDisplayingText:: db -wSerialSyncAndExchangeNybbleReceiveData:: ; the final received nybble is stored here by Serial_SyncAndExchangeNybble +wSerialSyncAndExchangeNybbleReceiveData:: -wSerialExchangeNybbleTempReceiveData:: ; temporary nybble used by Serial_ExchangeNybble +wSerialExchangeNybbleTempReceiveData:: -wLinkMenuSelectionReceiveBuffer:: ; two byte buffer ; the received menu selection is stored twice - ds 1 +wLinkMenuSelectionReceiveBuffer:: db -wSerialExchangeNybbleReceiveData:: ; the final received nybble is stored here by Serial_ExchangeNybble - ds 1 +wSerialExchangeNybbleReceiveData:: db ds 3 -wSerialExchangeNybbleSendData:: ; this nybble is sent when using Serial_SyncAndExchangeNybble or Serial_ExchangeNybble +wSerialExchangeNybbleSendData:: -wLinkMenuSelectionSendBuffer:: ; two byte buffer ; the menu selection byte is stored twice before sending +wLinkMenuSelectionSendBuffer:: ds 5 -wLinkTimeoutCounter:: ; 1 byte +wLinkTimeoutCounter:: -wUnknownSerialCounter:: ; 2 bytes +wUnknownSerialCounter:: -wEnteringCableClub:: ; 1 byte - ds 2 +wEnteringCableClub:: dw -wWhichTradeMonSelectionMenu:: ; $00 = player mons ; $01 = enemy mons +wWhichTradeMonSelectionMenu:: -wMonDataLocation:: ; 0 = player's party ; 1 = enemy party ; 2 = current box @@ -390,74 +334,69 @@ wMonDataLocation:: ; 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 +wMonDataLocation:: db -wMenuWrappingEnabled:: ; 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 +wMenuWrappingEnabled:: db -wCheckFor180DegreeTurn:: ; whether to check for 180-degree turn (0 = don't, 1 = do) - ds 1 +wCheckFor180DegreeTurn:: db ds 1 wMissableObjectIndex:: db wPredefID:: db -wPredefRegisters:: - ds 6 +wPredefRegisters:: ds 6 wTrainerHeaderFlagBit:: db ds 1 -wNPCMovementScriptPointerTableNum:: ; which NPC movement script pointer is being used ; 0 if an NPC movement script is not running - ds 1 +wNPCMovementScriptPointerTableNum:: db -wNPCMovementScriptBank:: ; ROM bank of current NPC movement script - ds 1 +wNPCMovementScriptBank:: db ds 2 wUnusedCC5B:: -wVermilionDockTileMapBuffer:: ; 180 bytes +wVermilionDockTileMapBuffer:: wOaksAideRewardItemName:: wDexRatingNumMonsSeen:: -wFilteredBagItems:: ; List of bag items that has been filtered to a certain type of items, ; such as drinks or fossils. +wFilteredBagItems:: wElevatorWarpMaps:: -wMonPartySpritesSavedOAM:: ; Saved copy of OAM for the first frame of the animation to make it easy to ; flip back from the second frame. ; $60 bytes +wMonPartySpritesSavedOAM:: -wTrainerCardBlkPacket:: ; $40 bytes +wTrainerCardBlkPacket:: -wSlotMachineSevenAndBarModeChance:: ; 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. +wSlotMachineSevenAndBarModeChance:: +; values between 0-6. Shake screen horizontally, shake screen vertically, blink Pokemon... wHallOfFame:: wBoostExpByExpAll:: wAnimationType:: -; values between 0-6. Shake screen horizontally, shake screen vertically, blink Pokemon... wNPCMovementDirections:: db @@ -465,9 +404,8 @@ wDexRatingNumMonsOwned:: db wDexRatingText:: db -wSlotMachineSavedROMBank:: ; ROM back to return to when the player is done with the slot machine - ds 1 +wSlotMachineSavedROMBank:: db ds 26 @@ -476,87 +414,75 @@ wAnimPalette:: db ds 29 UNION -wNPCMovementDirections2:: - ds 10 +wNPCMovementDirections2:: ds 10 +; used in Pallet Town scripted movement +wNumStepsToTake:: db NEXTU -wSwitchPartyMonTempBuffer:: ; temporary buffer when swapping party mon data - ds 49 - -NEXTU - ds 10 - -wNumStepsToTake:: -; used in Pallet Town scripted movement - ds 1 +wSwitchPartyMonTempBuffer:: ds 49 ENDU ds 10 wRLEByteCount:: db -wAddedToParty:: ; 0 = not added ; 1 = added +wAddedToParty:: -wSimulatedJoypadStatesEnd:: ; 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 +wSimulatedJoypadStatesEnd:: wParentMenuItem:: -wCanEvolveFlags:: ; 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 +wCanEvolveFlags:: db wForceEvolution:: db ; if [wAILayer2Encouragement] != 1, the second AI layer is not applied wAILayer2Encouragement:: db + ds 1 ; current HP of player and enemy substitutes wPlayerSubstituteHP:: db wEnemySubstituteHP:: db -wTestBattlePlayerSelectedMove:: ; The player's selected move during a test battle. ; InitBattleVariables sets it to the move Pound. - ds 1 +wTestBattlePlayerSelectedMove:: db ds 1 -wMoveMenuType:: ; 0=regular, 1=mimic, 2=above message box (relearn, heal pp..) - ds 1 +wMoveMenuType:: db wPlayerSelectedMove:: db wEnemySelectedMove:: db wLinkBattleRandomNumberListIndex:: db -wAICount:: ; number of times remaining that AI action can occur - ds 1 +wAICount:: db ds 2 wEnemyMoveListIndex:: db -wLastSwitchInEnemyMonHP:: ; 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 +wLastSwitchInEnemyMonHP:: dw -wTotalPayDayMoney:: ; total amount of money made using Pay Day during the current battle - ds 3 +wTotalPayDayMoney:: ds 3 wSafariEscapeFactor:: db wSafariBaitFactor:: db @@ -570,10 +496,9 @@ wMonIsDisobedient:: ds 1 wPlayerDisabledMoveNumber:: ds 1 wEnemyDisabledMoveNumber:: ds 1 -wInHandlePlayerMonFainted:: ; When running in the scope of HandlePlayerMonFainted, it equals 1. ; When running in the scope of HandleEnemyMonFainted, it equals 0. - ds 1 +wInHandlePlayerMonFainted:: db wPlayerUsedMove:: ds 1 wEnemyUsedMove:: ds 1 @@ -582,14 +507,12 @@ wEnemyMonMinimized:: ds 1 wMoveDidntMiss:: ds 1 -wPartyFoughtCurrentEnemyFlags:: ; flags that indicate which party members have fought the current enemy mon - flag_array 6 +wPartyFoughtCurrentEnemyFlags:: flag_array 6 -wLowHealthAlarmDisabled:: ; Whether the low health alarm has been disabled due to the player winning the ; battle. - ds 1 +wLowHealthAlarmDisabled:: db wPlayerMonMinimized:: db @@ -597,11 +520,11 @@ wPlayerMonMinimized:: db wLuckySlotHiddenObjectIndex:: -wEnemyNumHits:: ; number of hits by enemy in attacks like Double Slap, etc. +wEnemyNumHits:: -wEnemyBideAccumulatedDamage:: ; the amount of damage accumulated by the enemy while biding (2 bytes) +wEnemyBideAccumulatedDamage:: ds 10 @@ -637,6 +560,7 @@ wPlayerMonAccuracyMod:: db wPlayerMonEvasionMod:: db ds 2 + wPlayerMonStatModsEnd:: ds 1 @@ -646,14 +570,14 @@ wEnemyMonUnmodifiedMaxHP:: dw wEnemyMonUnmodifiedAttack:: dw wEnemyMonUnmodifiedDefense:: db +; ds 11 wInGameTradeMonNick:: db wEnemyMonUnmodifiedSpeed:: dw wEnemyMonUnmodifiedSpecial:: db wEngagedTrainerClass:: db -wEngagedTrainerSet:: -; ds 1 +wEngagedTrainerSet:: ; db ; stat modifiers for the enemy's current pokemon ; value can range from 1 - 13 ($1 to $D) @@ -670,6 +594,7 @@ wEnemyMonEvasionMod:: db wInGameTradeReceiveMonSpecies:: db ds 1 + wEnemyMonStatModsEnd:: ds 1 @@ -678,59 +603,54 @@ wNPCMovementDirections2Index:: wUnusedCD37:: -wFilteredBagItemsCount:: ; number of items in wFilteredBagItems list - ds 1 +wFilteredBagItemsCount:: db -wSimulatedJoypadStatesIndex:: ; the next simulated joypad state is at wSimulatedJoypadStatesEnd plus this value minus 1 ; 0 if the joypad state is not being simulated - ds 1 +wSimulatedJoypadStatesIndex:: db -wWastedByteCD39:: ; written to but nothing ever reads it - ds 1 +wWastedByteCD39:: db -wWastedByteCD3A:: ; written to but nothing ever reads it - ds 1 +wWastedByteCD3A:: db -wOverrideSimulatedJoypadStatesMask:: ; mask indicating which real button presses can override simulated ones ; XXX is it ever not 0? - ds 1 +wOverrideSimulatedJoypadStatesMask:: db ds 1 -wFallingObjectsMovementData:: ; up to 20 bytes (one byte for each falling object) +wFallingObjectsMovementData:: wSavedY:: wTempSCX:: -wBattleTransitionCircleScreenQuadrantY:: ; 0 = upper half (Y < 9) ; 1 = lower half (Y >= 9) +wBattleTransitionCircleScreenQuadrantY:: -wBattleTransitionCopyTilesOffset:: ; 2 bytes ; after 1 row/column has been copied, the offset to the next one to copy from +wBattleTransitionCopyTilesOffset:: -wInwardSpiralUpdateScreenCounter:: ; 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 +wInwardSpiralUpdateScreenCounter:: wHoFTeamIndex:: -wSSAnneSmokeDriftAmount:: ; multiplied by 16 to get the number of times to go right by 2 pixels +wSSAnneSmokeDriftAmount:: wRivalStarterTemp:: -wBoxMonCounts:: ; 12 bytes ; array of the number of mons in each box +wBoxMonCounts:: wDexMaxSeenMon:: @@ -742,20 +662,20 @@ wCanPlaySlots:: wNumShakes:: -wDayCareStartLevel:: ; the level of the mon at the time it entered day care +wDayCareStartLevel:: wWhichBadge:: -wPriceTemp:: ; 3-byte BCD number +wPriceTemp:: wTitleMonSpecies:: wPlayerCharacterOAMTile:: -wMoveDownSmallStarsOAMCount:: ; the number of small stars OAM entries to move down +wMoveDownSmallStarsOAMCount:: wChargeMoveNum:: @@ -769,23 +689,23 @@ wSwappedMenuItem:: wHoFMonSpecies:: -wFieldMoves:: ; 4 bytes ; the current mon's field moves +wFieldMoves:: -wBadgeNumberTile:: ; tile ID of the badge number being drawn +wBadgeNumberTile:: -wRodResponse:: ; 0 = no bite ; 1 = bite ; 2 = no fish on map +wRodResponse:: wWhichTownMapLocation:: -wStoppingWhichSlotMachineWheel:: ; which wheel the player is trying to stop ; 0 = none, 1 = wheel 1, 2 = wheel 2, 3 or greater = wheel 3 +wStoppingWhichSlotMachineWheel:: wTradedPlayerMonSpecies:: @@ -803,19 +723,19 @@ wBoxNumString:: wHiddenObjectFunctionArgument:: -wWhichTrade:: ; which entry from TradeMons to select +wWhichTrade:: wTrainerSpriteOffset:: wUnusedCD3D:: db -wHUDPokeballGfxOffsetX:: ; difference in X between the next ball and the current one +wHUDPokeballGfxOffsetX:: -wBattleTransitionCircleScreenQuadrantX:: ; 0 = left half (X < 10) ; 1 = right half (X >= 10) +wBattleTransitionCircleScreenQuadrantX:: wSSAnneSmokeX:: @@ -829,14 +749,14 @@ wTrainerInfoTextBoxWidth:: wHoFPartyMonIndex:: -wNumCreditsMonsDisplayed:: ; the number of credits mons that have been displayed so far +wNumCreditsMonsDisplayed:: -wBadgeNameTile:: ; first tile ID of the name being drawn +wBadgeNameTile:: -wFlyLocationsList:: ; NUM_CITY_MAPS bytes plus $ff sentinel values at each end +wFlyLocationsList:: wSlotMachineWheel1Offset:: @@ -854,11 +774,11 @@ wHiddenObjectFunctionRomBank:: wTrainerEngageDistance:: db -wHUDGraphicsTiles:: ; 3 bytes +wHUDGraphicsTiles:: -wDayCareTotalCost:: ; 2-byte BCD number +wDayCareTotalCost:: wJigglypuffFacingDirections:: @@ -868,10 +788,10 @@ wTrainerInfoTextBoxNextRowOffset:: wHoFMonLevel:: -wBadgeOrFaceTiles:: ; 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 +wBadgeOrFaceTiles:: wSlotMachineWheel2Offset:: @@ -887,10 +807,10 @@ wHiddenObjectIndex:: wTrainerFacingDirection:: db -wHoFMonOrPlayer:: ; show mon or show player? ; 0 = mon ; 1 = player +wHoFMonOrPlayer:: wSlotMachineWheel3Offset:: @@ -902,8 +822,8 @@ wTrainerScreenY:: wOptionsCancelCursorX:: db -wDayCarePerLevelCost:: ; 2-byte BCD number (always set to $100) +wDayCarePerLevelCost:: wHoFTeamIndex2:: @@ -913,8 +833,8 @@ wTradedPlayerMonOT:: wHiddenObjectX:: -wSlotMachineWinningSymbol:: ; the OAM tile number of the upper left corner of the winning symbol minus 2 +wSlotMachineWinningSymbol:: wNumFieldMoves:: @@ -929,8 +849,8 @@ wSlotMachineWheel1MiddleTile:: wFieldMovesLeftmostXCoord:: db -wLastFieldMoveID:: ; unused +wLastFieldMoveID:: wSlotMachineWheel1TopTile:: db @@ -938,89 +858,82 @@ wSlotMachineWheel2BottomTile:: db wSlotMachineWheel2MiddleTile:: db -wTempCoins1:: ; 2 bytes ; temporary variable used to add payout amount to the player's coins +wTempCoins1:: wSlotMachineWheel2TopTile:: db -wBattleTransitionSpiralDirection:: ; 0 = outward, 1 = inward +wBattleTransitionSpiralDirection:: wSlotMachineWheel3BottomTile:: db wSlotMachineWheel3MiddleTile:: -wFacingDirectionList:: ; 4 bytes (also, the byte before the start of the list (wSlotMachineWheel3BottomTile) ; is used a temp variable when the list is rotated) ; used when spinning the player's sprite - ds 1 +wFacingDirectionList:: db wSlotMachineWheel3TopTile:: -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 +wTempObtainedBadgesBooleans:: db -wTempCoins2:: ; 2 bytes ; temporary variable used to subtract the bet amount from the player's coins +wTempCoins2:: -wPayoutCoins:: ; 2 bytes - ds 2 +wPayoutCoins:: dw wTradedPlayerMonOTID:: -wSlotMachineFlags:: ; 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 +wSlotMachineFlags:: db -wSlotMachineWheel1SlipCounter:: ; wheel 1 can "slip" while this is non-zero +wSlotMachineWheel1SlipCounter:: -wCutTile:: ; $3d = tree tile ; $52 = grass tile - ds 1 +wCutTile:: db -wSlotMachineWheel2SlipCounter:: ; wheel 2 can "slip" while this is non-zero +wSlotMachineWheel2SlipCounter:: wTradedEnemyMonOT:: db wSavedPlayerScreenY:: -wSlotMachineRerollCounter:: ; 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. +wSlotMachineRerollCounter:: -wEmotionBubbleSpriteIndex:: ; the index of the sprite the emotion bubble is to be displayed above - ds 1 +wEmotionBubbleSpriteIndex:: db wWhichEmotionBubble:: -wSlotMachineBet:: ; how many coins the player bet on the slot machine (1 to 3) +wSlotMachineBet:: wSavedPlayerFacingDirection:: -wWhichAnimationOffsets:: ; 0 = cut animation, 1 = boulder dust animation - ds 9 +wWhichAnimationOffsets:: ds 9 wTradedEnemyMonOTID:: dw -wStandingOnWarpPadOrHole:: ; 0 = neither ; 1 = warp pad ; 2 = hole +wStandingOnWarpPadOrHole:: wOAMBaseTile:: @@ -1030,25 +943,21 @@ wSymmetricSpriteOAMAttributes:: db wMonPartySpriteSpecies:: db -wLeftGBMonSpecies:: ; in the trade animation, the mon that leaves the left gameboy - ds 1 +wLeftGBMonSpecies:: db -wRightGBMonSpecies:: ; in the trade animation, the mon that leaves the right gameboy - ds 1 +wRightGBMonSpecies:: db -wFlags_0xcd60:: ; 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 +wFlags_0xcd60:: db ds 9 -wActionResultOrTookBattleTurn:: ; 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. @@ -1058,20 +967,18 @@ wActionResultOrTookBattleTurn:: ; 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 +wActionResultOrTookBattleTurn:: db -wJoyIgnore:: ; Set buttons are ignored. - ds 1 +wJoyIgnore:: db -wDownscaledMonSize:: ; size of downscaled mon pic used in pokeball entering/exiting animation ; $00 = 5×5 ; $01 = 3×3 +wDownscaledMonSize:: -wNumMovesMinusOne:: ; FormatMovesString stores the number of moves minus one here - ds 1 +wNumMovesMinusOne:: db UNION @@ -1081,15 +988,13 @@ NEXTU ds 4 -wStatusScreenCurrentPP:: ; temp variable used to print a move's current PP on the status screen - ds 1 +wStatusScreenCurrentPP:: db ds 6 -wNormalMaxPPList:: ; list of normal max PP (without PP up) values - ds 9 +wNormalMaxPPList:: ds 9 NEXTU @@ -1098,41 +1003,40 @@ wEvosMoves:: ds MAX_EVOLUTIONS * EVOLUTION_SIZE + 1 ENDU -wSerialOtherGameboyRandomNumberListBlock:: ; buffer for transferring the random number list generated by the other gameboy +wSerialOtherGameboyRandomNumberListBlock:: -wTileMapBackup2:: ; second buffer for temporarily saving and restoring current screen's tiles (e.g. if menus are drawn on top) - ds 20 * 18 +wTileMapBackup2:: ds 20 * 18 wNamingScreenNameLength:: wEvoOldSpecies:: -wBuffer:: ; Temporary storage area of 30 bytes. +wBuffer:: -wTownMapCoords:: ; lower nybble is x, upper nybble is y +wTownMapCoords:: -wLearningMovesFromDayCare:: ; whether WriteMonMoves is being used to make a mon learn moves from day care ; non-zero if so +wLearningMovesFromDayCare:: wChangeMonPicEnemyTurnSpecies:: wHPBarMaxHP:: db -wNamingScreenSubmitName:: ; non-zero when the player has chosen to submit the name +wNamingScreenSubmitName:: wChangeMonPicPlayerTurnSpecies:: wEvoNewSpecies:: db -wAlphabetCase:: ; 0 = upper case ; 1 = lower case +wAlphabetCase:: wEvoMonTileOffset:: @@ -1150,73 +1054,62 @@ wHPBarTempHP:: dw ds 11 wHPBarHPDifference:: db + ds 7 -wAIItem:: ; the item that the AI used - ds 1 +wAIItem:: db wUsedItemOnWhichPokemon:: db -wAnimSoundID:: ; sound ID during battle animations - ds 1 +wAnimSoundID:: db -wBankswitchHomeSavedROMBank:: ; used as a storage value for the bank to return to after a BankswitchHome (bankswitch in homebank) - ds 1 +wBankswitchHomeSavedROMBank:: db -wBankswitchHomeTemp:: ; used as a temp storage value for the bank to switch to - ds 1 +wBankswitchHomeTemp:: db -wBoughtOrSoldItemInMart:: ; 0 = nothing bought or sold in pokemart ; 1 = bought or sold something in pokemart ; this value is not used for anything - ds 1 +wBoughtOrSoldItemInMart:: db -wBattleResult:: ; $00 - win ; $01 - lose ; $02 - draw - ds 1 +wBattleResult:: db -wAutoTextBoxDrawingControl:: ; bit 0: if set, DisplayTextID automatically draws a text box - ds 1 +wAutoTextBoxDrawingControl:: db wcf0d:: ds 1 ; used with some overworld scripts (not exactly sure what it's used for) -wTilePlayerStandingOn:: ; used in CheckForTilePairCollisions2 to store the tile the player is on - ds 1 +wTilePlayerStandingOn:: db wNPCNumScriptedSteps:: ds 1 -wNPCMovementScriptFunctionNum:: ; which script function within the pointer table indicated by ; wNPCMovementScriptPointerTableNum - ds 1 +wNPCMovementScriptFunctionNum:: db -wTextPredefFlag:: ; bit 0: set when printing a text predef so that DisplayTextID doesn't switch ; to the current map's bank - ds 1 +wTextPredefFlag:: db wPredefParentBank:: db wSpriteIndex:: ds 1 -wCurSpriteMovement2:: ; movement byte 2 of current sprite - ds 1 +wCurSpriteMovement2:: db ds 2 -wNPCMovementScriptSpriteOffset:: ; sprite offset of sprite being controlled by NPC movement script - ds 1 +wNPCMovementScriptSpriteOffset:: db wScriptedNPCWalkCounter:: db @@ -1224,25 +1117,22 @@ wScriptedNPCWalkCounter:: db wGBC:: db -wOnSGB:: ; if running on SGB, it's 1, else it's 0 - ds 1 +wOnSGB:: db wDefaultPaletteCommand:: db wPlayerHPBarColor:: -wWholeScreenPaletteMonSpecies:: ; species of the mon whose palette is used for the whole screen - ds 1 +wWholeScreenPaletteMonSpecies:: db wEnemyHPBarColor:: db ; 0: green ; 1: yellow ; 2: red -wPartyMenuHPBarColors:: - ds 6 +wPartyMenuHPBarColors:: ds 6 wStatusScreenHPBarColor:: db @@ -1254,70 +1144,60 @@ wWhichPartyMenuHPBar:: wPalPacket:: db -wPartyMenuBlkPacket:: ; $30 bytes - ds 29 +wPartyMenuBlkPacket:: ds 29 -wExpAmountGained:: ; 2-byte big-endian number ; the total amount of exp a mon gained +wExpAmountGained:: -wcf4b:: ; storage buffer for various strings - ds 2 +wcf4b:: dw wGainBoostedExp:: db ds 17 -wGymCityName:: - ds 17 +wGymCityName:: ds 17 -wGymLeaderName:: - ds NAME_LENGTH +wGymLeaderName:: ds NAME_LENGTH -wItemList:: - ds 16 +wItemList:: ds 16 wListPointer:: dw -wUnusedCF8D:: ; 2 bytes ; used to store pointers, but never read - ds 2 +wUnusedCF8D:: dw wItemPrices:: dw wcf91:: ds 1 ; used with a lot of things (too much to list here) -wWhichPokemon:: ; which pokemon you selected - ds 1 +wWhichPokemon:: db -wPrintItemPrices:: ; if non-zero, then print item prices when displaying lists - ds 1 +wPrintItemPrices:: db -wHPBarType:: ; type of HP bar ; $00 = enemy HUD in battle ; $01 = player HUD in battle / status screen ; $02 = party menu +wHPBarType:: -wListMenuID:: ; ID used by DisplayListMenuID - ds 1 +wListMenuID:: db -wRemoveMonFromBox:: ; if non-zero, RemovePokemon will remove the mon from the current box, ; else it will remove the mon from the party +wRemoveMonFromBox:: -wMoveMonType:: ; 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 +wMoveMonType:: db wItemQuantity:: db @@ -1326,22 +1206,18 @@ wMaxItemQuantity:: db ; LoadMonData copies mon data here wLoadedMon:: party_struct wLoadedMon -wFontLoaded:: ; bit 0: The space in VRAM that is used to store walk animation tile patterns ; for the player and NPCs is in use for font tile patterns. ; This means that NPC movement must be disabled. ; The other bits are unused. - ds 1 +wFontLoaded:: db -wWalkCounter:: ; walk animation counter - ds 1 +wWalkCounter:: db -wTileInFrontOfPlayer:: ; background tile number in front of the player (either 1 or 2 steps ahead) - ds 1 +wTileInFrontOfPlayer:: db -wAudioFadeOutControl:: ; 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 @@ -1351,13 +1227,12 @@ wAudioFadeOutControl:: ; 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 +wAudioFadeOutControl:: db wAudioFadeOutCounterReloadValue:: db wAudioFadeOutCounter:: db -wLastMusicSoundID:: ; 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 @@ -1367,14 +1242,13 @@ wLastMusicSoundID:: ; 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 +wLastMusicSoundID:: db -wUpdateSpritesEnabled:: ; $00 = causes sprites to be hidden and the value to change to $ff ; $01 = enabled ; $ff = disabled ; other values aren't used - ds 1 +wUpdateSpritesEnabled:: db wEnemyMoveNum:: db wEnemyMoveEffect:: db @@ -1410,87 +1284,74 @@ wTrainerClass:: db ds 1 wTrainerPicPointer:: dw + ds 1 wTempMoveNameBuffer:: -wLearnMoveMonName:: ; The name of the mon that is learning a move. - ds 16 +wLearnMoveMonName:: ds 16 -wTrainerBaseMoney:: ; 2-byte BCD number ; money received after battle = base money × level of highest-level enemy mon - ds 2 +wTrainerBaseMoney:: dw wMissableObjectCounter:: db ds 1 -wTrainerName:: ; 13 bytes for the letters of the opposing trainer ; the name is terminated with $50 with possible ; unused trailing letters - ds 13 +wTrainerName:: ds 13 -wIsInBattle:: ; lost battle, this is -1 ; no battle, this is 0 ; wild battle, this is 1 ; trainer battle, this is 2 - ds 1 +wIsInBattle:: db -wPartyGainExpFlags:: ; flags that indicate which party members should be be given exp when GainExperience is called - flag_array 6 +wPartyGainExpFlags:: flag_array 6 -wCurOpponent:: ; in a wild battle, this is the species of pokemon ; in a trainer battle, this is the trainer class + OPP_ID_OFFSET - ds 1 +wCurOpponent:: db -wBattleType:: ; in normal battle, this is 0 ; in old man battle, this is 1 ; in safari battle, this is 2 - ds 1 +wBattleType:: db -wDamageMultipliers:: ; bits 0-6: Effectiveness ; $0 = immune ; $5 = not very effective ; $a = neutral ; $14 = super-effective ; bit 7: STAB - ds 1 +wDamageMultipliers:: db -wLoneAttackNo:: ; which entry in LoneAttacks to use -wGymLeaderNo:: ; it's actually the same thing as ^ - ds 1 -wTrainerNo:: +wLoneAttackNo:: +wGymLeaderNo:: db ; which instance of [youngster, lass, etc] is this? - ds 1 +wTrainerNo:: db -wCriticalHitOrOHKO:: ; $00 = normal attack ; $01 = critical hit ; $02 = successful OHKO ; $ff = failed OHKO - ds 1 +wCriticalHitOrOHKO:: db wMoveMissed:: db -wPlayerStatsToDouble:: ; always 0 - ds 1 +wPlayerStatsToDouble:: db -wPlayerStatsToHalve:: ; always 0 - ds 1 +wPlayerStatsToHalve:: db -wPlayerBattleStatus1:: ; bit 0 - bide ; bit 1 - thrash / petal dance ; bit 2 - attacking multiple times (e.g. double kick) @@ -1499,9 +1360,8 @@ wPlayerBattleStatus1:: ; bit 5 - using multi-turn move (e.g. wrap) ; bit 6 - invulnerable to normal attack (using fly/dig) ; bit 7 - confusion - ds 1 +wPlayerBattleStatus1:: db -wPlayerBattleStatus2:: ; bit 0 - X Accuracy effect ; bit 1 - protected by "mist" ; bit 2 - focus energy effect @@ -1509,74 +1369,66 @@ wPlayerBattleStatus2:: ; bit 5 - need to recharge ; bit 6 - rage ; bit 7 - leech seeded - ds 1 +wPlayerBattleStatus2:: db -wPlayerBattleStatus3:: ; bit 0 - toxic ; bit 1 - light screen ; bit 2 - reflect ; bit 3 - transformed - ds 1 +wPlayerBattleStatus3:: db -wEnemyStatsToDouble:: ; always 0 - ds 1 +wEnemyStatsToDouble:: db -wEnemyStatsToHalve:: ; always 0 - ds 1 +wEnemyStatsToHalve:: db wEnemyBattleStatus1:: db wEnemyBattleStatus2:: db wEnemyBattleStatus3:: db -wPlayerNumAttacksLeft:: ; when the player is attacking multiple times, the number of attacks left - ds 1 +wPlayerNumAttacksLeft:: db wPlayerConfusedCounter:: db wPlayerToxicCounter:: db -wPlayerDisabledMove:: ; high nibble: which move is disabled (1-4) ; low nibble: disable turns left - ds 1 +wPlayerDisabledMove:: db ds 1 -wEnemyNumAttacksLeft:: ; when the enemy is attacking multiple times, the number of attacks left - ds 1 +wEnemyNumAttacksLeft:: db wEnemyConfusedCounter:: db wEnemyToxicCounter:: db -wEnemyDisabledMove:: ; high nibble: which move is disabled (1-4) ; low nibble: disable turns left - ds 1 +wEnemyDisabledMove:: db ds 1 -wPlayerNumHits:: ; number of hits by player in attacks like Double Slap, etc. +wPlayerNumHits:: -wPlayerBideAccumulatedDamage:: ; the amount of damage accumulated by the player while biding (2 bytes) +wPlayerBideAccumulatedDamage:: -wUnknownSerialCounter2:: ; 2 bytes +wUnknownSerialCounter2:: ds 4 -wEscapedFromBattle:: ; non-zero when an item or move that allows escape from battle was used - ds 1 +wEscapedFromBattle:: db -wAmountMoneyWon:: ; 3-byte BCD number +wAmountMoneyWon:: wObjectToHide:: db @@ -1584,27 +1436,24 @@ wObjectToShow:: db ds 1 -wDefaultMap:: ; the map you will start at when the debug bit is set +wDefaultMap:: wMenuItemOffset:: -wAnimationID:: ; ID number of the current battle animation - ds 1 +wAnimationID:: db wNamingScreenType:: wPartyMenuTypeOrMessageID:: -wTempTilesetNumTiles:: ; temporary storage for the number of tiles in a tileset - ds 1 +wTempTilesetNumTiles:: db -wSavedListScrollOffset:: ; 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 +wSavedListScrollOffset:: db ds 2 @@ -1616,47 +1465,42 @@ wBaseCoordY:: db ; high bit = enable, others = timer to cycle frequencies wLowHealthAlarm:: ds 1 -wFBTileCounter:: ; counts how many tiles of the current frame block have been drawn - ds 1 +wFBTileCounter:: db wMovingBGTilesCounter2:: db -wSubAnimFrameDelay:: ; duration of each frame of the current subanimation in terms of screen refreshes - ds 1 -wSubAnimCounter:: +wSubAnimFrameDelay:: db ; counts the number of subentries left in the current subanimation - ds 1 +wSubAnimCounter:: db -wSaveFileStatus:: ; 1 = no save file or save file is corrupted ; 2 = save file exists and no corruption has been detected - ds 1 +wSaveFileStatus:: db -wNumFBTiles:: ; number of tiles in current battle animation frame block - ds 1 +wNumFBTiles:: db wFlashScreenLongCounter:: wSpiralBallsBaseY:: -wFallingObjectMovementByte:: ; bits 0-6: index into FallingObjects_DeltaXs array (0 - 8) ; bit 7: direction; 0 = right, 1 = left +wFallingObjectMovementByte:: wNumShootingBalls:: -wTradedMonMovingRight:: ; $01 if mon is moving from left gameboy to right gameboy; $00 if vice versa +wTradedMonMovingRight:: wOptionsInitialized:: wNewSlotMachineBallTile:: -wCoordAdjustmentAmount:: ; how much to add to the X/Y coord +wCoordAdjustmentAmount:: wUnusedD08A:: db @@ -1666,16 +1510,15 @@ wNumFallingObjects:: wSlideMonDelay:: -wAnimCounter:: ; generic counter variable for various animations +wAnimCounter:: -wSubAnimTransform:: ; controls what transformations are applied to the subanimation ; 01: flip horizontally and vertically ; 02: flip horizontally and translate downwards 40 pixels ; 03: translate base coordinates of frame blocks, but don't change their internal coordinates or flip their tiles ; 04: reverse the subanimation - ds 1 +wSubAnimTransform:: db wEndBattleWinTextPointer:: dw @@ -1687,19 +1530,17 @@ wEndBattleTextRomBank:: db ds 1 -wSubAnimAddrPtr:: ; the address _of the address_ of the current subanimation entry - ds 2 +wSubAnimAddrPtr:: dw -wSlotMachineAllowMatchesCounter:: ; 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. +wSlotMachineAllowMatchesCounter:: -wSubAnimSubEntryAddr:: ; the address of the current subentry of the current subanimation - ds 2 +wSubAnimSubEntryAddr:: dw ds 2 @@ -1707,28 +1548,26 @@ wOutwardSpiralTileMapPointer:: db wPartyMenuAnimMonEnabled:: -wTownMapSpriteBlinkingEnabled:: ; non-zero when enabled. causes nest locations to blink on and off. ; the town selection cursor will blink regardless of what this value is +wTownMapSpriteBlinkingEnabled:: wUnusedD09B:: db -wFBDestAddr:: ; current destination address in OAM for frame blocks (big endian) - ds 2 +wFBDestAddr:: dw -wFBMode:: ; 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 [wFBDestAddr], so that the next frame block will overwrite this one - ds 1 +wFBMode:: db -wLinkCableAnimBulgeToggle:: ; 0 = small ; 1 = big +wLinkCableAnimBulgeToggle:: wIntroNidorinoBaseTile:: @@ -1740,13 +1579,12 @@ wNewTileBlockID:: wWhichBattleAnimTileset:: -wSquishMonCurrentDirection:: ; 0 = left ; 1 = right +wSquishMonCurrentDirection:: -wSlideMonUpBottomRowLeftTile:: ; the tile ID of the leftmost tile in the bottom row in AnimationSlideMonUp_ - ds 1 +wSlideMonUpBottomRowLeftTile:: db wDisableVBlankWYUpdate:: ds 1 ; if non-zero, don't update WY during V-blank @@ -1754,42 +1592,34 @@ wSpriteCurPosX:: db wSpriteCurPosY:: db wSpriteWidth:: db wSpriteHeight:: db -wSpriteInputCurByte:: ; current input byte - ds 1 -wSpriteInputBitCounter:: +wSpriteInputCurByte:: db ; bit offset of last read input bit - ds 1 +wSpriteInputBitCounter:: db -wSpriteOutputBitOffset:: ; determines where in the output byte the two bits are placed. Each byte contains four columns (2bpp data) +; 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 +wSpriteOutputBitOffset:: db -wSpriteLoadFlags:: ; bit 0 determines used buffer (0 -> sSpriteBuffer1, 1 -> sSpriteBuffer2) ; bit 1 loading last sprite chunk? (there are at most 2 chunks per load operation) - ds 1 +wSpriteLoadFlags:: db wSpriteUnpackMode:: db wSpriteFlipped:: db -wSpriteInputPtr:: ; pointer to next input byte - ds 2 -wSpriteOutputPtr:: +wSpriteInputPtr:: dw ; pointer to current output byte - ds 2 -wSpriteOutputPtrCached:: +wSpriteOutputPtr:: dw ; used to revert pointer for different bit offsets - ds 2 -wSpriteDecodeTable0Ptr:: +wSpriteOutputPtrCached:: dw ; pointer to differential decoding table (assuming initial value 0) - ds 2 -wSpriteDecodeTable1Ptr:: +wSpriteDecodeTable0Ptr:: dw ; pointer to differential decoding table (assuming initial value 1) - ds 2 +wSpriteDecodeTable1Ptr:: dw wd0b5:: ds 1 ; used as a temp storage area for Pokemon Species, and other Pokemon/Battle related things @@ -1799,10 +1629,9 @@ wPredefBank:: db wMonHeader:: -wMonHIndex:: ; In the ROM base stats data structure, this is the dex number, but it is ; overwritten with the internal index number after the header is copied to WRAM. - ds 1 +wMonHIndex:: db wMonHBaseStats:: wMonHBaseHP:: db @@ -1821,21 +1650,19 @@ wMonHSpriteDim:: db wMonHFrontSprite:: dw wMonHBackSprite:: dw -wMonHMoves:: - ds NUM_MOVES +wMonHMoves:: ds NUM_MOVES wMonHGrowthRate:: db -wMonHLearnset:: ; bit field - flag_array NUM_TMS + NUM_HMS +wMonHLearnset:: flag_array NUM_TMS + NUM_HMS ds 1 + wMonHeaderEnd:: -wSavedTileAnimations:: ; saved at the start of a battle and then written back at the end of the battle - ds 1 +wSavedTileAnimations:: db ds 2 @@ -1845,36 +1672,30 @@ wDamage:: dw wRepelRemainingSteps:: db -wMoves:: ; list of moves for FormatMovesString - ds NUM_MOVES +wMoves:: ds NUM_MOVES wMoveNum:: db -wMovesString:: - ds 56 +wMovesString:: ds 56 wUnusedD119:: db -wWalkBikeSurfStateCopy:: ; wWalkBikeSurfState is sometimes copied here, but it doesn't seem to be used for anything - ds 1 +wWalkBikeSurfStateCopy:: db -wInitListType:: ; the type of list for InitList to init - ds 1 +wInitListType:: db -wCapturedMonSpecies:: ; 0 if no mon was captured - ds 1 +wCapturedMonSpecies:: db -wFirstMonsNotOutYet:: ; 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 +wFirstMonsNotOutYet:: db wPokeBallCaptureCalcTemp:: @@ -1897,14 +1718,12 @@ wNumSetBits:: wd11e:: ds 1 ; used as a Pokemon and Item storage value. Also used as an output value for CountSetBits -wForcePlayerToChooseMon:: ; 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 +wForcePlayerToChooseMon:: db -wNumRunAttempts:: ; number of times the player has tried to run from battle - ds 1 +wNumRunAttempts:: db wEvolutionOccurred:: db @@ -1920,26 +1739,22 @@ wCurrentMapScriptFlags:: ds 1 ; not exactly sure what this is used for, but it s wCurEnemyLVL:: db -wItemListPointer:: ; pointer to list of items terminated by $FF - ds 2 +wItemListPointer:: dw -wListCount:: ; number of entries in a list - ds 1 +wListCount:: db wLinkState:: db wTwoOptionMenuID:: db -wChosenMenuItem:: ; the id of the menu item the player ultimately chose +wChosenMenuItem:: -wOutOfBattleBlackout:: ; non-zero when the whole party has fainted due to out-of-battle poison damage - ds 1 +wOutOfBattleBlackout:: db -wMenuExitMethod:: ; 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 @@ -1947,21 +1762,20 @@ wMenuExitMethod:: ; 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 +wMenuExitMethod:: db -wDungeonWarpDataEntrySize:: ; the size is always 6, so they didn't need a variable in RAM for this +wDungeonWarpDataEntrySize:: -wWhichPewterGuy:: ; 0 = museum guy ; 1 = gym guy +wWhichPewterGuy:: -wWhichPrizeWindow:: ; there are 3 windows, from 0 to 2 +wWhichPrizeWindow:: -wGymGateTileBlock:: ; a horizontal or vertical gate block - ds 1 +wGymGateTileBlock:: db wSavedSpriteScreenY:: db @@ -1975,18 +1789,15 @@ wSavedSpriteMapX:: db wWhichPrize:: db -wIgnoreInputCounter:: ; counts downward each frame ; when it hits 0, bit 5 (ignore input bit) of wd730 is reset - ds 1 +wIgnoreInputCounter:: db -wStepCounter:: ; counts down once every step - ds 1 +wStepCounter:: db -wNumberOfNoRandomBattleStepsLeft:: ; after a battle, you have at least 3 steps before a random battle can occur - ds 1 +wNumberOfNoRandomBattleStepsLeft:: db wPrize1:: db wPrize2:: db @@ -1994,8 +1805,8 @@ wPrize3:: db ds 1 -wSerialRandomNumberListBlock:: ; the first 7 bytes are the preamble +wSerialRandomNumberListBlock:: wPrize1Price:: dw @@ -2005,19 +1816,17 @@ wPrize3Price:: dw ds 1 -wLinkBattleRandomNumberList:: ; shared list of 9 random numbers, indexed by wLinkBattleRandomNumberListIndex - ds 10 +wLinkBattleRandomNumberList:: ds 10 -wSerialPlayerDataBlock:: ; the first 6 bytes are the preamble +wSerialPlayerDataBlock:: -wPseudoItemID:: ; 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 +wPseudoItemID:: db wUnusedD153:: db @@ -2027,8 +1836,7 @@ wEvoStoneItemID:: db wSavedNPCMovementDirections2Index:: db -wPlayerName:: - ds NAME_LENGTH +wPlayerName:: ds NAME_LENGTH wPartyDataStart:: @@ -2060,28 +1868,21 @@ wPartyDataEnd:: wMainDataStart:: -wPokedexOwned:: - flag_array NUM_POKEMON +wPokedexOwned:: flag_array NUM_POKEMON wPokedexOwnedEnd:: -wPokedexSeen:: - flag_array NUM_POKEMON +wPokedexSeen:: flag_array NUM_POKEMON wPokedexSeenEnd:: wNumBagItems:: db -wBagItems:: ; item, quantity - ds BAG_ITEM_CAPACITY * 2 - ds 1 ; end +wBagItems:: ds BAG_ITEM_CAPACITY * 2 + 1 -wPlayerMoney:: - ds 3 ; BCD +wPlayerMoney:: ds 3 ; BCD -wRivalName:: - ds NAME_LENGTH +wRivalName:: ds NAME_LENGTH -wOptions:: ; bit 7 = battle animation ; 0: On ; 1: Off @@ -2092,19 +1893,17 @@ wOptions:: ; 1: Fast ; 3: Medium ; 5: Slow - ds 1 +wOptions:: db -wObtainedBadges:: - flag_array 8 +wObtainedBadges:: flag_array 8 ds 1 -wLetterPrintingDelayFlags:: ; 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 +wLetterPrintingDelayFlags:: db wPlayerID:: dw @@ -2112,26 +1911,22 @@ wMapMusicSoundID:: db wMapMusicROMBank:: db -wMapPalOffset:: ; 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 +wMapPalOffset:: db wCurMap:: db -wCurrentTileBlockMapViewPointer:: ; pointer to the upper left corner of the current view in the tile block map - ds 2 +wCurrentTileBlockMapViewPointer:: dw -wYCoord:: ; player's position on the current map - ds 1 +wYCoord:: db wXCoord:: db -wYBlockCoord:: ; player's y position (by block) - ds 1 +wYBlockCoord:: db wXBlockCoord:: db @@ -2141,13 +1936,11 @@ wUnusedD366:: db wCurMapTileset:: db -wCurMapHeight:: ; blocks - ds 1 +wCurMapHeight:: db -wCurMapWidth:: ; blocks - ds 1 +wCurMapWidth:: db wMapDataPtr:: dw @@ -2155,9 +1948,8 @@ wMapTextPtr:: dw wMapScriptPtr:: dw -wMapConnections:: ; connection byte - ds 1 +wMapConnections:: db wMapConn1Ptr:: db @@ -2223,152 +2015,125 @@ wEastConnectedMapXAlignment:: db wEastConnectedMapViewPointer:: dw -wSpriteSet:: ; sprite set for the current map (11 sprite picture ID's) - ds 11 +wSpriteSet:: ds 11 -wSpriteSetID:: ; sprite set ID for the current map - ds 1 +wSpriteSetID:: db wObjectDataPointerTemp:: dw ds 2 -wMapBackgroundTile:: ; the tile shown outside the boundaries of the map - ds 1 +wMapBackgroundTile:: db -wNumberOfWarps:: ; number of warps in current map - ds 1 +wNumberOfWarps:: db -wWarpEntries:: ; current map warp entries - ds 128 +wWarpEntries:: ds 128 -wDestinationWarpID:: ; if $ff, the player's coordinates are not updated when entering the map - ds 1 +wDestinationWarpID:: db ds 128 -wNumSigns:: ; number of signs in the current map (up to 16) - ds 1 +wNumSigns:: db -wSignCoords:: ; 2 bytes each ; Y, X - ds 32 +wSignCoords:: ds 32 -wSignTextIDs:: - ds 16 +wSignTextIDs:: ds 16 -wNumSprites:: ; number of sprites on the current map - ds 1 +wNumSprites:: db ; these two variables track the X and Y offset in blocks from the last special warp used ; they don't seem to be used for anything wYOffsetSinceLastSpecialWarp:: db wXOffsetSinceLastSpecialWarp:: db -wMapSpriteData:: ; two bytes per sprite (movement byte 2, text ID) - ds 32 +wMapSpriteData:: ds 32 -wMapSpriteExtraData:: ; two bytes per sprite (trainer class/item ID, trainer set ID) - ds 32 +wMapSpriteExtraData:: ds 32 -wCurrentMapHeight2:: ; map height in 2x2 meta-tiles - ds 1 +wCurrentMapHeight2:: db -wCurrentMapWidth2:: ; map width in 2x2 meta-tiles - ds 1 +wCurrentMapWidth2:: db -wMapViewVRAMPointer:: ; the address of the upper left corner of the visible portion of the BG tile map in VRAM - ds 2 +wMapViewVRAMPointer:: dw ; In the comments for the player direction variables below, "moving" refers to ; both walking and changing facing direction without taking a step. -wPlayerMovingDirection:: ; 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 +wPlayerMovingDirection:: db -wPlayerLastStopDirection:: ; the direction in which the player was moving before the player last stopped - ds 1 +wPlayerLastStopDirection:: db -wPlayerDirection:: ; 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 +wPlayerDirection:: db wTilesetBank:: db -wTilesetBlocksPtr:: ; maps blocks (4x4 tiles) to tiles - ds 2 +wTilesetBlocksPtr:: dw wTilesetGfxPtr:: dw -wTilesetCollisionPtr:: ; list of all walkable tiles - ds 2 +wTilesetCollisionPtr:: dw -wTilesetTalkingOverTiles:: - ds 3 +wTilesetTalkingOverTiles:: ds 3 wGrassTile:: db ds 4 wNumBoxItems:: db -wBoxItems:: ; item, quantity - ds PC_ITEM_CAPACITY * 2 - ds 1 ; end +wBoxItems:: ds PC_ITEM_CAPACITY * 2 + 1 -wCurrentBoxNum:: ; bits 0-6: box number ; bit 7: whether the player has changed boxes before - ds 2 +wCurrentBoxNum:: dw -wNumHoFTeams:: ; number of HOF teams - ds 1 +wNumHoFTeams:: db wUnusedD5A3:: db -wPlayerCoins:: - ds 2 ; BCD +wPlayerCoins:: ds 2 ; BCD -wMissableObjectFlags:: ; bit array of missable objects. set = removed - ds 32 +wMissableObjectFlags:: ds 32 wMissableObjectFlagsEnd:: ds 7 -wd5cd:: ds 1 ; temp copy of SPRITESTATEDATA1_IMAGEINDEX (used for sprite facing/anim) +; temp copy of SPRITESTATEDATA1_IMAGEINDEX (used for sprite facing/anim) +wd5cd:: db -wMissableObjectList:: ; each entry consists of 2 bytes ; * the sprite ID (depending on the current map) ; * the missable object index (global, used for wMissableObjectFlags) ; terminated with $FF - ds 17 * 2 +wMissableObjectList:: ds 17 * 2 -wGameProgressFlags:: ; $c8 bytes +wGameProgressFlags:: wOaksLabCurScript:: db wPalletTownCurScript:: db ds 1 @@ -2487,39 +2252,32 @@ wGameProgressFlagsEnd:: ds 56 -wObtainedHiddenItemsFlags:: - ds 14 +wObtainedHiddenItemsFlags:: ds 14 wObtainedHiddenCoinsFlags:: dw -wWalkBikeSurfState:: ; $00 = walking ; $01 = biking ; $02 = surfing - ds 1 +wWalkBikeSurfState:: db ds 10 -wTownVisitedFlag:: - flag_array NUM_CITY_MAPS +wTownVisitedFlag:: flag_array NUM_CITY_MAPS -wSafariSteps:: ; starts at 502 - ds 2 +wSafariSteps:: dw -wFossilItem:: ; item given to cinnabar lab - ds 1 +wFossilItem:: db -wFossilMon:: ; mon that will result from the item - ds 1 +wFossilMon:: db ds 2 -wEnemyMonOrTrainerClass:: ; trainer classes start at OPP_ID_OFFSET - ds 1 +wEnemyMonOrTrainerClass:: db wPlayerJumpingYScreenCoordsIndex:: db @@ -2529,36 +2287,30 @@ wRivalStarter:: db wPlayerStarter:: db -wBoulderSpriteIndex:: ; sprite index of the boulder the player is trying to push - ds 1 +wBoulderSpriteIndex:: db wLastBlackoutMap:: db -wDestinationMap:: ; destination map (for certain types of special warps, not ordinary walking) - ds 1 +wDestinationMap:: db wUnusedD71B:: db -wTileInFrontOfBoulderAndBoulderCollisionResult:: ; used to store the tile in front of the boulder when trying to push a boulder -; also used to store the result of the collision check ($ff for a collision and $00 FOR no collision) - ds 1 +; also used to store the result of the collision check ($ff for a collision and $00 for no collision) +wTileInFrontOfBoulderAndBoulderCollisionResult:: db -wDungeonWarpDestinationMap:: ; destination map for dungeon warps - ds 1 +wDungeonWarpDestinationMap:: db -wWhichDungeonWarp:: ; which dungeon warp within the source map was used - ds 1 +wWhichDungeonWarp:: db wUnusedD71F:: db ds 8 -wd728:: ; 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 @@ -2566,23 +2318,20 @@ wd728:: ; 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 +wd728:: db ds 1 -wBeatGymFlags:: ; redundant because it matches wObtainedBadges ; used to determine whether to show name on statue and in two NPC text scripts - ds 1 +wBeatGymFlags:: db ds 1 -wd72c:: ; bit 0: if not set, the 3 minimum steps between random battles have passed ; bit 1: prevent audio fade out - ds 1 +wd72c:: db -wd72d:: ; 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 @@ -2593,9 +2342,8 @@ wd72d:: ; 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 +wd72d:: db -wd72e:: ; 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 @@ -2604,20 +2352,18 @@ wd72e:: ; 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 +wd72e:: db ds 1 -wd730:: ; 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 or an NPC's movement is being scripted - ds 1 +wd730:: db ds 1 -wd732:: ; bit 0: play time being counted ; bit 1: remnant of debug mode; only set by the debug build. ; if it is set: @@ -2635,31 +2381,28 @@ wd732:: ; bit 4: jumped into hole (Pokemon Mansion, Seafoam Islands, Victory Road) or went down waterfall (Seafoam Islands), so the target warp is a "dungeon warp" ; bit 5: currently being forced to ride bike (cycling road) ; bit 6: map destination is [wLastBlackoutMap] (usually the last used pokemon center, but could be the player's house) - ds 1 +wd732:: db -wFlags_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 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 +wFlags_D733:: db -wBeatLorelei:: ; 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 1 +wBeatLorelei:: db ds 1 -wd736:: ; 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 / fishing animation ; bit 7: player sprite spinning due to spin tiles (Rocket hideout / Viridian Gym) - ds 1 +wd736:: db wCompletedInGameTradeFlags:: dw @@ -2683,30 +2426,25 @@ wSecondLockTrashCanIndex:: db ds 2 -wEventFlags:: - flag_array NUM_EVENTS +wEventFlags:: flag_array NUM_EVENTS UNION wGrassRate:: db -wGrassMons:: - ds 10 * 2 +wGrassMons:: ds 10 * 2 ds 8 wWaterRate:: db -wWaterMons:: - ds 10 * 2 +wWaterMons:: ds 10 * 2 NEXTU -wLinkEnemyTrainerName:: ; linked game's trainer name - ds NAME_LENGTH +wLinkEnemyTrainerName:: ds NAME_LENGTH ds 1 -wSerialEnemyDataBlock:: -; ds $1a8 +wSerialEnemyDataBlock:: ; ds $1a8 ds 9 @@ -2738,16 +2476,15 @@ wTrainerHeaderPtr:: dw ds 6 -wOpponentAfterWrongAnswer:: ; the trainer the player must face after getting a wrong answer in the Cinnabar ; gym quiz +wOpponentAfterWrongAnswer:: wUnusedDA38:: db -wCurMapScript:: ; index of current map script, mostly used as index for function pointer array ; mostly copied from map-specific map script pointer and written back later - ds 1 +wCurMapScript:: db ds 7 @@ -2762,10 +2499,9 @@ wSafariZoneGameOver:: db wNumSafariBalls:: db -wDayCareInUse:: ; 0 if no pokemon is in the daycare ; 1 if pokemon is in the daycare - ds 1 +wDayCareInUse:: db wDayCareMonName:: ds NAME_LENGTH wDayCareMonOT:: ds NAME_LENGTH @@ -2781,7 +2517,6 @@ wBoxCount:: ds 1 wBoxSpecies:: ds MONS_PER_BOX + 1 wBoxMons:: - ; wBoxMon1 - wBoxMon20 FOR n, 1, MONS_PER_BOX + 1 wBoxMon{d:n}:: box_struct wBoxMon{d:n} @@ -2807,8 +2542,7 @@ SECTION "Stack", WRAM0 ; the stack grows downward ds $100 - 1 -wStack:: - ds 1 +wStack:: db INCLUDE "sram.asm" -- cgit v1.3.1-sl0p From f9ae7b1240863b4311d24944ae7ec3c1d9b24507 Mon Sep 17 00:00:00 2001 From: Rangi Date: Mon, 31 May 2021 16:25:16 -0400 Subject: More WRAM label cleanup (still needs UNIONs and renaming) --- engine/battle/core.asm | 8 +- engine/items/town_map.asm | 2 +- engine/menus/party_menu.asm | 2 +- engine/predefs.asm | 10 +- home/overworld.asm | 42 +-- home/predef.asm | 12 +- macros/wram.asm | 11 + scripts/VermilionDock.asm | 4 +- wram.asm | 786 ++++++++++++++------------------------------ 9 files changed, 301 insertions(+), 576 deletions(-) (limited to 'wram.asm') diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 8eee39d2..f325350f 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -6900,9 +6900,9 @@ ResetCryModifiers: ; animates the mon "growing" out of the pokeball AnimateSendingOutMon: - ld a, [wPredefRegisters] + ld a, [wPredefHL] ld h, a - ld a, [wPredefRegisters + 1] + ld a, [wPredefHL + 1] ld l, a ldh a, [hStartTileID] ldh [hBaseTileID], a @@ -6940,9 +6940,9 @@ AnimateSendingOutMon: jr CopyUncompressedPicToHL CopyUncompressedPicToTilemap: - ld a, [wPredefRegisters] + ld a, [wPredefHL] ld h, a - ld a, [wPredefRegisters + 1] + ld a, [wPredefHL + 1] ld l, a ldh a, [hStartTileID] CopyUncompressedPicToHL:: diff --git a/engine/items/town_map.asm b/engine/items/town_map.asm index 42d313d9..a12c0c8a 100644 --- a/engine/items/town_map.asm +++ b/engine/items/town_map.asm @@ -249,7 +249,7 @@ ToText: db "To@" BuildFlyLocationsList: - ld hl, wFlyLocationsList - 1 + ld hl, wFlyAnimUsingCoordList ld [hl], $ff inc hl ld a, [wTownVisitedFlag] diff --git a/engine/menus/party_menu.asm b/engine/menus/party_menu.asm index ddb92f75..f77beb26 100644 --- a/engine/menus/party_menu.asm +++ b/engine/menus/party_menu.asm @@ -131,7 +131,7 @@ RedrawPartyMenu_:: ld l, a ld de, wEvosMoves ld a, BANK(EvosMovesPointerTable) - ld bc, wEvosMoves.end - wEvosMoves + ld bc, wEvosMovesEnd - wEvosMoves call FarCopyData ld hl, wEvosMoves ld de, .notAbleToEvolveText diff --git a/engine/predefs.asm b/engine/predefs.asm index a9877739..faf0029e 100644 --- a/engine/predefs.asm +++ b/engine/predefs.asm @@ -1,20 +1,20 @@ GetPredefPointer:: -; Store the contents of the register -; pairs (hl, de, bc) at wPredefRegisters. +; Back up the contents of the registers (hl, de, bc). ; Then put the bank and address of predef ; wPredefID in [wPredefBank] and hl. ld a, h - ld [wPredefRegisters], a + ld [wPredefHL], a ld a, l - ld [wPredefRegisters + 1], a + ld [wPredefHL + 1], a - ld hl, wPredefRegisters + 2 + ld hl, wPredefDE ld a, d ld [hli], a ld a, e ld [hli], a + ASSERT wPredefDE + 2 == wPredefBC ld a, b ld [hli], a ld [hl], c diff --git a/home/overworld.asm b/home/overworld.asm index be2c5d55..eb6f2ddb 100644 --- a/home/overworld.asm +++ b/home/overworld.asm @@ -550,7 +550,7 @@ CheckMapConnections:: ld a, [wXCoord] cp $ff jr nz, .checkEastMap - ld a, [wMapConn3Ptr] + ld a, [wWestConnectedMap] ld [wCurMap], a ld a, [wWestConnectedMapXAlignment] ; new X coordinate upon entering west map ld [wXCoord], a @@ -587,7 +587,7 @@ CheckMapConnections:: ld a, [wCurrentMapWidth2] ; map width cp b jr nz, .checkNorthMap - ld a, [wMapConn4Ptr] + ld a, [wEastConnectedMap] ld [wCurMap], a ld a, [wEastConnectedMapXAlignment] ; new X coordinate upon entering east map ld [wXCoord], a @@ -623,7 +623,7 @@ CheckMapConnections:: ld a, [wYCoord] cp $ff jr nz, .checkSouthMap - ld a, [wMapConn1Ptr] + ld a, [wNorthConnectedMap] ld [wCurMap], a ld a, [wNorthConnectedMapYAlignment] ; new Y coordinate upon entering north map ld [wYCoord], a @@ -651,7 +651,7 @@ CheckMapConnections:: ld a, [wCurrentMapHeight2] cp b jr nz, .didNotEnterConnectedMap - ld a, [wMapConn2Ptr] + ld a, [wSouthConnectedMap] ld [wCurMap], a ld a, [wSouthConnectedMapYAlignment] ; new Y coordinate upon entering south map ld [wYCoord], a @@ -937,7 +937,7 @@ LoadTileBlockMap:: dec b jr nz, .rowLoop .northConnection - ld a, [wMapConn1Ptr] + ld a, [wNorthConnectedMap] cp $ff jr z, .southConnection call SwitchToMapRomBank @@ -949,13 +949,13 @@ LoadTileBlockMap:: ld e, a ld a, [wNorthConnectionStripDest + 1] ld d, a - ld a, [wNorthConnectionStripWidth] + ld a, [wNorthConnectionStripLength] ldh [hNorthSouthConnectionStripWidth], a ld a, [wNorthConnectedMapWidth] ldh [hNorthSouthConnectedMapWidth], a call LoadNorthSouthConnectionsTileMap .southConnection - ld a, [wMapConn2Ptr] + ld a, [wSouthConnectedMap] cp $ff jr z, .westConnection call SwitchToMapRomBank @@ -967,13 +967,13 @@ LoadTileBlockMap:: ld e, a ld a, [wSouthConnectionStripDest + 1] ld d, a - ld a, [wSouthConnectionStripWidth] + ld a, [wSouthConnectionStripLength] ldh [hNorthSouthConnectionStripWidth], a ld a, [wSouthConnectedMapWidth] ldh [hNorthSouthConnectedMapWidth], a call LoadNorthSouthConnectionsTileMap .westConnection - ld a, [wMapConn3Ptr] + ld a, [wWestConnectedMap] cp $ff jr z, .eastConnection call SwitchToMapRomBank @@ -985,13 +985,13 @@ LoadTileBlockMap:: ld e, a ld a, [wWestConnectionStripDest + 1] ld d, a - ld a, [wWestConnectionStripHeight] + ld a, [wWestConnectionStripLength] ld b, a ld a, [wWestConnectedMapWidth] ldh [hEastWestConnectedMapWidth], a call LoadEastWestConnectionsTileMap .eastConnection - ld a, [wMapConn4Ptr] + ld a, [wEastConnectedMap] cp $ff jr z, .done call SwitchToMapRomBank @@ -1003,7 +1003,7 @@ LoadTileBlockMap:: ld e, a ld a, [wEastConnectionStripDest + 1] ld d, a - ld a, [wEastConnectionStripHeight] + ld a, [wEastConnectionStripLength] ld b, a ld a, [wEastConnectedMapWidth] ldh [hEastWestConnectedMapWidth], a @@ -2046,32 +2046,32 @@ LoadMapHeader:: jr nz, .copyFixedHeaderLoop ; initialize all the connected maps to disabled at first, before loading the actual values ld a, $ff - ld [wMapConn1Ptr], a - ld [wMapConn2Ptr], a - ld [wMapConn3Ptr], a - ld [wMapConn4Ptr], a + ld [wNorthConnectedMap], a + ld [wSouthConnectedMap], a + ld [wWestConnectedMap], a + ld [wEastConnectedMap], a ; copy connection data (if any) to WRAM ld a, [wMapConnections] ld b, a .checkNorth bit 3, b jr z, .checkSouth - ld de, wMapConn1Ptr + ld de, wNorthConnectionHeader call CopyMapConnectionHeader .checkSouth bit 2, b jr z, .checkWest - ld de, wMapConn2Ptr + ld de, wSouthConnectionHeader call CopyMapConnectionHeader .checkWest bit 1, b jr z, .checkEast - ld de, wMapConn3Ptr + ld de, wWestConnectionHeader call CopyMapConnectionHeader .checkEast bit 0, b jr z, .getObjectDataPointer - ld de, wMapConn4Ptr + ld de, wEastConnectionHeader call CopyMapConnectionHeader .getObjectDataPointer ld a, [hli] @@ -2094,7 +2094,7 @@ LoadMapHeader:: ld c, a ld de, wWarpEntries .warpLoop ; one warp per loop iteration - ld b, $04 + ld b, 4 .warpInnerLoop ld a, [hli] ld [de], a diff --git a/home/predef.asm b/home/predef.asm index 69aa7347..14ac07b5 100644 --- a/home/predef.asm +++ b/home/predef.asm @@ -35,16 +35,16 @@ Predef:: GetPredefRegisters:: ; Restore the contents of register pairs ; when GetPredefPointer was called. - ld a, [wPredefRegisters + 0] + ld a, [wPredefHL] ld h, a - ld a, [wPredefRegisters + 1] + ld a, [wPredefHL + 1] ld l, a - ld a, [wPredefRegisters + 2] + ld a, [wPredefDE] ld d, a - ld a, [wPredefRegisters + 3] + ld a, [wPredefDE + 1] ld e, a - ld a, [wPredefRegisters + 4] + ld a, [wPredefBC] ld b, a - ld a, [wPredefRegisters + 5] + ld a, [wPredefBC + 1] ld c, a ret diff --git a/macros/wram.asm b/macros/wram.asm index 9d412f2d..872e7f57 100644 --- a/macros/wram.asm +++ b/macros/wram.asm @@ -102,3 +102,14 @@ sprite_oam_struct: MACRO \1TileID:: db \1Attributes:: db ENDM + +map_connection_struct: MACRO +\1ConnectedMap:: db +\1ConnectionStripSrc:: dw +\1ConnectionStripDest:: dw +\1ConnectionStripLength:: db +\1ConnectedMapWidth:: db +\1ConnectedMapYAlignment:: db +\1ConnectedMapXAlignment:: db +\1ConnectedMapViewPointer:: dw +ENDM diff --git a/scripts/VermilionDock.asm b/scripts/VermilionDock.asm index ea1fae79..f98e1250 100644 --- a/scripts/VermilionDock.asm +++ b/scripts/VermilionDock.asm @@ -182,12 +182,12 @@ VermilionDock_1dc7c: VermilionDock_EraseSSAnne: ; Fill the area the S.S. Anne occupies in BG map 0 with water tiles. ld hl, wVermilionDockTileMapBuffer - ld bc, (5 * BG_MAP_WIDTH) + SCREEN_WIDTH + ld bc, wVermilionDockTileMapBufferEnd - wVermilionDockTileMapBuffer ld a, $14 ; water tile call FillMemory hlbgcoord 0, 10 ld de, wVermilionDockTileMapBuffer - ld bc, (6 * BG_MAP_WIDTH) / 16 + lb bc, BANK(wVermilionDockTileMapBuffer), 12 call CopyVideoData ; Replace the blocks of the lower half of the ship with water blocks. This diff --git a/wram.asm b/wram.asm index 4a83a8e8..da21cc43 100644 --- a/wram.asm +++ b/wram.asm @@ -26,83 +26,54 @@ wStereoPanning:: db wSavedVolume:: db -wChannelCommandPointers:: ds 16 +wChannelCommandPointers:: ds NUM_CHANNELS * 2 +wChannelReturnAddresses:: ds NUM_CHANNELS * 2 -wChannelReturnAddresses:: ds 16 - -wChannelSoundIDs:: ds 8 - -wChannelFlags1:: ds 8 - -wChannelFlags2:: ds 8 - -wChannelDutyCycles:: ds 8 - -wChannelDutyCyclePatterns:: ds 8 +wChannelSoundIDs:: ds NUM_CHANNELS +wChannelFlags1:: ds NUM_CHANNELS +wChannelFlags2:: ds NUM_CHANNELS +wChannelDutyCycles:: ds NUM_CHANNELS +wChannelDutyCyclePatterns:: ds NUM_CHANNELS ; reloaded at the beginning of a note. counts down until the vibrato begins. -wChannelVibratoDelayCounters:: ds 8 - -wChannelVibratoExtents:: ds 8 - +wChannelVibratoDelayCounters:: ds NUM_CHANNELS +wChannelVibratoExtents:: ds NUM_CHANNELS ; high nybble is rate (counter reload value) and low nybble is counter. ; time between applications of vibrato. -wChannelVibratoRates:: ds 8 - -wChannelFrequencyLowBytes:: ds 8 - +wChannelVibratoRates:: ds NUM_CHANNELS +wChannelFrequencyLowBytes:: ds NUM_CHANNELS ; delay of the beginning of the vibrato from the start of the note -wChannelVibratoDelayCounterReloadValues:: ds 8 - -wChannelPitchSlideLengthModifiers:: ds 8 - -wChannelPitchSlideFrequencySteps:: ds 8 - -wChannelPitchSlideFrequencyStepsFractionalPart:: ds 8 - -wChannelPitchSlideCurrentFrequencyFractionalPart:: ds 8 - -wChannelPitchSlideCurrentFrequencyHighBytes:: ds 8 - -wChannelPitchSlideCurrentFrequencyLowBytes:: ds 8 - -wChannelPitchSlideTargetFrequencyHighBytes:: ds 8 - -wChannelPitchSlideTargetFrequencyLowBytes:: ds 8 - +wChannelVibratoDelayCounterReloadValues:: ds NUM_CHANNELS +wChannelPitchSlideLengthModifiers:: ds NUM_CHANNELS +wChannelPitchSlideFrequencySteps:: ds NUM_CHANNELS +wChannelPitchSlideFrequencyStepsFractionalPart:: ds NUM_CHANNELS +wChannelPitchSlideCurrentFrequencyFractionalPart:: ds NUM_CHANNELS +wChannelPitchSlideCurrentFrequencyHighBytes:: ds NUM_CHANNELS +wChannelPitchSlideCurrentFrequencyLowBytes:: ds NUM_CHANNELS +wChannelPitchSlideTargetFrequencyHighBytes:: ds NUM_CHANNELS +wChannelPitchSlideTargetFrequencyLowBytes:: ds NUM_CHANNELS ; Note delays are stored as 16-bit fixed-point numbers where the integer part ; is 8 bits and the fractional part is 8 bits. -wChannelNoteDelayCounters:: ds 8 - -wChannelLoopCounters:: ds 8 - -wChannelNoteSpeeds:: ds 8 - -wChannelNoteDelayCountersFractionalPart:: ds 8 - -wChannelOctaves:: ds 8 - +wChannelNoteDelayCounters:: ds NUM_CHANNELS +wChannelLoopCounters:: ds NUM_CHANNELS +wChannelNoteSpeeds:: ds NUM_CHANNELS +wChannelNoteDelayCountersFractionalPart:: ds NUM_CHANNELS +wChannelOctaves:: ds NUM_CHANNELS ; also includes fade for hardware channels that support it -wChannelVolumes:: ds 8 +wChannelVolumes:: ds NUM_CHANNELS wMusicWaveInstrument:: db - wSfxWaveInstrument:: db - wMusicTempo:: dw - wSfxTempo:: dw - wSfxHeaderPointer:: dw wNewSoundID:: db wAudioROMBank:: db - wAudioSavedROMBank:: db wFrequencyModifier:: db - wTempoModifier:: db ds 13 @@ -288,43 +259,33 @@ wTextDest:: dw ; if non-zero, skip waiting for a button press after displaying text in DisplayTextID wDoNotWaitForButtonPressAfterDisplayingText:: db -; the final received nybble is stored here by Serial_SyncAndExchangeNybble -wSerialSyncAndExchangeNybbleReceiveData:: +UNION +; the received menu selection is stored twice +wLinkMenuSelectionReceiveBuffer:: dw + ds 3 +; the menu selection byte is stored twice before sending +wLinkMenuSelectionSendBuffer:: dw + ds 3 +wEnteringCableClub:: +wLinkTimeoutCounter:: db +NEXTU ; temporary nybble used by Serial_ExchangeNybble wSerialExchangeNybbleTempReceiveData:: - -; two byte buffer -; the received menu selection is stored twice -wLinkMenuSelectionReceiveBuffer:: db - +; the final received nybble is stored here by Serial_SyncAndExchangeNybble +wSerialSyncAndExchangeNybbleReceiveData:: db ; the final received nybble is stored here by Serial_ExchangeNybble wSerialExchangeNybbleReceiveData:: db - ds 3 - ; this nybble is sent when using Serial_SyncAndExchangeNybble or Serial_ExchangeNybble -wSerialExchangeNybbleSendData:: - -; two byte buffer -; the menu selection byte is stored twice before sending -wLinkMenuSelectionSendBuffer:: - - ds 5 - -; 1 byte -wLinkTimeoutCounter:: - -; 2 bytes -wUnknownSerialCounter:: - -; 1 byte -wEnteringCableClub:: dw +wSerialExchangeNybbleSendData:: db + ds 4 +wUnknownSerialCounter:: dw +ENDU ; $00 = player mons ; $01 = enemy mons wWhichTradeMonSelectionMenu:: - ; 0 = player's party ; 1 = enemy party ; 2 = current box @@ -348,7 +309,9 @@ wCheckFor180DegreeTurn:: db wMissableObjectIndex:: db wPredefID:: db -wPredefRegisters:: ds 6 +wPredefHL:: dw +wPredefDE:: dw +wPredefBC:: dw wTrainerHeaderFlagBit:: db @@ -363,42 +326,37 @@ wNPCMovementScriptBank:: db ds 2 -wUnusedCC5B:: - -; 180 bytes -wVermilionDockTileMapBuffer:: +wVermilionDockTileMapBuffer:: ; ds 5 * BG_MAP_WIDTH + SCREEN_WIDTH -wOaksAideRewardItemName:: +wOaksAideRewardItemName:: ; ds ITEM_NAME_LENGTH -wDexRatingNumMonsSeen:: +wElevatorWarpMaps:: ; ds 11 * 2 ; List of bag items that has been filtered to a certain type of items, ; such as drinks or fossils. -wFilteredBagItems:: - -wElevatorWarpMaps:: +wFilteredBagItems:: ; ds 3 + 1 ; Saved copy of OAM for the first frame of the animation to make it easy to ; flip back from the second frame. -; $60 bytes -wMonPartySpritesSavedOAM:: +wMonPartySpritesSavedOAM:: ; ds $60 -; $40 bytes -wTrainerCardBlkPacket:: +wTrainerCardBlkPacket:: ; ds $40 +wHallOfFame:: ; ds HOF_TEAM + +wNPCMovementDirections:: ; ds $ff + +wBoostExpByExpAll:: +; values between 0-6. Shake screen horizontally, shake screen vertically, blink Pokemon... +wAnimationType:: ; 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. wSlotMachineSevenAndBarModeChance:: - -; values between 0-6. Shake screen horizontally, shake screen vertically, blink Pokemon... -wHallOfFame:: -wBoostExpByExpAll:: -wAnimationType:: - -wNPCMovementDirections:: db +wUnusedCC5B:: +wDexRatingNumMonsSeen:: db wDexRatingNumMonsOwned:: db @@ -420,24 +378,22 @@ wNumStepsToTake:: db NEXTU ; temporary buffer when swapping party mon data -wSwitchPartyMonTempBuffer:: ds 49 +wSwitchPartyMonTempBuffer:: ds 44 ; party_struct size ENDU - ds 10 + ds 15 wRLEByteCount:: db -; 0 = not added -; 1 = added -wAddedToParty:: - ; 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 wSimulatedJoypadStatesEnd:: wParentMenuItem:: - +; 0 = not added +; 1 = added +wAddedToParty:: ; 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. @@ -491,24 +447,24 @@ wSafariBaitFactor:: db wTransformedEnemyMonOriginalDVs:: dw -wMonIsDisobedient:: ds 1 +wMonIsDisobedient:: db -wPlayerDisabledMoveNumber:: ds 1 -wEnemyDisabledMoveNumber:: ds 1 +wPlayerDisabledMoveNumber:: db +wEnemyDisabledMoveNumber:: db ; When running in the scope of HandlePlayerMonFainted, it equals 1. ; When running in the scope of HandleEnemyMonFainted, it equals 0. wInHandlePlayerMonFainted:: db -wPlayerUsedMove:: ds 1 -wEnemyUsedMove:: ds 1 +wPlayerUsedMove:: db +wEnemyUsedMove:: db -wEnemyMonMinimized:: ds 1 +wEnemyMonMinimized:: db -wMoveDidntMiss:: ds 1 +wMoveDidntMiss:: db ; flags that indicate which party members have fought the current enemy mon -wPartyFoughtCurrentEnemyFlags:: flag_array 6 +wPartyFoughtCurrentEnemyFlags:: flag_array PARTY_LENGTH ; Whether the low health alarm has been disabled due to the player winning the ; battle. @@ -518,28 +474,33 @@ wPlayerMonMinimized:: db ds 13 +UNION wLuckySlotHiddenObjectIndex:: - ; number of hits by enemy in attacks like Double Slap, etc. -wEnemyNumHits:: +wEnemyNumHits:: db +NEXTU ; the amount of damage accumulated by the enemy while biding (2 bytes) -wEnemyBideAccumulatedDamage:: - - ds 10 +wEnemyBideAccumulatedDamage:: dw +ENDU -wInGameTradeGiveMonSpecies:: + ds 8 -wPlayerMonUnmodifiedLevel:: db +wVermilionDockTileMapBufferEnd:: -wInGameTradeTextPointerTablePointer:: +UNION +wInGameTradeGiveMonSpecies:: db +wInGameTradeTextPointerTablePointer:: dw +wInGameTradeTextPointerTableIndex:: db +wInGameTradeGiveMonName:: ds NAME_LENGTH +wInGameTradeReceiveMonName:: ds NAME_LENGTH +wInGameTradeMonNick:: ds NAME_LENGTH +wInGameTradeReceiveMonSpecies:: db +NEXTU +wPlayerMonUnmodifiedLevel:: db wPlayerMonUnmodifiedMaxHP:: dw - -wInGameTradeTextPointerTableIndex:: - -wPlayerMonUnmodifiedAttack:: db -wInGameTradeGiveMonName:: db +wPlayerMonUnmodifiedAttack:: dw wPlayerMonUnmodifiedDefense:: dw wPlayerMonUnmodifiedSpeed:: dw wPlayerMonUnmodifiedSpecial:: dw @@ -547,20 +508,14 @@ wPlayerMonUnmodifiedSpecial:: dw ; stat modifiers for the player's current pokemon ; value can range from 1 - 13 ($1 to $D) ; 7 is normal - wPlayerMonStatMods:: wPlayerMonAttackMod:: db wPlayerMonDefenseMod:: db wPlayerMonSpeedMod:: db wPlayerMonSpecialMod:: db - -wInGameTradeReceiveMonName:: - wPlayerMonAccuracyMod:: db wPlayerMonEvasionMod:: db - ds 2 - wPlayerMonStatModsEnd:: ds 1 @@ -568,21 +523,13 @@ wPlayerMonStatModsEnd:: wEnemyMonUnmodifiedLevel:: db wEnemyMonUnmodifiedMaxHP:: dw wEnemyMonUnmodifiedAttack:: dw -wEnemyMonUnmodifiedDefense:: db - -; ds 11 -wInGameTradeMonNick:: db - +wEnemyMonUnmodifiedDefense:: dw wEnemyMonUnmodifiedSpeed:: dw -wEnemyMonUnmodifiedSpecial:: db - -wEngagedTrainerClass:: db -wEngagedTrainerSet:: ; db +wEnemyMonUnmodifiedSpecial:: dw ; stat modifiers for the enemy's current pokemon ; value can range from 1 - 13 ($1 to $D) ; 7 is normal - wEnemyMonStatMods:: wEnemyMonAttackMod:: db wEnemyMonDefenseMod:: db @@ -590,19 +537,19 @@ wEnemyMonSpeedMod:: db wEnemyMonSpecialMod:: db wEnemyMonAccuracyMod:: db wEnemyMonEvasionMod:: db - -wInGameTradeReceiveMonSpecies:: db - - ds 1 - + ds 2 wEnemyMonStatModsEnd:: +NEXTU + ds 30 +wEngagedTrainerClass:: db +wEngagedTrainerSet:: db +ENDU + ds 1 wNPCMovementDirections2Index:: - wUnusedCD37:: - ; number of items in wFilteredBagItems list wFilteredBagItemsCount:: db @@ -622,275 +569,193 @@ wOverrideSimulatedJoypadStatesMask:: db ds 1 -; up to 20 bytes (one byte for each falling object) -wFallingObjectsMovementData:: +; one byte for each falling object +wFallingObjectsMovementData:: ; ds 20 -wSavedY:: +; array of the number of mons in each box +wBoxMonCounts:: ; ds NUM_BOXES -wTempSCX:: +; BCD number +wPriceTemp:: ; ds 3 + +; the current mon's field moves +wFieldMoves:: ; ds NUM_MOVES +wBoxNumString:: ; ds 3 + +wSavedY:: +wTempSCX:: ; 0 = upper half (Y < 9) ; 1 = lower half (Y >= 9) wBattleTransitionCircleScreenQuadrantY:: - ; 2 bytes ; after 1 row/column has been copied, the offset to the next one to copy from wBattleTransitionCopyTilesOffset:: - ; 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 wInwardSpiralUpdateScreenCounter:: - wHoFTeamIndex:: - ; multiplied by 16 to get the number of times to go right by 2 pixels wSSAnneSmokeDriftAmount:: - wRivalStarterTemp:: - -; 12 bytes -; array of the number of mons in each box -wBoxMonCounts:: - wDexMaxSeenMon:: - wPPRestoreItem:: - wWereAnyMonsAsleep:: - wCanPlaySlots:: - wNumShakes:: - ; the level of the mon at the time it entered day care wDayCareStartLevel:: - wWhichBadge:: - -; 3-byte BCD number -wPriceTemp:: - wTitleMonSpecies:: - wPlayerCharacterOAMTile:: - ; the number of small stars OAM entries to move down wMoveDownSmallStarsOAMCount:: - wChargeMoveNum:: - wCoordIndex:: - wOptionsTextSpeedCursorX:: - wTrainerInfoTextBoxWidthPlus1:: - wSwappedMenuItem:: - wHoFMonSpecies:: - -; 4 bytes -; the current mon's field moves -wFieldMoves:: - ; tile ID of the badge number being drawn wBadgeNumberTile:: - ; 0 = no bite ; 1 = bite ; 2 = no fish on map wRodResponse:: - wWhichTownMapLocation:: - ; which wheel the player is trying to stop ; 0 = none, 1 = wheel 1, 2 = wheel 2, 3 or greater = wheel 3 wStoppingWhichSlotMachineWheel:: - wTradedPlayerMonSpecies:: - wTradingWhichPlayerMon:: - wChangeBoxSavedMapTextPointer:: - wFlyAnimUsingCoordList:: - wPlayerSpinInPlaceAnimFrameDelay:: - wPlayerSpinWhileMovingUpOrDownAnimDeltaY:: - -wBoxNumString:: - wHiddenObjectFunctionArgument:: - ; which entry from TradeMons to select wWhichTrade:: - wTrainerSpriteOffset:: +wUnusedCD3D:: + db -wUnusedCD3D:: db +; $ff sentinel values at each end +wFlyLocationsList:: ; ds NUM_CITY_MAPS + 2 ; difference in X between the next ball and the current one wHUDPokeballGfxOffsetX:: - ; 0 = left half (X < 10) ; 1 = right half (X >= 10) wBattleTransitionCircleScreenQuadrantX:: - wSSAnneSmokeX:: - wRivalStarterBallSpriteIndex:: - wDayCareNumLevelsGrown:: - wOptionsBattleAnimCursorX:: - wTrainerInfoTextBoxWidth:: - wHoFPartyMonIndex:: - ; the number of credits mons that have been displayed so far wNumCreditsMonsDisplayed:: - ; first tile ID of the name being drawn wBadgeNameTile:: - -; NUM_CITY_MAPS bytes plus $ff sentinel values at each end -wFlyLocationsList:: - wSlotMachineWheel1Offset:: - wTradedEnemyMonSpecies:: - wTradingWhichEnemyMon:: - wFlyAnimCounter:: - wPlayerSpinInPlaceAnimFrameDelayDelta:: - wPlayerSpinWhileMovingUpOrDownAnimMaxY:: - wHiddenObjectFunctionRomBank:: +wTrainerEngageDistance:: + db -wTrainerEngageDistance:: db +wHUDGraphicsTiles:: ; ds 3 -; 3 bytes -wHUDGraphicsTiles:: +; BCD number +wDayCareTotalCost:: ; ds 2 -; 2-byte BCD number -wDayCareTotalCost:: +; 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 +wBadgeOrFaceTiles:: ; ds NUM_BADGES -wJigglypuffFacingDirections:: +wNameOfPlayerMonToBeTraded:: ; ds NAME_LENGTH +wJigglypuffFacingDirections:: wOptionsBattleStyleCursorX:: - wTrainerInfoTextBoxNextRowOffset:: - wHoFMonLevel:: - -; 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 -wBadgeOrFaceTiles:: - wSlotMachineWheel2Offset:: - -wNameOfPlayerMonToBeTraded:: - wFlyAnimBirdSpriteImageIndex:: - wPlayerSpinInPlaceAnimFrameDelayEndValue:: - wPlayerSpinWhileMovingUpOrDownAnimFrameDelay:: - wHiddenObjectIndex:: - -wTrainerFacingDirection:: db +wTrainerFacingDirection:: + db ; show mon or show player? ; 0 = mon ; 1 = player wHoFMonOrPlayer:: - wSlotMachineWheel3Offset:: - wPlayerSpinInPlaceAnimSoundID:: - wHiddenObjectY:: - wTrainerScreenY:: +wOptionsCancelCursorX:: + db -wOptionsCancelCursorX:: db +; BCD number (always set to $100) +wDayCarePerLevelCost:: ; ds 2 -; 2-byte BCD number (always set to $100) -wDayCarePerLevelCost:: +wTradedPlayerMonOT:: ; ds NAME_LENGTH wHoFTeamIndex2:: - wHiddenItemOrCoinsIndex:: - -wTradedPlayerMonOT:: - wHiddenObjectX:: - ; the OAM tile number of the upper left corner of the winning symbol minus 2 wSlotMachineWinningSymbol:: - wNumFieldMoves:: - wSlotMachineWheel1BottomTile:: - -wTrainerScreenX:: db -; a lot of the uses for these values use more than the said address +wTrainerScreenX:: + db wHoFTeamNo:: - wSlotMachineWheel1MiddleTile:: +wFieldMovesLeftmostXCoord:: + db -wFieldMovesLeftmostXCoord:: db - -; unused -wLastFieldMoveID:: - -wSlotMachineWheel1TopTile:: db +wLastFieldMoveID:: ; unused +wSlotMachineWheel1TopTile:: + db wSlotMachineWheel2BottomTile:: db wSlotMachineWheel2MiddleTile:: db -; 2 bytes ; temporary variable used to add payout amount to the player's coins -wTempCoins1:: +wTempCoins1:: ; ds 2 wSlotMachineWheel2TopTile:: db ; 0 = outward, 1 = inward wBattleTransitionSpiralDirection:: - wSlotMachineWheel3BottomTile:: db -wSlotMachineWheel3MiddleTile:: - -; 4 bytes (also, the byte before the start of the list (wSlotMachineWheel3BottomTile) -; is used a temp variable when the list is rotated) ; used when spinning the player's sprite -wFacingDirectionList:: db +; also, the byte before the start of the list is +; used as a temp variable when the list is rotated +wFacingDirectionList:: ; ds 4 -wSlotMachineWheel3TopTile:: +wSlotMachineWheel3MiddleTile:: db -; 8 bytes ; temporary list created when displaying the badges on the trainer screen ; one byte for each badge; 0 = not obtained, 1 = obtained -wTempObtainedBadgesBooleans:: db +wTempObtainedBadgesBooleans:: ; ds NUM_BADGES + +wSlotMachineWheel3TopTile:: db -; 2 bytes ; temporary variable used to subtract the bet amount from the player's coins wTempCoins2:: - -; 2 bytes wPayoutCoins:: dw -wTradedPlayerMonOTID:: +wTradedPlayerMonOTID:: ; dw ; These flags are set randomly and control when the wheels stop. ; bit 6: allow the player to win in general @@ -899,34 +764,30 @@ wSlotMachineFlags:: db ; wheel 1 can "slip" while this is non-zero wSlotMachineWheel1SlipCounter:: - ; $3d = tree tile ; $52 = grass tile wCutTile:: db -; wheel 2 can "slip" while this is non-zero -wSlotMachineWheel2SlipCounter:: +wTradedEnemyMonOT:: ; ds NAME_LENGTH -wTradedEnemyMonOT:: db +; wheel 2 can "slip" while this is non-zero +wSlotMachineWheel2SlipCounter:: db wSavedPlayerScreenY:: - ; 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. wSlotMachineRerollCounter:: - ; the index of the sprite the emotion bubble is to be displayed above wEmotionBubbleSpriteIndex:: db wWhichEmotionBubble:: - ; how many coins the player bet on the slot machine (1 to 3) wSlotMachineBet:: - wSavedPlayerFacingDirection:: - ; 0 = cut animation, 1 = boulder dust animation -wWhichAnimationOffsets:: ds 9 +wWhichAnimationOffsets:: db + + ds 8 wTradedEnemyMonOTID:: dw @@ -934,9 +795,7 @@ wTradedEnemyMonOTID:: dw ; 1 = warp pad ; 2 = hole wStandingOnWarpPadOrHole:: - wOAMBaseTile:: - wGymTrashCanIndex:: db wSymmetricSpriteOAMAttributes:: db @@ -976,84 +835,71 @@ wJoyIgnore:: db ; $00 = 5×5 ; $01 = 3×3 wDownscaledMonSize:: - ; FormatMovesString stores the number of moves minus one here wNumMovesMinusOne:: db UNION - wcd6d:: ds NAME_BUFFER_LENGTH ; buffer for various data NEXTU +wEvosMoves:: ds MAX_EVOLUTIONS * EVOLUTION_SIZE + 1 +wEvosMovesEnd:: +NEXTU ds 4 - ; temp variable used to print a move's current PP on the status screen wStatusScreenCurrentPP:: db - ds 6 - ; list of normal max PP (without PP up) values -wNormalMaxPPList:: ds 9 - -NEXTU - -wEvosMoves:: ds MAX_EVOLUTIONS * EVOLUTION_SIZE + 1 -.end:: - +wNormalMaxPPList:: ds NUM_MOVES + ds 5 ENDU ; buffer for transferring the random number list generated by the other gameboy -wSerialOtherGameboyRandomNumberListBlock:: +wSerialOtherGameboyRandomNumberListBlock:: ; ds $11 ; second buffer for temporarily saving and restoring current screen's tiles (e.g. if menus are drawn on top) wTileMapBackup2:: ds 20 * 18 -wNamingScreenNameLength:: +; Temporary storage area +wBuffer:: ; ds 30 +wNamingScreenNameLength:: wEvoOldSpecies:: - -; Temporary storage area of 30 bytes. -wBuffer:: - ; lower nybble is x, upper nybble is y wTownMapCoords:: - ; whether WriteMonMoves is being used to make a mon learn moves from day care ; non-zero if so wLearningMovesFromDayCare:: - wChangeMonPicEnemyTurnSpecies:: - -wHPBarMaxHP:: db +wHPBarMaxHP:: + db ; non-zero when the player has chosen to submit the name wNamingScreenSubmitName:: - wChangeMonPicPlayerTurnSpecies:: +wEvoNewSpecies:: + db -wEvoNewSpecies:: db +UNION +wHPBarOldHP:: dw +wHPBarNewHP:: dw +wHPBarDelta:: db +wHPBarTempHP:: dw + ds 11 +wHPBarHPDifference:: db +NEXTU ; 0 = upper case ; 1 = lower case wAlphabetCase:: - wEvoMonTileOffset:: - -wHPBarOldHP:: db + db wEvoCancelled:: db -wNamingScreenLetter:: - -wHPBarNewHP:: dw -wHPBarDelta:: db - -wHPBarTempHP:: dw - - ds 11 - -wHPBarHPDifference:: db +wNamingScreenLetter:: db +ENDU ds 7 @@ -1084,12 +930,12 @@ wBattleResult:: db ; bit 0: if set, DisplayTextID automatically draws a text box wAutoTextBoxDrawingControl:: db -wcf0d:: ds 1 ; used with some overworld scripts (not exactly sure what it's used for) +wcf0d:: db ; used with some overworld scripts (not exactly sure what it's used for) ; used in CheckForTilePairCollisions2 to store the tile the player is on wTilePlayerStandingOn:: db -wNPCNumScriptedSteps:: ds 1 +wNPCNumScriptedSteps:: db ; which script function within the pointer table indicated by ; wNPCMovementScriptPointerTableNum @@ -1101,7 +947,7 @@ wTextPredefFlag:: db wPredefParentBank:: db -wSpriteIndex:: ds 1 +wSpriteIndex:: db ; movement byte 2 of current sprite wCurSpriteMovement2:: db @@ -1122,7 +968,7 @@ wOnSGB:: db wDefaultPaletteCommand:: db -wPlayerHPBarColor:: +wPlayerHPBarColor:: ; dw ; species of the mon whose palette is used for the whole screen wWholeScreenPaletteMonSpecies:: db @@ -1132,27 +978,26 @@ wEnemyHPBarColor:: db ; 0: green ; 1: yellow ; 2: red -wPartyMenuHPBarColors:: ds 6 +wPartyMenuHPBarColors:: ds PARTY_LENGTH wStatusScreenHPBarColor:: db ds 7 wCopyingSGBTileData:: - wWhichPartyMenuHPBar:: +wPalPacket:: + db -wPalPacket:: db - -; $30 bytes -wPartyMenuBlkPacket:: ds 29 +wPartyMenuBlkPacket:: ; ds $30 -; 2-byte big-endian number -; the total amount of exp a mon gained -wExpAmountGained:: + ds 29 ; storage buffer for various strings -wcf4b:: dw +wcf4b:: ; ds 20 + +; the total amount of exp a mon gained +wExpAmountGained:: dw wGainBoostedExp:: db @@ -1166,13 +1011,12 @@ wItemList:: ds 16 wListPointer:: dw -; 2 bytes ; used to store pointers, but never read wUnusedCF8D:: dw wItemPrices:: dw -wcf91:: ds 1 ; used with a lot of things (too much to list here) +wcf91:: db ; used with a lot of things (too much to list here) ; which pokemon you selected wWhichPokemon:: db @@ -1185,14 +1029,12 @@ wPrintItemPrices:: db ; $01 = player HUD in battle / status screen ; $02 = party menu wHPBarType:: - ; ID used by DisplayListMenuID wListMenuID:: db ; if non-zero, RemovePokemon will remove the mon from the current box, ; else it will remove the mon from the party wRemoveMonFromBox:: - ; 0 = move from box to party ; 1 = move from party to box ; 2 = move from daycare to party @@ -1263,7 +1105,6 @@ wPlayerMoveType:: db wPlayerMoveAccuracy:: db wPlayerMoveMaxPP:: db - wEnemyMonSpecies2:: db wBattleMonSpecies2:: db @@ -1271,9 +1112,9 @@ wEnemyMonNick:: ds NAME_LENGTH wEnemyMon:: battle_struct wEnemyMon -wEnemyMonBaseStats:: ds 5 -wEnemyMonActualCatchRate:: ds 1 -wEnemyMonBaseExp:: ds 1 +wEnemyMonBaseStats:: ds NUM_STATS +wEnemyMonActualCatchRate:: db +wEnemyMonBaseExp:: db wBattleMonNick:: ds NAME_LENGTH wBattleMon:: battle_struct wBattleMon @@ -1287,12 +1128,14 @@ wTrainerPicPointer:: dw ds 1 -wTempMoveNameBuffer:: +wTempMoveNameBuffer:: ; ds 14 ; The name of the mon that is learning a move. -wLearnMoveMonName:: ds 16 +wLearnMoveMonName:: ; ds NAME_LENGTH + + ds 16 -; 2-byte BCD number +; BCD number ; money received after battle = base money × level of highest-level enemy mon wTrainerBaseMoney:: dw @@ -1312,7 +1155,7 @@ wTrainerName:: ds 13 wIsInBattle:: db ; flags that indicate which party members should be be given exp when GainExperience is called -wPartyGainExpFlags:: flag_array 6 +wPartyGainExpFlags:: flag_array PARTY_LENGTH ; in a wild battle, this is the species of pokemon ; in a trainer battle, this is the trainer class + OPP_ID_OFFSET @@ -1413,22 +1256,21 @@ wEnemyDisabledMove:: db ds 1 -; number of hits by player in attacks like Double Slap, etc. -wPlayerNumHits:: +; the amount of damage accumulated by the player while biding +wPlayerBideAccumulatedDamage:: ; dw -; the amount of damage accumulated by the player while biding (2 bytes) -wPlayerBideAccumulatedDamage:: +wUnknownSerialCounter2:: ; dw -; 2 bytes -wUnknownSerialCounter2:: +; number of hits by player in attacks like Double Slap, etc. +wPlayerNumHits:: db - ds 4 + ds 3 ; non-zero when an item or move that allows escape from battle was used wEscapedFromBattle:: db -; 3-byte BCD number -wAmountMoneyWon:: +; BCD number +wAmountMoneyWon:: ; ds 3 wObjectToHide:: db @@ -1438,16 +1280,12 @@ wObjectToShow:: db ; the map you will start at when the debug bit is set wDefaultMap:: - wMenuItemOffset:: - ; ID number of the current battle animation wAnimationID:: db wNamingScreenType:: - wPartyMenuTypeOrMessageID:: - ; temporary storage for the number of tiles in a tileset wTempTilesetNumTiles:: db @@ -1463,7 +1301,7 @@ wBaseCoordY:: db ; low health alarm counter/enable ; high bit = enable, others = timer to cycle frequencies -wLowHealthAlarm:: ds 1 +wLowHealthAlarm:: db ; counts how many tiles of the current frame block have been drawn wFBTileCounter:: db @@ -1483,42 +1321,32 @@ wSaveFileStatus:: db wNumFBTiles:: db wFlashScreenLongCounter:: - wSpiralBallsBaseY:: - ; bits 0-6: index into FallingObjects_DeltaXs array (0 - 8) ; bit 7: direction; 0 = right, 1 = left wFallingObjectMovementByte:: - wNumShootingBalls:: - ; $01 if mon is moving from left gameboy to right gameboy; $00 if vice versa wTradedMonMovingRight:: - wOptionsInitialized:: - wNewSlotMachineBallTile:: - ; how much to add to the X/Y coord wCoordAdjustmentAmount:: - -wUnusedD08A:: db +wUnusedD08A:: + db wSpiralBallsBaseX:: - wNumFallingObjects:: - wSlideMonDelay:: - ; generic counter variable for various animations wAnimCounter:: - ; controls what transformations are applied to the subanimation ; 01: flip horizontally and vertically ; 02: flip horizontally and translate downwards 40 pixels ; 03: translate base coordinates of frame blocks, but don't change their internal coordinates or flip their tiles ; 04: reverse the subanimation -wSubAnimTransform:: db +wSubAnimTransform:: + db wEndBattleWinTextPointer:: dw @@ -1533,25 +1361,23 @@ wEndBattleTextRomBank:: db ; the address _of the address_ of the current subanimation entry wSubAnimAddrPtr:: dw +; the address of the current subentry of the current subanimation +wSubAnimSubEntryAddr:: ; dw + ; 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. -wSlotMachineAllowMatchesCounter:: - -; the address of the current subentry of the current subanimation -wSubAnimSubEntryAddr:: dw +wSlotMachineAllowMatchesCounter:: db - ds 2 + ds 3 wOutwardSpiralTileMapPointer:: db wPartyMenuAnimMonEnabled:: - ; non-zero when enabled. causes nest locations to blink on and off. ; the town selection cursor will blink regardless of what this value is wTownMapSpriteBlinkingEnabled:: - wUnusedD09B:: db ; current destination address in OAM for frame blocks (big endian) @@ -1568,25 +1394,19 @@ wFBMode:: db ; 0 = small ; 1 = big wLinkCableAnimBulgeToggle:: - wIntroNidorinoBaseTile:: - wOutwardSpiralCurrentDirection:: - wDropletTile:: - wNewTileBlockID:: - wWhichBattleAnimTileset:: - ; 0 = left ; 1 = right wSquishMonCurrentDirection:: - ; the tile ID of the leftmost tile in the bottom row in AnimationSlideMonUp_ -wSlideMonUpBottomRowLeftTile:: db +wSlideMonUpBottomRowLeftTile:: + db -wDisableVBlankWYUpdate:: ds 1 ; if non-zero, don't update WY during V-blank +wDisableVBlankWYUpdate:: db ; if non-zero, don't update WY during V-blank wSpriteCurPosX:: db wSpriteCurPosY:: db @@ -1621,44 +1441,34 @@ wSpriteDecodeTable0Ptr:: dw ; pointer to differential decoding table (assuming initial value 1) wSpriteDecodeTable1Ptr:: dw -wd0b5:: ds 1 ; used as a temp storage area for Pokemon Species, and other Pokemon/Battle related things +wd0b5:: db ; used as a temp storage area for Pokemon Species, and other Pokemon/Battle related things wNameListType:: db wPredefBank:: db wMonHeader:: - ; In the ROM base stats data structure, this is the dex number, but it is ; overwritten with the internal index number after the header is copied to WRAM. wMonHIndex:: db - wMonHBaseStats:: wMonHBaseHP:: db wMonHBaseAttack:: db wMonHBaseDefense:: db wMonHBaseSpeed:: db wMonHBaseSpecial:: db - wMonHTypes:: wMonHType1:: db wMonHType2:: db - wMonHCatchRate:: db wMonHBaseEXP:: db wMonHSpriteDim:: db wMonHFrontSprite:: dw wMonHBackSprite:: dw - wMonHMoves:: ds NUM_MOVES - wMonHGrowthRate:: db - -; bit field wMonHLearnset:: flag_array NUM_TMS + NUM_HMS - ds 1 - wMonHeaderEnd:: ; saved at the start of a battle and then written back at the end of the battle @@ -1698,25 +1508,19 @@ wCapturedMonSpecies:: db wFirstMonsNotOutYet:: db wPokeBallCaptureCalcTemp:: - ; lower nybble: number of shakes ; upper nybble: number of animations to play wPokeBallAnimData:: - wUsingPPUp:: - wMaxPP:: - ; 0 for player, non-zero for enemy wCalculateWhoseStats:: - wTypeEffectiveness:: - wMoveType:: - wNumSetBits:: - -wd11e:: ds 1 ; used as a Pokemon and Item storage value. Also used as an output value for CountSetBits +; used as a Pokemon and Item storage value. Also used as an output value for CountSetBits +wd11e:: + db ; When this value is non-zero, the player isn't allowed to exit the party menu ; by pressing B and not choosing a mon. @@ -1735,7 +1539,7 @@ wIsKeyItem:: db wTextBoxID:: db -wCurrentMapScriptFlags:: ds 1 ; not exactly sure what this is used for, but it seems to be used as a multipurpose temp flag value +wCurrentMapScriptFlags:: db ; not exactly sure what this is used for, but it seems to be used as a multipurpose temp flag value wCurEnemyLVL:: db @@ -1751,7 +1555,6 @@ wTwoOptionMenuID:: db ; the id of the menu item the player ultimately chose wChosenMenuItem:: - ; non-zero when the whole party has fainted due to out-of-battle poison damage wOutOfBattleBlackout:: db @@ -1766,23 +1569,17 @@ wMenuExitMethod:: db ; the size is always 6, so they didn't need a variable in RAM for this wDungeonWarpDataEntrySize:: - ; 0 = museum guy ; 1 = gym guy wWhichPewterGuy:: - ; there are 3 windows, from 0 to 2 wWhichPrizeWindow:: - ; a horizontal or vertical gate block wGymGateTileBlock:: db wSavedSpriteScreenY:: db - wSavedSpriteScreenX:: db - wSavedSpriteMapY:: db - wSavedSpriteMapX:: db ds 5 @@ -1809,9 +1606,7 @@ wPrize3:: db wSerialRandomNumberListBlock:: wPrize1Price:: dw - wPrize2Price:: dw - wPrize3Price:: dw ds 1 @@ -1819,8 +1614,7 @@ wPrize3Price:: dw ; shared list of 9 random numbers, indexed by wLinkBattleRandomNumberListIndex wLinkBattleRandomNumberList:: ds 10 -; the first 6 bytes are the preamble -wSerialPlayerDataBlock:: +wSerialPlayerDataBlock:: ; ds ... ; 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. @@ -1841,7 +1635,7 @@ wPlayerName:: ds NAME_LENGTH wPartyDataStart:: -wPartyCount:: ds 1 +wPartyCount:: db wPartySpecies:: ds PARTY_LENGTH + 1 wPartyMons:: @@ -1874,7 +1668,6 @@ wPokedexOwnedEnd:: wPokedexSeen:: flag_array NUM_POKEMON wPokedexSeenEnd:: - wNumBagItems:: db ; item, quantity wBagItems:: ds BAG_ITEM_CAPACITY * 2 + 1 @@ -1895,7 +1688,7 @@ wRivalName:: ds NAME_LENGTH ; 5: Slow wOptions:: db -wObtainedBadges:: flag_array 8 +wObtainedBadges:: flag_array NUM_BADGES ds 1 @@ -1908,7 +1701,6 @@ wLetterPrintingDelayFlags:: db wPlayerID:: dw wMapMusicSoundID:: db - wMapMusicROMBank:: db ; offset subtracted from FadePal4 to get the background and object palettes for the current map @@ -1922,12 +1714,10 @@ wCurrentTileBlockMapViewPointer:: dw ; player's position on the current map wYCoord:: db - wXCoord:: db -; player's y position (by block) +; player's position (by block) wYBlockCoord:: db - wXBlockCoord:: db wLastMap:: db @@ -1938,86 +1728,20 @@ wCurMapTileset:: db ; blocks wCurMapHeight:: db - -; blocks wCurMapWidth:: db wMapDataPtr:: dw - wMapTextPtr:: dw - wMapScriptPtr:: dw -; connection byte wMapConnections:: db - -wMapConn1Ptr:: db - -wNorthConnectionStripSrc:: dw - -wNorthConnectionStripDest:: dw - -wNorthConnectionStripWidth:: db - -wNorthConnectedMapWidth:: db - -wNorthConnectedMapYAlignment:: db - -wNorthConnectedMapXAlignment:: db - -wNorthConnectedMapViewPointer:: dw - -wMapConn2Ptr:: db - -wSouthConnectionStripSrc:: dw - -wSouthConnectionStripDest:: dw - -wSouthConnectionStripWidth:: db - -wSouthConnectedMapWidth:: db - -wSouthConnectedMapYAlignment:: db - -wSouthConnectedMapXAlignment:: db - -wSouthConnectedMapViewPointer:: dw - -wMapConn3Ptr:: db - -wWestConnectionStripSrc:: dw - -wWestConnectionStripDest:: dw - -wWestConnectionStripHeight:: db - -wWestConnectedMapWidth:: db - -wWestConnectedMapYAlignment:: db - -wWestConnectedMapXAlignment:: db - -wWestConnectedMapViewPointer:: dw - -wMapConn4Ptr:: db - -wEastConnectionStripSrc:: dw - -wEastConnectionStripDest:: dw - -wEastConnectionStripHeight:: db - -wEastConnectedMapWidth:: db - -wEastConnectedMapYAlignment:: db - -wEastConnectedMapXAlignment:: db - -wEastConnectedMapViewPointer:: dw +wNorthConnectionHeader:: map_connection_struct wNorth +wSouthConnectionHeader:: map_connection_struct wSouth +wWestConnectionHeader:: map_connection_struct wWest +wEastConnectionHeader:: map_connection_struct wEast ; sprite set for the current map (11 sprite picture ID's) wSpriteSet:: ds 11 - ; sprite set ID for the current map wSpriteSetID:: db @@ -2028,11 +1752,11 @@ wObjectDataPointerTemp:: dw ; the tile shown outside the boundaries of the map wMapBackgroundTile:: db -; number of warps in current map +; number of warps in current map (up to 32) wNumberOfWarps:: db ; current map warp entries -wWarpEntries:: ds 128 +wWarpEntries:: ds 32 * 4 ; Y, X, warp ID, map ID ; if $ff, the player's coordinates are not updated when entering the map wDestinationWarpID:: db @@ -2042,13 +1766,10 @@ wDestinationWarpID:: db ; number of signs in the current map (up to 16) wNumSigns:: db -; 2 bytes each -; Y, X -wSignCoords:: ds 32 - +wSignCoords:: ds 16 * 2 ; Y, X wSignTextIDs:: ds 16 -; number of sprites on the current map +; number of sprites on the current map (up to 16) wNumSprites:: db ; these two variables track the X and Y offset in blocks from the last special warp used @@ -2056,11 +1777,8 @@ wNumSprites:: db wYOffsetSinceLastSpecialWarp:: db wXOffsetSinceLastSpecialWarp:: db -; two bytes per sprite (movement byte 2, text ID) -wMapSpriteData:: ds 32 - -; two bytes per sprite (trainer class/item ID, trainer set ID) -wMapSpriteExtraData:: ds 32 +wMapSpriteData:: ds 16 * 2 ; movement byte 2, text ID +wMapSpriteExtraData:: ds 16 * 2 ; trainer class/item ID, trainer set ID ; map height in 2x2 meta-tiles wCurrentMapHeight2:: db @@ -2118,7 +1836,7 @@ wUnusedD5A3:: db wPlayerCoins:: ds 2 ; BCD ; bit array of missable objects. set = removed -wMissableObjectFlags:: ds 32 +wMissableObjectFlags:: flag_array $100 wMissableObjectFlagsEnd:: ds 7 @@ -2130,9 +1848,10 @@ wd5cd:: db ; * the sprite ID (depending on the current map) ; * the missable object index (global, used for wMissableObjectFlags) ; terminated with $FF -wMissableObjectList:: ds 17 * 2 +wMissableObjectList:: ds 16 * 2 + 1 + + ds 1 -; $c8 bytes wGameProgressFlags:: wOaksLabCurScript:: db wPalletTownCurScript:: db @@ -2252,9 +1971,9 @@ wGameProgressFlagsEnd:: ds 56 -wObtainedHiddenItemsFlags:: ds 14 +wObtainedHiddenItemsFlags:: flag_array 112 -wObtainedHiddenCoinsFlags:: dw +wObtainedHiddenCoinsFlags:: flag_array 16 ; $00 = walking ; $01 = biking @@ -2270,7 +1989,6 @@ wSafariSteps:: dw ; item given to cinnabar lab wFossilItem:: db - ; mon that will result from the item wFossilMon:: db @@ -2409,19 +2127,16 @@ wCompletedInGameTradeFlags:: dw ds 2 wWarpedFromWhichWarp:: db - wWarpedFromWhichMap:: db ds 2 wCardKeyDoorY:: db - wCardKeyDoorX:: db ds 2 wFirstLockTrashCanIndex:: db - wSecondLockTrashCanIndex:: db ds 2 @@ -2479,7 +2194,6 @@ wTrainerHeaderPtr:: dw ; the trainer the player must face after getting a wrong answer in the Cinnabar ; gym quiz wOpponentAfterWrongAnswer:: - wUnusedDA38:: db ; index of current map script, mostly used as index for function pointer array @@ -2513,7 +2227,7 @@ wMainDataEnd:: wBoxDataStart:: -wBoxCount:: ds 1 +wBoxCount:: db wBoxSpecies:: ds MONS_PER_BOX + 1 wBoxMons:: -- cgit v1.3.1-sl0p