diff options
57 files changed, 374 insertions, 294 deletions
diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 0406fe7b..b3d82f8c 100755 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -225,7 +225,7 @@ StartBattle: ; 3c11e (f:411e) ld [wPartyFoughtCurrentEnemyFlags], a ld [wActionResultOrTookBattleTurn], a inc a - ld [wd11d], a + ld [wFirstMonsNotOutYet], a ld hl, wEnemyMon1HP ld bc, wEnemyMon2 - wEnemyMon1 - 1 ld d, $3 @@ -379,7 +379,7 @@ MainInBattleLoop: ; 3c233 (f:4233) jp z, HandleEnemyMonFainted ; if enemy mon HP is 0, jump call SaveScreenTilesToBuffer1 xor a - ld [wd11d], a + ld [wFirstMonsNotOutYet], a ld a, [W_PLAYERBATTSTATUS2] and (1 << NeedsToRecharge) | (1 << UsingRage) ; check if the player is using Rage or needs to recharge jr nz, .selectEnemyMove @@ -1434,7 +1434,7 @@ EnemySendOutFirstMon: ; 3c92a (f:492a) ld [wLastSwitchInEnemyMonHP + 1],a ld a,1 ld [wCurrentMenuItem],a - ld a,[wd11d] + ld a,[wFirstMonsNotOutYet] dec a jr z,.next4 ld a,[wPartyCount] @@ -1549,7 +1549,7 @@ HasMonFainted: ; 3ca97 (f:4a97) ld a, [hli] or [hl] ret nz - ld a, [wd11d] + ld a, [wFirstMonsNotOutYet] and a jr nz, .done ld hl, NoWillText @@ -1647,8 +1647,8 @@ TryRunningFromBattle: ; 3cab9 (f:4ab9) ld hl, NoRunningText .printCantEscapeOrNoRunningText call PrintText - ld a, $1 - ld [wd11f], a + ld a, 1 + ld [wForcePlayerToChooseMon], a call SaveScreenTilesToBuffer1 and a ; reset carry ret @@ -2334,7 +2334,7 @@ UseBagItem: res UsingTrappingMove, [hl] ; not using multi-turn move any more .checkIfMonCaptured - ld a, [wd11c] + ld a, [wCapturedMonSpecies] and a ; was the enemy mon captured with a ball? jr nz, .returnAfterCapturingMon @@ -2354,7 +2354,7 @@ UseBagItem: .returnAfterCapturingMon call GBPalNormal xor a - ld [wd11c], a + ld [wCapturedMonSpecies], a ld a, $2 ld [wBattleResult], a scf ; set carry @@ -2516,8 +2516,8 @@ BattleMenu_RunWasSelected: ; 3d1fa (f:51fa) ld hl, wBattleMonSpeed ld de, wEnemyMonSpeed call TryRunningFromBattle - ld a, $0 - ld [wd11f], a + ld a, 0 + ld [wForcePlayerToChooseMon], a ret c ld a, [wActionResultOrTookBattleTurn] and a @@ -3035,18 +3035,18 @@ SelectEnemyMove: ; 3d564 (f:5564) push hl call BattleRandom ld b, $1 - cp $3f ; select move 1 in [0,3e] (63/256 chance) + cp $3f ; select move 1, [0,3e] (63/256 chance) jr c, .moveChosen inc hl inc b - cp $7f ; select move 1 in [3f,7e] (64/256 chance) + cp $7f ; select move 2, [3f,7e] (64/256 chance) jr c, .moveChosen inc hl inc b - cp $be ; select move 1 in [7f,bd] (63/256 chance) + cp $be ; select move 3, [7f,bd] (63/256 chance) jr c, .moveChosen inc hl - inc b ; select move 4 in [be,ff] (66/256 chance) + inc b ; select move 4, [be,ff] (66/256 chance) .moveChosen ld a, b dec a diff --git a/engine/battle/end_of_battle.asm b/engine/battle/end_of_battle.asm index 8264e49c..c642d206 100755 --- a/engine/battle/end_of_battle.asm +++ b/engine/battle/end_of_battle.asm @@ -51,7 +51,7 @@ EndOfBattle: ; 137aa (4:77aa) ld [W_BATTLETYPE], a ld [W_MOVEMISSED], a ld [W_CUROPPONENT], a - ld [wd11f], a + ld [wForcePlayerToChooseMon], a ld [wNumRunAttempts], a ld [wEscapedFromBattle], a ld hl, wPartyAndBillsPCSavedMenuItem diff --git a/engine/battle/read_trainer_party.asm b/engine/battle/read_trainer_party.asm index 4f72aea1..0976c7c7 100755 --- a/engine/battle/read_trainer_party.asm +++ b/engine/battle/read_trainer_party.asm @@ -154,7 +154,7 @@ ReadTrainer: ; 39c53 (e:5c53) ld b,a .LastLoop ; update wAmountMoneyWon addresses (money to win) based on enemy's level - ld hl,wd047 + ld hl,wTrainerBaseMoney + 1 ld c,2 ; wAmountMoneyWon is a 3-byte number push bc predef AddBCDPredef diff --git a/engine/battle/trainer_ai.asm b/engine/battle/trainer_ai.asm index c803a870..fb932035 100644 --- a/engine/battle/trainer_ai.asm +++ b/engine/battle/trainer_ai.asm @@ -2,7 +2,7 @@ ; unused slots are filled with 0, all used slots may be chosen with equal probability AIEnemyTrainerChooseMoves: ; 39719 (e:5719) ld a, $a - ld hl, wHPBarMaxHP ; init temporary move selection array. Only the moves with the lowest numbers are chosen in the end + ld hl, wBuffer ; init temporary move selection array. Only the moves with the lowest numbers are chosen in the end ld [hli], a ; move 1 ld [hli], a ; move 2 ld [hli], a ; move 3 @@ -11,14 +11,14 @@ AIEnemyTrainerChooseMoves: ; 39719 (e:5719) swap a and $f jr z, .noMoveDisabled - ld hl, wHPBarMaxHP + ld hl, wBuffer dec a ld c, a ld b, $0 add hl, bc ; advance pointer to forbidden move ld [hl], $50 ; forbid (highly discourage) disabled move .noMoveDisabled - ld hl, TrainerClassMoveChoiceModifications ; 589B + ld hl, TrainerClassMoveChoiceModifications ld a, [W_TRAINERCLASS] ld b, a .loopTrainerClasses @@ -44,7 +44,7 @@ AIEnemyTrainerChooseMoves: ; 39719 (e:5719) dec a add a ld c, a - ld b, $0 + ld b, 0 add hl, bc ; skip to pointer ld a, [hli] ; read pointer into hl ld h, [hl] @@ -53,9 +53,9 @@ AIEnemyTrainerChooseMoves: ; 39719 (e:5719) push de jp [hl] ; execute modification function .loopFindMinimumEntries ; all entries will be decremented sequentially until one of them is zero - ld hl, wHPBarMaxHP ; temp move selection array + ld hl, wBuffer ; temp move selection array ld de, wEnemyMonMoves ; enemy moves - ld c, $4 + ld c, NUM_MOVES .loopDecrementEntries ld a, [de] inc de @@ -73,11 +73,11 @@ AIEnemyTrainerChooseMoves: ; 39719 (e:5719) inc [hl] dec hl inc a - cp $5 + cp NUM_MOVES + 1 jr nz, .loopUndoPartialIteration - ld hl, wHPBarMaxHP ; temp move selection array + ld hl, wBuffer ; temp move selection array ld de, wEnemyMonMoves ; enemy moves - ld c, $4 + ld c, NUM_MOVES .filterMinimalEntries ; all minimal entries now have value 1. All other slots will be disabled (move set to 0) ld a, [de] and a @@ -97,7 +97,7 @@ AIEnemyTrainerChooseMoves: ; 39719 (e:5719) inc de dec c jr nz, .filterMinimalEntries - ld hl, wHPBarMaxHP ; use created temporary array as move set + ld hl, wBuffer ; use created temporary array as move set ret .useOriginalMoveSet ld hl, wEnemyMonMoves ; use original move set @@ -694,11 +694,13 @@ SwitchEnemyMon: ; 3a74b (e:674b) ld hl, AIBattleWithdrawText call PrintText + ; This wFirstMonsNotOutYet variable is abused to prevent the player from + ; switching in a new mon in response to this switch. ld a,1 - ld [wd11d],a + ld [wFirstMonsNotOutYet],a callab EnemySendOut xor a - ld [wd11d],a + ld [wFirstMonsNotOutYet],a ld a,[wLinkState] cp LINK_STATE_BATTLING diff --git a/engine/evos_moves.asm b/engine/evos_moves.asm index b9b4bb0f..7dcc0513 100755 --- a/engine/evos_moves.asm +++ b/engine/evos_moves.asm @@ -14,7 +14,7 @@ EvolutionAfterBattle: ; 3ad1c (e:6d1c) ld a, [hTilesetType] push af xor a - ld [wd121], a + ld [wEvolutionOccurred], a dec a ld [wWhichPokemon], a push hl @@ -91,7 +91,7 @@ Evolution_PartyMonLoop: ; loop over party mons ld a, [wLoadedMonLevel] cp b ; is the mon's level greater than the evolution requirement? jp c, Evolution_PartyMonLoop ; if so, go the next mon - jr .asm_3adb6 + jr .doEvolution .checkItemEvo ld a, [hli] ld b, a ; evolution item @@ -104,10 +104,10 @@ Evolution_PartyMonLoop: ; loop over party mons ld a, [wLoadedMonLevel] cp b ; is the mon's level greater than the evolution requirement? jp c, .nextEvoEntry2 ; if so, go the next evolution entry -.asm_3adb6 +.doEvolution ld [W_CURENEMYLVL], a - ld a, $1 - ld [wd121], a + ld a, 1 + ld [wEvolutionOccurred], a push hl ld a, [hl] ld [wEvoNewSpecies], a @@ -252,7 +252,7 @@ Evolution_PartyMonLoop: ; loop over party mons ld a, [W_ISINBATTLE] and a ret nz - ld a, [wd121] + ld a, [wEvolutionOccurred] and a call nz, PlayDefaultMusic ret diff --git a/engine/hidden_object_functions17.asm b/engine/hidden_object_functions17.asm index 97681b79..788dd777 100755 --- a/engine/hidden_object_functions17.asm +++ b/engine/hidden_object_functions17.asm @@ -311,7 +311,7 @@ VermilionGymTrashText: ; 5ddf7 (17:5df7) GymTrashScript: ; 5ddfc (17:5dfc) call EnableAutoTextBoxDrawing ld a, [wHiddenObjectFunctionArgument] - ld [wcd5b], a + ld [wGymTrashCanIndex], a ; Don't do the trash can puzzle if it's already been done. CheckEvent EVENT_2ND_LOCK_OPENED @@ -320,12 +320,12 @@ GymTrashScript: ; 5ddfc (17:5dfc) tx_pre_jump VermilionGymTrashText .ok - bit 1, a + CheckEventReuseA EVENT_1ST_LOCK_OPENED jr nz, .trySecondLock - ld a, [wd743] + ld a, [wFirstLockTrashCanIndex] ld b, a - ld a, [wcd5b] + ld a, [wGymTrashCanIndex] cp b jr z, .openFirstLock @@ -337,7 +337,7 @@ GymTrashScript: ; 5ddfc (17:5dfc) SetEvent EVENT_1ST_LOCK_OPENED ld hl, GymTrashCans - ld a, [wcd5b] + ld a, [wGymTrashCanIndex] ; * 5 ld b, a add a @@ -364,15 +364,15 @@ GymTrashScript: ; 5ddfc (17:5dfc) add hl, de ld a, [hl] and $f - ld [wd744], a + ld [wSecondLockTrashCanIndex], a tx_pre_id VermilionGymTrashSuccesText1 jr .done .trySecondLock - ld a, [wd744] + ld a, [wSecondLockTrashCanIndex] ld b, a - ld a, [wcd5b] + ld a, [wGymTrashCanIndex] cp b jr z, .openSecondLock @@ -381,7 +381,7 @@ GymTrashScript: ; 5ddfc (17:5dfc) call Random and $e - ld [wd743], a + ld [wFirstLockTrashCanIndex], a tx_pre_id VermilionGymTrashFailText jr .done diff --git a/engine/hp_bar.asm b/engine/hp_bar.asm index 61209778..d1367b4e 100755 --- a/engine/hp_bar.asm +++ b/engine/hp_bar.asm @@ -205,20 +205,21 @@ UpdateHPBar_PrintHPNumber: ; faf5 (3:7af5) push de ld a, [wHPBarType] and a - jr z, .asm_fb2d + jr z, .done ; don't print number in enemy HUD +; convert from little-endian to big-endian for PrintNumber ld a, [wHPBarOldHP] - ld [wcef1], a - ld a, [wHPBarOldHP+1] - ld [wcef0], a + ld [wHPBarTempHP + 1], a + ld a, [wHPBarOldHP + 1] + ld [wHPBarTempHP], a push hl ld a, [hFlags_0xFFF6] bit 0, a jr z, .asm_fb15 ld de, $9 - jr .asm_fb18 + jr .next .asm_fb15 ld de, $15 -.asm_fb18 +.next add hl, de push hl ld a, $7f @@ -226,12 +227,12 @@ UpdateHPBar_PrintHPNumber: ; faf5 (3:7af5) ld [hli], a ld [hli], a pop hl - ld de, wcef0 + ld de, wHPBarTempHP ld bc, $203 call PrintNumber call DelayFrame pop hl -.asm_fb2d +.done pop de pop af ret diff --git a/engine/items/items.asm b/engine/items/items.asm index b0013b46..5669f012 100755 --- a/engine/items/items.asm +++ b/engine/items/items.asm @@ -118,7 +118,7 @@ ItemUseBall: ; d687 (3:5687) .UseBall ;ok, you can use a ball xor a - ld [wd11c],a + ld [wCapturedMonSpecies],a ld a,[W_BATTLETYPE] cp a,2 ;SafariBattle jr nz,.skipSafariZoneCode @@ -388,7 +388,7 @@ ItemUseBall: ; d687 (3:5687) pop af ld [hl],a ld a,[wEnemyMonSpecies] ;enemy - ld [wd11c],a + ld [wCapturedMonSpecies],a ld [wcf91],a ld [wd11e],a ld a,[W_BATTLETYPE] @@ -645,7 +645,7 @@ ItemUseEvoStone: ; da5b (3:5a5b) call PlaySoundWaitForCurrent call WaitForSoundToFinish callab TryEvolvingMon ; try to evolve pokemon - ld a,[wd121] + ld a,[wEvolutionOccurred] and a jr z,.noEffect pop af @@ -2537,13 +2537,13 @@ IsKeyItem_: ; e764 (3:6764) ; if the item is not an HM or TM push af ld hl,KeyItemBitfield - ld de,wHPBarMaxHP + ld de,wBuffer ld bc,15 ; only 11 bytes are actually used call CopyData pop af dec a ld c,a - ld hl,wHPBarMaxHP + ld hl,wBuffer ld b,FLAG_TEST predef FlagActionPredef ld a,c diff --git a/engine/learn_move.asm b/engine/learn_move.asm index abc3b7d4..a6a78355 100755 --- a/engine/learn_move.asm +++ b/engine/learn_move.asm @@ -46,10 +46,10 @@ DontAbandonLearning: ; 6e5b (1:6e5b) ld hl, Moves ld bc, $6 call AddNTimes - ld de, wHPBarMaxHP + ld de, wBuffer ld a, BANK(Moves) call FarCopyData - ld a, [wHPBarNewHP + 1] + ld a, [wBuffer + 5] ; a = move's max PP pop de pop hl ld [hl], a diff --git a/engine/menu/naming_screen.asm b/engine/menu/naming_screen.asm index 6037329e..20745c58 100755 --- a/engine/menu/naming_screen.asm +++ b/engine/menu/naming_screen.asm @@ -54,7 +54,7 @@ DoYouWantToNicknameText: ; 0x6557 db "@" DisplayNameRaterScreen: ; 655c (1:655c) - ld hl, wHPBarMaxHP + ld hl, wBuffer xor a ld [wUpdateSpritesEnabled], a ld a, NAME_MON_SCREEN @@ -72,7 +72,7 @@ DisplayNameRaterScreen: ; 655c (1:655c) call AddNTimes ld e, l ld d, h - ld hl, wHPBarMaxHP + ld hl, wBuffer ld bc, 11 call CopyData and a @@ -94,24 +94,24 @@ DisplayNamingScreen: ; 6596 (1:6596) call LoadEDTile callba LoadMonPartySpriteGfx coord hl, 0, 4 - ld b, $9 - ld c, $12 + ld b, 9 + ld c, 18 call TextBoxBorder call PrintNamingText - ld a, $3 + ld a, 3 ld [wTopMenuItemY], a - ld a, $1 + ld a, 1 ld [wTopMenuItemX], a ld [wLastMenuItem], a ld [wCurrentMenuItem], a ld a, $ff ld [wMenuWatchedKeys], a - ld a, $7 + ld a, 7 ld [wMaxMenuItem], a ld a, $50 ld [wcf4b], a xor a - ld hl, wHPBarMaxHP + 1 + ld hl, wNamingScreenSubmitName ld [hli], a ld [hli], a ld [wAnimCounter], a @@ -119,7 +119,7 @@ DisplayNamingScreen: ; 6596 (1:6596) call PrintAlphabet call GBPalNormal .ABStartReturnPoint - ld a, [wHPBarMaxHP + 1] + ld a, [wNamingScreenSubmitName] and a jr nz, .submitNickname call PrintNicknameAndUnderscores @@ -197,14 +197,14 @@ DisplayNamingScreen: ; 6596 (1:6596) ld de, .selectReturnPoint push de .pressedSelect - ld a, [wHPBarOldHP] + ld a, [wAlphabetCase] xor $1 - ld [wHPBarOldHP], a + ld [wAlphabetCase], a ret .pressedStart - ld a, $1 - ld [wHPBarMaxHP + 1], a + ld a, 1 + ld [wNamingScreenSubmitName], a ret .pressedA @@ -216,7 +216,7 @@ DisplayNamingScreen: ; 6596 (1:6596) jr z, .pressedStart .didNotPressED ld a, [wCurrentMenuItem] - cp $6 ; case swtich row + cp $6 ; case switch row jr nz, .didNotPressCaseSwtich ld a, [wTopMenuItemX] cp $1 ; case switch column @@ -228,9 +228,9 @@ DisplayNamingScreen: ; 6596 (1:6596) ld l, a inc hl ld a, [hl] - ld [wHPBarNewHP], a + ld [wNamingScreenLetter], a call CalcStringLength - ld a, [wHPBarNewHP] + ld a, [wNamingScreenLetter] cp $e5 ld de, Dakutens jr z, .dakutensAndHandakutens @@ -240,11 +240,11 @@ DisplayNamingScreen: ; 6596 (1:6596) ld a, [wNamingScreenType] cp NAME_MON_SCREEN jr nc, .checkMonNameLength - ld a, [wHPBarMaxHP] + ld a, [wNamingScreenNameLength] cp $7 ; max length of player/rival names jr .checkNameLength .checkMonNameLength - ld a, [wHPBarMaxHP] + ld a, [wNamingScreenNameLength] cp $a ; max length of pokemon nicknames .checkNameLength jr c, .addLetter @@ -257,14 +257,14 @@ DisplayNamingScreen: ; 6596 (1:6596) ret nc dec hl .addLetter - ld a, [wHPBarNewHP] + ld a, [wNamingScreenLetter] ld [hli], a ld [hl], $50 ld a, SFX_PRESS_AB call PlaySound ret .pressedB - ld a, [wHPBarMaxHP] + ld a, [wNamingScreenNameLength] and a ret z call CalcStringLength @@ -335,7 +335,7 @@ ED_Tile: ; 6767 (1:6767) PrintAlphabet: ; 676f (1:676f) xor a ld [H_AUTOBGTRANSFERENABLED], a - ld a, [wHPBarOldHP] + ld a, [wAlphabetCase] and a ld de, LowerCaseAlphabet jr nz, .lowercase @@ -371,7 +371,7 @@ UpperCaseAlphabet: ; 67d6 (1:67d6) PrintNicknameAndUnderscores: ; 680e (1:680e) call CalcStringLength ld a, c - ld [wHPBarMaxHP], a + ld [wNamingScreenNameLength], a coord hl, 10, 2 ld bc, $10a call ClearScreenArea @@ -394,7 +394,7 @@ PrintNicknameAndUnderscores: ; 680e (1:680e) jr nz, .placeUnderscoreLoop ld a, [wNamingScreenType] cp NAME_MON_SCREEN - ld a, [wHPBarMaxHP] + ld a, [wNamingScreenNameLength] jr nc, .pokemon2 cp 7 ; player or rival max name length jr .playerOrRival2 @@ -433,7 +433,7 @@ DakutensAndHandakutens: ; 6871 (1:6871) ret nc inc hl ld a, [hl] - ld [wHPBarNewHP], a + ld [wNamingScreenLetter], a ret Dakutens: ; 6885 (1:6885) diff --git a/engine/overworld/item.asm b/engine/overworld/item.asm index eb6d743a..6fbe823d 100644 --- a/engine/overworld/item.asm +++ b/engine/overworld/item.asm @@ -31,7 +31,7 @@ PickUpItem: jr nc, .BagFull ld a, [$ffdb] - ld [wcc4d], a + ld [wMissableObjectIndex], a predef HideObject ld a, 1 ld [wDoNotWaitForButtonPressAfterDisplayingText], a diff --git a/engine/overworld/npc_movement.asm b/engine/overworld/npc_movement.asm index fcef55e0..c9265f3e 100755 --- a/engine/overworld/npc_movement.asm +++ b/engine/overworld/npc_movement.asm @@ -149,7 +149,7 @@ PalletMovementScript_Done: ; 1a4f4 (6:64f4) and a ret nz ld a, $0 - ld [wcc4d], a + ld [wMissableObjectIndex], a predef HideObject ld hl, wd730 res 7, [hl] diff --git a/engine/overworld/player_animations.asm b/engine/overworld/player_animations.asm index a9aa2cf2..1a3d374f 100755 --- a/engine/overworld/player_animations.asm +++ b/engine/overworld/player_animations.asm @@ -370,10 +370,10 @@ IsPlayerStandingOnWarpPadOrHole: ; 70787 (1c:4787) ld b, [hl] .done ld a, b - ld [wcd5b], a + ld [wStandingOnWarpPadOrHole], a ret -; format: db tileset id, tile id, value to be put in wcd5b +; format: db tileset id, tile id, value to be put in [wStandingOnWarpPadOrHole] .warpPadAndHoleData: ; 707a9 (1c:47a9) db FACILITY, $20, 1 ; warp pad db FACILITY, $11, 2 ; hole diff --git a/engine/town_map.asm b/engine/town_map.asm index a90aa331..f5a047c3 100755 --- a/engine/town_map.asm +++ b/engine/town_map.asm @@ -487,24 +487,24 @@ WriteSymmetricMonPartySpriteOAM: ; 712a6 (1c:52a6) ; the X-flip OAM bit to be used so that only 2 rather than 4 tile patterns are ; needed. xor a - ld [wcd5c], a - ld de, $202 + ld [wSymmetricSpriteOAMAttributes], a + lb de, 2, 2 .loop push de push bc .innerLoop ld a, b - ld [hli], a + ld [hli], a ; Y ld a, c - ld [hli], a + ld [hli], a ; X ld a, [wOAMBaseTile] - ld [hli], a - ld a, [wcd5c] - ld [hli], a - xor $20 - ld [wcd5c], a + ld [hli], a ; tile + ld a, [wSymmetricSpriteOAMAttributes] + ld [hli], a ; attributes + xor (1 << OAM_X_FLIP) + ld [wSymmetricSpriteOAMAttributes], a inc d - ld a, $8 + ld a, 8 add c ld c, a dec e @@ -516,7 +516,7 @@ WriteSymmetricMonPartySpriteOAM: ; 712a6 (1c:52a6) inc [hl] inc [hl] pop hl - ld a, $8 + ld a, 8 add b ld b, a dec d @@ -394,13 +394,13 @@ PartyMenuInit:: ; 1420 (0:1420) ; otherwise, it is 0 .storeMaxMenuItemID ld [hli], a ; max menu item ID - ld a, [wd11f] + ld a, [wForcePlayerToChooseMon] and a - ld a, A_BUTTON + B_BUTTON + ld a, A_BUTTON | B_BUTTON jr z, .next xor a - ld [wd11f], a - inc a + ld [wForcePlayerToChooseMon], a + inc a ; a = A_BUTTON .next ld [hli], a ; menu watched keys pop af @@ -2403,7 +2403,7 @@ EndTrainerBattle:: ; 3275 (0:3275) call IsInArray ; search for sprite ID inc hl ld a, [hl] - ld [wcc4d], a ; load corresponding missable object index and remove it + ld [wMissableObjectIndex], a ; load corresponding missable object index and remove it predef HideObject .skipRemoveSprite ld hl, wd730 @@ -2905,7 +2905,7 @@ GetTrainerInformation:: ; 3566 (0:3566) inc de ld a, [hli] ld [de], a - ld de, wd046 + ld de, wTrainerBaseMoney ld a, [hli] ld [de], a inc de @@ -3944,7 +3944,7 @@ HandleMenuInput_:: ; 3ac2 (0:3ac2) ret .keyPressed xor a - ld [wcc4b],a + ld [wCheckFor180DegreeTurn],a ld a,[hJoy5] ld b,a bit 6,a ; pressed Up key? diff --git a/home/overworld.asm b/home/overworld.asm index 9b60d7e9..bd9f4a0a 100644 --- a/home/overworld.asm +++ b/home/overworld.asm @@ -132,8 +132,8 @@ OverworldLoopLessDelay:: ld hl,wFlags_0xcd60 res 2,[hl] call UpdateSprites - ld a,$01 - ld [wcc4b],a + ld a,1 + ld [wCheckFor180DegreeTurn],a ld a,[wPlayerMovingDirection] ; the direction that was pressed last time and a jp z,OverworldLoop @@ -174,7 +174,7 @@ OverworldLoopLessDelay:: ld a,[wd730] bit 7,a ; are we simulating button presses? jr nz,.noDirectionChange ; ignore direction changes if we are - ld a,[wcc4b] + ld a,[wCheckFor180DegreeTurn] and a jr z,.noDirectionChange ld a,[wPlayerDirection] ; new direction @@ -182,39 +182,44 @@ OverworldLoopLessDelay:: ld a,[wPlayerLastStopDirection] ; old direction cp b jr z,.noDirectionChange -; the code below is strange -; it computes whether or not the player did a 180 degree turn, but then overwrites the result -; also, it does a seemingly pointless loop afterwards +; Check whether the player did a 180-degree turn. +; It appears that this code was supposed to show the player rotate by having +; the player's sprite face an intermediate direction before facing the opposite +; direction (instead of doing an instantaneous about-face), but the intermediate +; direction is only set for a short period of time. It is unlikely for it to +; ever be visible because DelayFrame is called at the start of OverworldLoop and +; normally not enough cycles would be executed between then and the time the +; direction is set for V-blank to occur while the direction is still set. swap a ; put old direction in upper half or b ; put new direction in lower half cp a,(PLAYER_DIR_DOWN << 4) | PLAYER_DIR_UP ; change dir from down to up jr nz,.notDownToUp ld a,PLAYER_DIR_LEFT ld [wPlayerMovingDirection],a - jr .oddLoop + jr .holdIntermediateDirectionLoop .notDownToUp cp a,(PLAYER_DIR_UP << 4) | PLAYER_DIR_DOWN ; change dir from up to down jr nz,.notUpToDown ld a,PLAYER_DIR_RIGHT ld [wPlayerMovingDirection],a - jr .oddLoop + jr .holdIntermediateDirectionLoop .notUpToDown cp a,(PLAYER_DIR_RIGHT << 4) | PLAYER_DIR_LEFT ; change dir from right to left jr nz,.notRightToLeft ld a,PLAYER_DIR_DOWN ld [wPlayerMovingDirection],a - jr .oddLoop + jr .holdIntermediateDirectionLoop .notRightToLeft cp a,(PLAYER_DIR_LEFT << 4) | PLAYER_DIR_RIGHT ; change dir from left to right - jr nz,.oddLoop + jr nz,.holdIntermediateDirectionLoop ld a,PLAYER_DIR_UP ld [wPlayerMovingDirection],a -.oddLoop +.holdIntermediateDirectionLoop ld hl,wFlags_0xcd60 set 2,[hl] - ld hl,wcc4b + ld hl,wCheckFor180DegreeTurn dec [hl] - jr nz,.oddLoop + jr nz,.holdIntermediateDirectionLoop ld a,[wPlayerDirection] ld [wPlayerMovingDirection],a call NewBattle @@ -493,7 +498,7 @@ WarpFound2:: ; 073c (0:073c) ; if not going back to the previous map ld [W_CURMAP],a callba IsPlayerStandingOnWarpPadOrHole - ld a,[wcd5b] + ld a,[wStandingOnWarpPadOrHole] dec a ; is the player on a warp pad? jr nz,.notWarpPad ; if the player is on a warp pad @@ -2007,7 +2012,7 @@ LoadPlayerSpriteGraphicsCommon:: ; 1063 (0:1063) LoadMapHeader:: ; 107c (0:107c) callba MarkTownVisitedAndLoadMissableObjects ld a,[W_CURMAPTILESET] - ld [wd119],a + ld [wUnusedD119],a ld a,[W_CURMAP] call SwitchToMapRomBank ld a,[W_CURMAPTILESET] @@ -2305,7 +2310,7 @@ LoadMapData:: ; 1241 (0:1241) ld [hSCY],a ld [hSCX],a ld [wWalkCounter],a - ld [wd119],a + ld [wUnusedD119],a ld [wWalkBikeSurfStateCopy],a ld [W_SPRITESETID],a call LoadTextBoxTilePatterns diff --git a/home/vblank.asm b/home/vblank.asm index 05b01a3d..6abc3756 100644 --- a/home/vblank.asm +++ b/home/vblank.asm @@ -6,7 +6,7 @@ VBlank:: push hl ld a, [H_LOADEDROMBANK] - ld [wd122], a + ld [wVBlankSavedROMBank], a ld a, [hSCX] ld [rSCX], a @@ -78,7 +78,7 @@ VBlank:: and a call z, ReadJoypad - ld a, [wd122] + ld a, [wVBlankSavedROMBank] ld [H_LOADEDROMBANK], a ld [MBC1RomBank], a diff --git a/home/vcopy.asm b/home/vcopy.asm index 8de00e38..02caef29 100644 --- a/home/vcopy.asm +++ b/home/vcopy.asm @@ -380,21 +380,23 @@ UpdateMovingBgTiles:: and a ret z ; no animations if indoors (or if a menu set this to 0) - ld a, [$ffd8] + ld a, [hMovingBGTilesCounter1] inc a - ld [$ffd8], a - cp $14 + ld [hMovingBGTilesCounter1], a + cp 20 ret c - cp $15 + cp 21 jr z, .flower +; water + ld hl, vTileset + $14 * $10 ld c, $10 - ld a, [wd085] + ld a, [wMovingBGTilesCounter2] inc a and 7 - ld [wd085], a + ld [wMovingBGTilesCounter2], a and 4 jr nz, .left @@ -417,14 +419,14 @@ UpdateMovingBgTiles:: ret nc ; if in a cave, no flower animations xor a - ld [$ffd8], a + ld [hMovingBGTilesCounter1], a ret .flower xor a - ld [$ffd8], a + ld [hMovingBGTilesCounter1], a - ld a, [wd085] + ld a, [wMovingBGTilesCounter2] and 3 cp 2 ld hl, FlowerTile1 @@ -259,6 +259,8 @@ H_VBLANKOCCURRED EQU $FFD6 ; this is often set to 00 in order to turn off water and flower BG tile animations hTilesetType EQU $FFD7 +hMovingBGTilesCounter1 EQU $FFD8 + H_CURRENTSPRITEOFFSET EQU $FFDA ; multiple of $10 hFossilCounter EQU $FFDB @@ -1642,39 +1642,39 @@ DisplayTwoOptionMenu: ; 7559 (1:7559) ; The bottom and right edges of the menu may remain after the function returns. TwoOptionMenu_SaveScreenTiles: ; 763e (1:763e) - ld de, wHPBarMaxHP - ld bc, $506 -.asm_7644 + ld de, wBuffer + lb bc, 5, 6 +.loop ld a, [hli] ld [de], a inc de dec c - jr nz, .asm_7644 + jr nz, .loop push bc - ld bc, 14 + ld bc, SCREEN_WIDTH - 6 add hl, bc pop bc ld c, $6 dec b - jr nz, .asm_7644 + jr nz, .loop ret TwoOptionMenu_RestoreScreenTiles: ; 7656 (1:7656) - ld de, wHPBarMaxHP - ld bc, $506 -.asm_765c + ld de, wBuffer + lb bc, 5, 6 +.loop ld a, [de] inc de ld [hli], a dec c - jr nz, .asm_765c + jr nz, .loop push bc - ld bc, $e + ld bc, SCREEN_WIDTH - 6 add hl, bc pop bc - ld c, $6 + ld c, 6 dec b - jr nz, .asm_765c + jr nz, .loop call UpdateSprites ret @@ -3167,9 +3167,9 @@ RedrawMapView: ; eedc (3:6edc) and $3 or $98 ld a, l - ld [wHPBarMaxHP], a + ld [wBuffer], a ld a, h - ld [wHPBarMaxHP + 1], a + ld [wBuffer + 1], a ; this copy of the address is not used ld a, 2 ld [$ffbe], a ld c, 9 ; number of rows of 2x2 tiles (this covers the whole screen) @@ -3177,25 +3177,25 @@ RedrawMapView: ; eedc (3:6edc) push bc push hl push hl - ld hl, wTileMap - 2 * 20 - ld de, 20 + ld hl, wTileMap - 2 * SCREEN_WIDTH + ld de, SCREEN_WIDTH ld a, [$ffbe] -.asm_ef1a +.calcWRAMAddrLoop add hl, de dec a - jr nz, .asm_ef1a + jr nz, .calcWRAMAddrLoop call CopyToScreenEdgeTiles pop hl ld de, $20 ld a, [$ffbe] ld c, a -.asm_ef28 +.calcVRAMAddrLoop add hl, de ld a, h and $3 or $98 dec c - jr nz, .asm_ef28 + jr nz, .calcVRAMAddrLoop ld [H_SCREENEDGEREDRAWADDR + 1], a ld a, l ld [H_SCREENEDGEREDRAWADDR], a @@ -3301,7 +3301,7 @@ InitializeMissableObjectsFlags: ; f175 (3:7175) call FillMemory ; clear missable objects flags ld hl, MapHS00 xor a - ld [wd048], a + ld [wMissableObjectCounter], a .missableObjectsLoop ld a, [hli] cp $ff ; end of list @@ -3310,14 +3310,14 @@ InitializeMissableObjectsFlags: ; f175 (3:7175) inc hl ld a, [hl] cp Hide - jr nz, .asm_f19d + jr nz, .skip ld hl, W_MISSABLEOBJECTFLAGS - ld a, [wd048] + ld a, [wMissableObjectCounter] ld c, a ld b, FLAG_SET - call MissableObjectFlagAction ; set flag iff Item is hidden -.asm_f19d - ld hl, wd048 + call MissableObjectFlagAction ; set flag if Item is hidden +.skip + ld hl, wMissableObjectCounter inc [hl] pop hl inc hl @@ -3351,21 +3351,21 @@ IsObjectHidden: ; f1a6 (3:71a6) ret ; adds missable object (items, leg. pokemon, etc.) to the map -; [wcc4d]: index of the missable object to be added (global index) +; [wMissableObjectIndex]: index of the missable object to be added (global index) ShowObject: ; f1c8 (3:71c8) ShowObject2: ld hl, W_MISSABLEOBJECTFLAGS - ld a, [wcc4d] + ld a, [wMissableObjectIndex] ld c, a ld b, FLAG_RESET call MissableObjectFlagAction ; reset "removed" flag jp UpdateSprites ; removes missable object (items, leg. pokemon, etc.) from the map -; [wcc4d]: index of the missable object to be removed (global index) +; [wMissableObjectIndex]: index of the missable object to be removed (global index) HideObject: ; f1d7 (3:71d7) ld hl, W_MISSABLEOBJECTFLAGS - ld a, [wcc4d] + ld a, [wMissableObjectIndex] ld c, a ld b, FLAG_SET call MissableObjectFlagAction ; set "removed" flag diff --git a/scripts/billshouse.asm b/scripts/billshouse.asm index 71e61603..e4cfc031 100755 --- a/scripts/billshouse.asm +++ b/scripts/billshouse.asm @@ -49,7 +49,7 @@ BillsHouseScript2: ; 1e7a6 (7:67a6) bit 0, a ret nz ld a, HS_BILL_POKEMON - ld [wcc4d], a + ld [wMissableObjectIndex], a predef HideObject SetEvent EVENT_BILL_SAID_USE_CELL_SEPARATOR xor a @@ -75,7 +75,7 @@ BillsHouseScript3: ; 1e7c5 (7:67c5) ld [$ffee], a call SetSpritePosition1 ld a, HS_BILL_1 - ld [wcc4d], a + ld [wMissableObjectIndex], a predef ShowObject ld c, 8 call DelayFrames @@ -170,10 +170,10 @@ BillsHouseText2: ; 1e874 (7:6874) call PrintText SetEvent EVENT_GOT_SS_TICKET ld a, HS_CERULEAN_GUARD_1 - ld [wcc4d], a + ld [wMissableObjectIndex], a predef ShowObject ld a, HS_CERULEAN_GUARD_2 - ld [wcc4d], a + ld [wMissableObjectIndex], a predef HideObject .asm_1e8a9 ld hl, BillsHouseText_1e8cb diff --git a/scripts/blueshouse.asm b/scripts/blueshouse.asm index 12ca9106..0e29d64c 100755 --- a/scripts/blueshouse.asm +++ b/scripts/blueshouse.asm @@ -40,7 +40,7 @@ BluesHouseText1: ; 19b5d (6:5b5d) call GiveItem jr nc, .BagFull ld a,HS_TOWN_MAP - ld [wcc4d],a + ld [wMissableObjectIndex],a predef HideObject ; hide table map object ld hl,GotMapText call PrintText diff --git a/scripts/celadongamecorner.asm b/scripts/celadongamecorner.asm index 84919b64..e8917434 100755 --- a/scripts/celadongamecorner.asm +++ b/scripts/celadongamecorner.asm @@ -107,7 +107,7 @@ CeladonGameCornerScript2: ; 48c69 (12:4c69) xor a ld [wJoyIgnore], a ld a, HS_GAME_CORNER_ROCKET - ld [wcc4d], a + ld [wMissableObjectIndex], a predef HideObject ld hl, wd126 set 5, [hl] diff --git a/scripts/celadonmansion5.asm b/scripts/celadonmansion5.asm index f847759b..60d2cc92 100755 --- a/scripts/celadonmansion5.asm +++ b/scripts/celadonmansion5.asm @@ -15,7 +15,7 @@ CeladonMansion5Text2: ; 1dd46 (7:5d46) call GivePokemon jr nc, .asm_24365 ld a, HS_CELADON_MANSION_5_GIFT - ld [wcc4d], a + ld [wMissableObjectIndex], a predef HideObject .asm_24365 jp TextScriptEnd diff --git a/scripts/ceruleancity.asm b/scripts/ceruleancity.asm index 5da549f3..c13e66e2 100755 --- a/scripts/ceruleancity.asm +++ b/scripts/ceruleancity.asm @@ -9,7 +9,7 @@ CeruleanCityScript_1948c: ; 1948c (6:548c) ld [wJoyIgnore], a ld [W_CERULEANCITYCURSCRIPT], a ld a, HS_CERULEAN_RIVAL - ld [wcc4d], a + ld [wMissableObjectIndex], a predef_jump HideObject CeruleanCityScriptPointers: ; 1949d (6:549d) @@ -86,7 +86,7 @@ CeruleanCityScript0: ; 194c8 (6:54c8) ld [hl], $19 .asm_19535 ld a, HS_CERULEAN_RIVAL - ld [wcc4d], a + ld [wMissableObjectIndex], a predef ShowObject ld de, CeruleanCityMovement1 ld a, $1 @@ -218,7 +218,7 @@ CeruleanCityScript3: ; 19610 (6:5610) bit 0, a ret nz ld a, HS_CERULEAN_RIVAL - ld [wcc4d], a + ld [wMissableObjectIndex], a predef HideObject xor a ld [wJoyIgnore], a diff --git a/scripts/ceruleancity2.asm b/scripts/ceruleancity2.asm index 2232b0f4..3dafb3f8 100755 --- a/scripts/ceruleancity2.asm +++ b/scripts/ceruleancity2.asm @@ -4,13 +4,13 @@ CeruleanHideRocket: ; 74872 (1d:4872) ; the screen then fades out, he disappears, and fades back in call GBFadeOutToBlack ld a, HS_CERULEAN_GUARD_1 - ld [wcc4d], a + ld [wMissableObjectIndex], a predef ShowObject ld a, HS_CERULEAN_GUARD_2 - ld [wcc4d], a + ld [wMissableObjectIndex], a predef HideObject ld a, HS_CERULEAN_ROCKET - ld [wcc4d], a + ld [wMissableObjectIndex], a predef HideObject call GBFadeInFromBlack ret diff --git a/scripts/fightingdojo.asm b/scripts/fightingdojo.asm index 91d8a484..fa05d486 100755 --- a/scripts/fightingdojo.asm +++ b/scripts/fightingdojo.asm @@ -274,7 +274,7 @@ FightingDojoText6: ; 5cf06 (17:4f06) ; once Poké Ball is taken, hide sprite ld a, HS_FIGHTING_DOJO_GIFT_1 - ld [wcc4d], a + ld [wMissableObjectIndex], a predef HideObject SetEvents EVENT_GOT_HITMONLEE, EVENT_DEFEATED_FIGHTING_DOJO .done @@ -310,7 +310,7 @@ FightingDojoText7: ; 5cf4e (17:4f4e) ; once Poké Ball is taken, hide sprite ld a, HS_FIGHTING_DOJO_GIFT_2 - ld [wcc4d], a + ld [wMissableObjectIndex], a predef HideObject .done jp TextScriptEnd diff --git a/scripts/gary.asm b/scripts/gary.asm index 24a2d2de..9a3b1582 100755 --- a/scripts/gary.asm +++ b/scripts/gary.asm @@ -120,7 +120,7 @@ GaryScript4: ; 75fe4 (1d:5fe4) ld [H_SPRITEINDEX], a call MoveSprite ld a, HS_CHAMPIONS_ROOM_OAK - ld [wcc4d], a + ld [wMissableObjectIndex], a predef ShowObject ld a, $5 ld [W_GARYCURSCRIPT], a @@ -197,7 +197,7 @@ GaryScript8: ; 76083 (1d:6083) bit 0, a ret nz ld a, HS_CHAMPIONS_ROOM_OAK - ld [wcc4d], a + ld [wMissableObjectIndex], a predef HideObject ld a, $9 ld [W_GARYCURSCRIPT], a diff --git a/scripts/halloffameroom.asm b/scripts/halloffameroom.asm index 9a5b595a..1da6d3f5 100755 --- a/scripts/halloffameroom.asm +++ b/scripts/halloffameroom.asm @@ -95,7 +95,7 @@ HallofFameRoomScript1: ; 5a52b (16:652b) ld a, $ff ld [wJoyIgnore], a ld a, HS_UNKNOWN_DUNGEON_GUY - ld [wcc4d], a + ld [wMissableObjectIndex], a predef HideObject ld a, $2 ld [W_HALLOFFAMEROOMCURSCRIPT], a diff --git a/scripts/mtmoon3.asm b/scripts/mtmoon3.asm index 4542cc53..21c959aa 100755 --- a/scripts/mtmoon3.asm +++ b/scripts/mtmoon3.asm @@ -145,7 +145,7 @@ MtMoon3Script5: ; 49dfb (12:5dfb) .asm_49e1d ld a, HS_MT_MOON_3_FOSSIL_1 .asm_49e1f - ld [wcc4d], a + ld [wMissableObjectIndex], a predef HideObject xor a ld [wJoyIgnore], a @@ -276,7 +276,7 @@ MtMoon3Text6: ; 49ee9 (12:5ee9) jp nc, MtMoon3Script_49f76 call MtMoon3Script_49f69 ld a, HS_MT_MOON_3_FOSSIL_1 - ld [wcc4d], a + ld [wMissableObjectIndex], a predef HideObject SetEvent EVENT_GOT_DOME_FOSSIL ld a, $4 @@ -304,7 +304,7 @@ MtMoon3Text7: ; 49f29 (12:5f29) jp nc, MtMoon3Script_49f76 call MtMoon3Script_49f69 ld a, HS_MT_MOON_3_FOSSIL_2 - ld [wcc4d], a + ld [wMissableObjectIndex], a predef HideObject SetEvent EVENT_GOT_HELIX_FOSSIL ld a, $4 diff --git a/scripts/museum1f.asm b/scripts/museum1f.asm index 77c7f270..4c209eb8 100755 --- a/scripts/museum1f.asm +++ b/scripts/museum1f.asm @@ -196,7 +196,7 @@ Museum1FText3: ; 5c256 (17:4256) jr nc, .BagFull SetEvent EVENT_GOT_OLD_AMBER ld a, HS_OLD_AMBER - ld [wcc4d], a + ld [wMissableObjectIndex], a predef HideObject ld hl, ReceivedOldAmberText jr .asm_5c288 diff --git a/scripts/oakslab.asm b/scripts/oakslab.asm index a2fa4338..329d3c25 100755 --- a/scripts/oakslab.asm +++ b/scripts/oakslab.asm @@ -37,7 +37,7 @@ OaksLabScript0: ; 1cb4e (7:4b4e) and a ret nz ld a, HS_OAKS_LAB_OAK_2 - ld [wcc4d], a + ld [wMissableObjectIndex], a predef ShowObject ld hl, wd72e res 4, [hl] @@ -67,10 +67,10 @@ OaksLabScript2: ; 1cb82 (7:4b82) bit 0, a ret nz ld a, HS_OAKS_LAB_OAK_2 - ld [wcc4d], a + ld [wMissableObjectIndex], a predef HideObject ld a, HS_OAKS_LAB_OAK_1 - ld [wcc4d], a + ld [wMissableObjectIndex], a predef ShowObject ld a, $3 @@ -315,7 +315,7 @@ OaksLabScript9: ; 1cd00 (7:4d00) .asm_1cd30 ld a, HS_STARTER_BALL_3 .asm_1cd32 - ld [wcc4d], a + ld [wMissableObjectIndex], a predef HideObject call Delay3 ld a, [wRivalStarterTemp] @@ -475,7 +475,7 @@ OaksLabScript14: ; 1ce6d (7:4e6d) bit 0, a jr nz, .asm_1ce8c ld a, HS_OAKS_LAB_RIVAL - ld [wcc4d], a + ld [wMissableObjectIndex], a predef HideObject xor a ld [wJoyIgnore], a @@ -519,7 +519,7 @@ OaksLabScript15: ; 1ceb0 (7:4eb0) call DisplayTextID call OaksLabScript_1d02b ld a, HS_OAKS_LAB_RIVAL - ld [wcc4d], a + ld [wMissableObjectIndex], a predef ShowObject ld a, [wNPCMovementDirections2Index] ld [wd157], a @@ -578,10 +578,10 @@ OaksLabScript16: ; 1cf12 (7:4f12) call DisplayTextID call Delay3 ld a, HS_POKEDEX_1 - ld [wcc4d], a + ld [wMissableObjectIndex], a predef HideObject ld a, HS_POKEDEX_2 - ld [wcc4d], a + ld [wMissableObjectIndex], a predef HideObject call OaksLabScript_1cefd ld a, $1a @@ -599,10 +599,10 @@ OaksLabScript16: ; 1cf12 (7:4f12) SetEvent EVENT_GOT_POKEDEX SetEvent EVENT_OAK_GOT_PARCEL ld a, HS_LYING_OLD_MAN - ld [wcc4d], a + ld [wMissableObjectIndex], a predef HideObject ld a, HS_OLD_MAN - ld [wcc4d], a + ld [wMissableObjectIndex], a predef ShowObject ld a, [wd157] ld b, $0 @@ -630,13 +630,13 @@ OaksLabScript17: ; 1cfd4 (7:4fd4) ret nz call PlayDefaultMusic ld a, HS_OAKS_LAB_RIVAL - ld [wcc4d], a + ld [wMissableObjectIndex], a predef HideObject SetEvent EVENT_1ST_ROUTE22_RIVAL_BATTLE ResetEventReuseHL EVENT_2ND_ROUTE22_RIVAL_BATTLE SetEventReuseHL EVENT_ROUTE22_RIVAL_WANTS_BATTLE ld a, HS_ROUTE_22_RIVAL_1 - ld [wcc4d], a + ld [wMissableObjectIndex], a predef ShowObject ld a, $5 ld [W_PALLETTOWNCURSCRIPT], a @@ -914,7 +914,7 @@ OaksLabMonChoiceMenu: ; 1d1b3 (7:51b3) .asm_1d1e3 ld a, HS_STARTER_BALL_3 .asm_1d1e5 - ld [wcc4d], a + ld [wMissableObjectIndex], a predef HideObject ld a, $1 ld [wDoNotWaitForButtonPressAfterDisplayingText], a diff --git a/scripts/pallettown.asm b/scripts/pallettown.asm index 0fd7300e..e4c3f135 100755 --- a/scripts/pallettown.asm +++ b/scripts/pallettown.asm @@ -51,7 +51,7 @@ PalletTownScript1: ; 18eb2 (6:4eb2) ld a,$FF ld [wJoyIgnore],a ld a,HS_PALLET_TOWN_OAK - ld [wcc4d],a + ld [wMissableObjectIndex],a predef ShowObject ; trigger the next script @@ -136,10 +136,10 @@ PalletTownScript5: ; 18f56 (6:4f56) jr nz,.next SetEvent EVENT_DAISY_WALKING ld a,HS_DAISY_SITTING - ld [wcc4d],a + ld [wMissableObjectIndex],a predef HideObject ld a,HS_DAISY_WALKING - ld [wcc4d],a + ld [wMissableObjectIndex],a predef_jump ShowObject .next CheckEvent EVENT_GOT_POKEBALLS_FROM_OAK diff --git a/scripts/pewtercity.asm b/scripts/pewtercity.asm index 77da14f8..66589d52 100755 --- a/scripts/pewtercity.asm +++ b/scripts/pewtercity.asm @@ -88,7 +88,7 @@ PewterCityScript2: ; 192d3 (6:52d3) bit 0, a ret nz ld a, HS_MUSEUM_GUY - ld [wcc4d], a + ld [wMissableObjectIndex], a predef HideObject ld a, $3 ld [W_PEWTERCITYCURSCRIPT], a @@ -99,7 +99,7 @@ PewterCityScript3: ; 192e9 (6:52e9) ld [wSpriteIndex], a call SetSpritePosition2 ld a, HS_MUSEUM_GUY - ld [wcc4d], a + ld [wMissableObjectIndex], a predef ShowObject xor a ld [wJoyIgnore], a @@ -157,7 +157,7 @@ PewterCityScript5: ; 19359 (6:5359) bit 0, a ret nz ld a, HS_GYM_GUY - ld [wcc4d], a + ld [wMissableObjectIndex], a predef HideObject ld a, $6 ld [W_PEWTERCITYCURSCRIPT], a @@ -168,7 +168,7 @@ PewterCityScript6: ; 1936f (6:536f) ld [wSpriteIndex], a call SetSpritePosition2 ld a, HS_GYM_GUY - ld [wcc4d], a + ld [wMissableObjectIndex], a predef ShowObject xor a ld [wJoyIgnore], a diff --git a/scripts/pewtergym.asm b/scripts/pewtergym.asm index 576e8246..704ea104 100755 --- a/scripts/pewtergym.asm +++ b/scripts/pewtergym.asm @@ -66,10 +66,10 @@ PewterGymScript_5c3df: ; 5c3df (17:43df) set 0, [hl] ld a, HS_GYM_GUY - ld [wcc4d], a + ld [wMissableObjectIndex], a predef HideObject ld a, HS_ROUTE_22_RIVAL_1 - ld [wcc4d], a + ld [wMissableObjectIndex], a predef HideObject ResetEvents EVENT_1ST_ROUTE22_RIVAL_BATTLE, EVENT_ROUTE22_RIVAL_WANTS_BATTLE diff --git a/scripts/pokemontower2.asm b/scripts/pokemontower2.asm index c7b94c4f..a569b60b 100755 --- a/scripts/pokemontower2.asm +++ b/scripts/pokemontower2.asm @@ -112,7 +112,7 @@ PokemonTower2Script2: ; 605bb (18:45bb) bit 0, a ret nz ld a, HS_POKEMONTOWER_2_RIVAL - ld [wcc4d], a + ld [wMissableObjectIndex], a predef HideObject xor a ld [wJoyIgnore], a diff --git a/scripts/pokemontower7.asm b/scripts/pokemontower7.asm index 3698f4ee..f1fceb2f 100755 --- a/scripts/pokemontower7.asm +++ b/scripts/pokemontower7.asm @@ -51,7 +51,7 @@ PokemonTower7Script3: ; 60d56 (18:4d56) cp b ; search for sprite ID in missing objects list ld a, [hli] jr nz, .missableObjectsListLoop - ld [wcc4d], a ; remove missable object + ld [wMissableObjectIndex], a ; remove missable object predef HideObject xor a ld [wJoyIgnore], a @@ -67,7 +67,7 @@ PokemonTower7Script4: ; 60d86 (18:4d86) ld a, $ff ld [wJoyIgnore], a ld a, HS_POKEMONTOWER_7_MR_FUJI - ld [wcc4d], a + ld [wMissableObjectIndex], a predef HideObject ld a, SPRITE_FACING_UP ld [wSpriteStateData1 + 9], a @@ -259,13 +259,13 @@ PokemonTower7FujiText: SetEvent EVENT_RESCUED_MR_FUJI SetEvent EVENT_RESCUED_MR_FUJI_2 ld a, HS_LAVENDER_HOUSE_1_MR_FUJI - ld [wcc4d], a + ld [wMissableObjectIndex], a predef ShowObject ld a, HS_SAFFRON_CITY_E - ld [wcc4d], a + ld [wMissableObjectIndex], a predef HideObject ld a, HS_SAFFRON_CITY_F - ld [wcc4d], a + ld [wMissableObjectIndex], a predef ShowObject ld a, $4 ld [W_POKEMONTOWER7CURSCRIPT], a diff --git a/scripts/rockethideout4.asm b/scripts/rockethideout4.asm index ed2bb61d..62d6f6bb 100755 --- a/scripts/rockethideout4.asm +++ b/scripts/rockethideout4.asm @@ -56,10 +56,10 @@ RocketHideout4Script3: ; 454b6 (11:54b6) call DisplayTextID call GBFadeOutToBlack ld a, HS_ROCKET_HIDEOUT_4_GIOVANNI - ld [wcc4d], a + ld [wMissableObjectIndex], a predef HideObject ld a, HS_ROCKET_HIDEOUT_4_ITEM_4 - ld [wcc4d], a + ld [wMissableObjectIndex], a predef ShowObject call UpdateSprites call GBFadeInFromBlack @@ -211,7 +211,7 @@ RocketHideout4AfterBattleText4: ; 455cf (11:55cf) CheckAndSetEvent EVENT_ROCKET_DROPPED_LIFT_KEY jr nz, .asm_455e9 ld a, HS_ROCKET_HIDEOUT_4_ITEM_5 - ld [wcc4d], a + ld [wMissableObjectIndex], a predef ShowObject .asm_455e9 jp TextScriptEnd diff --git a/scripts/route12.asm b/scripts/route12.asm index be20958e..4057ce03 100755 --- a/scripts/route12.asm +++ b/scripts/route12.asm @@ -34,7 +34,7 @@ Route12Script0: ; 59619 (16:5619) ld a, 30 ld [W_CURENEMYLVL], a ld a, HS_ROUTE_12_SNORLAX - ld [wcc4d], a + ld [wMissableObjectIndex], a predef HideObject ld a, $3 ld [W_ROUTE12CURSCRIPT], a diff --git a/scripts/route16.asm b/scripts/route16.asm index 286b5289..c762c999 100755 --- a/scripts/route16.asm +++ b/scripts/route16.asm @@ -34,7 +34,7 @@ Route16Script0: ; 59959 (16:5959) ld a, 30 ld [W_CURENEMYLVL], a ld a, HS_ROUTE_16_SNORLAX - ld [wcc4d], a + ld [wMissableObjectIndex], a predef HideObject call UpdateSprites ld a, $3 diff --git a/scripts/route20.asm b/scripts/route20.asm index 2ef51da9..ce9e6f23 100755 --- a/scripts/route20.asm +++ b/scripts/route20.asm @@ -49,11 +49,11 @@ Route20Script_50cc6: ; 50cc6 (14:4cc6) ret Route20Script_50d0c: ; 50d0c (14:4d0c) - ld [wcc4d], a + ld [wMissableObjectIndex], a predef_jump ShowObject Route20Script_50d14: ; 50d14 (14:4d14) - ld [wcc4d], a + ld [wMissableObjectIndex], a predef_jump HideObject Route20ScriptPointers: ; 50d1c (14:4d1c) diff --git a/scripts/route22.asm b/scripts/route22.asm index 25b16886..041f75e6 100755 --- a/scripts/route22.asm +++ b/scripts/route22.asm @@ -224,7 +224,7 @@ Route22Script3: ; 5102a (14:502a) xor a ld [wJoyIgnore], a ld a, HS_ROUTE_22_RIVAL_1 - ld [wcc4d], a + ld [wMissableObjectIndex], a predef HideObject call PlayDefaultMusic ResetEvents EVENT_1ST_ROUTE22_RIVAL_BATTLE, EVENT_ROUTE22_RIVAL_WANTS_BATTLE @@ -369,7 +369,7 @@ Route22Script6: ; 51151 (14:5151) xor a ld [wJoyIgnore], a ld a, HS_ROUTE_22_RIVAL_2 - ld [wcc4d], a + ld [wMissableObjectIndex], a predef HideObject call PlayDefaultMusic ResetEvents EVENT_2ND_ROUTE22_RIVAL_BATTLE, EVENT_ROUTE22_RIVAL_WANTS_BATTLE diff --git a/scripts/route23.asm b/scripts/route23.asm index adc631d8..35f1b9cb 100755 --- a/scripts/route23.asm +++ b/scripts/route23.asm @@ -13,10 +13,10 @@ Route23Script_511e9: ; 511e9 (14:51e9) 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 ld a, HS_VICTORY_ROAD_3_BOULDER - ld [wcc4d], a + ld [wMissableObjectIndex], a predef ShowObject ld a, HS_VICTORY_ROAD_2_BOULDER - ld [wcc4d], a + ld [wMissableObjectIndex], a predef_jump HideObject Route23ScriptPointers: ; 51213 (14:5213) diff --git a/scripts/route25.asm b/scripts/route25.asm index a123d74a..49580ba6 100755 --- a/scripts/route25.asm +++ b/scripts/route25.asm @@ -19,20 +19,20 @@ Route25Script_515e1: ; 515e1 (14:55e1) jr nz, .asm_515ff ResetEventReuseHL EVENT_BILL_SAID_USE_CELL_SEPARATOR ld a, HS_BILL_POKEMON - ld [wcc4d], a + ld [wMissableObjectIndex], a predef_jump ShowObject .asm_515ff CheckEventAfterBranchReuseHL EVENT_GOT_SS_TICKET, EVENT_MET_BILL_2 ret z SetEventReuseHL EVENT_LEFT_BILLS_HOUSE_AFTER_HELPING ld a, HS_NUGGET_BRIDGE_GUY - ld [wcc4d], a + ld [wMissableObjectIndex], a predef HideObject ld a, HS_BILL_1 - ld [wcc4d], a + ld [wMissableObjectIndex], a predef HideObject ld a, HS_BILL_2 - ld [wcc4d], a + ld [wMissableObjectIndex], a predef_jump ShowObject Route25ScriptPointers: ; 51622 (14:5622) diff --git a/scripts/seafoamislands1.asm b/scripts/seafoamislands1.asm index 542afe18..f9a2e7fc 100755 --- a/scripts/seafoamislands1.asm +++ b/scripts/seafoamislands1.asm @@ -14,22 +14,22 @@ SeafoamIslands1Script: ; 447e9 (11:47e9) jr nz, .asm_44819 SetEventReuseHL EVENT_SEAFOAM1_BOULDER1_DOWN_HOLE ld a, HS_SEAFOAM_ISLANDS_1_BOULDER_1 - ld [wd079], a + ld [wObjectToHide], a ld a, HS_SEAFOAM_ISLANDS_2_BOULDER_1 - ld [wd07a], a + ld [wObjectToShow], a jr .asm_44825 .asm_44819 SetEventAfterBranchReuseHL EVENT_SEAFOAM1_BOULDER2_DOWN_HOLE, EVENT_SEAFOAM1_BOULDER1_DOWN_HOLE ld a, HS_SEAFOAM_ISLANDS_1_BOULDER_2 - ld [wd079], a + ld [wObjectToHide], a ld a, HS_SEAFOAM_ISLANDS_2_BOULDER_2 - ld [wd07a], a + ld [wObjectToShow], a .asm_44825 - ld a, [wd079] - ld [wcc4d], a + ld a, [wObjectToHide] + ld [wMissableObjectIndex], a predef HideObject - ld a, [wd07a] - ld [wcc4d], a + ld a, [wObjectToShow] + ld [wMissableObjectIndex], a predef_jump ShowObject .asm_4483b ld a, $9f diff --git a/scripts/seafoamislands2.asm b/scripts/seafoamislands2.asm index bf81a467..2c2962f8 100755 --- a/scripts/seafoamislands2.asm +++ b/scripts/seafoamislands2.asm @@ -13,22 +13,22 @@ SeafoamIslands2Script: ; 46315 (11:6315) jr nz, .asm_46340 SetEventReuseHL EVENT_SEAFOAM2_BOULDER1_DOWN_HOLE ld a, HS_SEAFOAM_ISLANDS_2_BOULDER_1 - ld [wd079], a + ld [wObjectToHide], a ld a, HS_SEAFOAM_ISLANDS_3_BOULDER_1 - ld [wd07a], a + ld [wObjectToShow], a jr .asm_4634c .asm_46340 SetEventAfterBranchReuseHL EVENT_SEAFOAM2_BOULDER2_DOWN_HOLE, EVENT_SEAFOAM2_BOULDER1_DOWN_HOLE ld a, HS_SEAFOAM_ISLANDS_2_BOULDER_2 - ld [wd079], a + ld [wObjectToHide], a ld a, HS_SEAFOAM_ISLANDS_3_BOULDER_2 - ld [wd07a], a + ld [wObjectToShow], a .asm_4634c - ld a, [wd079] - ld [wcc4d], a + ld a, [wObjectToHide] + ld [wMissableObjectIndex], a predef HideObject - ld a, [wd07a] - ld [wcc4d], a + ld a, [wObjectToShow] + ld [wMissableObjectIndex], a predef_jump ShowObject .asm_46362 ld a, $a0 diff --git a/scripts/seafoamislands3.asm b/scripts/seafoamislands3.asm index 8f66a0ca..6dda7f37 100755 --- a/scripts/seafoamislands3.asm +++ b/scripts/seafoamislands3.asm @@ -13,22 +13,22 @@ SeafoamIslands3Script: ; 46451 (11:6451) jr nz, .asm_4647c SetEventReuseHL EVENT_SEAFOAM3_BOULDER1_DOWN_HOLE ld a, HS_SEAFOAM_ISLANDS_3_BOULDER_1 - ld [wd079], a + ld [wObjectToHide], a ld a, HS_SEAFOAM_ISLANDS_4_BOULDER_3 - ld [wd07a], a + ld [wObjectToShow], a jr .asm_46488 .asm_4647c SetEventAfterBranchReuseHL EVENT_SEAFOAM3_BOULDER2_DOWN_HOLE, EVENT_SEAFOAM3_BOULDER1_DOWN_HOLE ld a, HS_SEAFOAM_ISLANDS_3_BOULDER_2 - ld [wd079], a + ld [wObjectToHide], a ld a, HS_SEAFOAM_ISLANDS_4_BOULDER_4 - ld [wd07a], a + ld [wObjectToShow], a .asm_46488 - ld a, [wd079] - ld [wcc4d], a + ld a, [wObjectToHide] + ld [wMissableObjectIndex], a predef HideObject - ld a, [wd07a] - ld [wcc4d], a + ld a, [wObjectToShow] + ld [wMissableObjectIndex], a predef_jump ShowObject .asm_4649e ld a, $a1 diff --git a/scripts/seafoamislands4.asm b/scripts/seafoamislands4.asm index dc198123..f7407e48 100755 --- a/scripts/seafoamislands4.asm +++ b/scripts/seafoamislands4.asm @@ -13,22 +13,22 @@ SeafoamIslands4Script: ; 4658d (11:658d) jr nz, .asm_465b8 SetEventReuseHL EVENT_SEAFOAM4_BOULDER1_DOWN_HOLE ld a, HS_SEAFOAM_ISLANDS_4_BOULDER_1 - ld [wd079], a + ld [wObjectToHide], a ld a, HS_SEAFOAM_ISLANDS_5_BOULDER_1 - ld [wd07a], a + ld [wObjectToShow], a jr .asm_465c4 .asm_465b8 SetEventAfterBranchReuseHL EVENT_SEAFOAM4_BOULDER2_DOWN_HOLE, EVENT_SEAFOAM4_BOULDER1_DOWN_HOLE ld a, HS_SEAFOAM_ISLANDS_4_BOULDER_2 - ld [wd079], a + ld [wObjectToHide], a ld a, HS_SEAFOAM_ISLANDS_5_BOULDER_2 - ld [wd07a], a + ld [wObjectToShow], a .asm_465c4 - ld a, [wd079] - ld [wcc4d], a + ld a, [wObjectToHide] + ld [wMissableObjectIndex], a predef HideObject - ld a, [wd07a] - ld [wcc4d], a + ld a, [wObjectToShow] + ld [wMissableObjectIndex], a predef ShowObject jr .asm_465ed .asm_465dc diff --git a/scripts/silphco1.asm b/scripts/silphco1.asm index 71b59d72..cfd51dc1 100755 --- a/scripts/silphco1.asm +++ b/scripts/silphco1.asm @@ -5,7 +5,7 @@ SilphCo1Script: ; 5d44e (17:544e) CheckAndSetEvent EVENT_SILPH_CO_RECEPTIONIST_AT_DESK ret nz ld a, HS_SILPH_CO_1F_RECEPTIONIST - ld [wcc4d], a + ld [wMissableObjectIndex], a predef_jump ShowObject SilphCo1TextPointers: ; 5d469 (17:5469) diff --git a/scripts/silphco11.asm b/scripts/silphco11.asm index 5de025f0..9cdf2891 100755 --- a/scripts/silphco11.asm +++ b/scripts/silphco11.asm @@ -76,7 +76,7 @@ SilphCo11Script_6216d: ; 6216d (18:616d) cp $ff jr z, .asm_62181 push hl - ld [wcc4d], a + ld [wMissableObjectIndex], a predef HideObject pop hl jr .asm_62170 @@ -87,7 +87,7 @@ SilphCo11Script_6216d: ; 6216d (18:616d) cp $ff ret z push hl - ld [wcc4d], a + ld [wMissableObjectIndex], a predef ShowObject pop hl jr .asm_62184 diff --git a/scripts/silphco7.asm b/scripts/silphco7.asm index 7169f0c0..44e92475 100755 --- a/scripts/silphco7.asm +++ b/scripts/silphco7.asm @@ -252,7 +252,7 @@ SilphCo7Script5: ; 51d25 (14:5d25) bit 0, a ret nz ld a, HS_SILPH_CO_7F_RIVAL - ld [wcc4d], a + ld [wMissableObjectIndex], a predef HideObject call PlayDefaultMusic xor a diff --git a/scripts/ssanne2.asm b/scripts/ssanne2.asm index bc13d4b6..b95c5723 100755 --- a/scripts/ssanne2.asm +++ b/scripts/ssanne2.asm @@ -33,7 +33,7 @@ SSAnne2Script0: ; 613be (18:53be) ld a, [wCoordIndex] ld [$ffdb], a ld a, HS_SS_ANNE_2_RIVAL - ld [wcc4d], a + ld [wMissableObjectIndex], a predef ShowObject call Delay3 ld a, $2 @@ -171,7 +171,7 @@ SSAnne2Script3: ; 614be (18:54be) xor a ld [wJoyIgnore], a ld a, HS_SS_ANNE_2_RIVAL - ld [wcc4d], a + ld [wMissableObjectIndex], a predef HideObject call PlayDefaultMusic ld a, $4 diff --git a/scripts/vermilioncity.asm b/scripts/vermilioncity.asm index 7448e8f9..64ccc477 100755 --- a/scripts/vermilioncity.asm +++ b/scripts/vermilioncity.asm @@ -17,7 +17,7 @@ VermilionCityScript_197c0: ; 197c0 (6:57c0) call Random ld a, [$ffd4] and $e - ld [wd743], a + ld [wFirstLockTrashCanIndex], a ret VermilionCityScript_197cb: ; 197cb (6:57cb) diff --git a/scripts/victoryroad3.asm b/scripts/victoryroad3.asm index 33a29e44..c5aaef50 100755 --- a/scripts/victoryroad3.asm +++ b/scripts/victoryroad3.asm @@ -44,10 +44,10 @@ VictoryRoad3Script0: ; 449b7 (11:49b7) CheckAndSetEvent EVENT_VICTORY_ROAD_3_BOULDER_ON_SWITCH2 jr nz, .asm_449fe ld a, HS_VICTORY_ROAD_3_BOULDER - ld [wcc4d], a + ld [wMissableObjectIndex], a predef HideObject ld a, HS_VICTORY_ROAD_2_BOULDER - ld [wcc4d], a + ld [wMissableObjectIndex], a predef_jump ShowObject .coordsData_449f9: ; 449f9 (11:49f9) diff --git a/scripts/viridiangym.asm b/scripts/viridiangym.asm index 3855d316..0e075b2f 100755 --- a/scripts/viridiangym.asm +++ b/scripts/viridiangym.asm @@ -163,7 +163,7 @@ ViridianGymScript3_74995: ; 74995 (1d:4995) SetEventRange EVENT_BEAT_VIRIDIAN_GYM_TRAINER_0, EVENT_BEAT_VIRIDIAN_GYM_TRAINER_7 ld a, HS_ROUTE_22_RIVAL_2 - ld [wcc4d], a + ld [wMissableObjectIndex], a predef ShowObject SetEvents EVENT_2ND_ROUTE22_RIVAL_BATTLE, EVENT_ROUTE22_RIVAL_WANTS_BATTLE jp ViridianGymScript_748d6 @@ -275,7 +275,7 @@ ViridianGymText1: ; 74a69 (1d:4a69) call PrintText call GBFadeOutToBlack ld a, HS_VIRIDIAN_GYM_GIOVANNI - ld [wcc4d], a + ld [wMissableObjectIndex], a predef HideObject call UpdateSprites call Delay3 diff --git a/text/maps/name_rater.asm b/text/maps/name_rater.asm index 2baec727..052a9588 100644 --- a/text/maps/name_rater.asm +++ b/text/maps/name_rater.asm @@ -35,7 +35,7 @@ _NameRaterText_1dac7:: ; 9a404 (26:6404) text "OK! This #MON" line "has been renamed" cont "@" - TX_RAM wHPBarMaxHP + TX_RAM wBuffer text "!" para "That's a better" @@ -360,8 +360,14 @@ wMenuWrappingEnabled:: ; cc4a ; set to 0 if you can't go past the top or bottom of the menu ds 1 -wcc4b:: ds 2 ; used as a joypad storage value -wcc4d:: ds 1 ; used in sprite hiding/showing related operations +wCheckFor180DegreeTurn:: ; cc4b +; whether to check for 180-degree turn (0 = don't, 1 = do) + ds 1 + + ds 1 + +wMissableObjectIndex:: ; cc4d + ds 1 wPredefID:: ; cc4e ds 1 @@ -979,10 +985,18 @@ wWhichAnimationOffsets:: ; cd50 wTradedEnemyMonOTID:: ; cd59 ds 2 +wStandingOnWarpPadOrHole:: ; cd5b +; 0 = neither +; 1 = warp pad +; 2 = hole + wOAMBaseTile:: ; cd5b -wcd5b:: ds 1 ; used in some sprite stuff, town map and surge gym trash cans -wcd5c:: ds 1 ; used in town map +wGymTrashCanIndex:: ; cd5b + ds 1 + +wSymmetricSpriteOAMAttributes:: ; cd5c + ds 1 wMonPartySpriteSpecies:: ; cd5d ds 1 @@ -1049,6 +1063,8 @@ wTileMapBackup2:: ; cd81 ; second buffer for temporarily saving and restoring current screen's tiles (e.g. if menus are drawn on top) ds 20 * 18 +wNamingScreenNameLength:: ; cee9 + wEvoOldSpecies:: ; cee9 wBuffer:: ; cee9 @@ -1066,11 +1082,18 @@ wChangeMonPicEnemyTurnSpecies:: ; cee9 wHPBarMaxHP:: ; cee9 ds 1 +wNamingScreenSubmitName:: ; ceea +; non-zero when the player has chosen to submit the name + wChangeMonPicPlayerTurnSpecies:: ; ceea wEvoNewSpecies:: ; ceea ds 1 +wAlphabetCase:: ; ceeb +; 0 = upper case +; 1 = lower case + wEvoMonTileOffset:: ; ceeb wHPBarOldHP:: ; ceeb @@ -1079,13 +1102,17 @@ wHPBarOldHP:: ; ceeb wEvoCancelled:: ; ceec ds 1 +wNamingScreenLetter:: ; ceed + wHPBarNewHP:: ; ceed ds 2 wHPBarDelta:: ; ceef ds 1 -wcef0:: ds 1 ; used with HP bar stuff, probably used with wBuffer too. -wcef1:: ds 12 ; same case as above +wHPBarTempHP:: ; cef0 + ds 2 + + ds 11 wHPBarHPDifference:: ; cefd ds 1 @@ -1356,9 +1383,16 @@ wTrainerPicPointer:: ; d033 ds 2 ds 1 wd036:: ds 16 ; used as a temporary buffer to print "XXX learned YYY" -wd046:: ds 1 ; used with trainer pointer stuff (not exactly sure, but the label is incremented and loaded with a value, so wd047 is accessed) -wd047:: ds 1 ; used with unloading trainer data? -wd048:: ds 2 ; used as a pointer for missable object loop + +wTrainerBaseMoney:: ; d046 +; 2-byte BCD number +; money received after battle = base money × level of highest-level enemy mon + ds 2 + +wMissableObjectCounter:: ; d048 + ds 1 + + ds 1 W_TRAINERNAME:: ; d04a ; 13 bytes for the letters of the opposing trainer @@ -1367,6 +1401,7 @@ W_TRAINERNAME:: ; d04a ds 13 W_ISINBATTLE:: ; d057 +; lost battle, this is -1 ; no battle, this is 0 ; wild battle, this is 1 ; trainer battle, this is 2 @@ -1513,10 +1548,16 @@ wEscapedFromBattle:: ; non-zero when an item or move that allows escape from battle was used ds 1 -wAmountMoneyWon:: ; wd079 - wd07b -wd079:: ds 1 ; used as a value to print the money won from a battle, as well as a misc. value in seafoam -wd07a:: ds 1 ; same case as above -wd07b:: ds 1 ; used as a buffer to convert the money won from a battle into BCD +wAmountMoneyWon:: ; d079 +; 3-byte BCD number + +wObjectToHide:: ; d079 + ds 1 + +wObjectToShow:: ; d07a + ds 1 + + ds 1 W_ANIMATIONID:: ; d07c ; ID number of the current battle animation @@ -1551,7 +1592,8 @@ W_FBTILECOUNTER:: ; d084 ; counts how many tiles of the current frame block have been drawn ds 1 -wd085:: ds 1 ; used with animating water/flowers +wMovingBGTilesCounter2:: ; d085 + ds 1 W_SUBANIMFRAMEDELAY:: ; d086 ; duration of each frame of the current subanimation in terms of screen refreshes @@ -1816,7 +1858,8 @@ wMoveNum:: ; d0e0 wMovesString:: ; d0e1 ds 56 -wd119:: ds 1 ; written to from W_CURMAPTILESET but never read +wUnusedD119:: ; d119 + ds 1 wWalkBikeSurfStateCopy:: ; d11a ; wWalkBikeSurfState is sometimes copied here, but it doesn't seem to be used for anything @@ -1826,18 +1869,39 @@ wInitListType:: ; d11b ; the type of list for InitList to init ds 1 -wd11c:: ds 1 ; temp storage value for catching pokemon -wd11d:: ds 1 ; used with battle switchout and testing if the enemy mon fainted +wCapturedMonSpecies:: ; d11c +; 0 if no mon was captured + ds 1 + +wFirstMonsNotOutYet:: ; d11d +; Non-zero when the first player mon and enemy mon haven't been sent out yet. +; It prevents the game from asking if the player wants to choose another mon +; when the enemy sends out their first mon and suppresses the "no will to fight" +; message when the game searches for the first non-fainted mon in the party, +; which will be the first mon sent out. + ds 1 + wd11e:: ds 1 ; used as a Pokemon and Item storage value. Also used as an output value for CountSetBits -wd11f:: ds 1 ; used when running from battle and PartyMenuInit + +wForcePlayerToChooseMon:: ; d11f +; When this value is non-zero, the player isn't allowed to exit the party menu +; by pressing B and not choosing a mon. + ds 1 wNumRunAttempts:: ; number of times the player has tried to run from battle ds 1 -wd121:: ds 1 ; used with evolving pokemon -wd122:: ds 2 ; saved ROM bank number for vblank -wIsKeyItem:: ds 1 ; d124 +wEvolutionOccurred:: ; d121 + ds 1 + +wVBlankSavedROMBank:: ; d122 + ds 1 + + ds 1 + +wIsKeyItem:: ; d124 + ds 1 wTextBoxID:: ; d125 ds 1 @@ -2664,9 +2728,13 @@ wCardKeyDoorX:: ; d740 ds 2 -wd743:: ds 1 ; used with surge gym trash cans -wd744:: ds 3 ; also used with surge gym trash cans +wFirstLockTrashCanIndex:: ; d743 + ds 1 + +wSecondLockTrashCanIndex:: ; d743 + ds 1 + ds 2 wEventFlags:: ; d747 ds 320 |