From d38cf5281a902b4bd167a46a7c9fd9db436484a7 Mon Sep 17 00:00:00 2001 From: Preeyan Parmar <4997904+preeyan@users.noreply.github.com> Date: Thu, 23 May 2024 17:43:54 +0100 Subject: [PATCH 01/19] Add comment about audio engine perfect pitch bug (#451) Co-authored-by: preeyan --- audio/engine_1.asm | 3 ++- audio/engine_2.asm | 3 ++- audio/engine_3.asm | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/audio/engine_1.asm b/audio/engine_1.asm index 8b30fb1af..24c93c9a3 100644 --- a/audio/engine_1.asm +++ b/audio/engine_1.asm @@ -831,7 +831,8 @@ Audio1_note_pitch: bit BIT_PERFECT_PITCH, [hl] ; has toggle_perfect_pitch been used? jr z, .skipFrequencyInc inc e ; if yes, increment the frequency by 1 - jr nc, .skipFrequencyInc + jr nc, .skipFrequencyInc ; Likely a mistake, because `inc` does not set flag C. + ; Fortunately this does not seem to affect any notes that actually occur. inc d .skipFrequencyInc ld hl, wChannelFrequencyLowBytes diff --git a/audio/engine_2.asm b/audio/engine_2.asm index 8783c4c62..2d15f7bb6 100644 --- a/audio/engine_2.asm +++ b/audio/engine_2.asm @@ -842,7 +842,8 @@ Audio2_note_pitch: bit BIT_PERFECT_PITCH, [hl] ; has toggle_perfect_pitch been used? jr z, .skipFrequencyInc inc e ; if yes, increment the frequency by 1 - jr nc, .skipFrequencyInc + jr nc, .skipFrequencyInc ; Likely a mistake, because `inc` does not set flag C. + ; Fortunately this does not seem to affect any notes that actually occur. inc d .skipFrequencyInc ld hl, wChannelFrequencyLowBytes diff --git a/audio/engine_3.asm b/audio/engine_3.asm index 404e6e7cf..2f1bbf96a 100644 --- a/audio/engine_3.asm +++ b/audio/engine_3.asm @@ -831,7 +831,8 @@ Audio3_note_pitch: bit BIT_PERFECT_PITCH, [hl] ; has toggle_perfect_pitch been used? jr z, .skipFrequencyInc inc e ; if yes, increment the frequency by 1 - jr nc, .skipFrequencyInc + jr nc, .skipFrequencyInc ; Likely a mistake, because `inc` does not set flag C. + ; Fortunately this does not seem to affect any notes that actually occur. inc d .skipFrequencyInc ld hl, wChannelFrequencyLowBytes 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: [PATCH 02/19] Identify some unused WRAM variables (#453) --- audio/engine_1.asm | 4 +-- audio/engine_2.asm | 4 +-- audio/engine_3.asm | 4 +-- engine/battle/animations.asm | 6 ++-- engine/battle/misc.asm | 4 +-- engine/items/item_effects.asm | 6 ++-- engine/link/cable_club.asm | 4 +-- engine/menus/main_menu.asm | 2 +- engine/menus/pokedex.asm | 2 +- engine/movie/credits.asm | 2 +- engine/movie/oak_speech/init_player_data.asm | 2 +- engine/overworld/auto_movement.asm | 4 +-- engine/overworld/clear_variables.asm | 2 +- engine/overworld/movement.asm | 2 +- engine/pokemon/add_mon.asm | 2 +- home/names2.asm | 4 +-- home/overworld.asm | 8 ++--- home/pathfinding.asm | 2 +- ram/wram.asm | 36 +++++++++----------- scripts/PokemonTower7F.asm | 2 +- 20 files changed, 49 insertions(+), 53 deletions(-) diff --git a/audio/engine_1.asm b/audio/engine_1.asm index 24c93c9a3..99d47f37d 100644 --- a/audio/engine_1.asm +++ b/audio/engine_1.asm @@ -1342,7 +1342,7 @@ Audio1_PlaySound:: .playMusic xor a - ld [wUnusedC000], a + ld [wUnusedMusicByte], a ld [wDisableChannelOutputWhenSfxEnds], a ld [wMusicTempo + 1], a ld [wMusicWaveInstrument], a @@ -1583,7 +1583,7 @@ Audio1_PlaySound:: ld a, $77 ldh [rNR50], a ; full volume xor a - ld [wUnusedC000], a + ld [wUnusedMusicByte], a ld [wDisableChannelOutputWhenSfxEnds], a ld [wMuteAudioAndPauseMusic], a ld [wMusicTempo + 1], a diff --git a/audio/engine_2.asm b/audio/engine_2.asm index 2d15f7bb6..bcaab6946 100644 --- a/audio/engine_2.asm +++ b/audio/engine_2.asm @@ -1405,7 +1405,7 @@ Audio2_PlaySound:: .playMusic xor a - ld [wUnusedC000], a + ld [wUnusedMusicByte], a ld [wDisableChannelOutputWhenSfxEnds], a ld [wMusicTempo + 1], a ld [wMusicWaveInstrument], a @@ -1646,7 +1646,7 @@ Audio2_PlaySound:: ld a, $77 ldh [rNR50], a ; full volume xor a - ld [wUnusedC000], a + ld [wUnusedMusicByte], a ld [wDisableChannelOutputWhenSfxEnds], a ld [wMuteAudioAndPauseMusic], a ld [wMusicTempo + 1], a diff --git a/audio/engine_3.asm b/audio/engine_3.asm index 2f1bbf96a..e5d285a30 100644 --- a/audio/engine_3.asm +++ b/audio/engine_3.asm @@ -1342,7 +1342,7 @@ Audio3_PlaySound:: .playMusic xor a - ld [wUnusedC000], a + ld [wUnusedMusicByte], a ld [wDisableChannelOutputWhenSfxEnds], a ld [wMusicTempo + 1], a ld [wMusicWaveInstrument], a @@ -1583,7 +1583,7 @@ Audio3_PlaySound:: ld a, $77 ldh [rNR50], a ; full volume xor a - ld [wUnusedC000], a + ld [wUnusedMusicByte], a ld [wDisableChannelOutputWhenSfxEnds], a ld [wMuteAudioAndPauseMusic], a ld [wMusicTempo + 1], a diff --git a/engine/battle/animations.asm b/engine/battle/animations.asm index 712958bcb..41d6a2efd 100644 --- a/engine/battle/animations.asm +++ b/engine/battle/animations.asm @@ -439,7 +439,7 @@ MoveAnimation: call WaitForSoundToFinish xor a ld [wSubAnimSubEntryAddr], a - ld [wUnusedD09B], a + ld [wUnusedMoveAnimByte], a ld [wSubAnimTransform], a dec a ; NO_MOVE - 1 ld [wAnimSoundID], a @@ -1125,12 +1125,12 @@ AnimationWaterDropletsEverywhere: ld a, 16 ld [wBaseCoordY], a ld a, 0 - ld [wUnusedD08A], a + ld [wUnusedWaterDropletsByte], a call _AnimationWaterDroplets ld a, 24 ld [wBaseCoordY], a ld a, 32 - ld [wUnusedD08A], a + ld [wUnusedWaterDropletsByte], a call _AnimationWaterDroplets dec d jr nz, .loop diff --git a/engine/battle/misc.asm b/engine/battle/misc.asm index 524ec161d..4feef343b 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 diff --git a/engine/items/item_effects.asm b/engine/items/item_effects.asm index d312059a1..8d21b9643 100644 --- a/engine/items/item_effects.asm +++ b/engine/items/item_effects.asm @@ -740,7 +740,7 @@ ItemUseSurfboard: ld a, b ld [wSimulatedJoypadStatesEnd], a xor a - ld [wUnusedCD39], a + ld [wUnusedSimulatedJoypadStatesMask], a inc a ld [wSimulatedJoypadStatesIndex], a ret @@ -1553,7 +1553,7 @@ ItemUseXAccuracy: ; The Card Key is handled in a different way. ItemUseCardKey: xor a - ld [wUnusedD71F], a + ld [wUnusedCardKeyGateID], a call GetTileAndCoordsInFrontOfPlayer ld a, [GetTileAndCoordsInFrontOfPlayer] cp $18 @@ -1585,7 +1585,7 @@ ItemUseCardKey: cp e jr nz, .nextEntry3 ld a, [hl] - ld [wUnusedD71F], a + ld [wUnusedCardKeyGateID], a jr .done .nextEntry1 inc hl diff --git a/engine/link/cable_club.asm b/engine/link/cable_club.asm index 7e8560933..f10e1adae 100644 --- a/engine/link/cable_club.asm +++ b/engine/link/cable_club.asm @@ -259,9 +259,9 @@ CableClub_DoBattleOrTradeAgain: dec c jr nz, .unpatchEnemyMonsLoop ld a, LOW(wEnemyMonOT) - ld [wUnusedCF8D], a + ld [wUnusedNamePointer], a ld a, HIGH(wEnemyMonOT) - ld [wUnusedCF8D + 1], a + ld [wUnusedNamePointer + 1], a xor a ld [wTradeCenterPointerTableIndex], a ld a, SFX_STOP_ALL_MUSIC diff --git a/engine/menus/main_menu.asm b/engine/menus/main_menu.asm index 69b3b9181..e638b169b 100644 --- a/engine/menus/main_menu.asm +++ b/engine/menus/main_menu.asm @@ -150,7 +150,7 @@ LinkMenu: ld de, CableClubOptionsText call PlaceString xor a - ld [wUnusedCD37], a + ld [wUnusedLinkMenuByte], a ld [wd72d], a ld hl, wTopMenuItemY ld a, $7 diff --git a/engine/menus/pokedex.asm b/engine/menus/pokedex.asm index 96bae343e..df5d643e9 100644 --- a/engine/menus/pokedex.asm +++ b/engine/menus/pokedex.asm @@ -36,7 +36,7 @@ ShowPokedexMenu: ld [wCurrentMenuItem], a ld [wLastMenuItem], a ldh [hJoy7], a - ld [wUnusedCD3A], a + ld [wUnusedOverrideSimulatedJoypadStatesIndex], a ld [wOverrideSimulatedJoypadStatesMask], a pop af ld [wListScrollOffset], a diff --git a/engine/movie/credits.asm b/engine/movie/credits.asm index 5f258503b..cb7e37c0d 100644 --- a/engine/movie/credits.asm +++ b/engine/movie/credits.asm @@ -29,7 +29,7 @@ HallOfFamePC: ld c, 128 call DelayFrames xor a - ld [wUnusedCD3D], a ; not read + ld [wUnusedCreditsByte], a ; not read ld [wNumCreditsMonsDisplayed], a jp Credits diff --git a/engine/movie/oak_speech/init_player_data.asm b/engine/movie/oak_speech/init_player_data.asm index 44869d447..492e80688 100644 --- a/engine/movie/oak_speech/init_player_data.asm +++ b/engine/movie/oak_speech/init_player_data.asm @@ -10,7 +10,7 @@ InitPlayerData2: ld [wPlayerID + 1], a ld a, $ff - ld [wUnusedD71B], a + ld [wUnusedPlayerDataByte], a ld hl, wPartyCount call InitializeEmptyList diff --git a/engine/overworld/auto_movement.asm b/engine/overworld/auto_movement.asm index 53b70c19a..538983712 100644 --- a/engine/overworld/auto_movement.asm +++ b/engine/overworld/auto_movement.asm @@ -17,7 +17,7 @@ PlayerStepOutFromDoor:: ret .notStandingOnDoor xor a - ld [wUnusedCD3A], a + ld [wUnusedOverrideSimulatedJoypadStatesIndex], a ld [wSimulatedJoypadStatesIndex], a ld [wSimulatedJoypadStatesEnd], a ld hl, wd736 @@ -39,7 +39,7 @@ _EndNPCMovementScript:: ld [wNPCMovementScriptSpriteOffset], a ld [wNPCMovementScriptPointerTableNum], a ld [wNPCMovementScriptFunctionNum], a - ld [wUnusedCD3A], a + ld [wUnusedOverrideSimulatedJoypadStatesIndex], a ld [wSimulatedJoypadStatesIndex], a ld [wSimulatedJoypadStatesEnd], a ret diff --git a/engine/overworld/clear_variables.asm b/engine/overworld/clear_variables.asm index bbb7c986b..6bd449636 100644 --- a/engine/overworld/clear_variables.asm +++ b/engine/overworld/clear_variables.asm @@ -10,7 +10,7 @@ ClearVariablesOnEnterMap:: ldh [hJoyReleased], a ldh [hJoyHeld], a ld [wActionResultOrTookBattleTurn], a - ld [wUnusedD5A3], a + ld [wUnusedMapVariable], a ld hl, wCardKeyDoorY ld [hli], a ld [hl], a diff --git a/engine/overworld/movement.asm b/engine/overworld/movement.asm index fd26f9cbb..afcb5907e 100644 --- a/engine/overworld/movement.asm +++ b/engine/overworld/movement.asm @@ -179,7 +179,7 @@ UpdateNPCSprite: res 0, [hl] xor a ld [wSimulatedJoypadStatesIndex], a - ld [wUnusedCD3A], a + ld [wUnusedOverrideSimulatedJoypadStatesIndex], a ret .next cp WALK diff --git a/engine/pokemon/add_mon.asm b/engine/pokemon/add_mon.asm index 611aebf47..6fb074ac9 100644 --- a/engine/pokemon/add_mon.asm +++ b/engine/pokemon/add_mon.asm @@ -92,7 +92,7 @@ _AddPartyMon:: ld hl, wPokedexOwned call FlagAction ld a, c ; whether the mon was already flagged as owned - ld [wUnusedD153], a ; not read + ld [wUnusedAlreadyOwnedFlag], a ld a, [wd11e] dec a ld c, a diff --git a/home/names2.asm b/home/names2.asm index 7b905fc58..c27739d77 100644 --- a/home/names2.asm +++ b/home/names2.asm @@ -88,9 +88,9 @@ GetName:: call CopyData .gotPtr ld a, e - ld [wUnusedCF8D], a + ld [wUnusedNamePointer], a ld a, d - ld [wUnusedCF8D + 1], a + ld [wUnusedNamePointer + 1], a pop de pop bc pop hl diff --git a/home/overworld.asm b/home/overworld.asm index 885a53274..eda5428a0 100644 --- a/home/overworld.asm +++ b/home/overworld.asm @@ -491,7 +491,7 @@ WarpFound2:: ld a, [wCurMap] ld [wLastMap], a ld a, [wCurMapWidth] - ld [wUnusedD366], a ; not read + ld [wUnusedLastMapWidth], a ldh a, [hWarpDestinationMap] ld [wCurMap], a cp ROCK_TUNNEL_1F @@ -1869,7 +1869,7 @@ JoypadOverworld:: ; if done simulating button presses .doneSimulating xor a - ld [wUnusedCD3A], a + ld [wUnusedOverrideSimulatedJoypadStatesIndex], a ld [wSimulatedJoypadStatesIndex], a ld [wSimulatedJoypadStatesEnd], a ld [wJoyIgnore], a @@ -2011,7 +2011,7 @@ LoadPlayerSpriteGraphicsCommon:: LoadMapHeader:: farcall MarkTownVisitedAndLoadMissableObjects ld a, [wCurMapTileset] - ld [wUnusedD119], a + ld [wUnusedCurMapTilesetCopy], a ld a, [wCurMap] call SwitchToMapRomBank ld a, [wCurMapTileset] @@ -2308,7 +2308,7 @@ LoadMapData:: ldh [hSCY], a ldh [hSCX], a ld [wWalkCounter], a - ld [wUnusedD119], a + ld [wUnusedCurMapTilesetCopy], a ld [wWalkBikeSurfStateCopy], a ld [wSpriteSetID], a call LoadTextBoxTilePatterns diff --git a/home/pathfinding.asm b/home/pathfinding.asm index 77cb5c4b3..766e7b375 100644 --- a/home/pathfinding.asm +++ b/home/pathfinding.asm @@ -40,7 +40,7 @@ MoveSprite_:: ld [wSimulatedJoypadStatesEnd], a dec a ld [wJoyIgnore], a - ld [wUnusedCD3A], a + ld [wUnusedOverrideSimulatedJoypadStatesIndex], a ret ; divides [hDividend2] by [hDivisor2] and stores the quotient in [hQuotient2] diff --git a/ram/wram.asm b/ram/wram.asm index dd7248ca7..12a734036 100644 --- a/ram/wram.asm +++ b/ram/wram.asm @@ -1,6 +1,6 @@ SECTION "Audio RAM", WRAM0 -wUnusedC000:: db +wUnusedMusicByte:: db wSoundID:: db @@ -567,20 +567,17 @@ ENDU ds 1 wNPCMovementDirections2Index:: -wUnusedCD37:: +wUnusedLinkMenuByte:: ; number of items in wFilteredBagItems list wFilteredBagItemsCount:: db ; the next simulated joypad state is at wSimulatedJoypadStatesEnd plus this value minus 1 ; 0 if the joypad state is not being simulated wSimulatedJoypadStatesIndex:: db - ; written to but nothing ever reads it -wUnusedCD39:: db - +wUnusedSimulatedJoypadStatesMask:: db ; written to but nothing ever reads it -wUnusedCD3A:: db - +wUnusedOverrideSimulatedJoypadStatesIndex:: db ; mask indicating which real button presses can override simulated ones ; XXX is it ever not 0? wOverrideSimulatedJoypadStatesMask:: db @@ -786,7 +783,7 @@ wBadgeOrFaceTiles:: ds NUM_BADGES + 1 wTempObtainedBadgesBooleans:: ds NUM_BADGES NEXTU -wUnusedCD3D:: db +wUnusedCreditsByte:: db ; the number of credits mons that have been displayed so far wNumCreditsMonsDisplayed:: db @@ -1065,7 +1062,7 @@ wItemList:: ds 16 wListPointer:: dw ; used to store pointers, but never read -wUnusedCF8D:: dw +wUnusedNamePointer:: dw wItemPrices:: dw @@ -1397,7 +1394,7 @@ wOptionsInitialized:: wNewSlotMachineBallTile:: ; how much to add to the X/Y coord wCoordAdjustmentAmount:: -wUnusedD08A:: +wUnusedWaterDropletsByte:: db wSlideMonDelay:: @@ -1442,7 +1439,7 @@ wPartyMenuAnimMonEnabled:: ; non-zero when enabled. causes nest locations to blink on and off. ; the town selection cursor will blink regardless of what this value is wTownMapSpriteBlinkingEnabled:: -wUnusedD09B:: db +wUnusedMoveAnimByte:: db ; current destination address in OAM for frame blocks (big endian) wFBDestAddr:: dw @@ -1553,7 +1550,7 @@ wMoveNum:: db wMovesString:: ds 56 -wUnusedD119:: db +wUnusedCurMapTilesetCopy:: db ; wWalkBikeSurfState is sometimes copied here, but it doesn't seem to be used for anything wWalkBikeSurfStateCopy:: db @@ -1688,7 +1685,7 @@ wSerialPlayerDataBlock:: ; ds $1a8 ; that case, this would be ESCAPE_ROPE. wPseudoItemID:: db -wUnusedD153:: db +wUnusedAlreadyOwnedFlag:: db ds 2 @@ -1791,8 +1788,7 @@ wYBlockCoord:: db wXBlockCoord:: db wLastMap:: db - -wUnusedD366:: db +wUnusedLastMapWidth:: db wCurMapHeader:: wCurMapTileset:: db @@ -1902,7 +1898,7 @@ wCurrentBoxNum:: db ; number of HOF teams wNumHoFTeams:: db -wUnusedD5A3:: db +wUnusedMapVariable:: db wPlayerCoins:: dw ; BCD @@ -2084,7 +2080,8 @@ wLastBlackoutMap:: db ; destination map (for certain types of special warps, not ordinary walking) wDestinationMap:: db -wUnusedD71B:: db +; initialized to $ff, but nothing ever reads it +wUnusedPlayerDataByte:: db ; used to store the tile in front of the boulder when trying to push a boulder ; also used to store the result of the collision check ($ff for a collision and $00 for no collision) @@ -2096,7 +2093,7 @@ wDungeonWarpDestinationMap:: db ; which dungeon warp within the source map was used wWhichDungeonWarp:: db -wUnusedD71F:: db +wUnusedCardKeyGateID:: db ds 8 @@ -2254,8 +2251,7 @@ wTrainerHeaderPtr:: dw ; the trainer the player must face after getting a wrong answer in the Cinnabar ; gym quiz -wOpponentAfterWrongAnswer:: -wUnusedDA38:: db +wOpponentAfterWrongAnswer:: db ; index of current map script, mostly used as index for function pointer array ; mostly copied from map-specific map script pointer and written back later diff --git a/scripts/PokemonTower7F.asm b/scripts/PokemonTower7F.asm index 9991cb5f1..85cc43092 100644 --- a/scripts/PokemonTower7F.asm +++ b/scripts/PokemonTower7F.asm @@ -58,7 +58,7 @@ PokemonTower7FHideNPCScript: ld [wJoyIgnore], a ld [wSpriteIndex], a ld [wTrainerHeaderFlagBit], a - ld [wUnusedDA38], a + ld [wOpponentAfterWrongAnswer], a ; not used here; likely a mistake copied from maps/CinnabarGym.asm ld a, SCRIPT_POKEMONTOWER7F_DEFAULT ld [wPokemonTower7FCurScript], a ld [wCurMapScript], a From 70228c2c4a94a8079d5d465c802d4f0159caa592 Mon Sep 17 00:00:00 2001 From: Rangi42 Date: Fri, 28 Jun 2024 16:04:57 -0400 Subject: [PATCH 03/19] Build with RGBDS 0.8.0, though it is not yet required --- .github/workflows/main.yml | 2 +- tools/unnamed.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 03d5dc0de..0a0da0f3f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -16,7 +16,7 @@ jobs: uses: actions/checkout@master with: path: rgbds - ref: v0.7.0 + ref: v0.8.0 repository: gbdev/rgbds - name: Install rgbds diff --git a/tools/unnamed.py b/tools/unnamed.py index e6426aaf2..f3081e976 100755 --- a/tools/unnamed.py +++ b/tools/unnamed.py @@ -90,14 +90,14 @@ def read_string(file): elif magic == b'RGB9': obj_ver = 10 + unpack_from(' Date: Tue, 16 Jul 2024 13:02:54 -0400 Subject: [PATCH 04/19] Identify various flag labels and bit constants (#454) --- constants/battle_constants.asm | 9 +- constants/input_constants.asm | 16 +- constants/misc_constants.asm | 12 -- constants/ram_constants.asm | 119 +++++++++++ constants/script_constants.asm | 13 -- data/predef_pointers.asm | 2 +- data/text/text_2.asm | 4 +- engine/battle/battle_transitions.asm | 2 +- engine/battle/core.asm | 36 ++-- engine/battle/effects.asm | 4 +- engine/battle/end_of_battle.asm | 4 +- engine/battle/experience.asm | 6 +- engine/battle/read_trainer_party.asm | 8 +- engine/battle/wild_encounters.asm | 8 +- engine/debug/debug_menu.asm | 6 +- engine/debug/debug_party.asm | 2 +- engine/events/black_out.asm | 12 +- engine/events/cinnabar_lab.asm | 8 +- engine/events/diploma.asm | 8 +- engine/events/display_pokedex.asm | 8 +- .../events/hidden_objects/bills_house_pc.asm | 8 +- .../hidden_objects/school_blackboard.asm | 24 +-- engine/events/hidden_objects/town_map.asm | 8 +- engine/events/in_game_trades.asm | 6 +- engine/events/poison.asm | 9 +- engine/events/pokecenter.asm | 8 +- engine/events/prize_menu.asm | 10 +- engine/events/vending_machine.asm | 8 +- engine/gfx/sprite_oam.asm | 4 +- engine/items/item_effects.asm | 32 +-- engine/items/town_map.asm | 7 +- engine/joypad.asm | 4 +- engine/link/cable_club.asm | 4 +- engine/link/cable_club_npc.asm | 4 +- engine/menus/display_text_id_init.asm | 6 +- engine/menus/draw_start_menu.asm | 12 +- engine/menus/league_pc.asm | 4 +- engine/menus/main_menu.asm | 86 ++++---- engine/menus/naming_screen.asm | 8 +- engine/menus/party_menu.asm | 4 +- engine/menus/pc.asm | 20 +- engine/menus/players_pc.asm | 24 +-- engine/menus/pokedex.asm | 8 +- engine/menus/save.asm | 9 +- engine/menus/start_sub_menus.asm | 36 ++-- engine/menus/text_box.asm | 50 ++--- engine/movie/oak_speech/oak_speech.asm | 10 +- engine/movie/title.asm | 6 +- engine/movie/trade.asm | 8 +- engine/overworld/auto_movement.asm | 76 +++---- engine/overworld/cut.asm | 8 +- engine/overworld/emotion_bubbles.asm | 4 +- engine/overworld/field_move_messages.asm | 24 +-- engine/overworld/hidden_objects.asm | 12 +- engine/overworld/ledges.asm | 8 +- engine/overworld/movement.asm | 22 +- engine/overworld/player_animations.asm | 32 +-- engine/overworld/player_state.asm | 27 ++- engine/overworld/push_boulder.asm | 38 ++-- engine/overworld/special_warps.asm | 30 +-- engine/overworld/trainer_sight.asm | 4 +- engine/play_time.asm | 16 +- engine/pokemon/add_mon.asm | 6 +- engine/pokemon/bills_pc.asm | 20 +- engine/pokemon/evos_moves.asm | 8 +- engine/pokemon/status_screen.asm | 10 +- engine/slots/slot_machine.asm | 8 +- home/audio.asm | 4 +- home/fade_audio.asm | 4 +- home/give.asm | 2 +- home/list_menu.asm | 12 +- home/map_objects.asm | 4 +- home/move_mon.asm | 4 +- home/npc_movement.asm | 16 +- home/overworld.asm | 197 +++++++++--------- home/pathfinding.asm | 4 +- home/pokemon.asm | 8 +- home/print_text.asm | 10 +- home/reload_tiles.asm | 4 +- home/text.asm | 2 +- home/text_script.asm | 10 +- home/trainers.asm | 58 +++--- home/window.asm | 4 +- includes.asm | 1 + ram/wram.asm | 140 ++----------- scripts/BikeShop.asm | 8 +- scripts/BillsHouse.asm | 8 +- scripts/CeladonGym.asm | 6 +- scripts/CeladonMartRoof.asm | 8 +- scripts/CeruleanCity.asm | 20 +- scripts/CeruleanGym.asm | 6 +- scripts/ChampionsRoom.asm | 16 +- scripts/CinnabarGym.asm | 10 +- scripts/FightingDojo.asm | 6 +- scripts/FuchsiaGoodRodHouse.asm | 8 +- scripts/FuchsiaGym.asm | 6 +- scripts/GameCorner.asm | 18 +- scripts/HallOfFame.asm | 7 +- scripts/IndigoPlateauLobby.asm | 8 +- scripts/LoreleisRoom.asm | 4 +- scripts/MtMoonB2F.asm | 18 +- scripts/OaksLab.asm | 56 ++--- scripts/PalletTown.asm | 4 +- scripts/PewterCity.asm | 16 +- scripts/PewterGym.asm | 6 +- scripts/PokemonMansion3F.asm | 12 +- scripts/PokemonTower2F.asm | 10 +- scripts/PokemonTower5F.asm | 8 +- scripts/PokemonTower6F.asm | 10 +- scripts/PokemonTower7F.asm | 12 +- scripts/RedsHouse1F.asm | 4 +- scripts/RocketHideoutB2F.asm | 8 +- scripts/RocketHideoutB3F.asm | 10 +- scripts/RocketHideoutB4F.asm | 6 +- scripts/Route12.asm | 2 +- scripts/Route12SuperRodHouse.asm | 8 +- scripts/Route16.asm | 2 +- scripts/Route16Gate1F.asm | 8 +- scripts/Route18Gate1F.asm | 8 +- scripts/Route22.asm | 28 +-- scripts/Route24.asm | 6 +- scripts/Route5Gate.asm | 16 +- scripts/Route6Gate.asm | 12 +- scripts/Route7Gate.asm | 12 +- scripts/Route8Gate.asm | 12 +- scripts/SSAnne2F.asm | 14 +- scripts/SSAnneCaptainsRoom.asm | 12 +- scripts/SaffronGym.asm | 6 +- scripts/SeafoamIslands1F.asm | 6 +- scripts/SeafoamIslandsB1F.asm | 6 +- scripts/SeafoamIslandsB2F.asm | 6 +- scripts/SeafoamIslandsB3F.asm | 22 +- scripts/SeafoamIslandsB4F.asm | 4 +- scripts/SilphCo11F.asm | 10 +- scripts/SilphCo7F.asm | 22 +- scripts/TradeCenter.asm | 6 +- scripts/VermilionDock.asm | 4 +- scripts/VermilionGym.asm | 6 +- scripts/VermilionOldRodHouse.asm | 8 +- scripts/VictoryRoad3F.asm | 18 +- scripts/ViridianCity.asm | 2 +- scripts/ViridianGym.asm | 14 +- text/RocketHideoutB3F.asm | 2 +- 143 files changed, 1071 insertions(+), 1081 deletions(-) create mode 100644 constants/ram_constants.asm diff --git a/constants/battle_constants.asm b/constants/battle_constants.asm index 44a85e8dc..9349bb75c 100644 --- a/constants/battle_constants.asm +++ b/constants/battle_constants.asm @@ -37,9 +37,6 @@ DEF MOVE_ACC rb DEF MOVE_PP rb DEF MOVE_LENGTH EQU _RS -; D733 flags -DEF BIT_TEST_BATTLE EQU 0 - ; battle type constants (wBattleType values) const_def const BATTLE_TYPE_NORMAL ; 0 @@ -78,7 +75,7 @@ DEF SPDSPCDV_TRAINER EQU $88 ; wPlayerBattleStatus1 or wEnemyBattleStatus1 bit flags const_def const STORING_ENERGY ; 0 ; Bide - const THRASHING_ABOUT ; 1 ; e.g. Thrash + const THRASHING_ABOUT ; 1 ; Thrash, Petal Dance const ATTACKING_MULTIPLE_TIMES ; 2 ; e.g. Double Kick, Fury Attack const FLINCHED ; 3 const CHARGING_UP ; 4 ; e.g. Solar Beam, Fly @@ -95,11 +92,11 @@ DEF SPDSPCDV_TRAINER EQU $88 const HAS_SUBSTITUTE_UP ; 4 const NEEDS_TO_RECHARGE ; 5 ; Hyper Beam const USING_RAGE ; 6 - const SEEDED ; 7 + const SEEDED ; 7 ; Leech Seed ; wPlayerBattleStatus3 or wEnemyBattleStatus3 bit flags const_def - const BADLY_POISONED ; 0 + const BADLY_POISONED ; 0 ; Toxic const HAS_LIGHT_SCREEN_UP ; 1 const HAS_REFLECT_UP ; 2 const TRANSFORMED ; 3 diff --git a/constants/input_constants.asm b/constants/input_constants.asm index f9070cba0..68233dea2 100644 --- a/constants/input_constants.asm +++ b/constants/input_constants.asm @@ -1,13 +1,13 @@ ; joypad buttons const_def - const BIT_A_BUTTON - const BIT_B_BUTTON - const BIT_SELECT - const BIT_START - const BIT_D_RIGHT - const BIT_D_LEFT - const BIT_D_UP - const BIT_D_DOWN + const BIT_A_BUTTON ; 0 + const BIT_B_BUTTON ; 1 + const BIT_SELECT ; 2 + const BIT_START ; 3 + const BIT_D_RIGHT ; 4 + const BIT_D_LEFT ; 5 + const BIT_D_UP ; 6 + const BIT_D_DOWN ; 7 DEF NO_INPUT EQU 0 DEF A_BUTTON EQU 1 << BIT_A_BUTTON diff --git a/constants/misc_constants.asm b/constants/misc_constants.asm index a230b3d7a..3562042b1 100644 --- a/constants/misc_constants.asm +++ b/constants/misc_constants.asm @@ -7,15 +7,3 @@ DEF TRUE EQU 1 const FLAG_RESET ; 0 const FLAG_SET ; 1 const FLAG_TEST ; 2 - -; wOptions -DEF TEXT_DELAY_FAST EQU %001 ; 1 -DEF TEXT_DELAY_MEDIUM EQU %011 ; 3 -DEF TEXT_DELAY_SLOW EQU %101 ; 5 - - const_def 6 - const BIT_BATTLE_SHIFT ; 6 - const BIT_BATTLE_ANIMATION ; 7 - -; wd732 flags -DEF BIT_DEBUG_MODE EQU 1 diff --git a/constants/ram_constants.asm b/constants/ram_constants.asm new file mode 100644 index 000000000..42956cc68 --- /dev/null +++ b/constants/ram_constants.asm @@ -0,0 +1,119 @@ +; wMiscFlags + const_def + const BIT_SEEN_BY_TRAINER ; 0 + const BIT_BOULDER_DUST ; 1 + const BIT_TURNING ; 2 + const BIT_USING_GENERIC_PC ; 3 + const BIT_NO_SPRITE_UPDATES ; 4 + const BIT_NO_MENU_BUTTON_SOUND ; 5 + const BIT_TRIED_PUSH_BOULDER ; 6 + const BIT_PUSHED_BOULDER ; 7 + +; wOptions +DEF TEXT_DELAY_MASK EQU %111 + const_def 6 + const BIT_BATTLE_SHIFT ; 6 + const BIT_BATTLE_ANIMATION ; 7 + +DEF TEXT_DELAY_FAST EQU %001 ; 1 +DEF TEXT_DELAY_MEDIUM EQU %011 ; 3 +DEF TEXT_DELAY_SLOW EQU %101 ; 5 + +; wLetterPrintingDelayFlags + const_def + const BIT_FAST_TEXT_DELAY ; 0 + const BIT_TEXT_DELAY ; 1 + +; wObtainedBadges, wBeatGymFlags + const_def + const BIT_BOULDERBADGE ; 0 + const BIT_CASCADEBADGE ; 1 + const BIT_THUNDERBADGE ; 2 + const BIT_RAINBOWBADGE ; 3 + const BIT_SOULBADGE ; 4 + const BIT_MARSHBADGE ; 5 + const BIT_VOLCANOBADGE ; 6 + const BIT_EARTHBADGE ; 7 +DEF NUM_BADGES EQU const_value + +; wStatusFlags1 + const_def + const BIT_STRENGTH_ACTIVE ; 0 + const BIT_SURF_ALLOWED ; 1 + const_skip ; 2 ; unused + const BIT_GOT_OLD_ROD ; 3 + const BIT_GOT_GOOD_ROD ; 4 + const BIT_GOT_SUPER_ROD ; 5 + const BIT_GAVE_SAFFRON_GUARDS_DRINK ; 6 + const BIT_UNUSED_CARD_KEY ; 7 + +; wStatusFlags2 + const_def + const BIT_WILD_ENCOUNTER_COOLDOWN ; 0 + const BIT_NO_AUDIO_FADE_OUT ; 1 + +; wStatusFlags3 + const_def + const BIT_INIT_TRADE_CENTER_FACING ; 0 + const_skip 2 ; 1-2 ; unused + const BIT_WARP_FROM_CUR_SCRIPT ; 3 + const BIT_ON_DUNGEON_WARP ; 4 + const BIT_NO_NPC_FACE_PLAYER ; 5 + const BIT_TALKED_TO_TRAINER ; 6 + const BIT_PRINT_END_BATTLE_TEXT ; 7 + +; wStatusFlags4 + const_def + const BIT_GOT_LAPRAS ; 0 + const BIT_UNKNOWN_4_1 ; 1 + const BIT_USED_POKECENTER ; 2 + const BIT_GOT_STARTER ; 3 + const BIT_NO_BATTLES ; 4 + const BIT_BATTLE_OVER_OR_BLACKOUT ; 5 + const BIT_LINK_CONNECTED ; 6 + const BIT_INIT_SCRIPTED_MOVEMENT ; 7 + +; wStatusFlags5 + const_def + const BIT_SCRIPTED_NPC_MOVEMENT ; 0 + const BIT_UNKNOWN_5_1 ; 1 + const BIT_UNKNOWN_5_2 ; 2 + const_skip ; 3 ; unused + const BIT_UNKNOWN_5_4 ; 4 + const BIT_DISABLE_JOYPAD ; 5 + const BIT_NO_TEXT_DELAY ; 6 + const BIT_SCRIPTED_MOVEMENT_STATE ; 7 + +; wStatusFlags6 + const_def + const BIT_GAME_TIMER_COUNTING ; 0 + const BIT_DEBUG_MODE ; 1 + const BIT_FLY_OR_DUNGEON_WARP ; 2 + const BIT_FLY_WARP ; 3 + const BIT_DUNGEON_WARP ; 4 + const BIT_ALWAYS_ON_BIKE ; 5 + const BIT_ESCAPE_WARP ; 6 + +; wStatusFlags7 + const_def + const BIT_TEST_BATTLE ; 0 + const BIT_NO_MAP_MUSIC ; 1 + const BIT_FORCED_WARP ; 2 + const BIT_TRAINER_BATTLE ; 3 + const BIT_USE_CUR_MAP_SCRIPT ; 4 + const_skip 2 ; 5-6 ; unused + const BIT_USED_FLY ; 7 + +; wElite4Flags + const_def + const BIT_UNUSED_BEAT_ELITE_4 ; 0 + const BIT_STARTED_ELITE_4 ; 1 + +; wMovementFlags + const_def + const BIT_STANDING_ON_DOOR ; 0 + const BIT_EXITING_DOOR ; 1 + const BIT_STANDING_ON_WARP ; 2 + const_skip 3 ; 3-5 ; unused + const BIT_LEDGE_OR_FISHING ; 6 + const BIT_SPINNING ; 7 diff --git a/constants/script_constants.asm b/constants/script_constants.asm index afd1258bf..24ad93f27 100644 --- a/constants/script_constants.asm +++ b/constants/script_constants.asm @@ -39,19 +39,6 @@ DEF NUM_NPC_TRADES EQU const_value const TRADE_DIALOGSET_EVOLUTION const TRADE_DIALOGSET_HAPPY -; badges -; wObtainedBadges and wBeatGymFlags bits - const_def - const BIT_BOULDERBADGE ; 0 - const BIT_CASCADEBADGE ; 1 - const BIT_THUNDERBADGE ; 2 - const BIT_RAINBOWBADGE ; 3 - const BIT_SOULBADGE ; 4 - const BIT_MARSHBADGE ; 5 - const BIT_VOLCANOBADGE ; 6 - const BIT_EARTHBADGE ; 7 -DEF NUM_BADGES EQU const_value - ; OaksAideScript results DEF OAKS_AIDE_BAG_FULL EQU $00 DEF OAKS_AIDE_GOT_ITEM EQU $01 diff --git a/data/predef_pointers.asm b/data/predef_pointers.asm index eaef75f6c..e960d49bf 100644 --- a/data/predef_pointers.asm +++ b/data/predef_pointers.asm @@ -101,7 +101,7 @@ PredefPointers:: add_predef EnterMapAnim, $1E ; wrong bank add_predef GetTileTwoStepsInFrontOfPlayer add_predef CheckForCollisionWhenPushingBoulder - add_predef PrintStrengthTxt + add_predef PrintStrengthText add_predef PickUpItem add_predef PrintMoveType add_predef LoadMovePPs diff --git a/data/text/text_2.asm b/data/text/text_2.asm index dcb67c675..d4b1b7db9 100644 --- a/data/text/text_2.asm +++ b/data/text/text_2.asm @@ -1229,7 +1229,7 @@ _GrewLevelText:: text_ram wcd6d text " grew" line "to level @" - text_decimal wCurEnemyLVL, 1, 3 + text_decimal wCurEnemyLevel, 1, 3 text "!@" text_end @@ -1435,7 +1435,7 @@ _RareCandyText:: text_ram wcd6d text " grew" line "to level @" - text_decimal wCurEnemyLVL, 1, 3 + text_decimal wCurEnemyLevel, 1, 3 text "!@" text_end diff --git a/engine/battle/battle_transitions.asm b/engine/battle/battle_transitions.asm index 363533cec..16311f48f 100644 --- a/engine/battle/battle_transitions.asm +++ b/engine/battle/battle_transitions.asm @@ -105,7 +105,7 @@ GetBattleTransitionID_CompareLevels: ld a, [hl] add $3 ld e, a - ld a, [wCurEnemyLVL] + ld a, [wCurEnemyLevel] sub e jr nc, .highLevelEnemy res 1, c diff --git a/engine/battle/core.asm b/engine/battle/core.asm index ca3294b81..ab4d1c566 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -844,7 +844,7 @@ FaintEnemyPokemon: ; the player has exp all ; now, set the gain exp flag for every party member ; half of the total stat exp and normal exp will divided evenly amongst every party member - ld a, $1 + ld a, TRUE ld [wBoostExpByExpAll], a ld a, [wPartyCount] ld b, 0 @@ -924,8 +924,8 @@ TrainerBattleVictory: cp RIVAL3 ; final battle against rival jr nz, .notrival ld b, MUSIC_DEFEATED_GYM_LEADER - ld hl, wFlags_D733 - set 1, [hl] + ld hl, wStatusFlags7 + set BIT_NO_MAP_MUSIC, [hl] .notrival ld a, [wLinkState] cp LINK_STATE_BATTLING @@ -1157,9 +1157,9 @@ HandlePlayerBlackOut: ld hl, LinkBattleLostText .noLinkBattle call PrintText - ld a, [wd732] - res 5, a - ld [wd732], a + ld a, [wStatusFlags6] + res BIT_ALWAYS_ON_BIKE, a + ld [wStatusFlags6], a call ClearScreen scf ret @@ -1179,10 +1179,10 @@ LinkBattleLostText: ; slides pic of fainted mon downwards until it disappears ; bug: when this is called, [hAutoBGTransferEnabled] is non-zero, so there is screen tearing SlideDownFaintedMonPic: - ld a, [wd730] + ld a, [wStatusFlags5] push af - set 6, a - ld [wd730], a + set BIT_NO_TEXT_DELAY, a + ld [wStatusFlags5], a ld b, 7 ; number of times to slide .slideStepLoop ; each iteration, the mon is slid down one row push bc @@ -1221,7 +1221,7 @@ SlideDownFaintedMonPic: dec b jr nz, .slideStepLoop pop af - ld [wd730], a + ld [wStatusFlags5], a ret SevenSpacesText: @@ -1344,7 +1344,7 @@ EnemySendOutFirstMon: ld bc, wEnemyMon2 - wEnemyMon1 call AddNTimes ld a, [hl] - ld [wCurEnemyLVL], a + ld [wCurEnemyLevel], a ld a, [wWhichPokemon] inc a ld hl, wEnemyPartyCount @@ -2558,7 +2558,7 @@ MoveSelectionMenu: cp LINK_STATE_BATTLING jr z, .matchedkeyspicked ; Disable left, right, and START buttons in regular battles. - ld a, [wFlags_D733] + ld a, [wStatusFlags7] bit BIT_TEST_BATTLE, a ld b, D_UP | D_DOWN | A_BUTTON | B_BUTTON | SELECT jr z, .matchedkeyspicked @@ -2587,7 +2587,7 @@ SelectMenuItem: jr .select .battleselect ; Hide move swap cursor in TestBattle. - ld a, [wFlags_D733] + ld a, [wStatusFlags7] bit BIT_TEST_BATTLE, a ; This causes PrintMenuItem to not run in TestBattle. ; MoveSelectionMenu still draws part of its window, an issue @@ -4404,7 +4404,7 @@ GetEnemyMonStat: ret .notLinkBattle ld a, [wEnemyMonLevel] - ld [wCurEnemyLVL], a + ld [wCurEnemyLevel], a ld a, [wEnemyMonSpecies] ld [wd0b5], a call GetMonHeader @@ -6092,7 +6092,7 @@ GetCurrentMove: .player ld de, wPlayerMoveNum ; Apply InitBattleVariables to TestBattle. - ld a, [wFlags_D733] + ld a, [wStatusFlags7] bit BIT_TEST_BATTLE, a ld a, [wTestBattlePlayerSelectedMove] jr nz, .selected @@ -6143,7 +6143,7 @@ LoadEnemyMonData: ld [hli], a ld [hl], b ld de, wEnemyMonLevel - ld a, [wCurEnemyLVL] + ld a, [wCurEnemyLevel] ld [de], a inc de ld b, $0 @@ -6776,7 +6776,7 @@ InitOpponent: jr InitBattleCommon DetermineWildOpponent: - ld a, [wd732] + ld a, [wStatusFlags6] bit BIT_DEBUG_MODE, a jr z, .notDebugMode ldh a, [hJoyHeld] @@ -6794,7 +6794,7 @@ InitBattleCommon: ld hl, wLetterPrintingDelayFlags ld a, [hl] push af - res 1, [hl] + res BIT_TEXT_DELAY, [hl] ; no delay callfar InitBattleVariables ld a, [wEnemyMonSpecies2] sub OPP_ID_OFFSET diff --git a/engine/battle/effects.asm b/engine/battle/effects.asm index b94b12d22..643afeb2c 100644 --- a/engine/battle/effects.asm +++ b/engine/battle/effects.asm @@ -812,7 +812,7 @@ SwitchAndTeleportEffect: ld a, [wIsInBattle] dec a jr nz, .notWildBattle1 - ld a, [wCurEnemyLVL] + ld a, [wCurEnemyLevel] ld b, a ld a, [wBattleMonLevel] cp b ; is the player's level greater than the enemy's level? @@ -856,7 +856,7 @@ SwitchAndTeleportEffect: jr nz, .notWildBattle2 ld a, [wBattleMonLevel] ld b, a - ld a, [wCurEnemyLVL] + ld a, [wCurEnemyLevel] cp b jr nc, .enemyMoveWasSuccessful add b diff --git a/engine/battle/end_of_battle.asm b/engine/battle/end_of_battle.asm index b9f9d537e..80fdf002e 100644 --- a/engine/battle/end_of_battle.asm +++ b/engine/battle/end_of_battle.asm @@ -66,8 +66,8 @@ EndOfBattle: ld [hli], a dec b jr nz, .loop - ld hl, wd72c - set 0, [hl] + ld hl, wStatusFlags2 + set BIT_WILD_ENCOUNTER_COOLDOWN, [hl] call WaitForSoundToFinish call GBPalWhiteOut ld a, $ff diff --git a/engine/battle/experience.asm b/engine/battle/experience.asm index 0eab6e085..798d7ce14 100644 --- a/engine/battle/experience.asm +++ b/engine/battle/experience.asm @@ -160,11 +160,11 @@ GainExperience: ld a, [hl] ; current level cp d jp z, .nextMon ; if level didn't change, go to next mon - ld a, [wCurEnemyLVL] + ld a, [wCurEnemyLevel] push af push hl ld a, d - ld [wCurEnemyLVL], a + ld [wCurEnemyLevel], a ld [hl], a ld bc, wPartyMon1Species - wPartyMon1Level add hl, bc @@ -261,7 +261,7 @@ GainExperience: predef FlagActionPredef pop hl pop af - ld [wCurEnemyLVL], a + ld [wCurEnemyLevel], a .nextMon ld a, [wPartyCount] diff --git a/engine/battle/read_trainer_party.asm b/engine/battle/read_trainer_party.asm index a9e09a304..a88b0dfcc 100644 --- a/engine/battle/read_trainer_party.asm +++ b/engine/battle/read_trainer_party.asm @@ -49,7 +49,7 @@ ReadTrainer: ld a, [hli] cp $FF ; is the trainer special? jr z, .SpecialTrainer ; if so, check for special moves - ld [wCurEnemyLVL], a + ld [wCurEnemyLevel], a .LoopTrainerData ld a, [hli] and a ; have we reached the end of the trainer data? @@ -69,7 +69,7 @@ ReadTrainer: ld a, [hli] and a ; have we reached the end of the trainer data? jr z, .AddLoneMove - ld [wCurEnemyLVL], a + ld [wCurEnemyLevel], a ld a, [hli] ld [wcf91], a ld a, ENEMY_PARTY_DATA @@ -150,7 +150,7 @@ ReadTrainer: ld [de], a inc de ld [de], a - ld a, [wCurEnemyLVL] + ld a, [wCurEnemyLevel] ld b, a .LastLoop ; update wAmountMoneyWon addresses (money to win) based on enemy's level @@ -162,5 +162,5 @@ ReadTrainer: inc de inc de dec b - jr nz, .LastLoop ; repeat wCurEnemyLVL times + jr nz, .LastLoop ; repeat wCurEnemyLevel times ret diff --git a/engine/battle/wild_encounters.asm b/engine/battle/wild_encounters.asm index 8c9c15296..eede46ed6 100644 --- a/engine/battle/wild_encounters.asm +++ b/engine/battle/wild_encounters.asm @@ -4,8 +4,8 @@ TryDoWildEncounter: ld a, [wNPCMovementScriptPointerTableNum] and a ret nz - ld a, [wd736] - and a + ld a, [wMovementFlags] + and a ; is player exiting a door, jumping over a ledge, or fishing? ret nz callfar IsPlayerStandingOnDoorTileOrWarpTile jr nc, .notStandingOnDoorOrWarpTile @@ -74,7 +74,7 @@ TryDoWildEncounter: ld b, 0 add hl, bc ld a, [hli] - ld [wCurEnemyLVL], a + ld [wCurEnemyLevel], a ld a, [hl] ld [wcf91], a ld [wEnemyMonSpecies2], a @@ -83,7 +83,7 @@ TryDoWildEncounter: jr z, .willEncounter ld a, [wPartyMon1Level] ld b, a - ld a, [wCurEnemyLVL] + ld a, [wCurEnemyLevel] cp b jr c, .CantEncounter2 ; repel prevents encounters if the leading party mon's level is higher than the wild mon jr .willEncounter diff --git a/engine/debug/debug_menu.asm b/engine/debug/debug_menu.asm index fbf136fe5..06c2ace15 100644 --- a/engine/debug/debug_menu.asm +++ b/engine/debug/debug_menu.asm @@ -55,7 +55,7 @@ IF DEF(_DEBUG) jp z, TestBattle ; DEBUG - ld hl, wd732 + ld hl, wStatusFlags6 set BIT_DEBUG_MODE, [hl] jp StartNewGameDebug @@ -80,7 +80,7 @@ TestBattle: ; unreferenced except in _DEBUG ld a, 1 << BIT_EARTHBADGE ld [wObtainedBadges], a - ld hl, wFlags_D733 + ld hl, wStatusFlags7 set BIT_TEST_BATTLE, [hl] ; wNumBagItems and wBagItems are not initialized here, @@ -100,7 +100,7 @@ TestBattle: ; unreferenced except in _DEBUG ld a, RHYDON ld [wcf91], a ld a, 20 - ld [wCurEnemyLVL], a + ld [wCurEnemyLevel], a xor a ld [wMonDataLocation], a ld [wCurMap], a diff --git a/engine/debug/debug_party.asm b/engine/debug/debug_party.asm index 0c76bde12..17d0f793d 100644 --- a/engine/debug/debug_party.asm +++ b/engine/debug/debug_party.asm @@ -7,7 +7,7 @@ SetDebugNewGameParty: ; unreferenced except in _DEBUG ld [wcf91], a inc de ld a, [de] - ld [wCurEnemyLVL], a + ld [wCurEnemyLevel], a inc de call AddPartyMon jr .loop diff --git a/engine/events/black_out.asm b/engine/events/black_out.asm index 16d2081fb..5b0459e2f 100644 --- a/engine/events/black_out.asm +++ b/engine/events/black_out.asm @@ -8,7 +8,7 @@ ResetStatusAndHalveMoneyOnBlackout:: ld [wNPCMovementScriptFunctionNum], a ldh [hJoyHeld], a ld [wNPCMovementScriptPointerTableNum], a - ld [wFlags_0xcd60], a + ld [wMiscFlags], a ldh [hMoney], a ldh [hMoney + 1], a @@ -37,10 +37,10 @@ ResetStatusAndHalveMoneyOnBlackout:: ld [wPlayerMoney + 2], a .lostmoney - ld hl, wd732 - set 2, [hl] - res 3, [hl] - set 6, [hl] - ld a, %11111111 + ld hl, wStatusFlags6 + set BIT_FLY_OR_DUNGEON_WARP, [hl] + res BIT_FLY_WARP, [hl] + set BIT_ESCAPE_WARP, [hl] + ld a, A_BUTTON | B_BUTTON | SELECT | START | D_RIGHT | D_LEFT | D_UP | D_DOWN ld [wJoyIgnore], a predef_jump HealParty diff --git a/engine/events/cinnabar_lab.asm b/engine/events/cinnabar_lab.asm index 545baf139..eb82a5b1c 100644 --- a/engine/events/cinnabar_lab.asm +++ b/engine/events/cinnabar_lab.asm @@ -1,6 +1,6 @@ GiveFossilToCinnabarLab:: - ld hl, wd730 - set 6, [hl] + ld hl, wStatusFlags5 + set BIT_NO_TEXT_DELAY, [hl] xor a ld [wCurrentMenuItem], a ld a, A_BUTTON | B_BUTTON @@ -24,8 +24,8 @@ GiveFossilToCinnabarLab:: call TextBoxBorder call UpdateSprites call PrintFossilsInBag - ld hl, wd730 - res 6, [hl] + ld hl, wStatusFlags5 + res BIT_NO_TEXT_DELAY, [hl] call HandleMenuInput bit BIT_B_BUTTON, a jr nz, .cancelledGivingFossil diff --git a/engine/events/diploma.asm b/engine/events/diploma.asm index e08b1f249..900e3782a 100644 --- a/engine/events/diploma.asm +++ b/engine/events/diploma.asm @@ -6,8 +6,8 @@ DisplayDiploma:: call ClearScreen xor a ld [wUpdateSpritesEnabled], a - ld hl, wd730 - set 6, [hl] + ld hl, wStatusFlags5 + set BIT_NO_TEXT_DELAY, [hl] call DisableLCD ld hl, CircleTile ld de, vChars2 tile CIRCLE_TILE_ID @@ -65,8 +65,8 @@ DisplayDiploma:: ld a, $90 ldh [rOBP0], a call WaitForTextScrollButtonPress - ld hl, wd730 - res 6, [hl] + ld hl, wStatusFlags5 + res BIT_NO_TEXT_DELAY, [hl] call GBPalWhiteOutWithDelay3 call RestoreScreenTilesAndReloadTilePatterns call Delay3 diff --git a/engine/events/display_pokedex.asm b/engine/events/display_pokedex.asm index d657ea858..68d48bb39 100644 --- a/engine/events/display_pokedex.asm +++ b/engine/events/display_pokedex.asm @@ -1,9 +1,9 @@ _DisplayPokedex:: - ld hl, wd730 - set 6, [hl] + ld hl, wStatusFlags5 + set BIT_NO_TEXT_DELAY, [hl] predef ShowPokedexData - ld hl, wd730 - res 6, [hl] + ld hl, wStatusFlags5 + res BIT_NO_TEXT_DELAY, [hl] call ReloadMapData ld c, 10 call DelayFrames diff --git a/engine/events/hidden_objects/bills_house_pc.asm b/engine/events/hidden_objects/bills_house_pc.asm index 6147387a3..b4c0256d4 100644 --- a/engine/events/hidden_objects/bills_house_pc.asm +++ b/engine/events/hidden_objects/bills_house_pc.asm @@ -82,8 +82,8 @@ BillsHousePokemonList:: ld a, 1 ld [wTopMenuItemX], a .billsPokemonLoop - ld hl, wd730 - set 6, [hl] + ld hl, wStatusFlags5 + set BIT_NO_TEXT_DELAY, [hl] hlcoord 0, 0 ld b, 10 ld c, 9 @@ -113,8 +113,8 @@ BillsHousePokemonList:: call LoadScreenTilesFromBuffer2 jr .billsPokemonLoop .cancel - ld hl, wd730 - res 6, [hl] + ld hl, wStatusFlags5 + res BIT_NO_TEXT_DELAY, [hl] call LoadScreenTilesFromBuffer2 jp TextScriptEnd diff --git a/engine/events/hidden_objects/school_blackboard.asm b/engine/events/hidden_objects/school_blackboard.asm index fd3c0b8f1..4839af37a 100644 --- a/engine/events/hidden_objects/school_blackboard.asm +++ b/engine/events/hidden_objects/school_blackboard.asm @@ -24,8 +24,8 @@ LinkCableHelp:: ld a, 1 ld [wTopMenuItemX], a .linkHelpLoop - ld hl, wd730 - set 6, [hl] + ld hl, wStatusFlags5 + set BIT_NO_TEXT_DELAY, [hl] hlcoord 0, 0 ld b, 8 ld c, 13 @@ -41,8 +41,8 @@ LinkCableHelp:: ld a, [wCurrentMenuItem] cp 3 ; pressed a on "STOP READING" jr z, .exit - ld hl, wd730 - res 6, [hl] + ld hl, wStatusFlags5 + res BIT_NO_TEXT_DELAY, [hl] ld hl, LinkCableInfoTexts add a ld d, 0 @@ -54,8 +54,8 @@ LinkCableHelp:: call PrintText jp .linkHelpLoop .exit - ld hl, wd730 - res 6, [hl] + ld hl, wStatusFlags5 + res BIT_NO_TEXT_DELAY, [hl] call LoadScreenTilesFromBuffer1 jp TextScriptEnd @@ -108,8 +108,8 @@ ViridianSchoolBlackboard:: ld a, 1 ld [wTopMenuItemX], a .blackboardLoop - ld hl, wd730 - set 6, [hl] + ld hl, wStatusFlags5 + set BIT_NO_TEXT_DELAY, [hl] hlcoord 0, 0 lb bc, 6, 10 call TextBoxBorder @@ -158,8 +158,8 @@ ViridianSchoolBlackboard:: jr z, .exitBlackboard ; we must have pressed a on a status condition ; so print the text - ld hl, wd730 - res 6, [hl] + ld hl, wStatusFlags5 + res BIT_NO_TEXT_DELAY, [hl] ld hl, ViridianBlackboardStatusPointers add a ld d, 0 @@ -171,8 +171,8 @@ ViridianSchoolBlackboard:: call PrintText jp .blackboardLoop .exitBlackboard - ld hl, wd730 - res 6, [hl] + ld hl, wStatusFlags5 + res BIT_NO_TEXT_DELAY, [hl] call LoadScreenTilesFromBuffer1 jp TextScriptEnd diff --git a/engine/events/hidden_objects/town_map.asm b/engine/events/hidden_objects/town_map.asm index 4284214fc..11f7cbc7d 100644 --- a/engine/events/hidden_objects/town_map.asm +++ b/engine/events/hidden_objects/town_map.asm @@ -4,8 +4,8 @@ TownMapText:: text_asm ld a, $1 ld [wDoNotWaitForButtonPressAfterDisplayingText], a - ld hl, wd730 - set 6, [hl] + ld hl, wStatusFlags5 + set BIT_NO_TEXT_DELAY, [hl] call GBPalWhiteOutWithDelay3 xor a ldh [hWY], a @@ -13,8 +13,8 @@ TownMapText:: ldh [hAutoBGTransferEnabled], a call LoadFontTilePatterns farcall DisplayTownMap - ld hl, wd730 - res 6, [hl] + ld hl, wStatusFlags5 + res BIT_NO_TEXT_DELAY, [hl] ld de, TextScriptEnd push de ldh a, [hLoadedROMBank] diff --git a/engine/events/in_game_trades.asm b/engine/events/in_game_trades.asm index c69516157..54588e7d6 100644 --- a/engine/events/in_game_trades.asm +++ b/engine/events/in_game_trades.asm @@ -108,7 +108,7 @@ InGameTrade_DoTrade: ld bc, wPartyMon2 - wPartyMon1 call AddNTimes ld a, [hl] - ld [wCurEnemyLVL], a + ld [wCurEnemyLevel], a ld hl, wCompletedInGameTradeFlags ld a, [wWhichTrade] ld c, a @@ -118,13 +118,13 @@ InGameTrade_DoTrade: call PrintText ld a, [wWhichPokemon] push af - ld a, [wCurEnemyLVL] + ld a, [wCurEnemyLevel] push af call LoadHpBarAndStatusTilePatterns call InGameTrade_PrepareTradeData predef InternalClockTradeAnim pop af - ld [wCurEnemyLVL], a + ld [wCurEnemyLevel], a pop af ld [wWhichPokemon], a ld a, [wInGameTradeReceiveMonSpecies] diff --git a/engine/events/poison.asm b/engine/events/poison.asm index 8bb756b57..513d08a79 100644 --- a/engine/events/poison.asm +++ b/engine/events/poison.asm @@ -1,6 +1,7 @@ ApplyOutOfBattlePoisonDamage: - ld a, [wd730] - add a + ld a, [wStatusFlags5] + assert BIT_SCRIPTED_MOVEMENT_STATE == 7 + add a ; overflows bit 7 into carry flag jp c, .noBlackOut ; no black out if joypad states are being simulated ld a, [wPartyCount] and a @@ -101,8 +102,8 @@ ApplyOutOfBattlePoisonDamage: ld a, TEXT_BLACKED_OUT ldh [hSpriteIndexOrTextID], a call DisplayTextID - ld hl, wd72e - set 5, [hl] + ld hl, wStatusFlags4 + set BIT_BATTLE_OVER_OR_BLACKOUT, [hl] ld a, $ff jr .done .noBlackOut diff --git a/engine/events/pokecenter.asm b/engine/events/pokecenter.asm index 97dbcd53f..e52c8f5e6 100644 --- a/engine/events/pokecenter.asm +++ b/engine/events/pokecenter.asm @@ -2,10 +2,10 @@ DisplayPokemonCenterDialogue_:: call SaveScreenTilesToBuffer1 ; save screen ld hl, PokemonCenterWelcomeText call PrintText - ld hl, wd72e - bit 2, [hl] - set 1, [hl] - set 2, [hl] + ld hl, wStatusFlags4 + bit BIT_USED_POKECENTER, [hl] + set BIT_UNKNOWN_4_1, [hl] + set BIT_USED_POKECENTER, [hl] jr nz, .skipShallWeHealYourPokemon ld hl, ShallWeHealYourPokemonText call PrintText diff --git a/engine/events/prize_menu.asm b/engine/events/prize_menu.asm index bc3aab9a6..c1e93c362 100644 --- a/engine/events/prize_menu.asm +++ b/engine/events/prize_menu.asm @@ -5,8 +5,8 @@ CeladonPrizeMenu:: ld hl, RequireCoinCaseTextPtr jp PrintText .havingCoinCase - ld hl, wd730 - set 6, [hl] ; disable letter-printing delay + ld hl, wStatusFlags5 + set BIT_NO_TEXT_DELAY, [hl] ld hl, ExchangeCoinsForPrizesTextPtr call PrintText ; the following are the menu settings @@ -38,8 +38,8 @@ CeladonPrizeMenu:: jr z, .noChoice call HandlePrizeChoice .noChoice - ld hl, wd730 - res 6, [hl] + ld hl, wStatusFlags5 + res BIT_NO_TEXT_DELAY, [hl] ret RequireCoinCaseTextPtr: @@ -298,7 +298,7 @@ GetPrizeMonLevel: jr .loop .matchFound ld a, [hl] - ld [wCurEnemyLVL], a + ld [wCurEnemyLevel], a ret INCLUDE "data/events/prize_mon_levels.asm" diff --git a/engine/events/vending_machine.asm b/engine/events/vending_machine.asm index 980a45c51..1530b9944 100644 --- a/engine/events/vending_machine.asm +++ b/engine/events/vending_machine.asm @@ -15,8 +15,8 @@ VendingMachineMenu:: ld [wTopMenuItemY], a ld a, 1 ld [wTopMenuItemX], a - ld hl, wd730 - set 6, [hl] + ld hl, wStatusFlags5 + set BIT_NO_TEXT_DELAY, [hl] hlcoord 0, 3 ld b, 8 ld c, 12 @@ -28,8 +28,8 @@ VendingMachineMenu:: hlcoord 9, 6 ld de, DrinkPriceText call PlaceString - ld hl, wd730 - res 6, [hl] + ld hl, wStatusFlags5 + res BIT_NO_TEXT_DELAY, [hl] call HandleMenuInput bit BIT_B_BUTTON, a jr nz, .notThirsty diff --git a/engine/gfx/sprite_oam.asm b/engine/gfx/sprite_oam.asm index 8704814ff..3916c0dbe 100644 --- a/engine/gfx/sprite_oam.asm +++ b/engine/gfx/sprite_oam.asm @@ -150,8 +150,8 @@ PrepareOAMData:: ld h, HIGH(wShadowOAM) ld de, $4 ld b, $a0 - ld a, [wd736] - bit 6, a ; jumping down ledge or fishing animation? + ld a, [wMovementFlags] + bit BIT_LEDGE_OR_FISHING, a ld a, $a0 jr z, .clear diff --git a/engine/items/item_effects.asm b/engine/items/item_effects.asm index 8d21b9643..e771504d3 100644 --- a/engine/items/item_effects.asm +++ b/engine/items/item_effects.asm @@ -495,7 +495,7 @@ ItemUseBall: ld a, [wEnemyMonSpecies2] ld [wcf91], a ld a, [wEnemyMonLevel] - ld [wCurEnemyLVL], a + ld [wCurEnemyLevel], a callfar LoadEnemyMonData pop af ld [wcf91], a @@ -679,8 +679,8 @@ ItemUseSurfboard: jp c, SurfingAttemptFailed .surf call .makePlayerMoveForward - ld hl, wd730 - set 7, [hl] + ld hl, wStatusFlags5 + set BIT_SCRIPTED_MOVEMENT_STATE, [hl] ld a, 2 ld [wWalkBikeSurfState], a ; change player state to surfing call PlayDefaultMusic ; play surfing music @@ -715,8 +715,8 @@ ItemUseSurfboard: jp PrintText .stopSurfing call .makePlayerMoveForward - ld hl, wd730 - set 7, [hl] + ld hl, wStatusFlags5 + set BIT_SCRIPTED_MOVEMENT_STATE, [hl] xor a ld [wWalkBikeSurfState], a ; change player state to walking dec a @@ -1259,7 +1259,7 @@ ItemUseMedicine: ld bc, wPartyMon1Level - wPartyMon1 add hl, bc ; hl now points to level ld a, [hl] ; a = level - ld [wCurEnemyLVL], a ; store level + ld [wCurEnemyLevel], a ; store level call GetMonHeader push de ld a, d @@ -1338,7 +1338,7 @@ ItemUseMedicine: jr z, .vitaminNoEffect ; can't raise level above 100 inc a ld [hl], a ; store incremented level - ld [wCurEnemyLVL], a + ld [wCurEnemyLevel], a push hl push de ld d, a @@ -1505,11 +1505,11 @@ ItemUseEscapeRope: jr z, .notUsable cp b jr nz, .loop - ld hl, wd732 - set 3, [hl] - set 6, [hl] - ld hl, wd72e - res 4, [hl] + ld hl, wStatusFlags6 + set BIT_FLY_WARP, [hl] + set BIT_ESCAPE_WARP, [hl] + ld hl, wStatusFlags4 + res BIT_NO_BATTLES, [hl] ResetEvent EVENT_IN_SAFARI_ZONE xor a ld [wNumSafariBalls], a @@ -1597,8 +1597,8 @@ ItemUseCardKey: .done ld hl, ItemUseText00 call PrintText - ld hl, wd728 - set 7, [hl] + ld hl, wStatusFlags1 + set BIT_UNUSED_CARD_KEY, [hl] ; never checked ret INCLUDE "data/events/card_key_coords.asm" @@ -1872,7 +1872,7 @@ RodResponse: ld a, 1 ld [wMoveMissed], a ld a, b ; level - ld [wCurEnemyLVL], a + ld [wCurEnemyLevel], a ld a, c ; species ld [wCurOpponent], a @@ -2774,7 +2774,7 @@ SendNewMonToBox: ld [de], a inc de push de - ld a, [wCurEnemyLVL] + ld a, [wCurEnemyLevel] ld d, a callfar CalcExperience pop de diff --git a/engine/items/town_map.asm b/engine/items/town_map.asm index d278d0347..ccbe02258 100644 --- a/engine/items/town_map.asm +++ b/engine/items/town_map.asm @@ -208,10 +208,11 @@ LoadTownMap_Fly:: call PlaySound ld a, [hl] ld [wDestinationMap], a - ld hl, wd732 - set 3, [hl] + ld hl, wStatusFlags6 + set BIT_FLY_WARP, [hl] + assert wStatusFlags6 + 1 == wStatusFlags7 inc hl - set 7, [hl] + set BIT_USED_FLY, [hl] .pressedB xor a ld [wTownMapSpriteBlinkingEnabled], a diff --git a/engine/joypad.asm b/engine/joypad.asm index 87f92635e..63b09a871 100644 --- a/engine/joypad.asm +++ b/engine/joypad.asm @@ -19,8 +19,8 @@ _Joypad:: ld a, b ldh [hJoyLast], a - ld a, [wd730] - bit 5, a + ld a, [wStatusFlags5] + bit BIT_DISABLE_JOYPAD, a jr nz, DiscardButtonPresses ldh a, [hJoyLast] diff --git a/engine/link/cable_club.asm b/engine/link/cable_club.asm index f10e1adae..e5796e53f 100644 --- a/engine/link/cable_club.asm +++ b/engine/link/cable_club.asm @@ -587,7 +587,7 @@ ReturnToCableClubRoom: push hl res 0, [hl] xor a - ld [wd72d], a + ld [wStatusFlags3], a ; clears BIT_INIT_TRADE_CENTER_FACING dec a ld [wDestinationWarpID], a call LoadMapData @@ -839,7 +839,7 @@ TradeCenter_Trade: call ClearScreen call LoadHpBarAndStatusTilePatterns xor a - ld [wUnusedCC5B], a + ld [wUnusedFlag], a ldh a, [hSerialConnectionStatus] cp USING_EXTERNAL_CLOCK jr z, .usingExternalClock diff --git a/engine/link/cable_club_npc.asm b/engine/link/cable_club_npc.asm index 41f56a212..d88538b0b 100644 --- a/engine/link/cable_club_npc.asm +++ b/engine/link/cable_club_npc.asm @@ -110,8 +110,8 @@ CableClubNPC:: ld hl, wUnknownSerialCounter ld [hli], a ld [hl], a - ld hl, wd72e - res 6, [hl] + ld hl, wStatusFlags4 + res BIT_LINK_CONNECTED, [hl] xor a ld [wMenuJoypadPollCount], a ret diff --git a/engine/menus/display_text_id_init.asm b/engine/menus/display_text_id_init.asm index 6ce76e7f5..7f2c1a59a 100644 --- a/engine/menus/display_text_id_init.asm +++ b/engine/menus/display_text_id_init.asm @@ -32,9 +32,9 @@ DisplayTextIDInit:: .skipDrawingTextBoxBorder ld hl, wFontLoaded set 0, [hl] - ld hl, wFlags_0xcd60 - bit 4, [hl] - res 4, [hl] + ld hl, wMiscFlags + bit BIT_NO_SPRITE_UPDATES, [hl] + res BIT_NO_SPRITE_UPDATES, [hl] jr nz, .skipMovingSprites call UpdateSprites .skipMovingSprites diff --git a/engine/menus/draw_start_menu.asm b/engine/menus/draw_start_menu.asm index 00d385bc3..c5b859524 100644 --- a/engine/menus/draw_start_menu.asm +++ b/engine/menus/draw_start_menu.asm @@ -23,8 +23,8 @@ DrawStartMenu:: ld [wLastMenuItem], a xor a ld [wMenuWatchMovingOutOfBounds], a - ld hl, wd730 - set 6, [hl] ; no pauses between printing each letter + ld hl, wStatusFlags5 + set BIT_NO_TEXT_DELAY, [hl] hlcoord 12, 2 CheckEvent EVENT_GOT_POKEDEX ; case for not having pokedex @@ -42,8 +42,8 @@ DrawStartMenu:: call PrintStartMenuItem ld de, wPlayerName ; player's name call PrintStartMenuItem - ld a, [wd72e] - bit 6, a ; is the player using the link feature? + ld a, [wStatusFlags4] + bit BIT_LINK_CONNECTED, a ; case for not using link feature ld de, StartMenuSaveText jr z, .printSaveOrResetText @@ -55,8 +55,8 @@ DrawStartMenu:: call PrintStartMenuItem ld de, StartMenuExitText call PlaceString - ld hl, wd730 - res 6, [hl] ; turn pauses between printing letters back on + ld hl, wStatusFlags5 + res BIT_NO_TEXT_DELAY, [hl] ret StartMenuPokedexText: diff --git a/engine/menus/league_pc.asm b/engine/menus/league_pc.asm index 533454ada..08ff22e4a 100644 --- a/engine/menus/league_pc.asm +++ b/engine/menus/league_pc.asm @@ -1,8 +1,8 @@ PKMNLeaguePC: ld hl, AccessedHoFPCText call PrintText - ld hl, wd730 - set 6, [hl] + ld hl, wStatusFlags5 + set BIT_NO_TEXT_DELAY, [hl] push hl ld a, [wUpdateSpritesEnabled] push af diff --git a/engine/menus/main_menu.asm b/engine/menus/main_menu.asm index e638b169b..df9f523fd 100644 --- a/engine/menus/main_menu.asm +++ b/engine/menus/main_menu.asm @@ -21,14 +21,14 @@ MainMenu: ld [hli], a ld [hl], a ld [wDefaultMap], a - ld hl, wd72e - res 6, [hl] + ld hl, wStatusFlags4 + res BIT_LINK_CONNECTED, [hl] call ClearScreen call RunDefaultPaletteCommand call LoadTextBoxTilePatterns call LoadFontTilePatterns - ld hl, wd730 - set 6, [hl] + ld hl, wStatusFlags5 + set BIT_NO_TEXT_DELAY, [hl] ld a, [wSaveFileStatus] cp 1 jr z, .noSaveFile @@ -50,8 +50,8 @@ MainMenu: ld de, NewGameText call PlaceString .next2 - ld hl, wd730 - res 6, [hl] + ld hl, wStatusFlags5 + res BIT_NO_TEXT_DELAY, [hl] call UpdateSprites xor a ld [wCurrentMenuItem], a @@ -85,7 +85,7 @@ MainMenu: cp 1 jp z, StartNewGame call DisplayOptionMenu - ld a, 1 + ld a, TRUE ld [wOptionsInitialized], a jp .mainMenuLoop .choseContinue @@ -99,10 +99,10 @@ MainMenu: ldh [hJoyHeld], a call Joypad ldh a, [hJoyHeld] - bit 0, a + bit BIT_A_BUTTON, a jr nz, .pressedA - bit 1, a - jp nz, .mainMenuLoop ; pressed B + bit BIT_B_BUTTON, a + jp nz, .mainMenuLoop jr .inputLoop .pressedA call GBPalWhiteOutWithDelay3 @@ -114,18 +114,18 @@ MainMenu: ld a, [wNumHoFTeams] and a jp z, SpecialEnterMap - ld a, [wCurMap] ; map ID + ld a, [wCurMap] cp HALL_OF_FAME jp nz, SpecialEnterMap xor a ld [wDestinationMap], a - ld hl, wd732 - set 2, [hl] ; fly warp or dungeon warp + ld hl, wStatusFlags6 + set BIT_FLY_OR_DUNGEON_WARP, [hl] call PrepareForSpecialWarp jp SpecialEnterMap InitOptions: - ld a, TEXT_DELAY_FAST + ld a, 1 << BIT_FAST_TEXT_DELAY ld [wLetterPrintingDelayFlags], a ld a, TEXT_DELAY_MEDIUM ld [wOptions], a @@ -134,8 +134,8 @@ InitOptions: LinkMenu: xor a ld [wLetterPrintingDelayFlags], a - ld hl, wd72e - set 6, [hl] + ld hl, wStatusFlags4 + set BIT_LINK_CONNECTED, [hl] ld hl, LinkMenuEmptyText call PrintText call SaveScreenTilesToBuffer1 @@ -151,20 +151,25 @@ LinkMenu: call PlaceString xor a ld [wUnusedLinkMenuByte], a - ld [wd72d], a + ld [wCableClubDestinationMap], a ld hl, wTopMenuItemY - ld a, $7 + ld a, 7 ld [hli], a - ld a, $6 + assert wTopMenuItemY + 1 == wTopMenuItemX + ld a, 6 ld [hli], a + assert wTopMenuItemX + 1 == wCurrentMenuItem xor a ld [hli], a inc hl - ld a, $2 + assert wCurrentMenuItem + 2 == wMaxMenuItem + ld a, 2 ld [hli], a + assert wMaxMenuItem + 1 == wMenuWatchedKeys + assert 2 + 1 == A_BUTTON | B_BUTTON inc a - ; ld a, A_BUTTON | B_BUTTON - ld [hli], a ; wMenuWatchedKeys + ld [hli], a + assert wMenuWatchedKeys + 1 == wLastMenuItem xor a ld [hl], a .waitForInputLoop @@ -262,12 +267,12 @@ LinkMenu: jr nz, .next ld a, TRADE_CENTER .next - ld [wd72d], a + ld [wCableClubDestinationMap], a ld hl, PleaseWaitText call PrintText ld c, 50 call DelayFrames - ld hl, wd732 + ld hl, wStatusFlags6 res BIT_DEBUG_MODE, [hl] ld a, [wDefaultMap] ld [wDestinationMap], a @@ -290,8 +295,8 @@ LinkMenu: ld hl, LinkCanceledText vc_hook Wireless_net_end call PrintText - ld hl, wd72e - res 6, [hl] + ld hl, wStatusFlags4 + res BIT_LINK_CONNECTED, [hl] ret WhereWouldYouLikeText: @@ -307,11 +312,9 @@ LinkCanceledText: text_end StartNewGame: - ld hl, wd732 - ; Ensure debug mode is not used when - ; starting a regular new game. - ; Debug mode persists in saved games for - ; both debug and non-debug builds, and is + ld hl, wStatusFlags6 + ; Ensure debug mode is not used when starting a regular new game. + ; Debug mode persists in saved games for both debug and non-debug builds, and is ; only reset here by the main menu. res BIT_DEBUG_MODE, [hl] ; fallthrough @@ -326,9 +329,9 @@ SpecialEnterMap:: ldh [hJoyPressed], a ldh [hJoyHeld], a ldh [hJoy5], a - ld [wd72d], a - ld hl, wd732 - set 0, [hl] ; count play time + ld [wCableClubDestinationMap], a + ld hl, wStatusFlags6 + set BIT_GAME_TIMER_COUNTING, [hl] call ResetPlayerSpriteData ld c, 20 call DelayFrames @@ -465,7 +468,8 @@ DisplayOptionMenu: xor a ld [wCurrentMenuItem], a ld [wLastMenuItem], a - inc a + assert BIT_FAST_TEXT_DELAY == 0 + inc a ; 1 << BIT_FAST_TEXT_DELAY ld [wLetterPrintingDelayFlags], a ld [wOptionsCancelCursorX], a ld a, 3 ; text speed cursor Y coordinate @@ -556,12 +560,12 @@ DisplayOptionMenu: jp .loop .cursorInBattleAnimation ld a, [wOptionsBattleAnimCursorX] ; battle animation cursor X coordinate - xor $0b ; toggle between 1 and 10 + xor 1 ^ 10 ; toggle between 1 and 10 ld [wOptionsBattleAnimCursorX], a jp .eraseOldMenuCursor .cursorInBattleStyle ld a, [wOptionsBattleStyleCursorX] ; battle style cursor X coordinate - xor $0b ; toggle between 1 and 10 + xor 1 ^ 10 ; toggle between 1 and 10 ld [wOptionsBattleStyleCursorX], a jp .eraseOldMenuCursor .pressedLeftInTextSpeed @@ -622,19 +626,19 @@ SetOptionsFromCursorPositions: dec a jr z, .battleAnimationOn .battleAnimationOff - set 7, d + set BIT_BATTLE_ANIMATION, d jr .checkBattleStyle .battleAnimationOn - res 7, d + res BIT_BATTLE_ANIMATION, d .checkBattleStyle ld a, [wOptionsBattleStyleCursorX] ; battle style cursor X coordinate dec a jr z, .battleStyleShift .battleStyleSet - set 6, d + set BIT_BATTLE_SHIFT, d jr .storeOptions .battleStyleShift - res 6, d + res BIT_BATTLE_SHIFT, d .storeOptions ld a, d ld [wOptions], a diff --git a/engine/menus/naming_screen.asm b/engine/menus/naming_screen.asm index c2e63aef3..f51205188 100644 --- a/engine/menus/naming_screen.asm +++ b/engine/menus/naming_screen.asm @@ -83,8 +83,8 @@ DisplayNameRaterScreen:: DisplayNamingScreen: push hl - ld hl, wd730 - set 6, [hl] + ld hl, wStatusFlags5 + set BIT_NO_TEXT_DELAY, [hl] call GBPalWhiteOutWithDelay3 call ClearScreen call UpdateSprites @@ -167,8 +167,8 @@ DisplayNamingScreen: call GBPalNormal xor a ld [wAnimCounter], a - ld hl, wd730 - res 6, [hl] + ld hl, wStatusFlags5 + res BIT_NO_TEXT_DELAY, [hl] ld a, [wIsInBattle] and a jp z, LoadTextBoxTilePatterns diff --git a/engine/menus/party_menu.asm b/engine/menus/party_menu.asm index 46b828eb4..50a9838ca 100644 --- a/engine/menus/party_menu.asm +++ b/engine/menus/party_menu.asm @@ -172,11 +172,11 @@ RedrawPartyMenu_:: ld b, SET_PAL_PARTY_MENU call RunPaletteCommand .printMessage - ld hl, wd730 + ld hl, wStatusFlags5 ld a, [hl] push af push hl - set 6, [hl] ; turn off letter printing delay + set BIT_NO_TEXT_DELAY, [hl] ld a, [wPartyMenuTypeOrMessageID] ; message ID cp FIRST_PARTY_MENU_TEXT_ID jr nc, .printItemUseMessage diff --git a/engine/menus/pc.asm b/engine/menus/pc.asm index 6a15eaa5e..33dd3c2c1 100644 --- a/engine/menus/pc.asm +++ b/engine/menus/pc.asm @@ -5,14 +5,14 @@ ActivatePC:: ld hl, TurnedOnPC1Text call PrintText call WaitForSoundToFinish - ld hl, wFlags_0xcd60 - set 3, [hl] + ld hl, wMiscFlags + set BIT_USING_GENERIC_PC, [hl] call LoadScreenTilesFromBuffer2 call Delay3 PCMainMenu: farcall DisplayPCMainMenu - ld hl, wFlags_0xcd60 - set 5, [hl] + ld hl, wMiscFlags + set BIT_NO_MENU_BUTTON_SOUND, [hl] call HandleMenuInput bit BIT_B_BUTTON, a jp nz, LogOff @@ -48,9 +48,9 @@ PCMainMenu: jp z, PKMNLeague ;if current menu item id is 3, it's pkmnleague jp LogOff ;otherwise, it's 4, and you're logging off .playersPC - ld hl, wFlags_0xcd60 - res 5, [hl] - set 3, [hl] + ld hl, wMiscFlags + res BIT_NO_MENU_BUTTON_SOUND, [hl] + set BIT_USING_GENERIC_PC, [hl] ld a, SFX_ENTER_PC call PlaySound call WaitForSoundToFinish @@ -93,9 +93,9 @@ LogOff: ld a, SFX_TURN_OFF_PC call PlaySound call WaitForSoundToFinish - ld hl, wFlags_0xcd60 - res 3, [hl] - res 5, [hl] + ld hl, wMiscFlags + res BIT_USING_GENERIC_PC, [hl] + res BIT_NO_MENU_BUTTON_SOUND, [hl] ret TurnedOnPC1Text: diff --git a/engine/menus/players_pc.asm b/engine/menus/players_pc.asm index 5461be51a..e0a3a007f 100644 --- a/engine/menus/players_pc.asm +++ b/engine/menus/players_pc.asm @@ -1,14 +1,14 @@ PlayerPC:: - ld hl, wd730 - set 6, [hl] + ld hl, wStatusFlags5 + set BIT_NO_TEXT_DELAY, [hl] ld a, ITEM_NAME ld [wNameListType], a call SaveScreenTilesToBuffer1 xor a ld [wBagSavedMenuItem], a ld [wParentMenuItem], a - ld a, [wFlags_0xcd60] - bit 3, a ; accessing player's PC through another PC? + ld a, [wMiscFlags] + bit BIT_USING_GENERIC_PC, a jr nz, PlayerPCMenu ; accessing it directly ld a, SFX_TURN_ON_PC @@ -19,8 +19,8 @@ PlayerPC:: PlayerPCMenu: ld a, [wParentMenuItem] ld [wCurrentMenuItem], a - ld hl, wFlags_0xcd60 - set 5, [hl] + ld hl, wMiscFlags + set BIT_NO_MENU_BUTTON_SOUND, [hl] call LoadScreenTilesFromBuffer2 hlcoord 0, 0 ld b, $8 @@ -63,22 +63,22 @@ PlayerPCMenu: jp z, PlayerPCToss ExitPlayerPC: - ld a, [wFlags_0xcd60] - bit 3, a ; accessing player's PC through another PC? + ld a, [wMiscFlags] + bit BIT_USING_GENERIC_PC, a jr nz, .next ; accessing it directly ld a, SFX_TURN_OFF_PC call PlaySound call WaitForSoundToFinish .next - ld hl, wFlags_0xcd60 - res 5, [hl] + ld hl, wMiscFlags + res BIT_NO_MENU_BUTTON_SOUND, [hl] call LoadScreenTilesFromBuffer2 xor a ld [wListScrollOffset], a ld [wBagSavedMenuItem], a - ld hl, wd730 - res 6, [hl] + ld hl, wStatusFlags5 + res BIT_NO_TEXT_DELAY, [hl] xor a ld [wDoNotWaitForButtonPressAfterDisplayingText], a ret diff --git a/engine/menus/pokedex.asm b/engine/menus/pokedex.asm index df5d643e9..c6fe37a00 100644 --- a/engine/menus/pokedex.asm +++ b/engine/menus/pokedex.asm @@ -397,8 +397,8 @@ ShowPokedexData: ; function to display pokedex data from inside the pokedex ShowPokedexDataInternal: - ld hl, wd72c - set 1, [hl] + ld hl, wStatusFlags2 + set BIT_NO_AUDIO_FADE_OUT, [hl] ld a, $33 ; 3/7 volume ldh [rNR50], a call GBPalWhiteOut ; zero all palettes @@ -583,8 +583,8 @@ ShowPokedexDataInternal: call RunDefaultPaletteCommand call LoadTextBoxTilePatterns call GBPalNormal - ld hl, wd72c - res 1, [hl] + ld hl, wStatusFlags2 + res BIT_NO_AUDIO_FADE_OUT, [hl] ld a, $77 ; max volume ldh [rNR50], a ret diff --git a/engine/menus/save.asm b/engine/menus/save.asm index 3269e7f2c..2f61b6787 100644 --- a/engine/menus/save.asm +++ b/engine/menus/save.asm @@ -1,6 +1,5 @@ LoadSAV: -;(if carry -> write -;"the file data is destroyed") +; if carry, write "the file data is destroyed" call ClearScreen call LoadFontTilePatterns call LoadTextBoxTilePatterns @@ -13,15 +12,15 @@ LoadSAV: ld a, $2 ; good checksum jr .goodsum .badsum - ld hl, wd730 + ld hl, wStatusFlags5 push hl - set 6, [hl] + set BIT_NO_TEXT_DELAY, [hl] ld hl, FileDataDestroyedText call PrintText ld c, 100 call DelayFrames pop hl - res 6, [hl] + res BIT_NO_TEXT_DELAY, [hl] ld a, $1 ; bad checksum .goodsum ld [wSaveFileStatus], a diff --git a/engine/menus/start_sub_menus.asm b/engine/menus/start_sub_menus.asm index 7dfb7dc3b..5f742e388 100644 --- a/engine/menus/start_sub_menus.asm +++ b/engine/menus/start_sub_menus.asm @@ -142,12 +142,12 @@ StartMenu_Pokemon:: jp .loop .canFly call ChooseFlyDestination - ld a, [wd732] - bit 3, a ; did the player decide to fly? + ld a, [wStatusFlags6] + bit BIT_FLY_WARP, a jp nz, .goBackToMap call LoadFontTilePatterns - ld hl, wd72e - set 1, [hl] + ld hl, wStatusFlags4 + set BIT_UNKNOWN_4_1, [hl] jp StartMenu_Pokemon .cut bit BIT_CASCADEBADGE, a @@ -161,9 +161,9 @@ StartMenu_Pokemon:: bit BIT_SOULBADGE, a jp z, .newBadgeRequired farcall IsSurfingAllowed - ld hl, wd728 - bit 1, [hl] - res 1, [hl] + ld hl, wStatusFlags1 + bit BIT_SURF_ALLOWED, [hl] + res BIT_SURF_ALLOWED, [hl] jp z, .loop ld a, SURFBOARD ld [wcf91], a @@ -177,7 +177,7 @@ StartMenu_Pokemon:: .strength bit BIT_RAINBOWBADGE, a jp z, .newBadgeRequired - predef PrintStrengthTxt + predef PrintStrengthText call GBPalWhiteOutWithDelay3 jp .goBackToMap .flash @@ -214,12 +214,12 @@ StartMenu_Pokemon:: .canTeleport ld hl, .warpToLastPokemonCenterText call PrintText - ld hl, wd732 - set 3, [hl] - set 6, [hl] - ld hl, wd72e - set 1, [hl] - res 4, [hl] + ld hl, wStatusFlags6 + set BIT_FLY_WARP, [hl] + set BIT_ESCAPE_WARP, [hl] + ld hl, wStatusFlags4 + set BIT_UNKNOWN_4_1, [hl] + res BIT_NO_BATTLES, [hl] ld c, 60 call DelayFrames call GBPalWhiteOutWithDelay3 @@ -371,8 +371,8 @@ StartMenu_Item:: ld a, [wcf91] cp BICYCLE jr nz, .notBicycle2 - ld a, [wd732] - bit 5, a + ld a, [wStatusFlags6] + bit BIT_ALWAYS_ON_BIKE, a jr z, .useItem_closeMenu ld hl, CannotGetOffHereText call PrintText @@ -639,8 +639,8 @@ TrainerInfo_DrawVerticalLine: ret StartMenu_SaveReset:: - ld a, [wd72e] - bit 6, a ; is the player using the link feature? + ld a, [wStatusFlags4] + bit BIT_LINK_CONNECTED, a jp nz, Init predef SaveSAV ; save the game call LoadScreenTilesFromBuffer2 ; restore saved screen diff --git a/engine/menus/text_box.asm b/engine/menus/text_box.asm index cdb8841d1..3c1b52336 100644 --- a/engine/menus/text_box.asm +++ b/engine/menus/text_box.asm @@ -37,14 +37,14 @@ DisplayTextBoxID_:: call TextBoxBorder pop hl call GetTextBoxIDText - ld a, [wd730] + ld a, [wStatusFlags5] push af - ld a, [wd730] - set 6, a ; no pauses between printing each letter - ld [wd730], a + ld a, [wStatusFlags5] + set BIT_NO_TEXT_DELAY, a + ld [wStatusFlags5], a call PlaceString pop af - ld [wd730], a + ld [wStatusFlags5], a call UpdateSprites ret @@ -128,8 +128,8 @@ GetAddressOfScreenCoords: INCLUDE "data/text_boxes.asm" DisplayMoneyBox: - ld hl, wd730 - set 6, [hl] + ld hl, wStatusFlags5 + set BIT_NO_TEXT_DELAY, [hl] ld a, MONEY_BOX_TEMPLATE ld [wTextBoxID], a call DisplayTextBoxID @@ -141,17 +141,17 @@ DisplayMoneyBox: ld de, wPlayerMoney ld c, $a3 call PrintBCDNumber - ld hl, wd730 - res 6, [hl] + ld hl, wStatusFlags5 + res BIT_NO_TEXT_DELAY, [hl] ret CurrencyString: db " ¥@" DoBuySellQuitMenu: - ld a, [wd730] - set 6, a ; no printing delay - ld [wd730], a + ld a, [wStatusFlags5] + set BIT_NO_TEXT_DELAY, a + ld [wStatusFlags5], a xor a ld [wChosenMenuItem], a ld a, BUY_SELL_QUIT_MENU_TEMPLATE @@ -169,9 +169,9 @@ DoBuySellQuitMenu: ld [wCurrentMenuItem], a ld [wLastMenuItem], a ld [wMenuWatchMovingOutOfBounds], a - ld a, [wd730] - res 6, a ; turn on the printing delay - ld [wd730], a + ld a, [wStatusFlags5] + res BIT_NO_TEXT_DELAY, a + ld [wStatusFlags5], a call HandleMenuInput call PlaceUnfilledArrowMenuCursor bit BIT_A_BUTTON, a @@ -205,9 +205,9 @@ DoBuySellQuitMenu: ; hl = address where the text box border should be drawn DisplayTwoOptionMenu: push hl - ld a, [wd730] - set 6, a ; no printing delay - ld [wd730], a + ld a, [wStatusFlags5] + set BIT_NO_TEXT_DELAY, a + ld [wStatusFlags5], a ; pointless because both values are overwritten before they are read xor a @@ -277,8 +277,8 @@ DisplayTwoOptionMenu: pop hl add hl, bc call PlaceString - ld hl, wd730 - res 6, [hl] ; turn on the printing delay + ld hl, wStatusFlags5 + res BIT_NO_TEXT_DELAY, [hl] ld a, [wTwoOptionMenuID] cp NO_YES_MENU jr nz, .notNoYesMenu @@ -287,12 +287,12 @@ DisplayTwoOptionMenu: ; it only seems to be used when confirming the deletion of a save file xor a ld [wTwoOptionMenuID], a - ld a, [wFlags_0xcd60] + ld a, [wMiscFlags] push af push hl - ld hl, wFlags_0xcd60 - bit 5, [hl] - set 5, [hl] ; don't play sound when A or B is pressed in menu + ld hl, wMiscFlags + bit BIT_NO_MENU_BUTTON_SOUND, [hl] + set BIT_NO_MENU_BUTTON_SOUND, [hl] pop hl .noYesMenuInputLoop call HandleMenuInput @@ -300,7 +300,7 @@ DisplayTwoOptionMenu: jr nz, .noYesMenuInputLoop ; try again if B was not pressed pop af pop hl - ld [wFlags_0xcd60], a + ld [wMiscFlags], a ld a, SFX_PRESS_AB call PlaySound jr .pressedAButton diff --git a/engine/movie/oak_speech/oak_speech.asm b/engine/movie/oak_speech/oak_speech.asm index 3e339619b..d0fc4ad8d 100644 --- a/engine/movie/oak_speech/oak_speech.asm +++ b/engine/movie/oak_speech/oak_speech.asm @@ -8,7 +8,7 @@ PrepareOakSpeech: ; which causes CheckForceBikeOrSurf to not return. ; To fix this in debug builds, reset bit 5 here or in StartNewGame. ; In non-debug builds, the instructions can be removed. - ld a, [wd732] + ld a, [wStatusFlags6] push af ld hl, wPlayerName ld bc, wBoxDataEnd - wPlayerName @@ -19,7 +19,7 @@ PrepareOakSpeech: xor a call FillMemory pop af - ld [wd732], a + ld [wStatusFlags6], a pop af ld [wOptions], a pop af @@ -61,7 +61,7 @@ OakSpeech: call PrepareForSpecialWarp xor a ldh [hTileAnimations], a - ld a, [wd732] + ld a, [wStatusFlags6] bit BIT_DEBUG_MODE, a jp nz, .skipSpeech ld de, ProfOakPic @@ -106,8 +106,8 @@ OakSpeech: lb bc, BANK(RedPicFront), $00 call IntroDisplayPicCenteredOrUpperRight call GBFadeInFromWhite - ld a, [wd72d] - and a + ld a, [wStatusFlags3] + and a ; ??? jr nz, .next ld hl, OakSpeechText3 call PrintText diff --git a/engine/movie/title.asm b/engine/movie/title.asm index 36a28b0df..7edbbedf2 100644 --- a/engine/movie/title.asm +++ b/engine/movie/title.asm @@ -15,9 +15,11 @@ PrepareTitleScreen:: xor a ldh [hWY], a ld [wLetterPrintingDelayFlags], a - ld hl, wd732 + ld hl, wStatusFlags6 ld [hli], a + assert wStatusFlags6 + 1 == wStatusFlags7 ld [hli], a + assert wStatusFlags7 + 1 == wElite4Flags ld [hl], a ld a, BANK(Music_TitleScreen) ld [wAudioROMBank], a @@ -218,7 +220,7 @@ ENDC ld [wNewSoundID], a call PlaySound xor a - ld [wUnusedCC5B], a + ld [wUnusedFlag], a ; Keep scrolling in new mons indefinitely until the user performs input. .awaitUserInterruptionLoop diff --git a/engine/movie/trade.asm b/engine/movie/trade.asm index def901ba2..9d168cc72 100644 --- a/engine/movie/trade.asm +++ b/engine/movie/trade.asm @@ -173,8 +173,8 @@ LoadTradingGFXAndMonNames: call ClearSprites ld a, $ff ld [wUpdateSpritesEnabled], a - ld hl, wd730 - set 6, [hl] ; turn on instant text printing + ld hl, wStatusFlags5 + set BIT_NO_TEXT_DELAY, [hl] ld a, [wOnSGB] and a ld a, $e4 ; non-SGB OBP0 @@ -218,8 +218,8 @@ Trade_SwapNames: Trade_Cleanup: xor a call LoadGBPal - ld hl, wd730 - res 6, [hl] ; turn off instant text printing + ld hl, wStatusFlags5 + res BIT_NO_TEXT_DELAY, [hl] ret Trade_ShowPlayerMon: diff --git a/engine/overworld/auto_movement.asm b/engine/overworld/auto_movement.asm index 538983712..8a45735f6 100644 --- a/engine/overworld/auto_movement.asm +++ b/engine/overworld/auto_movement.asm @@ -1,12 +1,12 @@ PlayerStepOutFromDoor:: - ld hl, wd730 - res 1, [hl] + ld hl, wStatusFlags5 ; should this be wMovementFlags? + res BIT_EXITING_DOOR, [hl] call IsPlayerStandingOnDoorTile jr nc, .notStandingOnDoor ld a, SELECT | START | D_RIGHT | D_LEFT | D_UP | D_DOWN ld [wJoyIgnore], a - ld hl, wd736 - set 1, [hl] + ld hl, wMovementFlags + set BIT_EXITING_DOOR, [hl] ld a, $1 ld [wSimulatedJoypadStatesIndex], a ld a, D_DOWN @@ -20,21 +20,21 @@ PlayerStepOutFromDoor:: ld [wUnusedOverrideSimulatedJoypadStatesIndex], a ld [wSimulatedJoypadStatesIndex], a ld [wSimulatedJoypadStatesEnd], a - ld hl, wd736 - res 0, [hl] - res 1, [hl] - ld hl, wd730 - res 7, [hl] + ld hl, wMovementFlags + res BIT_STANDING_ON_DOOR, [hl] + res BIT_EXITING_DOOR, [hl] + ld hl, wStatusFlags5 + res BIT_SCRIPTED_MOVEMENT_STATE, [hl] ret _EndNPCMovementScript:: - ld hl, wd730 - res 7, [hl] - ld hl, wd72e - res 7, [hl] - ld hl, wd736 - res 0, [hl] - res 1, [hl] + ld hl, wStatusFlags5 + res BIT_SCRIPTED_MOVEMENT_STATE, [hl] + ld hl, wStatusFlags4 + res BIT_INIT_SCRIPTED_MOVEMENT, [hl] + ld hl, wMovementFlags + res BIT_STANDING_ON_DOOR, [hl] + res BIT_EXITING_DOOR, [hl] xor a ld [wNPCMovementScriptSpriteOffset], a ld [wNPCMovementScriptPointerTableNum], a @@ -79,15 +79,15 @@ PalletMovementScript_OakMoveLeft: ld a, $3 ld [wNPCMovementScriptFunctionNum], a .done - ld hl, wFlags_D733 - set 1, [hl] + ld hl, wStatusFlags7 + set BIT_NO_MAP_MUSIC, [hl] ld a, SELECT | START | D_RIGHT | D_LEFT | D_UP | D_DOWN ld [wJoyIgnore], a ret PalletMovementScript_PlayerMoveLeft: - ld a, [wd730] - bit 0, a ; is an NPC being moved by a script? + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_NPC_MOVEMENT, a ret nz ; return if Oak is still moving ld a, [wNumStepsToTake] ld [wSimulatedJoypadStatesIndex], a @@ -119,10 +119,10 @@ PalletMovementScript_WalkToLab: ld hl, wNPCMovementDirections2 ld de, RLEList_ProfOakWalkToLab call DecodeRLEList - ld hl, wd72e - res 7, [hl] - ld hl, wd730 - set 7, [hl] + ld hl, wStatusFlags4 + res BIT_INIT_SCRIPTED_MOVEMENT, [hl] + ld hl, wStatusFlags5 + set BIT_SCRIPTED_MOVEMENT_STATE, [hl] ld a, $4 ld [wNPCMovementScriptFunctionNum], a ret @@ -151,10 +151,10 @@ PalletMovementScript_Done: ld a, HS_PALLET_TOWN_OAK ld [wMissableObjectIndex], a predef HideObject - ld hl, wd730 - res 7, [hl] - ld hl, wd72e - res 7, [hl] + ld hl, wStatusFlags5 + res BIT_SCRIPTED_MOVEMENT_STATE, [hl] + ld hl, wStatusFlags4 + res BIT_INIT_SCRIPTED_MOVEMENT, [hl] jp EndNPCMovementScript PewterMuseumGuyMovementScriptPointerTable:: @@ -183,8 +183,8 @@ PewterMovementScript_WalkToMuseum: ld hl, wNPCMovementDirections2 ld de, RLEList_PewterMuseumGuy call DecodeRLEList - ld hl, wd72e - res 7, [hl] + ld hl, wStatusFlags4 + res BIT_INIT_SCRIPTED_MOVEMENT, [hl] ld a, $1 ld [wNPCMovementScriptFunctionNum], a ret @@ -207,10 +207,10 @@ PewterMovementScript_Done: ld a, [wSimulatedJoypadStatesIndex] and a ret nz - ld hl, wd730 - res 7, [hl] - ld hl, wd72e - res 7, [hl] + ld hl, wStatusFlags5 + res BIT_SCRIPTED_MOVEMENT_STATE, [hl] + ld hl, wStatusFlags4 + res BIT_INIT_SCRIPTED_MOVEMENT, [hl] jp EndNPCMovementScript PewterGymGuyMovementScriptPointerTable:: @@ -240,10 +240,10 @@ PewterMovementScript_WalkToGym: ld hl, wNPCMovementDirections2 ld de, RLEList_PewterGymGuy call DecodeRLEList - ld hl, wd72e - res 7, [hl] - ld hl, wd730 - set 7, [hl] + ld hl, wStatusFlags4 + res BIT_INIT_SCRIPTED_MOVEMENT, [hl] + ld hl, wStatusFlags5 + set BIT_SCRIPTED_MOVEMENT_STATE, [hl] ld a, $1 ld [wNPCMovementScriptFunctionNum], a ret diff --git a/engine/overworld/cut.asm b/engine/overworld/cut.asm index 8ae9ed658..3e514672b 100644 --- a/engine/overworld/cut.asm +++ b/engine/overworld/cut.asm @@ -32,8 +32,8 @@ UsedCut: ld a, [wWhichPokemon] ld hl, wPartyMonNicks call GetPartyMonName - ld hl, wd730 - set 6, [hl] + ld hl, wStatusFlags5 + set BIT_NO_TEXT_DELAY, [hl] call GBPalWhiteOutWithDelay3 call ClearSprites call RestoreScreenTilesAndReloadTilePatterns @@ -49,8 +49,8 @@ UsedCut: ld hl, UsedCutText call PrintText call LoadScreenTilesFromBuffer2 - ld hl, wd730 - res 6, [hl] + ld hl, wStatusFlags5 + res BIT_NO_TEXT_DELAY, [hl] ld a, $ff ld [wUpdateSpritesEnabled], a call InitCutAnimOAM diff --git a/engine/overworld/emotion_bubbles.asm b/engine/overworld/emotion_bubbles.asm index 84b13f173..d25d5ff19 100644 --- a/engine/overworld/emotion_bubbles.asm +++ b/engine/overworld/emotion_bubbles.asm @@ -15,8 +15,8 @@ EmotionBubble: push af ld a, $ff ld [wUpdateSpritesEnabled], a - ld a, [wd736] - bit 6, a ; are the last 4 OAM entries reserved for a shadow or fishing rod? + ld a, [wMovementFlags] + bit BIT_LEDGE_OR_FISHING, a ; are the last 4 OAM entries reserved for a shadow or fishing rod? ld hl, wShadowOAMSprite35Attributes ld de, wShadowOAMSprite39Attributes jr z, .next diff --git a/engine/overworld/field_move_messages.asm b/engine/overworld/field_move_messages.asm index d75ffc213..a9e29b63c 100644 --- a/engine/overworld/field_move_messages.asm +++ b/engine/overworld/field_move_messages.asm @@ -1,6 +1,6 @@ -PrintStrengthTxt: - ld hl, wd728 - set 0, [hl] +PrintStrengthText: + ld hl, wStatusFlags1 + set BIT_STRENGTH_ACTIVE, [hl] ld hl, UsedStrengthText call PrintText ld hl, CanMoveBouldersText @@ -19,13 +19,13 @@ CanMoveBouldersText: text_end IsSurfingAllowed: -; Returns whether surfing is allowed in bit 1 of wd728. +; Returns whether surfing is allowed in BIT_SURF_ALLOWED of wStatusFlags1. ; Surfing isn't allowed on the Cycling Road or in the lowest level of the ; Seafoam Islands before the current has been slowed with boulders. - ld hl, wd728 - set 1, [hl] - ld a, [wd732] - bit 5, a + ld hl, wStatusFlags1 + set BIT_SURF_ALLOWED, [hl] + ld a, [wStatusFlags6] + bit BIT_ALWAYS_ON_BIKE, a jr nz, .forcedToRideBike ld a, [wCurMap] cp SEAFOAM_ISLANDS_B4F @@ -35,13 +35,13 @@ IsSurfingAllowed: ld hl, SeafoamIslandsB4FStairsCoords call ArePlayerCoordsInArray ret nc - ld hl, wd728 - res 1, [hl] + ld hl, wStatusFlags1 + res BIT_SURF_ALLOWED, [hl] ld hl, CurrentTooFastText jp PrintText .forcedToRideBike - ld hl, wd728 - res 1, [hl] + ld hl, wStatusFlags1 + res BIT_SURF_ALLOWED, [hl] ld hl, CyclingIsFunText jp PrintText diff --git a/engine/overworld/hidden_objects.asm b/engine/overworld/hidden_objects.asm index 855328e76..2798864a5 100644 --- a/engine/overworld/hidden_objects.asm +++ b/engine/overworld/hidden_objects.asm @@ -1,17 +1,17 @@ IsPlayerOnDungeonWarp:: xor a ld [wWhichDungeonWarp], a - ld a, [wd72d] - bit 4, a + ld a, [wStatusFlags3] + bit BIT_ON_DUNGEON_WARP, a ret nz call ArePlayerCoordsInArray ret nc ld a, [wCoordIndex] ld [wWhichDungeonWarp], a - ld hl, wd72d - set 4, [hl] - ld hl, wd732 - set 4, [hl] + ld hl, wStatusFlags3 + set BIT_ON_DUNGEON_WARP, [hl] + ld hl, wStatusFlags6 + set BIT_DUNGEON_WARP, [hl] ret ; if a hidden object was found, stores $00 in [hDidntFindAnyHiddenObject], else stores $ff diff --git a/engine/overworld/ledges.asm b/engine/overworld/ledges.asm index 89e4ef579..73733e15e 100644 --- a/engine/overworld/ledges.asm +++ b/engine/overworld/ledges.asm @@ -1,6 +1,6 @@ HandleLedges:: - ld a, [wd736] - bit 6, a ; already jumping down ledge + ld a, [wMovementFlags] + bit BIT_LEDGE_OR_FISHING, a ret nz ld a, [wCurMapTileset] and a ; OVERWORLD @@ -41,8 +41,8 @@ HandleLedges:: ret z ld a, A_BUTTON | B_BUTTON | SELECT | START | D_RIGHT | D_LEFT | D_UP | D_DOWN ld [wJoyIgnore], a - ld hl, wd736 - set 6, [hl] ; jumping down ledge + ld hl, wMovementFlags + set BIT_LEDGE_OR_FISHING, [hl] call StartSimulatingJoypadStates ld a, e ld [wSimulatedJoypadStatesEnd], a diff --git a/engine/overworld/movement.asm b/engine/overworld/movement.asm index afcb5907e..1ca24f6ac 100644 --- a/engine/overworld/movement.asm +++ b/engine/overworld/movement.asm @@ -60,8 +60,8 @@ UpdatePlayerSprite: bit 0, a jr nz, .notMoving .moving - ld a, [wd736] - bit 7, a ; is the player sprite spinning due to a spin tile? + ld a, [wMovementFlags] + bit BIT_SPINNING, a jr nz, .skipSpriteAnim ldh a, [hCurrentSpriteOffset] add $7 @@ -175,8 +175,8 @@ UpdateNPCSprite: jr nz, .next ; reached end of wNPCMovementDirections list ld [hl], a ; store $ff in movement byte 1, disabling scripted movement - ld hl, wd730 - res 0, [hl] + ld hl, wStatusFlags5 + res BIT_SCRIPTED_NPC_MOVEMENT, [hl] xor a ld [wSimulatedJoypadStatesIndex], a ld [wUnusedOverrideSimulatedJoypadStatesIndex], a @@ -409,8 +409,8 @@ MakeNPCFacePlayer: ; Check if the behaviour of the NPC facing the player when spoken to is ; disabled. This is only done when rubbing the S.S. Anne captain's back. - ld a, [wd72d] - bit 5, a + ld a, [wStatusFlags3] + bit BIT_NO_NPC_FACE_PLAYER, a jr nz, notYetMoving res 7, [hl] ld a, [wPlayerDirection] @@ -740,12 +740,12 @@ DoScriptedNPCMovement: ; a few times in the game. It is used when the NPC and player must walk together ; in sync, such as when the player is following the NPC somewhere. An NPC can't ; be moved in sync with the player using the other method. - ld a, [wd730] - bit 7, a + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_MOVEMENT_STATE, a ret z - ld hl, wd72e - bit 7, [hl] - set 7, [hl] + ld hl, wStatusFlags4 + bit BIT_INIT_SCRIPTED_MOVEMENT, [hl] + set BIT_INIT_SCRIPTED_MOVEMENT, [hl] jp z, InitScriptedNPCMovement ld hl, wNPCMovementDirections2 ld a, [wNPCMovementDirections2Index] diff --git a/engine/overworld/player_animations.asm b/engine/overworld/player_animations.asm index bec59369b..210599da9 100644 --- a/engine/overworld/player_animations.asm +++ b/engine/overworld/player_animations.asm @@ -5,15 +5,15 @@ EnterMapAnim:: call Delay3 push hl call GBFadeInFromWhite - ld hl, wFlags_D733 - bit 7, [hl] ; used fly out of battle? - res 7, [hl] + ld hl, wStatusFlags7 + bit BIT_USED_FLY, [hl] + res BIT_USED_FLY, [hl] jr nz, .flyAnimation ld a, SFX_TELEPORT_ENTER_1 call PlaySound - ld hl, wd732 - bit 4, [hl] ; used dungeon warp? - res 4, [hl] + ld hl, wStatusFlags6 + bit BIT_DUNGEON_WARP, [hl] + res BIT_DUNGEON_WARP, [hl] pop hl jr nz, .dungeonWarpAnimation call PlayerSpinWhileMovingDown @@ -122,8 +122,8 @@ _LeaveMapAnim:: .playerNotStandingOnWarpPadOrHole ld a, $4 call StopMusic - ld a, [wd732] - bit 6, a ; is the last used pokemon center the destination? + ld a, [wStatusFlags6] + bit BIT_ESCAPE_WARP, a jr z, .flyAnimation ; if going to the last used pokemon center ld hl, wPlayerSpinInPlaceAnimFrameDelay @@ -378,8 +378,8 @@ INCLUDE "data/tilesets/warp_pad_hole_tile_ids.asm" FishingAnim: ld c, 10 call DelayFrames - ld hl, wd736 - set 6, [hl] ; reserve the last 4 OAM entries + ld hl, wMovementFlags + set BIT_LEDGE_OR_FISHING, [hl] ld de, RedSprite ld hl, vNPCSprites tile $00 lb bc, BANK(RedSprite), 12 @@ -445,8 +445,8 @@ FishingAnim: .done call PrintText - ld hl, wd736 - res 6, [hl] ; unreserve the last 4 OAM entries + ld hl, wMovementFlags + res BIT_LEDGE_OR_FISHING, [hl] call LoadFontTilePatterns ret @@ -512,10 +512,10 @@ _HandleMidJump:: ldh [hJoyPressed], a ldh [hJoyReleased], a ld [wPlayerJumpingYScreenCoordsIndex], a - ld hl, wd736 - res 6, [hl] ; not jumping down a ledge any more - ld hl, wd730 - res 7, [hl] ; not simulating joypad states any more + ld hl, wMovementFlags + res BIT_LEDGE_OR_FISHING, [hl] + ld hl, wStatusFlags5 + res BIT_SCRIPTED_MOVEMENT_STATE, [hl] xor a ld [wJoyIgnore], a ret diff --git a/engine/overworld/player_state.asm b/engine/overworld/player_state.asm index 80b132ac3..4711bb5c4 100644 --- a/engine/overworld/player_state.asm +++ b/engine/overworld/player_state.asm @@ -1,4 +1,4 @@ -; only used for setting bit 2 of wd736 upon entering a new map +; only used for setting BIT_STANDING_ON_WARP of wMovementFlags upon entering a new map IsPlayerStandingOnWarp:: ld a, [wNumberOfWarps] and a @@ -18,8 +18,8 @@ IsPlayerStandingOnWarp:: ld [wDestinationWarpID], a ld a, [hl] ; target map ldh [hWarpDestinationMap], a - ld hl, wd736 - set 2, [hl] ; standing on warp flag + ld hl, wMovementFlags + set BIT_STANDING_ON_WARP, [hl] ret .nextWarp1 inc hl @@ -32,8 +32,8 @@ IsPlayerStandingOnWarp:: ret CheckForceBikeOrSurf:: - ld hl, wd732 - bit 5, [hl] + ld hl, wStatusFlags6 + bit BIT_ALWAYS_ON_BIKE, [hl] ret nz ld hl, ForcedBikeOrSurfMaps ld a, [wYCoord] @@ -45,14 +45,14 @@ CheckForceBikeOrSurf:: .loop ld a, [hli] cp $ff - ret z ;if we reach FF then it's not part of the list - cp d ;compare to current map + ret z ; if we reach FF then it's not part of the list + cp d ; compare to current map jr nz, .incorrectMap ld a, [hli] - cp b ;compare y-coord + cp b ; compare y-coord jr nz, .incorrectY ld a, [hli] - cp c ;compare x-coord + cp c ; compare x-coord jr nz, .loop ; incorrect x-coord, check next item ld a, [wCurMap] cp SEAFOAM_ISLANDS_B3F @@ -64,9 +64,8 @@ CheckForceBikeOrSurf:: ld a, SCRIPT_SEAFOAMISLANDSB4F_MOVE_OBJECT ld [wSeafoamIslandsB4FCurScript], a jr z, .forceSurfing - ;force bike riding - ld hl, wd732 - set 5, [hl] + ld hl, wStatusFlags6 + set BIT_ALWAYS_ON_BIKE, [hl] ld a, $1 ld [wWalkBikeSurfState], a ld [wWalkBikeSurfStateCopy], a @@ -207,8 +206,8 @@ IsPlayerStandingOnDoorTileOrWarpTile:: lda_coord 8, 9 call IsInArray jr nc, .done - ld hl, wd736 - res 2, [hl] + ld hl, wMovementFlags + res BIT_STANDING_ON_WARP, [hl] .done pop bc pop de diff --git a/engine/overworld/push_boulder.asm b/engine/overworld/push_boulder.asm index 96c506c02..7eee844c1 100644 --- a/engine/overworld/push_boulder.asm +++ b/engine/overworld/push_boulder.asm @@ -1,9 +1,9 @@ TryPushingBoulder:: - ld a, [wd728] - bit 0, a ; using Strength? + ld a, [wStatusFlags1] + bit BIT_STRENGTH_ACTIVE, a ret z - ld a, [wFlags_0xcd60] - bit 1, a ; has boulder dust animation from previous push played yet? + ld a, [wMiscFlags] + bit BIT_BOULDER_DUST, a ret nz xor a ldh [hSpriteIndexOrTextID], a @@ -23,9 +23,9 @@ TryPushingBoulder:: ld a, [hl] cp BOULDER_MOVEMENT_BYTE_2 jp nz, ResetBoulderPushFlags - ld hl, wFlags_0xcd60 - bit 6, [hl] - set 6, [hl] ; indicate that the player has tried pushing + ld hl, wMiscFlags + bit BIT_TRIED_PUSH_BOULDER, [hl] + set BIT_TRIED_PUSH_BOULDER, [hl] ret z ; the player must try pushing twice before the boulder will move ldh a, [hJoyHeld] and D_RIGHT | D_LEFT | D_UP | D_DOWN @@ -44,30 +44,30 @@ TryPushingBoulder:: cp SPRITE_FACING_RIGHT jr z, .pushBoulderRight .pushBoulderDown - bit 7, b + bit BIT_D_DOWN, b ret z ld de, PushBoulderDownMovementData jr .done .pushBoulderUp - bit 6, b + bit BIT_D_UP, b ret z ld de, PushBoulderUpMovementData jr .done .pushBoulderLeft - bit 5, b + bit BIT_D_LEFT, b ret z ld de, PushBoulderLeftMovementData jr .done .pushBoulderRight - bit 4, b + bit BIT_D_RIGHT, b ret z ld de, PushBoulderRightMovementData .done call MoveSprite ld a, SFX_PUSH_BOULDER call PlaySound - ld hl, wFlags_0xcd60 - set 1, [hl] + ld hl, wMiscFlags + set BIT_BOULDER_DUST, [hl] ret PushBoulderUpMovementData: @@ -87,14 +87,14 @@ PushBoulderRightMovementData: db -1 ; end DoBoulderDustAnimation:: - ld a, [wd730] - bit 0, a + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_NPC_MOVEMENT, a ret nz callfar AnimateBoulderDust call DiscardButtonPresses ld [wJoyIgnore], a call ResetBoulderPushFlags - set 7, [hl] ; [wFlags_0xcd60] + set BIT_PUSHED_BOULDER, [hl] ld a, [wBoulderSpriteIndex] ldh [hSpriteIndex], a call GetSpriteMovementByte2Pointer @@ -103,7 +103,7 @@ DoBoulderDustAnimation:: jp PlaySound ResetBoulderPushFlags: - ld hl, wFlags_0xcd60 - res 1, [hl] - res 6, [hl] + ld hl, wMiscFlags + res BIT_BOULDER_DUST, [hl] + res BIT_TRIED_PUSH_BOULDER, [hl] ret diff --git a/engine/overworld/special_warps.asm b/engine/overworld/special_warps.asm index 0cc2a4749..303415c15 100644 --- a/engine/overworld/special_warps.asm +++ b/engine/overworld/special_warps.asm @@ -1,9 +1,9 @@ PrepareForSpecialWarp:: call LoadSpecialWarpData predef LoadTilesetHeader - ld hl, wd732 - bit 2, [hl] ; dungeon warp or fly warp? - res 2, [hl] + ld hl, wStatusFlags6 + bit BIT_FLY_OR_DUNGEON_WARP, [hl] + res BIT_FLY_OR_DUNGEON_WARP, [hl] jr z, .debugNewGameWarp ld a, [wDestinationMap] jr .next @@ -17,19 +17,19 @@ PrepareForSpecialWarp:: ld a, PALLET_TOWN .next ld b, a - ld a, [wd72d] - and a + ld a, [wStatusFlags3] + and a ; ??? jr nz, .next2 ld a, b .next2 - ld hl, wd732 - bit 4, [hl] ; dungeon warp + ld hl, wStatusFlags6 + bit BIT_DUNGEON_WARP, [hl] ret nz ld [wLastMap], a ret LoadSpecialWarpData: - ld a, [wd72d] + ld a, [wCableClubDestinationMap] cp TRADE_CENTER jr nz, .notTradeCenter ld hl, TradeCenterPlayerWarp @@ -48,7 +48,7 @@ LoadSpecialWarpData: ld hl, ColosseumFriendWarp jr .copyWarpData .notColosseum - ld a, [wd732] + ld a, [wStatusFlags6] bit BIT_DEBUG_MODE, a ; warp to wLastMap (PALLET_TOWN) for StartNewGameDebug jr nz, .notNewGameWarp @@ -70,17 +70,17 @@ LoadSpecialWarpData: jr .done .notNewGameWarp ld a, [wLastMap] ; this value is overwritten before it's ever read - ld hl, wd732 - bit 4, [hl] ; dungeon warp + ld hl, wStatusFlags6 + bit BIT_DUNGEON_WARP, [hl] jr nz, .usedDungeonWarp - bit 6, [hl] ; blacked out - res 6, [hl] + bit BIT_ESCAPE_WARP, [hl] + res BIT_ESCAPE_WARP, [hl] jr z, .otherDestination ld a, [wLastBlackoutMap] jr .usedFlyWarp .usedDungeonWarp - ld hl, wd72d - res 4, [hl] + ld hl, wStatusFlags3 + res BIT_ON_DUNGEON_WARP, [hl] ld a, [wDungeonWarpDestinationMap] ld b, a ld [wCurMap], a diff --git a/engine/overworld/trainer_sight.asm b/engine/overworld/trainer_sight.asm index 816dea7f6..f32b558a5 100644 --- a/engine/overworld/trainer_sight.asm +++ b/engine/overworld/trainer_sight.asm @@ -221,8 +221,8 @@ TrainerEngage: ld a, [wTrainerSpriteOffset] and a jr z, .noEngage - ld hl, wFlags_0xcd60 - set 0, [hl] + ld hl, wMiscFlags + set BIT_SEEN_BY_TRAINER, [hl] call EngageMapTrainer ld a, $ff .noEngage diff --git a/engine/play_time.asm b/engine/play_time.asm index dcba88c24..9b4491de7 100644 --- a/engine/play_time.asm +++ b/engine/play_time.asm @@ -1,7 +1,7 @@ TrackPlayTime:: call CountDownIgnoreInputBitReset - ld a, [wd732] - bit 0, a + ld a, [wStatusFlags6] + bit BIT_GAME_TIMER_COUNTING, a ret z ld a, [wPlayTimeMaxed] and a @@ -48,12 +48,12 @@ CountDownIgnoreInputBitReset: ld [wIgnoreInputCounter], a and a ret nz - ld a, [wd730] - res 1, a - res 2, a - bit 5, a - res 5, a - ld [wd730], a + ld a, [wStatusFlags5] + res BIT_UNKNOWN_5_1, a + res BIT_UNKNOWN_5_2, a + bit BIT_DISABLE_JOYPAD, a + res BIT_DISABLE_JOYPAD, a + ld [wStatusFlags5], a ret z xor a ldh [hJoyPressed], a diff --git a/engine/pokemon/add_mon.asm b/engine/pokemon/add_mon.asm index 6fb074ac9..0b7fb96cd 100644 --- a/engine/pokemon/add_mon.asm +++ b/engine/pokemon/add_mon.asm @@ -199,7 +199,7 @@ _AddPartyMon:: inc de ld [de], a push de - ld a, [wCurEnemyLVL] + ld a, [wCurEnemyLevel] ld d, a callfar CalcExperience pop de @@ -224,7 +224,7 @@ _AddPartyMon:: pop hl call AddPartyMon_WriteMovePP inc de - ld a, [wCurEnemyLVL] + ld a, [wCurEnemyLevel] ld [de], a inc de ld a, [wIsInBattle] @@ -500,7 +500,7 @@ _MoveMon:: call LoadMonData farcall CalcLevelFromExperience ld a, d - ld [wCurEnemyLVL], a + ld [wCurEnemyLevel], a pop hl ld bc, wBoxMon2 - wBoxMon1 add hl, bc diff --git a/engine/pokemon/bills_pc.asm b/engine/pokemon/bills_pc.asm index 8684b7618..599337627 100644 --- a/engine/pokemon/bills_pc.asm +++ b/engine/pokemon/bills_pc.asm @@ -93,8 +93,8 @@ PKMNLeaguePCText: db "LEAGUE@" LogOffPCText: db "LOG OFF@" BillsPC_:: - ld hl, wd730 - set 6, [hl] + ld hl, wStatusFlags5 + set BIT_NO_TEXT_DELAY, [hl] xor a ld [wParentMenuItem], a inc a ; MONSTER_NAME @@ -102,8 +102,8 @@ BillsPC_:: call LoadHpBarAndStatusTilePatterns ld a, [wListScrollOffset] push af - ld a, [wFlags_0xcd60] - bit 3, a ; accessing Bill's PC through another PC? + ld a, [wMiscFlags] + bit BIT_USING_GENERIC_PC, a jr nz, BillsPCMenu ; accessing it directly ld a, SFX_TURN_ON_PC @@ -186,8 +186,8 @@ BillsPCMenu: jp z, BillsPCChangeBox ; change box ExitBillsPC: - ld a, [wFlags_0xcd60] - bit 3, a ; accessing Bill's PC through another PC? + ld a, [wMiscFlags] + bit BIT_USING_GENERIC_PC, a jr nz, .next ; accessing it directly call LoadTextBoxTilePatterns @@ -195,13 +195,13 @@ ExitBillsPC: call PlaySound call WaitForSoundToFinish .next - ld hl, wFlags_0xcd60 - res 5, [hl] + ld hl, wMiscFlags + res BIT_NO_MENU_BUTTON_SOUND, [hl] call LoadScreenTilesFromBuffer2 pop af ld [wListScrollOffset], a - ld hl, wd730 - res 6, [hl] + ld hl, wStatusFlags5 + res BIT_NO_TEXT_DELAY, [hl] ret BillsPCDeposit: diff --git a/engine/pokemon/evos_moves.asm b/engine/pokemon/evos_moves.asm index d6b51ee50..fa6930c10 100644 --- a/engine/pokemon/evos_moves.asm +++ b/engine/pokemon/evos_moves.asm @@ -105,7 +105,7 @@ Evolution_PartyMonLoop: ; loop over party mons cp b ; is the mon's level greater than the evolution requirement? jp c, .nextEvoEntry2 ; if so, go the next evolution entry .doEvolution - ld [wCurEnemyLVL], a + ld [wCurEnemyLevel], a ld a, 1 ld [wEvolutionOccurred], a push hl @@ -340,7 +340,7 @@ LearnMoveFromLevelUp: and a ; have we reached the end of the learn set? jr z, .done ; if we've reached the end of the learn set, jump ld b, a ; level the move is learnt at - ld a, [wCurEnemyLVL] + ld a, [wCurEnemyLevel] cp b ; is the move learnt at the mon's current level? ld a, [hli] ; move ID jr nz, .learnSetLoop @@ -375,7 +375,7 @@ LearnMoveFromLevelUp: ld [wd11e], a ret -; writes the moves a mon has at level [wCurEnemyLVL] to [de] +; writes the moves a mon has at level [wCurEnemyLevel] to [de] ; move slots are being filled up sequentially and shifted if all slots are full WriteMonMoves: call GetPredefRegisters @@ -407,7 +407,7 @@ WriteMonMoves: and a jp z, .done ; end of list ld b, a - ld a, [wCurEnemyLVL] + ld a, [wCurEnemyLevel] cp b jp c, .done ; mon level < move level (assumption: learnset is sorted by level) ld a, [wLearningMovesFromDayCare] diff --git a/engine/pokemon/status_screen.asm b/engine/pokemon/status_screen.asm index ac03514a9..d29c23fe5 100644 --- a/engine/pokemon/status_screen.asm +++ b/engine/pokemon/status_screen.asm @@ -71,14 +71,14 @@ StatusScreen: ; mon is in a box or daycare ld a, [wLoadedMonBoxLevel] ld [wLoadedMonLevel], a - ld [wCurEnemyLVL], a + ld [wCurEnemyLevel], a ld hl, wLoadedMonHPExp - 1 ld de, wLoadedMonStats ld b, $1 call CalcStats ; Recalculate stats .DontRecalculate - ld hl, wd72c - set 1, [hl] + ld hl, wStatusFlags2 + set BIT_NO_AUDIO_FADE_OUT, [hl] ld a, $33 ldh [rNR50], a ; Reduce the volume call GBPalWhiteOutWithDelay3 @@ -430,8 +430,8 @@ StatusScreen2: call WaitForTextScrollButtonPress ; wait for button pop af ldh [hTileAnimations], a - ld hl, wd72c - res 1, [hl] + ld hl, wStatusFlags2 + res BIT_NO_AUDIO_FADE_OUT, [hl] ld a, $77 ldh [rNR50], a call GBPalWhiteOut diff --git a/engine/slots/slot_machine.asm b/engine/slots/slot_machine.asm index 6dd3b42d8..649f634cf 100644 --- a/engine/slots/slot_machine.asm +++ b/engine/slots/slot_machine.asm @@ -26,16 +26,16 @@ PromptUserToPlaySlots: call GBPalNormal ld a, $e4 ldh [rOBP0], a - ld hl, wd730 - set 6, [hl] + ld hl, wStatusFlags5 + set BIT_NO_TEXT_DELAY, [hl] xor a ld [wSlotMachineAllowMatchesCounter], a ld hl, wStoppingWhichSlotMachineWheel ld bc, $14 call FillMemory call MainSlotMachineLoop - ld hl, wd730 - res 6, [hl] + ld hl, wStatusFlags5 + res BIT_NO_TEXT_DELAY, [hl] xor a ld [wSlotMachineAllowMatchesCounter], a call GBPalWhiteOutWithDelay3 diff --git a/home/audio.asm b/home/audio.asm index 1da6453c5..c9d8b9837 100644 --- a/home/audio.asm +++ b/home/audio.asm @@ -10,8 +10,8 @@ PlayDefaultMusicFadeOutCurrent:: ; Fade out the current music and then play the default music. ld c, 10 ld d, 0 - ld a, [wd72e] - bit 5, a ; has a battle just ended? + ld a, [wStatusFlags4] + bit BIT_BATTLE_OVER_OR_BLACKOUT, a jr z, PlayDefaultMusicCommon xor a ld [wLastMusicSoundID], a diff --git a/home/fade_audio.asm b/home/fade_audio.asm index 4ad2607d5..b09d00360 100644 --- a/home/fade_audio.asm +++ b/home/fade_audio.asm @@ -2,8 +2,8 @@ FadeOutAudio:: ld a, [wAudioFadeOutControl] and a ; currently fading out audio? jr nz, .fadingOut - ld a, [wd72c] - bit 1, a + ld a, [wStatusFlags2] + bit BIT_NO_AUDIO_FADE_OUT, a ret nz ld a, $77 ldh [rNR50], a diff --git a/home/give.asm b/home/give.asm index f446cf36c..128367ecf 100644 --- a/home/give.asm +++ b/home/give.asm @@ -20,7 +20,7 @@ GivePokemon:: ld a, b ld [wcf91], a ld a, c - ld [wCurEnemyLVL], a + ld [wCurEnemyLevel], a xor a ; PLAYER_PARTY_DATA ld [wMonDataLocation], a farjp _GivePokemon diff --git a/home/list_menu.asm b/home/list_menu.asm index 77e75012e..1629b1886 100644 --- a/home/list_menu.asm +++ b/home/list_menu.asm @@ -15,8 +15,8 @@ DisplayListMenuID:: ld a, BANK(DisplayBattleMenu) .bankswitch call BankswitchHome - ld hl, wd730 - set 6, [hl] ; turn off letter printing delay + ld hl, wStatusFlags5 + set BIT_NO_TEXT_DELAY, [hl] xor a ld [wMenuItemToSwap], a ; 0 means no item is currently being swapped ld [wListCount], a @@ -164,8 +164,8 @@ DisplayListMenuIDLoop:: ld [wChosenMenuItem], a xor a ldh [hJoy7], a ; joypad state update flag - ld hl, wd730 - res 6, [hl] ; turn on letter printing delay + ld hl, wStatusFlags5 + res BIT_NO_TEXT_DELAY, [hl] jp BankswitchBack .checkOtherKeys ; check B, SELECT, Up, and Down keys bit BIT_B_BUTTON, a @@ -325,8 +325,8 @@ ExitListMenu:: ld [wMenuWatchMovingOutOfBounds], a xor a ldh [hJoy7], a - ld hl, wd730 - res 6, [hl] + ld hl, wStatusFlags5 + res BIT_NO_TEXT_DELAY, [hl] call BankswitchBack xor a ld [wMenuItemToSwap], a ; 0 means no item is currently being swapped diff --git a/home/map_objects.asm b/home/map_objects.asm index 27a699654..01dd8b6ad 100644 --- a/home/map_objects.asm +++ b/home/map_objects.asm @@ -56,8 +56,8 @@ StartSimulatingJoypadStates:: xor a ld [wOverrideSimulatedJoypadStatesMask], a ld [wSpritePlayerStateData2MovementByte1], a - ld hl, wd730 - set 7, [hl] + ld hl, wStatusFlags5 + set BIT_SCRIPTED_MOVEMENT_STATE, [hl] ret IsItemInBag:: diff --git a/home/move_mon.asm b/home/move_mon.asm index c766fbd58..45b10322f 100644 --- a/home/move_mon.asm +++ b/home/move_mon.asm @@ -172,7 +172,7 @@ CalcStat:: ldh [hMultiplicand+1], a xor a ldh [hMultiplicand], a - ld a, [wCurEnemyLVL] + ld a, [wCurEnemyLevel] ldh [hMultiplier], a call Multiply ; ((Base + IV) * 2 + ceil(Sqrt(stat exp)) / 4) * Level ldh a, [hMultiplicand] @@ -190,7 +190,7 @@ CalcStat:: cp $1 ld a, 5 ; + 5 for non-HP stat jr nz, .notHPStat - ld a, [wCurEnemyLVL] + ld a, [wCurEnemyLevel] ld b, a ldh a, [hMultiplicand+2] add b diff --git a/home/npc_movement.asm b/home/npc_movement.asm index 23a854272..96804fdf8 100644 --- a/home/npc_movement.asm +++ b/home/npc_movement.asm @@ -4,17 +4,17 @@ IsPlayerCharacterBeingControlledByGame:: ld a, [wNPCMovementScriptPointerTableNum] and a ret nz - ld a, [wd736] - bit 1, a ; currently stepping down from door bit + ld a, [wMovementFlags] + bit BIT_EXITING_DOOR, a ret nz - ld a, [wd730] - and $80 + ld a, [wStatusFlags5] + and 1 << BIT_SCRIPTED_MOVEMENT_STATE ret RunNPCMovementScript:: - ld hl, wd736 - bit 0, [hl] - res 0, [hl] + ld hl, wMovementFlags + bit BIT_STANDING_ON_DOOR, [hl] + res BIT_STANDING_ON_DOOR, [hl] jr nz, .playerStepOutFromDoor ld a, [wNPCMovementScriptPointerTableNum] and a @@ -54,7 +54,7 @@ DebugPressedOrHeldB:: ; dummy except in _DEBUG ; This is used to skip Trainer battles, the ; Safari Game step counter, and some NPC scripts. IF DEF(_DEBUG) - ld a, [wd732] + ld a, [wStatusFlags6] bit BIT_DEBUG_MODE, a ret z ldh a, [hJoyHeld] diff --git a/home/overworld.asm b/home/overworld.asm index eda5428a0..805a1b600 100644 --- a/home/overworld.asm +++ b/home/overworld.asm @@ -9,28 +9,28 @@ EnterMap:: ld [wJoyIgnore], a call LoadMapData farcall ClearVariablesOnEnterMap - ld hl, wd72c - bit 0, [hl] ; has the player already made 3 steps since the last battle? + ld hl, wStatusFlags2 + bit BIT_WILD_ENCOUNTER_COOLDOWN, [hl] jr z, .skipGivingThreeStepsOfNoRandomBattles ld a, 3 ; minimum number of steps between battles ld [wNumberOfNoRandomBattleStepsLeft], a .skipGivingThreeStepsOfNoRandomBattles - ld hl, wd72e - bit 5, [hl] ; did a battle happen immediately before this? - res 5, [hl] ; unset the "battle just happened" flag + ld hl, wStatusFlags4 + bit BIT_BATTLE_OVER_OR_BLACKOUT, [hl] + res BIT_BATTLE_OVER_OR_BLACKOUT, [hl] call z, ResetUsingStrengthOutOfBattleBit call nz, MapEntryAfterBattle - ld hl, wd732 + ld hl, wStatusFlags6 ld a, [hl] - and 1 << 4 | 1 << 3 ; fly warp or dungeon warp + and (1 << BIT_FLY_WARP) | (1 << BIT_DUNGEON_WARP) jr z, .didNotEnterUsingFlyWarpOrDungeonWarp - res 3, [hl] + res BIT_FLY_WARP, [hl] farcall EnterMapAnim call UpdateSprites .didNotEnterUsingFlyWarpOrDungeonWarp farcall CheckForceBikeOrSurf ; handle currents in SF islands and forced bike riding in cycling road - ld hl, wd72d - res 5, [hl] + ld hl, wStatusFlags3 + res BIT_NO_NPC_FACE_PLAYER, [hl] call UpdateSprites ld hl, wCurrentMapScriptFlags set 5, [hl] @@ -43,8 +43,8 @@ OverworldLoop:: OverworldLoopLessDelay:: call DelayFrame call LoadGBPal - ld a, [wd736] - bit 6, a ; jumping down a ledge? + ld a, [wMovementFlags] + bit BIT_LEDGE_OR_FISHING, a call nz, HandleMidJump ld a, [wWalkCounter] and a @@ -54,18 +54,18 @@ OverworldLoopLessDelay:: ld a, [wSafariZoneGameOver] and a jp nz, WarpFound2 - ld hl, wd72d - bit 3, [hl] - res 3, [hl] + ld hl, wStatusFlags3 + bit BIT_WARP_FROM_CUR_SCRIPT, [hl] + res BIT_WARP_FROM_CUR_SCRIPT, [hl] jp nz, WarpFound2 - ld a, [wd732] - and 1 << 4 | 1 << 3 ; fly warp or dungeon warp + ld a, [wStatusFlags6] + and (1 << BIT_FLY_WARP) | (1 << BIT_DUNGEON_WARP) jp nz, HandleFlyWarpOrDungeonWarp ld a, [wCurOpponent] and a jp nz, .newBattle - ld a, [wd730] - bit 7, a ; are we simulating button presses? + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_MOVEMENT_STATE, a jr z, .notSimulating ldh a, [hJoyHeld] jr .checkIfStartIsPressed @@ -82,8 +82,8 @@ OverworldLoopLessDelay:: bit BIT_A_BUTTON, a jp z, .checkIfDownButtonIsPressed ; if A is pressed - ld a, [wd730] - bit 2, a + ld a, [wStatusFlags5] + bit BIT_UNKNOWN_5_2, a jp nz, .noDirectionButtonsPressed call IsPlayerCharacterBeingControlledByGame jr nz, .checkForOpponent @@ -98,10 +98,10 @@ OverworldLoopLessDelay:: .displayDialogue predef GetTileAndCoordsInFrontOfPlayer call UpdateSprites - ld a, [wFlags_0xcd60] - bit 2, a + ld a, [wMiscFlags] + bit BIT_TURNING, a jr nz, .checkForOpponent - bit 0, a + bit BIT_SEEN_BY_TRAINER, a jr nz, .checkForOpponent lda_coord 8, 9 ld [wTilePlayerStandingOn], a ; checked when using Surf for forbidden tile pairs @@ -130,8 +130,8 @@ OverworldLoopLessDelay:: jp nz, .newBattle jp OverworldLoop .noDirectionButtonsPressed - ld hl, wFlags_0xcd60 - res 2, [hl] + ld hl, wMiscFlags + res BIT_TURNING, [hl] call UpdateSprites ld a, 1 ld [wCheckFor180DegreeTurn], a @@ -178,8 +178,8 @@ OverworldLoopLessDelay:: .handleDirectionButtonPress ld [wPlayerDirection], a ; new direction - ld a, [wd730] - bit 7, a ; are we simulating button presses? + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_MOVEMENT_STATE, a jr nz, .noDirectionChange ; ignore direction changes if we are ld a, [wCheckFor180DegreeTurn] and a @@ -222,8 +222,8 @@ OverworldLoopLessDelay:: ld a, PLAYER_DIR_UP ld [wPlayerMovingDirection], a .holdIntermediateDirectionLoop - ld hl, wFlags_0xcd60 - set 2, [hl] + ld hl, wMiscFlags + set BIT_TURNING, [hl] ld hl, wCheckFor180DegreeTurn dec [hl] jr nz, .holdIntermediateDirectionLoop @@ -245,8 +245,8 @@ OverworldLoopLessDelay:: jr nc, .noCollision ; collision occurred push hl - ld hl, wd736 - bit 2, [hl] ; standing on warp flag + ld hl, wMovementFlags + bit BIT_STANDING_ON_WARP, [hl] pop hl jp z, OverworldLoop ; collision occurred while standing on a warp @@ -266,21 +266,21 @@ OverworldLoopLessDelay:: jr .moveAhead2 .moveAhead - ld a, [wd736] - bit 7, a + ld a, [wMovementFlags] + bit BIT_SPINNING, a jr z, .noSpinning farcall LoadSpinnerArrowTiles .noSpinning call UpdateSprites .moveAhead2 - ld hl, wFlags_0xcd60 - res 2, [hl] + ld hl, wMiscFlags + res BIT_TURNING, [hl] ld a, [wWalkBikeSurfState] dec a ; riding a bike? jr nz, .normalPlayerSpriteAdvancement - ld a, [wd736] - bit 6, a ; jumping a ledge? + ld a, [wMovementFlags] + bit BIT_LEDGE_OR_FISHING, a jr nz, .normalPlayerSpriteAdvancement call DoBikeSpeedup .normalPlayerSpriteAdvancement @@ -289,20 +289,20 @@ OverworldLoopLessDelay:: and a jp nz, CheckMapConnections ; it seems like this check will never succeed (the other place where CheckMapConnections is run works) ; walking animation finished - ld a, [wd730] - bit 7, a + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_MOVEMENT_STATE, a jr nz, .doneStepCounting ; if button presses are being simulated, don't count steps ; step counting ld hl, wStepCounter dec [hl] - ld a, [wd72c] - bit 0, a + ld a, [wStatusFlags2] + bit BIT_WILD_ENCOUNTER_COOLDOWN, a jr z, .doneStepCounting ld hl, wNumberOfNoRandomBattleStepsLeft dec [hl] jr nz, .doneStepCounting - ld hl, wd72c - res 0, [hl] ; indicate that the player has stepped thrice since the last battle + ld hl, wStatusFlags2 + res BIT_WILD_ENCOUNTER_COOLDOWN, [hl] .doneStepCounting CheckEvent EVENT_IN_SAFARI_ZONE jr z, .notSafariZone @@ -320,14 +320,14 @@ OverworldLoopLessDelay:: jp nz, HandleBlackOut ; if all pokemon fainted .newBattle call NewBattle - ld hl, wd736 - res 2, [hl] ; standing on warp flag + ld hl, wMovementFlags + res BIT_STANDING_ON_WARP, [hl] jp nc, CheckWarpsNoCollision ; check for warps if there was no battle .battleOccurred - ld hl, wd72d - res 6, [hl] - ld hl, wFlags_D733 - res 3, [hl] + ld hl, wStatusFlags3 + res BIT_TALKED_TO_TRAINER, [hl] + ld hl, wStatusFlags7 + res BIT_TRAINER_BATTLE, [hl] ld hl, wCurrentMapScriptFlags set 5, [hl] set 6, [hl] @@ -338,8 +338,8 @@ OverworldLoopLessDelay:: jr nz, .notCinnabarGym SetEvent EVENT_2A7 .notCinnabarGym - ld hl, wd72e - set 5, [hl] + ld hl, wStatusFlags4 + set BIT_BATTLE_OVER_OR_BLACKOUT, [hl] ld a, [wCurMap] cp OAKS_LAB jp z, .noFaintCheck ; no blacking out if the player lost to the rival in Oak's lab @@ -360,13 +360,13 @@ OverworldLoopLessDelay:: ; function to determine if there will be a battle and execute it (either a trainer battle or wild battle) ; sets carry if a battle occurred and unsets carry if not NewBattle:: - ld a, [wd72d] - bit 4, a + ld a, [wStatusFlags3] + bit BIT_ON_DUNGEON_WARP, a jr nz, .noBattle call IsPlayerCharacterBeingControlledByGame jr nz, .noBattle ; no battle if the player character is under the game's control - ld a, [wd72e] - bit 4, a + ld a, [wStatusFlags4] + bit BIT_NO_BATTLES, a jr nz, .noBattle farjp InitBattle .noBattle @@ -410,8 +410,8 @@ CheckWarpsNoCollisionLoop:: ; if a match was found push hl push bc - ld hl, wd736 - set 2, [hl] ; standing on warp flag + ld hl, wMovementFlags + set BIT_STANDING_ON_WARP, [hl] farcall IsPlayerStandingOnDoorTileOrWarpTile pop bc pop hl @@ -423,8 +423,8 @@ CheckWarpsNoCollisionLoop:: pop hl jr nc, CheckWarpsNoCollisionRetry2 ; if the extra check passed - ld a, [wFlags_D733] - bit 2, a + ld a, [wStatusFlags7] + bit BIT_FORCED_WARP, a jr nz, WarpFound1 push de push bc @@ -516,16 +516,16 @@ WarpFound2:: dec a ; is the player on a warp pad? jr nz, .notWarpPad ; if the player is on a warp pad - ld hl, wd732 - set 3, [hl] + ld hl, wStatusFlags6 + set BIT_FLY_WARP, [hl] call LeaveMapAnim jr .skipMapChangeSound .notWarpPad call PlayMapChangeSound .skipMapChangeSound - ld hl, wd736 - res 0, [hl] - res 1, [hl] + ld hl, wMovementFlags + res BIT_STANDING_ON_DOOR, [hl] + res BIT_EXITING_DOOR, [hl] jr .done .goBackOutside ld a, [wLastMap] @@ -534,8 +534,8 @@ WarpFound2:: xor a ld [wMapPalOffset], a .done - ld hl, wd736 - set 0, [hl] ; have the player's sprite step out from the door (if there is one) + ld hl, wMovementFlags + set BIT_STANDING_ON_DOOR, [hl] ; have the player's sprite step out from the door (if there is one) call IgnoreInputForHalfSecond jp EnterMap @@ -756,12 +756,11 @@ MapEntryAfterBattle:: HandleBlackOut:: ; For when all the player's pokemon faint. ; Does not print the "blacked out" message. - call GBFadeOutToBlack ld a, $08 call StopMusic - ld hl, wd72e - res 5, [hl] + ld hl, wStatusFlags4 + res BIT_BATTLE_OVER_OR_BLACKOUT, [hl] ld a, BANK(ResetStatusAndHalveMoneyOnBlackout) ; also BANK(PrepareForSpecialWarp) and BANK(SpecialEnterMap) ldh [hLoadedROMBank], a ld [MBC1RomBank], a @@ -789,9 +788,9 @@ HandleFlyWarpOrDungeonWarp:: ld [wWalkBikeSurfState], a ld [wIsInBattle], a ld [wMapPalOffset], a - ld hl, wd732 - set 2, [hl] ; fly warp or dungeon warp - res 5, [hl] ; forced to ride bike + ld hl, wStatusFlags6 + set BIT_FLY_OR_DUNGEON_WARP, [hl] + res BIT_ALWAYS_ON_BIKE, [hl] call LeaveMapAnim ld a, BANK(PrepareForSpecialWarp) ldh [hLoadedROMBank], a @@ -1219,8 +1218,8 @@ IsSpriteInFrontOfPlayer2:: ; function to check if the player will jump down a ledge and check if the tile ahead is passable (when not surfing) ; sets the carry flag if there is a collision, and unsets it if there isn't a collision CollisionCheckOnLand:: - ld a, [wd736] - bit 6, a ; is the player jumping? + ld a, [wMovementFlags] + bit BIT_LEDGE_OR_FISHING, a jr nz, .noCollision ; if not jumping a ledge ld a, [wSimulatedJoypadStatesIndex] @@ -1291,8 +1290,8 @@ CheckForJumpingAndTilePairCollisions:: pop de pop hl and a - ld a, [wd736] - bit 6, a ; is the player jumping? + ld a, [wMovementFlags] + bit BIT_LEDGE_OR_FISHING, a ret nz ; if not jumping @@ -1826,8 +1825,8 @@ JoypadOverworld:: ld [wSpritePlayerStateData1XStepVector], a call RunMapScript call Joypad - ld a, [wFlags_D733] - bit 3, a ; check if a trainer wants a challenge + ld a, [wStatusFlags7] + bit BIT_TRAINER_BATTLE, a jr nz, .notForcedDownwards ld a, [wCurMap] cp ROUTE_17 ; Cycling Road @@ -1838,8 +1837,8 @@ JoypadOverworld:: ld a, D_DOWN ldh [hJoyHeld], a ; on the cycling road, if there isn't a trainer and the player isn't pressing buttons, simulate a down press .notForcedDownwards - ld a, [wd730] - bit 7, a + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_MOVEMENT_STATE, a ret z ; if simulating button presses ldh a, [hJoyHeld] @@ -1874,12 +1873,12 @@ JoypadOverworld:: ld [wSimulatedJoypadStatesEnd], a ld [wJoyIgnore], a ldh [hJoyHeld], a - ld hl, wd736 + ld hl, wMovementFlags ld a, [hl] - and $f8 + and (1 << BIT_SPINNING) | (1 << BIT_LEDGE_OR_FISHING) | (1 << 5) | (1 << 4) | (1 << 3) ld [hl], a - ld hl, wd730 - res 7, [hl] + ld hl, wStatusFlags5 + res BIT_SCRIPTED_MOVEMENT_STATE, [hl] ret ; function to check the tile ahead to determine if the character should get on land or keep surfing @@ -1892,8 +1891,8 @@ JoypadOverworld:: ; and 2429 always sets c to 0xF0. There is no 0xF0 background tile, so it ; is considered impassable and it is detected as a collision. CollisionCheckOnWater:: - ld a, [wd730] - bit 7, a + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_MOVEMENT_STATE, a jp nz, .noCollision ; return and clear carry if button presses are being simulated ld a, [wPlayerDirection] ; the direction that the player is trying to go in ld d, a @@ -1955,8 +1954,8 @@ RunMapScript:: push de push bc farcall TryPushingBoulder - ld a, [wFlags_0xcd60] - bit 1, a ; play boulder dust animation + ld a, [wMiscFlags] + bit BIT_BOULDER_DUST, a jr z, .afterBoulderEffect farcall DoBoulderDustAnimation .afterBoulderEffect @@ -2137,8 +2136,8 @@ LoadMapHeader:: dec c jr nz, .signLoop .loadSpriteData - ld a, [wd72e] - bit 5, a ; did a battle happen immediately before this? + ld a, [wStatusFlags4] + bit BIT_BATTLE_OVER_OR_BLACKOUT, a jp nz, .finishUp ; if so, skip this because battles don't destroy this data ld a, [hli] ld [wNumSprites], a ; save the number of sprites @@ -2343,11 +2342,11 @@ LoadMapData:: ld b, SET_PAL_OVERWORLD call RunPaletteCommand call LoadPlayerSpriteGraphics - ld a, [wd732] - and 1 << 4 | 1 << 3 ; fly warp or dungeon warp + ld a, [wStatusFlags6] + and (1 << BIT_FLY_WARP) | (1 << BIT_DUNGEON_WARP) jr nz, .restoreRomBank - ld a, [wFlags_D733] - bit 1, a + ld a, [wStatusFlags7] + bit BIT_NO_MAP_MUSIC, a jr nz, .restoreRomBank call UpdateMusic6Times call PlayDefaultMusicFadeOutCurrent @@ -2381,15 +2380,15 @@ SwitchToMapRomBank:: IgnoreInputForHalfSecond: ld a, 30 ld [wIgnoreInputCounter], a - ld hl, wd730 + ld hl, wStatusFlags5 ld a, [hl] - or %00100110 + or (1 << BIT_DISABLE_JOYPAD) | (1 << BIT_UNKNOWN_5_2) | (1 << BIT_UNKNOWN_5_1) ld [hl], a ; set ignore input bit ret ResetUsingStrengthOutOfBattleBit: - ld hl, wd728 - res 0, [hl] + ld hl, wStatusFlags1 + res BIT_STRENGTH_ACTIVE, [hl] ret ForceBikeOrSurf:: diff --git a/home/pathfinding.asm b/home/pathfinding.asm index 766e7b375..12128f68c 100644 --- a/home/pathfinding.asm +++ b/home/pathfinding.asm @@ -32,8 +32,8 @@ MoveSprite_:: ld [wNPCNumScriptedSteps], a ; number of steps taken pop bc - ld hl, wd730 - set 0, [hl] + ld hl, wStatusFlags5 + set BIT_SCRIPTED_NPC_MOVEMENT, [hl] pop hl xor a ld [wOverrideSimulatedJoypadStatesMask], a diff --git a/home/pokemon.asm b/home/pokemon.asm index 3e63de35b..131fbd854 100644 --- a/home/pokemon.asm +++ b/home/pokemon.asm @@ -198,8 +198,8 @@ PartyMenuInit:: ld a, 1 ; hardcoded bank call BankswitchHome call LoadHpBarAndStatusTilePatterns - ld hl, wd730 - set 6, [hl] ; turn off letter printing delay + ld hl, wStatusFlags5 + set BIT_NO_TEXT_DELAY, [hl] xor a ; PLAYER_PARTY_DATA ld [wMonDataLocation], a ld [wMenuWatchMovingOutOfBounds], a @@ -245,8 +245,8 @@ HandlePartyMenuInput:: ld [wPartyMenuAnimMonEnabled], a ld a, [wCurrentMenuItem] ld [wPartyAndBillsPCSavedMenuItem], a - ld hl, wd730 - res 6, [hl] ; turn on letter printing delay + ld hl, wStatusFlags5 + res BIT_NO_TEXT_DELAY, [hl] ld a, [wMenuItemToSwap] and a jp nz, .swappingPokemon diff --git a/home/print_text.asm b/home/print_text.asm index 962ae519a..65d418a34 100644 --- a/home/print_text.asm +++ b/home/print_text.asm @@ -1,18 +1,18 @@ ; This function is used to wait a short period after printing a letter to the ; screen unless the player presses the A/B button or the delay is turned off -; through the [wd730] or [wLetterPrintingDelayFlags] flags. +; through the [wStatusFlags5] or [wLetterPrintingDelayFlags] flags. PrintLetterDelay:: - ld a, [wd730] - bit 6, a + ld a, [wStatusFlags5] + bit BIT_NO_TEXT_DELAY, a ret nz ld a, [wLetterPrintingDelayFlags] - bit 1, a + bit BIT_TEXT_DELAY, a ret z push hl push de push bc ld a, [wLetterPrintingDelayFlags] - bit 0, a + bit BIT_FAST_TEXT_DELAY, a jr z, .waitOneFrame ld a, [wOptions] and $f diff --git a/home/reload_tiles.asm b/home/reload_tiles.asm index 6228395c5..76110dbe2 100644 --- a/home/reload_tiles.asm +++ b/home/reload_tiles.asm @@ -30,8 +30,8 @@ ReloadTilesetTilePatterns:: ; shows the town map and lets the player choose a destination to fly to ChooseFlyDestination:: - ld hl, wd72e - res 4, [hl] + ld hl, wStatusFlags4 + res BIT_NO_BATTLES, [hl] farjp LoadTownMap_Fly ; causes the text box to close without waiting for a button press after displaying text diff --git a/home/text.asm b/home/text.asm index 9462c7490..e815fbf7c 100644 --- a/home/text.asm +++ b/home/text.asm @@ -315,7 +315,7 @@ ProtectedDelay3:: TextCommandProcessor:: ld a, [wLetterPrintingDelayFlags] push af - set 1, a + set BIT_TEXT_DELAY, a ld e, a ldh a, [hClearLetterPrintingDelayFlags] xor e diff --git a/home/text_script.asm b/home/text_script.asm index ceae1a0a1..5c90a981e 100644 --- a/home/text_script.asm +++ b/home/text_script.asm @@ -128,8 +128,8 @@ CloseTextDisplay:: call InitMapSprites ; reload sprite tile pattern data (since it was partially overwritten by text tile patterns) ld hl, wFontLoaded res 0, [hl] - ld a, [wd732] - bit 3, a ; used fly warp + ld a, [wStatusFlags6] + bit BIT_FLY_WARP, a call z, LoadPlayerSpriteGraphics call LoadCurrentMapView pop af @@ -196,9 +196,9 @@ PokemonFaintedText:: DisplayPlayerBlackedOutText:: ld hl, PlayerBlackedOutText call PrintText - ld a, [wd732] - res 5, a ; reset forced to use bike bit - ld [wd732], a + ld a, [wStatusFlags6] + res BIT_ALWAYS_ON_BIKE, a + ld [wStatusFlags6], a jp HoldTextDisplayOpen PlayerBlackedOutText:: diff --git a/home/trainers.asm b/home/trainers.asm index 011c1d6d3..0038d48c8 100644 --- a/home/trainers.asm +++ b/home/trainers.asm @@ -16,9 +16,9 @@ ExecuteCurMapScriptInTable:: pop hl pop af push hl - ld hl, wFlags_D733 - bit 4, [hl] - res 4, [hl] + ld hl, wStatusFlags7 + bit BIT_USE_CUR_MAP_SCRIPT, [hl] + res BIT_USE_CUR_MAP_SCRIPT, [hl] jr z, .useProvidedIndex ; test if map script index was overridden manually ld a, [wCurMapScript] .useProvidedIndex @@ -114,10 +114,10 @@ TalkToTrainer:: call ReadTrainerHeaderInfo ; read end battle text pop de call SaveEndBattleTextPointers - ld hl, wFlags_D733 - set 4, [hl] ; activate map script index override (index is set below) - ld hl, wFlags_0xcd60 - bit 0, [hl] ; test if player is already engaging the trainer (because the trainer saw the player) + ld hl, wStatusFlags7 + set BIT_USE_CUR_MAP_SCRIPT, [hl] ; activate map script index override (index is set below) + ld hl, wMiscFlags + bit BIT_SEEN_BY_TRAINER, [hl] ; test if player is already engaging the trainer (because the trainer saw the player) ret nz ; if the player talked to the trainer of his own volition call EngageMapTrainer @@ -143,8 +143,8 @@ ENDC ld [wTrainerHeaderFlagBit], a ret .trainerEngaging - ld hl, wFlags_D733 - set 3, [hl] + ld hl, wStatusFlags7 + set BIT_TRAINER_BATTLE, [hl] ld [wEmotionBubbleSpriteIndex], a xor a ; EXCLAMATION_BUBBLE ld [wWhichEmotionBubble], a @@ -160,8 +160,8 @@ ENDC ; display the before battle text after the enemy trainer has walked up to the player's sprite DisplayEnemyTrainerTextAndStartBattle:: - ld a, [wd730] - and $1 + ld a, [wStatusFlags5] + and 1 << BIT_SCRIPTED_NPC_MOVEMENT ret nz ; return if the enemy trainer hasn't finished walking to the player's sprite ld [wJoyIgnore], a ld a, [wSpriteIndex] @@ -173,11 +173,11 @@ StartTrainerBattle:: xor a ld [wJoyIgnore], a call InitBattleEnemyParameters - ld hl, wd72d - set 6, [hl] - set 7, [hl] - ld hl, wd72e - set 1, [hl] + ld hl, wStatusFlags3 + set BIT_TALKED_TO_TRAINER, [hl] + set BIT_PRINT_END_BATTLE_TEXT, [hl] + ld hl, wStatusFlags4 + set BIT_UNKNOWN_4_1, [hl] ld hl, wCurMapScript inc [hl] ; increment map script index (next script function is usually EndTrainerBattle) ret @@ -186,10 +186,10 @@ EndTrainerBattle:: ld hl, wCurrentMapScriptFlags set 5, [hl] set 6, [hl] - ld hl, wd72d - res 7, [hl] - ld hl, wFlags_0xcd60 - res 0, [hl] ; player is no longer engaged by any trainer + ld hl, wStatusFlags3 + res BIT_PRINT_END_BATTLE_TEXT, [hl] + ld hl, wMiscFlags + res BIT_SEEN_BY_TRAINER, [hl] ; player is no longer engaged by any trainer ld a, [wIsInBattle] cp $ff jp z, ResetButtonPressedAndMapScript @@ -211,9 +211,9 @@ EndTrainerBattle:: ld [wMissableObjectIndex], a ; load corresponding missable object index and remove it predef HideObject .skipRemoveSprite - ld hl, wd730 - bit 4, [hl] - res 4, [hl] + ld hl, wStatusFlags5 + bit BIT_UNKNOWN_5_4, [hl] + res BIT_UNKNOWN_5_4, [hl] ret nz ResetButtonPressedAndMapScript:: @@ -240,7 +240,7 @@ InitBattleEnemyParameters:: ld [wTrainerNo], a ret .noTrainer - ld [wCurEnemyLVL], a + ld [wCurEnemyLevel], a ret GetSpritePosition1:: @@ -340,9 +340,9 @@ EngageMapTrainer:: PrintEndBattleText:: push hl - ld hl, wd72d - bit 7, [hl] - res 7, [hl] + ld hl, wStatusFlags3 + bit BIT_PRINT_END_BATTLE_TEXT, [hl] + res BIT_PRINT_END_BATTLE_TEXT, [hl] pop hl ret z ldh a, [hLoadedROMBank] @@ -389,8 +389,8 @@ TrainerEndBattleText:: ; engaged with another trainer ; XXX unused? CheckIfAlreadyEngaged:: - ld a, [wFlags_0xcd60] - bit 0, a + ld a, [wMiscFlags] + bit BIT_SEEN_BY_TRAINER, a ret nz call EngageMapTrainer xor a diff --git a/home/window.asm b/home/window.asm index 0abe366da..01b52d410 100644 --- a/home/window.asm +++ b/home/window.asm @@ -95,8 +95,8 @@ HandleMenuInput_:: jr z, .skipPlayingSound .AButtonOrBButtonPressed push hl - ld hl, wFlags_0xcd60 - bit 5, [hl] + ld hl, wMiscFlags + bit BIT_NO_MENU_BUTTON_SOUND, [hl] pop hl jr nz, .skipPlayingSound ld a, SFX_PRESS_AB diff --git a/includes.asm b/includes.asm index 6253859b6..8808e1d0b 100644 --- a/includes.asm +++ b/includes.asm @@ -16,6 +16,7 @@ INCLUDE "macros/scripts/text.asm" INCLUDE "constants/charmap.asm" INCLUDE "constants/hardware_constants.asm" INCLUDE "constants/oam_constants.asm" +INCLUDE "constants/ram_constants.asm" INCLUDE "constants/misc_constants.asm" INCLUDE "constants/gfx_constants.asm" INCLUDE "constants/input_constants.asm" diff --git a/ram/wram.asm b/ram/wram.asm index 12a734036..4ff730dd0 100644 --- a/ram/wram.asm +++ b/ram/wram.asm @@ -399,8 +399,8 @@ NEXTU wSimulatedJoypadStatesEnd:: NEXTU -wBoostExpByExpAll:: -wUnusedCC5B:: db +wUnusedFlag:: +wBoostExpByExpAll:: db ds 59 @@ -850,12 +850,7 @@ wLeftGBMonSpecies:: db ; in the trade animation, the mon that leaves the right gameboy wRightGBMonSpecies:: db -; bit 0: is player engaged by trainer (to avoid being engaged by multiple trainers simultaneously) -; bit 1: boulder dust animation (from using Strength) pending -; bit 3: using generic PC -; bit 5: don't play sound when A or B is pressed in menu -; bit 6: tried pushing against boulder once (you need to push twice before it will move) -wFlags_0xcd60:: db +wMiscFlags:: db ds 9 @@ -1243,38 +1238,15 @@ wMoveMissed:: db ; always 0 wPlayerStatsToDouble:: db - ; always 0 wPlayerStatsToHalve:: db -; bit 0 - bide -; bit 1 - thrash / petal dance -; bit 2 - attacking multiple times (e.g. double kick) -; bit 3 - flinch -; bit 4 - charging up for attack -; bit 5 - using multi-turn move (e.g. wrap) -; bit 6 - invulnerable to normal attack (using fly/dig) -; bit 7 - confusion wPlayerBattleStatus1:: db - -; bit 0 - X Accuracy effect -; bit 1 - protected by "mist" -; bit 2 - focus energy effect -; bit 4 - has a substitute -; bit 5 - need to recharge -; bit 6 - rage -; bit 7 - leech seeded wPlayerBattleStatus2:: db - -; bit 0 - toxic -; bit 1 - light screen -; bit 2 - reflect -; bit 3 - transformed wPlayerBattleStatus3:: db ; always 0 wEnemyStatsToDouble:: db - ; always 0 wEnemyStatsToHalve:: db @@ -1602,7 +1574,7 @@ wTextBoxID:: db wCurrentMapScriptFlags:: db ; not exactly sure what this is used for, but it seems to be used as a multipurpose temp flag value -wCurEnemyLVL:: db +wCurEnemyLevel:: db ; pointer to list of items terminated by $FF wItemListPointer:: dw @@ -1648,7 +1620,7 @@ wSavedSpriteMapX:: db wWhichPrize:: db ; counts downward each frame -; when it hits 0, bit 5 (ignore input bit) of wd730 is reset +; when it hits 0, BIT_DISABLE_JOYPAD of wStatusFlags5 is reset wIgnoreInputCounter:: db ; counts down once every step @@ -1743,26 +1715,12 @@ wPlayerMoney:: ds 3 ; BCD wRivalName:: ds NAME_LENGTH -; bit 7 = battle animation -; 0: On -; 1: Off -; bit 6 = battle style -; 0: Shift -; 1: Set -; bits 0-3 = text speed (number of frames to delay after printing a letter) -; 1: Fast -; 3: Medium -; 5: Slow wOptions:: db wObtainedBadges:: flag_array NUM_BADGES ds 1 -; bit 0: If 0, limit the delay to 1 frame. Note that this has no effect if -; the delay has been disabled entirely through bit 1 of this variable -; or bit 6 of wd730. -; bit 1: If 0, no delay. wLetterPrintingDelayFlags:: db wPlayerID:: dw @@ -2097,88 +2055,22 @@ wUnusedCardKeyGateID:: db ds 8 -; bit 0: using Strength outside of battle -; bit 1: set by IsSurfingAllowed when surfing's allowed, but the caller resets it after checking the result -; bit 3: received Old Rod -; bit 4: received Good Rod -; bit 5: received Super Rod -; bit 6: gave one of the Saffron guards a drink -; bit 7: set by ItemUseCardKey, which is leftover code from a previous implementation of the Card Key -wd728:: db - +wStatusFlags1:: db ds 1 - -; redundant because it matches wObtainedBadges -; used to determine whether to show name on statue and in two NPC text scripts -wBeatGymFlags:: db - +wBeatGymFlags:: db ; redundant because it matches wObtainedBadges ds 1 - -; bit 0: if not set, the 3 minimum steps between random battles have passed -; bit 1: prevent audio fade out -wd72c:: db - -; This variable is used for temporary flags and as the destination map when -; warping to the Trade Center or Colosseum. -; bit 0: sprite facing directions have been initialised in the Trade Center -; bit 3: do scripted warp (used to warp back to Lavender Town from the top of the pokemon tower) -; bit 4: on a dungeon warp -; bit 5: don't make NPCs face the player when spoken to -; Bits 6 and 7 are set by scripts when starting major battles in the storyline, -; but they do not appear to affect anything. Bit 6 is reset after all battles -; and bit 7 is reset after trainer battles (but it's only set before trainer -; battles anyway). -wd72d:: db - -; bit 0: the player has received Lapras in the Silph Co. building -; bit 1: set in various places, but doesn't appear to have an effect -; bit 2: the player has healed pokemon at a pokemon center at least once -; bit 3: the player has a received a pokemon from Prof. Oak -; bit 4: disable battles -; bit 5: set when a battle ends and when the player blacks out in the overworld due to poison -; bit 6: using the link feature -; bit 7: set if scripted NPC movement has been initialised -wd72e:: db - +wStatusFlags2:: db +wCableClubDestinationMap:: +wStatusFlags3:: db +wStatusFlags4:: db ds 1 - -; bit 0: NPC sprite being moved by script -; bit 5: ignore joypad input -; bit 6: print text with no delay between each letter -; bit 7: set if joypad states are being simulated in the overworld or an NPC's movement is being scripted -wd730:: db - +wStatusFlags5:: db ds 1 - -; bit 0: play time being counted -; bit 1: debug mode (unused and incomplete in non-debug builds) -; bit 2: the target warp is a fly warp (bit 3 set or blacked out) or a dungeon warp (bit 4 set) -; bit 3: used warp pad, escape rope, dig, teleport, or fly, so the target warp is a "fly warp" -; bit 4: jumped into hole (Pokemon Mansion, Seafoam Islands, Victory Road) or went down waterfall (Seafoam Islands), so the target warp is a "dungeon warp" -; bit 5: currently being forced to ride bike (cycling road) -; bit 6: map destination is [wLastBlackoutMap] (usually the last used pokemon center, but could be the player's house) -wd732:: db - -; bit 0: running a test battle (unused in non-debug builds) -; bit 1: prevent music from changing when entering new map -; bit 2: skip the joypad check in CheckWarpsNoCollision (used for the forced warp down the waterfall in the Seafoam Islands) -; bit 3: trainer wants to battle -; bit 4: use variable [wCurMapScript] instead of the provided index for next frame's map script (used to start battle when talking to trainers) -; bit 7: used fly out of battle -wFlags_D733:: db - -; bit 1: set when you beat Lorelei and reset in Indigo Plateau lobby -; the game uses this to tell when Elite 4 events need to be reset -wBeatLorelei:: db - +wStatusFlags6:: db +wStatusFlags7:: db +wElite4Flags:: db ds 1 - -; bit 0: check if the player is standing on a door and make him walk down a step if so -; bit 1: the player is currently stepping down from a door -; bit 2: standing on a warp -; bit 6: jumping down a ledge / fishing animation -; bit 7: player sprite spinning due to spin tiles (Rocket hideout / Viridian Gym) -wd736:: db +wMovementFlags:: db wCompletedInGameTradeFlags:: dw diff --git a/scripts/BikeShop.asm b/scripts/BikeShop.asm index 3321a23e7..d8b82386a 100644 --- a/scripts/BikeShop.asm +++ b/scripts/BikeShop.asm @@ -48,8 +48,8 @@ BikeShopClerkText: ld [wTopMenuItemY], a ld a, $1 ld [wTopMenuItemX], a - ld hl, wd730 - set 6, [hl] + ld hl, wStatusFlags5 + set BIT_NO_TEXT_DELAY, [hl] hlcoord 0, 0 ld b, 4 ld c, 15 @@ -66,8 +66,8 @@ BikeShopClerkText: call HandleMenuInput bit BIT_B_BUTTON, a jr nz, .cancel - ld hl, wd730 - res 6, [hl] + ld hl, wStatusFlags5 + res BIT_NO_TEXT_DELAY, [hl] ld a, [wCurrentMenuItem] and a jr nz, .cancel diff --git a/scripts/BillsHouse.asm b/scripts/BillsHouse.asm index b6257d4f0..cf87ea64b 100644 --- a/scripts/BillsHouse.asm +++ b/scripts/BillsHouse.asm @@ -46,8 +46,8 @@ BillsHousePokemonWalkToMachineScript: db -1 ; end BillsHousePokemonEntersMachineScript: - ld a, [wd730] - bit 0, a + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_NPC_MOVEMENT, a ret nz ld a, HS_BILL_POKEMON ld [wMissableObjectIndex], a @@ -97,8 +97,8 @@ BillExitMachineMovement: db -1 ; end BillsHouseCleanupScript: - ld a, [wd730] - bit 0, a + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_NPC_MOVEMENT, a ret nz xor a ld [wJoyIgnore], a diff --git a/scripts/CeladonGym.asm b/scripts/CeladonGym.asm index 0195d0b9e..ea1f50538 100644 --- a/scripts/CeladonGym.asm +++ b/scripts/CeladonGym.asm @@ -119,9 +119,9 @@ CeladonGymErikaText: .beforeBeat ld hl, .PreBattleText call PrintText - ld hl, wd72d - set 6, [hl] - set 7, [hl] + ld hl, wStatusFlags3 + set BIT_TALKED_TO_TRAINER, [hl] + set BIT_PRINT_END_BATTLE_TEXT, [hl] ld hl, .ReceivedRainbowBadgeText ld de, .ReceivedRainbowBadgeText call SaveEndBattleTextPointers diff --git a/scripts/CeladonMartRoof.asm b/scripts/CeladonMartRoof.asm index 1edc39faa..73c128058 100644 --- a/scripts/CeladonMartRoof.asm +++ b/scripts/CeladonMartRoof.asm @@ -41,8 +41,8 @@ CeladonMartRoofDrinkList: db 0 ; end CeladonMartRoofScript_GiveDrinkToGirl: - ld hl, wd730 - set 6, [hl] + ld hl, wStatusFlags5 + set BIT_NO_TEXT_DELAY, [hl] ld hl, CeladonMartRoofLittleGirlGiveHerWhichDrinkText call PrintText xor a @@ -68,8 +68,8 @@ CeladonMartRoofScript_GiveDrinkToGirl: call TextBoxBorder call UpdateSprites call CeladonMartRoofScript_PrintDrinksInBag - ld hl, wd730 - res 6, [hl] + ld hl, wStatusFlags5 + res BIT_NO_TEXT_DELAY, [hl] call HandleMenuInput bit BIT_B_BUTTON, a ret nz diff --git a/scripts/CeruleanCity.asm b/scripts/CeruleanCity.asm index 439c31ade..2ff5f3be7 100644 --- a/scripts/CeruleanCity.asm +++ b/scripts/CeruleanCity.asm @@ -125,17 +125,17 @@ CeruleanCityFaceRivalScript: jp SetSpriteFacingDirectionAndDelay ; face object CeruleanCityRivalBattleScript: - ld a, [wd730] - bit 0, a + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_NPC_MOVEMENT, a ret nz xor a ld [wJoyIgnore], a ld a, TEXT_CERULEANCITY_RIVAL ldh [hSpriteIndexOrTextID], a call DisplayTextID - ld hl, wd72d - set 6, [hl] - set 7, [hl] + ld hl, wStatusFlags3 + set BIT_TALKED_TO_TRAINER, [hl] + set BIT_PRINT_END_BATTLE_TEXT, [hl] ld hl, CeruleanCityRivalDefeatedText ld de, CeruleanCityRivalVictoryText call SaveEndBattleTextPointers @@ -219,8 +219,8 @@ CeruleanCityMovement4: db -1 ; end CeruleanCityRivalCleanupScript: - ld a, [wd730] - bit 0, a + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_NPC_MOVEMENT, a ret nz ld a, HS_CERULEAN_RIVAL ld [wMissableObjectIndex], a @@ -289,9 +289,9 @@ CeruleanCityRocketText: jr nz, .beatRocketThief ld hl, .Text call PrintText - ld hl, wd72d - set 6, [hl] - set 7, [hl] + ld hl, wStatusFlags3 + set BIT_TALKED_TO_TRAINER, [hl] + set BIT_PRINT_END_BATTLE_TEXT, [hl] ld hl, .IGiveUpText ld de, .IGiveUpText call SaveEndBattleTextPointers diff --git a/scripts/CeruleanGym.asm b/scripts/CeruleanGym.asm index 8e6694ea1..7795b70bc 100644 --- a/scripts/CeruleanGym.asm +++ b/scripts/CeruleanGym.asm @@ -105,9 +105,9 @@ CeruleanGymMistyText: .beforeBeat ld hl, .PreBattleText call PrintText - ld hl, wd72d - set 6, [hl] - set 7, [hl] + ld hl, wStatusFlags3 + set BIT_TALKED_TO_TRAINER, [hl] + set BIT_PRINT_END_BATTLE_TEXT, [hl] ld hl, CeruleanGymMistyReceivedCascadeBadgeText ld de, CeruleanGymMistyReceivedCascadeBadgeText call SaveEndBattleTextPointers diff --git a/scripts/ChampionsRoom.asm b/scripts/ChampionsRoom.asm index c6c7c1dd7..f3c9818df 100644 --- a/scripts/ChampionsRoom.asm +++ b/scripts/ChampionsRoom.asm @@ -54,14 +54,14 @@ ChampionsRoomRivalReadyToBattleScript: xor a ld [wJoyIgnore], a ld hl, wOptions - res 7, [hl] ; Turn on battle animations to make the battle feel more epic. + res BIT_BATTLE_ANIMATION, [hl] ld a, TEXT_CHAMPIONSROOM_RIVAL ldh [hSpriteIndexOrTextID], a call DisplayTextID call Delay3 - ld hl, wd72d - set 6, [hl] - set 7, [hl] + ld hl, wStatusFlags3 + set BIT_TALKED_TO_TRAINER, [hl] + set BIT_PRINT_END_BATTLE_TEXT, [hl] ld hl, RivalDefeatedText ld de, RivalVictoryText call SaveEndBattleTextPointers @@ -136,8 +136,8 @@ OakEntranceAfterVictoryMovement: db -1 ; end ChampionsRoomOakCongratulatesPlayerScript: - ld a, [wd730] - bit 0, a + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_NPC_MOVEMENT, a ret nz ld a, PLAYER_DIR_LEFT ld [wPlayerMovingDirection], a @@ -194,8 +194,8 @@ OakExitChampionsRoomMovement: db -1 ; end ChampionsRoomOakExitsScript: - ld a, [wd730] - bit 0, a + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_NPC_MOVEMENT, a ret nz ld a, HS_CHAMPIONS_ROOM_OAK ld [wMissableObjectIndex], a diff --git a/scripts/CinnabarGym.asm b/scripts/CinnabarGym.asm index 17ac1ac1e..a7608a4fe 100644 --- a/scripts/CinnabarGym.asm +++ b/scripts/CinnabarGym.asm @@ -81,8 +81,8 @@ MovementNpcToLeft: db -1 ; end CinnabarGymGetOpponentTextScript: - ld a, [wd730] - bit 0, a + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_NPC_MOVEMENT, a ret nz xor a ld [wJoyIgnore], a @@ -194,9 +194,9 @@ CinnabarGymStartBattleScript: ld [wSpriteIndex], a call EngageMapTrainer call InitBattleEnemyParameters - ld hl, wd72d - set 6, [hl] - set 7, [hl] + ld hl, wStatusFlags3 + set BIT_TALKED_TO_TRAINER, [hl] + set BIT_PRINT_END_BATTLE_TEXT, [hl] ld a, [wSpriteIndex] cp CINNABARGYM_BLAINE jr z, .blaine diff --git a/scripts/FightingDojo.asm b/scripts/FightingDojo.asm index d434f6816..754270496 100644 --- a/scripts/FightingDojo.asm +++ b/scripts/FightingDojo.asm @@ -111,9 +111,9 @@ FightingDojoKarateMasterText: jp nz, .defeated_master ld hl, .Text call PrintText - ld hl, wd72d - set 6, [hl] - set 7, [hl] + ld hl, wStatusFlags3 + set BIT_TALKED_TO_TRAINER, [hl] + set BIT_PRINT_END_BATTLE_TEXT, [hl] ld hl, .DefeatedText ld de, .DefeatedText call SaveEndBattleTextPointers diff --git a/scripts/FuchsiaGoodRodHouse.asm b/scripts/FuchsiaGoodRodHouse.asm index 4bfd49ae6..ee55938b9 100644 --- a/scripts/FuchsiaGoodRodHouse.asm +++ b/scripts/FuchsiaGoodRodHouse.asm @@ -7,8 +7,8 @@ FuchsiaGoodRodHouse_TextPointers: FuchsiaGoodRodHouseFishingGuruText: text_asm - ld a, [wd728] - bit 4, a ; got good rod? + ld a, [wStatusFlags1] + bit BIT_GOT_GOOD_ROD, a jr nz, .got_item ld hl, .Text call PrintText @@ -19,8 +19,8 @@ FuchsiaGoodRodHouseFishingGuruText: lb bc, GOOD_ROD, 1 call GiveItem jr nc, .bag_full - ld hl, wd728 - set 4, [hl] ; got good rod + ld hl, wStatusFlags1 + set BIT_GOT_GOOD_ROD, [hl] ld hl, .ReceivedGoodRodText jr .done .bag_full diff --git a/scripts/FuchsiaGym.asm b/scripts/FuchsiaGym.asm index 1c0f02dfa..d2f0ee40f 100644 --- a/scripts/FuchsiaGym.asm +++ b/scripts/FuchsiaGym.asm @@ -119,9 +119,9 @@ FuchsiaGymKogaText: .beforeBeat ld hl, .BeforeBattleText call PrintText - ld hl, wd72d - set 6, [hl] - set 7, [hl] + ld hl, wStatusFlags3 + set BIT_TALKED_TO_TRAINER, [hl] + set BIT_PRINT_END_BATTLE_TEXT, [hl] ld hl, .ReceivedSoulBadgeText ld de, .ReceivedSoulBadgeText call SaveEndBattleTextPointers diff --git a/scripts/GameCorner.asm b/scripts/GameCorner.asm index 68cdc333a..b2ef12069 100644 --- a/scripts/GameCorner.asm +++ b/scripts/GameCorner.asm @@ -102,8 +102,8 @@ GameCornerMovement_Rocket_WalkDirect: db -1 ; end GameCornerRocketExitScript: - ld a, [wd730] - bit 0, a + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_NPC_MOVEMENT, a ret nz xor a ld [wJoyIgnore], a @@ -422,9 +422,9 @@ GameCornerRocketText: text_asm ld hl, .ImGuardingThisPosterText call PrintText - ld hl, wd72d - set 6, [hl] - set 7, [hl] + ld hl, wStatusFlags3 + set BIT_TALKED_TO_TRAINER, [hl] + set BIT_PRINT_END_BATTLE_TEXT, [hl] ld hl, .BattleEndText ld de, .BattleEndText call SaveEndBattleTextPointers @@ -482,8 +482,8 @@ GameCornerOopsForgotCoinCaseText: text_end GameCornerDrawCoinBox: - ld hl, wd730 - set 6, [hl] + ld hl, wStatusFlags5 + set BIT_NO_TEXT_DELAY, [hl] hlcoord 11, 0 ld b, 5 ld c, 7 @@ -513,8 +513,8 @@ GameCornerDrawCoinBox: ld de, wPlayerCoins ld c, $82 call PrintBCDNumber - ld hl, wd730 - res 6, [hl] + ld hl, wStatusFlags5 + res BIT_NO_TEXT_DELAY, [hl] ret GameCornerMoneyText: diff --git a/scripts/HallOfFame.asm b/scripts/HallOfFame.asm index d51028307..462988136 100644 --- a/scripts/HallOfFame.asm +++ b/scripts/HallOfFame.asm @@ -29,10 +29,11 @@ HallOfFameResetEventsAndSaveScript: predef HallOfFamePC pop af ld [wLetterPrintingDelayFlags], a - ld hl, wFlags_D733 - res 1, [hl] + ld hl, wStatusFlags7 + res BIT_NO_MAP_MUSIC, [hl] + assert wStatusFlags7 + 1 == wElite4Flags inc hl - set BIT_TEST_BATTLE, [hl] ; debug, unused? + set BIT_UNUSED_BEAT_ELITE_4, [hl] ; debug, unused? xor a ; SCRIPT_*_DEFAULT ld hl, wLoreleisRoomCurScript ld [hli], a ; wLoreleisRoomCurScript diff --git a/scripts/IndigoPlateauLobby.asm b/scripts/IndigoPlateauLobby.asm index 8f69fd58a..fd8ecf3cc 100644 --- a/scripts/IndigoPlateauLobby.asm +++ b/scripts/IndigoPlateauLobby.asm @@ -6,11 +6,11 @@ IndigoPlateauLobby_Script: res 6, [hl] ret z ResetEvent EVENT_VICTORY_ROAD_1_BOULDER_ON_SWITCH - ld hl, wBeatLorelei - bit 1, [hl] - res 1, [hl] + ; Reset Elite Four events if the player started challenging them before + ld hl, wElite4Flags + bit BIT_STARTED_ELITE_4, [hl] + res BIT_STARTED_ELITE_4, [hl] ret z - ; Elite 4 events ResetEventRange INDIGO_PLATEAU_EVENTS_START, EVENT_LANCES_ROOM_LOCK_DOOR ret diff --git a/scripts/LoreleisRoom.asm b/scripts/LoreleisRoom.asm index c1cc2adb1..52d79b154 100644 --- a/scripts/LoreleisRoom.asm +++ b/scripts/LoreleisRoom.asm @@ -14,8 +14,8 @@ LoreleiShowOrHideExitBlock: bit 5, [hl] res 5, [hl] ret z - ld hl, wBeatLorelei - set 1, [hl] + ld hl, wElite4Flags + set BIT_STARTED_ELITE_4, [hl] CheckEvent EVENT_BEAT_LORELEIS_ROOM_TRAINER_0 jr z, .blockExitToNextRoom ld a, $5 diff --git a/scripts/MtMoonB2F.asm b/scripts/MtMoonB2F.asm index 89871e350..3afd14c89 100644 --- a/scripts/MtMoonB2F.asm +++ b/scripts/MtMoonB2F.asm @@ -10,12 +10,12 @@ MtMoonB2F_Script: ld hl, MtMoonB2FFossilAreaCoords call ArePlayerCoordsInArray jr nc, .enable_battles - ld hl, wd72e - set 4, [hl] + ld hl, wStatusFlags4 + set BIT_NO_BATTLES, [hl] ret .enable_battles - ld hl, wd72e - res 4, [hl] + ld hl, wStatusFlags4 + res BIT_NO_BATTLES, [hl] ret MtMoonB2FFossilAreaCoords: @@ -129,8 +129,8 @@ MtMoon3FSuperNerdMoveUpMovementData: db -1 ; end MtMoonB2FSuperNerdTakesOtherFossilScript: - ld a, [wd730] - bit 0, a + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_NPC_MOVEMENT, a ret nz ld a, D_RIGHT | D_LEFT | D_UP | D_DOWN ld [wJoyIgnore], a @@ -193,9 +193,9 @@ MtMoonB2FSuperNerdText: .beat_super_nerd ld hl, MtMoonB2FSuperNerdTheyreBothMineText call PrintText - ld hl, wd72d - set 6, [hl] - set 7, [hl] + ld hl, wStatusFlags3 + set BIT_TALKED_TO_TRAINER, [hl] + set BIT_PRINT_END_BATTLE_TEXT, [hl] ld hl, MtMoonB2FSuperNerdOkIllShareText ld de, MtMoonB2FSuperNerdOkIllShareText call SaveEndBattleTextPointers diff --git a/scripts/OaksLab.asm b/scripts/OaksLab.asm index 9173dd946..dc9e56dfa 100644 --- a/scripts/OaksLab.asm +++ b/scripts/OaksLab.asm @@ -40,8 +40,8 @@ OaksLabDefaultScript: ld a, HS_OAKS_LAB_OAK_2 ld [wMissableObjectIndex], a predef ShowObject - ld hl, wd72e - res 4, [hl] + ld hl, wStatusFlags4 + res BIT_NO_BATTLES, [hl] ld a, SCRIPT_OAKSLAB_OAK_ENTERS_LAB ld [wOaksLabCurScript], a @@ -64,8 +64,8 @@ OakEntryMovement: db -1 ; end OaksLabHideShowOaksScript: - ld a, [wd730] - bit 0, a + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_NPC_MOVEMENT, a ret nz ld a, HS_OAKS_LAB_OAK_2 ld [wMissableObjectIndex], a @@ -117,8 +117,8 @@ OaksLabFollowedOakScript: ldh [hSpriteFacingDirection], a call SetSpriteFacingDirectionAndDelay call UpdateSprites - ld hl, wFlags_D733 - res 1, [hl] + ld hl, wStatusFlags7 + res BIT_NO_MAP_MUSIC, [hl] call PlayDefaultMusic ld a, SCRIPT_OAKSLAB_OAK_CHOOSE_MON_SPEECH @@ -290,8 +290,8 @@ OaksLabChoseStarterScript: ret OaksLabRivalChoosesStarterScript: - ld a, [wd730] - bit 0, a + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_NPC_MOVEMENT, a ret nz ld a, SELECT | START | D_RIGHT | D_LEFT | D_UP | D_DOWN ld [wJoyIgnore], a @@ -377,8 +377,8 @@ OaksLabRivalChallengesPlayerScript: ret OaksLabRivalStartBattleScript: - ld a, [wd730] - bit 0, a + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_NPC_MOVEMENT, a ret nz ; define which team rival uses, and fight it @@ -404,9 +404,9 @@ OaksLabRivalStartBattleScript: ld hl, OaksLabRivalIPickedTheWrongPokemonText ld de, OaksLabRivalAmIGreatOrWhatText call SaveEndBattleTextPointers - ld hl, wd72d - set 6, [hl] - set 7, [hl] + ld hl, wStatusFlags3 + set BIT_TALKED_TO_TRAINER, [hl] + set BIT_PRINT_END_BATTLE_TEXT, [hl] xor a ld [wJoyIgnore], a ld a, PLAYER_DIR_UP @@ -472,8 +472,8 @@ OaksLabRivalStartsExitScript: db -1 ; end OaksLabPlayerWatchRivalExitScript: - ld a, [wd730] - bit 0, a + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_NPC_MOVEMENT, a jr nz, .checkRivalPosition ld a, HS_OAKS_LAB_RIVAL ld [wMissableObjectIndex], a @@ -552,8 +552,8 @@ OaksLabRivalFaceUpOakFaceDownScript: jp SetSpriteFacingDirectionAndDelay OaksLabOakGivesPokedexScript: - ld a, [wd730] - bit 0, a + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_NPC_MOVEMENT, a ret nz call EnableAutoTextBoxDrawing call PlayDefaultMusic @@ -626,8 +626,8 @@ OaksLabOakGivesPokedexScript: ret OaksLabRivalLeavesWithPokedexScript: - ld a, [wd730] - bit 0, a + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_NPC_MOVEMENT, a ret nz call PlayDefaultMusic ld a, HS_OAKS_LAB_RIVAL @@ -853,11 +853,11 @@ OaksLabShowPokeBallPokemonScript: ldh [hSpriteDataOffset], a call GetPointerWithinSpriteStateData1 ld [hl], SPRITE_FACING_RIGHT - ld hl, wd730 - set 6, [hl] + ld hl, wStatusFlags5 + set BIT_NO_TEXT_DELAY, [hl] predef StarterDex - ld hl, wd730 - res 6, [hl] + ld hl, wStatusFlags5 + res BIT_NO_TEXT_DELAY, [hl] call ReloadMapData ld c, 10 call DelayFrames @@ -925,12 +925,12 @@ OaksLabMonChoiceMenu: xor a ; PLAYER_PARTY_DATA ld [wMonDataLocation], a ld a, 5 - ld [wCurEnemyLVL], a + ld [wCurEnemyLevel], a ld a, [wcf91] ld [wd11e], a call AddPartyMon - ld hl, wd72e - set 3, [hl] + ld hl, wStatusFlags4 + set BIT_GOT_STARTER, [hl] ld a, SELECT | START | D_RIGHT | D_LEFT | D_UP | D_DOWN ld [wJoyIgnore], a ld a, SCRIPT_OAKSLAB_CHOSE_STARTER_SCRIPT @@ -991,8 +991,8 @@ OaksLabOak1Text: jr nz, .mon_around_the_world CheckEventReuseA EVENT_BATTLED_RIVAL_IN_OAKS_LAB jr nz, .check_got_parcel - ld a, [wd72e] - bit 3, a + ld a, [wStatusFlags4] + bit BIT_GOT_STARTER, a jr nz, .already_got_pokemon ld hl, .WhichPokemonDoYouWantText call PrintText diff --git a/scripts/PalletTown.asm b/scripts/PalletTown.asm index 4d5bebf0d..a787fcc48 100644 --- a/scripts/PalletTown.asm +++ b/scripts/PalletTown.asm @@ -91,8 +91,8 @@ PalletTownOakWalksToPlayerScript: ret PalletTownOakNotSafeComeWithMeScript: - ld a, [wd730] - bit 0, a + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_NPC_MOVEMENT, a ret nz xor a ; ld a, SPRITE_FACING_DOWN ld [wSpritePlayerStateData1FacingDirection], a diff --git a/scripts/PewterCity.asm b/scripts/PewterCity.asm index d1f77b766..07c143d35 100644 --- a/scripts/PewterCity.asm +++ b/scripts/PewterCity.asm @@ -57,8 +57,8 @@ PewterCitySuperNerd1ShowsPlayerMuseumScript: ldh [hSpriteImageIndex], a call SetSpriteImageIndexAfterSettingFacingDirection call PlayDefaultMusic - ld hl, wFlags_0xcd60 - set 4, [hl] + ld hl, wMiscFlags + set BIT_NO_SPRITE_UPDATES, [hl] ld a, TEXT_PEWTERCITY_SUPER_NERD1_ITS_RIGHT_HERE ldh [hSpriteIndexOrTextID], a call DisplayTextID @@ -89,8 +89,8 @@ MovementData_PewterMuseumGuyExit: db -1 ; end PewterCityHideSuperNerd1Script: - ld a, [wd730] - bit 0, a + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_NPC_MOVEMENT, a ret nz ld a, HS_MUSEUM_GUY ld [wMissableObjectIndex], a @@ -125,8 +125,8 @@ PewterCityYoungsterShowsPlayerGymScript: ldh [hSpriteImageIndex], a call SetSpriteImageIndexAfterSettingFacingDirection call PlayDefaultMusic - ld hl, wFlags_0xcd60 - set 4, [hl] + ld hl, wMiscFlags + set BIT_NO_SPRITE_UPDATES, [hl] ld a, TEXT_PEWTERCITY_YOUNGSTER_GO_TAKE_ON_BROCK ldh [hSpriteIndexOrTextID], a call DisplayTextID @@ -158,8 +158,8 @@ MovementData_PewterGymGuyExit: db -1 ; end PewterCityHideYoungsterScript: - ld a, [wd730] - bit 0, a + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_NPC_MOVEMENT, a ret nz ld a, HS_GYM_GUY ld [wMissableObjectIndex], a diff --git a/scripts/PewterGym.asm b/scripts/PewterGym.asm index e653fc88c..b57710264 100644 --- a/scripts/PewterGym.asm +++ b/scripts/PewterGym.asm @@ -111,9 +111,9 @@ PewterGymBrockText: .beforeBeat ld hl, .PreBattleText call PrintText - ld hl, wd72d - set 6, [hl] - set 7, [hl] + ld hl, wStatusFlags3 + set BIT_TALKED_TO_TRAINER, [hl] + set BIT_PRINT_END_BATTLE_TEXT, [hl] ld hl, PewterGymBrockReceivedBoulderBadgeText ld de, PewterGymBrockReceivedBoulderBadgeText call SaveEndBattleTextPointers diff --git a/scripts/PokemonMansion3F.asm b/scripts/PokemonMansion3F.asm index f64357d57..fab06bbdb 100644 --- a/scripts/PokemonMansion3F.asm +++ b/scripts/PokemonMansion3F.asm @@ -60,17 +60,17 @@ PokemonMansion3FDefaultScript: .isPlayerFallingDownHole: xor a ld [wWhichDungeonWarp], a - ld a, [wd72d] - bit 4, a + ld a, [wStatusFlags3] + bit BIT_ON_DUNGEON_WARP, a ret nz call ArePlayerCoordsInArray ret nc ld a, [wCoordIndex] ld [wWhichDungeonWarp], a - ld hl, wd72d - set 4, [hl] - ld hl, wd732 - set 4, [hl] + ld hl, wStatusFlags3 + set BIT_ON_DUNGEON_WARP, [hl] + ld hl, wStatusFlags6 + set BIT_DUNGEON_WARP, [hl] ret Mansion3Script_Switches:: diff --git a/scripts/PokemonTower2F.asm b/scripts/PokemonTower2F.asm index e90fcdd0d..00f83fc5f 100644 --- a/scripts/PokemonTower2F.asm +++ b/scripts/PokemonTower2F.asm @@ -113,8 +113,8 @@ PokemonTower2FRivalDownThenRightMovement: db -1 ; end PokemonTower2FRivalExitsScript: - ld a, [wd730] - bit 0, a + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_NPC_MOVEMENT, a ret nz ld a, HS_POKEMON_TOWER_2F_RIVAL ld [wMissableObjectIndex], a @@ -142,9 +142,9 @@ PokemonTower2FRivalText: .do_battle ld hl, .WhatBringsYouHereText call PrintText - ld hl, wd72d - set 6, [hl] - set 7, [hl] + ld hl, wStatusFlags3 + set BIT_TALKED_TO_TRAINER, [hl] + set BIT_PRINT_END_BATTLE_TEXT, [hl] ld hl, .DefeatedText ld de, .VictoryText call SaveEndBattleTextPointers diff --git a/scripts/PokemonTower5F.asm b/scripts/PokemonTower5F.asm index 6482993d3..8e256b1ef 100644 --- a/scripts/PokemonTower5F.asm +++ b/scripts/PokemonTower5F.asm @@ -17,8 +17,8 @@ PokemonTower5FDefaultScript: ld hl, PokemonTower5FPurifiedZoneCoords call ArePlayerCoordsInArray jr c, .in_purified_zone - ld hl, wd72e - res 4, [hl] + ld hl, wStatusFlags4 + res BIT_NO_BATTLES, [hl] ResetEvent EVENT_IN_PURIFIED_ZONE jp CheckFightingMapTrainers .in_purified_zone @@ -28,8 +28,8 @@ PokemonTower5FDefaultScript: ldh [hJoyHeld], a ld a, D_RIGHT | D_LEFT | D_UP | D_DOWN ld [wJoyIgnore], a - ld hl, wd72e - set 4, [hl] + ld hl, wStatusFlags4 + set BIT_NO_BATTLES, [hl] predef HealParty call GBFadeOutToWhite call Delay3 diff --git a/scripts/PokemonTower6F.asm b/scripts/PokemonTower6F.asm index f2e995865..9e2f4118b 100644 --- a/scripts/PokemonTower6F.asm +++ b/scripts/PokemonTower6F.asm @@ -36,7 +36,7 @@ PokemonTower6FDefaultScript: ld a, RESTLESS_SOUL ld [wCurOpponent], a ld a, 30 - ld [wCurEnemyLVL], a + ld [wCurEnemyLevel], a ld a, SCRIPT_POKEMONTOWER6F_MAROWAK_BATTLE ld [wPokemonTower6FCurScript], a ld [wCurMapScript], a @@ -52,8 +52,8 @@ PokemonTower6FMarowakBattleScript: jp z, PokemonTower6FSetDefaultScript ld a, A_BUTTON | B_BUTTON | SELECT | START | D_RIGHT | D_LEFT | D_UP | D_DOWN ld [wJoyIgnore], a - ld a, [wd72d] - bit 6, a + ld a, [wStatusFlags3] + bit BIT_TALKED_TO_TRAINER, a ret nz call UpdateSprites ld a, D_RIGHT | D_LEFT | D_UP | D_DOWN @@ -79,8 +79,8 @@ PokemonTower6FMarowakBattleScript: xor a ld [wSpritePlayerStateData2MovementByte1], a ld [wOverrideSimulatedJoypadStatesMask], a - ld hl, wd730 - set 7, [hl] + ld hl, wStatusFlags5 + set BIT_SCRIPTED_MOVEMENT_STATE, [hl] ld a, SCRIPT_POKEMONTOWER6F_PLAYER_MOVING ld [wPokemonTower6FCurScript], a ld [wCurMapScript], a diff --git a/scripts/PokemonTower7F.asm b/scripts/PokemonTower7F.asm index 85cc43092..be9aacd9b 100644 --- a/scripts/PokemonTower7F.asm +++ b/scripts/PokemonTower7F.asm @@ -23,8 +23,8 @@ PokemonTower7F_ScriptPointers: dw_const PokemonTower7FWarpToMrFujiHouseScript, SCRIPT_POKEMONTOWER7F_WARP_TO_MR_FUJI_HOUSE PokemonTower7FEndBattleScript: - ld hl, wFlags_0xcd60 - res 0, [hl] + ld hl, wMiscFlags + res BIT_SEEN_BY_TRAINER, [hl] ld a, [wIsInBattle] cp $ff jp z, PokemonTower7FSetDefaultScript @@ -41,8 +41,8 @@ PokemonTower7FEndBattleScript: ret PokemonTower7FHideNPCScript: - ld a, [wd730] - bit 0, a + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_NPC_MOVEMENT, a ret nz ld hl, wMissableObjectList ld a, [wSpriteIndex] @@ -78,8 +78,8 @@ PokemonTower7FWarpToMrFujiHouseScript: ld [wDestinationWarpID], a ld a, LAVENDER_TOWN ld [wLastMap], a - ld hl, wd72d - set 3, [hl] + ld hl, wStatusFlags3 + set BIT_WARP_FROM_CUR_SCRIPT, [hl] ld a, SCRIPT_POKEMONTOWER7F_DEFAULT ld [wPokemonTower7FCurScript], a ld [wCurMapScript], a diff --git a/scripts/RedsHouse1F.asm b/scripts/RedsHouse1F.asm index 0c5dbcf13..a91ede805 100644 --- a/scripts/RedsHouse1F.asm +++ b/scripts/RedsHouse1F.asm @@ -8,8 +8,8 @@ RedsHouse1F_TextPointers: RedsHouse1FMomText: text_asm - ld a, [wd72e] - bit 3, a ; received a Pokémon from Oak? + ld a, [wStatusFlags4] + bit BIT_GOT_STARTER, a jr nz, .heal ld hl, .WakeUpText call PrintText diff --git a/scripts/RocketHideoutB2F.asm b/scripts/RocketHideoutB2F.asm index 3a7ffa9be..7a5c2e4ae 100644 --- a/scripts/RocketHideoutB2F.asm +++ b/scripts/RocketHideoutB2F.asm @@ -23,8 +23,8 @@ RocketHideoutB2FDefaultScript: call DecodeArrowMovementRLE cp $ff jp z, CheckFightingMapTrainers - ld hl, wd736 - set 7, [hl] + ld hl, wMovementFlags + set BIT_SPINNING, [hl] call StartSimulatingJoypadStates ld a, SFX_ARROW_TILES call PlaySound @@ -262,8 +262,8 @@ RocketHideoutB2FPlayerSpinningScript: jr nz, LoadSpinnerArrowTiles xor a ld [wJoyIgnore], a - ld hl, wd736 - res 7, [hl] + ld hl, wMovementFlags + res BIT_SPINNING, [hl] ld a, SCRIPT_ROCKETHIDEOUTB2F_DEFAULT ld [wCurMapScript], a ret diff --git a/scripts/RocketHideoutB3F.asm b/scripts/RocketHideoutB3F.asm index 03681befa..0c0e02ea3 100644 --- a/scripts/RocketHideoutB3F.asm +++ b/scripts/RocketHideoutB3F.asm @@ -23,8 +23,8 @@ RocketHideoutB3FDefaultScript: call DecodeArrowMovementRLE cp $ff jp z, CheckFightingMapTrainers - ld hl, wd736 - set 7, [hl] + ld hl, wMovementFlags + set BIT_SPINNING, [hl] call StartSimulatingJoypadStates ld a, SFX_ARROW_TILES call PlaySound @@ -119,8 +119,8 @@ RocketHideoutB3FPlayerSpinningScript: jp nz, LoadSpinnerArrowTiles xor a ld [wJoyIgnore], a - ld hl, wd736 - res 7, [hl] + ld hl, wMovementFlags + res BIT_SPINNING, [hl] ld a, SCRIPT_ROCKETHIDEOUTB3F_DEFAULT ld [wCurMapScript], a ret @@ -165,7 +165,7 @@ RocketHideoutB3FRocket2Text: jp TextScriptEnd RocketHideoutB3FRocket2BattleText: - text_far _RocketHideout3BattleTxt + text_far _RocketHideout3BattleText text_end RocketHideoutB3FRocket2EndBattleText: diff --git a/scripts/RocketHideoutB4F.asm b/scripts/RocketHideoutB4F.asm index 24bdd4a63..02ddcdd5c 100644 --- a/scripts/RocketHideoutB4F.asm +++ b/scripts/RocketHideoutB4F.asm @@ -102,9 +102,9 @@ RocketHideoutB4FGiovanniText: jp nz, .beat_giovanni ld hl, .ImpressedYouGotHereText call PrintText - ld hl, wd72d - set 6, [hl] - set 7, [hl] + ld hl, wStatusFlags3 + set BIT_TALKED_TO_TRAINER, [hl] + set BIT_PRINT_END_BATTLE_TEXT, [hl] ld hl, .WhatCannotBeText ld de, .WhatCannotBeText call SaveEndBattleTextPointers diff --git a/scripts/Route12.asm b/scripts/Route12.asm index ea7b66ca7..660b8a2d3 100644 --- a/scripts/Route12.asm +++ b/scripts/Route12.asm @@ -33,7 +33,7 @@ Route12DefaultScript: ld a, SNORLAX ld [wCurOpponent], a ld a, 30 - ld [wCurEnemyLVL], a + ld [wCurEnemyLevel], a ld a, HS_ROUTE_12_SNORLAX ld [wMissableObjectIndex], a predef HideObject diff --git a/scripts/Route12SuperRodHouse.asm b/scripts/Route12SuperRodHouse.asm index 551949d07..54867248c 100644 --- a/scripts/Route12SuperRodHouse.asm +++ b/scripts/Route12SuperRodHouse.asm @@ -7,8 +7,8 @@ Route12SuperRodHouse_TextPointers: Route12SuperRodHouseFishingGuruText: text_asm - ld a, [wd728] - bit 5, a ; received super rod? + ld a, [wStatusFlags1] + bit BIT_GOT_SUPER_ROD, a jr nz, .got_item ld hl, .DoYouLikeToFishText call PrintText @@ -19,8 +19,8 @@ Route12SuperRodHouseFishingGuruText: lb bc, SUPER_ROD, 1 call GiveItem jr nc, .bag_full - ld hl, wd728 - set 5, [hl] ; received super rod + ld hl, wStatusFlags1 + set BIT_GOT_SUPER_ROD, [hl] ld hl, .ReceivedSuperRodText jr .done .bag_full diff --git a/scripts/Route16.asm b/scripts/Route16.asm index f51bd00eb..ec33adf17 100644 --- a/scripts/Route16.asm +++ b/scripts/Route16.asm @@ -33,7 +33,7 @@ Route16DefaultScript: ld a, SNORLAX ld [wCurOpponent], a ld a, 30 - ld [wCurEnemyLVL], a + ld [wCurEnemyLevel], a ld a, HS_ROUTE_16_SNORLAX ld [wMissableObjectIndex], a predef HideObject diff --git a/scripts/Route16Gate1F.asm b/scripts/Route16Gate1F.asm index 2d9777fc0..d42a80d40 100644 --- a/scripts/Route16Gate1F.asm +++ b/scripts/Route16Gate1F.asm @@ -1,6 +1,6 @@ Route16Gate1F_Script: - ld hl, wd732 - res 5, [hl] + ld hl, wStatusFlags6 + res BIT_ALWAYS_ON_BIKE, [hl] call EnableAutoTextBoxDrawing ld a, [wRoute16Gate1FCurScript] ld hl, Route16Gate1F_ScriptPointers @@ -77,8 +77,8 @@ Route16Gate1FPlayerMovingRightScript: ret nz xor a ld [wJoyIgnore], a - ld hl, wd730 - res 7, [hl] + ld hl, wStatusFlags5 + res BIT_SCRIPTED_MOVEMENT_STATE, [hl] ld a, SCRIPT_ROUTE16GATE1F_DEFAULT ld [wRoute16Gate1FCurScript], a ret diff --git a/scripts/Route18Gate1F.asm b/scripts/Route18Gate1F.asm index 8f08638cc..79d982d79 100644 --- a/scripts/Route18Gate1F.asm +++ b/scripts/Route18Gate1F.asm @@ -1,6 +1,6 @@ Route18Gate1F_Script: - ld hl, wd732 - res 5, [hl] + ld hl, wStatusFlags6 + res BIT_ALWAYS_ON_BIKE, [hl] call EnableAutoTextBoxDrawing ld a, [wRoute18Gate1FCurScript] ld hl, Route18Gate1F_ScriptPointers @@ -77,8 +77,8 @@ Route18Gate1FPlayerMovingRightScript: ret nz xor a ld [wJoyIgnore], a - ld hl, wd730 - res 7, [hl] + ld hl, wStatusFlags5 + res BIT_SCRIPTED_MOVEMENT_STATE, [hl] ld a, SCRIPT_ROUTE18GATE1F_DEFAULT ld [wRoute18Gate1FCurScript], a ret diff --git a/scripts/Route22.asm b/scripts/Route22.asm index 1e575e43f..ad02b4c79 100644 --- a/scripts/Route22.asm +++ b/scripts/Route22.asm @@ -104,8 +104,8 @@ Route22FirstRivalBattleScript: ret Route22Rival1StartBattleScript: - ld a, [wd730] - bit 0, a + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_NPC_MOVEMENT, a ret nz ld a, [wSavedCoordIndex] cp 1 ; index of second, lower entry in Route22DefaultScript.Route22RivalBattleCoords @@ -126,9 +126,9 @@ Route22Rival1StartBattleScript: ld a, TEXT_ROUTE22_RIVAL1 ldh [hSpriteIndexOrTextID], a call DisplayTextID - ld hl, wd72d - set 6, [hl] - set 7, [hl] + ld hl, wStatusFlags3 + set BIT_TALKED_TO_TRAINER, [hl] + set BIT_PRINT_END_BATTLE_TEXT, [hl] ld hl, Route22Rival1DefeatedText ld de, Route22Rival1VictoryText call SaveEndBattleTextPointers @@ -219,8 +219,8 @@ Route22Rival1ExitMovementData2: db -1 ; end Route22Rival1ExitScript: - ld a, [wd730] - bit 0, a + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_NPC_MOVEMENT, a ret nz xor a ld [wJoyIgnore], a @@ -258,8 +258,8 @@ Route22SecondRivalBattleScript: ret Route22Rival2StartBattleScript: - ld a, [wd730] - bit 0, a + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_NPC_MOVEMENT, a ret nz ld a, ROUTE22_RIVAL2 ldh [hSpriteIndex], a @@ -282,9 +282,9 @@ Route22Rival2StartBattleScript: ld a, TEXT_ROUTE22_RIVAL2 ldh [hSpriteIndexOrTextID], a call DisplayTextID - ld hl, wd72d - set 6, [hl] - set 7, [hl] + ld hl, wStatusFlags3 + set BIT_TALKED_TO_TRAINER, [hl] + set BIT_PRINT_END_BATTLE_TEXT, [hl] ld hl, Route22Rival2DefeatedText ld de, Route22Rival2VictoryText call SaveEndBattleTextPointers @@ -363,8 +363,8 @@ Route22Rival2ExitMovementData2: db -1 ; end Route22Rival2ExitScript: - ld a, [wd730] - bit 0, a + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_NPC_MOVEMENT, a ret nz xor a ld [wJoyIgnore], a diff --git a/scripts/Route24.asm b/scripts/Route24.asm index 47d6eb9f0..6f8f02504 100644 --- a/scripts/Route24.asm +++ b/scripts/Route24.asm @@ -119,9 +119,9 @@ Route24CooltrainerM1Text: call PrintText ld hl, .JoinTeamRocketText call PrintText - ld hl, wd72d - set 6, [hl] - set 7, [hl] + ld hl, wStatusFlags3 + set BIT_TALKED_TO_TRAINER, [hl] + set BIT_PRINT_END_BATTLE_TEXT, [hl] ld hl, .DefeatedText ld de, .DefeatedText call SaveEndBattleTextPointers diff --git a/scripts/Route5Gate.asm b/scripts/Route5Gate.asm index d6e086ce8..a0913c85f 100644 --- a/scripts/Route5Gate.asm +++ b/scripts/Route5Gate.asm @@ -17,8 +17,8 @@ Route5GateMovePlayerUpScript: jp StartSimulatingJoypadStates Route5GateDefaultScript: - ld a, [wd728] - bit 6, a + ld a, [wStatusFlags1] + bit BIT_GAVE_SAFFRON_GUARDS_DRINK, a ret nz ld hl, .PlayerInCoordsArray call ArePlayerCoordsInArray @@ -42,8 +42,8 @@ Route5GateDefaultScript: ld a, TEXT_ROUTE5GATE_GUARD_GIVE_DRINK ldh [hSpriteIndexOrTextID], a call DisplayTextID - ld hl, wd728 - set 6, [hl] + ld hl, wStatusFlags1 + set BIT_GAVE_SAFFRON_GUARDS_DRINK, [hl] ret .PlayerInCoordsArray: @@ -69,8 +69,8 @@ Route5Gate_TextPointers: SaffronGateGuardText: text_asm - ld a, [wd728] - bit 6, a + ld a, [wStatusFlags1] + bit BIT_GAVE_SAFFRON_GUARDS_DRINK, a jr nz, .thanks_for_drink farcall RemoveGuardDrink ldh a, [hItemToRemoveID] @@ -86,8 +86,8 @@ SaffronGateGuardText: .have_drink ld hl, SaffronGateGuardGiveDrinkText call PrintText - ld hl, wd728 - set 6, [hl] + ld hl, wStatusFlags1 + set BIT_GAVE_SAFFRON_GUARDS_DRINK, [hl] jp TextScriptEnd .thanks_for_drink diff --git a/scripts/Route6Gate.asm b/scripts/Route6Gate.asm index db4cfcab1..7afba23ef 100644 --- a/scripts/Route6Gate.asm +++ b/scripts/Route6Gate.asm @@ -11,8 +11,8 @@ Route6Gate_ScriptPointers: dw_const Route6GatePlayerMovingScript, SCRIPT_ROUTE6GATE_PLAYER_MOVING Route6GateDefaultScript: - ld a, [wd728] - bit 6, a + ld a, [wStatusFlags1] + bit BIT_GAVE_SAFFRON_GUARDS_DRINK, a ret nz ld hl, .PlayerInCoordsArray call ArePlayerCoordsInArray @@ -33,8 +33,8 @@ Route6GateDefaultScript: ld [wRoute6GateCurScript], a ret .have_drink - ld hl, wd728 - set 6, [hl] + ld hl, wStatusFlags1 + set BIT_GAVE_SAFFRON_GUARDS_DRINK, [hl] ld a, TEXT_ROUTE6GATE_GUARD_GIVE_DRINK ldh [hSpriteIndexOrTextID], a jp DisplayTextID @@ -55,8 +55,8 @@ Route6GatePlayerMovingScript: ret Route6GateMovePlayerDownScript: - ld hl, wd730 - set 7, [hl] + ld hl, wStatusFlags5 + set BIT_SCRIPTED_MOVEMENT_STATE, [hl] ld a, D_DOWN ld [wSimulatedJoypadStatesEnd], a ld a, $1 diff --git a/scripts/Route7Gate.asm b/scripts/Route7Gate.asm index 0260fb488..813fab214 100644 --- a/scripts/Route7Gate.asm +++ b/scripts/Route7Gate.asm @@ -11,8 +11,8 @@ Route7Gate_ScriptPointers: dw_const Route7PlayerMovingScript, SCRIPT_ROUTE7GATE_PLAYER_MOVING Route7GateMovePlayerLeftScript: - ld hl, wd730 - set 7, [hl] + ld hl, wStatusFlags5 + set BIT_SCRIPTED_MOVEMENT_STATE, [hl] ld a, D_LEFT ld [wSimulatedJoypadStatesEnd], a ld a, $1 @@ -23,8 +23,8 @@ Route7GateMovePlayerLeftScript: ret Route7DefaultScript: - ld a, [wd728] - bit 6, a + ld a, [wStatusFlags1] + bit BIT_GAVE_SAFFRON_GUARDS_DRINK, a ret nz ld hl, .PlayerInCoordsArray call ArePlayerCoordsInArray @@ -48,8 +48,8 @@ Route7DefaultScript: ld a, TEXT_ROUTE7GATE_GUARD_GIVE_DRINK ldh [hSpriteIndexOrTextID], a call DisplayTextID - ld hl, wd728 - set 6, [hl] + ld hl, wStatusFlags1 + set BIT_GAVE_SAFFRON_GUARDS_DRINK, [hl] ret .PlayerInCoordsArray: diff --git a/scripts/Route8Gate.asm b/scripts/Route8Gate.asm index af4fe1968..51dd6f1af 100644 --- a/scripts/Route8Gate.asm +++ b/scripts/Route8Gate.asm @@ -10,8 +10,8 @@ Route8Gate_ScriptPointers: dw_const Route8GatePlayerMovingScript, SCRIPT_ROUTE8GATE_PLAYER_MOVING Route8GateMovePlayerRightScript: - ld hl, wd730 - set 7, [hl] + ld hl, wStatusFlags5 + set BIT_SCRIPTED_MOVEMENT_STATE, [hl] ld a, D_RIGHT ld [wSimulatedJoypadStatesEnd], a ld a, $1 @@ -22,8 +22,8 @@ Route8GateMovePlayerRightScript: ret Route8GateDefaultScript: - ld a, [wd728] - bit 6, a + ld a, [wStatusFlags1] + bit BIT_GAVE_SAFFRON_GUARDS_DRINK, a ret nz ld hl, .PlayerInCoordsArray call ArePlayerCoordsInArray @@ -44,8 +44,8 @@ Route8GateDefaultScript: ld [wRoute8GateCurScript], a ret .have_drink - ld hl, wd728 - set 6, [hl] + ld hl, wStatusFlags1 + set BIT_GAVE_SAFFRON_GUARDS_DRINK, [hl] ld a, TEXT_ROUTE8GATE_GUARD_GIVE_DRINK ldh [hSpriteIndexOrTextID], a jp DisplayTextID diff --git a/scripts/SSAnne2F.asm b/scripts/SSAnne2F.asm index 3d6be5d17..1c7c6b5b7 100644 --- a/scripts/SSAnne2F.asm +++ b/scripts/SSAnne2F.asm @@ -87,8 +87,8 @@ SSAnne2FSetFacingDirectionScript: jp SetSpriteFacingDirectionAndDelay SSAnne2FRivalStartBattleScript: - ld a, [wd730] - bit 0, a + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_NPC_MOVEMENT, a ret nz call SSAnne2FSetFacingDirectionScript xor a @@ -164,8 +164,8 @@ SSAnne2FRivalAfterBattleScript: db -1 ; end SSAnne2FRivalExitScript: - ld a, [wd730] - bit 0, a + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_NPC_MOVEMENT, a ret nz xor a ld [wJoyIgnore], a @@ -191,9 +191,9 @@ SSAnne2FRivalText: text_asm ld hl, .Text call PrintText - ld hl, wd72d - set 6, [hl] - set 7, [hl] + ld hl, wStatusFlags3 + set BIT_TALKED_TO_TRAINER, [hl] + set BIT_PRINT_END_BATTLE_TEXT, [hl] ld hl, SSAnne2FRivalDefeatedText ld de, SSAnne2FRivalVictoryText call SaveEndBattleTextPointers diff --git a/scripts/SSAnneCaptainsRoom.asm b/scripts/SSAnneCaptainsRoom.asm index da094261f..bac424e80 100644 --- a/scripts/SSAnneCaptainsRoom.asm +++ b/scripts/SSAnneCaptainsRoom.asm @@ -5,8 +5,8 @@ SSAnneCaptainsRoom_Script: SSAnneCaptainsRoomEventScript: CheckEvent EVENT_RUBBED_CAPTAINS_BACK ret nz - ld hl, wd72d - set 5, [hl] + ld hl, wStatusFlags3 + set BIT_NO_NPC_FACE_PLAYER, [hl] ret SSAnneCaptainsRoom_TextPointers: @@ -33,8 +33,8 @@ SSAnneCaptainsRoomCaptainText: .bag_full ld hl, SSAnneCaptainsRoomCaptainHM01NoRoomText call PrintText - ld hl, wd72d - set 5, [hl] + ld hl, wStatusFlags3 + set BIT_NO_NPC_FACE_PLAYER, [hl] jr .done .got_item ld hl, SSAnneCaptainsRoomCaptainNotSickAnymoreText @@ -64,8 +64,8 @@ SSAnneCaptainsRoomRubCaptainsBackText: jr z, .loop call PlayDefaultMusic SetEvent EVENT_RUBBED_CAPTAINS_BACK - ld hl, wd72d - res 5, [hl] + ld hl, wStatusFlags3 + res BIT_NO_NPC_FACE_PLAYER, [hl] jp TextScriptEnd SSAnneCaptainsRoomCaptainIFeelMuchBetterText: diff --git a/scripts/SaffronGym.asm b/scripts/SaffronGym.asm index 96e453dfb..2de1081b4 100644 --- a/scripts/SaffronGym.asm +++ b/scripts/SaffronGym.asm @@ -120,9 +120,9 @@ SaffronGymSabrinaText: .beforeBeat ld hl, .Text call PrintText - ld hl, wd72d - set 6, [hl] - set 7, [hl] + ld hl, wStatusFlags3 + set BIT_TALKED_TO_TRAINER, [hl] + set BIT_PRINT_END_BATTLE_TEXT, [hl] ld hl, .ReceivedMarshBadgeText ld de, .ReceivedMarshBadgeText call SaveEndBattleTextPointers diff --git a/scripts/SeafoamIslands1F.asm b/scripts/SeafoamIslands1F.asm index 27ddc2766..a3ec3c995 100644 --- a/scripts/SeafoamIslands1F.asm +++ b/scripts/SeafoamIslands1F.asm @@ -1,9 +1,9 @@ SeafoamIslands1F_Script: call EnableAutoTextBoxDrawing SetEvent EVENT_IN_SEAFOAM_ISLANDS - ld hl, wFlags_0xcd60 - bit 7, [hl] - res 7, [hl] + ld hl, wMiscFlags + bit BIT_PUSHED_BOULDER, [hl] + res BIT_PUSHED_BOULDER, [hl] jr z, .noBoulderWasPushed ld hl, Seafoam1HolesCoords call CheckBoulderCoords diff --git a/scripts/SeafoamIslandsB1F.asm b/scripts/SeafoamIslandsB1F.asm index 271775ed7..0bc2ee181 100644 --- a/scripts/SeafoamIslandsB1F.asm +++ b/scripts/SeafoamIslandsB1F.asm @@ -1,8 +1,8 @@ SeafoamIslandsB1F_Script: call EnableAutoTextBoxDrawing - ld hl, wFlags_0xcd60 - bit 7, [hl] - res 7, [hl] + ld hl, wMiscFlags + bit BIT_PUSHED_BOULDER, [hl] + res BIT_PUSHED_BOULDER, [hl] jr z, .noBoulderWasPushed ld hl, Seafoam2HolesCoords call CheckBoulderCoords diff --git a/scripts/SeafoamIslandsB2F.asm b/scripts/SeafoamIslandsB2F.asm index 71ae2e1ae..48b7979d4 100644 --- a/scripts/SeafoamIslandsB2F.asm +++ b/scripts/SeafoamIslandsB2F.asm @@ -1,8 +1,8 @@ SeafoamIslandsB2F_Script: call EnableAutoTextBoxDrawing - ld hl, wFlags_0xcd60 - bit 7, [hl] - res 7, [hl] + ld hl, wMiscFlags + bit BIT_PUSHED_BOULDER, [hl] + res BIT_PUSHED_BOULDER, [hl] jr z, .noBoulderWasPushed ld hl, Seafoam3HolesCoords call CheckBoulderCoords diff --git a/scripts/SeafoamIslandsB3F.asm b/scripts/SeafoamIslandsB3F.asm index 8c225dcc5..23dfd0504 100644 --- a/scripts/SeafoamIslandsB3F.asm +++ b/scripts/SeafoamIslandsB3F.asm @@ -1,8 +1,8 @@ SeafoamIslandsB3F_Script: call EnableAutoTextBoxDrawing - ld hl, wFlags_0xcd60 - bit 7, [hl] - res 7, [hl] + ld hl, wMiscFlags + bit BIT_PUSHED_BOULDER, [hl] + res BIT_PUSHED_BOULDER, [hl] jr z, .noBoulderWasPushed ld hl, Seafoam4HolesCoords call CheckBoulderCoords @@ -36,8 +36,8 @@ SeafoamIslandsB3F_Script: ld [wDungeonWarpDestinationMap], a ld hl, Seafoam4HolesCoords call IsPlayerOnDungeonWarp - ld a, [wd732] - bit 4, a + ld a, [wStatusFlags6] + bit BIT_DUNGEON_WARP, a ret nz .runCurrentMapScript ld hl, SeafoamIslandsB3F_ScriptPointers @@ -72,8 +72,8 @@ SeafoamIslandsB3FDefaultScript: dec a ld [wSimulatedJoypadStatesIndex], a call StartSimulatingJoypadStates - ld hl, wFlags_D733 - set 2, [hl] + ld hl, wStatusFlags7 + set BIT_FORCED_WARP, [hl] ld a, SCRIPT_SEAFOAMISLANDSB3F_OBJECT_MOVING1 ld [wSeafoamIslandsB3FCurScript], a ret @@ -112,10 +112,10 @@ SeafoamIslandsB3FMoveObjectScript: ld [wSimulatedJoypadStatesIndex], a xor a ld [wSpritePlayerStateData2MovementByte1], a - ld hl, wd730 - set 7, [hl] - ld hl, wFlags_D733 - set 2, [hl] + ld hl, wStatusFlags5 + set BIT_SCRIPTED_MOVEMENT_STATE, [hl] + ld hl, wStatusFlags7 + set BIT_FORCED_WARP, [hl] ld a, SCRIPT_SEAFOAMISLANDSB3F_OBJECT_MOVING2 .playerNotInStrongCurrent ld [wSeafoamIslandsB3FCurScript], a diff --git a/scripts/SeafoamIslandsB4F.asm b/scripts/SeafoamIslandsB4F.asm index bff27e9fd..783b410de 100644 --- a/scripts/SeafoamIslandsB4F.asm +++ b/scripts/SeafoamIslandsB4F.asm @@ -48,8 +48,8 @@ SeafoamIslandsB4FDefaultScript: ld a, D_UP ld [wSimulatedJoypadStatesEnd], a call StartSimulatingJoypadStates - ld hl, wFlags_D733 - res 2, [hl] + ld hl, wStatusFlags7 + res BIT_FORCED_WARP, [hl] ld a, SCRIPT_SEAFOAMISLANDSB4F_OBJECT_MOVING1 ld [wSeafoamIslandsB4FCurScript], a ret diff --git a/scripts/SilphCo11F.asm b/scripts/SilphCo11F.asm index 778283c53..9caf2a70b 100644 --- a/scripts/SilphCo11F.asm +++ b/scripts/SilphCo11F.asm @@ -236,8 +236,8 @@ SilphCo11FGiovanniAfterBattleScript: jp SilphCo11FSetCurScript SilphCo11FGiovanniBattleFacingScript: - ld a, [wd730] - bit 0, a + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_NPC_MOVEMENT, a ret nz ld a, SILPHCO11F_GIOVANNI ldh [hSpriteIndex], a @@ -258,9 +258,9 @@ SilphCo11FGiovanniBattleFacingScript: jp SilphCo11FSetCurScript SilphCo11FGiovanniStartBattleScript: - ld hl, wd72d - set 6, [hl] - set 7, [hl] + ld hl, wStatusFlags3 + set BIT_TALKED_TO_TRAINER, [hl] + set BIT_PRINT_END_BATTLE_TEXT, [hl] ld hl, SilphCo10FGiovanniILostAgainText ld de, SilphCo10FGiovanniILostAgainText call SaveEndBattleTextPointers diff --git a/scripts/SilphCo7F.asm b/scripts/SilphCo7F.asm index bfa788473..de9e689db 100644 --- a/scripts/SilphCo7F.asm +++ b/scripts/SilphCo7F.asm @@ -169,8 +169,8 @@ SilphCo7FDefaultScript: db -1 ; end SilphCo7FRivalStartBattleScript: - ld a, [wd730] - bit 0, a + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_NPC_MOVEMENT, a ret nz xor a ld [wJoyIgnore], a @@ -178,9 +178,9 @@ SilphCo7FRivalStartBattleScript: ldh [hSpriteIndexOrTextID], a call DisplayTextID call Delay3 - ld hl, wd72d - set 6, [hl] - set 7, [hl] + ld hl, wStatusFlags3 + set BIT_TALKED_TO_TRAINER, [hl] + set BIT_PRINT_END_BATTLE_TEXT, [hl] ld hl, SilphCo7FRivalDefeatedText ld de, SilphCo7FRivalVictoryText call SaveEndBattleTextPointers @@ -252,8 +252,8 @@ SilphCo7FRivalAfterBattleScript: db -1 ; end SilphCo7FRivalExitScript: - ld a, [wd730] - bit 0, a + ld a, [wStatusFlags5] + bit BIT_SCRIPTED_NPC_MOVEMENT, a ret nz ld a, HS_SILPH_CO_7F_RIVAL ld [wMissableObjectIndex], a @@ -296,8 +296,8 @@ SilphCo7TrainerHeader3: SilphCo7FSilphWorkerM1Text: ; lapras guy text_asm - ld a, [wd72e] - bit 0, a ; got lapras? + ld a, [wStatusFlags4] + bit BIT_GOT_LAPRAS, a jr z, .give_lapras CheckEvent EVENT_BEAT_SILPH_CO_GIOVANNI jr nz, .saved_silph @@ -316,8 +316,8 @@ SilphCo7FSilphWorkerM1Text: call EnableAutoTextBoxDrawing ld hl, .LaprasDescriptionText call PrintText - ld hl, wd72e - set 0, [hl] + ld hl, wStatusFlags4 + set BIT_GOT_LAPRAS, [hl] jr .done .saved_silph ld hl, .SavedText diff --git a/scripts/TradeCenter.asm b/scripts/TradeCenter.asm index d7e7c54c1..c716484cb 100644 --- a/scripts/TradeCenter.asm +++ b/scripts/TradeCenter.asm @@ -10,9 +10,9 @@ TradeCenter_Script: ld a, TRADECENTER_OPPONENT ldh [hSpriteIndex], a call SetSpriteFacingDirection - ld hl, wd72d - bit 0, [hl] - set 0, [hl] + ld hl, wStatusFlags3 + bit BIT_INIT_TRADE_CENTER_FACING, [hl] + set BIT_INIT_TRADE_CENTER_FACING, [hl] ret nz ld hl, wSprite01StateData2MapY ld a, 8 ; y diff --git a/scripts/VermilionDock.asm b/scripts/VermilionDock.asm index 041bf5b4a..11f9a09fe 100644 --- a/scripts/VermilionDock.asm +++ b/scripts/VermilionDock.asm @@ -11,8 +11,8 @@ VermilionDock_Script: jp z, VermilionDockSSAnneLeavesScript SetEventReuseHL EVENT_STARTED_WALKING_OUT_OF_DOCK call Delay3 - ld hl, wd730 - set 7, [hl] + ld hl, wStatusFlags5 + set BIT_SCRIPTED_MOVEMENT_STATE, [hl] ld hl, wSimulatedJoypadStatesEnd ld a, D_UP ld [hli], a diff --git a/scripts/VermilionGym.asm b/scripts/VermilionGym.asm index a4fab9525..194fce94c 100644 --- a/scripts/VermilionGym.asm +++ b/scripts/VermilionGym.asm @@ -127,9 +127,9 @@ VermilionGymLTSurgeText: .before_beat ld hl, .PreBattleText call PrintText - ld hl, wd72d - set 6, [hl] - set 7, [hl] + ld hl, wStatusFlags3 + set BIT_TALKED_TO_TRAINER, [hl] + set BIT_PRINT_END_BATTLE_TEXT, [hl] ld hl, VermilionGymLTSurgeReceivedThunderBadgeText ld de, VermilionGymLTSurgeReceivedThunderBadgeText call SaveEndBattleTextPointers diff --git a/scripts/VermilionOldRodHouse.asm b/scripts/VermilionOldRodHouse.asm index f170bcafc..8663de692 100644 --- a/scripts/VermilionOldRodHouse.asm +++ b/scripts/VermilionOldRodHouse.asm @@ -7,8 +7,8 @@ VermilionOldRodHouse_TextPointers: VermilionOldRodHouseFishingGuruText: text_asm - ld a, [wd728] - bit 3, a ; got old rod? + ld a, [wStatusFlags1] + bit BIT_GOT_OLD_ROD, a jr nz, .got_old_rod ld hl, .DoYouLikeToFishText call PrintText @@ -19,8 +19,8 @@ VermilionOldRodHouseFishingGuruText: lb bc, OLD_ROD, 1 call GiveItem jr nc, .bag_full - ld hl, wd728 - set 3, [hl] ; got old rod + ld hl, wStatusFlags1 + set BIT_GOT_OLD_ROD, [hl] ld hl, .TakeThisText jr .print_text .bag_full diff --git a/scripts/VictoryRoad3F.asm b/scripts/VictoryRoad3F.asm index ce7e2175d..e9295a153 100644 --- a/scripts/VictoryRoad3F.asm +++ b/scripts/VictoryRoad3F.asm @@ -27,9 +27,9 @@ VictoryRoad3F_ScriptPointers: dw_const EndTrainerBattle, SCRIPT_VICTORYROAD3F_END_BATTLE VictoryRoad3FDefaultScript: - ld hl, wFlags_0xcd60 - bit 7, [hl] - res 7, [hl] + ld hl, wMiscFlags + bit BIT_PUSHED_BOULDER, [hl] + res BIT_PUSHED_BOULDER, [hl] jp z, .check_switch_hole ld hl, .SwitchOrHoleCoords call CheckBoulderCoords @@ -64,14 +64,14 @@ VictoryRoad3FDefaultScript: ld a, [wCoordIndex] cp $1 jr nz, .hole - ld hl, wd72d - res 4, [hl] - ld hl, wd732 - res 4, [hl] + ld hl, wStatusFlags3 + res BIT_ON_DUNGEON_WARP, [hl] + ld hl, wStatusFlags6 + res BIT_DUNGEON_WARP, [hl] ret .hole - ld a, [wd72d] - bit 4, a + ld a, [wStatusFlags3] + bit BIT_ON_DUNGEON_WARP, a jp z, CheckFightingMapTrainers ret diff --git a/scripts/ViridianCity.asm b/scripts/ViridianCity.asm index efd2db211..0059bc600 100644 --- a/scripts/ViridianCity.asm +++ b/scripts/ViridianCity.asm @@ -75,7 +75,7 @@ ViridianCityOldManStartCatchTrainingScript: ld a, BATTLE_TYPE_OLD_MAN ld [wBattleType], a ld a, 5 - ld [wCurEnemyLVL], a + ld [wCurEnemyLevel], a ld a, WEEDLE ld [wCurOpponent], a ld a, SCRIPT_VIRIDIANCITY_OLD_MAN_END_CATCH_TRAINING diff --git a/scripts/ViridianGym.asm b/scripts/ViridianGym.asm index 5162d3bc0..a6f27bdff 100644 --- a/scripts/ViridianGym.asm +++ b/scripts/ViridianGym.asm @@ -41,8 +41,8 @@ ViridianGymDefaultScript: cp $ff jp z, CheckFightingMapTrainers call StartSimulatingJoypadStates - ld hl, wd736 - set 7, [hl] + ld hl, wMovementFlags + set BIT_SPINNING, [hl] ld a, SFX_ARROW_TILES call PlaySound ld a, A_BUTTON | B_BUTTON | SELECT | START | D_RIGHT | D_LEFT | D_UP | D_DOWN @@ -120,8 +120,8 @@ ViridianGymPlayerSpinningScript: jr nz, .ViridianGymLoadSpinnerArrow xor a ld [wJoyIgnore], a - ld hl, wd736 - res 7, [hl] + ld hl, wMovementFlags + res BIT_SPINNING, [hl] ld a, SCRIPT_VIRIDIANGYM_DEFAULT ld [wCurMapScript], a ret @@ -229,9 +229,9 @@ ViridianGymGiovanniText: .beforeBeat ld hl, .PreBattleText call PrintText - ld hl, wd72d - set 6, [hl] - set 7, [hl] + ld hl, wStatusFlags3 + set BIT_TALKED_TO_TRAINER, [hl] + set BIT_PRINT_END_BATTLE_TEXT, [hl] ld hl, .ReceivedEarthBadgeText ld de, .ReceivedEarthBadgeText call SaveEndBattleTextPointers diff --git a/text/RocketHideoutB3F.asm b/text/RocketHideoutB3F.asm index b7ec9e1a2..3d4af6162 100644 --- a/text/RocketHideoutB3F.asm +++ b/text/RocketHideoutB3F.asm @@ -16,7 +16,7 @@ _RocketHideoutB3FRocket1AfterBattleText:: cont "here somewhere." done -_RocketHideout3BattleTxt:: +_RocketHideout3BattleText:: text "We got word from" line "upstairs that you" cont "were coming!" 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: [PATCH 05/19] 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(-) diff --git a/data/text/text_1.asm b/data/text/text_1.asm index 2acc6f685..538396ebe 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 d4b1b7db9..4362e0f20 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 1d40d6b7a..ba09a0f68 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 39c7ab91b..f1c73a885 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 fb0cac666..1eee599c3 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 194afa7bc..8109b6593 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 fcb27d208..54629faff 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 ab4d1c566..ae399a01a 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 b2daebfe1..82be49e06 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 4feef343b..fe784dd63 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 fa373038b..9aab3feb3 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 4d40fd827..b25d5a110 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 eb82a5b1c..171fa99a3 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 b26bc90f0..0c6ec1ea6 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 54588e7d6..c62225baf 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 e771504d3..0c3394516 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 ccbe02258..a98402682 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 e5796e53f..9dd66de56 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 08ff22e4a..27bccbb54 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 f51205188..85447300d 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 50a9838ca..6c8cd6ebc 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 d37d95f88..6dd9aab1c 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 95ebcabe5..40c75f620 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 9d168cc72..931538c0a 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 98d1158e0..a564862bb 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 0b7fb96cd..73ba8071e 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 fa6930c10..1c7c328cf 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 0377caa41..981fe13ae 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 1629b1886..3d864222b 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 f7751fa03..2e5e1501a 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 c27739d77..cd3823fd0 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 131fbd854..b228f086a 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 4ff730dd0..3bdf5a7bb 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 73c128058..b5960c812 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 0e04367b6..ad1434dca 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 044d5e504..da0acfea0 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 a198dbd78..8522a1493 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 92f23f69c..9e62e5de8 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 6701bbd03..be0bc9474 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 87cde965f..be9b8eab2 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 106a2cf00..3d2d5eaa0 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 11accbd44..e839149e0 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 921b64070..cdccbf939 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 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: [PATCH 06/19] 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 +- .../events/hidden_objects/museum_fossils.asm | 7 +- .../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(-) diff --git a/engine/battle/animations.asm b/engine/battle/animations.asm index 41d6a2efd..31851a91a 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 0e2704245..810d3fb9b 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 ae399a01a..01faa890b 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 fe784dd63..1fa84e15d 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 a88b0dfcc..dda440f8f 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 eede46ed6..ea451bcff 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 06c2ace15..61c11c26d 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 17d0f793d..c16fe97b6 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 f2374e1ed..9472f49f6 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 277149814..e996e471c 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 ce047c2f4..733ab73e2 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 c62225baf..d35756890 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 a1d69c728..10b6dba26 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 c1e93c362..4603b582d 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 73b1632f4..53fabc6d5 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 d97fbc556..f59b37eab 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 ec1cfd0ff..6ac75ec79 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 0c3394516..5b41516f9 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 df9761bd6..8e64e5d00 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 ea7fbcadc..f3c6db98c 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 9dd66de56..4ade66e3f 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 27bccbb54..849c6e037 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 85447300d..25d69ca93 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 e0a3a007f..9e1553ddb 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 c6fe37a00..f746c8095 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 5f742e388..5417e3e02 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 cb7e37c0d..a9b6efbd9 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 4464fd876..d7a478859 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 6dd9aab1c..2344dce3e 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 d0fc4ad8d..ded8a7c3a 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 7edbbedf2..b515a9849 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 931538c0a..a7ccb6b8b 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 a9e29b63c..dadfb7533 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 73ba8071e..ab167a24e 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 599337627..736c104cb 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 1c7c328cf..aae6cb876 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 c5e2041a8..3d0548e0b 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 d29c23fe5..4ae4327a6 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 128367ecf..8ede4ea46 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 1100666f4..e4f9a261e 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 f27d46f4d..9e7f02f94 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 98eb31b1b..a71f655f1 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 3d864222b..ca369a82c 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 3bce15321..73ee35d7e 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 b228f086a..9fcf56224 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 3bdf5a7bb..ef23aabfd 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 417198e1f..b1f6db7ff 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 a3e9e286e..05b69935b 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 754270496..4522b9068 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 dc9e56dfa..087e6a379 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 From 59202a2ab5f097262db25eb9b12c41d2389c5164 Mon Sep 17 00:00:00 2001 From: Rangi42 Date: Sun, 4 Aug 2024 21:13:45 -0400 Subject: [PATCH 07/19] Use bankless symbols for VC constants This is valid according to the .sym file spec: --- tools/make_patch.c | 12 +++++++----- vc/pokeblue.constants.asm | 2 +- vc/pokered.constants.asm | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/tools/make_patch.c b/tools/make_patch.c index ecfd67b24..77a306830 100644 --- a/tools/make_patch.c +++ b/tools/make_patch.c @@ -103,12 +103,14 @@ int parse_number(const char *input, int base) { void parse_symbol_value(char *input, int *restrict bank, int *restrict address) { char *colon = strchr(input, ':'); - if (!colon) { - error_exit("Error: Cannot parse bank+address: \"%s\"\n", input); + if (colon) { + *colon++ = '\0'; + *bank = parse_number(input, 16); + *address = parse_number(colon, 16); + } else { + *bank = 0; + *address = parse_number(input, 16); } - *colon++ = '\0'; - *bank = parse_number(input, 16); - *address = parse_number(colon, 16); } void parse_symbols(const char *filename, struct Symbol **symbols) { diff --git a/vc/pokeblue.constants.asm b/vc/pokeblue.constants.asm index c32c39e61..41c0d8fd4 100644 --- a/vc/pokeblue.constants.asm +++ b/vc/pokeblue.constants.asm @@ -2,7 +2,7 @@ MACRO vc_const DEF x = \1 - PRINTLN "00:{04x:x} \1" ; same format as rgblink's .sym file + PRINTLN "{02x:x} \1" ; same format as rgblink's .sym file ENDM ; [FPA 001 Begin] diff --git a/vc/pokered.constants.asm b/vc/pokered.constants.asm index 646444ee5..8ae18a132 100644 --- a/vc/pokered.constants.asm +++ b/vc/pokered.constants.asm @@ -2,7 +2,7 @@ MACRO vc_const DEF x = \1 - PRINTLN "00:{04x:x} \1" ; same format as rgblink's .sym file + PRINTLN "{02x:x} \1" ; same format as rgblink's .sym file ENDM ; [FPA 001 Begin] From a4339827496610a384381ada93ec2a2b8bdb0f0d Mon Sep 17 00:00:00 2001 From: Vortyne <104168801+Vortyne@users.noreply.github.com> Date: Sun, 4 Aug 2024 22:51:07 -0400 Subject: [PATCH 08/19] Fix comment about auto text box drawing (#458) Actually, setting bit 0 of this byte disables auto text box drawing on calling DisplayTextID. See https://github.com/pret/pokered/blob/6e3ab0a9e97ff14123ac65f56cb4b4ddab45b695/engine/menus/display_text_id_init.asm#L7 --- ram/wram.asm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ram/wram.asm b/ram/wram.asm index ef23aabfd..8bfbfcf4c 100644 --- a/ram/wram.asm +++ b/ram/wram.asm @@ -976,7 +976,7 @@ wBoughtOrSoldItemInMart:: db ; $02 - draw wBattleResult:: db -; bit 0: if set, DisplayTextID automatically draws a text box +; bit 0: if set, prevents DisplayTextID from automatically drawing a text box wAutoTextBoxDrawingControl:: db ; used in some overworld scripts to vary scripted movement From febbb0938270e53ca039f4045abade5338c6aa45 Mon Sep 17 00:00:00 2001 From: Rangi42 Date: Wed, 28 Aug 2024 12:28:54 -0400 Subject: [PATCH 09/19] Use long option flags for rgbgfx, same as tools/gfx --- Makefile | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 4f6f4d34b..30cfd4f84 100644 --- a/Makefile +++ b/Makefile @@ -157,13 +157,13 @@ pokeblue_vc_opt = -jsv -n 0 -k 01 -l 0x33 -m 0x13 -r 03 -t "POKEMON BLUE" gfx/battle/move_anim_0.2bpp: tools/gfx += --trim-whitespace gfx/battle/move_anim_1.2bpp: tools/gfx += --trim-whitespace -gfx/intro/blue_jigglypuff_1.2bpp: rgbgfx += -Z -gfx/intro/blue_jigglypuff_2.2bpp: rgbgfx += -Z -gfx/intro/blue_jigglypuff_3.2bpp: rgbgfx += -Z -gfx/intro/red_nidorino_1.2bpp: rgbgfx += -Z -gfx/intro/red_nidorino_2.2bpp: rgbgfx += -Z -gfx/intro/red_nidorino_3.2bpp: rgbgfx += -Z -gfx/intro/gengar.2bpp: rgbgfx += -Z +gfx/intro/blue_jigglypuff_1.2bpp: rgbgfx += --columns +gfx/intro/blue_jigglypuff_2.2bpp: rgbgfx += --columns +gfx/intro/blue_jigglypuff_3.2bpp: rgbgfx += --columns +gfx/intro/red_nidorino_1.2bpp: rgbgfx += --columns +gfx/intro/red_nidorino_2.2bpp: rgbgfx += --columns +gfx/intro/red_nidorino_3.2bpp: rgbgfx += --columns +gfx/intro/gengar.2bpp: rgbgfx += --columns gfx/intro/gengar.2bpp: tools/gfx += --remove-duplicates --preserve=0x19,0x76 gfx/credits/the_end.2bpp: tools/gfx += --interleave --png=$< @@ -187,9 +187,9 @@ gfx/trade/game_boy.2bpp: tools/gfx += --remove-duplicates tools/gfx $(tools/gfx) -o $@ $@) %.1bpp: %.png - $(RGBGFX) $(rgbgfx) -d1 -o $@ $< + $(RGBGFX) $(rgbgfx) --depth 1 -o $@ $< $(if $(tools/gfx),\ - tools/gfx $(tools/gfx) -d1 -o $@ $@) + tools/gfx $(tools/gfx) --depth 1 -o $@ $@) %.pic: %.2bpp tools/pkmncompress $< $@ From 1f6e2bf999401b9444f939bb40c1eb279bc51829 Mon Sep 17 00:00:00 2001 From: Vortyne <104168801+Vortyne@users.noreply.github.com> Date: Mon, 9 Sep 2024 20:22:58 -0400 Subject: [PATCH 10/19] Use correct label in get_trainer_name.asm (#461) --- engine/battle/get_trainer_name.asm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/battle/get_trainer_name.asm b/engine/battle/get_trainer_name.asm index 82be49e06..beed3291c 100644 --- a/engine/battle/get_trainer_name.asm +++ b/engine/battle/get_trainer_name.asm @@ -1,5 +1,5 @@ GetTrainerName_:: - ld hl, wGrassRate + ld hl, wLinkEnemyTrainerName ld a, [wLinkState] and a jr nz, .foundName From 613d34678b7e9da1a467ec48fff23bfa75209871 Mon Sep 17 00:00:00 2001 From: Sylvie <35663410+Rangi42@users.noreply.github.com> Date: Wed, 18 Sep 2024 21:01:18 -0400 Subject: [PATCH 11/19] Split `hSpriteIndexOrTextID` into `hSpriteIndex` and `hTextID` (#462) Also identify `wPPUpCountAndMaxPP` --- data/text/text_2.asm | 2 +- engine/battle/battle_transitions.asm | 2 +- engine/battle/wild_encounters.asm | 2 +- engine/events/card_key.asm | 4 +-- engine/events/hidden_objects/safari_game.asm | 2 +- engine/events/pick_up_item.asm | 4 +-- engine/events/poison.asm | 4 +-- engine/events/prize_menu.asm | 21 ++++++------- engine/items/item_effects.asm | 7 +++-- engine/menus/display_text_id_init.asm | 2 +- engine/overworld/push_boulder.asm | 6 ++-- home/overworld.asm | 20 ++++++------ home/predef_text.asm | 2 +- home/text.asm | 4 +-- home/text_script.asm | 9 +++--- home/trainers.asm | 4 +-- home/uncompress.asm | 2 +- ram/hram.asm | 2 +- ram/wram.asm | 1 + scripts/AgathasRoom.asm | 4 +-- scripts/BillsHouse.asm | 2 +- scripts/BrunosRoom.asm | 4 +-- scripts/CeladonGym.asm | 6 ++-- scripts/CeruleanCity.asm | 10 +++--- scripts/CeruleanGym.asm | 6 ++-- scripts/ChampionsRoom.asm | 12 ++++---- scripts/CinnabarGym.asm | 12 ++++---- scripts/CinnabarIsland.asm | 2 +- scripts/FightingDojo.asm | 6 ++-- scripts/FuchsiaGym.asm | 6 ++-- scripts/GameCorner.asm | 2 +- scripts/GameCornerPrizeRoom.asm | 1 + scripts/HallOfFame.asm | 2 +- scripts/LancesRoom.asm | 4 +-- scripts/LoreleisRoom.asm | 4 +-- scripts/MtMoonB2F.asm | 4 +-- scripts/Museum1F.asm | 2 +- scripts/OaksLab.asm | 32 ++++++++++---------- scripts/PalletTown.asm | 4 +-- scripts/PewterCity.asm | 6 ++-- scripts/PewterGym.asm | 6 ++-- scripts/PokemonMansion1F.asm | 2 +- scripts/PokemonMansion2F.asm | 2 +- scripts/PokemonMansion3F.asm | 2 +- scripts/PokemonMansionB1F.asm | 2 +- scripts/PokemonTower2F.asm | 4 +-- scripts/PokemonTower5F.asm | 2 +- scripts/PokemonTower6F.asm | 4 +-- scripts/PokemonTower7F.asm | 2 +- scripts/RocketHideoutB4F.asm | 2 +- scripts/Route12.asm | 4 +-- scripts/Route16.asm | 4 +-- scripts/Route16Gate1F.asm | 4 +-- scripts/Route18Gate1F.asm | 4 +-- scripts/Route22.asm | 8 ++--- scripts/Route22Gate.asm | 2 +- scripts/Route23.asm | 2 +- scripts/Route24.asm | 6 ++-- scripts/Route5Gate.asm | 4 +-- scripts/Route6Gate.asm | 4 +-- scripts/Route7Gate.asm | 4 +-- scripts/Route8Gate.asm | 4 +-- scripts/SSAnne2F.asm | 4 +-- scripts/SafariZoneGate.asm | 8 ++--- scripts/SaffronGym.asm | 6 ++-- scripts/SilphCo11F.asm | 4 +-- scripts/SilphCo7F.asm | 6 ++-- scripts/VermilionCity.asm | 2 +- scripts/VermilionGym.asm | 6 ++-- scripts/ViridianCity.asm | 6 ++-- scripts/ViridianGym.asm | 6 ++-- scripts/ViridianMart.asm | 4 +-- scripts/WardensHouse.asm | 2 +- 73 files changed, 182 insertions(+), 181 deletions(-) diff --git a/data/text/text_2.asm b/data/text/text_2.asm index 4362e0f20..df28740dc 100644 --- a/data/text/text_2.asm +++ b/data/text/text_2.asm @@ -1781,7 +1781,7 @@ _WillBeTradedText:: done _TextIDErrorText:: - text_decimal hSpriteIndexOrTextID, 1, 2 + text_decimal hTextID, 1, 2 text " ERROR." done diff --git a/engine/battle/battle_transitions.asm b/engine/battle/battle_transitions.asm index 16311f48f..5956d875b 100644 --- a/engine/battle/battle_transitions.asm +++ b/engine/battle/battle_transitions.asm @@ -11,7 +11,7 @@ BattleTransition: ; Determine which OAM block is being used by the enemy trainer sprite (if there ; is one). ld hl, wSpritePlayerStateData1ImageIndex - ldh a, [hSpriteIndexOrTextID] ; enemy trainer sprite index (0 if wild battle) + ldh a, [hSpriteIndex] ; enemy trainer sprite index (0 if wild battle) ld c, a ld b, 0 ld de, $10 diff --git a/engine/battle/wild_encounters.asm b/engine/battle/wild_encounters.asm index ea451bcff..b5cf9f518 100644 --- a/engine/battle/wild_encounters.asm +++ b/engine/battle/wild_encounters.asm @@ -90,7 +90,7 @@ TryDoWildEncounter: .lastRepelStep ld [wRepelRemainingSteps], a ld a, TEXT_REPEL_WORE_OFF - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call EnableAutoTextBoxDrawing call DisplayTextID .CantEncounter2 diff --git a/engine/events/card_key.asm b/engine/events/card_key.asm index b052d3e2c..1597e12be 100644 --- a/engine/events/card_key.asm +++ b/engine/events/card_key.asm @@ -28,7 +28,7 @@ PrintCardKeyText: call GetCoordsInFrontOfPlayer push de tx_pre_id CardKeySuccessText - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call PrintPredefTextID pop de srl d @@ -55,7 +55,7 @@ PrintCardKeyText: jp PlaySound .noCardKey tx_pre_id CardKeyFailText - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a jp PrintPredefTextID INCLUDE "data/events/card_key_maps.asm" diff --git a/engine/events/hidden_objects/safari_game.asm b/engine/events/hidden_objects/safari_game.asm index 6fac1afa9..fc014ce0a 100644 --- a/engine/events/hidden_objects/safari_game.asm +++ b/engine/events/hidden_objects/safari_game.asm @@ -41,7 +41,7 @@ SafariZoneGameOver: cp SFX_SAFARI_ZONE_PA jr nz, .waitForMusicToPlay ld a, TEXT_SAFARI_GAME_OVER - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID xor a ld [wPlayerMovingDirection], a diff --git a/engine/events/pick_up_item.asm b/engine/events/pick_up_item.asm index 548db5be9..8fbdcfa23 100644 --- a/engine/events/pick_up_item.asm +++ b/engine/events/pick_up_item.asm @@ -1,7 +1,7 @@ PickUpItem: call EnableAutoTextBoxDrawing - ldh a, [hSpriteIndexOrTextID] + ldh a, [hSpriteIndex] ld b, a ld hl, wMissableObjectList .missableObjectsListLoop @@ -18,7 +18,7 @@ PickUpItem: ldh [hMissableObjectIndex], a ld hl, wMapSpriteExtraData - ldh a, [hSpriteIndexOrTextID] + ldh a, [hSpriteIndex] dec a add a ld d, 0 diff --git a/engine/events/poison.asm b/engine/events/poison.asm index 513d08a79..121bdc19a 100644 --- a/engine/events/poison.asm +++ b/engine/events/poison.asm @@ -53,7 +53,7 @@ ApplyOutOfBattlePoisonDamage: ld [wJoyIgnore], a call EnableAutoTextBoxDrawing ld a, TEXT_MON_FAINTED - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID pop de pop hl @@ -100,7 +100,7 @@ ApplyOutOfBattlePoisonDamage: jr nz, .noBlackOut call EnableAutoTextBoxDrawing ld a, TEXT_BLACKED_OUT - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ld hl, wStatusFlags4 set BIT_BATTLE_OVER_OR_BLACKOUT, [hl] diff --git a/engine/events/prize_menu.asm b/engine/events/prize_menu.asm index 4603b582d..f99cdaaa2 100644 --- a/engine/events/prize_menu.asm +++ b/engine/events/prize_menu.asm @@ -56,17 +56,14 @@ WhichPrizeTextPtr: text_end GetPrizeMenuId: -; determine which one among the three -; prize-texts has been selected -; using the text ID (stored in [hSpriteIndexOrTextID]) -; load the three prizes at wd13d-wd13f -; load the three prices at wd141-wd146 -; display the three prizes' names -; (distinguishing between Pokemon names -; and Items (specifically TMs) names) - ldh a, [hSpriteIndexOrTextID] - sub 3 ; prize-texts' id are 3, 4 and 5 - ld [wWhichPrizeWindow], a ; prize-texts' id (relative, i.e. 0, 1 or 2) +; determine which one among the three prize texts has been selected using the text ID (stored in [hTextID]) +; prize texts' IDs are TEXT_GAMECORNERPRIZEROOM_PRIZE_VENDOR_1-TEXT_GAMECORNERPRIZEROOM_PRIZE_VENDOR_3 +; load the three prizes at wPrize1-wPrice3 +; load the three prices at wPrize1Price-wPrize3Price +; display the three prizes' names, distinguishing between Pokemon names and item names (specifically TMs) + ldh a, [hTextID] + sub TEXT_GAMECORNERPRIZEROOM_PRIZE_VENDOR_1 + ld [wWhichPrizeWindow], a ; prize texts' relative ID (i.e. 0-2) add a add a ld d, 0 @@ -88,7 +85,7 @@ GetPrizeMenuId: ld bc, 6 call CopyData ld a, [wWhichPrizeWindow] - cp 2 ;is TM_menu? + cp 2 ; is TM_menu? jr nz, .putMonName ld a, [wPrize1] ld [wd11e], a diff --git a/engine/items/item_effects.asm b/engine/items/item_effects.asm index 5b41516f9..df050b031 100644 --- a/engine/items/item_effects.asm +++ b/engine/items/item_effects.asm @@ -688,11 +688,11 @@ ItemUseSurfboard: jp PrintText .tryToStopSurfing xor a - ldh [hSpriteIndexOrTextID], a + ldh [hSpriteIndex], a ld d, 16 ; talking range in pixels (normal range) call IsSpriteInFrontOfPlayer2 res 7, [hl] - ldh a, [hSpriteIndexOrTextID] + ldh a, [hSpriteIndex] and a ; is there a sprite in the way? jr nz, .cannotStopSurfing ld hl, TilePairCollisionsWater @@ -2512,9 +2512,10 @@ GetMaxPP: and %11000000 ; get PP Up count pop bc or b ; place normal max PP in 6 lower bits of a + assert wMoveData + MOVE_PP + 1 == wPPUpCountAndMaxPP ld h, d ld l, e - inc hl ; hl = wcd73 + inc hl ; hl = wPPUpCountAndMaxPP ld [hl], a xor a ; add the bonus for the existing PP Up count ld [wUsingPPUp], a diff --git a/engine/menus/display_text_id_init.asm b/engine/menus/display_text_id_init.asm index 7f2c1a59a..a89696fbf 100644 --- a/engine/menus/display_text_id_init.asm +++ b/engine/menus/display_text_id_init.asm @@ -5,7 +5,7 @@ DisplayTextIDInit:: ld a, [wAutoTextBoxDrawingControl] bit 0, a jr nz, .skipDrawingTextBoxBorder - ldh a, [hSpriteIndexOrTextID] ; text ID (or sprite ID) + ldh a, [hTextID] and a jr nz, .notStartMenu ; if text ID is 0 (i.e. the start menu) diff --git a/engine/overworld/push_boulder.asm b/engine/overworld/push_boulder.asm index 7eee844c1..ff4814397 100644 --- a/engine/overworld/push_boulder.asm +++ b/engine/overworld/push_boulder.asm @@ -6,15 +6,15 @@ TryPushingBoulder:: bit BIT_BOULDER_DUST, a ret nz xor a - ldh [hSpriteIndexOrTextID], a + ldh [hSpriteIndex], a call IsSpriteInFrontOfPlayer - ldh a, [hSpriteIndexOrTextID] + ldh a, [hSpriteIndex] ld [wBoulderSpriteIndex], a and a jp z, ResetBoulderPushFlags ld hl, wSpritePlayerStateData1MovementStatus ld d, $0 - ldh a, [hSpriteIndexOrTextID] + ldh a, [hSpriteIndex] swap a ld e, a add hl, de diff --git a/home/overworld.asm b/home/overworld.asm index 805a1b600..1595fdf0c 100644 --- a/home/overworld.asm +++ b/home/overworld.asm @@ -76,7 +76,7 @@ OverworldLoopLessDelay:: jr z, .startButtonNotPressed ; if START is pressed xor a ; TEXT_START_MENU - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a jp .displayDialogue .startButtonNotPressed bit BIT_A_BUTTON, a @@ -92,7 +92,7 @@ OverworldLoopLessDelay:: and a jp z, OverworldLoop ; jump if a hidden object or bookshelf was found, but not if a card key door was found call IsSpriteOrSignInFrontOfPlayer - ldh a, [hSpriteIndexOrTextID] + ldh a, [hTextID] and a jp z, OverworldLoop .displayDialogue @@ -1072,11 +1072,11 @@ LoadEastWestConnectionsTileMap:: ret ; function to check if there is a sign or sprite in front of the player -; if so, it is stored in [hSpriteIndexOrTextID] -; if not, [hSpriteIndexOrTextID] is set to 0 +; if so, it is stored in [hTextID] +; if not, [hTextID] is set to 0 IsSpriteOrSignInFrontOfPlayer:: xor a - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a ld a, [wNumSigns] and a jr z, .extendRangeOverCounter @@ -1106,7 +1106,7 @@ IsSpriteOrSignInFrontOfPlayer:: dec c add hl, bc ld a, [hl] - ldh [hSpriteIndexOrTextID], a ; store sign text ID + ldh [hTextID], a ; store sign text ID pop bc pop hl ret @@ -1127,7 +1127,7 @@ IsSpriteOrSignInFrontOfPlayer:: jr nz, .counterTilesLoop ; part of the above function, but sometimes its called on its own, when signs are irrelevant -; the caller must zero [hSpriteIndexOrTextID] +; the caller must zero [hTextID] IsSpriteInFrontOfPlayer:: ld d, $10 ; talking range in pixels (normal range) IsSpriteInFrontOfPlayer2:: @@ -1212,7 +1212,7 @@ IsSpriteInFrontOfPlayer2:: ld l, a ; hl = x#SPRITESTATEDATA1_MOVEMENTSTATUS set 7, [hl] ; set flag to make the sprite face the player ld a, e - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a ret ; function to check if the player will jump down a ledge and check if the tile ahead is passable (when not surfing) @@ -1231,9 +1231,9 @@ CollisionCheckOnLand:: and d ; check if a sprite is in the direction the player is trying to go jr nz, .collision xor a - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call IsSpriteInFrontOfPlayer ; check for sprite collisions again? when does the above check fail to detect a sprite collision? - ldh a, [hSpriteIndexOrTextID] + ldh a, [hTextID] and a ; was there a sprite collision? jr nz, .collision ; if no sprite collision diff --git a/home/predef_text.asm b/home/predef_text.asm index 1537ad5b7..bdecd3cf1 100644 --- a/home/predef_text.asm +++ b/home/predef_text.asm @@ -1,5 +1,5 @@ PrintPredefTextID:: - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a ld hl, TextPredefs call SetMapTextPointer ld hl, wTextPredefFlag diff --git a/home/text.asm b/home/text.asm index e815fbf7c..dc78b982c 100644 --- a/home/text.asm +++ b/home/text.asm @@ -117,13 +117,13 @@ NullChar:: ; unused pop hl ; A "" character in a printed string ; displays an error message with the current value - ; of hSpriteIndexOrTextID in decimal format. + ; of hTextID in decimal format. ; This is a debugging leftover. ld de, TextIDErrorText dec de ret -TextIDErrorText:: ; "[hSpriteIndexOrTextID] ERROR." +TextIDErrorText:: ; "[hTextID] ERROR." text_far _TextIDErrorText text_end diff --git a/home/text_script.asm b/home/text_script.asm index 5c90a981e..d367683db 100644 --- a/home/text_script.asm +++ b/home/text_script.asm @@ -1,6 +1,7 @@ ; this function is used to display sign messages, sprite dialog, etc. -; INPUT: [hSpriteIndexOrTextID] = sprite ID or text ID +; INPUT: [hSpriteIndex] = sprite ID or [hTextID] = text ID DisplayTextID:: + assert hSpriteIndex == hTextID ; these are at the same memory location ldh a, [hLoadedROMBank] push af farcall DisplayTextIDInit ; initialization @@ -18,7 +19,7 @@ DisplayTextID:: ld h, [hl] ld l, a ; hl = map text pointer ld d, $00 - ldh a, [hSpriteIndexOrTextID] ; text ID + ldh a, [hTextID] ld [wSpriteIndex], a dict TEXT_START_MENU, DisplayStartMenu @@ -29,7 +30,7 @@ DisplayTextID:: ld a, [wNumSprites] ld e, a - ldh a, [hSpriteIndexOrTextID] ; sprite ID + ldh a, [hSpriteIndex] ; sprite ID cp e jr z, .spriteHandling jr nc, .skipSpriteHandling @@ -42,7 +43,7 @@ DisplayTextID:: pop bc pop de ld hl, wMapSpriteData ; NPC text entries - ldh a, [hSpriteIndexOrTextID] + ldh a, [hSpriteIndex] dec a add a add l diff --git a/home/trainers.asm b/home/trainers.asm index 0038d48c8..0a466cc1e 100644 --- a/home/trainers.asm +++ b/home/trainers.asm @@ -7,7 +7,7 @@ StoreTrainerHeaderPointer:: ret ; executes the current map script from the function pointer array provided in de. -; a: map script index to execute (unless overridden by [wd733] bit 4) +; a: map script index to execute (unless overridden by [wStatusFlags7] BIT_USE_CUR_MAP_SCRIPT) ; hl: trainer header pointer ExecuteCurMapScriptInTable:: push af @@ -165,7 +165,7 @@ DisplayEnemyTrainerTextAndStartBattle:: ret nz ; return if the enemy trainer hasn't finished walking to the player's sprite ld [wJoyIgnore], a ld a, [wSpriteIndex] - ldh [hSpriteIndexOrTextID], a + ldh [hSpriteIndex], a call DisplayTextID ; fall through diff --git a/home/uncompress.asm b/home/uncompress.asm index d3d84b26c..0e609f1c1 100644 --- a/home/uncompress.asm +++ b/home/uncompress.asm @@ -52,7 +52,7 @@ _UncompressSpriteData:: ; bit 0 decides in which one the first chunk is placed ; fall through -; uncompresses a chunk from the sprite input data stream (pointed to at wd0da) into sSpriteBuffer1 or sSpriteBuffer2 +; uncompresses a chunk from the sprite input data stream (pointed to by wSpriteInputPtr) into sSpriteBuffer1 or sSpriteBuffer2 ; each chunk is a 1bpp sprite. A 2bpp sprite consist of two chunks which are merged afterwards ; note that this is an endless loop which is terminated during a call to MoveToNextBufferPosition by manipulating the stack UncompressSpriteDataLoop:: diff --git a/ram/hram.asm b/ram/hram.asm index 1a781da4b..e7c3ef3c8 100644 --- a/ram/hram.asm +++ b/ram/hram.asm @@ -16,7 +16,7 @@ hPreviousTileset:: hRLEByteValue:: db -hSpriteIndexOrTextID:: ; DisplayTextID's argument +hTextID:: ; DisplayTextID's argument hPartyMonIndex:: db diff --git a/ram/wram.asm b/ram/wram.asm index 8bfbfcf4c..a4d757074 100644 --- a/ram/wram.asm +++ b/ram/wram.asm @@ -882,6 +882,7 @@ wNameBuffer:: ds NAME_BUFFER_LENGTH NEXTU ; data copied from Moves for one move wMoveData:: ds MOVE_LENGTH +wPPUpCountAndMaxPP:: db NEXTU ; amount of money made from one use of Pay Day diff --git a/scripts/AgathasRoom.asm b/scripts/AgathasRoom.asm index cf5254ac0..0f3acc18c 100644 --- a/scripts/AgathasRoom.asm +++ b/scripts/AgathasRoom.asm @@ -75,7 +75,7 @@ AgathasRoomDefaultScript: jr z, AgathaScriptWalkIntoRoom .stopPlayerFromLeaving ld a, TEXT_AGATHASROOM_AGATHA_DONT_RUN_AWAY - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ld a, D_UP ld [wSimulatedJoypadStatesEnd], a @@ -111,7 +111,7 @@ AgathasRoomAgathaEndBattleScript: cp $ff jp z, ResetAgathaScript ld a, TEXT_AGATHASROOM_AGATHA - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ld a, SCRIPT_CHAMPIONSROOM_PLAYER_ENTERS ld [wChampionsRoomCurScript], a diff --git a/scripts/BillsHouse.asm b/scripts/BillsHouse.asm index cf87ea64b..86f79cb3b 100644 --- a/scripts/BillsHouse.asm +++ b/scripts/BillsHouse.asm @@ -110,7 +110,7 @@ BillsHouseCleanupScript: BillsHousePCScript: ld a, TEXT_BILLSHOUSE_ACTIVATE_PC - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ld a, SCRIPT_BILLSHOUSE_DEFAULT ld [wBillsHouseCurScript], a diff --git a/scripts/BrunosRoom.asm b/scripts/BrunosRoom.asm index 2a4ed6e66..94ec7d17e 100644 --- a/scripts/BrunosRoom.asm +++ b/scripts/BrunosRoom.asm @@ -75,7 +75,7 @@ BrunosRoomDefaultScript: jr z, BrunoScriptWalkIntoRoom .stopPlayerFromLeaving ld a, TEXT_BRUNOSROOM_BRUNO_DONT_RUN_AWAY - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ; "Don't run away!" ld a, D_UP ld [wSimulatedJoypadStatesEnd], a @@ -111,7 +111,7 @@ BrunosRoomBrunoEndBattleScript: cp $ff jp z, ResetBrunoScript ld a, TEXT_BRUNOSROOM_BRUNO - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a jp DisplayTextID BrunosRoom_TextPointers: diff --git a/scripts/CeladonGym.asm b/scripts/CeladonGym.asm index ea1f50538..ca7da4e50 100644 --- a/scripts/CeladonGym.asm +++ b/scripts/CeladonGym.asm @@ -45,20 +45,20 @@ CeladonGymErikaPostBattleScript: CeladonGymReceiveTM21: ld a, TEXT_CELADONGYM_RAINBOWBADGE_INFO - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID SetEvent EVENT_BEAT_ERIKA lb bc, TM_MEGA_DRAIN, 1 call GiveItem jr nc, .BagFull ld a, TEXT_CELADONGYM_RECEIVED_TM21 - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID SetEvent EVENT_GOT_TM21 jr .gymVictory .BagFull ld a, TEXT_CELADONGYM_TM21_NO_ROOM - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID .gymVictory ld hl, wObtainedBadges diff --git a/scripts/CeruleanCity.asm b/scripts/CeruleanCity.asm index 2ff5f3be7..9cf44891d 100644 --- a/scripts/CeruleanCity.asm +++ b/scripts/CeruleanCity.asm @@ -28,7 +28,7 @@ CeruleanCityRocketDefeatedScript: ld [wJoyIgnore], a SetEvent EVENT_BEAT_CERULEAN_ROCKET_THIEF ld a, TEXT_CERULEANCITY_ROCKET - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID xor a ; SCRIPT_CERULEANCITY_DEFAULT ld [wJoyIgnore], a @@ -58,7 +58,7 @@ ENDC ld [wSprite02StateData1FacingDirection], a call Delay3 ld a, TEXT_CERULEANCITY_ROCKET - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a jp DisplayTextID .skipRocketThiefEncounter CheckEvent EVENT_BEAT_CERULEAN_RIVAL @@ -131,7 +131,7 @@ CeruleanCityRivalBattleScript: xor a ld [wJoyIgnore], a ld a, TEXT_CERULEANCITY_RIVAL - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ld hl, wStatusFlags3 set BIT_TALKED_TO_TRAINER, [hl] @@ -174,7 +174,7 @@ CeruleanCityRivalDefeatedScript: ld [wJoyIgnore], a SetEvent EVENT_BEAT_CERULEAN_RIVAL ld a, TEXT_CERULEANCITY_RIVAL - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ld a, SFX_STOP_ALL_MUSIC ld [wNewSoundID], a @@ -295,7 +295,7 @@ CeruleanCityRocketText: ld hl, .IGiveUpText ld de, .IGiveUpText call SaveEndBattleTextPointers - ldh a, [hSpriteIndexOrTextID] + ldh a, [hTextID] ld [wSpriteIndex], a call EngageMapTrainer call InitBattleEnemyParameters diff --git a/scripts/CeruleanGym.asm b/scripts/CeruleanGym.asm index 7795b70bc..37d5e4059 100644 --- a/scripts/CeruleanGym.asm +++ b/scripts/CeruleanGym.asm @@ -45,20 +45,20 @@ CeruleanGymMistyPostBattleScript: CeruleanGymReceiveTM11: ld a, TEXT_CERULEANGYM_MISTY_CASCADE_BADGE_INFO - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID SetEvent EVENT_BEAT_MISTY lb bc, TM_BUBBLEBEAM, 1 call GiveItem jr nc, .BagFull ld a, TEXT_CERULEANGYM_MISTY_RECEIVED_TM11 - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID SetEvent EVENT_GOT_TM11 jr .gymVictory .BagFull ld a, TEXT_CERULEANGYM_MISTY_TM11_NO_ROOM - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID .gymVictory ld hl, wObtainedBadges diff --git a/scripts/ChampionsRoom.asm b/scripts/ChampionsRoom.asm index f3c9818df..efa666801 100644 --- a/scripts/ChampionsRoom.asm +++ b/scripts/ChampionsRoom.asm @@ -56,7 +56,7 @@ ChampionsRoomRivalReadyToBattleScript: ld hl, wOptions res BIT_BATTLE_ANIMATION, [hl] ld a, TEXT_CHAMPIONSROOM_RIVAL - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID call Delay3 ld hl, wStatusFlags3 @@ -99,7 +99,7 @@ ChampionsRoomRivalDefeatedScript: ld a, D_RIGHT | D_LEFT | D_UP | D_DOWN ld [wJoyIgnore], a ld a, TEXT_CHAMPIONSROOM_RIVAL - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call ChampionsRoom_DisplayTextID_AllowABSelectStart ld a, CHAMPIONSROOM_RIVAL ldh [hSpriteIndex], a @@ -111,7 +111,7 @@ ChampionsRoomRivalDefeatedScript: ChampionsRoomOakArrivesScript: farcall Music_Cities1AlternateTempo ld a, TEXT_CHAMPIONSROOM_OAK - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call ChampionsRoom_DisplayTextID_AllowABSelectStart ld a, CHAMPIONSROOM_OAK ldh [hSpriteIndex], a @@ -152,7 +152,7 @@ ChampionsRoomOakCongratulatesPlayerScript: ldh [hSpriteFacingDirection], a call SetSpriteFacingDirectionAndDelay ld a, TEXT_CHAMPIONSROOM_OAK_CONGRATULATES_PLAYER - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call ChampionsRoom_DisplayTextID_AllowABSelectStart ld a, SCRIPT_CHAMPIONSROOM_OAK_DISAPPOINTED_WITH_RIVAL ld [wChampionsRoomCurScript], a @@ -165,7 +165,7 @@ ChampionsRoomOakDisappointedWithRivalScript: ldh [hSpriteFacingDirection], a call SetSpriteFacingDirectionAndDelay ld a, TEXT_CHAMPIONSROOM_OAK_DISAPPOINTED_WITH_RIVAL - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call ChampionsRoom_DisplayTextID_AllowABSelectStart ld a, SCRIPT_CHAMPIONSROOM_OAK_COME_WITH_ME ld [wChampionsRoomCurScript], a @@ -178,7 +178,7 @@ ChampionsRoomOakComeWithMeScript: ldh [hSpriteFacingDirection], a call SetSpriteFacingDirectionAndDelay ld a, TEXT_CHAMPIONSROOM_OAK_COME_WITH_ME - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call ChampionsRoom_DisplayTextID_AllowABSelectStart ld de, OakExitChampionsRoomMovement ld a, CHAMPIONSROOM_OAK diff --git a/scripts/CinnabarGym.asm b/scripts/CinnabarGym.asm index a7608a4fe..b7c9e1bab 100644 --- a/scripts/CinnabarGym.asm +++ b/scripts/CinnabarGym.asm @@ -38,7 +38,7 @@ CinnabarGymResetScripts: ret CinnabarGymSetTrainerHeader: - ldh a, [hSpriteIndexOrTextID] + ldh a, [hTextID] ld [wTrainerHeaderFlagBit], a ret @@ -88,7 +88,7 @@ CinnabarGymGetOpponentTextScript: ld [wJoyIgnore], a ld a, [wOpponentAfterWrongAnswer] ld [wTrainerHeaderFlagBit], a - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a jp DisplayTextID CinnabarGymFlagAction: @@ -145,20 +145,20 @@ CinnabarGymBlainePostBattleScript: ; fallthrough CinnabarGymReceiveTM38: ld a, TEXT_CINNABARGYM_BLAINE_VOLCANO_BADGE_INFO - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID SetEvent EVENT_BEAT_BLAINE lb bc, TM_FIRE_BLAST, 1 call GiveItem jr nc, .BagFull ld a, TEXT_CINNABARGYM_BLAINE_RECEIVED_TM38 - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID SetEvent EVENT_GOT_TM38 jr .gymVictory .BagFull ld a, TEXT_CINNABARGYM_BLAINE_TM38_NO_ROOM - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID .gymVictory ld hl, wObtainedBadges @@ -190,7 +190,7 @@ CinnabarGym_TextPointers: dw_const CinnabarGymBlaineTM38NoRoomText, TEXT_CINNABARGYM_BLAINE_TM38_NO_ROOM CinnabarGymStartBattleScript: - ldh a, [hSpriteIndexOrTextID] + ldh a, [hSpriteIndex] ld [wSpriteIndex], a call EngageMapTrainer call InitBattleEnemyParameters diff --git a/scripts/CinnabarIsland.asm b/scripts/CinnabarIsland.asm index aca1b995c..ed38f6902 100644 --- a/scripts/CinnabarIsland.asm +++ b/scripts/CinnabarIsland.asm @@ -26,7 +26,7 @@ CinnabarIslandDefaultScript: ld a, PLAYER_DIR_UP ld [wPlayerMovingDirection], a ld a, TEXT_CINNABARISLAND_DOOR_IS_LOCKED - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID xor a ldh [hJoyHeld], a diff --git a/scripts/FightingDojo.asm b/scripts/FightingDojo.asm index 4522b9068..bffa4554f 100644 --- a/scripts/FightingDojo.asm +++ b/scripts/FightingDojo.asm @@ -49,7 +49,7 @@ FightingDojoDefaultScript: ldh [hSpriteFacingDirection], a call SetSpriteFacingDirectionAndDelay ld a, TEXT_FIGHTINGDOJO_KARATE_MASTER - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ret @@ -72,7 +72,7 @@ FightingDojoKarateMasterPostBattleScript: ld [wJoyIgnore], a SetEventRange EVENT_BEAT_KARATE_MASTER, EVENT_BEAT_FIGHTING_DOJO_TRAINER_3 ld a, TEXT_FIGHTINGDOJO_KARATE_MASTER_I_WILL_GIVE_YOU_A_POKEMON - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID xor a ; SCRIPT_FIGHTINGDOJO_DEFAULT ld [wJoyIgnore], a @@ -117,7 +117,7 @@ FightingDojoKarateMasterText: ld hl, .DefeatedText ld de, .DefeatedText call SaveEndBattleTextPointers - ldh a, [hSpriteIndexOrTextID] + ldh a, [hSpriteIndex] ld [wSpriteIndex], a call EngageMapTrainer call InitBattleEnemyParameters diff --git a/scripts/FuchsiaGym.asm b/scripts/FuchsiaGym.asm index d2f0ee40f..8ccebe409 100644 --- a/scripts/FuchsiaGym.asm +++ b/scripts/FuchsiaGym.asm @@ -47,20 +47,20 @@ FuchsiaGymKogaPostBattleScript: ; fallthrough FuchsiaGymReceiveTM06: ld a, TEXT_FUCHSIAGYM_KOGA_SOUL_BADGE_INFO - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID SetEvent EVENT_BEAT_KOGA lb bc, TM_TOXIC, 1 call GiveItem jr nc, .BagFull ld a, TEXT_FUCHSIAGYM_KOGA_RECEIVED_TM06 - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID SetEvent EVENT_GOT_TM06 jr .gymVictory .BagFull ld a, TEXT_FUCHSIAGYM_KOGA_TM06_NO_ROOM - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID .gymVictory ld hl, wObtainedBadges diff --git a/scripts/GameCorner.asm b/scripts/GameCorner.asm index b2ef12069..5d5236c5f 100644 --- a/scripts/GameCorner.asm +++ b/scripts/GameCorner.asm @@ -58,7 +58,7 @@ GameCornerRocketBattleScript: ld a, D_RIGHT | D_LEFT | D_UP | D_DOWN ld [wJoyIgnore], a ld a, TEXT_GAMECORNER_ROCKET_AFTER_BATTLE - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ld a, GAMECORNER_ROCKET ldh [hSpriteIndex], a diff --git a/scripts/GameCornerPrizeRoom.asm b/scripts/GameCornerPrizeRoom.asm index 443e02609..8e3bc0a65 100644 --- a/scripts/GameCornerPrizeRoom.asm +++ b/scripts/GameCornerPrizeRoom.asm @@ -8,6 +8,7 @@ GameCornerPrizeRoom_TextPointers: dw_const GameCornerPRizeRoomPrizeVendorText, TEXT_GAMECORNERPRIZEROOM_PRIZE_VENDOR_1 dw_const GameCornerPRizeRoomPrizeVendorText, TEXT_GAMECORNERPRIZEROOM_PRIZE_VENDOR_2 dw_const GameCornerPRizeRoomPrizeVendorText, TEXT_GAMECORNERPRIZEROOM_PRIZE_VENDOR_3 + EXPORT TEXT_GAMECORNERPRIZEROOM_PRIZE_VENDOR_1 ; used by engine/events/prize_menu.asm GameCornerPrizeRoomBaldingGuyText: text_far _GameCornerPrizeRoomBaldingGuyText diff --git a/scripts/HallOfFame.asm b/scripts/HallOfFame.asm index 462988136..ed3d2a731 100644 --- a/scripts/HallOfFame.asm +++ b/scripts/HallOfFame.asm @@ -92,7 +92,7 @@ HallOfFameOakCongratulationsScript: inc a ; PLAYER_DIR_RIGHT ld [wPlayerMovingDirection], a ld a, TEXT_HALLOFFAME_OAK - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ld a, A_BUTTON | B_BUTTON | SELECT | START | D_RIGHT | D_LEFT | D_UP | D_DOWN ld [wJoyIgnore], a diff --git a/scripts/LancesRoom.asm b/scripts/LancesRoom.asm index fd1401c28..31b0f2408 100644 --- a/scripts/LancesRoom.asm +++ b/scripts/LancesRoom.asm @@ -63,7 +63,7 @@ LancesRoomDefaultScript: cp $3 ; Is player standing next to Lance's sprite? jr nc, .notStandingNextToLance ld a, TEXT_LANCESROOM_LANCE - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a jp DisplayTextID .notStandingNextToLance cp $5 ; Is player standing on the entrance staircase? @@ -90,7 +90,7 @@ LancesRoomLanceEndBattleScript: cp $ff jp z, ResetLanceScript ld a, TEXT_LANCESROOM_LANCE - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a jp DisplayTextID WalkToLance: diff --git a/scripts/LoreleisRoom.asm b/scripts/LoreleisRoom.asm index 52d79b154..ec88f73e4 100644 --- a/scripts/LoreleisRoom.asm +++ b/scripts/LoreleisRoom.asm @@ -77,7 +77,7 @@ LoreleisRoomDefaultScript: jr z, LoreleiScriptWalkIntoRoom .stopPlayerFromLeaving ld a, TEXT_LORELEISROOM_DONT_RUN_AWAY - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ; "Don't run away!" ld a, D_UP ld [wSimulatedJoypadStatesEnd], a @@ -113,7 +113,7 @@ LoreleisRoomLoreleiEndBattleScript: cp $ff jp z, ResetLoreleiScript ld a, TEXT_LORELEISROOM_LORELEI - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a jp DisplayTextID LoreleisRoom_TextPointers: diff --git a/scripts/MtMoonB2F.asm b/scripts/MtMoonB2F.asm index 3afd14c89..d17d13fee 100644 --- a/scripts/MtMoonB2F.asm +++ b/scripts/MtMoonB2F.asm @@ -65,7 +65,7 @@ MtMoonB2FDefaultScript: xor a ldh [hJoyHeld], a ld a, TEXT_MTMOONB2F_SUPER_NERD - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a jp DisplayTextID MtMoonB2FCheckGotAFossil: @@ -137,7 +137,7 @@ MtMoonB2FSuperNerdTakesOtherFossilScript: ld a, $1 ld [wDoNotWaitForButtonPressAfterDisplayingText], a ld a, TEXT_MTMOONB2F_SUPER_NERD_THEN_THIS_IS_MINE - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID CheckEvent EVENT_GOT_DOME_FOSSIL jr z, .got_dome_fossil diff --git a/scripts/Museum1F.asm b/scripts/Museum1F.asm index 2939f51be..600c03c72 100644 --- a/scripts/Museum1F.asm +++ b/scripts/Museum1F.asm @@ -26,7 +26,7 @@ Museum1FDefaultScript: xor a ldh [hJoyHeld], a ld a, TEXT_MUSEUM1F_SCIENTIST1 - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a jp DisplayTextID Museum1FNoopScript: diff --git a/scripts/OaksLab.asm b/scripts/OaksLab.asm index 087e6a379..e89e0ee8c 100644 --- a/scripts/OaksLab.asm +++ b/scripts/OaksLab.asm @@ -129,19 +129,19 @@ OaksLabOakChooseMonSpeechScript: ld a, SELECT | START | D_RIGHT | D_LEFT | D_UP | D_DOWN ld [wJoyIgnore], a ld a, TEXT_OAKSLAB_RIVAL_FED_UP_WITH_WAITING - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID call Delay3 ld a, TEXT_OAKSLAB_OAK_CHOOSE_MON - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID call Delay3 ld a, TEXT_OAKSLAB_RIVAL_WHAT_ABOUT_ME - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID call Delay3 ld a, TEXT_OAKSLAB_OAK_BE_PATIENT - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID SetEvent EVENT_OAK_ASKED_TO_CHOOSE_MON xor a @@ -167,7 +167,7 @@ OaksLabPlayerDontGoAwayScript: call SetSpriteFacingDirectionAndDelay call UpdateSprites ld a, TEXT_OAKSLAB_OAK_DONT_GO_AWAY_YET - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ld a, $1 ld [wSimulatedJoypadStatesIndex], a @@ -301,7 +301,7 @@ OaksLabRivalChoosesStarterScript: ldh [hSpriteFacingDirection], a call SetSpriteFacingDirectionAndDelay ld a, TEXT_OAKSLAB_RIVAL_ILL_TAKE_THIS_ONE - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ld a, [wRivalStarterBallSpriteIndex] cp OAKSLAB_CHARMANDER_POKE_BALL @@ -330,7 +330,7 @@ OaksLabRivalChoosesStarterScript: ldh [hSpriteFacingDirection], a call SetSpriteFacingDirectionAndDelay ld a, TEXT_OAKSLAB_RIVAL_RECEIVED_MON - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID SetEvent EVENT_GOT_STARTER xor a @@ -355,7 +355,7 @@ OaksLabRivalChallengesPlayerScript: ld a, MUSIC_MEET_RIVAL call PlayMusic ld a, TEXT_OAKSLAB_RIVAL_ILL_TAKE_YOU_ON - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ld a, $1 ldh [hNPCPlayerRelativePosPerspective], a @@ -440,7 +440,7 @@ OaksLabRivalStartsExitScript: ld c, 20 call DelayFrames ld a, TEXT_OAKSLAB_RIVAL_SMELL_YOU_LATER - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID farcall Music_RivalAlternateStart ld a, OAKSLAB_RIVAL @@ -516,7 +516,7 @@ OaksLabRivalArrivesAtOaksRequestScript: call PlaySound farcall Music_RivalAlternateStart ld a, TEXT_OAKSLAB_RIVAL_GRAMPS - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID call OaksLabCalcRivalMovementScript ld a, HS_OAKS_LAB_RIVAL @@ -561,21 +561,21 @@ OaksLabOakGivesPokedexScript: ld [wJoyIgnore], a call OaksLabRivalFaceUpOakFaceDownScript ld a, TEXT_OAKSLAB_RIVAL_WHAT_DID_YOU_CALL_ME_FOR - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID call DelayFrame call OaksLabRivalFaceUpOakFaceDownScript ld a, TEXT_OAKSLAB_OAK_I_HAVE_A_REQUEST - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID call DelayFrame call OaksLabRivalFaceUpOakFaceDownScript ld a, TEXT_OAKSLAB_OAK_MY_INVENTION_POKEDEX - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID call DelayFrame ld a, TEXT_OAKSLAB_OAK_GOT_POKEDEX - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID call Delay3 ld a, HS_POKEDEX_1 @@ -586,7 +586,7 @@ OaksLabOakGivesPokedexScript: predef HideObject call OaksLabRivalFaceUpOakFaceDownScript ld a, TEXT_OAKSLAB_OAK_THAT_WAS_MY_DREAM - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ld a, OAKSLAB_RIVAL ldh [hSpriteIndex], a @@ -595,7 +595,7 @@ OaksLabOakGivesPokedexScript: call SetSpriteFacingDirectionAndDelay call Delay3 ld a, TEXT_OAKSLAB_RIVAL_LEAVE_IT_ALL_TO_ME - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID SetEvent EVENT_GOT_POKEDEX SetEvent EVENT_OAK_GOT_PARCEL diff --git a/scripts/PalletTown.asm b/scripts/PalletTown.asm index a787fcc48..14c5a840f 100644 --- a/scripts/PalletTown.asm +++ b/scripts/PalletTown.asm @@ -47,7 +47,7 @@ PalletTownOakHeyWaitScript: xor a ld [wOakWalkedToPlayer], a ld a, TEXT_PALLETTOWN_OAK - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ld a, A_BUTTON | B_BUTTON | SELECT | START | D_RIGHT | D_LEFT | D_UP | D_DOWN ld [wJoyIgnore], a @@ -101,7 +101,7 @@ PalletTownOakNotSafeComeWithMeScript: ld a, SELECT | START | D_RIGHT | D_LEFT | D_UP | D_DOWN ld [wJoyIgnore], a ld a, TEXT_PALLETTOWN_OAK - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ; set up movement script that causes the player to follow Oak to his lab ld a, A_BUTTON | B_BUTTON | SELECT | START | D_RIGHT | D_LEFT | D_UP | D_DOWN diff --git a/scripts/PewterCity.asm b/scripts/PewterCity.asm index 07c143d35..5cf0c8c7d 100644 --- a/scripts/PewterCity.asm +++ b/scripts/PewterCity.asm @@ -34,7 +34,7 @@ ENDC ld a, D_RIGHT | D_LEFT | D_UP | D_DOWN ld [wJoyIgnore], a ld a, TEXT_PEWTERCITY_YOUNGSTER - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a jp DisplayTextID PewterCityPlayerLeavingEastCoords: @@ -60,7 +60,7 @@ PewterCitySuperNerd1ShowsPlayerMuseumScript: ld hl, wMiscFlags set BIT_NO_SPRITE_UPDATES, [hl] ld a, TEXT_PEWTERCITY_SUPER_NERD1_ITS_RIGHT_HERE - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ld a, $3c ldh [hSpriteScreenYCoord], a @@ -128,7 +128,7 @@ PewterCityYoungsterShowsPlayerGymScript: ld hl, wMiscFlags set BIT_NO_SPRITE_UPDATES, [hl] ld a, TEXT_PEWTERCITY_YOUNGSTER_GO_TAKE_ON_BROCK - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ld a, $3c ldh [hSpriteScreenYCoord], a diff --git a/scripts/PewterGym.asm b/scripts/PewterGym.asm index b57710264..0029be19d 100644 --- a/scripts/PewterGym.asm +++ b/scripts/PewterGym.asm @@ -45,20 +45,20 @@ PewterGymBrockPostBattle: ; fallthrough PewterGymScriptReceiveTM34: ld a, TEXT_PEWTERGYM_BROCK_WAIT_TAKE_THIS - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID SetEvent EVENT_BEAT_BROCK lb bc, TM_BIDE, 1 call GiveItem jr nc, .BagFull ld a, TEXT_PEWTERGYM_RECEIVED_TM34 - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID SetEvent EVENT_GOT_TM34 jr .gymVictory .BagFull ld a, TEXT_PEWTERGYM_TM34_NO_ROOM - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID .gymVictory ld hl, wObtainedBadges diff --git a/scripts/PokemonMansion1F.asm b/scripts/PokemonMansion1F.asm index b294a2473..a93bd33b3 100644 --- a/scripts/PokemonMansion1F.asm +++ b/scripts/PokemonMansion1F.asm @@ -52,7 +52,7 @@ Mansion1Script_Switches:: xor a ldh [hJoyHeld], a ld a, TEXT_POKEMONMANSION1F_SWITCH - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a jp DisplayTextID PokemonMansion1F_ScriptPointers: diff --git a/scripts/PokemonMansion2F.asm b/scripts/PokemonMansion2F.asm index bc3d78e9b..df424a199 100644 --- a/scripts/PokemonMansion2F.asm +++ b/scripts/PokemonMansion2F.asm @@ -48,7 +48,7 @@ Mansion2Script_Switches:: xor a ldh [hJoyHeld], a ld a, TEXT_POKEMONMANSION2F_SWITCH - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a jp DisplayTextID PokemonMansion2F_ScriptPointers: diff --git a/scripts/PokemonMansion3F.asm b/scripts/PokemonMansion3F.asm index fab06bbdb..f53474467 100644 --- a/scripts/PokemonMansion3F.asm +++ b/scripts/PokemonMansion3F.asm @@ -80,7 +80,7 @@ Mansion3Script_Switches:: xor a ldh [hJoyHeld], a ld a, TEXT_POKEMONMANSION3F_SWITCH - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a jp DisplayTextID PokemonMansion3F_TextPointers: diff --git a/scripts/PokemonMansionB1F.asm b/scripts/PokemonMansionB1F.asm index 74f1648e7..e359621d6 100644 --- a/scripts/PokemonMansionB1F.asm +++ b/scripts/PokemonMansionB1F.asm @@ -50,7 +50,7 @@ Mansion4Script_Switches:: xor a ldh [hJoyHeld], a ld a, TEXT_POKEMONMANSIONB1F_SWITCH - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a jp DisplayTextID PokemonMansionB1F_ScriptPointers: diff --git a/scripts/PokemonTower2F.asm b/scripts/PokemonTower2F.asm index 00f83fc5f..6b3fe4aeb 100644 --- a/scripts/PokemonTower2F.asm +++ b/scripts/PokemonTower2F.asm @@ -51,7 +51,7 @@ ENDC ldh [hSpriteFacingDirection], a call SetSpriteFacingDirectionAndDelay ld a, TEXT_POKEMONTOWER2F_RIVAL - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID xor a ldh [hJoyHeld], a @@ -71,7 +71,7 @@ PokemonTower2FDefeatedRivalScript: ld [wJoyIgnore], a SetEvent EVENT_BEAT_POKEMON_TOWER_RIVAL ld a, TEXT_POKEMONTOWER2F_RIVAL - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ld de, PokemonTower2FRivalDownThenRightMovement CheckEvent EVENT_POKEMON_TOWER_RIVAL_ON_LEFT diff --git a/scripts/PokemonTower5F.asm b/scripts/PokemonTower5F.asm index 8e256b1ef..b35a2f0ab 100644 --- a/scripts/PokemonTower5F.asm +++ b/scripts/PokemonTower5F.asm @@ -36,7 +36,7 @@ PokemonTower5FDefaultScript: call Delay3 call GBFadeInFromWhite ld a, TEXT_POKEMONTOWER5F_PURIFIEDZONE - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID xor a ld [wJoyIgnore], a diff --git a/scripts/PokemonTower6F.asm b/scripts/PokemonTower6F.asm index 9e2f4118b..cf246c569 100644 --- a/scripts/PokemonTower6F.asm +++ b/scripts/PokemonTower6F.asm @@ -31,7 +31,7 @@ PokemonTower6FDefaultScript: xor a ldh [hJoyHeld], a ld a, TEXT_POKEMONTOWER6F_BEGONE - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ld a, RESTLESS_SOUL ld [wCurOpponent], a @@ -63,7 +63,7 @@ PokemonTower6FMarowakBattleScript: jr nz, .did_not_defeat SetEvent EVENT_BEAT_GHOST_MAROWAK ld a, TEXT_POKEMONTOWER6F_MAROWAK_DEPARTED - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID xor a ld [wJoyIgnore], a diff --git a/scripts/PokemonTower7F.asm b/scripts/PokemonTower7F.asm index be9aacd9b..41fba59cc 100644 --- a/scripts/PokemonTower7F.asm +++ b/scripts/PokemonTower7F.asm @@ -32,7 +32,7 @@ PokemonTower7FEndBattleScript: ld a, D_RIGHT | D_LEFT | D_UP | D_DOWN ld [wJoyIgnore], a ld a, [wSpriteIndex] - ldh [hSpriteIndexOrTextID], a + ldh [hSpriteIndex], a call DisplayTextID call PokemonTower7FRocketLeaveMovementScript ld a, SCRIPT_POKEMONTOWER7F_HIDE_NPC diff --git a/scripts/RocketHideoutB4F.asm b/scripts/RocketHideoutB4F.asm index 02ddcdd5c..920aa0898 100644 --- a/scripts/RocketHideoutB4F.asm +++ b/scripts/RocketHideoutB4F.asm @@ -53,7 +53,7 @@ RocketHideoutB4FBeatGiovanniScript: ld [wJoyIgnore], a SetEvent EVENT_BEAT_ROCKET_HIDEOUT_GIOVANNI ld a, TEXT_ROCKETHIDEOUTB4F_GIOVANNI_HOPE_WE_MEET_AGAIN - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID call GBFadeOutToBlack ld a, HS_ROCKET_HIDEOUT_B4F_GIOVANNI diff --git a/scripts/Route12.asm b/scripts/Route12.asm index 660b8a2d3..ea9fc567a 100644 --- a/scripts/Route12.asm +++ b/scripts/Route12.asm @@ -28,7 +28,7 @@ Route12DefaultScript: ResetEventReuseHL EVENT_FIGHT_ROUTE12_SNORLAX jp z, CheckFightingMapTrainers ld a, TEXT_ROUTE12_SNORLAX_WOKE_UP - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ld a, SNORLAX ld [wCurOpponent], a @@ -51,7 +51,7 @@ Route12SnorlaxPostBattleScript: cp $2 jr z, .caught_snorlax ld a, TEXT_ROUTE12_SNORLAX_CALMED_DOWN - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID .caught_snorlax SetEvent EVENT_BEAT_ROUTE12_SNORLAX diff --git a/scripts/Route16.asm b/scripts/Route16.asm index ec33adf17..6e3da97c2 100644 --- a/scripts/Route16.asm +++ b/scripts/Route16.asm @@ -28,7 +28,7 @@ Route16DefaultScript: ResetEventReuseHL EVENT_FIGHT_ROUTE16_SNORLAX jp z, CheckFightingMapTrainers ld a, TEXT_ROUTE16_SNORLAX_WOKE_UP - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ld a, SNORLAX ld [wCurOpponent], a @@ -52,7 +52,7 @@ Route16SnorlaxPostBattleScript: cp $2 jr z, .caught ld a, TEXT_ROUTE16_SNORLAX_RETURNED_TO_MOUNTAINS - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID .caught SetEvent EVENT_BEAT_ROUTE16_SNORLAX diff --git a/scripts/Route16Gate1F.asm b/scripts/Route16Gate1F.asm index d42a80d40..a8bf2f0fb 100644 --- a/scripts/Route16Gate1F.asm +++ b/scripts/Route16Gate1F.asm @@ -20,7 +20,7 @@ Route16Gate1FDefaultScript: call ArePlayerCoordsInArray ret nc ld a, TEXT_ROUTE16GATE1F_GUARD_WAIT_UP - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID xor a ldh [hJoyHeld], a @@ -60,7 +60,7 @@ Route16Gate1FPlayerMovingUpScript: Route16Gate1FGuardScript: ld a, TEXT_ROUTE16GATE1F_GUARD - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ld a, $1 ld [wSimulatedJoypadStatesIndex], a diff --git a/scripts/Route18Gate1F.asm b/scripts/Route18Gate1F.asm index 79d982d79..a2b4dcdf2 100644 --- a/scripts/Route18Gate1F.asm +++ b/scripts/Route18Gate1F.asm @@ -20,7 +20,7 @@ Route18Gate1FDefaultScript: call ArePlayerCoordsInArray ret nc ld a, TEXT_ROUTE18GATE1F_GUARD_EXCUSE_ME - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID xor a ldh [hJoyHeld], a @@ -60,7 +60,7 @@ Route18Gate1FPlayerMovingUpScript: Route18Gate1FGuardScript: ld a, TEXT_ROUTE18GATE1F_GUARD - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ld a, $1 ld [wSimulatedJoypadStatesIndex], a diff --git a/scripts/Route22.asm b/scripts/Route22.asm index ad02b4c79..1a2602fdd 100644 --- a/scripts/Route22.asm +++ b/scripts/Route22.asm @@ -124,7 +124,7 @@ Route22Rival1StartBattleScript: xor a ld [wJoyIgnore], a ld a, TEXT_ROUTE22_RIVAL1 - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ld hl, wStatusFlags3 set BIT_TALKED_TO_TRAINER, [hl] @@ -166,7 +166,7 @@ Route22Rival1AfterBattleScript: ld [wJoyIgnore], a SetEvent EVENT_BEAT_ROUTE22_RIVAL_1ST_BATTLE ld a, TEXT_ROUTE22_RIVAL1 - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ld a, SFX_STOP_ALL_MUSIC ld [wNewSoundID], a @@ -280,7 +280,7 @@ Route22Rival2StartBattleScript: xor a ld [wJoyIgnore], a ld a, TEXT_ROUTE22_RIVAL2 - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ld hl, wStatusFlags3 set BIT_TALKED_TO_TRAINER, [hl] @@ -325,7 +325,7 @@ Route22Rival2AfterBattleScript: ld [wJoyIgnore], a SetEvent EVENT_BEAT_ROUTE22_RIVAL_2ND_BATTLE ld a, TEXT_ROUTE22_RIVAL2 - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ld a, SFX_STOP_ALL_MUSIC ld [wNewSoundID], a diff --git a/scripts/Route22Gate.asm b/scripts/Route22Gate.asm index 9bca889df..d6160ad82 100644 --- a/scripts/Route22Gate.asm +++ b/scripts/Route22Gate.asm @@ -25,7 +25,7 @@ Route22GateDefaultScript: xor a ldh [hJoyHeld], a ld a, TEXT_ROUTE22GATE_GUARD - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a jp DisplayTextID Route22GateScriptCoords: diff --git a/scripts/Route23.asm b/scripts/Route23.asm index da0acfea0..ffd968dfa 100644 --- a/scripts/Route23.asm +++ b/scripts/Route23.asm @@ -46,7 +46,7 @@ Route23DefaultScript: ret nc .not_past_victory_road ld a, e - ldh [hSpriteIndexOrTextID], a + ldh [hSpriteIndex], a ld a, c ld [wWhichBadge], a ld b, FLAG_TEST diff --git a/scripts/Route24.asm b/scripts/Route24.asm index 6f8f02504..531851475 100644 --- a/scripts/Route24.asm +++ b/scripts/Route24.asm @@ -31,7 +31,7 @@ Route24DefaultScript: xor a ldh [hJoyHeld], a ld a, TEXT_ROUTE24_COOLTRAINER_M1 - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID CheckAndResetEvent EVENT_NUGGET_REWARD_AVAILABLE ret z @@ -68,7 +68,7 @@ Route24AfterRocketBattleScript: ld [wJoyIgnore], a SetEvent EVENT_BEAT_ROUTE24_ROCKET ld a, TEXT_ROUTE24_COOLTRAINER_M1 - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID xor a ld [wJoyIgnore], a @@ -125,7 +125,7 @@ Route24CooltrainerM1Text: ld hl, .DefeatedText ld de, .DefeatedText call SaveEndBattleTextPointers - ldh a, [hSpriteIndexOrTextID] + ldh a, [hSpriteIndex] ld [wSpriteIndex], a call EngageMapTrainer call InitBattleEnemyParameters diff --git a/scripts/Route5Gate.asm b/scripts/Route5Gate.asm index a0913c85f..0ccf9fae9 100644 --- a/scripts/Route5Gate.asm +++ b/scripts/Route5Gate.asm @@ -32,7 +32,7 @@ Route5GateDefaultScript: and a jr nz, .have_drink ld a, TEXT_ROUTE5GATE_GUARD_GEE_IM_THIRSTY - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID call Route5GateMovePlayerUpScript ld a, SCRIPT_ROUTE5GATE_PLAYER_MOVING @@ -40,7 +40,7 @@ Route5GateDefaultScript: ret .have_drink ld a, TEXT_ROUTE5GATE_GUARD_GIVE_DRINK - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ld hl, wStatusFlags1 set BIT_GAVE_SAFFRON_GUARDS_DRINK, [hl] diff --git a/scripts/Route6Gate.asm b/scripts/Route6Gate.asm index 7afba23ef..48228c7dd 100644 --- a/scripts/Route6Gate.asm +++ b/scripts/Route6Gate.asm @@ -26,7 +26,7 @@ Route6GateDefaultScript: and a jr nz, .have_drink ld a, TEXT_ROUTE6GATE_GUARD_GEE_IM_THIRSTY - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID call Route6GateMovePlayerDownScript ld a, SCRIPT_ROUTE6GATE_PLAYER_MOVING @@ -36,7 +36,7 @@ Route6GateDefaultScript: ld hl, wStatusFlags1 set BIT_GAVE_SAFFRON_GUARDS_DRINK, [hl] ld a, TEXT_ROUTE6GATE_GUARD_GIVE_DRINK - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a jp DisplayTextID .PlayerInCoordsArray: diff --git a/scripts/Route7Gate.asm b/scripts/Route7Gate.asm index 813fab214..e599e1476 100644 --- a/scripts/Route7Gate.asm +++ b/scripts/Route7Gate.asm @@ -38,7 +38,7 @@ Route7DefaultScript: and a jr nz, .have_drink ld a, TEXT_ROUTE7GATE_GUARD_GEE_IM_THIRSTY - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID call Route7GateMovePlayerLeftScript ld a, SCRIPT_ROUTE7GATE_PLAYER_MOVING @@ -46,7 +46,7 @@ Route7DefaultScript: ret .have_drink ld a, TEXT_ROUTE7GATE_GUARD_GIVE_DRINK - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ld hl, wStatusFlags1 set BIT_GAVE_SAFFRON_GUARDS_DRINK, [hl] diff --git a/scripts/Route8Gate.asm b/scripts/Route8Gate.asm index 51dd6f1af..44e94a0c8 100644 --- a/scripts/Route8Gate.asm +++ b/scripts/Route8Gate.asm @@ -37,7 +37,7 @@ Route8GateDefaultScript: and a jr nz, .have_drink ld a, TEXT_ROUTE8GATE_GUARD_GEE_IM_THIRSTY - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID call Route8GateMovePlayerRightScript ld a, SCRIPT_ROUTE8GATE_PLAYER_MOVING @@ -47,7 +47,7 @@ Route8GateDefaultScript: ld hl, wStatusFlags1 set BIT_GAVE_SAFFRON_GUARDS_DRINK, [hl] ld a, TEXT_ROUTE8GATE_GUARD_GIVE_DRINK - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a jp DisplayTextID .PlayerInCoordsArray: diff --git a/scripts/SSAnne2F.asm b/scripts/SSAnne2F.asm index 1c7c6b5b7..5bd5589d4 100644 --- a/scripts/SSAnne2F.asm +++ b/scripts/SSAnne2F.asm @@ -94,7 +94,7 @@ SSAnne2FRivalStartBattleScript: xor a ld [wJoyIgnore], a ld a, TEXT_SSANNE2F_RIVAL - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID call Delay3 ld a, OPP_RIVAL2 @@ -129,7 +129,7 @@ SSAnne2FRivalAfterBattleScript: ld a, D_RIGHT | D_LEFT | D_UP | D_DOWN ld [wJoyIgnore], a ld a, TEXT_SSANNE2F_RIVAL_CUT_MASTER - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ld a, SSANNE2F_RIVAL ldh [hSpriteIndex], a diff --git a/scripts/SafariZoneGate.asm b/scripts/SafariZoneGate.asm index 14a8a79b7..74a7baa1d 100644 --- a/scripts/SafariZoneGate.asm +++ b/scripts/SafariZoneGate.asm @@ -20,7 +20,7 @@ SafariZoneGateDefaultScript: call ArePlayerCoordsInArray ret nc ld a, TEXT_SAFARIZONEGATE_SAFARI_ZONE_WORKER1_1 - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ld a, A_BUTTON | B_BUTTON | SELECT | START | D_RIGHT | D_LEFT | D_UP | D_DOWN ld [wJoyIgnore], a @@ -58,7 +58,7 @@ SafariZoneGateWouldYouLikeToJoinScript: ld [wJoyIgnore], a call UpdateSprites ld a, TEXT_SAFARIZONEGATE_SAFARI_ZONE_WORKER1_WOULD_YOU_LIKE_TO_JOIN - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ld a, A_BUTTON | B_BUTTON | SELECT | START | D_RIGHT | D_LEFT | D_UP | D_DOWN ld [wJoyIgnore], a @@ -83,7 +83,7 @@ SafariZoneGateLeavingSafariScript: ld a, D_RIGHT | D_LEFT | D_UP | D_DOWN ld [wJoyIgnore], a ld a, TEXT_SAFARIZONEGATE_SAFARI_ZONE_WORKER1_GOOD_HAUL_COME_AGAIN - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID xor a ld [wNumSafariBalls], a @@ -95,7 +95,7 @@ SafariZoneGateLeavingSafariScript: jr .return .leaving_early ld a, TEXT_SAFARIZONEGATE_SAFARI_ZONE_WORKER1_LEAVING_EARLY - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID .return ret diff --git a/scripts/SaffronGym.asm b/scripts/SaffronGym.asm index 2de1081b4..556cd4c57 100644 --- a/scripts/SaffronGym.asm +++ b/scripts/SaffronGym.asm @@ -45,20 +45,20 @@ SaffronGymSabrinaPostBattle: SaffronGymSabrinaReceiveTM46Script: ld a, TEXT_SAFFRONGYM_SABRINA_MARSH_BADGE_INFO - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID SetEvent EVENT_BEAT_SABRINA lb bc, TM_PSYWAVE, 1 call GiveItem jr nc, .BagFull ld a, TEXT_SAFFRONGYM_SABRINA_RECEIVED_TM46 - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID SetEvent EVENT_GOT_TM46 jr .gymVictory .BagFull ld a, TEXT_SAFFRONGYM_SABRINA_TM46_NO_ROOM - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID .gymVictory ld hl, wObtainedBadges diff --git a/scripts/SilphCo11F.asm b/scripts/SilphCo11F.asm index 9caf2a70b..d5e4cb08d 100644 --- a/scripts/SilphCo11F.asm +++ b/scripts/SilphCo11F.asm @@ -176,7 +176,7 @@ SilphCo11FDefaultScript: ld a, D_RIGHT | D_LEFT | D_UP | D_DOWN ld [wJoyIgnore], a ld a, TEXT_SILPHCO11F_GIOVANNI - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ld a, SILPHCO11F_GIOVANNI ldh [hSpriteIndex], a @@ -223,7 +223,7 @@ SilphCo11FGiovanniAfterBattleScript: ld a, D_RIGHT | D_LEFT | D_UP | D_DOWN ld [wJoyIgnore], a ld a, TEXT_SILPHCO11F_GIOVANNI_YOU_RUINED_OUR_PLANS - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID call GBFadeOutToBlack call SilphCo11FTeamRocketLeavesScript diff --git a/scripts/SilphCo7F.asm b/scripts/SilphCo7F.asm index de9e689db..381eff7a3 100644 --- a/scripts/SilphCo7F.asm +++ b/scripts/SilphCo7F.asm @@ -138,7 +138,7 @@ SilphCo7FDefaultScript: ld a, MUSIC_MEET_RIVAL call PlayMusic ld a, TEXT_SILPHCO7F_RIVAL - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ld a, SILPHCO7F_RIVAL ldh [hSpriteIndex], a @@ -175,7 +175,7 @@ SilphCo7FRivalStartBattleScript: xor a ld [wJoyIgnore], a ld a, TEXT_SILPHCO7F_RIVAL_WAITED_HERE - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID call Delay3 ld hl, wStatusFlags3 @@ -218,7 +218,7 @@ SilphCo7FRivalAfterBattleScript: ldh [hSpriteFacingDirection], a call SetSpriteFacingDirectionAndDelay ld a, TEXT_SILPHCO7F_RIVAL_GOOD_LUCK_TO_YOU - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ld a, SFX_STOP_ALL_MUSIC ld [wNewSoundID], a diff --git a/scripts/VermilionCity.asm b/scripts/VermilionCity.asm index 9d8002334..fd5905df3 100644 --- a/scripts/VermilionCity.asm +++ b/scripts/VermilionCity.asm @@ -49,7 +49,7 @@ VermilionCityDefaultScript: ldh [hJoyHeld], a ld [wSavedCoordIndex], a ; unnecessary ld a, TEXT_VERMILIONCITY_SAILOR1 - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID CheckEvent EVENT_SS_ANNE_LEFT jr nz, .ship_departed diff --git a/scripts/VermilionGym.asm b/scripts/VermilionGym.asm index 194fce94c..d7828e429 100644 --- a/scripts/VermilionGym.asm +++ b/scripts/VermilionGym.asm @@ -64,20 +64,20 @@ VermilionGymLTSurgeAfterBattleScript: VermilionGymLTSurgeReceiveTM24Script: ld a, TEXT_VERMILIONGYM_LT_SURGE_THUNDER_BADGE_INFO - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID SetEvent EVENT_BEAT_LT_SURGE lb bc, TM_THUNDERBOLT, 1 call GiveItem jr nc, .bag_full ld a, TEXT_VERMILIONGYM_LT_SURGE_RECEIVED_TM24 - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID SetEvent EVENT_GOT_TM24 jr .gym_victory .bag_full ld a, TEXT_VERMILIONGYM_LT_SURGE_TM24_NO_ROOM - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID .gym_victory ld hl, wObtainedBadges diff --git a/scripts/ViridianCity.asm b/scripts/ViridianCity.asm index 0059bc600..473b7ee55 100644 --- a/scripts/ViridianCity.asm +++ b/scripts/ViridianCity.asm @@ -31,7 +31,7 @@ ViridianCityCheckGymOpenScript: cp 32 ret nz ld a, TEXT_VIRIDIANCITY_GYM_LOCKED - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID xor a ldh [hJoyHeld], a @@ -50,7 +50,7 @@ ViridianCityCheckGotPokedexScript: cp 19 ret nz ld a, TEXT_VIRIDIANCITY_OLD_MAN_SLEEPY - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID xor a ldh [hJoyHeld], a @@ -96,7 +96,7 @@ ViridianCityOldManEndCatchTrainingScript: xor a ld [wJoyIgnore], a ld a, TEXT_VIRIDIANCITY_OLD_MAN_YOU_NEED_TO_WEAKEN_THE_TARGET - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID xor a ld [wBattleType], a diff --git a/scripts/ViridianGym.asm b/scripts/ViridianGym.asm index a6f27bdff..55d849d27 100644 --- a/scripts/ViridianGym.asm +++ b/scripts/ViridianGym.asm @@ -137,20 +137,20 @@ ViridianGymGiovanniPostBattle: ; fallthrough ViridianGymReceiveTM27: ld a, TEXT_VIRIDIANGYM_GIOVANNI_EARTH_BADGE_INFO - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID SetEvent EVENT_BEAT_VIRIDIAN_GYM_GIOVANNI lb bc, TM_FISSURE, 1 call GiveItem jr nc, .bag_full ld a, TEXT_VIRIDIANGYM_GIOVANNI_RECEIVED_TM27 - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID SetEvent EVENT_GOT_TM27 jr .gym_victory .bag_full ld a, TEXT_VIRIDIANGYM_GIOVANNI_TM27_NO_ROOM - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID .gym_victory ld hl, wObtainedBadges diff --git a/scripts/ViridianMart.asm b/scripts/ViridianMart.asm index 8f91afd6d..f54f3c26b 100644 --- a/scripts/ViridianMart.asm +++ b/scripts/ViridianMart.asm @@ -28,7 +28,7 @@ ViridianMart_ScriptPointers: ViridianMartDefaultScript: call UpdateSprites ld a, TEXT_VIRIDIANMART_CLERK_YOU_CAME_FROM_PALLET_TOWN - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID ld hl, wSimulatedJoypadStatesEnd ld de, .PlayerMovement @@ -51,7 +51,7 @@ ViridianMartOaksParcelScript: ret nz call Delay3 ld a, TEXT_VIRIDIANMART_CLERK_PARCEL_QUEST - ldh [hSpriteIndexOrTextID], a + ldh [hTextID], a call DisplayTextID lb bc, OAKS_PARCEL, 1 call GiveItem diff --git a/scripts/WardensHouse.asm b/scripts/WardensHouse.asm index 1851e341a..aa6be6ca4 100644 --- a/scripts/WardensHouse.asm +++ b/scripts/WardensHouse.asm @@ -95,7 +95,7 @@ WardensHouseWardenText: WardensHouseDisplayText: text_asm - ldh a, [hSpriteIndexOrTextID] + ldh a, [hTextID] cp TEXT_WARDENSHOUSE_DISPLAY_LEFT ld hl, .MerchandiseText jr nz, .print_text 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: [PATCH 12/19] 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 +- .../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(-) diff --git a/engine/battle/animations.asm b/engine/battle/animations.asm index 31851a91a..3e077d2b7 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 01faa890b..428bc78a0 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 643afeb2c..6fba347f2 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 798d7ce14..57d37f019 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 beed3291c..a0e869fce 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 1fa84e15d..66675dbfd 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 56dda7f49..6f2e705ca 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 7da0dc8c6..e7c6729c1 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 a61f402fd..ca3ff8a24 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 e21a3492c..5eed1ae58 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 171fa99a3..d8066fb8e 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 68d48bb39..46b45d771 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 9472f49f6..9e80bdfca 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 0c6ec1ea6..8bf162a75 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 97bb0b71a..e42f60f9a 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 e996e471c..df74293f9 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 d35756890..ce4ffe3c4 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 121bdc19a..752899f72 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 10b6dba26..b280c7117 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 f99cdaaa2..816637bfc 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 53fabc6d5..e7016a1da 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 f59b37eab..47af5c296 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 df050b031..914624788 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 f3c6db98c..2da15fabf 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 4ade66e3f..cbb8a358c 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 849c6e037..17d58c55c 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 25d69ca93..33556e263 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 f746c8095..7710815bf 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 5417e3e02..7b0455d05 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 a9b6efbd9..bdd66e8ed 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 d7a478859..69463bfab 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 2344dce3e..a43ec5dac 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 ded8a7c3a..44b236c88 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 b515a9849..3c7ca27db 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 a7ccb6b8b..14a53a248 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 a564862bb..d4a4b6353 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 ab167a24e..7eaca222b 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 aae6cb876..268e522ab 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 427d2a7f3..d651321a3 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 981fe13ae..2df9964ef 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 3d0548e0b..7a39f0837 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 e9235f13c..2cf8f14c7 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 4ae4327a6..8d377f797 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 8ede4ea46..9f51450a3 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 ca369a82c..f04684a3f 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 01dd8b6ad..342139dd6 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 2e5e1501a..7330a065c 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 cd3823fd0..3bb6980c1 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 9fcf56224..54d69bba0 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 a4d757074..48616226c 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 b5960c812..d06fc4a26 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 efa666801..468141383 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 4a2ff51fa..e59281449 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 e89e0ee8c..89d6ef80f 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 9c223c871..bc1e2e902 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 ad1434dca..831b66e66 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 8522a1493..795b210ec 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 From 21cfdbd4588eb44e7c12ce8beb5096fe39833ff2 Mon Sep 17 00:00:00 2001 From: Rangi42 Date: Wed, 18 Sep 2024 21:49:35 -0400 Subject: [PATCH 13/19] Remove the Discord webhook and tools/unnamed.py Everything is named, unnamed.py reports 100.00% complete --- .github/webhook.sh | 13 ---- .github/workflows/main.yml | 7 -- tools/unnamed.py | 137 ------------------------------------- 3 files changed, 157 deletions(-) delete mode 100755 .github/webhook.sh delete mode 100755 tools/unnamed.py diff --git a/.github/webhook.sh b/.github/webhook.sh deleted file mode 100755 index 2ba63dbbf..000000000 --- a/.github/webhook.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh -set -e - -# Report unnamed symbols -content="$(tools/unnamed.py -r . -l 30 pokered.sym | head)" - -curl -H 'Content-Type: application/json' -X POST "$DISCORD_WEBHOOK_URL" -d@- << EOF -{ - "username": "OK", - "avatar_url": "https://i.imgur.com/38BQHdd.png", - "content": "\`\`\`$(echo "$content" | sed -E ':a;N;$!ba;s/\r{0,1}\n/\\n/g')\`\`\`" -} -EOF diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0a0da0f3f..7ac61def6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -48,13 +48,6 @@ jobs: return 1 fi - - name: Discord webhook - if: ${{ github.event_name == 'push' && github.repository_owner == 'pret' }} - env: - DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }} - run: | - .github/webhook.sh - - name: Checkout symbols if: ${{ github.event_name == 'push' && github.repository_owner == 'pret' }} uses: actions/checkout@master diff --git a/tools/unnamed.py b/tools/unnamed.py deleted file mode 100755 index f3081e976..000000000 --- a/tools/unnamed.py +++ /dev/null @@ -1,137 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -""" -Usage: unnamed.py [-h] [-r rootdir] [-l count] pokered.sym - -Parse the symfile to find unnamed symbols. -""" - -import sys -import argparse -import subprocess -import struct -import enum -import signal - -class symtype(enum.Enum): - LOCAL = 0 - IMPORT = 1 - EXPORT = 2 - -def unpack_from(fmt, file): - size = struct.calcsize(fmt) - return struct.unpack(fmt, file.read(size)) - -def read_string(file): - buf = bytearray() - while True: - b = file.read(1) - if b is None or b == b'\0': - return buf.decode() - buf += b - -# Fix broken pipe when using `head` -signal.signal(signal.SIGPIPE, signal.SIG_DFL) - -parser = argparse.ArgumentParser(description='Parse the symfile to find unnamed symbols') -parser.add_argument('symfile', type=argparse.FileType('r'), - help='the list of symbols') -parser.add_argument('-r', '--rootdir', type=str, - help='scan the output files to obtain a list of files with unnamed symbols (note: will rebuild objects as necessary)') -parser.add_argument('-l', '--list', type=int, default=0, - help="output this many of each file's unnamed symbols (note: requires -r)") -args = parser.parse_args() - -# Get list of object files -objects = None -if args.rootdir: - for line in subprocess.Popen(['make', '-C', args.rootdir, '-s', '-p', 'DEBUG=1'], - stdout=subprocess.PIPE).stdout.read().decode().split('\n'): - if line.startswith('pokered_obj :='): - objects = line[len('pokered_obj :='):].strip().split() - break - else: - print('Error: Object files not found!', file=sys.stderr) - sys.exit(1) - -# Scan all unnamed symbols from the symfile -symbols_total = 0 -symbols = set() -for line in args.symfile: - line = line.split(';')[0].strip() - split = line.split(' ') - if len(split) < 2: - continue - - symbols_total += 1 - - symbol = ' '.join(split[1:]).strip() - if symbol[-3:].lower() == split[0][-3:].lower(): - symbols.add(symbol) - -# If no object files were provided, just print what we know and exit -unnamed_percent = 100 * (symbols_total - len(symbols)) / symbols_total -print(f'Unnamed pokered symbols: {len(symbols)} ({unnamed_percent:.2f}% complete)') -if not objects: - for sym in symbols: - print(sym) - sys.exit() - -# Count the amount of symbols in each file -file_symbols = {} -for objfile in objects: - with open(objfile, 'rb') as file: - obj_ver = None - - magic = unpack_from('4s', file)[0] - if magic == b'RGB6': - obj_ver = 6 - elif magic == b'RGB9': - obj_ver = 10 + unpack_from(' Date: Mon, 23 Sep 2024 23:51:44 -0400 Subject: [PATCH 14/19] Identify more flag bits (#464) --- audio/engine_1.asm | 10 +++--- audio/engine_2.asm | 16 ++++----- audio/engine_3.asm | 10 +++--- audio/low_health_alarm.asm | 14 ++++---- constants/audio_constants.asm | 8 +++++ constants/battle_constants.asm | 4 +++ constants/gfx_constants.asm | 6 ++++ constants/map_object_constants.asm | 11 ++++-- constants/menu_constants.asm | 3 ++ constants/oam_constants.asm | 24 ++++++++----- constants/ram_constants.asm | 30 ++++++++++++++++ data/sprites/facings.asm | 8 ++--- engine/battle/animations.asm | 6 ++-- engine/battle/battle_transitions.asm | 20 +++++++---- engine/battle/core.asm | 34 +++++++++---------- engine/battle/effects.asm | 2 +- engine/battle/experience.asm | 2 +- engine/battle/trainer_ai.asm | 8 ++--- .../events/hidden_objects/pokecenter_pc.asm | 2 +- engine/events/poison.asm | 2 +- engine/gfx/hp_bar.asm | 2 +- engine/gfx/sprite_oam.asm | 4 +-- engine/items/item_effects.asm | 10 +++--- engine/items/town_map.asm | 10 +++--- engine/link/cable_club.asm | 14 ++++---- engine/menus/display_text_id_init.asm | 4 +-- engine/menus/league_pc.asm | 4 +-- engine/menus/party_menu.asm | 4 +-- engine/menus/players_pc.asm | 2 +- engine/menus/save.asm | 14 ++++---- engine/menus/text_box.asm | 4 +-- engine/overworld/map_sprites.asm | 6 ++-- engine/overworld/movement.asm | 8 ++--- engine/overworld/pathfinding.asm | 26 +++++++------- engine/overworld/push_boulder.asm | 2 +- engine/overworld/special_warps.asm | 2 +- engine/pokemon/learn_move.asm | 8 ++--- engine/pokemon/status_screen.asm | 2 +- engine/slots/slot_machine.asm | 27 ++++++++------- home/map_objects.asm | 2 +- home/overworld.asm | 20 +++++------ home/predef_text.asm | 2 +- home/print_bcd.asm | 28 +++++++-------- home/reload_sprites.asm | 2 +- home/text.asm | 2 +- home/text_script.asm | 6 ++-- home/window.asm | 14 ++++---- ram/hram.asm | 1 + scripts/CeruleanBadgeHouse.asm | 2 +- scripts/Museum1F.asm | 2 +- scripts/OaksLab.asm | 2 +- scripts/PewterMart.asm | 2 +- scripts/SSAnne2FRooms.asm | 2 +- 53 files changed, 267 insertions(+), 193 deletions(-) diff --git a/audio/engine_1.asm b/audio/engine_1.asm index 99d47f37d..e9642b326 100644 --- a/audio/engine_1.asm +++ b/audio/engine_1.asm @@ -15,9 +15,9 @@ Audio1_UpdateMusic:: ld a, [wMuteAudioAndPauseMusic] and a jr z, .applyAffects - bit 7, a + bit BIT_MUTE_AUDIO, a jr nz, .nextChannel - set 7, a + set BIT_MUTE_AUDIO, a ld [wMuteAudioAndPauseMusic], a xor a ; disable all channels' output ldh [rNR51], a @@ -197,7 +197,7 @@ Audio1_sound_ret: .dontDisable jr .afterDisable .returnFromCall - res 1, [hl] + res BIT_SOUND_CALL, [hl] ld d, $0 ld a, c add a @@ -377,8 +377,8 @@ Audio1_toggle_perfect_pitch: ld hl, wChannelFlags1 add hl, bc ld a, [hl] - xor $1 - ld [hl], a ; flip bit 0 of wChannelFlags1 + xor 1 << BIT_PERFECT_PITCH + ld [hl], a jp Audio1_sound_ret Audio1_vibrato: diff --git a/audio/engine_2.asm b/audio/engine_2.asm index bcaab6946..2f11c0273 100644 --- a/audio/engine_2.asm +++ b/audio/engine_2.asm @@ -17,9 +17,9 @@ Audio2_UpdateMusic:: ld a, [wMuteAudioAndPauseMusic] and a jr z, .applyAffects - bit 7, a + bit BIT_MUTE_AUDIO, a jr nz, .nextChannel - set 7, a + set BIT_MUTE_AUDIO, a ld [wMuteAudioAndPauseMusic], a xor a ; disable all channels' output ldh [rNR51], a @@ -163,8 +163,8 @@ Audio2_PlayNextNote: ld a, c cp CHAN5 jr nz, .beginChecks - ld a, [wLowHealthAlarm] ; low health alarm enabled? - bit 7, a + ld a, [wLowHealthAlarm] + bit BIT_LOW_HEALTH_ALARM, a ret nz .beginChecks ; --- @@ -208,7 +208,7 @@ Audio2_sound_ret: .dontDisable jr .afterDisable .returnFromCall - res 1, [hl] + res BIT_SOUND_CALL, [hl] ld d, $0 ld a, c add a @@ -388,8 +388,8 @@ Audio2_toggle_perfect_pitch: ld hl, wChannelFlags1 add hl, bc ld a, [hl] - xor $1 - ld [hl], a ; flip bit 0 of wChannelFlags1 + xor 1 << BIT_PERFECT_PITCH + ld [hl], a jp Audio2_sound_ret Audio2_vibrato: @@ -978,7 +978,7 @@ Audio2_ResetCryModifiers: cp CHAN5 jr nz, .skip ld a, [wLowHealthAlarm] - bit 7, a + bit BIT_LOW_HEALTH_ALARM, a jr z, .skip xor a ld [wFrequencyModifier], a diff --git a/audio/engine_3.asm b/audio/engine_3.asm index e5d285a30..f524875f7 100644 --- a/audio/engine_3.asm +++ b/audio/engine_3.asm @@ -15,9 +15,9 @@ Audio3_UpdateMusic:: ld a, [wMuteAudioAndPauseMusic] and a jr z, .applyAffects - bit 7, a + bit BIT_MUTE_AUDIO, a jr nz, .nextChannel - set 7, a + set BIT_MUTE_AUDIO, a ld [wMuteAudioAndPauseMusic], a xor a ; disable all channels' output ldh [rNR51], a @@ -197,7 +197,7 @@ Audio3_sound_ret: .dontDisable jr .afterDisable .returnFromCall - res 1, [hl] + res BIT_SOUND_CALL, [hl] ld d, $0 ld a, c add a @@ -377,8 +377,8 @@ Audio3_toggle_perfect_pitch: ld hl, wChannelFlags1 add hl, bc ld a, [hl] - xor $1 - ld [hl], a ; flip bit 0 of wChannelFlags1 + xor 1 << BIT_PERFECT_PITCH + ld [hl], a jp Audio3_sound_ret Audio3_vibrato: diff --git a/audio/low_health_alarm.asm b/audio/low_health_alarm.asm index 35fe18158..728f5f656 100644 --- a/audio/low_health_alarm.asm +++ b/audio/low_health_alarm.asm @@ -1,12 +1,12 @@ Music_DoLowHealthAlarm:: ld a, [wLowHealthAlarm] - cp $ff + cp DISABLE_LOW_HEALTH_ALARM jr z, .disableAlarm - bit 7, a ;alarm enabled? - ret z ;nope + bit BIT_LOW_HEALTH_ALARM, a + ret z - and $7f ;low 7 bits are the timer. + and LOW_HEALTH_TIMER_MASK jr nz, .notToneHi ;if timer > 0, play low tone. call .playToneHi @@ -19,15 +19,15 @@ Music_DoLowHealthAlarm:: call .playToneLo ;actually set the sound registers. .noTone - ld a, $86 + ld a, CRY_SFX_END ld [wChannelSoundIDs + CHAN5], a ;disable sound channel? ld a, [wLowHealthAlarm] - and $7f ;decrement alarm timer. + and LOW_HEALTH_TIMER_MASK dec a .resetTimer ; reset the timer and enable flag. - set 7, a + set BIT_LOW_HEALTH_ALARM, a ld [wLowHealthAlarm], a ret diff --git a/constants/audio_constants.asm b/constants/audio_constants.asm index a89030526..99b899d1e 100644 --- a/constants/audio_constants.asm +++ b/constants/audio_constants.asm @@ -66,3 +66,11 @@ DEF HW_CH4_DISABLE_MASK EQU (~HW_CH4_ENABLE_MASK & $ff) ; wChannelFlags2 constant (only has one flag) DEF BIT_EXECUTE_MUSIC EQU 0 ; if in execute music + +; wMuteAudioAndPauseMusic +DEF BIT_MUTE_AUDIO EQU 7 + +; wLowHealthAlarm +DEF BIT_LOW_HEALTH_ALARM EQU 7 +DEF LOW_HEALTH_TIMER_MASK EQU %01111111 +DEF DISABLE_LOW_HEALTH_ALARM EQU $ff diff --git a/constants/battle_constants.asm b/constants/battle_constants.asm index 9349bb75c..cde50b4d6 100644 --- a/constants/battle_constants.asm +++ b/constants/battle_constants.asm @@ -72,6 +72,10 @@ DEF MAX_STAT_VALUE EQU 999 DEF ATKDEFDV_TRAINER EQU $98 DEF SPDSPCDV_TRAINER EQU $88 +; wDamageMultipliers +DEF BIT_STAB_DAMAGE EQU 7 +DEF EFFECTIVENESS_MASK EQU %01111111 + ; wPlayerBattleStatus1 or wEnemyBattleStatus1 bit flags const_def const STORING_ENERGY ; 0 ; Bide diff --git a/constants/gfx_constants.asm b/constants/gfx_constants.asm index c62682088..79d9647fc 100644 --- a/constants/gfx_constants.asm +++ b/constants/gfx_constants.asm @@ -29,6 +29,12 @@ DEF TRANSFERBOTTOM EQU 2 DEF REDRAW_COL EQU 1 DEF REDRAW_ROW EQU 2 +; hUILayoutFlags + const_def + const BIT_PARTY_MENU_HP_BAR ; 0 + const BIT_DOUBLE_SPACED_MENU ; 1 + const BIT_SINGLE_SPACED_LINES ; 2 + ; tile list ids ; TileIDListPointerTable indexes (see data/tilemaps.asm) const_def diff --git a/constants/map_object_constants.asm b/constants/map_object_constants.asm index 377edcea5..3b17c6ae6 100644 --- a/constants/map_object_constants.asm +++ b/constants/map_object_constants.asm @@ -40,9 +40,16 @@ DEF SPRITESTATEDATA2_LENGTH EQU const_value DEF NUM_SPRITESTATEDATA_STRUCTS EQU 16 + const_def 6 + const BIT_TRAINER ; 6 + const BIT_ITEM ; 7 + ; different kinds of people events -DEF ITEM EQU $80 -DEF TRAINER EQU $40 +DEF TRAINER EQU 1 << BIT_TRAINER +DEF ITEM EQU 1 << BIT_ITEM + +; movement status +DEF BIT_FACE_PLAYER EQU 7 DEF WALK EQU $FE DEF STAY EQU $FF diff --git a/constants/menu_constants.asm b/constants/menu_constants.asm index f1f0d4175..a6e035e70 100644 --- a/constants/menu_constants.asm +++ b/constants/menu_constants.asm @@ -44,6 +44,9 @@ DEF PC_ITEM_CAPACITY EQU 50 const NO_YES_MENU ; 7 DEF NUM_TWO_OPTION_MENUS EQU const_value +; wTwoOptionMenuID +DEF BIT_SECOND_MENU_OPTION_DEFAULT EQU 7 + ; menu exit method constants for list menus and the buy/sell/quit menu DEF CHOSE_MENU_ITEM EQU 1 ; pressed A DEF CANCELLED_MENU EQU 2 ; pressed B diff --git a/constants/oam_constants.asm b/constants/oam_constants.asm index 8c5e6be88..e87e54a00 100644 --- a/constants/oam_constants.asm +++ b/constants/oam_constants.asm @@ -1,14 +1,20 @@ -; OAM flags used by this game -DEF OAMFLAG_ENDOFDATA EQU %00000001 ; pseudo OAM flag, only used by game logic -DEF OAMFLAG_CANBEMASKED EQU %00000010 ; pseudo OAM flag, only used by game logic +; Pseudo-OAM flags used by game logic + const_def + const BIT_END_OF_OAM_DATA ; 0 + const BIT_SPRITE_UNDER_GRASS ; 1 + +; Used in SpriteFacingAndAnimationTable (see data/sprites/facings.asm) +DEF FACING_END EQU 1 << BIT_END_OF_OAM_DATA +DEF UNDER_GRASS EQU 1 << BIT_SPRITE_UNDER_GRASS ; OAM attribute flags -DEF OAM_PALETTE EQU %111 -DEF OAM_TILE_BANK EQU 3 -DEF OAM_OBP_NUM EQU 4 ; Non CGB Mode Only -DEF OAM_X_FLIP EQU 5 -DEF OAM_Y_FLIP EQU 6 -DEF OAM_PRIORITY EQU 7 ; 0: OBJ above BG, 1: OBJ behind BG (colors 1-3) +DEF OAM_PALETTE EQU %111 + const_def 3 + const OAM_TILE_BANK ; 3 + const OAM_OBP_NUM ; 4 ; Non CGB Mode Only + const OAM_X_FLIP ; 5 + const OAM_Y_FLIP ; 6 + const OAM_PRIORITY ; 7 ; 0: OBJ above BG, 1: OBJ behind BG (colors 1-3) ; OAM attribute masks DEF OAM_OBP1 EQU 1 << OAM_OBP_NUM ; OBJ palette 1 diff --git a/constants/ram_constants.asm b/constants/ram_constants.asm index 42956cc68..8102cc7e5 100644 --- a/constants/ram_constants.asm +++ b/constants/ram_constants.asm @@ -1,3 +1,8 @@ +; wSlotMachineFlags + const_def 6 + const BIT_SLOTS_CAN_WIN ; 6 + const BIT_SLOTS_CAN_WIN_WITH_7_OR_BAR ; 7 + ; wMiscFlags const_def const BIT_SEEN_BY_TRAINER ; 0 @@ -9,6 +14,15 @@ const BIT_TRIED_PUSH_BOULDER ; 6 const BIT_PUSHED_BOULDER ; 7 +; wAutoTextBoxDrawingControl +DEF BIT_NO_AUTO_TEXT_BOX EQU 0 + +; wTextPredefFlag +DEF BIT_TEXT_PREDEF EQU 0 + +; wFontLoaded +DEF BIT_FONT_LOADED EQU 0 + ; wOptions DEF TEXT_DELAY_MASK EQU %111 const_def 6 @@ -24,6 +38,12 @@ DEF TEXT_DELAY_SLOW EQU %101 ; 5 const BIT_FAST_TEXT_DELAY ; 0 const BIT_TEXT_DELAY ; 1 +; wCurMapTileset +DEF BIT_NO_PREVIOUS_MAP EQU 7 + +; wCurrentBoxNum +DEF BIT_HAS_CHANGED_BOXES EQU 7 + ; wObtainedBadges, wBeatGymFlags const_def const BIT_BOULDERBADGE ; 0 @@ -117,3 +137,13 @@ DEF NUM_BADGES EQU const_value const_skip 3 ; 3-5 ; unused const BIT_LEDGE_OR_FISHING ; 6 const BIT_SPINNING ; 7 + +; hFindPathFlags + const_def + const BIT_PATH_FOUND_Y ; 0 + const BIT_PATH_FOUND_X ; 1 + +; hNPCPlayerRelativePosFlags + const_def + const BIT_PLAYER_LOWER_Y ; 0 + const BIT_PLAYER_LOWER_X ; 1 diff --git a/data/sprites/facings.asm b/data/sprites/facings.asm index eb583d53d..54fd7ed08 100644 --- a/data/sprites/facings.asm +++ b/data/sprites/facings.asm @@ -48,12 +48,12 @@ SpriteFacingAndAnimationTable: ; y, x, attributes db 0, 0, $00 ; top left db 0, 8, $00 ; top right - db 8, 0, OAMFLAG_CANBEMASKED ; bottom left - db 8, 8, OAMFLAG_CANBEMASKED | OAMFLAG_ENDOFDATA ; bottom right + db 8, 0, UNDER_GRASS ; bottom left + db 8, 8, UNDER_GRASS | FACING_END ; bottom right .FlippedOAM: ; y, x, attributes db 0, 8, OAM_HFLIP ; top left db 0, 0, OAM_HFLIP ; top right - db 8, 8, OAM_HFLIP | OAMFLAG_CANBEMASKED ; bottom left - db 8, 0, OAM_HFLIP | OAMFLAG_CANBEMASKED | OAMFLAG_ENDOFDATA ; bottom right + db 8, 8, OAM_HFLIP | UNDER_GRASS ; bottom left + db 8, 0, OAM_HFLIP | UNDER_GRASS | FACING_END ; bottom right diff --git a/engine/battle/animations.asm b/engine/battle/animations.asm index 3e077d2b7..3ccbf7c42 100644 --- a/engine/battle/animations.asm +++ b/engine/battle/animations.asm @@ -114,13 +114,13 @@ DrawFrameBlock: ld [de], a ; store tile ID inc de ld a, [hli] - bit 5, a ; is horizontal flip enabled? + bit OAM_X_FLIP, a jr nz, .disableHorizontalFlip .enableHorizontalFlip - set 5, a + set OAM_X_FLIP, a jr .storeFlags2 .disableHorizontalFlip - res 5, a + res OAM_X_FLIP, a .storeFlags2 ld [de], a inc de diff --git a/engine/battle/battle_transitions.asm b/engine/battle/battle_transitions.asm index 5956d875b..85d2177ee 100644 --- a/engine/battle/battle_transitions.asm +++ b/engine/battle/battle_transitions.asm @@ -64,6 +64,12 @@ BattleTransition: ld l, a jp hl + const_def + const BIT_TRAINER_BATTLE_TRANSITION ; 0 + const BIT_STRONGER_BATTLE_TRANSITION ; 1 + const BIT_DUNGEON_BATTLE_TRANSITION ; 2 +DEF NUM_BATTLE_TRANSITION_BITS EQU const_value + ; the three GetBattleTransitionID functions set the first ; three bits of c, which determines what transition animation ; to play at the beginning of a battle @@ -71,6 +77,7 @@ BattleTransition: ; bit 1: set if enemy is at least 3 levels higher than player ; bit 2: set if dungeon map BattleTransitions: + table_width 2, BattleTransitions dw BattleTransition_DoubleCircle ; %000 dw BattleTransition_Spiral ; %001 dw BattleTransition_Circle ; %010 @@ -79,15 +86,16 @@ BattleTransitions: dw BattleTransition_Shrink ; %101 dw BattleTransition_VerticalStripes ; %110 dw BattleTransition_Split ; %111 + assert_table_length 1 << NUM_BATTLE_TRANSITION_BITS GetBattleTransitionID_WildOrTrainer: ld a, [wCurOpponent] cp OPP_ID_OFFSET jr nc, .trainer - res 0, c + res BIT_TRAINER_BATTLE_TRANSITION, c ret .trainer - set 0, c + set BIT_TRAINER_BATTLE_TRANSITION, c ret GetBattleTransitionID_CompareLevels: @@ -108,12 +116,12 @@ GetBattleTransitionID_CompareLevels: ld a, [wCurEnemyLevel] sub e jr nc, .highLevelEnemy - res 1, c + res BIT_STRONGER_BATTLE_TRANSITION, c ld a, 1 ld [wBattleTransitionSpiralDirection], a ret .highLevelEnemy - set 1, c + set BIT_STRONGER_BATTLE_TRANSITION, c xor a ld [wBattleTransitionSpiralDirection], a ret @@ -129,7 +137,7 @@ GetBattleTransitionID_IsDungeonMap: cp e jr nz, .loop1 .match - set 2, c + set BIT_DUNGEON_BATTLE_TRANSITION, c ret .noMatch1 ld hl, DungeonMaps2 @@ -145,7 +153,7 @@ GetBattleTransitionID_IsDungeonMap: cp d jr nc, .match .noMatch2 - res 2, c + res BIT_DUNGEON_BATTLE_TRANSITION, c ret INCLUDE "data/maps/dungeon_maps.asm" diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 428bc78a0..5e93393c5 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -1007,12 +1007,12 @@ RemoveFaintedPlayerMon: ld b, FLAG_RESET predef FlagActionPredef ; clear gain exp flag for fainted mon ld hl, wEnemyBattleStatus1 - res 2, [hl] ; reset "attacking multiple times" flag + res ATTACKING_MULTIPLE_TIMES, [hl] ld a, [wLowHealthAlarm] - bit 7, a ; skip sound flag (red bar (?)) + bit BIT_LOW_HEALTH_ALARM, a jr z, .skipWaitForSound - ld a, $ff - ld [wLowHealthAlarm], a ;disable low health alarm + ld a, DISABLE_LOW_HEALTH_ALARM + ld [wLowHealthAlarm], a call WaitForSoundToFinish .skipWaitForSound ; a is 0, so this zeroes the enemy's accumulated damage. @@ -1305,7 +1305,7 @@ EnemySendOutFirstMon: dec a ld [wAICount], a ld hl, wPlayerBattleStatus1 - res 5, [hl] + res USING_TRAPPING_MOVE, [hl] hlcoord 18, 0 ld a, 8 call SlideTrainerPicOffScreen @@ -1860,15 +1860,15 @@ DrawPlayerHUDAndHPBar: jr z, .setLowHealthAlarm .fainted ld hl, wLowHealthAlarm - bit 7, [hl] ;low health alarm enabled? - ld [hl], $0 + bit BIT_LOW_HEALTH_ALARM, [hl] + ld [hl], 0 ret z xor a ld [wChannelSoundIDs + CHAN5], a ret .setLowHealthAlarm ld hl, wLowHealthAlarm - set 7, [hl] ;enable low health alarm + set BIT_LOW_HEALTH_ALARM, [hl] ret DrawEnemyHUDAndHPBar: @@ -2121,7 +2121,7 @@ DisplayBattleMenu:: ld a, D_LEFT | A_BUTTON ld [hli], a ; wMenuWatchedKeys call HandleMenuInput - bit 5, a ; check if left was pressed + bit BIT_D_LEFT, a jr nz, .leftColumn ; if left was pressed, jump ld a, [wCurrentMenuItem] add $2 ; if we're in the right column, the actual id is +2 @@ -2473,11 +2473,11 @@ MoveSelectionMenu: .writemoves ld de, wMovesString ldh a, [hUILayoutFlags] - set 2, a + set BIT_SINGLE_SPACED_LINES, a ldh [hUILayoutFlags], a call PlaceString ldh a, [hUILayoutFlags] - res 2, a + res BIT_SINGLE_SPACED_LINES, a ldh [hUILayoutFlags], a ret @@ -2604,10 +2604,10 @@ SelectMenuItem: ld [hl], "▷" .select ld hl, hUILayoutFlags - set 1, [hl] + set BIT_DOUBLE_SPACED_MENU, [hl] call HandleMenuInput ld hl, hUILayoutFlags - res 1, [hl] + res BIT_DOUBLE_SPACED_MENU, [hl] bit BIT_D_UP, a jp nz, SelectMenuItem_CursorUp bit BIT_D_DOWN, a @@ -2652,7 +2652,7 @@ SelectMenuItem: cp c jr z, .disabled ld a, [wPlayerBattleStatus3] - bit 3, a ; transformed + bit TRANSFORMED, a jr nz, .transformedMoveSelected .transformedMoveSelected ; pointless ; Allow moves copied by Transform to be used. @@ -3850,7 +3850,7 @@ PrintMoveFailureText: .playersTurn ld hl, DoesntAffectMonText ld a, [wDamageMultipliers] - and $7f + and EFFECTIVENESS_MASK jr z, .gotTextToPrint ld hl, AttackMissedText ld a, [wCriticalHitOrOHKO] @@ -5248,7 +5248,7 @@ AdjustDamageForMoveType: ld a, l ld [wDamage + 1], a ld hl, wDamageMultipliers - set 7, [hl] + set BIT_STAB_DAMAGE, [hl] .skipSameTypeAttackBonus ld a, [wMoveType] ld b, a @@ -5271,7 +5271,7 @@ AdjustDamageForMoveType: push bc inc hl ld a, [wDamageMultipliers] - and $80 + and 1 << BIT_STAB_DAMAGE ld b, a ld a, [hl] ; a = damage multiplier ldh [hMultiplier], a diff --git a/engine/battle/effects.asm b/engine/battle/effects.asm index 6fba347f2..95c8706f1 100644 --- a/engine/battle/effects.asm +++ b/engine/battle/effects.asm @@ -194,7 +194,7 @@ ExplodeEffect: FreezeBurnParalyzeEffect: xor a ld [wAnimationType], a - call CheckTargetSubstitute ; test bit 4 of d063/d068 flags [target has substitute flag] + call CheckTargetSubstitute ret nz ; return if they have a substitute, can't effect them ldh a, [hWhoseTurn] and a diff --git a/engine/battle/experience.asm b/engine/battle/experience.asm index 57d37f019..a8ee6747c 100644 --- a/engine/battle/experience.asm +++ b/engine/battle/experience.asm @@ -224,7 +224,7 @@ GainExperience: call CopyData pop hl ld a, [wPlayerBattleStatus3] - bit 3, a ; is the mon transformed? + bit TRANSFORMED, a jr nz, .recalcStatChanges ; the mon is not transformed, so update the unmodified stats ld de, wPlayerMonUnmodifiedLevel diff --git a/engine/battle/trainer_ai.asm b/engine/battle/trainer_ai.asm index 5eed1ae58..ccd4e804f 100644 --- a/engine/battle/trainer_ai.asm +++ b/engine/battle/trainer_ai.asm @@ -632,27 +632,27 @@ AICureStatus: ld [hl], a ; clear status in enemy team roster ld [wEnemyMonStatus], a ; clear status of active enemy ld hl, wEnemyBattleStatus3 - res 0, [hl] + res BADLY_POISONED, [hl] ret AIUseXAccuracy: ; unused call AIPlayRestoringSFX ld hl, wEnemyBattleStatus2 - set 0, [hl] + set USING_X_ACCURACY, [hl] ld a, X_ACCURACY jp AIPrintItemUse AIUseGuardSpec: call AIPlayRestoringSFX ld hl, wEnemyBattleStatus2 - set 1, [hl] + set PROTECTED_BY_MIST, [hl] ld a, GUARD_SPEC jp AIPrintItemUse AIUseDireHit: ; unused call AIPlayRestoringSFX ld hl, wEnemyBattleStatus2 - set 2, [hl] + set GETTING_PUMPED, [hl] ld a, DIRE_HIT jp AIPrintItemUse diff --git a/engine/events/hidden_objects/pokecenter_pc.asm b/engine/events/hidden_objects/pokecenter_pc.asm index f20f40ed4..59867d1a4 100644 --- a/engine/events/hidden_objects/pokecenter_pc.asm +++ b/engine/events/hidden_objects/pokecenter_pc.asm @@ -3,7 +3,7 @@ OpenPokemonCenterPC: cp SPRITE_FACING_UP ret nz call EnableAutoTextBoxDrawing - ld a, TRUE + ld a, 1 << BIT_NO_AUTO_TEXT_BOX ld [wAutoTextBoxDrawingControl], a tx_pre_jump PokemonCenterPCText diff --git a/engine/events/poison.asm b/engine/events/poison.asm index 752899f72..5a7bed7c4 100644 --- a/engine/events/poison.asm +++ b/engine/events/poison.asm @@ -1,7 +1,7 @@ ApplyOutOfBattlePoisonDamage: ld a, [wStatusFlags5] assert BIT_SCRIPTED_MOVEMENT_STATE == 7 - add a ; overflows bit 7 into carry flag + add a ; overflows scripted movement state bit into carry flag jp c, .noBlackOut ; no black out if joypad states are being simulated ld a, [wPartyCount] and a diff --git a/engine/gfx/hp_bar.asm b/engine/gfx/hp_bar.asm index d848a337a..c1ae598ef 100644 --- a/engine/gfx/hp_bar.asm +++ b/engine/gfx/hp_bar.asm @@ -214,7 +214,7 @@ UpdateHPBar_PrintHPNumber: ld [wHPBarTempHP], a push hl ldh a, [hUILayoutFlags] - bit 0, a + bit BIT_PARTY_MENU_HP_BAR, a jr z, .hpBelowBar ld de, $9 jr .next diff --git a/engine/gfx/sprite_oam.asm b/engine/gfx/sprite_oam.asm index 3916c0dbe..737443a6d 100644 --- a/engine/gfx/sprite_oam.asm +++ b/engine/gfx/sprite_oam.asm @@ -124,7 +124,7 @@ PrepareOAMData:: inc hl inc e ld a, [hl] - bit 1, a ; is the tile allowed to set the sprite priority bit? + bit BIT_SPRITE_UNDER_GRASS, a jr z, .skipPriority ldh a, [hSpritePriority] or [hl] @@ -132,7 +132,7 @@ PrepareOAMData:: inc hl ld [de], a inc e - bit 0, a ; OAMFLAG_ENDOFDATA + bit BIT_END_OF_OAM_DATA, a jr z, .tileLoop ld a, e diff --git a/engine/items/item_effects.asm b/engine/items/item_effects.asm index 914624788..9643412ca 100644 --- a/engine/items/item_effects.asm +++ b/engine/items/item_effects.asm @@ -691,7 +691,7 @@ ItemUseSurfboard: ldh [hSpriteIndex], a ld d, 16 ; talking range in pixels (normal range) call IsSpriteInFrontOfPlayer2 - res 7, [hl] + res BIT_FACE_PLAYER, [hl] ldh a, [hSpriteIndex] and a ; is there a sprite in the way? jr nz, .cannotStopSurfing @@ -1052,13 +1052,13 @@ ItemUseMedicine: ld a, SFX_HEAL_HP call PlaySoundWaitForCurrent ldh a, [hUILayoutFlags] - set 0, a + set BIT_PARTY_MENU_HP_BAR, a ldh [hUILayoutFlags], a ld a, $02 ld [wHPBarType], a predef UpdateHPBar2 ; animate HP bar decrease of pokemon that used Softboiled ldh a, [hUILayoutFlags] - res 0, a + res BIT_PARTY_MENU_HP_BAR, a ldh [hUILayoutFlags], a pop af ld b, a ; store heal amount (1/5 of max HP) @@ -1202,13 +1202,13 @@ ItemUseMedicine: ld a, SFX_HEAL_HP call PlaySoundWaitForCurrent ldh a, [hUILayoutFlags] - set 0, a + set BIT_PARTY_MENU_HP_BAR, a ldh [hUILayoutFlags], a ld a, $02 ld [wHPBarType], a predef UpdateHPBar2 ; animate the HP bar lengthening ldh a, [hUILayoutFlags] - res 0, a + res BIT_PARTY_MENU_HP_BAR, a ldh [hUILayoutFlags], a ld a, REVIVE_MSG ld [wPartyMenuTypeOrMessageID], a diff --git a/engine/items/town_map.asm b/engine/items/town_map.asm index a98402682..6f2c050ce 100644 --- a/engine/items/town_map.asm +++ b/engine/items/town_map.asm @@ -75,9 +75,9 @@ DisplayTownMap: jr z, .inputLoop ld a, SFX_TINK call PlaySound - bit 6, b + bit BIT_D_UP, b jr nz, .pressedUp - bit 7, b + bit BIT_D_DOWN, b jr nz, .pressedDown xor a ld [wTownMapSpriteBlinkingEnabled], a @@ -196,13 +196,13 @@ LoadTownMap_Fly:: pop hl and A_BUTTON | B_BUTTON | D_UP | D_DOWN jr z, .inputLoop - bit 0, b + bit BIT_A_BUTTON, b jr nz, .pressedA ld a, SFX_TINK call PlaySound - bit 6, b + bit BIT_D_UP, b jr nz, .pressedUp - bit 7, b + bit BIT_D_DOWN, b jr nz, .pressedDown jr .pressedB .pressedA diff --git a/engine/link/cable_club.asm b/engine/link/cable_club.asm index cbb8a358c..8ae192b8d 100644 --- a/engine/link/cable_club.asm +++ b/engine/link/cable_club.asm @@ -282,7 +282,7 @@ CableClub_DoBattleOrTradeAgain: call ClearScreen call Delay3 ld hl, wOptions - res 7, [hl] + res BIT_BATTLE_ANIMATION, [hl] predef InitOpponent predef HealParty jp ReturnToCableClubRoom @@ -342,10 +342,10 @@ TradeCenter_SelectMon: ld [wTopMenuItemX], a .enemyMonMenu_HandleInput ld hl, hUILayoutFlags - set 1, [hl] + set BIT_DOUBLE_SPACED_MENU, [hl] call HandleMenuInput ld hl, hUILayoutFlags - res 1, [hl] + res BIT_DOUBLE_SPACED_MENU, [hl] and a jp z, .getNewInput bit BIT_A_BUTTON, a @@ -407,10 +407,10 @@ TradeCenter_SelectMon: call ClearScreenArea .playerMonMenu_HandleInput ld hl, hUILayoutFlags - set 1, [hl] + set BIT_DOUBLE_SPACED_MENU, [hl] call HandleMenuInput ld hl, hUILayoutFlags - res 1, [hl] + res BIT_DOUBLE_SPACED_MENU, [hl] and a ; was anything pressed? jr nz, .playerMonMenu_SomethingPressed jp .getNewInput @@ -489,7 +489,7 @@ TradeCenter_SelectMon: ld a, 1 ld [wTopMenuItemX], a call HandleMenuInput - bit 4, a ; Right pressed? + bit BIT_D_RIGHT, a jr nz, .selectTradeMenuItem bit BIT_B_BUTTON, a jr z, .displayPlayerMonStats @@ -585,7 +585,7 @@ ReturnToCableClubRoom: ld a, [hl] push af push hl - res 0, [hl] + res BIT_FONT_LOADED, [hl] xor a ld [wStatusFlags3], a ; clears BIT_INIT_TRADE_CENTER_FACING dec a diff --git a/engine/menus/display_text_id_init.asm b/engine/menus/display_text_id_init.asm index a89696fbf..2ef1cfb18 100644 --- a/engine/menus/display_text_id_init.asm +++ b/engine/menus/display_text_id_init.asm @@ -3,7 +3,7 @@ DisplayTextIDInit:: xor a ld [wListMenuID], a ld a, [wAutoTextBoxDrawingControl] - bit 0, a + bit BIT_NO_AUTO_TEXT_BOX, a jr nz, .skipDrawingTextBoxBorder ldh a, [hTextID] and a @@ -31,7 +31,7 @@ DisplayTextIDInit:: call TextBoxBorder .skipDrawingTextBoxBorder ld hl, wFontLoaded - set 0, [hl] + set BIT_FONT_LOADED, [hl] ld hl, wMiscFlags bit BIT_NO_SPRITE_UPDATES, [hl] res BIT_NO_SPRITE_UPDATES, [hl] diff --git a/engine/menus/league_pc.asm b/engine/menus/league_pc.asm index 17d58c55c..03b1de6d9 100644 --- a/engine/menus/league_pc.asm +++ b/engine/menus/league_pc.asm @@ -44,7 +44,7 @@ PKMNLeaguePC: pop af ld [wUpdateSpritesEnabled], a pop hl - res 6, [hl] + res BIT_NO_TEXT_DELAY, [hl] call GBPalWhiteOutWithDelay3 call ClearScreen call RunDefaultPaletteCommand @@ -57,7 +57,7 @@ LeaguePCShowTeam: call LeaguePCShowMon call WaitForTextScrollButtonPress ldh a, [hJoyHeld] - bit 1, a + bit BIT_B_BUTTON, a jr nz, .exit ld hl, wHallOfFame + HOF_MON ld de, wHallOfFame diff --git a/engine/menus/party_menu.asm b/engine/menus/party_menu.asm index 6c8cd6ebc..e6388b5fd 100644 --- a/engine/menus/party_menu.asm +++ b/engine/menus/party_menu.asm @@ -70,12 +70,12 @@ RedrawPartyMenu_:: push hl ld bc, SCREEN_WIDTH + 1 ; down 1 row and right 1 column ldh a, [hUILayoutFlags] - set 0, a + set BIT_PARTY_MENU_HP_BAR, a ldh [hUILayoutFlags], a add hl, bc predef DrawHP2 ; draw HP bar and prints current / max HP ldh a, [hUILayoutFlags] - res 0, a + res BIT_PARTY_MENU_HP_BAR, a ldh [hUILayoutFlags], a call SetPartyMenuHPBarColor ; color the HP bar (on SGB) pop hl diff --git a/engine/menus/players_pc.asm b/engine/menus/players_pc.asm index 9e1553ddb..402275b52 100644 --- a/engine/menus/players_pc.asm +++ b/engine/menus/players_pc.asm @@ -50,7 +50,7 @@ PlayerPCMenu: ld hl, WhatDoYouWantText call PrintText call HandleMenuInput - bit 1, a + bit BIT_B_BUTTON, a jp nz, ExitPlayerPC call PlaceUnfilledArrowMenuCursor ld a, [wCurrentMenuItem] diff --git a/engine/menus/save.asm b/engine/menus/save.asm index 2f61b6787..eeb4b9e8a 100644 --- a/engine/menus/save.asm +++ b/engine/menus/save.asm @@ -66,7 +66,7 @@ LoadSAV0: ld bc, wMainDataEnd - wMainDataStart call CopyData ld hl, wCurMapTileset - set 7, [hl] + set BIT_NO_PREVIOUS_MAP, [hl] ld hl, sSpriteData ld de, wSpriteDataStart ld bc, wSpriteDataEnd - wSpriteDataStart @@ -349,15 +349,15 @@ ChangeBox:: and a ret nz ; return if No was chosen ld hl, wCurrentBoxNum - bit 7, [hl] ; is it the first time player is changing the box? + bit BIT_HAS_CHANGED_BOXES, [hl] ; is it the first time player is changing the box? call z, EmptyAllSRAMBoxes ; if so, empty all boxes in SRAM call DisplayChangeBoxMenu call UpdateSprites ld hl, hUILayoutFlags - set 1, [hl] + set BIT_DOUBLE_SPACED_MENU, [hl] call HandleMenuInput ld hl, hUILayoutFlags - res 1, [hl] + res BIT_DOUBLE_SPACED_MENU, [hl] bit BIT_B_BUTTON, a ret nz call GetBoxSRAMLocation @@ -366,7 +366,7 @@ ChangeBox:: ld hl, wBoxDataStart call CopyBoxToOrFromSRAM ; copy old box from WRAM to SRAM ld a, [wCurrentMenuItem] - set 7, a + set BIT_HAS_CHANGED_BOXES, a ld [wCurrentBoxNum], a call GetBoxSRAMLocation ld de, wBoxDataStart @@ -448,12 +448,12 @@ DisplayChangeBoxMenu: ld c, 7 call TextBoxBorder ld hl, hUILayoutFlags - set 2, [hl] + set BIT_SINGLE_SPACED_LINES, [hl] ld de, BoxNames hlcoord 13, 1 call PlaceString ld hl, hUILayoutFlags - res 2, [hl] + res BIT_SINGLE_SPACED_LINES, [hl] ld a, [wCurrentBoxNum] and $7f cp 9 diff --git a/engine/menus/text_box.asm b/engine/menus/text_box.asm index 3c1b52336..1c078693a 100644 --- a/engine/menus/text_box.asm +++ b/engine/menus/text_box.asm @@ -227,8 +227,8 @@ DisplayTwoOptionMenu: ld [wMenuWatchMovingOutOfBounds], a push hl ld hl, wTwoOptionMenuID - bit 7, [hl] ; select second menu item by default? - res 7, [hl] + bit BIT_SECOND_MENU_OPTION_DEFAULT, [hl] + res BIT_SECOND_MENU_OPTION_DEFAULT, [hl] jr z, .storeCurrentMenuItem inc a .storeCurrentMenuItem diff --git a/engine/overworld/map_sprites.asm b/engine/overworld/map_sprites.asm index 8acbb04fe..75c46474b 100644 --- a/engine/overworld/map_sprites.asm +++ b/engine/overworld/map_sprites.asm @@ -162,7 +162,7 @@ LoadMapSpriteTilePatterns: pop de ld b, a ld a, [wFontLoaded] - bit 0, a ; reloading upper half of tile patterns after displaying text? + bit BIT_FONT_LOADED, a ; reloading upper half of tile patterns after displaying text? jr nz, .skipFirstLoad ; if so, skip loading data into the lower half ld a, b ld b, 0 @@ -183,7 +183,7 @@ LoadMapSpriteTilePatterns: inc d .noCarry3 ld a, [wFontLoaded] - bit 0, a ; reloading upper half of tile patterns after displaying text? + bit BIT_FONT_LOADED, a ; reloading upper half of tile patterns after displaying text? jr nz, .loadWhileLCDOn pop af pop hl @@ -268,7 +268,7 @@ InitOutsideMapSprites: call nc, GetSplitMapSpriteSetID ; if so, choose the appropriate one ld b, a ; b = spriteSetID ld a, [wFontLoaded] - bit 0, a ; reloading upper half of tile patterns after displaying text? + bit BIT_FONT_LOADED, a ; reloading upper half of tile patterns after displaying text? jr nz, .loadSpriteSet ; if so, forcibly reload the sprite set ld a, [wSpriteSetID] cp b ; has the sprite set ID changed? diff --git a/engine/overworld/movement.asm b/engine/overworld/movement.asm index 1ca24f6ac..5f95cf6c3 100644 --- a/engine/overworld/movement.asm +++ b/engine/overworld/movement.asm @@ -57,7 +57,7 @@ UpdatePlayerSprite: .next ld [wSpritePlayerStateData1FacingDirection], a ld a, [wFontLoaded] - bit 0, a + bit BIT_FONT_LOADED, a jr nz, .notMoving .moving ld a, [wMovementFlags] @@ -135,11 +135,11 @@ UpdateNPCSprite: ld l, a inc l ld a, [hl] ; x#SPRITESTATEDATA1_MOVEMENTSTATUS - bit 7, a ; is the face player flag set? + bit BIT_FACE_PLAYER, a jp nz, MakeNPCFacePlayer ld b, a ld a, [wFontLoaded] - bit 0, a + bit BIT_FONT_LOADED, a jp nz, notYetMoving ld a, b cp $2 @@ -412,7 +412,7 @@ MakeNPCFacePlayer: ld a, [wStatusFlags3] bit BIT_NO_NPC_FACE_PLAYER, a jr nz, notYetMoving - res 7, [hl] + res BIT_FACE_PLAYER, [hl] ld a, [wPlayerDirection] bit PLAYER_DIR_BIT_UP, a jr z, .notFacingDown diff --git a/engine/overworld/pathfinding.asm b/engine/overworld/pathfinding.asm index d067345e2..58fa1da9b 100644 --- a/engine/overworld/pathfinding.asm +++ b/engine/overworld/pathfinding.asm @@ -16,7 +16,7 @@ FindPathToPlayer: and a jr nz, .stillHasYProgress ldh a, [hFindPathFlags] - set 0, a ; current end of path matches the player's Y coordinate + set BIT_PATH_FOUND_Y, a ldh [hFindPathFlags], a .stillHasYProgress ldh a, [hFindPathXProgress] @@ -27,11 +27,11 @@ FindPathToPlayer: and a jr nz, .stillHasXProgress ldh a, [hFindPathFlags] - set 1, a ; current end of path matches the player's X coordinate + set BIT_PATH_FOUND_X, a ldh [hFindPathFlags], a .stillHasXProgress ldh a, [hFindPathFlags] - cp $3 ; has the end of the path reached the player's position? + cp (1 << BIT_PATH_FOUND_X) | (1 << BIT_PATH_FOUND_Y) jr z, .done ; Compare whether the X distance between the player and the current of the path ; is greater or if the Y distance is. Then, try to reduce whichever is greater. @@ -40,7 +40,7 @@ FindPathToPlayer: jr c, .yDistanceGreater ; x distance is greater ldh a, [hNPCPlayerRelativePosFlags] - bit 1, a + bit BIT_PLAYER_LOWER_X, a jr nz, .playerIsLeftOfNPC ld d, NPC_MOVEMENT_RIGHT jr .next1 @@ -53,7 +53,7 @@ FindPathToPlayer: jr .storeDirection .yDistanceGreater ldh a, [hNPCPlayerRelativePosFlags] - bit 0, a + bit BIT_PLAYER_LOWER_Y, a jr nz, .playerIsAboveNPC ld d, NPC_MOVEMENT_DOWN jr .next2 @@ -97,15 +97,15 @@ CalcPositionOfPlayerRelativeToNPC: .NPCNorthOfPlayer push hl ld hl, hNPCPlayerRelativePosFlags - bit 0, [hl] - set 0, [hl] + bit BIT_PLAYER_LOWER_Y, [hl] + set BIT_PLAYER_LOWER_Y, [hl] pop hl jr .divideYDistance .NPCSouthOfOrAlignedWithPlayer push hl ld hl, hNPCPlayerRelativePosFlags - bit 0, [hl] - res 0, [hl] + bit BIT_PLAYER_LOWER_Y, [hl] + res BIT_PLAYER_LOWER_Y, [hl] pop hl .divideYDistance push hl @@ -125,15 +125,15 @@ CalcPositionOfPlayerRelativeToNPC: .NPCWestOfPlayer push hl ld hl, hNPCPlayerRelativePosFlags - bit 1, [hl] - set 1, [hl] + bit BIT_PLAYER_LOWER_X, [hl] + set BIT_PLAYER_LOWER_X, [hl] pop hl jr .divideXDistance .NPCEastOfOrAlignedWithPlayer push hl ld hl, hNPCPlayerRelativePosFlags - bit 1, [hl] - res 1, [hl] + bit BIT_PLAYER_LOWER_X, [hl] + res BIT_PLAYER_LOWER_X, [hl] pop hl .divideXDistance ldh [hDividend2], a diff --git a/engine/overworld/push_boulder.asm b/engine/overworld/push_boulder.asm index ff4814397..1773e818f 100644 --- a/engine/overworld/push_boulder.asm +++ b/engine/overworld/push_boulder.asm @@ -18,7 +18,7 @@ TryPushingBoulder:: swap a ld e, a add hl, de - res 7, [hl] + res BIT_FACE_PLAYER, [hl] call GetSpriteMovementByte2Pointer ld a, [hl] cp BOULDER_MOVEMENT_BYTE_2 diff --git a/engine/overworld/special_warps.asm b/engine/overworld/special_warps.asm index 303415c15..b20d490e2 100644 --- a/engine/overworld/special_warps.asm +++ b/engine/overworld/special_warps.asm @@ -52,7 +52,7 @@ LoadSpecialWarpData: bit BIT_DEBUG_MODE, a ; warp to wLastMap (PALLET_TOWN) for StartNewGameDebug jr nz, .notNewGameWarp - bit 2, a + bit BIT_FLY_OR_DUNGEON_WARP, a jr nz, .notNewGameWarp ld hl, NewGameWarp .copyWarpData diff --git a/engine/pokemon/learn_move.asm b/engine/pokemon/learn_move.asm index 2df9964ef..819466a59 100644 --- a/engine/pokemon/learn_move.asm +++ b/engine/pokemon/learn_move.asm @@ -127,11 +127,11 @@ TryingToLearn: hlcoord 6, 8 ld de, wMovesString ldh a, [hUILayoutFlags] - set 2, a + set BIT_SINGLE_SPACED_LINES, a ldh [hUILayoutFlags], a call PlaceString ldh a, [hUILayoutFlags] - res 2, a + res BIT_SINGLE_SPACED_LINES, a ldh [hUILayoutFlags], a ld hl, wTopMenuItemY ld a, 8 @@ -147,10 +147,10 @@ TryingToLearn: ld [hli], a ; wMenuWatchedKeys ld [hl], 0 ; wLastMenuItem ld hl, hUILayoutFlags - set 1, [hl] + set BIT_DOUBLE_SPACED_MENU, [hl] call HandleMenuInput ld hl, hUILayoutFlags - res 1, [hl] + res BIT_DOUBLE_SPACED_MENU, [hl] push af call LoadScreenTilesFromBuffer1 pop af diff --git a/engine/pokemon/status_screen.asm b/engine/pokemon/status_screen.asm index 8d377f797..447db8fd4 100644 --- a/engine/pokemon/status_screen.asm +++ b/engine/pokemon/status_screen.asm @@ -41,7 +41,7 @@ DrawHP_: call DrawHPBar pop hl ldh a, [hUILayoutFlags] - bit 0, a + bit BIT_PARTY_MENU_HP_BAR, a jr z, .printFractionBelowBar ld bc, $9 ; right of bar jr .printFraction diff --git a/engine/slots/slot_machine.asm b/engine/slots/slot_machine.asm index 649f634cf..1ed24a1a8 100644 --- a/engine/slots/slot_machine.asm +++ b/engine/slots/slot_machine.asm @@ -1,8 +1,9 @@ PromptUserToPlaySlots: call SaveScreenTilesToBuffer2 - ld a, BANK(DisplayTextIDInit) ; TRUE - ld [wAutoTextBoxDrawingControl], a - ld b, a + ld a, BANK(DisplayTextIDInit) + assert BANK(DisplayTextIDInit) == 1 << BIT_NO_AUTO_TEXT_BOX + ld [wAutoTextBoxDrawingControl], a ; 1 << BIT_NO_AUTO_TEXT_BOX + ld b, a ; BANK(DisplayTextIDInit) ld hl, DisplayTextIDInit call Bankswitch ld hl, PlaySlotMachineText @@ -173,7 +174,7 @@ OneMoreGoSlotMachineText: SlotMachine_SetFlags: ld hl, wSlotMachineFlags - bit 7, [hl] + bit BIT_SLOTS_CAN_WIN_WITH_7_OR_BAR, [hl] ret nz ld a, [wSlotMachineAllowMatchesCounter] and a @@ -191,14 +192,14 @@ SlotMachine_SetFlags: ld [hl], 0 ret .allowMatches - set 6, [hl] + set BIT_SLOTS_CAN_WIN, [hl] ret .setAllowMatchesCounter ld a, 60 ld [wSlotMachineAllowMatchesCounter], a ret .allowSevenAndBarMatches - set 7, [hl] + set BIT_SLOTS_CAN_WIN_WITH_7_OR_BAR, [hl] ret SlotMachine_SpinWheels: @@ -289,7 +290,7 @@ SlotMachine_StopWheel1Early: call SlotMachine_GetWheel1Tiles ld hl, wSlotMachineWheel1BottomTile ld a, [wSlotMachineFlags] - and $80 + and 1 << BIT_SLOTS_CAN_WIN_WITH_7_OR_BAR jr nz, .sevenAndBarMode ; Stop early if the middle symbol is not a cherry. inc hl @@ -317,7 +318,7 @@ SlotMachine_StopWheel1Early: SlotMachine_StopWheel2Early: call SlotMachine_GetWheel2Tiles ld a, [wSlotMachineFlags] - and $80 + and 1 << BIT_SLOTS_CAN_WIN_WITH_7_OR_BAR jr nz, .sevenAndBarMode ; Stop early if any symbols are lined up in the first two wheels. call SlotMachine_FindWheel1Wheel2Matches @@ -401,7 +402,7 @@ SlotMachine_CheckForMatches: call SlotMachine_CheckForMatch jr z, .foundMatch ld a, [wSlotMachineFlags] - and $c0 + and (1 << BIT_SLOTS_CAN_WIN) | (1 << BIT_SLOTS_CAN_WIN_WITH_7_OR_BAR) jr z, .noMatch ld hl, wSlotMachineRerollCounter dec [hl] @@ -421,9 +422,9 @@ SlotMachine_CheckForMatches: jp SlotMachine_CheckForMatches .foundMatch ld a, [wSlotMachineFlags] - and $c0 + and (1 << BIT_SLOTS_CAN_WIN) | (1 << BIT_SLOTS_CAN_WIN_WITH_7_OR_BAR) jr z, .rollWheel3DownByOneSymbol ; roll wheel if player isn't allowed to win - and $80 + and 1 << BIT_SLOTS_CAN_WIN_WITH_7_OR_BAR jr nz, .acceptMatch ; if 7/bar matches aren't enabled and the match was a 7/bar symbol, roll wheel ld a, [hl] @@ -599,7 +600,7 @@ SlotReward300Func: call PlaySound call Random cp $80 - ld a, $0 + ld a, 0 jr c, .skip ld [wSlotMachineFlags], a .skip @@ -654,7 +655,7 @@ SlotMachine_PrintPayoutCoins: jp PrintNumber SlotMachine_PayCoinsToPlayer: - ld a, $1 + ld a, TRUE ld [wMuteAudioAndPauseMusic], a call WaitForSoundToFinish diff --git a/home/map_objects.asm b/home/map_objects.asm index 342139dd6..e200238ad 100644 --- a/home/map_objects.asm +++ b/home/map_objects.asm @@ -227,7 +227,7 @@ SetSpriteMovementBytesToFF:: ; returns the sprite movement byte 1 pointer for sprite [hSpriteIndex] in hl GetSpriteMovementByte1Pointer:: - ld h, $C2 + ld h, HIGH(wSpriteStateData2) ldh a, [hSpriteIndex] swap a add 6 diff --git a/home/overworld.asm b/home/overworld.asm index 1595fdf0c..e43ebc813 100644 --- a/home/overworld.asm +++ b/home/overworld.asm @@ -121,7 +121,7 @@ OverworldLoopLessDelay:: ld a, [wCurMap] call SwitchToMapRomBank ; switch to the ROM bank of the current map ld hl, wCurMapTileset - set 7, [hl] + set BIT_NO_PREVIOUS_MAP, [hl] .changeMap jp EnterMap .checkForOpponent @@ -879,10 +879,10 @@ LoadTilesetTilePatternData:: ld a, [wTilesetBank] jp FarCopyData2 -; this loads the current maps complete tile map (which references blocks, not individual tiles) to C6E8 +; this loads the current map's complete tile map (which references blocks, not individual tiles) to wOverworldMap ; it can also load partial tile maps of connected maps into a border of length 3 around the current map LoadTileBlockMap:: -; fill C6E8-CBFB with the background tile +; fill wOverworldMap-wOverworldMapEnd with the background tile ld hl, wOverworldMap ld a, [wMapBackgroundTile] ld d, a @@ -1210,7 +1210,7 @@ IsSpriteInFrontOfPlayer2:: and $f0 inc a ld l, a ; hl = x#SPRITESTATEDATA1_MOVEMENTSTATUS - set 7, [hl] ; set flag to make the sprite face the player + set BIT_FACE_PLAYER, [hl] ld a, e ldh [hTextID], a ret @@ -1303,7 +1303,7 @@ CheckForTilePairCollisions:: ld a, [wTileInFrontOfPlayer] ld c, a .tilePairCollisionLoop - ld a, [wCurMapTileset] ; tileset number + ld a, [wCurMapTileset] ld b, a ld a, [hli] cp $ff @@ -1943,7 +1943,7 @@ CollisionCheckOnWater:: call PlayDefaultMusic jr .noCollision .checkIfVermilionDockTileset - ld a, [wCurMapTileset] ; tileset + ld a, [wCurMapTileset] cp SHIP_PORT ; Vermilion Dock tileset jr nz, .noCollision ; keep surfing if it's not the boarding platform tile jr .stopSurfing ; if it is the boarding platform tile, stop surfing @@ -2015,10 +2015,10 @@ LoadMapHeader:: call SwitchToMapRomBank ld a, [wCurMapTileset] ld b, a - res 7, a + res BIT_NO_PREVIOUS_MAP, a ld [wCurMapTileset], a ldh [hPreviousTileset], a - bit 7, b + bit BIT_NO_PREVIOUS_MAP, b ret nz ld hl, MapHeaderPointers ld a, [wCurMap] @@ -2203,9 +2203,9 @@ LoadMapHeader:: ld [hl], a ; store text ID in byte 1 of sprite entry pop hl ldh a, [hLoadSpriteTemp1] - bit 6, a + bit BIT_TRAINER, a jr nz, .trainerSprite - bit 7, a + bit BIT_ITEM, a jr nz, .itemBallSprite jr .regularSprite .trainerSprite diff --git a/home/predef_text.asm b/home/predef_text.asm index bdecd3cf1..61e22fce1 100644 --- a/home/predef_text.asm +++ b/home/predef_text.asm @@ -3,7 +3,7 @@ PrintPredefTextID:: ld hl, TextPredefs call SetMapTextPointer ld hl, wTextPredefFlag - set 0, [hl] + set BIT_TEXT_PREDEF, [hl] call DisplayTextID RestoreMapTextPointer:: diff --git a/home/print_bcd.asm b/home/print_bcd.asm index 38aedd3c8..57ec12a8a 100644 --- a/home/print_bcd.asm +++ b/home/print_bcd.asm @@ -13,12 +13,12 @@ ; their meaning at the beginning of the functions's execution. PrintBCDNumber:: ld b, c ; save flags in b - res 7, c - res 6, c - res 5, c ; c now holds the length - bit 5, b + res BIT_LEADING_ZEROES, c + res BIT_LEFT_ALIGN, c + res BIT_MONEY_SIGN, c ; c now holds the length + bit BIT_MONEY_SIGN, b jr z, .loop - bit 7, b + bit BIT_LEADING_ZEROES, b jr nz, .loop ld [hl], "¥" inc hl @@ -31,14 +31,14 @@ PrintBCDNumber:: inc de dec c jr nz, .loop - bit 7, b ; were any non-zero digits printed? + bit BIT_LEADING_ZEROES, b jr z, .done ; if so, we are done .numberEqualsZero ; if every digit of the BCD number is zero - bit 6, b ; left or right alignment? + bit BIT_LEFT_ALIGN, b jr nz, .skipRightAlignmentAdjustment dec hl ; if the string is right-aligned, it needs to be moved back one space .skipRightAlignmentAdjustment - bit 5, b + bit BIT_MONEY_SIGN, b jr z, .skipCurrencySymbol ld [hl], "¥" inc hl @@ -54,24 +54,24 @@ PrintBCDDigit:: and a jr z, .zeroDigit .nonzeroDigit - bit 7, b ; have any non-space characters been printed? + bit BIT_LEADING_ZEROES, b jr z, .outputDigit ; if bit 7 is set, then no numbers have been printed yet - bit 5, b ; print the currency symbol? + bit BIT_MONEY_SIGN, b jr z, .skipCurrencySymbol ld [hl], "¥" inc hl - res 5, b + res BIT_MONEY_SIGN, b .skipCurrencySymbol - res 7, b ; unset 7 to indicate that a nonzero digit has been reached + res BIT_LEADING_ZEROES, b .outputDigit add "0" ld [hli], a jp PrintLetterDelay .zeroDigit - bit 7, b ; either printing leading zeroes or already reached a nonzero digit? + bit BIT_LEADING_ZEROES, b jr z, .outputDigit ; if so, print a zero digit - bit 6, b ; left or right alignment? + bit BIT_LEFT_ALIGN, b ret nz inc hl ; if right-aligned, "print" a space by advancing the pointer ret diff --git a/home/reload_sprites.asm b/home/reload_sprites.asm index 8a08d64d8..5cf5d458b 100644 --- a/home/reload_sprites.asm +++ b/home/reload_sprites.asm @@ -4,7 +4,7 @@ ReloadMapSpriteTilePatterns:: ld hl, wFontLoaded ld a, [hl] push af - res 0, [hl] + res BIT_FONT_LOADED, [hl] push hl xor a ld [wSpriteSetID], a diff --git a/home/text.asm b/home/text.asm index dc78b982c..da884125d 100644 --- a/home/text.asm +++ b/home/text.asm @@ -63,7 +63,7 @@ PlaceNextChar:: jr nz, .NotNext ld bc, 2 * SCREEN_WIDTH ldh a, [hUILayoutFlags] - bit 2, a + bit BIT_SINGLE_SPACED_LINES, a jr z, .ok ld bc, SCREEN_WIDTH .ok diff --git a/home/text_script.asm b/home/text_script.asm index d367683db..c1606371e 100644 --- a/home/text_script.asm +++ b/home/text_script.asm @@ -6,8 +6,8 @@ DisplayTextID:: push af farcall DisplayTextIDInit ; initialization ld hl, wTextPredefFlag - bit 0, [hl] - res 0, [hl] + bit BIT_TEXT_PREDEF, [hl] + res BIT_TEXT_PREDEF, [hl] jr nz, .skipSwitchToMapBank ld a, [wCurMap] call SwitchToMapRomBank @@ -128,7 +128,7 @@ CloseTextDisplay:: ld [MBC1RomBank], a call InitMapSprites ; reload sprite tile pattern data (since it was partially overwritten by text tile patterns) ld hl, wFontLoaded - res 0, [hl] + res BIT_FONT_LOADED, [hl] ld a, [wStatusFlags6] bit BIT_FLY_WARP, a call z, LoadPlayerSpriteGraphics diff --git a/home/window.asm b/home/window.asm index 01b52d410..48ab1d0e0 100644 --- a/home/window.asm +++ b/home/window.asm @@ -137,12 +137,12 @@ PlaceMenuCursor:: jr z, .checkForArrow1 push af ldh a, [hUILayoutFlags] - bit 1, a ; is the menu double spaced? + bit BIT_DOUBLE_SPACED_MENU, a jr z, .doubleSpaced1 - ld bc, 20 + ld bc, SCREEN_WIDTH jr .getOldMenuItemScreenPosition .doubleSpaced1 - ld bc, 40 + ld bc, SCREEN_WIDTH * 2 .getOldMenuItemScreenPosition pop af .oldMenuItemLoop @@ -163,12 +163,12 @@ PlaceMenuCursor:: jr z, .checkForArrow2 push af ldh a, [hUILayoutFlags] - bit 1, a ; is the menu double spaced? + bit BIT_DOUBLE_SPACED_MENU, a jr z, .doubleSpaced2 - ld bc, 20 + ld bc, SCREEN_WIDTH jr .getCurrentMenuItemScreenPosition .doubleSpaced2 - ld bc, 40 + ld bc, SCREEN_WIDTH * 2 .getCurrentMenuItemScreenPosition pop af .currentMenuItemLoop @@ -272,7 +272,7 @@ EnableAutoTextBoxDrawing:: jr AutoTextBoxDrawingCommon DisableAutoTextBoxDrawing:: - ld a, TRUE + ld a, 1 << BIT_NO_AUTO_TEXT_BOX AutoTextBoxDrawingCommon:: ld [wAutoTextBoxDrawingControl], a diff --git a/ram/hram.asm b/ram/hram.asm index e7c3ef3c8..1be1dab69 100644 --- a/ram/hram.asm +++ b/ram/hram.asm @@ -388,6 +388,7 @@ hClearLetterPrintingDelayFlags:: db ; bit 0: draw HP fraction to the right of bar instead of below (for party menu) ; bit 1: menu is double spaced +; bit 2: text is single spaced hUILayoutFlags:: db hFieldMoveMonMenuTopMenuItemX:: db diff --git a/scripts/CeruleanBadgeHouse.asm b/scripts/CeruleanBadgeHouse.asm index b1f6db7ff..541865236 100644 --- a/scripts/CeruleanBadgeHouse.asm +++ b/scripts/CeruleanBadgeHouse.asm @@ -1,5 +1,5 @@ CeruleanBadgeHouse_Script: - ld a, TRUE + ld a, 1 << BIT_NO_AUTO_TEXT_BOX ld [wAutoTextBoxDrawingControl], a dec a ld [wDoNotWaitForButtonPressAfterDisplayingText], a diff --git a/scripts/Museum1F.asm b/scripts/Museum1F.asm index 600c03c72..465c72f8a 100644 --- a/scripts/Museum1F.asm +++ b/scripts/Museum1F.asm @@ -1,5 +1,5 @@ Museum1F_Script: - ld a, TRUE + ld a, 1 << BIT_NO_AUTO_TEXT_BOX ld [wAutoTextBoxDrawingControl], a xor a ld [wDoNotWaitForButtonPressAfterDisplayingText], a diff --git a/scripts/OaksLab.asm b/scripts/OaksLab.asm index 89d6ef80f..71704c5b2 100644 --- a/scripts/OaksLab.asm +++ b/scripts/OaksLab.asm @@ -1,7 +1,7 @@ OaksLab_Script: CheckEvent EVENT_PALLET_AFTER_GETTING_POKEBALLS_2 call nz, OaksLabLoadTextPointers2Script - ld a, TRUE + ld a, 1 << BIT_NO_AUTO_TEXT_BOX ld [wAutoTextBoxDrawingControl], a xor a ld [wDoNotWaitForButtonPressAfterDisplayingText], a diff --git a/scripts/PewterMart.asm b/scripts/PewterMart.asm index 0a5baac2b..49a91977e 100644 --- a/scripts/PewterMart.asm +++ b/scripts/PewterMart.asm @@ -1,6 +1,6 @@ PewterMart_Script: call EnableAutoTextBoxDrawing - ld a, TRUE + ld a, 1 << BIT_NO_AUTO_TEXT_BOX ld [wAutoTextBoxDrawingControl], a ret diff --git a/scripts/SSAnne2FRooms.asm b/scripts/SSAnne2FRooms.asm index e7b88b3f9..3358759d8 100644 --- a/scripts/SSAnne2FRooms.asm +++ b/scripts/SSAnne2FRooms.asm @@ -1,5 +1,5 @@ SSAnne2FRooms_Script: - ld a, TRUE + ld a, 1 << BIT_NO_AUTO_TEXT_BOX ld [wAutoTextBoxDrawingControl], a xor a ld [wDoNotWaitForButtonPressAfterDisplayingText], a From c3f297e98b39294c9104354275f9642f21d577ad Mon Sep 17 00:00:00 2001 From: Vortyne <104168801+Vortyne@users.noreply.github.com> Date: Tue, 24 Sep 2024 08:32:47 -0400 Subject: [PATCH 15/19] Fix comment: Road -> Roar (#466) --- engine/battle/core.asm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 5e93393c5..c0d73bac2 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -417,7 +417,7 @@ MainInBattleLoop: jr c, .AIActionUsedEnemyFirst call ExecuteEnemyMove ld a, [wEscapedFromBattle] - and a ; was Teleport, Road, or Whirlwind used to escape from battle? + and a ; was Teleport, Roar, or Whirlwind used to escape from battle? ret nz ; if so, return ld a, b and a @@ -428,7 +428,7 @@ MainInBattleLoop: call DrawHUDsAndHPBars call ExecutePlayerMove ld a, [wEscapedFromBattle] - and a ; was Teleport, Road, or Whirlwind used to escape from battle? + and a ; was Teleport, Roar, or Whirlwind used to escape from battle? ret nz ; if so, return ld a, b and a @@ -441,7 +441,7 @@ MainInBattleLoop: .playerMovesFirst call ExecutePlayerMove ld a, [wEscapedFromBattle] - and a ; was Teleport, Road, or Whirlwind used to escape from battle? + and a ; was Teleport, Roar, or Whirlwind used to escape from battle? ret nz ; if so, return ld a, b and a @@ -455,7 +455,7 @@ MainInBattleLoop: jr c, .AIActionUsedPlayerFirst call ExecuteEnemyMove ld a, [wEscapedFromBattle] - and a ; was Teleport, Road, or Whirlwind used to escape from battle? + and a ; was Teleport, Roar, or Whirlwind used to escape from battle? ret nz ; if so, return ld a, b and a From b5d2540e7c56d7ae596ba49d105b1a01dd6ffd29 Mon Sep 17 00:00:00 2001 From: Sylvie <35663410+Rangi42@users.noreply.github.com> Date: Tue, 24 Sep 2024 09:33:33 -0400 Subject: [PATCH 16/19] Identify more bit flags (#465) * Identify more bit flags * Space --- .../hidden_objects/indigo_plateau_statues.asm | 2 +- engine/gfx/mon_icons.asm | 2 +- engine/gfx/screen_effects.asm | 2 +- engine/movie/oak_speech/oak_speech.asm | 4 ++-- engine/overworld/map_sprites.asm | 4 ++-- engine/overworld/movement.asm | 4 ++-- engine/overworld/player_state.asm | 20 +++++++++++++------ engine/overworld/spinners.asm | 2 +- home/overworld.asm | 2 +- home/pokemon.asm | 2 +- home/serial.asm | 2 +- home/uncompress.asm | 19 +++++++++++------- scripts/VictoryRoad2F.asm | 2 +- 13 files changed, 40 insertions(+), 27 deletions(-) diff --git a/engine/events/hidden_objects/indigo_plateau_statues.asm b/engine/events/hidden_objects/indigo_plateau_statues.asm index 23e94fcf2..f78a5a727 100644 --- a/engine/events/hidden_objects/indigo_plateau_statues.asm +++ b/engine/events/hidden_objects/indigo_plateau_statues.asm @@ -3,7 +3,7 @@ IndigoPlateauStatues:: ld hl, IndigoPlateauStatuesText1 call PrintText ld a, [wXCoord] - bit 0, a + bit 0, a ; even or odd? ld hl, IndigoPlateauStatuesText2 jr nz, .ok ld hl, IndigoPlateauStatuesText3 diff --git a/engine/gfx/mon_icons.asm b/engine/gfx/mon_icons.asm index e7016a1da..24e9446e4 100644 --- a/engine/gfx/mon_icons.asm +++ b/engine/gfx/mon_icons.asm @@ -269,7 +269,7 @@ GetPartyMonSpriteID: ld d, 0 add hl, de ld a, [hl] - bit 0, c + bit 0, c ; even or odd? jr nz, .skipSwap swap a ; use lower nybble if pokedex num is even .skipSwap diff --git a/engine/gfx/screen_effects.asm b/engine/gfx/screen_effects.asm index c7a68734e..7d0ccf7ea 100644 --- a/engine/gfx/screen_effects.asm +++ b/engine/gfx/screen_effects.asm @@ -61,7 +61,7 @@ PredefShakeScreenHorizontally: ldh a, [hMutateWX] xor b ldh [hMutateWX], a - bit 7, a + bit 7, a ; negative? jr z, .skipZeroing xor a ; zero a if it's negative .skipZeroing diff --git a/engine/movie/oak_speech/oak_speech.asm b/engine/movie/oak_speech/oak_speech.asm index 44b236c88..5c3644356 100644 --- a/engine/movie/oak_speech/oak_speech.asm +++ b/engine/movie/oak_speech/oak_speech.asm @@ -4,9 +4,9 @@ PrepareOakSpeech: ld a, [wOptions] push af ; Retrieve BIT_DEBUG_MODE set in DebugMenu for StartNewGameDebug. - ; BUG: StartNewGame carries over bit 5 from previous save files, + ; BUG: StartNewGame carries over BIT_ALWAYS_ON_BIKE from previous save files, ; which causes CheckForceBikeOrSurf to not return. - ; To fix this in debug builds, reset bit 5 here or in StartNewGame. + ; To fix this in debug builds, reset BIT_ALWAYS_ON_BIKE here or in StartNewGame. ; In non-debug builds, the instructions can be removed. ld a, [wStatusFlags6] push af diff --git a/engine/overworld/map_sprites.asm b/engine/overworld/map_sprites.asm index 75c46474b..57c2d4db5 100644 --- a/engine/overworld/map_sprites.asm +++ b/engine/overworld/map_sprites.asm @@ -187,7 +187,7 @@ LoadMapSpriteTilePatterns: jr nz, .loadWhileLCDOn pop af pop hl - set 3, h ; add $80 tiles to hl + set 3, h ; add $800 ($80 tiles) to hl (1 << 3 == $8) push hl ld h, d ld l, e @@ -200,7 +200,7 @@ LoadMapSpriteTilePatterns: .loadWhileLCDOn pop af pop hl - set 3, h ; add $80 tiles to hl + set 3, h ; add $800 ($80 tiles) to hl (1 << 3 == $8) ld b, a swap c call CopyVideoData ; load tile pattern data for sprite when walking diff --git a/engine/overworld/movement.asm b/engine/overworld/movement.asm index 5f95cf6c3..cb65c997a 100644 --- a/engine/overworld/movement.asm +++ b/engine/overworld/movement.asm @@ -641,7 +641,7 @@ CanWalkOntoTile: add SPRITESTATEDATA2_YDISPLACEMENT ld l, a ld a, [hli] ; x#SPRITESTATEDATA2_YDISPLACEMENT (initialized at $8, keep track of where a sprite did go) - bit 7, d ; check if going upwards (d=$ff) + bit 7, d ; check if going upwards (d == -1) jr nz, .upwards add d ; bug: these tests against $5 probably were supposed to prevent @@ -658,7 +658,7 @@ CanWalkOntoTile: .checkHorizontal ld d, a ld a, [hl] ; x#SPRITESTATEDATA2_XDISPLACEMENT (initialized at $8, keep track of where a sprite did go) - bit 7, e ; check if going left (e=$ff) + bit 7, e ; check if going left (e == -1) jr nz, .left add e cp $5 ; compare, but no conditional jump like in the vertical check above (bug?) diff --git a/engine/overworld/player_state.asm b/engine/overworld/player_state.asm index 4711bb5c4..4da437da9 100644 --- a/engine/overworld/player_state.asm +++ b/engine/overworld/player_state.asm @@ -294,6 +294,13 @@ _GetTileAndCoordsInFrontOfPlayer: ld [wTileInFrontOfPlayer], a ret +; hPlayerFacing + const_def + const BIT_FACING_DOWN ; 0 + const BIT_FACING_UP ; 1 + const BIT_FACING_LEFT ; 2 + const BIT_FACING_RIGHT ; 3 + GetTileTwoStepsInFrontOfPlayer: xor a ldh [hPlayerFacing], a @@ -306,7 +313,7 @@ GetTileTwoStepsInFrontOfPlayer: jr nz, .notFacingDown ; facing down ld hl, hPlayerFacing - set 0, [hl] + set BIT_FACING_DOWN, [hl] lda_coord 8, 13 inc d jr .storeTile @@ -315,7 +322,7 @@ GetTileTwoStepsInFrontOfPlayer: jr nz, .notFacingUp ; facing up ld hl, hPlayerFacing - set 1, [hl] + set BIT_FACING_UP, [hl] lda_coord 8, 5 dec d jr .storeTile @@ -324,7 +331,7 @@ GetTileTwoStepsInFrontOfPlayer: jr nz, .notFacingLeft ; facing left ld hl, hPlayerFacing - set 2, [hl] + set BIT_FACING_LEFT, [hl] lda_coord 4, 9 dec e jr .storeTile @@ -333,7 +340,7 @@ GetTileTwoStepsInFrontOfPlayer: jr nz, .storeTile ; facing right ld hl, hPlayerFacing - set 3, [hl] + set BIT_FACING_RIGHT, [hl] lda_coord 12, 9 inc e .storeTile @@ -385,7 +392,7 @@ CheckForBoulderCollisionWithSprites: ld de, $f ld hl, wSprite01StateData2MapY ldh a, [hPlayerFacing] - and $3 ; facing up or down? + and (1 << BIT_FACING_UP) | (1 << BIT_FACING_DOWN) jr z, .pushingHorizontallyLoop .pushingVerticallyLoop inc hl @@ -396,6 +403,7 @@ CheckForBoulderCollisionWithSprites: ld a, [hli] ld b, a ldh a, [hPlayerFacing] + assert BIT_FACING_DOWN == 0 rrca jr c, .pushingDown ; pushing up @@ -421,7 +429,7 @@ CheckForBoulderCollisionWithSprites: jr nz, .nextSprite2 ld b, [hl] ldh a, [hPlayerFacing] - bit 2, a + bit BIT_FACING_LEFT, a jr nz, .pushingLeft ; pushing right ldh a, [hPlayerXCoord] diff --git a/engine/overworld/spinners.asm b/engine/overworld/spinners.asm index 98b478c4b..261a939e2 100644 --- a/engine/overworld/spinners.asm +++ b/engine/overworld/spinners.asm @@ -15,7 +15,7 @@ LoadSpinnerArrowTiles:: ld hl, GymSpinnerArrows .gotSpinnerArrows ld a, [wSimulatedJoypadStatesIndex] - bit 0, a + bit 0, a ; even or odd? jr nz, .alternateGraphics ld de, 6 * 4 add hl, de diff --git a/home/overworld.asm b/home/overworld.asm index e43ebc813..85969e46e 100644 --- a/home/overworld.asm +++ b/home/overworld.asm @@ -2002,7 +2002,7 @@ LoadPlayerSpriteGraphicsCommon:: jr nc, .noCarry inc d .noCarry - set 3, h + set 3, h ; add $800 ($80 tiles) to hl (1 << 3 == $8) lb bc, BANK(RedSprite), $0c jp CopyVideoData diff --git a/home/pokemon.asm b/home/pokemon.asm index 54d69bba0..7cc5f2d17 100644 --- a/home/pokemon.asm +++ b/home/pokemon.asm @@ -252,7 +252,7 @@ HandlePartyMenuInput:: jp nz, .swappingPokemon pop af ldh [hTileAnimations], a - bit 1, b + bit BIT_B_BUTTON, b jr nz, .noPokemonChosen ld a, [wPartyCount] and a diff --git a/home/serial.asm b/home/serial.asm index f44772dfe..58111de6f 100644 --- a/home/serial.asm +++ b/home/serial.asm @@ -30,7 +30,7 @@ Serial:: ldh [rDIV], a .waitLoop ldh a, [rDIV] - bit 7, a + bit 7, a ; wait until rDIV has incremented from $3 to $80 or more jr nz, .waitLoop ld a, START_TRANSFER_EXTERNAL_CLOCK ldh [rSC], a diff --git a/home/uncompress.asm b/home/uncompress.asm index 0e609f1c1..9e4344975 100644 --- a/home/uncompress.asm +++ b/home/uncompress.asm @@ -1,3 +1,8 @@ +; wSpriteLoadFlags bits, streamed from compressed sprite data + const_def + const BIT_USE_SPRITE_BUFFER_2 ; 0 + const BIT_LAST_SPRITE_CHUNK ; 1 + ; bankswitches and runs _UncompressSpriteData ; bank is given in a, sprite input stream is pointed to in wSpriteInputPtr UncompressSpriteData:: @@ -47,7 +52,7 @@ _UncompressSpriteData:: add a ld [wSpriteWidth], a call ReadNextInputBit - ld [wSpriteLoadFlags], a ; initialite bit1 to 0 and bit0 to the first input bit + ld [wSpriteLoadFlags], a ; initialize bit1 to 0 and bit0 to the first input bit ; this will load two chunks of data to sSpriteBuffer1 and sSpriteBuffer2 ; bit 0 decides in which one the first chunk is placed ; fall through @@ -58,13 +63,13 @@ _UncompressSpriteData:: UncompressSpriteDataLoop:: ld hl, sSpriteBuffer1 ld a, [wSpriteLoadFlags] - bit 0, a + bit BIT_USE_SPRITE_BUFFER_2, a jr z, .useSpriteBuffer1 ; check which buffer to use ld hl, sSpriteBuffer2 .useSpriteBuffer1 call StoreSpriteOutputPointer ld a, [wSpriteLoadFlags] - bit 1, a + bit BIT_LAST_SPRITE_CHUNK, a jr z, .startDecompression ; check if last iteration call ReadNextInputBit ; if last chunk, read 1-2 bit unpacking mode and a @@ -196,10 +201,10 @@ MoveToNextBufferPosition:: xor a ld [wSpriteCurPosX], a ld a, [wSpriteLoadFlags] - bit 1, a + bit BIT_LAST_SPRITE_CHUNK, a jr nz, .done ; test if there is one more sprite to go - xor $1 - set 1, a + xor 1 << BIT_USE_SPRITE_BUFFER_2 + set BIT_LAST_SPRITE_CHUNK, a ld [wSpriteLoadFlags], a jp UncompressSpriteDataLoop .done @@ -540,7 +545,7 @@ ReverseNybble:: ; resets sprite buffer pointers to buffer 1 and 2, depending on wSpriteLoadFlags ResetSpriteBufferPointers:: ld a, [wSpriteLoadFlags] - bit 0, a + bit BIT_USE_SPRITE_BUFFER_2, a jr nz, .buffer2Selected ld de, sSpriteBuffer1 ld hl, sSpriteBuffer2 diff --git a/scripts/VictoryRoad2F.asm b/scripts/VictoryRoad2F.asm index 347d16a53..5e31da7ae 100644 --- a/scripts/VictoryRoad2F.asm +++ b/scripts/VictoryRoad2F.asm @@ -27,7 +27,7 @@ VictoryRoad2FCheckBoulderEventScript: call VictoryRoad2FReplaceTileBlockScript pop af .not_on_switch - bit 7, a + CheckEventReuseA EVENT_VICTORY_ROAD_2_BOULDER_ON_SWITCH2 ret z ld a, $1d lb bc, 7, 11 From 6ae63a8ceac9c191ad89a1e9382ce3c87e6b2481 Mon Sep 17 00:00:00 2001 From: Sylvie <35663410+Rangi42@users.noreply.github.com> Date: Tue, 24 Sep 2024 10:48:10 -0400 Subject: [PATCH 17/19] Identify hardware register bits (#469) --- constants/hardware_constants.asm | 15 +++++++++++++-- engine/movie/hall_of_fame.asm | 4 ++-- engine/movie/intro.asm | 4 ++-- home/init.asm | 4 ++-- home/lcd.asm | 4 ++-- home/load_font.asm | 6 +++--- 6 files changed, 24 insertions(+), 13 deletions(-) diff --git a/constants/hardware_constants.asm b/constants/hardware_constants.asm index 6f6d2df81..005a69345 100644 --- a/constants/hardware_constants.asm +++ b/constants/hardware_constants.asm @@ -81,8 +81,14 @@ DEF rWave_d EQU $ff3d DEF rWave_e EQU $ff3e DEF rWave_f EQU $ff3f DEF rLCDC EQU $ff40 ; LCD Control (R/W) -DEF rLCDC_ENABLE EQU 7 -DEF rLCDC_ENABLE_MASK EQU 1 << rLCDC_ENABLE +DEF rLCDC_BG_PRIORITY EQU 0 +DEF rLCDC_SPRITES_ENABLE EQU 1 +DEF rLCDC_SPRITE_SIZE EQU 2 +DEF rLCDC_BG_TILEMAP EQU 3 +DEF rLCDC_TILE_DATA EQU 4 +DEF rLCDC_WINDOW_ENABLE EQU 5 +DEF rLCDC_WINDOW_TILEMAP EQU 6 +DEF rLCDC_ENABLE EQU 7 DEF rSTAT EQU $ff41 ; LCDC Status (R/W) DEF rSCY EQU $ff42 ; Scroll Y (R/W) DEF rSCX EQU $ff43 ; Scroll X (R/W) @@ -111,3 +117,8 @@ DEF rSVBK EQU $ff70 ; CGB Mode Only - WRAM Bank DEF rPCM12 EQU $ff76 ; Channels 1 & 2 Amplitude (R) DEF rPCM34 EQU $ff77 ; Channels 3 & 4 Amplitude (R) DEF rIE EQU $ffff ; Interrupt Enable (R/W) +DEF rIE_VBLANK EQU 0 +DEF rIE_LCD EQU 1 +DEF rIE_TIMER EQU 2 +DEF rIE_SERIAL EQU 3 +DEF rIE_JOYPAD EQU 4 diff --git a/engine/movie/hall_of_fame.asm b/engine/movie/hall_of_fame.asm index a43ec5dac..aebe65f0f 100644 --- a/engine/movie/hall_of_fame.asm +++ b/engine/movie/hall_of_fame.asm @@ -12,7 +12,7 @@ AnimateHallOfFame: call FillMemory call EnableLCD ld hl, rLCDC - set 3, [hl] + set rLCDC_BG_TILEMAP, [hl] xor a ld hl, wHallOfFame ld bc, HOF_TEAM @@ -88,7 +88,7 @@ AnimateHallOfFame: xor a ldh [hWY], a ld hl, rLCDC - res 3, [hl] + res rLCDC_BG_TILEMAP, [hl] ret HallOfFameText: diff --git a/engine/movie/intro.asm b/engine/movie/intro.asm index f489c60b6..552b13582 100644 --- a/engine/movie/intro.asm +++ b/engine/movie/intro.asm @@ -319,8 +319,8 @@ PlayShootingStar: call LoadIntroGraphics call EnableLCD ld hl, rLCDC - res 5, [hl] - set 3, [hl] + res rLCDC_WINDOW_ENABLE, [hl] + set rLCDC_BG_TILEMAP, [hl] ld c, 64 call DelayFrames farcall AnimateShootingStar diff --git a/home/init.asm b/home/init.asm index 619a24938..ab85192d6 100644 --- a/home/init.asm +++ b/home/init.asm @@ -8,7 +8,6 @@ SoftReset:: Init:: ; Program init. -DEF rLCDC_DEFAULT EQU %11100011 ; * LCD enabled ; * Window tile map at $9C00 ; * Window display enabled @@ -17,6 +16,7 @@ DEF rLCDC_DEFAULT EQU %11100011 ; * 8x8 OBJ size ; * OBJ display enabled ; * BG display enabled +DEF rLCDC_DEFAULT EQU (1 << rLCDC_ENABLE) | (1 << rLCDC_WINDOW_TILEMAP) | (1 << rLCDC_WINDOW_ENABLE) | (1 << rLCDC_SPRITES_ENABLE) | (1 << rLCDC_BG_PRIORITY) di @@ -35,7 +35,7 @@ DEF rLCDC_DEFAULT EQU %11100011 ldh [rOBP0], a ldh [rOBP1], a - ld a, rLCDC_ENABLE_MASK + ld a, 1 << rLCDC_ENABLE ldh [rLCDC], a call DisableLCD diff --git a/home/lcd.asm b/home/lcd.asm index 5c496824b..aef6d43fd 100644 --- a/home/lcd.asm +++ b/home/lcd.asm @@ -3,7 +3,7 @@ DisableLCD:: ldh [rIF], a ldh a, [rIE] ld b, a - res 0, a + res rIE_VBLANK, a ldh [rIE], a .wait @@ -12,7 +12,7 @@ DisableLCD:: jr nz, .wait ldh a, [rLCDC] - and ~rLCDC_ENABLE_MASK + and ~(1 << rLCDC_ENABLE) ldh [rLCDC], a ld a, b ldh [rIE], a diff --git a/home/load_font.asm b/home/load_font.asm index 3b56d3a88..0f48e84ca 100644 --- a/home/load_font.asm +++ b/home/load_font.asm @@ -1,6 +1,6 @@ LoadFontTilePatterns:: ldh a, [rLCDC] - bit 7, a ; is the LCD enabled? + bit rLCDC_ENABLE, a jr nz, .on .off ld hl, FontGraphics @@ -16,7 +16,7 @@ LoadFontTilePatterns:: LoadTextBoxTilePatterns:: ldh a, [rLCDC] - bit 7, a ; is the LCD enabled? + bit rLCDC_ENABLE, a jr nz, .on .off ld hl, TextBoxGraphics @@ -32,7 +32,7 @@ LoadTextBoxTilePatterns:: LoadHpBarAndStatusTilePatterns:: ldh a, [rLCDC] - bit 7, a ; is the LCD enabled? + bit rLCDC_ENABLE, a jr nz, .on .off ld hl, HpBarAndStatusGraphics From 635b9c4cab523100a797b17b28788281159371c0 Mon Sep 17 00:00:00 2001 From: Sylvie <35663410+Rangi42@users.noreply.github.com> Date: Tue, 24 Sep 2024 11:39:44 -0400 Subject: [PATCH 18/19] Identify `wCurrentMapScriptFlags` bits (#467) --- constants/ram_constants.asm | 6 ++++++ engine/events/card_key.asm | 2 +- engine/events/elevator.asm | 2 +- engine/events/hidden_objects/cinnabar_gym_quiz.asm | 2 +- engine/events/hidden_objects/vermilion_gym_trash.asm | 2 +- engine/menus/main_menu.asm | 2 +- home/overworld.asm | 8 ++++---- home/trainers.asm | 4 ++-- ram/wram.asm | 5 ++++- scripts/AgathasRoom.asm | 4 ++-- scripts/BrunosRoom.asm | 4 ++-- scripts/CeladonGym.asm | 4 ++-- scripts/CeladonMartElevator.asm | 8 ++++---- scripts/CeruleanGym.asm | 4 ++-- scripts/CinnabarGym.asm | 10 +++++----- scripts/CinnabarIsland.asm | 2 +- scripts/FuchsiaGym.asm | 4 ++-- scripts/GameCorner.asm | 12 ++++++------ scripts/IndigoPlateauLobby.asm | 4 ++-- scripts/LancesRoom.asm | 6 +++--- scripts/LoreleisRoom.asm | 4 ++-- scripts/PewterGym.asm | 4 ++-- scripts/PokemonMansion1F.asm | 6 +++--- scripts/PokemonMansion2F.asm | 6 +++--- scripts/PokemonMansion3F.asm | 4 ++-- scripts/PokemonMansionB1F.asm | 4 ++-- scripts/RocketHideoutB1F.asm | 4 ++-- scripts/RocketHideoutB4F.asm | 6 +++--- scripts/RocketHideoutElevator.asm | 8 ++++---- scripts/Route23.asm | 4 ++-- scripts/Route25.asm | 4 ++-- scripts/SaffronGym.asm | 4 ++-- scripts/SilphCo10F.asm | 4 ++-- scripts/SilphCo11F.asm | 4 ++-- scripts/SilphCo2F.asm | 4 ++-- scripts/SilphCo3F.asm | 4 ++-- scripts/SilphCo4F.asm | 4 ++-- scripts/SilphCo5F.asm | 4 ++-- scripts/SilphCo6F.asm | 4 ++-- scripts/SilphCo7F.asm | 4 ++-- scripts/SilphCo8F.asm | 4 ++-- scripts/SilphCo9F.asm | 4 ++-- scripts/SilphCoElevator.asm | 8 ++++---- scripts/VermilionCity.asm | 8 ++++---- scripts/VermilionGym.asm | 8 ++++---- scripts/VictoryRoad1F.asm | 6 +++--- scripts/VictoryRoad2F.asm | 10 +++++----- scripts/VictoryRoad3F.asm | 6 +++--- 48 files changed, 124 insertions(+), 115 deletions(-) diff --git a/constants/ram_constants.asm b/constants/ram_constants.asm index 8102cc7e5..756aaa68f 100644 --- a/constants/ram_constants.asm +++ b/constants/ram_constants.asm @@ -23,6 +23,12 @@ DEF BIT_TEXT_PREDEF EQU 0 ; wFontLoaded DEF BIT_FONT_LOADED EQU 0 +; wCurrentMapScriptFlags + const_def 5 + const BIT_CUR_MAP_LOADED_1 ; 5 + const BIT_CUR_MAP_LOADED_2 ; 6 + const BIT_CUR_MAP_USED_ELEVATOR ; 7 + ; wOptions DEF TEXT_DELAY_MASK EQU %111 const_def 6 diff --git a/engine/events/card_key.asm b/engine/events/card_key.asm index 1597e12be..f3fa17fe0 100644 --- a/engine/events/card_key.asm +++ b/engine/events/card_key.asm @@ -50,7 +50,7 @@ PrintCardKeyText: ld [wNewTileBlockID], a predef ReplaceTileBlock ld hl, wCurrentMapScriptFlags - set 5, [hl] + set BIT_CUR_MAP_LOADED_1, [hl] ld a, SFX_GO_INSIDE jp PlaySound .noCardKey diff --git a/engine/events/elevator.asm b/engine/events/elevator.asm index 8e871456e..9d9b712a9 100644 --- a/engine/events/elevator.asm +++ b/engine/events/elevator.asm @@ -20,7 +20,7 @@ DisplayElevatorFloorMenu: ld [wListScrollOffset], a ret c ld hl, wCurrentMapScriptFlags - set 7, [hl] + set BIT_CUR_MAP_USED_ELEVATOR, [hl] ld hl, wElevatorWarpMaps ld a, [wWhichPokemon] add a diff --git a/engine/events/hidden_objects/cinnabar_gym_quiz.asm b/engine/events/hidden_objects/cinnabar_gym_quiz.asm index 69f03f2c3..a14bd1988 100644 --- a/engine/events/hidden_objects/cinnabar_gym_quiz.asm +++ b/engine/events/hidden_objects/cinnabar_gym_quiz.asm @@ -83,7 +83,7 @@ CinnabarGymQuiz_AskQuestion: cp c jr nz, .wrongAnswer ld hl, wCurrentMapScriptFlags - set 5, [hl] + set BIT_CUR_MAP_LOADED_1, [hl] ldh a, [hGymGateIndex] ldh [hBackupGymGateIndex], a ld hl, CinnabarGymQuizCorrectText diff --git a/engine/events/hidden_objects/vermilion_gym_trash.asm b/engine/events/hidden_objects/vermilion_gym_trash.asm index c2bfed067..92fb1406b 100644 --- a/engine/events/hidden_objects/vermilion_gym_trash.asm +++ b/engine/events/hidden_objects/vermilion_gym_trash.asm @@ -97,7 +97,7 @@ GymTrashScript: ; Completed the trash can puzzle. SetEvent EVENT_2ND_LOCK_OPENED ld hl, wCurrentMapScriptFlags - set 6, [hl] + set BIT_CUR_MAP_LOADED_2, [hl] tx_pre_id VermilionGymTrashSuccessText3 diff --git a/engine/menus/main_menu.asm b/engine/menus/main_menu.asm index df9f523fd..8bd6f05ec 100644 --- a/engine/menus/main_menu.asm +++ b/engine/menus/main_menu.asm @@ -91,7 +91,7 @@ MainMenu: .choseContinue call DisplayContinueGameInfo ld hl, wCurrentMapScriptFlags - set 5, [hl] + set BIT_CUR_MAP_LOADED_1, [hl] .inputLoop xor a ldh [hJoyPressed], a diff --git a/home/overworld.asm b/home/overworld.asm index 85969e46e..80638815e 100644 --- a/home/overworld.asm +++ b/home/overworld.asm @@ -33,8 +33,8 @@ EnterMap:: res BIT_NO_NPC_FACE_PLAYER, [hl] call UpdateSprites ld hl, wCurrentMapScriptFlags - set 5, [hl] - set 6, [hl] + set BIT_CUR_MAP_LOADED_1, [hl] + set BIT_CUR_MAP_LOADED_2, [hl] xor a ld [wJoyIgnore], a @@ -329,8 +329,8 @@ OverworldLoopLessDelay:: ld hl, wStatusFlags7 res BIT_TRAINER_BATTLE, [hl] ld hl, wCurrentMapScriptFlags - set 5, [hl] - set 6, [hl] + set BIT_CUR_MAP_LOADED_1, [hl] + set BIT_CUR_MAP_LOADED_2, [hl] xor a ldh [hJoyHeld], a ld a, [wCurMap] diff --git a/home/trainers.asm b/home/trainers.asm index 0a466cc1e..bcd158508 100644 --- a/home/trainers.asm +++ b/home/trainers.asm @@ -184,8 +184,8 @@ StartTrainerBattle:: EndTrainerBattle:: ld hl, wCurrentMapScriptFlags - set 5, [hl] - set 6, [hl] + set BIT_CUR_MAP_LOADED_1, [hl] + set BIT_CUR_MAP_LOADED_2, [hl] ld hl, wStatusFlags3 res BIT_PRINT_END_BATTLE_TEXT, [hl] ld hl, wMiscFlags diff --git a/ram/wram.asm b/ram/wram.asm index 48616226c..c94c682f9 100644 --- a/ram/wram.asm +++ b/ram/wram.asm @@ -1593,7 +1593,10 @@ wIsKeyItem:: db wTextBoxID:: db -wCurrentMapScriptFlags:: db ; not exactly sure what this is used for, but it seems to be used as a multipurpose temp flag value +; bit 5: set when maps first load; can be reset to re-run a script +; bit 6: set when maps first load; can be reset to re-run a script (used less often than bit 5) +; bit 7: set when using an elevator map's menu; triggers the shaking animation +wCurrentMapScriptFlags:: db wCurEnemyLevel:: db diff --git a/scripts/AgathasRoom.asm b/scripts/AgathasRoom.asm index 0f3acc18c..2d0dca082 100644 --- a/scripts/AgathasRoom.asm +++ b/scripts/AgathasRoom.asm @@ -11,8 +11,8 @@ AgathasRoom_Script: AgathaShowOrHideExitBlock: ; Blocks or clears the exit to the next room. ld hl, wCurrentMapScriptFlags - bit 5, [hl] - res 5, [hl] + bit BIT_CUR_MAP_LOADED_1, [hl] + res BIT_CUR_MAP_LOADED_1, [hl] ret z CheckEvent EVENT_BEAT_AGATHAS_ROOM_TRAINER_0 jr z, .blockExitToNextRoom diff --git a/scripts/BrunosRoom.asm b/scripts/BrunosRoom.asm index 94ec7d17e..6d7fde6e2 100644 --- a/scripts/BrunosRoom.asm +++ b/scripts/BrunosRoom.asm @@ -11,8 +11,8 @@ BrunosRoom_Script: BrunoShowOrHideExitBlock: ; Blocks or clears the exit to the next room. ld hl, wCurrentMapScriptFlags - bit 5, [hl] - res 5, [hl] + bit BIT_CUR_MAP_LOADED_1, [hl] + res BIT_CUR_MAP_LOADED_1, [hl] ret z CheckEvent EVENT_BEAT_BRUNOS_ROOM_TRAINER_0 jr z, .blockExitToNextRoom diff --git a/scripts/CeladonGym.asm b/scripts/CeladonGym.asm index ca7da4e50..f95d129a8 100644 --- a/scripts/CeladonGym.asm +++ b/scripts/CeladonGym.asm @@ -1,7 +1,7 @@ CeladonGym_Script: ld hl, wCurrentMapScriptFlags - bit 6, [hl] - res 6, [hl] + bit BIT_CUR_MAP_LOADED_2, [hl] + res BIT_CUR_MAP_LOADED_2, [hl] call nz, .LoadNames call EnableAutoTextBoxDrawing ld hl, CeladonGymTrainerHeaders diff --git a/scripts/CeladonMartElevator.asm b/scripts/CeladonMartElevator.asm index 9a2842f32..69686fa8c 100644 --- a/scripts/CeladonMartElevator.asm +++ b/scripts/CeladonMartElevator.asm @@ -1,12 +1,12 @@ CeladonMartElevator_Script: ld hl, wCurrentMapScriptFlags - bit 5, [hl] - res 5, [hl] + bit BIT_CUR_MAP_LOADED_1, [hl] + res BIT_CUR_MAP_LOADED_1, [hl] push hl call nz, CeladonMartElevatorStoreWarpEntriesScript pop hl - bit 7, [hl] - res 7, [hl] + bit BIT_CUR_MAP_USED_ELEVATOR, [hl] + res BIT_CUR_MAP_USED_ELEVATOR, [hl] call nz, CeladonMartElevatorShakeScript xor a ld [wAutoTextBoxDrawingControl], a diff --git a/scripts/CeruleanGym.asm b/scripts/CeruleanGym.asm index 37d5e4059..e924907ad 100644 --- a/scripts/CeruleanGym.asm +++ b/scripts/CeruleanGym.asm @@ -1,7 +1,7 @@ CeruleanGym_Script: ld hl, wCurrentMapScriptFlags - bit 6, [hl] - res 6, [hl] + bit BIT_CUR_MAP_LOADED_2, [hl] + res BIT_CUR_MAP_LOADED_2, [hl] call nz, .LoadNames call EnableAutoTextBoxDrawing ld hl, CeruleanGymTrainerHeaders diff --git a/scripts/CinnabarGym.asm b/scripts/CinnabarGym.asm index b7c9e1bab..efda64a5a 100644 --- a/scripts/CinnabarGym.asm +++ b/scripts/CinnabarGym.asm @@ -7,13 +7,13 @@ CinnabarGym_Script: CinnabarGymSetMapAndTiles: ld hl, wCurrentMapScriptFlags - bit 6, [hl] - res 6, [hl] + bit BIT_CUR_MAP_LOADED_2, [hl] + res BIT_CUR_MAP_LOADED_2, [hl] push hl call nz, .LoadNames pop hl - bit 5, [hl] - res 5, [hl] + bit BIT_CUR_MAP_LOADED_1, [hl] + res BIT_CUR_MAP_LOADED_1, [hl] call nz, UpdateCinnabarGymGateTileBlocks ResetEvent EVENT_2A7 ret @@ -170,7 +170,7 @@ CinnabarGymReceiveTM38: SetEventRange EVENT_BEAT_CINNABAR_GYM_TRAINER_0, EVENT_BEAT_CINNABAR_GYM_TRAINER_6 ld hl, wCurrentMapScriptFlags - set 5, [hl] + set BIT_CUR_MAP_LOADED_1, [hl] jp CinnabarGymResetScripts diff --git a/scripts/CinnabarIsland.asm b/scripts/CinnabarIsland.asm index ed38f6902..f2a36afb3 100644 --- a/scripts/CinnabarIsland.asm +++ b/scripts/CinnabarIsland.asm @@ -1,7 +1,7 @@ CinnabarIsland_Script: call EnableAutoTextBoxDrawing ld hl, wCurrentMapScriptFlags - set 5, [hl] + set BIT_CUR_MAP_LOADED_1, [hl] ResetEvent EVENT_MANSION_SWITCH_ON ResetEvent EVENT_LAB_STILL_REVIVING_FOSSIL ld hl, CinnabarIsland_ScriptPointers diff --git a/scripts/FuchsiaGym.asm b/scripts/FuchsiaGym.asm index 8ccebe409..c983c896d 100644 --- a/scripts/FuchsiaGym.asm +++ b/scripts/FuchsiaGym.asm @@ -10,8 +10,8 @@ FuchsiaGym_Script: .LoadNames: ld hl, wCurrentMapScriptFlags - bit 6, [hl] - res 6, [hl] + bit BIT_CUR_MAP_LOADED_2, [hl] + res BIT_CUR_MAP_LOADED_2, [hl] ret z ld hl, .CityName ld de, .LeaderName diff --git a/scripts/GameCorner.asm b/scripts/GameCorner.asm index 5d5236c5f..cac3170c1 100644 --- a/scripts/GameCorner.asm +++ b/scripts/GameCorner.asm @@ -8,8 +8,8 @@ GameCorner_Script: GameCornerSelectLuckySlotMachine: ld hl, wCurrentMapScriptFlags - bit 6, [hl] - res 6, [hl] + bit BIT_CUR_MAP_LOADED_2, [hl] + res BIT_CUR_MAP_LOADED_2, [hl] ret z call Random ldh a, [hRandomAdd] @@ -25,8 +25,8 @@ GameCornerSelectLuckySlotMachine: GameCornerSetRocketHideoutDoorTile: ld hl, wCurrentMapScriptFlags - bit 5, [hl] - res 5, [hl] + bit BIT_CUR_MAP_LOADED_1, [hl] + res BIT_CUR_MAP_LOADED_1, [hl] ret z CheckEvent EVENT_FOUND_ROCKET_HIDEOUT ret nz @@ -111,8 +111,8 @@ GameCornerRocketExitScript: ld [wMissableObjectIndex], a predef HideObject ld hl, wCurrentMapScriptFlags - set 5, [hl] - set 6, [hl] + set BIT_CUR_MAP_LOADED_1, [hl] + set BIT_CUR_MAP_LOADED_2, [hl] ld a, SCRIPT_GAMECORNER_DEFAULT ld [wGameCornerCurScript], a ret diff --git a/scripts/IndigoPlateauLobby.asm b/scripts/IndigoPlateauLobby.asm index fd8ecf3cc..8ac87030f 100644 --- a/scripts/IndigoPlateauLobby.asm +++ b/scripts/IndigoPlateauLobby.asm @@ -2,8 +2,8 @@ IndigoPlateauLobby_Script: call Serial_TryEstablishingExternallyClockedConnection call EnableAutoTextBoxDrawing ld hl, wCurrentMapScriptFlags - bit 6, [hl] - res 6, [hl] + bit BIT_CUR_MAP_LOADED_2, [hl] + res BIT_CUR_MAP_LOADED_2, [hl] ret z ResetEvent EVENT_VICTORY_ROAD_1_BOULDER_ON_SWITCH ; Reset Elite Four events if the player started challenging them before diff --git a/scripts/LancesRoom.asm b/scripts/LancesRoom.asm index 31b0f2408..235deac1b 100644 --- a/scripts/LancesRoom.asm +++ b/scripts/LancesRoom.asm @@ -10,8 +10,8 @@ LancesRoom_Script: LanceShowOrHideEntranceBlocks: ld hl, wCurrentMapScriptFlags - bit 5, [hl] - res 5, [hl] + bit BIT_CUR_MAP_LOADED_1, [hl] + res BIT_CUR_MAP_LOADED_1, [hl] ret z CheckEvent EVENT_LANCES_ROOM_LOCK_DOOR jr nz, .closeEntrance @@ -71,7 +71,7 @@ LancesRoomDefaultScript: CheckAndSetEvent EVENT_LANCES_ROOM_LOCK_DOOR ret nz ld hl, wCurrentMapScriptFlags - set 5, [hl] + set BIT_CUR_MAP_LOADED_1, [hl] ld a, SFX_GO_INSIDE call PlaySound jp LanceShowOrHideEntranceBlocks diff --git a/scripts/LoreleisRoom.asm b/scripts/LoreleisRoom.asm index ec88f73e4..455561b80 100644 --- a/scripts/LoreleisRoom.asm +++ b/scripts/LoreleisRoom.asm @@ -11,8 +11,8 @@ LoreleisRoom_Script: LoreleiShowOrHideExitBlock: ; Blocks or clears the exit to the next room. ld hl, wCurrentMapScriptFlags - bit 5, [hl] - res 5, [hl] + bit BIT_CUR_MAP_LOADED_1, [hl] + res BIT_CUR_MAP_LOADED_1, [hl] ret z ld hl, wElite4Flags set BIT_STARTED_ELITE_4, [hl] diff --git a/scripts/PewterGym.asm b/scripts/PewterGym.asm index 0029be19d..6c4c94431 100644 --- a/scripts/PewterGym.asm +++ b/scripts/PewterGym.asm @@ -1,7 +1,7 @@ PewterGym_Script: ld hl, wCurrentMapScriptFlags - bit 6, [hl] - res 6, [hl] + bit BIT_CUR_MAP_LOADED_2, [hl] + res BIT_CUR_MAP_LOADED_2, [hl] call nz, .LoadNames call EnableAutoTextBoxDrawing ld hl, PewterGymTrainerHeaders diff --git a/scripts/PokemonMansion1F.asm b/scripts/PokemonMansion1F.asm index a93bd33b3..d06a234a9 100644 --- a/scripts/PokemonMansion1F.asm +++ b/scripts/PokemonMansion1F.asm @@ -10,8 +10,8 @@ PokemonMansion1F_Script: Mansion1CheckReplaceSwitchDoorBlocks: ld hl, wCurrentMapScriptFlags - bit 5, [hl] - res 5, [hl] + bit BIT_CUR_MAP_LOADED_1, [hl] + res BIT_CUR_MAP_LOADED_1, [hl] ret z CheckEvent EVENT_MANSION_SWITCH_ON jr nz, .switchTurnedOn @@ -103,7 +103,7 @@ PokemonMansion1FSwitchText: ld a, $1 ld [wDoNotWaitForButtonPressAfterDisplayingText], a ld hl, wCurrentMapScriptFlags - set 5, [hl] + set BIT_CUR_MAP_LOADED_1, [hl] ld hl, .PressedText call PrintText ld a, SFX_GO_INSIDE diff --git a/scripts/PokemonMansion2F.asm b/scripts/PokemonMansion2F.asm index df424a199..7da9e50f0 100644 --- a/scripts/PokemonMansion2F.asm +++ b/scripts/PokemonMansion2F.asm @@ -10,8 +10,8 @@ PokemonMansion2F_Script: Mansion2CheckReplaceSwitchDoorBlocks: ld hl, wCurrentMapScriptFlags - bit 5, [hl] - res 5, [hl] + bit BIT_CUR_MAP_LOADED_1, [hl] + res BIT_CUR_MAP_LOADED_1, [hl] ret z CheckEvent EVENT_MANSION_SWITCH_ON jr nz, .switchTurnedOn @@ -108,7 +108,7 @@ PokemonMansion2FSwitchText: ld a, $1 ld [wDoNotWaitForButtonPressAfterDisplayingText], a ld hl, wCurrentMapScriptFlags - set 5, [hl] + set BIT_CUR_MAP_LOADED_1, [hl] ld hl, .PressedText call PrintText ld a, SFX_GO_INSIDE diff --git a/scripts/PokemonMansion3F.asm b/scripts/PokemonMansion3F.asm index f53474467..de8bd1dd4 100644 --- a/scripts/PokemonMansion3F.asm +++ b/scripts/PokemonMansion3F.asm @@ -10,8 +10,8 @@ PokemonMansion3F_Script: Mansion3CheckReplaceSwitchDoorBlocks: ld hl, wCurrentMapScriptFlags - bit 5, [hl] - res 5, [hl] + bit BIT_CUR_MAP_LOADED_1, [hl] + res BIT_CUR_MAP_LOADED_1, [hl] ret z CheckEvent EVENT_MANSION_SWITCH_ON jr nz, .switchTurnedOn diff --git a/scripts/PokemonMansionB1F.asm b/scripts/PokemonMansionB1F.asm index e359621d6..e31bbd3eb 100644 --- a/scripts/PokemonMansionB1F.asm +++ b/scripts/PokemonMansionB1F.asm @@ -10,8 +10,8 @@ PokemonMansionB1F_Script: MansionB1FCheckReplaceSwitchDoorBlocks: ld hl, wCurrentMapScriptFlags - bit 5, [hl] - res 5, [hl] + bit BIT_CUR_MAP_LOADED_1, [hl] + res BIT_CUR_MAP_LOADED_1, [hl] ret z CheckEvent EVENT_MANSION_SWITCH_ON jr nz, .switchTurnedOn diff --git a/scripts/RocketHideoutB1F.asm b/scripts/RocketHideoutB1F.asm index f6c64bdaf..9354a0c72 100644 --- a/scripts/RocketHideoutB1F.asm +++ b/scripts/RocketHideoutB1F.asm @@ -10,8 +10,8 @@ RocketHideoutB1F_Script: RocketHideoutB1FDoorCallbackScript: ld hl, wCurrentMapScriptFlags - bit 5, [hl] - res 5, [hl] + bit BIT_CUR_MAP_LOADED_1, [hl] + res BIT_CUR_MAP_LOADED_1, [hl] ret z CheckEvent EVENT_677 jr nz, .door_open diff --git a/scripts/RocketHideoutB4F.asm b/scripts/RocketHideoutB4F.asm index 920aa0898..2c630067f 100644 --- a/scripts/RocketHideoutB4F.asm +++ b/scripts/RocketHideoutB4F.asm @@ -10,8 +10,8 @@ RocketHideoutB4F_Script: RocketHideoutB4FDoorCallbackScript: ld hl, wCurrentMapScriptFlags - bit 5, [hl] - res 5, [hl] + bit BIT_CUR_MAP_LOADED_1, [hl] + res BIT_CUR_MAP_LOADED_1, [hl] ret z CheckEvent EVENT_ROCKET_HIDEOUT_4_DOOR_UNLOCKED jr nz, .door_already_unlocked @@ -67,7 +67,7 @@ RocketHideoutB4FBeatGiovanniScript: xor a ld [wJoyIgnore], a ld hl, wCurrentMapScriptFlags - set 5, [hl] + set BIT_CUR_MAP_LOADED_1, [hl] ld a, SCRIPT_ROCKETHIDEOUTB4F_DEFAULT ld [wRocketHideoutB4FCurScript], a ld [wCurMapScript], a diff --git a/scripts/RocketHideoutElevator.asm b/scripts/RocketHideoutElevator.asm index 71ff0758a..bd6fb4987 100644 --- a/scripts/RocketHideoutElevator.asm +++ b/scripts/RocketHideoutElevator.asm @@ -1,12 +1,12 @@ RocketHideoutElevator_Script: ld hl, wCurrentMapScriptFlags - bit 5, [hl] - res 5, [hl] + bit BIT_CUR_MAP_LOADED_1, [hl] + res BIT_CUR_MAP_LOADED_1, [hl] push hl call nz, RocketHideoutElevatorStoreWarpEntriesScript pop hl - bit 7, [hl] - res 7, [hl] + bit BIT_CUR_MAP_USED_ELEVATOR, [hl] + res BIT_CUR_MAP_USED_ELEVATOR, [hl] call nz, RocketHideoutElevatorShakeScript xor a ld [wAutoTextBoxDrawingControl], a diff --git a/scripts/Route23.asm b/scripts/Route23.asm index ffd968dfa..ac4853d84 100644 --- a/scripts/Route23.asm +++ b/scripts/Route23.asm @@ -7,8 +7,8 @@ Route23_Script: Route23SetVictoryRoadBoulders: ld hl, wCurrentMapScriptFlags - bit 6, [hl] - res 6, [hl] + bit BIT_CUR_MAP_LOADED_2, [hl] + res BIT_CUR_MAP_LOADED_2, [hl] ret z ResetEvents EVENT_VICTORY_ROAD_2_BOULDER_ON_SWITCH1, EVENT_VICTORY_ROAD_2_BOULDER_ON_SWITCH2 ResetEvents EVENT_VICTORY_ROAD_3_BOULDER_ON_SWITCH1, EVENT_VICTORY_ROAD_3_BOULDER_ON_SWITCH2 diff --git a/scripts/Route25.asm b/scripts/Route25.asm index ef0e8fd2d..a85144a87 100644 --- a/scripts/Route25.asm +++ b/scripts/Route25.asm @@ -10,8 +10,8 @@ Route25_Script: Route25ShowHideBillScript: ld hl, wCurrentMapScriptFlags - bit 6, [hl] - res 6, [hl] + bit BIT_CUR_MAP_LOADED_2, [hl] + res BIT_CUR_MAP_LOADED_2, [hl] ret z CheckEventHL EVENT_LEFT_BILLS_HOUSE_AFTER_HELPING ret nz diff --git a/scripts/SaffronGym.asm b/scripts/SaffronGym.asm index 556cd4c57..4bfb7b2c7 100644 --- a/scripts/SaffronGym.asm +++ b/scripts/SaffronGym.asm @@ -1,7 +1,7 @@ SaffronGym_Script: ld hl, wCurrentMapScriptFlags - bit 6, [hl] - res 6, [hl] + bit BIT_CUR_MAP_LOADED_2, [hl] + res BIT_CUR_MAP_LOADED_2, [hl] call nz, .LoadNames call EnableAutoTextBoxDrawing ld hl, SaffronGymTrainerHeaders diff --git a/scripts/SilphCo10F.asm b/scripts/SilphCo10F.asm index 7cc2c58e7..d9650bc82 100644 --- a/scripts/SilphCo10F.asm +++ b/scripts/SilphCo10F.asm @@ -10,8 +10,8 @@ SilphCo10F_Script: SilphCo10FGateCallbackScript: ld hl, wCurrentMapScriptFlags - bit 5, [hl] - res 5, [hl] + bit BIT_CUR_MAP_LOADED_1, [hl] + res BIT_CUR_MAP_LOADED_1, [hl] ret z ld hl, .GateCoordinates call SilphCo2F_SetCardKeyDoorYScript diff --git a/scripts/SilphCo11F.asm b/scripts/SilphCo11F.asm index d5e4cb08d..6953d37c9 100644 --- a/scripts/SilphCo11F.asm +++ b/scripts/SilphCo11F.asm @@ -10,8 +10,8 @@ SilphCo11F_Script: SilphCo11FGateCallbackScript: ld hl, wCurrentMapScriptFlags - bit 5, [hl] - res 5, [hl] + bit BIT_CUR_MAP_LOADED_1, [hl] + res BIT_CUR_MAP_LOADED_1, [hl] ret z ld hl, SilphCo11GateCoords call SilphCo11F_SetCardKeyDoorYScript diff --git a/scripts/SilphCo2F.asm b/scripts/SilphCo2F.asm index 52241b95f..7ca57c456 100644 --- a/scripts/SilphCo2F.asm +++ b/scripts/SilphCo2F.asm @@ -10,8 +10,8 @@ SilphCo2F_Script: SilphCo2FGateCallbackScript: ld hl, wCurrentMapScriptFlags - bit 5, [hl] - res 5, [hl] + bit BIT_CUR_MAP_LOADED_1, [hl] + res BIT_CUR_MAP_LOADED_1, [hl] ret z ld hl, .GateCoordinates call SilphCo2F_SetCardKeyDoorYScript diff --git a/scripts/SilphCo3F.asm b/scripts/SilphCo3F.asm index df9df9e8c..146cbb072 100644 --- a/scripts/SilphCo3F.asm +++ b/scripts/SilphCo3F.asm @@ -10,8 +10,8 @@ SilphCo3F_Script: SilphCo3FGateCallbackScript: ld hl, wCurrentMapScriptFlags - bit 5, [hl] - res 5, [hl] + bit BIT_CUR_MAP_LOADED_1, [hl] + res BIT_CUR_MAP_LOADED_1, [hl] ret z ld hl, .GateCoordinates call SilphCo2F_SetCardKeyDoorYScript diff --git a/scripts/SilphCo4F.asm b/scripts/SilphCo4F.asm index 91453d653..f84ef9958 100644 --- a/scripts/SilphCo4F.asm +++ b/scripts/SilphCo4F.asm @@ -10,8 +10,8 @@ SilphCo4F_Script: SilphCo4FGateCallbackScript: ld hl, wCurrentMapScriptFlags - bit 5, [hl] - res 5, [hl] + bit BIT_CUR_MAP_LOADED_1, [hl] + res BIT_CUR_MAP_LOADED_1, [hl] ret z ld hl, .GateCoordinates call SilphCo4F_SetCardKeyDoorYScript diff --git a/scripts/SilphCo5F.asm b/scripts/SilphCo5F.asm index 1834bfa84..599c17430 100644 --- a/scripts/SilphCo5F.asm +++ b/scripts/SilphCo5F.asm @@ -10,8 +10,8 @@ SilphCo5F_Script: SilphCo5FGateCallbackScript: ld hl, wCurrentMapScriptFlags - bit 5, [hl] - res 5, [hl] + bit BIT_CUR_MAP_LOADED_1, [hl] + res BIT_CUR_MAP_LOADED_1, [hl] ret z ld hl, .GateCoordinates call SilphCo4F_SetCardKeyDoorYScript diff --git a/scripts/SilphCo6F.asm b/scripts/SilphCo6F.asm index 0626ffdbd..ad8e83f43 100644 --- a/scripts/SilphCo6F.asm +++ b/scripts/SilphCo6F.asm @@ -10,8 +10,8 @@ SilphCo6F_Script: SilphCo6F_GateCallbackScript: ld hl, wCurrentMapScriptFlags - bit 5, [hl] - res 5, [hl] + bit BIT_CUR_MAP_LOADED_1, [hl] + res BIT_CUR_MAP_LOADED_1, [hl] ret z ld hl, .GateCoordinates call SilphCo4F_SetCardKeyDoorYScript diff --git a/scripts/SilphCo7F.asm b/scripts/SilphCo7F.asm index 381eff7a3..bf517d29c 100644 --- a/scripts/SilphCo7F.asm +++ b/scripts/SilphCo7F.asm @@ -10,8 +10,8 @@ SilphCo7F_Script: SilphCo7F_GateCallbackScript: ld hl, wCurrentMapScriptFlags - bit 5, [hl] - res 5, [hl] + bit BIT_CUR_MAP_LOADED_1, [hl] + res BIT_CUR_MAP_LOADED_1, [hl] ret z ld hl, .GateCoordinates call SilphCo7F_SetCardKeyDoorYScript diff --git a/scripts/SilphCo8F.asm b/scripts/SilphCo8F.asm index cdd7f486f..dcba85c03 100644 --- a/scripts/SilphCo8F.asm +++ b/scripts/SilphCo8F.asm @@ -10,8 +10,8 @@ SilphCo8F_Script: SilphCo8FGateCallbackScript: ld hl, wCurrentMapScriptFlags - bit 5, [hl] - res 5, [hl] + bit BIT_CUR_MAP_LOADED_1, [hl] + res BIT_CUR_MAP_LOADED_1, [hl] ret z ld hl, .GateCoordinates call SilphCo8F_SetCardKeyDoorYScript diff --git a/scripts/SilphCo9F.asm b/scripts/SilphCo9F.asm index fe7f3da28..aec4dbf8f 100644 --- a/scripts/SilphCo9F.asm +++ b/scripts/SilphCo9F.asm @@ -10,8 +10,8 @@ SilphCo9F_Script: SilphCo9FGateCallbackScript: ld hl, wCurrentMapScriptFlags - bit 5, [hl] - res 5, [hl] + bit BIT_CUR_MAP_LOADED_1, [hl] + res BIT_CUR_MAP_LOADED_1, [hl] ret z ld hl, .GateCoordinates call SilphCo9F_SetCardKeyDoorYScript diff --git a/scripts/SilphCoElevator.asm b/scripts/SilphCoElevator.asm index a2ed009e6..ffdf101ee 100644 --- a/scripts/SilphCoElevator.asm +++ b/scripts/SilphCoElevator.asm @@ -1,12 +1,12 @@ SilphCoElevator_Script: ld hl, wCurrentMapScriptFlags - bit 5, [hl] - res 5, [hl] + bit BIT_CUR_MAP_LOADED_1, [hl] + res BIT_CUR_MAP_LOADED_1, [hl] push hl call nz, SilphCoElevatorStoreWarpEntriesScript pop hl - bit 7, [hl] - res 7, [hl] + bit BIT_CUR_MAP_USED_ELEVATOR, [hl] + res BIT_CUR_MAP_USED_ELEVATOR, [hl] call nz, SilphCoElevatorShakeScript xor a ld [wAutoTextBoxDrawingControl], a diff --git a/scripts/VermilionCity.asm b/scripts/VermilionCity.asm index fd5905df3..40a08dbca 100644 --- a/scripts/VermilionCity.asm +++ b/scripts/VermilionCity.asm @@ -1,13 +1,13 @@ VermilionCity_Script: call EnableAutoTextBoxDrawing ld hl, wCurrentMapScriptFlags - bit 6, [hl] - res 6, [hl] + bit BIT_CUR_MAP_LOADED_2, [hl] + res BIT_CUR_MAP_LOADED_2, [hl] push hl call nz, VermilionCityLeftSSAnneCallbackScript pop hl - bit 5, [hl] - res 5, [hl] + bit BIT_CUR_MAP_LOADED_1, [hl] + res BIT_CUR_MAP_LOADED_1, [hl] call nz, .setFirstLockTrashCanIndex ld hl, VermilionCity_ScriptPointers ld a, [wVermilionCityCurScript] diff --git a/scripts/VermilionGym.asm b/scripts/VermilionGym.asm index d7828e429..8d3a33b6c 100644 --- a/scripts/VermilionGym.asm +++ b/scripts/VermilionGym.asm @@ -1,12 +1,12 @@ VermilionGym_Script: ld hl, wCurrentMapScriptFlags - bit 5, [hl] - res 5, [hl] + bit BIT_CUR_MAP_LOADED_1, [hl] + res BIT_CUR_MAP_LOADED_1, [hl] push hl call nz, .LoadNames pop hl - bit 6, [hl] - res 6, [hl] + bit BIT_CUR_MAP_LOADED_2, [hl] + res BIT_CUR_MAP_LOADED_2, [hl] call nz, VermilionGymSetDoorTile call EnableAutoTextBoxDrawing ld hl, VermilionGymTrainerHeaders diff --git a/scripts/VictoryRoad1F.asm b/scripts/VictoryRoad1F.asm index e80e17d51..554ae39fc 100644 --- a/scripts/VictoryRoad1F.asm +++ b/scripts/VictoryRoad1F.asm @@ -1,7 +1,7 @@ VictoryRoad1F_Script: ld hl, wCurrentMapScriptFlags - bit 5, [hl] - res 5, [hl] + bit BIT_CUR_MAP_LOADED_1, [hl] + res BIT_CUR_MAP_LOADED_1, [hl] call nz, .next call EnableAutoTextBoxDrawing ld hl, VictoryRoad1TrainerHeaders @@ -31,7 +31,7 @@ VictoryRoad1FDefaultScript: call CheckBoulderCoords jp nc, CheckFightingMapTrainers ld hl, wCurrentMapScriptFlags - set 5, [hl] + set BIT_CUR_MAP_LOADED_1, [hl] SetEvent EVENT_VICTORY_ROAD_1_BOULDER_ON_SWITCH ret diff --git a/scripts/VictoryRoad2F.asm b/scripts/VictoryRoad2F.asm index 5e31da7ae..853562470 100644 --- a/scripts/VictoryRoad2F.asm +++ b/scripts/VictoryRoad2F.asm @@ -1,11 +1,11 @@ VictoryRoad2F_Script: ld hl, wCurrentMapScriptFlags - bit 6, [hl] - res 6, [hl] + bit BIT_CUR_MAP_LOADED_2, [hl] + res BIT_CUR_MAP_LOADED_2, [hl] call nz, VictoryRoad2FResetBoulderEventScript ld hl, wCurrentMapScriptFlags - bit 5, [hl] - res 5, [hl] + bit BIT_CUR_MAP_LOADED_1, [hl] + res BIT_CUR_MAP_LOADED_1, [hl] call nz, VictoryRoad2FCheckBoulderEventScript call EnableAutoTextBoxDrawing ld hl, VictoryRoad2TrainerHeaders @@ -60,7 +60,7 @@ VictoryRoad2FDefaultScript: ret nz .set_script_flag ld hl, wCurrentMapScriptFlags - set 5, [hl] + set BIT_CUR_MAP_LOADED_1, [hl] ret .SwitchCoords: diff --git a/scripts/VictoryRoad3F.asm b/scripts/VictoryRoad3F.asm index e9295a153..2b1b11c02 100644 --- a/scripts/VictoryRoad3F.asm +++ b/scripts/VictoryRoad3F.asm @@ -10,8 +10,8 @@ VictoryRoad3F_Script: VictoryRoad3FCheckBoulderEventScript: ld hl, wCurrentMapScriptFlags - bit 5, [hl] - res 5, [hl] + bit BIT_CUR_MAP_LOADED_1, [hl] + res BIT_CUR_MAP_LOADED_1, [hl] ret z CheckEventHL EVENT_VICTORY_ROAD_3_BOULDER_ON_SWITCH1 ret z @@ -38,7 +38,7 @@ VictoryRoad3FDefaultScript: cp $1 jr nz, .handle_hole ld hl, wCurrentMapScriptFlags - set 5, [hl] + set BIT_CUR_MAP_LOADED_1, [hl] SetEvent EVENT_VICTORY_ROAD_3_BOULDER_ON_SWITCH1 ret .handle_hole From d5ee4fd652417124afc8dca0d40d36fd37bf8e4d Mon Sep 17 00:00:00 2001 From: Rangi42 Date: Tue, 24 Sep 2024 11:41:14 -0400 Subject: [PATCH 19/19] Use `const_skip` --- constants/icon_constants.asm | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/constants/icon_constants.asm b/constants/icon_constants.asm index 767e29c6d..6b9e21557 100644 --- a/constants/icon_constants.asm +++ b/constants/icon_constants.asm @@ -1,17 +1,17 @@ ; party menu icons ; used in MonPartySpritePointers (see data/icon_pointers.asm) const_def - const ICON_MON ; $0 - const ICON_BALL ; $1 - const ICON_HELIX ; $2 - const ICON_FAIRY ; $3 - const ICON_BIRD ; $4 - const ICON_WATER ; $5 - const ICON_BUG ; $6 - const ICON_GRASS ; $7 - const ICON_SNAKE ; $8 - const ICON_QUADRUPED ; $9 - -DEF ICON_TRADEBUBBLE EQU $e + const ICON_MON ; $0 + const ICON_BALL ; $1 + const ICON_HELIX ; $2 + const ICON_FAIRY ; $3 + const ICON_BIRD ; $4 + const ICON_WATER ; $5 + const ICON_BUG ; $6 + const ICON_GRASS ; $7 + const ICON_SNAKE ; $8 + const ICON_QUADRUPED ; $9 + const_skip 4 + const ICON_TRADEBUBBLE ; $e DEF ICONOFFSET EQU $40 ; difference between alternating icon frames' tile IDs