From fc23e72a39eb9cb9ca0651ea805abb6f47ee458c Mon Sep 17 00:00:00 2001 From: Sylvie <35663410+Rangi42@users.noreply.github.com> Date: Sat, 15 Jun 2024 12:18:00 -0400 Subject: Identify some unused WRAM variables (#453) --- engine/battle/misc.asm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engine/battle/misc.asm') diff --git a/engine/battle/misc.asm b/engine/battle/misc.asm index 524ec161..4feef343 100644 --- a/engine/battle/misc.asm +++ b/engine/battle/misc.asm @@ -92,9 +92,9 @@ InitList: ld a, h ld [wListPointer + 1], a ld a, e - ld [wUnusedCF8D], a + ld [wUnusedNamePointer], a ld a, d - ld [wUnusedCF8D + 1], a + ld [wUnusedNamePointer + 1], a ld bc, ItemPrices ld a, c ld [wItemPrices], a -- cgit v1.3.1-sl0p From 6e3ab0a9e97ff14123ac65f56cb4b4ddab45b695 Mon Sep 17 00:00:00 2001 From: Sylvie <35663410+Rangi42@users.noreply.github.com> Date: Wed, 24 Jul 2024 12:21:59 -0400 Subject: Identify wcd6d as wNameBuffer and others (#455) --- data/text/text_1.asm | 2 +- data/text/text_2.asm | 46 ++++++++++++++++----------------- data/text/text_3.asm | 8 +++--- data/text/text_4.asm | 4 +-- data/text/text_5.asm | 10 +++---- data/text/text_6.asm | 8 +++--- data/text/text_7.asm | 6 ++--- engine/battle/core.asm | 10 +++---- engine/battle/get_trainer_name.asm | 4 +-- engine/battle/misc.asm | 8 +++--- engine/battle/move_effects/pay_day.asm | 6 ++--- engine/battle/save_trainer_name.asm | 2 +- engine/events/cinnabar_lab.asm | 2 +- engine/events/heal_party.asm | 4 +-- engine/events/in_game_trades.asm | 2 +- engine/items/item_effects.asm | 4 +-- engine/items/town_map.asm | 24 +++++++++-------- engine/link/cable_club.asm | 2 +- engine/menus/league_pc.asm | 2 +- engine/menus/naming_screen.asm | 2 +- engine/menus/party_menu.asm | 8 +++--- engine/movie/hall_of_fame.asm | 4 +-- engine/movie/oak_speech/oak_speech2.asm | 4 +-- engine/movie/trade.asm | 2 +- engine/movie/trade2.asm | 2 +- engine/pokemon/add_mon.asm | 4 +-- engine/pokemon/evos_moves.asm | 4 +-- engine/pokemon/learn_move.asm | 2 +- home/list_menu.asm | 2 +- home/names.asm | 19 +++++++------- home/names2.asm | 2 +- home/pokemon.asm | 4 +-- ram/wram.asm | 20 +++++++++++--- scripts/CeladonMartRoof.asm | 2 +- scripts/Route15Gate2F.asm | 2 +- scripts/Route23.asm | 2 +- scripts/Route2Gate.asm | 2 +- text/ChampionsRoom.asm | 2 +- text/CinnabarLabFossilRoom.asm | 4 +-- text/Daycare.asm | 6 ++--- text/NameRatersHouse.asm | 6 ++--- text/OaksLab.asm | 4 +-- text/Route23.asm | 8 +++--- 43 files changed, 142 insertions(+), 129 deletions(-) (limited to 'engine/battle/misc.asm') diff --git a/data/text/text_1.asm b/data/text/text_1.asm index 2acc6f68..538396eb 100644 --- a/data/text/text_1.asm +++ b/data/text/text_1.asm @@ -14,7 +14,7 @@ _CardKeyFailText:: done _TrainerNameText:: - text_ram wcd6d + text_ram wNameBuffer text ": @" text_end diff --git a/data/text/text_2.asm b/data/text/text_2.asm index d4b1b7db..4362e0f2 100644 --- a/data/text/text_2.asm +++ b/data/text/text_2.asm @@ -10,7 +10,7 @@ _AIBattleUseItemText:: text_ram wTrainerName text_start line "used @" - text_ram wcd6d + text_ram wNameBuffer text_start cont "on @" text_ram wEnemyMonNick @@ -36,7 +36,7 @@ _TradeSendsText:: text_ram wLinkEnemyTrainerName text " sends" line "@" - text_ram wcd6d + text_ram wNameBuffer text "." done @@ -47,7 +47,7 @@ _TradeWavesFarewellText:: done _TradeTransferredText:: - text_ram wcd6d + text_ram wNameBuffer text " is" line "transferred." done @@ -55,7 +55,7 @@ _TradeTransferredText:: _TradeTakeCareText:: text "Take good care of" line "@" - text_ram wcd6d + text_ram wNameBuffer text "." done @@ -63,7 +63,7 @@ _TradeWillTradeText:: text_ram wLinkEnemyTrainerName text " will" line "trade @" - text_ram wcd6d + text_ram wNameBuffer text_start done @@ -751,7 +751,7 @@ _VermilionGymTrashFailText:: _FoundHiddenItemText:: text " found" line "@" - text_ram wcd6d + text_ram wNameBuffer text "!@" text_end @@ -1070,7 +1070,7 @@ _CantMoveText:: _MoveIsDisabledText:: text "'s" line "@" - text_ram wcd6d + text_ram wNameBuffer text " is" cont "disabled!" prompt @@ -1205,7 +1205,7 @@ _HitXTimesText:: prompt _GainedText:: - text_ram wcd6d + text_ram wNameBuffer text " gained" line "@" text_end @@ -1226,7 +1226,7 @@ _ExpPointsText:: prompt _GrewLevelText:: - text_ram wcd6d + text_ram wNameBuffer text " grew" line "to level @" text_decimal wCurEnemyLevel, 1, 3 @@ -1382,7 +1382,7 @@ _PartyMenuSwapMonText:: done _PotionText:: - text_ram wcd6d + text_ram wNameBuffer text_start line "recovered by @" text_decimal wHPBarHPDifference, 2, 3 @@ -1390,49 +1390,49 @@ _PotionText:: done _AntidoteText:: - text_ram wcd6d + text_ram wNameBuffer text " was" line "cured of poison!" done _ParlyzHealText:: - text_ram wcd6d + text_ram wNameBuffer text "'s" line "rid of paralysis!" done _BurnHealText:: - text_ram wcd6d + text_ram wNameBuffer text "'s" line "burn was healed!" done _IceHealText:: - text_ram wcd6d + text_ram wNameBuffer text " was" line "defrosted!" done _AwakeningText:: - text_ram wcd6d + text_ram wNameBuffer text_start line "woke up!" done _FullHealText:: - text_ram wcd6d + text_ram wNameBuffer text "'s" line "health returned!" done _ReviveText:: - text_ram wcd6d + text_ram wNameBuffer text_start line "is revitalized!" done _RareCandyText:: - text_ram wcd6d + text_ram wNameBuffer text " grew" line "to level @" text_decimal wCurEnemyLevel, 1, 3 @@ -1487,7 +1487,7 @@ _DepositHowManyText:: done _ItemWasStoredText:: - text_ram wcd6d + text_ram wNameBuffer text " was" line "stored via PC." prompt @@ -1514,7 +1514,7 @@ _WithdrawHowManyText:: _WithdrewItemText:: text "Withdrew" line "@" - text_ram wcd6d + text_ram wNameBuffer text "." prompt @@ -1642,7 +1642,7 @@ _HereYouGoText:: _SoYouWantPrizeText:: text "So, you want" line "@" - text_ram wcd6d + text_ram wNameBuffer text "?" done @@ -1756,7 +1756,7 @@ _DoYouWantToNicknameText:: text "Do you want to" line "give a nickname" cont "to @" - text_ram wcd6d + text_ram wNameBuffer text "?" done @@ -1775,7 +1775,7 @@ _WillBeTradedText:: text_ram wNameOfPlayerMonToBeTraded text " and" line "@" - text_ram wcd6d + text_ram wNameBuffer text " will" cont "be traded." done diff --git a/data/text/text_3.asm b/data/text/text_3.asm index 1d40d6b7..ba09a0f6 100644 --- a/data/text/text_3.asm +++ b/data/text/text_3.asm @@ -40,7 +40,7 @@ _EvolvedText:: _IntoText:: text_start line "into @" - text_ram wcd6d + text_ram wNameBuffer text "!" done @@ -181,14 +181,14 @@ _MimicLearnedMoveText:: text "" line "learned" cont "@" - text_ram wcd6d + text_ram wNameBuffer text "!" prompt _MoveWasDisabledText:: text "'s" line "@" - text_ram wcd6d + text_ram wNameBuffer text " was" cont "disabled!" prompt @@ -291,7 +291,7 @@ _TransformedText:: text "" line "transformed into" cont "@" - text_ram wcd6d + text_ram wNameBuffer text "!" prompt diff --git a/data/text/text_4.asm b/data/text/text_4.asm index 39c7ab91..f1c73a88 100644 --- a/data/text/text_4.asm +++ b/data/text/text_4.asm @@ -4,7 +4,7 @@ _PokemartGreetingText:: done _PokemonFaintedText:: - text_ram wcd6d + text_ram wNameBuffer text_start line "fainted!" done @@ -145,7 +145,7 @@ _ForgotAndText:: text_ram wLearnMoveMonName text " forgot" line "@" - text_ram wcd6d + text_ram wNameBuffer text "!" para "And..." diff --git a/data/text/text_5.asm b/data/text/text_5.asm index fb0cac66..1eee599c 100644 --- a/data/text/text_5.asm +++ b/data/text/text_5.asm @@ -9,13 +9,13 @@ _CableClubNPCMakingPreparationsText:: done _UsedStrengthText:: - text_ram wcd6d + text_ram wNameBuffer text " used" line "STRENGTH.@" text_end _CanMoveBouldersText:: - text_ram wcd6d + text_ram wNameBuffer text " can" line "move boulders." prompt @@ -41,13 +41,13 @@ _WarpToLastPokemonCenterText:: done _CannotUseTeleportNowText:: - text_ram wcd6d + text_ram wNameBuffer text " can't" line "use TELEPORT now." prompt _CannotFlyHereText:: - text_ram wcd6d + text_ram wNameBuffer text " can't" line "FLY here." prompt @@ -75,7 +75,7 @@ _CannotGetOffHereText:: _GotMonText:: text " got" line "@" - text_ram wcd6d + text_ram wNameBuffer text "!@" text_end diff --git a/data/text/text_6.asm b/data/text/text_6.asm index 194afa7b..8109b659 100644 --- a/data/text/text_6.asm +++ b/data/text/text_6.asm @@ -59,7 +59,7 @@ _ItemUseBallText06:: _SurfingGotOnText:: text " got on" line "@" - text_ram wcd6d + text_ram wNameBuffer text "!" prompt @@ -69,7 +69,7 @@ _SurfingNoPlaceToGetOffText:: prompt _VitaminStatRoseText:: - text_ram wcd6d + text_ram wNameBuffer text "'s" line "@" text_ram wStringBuffer @@ -174,7 +174,7 @@ _TeachMachineMoveText:: done _MonCannotLearnMachineMoveText:: - text_ram wcd6d + text_ram wNameBuffer text " is not" line "compatible with" cont "@" @@ -220,7 +220,7 @@ _NoCyclingAllowedHereText:: _NoSurfingHereText:: text "No SURFing on" line "@" - text_ram wcd6d + text_ram wNameBuffer text " here!" prompt diff --git a/data/text/text_7.asm b/data/text/text_7.asm index fcb27d20..54629faf 100644 --- a/data/text/text_7.asm +++ b/data/text/text_7.asm @@ -29,7 +29,7 @@ _GotOffBicycleText2:: _ThrewAwayItemText:: text "Threw away" line "@" - text_ram wcd6d + text_ram wNameBuffer text "." prompt @@ -46,7 +46,7 @@ _TooImportantToTossText:: prompt _AlreadyKnowsText:: - text_ram wcd6d + text_ram wNameBuffer text " knows" line "@" text_ram wStringBuffer @@ -194,7 +194,7 @@ _NothingToCutText:: prompt _UsedCutText:: - text_ram wcd6d + text_ram wNameBuffer text " hacked" line "away with CUT!" prompt diff --git a/engine/battle/core.asm b/engine/battle/core.asm index ab4d1c56..ae399a01 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -2878,7 +2878,7 @@ PrintMenuItem: add hl, bc ld a, [hl] and $3f - ld [wcd6d], a + ld [wBattleMenuCurrentPP], a ; print TYPE/ and / hlcoord 1, 9 ld de, TypeText @@ -2888,7 +2888,7 @@ PrintMenuItem: hlcoord 5, 9 ld [hl], "/" hlcoord 5, 11 - ld de, wcd6d + ld de, wBattleMenuCurrentPP lb bc, 1, 2 call PrintNumber hlcoord 8, 11 @@ -5631,7 +5631,7 @@ EnemyCanExecuteChargingMove: ld a, MOVE_NAME ld [wNameListType], a call GetName - ld de, wcd6d + ld de, wNameBuffer call CopyToStringBuffer EnemyCanExecuteMove: xor a @@ -6111,7 +6111,7 @@ GetCurrentMove: ld a, MOVE_NAME ld [wNameListType], a call GetName - ld de, wcd6d + ld de, wNameBuffer jp CopyToStringBuffer LoadEnemyMonData: @@ -6247,7 +6247,7 @@ LoadEnemyMonData: ld a, [wEnemyMonSpecies2] ld [wd11e], a call GetMonName - ld hl, wcd6d + ld hl, wNameBuffer ld de, wEnemyMonNick ld bc, NAME_LENGTH call CopyData diff --git a/engine/battle/get_trainer_name.asm b/engine/battle/get_trainer_name.asm index b2daebfe..82be49e0 100644 --- a/engine/battle/get_trainer_name.asm +++ b/engine/battle/get_trainer_name.asm @@ -17,8 +17,8 @@ GetTrainerName_:: ld a, BANK(TrainerNames) ld [wPredefBank], a call GetName - ld hl, wcd6d + ld hl, wNameBuffer .foundName ld de, wTrainerName - ld bc, $d + ld bc, ITEM_NAME_LENGTH jp CopyData diff --git a/engine/battle/misc.asm b/engine/battle/misc.asm index 4feef343..fe784dd6 100644 --- a/engine/battle/misc.asm +++ b/engine/battle/misc.asm @@ -14,10 +14,10 @@ FormatMovesString: ld a, MOVE_NAME ld [wNameListType], a call GetName - ld hl, wcd6d + ld hl, wNameBuffer .copyNameLoop ld a, [hli] - cp $50 + cp "@" jr z, .doneCopyingName ld [de], a inc de @@ -26,7 +26,7 @@ FormatMovesString: ld a, b ld [wNumMovesMinusOne], a inc b - ld a, $4e ; line break + ld a, "" ld [de], a inc de pop hl @@ -42,7 +42,7 @@ FormatMovesString: ld a, b cp NUM_MOVES jr z, .done - ld a, $4e ; line break + ld a, "" ld [de], a inc de jr .printDashLoop diff --git a/engine/battle/move_effects/pay_day.asm b/engine/battle/move_effects/pay_day.asm index fa373038..9aab3feb 100644 --- a/engine/battle/move_effects/pay_day.asm +++ b/engine/battle/move_effects/pay_day.asm @@ -1,6 +1,6 @@ PayDayEffect_: xor a - ld hl, wcd6d + ld hl, wPayDayMoney ld [hli], a ldh a, [hWhoseTurn] and a @@ -21,7 +21,7 @@ PayDayEffect_: ld b, $4 call Divide ldh a, [hQuotient + 3] - ld [hli], a + ld [hli], a ; wPayDayMoney + 1 ldh a, [hRemainder] ldh [hDividend + 3], a ld a, 10 @@ -33,7 +33,7 @@ PayDayEffect_: ld b, a ldh a, [hRemainder] add b - ld [hl], a + ld [hl], a ; wPayDayMoney + 2 ld de, wTotalPayDayMoney + 2 ld c, $3 predef AddBCDPredef diff --git a/engine/battle/save_trainer_name.asm b/engine/battle/save_trainer_name.asm index 4d40fd82..b25d5a11 100644 --- a/engine/battle/save_trainer_name.asm +++ b/engine/battle/save_trainer_name.asm @@ -9,7 +9,7 @@ SaveTrainerName:: ld a, [hli] ld h, [hl] ld l, a - ld de, wcd6d + ld de, wNameBuffer .CopyCharacter ld a, [hli] ld [de], a diff --git a/engine/events/cinnabar_lab.asm b/engine/events/cinnabar_lab.asm index eb82a5b1..171fa99a 100644 --- a/engine/events/cinnabar_lab.asm +++ b/engine/events/cinnabar_lab.asm @@ -104,7 +104,7 @@ PrintFossilsInBag: ldh a, [hItemCounter] ld bc, SCREEN_WIDTH * 2 call AddNTimes - ld de, wcd6d + ld de, wNameBuffer call PlaceString ld hl, hItemCounter inc [hl] diff --git a/engine/events/heal_party.asm b/engine/events/heal_party.asm index b26bc90f..0c6ec1ea 100644 --- a/engine/events/heal_party.asm +++ b/engine/events/heal_party.asm @@ -37,10 +37,10 @@ HealParty: ld hl, Moves ld bc, MOVE_LENGTH call AddNTimes - ld de, wcd6d + ld de, wMoveData ld a, BANK(Moves) call FarCopyData - ld a, [wcd6d + 5] ; PP is byte 5 of move data + ld a, [wMoveData + MOVE_PP] pop bc pop de diff --git a/engine/events/in_game_trades.asm b/engine/events/in_game_trades.asm index 54588e7d..c62225ba 100644 --- a/engine/events/in_game_trades.asm +++ b/engine/events/in_game_trades.asm @@ -79,7 +79,7 @@ InGameTrade_GetMonName: push de ld [wd11e], a call GetMonName - ld hl, wcd6d + ld hl, wNameBuffer pop de ld bc, NAME_LENGTH jp CopyData diff --git a/engine/items/item_effects.asm b/engine/items/item_effects.asm index e771504d..0c339451 100644 --- a/engine/items/item_effects.asm +++ b/engine/items/item_effects.asm @@ -2493,10 +2493,10 @@ GetMaxPP: ld hl, Moves ld bc, MOVE_LENGTH call AddNTimes - ld de, wcd6d + ld de, wMoveData ld a, BANK(Moves) call FarCopyData - ld de, wcd6d + 5 ; PP is byte 5 of move data + ld de, wMoveData + MOVE_PP ld a, [de] ld b, a ; b = normal max PP pop hl diff --git a/engine/items/town_map.asm b/engine/items/town_map.asm index ccbe0225..a9840268 100644 --- a/engine/items/town_map.asm +++ b/engine/items/town_map.asm @@ -1,5 +1,7 @@ DEF NOT_VISITED EQU $fe +DEF BIRD_BASE_TILE EQU $04 + DisplayTownMap: call LoadTownMap ld hl, wUpdateSpritesEnabled @@ -12,15 +14,15 @@ DisplayTownMap: ld a, [wCurMap] push af ld b, $0 - call DrawPlayerOrBirdSprite ; player sprite + call DrawPlayerOrBirdSprite hlcoord 1, 0 - ld de, wcd6d + ld de, wNameBuffer call PlaceString ld hl, wShadowOAM ld de, wTileMapBackup ld bc, $10 call CopyData - ld hl, vSprites tile $04 + ld hl, vSprites tile BIRD_BASE_TILE ld de, TownMapCursor lb bc, BANK(TownMapCursor), (TownMapCursorEnd - TownMapCursor) / $8 call CopyVideoDataDouble @@ -50,15 +52,15 @@ DisplayTownMap: ld hl, wShadowOAMSprite04 call WriteTownMapSpriteOAM ; town map cursor sprite pop hl - ld de, wcd6d + ld de, wNameBuffer .copyMapName ld a, [hli] ld [de], a inc de - cp $50 + cp "@" jr nz, .copyMapName hlcoord 1, 0 - ld de, wcd6d + ld de, wNameBuffer call PlaceString ld hl, wShadowOAMSprite04 ld de, wTileMapBackup + 16 @@ -142,7 +144,7 @@ LoadTownMap_Fly:: call LoadPlayerSpriteGraphics call LoadFontTilePatterns ld de, BirdSprite - ld hl, vSprites tile $04 + ld hl, vSprites tile BIRD_BASE_TILE lb bc, BANK(BirdSprite), 12 call CopyVideoData ld de, TownMapUpArrow @@ -173,10 +175,10 @@ LoadTownMap_Fly:: call ClearScreenArea pop hl ld a, [hl] - ld b, $4 - call DrawPlayerOrBirdSprite ; draw bird sprite + ld b, BIRD_BASE_TILE + call DrawPlayerOrBirdSprite hlcoord 3, 0 - ld de, wcd6d + ld de, wNameBuffer call PlaceString ld c, 15 call DelayFrames @@ -356,7 +358,7 @@ DrawPlayerOrBirdSprite: call TownMapCoordsToOAMCoords call WritePlayerOrBirdSpriteOAM pop hl - ld de, wcd6d + ld de, wNameBuffer .loop ld a, [hli] ld [de], a diff --git a/engine/link/cable_club.asm b/engine/link/cable_club.asm index e5796e53..9dd66de5 100644 --- a/engine/link/cable_club.asm +++ b/engine/link/cable_club.asm @@ -699,7 +699,7 @@ TradeCenter_Trade: ld a, [hl] ld [wd11e], a call GetMonName - ld hl, wcd6d + ld hl, wNameBuffer ld de, wNameOfPlayerMonToBeTraded ld bc, NAME_LENGTH call CopyData diff --git a/engine/menus/league_pc.asm b/engine/menus/league_pc.asm index 08ff22e4..27bccbb5 100644 --- a/engine/menus/league_pc.asm +++ b/engine/menus/league_pc.asm @@ -89,7 +89,7 @@ LeaguePCShowMon: ld [wWholeScreenPaletteMonSpecies], a ld a, [hli] ld [wHoFMonLevel], a - ld de, wcd6d + ld de, wNameBuffer ld bc, NAME_LENGTH call CopyData ld b, SET_PAL_POKEMON_WHOLE_SCREEN diff --git a/engine/menus/naming_screen.asm b/engine/menus/naming_screen.asm index f5120518..85447300 100644 --- a/engine/menus/naming_screen.asm +++ b/engine/menus/naming_screen.asm @@ -45,7 +45,7 @@ AskName: .declinedNickname ld d, h ld e, l - ld hl, wcd6d + ld hl, wNameBuffer ld bc, NAME_LENGTH jp CopyData diff --git a/engine/menus/party_menu.asm b/engine/menus/party_menu.asm index 50a9838c..6c8cd6eb 100644 --- a/engine/menus/party_menu.asm +++ b/engine/menus/party_menu.asm @@ -121,19 +121,19 @@ RedrawPartyMenu_:: rl b ld c, a add hl, bc - ld de, wcd6d + ld de, wEvoDataBuffer ld a, BANK(EvosMovesPointerTable) ld bc, 2 call FarCopyData - ld hl, wcd6d + ld hl, wEvoDataBuffer ld a, [hli] ld h, [hl] ld l, a - ld de, wcd6d + ld de, wEvoDataBuffer ld a, BANK(EvosMovesPointerTable) ld bc, 4 * 3 + 1 ; enough for Eevee's three 4-byte evolutions and 0 terminator call FarCopyData - ld hl, wcd6d + ld hl, wEvoDataBuffer ld de, .notAbleToEvolveText ; loop through the pokemon's evolution entries .checkEvolutionsLoop diff --git a/engine/movie/hall_of_fame.asm b/engine/movie/hall_of_fame.asm index d37d95f8..6dd9aab1 100644 --- a/engine/movie/hall_of_fame.asm +++ b/engine/movie/hall_of_fame.asm @@ -165,7 +165,7 @@ HoFDisplayMonInfo: ld de, HoFMonInfoText call PlaceString hlcoord 1, 4 - ld de, wcd6d + ld de, wNameBuffer call PlaceString ld a, [wHoFMonLevel] hlcoord 8, 7 @@ -275,7 +275,7 @@ HoFRecordMonInfo: ld [hli], a ld e, l ld d, h - ld hl, wcd6d + ld hl, wNameBuffer ld bc, NAME_LENGTH jp CopyData diff --git a/engine/movie/oak_speech/oak_speech2.asm b/engine/movie/oak_speech/oak_speech2.asm index 95ebcabe..40c75f62 100644 --- a/engine/movie/oak_speech/oak_speech2.asm +++ b/engine/movie/oak_speech/oak_speech2.asm @@ -72,7 +72,7 @@ OakSpeechSlidePicLeft: ld c, 10 call DelayFrames pop de - ld hl, wcd6d + ld hl, wNameBuffer ld bc, NAME_LENGTH call CopyData call Delay3 @@ -209,7 +209,7 @@ GetDefaultName: .foundName ld h, d ld l, e - ld de, wcd6d + ld de, wNameBuffer ld bc, NAME_BUFFER_LENGTH jp CopyData diff --git a/engine/movie/trade.asm b/engine/movie/trade.asm index 9d168cc7..931538c0 100644 --- a/engine/movie/trade.asm +++ b/engine/movie/trade.asm @@ -188,7 +188,7 @@ LoadTradingGFXAndMonNames: ld a, [wTradedPlayerMonSpecies] ld [wd11e], a call GetMonName - ld hl, wcd6d + ld hl, wNameBuffer ld de, wStringBuffer ld bc, NAME_LENGTH call CopyData diff --git a/engine/movie/trade2.asm b/engine/movie/trade2.asm index 98d1158e..a564862b 100644 --- a/engine/movie/trade2.asm +++ b/engine/movie/trade2.asm @@ -32,7 +32,7 @@ Trade_PrintEnemyMonInfoText: lb bc, LEADING_ZEROES | 1, 3 call PrintNumber hlcoord 5, 12 - ld de, wcd6d + ld de, wNameBuffer call PlaceString hlcoord 8, 14 ld de, wTradedEnemyMonOT diff --git a/engine/pokemon/add_mon.asm b/engine/pokemon/add_mon.asm index 0b7fb96c..73ba8071 100644 --- a/engine/pokemon/add_mon.asm +++ b/engine/pokemon/add_mon.asm @@ -261,13 +261,13 @@ AddPartyMon_WriteMovePP: ld hl, Moves ld bc, MOVE_LENGTH call AddNTimes - ld de, wcd6d + ld de, wMoveData ld a, BANK(Moves) call FarCopyData pop bc pop de pop hl - ld a, [wcd6d + 5] ; PP is byte 5 of move data + ld a, [wMoveData + MOVE_PP] .empty inc de ld [de], a diff --git a/engine/pokemon/evos_moves.asm b/engine/pokemon/evos_moves.asm index fa6930c1..1c7c328c 100644 --- a/engine/pokemon/evos_moves.asm +++ b/engine/pokemon/evos_moves.asm @@ -267,7 +267,7 @@ RenameEvolvedMon: call GetName pop af ld [wd0b5], a - ld hl, wcd6d + ld hl, wNameBuffer ld de, wStringBuffer .compareNamesLoop ld a, [de] @@ -283,7 +283,7 @@ RenameEvolvedMon: call AddNTimes push hl call GetName - ld hl, wcd6d + ld hl, wNameBuffer pop de jp CopyData diff --git a/engine/pokemon/learn_move.asm b/engine/pokemon/learn_move.asm index 0377caa4..981fe13a 100644 --- a/engine/pokemon/learn_move.asm +++ b/engine/pokemon/learn_move.asm @@ -3,7 +3,7 @@ LearnMove: ld a, [wWhichPokemon] ld hl, wPartyMonNicks call GetPartyMonName - ld hl, wcd6d + ld hl, wNameBuffer ld de, wLearnMoveMonName ld bc, NAME_LENGTH call CopyData diff --git a/home/list_menu.asm b/home/list_menu.asm index 1629b188..3d864222 100644 --- a/home/list_menu.asm +++ b/home/list_menu.asm @@ -156,7 +156,7 @@ DisplayListMenuIDLoop:: ld a, [wWhichPokemon] call GetPartyMonName .storeChosenEntry ; store the menu entry that the player chose and return - ld de, wcd6d + ld de, wNameBuffer call CopyToStringBuffer ld a, CHOSE_MENU_ITEM ld [wMenuExitMethod], a diff --git a/home/names.asm b/home/names.asm index f7751fa0..2e5e1501 100644 --- a/home/names.asm +++ b/home/names.asm @@ -8,14 +8,14 @@ GetMonName:: ld a, [wd11e] dec a ld hl, MonsterNames - ld c, 10 + ld c, NAME_LENGTH - 1 ld b, 0 call AddNTimes - ld de, wcd6d + ld de, wNameBuffer push de - ld bc, 10 + ld bc, NAME_LENGTH - 1 call CopyData - ld hl, wcd6d + 10 + ld hl, wNameBuffer + NAME_LENGTH - 1 ld [hl], "@" pop de pop af @@ -25,8 +25,7 @@ GetMonName:: ret GetItemName:: -; given an item ID at [wd11e], store the name of the item into a string -; starting at wcd6d +; given an item ID at [wd11e], store the name of the item in wNameBuffer push hl push bc ld a, [wd11e] @@ -44,13 +43,13 @@ GetItemName:: .Machine call GetMachineName .Finish - ld de, wcd6d ; pointer to where item name is stored in RAM + ld de, wNameBuffer pop bc pop hl ret GetMachineName:: -; copies the name of the TM/HM in [wd11e] to wcd6d +; copies the name of the TM/HM in [wd11e] to wNameBuffer push hl push de push bc @@ -69,7 +68,7 @@ GetMachineName:: ld hl, TechnicalPrefix ; points to "TM" ld bc, 2 .WriteMachinePrefix - ld de, wcd6d + ld de, wNameBuffer call CopyData ; now get the machine number and convert it to text @@ -136,6 +135,6 @@ GetMoveName:: ld a, BANK(MoveNames) ld [wPredefBank], a call GetName - ld de, wcd6d ; pointer to where move name is stored in RAM + ld de, wNameBuffer pop hl ret diff --git a/home/names2.asm b/home/names2.asm index c27739d7..cd3823fd 100644 --- a/home/names2.asm +++ b/home/names2.asm @@ -83,7 +83,7 @@ GetName:: jr nz, .nextName ld h, d ld l, e - ld de, wcd6d + ld de, wNameBuffer ld bc, NAME_BUFFER_LENGTH call CopyData .gotPtr diff --git a/home/pokemon.asm b/home/pokemon.asm index 131fbd85..b228f086 100644 --- a/home/pokemon.asm +++ b/home/pokemon.asm @@ -435,7 +435,7 @@ GetMonHeader:: ld [MBC1RomBank], a ret -; copy party pokemon's name to wcd6d +; copy party pokemon's name to wNameBuffer GetPartyMonName2:: ld a, [wWhichPokemon] ; index within party ld hl, wPartyMonNicks @@ -445,7 +445,7 @@ GetPartyMonName:: push hl push bc call SkipFixedLengthTextEntries ; add NAME_LENGTH to hl, a times - ld de, wcd6d + ld de, wNameBuffer push de ld bc, NAME_LENGTH call CopyData diff --git a/ram/wram.asm b/ram/wram.asm index 4ff730dd..3bdf5a7b 100644 --- a/ram/wram.asm +++ b/ram/wram.asm @@ -876,16 +876,28 @@ wDownscaledMonSize:: wNumMovesMinusOne:: db UNION -wcd6d:: ds NAME_BUFFER_LENGTH ; buffer for various data +; storage buffer for various name strings +wNameBuffer:: ds NAME_BUFFER_LENGTH NEXTU - ds 4 -; temp variable used to print a move's current PP on the status screen +; data copied from Moves for one move +wMoveData:: ds MOVE_LENGTH + +NEXTU +; amount of money made from one use of Pay Day +wPayDayMoney:: ds 3 + +NEXTU +; evolution data for one mon +wEvoDataBuffer:: ds 4 * 3 + 1 ; enough for Eevee's three 4-byte evolutions and 0 terminator + +NEXTU +wBattleMenuCurrentPP:: db + ds 3 wStatusScreenCurrentPP:: db ds 6 ; list of normal max PP (without PP up) values wNormalMaxPPList:: ds NUM_MOVES - ds 5 ENDU UNION diff --git a/scripts/CeladonMartRoof.asm b/scripts/CeladonMartRoof.asm index 73c12805..b5960c81 100644 --- a/scripts/CeladonMartRoof.asm +++ b/scripts/CeladonMartRoof.asm @@ -198,7 +198,7 @@ CeladonMartRoofScript_PrintDrinksInBag: ldh a, [hItemCounter] ld bc, SCREEN_WIDTH * 2 call AddNTimes - ld de, wcd6d + ld de, wNameBuffer call PlaceString ld hl, hItemCounter inc [hl] diff --git a/scripts/Route15Gate2F.asm b/scripts/Route15Gate2F.asm index 0e04367b..ad1434dc 100644 --- a/scripts/Route15Gate2F.asm +++ b/scripts/Route15Gate2F.asm @@ -16,7 +16,7 @@ Route15Gate2FOaksAideText: ldh [hOaksAideRewardItem], a ld [wd11e], a call GetItemName - ld hl, wcd6d + ld hl, wNameBuffer ld de, wOaksAideRewardItemName ld bc, ITEM_NAME_LENGTH call CopyData diff --git a/scripts/Route23.asm b/scripts/Route23.asm index 044d5e50..da0acfea 100644 --- a/scripts/Route23.asm +++ b/scripts/Route23.asm @@ -81,7 +81,7 @@ Route23CopyBadgeTextScript: ld a, [hli] ld h, [hl] ld l, a - ld de, wcd6d + ld de, wNameBuffer .copyTextLoop ld a, [hli] ld [de], a diff --git a/scripts/Route2Gate.asm b/scripts/Route2Gate.asm index a198dbd7..8522a149 100644 --- a/scripts/Route2Gate.asm +++ b/scripts/Route2Gate.asm @@ -16,7 +16,7 @@ Route2GateOaksAideText: ldh [hOaksAideRewardItem], a ld [wd11e], a call GetItemName - ld hl, wcd6d + ld hl, wNameBuffer ld de, wOaksAideRewardItemName ld bc, ITEM_NAME_LENGTH call CopyData diff --git a/text/ChampionsRoom.asm b/text/ChampionsRoom.asm index 92f23f69..9e62e5de 100644 --- a/text/ChampionsRoom.asm +++ b/text/ChampionsRoom.asm @@ -96,7 +96,7 @@ _ChampionsRoomOakCongratulatesPlayerText:: line "much since you" cont "first left with" cont "@" - text_ram wcd6d + text_ram wNameBuffer text "!" para ", you have" diff --git a/text/CinnabarLabFossilRoom.asm b/text/CinnabarLabFossilRoom.asm index 6701bbd0..be0bc947 100644 --- a/text/CinnabarLabFossilRoom.asm +++ b/text/CinnabarLabFossilRoom.asm @@ -38,7 +38,7 @@ _CinnabarLabFossilRoomScientist1FossilIsBackToLifeText:: _CinnabarLabFossilRoomScientist1SeesFossilText:: text "Oh! That is" line "@" - text_ram wcd6d + text_ram wNameBuffer text "!" para "It is fossil of" @@ -60,7 +60,7 @@ _CinnabarLabFossilRoomScientist1TakesFossilText:: para " handed" line "over @" - text_ram wcd6d + text_ram wNameBuffer text "!" prompt diff --git a/text/Daycare.asm b/text/Daycare.asm index 87cde965..be9b8eab 100644 --- a/text/Daycare.asm +++ b/text/Daycare.asm @@ -13,7 +13,7 @@ _DaycareGentlemanWhichMonText:: _DaycareGentlemanWillLookAfterMonText:: text "Fine, I'll look" line "after @" - text_ram wcd6d + text_ram wNameBuffer text_start cont "for a while." prompt @@ -25,7 +25,7 @@ _DaycareGentlemanComeSeeMeInAWhileText:: _DaycareGentlemanMonHasGrownText:: text "Your @" - text_ram wcd6d + text_ram wNameBuffer text_start line "has grown a lot!" @@ -55,7 +55,7 @@ _DaycareGentlemanGotMonBackText:: _DaycareGentlemanMonNeedsMoreTimeText:: text "Back already?" line "Your @" - text_ram wcd6d + text_ram wNameBuffer text_start cont "needs some more" cont "time with me." diff --git a/text/NameRatersHouse.asm b/text/NameRatersHouse.asm index 106a2cf0..3d2d5eaa 100644 --- a/text/NameRatersHouse.asm +++ b/text/NameRatersHouse.asm @@ -14,7 +14,7 @@ _NameRatersHouseNameRaterWhichPokemonText:: prompt _NameRatersHouseNameRaterGiveItANiceNameText:: - text_ram wcd6d + text_ram wNameBuffer text ", is it?" line "That is a decent" cont "nickname!" @@ -48,13 +48,13 @@ _NameRatersHouseNameRaterComeAnyTimeYouLikeText:: done _NameRatersHouseNameRaterATrulyImpeccableNameText:: - text_ram wcd6d + text_ram wNameBuffer text ", is it?" line "That is a truly" cont "impeccable name!" para "Take good care of" line "@" - text_ram wcd6d + text_ram wNameBuffer text "!" done diff --git a/text/OaksLab.asm b/text/OaksLab.asm index 11accbd4..e839149e 100644 --- a/text/OaksLab.asm +++ b/text/OaksLab.asm @@ -51,7 +51,7 @@ _OaksLabMonEnergeticText:: _OaksLabReceivedMonText:: text " received" line "a @" - text_ram wcd6d + text_ram wNameBuffer text "!@" text_end @@ -243,7 +243,7 @@ _OaksLabRivalIllTakeThisOneText:: _OaksLabRivalReceivedMonText:: text " received" line "a @" - text_ram wcd6d + text_ram wNameBuffer text "!@" text_end diff --git a/text/Route23.asm b/text/Route23.asm index 921b6407..cdccbf93 100644 --- a/text/Route23.asm +++ b/text/Route23.asm @@ -2,12 +2,12 @@ _Route23YouDontHaveTheBadgeYetText:: text "You can pass here" line "only if you have" cont "the @" - text_ram wcd6d + text_ram wNameBuffer text "!" para "You don't have the" line "@" - text_ram wcd6d + text_ram wNameBuffer text " yet!" para "You have to have" @@ -19,12 +19,12 @@ _Route23OhThatIsTheBadgeText:: text "You can pass here" line "only if you have" cont "the @" - text_ram wcd6d + text_ram wNameBuffer text "!" para "Oh! That is the" line "@" - text_ram wcd6d + text_ram wNameBuffer text "!@" text_end -- cgit v1.3.1-sl0p From 77d051479bd0ed96cc2efdba52f837afd1e119c3 Mon Sep 17 00:00:00 2001 From: Sylvie <35663410+Rangi42@users.noreply.github.com> Date: Sun, 4 Aug 2024 10:05:33 -0400 Subject: Identify wcf91 as wCurPartySpecies, wCurItem, and wCurListMenuItem (#457) --- engine/battle/animations.asm | 6 +- engine/battle/common_text.asm | 2 +- engine/battle/core.asm | 30 +++---- engine/battle/misc.asm | 2 +- engine/battle/read_trainer_party.asm | 4 +- engine/battle/wild_encounters.asm | 2 +- engine/debug/debug_menu.asm | 2 +- engine/debug/debug_party.asm | 4 +- engine/events/give_pokemon.asm | 4 +- engine/events/hidden_objects/museum_fossils.asm | 7 +- .../events/hidden_objects/route_15_binoculars.asm | 2 +- engine/events/in_game_trades.asm | 4 +- engine/events/pokemart.asm | 4 +- engine/events/prize_menu.asm | 4 +- engine/gfx/mon_icons.asm | 4 +- engine/gfx/palettes.asm | 4 +- engine/items/inventory.asm | 6 +- engine/items/item_effects.asm | 92 +++++++++++----------- engine/items/tm_prices.asm | 4 +- engine/items/tms.asm | 4 +- engine/link/cable_club.asm | 2 +- engine/menus/league_pc.asm | 2 +- engine/menus/naming_screen.asm | 4 +- engine/menus/players_pc.asm | 2 +- engine/menus/pokedex.asm | 8 +- engine/menus/start_sub_menus.asm | 18 ++--- engine/movie/credits.asm | 2 +- engine/movie/evolution.asm | 8 +- engine/movie/hall_of_fame.asm | 2 +- engine/movie/oak_speech/oak_speech.asm | 4 +- engine/movie/title.asm | 2 +- engine/movie/trade.asm | 2 +- engine/overworld/field_move_messages.asm | 2 +- engine/pokemon/add_mon.asm | 14 ++-- engine/pokemon/bills_pc.asm | 6 +- engine/pokemon/evos_moves.asm | 12 +-- engine/pokemon/load_mon_data.asm | 6 +- engine/pokemon/status_screen.asm | 6 +- home/give.asm | 4 +- home/inventory.asm | 2 +- home/item.asm | 6 +- home/item_price.asm | 4 +- home/list_menu.asm | 14 ++-- home/pics.asm | 2 +- home/pokemon.asm | 8 +- ram/wram.asm | 5 +- scripts/CeruleanBadgeHouse.asm | 2 +- scripts/Daycare.asm | 6 +- scripts/FightingDojo.asm | 4 +- scripts/OaksLab.asm | 8 +- 50 files changed, 181 insertions(+), 177 deletions(-) (limited to 'engine/battle/misc.asm') diff --git a/engine/battle/animations.asm b/engine/battle/animations.asm index 41d6a2ef..31851a91 100644 --- a/engine/battle/animations.asm +++ b/engine/battle/animations.asm @@ -683,7 +683,7 @@ DoSpecialEffectByAnimationId: INCLUDE "data/battle_anims/special_effects.asm" DoBallTossSpecialEffects: - ld a, [wcf91] + ld a, [wCurItem] cp ULTRA_BALL + 1 ; is it a Master Ball or Ultra Ball? jr nc, .skipFlashingEffect .flashingEffect ; do a flashing effect if it's Master Ball or Ultra Ball @@ -2031,7 +2031,7 @@ ChangeMonPic: and a jr z, .playerTurn ld a, [wChangeMonPicEnemyTurnSpecies] - ld [wcf91], a + ld [wCurPartySpecies], a ld [wd0b5], a xor a ld [wSpriteFlipped], a @@ -2599,7 +2599,7 @@ TossBallAnimation: ld hl, .PokeBallAnimations ; choose which toss animation to use - ld a, [wcf91] + ld a, [wCurItem] cp POKE_BALL ld b, TOSS_ANIM jr z, .done diff --git a/engine/battle/common_text.asm b/engine/battle/common_text.asm index 0e270424..810d3fb9 100644 --- a/engine/battle/common_text.asm +++ b/engine/battle/common_text.asm @@ -32,7 +32,7 @@ PrintBeginningBattleText: ld b, SILPH_SCOPE call IsItemInBag ld a, [wEnemyMonSpecies2] - ld [wcf91], a + ld [wCurPartySpecies], a cp RESTLESS_SOUL jr z, .isMarowak ld a, b diff --git a/engine/battle/core.asm b/engine/battle/core.asm index ae399a01..01faa890 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -229,7 +229,7 @@ StartBattle: ld b, 0 add hl, bc ld a, [hl] ; species - ld [wcf91], a + ld [wCurPartySpecies], a ld [wBattleMonSpecies2], a call LoadScreenTilesFromBuffer1 hlcoord 1, 5 @@ -1353,7 +1353,7 @@ EnemySendOutFirstMon: add hl, bc ld a, [hl] ld [wEnemyMonSpecies2], a - ld [wcf91], a + ld [wCurPartySpecies], a call LoadEnemyMonData ld hl, wEnemyMonHP ld a, [hli] @@ -1420,7 +1420,7 @@ EnemySendOutFirstMon: ld hl, TrainerSentOutText call PrintText ld a, [wEnemyMonSpecies2] - ld [wcf91], a + ld [wCurPartySpecies], a ld [wd0b5], a call GetMonHeader ld de, vFrontPic @@ -1759,7 +1759,7 @@ SendOutMon: call PlayMoveAnimation hlcoord 4, 11 predef AnimateSendingOutMon - ld a, [wcf91] + ld a, [wCurPartySpecies] call PlayCry call PrintEmptyString jp SaveScreenTilesToBuffer1 @@ -1841,7 +1841,7 @@ DrawPlayerHUDAndHPBar: call PrintLevel .doNotPrintLevel ld a, [wLoadedMonSpecies] - ld [wcf91], a + ld [wCurPartySpecies], a hlcoord 10, 9 predef DrawHP ld a, $1 @@ -2159,7 +2159,7 @@ DisplayBattleMenu:: jp LoadScreenTilesFromBuffer1 ; restore saved screen and return .throwSafariBallWasSelected ld a, SAFARI_BALL - ld [wcf91], a + ld [wCurItem], a jr UseBagItem .upperLeftMenuItemWasNotSelected ; a menu item other than the upper left item was selected @@ -2184,7 +2184,7 @@ DisplayBattleMenu:: ; bait was selected ld a, SAFARI_BAIT - ld [wcf91], a + ld [wCurItem], a jr UseBagItem BagWasSelected: @@ -2236,7 +2236,7 @@ DisplayBagMenu: UseBagItem: ; either use an item from the bag or use a safari zone item - ld a, [wcf91] + ld a, [wCurItem] ld [wd11e], a call GetItemName call CopyToStringBuffer @@ -2305,7 +2305,7 @@ PartyMenuOrRockOrRun: jr nz, .partyMenuWasSelected ; safari battle ld a, SAFARI_ROCK - ld [wcf91], a + ld [wCurItem], a jp UseBagItem .partyMenuWasSelected call LoadScreenTilesFromBuffer1 @@ -2379,7 +2379,7 @@ PartyMenuOrRockOrRun: jr nz, .doEnemyMonAnimation ; enemy mon is not minimised ld a, [wEnemyMonSpecies] - ld [wcf91], a + ld [wCurPartySpecies], a ld [wd0b5], a call GetMonHeader ld de, vFrontPic @@ -6771,7 +6771,7 @@ InitBattle:: InitOpponent: ld a, [wCurOpponent] - ld [wcf91], a + ld [wCurPartySpecies], a ld [wEnemyMonSpecies2], a jr InitBattleCommon @@ -6847,14 +6847,14 @@ InitWildBattle: ld a, "T" ld [hli], a ld [hl], "@" - ld a, [wcf91] + ld a, [wCurPartySpecies] push af ld a, MON_GHOST - ld [wcf91], a + ld [wCurPartySpecies], a ld de, vFrontPic call LoadMonFrontSprite ; load ghost sprite pop af - ld [wcf91], a + ld [wCurPartySpecies], a jr .spriteLoaded .isNoGhost ld de, vFrontPic @@ -7030,7 +7030,7 @@ LoadMonBackPic: ; Assumes the monster's attributes have ; been loaded with GetMonHeader. ld a, [wBattleMonSpecies2] - ld [wcf91], a + ld [wCurPartySpecies], a hlcoord 1, 5 ld b, 7 ld c, 8 diff --git a/engine/battle/misc.asm b/engine/battle/misc.asm index fe784dd6..1fa84e15 100644 --- a/engine/battle/misc.asm +++ b/engine/battle/misc.asm @@ -118,5 +118,5 @@ GetMonSpecies: ld d, 0 add hl, de ld a, [hl] - ld [wcf91], a + ld [wCurPartySpecies], a ret diff --git a/engine/battle/read_trainer_party.asm b/engine/battle/read_trainer_party.asm index a88b0dfc..dda440f8 100644 --- a/engine/battle/read_trainer_party.asm +++ b/engine/battle/read_trainer_party.asm @@ -54,7 +54,7 @@ ReadTrainer: ld a, [hli] and a ; have we reached the end of the trainer data? jr z, .FinishUp - ld [wcf91], a ; write species somewhere (XXX why?) + ld [wCurPartySpecies], a ld a, ENEMY_PARTY_DATA ld [wMonDataLocation], a push hl @@ -71,7 +71,7 @@ ReadTrainer: jr z, .AddLoneMove ld [wCurEnemyLevel], a ld a, [hli] - ld [wcf91], a + ld [wCurPartySpecies], a ld a, ENEMY_PARTY_DATA ld [wMonDataLocation], a push hl diff --git a/engine/battle/wild_encounters.asm b/engine/battle/wild_encounters.asm index eede46ed..ea451bcf 100644 --- a/engine/battle/wild_encounters.asm +++ b/engine/battle/wild_encounters.asm @@ -76,7 +76,7 @@ TryDoWildEncounter: ld a, [hli] ld [wCurEnemyLevel], a ld a, [hl] - ld [wcf91], a + ld [wCurPartySpecies], a ld [wEnemyMonSpecies2], a ld a, [wRepelRemainingSteps] and a diff --git a/engine/debug/debug_menu.asm b/engine/debug/debug_menu.asm index 06c2ace1..61c11c26 100644 --- a/engine/debug/debug_menu.asm +++ b/engine/debug/debug_menu.asm @@ -98,7 +98,7 @@ TestBattle: ; unreferenced except in _DEBUG ; Give the player a level 20 Rhydon. ld a, RHYDON - ld [wcf91], a + ld [wCurPartySpecies], a ld a, 20 ld [wCurEnemyLevel], a xor a diff --git a/engine/debug/debug_party.asm b/engine/debug/debug_party.asm index 17d0f793..c16fe97b 100644 --- a/engine/debug/debug_party.asm +++ b/engine/debug/debug_party.asm @@ -4,7 +4,7 @@ SetDebugNewGameParty: ; unreferenced except in _DEBUG ld a, [de] cp -1 ret z - ld [wcf91], a + ld [wCurPartySpecies], a inc de ld a, [de] ld [wCurEnemyLevel], a @@ -97,7 +97,7 @@ IF DEF(_DEBUG) ld a, [de] cp -1 jr z, .items_end - ld [wcf91], a + ld [wCurItem], a inc de ld a, [de] inc de diff --git a/engine/events/give_pokemon.asm b/engine/events/give_pokemon.asm index f2374e1e..9472f49f 100644 --- a/engine/events/give_pokemon.asm +++ b/engine/events/give_pokemon.asm @@ -13,7 +13,7 @@ _GivePokemon:: ; add to box xor a ld [wEnemyBattleStatus3], a - ld a, [wcf91] + ld a, [wCurPartySpecies] ld [wEnemyMonSpecies2], a callfar LoadEnemyMonData call SetPokedexOwnedFlag @@ -52,7 +52,7 @@ _GivePokemon:: ret SetPokedexOwnedFlag: - ld a, [wcf91] + ld a, [wCurPartySpecies] push af ld [wd11e], a predef IndexToPokedex diff --git a/engine/events/hidden_objects/museum_fossils.asm b/engine/events/hidden_objects/museum_fossils.asm index 27714981..e996e471 100644 --- a/engine/events/hidden_objects/museum_fossils.asm +++ b/engine/events/hidden_objects/museum_fossils.asm @@ -1,6 +1,6 @@ AerodactylFossil: ld a, FOSSIL_AERODACTYL - ld [wcf91], a + ld [wCurPartySpecies], a call DisplayMonFrontSpriteInBox call EnableAutoTextBoxDrawing tx_pre AerodactylFossilText @@ -12,7 +12,7 @@ AerodactylFossilText:: KabutopsFossil: ld a, FOSSIL_KABUTOPS - ld [wcf91], a + ld [wCurPartySpecies], a call DisplayMonFrontSpriteInBox call EnableAutoTextBoxDrawing tx_pre KabutopsFossilText @@ -24,7 +24,6 @@ KabutopsFossilText:: DisplayMonFrontSpriteInBox: ; Displays a pokemon's front sprite in a pop-up window. -; [wcf91] = pokemon internal id number ld a, 1 ldh [hAutoBGTransferEnabled], a call Delay3 @@ -35,7 +34,7 @@ DisplayMonFrontSpriteInBox: ld [wTextBoxID], a call DisplayTextBoxID call UpdateSprites - ld a, [wcf91] + ld a, [wCurPartySpecies] ld [wd0b5], a call GetMonHeader ld de, vChars1 tile $31 diff --git a/engine/events/hidden_objects/route_15_binoculars.asm b/engine/events/hidden_objects/route_15_binoculars.asm index ce047c2f..733ab73e 100644 --- a/engine/events/hidden_objects/route_15_binoculars.asm +++ b/engine/events/hidden_objects/route_15_binoculars.asm @@ -5,7 +5,7 @@ Route15GateLeftBinoculars: call EnableAutoTextBoxDrawing tx_pre Route15UpstairsBinocularsText ld a, ARTICUNO - ld [wcf91], a + ld [wCurPartySpecies], a call PlayCry jp DisplayMonFrontSpriteInBox diff --git a/engine/events/in_game_trades.asm b/engine/events/in_game_trades.asm index c62225ba..d3575689 100644 --- a/engine/events/in_game_trades.asm +++ b/engine/events/in_game_trades.asm @@ -99,7 +99,7 @@ InGameTrade_DoTrade: jp c, .tradeFailed ; jump if the player didn't select a pokemon ld a, [wInGameTradeGiveMonSpecies] ld b, a - ld a, [wcf91] + ld a, [wCurPartySpecies] cp b ld a, $2 jr nz, .tradeFailed ; jump if the selected mon's species is not the required one @@ -128,7 +128,7 @@ InGameTrade_DoTrade: pop af ld [wWhichPokemon], a ld a, [wInGameTradeReceiveMonSpecies] - ld [wcf91], a + ld [wCurPartySpecies], a xor a ld [wMonDataLocation], a ; not used ld [wRemoveMonFromBox], a diff --git a/engine/events/pokemart.asm b/engine/events/pokemart.asm index a1d69c72..10b6dba2 100644 --- a/engine/events/pokemart.asm +++ b/engine/events/pokemart.asm @@ -72,7 +72,7 @@ DisplayPokemartDialogue_:: ld a, [wIsKeyItem] and a jr nz, .unsellableItem - ld a, [wcf91] + ld a, [wCurItem] call IsItemHM jr c, .unsellableItem ld a, PRICEDITEMLISTMENU @@ -156,7 +156,7 @@ DisplayPokemartDialogue_:: call DisplayChooseQuantityMenu inc a jr z, .buyMenuLoop ; if the player closed the choose quantity menu with the B button - ld a, [wcf91] ; item ID + ld a, [wCurItem] ld [wd11e], a ; store item ID for GetItemName call GetItemName call CopyToStringBuffer diff --git a/engine/events/prize_menu.asm b/engine/events/prize_menu.asm index c1e93c36..4603b582 100644 --- a/engine/events/prize_menu.asm +++ b/engine/events/prize_menu.asm @@ -222,7 +222,7 @@ HandlePrizeChoice: jr .subtractCoins .giveMon ld a, [wd11e] - ld [wcf91], a + ld [wCurPartySpecies], a push af call GetPrizeMonLevel ld c, a @@ -287,7 +287,7 @@ OhFineThenTextPtr: text_end GetPrizeMonLevel: - ld a, [wcf91] + ld a, [wCurPartySpecies] ld b, a ld hl, PrizeMonLevelDictionary .loop diff --git a/engine/gfx/mon_icons.asm b/engine/gfx/mon_icons.asm index 73b1632f..53fabc6d 100644 --- a/engine/gfx/mon_icons.asm +++ b/engine/gfx/mon_icons.asm @@ -196,9 +196,9 @@ WriteMonPartySpriteOAMBySpecies: UnusedPartyMonSpriteFunction: ; This function is unused and doesn't appear to do anything useful. It looks ; like it may have been intended to load the tile patterns and OAM data for -; the mon party sprite associated with the species in [wcf91]. +; the mon party sprite associated with the species in [wCurPartySpecies]. ; However, its calculations are off and it loads garbage data. - ld a, [wcf91] + ld a, [wCurPartySpecies] call GetPartyMonSpriteID push af ld hl, vSprites tile $00 diff --git a/engine/gfx/palettes.asm b/engine/gfx/palettes.asm index d97fbc55..f59b37ea 100644 --- a/engine/gfx/palettes.asm +++ b/engine/gfx/palettes.asm @@ -69,7 +69,7 @@ SetPal_StatusScreen: ld de, wPalPacket ld bc, $10 call CopyData - ld a, [wcf91] + ld a, [wCurPartySpecies] cp NUM_POKEMON_INDEXES + 1 jr c, .pokemon ld a, $1 ; not pokemon @@ -97,7 +97,7 @@ SetPal_Pokedex: ld de, wPalPacket ld bc, $10 call CopyData - ld a, [wcf91] + ld a, [wCurPartySpecies] call DeterminePaletteIDOutOfBattle ld hl, wPalPacket + 3 ld [hl], a diff --git a/engine/items/inventory.asm b/engine/items/inventory.asm index ec1cfd0f..6ac75ec7 100644 --- a/engine/items/inventory.asm +++ b/engine/items/inventory.asm @@ -1,7 +1,7 @@ ; function to add an item (in varying quantities) to the player's bag or PC box ; INPUT: ; hl = address of inventory (either wNumBagItems or wNumBoxItems) -; [wcf91] = item ID +; [wCurItem] = item ID ; [wItemQuantity] = item quantity ; sets carry flag if successful, unsets carry flag if unsuccessful AddItemToInventory_:: @@ -30,7 +30,7 @@ AddItemToInventory_:: .notAtEndOfInventory ld a, [hli] ld b, a ; b = ID of current item in table - ld a, [wcf91] ; a = ID of item being added + ld a, [wCurItem] ; a = ID of item being added cp b ; does the current item in the table match the item being added? jp z, .increaseItemQuantity ; if so, increase the item's quantity inc hl @@ -50,7 +50,7 @@ AddItemToInventory_:: ld c, a ld b, 0 add hl, bc ; hl = address to store the item - ld a, [wcf91] + ld a, [wCurItem] ld [hli], a ; store item ID ld a, [wItemQuantity] ld [hli], a ; store item quantity diff --git a/engine/items/item_effects.asm b/engine/items/item_effects.asm index 0c339451..5b41516f 100644 --- a/engine/items/item_effects.asm +++ b/engine/items/item_effects.asm @@ -1,7 +1,7 @@ UseItem_:: ld a, 1 ld [wActionResultOrTookBattleTurn], a ; initialise to success value - ld a, [wcf91] ;contains item_ID + ld a, [wCurItem] cp HM01 jp nc, ItemUseTMHM ld hl, ItemUsePtrTable @@ -187,7 +187,7 @@ ItemUseBall: ld b, a ; Get the item ID. - ld hl, wcf91 + ld hl, wCurItem ld a, [hl] ; The Master Ball always succeeds. @@ -251,7 +251,7 @@ ItemUseBall: call Multiply ; Determine BallFactor. It's 8 for Great Balls and 12 for the others. - ld a, [wcf91] + ld a, [wCurItem] cp GREAT_BALL ld a, 12 jr nz, .skip1 @@ -336,7 +336,7 @@ ItemUseBall: ; Poké Ball: BallFactor2 = 255 ; Great Ball: BallFactor2 = 200 ; Ultra/Safari Ball: BallFactor2 = 150 - ld a, [wcf91] + ld a, [wCurItem] ld b, 255 cp POKE_BALL jr z, .skip4 @@ -428,11 +428,11 @@ ItemUseBall: ld [wDamageMultipliers], a ld a, [wWhichPokemon] push af - ld a, [wcf91] + ld a, [wCurItem] push af predef MoveAnimation pop af - ld [wcf91], a + ld [wCurItem], a pop af ld [wWhichPokemon], a @@ -490,15 +490,15 @@ ItemUseBall: ld [hl], a .skip6 - ld a, [wcf91] + ld a, [wCurPartySpecies] push af ld a, [wEnemyMonSpecies2] - ld [wcf91], a + ld [wCurPartySpecies], a ld a, [wEnemyMonLevel] ld [wCurEnemyLevel], a callfar LoadEnemyMonData pop af - ld [wcf91], a + ld [wCurPartySpecies], a pop hl pop af ld [hld], a @@ -509,7 +509,7 @@ ItemUseBall: ld [hl], a ld a, [wEnemyMonSpecies] ld [wCapturedMonSpecies], a - ld [wcf91], a + ld [wCurPartySpecies], a ld [wd11e], a ld a, [wBattleType] dec a ; is this the old man battle? @@ -762,7 +762,7 @@ ItemUseEvoStone: jp nz, ItemUseNotTime ld a, [wWhichPokemon] push af - ld a, [wcf91] + ld a, [wCurItem] ld [wEvoStoneItemID], a push af ld a, EVO_STONE_PARTY_MENU @@ -773,7 +773,7 @@ ItemUseEvoStone: pop bc jr c, .canceledItemUse ld a, b - ld [wcf91], a + ld [wCurPartySpecies], a ld a, $01 ld [wForceEvolution], a ld a, SFX_HEAL_AILMENT @@ -808,7 +808,7 @@ ItemUseMedicine: jp z, .emptyParty ld a, [wWhichPokemon] push af - ld a, [wcf91] + ld a, [wCurItem] push af ld a, USE_ITEM_PARTY_MENU ld [wPartyMenuTypeOrMessageID], a @@ -840,11 +840,11 @@ ItemUseMedicine: ld a, [wWhichPokemon] ld [wUsedItemOnWhichPokemon], a ld d, a - ld a, [wcf91] + ld a, [wCurPartySpecies] ld e, a ld [wd0b5], a pop af - ld [wcf91], a + ld [wCurItem], a pop af ld [wWhichPokemon], a ld a, [wPseudoItemID] @@ -855,7 +855,7 @@ ItemUseMedicine: cp d ; is the pokemon trying to use softboiled on itself? jr z, ItemUseMedicine ; if so, force another choice .checkItemType - ld a, [wcf91] + ld a, [wCurItem] cp REVIVE jr nc, .healHP ; if it's a Revive or Max Revive cp FULL_HEAL @@ -868,7 +868,7 @@ ItemUseMedicine: .cureStatusAilment ld bc, wPartyMon1Status - wPartyMon1 add hl, bc ; hl now points to status - ld a, [wcf91] + ld a, [wCurItem] lb bc, ANTIDOTE_MSG, 1 << PSN cp ANTIDOTE jr z, .checkMonStatus @@ -922,7 +922,7 @@ ItemUseMedicine: or b jr nz, .notFainted .fainted - ld a, [wcf91] + ld a, [wCurItem] cp REVIVE jr z, .updateInBattleFaintedData cp MAX_REVIVE @@ -954,7 +954,7 @@ ItemUseMedicine: pop hl jr .compareCurrentHPToMaxHP .notFainted - ld a, [wcf91] + ld a, [wCurItem] cp REVIVE jp z, .healingItemNoEffect cp MAX_REVIVE @@ -974,7 +974,7 @@ ItemUseMedicine: pop hl jr nz, .notFullHP .fullHP ; if the pokemon's current HP equals its max HP - ld a, [wcf91] + ld a, [wCurItem] cp FULL_RESTORE jp nz, .healingItemNoEffect inc hl @@ -983,7 +983,7 @@ ItemUseMedicine: and a ; does the pokemon have a status ailment? jp z, .healingItemNoEffect ld a, FULL_HEAL - ld [wcf91], a + ld [wCurItem], a dec hl dec hl dec hl @@ -1073,7 +1073,7 @@ ItemUseMedicine: ld [hl], a jr .addHealAmount .notUsingSoftboiled2 - ld a, [wcf91] + ld a, [wCurItem] cp SODA_POP ld b, 60 ; Soda Pop heal amount jr z, .addHealAmount @@ -1108,7 +1108,7 @@ ItemUseMedicine: ld e, l ; de now points to current HP ld hl, (wPartyMon1MaxHP + 1) - (wPartyMon1HP + 1) add hl, de ; hl now points to max HP - ld a, [wcf91] + ld a, [wCurItem] cp REVIVE jr z, .setCurrentHPToHalfMaxHP ld a, [hld] @@ -1120,7 +1120,7 @@ ItemUseMedicine: ld a, [de] sbc b jr nc, .setCurrentHPToMaxHp ; if current HP exceeds max HP after healing - ld a, [wcf91] + ld a, [wCurItem] cp HYPER_POTION jr c, .setCurrentHPToMaxHp ; if using a Full Restore or Max Potion cp MAX_REVIVE @@ -1150,7 +1150,7 @@ ItemUseMedicine: ld [wHPBarNewHP], a dec de .doneHealingPartyHP ; done updating the pokemon's current HP in the party data structure - ld a, [wcf91] + ld a, [wCurItem] cp FULL_RESTORE jr nz, .updateInBattleData ld bc, wPartyMon1Status - (wPartyMon1MaxHP + 1) @@ -1169,7 +1169,7 @@ ItemUseMedicine: ld [wBattleMonHP], a ld a, [hld] ld [wBattleMonHP + 1], a - ld a, [wcf91] + ld a, [wCurItem] cp FULL_RESTORE jr nz, .calculateHPBarCoords xor a @@ -1194,7 +1194,7 @@ ItemUseMedicine: call RemoveUsedItem pop hl .skipRemovingItem - ld a, [wcf91] + ld a, [wCurItem] cp FULL_RESTORE jr c, .playStatusAilmentCuringSound cp FULL_HEAL @@ -1212,7 +1212,7 @@ ItemUseMedicine: ldh [hUILayoutFlags], a ld a, REVIVE_MSG ld [wPartyMenuTypeOrMessageID], a - ld a, [wcf91] + ld a, [wCurItem] cp REVIVE jr z, .showHealingItemMessage cp MAX_REVIVE @@ -1267,7 +1267,7 @@ ItemUseMedicine: call GetPartyMonName pop de pop hl - ld a, [wcf91] + ld a, [wCurItem] cp RARE_CANDY jp z, .useRareCandy push hl @@ -1293,7 +1293,7 @@ ItemUseMedicine: pop hl call .recalculateStats ld hl, VitaminStats - ld a, [wcf91] + ld a, [wCurItem] sub HP_UP - 1 ld c, a .statNameLoop ; loop to get the address of the name of the stat the vitamin increases @@ -1357,7 +1357,7 @@ ItemUseMedicine: pop hl ld a, [wWhichPokemon] push af - ld a, [wcf91] + ld a, [wCurItem] push af push de push hl @@ -1412,7 +1412,7 @@ ItemUseMedicine: ld a, $01 ld [wUpdateSpritesEnabled], a pop af - ld [wcf91], a + ld [wCurItem], a pop af ld [wWhichPokemon], a jp RemoveUsedItem @@ -1650,7 +1650,7 @@ ItemUseXStat: ld a, [hl] push af ; save [wPlayerMoveEffect] push hl - ld a, [wcf91] + ld a, [wCurItem] sub X_ATTACK - ATTACK_UP1_EFFECT ld [hl], a ; store player move effect call PrintItemUseTextAndRemoveItem @@ -1954,7 +1954,7 @@ ItemUsePPUp: ItemUsePPRestore: ld a, [wWhichPokemon] push af - ld a, [wcf91] + ld a, [wCurItem] ld [wPPRestoreItem], a .chooseMon xor a @@ -2155,7 +2155,7 @@ ItemUseTMHM: ld a, [wIsInBattle] and a jp nz, ItemUseNotTime - ld a, [wcf91] + ld a, [wCurItem] sub TM01 ; underflows below 0 for HM items (before TM items) push af jr nc, .skipAdding @@ -2190,7 +2190,7 @@ ItemUseTMHM: .useMachine ld a, [wWhichPokemon] push af - ld a, [wcf91] + ld a, [wCurItem] push af .chooseMon ld hl, wStringBuffer @@ -2237,13 +2237,13 @@ ItemUseTMHM: jr c, .chooseMon predef LearnMove ; teach move pop af - ld [wcf91], a + ld [wCurItem], a pop af ld [wWhichPokemon], a ld a, b and a ret z - ld a, [wcf91] + ld a, [wCurItem] call IsItemHM ret c jp RemoveUsedItem @@ -2538,14 +2538,14 @@ GetSelectedMoveOffset2: ; confirms the item toss and then tosses the item ; INPUT: ; hl = address of inventory (either wNumBagItems or wNumBoxItems) -; [wcf91] = item ID +; [wCurItem] = item ID ; [wWhichPokemon] = index of item within inventory ; [wItemQuantity] = quantity to toss ; OUTPUT: ; clears carry flag if the item is tossed, sets carry flag if not TossItem_:: push hl - ld a, [wcf91] + ld a, [wCurItem] call IsItemHM pop hl jr c, .tooImportantToToss @@ -2556,7 +2556,7 @@ TossItem_:: and a jr nz, .tooImportantToToss push hl - ld a, [wcf91] + ld a, [wCurItem] ld [wd11e], a call GetItemName call CopyToStringBuffer @@ -2576,7 +2576,7 @@ TossItem_:: push hl ld a, [wWhichPokemon] call RemoveItemFromInventory - ld a, [wcf91] + ld a, [wCurItem] ld [wd11e], a call GetItemName call CopyToStringBuffer @@ -2607,7 +2607,7 @@ TooImportantToTossText: ; checks if an item is a key item ; INPUT: -; [wcf91] = item ID +; [wCurItem] = item ID ; OUTPUT: ; [wIsKeyItem] = result ; 00: item is not key item @@ -2615,7 +2615,7 @@ TooImportantToTossText: IsKeyItem_:: ld a, $01 ld [wIsKeyItem], a - ld a, [wcf91] + ld a, [wCurItem] cp HM01 ; is the item an HM or TM? jr nc, .checkIfItemIsHM ; if the item is not an HM or TM @@ -2635,7 +2635,7 @@ IsKeyItem_:: and a ret nz .checkIfItemIsHM - ld a, [wcf91] + ld a, [wCurItem] call IsItemHM ret c xor a @@ -2649,7 +2649,7 @@ SendNewMonToBox: ld a, [de] inc a ld [de], a - ld a, [wcf91] + ld a, [wCurPartySpecies] ld [wd0b5], a ld c, a .loop diff --git a/engine/items/tm_prices.asm b/engine/items/tm_prices.asm index df9761bd..8e64e5d0 100644 --- a/engine/items/tm_prices.asm +++ b/engine/items/tm_prices.asm @@ -1,7 +1,7 @@ GetMachinePrice:: -; Input: [wcf91] = Item Id of a TM +; Input: [wCurItem] = Item ID of a TM ; Output: Stores the TM price at hItemPrice - ld a, [wcf91] ; a contains TM item id + ld a, [wCurItem] sub TM01 ; underflows below 0 for HM items (before TM items) ret c ; HMs are priceless ld d, a diff --git a/engine/items/tms.asm b/engine/items/tms.asm index ea7fbcad..f3c6db98 100644 --- a/engine/items/tms.asm +++ b/engine/items/tms.asm @@ -1,6 +1,6 @@ -; tests if mon [wcf91] can learn move [wMoveNum] +; tests if mon [wCurPartySpecies] can learn move [wMoveNum] CanLearnTM: - ld a, [wcf91] + ld a, [wCurPartySpecies] ld [wd0b5], a call GetMonHeader ld hl, wMonHLearnset diff --git a/engine/link/cable_club.asm b/engine/link/cable_club.asm index 9dd66de5..4ade66e3 100644 --- a/engine/link/cable_club.asm +++ b/engine/link/cable_club.asm @@ -806,7 +806,7 @@ TradeCenter_Trade: ld e, a add hl, de ld a, [hl] - ld [wcf91], a + ld [wCurPartySpecies], a ld hl, wEnemyMons ld a, c ld bc, wEnemyMon2 - wEnemyMon1 diff --git a/engine/menus/league_pc.asm b/engine/menus/league_pc.asm index 27bccbb5..849c6e03 100644 --- a/engine/menus/league_pc.asm +++ b/engine/menus/league_pc.asm @@ -83,7 +83,7 @@ LeaguePCShowMon: ld hl, wHallOfFame ld a, [hli] ld [wHoFMonSpecies], a - ld [wcf91], a + ld [wCurPartySpecies], a ld [wd0b5], a ld [wBattleMonSpecies2], a ld [wWholeScreenPaletteMonSpecies], a diff --git a/engine/menus/naming_screen.asm b/engine/menus/naming_screen.asm index 85447300..25d69ca9 100644 --- a/engine/menus/naming_screen.asm +++ b/engine/menus/naming_screen.asm @@ -8,7 +8,7 @@ AskName: ld b, 4 ld c, 11 call z, ClearScreenArea ; only if in wild battle - ld a, [wcf91] + ld a, [wCurPartySpecies] ld [wd11e], a call GetMonName ld hl, DoYouWantToNicknameText @@ -457,7 +457,7 @@ PrintNamingText: ld de, RivalsTextString dec a jr z, .notNickname - ld a, [wcf91] + ld a, [wCurPartySpecies] ld [wMonPartySpriteSpecies], a push af farcall WriteMonPartySpriteOAMBySpecies diff --git a/engine/menus/players_pc.asm b/engine/menus/players_pc.asm index e0a3a007..9e1553dd 100644 --- a/engine/menus/players_pc.asm +++ b/engine/menus/players_pc.asm @@ -225,7 +225,7 @@ PlayerPCToss: ld a, [wIsKeyItem] and a jr nz, .next - ld a, [wcf91] + ld a, [wCurItem] call IsItemHM jr c, .next ; if it's not a key item, there can be more than one of the item diff --git a/engine/menus/pokedex.asm b/engine/menus/pokedex.asm index c6fe37a0..f746c809 100644 --- a/engine/menus/pokedex.asm +++ b/engine/menus/pokedex.asm @@ -404,7 +404,7 @@ ShowPokedexDataInternal: call GBPalWhiteOut ; zero all palettes call ClearScreen ld a, [wd11e] ; pokemon ID - ld [wcf91], a + ld [wCurPartySpecies], a push af ld b, SET_PAL_POKEDEX call RunPaletteCommand @@ -488,7 +488,7 @@ ShowPokedexDataInternal: call IsPokemonBitSet pop af ld [wd11e], a - ld a, [wcf91] + ld a, [wCurPartySpecies] ld [wd0b5], a pop de @@ -502,8 +502,8 @@ ShowPokedexDataInternal: call GetMonHeader ; load pokemon picture location hlcoord 1, 1 call LoadFlippedFrontSpriteByMonIndex ; draw pokemon picture - ld a, [wcf91] - call PlayCry ; play pokemon cry + ld a, [wCurPartySpecies] + call PlayCry pop hl pop de diff --git a/engine/menus/start_sub_menus.asm b/engine/menus/start_sub_menus.asm index 5f742e38..5417e3e0 100644 --- a/engine/menus/start_sub_menus.asm +++ b/engine/menus/start_sub_menus.asm @@ -166,7 +166,7 @@ StartMenu_Pokemon:: res BIT_SURF_ALLOWED, [hl] jp z, .loop ld a, SURFBOARD - ld [wcf91], a + ld [wCurItem], a ld [wPseudoItemID], a call UseItem ld a, [wActionResultOrTookBattleTurn] @@ -194,7 +194,7 @@ StartMenu_Pokemon:: text_end .dig ld a, ESCAPE_ROPE - ld [wcf91], a + ld [wCurItem], a ld [wPseudoItemID], a call UseItem ld a, [wActionResultOrTookBattleTurn] @@ -259,7 +259,7 @@ StartMenu_Pokemon:: ld a, [wPartyAndBillsPCSavedMenuItem] push af ld a, POTION - ld [wcf91], a + ld [wCurItem], a ld [wPseudoItemID], a call UseItem pop af @@ -337,7 +337,7 @@ StartMenu_Item:: call PlaceUnfilledArrowMenuCursor xor a ld [wMenuItemToSwap], a - ld a, [wcf91] + ld a, [wCurItem] cp BICYCLE jp z, .useOrTossItem .notBicycle1 @@ -364,11 +364,11 @@ StartMenu_Item:: jr z, .useOrTossItem jp ItemMenuLoop .useOrTossItem ; if the player made the choice to use or toss the item - ld a, [wcf91] + ld a, [wCurItem] ld [wd11e], a call GetItemName call CopyToStringBuffer - ld a, [wcf91] + ld a, [wCurItem] cp BICYCLE jr nz, .notBicycle2 ld a, [wStatusFlags6] @@ -383,14 +383,14 @@ StartMenu_Item:: jr nz, .tossItem ; use item ld [wPseudoItemID], a ; a must be 0 due to above conditional jump - ld a, [wcf91] + ld a, [wCurItem] cp HM01 jr nc, .useItem_partyMenu ld hl, UsableItems_CloseMenu ld de, 1 call IsInArray jr c, .useItem_closeMenu - ld a, [wcf91] + ld a, [wCurItem] ld hl, UsableItems_PartyMenu ld de, 1 call IsInArray @@ -426,7 +426,7 @@ StartMenu_Item:: ld a, [wIsKeyItem] and a jr nz, .skipAskingQuantity - ld a, [wcf91] + ld a, [wCurItem] call IsItemHM jr c, .skipAskingQuantity call DisplayChooseQuantityMenu diff --git a/engine/movie/credits.asm b/engine/movie/credits.asm index cb7e37c0..a9b6efbd 100644 --- a/engine/movie/credits.asm +++ b/engine/movie/credits.asm @@ -59,7 +59,7 @@ DisplayCreditsMon: ld hl, CreditsMons add hl, bc ; go that far in the list of monsters and get the next one ld a, [hl] - ld [wcf91], a + ld [wCurPartySpecies], a ld [wd0b5], a hlcoord 8, 6 call GetMonHeader diff --git a/engine/movie/evolution.asm b/engine/movie/evolution.asm index 4464fd87..d7a47885 100644 --- a/engine/movie/evolution.asm +++ b/engine/movie/evolution.asm @@ -2,7 +2,7 @@ EvolveMon: push hl push de push bc - ld a, [wcf91] + ld a, [wCurPartySpecies] push af ld a, [wd0b5] push af @@ -25,7 +25,7 @@ EvolveMon: ld c, 0 call EvolutionSetWholeScreenPalette ld a, [wEvoNewSpecies] - ld [wcf91], a + ld [wCurPartySpecies], a ld [wd0b5], a call Evolution_LoadPic ld de, vFrontPic @@ -33,7 +33,7 @@ EvolveMon: ld bc, 7 * 7 call CopyVideoData ld a, [wEvoOldSpecies] - ld [wcf91], a + ld [wCurPartySpecies], a ld [wd0b5], a call Evolution_LoadPic ld a, $1 @@ -77,7 +77,7 @@ EvolveMon: pop af ld [wd0b5], a pop af - ld [wcf91], a + ld [wCurPartySpecies], a pop bc pop de pop hl diff --git a/engine/movie/hall_of_fame.asm b/engine/movie/hall_of_fame.asm index 6dd9aab1..2344dce3 100644 --- a/engine/movie/hall_of_fame.asm +++ b/engine/movie/hall_of_fame.asm @@ -101,7 +101,7 @@ HoFShowMonOrPlayer: ld a, $c0 ldh [hSCX], a ld a, [wHoFMonSpecies] - ld [wcf91], a + ld [wCurPartySpecies], a ld [wd0b5], a ld [wBattleMonSpecies2], a ld [wWholeScreenPaletteMonSpecies], a diff --git a/engine/movie/oak_speech/oak_speech.asm b/engine/movie/oak_speech/oak_speech.asm index d0fc4ad8..ded8a7c3 100644 --- a/engine/movie/oak_speech/oak_speech.asm +++ b/engine/movie/oak_speech/oak_speech.asm @@ -52,7 +52,7 @@ OakSpeech: predef InitPlayerData2 ld hl, wNumBoxItems ld a, POTION - ld [wcf91], a + ld [wCurItem], a ld a, 1 ld [wItemQuantity], a call AddItemToInventory @@ -74,7 +74,7 @@ OakSpeech: call ClearScreen ld a, NIDORINO ld [wd0b5], a - ld [wcf91], a + ld [wCurPartySpecies], a call GetMonHeader hlcoord 6, 4 call LoadFlippedFrontSpriteByMonIndex diff --git a/engine/movie/title.asm b/engine/movie/title.asm index 7edbbedf..b515a984 100644 --- a/engine/movie/title.asm +++ b/engine/movie/title.asm @@ -361,7 +361,7 @@ ClearBothBGMaps: jp FillMemory LoadTitleMonSprite: - ld [wcf91], a + ld [wCurPartySpecies], a ld [wd0b5], a hlcoord 5, 10 call GetMonHeader diff --git a/engine/movie/trade.asm b/engine/movie/trade.asm index 931538c0..a7ccb6b8 100644 --- a/engine/movie/trade.asm +++ b/engine/movie/trade.asm @@ -727,7 +727,7 @@ Trade_CircleOAM3: ; a = species Trade_LoadMonSprite: - ld [wcf91], a + ld [wCurPartySpecies], a ld [wd0b5], a ld [wWholeScreenPaletteMonSpecies], a ld b, SET_PAL_POKEMON_WHOLE_SCREEN diff --git a/engine/overworld/field_move_messages.asm b/engine/overworld/field_move_messages.asm index a9e29b63..dadfb753 100644 --- a/engine/overworld/field_move_messages.asm +++ b/engine/overworld/field_move_messages.asm @@ -9,7 +9,7 @@ PrintStrengthText: UsedStrengthText: text_far _UsedStrengthText text_asm - ld a, [wcf91] + ld a, [wCurPartySpecies] call PlayCry call Delay3 jp TextScriptEnd diff --git a/engine/pokemon/add_mon.asm b/engine/pokemon/add_mon.asm index 73ba8071..ab167a24 100644 --- a/engine/pokemon/add_mon.asm +++ b/engine/pokemon/add_mon.asm @@ -21,7 +21,7 @@ _AddPartyMon:: jr nc, .noCarry inc d .noCarry - ld a, [wcf91] + ld a, [wCurPartySpecies] ld [de], a ; write species of new mon in party list inc de ld a, $ff ; terminator @@ -64,7 +64,7 @@ _AddPartyMon:: ld e, l ld d, h push hl - ld a, [wcf91] + ld a, [wCurPartySpecies] ld [wd0b5], a call GetMonHeader ld hl, wMonHeader @@ -80,7 +80,7 @@ _AddPartyMon:: jr nz, .next4 ; If the mon is being added to the player's party, update the pokedex. - ld a, [wcf91] + ld a, [wCurPartySpecies] ld [wd11e], a push de predef IndexToPokedex @@ -275,7 +275,7 @@ AddPartyMon_WriteMovePP: jr nz, .pploop ; there are still moves to read ret -; adds enemy mon [wcf91] (at position [wWhichPokemon] in enemy list) to own party +; adds enemy mon [wCurPartySpecies] (at position [wWhichPokemon] in enemy list) to own party ; used in the cable club trade center _AddEnemyMonToPlayerParty:: ld hl, wPartyCount @@ -288,7 +288,7 @@ _AddEnemyMonToPlayerParty:: ld c, a ld b, $0 add hl, bc - ld a, [wcf91] + ld a, [wCurPartySpecies] ld [hli], a ; add mon as last list entry ld [hl], $ff ; write new sentinel ld hl, wPartyMons @@ -322,7 +322,7 @@ _AddEnemyMonToPlayerParty:: call SkipFixedLengthTextEntries ld bc, NAME_LENGTH call CopyData ; write new mon's nickname (from an enemy mon) - ld a, [wcf91] + ld a, [wCurPartySpecies] ld [wd11e], a predef IndexToPokedex ld a, [wd11e] @@ -371,7 +371,7 @@ _MoveMon:: cp DAYCARE_TO_PARTY ld a, [wDayCareMon] jr z, .copySpecies - ld a, [wcf91] + ld a, [wCurPartySpecies] .copySpecies ld [hli], a ; write new mon ID ld [hl], $ff ; write new sentinel diff --git a/engine/pokemon/bills_pc.asm b/engine/pokemon/bills_pc.asm index 59933762..736c104c 100644 --- a/engine/pokemon/bills_pc.asm +++ b/engine/pokemon/bills_pc.asm @@ -224,7 +224,7 @@ BillsPCDeposit: jp c, BillsPCMenu call DisplayDepositWithdrawMenu jp nc, BillsPCMenu - ld a, [wcf91] + ld a, [wCurPartySpecies] call GetCryData call PlaySoundWaitForCurrent ld a, PARTY_TO_BOX @@ -276,7 +276,7 @@ BillsPCWithdraw: ld a, [wWhichPokemon] ld hl, wBoxMonNicks call GetPartyMonName - ld a, [wcf91] + ld a, [wCurPartySpecies] call GetCryData call PlaySoundWaitForCurrent xor a ; BOX_TO_PARTY @@ -311,7 +311,7 @@ BillsPCRelease: ld [wRemoveMonFromBox], a call RemovePokemon call WaitForSoundToFinish - ld a, [wcf91] + ld a, [wCurPartySpecies] call PlayCry ld hl, MonWasReleasedText call PrintText diff --git a/engine/pokemon/evos_moves.asm b/engine/pokemon/evos_moves.asm index 1c7c328c..aae6cb87 100644 --- a/engine/pokemon/evos_moves.asm +++ b/engine/pokemon/evos_moves.asm @@ -53,13 +53,13 @@ Evolution_PartyMonLoop: ; loop over party mons ld h, [hl] ld l, a push hl - ld a, [wcf91] + ld a, [wCurPartySpecies] push af xor a ; PLAYER_PARTY_DATA ld [wMonDataLocation], a call LoadMonData pop af - ld [wcf91], a + ld [wCurPartySpecies], a pop hl .evoEntryLoop ; loop over evolution entries @@ -95,7 +95,7 @@ Evolution_PartyMonLoop: ; loop over party mons .checkItemEvo ld a, [hli] ld b, a ; evolution item - ld a, [wcf91] ; this is supposed to be the last item used, but it is also used to hold species numbers + ld a, [wCurItem] cp b ; was the evolution item in this entry used? jp nz, .nextEvoEntry1 ; if not, go to the next evolution entry .checkLevel @@ -320,7 +320,7 @@ Evolution_ReloadTilesetTilePatterns: LearnMoveFromLevelUp: ld hl, EvosMovesPointerTable ld a, [wd11e] ; species - ld [wcf91], a + ld [wCurPartySpecies], a dec a ld bc, 0 ld hl, EvosMovesPointerTable @@ -371,7 +371,7 @@ LearnMoveFromLevelUp: call CopyToStringBuffer predef LearnMove .done - ld a, [wcf91] + ld a, [wCurPartySpecies] ld [wd11e], a ret @@ -384,7 +384,7 @@ WriteMonMoves: push bc ld hl, EvosMovesPointerTable ld b, 0 - ld a, [wcf91] ; cur mon ID + ld a, [wCurPartySpecies] dec a add a rl b diff --git a/engine/pokemon/load_mon_data.asm b/engine/pokemon/load_mon_data.asm index c5e2041a..3d0548e0 100644 --- a/engine/pokemon/load_mon_data.asm +++ b/engine/pokemon/load_mon_data.asm @@ -4,11 +4,11 @@ LoadMonData_:: ; 1: enemymon ; 2: boxmon ; 3: daycaremon -; Return monster id at wcf91 and its data at wLoadedMon. +; Return monster id at wCurPartySpecies and its data at wLoadedMon. ; Also load base stats at wMonHeader for convenience. ld a, [wDayCareMonSpecies] - ld [wcf91], a + ld [wCurPartySpecies], a ld a, [wMonDataLocation] cp DAYCARE_DATA jr z, .GetMonHeader @@ -18,7 +18,7 @@ LoadMonData_:: callfar GetMonSpecies .GetMonHeader - ld a, [wcf91] + ld a, [wCurPartySpecies] ld [wd0b5], a ; input for GetMonHeader call GetMonHeader diff --git a/engine/pokemon/status_screen.asm b/engine/pokemon/status_screen.asm index d29c23fe..4ae4327a 100644 --- a/engine/pokemon/status_screen.asm +++ b/engine/pokemon/status_screen.asm @@ -170,9 +170,9 @@ StatusScreen: call GBPalNormal hlcoord 1, 0 call LoadFlippedFrontSpriteByMonIndex ; draw Pokémon picture - ld a, [wcf91] - call PlayCry ; play Pokémon cry - call WaitForTextScrollButtonPress ; wait for button + ld a, [wCurPartySpecies] + call PlayCry + call WaitForTextScrollButtonPress pop af ldh [hTileAnimations], a ret diff --git a/home/give.asm b/home/give.asm index 128367ec..8ede4ea4 100644 --- a/home/give.asm +++ b/home/give.asm @@ -4,7 +4,7 @@ GiveItem:: ; Return carry on success. ld a, b ld [wd11e], a - ld [wcf91], a + ld [wCurItem], a ld a, c ld [wItemQuantity], a ld hl, wNumBagItems @@ -18,7 +18,7 @@ GiveItem:: GivePokemon:: ; Give the player monster b at level c. ld a, b - ld [wcf91], a + ld [wCurPartySpecies], a ld a, c ld [wCurEnemyLevel], a xor a ; PLAYER_PARTY_DATA diff --git a/home/inventory.asm b/home/inventory.asm index 1100666f..e4f9a261 100644 --- a/home/inventory.asm +++ b/home/inventory.asm @@ -28,7 +28,7 @@ RemoveItemFromInventory:: ; function to add an item (in varying quantities) to the player's bag or PC box ; INPUT: ; HL = address of inventory (either wNumBagItems or wNumBoxItems) -; [wcf91] = item ID +; [wCurItem] = item ID ; [wItemQuantity] = item quantity ; sets carry flag if successful, unsets carry flag if unsuccessful AddItemToInventory:: diff --git a/home/item.asm b/home/item.asm index f27d46f4..9e7f02f9 100644 --- a/home/item.asm +++ b/home/item.asm @@ -1,7 +1,7 @@ ; uses an item ; UseItem is used with dummy items to perform certain other functions as well ; INPUT: -; [wcf91] = item ID +; [wCurItem] = item ID ; OUTPUT: ; [wActionResultOrTookBattleTurn] = success ; 00: unsuccessful @@ -13,7 +13,7 @@ UseItem:: ; confirms the item toss and then tosses the item ; INPUT: ; hl = address of inventory (either wNumBagItems or wNumBoxItems) -; [wcf91] = item ID +; [wCurItem] = item ID ; [wWhichPokemon] = index of item within inventory ; [wItemQuantity] = quantity to toss ; OUTPUT: @@ -33,7 +33,7 @@ TossItem:: ; checks if an item is a key item ; INPUT: -; [wcf91] = item ID +; [wCurItem] = item ID ; OUTPUT: ; [wIsKeyItem] = result ; 00: item is not key item diff --git a/home/item_price.asm b/home/item_price.asm index 98eb31b1..a71f655f 100644 --- a/home/item_price.asm +++ b/home/item_price.asm @@ -1,6 +1,6 @@ GetItemPrice:: ; Stores item's price as BCD at hItemPrice (3 bytes) -; Input: [wcf91] = item id +; Input: [wCurItem] = item id ldh a, [hLoadedROMBank] push af ld a, [wListMenuID] @@ -15,7 +15,7 @@ GetItemPrice:: ld a, [hli] ld h, [hl] ld l, a - ld a, [wcf91] ; a contains item id + ld a, [wCurItem] cp HM01 jr nc, .getTMPrice ld bc, $3 diff --git a/home/list_menu.asm b/home/list_menu.asm index 3d864222..ca369a82 100644 --- a/home/list_menu.asm +++ b/home/list_menu.asm @@ -124,28 +124,30 @@ DisplayListMenuIDLoop:: ld b, 0 add hl, bc ld a, [hl] - ld [wcf91], a + ld [wCurListMenuItem], a ld a, [wListMenuID] and a ; PCPOKEMONLISTMENU? jr z, .pokemonList +; if it's an item menu + assert wCurListMenuItem == wCurItem push hl call GetItemPrice pop hl ld a, [wListMenuID] cp ITEMLISTMENU jr nz, .skipGettingQuantity -; if it's an item menu inc hl ld a, [hl] ; a = item quantity ld [wMaxItemQuantity], a .skipGettingQuantity - ld a, [wcf91] + ld a, [wCurItem] ld [wd0b5], a ld a, BANK(ItemNames) ld [wPredefBank], a call GetName jr .storeChosenEntry .pokemonList + assert wCurListMenuItem == wCurPartySpecies ld hl, wPartyCount ld a, [wListPointer] cp l ; is it a list of party pokemon or box pokemon? @@ -413,8 +415,8 @@ PrintListMenuEntries:: push hl ld a, [de] ld de, ItemPrices - ld [wcf91], a - call GetItemPrice ; get price + ld [wCurItem], a + call GetItemPrice pop hl ld bc, SCREEN_WIDTH + 5 ; 1 row down and 5 columns right add hl, bc @@ -468,7 +470,7 @@ PrintListMenuEntries:: jr nz, .nextListEntry .printItemQuantity ld a, [wd11e] - ld [wcf91], a + ld [wCurItem], a call IsKeyItem ; check if item is unsellable ld a, [wIsKeyItem] and a ; is the item unsellable? diff --git a/home/pics.asm b/home/pics.asm index 3bce1532..73ee35d7 100644 --- a/home/pics.asm +++ b/home/pics.asm @@ -16,7 +16,7 @@ UncompressMonSprite:: ; $4A ≤ index < $74: bank $B ("Pics 3") ; $74 ≤ index < $99: bank $C ("Pics 4") ; $99 ≤ index: bank $D ("Pics 5") - ld a, [wcf91] + ld a, [wCurPartySpecies] ld b, a cp MEW ld a, BANK(MewPicFront) diff --git a/home/pokemon.asm b/home/pokemon.asm index b228f086..9fcf5622 100644 --- a/home/pokemon.asm +++ b/home/pokemon.asm @@ -77,7 +77,7 @@ DrawHPBar:: ; 02: current box ; 03: daycare ; OUTPUT: -; [wcf91] = pokemon ID +; [wCurPartySpecies] = pokemon ID ; wLoadedMon = base address of pokemon data ; wMonHeader = base address of base stats LoadMonData:: @@ -101,7 +101,7 @@ LoadFrontSpriteByMonIndex:: push hl ld a, [wd11e] push af - ld a, [wcf91] + ld a, [wCurPartySpecies] ld [wd11e], a predef IndexToPokedex ld hl, wd11e @@ -115,7 +115,7 @@ LoadFrontSpriteByMonIndex:: jr c, .validDexNumber ; dex >#151 invalid .invalidDexNumber ld a, RHYDON ; $1 - ld [wcf91], a + ld [wCurPartySpecies], a ret .validDexNumber push hl @@ -264,7 +264,7 @@ HandlePartyMenuInput:: ld c, a add hl, bc ld a, [hl] - ld [wcf91], a + ld [wCurPartySpecies], a ld [wBattleMonSpecies2], a call BankswitchBack and a diff --git a/ram/wram.asm b/ram/wram.asm index 3bdf5a7b..ef23aabf 100644 --- a/ram/wram.asm +++ b/ram/wram.asm @@ -1073,7 +1073,10 @@ wUnusedNamePointer:: dw wItemPrices:: dw -wcf91:: db ; used with a lot of things (too much to list here) +wCurPartySpecies:: +wCurItem:: +wCurListMenuItem:: + db ; which pokemon you selected wWhichPokemon:: db diff --git a/scripts/CeruleanBadgeHouse.asm b/scripts/CeruleanBadgeHouse.asm index 417198e1..b1f6db7f 100644 --- a/scripts/CeruleanBadgeHouse.asm +++ b/scripts/CeruleanBadgeHouse.asm @@ -34,7 +34,7 @@ CeruleanBadgeHouseMiddleAgedManText: call DisplayListMenuID jr c, .done ld hl, CeruleanBadgeHouseBadgeTextPointers - ld a, [wcf91] + ld a, [wCurItem] sub BOULDERBADGE add a ld d, $0 diff --git a/scripts/Daycare.asm b/scripts/Daycare.asm index a3e9e286..05b69935 100644 --- a/scripts/Daycare.asm +++ b/scripts/Daycare.asm @@ -54,7 +54,7 @@ DaycareGentlemanText: xor a ld [wRemoveMonFromBox], a call RemovePokemon - ld a, [wcf91] + ld a, [wCurPartySpecies] call PlayCry ld hl, .ComeSeeMeInAWhileText jp .done @@ -169,7 +169,7 @@ DaycareGentlemanText: ld [wMoveMonType], a call MoveMon ld a, [wDayCareMonSpecies] - ld [wcf91], a + ld [wCurPartySpecies], a ld a, [wPartyCount] dec a push af @@ -198,7 +198,7 @@ DaycareGentlemanText: ld a, [hl] ld [de], a - ld a, [wcf91] + ld a, [wCurPartySpecies] call PlayCry ld hl, .GotMonBackText jr .done diff --git a/scripts/FightingDojo.asm b/scripts/FightingDojo.asm index 75427049..4522b906 100644 --- a/scripts/FightingDojo.asm +++ b/scripts/FightingDojo.asm @@ -239,7 +239,7 @@ FightingDojoHitmonleePokeBallText: ld a, [wCurrentMenuItem] and a jr nz, .done - ld a, [wcf91] + ld a, [wCurPartySpecies] ld b, a ld c, 30 call GivePokemon @@ -273,7 +273,7 @@ FightingDojoHitmonchanPokeBallText: ld a, [wCurrentMenuItem] and a jr nz, .done - ld a, [wcf91] + ld a, [wCurPartySpecies] ld b, a ld c, 30 call GivePokemon diff --git a/scripts/OaksLab.asm b/scripts/OaksLab.asm index dc9e56df..087e6a37 100644 --- a/scripts/OaksLab.asm +++ b/scripts/OaksLab.asm @@ -321,7 +321,7 @@ OaksLabRivalChoosesStarterScript: call Delay3 ld a, [wRivalStarterTemp] ld [wRivalStarter], a - ld [wcf91], a + ld [wCurPartySpecies], a ld [wd11e], a call GetMonName ld a, OAKSLAB_RIVAL @@ -824,7 +824,7 @@ OaksLabBulbasaurPokeBallText: ld b, OAKSLAB_BULBASAUR_POKE_BALL OaksLabSelectedPokeBallScript: - ld [wcf91], a + ld [wCurPartySpecies], a ld [wd11e], a ld a, b ld [wSpriteIndex], a @@ -897,7 +897,7 @@ OaksLabMonChoiceMenu: ld a, [wCurrentMenuItem] and a jr nz, OaksLabMonChoiceEnd - ld a, [wcf91] + ld a, [wCurPartySpecies] ld [wPlayerStarter], a ld [wd11e], a call GetMonName @@ -926,7 +926,7 @@ OaksLabMonChoiceMenu: ld [wMonDataLocation], a ld a, 5 ld [wCurEnemyLevel], a - ld a, [wcf91] + ld a, [wCurPartySpecies] ld [wd11e], a call AddPartyMon ld hl, wStatusFlags4 -- cgit v1.3.1-sl0p From 5a622f628de6908210091a05956b0d8ce3620237 Mon Sep 17 00:00:00 2001 From: Sylvie <35663410+Rangi42@users.noreply.github.com> Date: Wed, 18 Sep 2024 21:41:58 -0400 Subject: Identify remaining uses of `wd0b5` and `wd11e` (#463) --- engine/battle/animations.asm | 6 +-- engine/battle/core.asm | 44 ++++++++++----------- engine/battle/effects.asm | 6 +-- engine/battle/experience.asm | 18 ++++----- engine/battle/get_trainer_name.asm | 2 +- engine/battle/misc.asm | 2 +- engine/battle/move_effects/transform.asm | 2 +- engine/battle/print_type.asm | 2 +- engine/battle/safari_zone.asm | 2 +- engine/battle/trainer_ai.asm | 2 +- engine/events/cinnabar_lab.asm | 6 +-- engine/events/display_pokedex.asm | 2 +- engine/events/give_pokemon.asm | 6 +-- engine/events/heal_party.asm | 2 +- engine/events/hidden_items.asm | 2 +- engine/events/hidden_objects/museum_fossils.asm | 2 +- engine/events/in_game_trades.asm | 2 +- engine/events/poison.asm | 2 +- engine/events/pokemart.asm | 2 +- engine/events/prize_menu.asm | 20 +++++----- engine/gfx/mon_icons.asm | 4 +- engine/gfx/palettes.asm | 4 +- engine/items/item_effects.asm | 34 ++++++++-------- engine/items/tms.asm | 8 ++-- engine/link/cable_club.asm | 6 +-- engine/menus/league_pc.asm | 2 +- engine/menus/naming_screen.asm | 4 +- engine/menus/pokedex.asm | 52 ++++++++++++------------- engine/menus/start_sub_menus.asm | 2 +- engine/movie/credits.asm | 2 +- engine/movie/evolution.asm | 8 ++-- engine/movie/hall_of_fame.asm | 4 +- engine/movie/oak_speech/oak_speech.asm | 2 +- engine/movie/title.asm | 2 +- engine/movie/trade.asm | 6 +-- engine/movie/trade2.asm | 8 ++-- engine/pokemon/add_mon.asm | 12 +++--- engine/pokemon/evos_moves.asm | 33 ++++++++-------- engine/pokemon/experience.asm | 2 +- engine/pokemon/learn_move.asm | 2 +- engine/pokemon/load_mon_data.asm | 2 +- engine/pokemon/set_types.asm | 6 +-- engine/pokemon/status_screen.asm | 8 ++-- home/give.asm | 2 +- home/list_menu.asm | 16 ++++---- home/map_objects.asm | 2 +- home/names.asm | 22 +++++------ home/names2.asm | 8 ++-- home/pokemon.asm | 26 ++++++------- ram/wram.asm | 27 +++++++------ scripts/CeladonMartRoof.asm | 9 +++-- scripts/ChampionsRoom.asm | 2 +- scripts/CinnabarLabFossilRoom.asm | 7 ++-- scripts/OaksLab.asm | 8 ++-- scripts/Route11Gate2F.asm | 2 +- scripts/Route15Gate2F.asm | 2 +- scripts/Route2Gate.asm | 2 +- 57 files changed, 243 insertions(+), 237 deletions(-) (limited to 'engine/battle/misc.asm') diff --git a/engine/battle/animations.asm b/engine/battle/animations.asm index 31851a91..3e077d2b 100644 --- a/engine/battle/animations.asm +++ b/engine/battle/animations.asm @@ -701,7 +701,7 @@ DoBallTossSpecialEffects: ld a, [wIsInBattle] cp 2 ; is it a trainer battle? jr z, .isTrainerBattle - ld a, [wd11e] + ld a, [wPokeBallAnimData] cp $10 ; is the enemy pokemon the Ghost Marowak? ret nz ; if the enemy pokemon is the Ghost Marowak, make it dodge during the last 3 frames @@ -2032,7 +2032,7 @@ ChangeMonPic: jr z, .playerTurn ld a, [wChangeMonPicEnemyTurnSpecies] ld [wCurPartySpecies], a - ld [wd0b5], a + ld [wCurSpecies], a xor a ld [wSpriteFlipped], a call GetMonHeader @@ -2044,7 +2044,7 @@ ChangeMonPic: push af ld a, [wChangeMonPicPlayerTurnSpecies] ld [wBattleMonSpecies2], a - ld [wd0b5], a + ld [wCurSpecies], a call GetMonHeader predef LoadMonBackPic xor a ; TILEMAP_MON_PIC diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 01faa890..428bc78a 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -1421,7 +1421,7 @@ EnemySendOutFirstMon: call PrintText ld a, [wEnemyMonSpecies2] ld [wCurPartySpecies], a - ld [wd0b5], a + ld [wCurSpecies], a call GetMonHeader ld de, vFrontPic call LoadMonFrontSprite @@ -1642,7 +1642,7 @@ LoadBattleMonFromParty: ld bc, wBattleMonPP - wBattleMonLevel call CopyData ld a, [wBattleMonSpecies2] - ld [wd0b5], a + ld [wCurSpecies], a call GetMonHeader ld hl, wPartyMonNicks ld a, [wPlayerMonNumber] @@ -1686,7 +1686,7 @@ LoadEnemyMonFromParty: ld bc, wEnemyMonPP - wEnemyMonLevel call CopyData ld a, [wEnemyMonSpecies] - ld [wd0b5], a + ld [wCurSpecies], a call GetMonHeader ld hl, wEnemyMonNicks ld a, [wWhichPokemon] @@ -2237,7 +2237,7 @@ DisplayBagMenu: UseBagItem: ; either use an item from the bag or use a safari zone item ld a, [wCurItem] - ld [wd11e], a + ld [wNamedObjectIndex], a call GetItemName call CopyToStringBuffer xor a @@ -2380,7 +2380,7 @@ PartyMenuOrRockOrRun: ; enemy mon is not minimised ld a, [wEnemyMonSpecies] ld [wCurPartySpecies], a - ld [wd0b5], a + ld [wCurSpecies], a call GetMonHeader ld de, vFrontPic call LoadMonFrontSprite @@ -3564,7 +3564,7 @@ CheckPlayerStatusConditions: bit USING_RAGE, a ; is mon using rage? jp z, .checkPlayerStatusConditionsDone ; if we made it this far, mon can move normally this turn ld a, RAGE - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMoveName call CopyToStringBuffer xor a @@ -3654,7 +3654,7 @@ PrintMoveIsDisabledText: res CHARGING_UP, a ; end the pokemon's ld [de], a ld a, [hl] - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMoveName ld hl, MoveIsDisabledText jp PrintText @@ -3728,13 +3728,13 @@ MonName1Text: ld hl, wEnemyUsedMove .playerTurn ld [hl], a - ld [wd11e], a + ld [wMoveGrammar], a call DetermineExclamationPointTextNum ld a, [wMonIsDisobedient] and a ld hl, Used2Text ret nz - ld a, [wd11e] + ld a, [wMoveGrammar] cp 3 ld hl, Used2Text ret c @@ -3771,7 +3771,7 @@ _PrintMoveName: text_far _MoveNameText text_asm ld hl, ExclamationPointPointerTable - ld a, [wd11e] ; exclamation point num + ld a, [wMoveGrammar] add a push bc ld b, $0 @@ -3819,7 +3819,7 @@ ExclamationPoint5Text: ; but the functionality didn't get removed DetermineExclamationPointTextNum: push bc - ld a, [wd11e] ; move ID + ld a, [wMoveGrammar] ; move ID ld c, a ld b, $0 ld hl, ExclamationPointMoveSets @@ -3835,7 +3835,7 @@ DetermineExclamationPointTextNum: jr .loop .done ld a, b - ld [wd11e], a ; exclamation point num + ld [wMoveGrammar], a pop bc ret @@ -4406,7 +4406,7 @@ GetEnemyMonStat: ld a, [wEnemyMonLevel] ld [wCurEnemyLevel], a ld a, [wEnemyMonSpecies] - ld [wd0b5], a + ld [wCurSpecies], a call GetMonHeader ld hl, wEnemyMonDVs ld de, wLoadedMonSpeedExp @@ -4610,7 +4610,7 @@ CriticalHitTest: jr nz, .handleEnemy ld a, [wBattleMonSpecies] .handleEnemy - ld [wd0b5], a + ld [wCurSpecies], a call GetMonHeader ld a, [wMonHBaseSpeed] ld b, a @@ -5120,7 +5120,7 @@ MirrorMoveFailedText: ; function used to reload move data for moves like Mirror Move and Metronome ReloadMoveData: - ld [wd11e], a + ld [wNamedObjectIndex], a dec a ld hl, Moves ld bc, MOVE_LENGTH @@ -5625,7 +5625,7 @@ EnemyCanExecuteChargingMove: res CHARGING_UP, [hl] ; no longer charging up for attack res INVULNERABLE, [hl] ; no longer invulnerable to typical attacks ld a, [wEnemyMoveNum] - ld [wd0b5], a + ld [wNameListIndex], a ld a, BANK(MoveNames) ld [wPredefBank], a ld a, MOVE_NAME @@ -6067,7 +6067,7 @@ CheckEnemyStatusConditions: bit USING_RAGE, a ; is mon using rage? jp z, .checkEnemyStatusConditionsDone ; if we made it this far, mon can move normally this turn ld a, RAGE - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMoveName call CopyToStringBuffer xor a @@ -6098,7 +6098,7 @@ GetCurrentMove: jr nz, .selected ld a, [wPlayerSelectedMove] .selected - ld [wd0b5], a + ld [wNameListIndex], a dec a ld hl, Moves ld bc, MOVE_LENGTH @@ -6120,7 +6120,7 @@ LoadEnemyMonData: jp z, LoadEnemyMonFromParty ld a, [wEnemyMonSpecies2] ld [wEnemyMonSpecies], a - ld [wd0b5], a + ld [wCurSpecies], a call GetMonHeader ld a, [wEnemyBattleStatus3] bit TRANSFORMED, a ; is enemy mon transformed? @@ -6245,16 +6245,16 @@ LoadEnemyMonData: ld a, [hl] ; base exp ld [de], a ld a, [wEnemyMonSpecies2] - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMonName ld hl, wNameBuffer ld de, wEnemyMonNick ld bc, NAME_LENGTH call CopyData ld a, [wEnemyMonSpecies2] - ld [wd11e], a + ld [wPokedexNum], a predef IndexToPokedex - ld a, [wd11e] + ld a, [wPokedexNum] dec a ld c, a ld b, FLAG_SET diff --git a/engine/battle/effects.asm b/engine/battle/effects.asm index 643afeb2..6fba347f 100644 --- a/engine/battle/effects.asm +++ b/engine/battle/effects.asm @@ -1262,7 +1262,7 @@ MimicEffect: add hl, bc ld a, d ld [hl], a - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMoveName call PlayCurrentMoveAnimation ld hl, MimicLearnedMoveText @@ -1309,7 +1309,7 @@ DisableEffect: pop hl and a jr z, .pickMoveToDisable ; loop until a non-00 move slot is found - ld [wd11e], a ; store move number + ld [wNamedObjectIndex], a ; store move number push hl ldh a, [hWhoseTurn] and a @@ -1354,7 +1354,7 @@ DisableEffect: jr nz, .printDisableText inc hl ; wEnemyDisabledMoveNumber .printDisableText - ld a, [wd11e] ; move number + ld a, [wNamedObjectIndex] ; move number ld [hl], a call GetMoveName ld hl, MoveWasDisabledText diff --git a/engine/battle/experience.asm b/engine/battle/experience.asm index 798d7ce1..57d37f01 100644 --- a/engine/battle/experience.asm +++ b/engine/battle/experience.asm @@ -113,8 +113,8 @@ GainExperience: ld b, 0 ld hl, wPartySpecies add hl, bc - ld a, [hl] ; species - ld [wd0b5], a + ld a, [hl] + ld [wCurSpecies], a call GetMonHeader ld d, MAX_LEVEL callfar CalcExperience ; get max exp @@ -168,9 +168,9 @@ GainExperience: ld [hl], a ld bc, wPartyMon1Species - wPartyMon1Level add hl, bc - ld a, [hl] ; species - ld [wd0b5], a - ld [wd11e], a + ld a, [hl] + ld [wCurSpecies], a + ld [wPokedexNum], a call GetMonHeader ld bc, (wPartyMon1MaxHP + 1) - wPartyMon1Species add hl, bc @@ -251,8 +251,8 @@ GainExperience: call LoadScreenTilesFromBuffer1 xor a ; PLAYER_PARTY_DATA ld [wMonDataLocation], a - ld a, [wd0b5] - ld [wd11e], a + ld a, [wCurSpecies] + ld [wPokedexNum], a predef LearnMoveFromLevelUp ld hl, wCanEvolveFlags ld a, [wWhichPokemon] @@ -306,7 +306,7 @@ DivideExpDataByNumMonsGainingExp: jr nz, .countSetBitsLoop cp $2 ret c ; return if only one mon is gaining exp - ld [wd11e], a ; store number of mons gaining exp + ld [wTempByteValue], a ; store number of mons gaining exp ld hl, wEnemyMonBaseStats ld c, wEnemyMonBaseExp + 1 - wEnemyMonBaseStats .divideLoop @@ -314,7 +314,7 @@ DivideExpDataByNumMonsGainingExp: ldh [hDividend], a ld a, [hl] ldh [hDividend + 1], a - ld a, [wd11e] + ld a, [wTempByteValue] ldh [hDivisor], a ld b, $2 call Divide ; divide value by number of mons gaining exp diff --git a/engine/battle/get_trainer_name.asm b/engine/battle/get_trainer_name.asm index beed3291..a0e869fc 100644 --- a/engine/battle/get_trainer_name.asm +++ b/engine/battle/get_trainer_name.asm @@ -11,7 +11,7 @@ GetTrainerName_:: jr z, .foundName cp RIVAL3 jr z, .foundName - ld [wd0b5], a + ld [wNameListIndex], a ld a, TRAINER_NAME ld [wNameListType], a ld a, BANK(TrainerNames) diff --git a/engine/battle/misc.asm b/engine/battle/misc.asm index 1fa84e15..66675dbf 100644 --- a/engine/battle/misc.asm +++ b/engine/battle/misc.asm @@ -8,7 +8,7 @@ FormatMovesString: and a ; end of move list? jr z, .printDashLoop ; print dashes when no moves are left push hl - ld [wd0b5], a + ld [wNameListIndex], a ld a, BANK(MoveNames) ld [wPredefBank], a ld a, MOVE_NAME diff --git a/engine/battle/move_effects/transform.asm b/engine/battle/move_effects/transform.asm index 56dda7f4..6f2e705c 100644 --- a/engine/battle/move_effects/transform.asm +++ b/engine/battle/move_effects/transform.asm @@ -116,7 +116,7 @@ TransformEffect_: ; original (unmodified) stats and stat mods pop hl ld a, [hl] - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMonName ld hl, wEnemyMonUnmodifiedAttack ld de, wPlayerMonUnmodifiedAttack diff --git a/engine/battle/print_type.asm b/engine/battle/print_type.asm index 7da0dc8c..e7c6729c 100644 --- a/engine/battle/print_type.asm +++ b/engine/battle/print_type.asm @@ -1,4 +1,4 @@ -; [wd0b5] = pokemon ID +; [wCurSpecies] = pokemon ID ; hl = dest addr PrintMonType: call GetPredefRegisters diff --git a/engine/battle/safari_zone.asm b/engine/battle/safari_zone.asm index a61f402f..ca3ff8a2 100644 --- a/engine/battle/safari_zone.asm +++ b/engine/battle/safari_zone.asm @@ -16,7 +16,7 @@ PrintSafariZoneBattleText: jr nz, .done push hl ld a, [wEnemyMonSpecies] - ld [wd0b5], a + ld [wCurSpecies], a call GetMonHeader ld a, [wMonHCatchRate] ld [wEnemyMonActualCatchRate], a diff --git a/engine/battle/trainer_ai.asm b/engine/battle/trainer_ai.asm index e21a3492..5eed1ae5 100644 --- a/engine/battle/trainer_ai.asm +++ b/engine/battle/trainer_ai.asm @@ -732,7 +732,7 @@ AIPrintItemUse: AIPrintItemUse_: ; print "x used [wAIItem] on z!" ld a, [wAIItem] - ld [wd11e], a + ld [wNamedObjectIndex], a call GetItemName ld hl, AIBattleUseItemText jp PrintText diff --git a/engine/events/cinnabar_lab.asm b/engine/events/cinnabar_lab.asm index 171fa99a..d8066fb8 100644 --- a/engine/events/cinnabar_lab.asm +++ b/engine/events/cinnabar_lab.asm @@ -98,7 +98,7 @@ PrintFossilsInBag: cp $ff ret z push hl - ld [wd11e], a + ld [wNamedObjectIndex], a call GetItemName hlcoord 2, 2 ldh a, [hItemCounter] @@ -114,10 +114,10 @@ PrintFossilsInBag: ; loads the names of the fossil item and the resulting mon LoadFossilItemAndMonName:: ld a, [wFossilMon] - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMonName call CopyToStringBuffer ld a, [wFossilItem] - ld [wd11e], a + ld [wNamedObjectIndex], a call GetItemName ret diff --git a/engine/events/display_pokedex.asm b/engine/events/display_pokedex.asm index 68d48bb3..46b45d77 100644 --- a/engine/events/display_pokedex.asm +++ b/engine/events/display_pokedex.asm @@ -8,7 +8,7 @@ _DisplayPokedex:: ld c, 10 call DelayFrames predef IndexToPokedex - ld a, [wd11e] + ld a, [wPokedexNum] dec a ld c, a ld b, FLAG_SET diff --git a/engine/events/give_pokemon.asm b/engine/events/give_pokemon.asm index 9472f49f..9e80bdfc 100644 --- a/engine/events/give_pokemon.asm +++ b/engine/events/give_pokemon.asm @@ -54,16 +54,16 @@ _GivePokemon:: SetPokedexOwnedFlag: ld a, [wCurPartySpecies] push af - ld [wd11e], a + ld [wPokedexNum], a predef IndexToPokedex - ld a, [wd11e] + ld a, [wPokedexNum] dec a ld c, a ld hl, wPokedexOwned ld b, FLAG_SET predef FlagActionPredef pop af - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMonName ld hl, GotMonText jp PrintText diff --git a/engine/events/heal_party.asm b/engine/events/heal_party.asm index 0c6ec1ea..8bf162a7 100644 --- a/engine/events/heal_party.asm +++ b/engine/events/heal_party.asm @@ -84,7 +84,7 @@ HealParty: .done xor a ld [wWhichPokemon], a - ld [wd11e], a + ld [wUsingPPUp], a ld a, [wPartyCount] ld b, a diff --git a/engine/events/hidden_items.asm b/engine/events/hidden_items.asm index 97bb0b71..e42f60f9 100644 --- a/engine/events/hidden_items.asm +++ b/engine/events/hidden_items.asm @@ -14,7 +14,7 @@ HiddenItems: ld a, 1 ld [wDoNotWaitForButtonPressAfterDisplayingText], a ld a, [wHiddenObjectFunctionArgument] ; item ID - ld [wd11e], a + ld [wNamedObjectIndex], a call GetItemName tx_pre_jump FoundHiddenItemText diff --git a/engine/events/hidden_objects/museum_fossils.asm b/engine/events/hidden_objects/museum_fossils.asm index e996e471..df74293f 100644 --- a/engine/events/hidden_objects/museum_fossils.asm +++ b/engine/events/hidden_objects/museum_fossils.asm @@ -35,7 +35,7 @@ DisplayMonFrontSpriteInBox: call DisplayTextBoxID call UpdateSprites ld a, [wCurPartySpecies] - ld [wd0b5], a + ld [wCurSpecies], a call GetMonHeader ld de, vChars1 tile $31 call LoadMonFrontSprite diff --git a/engine/events/in_game_trades.asm b/engine/events/in_game_trades.asm index d3575689..ce4ffe3c 100644 --- a/engine/events/in_game_trades.asm +++ b/engine/events/in_game_trades.asm @@ -77,7 +77,7 @@ DoInGameTradeDialogue: ; copies name of species a to hl InGameTrade_GetMonName: push de - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMonName ld hl, wNameBuffer pop de diff --git a/engine/events/poison.asm b/engine/events/poison.asm index 121bdc19..752899f7 100644 --- a/engine/events/poison.asm +++ b/engine/events/poison.asm @@ -44,7 +44,7 @@ ApplyOutOfBattlePoisonDamage: inc hl ld [hl], a ld a, [de] - ld [wd11e], a + ld [wPokedexNum], a push de ld a, [wWhichPokemon] ld hl, wPartyMonNicks diff --git a/engine/events/pokemart.asm b/engine/events/pokemart.asm index 10b6dba2..b280c711 100644 --- a/engine/events/pokemart.asm +++ b/engine/events/pokemart.asm @@ -157,7 +157,7 @@ DisplayPokemartDialogue_:: inc a jr z, .buyMenuLoop ; if the player closed the choose quantity menu with the B button ld a, [wCurItem] - ld [wd11e], a ; store item ID for GetItemName + ld [wNamedObjectIndex], a call GetItemName call CopyToStringBuffer ld hl, PokemartTellBuyPriceText diff --git a/engine/events/prize_menu.asm b/engine/events/prize_menu.asm index f99cdaaa..816637bf 100644 --- a/engine/events/prize_menu.asm +++ b/engine/events/prize_menu.asm @@ -88,34 +88,34 @@ GetPrizeMenuId: cp 2 ; is TM_menu? jr nz, .putMonName ld a, [wPrize1] - ld [wd11e], a + ld [wNamedObjectIndex], a call GetItemName hlcoord 2, 4 call PlaceString ld a, [wPrize2] - ld [wd11e], a + ld [wNamedObjectIndex], a call GetItemName hlcoord 2, 6 call PlaceString ld a, [wPrize3] - ld [wd11e], a + ld [wNamedObjectIndex], a call GetItemName hlcoord 2, 8 call PlaceString jr .putNoThanksText .putMonName ld a, [wPrize1] - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMonName hlcoord 2, 4 call PlaceString ld a, [wPrize2] - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMonName hlcoord 2, 6 call PlaceString ld a, [wPrize3] - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMonName hlcoord 2, 8 call PlaceString @@ -189,7 +189,7 @@ HandlePrizeChoice: ld hl, wPrize1 add hl, de ld a, [hl] - ld [wd11e], a + ld [wNamedObjectIndex], a ld a, [wWhichPrizeWindow] cp 2 ; is prize a TM? jr nz, .getMonName @@ -208,9 +208,9 @@ HandlePrizeChoice: call HasEnoughCoins jr c, .notEnoughCoins ld a, [wWhichPrizeWindow] - cp $02 + cp 2 ; is prize a TM? jr nz, .giveMon - ld a, [wd11e] + ld a, [wNamedObjectIndex] ld b, a ld a, 1 ld c, a @@ -218,7 +218,7 @@ HandlePrizeChoice: jr nc, .bagFull jr .subtractCoins .giveMon - ld a, [wd11e] + ld a, [wNamedObjectIndex] ld [wCurPartySpecies], a push af call GetPrizeMonLevel diff --git a/engine/gfx/mon_icons.asm b/engine/gfx/mon_icons.asm index 53fabc6d..e7016a1d 100644 --- a/engine/gfx/mon_icons.asm +++ b/engine/gfx/mon_icons.asm @@ -258,9 +258,9 @@ WriteMonPartySpriteOAM: jp CopyData GetPartyMonSpriteID: - ld [wd11e], a + ld [wPokedexNum], a predef IndexToPokedex - ld a, [wd11e] + ld a, [wPokedexNum] ld c, a dec a srl a diff --git a/engine/gfx/palettes.asm b/engine/gfx/palettes.asm index f59b37ea..47af5c29 100644 --- a/engine/gfx/palettes.asm +++ b/engine/gfx/palettes.asm @@ -275,13 +275,13 @@ DeterminePaletteID: ret nz ld a, [hl] DeterminePaletteIDOutOfBattle: - ld [wd11e], a + ld [wPokedexNum], a and a ; is the mon index 0? jr z, .skipDexNumConversion push bc predef IndexToPokedex pop bc - ld a, [wd11e] + ld a, [wPokedexNum] .skipDexNumConversion ld e, a ld d, 0 diff --git a/engine/items/item_effects.asm b/engine/items/item_effects.asm index df050b03..91462478 100644 --- a/engine/items/item_effects.asm +++ b/engine/items/item_effects.asm @@ -510,7 +510,7 @@ ItemUseBall: ld a, [wEnemyMonSpecies] ld [wCapturedMonSpecies], a ld [wCurPartySpecies], a - ld [wd11e], a + ld [wPokedexNum], a ld a, [wBattleType] dec a ; is this the old man battle? jr z, .oldManCaughtMon ; if so, don't give the player the caught Pokémon @@ -520,7 +520,7 @@ ItemUseBall: ; Add the caught Pokémon to the Pokédex. predef IndexToPokedex - ld a, [wd11e] + ld a, [wPokedexNum] dec a ld c, a ld b, FLAG_TEST @@ -528,7 +528,7 @@ ItemUseBall: predef FlagActionPredef ld a, c push af - ld a, [wd11e] + ld a, [wPokedexNum] dec a ld c, a ld b, FLAG_SET @@ -542,7 +542,7 @@ ItemUseBall: call PrintText call ClearSprites ld a, [wEnemyMonSpecies] - ld [wd11e], a + ld [wPokedexNum], a predef ShowPokedexData .skipShowingPokedexData @@ -842,7 +842,7 @@ ItemUseMedicine: ld d, a ld a, [wCurPartySpecies] ld e, a - ld [wd0b5], a + ld [wCurSpecies], a pop af ld [wCurItem], a pop af @@ -1254,8 +1254,8 @@ ItemUseMedicine: .useVitamin push hl ld a, [hl] - ld [wd0b5], a - ld [wd11e], a + ld [wCurSpecies], a + ld [wPokedexNum], a ld bc, wPartyMon1Level - wPartyMon1 add hl, bc ; hl now points to level ld a, [hl] ; a = level @@ -1396,7 +1396,7 @@ ItemUseMedicine: ld a, d ld [wWhichPokemon], a ld a, e - ld [wd11e], a + ld [wPokedexNum], a xor a ; PLAYER_PARTY_DATA ld [wMonDataLocation], a call LoadMonData @@ -1988,7 +1988,7 @@ ItemUsePPRestore: call GetSelectedMoveOffset push hl ld a, [hl] - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMoveName call CopyToStringBuffer pop hl @@ -2009,7 +2009,7 @@ ItemUsePPRestore: add 1 << 6 ; increase PP Up count by 1 ld [hl], a ld a, 1 ; 1 PP Up used - ld [wd11e], a + ld [wUsingPPUp], a call RestoreBonusPP ; add the bonus PP to current PP ld hl, PPIncreasedText call PrintText @@ -2162,9 +2162,9 @@ ItemUseTMHM: add NUM_TMS + NUM_HMS ; adjust HM IDs to come after TM IDs .skipAdding inc a - ld [wd11e], a + ld [wTempTMHM], a predef TMToMove ; get move ID from TM/HM ID - ld a, [wd11e] + ld a, [wTempTMHM] ld [wMoveNum], a call GetMoveName call CopyToStringBuffer @@ -2558,7 +2558,7 @@ TossItem_:: jr nz, .tooImportantToToss push hl ld a, [wCurItem] - ld [wd11e], a + ld [wNamedObjectIndex], a call GetItemName call CopyToStringBuffer ld hl, IsItOKToTossItemText @@ -2578,7 +2578,7 @@ TossItem_:: ld a, [wWhichPokemon] call RemoveItemFromInventory ld a, [wCurItem] - ld [wd11e], a + ld [wNamedObjectIndex], a call GetItemName call CopyToStringBuffer ld hl, ThrewAwayItemText @@ -2651,7 +2651,7 @@ SendNewMonToBox: inc a ld [de], a ld a, [wCurPartySpecies] - ld [wd0b5], a + ld [wCurSpecies], a ld c, a .loop inc de @@ -2893,7 +2893,7 @@ ItemUseReloadOverworldData: call LoadCurrentMapView jp UpdateSprites -; creates a list at wBuffer of maps where the mon in [wd11e] can be found. +; creates a list at wBuffer of maps where the mon in [wPokedexNum] can be found. ; this is used by the pokedex to display locations the mon can be found on the map. FindWildLocationsOfMon: ld hl, WildDataPointers @@ -2928,7 +2928,7 @@ CheckMapForMon: inc hl ld b, NUM_WILDMONS .loop - ld a, [wd11e] + ld a, [wPokedexNum] cp [hl] jr nz, .nextEntry ld a, c diff --git a/engine/items/tms.asm b/engine/items/tms.asm index f3c6db98..2da15fab 100644 --- a/engine/items/tms.asm +++ b/engine/items/tms.asm @@ -1,7 +1,7 @@ ; tests if mon [wCurPartySpecies] can learn move [wMoveNum] CanLearnTM: ld a, [wCurPartySpecies] - ld [wd0b5], a + ld [wCurSpecies], a call GetMonHeader ld hl, wMonHLearnset push hl @@ -20,17 +20,17 @@ CanLearnTM: ld b, FLAG_TEST predef_jump FlagActionPredef -; converts TM/HM number in wd11e into move number +; converts TM/HM number in [wTempTMHM] into move number ; HMs start at 51 TMToMove: - ld a, [wd11e] + ld a, [wTempTMHM] dec a ld hl, TechnicalMachines ld b, $0 ld c, a add hl, bc ld a, [hl] - ld [wd11e], a + ld [wTempTMHM], a ret INCLUDE "data/moves/tmhm_moves.asm" diff --git a/engine/link/cable_club.asm b/engine/link/cable_club.asm index 4ade66e3..cbb8a358 100644 --- a/engine/link/cable_club.asm +++ b/engine/link/cable_club.asm @@ -660,7 +660,7 @@ TradeCenter_PrintPartyListNames: ld a, [de] cp $ff ret z - ld [wd11e], a + ld [wNamedObjectIndex], a push bc push hl push de @@ -697,7 +697,7 @@ TradeCenter_Trade: ld b, 0 add hl, bc ld a, [hl] - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMonName ld hl, wNameBuffer ld de, wNameOfPlayerMonToBeTraded @@ -709,7 +709,7 @@ TradeCenter_Trade: ld b, 0 add hl, bc ld a, [hl] - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMonName ld hl, WillBeTradedText bccoord 1, 14 diff --git a/engine/menus/league_pc.asm b/engine/menus/league_pc.asm index 849c6e03..17d58c55 100644 --- a/engine/menus/league_pc.asm +++ b/engine/menus/league_pc.asm @@ -84,7 +84,7 @@ LeaguePCShowMon: ld a, [hli] ld [wHoFMonSpecies], a ld [wCurPartySpecies], a - ld [wd0b5], a + ld [wCurSpecies], a ld [wBattleMonSpecies2], a ld [wWholeScreenPaletteMonSpecies], a ld a, [hli] diff --git a/engine/menus/naming_screen.asm b/engine/menus/naming_screen.asm index 25d69ca9..33556e26 100644 --- a/engine/menus/naming_screen.asm +++ b/engine/menus/naming_screen.asm @@ -9,7 +9,7 @@ AskName: ld c, 11 call z, ClearScreenArea ; only if in wild battle ld a, [wCurPartySpecies] - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMonName ld hl, DoYouWantToNicknameText call PrintText @@ -462,7 +462,7 @@ PrintNamingText: push af farcall WriteMonPartySpriteOAMBySpecies pop af - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMonName hlcoord 4, 1 call PlaceString diff --git a/engine/menus/pokedex.asm b/engine/menus/pokedex.asm index f746c809..7710815b 100644 --- a/engine/menus/pokedex.asm +++ b/engine/menus/pokedex.asm @@ -9,7 +9,7 @@ ShowPokedexMenu: ld [wListScrollOffset], a ld [wLastMenuItem], a inc a - ld [wd11e], a + ld [wPokedexNum], a ldh [hJoy7], a .setUpGraphics ld b, SET_PAL_GENERIC @@ -68,8 +68,8 @@ HandlePokedexSideMenu: push af add b inc a - ld [wd11e], a - ld a, [wd11e] + ld [wPokedexNum], a + ld a, [wPokedexNum] push af ld a, [wDexMaxSeenMon] push af ; this doesn't need to be preserved @@ -111,7 +111,7 @@ HandlePokedexSideMenu: pop af ld [wDexMaxSeenMon], a pop af - ld [wd11e], a + ld [wPokedexNum], a pop af ld [wListScrollOffset], a pop af @@ -142,7 +142,7 @@ HandlePokedexSideMenu: ; play pokemon cry .choseCry - ld a, [wd11e] + ld a, [wPokedexNum] call GetCryData call PlaySound jr .handleMenuInput @@ -222,7 +222,7 @@ HandlePokedexListMenu: call ClearScreenArea hlcoord 1, 3 ld a, [wListScrollOffset] - ld [wd11e], a + ld [wPokedexNum], a ld d, 7 ld a, [wDexMaxSeenMon] cp 7 @@ -233,17 +233,17 @@ HandlePokedexListMenu: ; loop to print pokemon pokedex numbers and names ; if the player has owned the pokemon, it puts a pokeball beside the name .printPokemonLoop - ld a, [wd11e] + ld a, [wPokedexNum] inc a - ld [wd11e], a + ld [wPokedexNum], a push af push de push hl ld de, -SCREEN_WIDTH add hl, de - ld de, wd11e + ld de, wPokedexNum lb bc, LEADING_ZEROES | 1, 3 - call PrintNumber ; print the pokedex number + call PrintNumber ld de, SCREEN_WIDTH add hl, de dec hl @@ -276,7 +276,7 @@ HandlePokedexListMenu: add hl, bc pop de pop af - ld [wd11e], a + ld [wPokedexNum], a dec d jr nz, .printPokemonLoop ld a, 01 @@ -376,10 +376,10 @@ PokedexMenuItemsText: ; tests if a pokemon's bit is set in the seen or owned pokemon bit fields ; INPUT: -; [wd11e] = pokedex number +; [wPokedexNum] = pokedex number ; hl = address of bit field IsPokemonBitSet: - ld a, [wd11e] + ld a, [wPokedexNum] dec a ld c, a ld b, FLAG_TEST @@ -403,13 +403,13 @@ ShowPokedexDataInternal: ldh [rNR50], a call GBPalWhiteOut ; zero all palettes call ClearScreen - ld a, [wd11e] ; pokemon ID + ld a, [wPokedexNum] ld [wCurPartySpecies], a push af ld b, SET_PAL_POKEDEX call RunPaletteCommand pop af - ld [wd11e], a + ld [wPokedexNum], a ldh a, [hTileAnimations] push af xor a @@ -455,7 +455,7 @@ ShowPokedexDataInternal: call PlaceString ld hl, PokedexEntryPointers - ld a, [wd11e] + ld a, [wPokedexNum] dec a ld e, a ld d, 0 @@ -471,7 +471,7 @@ ShowPokedexDataInternal: ld h, b ld l, c push de - ld a, [wd11e] + ld a, [wPokedexNum] push af call IndexToPokedex @@ -480,16 +480,16 @@ ShowPokedexDataInternal: ld [hli], a ld a, "" ld [hli], a - ld de, wd11e + ld de, wPokedexNum lb bc, LEADING_ZEROES | 1, 3 call PrintNumber ; print pokedex number ld hl, wPokedexOwned call IsPokemonBitSet pop af - ld [wd11e], a + ld [wPokedexNum], a ld a, [wCurPartySpecies] - ld [wd0b5], a + ld [wCurSpecies], a pop de push af @@ -624,10 +624,10 @@ DrawTileLine: INCLUDE "data/pokemon/dex_entries.asm" PokedexToIndex: - ; converts the Pokédex number at wd11e to an index + ; converts the Pokédex number at [wPokedexNum] to an index push bc push hl - ld a, [wd11e] + ld a, [wPokedexNum] ld b, a ld c, 0 ld hl, PokedexOrder @@ -639,23 +639,23 @@ PokedexToIndex: jr nz, .loop ld a, c - ld [wd11e], a + ld [wPokedexNum], a pop hl pop bc ret IndexToPokedex: - ; converts the index number at wd11e to a Pokédex number + ; converts the index number at [wPokedexNum] to a Pokédex number push bc push hl - ld a, [wd11e] + ld a, [wPokedexNum] dec a ld hl, PokedexOrder ld b, 0 ld c, a add hl, bc ld a, [hl] - ld [wd11e], a + ld [wPokedexNum], a pop hl pop bc ret diff --git a/engine/menus/start_sub_menus.asm b/engine/menus/start_sub_menus.asm index 5417e3e0..7b0455d0 100644 --- a/engine/menus/start_sub_menus.asm +++ b/engine/menus/start_sub_menus.asm @@ -365,7 +365,7 @@ StartMenu_Item:: jp ItemMenuLoop .useOrTossItem ; if the player made the choice to use or toss the item ld a, [wCurItem] - ld [wd11e], a + ld [wNamedObjectIndex], a call GetItemName call CopyToStringBuffer ld a, [wCurItem] diff --git a/engine/movie/credits.asm b/engine/movie/credits.asm index a9b6efbd..bdd66e8e 100644 --- a/engine/movie/credits.asm +++ b/engine/movie/credits.asm @@ -60,7 +60,7 @@ DisplayCreditsMon: add hl, bc ; go that far in the list of monsters and get the next one ld a, [hl] ld [wCurPartySpecies], a - ld [wd0b5], a + ld [wCurSpecies], a hlcoord 8, 6 call GetMonHeader call LoadFrontSpriteByMonIndex diff --git a/engine/movie/evolution.asm b/engine/movie/evolution.asm index d7a47885..69463bfa 100644 --- a/engine/movie/evolution.asm +++ b/engine/movie/evolution.asm @@ -4,7 +4,7 @@ EvolveMon: push bc ld a, [wCurPartySpecies] push af - ld a, [wd0b5] + ld a, [wCurSpecies] push af xor a ld [wLowHealthAlarm], a @@ -26,7 +26,7 @@ EvolveMon: call EvolutionSetWholeScreenPalette ld a, [wEvoNewSpecies] ld [wCurPartySpecies], a - ld [wd0b5], a + ld [wCurSpecies], a call Evolution_LoadPic ld de, vFrontPic ld hl, vBackPic @@ -34,7 +34,7 @@ EvolveMon: call CopyVideoData ld a, [wEvoOldSpecies] ld [wCurPartySpecies], a - ld [wd0b5], a + ld [wCurSpecies], a call Evolution_LoadPic ld a, $1 ldh [hAutoBGTransferEnabled], a @@ -75,7 +75,7 @@ EvolveMon: ld c, 0 call EvolutionSetWholeScreenPalette pop af - ld [wd0b5], a + ld [wCurSpecies], a pop af ld [wCurPartySpecies], a pop bc diff --git a/engine/movie/hall_of_fame.asm b/engine/movie/hall_of_fame.asm index 2344dce3..a43ec5da 100644 --- a/engine/movie/hall_of_fame.asm +++ b/engine/movie/hall_of_fame.asm @@ -102,7 +102,7 @@ HoFShowMonOrPlayer: ldh [hSCX], a ld a, [wHoFMonSpecies] ld [wCurPartySpecies], a - ld [wd0b5], a + ld [wCurSpecies], a ld [wBattleMonSpecies2], a ld [wWholeScreenPaletteMonSpecies], a ld a, [wHoFMonOrPlayer] @@ -171,7 +171,7 @@ HoFDisplayMonInfo: hlcoord 8, 7 call PrintLevelCommon ld a, [wHoFMonSpecies] - ld [wd0b5], a + ld [wCurSpecies], a hlcoord 3, 9 predef PrintMonType ld a, [wHoFMonSpecies] diff --git a/engine/movie/oak_speech/oak_speech.asm b/engine/movie/oak_speech/oak_speech.asm index ded8a7c3..44b236c8 100644 --- a/engine/movie/oak_speech/oak_speech.asm +++ b/engine/movie/oak_speech/oak_speech.asm @@ -73,7 +73,7 @@ OakSpeech: call GBFadeOutToWhite call ClearScreen ld a, NIDORINO - ld [wd0b5], a + ld [wCurSpecies], a ld [wCurPartySpecies], a call GetMonHeader hlcoord 6, 4 diff --git a/engine/movie/title.asm b/engine/movie/title.asm index b515a984..3c7ca27d 100644 --- a/engine/movie/title.asm +++ b/engine/movie/title.asm @@ -362,7 +362,7 @@ ClearBothBGMaps: LoadTitleMonSprite: ld [wCurPartySpecies], a - ld [wd0b5], a + ld [wCurSpecies], a hlcoord 5, 10 call GetMonHeader jp LoadFrontSpriteByMonIndex diff --git a/engine/movie/trade.asm b/engine/movie/trade.asm index a7ccb6b8..14a53a24 100644 --- a/engine/movie/trade.asm +++ b/engine/movie/trade.asm @@ -186,14 +186,14 @@ LoadTradingGFXAndMonNames: xor a ldh [hAutoBGTransferEnabled], a ld a, [wTradedPlayerMonSpecies] - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMonName ld hl, wNameBuffer ld de, wStringBuffer ld bc, NAME_LENGTH call CopyData ld a, [wTradedEnemyMonSpecies] - ld [wd11e], a + ld [wNamedObjectIndex], a jp GetMonName Trade_LoadMonPartySpriteGfx: @@ -728,7 +728,7 @@ Trade_CircleOAM3: ; a = species Trade_LoadMonSprite: ld [wCurPartySpecies], a - ld [wd0b5], a + ld [wCurSpecies], a ld [wWholeScreenPaletteMonSpecies], a ld b, SET_PAL_POKEMON_WHOLE_SCREEN ld c, 0 diff --git a/engine/movie/trade2.asm b/engine/movie/trade2.asm index a564862b..d4a4b635 100644 --- a/engine/movie/trade2.asm +++ b/engine/movie/trade2.asm @@ -3,10 +3,10 @@ Trade_PrintPlayerMonInfoText: ld de, Trade_MonInfoText call PlaceString ld a, [wTradedPlayerMonSpecies] - ld [wd11e], a + ld [wPokedexNum], a predef IndexToPokedex hlcoord 9, 0 - ld de, wd11e + ld de, wPokedexNum lb bc, LEADING_ZEROES | 1, 3 call PrintNumber hlcoord 5, 2 @@ -25,10 +25,10 @@ Trade_PrintEnemyMonInfoText: ld de, Trade_MonInfoText call PlaceString ld a, [wTradedEnemyMonSpecies] - ld [wd11e], a + ld [wPokedexNum], a predef IndexToPokedex hlcoord 9, 10 - ld de, wd11e + ld de, wPokedexNum lb bc, LEADING_ZEROES | 1, 3 call PrintNumber hlcoord 5, 12 diff --git a/engine/pokemon/add_mon.asm b/engine/pokemon/add_mon.asm index ab167a24..7eaca222 100644 --- a/engine/pokemon/add_mon.asm +++ b/engine/pokemon/add_mon.asm @@ -65,7 +65,7 @@ _AddPartyMon:: ld d, h push hl ld a, [wCurPartySpecies] - ld [wd0b5], a + ld [wCurSpecies], a call GetMonHeader ld hl, wMonHeader ld a, [hli] @@ -81,11 +81,11 @@ _AddPartyMon:: ; If the mon is being added to the player's party, update the pokedex. ld a, [wCurPartySpecies] - ld [wd11e], a + ld [wPokedexNum], a push de predef IndexToPokedex pop de - ld a, [wd11e] + ld a, [wPokedexNum] dec a ld c, a ld b, FLAG_TEST @@ -93,7 +93,7 @@ _AddPartyMon:: call FlagAction ld a, c ; whether the mon was already flagged as owned ld [wUnusedAlreadyOwnedFlag], a - ld a, [wd11e] + ld a, [wPokedexNum] dec a ld c, a ld b, FLAG_SET @@ -323,9 +323,9 @@ _AddEnemyMonToPlayerParty:: ld bc, NAME_LENGTH call CopyData ; write new mon's nickname (from an enemy mon) ld a, [wCurPartySpecies] - ld [wd11e], a + ld [wPokedexNum], a predef IndexToPokedex - ld a, [wd11e] + ld a, [wPokedexNum] dec a ld c, a ld b, FLAG_SET diff --git a/engine/pokemon/evos_moves.asm b/engine/pokemon/evos_moves.asm index aae6cb87..268e522a 100644 --- a/engine/pokemon/evos_moves.asm +++ b/engine/pokemon/evos_moves.asm @@ -135,7 +135,7 @@ Evolution_PartyMonLoop: ; loop over party mons call PrintText pop hl ld a, [hl] - ld [wd0b5], a + ld [wCurSpecies], a ld [wLoadedMonSpecies], a ld [wEvoNewSpecies], a ld a, MONSTER_NAME @@ -153,22 +153,22 @@ Evolution_PartyMonLoop: ; loop over party mons call DelayFrames call ClearScreen call RenameEvolvedMon - ld a, [wd11e] + ld a, [wPokedexNum] push af - ld a, [wd0b5] - ld [wd11e], a + ld a, [wCurSpecies] + ld [wPokedexNum], a predef IndexToPokedex - ld a, [wd11e] + ld a, [wPokedexNum] dec a ld hl, BaseStats ld bc, BASE_DATA_SIZE call AddNTimes ld de, wMonHeader call CopyData - ld a, [wd0b5] + ld a, [wCurSpecies] ld [wMonHIndex], a pop af - ld [wd11e], a + ld [wPokedexNum], a ld hl, wLoadedMonHPExp - 1 ld de, wLoadedMonStats ld b, $1 @@ -203,8 +203,8 @@ Evolution_PartyMonLoop: ; loop over party mons dec hl pop bc call CopyData - ld a, [wd0b5] - ld [wd11e], a + ld a, [wCurSpecies] + ld [wPokedexNum], a xor a ld [wMonDataLocation], a call LearnMoveFromLevelUp @@ -214,7 +214,7 @@ Evolution_PartyMonLoop: ; loop over party mons and a call z, Evolution_ReloadTilesetTilePatterns predef IndexToPokedex - ld a, [wd11e] + ld a, [wPokedexNum] dec a ld c, a ld b, FLAG_SET @@ -260,13 +260,14 @@ Evolution_PartyMonLoop: ; loop over party mons RenameEvolvedMon: ; Renames the mon to its new, evolved form's standard name unless it had a ; nickname, in which case the nickname is kept. - ld a, [wd0b5] + assert wCurSpecies == wNameListIndex ; save+restore wCurSpecies while using wNameListIndex + ld a, [wCurSpecies] push af ld a, [wMonHIndex] - ld [wd0b5], a + ld [wNameListIndex], a call GetName pop af - ld [wd0b5], a + ld [wCurSpecies], a ld hl, wNameBuffer ld de, wStringBuffer .compareNamesLoop @@ -319,7 +320,7 @@ Evolution_ReloadTilesetTilePatterns: LearnMoveFromLevelUp: ld hl, EvosMovesPointerTable - ld a, [wd11e] ; species + ld a, [wPokedexNum] ; species ld [wCurPartySpecies], a dec a ld bc, 0 @@ -366,13 +367,13 @@ LearnMoveFromLevelUp: jr nz, .checkCurrentMovesLoop ld a, d ld [wMoveNum], a - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMoveName call CopyToStringBuffer predef LearnMove .done ld a, [wCurPartySpecies] - ld [wd11e], a + ld [wPokedexNum], a ret ; writes the moves a mon has at level [wCurEnemyLevel] to [de] diff --git a/engine/pokemon/experience.asm b/engine/pokemon/experience.asm index 427d2a7f..d651321a 100644 --- a/engine/pokemon/experience.asm +++ b/engine/pokemon/experience.asm @@ -1,7 +1,7 @@ ; calculates the level a mon should be based on its current exp CalcLevelFromExperience:: ld a, [wLoadedMonSpecies] - ld [wd0b5], a + ld [wCurSpecies], a call GetMonHeader ld d, $1 ; init level to 1 .loop diff --git a/engine/pokemon/learn_move.asm b/engine/pokemon/learn_move.asm index 981fe13a..2df9964e 100644 --- a/engine/pokemon/learn_move.asm +++ b/engine/pokemon/learn_move.asm @@ -29,7 +29,7 @@ DontAbandonLearning: jp c, AbandonLearning push hl push de - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMoveName ld hl, OneTwoAndText call PrintText diff --git a/engine/pokemon/load_mon_data.asm b/engine/pokemon/load_mon_data.asm index 3d0548e0..7a39f083 100644 --- a/engine/pokemon/load_mon_data.asm +++ b/engine/pokemon/load_mon_data.asm @@ -19,7 +19,7 @@ LoadMonData_:: .GetMonHeader ld a, [wCurPartySpecies] - ld [wd0b5], a ; input for GetMonHeader + ld [wCurSpecies], a call GetMonHeader ld hl, wPartyMons diff --git a/engine/pokemon/set_types.asm b/engine/pokemon/set_types.asm index e9235f13..2cf8f14c 100644 --- a/engine/pokemon/set_types.asm +++ b/engine/pokemon/set_types.asm @@ -1,10 +1,10 @@ -; updates the types of a party mon (pointed to in hl) to the ones of the mon specified in wd11e +; updates the types of a party mon (pointed to in hl) to the ones of the mon specified in [wPokedexNum] SetPartyMonTypes: call GetPredefRegisters ld bc, wPartyMon1Type - wPartyMon1 ; $5 add hl, bc - ld a, [wd11e] - ld [wd0b5], a + ld a, [wPokedexNum] + ld [wCurSpecies], a push hl call GetMonHeader pop hl diff --git a/engine/pokemon/status_screen.asm b/engine/pokemon/status_screen.asm index 4ae4327a..8d377f79 100644 --- a/engine/pokemon/status_screen.asm +++ b/engine/pokemon/status_screen.asm @@ -139,11 +139,11 @@ StatusScreen: hlcoord 14, 2 call PrintLevel ; Pokémon level ld a, [wMonHIndex] - ld [wd11e], a - ld [wd0b5], a + ld [wPokedexNum], a + ld [wCurSpecies], a predef IndexToPokedex hlcoord 3, 7 - ld de, wd11e + ld de, wPokedexNum lb bc, LEADING_ZEROES | 1, 3 call PrintNumber ; Pokémon no. hlcoord 11, 10 @@ -420,7 +420,7 @@ StatusScreen2: hlcoord 9, 1 call StatusScreen_ClearName ld a, [wMonHIndex] - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMonName hlcoord 9, 1 call PlaceString diff --git a/home/give.asm b/home/give.asm index 8ede4ea4..9f51450a 100644 --- a/home/give.asm +++ b/home/give.asm @@ -3,7 +3,7 @@ GiveItem:: ; and copy the item's name to wStringBuffer. ; Return carry on success. ld a, b - ld [wd11e], a + ld [wNamedObjectIndex], a ld [wCurItem], a ld a, c ld [wItemQuantity], a diff --git a/home/list_menu.asm b/home/list_menu.asm index ca369a82..f04684a3 100644 --- a/home/list_menu.asm +++ b/home/list_menu.asm @@ -141,7 +141,7 @@ DisplayListMenuIDLoop:: ld [wMaxItemQuantity], a .skipGettingQuantity ld a, [wCurItem] - ld [wd0b5], a + ld [wNameListIndex], a ld a, BANK(ItemNames) ld [wPredefBank], a call GetName @@ -367,7 +367,7 @@ PrintListMenuEntries:: ld a, b ld [wWhichPokemon], a ld a, [de] - ld [wd11e], a + ld [wNamedObjectIndex], a cp $ff jp z, .printCancelMenuItem push bc @@ -427,7 +427,7 @@ PrintListMenuEntries:: and a ; PCPOKEMONLISTMENU? jr nz, .skipPrintingPokemonLevel .printPokemonLevel - ld a, [wd11e] + ld a, [wNamedObjectIndex] push af push hl ld hl, wPartyCount @@ -460,7 +460,7 @@ PrintListMenuEntries:: add hl, bc call PrintLevel pop af - ld [wd11e], a + ld [wNamedObjectIndex], a .skipPrintingPokemonLevel pop hl pop de @@ -469,7 +469,7 @@ PrintListMenuEntries:: cp ITEMLISTMENU jr nz, .nextListEntry .printItemQuantity - ld a, [wd11e] + ld a, [wNamedObjectIndex] ld [wCurItem], a call IsKeyItem ; check if item is unsellable ld a, [wIsKeyItem] @@ -480,18 +480,18 @@ PrintListMenuEntries:: add hl, bc ld a, "×" ld [hli], a - ld a, [wd11e] + ld a, [wNamedObjectIndex] push af ld a, [de] ld [wMaxItemQuantity], a push de - ld de, wd11e + ld de, wTempByteValue ld [de], a lb bc, 1, 2 call PrintNumber pop de pop af - ld [wd11e], a + ld [wNamedObjectIndex], a pop hl .skipPrintingItemQuantity inc de diff --git a/home/map_objects.asm b/home/map_objects.asm index 01dd8b6a..342139dd 100644 --- a/home/map_objects.asm +++ b/home/map_objects.asm @@ -71,7 +71,7 @@ IsItemInBag:: ret DisplayPokedex:: - ld [wd11e], a + ld [wPokedexNum], a farjp _DisplayPokedex SetSpriteFacingDirectionAndDelay:: diff --git a/home/names.asm b/home/names.asm index 2e5e1501..7330a065 100644 --- a/home/names.asm +++ b/home/names.asm @@ -5,7 +5,7 @@ GetMonName:: ld a, BANK(MonsterNames) ldh [hLoadedROMBank], a ld [MBC1RomBank], a - ld a, [wd11e] + ld a, [wNamedObjectIndex] dec a ld hl, MonsterNames ld c, NAME_LENGTH - 1 @@ -25,14 +25,14 @@ GetMonName:: ret GetItemName:: -; given an item ID at [wd11e], store the name of the item in wNameBuffer +; given an item ID at [wNamedObjectIndex], store the name of the item in wNameBuffer push hl push bc - ld a, [wd11e] + ld a, [wNamedObjectIndex] cp HM01 ; is this a TM/HM? jr nc, .Machine - ld [wd0b5], a + ld [wNameListIndex], a ld a, ITEM_NAME ld [wNameListType], a ld a, BANK(ItemNames) @@ -49,18 +49,18 @@ GetItemName:: ret GetMachineName:: -; copies the name of the TM/HM in [wd11e] to wNameBuffer +; copies the name of the TM/HM in [wNamedObjectIndex] to wNameBuffer push hl push de push bc - ld a, [wd11e] + ld a, [wNamedObjectIndex] push af cp TM01 ; is this a TM? [not HM] jr nc, .WriteTM ; if HM, then write "HM" and add NUM_HMS to the item ID, so we can reuse the ; TM printing code add NUM_HMS - ld [wd11e], a + ld [wNamedObjectIndex], a ld hl, HiddenPrefix ; points to "HM" ld bc, 2 jr .WriteMachinePrefix @@ -72,7 +72,7 @@ GetMachineName:: call CopyData ; now get the machine number and convert it to text - ld a, [wd11e] + ld a, [wNamedObjectIndex] sub TM01 - 1 ld b, "0" .FirstDigit @@ -94,7 +94,7 @@ GetMachineName:: ld a, "@" ld [de], a pop af - ld [wd11e], a + ld [wNamedObjectIndex], a pop bc pop de pop hl @@ -130,8 +130,8 @@ GetMoveName:: push hl ld a, MOVE_NAME ld [wNameListType], a - ld a, [wd11e] - ld [wd0b5], a + ld a, [wNamedObjectIndex] + ld [wNameListIndex], a ld a, BANK(MoveNames) ld [wPredefBank], a call GetName diff --git a/home/names2.asm b/home/names2.asm index cd3823fd..3bb6980c 100644 --- a/home/names2.asm +++ b/home/names2.asm @@ -10,13 +10,13 @@ NamePointers:: GetName:: ; arguments: -; [wd0b5] = which name +; [wNameListIndex] = which name ; [wNameListType] = which list ; [wPredefBank] = bank of list ; ; returns pointer to name in de - ld a, [wd0b5] - ld [wd11e], a + ld a, [wNameListIndex] + ld [wNamedObjectIndex], a ; TM names are separate from item names. ; BUG: This applies to all names instead of just items. @@ -67,7 +67,7 @@ GetName:: ld h, a ldh a, [hSwapTemp + 1] ld l, a - ld a, [wd0b5] + ld a, [wNameListIndex] ld b, a ; wanted entry ld c, 0 ; entry counter .nextName diff --git a/home/pokemon.asm b/home/pokemon.asm index 9fcf5622..54d69bba 100644 --- a/home/pokemon.asm +++ b/home/pokemon.asm @@ -99,12 +99,12 @@ LoadFlippedFrontSpriteByMonIndex:: LoadFrontSpriteByMonIndex:: push hl - ld a, [wd11e] + ld a, [wPokedexNum] push af ld a, [wCurPartySpecies] - ld [wd11e], a + ld [wPokedexNum], a predef IndexToPokedex - ld hl, wd11e + ld hl, wPokedexNum ld a, [hl] pop bc ld [hl], b @@ -355,8 +355,8 @@ PrintLevelFull:: ld a, [wLoadedMonLevel] ; level PrintLevelCommon:: - ld [wd11e], a - ld de, wd11e + ld [wTempByteValue], a + ld de, wTempByteValue ld b, LEFT_ALIGN | 1 ; 1 byte jp PrintNumber @@ -371,7 +371,7 @@ GetwMoves:: ; copies the base stat data of a pokemon to wMonHeader ; INPUT: -; [wd0b5] = pokemon ID +; [wCurSpecies] = pokemon ID GetMonHeader:: ldh a, [hLoadedROMBank] push af @@ -381,10 +381,10 @@ GetMonHeader:: push bc push de push hl - ld a, [wd11e] + ld a, [wPokedexNum] push af - ld a, [wd0b5] - ld [wd11e], a + ld a, [wCurSpecies] + ld [wPokedexNum], a ld de, FossilKabutopsPic ld b, $66 ; size of Kabutops fossil and Ghost sprites cp FOSSIL_KABUTOPS ; Kabutops fossil @@ -398,8 +398,8 @@ GetMonHeader:: jr z, .specialID cp MEW jr z, .mew - predef IndexToPokedex ; convert pokemon ID in [wd11e] to pokedex number - ld a, [wd11e] + predef IndexToPokedex + ld a, [wPokedexNum] dec a ld bc, BASE_DATA_SIZE ld hl, BaseStats @@ -423,10 +423,10 @@ GetMonHeader:: ld a, BANK(MewBaseStats) call FarCopyData .done - ld a, [wd0b5] + ld a, [wCurSpecies] ld [wMonHIndex], a pop af - ld [wd11e], a + ld [wPokedexNum], a pop hl pop de pop bc diff --git a/ram/wram.asm b/ram/wram.asm index a4d75707..48616226 100644 --- a/ram/wram.asm +++ b/ram/wram.asm @@ -1490,8 +1490,10 @@ wSpriteDecodeTable0Ptr:: dw ; pointer to differential decoding table (assuming initial value 1) wSpriteDecodeTable1Ptr:: dw -wd0b5:: db ; used as a temp storage area for Pokemon Species, and other Pokemon/Battle related things - +; input for GetMonHeader +wCurSpecies:: +; input for GetName +wNameListIndex:: db wNameListType:: db wPredefBank:: db @@ -1556,19 +1558,22 @@ wCapturedMonSpecies:: db ; which will be the first mon sent out. wFirstMonsNotOutYet:: db -wPokeBallCaptureCalcTemp:: -; lower nybble: number of shakes -; upper nybble: number of animations to play -wPokeBallAnimData:: +wNamedObjectIndex:: +wTempByteValue:: +wNumSetBits:: +wTypeEffectiveness:: +wMoveType:: +wPokedexNum:: +wTempTMHM:: wUsingPPUp:: wMaxPP:: +wMoveGrammar:: ; 0 for player, non-zero for enemy wCalculateWhoseStats:: -wTypeEffectiveness:: -wMoveType:: -wNumSetBits:: -; used as a Pokemon and Item storage value. Also used as an output value for CountSetBits -wd11e:: +wPokeBallCaptureCalcTemp:: +; lower nybble: number of shakes +; upper nybble: number of animations to play +wPokeBallAnimData:: db ; When this value is non-zero, the player isn't allowed to exit the party menu diff --git a/scripts/CeladonMartRoof.asm b/scripts/CeladonMartRoof.asm index b5960c81..d06fc4a2 100644 --- a/scripts/CeladonMartRoof.asm +++ b/scripts/CeladonMartRoof.asm @@ -13,15 +13,16 @@ CeladonMartRoofScript_GetDrinksInBag: jr z, .done push hl push de - ld [wd11e], a + ld [wTempByteValue], a ld b, a predef GetQuantityOfItemInBag pop de pop hl ld a, b and a - jr z, .loop ; if the item isn't in the bag - ld a, [wd11e] + jr z, .loop + ; A drink is in the bag + ld a, [wTempByteValue] ld [de], a inc de push hl @@ -192,7 +193,7 @@ CeladonMartRoofScript_PrintDrinksInBag: cp $ff ret z push hl - ld [wd11e], a + ld [wNamedObjectIndex], a call GetItemName hlcoord 2, 2 ldh a, [hItemCounter] diff --git a/scripts/ChampionsRoom.asm b/scripts/ChampionsRoom.asm index efa66680..46814138 100644 --- a/scripts/ChampionsRoom.asm +++ b/scripts/ChampionsRoom.asm @@ -281,7 +281,7 @@ ChampionsRoomOakText: ChampionsRoomOakCongratulatesPlayerText: text_asm ld a, [wPlayerStarter] - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMonName ld hl, .Text call PrintText diff --git a/scripts/CinnabarLabFossilRoom.asm b/scripts/CinnabarLabFossilRoom.asm index 4a2ff51f..e5928144 100644 --- a/scripts/CinnabarLabFossilRoom.asm +++ b/scripts/CinnabarLabFossilRoom.asm @@ -18,7 +18,7 @@ Lab4Script_GetFossilsInBag: jr z, .done push hl push de - ld [wd11e], a + ld [wTempByteValue], a ld b, a predef GetQuantityOfItemInBag pop de @@ -26,9 +26,8 @@ Lab4Script_GetFossilsInBag: ld a, b and a jr z, .loop - - ; A fossil's in the bag - ld a, [wd11e] + ; A fossil is in the bag + ld a, [wTempByteValue] ld [de], a inc de push hl diff --git a/scripts/OaksLab.asm b/scripts/OaksLab.asm index e89e0ee8..89d6ef80 100644 --- a/scripts/OaksLab.asm +++ b/scripts/OaksLab.asm @@ -322,7 +322,7 @@ OaksLabRivalChoosesStarterScript: ld a, [wRivalStarterTemp] ld [wRivalStarter], a ld [wCurPartySpecies], a - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMonName ld a, OAKSLAB_RIVAL ldh [hSpriteIndex], a @@ -825,7 +825,7 @@ OaksLabBulbasaurPokeBallText: OaksLabSelectedPokeBallScript: ld [wCurPartySpecies], a - ld [wd11e], a + ld [wPokedexNum], a ld a, b ld [wSpriteIndex], a CheckEvent EVENT_GOT_STARTER @@ -899,7 +899,7 @@ OaksLabMonChoiceMenu: jr nz, OaksLabMonChoiceEnd ld a, [wCurPartySpecies] ld [wPlayerStarter], a - ld [wd11e], a + ld [wNamedObjectIndex], a call GetMonName ld a, [wSpriteIndex] cp OAKSLAB_CHARMANDER_POKE_BALL @@ -927,7 +927,7 @@ OaksLabMonChoiceMenu: ld a, 5 ld [wCurEnemyLevel], a ld a, [wCurPartySpecies] - ld [wd11e], a + ld [wPokedexNum], a call AddPartyMon ld hl, wStatusFlags4 set BIT_GOT_STARTER, [hl] diff --git a/scripts/Route11Gate2F.asm b/scripts/Route11Gate2F.asm index 9c223c87..bc1e2e90 100644 --- a/scripts/Route11Gate2F.asm +++ b/scripts/Route11Gate2F.asm @@ -24,7 +24,7 @@ Route11Gate2FOaksAideText: ldh [hOaksAideRequirement], a ld a, ITEMFINDER ldh [hOaksAideRewardItem], a - ld [wd11e], a + ld [wNamedObjectIndex], a call GetItemName ld h, d ld l, e diff --git a/scripts/Route15Gate2F.asm b/scripts/Route15Gate2F.asm index ad1434dc..831b66e6 100644 --- a/scripts/Route15Gate2F.asm +++ b/scripts/Route15Gate2F.asm @@ -14,7 +14,7 @@ Route15Gate2FOaksAideText: ldh [hOaksAideRequirement], a ld a, EXP_ALL ldh [hOaksAideRewardItem], a - ld [wd11e], a + ld [wNamedObjectIndex], a call GetItemName ld hl, wNameBuffer ld de, wOaksAideRewardItemName diff --git a/scripts/Route2Gate.asm b/scripts/Route2Gate.asm index 8522a149..795b210e 100644 --- a/scripts/Route2Gate.asm +++ b/scripts/Route2Gate.asm @@ -14,7 +14,7 @@ Route2GateOaksAideText: ldh [hOaksAideRequirement], a ld a, HM_FLASH ldh [hOaksAideRewardItem], a - ld [wd11e], a + ld [wNamedObjectIndex], a call GetItemName ld hl, wNameBuffer ld de, wOaksAideRewardItemName -- cgit v1.3.1-sl0p