diff options
Diffstat (limited to 'engine')
226 files changed, 5864 insertions, 5863 deletions
diff --git a/engine/battle/ai/items.asm b/engine/battle/ai/items.asm index d0867fb33..4d1eea2e8 100644 --- a/engine/battle/ai/items.asm +++ b/engine/battle/ai/items.asm @@ -12,7 +12,7 @@ AI_SwitchOrTryItem: ; 38000 farcall CheckEnemyLockedIn ret nz - ld a, [PlayerSubStatus5] + ld a, [wPlayerSubStatus5] bit SUBSTATUS_CANT_RUN, a jr nz, DontSwitch @@ -21,11 +21,11 @@ AI_SwitchOrTryItem: ; 38000 jr nz, DontSwitch ld hl, TrainerClassAttributes + TRNATTR_AI_ITEM_SWITCH - ld a, [InBattleTowerBattle] ; Load always the first TrainerClass for BattleTower-Trainers + ld a, [wInBattleTowerBattle] ; always load the first trainer class in wTrainerClass for BattleTower-Trainers and a jr nz, .ok - ld a, [TrainerClass] + ld a, [wTrainerClass] dec a ld bc, NUM_TRAINER_ATTRIBUTES call AddNTimes @@ -151,7 +151,7 @@ SwitchSometimes: ; 380c1 CheckSubstatusCantRun: ; 380ff - ld a, [EnemySubStatus5] + ld a, [wEnemySubStatus5] bit SUBSTATUS_CANT_RUN, a ret ; 38105 @@ -159,7 +159,7 @@ CheckSubstatusCantRun: ; 380ff AI_TryItem: ; 38105 ; items are not allowed in the BattleTower - ld a, [InBattleTowerBattle] + ld a, [wInBattleTowerBattle] and a ret nz @@ -172,7 +172,7 @@ AI_TryItem: ; 38105 call .IsHighestLevel ret nc - ld a, [TrainerClass] + ld a, [wTrainerClass] dec a ld hl, TrainerClassAttributes + TRNATTR_AI_ITEM_SWITCH ld bc, NUM_TRAINER_ATTRIBUTES @@ -226,29 +226,29 @@ AI_TryItem: ; 38105 inc a ld [wEnemyGoesFirst], a - ld hl, EnemySubStatus3 + ld hl, wEnemySubStatus3 res SUBSTATUS_BIDE, [hl] xor a - ld [EnemyFuryCutterCount], a - ld [EnemyProtectCount], a + ld [wEnemyFuryCutterCount], a + ld [wEnemyProtectCount], a ld [wEnemyRageCounter], a - ld hl, EnemySubStatus4 + ld hl, wEnemySubStatus4 res SUBSTATUS_RAGE, [hl] xor a - ld [LastEnemyCounterMove], a + ld [wLastEnemyCounterMove], a scf ret .IsHighestLevel: ; 38170 - ld a, [OTPartyCount] + ld a, [wOTPartyCount] ld d, a ld e, 0 - ld hl, OTPartyMon1Level + ld hl, wOTPartyMon1Level ld bc, PARTYMON_STRUCT_LENGTH .next ld a, [hl] @@ -260,8 +260,8 @@ AI_TryItem: ; 38105 dec d jr nz, .next - ld a, [CurOTMon] - ld hl, OTPartyMon1Level + ld a, [wCurOTMon] + ld hl, wOTPartyMon1Level call AddNTimes ld a, [hl] cp e @@ -302,7 +302,7 @@ AI_Items: ; 39196 ; 381ca .Status: ; 381ca (e:41ca) - ld a, [EnemyMonStatus] + ld a, [wEnemyMonStatus] and a jp z, .DontUse @@ -318,17 +318,17 @@ AI_Items: ; 39196 jp .DontUse .StatusCheckContext: - ld a, [EnemySubStatus5] + ld a, [wEnemySubStatus5] bit SUBSTATUS_TOXIC, a jr z, .FailToxicCheck - ld a, [EnemyToxicCount] + ld a, [wEnemyToxicCount] cp 4 jr c, .FailToxicCheck call Random cp 1 + 50 percent jp c, .Use .FailToxicCheck: - ld a, [EnemyMonStatus] + ld a, [wEnemyMonStatus] and 1 << FRZ | SLP jp z, .DontUse jp .Use @@ -419,8 +419,8 @@ AI_Items: ; 39196 callfar AICheckEnemyMaxHP jr c, .dont_use push bc - ld de, EnemyMonMaxHP + 1 - ld hl, EnemyMonHP + 1 + ld de, wEnemyMonMaxHP + 1 + ld hl, wEnemyMonHP + 1 ld a, [de] sub [hl] jr z, .check_40_percent @@ -509,7 +509,7 @@ AI_Items: ; 39196 ; 3834d .XItem: ; 3834d (e:434d) - ld a, [EnemyTurnsTaken] + ld a, [wEnemyTurnsTaken] and a jr nz, .notfirstturnout ld a, [bc] @@ -571,37 +571,37 @@ EnemyUsedFullHeal: ; 383a3 (e:43a3) EnemyUsedMaxPotion: ; 383ae (e:43ae) ld a, MAX_POTION - ld [CurEnemyItem], a + ld [wCurEnemyItem], a jr FullRestoreContinue EnemyUsedFullRestore: ; 383b5 (e:43b5) call AI_HealStatus ld a, FULL_RESTORE - ld [CurEnemyItem], a - ld hl, EnemySubStatus3 + ld [wCurEnemyItem], a + ld hl, wEnemySubStatus3 res SUBSTATUS_CONFUSED, [hl] xor a - ld [EnemyConfuseCount], a + ld [wEnemyConfuseCount], a FullRestoreContinue: ; 383c6 ld de, wCurHPAnimOldHP - ld hl, EnemyMonHP + 1 + ld hl, wEnemyMonHP + 1 ld a, [hld] ld [de], a inc de ld a, [hl] ld [de], a inc de - ld hl, EnemyMonMaxHP + 1 + ld hl, wEnemyMonMaxHP + 1 ld a, [hld] ld [de], a inc de ld [wCurHPAnimMaxHP], a - ld [EnemyMonHP + 1], a + ld [wEnemyMonHP + 1], a ld a, [hl] ld [de], a ld [wCurHPAnimMaxHP + 1], a - ld [EnemyMonHP], a + ld [wEnemyMonHP], a jr EnemyPotionFinish ; 383e8 (e:43e8) @@ -620,8 +620,8 @@ EnemyUsedHyperPotion: ; 383f4 (e:43f4) ld b, 200 EnemyPotionContinue: ; 383f8 - ld [CurEnemyItem], a - ld hl, EnemyMonHP + 1 + ld [wCurEnemyItem], a + ld hl, wEnemyMonHP + 1 ld a, [hl] ld [wCurHPAnimOldHP], a add b @@ -638,7 +638,7 @@ EnemyPotionContinue: ; 383f8 inc hl ld a, [hld] ld b, a - ld de, EnemyMonMaxHP + 1 + ld de, wEnemyMonMaxHP + 1 ld a, [de] dec de ld [wCurHPAnimMaxHP], a @@ -671,9 +671,9 @@ EnemyPotionFinish: ; 38436 AI_TrySwitch: ; 3844b ; Determine whether the AI can switch based on how many Pokemon are still alive. ; If it can switch, it will. - ld a, [OTPartyCount] + ld a, [wOTPartyCount] ld c, a - ld hl, OTPartyMon1HP + ld hl, wOTPartyMon1HP ld d, 0 .SwitchLoop: ld a, [hli] @@ -701,20 +701,20 @@ AI_Switch: ; 3846c ld a, $1 ld [wEnemyIsSwitching], a ld [wEnemyGoesFirst], a - ld hl, EnemySubStatus4 + ld hl, wEnemySubStatus4 res SUBSTATUS_RAGE, [hl] xor a ld [hBattleTurn], a callfar PursuitSwitch push af - ld a, [CurOTMon] - ld hl, OTPartyMon1Status + ld a, [wCurOTMon] + ld hl, wOTPartyMon1Status ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes ld d, h ld e, l - ld hl, EnemyMonStatus + ld hl, wEnemyMonStatus ld bc, MON_MAXHP - MON_STATUS call CopyBytes pop af @@ -728,7 +728,7 @@ AI_Switch: ; 3846c ld [wBattleHasJustStarted], a callfar NewEnemyMonStatus callfar ResetEnemyStatLevels - ld hl, PlayerSubStatus1 + ld hl, wPlayerSubStatus1 res SUBSTATUS_IN_LOVE, [hl] farcall EnemySwitch farcall ResetBattleParticipants @@ -754,25 +754,25 @@ Function384d5: ; This appears to be unused ; 384e0 AI_HealStatus: ; 384e0 - ld a, [CurOTMon] - ld hl, OTPartyMon1Status + ld a, [wCurOTMon] + ld hl, wOTPartyMon1Status ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes xor a ld [hl], a - ld [EnemyMonStatus], a + ld [wEnemyMonStatus], a ; Bug: this should reset SUBSTATUS_NIGHTMARE too ; Uncomment the lines below to fix - ; ld hl, EnemySubStatus1 + ; ld hl, wEnemySubStatus1 ; res SUBSTATUS_NIGHTMARE, [hl] - ld hl, EnemySubStatus5 + ld hl, wEnemySubStatus5 res SUBSTATUS_TOXIC, [hl] ret ; 384f7 EnemyUsedXAccuracy: ; 384f7 call AIUsedItemSound - ld hl, EnemySubStatus4 + ld hl, wEnemySubStatus4 set SUBSTATUS_X_ACCURACY, [hl] ld a, X_ACCURACY jp PrintText_UsedItemOn_AND_AIUpdateHUD @@ -780,7 +780,7 @@ EnemyUsedXAccuracy: ; 384f7 EnemyUsedGuardSpec: ; 38504 call AIUsedItemSound - ld hl, EnemySubStatus4 + ld hl, wEnemySubStatus4 set SUBSTATUS_MIST, [hl] ld a, GUARD_SPEC jp PrintText_UsedItemOn_AND_AIUpdateHUD @@ -788,7 +788,7 @@ EnemyUsedGuardSpec: ; 38504 EnemyUsedDireHit: ; 38511 call AIUsedItemSound - ld hl, EnemySubStatus4 + ld hl, wEnemySubStatus4 set SUBSTATUS_FOCUS_ENERGY, [hl] ld a, DIRE_HIT jp PrintText_UsedItemOn_AND_AIUpdateHUD @@ -796,7 +796,7 @@ EnemyUsedDireHit: ; 38511 Function3851e: ; This appears to be unused ld [hDivisor], a - ld hl, EnemyMonMaxHP + ld hl, wEnemyMonMaxHP ld a, [hli] ld [hDividend], a ld a, [hl] @@ -807,7 +807,7 @@ Function3851e: ; This appears to be unused ld c, a ld a, [hQuotient + 1] ld b, a - ld hl, EnemyMonHP + 1 + ld hl, wEnemyMonHP + 1 ld a, [hld] ld e, a ld a, [hl] @@ -847,7 +847,7 @@ EnemyUsedXSpecial: ; 38553 ; a = ITEM_CONSTANT ; b = BATTLE_CONSTANT (ATTACK, DEFENSE, SPEED, SP_ATTACK, SP_DEFENSE, ACCURACY, EVASION) EnemyUsedXItem: - ld [CurEnemyItem], a + ld [wCurEnemyItem], a push bc call PrintText_UsedItemOn pop bc @@ -859,16 +859,16 @@ EnemyUsedXItem: ; Parameter ; a = ITEM_CONSTANT PrintText_UsedItemOn_AND_AIUpdateHUD: ; 38568 - ld [CurEnemyItem], a + ld [wCurEnemyItem], a call PrintText_UsedItemOn jp AIUpdateHUD ; 38571 PrintText_UsedItemOn: ; 38571 - ld a, [CurEnemyItem] + ld a, [wCurEnemyItem] ld [wd265], a call GetItemName - ld hl, StringBuffer1 + ld hl, wStringBuffer1 ld de, wMonOrItemNameBuffer ld bc, ITEM_NAME_LENGTH call CopyBytes diff --git a/engine/battle/ai/move.asm b/engine/battle/ai/move.asm index 7ccb20972..b5ac966f8 100755 --- a/engine/battle/ai/move.asm +++ b/engine/battle/ai/move.asm @@ -1,5 +1,5 @@ AIChooseMove: ; 440ce -; Score each move in EnemyMonMoves starting from Buffer1. Lower is better. +; Score each move in wEnemyMonMoves starting from wBuffer1. Lower is better. ; Pick the move with the lowest score. ; Wildmons attack at random. @@ -18,18 +18,18 @@ AIChooseMove: ; 440ce ; The default score is 20. Unusable moves are given a score of 80. ld a, 20 - ld hl, Buffer1 + ld hl, wBuffer1 ld [hli], a ld [hli], a ld [hli], a ld [hl], a ; Don't pick disabled moves. - ld a, [EnemyDisabledMove] + ld a, [wEnemyDisabledMove] and a jr z, .CheckPP - ld hl, EnemyMonMoves + ld hl, wEnemyMonMoves ld c, 0 .CheckDisabledMove: cp [hl] @@ -38,20 +38,20 @@ AIChooseMove: ; 440ce inc hl jr .CheckDisabledMove .ScoreDisabledMove: - ld hl, Buffer1 + ld hl, wBuffer1 ld b, 0 add hl, bc ld [hl], 80 ; Don't pick moves with 0 PP. .CheckPP: - ld hl, Buffer1 - 1 - ld de, EnemyMonPP + ld hl, wBuffer1 - 1 + ld de, wEnemyMonPP ld b, 0 .CheckMovePP: inc b ld a, b - cp EnemyMonMovesEnd - EnemyMonMoves + 1 + cp wEnemyMonMovesEnd - wEnemyMonMoves + 1 jr z, .ApplyLayers inc hl ld a, [de] @@ -66,13 +66,13 @@ AIChooseMove: ; 440ce .ApplyLayers: ld hl, TrainerClassAttributes + TRNATTR_AI_MOVE_WEIGHTS - ; If we have a battle in BattleTower just load the Attributes of the first TrainerClass (Falkner) + ; If we have a battle in BattleTower just load the Attributes of the first trainer class in wTrainerClass (Falkner) ; so we have always the same AI, regardless of the loaded class of trainer - ld a, [InBattleTowerBattle] + ld a, [wInBattleTowerBattle] bit 0, a jr nz, .battle_tower_skip - ld a, [TrainerClass] + ld a, [wTrainerClass] dec a ld bc, 7 ; Trainer2AI - Trainer1AI call AddNTimes @@ -119,9 +119,9 @@ AIChooseMove: ; 440ce ; Decrement the scores of all moves one by one until one reaches 0. .DecrementScores: - ld hl, Buffer1 - ld de, EnemyMonMoves - ld c, EnemyMonMovesEnd - EnemyMonMoves + ld hl, wBuffer1 + ld de, wEnemyMonMoves + ld c, wEnemyMonMovesEnd - wEnemyMonMoves .DecrementNextScore: ; If the enemy has no moves, this will infinite. @@ -154,8 +154,8 @@ AIChooseMove: ; 440ce cp NUM_MOVES + 1 jr nz, .move_loop - ld hl, Buffer1 - ld de, EnemyMonMoves + ld hl, wBuffer1 + ld de, wEnemyMonMoves ld c, NUM_MOVES ; Give a score of 0 to a blank move @@ -184,7 +184,7 @@ AIChooseMove: ; 440ce ; Randomly choose one of the moves with a score of 1 .ChooseMove: - ld hl, Buffer1 + ld hl, wBuffer1 call Random maskbits NUM_MOVES ld c, a @@ -194,9 +194,9 @@ AIChooseMove: ; 440ce and a jr z, .ChooseMove - ld [CurEnemyMove], a + ld [wCurEnemyMove], a ld a, c - ld [CurEnemyMoveNum], a + ld [wCurEnemyMoveNum], a ret ; 441af diff --git a/engine/battle/ai/redundant.asm b/engine/battle/ai/redundant.asm index 2e8f7c6df..d09b4da73 100755 --- a/engine/battle/ai/redundant.asm +++ b/engine/battle/ai/redundant.asm @@ -47,95 +47,95 @@ AI_Redundant: ; 2c41a db -1 .LightScreen: ; 2c487 - ld a, [EnemyScreens] + ld a, [wEnemyScreens] bit SCREENS_LIGHT_SCREEN, a ret .Mist: ; 2c48d - ld a, [EnemySubStatus4] + ld a, [wEnemySubStatus4] bit SUBSTATUS_MIST, a ret .FocusEnergy: ; 2c493 - ld a, [EnemySubStatus4] + ld a, [wEnemySubStatus4] bit SUBSTATUS_FOCUS_ENERGY, a ret .Confuse: ; 2c499 - ld a, [PlayerSubStatus3] + ld a, [wPlayerSubStatus3] bit SUBSTATUS_CONFUSED, a ret nz - ld a, [PlayerScreens] + ld a, [wPlayerScreens] bit SCREENS_SAFEGUARD, a ret .Transform: ; 2c4a5 - ld a, [EnemySubStatus5] + ld a, [wEnemySubStatus5] bit SUBSTATUS_TRANSFORMED, a ret .Reflect: ; 2c4ab - ld a, [EnemyScreens] + ld a, [wEnemyScreens] bit SCREENS_REFLECT, a ret .Substitute: ; 2c4b1 - ld a, [EnemySubStatus4] + ld a, [wEnemySubStatus4] bit SUBSTATUS_SUBSTITUTE, a ret .LeechSeed: ; 2c4b7 - ld a, [PlayerSubStatus4] + ld a, [wPlayerSubStatus4] bit SUBSTATUS_LEECH_SEED, a ret .Disable: ; 2c4bd - ld a, [PlayerDisableCount] + ld a, [wPlayerDisableCount] and a ret .Encore: ; 2c4c2 - ld a, [PlayerSubStatus5] + ld a, [wPlayerSubStatus5] bit SUBSTATUS_ENCORED, a ret .Snore: .SleepTalk: ; 2c4c8 - ld a, [EnemyMonStatus] + ld a, [wEnemyMonStatus] and SLP jr z, .Redundant jr .NotRedundant .MeanLook: ; 2c4d1 - ld a, [EnemySubStatus5] + ld a, [wEnemySubStatus5] bit SUBSTATUS_CANT_RUN, a ret .Nightmare: ; 2c4d7 - ld a, [BattleMonStatus] + ld a, [wBattleMonStatus] and a jr z, .Redundant - ld a, [PlayerSubStatus1] + ld a, [wPlayerSubStatus1] bit SUBSTATUS_NIGHTMARE, a ret .Spikes: ; 2c4e3 - ld a, [PlayerScreens] + ld a, [wPlayerScreens] bit SCREENS_SPIKES, a ret .Foresight: ; 2c4e9 - ld a, [PlayerSubStatus1] + ld a, [wPlayerSubStatus1] bit SUBSTATUS_IDENTIFIED, a ret .PerishSong: ; 2c4ef - ld a, [PlayerSubStatus1] + ld a, [wPlayerSubStatus1] bit SUBSTATUS_PERISH, a ret .Sandstorm: ; 2c4f5 - ld a, [Weather] + ld a, [wBattleWeather] cp WEATHER_SANDSTORM jr z, .Redundant jr .NotRedundant @@ -143,40 +143,40 @@ AI_Redundant: ; 2c41a .Attract: ; 2c4fe farcall CheckOppositeGender jr c, .Redundant - ld a, [PlayerSubStatus1] + ld a, [wPlayerSubStatus1] bit SUBSTATUS_IN_LOVE, a ret .Safeguard: ; 2c50c - ld a, [EnemyScreens] + ld a, [wEnemyScreens] bit SCREENS_SAFEGUARD, a ret .RainDance: ; 2c512 - ld a, [Weather] + ld a, [wBattleWeather] cp WEATHER_RAIN jr z, .Redundant jr .NotRedundant .SunnyDay: ; 2c51b - ld a, [Weather] + ld a, [wBattleWeather] cp WEATHER_SUN jr z, .Redundant jr .NotRedundant .DreamEater: ; 2c524 - ld a, [BattleMonStatus] + ld a, [wBattleMonStatus] and SLP jr z, .Redundant jr .NotRedundant .Swagger: ; 2c52d - ld a, [PlayerSubStatus3] + ld a, [wPlayerSubStatus3] bit SUBSTATUS_CONFUSED, a ret .FutureSight: ; 2c533 - ld a, [EnemyScreens] + ld a, [wEnemyScreens] bit 5, a ret diff --git a/engine/battle/ai/scoring.asm b/engine/battle/ai/scoring.asm index 73284435a..b250128a4 100644 --- a/engine/battle/ai/scoring.asm +++ b/engine/battle/ai/scoring.asm @@ -5,9 +5,9 @@ AI_Basic: ; 38591 ; -Using status-only moves if the player can't be statused ; -Using moves that fail if they've already been used - ld hl, Buffer1 - 1 - ld de, EnemyMonMoves - ld b, EnemyMonMovesEnd - EnemyMonMoves + 1 + ld hl, wBuffer1 - 1 + ld de, wEnemyMonMoves + ld b, wEnemyMonMovesEnd - wEnemyMonMoves + 1 .checkmove dec b ret z @@ -49,12 +49,12 @@ AI_Basic: ; 38591 pop hl jr nc, .checkmove - ld a, [BattleMonStatus] + ld a, [wBattleMonStatus] and a jr nz, .discourage ; Dismiss Safeguard if it's already active. - ld a, [PlayerScreens] + ld a, [wPlayerScreens] bit SCREENS_SAFEGUARD, a jr z, .checkmove @@ -80,9 +80,9 @@ AI_Setup: ; 385e0 ; 50% chance to greatly encourage stat-down moves during the first turn of player's Pokemon. ; Almost 90% chance to greatly discourage stat-modifying moves otherwise. - ld hl, Buffer1 - 1 - ld de, EnemyMonMoves - ld b, EnemyMonMovesEnd - EnemyMonMoves + 1 + ld hl, wBuffer1 - 1 + ld de, wEnemyMonMoves + ld b, wEnemyMonMovesEnd - wEnemyMonMoves + 1 .checkmove dec b ret z @@ -120,14 +120,14 @@ AI_Setup: ; 385e0 jr .checkmove .statup - ld a, [EnemyTurnsTaken] + ld a, [wEnemyTurnsTaken] and a jr nz, .discourage jr .encourage .statdown - ld a, [PlayerTurnsTaken] + ld a, [wPlayerTurnsTaken] and a jr nz, .discourage @@ -156,9 +156,9 @@ AI_Types: ; 38635 ; Discourage not very effective moves unless ; all damaging moves are of the same type. - ld hl, Buffer1 - 1 - ld de, EnemyMonMoves - ld b, EnemyMonMovesEnd - EnemyMonMoves + 1 + ld hl, wBuffer1 - 1 + ld de, wEnemyMonMoves + ld b, wEnemyMonMovesEnd - wEnemyMonMoves + 1 .checkmove dec b ret z @@ -203,8 +203,8 @@ AI_Types: ; 38635 push bc ld a, [wEnemyMoveStruct + MOVE_TYPE] ld d, a - ld hl, EnemyMonMoves - ld b, EnemyMonMovesEnd - EnemyMonMoves + 1 + ld hl, wEnemyMonMoves + ld b, wEnemyMonMovesEnd - wEnemyMonMoves + 1 ld c, 0 .checkmove2 dec b @@ -245,9 +245,9 @@ AI_Types: ; 38635 AI_Offensive: ; 386a2 ; Greatly discourage non-damaging moves. - ld hl, Buffer1 - 1 - ld de, EnemyMonMoves - ld b, EnemyMonMovesEnd - EnemyMonMoves + 1 + ld hl, wBuffer1 - 1 + ld de, wEnemyMonMoves + ld b, wEnemyMonMovesEnd - wEnemyMonMoves + 1 .checkmove dec b ret z @@ -274,9 +274,9 @@ AI_Offensive: ; 386a2 AI_Smart: ; 386be ; Context-specific scoring. - ld hl, Buffer1 - ld de, EnemyMonMoves - ld b, EnemyMonMovesEnd - EnemyMonMoves + 1 + ld hl, wBuffer1 + ld de, wEnemyMonMoves + ld b, wEnemyMonMovesEnd - wEnemyMonMoves + 1 .checkmove dec b ret z @@ -462,7 +462,7 @@ AI_Smart_LeechHit: ; 387f7 AI_Smart_LockOn: ; 3881d - ld a, [PlayerSubStatus5] + ld a, [wPlayerSubStatus5] bit SUBSTATUS_LOCK_ON, a jr nz, .asm_38882 @@ -477,20 +477,20 @@ AI_Smart_LockOn: ; 3881d jr nc, .asm_38877 .asm_38834 - ld a, [PlayerEvaLevel] + ld a, [wPlayerEvaLevel] cp $a jr nc, .asm_3887a cp $8 jr nc, .asm_38875 - ld a, [EnemyAccLevel] + ld a, [wEnemyAccLevel] cp $5 jr c, .asm_3887a cp $7 jr c, .asm_38875 - ld hl, EnemyMonMoves - ld c, EnemyMonMovesEnd - EnemyMonMoves + 1 + ld hl, wEnemyMonMoves + ld c, wEnemyMonMovesEnd - wEnemyMonMoves + 1 .asm_3884f dec c jr z, .asm_38877 @@ -537,9 +537,9 @@ AI_Smart_LockOn: ; 3881d .asm_38882 push hl - ld hl, Buffer1 - 1 - ld de, EnemyMonMoves - ld c, EnemyMonMovesEnd - EnemyMonMoves + 1 + ld hl, wBuffer1 - 1 + ld de, wEnemyMonMoves + ld c, wEnemyMonMovesEnd - wEnemyMonMoves + 1 .asm_3888b inc hl @@ -622,7 +622,7 @@ AI_Smart_DreamEater: ; 388ca AI_Smart_EvasionUp: ; 388d4 ; Dismiss this move if enemy's evasion can't raise anymore. - ld a, [EnemyEvaLevel] + ld a, [wEnemyEvaLevel] cp $d jp nc, AIDiscourageMove @@ -631,7 +631,7 @@ AI_Smart_EvasionUp: ; 388d4 jr nc, .asm_388f2 ; ...greatly encourage this move if player is badly poisoned. - ld a, [PlayerSubStatus5] + ld a, [wPlayerSubStatus5] bit SUBSTATUS_TOXIC, a jr nz, .asm_388ef @@ -680,27 +680,27 @@ AI_Smart_EvasionUp: ; 388d4 ; 100% chance to end up here if enemy's HP is below 25%. ; In other words, we only end up here if the move has not been encouraged or dismissed. .asm_38911 - ld a, [PlayerSubStatus5] + ld a, [wPlayerSubStatus5] bit SUBSTATUS_TOXIC, a jr nz, .asm_38938 - ld a, [PlayerSubStatus4] + ld a, [wPlayerSubStatus4] bit SUBSTATUS_LEECH_SEED, a jr nz, .asm_38941 ; Discourage this move if enemy's evasion level is higher than player's accuracy level. - ld a, [EnemyEvaLevel] + ld a, [wEnemyEvaLevel] ld b, a - ld a, [PlayerAccLevel] + ld a, [wPlayerAccLevel] cp b jr c, .asm_38936 ; Greatly encourage this move if the player is in the middle of Fury Cutter or Rollout. - ld a, [PlayerFuryCutterCount] + ld a, [wPlayerFuryCutterCount] and a jr nz, .asm_388ef - ld a, [PlayerSubStatus1] + ld a, [wPlayerSubStatus1] bit SUBSTATUS_ROLLOUT, a jr nz, .asm_388ef @@ -736,12 +736,12 @@ AI_Smart_AlwaysHit: ; 38947 ; 80% chance to greatly encourage this move if either... ; ...enemy's accuracy level has been lowered three or more stages - ld a, [EnemyAccLevel] + ld a, [wEnemyAccLevel] cp $5 jr c, .asm_38954 ; ...or player's evasion level has been raised three or more stages. - ld a, [PlayerEvaLevel] + ld a, [wPlayerEvaLevel] cp $a ret c @@ -758,7 +758,7 @@ AI_Smart_AlwaysHit: ; 38947 AI_Smart_MirrorMove: ; 3895b ; If the player did not use any move last turn... - ld a, [LastPlayerCounterMove] + ld a, [wLastPlayerCounterMove] and a jr nz, .asm_38968 @@ -810,7 +810,7 @@ AI_Smart_AccuracyDown: ; 38985 jr nc, .asm_389a0 ; ...greatly encourage this move if player is badly poisoned. - ld a, [PlayerSubStatus5] + ld a, [wPlayerSubStatus5] bit SUBSTATUS_TOXIC, a jr nz, .asm_3899d @@ -855,27 +855,27 @@ AI_Smart_AccuracyDown: ; 38985 ; We only end up here if the move has not been already encouraged. .asm_389bf - ld a, [PlayerSubStatus5] + ld a, [wPlayerSubStatus5] bit SUBSTATUS_TOXIC, a jr nz, .asm_389e6 - ld a, [PlayerSubStatus4] + ld a, [wPlayerSubStatus4] bit SUBSTATUS_LEECH_SEED, a jr nz, .asm_389ef ; Discourage this move if enemy's evasion level is higher than player's accuracy level. - ld a, [EnemyEvaLevel] + ld a, [wEnemyEvaLevel] ld b, a - ld a, [PlayerAccLevel] + ld a, [wPlayerAccLevel] cp b jr c, .asm_389e4 ; Greatly encourage this move if the player is in the middle of Fury Cutter or Rollout. - ld a, [PlayerFuryCutterCount] + ld a, [wPlayerFuryCutterCount] and a jr nz, .asm_3899d - ld a, [PlayerSubStatus1] + ld a, [wPlayerSubStatus1] bit SUBSTATUS_ROLLOUT, a jr nz, .asm_3899d @@ -910,7 +910,7 @@ AI_Smart_ResetStats: ; 389f5 ; 85% chance to encourage this move if any of enemy's stat levels is lower than -2. push hl - ld hl, EnemyAtkLevel + ld hl, wEnemyAtkLevel ld c, $8 .asm_389fb dec c @@ -922,7 +922,7 @@ AI_Smart_ResetStats: ; 389f5 ; 85% chance to encourage this move if any of player's stat levels is higher than +2. .asm_38a05 - ld hl, PlayerAtkLevel + ld hl, wPlayerAtkLevel ld c, $8 .asm_38a0a dec c @@ -1034,9 +1034,9 @@ AI_Smart_Ohko: ; 38a60 ; Dismiss this move if player's level is higher than enemy's level. ; Else, discourage this move is player's HP is below 50%. - ld a, [BattleMonLevel] + ld a, [wBattleMonLevel] ld b, a - ld a, [EnemyMonLevel] + ld a, [wEnemyMonLevel] cp b jp c, AIDiscourageMove call AICheckPlayerHalfHP @@ -1056,16 +1056,16 @@ AI_Smart_TrapTarget: ; 38a71 ; 50% chance to greatly encourage this move if player is either ; badly poisoned, in love, identified, stuck in Rollout, or has a Nightmare. - ld a, [PlayerSubStatus5] + ld a, [wPlayerSubStatus5] bit SUBSTATUS_TOXIC, a jr nz, .asm_38a91 - ld a, [PlayerSubStatus1] + ld a, [wPlayerSubStatus1] and 1<<SUBSTATUS_IN_LOVE | 1<<SUBSTATUS_ROLLOUT | 1<<SUBSTATUS_IDENTIFIED | 1<<SUBSTATUS_NIGHTMARE jr nz, .asm_38a91 ; Else, 50% chance to greatly encourage this move if it's the player's Pokemon first turn. - ld a, [PlayerTurnsTaken] + ld a, [wPlayerTurnsTaken] and a jr z, .asm_38a91 @@ -1089,17 +1089,17 @@ AI_Smart_TrapTarget: ; 38a71 AI_Smart_RazorWind: AI_Smart_Unused2B: ; 38a9c - ld a, [EnemySubStatus1] + ld a, [wEnemySubStatus1] bit SUBSTATUS_PERISH, a jr z, .asm_38aaa - ld a, [EnemyPerishCount] + ld a, [wEnemyPerishCount] cp 3 jr c, .asm_38ad3 .asm_38aaa push hl - ld hl, PlayerUsedMoves + ld hl, wPlayerUsedMoves ld c, 4 .asm_38ab0 @@ -1117,7 +1117,7 @@ AI_Smart_Unused2B: ; 38a9c .asm_38ac1 pop hl - ld a, [EnemySubStatus3] + ld a, [wEnemySubStatus3] bit SUBSTATUS_CONFUSED, a jr nz, .asm_38acd @@ -1168,7 +1168,7 @@ AI_Smart_SpDefenseUp2: ; 38aed jr nc, .asm_38b10 ; Discourage this move if enemy's special defense level is higher than +3. - ld a, [EnemySDefLevel] + ld a, [wEnemySDefLevel] cp $b jr nc, .asm_38b10 @@ -1177,10 +1177,10 @@ AI_Smart_SpDefenseUp2: ; 38aed cp $9 ret nc - ld a, [BattleMonType1] + ld a, [wBattleMonType1] cp SPECIAL jr nc, .asm_38b09 - ld a, [BattleMonType2] + ld a, [wBattleMonType2] cp SPECIAL ret c @@ -1203,7 +1203,7 @@ AI_Smart_Fly: ; 38b12 ; Greatly encourage this move if the player is ; flying or underground, and slower than the enemy. - ld a, [PlayerSubStatus3] + ld a, [wPlayerSubStatus3] and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND ret z @@ -1266,7 +1266,7 @@ AI_Smart_SpeedDownHit: ; 38b40 ret nz call AICheckEnemyQuarterHP ret nc - ld a, [PlayerTurnsTaken] + ld a, [wPlayerTurnsTaken] and a ret nz call AICompareSpeed @@ -1315,7 +1315,7 @@ AI_Smart_HyperBeam: ; 38b63 AI_Smart_Rage: ; 38b7f - ld a, [EnemySubStatus4] + ld a, [wEnemySubStatus4] bit SUBSTATUS_RAGE, a jr z, .asm_38b9b @@ -1355,7 +1355,7 @@ AI_Smart_Rage: ; 38b7f AI_Smart_Mimic: ; 38ba8 - ld a, [LastPlayerCounterMove] + ld a, [wLastPlayerCounterMove] and a jr z, .asm_38be9 @@ -1363,7 +1363,7 @@ AI_Smart_Mimic: ; 38ba8 jr nc, .asm_38bef push hl - ld a, [LastPlayerCounterMove] + ld a, [wLastPlayerCounterMove] call AIGetEnemyMove ld a, $1 @@ -1382,7 +1382,7 @@ AI_Smart_Mimic: ; 38ba8 dec [hl] .asm_38bd4 - ld a, [LastPlayerCounterMove] + ld a, [wLastPlayerCounterMove] push hl ld hl, UsefulMoves ld de, 1 @@ -1407,7 +1407,7 @@ AI_Smart_Mimic: ; 38ba8 AI_Smart_Counter: ; 38bf1 push hl - ld hl, PlayerUsedMoves + ld hl, wPlayerUsedMoves ld c, 4 ld b, 0 @@ -1440,7 +1440,7 @@ AI_Smart_Counter: ; 38bf1 cp $3 jr nc, .asm_38c30 - ld a, [LastPlayerCounterMove] + ld a, [wLastPlayerCounterMove] and a jr z, .asm_38c38 @@ -1475,7 +1475,7 @@ AI_Smart_Encore: ; 38c3b call AICompareSpeed jr nc, .asm_38c81 - ld a, [LastPlayerMove] + ld a, [wLastPlayerMove] and a jp z, AIDiscourageMove @@ -1487,7 +1487,7 @@ AI_Smart_Encore: ; 38c3b push hl ld a, [wEnemyMoveStruct + MOVE_TYPE] - ld hl, EnemyMonType1 + ld hl, wEnemyMonType1 predef CheckTypeMatchup pop hl @@ -1501,7 +1501,7 @@ AI_Smart_Encore: ; 38c3b .asm_38c68 push hl - ld a, [LastPlayerCounterMove] + ld a, [wLastPlayerCounterMove] ld hl, .EncoreMoves ld de, 1 call IsInArray @@ -1561,13 +1561,13 @@ AI_Smart_PainSplit: ; 38ca4 ; Discourage this move if [enemy's current HP * 2 > player's current HP]. push hl - ld hl, EnemyMonHP + ld hl, wEnemyMonHP ld b, [hl] inc hl ld c, [hl] sla c rl b - ld hl, BattleMonHP + 1 + ld hl, wBattleMonHP + 1 ld a, [hld] cp c ld a, [hl] @@ -1584,7 +1584,7 @@ AI_Smart_SleepTalk: ; 38cba ; Greatly encourage this move if enemy is fast asleep. ; Greatly discourage this move otherwise. - ld a, [EnemyMonStatus] + ld a, [wEnemyMonStatus] and $7 cp $1 jr z, .asm_38cc7 @@ -1606,7 +1606,7 @@ AI_Smart_DefrostOpponent: ; 38ccb ; Greatly encourage this move if enemy is frozen. ; No move has EFFECT_DEFROST_OPPONENT, so this layer is unused. - ld a, [EnemyMonStatus] + ld a, [wEnemyMonStatus] and $20 ret z dec [hl] @@ -1617,7 +1617,7 @@ AI_Smart_DefrostOpponent: ; 38ccb AI_Smart_Spite: ; 38cd5 - ld a, [LastPlayerCounterMove] + ld a, [wLastPlayerCounterMove] and a jr nz, .asm_38ce7 @@ -1633,8 +1633,8 @@ AI_Smart_Spite: ; 38cd5 push hl ld b, a ld c, 4 - ld hl, BattleMonMoves - ld de, BattleMonPP + ld hl, wBattleMonMoves + ld de, wBattleMonPP .asm_38cf1 ld a, [hli] @@ -1697,10 +1697,10 @@ AI_Smart_HealBell: ; 38d1f ; 50% chance to greatly encourage this move if the enemy is fast asleep or frozen. push hl - ld a, [OTPartyCount] + ld a, [wOTPartyCount] ld b, a ld c, 0 - ld hl, OTPartyMon1HP + ld hl, wOTPartyMon1HP ld de, PARTYMON_STRUCT_LENGTH .loop @@ -1728,7 +1728,7 @@ AI_Smart_HealBell: ; 38d1f and a jr z, .no_status - ld a, [EnemyMonStatus] + ld a, [wEnemyMonStatus] and a jr z, .ok dec [hl] @@ -1742,7 +1742,7 @@ AI_Smart_HealBell: ; 38d1f ret .no_status - ld a, [EnemyMonStatus] + ld a, [wEnemyMonStatus] and a ret nz jp AIDiscourageMove @@ -1755,7 +1755,7 @@ AI_Smart_PriorityHit: ; 38d5a ret c ; Dismiss this move if the player is flying or underground. - ld a, [PlayerSubStatus3] + ld a, [wPlayerSubStatus3] and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND jp nz, AIDiscourageMove @@ -1767,13 +1767,13 @@ AI_Smart_PriorityHit: ; 38d5a callfar BattleCommand_DamageCalc callfar BattleCommand_Stab pop hl - ld a, [CurDamage + 1] + ld a, [wCurDamage + 1] ld c, a - ld a, [CurDamage] + ld a, [wCurDamage] ld b, a - ld a, [BattleMonHP + 1] + ld a, [wBattleMonHP + 1] cp c - ld a, [BattleMonHP] + ld a, [wBattleMonHP] sbc b ret nc dec [hl] @@ -1794,7 +1794,7 @@ AI_Smart_Thief: ; 38d93 AI_Smart_Conversion2: ; 38d98 - ld a, [LastPlayerMove] + ld a, [wLastPlayerMove] and a jr nz, .asm_38dc9 @@ -1839,7 +1839,7 @@ AI_Smart_Disable: ; 38dd1 jr nc, .asm_38df3 push hl - ld a, [LastPlayerCounterMove] + ld a, [wLastPlayerCounterMove] ld hl, UsefulMoves ld de, 1 call IsInArray @@ -1877,14 +1877,14 @@ AI_Smart_MeanLook: ; 38dfb jp z, AIDiscourageMove ; 80% chance to greatly encourage this move if the enemy is badly poisoned (buggy). -; Should check PlayerSubStatus5 instead. - ld a, [EnemySubStatus5] +; Should check wPlayerSubStatus5 instead. + ld a, [wEnemySubStatus5] bit SUBSTATUS_TOXIC, a jr nz, .asm_38e26 ; 80% chance to greatly encourage this move if the player is either ; in love, identified, stuck in Rollout, or has a Nightmare. - ld a, [PlayerSubStatus1] + ld a, [wPlayerSubStatus1] and 1<<SUBSTATUS_IN_LOVE | 1<<SUBSTATUS_ROLLOUT | 1<<SUBSTATUS_IDENTIFIED | 1<<SUBSTATUS_NIGHTMARE jr nz, .asm_38e26 @@ -1911,14 +1911,14 @@ AI_Smart_MeanLook: ; 38dfb AICheckLastPlayerMon: ; 38e2e - ld a, [PartyCount] + ld a, [wPartyCount] ld b, a ld c, 0 - ld hl, PartyMon1HP + ld hl, wPartyMon1HP ld de, PARTYMON_STRUCT_LENGTH .loop - ld a, [CurBattleMon] + ld a, [wCurBattleMon] cp c jr z, .asm_38e44 @@ -1952,7 +1952,7 @@ AI_Smart_Nightmare: ; 38e4a AI_Smart_FlameWheel: ; 38e50 ; Use this move if the enemy is frozen. - ld a, [EnemyMonStatus] + ld a, [wEnemyMonStatus] bit FRZ, a ret z rept 5 @@ -1963,28 +1963,28 @@ endr AI_Smart_Curse: ; 38e5c - ld a, [EnemyMonType1] + ld a, [wEnemyMonType1] cp GHOST jr z, .ghostcurse - ld a, [EnemyMonType2] + ld a, [wEnemyMonType2] cp GHOST jr z, .ghostcurse call AICheckEnemyHalfHP jr nc, .asm_38e93 - ld a, [EnemyAtkLevel] + ld a, [wEnemyAtkLevel] cp $b jr nc, .asm_38e93 cp $9 ret nc - ld a, [BattleMonType1] + ld a, [wBattleMonType1] cp GHOST jr z, .asm_38e92 cp SPECIAL ret nc - ld a, [BattleMonType2] + ld a, [wBattleMonType2] cp SPECIAL ret nc call AI_80_20 @@ -2003,7 +2003,7 @@ AI_Smart_Curse: ; 38e5c ret .ghostcurse - ld a, [PlayerSubStatus1] + ld a, [wPlayerSubStatus1] bit SUBSTATUS_CURSE, a jp nz, AIDiscourageMove @@ -2037,7 +2037,7 @@ AI_Smart_Curse: ; 38e5c call AICheckEnemyMaxHP ret nc - ld a, [PlayerTurnsTaken] + ld a, [wPlayerTurnsTaken] and a ret nz @@ -2052,36 +2052,36 @@ AI_Smart_Curse: ; 38e5c AI_Smart_Protect: ; 38ed2 - ld a, [EnemyProtectCount] + ld a, [wEnemyProtectCount] and a jr nz, .asm_38f13 - ld a, [PlayerSubStatus5] + ld a, [wPlayerSubStatus5] bit SUBSTATUS_LOCK_ON, a jr nz, .asm_38f14 - ld a, [PlayerFuryCutterCount] + ld a, [wPlayerFuryCutterCount] cp 3 jr nc, .asm_38f0d - ld a, [PlayerSubStatus3] + ld a, [wPlayerSubStatus3] bit SUBSTATUS_CHARGED, a jr nz, .asm_38f0d - ld a, [PlayerSubStatus5] + ld a, [wPlayerSubStatus5] bit SUBSTATUS_TOXIC, a jr nz, .asm_38f0d - ld a, [PlayerSubStatus4] + ld a, [wPlayerSubStatus4] bit SUBSTATUS_LEECH_SEED, a jr nz, .asm_38f0d - ld a, [PlayerSubStatus1] + ld a, [wPlayerSubStatus1] bit SUBSTATUS_CURSE, a jr nz, .asm_38f0d bit SUBSTATUS_ROLLOUT, a jr z, .asm_38f14 - ld a, [PlayerRolloutCount] + ld a, [wPlayerRolloutCount] cp 3 jr c, .asm_38f14 @@ -2105,17 +2105,17 @@ AI_Smart_Protect: ; 38ed2 AI_Smart_Foresight: ; 38f1d - ld a, [EnemyAccLevel] + ld a, [wEnemyAccLevel] cp $5 jr c, .asm_38f41 - ld a, [PlayerEvaLevel] + ld a, [wPlayerEvaLevel] cp $a jr nc, .asm_38f41 - ld a, [BattleMonType1] + ld a, [wBattleMonType1] cp GHOST jr z, .asm_38f41 - ld a, [BattleMonType2] + ld a, [wBattleMonType2] cp GHOST jr z, .asm_38f41 @@ -2141,7 +2141,7 @@ AI_Smart_PerishSong: ; 38f4a pop hl jr c, .no - ld a, [PlayerSubStatus5] + ld a, [wPlayerSubStatus5] bit SUBSTATUS_CANT_RUN, a jr nz, .yes @@ -2176,7 +2176,7 @@ AI_Smart_PerishSong: ; 38f4a AI_Smart_Sandstorm: ; 38f7a ; Greatly discourage this move if the player is immune to Sandstorm damage. - ld a, [BattleMonType1] + ld a, [wBattleMonType1] push hl ld hl, .SandstormImmuneTypes ld de, 1 @@ -2184,7 +2184,7 @@ AI_Smart_Sandstorm: ; 38f7a pop hl jr c, .asm_38fa5 - ld a, [BattleMonType2] + ld a, [wBattleMonType2] push hl ld hl, .SandstormImmuneTypes ld de, 1 @@ -2219,7 +2219,7 @@ AI_Smart_Sandstorm: ; 38f7a AI_Smart_Endure: ; 38fac - ld a, [EnemyProtectCount] + ld a, [wEnemyProtectCount] and a jr nz, .asm_38fd8 @@ -2242,7 +2242,7 @@ AI_Smart_Endure: ; 38fac ret .asm_38fcb - ld a, [EnemySubStatus5] + ld a, [wEnemySubStatus5] bit SUBSTATUS_LOCK_ON, a ret z @@ -2265,7 +2265,7 @@ AI_Smart_Endure: ; 38fac AI_Smart_FuryCutter: ; 38fdb ; Encourage this move based on Fury Cutter's count. - ld a, [EnemyFuryCutterCount] + ld a, [wEnemyFuryCutterCount] and a jr z, .end dec [hl] @@ -2291,15 +2291,15 @@ AI_Smart_Rollout: ; 38fef ; Rollout, Fury Cutter ; 80% chance to discourage this move if the enemy is in love, confused, or paralyzed. - ld a, [EnemySubStatus1] + ld a, [wEnemySubStatus1] bit SUBSTATUS_IN_LOVE, a jr nz, .asm_39020 - ld a, [EnemySubStatus3] + ld a, [wEnemySubStatus3] bit SUBSTATUS_CONFUSED, a jr nz, .asm_39020 - ld a, [EnemyMonStatus] + ld a, [wEnemyMonStatus] bit PAR, a jr nz, .asm_39020 @@ -2308,10 +2308,10 @@ AI_Smart_Rollout: ; 38fef call AICheckEnemyQuarterHP jr nc, .asm_39020 - ld a, [EnemyAccLevel] + ld a, [wEnemyAccLevel] cp 7 jr c, .asm_39020 - ld a, [PlayerEvaLevel] + ld a, [wPlayerEvaLevel] cp 8 jr nc, .asm_39020 @@ -2336,7 +2336,7 @@ AI_Smart_Attract: ; 39026 ; 80% chance to encourage this move during the first turn of player's Pokemon. ; 80% chance to discourage this move otherwise. - ld a, [PlayerTurnsTaken] + ld a, [wPlayerTurnsTaken] and a jr z, .first_turn @@ -2370,11 +2370,11 @@ AI_Smart_Magnitude: AI_Smart_Earthquake: ; 39044 ; Greatly encourage this move if the player is underground and the enemy is faster. - ld a, [LastPlayerCounterMove] + ld a, [wLastPlayerCounterMove] cp DIG ret nz - ld a, [PlayerSubStatus3] + ld a, [wPlayerSubStatus3] bit SUBSTATUS_UNDERGROUND, a jr z, .could_dig @@ -2442,11 +2442,11 @@ AI_Smart_RapidSpin: ; 39084 and a jr nz, .asm_39097 - ld a, [EnemySubStatus4] + ld a, [wEnemySubStatus4] bit SUBSTATUS_LEECH_SEED, a jr nz, .asm_39097 - ld a, [EnemyScreens] + ld a, [wEnemyScreens] bit SCREENS_SPIKES, a ret z @@ -2504,13 +2504,13 @@ AI_Smart_RainDance: ; 390cb ; Greatly discourage this move if it would favour the player type-wise. ; Particularly, if the player is a Water-type. - ld a, [BattleMonType1] + ld a, [wBattleMonType1] cp WATER jr z, AIBadWeatherType cp FIRE jr z, AIGoodWeatherType - ld a, [BattleMonType2] + ld a, [wBattleMonType2] cp WATER jr z, AIBadWeatherType cp FIRE @@ -2541,13 +2541,13 @@ AI_Smart_SunnyDay: ; 390f3 ; Greatly discourage this move if it would favour the player type-wise. ; Particularly, if the player is a Fire-type. - ld a, [BattleMonType1] + ld a, [wBattleMonType1] cp FIRE jr z, AIBadWeatherType cp WATER jr z, AIGoodWeatherType - ld a, [BattleMonType2] + ld a, [wBattleMonType2] cp FIRE jr z, AIBadWeatherType cp WATER @@ -2597,12 +2597,12 @@ AIGoodWeatherType: ; 39122 ; ...as long as one of the following conditions meet: ; It's the first turn of the player's Pokemon. - ld a, [PlayerTurnsTaken] + ld a, [wPlayerTurnsTaken] and a jr z, .good ; Or it's the first turn of the enemy's Pokemon. - ld a, [EnemyTurnsTaken] + ld a, [wEnemyTurnsTaken] and a ret nz @@ -2630,7 +2630,7 @@ AI_Smart_BellyDrum: ; 3913d ; Dismiss this move if enemy's attack is higher than +2 or if enemy's HP is below 50%. ; Else, discourage this move if enemy's HP is not full. - ld a, [EnemyAtkLevel] + ld a, [wEnemyAtkLevel] cp $a jr nc, .asm_3914d @@ -2652,7 +2652,7 @@ AI_Smart_BellyDrum: ; 3913d AI_Smart_PsychUp: ; 39152 push hl - ld hl, EnemyAtkLevel + ld hl, wEnemyAtkLevel ld b, $8 ld c, 100 @@ -2668,7 +2668,7 @@ AI_Smart_PsychUp: ; 39152 ; Calculate the sum of all player's stat level modifiers. Add 100 first to prevent underflow. ; Put the result in d. d will range between 58 and 142. - ld hl, PlayerAtkLevel + ld hl, wPlayerAtkLevel ld b, $8 ld d, 100 @@ -2687,12 +2687,12 @@ AI_Smart_PsychUp: ; 39152 jr nc, .asm_39188 ; Else, 80% chance to encourage this move unless player's accuracy level is lower than -1... - ld a, [PlayerAccLevel] + ld a, [wPlayerAccLevel] cp $6 ret c ; ...or enemy's evasion level is higher than +0. - ld a, [EnemyEvaLevel] + ld a, [wEnemyEvaLevel] cp $8 ret nc @@ -2711,7 +2711,7 @@ AI_Smart_PsychUp: ; 39152 AI_Smart_MirrorCoat: ; 3918b push hl - ld hl, PlayerUsedMoves + ld hl, wPlayerUsedMoves ld c, $4 ld b, $0 @@ -2744,7 +2744,7 @@ AI_Smart_MirrorCoat: ; 3918b cp $3 jr nc, .asm_391ca - ld a, [LastPlayerCounterMove] + ld a, [wLastPlayerCounterMove] and a jr z, .asm_391d2 @@ -2778,11 +2778,11 @@ AI_Smart_Twister: AI_Smart_Gust: ; 391d5 ; Greatly encourage this move if the player is flying and the enemy is faster. - ld a, [LastPlayerCounterMove] + ld a, [wLastPlayerCounterMove] cp FLY ret nz - ld a, [PlayerSubStatus3] + ld a, [wPlayerSubStatus3] bit SUBSTATUS_FLYING, a jr z, .couldFly @@ -2813,7 +2813,7 @@ AI_Smart_FutureSight: ; 391f3 call AICompareSpeed ret nc - ld a, [PlayerSubStatus3] + ld a, [wPlayerSubStatus3] and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND ret z @@ -2842,7 +2842,7 @@ AI_Smart_Solarbeam: ; 3920b ; 80% chance to encourage this move when it's sunny. ; 90% chance to discourage this move when it's raining. - ld a, [Weather] + ld a, [wBattleWeather] cp WEATHER_SUN jr z, .asm_3921e @@ -2870,7 +2870,7 @@ AI_Smart_Solarbeam: ; 3920b AI_Smart_Thunder: ; 39225 ; 90% chance to discourage this move when it's sunny. - ld a, [Weather] + ld a, [wBattleWeather] cp WEATHER_SUN ret nz @@ -2887,13 +2887,13 @@ AICompareSpeed: ; 39233 ; Return carry if enemy is faster than player. push bc - ld a, [EnemyMonSpeed + 1] + ld a, [wEnemyMonSpeed + 1] ld b, a - ld a, [BattleMonSpeed + 1] + ld a, [wBattleMonSpeed + 1] cp b - ld a, [EnemyMonSpeed] + ld a, [wEnemyMonSpeed] ld b, a - ld a, [BattleMonSpeed] + ld a, [wBattleMonSpeed] sbc b pop bc ret @@ -2904,8 +2904,8 @@ AICheckPlayerMaxHP: ; 39246 push hl push de push bc - ld de, BattleMonHP - ld hl, BattleMonMaxHP + ld de, wBattleMonHP + ld hl, wBattleMonMaxHP jr AICheckMaxHP ; 39251 @@ -2914,8 +2914,8 @@ AICheckEnemyMaxHP: ; 39251 push hl push de push bc - ld de, EnemyMonHP - ld hl, EnemyMonMaxHP + ld de, wEnemyMonHP + ld hl, wEnemyMonMaxHP ; fallthrough ; 3925a @@ -2950,7 +2950,7 @@ AICheckMaxHP: ; 3925a AICheckPlayerHalfHP: ; 3926e push hl - ld hl, BattleMonHP + ld hl, wBattleMonHP ld b, [hl] inc hl ld c, [hl] @@ -2971,7 +2971,7 @@ AICheckEnemyHalfHP: ; 39281 push hl push de push bc - ld hl, EnemyMonHP + ld hl, wEnemyMonHP ld b, [hl] inc hl ld c, [hl] @@ -2994,7 +2994,7 @@ AICheckEnemyQuarterHP: ; 39298 push hl push de push bc - ld hl, EnemyMonHP + ld hl, wEnemyMonHP ld b, [hl] inc hl ld c, [hl] @@ -3017,7 +3017,7 @@ AICheckEnemyQuarterHP: ; 39298 AICheckPlayerQuarterHP: ; 392b3 push hl - ld hl, BattleMonHP + ld hl, wBattleMonHP ld b, [hl] inc hl ld c, [hl] @@ -3040,8 +3040,8 @@ AIHasMoveEffect: ; 392ca ; Return carry if the enemy has move b. push hl - ld hl, EnemyMonMoves - ld c, EnemyMonMovesEnd - EnemyMonMoves + ld hl, wEnemyMonMoves + ld c, wEnemyMonMovesEnd - wEnemyMonMoves .checkmove ld a, [hli] @@ -3082,8 +3082,8 @@ AIHasMoveInArray: ; 392e6 jr z, .done ld b, a - ld c, EnemyMonMovesEnd - EnemyMonMoves + 1 - ld de, EnemyMonMoves + ld c, wEnemyMonMovesEnd - wEnemyMonMoves + 1 + ld de, wEnemyMonMoves .check dec c @@ -3145,9 +3145,9 @@ AI_Opportunist: ; 39315 ret c .asm_39322 - ld hl, Buffer1 - 1 - ld de, EnemyMonMoves - ld c, EnemyMonMovesEnd - EnemyMonMoves + 1 + ld hl, wBuffer1 - 1 + ld de, wEnemyMonMoves + ld c, wEnemyMonMovesEnd - wEnemyMonMoves + 1 .checkmove inc hl dec c @@ -3222,13 +3222,13 @@ AI_Aggressive: ; 39369 ; no move will be discouraged ; Figure out which attack does the most damage and put it in c. - ld hl, EnemyMonMoves + ld hl, wEnemyMonMoves ld bc, 0 ld de, 0 .checkmove inc b ld a, b - cp EnemyMonMovesEnd - EnemyMonMoves + 1 + cp wEnemyMonMovesEnd - wEnemyMonMoves + 1 jr z, .gotstrongestmove ld a, [hli] @@ -3248,15 +3248,15 @@ AI_Aggressive: ; 39369 pop hl ; Update current move if damage is highest so far - ld a, [CurDamage + 1] + ld a, [wCurDamage + 1] cp e - ld a, [CurDamage] + ld a, [wCurDamage] sbc d jr c, .checkmove - ld a, [CurDamage + 1] + ld a, [wCurDamage + 1] ld e, a - ld a, [CurDamage] + ld a, [wCurDamage] ld d, a ld c, b jr .checkmove @@ -3274,13 +3274,13 @@ AI_Aggressive: ; 39369 jr z, .done ; Discourage moves that do less damage unless they're reckless too. - ld hl, Buffer1 - 1 - ld de, EnemyMonMoves + ld hl, wBuffer1 - 1 + ld de, wEnemyMonMoves ld b, 0 .checkmove2 inc b ld a, b - cp EnemyMonMovesEnd - EnemyMonMoves + 1 + cp wEnemyMonMovesEnd - wEnemyMonMoves + 1 jr z, .done ; Ignore this move if it is the highest damaging one. @@ -3357,13 +3357,13 @@ AIDamageCalc: ; 393e7 AI_Cautious: ; 39418 ; 90% chance to discourage moves with residual effects after the first turn. - ld a, [EnemyTurnsTaken] + ld a, [wEnemyTurnsTaken] and a ret z - ld hl, Buffer1 - 1 - ld de, EnemyMonMoves - ld c, EnemyMonMovesEnd - EnemyMonMoves + 1 + ld hl, wBuffer1 - 1 + ld de, wEnemyMonMoves + ld c, wEnemyMonMovesEnd - wEnemyMonMoves + 1 .asm_39425 inc hl dec c @@ -3414,9 +3414,9 @@ AI_Cautious: ; 39418 AI_Status: ; 39453 ; Dismiss status moves that don't affect the player. - ld hl, Buffer1 - 1 - ld de, EnemyMonMoves - ld b, EnemyMonMovesEnd - EnemyMonMoves + 1 + ld hl, wBuffer1 - 1 + ld de, wEnemyMonMoves + ld b, wEnemyMonMovesEnd - wEnemyMonMoves + 1 .checkmove dec b ret z @@ -3446,10 +3446,10 @@ AI_Status: ; 39453 jr .typeimmunity .poisonimmunity - ld a, [BattleMonType1] + ld a, [wBattleMonType1] cp POISON jr z, .immune - ld a, [BattleMonType2] + ld a, [wBattleMonType2] cp POISON jr z, .immune @@ -3479,9 +3479,9 @@ AI_Risky: ; 394a9 ; Use any move that will KO the target. ; Risky moves will often be an exception (see below). - ld hl, Buffer1 - 1 - ld de, EnemyMonMoves - ld c, EnemyMonMovesEnd - EnemyMonMoves + 1 + ld hl, wBuffer1 - 1 + ld de, wEnemyMonMoves + ld c, wEnemyMonMovesEnd - wEnemyMonMoves + 1 .checkmove inc hl dec c @@ -3519,13 +3519,13 @@ AI_Risky: ; 394a9 .checkko call AIDamageCalc - ld a, [CurDamage + 1] + ld a, [wCurDamage + 1] ld e, a - ld a, [CurDamage] + ld a, [wCurDamage] ld d, a - ld a, [BattleMonHP + 1] + ld a, [wBattleMonHP + 1] cp e - ld a, [BattleMonHP] + ld a, [wBattleMonHP] sbc d jr nc, .nextmove diff --git a/engine/battle/ai/switch.asm b/engine/battle/ai/switch.asm index c2f83fa1f..d397c8d32 100755 --- a/engine/battle/ai/switch.asm +++ b/engine/battle/ai/switch.asm @@ -7,7 +7,7 @@ CheckPlayerMoveTypeMatchups: ; 3484e push bc ld a, 10 ld [wEnemyAISwitchScore], a - ld hl, PlayerUsedMoves + ld hl, wPlayerUsedMoves ld a, [hl] and a jr z, .unknown_moves @@ -27,7 +27,7 @@ CheckPlayerMoveTypeMatchups: ; 3484e inc hl call GetMoveByte - ld hl, EnemyMonType + ld hl, wEnemyMonType call CheckTypeMatchup ld a, [wTypeMatchup] cp 10 + 1 ; 1.0 + 0.1 @@ -70,16 +70,16 @@ CheckPlayerMoveTypeMatchups: ; 3484e jr .done .unknown_moves - ld a, [BattleMonType1] + ld a, [wBattleMonType1] ld b, a - ld hl, EnemyMonType1 + ld hl, wEnemyMonType1 call CheckTypeMatchup ld a, [wTypeMatchup] cp 10 + 1 ; 1.0 + 0.1 jr c, .ok call .DecreaseScore .ok - ld a, [BattleMonType2] + ld a, [wBattleMonType2] cp b jr z, .ok2 call CheckTypeMatchup @@ -99,7 +99,7 @@ CheckPlayerMoveTypeMatchups: ; 3484e .CheckEnemyMoveMatchups: ; 348de - ld de, EnemyMonMoves + ld de, wEnemyMonMoves ld b, NUM_MOVES + 1 ld c, 0 @@ -122,7 +122,7 @@ CheckPlayerMoveTypeMatchups: ; 3484e inc hl call GetMoveByte - ld hl, BattleMonType1 + ld hl, wBattleMonType1 call CheckTypeMatchup ld a, [wTypeMatchup] @@ -183,11 +183,11 @@ CheckAbleToSwitch: ; 34941 call FindAliveEnemyMons ret c - ld a, [EnemySubStatus1] + ld a, [wEnemySubStatus1] bit SUBSTATUS_PERISH, a jr z, .no_perish - ld a, [EnemyPerishCount] + ld a, [wEnemyPerishCount] cp 1 jr nz, .no_perish @@ -229,7 +229,7 @@ CheckAbleToSwitch: ; 34941 cp 11 ret nc - ld a, [LastPlayerCounterMove] + ld a, [wLastPlayerCounterMove] and a jr z, .no_last_counter_move @@ -296,7 +296,7 @@ CheckAbleToSwitch: ; 34941 FindAliveEnemyMons: ; 349f4 - ld a, [OTPartyCount] + ld a, [wOTPartyCount] cp 2 jr c, .only_one @@ -304,10 +304,10 @@ FindAliveEnemyMons: ; 349f4 ld e, 0 ld b, 1 << (PARTY_LENGTH - 1) ld c, 0 - ld hl, OTPartyMon1HP + ld hl, wOTPartyMon1HP .loop - ld a, [CurOTMon] + ld a, [wCurOTMon] cp e jr z, .next @@ -348,8 +348,8 @@ FindAliveEnemyMons: ; 349f4 FindEnemyMonsImmuneToLastCounterMove: ; 34a2a - ld hl, OTPartyMon1 - ld a, [OTPartyCount] + ld hl, wOTPartyMon1 + ld a, [wOTPartyCount] ld b, a ld c, 1 << (PARTY_LENGTH - 1) ld d, 0 @@ -357,7 +357,7 @@ FindEnemyMonsImmuneToLastCounterMove: ; 34a2a ld [wEnemyAISwitchScore], a .loop - ld a, [CurOTMon] + ld a, [wCurOTMon] cp d push hl jr z, .next @@ -375,11 +375,11 @@ FindEnemyMonsImmuneToLastCounterMove: ; 34a2a jr z, .next ld a, [hl] - ld [CurSpecies], a + ld [wCurSpecies], a call GetBaseData ; the player's last move is damaging... - ld a, [LastPlayerCounterMove] + ld a, [wLastPlayerCounterMove] dec a ld hl, Moves + MOVE_POWER call GetMoveAttr @@ -389,7 +389,7 @@ FindEnemyMonsImmuneToLastCounterMove: ; 34a2a ; and the Pokemon is immune to it... inc hl call GetMoveByte - ld hl, BaseType + ld hl, wBaseType call CheckTypeMatchup ld a, [wTypeMatchup] and a @@ -417,9 +417,9 @@ FindEnemyMonsImmuneToLastCounterMove: ; 34a2a FindAliveEnemyMonsWithASuperEffectiveMove: ; 34a85 push bc - ld a, [OTPartyCount] + ld a, [wOTPartyCount] ld e, a - ld hl, OTPartyMon1HP + ld hl, wOTPartyMon1HP ld b, 1 << (PARTY_LENGTH - 1) ld c, 0 .loop @@ -434,7 +434,7 @@ FindAliveEnemyMonsWithASuperEffectiveMove: ; 34a85 .next srl b push bc - ld bc, PartyMon2HP - (PartyMon1HP + 1) + ld bc, wPartyMon2HP - (wPartyMon1HP + 1) add hl, bc pop bc dec e @@ -449,7 +449,7 @@ FindEnemyMonsWithASuperEffectiveMove: ; 34aa7 ld a, -1 ld [wEnemyAISwitchScore], a - ld hl, OTPartyMon1Moves + ld hl, wOTPartyMon1Moves ld b, 1 << (PARTY_LENGTH - 1) ld d, 0 ld e, 0 @@ -480,7 +480,7 @@ FindEnemyMonsWithASuperEffectiveMove: ; 34aa7 ; check type matchups inc hl call GetMoveByte - ld hl, BattleMonType1 + ld hl, wBattleMonType1 call CheckTypeMatchup ; if immune or not very effective: continue @@ -556,7 +556,7 @@ FindEnemyMonsWithASuperEffectiveMove: ; 34aa7 FindEnemyMonsThatResistPlayer: ; 34b20 push bc - ld hl, OTPartySpecies + ld hl, wOTPartySpecies ld b, 1 << (PARTY_LENGTH - 1) ld c, 0 @@ -566,9 +566,9 @@ FindEnemyMonsThatResistPlayer: ; 34b20 jr z, .done push hl - ld [CurSpecies], a + ld [wCurSpecies], a call GetBaseData - ld a, [LastPlayerCounterMove] + ld a, [wLastPlayerCounterMove] and a jr z, .skip_move @@ -583,16 +583,16 @@ FindEnemyMonsThatResistPlayer: ; 34b20 jr .check_type .skip_move - ld a, [BattleMonType1] - ld hl, BaseType + ld a, [wBattleMonType1] + ld hl, wBaseType call CheckTypeMatchup ld a, [wTypeMatchup] cp 10 + 1 jr nc, .dont_choose_mon - ld a, [BattleMonType2] + ld a, [wBattleMonType2] .check_type - ld hl, BaseType + ld hl, wBaseType call CheckTypeMatchup ld a, [wTypeMatchup] cp 10 + 1 @@ -618,10 +618,10 @@ FindEnemyMonsThatResistPlayer: ; 34b20 FindEnemyMonsWithAtLeastQuarterMaxHP: ; 34b77 push bc - ld de, OTPartySpecies + ld de, wOTPartySpecies ld b, 1 << (PARTY_LENGTH - 1) ld c, 0 - ld hl, OTPartyMon1HP + ld hl, wOTPartyMon1HP .loop ld a, [de] diff --git a/engine/battle/anim_hp_bar.asm b/engine/battle/anim_hp_bar.asm index 71276d27e..7d51a8629 100755 --- a/engine/battle/anim_hp_bar.asm +++ b/engine/battle/anim_hp_bar.asm @@ -275,10 +275,10 @@ HPBarAnim_UpdateHPRemaining: ; d784 ld [hld], a dec hl ld a, [wCurHPAnimOldHP] - ld [StringBuffer2 + 1], a + ld [wStringBuffer2 + 1], a ld a, [wCurHPAnimOldHP + 1] - ld [StringBuffer2], a - ld de, StringBuffer2 + ld [wStringBuffer2], a + ld de, wStringBuffer2 lb bc, 2, 3 call PrintNum pop hl @@ -311,7 +311,7 @@ HPBarAnim_BGMapUpdate: ; d7c9 jr z, .load_0 cp $1 jr z, .load_1 - ld a, [CurPartyMon] + ld a, [wCurPartyMon] cp $3 jr nc, .bottom_half_of_screen ld c, $0 diff --git a/engine/battle/battle_transition.asm b/engine/battle/battle_transition.asm index 452339e81..29b2d8663 100644 --- a/engine/battle/battle_transition.asm +++ b/engine/battle/battle_transition.asm @@ -198,12 +198,12 @@ BattleTransitionJumptable: ; 8c314 StartTrainerBattle_DetermineWhichAnimation: ; 8c365 (23:4365) ; The screen flashes a different number of times depending on the level of ; your lead Pokemon relative to the opponent's. -; BUG: BattleMonLevel and EnemyMonLevel are not set at this point, so whatever +; BUG: wBattleMonLevel and wEnemyMonLevel are not set at this point, so whatever ; values happen to be there will determine the animation. ld de, 0 - ld a, [BattleMonLevel] + ld a, [wBattleMonLevel] add 3 - ld hl, EnemyMonLevel + ld hl, wEnemyMonLevel cp [hl] jr nc, .okay set 0, e @@ -298,7 +298,7 @@ StartTrainerBattle_Flash: ; 8c3ab (23:43ab) StartTrainerBattle_SetUpForWavyOutro: ; 8c3e8 (23:43e8) farcall Function5602 - ld a, BANK(LYOverrides) + ld a, BANK(wLYOverrides) ld [rSVBK], a call StartTrainerBattle_NextScene @@ -334,8 +334,8 @@ StartTrainerBattle_SineWave: ; 8c408 (23:4408) ld d, [hl] add [hl] ld [hl], a - ld a, LYOverridesEnd - LYOverrides - ld bc, LYOverrides + ld a, wLYOverridesEnd - wLYOverrides + ld bc, wLYOverrides ld e, $0 .loop @@ -356,7 +356,7 @@ StartTrainerBattle_SineWave: ; 8c408 (23:4408) StartTrainerBattle_SetUpForSpinOutro: ; 8c43d (23:443d) farcall Function5602 - ld a, BANK(LYOverrides) + ld a, BANK(wLYOverrides) ld [rSVBK], a call StartTrainerBattle_NextScene xor a @@ -498,7 +498,7 @@ ENDM StartTrainerBattle_SetUpForRandomScatterOutro: ; 8c578 (23:4578) farcall Function5602 - ld a, BANK(LYOverrides) + ld a, BANK(wLYOverrides) ld [rSVBK], a call StartTrainerBattle_NextScene ld a, $10 @@ -566,13 +566,13 @@ StartTrainerBattle_SpeckleToBlack: ; 8c58f (23:458f) ret StartTrainerBattle_LoadPokeBallGraphics: ; 8c5dc (23:45dc) - ld a, [OtherTrainerClass] + ld a, [wOtherTrainerClass] and a jp z, .nextscene ; don't need to be here if wild xor a ld [hBGMapMode], a - hlcoord 0, 0, AttrMap + hlcoord 0, 0, wAttrMap ld bc, SCREEN_HEIGHT * SCREEN_WIDTH inc b inc c @@ -639,7 +639,7 @@ StartTrainerBattle_LoadPokeBallGraphics: ; 8c5dc (23:45dc) .cgb ld hl, .daypals - ld a, [TimeOfDayPal] + ld a, [wTimeOfDayPal] maskbits NUM_DAYTIMES cp DARKNESS_F jr nz, .daytime @@ -699,7 +699,7 @@ INCLUDE "gfx/overworld/trainer_battle_nite.pal" ; 8c6b1 .loadpokeballgfx - ld a, [OtherTrainerClass] + ld a, [wOtherTrainerClass] ld de, PokeBallTransition ret @@ -724,12 +724,12 @@ PokeBallTransition: WipeLYOverrides: ; 8c6d8 ld a, [rSVBK] push af - ld a, BANK(LYOverrides) + ld a, BANK(wLYOverrides) ld [rSVBK], a - ld hl, LYOverrides + ld hl, wLYOverrides call .wipe - ld hl, LYOverridesBackup + ld hl, wLYOverridesBackup call .wipe pop af diff --git a/engine/battle/checkbattlescene.asm b/engine/battle/checkbattlescene.asm index a33cc62e3..577c36e33 100644 --- a/engine/battle/checkbattlescene.asm +++ b/engine/battle/checkbattlescene.asm @@ -7,7 +7,7 @@ CheckBattleScene: ; 4ea44 cp LINK_MOBILE jr z, .mobile - ld a, [Options] + ld a, [wOptions] bit BATTLE_SCENE, a jr nz, .off diff --git a/engine/battle/consumehelditem.asm b/engine/battle/consumehelditem.asm index a6f7766fb..39ddbc27e 100644 --- a/engine/battle/consumehelditem.asm +++ b/engine/battle/consumehelditem.asm @@ -4,13 +4,13 @@ ConsumeHeldItem: ; 27192 push bc ld a, [hBattleTurn] and a - ld hl, OTPartyMon1Item - ld de, EnemyMonItem - ld a, [CurOTMon] + ld hl, wOTPartyMon1Item + ld de, wEnemyMonItem + ld a, [wCurOTMon] jr z, .theirturn - ld hl, PartyMon1Item - ld de, BattleMonItem - ld a, [CurBattleMon] + ld hl, wPartyMon1Item + ld de, wBattleMonItem + ld a, [wCurBattleMon] .theirturn push hl diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 1a58b3df5..0fe77df40 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -4,11 +4,11 @@ DoBattle: ; 3c000 xor a ld [wBattleParticipantsNotFainted], a ld [wBattleParticipantsIncludingFainted], a - ld [wPlayerAction], a - ld [BattleEnded], a + ld [wBattlePlayerAction], a + ld [wBattleEnded], a inc a ld [wBattleHasJustStarted], a - ld hl, OTPartyMon1HP + ld hl, wOTPartyMon1HP ld bc, PARTYMON_STRUCT_LENGTH - 1 ld d, BATTLEACTION_SWITCH1 - 1 .loop @@ -52,33 +52,33 @@ DoBattle: ; 3c000 and a jp z, LostBattle call Call_LoadTempTileMapToTileMap - ld a, [BattleType] + ld a, [wBattleType] cp BATTLETYPE_DEBUG jp z, .tutorial_debug cp BATTLETYPE_TUTORIAL jp z, .tutorial_debug xor a - ld [CurPartyMon], a + ld [wCurPartyMon], a .loop2 call CheckIfCurPartyMonIsFitToFight jr nz, .alive2 - ld hl, CurPartyMon + ld hl, wCurPartyMon inc [hl] jr .loop2 .alive2 - ld a, [CurBattleMon] - ld [LastPlayerMon], a - ld a, [CurPartyMon] - ld [CurBattleMon], a + ld a, [wCurBattleMon] + ld [wLastPlayerMon], a + ld a, [wCurPartyMon] + ld [wCurBattleMon], a inc a - ld hl, PartySpecies - 1 + ld hl, wPartySpecies - 1 ld c, a ld b, 0 add hl, bc ld a, [hl] - ld [CurPartySpecies], a - ld [TempBattleMonSpecies], a + ld [wCurPartySpecies], a + ld [wTempBattleMonSpecies], a hlcoord 1, 5 ld a, 9 call SlideBattlePicOut @@ -154,7 +154,7 @@ WildFled_EnemyFled_LinkBattleCanceled: ; 3c0e5 .skip_sfx call SetPlayerTurn ld a, 1 - ld [BattleEnded], a + ld [wBattleEnded], a ret ; 3c12f @@ -170,8 +170,8 @@ BattleTurn: ; 3c12f ld [wBattleHasJustStarted], a ld [wPlayerJustGotFrozen], a ld [wEnemyJustGotFrozen], a - ld [CurDamage], a - ld [CurDamage + 1], a + ld [wCurDamage], a + ld [wCurDamage + 1], a call HandleBerserkGene call UpdateBattleMonInParty @@ -190,7 +190,7 @@ BattleTurn: ; 3c12f .loop1 call BattleMenu jr c, .quit - ld a, [BattleEnded] + ld a, [wBattleEnded] and a jr nz, .quit ld a, [wForcedSwitch] ; roared/whirlwinded/teleported @@ -217,12 +217,12 @@ BattleTurn: ; 3c12f and a jr nz, .quit - ld a, [BattleEnded] + ld a, [wBattleEnded] and a jr nz, .quit call HandleBetweenTurnEffects - ld a, [BattleEnded] + ld a, [wBattleEnded] and a jr nz, .quit jp .loop @@ -303,7 +303,7 @@ CheckFaint_PlayerThenEnemy: ; 3c23c call HasPlayerFainted jr nz, .PlayerNotFainted call HandlePlayerMonFaint - ld a, [BattleEnded] + ld a, [wBattleEnded] and a jr nz, .BattleIsOver @@ -311,7 +311,7 @@ CheckFaint_PlayerThenEnemy: ; 3c23c call HasEnemyFainted jr nz, .BattleContinues call HandleEnemyMonFaint - ld a, [BattleEnded] + ld a, [wBattleEnded] and a jr nz, .BattleIsOver @@ -328,7 +328,7 @@ CheckFaint_EnemyThenPlayer: ; 3c25c call HasEnemyFainted jr nz, .EnemyNotFainted call HandleEnemyMonFaint - ld a, [BattleEnded] + ld a, [wBattleEnded] and a jr nz, .BattleIsOver @@ -336,7 +336,7 @@ CheckFaint_EnemyThenPlayer: ; 3c25c call HasPlayerFainted jr nz, .BattleContinues call HandlePlayerMonFaint - ld a, [BattleEnded] + ld a, [wBattleEnded] and a jr nz, .BattleIsOver @@ -363,15 +363,15 @@ HandleBerserkGene: ; 3c27c .player call SetPlayerTurn - ld de, PartyMon1Item - ld a, [CurBattleMon] + ld de, wPartyMon1Item + ld a, [wCurBattleMon] ld b, a jr .go .enemy call SetEnemyTurn - ld de, OTPartyMon1Item - ld a, [CurOTMon] + ld de, wOTPartyMon1Item + ld a, [wCurOTMon] ld b, a ; jr .go @@ -404,8 +404,8 @@ HandleBerserkGene: ; 3c27c push af xor a ld [hl], a - ld [AttackMissed], a - ld [EffectFailed], a + ld [wAttackMissed], a + ld [wEffectFailed], a farcall BattleCommand_AttackUp2 pop af pop hl @@ -455,7 +455,7 @@ DetermineMoveOrder: ; 3c314 jr z, .use_move sub BATTLEACTION_SWITCH1 jr c, .use_move - ld a, [wPlayerAction] + ld a, [wBattlePlayerAction] cp $2 jr nz, .switch ld a, [hSerialConnectionStatus] @@ -480,7 +480,7 @@ DetermineMoveOrder: ; 3c314 jp .enemy_first .use_move - ld a, [wPlayerAction] + ld a, [wBattlePlayerAction] and a jp nz, .player_first call CompareMovePriority @@ -536,8 +536,8 @@ DetermineMoveOrder: ; 3c314 jr .speed_check .speed_check - ld de, BattleMonSpeed - ld hl, EnemyMonSpeed + ld de, wBattleMonSpeed + ld hl, wEnemyMonSpeed ld c, 2 call StringCmp jr z, .speed_tie @@ -568,7 +568,7 @@ DetermineMoveOrder: ; 3c314 ; 3c3f5 CheckContestBattleOver: ; 3c3f5 - ld a, [BattleType] + ld a, [wBattleType] cp BATTLETYPE_CONTEST jr nz, .contest_not_over ld a, [wParkBallsRemaining] @@ -587,20 +587,20 @@ CheckContestBattleOver: ; 3c3f5 ; 3c410 CheckPlayerLockedIn: ; 3c410 - ld a, [PlayerSubStatus4] + ld a, [wPlayerSubStatus4] and 1 << SUBSTATUS_RECHARGE jp nz, .quit - ld hl, EnemySubStatus3 + ld hl, wEnemySubStatus3 res SUBSTATUS_FLINCHED, [hl] - ld hl, PlayerSubStatus3 + ld hl, wPlayerSubStatus3 res SUBSTATUS_FLINCHED, [hl] ld a, [hl] and 1 << SUBSTATUS_CHARGED | 1 << SUBSTATUS_RAMPAGE jp nz, .quit - ld hl, PlayerSubStatus1 + ld hl, wPlayerSubStatus1 bit SUBSTATUS_ROLLOUT, [hl] jp nz, .quit @@ -615,31 +615,31 @@ CheckPlayerLockedIn: ; 3c410 ParsePlayerAction: ; 3c434 call CheckPlayerLockedIn jp c, .locked_in - ld hl, PlayerSubStatus5 + ld hl, wPlayerSubStatus5 bit SUBSTATUS_ENCORED, [hl] jr z, .not_encored - ld a, [LastPlayerMove] - ld [CurPlayerMove], a + ld a, [wLastPlayerMove] + ld [wCurPlayerMove], a jr .encored .not_encored - ld a, [wPlayerAction] + ld a, [wBattlePlayerAction] cp $2 jr z, .reset_rage and a jr nz, .reset_bide - ld a, [PlayerSubStatus3] + ld a, [wPlayerSubStatus3] and 1 << SUBSTATUS_BIDE jr nz, .locked_in xor a ld [wMoveSelectionMenuType], a inc a ; POUND - ld [FXAnimID], a + ld [wFXAnimID], a call MoveSelectionScreen push af call Call_LoadTempTileMapToTileMap call UpdateBattleHuds - ld a, [CurPlayerMove] + ld a, [wCurPlayerMove] cp STRUGGLE jr z, .struggle call PlayClickSFX @@ -659,13 +659,13 @@ ParsePlayerAction: ; 3c434 cp EFFECT_FURY_CUTTER jr z, .continue_fury_cutter xor a - ld [PlayerFuryCutterCount], a + ld [wPlayerFuryCutterCount], a .continue_fury_cutter ld a, [wPlayerMoveStruct + MOVE_EFFECT] cp EFFECT_RAGE jr z, .continue_rage - ld hl, PlayerSubStatus4 + ld hl, wPlayerSubStatus4 res SUBSTATUS_RAGE, [hl] xor a ld [wPlayerRageCounter], a @@ -677,19 +677,19 @@ ParsePlayerAction: ; 3c434 cp EFFECT_ENDURE jr z, .continue_protect xor a - ld [PlayerProtectCount], a + ld [wPlayerProtectCount], a jr .continue_protect .reset_bide - ld hl, PlayerSubStatus3 + ld hl, wPlayerSubStatus3 res SUBSTATUS_BIDE, [hl] .locked_in xor a - ld [PlayerFuryCutterCount], a - ld [PlayerProtectCount], a + ld [wPlayerFuryCutterCount], a + ld [wPlayerProtectCount], a ld [wPlayerRageCounter], a - ld hl, PlayerSubStatus4 + ld hl, wPlayerSubStatus4 res SUBSTATUS_RAGE, [hl] .continue_protect @@ -699,10 +699,10 @@ ParsePlayerAction: ; 3c434 .reset_rage xor a - ld [PlayerFuryCutterCount], a - ld [PlayerProtectCount], a + ld [wPlayerFuryCutterCount], a + ld [wPlayerProtectCount], a ld [wPlayerRageCounter], a - ld hl, PlayerSubStatus4 + ld hl, wPlayerSubStatus4 res SUBSTATUS_RAGE, [hl] xor a ret @@ -718,15 +718,15 @@ HandleEncore: ; 3c4df .player_1 call .do_enemy .do_player - ld hl, PlayerSubStatus5 + ld hl, wPlayerSubStatus5 bit SUBSTATUS_ENCORED, [hl] ret z - ld a, [PlayerEncoreCount] + ld a, [wPlayerEncoreCount] dec a - ld [PlayerEncoreCount], a + ld [wPlayerEncoreCount], a jr z, .end_player_encore - ld hl, BattleMonPP - ld a, [CurMoveNum] + ld hl, wBattleMonPP + ld a, [wCurMoveNum] ld c, a ld b, 0 add hl, bc @@ -735,22 +735,22 @@ HandleEncore: ; 3c4df ret nz .end_player_encore - ld hl, PlayerSubStatus5 + ld hl, wPlayerSubStatus5 res SUBSTATUS_ENCORED, [hl] call SetEnemyTurn ld hl, BattleText_TargetsEncoreEnded jp StdBattleTextBox .do_enemy - ld hl, EnemySubStatus5 + ld hl, wEnemySubStatus5 bit SUBSTATUS_ENCORED, [hl] ret z - ld a, [EnemyEncoreCount] + ld a, [wEnemyEncoreCount] dec a - ld [EnemyEncoreCount], a + ld [wEnemyEncoreCount], a jr z, .end_enemy_encore - ld hl, EnemyMonPP - ld a, [CurEnemyMoveNum] + ld hl, wEnemyMonPP + ld a, [wCurEnemyMoveNum] ld c, a ld b, 0 add hl, bc @@ -759,7 +759,7 @@ HandleEncore: ; 3c4df ret nz .end_enemy_encore - ld hl, EnemySubStatus5 + ld hl, wEnemySubStatus5 res SUBSTATUS_ENCORED, [hl] call SetPlayerTurn ld hl, BattleText_TargetsEncoreEnded @@ -771,7 +771,7 @@ TryEnemyFlee: ; 3c543 dec a jr nz, .Stay - ld a, [PlayerSubStatus5] + ld a, [wPlayerSubStatus5] bit SUBSTATUS_CANT_RUN, a jr nz, .Stay @@ -779,11 +779,11 @@ TryEnemyFlee: ; 3c543 and a jr nz, .Stay - ld a, [EnemyMonStatus] + ld a, [wEnemyMonStatus] and 1 << FRZ | SLP jr nz, .Stay - ld a, [TempEnemyMonSpecies] + ld a, [wTempEnemyMonSpecies] ld de, 1 ld hl, AlwaysFleeMons call IsInArray @@ -795,7 +795,7 @@ TryEnemyFlee: ; 3c543 jr nc, .Stay push bc - ld a, [TempEnemyMonSpecies] + ld a, [wTempEnemyMonSpecies] ld de, 1 ld hl, OftenFleeMons call IsInArray @@ -806,7 +806,7 @@ TryEnemyFlee: ; 3c543 cp 1 + (10 percent) jr nc, .Stay - ld a, [TempEnemyMonSpecies] + ld a, [wTempEnemyMonSpecies] ld de, 1 ld hl, SometimesFleeMons call IsInArray @@ -827,11 +827,11 @@ CompareMovePriority: ; 3c5b4 ; Compare the priority of the player and enemy's moves. ; Return carry if the player goes first, or z if they match. - ld a, [CurPlayerMove] + ld a, [wCurPlayerMove] call GetMovePriority ld b, a push bc - ld a, [CurEnemyMove] + ld a, [wCurEnemyMove] call GetMovePriority pop bc cp b @@ -920,7 +920,7 @@ Battle_EnemyFirst: ; 3c5fe jp z, HandlePlayerMonFaint call RefreshBattleHuds xor a - ld [wPlayerAction], a + ld [wBattlePlayerAction], a ret ; 3c664 @@ -970,7 +970,7 @@ Battle_PlayerFirst: ; 3c664 jp z, HandleEnemyMonFaint call RefreshBattleHuds xor a - ld [wPlayerAction], a + ld [wBattlePlayerAction], a ret ; 3c6cf @@ -1011,11 +1011,11 @@ HasUserFainted: ; 3c706 and a jr z, HasPlayerFainted HasEnemyFainted: ; 3c70b - ld hl, EnemyMonHP + ld hl, wEnemyMonHP jr CheckIfHPIsZero HasPlayerFainted: ; 3c710 - ld hl, BattleMonHP + ld hl, wBattleMonHP CheckIfHPIsZero: ; 3c713 ld a, [hli] @@ -1052,11 +1052,11 @@ ResidualDamage: ; 3c716 ld [wNumHits], a call Call_PlayBattleAnim_OnlyIfVisible call GetEighthMaxHP - ld de, PlayerToxicCount + ld de, wPlayerToxicCount ld a, [hBattleTurn] and a jr z, .check_toxic - ld de, EnemyToxicCount + ld de, wEnemyToxicCount .check_toxic ld a, BATTLE_VARS_SUBSTATUS5 @@ -1141,11 +1141,11 @@ ResidualDamage: ; 3c716 call StdBattleTextBox .not_cursed - ld hl, BattleMonHP + ld hl, wBattleMonHP ld a, [hBattleTurn] and a jr z, .check_fainted - ld hl, EnemyMonHP + ld hl, wEnemyMonHP .check_fainted ld a, [hli] @@ -1175,11 +1175,11 @@ HandlePerishSong: ; 3c801 call SetPlayerTurn .do_it - ld hl, PlayerPerishCount + ld hl, wPlayerPerishCount ld a, [hBattleTurn] and a jr z, .got_count - ld hl, EnemyPerishCount + ld hl, wEnemyPerishCount .got_count ld a, BATTLE_VARS_SUBSTATUS1 @@ -1200,12 +1200,12 @@ HandlePerishSong: ; 3c801 ld a, [hBattleTurn] and a jr nz, .kill_enemy - ld hl, BattleMonHP + ld hl, wBattleMonHP xor a ld [hli], a ld [hl], a - ld hl, PartyMon1HP - ld a, [CurBattleMon] + ld hl, wPartyMon1HP + ld a, [wCurBattleMon] call GetPartyLocation xor a ld [hli], a @@ -1213,15 +1213,15 @@ HandlePerishSong: ; 3c801 ret .kill_enemy - ld hl, EnemyMonHP + ld hl, wEnemyMonHP xor a ld [hli], a ld [hl], a ld a, [wBattleMode] dec a ret z - ld hl, OTPartyMon1HP - ld a, [CurOTMon] + ld hl, wOTPartyMon1HP + ld a, [wCurOTMon] call GetPartyLocation xor a ld [hli], a @@ -1264,7 +1264,7 @@ HandleWrap: ; 3c874 ld a, [de] ld [wd265], a - ld [FXAnimID], a + ld [wFXAnimID], a call GetMoveName dec [hl] jr z, .release_from_bounds @@ -1277,7 +1277,7 @@ HandleWrap: ; 3c874 call SwitchTurnCore xor a ld [wNumHits], a - ld [FXAnimID + 1], a + ld [wFXAnimID + 1], a predef PlayBattleAnim call SwitchTurnCore @@ -1324,11 +1324,11 @@ HandleLeftovers: ; 3c8eb cp HELD_LEFTOVERS ret nz - ld hl, BattleMonHP + ld hl, wBattleMonHP ld a, [hBattleTurn] and a jr z, .got_hp - ld hl, EnemyMonHP + ld hl, wEnemyMonHP .got_hp ; Don't restore if we're already at max HP @@ -1370,13 +1370,13 @@ HandleMysteryberry: ; 3c93c ld a, b cp HELD_RESTORE_PP jr nz, .quit - ld hl, PartyMon1PP - ld a, [CurBattleMon] + ld hl, wPartyMon1PP + ld a, [wCurBattleMon] call GetPartyLocation ld d, h ld e, l - ld hl, PartyMon1Moves - ld a, [CurBattleMon] + ld hl, wPartyMon1Moves + ld a, [wCurBattleMon] call GetPartyLocation ld a, [hBattleTurn] and a @@ -1386,13 +1386,13 @@ HandleMysteryberry: ; 3c93c ld a, [wBattleMode] dec a jr z, .wild - ld hl, OTPartyMon1PP - ld a, [CurOTMon] + ld hl, wOTPartyMon1PP + ld a, [wCurOTMon] call GetPartyLocation ld d, h ld e, l - ld hl, OTPartyMon1Moves - ld a, [CurOTMon] + ld hl, wOTPartyMon1Moves + ld a, [wCurOTMon] call GetPartyLocation .wild @@ -1429,13 +1429,13 @@ HandleMysteryberry: ; 3c93c push bc ld a, [hl] ld [wd265], a - ld de, BattleMonMoves - 1 - ld hl, BattleMonPP + ld de, wBattleMonMoves - 1 + ld hl, wBattleMonPP ld a, [hBattleTurn] and a jr z, .player_pp - ld de, EnemyMonMoves - 1 - ld hl, EnemyMonPP + ld de, wEnemyMonMoves - 1 + ld hl, wEnemyMonPP .player_pp inc de pop bc @@ -1453,9 +1453,9 @@ HandleMysteryberry: ; 3c93c jr nz, .skip_checks ld a, [hBattleTurn] and a - ld a, [PlayerSubStatus5] + ld a, [wPlayerSubStatus5] jr z, .check_transform - ld a, [EnemySubStatus5] + ld a, [wEnemySubStatus5] .check_transform bit SUBSTATUS_TRANSFORMED, a jr nz, .skip_checks @@ -1531,14 +1531,14 @@ HandleFutureSight: ; 3ca26 callfar UpdateMoveData xor a - ld [AttackMissed], a - ld [AlreadyDisobeyed], a + ld [wAttackMissed], a + ld [wAlreadyDisobeyed], a ld a, 10 - ld [TypeModifier], a + ld [wTypeModifier], a callfar DoMove xor a - ld [CurDamage], a - ld [CurDamage + 1], a + ld [wCurDamage], a + ld [wCurDamage + 1], a ld a, BATTLE_VARS_MOVE call GetBattleVarAddr @@ -1559,7 +1559,7 @@ HanleDefrost: ; 3ca8f .enemy_first call .do_enemy_turn .do_player_turn - ld a, [BattleMonStatus] + ld a, [wBattleMonStatus] bit FRZ, a ret z @@ -1571,9 +1571,9 @@ HanleDefrost: ; 3ca8f cp 10 percent ret nc xor a - ld [BattleMonStatus], a - ld a, [CurBattleMon] - ld hl, PartyMon1Status + ld [wBattleMonStatus], a + ld a, [wCurBattleMon] + ld hl, wPartyMon1Status call GetPartyLocation ld [hl], 0 call UpdateBattleHuds @@ -1582,7 +1582,7 @@ HanleDefrost: ; 3ca8f jp StdBattleTextBox .do_enemy_turn - ld a, [EnemyMonStatus] + ld a, [wEnemyMonStatus] bit FRZ, a ret z ld a, [wEnemyJustGotFrozen] @@ -1592,13 +1592,13 @@ HanleDefrost: ; 3ca8f cp 10 percent ret nc xor a - ld [EnemyMonStatus], a + ld [wEnemyMonStatus], a ld a, [wBattleMode] dec a jr z, .wild - ld a, [CurOTMon] - ld hl, OTPartyMon1Status + ld a, [wCurOTMon] + ld hl, wOTPartyMon1Status call GetPartyLocation ld [hl], 0 .wild @@ -1619,26 +1619,26 @@ HandleSafeguard: ; 3cafb .player1 call .CheckEnemy .CheckPlayer: - ld a, [PlayerScreens] + ld a, [wPlayerScreens] bit SCREENS_SAFEGUARD, a ret z - ld hl, PlayerSafeguardCount + ld hl, wPlayerSafeguardCount dec [hl] ret nz res SCREENS_SAFEGUARD, a - ld [PlayerScreens], a + ld [wPlayerScreens], a xor a jr .print .CheckEnemy: - ld a, [EnemyScreens] + ld a, [wEnemyScreens] bit SCREENS_SAFEGUARD, a ret z - ld hl, EnemySafeguardCount + ld hl, wEnemySafeguardCount dec [hl] ret nz res SCREENS_SAFEGUARD, a - ld [EnemyScreens], a + ld [wEnemyScreens], a ld a, $1 .print @@ -1660,16 +1660,16 @@ HandleScreens: ; 3cb36 call SetPlayerTurn ld de, .Your call .Copy - ld hl, PlayerScreens - ld de, PlayerLightScreenCount + ld hl, wPlayerScreens + ld de, wPlayerLightScreenCount jr .TickScreens .CheckEnemy: call SetEnemyTurn ld de, .Enemy call .Copy - ld hl, EnemyScreens - ld de, EnemyLightScreenCount + ld hl, wEnemyScreens + ld de, wEnemyLightScreenCount .TickScreens: bit SCREENS_LIGHT_SCREEN, [hl] @@ -1679,7 +1679,7 @@ HandleScreens: ; 3cb36 ret .Copy: - ld hl, StringBuffer1 + ld hl, wStringBuffer1 jp CopyName2 ; 3cb75 @@ -1716,18 +1716,18 @@ HandleScreens: ; 3cb36 ; 3cb9e HandleWeather: ; 3cb9e - ld a, [Weather] + ld a, [wBattleWeather] cp WEATHER_NONE ret z - ld hl, WeatherCount + ld hl, wWeatherCount dec [hl] jr z, .ended ld hl, .WeatherMessages call .PrintWeatherMessage - ld a, [Weather] + ld a, [wBattleWeather] cp WEATHER_SANDSTORM ret nz @@ -1752,11 +1752,11 @@ HandleWeather: ; 3cb9e bit SUBSTATUS_UNDERGROUND, a ret nz - ld hl, BattleMonType1 + ld hl, wBattleMonType1 ld a, [hBattleTurn] and a jr z, .ok - ld hl, EnemyMonType1 + ld hl, wEnemyMonType1 .ok ld a, [hli] cp ROCK @@ -1790,11 +1790,11 @@ HandleWeather: ; 3cb9e ld hl, .WeatherEndedMessages call .PrintWeatherMessage xor a - ld [Weather], a + ld [wBattleWeather], a ret .PrintWeatherMessage: - ld a, [Weather] + ld a, [wBattleWeather] dec a ld c, a ld b, 0 @@ -1828,34 +1828,34 @@ SubtractHPFromUser: ; 3cc3f ; 3cc45 SubtractHP: ; 3cc45 - ld hl, BattleMonHP + ld hl, wBattleMonHP ld a, [hBattleTurn] and a jr z, .ok - ld hl, EnemyMonHP + ld hl, wEnemyMonHP .ok inc hl ld a, [hl] - ld [Buffer3], a + ld [wBuffer3], a sub c ld [hld], a - ld [Buffer5], a + ld [wBuffer5], a ld a, [hl] - ld [Buffer4], a + ld [wBuffer4], a sbc b ld [hl], a - ld [Buffer6], a + ld [wBuffer6], a ret nc - ld a, [Buffer3] + ld a, [wBuffer3] ld c, a - ld a, [Buffer4] + ld a, [wBuffer4] ld b, a xor a ld [hli], a ld [hl], a - ld [Buffer5], a - ld [Buffer6], a + ld [wBuffer5], a + ld [wBuffer6], a ret ; 3cc76 @@ -1926,30 +1926,30 @@ GetHalfMaxHP: ; 3cc9f ; 3ccac GetMaxHP: ; 3ccac -; output: bc, Buffer1-2 +; output: bc, wBuffer1-2 - ld hl, BattleMonMaxHP + ld hl, wBattleMonMaxHP ld a, [hBattleTurn] and a jr z, .ok - ld hl, EnemyMonMaxHP + ld hl, wEnemyMonMaxHP .ok ld a, [hli] - ld [Buffer2], a + ld [wBuffer2], a ld b, a ld a, [hl] - ld [Buffer1], a + ld [wBuffer1], a ld c, a ret ; 3ccc2 Unreferenced_GetHalfHP: ; 3ccc2 - ld hl, BattleMonHP + ld hl, wBattleMonHP ld a, [hBattleTurn] and a jr z, .ok - ld hl, EnemyMonHP + ld hl, wEnemyMonHP .ok ld a, [hli] ld b, a @@ -1958,18 +1958,18 @@ Unreferenced_GetHalfHP: ; 3ccc2 srl b rr c ld a, [hli] - ld [Buffer2], a + ld [wBuffer2], a ld a, [hl] - ld [Buffer1], a + ld [wBuffer1], a ret ; 3ccde CheckUserHasEnoughHP: ; 3ccde - ld hl, BattleMonHP + 1 + ld hl, wBattleMonHP + 1 ld a, [hBattleTurn] and a jr z, .ok - ld hl, EnemyMonHP + 1 + ld hl, wEnemyMonHP + 1 .ok ld a, c sub [hl] @@ -1980,43 +1980,43 @@ CheckUserHasEnoughHP: ; 3ccde ; 3ccef RestoreHP ; 3ccef - ld hl, EnemyMonMaxHP + ld hl, wEnemyMonMaxHP ld a, [hBattleTurn] and a jr z, .ok - ld hl, BattleMonMaxHP + ld hl, wBattleMonMaxHP .ok ld a, [hli] - ld [Buffer2], a + ld [wBuffer2], a ld a, [hld] - ld [Buffer1], a + ld [wBuffer1], a dec hl ld a, [hl] - ld [Buffer3], a + ld [wBuffer3], a add c ld [hld], a - ld [Buffer5], a + ld [wBuffer5], a ld a, [hl] - ld [Buffer4], a + ld [wBuffer4], a adc b ld [hli], a - ld [Buffer6], a + ld [wBuffer6], a - ld a, [Buffer1] + ld a, [wBuffer1] ld c, a ld a, [hld] sub c - ld a, [Buffer2] + ld a, [wBuffer2] ld b, a ld a, [hl] sbc b jr c, .asm_3cd2d ld a, b ld [hli], a - ld [Buffer6], a + ld [wBuffer6], a ld a, c ld [hl], a - ld [Buffer5], a + ld [wBuffer5], a .asm_3cd2d call SwitchTurnCore @@ -2047,7 +2047,7 @@ UpdateHPBar: ; 3cd3c HandleEnemyMonFaint: ; 3cd55 call FaintEnemyPokemon - ld hl, BattleMonHP + ld hl, wBattleMonHP ld a, [hli] or [hl] call z, FaintYourPokemon @@ -2059,7 +2059,7 @@ HandleEnemyMonFaint: ; 3cd55 and a jp z, LostBattle - ld hl, BattleMonHP + ld hl, wBattleMonHP ld a, [hli] or [hl] call nz, UpdatePlayerHUD @@ -2074,14 +2074,14 @@ HandleEnemyMonFaint: ; 3cd55 jr nz, .trainer ld a, 1 - ld [BattleEnded], a + ld [wBattleEnded], a ret .trainer call CheckEnemyTrainerDefeated jp z, WinTrainerBattle - ld hl, BattleMonHP + ld hl, wBattleMonHP ld a, [hli] or [hl] jr nz, .player_mon_not_fainted @@ -2090,7 +2090,7 @@ HandleEnemyMonFaint: ; 3cd55 jr nc, .dont_flee ld a, 1 - ld [BattleEnded], a + ld [wBattleEnded], a ret .dont_flee @@ -2099,18 +2099,18 @@ HandleEnemyMonFaint: ; 3cd55 jp c, WildFled_EnemyFled_LinkBattleCanceled ld a, $1 - ld [wPlayerAction], a + ld [wBattlePlayerAction], a call HandleEnemySwitch jp z, WildFled_EnemyFled_LinkBattleCanceled jr DoubleSwitch .player_mon_not_fainted ld a, $1 - ld [wPlayerAction], a + ld [wBattlePlayerAction], a call HandleEnemySwitch jp z, WildFled_EnemyFled_LinkBattleCanceled xor a - ld [wPlayerAction], a + ld [wBattlePlayerAction], a ret ; 3cdca @@ -2128,19 +2128,19 @@ DoubleSwitch: ; 3cdca jr .done .player_1 - ld a, [CurPartyMon] + ld a, [wCurPartyMon] push af ld a, $1 call EnemyPartyMonEntrance call ClearSprites call LoadTileMapToTempTileMap pop af - ld [CurPartyMon], a + ld [wCurPartyMon], a call PlayerPartyMonEntrance .done xor a - ld [wPlayerAction], a + ld [wBattlePlayerAction], a ret ; 3ce01 @@ -2149,18 +2149,18 @@ UpdateBattleStateAndExperienceAfterEnemyFaint: ; 3ce01 ld a, [wBattleMode] dec a jr z, .wild - ld a, [CurOTMon] - ld hl, OTPartyMon1HP + ld a, [wCurOTMon] + ld hl, wOTPartyMon1HP call GetPartyLocation xor a ld [hli], a ld [hl], a .wild - ld hl, PlayerSubStatus3 + ld hl, wPlayerSubStatus3 res SUBSTATUS_IN_LOOP, [hl] xor a - ld hl, EnemyDamageTaken + ld hl, wEnemyDamageTaken ld [hli], a ld [hl], a call NewEnemyMonStatus @@ -2173,10 +2173,10 @@ UpdateBattleStateAndExperienceAfterEnemyFaint: ; 3ce01 .wild2 call StopDangerSound ld a, $1 - ld [wDanger], a + ld [wBattleLowHealthAlarm], a .trainer - ld hl, BattleMonHP + ld hl, wBattleMonHP ld a, [hli] or [hl] jr nz, .player_mon_did_not_faint @@ -2200,8 +2200,8 @@ UpdateBattleStateAndExperienceAfterEnemyFaint: ; 3ce01 ld [wBattleResult], a call IsAnyMonHoldingExpShare jr z, .skip_exp - ld hl, EnemyMonBaseStats - ld b, EnemyMonEnd - EnemyMonBaseStats + ld hl, wEnemyMonBaseStats + ld b, wEnemyMonEnd - wEnemyMonBaseStats .loop srl [hl] inc hl @@ -2209,9 +2209,9 @@ UpdateBattleStateAndExperienceAfterEnemyFaint: ; 3ce01 jr nz, .loop .skip_exp - ld hl, EnemyMonBaseStats + ld hl, wEnemyMonBaseStats ld de, wBackupEnemyMonBaseStats - ld bc, EnemyMonEnd - EnemyMonBaseStats + ld bc, wEnemyMonEnd - wEnemyMonBaseStats call CopyBytes xor a ld [wGivingExperienceToExpShareHolders], a @@ -2224,8 +2224,8 @@ UpdateBattleStateAndExperienceAfterEnemyFaint: ; 3ce01 ld a, d ld [wBattleParticipantsNotFainted], a ld hl, wBackupEnemyMonBaseStats - ld de, EnemyMonBaseStats - ld bc, EnemyMonEnd - EnemyMonBaseStats + ld de, wEnemyMonBaseStats + ld bc, wEnemyMonEnd - wEnemyMonBaseStats call CopyBytes ld a, $1 ld [wGivingExperienceToExpShareHolders], a @@ -2236,9 +2236,9 @@ UpdateBattleStateAndExperienceAfterEnemyFaint: ; 3ce01 ; 3ceaa IsAnyMonHoldingExpShare: ; 3ceaa - ld a, [PartyCount] + ld a, [wPartyCount] ld b, a - ld hl, PartyMon1 + ld hl, wPartyMon1 ld c, 1 ld d, 0 .loop @@ -2293,7 +2293,7 @@ IsAnyMonHoldingExpShare: ; 3ceaa StopDangerSound: ; 3ceec xor a - ld [Danger], a + ld [wLowHealthAlarm], a ret ; 3cef1 @@ -2301,8 +2301,8 @@ FaintYourPokemon: ; 3cef1 call StopDangerSound call WaitSFX ld a, $f0 - ld [CryTracks], a - ld a, [BattleMonSpecies] + ld [wCryTracks], a + ld a, [wBattleMonSpecies] call PlayStereoCry call PlayerMonFaintedAnimation hlcoord 9, 7 @@ -2327,10 +2327,10 @@ FaintEnemyPokemon: ; 3cf14 ; 3cf35 CheckEnemyTrainerDefeated: ; 3cf35 - ld a, [OTPartyCount] + ld a, [wOTPartyCount] ld b, a xor a - ld hl, OTPartyMon1HP + ld hl, wOTPartyMon1HP ld de, PARTYMON_STRUCT_LENGTH .loop @@ -2347,7 +2347,7 @@ CheckEnemyTrainerDefeated: ; 3cf35 ; 3cf4a HandleEnemySwitch: ; 3cf4a - ld hl, EnemyHPPal + ld hl, wEnemyHPPal ld e, HP_BAR_LENGTH_PX call UpdateHPPal call WaitBGMap @@ -2364,7 +2364,7 @@ HandleEnemySwitch: ; 3cf4a call Call_LoadTempTileMapToTileMap .not_linked - ld hl, BattleMonHP + ld hl, wBattleMonHP ld a, [hli] or [hl] ld a, $0 @@ -2394,7 +2394,7 @@ EnemyPartyMonEntrance: ; 3cf78 call SpikesDamage xor a ld [wEnemyMoveStruct + MOVE_ANIM], a - ld [wPlayerAction], a + ld [wBattlePlayerAction], a inc a ret ; 3cfa4 @@ -2403,8 +2403,8 @@ WinTrainerBattle: ; 3cfa4 ; Player won the battle call StopDangerSound ld a, $1 - ld [wDanger], a - ld [BattleEnded], a + ld [wBattleLowHealthAlarm], a + ld [wBattleEnded], a ld a, [wLinkMode] and a ld a, b @@ -2419,14 +2419,14 @@ WinTrainerBattle: ; 3cfa4 and a ret nz - ld a, [InBattleTowerBattle] + ld a, [wInBattleTowerBattle] bit 0, a jr nz, .battle_tower call BattleWinSlideInEnemyTrainerFrontpic ld c, 40 call DelayFrames - ld a, [BattleType] + ld a, [wBattleType] cp BATTLETYPE_CANLOSE jr nz, .skip_heal predef HealParty @@ -2535,7 +2535,7 @@ WinTrainerBattle: ; 3cfa4 .AddMoneyToWallet: ; 3d08d push bc ld hl, wBattleReward + 2 - ld de, Money + 2 + ld de, wMoney + 2 call AddBattleMoneyToAccount pop bc ret @@ -2652,7 +2652,7 @@ IsGymLeader: ; 0x3d128 ld hl, GymLeaders IsGymLeaderCommon: push de - ld a, [OtherTrainerClass] + ld a, [wOtherTrainerClass] ld de, $1 call IsInArray pop de @@ -2663,7 +2663,7 @@ INCLUDE "data/trainers/leaders.asm" HandlePlayerMonFaint: ; 3d14e call FaintYourPokemon - ld hl, EnemyMonHP + ld hl, wEnemyMonHP ld a, [hli] or [hl] call z, FaintEnemyPokemon @@ -2674,7 +2674,7 @@ HandlePlayerMonFaint: ; 3d14e ld a, d and a jp z, LostBattle - ld hl, EnemyMonHP + ld hl, wEnemyMonHP ld a, [hli] or [hl] jr nz, .notfainted @@ -2683,7 +2683,7 @@ HandlePlayerMonFaint: ; 3d14e dec a jr nz, .trainer ld a, $1 - ld [BattleEnded], a + ld [wBattleEnded], a ret .trainer @@ -2694,7 +2694,7 @@ HandlePlayerMonFaint: ; 3d14e call AskUseNextPokemon jr nc, .switch ld a, $1 - ld [BattleEnded], a + ld [wBattleEnded], a ret .switch @@ -2705,40 +2705,40 @@ HandlePlayerMonFaint: ; 3d14e and a ret nz ld a, $1 - ld [wPlayerAction], a + ld [wBattlePlayerAction], a call HandleEnemySwitch jp z, WildFled_EnemyFled_LinkBattleCanceled jp DoubleSwitch ; 3d1aa PlayerMonFaintHappinessMod: ; 3d1aa - ld a, [CurBattleMon] + ld a, [wCurBattleMon] ld c, a ld hl, wBattleParticipantsNotFainted ld b, RESET_FLAG predef SmallFarFlagAction - ld hl, EnemySubStatus3 + ld hl, wEnemySubStatus3 res SUBSTATUS_IN_LOOP, [hl] xor a - ld [Danger], a - ld hl, PlayerDamageTaken + ld [wLowHealthAlarm], a + ld hl, wPlayerDamageTaken ld [hli], a ld [hl], a - ld [BattleMonStatus], a + ld [wBattleMonStatus], a call UpdateBattleMonInParty ld c, HAPPINESS_FAINTED ; If TheirLevel > (YourLevel + 30), use a different parameter - ld a, [BattleMonLevel] + ld a, [wBattleMonLevel] add 30 ld b, a - ld a, [EnemyMonLevel] + ld a, [wEnemyMonLevel] cp b jr c, .got_param ld c, HAPPINESS_BEATENBYSTRONGFOE .got_param - ld a, [CurBattleMon] - ld [CurPartyMon], a + ld a, [wCurBattleMon] + ld [wCurPartyMon], a callfar ChangeHappiness ld a, [wBattleResult] and %11000000 @@ -2774,8 +2774,8 @@ AskUseNextPokemon: ; 3d1f8 ld a, [wMenuCursorY] cp $1 ; YES jr z, .loop - ld hl, PartyMon1Speed - ld de, EnemyMonSpeed + ld hl, wPartyMon1Speed + ld de, wEnemyMonSpeed jp TryToRunAwayFromBattle ; 3d227 @@ -2788,15 +2788,15 @@ ForcePlayerMonChoice: ; 3d227 and a jr z, .skip_link ld a, $1 - ld [wPlayerAction], a + ld [wBattlePlayerAction], a call LinkBattleSendReceiveAction .skip_link xor a - ld [wPlayerAction], a + ld [wBattlePlayerAction], a call CheckMobileBattleError jr c, .enemy_fainted_mobile_error - ld hl, EnemyMonHP + ld hl, wEnemyMonHP ld a, [hli] or [hl] jr nz, .send_out_pokemon @@ -2816,10 +2816,10 @@ ForcePlayerMonChoice: ; 3d227 .send_out_pokemon call ClearSprites - ld a, [CurBattleMon] - ld [LastPlayerMon], a - ld a, [CurPartyMon] - ld [CurBattleMon], a + ld a, [wCurBattleMon] + ld [wLastPlayerMon], a + ld a, [wCurPartyMon] + ld [wCurBattleMon], a call AddBattleParticipant call InitBattleMon call ResetPlayerStatLevels @@ -2844,10 +2844,10 @@ ForcePlayerMonChoice: ; 3d227 ; 3d2b3 PlayerPartyMonEntrance: ; 3d2b3 - ld a, [CurBattleMon] - ld [LastPlayerMon], a - ld a, [CurPartyMon] - ld [CurBattleMon], a + ld a, [wCurBattleMon] + ld [wLastPlayerMon], a + ld a, [wCurPartyMon] + ld [wCurBattleMon], a call AddBattleParticipant call InitBattleMon call ResetPlayerStatLevels @@ -2918,7 +2918,7 @@ SelectBattleMon: ; 3d329 PickPartyMonInBattle: ; 3d33c .loop ld a, PARTYMENUACTION_SWITCH ; Which PKMN? - ld [PartyMenuActionText], a + ld [wPartyMenuActionText], a call JumpToPartyMenuAndPrintText call SelectBattleMon ret c @@ -2929,8 +2929,8 @@ PickPartyMonInBattle: ; 3d33c ; 3d34f SwitchMonAlreadyOut: ; 3d34f - ld hl, CurBattleMon - ld a, [CurPartyMon] + ld hl, wCurBattleMon + ld a, [wCurPartyMon] cp [hl] jr nz, .notout @@ -2985,13 +2985,13 @@ ForcePickSwitchMonInBattle: ; 3d380 LostBattle: ; 3d38e ld a, 1 - ld [BattleEnded], a + ld [wBattleEnded], a - ld a, [InBattleTowerBattle] + ld a, [wInBattleTowerBattle] bit 0, a jr nz, .battle_tower - ld a, [BattleType] + ld a, [wBattleType] cp BATTLETYPE_CANLOSE jr nz, .not_canlose @@ -3229,7 +3229,7 @@ EnemySwitch: ; 3d4e1 xor a ld [wBattleParticipantsNotFainted], a ld [wBattleParticipantsIncludingFainted], a - ld [wPlayerAction], a + ld [wBattlePlayerAction], a inc a ld [wEnemyIsSwitching], a call LoadTileMapToTempTileMap @@ -3288,10 +3288,10 @@ CheckWhetherSwitchmonIsPredetermined: ; 3d533 ResetEnemyBattleVars: ; 3d557 ; and draw empty TextBox xor a - ld [LastPlayerCounterMove], a - ld [LastEnemyCounterMove], a - ld [LastEnemyMove], a - ld [CurEnemyMove], a + ld [wLastPlayerCounterMove], a + ld [wLastEnemyCounterMove], a + ld [wLastEnemyMove], a + ld [wCurEnemyMove], a dec a ld [wEnemyItemState], a xor a @@ -3308,7 +3308,7 @@ ResetBattleParticipants: ; 3d57a ld [wBattleParticipantsNotFainted], a ld [wBattleParticipantsIncludingFainted], a AddBattleParticipant: ; 3d581 - ld a, [CurBattleMon] + ld a, [wCurBattleMon] ld c, a ld hl, wBattleParticipantsNotFainted ld b, SET_FLAG @@ -3322,21 +3322,21 @@ AddBattleParticipant: ; 3d581 FindPkmnInOTPartyToSwitchIntoBattle: ; 3d599 ld b, $ff ld a, $1 - ld [Buffer1], a - ld [Buffer2], a + ld [wBuffer1], a + ld [wBuffer2], a .loop - ld hl, Buffer1 + ld hl, wBuffer1 sla [hl] inc hl sla [hl] inc b - ld a, [OTPartyCount] + ld a, [wOTPartyCount] cp b jp z, ScoreMonTypeMatchups - ld a, [CurOTMon] + ld a, [wCurOTMon] cp b jr z, .discourage - ld hl, OTPartyMon1HP + ld hl, wOTPartyMon1HP push bc ld a, b call GetPartyLocation @@ -3351,14 +3351,14 @@ FindPkmnInOTPartyToSwitchIntoBattle: ; 3d599 jr .loop .discourage - ld hl, Buffer2 + ld hl, wBuffer2 set 0, [hl] jr .loop ; 3d5d7 LookUpTheEffectivenessOfEveryMove: ; 3d5d7 push bc - ld hl, OTPartyMon1Moves + ld hl, wOTPartyMon1Moves ld a, b call GetPartyLocation pop bc @@ -3387,7 +3387,7 @@ LookUpTheEffectivenessOfEveryMove: ; 3d5d7 ld a, [wd265] ; Get The Effectiveness Modifier cp 10 + 1 ; 1.0 + 0.1 jr c, .loop - ld hl, Buffer1 + ld hl, wBuffer1 set 0, [hl] ret .done @@ -3398,7 +3398,7 @@ IsThePlayerPkmnTypesEffectiveAgainstOTPkmn: ; 3d618 ; Calculates the effectiveness of the types of the PlayerPkmn ; against the OTPkmn push bc - ld hl, OTPartyCount + ld hl, wOTPartyCount ld a, b inc a ld c, a @@ -3409,18 +3409,18 @@ IsThePlayerPkmnTypesEffectiveAgainstOTPkmn: ; 3d618 ld hl, BaseData + BASE_TYPES ld bc, BASE_DATA_SIZE call AddNTimes - ld de, EnemyMonType + ld de, wEnemyMonType ld bc, BASE_CATCH_RATE - BASE_TYPES ld a, BANK(BaseData) call FarCopyBytes - ld a, [BattleMonType1] + ld a, [wBattleMonType1] ld [wPlayerMoveStruct + MOVE_TYPE], a call SetPlayerTurn callfar BattleCheckTypeMatchup ld a, [wd265] cp 10 + 1 ; 1.0 + 0.1 jr nc, .super_effective - ld a, [BattleMonType2] + ld a, [wBattleMonType2] ld [wPlayerMoveStruct + MOVE_TYPE], a callfar BattleCheckTypeMatchup ld a, [wd265] @@ -3431,7 +3431,7 @@ IsThePlayerPkmnTypesEffectiveAgainstOTPkmn: ; 3d618 .super_effective pop bc - ld hl, Buffer1 + ld hl, wBuffer1 bit 0, [hl] jr nz, .reset inc hl @@ -3445,12 +3445,12 @@ IsThePlayerPkmnTypesEffectiveAgainstOTPkmn: ; 3d618 ScoreMonTypeMatchups: ; 3d672 .loop1 - ld hl, Buffer1 + ld hl, wBuffer1 sla [hl] inc hl sla [hl] jr nc, .loop1 - ld a, [OTPartyCount] + ld a, [wOTPartyCount] ld b, a ld c, [hl] .loop2 @@ -3461,7 +3461,7 @@ ScoreMonTypeMatchups: ; 3d672 jr .loop2 .okay - ld a, [Buffer1] + ld a, [wBuffer1] and a jr z, .okay2 ld b, $ff @@ -3474,7 +3474,7 @@ ScoreMonTypeMatchups: ; 3d672 .okay2 ld b, $ff - ld a, [Buffer2] + ld a, [wBuffer2] ld c, a .loop4 inc b @@ -3483,17 +3483,17 @@ ScoreMonTypeMatchups: ; 3d672 jr .quit .loop5 - ld a, [OTPartyCount] + ld a, [wOTPartyCount] ld b, a call BattleRandom and $7 cp b jr nc, .loop5 ld b, a - ld a, [CurOTMon] + ld a, [wCurOTMon] cp b jr z, .loop5 - ld hl, OTPartyMon1HP + ld hl, wOTPartyMon1HP push bc ld a, b call GetPartyLocation @@ -3511,35 +3511,35 @@ ScoreMonTypeMatchups: ; 3d672 LoadEnemyPkmnToSwitchTo: ; 3d6ca ; 'b' contains the PartyNr of the Pkmn the AI will switch to ld a, b - ld [CurPartyMon], a - ld hl, OTPartyMon1Level + ld [wCurPartyMon], a + ld hl, wOTPartyMon1Level call GetPartyLocation ld a, [hl] - ld [CurPartyLevel], a - ld a, [CurPartyMon] + ld [wCurPartyLevel], a + ld a, [wCurPartyMon] inc a - ld hl, OTPartyCount + ld hl, wOTPartyCount ld c, a ld b, 0 add hl, bc ld a, [hl] - ld [TempEnemyMonSpecies], a - ld [CurPartySpecies], a + ld [wTempEnemyMonSpecies], a + ld [wCurPartySpecies], a call LoadEnemyMon - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] cp UNOWN jr nz, .skip_unown ld a, [wFirstUnownSeen] and a jr nz, .skip_unown - ld hl, EnemyMonDVs + ld hl, wEnemyMonDVs predef GetUnownLetter - ld a, [UnownLetter] + ld a, [wUnownLetter] ld [wFirstUnownSeen], a .skip_unown - ld hl, EnemyMonHP + ld hl, wEnemyMonHP ld a, [hli] ld [wEnemyHPAtTimeOfPlayerSwitch], a ld a, [hl] @@ -3551,23 +3551,23 @@ CheckWhetherToAskSwitch: ; 3d714 ld a, [wBattleHasJustStarted] dec a jp z, .return_nc - ld a, [PartyCount] + ld a, [wPartyCount] dec a jp z, .return_nc ld a, [wLinkMode] and a jp nz, .return_nc - ld a, [Options] + ld a, [wOptions] bit BATTLE_SHIFT, a jr nz, .return_nc - ld a, [CurPartyMon] + ld a, [wCurPartyMon] push af - ld a, [CurBattleMon] - ld [CurPartyMon], a + ld a, [wCurBattleMon] + ld [wCurPartyMon], a farcall CheckCurPartyMonFainted pop bc ld a, b - ld [CurPartyMon], a + ld [wCurPartyMon], a jr c, .return_nc scf ret @@ -3578,7 +3578,7 @@ CheckWhetherToAskSwitch: ; 3d714 ; 3d74b OfferSwitch: ; 3d74b - ld a, [CurPartyMon] + ld a, [wCurPartyMon] push af callfar Battle_GetTrainerName ld hl, BattleText_EnemyIsAboutToUseWillPlayerChangePkmn @@ -3591,18 +3591,18 @@ OfferSwitch: ; 3d74b call SetUpBattlePartyMenu_NoLoop call PickSwitchMonInBattle jr c, .canceled_switch - ld a, [CurBattleMon] - ld [LastPlayerMon], a - ld a, [CurPartyMon] - ld [CurBattleMon], a + ld a, [wCurBattleMon] + ld [wLastPlayerMon], a + ld a, [wCurPartyMon] + ld [wCurBattleMon], a call ClearPalettes call DelayFrame call _LoadHPBar pop af - ld [CurPartyMon], a + ld [wCurPartyMon], a xor a - ld [CurEnemyMove], a - ld [CurPlayerMove], a + ld [wCurEnemyMove], a + ld [wCurPlayerMove], a and a ret @@ -3613,7 +3613,7 @@ OfferSwitch: ; 3d74b .said_no pop af - ld [CurPartyMon], a + ld [wCurPartyMon], a scf ret ; 3d7a0 @@ -3638,12 +3638,12 @@ Function_BattleTextEnemySentOut: ; 3d7b8 ; 3d7c7 Function_SetEnemyPkmnAndSendOutAnimation: ; 3d7c7 - ld a, [TempEnemyMonSpecies] - ld [CurPartySpecies], a - ld [CurSpecies], a + ld a, [wTempEnemyMonSpecies] + ld [wCurPartySpecies], a + ld [wCurSpecies], a call GetBaseData ld a, OTPARTYMON - ld [MonType], a + ld [wMonType], a predef CopyPkmnToTempMon call GetEnemyMonFrontpic @@ -3662,7 +3662,7 @@ Function_SetEnemyPkmnAndSendOutAnimation: ; 3d7c7 call Call_PlayBattleAnim .not_shiny - ld bc, TempMonSpecies + ld bc, wTempMonSpecies farcall CheckFaintedFrzSlp jr c, .skip_cry farcall CheckBattleScene @@ -3675,8 +3675,8 @@ Function_SetEnemyPkmnAndSendOutAnimation: ; 3d7c7 .cry_no_anim ld a, $f - ld [CryTracks], a - ld a, [TempEnemyMonSpecies] + ld [wCryTracks], a + ld a, [wTempEnemyMonSpecies] call PlayStereoCry .skip_cry @@ -3688,24 +3688,24 @@ Function_SetEnemyPkmnAndSendOutAnimation: ; 3d7c7 NewEnemyMonStatus: ; 3d834 xor a - ld [LastPlayerCounterMove], a - ld [LastEnemyCounterMove], a - ld [LastEnemyMove], a - ld hl, EnemySubStatus1 + ld [wLastPlayerCounterMove], a + ld [wLastEnemyCounterMove], a + ld [wLastEnemyMove], a + ld hl, wEnemySubStatus1 rept 4 ld [hli], a endr ld [hl], a - ld [EnemyDisableCount], a - ld [EnemyFuryCutterCount], a - ld [EnemyProtectCount], a + ld [wEnemyDisableCount], a + ld [wEnemyFuryCutterCount], a + ld [wEnemyProtectCount], a ld [wEnemyRageCounter], a - ld [EnemyDisabledMove], a + ld [wEnemyDisabledMove], a ld [wEnemyMinimized], a ld [wPlayerWrapCount], a ld [wEnemyWrapCount], a - ld [EnemyTurnsTaken], a - ld hl, PlayerSubStatus5 + ld [wEnemyTurnsTaken], a + ld hl, wPlayerSubStatus5 res SUBSTATUS_CANT_RUN, [hl] ret ; 3d867 @@ -3713,7 +3713,7 @@ endr ResetEnemyStatLevels: ; 3d867 ld a, BASE_STAT_LEVEL ld b, NUM_LEVEL_STATS - ld hl, EnemyStatLevels + ld hl, wEnemyStatLevels .loop ld [hli], a dec b @@ -3723,11 +3723,11 @@ ResetEnemyStatLevels: ; 3d867 CheckPlayerPartyForFitPkmn: ; 3d873 ; Has the player any Pkmn in his Party that can fight? - ld a, [PartyCount] + ld a, [wPartyCount] ld e, a xor a - ld hl, PartyMon1HP - ld bc, PartyMon2 - (PartyMon1 + 1) + ld hl, wPartyMon1HP + ld bc, wPartyMon2 - (wPartyMon1 + 1) .loop or [hl] inc hl @@ -3740,8 +3740,8 @@ CheckPlayerPartyForFitPkmn: ; 3d873 ; 3d887 CheckIfCurPartyMonIsFitToFight: ; 3d887 - ld a, [CurPartyMon] - ld hl, PartyMon1HP + ld a, [wCurPartyMon] + ld hl, wPartyMon1HP call GetPartyLocation ld a, [hli] or [hl] @@ -3750,8 +3750,8 @@ CheckIfCurPartyMonIsFitToFight: ; 3d887 ld a, [wBattleHasJustStarted] and a jr nz, .finish_fail - ld hl, PartySpecies - ld a, [CurPartyMon] + ld hl, wPartySpecies + ld a, [wCurPartyMon] ld c, a ld b, 0 add hl, bc @@ -3772,7 +3772,7 @@ CheckIfCurPartyMonIsFitToFight: ; 3d887 TryToRunAwayFromBattle: ; 3d8b3 ; Run away from battle, with or without item - ld a, [BattleType] + ld a, [wBattleType] cp BATTLETYPE_DEBUG jp z, .can_escape cp BATTLETYPE_CONTEST @@ -3794,7 +3794,7 @@ TryToRunAwayFromBattle: ; 3d8b3 dec a jp nz, .cant_run_from_trainer - ld a, [EnemySubStatus5] + ld a, [wEnemySubStatus5] bit SUBSTATUS_CANT_RUN, a jp nz, .cant_escape @@ -3804,7 +3804,7 @@ TryToRunAwayFromBattle: ; 3d8b3 push hl push de - ld a, [BattleMonItem] + ld a, [wBattleMonItem] ld [wd265], a ld b, a callfar GetItemHeldEffect @@ -3883,7 +3883,7 @@ TryToRunAwayFromBattle: ; 3d8b3 cp b jr nc, .can_escape ld a, $1 - ld [wPlayerAction], a + ld [wBattlePlayerAction], a ld hl, BattleText_CantEscape2 jr .print_inescapable_text @@ -3909,11 +3909,11 @@ TryToRunAwayFromBattle: ; 3d8b3 jr z, .fled call LoadTileMapToTempTileMap xor a - ld [wPlayerAction], a + ld [wBattlePlayerAction], a ld a, $f - ld [CurMoveNum], a + ld [wCurMoveNum], a xor a - ld [CurPlayerMove], a + ld [wCurPlayerMove], a call LinkBattleSendReceiveAction call Call_LoadTempTileMapToTileMap call CheckMobileBattleError @@ -3962,37 +3962,37 @@ TryToRunAwayFromBattle: ; 3d8b3 InitBattleMon: ; 3da0d ld a, MON_SPECIES call GetPartyParamLocation - ld de, BattleMonSpecies + ld de, wBattleMonSpecies ld bc, MON_ID call CopyBytes ld bc, MON_DVS - MON_ID add hl, bc - ld de, BattleMonDVs + ld de, wBattleMonDVs ld bc, MON_PKRUS - MON_DVS call CopyBytes inc hl inc hl inc hl - ld de, BattleMonLevel + ld de, wBattleMonLevel ld bc, PARTYMON_STRUCT_LENGTH - MON_LEVEL call CopyBytes - ld a, [BattleMonSpecies] - ld [TempBattleMonSpecies], a - ld [CurPartySpecies], a - ld [CurSpecies], a + ld a, [wBattleMonSpecies] + ld [wTempBattleMonSpecies], a + ld [wCurPartySpecies], a + ld [wCurSpecies], a call GetBaseData - ld a, [BaseType1] - ld [BattleMonType1], a - ld a, [BaseType2] - ld [BattleMonType2], a - ld hl, PartyMonNicknames - ld a, [CurBattleMon] + ld a, [wBaseType1] + ld [wBattleMonType1], a + ld a, [wBaseType2] + ld [wBattleMonType2], a + ld hl, wPartyMonNicknames + ld a, [wCurBattleMon] call SkipNames - ld de, BattleMonNick + ld de, wBattleMonNick ld bc, MON_NAME_LENGTH call CopyBytes - ld hl, BattleMonAttack - ld de, PlayerStats + ld hl, wBattleMonAttack + ld de, wPlayerStats ld bc, PARTYMON_STRUCT_LENGTH - MON_ATK call CopyBytes call ApplyStatusEffectOnPlayerStats @@ -4015,33 +4015,33 @@ BattleCheckShininess: ; 3da7c ; 3da85 GetPartyMonDVs: ; 3da85 - ld hl, BattleMonDVs - ld a, [PlayerSubStatus5] + ld hl, wBattleMonDVs + ld a, [wPlayerSubStatus5] bit SUBSTATUS_TRANSFORMED, a ret z - ld hl, PartyMon1DVs - ld a, [CurBattleMon] + ld hl, wPartyMon1DVs + ld a, [wCurBattleMon] jp GetPartyLocation ; 3da97 GetEnemyMonDVs: ; 3da97 - ld hl, EnemyMonDVs - ld a, [EnemySubStatus5] + ld hl, wEnemyMonDVs + ld a, [wEnemySubStatus5] bit SUBSTATUS_TRANSFORMED, a ret z ld hl, wEnemyBackupDVs ld a, [wBattleMode] dec a ret z - ld hl, OTPartyMon1DVs - ld a, [CurOTMon] + ld hl, wOTPartyMon1DVs + ld a, [wCurOTMon] jp GetPartyLocation ; 3dab1 ResetPlayerStatLevels: ; 3dab1 ld a, BASE_STAT_LEVEL ld b, NUM_LEVEL_STATS - ld hl, PlayerStatLevels + ld hl, wPlayerStatLevels .loop ld [hli], a dec b @@ -4050,46 +4050,46 @@ ResetPlayerStatLevels: ; 3dab1 ; 3dabd InitEnemyMon: ; 3dabd - ld a, [CurPartyMon] - ld hl, OTPartyMon1Species + ld a, [wCurPartyMon] + ld hl, wOTPartyMon1Species call GetPartyLocation - ld de, EnemyMonSpecies + ld de, wEnemyMonSpecies ld bc, MON_ID call CopyBytes ld bc, MON_DVS - MON_ID add hl, bc - ld de, EnemyMonDVs + ld de, wEnemyMonDVs ld bc, MON_PKRUS - MON_DVS call CopyBytes inc hl inc hl inc hl - ld de, EnemyMonLevel + ld de, wEnemyMonLevel ld bc, PARTYMON_STRUCT_LENGTH - MON_LEVEL call CopyBytes - ld a, [EnemyMonSpecies] - ld [CurSpecies], a + ld a, [wEnemyMonSpecies] + ld [wCurSpecies], a call GetBaseData - ld hl, OTPartyMonNicknames - ld a, [CurPartyMon] + ld hl, wOTPartyMonNicknames + ld a, [wCurPartyMon] call SkipNames - ld de, EnemyMonNick + ld de, wEnemyMonNick ld bc, MON_NAME_LENGTH call CopyBytes - ld hl, EnemyMonAttack - ld de, EnemyStats + ld hl, wEnemyMonAttack + ld de, wEnemyStats ld bc, PARTYMON_STRUCT_LENGTH - MON_ATK call CopyBytes call ApplyStatusEffectOnEnemyStats - ld hl, BaseType1 - ld de, EnemyMonType1 + ld hl, wBaseType1 + ld de, wEnemyMonType1 ld a, [hli] ld [de], a inc de ld a, [hl] ld [de], a - ld hl, BaseStats - ld de, EnemyMonBaseStats + ld hl, wBaseStats + ld de, wEnemyMonBaseStats ld b, 5 .loop ld a, [hli] @@ -4097,17 +4097,17 @@ InitEnemyMon: ; 3dabd inc de dec b jr nz, .loop - ld a, [CurPartyMon] - ld [CurOTMon], a + ld a, [wCurPartyMon] + ld [wCurOTMon], a ret ; 3db32 SwitchPlayerMon: ; 3db32 call ClearSprites - ld a, [CurBattleMon] - ld [LastPlayerMon], a - ld a, [CurPartyMon] - ld [CurBattleMon], a + ld a, [wCurBattleMon] + ld [wLastPlayerMon], a + ld a, [wCurPartyMon] + ld [wCurBattleMon], a call AddBattleParticipant call InitBattleMon call ResetPlayerStatLevels @@ -4116,14 +4116,14 @@ SwitchPlayerMon: ; 3db32 call SendOutPlayerMon call EmptyBattleTextBox call LoadTileMapToTempTileMap - ld hl, EnemyMonHP + ld hl, wEnemyMonHP ld a, [hli] or [hl] ret ; 3db5f SendOutPlayerMon: ; 3db5f - ld hl, BattleMonDVs + ld hl, wBattleMonDVs predef GetUnownLetter hlcoord 1, 5 ld b, 7 @@ -4136,12 +4136,12 @@ SendOutPlayerMon: ; 3db5f xor a ld [hGraphicStartTile], a ld [wBattleMenuCursorBuffer], a - ld [CurMoveNum], a - ld [TypeModifier], a + ld [wCurMoveNum], a + ld [wTypeModifier], a ld [wPlayerMoveStruct + MOVE_ANIM], a - ld [LastPlayerCounterMove], a - ld [LastEnemyCounterMove], a - ld [LastPlayerMove], a + ld [wLastPlayerCounterMove], a + ld [wLastEnemyCounterMove], a + ld [wLastPlayerMove], a call CheckAmuletCoin call FinishBattleAnim xor a @@ -4167,8 +4167,8 @@ SendOutPlayerMon: ; 3db5f farcall CheckFaintedFrzSlp jr c, .statused ld a, $f0 - ld [CryTracks], a - ld a, [CurPartySpecies] + ld [wCryTracks], a + ld a, [wCurPartySpecies] call PlayStereoCry .statused @@ -4180,50 +4180,50 @@ SendOutPlayerMon: ; 3db5f NewBattleMonStatus: ; 3dbde xor a - ld [LastPlayerCounterMove], a - ld [LastEnemyCounterMove], a - ld [LastPlayerMove], a - ld hl, PlayerSubStatus1 + ld [wLastPlayerCounterMove], a + ld [wLastEnemyCounterMove], a + ld [wLastPlayerMove], a + ld hl, wPlayerSubStatus1 rept 4 ld [hli], a endr ld [hl], a - ld hl, PlayerUsedMoves + ld hl, wPlayerUsedMoves ld [hli], a ld [hli], a ld [hli], a ld [hl], a - ld [PlayerDisableCount], a - ld [PlayerFuryCutterCount], a - ld [PlayerProtectCount], a + ld [wPlayerDisableCount], a + ld [wPlayerFuryCutterCount], a + ld [wPlayerProtectCount], a ld [wPlayerRageCounter], a - ld [DisabledMove], a + ld [wDisabledMove], a ld [wPlayerMinimized], a ld [wEnemyWrapCount], a ld [wPlayerWrapCount], a - ld [PlayerTurnsTaken], a - ld hl, EnemySubStatus5 + ld [wPlayerTurnsTaken], a + ld hl, wEnemySubStatus5 res SUBSTATUS_CANT_RUN, [hl] ret ; 3dc18 BreakAttraction: ; 3dc18 - ld hl, PlayerSubStatus1 + ld hl, wPlayerSubStatus1 res SUBSTATUS_IN_LOVE, [hl] - ld hl, EnemySubStatus1 + ld hl, wEnemySubStatus1 res SUBSTATUS_IN_LOVE, [hl] ret ; 3dc23 SpikesDamage: ; 3dc23 - ld hl, PlayerScreens - ld de, BattleMonType + ld hl, wPlayerScreens + ld de, wBattleMonType ld bc, UpdatePlayerHUD ld a, [hBattleTurn] and a jr z, .ok - ld hl, EnemyScreens - ld de, EnemyMonType + ld hl, wEnemyScreens + ld de, wEnemyMonType ld bc, UpdateEnemyHUD .ok @@ -4265,7 +4265,7 @@ PursuitSwitch: ; 3dc5b cp EFFECT_PURSUIT jr nz, .done - ld a, [CurBattleMon] + ld a, [wCurBattleMon] push af ld hl, DoPlayerTurn @@ -4273,8 +4273,8 @@ PursuitSwitch: ; 3dc5b and a jr z, .do_turn ld hl, DoEnemyTurn - ld a, [LastPlayerMon] - ld [CurBattleMon], a + ld a, [wLastPlayerMon] + ld [wCurBattleMon], a .do_turn ld a, BANK(DoPlayerTurn) rst FarCall @@ -4285,24 +4285,24 @@ PursuitSwitch: ; 3dc5b ld [hl], a pop af - ld [CurBattleMon], a + ld [wCurBattleMon], a ld a, [hBattleTurn] and a jr z, .check_enemy_fainted - ld a, [LastPlayerMon] + ld a, [wLastPlayerMon] call UpdateBattleMon - ld hl, BattleMonHP + ld hl, wBattleMonHP ld a, [hli] or [hl] jr nz, .done ld a, $f0 - ld [CryTracks], a - ld a, [BattleMonSpecies] + ld [wCryTracks], a + ld a, [wBattleMonSpecies] call PlayStereoCry - ld a, [LastPlayerMon] + ld a, [wLastPlayerMon] ld c, a ld hl, wBattleParticipantsNotFainted ld b, RESET_FLAG @@ -4312,7 +4312,7 @@ PursuitSwitch: ; 3dc5b jr .done_fainted .check_enemy_fainted - ld hl, EnemyMonHP + ld hl, wEnemyMonHP ld a, [hli] or [hl] jr nz, .done @@ -4378,26 +4378,26 @@ HandleHPHealingItem: ; 3dd2f ld a, b cp HELD_BERRY ret nz - ld de, EnemyMonHP + 1 - ld hl, EnemyMonMaxHP + ld de, wEnemyMonHP + 1 + ld hl, wEnemyMonMaxHP ld a, [hBattleTurn] and a jr z, .go - ld de, BattleMonHP + 1 - ld hl, BattleMonMaxHP + ld de, wBattleMonHP + 1 + ld hl, wBattleMonMaxHP .go ; If, and only if, Pokemon's HP is less than half max, use the item. ; Store current HP in Buffer 3/4 push bc ld a, [de] - ld [Buffer3], a + ld [wBuffer3], a add a ld c, a dec de ld a, [de] inc de - ld [Buffer4], a + ld [wBuffer4], a adc a ld b, a ld a, b @@ -4416,19 +4416,19 @@ HandleHPHealingItem: ; 3dd2f .less call ItemRecoveryAnim - ; store max HP in Buffer1/2 + ; store max HP in wBuffer1/2 ld a, [hli] - ld [Buffer2], a + ld [wBuffer2], a ld a, [hl] - ld [Buffer1], a + ld [wBuffer1], a ld a, [de] add c - ld [Buffer5], a + ld [wBuffer5], a ld c, a dec de ld a, [de] adc $0 - ld [Buffer6], a + ld [wBuffer6], a ld b, a ld a, [hld] cp c @@ -4436,15 +4436,15 @@ HandleHPHealingItem: ; 3dd2f sbc b jr nc, .okay ld a, [hli] - ld [Buffer6], a + ld [wBuffer6], a ld a, [hl] - ld [Buffer5], a + ld [wBuffer5], a .okay - ld a, [Buffer6] + ld a, [wBuffer6] ld [de], a inc de - ld a, [Buffer5] + ld a, [wBuffer5] ld [de], a ld a, [hBattleTurn] ld [wWhichHPBar], a @@ -4473,11 +4473,11 @@ ItemRecoveryAnim: ; 3ddc8 push bc call EmptyBattleTextBox ld a, RECOVER - ld [FXAnimID], a + ld [wFXAnimID], a call SwitchTurnCore xor a ld [wNumHits], a - ld [FXAnimID + 1], a + ld [wFXAnimID + 1], a predef PlayBattleAnim call SwitchTurnCore pop bc @@ -4646,7 +4646,7 @@ HandleStatBoostingHeldItems: ; 3de97 rst FarCall pop bc pop de - ld a, [FailedMessage] + ld a, [wFailedMessage] and a ret nz xor a @@ -4676,18 +4676,18 @@ HandleStatBoostingHeldItems: ; 3de97 ; 3df12 GetPartymonItem: ; 3df12 - ld hl, PartyMon1Item - ld a, [CurBattleMon] + ld hl, wPartyMon1Item + ld a, [wCurBattleMon] call GetPartyLocation - ld bc, BattleMonItem + ld bc, wBattleMonItem ret ; 3df1f GetOTPartymonItem: ; 3df1f - ld hl, OTPartyMon1Item - ld a, [CurOTMon] + ld hl, wOTPartyMon1Item + ld a, [wCurOTMon] call GetPartyLocation - ld bc, EnemyMonItem + ld bc, wEnemyMonItem ret ; 3df2c @@ -4696,11 +4696,11 @@ UpdateBattleHUDs: ; 3df2c push de push bc call DrawPlayerHUD - ld hl, PlayerHPPal + ld hl, wPlayerHPPal call SetHPPal call CheckDanger call DrawEnemyHUD - ld hl, EnemyHPPal + ld hl, wEnemyHPPal call SetHPPal pop bc pop de @@ -4740,19 +4740,19 @@ DrawPlayerHUD: ; 3df58 hlcoord 10, 9 ld b, 1 xor a ; PARTYMON - ld [MonType], a + ld [wMonType], a predef DrawPlayerHP ; Exp bar push de - ld a, [CurBattleMon] - ld hl, PartyMon1Exp + 2 + ld a, [wCurBattleMon] + ld hl, wPartyMon1Exp + 2 call GetPartyLocation ld d, h ld e, l hlcoord 10, 11 - ld a, [TempMonLevel] + ld a, [wTempMonLevel] ld b, a call FillInExpBar pop de @@ -4760,29 +4760,29 @@ DrawPlayerHUD: ; 3df58 ; 3df98 UpdatePlayerHPPal: ; 3df98 - ld hl, PlayerHPPal + ld hl, wPlayerHPPal jp UpdateHPPal ; 3df9e CheckDanger: ; 3df9e - ld hl, BattleMonHP + ld hl, wBattleMonHP ld a, [hli] or [hl] jr z, .no_danger - ld a, [wDanger] + ld a, [wBattleLowHealthAlarm] and a jr nz, .done - ld a, [PlayerHPPal] + ld a, [wPlayerHPPal] cp HP_RED jr z, .danger .no_danger - ld hl, Danger + ld hl, wLowHealthAlarm res DANGER_ON_F, [hl] jr .done .danger - ld hl, Danger + ld hl, wLowHealthAlarm set DANGER_ON_F, [hl] .done @@ -4790,39 +4790,39 @@ CheckDanger: ; 3df9e ; 3dfbf PrintPlayerHUD: ; 3dfbf - ld de, BattleMonNick + ld de, wBattleMonNick hlcoord 10, 7 call ret_3e138 call PlaceString push bc - ld a, [CurBattleMon] - ld hl, PartyMon1DVs + ld a, [wCurBattleMon] + ld hl, wPartyMon1DVs call GetPartyLocation - ld de, TempMonDVs + ld de, wTempMonDVs ld a, [hli] ld [de], a inc de ld a, [hl] ld [de], a - ld hl, BattleMonLevel - ld de, TempMonLevel + ld hl, wBattleMonLevel + ld de, wTempMonLevel ld bc, $11 call CopyBytes - ld a, [CurBattleMon] - ld hl, PartyMon1Species + ld a, [wCurBattleMon] + ld hl, wPartyMon1Species call GetPartyLocation ld a, [hl] - ld [CurPartySpecies], a - ld [CurSpecies], a + ld [wCurPartySpecies], a + ld [wCurSpecies], a call GetBaseData pop hl dec hl ld a, TEMPMON - ld [MonType], a + ld [wMonType], a callfar GetGender ld a, " " jr c, .got_gender_char @@ -4836,7 +4836,7 @@ PrintPlayerHUD: ; 3dfbf hlcoord 14, 8 push af ; back up gender push hl - ld de, BattleMonStatus + ld de, wBattleMonStatus predef PlaceNonFaintStatus pop hl pop bc @@ -4847,8 +4847,8 @@ PrintPlayerHUD: ; 3dfbf dec hl ; genderless .copy_level - ld a, [BattleMonLevel] - ld [TempMonLevel], a + ld a, [wBattleMonLevel] + ld [wTempMonLevel], a jp PrintLevel ; 3e036 @@ -4874,11 +4874,11 @@ DrawEnemyHUD: ; 3e043 farcall DrawEnemyHUDBorder - ld a, [TempEnemyMonSpecies] - ld [CurSpecies], a - ld [CurPartySpecies], a + ld a, [wTempEnemyMonSpecies] + ld [wCurSpecies], a + ld [wCurPartySpecies], a call GetBaseData - ld de, EnemyMonNick + ld de, wEnemyMonNick hlcoord 1, 0 call ret_3e138 call PlaceString @@ -4886,9 +4886,9 @@ DrawEnemyHUD: ; 3e043 ld l, c dec hl - ld hl, EnemyMonDVs - ld de, TempMonDVs - ld a, [EnemySubStatus5] + ld hl, wEnemyMonDVs + ld de, wTempMonDVs + ld a, [wEnemySubStatus5] bit SUBSTATUS_TRANSFORMED, a jr z, .ok ld hl, wEnemyBackupDVs @@ -4900,7 +4900,7 @@ DrawEnemyHUD: ; 3e043 ld [de], a ld a, TEMPMON - ld [MonType], a + ld [wMonType], a callfar GetGender ld a, " " jr c, .got_gender @@ -4915,7 +4915,7 @@ DrawEnemyHUD: ; 3e043 hlcoord 6, 1 push af push hl - ld de, EnemyMonStatus + ld de, wEnemyMonStatus predef PlaceNonFaintStatus pop hl pop bc @@ -4925,12 +4925,12 @@ DrawEnemyHUD: ; 3e043 jr nz, .print_level dec hl .print_level - ld a, [EnemyMonLevel] - ld [TempMonLevel], a + ld a, [wEnemyMonLevel] + ld [wTempMonLevel], a call PrintLevel .skip_level - ld hl, EnemyMonHP + ld hl, wEnemyMonHP ld a, [hli] ld [hMultiplicand + 1], a ld a, [hld] @@ -4949,7 +4949,7 @@ DrawEnemyHUD: ; 3e043 ld a, HP_BAR_LENGTH_PX ld [hMultiplier], a call Multiply - ld hl, EnemyMonMaxHP + ld hl, wEnemyMonMaxHP ld a, [hli] ld b, a ld a, [hl] @@ -4998,7 +4998,7 @@ DrawEnemyHUD: ; 3e043 ; 3e127 UpdateEnemyHPPal: ; 3e127 - ld hl, EnemyHPPal + ld hl, wEnemyHPPal call UpdateHPPal ret ; 3e12e @@ -5021,7 +5021,7 @@ BattleMenu: ; 3e139 ld [hBGMapMode], a call LoadTempTileMapToTileMap - ld a, [BattleType] + ld a, [wBattleType] cp BATTLETYPE_DEBUG jr z, .ok cp BATTLETYPE_TUTORIAL @@ -5033,7 +5033,7 @@ BattleMenu: ; 3e139 .ok .loop - ld a, [BattleType] + ld a, [wBattleType] cp BATTLETYPE_CONTEST jr nz, .not_contest farcall ContestBattleMenu @@ -5041,7 +5041,7 @@ BattleMenu: ; 3e139 .not_contest ; Auto input: choose "ITEM" - ld a, [InputType] + ld a, [wInputType] or a jr z, .skip_dude_pack_select farcall _DudeAutoInput_DownA @@ -5103,20 +5103,20 @@ BattleMenu_Pack: ; 3e1c7 and a jp nz, .ItemsCantBeUsed - ld a, [InBattleTowerBattle] + ld a, [wInBattleTowerBattle] and a jp nz, .ItemsCantBeUsed call LoadStandardMenuDataHeader - ld a, [BattleType] + ld a, [wBattleType] cp BATTLETYPE_TUTORIAL jr z, .tutorial cp BATTLETYPE_CONTEST jr z, .contest farcall BattlePack - ld a, [wPlayerAction] + ld a, [wBattlePlayerAction] and a jr z, .didnt_use_item jr .got_item @@ -5124,13 +5124,13 @@ BattleMenu_Pack: ; 3e1c7 .tutorial farcall TutorialPack ld a, POKE_BALL - ld [CurItem], a + ld [wCurItem], a call DoItemEffect jr .got_item .contest ld a, PARK_BALL - ld [CurItem], a + ld [wCurItem], a call DoItemEffect .got_item @@ -5171,7 +5171,7 @@ BattleMenu_Pack: ; 3e1c7 ld [hBGMapMode], a call _LoadBattleFontsHPBar call ClearSprites - ld a, [BattleType] + ld a, [wBattleType] cp BATTLETYPE_TUTORIAL jr z, .tutorial2 call GetBattleMonBackpic @@ -5210,7 +5210,7 @@ BattleMenuPKMN_ReturnFromStats: BattleMenuPKMN_Loop: call SetUpBattlePartyMenu xor a - ld [PartyMenuActionText], a + ld [wPartyMenuActionText], a call JumpToPartyMenuAndPrintText call SelectBattleMon jr c, .Cancel @@ -5280,7 +5280,7 @@ Battle_StatsScreen: ; 3e308 call ClearSprites call LowVolume xor a ; PARTYMON - ld [MonType], a + ld [wMonType], a farcall BattleStatsScreenInit call MaxVolume @@ -5301,9 +5301,9 @@ Battle_StatsScreen: ; 3e308 ; 3e358 TryPlayerSwitch: ; 3e358 - ld a, [CurBattleMon] + ld a, [wCurBattleMon] ld d, a - ld a, [CurPartyMon] + ld a, [wCurPartyMon] cp d jr nz, .check_trapped ld hl, BattleText_PkmnIsAlreadyOut @@ -5314,7 +5314,7 @@ TryPlayerSwitch: ; 3e358 ld a, [wPlayerWrapCount] and a jr nz, .trapped - ld a, [EnemySubStatus5] + ld a, [wEnemySubStatus5] bit SUBSTATUS_CANT_RUN, a jr z, .try_switch @@ -5326,10 +5326,10 @@ TryPlayerSwitch: ; 3e358 .try_switch call CheckIfCurPartyMonIsFitToFight jp z, BattleMenuPKMN_Loop - ld a, [CurBattleMon] - ld [LastPlayerMon], a + ld a, [wCurBattleMon] + ld [wLastPlayerMon], a ld a, $2 - ld [wPlayerAction], a + ld [wBattlePlayerAction], a call ClearPalettes call DelayFrame call ClearSprites @@ -5337,8 +5337,8 @@ TryPlayerSwitch: ; 3e358 call CloseWindow call GetMemSGBLayout call SetPalettes - ld a, [CurPartyMon] - ld [CurBattleMon], a + ld a, [wCurPartyMon] + ld [wCurBattleMon], a PlayerSwitch: ; 3e3ad ld a, 1 ld [wPlayerIsSwitching], a @@ -5401,7 +5401,7 @@ BattleMonEntrance: ; 3e40b ld c, 50 call DelayFrames - ld hl, PlayerSubStatus4 + ld hl, wPlayerSubStatus4 res SUBSTATUS_RAGE, [hl] call SetEnemyTurn @@ -5414,8 +5414,8 @@ BattleMonEntrance: ; 3e40b lb bc, 5, 11 call ClearBox - ld a, [CurBattleMon] - ld [CurPartyMon], a + ld a, [wCurBattleMon] + ld [wCurPartyMon], a call AddBattleParticipant call InitBattleMon call ResetPlayerStatLevels @@ -5440,8 +5440,8 @@ PassedBattleMonEntrance: ; 3e459 lb bc, 5, 11 call ClearBox - ld a, [CurPartyMon] - ld [CurBattleMon], a + ld a, [wCurPartyMon] + ld [wCurBattleMon], a call AddBattleParticipant call InitBattleMon xor a @@ -5458,20 +5458,20 @@ BattleMenu_Run: ; 3e489 call Call_LoadTempTileMapToTileMap ld a, $3 ld [wMenuCursorY], a - ld hl, BattleMonSpeed - ld de, EnemyMonSpeed + ld hl, wBattleMonSpeed + ld de, wEnemyMonSpeed call TryToRunAwayFromBattle ld a, $0 ld [wFailedToFlee], a ret c - ld a, [wPlayerAction] + ld a, [wBattlePlayerAction] and a ret nz jp BattleMenu ; 3e4a8 CheckAmuletCoin: ; 3e4a8 - ld a, [BattleMonItem] + ld a, [wBattleMonItem] ld b, a callfar GetItemHeldEffect ld a, b @@ -5489,7 +5489,7 @@ MoveSelectionScreen: ; 3e4bc ret .not_mobile - ld hl, EnemyMonMoves + ld hl, wEnemyMonMoves ld a, [wMoveSelectionMenuType] dec a jr z, .got_menu_type @@ -5497,7 +5497,7 @@ MoveSelectionScreen: ; 3e4bc jr z, .ether_elixer_menu call CheckPlayerHasUsableMoves ret z ; use Struggle - ld hl, BattleMonMoves + ld hl, wBattleMonMoves jr .got_menu_type .ether_elixer_menu @@ -5530,7 +5530,7 @@ MoveSelectionScreen: ; 3e4bc hlcoord 6, 17 - NUM_MOVES - 4 .got_start_coord ld a, SCREEN_WIDTH - ld [Buffer1], a + ld [wBuffer1], a predef ListMoves ld b, 5 @@ -5548,7 +5548,7 @@ MoveSelectionScreen: ; 3e4bc ld a, [wMoveSelectionMenuType] cp $1 jr z, .skip_inc - ld a, [CurMoveNum] + ld a, [wCurMoveNum] inc a .skip_inc @@ -5634,7 +5634,7 @@ MoveSelectionScreen: ; 3e4bc .not_enemy_moves_process_b dec a ld a, b - ld [CurMoveNum], a + ld [wCurMoveNum], a jr nz, .use_move pop af @@ -5644,7 +5644,7 @@ MoveSelectionScreen: ; 3e4bc pop af ret nz - ld hl, BattleMonPP + ld hl, wBattleMonPP ld a, [wMenuCursorY] ld c, a ld b, 0 @@ -5652,7 +5652,7 @@ MoveSelectionScreen: ; 3e4bc ld a, [hl] and PP_MASK jr z, .no_pp_left - ld a, [PlayerDisableCount] + ld a, [wPlayerDisableCount] swap a and $f dec a @@ -5662,14 +5662,14 @@ MoveSelectionScreen: ; 3e4bc and a jr nz, .skip2 ld a, [wMenuCursorY] - ld hl, BattleMonMoves + ld hl, wBattleMonMoves ld c, a ld b, 0 add hl, bc ld a, [hl] .skip2 - ld [CurPlayerMove], a + ld [wCurPlayerMove], a xor a ret @@ -5717,11 +5717,11 @@ MoveSelectionScreen: ; 3e4bc ld a, [wMoveSwapBuffer] and a jr z, .start_swap - ld hl, BattleMonMoves + ld hl, wBattleMonMoves call .swap_bytes - ld hl, BattleMonPP + ld hl, wBattleMonPP call .swap_bytes - ld hl, PlayerDisableCount + ld hl, wPlayerDisableCount ld a, [hl] swap a and $f @@ -5752,11 +5752,11 @@ MoveSelectionScreen: ; 3e4bc .swap_moves_in_party_struct ; Fixes the COOLTRAINER glitch - ld a, [PlayerSubStatus5] + ld a, [wPlayerSubStatus5] bit SUBSTATUS_TRANSFORMED, a jr nz, .transformed - ld hl, PartyMon1Moves - ld a, [CurBattleMon] + ld hl, wPartyMon1Moves + ld a, [wCurBattleMon] call GetPartyLocation push hl call .swap_bytes @@ -5808,7 +5808,7 @@ MoveInfoBox: ; 3e6c8 call TextBox call MobileTextBorder - ld a, [PlayerDisableCount] + ld a, [wPlayerDisableCount] and a jr z, .not_disabled @@ -5828,29 +5828,29 @@ MoveInfoBox: ; 3e6c8 ld hl, wMenuCursorY dec [hl] call SetPlayerTurn - ld hl, BattleMonMoves + ld hl, wBattleMonMoves ld a, [wMenuCursorY] ld c, a ld b, 0 add hl, bc ld a, [hl] - ld [CurPlayerMove], a + ld [wCurPlayerMove], a - ld a, [CurBattleMon] - ld [CurPartyMon], a + ld a, [wCurBattleMon] + ld [wCurPartyMon], a ld a, WILDMON - ld [MonType], a + ld [wMonType], a callfar GetMaxPPOfMove ld hl, wMenuCursorY ld c, [hl] inc [hl] ld b, 0 - ld hl, BattleMonPP + ld hl, wBattleMonPP add hl, bc ld a, [hl] and PP_MASK - ld [StringBuffer1], a + ld [wStringBuffer1], a call .PrintPP hlcoord 1, 9 @@ -5884,7 +5884,7 @@ MoveInfoBox: ; 3e6c8 hlcoord 5, 11 .ok push hl - ld de, StringBuffer1 + ld de, wStringBuffer1 lb bc, 1, 2 call PrintNum pop hl @@ -5900,10 +5900,10 @@ MoveInfoBox: ; 3e6c8 CheckPlayerHasUsableMoves: ; 3e786 ld a, STRUGGLE - ld [CurPlayerMove], a - ld a, [PlayerDisableCount] + ld [wCurPlayerMove], a + ld a, [wPlayerDisableCount] and a - ld hl, BattleMonPP + ld hl, wBattleMonPP jr nz, .disabled ld a, [hli] @@ -5955,7 +5955,7 @@ ParseEnemyAction: ; 3e7c1 jr z, .not_linked call EmptyBattleTextBox call LoadTileMapToTempTileMap - ld a, [wPlayerAction] + ld a, [wBattlePlayerAction] and a call z, LinkBattleSendReceiveAction call Call_LoadTempTileMapToTileMap @@ -5966,30 +5966,30 @@ ParseEnemyAction: ; 3e7c1 jp z, .battle_action_d cp BATTLEACTION_SWITCH1 jp nc, ResetVarsForSubstatusRage - ld [CurEnemyMoveNum], a + ld [wCurEnemyMoveNum], a ld c, a - ld a, [EnemySubStatus1] + ld a, [wEnemySubStatus1] bit SUBSTATUS_ROLLOUT, a jp nz, .skip_load - ld a, [EnemySubStatus3] + ld a, [wEnemySubStatus3] and 1 << SUBSTATUS_CHARGED | 1 << SUBSTATUS_RAMPAGE | 1 << SUBSTATUS_BIDE jp nz, .skip_load - ld hl, EnemySubStatus5 + ld hl, wEnemySubStatus5 bit SUBSTATUS_ENCORED, [hl] - ld a, [LastEnemyMove] + ld a, [wLastEnemyMove] jp nz, .finish - ld hl, EnemyMonMoves + ld hl, wEnemyMonMoves ld b, 0 add hl, bc ld a, [hl] jp .finish .not_linked - ld hl, EnemySubStatus5 + ld hl, wEnemySubStatus5 bit SUBSTATUS_ENCORED, [hl] jr z, .skip_encore - ld a, [LastEnemyMove] + ld a, [wLastEnemyMove] jp .finish .skip_encore @@ -6002,14 +6002,14 @@ ParseEnemyAction: ; 3e7c1 jr .finish .continue - ld hl, EnemyMonMoves - ld de, EnemyMonPP + ld hl, wEnemyMonMoves + ld de, wEnemyMonPP ld b, NUM_MOVES .loop ld a, [hl] and a jp z, .struggle - ld a, [EnemyDisabledMove] + ld a, [wEnemyDisabledMove] cp [hl] jr z, .disabled ld a, [de] @@ -6029,13 +6029,13 @@ ParseEnemyAction: ; 3e7c1 jr nz, .skip_load ; wild .loop2 - ld hl, EnemyMonMoves + ld hl, wEnemyMonMoves call BattleRandom maskbits NUM_MOVES ld c, a ld b, 0 add hl, bc - ld a, [EnemyDisableCount] + ld a, [wEnemyDisableCount] swap a and $f dec a @@ -6044,18 +6044,18 @@ ParseEnemyAction: ; 3e7c1 ld a, [hl] and a jr z, .loop2 - ld hl, EnemyMonPP + ld hl, wEnemyMonPP add hl, bc ld b, a ld a, [hl] and PP_MASK jr z, .loop2 ld a, c - ld [CurEnemyMoveNum], a + ld [wCurEnemyMoveNum], a ld a, b .finish - ld [CurEnemyMove], a + ld [wCurEnemyMove], a .skip_load call SetEnemyTurn @@ -6070,13 +6070,13 @@ ParseEnemyAction: ; 3e7c1 cp EFFECT_FURY_CUTTER jr z, .fury_cutter xor a - ld [EnemyFuryCutterCount], a + ld [wEnemyFuryCutterCount], a .fury_cutter ld a, [wEnemyMoveStruct + MOVE_EFFECT] cp EFFECT_RAGE jr z, .no_rage - ld hl, EnemySubStatus4 + ld hl, wEnemySubStatus4 res SUBSTATUS_RAGE, [hl] xor a ld [wEnemyRageCounter], a @@ -6088,7 +6088,7 @@ ParseEnemyAction: ; 3e7c1 cp EFFECT_ENDURE ret z xor a - ld [EnemyProtectCount], a + ld [wEnemyProtectCount], a ret .struggle @@ -6098,25 +6098,25 @@ ParseEnemyAction: ; 3e7c1 ResetVarsForSubstatusRage: ; 3e8c1 xor a - ld [EnemyFuryCutterCount], a - ld [EnemyProtectCount], a + ld [wEnemyFuryCutterCount], a + ld [wEnemyProtectCount], a ld [wEnemyRageCounter], a - ld hl, EnemySubStatus4 + ld hl, wEnemySubStatus4 res SUBSTATUS_RAGE, [hl] ret ; 3e8d1 CheckEnemyLockedIn: ; 3e8d1 - ld a, [EnemySubStatus4] + ld a, [wEnemySubStatus4] and 1 << SUBSTATUS_RECHARGE ret nz - ld hl, EnemySubStatus3 + ld hl, wEnemySubStatus3 ld a, [hl] and 1 << SUBSTATUS_CHARGED | 1 << SUBSTATUS_RAMPAGE | 1 << SUBSTATUS_BIDE ret nz - ld hl, EnemySubStatus1 + ld hl, wEnemySubStatus1 bit SUBSTATUS_ROLLOUT, [hl] ret ; 3e8e4 @@ -6128,15 +6128,15 @@ LinkBattleSendReceiveAction: ; 3e8e4 LoadEnemyMon: ; 3e8eb ; Initialize enemy monster parameters -; To do this we pull the species from TempEnemyMonSpecies +; To do this we pull the species from wTempEnemyMonSpecies ; Notes: ; BattleRandom is used to ensure sync between Game Boys -; Clear the whole EnemyMon struct +; Clear the whole enemy mon struct (wEnemyMon) xor a - ld hl, EnemyMonSpecies - ld bc, EnemyMonEnd - EnemyMon + ld hl, wEnemyMonSpecies + ld bc, wEnemyMonEnd - wEnemyMon call ByteFill ; We don't need to be here if we're in a link battle @@ -6145,15 +6145,15 @@ LoadEnemyMon: ; 3e8eb jp nz, InitEnemyMon ; and also not in a BattleTower-Battle - ld a, [InBattleTowerBattle] ; ???? + ld a, [wInBattleTowerBattle] ; ???? bit 0, a jp nz, InitEnemyMon ; Make sure everything knows what species we're working with - ld a, [TempEnemyMonSpecies] - ld [EnemyMonSpecies], a - ld [CurSpecies], a - ld [CurPartySpecies], a + ld a, [wTempEnemyMonSpecies] + ld [wEnemyMonSpecies], a + ld [wCurSpecies], a + ld [wCurPartySpecies], a ; Grab the BaseData for this species call GetBaseData @@ -6166,9 +6166,9 @@ LoadEnemyMon: ; 3e8eb jr z, .WildItem ; If we're in a trainer battle, the item is in the party struct - ld a, [CurPartyMon] - ld hl, OTPartyMon1Item - call GetPartyLocation ; bc = PartyMon[CurPartyMon] - PartyMons + ld a, [wCurPartyMon] + ld hl, wOTPartyMon1Item + call GetPartyLocation ; bc = PartyMon[wCurPartyMon] - wPartyMons ld a, [hl] jr .UpdateItem @@ -6177,9 +6177,9 @@ LoadEnemyMon: ; 3e8eb ; Force Item1 ; Used for Ho-Oh, Lugia and Snorlax encounters - ld a, [BattleType] + ld a, [wBattleType] cp BATTLETYPE_FORCEITEM - ld a, [BaseItems] + ld a, [wBaseItems] jr z, .UpdateItem ; Failing that, it's all up to chance @@ -6197,12 +6197,12 @@ LoadEnemyMon: ; 3e8eb ; From there, an 8% chance for Item2 call BattleRandom cp 8 percent ; 8% of 25% = 2% Item2 - ld a, [BaseItems] + ld a, [wBaseItems] jr nc, .UpdateItem - ld a, [BaseItems+1] + ld a, [wBaseItems+1] .UpdateItem: - ld [EnemyMonItem], a + ld [wEnemyMonItem], a ; Initialize DVs @@ -6211,13 +6211,13 @@ LoadEnemyMon: ; 3e8eb and a jr z, .InitDVs - ld a, [EnemySubStatus5] + ld a, [wEnemySubStatus5] bit SUBSTATUS_TRANSFORMED, a jr z, .InitDVs ; Unknown ld hl, wEnemyBackupDVs - ld de, EnemyMonDVs + ld de, wEnemyMonDVs ld a, [hli] ld [de], a inc de @@ -6242,7 +6242,7 @@ LoadEnemyMon: ; 3e8eb ; Roaming monsters (Entei, Raikou) work differently ; They have their own structs, which are shorter than normal - ld a, [BattleType] + ld a, [wBattleType] cp BATTLETYPE_ROAMING jr nz, .NotRoaming @@ -6280,7 +6280,7 @@ LoadEnemyMon: ; 3e8eb jr .UpdateDVs .NotRoaming: -; Register a contains BattleType +; Register a contains wBattleType ; Forced shiny battle type ; Used by Red Gyarados at Lake of Rage @@ -6300,7 +6300,7 @@ LoadEnemyMon: ; 3e8eb .UpdateDVs: ; Input DVs in register bc - ld hl, EnemyMonDVs + ld hl, wEnemyMonDVs ld a, b ld [hli], a ld [hl], c @@ -6313,12 +6313,12 @@ LoadEnemyMon: ; 3e8eb ; Species-specfic: ; Unown - ld a, [TempEnemyMonSpecies] + ld a, [wTempEnemyMonSpecies] cp UNOWN jr nz, .Magikarp ; Get letter based on DVs - ld hl, EnemyMonDVs + ld hl, wEnemyMonDVs predef GetUnownLetter ; Can't use any letters that haven't been unlocked ; If combined with forced shiny battletype, causes an infinite loop @@ -6334,13 +6334,13 @@ LoadEnemyMon: ; 3e8eb ; by targeting those 1600 mm (= 5'3") or larger. ; After the conversion to feet, it is unable to target any, ; since the largest possible Magikarp is 5'3", and $0503 = 1283 mm. - ld a, [TempEnemyMonSpecies] + ld a, [wTempEnemyMonSpecies] cp MAGIKARP jr nz, .Happiness ; Get Magikarp's length - ld de, EnemyMonDVs - ld bc, PlayerID + ld de, wEnemyMonDVs + ld bc, wPlayerID callfar CalcMagikarpLength ; No reason to keep going if length > 1536 mm (i.e. if HIGH(length) > 6 feet) @@ -6380,10 +6380,10 @@ LoadEnemyMon: ; 3e8eb ; Moreover, due to the check not being translated to feet+inches, all Magikarp ; smaller than 4'0" may be caught by the filter, a lot more than intended. - ld a, [MapGroup] + ld a, [wMapGroup] cp GROUP_LAKE_OF_RAGE jr z, .Happiness - ld a, [MapNumber] + ld a, [wMapNumber] cp MAP_LAKE_OF_RAGE jr z, .Happiness ; 40% chance of not flooring @@ -6400,14 +6400,14 @@ LoadEnemyMon: ; 3e8eb .Happiness: ; Set happiness ld a, BASE_HAPPINESS - ld [EnemyMonHappiness], a + ld [wEnemyMonHappiness], a ; Set level - ld a, [CurPartyLevel] - ld [EnemyMonLevel], a + ld a, [wCurPartyLevel] + ld [wEnemyMonLevel], a ; Fill stats - ld de, EnemyMonMaxHP + ld de, wEnemyMonMaxHP ld b, FALSE - ld hl, EnemyMonDVs - (MON_DVS - MON_STAT_EXP + 1) ; LinkBattleRNs + 7 ; ? + ld hl, wEnemyMonDVs - (MON_DVS - MON_STAT_EXP + 1) ; wLinkBattleRNs + 7 ; ? predef CalcPkmnStats ; If we're in a trainer battle, @@ -6420,7 +6420,7 @@ LoadEnemyMon: ; 3e8eb and a jr z, .TreeMon - ld a, [EnemySubStatus5] + ld a, [wEnemySubStatus5] bit SUBSTATUS_TRANSFORMED, a jp nz, .Moves @@ -6433,7 +6433,7 @@ LoadEnemyMon: ; 3e8eb xor a .UpdateStatus: - ld hl, EnemyMonStatus + ld hl, wEnemyMonStatus ld [hli], a ; Unused byte @@ -6441,13 +6441,13 @@ LoadEnemyMon: ; 3e8eb ld [hli], a ; Full HP.. - ld a, [EnemyMonMaxHP] + ld a, [wEnemyMonMaxHP] ld [hli], a - ld a, [EnemyMonMaxHP + 1] + ld a, [wEnemyMonMaxHP + 1] ld [hl], a ; ..unless it's a RoamMon - ld a, [BattleType] + ld a, [wBattleType] cp BATTLETYPE_ROAMING jr nz, .Moves @@ -6459,38 +6459,38 @@ LoadEnemyMon: ; 3e8eb jr z, .InitRoamHP ; Update from the struct if it has ld a, [hl] - ld [EnemyMonHP + 1], a + ld [wEnemyMonHP + 1], a jr .Moves .InitRoamHP: ; HP only uses the lo byte in the RoamMon struct since ; Raikou/Entei/Suicune will have < 256 hp at level 40 - ld a, [EnemyMonHP + 1] + ld a, [wEnemyMonHP + 1] ld [hl], a jr .Moves .OpponentParty: ; Get HP from the party struct - ld hl, (OTPartyMon1HP + 1) - ld a, [CurPartyMon] + ld hl, (wOTPartyMon1HP + 1) + ld a, [wCurPartyMon] call GetPartyLocation ld a, [hld] - ld [EnemyMonHP + 1], a + ld [wEnemyMonHP + 1], a ld a, [hld] - ld [EnemyMonHP], a + ld [wEnemyMonHP], a ; Make sure everything knows which monster the opponent is using - ld a, [CurPartyMon] - ld [CurOTMon], a + ld a, [wCurPartyMon] + ld [wCurOTMon], a ; Get status from the party struct dec hl ld a, [hl] ; OTPartyMonStatus - ld [EnemyMonStatus], a + ld [wEnemyMonStatus], a .Moves: - ld hl, BaseType1 - ld de, EnemyMonType1 + ld hl, wBaseType1 + ld de, wEnemyMonType1 ld a, [hli] ld [de], a inc de @@ -6498,21 +6498,21 @@ LoadEnemyMon: ; 3e8eb ld [de], a ; Get moves - ld de, EnemyMonMoves + ld de, wEnemyMonMoves ; Are we in a trainer battle? ld a, [wBattleMode] cp TRAINER_BATTLE jr nz, .WildMoves ; Then copy moves from the party struct - ld hl, OTPartyMon1Moves - ld a, [CurPartyMon] + ld hl, wOTPartyMon1Moves + ld a, [wCurPartyMon] call GetPartyLocation ld bc, NUM_MOVES call CopyBytes jr .PP .WildMoves: -; Clear EnemyMonMoves +; Clear wEnemyMonMoves xor a ld h, d ld l, e @@ -6532,25 +6532,25 @@ LoadEnemyMon: ; 3e8eb jr z, .TrainerPP ; Fill wild PP - ld hl, EnemyMonMoves - ld de, EnemyMonPP + ld hl, wEnemyMonMoves + ld de, wEnemyMonPP predef FillPP jr .Finish .TrainerPP: ; Copy PP from the party struct - ld hl, OTPartyMon1PP - ld a, [CurPartyMon] + ld hl, wOTPartyMon1PP + ld a, [wCurPartyMon] call GetPartyLocation - ld de, EnemyMonPP + ld de, wEnemyMonPP ld bc, NUM_MOVES call CopyBytes .Finish: ; Only the first five base stats are copied.. - ld hl, BaseStats - ld de, EnemyMonBaseStats - ld b, BaseSpecialDefense - BaseStats + ld hl, wBaseStats + ld de, wEnemyMonBaseStats + ld b, wBaseSpecialDefense - wBaseStats .loop ld a, [hli] ld [de], a @@ -6558,14 +6558,14 @@ LoadEnemyMon: ; 3e8eb dec b jr nz, .loop - ld a, [BaseCatchRate] + ld a, [wBaseCatchRate] ld [de], a inc de - ld a, [BaseExp] + ld a, [wBaseExp] ld [de], a - ld a, [TempEnemyMonSpecies] + ld a, [wTempEnemyMonSpecies] ld [wd265], a call GetPokemonName @@ -6576,22 +6576,22 @@ LoadEnemyMon: ; 3e8eb ret z ; Update enemy nick - ld hl, StringBuffer1 - ld de, EnemyMonNick + ld hl, wStringBuffer1 + ld de, wEnemyMonNick ld bc, MON_NAME_LENGTH call CopyBytes ; Saw this mon - ld a, [TempEnemyMonSpecies] + ld a, [wTempEnemyMonSpecies] dec a ld c, a ld b, SET_FLAG - ld hl, PokedexSeen + ld hl, wPokedexSeen predef SmallFarFlagAction - ld hl, EnemyMonStats - ld de, EnemyStats - ld bc, EnemyMonStatsEnd - EnemyMonStats + ld hl, wEnemyMonStats + ld de, wEnemyStats + ld bc, wEnemyMonStatsEnd - wEnemyMonStats call CopyBytes ret @@ -6602,13 +6602,13 @@ CheckSleepingTreeMon: ; 3eb38 ; for the current time of day ; Don't do anything if this isn't a tree encounter - ld a, [BattleType] + ld a, [wBattleType] cp BATTLETYPE_TREE jr nz, .NotSleeping ; Get list for the time of day ld hl, AsleepTreeMonsMorn - ld a, [TimeOfDay] + ld a, [wTimeOfDay] cp DAY_F jr c, .Check ld hl, AsleepTreeMonsDay @@ -6616,7 +6616,7 @@ CheckSleepingTreeMon: ; 3eb38 ld hl, AsleepTreeMonsNite .Check: - ld a, [TempEnemyMonSpecies] + ld a, [wTempEnemyMonSpecies] ld de, 1 ; length of species id call IsInArray ; If it's a match, the opponent is asleep @@ -6649,7 +6649,7 @@ CheckUnownLetter: ; 3eb75 ld l, a push de - ld a, [UnownLetter] + ld a, [wUnownLetter] ld de, 1 push bc call IsInArray @@ -6698,22 +6698,22 @@ CheckUnownLetter: ; 3eb75 Unreferenced_SwapBattlerLevels: ; 3ebc7 push bc - ld a, [BattleMonLevel] + ld a, [wBattleMonLevel] ld b, a - ld a, [EnemyMonLevel] - ld [BattleMonLevel], a + ld a, [wEnemyMonLevel] + ld [wBattleMonLevel], a ld a, b - ld [EnemyMonLevel], a + ld [wEnemyMonLevel], a pop bc ret ; 3ebd8 BattleWinSlideInEnemyTrainerFrontpic: ; 3ebd8 xor a - ld [TempEnemyMonSpecies], a + ld [wTempEnemyMonSpecies], a call FinishBattleAnim - ld a, [OtherTrainerClass] - ld [TrainerClass], a + ld a, [wOtherTrainerClass] + ld [wTrainerClass], a ld de, vTiles2 callfar GetTrainerPic hlcoord 19, 0 @@ -6789,10 +6789,10 @@ ApplyPrzEffectOnSpeed: ; 3ec39 ld a, [hBattleTurn] and a jr z, .enemy - ld a, [BattleMonStatus] + ld a, [wBattleMonStatus] and 1 << PAR ret z - ld hl, BattleMonSpeed + 1 + ld hl, wBattleMonSpeed + 1 ld a, [hld] ld b, a ld a, [hl] @@ -6810,10 +6810,10 @@ ApplyPrzEffectOnSpeed: ; 3ec39 ret .enemy - ld a, [EnemyMonStatus] + ld a, [wEnemyMonStatus] and 1 << PAR ret z - ld hl, EnemyMonSpeed + 1 + ld hl, wEnemyMonSpeed + 1 ld a, [hld] ld b, a ld a, [hl] @@ -6835,10 +6835,10 @@ ApplyBrnEffectOnAttack: ; 3ec76 ld a, [hBattleTurn] and a jr z, .enemy - ld a, [BattleMonStatus] + ld a, [wBattleMonStatus] and 1 << BRN ret z - ld hl, BattleMonAttack + 1 + ld hl, wBattleMonAttack + 1 ld a, [hld] ld b, a ld a, [hl] @@ -6854,10 +6854,10 @@ ApplyBrnEffectOnAttack: ; 3ec76 ret .enemy - ld a, [EnemyMonStatus] + ld a, [wEnemyMonStatus] and 1 << BRN ret z - ld hl, EnemyMonAttack + 1 + ld hl, wEnemyMonAttack + 1 ld a, [hld] ld b, a ld a, [hl] @@ -6891,13 +6891,13 @@ ApplyStatLevelMultiplier: ; 3ecb7 ld a, [wd265] and a ld a, c - ld hl, BattleMonAttack - ld de, PlayerStats - ld bc, PlayerAtkLevel + ld hl, wBattleMonAttack + ld de, wPlayerStats + ld bc, wPlayerAtkLevel jr z, .got_pointers - ld hl, EnemyMonAttack - ld de, EnemyStats - ld bc, EnemyAtkLevel + ld hl, wEnemyMonAttack + ld de, wEnemyStats + ld bc, wEnemyAtkLevel .got_pointers add c @@ -6989,7 +6989,8 @@ ApplyStatLevelMultiplier: ; 3ecb7 ; 3ed45 BadgeStatBoosts: ; 3ed45 -; Raise BattleMon stats depending on which badges have been obtained. +; Raise the stats of the battle mon in wBattleMon +; depending on which badges have been obtained. ; Every other badge boosts a stat, starting from the first. @@ -7005,7 +7006,7 @@ BadgeStatBoosts: ; 3ed45 and a ret nz - ld a, [InBattleTowerBattle] + ld a, [wInBattleTowerBattle] and a ret nz @@ -7028,7 +7029,7 @@ BadgeStatBoosts: ; 3ed45 or c ld b, a - ld hl, BattleMonAttack + ld hl, wBattleMonAttack ld c, 4 .CheckBadge: ld a, b @@ -7124,13 +7125,13 @@ _BattleRandom:: ; 3edd8 ; Which value are we trying to pull? push hl push bc - ld a, [LinkBattleRNCount] + ld a, [wLinkBattleRNCount] ld c, a ld b, 0 - ld hl, LinkBattleRNs + ld hl, wLinkBattleRNs add hl, bc inc a - ld [LinkBattleRNCount], a + ld [wLinkBattleRNCount], a ; If we haven't hit the end yet, we're good cp 10 - 1 ; Exclude last value. See the closing comment @@ -7147,8 +7148,8 @@ _BattleRandom:: ; 3edd8 ; Reset count to 0 xor a - ld [LinkBattleRNCount], a - ld hl, LinkBattleRNs + ld [wLinkBattleRNCount], a + ld hl, wLinkBattleRNs ld b, 10 ; number of seeds ; Generate next number in the sequence for each seed @@ -7188,9 +7189,9 @@ Call_PlayBattleAnim_OnlyIfVisible: ; 3ee0f Call_PlayBattleAnim: ; 3ee17 ld a, e - ld [FXAnimID], a + ld [wFXAnimID], a ld a, d - ld [FXAnimID + 1], a + ld [wFXAnimID + 1], a call WaitBGMap predef_jump PlayBattleAnim ; 3ee27 @@ -7218,14 +7219,14 @@ GiveExperiencePoints: ; 3ee3b and a ret nz - ld a, [InBattleTowerBattle] + ld a, [wInBattleTowerBattle] bit 0, a ret nz call .EvenlyDivideExpAmongParticipants xor a - ld [CurPartyMon], a - ld bc, PartyMon1Species + ld [wCurPartyMon], a + ld bc, wPartyMon1Species .loop ld hl, MON_HP @@ -7236,7 +7237,7 @@ GiveExperiencePoints: ; 3ee3b push bc ld hl, wBattleParticipantsNotFainted - ld a, [CurPartyMon] + ld a, [wCurPartyMon] ld c, a ld b, CHECK_FLAG ld d, $0 @@ -7251,7 +7252,7 @@ GiveExperiencePoints: ; 3ee3b add hl, bc ld d, h ld e, l - ld hl, EnemyMonBaseStats - 1 + ld hl, wEnemyMonBaseStats - 1 push bc ld c, $5 .loop1 @@ -7303,9 +7304,9 @@ GiveExperiencePoints: ; 3ee3b xor a ld [hMultiplicand + 0], a ld [hMultiplicand + 1], a - ld a, [EnemyMonBaseExp] + ld a, [wEnemyMonBaseExp] ld [hMultiplicand + 2], a - ld a, [EnemyMonLevel] + ld a, [wEnemyMonLevel] ld [hMultiplier], a call Multiply ld a, 7 @@ -7316,11 +7317,11 @@ GiveExperiencePoints: ; 3ee3b pop bc ld hl, MON_ID add hl, bc - ld a, [PlayerID] + ld a, [wPlayerID] cp [hl] jr nz, .boosted inc hl - ld a, [PlayerID + 1] + ld a, [wPlayerID + 1] cp [hl] ld a, $0 jr z, .no_boost @@ -7331,7 +7332,7 @@ GiveExperiencePoints: ; 3ee3b .no_boost ; Boost experience for a Trainer Battle - ld [StringBuffer2 + 2], a + ld [wStringBuffer2 + 2], a ld a, [wBattleMode] dec a call nz, BoostExp @@ -7343,17 +7344,17 @@ GiveExperiencePoints: ; 3ee3b cp LUCKY_EGG call z, BoostExp ld a, [hQuotient + 2] - ld [StringBuffer2 + 1], a + ld [wStringBuffer2 + 1], a ld a, [hQuotient + 1] - ld [StringBuffer2], a - ld a, [CurPartyMon] - ld hl, PartyMonNicknames + ld [wStringBuffer2], a + ld a, [wCurPartyMon] + ld hl, wPartyMonNicknames call GetNick ld hl, Text_PkmnGainedExpPoint call BattleTextBox - ld a, [StringBuffer2 + 1] + ld a, [wStringBuffer2 + 1] ld [hQuotient + 2], a - ld a, [StringBuffer2] + ld a, [wStringBuffer2] ld [hQuotient + 1], a pop bc call AnimateExpBar @@ -7380,13 +7381,13 @@ GiveExperiencePoints: ; 3ee3b ld [hl], a .skip2 - ld a, [CurPartyMon] + ld a, [wCurPartyMon] ld e, a ld d, $0 - ld hl, PartySpecies + ld hl, wPartySpecies add hl, de ld a, [hl] - ld [CurSpecies], a + ld [wCurSpecies], a call GetBaseData push bc ld d, MAX_LEVEL @@ -7417,7 +7418,7 @@ GiveExperiencePoints: ; 3ee3b .not_max_exp xor a ; PARTYMON - ld [MonType], a + ld [wMonType], a predef CopyPkmnToTempMon callfar CalcLevel pop bc @@ -7430,15 +7431,15 @@ GiveExperiencePoints: ; 3ee3b jp z, .skip_stats ; <NICKNAME> grew to level ##! ld [wTempLevel], a - ld a, [CurPartyLevel] + ld a, [wCurPartyLevel] push af ld a, d - ld [CurPartyLevel], a + ld [wCurPartyLevel], a ld [hl], a ld hl, MON_SPECIES add hl, bc ld a, [hl] - ld [CurSpecies], a + ld [wCurSpecies], a ld [wd265], a call GetBaseData ld hl, MON_MAXHP + 1 @@ -7473,18 +7474,18 @@ GiveExperiencePoints: ; 3ee3b ld a, [hl] adc d ld [hl], a - ld a, [CurBattleMon] + ld a, [wCurBattleMon] ld d, a - ld a, [CurPartyMon] + ld a, [wCurPartyMon] cp d jr nz, .skip_animation - ld de, BattleMonHP + ld de, wBattleMonHP ld a, [hli] ld [de], a inc de ld a, [hli] ld [de], a - ld de, BattleMonMaxHP + ld de, wBattleMonMaxHP push bc ld bc, PARTYMON_STRUCT_LENGTH - MON_MAXHP call CopyBytes @@ -7492,13 +7493,13 @@ GiveExperiencePoints: ; 3ee3b ld hl, MON_LEVEL add hl, bc ld a, [hl] - ld [BattleMonLevel], a - ld a, [PlayerSubStatus5] + ld [wBattleMonLevel], a + ld a, [wPlayerSubStatus5] bit SUBSTATUS_TRANSFORMED, a jr nz, .transformed ld hl, MON_ATK add hl, bc - ld de, PlayerStats + ld de, wPlayerStats ld bc, PARTYMON_STRUCT_LENGTH - MON_ATK call CopyBytes @@ -7516,9 +7517,9 @@ GiveExperiencePoints: ; 3ee3b .skip_animation farcall LevelUpHappinessMod - ld a, [CurBattleMon] + ld a, [wCurBattleMon] ld b, a - ld a, [CurPartyMon] + ld a, [wCurPartyMon] cp b jr z, .skip_animation2 ld de, SFX_HIT_END_OF_EXP_BAR @@ -7530,7 +7531,7 @@ GiveExperiencePoints: ; 3ee3b .skip_animation2 xor a ; PARTYMON - ld [MonType], a + ld [wMonType], a predef CopyPkmnToTempMon hlcoord 9, 0 ld b, $a @@ -7544,10 +7545,10 @@ GiveExperiencePoints: ; 3ee3b call WaitPressAorB_BlinkCursor call Call_LoadTempTileMapToTileMap xor a ; PARTYMON - ld [MonType], a - ld a, [CurSpecies] + ld [wMonType], a + ld a, [wCurSpecies] ld [wd265], a - ld a, [CurPartyLevel] + ld a, [wCurPartyLevel] push af ld c, a ld a, [wTempLevel] @@ -7556,7 +7557,7 @@ GiveExperiencePoints: ; 3ee3b .level_loop inc b ld a, b - ld [CurPartyLevel], a + ld [wCurPartyLevel], a push bc predef LearnLevelMoves pop bc @@ -7564,23 +7565,23 @@ GiveExperiencePoints: ; 3ee3b cp c jr nz, .level_loop pop af - ld [CurPartyLevel], a - ld hl, EvolvableFlags - ld a, [CurPartyMon] + ld [wCurPartyLevel], a + ld hl, wEvolvableFlags + ld a, [wCurPartyMon] ld c, a ld b, SET_FLAG predef SmallFarFlagAction pop af - ld [CurPartyLevel], a + ld [wCurPartyLevel], a .skip_stats - ld a, [PartyCount] + ld a, [wPartyCount] ld b, a - ld a, [CurPartyMon] + ld a, [wCurPartyMon] inc a cp b jr z, .done - ld [CurPartyMon], a + ld [wCurPartyMon], a ld a, MON_SPECIES call GetPartyParamLocation ld b, h @@ -7608,8 +7609,8 @@ GiveExperiencePoints: ; 3ee3b ret c ld [wd265], a - ld hl, EnemyMonBaseStats - ld c, EnemyMonEnd - EnemyMonBaseStats + ld hl, wEnemyMonBaseStats + ld c, wEnemyMonEnd - wEnemyMonBaseStats .count_loop2 xor a ld [hDividend + 0], a @@ -7651,7 +7652,7 @@ Text_PkmnGainedExpPoint: ; 3f11b text_jump Text_Gained start_asm ld hl, TextJump_StringBuffer2ExpPoints - ld a, [StringBuffer2 + 2] ; IsTradedMon + ld a, [wStringBuffer2 + 2] ; IsTradedMon and a ret z @@ -7672,12 +7673,12 @@ TextJump_StringBuffer2ExpPoints: ; 3f131 AnimateExpBar: ; 3f136 push bc - ld hl, CurPartyMon - ld a, [CurBattleMon] + ld hl, wCurPartyMon + ld a, [wCurBattleMon] cp [hl] jp nz, .finish - ld a, [BattleMonLevel] + ld a, [wBattleMonLevel] cp MAX_LEVEL jp nc, .finish @@ -7690,16 +7691,16 @@ AnimateExpBar: ; 3f136 xor a ld [wd002], a xor a ; PARTYMON - ld [MonType], a + ld [wMonType], a predef CopyPkmnToTempMon - ld a, [TempMonLevel] + ld a, [wTempMonLevel] ld b, a ld e, a push de - ld de, TempMonExp + 2 + ld de, wTempMonExp + 2 call CalcExpBar push bc - ld hl, TempMonExp + 2 + ld hl, wTempMonExp + 2 ld a, [wd004] add [hl] ld [hld], a @@ -7723,7 +7724,7 @@ AnimateExpBar: ; 3f136 ld c, a ld a, [hProduct + 3] ld d, a - ld hl, TempMonExp + 2 + ld hl, wTempMonExp + 2 ld a, [hld] sub d ld a, [hld] @@ -7756,16 +7757,16 @@ AnimateExpBar: ; 3f136 cp d jr z, .FinishExpBar inc a - ld [TempMonLevel], a - ld [CurPartyLevel], a - ld [BattleMonLevel], a + ld [wTempMonLevel], a + ld [wCurPartyLevel], a + ld [wBattleMonLevel], a push de call .PlayExpBarSound ld c, $40 call .LoopBarAnimation call PrintPlayerHUD - ld hl, BattleMonNick - ld de, StringBuffer1 + ld hl, wBattleMonNick + ld de, wStringBuffer1 ld bc, MON_NAME_LENGTH call CopyBytes call TerminateExpBarSound @@ -7783,7 +7784,7 @@ AnimateExpBar: ; 3f136 .FinishExpBar: push bc ld b, d - ld de, TempMonExp + 2 + ld de, wTempMonExp + 2 call CalcExpBar ld a, b pop bc @@ -7868,7 +7869,7 @@ SendOutPkmnText: ; 3f26d .not_linked ; Depending on the HP of the enemy Pkmn, the game prints a different text - ld hl, EnemyMonHP + ld hl, wEnemyMonHP ld a, [hli] or [hl] ld hl, JumpText_GoPkmn @@ -7877,7 +7878,7 @@ SendOutPkmnText: ; 3f26d ; compute enemy helth remaining as a percentage xor a ld [hMultiplicand + 0], a - ld hl, EnemyMonHP + ld hl, wEnemyMonHP ld a, [hli] ld [wEnemyHPAtTimeOfPlayerSwitch], a ld [hMultiplicand + 1], a @@ -7887,7 +7888,7 @@ SendOutPkmnText: ; 3f26d ld a, 25 ld [hMultiplier], a call Multiply - ld hl, EnemyMonMaxHP + ld hl, wEnemyMonMaxHP ld a, [hli] ld b, [hl] srl a @@ -7959,7 +7960,7 @@ WithdrawPkmnText: ; 3f2f4 ; depending on HP the message is different push de push bc - ld hl, EnemyMonHP + 1 + ld hl, wEnemyMonHP + 1 ld de, wEnemyHPAtTimeOfPlayerSwitch + 1 ld b, [hl] dec hl @@ -7974,7 +7975,7 @@ WithdrawPkmnText: ; 3f2f4 ld a, 25 ld [hMultiplier], a call Multiply - ld hl, EnemyMonMaxHP + ld hl, wEnemyMonMaxHP ld a, [hli] ld b, [hl] srl a @@ -8048,11 +8049,11 @@ Unreferenced_HandleSafariAngerEatingStatus: ld hl, BattleText_WildPkmnIsAngry jr nz, .finish push hl - ld a, [EnemyMonSpecies] - ld [CurSpecies], a + ld a, [wEnemyMonSpecies] + ld [wCurSpecies], a call GetBaseData - ld a, [BaseCatchRate] - ld [EnemyMonCatchRate], a + ld a, [wBaseCatchRate] + ld [wEnemyMonCatchRate], a pop hl .finish @@ -8205,7 +8206,7 @@ PlaceExpBar: ; 3f41c ; 3f43d GetBattleMonBackpic: ; 3f43d - ld a, [PlayerSubStatus4] + ld a, [wPlayerSubStatus4] bit SUBSTATUS_SUBSTITUTE, a ld hl, BattleAnimCmd_RaiseSub jr nz, GetBattleMonBackpic_DoAnim ; substitute @@ -8215,16 +8216,16 @@ DropPlayerSub: ; 3f447 and a ld hl, BattleAnimCmd_MinimizeOpp jr nz, GetBattleMonBackpic_DoAnim - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] push af - ld a, [BattleMonSpecies] - ld [CurPartySpecies], a - ld hl, BattleMonDVs + ld a, [wBattleMonSpecies] + ld [wCurPartySpecies], a + ld hl, wBattleMonDVs predef GetUnownLetter ld de, vTiles2 tile $31 predef GetMonBackpic pop af - ld [CurPartySpecies], a + ld [wCurPartySpecies], a ret ; 3f46f @@ -8241,7 +8242,7 @@ GetBattleMonBackpic_DoAnim: ; 3f46f ; 3f47c GetEnemyMonFrontpic: ; 3f47c - ld a, [EnemySubStatus4] + ld a, [wEnemySubStatus4] bit SUBSTATUS_SUBSTITUTE, a ld hl, BattleAnimCmd_RaiseSub jr nz, GetEnemyMonFrontpic_DoAnim @@ -8252,18 +8253,18 @@ DropEnemySub: ; 3f486 ld hl, BattleAnimCmd_MinimizeOpp jr nz, GetEnemyMonFrontpic_DoAnim - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] push af - ld a, [EnemyMonSpecies] - ld [CurSpecies], a - ld [CurPartySpecies], a + ld a, [wEnemyMonSpecies] + ld [wCurSpecies], a + ld [wCurPartySpecies], a call GetBaseData - ld hl, EnemyMonDVs + ld hl, wEnemyMonDVs predef GetUnownLetter ld de, vTiles2 predef GetAnimatedFrontpic pop af - ld [CurPartySpecies], a + ld [wCurPartySpecies], a ret ; 3f4b4 @@ -8282,17 +8283,17 @@ StartBattle: ; 3f4c1 ; This check prevents you from entering a battle without any Pokemon. ; Those using walk-through-walls to bypass getting a Pokemon experience ; the effects of this check. - ld a, [PartyCount] + ld a, [wPartyCount] and a ret z - ld a, [TimeOfDayPal] + ld a, [wTimeOfDayPal] push af call BattleIntro call DoBattle call ExitBattle pop af - ld [TimeOfDayPal], a + ld [wTimeOfDayPal], a scf ret ; 3f4d9 @@ -8306,7 +8307,7 @@ BattleIntro: ; 3f4dd farcall StubbedTrainerRankings_Battles ; mobile call LoadTrainerOrWildMonPic xor a - ld [TempBattleMonSpecies], a + ld [wTempBattleMonSpecies], a ld [wBattleMenuCursorBuffer], a xor a ld [hMapAnims], a @@ -8344,19 +8345,19 @@ BattleIntro: ; 3f4dd ; 3f54e LoadTrainerOrWildMonPic: ; 3f54e - ld a, [OtherTrainerClass] + ld a, [wOtherTrainerClass] and a jr nz, .Trainer - ld a, [TempWildMonSpecies] - ld [CurPartySpecies], a + ld a, [wTempWildMonSpecies] + ld [wCurPartySpecies], a .Trainer: - ld [TempEnemyMonSpecies], a + ld [wTempEnemyMonSpecies], a ret ; 3f55e InitEnemy: ; 3f55e - ld a, [OtherTrainerClass] + ld a, [wOtherTrainerClass] and a jp nz, InitEnemyTrainer ; trainer jp InitEnemyWildmon ; wild @@ -8387,19 +8388,19 @@ BackUpBGMap2: ; 3f568 ; 3f594 InitEnemyTrainer: ; 3f594 - ld [TrainerClass], a + ld [wTrainerClass], a farcall StubbedTrainerRankings_TrainerBattles xor a - ld [TempEnemyMonSpecies], a + ld [wTempEnemyMonSpecies], a callfar GetTrainerAttributes callfar ReadTrainerParty ; RIVAL1's first mon has no held item - ld a, [TrainerClass] + ld a, [wTrainerClass] cp RIVAL1 jr nz, .ok xor a - ld [OTPartyMon1Item], a + ld [wOTPartyMon1Item], a .ok ld de, vTiles2 @@ -8412,15 +8413,15 @@ InitEnemyTrainer: ; 3f594 lb bc, 7, 7 predef PlaceGraphic ld a, -1 - ld [CurOTMon], a + ld [wCurOTMon], a ld a, TRAINER_BATTLE ld [wBattleMode], a call IsGymLeader jr nc, .done xor a - ld [CurPartyMon], a - ld a, [PartyCount] + ld [wCurPartyMon], a + ld a, [wPartyCount] ld b, a .partyloop push bc @@ -8435,7 +8436,7 @@ InitEnemyTrainer: ; 3f594 pop bc dec b jr z, .done - ld hl, CurPartyMon + ld hl, wCurPartyMon inc [hl] jr .partyloop .done @@ -8447,29 +8448,29 @@ InitEnemyWildmon: ; 3f607 ld [wBattleMode], a farcall StubbedTrainerRankings_WildBattles call LoadEnemyMon - ld hl, EnemyMonMoves + ld hl, wEnemyMonMoves ld de, wWildMonMoves ld bc, NUM_MOVES call CopyBytes - ld hl, EnemyMonPP + ld hl, wEnemyMonPP ld de, wWildMonPP ld bc, NUM_MOVES call CopyBytes - ld hl, EnemyMonDVs + ld hl, wEnemyMonDVs predef GetUnownLetter - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] cp UNOWN jr nz, .skip_unown ld a, [wFirstUnownSeen] and a jr nz, .skip_unown - ld a, [UnownLetter] + ld a, [wUnownLetter] ld [wFirstUnownSeen], a .skip_unown ld de, vTiles2 predef GetAnimatedFrontpic xor a - ld [TrainerClass], a + ld [wTrainerClass], a ld [hGraphicStartTile], a hlcoord 12, 0 lb bc, 7, 7 @@ -8478,7 +8479,7 @@ InitEnemyWildmon: ; 3f607 ; 3f662 Unreferenced_Function3f662: ; 3f662 - ld hl, EnemyMonMoves + ld hl, wEnemyMonMoves ld de, wListMoves_MoveIndicesBuffer ld b, NUM_MOVES .loop @@ -8500,7 +8501,7 @@ Unreferenced_Function3f662: ; 3f662 call GetFarByte pop hl - ld bc, EnemyMonPP - (EnemyMonMoves + 1) + ld bc, wEnemyMonPP - (wEnemyMonMoves + 1) add hl, bc ld [hl], a @@ -8518,7 +8519,7 @@ Unreferenced_Function3f662: ; 3f662 .clearpp push bc push hl - ld bc, EnemyMonPP - (EnemyMonMoves + 1) + ld bc, wEnemyMonPP - (wEnemyMonMoves + 1) add hl, bc xor a ld [hl], a @@ -8560,12 +8561,12 @@ ExitBattle: ; 3f69e CleanUpBattleRAM: ; 3f6d0 call BattleEnd_HandleRoamMons xor a - ld [Danger], a + ld [wLowHealthAlarm], a ld [wBattleMode], a - ld [BattleType], a - ld [AttackMissed], a - ld [TempWildMonSpecies], a - ld [OtherTrainerClass], a + ld [wBattleType], a + ld [wAttackMissed], a + ld [wTempWildMonSpecies], a + ld [wOtherTrainerClass], a ld [wFailedToFlee], a ld [wNumFleeAttempts], a ld [wForcedSwitch], a @@ -8573,15 +8574,15 @@ CleanUpBattleRAM: ; 3f6d0 ld [wKeyItemsPocketCursor], a ld [wItemsPocketCursor], a ld [wBattleMenuCursorBuffer], a - ld [CurMoveNum], a + ld [wCurMoveNum], a ld [wBallsPocketCursor], a ld [wLastPocket], a ld [wMenuScrollPosition], a ld [wKeyItemsPocketScrollPosition], a ld [wItemsPocketScrollPosition], a ld [wBallsPocketScrollPosition], a - ld hl, PlayerSubStatus1 - ld b, EnemyFuryCutterCount - PlayerSubStatus1 + ld hl, wPlayerSubStatus1 + ld b, wEnemyFuryCutterCount - wPlayerSubStatus1 .loop ld [hli], a dec b @@ -8614,11 +8615,11 @@ CheckPayDay: ; 3f71d .okay ld hl, wPayDayMoney + 2 - ld de, Money + 2 + ld de, wMoney + 2 call AddBattleMoneyToAccount ld hl, BattleText_PlayerPickedUpPayDayMoney call StdBattleTextBox - ld a, [InBattleTowerBattle] + ld a, [wInBattleTowerBattle] bit 0, a ret z call ClearTileMap @@ -8629,10 +8630,10 @@ CheckPayDay: ; 3f71d ShowLinkBattleParticipantsAfterEnd: ; 3f759 farcall StubbedTrainerRankings_LinkBattles farcall BackupMobileEventIndex - ld a, [CurOTMon] - ld hl, OTPartyMon1Status + ld a, [wCurOTMon] + ld hl, wOTPartyMon1Status call GetPartyLocation - ld a, [EnemyMonStatus] + ld a, [wEnemyMonStatus] ld [hl], a call ClearTileMap farcall _ShowLinkBattleParticipants @@ -8734,7 +8735,7 @@ DisplayLinkRecord: ; 3f836 call ReadAndPrintLinkBattleRecord call CloseSRAM - hlcoord 0, 0, AttrMap + hlcoord 0, 0, wAttrMap xor a ld bc, SCREEN_WIDTH * SCREEN_HEIGHT call ByteFill @@ -8883,14 +8884,14 @@ ReadAndPrintLinkBattleRecord: ; 3f85f ; 3f998 BattleEnd_HandleRoamMons: ; 3f998 - ld a, [BattleType] + ld a, [wBattleType] cp BATTLETYPE_ROAMING jr nz, .not_roaming ld a, [wBattleResult] and $f jr z, .caught_or_defeated_roam_mon call GetRoamMonHP - ld a, [EnemyMonHP + 1] + ld a, [wEnemyMonHP + 1] ld [hl], a jr .update_roam_mons @@ -8916,7 +8917,7 @@ BattleEnd_HandleRoamMons: ; 3f998 ; 3f9d1 GetRoamMonMapGroup: ; 3f9d1 - ld a, [TempEnemyMonSpecies] + ld a, [wTempEnemyMonSpecies] ld b, a ld a, [wRoamMon1Species] cp b @@ -8931,7 +8932,7 @@ GetRoamMonMapGroup: ; 3f9d1 ; 3f9e9 GetRoamMonMapNumber: ; 3f9e9 - ld a, [TempEnemyMonSpecies] + ld a, [wTempEnemyMonSpecies] ld b, a ld a, [wRoamMon1Species] cp b @@ -8947,7 +8948,7 @@ GetRoamMonMapNumber: ; 3f9e9 GetRoamMonHP: ; 3fa01 ; output: hl = wRoamMonHP - ld a, [TempEnemyMonSpecies] + ld a, [wTempEnemyMonSpecies] ld b, a ld a, [wRoamMon1Species] cp b @@ -8963,7 +8964,7 @@ GetRoamMonHP: ; 3fa01 GetRoamMonDVs: ; 3fa19 ; output: hl = wRoamMonDVs - ld a, [TempEnemyMonSpecies] + ld a, [wTempEnemyMonSpecies] ld b, a ld a, [wRoamMon1Species] cp b @@ -8978,7 +8979,7 @@ GetRoamMonDVs: ; 3fa19 ; 3fa31 GetRoamMonSpecies: ; 3fa31 - ld a, [TempEnemyMonSpecies] + ld a, [wTempEnemyMonSpecies] ld hl, wRoamMon1Species cp [hl] ret z @@ -8990,11 +8991,11 @@ GetRoamMonSpecies: ; 3fa31 ; 3fa42 AddLastMobileBattleToLinkRecord: ; 3fa42 - ld hl, OTPlayerID - ld de, StringBuffer1 + ld hl, wOTPlayerID + ld de, wStringBuffer1 ld bc, 2 call CopyBytes - ld hl, OTPlayerName + ld hl, wOTPlayerName ld bc, NAME_LENGTH - 1 call CopyBytes ld hl, sLinkBattleResults @@ -9012,7 +9013,7 @@ AddLastMobileBattleToLinkRecord: ; 3fa42 jr z, .copy push de ld bc, 12 - ld de, StringBuffer1 + ld de, wStringBuffer1 call CompareLong pop de pop hl @@ -9028,7 +9029,7 @@ AddLastMobileBattleToLinkRecord: ; 3fa42 .copy ld d, h ld e, l - ld hl, StringBuffer1 + ld hl, wStringBuffer1 ld bc, 12 call CopyBytes ld b, 6 @@ -9275,7 +9276,7 @@ GetTrainerBackpic: ; 3fbff ; Special exception for Dude. ld b, BANK(DudeBackpic) ld hl, DudeBackpic - ld a, [BattleType] + ld a, [wBattleType] cp BATTLETYPE_TUTORIAL jr z, .Decompress @@ -9326,7 +9327,7 @@ CopyBackpic: ; 3fc30 ; 3fc5b .LoadTrainerBackpicAsOAM: ; 3fc5b - ld hl, Sprite01 + ld hl, wVirtualOAMSprite00 xor a ld [hMapObjectIndexBuffer], a ld b, 6 @@ -9406,12 +9407,12 @@ BattleStartMessage: ; 3fc8b .cry_no_anim ld a, $0f - ld [CryTracks], a - ld a, [TempEnemyMonSpecies] + ld [wCryTracks], a + ld a, [wTempEnemyMonSpecies] call PlayStereoCry .skip_cry - ld a, [BattleType] + ld a, [wBattleType] cp BATTLETYPE_FISH jr nz, .NotFishing diff --git a/engine/battle/effect_commands.asm b/engine/battle/effect_commands.asm index c1bc3752a..48efba8fa 100644 --- a/engine/battle/effect_commands.asm +++ b/engine/battle/effect_commands.asm @@ -1,7 +1,7 @@ DoPlayerTurn: ; 34000 call SetPlayerTurn - ld a, [wPlayerAction] + ld a, [wBattlePlayerAction] and a ret nz @@ -56,7 +56,7 @@ DoMove: ; 3402c ld a, BANK(MoveEffectsPointers) call GetFarHalfword - ld de, BattleScriptBuffer + ld de, wBattleScriptBuffer .GetMoveEffect: ld a, BANK(MoveEffects) @@ -68,27 +68,27 @@ DoMove: ; 3402c jr nz, .GetMoveEffect ; Start at the first command. - ld hl, BattleScriptBuffer + ld hl, wBattleScriptBuffer ld a, l - ld [BattleScriptBufferAddress], a + ld [wBattleScriptBufferAddress], a ld a, h - ld [BattleScriptBufferAddress + 1], a + ld [wBattleScriptBufferAddress + 1], a .ReadMoveEffectCommand: -; ld a, [BattleScriptBufferAddress++] - ld a, [BattleScriptBufferAddress] +; ld a, [wBattleScriptBufferAddress++] + ld a, [wBattleScriptBufferAddress] ld l, a - ld a, [BattleScriptBufferAddress + 1] + ld a, [wBattleScriptBufferAddress + 1] ld h, a ld a, [hli] push af ld a, l - ld [BattleScriptBufferAddress], a + ld [wBattleScriptBufferAddress], a ld a, h - ld [BattleScriptBufferAddress + 1], a + ld [wBattleScriptBufferAddress + 1], a pop af ; endturn_command (-2) is used to terminate branches without ending the read cycle. @@ -131,15 +131,15 @@ BattleCommand_CheckTurn: ; 34084 jp z, EndTurn xor a - ld [AttackMissed], a - ld [EffectFailed], a + ld [wAttackMissed], a + ld [wEffectFailed], a ld [wKickCounter], a - ld [AlreadyDisobeyed], a - ld [AlreadyFailed], a + ld [wAlreadyDisobeyed], a + ld [wAlreadyFailed], a ld [wSomeoneIsRampaging], a ld a, EFFECTIVE - ld [TypeModifier], a + ld [wTypeModifier], a ld a, [hBattleTurn] and a @@ -148,7 +148,7 @@ BattleCommand_CheckTurn: ; 34084 CheckPlayerTurn: - ld hl, PlayerSubStatus4 + ld hl, wPlayerSubStatus4 bit SUBSTATUS_RECHARGE, [hl] jr z, .no_recharge @@ -161,13 +161,13 @@ CheckPlayerTurn: .no_recharge - ld hl, BattleMonStatus + ld hl, wBattleMonStatus ld a, [hl] and SLP jr z, .not_asleep dec a - ld [BattleMonStatus], a + ld [wBattleMonStatus], a and SLP jr z, .woke_up @@ -186,7 +186,7 @@ CheckPlayerTurn: call CallBattleCore ld a, $1 ld [hBGMapMode], a - ld hl, PlayerSubStatus1 + ld hl, wPlayerSubStatus1 res SUBSTATUS_NIGHTMARE, [hl] jr .not_asleep @@ -195,7 +195,7 @@ CheckPlayerTurn: call StdBattleTextBox ; Snore and Sleep Talk bypass sleep. - ld a, [CurPlayerMove] + ld a, [wCurPlayerMove] cp SNORE jr z, .not_asleep cp SLEEP_TALK @@ -207,12 +207,12 @@ CheckPlayerTurn: .not_asleep - ld hl, BattleMonStatus + ld hl, wBattleMonStatus bit FRZ, [hl] jr z, .not_frozen ; Flame Wheel and Sacred Fire thaw the user. - ld a, [CurPlayerMove] + ld a, [wCurPlayerMove] cp FLAME_WHEEL jr z, .not_frozen cp SACRED_FIRE @@ -227,7 +227,7 @@ CheckPlayerTurn: .not_frozen - ld hl, PlayerSubStatus3 + ld hl, wPlayerSubStatus3 bit SUBSTATUS_FLINCHED, [hl] jr z, .not_flinched @@ -241,7 +241,7 @@ CheckPlayerTurn: .not_flinched - ld hl, PlayerDisableCount + ld hl, wPlayerDisableCount ld a, [hl] and a jr z, .not_disabled @@ -252,21 +252,21 @@ CheckPlayerTurn: jr nz, .not_disabled ld [hl], a - ld [DisabledMove], a + ld [wDisabledMove], a ld hl, DisabledNoMoreText call StdBattleTextBox .not_disabled - ld a, [PlayerSubStatus3] + ld a, [wPlayerSubStatus3] add a jr nc, .not_confused - ld hl, PlayerConfuseCount + ld hl, wPlayerConfuseCount dec [hl] jr nz, .confused - ld hl, PlayerSubStatus3 + ld hl, wPlayerSubStatus3 res SUBSTATUS_CONFUSED, [hl] ld hl, ConfusedNoMoreText call StdBattleTextBox @@ -286,7 +286,7 @@ CheckPlayerTurn: jr nc, .not_confused ; clear confusion-dependent substatus - ld hl, PlayerSubStatus3 + ld hl, wPlayerSubStatus3 ld a, [hl] and 1 << SUBSTATUS_CONFUSED ld [hl], a @@ -298,7 +298,7 @@ CheckPlayerTurn: .not_confused - ld a, [PlayerSubStatus1] + ld a, [wPlayerSubStatus1] add a ; bit SUBSTATUS_ATTRACT jr nc, .not_infatuated @@ -323,12 +323,12 @@ CheckPlayerTurn: ; We can't disable a move that doesn't exist. - ld a, [DisabledMove] + ld a, [wDisabledMove] and a jr z, .no_disabled_move ; Are we using the disabled move? - ld hl, CurPlayerMove + ld hl, wCurPlayerMove cp [hl] jr nz, .no_disabled_move @@ -339,7 +339,7 @@ CheckPlayerTurn: .no_disabled_move - ld hl, BattleMonStatus + ld hl, wBattleMonStatus bit PAR, [hl] ret z @@ -397,7 +397,7 @@ OpponentCantMove: ; 34216 CheckEnemyTurn: ; 3421f - ld hl, EnemySubStatus4 + ld hl, wEnemySubStatus4 bit SUBSTATUS_RECHARGE, [hl] jr z, .no_recharge @@ -410,13 +410,13 @@ CheckEnemyTurn: ; 3421f .no_recharge - ld hl, EnemyMonStatus + ld hl, wEnemyMonStatus ld a, [hl] and SLP jr z, .not_asleep dec a - ld [EnemyMonStatus], a + ld [wEnemyMonStatus], a and a jr z, .woke_up @@ -437,13 +437,13 @@ CheckEnemyTurn: ; 3421f call CallBattleCore ld a, $1 ld [hBGMapMode], a - ld hl, EnemySubStatus1 + ld hl, wEnemySubStatus1 res SUBSTATUS_NIGHTMARE, [hl] jr .not_asleep .fast_asleep ; Snore and Sleep Talk bypass sleep. - ld a, [CurEnemyMove] + ld a, [wCurEnemyMove] cp SNORE jr z, .not_asleep cp SLEEP_TALK @@ -454,12 +454,12 @@ CheckEnemyTurn: ; 3421f .not_asleep - ld hl, EnemyMonStatus + ld hl, wEnemyMonStatus bit FRZ, [hl] jr z, .not_frozen ; Flame Wheel and Sacred Fire thaw the user. - ld a, [CurEnemyMove] + ld a, [wCurEnemyMove] cp FLAME_WHEEL jr z, .not_frozen cp SACRED_FIRE @@ -473,7 +473,7 @@ CheckEnemyTurn: ; 3421f .not_frozen - ld hl, EnemySubStatus3 + ld hl, wEnemySubStatus3 bit SUBSTATUS_FLINCHED, [hl] jr z, .not_flinched @@ -487,7 +487,7 @@ CheckEnemyTurn: ; 3421f .not_flinched - ld hl, EnemyDisableCount + ld hl, wEnemyDisableCount ld a, [hl] and a jr z, .not_disabled @@ -498,7 +498,7 @@ CheckEnemyTurn: ; 3421f jr nz, .not_disabled ld [hl], a - ld [EnemyDisabledMove], a + ld [wEnemyDisabledMove], a ld hl, DisabledNoMoreText call StdBattleTextBox @@ -506,15 +506,15 @@ CheckEnemyTurn: ; 3421f .not_disabled - ld a, [EnemySubStatus3] + ld a, [wEnemySubStatus3] add a ; bit SUBSTATUS_CONFUSED jr nc, .not_confused - ld hl, EnemyConfuseCount + ld hl, wEnemyConfuseCount dec [hl] jr nz, .confused - ld hl, EnemySubStatus3 + ld hl, wEnemySubStatus3 res SUBSTATUS_CONFUSED, [hl] ld hl, ConfusedNoMoreText call StdBattleTextBox @@ -536,7 +536,7 @@ CheckEnemyTurn: ; 3421f jr nc, .not_confused ; clear confusion-dependent substatus - ld hl, EnemySubStatus3 + ld hl, wEnemySubStatus3 ld a, [hl] and 1 << SUBSTATUS_CONFUSED ld [hl], a @@ -565,7 +565,7 @@ CheckEnemyTurn: ; 3421f .not_confused - ld a, [EnemySubStatus1] + ld a, [wEnemySubStatus1] add a ; bit SUBSTATUS_ATTRACT jr nc, .not_infatuated @@ -590,12 +590,12 @@ CheckEnemyTurn: ; 3421f ; We can't disable a move that doesn't exist. - ld a, [EnemyDisabledMove] + ld a, [wEnemyDisabledMove] and a jr z, .no_disabled_move ; Are we using the disabled move? - ld hl, CurEnemyMove + ld hl, wCurEnemyMove cp [hl] jr nz, .no_disabled_move @@ -607,7 +607,7 @@ CheckEnemyTurn: ; 3421f .no_disabled_move - ld hl, EnemyMonStatus + ld hl, wEnemyMonStatus bit PAR, [hl] ret z @@ -656,7 +656,7 @@ HitConfusion: ; 343a5 call StdBattleTextBox xor a - ld [CriticalHit], a + ld [wCriticalHit], a call HitSelfInConfusion call BattleCommand_DamageCalc @@ -695,12 +695,12 @@ BattleCommand_CheckObedience: ; 343db ret nz ; If we've already checked this turn - ld a, [AlreadyDisobeyed] + ld a, [wAlreadyDisobeyed] and a ret nz xor a - ld [AlreadyDisobeyed], a + ld [wAlreadyDisobeyed], a ; No obedience in link battles ; (since no handling exists for enemy) @@ -708,7 +708,7 @@ BattleCommand_CheckObedience: ; 343db and a ret nz - ld a, [InBattleTowerBattle] + ld a, [wInBattleTowerBattle] and a ret nz @@ -717,11 +717,11 @@ BattleCommand_CheckObedience: ; 343db ld a, MON_ID call BattlePartyAttr - ld a, [PlayerID] + ld a, [wPlayerID] cp [hl] jr nz, .obeylevel inc hl - ld a, [PlayerID + 1] + ld a, [wPlayerID + 1] cp [hl] ret z @@ -762,7 +762,7 @@ BattleCommand_CheckObedience: ; 343db ld b, a ld c, a - ld a, [BattleMonLevel] + ld a, [wBattleMonLevel] ld d, a add b @@ -839,7 +839,7 @@ BattleCommand_CheckObedience: ; 343db and SLP jr z, .Nap - ld [BattleMonStatus], a + ld [wBattleMonStatus], a ld hl, BeganToNapText jr .Print @@ -872,18 +872,18 @@ BattleCommand_CheckObedience: ; 343db .UseInstead: ; Can't use another move if the monster only has one! - ld a, [BattleMonMoves + 1] + ld a, [wBattleMonMoves + 1] and a jr z, .DoNothing ; Don't bother trying to handle Disable. - ld a, [DisabledMove] + ld a, [wDisabledMove] and a jr nz, .DoNothing - ld hl, BattleMonPP - ld de, BattleMonMoves + ld hl, wBattleMonPP + ld de, wBattleMonMoves ld b, 0 ld c, NUM_MOVES @@ -904,8 +904,8 @@ BattleCommand_CheckObedience: ; 343db .CheckMovePP: - ld hl, BattleMonPP - ld a, [CurMoveNum] + ld hl, wBattleMonPP + ld a, [wCurMoveNum] ld e, a ld d, 0 add hl, de @@ -919,13 +919,13 @@ BattleCommand_CheckObedience: ; 343db ; Make sure we can actually use the move once we get there. ld a, 1 - ld [AlreadyDisobeyed], a + ld [wAlreadyDisobeyed], a ld a, [w2DMenuNumRows] ld b, a ; Save the move we originally picked for afterward. - ld a, [CurMoveNum] + ld a, [wCurMoveNum] ld c, a push af @@ -942,8 +942,8 @@ BattleCommand_CheckObedience: ; 343db jr z, .RandomMove ; Make sure it has PP. - ld [CurMoveNum], a - ld hl, BattleMonPP + ld [wCurMoveNum], a + ld hl, wBattleMonPP ld e, a ld d, 0 add hl, de @@ -953,13 +953,13 @@ BattleCommand_CheckObedience: ; 343db ; Use it. - ld a, [CurMoveNum] + ld a, [wCurMoveNum] ld c, a ld b, 0 - ld hl, BattleMonMoves + ld hl, wBattleMonMoves add hl, bc ld a, [hl] - ld [CurPlayerMove], a + ld [wCurPlayerMove], a call SetPlayerTurn call UpdateMoveData @@ -968,19 +968,19 @@ BattleCommand_CheckObedience: ; 343db ; Restore original move choice. pop af - ld [CurMoveNum], a + ld [wCurMoveNum], a .EndDisobedience: xor a - ld [LastPlayerMove], a - ld [LastPlayerCounterMove], a + ld [wLastPlayerMove], a + ld [wLastPlayerCounterMove], a ; Break Encore too. - ld hl, PlayerSubStatus5 + ld hl, wPlayerSubStatus5 res SUBSTATUS_ENCORED, [hl] xor a - ld [PlayerEncoreCount], a + ld [wPlayerEncoreCount], a jp EndMoveEffect @@ -1044,17 +1044,17 @@ BattleCommand_DoTurn: ; 34555 call CheckUserIsCharging ret nz - ld hl, BattleMonPP - ld de, PlayerSubStatus3 - ld bc, PlayerTurnsTaken + ld hl, wBattleMonPP + ld de, wPlayerSubStatus3 + ld bc, wPlayerTurnsTaken ld a, [hBattleTurn] and a jr z, .proceed - ld hl, EnemyMonPP - ld de, EnemySubStatus3 - ld bc, EnemyTurnsTaken + ld hl, wEnemyMonPP + ld de, wEnemySubStatus3 + ld bc, wEnemyTurnsTaken .proceed @@ -1088,8 +1088,8 @@ BattleCommand_DoTurn: ; 34555 ld a, [hBattleTurn] and a - ld hl, PartyMon1PP - ld a, [CurBattleMon] + ld hl, wPartyMon1PP + ld a, [wCurBattleMon] jr z, .player ; mimic this part entirely if wildbattle @@ -1097,8 +1097,8 @@ BattleCommand_DoTurn: ; 34555 dec a jr z, .wild - ld hl, OTPartyMon1PP - ld a, [CurOTMon] + ld hl, wOTPartyMon1PP + ld a, [wCurOTMon] .player call GetPartyLocation @@ -1110,9 +1110,9 @@ BattleCommand_DoTurn: ; 34555 .consume_pp ld a, [hBattleTurn] and a - ld a, [CurMoveNum] + ld a, [wCurMoveNum] jr z, .okay - ld a, [CurEnemyMoveNum] + ld a, [wCurEnemyMoveNum] .okay ld c, a @@ -1126,8 +1126,8 @@ BattleCommand_DoTurn: ; 34555 ret .wild - ld hl, EnemyMonMoves - ld a, [CurEnemyMoveNum] + ld hl, wEnemyMonMoves + ld a, [wCurEnemyMoveNum] ld c, a ld b, 0 add hl, bc @@ -1182,9 +1182,9 @@ BattleCommand_DoTurn: ; 34555 CheckMimicUsed: ; 3460b ld a, [hBattleTurn] and a - ld a, [CurMoveNum] + ld a, [wCurMoveNum] jr z, .player - ld a, [CurEnemyMoveNum] + ld a, [wCurEnemyMoveNum] .player ld c, a @@ -1218,7 +1218,7 @@ BattleCommand_Critical: ; 34631 ; Determine whether this attack's hit will be critical. xor a - ld [CriticalHit], a + ld [wCriticalHit], a ld a, BATTLE_VARS_MOVE_POWER call GetBattleVar @@ -1227,11 +1227,11 @@ BattleCommand_Critical: ; 34631 ld a, [hBattleTurn] and a - ld hl, EnemyMonItem - ld a, [EnemyMonSpecies] + ld hl, wEnemyMonItem + ld a, [wEnemyMonSpecies] jr nz, .Item - ld hl, BattleMonItem - ld a, [BattleMonSpecies] + ld hl, wBattleMonItem + ld a, [wBattleMonSpecies] .Item: ld c, 0 @@ -1299,7 +1299,7 @@ BattleCommand_Critical: ; 34631 cp [hl] ret nc ld a, 1 - ld [CriticalHit], a + ld [wCriticalHit], a ret INCLUDE "data/battle/critical_hits.asm" @@ -1312,7 +1312,7 @@ BattleCommand_TripleKick: ; 346b2 ld a, [wKickCounter] ld b, a inc b - ld hl, CurDamage + 1 + ld hl, wCurDamage + 1 ld a, [hld] ld e, a ld a, [hli] @@ -1354,11 +1354,11 @@ BattleCommand_Stab: ; 346d2 cp STRUGGLE ret z - ld hl, BattleMonType1 + ld hl, wBattleMonType1 ld a, [hli] ld b, a ld c, [hl] - ld hl, EnemyMonType1 + ld hl, wEnemyMonType1 ld a, [hli] ld d, a ld e, [hl] @@ -1367,11 +1367,11 @@ BattleCommand_Stab: ; 346d2 and a jr z, .go ; Who Attacks and who Defends - ld hl, EnemyMonType1 + ld hl, wEnemyMonType1 ld a, [hli] ld b, a ld c, [hl] - ld hl, BattleMonType1 + ld hl, wBattleMonType1 ld a, [hli] ld d, a ld e, [hl] @@ -1404,7 +1404,7 @@ BattleCommand_Stab: ; 346d2 jr .SkipStab .stab - ld hl, CurDamage + 1 + ld hl, wCurDamage + 1 ld a, [hld] ld h, [hl] ld l, a @@ -1416,11 +1416,11 @@ BattleCommand_Stab: ; 346d2 add hl, bc ld a, h - ld [CurDamage], a + ld [wCurDamage], a ld a, l - ld [CurDamage + 1], a + ld [wCurDamage + 1], a - ld hl, TypeModifier + ld hl, wTypeModifier set 7, [hl] .SkipStab: @@ -1459,7 +1459,7 @@ BattleCommand_Stab: ; 346d2 push hl push bc inc hl - ld a, [TypeModifier] + ld a, [wTypeModifier] and %10000000 ld b, a ; If the target is immune to the move, treat it as a miss and calculate the damage as 0 @@ -1467,17 +1467,17 @@ BattleCommand_Stab: ; 346d2 and a jr nz, .NotImmune inc a - ld [AttackMissed], a + ld [wAttackMissed], a xor a .NotImmune: ld [hMultiplier], a add b - ld [TypeModifier], a + ld [wTypeModifier], a xor a ld [hMultiplicand + 0], a - ld hl, CurDamage + ld hl, wCurDamage ld a, [hli] ld [hMultiplicand + 1], a ld a, [hld] @@ -1525,21 +1525,21 @@ BattleCommand_Stab: ; 346d2 call BattleCheckTypeMatchup ld a, [wTypeMatchup] ld b, a - ld a, [TypeModifier] + ld a, [wTypeModifier] and %10000000 or b - ld [TypeModifier], a + ld [wTypeModifier], a ret ; 347c8 BattleCheckTypeMatchup: ; 347c8 - ld hl, EnemyMonType1 + ld hl, wEnemyMonType1 ld a, [hBattleTurn] and a jr z, CheckTypeMatchup - ld hl, BattleMonType1 + ld hl, wBattleMonType1 CheckTypeMatchup: ; 347d3 ; There is an incorrect assumption about this function made in the AI related code: when ; the AI calls CheckTypeMatchup (not BattleCheckTypeMatchup), it assumes that placing @@ -1626,9 +1626,9 @@ BattleCommand_ResetTypeMatchup: ; 34833 jr nz, .reset call ResetDamage xor a - ld [TypeModifier], a + ld [wTypeModifier], a inc a - ld [AttackMissed], a + ld [wAttackMissed], a ret .reset @@ -1652,7 +1652,7 @@ BattleCommand_DamageVariation: ; 34cfd ; No point in reducing 1 or 0 damage. - ld hl, CurDamage + ld hl, wCurDamage ld a, [hli] and a jr nz, .go @@ -1688,7 +1688,7 @@ BattleCommand_DamageVariation: ; 34cfd ; ...to get .85-1.00x damage. ld a, [hQuotient + 1] - ld hl, CurDamage + ld hl, wCurDamage ld [hli], a ld a, [hQuotient + 2] ld [hl], a @@ -1776,7 +1776,7 @@ BattleCommand_CheckHit: ; 34d32 .Missed: ld a, 1 - ld [AttackMissed], a + ld [wAttackMissed], a ret @@ -1908,7 +1908,7 @@ BattleCommand_CheckHit: ; 34d32 cp EFFECT_THUNDER ret nz - ld a, [Weather] + ld a, [wBattleWeather] cp WEATHER_RAIN ret @@ -1927,17 +1927,17 @@ BattleCommand_CheckHit: ; 34d32 ; load the user's accuracy into b and the opponent's evasion into c. ld hl, wPlayerMoveStruct + MOVE_ACC - ld a, [PlayerAccLevel] + ld a, [wPlayerAccLevel] ld b, a - ld a, [EnemyEvaLevel] + ld a, [wEnemyEvaLevel] ld c, a jr z, .got_acc_eva ld hl, wEnemyMoveStruct + MOVE_ACC - ld a, [EnemyAccLevel] + ld a, [wEnemyAccLevel] ld b, a - ld a, [PlayerEvaLevel] + ld a, [wPlayerEvaLevel] ld c, a .got_acc_eva @@ -2020,7 +2020,7 @@ BattleCommand_EffectChance: ; 34ecc ; effectchance xor a - ld [EffectFailed], a + ld [wEffectFailed], a call CheckSubstituteOpp jr nz, .failed @@ -2039,7 +2039,7 @@ BattleCommand_EffectChance: ; 34ecc .failed ld a, 1 - ld [EffectFailed], a + ld [wEffectFailed], a and a ret @@ -2085,7 +2085,7 @@ BattleCommand_LowerSub: ; 34eee xor a ld [wNumHits], a - ld [FXAnimID + 1], a + ld [wFXAnimID + 1], a inc a ld [wKickCounter], a ld a, SUBSTITUTE @@ -2127,16 +2127,16 @@ BattleCommand_HitTarget: ; 34f57 BattleCommand_HitTargetNoSub: ; 34f60 - ld a, [AttackMissed] + ld a, [wAttackMissed] and a jp nz, BattleCommand_MoveDelay ld a, [hBattleTurn] and a - ld de, PlayerRolloutCount + ld de, wPlayerRolloutCount ld a, BATTLEANIM_ENEMY_DAMAGE jr z, .got_rollout_count - ld de, EnemyRolloutCount + ld de, wEnemyRolloutCount ld a, BATTLEANIM_PLAYER_DAMAGE .got_rollout_count @@ -2200,7 +2200,7 @@ BattleCommand_HitTargetNoSub: ; 34f60 BattleCommand_StatUpAnim: ; 34fd1 - ld a, [AttackMissed] + ld a, [wAttackMissed] and a jp nz, BattleCommand_MoveDelay @@ -2211,7 +2211,7 @@ BattleCommand_StatUpAnim: ; 34fd1 BattleCommand_StatDownAnim: ; 34fdb - ld a, [AttackMissed] + ld a, [wAttackMissed] and a jp nz, BattleCommand_MoveDelay @@ -2262,7 +2262,7 @@ BattleCommand_RaiseSub: ; 35004 xor a ld [wNumHits], a - ld [FXAnimID + 1], a + ld [wFXAnimID + 1], a ld a, $2 ld [wKickCounter], a ld a, SUBSTITUTE @@ -2276,7 +2276,7 @@ BattleCommand_FailureText: ; 35023 ; If the move missed or failed, load the appropriate ; text, and end the effects of multi-turn or multi- ; hit moves. - ld a, [AttackMissed] + ld a, [wAttackMissed] and a ret z @@ -2380,20 +2380,20 @@ BattleCommand_CheckFaint: ; 3505e bit SUBSTATUS_SUBSTITUTE, a ret nz - ld de, PlayerDamageTaken + 1 + ld de, wPlayerDamageTaken + 1 ld a, [hBattleTurn] and a jr nz, .damage_taken - ld de, EnemyDamageTaken + 1 + ld de, wEnemyDamageTaken + 1 .damage_taken - ld a, [CurDamage + 1] + ld a, [wCurDamage + 1] ld b, a ld a, [de] add b ld [de], a dec de - ld a, [CurDamage] + ld a, [wCurDamage] ld b, a ld a, [de] adc b @@ -2411,7 +2411,7 @@ BattleCommand_CheckFaint: ; 3505e GetFailureResultText: ; 350e4 ld hl, DoesntAffectText ld de, DoesntAffectText - ld a, [TypeModifier] + ld a, [wTypeModifier] and $7f jr z, .got_text ld a, BATTLE_VARS_MOVE_EFFECT @@ -2422,25 +2422,25 @@ GetFailureResultText: ; 350e4 jr z, .got_text ld hl, AttackMissedText ld de, AttackMissed2Text - ld a, [CriticalHit] + ld a, [wCriticalHit] cp -1 jr nz, .got_text ld hl, UnaffectedText .got_text call FailText_CheckOpponentProtect xor a - ld [CriticalHit], a + ld [wCriticalHit], a ld a, BATTLE_VARS_MOVE_EFFECT call GetBattleVar cp EFFECT_JUMP_KICK ret nz - ld a, [TypeModifier] + ld a, [wTypeModifier] and $7f ret z - ld hl, CurDamage + ld hl, wCurDamage ld a, [hli] ld b, [hl] rept 3 @@ -2480,11 +2480,11 @@ FailText_CheckOpponentProtect: ; 35157 BattleCommanda5: ; 35165 - ld a, [AttackMissed] + ld a, [wAttackMissed] and a ret z - ld a, [TypeModifier] + ld a, [wTypeModifier] and $7f jp z, PrintDoesntAffect jp PrintButItFailed @@ -2497,7 +2497,7 @@ BattleCommand_CriticalText: ; 35175 ; Prints the message for critical hits or one-hit KOs. ; If there is no message to be printed, wait 20 frames. - ld a, [CriticalHit] + ld a, [wCriticalHit] and a jr z, .wait @@ -2513,7 +2513,7 @@ BattleCommand_CriticalText: ; 35175 call StdBattleTextBox xor a - ld [CriticalHit], a + ld [wCriticalHit], a .wait ld c, 20 @@ -2528,11 +2528,11 @@ BattleCommand_CriticalText: ; 35175 BattleCommand_StartLoop: ; 35197 ; startloop - ld hl, PlayerRolloutCount + ld hl, wPlayerRolloutCount ld a, [hBattleTurn] and a jr z, .ok - ld hl, EnemyRolloutCount + ld hl, wEnemyRolloutCount .ok xor a ld [hl], a @@ -2556,7 +2556,7 @@ BattleCommand_SuperEffectiveLoopText: ; 351a5 BattleCommand_SuperEffectiveText: ; 351ad ; supereffectivetext - ld a, [TypeModifier] + ld a, [wTypeModifier] and $7f cp 10 ; 1.0 ret z @@ -2574,11 +2574,11 @@ BattleCommand_CheckDestinyBond: ; 351c0 ; Faint the user if it fainted an opponent using Destiny Bond. - ld hl, EnemyMonHP + ld hl, wEnemyMonHP ld a, [hBattleTurn] and a jr z, .got_hp - ld hl, BattleMonHP + ld hl, wBattleMonHP .got_hp ld a, [hli] @@ -2595,30 +2595,30 @@ BattleCommand_CheckDestinyBond: ; 351c0 ld a, [hBattleTurn] and a - ld hl, EnemyMonMaxHP + 1 + ld hl, wEnemyMonMaxHP + 1 bccoord 2, 2 ; hp bar ld a, 0 jr nz, .got_max_hp - ld hl, BattleMonMaxHP + 1 + ld hl, wBattleMonMaxHP + 1 bccoord 10, 9 ; hp bar ld a, 1 .got_max_hp ld [wWhichHPBar], a ld a, [hld] - ld [Buffer1], a + ld [wBuffer1], a ld a, [hld] - ld [Buffer2], a + ld [wBuffer2], a ld a, [hl] - ld [Buffer3], a + ld [wBuffer3], a xor a ld [hld], a ld a, [hl] - ld [Buffer4], a + ld [wBuffer4], a xor a ld [hl], a - ld [Buffer5], a - ld [Buffer6], a + ld [wBuffer5], a + ld [wBuffer6], a ld h, b ld l, c predef AnimateHPBar @@ -2627,7 +2627,7 @@ BattleCommand_CheckDestinyBond: ; 351c0 call BattleCommand_SwitchTurn xor a ld [wNumHits], a - ld [FXAnimID + 1], a + ld [wFXAnimID + 1], a inc a ld [wKickCounter], a ld a, DESTINY_BOND @@ -2665,7 +2665,7 @@ BattleCommand_BuildOpponentRage: ; 35250 jp .start .start - ld a, [AttackMissed] + ld a, [wAttackMissed] and a ret nz @@ -2696,10 +2696,10 @@ BattleCommand_BuildOpponentRage: ; 35250 BattleCommand_RageDamage: ; 3527b ; ragedamage - ld a, [CurDamage] + ld a, [wCurDamage] ld h, a ld b, a - ld a, [CurDamage + 1] + ld a, [wCurDamage + 1] ld l, a ld c, a ld a, [hBattleTurn] @@ -2716,18 +2716,18 @@ BattleCommand_RageDamage: ; 3527b ld hl, -1 .done ld a, h - ld [CurDamage], a + ld [wCurDamage], a ld a, l - ld [CurDamage + 1], a + ld [wCurDamage + 1], a ret ; 352a3 EndMoveEffect: ; 352a3 - ld a, [BattleScriptBufferAddress] + ld a, [wBattleScriptBufferAddress] ld l, a - ld a, [BattleScriptBufferAddress + 1] + ld a, [wBattleScriptBufferAddress + 1] ld h, a ld a, $ff ld [hli], a @@ -2745,7 +2745,7 @@ DittoMetalPowder: ; 352b1 and a ld a, [hl] jr nz, .Ditto - ld a, [TempEnemyMonSpecies] + ld a, [wTempEnemyMonSpecies] .Ditto: cp DITTO @@ -2804,51 +2804,51 @@ PlayerAttackDamage: ; 352e2 jr nc, .special .physical - ld hl, EnemyMonDefense + ld hl, wEnemyMonDefense ld a, [hli] ld b, a ld c, [hl] - ld a, [EnemyScreens] + ld a, [wEnemyScreens] bit SCREENS_REFLECT, a jr z, .physicalcrit sla c rl b .physicalcrit - ld hl, BattleMonAttack + ld hl, wBattleMonAttack call GetDamageStatsCritical jr c, .thickclub - ld hl, EnemyDefense + ld hl, wEnemyDefense ld a, [hli] ld b, a ld c, [hl] - ld hl, PlayerAttack + ld hl, wPlayerAttack jr .thickclub .special - ld hl, EnemyMonSpclDef + ld hl, wEnemyMonSpclDef ld a, [hli] ld b, a ld c, [hl] - ld a, [EnemyScreens] + ld a, [wEnemyScreens] bit SCREENS_LIGHT_SCREEN, a jr z, .specialcrit sla c rl b .specialcrit - ld hl, BattleMonSpclAtk + ld hl, wBattleMonSpclAtk call GetDamageStatsCritical jr c, .lightball - ld hl, EnemySpDef + ld hl, wEnemySpDef ld a, [hli] ld b, a ld c, [hl] - ld hl, PlayerSpAtk + ld hl, wPlayerSpAtk .lightball ; Note: Returns player special attack at hl in hl. @@ -2862,7 +2862,7 @@ PlayerAttackDamage: ; 352e2 .done call TruncateHL_BC - ld a, [BattleMonLevel] + ld a, [wBattleMonLevel] ld e, a call DittoMetalPowder @@ -2924,7 +2924,7 @@ TruncateHL_BC: ; 3534d GetDamageStatsCritical: ; 35378 ; Return carry if non-critical. - ld a, [CriticalHit] + ld a, [wCriticalHit] and a scf ret z @@ -2945,28 +2945,28 @@ GetDamageStats: ; 3537e ld a, [wPlayerMoveStructType] cp SPECIAL ; special - ld a, [PlayerSAtkLevel] + ld a, [wPlayerSAtkLevel] ld b, a - ld a, [EnemySDefLevel] + ld a, [wEnemySDefLevel] jr nc, .end ; physical - ld a, [PlayerAtkLevel] + ld a, [wPlayerAtkLevel] ld b, a - ld a, [EnemyDefLevel] + ld a, [wEnemyDefLevel] jr .end .enemy ld a, [wEnemyMoveStructType] cp SPECIAL ; special - ld a, [EnemySAtkLevel] + ld a, [wEnemySAtkLevel] ld b, a - ld a, [PlayerSDefLevel] + ld a, [wPlayerSDefLevel] jr nc, .end ; physical - ld a, [EnemyAtkLevel] + ld a, [wEnemyAtkLevel] ld b, a - ld a, [PlayerDefLevel] + ld a, [wPlayerDefLevel] .end cp b pop bc @@ -3030,7 +3030,7 @@ SpeciesItemBoost: ; 353d1 and a ld a, [hl] jr z, .CompareSpecies - ld a, [TempEnemyMonSpecies] + ld a, [wTempEnemyMonSpecies] .CompareSpecies: pop hl @@ -3070,50 +3070,50 @@ EnemyAttackDamage: ; 353f6 jr nc, .Special .physical - ld hl, BattleMonDefense + ld hl, wBattleMonDefense ld a, [hli] ld b, a ld c, [hl] - ld a, [PlayerScreens] + ld a, [wPlayerScreens] bit SCREENS_REFLECT, a jr z, .physicalcrit sla c rl b .physicalcrit - ld hl, EnemyMonAttack + ld hl, wEnemyMonAttack call GetDamageStatsCritical jr c, .thickclub - ld hl, PlayerDefense + ld hl, wPlayerDefense ld a, [hli] ld b, a ld c, [hl] - ld hl, EnemyAttack + ld hl, wEnemyAttack jr .thickclub .Special: - ld hl, BattleMonSpclDef + ld hl, wBattleMonSpclDef ld a, [hli] ld b, a ld c, [hl] - ld a, [PlayerScreens] + ld a, [wPlayerScreens] bit SCREENS_LIGHT_SCREEN, a jr z, .specialcrit sla c rl b .specialcrit - ld hl, EnemyMonSpclAtk + ld hl, wEnemyMonSpclAtk call GetDamageStatsCritical jr c, .lightball - ld hl, PlayerSpDef + ld hl, wPlayerSpDef ld a, [hli] ld b, a ld c, [hl] - ld hl, EnemySpAtk + ld hl, wEnemySpAtk .lightball call LightBallBoost @@ -3125,7 +3125,7 @@ EnemyAttackDamage: ; 353f6 .done call TruncateHL_BC - ld a, [EnemyMonLevel] + ld a, [wEnemyMonLevel] ld e, a call DittoMetalPowder @@ -3143,27 +3143,27 @@ BattleCommand_BeatUp: ; 35461 ld a, [hBattleTurn] and a jp nz, .enemy_beats_up - ld a, [PlayerSubStatus3] + ld a, [wPlayerSubStatus3] bit SUBSTATUS_IN_LOOP, a jr nz, .next_mon ld c, 20 call DelayFrames xor a - ld [PlayerRolloutCount], a + ld [wPlayerRolloutCount], a ld [wd002], a ld [wBeatUpHitAtLeastOnce], a jr .got_mon .next_mon - ld a, [PlayerRolloutCount] + ld a, [wPlayerRolloutCount] ld b, a - ld a, [PartyCount] + ld a, [wPartyCount] sub b ld [wd002], a .got_mon ld a, [wd002] - ld hl, PartyMonNicknames + ld hl, wPartyMonNicknames call GetNick ld a, MON_HP call GetBeatupMonLocation @@ -3172,11 +3172,11 @@ BattleCommand_BeatUp: ; 35461 jp z, .beatup_fail ; fainted ld a, [wd002] ld c, a - ld a, [CurBattleMon] + ld a, [wCurBattleMon] ; BUG: this can desynchronize link battles ; Change "cp [hl]" to "cp c" to fix cp [hl] - ld hl, BattleMonStatus + ld hl, wBattleMonStatus jr z, .active_mon ld a, MON_STATUS call GetBeatupMonLocation @@ -3189,18 +3189,18 @@ BattleCommand_BeatUp: ; 35461 ld [wBeatUpHitAtLeastOnce], a ld hl, BeatUpAttackText call StdBattleTextBox - ld a, [EnemyMonSpecies] - ld [CurSpecies], a + ld a, [wEnemyMonSpecies] + ld [wCurSpecies], a call GetBaseData - ld a, [BaseDefense] + ld a, [wBaseDefense] ld c, a push bc ld a, MON_SPECIES call GetBeatupMonLocation ld a, [hl] - ld [CurSpecies], a + ld [wCurSpecies], a call GetBaseData - ld a, [BaseAttack] + ld a, [wBaseAttack] pop bc ld b, a push bc @@ -3214,20 +3214,20 @@ BattleCommand_BeatUp: ; 35461 ret .enemy_beats_up - ld a, [EnemySubStatus3] + ld a, [wEnemySubStatus3] bit SUBSTATUS_IN_LOOP, a jr nz, .not_first_enemy_beatup xor a - ld [EnemyRolloutCount], a + ld [wEnemyRolloutCount], a ld [wd002], a ld [wBeatUpHitAtLeastOnce], a jr .enemy_continue .not_first_enemy_beatup - ld a, [EnemyRolloutCount] + ld a, [wEnemyRolloutCount] ld b, a - ld a, [OTPartyCount] + ld a, [wOTPartyCount] sub b ld [wd002], a .enemy_continue @@ -3239,14 +3239,14 @@ BattleCommand_BeatUp: ; 35461 and a jr nz, .link_or_tower - ld a, [InBattleTowerBattle] + ld a, [wInBattleTowerBattle] and a jr nz, .link_or_tower ld a, [wd002] ld c, a ld b, 0 - ld hl, OTPartySpecies + ld hl, wOTPartySpecies add hl, bc ld a, [hl] ld [wNamedObjectIndexBuffer], a @@ -3255,10 +3255,10 @@ BattleCommand_BeatUp: ; 35461 .link_or_tower ld a, [wd002] - ld hl, OTPartyMonNicknames + ld hl, wOTPartyMonNicknames ld bc, NAME_LENGTH call AddNTimes - ld de, StringBuffer1 + ld de, wStringBuffer1 call CopyBytes .got_enemy_nick ld a, MON_HP @@ -3268,9 +3268,9 @@ BattleCommand_BeatUp: ; 35461 jp z, .beatup_fail ld a, [wd002] ld b, a - ld a, [CurOTMon] + ld a, [wCurOTMon] cp b - ld hl, EnemyMonStatus + ld hl, wEnemyMonStatus jr z, .active_enemy ld a, MON_STATUS @@ -3285,7 +3285,7 @@ BattleCommand_BeatUp: ; 35461 jr .finish_beatup .wild - ld a, [EnemyMonSpecies] + ld a, [wEnemyMonSpecies] ld [wNamedObjectIndexBuffer], a call GetPokemonName ld hl, BeatUpAttackText @@ -3295,18 +3295,18 @@ BattleCommand_BeatUp: ; 35461 .finish_beatup ld hl, BeatUpAttackText call StdBattleTextBox - ld a, [BattleMonSpecies] - ld [CurSpecies], a + ld a, [wBattleMonSpecies] + ld [wCurSpecies], a call GetBaseData - ld a, [BaseDefense] + ld a, [wBaseDefense] ld c, a push bc ld a, MON_SPECIES call GetBeatupMonLocation ld a, [hl] - ld [CurSpecies], a + ld [wCurSpecies], a call GetBaseData - ld a, [BaseAttack] + ld a, [wBaseAttack] pop bc ld b, a push bc @@ -3345,9 +3345,9 @@ GetBeatupMonLocation: ; 355bd ld b, 0 ld a, [hBattleTurn] and a - ld hl, PartyMon1Species + ld hl, wPartyMon1Species jr z, .got_species - ld hl, OTPartyMon1Species + ld hl, wOTPartyMon1Species .got_species ld a, [wd002] @@ -3359,7 +3359,7 @@ GetBeatupMonLocation: ; 355bd BattleCommand_ClearMissDamage: ; 355d5 ; clearmissdamage - ld a, [AttackMissed] + ld a, [wAttackMissed] and a ret z @@ -3372,14 +3372,14 @@ HitSelfInConfusion: ; 355dd call ResetDamage ld a, [hBattleTurn] and a - ld hl, BattleMonDefense - ld de, PlayerScreens - ld a, [BattleMonLevel] + ld hl, wBattleMonDefense + ld de, wPlayerScreens + ld a, [wBattleMonLevel] jr z, .got_it - ld hl, EnemyMonDefense - ld de, EnemyScreens - ld a, [EnemyMonLevel] + ld hl, wEnemyMonDefense + ld de, wEnemyScreens + ld a, [wEnemyMonLevel] .got_it push af ld a, [hli] @@ -3536,8 +3536,8 @@ BattleCommand_DamageCalc: ; 35612 call .CriticalMultiplier -; Update CurDamage (capped at 997). - ld hl, CurDamage +; Update wCurDamage (capped at 997). + ld hl, wCurDamage ld b, [hl] ld a, [hProduct + 3] add b @@ -3617,7 +3617,7 @@ BattleCommand_DamageCalc: ; 35612 .CriticalMultiplier: - ld a, [CriticalHit] + ld a, [wCriticalHit] and a ret z @@ -3648,11 +3648,11 @@ INCLUDE "data/battle/type_boost_items.asm" BattleCommand_ConstantDamage: ; 35726 ; constantdamage - ld hl, BattleMonLevel + ld hl, wBattleMonLevel ld a, [hBattleTurn] and a jr z, .got_turn - ld hl, EnemyMonLevel + ld hl, wEnemyMonLevel .got_turn ld a, BATTLE_VARS_MOVE_EFFECT @@ -3695,11 +3695,11 @@ BattleCommand_ConstantDamage: ; 35726 jr .got_power .super_fang - ld hl, EnemyMonHP + ld hl, wEnemyMonHP ld a, [hBattleTurn] and a jr z, .got_hp - ld hl, BattleMonHP + ld hl, wBattleMonHP .got_hp ld a, [hli] srl a @@ -3718,17 +3718,17 @@ BattleCommand_ConstantDamage: ; 35726 jr .got_power .got_power - ld hl, CurDamage + ld hl, wCurDamage ld [hli], a ld [hl], b ret .reversal - ld hl, BattleMonHP + ld hl, wBattleMonHP ld a, [hBattleTurn] and a jr z, .reversal_got_hp - ld hl, EnemyMonHP + ld hl, wEnemyMonHP .reversal_got_hp xor a ld [hDividend], a @@ -3818,7 +3818,7 @@ BattleCommand_Counter: ; 35813 ; counter ld a, 1 - ld [AttackMissed], a + ld [wAttackMissed], a ld a, BATTLE_VARS_LAST_COUNTER_MOVE_OPP call GetBattleVar and a @@ -3841,18 +3841,18 @@ BattleCommand_Counter: ; 35813 ld a, BATTLE_VARS_LAST_COUNTER_MOVE_OPP call GetBattleVar dec a - ld de, StringBuffer1 + ld de, wStringBuffer1 call GetMoveData - ld a, [StringBuffer1 + MOVE_POWER] + ld a, [wStringBuffer1 + MOVE_POWER] and a ret z - ld a, [StringBuffer1 + MOVE_TYPE] + ld a, [wStringBuffer1 + MOVE_TYPE] cp SPECIAL ret nc - ld hl, CurDamage + ld hl, wCurDamage ld a, [hli] or [hl] ret z @@ -3870,7 +3870,7 @@ BattleCommand_Counter: ; 35813 .capped xor a - ld [AttackMissed], a + ld [wAttackMissed], a ret ; 35864 @@ -3879,13 +3879,13 @@ BattleCommand_Counter: ; 35813 BattleCommand_Encore: ; 35864 ; encore - ld hl, EnemyMonMoves - ld de, EnemyEncoreCount + ld hl, wEnemyMonMoves + ld de, wEnemyEncoreCount ld a, [hBattleTurn] and a jr z, .ok - ld hl, BattleMonMoves - ld de, PlayerEncoreCount + ld hl, wBattleMonMoves + ld de, wPlayerEncoreCount .ok ld a, BATTLE_VARS_LAST_MOVE_OPP call GetBattleVar @@ -3904,12 +3904,12 @@ BattleCommand_Encore: ; 35864 cp b jr nz, .got_move - ld bc, BattleMonPP - BattleMonMoves - 1 + ld bc, wBattleMonPP - wBattleMonMoves - 1 add hl, bc ld a, [hl] and PP_MASK jp z, .failed - ld a, [AttackMissed] + ld a, [wAttackMissed] and a jp nz, .failed ld a, BATTLE_VARS_SUBSTATUS5_OPP @@ -3930,10 +3930,10 @@ BattleCommand_Encore: ; 35864 jr z, .force_last_enemy_move push hl - ld a, [LastPlayerMove] + ld a, [wLastPlayerMove] ld b, a ld c, 0 - ld hl, BattleMonMoves + ld hl, wBattleMonMoves .find_player_move ld a, [hli] cp b @@ -3951,9 +3951,9 @@ BattleCommand_Encore: ; 35864 .got_player_move pop hl ld a, c - ld [CurMoveNum], a + ld [wCurMoveNum], a ld a, b - ld [CurPlayerMove], a + ld [wCurPlayerMove], a dec a ld de, wPlayerMoveStruct call GetMoveData @@ -3961,10 +3961,10 @@ BattleCommand_Encore: ; 35864 .force_last_enemy_move push hl - ld a, [LastEnemyMove] + ld a, [wLastEnemyMove] ld b, a ld c, 0 - ld hl, EnemyMonMoves + ld hl, wEnemyMonMoves .find_enemy_move ld a, [hli] cp b @@ -3982,9 +3982,9 @@ BattleCommand_Encore: ; 35864 .got_enemy_move pop hl ld a, c - ld [CurEnemyMoveNum], a + ld [wCurEnemyMoveNum], a ld a, b - ld [CurEnemyMove], a + ld [wCurEnemyMove], a dec a ld de, wEnemyMoveStruct call GetMoveData @@ -4003,28 +4003,28 @@ BattleCommand_Encore: ; 35864 BattleCommand_PainSplit: ; 35926 ; painsplit - ld a, [AttackMissed] + ld a, [wAttackMissed] and a jp nz, .ButItFailed call CheckSubstituteOpp jp nz, .ButItFailed call AnimateCurrentMove - ld hl, BattleMonMaxHP + 1 - ld de, EnemyMonMaxHP + 1 + ld hl, wBattleMonMaxHP + 1 + ld de, wEnemyMonMaxHP + 1 call .PlayerShareHP ld a, $1 ld [wWhichHPBar], a hlcoord 10, 9 predef AnimateHPBar - ld hl, EnemyMonHP + ld hl, wEnemyMonHP ld a, [hli] - ld [Buffer4], a + ld [wBuffer4], a ld a, [hli] - ld [Buffer3], a + ld [wBuffer3], a ld a, [hli] - ld [Buffer2], a + ld [wBuffer2], a ld a, [hl] - ld [Buffer1], a + ld [wBuffer1], a call .EnemyShareHP xor a ld [wWhichHPBar], a @@ -4038,28 +4038,28 @@ BattleCommand_PainSplit: ; 35926 .PlayerShareHP: ld a, [hld] - ld [Buffer1], a + ld [wBuffer1], a ld a, [hld] - ld [Buffer2], a + ld [wBuffer2], a ld a, [hld] ld b, a - ld [Buffer3], a + ld [wBuffer3], a ld a, [hl] - ld [Buffer4], a + ld [wBuffer4], a dec de dec de ld a, [de] dec de add b - ld [CurDamage + 1], a + ld [wCurDamage + 1], a ld b, [hl] ld a, [de] adc b srl a - ld [CurDamage], a - ld a, [CurDamage + 1] + ld [wCurDamage], a + ld a, [wCurDamage + 1] rr a - ld [CurDamage + 1], a + ld [wCurDamage + 1], a inc hl inc hl inc hl @@ -4070,25 +4070,25 @@ BattleCommand_PainSplit: ; 35926 .EnemyShareHP: ; 359ac ld c, [hl] dec hl - ld a, [CurDamage + 1] + ld a, [wCurDamage + 1] sub c ld b, [hl] dec hl - ld a, [CurDamage] + ld a, [wCurDamage] sbc b jr nc, .skip - ld a, [CurDamage] + ld a, [wCurDamage] ld b, a - ld a, [CurDamage + 1] + ld a, [wCurDamage + 1] ld c, a .skip ld a, c ld [hld], a - ld [Buffer5], a + ld [wBuffer5], a ld a, b ld [hli], a - ld [Buffer6], a + ld [wBuffer6], a ret ; 359cd @@ -4107,7 +4107,7 @@ BattleCommand_Snore: ; 359d0 ret nz call ResetDamage ld a, $1 - ld [AttackMissed], a + ld [wAttackMissed], a call FailSnore jp EndMoveEffect @@ -4117,14 +4117,14 @@ BattleCommand_Snore: ; 359d0 BattleCommand_Conversion2: ; 359e6 ; conversion2 - ld a, [AttackMissed] + ld a, [wAttackMissed] and a jr nz, .failed - ld hl, BattleMonType1 + ld hl, wBattleMonType1 ld a, [hBattleTurn] and a jr z, .got_type - ld hl, EnemyMonType1 + ld hl, wEnemyMonType1 .got_type ld a, BATTLE_VARS_LAST_COUNTER_MOVE_OPP call GetBattleVar @@ -4188,7 +4188,7 @@ BattleCommand_LockOn: ; 35a53 call CheckSubstituteOpp jr nz, .fail - ld a, [AttackMissed] + ld a, [wAttackMissed] and a jr nz, .fail @@ -4235,11 +4235,11 @@ BattleCommand_Sketch: ; 35a74 ld d, h ld e, l ; Get the battle move structs. - ld hl, BattleMonMoves + ld hl, wBattleMonMoves ld a, [hBattleTurn] and a jr z, .get_last_move - ld hl, EnemyMonMoves + ld hl, wEnemyMonMoves .get_last_move ld a, BATTLE_VARS_LAST_COUNTER_MOVE_OPP call GetBattleVar @@ -4278,7 +4278,7 @@ BattleCommand_Sketch: ; 35a74 ld hl, Moves + MOVE_PP call GetMoveAttr pop hl - ld bc, BattleMonPP - BattleMonMoves + ld bc, wBattleMonPP - wBattleMonMoves add hl, bc ld [hl], a pop bc @@ -4361,17 +4361,17 @@ BattleCommand_SleepTalk: ; 35b33 ; sleeptalk call ClearLastMove - ld a, [AttackMissed] + ld a, [wAttackMissed] and a jr nz, .fail ld a, [hBattleTurn] and a - ld hl, BattleMonMoves + 1 - ld a, [DisabledMove] + ld hl, wBattleMonMoves + 1 + ld a, [wDisabledMove] ld d, a jr z, .got_moves - ld hl, EnemyMonMoves + 1 - ld a, [EnemyDisabledMove] + ld hl, wEnemyMonMoves + 1 + ld a, [wEnemyDisabledMove] ld d, a .got_moves ld a, BATTLE_VARS_STATUS @@ -4438,10 +4438,10 @@ BattleCommand_SleepTalk: ; 35b33 .check_has_usable_move ld a, [hBattleTurn] and a - ld a, [DisabledMove] + ld a, [wDisabledMove] jr z, .got_move_2 - ld a, [EnemyDisabledMove] + ld a, [wEnemyDisabledMove] .got_move_2 ld b, a ld a, BATTLE_VARS_MOVE @@ -4520,15 +4520,15 @@ BattleCommand_DestinyBond: ; 35bff BattleCommand_Spite: ; 35c0f ; spite - ld a, [AttackMissed] + ld a, [wAttackMissed] and a jp nz, .failed ld bc, PARTYMON_STRUCT_LENGTH ; ???? - ld hl, EnemyMonMoves + ld hl, wEnemyMonMoves ld a, [hBattleTurn] and a jr z, .got_moves - ld hl, BattleMonMoves + ld hl, wBattleMonMoves .got_moves ld a, BATTLE_VARS_LAST_COUNTER_MOVE_OPP call GetBattleVar @@ -4547,7 +4547,7 @@ BattleCommand_Spite: ; 35c0f dec hl ld b, 0 push bc - ld c, BattleMonPP - BattleMonMoves + ld c, wBattleMonPP - wBattleMonMoves add hl, bc pop bc ld a, [hl] @@ -4610,13 +4610,13 @@ BattleCommand_Spite: ; 35c0f BattleCommand_FalseSwipe: ; 35c94 ; falseswipe - ld hl, EnemyMonHP + ld hl, wEnemyMonHP ld a, [hBattleTurn] and a jr z, .got_hp - ld hl, BattleMonHP + ld hl, wBattleMonHP .got_hp - ld de, CurDamage + ld de, wCurDamage ld c, 2 push hl push de @@ -4637,11 +4637,11 @@ BattleCommand_FalseSwipe: ; 35c94 dec a ld [de], a .okay - ld a, [CriticalHit] + ld a, [wCriticalHit] cp 2 jr nz, .carry xor a - ld [CriticalHit], a + ld [wCriticalHit], a .carry scf ret @@ -4659,11 +4659,11 @@ BattleCommand_HealBell: ; 35cc9 ld a, BATTLE_VARS_SUBSTATUS1 call GetBattleVarAddr res SUBSTATUS_NIGHTMARE, [hl] - ld de, PartyMon1Status + ld de, wPartyMon1Status ld a, [hBattleTurn] and a jr z, .got_status - ld de, OTPartyMon1Status + ld de, wOTPartyMon1Status .got_status ld a, BATTLE_VARS_STATUS call GetBattleVarAddr @@ -4704,9 +4704,9 @@ FarPlayBattleAnimation: ; 35d00 PlayFXAnimID: ; 35d08 ld a, e - ld [FXAnimID], a + ld [wFXAnimID], a ld a, d - ld [FXAnimID + 1], a + ld [wFXAnimID + 1], a ld c, 3 call DelayFrames @@ -4719,7 +4719,7 @@ PlayFXAnimID: ; 35d08 EnemyHurtItself: ; 35d1c - ld hl, CurDamage + ld hl, wCurDamage ld a, [hli] ld b, a ld a, [hl] @@ -4730,46 +4730,46 @@ EnemyHurtItself: ; 35d1c and a jr nz, .mimic_sub_check - ld a, [EnemySubStatus4] + ld a, [wEnemySubStatus4] bit SUBSTATUS_SUBSTITUTE, a jp nz, SelfInflictDamageToSubstitute .mimic_sub_check ld a, [hld] ld b, a - ld a, [EnemyMonHP + 1] - ld [Buffer3], a + ld a, [wEnemyMonHP + 1] + ld [wBuffer3], a sub b - ld [EnemyMonHP + 1], a + ld [wEnemyMonHP + 1], a ld a, [hl] ld b, a - ld a, [EnemyMonHP] - ld [Buffer4], a + ld a, [wEnemyMonHP] + ld [wBuffer4], a sbc b - ld [EnemyMonHP], a + ld [wEnemyMonHP], a jr nc, .mimic_faint - ld a, [Buffer4] + ld a, [wBuffer4] ld [hli], a - ld a, [Buffer3] + ld a, [wBuffer3] ld [hl], a xor a - ld hl, EnemyMonHP + ld hl, wEnemyMonHP ld [hli], a ld [hl], a .mimic_faint - ld hl, EnemyMonMaxHP + ld hl, wEnemyMonMaxHP ld a, [hli] - ld [Buffer2], a + ld [wBuffer2], a ld a, [hl] - ld [Buffer1], a - ld hl, EnemyMonHP + ld [wBuffer1], a + ld hl, wEnemyMonHP ld a, [hli] - ld [Buffer6], a + ld [wBuffer6], a ld a, [hl] - ld [Buffer5], a + ld [wBuffer5], a hlcoord 2, 2 xor a ld [wWhichHPBar], a @@ -4781,7 +4781,7 @@ EnemyHurtItself: ; 35d1c PlayerHurtItself: ; 35d7e - ld hl, CurDamage + ld hl, wCurDamage ld a, [hli] ld b, a ld a, [hl] @@ -4792,44 +4792,44 @@ PlayerHurtItself: ; 35d7e and a jr nz, .mimic_sub_check - ld a, [PlayerSubStatus4] + ld a, [wPlayerSubStatus4] bit SUBSTATUS_SUBSTITUTE, a jp nz, SelfInflictDamageToSubstitute .mimic_sub_check ld a, [hld] ld b, a - ld a, [BattleMonHP + 1] - ld [Buffer3], a + ld a, [wBattleMonHP + 1] + ld [wBuffer3], a sub b - ld [BattleMonHP + 1], a - ld [Buffer5], a + ld [wBattleMonHP + 1], a + ld [wBuffer5], a ld b, [hl] - ld a, [BattleMonHP] - ld [Buffer4], a + ld a, [wBattleMonHP] + ld [wBuffer4], a sbc b - ld [BattleMonHP], a - ld [Buffer6], a + ld [wBattleMonHP], a + ld [wBuffer6], a jr nc, .mimic_faint - ld a, [Buffer4] + ld a, [wBuffer4] ld [hli], a - ld a, [Buffer3] + ld a, [wBuffer3] ld [hl], a xor a - ld hl, BattleMonHP + ld hl, wBattleMonHP ld [hli], a ld [hl], a - ld hl, Buffer5 + ld hl, wBuffer5 ld [hli], a ld [hl], a .mimic_faint - ld hl, BattleMonMaxHP + ld hl, wBattleMonMaxHP ld a, [hli] - ld [Buffer2], a + ld [wBuffer2], a ld a, [hl] - ld [Buffer1], a + ld [wBuffer1], a hlcoord 10, 9 ld a, $1 ld [wWhichHPBar], a @@ -4845,14 +4845,14 @@ SelfInflictDamageToSubstitute: ; 35de0 ld hl, SubTookDamageText call StdBattleTextBox - ld de, EnemySubstituteHP + ld de, wEnemySubstituteHP ld a, [hBattleTurn] and a jr z, .got_hp - ld de, PlayerSubstituteHP + ld de, wPlayerSubstituteHP .got_hp - ld hl, CurDamage + ld hl, wCurDamage ld a, [hli] and a jr nz, .broke @@ -4910,7 +4910,7 @@ UpdateMoveData: ; 35e40 ld a, BATTLE_VARS_MOVE call GetBattleVar - ld [CurMove], a + ld [wCurMove], a ld [wNamedObjectIndexBuffer], a dec a @@ -4945,7 +4945,7 @@ BattleCommand_SleepTarget: ; 35e5c ld hl, AlreadyAsleepText jr nz, .fail - ld a, [AttackMissed] + ld a, [wAttackMissed] and a jp nz, PrintDidntAffect2 @@ -4962,7 +4962,7 @@ BattleCommand_SleepTarget: ; 35e5c call AnimateCurrentMove ld b, $7 - ld a, [InBattleTowerBattle] + ld a, [wInBattleTowerBattle] and a jr z, .random_loop ld b, $3 @@ -5006,12 +5006,12 @@ BattleCommand_SleepTarget: ; 35e5c and a jr nz, .dont_fail - ld a, [InBattleTowerBattle] + ld a, [wInBattleTowerBattle] and a jr nz, .dont_fail ; Not locked-on by the enemy - ld a, [PlayerSubStatus5] + ld a, [wPlayerSubStatus5] bit SUBSTATUS_LOCK_ON, a jr nz, .dont_fail @@ -5035,7 +5035,7 @@ BattleCommand_PoisonTarget: ; 35eee call GetBattleVarAddr and a ret nz - ld a, [TypeModifier] + ld a, [wTypeModifier] and $7f ret z call CheckIfTargetIsPoisonType @@ -5044,7 +5044,7 @@ BattleCommand_PoisonTarget: ; 35eee ld a, b cp HELD_PREVENT_POISON ret z - ld a, [EffectFailed] + ld a, [wEffectFailed] and a ret nz call SafeCheckSafeguard @@ -5068,7 +5068,7 @@ BattleCommand_Poison: ; 35f2c ; poison ld hl, DoesntAffectText - ld a, [TypeModifier] + ld a, [wTypeModifier] and $7f jp z, .failed @@ -5107,11 +5107,11 @@ BattleCommand_Poison: ; 35f2c and a jr nz, .mimic_random - ld a, [InBattleTowerBattle] + ld a, [wInBattleTowerBattle] and a jr nz, .mimic_random - ld a, [PlayerSubStatus5] + ld a, [wPlayerSubStatus5] bit SUBSTATUS_LOCK_ON, a jr nz, .mimic_random @@ -5122,7 +5122,7 @@ BattleCommand_Poison: ; 35f2c .mimic_random call CheckSubstituteOpp jr nz, .failed - ld a, [AttackMissed] + ld a, [wAttackMissed] and a jr nz, .failed call .check_toxic @@ -5168,9 +5168,9 @@ BattleCommand_Poison: ; 35f2c call GetBattleVarAddr ld a, [hBattleTurn] and a - ld de, EnemyToxicCount + ld de, wEnemyToxicCount jr z, .ok - ld de, PlayerToxicCount + ld de, wPlayerToxicCount .ok ld a, BATTLE_VARS_MOVE_EFFECT call GetBattleVar @@ -5181,11 +5181,11 @@ BattleCommand_Poison: ; 35f2c CheckIfTargetIsPoisonType: ; 35fe1 - ld de, EnemyMonType1 + ld de, wEnemyMonType1 ld a, [hBattleTurn] and a jr z, .ok - ld de, BattleMonType1 + ld de, wBattleMonType1 .ok ld a, [de] inc de @@ -5226,7 +5226,7 @@ BattleCommand_EatDream: ; 36008 SapHealth: ; 36011 - ld hl, CurDamage + ld hl, wCurDamage ld a, [hli] srl a ld [hDividend], a @@ -5239,15 +5239,15 @@ SapHealth: ; 36011 ld a, $1 ld [hDividend + 1], a .ok1 - ld hl, BattleMonHP - ld de, BattleMonMaxHP + ld hl, wBattleMonHP + ld de, wBattleMonMaxHP ld a, [hBattleTurn] and a jr z, .battlemonhp - ld hl, EnemyMonHP - ld de, EnemyMonMaxHP + ld hl, wEnemyMonHP + ld de, wEnemyMonMaxHP .battlemonhp - ld bc, Buffer4 + ld bc, wBuffer4 ld a, [hli] ld [bc], a ld a, [hl] @@ -5264,12 +5264,12 @@ SapHealth: ; 36011 ld b, [hl] add b ld [hld], a - ld [Buffer5], a + ld [wBuffer5], a ld a, [hDividend] ld b, [hl] adc b ld [hli], a - ld [Buffer6], a + ld [wBuffer6], a jr c, .okay2 ld a, [hld] ld b, a @@ -5285,11 +5285,11 @@ SapHealth: ; 36011 .okay2 ld a, [de] ld [hld], a - ld [Buffer5], a + ld [wBuffer5], a dec de ld a, [de] ld [hli], a - ld [Buffer6], a + ld [wBuffer6], a inc de .okay3 ld a, [hBattleTurn] @@ -5319,7 +5319,7 @@ BattleCommand_BurnTarget: ; 3608c call GetBattleVarAddr and a jp nz, Defrost - ld a, [TypeModifier] + ld a, [wTypeModifier] and $7f ret z call CheckMoveTypeMatchesTarget ; Don't burn a Fire-type @@ -5328,7 +5328,7 @@ BattleCommand_BurnTarget: ; 3608c ld a, b cp HELD_PREVENT_BURN ret z - ld a, [EffectFailed] + ld a, [wEffectFailed] and a ret nz call SafeCheckSafeguard @@ -5362,11 +5362,11 @@ Defrost: ; 360dd ld a, [hBattleTurn] and a - ld a, [CurOTMon] - ld hl, OTPartyMon1Status + ld a, [wCurOTMon] + ld hl, wOTPartyMon1Status jr z, .ok - ld hl, PartyMon1Status - ld a, [CurBattleMon] + ld hl, wPartyMon1Status + ld a, [wCurBattleMon] .ok call GetPartyLocation @@ -5391,10 +5391,10 @@ BattleCommand_FreezeTarget: ; 36102 call GetBattleVarAddr and a ret nz - ld a, [TypeModifier] + ld a, [wTypeModifier] and $7f ret z - ld a, [Weather] + ld a, [wBattleWeather] cp WEATHER_SUN ret z call CheckMoveTypeMatchesTarget ; Don't freeze an Ice-type @@ -5403,7 +5403,7 @@ BattleCommand_FreezeTarget: ; 36102 ld a, b cp HELD_PREVENT_FREEZE ret z - ld a, [EffectFailed] + ld a, [wEffectFailed] and a ret nz call SafeCheckSafeguard @@ -5447,14 +5447,14 @@ BattleCommand_ParalyzeTarget: ; 36165 call GetBattleVarAddr and a ret nz - ld a, [TypeModifier] + ld a, [wTypeModifier] and $7f ret z call GetOpponentItem ld a, b cp HELD_PREVENT_PARALYZE ret z - ld a, [EffectFailed] + ld a, [wEffectFailed] and a ret nz call SafeCheckSafeguard @@ -5548,7 +5548,7 @@ BattleCommand_EvasionUp2: ; 361e0 BattleCommand_StatUp: ; 361e4 ; statup call CheckIfStatCanBeRaised - ld a, [FailedMessage] + ld a, [wFailedMessage] and a ret nz jp StatUpAnimation @@ -5558,20 +5558,20 @@ BattleCommand_StatUp: ; 361e4 CheckIfStatCanBeRaised: ; 361ef ld a, b - ld [LoweredStat], a - ld hl, PlayerStatLevels + ld [wLoweredStat], a + ld hl, wPlayerStatLevels ld a, [hBattleTurn] and a jr z, .got_stat_levels - ld hl, EnemyStatLevels + ld hl, wEnemyStatLevels .got_stat_levels - ld a, [AttackMissed] + ld a, [wAttackMissed] and a jp nz, .stat_raise_failed - ld a, [EffectFailed] + ld a, [wEffectFailed] and a jp nz, .stat_raise_failed - ld a, [LoweredStat] + ld a, [wLoweredStat] and $f ld c, a ld b, 0 @@ -5581,7 +5581,7 @@ CheckIfStatCanBeRaised: ; 361ef ld a, $d cp b jp c, .cant_raise_stat - ld a, [LoweredStat] + ld a, [wLoweredStat] and $f0 jr z, .got_num_stages inc b @@ -5595,13 +5595,13 @@ CheckIfStatCanBeRaised: ; 361ef ld a, c cp $5 jr nc, .done_calcing_stats - ld hl, BattleMonStats + 1 - ld de, PlayerStats + ld hl, wBattleMonStats + 1 + ld de, wPlayerStats ld a, [hBattleTurn] and a jr z, .got_stats_pointer - ld hl, EnemyMonStats + 1 - ld de, EnemyStats + ld hl, wEnemyMonStats + 1 + ld de, wEnemyStats .got_stats_pointer push bc sla c @@ -5632,7 +5632,7 @@ CheckIfStatCanBeRaised: ; 361ef .done_calcing_stats pop hl xor a - ld [FailedMessage], a + ld [wFailedMessage], a ret ; 3626e @@ -5647,9 +5647,9 @@ CheckIfStatCanBeRaised: ; 361ef .cant_raise_stat ; 36270 ld a, $2 - ld [FailedMessage], a + ld [wFailedMessage], a ld a, $1 - ld [AttackMissed], a + ld [wAttackMissed], a ret ; 3627b @@ -5657,7 +5657,7 @@ CheckIfStatCanBeRaised: ; 361ef .stat_raise_failed ; 3627b ld a, $1 - ld [FailedMessage], a + ld [wFailedMessage], a ret ; 36281 @@ -5763,20 +5763,20 @@ BattleCommand_EvasionDown2: ; 362e1 BattleCommand_StatDown: ; 362e3 ; statdown - ld [LoweredStat], a + ld [wLoweredStat], a call CheckMist jp nz, .Mist - ld hl, EnemyStatLevels + ld hl, wEnemyStatLevels ld a, [hBattleTurn] and a jr z, .GetStatLevel - ld hl, PlayerStatLevels + ld hl, wPlayerStatLevels .GetStatLevel: ; Attempt to lower the stat. - ld a, [LoweredStat] + ld a, [wLoweredStat] and $f ld c, a ld b, 0 @@ -5786,7 +5786,7 @@ BattleCommand_StatDown: ; 362e3 jp z, .CantLower ; Sharply lower the stat if applicable. - ld a, [LoweredStat] + ld a, [wLoweredStat] and $f0 jr z, .ComputerMiss dec b @@ -5803,12 +5803,12 @@ BattleCommand_StatDown: ; 362e3 and a jr nz, .DidntMiss - ld a, [InBattleTowerBattle] + ld a, [wInBattleTowerBattle] and a jr nz, .DidntMiss ; Lock-On still always works. - ld a, [PlayerSubStatus5] + ld a, [wPlayerSubStatus5] bit SUBSTATUS_LOCK_ON, a jr nz, .DidntMiss @@ -5826,11 +5826,11 @@ BattleCommand_StatDown: ; 362e3 call CheckSubstituteOpp jr nz, .Failed - ld a, [AttackMissed] + ld a, [wAttackMissed] and a jr nz, .Failed - ld a, [EffectFailed] + ld a, [wEffectFailed] and a jr nz, .Failed @@ -5844,13 +5844,13 @@ BattleCommand_StatDown: ; 362e3 jr nc, .Hit push hl - ld hl, EnemyMonAttack + 1 - ld de, EnemyStats + ld hl, wEnemyMonAttack + 1 + ld de, wEnemyStats ld a, [hBattleTurn] and a jr z, .do_enemy - ld hl, BattleMonAttack + 1 - ld de, PlayerStats + ld hl, wBattleMonAttack + 1 + ld de, wPlayerStats .do_enemy call TryLowerStat pop hl @@ -5858,29 +5858,29 @@ BattleCommand_StatDown: ; 362e3 .Hit: xor a - ld [FailedMessage], a + ld [wFailedMessage], a ret .CouldntLower: inc [hl] .CantLower: ld a, 3 - ld [FailedMessage], a + ld [wFailedMessage], a ld a, 1 - ld [AttackMissed], a + ld [wAttackMissed], a ret .Failed: ld a, 1 - ld [FailedMessage], a - ld [AttackMissed], a + ld [wFailedMessage], a + ld [wAttackMissed], a ret .Mist: ld a, 2 - ld [FailedMessage], a + ld [wFailedMessage], a ld a, 1 - ld [AttackMissed], a + ld [wAttackMissed], a ret ; 36391 @@ -5915,10 +5915,10 @@ CheckMist: ; 36391 BattleCommand_StatUpMessage: ; 363b8 - ld a, [FailedMessage] + ld a, [wFailedMessage] and a ret nz - ld a, [LoweredStat] + ld a, [wLoweredStat] and $f ld b, a inc b @@ -5930,7 +5930,7 @@ BattleCommand_StatUpMessage: ; 363b8 text_jump UnknownText_0x1c0cc6 start_asm ld hl, .up - ld a, [LoweredStat] + ld a, [wLoweredStat] and $f0 ret z ld hl, .wayup @@ -5948,10 +5948,10 @@ BattleCommand_StatUpMessage: ; 363b8 BattleCommand_StatDownMessage: ; 363e9 - ld a, [FailedMessage] + ld a, [wFailedMessage] and a ret nz - ld a, [LoweredStat] + ld a, [wLoweredStat] and $f ld b, a inc b @@ -5963,7 +5963,7 @@ BattleCommand_StatDownMessage: ; 363e9 text_jump UnknownText_0x1c0ceb start_asm ld hl, .fell - ld a, [LoweredStat] + ld a, [wLoweredStat] and $f0 ret z ld hl, .sharplyfell @@ -6027,7 +6027,7 @@ TryLowerStat: ; 3641a BattleCommand_StatUpFailText: ; 3644c ; statupfailtext - ld a, [FailedMessage] + ld a, [wFailedMessage] and a ret z push af @@ -6035,7 +6035,7 @@ BattleCommand_StatUpFailText: ; 3644c pop af dec a jp z, TryPrintButItFailed - ld a, [LoweredStat] + ld a, [wLoweredStat] and $f ld b, a inc b @@ -6048,7 +6048,7 @@ BattleCommand_StatUpFailText: ; 3644c BattleCommand_StatDownFailText: ; 3646a ; statdownfailtext - ld a, [FailedMessage] + ld a, [wFailedMessage] and a ret z push af @@ -6059,7 +6059,7 @@ BattleCommand_StatDownFailText: ; 3646a dec a ld hl, ProtectedByMistText jp z, StdBattleTextBox - ld a, [LoweredStat] + ld a, [wLoweredStat] and $f ld b, a inc b @@ -6083,8 +6083,8 @@ GetStatName: ; 3648f jr .GetName .Copy: - ld de, StringBuffer2 - ld bc, StringBuffer3 - StringBuffer2 + ld de, wStringBuffer2 + ld bc, wStringBuffer3 - wStringBuffer2 jp CopyBytes INCLUDE "data/battle/stat_names.asm" @@ -6125,23 +6125,23 @@ BattleCommand_AllStatsUp: ; 36500 ResetMiss: ; 3652d xor a - ld [AttackMissed], a + ld [wAttackMissed], a ret ; 36532 LowerStat: ; 36532 - ld [LoweredStat], a + ld [wLoweredStat], a - ld hl, PlayerStatLevels + ld hl, wPlayerStatLevels ld a, [hBattleTurn] and a jr z, .got_target - ld hl, EnemyStatLevels + ld hl, wEnemyStatLevels .got_target - ld a, [LoweredStat] + ld a, [wLoweredStat] and $f ld c, a ld b, 0 @@ -6150,7 +6150,7 @@ LowerStat: ; 36532 dec b jr z, .cant_lower_anymore - ld a, [LoweredStat] + ld a, [wLoweredStat] and $f0 jr z, .got_num_stages dec b @@ -6164,13 +6164,13 @@ LowerStat: ; 36532 jr nc, .accuracy_evasion push hl - ld hl, BattleMonStats + 1 - ld de, PlayerStats + ld hl, wBattleMonStats + 1 + ld de, wPlayerStats ld a, [hBattleTurn] and a jr z, .got_target_2 - ld hl, EnemyMonStats + 1 - ld de, EnemyStats + ld hl, wEnemyMonStats + 1 + ld de, wEnemyStats .got_target_2 call TryLowerStat @@ -6191,7 +6191,7 @@ LowerStat: ; 36532 .finish xor a - ld [FailedMessage], a + ld [wFailedMessage], a ret .failed @@ -6199,7 +6199,7 @@ LowerStat: ; 36532 .cant_lower_anymore ld a, 2 - ld [FailedMessage], a + ld [wFailedMessage], a ret ; 3658f @@ -6269,9 +6269,9 @@ BattleCommand_LowerSubNoAnim: ; 365c3 CalcPlayerStats: ; 365d7 - ld hl, PlayerAtkLevel - ld de, PlayerStats - ld bc, BattleMonAttack + ld hl, wPlayerAtkLevel + ld de, wPlayerStats + ld bc, wBattleMonAttack ld a, 5 call CalcStats @@ -6293,9 +6293,9 @@ CalcPlayerStats: ; 365d7 CalcEnemyStats: ; 365fd - ld hl, EnemyAtkLevel - ld de, EnemyStats - ld bc, EnemyMonAttack + ld hl, wEnemyAtkLevel + ld de, wEnemyStats + ld bc, wEnemyMonAttack ld a, 5 call CalcStats @@ -6393,11 +6393,11 @@ BattleCommand_StoreEnergy: ; 36671 bit SUBSTATUS_BIDE, a ret z - ld hl, PlayerRolloutCount + ld hl, wPlayerRolloutCount ld a, [hBattleTurn] and a jr z, .check_still_storing_energy - ld hl, EnemyRolloutCount + ld hl, wEnemyRolloutCount .check_still_storing_energy dec [hl] jr nz, .still_storing @@ -6413,30 +6413,30 @@ BattleCommand_StoreEnergy: ; 36671 call GetBattleVarAddr ld a, 1 ld [hl], a - ld hl, PlayerDamageTaken + 1 + ld hl, wPlayerDamageTaken + 1 ld de, wPlayerCharging ; player ld a, [hBattleTurn] and a jr z, .player - ld hl, EnemyDamageTaken + 1 + ld hl, wEnemyDamageTaken + 1 ld de, wEnemyCharging ; enemy .player ld a, [hld] add a ld b, a - ld [CurDamage + 1], a + ld [wCurDamage + 1], a ld a, [hl] rl a - ld [CurDamage], a + ld [wCurDamage], a jr nc, .not_maxed ld a, $ff - ld [CurDamage], a - ld [CurDamage + 1], a + ld [wCurDamage], a + ld [wCurDamage + 1], a .not_maxed or b jr nz, .built_up_something ld a, 1 - ld [AttackMissed], a + ld [wAttackMissed], a .built_up_something xor a ld [hli], a @@ -6462,13 +6462,13 @@ BattleCommand_StoreEnergy: ; 36671 BattleCommand_UnleashEnergy: ; 366e5 ; unleashenergy - ld de, PlayerDamageTaken - ld bc, PlayerRolloutCount + ld de, wPlayerDamageTaken + ld bc, wPlayerRolloutCount ld a, [hBattleTurn] and a jr z, .got_damage - ld de, EnemyDamageTaken - ld bc, EnemyRolloutCount + ld de, wEnemyDamageTaken + ld bc, wEnemyRolloutCount .got_damage ld a, BATTLE_VARS_SUBSTATUS3 call GetBattleVarAddr @@ -6495,11 +6495,11 @@ BattleCommand_UnleashEnergy: ; 366e5 BattleCommand_CheckRampage: ; 3671a ; checkrampage - ld de, PlayerRolloutCount + ld de, wPlayerRolloutCount ld a, [hBattleTurn] and a jr z, .player - ld de, EnemyRolloutCount + ld de, wEnemyRolloutCount .player ld a, BATTLE_VARS_SUBSTATUS3 call GetBattleVarAddr @@ -6541,11 +6541,11 @@ BattleCommand_Rampage: ; 36751 and SLP ret nz - ld de, PlayerRolloutCount + ld de, wPlayerRolloutCount ld a, [hBattleTurn] and a jr z, .ok - ld de, EnemyRolloutCount + ld de, wEnemyRolloutCount .ok ld a, BATTLE_VARS_SUBSTATUS3 call GetBattleVarAddr @@ -6565,7 +6565,7 @@ BattleCommand_Rampage: ; 36751 BattleCommand_Teleport: ; 36778 ; teleport - ld a, [BattleType] + ld a, [wBattleType] cp BATTLETYPE_SHINY jr z, .failed cp BATTLETYPE_TRAP @@ -6588,9 +6588,9 @@ BattleCommand_Teleport: ; 36778 dec a jr nz, .failed ; If your level is greater than the opponent's, you run without fail. - ld a, [CurPartyLevel] + ld a, [wCurPartyLevel] ld b, a - ld a, [BattleMonLevel] + ld a, [wBattleMonLevel] cp b jr nc, .run_away ; Generate a number between 0 and (YourLevel + TheirLevel). @@ -6615,9 +6615,9 @@ BattleCommand_Teleport: ; 36778 ld a, [wBattleMode] dec a jr nz, .failed - ld a, [BattleMonLevel] + ld a, [wBattleMonLevel] ld b, a - ld a, [CurPartyLevel] + ld a, [wCurPartyLevel] cp b jr nc, .run_away add b @@ -6668,7 +6668,7 @@ SetBattleDraw: ; 36804 BattleCommand_ForceSwitch: ; 3680f ; forceswitch - ld a, [BattleType] + ld a, [wBattleType] cp BATTLETYPE_SHINY jp z, .fail cp BATTLETYPE_TRAP @@ -6680,15 +6680,15 @@ BattleCommand_ForceSwitch: ; 3680f ld a, [hBattleTurn] and a jp nz, .force_player_switch - ld a, [AttackMissed] + ld a, [wAttackMissed] and a jr nz, .missed ld a, [wBattleMode] dec a jr nz, .trainer - ld a, [CurPartyLevel] + ld a, [wCurPartyLevel] ld b, a - ld a, [BattleMonLevel] + ld a, [wBattleMonLevel] cp b jr nc, .wild_force_flee add b @@ -6732,9 +6732,9 @@ BattleCommand_ForceSwitch: ; 3680f call ClearBox ld c, 20 call DelayFrames - ld a, [OTPartyCount] + ld a, [wOTPartyCount] ld b, a - ld a, [CurOTMon] + ld a, [wCurOTMon] ld c, a ; select a random enemy mon to switch to .random_loop_trainer @@ -6746,7 +6746,7 @@ BattleCommand_ForceSwitch: ; 3680f jr z, .random_loop_trainer push af push bc - ld hl, OTPartyMon1HP + ld hl, wOTPartyMon1HP call GetPartyLocation ld a, [hli] or [hl] @@ -6768,7 +6768,7 @@ BattleCommand_ForceSwitch: ; 3680f jp .fail .force_player_switch - ld a, [AttackMissed] + ld a, [wAttackMissed] and a jr nz, .player_miss @@ -6776,9 +6776,9 @@ BattleCommand_ForceSwitch: ; 3680f dec a jr nz, .vs_trainer - ld a, [BattleMonLevel] + ld a, [wBattleMonLevel] ld b, a - ld a, [CurPartyLevel] + ld a, [wCurPartyLevel] cp b jr nc, .wild_succeed_playeristarget @@ -6827,9 +6827,9 @@ BattleCommand_ForceSwitch: ; 3680f call ClearBox ld c, 20 call DelayFrames - ld a, [PartyCount] + ld a, [wPartyCount] ld b, a - ld a, [CurBattleMon] + ld a, [wCurBattleMon] ld c, a .random_loop_trainer_playeristarget call BattleRandom @@ -6842,7 +6842,7 @@ BattleCommand_ForceSwitch: ; 3680f push af push bc - ld hl, PartyMon1HP + ld hl, wPartyMon1HP call GetPartyLocation ld a, [hli] or [hl] @@ -6851,7 +6851,7 @@ BattleCommand_ForceSwitch: ; 3680f jr z, .random_loop_trainer_playeristarget ld a, d - ld [CurPartyMon], a + ld [wCurPartyMon], a ld hl, SwitchPlayerMon call CallBattleCore @@ -6888,17 +6888,17 @@ BattleCommand_ForceSwitch: ; 3680f CheckPlayerHasMonToSwitchTo: ; 36994 - ld a, [PartyCount] + ld a, [wPartyCount] ld d, a ld e, 0 ld bc, PARTYMON_STRUCT_LENGTH .loop - ld a, [CurBattleMon] + ld a, [wCurBattleMon] cp e jr z, .next ld a, e - ld hl, PartyMon1HP + ld hl, wPartyMon1HP call AddNTimes ld a, [hli] or [hl] @@ -6924,13 +6924,13 @@ BattleCommand_EndLoop: ; 369b6 ; Loop back to the command before 'critical'. - ld de, PlayerRolloutCount - ld bc, PlayerDamageTaken + ld de, wPlayerRolloutCount + ld bc, wPlayerDamageTaken ld a, [hBattleTurn] and a jr z, .got_addrs - ld de, EnemyRolloutCount - ld bc, EnemyDamageTaken + ld de, wEnemyRolloutCount + ld bc, wEnemyDamageTaken .got_addrs ld a, BATTLE_VARS_SUBSTATUS3 @@ -6965,7 +6965,7 @@ BattleCommand_EndLoop: ; 369b6 ld a, [hBattleTurn] and a jr nz, .check_ot_beat_up - ld a, [PartyCount] + ld a, [wPartyCount] cp 1 jp z, .only_one_beatup dec a @@ -6975,7 +6975,7 @@ BattleCommand_EndLoop: ; 369b6 ld a, [wBattleMode] cp WILD_BATTLE jp z, .only_one_beatup - ld a, [OTPartyCount] + ld a, [wOTPartyCount] cp 1 jp z, .only_one_beatup dec a @@ -7039,9 +7039,9 @@ BattleCommand_EndLoop: ; 369b6 ; Loop back to the command before 'critical'. .loop_back_to_critical - ld a, [BattleScriptBufferAddress + 1] + ld a, [wBattleScriptBufferAddress + 1] ld h, a - ld a, [BattleScriptBufferAddress] + ld a, [wBattleScriptBufferAddress] ld l, a .not_critical ld a, [hld] @@ -7049,16 +7049,16 @@ BattleCommand_EndLoop: ; 369b6 jr nz, .not_critical inc hl ld a, h - ld [BattleScriptBufferAddress + 1], a + ld [wBattleScriptBufferAddress + 1], a ld a, l - ld [BattleScriptBufferAddress], a + ld [wBattleScriptBufferAddress], a ret ; 36a82 BattleCommand_FakeOut: ; 36a82 - ld a, [AttackMissed] + ld a, [wAttackMissed] and a ret nz @@ -7075,7 +7075,7 @@ BattleCommand_FakeOut: ; 36a82 .fail ld a, 1 - ld [AttackMissed], a + ld [wAttackMissed], a ret ; 36aa0 @@ -7093,7 +7093,7 @@ BattleCommand_FlinchTarget: ; 36aa0 call CheckOpponentWentFirst ret nz - ld a, [EffectFailed] + ld a, [wEffectFailed] and a ret nz @@ -7127,7 +7127,7 @@ CheckOpponentWentFirst: ; 36abf BattleCommand_HeldFlinch: ; 36ac9 ; kingsrock - ld a, [AttackMissed] + ld a, [wAttackMissed] and a ret nz @@ -7159,11 +7159,11 @@ BattleCommand_OHKO: ; 36af3 ; ohko call ResetDamage - ld a, [TypeModifier] + ld a, [wTypeModifier] and $7f jr z, .no_effect - ld hl, EnemyMonLevel - ld de, BattleMonLevel + ld hl, wEnemyMonLevel + ld de, wBattleMonLevel ld bc, wPlayerMoveStruct + MOVE_ACC ld a, [hBattleTurn] and a @@ -7186,19 +7186,19 @@ BattleCommand_OHKO: ; 36af3 .finish_ohko ld [bc], a call BattleCommand_CheckHit - ld hl, CurDamage + ld hl, wCurDamage ld a, $ff ld [hli], a ld [hl], a ld a, $2 - ld [CriticalHit], a + ld [wCriticalHit], a ret .no_effect ld a, $ff - ld [CriticalHit], a + ld [wCriticalHit], a ld a, $1 - ld [AttackMissed], a + ld [wAttackMissed], a ret ; 36b3a @@ -7240,7 +7240,7 @@ BattleCommand_Charge: ; 36b4d set SUBSTATUS_CHARGED, [hl] ld hl, IgnoredOrders2Text - ld a, [AlreadyDisobeyed] + ld a, [wAlreadyDisobeyed] and a call nz, StdBattleTextBox @@ -7373,7 +7373,7 @@ BattleCommand3c: ; 36c2c BattleCommand_TrapTarget: ; 36c2d ; traptarget - ld a, [AttackMissed] + ld a, [wAttackMissed] and a ret nz ld hl, wEnemyWrapCount @@ -7469,19 +7469,19 @@ BattleCommand_FocusEnergy: ; 36c98 BattleCommand_Recoil: ; 36cb2 ; recoil - ld hl, BattleMonMaxHP + ld hl, wBattleMonMaxHP ld a, [hBattleTurn] and a jr z, .got_hp - ld hl, EnemyMonMaxHP + ld hl, wEnemyMonMaxHP .got_hp ld a, BATTLE_VARS_MOVE_ANIM call GetBattleVar ld d, a ; get 1/4 damage or 1 HP, whichever is higher - ld a, [CurDamage] + ld a, [wCurDamage] ld b, a - ld a, [CurDamage + 1] + ld a, [wCurDamage + 1] ld c, a srl b rr c @@ -7493,26 +7493,26 @@ BattleCommand_Recoil: ; 36cb2 inc c .min_damage ld a, [hli] - ld [Buffer2], a + ld [wBuffer2], a ld a, [hl] - ld [Buffer1], a + ld [wBuffer1], a dec hl dec hl ld a, [hl] - ld [Buffer3], a + ld [wBuffer3], a sub c ld [hld], a - ld [Buffer5], a + ld [wBuffer5], a ld a, [hl] - ld [Buffer4], a + ld [wBuffer4], a sbc b ld [hl], a - ld [Buffer6], a + ld [wBuffer6], a jr nc, .dont_ko xor a ld [hli], a ld [hl], a - ld hl, Buffer5 + ld hl, wBuffer5 ld [hli], a ld [hl], a .dont_ko @@ -7540,7 +7540,7 @@ BattleCommand_ConfuseTarget: ; 36d1d ld a, b cp HELD_PREVENT_CONFUSE ret z - ld a, [EffectFailed] + ld a, [wEffectFailed] and a ret nz call SafeCheckSafeguard @@ -7580,15 +7580,15 @@ BattleCommand_Confuse: ; 36d3b .not_already_confused call CheckSubstituteOpp jr nz, BattleCommand_Confuse_CheckSnore_Swagger_ConfuseHit - ld a, [AttackMissed] + ld a, [wAttackMissed] and a jr nz, BattleCommand_Confuse_CheckSnore_Swagger_ConfuseHit BattleCommand_FinishConfusingTarget: ; 36d70 - ld bc, EnemyConfuseCount + ld bc, wEnemyConfuseCount ld a, [hBattleTurn] and a jr z, .got_confuse_count - ld bc, PlayerConfuseCount + ld bc, wPlayerConfuseCount .got_confuse_count set SUBSTATUS_CONFUSED, [hl] @@ -7649,7 +7649,7 @@ BattleCommand_Paralyze: ; 36dc7 call GetBattleVar bit PAR, a jr nz, .paralyzed - ld a, [TypeModifier] + ld a, [wTypeModifier] and $7f jr z, .didnt_affect call GetOpponentItem @@ -7672,11 +7672,11 @@ BattleCommand_Paralyze: ; 36dc7 and a jr nz, .dont_sample_failure - ld a, [InBattleTowerBattle] + ld a, [wInBattleTowerBattle] and a jr nz, .dont_sample_failure - ld a, [PlayerSubStatus5] + ld a, [wPlayerSubStatus5] bit SUBSTATUS_LOCK_ON, a jr nz, .dont_sample_failure @@ -7689,7 +7689,7 @@ BattleCommand_Paralyze: ; 36dc7 call GetBattleVarAddr and a jr nz, .failed - ld a, [AttackMissed] + ld a, [wAttackMissed] and a jr nz, .failed call CheckSubstituteOpp @@ -7732,11 +7732,11 @@ CheckMoveTypeMatchesTarget: ; 36e5b push hl - ld hl, EnemyMonType1 + ld hl, wEnemyMonType1 ld a, [hBattleTurn] and a jr z, .ok - ld hl, BattleMonType1 + ld hl, wBattleMonType1 .ok ld a, BATTLE_VARS_MOVE_TYPE @@ -7767,13 +7767,13 @@ BattleCommand_Substitute: ; 36e7c ; substitute call BattleCommand_MoveDelay - ld hl, BattleMonMaxHP - ld de, PlayerSubstituteHP + ld hl, wBattleMonMaxHP + ld de, wPlayerSubstituteHP ld a, [hBattleTurn] and a jr z, .got_hp - ld hl, EnemyMonMaxHP - ld de, EnemySubstituteHP + ld hl, wEnemyMonMaxHP + ld de, wEnemySubstituteHP .got_hp ld a, BATTLE_VARS_SUBSTATUS4 @@ -7826,7 +7826,7 @@ BattleCommand_Substitute: ; 36e7c xor a ld [wNumHits], a - ld [FXAnimID + 1], a + ld [wFXAnimID + 1], a ld [wKickCounter], a ld a, SUBSTITUTE call LoadAnim @@ -7908,7 +7908,7 @@ BattleCommand_DoubleUndergroundDamage: ; 36f2f DoubleDamage: ; 36f37 - ld hl, CurDamage + 1 + ld hl, wCurDamage + 1 sla [hl] dec hl rl [hl] @@ -7928,14 +7928,14 @@ BattleCommand_Mimic: ; 36f46 call ClearLastMove call BattleCommand_MoveDelay - ld a, [AttackMissed] + ld a, [wAttackMissed] and a jr nz, .fail - ld hl, BattleMonMoves + ld hl, wBattleMonMoves ld a, [hBattleTurn] and a jr z, .player_turn - ld hl, EnemyMonMoves + ld hl, wEnemyMonMoves .player_turn call CheckHiddenOpponent jr nz, .fail @@ -7963,7 +7963,7 @@ BattleCommand_Mimic: ; 36f46 call GetBattleVar ld [hl], a ld [wNamedObjectIndexBuffer], a - ld bc, BattleMonPP - BattleMonMoves + ld bc, wBattleMonPP - wBattleMonMoves add hl, bc ld [hl], 5 call GetMoveName @@ -7979,17 +7979,17 @@ BattleCommand_Mimic: ; 36f46 BattleCommand_LeechSeed: ; 36f9d ; leechseed - ld a, [AttackMissed] + ld a, [wAttackMissed] and a jr nz, .evaded call CheckSubstituteOpp jr nz, .evaded - ld de, EnemyMonType1 + ld de, wEnemyMonType1 ld a, [hBattleTurn] and a jr z, .ok - ld de, BattleMonType1 + ld de, wBattleMonType1 .ok ld a, [de] @@ -8032,17 +8032,17 @@ BattleCommand_Splash: ; 36fe1 BattleCommand_Disable: ; 36fed ; disable - ld a, [AttackMissed] + ld a, [wAttackMissed] and a jr nz, .failed - ld de, EnemyDisableCount - ld hl, EnemyMonMoves + ld de, wEnemyDisableCount + ld hl, wEnemyMonMoves ld a, [hBattleTurn] and a jr z, .got_moves - ld de, PlayerDisableCount - ld hl, BattleMonMoves + ld de, wPlayerDisableCount + ld hl, wBattleMonMoves .got_moves ld a, [de] @@ -8066,9 +8066,9 @@ BattleCommand_Disable: ; 36fed ld a, [hBattleTurn] and a - ld hl, EnemyMonPP + ld hl, wEnemyMonPP jr z, .got_pp - ld hl, BattleMonPP + ld hl, wBattleMonPP .got_pp ld b, 0 add hl, bc @@ -8085,7 +8085,7 @@ BattleCommand_Disable: ; 36fed add c ld [de], a call AnimateCurrentMove - ld hl, DisabledMove + ld hl, wDisabledMove ld a, [hBattleTurn] and a jr nz, .got_disabled_move_pointer @@ -8109,14 +8109,14 @@ BattleCommand_PayDay: ; 3705c ; payday xor a - ld hl, StringBuffer1 + ld hl, wStringBuffer1 ld [hli], a ld a, [hBattleTurn] and a - ld a, [BattleMonLevel] + ld a, [wBattleMonLevel] jr z, .ok - ld a, [EnemyMonLevel] + ld a, [wEnemyMonLevel] .ok add a @@ -8138,17 +8138,17 @@ BattleCommand_PayDay: ; 3705c BattleCommand_Conversion: ; 3707f ; conversion - ld hl, BattleMonMoves - ld de, BattleMonType1 + ld hl, wBattleMonMoves + ld de, wBattleMonType1 ld a, [hBattleTurn] and a jr z, .got_moves - ld hl, EnemyMonMoves - ld de, EnemyMonType1 + ld hl, wEnemyMonMoves + ld de, wEnemyMonType1 .got_moves push de ld c, 0 - ld de, StringBuffer1 + ld de, wStringBuffer1 .loop push hl ld b, 0 @@ -8178,7 +8178,7 @@ BattleCommand_Conversion: ; 3707f inc de ld [de], a pop de - ld hl, StringBuffer1 + ld hl, wStringBuffer1 .loop2 ld a, [hl] cp -1 @@ -8207,7 +8207,7 @@ BattleCommand_Conversion: ; 3707f maskbits NUM_MOVES ld c, a ld b, 0 - ld hl, StringBuffer1 + ld hl, wStringBuffer1 add hl, bc ld a, [hl] cp -1 @@ -8239,9 +8239,9 @@ BattleCommand_ResetStats: ; 3710e ; resetstats ld a, 7 ; neutral - ld hl, PlayerStatLevels + ld hl, wPlayerStatLevels call .Fill - ld hl, EnemyStatLevels + ld hl, wEnemyStatLevels call .Fill ld a, [hBattleTurn] @@ -8261,7 +8261,7 @@ BattleCommand_ResetStats: ; 3710e jp StdBattleTextBox .Fill: - ld b, PlayerStatLevelsEnd - PlayerStatLevels + ld b, wPlayerStatLevelsEnd - wPlayerStatLevels .next ld [hli], a dec b @@ -8274,13 +8274,13 @@ BattleCommand_ResetStats: ; 3710e BattleCommand_Heal: ; 3713e ; heal - ld de, BattleMonHP - ld hl, BattleMonMaxHP + ld de, wBattleMonHP + ld hl, wBattleMonMaxHP ld a, [hBattleTurn] and a jr z, .got_hp - ld de, EnemyMonHP - ld hl, EnemyMonMaxHP + ld de, wEnemyMonHP + ld hl, wEnemyMonMaxHP .got_hp ld a, BATTLE_VARS_MOVE_ANIM call GetBattleVar @@ -8403,14 +8403,14 @@ ResetActorDisable: ; 372e7 jr z, .player xor a - ld [EnemyDisableCount], a - ld [EnemyDisabledMove], a + ld [wEnemyDisableCount], a + ld [wEnemyDisabledMove], a ret .player xor a - ld [PlayerDisableCount], a - ld [DisabledMove], a + ld [wPlayerDisableCount], a + ld [wDisabledMove], a ret ; 372fc @@ -8419,13 +8419,13 @@ ResetActorDisable: ; 372e7 BattleCommand_Screen: ; 372fc ; screen - ld hl, PlayerScreens - ld bc, PlayerLightScreenCount + ld hl, wPlayerScreens + ld bc, wPlayerLightScreenCount ld a, [hBattleTurn] and a jr z, .got_screens_pointer - ld hl, EnemyScreens - ld bc, EnemyLightScreenCount + ld hl, wEnemyScreens + ld bc, wEnemyLightScreenCount .got_screens_pointer ld a, BATTLE_VARS_MOVE_EFFECT @@ -8481,7 +8481,7 @@ PrintNothingHappened: ; 37343 TryPrintButItFailed: ; 37349 - ld a, [AlreadyFailed] + ld a, [wAlreadyFailed] and a ret nz @@ -8590,11 +8590,11 @@ INCLUDE "engine/battle/effect_commands/metronome.asm" CheckUserMove: ; 37462 ; Return z if the user has move a. ld b, a - ld de, BattleMonMoves + ld de, wBattleMonMoves ld a, [hBattleTurn] and a jr z, .ok - ld de, EnemyMonMoves + ld de, wEnemyMonMoves .ok ld c, NUM_MOVES @@ -8624,7 +8624,7 @@ ResetTurn: ; 3747b .player ld [hl], 1 xor a - ld [AlreadyDisobeyed], a + ld [wAlreadyDisobeyed], a call DoMove jp EndMoveEffect @@ -8727,14 +8727,14 @@ BattleCommand5d: ; 37791 BattleCommand_FuryCutter: ; 37792 ; furycutter - ld hl, PlayerFuryCutterCount + ld hl, wPlayerFuryCutterCount ld a, [hBattleTurn] and a jr z, .go - ld hl, EnemyFuryCutterCount + ld hl, wEnemyFuryCutterCount .go - ld a, [AttackMissed] + ld a, [wAttackMissed] and a jp nz, ResetFuryCutterCount @@ -8752,7 +8752,7 @@ BattleCommand_FuryCutter: ; 37792 ret z ; Double the damage - ld hl, CurDamage + 1 + ld hl, wCurDamage + 1 sla [hl] dec hl rl [hl] @@ -8771,11 +8771,11 @@ ResetFuryCutterCount: ; 377be push hl - ld hl, PlayerFuryCutterCount + ld hl, wPlayerFuryCutterCount ld a, [hBattleTurn] and a jr z, .reset - ld hl, EnemyFuryCutterCount + ld hl, wEnemyFuryCutterCount .reset xor a @@ -8792,11 +8792,11 @@ INCLUDE "engine/battle/effect_commands/attract.asm" BattleCommand_HappinessPower: ; 3784b ; happinesspower push bc - ld hl, BattleMonHappiness + ld hl, wBattleMonHappiness ld a, [hBattleTurn] and a jr z, .ok - ld hl, EnemyMonHappiness + ld hl, wEnemyMonHappiness .ok xor a ld [hMultiplicand + 0], a @@ -8824,11 +8824,11 @@ BattleCommand_FrustrationPower: ; 3790e ; frustrationpower push bc - ld hl, BattleMonHappiness + ld hl, wBattleMonHappiness ld a, [hBattleTurn] and a jr z, .got_happiness - ld hl, EnemyMonHappiness + ld hl, wEnemyMonHappiness .got_happiness ld a, $ff sub [hl] @@ -8854,13 +8854,13 @@ BattleCommand_FrustrationPower: ; 3790e BattleCommand_Safeguard: ; 37939 ; safeguard - ld hl, PlayerScreens - ld de, PlayerSafeguardCount + ld hl, wPlayerScreens + ld de, wPlayerSafeguardCount ld a, [hBattleTurn] and a jr z, .ok - ld hl, EnemyScreens - ld de, EnemySafeguardCount + ld hl, wEnemyScreens + ld de, wEnemySafeguardCount .ok bit SCREENS_SAFEGUARD, [hl] jr nz, .failed @@ -8880,11 +8880,11 @@ BattleCommand_Safeguard: ; 37939 SafeCheckSafeguard: ; 37962 push hl - ld hl, EnemyScreens + ld hl, wEnemyScreens ld a, [hBattleTurn] and a jr z, .got_turn - ld hl, PlayerScreens + ld hl, wPlayerScreens .got_turn bit SCREENS_SAFEGUARD, [hl] @@ -8896,16 +8896,16 @@ SafeCheckSafeguard: ; 37962 BattleCommand_CheckSafeguard: ; 37972 ; checksafeguard - ld hl, EnemyScreens + ld hl, wEnemyScreens ld a, [hBattleTurn] and a jr z, .got_turn - ld hl, PlayerScreens + ld hl, wPlayerScreens .got_turn bit SCREENS_SAFEGUARD, [hl] ret z ld a, 1 - ld [AttackMissed], a + ld [wAttackMissed], a call BattleCommand_MoveDelay ld hl, SafeguardProtectText call StdBattleTextBox @@ -9046,7 +9046,7 @@ BatonPass_LinkPlayerSwitch: ; 37a67 ret z ld a, 1 - ld [wPlayerAction], a + ld [wBattlePlayerAction], a call LoadStandardMenuDataHeader ld hl, LinkBattleSendReceiveAction @@ -9054,7 +9054,7 @@ BatonPass_LinkPlayerSwitch: ; 37a67 call CloseWindow xor a - ld [wPlayerAction], a + ld [wBattlePlayerAction], a ret ; 37a82 @@ -9069,7 +9069,7 @@ BatonPass_LinkEnemySwitch: ; 37a82 ld hl, LinkBattleSendReceiveAction call CallBattleCore - ld a, [OTPartyCount] + ld a, [wOTPartyCount] add BATTLEACTION_SWITCH1 ld b, a ld a, [wBattleAction] @@ -9079,7 +9079,7 @@ BatonPass_LinkEnemySwitch: ; 37a82 jr c, .switch .baton_pass - ld a, [CurOTMon] + ld a, [wCurOTMon] add BATTLEACTION_SWITCH1 ld [wBattleAction], a .switch @@ -9113,11 +9113,11 @@ ResetBatonPassStatus: ; 37ab1 call ResetActorDisable ; Attraction isn't passed. - ld hl, PlayerSubStatus1 + ld hl, wPlayerSubStatus1 res SUBSTATUS_IN_LOVE, [hl] - ld hl, EnemySubStatus1 + ld hl, wEnemySubStatus1 res SUBSTATUS_IN_LOVE, [hl] - ld hl, PlayerSubStatus5 + ld hl, wPlayerSubStatus5 ld a, BATTLE_VARS_SUBSTATUS5 call GetBattleVarAddr @@ -9138,10 +9138,10 @@ ResetBatonPassStatus: ; 37ab1 CheckAnyOtherAlivePartyMons: ; 37ae9 - ld hl, PartyMon1HP - ld a, [PartyCount] + ld hl, wPartyMon1HP + ld a, [wPartyCount] ld d, a - ld a, [CurBattleMon] + ld a, [wCurBattleMon] ld e, a jr CheckAnyOtherAliveMons @@ -9149,10 +9149,10 @@ CheckAnyOtherAlivePartyMons: ; 37ae9 CheckAnyOtherAliveEnemyMons: ; 37af6 - ld hl, OTPartyMon1HP - ld a, [OTPartyCount] + ld hl, wOTPartyMon1HP + ld a, [wOTPartyCount] ld d, a - ld a, [CurOTMon] + ld a, [wCurOTMon] ld e, a ; fallthrough @@ -9211,7 +9211,7 @@ BattleCommand_Pursuit: ; 37b1d and a ret z - ld hl, CurDamage + 1 + ld hl, wCurDamage + 1 sla [hl] dec hl rl [hl] @@ -9237,12 +9237,12 @@ BattleCommand_ClearHazards: ; 37b39 call StdBattleTextBox .not_leeched - ld hl, PlayerScreens + ld hl, wPlayerScreens ld de, wPlayerWrapCount ld a, [hBattleTurn] and a jr z, .got_screens_wrap - ld hl, EnemyScreens + ld hl, wEnemyScreens ld de, wEnemyWrapCount .got_screens_wrap bit SCREENS_SPIKES, [hl] @@ -9288,13 +9288,13 @@ BattleCommand_HealNite: ; 37b7c BattleCommand_TimeBasedHealContinue: ; 37b7e ; Time- and weather-sensitive heal. - ld hl, BattleMonMaxHP - ld de, BattleMonHP + ld hl, wBattleMonMaxHP + ld de, wBattleMonHP ld a, [hBattleTurn] and a jr z, .start - ld hl, EnemyMonMaxHP - ld de, EnemyMonHP + ld hl, wEnemyMonMaxHP + ld de, wEnemyMonHP .start ; Index for .Multipliers @@ -9310,15 +9310,15 @@ BattleCommand_TimeBasedHealContinue: ; 37b7e ; Don't factor in time of day in link battles. ld a, [wLinkMode] and a - jr nz, .Weather + jr nz, .checkWeather - ld a, [TimeOfDay] + ld a, [wTimeOfDay] cp b - jr z, .Weather + jr z, .checkWeather dec c ; double -.Weather: - ld a, [Weather] +.checkWeather: + ld a, [wBattleWeather] and a jr z, .Heal @@ -9372,7 +9372,7 @@ BattleCommand_TimeBasedHealContinue: ; 37b7e BattleCommand_HiddenPower: ; 37be8 ; hiddenpower - ld a, [AttackMissed] + ld a, [wAttackMissed] and a ret nz farcall HiddenPowerDamage @@ -9384,9 +9384,9 @@ BattleCommand_HiddenPower: ; 37be8 BattleCommand_StartRain: ; 37bf4 ; startrain ld a, WEATHER_RAIN - ld [Weather], a + ld [wBattleWeather], a ld a, 5 - ld [WeatherCount], a + ld [wWeatherCount], a call AnimateCurrentMove ld hl, DownpourText jp StdBattleTextBox @@ -9397,9 +9397,9 @@ BattleCommand_StartRain: ; 37bf4 BattleCommand_StartSun: ; 37c07 ; startsun ld a, WEATHER_SUN - ld [Weather], a + ld [wBattleWeather], a ld a, 5 - ld [WeatherCount], a + ld [wWeatherCount], a call AnimateCurrentMove ld hl, SunGotBrightText jp StdBattleTextBox @@ -9413,7 +9413,7 @@ BattleCommand_BellyDrum: ; 37c1a ; before checking that it has enough HP to use the move. ; Swap the order of these two blocks to fix. call BattleCommand_AttackUp2 - ld a, [AttackMissed] + ld a, [wAttackMissed] and a jr nz, .failed @@ -9448,8 +9448,8 @@ BattleCommand_BellyDrum: ; 37c1a BattleCommand_PsychUp: ; 37c55 ; psychup - ld hl, EnemyStatLevels - ld de, PlayerStatLevels + ld hl, wEnemyStatLevels + ld de, wPlayerStatLevels ld a, [hBattleTurn] and a jr z, .pointers_correct @@ -9502,7 +9502,7 @@ BattleCommand_MirrorCoat: ; 37c95 ; mirrorcoat ld a, 1 - ld [AttackMissed], a + ld [wAttackMissed], a ld a, BATTLE_VARS_LAST_COUNTER_MOVE_OPP call GetBattleVar @@ -9526,18 +9526,18 @@ BattleCommand_MirrorCoat: ; 37c95 ld a, BATTLE_VARS_LAST_COUNTER_MOVE_OPP call GetBattleVar dec a - ld de, StringBuffer1 + ld de, wStringBuffer1 call GetMoveData - ld a, [StringBuffer1 + 2] + ld a, [wStringBuffer1 + 2] and a ret z - ld a, [StringBuffer1 + 3] + ld a, [wStringBuffer1 + 3] cp SPECIAL ret c - ld hl, CurDamage + ld hl, wCurDamage ld a, [hli] or [hl] ret z @@ -9555,7 +9555,7 @@ BattleCommand_MirrorCoat: ; 37c95 .capped xor a - ld [AttackMissed], a + ld [wAttackMissed], a ret ; 37ce6 @@ -9573,7 +9573,7 @@ BattleCommand_DoubleMinimizeDamage: ; 37ce6 ld a, [hl] and a ret z - ld hl, CurDamage + 1 + ld hl, wCurDamage + 1 sla [hl] dec hl rl [hl] @@ -9588,7 +9588,7 @@ BattleCommand_DoubleMinimizeDamage: ; 37ce6 BattleCommand_SkipSunCharge: ; 37d02 ; mimicsuncharge - ld a, [Weather] + ld a, [wBattleWeather] cp WEATHER_SUN ret nz ld b, charge_command @@ -9618,9 +9618,9 @@ BattleCommand_CheckFutureSight: ; 37d0d ld [hl], 0 ld a, [de] inc de - ld [CurDamage], a + ld [wCurDamage], a ld a, [de] - ld [CurDamage + 1], a + ld [wCurDamage + 1], a ld b, futuresight_command jp SkipToBattleCommand @@ -9663,7 +9663,7 @@ BattleCommand_FutureSight: ; 37d34 jr z, .StoreDamage ld de, wEnemyFutureSightDamage .StoreDamage: - ld hl, CurDamage + ld hl, wCurDamage ld a, [hl] ld [de], a ld [hl], 0 @@ -9690,7 +9690,7 @@ BattleCommand_ThunderAccuracy: ; 37d94 ld a, BATTLE_VARS_MOVE_TYPE call GetBattleVarAddr inc hl - ld a, [Weather] + ld a, [wBattleWeather] cp WEATHER_RAIN jr z, .rain cp WEATHER_SUN @@ -9718,11 +9718,11 @@ CheckHiddenOpponent: ; 37daa GetUserItem: ; 37db2 ; Return the effect of the user's item in bc, and its id at hl. - ld hl, BattleMonItem + ld hl, wBattleMonItem ld a, [hBattleTurn] and a jr z, .go - ld hl, EnemyMonItem + ld hl, wEnemyMonItem .go ld b, [hl] jp GetItemHeldEffect @@ -9732,11 +9732,11 @@ GetUserItem: ; 37db2 GetOpponentItem: ; 37dc1 ; Return the effect of the opponent's item in bc, and its id at hl. - ld hl, EnemyMonItem + ld hl, wEnemyMonItem ld a, [hBattleTurn] and a jr z, .go - ld hl, BattleMonItem + ld hl, wBattleMonItem .go ld b, [hl] jp GetItemHeldEffect @@ -9807,14 +9807,14 @@ AnimateCurrentMove: ; 37e01 PlayDamageAnim: ; 37e19 xor a - ld [FXAnimID + 1], a + ld [wFXAnimID + 1], a ld a, BATTLE_VARS_MOVE_ANIM call GetBattleVar and a ret z - ld [FXAnimID], a + ld [wFXAnimID], a ld a, [hBattleTurn] and a @@ -9833,7 +9833,7 @@ PlayDamageAnim: ; 37e19 LoadMoveAnim: ; 37e36 xor a ld [wNumHits], a - ld [FXAnimID + 1], a + ld [wFXAnimID + 1], a ld a, BATTLE_VARS_MOVE_ANIM call GetBattleVar @@ -9846,7 +9846,7 @@ LoadMoveAnim: ; 37e36 LoadAnim: ; 37e44 - ld [FXAnimID], a + ld [wFXAnimID], a ; fallthrough ; 37e47 @@ -9867,9 +9867,9 @@ PlayUserBattleAnim: ; 37e47 PlayOpponentBattleAnim: ; 37e54 ld a, e - ld [FXAnimID], a + ld [wFXAnimID], a ld a, d - ld [FXAnimID + 1], a + ld [wFXAnimID + 1], a xor a ld [wNumHits], a @@ -9928,9 +9928,9 @@ BattleCommand_ClearText: ; 37e85 SkipToBattleCommand: ; 37e8c ; Skip over commands until reaching command b. - ld a, [BattleScriptBufferAddress + 1] + ld a, [wBattleScriptBufferAddress + 1] ld h, a - ld a, [BattleScriptBufferAddress] + ld a, [wBattleScriptBufferAddress] ld l, a .loop ld a, [hli] @@ -9938,9 +9938,9 @@ SkipToBattleCommand: ; 37e8c jr nz, .loop ld a, h - ld [BattleScriptBufferAddress + 1], a + ld [wBattleScriptBufferAddress + 1], a ld a, l - ld [BattleScriptBufferAddress], a + ld [wBattleScriptBufferAddress], a ret ; 37ea1 diff --git a/engine/battle/effect_commands/attract.asm b/engine/battle/effect_commands/attract.asm index 0a6d7c975..da6a9c0e9 100755 --- a/engine/battle/effect_commands/attract.asm +++ b/engine/battle/effect_commands/attract.asm @@ -1,6 +1,6 @@ BattleCommand_Attract: ; 377ce ; attract - ld a, [AttackMissed] + ld a, [wAttackMissed] and a jr nz, .failed call CheckOppositeGender @@ -28,12 +28,12 @@ CheckOppositeGender: ; 377f5 ld a, MON_SPECIES call BattlePartyAttr ld a, [hl] - ld [CurPartySpecies], a + ld [wCurPartySpecies], a - ld a, [CurBattleMon] - ld [CurPartyMon], a + ld a, [wCurBattleMon] + ld [wCurPartyMon], a xor a - ld [MonType], a + ld [wMonType], a farcall GetGender jr c, .genderless_samegender @@ -44,20 +44,20 @@ CheckOppositeGender: ; 377f5 .got_gender push bc - ld a, [TempEnemyMonSpecies] - ld [CurPartySpecies], a - ld hl, EnemyMonDVs - ld a, [EnemySubStatus5] + ld a, [wTempEnemyMonSpecies] + ld [wCurPartySpecies], a + ld hl, wEnemyMonDVs + ld a, [wEnemySubStatus5] bit SUBSTATUS_TRANSFORMED, a jr z, .not_transformed ld hl, wEnemyBackupDVs .not_transformed ld a, [hli] - ld [TempMonDVs], a + ld [wTempMonDVs], a ld a, [hl] - ld [TempMonDVs + 1], a + ld [wTempMonDVs + 1], a ld a, 3 - ld [MonType], a + ld [wMonType], a farcall GetGender pop bc jr c, .genderless_samegender diff --git a/engine/battle/effect_commands/curse.asm b/engine/battle/effect_commands/curse.asm index dceb3b8d5..b11b9f3fb 100644 --- a/engine/battle/effect_commands/curse.asm +++ b/engine/battle/effect_commands/curse.asm @@ -1,13 +1,13 @@ BattleCommand_Curse: ; 37588 ; curse - ld de, BattleMonType1 - ld bc, PlayerStatLevels + ld de, wBattleMonType1 + ld bc, wPlayerStatLevels ld a, [hBattleTurn] and a jr z, .go - ld de, EnemyMonType1 - ld bc, EnemyStatLevels + ld de, wEnemyMonType1 + ld bc, wEnemyStatLevels .go diff --git a/engine/battle/effect_commands/foresight.asm b/engine/battle/effect_commands/foresight.asm index 6f4f97cd2..006e3b3d7 100644 --- a/engine/battle/effect_commands/foresight.asm +++ b/engine/battle/effect_commands/foresight.asm @@ -1,7 +1,7 @@ BattleCommand_Foresight: ; 376a0 ; foresight - ld a, [AttackMissed] + ld a, [wAttackMissed] and a jr nz, .failed diff --git a/engine/battle/effect_commands/perish_song.asm b/engine/battle/effect_commands/perish_song.asm index ac491ef6b..8c88c8739 100644 --- a/engine/battle/effect_commands/perish_song.asm +++ b/engine/battle/effect_commands/perish_song.asm @@ -2,8 +2,8 @@ BattleCommand_PerishSong: ; 376c2 ; perishsong - ld hl, PlayerSubStatus1 - ld de, EnemySubStatus1 + ld hl, wPlayerSubStatus1 + ld de, wEnemySubStatus1 bit SUBSTATUS_PERISH, [hl] jr z, .ok @@ -17,7 +17,7 @@ BattleCommand_PerishSong: ; 376c2 set SUBSTATUS_PERISH, [hl] ld a, 4 - ld [PlayerPerishCount], a + ld [wPlayerPerishCount], a .enemy ld a, [de] @@ -27,7 +27,7 @@ BattleCommand_PerishSong: ; 376c2 set SUBSTATUS_PERISH, a ld [de], a ld a, 4 - ld [EnemyPerishCount], a + ld [wEnemyPerishCount], a .done call AnimateCurrentMove diff --git a/engine/battle/effect_commands/present.asm b/engine/battle/effect_commands/present.asm index 2b358e8b9..f0cf8006d 100755 --- a/engine/battle/effect_commands/present.asm +++ b/engine/battle/effect_commands/present.asm @@ -20,7 +20,7 @@ BattleCommand_Present: ; 37874 ld a, [wTypeMatchup] and a jp z, AnimateFailedMove - ld a, [AttackMissed] + ld a, [wAttackMissed] and a jp nz, AnimateFailedMove diff --git a/engine/battle/effect_commands/protect.asm b/engine/battle/effect_commands/protect.asm index 568ac00f8..6c65e0ed1 100644 --- a/engine/battle/effect_commands/protect.asm +++ b/engine/battle/effect_commands/protect.asm @@ -16,11 +16,11 @@ BattleCommand_Protect: ; 37618 ProtectChance: ; 3762c - ld de, PlayerProtectCount + ld de, wPlayerProtectCount ld a, [hBattleTurn] and a jr z, .asm_37637 - ld de, EnemyProtectCount + ld de, wEnemyProtectCount .asm_37637 call CheckOpponentWentFirst diff --git a/engine/battle/effect_commands/rollout.asm b/engine/battle/effect_commands/rollout.asm index 4ce9ab3d8..f6966c48a 100644 --- a/engine/battle/effect_commands/rollout.asm +++ b/engine/battle/effect_commands/rollout.asm @@ -4,11 +4,11 @@ MAX_ROLLOUT_COUNT EQU 5 BattleCommand_CheckCurl: ; 37718 ; checkcurl - ld de, PlayerRolloutCount + ld de, wPlayerRolloutCount ld a, [hBattleTurn] and a jr z, .ok - ld de, EnemyRolloutCount + ld de, wEnemyRolloutCount .ok ld a, BATTLE_VARS_SUBSTATUS1 call GetBattleVar @@ -33,11 +33,11 @@ BattleCommand_RolloutPower: ; 37734 and SLP ret nz - ld hl, PlayerRolloutCount + ld hl, wPlayerRolloutCount ld a, [hBattleTurn] and a jr z, .got_rollout_count - ld hl, EnemyRolloutCount + ld hl, wEnemyRolloutCount .got_rollout_count ld a, [hl] @@ -47,7 +47,7 @@ BattleCommand_RolloutPower: ; 37734 ld [wSomeoneIsRampaging], a .skip_set_rampage - ld a, [AttackMissed] + ld a, [wAttackMissed] and a jr z, .hit @@ -84,7 +84,7 @@ BattleCommand_RolloutPower: ; 37734 dec b jr z, .done_damage - ld hl, CurDamage + 1 + ld hl, wCurDamage + 1 sla [hl] dec hl rl [hl] diff --git a/engine/battle/effect_commands/sandstorm.asm b/engine/battle/effect_commands/sandstorm.asm index 27b8e8e2c..5aaa61deb 100644 --- a/engine/battle/effect_commands/sandstorm.asm +++ b/engine/battle/effect_commands/sandstorm.asm @@ -1,14 +1,14 @@ BattleCommand_StartSandstorm: ; 376f8 ; startsandstorm - ld a, [Weather] + ld a, [wBattleWeather] cp WEATHER_SANDSTORM jr z, .failed ld a, WEATHER_SANDSTORM - ld [Weather], a + ld [wBattleWeather], a ld a, 5 - ld [WeatherCount], a + ld [wWeatherCount], a call AnimateCurrentMove ld hl, SandstormBrewedText jp StdBattleTextBox diff --git a/engine/battle/effect_commands/spikes.asm b/engine/battle/effect_commands/spikes.asm index 3d15e4cfd..a5e22a706 100644 --- a/engine/battle/effect_commands/spikes.asm +++ b/engine/battle/effect_commands/spikes.asm @@ -1,11 +1,11 @@ BattleCommand_Spikes: ; 37683 ; spikes - ld hl, EnemyScreens + ld hl, wEnemyScreens ld a, [hBattleTurn] and a jr z, .asm_3768e - ld hl, PlayerScreens + ld hl, wPlayerScreens .asm_3768e ; Fails if spikes are already down! diff --git a/engine/battle/effect_commands/thief.asm b/engine/battle/effect_commands/thief.asm index 6d32d68d4..5397c2bdf 100644 --- a/engine/battle/effect_commands/thief.asm +++ b/engine/battle/effect_commands/thief.asm @@ -26,7 +26,7 @@ BattleCommand_Thief: ; 37492 farcall ItemIsMail ret c - ld a, [EffectFailed] + ld a, [wEffectFailed] and a ret nz @@ -74,7 +74,7 @@ BattleCommand_Thief: ; 37492 farcall ItemIsMail ret c - ld a, [EffectFailed] + ld a, [wEffectFailed] and a ret nz @@ -103,7 +103,7 @@ BattleCommand_Thief: ; 37492 call BattlePartyAttr ld d, h ld e, l - ld hl, BattleMonItem + ld hl, wBattleMonItem ret .enemyitem @@ -111,6 +111,6 @@ BattleCommand_Thief: ; 37492 call OTPartyAttr ld d, h ld e, l - ld hl, EnemyMonItem + ld hl, wEnemyMonItem ret ; 37517 diff --git a/engine/battle/effect_commands/transform.asm b/engine/battle/effect_commands/transform.asm index 65c3f3e60..5ae7c1511 100755 --- a/engine/battle/effect_commands/transform.asm +++ b/engine/battle/effect_commands/transform.asm @@ -11,7 +11,7 @@ BattleCommand_Transform: ; 371cd jp nz, BattleEffect_ButItFailed xor a ld [wNumHits], a - ld [FXAnimID + 1], a + ld [wFXAnimID + 1], a ld a, $1 ld [wKickCounter], a ld a, BATTLE_VARS_SUBSTATUS4 @@ -28,15 +28,15 @@ BattleCommand_Transform: ; 371cd call GetBattleVarAddr set SUBSTATUS_TRANSFORMED, [hl] call ResetActorDisable - ld hl, BattleMonSpecies - ld de, EnemyMonSpecies + ld hl, wBattleMonSpecies + ld de, wEnemyMonSpecies ld a, [hBattleTurn] and a jr nz, .got_mon_species - ld hl, EnemyMonSpecies - ld de, BattleMonSpecies + ld hl, wEnemyMonSpecies + ld de, wBattleMonSpecies xor a - ld [CurMoveNum], a + ld [wCurMoveNum], a .got_mon_species push hl ld a, [hli] @@ -64,7 +64,7 @@ BattleCommand_Transform: ; 371cd ld [de], a inc de ; move pointer to stats - ld bc, BattleMonStats - BattleMonPP + ld bc, wBattleMonStats - wBattleMonPP add hl, bc push hl ld h, d @@ -73,16 +73,16 @@ BattleCommand_Transform: ; 371cd ld d, h ld e, l pop hl - ld bc, BattleMonStructEnd - BattleMonStats + ld bc, wBattleMonStructEnd - wBattleMonStats call CopyBytes ; init the power points - ld bc, BattleMonMoves - BattleMonStructEnd + ld bc, wBattleMonMoves - wBattleMonStructEnd add hl, bc push de ld d, h ld e, l pop hl - ld bc, BattleMonPP - BattleMonStructEnd + ld bc, wBattleMonPP - wBattleMonStructEnd add hl, bc ld b, NUM_MOVES .pp_loop @@ -102,12 +102,12 @@ BattleCommand_Transform: ; 371cd ld a, [hl] ld [wNamedObjectIndexBuffer], a call GetPokemonName - ld hl, EnemyStats - ld de, PlayerStats + ld hl, wEnemyStats + ld de, wPlayerStats ld bc, 2 * 5 call BattleSideCopy - ld hl, EnemyStatLevels - ld de, PlayerStatLevels + ld hl, wEnemyStatLevels + ld de, wPlayerStatLevels ld bc, 8 call BattleSideCopy call _CheckBattleScene @@ -129,7 +129,7 @@ BattleCommand_Transform: ; 371cd .after_anim xor a ld [wNumHits], a - ld [FXAnimID + 1], a + ld [wFXAnimID + 1], a ld a, $2 ld [wKickCounter], a pop af diff --git a/engine/battle/hidden_power.asm b/engine/battle/hidden_power.asm index a1d3957e4..9d9a8dc0e 100644 --- a/engine/battle/hidden_power.asm +++ b/engine/battle/hidden_power.asm @@ -1,11 +1,11 @@ HiddenPowerDamage: ; fbced ; Override Hidden Power's type and power based on the user's DVs. - ld hl, BattleMonDVs + ld hl, wBattleMonDVs ld a, [hBattleTurn] and a jr z, .got_dvs - ld hl, EnemyMonDVs + ld hl, wEnemyMonDVs .got_dvs diff --git a/engine/battle/link_result.asm b/engine/battle/link_result.asm index cf6102acc..8f456da9b 100755 --- a/engine/battle/link_result.asm +++ b/engine/battle/link_result.asm @@ -1,9 +1,9 @@ DetermineLinkBattleResult: ; 2b930 farcall UpdateEnemyMonInParty - ld hl, PartyMon1HP + ld hl, wPartyMon1HP call .CountMonsRemaining push bc - ld hl, OTPartyMon1HP + ld hl, wOTPartyMon1HP call .CountMonsRemaining ld a, c pop bc @@ -20,10 +20,10 @@ DetermineLinkBattleResult: ; 2b930 jr z, .victory cp $2 jr z, .defeat - ld hl, PartyMon1HP + ld hl, wPartyMon1HP call .CalcPercentHPRemaining push de - ld hl, OTPartyMon1HP + ld hl, wOTPartyMon1HP call .CalcPercentHPRemaining pop hl ld a, d @@ -118,16 +118,16 @@ DetermineLinkBattleResult: ; 2b930 ret .BothSides_CheckNumberMonsAtFullHealth: ; 2b9e1 - ld hl, PartyMon1HP + ld hl, wPartyMon1HP call .CheckFaintedOrFullHealth jr nz, .finish ; we have a pokemon that's neither fainted nor at full health - ld hl, OTPartyMon1HP + ld hl, wOTPartyMon1HP call .CheckFaintedOrFullHealth ld e, $1 ret .finish - ld hl, OTPartyMon1HP + ld hl, wOTPartyMon1HP call .CheckFaintedOrFullHealth ld e, $0 ret nz ; we both have pokemon that are neither fainted nor at full health diff --git a/engine/battle/misc.asm b/engine/battle/misc.asm index a41d31d9a..b79c274b9 100644 --- a/engine/battle/misc.asm +++ b/engine/battle/misc.asm @@ -53,7 +53,7 @@ GetPlayerBackpicCoords: ; fbd9d (3e:7d9d) DoWeatherModifiers: ; fbda4 ld de, .WeatherTypeModifiers - ld a, [Weather] + ld a, [wBattleWeather] ld b, a ld a, [wd265] ; move type ld c, a @@ -105,7 +105,7 @@ DoWeatherModifiers: ; fbda4 .ApplyModifier: xor a ld [hMultiplicand + 0], a - ld hl, CurDamage + ld hl, wCurDamage ld a, [hli] ld [hMultiplicand + 1], a ld a, [hl] @@ -138,9 +138,9 @@ DoWeatherModifiers: ; fbda4 .Update: ld a, b - ld [CurDamage], a + ld [wCurDamage], a ld a, c - ld [CurDamage + 1], a + ld [wCurDamage + 1], a .done ret @@ -163,7 +163,7 @@ DoBadgeTypeBoosts: ; fbe24 and a ret nz - ld a, [InBattleTowerBattle] + ld a, [wInBattleTowerBattle] and a ret nz @@ -199,10 +199,10 @@ DoBadgeTypeBoosts: ; fbe24 jr .CheckBadge .ApplyBoost: - ld a, [CurDamage] + ld a, [wCurDamage] ld h, a ld d, a - ld a, [CurDamage + 1] + ld a, [wCurDamage + 1] ld l, a ld e, a @@ -226,9 +226,9 @@ DoBadgeTypeBoosts: ; fbe24 .Update: ld a, h - ld [CurDamage], a + ld [wCurDamage], a ld a, l - ld [CurDamage + 1], a + ld [wCurDamage + 1], a .done pop bc diff --git a/engine/battle/read_trainer_attributes.asm b/engine/battle/read_trainer_attributes.asm index dfb8d3682..0b9507e0d 100644 --- a/engine/battle/read_trainer_attributes.asm +++ b/engine/battle/read_trainer_attributes.asm @@ -1,18 +1,18 @@ GetTrainerClassName: ; 3952d - ld hl, RivalName + ld hl, wRivalName ld a, c cp RIVAL1 jr z, .rival - ld [CurSpecies], a + ld [wCurSpecies], a ld a, TRAINER_NAME ld [wNamedObjectTypeBuffer], a call GetName - ld de, StringBuffer1 + ld de, wStringBuffer1 ret .rival - ld de, StringBuffer1 + ld de, wStringBuffer1 push de ld bc, NAME_LENGTH call CopyBytes @@ -20,35 +20,35 @@ GetTrainerClassName: ; 3952d ret GetOTName: ; 39550 - ld hl, OTPlayerName + ld hl, wOTPlayerName ld a, [wLinkMode] and a jr nz, .ok - ld hl, RivalName + ld hl, wRivalName ld a, c cp RIVAL1 jr z, .ok - ld [CurSpecies], a + ld [wCurSpecies], a ld a, TRAINER_NAME ld [wNamedObjectTypeBuffer], a call GetName - ld hl, StringBuffer1 + ld hl, wStringBuffer1 .ok ld bc, TRAINER_CLASS_NAME_LENGTH - ld de, OTClassName + ld de, wOTClassName push de call CopyBytes pop de ret GetTrainerAttributes: ; 3957b - ld a, [TrainerClass] + ld a, [wTrainerClass] ld c, a call GetOTName - ld a, [TrainerClass] + ld a, [wTrainerClass] dec a ld hl, TrainerClassAttributes + TRNATTR_ITEM1 ld bc, NUM_TRAINER_ATTRIBUTES diff --git a/engine/battle/read_trainer_dvs.asm b/engine/battle/read_trainer_dvs.asm index d7c0ff50b..c021e8e8c 100644 --- a/engine/battle/read_trainer_dvs.asm +++ b/engine/battle/read_trainer_dvs.asm @@ -1,8 +1,8 @@ GetTrainerDVs: ; 270c4 -; Return the DVs of OtherTrainerClass in bc +; Return the DVs of wOtherTrainerClass in bc push hl - ld a, [OtherTrainerClass] + ld a, [wOtherTrainerClass] dec a ld c, a ld b, 0 diff --git a/engine/battle/read_trainer_party.asm b/engine/battle/read_trainer_party.asm index a09c6dd08..9f7a4a4a8 100755 --- a/engine/battle/read_trainer_party.asm +++ b/engine/battle/read_trainer_party.asm @@ -1,5 +1,5 @@ ReadTrainerParty: ; 39771 - ld a, [InBattleTowerBattle] + ld a, [wInBattleTowerBattle] bit 0, a ret nz @@ -7,24 +7,24 @@ ReadTrainerParty: ; 39771 and a ret nz - ld hl, OTPartyCount + ld hl, wOTPartyCount xor a ld [hli], a dec a ld [hl], a - ld hl, OTPartyMons - ld bc, OTPartyMonsEnd - OTPartyMons + ld hl, wOTPartyMons + ld bc, wOTPartyMonsEnd - wOTPartyMons xor a call ByteFill - ld a, [OtherTrainerClass] + ld a, [wOtherTrainerClass] cp CAL jr nz, .not_cal2 - ld a, [OtherTrainerID] + ld a, [wOtherTrainerID] cp CAL2 jr z, .cal2 - ld a, [OtherTrainerClass] + ld a, [wOtherTrainerClass] .not_cal2 dec a @@ -37,7 +37,7 @@ ReadTrainerParty: ; 39771 ld h, [hl] ld l, a - ld a, [OtherTrainerID] + ld a, [wOtherTrainerID] ld b, a .skip_trainer dec b @@ -97,11 +97,11 @@ TrainerType1: ; 397eb cp $ff ret z - ld [CurPartyLevel], a + ld [wCurPartyLevel], a ld a, [hli] - ld [CurPartySpecies], a + ld [wCurPartySpecies], a ld a, OTPARTYMON - ld [MonType], a + ld [wMonType], a push hl predef TryAddMonToParty pop hl @@ -117,17 +117,17 @@ TrainerType2: ; 39806 cp $ff ret z - ld [CurPartyLevel], a + ld [wCurPartyLevel], a ld a, [hli] - ld [CurPartySpecies], a + ld [wCurPartySpecies], a ld a, OTPARTYMON - ld [MonType], a + ld [wMonType], a push hl predef TryAddMonToParty - ld a, [OTPartyCount] + ld a, [wOTPartyCount] dec a - ld hl, OTPartyMon1Moves + ld hl, wOTPartyMon1Moves ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes ld d, h @@ -144,9 +144,9 @@ TrainerType2: ; 39806 push hl - ld a, [OTPartyCount] + ld a, [wOTPartyCount] dec a - ld hl, OTPartyMon1Species + ld hl, wOTPartyMon1Species ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes ld d, h @@ -194,16 +194,16 @@ TrainerType3: ; 39871 cp $ff ret z - ld [CurPartyLevel], a + ld [wCurPartyLevel], a ld a, [hli] - ld [CurPartySpecies], a + ld [wCurPartySpecies], a ld a, OTPARTYMON - ld [MonType], a + ld [wMonType], a push hl predef TryAddMonToParty - ld a, [OTPartyCount] + ld a, [wOTPartyCount] dec a - ld hl, OTPartyMon1Item + ld hl, wOTPartyMon1Item ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes ld d, h @@ -223,18 +223,18 @@ TrainerType4: ; 3989d cp $ff ret z - ld [CurPartyLevel], a + ld [wCurPartyLevel], a ld a, [hli] - ld [CurPartySpecies], a + ld [wCurPartySpecies], a ld a, OTPARTYMON - ld [MonType], a + ld [wMonType], a push hl predef TryAddMonToParty - ld a, [OTPartyCount] + ld a, [wOTPartyCount] dec a - ld hl, OTPartyMon1Item + ld hl, wOTPartyMon1Item ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes ld d, h @@ -245,9 +245,9 @@ TrainerType4: ; 3989d ld [de], a push hl - ld a, [OTPartyCount] + ld a, [wOTPartyCount] dec a - ld hl, OTPartyMon1Moves + ld hl, wOTPartyMon1Moves ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes ld d, h @@ -264,9 +264,9 @@ TrainerType4: ; 3989d push hl - ld a, [OTPartyCount] + ld a, [wOTPartyCount] dec a - ld hl, OTPartyMon1 + ld hl, wOTPartyMon1 ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes ld d, h @@ -314,7 +314,7 @@ ComputeTrainerReward: ; 3991b (e:591b) ld [hli], a ld a, [wEnemyTrainerBaseReward] ld [hli], a - ld a, [CurPartyLevel] + ld a, [wCurPartyLevel] ld [hl], a call Multiply ld hl, wBattleReward @@ -328,14 +328,14 @@ ComputeTrainerReward: ; 3991b (e:591b) Battle_GetTrainerName:: ; 39939 - ld a, [InBattleTowerBattle] + ld a, [wInBattleTowerBattle] bit 0, a - ld hl, OTPlayerName + ld hl, wOTPlayerName jp nz, CopyTrainerName - ld a, [OtherTrainerID] + ld a, [wOtherTrainerID] ld b, a - ld a, [OtherTrainerClass] + ld a, [wOtherTrainerClass] ld c, a GetTrainerName:: ; 3994c @@ -379,7 +379,7 @@ GetTrainerName:: ; 3994c jr .loop CopyTrainerName: ; 39984 - ld de, StringBuffer1 + ld de, wStringBuffer1 push de ld bc, NAME_LENGTH call CopyBytes @@ -389,7 +389,7 @@ CopyTrainerName: ; 39984 Function39990: ; 39990 ; This function is useless. - ld de, StringBuffer1 + ld de, wStringBuffer1 push de ld bc, NAME_LENGTH pop de diff --git a/engine/battle/returntobattle_useball.asm b/engine/battle/returntobattle_useball.asm index e6e33f900..b63881b2c 100644 --- a/engine/battle/returntobattle_useball.asm +++ b/engine/battle/returntobattle_useball.asm @@ -1,7 +1,7 @@ _ReturnToBattle_UseBall: ; 2715c call ClearBGPalettes call ClearTileMap - ld a, [BattleType] + ld a, [wBattleType] cp BATTLETYPE_TUTORIAL jr z, .gettutorialbackpic farcall GetBattleMonBackpic diff --git a/engine/battle/sliding_intro.asm b/engine/battle/sliding_intro.asm index 418454283..667f18191 100755 --- a/engine/battle/sliding_intro.asm +++ b/engine/battle/sliding_intro.asm @@ -1,7 +1,7 @@ BattleIntroSlidingPics: ; 4e980 ld a, [rSVBK] push af - ld a, BANK(LYOverrides) + ld a, BANK(wLYOverrides) ld [rSVBK], a call .subfunction1 ld a, rSCX - $ff00 @@ -60,7 +60,7 @@ BattleIntroSlidingPics: ; 4e980 ; 4e9d6 .subfunction3 ; 4e9d6 - ld hl, Sprite01XCoord + ld hl, wVirtualOAMSprite00XCoord ld c, $12 ; 18 ld de, SPRITEOAMSTRUCT_LENGTH .loop3 @@ -73,7 +73,7 @@ BattleIntroSlidingPics: ; 4e980 ; 4e9e5 .subfunction4 ; 4e9e5 - ld hl, LYOverrides + ld hl, wLYOverrides ld a, $90 ld bc, SCREEN_HEIGHT_PX call ByteFill @@ -81,7 +81,7 @@ BattleIntroSlidingPics: ; 4e980 ; 4e9f1 .subfunction5 ; 4e9f1 - ld hl, LYOverrides + ld hl, wLYOverrides ld a, d ld c, $3e ; 62 .loop4 diff --git a/engine/battle/start_battle.asm b/engine/battle/start_battle.asm index e1377eec0..84cd1e858 100644 --- a/engine/battle/start_battle.asm +++ b/engine/battle/start_battle.asm @@ -17,7 +17,7 @@ FindFirstAliveMonAndStartBattle: ; 2ee2f ld [hMapAnims], a call DelayFrame ld b, 6 - ld hl, PartyMon1HP + ld hl, wPartyMon1HP ld de, PARTYMON_STRUCT_LENGTH - 1 .loop @@ -32,7 +32,7 @@ FindFirstAliveMonAndStartBattle: ; 2ee2f ld de, MON_LEVEL - MON_HP add hl, de ld a, [hl] - ld [BattleMonLevel], a + ld [wBattleMonLevel], a predef DoBattleTransition farcall _LoadBattleFontsHPBar ld a, 1 @@ -52,13 +52,13 @@ PlayBattleMusic: ; 2ee6c push bc xor a - ld [MusicFade], a + ld [wMusicFade], a ld de, MUSIC_NONE call PlayMusic call DelayFrame call MaxVolume - ld a, [BattleType] + ld a, [wBattleType] cp BATTLETYPE_SUICUNE ld de, MUSIC_SUICUNE_BATTLE jp z, .done @@ -66,7 +66,7 @@ PlayBattleMusic: ; 2ee6c jp z, .done ; Are we fighting a trainer? - ld a, [OtherTrainerClass] + ld a, [wOtherTrainerClass] and a jr nz, .trainermusic @@ -76,7 +76,7 @@ PlayBattleMusic: ; 2ee6c jr nz, .kantowild ld de, MUSIC_JOHTO_WILD_BATTLE - ld a, [TimeOfDay] + ld a, [wTimeOfDay] cp NITE_F jr nz, .done ld de, MUSIC_JOHTO_WILD_BATTLE_NIGHT @@ -111,13 +111,13 @@ PlayBattleMusic: ; 2ee6c jr c, .done ld de, MUSIC_RIVAL_BATTLE - ld a, [OtherTrainerClass] + ld a, [wOtherTrainerClass] cp RIVAL1 jr z, .done cp RIVAL2 jr nz, .othertrainer - ld a, [OtherTrainerID] + ld a, [wOtherTrainerID] cp RIVAL2_2_CHIKORITA ; Rival in Indigo Plateau jr c, .done ld de, MUSIC_CHAMPION_BATTLE @@ -150,7 +150,7 @@ PlayBattleMusic: ; 2ee6c ClearBattleRAM: ; 2ef18 xor a - ld [wPlayerAction], a + ld [wBattlePlayerAction], a ld [wBattleResult], a ld hl, wPartyMenuCursor @@ -160,25 +160,25 @@ ClearBattleRAM: ; 2ef18 ld [hl], a ld [wMenuScrollPosition], a - ld [CriticalHit], a - ld [BattleMonSpecies], a + ld [wCriticalHit], a + ld [wBattleMonSpecies], a ld [wBattleParticipantsNotFainted], a - ld [CurBattleMon], a + ld [wCurBattleMon], a ld [wForcedSwitch], a - ld [TimeOfDayPal], a - ld [PlayerTurnsTaken], a - ld [EnemyTurnsTaken], a - ld [EvolvableFlags], a + ld [wTimeOfDayPal], a + ld [wPlayerTurnsTaken], a + ld [wEnemyTurnsTaken], a + ld [wEvolvableFlags], a - ld hl, PlayerHPPal + ld hl, wPlayerHPPal ld [hli], a ld [hl], a - ld hl, BattleMonDVs + ld hl, wBattleMonDVs ld [hli], a ld [hl], a - ld hl, EnemyMonDVs + ld hl, wEnemyMonDVs ld [hli], a ld [hl], a diff --git a/engine/battle/trainer_huds.asm b/engine/battle/trainer_huds.asm index 317e72214..0a18098ed 100755 --- a/engine/battle/trainer_huds.asm +++ b/engine/battle/trainer_huds.asm @@ -18,8 +18,8 @@ EnemySwitch_TrainerHud: ; 2c012 ShowPlayerMonsRemaining: ; 2c01c call DrawPlayerPartyIconHUDBorder - ld hl, PartyMon1HP - ld de, PartyCount + ld hl, wPartyMon1HP + ld de, wPartyCount call StageBallTilesData ; ldpixel wPlaceBallsX, 12, 12 ld a, 12 * 8 @@ -28,14 +28,14 @@ ShowPlayerMonsRemaining: ; 2c01c ld [hl], a ld a, 8 ld [wPlaceBallsDirection], a - ld hl, Sprite01 + ld hl, wVirtualOAMSprite00 jp LoadTrainerHudOAM ; 2c03a ShowOTTrainerMonsRemaining: ; 2c03a call DrawEnemyHUDBorder - ld hl, OTPartyMon1HP - ld de, OTPartyCount + ld hl, wOTPartyMon1HP + ld de, wOTPartyCount call StageBallTilesData ; ldpixel wPlaceBallsX, 9, 4 ld hl, wPlaceBallsX @@ -44,14 +44,14 @@ ShowOTTrainerMonsRemaining: ; 2c03a ld [hl], 4 * 8 ld a, -8 ld [wPlaceBallsDirection], a - ld hl, Sprite01 + PARTY_LENGTH * SPRITEOAMSTRUCT_LENGTH + ld hl, wVirtualOAMSprite00 + PARTY_LENGTH * SPRITEOAMSTRUCT_LENGTH jp LoadTrainerHudOAM ; 2c059 StageBallTilesData: ; 2c059 ld a, [de] push af - ld de, Buffer1 + ld de, wBuffer1 ld c, PARTY_LENGTH ld a, $34 ; empty slot .loop1 @@ -60,7 +60,7 @@ StageBallTilesData: ; 2c059 dec c jr nz, .loop1 pop af - ld de, Buffer1 + ld de, wBuffer1 .loop2 push af call .GetHUDTile @@ -147,7 +147,7 @@ DrawEnemyHUDBorder: ; 2c0c5 ld a, [wBattleMode] dec a ret nz - ld a, [TempEnemyMonSpecies] + ld a, [wTempEnemyMonSpecies] dec a call CheckCaughtMon ret z @@ -167,25 +167,25 @@ PlaceHUDBorderTiles: ; 2c0f1 ld [hl], a ld bc, SCREEN_WIDTH add hl, bc - ld a, [StartFlypoint] + ld a, [wStartFlypoint] ld [hl], a ld b, $8 .loop add hl, de - ld a, [MovementBuffer] + ld a, [wMovementBuffer] ld [hl], a dec b jr nz, .loop add hl, de - ld a, [EndFlypoint] + ld a, [wEndFlypoint] ld [hl], a ret ; 2c10d LinkBattle_TrainerHuds: ; 2c10d call LoadBallIconGFX - ld hl, PartyMon1HP - ld de, PartyCount + ld hl, wPartyMon1HP + ld de, wPartyCount call StageBallTilesData ld hl, wPlaceBallsX ld a, 10 * 8 @@ -193,22 +193,22 @@ LinkBattle_TrainerHuds: ; 2c10d ld [hl], 8 * 8 ld a, $8 ld [wPlaceBallsDirection], a - ld hl, Sprite01 + ld hl, wVirtualOAMSprite00 call LoadTrainerHudOAM - ld hl, OTPartyMon1HP - ld de, OTPartyCount + ld hl, wOTPartyMon1HP + ld de, wOTPartyCount call StageBallTilesData ld hl, wPlaceBallsX ld a, 10 * 8 ld [hli], a ld [hl], 13 * 8 - ld hl, Sprite01 + PARTY_LENGTH * SPRITEOAMSTRUCT_LENGTH + ld hl, wVirtualOAMSprite00 + PARTY_LENGTH * SPRITEOAMSTRUCT_LENGTH jp LoadTrainerHudOAM ; 2c143 LoadTrainerHudOAM: ; 2c143 - ld de, Buffer1 + ld de, wBuffer1 ld c, PARTY_LENGTH .loop ld a, [wPlaceBallsY] @@ -250,10 +250,10 @@ _ShowLinkBattleParticipants: ; 2c1b2 ld c, 14 call TextBox hlcoord 4, 5 - ld de, PlayerName + ld de, wPlayerName call PlaceString hlcoord 4, 10 - ld de, OTPlayerName + ld de, wOTPlayerName call PlaceString hlcoord 9, 8 ld a, "<BOLD_V>" diff --git a/engine/battle/updatebattlehuds.asm b/engine/battle/updatebattlehuds.asm index ec7f662e8..0c31f1c36 100644 --- a/engine/battle/updatebattlehuds.asm +++ b/engine/battle/updatebattlehuds.asm @@ -1,9 +1,9 @@ _UpdateBattleHUDs: farcall DrawPlayerHUD - ld hl, PlayerHPPal + ld hl, wPlayerHPPal call SetHPPal farcall DrawEnemyHUD - ld hl, EnemyHPPal + ld hl, wEnemyHPPal call SetHPPal farcall FinishBattleAnim ret diff --git a/engine/battle/used_move_text.asm b/engine/battle/used_move_text.asm index 1b5aa564c..bab0ea834 100755 --- a/engine/battle/used_move_text.asm +++ b/engine/battle/used_move_text.asm @@ -46,7 +46,7 @@ UsedMoveText: ; 105db9 ; everything except 'instead' made redundant in localization ; check obedience - ld a, [AlreadyDisobeyed] + ld a, [wAlreadyDisobeyed] and a ld hl, UsedMove2Text ret nz @@ -71,7 +71,7 @@ UsedMove2Text: ; 105e0b start_asm UsedMoveText_CheckObedience: ; 105e10 ; check obedience - ld a, [AlreadyDisobeyed] + ld a, [wAlreadyDisobeyed] and a jr z, .GetMoveNameText ; print "instead," @@ -183,11 +183,11 @@ INCLUDE "data/moves/grammar.asm" UpdateUsedMoves: ; 105ed0 -; append move a to PlayerUsedMoves unless it has already been used +; append move a to wPlayerUsedMoves unless it has already been used push bc ; start of list - ld hl, PlayerUsedMoves + ld hl, wPlayerUsedMoves ; get move id ld b, a ; next count @@ -209,7 +209,7 @@ UpdateUsedMoves: ; 105ed0 ; if the list is full and the move hasn't already been used ; shift the list back one byte, deleting the first move used ; this can occur with struggle or a new learned move - ld hl, PlayerUsedMoves + 1 + ld hl, wPlayerUsedMoves + 1 ; 1 = 2 ld a, [hld] ld [hli], a @@ -223,7 +223,7 @@ UpdateUsedMoves: ; 105ed0 ld [hl], a ; 4 = new move ld a, b - ld [PlayerUsedMoves + 3], a + ld [wPlayerUsedMoves + 3], a jr .quit .add diff --git a/engine/battle_anims/anim_commands.asm b/engine/battle_anims/anim_commands.asm index 0bbedf909..ca4928233 100644 --- a/engine/battle_anims/anim_commands.asm +++ b/engine/battle_anims/anim_commands.asm @@ -5,7 +5,7 @@ PlayBattleAnim: ; cc0d6 ld a, [rSVBK] push af - ld a, BANK(ActiveAnimObjects) + ld a, BANK(wActiveAnimObjects) ld [rSVBK], a call _PlayBattleAnim @@ -56,7 +56,7 @@ _PlayBattleAnim: ; cc0e4 BattleAnimRunScript: ; cc11c - ld a, [FXAnimID + 1] + ld a, [wFXAnimID + 1] and a jr nz, .hi_byte @@ -85,9 +85,9 @@ BattleAnimRunScript: ; cc11c ld de, ANIM_MISS add hl, de ld a, l - ld [FXAnimID], a + ld [wFXAnimID], a ld a, h - ld [FXAnimID + 1], a + ld [wFXAnimID + 1], a .hi_byte call WaitSFX @@ -111,18 +111,18 @@ RunBattleAnimScript: ; cc163 call BattleAnimRequestPals ; Speed up Rollout's animation. - ld a, [FXAnimID + 1] + ld a, [wFXAnimID + 1] or a jr nz, .not_rollout - ld a, [FXAnimID] + ld a, [wFXAnimID] cp ROLLOUT jr nz, .not_rollout ld a, $2e ld b, 5 ld de, 4 - ld hl, ActiveBGEffects + ld hl, wActiveBGEffects .find cp [hl] jr z, .done @@ -134,7 +134,7 @@ RunBattleAnimScript: ; cc163 call BattleAnimDelayFrame .done - ld a, [BattleAnimFlags] + ld a, [wBattleAnimFlags] bit 0, a jr z, .playframe @@ -163,7 +163,7 @@ BattleAnimRestoreHuds: ; cc1bb ld a, [rSVBK] push af - ld a, BANK(CurBattleMon) ; alternatively: BANK(TempMon), BANK(PartyMon1), several others + ld a, BANK(wCurBattleMon) ; alternatively: BANK(wTempMon), BANK(wPartyMon1), several others ld [rSVBK], a ld hl, UpdateBattleHuds @@ -206,9 +206,9 @@ BattleAnimDelayFrame: ; cc1fb ; Like DelayFrame but wastes battery life. ld a, 1 - ld [VBlankOccurred], a + ld [wVBlankOccurred], a .wait - ld a, [VBlankOccurred] + ld a, [wVBlankOccurred] and a jr nz, .wait ret @@ -253,11 +253,11 @@ Unreferenced_Functioncc220: ; cc220 BattleAnim_ClearCGB_OAMFlags: ; cc23d - ld a, [BattleAnimFlags] + ld a, [wBattleAnimFlags] bit 3, a jr z, .delete - ld hl, Sprite01Attributes + ld hl, wVirtualOAMSprite00Attributes ld c, NUM_SPRITE_OAM_STRUCTS .loop ld a, [hl] @@ -271,8 +271,8 @@ endr ret .delete - ld hl, Sprites - ld c, SpritesEnd - Sprites + ld hl, wVirtualOAM + ld c, wVirtualOAMEnd - wVirtualOAM xor a .loop2 ld [hli], a @@ -289,12 +289,12 @@ RunBattleAnimCommand: ; cc25f ; cc267 .CheckTimer: ; cc267 - ld a, [BattleAnimDuration] + ld a, [wBattleAnimDuration] and a jr z, .done dec a - ld [BattleAnimDuration], a + ld [wBattleAnimDuration], a and a ret @@ -311,7 +311,7 @@ RunBattleAnimCommand: ; cc25f jr nz, .not_done_with_anim ; Return from a subroutine. - ld hl, BattleAnimFlags + ld hl, wBattleAnimFlags bit 1, [hl] jr nz, .do_anim @@ -322,7 +322,7 @@ RunBattleAnimCommand: ; cc25f cp $d0 jr nc, .do_anim - ld [BattleAnimDuration], a + ld [wBattleAnimDuration], a ret .do_anim @@ -332,8 +332,8 @@ RunBattleAnimCommand: ; cc25f ; cc293 .DoCommand: ; cc293 -; Execute battle animation command in [BattleAnimByte]. - ld a, [BattleAnimByte] +; Execute battle animation command in [wBattleAnimByte]. + ld a, [wBattleAnimByte] sub $d0 ld e, a @@ -408,13 +408,13 @@ BattleAnimCmd_ED: ; cc304 (33:4304) ret BattleAnimCmd_Ret: ; cc305 (33:4305) - ld hl, BattleAnimFlags + ld hl, wBattleAnimFlags res 1, [hl] - ld hl, BattleAnimParent + ld hl, wBattleAnimParent ld e, [hl] inc hl ld d, [hl] - ld hl, BattleAnimAddress + ld hl, wBattleAnimAddress ld [hl], e inc hl ld [hl], d @@ -426,20 +426,20 @@ BattleAnimCmd_Call: ; cc317 (33:4317) call GetBattleAnimByte ld d, a push de - ld hl, BattleAnimAddress + ld hl, wBattleAnimAddress ld e, [hl] inc hl ld d, [hl] - ld hl, BattleAnimParent + ld hl, wBattleAnimParent ld [hl], e inc hl ld [hl], d pop de - ld hl, BattleAnimAddress + ld hl, wBattleAnimAddress ld [hl], e inc hl ld [hl], d - ld hl, BattleAnimFlags + ld hl, wBattleAnimFlags set 1, [hl] ret @@ -448,7 +448,7 @@ BattleAnimCmd_Jump: ; cc339 (33:4339) ld e, a call GetBattleAnimByte ld d, a - ld hl, BattleAnimAddress + ld hl, wBattleAnimAddress ld [hl], e inc hl ld [hl], d @@ -456,16 +456,16 @@ BattleAnimCmd_Jump: ; cc339 (33:4339) BattleAnimCmd_Loop: ; cc348 (33:4348) call GetBattleAnimByte - ld hl, BattleAnimFlags + ld hl, wBattleAnimFlags bit 2, [hl] jr nz, .continue_loop and a jr z, .perpetual dec a set 2, [hl] - ld [BattleAnimLoops], a + ld [wBattleAnimLoops], a .continue_loop - ld hl, BattleAnimLoops + ld hl, wBattleAnimLoops ld a, [hl] and a jr z, .return_from_loop @@ -475,16 +475,16 @@ BattleAnimCmd_Loop: ; cc348 (33:4348) ld e, a call GetBattleAnimByte ld d, a - ld hl, BattleAnimAddress + ld hl, wBattleAnimAddress ld [hl], e inc hl ld [hl], d ret .return_from_loop - ld hl, BattleAnimFlags + ld hl, wBattleAnimFlags res 2, [hl] - ld hl, BattleAnimAddress + ld hl, wBattleAnimAddress ld e, [hl] inc hl ld d, [hl] @@ -506,14 +506,14 @@ BattleAnimCmd_JumpUntil: ; cc383 (33:4383) ld e, a call GetBattleAnimByte ld d, a - ld hl, BattleAnimAddress + ld hl, wBattleAnimAddress ld [hl], e inc hl ld [hl], d ret .dont_jump - ld hl, BattleAnimAddress + ld hl, wBattleAnimAddress ld e, [hl] inc hl ld d, [hl] @@ -526,21 +526,21 @@ BattleAnimCmd_JumpUntil: ; cc383 (33:4383) BattleAnimCmd_SetVar: ; cc3a6 (33:43a6) call GetBattleAnimByte - ld [BattleAnimVar], a + ld [wBattleAnimVar], a ret BattleAnimCmd_IncVar: ; cc3ad (33:43ad) - ld hl, BattleAnimVar + ld hl, wBattleAnimVar inc [hl] ret BattleAnimCmd_IfVarEqual: ; cc3b2 (33:43b2) call GetBattleAnimByte - ld hl, BattleAnimVar + ld hl, wBattleAnimVar cp [hl] jr z, .jump - ld hl, BattleAnimAddress + ld hl, wBattleAnimAddress ld e, [hl] inc hl ld d, [hl] @@ -556,7 +556,7 @@ BattleAnimCmd_IfVarEqual: ; cc3b2 (33:43b2) ld e, a call GetBattleAnimByte ld d, a - ld hl, BattleAnimAddress + ld hl, wBattleAnimAddress ld [hl], e inc hl ld [hl], d @@ -568,7 +568,7 @@ BattleAnimCmd_IfParamEqual: ; cc3d6 (33:43d6) cp [hl] jr z, .jump - ld hl, BattleAnimAddress + ld hl, wBattleAnimAddress ld e, [hl] inc hl ld d, [hl] @@ -584,7 +584,7 @@ BattleAnimCmd_IfParamEqual: ; cc3d6 (33:43d6) ld e, a call GetBattleAnimByte ld d, a - ld hl, BattleAnimAddress + ld hl, wBattleAnimAddress ld [hl], e inc hl ld [hl], d @@ -597,7 +597,7 @@ BattleAnimCmd_IfParamAnd: ; cc3fa (33:43fa) and e jr nz, .jump - ld hl, BattleAnimAddress + ld hl, wBattleAnimAddress ld e, [hl] inc hl ld d, [hl] @@ -613,7 +613,7 @@ BattleAnimCmd_IfParamAnd: ; cc3fa (33:43fa) ld e, a call GetBattleAnimByte ld d, a - ld hl, BattleAnimAddress + ld hl, wBattleAnimAddress ld [hl], e inc hl ld [hl], d @@ -670,7 +670,7 @@ BattleAnimCmd_ResetObp0: ; cc46c (33:446c) ret BattleAnimCmd_ClearObjs: ; cc479 (33:4479) - ld hl, ActiveAnimObjects + ld hl, wActiveAnimObjects ld a, $a0 .loop ld [hl], $0 @@ -684,7 +684,7 @@ BattleAnimCmd_2GFX: BattleAnimCmd_3GFX: BattleAnimCmd_4GFX: BattleAnimCmd_5GFX: ; cc485 (33:4485) - ld a, [BattleAnimByte] + ld a, [wBattleAnimByte] and $f ld c, a ld hl, wBattleAnimTileDict @@ -707,7 +707,7 @@ rept 4 endr ld de, vTiles0 tile $31 add hl, de - ld a, [BattleAnimByte] + ld a, [wBattleAnimByte] call LoadBattleAnimObj ld a, [wBattleAnimTemp0] add c @@ -721,12 +721,12 @@ endr BattleAnimCmd_IncObj: ; cc4c0 (33:44c0) call GetBattleAnimByte ld e, 10 - ld bc, ActiveAnimObjects + ld bc, wActiveAnimObjects .loop ld hl, BATTLEANIMSTRUCT_INDEX add hl, bc ld d, [hl] - ld a, [BattleAnimByte] + ld a, [wBattleAnimByte] cp d jr z, .found ld hl, BATTLEANIMSTRUCT_LENGTH @@ -746,12 +746,12 @@ BattleAnimCmd_IncObj: ; cc4c0 (33:44c0) BattleAnimCmd_IncBGEffect: ; cc4e3 (33:44e3) call GetBattleAnimByte ld e, 5 - ld bc, ActiveBGEffects + ld bc, wActiveBGEffects .loop ld hl, $0 add hl, bc ld d, [hl] - ld a, [BattleAnimByte] + ld a, [wBattleAnimByte] cp d jr z, .found ld hl, 4 @@ -771,12 +771,12 @@ BattleAnimCmd_IncBGEffect: ; cc4e3 (33:44e3) BattleAnimCmd_SetObj: ; cc506 (33:4506) call GetBattleAnimByte ld e, 10 - ld bc, ActiveAnimObjects + ld bc, wActiveAnimObjects .loop ld hl, BATTLEANIMSTRUCT_INDEX add hl, bc ld d, [hl] - ld a, [BattleAnimByte] + ld a, [wBattleAnimByte] cp d jr z, .found ld hl, BATTLEANIMSTRUCT_LENGTH @@ -907,7 +907,7 @@ BattleAnimCmd_PlayerHeadObj: ; cc57e (33:457e) BattleAnimCmd_CheckPokeball: ; cc5d0 (33:45d0) callfar GetPokeBallWobble ld a, c - ld [BattleAnimVar], a + ld [wBattleAnimVar], a ret BattleAnimCmd_E7: ; cc5db (33:45db) @@ -916,34 +916,34 @@ BattleAnimCmd_E7: ; cc5db (33:45db) BattleAnimCmd_Transform: ; cc5dc (33:45dc) ld a, [rSVBK] push af - ld a, BANK(CurPartySpecies) + ld a, BANK(wCurPartySpecies) ld [rSVBK], a - ld a, [CurPartySpecies] ; CurPartySpecies + ld a, [wCurPartySpecies] ; CurPartySpecies push af ld a, [hBattleTurn] and a jr z, .player - ld a, [TempBattleMonSpecies] ; TempBattleMonSpecies - ld [CurPartySpecies], a ; CurPartySpecies - ld hl, BattleMonDVs ; BattleMonDVs + ld a, [wTempBattleMonSpecies] ; TempBattleMonSpecies + ld [wCurPartySpecies], a ; CurPartySpecies + ld hl, wBattleMonDVs ; BattleMonDVs predef GetUnownLetter ld de, vTiles0 tile $00 predef GetMonFrontpic jr .done .player - ld a, [TempEnemyMonSpecies] ; TempEnemyMonSpecies - ld [CurPartySpecies], a ; CurPartySpecies - ld hl, EnemyMonDVs ; EnemyMonDVs + ld a, [wTempEnemyMonSpecies] ; TempEnemyMonSpecies + ld [wCurPartySpecies], a ; CurPartySpecies + ld hl, wEnemyMonDVs ; EnemyMonDVs predef GetUnownLetter ld de, vTiles0 tile $00 predef GetMonBackpic .done pop af - ld [CurPartySpecies], a ; CurPartySpecies + ld [wCurPartySpecies], a ; CurPartySpecies pop af ld [rSVBK], a ret @@ -1117,10 +1117,10 @@ BattleAnimCmd_Minimize: ; cc735 (33:4735) BattleAnimCmd_DropSub: ; cc750 (33:4750) ld a, [rSVBK] push af - ld a, BANK(CurPartySpecies) + ld a, BANK(wCurPartySpecies) ld [rSVBK], a - ld a, [CurPartySpecies] ; CurPartySpecies + ld a, [wCurPartySpecies] ; CurPartySpecies push af ld a, [hBattleTurn] and a @@ -1134,7 +1134,7 @@ BattleAnimCmd_DropSub: ; cc750 (33:4750) .done pop af - ld [CurPartySpecies], a ; CurPartySpecies + ld [wCurPartySpecies], a ; CurPartySpecies pop af ld [rSVBK], a ret @@ -1142,33 +1142,33 @@ BattleAnimCmd_DropSub: ; cc750 (33:4750) BattleAnimCmd_BeatUp: ; cc776 (33:4776) ld a, [rSVBK] push af - ld a, BANK(CurPartySpecies) + ld a, BANK(wCurPartySpecies) ld [rSVBK], a - ld a, [CurPartySpecies] ; CurPartySpecies + ld a, [wCurPartySpecies] ; CurPartySpecies push af ld a, [wBattleAnimParam] - ld [CurPartySpecies], a ; CurPartySpecies + ld [wCurPartySpecies], a ; CurPartySpecies ld a, [hBattleTurn] and a jr z, .player - ld hl, BattleMonDVs + ld hl, wBattleMonDVs predef GetUnownLetter ld de, vTiles2 tile $00 predef GetMonFrontpic jr .done .player - ld hl, EnemyMonDVs + ld hl, wEnemyMonDVs predef GetUnownLetter ld de, vTiles2 tile $31 predef GetMonBackpic .done pop af - ld [CurPartySpecies], a ; CurPartySpecies + ld [wCurPartySpecies], a ; CurPartySpecies ld b, SCGB_BATTLE_COLORS call GetSGBLayout pop af @@ -1186,7 +1186,7 @@ BattleAnimCmd_OAMOff: ; cc7bf (33:47bf) ret BattleAnimCmd_ClearSprites: ; cc7c4 (33:47c4) - ld hl, BattleAnimFlags + ld hl, wBattleAnimFlags set 3, [hl] ret @@ -1207,7 +1207,7 @@ BattleAnimCmd_Sound: ; cc7cd (33:47cd) ld [wSFXDuration], a call .GetCryTrack maskbits NUM_NOISE_CHANS - ld [CryTracks], a ; CryTracks + ld [wCryTracks], a ; CryTracks ld e, a ld d, 0 @@ -1253,7 +1253,7 @@ endr ld a, [rSVBK] push af - ld a, BANK(EnemyMon) ; BattleMon is in WRAM0, but EnemyMon is in WRAMX + ld a, BANK(wEnemyMon) ; wBattleMon is in WRAM0, but EnemyMon is in WRAMX ld [rSVBK], a ld a, [hBattleTurn] @@ -1261,14 +1261,14 @@ endr jr nz, .enemy ld a, $f0 - ld [CryTracks], a - ld a, [BattleMonSpecies] + ld [wCryTracks], a + ld a, [wBattleMonSpecies] jr .done_cry_tracks .enemy ld a, $0f - ld [CryTracks], a - ld a, [EnemyMonSpecies] + ld [wCryTracks], a + ld a, [wEnemyMonSpecies] .done_cry_tracks push hl @@ -1282,30 +1282,30 @@ endr ld b, a push hl - ld hl, CryPitch + ld hl, wCryPitch ld a, [hli] ld h, [hl] ld l, a add hl, bc ld a, l - ld [CryPitch], a + ld [wCryPitch], a ld a, h - ld [CryPitch + 1], a + ld [wCryPitch + 1], a pop hl ld a, [hli] ld c, a ld b, [hl] - ld hl, CryLength ; CryLength + ld hl, wCryLength ; CryLength ld a, [hli] ld h, [hl] ld l, a add hl, bc ld a, l - ld [CryLength], a ; CryLength + ld [wCryLength], a ; CryLength ld a, h - ld [CryLength + 1], a + ld [wCryLength + 1], a ld a, 1 ld [wStereoPanningMask], a @@ -1334,7 +1334,7 @@ PlayHitSound: ; cc881 ret nz .okay - ld a, [TypeModifier] + ld a, [wTypeModifier] and $7f ret z @@ -1382,8 +1382,8 @@ BattleAnimAssignPals: ; cc8a4 ClearBattleAnims: ; cc8d3 ; Clear animation block - ld hl, LYOverrides - ld bc, wBattleAnimEnd - LYOverrides + ld hl, wLYOverrides + ld bc, wBattleAnimEnd - wLYOverrides .loop ld [hl], $0 inc hl @@ -1392,7 +1392,7 @@ ClearBattleAnims: ; cc8d3 or b jr nz, .loop - ld hl, FXAnimID + ld hl, wFXAnimID ld e, [hl] inc hl ld d, [hl] @@ -1476,7 +1476,7 @@ BattleAnim_SetOBPals: ; cc94b BattleAnim_UpdateOAM_All: ; cc96e ld a, $0 ld [wBattleAnimOAMPointerLo], a - ld hl, ActiveAnimObjects + ld hl, wActiveAnimObjects ld e, 10 .loop ld a, [hl] @@ -1499,10 +1499,10 @@ BattleAnim_UpdateOAM_All: ; cc96e jr nz, .loop ld a, [wBattleAnimOAMPointerLo] ld l, a - ld h, HIGH(Sprites) + ld h, HIGH(wVirtualOAM) .loop2 ld a, l - cp LOW(SpritesEnd) + cp LOW(wVirtualOAMEnd) jr nc, .done xor a ld [hli], a diff --git a/engine/battle_anims/bg_effects.asm b/engine/battle_anims/bg_effects.asm index a7c2012e5..3192774dd 100644 --- a/engine/battle_anims/bg_effects.asm +++ b/engine/battle_anims/bg_effects.asm @@ -9,7 +9,7 @@ ; BG effects for use in battle animations. ExecuteBGEffects: ; c8000 (32:4000) - ld hl, ActiveBGEffects + ld hl, wActiveBGEffects ld e, 5 .loop ld a, [hl] @@ -30,7 +30,7 @@ ExecuteBGEffects: ; c8000 (32:4000) ret QueueBGEffect: ; c801a (32:401a) - ld hl, ActiveBGEffects + ld hl, wActiveBGEffects ld e, 5 .loop ld a, [hl] @@ -960,7 +960,7 @@ BattleBGEffect_Surf: ; c8545 (32:4545) jr nz, .loop pop af ld [hl], a - ld de, LYOverridesBackup + ld de, wLYOverridesBackup ld hl, wSurfWaveBGEffect ld bc, $0 .loop2 @@ -1224,7 +1224,7 @@ BattleBGEffect_DoubleTeam: ; c8689 (32:4689) xor $ff inc a ld d, a - ld h, HIGH(LYOverridesBackup) + ld h, HIGH(wLYOverridesBackup) ld a, [hLYOverrideStart] ld l, a ld a, [hLYOverrideEnd] @@ -1265,7 +1265,7 @@ BattleBGEffect_AcidArmor: ; c8709 (32:4709) ld e, [hl] ld d, 2 call Functionc8f2e - ld h, HIGH(LYOverridesBackup) + ld h, HIGH(wLYOverridesBackup) ld a, [hLYOverrideEnd] ld l, a ld [hl], $0 @@ -1276,7 +1276,7 @@ BattleBGEffect_AcidArmor: ; c8709 (32:4709) .one ld a, [hLYOverrideEnd] ld l, a - ld h, HIGH(LYOverridesBackup) + ld h, HIGH(wLYOverridesBackup) ld e, l ld d, h dec de @@ -1539,10 +1539,10 @@ Tackle_BGEffect25_2d_two: Functionc88a5: ; c88a5 (32:48a5) push af - ld a, [FXAnimID + 1] ; FXAnimID + 1 + ld a, [wFXAnimID + 1] ; FXAnimID + 1 or a jr nz, .not_rollout - ld a, [FXAnimID] ; FXAnimID + ld a, [wFXAnimID] ; FXAnimID cp ROLLOUT jr z, .rollout .not_rollout @@ -1555,7 +1555,7 @@ Functionc88a5: ; c88a5 (32:48a5) ld a, [hLYOverrideEnd] sub d ld d, a - ld h, HIGH(LYOverridesBackup) + ld h, HIGH(wLYOverridesBackup) ld a, [hSCY] or a jr nz, .skip1 @@ -1847,7 +1847,7 @@ BattleBGEffect_2a: ; c8a3a (32:4a3a) ld [hLYOverrideEnd], a ld a, [hLYOverrideStart] ld l, a - ld h, HIGH(LYOverridesBackup) + ld h, HIGH(wLYOverridesBackup) .loop ld a, [hLYOverrideEnd] cp l @@ -1901,7 +1901,7 @@ BattleBGEffect_2a: ; c8a3a (32:4a3a) ld a, [hLYOverrideEnd] sub l srl a - ld h, HIGH(LYOverridesBackup) + ld h, HIGH(wLYOverridesBackup) .loop2 ld [hl], e inc hl @@ -2044,7 +2044,7 @@ BattleBGEffect_1c: ; c8b00 (32:4b00) ret .DMG_LYOverrideLoads: - ld hl, LYOverridesBackup + ld hl, wLYOverridesBackup .loop1 ld [hl], d inc hl @@ -2314,7 +2314,7 @@ BattleBGEffect_2e: ; c8ce1 (32:4ce1) ld [hSCY], a xor $ff inc a - ld [AnimObject01YOffset], a + ld [wAnimObject01YOffset], a ret BattleBGEffect_1f: ; c8cf9 (32:4cf9) @@ -2657,13 +2657,13 @@ BattleBGEffect_GetNextDMGPal: ; c8eb2 (32:4eb2) BattleBGEffects_ClearLYOverrides: ; c8eca (32:4eca) xor a BattleBGEffects_SetLYOverrides: ; c8ecb (32:4ecb) - ld hl, LYOverrides ; wListPointer + ld hl, wLYOverrides ; wListPointer ld e, $99 .loop1 ld [hli], a dec e jr nz, .loop1 - ld hl, LYOverridesBackup + ld hl, wLYOverridesBackup ld e, $91 .loop2 ld [hli], a @@ -2735,7 +2735,7 @@ Functionc8f2e: ; c8f2e (32:4f2e) ld [wBattleAnimTemp2], a ld a, $80 ld [wBattleAnimTemp3], a - ld bc, LYOverridesBackup + ld bc, wLYOverridesBackup .loop ld a, [hLYOverrideStart] cp c @@ -2796,7 +2796,7 @@ Functionc8f9a: ; c8f9a (32:4f9a) ld a, d ld [wBattleAnimTemp2], a call .GetLYOverrideBackupAddrOffset - ld hl, LYOverridesBackup + ld hl, wLYOverridesBackup add hl, de ld c, l ld b, h @@ -2853,7 +2853,7 @@ BattleBGEffect_WavyScreenFX: ; c8fef (32:4fef) ld l, a inc a ld e, a - ld h, HIGH(LYOverridesBackup) + ld h, HIGH(wLYOverridesBackup) ld d, h ld a, [hLYOverrideEnd] sub l @@ -2876,7 +2876,7 @@ BattleBGEffect_WavyScreenFX: ; c8fef (32:4fef) BGEffect_FillLYOverridesBackup: ; c900b (32:500b) push af - ld h, HIGH(LYOverridesBackup) + ld h, HIGH(wLYOverridesBackup) ld a, [hLYOverrideStart] ld l, a ld a, [hLYOverrideEnd] @@ -2899,7 +2899,7 @@ BGEffect_DisplaceLYOverridesBackup: ; c901b (32:501b) sub l sub e ld d, a - ld h, HIGH(LYOverridesBackup) + ld h, HIGH(wLYOverridesBackup) ld a, [hLYOverrideStart] ld l, a ld a, $90 @@ -2930,12 +2930,12 @@ BGEffect_CheckFlyDigStatus: ; c9042 (32:5042) and $1 xor [hl] jr nz, .player - ld a, [EnemySubStatus3] ; EnemySubStatus3 + ld a, [wEnemySubStatus3] ; EnemySubStatus3 and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND ret .player - ld a, [PlayerSubStatus3] ; PlayerSubStatus3 + ld a, [wPlayerSubStatus3] ; PlayerSubStatus3 and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND ret diff --git a/engine/battle_anims/core.asm b/engine/battle_anims/core.asm index 55adeae8c..11578f7f0 100755 --- a/engine/battle_anims/core.asm +++ b/engine/battle_anims/core.asm @@ -1,5 +1,5 @@ QueueBattleAnimation: ; cc9a1 (33:49a1) - ld hl, ActiveAnimObjects + ld hl, wActiveAnimObjects ld e, 10 .loop ld a, [hl] @@ -106,7 +106,7 @@ BattleAnimOAMUpdate: ; cca09 ld l, a ld a, [wBattleAnimOAMPointerLo] ld e, a - ld d, HIGH(Sprites) + ld d, HIGH(wVirtualOAM) .loop ld a, [wBattleAnimTempYCoord] ld b, a @@ -249,10 +249,10 @@ InitBattleAnimBuffer: ; ccaaa .check_kinesis_softboiled_milkdrink sub d push af - ld a, [FXAnimID + 1] + ld a, [wFXAnimID + 1] or a jr nz, .no_sub - ld a, [FXAnimID] + ld a, [wFXAnimID] cp KINESIS jr z, .kinesis cp SOFTBOILED diff --git a/engine/battle_anims/functions.asm b/engine/battle_anims/functions.asm index 5e85ffdb0..e747feeef 100755 --- a/engine/battle_anims/functions.asm +++ b/engine/battle_anims/functions.asm @@ -428,9 +428,9 @@ GetBallAnimPal: ; cd249 (33:5249) ld hl, BallColors ld a, [rSVBK] push af - ld a, BANK(CurItem) + ld a, BANK(wCurItem) ld [rSVBK], a - ld a, [CurItem] + ld a, [wCurItem] ld e, a pop af ld [rSVBK], a @@ -1611,7 +1611,7 @@ Functioncd913: ; cd913 (33:5913) ld hl, BATTLEANIMSTRUCT_10 add hl, bc ld e, [hl] - ld hl, hPushOAM ; $ff80 + ld hl, hTransferVirtualOAM ; $ff80 add hl, de ld e, l ld d, h @@ -2104,7 +2104,7 @@ asm_cdbfa: ; cdbfa (33:5bfa) ld hl, BATTLEANIMSTRUCT_0F add hl, bc ld e, [hl] - ld hl, hPushOAM ; $ff80 + ld hl, hTransferVirtualOAM ; $ff80 add hl, de ld e, l ld d, h @@ -3332,7 +3332,7 @@ Functionce306: ; ce306 (33:6306) ld hl, BATTLEANIMSTRUCT_0F add hl, bc ld e, [hl] - ld hl, hPushOAM ; $ff80 + ld hl, hTransferVirtualOAM ; $ff80 add hl, de ld e, l ld d, h diff --git a/engine/battle_anims/getpokeballwobble.asm b/engine/battle_anims/getpokeballwobble.asm index 2bc53d798..b3f558039 100755 --- a/engine/battle_anims/getpokeballwobble.asm +++ b/engine/battle_anims/getpokeballwobble.asm @@ -8,12 +8,12 @@ GetPokeBallWobble: ; f971 (3:7971) ld d, a push de - ld a, BANK(Buffer2) + ld a, BANK(wBuffer2) ld [rSVBK], a - ld a, [Buffer2] + ld a, [wBuffer2] inc a - ld [Buffer2], a + ld [wBuffer2], a ; Wobble up to 3 times. cp 3 + 1 @@ -25,7 +25,7 @@ GetPokeBallWobble: ; f971 (3:7971) jr nz, .done ld hl, .WobbleProbabilities - ld a, [Buffer1] + ld a, [wBuffer1] ld b, a .loop ld a, [hli] diff --git a/engine/billspc.asm b/engine/billspc.asm index 5fa590c41..57c4faac4 100755 --- a/engine/billspc.asm +++ b/engine/billspc.asm @@ -1,12 +1,12 @@ _DepositPKMN: ; e2391 (38:6391) - ld hl, Options + ld hl, wOptions ld a, [hl] push af set 4, [hl] - ld a, [VramState] + ld a, [wVramState] push af xor a - ld [VramState], a + ld [wVramState], a ld a, [hInMenu] push af ld a, $1 @@ -30,9 +30,9 @@ _DepositPKMN: ; e2391 (38:6391) pop af ld [hInMenu], a pop af - ld [VramState], a + ld [wVramState], a pop af - ld [Options], a + ld [wOptions], a ret .RunJumptable: ; e23d5 (38:63d5) @@ -61,7 +61,7 @@ _DepositPKMN: ; e2391 (38:6391) call BillsPC_RefreshTextboxes call PCMonInfo ld a, $ff - ld [CurPartySpecies], a + ld [wCurPartySpecies], a ld a, SCGB_BILLS_PC call BillsPC_ApplyPalettes call WaitBGMap @@ -117,7 +117,7 @@ _DepositPKMN: ; e2391 (38:6391) ld [hBGMapMode], a call ClearSprites call BillsPC_GetSelectedPokemonSpecies - ld [CurPartySpecies], a + ld [wCurPartySpecies], a ld a, SCGB_BILLS_PC call BillsPC_ApplyPalettes ld de, PCString_WhatsUp @@ -177,7 +177,7 @@ BillsPCDepositFuncStats: ; e24c8 (38:64c8) call ExitMenu call PCMonInfo call BillsPC_GetSelectedPokemonSpecies - ld [CurPartySpecies], a + ld [wCurPartySpecies], a ld a, SCGB_BILLS_PC call BillsPC_ApplyPalettes ret @@ -202,7 +202,7 @@ BillsPCDepositFuncRelease: ; e24e0 (38:64e0) ld a, [wBillsPC_CursorPosition] ld hl, wBillsPC_ScrollPosition add [hl] - ld [CurPartyMon], a + ld [wCurPartyMon], a xor a ld [wPokemonWithdrawDepositParameter], a farcall RemoveMonFromPartyOrBox @@ -261,14 +261,14 @@ Unreferenced_BillsPCClearThreeBoxes: ; e2564 ; e2583 _WithdrawPKMN: ; e2583 (38:6583) - ld hl, Options + ld hl, wOptions ld a, [hl] push af set 4, [hl] - ld a, [VramState] + ld a, [wVramState] push af xor a - ld [VramState], a + ld [wVramState], a ld a, [hInMenu] push af ld a, $1 @@ -292,9 +292,9 @@ _WithdrawPKMN: ; e2583 (38:6583) pop af ld [hInMenu], a pop af - ld [VramState], a + ld [wVramState], a pop af - ld [Options], a + ld [wOptions], a ret .RunJumptable: ; e25c8 (38:65c8) @@ -325,7 +325,7 @@ _WithdrawPKMN: ; e2583 (38:6583) call BillsPC_RefreshTextboxes call PCMonInfo ld a, $ff - ld [CurPartySpecies], a + ld [wCurPartySpecies], a ld a, SCGB_BILLS_PC call BillsPC_ApplyPalettes call WaitBGMap @@ -380,7 +380,7 @@ _WithdrawPKMN: ; e2583 (38:6583) ld [hBGMapMode], a call ClearSprites call BillsPC_GetSelectedPokemonSpecies - ld [CurPartySpecies], a + ld [wCurPartySpecies], a ld a, SCGB_BILLS_PC call BillsPC_ApplyPalettes ld de, PCString_WhatsUp @@ -439,7 +439,7 @@ BillsPC_Withdraw: ; e2675 (38:6675) call ExitMenu call PCMonInfo call BillsPC_GetSelectedPokemonSpecies - ld [CurPartySpecies], a + ld [wCurPartySpecies], a ld a, SCGB_BILLS_PC call BillsPC_ApplyPalettes ret @@ -462,7 +462,7 @@ BillsPC_Withdraw: ; e2675 (38:6675) ld a, [wBillsPC_CursorPosition] ld hl, wBillsPC_ScrollPosition add [hl] - ld [CurPartyMon], a + ld [wCurPartyMon], a ld a, PC_DEPOSIT ld [wPokemonWithdrawDepositParameter], a farcall RemoveMonFromPartyOrBox @@ -504,14 +504,14 @@ BillsPC_Withdraw: ; e2675 (38:6675) ; 0xe2759 _MovePKMNWithoutMail: ; e2759 - ld hl, Options + ld hl, wOptions ld a, [hl] push af set 4, [hl] - ld a, [VramState] + ld a, [wVramState] push af xor a - ld [VramState], a + ld [wVramState], a ld a, [hInMenu] push af ld a, $1 @@ -538,9 +538,9 @@ _MovePKMNWithoutMail: ; e2759 pop af ld [hInMenu], a pop af - ld [VramState], a + ld [wVramState], a pop af - ld [Options], a + ld [wOptions], a ret ; e27a2 @@ -574,7 +574,7 @@ _MovePKMNWithoutMail: ; e2759 call BillsPC_MoveMonWOMail_BoxNameAndArrows call PCMonInfo ld a, $ff - ld [CurPartySpecies], a + ld [wCurPartySpecies], a ld a, SCGB_BILLS_PC call BillsPC_ApplyPalettes call WaitBGMap @@ -640,7 +640,7 @@ _MovePKMNWithoutMail: ; e2759 ld [hBGMapMode], a call ClearSprites call BillsPC_GetSelectedPokemonSpecies - ld [CurPartySpecies], a + ld [wCurPartySpecies], a ld a, SCGB_BILLS_PC call BillsPC_ApplyPalettes ld de, PCString_WhatsUp @@ -698,7 +698,7 @@ _MovePKMNWithoutMail: ; e2759 call ExitMenu call PCMonInfo call BillsPC_GetSelectedPokemonSpecies - ld [CurPartySpecies], a + ld [wCurPartySpecies], a ld a, SCGB_BILLS_PC call BillsPC_ApplyPalettes ret @@ -1092,16 +1092,16 @@ PCMonInfo: ; e2ac6 (38:6ac6) call BillsPC_LoadMonStats ld a, [wd265] - ld [CurPartySpecies], a - ld [CurSpecies], a - ld hl, TempMonDVs + ld [wCurPartySpecies], a + ld [wCurSpecies], a + ld hl, wTempMonDVs predef GetUnownLetter call GetBaseData ld de, vTiles2 tile $00 predef GetMonFrontpic xor a ld [wBillsPC_MonHasMail], a - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] ld [wd265], a cp EGG ret z @@ -1114,7 +1114,7 @@ PCMonInfo: ; e2ac6 (38:6ac6) call PrintLevel ld a, $3 - ld [MonType], a + ld [wMonType], a farcall GetGender jr c, .skip_gender ld a, "♂" @@ -1125,7 +1125,7 @@ PCMonInfo: ; e2ac6 (38:6ac6) ld [hl], a .skip_gender - ld a, [TempMonItem] + ld a, [wTempMonItem] and a ret z @@ -1169,7 +1169,7 @@ BillsPC_LoadMonStats: ; e2b6d (38:6b6d) ld a, e call AddNTimes ld a, [hl] - ld [TempMonLevel], a + ld [wTempMonLevel], a pop hl push hl ld bc, sBoxMon1Item - sBox @@ -1178,14 +1178,14 @@ BillsPC_LoadMonStats: ; e2b6d (38:6b6d) ld a, e call AddNTimes ld a, [hl] - ld [TempMonItem], a + ld [wTempMonItem], a pop hl ld bc, sBoxMon1DVs - sBox add hl, bc ld bc, BOXMON_STRUCT_LENGTH ld a, e call AddNTimes - ld de, TempMonDVs + ld de, wTempMonDVs ld a, [hli] ld [de], a inc de @@ -1195,23 +1195,23 @@ BillsPC_LoadMonStats: ; e2b6d (38:6b6d) ret .party - ld hl, PartyMon1Level + ld hl, wPartyMon1Level ld bc, PARTYMON_STRUCT_LENGTH ld a, e call AddNTimes ld a, [hl] - ld [TempMonLevel], a - ld hl, PartyMon1Item + ld [wTempMonLevel], a + ld hl, wPartyMon1Item ld bc, PARTYMON_STRUCT_LENGTH ld a, e call AddNTimes ld a, [hl] - ld [TempMonItem], a - ld hl, PartyMon1DVs + ld [wTempMonItem], a + ld hl, wPartyMon1DVs ld bc, PARTYMON_STRUCT_LENGTH ld a, e call AddNTimes - ld de, TempMonDVs + ld de, wTempMonDVs ld a, [hli] ld [de], a inc de @@ -1227,20 +1227,20 @@ BillsPC_LoadMonStats: ; e2b6d (38:6b6d) ld a, e call AddNTimes ld a, [hl] - ld [TempMonLevel], a + ld [wTempMonLevel], a ld hl, sBoxMon1Item ld bc, BOXMON_STRUCT_LENGTH ld a, e call AddNTimes ld a, [hl] - ld [TempMonItem], a + ld [wTempMonItem], a ld hl, sBoxMon1DVs ld bc, BOXMON_STRUCT_LENGTH ld a, e call AddNTimes - ld de, TempMonDVs + ld de, wTempMonDVs ld a, [hli] ld [de], a inc de @@ -1334,12 +1334,12 @@ BillsPC_RefreshTextboxes: ; e2c2c (38:6c2c) ld bc, MON_NAME_LENGTH ld a, e call AddNTimes - ld de, StringBuffer1 + ld de, wStringBuffer1 ld bc, MON_NAME_LENGTH call CopyBytes call CloseSRAM pop hl - ld de, StringBuffer1 + ld de, wStringBuffer1 call PlaceString ret @@ -1350,21 +1350,21 @@ BillsPC_RefreshTextboxes: ; e2c2c (38:6c2c) .party push hl - ld hl, PartySpecies + ld hl, wPartySpecies ld d, $0 add hl, de ld a, [hl] and a jr z, .partyfail - ld hl, PartyMonNicknames + ld hl, wPartyMonNicknames ld bc, MON_NAME_LENGTH ld a, e call AddNTimes - ld de, StringBuffer1 + ld de, wStringBuffer1 ld bc, MON_NAME_LENGTH call CopyBytes pop hl - ld de, StringBuffer1 + ld de, wStringBuffer1 call PlaceString ret @@ -1386,12 +1386,12 @@ BillsPC_RefreshTextboxes: ; e2c2c (38:6c2c) ld bc, MON_NAME_LENGTH ld a, e call AddNTimes - ld de, StringBuffer1 + ld de, wStringBuffer1 ld bc, MON_NAME_LENGTH call CopyBytes call CloseSRAM pop hl - ld de, StringBuffer1 + ld de, wStringBuffer1 call PlaceString ret @@ -1465,7 +1465,7 @@ CopyBoxmonSpecies: ; e2d30 (38:6d30) ret .party - ld hl, PartySpecies + ld hl, wPartySpecies copy_box_data 0 ret @@ -1498,7 +1498,7 @@ BillsPC_UpdateSelectionCursor: ; e2e01 (38:6e01) .place_cursor ld hl, .OAM - ld de, Sprite01 + ld de, wVirtualOAMSprite00 .loop ld a, [hl] cp -1 @@ -1548,7 +1548,7 @@ endr BillsPC_UpdateInsertCursor: ; e2e8c ld hl, .OAM - ld de, Sprite01 + ld de, wVirtualOAMSprite00 .loop ld a, [hl] cp -1 @@ -1645,7 +1645,7 @@ BillsPC_CheckMail_PreventBlackout: ; e2f18 (38:6f18) ld a, [wBillsPC_CursorPosition] ld hl, wBillsPC_ScrollPosition add [hl] - ld [CurPartyMon], a + ld [wCurPartyMon], a farcall CheckCurPartyMonFainted jr c, .AllOthersFainted ld a, [wBillsPC_MonHasMail] @@ -1676,7 +1676,7 @@ BillsPC_CheckMail_PreventBlackout: ; e2f18 (38:6f18) ret BillsPC_IsMonAnEgg: ; e2f5f (38:6f5f) - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] cp EGG jr z, .egg and a @@ -1697,7 +1697,7 @@ BillsPC_StatsScreen: ; e2f7e (38:6f7e) call LowVolume call BillsPC_CopyMon ld a, $3 - ld [MonType], a + ld [wMonType], a predef StatsScreenInit call BillsPC_InitGFX call MaxVolume @@ -1723,9 +1723,9 @@ StatsScreenDPad: ; e2f95 (38:6f95) ld [wd265], a call BillsPC_LoadMonStats ld a, [wd265] - ld [CurPartySpecies], a - ld [CurSpecies], a - ld hl, TempMonDVs + ld [wCurPartySpecies], a + ld [wCurSpecies], a + ld hl, wTempMonDVs predef GetUnownLetter call GetBaseData call BillsPC_CopyMon @@ -1741,7 +1741,7 @@ BillsPC_CopyMon: ; e2fd6 (38:6fd6) ld a, [wBillsPC_CursorPosition] ld hl, wBillsPC_ScrollPosition add [hl] - ld [CurPartyMon], a + ld [wCurPartyMon], a ld a, [wBillsPC_LoadedBox] and a jr z, .party @@ -1757,7 +1757,7 @@ BillsPC_CopyMon: ; e2fd6 (38:6fd6) call CopyOTNameToTemp ld hl, sBoxMons ld bc, BOXMON_STRUCT_LENGTH - ld a, [CurPartyMon] + ld a, [wCurPartyMon] call AddNTimes ld de, wBufferMon ld bc, PARTYMON_STRUCT_LENGTH @@ -1767,15 +1767,15 @@ BillsPC_CopyMon: ; e2fd6 (38:6fd6) ret .party - ld hl, PartySpecies + ld hl, wPartySpecies call CopySpeciesToTemp - ld hl, PartyMonNicknames + ld hl, wPartyMonNicknames call CopyNicknameToTemp - ld hl, PartyMonOT + ld hl, wPartyMonOT call CopyOTNameToTemp - ld hl, PartyMon1 + ld hl, wPartyMon1 ld bc, PARTYMON_STRUCT_LENGTH - ld a, [CurPartyMon] + ld a, [wCurPartyMon] call AddNTimes ld de, wBufferMon ld bc, PARTYMON_STRUCT_LENGTH @@ -1813,9 +1813,9 @@ DepositPokemon: ; e307c (38:707c) ld a, [wBillsPC_CursorPosition] ld hl, wBillsPC_ScrollPosition add [hl] - ld [CurPartyMon], a - ld hl, PartyMonNicknames - ld a, [CurPartyMon] + ld [wCurPartyMon], a + ld hl, wPartyMonNicknames + ld a, [wCurPartyMon] call GetNick ld a, PC_DEPOSIT ld [wPokemonWithdrawDepositParameter], a @@ -1824,7 +1824,7 @@ DepositPokemon: ; e307c (38:707c) xor a ld [wPokemonWithdrawDepositParameter], a farcall RemoveMonFromPartyOrBox - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] call PlayMonCry hlcoord 0, 0 lb bc, 15, 8 @@ -1841,7 +1841,7 @@ DepositPokemon: ; e307c (38:707c) call PlaceString ld l, c ld h, b - ld de, StringBuffer1 + ld de, wStringBuffer1 call PlaceString ld a, "!" ld [bc], a @@ -1865,10 +1865,10 @@ TryWithdrawPokemon: ; e30fa (38:70fa) ld a, [wBillsPC_CursorPosition] ld hl, wBillsPC_ScrollPosition add [hl] - ld [CurPartyMon], a + ld [wCurPartyMon], a ld a, BANK(sBoxMonNicknames) call GetSRAMBank - ld a, [CurPartyMon] + ld a, [wCurPartyMon] ld hl, sBoxMonNicknames call GetNick call CloseSRAM @@ -1879,7 +1879,7 @@ TryWithdrawPokemon: ; e30fa (38:70fa) ld a, PC_DEPOSIT ld [wPokemonWithdrawDepositParameter], a farcall RemoveMonFromPartyOrBox - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] call PlayMonCry hlcoord 0, 0 lb bc, 15, 8 @@ -1896,7 +1896,7 @@ TryWithdrawPokemon: ; e30fa (38:70fa) call PlaceString ld l, c ld h, b - ld de, StringBuffer1 + ld de, wStringBuffer1 call PlaceString ld a, $e7 ld [bc], a @@ -1929,7 +1929,7 @@ ReleasePKMN_ByePKMN: ; e3180 (38:7180) call TextBox call WaitBGMap - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] call GetCryIndex jr c, .skip_cry ld e, c @@ -1937,7 +1937,7 @@ ReleasePKMN_ByePKMN: ; e3180 (38:7180) call PlayCry .skip_cry - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] ld [wd265], a call GetPokemonName hlcoord 1, 16 @@ -1954,7 +1954,7 @@ ReleasePKMN_ByePKMN: ; e3180 (38:7180) ld l, c ld h, b inc hl - ld de, StringBuffer1 + ld de, wStringBuffer1 call PlaceString ld l, c ld h, b @@ -2099,7 +2099,7 @@ MovePKMNWitoutMail_InsertMon: ; e31e7 ld a, [wBillsPC_BackupCursorPosition] ld hl, wBillsPC_BackupScrollPosition add [hl] - ld [CurPartyMon], a + ld [wCurPartyMon], a ld a, BANK(sBox) call GetSRAMBank ld hl, sBoxSpecies @@ -2127,7 +2127,7 @@ MovePKMNWitoutMail_InsertMon: ; e31e7 ld a, [wBillsPC_CursorPosition] ld hl, wBillsPC_ScrollPosition add [hl] - ld [CurPartyMon], a + ld [wCurPartyMon], a farcall InsertPokemonIntoBox ret ; e3316 @@ -2136,14 +2136,14 @@ MovePKMNWitoutMail_InsertMon: ; e31e7 ld a, [wBillsPC_BackupCursorPosition] ld hl, wBillsPC_BackupScrollPosition add [hl] - ld [CurPartyMon], a - ld hl, PartySpecies + ld [wCurPartyMon], a + ld hl, wPartySpecies call CopySpeciesToTemp - ld hl, PartyMonNicknames + ld hl, wPartyMonNicknames call CopyNicknameToTemp - ld hl, PartyMonOT + ld hl, wPartyMonOT call CopyOTNameToTemp - ld hl, PartyMon1Species + ld hl, wPartyMon1Species ld bc, PARTYMON_STRUCT_LENGTH call CopyMonToTemp xor a @@ -2156,23 +2156,23 @@ MovePKMNWitoutMail_InsertMon: ; e31e7 ld a, [wBillsPC_CursorPosition] ld hl, wBillsPC_ScrollPosition add [hl] - ld [CurPartyMon], a + ld [wCurPartyMon], a farcall InsertPokemonIntoParty ret ; e3357 CopySpeciesToTemp: ; e3357 (38:7357) - ld a, [CurPartyMon] + ld a, [wCurPartyMon] ld c, a ld b, $0 add hl, bc ld a, [hl] - ld [CurPartySpecies], a + ld [wCurPartySpecies], a ret CopyNicknameToTemp: ; e3363 (38:7363) ld bc, MON_NAME_LENGTH - ld a, [CurPartyMon] + ld a, [wCurPartyMon] call AddNTimes ld de, wBufferMonNick ld bc, MON_NAME_LENGTH @@ -2181,7 +2181,7 @@ CopyNicknameToTemp: ; e3363 (38:7363) CopyOTNameToTemp: ; e3376 (38:7376) ld bc, NAME_LENGTH - ld a, [CurPartyMon] + ld a, [wCurPartyMon] call AddNTimes ld de, wBufferMonOT ld bc, NAME_LENGTH @@ -2189,7 +2189,7 @@ CopyOTNameToTemp: ; e3376 (38:7376) ret CopyMonToTemp: ; e3389 (38:7389) - ld a, [CurPartyMon] + ld a, [wCurPartyMon] call AddNTimes ld de, wBufferMon call CopyBytes @@ -2357,7 +2357,7 @@ endr .boxnames ; e3619 push de - ld a, [MenuSelection] + ld a, [wMenuSelection] dec a call GetBoxName pop hl @@ -2378,7 +2378,7 @@ BillsPC_PrintBoxCountAndCapacity: ; e3632 hlcoord 11, 7 lb bc, 5, 7 call TextBox - ld a, [MenuSelection] + ld a, [wMenuSelection] cp -1 ret z hlcoord 12, 9 @@ -2410,7 +2410,7 @@ BillsPC_PrintBoxCountAndCapacity: ; e3632 GetBoxCount: ; e366c (38:766c) ld a, [wCurBox] ld c, a - ld a, [MenuSelection] + ld a, [wMenuSelection] dec a cp c jr z, .activebox @@ -2508,7 +2508,7 @@ BillsPC_ChangeBoxSubmenu: ; e36f9 (38:76f9) jr z, .EmptyBox ld e, l ld d, h - ld a, [MenuSelection] + ld a, [wMenuSelection] dec a ld c, a farcall PrintPCBox @@ -2522,7 +2522,7 @@ BillsPC_ChangeBoxSubmenu: ; e36f9 (38:76f9) ret .Switch: - ld a, [MenuSelection] + ld a, [wMenuSelection] dec a ld e, a ld a, [wCurBox] @@ -2538,7 +2538,7 @@ BillsPC_ChangeBoxSubmenu: ; e36f9 (38:76f9) call ClearTileMap call LoadStandardFont call LoadFontsBattleExtra - ld a, [MenuSelection] + ld a, [wMenuSelection] dec a call GetBoxName ld e, l @@ -2546,7 +2546,7 @@ BillsPC_ChangeBoxSubmenu: ; e36f9 (38:76f9) ld hl, wd002 ld c, BOX_NAME_LENGTH - 1 call InitString - ld a, [MenuSelection] + ld a, [wMenuSelection] dec a call GetBoxName ld de, wd002 diff --git a/engine/billspctop.asm b/engine/billspctop.asm index ac70082d6..2c0a110ba 100755 --- a/engine/billspctop.asm +++ b/engine/billspctop.asm @@ -6,7 +6,7 @@ _BillsPC: ; e3fd jp .LogOut .CheckCanUsePC: ; e40a (3:640a) - ld a, [PartyCount] + ld a, [wPartyCount] and a ret nz ld hl, .Text_GottaHavePokemon @@ -24,14 +24,14 @@ _BillsPC: ; e3fd ld [hBGMapMode], a call LoadStandardMenuDataHeader call ClearPCItemScreen - ld hl, Options + ld hl, wOptions ld a, [hl] push af set NO_TEXT_SCROLL, [hl] ld hl, .Text_What call PrintText pop af - ld [Options], a + ld [wOptions], a call LoadFontsBattleExtra ret @@ -58,7 +58,7 @@ _BillsPC: ; e3fd jr c, .cancel ld a, [wMenuCursorBuffer] push af - ld a, [MenuSelection] + ld a, [wMenuSelection] ld hl, .Jumptable rst JumpTable pop bc @@ -143,7 +143,7 @@ BillsPC_DepositMenu: ; e4fe (3:64fe) ret Unreferenced_Functione512: - ld a, [PartyCount] + ld a, [wPartyCount] and a jr z, .no_pkmn cp 2 @@ -174,11 +174,11 @@ Unreferenced_Functione512: db "@" CheckCurPartyMonFainted: ; e538 - ld hl, PartyMon1HP + ld hl, wPartyMon1HP ld de, PARTYMON_STRUCT_LENGTH ld b, $0 .loop - ld a, [CurPartyMon] + ld a, [wCurPartyMon] cp b jr z, .skip ld a, [hli] @@ -188,7 +188,7 @@ CheckCurPartyMonFainted: ; e538 .skip inc b - ld a, [PartyCount] + ld a, [wPartyCount] cp b jr z, .done add hl, de @@ -212,7 +212,7 @@ BillsPC_WithdrawMenu: ; e559 (3:6559) ret Unreferenced_Functione56d: - ld a, [PartyCount] + ld a, [wPartyCount] cp PARTY_LENGTH jr nc, .asm_e576 and a @@ -255,11 +255,11 @@ ClearPCItemScreen: ; e58b ret CopyBoxmonToTempMon: ; e5bb - ld a, [CurPartyMon] + ld a, [wCurPartyMon] ld hl, sBoxMon1Species ld bc, BOXMON_STRUCT_LENGTH call AddNTimes - ld de, TempMonSpecies + ld de, wTempMonSpecies ld bc, BOXMON_STRUCT_LENGTH ld a, BANK(sBoxMon1Species) call GetSRAMBank @@ -309,7 +309,7 @@ Unreferenced_Functione5d9: ld a, [hl] ld [de], a inc de - ld [CurSpecies], a + ld [wCurSpecies], a call GetBaseData pop bc pop hl @@ -352,7 +352,7 @@ Unreferenced_Functione5d9: swap a or b ld b, a - ld a, [BaseGender] + ld a, [wBaseGender] cp b ld a, $1 jr c, .okay2 diff --git a/engine/breeding.asm b/engine/breeding.asm index b16747089..7756d30ef 100755 --- a/engine/breeding.asm +++ b/engine/breeding.asm @@ -3,13 +3,13 @@ CheckBreedmonCompatibility: ; 16e1d ld c, $0 jp nc, .done ld a, [wBreedMon1Species] - ld [CurPartySpecies], a + ld [wCurPartySpecies], a ld a, [wBreedMon1DVs] - ld [TempMonDVs], a + ld [wTempMonDVs], a ld a, [wBreedMon1DVs + 1] - ld [TempMonDVs + 1], a + ld [wTempMonDVs + 1], a ld a, TEMPMON - ld [MonType], a + ld [wMonType], a predef GetGender jr c, .genderless ld b, $1 @@ -19,13 +19,13 @@ CheckBreedmonCompatibility: ; 16e1d .breedmon2 push bc ld a, [wBreedMon2Species] - ld [CurPartySpecies], a + ld [wCurPartySpecies], a ld a, [wBreedMon2DVs] - ld [TempMonDVs], a + ld [wTempMonDVs], a ld a, [wBreedMon2DVs + 1] - ld [TempMonDVs + 1], a + ld [wTempMonDVs + 1], a ld a, $3 - ld [MonType], a + ld [wMonType], a predef GetGender pop bc jr c, .genderless @@ -109,16 +109,16 @@ CheckBreedmonCompatibility: ; 16e1d ; If either mon is in the No Eggs group, ; they are not compatible. ld a, [wBreedMon2Species] - ld [CurSpecies], a + ld [wCurSpecies], a call GetBaseData - ld a, [BaseEggGroups] + ld a, [wBaseEggGroups] cp NO_EGGS * $11 jr z, .Incompatible ld a, [wBreedMon1Species] - ld [CurSpecies], a + ld [wCurSpecies], a call GetBaseData - ld a, [BaseEggGroups] + ld a, [wBaseEggGroups] cp NO_EGGS * $11 jr z, .Incompatible @@ -127,9 +127,9 @@ CheckBreedmonCompatibility: ; 16e1d ld a, [wBreedMon2Species] cp DITTO jr z, .Compatible - ld [CurSpecies], a + ld [wCurSpecies], a call GetBaseData - ld a, [BaseEggGroups] + ld a, [wBaseEggGroups] push af and $f ld b, a @@ -141,11 +141,11 @@ CheckBreedmonCompatibility: ; 16e1d ld a, [wBreedMon1Species] cp DITTO jr z, .Compatible - ld [CurSpecies], a + ld [wCurSpecies], a push bc call GetBaseData pop bc - ld a, [BaseEggGroups] + ld a, [wBaseEggGroups] push af and $f ld d, a @@ -176,8 +176,8 @@ CheckBreedmonCompatibility: ; 16e1d ; 16f3e DoEggStep:: ; 16f3e - ld de, PartySpecies - ld hl, PartyMon1Happiness + ld de, wPartySpecies + ld hl, wPartyMon1Happiness ld c, 0 .loop ld a, [de] @@ -210,10 +210,10 @@ OverworldHatchEgg:: ; 16f5e ; 16f70 HatchEggs: ; 16f70 (5:6f70) - ld de, PartySpecies - ld hl, PartyMon1Happiness + ld de, wPartySpecies + ld hl, wPartyMon1Happiness xor a - ld [CurPartyMon], a + ld [wCurPartyMon], a .loop ; 16f7a (5:6f7a) ld a, [de] @@ -233,16 +233,16 @@ HatchEggs: ; 16f70 (5:6f70) farcall SetEggMonCaughtData farcall StubbedTrainerRankings_EggsHatched - ld a, [CurPartyMon] - ld hl, PartyMon1Species + ld a, [wCurPartyMon] + ld hl, wPartyMon1Species ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes ld a, [hl] - ld [CurPartySpecies], a + ld [wCurPartySpecies], a dec a call SetSeenAndCaughtMon - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] cp TOGEPI jr nz, .nottogepi ; set the event flag for hatching togepi @@ -253,17 +253,17 @@ HatchEggs: ; 16f70 (5:6f70) pop de - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] dec de ld [de], a ld [wd265], a - ld [CurSpecies], a + ld [wCurSpecies], a call GetPokemonName xor a ld [wd26b], a call GetBaseData - ld a, [CurPartyMon] - ld hl, PartyMon1 + ld a, [wCurPartyMon] + ld hl, wPartyMon1 ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes push hl @@ -276,7 +276,7 @@ HatchEggs: ; 16f70 (5:6f70) ld bc, MON_LEVEL add hl, bc ld a, [hl] - ld [CurPartyLevel], a + ld [wCurPartyLevel], a pop hl push hl ld bc, MON_STATUS @@ -304,22 +304,22 @@ HatchEggs: ; 16f70 (5:6f70) ld [hl], a ld hl, MON_ID add hl, bc - ld a, [PlayerID] + ld a, [wPlayerID] ld [hli], a - ld a, [PlayerID + 1] + ld a, [wPlayerID + 1] ld [hl], a - ld a, [CurPartyMon] - ld hl, PartyMonOT + ld a, [wCurPartyMon] + ld hl, wPartyMonOT ld bc, NAME_LENGTH call AddNTimes ld d, h ld e, l - ld hl, PlayerName + ld hl, wPlayerName call CopyBytes ld hl, .Text_HatchEgg call PrintText - ld a, [CurPartyMon] - ld hl, PartyMonNicknames + ld a, [wCurPartyMon] + ld hl, wPartyMonNicknames ld bc, MON_NAME_LENGTH call AddNTimes ld d, h @@ -334,22 +334,22 @@ HatchEggs: ; 16f70 (5:6f70) ld a, $1 ld [wd26b], a xor a - ld [MonType], a + ld [wMonType], a push de ld b, $0 farcall NamingScreen pop hl - ld de, StringBuffer1 + ld de, wStringBuffer1 call InitName jr .next .nonickname - ld hl, StringBuffer1 + ld hl, wStringBuffer1 ld bc, MON_NAME_LENGTH call CopyBytes .next ; 1707d (5:707d) - ld hl, CurPartyMon + ld hl, wCurPartyMon inc [hl] pop hl ld de, PARTYMON_STRUCT_LENGTH @@ -365,18 +365,18 @@ HatchEggs: ; 16f70 (5:6f70) ; Huh? @ @ text_jump UnknownText_0x1c0db0 start_asm - ld hl, VramState + ld hl, wVramState res 0, [hl] push hl push de push bc - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] push af call EggHatch_AnimationSequence ld hl, .ClearTextbox call PrintText pop af - ld [CurPartySpecies], a + ld [wCurPartySpecies], a pop bc pop de pop hl @@ -580,32 +580,32 @@ GetHeritableMoves: ; 17197 ret .ditto1 - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] push af ld a, [wBreedMon2Species] - ld [CurPartySpecies], a + ld [wCurPartySpecies], a ld a, [wBreedMon2DVs] - ld [TempMonDVs], a + ld [wTempMonDVs], a ld a, [wBreedMon2DVs + 1] - ld [TempMonDVs + 1], a + ld [wTempMonDVs + 1], a ld a, TEMPMON - ld [MonType], a + ld [wMonType], a predef GetGender jr c, .inherit_mon2_moves jr nz, .inherit_mon2_moves jr .inherit_mon1_moves .ditto2 - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] push af ld a, [wBreedMon1Species] - ld [CurPartySpecies], a + ld [wCurPartySpecies], a ld a, [wBreedMon1DVs] - ld [TempMonDVs], a + ld [wTempMonDVs], a ld a, [wBreedMon1DVs + 1] - ld [TempMonDVs + 1], a + ld [wTempMonDVs + 1], a ld a, TEMPMON - ld [MonType], a + ld [wMonType], a predef GetGender jr c, .inherit_mon1_moves jr nz, .inherit_mon1_moves @@ -613,13 +613,13 @@ GetHeritableMoves: ; 17197 .inherit_mon2_moves ld hl, wBreedMon2Moves pop af - ld [CurPartySpecies], a + ld [wCurPartySpecies], a ret .inherit_mon1_moves ld hl, wBreedMon1Moves pop af - ld [CurPartySpecies], a + ld [wCurPartySpecies], a ret ; 1720b @@ -643,20 +643,20 @@ GetBreedmonMovePointer: ; 1720b GetEggFrontpic: ; 17224 (5:7224) push de - ld [CurPartySpecies], a - ld [CurSpecies], a + ld [wCurPartySpecies], a + ld [wCurSpecies], a call GetBaseData - ld hl, BattleMonDVs + ld hl, wBattleMonDVs predef GetUnownLetter pop de predef_jump GetMonFrontpic GetHatchlingFrontpic: ; 1723c (5:723c) push de - ld [CurPartySpecies], a - ld [CurSpecies], a + ld [wCurPartySpecies], a + ld [wCurSpecies], a call GetBaseData - ld hl, BattleMonDVs + ld hl, wBattleMonDVs predef GetUnownLetter pop de predef_jump GetAnimatedFrontpic @@ -697,7 +697,7 @@ EggHatch_DoAnimFrame: ; 1727f (5:727f) EggHatch_AnimationSequence: ; 1728f (5:728f) ld a, [wd265] ld [wJumptableIndex], a - ld a, [CurSpecies] + ld a, [wCurSpecies] push af ld de, MUSIC_NONE call PlayMusic @@ -775,17 +775,17 @@ EggHatch_AnimationSequence: ; 1728f (5:728f) call Hatch_ShellFragmentLoop call WaitSFX ld a, [wJumptableIndex] - ld [CurPartySpecies], a + ld [wCurPartySpecies], a hlcoord 6, 3 ld d, $0 ld e, ANIM_MON_HATCH predef AnimateFrontpic pop af - ld [CurSpecies], a + ld [wCurSpecies], a ret Hatch_LoadFrontpicPal: ; 17363 (5:7363) - ld [PlayerHPPal], a + ld [wPlayerHPPal], a ld b, SCGB_EVOLUTION ld c, $0 jp GetSGBLayout @@ -931,7 +931,7 @@ DayCareMon1Text: ; 0x17467 DayCareMonCompatibilityText: ; 1746c push bc - ld de, StringBuffer1 + ld de, wStringBuffer1 ld bc, NAME_LENGTH call CopyBytes call CheckBreedmonCompatibility diff --git a/engine/buy_sell_toss.asm b/engine/buy_sell_toss.asm index ff2bd2967..d2cf14628 100755 --- a/engine/buy_sell_toss.asm +++ b/engine/buy_sell_toss.asm @@ -9,9 +9,9 @@ SelectQuantityToBuy: ; 24fc9 farcall GetItemPrice RooftopSale_SelectQuantityToBuy: ; 24fcf ld a, d - ld [Buffer1], a + ld [wBuffer1], a ld a, e - ld [Buffer2], a + ld [wBuffer2], a ld hl, BuyItem_MenuDataHeader call LoadMenuDataHeader call Toss_Sell_Loop @@ -21,9 +21,9 @@ RooftopSale_SelectQuantityToBuy: ; 24fcf SelectQuantityToSell: ; 24fe1 farcall GetItemPrice ld a, d - ld [Buffer1], a + ld [wBuffer1], a ld a, e - ld [Buffer2], a + ld [wBuffer2], a ld hl, SellItem_MenuDataHeader call LoadMenuDataHeader call Toss_Sell_Loop @@ -167,9 +167,9 @@ DisplaySellingPrice: ; 2509f BuySell_MultiplyPrice: ; 250a9 xor a ld [hMultiplicand + 0], a - ld a, [Buffer1] + ld a, [wBuffer1] ld [hMultiplicand + 1], a - ld a, [Buffer2] + ld a, [wBuffer2] ld [hMultiplicand + 2], a ld a, [wItemQuantityChangeBuffer] ld [hMultiplier], a diff --git a/engine/card_flip.asm b/engine/card_flip.asm index ae90b124a..fbeb3e3b6 100755 --- a/engine/card_flip.asm +++ b/engine/card_flip.asm @@ -11,7 +11,7 @@ ret_e00ed: ; e00ed (38:40ed) ret _CardFlip: ; e00ee (38:40ee) - ld hl, Options + ld hl, wOptions set 4, [hl] call ClearBGPalettes call ClearTileMap @@ -70,7 +70,7 @@ _CardFlip: ; e00ee (38:40ee) call PlaySFX call WaitSFX call ClearBGPalettes - ld hl, Options + ld hl, wOptions res 4, [hl] ret @@ -126,9 +126,9 @@ _CardFlip: ; e00ee (38:40ee) ; 0xe01d2 .DeductCoins: ; e01d2 - ld a, [Coins] + ld a, [wCoins] ld h, a - ld a, [Coins + 1] + ld a, [wCoins + 1] ld l, a ld a, h and a @@ -146,9 +146,9 @@ _CardFlip: ; e00ee (38:40ee) ld de, -3 add hl, de ld a, h - ld [Coins], a + ld [wCoins], a ld a, l - ld [Coins + 1], a + ld [wCoins + 1], a ld de, SFX_TRANSACTION call PlaySFX xor a @@ -485,7 +485,7 @@ CardFlip_DisplayCardFaceUp: ; e03ec ret z ; Set the attributes - ld de, AttrMap - TileMap + ld de, wAttrMap - wTileMap add hl, de ld a, [wCardFlipFaceUpCard] and 3 @@ -535,7 +535,7 @@ CardFlip_PrintCoinBalance: ; e049c ld de, .CoinStr call PlaceString hlcoord 15, 16 - ld de, Coins + ld de, wCoins lb bc, PRINTNUM_LEADINGZEROS | 2, 4 call PrintNum ret @@ -601,7 +601,7 @@ CardFlip_CopyToBox: ; e04f7 (38:44f7) ; e0509 (38:4509) CardFlip_CopyOAM: ; e0509 - ld de, Sprite01 + ld de, wVirtualOAMSprite00 ld a, [hli] .loop push af @@ -1174,29 +1174,29 @@ CardFlip_CheckWinCondition: ; e0637 ; 0xe081b .AddCoinPlaySFX: ; e081b - ld a, [Coins] + ld a, [wCoins] ld h, a - ld a, [Coins + 1] + ld a, [wCoins + 1] ld l, a inc hl ld a, h - ld [Coins], a + ld [wCoins], a ld a, l - ld [Coins + 1], a + ld [wCoins + 1], a ld de, SFX_PAY_DAY call PlaySFX ret ; e0833 .IsCoinCaseFull: ; e0833 - ld a, [Coins] + ld a, [wCoins] cp HIGH(MAX_COINS) jr c, .less jr z, .check_low jr .more .check_low - ld a, [Coins + 1] + ld a, [wCoins + 1] cp LOW(MAX_COINS) jr c, .less @@ -1625,32 +1625,32 @@ CardFlip_InitAttrPals: ; e0c37 (38:4c37) and a ret z - hlcoord 0, 0, AttrMap + hlcoord 0, 0, wAttrMap ld bc, SCREEN_HEIGHT * SCREEN_WIDTH xor a call ByteFill - hlcoord 12, 1, AttrMap + hlcoord 12, 1, wAttrMap lb bc, 2, 2 ld a, $1 call CardFlip_FillBox - hlcoord 14, 1, AttrMap + hlcoord 14, 1, wAttrMap lb bc, 2, 2 ld a, $2 call CardFlip_FillBox - hlcoord 16, 1, AttrMap + hlcoord 16, 1, wAttrMap lb bc, 2, 2 ld a, $3 call CardFlip_FillBox - hlcoord 18, 1, AttrMap + hlcoord 18, 1, wAttrMap lb bc, 2, 2 ld a, $4 call CardFlip_FillBox - hlcoord 9, 0, AttrMap + hlcoord 9, 0, wAttrMap lb bc, 12, 1 ld a, $1 call CardFlip_FillBox diff --git a/engine/caught_data.asm b/engine/caught_data.asm index 9310b7b90..997d708c1 100644 --- a/engine/caught_data.asm +++ b/engine/caught_data.asm @@ -2,10 +2,10 @@ Special_CheckPartyFullAfterContest: ; 4d9e5 ld a, [wContestMon] and a jp z, .DidntCatchAnything - ld [CurPartySpecies], a - ld [CurSpecies], a + ld [wCurPartySpecies], a + ld [wCurSpecies], a call GetBaseData - ld hl, PartyCount + ld hl, wPartyCount ld a, [hl] cp PARTY_LENGTH jp nc, .TryAddToBox @@ -16,11 +16,11 @@ Special_CheckPartyFullAfterContest: ; 4d9e5 add hl, bc ld a, [wContestMon] ld [hli], a - ld [CurSpecies], a + ld [wCurSpecies], a ld a, -1 ld [hl], a - ld hl, PartyMon1Species - ld a, [PartyCount] + ld hl, wPartyMon1Species + ld a, [wPartyCount] dec a ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes @@ -29,50 +29,50 @@ Special_CheckPartyFullAfterContest: ; 4d9e5 ld hl, wContestMon ld bc, PARTYMON_STRUCT_LENGTH call CopyBytes - ld a, [PartyCount] + ld a, [wPartyCount] dec a - ld hl, PartyMonOT + ld hl, wPartyMonOT call SkipNames ld d, h ld e, l - ld hl, PlayerName + ld hl, wPlayerName call CopyBytes - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] ld [wd265], a call GetPokemonName - ld hl, StringBuffer1 + ld hl, wStringBuffer1 ld de, wMonOrItemNameBuffer ld bc, MON_NAME_LENGTH call CopyBytes call GiveANickname_YesNo jr c, .Party_SkipNickname - ld a, [PartyCount] + ld a, [wPartyCount] dec a - ld [CurPartyMon], a + ld [wCurPartyMon], a xor a - ld [MonType], a + ld [wMonType], a ld de, wMonOrItemNameBuffer callfar InitNickname .Party_SkipNickname: - ld a, [PartyCount] + ld a, [wPartyCount] dec a - ld hl, PartyMonNicknames + ld hl, wPartyMonNicknames call SkipNames ld d, h ld e, l ld hl, wMonOrItemNameBuffer call CopyBytes - ld a, [PartyCount] + ld a, [wPartyCount] dec a - ld hl, PartyMon1Level + ld hl, wPartyMon1Level call GetPartyLocation ld a, [hl] - ld [CurPartyLevel], a + ld [wCurPartyLevel], a call SetCaughtData - ld a, [PartyCount] + ld a, [wPartyCount] dec a - ld hl, PartyMon1CaughtLocation + ld hl, wPartyMon1CaughtLocation call GetPartyLocation ld a, [hl] and CAUGHT_GENDER_MASK @@ -82,7 +82,7 @@ Special_CheckPartyFullAfterContest: ; 4d9e5 xor a ld [wContestMon], a and a ; BUGCONTEST_CAUGHT_MON - ld [ScriptVar], a + ld [wScriptVar], a ret .TryAddToBox: ; 4daa3 @@ -94,24 +94,24 @@ Special_CheckPartyFullAfterContest: ; 4d9e5 call CloseSRAM jr nc, .BoxFull xor a - ld [CurPartyMon], a + ld [wCurPartyMon], a ld hl, wContestMon ld de, wBufferMon ld bc, BOXMON_STRUCT_LENGTH call CopyBytes - ld hl, PlayerName + ld hl, wPlayerName ld de, wBufferMonOT ld bc, NAME_LENGTH call CopyBytes callfar InsertPokemonIntoBox - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] ld [wd265], a call GetPokemonName call GiveANickname_YesNo - ld hl, StringBuffer1 + ld hl, wStringBuffer1 jr c, .Box_SkipNickname ld a, BOXMON - ld [MonType], a + ld [wMonType], a ld de, wMonOrItemNameBuffer callfar InitNickname ld hl, wMonOrItemNameBuffer @@ -128,7 +128,7 @@ Special_CheckPartyFullAfterContest: ; 4d9e5 ld a, BANK(sBoxMon1Level) call GetSRAMBank ld a, [sBoxMon1Level] - ld [CurPartyLevel], a + ld [wCurPartyLevel], a call CloseSRAM call SetBoxMonCaughtData ld a, BANK(sBoxMon1CaughtLocation) @@ -143,12 +143,12 @@ Special_CheckPartyFullAfterContest: ; 4d9e5 xor a ld [wContestMon], a ld a, BUGCONTEST_BOXED_MON - ld [ScriptVar], a + ld [wScriptVar], a ret .DidntCatchAnything: ; 4db35 ld a, BUGCONTEST_NO_CATCH - ld [ScriptVar], a + ld [wScriptVar], a ret GiveANickname_YesNo: ; 4db3b @@ -162,22 +162,22 @@ TextJump_GiveANickname: ; 0x4db44 db "@" SetCaughtData: ; 4db49 - ld a, [PartyCount] + ld a, [wPartyCount] dec a - ld hl, PartyMon1CaughtLevel + ld hl, wPartyMon1CaughtLevel call GetPartyLocation SetBoxmonOrEggmonCaughtData: ; 4db53 - ld a, [TimeOfDay] + ld a, [wTimeOfDay] inc a rrca rrca ld b, a - ld a, [CurPartyLevel] + ld a, [wCurPartyLevel] or b ld [hli], a - ld a, [MapGroup] + ld a, [wMapGroup] ld b, a - ld a, [MapNumber] + ld a, [wMapNumber] ld c, a cp MAP_POKECENTER_2F jr nz, .NotPokecenter2F @@ -185,9 +185,9 @@ SetBoxmonOrEggmonCaughtData: ; 4db53 cp GROUP_POKECENTER_2F jr nz, .NotPokecenter2F - ld a, [BackupMapGroup] + ld a, [wBackupMapGroup] ld b, a - ld a, [BackupMapNumber] + ld a, [wBackupMapNumber] ld c, a .NotPokecenter2F: @@ -218,9 +218,9 @@ SetGiftBoxMonCaughtData: ; 4db92 ret SetGiftPartyMonCaughtData: ; 4dba3 - ld a, [PartyCount] + ld a, [wPartyCount] dec a - ld hl, PartyMon1CaughtLevel + ld hl, wPartyMon1CaughtLevel push bc call GetPartyLocation pop bc @@ -234,14 +234,14 @@ SetGiftMonCaughtData: ; 4dbaf ret SetEggMonCaughtData: ; 4dbb8 (13:5bb8) - ld a, [CurPartyMon] - ld hl, PartyMon1CaughtLevel + ld a, [wCurPartyMon] + ld hl, wPartyMon1CaughtLevel call GetPartyLocation - ld a, [CurPartyLevel] + ld a, [wCurPartyLevel] push af ld a, CAUGHT_EGG_LEVEL - ld [CurPartyLevel], a + ld [wCurPartyLevel], a call SetBoxmonOrEggmonCaughtData pop af - ld [CurPartyLevel], a + ld [wCurPartyLevel], a ret diff --git a/engine/cgb_layouts.asm b/engine/cgb_layouts.asm index 84fb6c9de..1c2dfb7aa 100644 --- a/engine/cgb_layouts.asm +++ b/engine/cgb_layouts.asm @@ -10,7 +10,7 @@ LoadSGBLayoutCGB: ; 8d59 ld a, b cp SCGB_RAM jr nz, .not_ram - ld a, [SGBPredef] + ld a, [wSGBPredef] .not_ram cp SCGB_PARTY_MENU_HP_PALS jp z, CGB_ApplyPartyMenuHPPals @@ -89,7 +89,7 @@ _CGB_BattleColors: ; 8ddb call GetEnemyFrontpicPalettePointer push hl call LoadPalette_White_Col1_Col2_Black ; PAL_BATTLE_BG_ENEMY - ld a, [EnemyHPPal] + ld a, [wEnemyHPPal] ld l, a ld h, $0 add hl, hl @@ -97,7 +97,7 @@ _CGB_BattleColors: ; 8ddb ld bc, HPBarPals add hl, bc call LoadPalette_White_Col1_Col2_Black ; PAL_BATTLE_BG_ENEMY_HP - ld a, [PlayerHPPal] + ld a, [wPlayerHPPal] ld l, a ld h, $0 add hl, hl @@ -113,35 +113,35 @@ _CGB_BattleColors: ; 8ddb pop hl call LoadPalette_White_Col1_Col2_Black ; PAL_BATTLE_OB_PLAYER ld a, SCGB_BATTLE_COLORS - ld [SGBPredef], a + ld [wSGBPredef], a call ApplyPals _CGB_FinishBattleScreenLayout: ; 8e23 call InitPartyMenuBGPal7 - hlcoord 0, 0, AttrMap + hlcoord 0, 0, wAttrMap ld bc, SCREEN_WIDTH * SCREEN_HEIGHT ld a, PAL_BATTLE_BG_ENEMY_HP call ByteFill - hlcoord 0, 4, AttrMap + hlcoord 0, 4, wAttrMap lb bc, 8, 10 ld a, PAL_BATTLE_BG_PLAYER call FillBoxCGB - hlcoord 10, 0, AttrMap + hlcoord 10, 0, wAttrMap lb bc, 7, 10 ld a, PAL_BATTLE_BG_ENEMY call FillBoxCGB - hlcoord 0, 0, AttrMap + hlcoord 0, 0, wAttrMap lb bc, 4, 10 ld a, PAL_BATTLE_BG_ENEMY_HP call FillBoxCGB - hlcoord 10, 7, AttrMap + hlcoord 10, 7, wAttrMap lb bc, 5, 10 ld a, PAL_BATTLE_BG_PLAYER_HP call FillBoxCGB - hlcoord 10, 11, AttrMap + hlcoord 10, 11, wAttrMap lb bc, 1, 9 ld a, PAL_BATTLE_BG_EXP call FillBoxCGB - hlcoord 0, 12, AttrMap + hlcoord 0, 12, wAttrMap ld bc, 6 * SCREEN_WIDTH ld a, PAL_BATTLE_BG_TEXT call ByteFill @@ -212,8 +212,8 @@ _CGB_StatsScreenHPPals: ; 8edb ld bc, HPBarPals add hl, bc call LoadPalette_White_Col1_Col2_Black ; hp palette - ld a, [CurPartySpecies] - ld bc, TempMonDVs + ld a, [wCurPartySpecies] + ld bc, wTempMonDVs call GetPlayerOrMonPalettePointer call LoadPalette_White_Col1_Col2_Black ; mon palette ld hl, ExpBarPalette @@ -225,27 +225,27 @@ _CGB_StatsScreenHPPals: ; 8edb call FarCopyWRAM call WipeAttrMap - hlcoord 0, 0, AttrMap + hlcoord 0, 0, wAttrMap lb bc, 8, SCREEN_WIDTH ld a, $1 ; mon palette call FillBoxCGB - hlcoord 10, 16, AttrMap + hlcoord 10, 16, wAttrMap ld bc, 10 ld a, $2 ; exp palette call ByteFill - hlcoord 13, 5, AttrMap + hlcoord 13, 5, wAttrMap lb bc, 2, 2 ld a, $3 ; pink page palette call FillBoxCGB - hlcoord 15, 5, AttrMap + hlcoord 15, 5, wAttrMap lb bc, 2, 2 ld a, $4 ; green page palette call FillBoxCGB - hlcoord 17, 5, AttrMap + hlcoord 17, 5, wAttrMap lb bc, 2, 2 ld a, $5 ; blue page palette call FillBoxCGB @@ -270,7 +270,7 @@ _CGB_Pokedex: ; 8f70 ld a, PREDEFPAL_POKEDEX call GetPredefPal call LoadHLPaletteIntoDE ; dex interface palette - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] cp $ff jr nz, .is_pokemon ld hl, .PokedexQuestionMarkPalette @@ -282,7 +282,7 @@ _CGB_Pokedex: ; 8f70 call LoadPalette_White_Col1_Col2_Black ; mon palette .got_palette call WipeAttrMap - hlcoord 1, 1, AttrMap + hlcoord 1, 1, wAttrMap lb bc, 7, 7 ld a, $1 ; green question mark palette call FillBoxCGB @@ -312,7 +312,7 @@ _CGB_BillsPC: ; 8fca ld a, PREDEFPAL_POKEDEX call GetPredefPal call LoadHLPaletteIntoDE - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] cp $ff jr nz, .GetMonPalette ld hl, .BillsPCOrangePalette @@ -320,12 +320,12 @@ _CGB_BillsPC: ; 8fca jr .Resume .GetMonPalette: - ld bc, TempMonDVs + ld bc, wTempMonDVs call GetPlayerOrMonPalettePointer call LoadPalette_White_Col1_Col2_Black .Resume: call WipeAttrMap - hlcoord 1, 4, AttrMap + hlcoord 1, 4, wAttrMap lb bc, 7, 7 ld a, $1 call FillBoxCGB @@ -343,12 +343,12 @@ _CGB_BillsPC: ; 8fca jr .asm_901a .unused - ld bc, TempMonDVs + ld bc, wTempMonDVs call GetPlayerOrMonPalettePointer call LoadPalette_White_Col1_Col2_Black .asm_901a call WipeAttrMap - hlcoord 1, 1, AttrMap + hlcoord 1, 1, wAttrMap lb bc, 7, 7 ld a, $1 call FillBoxCGB @@ -369,11 +369,11 @@ _CGB_PokedexUnownMode: ; 903e ld a, PREDEFPAL_POKEDEX call GetPredefPal call LoadHLPaletteIntoDE - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] call GetMonPalettePointer_ call LoadPalette_White_Col1_Col2_Black call WipeAttrMap - hlcoord 7, 5, AttrMap + hlcoord 7, 5, wAttrMap lb bc, 7, 7 ld a, $1 call FillBoxCGB @@ -392,43 +392,43 @@ _CGB_SlotMachine: ; 906e ld a, BANK(wBGPals1) call FarCopyWRAM call WipeAttrMap - hlcoord 0, 2, AttrMap + hlcoord 0, 2, wAttrMap lb bc, 10, 3 ld a, $2 call FillBoxCGB - hlcoord 17, 2, AttrMap + hlcoord 17, 2, wAttrMap lb bc, 10, 3 ld a, $2 call FillBoxCGB - hlcoord 0, 4, AttrMap + hlcoord 0, 4, wAttrMap lb bc, 6, 3 ld a, $3 call FillBoxCGB - hlcoord 17, 4, AttrMap + hlcoord 17, 4, wAttrMap lb bc, 6, 3 ld a, $3 call FillBoxCGB - hlcoord 0, 6, AttrMap + hlcoord 0, 6, wAttrMap lb bc, 2, 3 ld a, $4 call FillBoxCGB - hlcoord 17, 6, AttrMap + hlcoord 17, 6, wAttrMap lb bc, 2, 3 ld a, $4 call FillBoxCGB - hlcoord 4, 2, AttrMap + hlcoord 4, 2, wAttrMap lb bc, 2, 12 ld a, $1 call FillBoxCGB - hlcoord 3, 2, AttrMap + hlcoord 3, 2, wAttrMap lb bc, 10, 1 ld a, $1 call FillBoxCGB - hlcoord 16, 2, AttrMap + hlcoord 16, 2, wAttrMap lb bc, 10, 1 ld a, $1 call FillBoxCGB - hlcoord 0, 12, AttrMap + hlcoord 0, 12, wAttrMap ld bc, $78 ld a, $7 call ByteFill @@ -447,7 +447,7 @@ _CGB06: ; 90f8 ld a, PREDEFPAL_PACK call GetPredefPal call LoadHLPaletteIntoDE - hlcoord 0, 6, AttrMap + hlcoord 0, 6, wAttrMap lb bc, 12, SCREEN_WIDTH ld a, $1 call FillBoxCGB @@ -560,7 +560,7 @@ _CGB_Diploma: ; 91ad _CGB_MapPals: ; 91c8 call LoadMapPals ld a, SCGB_MAPPALS - ld [SGBPredef], a + ld [wSGBPredef], a ret ; 91d1 @@ -585,13 +585,13 @@ _CGB_Evolution: ; 91e4 jr .got_palette .pokemon - ld hl, PartyMon1DVs + ld hl, wPartyMon1DVs ld bc, PARTYMON_STRUCT_LENGTH - ld a, [CurPartyMon] + ld a, [wCurPartyMon] call AddNTimes ld c, l ld b, h - ld a, [PlayerHPPal] + ld a, [wPlayerHPPal] call GetPlayerOrMonPalettePointer call LoadPalette_White_Col1_Col2_Black ld hl, BattleObjectPals @@ -621,7 +621,7 @@ _CGB_GSTitleScreen: ; 9228 ld a, BANK(wOBPals1) call FarCopyWRAM ld a, SCGB_DIPLOMA - ld [SGBPredef], a + ld [wSGBPredef], a call ApplyPals ld a, $1 ld [hCGBPalUpdate], a @@ -690,7 +690,7 @@ _CGB_TrainerCard: ; 9289 call LoadHLPaletteIntoDE ; fill screen with opposite-gender palette for the card border - hlcoord 0, 0, AttrMap + hlcoord 0, 0, wAttrMap ld bc, SCREEN_WIDTH * SCREEN_HEIGHT ld a, [wPlayerGender] and a @@ -700,7 +700,7 @@ _CGB_TrainerCard: ; 9289 .got_gender call ByteFill ; fill trainer sprite area with same-gender palette - hlcoord 14, 1, AttrMap + hlcoord 14, 1, wAttrMap lb bc, 7, 5 ld a, [wPlayerGender] and a @@ -710,33 +710,33 @@ _CGB_TrainerCard: ; 9289 .got_gender2 call FillBoxCGB ; top-right corner still uses the border's palette - hlcoord 18, 1, AttrMap + hlcoord 18, 1, wAttrMap ld [hl], $1 - hlcoord 2, 11, AttrMap + hlcoord 2, 11, wAttrMap lb bc, 2, 4 ld a, $1 ; falkner call FillBoxCGB - hlcoord 6, 11, AttrMap + hlcoord 6, 11, wAttrMap lb bc, 2, 4 ld a, $2 ; bugsy call FillBoxCGB - hlcoord 10, 11, AttrMap + hlcoord 10, 11, wAttrMap lb bc, 2, 4 ld a, $3 ; whitney call FillBoxCGB - hlcoord 14, 11, AttrMap + hlcoord 14, 11, wAttrMap lb bc, 2, 4 ld a, $4 ; morty call FillBoxCGB - hlcoord 2, 14, AttrMap + hlcoord 2, 14, wAttrMap lb bc, 2, 4 ld a, $5 ; chuck call FillBoxCGB - hlcoord 6, 14, AttrMap + hlcoord 6, 14, wAttrMap lb bc, 2, 4 ld a, $6 ; jasmine call FillBoxCGB - hlcoord 10, 14, AttrMap + hlcoord 10, 14, wAttrMap lb bc, 2, 4 ld a, $7 ; pryce call FillBoxCGB @@ -745,7 +745,7 @@ _CGB_TrainerCard: ; 9289 and a push af jr z, .got_gender3 - hlcoord 14, 14, AttrMap + hlcoord 14, 14, wAttrMap lb bc, 2, 4 ld a, $1 call FillBoxCGB @@ -756,7 +756,7 @@ _CGB_TrainerCard: ; 9289 inc c .got_gender4 ld a, c - hlcoord 18, 1, AttrMap + hlcoord 18, 1, wAttrMap ld [hl], a call ApplyAttrMap call ApplyPals @@ -770,7 +770,7 @@ _CGB_MoveList: ; 9373 ld a, PREDEFPAL_GOLDENROD call GetPredefPal call LoadHLPaletteIntoDE - ld a, [PlayerHPPal] + ld a, [wPlayerHPPal] ld l, a ld h, 0 add hl, hl @@ -779,7 +779,7 @@ _CGB_MoveList: ; 9373 add hl, bc call LoadPalette_White_Col1_Col2_Black call WipeAttrMap - hlcoord 11, 1, AttrMap + hlcoord 11, 1, wAttrMap lb bc, 2, 9 ld a, $1 call FillBoxCGB @@ -816,7 +816,7 @@ _CGB_PokedexSearchOption: ; 93ba _CGB_PackPals: ; 93d3 ; pack pals - ld a, [BattleType] + ld a, [wBattleType] cp BATTLETYPE_TUTORIAL jr z, .tutorial_male @@ -836,23 +836,23 @@ _CGB_PackPals: ; 93d3 ld a, BANK(wBGPals1) call FarCopyWRAM call WipeAttrMap - hlcoord 0, 0, AttrMap + hlcoord 0, 0, wAttrMap lb bc, 1, 10 ld a, $1 call FillBoxCGB - hlcoord 10, 0, AttrMap + hlcoord 10, 0, wAttrMap lb bc, 1, 10 ld a, $2 call FillBoxCGB - hlcoord 7, 2, AttrMap + hlcoord 7, 2, wAttrMap lb bc, 9, 1 ld a, $3 call FillBoxCGB - hlcoord 0, 7, AttrMap + hlcoord 0, 7, wAttrMap lb bc, 3, 5 ld a, $4 call FillBoxCGB - hlcoord 0, 3, AttrMap + hlcoord 0, 3, wAttrMap lb bc, 3, 5 ld a, $5 call FillBoxCGB @@ -874,7 +874,7 @@ INCLUDE "gfx/pack/pack_f.pal" _CGB_Pokepic: ; 9499 call _CGB_MapPals ld de, SCREEN_WIDTH - hlcoord 0, 0, AttrMap + hlcoord 0, 0, wAttrMap ld a, [wMenuBorderTopCoord] .loop and a @@ -910,11 +910,11 @@ _CGB13: ; 94d0 ld hl, PalPacket_SCGB_13 + 1 call CopyFourPalettes call WipeAttrMap - hlcoord 0, 4, AttrMap + hlcoord 0, 4, wAttrMap lb bc, 10, SCREEN_WIDTH ld a, $2 call FillBoxCGB - hlcoord 0, 6, AttrMap + hlcoord 0, 6, wAttrMap lb bc, 6, SCREEN_WIDTH ld a, $1 call FillBoxCGB @@ -948,8 +948,8 @@ INCLUDE "gfx/splash/logo.pal" _CGB_PlayerOrMonFrontpicPals: ; 9529 ld de, wBGPals1 - ld a, [CurPartySpecies] - ld bc, TempMonDVs + ld a, [wCurPartySpecies] + ld bc, wTempMonDVs call GetPlayerOrMonPalettePointer call LoadPalette_White_Col1_Col2_Black call WipeAttrMap @@ -960,7 +960,7 @@ _CGB_PlayerOrMonFrontpicPals: ; 9529 _CGB1e: ; 9542 ld de, wBGPals1 - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] call GetMonPalettePointer_ call LoadPalette_White_Col1_Col2_Black call WipeAttrMap @@ -986,8 +986,8 @@ _CGB_TradeTube: ; 9555 _CGB_TrainerOrMonFrontpicPals: ; 9578 ld de, wBGPals1 - ld a, [CurPartySpecies] - ld bc, TempMonDVs + ld a, [wCurPartySpecies] + ld bc, wTempMonDVs call GetFrontpicPalettePointer call LoadPalette_White_Col1_Col2_Black call WipeAttrMap @@ -1004,23 +1004,23 @@ _CGB_MysteryGift: ; 9591 call FarCopyWRAM call ApplyPals call WipeAttrMap - hlcoord 3, 7, AttrMap + hlcoord 3, 7, wAttrMap lb bc, 8, 14 ld a, $1 call FillBoxCGB - hlcoord 1, 5, AttrMap + hlcoord 1, 5, wAttrMap lb bc, 1, 18 ld a, $1 call FillBoxCGB - hlcoord 1, 16, AttrMap + hlcoord 1, 16, wAttrMap lb bc, 1, 18 ld a, $1 call FillBoxCGB - hlcoord 0, 0, AttrMap + hlcoord 0, 0, wAttrMap lb bc, 17, 2 ld a, $1 call FillBoxCGB - hlcoord 18, 5, AttrMap + hlcoord 18, 5, wAttrMap lb bc, 12, 1 ld a, $1 call FillBoxCGB diff --git a/engine/clock_reset.asm b/engine/clock_reset.asm index 82b81b85c..4c4a96b9c 100755 --- a/engine/clock_reset.asm +++ b/engine/clock_reset.asm @@ -20,13 +20,13 @@ endr ; 20015 (8:4015) .WrapAroundTimes: ; 20015 - dw Buffer4 + dw wBuffer4 db 7, 4 - dw Buffer5 + dw wBuffer5 db 24, 12 - dw Buffer6 + dw wBuffer6 db 60, 15 ; 20021 @@ -34,7 +34,7 @@ RestartClock: ; 20021 (8:4021) ; If we're here, we had an RTC overflow. ld hl, .Text_ClockTimeMayBeWrong call PrintText - ld hl, Options + ld hl, wOptions ld a, [hl] push af set NO_TEXT_SCROLL, [hl] @@ -45,7 +45,7 @@ RestartClock: ; 20021 (8:4021) call .SetClock call ExitMenu pop bc - ld hl, Options + ld hl, wOptions ld [hl], b ld c, a ret @@ -65,17 +65,17 @@ RestartClock: ; 20021 (8:4021) .SetClock: ; 20051 (8:4051) ld a, 1 - ld [Buffer1], a ; which digit - ld [Buffer2], a + ld [wBuffer1], a ; which digit + ld [wBuffer2], a ld a, 8 - ld [Buffer3], a + ld [wBuffer3], a call UpdateTime call GetWeekday - ld [Buffer4], a + ld [wBuffer4], a ld a, [hHours] - ld [Buffer5], a + ld [wBuffer5], a ld a, [hMinutes] - ld [Buffer6], a + ld [wBuffer6], a .loop call .joy_loop @@ -87,14 +87,14 @@ RestartClock: ; 20021 (8:4021) call PrintText call YesNoBox jr c, .cancel - ld a, [Buffer4] - ld [StringBuffer2], a - ld a, [Buffer5] - ld [StringBuffer2 + 1], a - ld a, [Buffer6] - ld [StringBuffer2 + 2], a + ld a, [wBuffer4] + ld [wStringBuffer2], a + ld a, [wBuffer5] + ld [wStringBuffer2 + 1], a + ld a, [wBuffer6] + ld [wStringBuffer2 + 2], a xor a - ld [StringBuffer2 + 3], a + ld [wStringBuffer2 + 3], a call InitTime call .PrintTime ld hl, .Text_ClockReset @@ -151,7 +151,7 @@ RestartClock: ; 20021 (8:4021) ret .pressed_up - ld a, [Buffer1] + ld a, [wBuffer1] call ResetClock_GetWraparoundTime ld a, [de] inc a @@ -163,7 +163,7 @@ RestartClock: ; 20021 (8:4021) jr .done_scroll .pressed_down - ld a, [Buffer1] + ld a, [wBuffer1] call ResetClock_GetWraparoundTime ld a, [de] dec a @@ -176,14 +176,14 @@ RestartClock: ; 20021 (8:4021) jr .done_scroll .pressed_left - ld hl, Buffer1 + ld hl, wBuffer1 dec [hl] jr nz, .done_scroll ld [hl], $3 jr .done_scroll .pressed_right - ld hl, Buffer1 + ld hl, wBuffer1 inc [hl] ld a, [hl] cp $4 @@ -200,29 +200,29 @@ RestartClock: ; 20021 (8:4021) ld c, 18 call TextBox decoord 1, 8 - ld a, [Buffer4] + ld a, [wBuffer4] ld b, a farcall PrintDayOfWeek - ld a, [Buffer5] + ld a, [wBuffer5] ld b, a - ld a, [Buffer6] + ld a, [wBuffer6] ld c, a decoord 11, 8 farcall PrintHoursMins - ld a, [Buffer2] + ld a, [wBuffer2] lb de, " ", " " call .PlaceChars - ld a, [Buffer1] + ld a, [wBuffer1] lb de, "▲", "▼" call .PlaceChars - ld a, [Buffer1] - ld [Buffer2], a + ld a, [wBuffer1] + ld [wBuffer2], a ret ; 20160 (8:4160) ; unused .unreferenced ; 20160 - ld a, [Buffer3] + ld a, [wBuffer3] ld b, a call Coord2Tile ret @@ -231,7 +231,7 @@ RestartClock: ; 20021 (8:4021) .PlaceChars: ; 20168 (8:4168) push de call ResetClock_GetWraparoundTime - ld a, [Buffer3] + ld a, [wBuffer3] dec a ld b, a call Coord2Tile diff --git a/engine/color.asm b/engine/color.asm index 485125821..21842b7b3 100644 --- a/engine/color.asm +++ b/engine/color.asm @@ -239,13 +239,13 @@ Unreferenced_Function8b81: ret LoadTrainerClassPaletteAsNthBGPal: - ld a, [TrainerClass] + ld a, [wTrainerClass] call GetTrainerPalettePointer ld a, e jr got_palette_pointer_8bd7 LoadMonPaletteAsNthBGPal: - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] call GetMonPalettePointer ld a, e bit 7, a @@ -278,14 +278,14 @@ Unreferenced_Function8bec: ld a, [hCGB] and a jr nz, .cgb - ld hl, PlayerLightScreenCount + ld hl, wPlayerLightScreenCount jp PushSGBPals_ .cgb - ld a, [EnemyLightScreenCount] ; col + ld a, [wEnemyLightScreenCount] ; col ld c, a - ld a, [EnemyReflectCount] ; row - hlcoord 0, 0, AttrMap + ld a, [wEnemyReflectCount] ; row + hlcoord 0, 0, wAttrMap ld de, SCREEN_WIDTH .loop and a @@ -298,7 +298,7 @@ Unreferenced_Function8bec: ld b, $0 add hl, bc lb bc, 6, 4 - ld a, [EnemySafeguardCount] ; value + ld a, [wEnemySafeguardCount] ; value and $3 call FillBoxCGB call CopyTilemapAtOnce @@ -310,12 +310,12 @@ ApplyMonOrTrainerPals: ld a, e and a jr z, .get_trainer - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] call GetMonPalettePointer_ jr .load_palettes .get_trainer - ld a, [TrainerClass] + ld a, [wTrainerClass] call GetTrainerPalettePointer .load_palettes @@ -360,9 +360,9 @@ ApplyHPBarPals: .PartyMenu: ld e, c inc e - hlcoord 11, 1, AttrMap + hlcoord 11, 1, wAttrMap ld bc, 2 * SCREEN_WIDTH - ld a, [CurPartyMon] + ld a, [wCurPartyMon] .loop and a jr z, .done @@ -592,7 +592,7 @@ ResetBGPals: ret WipeAttrMap: - hlcoord 0, 0, AttrMap + hlcoord 0, 0, wAttrMap ld bc, SCREEN_WIDTH * SCREEN_HEIGHT xor a call ByteFill @@ -602,7 +602,7 @@ ApplyPals: ld hl, wBGPals1 ld de, wBGPals2 ld bc, 16 palettes - ld a, BANK(wPals) + ld a, BANK(wGBCPalettes) call FarCopyWRAM ret @@ -623,7 +623,7 @@ ApplyAttrMap: ret .UpdateVBank1: - hlcoord 0, 0, AttrMap + hlcoord 0, 0, wAttrMap debgcoord 0, 0 ld b, SCREEN_HEIGHT ld a, $1 @@ -660,7 +660,7 @@ CGB_ApplyPartyMenuHPPals: ; 96f3 ld a, [de] inc a ld e, a - hlcoord 11, 2, AttrMap + hlcoord 11, 2, wAttrMap ld bc, 2 * SCREEN_WIDTH ld a, [wSGBPals] .loop @@ -688,7 +688,7 @@ GetBattlemonBackpicPalettePointer: farcall GetPartyMonDVs ld c, l ld b, h - ld a, [TempBattleMonSpecies] + ld a, [wTempBattleMonSpecies] call GetPlayerOrMonPalettePointer pop de ret @@ -698,7 +698,7 @@ GetEnemyFrontpicPalettePointer: farcall GetEnemyMonDVs ld c, l ld b, h - ld a, [TempEnemyMonSpecies] + ld a, [wTempEnemyMonSpecies] call GetFrontpicPalettePointer pop de ret @@ -716,13 +716,13 @@ GetPlayerOrMonPalettePointer: ret .male - ld hl, PlayerPalette + ld hl, wPlayerPalette ret GetFrontpicPalettePointer: and a jp nz, GetMonNormalOrShinyPalettePointer - ld a, [TrainerClass] + ld a, [wTrainerClass] GetTrainerPalettePointer: ld l, a @@ -1230,7 +1230,7 @@ LoadMapPals: ld h, [hl] ld l, a ; Futher refine by time of day - ld a, [TimeOfDayPal] + ld a, [wTimeOfDayPal] maskbits NUM_DAYTIMES add a add a @@ -1276,7 +1276,7 @@ LoadMapPals: ld [rSVBK], a .got_pals - ld a, [TimeOfDayPal] + ld a, [wTimeOfDayPal] maskbits NUM_DAYTIMES ld bc, 8 palettes ld hl, MapObjectPals @@ -1292,7 +1292,7 @@ LoadMapPals: cp ROUTE ret nz .outside - ld a, [MapGroup] + ld a, [wMapGroup] ld l, a ld h, 0 add hl, hl @@ -1300,7 +1300,7 @@ LoadMapPals: add hl, hl ld de, RoofPals add hl, de - ld a, [TimeOfDayPal] + ld a, [wTimeOfDayPal] maskbits NUM_DAYTIMES cp NITE_F jr c, .morn_day diff --git a/engine/credits.asm b/engine/credits.asm index ac5064a41..1aaecf64a 100644 --- a/engine/credits.asm +++ b/engine/credits.asm @@ -13,7 +13,7 @@ Credits:: ; 109847 ld a, [rSVBK] push af - ld a, BANK(wPals) + ld a, BANK(wGBCPalettes) ld [rSVBK], a call ClearBGPalettes @@ -63,7 +63,7 @@ Credits:: ; 109847 xor a ld [wCreditsLYOverride], a - ld hl, LYOverrides + ld hl, wLYOverrides ld bc, $100 xor a call ByteFill @@ -81,9 +81,9 @@ Credits:: ; 109847 ld [hInMenu], a xor a ld [hBGMapMode], a - ld [CreditsPos], a - ld [CreditsUnusedCD21], a - ld [CreditsTimer], a + ld [wCreditsPos], a + ld [wCreditsUnusedCD21], a + ld [wCreditsTimer], a .execution_loop call Credits_HandleBButton @@ -122,7 +122,7 @@ Credits_HandleBButton: ; 109908 ld a, [wJumptableIndex] bit 6, a ret z - ld hl, CreditsPos + ld hl, wCreditsPos ld a, [hli] cp $d jr nc, .okay @@ -130,7 +130,7 @@ Credits_HandleBButton: ; 109908 and a ret z .okay - ld hl, CreditsTimer + ld hl, wCreditsTimer ld a, [hl] and a ret z @@ -187,20 +187,20 @@ Credits_PrepBGMapUpdate: ; 10995e (42:595e) Credits_UpdateGFXRequestPath: ; 109964 (42:5964) call Credits_LoadBorderGFX ld a, l - ld [Requested2bppSource], a + ld [wRequested2bppSource], a ld a, h - ld [Requested2bppSource + 1], a + ld [wRequested2bppSource + 1], a ld a, LOW(vTiles2) - ld [Requested2bppDest], a + ld [wRequested2bppDest], a ld a, HIGH(vTiles2) - ld [Requested2bppDest + 1], a + ld [wRequested2bppDest + 1], a jr Credits_RequestGFX Credits_RequestGFX: ; 10997b (42:597b) xor a ld [hBGMapMode], a ld a, $8 - ld [Requested2bpp], a + ld [wRequested2bpp], a jp Credits_Next Credits_LYOverride: ; 109986 (42:5986) @@ -211,9 +211,9 @@ Credits_LYOverride: ; 109986 (42:5986) dec a dec a ld [wCreditsLYOverride], a - ld hl, LYOverrides + $1f + ld hl, wLYOverrides + $1f call .Fill - ld hl, LYOverrides + $87 + ld hl, wLYOverrides + $87 call .Fill jp Credits_Next @@ -233,7 +233,7 @@ ParseCredits: ; 1099aa jp nz, .done ; Wait until the timer has run out to parse the next command. - ld hl, CreditsTimer + ld hl, wCreditsTimer ld a, [hl] and a jr z, .parse @@ -349,13 +349,13 @@ ParseCredits: ; 1099aa .wait2 ; Wait for some amount of ticks. call .get - ld [CreditsTimer], a + ld [wCreditsTimer], a jr .done .wait ; Wait for some amount of ticks, and do something else. call .get - ld [CreditsTimer], a + ld [wCreditsTimer], a xor a ld [hBGMapThird], a @@ -370,29 +370,29 @@ ParseCredits: ; 1099aa ld hl, wJumptableIndex set 7, [hl] ld a, 32 - ld [MusicFade], a + ld [wMusicFade], a ld a, LOW(MUSIC_POST_CREDITS) - ld [MusicFadeID], a + ld [wMusicFadeID], a ld a, HIGH(MUSIC_POST_CREDITS) - ld [MusicFadeID + 1], a + ld [wMusicFadeID + 1], a ret .get -; Get byte CreditsPos from CreditsScript +; Get byte wCreditsPos from CreditsScript push hl push de - ld a, [CreditsPos] + ld a, [wCreditsPos] ld e, a - ld a, [CreditsPos+1] + ld a, [wCreditsPos+1] ld d, a ld hl, CreditsScript add hl, de inc de ld a, e - ld [CreditsPos], a + ld [wCreditsPos], a ld a, d - ld [CreditsPos+1], a + ld [wCreditsPos+1], a ld a, [hl] pop de pop hl @@ -424,22 +424,22 @@ ConstructCreditsTilemap: ; 109a95 (42:5a95) ld a, $20 call DrawCreditsBorder - hlcoord 0, 0, AttrMap + hlcoord 0, 0, wAttrMap ld bc, 4 * SCREEN_WIDTH xor a call ByteFill - hlcoord 0, 4, AttrMap + hlcoord 0, 4, wAttrMap ld bc, SCREEN_WIDTH ld a, $1 call ByteFill - hlcoord 0, 5, AttrMap + hlcoord 0, 5, wAttrMap ld bc, 12 * SCREEN_WIDTH ld a, $2 call ByteFill - hlcoord 0, 17, AttrMap + hlcoord 0, 17, wAttrMap ld bc, SCREEN_WIDTH ld a, $1 call ByteFill diff --git a/engine/crystal_intro.asm b/engine/crystal_intro.asm index ea6828f14..d6c467867 100755 --- a/engine/crystal_intro.asm +++ b/engine/crystal_intro.asm @@ -352,7 +352,7 @@ INCBIN "gfx/splash/logo2.1bpp" CrystalIntro: ; e48ac ld a, [rSVBK] push af - ld a, BANK(wPals) + ld a, BANK(wGBCPalettes) ld [rSVBK], a ld a, [hInMenu] push af @@ -796,7 +796,7 @@ IntroScene9: ; e4c04 (39:4c04) xor a ld [hLCDCPointer], a call ClearSprites - hlcoord 0, 0, AttrMap + hlcoord 0, 0, wAttrMap ; first 12 rows have palette 1 ld bc, 12 * SCREEN_WIDTH ld a, $1 @@ -1919,15 +1919,15 @@ Intro_RustleGrass: ; e546d (39:546d) ld hl, .RustlingGrassPointers add hl, de ld a, [hli] - ld [Requested2bppSource], a + ld [wRequested2bppSource], a ld a, [hli] - ld [Requested2bppSource + 1], a + ld [wRequested2bppSource + 1], a ld a, LOW(vTiles2 tile $09) - ld [Requested2bppDest], a + ld [wRequested2bppDest], a ld a, HIGH(vTiles2 tile $09) - ld [Requested2bppDest + 1], a + ld [wRequested2bppDest + 1], a ld a, 4 - ld [Requested2bppSize], a + ld [wRequested2bppSize], a ret ; e5496 (39:5496) @@ -2022,11 +2022,11 @@ Intro_DecompressRequest2bpp_64Tiles: ; e54fa (39:54fa) Intro_ResetLYOverrides: ; e5516 (39:5516) ld a, [rSVBK] push af - ld a, BANK(LYOverrides) + ld a, BANK(wLYOverrides) ld [rSVBK], a - ld hl, LYOverrides - ld bc, LYOverridesEnd - LYOverrides + ld hl, wLYOverrides + ld bc, wLYOverridesEnd - wLYOverrides xor a call ByteFill @@ -2039,7 +2039,7 @@ Intro_ResetLYOverrides: ; e5516 (39:5516) Intro_PerspectiveScrollBG: ; e552f (39:552f) ld a, [rSVBK] push af - ld a, BANK(LYOverrides) + ld a, BANK(wLYOverrides) ld [rSVBK], a ; Scroll the grass every frame. ; Scroll the trees every other frame and at half speed. @@ -2048,20 +2048,20 @@ Intro_PerspectiveScrollBG: ; e552f (39:552f) and $1 jr z, .skip ; trees in the back - ld hl, LYOverrides + ld hl, wLYOverrides ld a, [hl] inc a ld bc, $5f call ByteFill .skip ; grass in the front - ld hl, LYOverrides + $5f + ld hl, wLYOverrides + $5f ld a, [hl] inc a inc a ld bc, $31 call ByteFill - ld a, [LYOverrides + 0] + ld a, [wLYOverrides + 0] ld [hSCX], a pop af ld [rSVBK], a diff --git a/engine/crystal_layouts.asm b/engine/crystal_layouts.asm index 9fd01aac0..1fbba9a5f 100755 --- a/engine/crystal_layouts.asm +++ b/engine/crystal_layouts.asm @@ -2,7 +2,7 @@ GetMysteryGift_MobileAdapterLayout: ; 4930f (mobile) ld a, b cp SCGB_RAM jr nz, .not_ram - ld a, [SGBPredef] + ld a, [wSGBPredef] .not_ram push af farcall ResetBGPals @@ -46,7 +46,7 @@ MG_Mobile_Layout_FillBox: ; 49336 ; 49346 MG_Mobile_Layout_WipeAttrMap: ; 49346 (12:5346) - hlcoord 0, 0, AttrMap + hlcoord 0, 0, wAttrMap ld bc, SCREEN_HEIGHT * SCREEN_WIDTH xor a call ByteFill @@ -74,7 +74,7 @@ MG_Mobile_Layout00: ; 4936e (12:536e) ret MG_Mobile_Layout_CreatePalBoxes: ; 49384 (12:5384) - hlcoord 0, 0, AttrMap + hlcoord 0, 0, wAttrMap lb bc, 4, 1 ld a, $1 call MG_Mobile_Layout_FillBox @@ -84,7 +84,7 @@ MG_Mobile_Layout_CreatePalBoxes: ; 49384 (12:5384) lb bc, 6, 1 ld a, $3 call MG_Mobile_Layout_FillBox - hlcoord 1, 0, AttrMap + hlcoord 1, 0, wAttrMap ld a, $1 lb bc, 3, 18 call MG_Mobile_Layout_FillBox @@ -94,7 +94,7 @@ MG_Mobile_Layout_CreatePalBoxes: ; 49384 (12:5384) lb bc, 12, 18 ld a, $3 call MG_Mobile_Layout_FillBox - hlcoord 19, 0, AttrMap + hlcoord 19, 0, wAttrMap lb bc, 4, 1 ld a, $1 call MG_Mobile_Layout_FillBox @@ -104,7 +104,7 @@ MG_Mobile_Layout_CreatePalBoxes: ; 49384 (12:5384) lb bc, 6, 1 ld a, $3 call MG_Mobile_Layout_FillBox - hlcoord 0, 12, AttrMap + hlcoord 0, 12, wAttrMap ld bc, 6 * SCREEN_WIDTH ld a, $7 call ByteFill @@ -145,11 +145,11 @@ MG_Mobile_Layout01: ; 4942f ld a, BANK(wBGPals1) call FarCopyWRAM call MG_Mobile_Layout_WipeAttrMap - hlcoord 0, 0, AttrMap + hlcoord 0, 0, wAttrMap ld bc, SCREEN_WIDTH * SCREEN_HEIGHT xor a call ByteFill - hlcoord 0, 14, AttrMap + hlcoord 0, 14, wAttrMap ld bc, 4 * SCREEN_WIDTH ld a, $7 call ByteFill @@ -178,27 +178,27 @@ MG_Mobile_Layout01: ; 4942f ; 49480 Function49480: ; 49480 - hlcoord 0, 0, AttrMap + hlcoord 0, 0, wAttrMap lb bc, 4, SCREEN_WIDTH ld a, $7 call MG_Mobile_Layout_FillBox - hlcoord 0, 2, AttrMap + hlcoord 0, 2, wAttrMap ld a, $4 ld [hl], a - hlcoord 19, 2, AttrMap + hlcoord 19, 2, wAttrMap ld [hl], a ret ; 49496 Function49496: ; 49496 - hlcoord 0, 0, AttrMap + hlcoord 0, 0, wAttrMap lb bc, 2, SCREEN_WIDTH ld a, $7 call MG_Mobile_Layout_FillBox - hlcoord 0, 1, AttrMap + hlcoord 0, 1, wAttrMap ld a, $4 ld [hl], a - hlcoord 19, 1, AttrMap + hlcoord 19, 1, wAttrMap ld [hl], a ret ; 494ac @@ -251,43 +251,43 @@ INCLUDE "gfx/unknown/49757.pal" ; 49797 _InitMG_Mobile_LinkTradePalMap: ; 49797 - hlcoord 0, 0, AttrMap + hlcoord 0, 0, wAttrMap lb bc, 16, 2 ld a, $4 call MG_Mobile_Layout_FillBox ld a, $3 - ldcoord_a 0, 1, AttrMap - ldcoord_a 0, 14, AttrMap - hlcoord 2, 0, AttrMap + ldcoord_a 0, 1, wAttrMap + ldcoord_a 0, 14, wAttrMap + hlcoord 2, 0, wAttrMap lb bc, 8, 18 ld a, $5 call MG_Mobile_Layout_FillBox - hlcoord 2, 8, AttrMap + hlcoord 2, 8, wAttrMap lb bc, 8, 18 ld a, $6 call MG_Mobile_Layout_FillBox - hlcoord 0, 16, AttrMap + hlcoord 0, 16, wAttrMap lb bc, 2, SCREEN_WIDTH ld a, $4 call MG_Mobile_Layout_FillBox ld a, $3 lb bc, 6, 1 - hlcoord 6, 1, AttrMap + hlcoord 6, 1, wAttrMap call MG_Mobile_Layout_FillBox ld a, $3 lb bc, 6, 1 - hlcoord 17, 1, AttrMap + hlcoord 17, 1, wAttrMap call MG_Mobile_Layout_FillBox ld a, $3 lb bc, 6, 1 - hlcoord 6, 9, AttrMap + hlcoord 6, 9, wAttrMap call MG_Mobile_Layout_FillBox ld a, $3 lb bc, 6, 1 - hlcoord 17, 9, AttrMap + hlcoord 17, 9, wAttrMap call MG_Mobile_Layout_FillBox ld a, $2 - hlcoord 2, 16, AttrMap + hlcoord 2, 16, wAttrMap ld [hli], a ld a, $7 ld [hli], a @@ -295,7 +295,7 @@ _InitMG_Mobile_LinkTradePalMap: ; 49797 ld [hli], a ld a, $2 ld [hl], a - hlcoord 2, 17, AttrMap + hlcoord 2, 17, wAttrMap ld a, $3 ld bc, 6 call ByteFill diff --git a/engine/debug.asm b/engine/debug.asm index c15481926..52bd15f28 100755 --- a/engine/debug.asm +++ b/engine/debug.asm @@ -71,7 +71,7 @@ Function818f4: ; 818f4 ld hl, PokemonPalettes Function818fd: ; 818fd - ld de, OverworldMap + ld de, wOverworldMap ld c, NUM_POKEMON + 1 .asm_81902 push bc @@ -87,7 +87,7 @@ Function818fd: ; 818fd Function81911: ; 81911 ld hl, TrainerPalettes - ld de, OverworldMap + ld de, wOverworldMap ld c, NUM_TRAINER_CLASSES .asm_81919 push bc @@ -138,7 +138,7 @@ Function81948: ; 81948 ld bc, sScratch - vTiles0 xor a call ByteFill - hlcoord 0, 0, AttrMap + hlcoord 0, 0, wAttrMap ld bc, SCREEN_WIDTH * SCREEN_HEIGHT xor a call ByteFill @@ -320,7 +320,7 @@ Function81adb: ; 81adb call Function81bf4 ld a, [wcf66] inc a - ld [CurPartySpecies], a + ld [wCurPartySpecies], a ld [wd265], a hlcoord 0, 1 ld de, wd265 @@ -330,7 +330,7 @@ Function81adb: ; 81adb and a jr nz, .asm_81b7a ld a, $1 - ld [UnownLetter], a + ld [wUnownLetter], a call GetPokemonName hlcoord 4, 1 call PlaceString @@ -364,15 +364,15 @@ Function81adb: ; 81adb .asm_81b7a ld a, [wd265] - ld [TrainerClass], a + ld [wTrainerClass], a callfar GetTrainerAttributes - ld de, StringBuffer1 + ld de, wStringBuffer1 hlcoord 4, 1 call PlaceString ld de, vTiles2 callfar GetTrainerPic xor a - ld [TempEnemyMonSpecies], a + ld [wTempEnemyMonSpecies], a ld [hGraphicStartTile], a hlcoord 2, 3 lb bc, 7, 7 @@ -390,15 +390,15 @@ String_81bb9: db DEBUGTEST_A, "きりかえ▶@" ; (A) switches ; 81bc0 Function81bc0: ; 81bc0 - decoord 0, 11, AttrMap + decoord 0, 11, wAttrMap hlcoord 2, 11 ld a, $1 call Function81bde - decoord 0, 13, AttrMap + decoord 0, 13, wAttrMap hlcoord 2, 13 ld a, $2 call Function81bde - decoord 0, 15, AttrMap + decoord 0, 15, wAttrMap hlcoord 2, 15 ld a, $3 @@ -424,7 +424,7 @@ Function81bf4: ; 81bf4 ld h, $0 add hl, hl add hl, hl - ld de, OverworldMap + ld de, wOverworldMap add hl, de ld de, wc608 ld bc, 4 @@ -771,7 +771,7 @@ Function81df4: ; 81df4 call PlaceString ld a, [wd004] call Function81e55 - ld [CurItem], a + ld [wCurItem], a predef CanLearnTMHMMove ld a, c and a @@ -876,7 +876,7 @@ Function81eca: ; 81eca ld h, $0 add hl, hl add hl, hl - ld de, OverworldMap + ld de, wOverworldMap add hl, de ld e, l ld d, h @@ -1029,7 +1029,7 @@ Function81f5e: ; 81f5e ld [hl], $ed ld b, $70 ld c, $5 - ld hl, Sprites + ld hl, wVirtualOAM ld de, wc608 + 10 call .asm_81fb7 ld de, wc608 + 11 @@ -1099,7 +1099,7 @@ TilesetColorTest: ld bc, SCREEN_WIDTH * SCREEN_HEIGHT ld a, DEBUGTEST_BLACK call ByteFill - hlcoord 0, 0, AttrMap + hlcoord 0, 0, wAttrMap ld bc, SCREEN_WIDTH * SCREEN_HEIGHT ld a, $7 call ByteFill @@ -1130,7 +1130,7 @@ Function821d2: ; 821d2 Function821d8: ; 821d8 ld a, [wcf64] - hlcoord 0, 0, AttrMap + hlcoord 0, 0, wAttrMap Function821de: ; 821de add hl, de diff --git a/engine/decorations.asm b/engine/decorations.asm index 413a049a2..cf372159a 100755 --- a/engine/decorations.asm +++ b/engine/decorations.asm @@ -1,8 +1,8 @@ InitDecorations: ; 26751 (9:6751) ld a, DECO_FEATHERY_BED - ld [Bed], a + ld [wDecoBed], a ld a, DECO_TOWN_MAP - ld [Poster], a + ld [wDecoPoster], a ret _KrisDecorationMenu: ; 0x2675c @@ -11,18 +11,18 @@ _KrisDecorationMenu: ; 0x2675c ld hl, .MenuDataHeader call LoadMenuDataHeader xor a - ld [Buffer5], a + ld [wBuffer5], a ld a, $1 - ld [Buffer6], a + ld [wBuffer6], a .top_loop - ld a, [Buffer6] + ld a, [wBuffer6] ld [wMenuCursorBuffer], a call .FindCategoriesWithOwnedDecos call DoNthMenu ld a, [wMenuCursorY] - ld [Buffer6], a + ld [wBuffer6], a jr c, .exit_menu - ld a, [MenuSelection] + ld a, [wMenuSelection] ld hl, .pointers call MenuJumptable jr nc, .top_loop @@ -31,7 +31,7 @@ _KrisDecorationMenu: ; 0x2675c call ExitMenu pop af ld [wWhichIndexSet], a - ld a, [Buffer5] + ld a, [wBuffer5] ld c, a ret ; 0x2679a @@ -78,14 +78,14 @@ _KrisDecorationMenu: ; 0x2675c call .FindOwndDecos ld a, 7 call .AppendToStringBuffer2 - ld hl, StringBuffer2 + ld hl, wStringBuffer2 ld de, wd002 ld bc, ITEM_NAME_LENGTH call CopyBytes ret .ClearStringBuffer2: ; 26822 (9:6822) - ld hl, StringBuffer2 + ld hl, wStringBuffer2 xor a ld [hli], a ld bc, ITEM_NAME_LENGTH - 1 @@ -94,7 +94,7 @@ _KrisDecorationMenu: ; 0x2675c ret .AppendToStringBuffer2: ; 26830 (9:6830) - ld hl, StringBuffer2 + ld hl, wStringBuffer2 inc [hl] ld e, [hl] ld d, 0 @@ -471,7 +471,7 @@ GetDecorationName: ; 269e7 ; 269f3 DecorationMenuFunction: ; 269f3 - ld a, [MenuSelection] + ld a, [wMenuSelection] push de call GetDecorationData call GetDecoName @@ -481,7 +481,7 @@ DecorationMenuFunction: ; 269f3 ; 26a02 DoDecorationAction2: ; 26a02 - ld a, [MenuSelection] + ld a, [wMenuSelection] call GetDecorationData ld de, 2 ; function 2 add hl, de @@ -545,7 +545,7 @@ INCLUDE "data/decorations/names.asm" GetDecoName: ; 26c72 ld a, [hli] ld e, [hl] - ld bc, StringBuffer2 + ld bc, wStringBuffer2 push bc ld hl, .NameFunctions rst JumpTable @@ -645,75 +645,75 @@ DecoAction_nothing: ; 26ce3 ; 26ce5 DecoAction_setupbed: ; 26ce5 - ld hl, Bed + ld hl, wDecoBed jp DecoAction_TrySetItUp ; 26ceb DecoAction_putawaybed: ; 26ceb - ld hl, Bed + ld hl, wDecoBed jp DecoAction_TryPutItAway ; 26cf1 DecoAction_setupcarpet: ; 26cf1 - ld hl, Carpet + ld hl, wDecoCarpet jp DecoAction_TrySetItUp ; 26cf7 DecoAction_putawaycarpet: ; 26cf7 - ld hl, Carpet + ld hl, wDecoCarpet jp DecoAction_TryPutItAway ; 26cfd DecoAction_setupplant: ; 26cfd - ld hl, Plant + ld hl, wDecoPlant jp DecoAction_TrySetItUp ; 26d03 DecoAction_putawayplant: ; 26d03 - ld hl, Plant + ld hl, wDecoPlant jp DecoAction_TryPutItAway ; 26d09 DecoAction_setupposter: ; 26d09 - ld hl, Poster + ld hl, wDecoPoster jp DecoAction_TrySetItUp ; 26d0f DecoAction_putawayposter: ; 26d0f - ld hl, Poster + ld hl, wDecoPoster jp DecoAction_TryPutItAway ; 26d15 DecoAction_setupconsole: ; 26d15 - ld hl, Console + ld hl, wDecoConsole jp DecoAction_TrySetItUp ; 26d1b DecoAction_putawayconsole: ; 26d1b - ld hl, Console + ld hl, wDecoConsole jp DecoAction_TryPutItAway ; 26d21 DecoAction_setupbigdoll: ; 26d21 - ld hl, BigDoll + ld hl, wDecoBigDoll jp DecoAction_TrySetItUp ; 26d27 DecoAction_putawaybigdoll: ; 26d27 - ld hl, BigDoll + ld hl, wDecoBigDoll jp DecoAction_TryPutItAway ; 26d2d DecoAction_TrySetItUp: ; 26d2d ld a, [hl] - ld [Buffer1], a + ld [wBuffer1], a push hl call DecoAction_SetItUp jr c, .failed ld a, 1 - ld [Buffer5], a + ld [wBuffer5], a pop hl - ld a, [MenuSelection] + ld a, [wMenuSelection] ld [hl], a xor a ret @@ -726,20 +726,20 @@ DecoAction_TrySetItUp: ; 26d2d DecoAction_SetItUp: ; 26d46 ; See if there's anything of the same type already out - ld a, [Buffer1] + ld a, [wBuffer1] and a jr z, .nothingthere ; See if that item is already out ld b, a - ld a, [MenuSelection] + ld a, [wMenuSelection] cp b jr z, .alreadythere ; Put away the item that's already out, and set up the new one - ld a, [MenuSelection] - ld hl, StringBuffer4 + ld a, [wMenuSelection] + ld hl, wStringBuffer4 call GetDecorationName - ld a, [Buffer1] - ld hl, StringBuffer3 + ld a, [wBuffer1] + ld hl, wStringBuffer3 call GetDecorationName ld hl, DecoText_PutAwayAndSetUp call MenuTextBoxBackup @@ -747,8 +747,8 @@ DecoAction_SetItUp: ; 26d46 ret .nothingthere - ld a, [MenuSelection] - ld hl, StringBuffer3 + ld a, [wMenuSelection] + ld hl, wStringBuffer3 call GetDecorationName ld hl, DecoText_SetUpTheDeco call MenuTextBoxBackup @@ -765,18 +765,18 @@ DecoAction_SetItUp: ; 26d46 DecoAction_TryPutItAway: ; 26d86 ; If there is no item of that type already set, there is nothing to put away. ld a, [hl] - ld [Buffer1], a + ld [wBuffer1], a xor a ld [hl], a - ld a, [Buffer1] + ld a, [wBuffer1] and a jr z, .nothingthere ; Put it away. ld a, $1 - ld [Buffer5], a - ld a, [Buffer1] - ld [MenuSelection], a - ld hl, StringBuffer3 + ld [wBuffer5], a + ld a, [wBuffer1] + ld [wMenuSelection], a + ld hl, wStringBuffer3 call GetDecorationName ld hl, DecoText_PutAwayTheDeco call MenuTextBoxBackup @@ -797,7 +797,7 @@ DecoAction_setupornament: ; 26db3 call DecoAction_SetItUp_Ornament jr c, .cancel ld a, $1 - ld [Buffer5], a + ld [wBuffer5], a jr DecoAction_FinishUp_Ornament .cancel @@ -829,16 +829,16 @@ DecoAction_SetItUp_Ornament: ; 26de3 and a jr z, .nothingthere ld b, a - ld a, [MenuSelection] + ld a, [wMenuSelection] cp b jr z, .failed ld a, b - ld hl, StringBuffer3 + ld hl, wStringBuffer3 call GetDecorationName - ld a, [MenuSelection] - ld hl, StringBuffer4 + ld a, [wMenuSelection] + ld hl, wStringBuffer4 call GetDecorationName - ld a, [MenuSelection] + ld a, [wMenuSelection] ld [wSelectedDecoration], a call .getwhichside ld hl, DecoText_PutAwayAndSetUp @@ -847,11 +847,11 @@ DecoAction_SetItUp_Ornament: ; 26de3 ret .nothingthere - ld a, [MenuSelection] + ld a, [wMenuSelection] ld [wSelectedDecoration], a call .getwhichside - ld a, [MenuSelection] - ld hl, StringBuffer3 + ld a, [wMenuSelection] + ld hl, wStringBuffer3 call GetDecorationName ld hl, DecoText_SetUpTheDeco call MenuTextBoxBackup @@ -866,7 +866,7 @@ DecoAction_SetItUp_Ornament: ; 26de3 ; 26e33 .getwhichside ; 26e33 - ld a, [MenuSelection] + ld a, [wMenuSelection] ld b, a ld a, [wOtherDecoration] cp b @@ -886,10 +886,10 @@ DecoAction_PutItAway_Ornament: ; 26e46 ld a, [wSelectedDecoration] and a jr z, .nothingthere - ld hl, StringBuffer3 + ld hl, wStringBuffer3 call GetDecorationName ld a, $1 - ld [Buffer5], a + ld [wBuffer5], a xor a ld [wSelectedDecoration], a ld hl, DecoText_PutAwayTheDeco @@ -920,7 +920,7 @@ DecoAction_AskWhichSide: ; 26e70 ld a, [wMenuCursorY] cp 3 jr z, .nope - ld [Buffer2], a + ld [wBuffer2], a call QueryWhichSide ld a, [hl] ld [wSelectedDecoration], a @@ -935,9 +935,9 @@ DecoAction_AskWhichSide: ; 26e70 ; 26e9a QueryWhichSide: ; 26e9a - ld hl, RightOrnament - ld de, LeftOrnament - ld a, [Buffer2] + ld hl, wDecoRightOrnament + ld de, wDecoLeftOrnament + ld a, [wBuffer2] cp 1 ret z push hl @@ -1009,7 +1009,7 @@ DecorationFlagAction_c: ; 26ef1 GetDecorationName_c: ; 26ef5 (9:6ef5) ld a, c call GetDecorationID - ld hl, StringBuffer1 + ld hl, wStringBuffer1 push hl call GetDecorationName pop de @@ -1072,7 +1072,7 @@ DescribeDecoration:: ; 26f59 ; 26f69 DecorationDesc_Poster: ; 26f69 - ld a, [Poster] + ld a, [wDecoPoster] ld hl, DecorationDesc_PosterPointers ld de, 3 call IsInArray @@ -1148,20 +1148,20 @@ DecorationDesc_NullPoster: ; 26fb8 ; 26fb9 DecorationDesc_LeftOrnament: ; 26fb9 - ld a, [LeftOrnament] + ld a, [wDecoLeftOrnament] jr DecorationDesc_OrnamentOrConsole DecorationDesc_RightOrnament: ; 26fbe - ld a, [RightOrnament] + ld a, [wDecoRightOrnament] jr DecorationDesc_OrnamentOrConsole DecorationDesc_Console: ; 26fc3 - ld a, [Console] + ld a, [wDecoConsole] jr DecorationDesc_OrnamentOrConsole DecorationDesc_OrnamentOrConsole: ; 26fc8 ld c, a - ld de, StringBuffer3 + ld de, wStringBuffer3 call GetDecorationName_c_de ld b, BANK(.OrnamentConsoleScript) ld de, .OrnamentConsoleScript @@ -1196,18 +1196,18 @@ DecorationDesc_GiantOrnament: ; 26fdd Special_ToggleMaptileDecorations: ; 26feb lb de, 0, 4 - ld a, [Bed] + ld a, [wDecoBed] call SetDecorationTile lb de, 7, 4 - ld a, [Plant] + ld a, [wDecoPlant] call SetDecorationTile lb de, 6, 0 - ld a, [Poster] + ld a, [wDecoPoster] call SetDecorationTile call SetPosterVisibility lb de, 0, 0 call PadCoords_de - ld a, [Carpet] + ld a, [wDecoCarpet] and a ret z call _GetDecorationSprite @@ -1227,7 +1227,7 @@ Special_ToggleMaptileDecorations: ; 26feb SetPosterVisibility: ; 27027 ld b, SET_FLAG - ld a, [Poster] + ld a, [wDecoPoster] and a jr nz, .ok ld b, RESET_FLAG @@ -1250,20 +1250,20 @@ SetDecorationTile: ; 27037 Special_ToggleDecorationsVisibility: ; 27043 ld de, EVENT_KRISS_HOUSE_2F_CONSOLE - ld hl, VariableSprites + SPRITE_CONSOLE - SPRITE_VARS - ld a, [Console] + ld hl, wVariableSprites + SPRITE_CONSOLE - SPRITE_VARS + ld a, [wDecoConsole] call ToggleDecorationVisibility ld de, EVENT_KRISS_HOUSE_2F_DOLL_1 - ld hl, VariableSprites + SPRITE_DOLL_1 - SPRITE_VARS - ld a, [LeftOrnament] + ld hl, wVariableSprites + SPRITE_DOLL_1 - SPRITE_VARS + ld a, [wDecoLeftOrnament] call ToggleDecorationVisibility ld de, EVENT_KRISS_HOUSE_2F_DOLL_2 - ld hl, VariableSprites + SPRITE_DOLL_2 - SPRITE_VARS - ld a, [RightOrnament] + ld hl, wVariableSprites + SPRITE_DOLL_2 - SPRITE_VARS + ld a, [wDecoRightOrnament] call ToggleDecorationVisibility ld de, EVENT_KRISS_HOUSE_2F_BIG_DOLL - ld hl, VariableSprites + SPRITE_BIG_DOLL - SPRITE_VARS - ld a, [BigDoll] + ld hl, wVariableSprites + SPRITE_BIG_DOLL - SPRITE_VARS + ld a, [wDecoBigDoll] call ToggleDecorationVisibility ret ; 27074 diff --git a/engine/delete_save_change_clock.asm b/engine/delete_save_change_clock.asm index 8a711cc5e..fd6ffae2c 100755 --- a/engine/delete_save_change_clock.asm +++ b/engine/delete_save_change_clock.asm @@ -61,12 +61,12 @@ _ResetClock: ; 4d3b1 ClockResetPassword: ; 4d41e call .CalculatePassword push de - ld hl, StringBuffer2 + ld hl, wStringBuffer2 ld bc, 5 xor a call ByteFill ld a, $4 - ld [StringBuffer2 + 5], a + ld [wStringBuffer2 + 5], a ld hl, .pleaseenterpasswordtext call PrintText .loop @@ -108,7 +108,7 @@ ClockResetPassword: ; 4d41e .updateIDdisplay ; 4d468 hlcoord 14, 15 - ld de, StringBuffer2 + ld de, wStringBuffer2 ld c, 5 .loop3 ld a, [de] @@ -122,7 +122,7 @@ ClockResetPassword: ; 4d41e ld a, " " call ByteFill hlcoord 14, 16 - ld a, [StringBuffer2 + 5] + ld a, [wStringBuffer2 + 5] ld e, a ld d, $0 add hl, de @@ -145,19 +145,19 @@ ClockResetPassword: ; 4d41e ret .left - ld a, [StringBuffer2 + 5] + ld a, [wStringBuffer2 + 5] and a ret z dec a - ld [StringBuffer2 + 5], a + ld [wStringBuffer2 + 5], a ret .right - ld a, [StringBuffer2 + 5] + ld a, [wStringBuffer2 + 5] cp $4 ret z inc a - ld [StringBuffer2 + 5], a + ld [wStringBuffer2 + 5], a ret .up @@ -187,16 +187,16 @@ ClockResetPassword: ; 4d41e ret .getcurrentdigit ; 4d4d5 - ld a, [StringBuffer2 + 5] + ld a, [wStringBuffer2 + 5] ld e, a ld d, $0 - ld hl, StringBuffer2 + ld hl, wStringBuffer2 add hl, de ret .ConvertDecIDToBytes: ; 4d4e0 ld hl, 0 - ld de, StringBuffer2 + 4 + ld de, wStringBuffer2 + 4 ld bc, 1 call .ConvertToBytes ld bc, 10 @@ -222,13 +222,13 @@ ClockResetPassword: ; 4d41e ld a, BANK(sPlayerData) call GetSRAMBank ld de, 0 - ld hl, sPlayerData + (PlayerID - wPlayerData) + ld hl, sPlayerData + (wPlayerID - wPlayerData) ld c, $2 call .ComponentFromNumber - ld hl, sPlayerData + (PlayerName - wPlayerData) + ld hl, sPlayerData + (wPlayerName - wPlayerData) ld c, NAME_LENGTH_JAPANESE - 1 call .ComponentFromString - ld hl, sPlayerData + (Money - wPlayerData) + ld hl, sPlayerData + (wMoney - wPlayerData) ld c, $3 call .ComponentFromNumber call CloseSRAM diff --git a/engine/diploma.asm b/engine/diploma.asm index ba45e4cd5..5d0482cc4 100644 --- a/engine/diploma.asm +++ b/engine/diploma.asm @@ -22,7 +22,7 @@ PlaceDiplomaOnScreen: ; 1dd709 ld de, .EmptyString hlcoord 15, 5 call PlaceString - ld de, PlayerName + ld de, wPlayerName hlcoord 9, 5 call PlaceString ld de, .Certification @@ -68,12 +68,12 @@ PrintDiplomaPage2: ; 1dd7ae hlcoord 3, 15 call PlaceString hlcoord 12, 15 - ld de, GameTimeHours + ld de, wGameTimeHours lb bc, 2, 4 call PrintNum ld [hl], $67 ; colon inc hl - ld de, GameTimeMinutes + ld de, wGameTimeMinutes lb bc, PRINTNUM_LEADINGZEROS | 1, 2 call PrintNum ret diff --git a/engine/dma_transfer.asm b/engine/dma_transfer.asm index 60b515acf..b4a500545 100755 --- a/engine/dma_transfer.asm +++ b/engine/dma_transfer.asm @@ -3,7 +3,7 @@ HDMATransferAttrMapAndTileMapToWRAMBank3:: ; 104000 jp CallInSafeGFXMode .Function: - decoord 0, 0, AttrMap + decoord 0, 0, wAttrMap ld hl, wScratchAttrMap call PadAttrMapForHDMATransfer decoord 0, 0 @@ -40,7 +40,7 @@ HDMATransferAttrMapToWRAMBank3: ; 104047 jp CallInSafeGFXMode .Function: - decoord 0, 0, AttrMap + decoord 0, 0, wAttrMap ld hl, wScratchAttrMap call PadAttrMapForHDMATransfer ld a, $1 @@ -55,7 +55,7 @@ ReloadMapPart:: ; 104061 jp CallInSafeGFXMode .Function: - decoord 0, 0, AttrMap + decoord 0, 0, wAttrMap ld hl, wScratchAttrMap call PadAttrMapForHDMATransfer decoord 0, 0 @@ -86,7 +86,7 @@ Mobile_ReloadMapPart: ; 104099 jp CallInSafeGFXMode .Function: - decoord 0, 0, AttrMap + decoord 0, 0, wAttrMap ld hl, wScratchAttrMap call PadAttrMapForHDMATransfer decoord 0, 0 @@ -156,10 +156,10 @@ OpenAndCloseMenu_HDMATransferTileMapAndAttrMap:: ; 104110 jp CallInSafeGFXMode .Function: - ; Transfer AttrMap and Tilemap to BGMap + ; Transfer wAttrMap and Tilemap to BGMap ; Fill vBGAttrs with $00 ; Fill vBGTiles with " " - decoord 0, 0, AttrMap + decoord 0, 0, wAttrMap ld hl, wScratchAttrMap call PadAttrMapForHDMATransfer decoord 0, 0 @@ -189,10 +189,10 @@ Mobile_OpenAndCloseMenu_HDMATransferTileMapAndAttrMap: ; 104148 (41:4148) jp CallInSafeGFXMode .Function: - ; Transfer AttrMap and Tilemap to BGMap + ; Transfer wAttrMap and Tilemap to BGMap ; Fill vBGAttrs with $00 ; Fill vBGTiles with $ff - decoord 0, 0, AttrMap + decoord 0, 0, wAttrMap ld hl, wScratchAttrMap call PadAttrMapForHDMATransfer ld c, $ff @@ -588,7 +588,7 @@ HDMATransfer_OnlyTopFourRows: ; 104303 decoord 0, 0 call .Copy ld hl, wScratchTileMap + $80 - decoord 0, 0, AttrMap + decoord 0, 0, wAttrMap call .Copy ld a, $1 ld [rVBK], a diff --git a/engine/events.asm b/engine/events.asm index 96108730a..2b4cfd586 100644 --- a/engine/events.asm +++ b/engine/events.asm @@ -5,12 +5,12 @@ SECTION "Events", ROMX OverworldLoop:: ; 966b0 xor a - ld [MapStatus], a + ld [wMapStatus], a .loop - ld a, [MapStatus] + ld a, [wMapStatus] ld hl, .jumps rst JumpTable - ld a, [MapStatus] + ld a, [wMapStatus] cp 3 ; done jr nz, .loop .done @@ -25,101 +25,101 @@ OverworldLoop:: ; 966b0 DisableEvents: ; 966cb xor a - ld [ScriptFlags3], a + ld [wScriptFlags3], a ret ; 966d0 EnableEvents:: ; 966d0 ld a, $ff - ld [ScriptFlags3], a + ld [wScriptFlags3], a ret ; 966d6 CheckBit5_ScriptFlags3: ; 966d6 - ld hl, ScriptFlags3 + ld hl, wScriptFlags3 bit 5, [hl] ret ; 966dc DisableWarpsConnxns: ; 966dc - ld hl, ScriptFlags3 + ld hl, wScriptFlags3 res 2, [hl] ret ; 966e2 DisableCoordEvents: ; 966e2 - ld hl, ScriptFlags3 + ld hl, wScriptFlags3 res 1, [hl] ret ; 966e8 DisableStepCount: ; 966e8 - ld hl, ScriptFlags3 + ld hl, wScriptFlags3 res 0, [hl] ret ; 966ee DisableWildEncounters: ; 966ee - ld hl, ScriptFlags3 + ld hl, wScriptFlags3 res 4, [hl] ret ; 966f4 EnableWarpsConnxns: ; 966f4 - ld hl, ScriptFlags3 + ld hl, wScriptFlags3 set 2, [hl] ret ; 966fa EnableCoordEvents: ; 966fa - ld hl, ScriptFlags3 + ld hl, wScriptFlags3 set 1, [hl] ret ; 96700 EnableStepCount: ; 96700 - ld hl, ScriptFlags3 + ld hl, wScriptFlags3 set 0, [hl] ret ; 96706 EnableWildEncounters: ; 96706 - ld hl, ScriptFlags3 + ld hl, wScriptFlags3 set 4, [hl] ret ; 9670c CheckWarpConnxnScriptFlag: ; 9670c - ld hl, ScriptFlags3 + ld hl, wScriptFlags3 bit 2, [hl] ret ; 96712 CheckCoordEventScriptFlag: ; 96712 - ld hl, ScriptFlags3 + ld hl, wScriptFlags3 bit 1, [hl] ret ; 96718 CheckStepCountScriptFlag: ; 96718 - ld hl, ScriptFlags3 + ld hl, wScriptFlags3 bit 0, [hl] ret ; 9671e CheckWildEncountersScriptFlag: ; 9671e - ld hl, ScriptFlags3 + ld hl, wScriptFlags3 bit 4, [hl] ret ; 96724 StartMap: ; 96724 xor a - ld [ScriptVar], a + ld [wScriptVar], a xor a - ld [ScriptRunning], a - ld hl, MapStatus - ld bc, wMapStatusEnd - MapStatus + ld [wScriptRunning], a + ld hl, wMapStatus + ld bc, wMapStatusEnd - wMapStatus call ByteFill farcall InitCallReceiveDelay call ClearJoypad @@ -141,13 +141,13 @@ EnterMap: ; 9673e cp MAPSETUP_RELOADMAP jr nz, .dontresetpoison xor a - ld [PoisonStepCount], a + ld [wPoisonStepCount], a .dontresetpoison xor a ; end map entry ld [hMapEntryMethod], a ld a, 2 ; HandleMap - ld [MapStatus], a + ld [wMapStatus], a ret ; 9676d @@ -164,7 +164,7 @@ HandleMap: ; 96773 call MapEvents ; Not immediately entering a connected map will cause problems. - ld a, [MapStatus] + ld a, [wMapStatus] cp 2 ; HandleMap ret nz @@ -176,7 +176,7 @@ HandleMap: ; 96773 ; 96795 MapEvents: ; 96795 - ld a, [MapEventStatus] + ld a, [wMapEventStatus] ld hl, .jumps rst JumpTable ret @@ -203,12 +203,12 @@ MaxOverworldDelay: ; 967af ResetOverworldDelay: ; 967b0 ld a, [MaxOverworldDelay] - ld [OverworldDelay], a + ld [wOverworldDelay], a ret ; 967b7 NextOverworldFrame: ; 967b7 - ld a, [OverworldDelay] + ld a, [wOverworldDelay] and a ret z ld c, a @@ -217,7 +217,7 @@ NextOverworldFrame: ; 967b7 ; 967c1 HandleMapTimeAndJoypad: ; 967c1 - ld a, [MapEventStatus] + ld a, [wMapEventStatus] cp 1 ; no events ret z @@ -252,12 +252,12 @@ CheckPlayerState: ; 967f4 call EnableEvents .events ld a, 0 ; events - ld [MapEventStatus], a + ld [wMapEventStatus], a ret .noevents ld a, 1 ; no events - ld [MapEventStatus], a + ld [wMapEventStatus], a ret ; 96812 @@ -272,7 +272,7 @@ _CheckObjectEnteringVisibleRange: ; 96812 PlayerEvents: ; 9681f xor a ; If there's already a player event, don't interrupt it. - ld a, [ScriptRunning] + ld a, [wScriptRunning] and a ret nz @@ -304,9 +304,9 @@ PlayerEvents: ; 9681f farcall EnableScriptMode pop af - ld [ScriptRunning], a + ld [wScriptRunning], a call DoPlayerEvent - ld a, [ScriptRunning] + ld a, [wScriptRunning] cp PLAYEREVENT_CONNECTION jr z, .ok2 cp PLAYEREVENT_JOYCHANGEFACING @@ -379,7 +379,7 @@ CheckTileEvent: ; 96874 ret .warp_tile - ld a, [PlayerStandingTile] + ld a, [wPlayerStandingTile] call CheckPitTile jr nz, .not_pit ld a, PLAYEREVENT_FALL @@ -463,13 +463,13 @@ endr call GetMapScriptsBank call CallScript - ld hl, ScriptFlags + ld hl, wScriptFlags res 3, [hl] farcall EnableScriptMode farcall ScriptEvents - ld hl, ScriptFlags + ld hl, wScriptFlags bit 3, [hl] jr z, .nope @@ -647,7 +647,7 @@ TryObjectEvent: ; 969b5 ld h, [hl] ld l, a call GetMapScriptsBank - ld de, EngineBuffer1 + ld de, wEngineBuffer1 ld bc, 2 call FarCopyBytes ld a, PLAYEREVENT_ITEMBALL @@ -689,7 +689,7 @@ TryBGEvent: ; 96a38 ret .is_bg_event: - ld a, [EngineBuffer3] + ld a, [wEngineBuffer3] ld hl, .bg_events rst JumpTable ret @@ -720,14 +720,14 @@ TryBGEvent: ; 96a38 jr .checkdir .checkdir - ld a, [PlayerDirection] + ld a, [wPlayerDirection] and %1100 cp b jp nz, .dontread .read call PlayTalkObject - ld hl, EngineBuffer4 + ld hl, wEngineBuffer4 ld a, [hli] ld h, [hl] ld l, a @@ -741,7 +741,7 @@ TryBGEvent: ; 96a38 jp nz, .dontread call PlayTalkObject call GetMapScriptsBank - ld de, EngineBuffer1 + ld de, wEngineBuffer1 ld bc, 3 call FarCopyBytes ld a, BANK(HiddenItemScript) @@ -754,7 +754,7 @@ TryBGEvent: ; 96a38 call CheckBGEventFlag jr nz, .dontread call GetMapScriptsBank - ld de, EngineBuffer1 + ld de, wEngineBuffer1 ld bc, 3 call FarCopyBytes jr .dontread @@ -787,7 +787,7 @@ TryBGEvent: ; 96a38 ; 96ad8 CheckBGEventFlag: ; 96ad8 - ld hl, EngineBuffer4 + ld hl, wEngineBuffer4 ld a, [hli] ld h, [hl] ld l, a @@ -943,9 +943,9 @@ CountStep: ; 96b79 jr c, .doscript ; Count the step for poison and total steps - ld hl, PoisonStepCount + ld hl, wPoisonStepCount inc [hl] - ld hl, StepCount + ld hl, wStepCount inc [hl] ; Every 256 steps, increase the happiness of all your Pokemon. jr nz, .skip_happiness @@ -956,7 +956,7 @@ CountStep: ; 96b79 ; Every 256 steps, offset from the happiness incrementor by 128 steps, ; decrease the hatch counter of all your eggs until you reach the first ; one that is ready to hatch. - ld a, [StepCount] + ld a, [wStepCount] cp $80 jr nz, .skip_egg @@ -968,7 +968,7 @@ CountStep: ; 96b79 farcall DayCareStep ; Every four steps, deal damage to all Poisoned Pokemon - ld hl, PoisonStepCount + ld hl, wPoisonStepCount ld a, [hl] cp 4 jr c, .skip_poison @@ -1019,7 +1019,7 @@ DoRepelStep: ; 96bd7 ; 96beb DoPlayerEvent: ; 96beb - ld a, [ScriptRunning] + ld a, [wScriptRunning] and a ret z @@ -1036,11 +1036,11 @@ DoPlayerEvent: ; 96beb add hl, bc add hl, bc ld a, [hli] - ld [ScriptBank], a + ld [wScriptBank], a ld a, [hli] - ld [ScriptPos], a + ld [wScriptPos], a ld a, [hl] - ld [ScriptPos + 1], a + ld [wScriptPos + 1], a ret ; 96c0c diff --git a/engine/events/basement_key.asm b/engine/events/basement_key.asm index b15288d09..879c86a34 100755 --- a/engine/events/basement_key.asm +++ b/engine/events/basement_key.asm @@ -1,10 +1,10 @@ _BasementKey: ; 507b4 ; Are we even in the right map to use this? - ld a, [MapGroup] + ld a, [wMapGroup] cp GROUP_GOLDENROD_UNDERGROUND jr nz, .nope - ld a, [MapNumber] + ld a, [wMapNumber] cp MAP_GOLDENROD_UNDERGROUND jr nz, .nope ; Are we on the tile in front of the door? diff --git a/engine/events/battle_tower/battle_tower.asm b/engine/events/battle_tower/battle_tower.asm index 94a29cdab..4b4494925 100755 --- a/engine/events/battle_tower/battle_tower.asm +++ b/engine/events/battle_tower/battle_tower.asm @@ -96,9 +96,9 @@ Function170139: ; 170139 ld a, l ld [wMisc + 1], a ld hl, wBT_OTTempPkmn1DVs - ld a, [PlayerID] + ld a, [wPlayerID] ld [hli], a - ld a, [PlayerID + 1] + ld a, [wPlayerID + 1] ld [hli], a ld a, [wSecretID] ld [hli], a @@ -106,23 +106,23 @@ Function170139: ; 170139 ld [hli], a ld e, l ld d, h - ld hl, PlayerName + ld hl, wPlayerName ld bc, NAME_LENGTH_JAPANESE - 1 call CopyBytes - ld bc, PlayerID + ld bc, wPlayerID ld de, wPlayerGender farcall GetMobileOTTrainerClass ld de, wBT_OTTempPkmn1CaughtGender ld a, c ld [de], a inc de - ld a, LOW(PartyMons) + ld a, LOW(wPartyMons) ld [wcd49], a - ld a, HIGH(PartyMons) + ld a, HIGH(wPartyMons) ld [wcd4a], a - ld a, LOW(PartyMonNicknames) + ld a, LOW(wPartyMonNicknames) ld [wcd4b], a - ld a, HIGH(PartyMonNicknames) + ld a, HIGH(wPartyMonNicknames) ld [wcd4c], a ld a, 3 .CopyLoop: @@ -231,15 +231,15 @@ _BattleTowerBattle: ; 17022c ; 17024d RunBattleTowerTrainer: ; 17024d - ld a, [Options] + ld a, [wOptions] push af - ld hl, Options + ld hl, wOptions set BATTLE_SHIFT, [hl] ; SET MODE - ld a, [InBattleTowerBattle] + ld a, [wInBattleTowerBattle] push af or $1 - ld [InBattleTowerBattle], a + ld [wInBattleTowerBattle], a xor a ld [wLinkMode], a @@ -253,7 +253,7 @@ RunBattleTowerTrainer: ; 17024d farcall LoadPokemonData farcall HealParty ld a, [wBattleResult] - ld [ScriptVar], a + ld [wScriptVar], a and a jr nz, .lost ld a, BANK(sNrOfBeatenBattleTowerTrainers) @@ -261,7 +261,7 @@ RunBattleTowerTrainer: ; 17024d ld a, [sNrOfBeatenBattleTowerTrainers] ld [wNrOfBeatenBattleTowerTrainers], a call CloseSRAM - ld hl, StringBuffer3 + ld hl, wStringBuffer3 ld a, [wNrOfBeatenBattleTowerTrainers] add "1" ld [hli], a @@ -270,9 +270,9 @@ RunBattleTowerTrainer: ; 17024d .lost pop af - ld [InBattleTowerBattle], a + ld [wInBattleTowerBattle], a pop af - ld [Options], a + ld [wOptions], a ld a, $1 ld [wBattleTowerBattleEnded], a ret @@ -334,7 +334,7 @@ ReadBTTrainerParty: ; 1702b7 ld [wBT_OTTempPkmn3NameEnd - 1], a ; $c68a + 57 = $c6c3 ; Fix errors in the movesets call CheckBTMonMovesForErrors -; Repair the trainer name if needed, then copy it to OTPlayerName +; Repair the trainer name if needed, then copy it to wOTPlayerName ld de, wBT_OTTempName ld c, NAME_LENGTH - 1 farcall CheckStringForErrors @@ -346,7 +346,7 @@ ReadBTTrainerParty: ; 1702b7 ld hl, wBT_OTTempName ; 0xc608 .done_trainer_name - ld de, OTPlayerName + ld de, wOTPlayerName ld bc, NAME_LENGTH - 1 call CopyBytes ld a, "@" @@ -354,15 +354,15 @@ ReadBTTrainerParty: ; 1702b7 ld hl, wBT_OTTempTrainerClass ld a, [hli] - ld [OtherTrainerClass], a - ld a, LOW(OTPartyMonNicknames) - ld [BGMapBuffer], a - ld a, HIGH(OTPartyMonNicknames) - ld [BGMapBuffer + 1], a + ld [wOtherTrainerClass], a + ld a, LOW(wOTPartyMonNicknames) + ld [wBGMapBuffer], a + ld a, HIGH(wOTPartyMonNicknames) + ld [wBGMapBuffer + 1], a ; Copy Pkmn into Memory from the address in hl - ld de, OTPartyMon1Species - ld bc, OTPartyCount + ld de, wOTPartyMon1Species + ld bc, wOTPartyCount ld a, BATTLETOWER_PARTY_LENGTH ld [bc], a inc bc @@ -375,16 +375,16 @@ ReadBTTrainerParty: ; 1702b7 ld bc, PARTYMON_STRUCT_LENGTH call CopyBytes push de - ld a, [BGMapBuffer] + ld a, [wBGMapBuffer] ld e, a - ld a, [BGMapBuffer + 1] + ld a, [wBGMapBuffer + 1] ld d, a ld bc, MON_NAME_LENGTH call CopyBytes ld a, e - ld [BGMapBuffer], a + ld [wBGMapBuffer], a ld a, d - ld [BGMapBuffer + 1], a + ld [wBGMapBuffer + 1], a pop de pop bc pop af @@ -420,7 +420,7 @@ endr ld [hl], a .valid - ld [CurSpecies], a + ld [wCurSpecies], a call GetBaseData ld a, $5 call GetSRAMBank @@ -442,7 +442,7 @@ endr ld [hl], a .dont_load - ld [CurPartyLevel], a + ld [wCurPartyLevel], a ld hl, MON_MOVES add hl, bc ld d, NUM_MOVES - 1 @@ -574,13 +574,13 @@ INCLUDE "data/battle_tower/unknown_levels.asm" CopyBTTrainer_FromBT_OT_TowBT_OTTemp: ; 1704a2 -; copy the BattleTower-Trainer data that lies at 'BT_OTTrainer' to 'wBT_OTTemp' +; copy the BattleTower-Trainer data that lies at 'wBT_OTTrainer' to 'wBT_OTTemp' ld a, [rSVBK] push af - ld a, BANK(BT_OTTrainer) + ld a, BANK(wBT_OTTrainer) ld [rSVBK], a - ld hl, BT_OTTrainer + ld hl, wBT_OTTrainer ld de, wBT_OTTemp ld bc, BATTLE_TOWER_STRUCT_LENGTH call CopyBytes @@ -669,7 +669,7 @@ UnusedSpecial_Function1704e1: ; 1704e1 call GetSRAMBank ld hl, $a89c - ld de, StringBuffer3 + ld de, wStringBuffer3 ld bc, $16 call CopyBytes @@ -680,13 +680,13 @@ UnusedSpecial_Function1704e1: ; 1704e1 call CloseSRAM hlcoord 1, 1 - ld de, StringBuffer3 + ld de, wStringBuffer3 call PlaceString hlcoord 1, 3 ld de, .String_Mail call PlaceString hlcoord 4, 3 - ld de, StringBuffer4 + ld de, wStringBuffer4 call PlaceString hlcoord 8, 3 ld de, .String_PastReaders @@ -901,7 +901,7 @@ UnusedSpecial_Function1704e1: ; 1704e1 ; 170687 Special_BattleTowerAction: ; 170687 - ld a, [ScriptVar] + ld a, [wScriptVar] ld e, a ld d, 0 ld hl, .dw @@ -972,13 +972,13 @@ BattleTower_GiveReward: ; 1706ee (5c:46ee) BattleTowerAction $1b ld a, [sBattleTowerReward] call CloseSRAM - ld [ScriptVar], a - ld hl, NumItems + ld [wScriptVar], a + ld hl, wNumItems ld a, [hli] cp MAX_ITEMS ret c ld b, MAX_ITEMS - ld a, [ScriptVar] + ld a, [wScriptVar] ld c, a .loop ld a, [hli] @@ -992,7 +992,7 @@ BattleTower_GiveReward: ; 1706ee (5c:46ee) BattleTowerAction $1b dec b jr nz, .loop ld a, POTION - ld [ScriptVar], a + ld [wScriptVar], a ret Function17071b: ; 17071b (5c:471b) BattleTowerAction $1c @@ -1038,7 +1038,7 @@ BattleTower_RandomlyChooseReward: ; 17073e (5c:473e) BattleTowerAction $1e BattleTowerAction_CheckExplanationRead: ; 17075f (5c:475f) BattleTowerAction $00 call BattleTower_CheckSaveFileExistsAndIsYours - ld a, [ScriptVar] + ld a, [wScriptVar] and a ret z @@ -1046,7 +1046,7 @@ BattleTowerAction_CheckExplanationRead: ; 17075f (5c:475f) BattleTowerAction $00 call GetSRAMBank ld a, [sBattleTowerSaveFileFlags] and $2 - ld [ScriptVar], a + ld [wScriptVar], a call CloseSRAM ret @@ -1055,7 +1055,7 @@ BattleTowerAction_GetChallengeState: ; 170778 (5c:4778) BattleTowerAction $02 ld a, BANK(sBattleTowerChallengeState) call GetSRAMBank ld a, [hl] - ld [ScriptVar], a + ld [wScriptVar], a call CloseSRAM ret @@ -1088,7 +1088,7 @@ Function1707ac: ; 1707ac (5c:47ac) BattleTowerAction $05 ld a, [$aa8c] ld b, a ld a, [$be46] - ld [ScriptVar], a + ld [wScriptVar], a call CloseSRAM and a ret z @@ -1103,7 +1103,7 @@ Function1707ac: ; 1707ac (5c:47ac) BattleTowerAction $05 ld a, [$aa8b] call CloseSRAM ld c, a - ld a, [CurDay] + ld a, [wCurDay] sub c jr c, .asm_1707e5 cp $8 @@ -1113,7 +1113,7 @@ Function1707ac: ; 1707ac (5c:47ac) BattleTowerAction $05 jr nz, .asm_1707ef ret .asm_1707e5 - ld hl, CurDay + ld hl, wCurDay ld a, $8c sub c add [hl] @@ -1121,7 +1121,7 @@ Function1707ac: ; 1707ac (5c:47ac) BattleTowerAction $05 ret c .asm_1707ef ld a, $8 - ld [ScriptVar], a + ld [wScriptVar], a Function1707f4: ; 1707f4 (5c:47f4) BattleTowerAction $06 ld a, $5 @@ -1137,7 +1137,7 @@ Function170807: ; 170807 (5c:4807) BattleTowerAction $16 call UpdateTime ld a, $5 call GetSRAMBank - ld a, [CurDay] + ld a, [wCurDay] ld [$b2f9], a xor a ld [$b2fa], a @@ -1146,7 +1146,7 @@ Function170807: ; 170807 (5c:4807) BattleTowerAction $16 Function17081d: ; 17081d (5c:481d) BattleTowerAction $17 xor a - ld [ScriptVar], a + ld [wScriptVar], a ld a, $5 call GetSRAMBank ld a, [$b2f9] @@ -1159,7 +1159,7 @@ Function17081d: ; 17081d (5c:481d) BattleTowerAction $17 push bc call UpdateTime pop bc - ld a, [CurDay] + ld a, [wCurDay] sub c jr c, .asm_170849 cp $b @@ -1170,7 +1170,7 @@ Function17081d: ; 17081d (5c:481d) BattleTowerAction $17 ret .asm_170849 - ld hl, CurDay + ld hl, wCurDay ld a, 140 sub c add [hl] @@ -1178,7 +1178,7 @@ Function17081d: ; 17081d (5c:481d) BattleTowerAction $17 ret c .asm_170853 ld a, $1 - ld [ScriptVar], a + ld [wScriptVar], a ld a, $5 call GetSRAMBank xor a @@ -1228,14 +1228,14 @@ BattleTower_CheckSaveFileExistsAndIsYours: ; 17089a BattleTowerAction $09 ld a, $1 .nope - ld [ScriptVar], a + ld [wScriptVar], a ret ; 1708b1 Function1708b1: ; 1708b1 (5c:48b1) BattleTowerAction $0a xor a - ld [MusicFade], a + ld [wMusicFade], a call MaxVolume ret @@ -1243,7 +1243,7 @@ CheckMobileEventIndex: ; 1708b9 (5c:48b9) BattleTowerAction $0b something to do ld a, BANK(sMobileEventIndex) call GetSRAMBank ld a, [sMobileEventIndex] - ld [ScriptVar], a + ld [wScriptVar], a call CloseSRAM ret @@ -1251,14 +1251,14 @@ Function1708c8: ; 1708c8 (5c:48c8) BattleTowerAction $0c call UpdateTime ld a, $5 call GetSRAMBank - ld a, [CurDay] + ld a, [wCurDay] ld [$aa8b], a xor a ld [$aa8c], a ld a, [$aa5d] cp $2 jr nc, .asm_1708ec - ld a, [CurDay] + ld a, [wCurDay] ld [$aa48], a ld a, $1 ld [$aa47], a @@ -1268,7 +1268,7 @@ Function1708c8: ; 1708c8 (5c:48c8) BattleTowerAction $0c Function1708f0: ; 1708f0 (5c:48f0) BattleTowerAction $0d xor a - ld [ScriptVar], a + ld [wScriptVar], a call UpdateTime ld a, $5 call GetSRAMBank @@ -1278,7 +1278,7 @@ Function1708f0: ; 1708f0 (5c:48f0) BattleTowerAction $0d call CloseSRAM and a ret z - ld hl, CurDay + ld hl, wCurDay ld a, c cp [hl] jr nz, Function170923 @@ -1289,7 +1289,7 @@ Function1708f0: ; 1708f0 (5c:48f0) BattleTowerAction $0d cp $5 ret c ld a, $1 - ld [ScriptVar], a + ld [wScriptVar], a ret @@ -1309,22 +1309,22 @@ Function170923: ; 170923 BattleTowerAction_EggTicket: ; 17093c (5c:493c) BattleTowerAction $0e xor a - ld [ScriptVar], a + ld [wScriptVar], a ld a, EGG_TICKET - ld [CurItem], a - ld hl, NumItems + ld [wCurItem], a + ld hl, wNumItems call CheckItem ret nc - ld a, [PartyCount] + ld a, [wPartyCount] ld b, 0 ld c, a - ld hl, PartySpecies + ld hl, wPartySpecies .loop ld a, [hli] cp EGG jr nz, .not_egg push hl - ld hl, PartyMonOT + ld hl, wPartyMonOT ld de, NAME_LENGTH_JAPANESE ld a, b and a @@ -1354,15 +1354,15 @@ endr ld [hli], a pop hl ld a, EGG_TICKET - ld [CurItem], a + ld [wCurItem], a ld a, 1 ld [wItemQuantityChangeBuffer], a ld a, -1 - ld [CurItemQuantity], a - ld hl, NumItems + ld [wCurItemQuantity], a + ld hl, wNumItems call TossItem ld a, $1 - ld [ScriptVar], a + ld [wScriptVar], a ret .different @@ -1384,14 +1384,14 @@ Function1709aa: ; 1709aa (5c:49aa) BattleTowerAction $0f ld a, BANK(w3_d090) ld [rSVBK], a ld a, [w3_d090] - ld [ScriptVar], a + ld [wScriptVar], a pop af ld [rSVBK], a ret Function1709bb: ; 1709bb (5c:49bb) BattleTowerAction $10 xor a - ld [ScriptVar], a + ld [wScriptVar], a ld a, $5 call GetSRAMBank ld a, [$a800] @@ -1452,7 +1452,7 @@ Jumptable_1709e7: ; 1709e7 farcall Function11b6b4 farcall Function17d0f3 ld a, $1 - ld [ScriptVar], a + ld [wScriptVar], a ret ; 170a33 @@ -1478,9 +1478,9 @@ Jumptable_1709e7: ; 1709e7 dec c jr nz, .compare_loop call CloseSRAM - ld a, [MapGroup] + ld a, [wMapGroup] ld b, a - ld a, [MapNumber] + ld a, [wMapNumber] ld c, a call GetMapSceneID ld a, d @@ -1492,7 +1492,7 @@ Jumptable_1709e7: ; 1709e7 .no_scene ld a, $1 - ld [ScriptVar], a + ld [wScriptVar], a ret .different @@ -1502,10 +1502,10 @@ Jumptable_1709e7: ; 1709e7 xor a ld [$a800], a call CloseSRAM - ld [ScriptVar], a - ld a, [MapGroup] + ld [wScriptVar], a + ld a, [wMapGroup] ld b, a - ld a, [MapNumber] + ld a, [wMapNumber] ld c, a call GetMapSceneID ld a, d @@ -1536,13 +1536,13 @@ Function170aaf: ; 170aaf (5c:4aaf) BattleTowerAction $13 ld a, $5 call GetSRAMBank ld a, [$aa8d] - ld [ScriptVar], a + ld [wScriptVar], a call CloseSRAM ret Function170abe: ; 170abe (5c:4abe) BattleTowerAction $14 call BattleTower_CheckSaveFileExistsAndIsYours - ld a, [ScriptVar] + ld a, [wScriptVar] and a ret z @@ -1550,7 +1550,7 @@ Function170abe: ; 170abe (5c:4abe) BattleTowerAction $14 call GetSRAMBank ld a, [sBattleTowerSaveFileFlags] and $1 - ld [ScriptVar], a + ld [wScriptVar], a call CloseSRAM ret @@ -1573,14 +1573,14 @@ BattleTowerAction_LevelCheck: ; 170ae8 (5c:4ae8) BattleTowerAction $18 ld a, b ld [wcd4f], a xor a - ld [ScriptVar], a + ld [wScriptVar], a farcall BattleTower_LevelCheck ; level check ret nc ld a, $5 call GetSRAMBank ld a, [$b2fb] call CloseSRAM - ld [ScriptVar], a + ld [wScriptVar], a ret BattleTowerAction_UbersCheck: ; 170b16 (5c:4b16) BattleTowerAction $19 @@ -1593,14 +1593,14 @@ BattleTowerAction_UbersCheck: ; 170b16 (5c:4b16) BattleTowerAction $19 ld a, b ld [wcd4f], a xor a - ld [ScriptVar], a + ld [wScriptVar], a farcall BattleTower_UbersCheck ret nc ld a, $5 call GetSRAMBank ld a, [$b2fb] call CloseSRAM - ld [ScriptVar], a + ld [wScriptVar], a ret Special_LoadOpponentTrainerAndPokemonWithOTSprite: ; 0x170b44 @@ -1609,7 +1609,7 @@ Special_LoadOpponentTrainerAndPokemonWithOTSprite: ; 0x170b44 push af ld a, $3 ld [rSVBK], a - ld hl, BT_OTTrainerClass + ld hl, wBT_OTTrainerClass ld a, [hl] dec a ld c, a @@ -1623,7 +1623,7 @@ Special_LoadOpponentTrainerAndPokemonWithOTSprite: ; 0x170b44 ; Load sprite of the opponent trainer ; because s/he is chosen randomly and appears out of nowhere - ld a, [ScriptVar] + ld a, [wScriptVar] dec a sla a ld e, a @@ -1633,12 +1633,12 @@ Special_LoadOpponentTrainerAndPokemonWithOTSprite: ; 0x170b44 ld c, a ld b, 0 ld d, 0 - ld hl, MapObjects + ld hl, wMapObjects add hl, bc inc hl ld a, [wBTTempOTSprite] ld [hl], a - ld hl, UsedSprites + ld hl, wUsedSprites add hl, de ld [hli], a ld [hUsedSpriteIndex], a @@ -1664,6 +1664,6 @@ Special_CheckForBattleTowerRules: ; 170bd3 ld a, TRUE .asm_170be0 - ld [ScriptVar], a + ld [wScriptVar], a ret ; 170be4 diff --git a/engine/events/battle_tower/load_trainer.asm b/engine/events/battle_tower/load_trainer.asm index e0e4a5ca1..bfb5cf885 100644 --- a/engine/events/battle_tower/load_trainer.asm +++ b/engine/events/battle_tower/load_trainer.asm @@ -1,23 +1,23 @@ Function_LoadOpponentTrainerAndPokemons: ; 1f8000 ld a, [rSVBK] push af - ld a, BANK(BT_OTTrainer) + ld a, BANK(wBT_OTTrainer) ld [rSVBK], a - ; Fill BT_OTTrainer with zeros + ; Fill wBT_OTTrainer with zeros xor a - ld hl, BT_OTTrainer - ld bc, BT_OTTrainerEnd - BT_OTTrainer + ld hl, wBT_OTTrainer + ld bc, wBT_OTTrainerEnd - wBT_OTTrainer call ByteFill ; Write $ff into the Item-Slots ld a, $ff - ld [BT_OTPkmn1Item], a - ld [BT_OTPkmn2Item], a - ld [BT_OTPkmn3Item], a + ld [wBT_OTPkmn1Item], a + ld [wBT_OTPkmn2Item], a + ld [wBT_OTPkmn3Item], a - ; Set BT_OTTrainer as start address to write the following data to - ld de, BT_OTTrainer + ; Set wBT_OTTrainer as start address to write the following data to + ld de, wBT_OTTrainer ld a, [hRandomAdd] ld b, a @@ -129,22 +129,22 @@ Function_LoadRandomBattleTowerPkmn: ; 1f8081 ld b, a ld a, [hld] ld c, a - ld a, [BT_OTPkmn1] + ld a, [wBT_OTPkmn1] cp b jr z, .FindARandomBattleTowerPkmn - ld a, [BT_OTPkmn1Item] + ld a, [wBT_OTPkmn1Item] cp c jr z, .FindARandomBattleTowerPkmn - ld a, [BT_OTPkmn2] + ld a, [wBT_OTPkmn2] cp b jr z, .FindARandomBattleTowerPkmn - ld a, [BT_OTPkmn2Item] + ld a, [wBT_OTPkmn2Item] cp c jr z, .FindARandomBattleTowerPkmn - ld a, [BT_OTPkmn3] + ld a, [wBT_OTPkmn3] cp b jr z, .FindARandomBattleTowerPkmn - ld a, [BT_OTPkmn3Item] + ld a, [wBT_OTPkmn3Item] cp c jr z, .FindARandomBattleTowerPkmn ld a, [sBTPkmnPrevTrainer1] @@ -199,11 +199,11 @@ Function_LoadRandomBattleTowerPkmn: ; 1f8081 ld [sBTPkmnPrevPrevTrainer2], a ld a, [sBTPkmnPrevTrainer3] ld [sBTPkmnPrevPrevTrainer3], a - ld a, [BT_OTPkmn1] + ld a, [wBT_OTPkmn1] ld [sBTPkmnPrevTrainer1], a - ld a, [BT_OTPkmn2] + ld a, [wBT_OTPkmn2] ld [sBTPkmnPrevTrainer2], a - ld a, [BT_OTPkmn3] + ld a, [wBT_OTPkmn3] ld [sBTPkmnPrevTrainer3], a call CloseSRAM ret diff --git a/engine/events/battle_tower/rules.asm b/engine/events/battle_tower/rules.asm index 0e994c27e..fc9fa948a 100644 --- a/engine/events/battle_tower/rules.asm +++ b/engine/events/battle_tower/rules.asm @@ -30,7 +30,7 @@ CheckForMobileBattleRules: ; 8b1e1 ; 0x8b201 CheckForBattleTowerRules: ; 8b201 - ld hl, StringBuffer2 + ld hl, wStringBuffer2 ld [hl], "3" inc hl ld [hl], "@" @@ -212,13 +212,13 @@ BattleTower_ExecuteJumptable: ; 8b25b ; 8b2bb BattleTower_CheckPartyLengthIs3: ; 8b2bb - ld a, [PartyCount] + ld a, [wPartyCount] cp BATTLETOWER_PARTY_LENGTH ret ; 8b2c1 BattleTower_CheckPartyHasThreeMonsThatAreNotEggs: ; 8b2c1 - ld hl, PartyCount + ld hl, wPartyCount ld a, [hli] ld b, $0 ld c, a @@ -231,7 +231,7 @@ BattleTower_CheckPartyHasThreeMonsThatAreNotEggs: ; 8b2c1 .egg dec c jr nz, .loop - ld a, [PartyCount] + ld a, [wPartyCount] cp b ret z ld a, b @@ -240,7 +240,7 @@ BattleTower_CheckPartyHasThreeMonsThatAreNotEggs: ; 8b2c1 ; 8b2da Function_PartyCountEq3: ; 8b2da - ld a, [PartyCount] + ld a, [wPartyCount] cp BATTLETOWER_PARTY_LENGTH ret z scf @@ -248,13 +248,13 @@ Function_PartyCountEq3: ; 8b2da ; 8b2e2 Function_PartySpeciesAreUnique: ; 8b2e2 - ld hl, PartyMon1Species + ld hl, wPartyMon1Species call VerifyUniqueness ret ; 8b2e9 VerifyUniqueness: ; 8b2e9 - ld de, PartyCount + ld de, wPartyCount ld a, [de] inc de dec a @@ -318,13 +318,13 @@ VerifyUniqueness: ; 8b2e9 ; 8b32a Function_PartyItemsAreUnique: ; 8b32a - ld hl, PartyMon1Item + ld hl, wPartyMon1Item call VerifyUniqueness ret ; 8b331 Function_HasPartyAnEgg: ; 8b331 - ld hl, PartyCount + ld hl, wPartyCount ld a, [hli] ld c, a .loop diff --git a/engine/events/battle_tower/trainer_text.asm b/engine/events/battle_tower/trainer_text.asm index 96c91caa9..c4bcedf64 100755 --- a/engine/events/battle_tower/trainer_text.asm +++ b/engine/events/battle_tower/trainer_text.asm @@ -1,14 +1,14 @@ BattleTowerText:: ; 11c000 -; Print text c for trainer [BT_OTTrainerClass] +; Print text c for trainer [wBT_OTTrainerClass] ; 1: Intro text ; 2: Player lost ; 3: Player won ld a, [rSVBK] push af - ld a, BANK(BT_OTTrainerClass) + ld a, BANK(wBT_OTTrainerClass) ld [rSVBK], a if DEF(_CRYSTAL11) - ld hl, BT_OTTrainerClass + ld hl, wBT_OTTrainerClass else ; BUG ALERT ; Instead of loading the Trainer Class, this routine @@ -16,7 +16,7 @@ else ; uses it to get the gender of the trainer. ; As a consequence, the enemy trainer's dialog will ; always be sampled from the female array. - ld hl, BT_OTName + NAME_LENGTH_JAPANESE - 1 + ld hl, wBT_OTName + NAME_LENGTH_JAPANESE - 1 endc ld a, [hl] dec a @@ -53,11 +53,11 @@ endc ld b, 0 dec c jr nz, .restore - ld [BT_TrainerTextIndex], a + ld [wBT_TrainerTextIndex], a jr .okay2 .restore - ld a, [BT_TrainerTextIndex] + ld a, [wBT_TrainerTextIndex] .okay2 push af diff --git a/engine/events/buena.asm b/engine/events/buena.asm index d5a80ef2e..1991d6a86 100644 --- a/engine/events/buena.asm +++ b/engine/events/buena.asm @@ -14,7 +14,7 @@ Special_BuenasPassword: ; 8af6b call DoNthMenu ; menu farcall Buena_ExitMenu ld b, $0 - ld a, [MenuSelection] + ld a, [wMenuSelection] ld c, a ld a, [wBuenasPassword] maskbits NUM_PASSWORDS_PER_CATEGORY @@ -24,7 +24,7 @@ Special_BuenasPassword: ; 8af6b .wrong ld a, b - ld [ScriptVar], a + ld [wScriptVar], a ret ; 8afa9 @@ -58,7 +58,7 @@ endr ld a, [wBuenasPassword] and $f0 ld c, a - ld a, [MenuSelection] + ld a, [wMenuSelection] add c ld c, a farcall GetBuenasPassword @@ -71,7 +71,7 @@ Special_BuenaPrize: ; 8afd4 xor a ld [wMenuScrollPosition], a ld a, $1 - ld [MenuSelection], a + ld [wMenuSelection], a call Buena_PlacePrizeMenuBox call Buena_DisplayBlueCardBalance ld hl, .Text_AskWhichPrize @@ -88,7 +88,7 @@ Special_BuenaPrize: ; 8afd4 call PrintBlueCardBalance call Buena_PrizeMenu jr z, .done - ld [MenuSelectionQuantity], a + ld [wMenuSelectionQuantity], a call Buena_getprize ld a, [hl] ld [wNamedObjectIndexBuffer], a @@ -98,7 +98,7 @@ Special_BuenaPrize: ; 8afd4 call YesNoBox jr c, .loop - ld a, [MenuSelectionQuantity] + ld a, [wMenuSelectionQuantity] call Buena_getprize inc hl ld a, [hld] @@ -109,10 +109,10 @@ Special_BuenaPrize: ; 8afd4 ld a, [hli] push hl - ld [CurItem], a + ld [wCurItem], a ld a, $1 ld [wItemQuantityChangeBuffer], a - ld hl, NumItems + ld hl, wNumItems call ReceiveItem pop hl jr nc, .BagFull @@ -246,7 +246,7 @@ Buena_PlacePrizeMenuBox: ; 8b0d6 Buena_PrizeMenu: ; 8b0e2 ld hl, .MenuDataHeader call CopyMenuDataHeader - ld a, [MenuSelection] + ld a, [wMenuSelection] ld [wMenuCursorBuffer], a xor a ld [wWhichIndexSet], a @@ -254,10 +254,10 @@ Buena_PrizeMenu: ; 8b0e2 call InitScrollingMenu call UpdateSprites call ScrollingMenu - ld a, [MenuSelection] + ld a, [wMenuSelection] ld c, a ld a, [wMenuCursorY] - ld [MenuSelection], a + ld [wMenuSelection], a ld a, [wMenuJoypad] cp $2 jr z, .cancel @@ -301,7 +301,7 @@ endr ; 8b134 .prizeitem ; 8b134 - ld a, [MenuSelection] + ld a, [wMenuSelection] call Buena_getprize ld a, [hl] push de @@ -313,7 +313,7 @@ endr ; 8b147 .prizepoints ; 8b147 - ld a, [MenuSelection] + ld a, [wMenuSelection] call Buena_getprize inc hl ld a, [hl] diff --git a/engine/events/buena_menu.asm b/engine/events/buena_menu.asm index cf6fecf72..047d1e7e3 100644 --- a/engine/events/buena_menu.asm +++ b/engine/events/buena_menu.asm @@ -5,7 +5,7 @@ Special_AskRememberPassword: ; 4ae12 ld a, $1 .okay - ld [ScriptVar], a + ld [wScriptVar], a ret .DoMenu: ; 4ae1f diff --git a/engine/events/bug_contest/caught_mon.asm b/engine/events/bug_contest/caught_mon.asm index 5d423f466..4bad01829 100644 --- a/engine/events/bug_contest/caught_mon.asm +++ b/engine/events/bug_contest/caught_mon.asm @@ -11,7 +11,7 @@ BugContest_SetCaughtContestMon: ; e6ce .firstcatch call .generatestats - ld a, [TempEnemyMonSpecies] + ld a, [wTempEnemyMonSpecies] ld [wd265], a call GetPokemonName ld hl, .caughttext @@ -19,16 +19,16 @@ BugContest_SetCaughtContestMon: ; e6ce ret .generatestats ; e6fd - ld a, [TempEnemyMonSpecies] - ld [CurSpecies], a - ld [CurPartySpecies], a + ld a, [wTempEnemyMonSpecies] + ld [wCurSpecies], a + ld [wCurPartySpecies], a call GetBaseData xor a ld bc, PARTYMON_STRUCT_LENGTH ld hl, wContestMon call ByteFill xor a - ld [MonType], a + ld [wMonType], a ld hl, wContestMon jp GeneratePartyMonStats diff --git a/engine/events/bug_contest/contest_2.asm b/engine/events/bug_contest/contest_2.asm index 7ade44815..8913dee6f 100755 --- a/engine/events/bug_contest/contest_2.asm +++ b/engine/events/bug_contest/contest_2.asm @@ -77,12 +77,12 @@ Special_CheckBugContestContestantFlag: ; 139ed INCLUDE "data/bug_contest_flags.asm" Special_ContestDropOffMons: ; 13a12 - ld hl, PartyMon1HP + ld hl, wPartyMon1HP ld a, [hli] or [hl] jr z, .fainted ; Mask the rest of your party by setting the count to 1... - ld hl, PartyCount + ld hl, wPartyCount ld a, 1 ld [hli], a inc hl @@ -92,18 +92,18 @@ Special_ContestDropOffMons: ; 13a12 ; ... and replacing it with the terminator byte ld [hl], -1 xor a - ld [ScriptVar], a + ld [wScriptVar], a ret .fainted ld a, $1 - ld [ScriptVar], a + ld [wScriptVar], a ret ; 13a31 Special_ContestReturnMons: ; 13a31 ; Restore the species of the second mon. - ld hl, PartySpecies + 1 + ld hl, wPartySpecies + 1 ld a, [wBugContestSecondPartySpecies] ld [hl], a ; Restore the party count, which must be recomputed. @@ -117,6 +117,6 @@ Special_ContestReturnMons: ; 13a31 .done ld a, b - ld [PartyCount], a + ld [wPartyCount], a ret ; 13a47 diff --git a/engine/events/bug_contest/display_stats.asm b/engine/events/bug_contest/display_stats.asm index 92b89a38f..13b90d0a3 100644 --- a/engine/events/bug_contest/display_stats.asm +++ b/engine/events/bug_contest/display_stats.asm @@ -4,7 +4,7 @@ DisplayCaughtContestMonStats: ; cc000 call ClearSprites call LoadFontsBattleExtra - ld hl, Options + ld hl, wOptions ld a, [hl] push af set 4, [hl] @@ -38,24 +38,24 @@ DisplayCaughtContestMonStats: ; cc000 ld a, [wContestMon] ld [wd265], a call GetPokemonName - ld de, StringBuffer1 + ld de, wStringBuffer1 hlcoord 1, 2 call PlaceString ld h, b ld l, c ld a, [wContestMonLevel] - ld [TempMonLevel], a + ld [wTempMonLevel], a call PrintLevel - ld de, EnemyMonNick + ld de, wEnemyMonNick hlcoord 1, 8 call PlaceString ld h, b ld l, c - ld a, [EnemyMonLevel] - ld [TempMonLevel], a + ld a, [wEnemyMonLevel] + ld [wTempMonLevel], a call PrintLevel hlcoord 11, 4 @@ -64,14 +64,14 @@ DisplayCaughtContestMonStats: ; cc000 call PrintNum hlcoord 11, 10 - ld de, EnemyMonMaxHP + ld de, wEnemyMonMaxHP call PrintNum ld hl, SwitchMonText call PrintText pop af - ld [Options], a + ld [wOptions], a call WaitBGMap ld b, SCGB_DIPLOMA diff --git a/engine/events/bug_contest/judging.asm b/engine/events/bug_contest/judging.asm index a8cb80efe..c63087397 100755 --- a/engine/events/bug_contest/judging.asm +++ b/engine/events/bug_contest/judging.asm @@ -97,7 +97,7 @@ LoadContestantName: ; 13730 push bc ; Get the Trainer Class name and copy it into wBugContestWinnerName. callfar GetTrainerClassName - ld hl, StringBuffer1 + ld hl, wStringBuffer1 ld de, wBugContestWinnerName ld bc, TRAINER_CLASS_NAME_LENGTH call CopyBytes @@ -121,13 +121,13 @@ LoadContestantName: ; 13730 ld b, a callfar GetTrainerName ; Append the name to wBugContestWinnerName. - ld hl, StringBuffer1 + ld hl, wStringBuffer1 pop de ld bc, NAME_LENGTH - 1 jp CopyBytes .player - ld hl, PlayerName + ld hl, wPlayerName ld de, wBugContestWinnerName ld bc, NAME_LENGTH jp CopyBytes diff --git a/engine/events/card_key.asm b/engine/events/card_key.asm index dc4c73ad2..0f0b0ff33 100755 --- a/engine/events/card_key.asm +++ b/engine/events/card_key.asm @@ -1,14 +1,14 @@ _CardKey: ; 50779 ; Are we even in the right map to use this? - ld a, [MapGroup] + ld a, [wMapGroup] cp GROUP_RADIO_TOWER_3F jr nz, .nope - ld a, [MapNumber] + ld a, [wMapNumber] cp MAP_RADIO_TOWER_3F jr nz, .nope ; Are we facing the slot? - ld a, [PlayerDirection] + ld a, [wPlayerDirection] and %1100 cp OW_UP jr nz, .nope diff --git a/engine/events/catch_tutorial.asm b/engine/events/catch_tutorial.asm index b9352ccd6..6ae3b4a3b 100644 --- a/engine/events/catch_tutorial.asm +++ b/engine/events/catch_tutorial.asm @@ -1,5 +1,5 @@ CatchTutorial:: ; 4e554 - ld a, [BattleType] + ld a, [wBattleType] dec a ld c, a ld hl, .dw @@ -18,13 +18,13 @@ CatchTutorial:: ; 4e554 .DudeTutorial: ; 4e56a (13:656a) ; Back up your name to your Mom's name. - ld hl, PlayerName - ld de, MomsName + ld hl, wPlayerName + ld de, wMomsName ld bc, NAME_LENGTH call CopyBytes ; Copy Dude's name to your name ld hl, .Dude - ld de, PlayerName + ld de, wPlayerName ld bc, NAME_LENGTH call CopyBytes @@ -33,11 +33,11 @@ CatchTutorial:: ; 4e554 xor a ld [hJoyDown], a ld [hJoyPressed], a - ld a, [Options] + ld a, [wOptions] push af and $f8 add $3 - ld [Options], a + ld [wOptions], a ld hl, .AutoInput ld a, BANK(.AutoInput) call StartAutoInput @@ -45,9 +45,9 @@ CatchTutorial:: ; 4e554 call StopAutoInput pop af - ld [Options], a - ld hl, MomsName - ld de, PlayerName + ld [wOptions], a + ld hl, wMomsName + ld de, wPlayerName ld bc, NAME_LENGTH call CopyBytes ret diff --git a/engine/events/celebi.asm b/engine/events/celebi.asm index 81565c27e..fe4a490f2 100755 --- a/engine/events/celebi.asm +++ b/engine/events/celebi.asm @@ -2,10 +2,10 @@ SPECIALCELEBIEVENT_CELEBI EQU $84 Special_CelebiShrineEvent: ; 4989a call DelayFrame - ld a, [VramState] + ld a, [wVramState] push af xor a - ld [VramState], a + ld [wVramState], a call LoadCelebiGFX depixel 0, 10, 7, 0 ld a, SPRITE_ANIM_INDEX_CELEBI @@ -44,7 +44,7 @@ Special_CelebiShrineEvent: ; 4989a .done pop af - ld [VramState], a + ld [wVramState], a call .RestorePlayerSprite_DespawnLeaves call CelebiEvent_SetBattleType ret @@ -52,7 +52,7 @@ Special_CelebiShrineEvent: ; 4989a ; 498f9 .RestorePlayerSprite_DespawnLeaves: ; 498f9 - ld hl, Sprite01TileID + ld hl, wVirtualOAMSprite00TileID xor a ld c, 4 .OAMloop: @@ -63,8 +63,8 @@ endr inc a dec c jr nz, .OAMloop - ld hl, Sprite05 - ld bc, SpritesEnd - Sprite05 + ld hl, wVirtualOAMSprite04 + ld bc, wVirtualOAMEnd - wVirtualOAMSprite04 xor a call ByteFill ret @@ -357,7 +357,7 @@ GetCelebiSpriteTile: ; 49bae CelebiEvent_SetBattleType: ; 49bf3 ld a, BATTLETYPE_CELEBI - ld [BattleType], a + ld [wBattleType], a ret ; 49bf9 @@ -367,13 +367,13 @@ Special_CheckCaughtCelebi: ; 49bf9 bit 6, a jr z, .false ld a, $1 - ld [ScriptVar], a + ld [wScriptVar], a jr .done .false xor a - ld [ScriptVar], a + ld [wScriptVar], a .done ret diff --git a/engine/events/checkforhiddenitems.asm b/engine/events/checkforhiddenitems.asm index 3cad2b821..7396bd39a 100644 --- a/engine/events/checkforhiddenitems.asm +++ b/engine/events/checkforhiddenitems.asm @@ -1,14 +1,14 @@ CheckForHiddenItems: ; b8172 ; Checks to see if there are hidden items on the screen that have not yet been found. If it finds one, returns carry. call GetMapScriptsBank - ld [Buffer1], a -; Get the coordinate of the bottom right corner of the screen, and load it in Buffer3/Buffer4. - ld a, [XCoord] + ld [wBuffer1], a +; Get the coordinate of the bottom right corner of the screen, and load it in wBuffer3/wBuffer4. + ld a, [wXCoord] add SCREEN_WIDTH / 4 - ld [Buffer4], a - ld a, [YCoord] + ld [wBuffer4], a + ld a, [wYCoord] add SCREEN_HEIGHT / 4 - ld [Buffer3], a + ld [wBuffer3], a ; Get the pointer for the first bg_event in the map... ld hl, wCurrMapBGEventsPointer ld a, [hli] @@ -20,14 +20,14 @@ CheckForHiddenItems: ; b8172 jr z, .nobgeventitems ; For i = 1:wCurrMapBGEventCount... .loop -; Store the counter in Buffer2, and store the bg_event pointer in the stack. - ld [Buffer2], a +; Store the counter in wBuffer2, and store the bg_event pointer in the stack. + ld [wBuffer2], a push hl ; Get the Y coordinate of the BG event. call .GetFarByte ld e, a ; Is the Y coordinate of the BG event on the screen? If not, go to the next BG event. - ld a, [Buffer3] + ld a, [wBuffer3] sub e jr c, .next cp SCREEN_HEIGHT / 2 @@ -35,7 +35,7 @@ CheckForHiddenItems: ; b8172 ; Is the X coordinate of the BG event on the screen? If not, go to the next BG event. call .GetFarByte ld d, a - ld a, [Buffer4] + ld a, [wBuffer4] sub d jr c, .next cp SCREEN_WIDTH / 2 @@ -45,9 +45,9 @@ CheckForHiddenItems: ; b8172 cp BGEVENT_ITEM jr nz, .next ; Has this item already been found? If not, set off the Itemfinder. - ld a, [Buffer1] + ld a, [wBuffer1] call GetFarHalfword - ld a, [Buffer1] + ld a, [wBuffer1] call GetFarHalfword ld d, h ld e, l @@ -63,7 +63,7 @@ CheckForHiddenItems: ; b8172 ld bc, 5 add hl, bc ; Restore the BG event counter and decrement it. If it hits zero, there are no hidden items in range. - ld a, [Buffer2] + ld a, [wBuffer2] dec a jr nz, .loop @@ -78,7 +78,7 @@ CheckForHiddenItems: ; b8172 ; b81e2 .GetFarByte: ; b81e2 - ld a, [Buffer1] + ld a, [wBuffer1] call GetFarByte inc hl ret diff --git a/engine/events/daycare.asm b/engine/events/daycare.asm index f65464a8d..3d36bbfd7 100755 --- a/engine/events/daycare.asm +++ b/engine/events/daycare.asm @@ -119,7 +119,7 @@ DayCareManIntroText: ; 1678f ; 16798 DayCareAskDepositPokemon: ; 16798 - ld a, [PartyCount] + ld a, [wPartyCount] cp 2 jr c, .OnlyOneMon ld a, DAYCARETEXT_WHICH_ONE @@ -127,20 +127,20 @@ DayCareAskDepositPokemon: ; 16798 ld b, PARTYMENUACTION_GIVE_MON farcall SelectTradeOrDayCareMon jr c, .Declined - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] cp EGG jr z, .Egg farcall CheckCurPartyMonFainted jr c, .OutOfUsableMons - ld hl, PartyMon1Item + ld hl, wPartyMon1Item ld bc, PARTYMON_STRUCT_LENGTH - ld a, [CurPartyMon] + ld a, [wCurPartyMon] call AddNTimes ld d, [hl] farcall ItemIsMail jr c, .HoldingMail - ld hl, PartyMonNicknames - ld a, [CurPartyMon] + ld hl, wPartyMonNicknames + ld a, [wCurPartyMon] call GetNick and a ret @@ -180,7 +180,7 @@ DayCareAskDepositPokemon: ; 16798 DayCare_DepositPokemonText: ; 167f6 ld a, DAYCARETEXT_DEPOSIT call PrintDayCareText - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] call PlayMonCry ld a, DAYCARETEXT_COME_BACK_LATER call PrintDayCareText @@ -188,7 +188,7 @@ DayCare_DepositPokemonText: ; 167f6 ; 16807 DayCare_AskWithdrawBreedMon: ; 16807 - ld a, [StringBuffer2 + 1] + ld a, [wStringBuffer2 + 1] and a jr nz, .grew_at_least_one_level ld a, DAYCARETEXT_TOO_SOON @@ -208,11 +208,11 @@ DayCare_AskWithdrawBreedMon: ; 16807 jr c, .refused .check_money - ld de, Money - ld bc, StringBuffer2 + 2 + ld de, wMoney + ld bc, wStringBuffer2 + 2 farcall CompareMoney jr c, .not_enough_money - ld a, [PartyCount] + ld a, [wPartyCount] cp PARTY_LENGTH jr nc, .PartyFull and a @@ -235,12 +235,12 @@ DayCare_AskWithdrawBreedMon: ; 16807 ; 16850 DayCare_GetBackMonForMoney: ; 16850 - ld bc, StringBuffer2 + 2 - ld de, Money + ld bc, wStringBuffer2 + 2 + ld de, wMoney farcall TakeMoney ld a, DAYCARETEXT_WITHDRAW call PrintDayCareText - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] call PlayMonCry ld a, DAYCARETEXT_GOT_BACK call PrintDayCareText @@ -249,24 +249,24 @@ DayCare_GetBackMonForMoney: ; 16850 GetPriceToRetrieveBreedmon: ; 1686d ld a, b - ld [StringBuffer2], a + ld [wStringBuffer2], a ld a, d - ld [StringBuffer2 + 1], a - ld de, StringBuffer1 + ld [wStringBuffer2 + 1], a + ld de, wStringBuffer1 ld bc, NAME_LENGTH call CopyBytes ld hl, 0 ld bc, 100 - ld a, [StringBuffer2 + 1] + ld a, [wStringBuffer2 + 1] call AddNTimes ld de, 100 add hl, de xor a - ld [StringBuffer2 + 2], a + ld [wStringBuffer2 + 2], a ld a, h - ld [StringBuffer2 + 3], a + ld [wStringBuffer2 + 3], a ld a, l - ld [StringBuffer2 + 4], a + ld [wStringBuffer2 + 4], a ret ; 1689b @@ -446,7 +446,7 @@ Special_DayCareManOutside: ; 16936 call PrintText call YesNoBox jr c, .Declined - ld a, [PartyCount] + ld a, [wPartyCount] cp PARTY_LENGTH jr nc, .PartyFull call DayCare_GiveEgg @@ -468,14 +468,14 @@ Special_DayCareManOutside: ; 16936 .Load0: call PrintText xor a ; FALSE - ld [ScriptVar], a + ld [wScriptVar], a ret .PartyFull: ld hl, .PartyFullText call PrintText ld a, TRUE - ld [ScriptVar], a + ld [wScriptVar], a ret ; 16993 @@ -511,8 +511,8 @@ Special_DayCareManOutside: ; 16936 DayCare_GiveEgg: ; 169ac ld a, [wEggMonLevel] - ld [CurPartyLevel], a - ld hl, PartyCount + ld [wCurPartyLevel], a + ld hl, wPartyCount ld a, [hl] cp PARTY_LENGTH jr nc, .PartyFull @@ -525,24 +525,24 @@ DayCare_GiveEgg: ; 169ac ld a, EGG ld [hli], a ld a, [wEggMonSpecies] - ld [CurSpecies], a - ld [CurPartySpecies], a + ld [wCurSpecies], a + ld [wCurPartySpecies], a ld a, -1 ld [hl], a - ld hl, PartyMonNicknames + ld hl, wPartyMonNicknames ld bc, MON_NAME_LENGTH call DayCare_GetCurrentPartyMember ld hl, wEggNick call CopyBytes - ld hl, PartyMonOT + ld hl, wPartyMonOT ld bc, NAME_LENGTH call DayCare_GetCurrentPartyMember ld hl, wEggOT call CopyBytes - ld hl, PartyMon1 + ld hl, wPartyMon1 ld bc, PARTYMON_STRUCT_LENGTH call DayCare_GetCurrentPartyMember ld hl, wEggMon @@ -550,9 +550,9 @@ DayCare_GiveEgg: ; 169ac call CopyBytes call GetBaseData - ld a, [PartyCount] + ld a, [wPartyCount] dec a - ld hl, PartyMon1 + ld hl, wPartyMon1 ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes ld b, h @@ -583,7 +583,7 @@ DayCare_GiveEgg: ; 169ac ; 16a31 DayCare_GetCurrentPartyMember: ; 16a31 - ld a, [PartyCount] + ld a, [wPartyCount] dec a call AddNTimes ld d, h @@ -626,13 +626,13 @@ DayCare_InitBreeding: ; 16a3b ld bc, NAME_LENGTH call ByteFill ld a, [wBreedMon1DVs] - ld [TempMonDVs], a + ld [wTempMonDVs], a ld a, [wBreedMon1DVs + 1] - ld [TempMonDVs + 1], a + ld [wTempMonDVs + 1], a ld a, [wBreedMon1Species] - ld [CurPartySpecies], a + ld [wCurPartySpecies], a ld a, $3 - ld [MonType], a + ld [wMonType], a ld a, [wBreedMon1Species] cp DITTO ld a, $1 @@ -654,13 +654,13 @@ DayCare_InitBreeding: ; 16a3b ld a, [wBreedMon2Species] .GotMother: - ld [CurPartySpecies], a + ld [wCurPartySpecies], a callfar GetPreEvolution callfar GetPreEvolution ld a, EGG_LEVEL - ld [CurPartyLevel], a + ld [wCurPartyLevel], a - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] cp NIDORAN_F jr nz, .GotEggSpecies call Random @@ -669,15 +669,15 @@ DayCare_InitBreeding: ; 16a3b jr c, .GotEggSpecies ld a, NIDORAN_M .GotEggSpecies: - ld [CurPartySpecies], a - ld [CurSpecies], a + ld [wCurPartySpecies], a + ld [wCurSpecies], a ld [wEggMonSpecies], a call GetBaseData ld hl, wEggNick ld de, .String_EGG call CopyName2 - ld hl, PlayerName + ld hl, wPlayerName ld de, wEggOT ld bc, NAME_LENGTH call CopyBytes @@ -685,15 +685,15 @@ DayCare_InitBreeding: ; 16a3b ld [wEggMonItem], a ld de, wEggMonMoves xor a - ld [Buffer1], a + ld [wBuffer1], a predef FillMoves farcall InitEggMoves ld hl, wEggMonID - ld a, [PlayerID] + ld a, [wPlayerID] ld [hli], a - ld a, [PlayerID + 1] + ld a, [wPlayerID + 1] ld [hl], a - ld a, [CurPartyLevel] + ld a, [wCurPartyLevel] ld d, a callfar CalcExpAtLevel ld hl, wEggMonExp @@ -713,10 +713,10 @@ DayCare_InitBreeding: ; 16a3b ld hl, wEggMonDVs call Random ld [hli], a - ld [TempMonDVs], a + ld [wTempMonDVs], a call Random ld [hld], a - ld [TempMonDVs + 1], a + ld [wTempMonDVs + 1], a ld de, wBreedMon1DVs ld a, [wBreedMon1Species] cp DITTO @@ -726,7 +726,7 @@ DayCare_InitBreeding: ; 16a3b cp DITTO jr z, .GotDVs ld a, TEMPMON - ld [MonType], a + ld [wMonType], a push hl farcall GetGender pop hl @@ -766,7 +766,7 @@ DayCare_InitBreeding: ; 16a3b ld [hl], a .SkipDVs: - ld hl, StringBuffer1 + ld hl, wStringBuffer1 ld de, wMonOrItemNameBuffer ld bc, NAME_LENGTH call CopyBytes @@ -774,17 +774,17 @@ DayCare_InitBreeding: ; 16a3b ld de, wEggMonPP predef FillPP ld hl, wMonOrItemNameBuffer - ld de, StringBuffer1 + ld de, wStringBuffer1 ld bc, NAME_LENGTH call CopyBytes - ld a, [BaseEggSteps] + ld a, [wBaseEggSteps] ld hl, wEggMonHappiness ld [hli], a xor a ld [hli], a ld [hli], a ld [hl], a - ld a, [CurPartyLevel] + ld a, [wCurPartyLevel] ld [wEggMonLevel], a ret ; 16be0 diff --git a/engine/events/dratini.asm b/engine/events/dratini.asm index 83732bef2..a45f01195 100644 --- a/engine/events/dratini.asm +++ b/engine/events/dratini.asm @@ -1,12 +1,12 @@ Special_Dratini: ; 0x8b170 -; if ScriptVar is 0 or 1, change the moveset of the last Dratini in the party. +; if wScriptVar is 0 or 1, change the moveset of the last Dratini in the party. ; 0: give it a special moveset with Extremespeed. ; 1: give it the normal moveset of a level 15 Dratini. - ld a, [ScriptVar] + ld a, [wScriptVar] cp $2 ret nc - ld bc, PartyCount + ld bc, wPartyCount ld a, [bc] ld hl, MON_SPECIES call .GetNthPartyMon @@ -30,7 +30,7 @@ Special_Dratini: ; 0x8b170 .GiveMoveset: push hl - ld a, [ScriptVar] + ld a, [wScriptVar] ld hl, .Movesets ld bc, .Moveset1 - .Moveset0 call AddNTimes @@ -93,7 +93,7 @@ Special_Dratini: ; 0x8b170 ; returns the address of the last Pokémon in the party in hl. ; sets carry if a is 0. - ld de, PartyMon1 + ld de, wPartyMon1 add hl, de and a jr z, .EmptyParty diff --git a/engine/events/elevator.asm b/engine/events/elevator.asm index e0426c5bd..98d408b0e 100755 --- a/engine/events/elevator.asm +++ b/engine/events/elevator.asm @@ -29,7 +29,7 @@ Elevator:: ; 1342d ; 1345a .LoadFloors: ; 1345a - ld de, CurElevator + ld de, wCurElevator ld bc, 4 ld hl, wElevatorPointer ld a, [hli] @@ -60,9 +60,9 @@ Elevator:: ; 1342d call GetFarByte ld c, a inc hl - ld a, [BackupMapGroup] + ld a, [wBackupMapGroup] ld d, a - ld a, [BackupMapNumber] + ld a, [wBackupMapNumber] ld e, a ld b, 0 .loop2 @@ -111,7 +111,7 @@ Elevator_GoToFloor: ; 134c0 ld bc, 4 call AddNTimes inc hl - ld de, BackupWarpNumber + ld de, wBackupWarpNumber ld a, [wElevatorPointerBank] ld bc, 3 call FarCopyBytes @@ -151,7 +151,7 @@ Elevator_WhichFloorText: ; 0x1350d Elevator_GetCurrentFloorText: ; 13512 - ld hl, Options + ld hl, wOptions ld a, [hl] push af set NO_TEXT_SCROLL, [hl] @@ -165,7 +165,7 @@ Elevator_GetCurrentFloorText: ; 13512 hlcoord 4, 4 call Elevator_GetCurrentFloorString pop af - ld [Options], a + ld [wOptions], a ret ; 13537 @@ -179,7 +179,7 @@ Elevator_GetCurrentFloorString: ; 1353f ld a, [wElevatorOriginFloor] ld e, a ld d, 0 - ld hl, CurElevatorFloors + ld hl, wCurElevatorFloors add hl, de ld a, [hl] pop de @@ -198,14 +198,14 @@ Elevator_MenuData2: ; 0x13558 db SCROLLINGMENU_DISPLAY_ARROWS ; flags db 4, 0 ; rows, columns db 1 ; horizontal spacing - dbw 0, CurElevator + dbw 0, wCurElevator dba GetElevatorFloorStrings dba NULL dba NULL ; 13568 GetElevatorFloorStrings: ; 13568 - ld a, [MenuSelection] + ld a, [wMenuSelection] GetFloorString: ; 1356b push de call FloorToString diff --git a/engine/events/field_moves.asm b/engine/events/field_moves.asm index 3fb1fe9e6..0f12338e0 100755 --- a/engine/events/field_moves.asm +++ b/engine/events/field_moves.asm @@ -62,8 +62,8 @@ ShakeHeadbuttTree: ; 8c80a xor a ld [hBGMapMode], a farcall ClearSpriteAnims - ld hl, Sprite37 - ld bc, SpritesEnd - Sprite37 + ld hl, wVirtualOAMSprite36 + ld bc, wVirtualOAMEnd - wVirtualOAMSprite36 xor a call ByteFill ld de, Font @@ -81,7 +81,7 @@ INCBIN "gfx/overworld/headbutt_tree.2bpp" HideHeadbuttTree: ; 8c913 xor a ld [hBGMapMode], a - ld a, [PlayerDirection] + ld a, [wPlayerDirection] and %00001100 srl a ld e, a @@ -262,7 +262,7 @@ Cut_GetLeafSpawnCoords: ; 8ca8e (23:4a8e) jr z, .top_side set 1, e .top_side - ld a, [PlayerDirection] + ld a, [wPlayerDirection] and %00001100 add e ld e, a @@ -298,7 +298,7 @@ Cut_GetLeafSpawnCoords: ; 8ca8e (23:4a8e) ; 8cad3 Cut_Headbutt_GetPixelFacing: ; 8cad3 (23:4ad3) - ld a, [PlayerDirection] + ld a, [wPlayerDirection] and %00001100 srl a ld e, a @@ -321,10 +321,10 @@ Cut_Headbutt_GetPixelFacing: ; 8cad3 (23:4ad3) FlyFromAnim: ; 8caed call DelayFrame - ld a, [VramState] + ld a, [wVramState] push af xor a - ld [VramState], a + ld [wVramState], a call FlyFunction_InitGFX depixel 10, 10, 4, 0 ld a, SPRITE_ANIM_INDEX_RED_WALK @@ -350,16 +350,16 @@ FlyFromAnim: ; 8caed .exit pop af - ld [VramState], a + ld [wVramState], a ret ; 8cb33 FlyToAnim: ; 8cb33 call DelayFrame - ld a, [VramState] + ld a, [wVramState] push af xor a - ld [VramState], a + ld [wVramState], a call FlyFunction_InitGFX depixel 31, 10, 4, 0 ld a, SPRITE_ANIM_INDEX_RED_WALK @@ -388,12 +388,12 @@ FlyToAnim: ; 8cb33 .exit pop af - ld [VramState], a + ld [wVramState], a call .RestorePlayerSprite_DespawnLeaves ret .RestorePlayerSprite_DespawnLeaves: ; 8cb82 (23:4b82) - ld hl, Sprite01TileID + ld hl, wVirtualOAMSprite00TileID xor a ld c, 4 .OAMloop @@ -404,8 +404,8 @@ endr inc a dec c jr nz, .OAMloop - ld hl, Sprite05 - ld bc, SpritesEnd - Sprite05 + ld hl, wVirtualOAMSprite04 + ld bc, wVirtualOAMEnd - wVirtualOAMSprite04 xor a call ByteFill ret @@ -416,8 +416,8 @@ FlyFunction_InitGFX: ; 8cb9b (23:4b9b) ld hl, vTiles1 tile $00 lb bc, BANK(CutGrassGFX), 4 call Request2bpp - ld a, [CurPartyMon] - ld hl, PartySpecies + ld a, [wCurPartyMon] + ld hl, wPartySpecies ld e, a ld d, 0 add hl, de diff --git a/engine/events/fish.asm b/engine/events/fish.asm index 39644847d..d79ac0a43 100644 --- a/engine/events/fish.asm +++ b/engine/events/fish.asm @@ -79,7 +79,7 @@ rept 4 add hl, de endr - ld a, [TimeOfDay] + ld a, [wTimeOfDay] maskbits NUM_DAYTIMES cp NITE_F jr c, .time_species diff --git a/engine/events/fruit_trees.asm b/engine/events/fruit_trees.asm index 44f2315a0..796880175 100644 --- a/engine/events/fruit_trees.asm +++ b/engine/events/fruit_trees.asm @@ -1,7 +1,7 @@ FruitTreeScript:: ; 44000 callasm GetCurTreeFruit opentext - copybytetovar CurFruit + copybytetovar wCurFruit itemtotext USE_SCRIPT_VAR, MEM_BUFFER_0 writetext FruitBearingTreeText buttonsound @@ -14,7 +14,7 @@ FruitTreeScript:: ; 44000 .fruit writetext HeyItsFruitText - copybytetovar CurFruit + copybytetovar wCurFruit giveitem ITEM_FROM_MEM iffalse .packisfull buttonsound @@ -35,10 +35,10 @@ FruitTreeScript:: ; 44000 ; 44041 GetCurTreeFruit: ; 44041 - ld a, [CurFruitTree] + ld a, [wCurFruitTree] dec a call GetFruitTreeItem - ld [CurFruit], a + ld [wCurFruit], a ret ; 4404c @@ -53,7 +53,7 @@ CheckFruitTree: ; 44055 ld b, 2 call GetFruitTreeFlag ld a, c - ld [ScriptVar], a + ld [wScriptVar], a ret ; 4405f @@ -65,7 +65,7 @@ PickedFruitTree: ; 4405f ResetFruitTrees: ; 4406a xor a - ld hl, FruitTreeFlags + ld hl, wFruitTreeFlags ld [hli], a ld [hli], a ld [hli], a @@ -78,11 +78,11 @@ ResetFruitTrees: ; 4406a GetFruitTreeFlag: ; 44078 push hl push de - ld a, [CurFruitTree] + ld a, [wCurFruitTree] dec a ld e, a ld d, 0 - ld hl, FruitTreeFlags + ld hl, wFruitTreeFlags call FlagAction pop de pop hl diff --git a/engine/events/halloffame.asm b/engine/events/halloffame.asm index dbd3a2d5a..78b5cbe03 100755 --- a/engine/events/halloffame.asm +++ b/engine/events/halloffame.asm @@ -37,14 +37,14 @@ HallOfFame:: ; 0x8640e RedCredits:: ; 86455 ld a, LOW(MUSIC_NONE) - ld [MusicFadeID], a + ld [wMusicFadeID], a ld a, HIGH(MUSIC_NONE) - ld [MusicFadeID + 1], a + ld [wMusicFadeID + 1], a ld a, 10 - ld [MusicFade], a + ld [wMusicFade], a farcall Special_FadeOutPalettes xor a - ld [VramState], a + ld [wVramState], a ld [hMapAnims], a farcall InitDisplayForRedCredits ld c, 8 @@ -60,14 +60,14 @@ RedCredits:: ; 86455 HallOfFame_FadeOutMusic: ; 8648e ld a, LOW(MUSIC_NONE) - ld [MusicFadeID], a + ld [wMusicFadeID], a ld a, HIGH(MUSIC_NONE) - ld [MusicFadeID + 1], a + ld [wMusicFadeID + 1], a ld a, 10 - ld [MusicFade], a + ld [wMusicFade], a farcall Special_FadeOutPalettes xor a - ld [VramState], a + ld [wVramState], a ld [hMapAnims], a farcall InitDisplayForHallOfFame ld c, 100 @@ -115,7 +115,7 @@ AnimateHallOfFame: ; 864c3 .done call HOF_AnimatePlayerPic ld a, $4 - ld [MusicFade], a + ld [wMusicFade], a call RotateThreePalettesRight ld c, 8 call DelayFrames @@ -143,15 +143,15 @@ AnimateHallOfFame: ; 864c3 GetHallOfFameParty: ; 8653f - ld hl, OverworldMap + ld hl, wOverworldMap ld bc, HOF_LENGTH xor a call ByteFill ld a, [wHallOfFameCount] - ld de, OverworldMap + ld de, wOverworldMap ld [de], a inc de - ld hl, PartySpecies + ld hl, wPartySpecies ld c, 0 .next ld a, [hli] @@ -168,7 +168,7 @@ GetHallOfFameParty: ; 8653f push bc ld a, c - ld hl, PartyMons + ld hl, wPartyMons ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes ld c, l @@ -207,7 +207,7 @@ GetHallOfFameParty: ; 8653f pop bc push bc ld a, c - ld hl, PartyMonNicknames + ld hl, wPartyMonNicknames ld bc, MON_NAME_LENGTH call AddNTimes ld bc, MON_NAME_LENGTH - 1 @@ -235,15 +235,15 @@ AnimateHOFMonEntrance: ; 865b5 farcall ResetDisplayBetweenHallOfFameMons pop hl ld a, [hli] - ld [TempMonSpecies], a - ld [CurPartySpecies], a + ld [wTempMonSpecies], a + ld [wCurPartySpecies], a inc hl inc hl ld a, [hli] - ld [TempMonDVs], a + ld [wTempMonDVs], a ld a, [hli] - ld [TempMonDVs + 1], a - ld hl, TempMonDVs + ld [wTempMonDVs + 1], a + ld hl, wTempMonDVs predef GetUnownLetter hlcoord 0, 0 ld bc, SCREEN_WIDTH * SCREEN_HEIGHT @@ -448,22 +448,22 @@ DisplayHOFMon: ; 86748 xor a ld [hBGMapMode], a ld a, [hli] - ld [TempMonSpecies], a + ld [wTempMonSpecies], a ld a, [hli] - ld [TempMonID], a + ld [wTempMonID], a ld a, [hli] - ld [TempMonID + 1], a + ld [wTempMonID + 1], a ld a, [hli] - ld [TempMonDVs], a + ld [wTempMonDVs], a ld a, [hli] - ld [TempMonDVs + 1], a + ld [wTempMonDVs + 1], a ld a, [hli] - ld [TempMonLevel], a - ld de, StringBuffer2 + ld [wTempMonLevel], a + ld de, wStringBuffer2 ld bc, MON_NAME_LENGTH - 1 call CopyBytes ld a, "@" - ld [StringBuffer2 + 10], a + ld [wStringBuffer2 + 10], a hlcoord 0, 0 ld bc, SCREEN_WIDTH * SCREEN_HEIGHT ld a, " " @@ -474,16 +474,16 @@ DisplayHOFMon: ; 86748 hlcoord 0, 12 lb bc, 4, SCREEN_WIDTH - 2 call TextBox - ld a, [TempMonSpecies] - ld [CurPartySpecies], a + ld a, [wTempMonSpecies] + ld [wCurPartySpecies], a ld [wd265], a - ld hl, TempMonDVs + ld hl, wTempMonDVs predef GetUnownLetter xor a ld [wBoxAlignment], a hlcoord 6, 5 call _PrepMonFrontpic - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] cp EGG jr z, .print_id_no hlcoord 1, 13 @@ -498,7 +498,7 @@ DisplayHOFMon: ; 86748 hlcoord 7, 13 call PlaceString ld a, TEMPMON - ld [MonType], a + ld [wMonType], a farcall GetGender ld a, " " jr c, .got_gender @@ -512,7 +512,7 @@ DisplayHOFMon: ; 86748 hlcoord 8, 14 ld a, "/" ld [hli], a - ld de, StringBuffer2 + ld de, wStringBuffer2 call PlaceString hlcoord 1, 16 call PrintLevel @@ -525,7 +525,7 @@ DisplayHOFMon: ; 86748 ld [hli], a ld [hl], "/" hlcoord 10, 16 - ld de, TempMonID + ld de, wTempMonID lb bc, PRINTNUM_LEADINGZEROS | 2, 5 call PrintNum ret @@ -554,7 +554,7 @@ HOF_AnimatePlayerPic: ; 86810 call WaitBGMap xor a ld [hBGMapMode], a - ld [CurPartySpecies], a + ld [wCurPartySpecies], a ld b, SCGB_PLAYER_OR_MON_FRONTPIC_PALS call GetSGBLayout call SetPalettes @@ -587,7 +587,7 @@ HOF_AnimatePlayerPic: ; 86810 lb bc, 4, 18 call TextBox hlcoord 2, 4 - ld de, PlayerName + ld de, wPlayerName call PlaceString hlcoord 1, 6 ld a, "<ID>" @@ -596,19 +596,19 @@ HOF_AnimatePlayerPic: ; 86810 ld [hli], a ld [hl], "/" hlcoord 4, 6 - ld de, PlayerID + ld de, wPlayerID lb bc, PRINTNUM_LEADINGZEROS | 2, 5 call PrintNum hlcoord 1, 8 ld de, .PlayTime call PlaceString hlcoord 3, 9 - ld de, GameTimeHours + ld de, wGameTimeHours lb bc, 2, 3 call PrintNum ld [hl], HALLOFFAME_COLON inc hl - ld de, GameTimeMinutes + ld de, wGameTimeMinutes lb bc, PRINTNUM_LEADINGZEROS | 1, 2 call PrintNum call WaitBGMap diff --git a/engine/events/happiness_egg.asm b/engine/events/happiness_egg.asm index 2db54a1a7..0c516247f 100755 --- a/engine/events/happiness_egg.asm +++ b/engine/events/happiness_egg.asm @@ -1,7 +1,7 @@ Special_GetFirstPokemonHappiness: ; 718d - ld hl, PartyMon1Happiness + ld hl, wPartyMon1Happiness ld bc, PARTYMON_STRUCT_LENGTH - ld de, PartySpecies + ld de, wPartySpecies .loop ld a, [de] cp EGG @@ -13,12 +13,12 @@ Special_GetFirstPokemonHappiness: ; 718d .done ld [wd265], a ld a, [hl] - ld [ScriptVar], a + ld [wScriptVar], a call GetPokemonName jp CopyPokemonName_Buffer1_Buffer3 Special_CheckFirstMonIsEgg: ; 71ac - ld a, [PartySpecies] + ld a, [wPartySpecies] ld [wd265], a cp EGG ld a, 1 @@ -26,27 +26,27 @@ Special_CheckFirstMonIsEgg: ; 71ac xor a .egg - ld [ScriptVar], a + ld [wScriptVar], a call GetPokemonName jp CopyPokemonName_Buffer1_Buffer3 ChangeHappiness: ; 71c2 -; Perform happiness action c on CurPartyMon +; Perform happiness action c on wCurPartyMon - ld a, [CurPartyMon] + ld a, [wCurPartyMon] inc a ld e, a ld d, 0 - ld hl, PartySpecies - 1 + ld hl, wPartySpecies - 1 add hl, de ld a, [hl] cp EGG ret z push bc - ld hl, PartyMon1Happiness + ld hl, wPartyMon1Happiness ld bc, PARTYMON_STRUCT_LENGTH - ld a, [CurPartyMon] + ld a, [wCurPartyMon] call AddNTimes pop bc @@ -93,13 +93,13 @@ ChangeHappiness: ; 71c2 ld a, [wBattleMode] and a ret z - ld a, [CurPartyMon] + ld a, [wCurPartyMon] ld b, a ld a, [wPartyMenuCursor] cp b ret nz ld a, [de] - ld [BattleMonHappiness], a + ld [wBattleMonHappiness], a ret @@ -116,13 +116,13 @@ StepHappiness:: ; 725a ld [hl], a ret nz - ld de, PartyCount + ld de, wPartyCount ld a, [de] and a ret z ld c, a - ld hl, PartyMon1Happiness + ld hl, wPartyMon1Happiness .loop inc de ld a, [de] diff --git a/engine/events/heal_machine_anim.asm b/engine/events/heal_machine_anim.asm index 067b2f554..400645b47 100755 --- a/engine/events/heal_machine_anim.asm +++ b/engine/events/heal_machine_anim.asm @@ -9,28 +9,28 @@ Special_HealMachineAnim: ; 12324 ; If you have no Pokemon, don't change the buffer. This can lead to some glitchy effects if you have no Pokemon. - ld a, [PartyCount] + ld a, [wPartyCount] and a ret z - ; The location of the healing machine relative to the player is stored in ScriptVar. + ; The location of the healing machine relative to the player is stored in wScriptVar. ; 0: Up and left (Pokemon Center) ; 1: Left (Elm's Lab) ; 2: Up (Hall of Fame) - ld a, [ScriptVar] - ld [Buffer1], a + ld a, [wScriptVar] + ld [wBuffer1], a ld a, [rOBP1] - ld [Buffer2], a + ld [wBuffer2], a call .DoJumptableFunctions - ld a, [Buffer2] + ld a, [wBuffer2] call DmgToCgbObjPal1 ret ; 1233e .DoJumptableFunctions: ; 1233e xor a - ld [Buffer3], a + ld [wBuffer3], a .jumpable_loop - ld a, [Buffer1] + ld a, [wBuffer1] ld e, a ld d, 0 ld hl, .Pointers @@ -39,10 +39,10 @@ Special_HealMachineAnim: ; 12324 ld a, [hli] ld h, [hl] ld l, a - ld a, [Buffer3] + ld a, [wBuffer3] ld e, a inc a - ld [Buffer3], a + ld [wBuffer3], a add hl, de ld a, [hl] cp HEALMACHINESTATE_FINISH @@ -97,18 +97,18 @@ ENDM ; 12393 .PC_LoadBallsOntoMachine: ; 12393 - ld hl, Sprite33 + ld hl, wVirtualOAMSprite32 ld de, .PC_ElmsLab_OAM call .PlaceHealingMachineTile call .PlaceHealingMachineTile jr .LoadBallsOntoMachine .HOF_LoadBallsOntoMachine: ; 123a1 - ld hl, Sprite33 + ld hl, wVirtualOAMSprite32 ld de, .HOF_OAM .LoadBallsOntoMachine: ; 123a7 - ld a, [PartyCount] + ld a, [wPartyCount] ld b, a .party_loop call .PlaceHealingMachineTile @@ -254,7 +254,7 @@ INCLUDE "gfx/overworld/heal_machine.pal" .PlaceHealingMachineTile: ; 124a3 push bc - ld a, [Buffer1] + ld a, [wBuffer1] bcpixel 2, 4 cp HEALMACHINE_ELMS_LAB jr z, .okay diff --git a/engine/events/kurt.asm b/engine/events/kurt.asm index 13bde6f7e..79eb7da2e 100644 --- a/engine/events/kurt.asm +++ b/engine/events/kurt.asm @@ -33,13 +33,13 @@ Special_SelectApricornForKurt: ; 88018 call Kurt_PrintTextWhichApricorn pop bc ld a, c - ld [MenuSelection], a + ld [wMenuSelection], a call Kurt_SelectApricorn ld a, c - ld [ScriptVar], a + ld [wScriptVar], a and a jr z, .done - ld [CurItem], a + ld [wCurItem], a ld a, [wMenuCursorY] ld c, a push bc @@ -61,7 +61,7 @@ Kurt_SelectApricorn: ; 88055 jr c, .nope ld hl, .MenuDataHeader call CopyMenuDataHeader - ld a, [MenuSelection] + ld a, [wMenuSelection] ld [wMenuCursorBuffer], a xor a ld [hBGMapMode], a @@ -71,7 +71,7 @@ Kurt_SelectApricorn: ; 88055 ld a, [wMenuJoypad] cp B_BUTTON jr z, .nope - ld a, [MenuSelection] + ld a, [wMenuSelection] cp -1 jr nz, .done @@ -96,13 +96,13 @@ Kurt_SelectApricorn: ; 88055 db SCROLLINGMENU_DISPLAY_ARROWS ; flags db 4, 7 db 1 - dbw 0, Buffer1 + dbw 0, wBuffer1 dba .Name dba .Quantity dba NULL .Name: ; 8809f - ld a, [MenuSelection] + ld a, [wMenuSelection] and a ret z farcall PlaceMenuItemName @@ -110,19 +110,19 @@ Kurt_SelectApricorn: ; 88055 ; 880ab .Quantity: ; 880ab - ld a, [MenuSelection] - ld [CurItem], a + ld a, [wMenuSelection] + ld [wCurItem], a call Kurt_GetQuantityOfApricorn ret z ld a, [wItemQuantityChangeBuffer] - ld [MenuSelectionQuantity], a + ld [wMenuSelectionQuantity], a farcall PlaceMenuItemQuantity ret ; 880c2 Kurt_SelectQuantity: ; 880c2 - ld a, [CurItem] - ld [MenuSelection], a + ld a, [wCurItem] + ld [wMenuSelection], a call Kurt_GetQuantityOfApricorn jr z, .done ld a, [wItemQuantityChangeBuffer] @@ -187,8 +187,8 @@ PlaceApricornQuantity: ; 88126 Kurt_GetQuantityOfApricorn: ; 88139 push bc - ld hl, NumItems - ld a, [CurItem] + ld hl, wNumItems + ld a, [wCurItem] ld c, a ld b, $0 .loop @@ -219,27 +219,27 @@ Kurt_GetQuantityOfApricorn: ; 88139 ; 88161 Kurt_GiveUpSelectedQuantityOfSelectedApricorn: ; 88161 -; Get the quantity of Apricorns of type [CurItem] +; Get the quantity of Apricorns of type [wCurItem] ; in the bag. Compatible with multiple stacks. ; Initialize the search. push de push bc - ld hl, NumItems - ld a, [CurItem] + ld hl, wNumItems + ld a, [wCurItem] ld c, a ld e, $0 xor a - ld [CurItemQuantity], a + ld [wCurItemQuantity], a ld a, -1 ld [wApricorns], a -; Search for [CurItem] in the bag. +; Search for [wCurItem] in the bag. .loop1 ; Increase the total count. - ld a, [CurItemQuantity] + ld a, [wCurItemQuantity] inc a - ld [CurItemQuantity], a + ld [wCurItemQuantity], a ; Get the index of the next item. inc hl ld a, [hli] @@ -255,7 +255,7 @@ Kurt_GiveUpSelectedQuantityOfSelectedApricorn: ; 88161 ld hl, wApricorns add hl, de inc e - ld a, [CurItemQuantity] + ld a, [wCurItemQuantity] dec a ld [hli], a ld a, -1 @@ -321,7 +321,7 @@ Kurt_GiveUpSelectedQuantityOfSelectedApricorn: ; 88161 cp -1 jr z, .done push hl - ld [CurItemQuantity], a + ld [wCurItemQuantity], a call Kurt_GetRidOfItem pop hl ld a, [wItemQuantityChangeBuffer] @@ -357,7 +357,7 @@ Kurt_GiveUpSelectedQuantityOfSelectedApricorn: ; 88161 Kurt_GetAddressOfApricornQuantity: ; 88201 push hl push bc - ld hl, NumItems + ld hl, wNumItems inc hl ld c, a ld b, $0 @@ -372,14 +372,14 @@ Kurt_GetAddressOfApricornQuantity: ; 88201 Kurt_GetRidOfItem: ; 88211 push bc - ld hl, NumItems - ld a, [CurItemQuantity] + ld hl, wNumItems + ld a, [wCurItemQuantity] ld c, a ld b, $0 inc hl add hl, bc add hl, bc - ld a, [CurItem] + ld a, [wCurItem] ld c, a ld a, [hli] cp -1 @@ -397,7 +397,7 @@ Kurt_GetRidOfItem: ; 88211 .okay push bc - ld hl, NumItems + ld hl, wNumItems ld a, b ld [wItemQuantityChangeBuffer], a call TossItem diff --git a/engine/events/lucky_number.asm b/engine/events/lucky_number.asm index a172fc431..1582cec7d 100644 --- a/engine/events/lucky_number.asm +++ b/engine/events/lucky_number.asm @@ -1,13 +1,13 @@ Special_CheckForLuckyNumberWinners: ; 4d87a xor a - ld [ScriptVar], a + ld [wScriptVar], a ld [wFoundMatchingIDInParty], a - ld a, [PartyCount] + ld a, [wPartyCount] and a ret z ld d, a - ld hl, PartyMon1ID - ld bc, PartySpecies + ld hl, wPartyMon1ID + ld bc, wPartySpecies .PartyLoop: ld a, [bc] inc bc @@ -79,7 +79,7 @@ Special_CheckForLuckyNumberWinners: ; 4d87a cp EGG jr z, .SkipBoxMon - call .CompareLuckyNumberToMonID ; sets ScriptVar and CurPartySpecies appropriately + call .CompareLuckyNumberToMonID ; sets wScriptVar and wCurPartySpecies appropriately jr nc, .SkipBoxMon ld a, 1 ld [wFoundMatchingIDInParty], a @@ -100,14 +100,14 @@ Special_CheckForLuckyNumberWinners: ; 4d87a jr c, .BoxesLoop call CloseSRAM - ld a, [ScriptVar] + ld a, [wScriptVar] and a ret z ; found nothing farcall StubbedTrainerRankings_LuckyNumberShow ld a, [wFoundMatchingIDInParty] and a push af - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] ld [wNamedObjectIndexBuffer], a call GetPokemonName ld hl, .FoundPartymonText @@ -124,17 +124,17 @@ Special_CheckForLuckyNumberWinners: ; 4d87a push hl ld d, h ld e, l - ld hl, Buffer1 + ld hl, wBuffer1 lb bc, PRINTNUM_LEADINGZEROS | 2, 5 call PrintNum - ld hl, LuckyNumberDigit1Buffer + ld hl, wLuckyNumberDigit1Buffer ld de, wLuckyIDNumber lb bc, PRINTNUM_LEADINGZEROS | 2, 5 call PrintNum ld b, 5 ld c, 0 - ld hl, LuckyNumberDigit5Buffer - ld de, Buffer5 + ld hl, wLuckyNumberDigit5Buffer + ld de, wBuffer5 .loop ld a, [de] cp [hl] @@ -167,7 +167,7 @@ Special_CheckForLuckyNumberWinners: ; 4d87a .okay inc b - ld a, [ScriptVar] + ld a, [wScriptVar] and a jr z, .bettermatch cp b @@ -176,10 +176,10 @@ Special_CheckForLuckyNumberWinners: ; 4d87a .bettermatch dec b ld a, b - ld [ScriptVar], a + ld [wScriptVar], a pop bc ld a, b - ld [CurPartySpecies], a + ld [wCurPartySpecies], a pop bc scf ret @@ -217,10 +217,10 @@ Special_CheckForLuckyNumberWinners: ; 4d87a db "@" Special_PrintTodaysLuckyNumber: ; 4d9d3 - ld hl, StringBuffer3 + ld hl, wStringBuffer3 ld de, wLuckyIDNumber lb bc, PRINTNUM_LEADINGZEROS | 2, 5 call PrintNum ld a, "@" - ld [StringBuffer3 + 5], a + ld [wStringBuffer3 + 5], a ret diff --git a/engine/events/magikarp.asm b/engine/events/magikarp.asm index 6588295b8..8d835960f 100644 --- a/engine/events/magikarp.asm +++ b/engine/events/magikarp.asm @@ -7,13 +7,13 @@ Special_CheckMagikarpLength: ; fbb32 ; Let's start by selecting a Magikarp. farcall SelectMonFromParty jr c, .declined - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] cp MAGIKARP jr nz, .not_magikarp ; Now let's compute its length based on its DVs and ID. - ld a, [CurPartyMon] - ld hl, PartyMon1Species + ld a, [wCurPartyMon] + ld hl, wPartyMon1Species ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes push hl @@ -48,27 +48,27 @@ Special_CheckMagikarpLength: ; fbb32 ld a, [hl] ld [de], a inc de - ld a, [CurPartyMon] - ld hl, PartyMonOT + ld a, [wCurPartyMon] + ld hl, wPartyMonOT call SkipNames call CopyBytes ld a, MAGIKARPLENGTH_BEAT_RECORD - ld [ScriptVar], a + ld [wScriptVar], a ret .not_long_enough ld a, MAGIKARPLENGTH_TOO_SHORT - ld [ScriptVar], a + ld [wScriptVar], a ret .declined ld a, MAGIKARPLENGTH_REFUSED - ld [ScriptVar], a + ld [wScriptVar], a ret .not_magikarp xor a ; MAGIKARPLENGTH_NOT_MAGIKARP - ld [ScriptVar], a + ld [wScriptVar], a ret ; fbba9 @@ -92,7 +92,7 @@ INCBIN "gfx/font/feet_inches.2bpp" PrintMagikarpLength: ; fbbdb call Magikarp_LoadFeetInchesChars - ld hl, StringBuffer1 + ld hl, wStringBuffer1 ld de, wMagikarpLength lb bc, PRINTNUM_RIGHTALIGN | 1, 2 call PrintNum @@ -111,8 +111,8 @@ CalcMagikarpLength: ; fbbfc ; Return Magikarp's length (in feet and inches) at wMagikarpLength (big endian). ; ; input: -; de: EnemyMonDVs -; bc: PlayerID +; de: wEnemyMonDVs +; bc: wPlayerID ; This function is poorly commented. diff --git a/engine/events/magnet_train.asm b/engine/events/magnet_train.asm index 232372dbd..ed7caf218 100755 --- a/engine/events/magnet_train.asm +++ b/engine/events/magnet_train.asm @@ -1,5 +1,5 @@ Special_MagnetTrain: ; 8cc04 - ld a, [ScriptVar] + ld a, [wScriptVar] and a jr nz, .ToGoldenrod ld a, 1 ; forwards @@ -65,11 +65,11 @@ Special_MagnetTrain: ; 8cc04 ld [hLYOverrideStart], a ld [hLYOverrideEnd], a ld [hSCX], a - ld [Requested2bppSource], a - ld [Requested2bppSource + 1], a - ld [Requested2bppDest], a - ld [Requested2bppDest + 1], a - ld [Requested2bpp], a + ld [wRequested2bppSource], a + ld [wRequested2bppSource + 1], a + ld [wRequested2bppDest], a + ld [wRequested2bppDest + 1], a + ld [wRequested2bpp], a call ClearTileMap pop af @@ -84,7 +84,7 @@ Special_MagnetTrain: ; 8cc04 ; 8cc99 MagnetTrain_UpdateLYOverrides: ; 8cc99 - ld hl, LYOverridesBackup + ld hl, wLYOverridesBackup ld c, $2f ld a, [wMagnetTrainOffset] add a @@ -242,12 +242,12 @@ MagnetTrainBGTiles: ; 8cd82 ; 8cda6 MagnetTrain_InitLYOverrides: ; 8cda6 - ld hl, LYOverrides - ld bc, LYOverridesEnd - LYOverrides + ld hl, wLYOverrides + ld bc, wLYOverridesEnd - wLYOverrides ld a, [wMagnetTrainInitPosition] call ByteFill - ld hl, LYOverridesBackup - ld bc, LYOverridesBackupEnd - LYOverridesBackup + ld hl, wLYOverridesBackup + ld bc, wLYOverridesBackupEnd - wLYOverridesBackup ld a, [wMagnetTrainInitPosition] call ByteFill ld a, rSCX - $ff00 @@ -430,13 +430,13 @@ MagnetTrain_Jumptable_FirstRunThrough: ; 8ceae push af ld a, BANK(wEnvironment) ld [rSVBK], a - ld a, [TimeOfDayPal] + ld a, [wTimeOfDayPal] push af ld a, [wEnvironment] push af - ld a, [TimeOfDay] + ld a, [wTimeOfDay] maskbits NUM_DAYTIMES - ld [TimeOfDayPal], a + ld [wTimeOfDayPal], a ld a, $1 ld [wEnvironment], a ld b, SCGB_MAPPALS @@ -451,7 +451,7 @@ MagnetTrain_Jumptable_FirstRunThrough: ; 8ceae pop af ld [wEnvironment], a pop af - ld [TimeOfDayPal], a + ld [wTimeOfDayPal], a pop af ld [rSVBK], a ret diff --git a/engine/events/map_name_sign.asm b/engine/events/map_name_sign.asm index b20d74ee4..b97d40798 100644 --- a/engine/events/map_name_sign.asm +++ b/engine/events/map_name_sign.asm @@ -9,9 +9,9 @@ ReturnFromMapSetupScript:: ; b8000 ; should have just been a fallthrough .inefficient_farcall ; b800a - ld a, [MapGroup] + ld a, [wMapGroup] ld b, a - ld a, [MapNumber] + ld a, [wMapNumber] ld c, a call GetWorldMapLocation ld [wCurrentLandmark], a @@ -91,10 +91,10 @@ ReturnFromMapSetupScript:: ; b8000 ; b8089 .CheckNationalParkGate: ; b8089 - ld a, [MapGroup] + ld a, [wMapGroup] cp GROUP_ROUTE_35_NATIONAL_PARK_GATE ret nz - ld a, [MapNumber] + ld a, [wMapNumber] cp MAP_ROUTE_35_NATIONAL_PARK_GATE ret z cp MAP_ROUTE_36_NATIONAL_PARK_GATE @@ -161,14 +161,14 @@ PlaceMapNameCenterAlign: ; b80e1 (2e:40e1) ld c, a hlcoord 0, 2 add hl, bc - ld de, StringBuffer1 + ld de, wStringBuffer1 call PlaceString ret .GetNameLength: ; b8101 (2e:4101) ld c, 0 push hl - ld hl, StringBuffer1 + ld hl, wStringBuffer1 .loop ld a, [hli] cp "@" @@ -183,7 +183,7 @@ PlaceMapNameCenterAlign: ; b80e1 (2e:40e1) InitMapSignAttrMap: ; b8115 - ld de, AttrMap - TileMap + ld de, wAttrMap - wTileMap add hl, de inc b inc b diff --git a/engine/events/misc_scripts.asm b/engine/events/misc_scripts.asm index 73ed89143..4e4d5dc86 100755 --- a/engine/events/misc_scripts.asm +++ b/engine/events/misc_scripts.asm @@ -43,20 +43,20 @@ FindItemInBallScript:: ; 0x122ce .TryReceiveItem: ; 122f8 xor a - ld [ScriptVar], a - ld a, [EngineBuffer1] + ld [wScriptVar], a + ld a, [wEngineBuffer1] ld [wNamedObjectIndexBuffer], a call GetItemName - ld hl, StringBuffer3 + ld hl, wStringBuffer3 call CopyName2 - ld a, [EngineBuffer1] - ld [CurItem], a - ld a, [CurFruit] + ld a, [wEngineBuffer1] + ld [wCurItem], a + ld a, [wCurFruit] ld [wItemQuantityChangeBuffer], a - ld hl, NumItems + ld hl, wNumItems call ReceiveItem ret nc ld a, $1 - ld [ScriptVar], a + ld [wScriptVar], a ret ; 12324 diff --git a/engine/events/misc_scripts_2.asm b/engine/events/misc_scripts_2.asm index 29416a9e5..dd705b547 100644 --- a/engine/events/misc_scripts_2.asm +++ b/engine/events/misc_scripts_2.asm @@ -12,7 +12,7 @@ RepelWoreOffScript:: ; 0x13619 HiddenItemScript:: ; 0x13625 opentext - copybytetovar EngineBuffer3 + copybytetovar wEngineBuffer3 itemtotext USE_SCRIPT_VAR, MEM_BUFFER_0 writetext .found_text giveitem ITEM_FROM_MEM @@ -42,7 +42,7 @@ HiddenItemScript:: ; 0x13625 db "@" SetMemEvent: ; 1364f - ld hl, EngineBuffer1 + ld hl, wEngineBuffer1 ld a, [hli] ld d, [hl] ld e, a diff --git a/engine/events/mom.asm b/engine/events/mom.asm index c7e1cd6e9..fbda552ad 100644 --- a/engine/events/mom.asm +++ b/engine/events/mom.asm @@ -141,7 +141,7 @@ Special_BankOfMom: ; 16218 ld hl, UnknownText_0x16662 call PrintText xor a - ld hl, StringBuffer2 + ld hl, wStringBuffer2 ld [hli], a ld [hli], a ld [hl], a @@ -153,28 +153,28 @@ Special_BankOfMom: ; 16218 call Mom_WithdrawDepositMenuJoypad call CloseWindow jr c, .CancelDeposit - ld hl, StringBuffer2 + ld hl, wStringBuffer2 ld a, [hli] or [hl] inc hl or [hl] jr z, .CancelDeposit - ld de, Money - ld bc, StringBuffer2 + ld de, wMoney + ld bc, wStringBuffer2 farcall CompareMoney jr c, .DontHaveThatMuchToDeposit - ld hl, StringBuffer2 - ld de, StringBuffer2 + 3 + ld hl, wStringBuffer2 + ld de, wStringBuffer2 + 3 ld bc, 3 call CopyBytes ld bc, wMomsMoney - ld de, StringBuffer2 + ld de, wStringBuffer2 farcall GiveMoney jr c, .CantDepositThatMuch - ld bc, StringBuffer2 + 3 - ld de, Money + ld bc, wStringBuffer2 + 3 + ld de, wMoney farcall TakeMoney - ld hl, StringBuffer2 + ld hl, wStringBuffer2 ld de, wMomsMoney ld bc, 3 call CopyBytes @@ -208,7 +208,7 @@ Special_BankOfMom: ; 16218 ld hl, UnknownText_0x16667 call PrintText xor a - ld hl, StringBuffer2 + ld hl, wStringBuffer2 ld [hli], a ld [hli], a ld [hl], a @@ -220,29 +220,29 @@ Special_BankOfMom: ; 16218 call Mom_WithdrawDepositMenuJoypad call CloseWindow jr c, .CancelWithdraw - ld hl, StringBuffer2 + ld hl, wStringBuffer2 ld a, [hli] or [hl] inc hl or [hl] jr z, .CancelWithdraw - ld hl, StringBuffer2 - ld de, StringBuffer2 + 3 + ld hl, wStringBuffer2 + ld de, wStringBuffer2 + 3 ld bc, 3 call CopyBytes ld de, wMomsMoney - ld bc, StringBuffer2 + ld bc, wStringBuffer2 farcall CompareMoney jr c, .InsufficientFundsInBank - ld bc, Money - ld de, StringBuffer2 + ld bc, wMoney + ld de, wStringBuffer2 farcall GiveMoney jr c, .NotEnoughRoomInWallet - ld bc, StringBuffer2 + 3 + ld bc, wStringBuffer2 + 3 ld de, wMomsMoney farcall TakeMoney - ld hl, StringBuffer2 - ld de, Money + ld hl, wStringBuffer2 + ld de, wMoney ld bc, 3 call CopyBytes ld de, SFX_TRANSACTION @@ -367,33 +367,33 @@ DSTChecks: ; 16439 ; 164b9 .SetClockForward: ; 164b9 - ld a, [StartHour] + ld a, [wStartHour] add 1 sub 24 jr nc, .DontLoopHourForward add 24 .DontLoopHourForward: - ld [StartHour], a + ld [wStartHour], a ccf - ld a, [StartDay] + ld a, [wStartDay] adc 0 - ld [StartDay], a + ld [wStartDay], a ret ; 164d1 .SetClockBack: ; 164d1 - ld a, [StartHour] + ld a, [wStartHour] sub 1 jr nc, .DontLoopHourBack add 24 .DontLoopHourBack: - ld [StartHour], a - ld a, [StartDay] + ld [wStartHour], a + ld a, [wStartDay] sbc 0 jr nc, .DontLoopDayBack add 7 .DontLoopDayBack: - ld [StartDay], a + ld [wStartDay], a ret ; 164ea @@ -465,14 +465,14 @@ Mom_ContinueMenuSetup: ; 1651a ld de, Mom_HeldString call PlaceString hlcoord 12, 4 - ld de, Money + ld de, wMoney lb bc, PRINTNUM_MONEY | 3, 6 call PrintNum hlcoord 1, 6 pop de call PlaceString hlcoord 12, 6 - ld de, StringBuffer2 + ld de, wStringBuffer2 lb bc, PRINTNUM_MONEY | PRINTNUM_LEADINGZEROS | 3, 6 call PrintNum call UpdateSprites @@ -504,7 +504,7 @@ Mom_WithdrawDepositMenuJoypad: ; 16571 ld a, " " call ByteFill hlcoord 12, 6 - ld de, StringBuffer2 + ld de, wStringBuffer2 lb bc, PRINTNUM_MONEY | PRINTNUM_LEADINGZEROS | 3, 6 call PrintNum ld a, [hVBlankCounter] @@ -567,7 +567,7 @@ Mom_WithdrawDepositMenuJoypad: ; 16571 call .getdigitquantity ld c, l ld b, h - ld de, StringBuffer2 + ld de, wStringBuffer2 farcall GiveMoney ret @@ -576,7 +576,7 @@ Mom_WithdrawDepositMenuJoypad: ; 16571 call .getdigitquantity ld c, l ld b, h - ld de, StringBuffer2 + ld de, wStringBuffer2 farcall TakeMoney ret diff --git a/engine/events/mom_phone.asm b/engine/events/mom_phone.asm index d12bf0155..0b35fdb30 100755 --- a/engine/events/mom_phone.asm +++ b/engine/events/mom_phone.asm @@ -41,13 +41,13 @@ MomTriesToBuySomething:: ; fcfec .ok ld a, PHONE_MOM ld [wCurrentCaller], a - ld bc, EngineBuffer2 + ld bc, wEngineBuffer2 ld hl, 0 add hl, bc ld [hl], 0 inc hl ld [hl], 1 - ld hl, wPhoneScriptPointer - EngineBuffer2 + ld hl, wPhoneScriptPointer - wEngineBuffer2 add hl, bc ld a, BANK(Mom_GetScriptPointer) ld [hli], a @@ -89,7 +89,7 @@ CheckBalance_MomItem2: ; fd044 inc hl ld [hl], LOW(MOM_MONEY) .loop - ld de, MomItemTriggerBalance + ld de, wMomItemTriggerBalance ld bc, wMomsMoney farcall CompareMoney jr z, .exact @@ -111,7 +111,7 @@ CheckBalance_MomItem2: ; fd044 ret .AddMoney: - ld de, MomItemTriggerBalance + ld de, wMomItemTriggerBalance ld bc, hMoneyTemp farcall AddMoney ret @@ -150,10 +150,10 @@ Mom_GiveItemOrDoll: ; fd0c3 .not_doll ld a, [hl] - ld [CurItem], a + ld [wCurItem], a ld a, 1 ld [wItemQuantityChangeBuffer], a - ld hl, PCItems + ld hl, wPCItems call ReceiveItem ret ; fd0eb diff --git a/engine/events/move_deleter.asm b/engine/events/move_deleter.asm index 3e06113ae..fad33e222 100644 --- a/engine/events/move_deleter.asm +++ b/engine/events/move_deleter.asm @@ -7,11 +7,11 @@ Special_MoveDeletion: call PrintText farcall SelectMonFromParty jr c, .declined - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] cp EGG jr z, .egg - ld a, [CurPartyMon] - ld hl, PartyMon1Moves + 1 + ld a, [wCurPartyMon] + ld hl, wPartyMon1Moves + 1 ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes ld a, [hl] @@ -27,7 +27,7 @@ Special_MoveDeletion: jr c, .declined ld a, [wMenuCursorY] push af - ld a, [CurSpecies] + ld a, [wCurSpecies] ld [wd265], a call GetMoveName ld hl, .ConfirmDeleteText @@ -113,9 +113,9 @@ Special_MoveDeletion: dec a ld c, a ld b, 0 - ld hl, PartyMon1Moves + ld hl, wPartyMon1Moves add hl, bc - ld a, [CurPartyMon] + ld a, [wCurPartyMon] ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes pop bc @@ -142,9 +142,9 @@ Special_MoveDeletion: dec a ld c, a ld b, 0 - ld hl, PartyMon1PP + ld hl, wPartyMon1PP add hl, bc - ld a, [CurPartyMon] + ld a, [wCurPartyMon] ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes pop bc diff --git a/engine/events/move_tutor.asm b/engine/events/move_tutor.asm index be5f37564..df599d3ae 100644 --- a/engine/events/move_tutor.asm +++ b/engine/events/move_tutor.asm @@ -23,18 +23,18 @@ Special_MoveTutor: ; 4925b call CheckCanLearnMoveTutorMove jr nc, .loop xor a ; FALSE - ld [ScriptVar], a + ld [wScriptVar], a jr .quit .cancel ld a, -1 - ld [ScriptVar], a + ld [wScriptVar], a .quit call CloseSubmenu ret .GetMoveTutorMove: ; 492a5 - ld a, [ScriptVar] + ld a, [wScriptVar] cp MOVETUTOR_FLAMETHROWER jr z, .flamethrower cp MOVETUTOR_THUNDERBOLT @@ -58,8 +58,8 @@ CheckCanLearnMoveTutorMove: ; 492b9 predef CanLearnTMHMMove push bc - ld a, [CurPartyMon] - ld hl, PartyMonNicknames + ld a, [wCurPartyMon] + ld hl, wPartyMonNicknames call GetNick pop bc diff --git a/engine/events/name_rater.asm b/engine/events/name_rater.asm index 796647f48..ad4ea1c9c 100644 --- a/engine/events/name_rater.asm +++ b/engine/events/name_rater.asm @@ -10,7 +10,7 @@ NameRater: ; fb6ed farcall SelectMonFromParty jr c, .cancel ; He can't rename an egg... - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] cp EGG jr z, .egg ; ... or a Pokemon you got from a trade. @@ -25,15 +25,15 @@ NameRater: ; fb6ed ; What name shall I give it then? ld hl, NameRaterWhichNameText call PrintText -; Load the new nickname into StringBuffer2 +; Load the new nickname into wStringBuffer2 xor a ; PARTYMON - ld [MonType], a - ld a, [CurPartySpecies] + ld [wMonType], a + ld a, [wCurPartySpecies] ld [wd265], a - ld [CurSpecies], a + ld [wCurSpecies], a call GetBaseData ld b, 0 - ld de, StringBuffer2 + ld de, wStringBuffer2 farcall _NamingScreen ; If the new name is empty, treat it as unchanged. call IsNewNameEmpty @@ -43,14 +43,14 @@ NameRater: ; fb6ed call CompareNewToOld ld hl, NameRaterSameAsBeforeText jr c, .samename -; Copy the new name from StringBuffer2 - ld hl, PartyMonNicknames +; Copy the new name from wStringBuffer2 + ld hl, wPartyMonNicknames ld bc, MON_NAME_LENGTH - ld a, [CurPartyMon] + ld a, [wCurPartyMon] call AddNTimes ld e, l ld d, h - ld hl, StringBuffer2 + ld hl, wStringBuffer2 ld bc, MON_NAME_LENGTH call CopyBytes ld hl, NameRaterEvenBetterText @@ -80,21 +80,21 @@ NameRater: ; fb6ed ; fb78a CheckIfMonIsYourOT: ; fb78a -; Checks to see if the partymon loaded in [CurPartyMon] has the different OT as you. Returns carry if not. - ld hl, PartyMonOT +; Checks to see if the partymon loaded in [wCurPartyMon] has the different OT as you. Returns carry if not. + ld hl, wPartyMonOT ld bc, NAME_LENGTH - ld a, [CurPartyMon] + ld a, [wCurPartyMon] call AddNTimes - ld de, PlayerName + ld de, wPlayerName ld c, NAME_LENGTH call .loop jr c, .nope - ld hl, PartyMon1ID + ld hl, wPartyMon1ID ld bc, PARTYMON_STRUCT_LENGTH - ld a, [CurPartyMon] + ld a, [wCurPartyMon] call AddNTimes - ld de, PlayerID + ld de, wPlayerID ld c, 2 ; number of bytes in which your ID is stored .loop ld a, [de] @@ -113,8 +113,8 @@ CheckIfMonIsYourOT: ; fb78a ; fb7be IsNewNameEmpty: ; fb7be -; Checks to see if the nickname loaded in StringBuffer2 is empty. If so, return carry. - ld hl, StringBuffer2 +; Checks to see if the nickname loaded in wStringBuffer2 is empty. If so, return carry. + ld hl, wStringBuffer2 ld c, MON_NAME_LENGTH - 1 .loop ld a, [hli] @@ -135,21 +135,21 @@ IsNewNameEmpty: ; fb7be ; fb7d3 CompareNewToOld: ; fb7d3 -; Compares the nickname in StringBuffer2 to the previous nickname. If they are the same, return carry. - ld hl, PartyMonNicknames +; Compares the nickname in wStringBuffer2 to the previous nickname. If they are the same, return carry. + ld hl, wPartyMonNicknames ld bc, MON_NAME_LENGTH - ld a, [CurPartyMon] + ld a, [wCurPartyMon] call AddNTimes push hl call GetNicknameLength ld b, c - ld hl, StringBuffer2 + ld hl, wStringBuffer2 call GetNicknameLength pop hl ld a, c cp b jr nz, .different - ld de, StringBuffer2 + ld de, wStringBuffer2 .loop ld a, [de] cp "@" diff --git a/engine/events/odd_egg.asm b/engine/events/odd_egg.asm index de3107804..e4efc5c0f 100644 --- a/engine/events/odd_egg.asm +++ b/engine/events/odd_egg.asm @@ -42,17 +42,17 @@ GiveOddEgg: ; 1fb4b6 ld a, OddEgg2 - OddEgg1 call AddNTimes - ld de, OddEggSpecies + ld de, wOddEggSpecies ld bc, PARTYMON_STRUCT_LENGTH + 2 * MON_NAME_LENGTH call CopyBytes ld a, EGG_TICKET - ld [CurItem], a + ld [wCurItem], a ld a, 1 ld [wItemQuantityChangeBuffer], a ld a, -1 - ld [CurItemQuantity], a - ld hl, NumItems + ld [wCurItemQuantity], a + ld hl, wNumItems call TossItem ; load species in wcd2a @@ -64,10 +64,10 @@ GiveOddEgg: ; 1fb4b6 ld [wMobileMonSpeciesPointerBuffer], a ld a, HIGH(wMobileMonSpeciesBuffer - 1) ld [wMobileMonSpeciesPointerBuffer + 1], a - ; load pointer to OddEggSpecies in wMobileMonStructurePointerBuffer - ld a, LOW(OddEggSpecies) + ; load pointer to wOddEggSpecies in wMobileMonStructurePointerBuffer + ld a, LOW(wOddEggSpecies) ld [wMobileMonStructurePointerBuffer], a - ld a, HIGH(OddEggSpecies) + ld a, HIGH(wOddEggSpecies) ld [wMobileMonStructurePointerBuffer + 1], a ; load Odd Egg Name in wTempOddEggNickname diff --git a/engine/events/overworld.asm b/engine/events/overworld.asm index c9e0a5fe5..6223d875d 100755 --- a/engine/events/overworld.asm +++ b/engine/events/overworld.asm @@ -1,14 +1,14 @@ FieldMoveJumptableReset: ; c6ea xor a - ld hl, Buffer1 + ld hl, wBuffer1 ld bc, 7 call ByteFill ret FieldMoveJumptable: ; c6f5 - ld a, [Buffer1] + ld a, [wBuffer1] rst JumpTable - ld [Buffer1], a + ld [wBuffer1], a bit 7, a jr nz, .okay and a @@ -20,16 +20,16 @@ FieldMoveJumptable: ; c6f5 ret GetPartyNick: ; c706 -; write CurPartyMon nickname to StringBuffer1-3 - ld hl, PartyMonNicknames +; write wCurPartyMon nickname to wStringBuffer1-3 + ld hl, wPartyMonNicknames ld a, BOXMON - ld [MonType], a - ld a, [CurPartyMon] + ld [wMonType], a + ld a, [wCurPartyMon] call GetNick call CopyName1 -; copy text from StringBuffer2 to StringBuffer3 - ld de, StringBuffer2 - ld hl, StringBuffer3 +; copy text from wStringBuffer2 to wStringBuffer3 + ld de, wStringBuffer2 + ld hl, wStringBuffer3 call CopyName2 ret @@ -68,11 +68,11 @@ CheckPartyMove: ; c742 ld e, 0 xor a - ld [CurPartyMon], a + ld [wCurPartyMon], a .loop ld c, e ld b, 0 - ld hl, PartySpecies + ld hl, wPartySpecies add hl, bc ld a, [hl] and a @@ -83,7 +83,7 @@ CheckPartyMove: ; c742 jr z, .next ld bc, PARTYMON_STRUCT_LENGTH - ld hl, PartyMon1Moves + ld hl, wPartyMon1Moves ld a, e call AddNTimes ld b, NUM_MOVES @@ -100,7 +100,7 @@ CheckPartyMove: ; c742 .yes ld a, e - ld [CurPartyMon], a ; which mon has the move + ld [wCurPartyMon], a ; which mon has the move xor a ret .no @@ -179,7 +179,7 @@ CheckMapForSomethingToCut: ; c7ce farcall CheckCutCollision pop de jr nc, .fail - ; Get the location of the current block in OverworldMap. + ; Get the location of the current block in wOverworldMap. call GetBlockLocation ld c, [hl] ; See if that block contains something that can be cut. @@ -188,17 +188,17 @@ CheckMapForSomethingToCut: ; c7ce call CheckOverworldTileArrays pop hl jr nc, .fail - ; Back up the OverworldMap address to Buffer3 + ; Back up the wOverworldMap address to wBuffer3 ld a, l - ld [Buffer3], a + ld [wBuffer3], a ld a, h - ld [Buffer4], a - ; Back up the replacement tile to Buffer5 + ld [wBuffer4], a + ; Back up the replacement tile to wBuffer5 ld a, b - ld [Buffer5], a - ; Back up the animation index to Buffer6 + ld [wBuffer5], a + ; Back up the animation index to wBuffer6 ld a, c - ld [Buffer6], a + ld [wBuffer6], a xor a ret @@ -219,18 +219,18 @@ Script_Cut: ; 0xc802 end CutDownTreeOrGrass: ; c810 - ld hl, Buffer3 ; OverworldMapTile + ld hl, wBuffer3 ; OverworldMapTile ld a, [hli] ld h, [hl] ld l, a - ld a, [Buffer5] ; ReplacementTile + ld a, [wBuffer5] ; ReplacementTile ld [hl], a xor a ld [hBGMapMode], a call OverworldTextModeSwitch call UpdateSprites call DelayFrame - ld a, [Buffer6] ; Animation type + ld a, [wBuffer6] ; Animation type ld e, a farcall OWCutAnimation call BufferScreen @@ -248,7 +248,7 @@ CheckOverworldTileArrays: ; c840 ; Dictionary lookup for pointer to tile replacement table push bc - ld a, [wTileset] + ld a, [wMapTileset] ld de, 3 call IsInArray pop bc @@ -360,7 +360,7 @@ SurfFunction: ; c909 ld hl, wBikeFlags bit 1, [hl] ; always on bike jr nz, .cannotsurf - ld a, [PlayerState] + ld a, [wPlayerState] cp PLAYER_SURF jr z, .alreadyfail cp PLAYER_SURF_PIKA @@ -387,7 +387,7 @@ SurfFunction: ; c909 .DoSurf: ; c95f (3:495f) call GetSurfType - ld [Buffer2], a + ld [wBuffer2], a call GetPartyNick ld hl, SurfFromMenuScript call QueueScript @@ -416,14 +416,14 @@ UsedSurfScript: ; c986 callasm .empty_fn ; empty function - copybytetovar Buffer2 + copybytetovar wBuffer2 writevarcode VAR_MOVEMENT special ReplaceKrisSprite special PlayMapMusic ; step into the water special Special_SurfStartStep ; (slow_step_x, step_end) - applymovement PLAYER, MovementBuffer ; PLAYER, MovementBuffer + applymovement PLAYER, wMovementBuffer ; PLAYER, MovementBuffer end .empty_fn ; c9a2 @@ -446,10 +446,10 @@ GetSurfType: ; c9b8 ; Surfing on Pikachu uses an alternate sprite. ; This is done by using a separate movement type. - ld a, [CurPartyMon] + ld a, [wCurPartyMon] ld e, a ld d, 0 - ld hl, PartySpecies + ld hl, wPartySpecies add hl, de ld a, [hl] @@ -464,7 +464,7 @@ CheckDirection: ; c9cb ; from moving in the direction you're facing. ; Get player direction - ld a, [PlayerDirection] + ld a, [wPlayerDirection] and %00001100 ; bits 2 and 3 contain direction rrca rrca @@ -474,7 +474,7 @@ CheckDirection: ; c9cb add hl, de ; Can you walk in this direction? - ld a, [TilePermissions] + ld a, [wTilePermissions] and [hl] jr nz, .quit xor a @@ -495,14 +495,14 @@ TrySurfOW:: ; c9e7 ; Return carry if fail is allowed. ; Don't ask to surf if already fail. - ld a, [PlayerState] + ld a, [wPlayerState] cp PLAYER_SURF_PIKA jr z, .quit cp PLAYER_SURF jr z, .quit ; Must be facing water. - ld a, [EngineBuffer1] + ld a, [wEngineBuffer1] call GetTileCollision cp WATERTILE jr nz, .quit @@ -524,7 +524,7 @@ TrySurfOW:: ; c9e7 jr nz, .quit call GetSurfType - ld [Buffer2], a + ld [wBuffer2], a call GetPartyNick ld a, BANK(AskSurfScript) @@ -587,7 +587,7 @@ FlyFunction: ; ca3b cp NUM_SPAWNS jr nc, .illegal - ld [DefaultSpawnpoint], a + ld [wDefaultSpawnpoint], a call CloseWindow ld a, $1 ret @@ -664,11 +664,11 @@ WaterfallFunction: ; cade ret CheckMapCanWaterfall: ; cb07 - ld a, [PlayerDirection] + ld a, [wPlayerDirection] and $c cp FACE_UP jr nz, .failed - ld a, [TileUp] + ld a, [wTileUp] call CheckWaterfallTile jr nz, .failed xor a @@ -696,13 +696,13 @@ Script_UsedWaterfall: ; 0xcb20 .CheckContinueWaterfall: ; cb38 xor a - ld [ScriptVar], a - ld a, [PlayerStandingTile] + ld [wScriptVar], a + ld a, [wPlayerStandingTile] call CheckWaterfallTile ret z farcall StubbedTrainerRankings_Waterfall ld a, $1 - ld [ScriptVar], a + ld [wScriptVar], a ret .WaterfallStep: ; cb4f @@ -767,7 +767,7 @@ DigFunction: ; cb9c ld a, $2 dig_incave - ld [Buffer2], a + ld [wBuffer2], a .loop ld hl, .DigTable call FieldMoveJumptable @@ -811,7 +811,7 @@ dig_incave ld bc, 3 call CopyBytes call GetPartyNick - ld a, [Buffer2] + ld a, [wBuffer2] cp $2 jr nz, .escaperope ld hl, .UsedDigScript @@ -827,7 +827,7 @@ dig_incave ret .FailDig: ; cc06 - ld a, [Buffer2] + ld a, [wBuffer2] cp $2 jr nz, .failescaperope ld hl, .Text_CantUseHere @@ -917,7 +917,7 @@ TeleportFunction: ; cc61 farcall IsSpawnPoint jr nc, .nope ld a, c - ld [DefaultSpawnpoint], a + ld [wDefaultSpawnpoint], a ld a, $1 ret @@ -1009,13 +1009,13 @@ StrengthFunction: ; cce5 SetStrengthFlag: ; cd12 ld hl, wBikeFlags set 0, [hl] - ld a, [CurPartyMon] + ld a, [wCurPartyMon] ld e, a ld d, 0 - ld hl, PartySpecies + ld hl, wPartySpecies add hl, de ld a, [hl] - ld [Buffer6], a + ld [wBuffer6], a call GetPartyNick ret @@ -1026,7 +1026,7 @@ Script_StrengthFromMenu: ; 0xcd29 Script_UsedStrength: ; 0xcd2d callasm SetStrengthFlag writetext .UsedStrength - copybytetovar Buffer6 + copybytetovar wBuffer6 cry 0 pause 3 writetext .StrengthAllowedItToMoveBoulders @@ -1101,7 +1101,7 @@ TryStrengthOW: ; cd78 jr .done .done - ld [ScriptVar], a + ld [wScriptVar], a ret WhirlpoolFunction: ; cd9d @@ -1167,13 +1167,13 @@ TryWhirlpoolMenu: ; cdde pop hl jr nc, .failed ld a, l - ld [Buffer3], a + ld [wBuffer3], a ld a, h - ld [Buffer4], a + ld [wBuffer4], a ld a, b - ld [Buffer5], a + ld [wBuffer5], a ld a, c - ld [Buffer6], a + ld [wBuffer6], a xor a ret @@ -1194,16 +1194,16 @@ Script_UsedWhirlpool: ; 0xce0f end DisappearWhirlpool: ; ce1d - ld hl, Buffer3 + ld hl, wBuffer3 ld a, [hli] ld h, [hl] ld l, a - ld a, [Buffer5] + ld a, [wBuffer5] ld [hl], a xor a ld [hBGMapMode], a call OverworldTextModeSwitch - ld a, [Buffer6] + ld a, [wBuffer6] ld e, a farcall PlayWhirlpoolSound call BufferScreen @@ -1395,7 +1395,7 @@ RockSmashScript: ; cf32 disappear -2 callasm RockMonEncounter - copybytetovar TempWildMonSpecies + copybytetovar wTempWildMonSpecies iffalse .done randomwildmon startbattle @@ -1445,7 +1445,7 @@ HasRockSmash: ; cf7c xor a jr .done .done - ld [ScriptVar], a + ld [wScriptVar], a ret FishFunction: ; cf8e @@ -1453,7 +1453,7 @@ FishFunction: ; cf8e push af call FieldMoveJumptableReset pop af - ld [Buffer2], a + ld [wBuffer2], a .loop ld hl, .FishTable call FieldMoveJumptable @@ -1470,7 +1470,7 @@ FishFunction: ; cf8e dw .FishNoFish .TryFish: ; cfaf - ld a, [PlayerState] + ld a, [wPlayerState] cp PLAYER_SURF jr z, .fail cp PLAYER_SURF_PIKA @@ -1492,17 +1492,17 @@ FishFunction: ; cf8e .goodtofish ld d, a - ld a, [Buffer2] + ld a, [wBuffer2] ld e, a farcall Fish ld a, d and a jr z, .nonibble - ld [TempWildMonSpecies], a + ld [wTempWildMonSpecies], a ld a, e - ld [CurPartyLevel], a + ld [wCurPartyLevel], a ld a, BATTLETYPE_FISH - ld [BattleType], a + ld [wBattleType], a ld a, $2 ret @@ -1516,7 +1516,7 @@ FishFunction: ; cf8e .FishGotSomething: ; cff4 ld a, $1 - ld [Buffer6], a + ld [wBuffer6], a ld hl, Script_GotABite call QueueScript ld a, $81 @@ -1524,7 +1524,7 @@ FishFunction: ; cf8e .FishNoBite: ; d002 ld a, $2 - ld [Buffer6], a + ld [wBuffer6], a ld hl, Script_NotEvenANibble call QueueScript ld a, $81 @@ -1532,7 +1532,7 @@ FishFunction: ; cf8e .FishNoFish: ; d010 ld a, $0 - ld [Buffer6], a + ld [wBuffer6], a ld hl, Script_NotEvenANibble2 call QueueScript ld a, $81 @@ -1597,7 +1597,7 @@ Script_GotABite: ; 0xd035 step_end Fishing_CheckFacingUp: ; d06c - ld a, [PlayerDirection] + ld a, [wPlayerDirection] and $c cp OW_UP ld a, $1 @@ -1605,7 +1605,7 @@ Fishing_CheckFacingUp: ; d06c xor a .up - ld [ScriptVar], a + ld [wScriptVar], a ret Script_FishCastRod: ; 0xd07c @@ -1627,7 +1627,7 @@ PutTheRodAway: ; d095 xor a ld [hBGMapMode], a ld a, $1 - ld [PlayerAction], a + ld [wPlayerAction], a call UpdateSprites call ReplaceKrisSprite ret @@ -1656,7 +1656,7 @@ BikeFunction: ; d0b3 .TryBike: ; d0bc call .CheckEnvironment jr c, .CannotUseBike - ld a, [PlayerState] + ld a, [wPlayerState] cp PLAYER_NORMAL jr z, .GetOnBike cp PLAYER_BIKE @@ -1669,7 +1669,7 @@ BikeFunction: ; d0b3 call .CheckIfRegistered call QueueScript xor a - ld [MusicFade], a + ld [wMusicFade], a ld de, MUSIC_NONE call PlayMusic call DelayFrame @@ -1826,11 +1826,11 @@ AskCutScript: ; 0xd1a9 .CheckMap: ; d1ba xor a - ld [ScriptVar], a + ld [wScriptVar], a call CheckMapForSomethingToCut ret c ld a, TRUE - ld [ScriptVar], a + ld [wScriptVar], a ret UnknownText_0xd1c8: ; 0xd1c8 diff --git a/engine/events/poisonstep.asm b/engine/events/poisonstep.asm index 00c7477bc..47916076f 100755 --- a/engine/events/poisonstep.asm +++ b/engine/events/poisonstep.asm @@ -1,44 +1,44 @@ DoPoisonStep:: ; 505da - ld a, [PartyCount] + ld a, [wPartyCount] and a jr z, .no_faint xor a ld c, 7 - ld hl, EngineBuffer1 + ld hl, wEngineBuffer1 .loop_clearEngineBuffer1 ld [hli], a dec c jr nz, .loop_clearEngineBuffer1 xor a - ld [CurPartyMon], a + ld [wCurPartyMon], a .loop_check_poison call .DamageMonIfPoisoned jr nc, .not_poisoned -; the output flag is stored in c, copy it to the ([CurPartyMon] + 2)nd EngineBuffer -; and set the corresponding flag in EngineBuffer1 - ld a, [CurPartyMon] +; the output flag is stored in c, copy it to the ([wCurPartyMon] + 2)nd EngineBuffer +; and set the corresponding flag in wEngineBuffer1 + ld a, [wCurPartyMon] ld e, a ld d, 0 - ld hl, EngineBuffer2 + ld hl, wEngineBuffer2 add hl, de ld [hl], c - ld a, [EngineBuffer1] + ld a, [wEngineBuffer1] or c - ld [EngineBuffer1], a + ld [wEngineBuffer1], a .not_poisoned - ld a, [PartyCount] - ld hl, CurPartyMon + ld a, [wPartyCount] + ld hl, wCurPartyMon inc [hl] cp [hl] jr nz, .loop_check_poison - ld a, [EngineBuffer1] + ld a, [wEngineBuffer1] and %10 jr nz, .someone_has_fainted - ld a, [EngineBuffer1] + ld a, [wEngineBuffer1] and %01 jr z, .no_faint call .PlayPoisonSFX @@ -124,8 +124,8 @@ DoPoisonStep:: ; 505da .CheckWhitedOut: ; 5067b xor a - ld [CurPartyMon], a - ld de, EngineBuffer2 + ld [wCurPartyMon], a + ld de, wEngineBuffer2 .party_loop push de ld a, [de] @@ -140,14 +140,14 @@ DoPoisonStep:: ; 505da .mon_not_fainted pop de inc de - ld hl, CurPartyMon + ld hl, wCurPartyMon inc [hl] - ld a, [PartyCount] + ld a, [wPartyCount] cp [hl] jr nz, .party_loop predef CheckPlayerPartyForFitPkmn ld a, d - ld [ScriptVar], a + ld [wScriptVar], a ret ; 506b2 diff --git a/engine/events/poisonstep_pals.asm b/engine/events/poisonstep_pals.asm index 5b5b642ce..c1bfa49f0 100644 --- a/engine/events/poisonstep_pals.asm +++ b/engine/events/poisonstep_pals.asm @@ -9,7 +9,7 @@ LoadPoisonBGPals: ; cbcdd ld a, [hCGB] and a jr nz, .cgb - ld a, [TimeOfDayPal] + ld a, [wTimeOfDayPal] maskbits NUM_DAYTIMES cp DARKNESS_F ld a, %00000000 diff --git a/engine/events/poke_seer.asm b/engine/events/poke_seer.asm index fb9c6d9f9..85fc7af2d 100644 --- a/engine/events/poke_seer.asm +++ b/engine/events/poke_seer.asm @@ -24,7 +24,7 @@ Special_PokeSeer: ; 4f0bc farcall SelectMonFromParty jr c, .cancel - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] cp EGG jr z, .egg @@ -118,12 +118,12 @@ ReadCaughtData: ; 4f134 ld a, MON_ID call GetPartyParamLocation - ld a, [PlayerID] + ld a, [wPlayerID] cp [hl] jr nz, .traded inc hl - ld a, [PlayerID + 1] + ld a, [wPlayerID + 1] ; cp [hl] jr nz, .traded @@ -146,8 +146,8 @@ ReadCaughtData: ; 4f134 ; 4f176 GetCaughtName: ; 4f176 - ld a, [CurPartyMon] - ld hl, PartyMonNicknames + ld a, [wCurPartyMon] + ld hl, wPartyMonNicknames ld bc, MON_NAME_LENGTH call AddNTimes ld de, wSeerNickname @@ -241,7 +241,7 @@ GetCaughtLocation: ; 4f20a jr z, .fail ld e, a farcall GetLandmarkName - ld hl, StringBuffer1 + ld hl, wStringBuffer1 ld de, wSeerCaughtLocation ld bc, 17 call CopyBytes @@ -266,8 +266,8 @@ GetCaughtLocation: ; 4f20a ; 4f242 GetCaughtOT: ; 4f242 - ld a, [CurPartyMon] - ld hl, PartyMonOT + ld a, [wCurPartyMon] + ld hl, wPartyMonOT ld bc, NAME_LENGTH call AddNTimes ld de, wSeerOTName diff --git a/engine/events/pokecenter_pc.asm b/engine/events/pokecenter_pc.asm index 75d2d5392..75309aaa1 100755 --- a/engine/events/pokecenter_pc.asm +++ b/engine/events/pokecenter_pc.asm @@ -15,7 +15,7 @@ Special_PokemonCenterPC: ; 1559a ld [wWhichIndexSet], a call DoNthMenu jr c, .shutdown - ld a, [MenuSelection] + ld a, [wMenuSelection] ld hl, .JumpTable call MenuJumptable jr nc, .loop @@ -84,7 +84,7 @@ Special_PokemonCenterPC: ; 1559a ; 15650 PC_CheckPartyForPokemon: ; 15650 - ld a, [PartyCount] + ld a, [wPartyCount] and a ret nz ld de, SFX_CHOOSE_PC_OPTION @@ -289,13 +289,13 @@ LOG_OFF EQU 6 db -1 PC_DisplayTextWaitMenu: ; 157bb - ld a, [Options] + ld a, [wOptions] push af set NO_TEXT_SCROLL, a - ld [Options], a + ld [wOptions], a call MenuTextBox pop af - ld [Options], a + ld [wOptions], a ret ; 157cc @@ -341,17 +341,17 @@ KrisWithdrawItemMenu: ; 0x157d1 .withdraw ld a, [wItemQuantityChangeBuffer] - ld [Buffer1], a ; quantity - ld a, [CurItemQuantity] - ld [Buffer2], a - ld hl, NumItems + ld [wBuffer1], a ; quantity + ld a, [wCurItemQuantity] + ld [wBuffer2], a + ld hl, wNumItems call ReceiveItem jr nc, .PackFull - ld a, [Buffer1] + ld a, [wBuffer1] ld [wItemQuantityChangeBuffer], a - ld a, [Buffer2] - ld [CurItemQuantity], a - ld hl, PCItems + ld a, [wBuffer2] + ld [wCurItemQuantity], a + ld hl, wPCItems call TossItem predef PartyMonItemName ld hl, .WithdrewText @@ -387,7 +387,7 @@ KrisTossItemMenu: ; 0x1585f .loop call PCItemsJoypad jr c, .quit - ld de, PCItems + ld de, wPCItems farcall TossItemFromPC jr .loop @@ -473,15 +473,15 @@ KrisDepositItemMenu: ; 0x1588b ret .tossable - ld a, [Buffer1] + ld a, [wBuffer1] push af - ld a, [Buffer2] + ld a, [wBuffer2] push af call .DepositItem_ pop af - ld [Buffer2], a + ld [wBuffer2], a pop af - ld [Buffer1], a + ld [wBuffer1], a ret .DepositItem_: @@ -505,17 +505,17 @@ KrisDepositItemMenu: ; 0x1588b .DepositItem: ld a, [wItemQuantityChangeBuffer] - ld [Buffer1], a - ld a, [CurItemQuantity] - ld [Buffer2], a - ld hl, PCItems + ld [wBuffer1], a + ld a, [wCurItemQuantity] + ld [wBuffer2], a + ld hl, wPCItems call ReceiveItem jr nc, .NoRoomInPC - ld a, [Buffer1] + ld a, [wBuffer1] ld [wItemQuantityChangeBuffer], a - ld a, [Buffer2] - ld [CurItemQuantity], a - ld hl, NumItems + ld a, [wBuffer2] + ld [wCurItemQuantity], a + ld hl, wNumItems call TossItem predef PartyMonItemName ld hl, .DepositText @@ -628,7 +628,7 @@ PCItemsJoypad: ; 0x15985 db SCROLLINGMENU_ENABLE_SELECT | SCROLLINGMENU_ENABLE_FUNCTION3 | SCROLLINGMENU_DISPLAY_ARROWS ; flags db 4, 8 ; rows/cols? db 2 ; horizontal spacing? - dbw 0, PCItems + dbw 0, wPCItems dba PlaceMenuItemName dba PlaceMenuItemQuantity dba UpdateItemDescription diff --git a/engine/events/pokepic.asm b/engine/events/pokepic.asm index e9e14bbf4..a98ba47d3 100755 --- a/engine/events/pokepic.asm +++ b/engine/events/pokepic.asm @@ -8,8 +8,8 @@ Pokepic:: ; 244e3 call GetSGBLayout xor a ld [hBGMapMode], a - ld a, [CurPartySpecies] - ld [CurSpecies], a + ld a, [wCurPartySpecies] + ld [wCurSpecies], a call GetBaseData ld de, vTiles1 predef GetMonFrontpic diff --git a/engine/events/pokerus/apply_pokerus_tick.asm b/engine/events/pokerus/apply_pokerus_tick.asm index 3c97fdc5e..e632fbfe4 100644 --- a/engine/events/pokerus/apply_pokerus_tick.asm +++ b/engine/events/pokerus/apply_pokerus_tick.asm @@ -1,7 +1,7 @@ ApplyPokerusTick: ; 13988 ; decreases all pokemon's pokerus counter by b. if the lower nybble reaches zero, the pokerus is cured. - ld hl, PartyMon1PokerusStatus ; PartyMon1 + MON_PKRS - ld a, [PartyCount] + ld hl, wPartyMon1PokerusStatus ; wPartyMon1 + MON_PKRS + ld a, [wPartyCount] and a ret z ; make sure it's not wasting time on an empty party ld c, a diff --git a/engine/events/pokerus/check_pokerus.asm b/engine/events/pokerus/check_pokerus.asm index 285024754..d45055ab2 100644 --- a/engine/events/pokerus/check_pokerus.asm +++ b/engine/events/pokerus/check_pokerus.asm @@ -2,12 +2,12 @@ CheckPokerus: ; 4d860 ; Return carry if a monster in your party has Pokerus ; Get number of monsters to iterate over - ld a, [PartyCount] + ld a, [wPartyCount] and a jr z, .NoPokerus ld b, a ; Check each monster in the party for Pokerus - ld hl, PartyMon1PokerusStatus + ld hl, wPartyMon1PokerusStatus ld de, PARTYMON_STRUCT_LENGTH .Check: ld a, [hl] diff --git a/engine/events/pokerus/pokerus.asm b/engine/events/pokerus/pokerus.asm index d47bcb6c1..b29d0d096 100644 --- a/engine/events/pokerus/pokerus.asm +++ b/engine/events/pokerus/pokerus.asm @@ -1,7 +1,7 @@ GivePokerusAndConvertBerries: ; 2ed44 call ConvertBerriesToBerryJuice - ld hl, PartyMon1PokerusStatus - ld a, [PartyCount] + ld hl, wPartyMon1PokerusStatus + ld a, [wPartyCount] ld b, a ld de, PARTYMON_STRUCT_LENGTH ; Check to see if any of your Pokemon already has Pokerus. @@ -28,14 +28,14 @@ GivePokerusAndConvertBerries: ; 2ed44 ld a, [hRandomSub] cp $3 ret nc ; 3/65536 chance (00 00, 00 01 or 00 02) - ld a, [PartyCount] + ld a, [wPartyCount] ld b, a .randomMonSelectLoop call Random and $7 cp b jr nc, .randomMonSelectLoop - ld hl, PartyMon1PokerusStatus + ld hl, wPartyMon1PokerusStatus call GetPartyLocation ; get pokerus byte of random mon ld a, [hl] and $f0 @@ -64,7 +64,7 @@ GivePokerusAndConvertBerries: ; 2ed44 cp 1 + 33 percent ret nc ; 1/3 chance - ld a, [PartyCount] + ld a, [wPartyCount] cp 1 ret z ; only one mon, nothing to do @@ -91,7 +91,7 @@ GivePokerusAndConvertBerries: ; 2ed44 ret .checkPreviousMonsLoop - ld a, [PartyCount] + ld a, [wPartyCount] cp b ret z ; no more mons ld a, l @@ -129,8 +129,8 @@ ConvertBerriesToBerryJuice: ; 2ede6 call Random cp $10 ret nc ; 1/16 chance - ld hl, PartyMons - ld a, [PartyCount] + ld hl, wPartyMons + ld a, [wPartyCount] .partyMonLoop push af push hl diff --git a/engine/events/print_photo.asm b/engine/events/print_photo.asm index 54aa1892d..47766344c 100755 --- a/engine/events/print_photo.asm +++ b/engine/events/print_photo.asm @@ -3,7 +3,7 @@ Special_PhotoStudio: ; 16dc7 call PrintText farcall SelectMonFromParty jr c, .cancel - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] cp EGG jr z, .egg diff --git a/engine/events/print_unown.asm b/engine/events/print_unown.asm index 771d3ea5a..b0b7e856a 100644 --- a/engine/events/print_unown.asm +++ b/engine/events/print_unown.asm @@ -1,5 +1,5 @@ UnownPrinter: ; 16be4 - ld a, [UnownDex] + ld a, [wUnownDex] and a ret z @@ -7,10 +7,10 @@ UnownPrinter: ; 16be4 push af ld a, $1 ld [hInMenu], a - ld a, [Options] + ld a, [wOptions] push af set NO_TEXT_SCROLL, a - ld [Options], a + ld [wOptions], a call ClearBGPalettes call ClearTileMap @@ -54,10 +54,10 @@ UnownPrinter: ; 16be4 call WaitBGMap ld a, UNOWN - ld [CurPartySpecies], a + ld [wCurPartySpecies], a xor a - ld [TempMonDVs], a - ld [TempMonDVs + 1], a + ld [wTempMonDVs], a + ld [wTempMonDVs + 1], a ld b, SCGB_TRAINER_OR_MON_FRONTPIC_PALS call GetSGBLayout @@ -89,7 +89,7 @@ UnownPrinter: ; 16be4 .pressed_b pop af - ld [Options], a + ld [wOptions], a pop af ld [hInMenu], a call ReturnToMapFromSubmenu @@ -134,9 +134,9 @@ UnownPrinter: ; 16be4 cp 26 jr z, .vacant inc a - ld [UnownLetter], a + ld [wUnownLetter], a ld a, UNOWN - ld [CurPartySpecies], a + ld [wCurPartySpecies], a xor a ld [wBoxAlignment], a ld de, vTiles2 diff --git a/engine/events/print_unown_2.asm b/engine/events/print_unown_2.asm index 1e0b90fc5..4583a59e0 100644 --- a/engine/events/print_unown_2.asm +++ b/engine/events/print_unown_2.asm @@ -30,7 +30,7 @@ RotateUnownFrontpic: ; e0000 cp 7 * 7 jr c, .loop - ld hl, OverworldMap + ld hl, wOverworldMap ld de, sScratch ld bc, 7 * 7 tiles call CopyBytes @@ -100,7 +100,7 @@ y = 0 rept \1 x = \1 * (\2 +- 1) + y rept \2 - dw OverworldMap tile x + dw wOverworldMap tile x x = x +- \2 endr y = y + 1 diff --git a/engine/events/prof_oaks_pc.asm b/engine/events/prof_oaks_pc.asm index ae84a43a5..5dca38efe 100755 --- a/engine/events/prof_oaks_pc.asm +++ b/engine/events/prof_oaks_pc.asm @@ -33,12 +33,12 @@ ProfOaksPCRating: ; 0x26601 Rate: ; 0x26616 ; calculate Seen/Owned - ld hl, PokedexSeen - ld b, EndPokedexSeen - PokedexSeen + ld hl, wPokedexSeen + ld b, wEndPokedexSeen - wPokedexSeen call CountSetBits ld [wd002], a - ld hl, PokedexCaught - ld b, EndPokedexCaught - PokedexCaught + ld hl, wPokedexCaught + ld b, wEndPokedexCaught - wPokedexCaught call CountSetBits ld [wd003], a @@ -56,10 +56,10 @@ Rate: ; 0x26616 ret .UpdateRatingBuffers: ; 0x26647 - ld hl, StringBuffer3 + ld hl, wStringBuffer3 ld de, wd002 call .UpdateRatingBuffer - ld hl, StringBuffer4 + ld hl, wStringBuffer4 ld de, wd003 call .UpdateRatingBuffer ret diff --git a/engine/events/sacred_ash.asm b/engine/events/sacred_ash.asm index 65ed83438..cf305355a 100755 --- a/engine/events/sacred_ash.asm +++ b/engine/events/sacred_ash.asm @@ -14,9 +14,9 @@ _SacredAsh: ; 507e6 CheckAnyFaintedMon: ; 507fb ld de, PARTYMON_STRUCT_LENGTH - ld bc, PartySpecies - ld hl, PartyMon1HP - ld a, [PartyCount] + ld bc, wPartySpecies + ld hl, wPartyMon1HP + ld a, [wPartyCount] and a ret z diff --git a/engine/events/special.asm b/engine/events/special.asm index 128e7af29..081606512 100755 --- a/engine/events/special.asm +++ b/engine/events/special.asm @@ -4,13 +4,13 @@ Special_GiveShuckle: ; 7305 ; Adding to the party. xor a - ld [MonType], a + ld [wMonType], a ; Level 15 Shuckle. ld a, SHUCKLE - ld [CurPartySpecies], a + ld [wCurPartySpecies], a ld a, 15 - ld [CurPartyLevel], a + ld [wCurPartyLevel], a predef TryAddMonToParty jr nc, .NotGiven @@ -21,35 +21,35 @@ Special_GiveShuckle: ; 7305 ; Holding a Berry. ld bc, PARTYMON_STRUCT_LENGTH - ld a, [PartyCount] + ld a, [wPartyCount] dec a push af push bc - ld hl, PartyMon1Item + ld hl, wPartyMon1Item call AddNTimes ld [hl], BERRY pop bc pop af ; OT ID. - ld hl, PartyMon1ID + ld hl, wPartyMon1ID call AddNTimes ld a, HIGH(MANIA_OT_ID) ld [hli], a ld [hl], LOW(MANIA_OT_ID) ; Nickname. - ld a, [PartyCount] + ld a, [wPartyCount] dec a - ld hl, PartyMonNicknames + ld hl, wPartyMonNicknames call SkipNames ld de, SpecialShuckleNick call CopyName2 ; OT. - ld a, [PartyCount] + ld a, [wPartyCount] dec a - ld hl, PartyMonOT + ld hl, wPartyMonOT call SkipNames ld de, SpecialShuckleOT call CopyName2 @@ -58,12 +58,12 @@ Special_GiveShuckle: ; 7305 ld hl, wDailyFlags set 5, [hl] ; ENGINE_SHUCKLE_GIVEN ld a, 1 - ld [ScriptVar], a + ld [wScriptVar], a ret .NotGiven: xor a - ld [ScriptVar], a + ld [wScriptVar], a ret SpecialShuckleOT: @@ -75,12 +75,12 @@ Special_ReturnShuckle: ; 737e farcall SelectMonFromParty jr c, .refused - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] cp SHUCKLE jr nz, .DontReturn - ld a, [CurPartyMon] - ld hl, PartyMon1ID + ld a, [wCurPartyMon] + ld hl, wPartyMon1ID ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes @@ -93,8 +93,8 @@ Special_ReturnShuckle: ; 737e jr nz, .DontReturn ; OT - ld a, [CurPartyMon] - ld hl, PartyMonOT + ld a, [wCurPartyMon] + ld hl, wPartyMonOT call SkipNames ld de, SpecialShuckleOT .CheckOT: @@ -110,8 +110,8 @@ Special_ReturnShuckle: ; 737e .done farcall CheckCurPartyMonFainted jr c, .fainted - ld a, [CurPartyMon] - ld hl, PartyMon1Happiness + ld a, [wCurPartyMon] + ld hl, wPartyMon1Happiness ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes ld a, [hl] @@ -123,36 +123,36 @@ Special_ReturnShuckle: ; 737e callfar RemoveMonFromPartyOrBox ld a, SHUCKIE_RETURNED .HappyToStayWithYou: - ld [ScriptVar], a + ld [wScriptVar], a ret .refused ld a, SHUCKIE_REFUSED - ld [ScriptVar], a + ld [wScriptVar], a ret .DontReturn: xor a ; SHUCKIE_WRONG_MON - ld [ScriptVar], a + ld [wScriptVar], a ret .fainted ld a, SHUCKIE_FAINTED - ld [ScriptVar], a + ld [wScriptVar], a ret Special_BillsGrandfather: ; 73f7 farcall SelectMonFromParty jr c, .cancel - ld a, [CurPartySpecies] - ld [ScriptVar], a + ld a, [wCurPartySpecies] + ld [wScriptVar], a ld [wNamedObjectIndexBuffer], a call GetPokemonName jp CopyPokemonName_Buffer1_Buffer3 .cancel xor a - ld [ScriptVar], a + ld [wScriptVar], a ret Special_YoungerHaircutBrother: ; 7413 @@ -171,7 +171,7 @@ MassageOrHaircut: ; 7420 farcall SelectMonFromParty pop hl jr c, .nope - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] cp EGG jr z, .egg push hl @@ -197,19 +197,19 @@ MassageOrHaircut: ; 7420 .ok inc hl ld a, [hli] - ld [ScriptVar], a + ld [wScriptVar], a ld c, [hl] call ChangeHappiness ret .nope xor a - ld [ScriptVar], a + ld [wScriptVar], a ret .egg ld a, 1 - ld [ScriptVar], a + ld [wScriptVar], a ret Data_YoungerHaircutBrother: ; 7459 @@ -226,8 +226,8 @@ Data_DaisyMassage: ; 746b db $ff, 2, HAPPINESS_MASSAGE ; 99.6% chance CopyPokemonName_Buffer1_Buffer3: ; 746e - ld hl, StringBuffer1 - ld de, StringBuffer3 + ld hl, wStringBuffer1 + ld de, wStringBuffer3 ld bc, MON_NAME_LENGTH jp CopyBytes diff --git a/engine/events/squirtbottle.asm b/engine/events/squirtbottle.asm index 1134f1bb0..f6ab00951 100755 --- a/engine/events/squirtbottle.asm +++ b/engine/events/squirtbottle.asm @@ -21,11 +21,11 @@ _Squirtbottle: ; 50730 db "@" .CheckCanUseSquirtbottle: - ld a, [MapGroup] + ld a, [wMapGroup] cp GROUP_ROUTE_36 jr nz, .nope - ld a, [MapNumber] + ld a, [wMapNumber] cp MAP_ROUTE_36 jr nz, .nope @@ -37,11 +37,11 @@ _Squirtbottle: ; 50730 jr nz, .nope ld a, 1 - ld [ScriptVar], a + ld [wScriptVar], a ret .nope xor a - ld [ScriptVar], a + ld [wScriptVar], a ret ; 50779 diff --git a/engine/events/sweet_scent.asm b/engine/events/sweet_scent.asm index 9b75eb9b8..2f1759a2b 100755 --- a/engine/events/sweet_scent.asm +++ b/engine/events/sweet_scent.asm @@ -52,13 +52,13 @@ SweetScentEncounter: ; 506ef .start_battle ld a, $1 - ld [ScriptVar], a + ld [wScriptVar], a ret .no_battle xor a - ld [ScriptVar], a - ld [BattleType], a + ld [wScriptVar], a + ld [wBattleType], a ret ; 50726 diff --git a/engine/events/trainer_scripts.asm b/engine/events/trainer_scripts.asm index 212cd7f28..abfcd8dee 100644 --- a/engine/events/trainer_scripts.asm +++ b/engine/events/trainer_scripts.asm @@ -11,7 +11,7 @@ SeenByTrainerScript:: ; 0xbe675 encountermusic showemote EMOTE_SHOCK, LAST_TALKED, 30 callasm TrainerWalkToPlayer - applymovement2 MovementBuffer + applymovement2 wMovementBuffer writeobjectxy LAST_TALKED faceobject PLAYER, LAST_TALKED jump StartBattleWithMapTrainerScript diff --git a/engine/events/treemons.asm b/engine/events/treemons.asm index 780fef2cc..6d55004f4 100755 --- a/engine/events/treemons.asm +++ b/engine/events/treemons.asm @@ -2,8 +2,8 @@ TreeMonEncounter: ; b81ea farcall StubbedTrainerRankings_TreeEncounters xor a - ld [TempWildMonSpecies], a - ld [CurPartyLevel], a + ld [wTempWildMonSpecies], a + ld [wCurPartyLevel], a ld hl, TreeMonMaps call GetTreeMonSet @@ -16,22 +16,22 @@ TreeMonEncounter: ; b81ea jr nc, .no_battle ld a, BATTLETYPE_TREE - ld [BattleType], a + ld [wBattleType], a ld a, 1 - ld [ScriptVar], a + ld [wScriptVar], a ret .no_battle xor a - ld [ScriptVar], a + ld [wScriptVar], a ret ; b8219 RockMonEncounter: ; b8219 xor a - ld [TempWildMonSpecies], a - ld [CurPartyLevel], a + ld [wTempWildMonSpecies], a + ld [wCurPartyLevel], a ld hl, RockMonMaps call GetTreeMonSet @@ -61,9 +61,9 @@ RockMonEncounter: ; b8219 GetTreeMonSet: ; b823f ; Return carry and treemon set in a ; if the current map is in table hl. - ld a, [MapNumber] + ld a, [wMapNumber] ld e, a - ld a, [MapGroup] + ld a, [wMapGroup] ld d, a .loop ld a, [hli] @@ -189,26 +189,26 @@ SelectTreeMon: ; b841f jr z, NoTreeMon ld a, [hli] - ld [TempWildMonSpecies], a + ld [wTempWildMonSpecies], a ld a, [hl] - ld [CurPartyLevel], a + ld [wCurPartyLevel], a scf ret NoTreeMon: ; b843b xor a - ld [TempWildMonSpecies], a - ld [CurPartyLevel], a + ld [wTempWildMonSpecies], a + ld [wCurPartyLevel], a ret ; b8443 GetTreeScore: ; b8443 call .CoordScore - ld [Buffer1], a + ld [wBuffer1], a call .OTIDScore - ld [Buffer2], a + ld [wBuffer2], a ld c, a - ld a, [Buffer1] + ld a, [wBuffer1] sub c jr z, .rare jr nc, .ok @@ -272,9 +272,9 @@ GetTreeScore: ; b8443 ; b849d .OTIDScore: ; b849d - ld a, [PlayerID] + ld a, [wPlayerID] ld [hDividend], a - ld a, [PlayerID + 1] + ld a, [wPlayerID + 1] ld [hDividend + 1], a ld a, 10 ld [hDivisor], a diff --git a/engine/events/unown_walls.asm b/engine/events/unown_walls.asm index 4d59a2f7a..5cc241966 100644 --- a/engine/events/unown_walls.asm +++ b/engine/events/unown_walls.asm @@ -1,5 +1,5 @@ Special_HoOhChamber: ; 0x8addb - ld hl, PartySpecies + ld hl, wPartySpecies ld a, [hl] cp HO_OH ; is Ho-oh the first Pokémon in the party? jr nz, .done ; if not, we're done @@ -21,12 +21,12 @@ Special_OmanyteChamber: ; 8adef jr nz, .nope ld a, WATER_STONE - ld [CurItem], a - ld hl, NumItems + ld [wCurItem], a + ld hl, wNumItems call CheckItem jr c, .open - ld a, [PartyCount] + ld a, [wPartyCount] ld b, a inc b .loop @@ -34,7 +34,7 @@ Special_OmanyteChamber: ; 8adef jr z, .nope ld a, b dec a - ld [CurPartyMon], a + ld [wCurPartyMon], a push bc ld a, MON_ITEM call GetPartyParamLocation @@ -104,7 +104,7 @@ SpecialKabutoChamber: ; 8ae4e ; 8ae68 Special_DisplayUnownWords: ; 8ae68 - ld a, [ScriptVar] + ld a, [wScriptVar] ld hl, MenuDataHeaders_UnownWalls and a jr z, .load @@ -129,7 +129,7 @@ Special_DisplayUnownWords: ; 8ae68 ld e, SCREEN_WIDTH add hl, de add hl, de - ld a, [ScriptVar] + ld a, [wScriptVar] ld c, a ld de, UnownWalls and a @@ -143,7 +143,7 @@ Special_DisplayUnownWords: ; 8ae68 jr nz, .loop2 .copy call _DisplayUnownWords_CopyWord - ld bc, AttrMap - TileMap + ld bc, wAttrMap - wTileMap add hl, bc call _DisplayUnownWords_FillAttr call WaitBGMap2 diff --git a/engine/events/whiteout.asm b/engine/events/whiteout.asm index aa629682f..4adef9f4f 100755 --- a/engine/events/whiteout.asm +++ b/engine/events/whiteout.asm @@ -52,7 +52,7 @@ HalveMoney: ; 12513 farcall StubbedTrainerRankings_WhiteOuts ; Halve the player's money. - ld hl, Money + ld hl, wMoney ld a, [hl] srl a ld [hli], a @@ -77,6 +77,6 @@ GetWhiteoutSpawn: ; 12527 xor a ; SPAWN_HOME .yes - ld [DefaultSpawnpoint], a + ld [wDefaultSpawnpoint], a ret ; 1253d diff --git a/engine/events_2.asm b/engine/events_2.asm index 1149c2431..b43ebdd6a 100644 --- a/engine/events_2.asm +++ b/engine/events_2.asm @@ -52,7 +52,7 @@ LoadScriptBDE:: ; 97c4f TryTileCollisionEvent:: ; 97c5f call GetFacingTileCoord - ld [EngineBuffer1], a + ld [wEngineBuffer1], a ld c, a farcall CheckFacingTileForStdScript jr c, .done @@ -63,21 +63,21 @@ TryTileCollisionEvent:: ; 97c5f jr .done .whirlpool - ld a, [EngineBuffer1] + ld a, [wEngineBuffer1] call CheckWhirlpoolTile jr nz, .waterfall farcall TryWhirlpoolOW jr .done .waterfall - ld a, [EngineBuffer1] + ld a, [wEngineBuffer1] call CheckWaterfallTile jr nz, .headbutt farcall TryWaterfallOW jr .done .headbutt - ld a, [EngineBuffer1] + ld a, [wEngineBuffer1] call CheckHeadbuttTreeTile jr nz, .surf farcall TryHeadbuttOW @@ -161,7 +161,7 @@ CanUseSweetScent:: ; 97cfd jr nc, .no .ice_check - ld a, [PlayerStandingTile] + ld a, [wPlayerStandingTile] call CheckIceTile jr z, .no scf @@ -202,7 +202,7 @@ ChooseWildEncounter_BugContest:: ; 97d31 ; Species ld a, [hli] - ld [TempWildMonSpecies], a + ld [wTempWildMonSpecies], a ; Min level ld a, [hli] @@ -228,14 +228,14 @@ ChooseWildEncounter_BugContest:: ; 97d31 add d .GotLevel: - ld [CurPartyLevel], a + ld [wCurPartyLevel], a xor a ret ; 97d64 TryWildEncounter_BugContest: ; 97d64 - ld a, [PlayerStandingTile] + ld a, [wPlayerStandingTile] call CheckSuperTallGrassTile ld b, 40 percent jr z, .ok @@ -268,7 +268,7 @@ DoBikeStep:: ; 97db3 jr z, .NoCall ; If we're not on the bike, we don't have to be here. - ld a, [PlayerState] + ld a, [wPlayerState] cp PLAYER_BIKE jr nz, .NoCall @@ -594,7 +594,7 @@ CmdQueue_Type3: ; 97ef9 .IsPlayerFacingDown: ; 97f38 push bc - ld bc, PlayerStruct + ld bc, wPlayerStruct call GetSpriteDirection and a pop bc @@ -602,7 +602,7 @@ CmdQueue_Type3: ; 97ef9 ; 97f42 CmdQueue_StoneTable: ; 97f42 - ld de, PlayerStruct + ld de, wPlayerStruct ld a, NUM_OBJECT_STRUCTS .loop push af diff --git a/engine/evolution_animation.asm b/engine/evolution_animation.asm index 2e6e82e25..e78423ef1 100755 --- a/engine/evolution_animation.asm +++ b/engine/evolution_animation.asm @@ -2,21 +2,21 @@ EvolutionAnimation: ; 4e5e1 push hl push de push bc - ld a, [CurSpecies] + ld a, [wCurSpecies] push af ld a, [rOBP0] push af - ld a, [BaseDexNo] + ld a, [wBaseDexNo] push af call .EvolutionAnimation pop af - ld [BaseDexNo], a + ld [wBaseDexNo], a pop af ld [rOBP0], a pop af - ld [CurSpecies], a + ld [wCurSpecies], a pop bc pop de pop hl @@ -44,18 +44,18 @@ EvolutionAnimation: ; 4e5e1 call Request2bpp xor a - ld [Danger], a + ld [wLowHealthAlarm], a call WaitBGMap xor a ld [hBGMapMode], a ld a, [wEvolutionOldSpecies] - ld [PlayerHPPal], a + ld [wPlayerHPPal], a ld c, $0 call .GetSGBLayout ld a, [wEvolutionOldSpecies] - ld [CurPartySpecies], a - ld [CurSpecies], a + ld [wCurPartySpecies], a + ld [wCurSpecies], a call .PlaceFrontpic ld de, vTiles2 @@ -67,12 +67,12 @@ EvolutionAnimation: ; 4e5e1 ld [wEvolutionPicOffset], a call .ReplaceFrontpic ld a, [wEvolutionNewSpecies] - ld [CurPartySpecies], a - ld [CurSpecies], a + ld [wCurPartySpecies], a + ld [wCurSpecies], a call .LoadFrontpic ld a, [wEvolutionOldSpecies] - ld [CurPartySpecies], a - ld [CurSpecies], a + ld [wCurPartySpecies], a + ld [wCurSpecies], a ld a, $1 ld [hBGMapMode], a @@ -101,7 +101,7 @@ EvolutionAnimation: ; 4e5e1 ld [wEvolutionCanceled], a ld a, [wEvolutionNewSpecies] - ld [PlayerHPPal], a + ld [wPlayerHPPal], a ld c, $0 call .GetSGBLayout @@ -114,18 +114,18 @@ EvolutionAnimation: ; 4e5e1 push af ld a, $1 ld [wBoxAlignment], a - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] push af - ld a, [PlayerHPPal] - ld [CurPartySpecies], a + ld a, [wPlayerHPPal] + ld [wCurPartySpecies], a hlcoord 7, 2 ld d, $0 ld e, ANIM_MON_EVOLVE predef AnimateFrontpic pop af - ld [CurPartySpecies], a + ld [wCurPartySpecies], a pop af ld [wBoxAlignment], a ret @@ -138,7 +138,7 @@ EvolutionAnimation: ; 4e5e1 ld [wEvolutionCanceled], a ld a, [wEvolutionOldSpecies] - ld [PlayerHPPal], a + ld [wPlayerHPPal], a ld c, $0 call .GetSGBLayout @@ -147,7 +147,7 @@ EvolutionAnimation: ; 4e5e1 call .check_statused ret c - ld a, [PlayerHPPal] + ld a, [wPlayerHPPal] call PlayMonCry ret ; 4e703 @@ -258,8 +258,8 @@ EvolutionAnimation: ; 4e5e1 ; 4e794 .check_statused ; 4e794 - ld a, [CurPartyMon] - ld hl, PartyMon1Species + ld a, [wCurPartyMon] + ld hl, wPartyMon1Species call GetPartyLocation ld b, h ld c, l @@ -346,7 +346,7 @@ EvolutionAnimation: ; 4e5e1 inc a and $7 ld b, a - ld hl, Sprite01Attributes + ld hl, wVirtualOAMSprite00Attributes ld c, NUM_SPRITE_OAM_STRUCTS .loop6 ld a, [hl] diff --git a/engine/evolve.asm b/engine/evolve.asm index 2e72320d4..5fb5aff46 100755 --- a/engine/evolve.asm +++ b/engine/evolve.asm @@ -1,8 +1,8 @@ EvolvePokemon: ; 421d8 - ld hl, EvolvableFlags + ld hl, wEvolvableFlags xor a ld [hl], a - ld a, [CurPartyMon] + ld a, [wCurPartyMon] ld c, a ld b, SET_FLAG call EvoFlagAction @@ -10,16 +10,16 @@ EvolveAfterBattle: ; 421e6 xor a ld [wMonTriedToEvolve], a dec a - ld [CurPartyMon], a + ld [wCurPartyMon], a push hl push bc push de - ld hl, PartyCount + ld hl, wPartyCount push hl EvolveAfterBattle_MasterLoop - ld hl, CurPartyMon + ld hl, wCurPartyMon inc [hl] pop hl @@ -32,9 +32,9 @@ EvolveAfterBattle_MasterLoop ld [wEvolutionOldSpecies], a push hl - ld a, [CurPartyMon] + ld a, [wCurPartyMon] ld c, a - ld hl, EvolvableFlags + ld hl, wEvolvableFlags ld b, CHECK_FLAG call EvoFlagAction ld a, c @@ -54,7 +54,7 @@ EvolveAfterBattle_MasterLoop push hl xor a - ld [MonType], a + ld [wMonType], a predef CopyPkmnToTempMon pop hl @@ -89,7 +89,7 @@ EvolveAfterBattle_MasterLoop ; EVOLVE_STAT - ld a, [TempMonLevel] + ld a, [wTempMonLevel] cp [hl] jp c, .dont_evolve_1 @@ -97,8 +97,8 @@ EvolveAfterBattle_MasterLoop jp z, .dont_evolve_1 push hl - ld de, TempMonAttack - ld hl, TempMonDefense + ld de, wTempMonAttack + ld hl, wTempMonDefense ld c, 2 call StringCmp ld a, ATK_EQ_DEF @@ -118,7 +118,7 @@ EvolveAfterBattle_MasterLoop .happiness - ld a, [TempMonHappiness] + ld a, [wTempMonHappiness] cp HAPPINESS_TO_EVOLVE jp c, .dont_evolve_2 @@ -132,13 +132,13 @@ EvolveAfterBattle_MasterLoop jr z, .happiness_daylight ; TR_NITE - ld a, [TimeOfDay] + ld a, [wTimeOfDay] cp NITE_F jp nz, .dont_evolve_3 jr .proceed .happiness_daylight - ld a, [TimeOfDay] + ld a, [wTimeOfDay] cp NITE_F jp z, .dont_evolve_3 jr .proceed @@ -161,19 +161,19 @@ EvolveAfterBattle_MasterLoop cp LINK_TIMECAPSULE jp z, .dont_evolve_3 - ld a, [TempMonItem] + ld a, [wTempMonItem] cp b jp nz, .dont_evolve_3 xor a - ld [TempMonItem], a + ld [wTempMonItem], a jr .proceed .item ld a, [hli] ld b, a - ld a, [CurItem] + ld a, [wCurItem] cp b jp nz, .dont_evolve_3 @@ -189,15 +189,15 @@ EvolveAfterBattle_MasterLoop .level ld a, [hli] ld b, a - ld a, [TempMonLevel] + ld a, [wTempMonLevel] cp b jp c, .dont_evolve_3 call IsMonHoldingEverstone jp z, .dont_evolve_3 .proceed - ld a, [TempMonLevel] - ld [CurPartyLevel], a + ld a, [wTempMonLevel] + ld [wCurPartyLevel], a ld a, $1 ld [wMonTriedToEvolve], a @@ -205,8 +205,8 @@ EvolveAfterBattle_MasterLoop ld a, [hl] ld [wEvolutionNewSpecies], a - ld a, [CurPartyMon] - ld hl, PartyMonNicknames + ld a, [wCurPartyMon] + ld hl, wPartyMonNicknames call GetNick call CopyName1 ld hl, Text_WhatEvolving @@ -238,8 +238,8 @@ EvolveAfterBattle_MasterLoop pop hl ld a, [hl] - ld [CurSpecies], a - ld [TempMonSpecies], a + ld [wCurSpecies], a + ld [wTempMonSpecies], a ld [wEvolutionNewSpecies], a ld [wd265], a call GetPokemonName @@ -262,13 +262,13 @@ EvolveAfterBattle_MasterLoop call UpdateSpeciesNameIfNotNicknamed call GetBaseData - ld hl, TempMonExp + 2 - ld de, TempMonMaxHP + ld hl, wTempMonExp + 2 + ld de, wTempMonMaxHP ld b, $1 predef CalcPkmnStats - ld a, [CurPartyMon] - ld hl, PartyMons + ld a, [wCurPartyMon] + ld hl, wPartyMons ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes ld e, l @@ -278,14 +278,14 @@ EvolveAfterBattle_MasterLoop ld a, [hli] ld b, a ld c, [hl] - ld hl, TempMonMaxHP + 1 + ld hl, wTempMonMaxHP + 1 ld a, [hld] sub c ld c, a ld a, [hl] sbc b ld b, a - ld hl, TempMonHP + 1 + ld hl, wTempMonHP + 1 ld a, [hl] add c ld [hld], a @@ -293,14 +293,14 @@ EvolveAfterBattle_MasterLoop adc b ld [hl], a - ld hl, TempMonSpecies + ld hl, wTempMonSpecies ld bc, PARTYMON_STRUCT_LENGTH call CopyBytes - ld a, [CurSpecies] + ld a, [wCurSpecies] ld [wd265], a xor a - ld [MonType], a + ld [wMonType], a call LearnLevelMoves ld a, [wd265] dec a @@ -310,14 +310,14 @@ EvolveAfterBattle_MasterLoop cp UNOWN jr nz, .skip_unown - ld hl, TempMonDVs + ld hl, wTempMonDVs predef GetUnownLetter callfar UpdateUnownDex .skip_unown pop de pop hl - ld a, [TempMonSpecies] + ld a, [wTempMonSpecies] ld [hl], a push hl ld l, e @@ -352,15 +352,15 @@ EvolveAfterBattle_MasterLoop ; 42414 UpdateSpeciesNameIfNotNicknamed: ; 42414 - ld a, [CurSpecies] + ld a, [wCurSpecies] push af - ld a, [BaseDexNo] + ld a, [wBaseDexNo] ld [wd265], a call GetPokemonName pop af - ld [CurSpecies], a - ld hl, StringBuffer1 - ld de, StringBuffer2 + ld [wCurSpecies], a + ld hl, wStringBuffer1 + ld de, wStringBuffer2 .loop ld a, [de] inc de @@ -370,15 +370,15 @@ UpdateSpeciesNameIfNotNicknamed: ; 42414 cp "@" jr nz, .loop - ld a, [CurPartyMon] + ld a, [wCurPartyMon] ld bc, MON_NAME_LENGTH - ld hl, PartyMonNicknames + ld hl, wPartyMonNicknames call AddNTimes push hl - ld a, [CurSpecies] + ld a, [wCurSpecies] ld [wd265], a call GetPokemonName - ld hl, StringBuffer1 + ld hl, wStringBuffer1 pop de ld bc, MON_NAME_LENGTH jp CopyBytes @@ -394,8 +394,8 @@ CancelEvolution: ; 42454 IsMonHoldingEverstone: ; 42461 push hl - ld a, [CurPartyMon] - ld hl, PartyMon1Item + ld a, [wCurPartyMon] + ld hl, wPartyMon1Item ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes ld a, [hl] @@ -431,7 +431,7 @@ Text_WhatEvolving: ; 0x42482 LearnLevelMoves: ; 42487 ld a, [wd265] - ld [CurPartySpecies], a + ld [wCurPartySpecies], a dec a ld b, 0 ld c, a @@ -453,15 +453,15 @@ LearnLevelMoves: ; 42487 jr z, .done ld b, a - ld a, [CurPartyLevel] + ld a, [wCurPartyLevel] cp b ld a, [hli] jr nz, .find_move push hl ld d, a - ld hl, PartyMon1Moves - ld a, [CurPartyMon] + ld hl, wPartyMon1Moves + ld a, [wCurPartyMon] ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes @@ -489,21 +489,21 @@ LearnLevelMoves: ; 42487 jr .find_move .done - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] ld [wd265], a ret ; 424e1 FillMoves: ; 424e1 -; Fill in moves at de for CurPartySpecies at CurPartyLevel +; Fill in moves at de for wCurPartySpecies at wCurPartyLevel push hl push de push bc ld hl, EvosAttacksPointers ld b, 0 - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] dec a add a rl b @@ -527,7 +527,7 @@ FillMoves: ; 424e1 and a jp z, .done ld b, a - ld a, [CurPartyLevel] + ld a, [wCurPartyLevel] cp b jp c, .done ld a, [wEvolutionOldSpecies] @@ -567,7 +567,7 @@ FillMoves: ; 424e1 and a jr z, .ShiftedMove push de - ld bc, PartyMon1PP - (PartyMon1Moves + NUM_MOVES - 1) + ld bc, wPartyMon1PP - (wPartyMon1Moves + NUM_MOVES - 1) add hl, bc ld d, h ld e, l @@ -627,9 +627,9 @@ EvoFlagAction: ; 42577 ; 42581 GetPreEvolution: ; 42581 -; Find the first mon to evolve into CurPartySpecies. +; Find the first mon to evolve into wCurPartySpecies. -; Return carry and the new species in CurPartySpecies +; Return carry and the new species in wCurPartySpecies ; if a pre-evolution is found. ld c, 0 @@ -644,14 +644,14 @@ GetPreEvolution: ; 42581 .loop2 ; For each evolution... ld a, [hli] and a - jr z, .no_evolve ; If we jump, this Pokemon does not evolve into CurPartySpecies. + jr z, .no_evolve ; If we jump, this Pokemon does not evolve into wCurPartySpecies. cp EVOLVE_STAT ; This evolution type has the extra parameter of stat comparison. jr nz, .not_tyrogue inc hl .not_tyrogue inc hl - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] cp [hl] jr z, .found_preevo inc hl @@ -670,7 +670,7 @@ GetPreEvolution: ; 42581 .found_preevo inc c ld a, c - ld [CurPartySpecies], a + ld [wCurPartySpecies], a scf ret ; 425b1 diff --git a/engine/experience.asm b/engine/experience.asm index b1e1fb831..6b94ed357 100644 --- a/engine/experience.asm +++ b/engine/experience.asm @@ -1,6 +1,6 @@ CalcLevel: ; 50e1b - ld a, [TempMonSpecies] - ld [CurSpecies], a + ld a, [wTempMonSpecies] + ld [wCurSpecies], a call GetBaseData ld d, 1 .next_level @@ -10,7 +10,7 @@ CalcLevel: ; 50e1b jr z, .got_level call CalcExpAtLevel push hl - ld hl, TempMonExp + 2 + ld hl, wTempMonExp + 2 ld a, [hProduct + 3] ld c, a ld a, [hld] @@ -32,7 +32,7 @@ CalcLevel: ; 50e1b CalcExpAtLevel: ; 50e47 ; (a/b)*n**3 + c*n**2 + d*n - e - ld a, [BaseGrowthRate] + ld a, [wBaseGrowthRate] add a add a ld c, a diff --git a/engine/health.asm b/engine/health.asm index 0f7ba156d..cc47e8252 100755 --- a/engine/health.asm +++ b/engine/health.asm @@ -1,7 +1,7 @@ HealParty: ; c658 xor a - ld [CurPartyMon], a - ld hl, PartySpecies + ld [wCurPartyMon], a + ld hl, wPartySpecies .loop ld a, [hli] cp -1 @@ -14,9 +14,9 @@ HealParty: ; c658 pop hl .next - ld a, [CurPartyMon] + ld a, [wCurPartyMon] inc a - ld [CurPartyMon], a + ld [wCurPartyMon], a jr .loop .done diff --git a/engine/init_gender.asm b/engine/init_gender.asm index 76b1640d9..945e9f61f 100755 --- a/engine/init_gender.asm +++ b/engine/init_gender.asm @@ -65,11 +65,11 @@ TextJump_AreYouABoyOrAreYouAGirl: ; 0x48e0f InitGenderScreen: ; 48e14 (12:4e14) ld a, $10 - ld [MusicFade], a + ld [wMusicFade], a ld a, MUSIC_NONE - ld [MusicFadeID], a + ld [wMusicFadeID], a ld a, $0 - ld [MusicFadeID + 1], a + ld [wMusicFadeID + 1], a ld c, 8 call DelayFrames call ClearBGPalettes @@ -79,7 +79,7 @@ InitGenderScreen: ; 48e14 (12:4e14) ld bc, SCREEN_HEIGHT * SCREEN_WIDTH ld a, $0 call ByteFill - hlcoord 0, 0, AttrMap + hlcoord 0, 0, wAttrMap ld bc, SCREEN_HEIGHT * SCREEN_WIDTH xor a call ByteFill diff --git a/engine/init_hof_credits.asm b/engine/init_hof_credits.asm index d8eb7670a..e8e98a0e1 100644 --- a/engine/init_hof_credits.asm +++ b/engine/init_hof_credits.asm @@ -9,7 +9,7 @@ InitDisplayForHallOfFame: ; 4e881 ld bc, vBGMap1 - vBGMap0 ld a, " " call ByteFill - hlcoord 0, 0, AttrMap + hlcoord 0, 0, wAttrMap ld bc, SCREEN_WIDTH * SCREEN_HEIGHT xor a call ByteFill @@ -39,7 +39,7 @@ InitDisplayForRedCredits: ; 4e8c2 ld bc, vBGMap1 - vBGMap0 ld a, " " call ByteFill - hlcoord 0, 0, AttrMap + hlcoord 0, 0, wAttrMap ld bc, SCREEN_WIDTH * SCREEN_HEIGHT xor a call ByteFill diff --git a/engine/init_map.asm b/engine/init_map.asm index 0ea2379d2..2eb4998a6 100644 --- a/engine/init_map.asm +++ b/engine/init_map.asm @@ -16,7 +16,7 @@ ReanchorBGMap_NoOAMUpdate:: ; 6454 ld [hBGMapMode], a pop af ld [hOAMUpdate], a - ld hl, VramState + ld hl, wVramState set 6, [hl] ret diff --git a/engine/intro_menu.asm b/engine/intro_menu.asm index a26ac1f81..74daec6d8 100755 --- a/engine/intro_menu.asm +++ b/engine/intro_menu.asm @@ -78,7 +78,7 @@ NewGame: ; 5b6b ld [wPreviousLandmark], a ld a, SPAWN_HOME - ld [DefaultSpawnpoint], a + ld [wDefaultSpawnpoint], a ld a, MAPSETUP_WARP ld [hMapEntryMethod], a @@ -106,8 +106,8 @@ ResetWRAM: ; 5ba7 _ResetWRAM: ; 5bae - ld hl, Sprites - ld bc, Options - Sprites + ld hl, wVirtualOAM + ld bc, wOptions - wVirtualOAM xor a call ByteFill @@ -125,13 +125,13 @@ _ResetWRAM: ; 5bae ld [hSecondsBackup], a call DelayFrame ld a, [hRandomSub] - ld [PlayerID], a + ld [wPlayerID], a ld a, [rLY] ld [hSecondsBackup], a call DelayFrame ld a, [hRandomAdd] - ld [PlayerID + 1], a + ld [wPlayerID + 1], a call Random ld [wSecretID], a @@ -139,7 +139,7 @@ _ResetWRAM: ; 5bae call Random ld [wSecretID + 1], a - ld hl, PartyCount + ld hl, wPartyCount call .InitList xor a @@ -154,16 +154,16 @@ _ResetWRAM: ; 5bae call .InitList call CloseSRAM - ld hl, NumItems + ld hl, wNumItems call .InitList - ld hl, NumKeyItems + ld hl, wNumKeyItems call .InitList - ld hl, NumBalls + ld hl, wNumBalls call .InitList - ld hl, PCItems + ld hl, wPCItems call .InitList xor a @@ -191,27 +191,27 @@ _ResetWRAM: ; 5bae call InitializeMagikarpHouse xor a - ld [MonType], a + ld [wMonType], a ld [wJohtoBadges], a ld [wKantoBadges], a - ld [Coins], a - ld [Coins + 1], a + ld [wCoins], a + ld [wCoins + 1], a if START_MONEY >= $10000 ld a, HIGH(START_MONEY >> 8) endc - ld [Money], a + ld [wMoney], a ld a, HIGH(START_MONEY) ; mid - ld [Money + 1], a + ld [wMoney + 1], a ld a, LOW(START_MONEY) - ld [Money + 2], a + ld [wMoney + 2], a xor a ld [wWhichMomItem], a - ld hl, MomItemTriggerBalance + ld hl, wMomItemTriggerBalance ld [hl], HIGH(MOM_MONEY >> 8) inc hl ld [hl], HIGH(MOM_MONEY) ; mid @@ -289,19 +289,19 @@ InitializeMagikarpHouse: ; 5cd3 InitializeNPCNames: ; 5ce9 ld hl, .Rival - ld de, RivalName + ld de, wRivalName call .Copy ld hl, .Mom - ld de, MomsName + ld de, wMomsName call .Copy ld hl, .Red - ld de, RedsName + ld de, wRedsName call .Copy ld hl, .Green - ld de, GreensName + ld de, wGreensName .Copy: ld bc, NAME_LENGTH @@ -324,7 +324,7 @@ InitializeWorld: ; 5d23 LoadOrRegenerateLuckyIDNumber: ; 5d33 ld a, BANK(sLuckyIDNumber) call GetSRAMBank - ld a, [CurDay] + ld a, [wCurDay] inc a ld b, a ld a, [sLuckyNumberDay] @@ -371,11 +371,11 @@ Continue: ; 5d65 .Check2Pass: ld a, $8 - ld [MusicFade], a + ld [wMusicFade], a ld a, LOW(MUSIC_NONE) - ld [MusicFadeID], a + ld [wMusicFadeID], a ld a, HIGH(MUSIC_NONE) - ld [MusicFadeID + 1], a + ld [wMusicFadeID + 1], a call ClearBGPalettes call Continue_MobileAdapterMenu call CloseWindow @@ -397,14 +397,14 @@ Continue: ; 5d65 .SpawnAfterE4: ld a, SPAWN_NEW_BARK - ld [DefaultSpawnpoint], a + ld [wDefaultSpawnpoint], a call PostCreditsSpawn jp FinishContinueFunction ; 5de2 SpawnAfterRed: ; 5de2 ld a, SPAWN_MT_SILVER - ld [DefaultSpawnpoint], a + ld [wDefaultSpawnpoint], a ; 5de7 PostCreditsSpawn: ; 5de7 @@ -425,22 +425,22 @@ Continue_MobileAdapterMenu: ; 5df0 bit 1, [hl] ret nz ld a, 5 - ld [MusicFade], a + ld [wMusicFade], a ld a, LOW(MUSIC_MOBILE_ADAPTER_MENU) - ld [MusicFadeID], a + ld [wMusicFadeID], a ld a, HIGH(MUSIC_MOBILE_ADAPTER_MENU) - ld [MusicFadeID + 1], a + ld [wMusicFadeID + 1], a ld c, 20 call DelayFrames ld c, $1 farcall InitMobileProfile ; mobile farcall _SaveData ld a, 8 - ld [MusicFade], a + ld [wMusicFade], a ld a, LOW(MUSIC_NONE) - ld [MusicFadeID], a + ld [wMusicFadeID], a ld a, HIGH(MUSIC_NONE) - ld [MusicFadeID + 1], a + ld [wMusicFadeID + 1], a ld c, 35 call DelayFrames ret @@ -643,7 +643,7 @@ Continue_DisplayPokedexNumCaught: ; 5f6b bit 0, a ; Pokedex ret z push hl - ld hl, PokedexCaught + ld hl, wPokedexCaught if NUM_POKEMON % 8 ld b, NUM_POKEMON / 8 + 1 else @@ -657,12 +657,12 @@ endc ; 5f84 Continue_DisplayGameTime: ; 5f84 - ld de, GameTimeHours + ld de, wGameTimeHours lb bc, 2, 3 call PrintNum ld [hl], "<COLON>" inc hl - ld de, GameTimeMinutes + ld de, wGameTimeMinutes lb bc, PRINTNUM_LEADINGZEROS | 1, 2 jp PrintNum ; 5f99 @@ -679,9 +679,9 @@ OakSpeech: ; 0x5f99 call RotateFourPalettesRight call RotateThreePalettesRight xor a - ld [CurPartySpecies], a + ld [wCurPartySpecies], a ld a, POKEMON_PROF - ld [TrainerClass], a + ld [wTrainerClass], a call Intro_PrepTrainerPic ld b, SCGB_TRAINER_OR_MON_FRONTPIC_PALS @@ -694,16 +694,16 @@ OakSpeech: ; 0x5f99 call ClearTileMap ld a, WOOPER - ld [CurSpecies], a - ld [CurPartySpecies], a + ld [wCurSpecies], a + ld [wCurPartySpecies], a call GetBaseData hlcoord 6, 4 call PrepMonFrontpic xor a - ld [TempMonDVs], a - ld [TempMonDVs + 1], a + ld [wTempMonDVs], a + ld [wTempMonDVs + 1], a ld b, SCGB_TRAINER_OR_MON_FRONTPIC_PALS call GetSGBLayout @@ -717,9 +717,9 @@ OakSpeech: ; 0x5f99 call ClearTileMap xor a - ld [CurPartySpecies], a + ld [wCurPartySpecies], a ld a, POKEMON_PROF - ld [TrainerClass], a + ld [wTrainerClass], a call Intro_PrepTrainerPic ld b, SCGB_TRAINER_OR_MON_FRONTPIC_PALS @@ -732,7 +732,7 @@ OakSpeech: ; 0x5f99 call ClearTileMap xor a - ld [CurPartySpecies], a + ld [wCurPartySpecies], a farcall DrawIntroPlayerPic ld b, SCGB_TRAINER_OR_MON_FRONTPIC_PALS @@ -792,7 +792,7 @@ NamePlayer: ; 0x6074 .NewName: ld b, 1 - ld de, PlayerName + ld de, wPlayerName farcall NamingScreen call RotateThreePalettesRight @@ -802,14 +802,14 @@ NamePlayer: ; 0x6074 call WaitBGMap xor a - ld [CurPartySpecies], a + ld [wCurPartySpecies], a farcall DrawIntroPlayerPic ld b, SCGB_TRAINER_OR_MON_FRONTPIC_PALS call GetSGBLayout call RotateThreePalettesLeft - ld hl, PlayerName + ld hl, wPlayerName ld de, .Chris ld a, [wPlayerGender] bit 0, a @@ -838,10 +838,10 @@ Unreferenced_Function60e9: StorePlayerName: ; 60fa ld a, "@" ld bc, NAME_LENGTH - ld hl, PlayerName + ld hl, wPlayerName call ByteFill - ld hl, PlayerName - ld de, StringBuffer2 + ld hl, wPlayerName + ld de, wStringBuffer2 call CopyName2 ret ; 610f @@ -852,12 +852,12 @@ ShrinkPlayer: ; 610f push af ld a, 32 ; fade time - ld [MusicFade], a + ld [wMusicFade], a ld de, MUSIC_NONE ld a, e - ld [MusicFadeID], a + ld [wMusicFadeID], a ld a, d - ld [MusicFadeID + 1], a + ld [wMusicFadeID + 1], a ld de, SFX_ESCAPE_ROPE call PlaySFX @@ -969,7 +969,7 @@ Intro_PlacePlayerSprite: ; 61cd ld hl, vTiles0 call Request2bpp - ld hl, Sprite01 + ld hl, wVirtualOAMSprite00 ld de, .sprites ld a, [de] inc de @@ -1097,7 +1097,7 @@ Unreferenced_Function6292: ; 6292 ld a, [hVBlankCounter] and $7 ret nz - ld hl, LYOverrides + $5f + ld hl, wLYOverrides + $5f ld a, [hl] dec a ld bc, 2 * SCREEN_WIDTH @@ -1143,7 +1143,7 @@ TitleScreenEntrance: ; 62bc ; Lay out a base (all lines scrolling together). ld e, a - ld hl, LYOverrides + ld hl, wLYOverrides ld bc, 8 * 10 ; logo height call ByteFill @@ -1154,7 +1154,7 @@ TitleScreenEntrance: ; 62bc inc a ld b, 8 * 10 / 2 ; logo height / 2 - ld hl, LYOverrides + 1 + ld hl, wLYOverrides + 1 .loop ld [hli], a inc hl @@ -1279,9 +1279,9 @@ TitleScreenMain: ; 6304 ; Fade out the title screen music xor a - ld [MusicFadeID], a - ld [MusicFadeID + 1], a - ld hl, MusicFade + ld [wMusicFadeID], a + ld [wMusicFadeID + 1], a + ld hl, wMusicFade ld [hl], 8 ; 1 second ld hl, wTitleScreenTimer @@ -1305,7 +1305,7 @@ TitleScreenEnd: ; 6375 ld hl, wTitleScreenTimer inc [hl] - ld a, [MusicFade] + ld a, [wMusicFade] and a ret nz @@ -1333,7 +1333,7 @@ Unreferenced_Function639b: ld a, [wTitleScreenTimer] and %00000011 ret nz - ld bc, SpriteAnim10 + ld bc, wSpriteAnim10 ld hl, SPRITEANIMSTRUCT_FRAME add hl, bc ; over-the-top compicated way to load wc3ae into hl ld l, [hl] diff --git a/engine/item_effects.asm b/engine/item_effects.asm index c2bdd1f61..114b2cb70 100644 --- a/engine/item_effects.asm +++ b/engine/item_effects.asm @@ -1,11 +1,11 @@ _DoItemEffect:: ; e722 - ld a, [CurItem] + ld a, [wCurItem] ld [wd265], a call GetItemName call CopyName1 ld a, 1 ld [wItemEffectSucceeded], a - ld a, [CurItem] + ld a, [wCurItem] dec a ld hl, ItemEffects rst JumpTable @@ -213,7 +213,7 @@ ParkBall: ; e8a2 dec a jp nz, UseBallInTrainerBattle - ld a, [PartyCount] + ld a, [wPartyCount] cp PARTY_LENGTH jr nz, .room_in_party @@ -227,24 +227,24 @@ ParkBall: ; e8a2 .room_in_party xor a ld [wWildMon], a - ld a, [CurItem] + ld a, [wCurItem] cp PARK_BALL call nz, ReturnToBattle_UseBall - ld hl, Options + ld hl, wOptions res NO_TEXT_SCROLL, [hl] ld hl, UsedItemText call PrintText - ld a, [EnemyMonCatchRate] + ld a, [wEnemyMonCatchRate] ld b, a - ld a, [BattleType] + ld a, [wBattleType] cp BATTLETYPE_TUTORIAL jp z, .catch_without_fail - ld a, [CurItem] + ld a, [wCurItem] cp MASTER_BALL jp z, .catch_without_fail - ld a, [CurItem] + ld a, [wCurItem] ld c, a ld hl, BallMultiplierFunctionTable @@ -267,7 +267,7 @@ ParkBall: ; e8a2 jp hl .skip_or_return_from_ball_fn - ld a, [CurItem] + ld a, [wCurItem] cp LEVEL_BALL ld a, b jp z, .skip_hp_calc @@ -275,7 +275,7 @@ ParkBall: ; e8a2 ld a, b ld [hMultiplicand + 2], a - ld hl, EnemyMonHP + ld hl, wEnemyMonHP ld b, [hl] inc hl ld c, [hl] @@ -339,11 +339,11 @@ ParkBall: ; e8a2 ; benefit. ; Uncomment the line below to fix this. ld b, a - ld a, [EnemyMonStatus] + ld a, [wEnemyMonStatus] and 1 << FRZ | SLP ld c, 10 jr nz, .addstatus - ; ld a, [EnemyMonStatus] + ; ld a, [wEnemyMonStatus] and a ld c, 5 jr nz, .addstatus @@ -367,7 +367,7 @@ ParkBall: ; e8a2 ; Uncomment the line below to fix. - ld a, [BattleMonItem] + ld a, [wBattleMonItem] ; ld b, a farcall GetItemHeldEffect ld a, b @@ -383,7 +383,7 @@ ParkBall: ; e8a2 .skip_hp_calc ld b, a - ld [Buffer1], a + ld [wBuffer1], a call Random cp b @@ -392,14 +392,14 @@ ParkBall: ; e8a2 jr nc, .fail_to_catch .catch_without_fail - ld a, [EnemyMonSpecies] + ld a, [wEnemyMonSpecies] .fail_to_catch ld [wWildMon], a ld c, 20 call DelayFrames - ld a, [CurItem] + ld a, [wCurItem] cp POKE_BALL + 1 ; Assumes Master/Ultra/Great come before jr c, .not_kurt_ball ld a, POKE_BALL @@ -408,19 +408,19 @@ ParkBall: ; e8a2 ld de, ANIM_THROW_POKE_BALL ld a, e - ld [FXAnimID], a + ld [wFXAnimID], a ld a, d - ld [FXAnimID + 1], a + ld [wFXAnimID + 1], a xor a ld [hBattleTurn], a - ld [Buffer2], a + ld [wBuffer2], a ld [wNumHits], a predef PlayBattleAnim ld a, [wWildMon] and a jr nz, .caught - ld a, [Buffer2] + ld a, [wBuffer2] cp $1 ld hl, Text_NoShake jp z, .shake_and_break_free @@ -435,7 +435,7 @@ ParkBall: ; e8a2 jp z, .shake_and_break_free .caught - ld hl, EnemyMonStatus + ld hl, wEnemyMonStatus ld a, [hli] push af inc hl @@ -444,44 +444,44 @@ ParkBall: ; e8a2 ld a, [hl] push af push hl - ld hl, EnemyMonItem + ld hl, wEnemyMonItem ld a, [hl] push af push hl - ld hl, EnemySubStatus5 + ld hl, wEnemySubStatus5 ld a, [hl] push af set SUBSTATUS_TRANSFORMED, [hl] ; This code is buggy. Any wild Pokémon that has Transformed will be ; caught as a Ditto, even if it was something else like Mew. -; To fix, do not set [TempEnemyMonSpecies] to DITTO. +; To fix, do not set [wTempEnemyMonSpecies] to DITTO. bit SUBSTATUS_TRANSFORMED, a jr nz, .ditto jr .not_ditto .ditto ld a, DITTO - ld [TempEnemyMonSpecies], a + ld [wTempEnemyMonSpecies], a jr .load_data .not_ditto set SUBSTATUS_TRANSFORMED, [hl] ld hl, wEnemyBackupDVs - ld a, [EnemyMonDVs] + ld a, [wEnemyMonDVs] ld [hli], a - ld a, [EnemyMonDVs + 1] + ld a, [wEnemyMonDVs + 1] ld [hl], a .load_data - ld a, [TempEnemyMonSpecies] - ld [CurPartySpecies], a - ld a, [EnemyMonLevel] - ld [CurPartyLevel], a + ld a, [wTempEnemyMonSpecies] + ld [wCurPartySpecies], a + ld a, [wEnemyMonLevel] + ld [wCurPartyLevel], a farcall LoadEnemyMon pop af - ld [EnemySubStatus5], a + ld [wEnemySubStatus5], a pop hl pop af @@ -495,25 +495,25 @@ ParkBall: ; e8a2 pop af ld [hl], a - ld hl, EnemySubStatus5 + ld hl, wEnemySubStatus5 bit SUBSTATUS_TRANSFORMED, [hl] jr nz, .Transformed ld hl, wWildMonMoves - ld de, EnemyMonMoves + ld de, wEnemyMonMoves ld bc, NUM_MOVES call CopyBytes ld hl, wWildMonPP - ld de, EnemyMonPP + ld de, wEnemyMonPP ld bc, NUM_MOVES call CopyBytes .Transformed: - ld a, [EnemyMonSpecies] + ld a, [wEnemyMonSpecies] ld [wWildMon], a - ld [CurPartySpecies], a + ld [wCurPartySpecies], a ld [wd265], a - ld a, [BattleType] + ld a, [wBattleType] cp BATTLETYPE_TUTORIAL jp z, .FinishTutorial @@ -545,12 +545,12 @@ ParkBall: ; e8a2 call ClearSprites - ld a, [EnemyMonSpecies] + ld a, [wEnemyMonSpecies] ld [wd265], a predef NewPokedexEntry .skip_pokedex - ld a, [BattleType] + ld a, [wBattleType] cp BATTLETYPE_CONTEST jp z, .catch_bug_contest_mon cp BATTLETYPE_CELEBI @@ -559,25 +559,25 @@ ParkBall: ; e8a2 set 6, [hl] .not_celebi - ld a, [PartyCount] + ld a, [wPartyCount] cp PARTY_LENGTH jr z, .SendToPC xor a ; PARTYMON - ld [MonType], a + ld [wMonType], a call ClearSprites predef TryAddMonToParty farcall SetCaughtData - ld a, [CurItem] + ld a, [wCurItem] cp FRIEND_BALL jr nz, .SkipPartyMonFriendBall - ld a, [PartyCount] + ld a, [wPartyCount] dec a - ld hl, PartyMon1Happiness + ld hl, wPartyMon1Happiness ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes @@ -588,17 +588,17 @@ ParkBall: ; e8a2 ld hl, Text_AskNicknameNewlyCaughtMon call PrintText - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] ld [wd265], a call GetPokemonName call YesNoBox jp c, .return_from_capture - ld a, [PartyCount] + ld a, [wPartyCount] dec a - ld [CurPartyMon], a - ld hl, PartyMonNicknames + ld [wCurPartyMon], a + ld hl, wPartyMonNicknames ld bc, MON_NAME_LENGTH call AddNTimes @@ -606,7 +606,7 @@ ParkBall: ; e8a2 ld e, l push de xor a ; PARTYMON - ld [MonType], a + ld [wMonType], a ld b, 0 farcall NamingScreen @@ -615,7 +615,7 @@ ParkBall: ; e8a2 call LoadStandardFont pop hl - ld de, StringBuffer1 + ld de, wStringBuffer1 call InitName jp .return_from_capture @@ -636,7 +636,7 @@ ParkBall: ; e8a2 ld hl, wBattleResult set 7, [hl] .BoxNotFullYet: - ld a, [CurItem] + ld a, [wCurItem] cp FRIEND_BALL jr nz, .SkipBoxMonFriendBall ; The captured mon is now first in the box @@ -648,7 +648,7 @@ ParkBall: ; e8a2 ld hl, Text_AskNicknameNewlyCaughtMon call PrintText - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] ld [wd265], a call GetPokemonName @@ -656,9 +656,9 @@ ParkBall: ; e8a2 jr c, .SkipBoxMonNickname xor a - ld [CurPartyMon], a + ld [wCurPartyMon], a ld a, BOXMON - ld [MonType], a + ld [wMonType], a ld de, wMonOrItemNameBuffer ld b, $0 farcall NamingScreen @@ -672,7 +672,7 @@ ParkBall: ; e8a2 call CopyBytes ld hl, sBoxMonNicknames - ld de, StringBuffer1 + ld de, wStringBuffer1 call InitName call CloseSRAM @@ -707,7 +707,7 @@ ParkBall: ; e8a2 call ClearSprites .return_from_capture - ld a, [BattleType] + ld a, [wBattleType] cp BATTLETYPE_TUTORIAL ret z cp BATTLETYPE_DEBUG @@ -723,7 +723,7 @@ ParkBall: ; e8a2 call ClearTileMap .toss - ld hl, NumItems + ld hl, wNumItems inc a ld [wItemQuantityChangeBuffer], a jp TossItem @@ -772,7 +772,7 @@ ParkBallMultiplier: GetPokedexEntryBank: push hl push de - ld a, [EnemyMonSpecies] + ld a, [wEnemyMonSpecies] rlca rlca maskbits NUM_DEX_ENTRY_BANKS @@ -797,7 +797,7 @@ HeavyBallMultiplier: ; else add 20 to catch rate if weight < 307.2 kg ; else add 30 to catch rate if weight < 409.6 kg ; else add 40 to catch rate (never happens) - ld a, [EnemyMonSpecies] + ld a, [wEnemyMonSpecies] ld hl, PokedexDataPointerTable dec a ld e, a @@ -893,7 +893,7 @@ HeavyBallMultiplier: LureBallMultiplier: ; multiply catch rate by 3 if this is a fishing rod battle - ld a, [BattleType] + ld a, [wBattleType] cp BATTLETYPE_FISH ret nz @@ -918,7 +918,7 @@ GLOBAL EvosAttacks GLOBAL EvosAttacksPointers push bc - ld a, [TempEnemyMonSpecies] + ld a, [wTempEnemyMonSpecies] dec a ld c, a ld b, 0 @@ -965,20 +965,20 @@ LoveBallMultiplier: ; Reality: multiply catch rate by 8 if mons are of same species, same sex ; does species match? - ld a, [TempEnemyMonSpecies] + ld a, [wTempEnemyMonSpecies] ld c, a - ld a, [TempBattleMonSpecies] + ld a, [wTempBattleMonSpecies] cp c ret nz ; check player mon species push bc - ld a, [TempBattleMonSpecies] - ld [CurPartySpecies], a + ld a, [wTempBattleMonSpecies] + ld [wCurPartySpecies], a xor a ; PARTYMON - ld [MonType], a - ld a, [CurBattleMon] - ld [CurPartyMon], a + ld [wMonType], a + ld a, [wCurBattleMon] + ld [wCurPartyMon], a farcall GetGender jr c, .done1 ; no effect on genderless @@ -989,10 +989,10 @@ LoveBallMultiplier: ; check wild mon species push de - ld a, [TempEnemyMonSpecies] - ld [CurPartySpecies], a + ld a, [wTempEnemyMonSpecies] + ld [wCurPartySpecies], a ld a, WILDMON - ld [MonType], a + ld [wMonType], a farcall GetGender jr c, .done2 ; no effect on genderless @@ -1030,7 +1030,7 @@ FastBallMultiplier: ; FleeMons tables. ; Reality: multiply catch rate by 4 if enemy mon is one of the first three in ; the first FleeMons table. - ld a, [TempEnemyMonSpecies] + ld a, [wTempEnemyMonSpecies] ld c, a ld hl, FleeMons ld d, 3 @@ -1063,9 +1063,9 @@ LevelBallMultiplier: ; multiply catch rate by 8 if player mon level / 4 > enemy mon level ; multiply catch rate by 4 if player mon level / 2 > enemy mon level ; multiply catch rate by 2 if player mon level > enemy mon level - ld a, [BattleMonLevel] + ld a, [wBattleMonLevel] ld c, a - ld a, [EnemyMonLevel] + ld a, [wEnemyMonLevel] cp c ret nc ; if player is lower level, we're done here sla b @@ -1253,7 +1253,7 @@ Calcium: ; ee3d ld a, [hli] ld h, [hl] ld l, a - ld de, StringBuffer2 + ld de, wStringBuffer2 ld bc, ITEM_NAME_LENGTH call CopyBytes @@ -1316,7 +1316,7 @@ StatStrings: ; eeab GetStatExpRelativePointer: ; eed9 - ld a, [CurItem] + ld a, [wCurItem] ld hl, Table_eeeb .next cp [hl] @@ -1342,16 +1342,16 @@ Table_eeeb: ; eeeb RareCandy_StatBooster_GetParameters: ; eef5 - ld a, [CurPartySpecies] - ld [CurSpecies], a + ld a, [wCurPartySpecies] + ld [wCurSpecies], a ld [wd265], a ld a, MON_LEVEL call GetPartyParamLocation ld a, [hl] - ld [CurPartyLevel], a + ld [wCurPartyLevel], a call GetBaseData - ld a, [CurPartyMon] - ld hl, PartyMonNicknames + ld a, [wCurPartyMon] + ld hl, wPartyMonNicknames call GetNick ret ; 0xef14 @@ -1374,7 +1374,7 @@ RareCandy: ; ef14 inc a ld [hl], a - ld [CurPartyLevel], a + ld [wCurPartyLevel], a push de ld d, a farcall CalcExpAtLevel @@ -1421,7 +1421,7 @@ RareCandy: ; ef14 call ItemActionText xor a ; PARTYMON - ld [MonType], a + ld [wMonType], a predef CopyPkmnToTempMon hlcoord 9, 0 @@ -1436,8 +1436,8 @@ RareCandy: ; ef14 call WaitPressAorB_BlinkCursor xor a ; PARTYMON - ld [MonType], a - ld a, [CurPartySpecies] + ld [wMonType], a + ld a, [wCurPartySpecies] ld [wd265], a predef LearnLevelMoves @@ -1511,7 +1511,7 @@ UseStatusHealer: ; efda (3:6fda) xor a ld [hl], a ld a, b - ld [PartyMenuActionText], a + ld [wPartyMenuActionText], a call HealStatus call Play_SFX_FULL_HEAL call ItemActionTextWaitButton @@ -1522,7 +1522,7 @@ UseStatusHealer: ; efda (3:6fda) IsItemUsedOnConfusedMon: ; f009 (3:7009) call IsItemUsedOnBattleMon jr nc, .nope - ld a, [PlayerSubStatus3] + ld a, [wPlayerSubStatus3] bit SUBSTATUS_CONFUSED, a jr z, .nope ld a, c @@ -1541,25 +1541,25 @@ BattlemonRestoreHealth: ; f01e (3:701e) ld a, MON_HP call GetPartyParamLocation ld a, [hli] - ld [BattleMonHP], a + ld [wBattleMonHP], a ld a, [hld] - ld [BattleMonHP + 1], a + ld [wBattleMonHP + 1], a ret HealStatus: ; f030 (3:7030) call IsItemUsedOnBattleMon ret nc xor a - ld [BattleMonStatus], a - ld hl, PlayerSubStatus5 + ld [wBattleMonStatus], a + ld hl, wPlayerSubStatus5 res SUBSTATUS_TOXIC, [hl] - ld hl, PlayerSubStatus1 + ld hl, wPlayerSubStatus1 res SUBSTATUS_NIGHTMARE, [hl] call GetItemHealingAction ld a, c cp %11111111 jr nz, .not_full_heal - ld hl, PlayerSubStatus3 + ld hl, wPlayerSubStatus3 res SUBSTATUS_CONFUSED, [hl] .not_full_heal push bc @@ -1569,7 +1569,7 @@ HealStatus: ; f030 (3:7030) GetItemHealingAction: ; f058 (3:7058) push hl - ld a, [CurItem] + ld a, [wCurItem] ld hl, StatusHealingActions ld bc, 3 .next @@ -1640,7 +1640,7 @@ RevivePokemon: ; f0d6 and a jr z, .skip_to_revive - ld a, [CurPartyMon] + ld a, [wCurPartyMon] ld c, a ld d, 0 ld hl, wBattleParticipantsIncludingFainted @@ -1650,7 +1650,7 @@ RevivePokemon: ; f0d6 and a jr z, .skip_to_revive - ld a, [CurPartyMon] + ld a, [wCurPartyMon] ld c, a ld hl, wBattleParticipantsNotFainted ld b, SET_FLAG @@ -1658,8 +1658,8 @@ RevivePokemon: ; f0d6 .skip_to_revive xor a - ld [Danger], a - ld a, [CurItem] + ld [wLowHealthAlarm], a + ld a, [wCurItem] cp REVIVE jr z, .revive_half_hp @@ -1672,7 +1672,7 @@ RevivePokemon: ; f0d6 .finish_revive call HealHP_SFX_GFX ld a, PARTYMENUTEXT_REVIVE - ld [PartyMenuActionText], a + ld [wPartyMenuActionText], a call ItemActionTextWaitButton call UseDisposableItem ld a, 0 @@ -1701,7 +1701,7 @@ FullRestore: ; f128 .FullRestore: ; f144 xor a - ld [Danger], a + ld [wLowHealthAlarm], a call ReviveFullHP ld a, MON_STATUS call GetPartyParamLocation @@ -1712,7 +1712,7 @@ FullRestore: ; f128 call BattlemonRestoreHealth call HealHP_SFX_GFX ld a, PARTYMENUTEXT_HEAL_HP - ld [PartyMenuActionText], a + ld [wPartyMenuActionText], a call ItemActionTextWaitButton call UseDisposableItem ld a, 0 @@ -1721,7 +1721,7 @@ FullRestore: ; f128 BitterBerry: ; f16a - ld hl, PlayerSubStatus3 + ld hl, wPlayerSubStatus3 bit SUBSTATUS_CONFUSED, [hl] ld a, 1 jr z, .done @@ -1798,13 +1798,13 @@ ItemRestoreHP: ; f1a9 (3:71a9) ret nc xor a - ld [Danger], a + ld [wLowHealthAlarm], a call GetHealingItemAmount call RestoreHealth call BattlemonRestoreHealth call HealHP_SFX_GFX ld a, PARTYMENUTEXT_HEAL_HP - ld [PartyMenuActionText], a + ld [wPartyMenuActionText], a call ItemActionTextWaitButton call UseDisposableItem ld a, 0 @@ -1815,7 +1815,7 @@ HealHP_SFX_GFX: ; f1db (3:71db) ld de, SFX_POTION call WaitPlaySFX pop de - ld a, [CurPartyMon] + ld a, [wCurPartyMon] hlcoord 11, 0 ld bc, SCREEN_WIDTH * 2 call AddNTimes @@ -1827,7 +1827,7 @@ UseItem_SelectMon: ; f1f9 (3:71f9) call .SelectMon ret c - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] cp EGG jr nz, .not_egg @@ -1841,7 +1841,7 @@ UseItem_SelectMon: ; f1f9 (3:71f9) .SelectMon: ; f20b (3:720b) ld a, b - ld [PartyMenuActionText], a + ld [wPartyMenuActionText], a push hl push de push bc @@ -1865,10 +1865,10 @@ ChoosePkmnToUseItemOn: ; f21c (3:721c) ret ItemActionText: ; f24a (3:724a) - ld [PartyMenuActionText], a - ld a, [CurPartySpecies] + ld [wPartyMenuActionText], a + ld a, [wCurPartySpecies] push af - ld a, [CurPartyMon] + ld a, [wCurPartyMon] push af push hl push de @@ -1882,19 +1882,19 @@ ItemActionText: ; f24a (3:724a) pop de pop hl pop af - ld [CurPartyMon], a + ld [wCurPartyMon], a pop af - ld [CurPartySpecies], a + ld [wCurPartySpecies], a ret ItemActionTextWaitButton: ; f279 (3:7279) xor a ld [hBGMapMode], a hlcoord 0, 0 - ld bc, TileMapEnd - TileMap + ld bc, wTileMapEnd - wTileMap ld a, " " call ByteFill - ld a, [PartyMenuActionText] + ld a, [wPartyMenuActionText] call ItemActionText ld a, $1 ld [hBGMapMode], a @@ -1917,9 +1917,9 @@ IsItemUsedOnBattleMon: ; f2a6 (3:72a6) ld a, [wBattleMode] and a ret z - ld a, [CurPartyMon] + ld a, [wCurPartyMon] push hl - ld hl, CurBattleMon + ld hl, wCurBattleMon cp [hl] pop hl jr nz, .nope @@ -2017,24 +2017,24 @@ LoadCurHPIntoBuffer5: ; f328 (3:7328) ld a, MON_HP call GetPartyParamLocation ld a, [hli] - ld [Buffer6], a + ld [wBuffer6], a ld a, [hl] - ld [Buffer5], a + ld [wBuffer5], a ret ; f336 (3:7336) LoadHPIntoBuffer5: ; f336 ld a, d - ld [Buffer6], a + ld [wBuffer6], a ld a, e - ld [Buffer5], a + ld [wBuffer5], a ret ; f33f LoadHPFromBuffer5: ; f33f - ld a, [Buffer6] + ld a, [wBuffer6] ld d, a - ld a, [Buffer5] + ld a, [wBuffer5] ld e, a ret ; f348 @@ -2043,15 +2043,15 @@ LoadCurHPToBuffer3: ; f348 (3:7348) ld a, MON_HP call GetPartyParamLocation ld a, [hli] - ld [Buffer4], a + ld [wBuffer4], a ld a, [hl] - ld [Buffer3], a + ld [wBuffer3], a ret LoadHPFromBuffer3: ; f356 (3:7356) - ld a, [Buffer4] + ld a, [wBuffer4] ld d, a - ld a, [Buffer3] + ld a, [wBuffer3] ld e, a ret @@ -2060,16 +2060,16 @@ LoadMaxHPToBuffer1: ; f35f (3:735f) ld a, MON_MAXHP call GetPartyParamLocation ld a, [hli] - ld [Buffer2], a + ld [wBuffer2], a ld a, [hl] - ld [Buffer1], a + ld [wBuffer1], a pop hl ret LoadHPFromBuffer1: ; f36f (3:736f) - ld a, [Buffer2] + ld a, [wBuffer2] ld d, a - ld a, [Buffer1] + ld a, [wBuffer1] ld e, a ret @@ -2094,7 +2094,7 @@ GetOneFifthMaxHP: ; f378 (3:7378) GetHealingItemAmount: ; f395 (3:7395) push hl - ld a, [CurItem] + ld a, [wCurItem] ld hl, HealingHPAmounts ld d, a .next @@ -2127,7 +2127,7 @@ Softboiled_MilkDrinkFunction: ; f3df (3:73df) call .SelectMilkDrinkRecipient ; select pokemon jr c, .skip ld a, b - ld [CurPartyMon], a + ld [wCurPartyMon], a call IsMonFainted call GetOneFifthMaxHP call RemoveHP @@ -2136,7 +2136,7 @@ Softboiled_MilkDrinkFunction: ; f3df (3:73df) pop bc call GetOneFifthMaxHP ld a, c - ld [CurPartyMon], a + ld [wCurPartyMon], a call IsMonFainted call RestoreHealth call HealHP_SFX_GFX @@ -2153,7 +2153,7 @@ Softboiled_MilkDrinkFunction: ; f3df (3:73df) .loop push bc ld a, PARTYMENUACTION_HEALING_ITEM - ld [PartyMenuActionText], a + ld [wPartyMenuActionText], a call ChoosePkmnToUseItemOn pop bc jr c, .set_carry @@ -2164,7 +2164,7 @@ Softboiled_MilkDrinkFunction: ; f3df (3:73df) cp c jr z, .cant_use ; chose the same mon as user ld a, c - ld [CurPartyMon], a + ld [wCurPartyMon], a call IsMonFainted jr z, .cant_use call IsMonAtFullHealth @@ -2236,7 +2236,7 @@ TextJump_RepelUsedEarlierIsStillInEffect: ; 0xf47d XAccuracy: ; f482 - ld hl, PlayerSubStatus4 + ld hl, wPlayerSubStatus4 bit SUBSTATUS_X_ACCURACY, [hl] jp nz, WontHaveAnyEffect_NotUsedMessage set SUBSTATUS_X_ACCURACY, [hl] @@ -2264,7 +2264,7 @@ PokeDoll: ; f48f GuardSpec: ; f4ab - ld hl, PlayerSubStatus4 + ld hl, wPlayerSubStatus4 bit SUBSTATUS_MIST, [hl] jp nz, WontHaveAnyEffect_NotUsedMessage set SUBSTATUS_MIST, [hl] @@ -2273,7 +2273,7 @@ GuardSpec: ; f4ab DireHit: ; f4b8 - ld hl, PlayerSubStatus4 + ld hl, wPlayerSubStatus4 bit SUBSTATUS_FOCUS_ENERGY, [hl] jp nz, WontHaveAnyEffect_NotUsedMessage set SUBSTATUS_FOCUS_ENERGY, [hl] @@ -2287,7 +2287,7 @@ XSpeed: XSpecial: ; f4c5 call UseItemText - ld a, [CurItem] + ld a, [wCurItem] ld hl, XItemStats .loop @@ -2302,16 +2302,16 @@ XSpecial: ; f4c5 ld b, [hl] xor a ld [hBattleTurn], a - ld [AttackMissed], a - ld [EffectFailed], a + ld [wAttackMissed], a + ld [wEffectFailed], a farcall CheckIfStatCanBeRaised call WaitSFX farcall BattleCommand_StatUpMessage farcall BattleCommand_StatUpFailText - ld a, [CurBattleMon] - ld [CurPartyMon], a + ld a, [wCurBattleMon] + ld [wCurPartyMon], a ld c, HAPPINESS_USEDXITEM farcall ChangeHappiness ret @@ -2331,21 +2331,21 @@ PokeFlute: ; f50c ld b, $ff ^ SLP - ld hl, PartyMon1Status + ld hl, wPartyMon1Status call .CureSleep ld a, [wBattleMode] cp WILD_BATTLE jr z, .skip_otrainer - ld hl, OTPartyMon1Status + ld hl, wOTPartyMon1Status call .CureSleep .skip_otrainer - ld hl, BattleMonStatus + ld hl, wBattleMonStatus ld a, [hl] and b ld [hl], a - ld hl, EnemyMonStatus + ld hl, wEnemyMonStatus ld a, [hl] and b ld [hl], a @@ -2357,7 +2357,7 @@ PokeFlute: ; f50c ld hl, .PlayedTheFlute call PrintText - ld a, [Danger] + ld a, [wLowHealthAlarm] and 1 << DANGER_ON_F jr nz, .dummy2 .dummy2 @@ -2471,7 +2471,7 @@ Ether: MaxEther: Elixer: Mysteryberry: ; f5bf - ld a, [CurItem] + ld a, [wCurItem] ld [wd002], a .loop @@ -2496,19 +2496,19 @@ Mysteryberry: ; f5bf .ppup call PrintText - ld a, [CurMoveNum] + ld a, [wCurMoveNum] push af xor a - ld [CurMoveNum], a + ld [wCurMoveNum], a ld a, $2 ld [wMoveSelectionMenuType], a farcall MoveSelectionScreen pop bc ld a, b - ld [CurMoveNum], a + ld [wCurMoveNum], a jr nz, .loop - ld hl, PartyMon1Moves + ld hl, wPartyMon1Moves ld bc, PARTYMON_STRUCT_LENGTH call GetMthMoveOfNthPartymon @@ -2560,12 +2560,12 @@ BattleRestorePP: ; f652 ld a, [wBattleMode] and a jr z, .not_in_battle - ld a, [CurPartyMon] + ld a, [wCurPartyMon] ld b, a - ld a, [CurBattleMon] + ld a, [wCurBattleMon] cp b jr nz, .not_in_battle - ld a, [PlayerSubStatus5] + ld a, [wPlayerSubStatus5] bit SUBSTATUS_TRANSFORMED, a jr nz, .not_in_battle call .UpdateBattleMonPP @@ -2577,11 +2577,11 @@ BattleRestorePP: ; f652 jr FinishPPRestore .UpdateBattleMonPP: - ld a, [CurPartyMon] - ld hl, PartyMon1Moves + ld a, [wCurPartyMon] + ld hl, wPartyMon1Moves ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes - ld de, BattleMonMoves + ld de, wBattleMonMoves ld b, NUM_MOVES .loop ld a, [de] @@ -2592,7 +2592,7 @@ BattleRestorePP: ; f652 push hl push de push bc - rept NUM_MOVES + 2 ; BattleMonPP - BattleMonMoves + rept NUM_MOVES + 2 ; wBattleMonPP - wBattleMonMoves inc de endr ld bc, MON_PP - MON_MOVES @@ -2627,7 +2627,7 @@ Elixer_RestorePPofAllMoves: ; f6af ld b, NUM_MOVES .moveLoop push bc - ld hl, PartyMon1Moves + ld hl, wPartyMon1Moves ld bc, PARTYMON_STRUCT_LENGTH call GetMthMoveOfNthPartymon ld a, [hl] @@ -2661,9 +2661,9 @@ PPRestoreItem_Cancel: ; f6e0 RestorePP: ; f6e8 xor a ; PARTYMON - ld [MonType], a + ld [wMonType], a call GetMaxPPOfMove - ld hl, PartyMon1PP + ld hl, wPartyMon1PP ld bc, PARTYMON_STRUCT_LENGTH call GetMthMoveOfNthPartymon ld a, [wd265] @@ -2895,7 +2895,7 @@ UseItemText: ; f789 call Play_SFX_FULL_HEAL call WaitPressAorB_BlinkCursor UseDisposableItem: ; f795 - ld hl, NumItems + ld hl, wNumItems ld a, 1 ld [wItemQuantityChangeBuffer], a jp TossItem @@ -2905,9 +2905,9 @@ UseBallInTrainerBattle: ; f7a0 call ReturnToBattle_UseBall ld de, ANIM_THROW_POKE_BALL ld a, e - ld [FXAnimID], a + ld [wFXAnimID], a ld a, d - ld [FXAnimID + 1], a + ld [wFXAnimID + 1], a xor a ld [wBattleAnimParam], a ld [hBattleTurn], a @@ -3058,12 +3058,12 @@ ApplyPPUp: ; f84c ld a, MON_MOVES call GetPartyParamLocation push hl - ld de, Buffer1 + ld de, wBuffer1 predef FillPP pop hl ld bc, MON_PP - MON_MOVES add hl, bc - ld de, Buffer1 + ld de, wBuffer1 ld b, 0 .loop inc b @@ -3151,7 +3151,7 @@ RestoreAllPP: ; f8b9 pop de xor a ; PARTYMON ld [wMenuCursorY], a - ld [MonType], a + ld [wMonType], a ld c, NUM_MOVES .loop ld a, [hli] @@ -3180,31 +3180,31 @@ RestoreAllPP: ; f8b9 GetMaxPPOfMove: ; f8ec - ld a, [StringBuffer1 + 0] + ld a, [wStringBuffer1 + 0] push af - ld a, [StringBuffer1 + 1] + ld a, [wStringBuffer1 + 1] push af - ld a, [MonType] + ld a, [wMonType] and a - ld hl, PartyMon1Moves + ld hl, wPartyMon1Moves ld bc, PARTYMON_STRUCT_LENGTH jr z, .got_partymon ; PARTYMON - ld hl, OTPartyMon1Moves + ld hl, wOTPartyMon1Moves dec a jr z, .got_partymon ; OTPARTYMON - ld hl, TempMonMoves + ld hl, wTempMonMoves dec a jr z, .got_nonpartymon ; BOXMON - ld hl, TempMonMoves ; Wasted cycles + ld hl, wTempMonMoves ; Wasted cycles dec a jr z, .got_nonpartymon ; TEMPMON - ld hl, BattleMonMoves ; WILDMON + ld hl, wBattleMonMoves ; WILDMON .got_nonpartymon ; BOXMON, TEMPMON, WILDMON call GetMthMoveOfCurrentMon @@ -3224,16 +3224,16 @@ GetMaxPPOfMove: ; f8ec ld a, BANK(Moves) call GetFarByte ld b, a - ld de, StringBuffer1 + ld de, wStringBuffer1 ld [de], a pop hl push bc ld bc, MON_PP - MON_MOVES - ld a, [MonType] + ld a, [wMonType] cp WILDMON jr nz, .notwild - ld bc, EnemyMonPP - EnemyMonMoves + ld bc, wEnemyMonPP - wEnemyMonMoves .notwild add hl, bc ld a, [hl] @@ -3241,7 +3241,7 @@ GetMaxPPOfMove: ; f8ec pop bc or b - ld hl, StringBuffer1 + 1 + ld hl, wStringBuffer1 + 1 ld [hl], a xor a ld [wd265], a @@ -3252,14 +3252,14 @@ GetMaxPPOfMove: ; f8ec ld [wd265], a pop af - ld [StringBuffer1 + 1], a + ld [wStringBuffer1 + 1], a pop af - ld [StringBuffer1 + 0], a + ld [wStringBuffer1 + 0], a ret ; f963 GetMthMoveOfNthPartymon: ; f963 - ld a, [CurPartyMon] + ld a, [wCurPartyMon] call AddNTimes GetMthMoveOfCurrentMon: ; f969 diff --git a/engine/items.asm b/engine/items.asm index 503a76c6b..7246d5609 100755 --- a/engine/items.asm +++ b/engine/items.asm @@ -27,13 +27,13 @@ _ReceiveItem:: ; d1d5 jp ReceiveKeyItem .Ball: ; d1fb - ld hl, NumBalls + ld hl, wNumBalls jp PutItemInPocket .TMHM: ; d201 ld h, d ld l, e - ld a, [CurItem] + ld a, [wCurItem] ld c, a call GetTMHMNumber jp ReceiveTMHM @@ -57,13 +57,13 @@ _TossItem:: ; d20d dw .TMHM .Ball: ; d228 - ld hl, NumBalls + ld hl, wNumBalls jp RemoveItemFromPocket .TMHM: ; d22e ld h, d ld l, e - ld a, [CurItem] + ld a, [wCurItem] ld c, a call GetTMHMNumber jp TossTMHM @@ -99,13 +99,13 @@ _CheckItem:: ; d244 dw .TMHM .Ball: ; d25f - ld hl, NumBalls + ld hl, wNumBalls jp CheckTheItem .TMHM: ; d265 ld h, d ld l, e - ld a, [CurItem] + ld a, [wCurItem] ld c, a call GetTMHMNumber jp CheckTMHM @@ -124,28 +124,28 @@ _CheckItem:: ; d244 DoesHLEqualNumItems: ; d27b ld a, l - cp LOW(NumItems) + cp LOW(wNumItems) ret nz ld a, h - cp HIGH(NumItems) + cp HIGH(wNumItems) ret GetPocketCapacity: ; d283 ld c, MAX_ITEMS ld a, e - cp LOW(NumItems) + cp LOW(wNumItems) jr nz, .not_bag ld a, d - cp HIGH(NumItems) + cp HIGH(wNumItems) ret z .not_bag ld c, MAX_PC_ITEMS ld a, e - cp LOW(PCItems) + cp LOW(wPCItems) jr nz, .not_pc ld a, d - cp HIGH(PCItems) + cp HIGH(wPCItems) ret z .not_pc @@ -156,7 +156,7 @@ PutItemInPocket: ; d29c ld d, h ld e, l inc hl - ld a, [CurItem] + ld a, [wCurItem] ld c, a ld b, 0 .loop @@ -189,7 +189,7 @@ PutItemInPocket: ; d29c .ok ld h, d ld l, e - ld a, [CurItem] + ld a, [wCurItem] ld c, a ld a, [wItemQuantityChangeBuffer] ld [wItemQuantityBuffer], a @@ -215,7 +215,7 @@ PutItemInPocket: ; d29c .terminator2 dec hl - ld a, [CurItem] + ld a, [wCurItem] ld [hli], a ld a, [wItemQuantityBuffer] ld [hli], a @@ -233,14 +233,14 @@ RemoveItemFromPocket: ; d2ff ld e, l ld a, [hli] ld c, a - ld a, [CurItemQuantity] + ld a, [wCurItemQuantity] cp c jr nc, .ok ; memory ld c, a ld b, $0 add hl, bc add hl, bc - ld a, [CurItem] + ld a, [wCurItem] cp [hl] inc hl jr z, .skip @@ -249,7 +249,7 @@ RemoveItemFromPocket: ; d2ff inc hl .ok - ld a, [CurItem] + ld a, [wCurItem] ld b, a .loop ld a, [hli] @@ -294,7 +294,7 @@ RemoveItemFromPocket: ; d2ff ret CheckTheItem: ; d349 - ld a, [CurItem] + ld a, [wCurItem] ld c, a .loop inc hl @@ -311,17 +311,17 @@ CheckTheItem: ; d349 ret ReceiveKeyItem: ; d35a - ld hl, NumKeyItems + ld hl, wNumKeyItems ld a, [hli] cp MAX_KEY_ITEMS jr nc, .nope ld c, a ld b, 0 add hl, bc - ld a, [CurItem] + ld a, [wCurItem] ld [hli], a ld [hl], -1 - ld hl, NumKeyItems + ld hl, wNumKeyItems inc [hl] scf ret @@ -331,10 +331,10 @@ ReceiveKeyItem: ; d35a ret TossKeyItem: ; d374 - ld a, [CurItemQuantity] + ld a, [wCurItemQuantity] ld e, a ld d, 0 - ld hl, NumKeyItems + ld hl, wNumKeyItems ld a, [hl] cp e jr nc, .ok @@ -361,8 +361,8 @@ TossKeyItem: ; d374 ret .Toss: ; d396 - ld hl, NumKeyItems - ld a, [CurItem] + ld hl, wNumKeyItems + ld a, [wCurItem] ld c, a .loop3 inc hl @@ -375,16 +375,16 @@ TossKeyItem: ; d374 ret .ok3 - ld a, [NumKeyItems] + ld a, [wNumKeyItems] dec a - ld [NumKeyItems], a + ld [wNumKeyItems], a scf ret CheckKeyItems: ; d3b1 - ld a, [CurItem] + ld a, [wCurItem] ld c, a - ld hl, KeyItems + ld hl, wKeyItems .loop ld a, [hli] cp c @@ -401,7 +401,7 @@ CheckKeyItems: ; d3b1 ReceiveTMHM: ; d3c4 dec c ld b, 0 - ld hl, TMsHMs + ld hl, wTMsHMs add hl, bc ld a, [wItemQuantityChangeBuffer] add [hl] @@ -418,7 +418,7 @@ ReceiveTMHM: ; d3c4 TossTMHM: ; d3d8 dec c ld b, 0 - ld hl, TMsHMs + ld hl, wTMsHMs add hl, bc ld a, [wItemQuantityChangeBuffer] ld b, a @@ -445,7 +445,7 @@ TossTMHM: ; d3d8 CheckTMHM: ; d3fb dec c ld b, $0 - ld hl, TMsHMs + ld hl, wTMsHMs add hl, bc ld a, [hl] and a @@ -489,7 +489,7 @@ GetNumberedTMHM: ; d417 ret _CheckTossableItem:: ; d427 -; Return 1 in wItemAttributeParamBuffer and carry if CurItem can't be removed from the bag. +; Return 1 in wItemAttributeParamBuffer and carry if wCurItem can't be removed from the bag. ld a, ITEMATTR_PERMISSIONS call GetItemAttr bit 7, a @@ -498,7 +498,7 @@ _CheckTossableItem:: ; d427 ret CheckSelectableItem: ; d432 -; Return 1 in wItemAttributeParamBuffer and carry if CurItem can't be selected. +; Return 1 in wItemAttributeParamBuffer and carry if wCurItem can't be selected. ld a, ITEMATTR_PERMISSIONS call GetItemAttr bit 6, a @@ -507,7 +507,7 @@ CheckSelectableItem: ; d432 ret CheckItemPocket:: ; d43d -; Return the pocket for CurItem in wItemAttributeParamBuffer. +; Return the pocket for wCurItem in wItemAttributeParamBuffer. ld a, ITEMATTR_POCKET call GetItemAttr and $f @@ -515,7 +515,7 @@ CheckItemPocket:: ; d43d ret CheckItemContext: ; d448 -; Return the context for CurItem in wItemAttributeParamBuffer. +; Return the context for wCurItem in wItemAttributeParamBuffer. ld a, ITEMATTR_HELP call GetItemAttr and $f @@ -523,7 +523,7 @@ CheckItemContext: ; d448 ret CheckItemMenu: ; d453 -; Return the menu for CurItem in wItemAttributeParamBuffer. +; Return the menu for wCurItem in wItemAttributeParamBuffer. ld a, ITEMATTR_HELP call GetItemAttr swap a @@ -532,7 +532,7 @@ CheckItemMenu: ; d453 ret GetItemAttr: ; d460 -; Get attribute a of CurItem. +; Get attribute a of wCurItem. push hl push bc @@ -545,7 +545,7 @@ GetItemAttr: ; d460 xor a ld [wItemAttributeParamBuffer], a - ld a, [CurItem] + ld a, [wCurItem] dec a ld c, a ld a, ITEMATTR_STRUCT_LENGTH @@ -564,7 +564,7 @@ ItemAttr_ReturnCarry: ; d47f ret GetItemPrice: ; d486 -; Return the price of CurItem in de. +; Return the price of wCurItem in de. push hl push bc ld a, ITEMATTR_PRICE diff --git a/engine/landmarks.asm b/engine/landmarks.asm index 452bd2e92..f16f48e67 100644 --- a/engine/landmarks.asm +++ b/engine/landmarks.asm @@ -16,7 +16,7 @@ GetLandmarkCoords: ; 0x1ca896 GetLandmarkName:: ; 0x1ca8a5 -; Copy the name of landmark e to StringBuffer1. +; Copy the name of landmark e to wStringBuffer1. push hl push de push bc @@ -31,7 +31,7 @@ GetLandmarkName:: ; 0x1ca8a5 ld h, [hl] ld l, a - ld de, StringBuffer1 + ld de, wStringBuffer1 ld c, 18 .copy ld a, [hli] @@ -54,9 +54,9 @@ RegionCheck: ; 0x1caea1 ; Checks if the player is in Kanto or Johto. ; If in Johto, returns 0 in e. ; If in Kanto, returns 1 in e. - ld a, [MapGroup] + ld a, [wMapGroup] ld b, a - ld a, [MapNumber] + ld a, [wMapNumber] ld c, a call GetWorldMapLocation cp FAST_SHIP ; S.S. Aqua @@ -65,9 +65,9 @@ RegionCheck: ; 0x1caea1 jr nz, .checkagain ; In a special map, get the backup map group / map id - ld a, [BackupMapGroup] + ld a, [wBackupMapGroup] ld b, a - ld a, [BackupMapNumber] + ld a, [wBackupMapNumber] ld c, a call GetWorldMapLocation diff --git a/engine/learn.asm b/engine/learn.asm index 2f1038d7f..54ec8f6bb 100755 --- a/engine/learn.asm +++ b/engine/learn.asm @@ -1,17 +1,17 @@ LearnMove: ; 6508 call LoadTileMapToTempTileMap - ld a, [CurPartyMon] - ld hl, PartyMonNicknames + ld a, [wCurPartyMon] + ld hl, wPartyMonNicknames call GetNick - ld hl, StringBuffer1 + ld hl, wStringBuffer1 ld de, wMonOrItemNameBuffer ld bc, MON_NAME_LENGTH call CopyBytes .loop - ld hl, PartyMon1Moves + ld hl, wPartyMon1Moves ld bc, PARTYMON_STRUCT_LENGTH - ld a, [CurPartyMon] + ld a, [wCurPartyMon] call AddNTimes ld d, h ld e, l @@ -42,12 +42,12 @@ LearnMove: ; 6508 ld a, [wBattleMode] and a jr z, .not_disabled - ld a, [DisabledMove] + ld a, [wDisabledMove] cp b jr nz, .not_disabled xor a - ld [DisabledMove], a - ld [PlayerDisableCount], a + ld [wDisabledMove], a + ld [wPlayerDisableCount], a .not_disabled call GetMoveName @@ -79,24 +79,24 @@ LearnMove: ; 6508 and a jp z, .learned - ld a, [CurPartyMon] + ld a, [wCurPartyMon] ld b, a - ld a, [CurBattleMon] + ld a, [wCurBattleMon] cp b jp nz, .learned - ld a, [PlayerSubStatus5] + ld a, [wPlayerSubStatus5] bit SUBSTATUS_TRANSFORMED, a jp nz, .learned ld h, d ld l, e - ld de, BattleMonMoves + ld de, wBattleMonMoves ld bc, NUM_MOVES call CopyBytes - ld bc, PartyMon1PP - (PartyMon1Moves + NUM_MOVES) + ld bc, wPartyMon1PP - (wPartyMon1Moves + NUM_MOVES) add hl, bc - ld de, BattleMonPP + ld de, wBattleMonPP ld bc, NUM_MOVES call CopyBytes jp .learned @@ -143,7 +143,7 @@ ForgetMove: ; 65d3 call TextBox hlcoord 5 + 2, 2 + 2 ld a, SCREEN_WIDTH * 2 - ld [Buffer1], a + ld [wBuffer1], a predef ListMoves ; wMenuData3 ld a, $4 diff --git a/engine/link.asm b/engine/link.asm index 86a593284..59d1a149a 100755 --- a/engine/link.asm +++ b/engine/link.asm @@ -73,13 +73,13 @@ TimeCapsule: ; 2805d ld a, $8 ld [rIE], a ld hl, wd1f3 - ld de, EnemyMonSpecies + ld de, wEnemyMonSpecies ld bc, $11 call Serial_ExchangeBytes ld a, SERIAL_NO_DATA_BYTE ld [de], a ld hl, wLinkData - ld de, OTPlayerName + ld de, wOTPlayerName ld bc, $1a8 call Serial_ExchangeBytes ld a, SERIAL_NO_DATA_BYTE @@ -93,7 +93,7 @@ TimeCapsule: ; 2805d ld a, $1d ld [rIE], a call Link_CopyRandomNumbers - ld hl, OTPlayerName + ld hl, wOTPlayerName call Link_FindFirstNonControlCharacter_SkipZero push hl ld bc, NAME_LENGTH @@ -138,10 +138,10 @@ TimeCapsule: ; 2805d dec c jr nz, .loop ld hl, wLinkPlayerName - ld de, OTPlayerName + ld de, wOTPlayerName ld bc, NAME_LENGTH call CopyBytes - ld de, OTPartyCount + ld de, wOTPartyCount ld a, [hli] ld [de], a inc de @@ -164,9 +164,9 @@ TimeCapsule: ; 2805d ld [de], a ld hl, wTimeCapsulePartyMon1Species call Function2868a - ld a, LOW(OTPartyMonOT) + ld a, LOW(wOTPartyMonOT) ld [wUnusedD102], a - ld a, HIGH(OTPartyMonOT) + ld a, HIGH(wOTPartyMonOT) ld [wUnusedD102 + 1], a ld de, MUSIC_NONE call PlayMusic @@ -184,7 +184,7 @@ Gen2ToGen2LinkComms: ; 28177 call Link_PrepPartyData_Gen2 call FixDataForLinkTransfer call Function29dba - ld a, [ScriptVar] + ld a, [wScriptVar] and a jp z, LinkTimeout ld a, [hSerialConnectionStatus] @@ -218,13 +218,13 @@ Gen2ToGen2LinkComms: ; 28177 ld a, $8 ld [rIE], a ld hl, wd1f3 - ld de, EnemyMonSpecies + ld de, wEnemyMonSpecies ld bc, $11 call Serial_ExchangeBytes ld a, SERIAL_NO_DATA_BYTE ld [de], a ld hl, wLinkData - ld de, OTPlayerName + ld de, wOTPlayerName ld bc, $1c2 call Serial_ExchangeBytes ld a, SERIAL_NO_DATA_BYTE @@ -249,7 +249,7 @@ Gen2ToGen2LinkComms: ; 28177 ld de, MUSIC_NONE call PlayMusic call Link_CopyRandomNumbers - ld hl, OTPlayerName + ld hl, wOTPlayerName call Link_FindFirstNonControlCharacter_SkipZero ld de, wLinkData ld bc, $1b9 @@ -395,21 +395,21 @@ Gen2ToGen2LinkComms: ; 28177 .skip_mail ld hl, wLinkPlayerName - ld de, OTPlayerName + ld de, wOTPlayerName ld bc, NAME_LENGTH call CopyBytes - ld de, OTPartyCount + ld de, wOTPartyCount ld bc, 1 + PARTY_LENGTH + 1 call CopyBytes - ld de, OTPlayerID + ld de, wOTPlayerID ld bc, 2 call CopyBytes - ld de, OTPartyMons - ld bc, OTPartyDataEnd - OTPartyMons + ld de, wOTPartyMons + ld bc, wOTPartyDataEnd - wOTPartyMons call CopyBytes - ld a, LOW(OTPartyMonOT) + ld a, LOW(wOTPartyMonOT) ld [wUnusedD102], a - ld a, HIGH(OTPartyMonOT) + ld a, HIGH(wOTPartyMonOT) ld [wUnusedD102 + 1], a ld de, MUSIC_NONE call PlayMusic @@ -421,17 +421,17 @@ Gen2ToGen2LinkComms: ; 28177 cp LINK_COLOSSEUM jr nz, .ready_to_trade ld a, CAL - ld [OtherTrainerClass], a + ld [wOtherTrainerClass], a call ClearScreen farcall Link_WaitBGMap - ld hl, Options + ld hl, wOptions ld a, [hl] push af and 1 << STEREO or TEXT_DELAY_MED ld [hl], a - ld hl, OTPlayerName - ld de, OTClassName + ld hl, wOTPlayerName + ld de, wOTClassName ld bc, NAME_LENGTH call CopyBytes call ReturnToMapFromSubmenu @@ -466,7 +466,7 @@ Gen2ToGen2LinkComms: ; 28177 pop af ld [wDisableTextAcceleration], a pop af - ld [Options], a + ld [wOptions], a farcall LoadPokemonData jp Function28b22 @@ -568,12 +568,12 @@ ClearLinkData: ; 28426 FixDataForLinkTransfer: ; 28434 ld hl, wd1f3 ld a, SERIAL_PREAMBLE_BYTE - ld b, LinkBattleRNs - wd1f3 + ld b, wLinkBattleRNs - wd1f3 .loop1 ld [hli], a dec b jr nz, .loop1 - ld b, TempEnemyMonSpecies - LinkBattleRNs + ld b, wTempEnemyMonSpecies - wLinkBattleRNs .loop2 call Random cp SERIAL_PREAMBLE_BYTE @@ -647,11 +647,11 @@ Link_PrepPartyData_Gen1: ; 28499 inc de dec b jr nz, .loop1 - ld hl, PlayerName + ld hl, wPlayerName ld bc, NAME_LENGTH call CopyBytes push de - ld hl, PartyCount + ld hl, wPartyCount ld a, [hli] ld [de], a inc de @@ -677,7 +677,7 @@ Link_PrepPartyData_Gen1: ; 28499 add hl, de ld d, h ld e, l - ld hl, PartyMon1Species + ld hl, wPartyMon1Species ld c, PARTY_LENGTH .mon_loop push bc @@ -687,9 +687,9 @@ Link_PrepPartyData_Gen1: ; 28499 pop bc dec c jr nz, .mon_loop - ld hl, PartyMonOT + ld hl, wPartyMonOT call .copy_ot_nicks - ld hl, PartyMonNicknames + ld hl, wPartyMonNicknames .copy_ot_nicks ld bc, PARTY_LENGTH * NAME_LENGTH jp CopyBytes @@ -761,7 +761,7 @@ Link_PrepPartyData_Gen1: ; 28499 add hl, bc ld a, [hl] ld [de], a - ld [CurPartyLevel], a + ld [wCurPartyLevel], a inc de push bc @@ -783,7 +783,7 @@ Link_PrepPartyData_Gen1: ; 28499 add hl, bc ld a, BANK(KantoMonSpecials) call GetFarByte - ld [BaseSpecialAttack], a + ld [wBaseSpecialAttack], a pop bc ld hl, MON_STAT_EXP - 1 @@ -815,22 +815,22 @@ Link_PrepPartyData_Gen2: ; 28595 inc de dec b jr nz, .loop1 - ld hl, PlayerName + ld hl, wPlayerName ld bc, NAME_LENGTH call CopyBytes - ld hl, PartyCount + ld hl, wPartyCount ld bc, 1 + PARTY_LENGTH + 1 call CopyBytes - ld hl, PlayerID + ld hl, wPlayerID ld bc, 2 call CopyBytes - ld hl, PartyMon1Species + ld hl, wPartyMon1Species ld bc, PARTY_LENGTH * PARTYMON_STRUCT_LENGTH call CopyBytes - ld hl, PartyMonOT + ld hl, wPartyMonOT ld bc, PARTY_LENGTH * NAME_LENGTH call CopyBytes - ld hl, PartyMonNicknames + ld hl, wPartyMonNicknames ld bc, PARTY_LENGTH * MON_NAME_LENGTH call CopyBytes @@ -963,7 +963,7 @@ Function2868a: ; 2868a ld a, c ld [hli], a ld [hl], b - ld hl, OTPartyMon1Species + ld hl, wOTPartyMon1Species ld c, PARTY_LENGTH .loop push bc @@ -974,10 +974,10 @@ Function2868a: ; 2868a pop hl ld bc, PARTY_LENGTH * REDMON_STRUCT_LENGTH add hl, bc - ld de, OTPartyMonOT + ld de, wOTPartyMonOT ld bc, PARTY_LENGTH * NAME_LENGTH call CopyBytes - ld de, OTPartyMonNicknames + ld de, wOTPartyMonNicknames ld bc, PARTY_LENGTH * MON_NAME_LENGTH jp CopyBytes ; 286ba @@ -995,7 +995,7 @@ Function2868a: ; 2868a pop bc ld a, [wd265] ld [bc], a - ld [CurSpecies], a + ld [wCurSpecies], a ld hl, MON_HP add hl, bc ld a, [de] @@ -1049,7 +1049,7 @@ Function2868a: ; 2868a ld a, [de] inc de ld [hl], a - ld [CurPartyLevel], a + ld [wCurPartyLevel], a push bc ld hl, $24 add hl, bc @@ -1148,9 +1148,9 @@ Link_CopyRandomNumbers: ; 287ab ld a, [hSerialConnectionStatus] cp USING_INTERNAL_CLOCK ret z - ld hl, EnemyMonSpecies + ld hl, wEnemyMonSpecies call Link_FindFirstNonControlCharacter_AllowZero - ld de, LinkBattleRNs + ld de, wLinkBattleRNs ld c, 10 .loop ld a, [hli] @@ -1208,10 +1208,10 @@ InitTradeMenuDisplay: ; 287e3 LinkTrade_OTPartyMenu: ; 28803 ld a, OTPARTYMON - ld [MonType], a + ld [wMonType], a ld a, A_BUTTON | D_UP | D_DOWN ld [wMenuJoypadFilter], a - ld a, [OTPartyCount] + ld a, [wOTPartyCount] ld [w2DMenuNumRows], a ld a, 1 ld [w2DMenuNumCols], a @@ -1238,7 +1238,7 @@ LinkTradeOTPartymonMenuLoop: ; 28835 ld a, INIT_ENEMYOT_LIST ld [wInitListType], a callfar InitList - ld hl, OTPartyMon1Species + ld hl, wOTPartyMon1Species farcall LinkMonStatsScreen jp LinkTradePartiesMenuMasterLoop @@ -1247,11 +1247,11 @@ LinkTradeOTPartymonMenuLoop: ; 28835 jr z, .not_d_up ld a, [wMenuCursorY] ld b, a - ld a, [OTPartyCount] + ld a, [wOTPartyCount] cp b jp nz, LinkTradePartiesMenuMasterLoop xor a - ld [MonType], a + ld [wMonType], a call HideCursor push hl push bc @@ -1260,7 +1260,7 @@ LinkTradeOTPartymonMenuLoop: ; 28835 ld [hl], " " pop bc pop hl - ld a, [PartyCount] + ld a, [wPartyCount] ld [wMenuCursorY], a jr LinkTrade_PlayerPartyMenu @@ -1273,10 +1273,10 @@ LinkTradeOTPartymonMenuLoop: ; 28835 LinkTrade_PlayerPartyMenu: ; 2888b farcall InitMG_Mobile_LinkTradePalMap xor a - ld [MonType], a + ld [wMonType], a ld a, A_BUTTON | D_UP | D_DOWN ld [wMenuJoypadFilter], a - ld a, [PartyCount] + ld a, [wPartyCount] ld [w2DMenuNumRows], a ld a, 1 ld [w2DMenuNumCols], a @@ -1313,7 +1313,7 @@ LinkTradePartymonMenuLoop: ; 288c5 dec a jp nz, LinkTradePartiesMenuMasterLoop ld a, OTPARTYMON - ld [MonType], a + ld [wMonType], a call HideCursor push hl push bc @@ -1331,7 +1331,7 @@ LinkTradePartymonMenuLoop: ; 288c5 jr z, LinkTradePartiesMenuMasterLoop ld a, [wMenuCursorY] ld b, a - ld a, [PartyCount] + ld a, [wPartyCount] cp b jr nz, LinkTradePartiesMenuMasterLoop call HideCursor @@ -1346,7 +1346,7 @@ LinkTradePartymonMenuLoop: ; 288c5 ; 2891c LinkTradePartiesMenuMasterLoop: ; 2891c - ld a, [MonType] + ld a, [wMonType] and a jp z, LinkTradePartymonMenuLoop ; PARTYMON jp LinkTradeOTPartymonMenuLoop ; OTPARTYMON @@ -1480,7 +1480,7 @@ Function28926: ; 28926 ld [wcf57], a ld [wOtherPlayerLinkAction], a ld a, [wd003] - ld hl, OTPartySpecies + ld hl, wOTPartySpecies ld c, a ld b, 0 add hl, bc @@ -1558,7 +1558,7 @@ Function28ade: ; 28ade pop af bit D_UP_F, a jr z, .d_up - ld a, [OTPartyCount] + ld a, [wOTPartyCount] ld [wMenuCursorY], a jp LinkTrade_OTPartyMenu @@ -1648,19 +1648,19 @@ LinkTrade: ; 28b87 call LinkTextboxAtHL farcall Link_WaitBGMap ld a, [wd002] - ld hl, PartySpecies + ld hl, wPartySpecies ld c, a ld b, 0 add hl, bc ld a, [hl] ld [wd265], a call GetPokemonName - ld hl, StringBuffer1 + ld hl, wStringBuffer1 ld de, wd004 ld bc, MON_NAME_LENGTH call CopyBytes ld a, [wd003] - ld hl, OTPartySpecies + ld hl, wOTPartySpecies ld c, a ld b, 0 add hl, bc @@ -1763,7 +1763,7 @@ LinkTrade: ; 28b87 .asm_28ca6 ld hl, sPartyMail - ld a, [PartyCount] + ld a, [wPartyCount] dec a ld bc, MAIL_STRUCT_LENGTH call AddNTimes @@ -1776,12 +1776,12 @@ LinkTrade: ; 28b87 ld bc, MAIL_STRUCT_LENGTH call CopyBytes call CloseSRAM - ld hl, PlayerName + ld hl, wPlayerName ld de, wPlayerTrademonSenderName ld bc, NAME_LENGTH call CopyBytes ld a, [wd002] - ld hl, PartySpecies + ld hl, wPartySpecies ld b, 0 ld c, a add hl, bc @@ -1789,19 +1789,19 @@ LinkTrade: ; 28b87 ld [wPlayerTrademonSpecies], a push af ld a, [wd002] - ld hl, PartyMonOT + ld hl, wPartyMonOT call SkipNames ld de, wPlayerTrademonOTName ld bc, NAME_LENGTH call CopyBytes - ld hl, PartyMon1ID + ld hl, wPartyMon1ID ld a, [wd002] call GetPartyLocation ld a, [hli] ld [wPlayerTrademonID], a ld a, [hl] ld [wPlayerTrademonID + 1], a - ld hl, PartyMon1DVs + ld hl, wPartyMon1DVs ld a, [wd002] call GetPartyLocation ld a, [hli] @@ -1809,38 +1809,38 @@ LinkTrade: ; 28b87 ld a, [hl] ld [wPlayerTrademonDVs + 1], a ld a, [wd002] - ld hl, PartyMon1Species + ld hl, wPartyMon1Species call GetPartyLocation ld b, h ld c, l farcall GetCaughtGender ld a, c ld [wPlayerTrademonCaughtData], a - ld hl, OTPlayerName + ld hl, wOTPlayerName ld de, wOTTrademonSenderName ld bc, NAME_LENGTH call CopyBytes ld a, [wd003] - ld hl, OTPartySpecies + ld hl, wOTPartySpecies ld b, 0 ld c, a add hl, bc ld a, [hl] ld [wOTTrademonSpecies], a ld a, [wd003] - ld hl, OTPartyMonOT + ld hl, wOTPartyMonOT call SkipNames ld de, wOTTrademonOTName ld bc, NAME_LENGTH call CopyBytes - ld hl, OTPartyMon1ID + ld hl, wOTPartyMon1ID ld a, [wd003] call GetPartyLocation ld a, [hli] ld [wOTTrademonID], a ld a, [hl] ld [wOTTrademonID + 1], a - ld hl, OTPartyMon1DVs + ld hl, wOTPartyMon1DVs ld a, [wd003] call GetPartyLocation ld a, [hli] @@ -1848,7 +1848,7 @@ LinkTrade: ; 28b87 ld a, [hl] ld [wOTTrademonDVs + 1], a ld a, [wd003] - ld hl, OTPartyMon1Species + ld hl, wOTPartyMon1Species call GetPartyLocation ld b, h ld c, l @@ -1856,8 +1856,8 @@ LinkTrade: ; 28b87 ld a, c ld [wOTTrademonCaughtData], a ld a, [wd002] - ld [CurPartyMon], a - ld hl, PartySpecies + ld [wCurPartyMon], a + ld hl, wPartySpecies ld b, 0 ld c, a add hl, bc @@ -1866,14 +1866,14 @@ LinkTrade: ; 28b87 xor a ld [wPokemonWithdrawDepositParameter], a callfar RemoveMonFromPartyOrBox - ld a, [PartyCount] + ld a, [wPartyCount] dec a - ld [CurPartyMon], a + ld [wCurPartyMon], a ld a, TRUE ld [wForceEvolution], a ld a, [wd003] push af - ld hl, OTPartySpecies + ld hl, wOTPartySpecies ld b, 0 ld c, a add hl, bc @@ -1897,23 +1897,23 @@ LinkTrade: ; 28b87 .done_animation pop af ld c, a - ld [CurPartyMon], a - ld hl, OTPartySpecies + ld [wCurPartyMon], a + ld hl, wOTPartySpecies ld d, 0 ld e, a add hl, de ld a, [hl] - ld [CurPartySpecies], a - ld hl, OTPartyMon1Species + ld [wCurPartySpecies], a + ld hl, wOTPartyMon1Species ld a, c call GetPartyLocation - ld de, TempMonSpecies + ld de, wTempMonSpecies ld bc, PARTYMON_STRUCT_LENGTH call CopyBytes predef AddTempmonToParty - ld a, [PartyCount] + ld a, [wPartyCount] dec a - ld [CurPartyMon], a + ld [wCurPartyMon], a callfar EvolvePokemon call ClearScreen call LoadTradeScreenBorder @@ -1924,14 +1924,14 @@ LinkTrade: ; 28b87 ld c, a cp MEW jr z, .loop - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] cp MEW jr z, .loop ld b, $2 ld a, c cp CELEBI jr z, .loop - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] cp CELEBI jr z, .loop ld b, $0 @@ -2032,14 +2032,14 @@ Unreferenced_Function28f09: ; 28f09 INCLUDE "engine/trade_animation.asm" Special_CheckTimeCapsuleCompatibility: ; 29bfb -; Checks to see if your Party is compatible with the generation 1 games. Returns the following in ScriptVar: +; Checks to see if your Party is compatible with the generation 1 games. Returns the following in wScriptVar: ; 0: Party is okay ; 1: At least one Pokemon was introduced in GS ; 2: At least one Pokemon has a move that was introduced in GS ; 3: At least one Pokemon is holding mail ; If any party Pokemon was introduced in the generation 2 games, don't let it in. - ld hl, PartySpecies + ld hl, wPartySpecies ld b, PARTY_LENGTH .loop ld a, [hli] @@ -2052,9 +2052,9 @@ Special_CheckTimeCapsuleCompatibility: ; 29bfb ; If any party Pokemon is holding mail, don't let it in. .checkitem - ld a, [PartyCount] + ld a, [wPartyCount] ld b, a - ld hl, PartyMon1Item + ld hl, wPartyMon1Item .itemloop push hl push bc @@ -2069,8 +2069,8 @@ Special_CheckTimeCapsuleCompatibility: ; 29bfb jr nz, .itemloop ; If any party Pokemon has a move that was introduced in the generation 2 games, don't let it in. - ld hl, PartyMon1Moves - ld a, [PartyCount] + ld hl, wPartyMon1Moves + ld a, [wPartyCount] ld b, a .move_loop ld c, NUM_MOVES @@ -2080,7 +2080,7 @@ Special_CheckTimeCapsuleCompatibility: ; 29bfb jr nc, .move_too_new dec c jr nz, .move_next - ld de, PartyMon2 - (PartyMon1 + NUM_MOVES) + ld de, wPartyMon2 - (wPartyMon1 + NUM_MOVES) add hl, de dec b jr nz, .move_loop @@ -2108,17 +2108,17 @@ Special_CheckTimeCapsuleCompatibility: ; 29bfb ld a, $3 .done - ld [ScriptVar], a + ld [wScriptVar], a ret ; 29c67 Function29c67: ; 29c67 - ld a, [PartyCount] + ld a, [wPartyCount] sub b ld c, a inc c ld b, 0 - ld hl, PartyCount + ld hl, wPartyCount add hl, bc ld a, [hl] ld [wd265], a @@ -2280,12 +2280,12 @@ Special_WaitForLinkedFriend: ; 29d11 ld c, 50 call DelayFrames ld a, $1 - ld [ScriptVar], a + ld [wScriptVar], a ret .done xor a - ld [ScriptVar], a + ld [wScriptVar], a ret ; 29d92 @@ -2305,7 +2305,7 @@ Special_CheckLinkTimeout: ; 29d92 call Link_CheckCommunicationError xor a ld [hVBlank], a - ld a, [ScriptVar] + ld a, [wScriptVar] and a ret nz jp Link_ResetSerialRegistersAfterLinkClosure @@ -2325,7 +2325,7 @@ Function29dba: ; 29dba call DelayFrame call DelayFrame call Link_CheckCommunicationError - ld a, [ScriptVar] + ld a, [wScriptVar] and a jr z, .vblank ld bc, -1 @@ -2350,7 +2350,7 @@ Function29dba: ; 29dba .script_var xor a - ld [ScriptVar], a + ld [wScriptVar], a ret .vblank @@ -2382,7 +2382,7 @@ Link_CheckCommunicationError: ; 29e0c ld a, $1 .load_scriptvar - ld [ScriptVar], a + ld [wScriptVar], a ld hl, wLinkTimeoutFrames xor a ld [hli], a @@ -2435,7 +2435,7 @@ Special_TryQuickSave: ; 29e66 jr nc, .return_result xor a ; FALSE .return_result - ld [ScriptVar], a + ld [wScriptVar], a ld c, 30 call DelayFrames pop af @@ -2461,12 +2461,12 @@ Special_CheckBothSelectedSameRoom: ; 29e82 xor a ld [hVBlank], a ld a, TRUE - ld [ScriptVar], a + ld [wScriptVar], a ret .fail xor a ; FALSE - ld [ScriptVar], a + ld [wScriptVar], a ret ; 29eaf @@ -2568,7 +2568,7 @@ Special_CableClubCheckWhichChris: ; 29f47 dec a ; FALSE .yes - ld [ScriptVar], a + ld [wScriptVar], a ret ; 29f54 diff --git a/engine/link_2.asm b/engine/link_2.asm index 866126cd2..e2fe47dc5 100644 --- a/engine/link_2.asm +++ b/engine/link_2.asm @@ -1,10 +1,10 @@ LinkMonStatsScreen: ; 4d319 ld a, [wMenuCursorY] dec a - ld [CurPartyMon], a + ld [wCurPartyMon], a call LowVolume predef StatsScreenInit - ld a, [CurPartyMon] + ld a, [wCurPartyMon] inc a ld [wMenuCursorY], a call ClearScreen @@ -31,7 +31,7 @@ LinkTextbox2: ; 4d35b pop hl pop bc - ld de, AttrMap - TileMap + ld de, wAttrMap - wTileMap add hl, de inc b inc b diff --git a/engine/link_trade.asm b/engine/link_trade.asm index 504dc6d95..bb3423051 100755 --- a/engine/link_trade.asm +++ b/engine/link_trade.asm @@ -52,7 +52,7 @@ _LinkTextbox: ; 16d61d pop hl pop bc - ld de, AttrMap - TileMap + ld de, wAttrMap - wTileMap add hl, de inc b inc b diff --git a/engine/load_font.asm b/engine/load_font.asm index 345fa6ff6..40dbb9c10 100644 --- a/engine/load_font.asm +++ b/engine/load_font.asm @@ -81,7 +81,7 @@ _LoadFontsBattleExtra:: ; fb4be ; fb4cc LoadFrame: ; fb4cc - ld a, [TextBoxFrame] + ld a, [wTextBoxFrame] maskbits NUM_FRAMES ld bc, 6 * LEN_1BPP_TILE ld hl, Frames diff --git a/engine/load_pics.asm b/engine/load_pics.asm index 5d3becf42..0558fb7f7 100755 --- a/engine/load_pics.asm +++ b/engine/load_pics.asm @@ -1,5 +1,5 @@ GetUnownLetter: ; 51040 -; Return Unown letter in UnownLetter based on DVs at hl +; Return Unown letter in wUnownLetter based on DVs at hl ; Take the middle 2 bits of each DV and place them in order: ; atk def spd spc @@ -45,12 +45,12 @@ GetUnownLetter: ; 51040 ; Increment to get 1-26 ld a, [hQuotient + 2] inc a - ld [UnownLetter], a + ld [wUnownLetter], a ret GetMonFrontpic: ; 51077 - ld a, [CurPartySpecies] - ld [CurSpecies], a + ld a, [wCurPartySpecies] + ld [wCurSpecies], a call IsAPokemon ret c ld a, [rSVBK] @@ -61,8 +61,8 @@ GetMonFrontpic: ; 51077 ret GetAnimatedFrontpic: ; 5108b - ld a, [CurPartySpecies] - ld [CurSpecies], a + ld a, [wCurPartySpecies] + ld [wCurSpecies], a call IsAPokemon ret c ld a, [rSVBK] @@ -78,7 +78,7 @@ GetAnimatedFrontpic: ; 5108b _GetFrontpic: ; 510a5 push de call GetBaseData - ld a, [BasePicSize] + ld a, [wBasePicSize] and $f ld b, a push bc @@ -105,15 +105,15 @@ _GetFrontpic: ; 510a5 GetFrontpicPointer: ; 510d7 GLOBAL PokemonPicPointers, UnownPicPointers - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] cp UNOWN jr z, .unown - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] ld d, BANK(PokemonPicPointers) jr .ok .unown - ld a, [UnownLetter] + ld a, [wUnownLetter] ld d, BANK(UnownPicPointers) .ok @@ -144,8 +144,8 @@ GetAnimatedEnemyFrontpic: ; 51103 ld de, 7 * 7 tiles add hl, de push hl - ld a, BANK(BasePicSize) - ld hl, BasePicSize + ld a, BANK(wBasePicSize) + ld hl, wBasePicSize call GetFarWRAMByte pop hl and $f @@ -196,13 +196,13 @@ LoadFrontpicTiles: ; 5114f ret GetMonBackpic: ; 5116c - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] call IsAPokemon ret c - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] ld b, a - ld a, [UnownLetter] + ld a, [wUnownLetter] ld c, a ld a, [rSVBK] push af @@ -311,7 +311,7 @@ Function511ec: ; 511ec ret GetTrainerPic: ; 5120d - ld a, [TrainerClass] + ld a, [wTrainerClass] and a ret z cp NUM_TRAINER_CLASSES @@ -320,7 +320,7 @@ GetTrainerPic: ; 5120d xor a ld [hBGMapMode], a ld hl, TrainerPicPointers - ld a, [TrainerClass] + ld a, [wTrainerClass] dec a ld bc, 3 call AddNTimes diff --git a/engine/mail.asm b/engine/mail.asm index 68b16fd10..c1a2db5aa 100755 --- a/engine/mail.asm +++ b/engine/mail.asm @@ -12,7 +12,7 @@ SendMailToPC: ; 4456e call AddNTimes ld d, h ld e, l - ld a, [CurPartyMon] + ld a, [wCurPartyMon] ld bc, MAIL_STRUCT_LENGTH ld hl, sPartyMail call AddNTimes @@ -92,7 +92,7 @@ MoveMailFromPCToParty: ; 44607 ld hl, sMailbox call AddNTimes push hl - ld a, [CurPartyMon] + ld a, [wCurPartyMon] ld bc, MAIL_STRUCT_LENGTH ld hl, sPartyMail call AddNTimes @@ -106,8 +106,8 @@ MoveMailFromPCToParty: ; 44607 ld de, PARTYMON_STRUCT_LENGTH - MON_MOVES add hl, de ld d, [hl] - ld a, [CurPartyMon] - ld hl, PartyMon1Item + ld a, [wCurPartyMon] + ld hl, wPartyMon1Item ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes ld [hl], d @@ -131,8 +131,8 @@ CheckPokeItem:: ; 44654 ld a, POKEMAIL_REFUSED jr c, .pop_return - ld a, [CurPartyMon] - ld hl, PartyMon1Item + ld a, [wCurPartyMon] + ld hl, wPartyMon1Item ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes ld d, [hl] @@ -142,7 +142,7 @@ CheckPokeItem:: ; 44654 ld a, BANK(sPartyMail) call GetSRAMBank - ld a, [CurPartyMon] + ld a, [wCurPartyMon] ld hl, sPartyMail ld bc, MAIL_STRUCT_LENGTH call AddNTimes @@ -189,17 +189,17 @@ CheckPokeItem:: ; 44654 pop bc .return - ld [ScriptVar], a + ld [wScriptVar], a ret ; 446cc GivePokeItem:: ; 446cc - ld a, [PartyCount] + ld a, [wPartyCount] dec a push af push bc - ld hl, PartyMon1Item + ld hl, wPartyMon1Item ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes pop bc @@ -219,13 +219,13 @@ GivePokeItem:: ; 446cc call CopyBytes pop af push af - ld hl, PartyMonOT + ld hl, wPartyMonOT ld bc, NAME_LENGTH call AddNTimes ld bc, NAME_LENGTH - 1 call CopyBytes pop af - ld hl, PartyMon1ID + ld hl, wPartyMon1ID ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes ld a, [hli] @@ -234,7 +234,7 @@ GivePokeItem:: ; 446cc ld a, [hl] ld [de], a inc de - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] ld [de], a inc de pop bc @@ -287,11 +287,11 @@ DeletePartyMonMail: ; 44765 (11:4765) IsAnyMonHoldingMail: ; 44781 - ld a, [PartyCount] + ld a, [wPartyCount] and a jr z, .no_mons ld e, a - ld hl, PartyMon1Item + ld hl, wPartyMon1Item .loop ld d, [hl] push hl @@ -362,7 +362,7 @@ MailboxPC_GetMailAuthor: ; 0x447da call AddNTimes ld a, BANK(sMailboxCount) call GetSRAMBank - ld de, StringBuffer2 + ld de, wStringBuffer2 push de ld bc, NAME_LENGTH - 1 call CopyBytes @@ -375,7 +375,7 @@ MailboxPC_GetMailAuthor: ; 0x447da MailboxPC_PrintMailAuthor: ; 0x447fb push de - ld a, [MenuSelection] + ld a, [wMenuSelection] call MailboxPC_GetMailAuthor pop hl jp PlaceString @@ -439,7 +439,7 @@ MailboxPC: ; 0x44806 .ReadMail: ; 0x44869 call FadeToMenu - ld a, [MenuSelection] + ld a, [wMenuSelection] dec a ld b, a call ReadMailMessage @@ -452,19 +452,19 @@ MailboxPC: ; 0x44806 call YesNoBox call ExitMenu ret c - ld a, [MenuSelection] + ld a, [wMenuSelection] dec a call .GetMailType ld a, 1 ld [wItemQuantityChangeBuffer], a - ld hl, NumItems + ld hl, wNumItems call ReceiveItem jr c, .put_in_bag ld hl, .PackFullText jp MenuTextBoxBackup .put_in_bag - ld a, [MenuSelection] + ld a, [wMenuSelection] dec a ld b, a call DeleteMailFromPC @@ -493,14 +493,14 @@ MailboxPC: ; 0x44806 ld bc, MAIL_STRUCT_LENGTH call AddNTimes ld a, [hl] - ld [CurItem], a + ld [wCurItem], a jp CloseSRAM ; 0x448d2 .AttachMail: ; 0x448d2 call FadeToMenu xor a - ld [PartyMenuActionText], a + ld [wPartyMenuActionText], a call ClearBGPalettes .try_again farcall LoadPartyMenuGFX @@ -513,7 +513,7 @@ MailboxPC: ; 0x44806 call DelayFrame farcall PartyMenuSelect jr c, .exit2 - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] cp EGG jr z, .egg ld a, MON_ITEM @@ -531,7 +531,7 @@ MailboxPC: ; 0x44806 jr .try_again .attach_mail - ld a, [MenuSelection] + ld a, [wMenuSelection] dec a ld b, a call MoveMailFromPCToParty diff --git a/engine/mail_2.asm b/engine/mail_2.asm index 4450063a4..6e326641b 100755 --- a/engine/mail_2.asm +++ b/engine/mail_2.asm @@ -1,5 +1,5 @@ ReadPartyMonMail: ; b9229 - ld a, [CurPartyMon] + ld a, [wCurPartyMon] ld hl, sPartyMail ld bc, MAIL_STRUCT_LENGTH call AddNTimes @@ -35,7 +35,7 @@ ReadAnyMail: ; b9237 call .LoadGFX call EnableLCD call WaitBGMap - ld a, [Buffer3] + ld a, [wBuffer3] ld e, a farcall LoadMailPalettes call SetPalettes @@ -74,11 +74,11 @@ ReadAnyMail: ; b9237 ld de, sPartyMon1MailAuthorID - sPartyMon1Mail add hl, de ld a, [hli] - ld [Buffer1], a + ld [wBuffer1], a ld a, [hli] - ld [Buffer2], a + ld [wBuffer2], a ld a, [hli] - ld [CurPartySpecies], a + ld [wCurPartySpecies], a ld b, [hl] call CloseSRAM ld hl, MailGFXPointers @@ -100,7 +100,7 @@ ReadAnyMail: ; b9237 .got_pointer ld a, c - ld [Buffer3], a + ld [wBuffer3], a ld a, [hli] ld h, [hl] ld l, a @@ -567,7 +567,7 @@ LoadPortraitMailGFX: ; b96ca call Mail_DrawRowLoop call LovelyEonMail_PlaceIcons ld a, $1 - ld [UnownLetter], a + ld [wUnownLetter], a hlcoord 1, 10 call PrepMonFrontpic pop hl @@ -712,7 +712,7 @@ MailGFX_PlaceMessage: ; b9803 ld a, [de] and a ret z - ld a, [Buffer3] + ld a, [wBuffer3] hlcoord 8, 14 cp $3 ; PORTRAITMAIL jr z, .place_author diff --git a/engine/main_menu.asm b/engine/main_menu.asm index f82c6072a..9d3d8cbdb 100755 --- a/engine/main_menu.asm +++ b/engine/main_menu.asm @@ -20,7 +20,7 @@ MainMenu: ; 49cdc call CloseWindow jr c, .quit call ClearTileMap - ld a, [MenuSelection] + ld a, [wMenuSelection] ld hl, .Jumptable rst JumpTable jr MainMenu @@ -225,13 +225,13 @@ MainMenu_PrintCurrentTimeAndDay: ; 49e09 xor a ld [hBGMapMode], a call .PlaceBox - ld hl, Options + ld hl, wOptions ld a, [hl] push af set NO_TEXT_SCROLL, [hl] call .PlaceTime pop af - ld [Options], a + ld [wOptions], a ld a, $1 ld [hBGMapMode], a ret diff --git a/engine/map_object_action.asm b/engine/map_object_action.asm index ec5ad887e..c82cd80a2 100755 --- a/engine/map_object_action.asm +++ b/engine/map_object_action.asm @@ -263,7 +263,7 @@ SetFacingBigDollAsym: ; 45be ; 45c5 SetFacingBigDoll: ; 45c5 - ld a, [VariableSprites + SPRITE_BIG_DOLL - SPRITE_VARS] + ld a, [wVariableSprites + SPRITE_BIG_DOLL - SPRITE_VARS] ld d, FACING_BIG_DOLL_SYM ; symmetric cp SPRITE_BIG_SNORLAX jr z, .ok diff --git a/engine/map_objects.asm b/engine/map_objects.asm index 00ce599e3..b3efc5fb7 100644 --- a/engine/map_objects.asm +++ b/engine/map_objects.asm @@ -40,7 +40,7 @@ Function437b: ; 437b ld hl, OBJECT_FLAGS2 add hl, bc res 6, [hl] - ld a, [XCoord] + ld a, [wXCoord] ld e, a ld hl, OBJECT_NEXT_MAP_X add hl, bc @@ -50,7 +50,7 @@ Function437b: ; 437b jr c, .ok cp MAPOBJECT_SCREEN_WIDTH jr nc, .ok - ld a, [YCoord] + ld a, [wYCoord] ld e, a ld hl, OBJECT_NEXT_MAP_Y add hl, bc @@ -66,7 +66,7 @@ Function437b: ; 437b ld hl, OBJECT_FLAGS2 add hl, bc set 6, [hl] - ld a, [XCoord] + ld a, [wXCoord] ld e, a ld hl, OBJECT_INIT_X add hl, bc @@ -76,7 +76,7 @@ Function437b: ; 437b jr c, .ok2 cp MAPOBJECT_SCREEN_WIDTH jr nc, .ok2 - ld a, [YCoord] + ld a, [wYCoord] ld e, a ld hl, OBJECT_INIT_Y add hl, bc @@ -169,7 +169,7 @@ asm_4448 ; 444d _HandleObjectAction -; call [4 * ObjectStructs[ObjInd, OBJECT_ACTION] + de] +; call [4 * wObjectStructs[ObjInd, OBJECT_ACTION] + de] ld hl, OBJECT_ACTION add hl, bc ld a, [hl] @@ -2149,7 +2149,7 @@ DespawnEmote: ; 5579 ret .DeleteEmote: - ld de, ObjectStructs + ld de, wObjectStructs ld a, NUM_OBJECT_STRUCTS .loop push af @@ -2223,10 +2223,10 @@ CopyTempObjectData: ; 55b9 ; 55e0 Function55e0:: ; 55e0 - ld a, [VramState] + ld a, [wVramState] bit 0, a ret z - ld bc, ObjectStructs + ld bc, wObjectStructs xor a .loop ld [hMapObjectIndexBuffer], a @@ -2289,7 +2289,7 @@ Function5629: ; 5629 Function5645: ; 5645 xor a - ld bc, ObjectStructs + ld bc, wObjectStructs .loop ld [hMapObjectIndexBuffer], a call SetFacing_Standing @@ -2359,7 +2359,7 @@ Function56a3: ; 56a3 ld e, [hl] inc d inc e - ld a, [XCoord] + ld a, [wXCoord] cp d jr z, .equal_x jr nc, .nope @@ -2367,7 +2367,7 @@ Function56a3: ; 56a3 cp d jr c, .nope .equal_x - ld a, [YCoord] + ld a, [wYCoord] cp e jr z, .equal_y jr nc, .nope @@ -2508,7 +2508,7 @@ HandleNPCStep:: ; 576a ret .DoStepsForAllObjects: - ld bc, ObjectStructs + ld bc, wObjectStructs xor a .loop ld [hMapObjectIndexBuffer], a @@ -2533,7 +2533,7 @@ RefreshPlayerSprite: ; 579d ld [wPlayerMovement], a xor a ld [wPlayerTurningDirection], a - ld [PlayerObjectStepFrame], a + ld [wPlayerObjectStepFrame], a call .TryResetPlayerAction farcall CheckWarpFacingDown call c, SpawnInFacingDown @@ -2549,7 +2549,7 @@ RefreshPlayerSprite: ; 579d .ok ld a, OBJECT_ACTION_00 - ld [PlayerAction], a + ld [wPlayerAction], a ret ; 57ca @@ -2567,7 +2567,7 @@ RefreshPlayerSprite: ; 579d SpawnInFacingDown: ; 57d9 ld a, 0 ContinueSpawnFacing: ; 57db - ld bc, PlayerStruct + ld bc, wPlayerStruct call SetSpriteDirection ret ; 57e2 @@ -2586,7 +2586,7 @@ SetPlayerPalette: ; 57e2 swap a and %00000111 ld d, a - ld bc, PlayerStruct + ld bc, wPlayerStruct ld hl, OBJECT_PALETTE add hl, bc ld a, [hl] @@ -2681,7 +2681,7 @@ Function586e: ; 586e ; 587a Function587a: ; 587a - ld bc, ObjectStructs + ld bc, wObjectStructs xor a .loop push af @@ -2726,7 +2726,7 @@ _SetFlagsForMovement_2:: ; 5897 Function58b9:: ; 58b9 push bc - ld bc, ObjectStructs + ld bc, wObjectStructs xor a .loop push af @@ -2803,7 +2803,7 @@ Function5903: ; 5903 ; 5920 _UpdateSprites:: ; 5920 - ld a, [VramState] + ld a, [wVramState] bit 0, a ret z xor a @@ -2819,9 +2819,9 @@ _UpdateSprites:: ; 5920 ret .fill - ld a, [VramState] + ld a, [wVramState] bit 1, a - ld b, LOW(SpritesEnd) + ld b, LOW(wVirtualOAMEnd) jr z, .ok ld b, 28 * SPRITEOAMSTRUCT_LENGTH .ok @@ -2829,7 +2829,7 @@ _UpdateSprites:: ; 5920 cp b ret nc ld l, a - ld h, HIGH(Sprites) + ld h, HIGH(wVirtualOAM) ld de, SPRITEOAMSTRUCT_LENGTH ld a, b ld c, SCREEN_HEIGHT_PX + 2 * TILE_WIDTH @@ -2849,7 +2849,7 @@ ApplyBGMapAnchorToObjects: ; 5958 ld d, a ld a, [wPlayerBGMapOffsetY] ld e, a - ld bc, ObjectStructs + ld bc, wObjectStructs ld a, NUM_OBJECT_STRUCTS .loop push af @@ -2903,7 +2903,7 @@ InitSprites: ; 5991 ld bc, NUM_OBJECT_STRUCTS call ByteFill ld d, 0 - ld bc, ObjectStructs + ld bc, wObjectStructs ld hl, wMovementPointer .loop push hl @@ -3043,11 +3043,11 @@ InitSprites: ; 5991 ld l, a ld a, [hUsedSpriteIndex] ld c, a - ld b, HIGH(Sprites) + ld b, HIGH(wVirtualOAM) ld a, [hli] ld [hUsedSpriteTile], a add c - cp LOW(SpritesEnd) + cp LOW(wVirtualOAMEnd) jr nc, .full .addsprite ld a, [hFFC0] @@ -3107,17 +3107,17 @@ InitSprites: ; 5991 ret .Addresses: ; 5ace - dw PlayerStruct - dw Object1Struct - dw Object2Struct - dw Object3Struct - dw Object4Struct - dw Object5Struct - dw Object6Struct - dw Object7Struct - dw Object8Struct - dw Object9Struct - dw Object10Struct - dw Object11Struct - dw Object12Struct + dw wPlayerStruct + dw wObject1Struct + dw wObject2Struct + dw wObject3Struct + dw wObject4Struct + dw wObject5Struct + dw wObject6Struct + dw wObject7Struct + dw wObject8Struct + dw wObject9Struct + dw wObject10Struct + dw wObject11Struct + dw wObject12Struct ; 5ae8 diff --git a/engine/map_objects_2.asm b/engine/map_objects_2.asm index 3c9a9773c..038e2b49b 100644 --- a/engine/map_objects_2.asm +++ b/engine/map_objects_2.asm @@ -4,7 +4,7 @@ LoadObjectMasks: ; 2454f ld bc, NUM_OBJECTS call ByteFill nop - ld bc, MapObjects + ld bc, wMapObjects ld de, wObjectMasks xor a .loop diff --git a/engine/map_palettes.asm b/engine/map_palettes.asm index ffeef7bf6..f8e23e058 100644 --- a/engine/map_palettes.asm +++ b/engine/map_palettes.asm @@ -1,6 +1,6 @@ SwapTextboxPalettes:: ; 4c000 hlcoord 0, 0 - decoord 0, 0, AttrMap + decoord 0, 0, wAttrMap ld b, SCREEN_HEIGHT .loop push bc @@ -10,10 +10,10 @@ SwapTextboxPalettes:: ; 4c000 push hl srl a jr c, .UpperNybble - ld hl, TilesetPalettes + ld hl, wTilesetPalettes add [hl] ld l, a - ld a, [TilesetPalettes + 1] + ld a, [wTilesetPalettes + 1] adc $0 ld h, a ld a, [hl] @@ -21,10 +21,10 @@ SwapTextboxPalettes:: ; 4c000 jr .next .UpperNybble: - ld hl, TilesetPalettes + ld hl, wTilesetPalettes add [hl] ld l, a - ld a, [TilesetPalettes + 1] + ld a, [wTilesetPalettes + 1] adc $0 ld h, a ld a, [hl] @@ -45,8 +45,8 @@ SwapTextboxPalettes:: ; 4c000 ret ScrollBGMapPalettes:: ; 4c03f - ld hl, BGMapBuffer - ld de, BGMapPalBuffer + ld hl, wBGMapBuffer + ld de, wBGMapPalBuffer .loop ld a, [hl] push hl @@ -54,10 +54,10 @@ ScrollBGMapPalettes:: ; 4c03f jr c, .UpperNybble ; .LowerNybble - ld hl, TilesetPalettes + ld hl, wTilesetPalettes add [hl] ld l, a - ld a, [TilesetPalettes + 1] + ld a, [wTilesetPalettes + 1] adc $0 ld h, a ld a, [hl] @@ -65,10 +65,10 @@ ScrollBGMapPalettes:: ; 4c03f jr .next .UpperNybble: - ld hl, TilesetPalettes + ld hl, wTilesetPalettes add [hl] ld l, a - ld a, [TilesetPalettes + 1] + ld a, [wTilesetPalettes + 1] adc $0 ld h, a ld a, [hl] diff --git a/engine/map_setup.asm b/engine/map_setup.asm index b3905b71e..1cd660f86 100644 --- a/engine/map_setup.asm +++ b/engine/map_setup.asm @@ -172,12 +172,12 @@ CheckReplaceKrisSprite: ; 154f7 bit 1, [hl] ret z ld a, PLAYER_BIKE - ld [PlayerState], a + ld [wPlayerState], a scf ret .CheckSurfing2: ; 1551a (5:551a) - ld a, [PlayerState] + ld a, [wPlayerState] cp PLAYER_NORMAL jr z, .nope cp PLAYER_SKATE @@ -195,12 +195,12 @@ CheckReplaceKrisSprite: ; 154f7 jr z, .checkbiking jr .nope .checkbiking - ld a, [PlayerState] + ld a, [wPlayerState] cp PLAYER_BIKE jr nz, .nope .surfing ld a, PLAYER_NORMAL - ld [PlayerState], a + ld [wPlayerState], a scf ret @@ -211,13 +211,13 @@ CheckReplaceKrisSprite: ; 154f7 .CheckSurfing: ; 1554e (5:554e) call CheckOnWater jr nz, .ret_nc - ld a, [PlayerState] + ld a, [wPlayerState] cp PLAYER_SURF jr z, ._surfing cp PLAYER_SURF_PIKA jr z, ._surfing ld a, PLAYER_SURF - ld [PlayerState], a + ld [wPlayerState], a ._surfing scf ret @@ -238,22 +238,22 @@ RetainOldPalettes: ; 1556d RotatePalettesRightMapAndMusic: ; 15574 ld e, 0 - ld a, [MusicFadeID] + ld a, [wMusicFadeID] ld d, 0 - ld a, [MusicFadeID + 1] + ld a, [wMusicFadeID + 1] ld a, $4 - ld [MusicFade], a + ld [wMusicFade], a call RotateThreePalettesRight ret ; 15587 ForceMapMusic: ; 15587 - ld a, [PlayerState] + ld a, [wPlayerState] cp PLAYER_BIKE jr nz, .notbiking call VolumeOff ld a, $88 - ld [MusicFade], a + ld [wMusicFade], a .notbiking call TryRestartMapMusic ret diff --git a/engine/mapgroup_roofs.asm b/engine/mapgroup_roofs.asm index 2cd734234..58e5e7cfe 100644 --- a/engine/mapgroup_roofs.asm +++ b/engine/mapgroup_roofs.asm @@ -1,5 +1,5 @@ LoadMapGroupRoof:: ; 1c000 - ld a, [MapGroup] + ld a, [wMapGroup] ld e, a ld d, 0 ld hl, MapGroupRoofs diff --git a/engine/mart.asm b/engine/mart.asm index d4c0b623b..84888eccc 100755 --- a/engine/mart.asm +++ b/engine/mart.asm @@ -9,9 +9,9 @@ OpenMartDialog:: ; 15a45 call GetMart ld a, c - ld [EngineBuffer1], a + ld [wEngineBuffer1], a call LoadMartPointer - ld a, [EngineBuffer1] + ld a, [wEngineBuffer1] ld hl, .dialogs rst JumpTable ret @@ -27,9 +27,9 @@ OpenMartDialog:: ; 15a45 MartDialog: ; 15a61 ld a, 0 - ld [EngineBuffer1], a + ld [wEngineBuffer1], a xor a - ld [EngineBuffer5], a + ld [wEngineBuffer5], a call StandardMart ret ; 15a6e @@ -103,19 +103,19 @@ INCLUDE "data/items/rooftop_sale.asm" LoadMartPointer: ; 15b10 ld a, b - ld [MartPointerBank], a + ld [wMartPointerBank], a ld a, e - ld [MartPointer], a + ld [wMartPointer], a ld a, d - ld [MartPointer + 1], a - ld hl, CurMart + ld [wMartPointer + 1], a + ld hl, wCurMart xor a ld bc, 16 call ByteFill xor a - ld [EngineBuffer5], a + ld [wEngineBuffer5], a ld [wBargainShopFlags], a - ld [FacingDirection], a + ld [wFacingDirection], a ret ; 15b31 @@ -140,10 +140,10 @@ GetMart: ; 15b31 StandardMart: ; 15b47 .loop - ld a, [EngineBuffer5] + ld a, [wEngineBuffer5] ld hl, .MartFunctions rst JumpTable - ld [EngineBuffer5], a + ld [wEngineBuffer5], a cp $ff jr nz, .loop ret @@ -219,13 +219,13 @@ StandardMart: ; 15b47 ; 15bbb FarReadMart: ; 15bbb - ld hl, MartPointer + ld hl, wMartPointer ld a, [hli] ld h, [hl] ld l, a - ld de, CurMart + ld de, wCurMart .CopyMart: - ld a, [MartPointerBank] + ld a, [wMartPointerBank] call GetFarByte ld [de], a inc hl @@ -233,7 +233,7 @@ FarReadMart: ; 15bbb cp -1 jr nz, .CopyMart ld hl, wMartItem1BCD - ld de, CurMart + 1 + ld de, wCurMart + 1 .ReadMartItem: ld a, [de] inc de @@ -249,26 +249,26 @@ FarReadMart: ; 15bbb ; 15be5 GetMartItemPrice: ; 15be5 -; Return the price of item a in BCD at hl and in tiles at StringBuffer1. +; Return the price of item a in BCD at hl and in tiles at wStringBuffer1. push hl - ld [CurItem], a + ld [wCurItem], a farcall GetItemPrice pop hl GetMartPrice: ; 15bf0 -; Return price de in BCD at hl and in tiles at StringBuffer1. +; Return price de in BCD at hl and in tiles at wStringBuffer1. push hl ld a, d - ld [StringBuffer2], a + ld [wStringBuffer2], a ld a, e - ld [StringBuffer2 + 1], a - ld hl, StringBuffer1 - ld de, StringBuffer2 + ld [wStringBuffer2 + 1], a + ld hl, wStringBuffer1 + ld de, wStringBuffer2 lb bc, PRINTNUM_LEADINGZEROS | 2, 6 ; 6 digits call PrintNum pop hl - ld de, StringBuffer1 + ld de, wStringBuffer1 ld c, 6 / 2 ; 6 digits .loop call .CharToNybble @@ -296,7 +296,7 @@ GetMartPrice: ; 15bf0 ReadMart: ; 15c25 ; Load the mart pointer. Mart data is local (no need for bank). - ld hl, MartPointer + ld hl, wMartPointer ld a, [hli] ld h, [hl] ld l, a @@ -304,9 +304,9 @@ ReadMart: ; 15c25 ; set hl to the first item inc hl ld bc, wMartItem1BCD - ld de, CurMart + 1 + ld de, wCurMart + 1 .loop -; copy the item to CurMart + (ItemIndex) +; copy the item to wCurMart + (ItemIndex) ld a, [hli] ld [de], a inc de @@ -335,7 +335,7 @@ ReadMart: ; 15c25 .done pop hl ld a, [hl] - ld [CurMart], a + ld [wCurMart], a ret ; 15c51 @@ -358,7 +358,7 @@ BuyMenu: ; 15c62 LoadBuyMenuText: ; 15c7d ; load text from a nested table -; which table is in EngineBuffer1 +; which table is in wEngineBuffer1 ; which entry is in register a push af call GetMartDialogGroup ; gets a pointer from GetMartDialogGroup.MartTextFunctionPointers @@ -390,7 +390,7 @@ MartAskPurchaseQuantity: ; 15c91 ; 15ca3 GetMartDialogGroup: ; 15ca3 - ld a, [EngineBuffer1] + ld a, [wEngineBuffer1] ld e, a ld d, 0 ld hl, .MartTextFunctionPointers @@ -468,12 +468,12 @@ BuyMenuLoop: ; 15cef jr c, .cancel call MartConfirmPurchase jr c, .cancel - ld de, Money + ld de, wMoney ld bc, hMoneyTemp ld a, $3 ; useless load call CompareMoney jr c, .insufficient_funds - ld hl, NumItems + ld hl, wNumItems call ReceiveItem jr nc, .insufficient_bag_space ld a, [wMartItemID] @@ -483,7 +483,7 @@ BuyMenuLoop: ; 15cef ld hl, wBargainShopFlags call FlagAction call PlayTransactionSound - ld de, Money + ld de, wMoney ld bc, hMoneyTemp call TakeMoney ld a, MARTTEXT_HERE_YOU_GO @@ -547,7 +547,7 @@ BargainShopAskPurchaseQuantity: ld a, [wMartItemID] ld e, a ld d, $0 - ld hl, MartPointer + ld hl, wMartPointer ld a, [hli] ld h, [hl] ld l, a @@ -588,7 +588,7 @@ RooftopSaleAskPurchaseQuantity: ld a, [wMartItemID] ld e, a ld d, 0 - ld hl, MartPointer + ld hl, wMartPointer ld a, [hli] ld h, [hl] ld l, a @@ -627,7 +627,7 @@ MenuDataHeader_Buy: ; 0x15e18 db SCROLLINGMENU_DISPLAY_ARROWS | SCROLLINGMENU_ENABLE_FUNCTION3 ; flags db 4, 8 ; rows, columns db 1 ; horizontal spacing - dbw 0, CurMart + dbw 0, wCurMart dba PlaceMenuItemName dba .PrintBCDPrices dba UpdateItemDescription @@ -857,11 +857,11 @@ SellMenu: ; 15eb3 call PrintTextBoxText call YesNoBox jr c, .declined - ld de, Money + ld de, wMoney ld bc, hMoneyTemp call GiveMoney ld a, [wMartItemID] - ld hl, NumItems + ld hl, wNumItems call TossItem predef PartyMonItemName hlcoord 1, 14 diff --git a/engine/menu.asm b/engine/menu.asm index 802bece08..846ad0ad9 100755 --- a/engine/menu.asm +++ b/engine/menu.asm @@ -725,7 +725,7 @@ _ExitMenu:: ; 243e8 ; 24423 Unreferenced_Function24423: ; 24423 - ld a, [VramState] + ld a, [wVramState] bit 0, a ret z xor a ; sScratch diff --git a/engine/menu_2.asm b/engine/menu_2.asm index c8c4ebf5d..44960783f 100644 --- a/engine/menu_2.asm +++ b/engine/menu_2.asm @@ -1,6 +1,6 @@ PlaceMenuItemName: ; 0x24ab4 push de - ld a, [MenuSelection] + ld a, [wMenuSelection] ld [wNamedObjectIndexBuffer], a call GetItemName pop hl @@ -9,8 +9,8 @@ PlaceMenuItemName: ; 0x24ab4 PlaceMenuItemQuantity: ; 0x24ac3 push de - ld a, [MenuSelection] - ld [CurItem], a + ld a, [wMenuSelection] + ld [wCurItem], a farcall _CheckTossableItem ld a, [wItemAttributeParamBuffer] pop hl @@ -20,7 +20,7 @@ PlaceMenuItemQuantity: ; 0x24ac3 add hl, de ld [hl], "×" inc hl - ld de, MenuSelectionQuantity + ld de, wMenuSelectionQuantity lb bc, 1, 2 call PrintNum @@ -47,7 +47,7 @@ PlaceMoneyDataHeader: ; 24b01 call MenuBoxCoord2Tile ld de, SCREEN_WIDTH + 1 add hl, de - ld de, Money + ld de, wMoney lb bc, PRINTNUM_MONEY | 3, 6 call PrintNum ret @@ -76,7 +76,7 @@ Special_DisplayCoinCaseBalance: ; 24b25 hlcoord 17, 1 ld de, ShowMoney_TerminatorString call PlaceString - ld de, Coins + ld de, wCoins lb bc, 2, 4 hlcoord 13, 1 call PrintNum @@ -91,14 +91,14 @@ Special_DisplayMoneyAndCoinBalance: ; 24b4e ld de, MoneyString call PlaceString hlcoord 12, 1 - ld de, Money + ld de, wMoney lb bc, PRINTNUM_MONEY | 3, 6 call PrintNum hlcoord 6, 3 ld de, CoinString call PlaceString hlcoord 15, 3 - ld de, Coins + ld de, wCoins lb bc, 2, 4 call PrintNum ret @@ -112,7 +112,7 @@ ShowMoney_TerminatorString: ; 24b8e Unreferenced_Function24b8f: ; 24b8f ; related to safari? - ld hl, Options + ld hl, wOptions ld a, [hl] push af set NO_TEXT_SCROLL, [hl] @@ -135,7 +135,7 @@ Unreferenced_Function24b8f: ; 24b8f lb bc, 1, 2 call PrintNum pop af - ld [Options], a + ld [wOptions], a ret .slash_500 ; 24bcf @@ -151,7 +151,7 @@ StartMenu_DrawBugContestStatusBox: ; 24bdc ret StartMenu_PrintBugContestStatus: ; 24be7 - ld hl, Options + ld hl, wOptions ld a, [hl] push af set NO_TEXT_SCROLL, [hl] @@ -191,7 +191,7 @@ StartMenu_PrintBugContestStatus: ; 24be7 .skip_level pop af - ld [Options], a + ld [wOptions], a ret .Balls_JP: ; 24c43 @@ -207,7 +207,7 @@ StartMenu_PrintBugContestStatus: ; 24be7 FindApricornsInBag: ; 24c64 ; Checks the bag for Apricorns. - ld hl, Buffer1 + ld hl, wBuffer1 xor a ld [hli], a dec a @@ -220,8 +220,8 @@ FindApricornsInBag: ; 24c64 cp -1 jr z, .done push hl - ld [CurItem], a - ld hl, NumItems + ld [wCurItem], a + ld hl, wNumItems call CheckItem pop hl jr nc, .nope @@ -233,7 +233,7 @@ FindApricornsInBag: ; 24c64 jr .loop .done - ld a, [Buffer1] + ld a, [wBuffer1] and a ret nz scf @@ -241,7 +241,7 @@ FindApricornsInBag: ; 24c64 .addtobuffer ; 24c94 push hl - ld hl, Buffer1 + ld hl, wBuffer1 inc [hl] ld e, [hl] ld d, 0 diff --git a/engine/mon_icons.asm b/engine/mon_icons.asm index db1a68ceb..5a26d2d7c 100755 --- a/engine/mon_icons.asm +++ b/engine/mon_icons.asm @@ -55,7 +55,7 @@ LoadMenuMonIcon: ; 8e83f .GetPartyMonItemGFX: ; 8e86c (23:686c) push bc ld a, [hObjectStructIndexBuffer] - ld hl, PartyMon1Item + ld hl, wPartyMon1Item ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes pop bc @@ -129,7 +129,7 @@ PartyMenu_InitAnimatedMonIcon: ; 8e8d5 (23:68d5) .SpawnItemIcon: ; 8e8df (23:68df) push bc ld a, [hObjectStructIndexBuffer] - ld hl, PartyMon1Item + ld hl, wPartyMon1Item ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes pop bc @@ -158,13 +158,13 @@ InitPartyMenuIcon: ; 8e908 (23:6908) ld a, [wCurIconTile] push af ld a, [hObjectStructIndexBuffer] - ld hl, PartySpecies + ld hl, wPartySpecies ld e, a ld d, $0 add hl, de ld a, [hl] call ReadMonMenuIcon - ld [CurIcon], a + ld [wCurIcon], a call GetMemIconGFX ld a, [hObjectStructIndexBuffer] ; y coord @@ -222,7 +222,7 @@ SetPartyMonIconAnimSpeed: ; 8e936 (23:6936) NamingScreen_InitAnimatedMonIcon: ; 8e961 (23:6961) ld a, [wd265] call ReadMonMenuIcon - ld [CurIcon], a + ld [wCurIcon], a xor a call GetIconGFX depixel 4, 4, 4, 0 @@ -236,7 +236,7 @@ NamingScreen_InitAnimatedMonIcon: ; 8e961 (23:6961) MoveList_InitAnimatedMonIcon: ; 8e97d (23:697d) ld a, [wd265] call ReadMonMenuIcon - ld [CurIcon], a + ld [wCurIcon], a xor a call GetIconGFX ld d, 3 * 8 + 2 ; depixel 3, 4, 2, 4 @@ -251,7 +251,7 @@ MoveList_InitAnimatedMonIcon: ; 8e97d (23:697d) Trade_LoadMonIconGFX: ; 8e99a (23:699a) ld a, [wd265] call ReadMonMenuIcon - ld [CurIcon], a + ld [wCurIcon], a ld a, $62 ld [wCurIconTile], a call GetMemIconGFX @@ -262,7 +262,7 @@ GetSpeciesIcon: ; 8e9ac push de ld a, [wd265] call ReadMonMenuIcon - ld [CurIcon], a + ld [wCurIcon], a pop de ld a, e call GetIconGFX @@ -274,7 +274,7 @@ FlyFunction_GetMonIcon: ; 8e9bc (23:69bc) push de ld a, [wd265] call ReadMonMenuIcon - ld [CurIcon], a + ld [wCurIcon], a pop de ld a, e call GetIcon_a @@ -285,7 +285,7 @@ Unreferenced_GetMonIcon2: ; 8e9cc push de ld a, [wd265] call ReadMonMenuIcon - ld [CurIcon], a + ld [wCurIcon], a pop de call GetIcon_de ret @@ -335,7 +335,7 @@ endr ; The icons are contiguous, in order and of the same ; size, so the pointer table is somewhat redundant. - ld a, [CurIcon] + ld a, [wCurIcon] push hl ld l, a ld h, 0 diff --git a/engine/mon_menu.asm b/engine/mon_menu.asm index d7e8446d0..f398910ac 100755 --- a/engine/mon_menu.asm +++ b/engine/mon_menu.asm @@ -48,7 +48,7 @@ MonSubmenu: ; 24d19 ld a, 1 ld [hBGMapMode], a call MonMenuLoop - ld [MenuSelection], a + ld [wMenuSelection], a call ExitMenu ret @@ -63,7 +63,7 @@ MonSubmenu: ; 24d19 .GetTopCoord: ; 24d47 ; TopCoord = 1 + BottomCoord - 2 * (NumSubmenuItems + 1) - ld a, [Buffer1] + ld a, [wBuffer1] inc a add a ld b, a @@ -79,7 +79,7 @@ MonMenuLoop: ; 24d59 .loop ld a, MENU_UNUSED_3 | MENU_BACKUP_TILES_2 ; flags ld [wMenuData2Flags], a - ld a, [Buffer1] ; items + ld a, [wBuffer1] ; items ld [wMenuData2Items], a call InitVerticalMenuCursor ld hl, w2DMenuFlags1 @@ -103,7 +103,7 @@ MonMenuLoop: ; 24d59 dec a ld c, a ld b, 0 - ld hl, Buffer2 + ld hl, wBuffer2 add hl, bc ld a, [hl] ret @@ -113,7 +113,7 @@ PopulateMonMenu: ; 24d91 call MenuBoxCoord2Tile ld bc, $2a ; 42 add hl, bc - ld de, Buffer2 + ld de, wBuffer2 .loop ld a, [de] inc de @@ -157,7 +157,7 @@ GetMonMenuString: ; 24db0 GetMonSubmenuItems: ; 24dd4 call ResetMonSubmenu - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] cp EGG jr z, .egg ld a, [wLinkMode] @@ -211,7 +211,7 @@ GetMonSubmenuItems: ; 24dd4 call AddMonMenuItem .skip2 - ld a, [Buffer1] + ld a, [wBuffer1] cp NUM_MONMENU_ITEMS jr z, .ok2 ld a, MONMENU_CANCEL @@ -255,18 +255,18 @@ IsFieldMove: ; 24e52 ResetMonSubmenu: ; 24e68 xor a - ld [Buffer1], a - ld hl, Buffer2 + ld [wBuffer1], a + ld hl, wBuffer2 ld bc, NUM_MONMENU_ITEMS + 1 call ByteFill ret ; 24e76 TerminateMonSubmenu: ; 24e76 - ld a, [Buffer1] + ld a, [wBuffer1] ld e, a ld d, $0 - ld hl, Buffer2 + ld hl, wBuffer2 add hl, de ld [hl], -1 ret @@ -276,12 +276,12 @@ AddMonMenuItem: ; 24e83 push hl push de push af - ld a, [Buffer1] + ld a, [wBuffer1] ld e, a inc a - ld [Buffer1], a + ld [wBuffer1], a ld d, $0 - ld hl, Buffer2 + ld hl, wBuffer2 add hl, de pop af ld [hl], a diff --git a/engine/mon_stats.asm b/engine/mon_stats.asm index 7a493c591..a06ad1a46 100644 --- a/engine/mon_stats.asm +++ b/engine/mon_stats.asm @@ -10,13 +10,13 @@ DrawHP: ; 50b10 push hl push bc ; box mons have full HP - ld a, [MonType] + ld a, [wMonType] cp BOXMON jr z, .at_least_1_hp - ld a, [TempMonHP] + ld a, [wTempMonHP] ld b, a - ld a, [TempMonHP + 1] + ld a, [wTempMonHP + 1] ld c, a ; Any HP? @@ -31,11 +31,11 @@ DrawHP: ; 50b10 jp .fainted .at_least_1_hp - ld a, [TempMonMaxHP] + ld a, [wTempMonMaxHP] ld d, a - ld a, [TempMonMaxHP + 1] + ld a, [wTempMonMaxHP + 1] ld e, a - ld a, [MonType] + ld a, [wMonType] cp BOXMON jr nz, .not_boxmon @@ -62,11 +62,11 @@ DrawHP: ; 50b10 ; Print HP bccoord 1, 1, 0 add hl, bc - ld de, TempMonHP - ld a, [MonType] + ld de, wTempMonHP + ld a, [wMonType] cp BOXMON jr nz, .not_boxmon_2 - ld de, TempMonMaxHP + ld de, wTempMonMaxHP .not_boxmon_2 lb bc, 2, 3 call PrintNum @@ -75,7 +75,7 @@ DrawHP: ; 50b10 ld [hli], a ; Print max HP - ld de, TempMonMaxHP + ld de, wTempMonMaxHP lb bc, 2, 3 call PrintNum pop hl @@ -83,7 +83,7 @@ DrawHP: ; 50b10 ret PrintTempMonStats: ; 50b7b -; Print TempMon's stats at hl, with spacing bc. +; Print wTempMon's stats at hl, with spacing bc. push bc push hl ld de, .StatNames @@ -93,16 +93,16 @@ PrintTempMonStats: ; 50b7b add hl, bc ld bc, SCREEN_WIDTH add hl, bc - ld de, TempMonAttack + ld de, wTempMonAttack lb bc, 2, 3 call .PrintStat - ld de, TempMonDefense + ld de, wTempMonDefense call .PrintStat - ld de, TempMonSpclAtk + ld de, wTempMonSpclAtk call .PrintStat - ld de, TempMonSpclDef + ld de, wTempMonSpclDef call .PrintStat - ld de, TempMonSpeed + ld de, wTempMonSpeed jp PrintNum .PrintStat: ; 50bab @@ -122,8 +122,8 @@ PrintTempMonStats: ; 50b7b next "@" GetGender: ; 50bdd -; Return the gender of a given monster (CurPartyMon/CurOTMon/CurWildMon). -; When calling this function, a should be set to an appropriate MonType value. +; Return the gender of a given monster (wCurPartyMon/wCurOTMon/CurWildMon). +; When calling this function, a should be set to an appropriate wMonType value. ; return values: ; a = 1: f = nc|nz; male @@ -136,14 +136,14 @@ GetGender: ; 50bdd ; Figure out what type of monster struct we're looking at. ; 0: PartyMon - ld hl, PartyMon1DVs + ld hl, wPartyMon1DVs ld bc, PARTYMON_STRUCT_LENGTH - ld a, [MonType] + ld a, [wMonType] and a jr z, .PartyMon ; 1: OTPartyMon - ld hl, OTPartyMon1DVs + ld hl, wOTPartyMon1DVs dec a jr z, .PartyMon @@ -154,25 +154,25 @@ GetGender: ; 50bdd jr z, .sBoxMon ; 3: Unknown - ld hl, TempMonDVs + ld hl, wTempMonDVs dec a jr z, .DVs ; else: WildMon - ld hl, EnemyMonDVs + ld hl, wEnemyMonDVs jr .DVs ; Get our place in the party/box. .PartyMon: .sBoxMon - ld a, [CurPartyMon] + ld a, [wCurPartyMon] call AddNTimes .DVs: ; sBoxMon data is read directly from SRAM. - ld a, [MonType] + ld a, [wMonType] cp BOXMON ld a, BANK(sBox) call z, GetSRAMBank @@ -191,13 +191,13 @@ GetGender: ; 50bdd ld b, a ; Close SRAM if we were dealing with a sBoxMon. - ld a, [MonType] + ld a, [wMonType] cp BOXMON call z, CloseSRAM ; We need the gender ratio to do anything with this. push bc - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] dec a ld hl, BaseData + BASE_GENDER ld bc, BASE_DATA_SIZE @@ -243,7 +243,7 @@ ListMovePP: ; 50c50 sub c ld b, a push hl - ld a, [Buffer1] + ld a, [wBuffer1] ld e, a ld d, $0 ld a, $3e ; P @@ -262,7 +262,7 @@ ListMovePP: ; 50c50 inc hl ld d, h ld e, l - ld hl, TempMonMoves + ld hl, wTempMonMoves ld b, 0 .loop ld a, [hli] @@ -283,15 +283,15 @@ ListMovePP: ; 50c50 pop de pop hl push hl - ld bc, TempMonPP - (TempMonMoves + 1) + ld bc, wTempMonPP - (wTempMonMoves + 1) add hl, bc ld a, [hl] and $3f - ld [StringBuffer1 + 4], a + ld [wStringBuffer1 + 4], a ld h, d ld l, e push hl - ld de, StringBuffer1 + 4 + ld de, wStringBuffer1 + 4 lb bc, 1, 2 call PrintNum ld a, "/" @@ -300,7 +300,7 @@ ListMovePP: ; 50c50 lb bc, 1, 2 call PrintNum pop hl - ld a, [Buffer1] + ld a, [wBuffer1] ld e, a ld d, 0 add hl, de @@ -338,14 +338,14 @@ Unreferenced_Function50cd0: ; 50cd0 Unused_PlaceEnemyHPLevel: push hl push hl - ld hl, PartyMonNicknames - ld a, [CurPartyMon] + ld hl, wPartyMonNicknames + ld a, [wCurPartyMon] call GetNick pop hl call PlaceString call CopyPkmnToTempMon pop hl - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] cp EGG jr z, .egg push hl @@ -431,7 +431,7 @@ FrzString: db "FRZ@" ParString: db "PAR@" ListMoves: ; 50d6f -; List moves at hl, spaced every [Buffer1] tiles. +; List moves at hl, spaced every [wBuffer1] tiles. ld de, wListMoves_MoveIndicesBuffer ld b, $0 .moves_loop @@ -442,11 +442,11 @@ ListMoves: ; 50d6f push de push hl push hl - ld [CurSpecies], a + ld [wCurSpecies], a ld a, MOVE_NAME ld [wNamedObjectTypeBuffer], a call GetName - ld de, StringBuffer1 + ld de, wStringBuffer1 pop hl push bc call PlaceString @@ -456,7 +456,7 @@ ListMoves: ; 50d6f inc b pop hl push bc - ld a, [Buffer1] + ld a, [wBuffer1] ld c, a ld b, 0 add hl, bc @@ -472,7 +472,7 @@ ListMoves: ; 50d6f .nonmove_loop push af ld [hl], "-" - ld a, [Buffer1] + ld a, [wBuffer1] ld c, a ld b, 0 add hl, bc diff --git a/engine/money.asm b/engine/money.asm index 60de97568..585c85618 100755 --- a/engine/money.asm +++ b/engine/money.asm @@ -171,7 +171,7 @@ AddFunds: ; 16055 GiveCoins:: ; 1606f ld a, 2 - ld de, Coins + ld de, wCoins call AddFunds ld a, 2 ld bc, .maxcoins @@ -198,7 +198,7 @@ GiveCoins:: ; 1606f TakeCoins:: ; 1608f ld a, 2 - ld de, Coins + ld de, wCoins call SubtractFunds jr nc, .okay ; leave with 0 coins @@ -216,6 +216,6 @@ TakeCoins:: ; 1608f CheckCoins:: ; 160a1 ld a, 2 - ld de, Coins + ld de, wCoins jp CompareFunds ; 160a9 diff --git a/engine/move_mon.asm b/engine/move_mon.asm index 52894359e..0c0694851 100755 --- a/engine/move_mon.asm +++ b/engine/move_mon.asm @@ -1,11 +1,11 @@ TryAddMonToParty: ; d88c ; Check if to copy wild Pkmn or generate new Pkmn ; Whose is it? - ld de, PartyCount - ld a, [MonType] + ld de, wPartyCount + ld a, [wMonType] and $f jr z, .getpartylocation ; PARTYMON - ld de, OTPartyCount + ld de, wOTPartyCount .getpartylocation ; Do we have room for it? @@ -25,18 +25,18 @@ TryAddMonToParty: ; d88c .loadspecies ; Load the species of the Pokemon into the party list. ; The terminator is usually here, but it'll be back. - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] ld [de], a ; Load the terminator into the next slot. inc de ld a, -1 ld [de], a ; Now let's load the OT name. - ld hl, PartyMonOT - ld a, [MonType] + ld hl, wPartyMonOT + ld a, [wMonType] and $f jr z, .loadOTname - ld hl, OTPartyMonOT + ld hl, wOTPartyMonOT .loadOTname ld a, [hMoveMon] ; Restore index from backup @@ -44,31 +44,31 @@ TryAddMonToParty: ; d88c call SkipNames ld d, h ld e, l - ld hl, PlayerName + ld hl, wPlayerName ld bc, NAME_LENGTH call CopyBytes - ld a, [MonType] + ld a, [wMonType] and a jr nz, .skipnickname - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] ld [wd265], a call GetPokemonName - ld hl, PartyMonNicknames + ld hl, wPartyMonNicknames ld a, [hMoveMon] dec a call SkipNames ld d, h ld e, l - ld hl, StringBuffer1 + ld hl, wStringBuffer1 ld bc, MON_NAME_LENGTH call CopyBytes .skipnickname - ld hl, PartyMon1Species - ld a, [MonType] + ld hl, wPartyMon1Species + ld a, [wMonType] and $f jr z, .initializeStats - ld hl, OTPartyMon1Species + ld hl, wOTPartyMon1Species .initializeStats ld a, [hMoveMon] @@ -79,17 +79,17 @@ GeneratePartyMonStats: ; d906 ld e, l ld d, h push hl - ld a, [CurPartySpecies] - ld [CurSpecies], a + ld a, [wCurPartySpecies] + ld [wCurSpecies], a call GetBaseData - ld a, [BaseDexNo] + ld a, [wBaseDexNo] ld [de], a inc de ld a, [wBattleMode] and a ld a, $0 jr z, .skipitem - ld a, [EnemyMonItem] + ld a, [wEnemyMonItem] .skipitem ld [de], a @@ -100,10 +100,10 @@ GeneratePartyMonStats: ; d906 ld a, [wBattleMode] and a jr z, .randomlygeneratemoves - ld a, [MonType] + ld a, [wMonType] and a jr nz, .randomlygeneratemoves - ld de, EnemyMonMoves + ld de, wEnemyMonMoves rept NUM_MOVES + -1 ld a, [de] inc de @@ -119,7 +119,7 @@ GeneratePartyMonStats: ; d906 ld [hli], a endr ld [hl], a - ld [Buffer1], a + ld [wBuffer1], a predef FillMoves .next @@ -127,14 +127,14 @@ GeneratePartyMonStats: ; d906 rept 4 inc de endr - ld a, [PlayerID] + ld a, [wPlayerID] ld [de], a inc de - ld a, [PlayerID + 1] + ld a, [wPlayerID + 1] ld [de], a inc de push de - ld a, [CurPartyLevel] + ld a, [wCurPartyLevel] ld d, a callfar CalcExpAtLevel pop de @@ -156,7 +156,7 @@ endr jr nz, .loop pop hl push hl - ld a, [MonType] + ld a, [wMonType] and $f jr z, .generateDVs push hl @@ -165,7 +165,7 @@ endr jr .initializetrainermonstats .generateDVs - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] ld [wd265], a dec a push de @@ -211,7 +211,7 @@ endr inc de ld [de], a inc de - ld a, [CurPartyLevel] + ld a, [wCurPartyLevel] ld [de], a inc de xor a @@ -234,15 +234,15 @@ endr jr .next2 .copywildmonstats - ld a, [EnemyMonDVs] + ld a, [wEnemyMonDVs] ld [de], a inc de - ld a, [EnemyMonDVs + 1] + ld a, [wEnemyMonDVs + 1] ld [de], a inc de push hl - ld hl, EnemyMonPP + ld hl, wEnemyMonPP ld b, NUM_MOVES .wildmonpploop ld a, [hli] @@ -262,11 +262,11 @@ endr inc de ld [de], a inc de - ld a, [CurPartyLevel] + ld a, [wCurPartyLevel] ld [de], a inc de - ld hl, EnemyMonStatus - ; Copy EnemyMonStatus + ld hl, wEnemyMonStatus + ; Copy wEnemyMonStatus ld a, [hli] ld [de], a inc de @@ -274,7 +274,7 @@ endr ld a, [hli] ld [de], a inc de - ; Copy EnemyMonHP + ; Copy wEnemyMonHP ld a, [hli] ld [de], a inc de @@ -286,7 +286,7 @@ endr ld a, [wBattleMode] dec a jr nz, .generatestats - ld hl, EnemyMonMaxHP + ld hl, wEnemyMonMaxHP ld bc, 2 * 6 ; MaxHP + 5 Stats call CopyBytes pop hl @@ -300,14 +300,14 @@ endr call CalcPkmnStats .next3 - ld a, [MonType] + ld a, [wMonType] and $f jr nz, .done - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] cp UNOWN jr nz, .done - ld hl, PartyMon1DVs - ld a, [PartyCount] + ld hl, wPartyMon1DVs + ld a, [wPartyCount] dec a ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes @@ -333,13 +333,13 @@ FillPP: ; da6d ld hl, Moves ld bc, MOVE_LENGTH call AddNTimes - ld de, StringBuffer1 + ld de, wStringBuffer1 ld a, BANK(Moves) call FarCopyBytes pop bc pop de pop hl - ld a, [StringBuffer1 + MOVE_PP] + ld a, [wStringBuffer1 + MOVE_PP] .next ld [de], a @@ -351,7 +351,7 @@ FillPP: ; da6d ; da96 AddTempmonToParty: ; da96 - ld hl, PartyCount + ld hl, wPartyCount ld a, [hl] cp PARTY_LENGTH scf @@ -362,63 +362,63 @@ AddTempmonToParty: ; da96 ld c, a ld b, 0 add hl, bc - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] ld [hli], a ld [hl], $ff - ld hl, PartyMon1Species - ld a, [PartyCount] + ld hl, wPartyMon1Species + ld a, [wPartyCount] dec a ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes ld e, l ld d, h - ld hl, TempMonSpecies + ld hl, wTempMonSpecies call CopyBytes - ld hl, PartyMonOT - ld a, [PartyCount] + ld hl, wPartyMonOT + ld a, [wPartyCount] dec a call SkipNames ld d, h ld e, l - ld hl, OTPartyMonOT - ld a, [CurPartyMon] + ld hl, wOTPartyMonOT + ld a, [wCurPartyMon] call SkipNames ld bc, NAME_LENGTH call CopyBytes - ld hl, PartyMonNicknames - ld a, [PartyCount] + ld hl, wPartyMonNicknames + ld a, [wPartyCount] dec a call SkipNames ld d, h ld e, l - ld hl, OTPartyMonNicknames - ld a, [CurPartyMon] + ld hl, wOTPartyMonNicknames + ld a, [wCurPartyMon] call SkipNames ld bc, MON_NAME_LENGTH call CopyBytes - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] ld [wNamedObjectIndexBuffer], a cp EGG jr z, .egg dec a call SetSeenAndCaughtMon - ld hl, PartyMon1Happiness - ld a, [PartyCount] + ld hl, wPartyMon1Happiness + ld a, [wPartyCount] dec a ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes ld [hl], BASE_HAPPINESS .egg - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] cp UNOWN jr nz, .done - ld hl, PartyMon1DVs - ld a, [PartyCount] + ld hl, wPartyMon1DVs + ld a, [wPartyCount] dec a ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes @@ -427,7 +427,7 @@ AddTempmonToParty: ; da96 ld a, [wFirstUnownSeen] and a jr nz, .done - ld a, [UnownLetter] + ld a, [wUnownLetter] ld [wFirstUnownSeen], a .done @@ -461,7 +461,7 @@ SendGetPkmnIntoFromBox: ; db3f jp CloseSRAM_And_SetCarryFlag .check_IfPartyIsFull - ld hl, PartyCount + ld hl, wPartyCount ld a, [hl] cp PARTY_LENGTH jp z, CloseSRAM_And_SetCarryFlag @@ -476,23 +476,23 @@ SendGetPkmnIntoFromBox: ; db3f cp DAY_CARE_WITHDRAW ld a, [wBreedMon1Species] jr z, .okay1 - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] .okay1 ld [hli], a ld [hl], $ff ld a, [wPokemonWithdrawDepositParameter] dec a - ld hl, PartyMon1Species + ld hl, wPartyMon1Species ld bc, PARTYMON_STRUCT_LENGTH - ld a, [PartyCount] + ld a, [wPartyCount] jr nz, .okay2 ld hl, sBoxMon1Species ld bc, BOXMON_STRUCT_LENGTH ld a, [sBoxCount] .okay2 - dec a ; PartyCount - 1 + dec a ; wPartyCount - 1 call AddNTimes .breedmon @@ -507,11 +507,11 @@ SendGetPkmnIntoFromBox: ; db3f cp DAY_CARE_WITHDRAW ld hl, wBreedMon1Species jr z, .okay4 - ld hl, PartyMon1Species + ld hl, wPartyMon1Species ld bc, PARTYMON_STRUCT_LENGTH .okay3 - ld a, [CurPartyMon] + ld a, [wCurPartyMon] call AddNTimes .okay4 @@ -522,8 +522,8 @@ SendGetPkmnIntoFromBox: ; db3f ld de, wBreedMon1OT jr z, .okay5 dec a - ld hl, PartyMonOT - ld a, [PartyCount] + ld hl, wPartyMonOT + ld a, [wPartyCount] jr nz, .okay6 ld hl, sBoxMonOT ld a, [sBoxCount] @@ -542,10 +542,10 @@ SendGetPkmnIntoFromBox: ; db3f ld hl, wBreedMon1OT cp DAY_CARE_WITHDRAW jr z, .okay8 - ld hl, PartyMonOT + ld hl, wPartyMonOT .okay7 - ld a, [CurPartyMon] + ld a, [wCurPartyMon] call SkipNames .okay8 @@ -556,8 +556,8 @@ SendGetPkmnIntoFromBox: ; db3f ld de, wBreedMon1Nick jr z, .okay9 dec a - ld hl, PartyMonNicknames - ld a, [PartyCount] + ld hl, wPartyMonNicknames + ld a, [wPartyCount] jr nz, .okay10 ld hl, sBoxMonNicknames ld a, [sBoxCount] @@ -576,10 +576,10 @@ SendGetPkmnIntoFromBox: ; db3f ld hl, wBreedMon1Nick cp DAY_CARE_WITHDRAW jr z, .okay12 - ld hl, PartyMonNicknames + ld hl, wPartyMonNicknames .okay11 - ld a, [CurPartyMon] + ld a, [wCurPartyMon] call SkipNames .okay12 @@ -596,11 +596,11 @@ SendGetPkmnIntoFromBox: ; db3f push hl srl a add $2 - ld [MonType], a + ld [wMonType], a predef CopyPkmnToTempMon callfar CalcLevel ld a, d - ld [CurPartyLevel], a + ld [wCurPartyLevel], a pop hl ld b, h @@ -631,7 +631,7 @@ SendGetPkmnIntoFromBox: ; db3f add hl, bc ld d, h ld e, l - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] cp EGG jr z, .egg inc hl @@ -678,14 +678,14 @@ RestorePPofDepositedPokemon: ; dcb6 add hl, bc push hl push bc - ld de, TempMonPP + ld de, wTempMonPP ld bc, NUM_MOVES call CopyBytes pop bc ld hl, MON_MOVES add hl, bc push hl - ld de, TempMonMoves + ld de, wTempMonMoves ld bc, NUM_MOVES call CopyBytes pop hl @@ -693,16 +693,16 @@ RestorePPofDepositedPokemon: ; dcb6 ld a, [wMenuCursorY] push af - ld a, [MonType] + ld a, [wMonType] push af ld b, 0 .loop ld a, [hli] and a jr z, .done - ld [TempMonMoves], a + ld [wTempMonMoves], a ld a, BOXMON - ld [MonType], a + ld [wMonType], a ld a, b ld [wMenuCursorY], a push bc @@ -726,7 +726,7 @@ RestorePPofDepositedPokemon: ; dcb6 .done pop af - ld [MonType], a + ld [wMonType], a pop af ld [wMenuCursorY], a ret @@ -734,7 +734,7 @@ RestorePPofDepositedPokemon: ; dcb6 RetrievePokemonFromDayCareMan: ; dd21 ld a, [wBreedMon1Species] - ld [CurPartySpecies], a + ld [wCurPartySpecies], a ld de, SFX_TRANSACTION call PlaySFX call WaitSFX @@ -742,7 +742,7 @@ RetrievePokemonFromDayCareMan: ; dd21 ld a, b ld [wd002], a ld a, e - ld [CurPartyLevel], a + ld [wCurPartyLevel], a xor a ld [wPokemonWithdrawDepositParameter], a jp Functiondd64 @@ -750,7 +750,7 @@ RetrievePokemonFromDayCareMan: ; dd21 RetrievePokemonFromDayCareLady: ; dd42 ld a, [wBreedMon2Species] - ld [CurPartySpecies], a + ld [wCurPartySpecies], a ld de, SFX_TRANSACTION call PlaySFX call WaitSFX @@ -758,14 +758,14 @@ RetrievePokemonFromDayCareLady: ; dd42 ld a, b ld [wd002], a ld a, e - ld [CurPartyLevel], a + ld [wCurPartyLevel], a ld a, PC_DEPOSIT ld [wPokemonWithdrawDepositParameter], a jp Functiondd64 ; dd64 Functiondd64: ; dd64 - ld hl, PartyCount + ld hl, wPartyCount ld a, [hl] cp PARTY_LENGTH jr nz, .room_in_party @@ -788,11 +788,11 @@ Functiondd64: ; dd64 .okay ld [hli], a - ld [CurSpecies], a + ld [wCurSpecies], a ld a, $ff ld [hl], a - ld hl, PartyMonNicknames - ld a, [PartyCount] + ld hl, wPartyMonNicknames + ld a, [wPartyCount] dec a call SkipNames push hl @@ -801,8 +801,8 @@ Functiondd64: ; dd64 pop de call CopyBytes push hl - ld hl, PartyMonOT - ld a, [PartyCount] + ld hl, wPartyMonOT + ld a, [wPartyCount] dec a call SkipNames ld d, h @@ -820,7 +820,7 @@ Functiondd64: ; dd64 ld c, e ld hl, MON_LEVEL add hl, bc - ld a, [CurPartyLevel] + ld a, [wCurPartyLevel] ld [hl], a ld hl, MON_MAXHP add hl, bc @@ -831,21 +831,21 @@ Functiondd64: ; dd64 push bc ld b, $1 call CalcPkmnStats - ld hl, PartyMon1Moves - ld a, [PartyCount] + ld hl, wPartyMon1Moves + ld a, [wPartyCount] dec a ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes ld d, h ld e, l ld a, $1 - ld [Buffer1], a + ld [wBuffer1], a predef FillMoves - ld a, [PartyCount] + ld a, [wPartyCount] dec a - ld [CurPartyMon], a + ld [wCurPartyMon], a farcall HealPartyMon - ld a, [CurPartyLevel] + ld a, [wCurPartyLevel] ld d, a callfar CalcExpAtLevel pop bc @@ -862,9 +862,9 @@ Functiondd64: ; dd64 ; de1a Functionde1a: ; de1a - ld a, [PartyCount] + ld a, [wPartyCount] dec a - ld hl, PartyMon1Species + ld hl, wPartyMon1Species ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes ld d, h @@ -889,16 +889,16 @@ DepositMonWithDayCareLady: ; de37 ; de44 DepositBreedmon: ; de44 - ld a, [CurPartyMon] - ld hl, PartyMonNicknames + ld a, [wCurPartyMon] + ld hl, wPartyMonNicknames call SkipNames call CopyBytes - ld a, [CurPartyMon] - ld hl, PartyMonOT + ld a, [wCurPartyMon] + ld hl, wPartyMonOT call SkipNames call CopyBytes - ld a, [CurPartyMon] - ld hl, PartyMon1Species + ld a, [wCurPartyMon] + ld hl, wPartyMon1Species ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes ld bc, BOXMON_STRUCT_LENGTH @@ -906,7 +906,7 @@ DepositBreedmon: ; de44 SendPkmnIntoBox: ; de6e ; Sends the Pkmn into one of Bills Boxes -; the data comes mainly from 'EnemyMon:' +; the data comes mainly from 'wEnemyMon:' ld a, BANK(sBoxCount) call GetSRAMBank ld de, sBoxCount @@ -916,8 +916,8 @@ SendPkmnIntoBox: ; de6e inc a ld [de], a - ld a, [CurPartySpecies] - ld [CurSpecies], a + ld a, [wCurPartySpecies] + ld [wCurSpecies], a ld c, a .loop inc de @@ -932,26 +932,26 @@ SendPkmnIntoBox: ; de6e call GetBaseData call ShiftBoxMon - ld hl, PlayerName + ld hl, wPlayerName ld de, sBoxMonOT ld bc, NAME_LENGTH call CopyBytes - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] ld [wd265], a call GetPokemonName ld de, sBoxMonNicknames - ld hl, StringBuffer1 + ld hl, wStringBuffer1 ld bc, MON_NAME_LENGTH call CopyBytes - ld hl, EnemyMon + ld hl, wEnemyMon ld de, sBoxMon1 ld bc, 1 + 1 + NUM_MOVES ; species + item + moves call CopyBytes - ld hl, PlayerID + ld hl, wPlayerID ld a, [hli] ld [de], a inc de @@ -959,7 +959,7 @@ SendPkmnIntoBox: ; de6e ld [de], a inc de push de - ld a, [CurPartyLevel] + ld a, [wCurPartyLevel] ld d, a callfar CalcExpAtLevel pop de @@ -982,8 +982,8 @@ SendPkmnIntoBox: ; de6e dec b jr nz, .loop2 - ld hl, EnemyMonDVs - ld b, 2 + NUM_MOVES ; DVs and PP ; EnemyMonHappiness - EnemyMonDVs + ld hl, wEnemyMonDVs + ld b, 2 + NUM_MOVES ; DVs and PP ; wEnemyMonHappiness - wEnemyMonDVs .loop3 ld a, [hli] ld [de], a @@ -1001,12 +1001,12 @@ SendPkmnIntoBox: ; de6e inc de ld [de], a inc de - ld a, [CurPartyLevel] + ld a, [wCurPartyLevel] ld [de], a - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] dec a call SetSeenAndCaughtMon - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] cp UNOWN jr nz, .not_unown ld hl, sBoxMon1DVs @@ -1015,12 +1015,12 @@ SendPkmnIntoBox: ; de6e .not_unown ld hl, sBoxMon1Moves - ld de, TempMonMoves + ld de, wTempMonMoves ld bc, NUM_MOVES call CopyBytes ld hl, sBoxMon1PP - ld de, TempMonPP + ld de, wTempMonPP ld bc, NUM_MOVES call CopyBytes @@ -1087,11 +1087,11 @@ ShiftBoxMon: ; df47 ; df8c GiveEgg:: ; df8c - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] push af callfar GetPreEvolution callfar GetPreEvolution - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] dec a ; TryAddMonToParty sets Seen and Caught flags @@ -1113,11 +1113,11 @@ GiveEgg:: ; df8c ld a, c and a jr nz, .skip_caught_flag - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] dec a ld c, a ld d, $0 - ld hl, PokedexCaught + ld hl, wPokedexCaught ld b, RESET_FLAG predef SmallFarFlagAction @@ -1129,53 +1129,53 @@ GiveEgg:: ; df8c ld a, c and a jr nz, .skip_seen_flag - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] dec a ld c, a ld d, $0 - ld hl, PokedexSeen + ld hl, wPokedexSeen ld b, RESET_FLAG predef SmallFarFlagAction .skip_seen_flag pop af - ld [CurPartySpecies], a - ld a, [PartyCount] + ld [wCurPartySpecies], a + ld a, [wPartyCount] dec a ld bc, PARTYMON_STRUCT_LENGTH - ld hl, PartyMon1Species + ld hl, wPartyMon1Species call AddNTimes - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] ld [hl], a - ld hl, PartyCount + ld hl, wPartyCount ld a, [hl] ld b, 0 ld c, a add hl, bc ld a, EGG ld [hl], a - ld a, [PartyCount] + ld a, [wPartyCount] dec a - ld hl, PartyMonNicknames + ld hl, wPartyMonNicknames call SkipNames ld de, String_Egg call CopyName2 - ld a, [PartyCount] + ld a, [wPartyCount] dec a - ld hl, PartyMon1Happiness + ld hl, wPartyMon1Happiness ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes ld a, [wMonStatusFlags] bit 1, a ld a, 1 jr nz, .got_init_happiness - ld a, [BaseEggSteps] + ld a, [wBaseEggSteps] .got_init_happiness ld [hl], a - ld a, [PartyCount] + ld a, [wPartyCount] dec a - ld hl, PartyMon1HP + ld hl, wPartyMon1HP ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes xor a @@ -1190,7 +1190,7 @@ String_Egg: ; e035 ; e039 RemoveMonFromPartyOrBox: ; e039 - ld hl, PartyCount + ld hl, wPartyCount ld a, [wPokemonWithdrawDepositParameter] and a @@ -1204,7 +1204,7 @@ RemoveMonFromPartyOrBox: ; e039 ld a, [hl] dec a ld [hli], a - ld a, [CurPartyMon] + ld a, [wCurPartyMon] ld c, a ld b, 0 add hl, bc @@ -1217,7 +1217,7 @@ RemoveMonFromPartyOrBox: ; e039 ld [hli], a inc a jr nz, .loop - ld hl, PartyMonOT + ld hl, wPartyMonOT ld d, PARTY_LENGTH - 1 ld a, [wPokemonWithdrawDepositParameter] and a @@ -1228,9 +1228,9 @@ RemoveMonFromPartyOrBox: ; e039 .party ; If this is the last mon in our party (box), ; shift all the other mons up to close the gap. - ld a, [CurPartyMon] + ld a, [wCurPartyMon] call SkipNames - ld a, [CurPartyMon] + ld a, [wCurPartyMon] cp d jr nz, .delete_inside ld [hl], -1 @@ -1242,7 +1242,7 @@ RemoveMonFromPartyOrBox: ; e039 ld e, l ld bc, MON_NAME_LENGTH add hl, bc - ld bc, PartyMonNicknames + ld bc, wPartyMonNicknames ld a, [wPokemonWithdrawDepositParameter] and a jr z, .party2 @@ -1250,7 +1250,7 @@ RemoveMonFromPartyOrBox: ; e039 .party2 call CopyDataUntil ; Shift the struct - ld hl, PartyMons + ld hl, wPartyMons ld bc, PARTYMON_STRUCT_LENGTH ld a, [wPokemonWithdrawDepositParameter] and a @@ -1258,7 +1258,7 @@ RemoveMonFromPartyOrBox: ; e039 ld hl, sBoxMons ld bc, BOXMON_STRUCT_LENGTH .party4 - ld a, [CurPartyMon] + ld a, [wCurPartyMon] call AddNTimes ld d, h ld e, l @@ -1273,24 +1273,24 @@ RemoveMonFromPartyOrBox: ; e039 .party5 ld bc, PARTYMON_STRUCT_LENGTH add hl, bc - ld bc, PartyMonOT + ld bc, wPartyMonOT .copy call CopyDataUntil ; Shift the nicknames - ld hl, PartyMonNicknames + ld hl, wPartyMonNicknames ld a, [wPokemonWithdrawDepositParameter] and a jr z, .party6 ld hl, sBoxMonNicknames .party6 ld bc, MON_NAME_LENGTH - ld a, [CurPartyMon] + ld a, [wCurPartyMon] call AddNTimes ld d, h ld e, l ld bc, MON_NAME_LENGTH add hl, bc - ld bc, PartyMonNicknamesEnd + ld bc, wPartyMonNicknamesEnd ld a, [wPokemonWithdrawDepositParameter] and a jr z, .party7 @@ -1309,8 +1309,8 @@ RemoveMonFromPartyOrBox: ; e039 ld a, BANK(sPartyMail) call GetSRAMBank ; If this is the last mon in our party, no need to shift mail. - ld hl, PartyCount - ld a, [CurPartyMon] + ld hl, wPartyCount + ld a, [wCurPartyMon] cp [hl] jr z, .close_sram ; Shift our mail messages up. @@ -1320,7 +1320,7 @@ RemoveMonFromPartyOrBox: ; e039 push hl add hl, bc pop de - ld a, [CurPartyMon] + ld a, [wCurPartyMon] ld b, a .loop2 push bc @@ -1334,7 +1334,7 @@ RemoveMonFromPartyOrBox: ; e039 pop de pop bc inc b - ld a, [PartyCount] + ld a, [wPartyCount] cp b jr nz, .loop2 .close_sram @@ -1350,7 +1350,7 @@ ComputeNPCTrademonStats: ; e134 ld a, MON_SPECIES call GetPartyParamLocation ld a, [hl] - ld [CurSpecies], a + ld [wCurSpecies], a call GetBaseData ld a, MON_MAXHP call GetPartyParamLocation @@ -1375,7 +1375,7 @@ ComputeNPCTrademonStats: ; e134 CalcPkmnStats: ; e167 ; Calculates all 6 Stats of a Pkmn ; b: Take into account stat EXP if TRUE -; 'c' counts from 1-6 and points with 'BaseStats' to the base value +; 'c' counts from 1-6 and points with 'wBaseStats' to the base value ; hl is the path to the Stat EXP ; results in $ffb5 and $ffb6 are saved in [de] @@ -1409,7 +1409,7 @@ CalcPkmnStatC: ; e17b ld a, b ld d, a push hl - ld hl, BaseStats + ld hl, wBaseStats dec hl ; has to be decreased, because 'c' begins with 1 ld b, $0 add hl, bc @@ -1527,7 +1527,7 @@ CalcPkmnStatC: ; e17b ld [hMultiplicand + 1], a xor a ld [hMultiplicand + 0], a - ld a, [CurPartyLevel] + ld a, [wCurPartyLevel] ld [hMultiplier], a call Multiply ld a, [hProduct + 1] @@ -1545,7 +1545,7 @@ CalcPkmnStatC: ; e17b cp STAT_HP ld a, STAT_MIN_NORMAL jr nz, .not_hp - ld a, [CurPartyLevel] + ld a, [wCurPartyLevel] ld b, a ld a, [hQuotient + 2] add b @@ -1595,13 +1595,13 @@ GivePoke:: ; e277 push de push bc xor a ; PARTYMON - ld [MonType], a + ld [wMonType], a call TryAddMonToParty jr nc, .failed - ld hl, PartyMonNicknames - ld a, [PartyCount] + ld hl, wPartyMonNicknames + ld a, [wPartyCount] dec a - ld [CurPartyMon], a + ld [wCurPartyMon], a call SkipNames ld d, h ld e, l @@ -1611,27 +1611,27 @@ GivePoke:: ; e277 push bc push de push af - ld a, [CurItem] + ld a, [wCurItem] and a jr z, .done - ld a, [CurPartyMon] - ld hl, PartyMon1Item + ld a, [wCurPartyMon] + ld hl, wPartyMon1Item ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes - ld a, [CurItem] + ld a, [wCurItem] ld [hl], a jr .done .failed - ld a, [CurPartySpecies] - ld [TempEnemyMonSpecies], a + ld a, [wCurPartySpecies] + ld [wTempEnemyMonSpecies], a callfar LoadEnemyMon call SendPkmnIntoBox jp nc, .FailedToGiveMon ld a, BOXMON - ld [MonType], a + ld [wMonType], a xor a - ld [CurPartyMon], a + ld [wCurPartyMon], a ld de, wMonOrItemNameBuffer pop bc ld a, b @@ -1639,18 +1639,18 @@ GivePoke:: ; e277 push bc push de push af - ld a, [CurItem] + ld a, [wCurItem] and a jr z, .done - ld a, [CurItem] + ld a, [wCurItem] ld [sBoxMon1Item], a .done - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] ld [wd265], a - ld [TempEnemyMonSpecies], a + ld [wTempEnemyMonSpecies], a call GetPokemonName - ld hl, StringBuffer1 + ld hl, wStringBuffer1 ld de, wMonOrItemNameBuffer ld bc, MON_NAME_LENGTH call CopyBytes @@ -1662,15 +1662,15 @@ GivePoke:: ; e277 pop hl push bc push hl - ld a, [ScriptBank] + ld a, [wScriptBank] call GetFarHalfword ld bc, MON_NAME_LENGTH - ld a, [ScriptBank] + ld a, [wScriptBank] call FarCopyBytes pop hl inc hl inc hl - ld a, [ScriptBank] + ld a, [wScriptBank] call GetFarHalfword pop bc ld a, b @@ -1680,26 +1680,26 @@ GivePoke:: ; e277 jr nz, .send_to_box push hl - ld a, [CurPartyMon] - ld hl, PartyMonOT + ld a, [wCurPartyMon] + ld hl, wPartyMonOT call SkipNames ld d, h ld e, l pop hl .otnameloop - ld a, [ScriptBank] + ld a, [wScriptBank] call GetFarByte ld [de], a inc hl inc de cp "@" jr nz, .otnameloop - ld a, [ScriptBank] + ld a, [wScriptBank] call GetFarByte ld b, a push bc - ld a, [CurPartyMon] - ld hl, PartyMon1ID + ld a, [wCurPartyMon] + ld hl, wPartyMon1ID ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes ld a, HIGH(01001) @@ -1714,14 +1714,14 @@ GivePoke:: ; e277 call GetSRAMBank ld de, sBoxMonOT .loop - ld a, [ScriptBank] + ld a, [wScriptBank] call GetFarByte ld [de], a inc hl inc de cp "@" jr nz, .loop - ld a, [ScriptBank] + ld a, [wScriptBank] call GetFarByte ld b, a ld hl, sBoxMon1ID @@ -1793,7 +1793,7 @@ InitNickname: ; e3de ld b, $0 farcall NamingScreen pop hl - ld de, StringBuffer1 + ld de, wStringBuffer1 call InitName ld a, $4 ; ExitAllMenus is in bank 0, XXX could this be in bank 4 in pokered? ld hl, ExitAllMenus diff --git a/engine/move_mon_wo_mail.asm b/engine/move_mon_wo_mail.asm index e5e1d6e49..5d81da8a0 100755 --- a/engine/move_mon_wo_mail.asm +++ b/engine/move_mon_wo_mail.asm @@ -25,39 +25,39 @@ InsertPokemonIntoBox: ; 51322 ld de, wBufferMon call InsertDataIntoBoxOrParty ld hl, wBufferMonMoves - ld de, TempMonMoves + ld de, wTempMonMoves ld bc, NUM_MOVES call CopyBytes ld hl, wBufferMonPP - ld de, TempMonPP + ld de, wTempMonPP ld bc, NUM_MOVES call CopyBytes - ld a, [CurPartyMon] + ld a, [wCurPartyMon] ld b, a farcall RestorePPofDepositedPokemon jp CloseSRAM InsertPokemonIntoParty: ; 5138b - ld hl, PartyCount + ld hl, wPartyCount call InsertSpeciesIntoBoxOrParty - ld a, [PartyCount] + ld a, [wPartyCount] dec a ld [wd265], a - ld hl, PartyMonNicknames + ld hl, wPartyMonNicknames ld bc, MON_NAME_LENGTH ld de, wBufferMonNick call InsertDataIntoBoxOrParty - ld a, [PartyCount] + ld a, [wPartyCount] dec a ld [wd265], a - ld hl, PartyMonOT + ld hl, wPartyMonOT ld bc, NAME_LENGTH ld de, wBufferMonOT call InsertDataIntoBoxOrParty - ld a, [PartyCount] + ld a, [wPartyCount] dec a ld [wd265], a - ld hl, PartyMons + ld hl, wPartyMons ld bc, PARTYMON_STRUCT_LENGTH ld de, wBufferMon call InsertDataIntoBoxOrParty @@ -66,11 +66,11 @@ InsertPokemonIntoParty: ; 5138b InsertSpeciesIntoBoxOrParty: ; 513cb inc [hl] inc hl - ld a, [CurPartyMon] + ld a, [wCurPartyMon] ld c, a ld b, 0 add hl, bc - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] ld c, a .loop ld a, [hl] @@ -97,7 +97,7 @@ InsertDataIntoBoxOrParty: ; 513e0 push bc ld a, [wd265] ld b, a - ld a, [CurPartyMon] + ld a, [wCurPartyMon] cp b pop bc jr z, .insert @@ -124,7 +124,7 @@ InsertDataIntoBoxOrParty: ; 513e0 .insert pop bc pop hl - ld a, [CurPartyMon] + ld a, [wCurPartyMon] call AddNTimes ld d, h ld e, l diff --git a/engine/movement.asm b/engine/movement.asm index 3ba48d60d..a701ff6f9 100644 --- a/engine/movement.asm +++ b/engine/movement.asm @@ -215,7 +215,7 @@ Movement_step_end: ; 51c1 add hl, bc ld [hl], $0 - ld hl, VramState + ld hl, wVramState res 7, [hl] ld hl, OBJECT_STEP_TYPE @@ -243,7 +243,7 @@ Movement_48: ; 51db add hl, bc ld [hl], STEP_TYPE_03 - ld hl, VramState + ld hl, wVramState res 7, [hl] ret ; 51fd @@ -257,7 +257,7 @@ Movement_remove_object: ; 51fd ld [hl], -1 .not_leading - ld hl, VramState + ld hl, wVramState res 7, [hl] ret ; 5210 @@ -271,7 +271,7 @@ Movement_4b: ; 5210 add hl, bc ld [hl], STEP_TYPE_04 - ld hl, VramState + ld hl, wVramState res 7, [hl] ret ; 5222 diff --git a/engine/mystery_gift.asm b/engine/mystery_gift.asm index fccdcfcbc..dc1daa1a3 100755 --- a/engine/mystery_gift.asm +++ b/engine/mystery_gift.asm @@ -79,7 +79,7 @@ DoMysteryGift: ; 1048ba (41:48ba) callfar GetDecorationName_c ld h, d ld l, e - ld de, StringBuffer1 + ld de, wStringBuffer1 ld bc, ITEM_NAME_LENGTH call CopyBytes ld hl, .Text_SentToHome ; sent decoration to home @@ -394,7 +394,7 @@ Function104b88: ; 104b88 (41:4b88) jp nz, Function104d32 call Function104d38 ret nz - ld hl, OverworldMap + ld hl, wOverworldMap ld a, [wca02] ld b, a call Function104d4e @@ -551,7 +551,7 @@ Function104cd2: ; 104cd2 (41:4cd2) jp nz, Function104d32 call Function104d38 ret nz - ld hl, OverworldMap + ld hl, wOverworldMap ld a, [wca02] ld b, a call Function104d4e @@ -1229,8 +1229,8 @@ StagePartyDataForMysteryGift: ; 10510b (41:510b) ld a, BANK(sPokemonData) call GetSRAMBank ld de, wMysteryGiftStaging - ld bc, sPokemonData + PartyMons - wPokemonData - ld hl, sPokemonData + PartySpecies - wPokemonData + ld bc, sPokemonData + wPartyMons - wPokemonData + ld hl, sPokemonData + wPartySpecies - wPokemonData .loop ld a, [hli] cp -1 @@ -1458,7 +1458,7 @@ Function105688: ; 105688 (41:5688) Function1056eb: ; 1056eb (41:56eb) ld c, 16 .loop - ld hl, Sprite01YCoord + ld hl, wVirtualOAMSprite00YCoord ld b, 8 .dec_y_loop dec [hl] @@ -1467,7 +1467,7 @@ rept SPRITEOAMSTRUCT_LENGTH endr dec b jr nz, .dec_y_loop - ld hl, Sprite09YCoord + ld hl, wVirtualOAMSprite08YCoord ld b, 8 .inc_y_loop inc [hl] @@ -1543,13 +1543,13 @@ Function105777: ; 105777 (41:5777) ret Function10578c: ; 10578c (41:578c) - ld de, OverworldMap + ld de, wOverworldMap ld a, BANK(sPlayerData) call GetSRAMBank - ld hl, sPlayerData + PlayerName - wPlayerData + ld hl, sPlayerData + wPlayerName - wPlayerData ld bc, NAME_LENGTH call CopyBytes - ld hl, sPlayerData + PlayerID - wPlayerData + ld hl, sPlayerData + wPlayerID - wPlayerData ld bc, 2 call CopyBytes ld hl, sPlayerData + wSecretID - wPlayerData @@ -1656,7 +1656,7 @@ Function1057d7: ; 1057d7 (41:57d7) ld [hl], $3c hlcoord 17, 15 ld [hl], $3e - ld de, Sprite01 + ld de, wVirtualOAMSprite00 ld hl, .OAM_data ld bc, 16 * SPRITEOAMSTRUCT_LENGTH call CopyBytes diff --git a/engine/mystery_gift_2.asm b/engine/mystery_gift_2.asm index 72767aa17..bb86e1ae6 100755 --- a/engine/mystery_gift_2.asm +++ b/engine/mystery_gift_2.asm @@ -5,7 +5,7 @@ PrepMysteryGiftDataToSend: ; 2c642 (b:4642) inc de ; wc801 ld a, BANK(sGameData) call GetSRAMBank - ld hl, sPlayerData + PlayerID - wPlayerData + ld hl, sPlayerData + wPlayerID - wPlayerData ld a, [hli] ld [de], a ld b, a @@ -15,12 +15,12 @@ PrepMysteryGiftDataToSend: ; 2c642 (b:4642) ld c, a inc de ; wc803 push bc - ld hl, sPlayerData + PlayerName - wPlayerData + ld hl, sPlayerData + wPlayerName - wPlayerData ld bc, NAME_LENGTH call CopyBytes push de ; wc80e - ld hl, sPokemonData + PokedexCaught - wPokemonData - ld b, EndPokedexCaught - PokedexCaught + ld hl, sPokemonData + wPokedexCaught - wPokemonData + ld b, wEndPokedexCaught - wPokedexCaught call CountSetBits pop de pop bc diff --git a/engine/naming_screen.asm b/engine/naming_screen.asm index b53a3b09d..859e7a515 100755 --- a/engine/naming_screen.asm +++ b/engine/naming_screen.asm @@ -19,7 +19,7 @@ NamingScreen: ; 116c1 ld [hl], d ld hl, wNamingScreenType ld [hl], b - ld hl, Options + ld hl, wOptions ld a, [hl] push af set NO_TEXT_SCROLL, [hl] @@ -41,7 +41,7 @@ NamingScreen: ; 116c1 pop af ld [hMapAnims], a pop af - ld [Options], a + ld [wOptions], a call ClearJoypad ret @@ -91,13 +91,13 @@ NamingScreen: ; 116c1 dw .Pokemon .Pokemon: ; 1173e (4:573e) - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] ld [wd265], a ld hl, LoadMenuMonIcon ld a, BANK(LoadMenuMonIcon) ld e, $1 rst FarCall ; ; indirect jump to LoadMenuMonIcon (8e83f (23:683f)) - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] ld [wd265], a call GetPokemonName hlcoord 5, 2 diff --git a/engine/npc_movement.asm b/engine/npc_movement.asm index e8b353fa6..ecb520554 100755 --- a/engine/npc_movement.asm +++ b/engine/npc_movement.asm @@ -235,14 +235,14 @@ CheckFacingObject:: ; 6fd9 call CheckCounterTile jr nz, .asm_6ff1 - ld a, [PlayerStandingMapX] + ld a, [wPlayerStandingMapX] sub d cpl inc a add d ld d, a - ld a, [PlayerStandingMapY] + ld a, [wPlayerStandingMapY] sub e cpl inc a @@ -250,7 +250,7 @@ CheckFacingObject:: ; 6fd9 ld e, a .asm_6ff1 - ld bc, ObjectStructs ; redundant + ld bc, wObjectStructs ; redundant ld a, 0 ld [hMapObjectIndexBuffer], a call IsNPCAtCoord @@ -317,7 +317,7 @@ Unreferenced_Function7015: ; 7041 IsNPCAtCoord: ; 7041 - ld bc, ObjectStructs + ld bc, wObjectStructs xor a .loop ld [hObjectStructIndexBuffer], a @@ -454,7 +454,7 @@ HasObjectReachedMovementLimit: ; 70a4 IsObjectMovingOffEdgeOfScreen: ; 70ed ld hl, OBJECT_NEXT_MAP_X add hl, bc - ld a, [XCoord] + ld a, [wXCoord] cp [hl] jr z, .check_y jr nc, .yes @@ -465,7 +465,7 @@ IsObjectMovingOffEdgeOfScreen: ; 70ed .check_y ld hl, OBJECT_NEXT_MAP_Y add hl, bc - ld a, [YCoord] + ld a, [wYCoord] cp [hl] jr z, .nope jr nc, .yes @@ -483,11 +483,11 @@ IsObjectMovingOffEdgeOfScreen: ; 70ed ; 7113 Unreferenced_Function7113: - ld a, [PlayerStandingMapX] + ld a, [wPlayerStandingMapX] ld d, a - ld a, [PlayerStandingMapY] + ld a, [wPlayerStandingMapY] ld e, a - ld bc, ObjectStructs + ld bc, wObjectStructs xor a .loop ld [hObjectStructIndexBuffer], a diff --git a/engine/npctrade.asm b/engine/npctrade.asm index 40f6dd638..7082d5442 100755 --- a/engine/npctrade.asm +++ b/engine/npctrade.asm @@ -22,7 +22,7 @@ NPCTrade:: ; fcba8 ld e, TRADE_GIVEMON call GetTradeAttribute - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] cp [hl] ld a, TRADE_WRONG jr nz, .done @@ -70,7 +70,7 @@ NPCTrade:: ; fcba8 CheckTradeGender: ; fcc23 xor a - ld [MonType], a + ld [wMonType], a ld e, TRADE_GENDER call GetTradeAttribute @@ -136,29 +136,29 @@ DoNPCTrade: ; fcc63 call GetTradeMonName call CopyTradeName - ld hl, PartyMonOT + ld hl, wPartyMonOT ld bc, NAME_LENGTH call Trade_GetAttributeOfCurrentPartymon ld de, wPlayerTrademonOTName call CopyTradeName - ld hl, PlayerName + ld hl, wPlayerName ld de, wPlayerTrademonSenderName call CopyTradeName - ld hl, PartyMon1ID + ld hl, wPartyMon1ID ld bc, PARTYMON_STRUCT_LENGTH call Trade_GetAttributeOfCurrentPartymon ld de, wPlayerTrademonID call Trade_CopyTwoBytes - ld hl, PartyMon1DVs + ld hl, wPartyMon1DVs ld bc, PARTYMON_STRUCT_LENGTH call Trade_GetAttributeOfCurrentPartymon ld de, wPlayerTrademonDVs call Trade_CopyTwoBytes - ld hl, PartyMon1Species + ld hl, wPartyMon1Species ld bc, PARTYMON_STRUCT_LENGTH call Trade_GetAttributeOfCurrentPartymon ld b, h @@ -177,15 +177,15 @@ DoNPCTrade: ; fcc63 .okay ld [wOTTrademonCaughtData], a - ld hl, PartyMon1Level + ld hl, wPartyMon1Level ld bc, PARTYMON_STRUCT_LENGTH call Trade_GetAttributeOfCurrentPartymon ld a, [hl] - ld [CurPartyLevel], a + ld [wCurPartyLevel], a ld a, [wOTTrademonSpecies] - ld [CurPartySpecies], a + ld [wCurPartySpecies], a xor a - ld [MonType], a + ld [wMonType], a ld [wPokemonWithdrawDepositParameter], a callfar RemoveMonFromPartyOrBox predef TryAddMonToParty @@ -205,7 +205,7 @@ DoNPCTrade: ; fcc63 ld de, wOTTrademonNickname call CopyTradeName - ld hl, PartyMonNicknames + ld hl, wPartyMonNicknames ld bc, MON_NAME_LENGTH call Trade_GetAttributeOfLastPartymon ld hl, wOTTrademonNickname @@ -220,7 +220,7 @@ DoNPCTrade: ; fcc63 ld de, wOTTrademonSenderName call CopyTradeName - ld hl, PartyMonOT + ld hl, wPartyMonOT ld bc, NAME_LENGTH call Trade_GetAttributeOfLastPartymon ld hl, wOTTrademonOTName @@ -231,7 +231,7 @@ DoNPCTrade: ; fcc63 ld de, wOTTrademonDVs call Trade_CopyTwoBytes - ld hl, PartyMon1DVs + ld hl, wPartyMon1DVs ld bc, PARTYMON_STRUCT_LENGTH call Trade_GetAttributeOfLastPartymon ld hl, wOTTrademonDVs @@ -242,7 +242,7 @@ DoNPCTrade: ; fcc63 ld de, wOTTrademonID + 1 call Trade_CopyTwoBytesReverseEndian - ld hl, PartyMon1ID + ld hl, wPartyMon1ID ld bc, PARTYMON_STRUCT_LENGTH call Trade_GetAttributeOfLastPartymon ld hl, wOTTrademonID @@ -251,7 +251,7 @@ DoNPCTrade: ; fcc63 ld e, TRADE_ITEM call GetTradeAttribute push hl - ld hl, PartyMon1Item + ld hl, wPartyMon1Item ld bc, PARTYMON_STRUCT_LENGTH call Trade_GetAttributeOfLastPartymon pop hl @@ -262,14 +262,14 @@ DoNPCTrade: ; fcc63 push bc push de push hl - ld a, [CurPartyMon] + ld a, [wCurPartyMon] push af - ld a, [PartyCount] + ld a, [wPartyCount] dec a - ld [CurPartyMon], a + ld [wCurPartyMon], a farcall ComputeNPCTrademonStats pop af - ld [CurPartyMon], a + ld [wCurPartyMon], a pop hl pop de pop bc @@ -295,13 +295,13 @@ GetTradeAttribute: ; 0xfcdc2 ; 0xfcdd7 Trade_GetAttributeOfCurrentPartymon: ; fcdd7 - ld a, [CurPartyMon] + ld a, [wCurPartyMon] call AddNTimes ret ; fcdde Trade_GetAttributeOfLastPartymon: ; fcdde - ld a, [PartyCount] + ld a, [wPartyCount] dec a call AddNTimes ld e, l @@ -313,7 +313,7 @@ GetTradeMonName: ; fcde8 push de ld [wd265], a call GetBasePokemonName - ld hl, StringBuffer1 + ld hl, wStringBuffer1 pop de ret ; fcdf4 @@ -364,7 +364,7 @@ GetTradeMonNames: ; fce1b ld a, [hl] call GetTradeMonName - ld de, StringBuffer2 + ld de, wStringBuffer2 call CopyTradeName ld e, TRADE_GIVEMON @@ -375,7 +375,7 @@ GetTradeMonNames: ; fce1b ld de, wMonOrItemNameBuffer call CopyTradeName - ld hl, StringBuffer1 + ld hl, wStringBuffer1 .loop ld a, [hli] cp "@" diff --git a/engine/options_menu.asm b/engine/options_menu.asm index 4ab215282..b6ca978d1 100755 --- a/engine/options_menu.asm +++ b/engine/options_menu.asm @@ -139,10 +139,10 @@ Options_TextSpeed: ; e42f5 .Save: ld b, a - ld a, [Options] + ld a, [wOptions] and $f0 or b - ld [Options], a + ld [wOptions], a .NonePressed: ld b, 0 @@ -173,7 +173,7 @@ Options_TextSpeed: ; e42f5 GetTextSpeed: ; e4346 ; converts TEXT_DELAY_* value in a to OPT_TEXT_SPEED_* value in c, ; with previous/next TEXT_DELAY_* values in d/e - ld a, [Options] + ld a, [wOptions] and $7 cp TEXT_DELAY_SLOW jr z, .slow @@ -197,7 +197,7 @@ GetTextSpeed: ; e4346 Options_BattleScene: ; e4365 - ld hl, Options + ld hl, wOptions ld a, [hJoyPressed] bit D_LEFT_F, a jr nz, .LeftPressed @@ -239,7 +239,7 @@ Options_BattleScene: ; e4365 Options_BattleStyle: ; e43a0 - ld hl, Options + ld hl, wOptions ld a, [hJoyPressed] bit D_LEFT_F, a jr nz, .LeftPressed @@ -280,7 +280,7 @@ Options_BattleStyle: ; e43a0 Options_Sound: ; e43dd - ld hl, Options + ld hl, wOptions ld a, [hJoyPressed] bit D_LEFT_F, a jr nz, .LeftPressed @@ -363,7 +363,7 @@ Options_Print: ; e4424 .Save: ld b, a - ld [GBPrinter], a + ld [wGBPrinter], a .NonePressed: ld b, $0 @@ -398,7 +398,7 @@ Options_Print: ; e4424 GetPrinterSetting: ; e4491 ; converts GBPRINTER_* value in a to OPT_PRINT_* value in c, ; with previous/next GBPRINTER_* values in d/e - ld a, [GBPrinter] + ld a, [wGBPrinter] and a jr z, .IsLightest cp GBPRINTER_LIGHTER @@ -434,7 +434,7 @@ GetPrinterSetting: ; e4491 ; e44c1 Options_MenuAccount: ; e44c1 - ld hl, Options2 + ld hl, wOptions2 ld a, [hJoyPressed] bit D_LEFT_F, a jr nz, .LeftPressed @@ -475,7 +475,7 @@ Options_MenuAccount: ; e44c1 Options_Frame: ; e44fa - ld hl, TextBoxFrame + ld hl, wTextBoxFrame ld a, [hJoyPressed] bit D_LEFT_F, a jr nz, .LeftPressed @@ -497,7 +497,7 @@ Options_Frame: ; e44fa and $7 ld [hl], a UpdateFrame: ; e4512 - ld a, [TextBoxFrame] + ld a, [wTextBoxFrame] hlcoord 16, 15 ; where on the screen the number is drawn add "1" ld [hl], a diff --git a/engine/overworld.asm b/engine/overworld.asm index 4c379711d..7e3a69c6f 100755 --- a/engine/overworld.asm +++ b/engine/overworld.asm @@ -9,9 +9,9 @@ GetEmote2bpp: ; 1412a _ReplaceKrisSprite:: ; 14135 call GetPlayerSprite - ld a, [UsedSprites] + ld a, [wUsedSprites] ld [hUsedSpriteIndex], a - ld a, [UsedSprites + 1] + ld a, [wUsedSprites + 1] ld [hUsedSpriteTile], a call GetUsedSprite ret @@ -49,8 +49,8 @@ Special_RefreshSprites:: ; 14168 .Refresh: ; 1416f xor a - ld bc, UsedSpritesEnd - UsedSprites - ld hl, UsedSprites + ld bc, wUsedSpritesEnd - wUsedSprites + ld hl, wUsedSprites call ByteFill call GetPlayerSprite call AddMapSprites @@ -70,7 +70,7 @@ GetPlayerSprite: ; 14183 ld hl, .Kris .go - ld a, [PlayerState] + ld a, [wPlayerState] ld c, a .loop ld a, [hli] @@ -82,7 +82,7 @@ GetPlayerSprite: ; 14183 ; Any player state not in the array defaults to Chris's sprite. xor a ; ld a, PLAYER_NORMAL - ld [PlayerState], a + ld [wPlayerState], a ld a, SPRITE_CHRIS jr .finish @@ -90,9 +90,9 @@ GetPlayerSprite: ; 14183 ld a, [hl] .finish - ld [UsedSprites + 0], a - ld [PlayerSprite], a - ld [PlayerObjectSprite], a + ld [wUsedSprites + 0], a + ld [wPlayerSprite], a + ld [wPlayerObjectSprite], a ret .Chris: @@ -125,7 +125,7 @@ AddMapSprites: ; 141c9 AddIndoorSprites: ; 141d9 - ld hl, Map1ObjectSprite + ld hl, wMap1ObjectSprite ld a, 1 .loop push af @@ -142,7 +142,7 @@ AddIndoorSprites: ; 141d9 AddOutdoorSprites: ; 141ee - ld a, [MapGroup] + ld a, [wMapGroup] dec a ld c, a ld b, 0 @@ -276,7 +276,7 @@ GetMonSprite: ; 14259 sub SPRITE_VARS ld e, a ld d, 0 - ld hl, VariableSprites + ld hl, wVariableSprites add hl, de ld a, [hl] and a @@ -355,7 +355,7 @@ AddSpriteGFX: ; 142e5 push hl push bc ld b, a - ld hl, UsedSprites + 2 + ld hl, wUsedSprites + 2 ld c, SPRITE_GFX_LIST_CAPACITY - 1 .loop ld a, [hl] @@ -392,7 +392,7 @@ LoadSpriteGFX: ; 14306 ; Bug: b is not preserved, so it's useless as a next count. ; Uncomment the lines below to fix. - ld hl, UsedSprites + ld hl, wUsedSprites ld b, SPRITE_GFX_LIST_CAPACITY .loop ld a, [hli] @@ -420,10 +420,10 @@ LoadSpriteGFX: ; 14306 SortUsedSprites: ; 1431e ; Bubble-sort sprites by type. -; Run backwards through UsedSprites to find the last one. +; Run backwards through wUsedSprites to find the last one. ld c, SPRITE_GFX_LIST_CAPACITY - ld de, UsedSprites + (SPRITE_GFX_LIST_CAPACITY - 1) * 2 + ld de, wUsedSprites + (SPRITE_GFX_LIST_CAPACITY - 1) * 2 .FindLastSprite: ld a, [de] and a @@ -440,7 +440,7 @@ SortUsedSprites: ; 1431e ; higher than a later one, swap them. inc de - ld hl, UsedSprites + 1 + ld hl, wUsedSprites + 1 .CheckSprite: push bc @@ -493,7 +493,7 @@ ArrangeUsedSprites: ; 14355 ; Get the length of each sprite and space them out in VRAM. ; Crystal introduces a second table in VRAM bank 0. - ld hl, UsedSprites + ld hl, wUsedSprites ld c, SPRITE_GFX_LIST_CAPACITY ld b, 0 .FirstTableLength: @@ -573,7 +573,7 @@ GetSpriteLength: ; 14386 GetUsedSprites: ; 1439b - ld hl, UsedSprites + ld hl, wUsedSprites ld c, SPRITE_GFX_LIST_CAPACITY .loop diff --git a/engine/pack.asm b/engine/pack.asm index f9c7490af..dfe30612d 100644 --- a/engine/pack.asm +++ b/engine/pack.asm @@ -13,7 +13,7 @@ const PACKSTATE_QUITRUNSCRIPT ; 10 Pack: ; 10000 - ld hl, Options + ld hl, wOptions set NO_TEXT_SCROLL, [hl] call InitPackBuffers .loop @@ -28,7 +28,7 @@ Pack: ; 10000 .done ld a, [wCurrPocket] ld [wLastPocket], a - ld hl, Options + ld hl, wOptions res NO_TEXT_SCROLL, [hl] ret ; 10026 @@ -207,13 +207,13 @@ Pack: ; 10000 ret c farcall ChooseMonToLearnTMHM jr c, .declined - ld hl, Options + ld hl, wOptions ld a, [hl] push af res NO_TEXT_SCROLL, [hl] farcall TeachTMHM pop af - ld [Options], a + ld [wOptions], a .declined xor a ld [hBGMapMode], a @@ -482,7 +482,7 @@ UseItem: ; 10311 ret .Party: ; 10338 (4:4338) - ld a, [PartyCount] + ld a, [wPartyCount] and a jr z, .NoPokemon call DoItemEffect @@ -524,8 +524,8 @@ TossMenu: ; 10364 call ExitMenu pop af jr c, .finish - ld hl, NumItems - ld a, [CurItemQuantity] + ld hl, wNumItems + ld a, [wCurItemQuantity] call TossItem call Pack_GetItemName ld hl, Text_ThrewAway @@ -573,13 +573,13 @@ RegisterItem: ; 103c2 rrca and $c0 ld b, a - ld a, [CurItemQuantity] + ld a, [wCurItemQuantity] inc a and $3f or b - ld [WhichRegisteredItem], a - ld a, [CurItem] - ld [RegisteredItem], a + ld [wWhichRegisteredItem], a + ld a, [wCurItem] + ld [wRegisteredItem], a call Pack_GetItemName ld de, SFX_FULL_HEAL call WaitPlaySFX @@ -594,15 +594,15 @@ RegisterItem: ; 103c2 ; 103fd GiveItem: ; 103fd - ld a, [PartyCount] + ld a, [wPartyCount] and a jp z, .NoPokemon - ld a, [Options] + ld a, [wOptions] push af res NO_TEXT_SCROLL, a - ld [Options], a + ld [wOptions], a ld a, PARTYMENUACTION_GIVE_ITEM - ld [PartyMenuActionText], a + ld [wPartyMenuActionText], a call ClearBGPalettes farcall LoadPartyMenuGFX farcall InitPartyMenuWithCancel @@ -615,7 +615,7 @@ GiveItem: ; 103fd call DelayFrame farcall PartyMenuSelect jr c, .finish - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] cp EGG jr nz, .give ld hl, .Egg @@ -628,7 +628,7 @@ GiveItem: ; 103fd ld a, [wPackJumptableIndex] push af call GetCurNick - ld hl, StringBuffer1 + ld hl, wStringBuffer1 ld de, wMonOrItemNameBuffer ld bc, MON_NAME_LENGTH call CopyBytes @@ -639,7 +639,7 @@ GiveItem: ; 103fd ld [wJumptableIndex], a .finish pop af - ld [Options], a + ld [wOptions], a xor a ld [hBGMapMode], a call Pack_InitGFX @@ -663,7 +663,7 @@ QuitItemSubmenu: ; 10492 ; 10493 BattlePack: ; 10493 - ld hl, Options + ld hl, wOptions set NO_TEXT_SCROLL, [hl] call InitPackBuffers .loop @@ -678,7 +678,7 @@ BattlePack: ; 10493 .end ld a, [wCurrPocket] ld [wLastPocket], a - ld hl, Options + ld hl, wOptions res NO_TEXT_SCROLL, [hl] ret ; 104b9 @@ -1040,8 +1040,8 @@ DepositSellPack: ; 106be call InitPocket call WaitBGMap_DrawPackGFX farcall TMHMPocket - ld a, [CurItem] - ld [CurItem], a + ld a, [wCurItem] + ld [wCurItem], a ret .BallsPocket: ; 1073b (4:473b) @@ -1123,7 +1123,7 @@ DepositSellTutorial_InterpretJoypad: ; 1076f TutorialPack: ; 107bb call DepositSellInitPackBuffers - ld a, [InputType] + ld a, [wInputType] or a jr z, .loop farcall _DudeAutoInput_RightA @@ -1148,7 +1148,7 @@ TutorialPack: ; 107bb ; entries correspond to *_POCKET constants dw .Items dw .Balls - dw .KeyItems + dw .wKeyItems dw .TMHM .Items: ; 107e9 (4:47e9) @@ -1174,7 +1174,7 @@ TutorialPack: ; 107bb dba UpdateItemDescription ; 10807 -.KeyItems: ; 10807 (4:4807) +.wKeyItems: ; 10807 (4:4807) ld a, KEY_ITEM_POCKET ld hl, .KeyItemsMenuDataHeader jr .DisplayPocket @@ -1202,8 +1202,8 @@ TutorialPack: ; 107bb call InitPocket call WaitBGMap_DrawPackGFX farcall TMHMPocket - ld a, [CurItem] - ld [CurItem], a + ld a, [wCurItem] + ld [wCurItem], a ret .Balls: ; 1083b (4:483b) @@ -1268,13 +1268,13 @@ Pack_QuitRunScript: ; 1087e (4:487e) ret Pack_PrintTextNoScroll: ; 10889 (4:4889) - ld a, [Options] + ld a, [wOptions] push af set NO_TEXT_SCROLL, a - ld [Options], a + ld [wOptions], a call PrintText pop af - ld [Options], a + ld [wOptions], a ret WaitBGMap_DrawPackGFX: ; 1089a (4:489a) @@ -1284,7 +1284,7 @@ DrawPackGFX: ; 1089d maskbits NUM_POCKETS ld e, a ld d, $0 - ld a, [BattleType] + ld a, [wBattleType] cp BATTLETYPE_TUTORIAL jr z, .male_dude ld a, [wPlayerGender] @@ -1506,7 +1506,7 @@ DrawPocketName: ; 109bb ; 10a1d Pack_GetItemName: ; 10a1d - ld a, [CurItem] + ld a, [wCurItem] ld [wNamedObjectIndexBuffer], a call GetItemName call CopyName1 @@ -1547,7 +1547,7 @@ ItemsPocketMenuDataHeader: ; 0x10a4f db STATICMENU_ENABLE_SELECT | STATICMENU_ENABLE_LEFT_RIGHT | STATICMENU_ENABLE_START | STATICMENU_WRAP | STATICMENU_CURSOR ; flags db 5, 8 ; rows, columns db 2 ; horizontal spacing - dbw 0, NumItems + dbw 0, wNumItems dba PlaceMenuItemName dba PlaceMenuItemQuantity dba UpdateItemDescription @@ -1564,7 +1564,7 @@ PC_Mart_ItemsPocketMenuDataHeader: ; 0x10a67 db STATICMENU_ENABLE_SELECT | STATICMENU_ENABLE_LEFT_RIGHT | STATICMENU_ENABLE_START | STATICMENU_WRAP ; flags db 5, 8 ; rows, columns db 2 ; horizontal spacing - dbw 0, NumItems + dbw 0, wNumItems dba PlaceMenuItemName dba PlaceMenuItemQuantity dba UpdateItemDescription @@ -1581,7 +1581,7 @@ KeyItemsPocketMenuDataHeader: ; 0x10a7f db STATICMENU_ENABLE_SELECT | STATICMENU_ENABLE_LEFT_RIGHT | STATICMENU_ENABLE_START | STATICMENU_WRAP | STATICMENU_CURSOR ; flags db 5, 8 ; rows, columns db 1 ; horizontal spacing - dbw 0, NumKeyItems + dbw 0, wNumKeyItems dba PlaceMenuItemName dba PlaceMenuItemQuantity dba UpdateItemDescription @@ -1598,7 +1598,7 @@ PC_Mart_KeyItemsPocketMenuDataHeader: ; 0x10a97 db STATICMENU_ENABLE_SELECT | STATICMENU_ENABLE_LEFT_RIGHT | STATICMENU_ENABLE_START | STATICMENU_WRAP ; flags db 5, 8 ; rows, columns db 1 ; horizontal spacing - dbw 0, NumKeyItems + dbw 0, wNumKeyItems dba PlaceMenuItemName dba PlaceMenuItemQuantity dba UpdateItemDescription @@ -1615,7 +1615,7 @@ BallsPocketMenuDataHeader: ; 0x10aaf db STATICMENU_ENABLE_SELECT | STATICMENU_ENABLE_LEFT_RIGHT | STATICMENU_ENABLE_START | STATICMENU_WRAP | STATICMENU_CURSOR ; flags db 5, 8 ; rows, columns db 2 ; horizontal spacing - dbw 0, NumBalls + dbw 0, wNumBalls dba PlaceMenuItemName dba PlaceMenuItemQuantity dba UpdateItemDescription @@ -1632,7 +1632,7 @@ PC_Mart_BallsPocketMenuDataHeader: ; 0x10ac7 db STATICMENU_ENABLE_SELECT | STATICMENU_ENABLE_LEFT_RIGHT | STATICMENU_ENABLE_START | STATICMENU_WRAP ; flags db 5, 8 ; rows, columns db 2 ; horizontal spacing - dbw 0, NumBalls + dbw 0, wNumBalls dba PlaceMenuItemName dba PlaceMenuItemQuantity dba UpdateItemDescription diff --git a/engine/party_menu.asm b/engine/party_menu.asm index 5ef9b50de..9dffa4089 100644 --- a/engine/party_menu.asm +++ b/engine/party_menu.asm @@ -1,7 +1,7 @@ SelectMonFromParty: ; 50000 call DisableSpriteUpdates xor a - ld [PartyMenuActionText], a + ld [wPartyMenuActionText], a call ClearBGPalettes call InitPartyMenuLayout call WaitBGMap @@ -15,7 +15,7 @@ SelectMonFromParty: ; 50000 SelectTradeOrDayCareMon: ; 5001d ld a, b - ld [PartyMenuActionText], a + ld [wPartyMenuActionText], a call DisableSpriteUpdates call ClearBGPalettes call InitPartyMenuLayout @@ -47,7 +47,7 @@ LoadPartyMenuGFX: ; 5004f WritePartyMenuTilemap: ; 0x5005f - ld hl, Options + ld hl, wOptions ld a, [hl] push af set NO_TEXT_SCROLL, [hl] @@ -69,7 +69,7 @@ WritePartyMenuTilemap: ; 0x5005f jr .loop .end pop af - ld [Options], a + ld [wOptions], a ret ; 0x50089 @@ -88,7 +88,7 @@ WritePartyMenuTilemap: ; 0x5005f PlacePartyNicknames: ; 5009b hlcoord 3, 1 - ld a, [PartyCount] + ld a, [wPartyCount] and a jr z, .end ld c, a @@ -97,7 +97,7 @@ PlacePartyNicknames: ; 5009b push bc push hl push hl - ld hl, PartyMonNicknames + ld hl, wPartyMonNicknames ld a, b call GetNick pop hl @@ -126,7 +126,7 @@ PlacePartyNicknames: ; 5009b PlacePartyHPBar: ; 500cf xor a ld [wSGBPals], a - ld a, [PartyCount] + ld a, [wPartyCount] and a ret z ld c, a @@ -169,7 +169,7 @@ PlacePartyHPBar: ; 500cf PlacePartymonHPBar: ; 50117 ld a, b ld bc, PARTYMON_STRUCT_LENGTH - ld hl, PartyMon1HP + ld hl, wPartyMon1HP call AddNTimes ld a, [hli] or [hl] @@ -194,7 +194,7 @@ PlacePartymonHPBar: ; 50117 ; 50138 PlacePartyMenuHPDigits: ; 50138 - ld a, [PartyCount] + ld a, [wPartyCount] and a ret z ld c, a @@ -208,7 +208,7 @@ PlacePartyMenuHPDigits: ; 50138 push hl ld a, b ld bc, PARTYMON_STRUCT_LENGTH - ld hl, PartyMon1HP + ld hl, wPartyMon1HP call AddNTimes ld e, l ld d, h @@ -236,7 +236,7 @@ PlacePartyMenuHPDigits: ; 50138 ; 50176 PlacePartyMonLevel: ; 50176 - ld a, [PartyCount] + ld a, [wPartyCount] and a ret z ld c, a @@ -250,7 +250,7 @@ PlacePartyMonLevel: ; 50176 push hl ld a, b ld bc, PARTYMON_STRUCT_LENGTH - ld hl, PartyMon1Level + ld hl, wPartyMon1Level call AddNTimes ld e, l ld d, h @@ -279,7 +279,7 @@ PlacePartyMonLevel: ; 50176 ; 501b2 PlacePartyMonStatus: ; 501b2 - ld a, [PartyCount] + ld a, [wPartyCount] and a ret z ld c, a @@ -293,7 +293,7 @@ PlacePartyMonStatus: ; 501b2 push hl ld a, b ld bc, PARTYMON_STRUCT_LENGTH - ld hl, PartyMon1Status + ld hl, wPartyMon1Status call AddNTimes ld e, l ld d, h @@ -312,7 +312,7 @@ PlacePartyMonStatus: ; 501b2 ; 501e0 PlacePartyMonTMHMCompatibility: ; 501e0 - ld a, [PartyCount] + ld a, [wPartyCount] and a ret z ld c, a @@ -324,12 +324,12 @@ PlacePartyMonTMHMCompatibility: ; 501e0 call PartyMenuCheckEgg jr z, .next push hl - ld hl, PartySpecies + ld hl, wPartySpecies ld e, b ld d, 0 add hl, de ld a, [hl] - ld [CurPartySpecies], a + ld [wCurPartySpecies], a predef CanLearnTMHMMove pop hl call .PlaceAbleNotAble @@ -368,7 +368,7 @@ PlacePartyMonTMHMCompatibility: ; 501e0 PlacePartyMonEvoStoneCompatibility: ; 5022f - ld a, [PartyCount] + ld a, [wPartyCount] and a ret z ld c, a @@ -382,7 +382,7 @@ PlacePartyMonEvoStoneCompatibility: ; 5022f push hl ld a, b ld bc, PARTYMON_STRUCT_LENGTH - ld hl, PartyMon1Species + ld hl, wPartyMon1Species call AddNTimes ld a, [hl] dec a @@ -407,19 +407,19 @@ PlacePartyMonEvoStoneCompatibility: ; 5022f ; 50268 .DetermineCompatibility: ; 50268 - ld de, StringBuffer1 + ld de, wStringBuffer1 ld a, BANK(EvosAttacksPointers) ld bc, 2 call FarCopyBytes - ld hl, StringBuffer1 + ld hl, wStringBuffer1 ld a, [hli] ld h, [hl] ld l, a - ld de, StringBuffer1 + ld de, wStringBuffer1 ld a, BANK(EvosAttacks) ld bc, $a call FarCopyBytes - ld hl, StringBuffer1 + ld hl, wStringBuffer1 .loop2 ld a, [hli] and a @@ -430,7 +430,7 @@ PlacePartyMonEvoStoneCompatibility: ; 5022f jr nz, .loop2 dec hl dec hl - ld a, [CurItem] + ld a, [wCurItem] cp [hl] inc hl inc hl @@ -452,7 +452,7 @@ PlacePartyMonEvoStoneCompatibility: ; 5022f PlacePartyMonGender: ; 502b1 - ld a, [PartyCount] + ld a, [wPartyCount] and a ret z ld c, a @@ -463,12 +463,12 @@ PlacePartyMonGender: ; 502b1 push hl call PartyMenuCheckEgg jr z, .next - ld [CurPartySpecies], a + ld [wCurPartySpecies], a push hl ld a, b - ld [CurPartyMon], a + ld [wCurPartyMon], a xor a - ld [MonType], a + ld [wMonType], a call GetGender ld de, .unknown jr c, .got_gender @@ -505,7 +505,7 @@ PlacePartyMonGender: ; 502b1 PlacePartyMonMobileBattleSelection: ; 50307 - ld a, [PartyCount] + ld a, [wPartyCount] and a ret z ld c, a @@ -588,10 +588,10 @@ PlacePartyMonMobileBattleSelection: ; 50307 PartyMenuCheckEgg: ; 50389 - ld a, LOW(PartySpecies) + ld a, LOW(wPartySpecies) add b ld e, a - ld a, HIGH(PartySpecies) + ld a, HIGH(wPartySpecies) adc 0 ld d, a ld a, [de] @@ -600,10 +600,10 @@ PartyMenuCheckEgg: ; 50389 ; 50396 GetPartyMenuQualityIndexes: ; 50396 - ld a, [PartyMenuActionText] + ld a, [wPartyMenuActionText] and $f0 jr nz, .skip - ld a, [PartyMenuActionText] + ld a, [wPartyMenuActionText] and $f ld e, a ld d, 0 @@ -624,7 +624,7 @@ INCLUDE "data/party_menu_qualities.asm" InitPartyMenuGFX: ; 503e0 - ld hl, PartyCount + ld hl, wPartyCount ld a, [hli] and a ret z @@ -655,7 +655,7 @@ InitPartyMenuWithCancel: ; 50405 ld [wSwitchMon], a ld de, PartyMenuAttributes call SetMenuAttributes - ld a, [PartyCount] + ld a, [wPartyCount] inc a ld [w2DMenuNumRows], a ; list length dec a @@ -681,7 +681,7 @@ InitPartyMenuNoCancel: ; 0x5042d ; no cancel ld de, PartyMenuAttributes call SetMenuAttributes - ld a, [PartyCount] + ld a, [wPartyCount] ld [w2DMenuNumRows], a ; list length ld b, a ld a, [wPartyMenuCursor] @@ -719,7 +719,7 @@ PartyMenuSelect: ; 0x50457 ; sets carry if exitted menu. call StaticMenuJoypad call PlaceHollowCursor - ld a, [PartyCount] + ld a, [wPartyCount] inc a ld b, a ld a, [wMenuCursorY] ; menu selection? @@ -732,13 +732,13 @@ PartyMenuSelect: ; 0x50457 jr nz, .exitmenu ; B button ld a, [wMenuCursorY] dec a - ld [CurPartyMon], a + ld [wCurPartyMon], a ld c, a ld b, $0 - ld hl, PartySpecies + ld hl, wPartySpecies add hl, bc ld a, [hl] - ld [CurPartySpecies], a + ld [wCurPartySpecies], a ld de, SFX_READ_TEXT_2 call PlaySFX @@ -759,13 +759,13 @@ PrintPartyMenuText: ; 5049a hlcoord 0, 14 lb bc, 2, 18 call TextBox - ld a, [PartyCount] + ld a, [wPartyCount] and a jr nz, .haspokemon ld de, YouHaveNoPKMNString jr .gotstring .haspokemon ; 504ae - ld a, [PartyMenuActionText] + ld a, [wPartyMenuActionText] and $f ; drop high nibble ld hl, PartyMenuStrings ld e, a @@ -776,14 +776,14 @@ PrintPartyMenuText: ; 5049a ld d, [hl] ld e, a .gotstring ; 504be - ld a, [Options] + ld a, [wOptions] push af set 4, a ; disable text delay - ld [Options], a + ld [wOptions], a hlcoord 1, 16 ; Coord call PlaceString pop af - ld [Options], a + ld [wOptions], a ret ; 0x504d2 @@ -828,10 +828,10 @@ YouHaveNoPKMNString: ; 0x50556 db "You have no <PK><MN>!@" PrintPartyMenuActionText: ; 50566 - ld a, [CurPartyMon] - ld hl, PartyMonNicknames + ld a, [wCurPartyMon] + ld hl, wPartyMonNicknames call GetNick - ld a, [PartyMenuActionText] + ld a, [wPartyMenuActionText] and $f ld hl, .MenuActionTexts call .PrintText @@ -920,12 +920,12 @@ PrintPartyMenuActionText: ; 50566 ld a, [hli] ld h, [hl] ld l, a - ld a, [Options] + ld a, [wOptions] push af set NO_TEXT_SCROLL, a - ld [Options], a + ld [wOptions], a call PrintText pop af - ld [Options], a + ld [wOptions], a ret ; 505da diff --git a/engine/phone/phone.asm b/engine/phone/phone.asm index f402e9102..fad859bfe 100644 --- a/engine/phone/phone.asm +++ b/engine/phone/phone.asm @@ -68,7 +68,7 @@ Phone_FindOpenSlot: ; 9002d GetRemainingSpaceInPhoneList: ; 90040 xor a - ld [Buffer1], a + ld [wBuffer1], a ld hl, PermanentNumbers .loop ld a, [hli] @@ -82,7 +82,7 @@ GetRemainingSpaceInPhoneList: ; 90040 ld c, a call _CheckCellNum jr c, .permanent - ld hl, Buffer1 + ld hl, wBuffer1 inc [hl] .permanent pop hl @@ -93,7 +93,7 @@ GetRemainingSpaceInPhoneList: ; 90040 .done ld a, CONTACT_LIST_SIZE - ld hl, Buffer1 + ld hl, wBuffer1 sub [hl] ret ; 90066 @@ -173,7 +173,7 @@ CheckPhoneContactTimeOfDay: ; 900ad (24:40ad) ChooseRandomCaller: ; 900bf (24:40bf) ; If no one is available to call, don't return anything. - ld a, [EngineBuffer3] + ld a, [wEngineBuffer3] and a jr z, .NothingToSample @@ -188,7 +188,7 @@ ChooseRandomCaller: ; 900bf (24:40bf) ; Return the caller ID you just sampled. ld c, a ld b, 0 - ld hl, EngineBuffer4 + ld hl, wEngineBuffer4 add hl, bc ld a, [hl] scf @@ -201,8 +201,8 @@ ChooseRandomCaller: ; 900bf (24:40bf) GetAvailableCallers: ; 900de (24:40de) farcall CheckTime ld a, c - ld [EngineBuffer1], a - ld hl, EngineBuffer3 + ld [wEngineBuffer1], a + ld hl, wEngineBuffer3 ld bc, 11 xor a call ByteFill @@ -210,38 +210,38 @@ GetAvailableCallers: ; 900de (24:40de) ld a, CONTACT_LIST_SIZE .loop - ld [EngineBuffer2], a + ld [wEngineBuffer2], a ld a, [de] and a jr z, .not_good_for_call ld hl, PhoneContacts + PHONE_CONTACT_SCRIPT2_TIME ld bc, PHONE_TABLE_WIDTH call AddNTimes - ld a, [EngineBuffer1] + ld a, [wEngineBuffer1] and [hl] jr z, .not_good_for_call ld bc, PHONE_CONTACT_MAP_GROUP - PHONE_CONTACT_SCRIPT2_TIME add hl, bc - ld a, [MapGroup] + ld a, [wMapGroup] cp [hl] jr nz, .different_map inc hl - ld a, [MapNumber] + ld a, [wMapNumber] cp [hl] jr z, .not_good_for_call .different_map - ld a, [EngineBuffer3] + ld a, [wEngineBuffer3] ld c, a ld b, $0 inc a - ld [EngineBuffer3], a - ld hl, EngineBuffer4 + ld [wEngineBuffer3], a + ld hl, wEngineBuffer4 add hl, bc ld a, [de] ld [hl], a .not_good_for_call inc de - ld a, [EngineBuffer2] + ld a, [wEngineBuffer2] dec a jr nz, .loop ret @@ -348,12 +348,12 @@ Function90199: ; 90199 (24:4199) ; use the "Just talk to that person" script. ld hl, PHONE_CONTACT_MAP_GROUP add hl, de - ld a, [MapGroup] + ld a, [wMapGroup] cp [hl] jr nz, .GetPhoneScript ld hl, PHONE_CONTACT_MAP_NUMBER add hl, de - ld a, [MapNumber] + ld a, [wMapNumber] cp [hl] jr nz, .GetPhoneScript ld b, BANK(PhoneScript_JustTalkToThem) @@ -379,11 +379,11 @@ Function90199: ; 90199 (24:4199) .DoPhoneCall: ld a, b - ld [PhoneScriptBank], a + ld [wPhoneScriptBank], a ld a, l - ld [PhoneCaller], a + ld [wPhoneCaller], a ld a, h - ld [PhoneCaller + 1], a + ld [wPhoneCaller + 1], a ld b, BANK(UnknownScript_0x90205) ld de, UnknownScript_0x90205 call ExecuteCallbackScript @@ -418,7 +418,7 @@ LoadCallerScript: ; 9020d (24:420d) call AddNTimes ld a, BANK(PhoneContacts) .proceed - ld de, EngineBuffer2 + ld de, wEngineBuffer2 ld bc, 12 call FarCopyBytes ret @@ -491,11 +491,11 @@ Phone_CallerTextboxWithName: ; 90292 (24:4292) PhoneCall:: ; 9029a ld a, b - ld [PhoneScriptBank], a + ld [wPhoneScriptBank], a ld a, e - ld [PhoneCaller], a + ld [wPhoneCaller], a ld a, d - ld [PhoneCaller + 1], a + ld [wPhoneCaller + 1], a call Phone_FirstOfTwoRings call Phone_FirstOfTwoRings farcall StubbedTrainerRankings_PhoneCalls @@ -519,11 +519,11 @@ Phone_CallerTextboxWithName2: ; 902c9 ld [hl], "☎" inc hl inc hl - ld a, [PhoneScriptBank] + ld a, [wPhoneScriptBank] ld b, a - ld a, [PhoneCaller] + ld a, [wPhoneCaller] ld e, a - ld a, [PhoneCaller + 1] + ld a, [wPhoneCaller + 1] ld d, a call FarPlaceString ret diff --git a/engine/pic_animation.asm b/engine/pic_animation.asm index 4317d96f8..a84c3f449 100644 --- a/engine/pic_animation.asm +++ b/engine/pic_animation.asm @@ -267,7 +267,7 @@ PokeAnim_CryNoWait: ; d0188 PokeAnim_StereoCry: ; d0196 ld a, $f - ld [CryTracks], a + ld [wCryTracks], a ld a, [wPokeAnimSpecies] call PlayStereoCry2 ld a, [wPokeAnimSceneIndex] @@ -291,7 +291,7 @@ PokeAnim_DeinitFrames: ; d01a9 ; d01c6 AnimateMon_CheckIfPokemon: ; d01c6 - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] cp EGG jr z, .fail call IsAPokemon @@ -326,7 +326,7 @@ PokeAnim_InitPicAttributes: ; d01d6 ld [wPokeAnimPointer], a ld a, b ld [wPokeAnimPointer + 1], a -; hl contains TileMap coords +; hl contains tilemap coords ld a, l ld [wPokeAnimCoord], a ld a, h @@ -335,13 +335,13 @@ PokeAnim_InitPicAttributes: ; d01d6 ld a, d ld [wPokeAnimGraphicStartTile], a - ld a, BANK(CurPartySpecies) - ld hl, CurPartySpecies + ld a, BANK(wCurPartySpecies) + ld hl, wCurPartySpecies call GetFarWRAMByte ld [wPokeAnimSpecies], a - ld a, BANK(UnownLetter) - ld hl, UnownLetter + ld a, BANK(wUnownLetter) + ld hl, wUnownLetter call GetFarWRAMByte ld [wPokeAnimUnownLetter], a @@ -938,7 +938,7 @@ PokeAnim_GetAttrMapCoord: ; d0551 ld a, [hli] ld h, [hl] ld l, a - ld de, AttrMap - TileMap + ld de, wAttrMap - wTileMap add hl, de ret ; d055c @@ -1001,12 +1001,12 @@ GetMonAnimPointer: ; d055c PokeAnim_GetFrontpicDims: ; d05b4 ld a, [rSVBK] push af - ld a, BANK(CurPartySpecies) + ld a, BANK(wCurPartySpecies) ld [rSVBK], a - ld a, [CurPartySpecies] - ld [CurSpecies], a + ld a, [wCurPartySpecies] + ld [wCurSpecies], a call GetBaseData - ld a, [BasePicSize] + ld a, [wBasePicSize] and $f ld c, a pop af @@ -1136,6 +1136,6 @@ HOF_AnimateFrontpic: ; d066e xor a ld [wBoxAlignment], a inc a - ld [CurPartySpecies], a + ld [wCurPartySpecies], a ret ; d0695 diff --git a/engine/player_gfx.asm b/engine/player_gfx.asm index 21929e32c..282d2e22f 100644 --- a/engine/player_gfx.asm +++ b/engine/player_gfx.asm @@ -7,7 +7,7 @@ Unreferenced_Function88248: ; 88248 .okay ld a, c - ld [TrainerClass], a + ld [wTrainerClass], a ret MovePlayerPicRight: ; 88258 @@ -73,7 +73,7 @@ ShowPlayerNamingChoices: ; 88297 INCLUDE "data/player_names.asm" GetPlayerNameArray: ; 88318 This Function is never called - ld hl, PlayerName + ld hl, wPlayerName ld de, MalePlayerNameArray ld a, [wPlayerGender] bit 0, a @@ -156,7 +156,7 @@ HOF_LoadTrainerFrontpic: ; 88840 .GotClass: ld a, e - ld [TrainerClass], a + ld [wTrainerClass], a ld de, ChrisPic ld a, [wPlayerGender] bit 0, a @@ -184,7 +184,7 @@ DrawIntroPlayerPic: ; 88874 ld e, KRIS .GotClass: ld a, e - ld [TrainerClass], a + ld [wTrainerClass], a ; Load pic ld de, ChrisPic diff --git a/engine/player_movement.asm b/engine/player_movement.asm index d6d10aea1..83fdf64ba 100755 --- a/engine/player_movement.asm +++ b/engine/player_movement.asm @@ -2,19 +2,19 @@ DoPlayerMovement:: ; 80000 call .GetDPad ld a, movement_step_sleep - ld [MovementAnimation], a + ld [wMovementAnimation], a xor a ld [wd041], a call .TranslateIntoMovement ld c, a - ld a, [MovementAnimation] + ld a, [wMovementAnimation] ld [wPlayerNextMovement], a ret .GetDPad: ld a, [hJoyDown] - ld [CurInput], a + ld [wCurInput], a ; Standing downhill instead moves down. @@ -28,12 +28,12 @@ DoPlayerMovement:: ; 80000 ld a, c or D_DOWN - ld [CurInput], a + ld [wCurInput], a ret ; 8002d .TranslateIntoMovement: - ld a, [PlayerState] + ld a, [wPlayerState] cp PLAYER_NORMAL jr z, .Normal cp PLAYER_SURF @@ -84,7 +84,7 @@ DoPlayerMovement:: ; 80000 ret c call .CheckWarp ret c - ld a, [WalkingDirection] + ld a, [wWalkingDirection] cp STANDING jr z, .HitWall call .BumpSound @@ -94,12 +94,12 @@ DoPlayerMovement:: ; 80000 ret .NotMoving: - ld a, [WalkingDirection] + ld a, [wWalkingDirection] cp STANDING jr z, .Standing ; Walking into an edge warp won't bump. - ld a, [EngineBuffer4] + ld a, [wEngineBuffer4] and a jr nz, .CantMove call .BumpSound @@ -118,7 +118,7 @@ DoPlayerMovement:: ; 80000 ; Tiles such as waterfalls and warps move the player ; in a given direction, overriding input. - ld a, [PlayerStandingTile] + ld a, [wPlayerStandingTile] ld c, a call CheckWhirlpoolTile jr c, .not_whirlpool @@ -146,7 +146,7 @@ DoPlayerMovement:: ; 80000 ld hl, .water_table add hl, bc ld a, [hl] - ld [WalkingDirection], a + ld [wWalkingDirection], a jr .continue_walk .water_table @@ -165,7 +165,7 @@ DoPlayerMovement:: ; 80000 ld a, [hl] cp STANDING jr z, .no_walk - ld [WalkingDirection], a + ld [wWalkingDirection], a jr .continue_walk .land1_table @@ -188,7 +188,7 @@ DoPlayerMovement:: ; 80000 ld a, [hl] cp STANDING jr z, .no_walk - ld [WalkingDirection], a + ld [wWalkingDirection], a jr .continue_walk .land2_table @@ -214,7 +214,7 @@ DoPlayerMovement:: ; 80000 .down ld a, DOWN - ld [WalkingDirection], a + ld [wWalkingDirection], a jr .continue_walk .no_walk @@ -236,12 +236,12 @@ DoPlayerMovement:: ; 80000 ld a, [wPlayerTurningDirection] cp 0 jr nz, .not_turning - ld a, [WalkingDirection] + ld a, [wWalkingDirection] cp STANDING jr z, .not_turning ld e, a - ld a, [PlayerDirection] + ld a, [wPlayerDirection] rrca rrca maskbits NUM_DIRECTIONS @@ -262,7 +262,7 @@ DoPlayerMovement:: ; 80000 .TryStep: ; 8016b ; Surfing actually calls .TrySurf directly instead of passing through here. - ld a, [PlayerState] + ld a, [wPlayerState] cp PLAYER_SURF jr z, .TrySurf cp PLAYER_SURF_PIKA @@ -277,7 +277,7 @@ DoPlayerMovement:: ; 80000 cp 2 jr z, .bump - ld a, [PlayerStandingTile] + ld a, [wPlayerStandingTile] call CheckIceTile jr nc, .ice @@ -289,7 +289,7 @@ DoPlayerMovement:: ; 80000 bit 2, [hl] ; downhill jr z, .fast - ld a, [WalkingDirection] + ld a, [wWalkingDirection] cp DOWN jr z, .fast @@ -362,7 +362,7 @@ DoPlayerMovement:: ; 80000 ; 801f3 .TryJump: ; 801f3 - ld a, [PlayerStandingTile] + ld a, [wPlayerStandingTile] ld e, a and $f0 cp HI_NYBBLE_LEDGES @@ -374,7 +374,7 @@ DoPlayerMovement:: ; 80000 ld d, 0 ld hl, .data_8021e add hl, de - ld a, [FacingDirection] + ld a, [wFacingDirection] and [hl] jr z, .DontJump @@ -408,26 +408,26 @@ DoPlayerMovement:: ; 80000 ; This causes wd041 to be nonzero when standing on tile $3e, ; making bumps silent. - ld a, [WalkingDirection] + ld a, [wWalkingDirection] ; cp STANDING ; jr z, .not_warp ld e, a ld d, 0 ld hl, .EdgeWarps add hl, de - ld a, [PlayerStandingTile] + ld a, [wPlayerStandingTile] cp [hl] jr nz, .not_warp ld a, 1 ld [wd041], a - ld a, [WalkingDirection] + ld a, [wWalkingDirection] ; This is in the wrong place. cp STANDING jr z, .not_warp ld e, a - ld a, [PlayerDirection] + ld a, [wPlayerDirection] rrca rrca maskbits NUM_DIRECTIONS @@ -462,14 +462,14 @@ DoPlayerMovement:: ; 80000 ld h, [hl] ld l, a - ld a, [WalkingDirection] + ld a, [wWalkingDirection] ld e, a cp STANDING jp z, .StandInPlace add hl, de ld a, [hl] - ld [MovementAnimation], a + ld [wMovementAnimation], a ld hl, .FinishFacing add hl, de @@ -535,7 +535,7 @@ DoPlayerMovement:: ; 80000 ld a, 0 ld [wPlayerTurningDirection], a ld a, movement_step_sleep - ld [MovementAnimation], a + ld [wMovementAnimation], a xor a ret ; 802bf @@ -544,7 +544,7 @@ DoPlayerMovement:: ; 80000 ld a, 0 ld [wPlayerTurningDirection], a ld a, movement_step_bump - ld [MovementAnimation], a + ld [wMovementAnimation], a xor a ret ; 802cb @@ -564,10 +564,10 @@ DoPlayerMovement:: ; 80000 ld d, 0 ld hl, .forced_dpad add hl, de - ld a, [CurInput] + ld a, [wCurInput] and BUTTONS or [hl] - ld [CurInput], a + ld [wCurInput], a ret .forced_dpad @@ -579,7 +579,7 @@ DoPlayerMovement:: ; 80000 ld hl, .table ld de, .table2 - .table1 - ld a, [CurInput] + ld a, [wCurInput] bit D_DOWN_F, a jr nz, .d_down bit D_UP_F, a @@ -598,18 +598,18 @@ DoPlayerMovement:: ; 80000 .update ld a, [hli] - ld [WalkingDirection], a + ld [wWalkingDirection], a ld a, [hli] - ld [FacingDirection], a + ld [wFacingDirection], a ld a, [hli] - ld [WalkingX], a + ld [wWalkingX], a ld a, [hli] - ld [WalkingY], a + ld [wWalkingY], a ld a, [hli] ld h, [hl] ld l, a ld a, [hl] - ld [WalkingTile], a + ld [wWalkingTile], a ret .table @@ -621,16 +621,16 @@ DoPlayerMovement:: ; 80000 ; tile collision pointer .table1 db STANDING, FACE_CURRENT, 0, 0 - dw PlayerStandingTile + dw wPlayerStandingTile .table2 db RIGHT, FACE_RIGHT, 1, 0 - dw TileRight + dw wTileRight db LEFT, FACE_LEFT, -1, 0 - dw TileLeft + dw wTileLeft db UP, FACE_UP, 0, -1 - dw TileUp + dw wTileUp db DOWN, FACE_DOWN, 0, 1 - dw TileDown + dw wTileDown ; 80341 .CheckNPC: ; 80341 @@ -640,19 +640,19 @@ DoPlayerMovement:: ; 80000 ld a, 0 ld [hMapObjectIndexBuffer], a ; Load the next X coordinate into d - ld a, [PlayerStandingMapX] + ld a, [wPlayerStandingMapX] ld d, a - ld a, [WalkingX] + ld a, [wWalkingX] add d ld d, a ; Load the next Y coordinate into e - ld a, [PlayerStandingMapY] + ld a, [wPlayerStandingMapY] ld e, a - ld a, [WalkingY] + ld a, [wWalkingY] add e ld e, a ; Find an object struct with coordinates equal to d,e - ld bc, ObjectStructs ; redundant + ld bc, wObjectStructs ; redundant farcall IsNPCAtCoord jr nc, .is_npc call .CheckStrengthBoulder @@ -691,7 +691,7 @@ DoPlayerMovement:: ; 80000 add hl, bc set 2, [hl] - ld a, [WalkingDirection] + ld a, [wWalkingDirection] ld d, a ld hl, OBJECT_RANGE add hl, bc @@ -712,13 +712,13 @@ DoPlayerMovement:: ; 80000 ; Return 0 if walking onto land and tile permissions allow it. ; Otherwise, return carry. - ld a, [TilePermissions] + ld a, [wTilePermissions] ld d, a - ld a, [FacingDirection] + ld a, [wFacingDirection] and d jr nz, .NotWalkable - ld a, [WalkingTile] + ld a, [wWalkingTile] call .CheckWalkable jr c, .NotWalkable @@ -734,13 +734,13 @@ DoPlayerMovement:: ; 80000 ; Return 0 if moving in water, or 1 if moving onto land. ; Otherwise, return carry. - ld a, [TilePermissions] + ld a, [wTilePermissions] ld d, a - ld a, [FacingDirection] + ld a, [wFacingDirection] and d jr nz, .NotSurfable - ld a, [WalkingTile] + ld a, [wWalkingTile] call .CheckSurfable jr c, .NotSurfable @@ -753,7 +753,7 @@ DoPlayerMovement:: ; 80000 ; 803ca .BikeCheck: ; 803ca - ld a, [PlayerState] + ld a, [wPlayerState] cp PLAYER_BIKE ret z cp PLAYER_SKATE @@ -810,7 +810,7 @@ DoPlayerMovement:: ; 80000 .GetOutOfWater: ; 803f9 push bc ld a, PLAYER_NORMAL - ld [PlayerState], a + ld [wPlayerState], a call ReplaceKrisSprite ; UpdateSprites pop bc ret @@ -822,10 +822,10 @@ CheckStandingOnIce:: ; 80404 jr z, .not_ice cp $f0 jr z, .not_ice - ld a, [PlayerStandingTile] + ld a, [wPlayerStandingTile] call CheckIceTile jr nc, .yep - ld a, [PlayerState] + ld a, [wPlayerState] cp PLAYER_SKATE jr nz, .not_ice diff --git a/engine/player_object.asm b/engine/player_object.asm index b630078a2..b16afda5c 100755 --- a/engine/player_object.asm +++ b/engine/player_object.asm @@ -5,11 +5,11 @@ BlankScreen: ; 8000 call ClearBGPalettes call ClearSprites hlcoord 0, 0 - ld bc, TileMapEnd - TileMap + ld bc, wTileMapEnd - wTileMap ld a, " " call ByteFill - hlcoord 0, 0, AttrMap - ld bc, AttrMapEnd - AttrMap + hlcoord 0, 0, wAttrMap + ld bc, wAttrMapEnd - wAttrMap ld a, $7 call ByteFill call WaitBGMap2 @@ -42,10 +42,10 @@ SpawnPlayer: ; 8029 ld [hl], e ld a, $0 ld [hMapObjectIndexBuffer], a - ld bc, MapObjects + ld bc, wMapObjects ld a, $0 ld [hObjectStructIndexBuffer], a - ld de, ObjectStructs + ld de, wObjectStructs call CopyMapObjectToObjectStruct ld a, PLAYER ld [wCenteredObject], a @@ -72,10 +72,10 @@ CopyDECoordsToMapObject:: ; 807e PlayerSpawn_ConvertCoords: ; 808f push bc - ld a, [XCoord] + ld a, [wXCoord] add 4 ld d, a - ld a, [YCoord] + ld a, [wYCoord] add 4 ld e, a pop bc @@ -100,26 +100,26 @@ WriteObjectXY:: ; 80a1 ret RefreshPlayerCoords: ; 80b8 - ld a, [XCoord] + ld a, [wXCoord] add 4 ld d, a - ld hl, PlayerStandingMapX + ld hl, wPlayerStandingMapX sub [hl] ld [hl], d - ld hl, MapObjects + MAPOBJECT_X_COORD + ld hl, wMapObjects + MAPOBJECT_X_COORD ld [hl], d - ld hl, PlayerLastMapX + ld hl, wPlayerLastMapX ld [hl], d ld d, a - ld a, [YCoord] + ld a, [wYCoord] add 4 ld e, a - ld hl, PlayerStandingMapY + ld hl, wPlayerStandingMapY sub [hl] ld [hl], e - ld hl, MapObjects + MAPOBJECT_Y_COORD + ld hl, wMapObjects + MAPOBJECT_Y_COORD ld [hl], e - ld hl, PlayerLastMapY + ld hl, wPlayerLastMapY ld [hl], e ld e, a ld a, [wObjectFollow_Leader] @@ -132,7 +132,7 @@ CopyObjectStruct:: ; 80e7 and a ret nz ; masked - ld hl, ObjectStructs + OBJECT_STRUCT_LENGTH * 1 + ld hl, wObjectStructs + OBJECT_STRUCT_LENGTH * 1 ld a, 1 ld de, OBJECT_STRUCT_LENGTH .loop @@ -152,7 +152,7 @@ CopyObjectStruct:: ; 80e7 ld d, h ld e, l call CopyMapObjectToObjectStruct - ld hl, VramState + ld hl, wVramState bit 7, [hl] ret z @@ -224,7 +224,7 @@ CopyMapObjectToObjectStruct: ; 8116 ret InitializeVisibleSprites: ; 8177 - ld bc, MapObjects + OBJECT_LENGTH + ld bc, wMapObjects + OBJECT_LENGTH ld a, 1 .loop ld [hMapObjectIndexBuffer], a @@ -240,9 +240,9 @@ InitializeVisibleSprites: ; 8177 cp -1 jr nz, .next - ld a, [XCoord] + ld a, [wXCoord] ld d, a - ld a, [YCoord] + ld a, [wYCoord] ld e, a ld hl, MAPOBJECT_X_COORD @@ -300,18 +300,18 @@ CheckObjectEnteringVisibleRange:: ; 81ca dw .Right .Up: ; 81de - ld a, [YCoord] + ld a, [wYCoord] sub 1 jr .Vertical .Down: ; 81e5 - ld a, [YCoord] + ld a, [wYCoord] add 9 .Vertical: ; 81ea ld d, a - ld a, [XCoord] + ld a, [wXCoord] ld e, a - ld bc, MapObjects + OBJECT_LENGTH + ld bc, wMapObjects + OBJECT_LENGTH ld a, 1 .loop_v ld [hMapObjectIndexBuffer], a @@ -356,18 +356,18 @@ CheckObjectEnteringVisibleRange:: ; 81ca ret .Left: ; 8232 - ld a, [XCoord] + ld a, [wXCoord] sub 1 jr .Horizontal .Right: ; 8239 - ld a, [XCoord] + ld a, [wXCoord] add 10 .Horizontal: ; 823e ld e, a - ld a, [YCoord] + ld a, [wYCoord] ld d, a - ld bc, MapObjects + OBJECT_LENGTH + ld bc, wMapObjects + OBJECT_LENGTH ld a, 1 .loop_h ld [hMapObjectIndexBuffer], a @@ -470,7 +470,7 @@ CopyTempObjectToObjectStruct: ; 8286 add hl, de ld [hl], a - ld hl, YCoord + ld hl, wYCoord sub [hl] and $f swap a @@ -488,7 +488,7 @@ CopyTempObjectToObjectStruct: ; 8286 ld hl, OBJECT_NEXT_MAP_X add hl, de ld [hl], a - ld hl, XCoord + ld hl, wXCoord sub [hl] and $f swap a @@ -586,7 +586,7 @@ Special_SurfStartStep: ; 8379 ret .GetMovementData: ; 8388 - ld a, [PlayerDirection] + ld a, [wPlayerDirection] srl a srl a maskbits NUM_DIRECTIONS @@ -656,7 +656,7 @@ FollowNotExact:: ; 839e add hl, de ld [hl], b ld a, b - ld hl, XCoord + ld hl, wXCoord sub [hl] and $f swap a @@ -669,7 +669,7 @@ FollowNotExact:: ; 839e add hl, de ld [hl], c ld a, c - ld hl, YCoord + ld hl, wYCoord sub [hl] and $f swap a diff --git a/engine/player_step.asm b/engine/player_step.asm index 3af41be59..675c6553b 100755 --- a/engine/player_step.asm +++ b/engine/player_step.asm @@ -86,28 +86,28 @@ UpdatePlayerCoords: ; d511 (3:5511) ld a, [wPlayerStepDirection] and a jr nz, .check_step_down - ld hl, YCoord + ld hl, wYCoord inc [hl] ret .check_step_down cp UP jr nz, .check_step_left - ld hl, YCoord + ld hl, wYCoord dec [hl] ret .check_step_left cp LEFT jr nz, .check_step_right - ld hl, XCoord + ld hl, wXCoord dec [hl] ret .check_step_right cp RIGHT ret nz - ld hl, XCoord + ld hl, wXCoord inc [hl] ret @@ -170,7 +170,7 @@ UpdateOverworldMap: ; d536 (3:5536) .Add6ToOverworldMapAnchor: ; d595 (3:5595) ld hl, wOverworldMapAnchor - ld a, [MapWidth] + ld a, [wMapWidth] add 6 add [hl] ld [hli], a @@ -201,7 +201,7 @@ UpdateOverworldMap: ; d536 (3:5536) .Sub6FromOverworldMapAnchor: ; d5c6 (3:55c6) ld hl, wOverworldMapAnchor - ld a, [MapWidth] + ld a, [wMapWidth] add 6 ld b, a ld a, [hl] diff --git a/engine/pokedex/newpokedexentry.asm b/engine/pokedex/newpokedexentry.asm index d6b755200..365cf1b70 100644 --- a/engine/pokedex/newpokedexentry.asm +++ b/engine/pokedex/newpokedexentry.asm @@ -42,9 +42,9 @@ NewPokedexEntry: ; fb877 call WaitBGMap2 farcall GetEnemyMonDVs ld a, [hli] - ld [TempMonDVs], a + ld [wTempMonDVs], a ld a, [hl] - ld [TempMonDVs + 1], a + ld [wTempMonDVs + 1], a ld b, SCGB_TRAINER_OR_MON_FRONTPIC_PALS call GetSGBLayout call SetPalettes diff --git a/engine/pokedex/pokedex.asm b/engine/pokedex/pokedex.asm index e96d0a7d7..04b4a6472 100644 --- a/engine/pokedex/pokedex.asm +++ b/engine/pokedex/pokedex.asm @@ -27,14 +27,14 @@ Pokedex: ; 40000 push hl ld a, [hSCX] push af - ld hl, Options + ld hl, wOptions ld a, [hl] push af set NO_TEXT_SCROLL, [hl] - ld a, [VramState] + ld a, [wVramState] push af xor a - ld [VramState], a + ld [wVramState], a ld a, [hInMenu] push af ld a, $1 @@ -65,9 +65,9 @@ Pokedex: ; 40000 pop af ld [hInMenu], a pop af - ld [VramState], a + ld [wVramState], a pop af - ld [Options], a + ld [wOptions], a pop af ld [hSCX], a pop hl @@ -163,18 +163,18 @@ Pokedex_InitCursorPosition: ; 400b4 ret Pokedex_GetLandmark: ; 400ed - ld a, [MapGroup] + ld a, [wMapGroup] ld b, a - ld a, [MapNumber] + ld a, [wMapNumber] ld c, a call GetWorldMapLocation cp SPECIAL_MAP jr nz, .load - ld a, [BackupMapGroup] + ld a, [wBackupMapGroup] ld b, a - ld a, [BackupMapNumber] + ld a, [wBackupMapNumber] ld c, a call GetWorldMapLocation @@ -220,7 +220,7 @@ Pokedex_InitMainScreen: ; 4013c (10:413c) ld [hBGMapMode], a call ClearSprites xor a - hlcoord 0, 0, AttrMap + hlcoord 0, 0, wAttrMap ld bc, SCREEN_HEIGHT * SCREEN_WIDTH call ByteFill farcall DrawPokedexListWindow @@ -249,7 +249,7 @@ Pokedex_InitMainScreen: ; 4013c (10:413c) call Pokedex_ResetBGMapMode ld a, -1 - ld [CurPartySpecies], a + ld [wCurPartySpecies], a ld a, SCGB_POKEDEX call Pokedex_GetSGBLayout call Pokedex_UpdateCursorOAM @@ -342,10 +342,10 @@ Pokedex_InitDexEntryScreen: ; 40217 (10:4217) ld a, $a7 ld [hWX], a call Pokedex_GetSelectedMon - ld [CurPartySpecies], a + ld [wCurPartySpecies], a ld a, SCGB_POKEDEX call Pokedex_GetSGBLayout - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] call PlayMonCry call Pokedex_IncrementDexPointer ret @@ -372,11 +372,11 @@ Pokedex_UpdateDexEntryScreen: ; 40258 (10:4258) jp hl .return_to_prev_screen - ld a, [LastVolume] + ld a, [wLastVolume] and a jr z, .max_volume ld a, $77 - ld [LastVolume], a + ld [wLastVolume], a .max_volume call MaxVolume @@ -411,10 +411,10 @@ Pokedex_ReinitDexEntryScreen: ; 402aa (10:42aa) call Pokedex_LoadSelectedMonTiles call WaitBGMap call Pokedex_GetSelectedMon - ld [CurPartySpecies], a + ld [wCurPartySpecies], a ld a, SCGB_POKEDEX call Pokedex_GetSGBLayout - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] call PlayMonCry ld hl, wJumptableIndex dec [hl] @@ -460,7 +460,7 @@ DexEntryScreen_MenuActionJumptable: ; 402f2 call Pokedex_LoadSelectedMonTiles call WaitBGMap call Pokedex_GetSelectedMon - ld [CurPartySpecies], a + ld [wCurPartySpecies], a ld a, SCGB_POKEDEX call Pokedex_GetSGBLayout ret @@ -720,7 +720,7 @@ Pokedex_InitSearchResultsScreen: ; 4050a (10:450a) xor a ld [hBGMapMode], a xor a - hlcoord 0, 0, AttrMap + hlcoord 0, 0, wAttrMap ld bc, SCREEN_WIDTH * SCREEN_HEIGHT call ByteFill call Pokedex_SetBGMapMode4 @@ -745,7 +745,7 @@ Pokedex_InitSearchResultsScreen: ; 4050a (10:450a) call Pokedex_PlaceSearchResultsTypeStrings call Pokedex_UpdateSearchResultsCursorOAM ld a, -1 - ld [CurPartySpecies], a + ld [wCurPartySpecies], a ld a, SCGB_POKEDEX call Pokedex_GetSGBLayout call Pokedex_IncrementDexPointer @@ -1088,8 +1088,8 @@ Pokedex_DrawMainScreenBG: ; 4074c (10:474c) hlcoord 1, 11 ld de, String_SEEN call Pokedex_PlaceString - ld hl, PokedexSeen - ld b, EndPokedexSeen - PokedexSeen + ld hl, wPokedexSeen + ld b, wEndPokedexSeen - wPokedexSeen call CountSetBits ld de, wd265 hlcoord 5, 12 @@ -1098,8 +1098,8 @@ Pokedex_DrawMainScreenBG: ; 4074c (10:474c) hlcoord 1, 14 ld de, String_OWN call Pokedex_PlaceString - ld hl, PokedexCaught - ld b, EndPokedexCaught - PokedexCaught + ld hl, wPokedexCaught + ld b, wEndPokedexCaught - wPokedexCaught call CountSetBits ld de, wd265 hlcoord 5, 15 @@ -1322,7 +1322,7 @@ Pokedex_DrawUnownModeBG: ; 409f1 (10:49f1) ld b, 0 ld c, 26 .loop - ld hl, UnownDex + ld hl, wUnownDex add hl, de ld a, [hl] and a @@ -1911,7 +1911,7 @@ Pokedex_SearchForMons: ; 41086 and a jr z, .next_mon ld [wd265], a - ld [CurSpecies], a + ld [wCurSpecies], a call Pokedex_CheckCaught jr z, .next_mon push hl @@ -1921,10 +1921,10 @@ Pokedex_SearchForMons: ; 41086 pop hl ld a, [wDexConvertedMonType] ld b, a - ld a, [BaseType1] + ld a, [wBaseType1] cp b jr z, .match_found - ld a, [BaseType2] + ld a, [wBaseType2] cp b jr nz, .next_mon @@ -2117,7 +2117,7 @@ Pokedex_UpdateSearchResultsCursorOAM: ; 41281 (10:5281) db -1 Pokedex_LoadCursorOAM: ; 412f1 (10:52f1) - ld de, Sprite01 + ld de, wVirtualOAMSprite00 .loop ld a, [hl] cp -1 @@ -2366,9 +2366,9 @@ Pokedex_LoadSelectedMonTiles: ; 4143b call Pokedex_CheckSeen jr z, .QuestionMark ld a, [wFirstUnownSeen] - ld [UnownLetter], a + ld [wUnownLetter], a ld a, [wd265] - ld [CurPartySpecies], a + ld [wCurPartySpecies], a call GetBaseData ld de, vTiles2 predef GetMonFrontpic @@ -2511,22 +2511,22 @@ Pokedex_LoadUnownFont: ; 41a2c ret Pokedex_LoadUnownFrontpicTiles: ; 41a58 (10:5a58) - ld a, [UnownLetter] + ld a, [wUnownLetter] push af ld a, [wDexCurrentUnownIndex] ld e, a ld d, 0 - ld hl, UnownDex + ld hl, wUnownDex add hl, de ld a, [hl] - ld [UnownLetter], a + ld [wUnownLetter], a ld a, UNOWN - ld [CurPartySpecies], a + ld [wCurPartySpecies], a call GetBaseData ld de, vTiles2 tile $00 predef GetMonFrontpic pop af - ld [UnownLetter], a + ld [wUnownLetter], a ret _NewPokedexEntry: ; 41a7f @@ -2540,7 +2540,7 @@ _NewPokedexEntry: ; 41a7f call Pokedex_LoadGFX call Pokedex_LoadAnyFootprint ld a, [wd265] - ld [CurPartySpecies], a + ld [wCurPartySpecies], a call Pokedex_DrawDexEntryScreenBG call Pokedex_DrawFootprint hlcoord 0, 17 @@ -2557,7 +2557,7 @@ _NewPokedexEntry: ; 41a7f predef GetMonFrontpic ld a, SCGB_POKEDEX call Pokedex_GetSGBLayout - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] call PlayMonCry ret diff --git a/engine/pokedex/pokedex_2.asm b/engine/pokedex/pokedex_2.asm index 4dd608ac0..a467fe02c 100644 --- a/engine/pokedex/pokedex_2.asm +++ b/engine/pokedex/pokedex_2.asm @@ -41,7 +41,7 @@ AnimateDexSearchSlowpoke: ; 441cf DoDexSearchSlowpokeFrame: ; 44207 ld a, [wDexSearchSlowpokeFrame] ld hl, .SlowpokeSpriteData - ld de, Sprite01 + ld de, wVirtualOAMSprite00 .loop ld a, [hli] cp -1 @@ -107,8 +107,8 @@ DisplayDexEntry: ; 4424d pop bc ret z ; Get the height of the Pokemon. - ld a, [CurPartySpecies] - ld [CurSpecies], a + ld a, [wCurPartySpecies] + ld [wCurSpecies], a inc hl ld a, b push af diff --git a/engine/pokedex/pokedex_3.asm b/engine/pokedex/pokedex_3.asm index dc52f83d3..f5247f2da 100644 --- a/engine/pokedex/pokedex_3.asm +++ b/engine/pokedex/pokedex_3.asm @@ -140,7 +140,7 @@ DrawDexEntryScreenRightEdge: ; 1de247 ld [hl], $3c xor a ld b, SCREEN_HEIGHT - hlcoord 19, 0, AttrMap + hlcoord 19, 0, wAttrMap call Bank77_FillColumn call WaitBGMap2 pop hl diff --git a/engine/pokedex/unown_dex.asm b/engine/pokedex/unown_dex.asm index dc6db9dc6..cc3d4a273 100755 --- a/engine/pokedex/unown_dex.asm +++ b/engine/pokedex/unown_dex.asm @@ -1,8 +1,8 @@ UpdateUnownDex: ; fba18 - ld a, [UnownLetter] + ld a, [wUnownLetter] ld c, a ld b, NUM_UNOWN - ld hl, UnownDex + ld hl, wUnownDex .loop ld a, [hli] and a @@ -27,7 +27,7 @@ PrintUnownWord: ; fba2e (3e:7a2e) ld a, [wDexCurrentUnownIndex] ld e, a ld d, 0 - ld hl, UnownDex + ld hl, wUnownDex add hl, de ld a, [hl] ld e, a diff --git a/engine/pokegear.asm b/engine/pokegear.asm index f65f394be..ea2afdc78 100755 --- a/engine/pokegear.asm +++ b/engine/pokegear.asm @@ -23,7 +23,7 @@ NUM_POKEGEAR_CARDS EQU const_value const POKEGEARSTATE_RADIOJOYPAD ; c PokeGear: ; 90b8d (24:4b8d) - ld hl, Options + ld hl, wOptions ld a, [hl] push af set NO_TEXT_SCROLL, [hl] @@ -31,10 +31,10 @@ PokeGear: ; 90b8d (24:4b8d) push af ld a, $1 ld [hInMenu], a - ld a, [VramState] + ld a, [wVramState] push af xor a - ld [VramState], a + ld [wVramState], a call .InitTilemap call DelayFrame .loop @@ -53,11 +53,11 @@ PokeGear: ; 90b8d (24:4b8d) call PlaySFX call WaitSFX pop af - ld [VramState], a + ld [wVramState], a pop af ld [hInMenu], a pop af - ld [Options], a + ld [wOptions], a call ClearBGPalettes xor a ; LOW(vBGMap0) ld [hBGMapAddress], a @@ -123,9 +123,9 @@ Pokegear_LoadGFX: ; 90c4e ld de, vTiles0 ld a, BANK(PokegearSpritesGFX) call Decompress - ld a, [MapGroup] + ld a, [wMapGroup] ld b, a - ld a, [MapNumber] + ld a, [wMapNumber] ld c, a call GetWorldMapLocation cp FAST_SHIP @@ -194,16 +194,16 @@ AnimatePokegearModeIndicatorArrow: ; 90d41 (24:4d41) ; 90d56 TownMap_GetCurrentLandmark: ; 90d56 - ld a, [MapGroup] + ld a, [wMapGroup] ld b, a - ld a, [MapNumber] + ld a, [wMapNumber] ld c, a call GetWorldMapLocation cp SPECIAL_MAP ret nz - ld a, [BackupMapGroup] + ld a, [wBackupMapGroup] ld b, a - ld a, [BackupMapNumber] + ld a, [wBackupMapNumber] ld c, a call GetWorldMapLocation ret @@ -211,18 +211,18 @@ TownMap_GetCurrentLandmark: ; 90d56 ; 90d70 TownMap_InitCursorAndPlayerIconPositions: ; 90d70 (24:4d70) - ld a, [MapGroup] + ld a, [wMapGroup] ld b, a - ld a, [MapNumber] + ld a, [wMapNumber] ld c, a call GetWorldMapLocation cp FAST_SHIP jr z, .FastShip cp SPECIAL_MAP jr nz, .LoadLandmark - ld a, [BackupMapGroup] + ld a, [wBackupMapGroup] ld b, a - ld a, [BackupMapNumber] + ld a, [wBackupMapNumber] ld c, a call GetWorldMapLocation .LoadLandmark: @@ -247,7 +247,7 @@ InitPokegearTilemap: ; 90da8 (24:4da8) xor a ld [hBGMapMode], a hlcoord 0, 0 - ld bc, TileMapEnd - TileMap + ld bc, SCREEN_WIDTH * SCREEN_HEIGHT ld a, $4f call ByteFill ld a, [wPokegearCard] @@ -929,7 +929,7 @@ PokegearPhone_MakePhoneCall: ; 911eb (24:51eb) call GetMapPhoneService and a jr nz, .no_service - ld hl, Options + ld hl, wOptions res NO_TEXT_SCROLL, [hl] xor a ld [hInMenu], a @@ -948,7 +948,7 @@ PokegearPhone_MakePhoneCall: ; 911eb (24:51eb) call Function90199 ld c, 10 call DelayFrames - ld hl, Options + ld hl, wOptions set NO_TEXT_SCROLL, [hl] ld a, $1 ld [hInMenu], a @@ -1384,8 +1384,8 @@ ExitPokegearRadio_HandleMusic: ; 91492 ; 914ab DeleteSpriteAnimStruct2ToEnd: ; 914ab (24:54ab) - ld hl, SpriteAnim2 - ld bc, wSpriteAnimationStructsEnd - SpriteAnim2 + ld hl, wSpriteAnim2 + ld bc, wSpriteAnimationStructsEnd - wSpriteAnim2 xor a call ByteFill ld a, 2 @@ -1560,7 +1560,7 @@ RadioChannels: ; Oak's Pokémon Talk in the afternoon and evening call .InJohto jr nc, .NoSignal - ld a, [TimeOfDay] + ld a, [wTimeOfDay] and a jp z, LoadStation_PokedexShow jp LoadStation_OaksPokemonTalk @@ -1858,7 +1858,7 @@ PokeFluteStationName: db "# FLUTE@" ; 9191c _TownMap: ; 9191c - ld hl, Options + ld hl, wOptions ld a, [hl] push af set NO_TEXT_SCROLL, [hl] @@ -1868,10 +1868,10 @@ _TownMap: ; 9191c ld a, $1 ld [hInMenu], a - ld a, [VramState] + ld a, [wVramState] push af xor a - ld [VramState], a + ld [wVramState], a call ClearBGPalettes call ClearTileMap @@ -1923,11 +1923,11 @@ _TownMap: ; 9191c .resume pop af - ld [VramState], a + ld [wVramState], a pop af ld [hInMenu], a pop af - ld [Options], a + ld [wOptions], a call ClearBGPalettes ret @@ -2028,7 +2028,7 @@ _TownMap: ; 9191c ; 91a53 PlayRadio: ; 91a53 - ld hl, Options + ld hl, wOptions ld a, [hl] push af set NO_TEXT_SCROLL, [hl] @@ -2054,7 +2054,7 @@ PlayRadio: ; 91a53 .stop pop af - ld [Options], a + ld [wOptions], a call ExitPokegearRadio_HandleMusic ret @@ -2111,7 +2111,7 @@ PlayRadio: ; 91a53 and a jr nz, .kanto call UpdateTime - ld a, [TimeOfDay] + ld a, [wTimeOfDay] and a jp z, LoadStation_PokedexShow jp LoadStation_OaksPokemonTalk @@ -2202,9 +2202,9 @@ _FlyMap: ; 91af3 ; 91b73 FlyMapScroll: ; 91b73 - ld a, [StartFlypoint] + ld a, [wStartFlypoint] ld e, a - ld a, [EndFlypoint] + ld a, [wEndFlypoint] ld d, a ld hl, hJoyLast ld a, [hl] @@ -2308,7 +2308,7 @@ TownMapBubble: ; 91bb5 ld e, [hl] farcall GetLandmarkName hlcoord 2, 1 - ld de, StringBuffer1 + ld de, wStringBuffer1 call PlaceString ret @@ -2376,18 +2376,18 @@ ret_91c8f: ; 91c8f ; 91c90 FlyMap: ; 91c90 - ld a, [MapGroup] + ld a, [wMapGroup] ld b, a - ld a, [MapNumber] + ld a, [wMapNumber] ld c, a call GetWorldMapLocation ; If we're not in a valid location, i.e. Pokecenter floor 2F, ; the backup map information is used. cp SPECIAL_MAP jr nz, .CheckRegion - ld a, [BackupMapGroup] + ld a, [wBackupMapGroup] ld b, a - ld a, [BackupMapNumber] + ld a, [wBackupMapNumber] ld c, a call GetWorldMapLocation .CheckRegion: @@ -2401,10 +2401,10 @@ FlyMap: ; 91c90 ld a, FLY_NEW_BARK ld [wTownMapPlayerIconLandmark], a ; Flypoints begin at New Bark Town... - ld [StartFlypoint], a + ld [wStartFlypoint], a ; ..and end at Silver Cave. ld a, FLY_MT_SILVER - ld [EndFlypoint], a + ld [wEndFlypoint], a ; Fill out the map call FillJohtoMap call .MapHud @@ -2430,10 +2430,10 @@ FlyMap: ; 91c90 ; Flypoints begin at Pallet Town... ld a, FLY_PALLET - ld [StartFlypoint], a + ld [wStartFlypoint], a ; ...and end at Indigo Plateau ld a, FLY_INDIGO - ld [EndFlypoint], a + ld [wEndFlypoint], a ; Because Indigo Plateau is the first flypoint the player ; visits, it's made the default flypoint. ld [wTownMapPlayerIconLandmark], a @@ -2451,10 +2451,10 @@ FlyMap: ; 91c90 ld a, FLY_NEW_BARK ld [wTownMapPlayerIconLandmark], a ; Flypoints begin at New Bark Town... - ld [StartFlypoint], a + ld [wStartFlypoint], a ; ..and end at Silver Cave ld a, FLY_MT_SILVER - ld [EndFlypoint], a + ld [wEndFlypoint], a call FillJohtoMap pop af .MapHud: @@ -2588,8 +2588,8 @@ Pokedex_GetArea: ; 91d11 .copy_sprites hlcoord 0, 0 - ld de, Sprites - ld bc, SpritesEnd - Sprites + ld de, wVirtualOAM + ld bc, wVirtualOAMEnd - wVirtualOAM call CopyBytes ret @@ -2625,9 +2625,9 @@ Pokedex_GetArea: ; 91d11 .GetAndPlaceNest: ; 91e1e ld [wTownMapCursorLandmark], a ld e, a - farcall FindNest ; load nest landmarks into TileMap[0,0] + farcall FindNest ; load nest landmarks into wTileMap[0,0] decoord 0, 0 - ld hl, Sprite01 + ld hl, wVirtualOAMSprite00 .nestloop ld a, [de] and a @@ -2654,9 +2654,9 @@ Pokedex_GetArea: ; 91d11 jr .nestloop .done_nest - ld hl, Sprites + ld hl, wVirtualOAM decoord 0, 0 - ld bc, SpritesEnd - Sprites + ld bc, wVirtualOAMEnd - wVirtualOAM call CopyBytes ret @@ -2671,7 +2671,7 @@ Pokedex_GetArea: ; 91d11 ld c, e ld b, d ld de, .PlayerOAM - ld hl, Sprite01 + ld hl, wVirtualOAMSprite00 .ShowPlayerLoop: ld a, [de] cp $80 @@ -2700,8 +2700,8 @@ Pokedex_GetArea: ; 91d11 jr .ShowPlayerLoop .clear_oam - ld hl, Sprite05 - ld bc, SpritesEnd - Sprite05 + ld hl, wVirtualOAMSprite04 + ld bc, wVirtualOAMEnd - wVirtualOAMSprite04 xor a call ByteFill ret @@ -2741,8 +2741,8 @@ Pokedex_GetArea: ; 91d11 ret .clear - ld hl, Sprites - ld bc, SpritesEnd - Sprites + ld hl, wVirtualOAM + ld bc, wVirtualOAMEnd - wVirtualOAM xor a call ByteFill scf @@ -2816,7 +2816,7 @@ FillTownMap: ; 91f07 TownMapPals: ; 91f13 ; Assign palettes based on tile ids hlcoord 0, 0 - decoord 0, 0, AttrMap + decoord 0, 0, wAttrMap ld bc, SCREEN_WIDTH * SCREEN_HEIGHT .loop ; Current tile @@ -2872,8 +2872,8 @@ TownMapMon: ; 91f7b ; Draw the FlyMon icon at town map location ; Get FlyMon species - ld a, [CurPartyMon] - ld hl, PartySpecies + ld a, [wCurPartyMon] + ld hl, wPartySpecies ld e, a ld d, $0 add hl, de diff --git a/engine/predef.asm b/engine/predef.asm index 6c8c2c5f2..13c593c90 100644 --- a/engine/predef.asm +++ b/engine/predef.asm @@ -1,14 +1,14 @@ GetPredefPointer:: ; 854b -; Return the bank and address of PredefID in a and PredefAddress. +; Return the bank and address of wPredefID in a and wPredefAddress. ; Save hl for later (back in Predef) ld a, h - ld [PredefTemp], a + ld [wPredefTemp], a ld a, l - ld [PredefTemp + 1], a + ld [wPredefTemp + 1], a push de - ld a, [PredefID] + ld a, [wPredefID] ld e, a ld d, 0 ld hl, PredefPointers @@ -18,9 +18,9 @@ GetPredefPointer:: ; 854b pop de ld a, [hli] - ld [PredefAddress + 1], a + ld [wPredefAddress + 1], a ld a, [hli] - ld [PredefAddress], a + ld [wPredefAddress], a ld a, [hl] ret diff --git a/engine/print_party.asm b/engine/print_party.asm index 7c23528f3..5fe0e28c0 100755 --- a/engine/print_party.asm +++ b/engine/print_party.asm @@ -158,25 +158,25 @@ PrintPartyMonPage1: ; 1dc381 call Get2bpp xor a - ld [MonType], a + ld [wMonType], a farcall CopyPkmnToTempMon hlcoord 0, 7 ld b, 9 ld c, 18 call TextBox hlcoord 8, 2 - ld a, [TempMonLevel] + ld a, [wTempMonLevel] call PrintLevel_Force3Digits hlcoord 12, 2 ld [hl], PRINTPARTY_HP inc hl - ld de, TempMonMaxHP + ld de, wTempMonMaxHP lb bc, 2, 3 call PrintNum - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] ld [wd265], a - ld [CurSpecies], a - ld hl, PartyMonNicknames + ld [wCurSpecies], a + ld hl, wPartyMonNicknames call Function1dc50e hlcoord 8, 4 call PlaceString @@ -196,7 +196,7 @@ PrintPartyMonPage1: ; 1dc381 hlcoord 1, 9 ld de, String1dc550 call PlaceString - ld hl, PartyMonOT + ld hl, wPartyMonOT call Function1dc50e hlcoord 4, 9 call PlaceString @@ -204,22 +204,22 @@ PrintPartyMonPage1: ; 1dc381 ld de, String1dc559 call PlaceString hlcoord 4, 11 - ld de, TempMonID + ld de, wTempMonID lb bc, PRINTNUM_LEADINGZEROS | 2, 5 call PrintNum hlcoord 1, 14 ld de, String1dc554 call PlaceString hlcoord 7, 14 - ld a, [TempMonMoves + 0] + ld a, [wTempMonMoves + 0] call Function1dc51a call Function1dc52c - ld hl, TempMonDVs + ld hl, wTempMonDVs predef GetUnownLetter ld hl, wBoxAlignment xor a ld [hl], a - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] cp UNOWN jr z, .asm_1dc469 inc [hl] @@ -242,7 +242,7 @@ PrintPartyMonPage2: ; 1dc47b ld [hBGMapMode], a call LoadFontsBattleExtra xor a - ld [MonType], a + ld [wMonType], a farcall CopyPkmnToTempMon hlcoord 0, 0 ld b, 15 @@ -253,31 +253,31 @@ PrintPartyMonPage2: ; 1dc47b hlcoord 0, 1 call CopyBytes hlcoord 7, 0 - ld a, [TempMonMoves + 1] + ld a, [wTempMonMoves + 1] call Function1dc51a hlcoord 7, 2 - ld a, [TempMonMoves + 2] + ld a, [wTempMonMoves + 2] call Function1dc51a hlcoord 7, 4 - ld a, [TempMonMoves + 3] + ld a, [wTempMonMoves + 3] call Function1dc51a hlcoord 7, 7 ld de, String1dc55d call PlaceString hlcoord 16, 7 - ld de, TempMonAttack + ld de, wTempMonAttack call .PrintTempMonStats hlcoord 16, 9 - ld de, TempMonDefense + ld de, wTempMonDefense call .PrintTempMonStats hlcoord 16, 11 - ld de, TempMonSpclAtk + ld de, wTempMonSpclAtk call .PrintTempMonStats hlcoord 16, 13 - ld de, TempMonSpclDef + ld de, wTempMonSpclDef call .PrintTempMonStats hlcoord 16, 15 - ld de, TempMonSpeed + ld de, wTempMonSpeed call .PrintTempMonStats call WaitBGMap ld b, SCGB_STATS_SCREEN_HP_PALS @@ -294,7 +294,7 @@ PrintPartyMonPage2: ; 1dc47b Function1dc50e: ; 1dc50e ld bc, NAME_LENGTH - ld a, [CurPartyMon] + ld a, [wCurPartyMon] call AddNTimes ld e, l ld d, h @@ -328,7 +328,7 @@ Function1dc52c: ; 1dc52c .got_gender hlcoord 17, 2 ld [hl], a - ld bc, TempMonDVs + ld bc, wTempMonDVs farcall CheckShininess ret nc hlcoord 18, 2 diff --git a/engine/printer.asm b/engine/printer.asm index 4479d5d0b..b9e55ef2a 100755 --- a/engine/printer.asm +++ b/engine/printer.asm @@ -751,7 +751,7 @@ Printer_PrintBoxListSegment: ; 848e7 (21:48e7) cp $ff jp z, .finish ld [wd265], a - ld [CurPartySpecies], a + ld [wCurPartySpecies], a push bc push hl @@ -769,7 +769,7 @@ Printer_PrintBoxListSegment: ; 848e7 (21:48e7) push hl call PlaceString - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] cp EGG pop hl jr z, .ok2 @@ -850,16 +850,16 @@ Printer_GetMonGender: ; 8498a (21:498a) ld bc, BOXMON_STRUCT_LENGTH ld a, [wWhichBoxMonToPrint] call AddNTimes - ld de, TempMonDVs + ld de, wTempMonDVs ld a, [hli] ld [de], a inc de ld a, [hli] ld [de], a ld a, [wWhichBoxMonToPrint] - ld [CurPartyMon], a + ld [wCurPartyMon], a ld a, TEMPMON - ld [MonType], a + ld [wMonType], a farcall GetGender ld a, " " jr c, .got_gender diff --git a/engine/printer_serial.asm b/engine/printer_serial.asm index 02d0595fa..4e0d10851 100755 --- a/engine/printer_serial.asm +++ b/engine/printer_serial.asm @@ -9,7 +9,7 @@ Printer_StartTransmission: ; 84000 ld [wPrinterOpcode], a ld hl, wPrinterConnectionOpen set 0, [hl] - ld a, [GBPrinter] + ld a, [wGBPrinter] ld [wGBPrinterSettings], a xor a ld [wJumptableIndex], a diff --git a/engine/radio.asm b/engine/radio.asm index df0d81679..e6ee257ee 100644 --- a/engine/radio.asm +++ b/engine/radio.asm @@ -269,9 +269,9 @@ endr ld a, BANK(JohtoGrassWildMons) call GetFarByte ld [wNamedObjectIndexBuffer], a - ld [CurPartySpecies], a + ld [wCurPartySpecies], a call GetPokemonName - ld hl, StringBuffer1 + ld hl, wStringBuffer1 ld de, wMonOrItemNameBuffer ld bc, MON_NAME_LENGTH call CopyBytes @@ -335,7 +335,7 @@ OPT_OakText3: db "@" OaksPkmnTalk7: - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] ld [wNamedObjectIndexBuffer], a call GetPokemonName ld hl, OPT_MaryText1 @@ -688,7 +688,7 @@ ClearBottomLine: PokedexShow_GetDexEntryBank: push hl push de - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] dec a rlca rlca @@ -722,7 +722,7 @@ PokedexShow1: jr z, .loop inc c ld a, c - ld [CurPartySpecies], a + ld [wCurPartySpecies], a ld [wNamedObjectIndexBuffer], a call GetPokemonName ld hl, PokedexShowText @@ -730,7 +730,7 @@ PokedexShow1: jp NextRadioLine PokedexShow2: - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] dec a ld hl, PokedexDataPointerTable ld c, a @@ -1011,12 +1011,12 @@ LuckyNumberShow7: jp NextRadioLine LuckyNumberShow8: - ld hl, StringBuffer1 + ld hl, wStringBuffer1 ld de, wLuckyIDNumber lb bc, PRINTNUM_LEADINGZEROS | 2, 5 call PrintNum ld a, "@" - ld [StringBuffer1 + 5], a + ld [wStringBuffer1 + 5], a ld hl, LC_Text8 ld a, LUCKY_NUMBER_SHOW_9 jp NextRadioLine @@ -1188,7 +1188,7 @@ PeoplePlaces4: ; People jr c, PeoplePlaces4 push bc callfar GetTrainerClassName - ld de, StringBuffer1 + ld de, wStringBuffer1 call CopyName1 pop bc ld b, 1 @@ -1669,16 +1669,16 @@ GetBuenasPassword: jr nz, .read_loop dec c jr nz, .read_loop -; ... and copy it into StringBuffer1. +; ... and copy it into wStringBuffer1. .skip - ld hl, StringBuffer1 + ld hl, wStringBuffer1 .copy_loop ld a, [de] inc de ld [hli], a cp "@" jr nz, .copy_loop - ld de, StringBuffer1 + ld de, wStringBuffer1 ret INCLUDE "data/radio/buenas_passwords.asm" diff --git a/engine/routines/checktime.asm b/engine/routines/checktime.asm index ada151dbf..4c7d033ff 100644 --- a/engine/routines/checktime.asm +++ b/engine/routines/checktime.asm @@ -1,5 +1,5 @@ CheckTime:: ; c000 - ld a, [TimeOfDay] + ld a, [wTimeOfDay] ld hl, .TimeOfDayTable ld de, 2 call IsInArray diff --git a/engine/routines/correcterrorsinplayerparty.asm b/engine/routines/correcterrorsinplayerparty.asm index 42e550900..5f2bba6bc 100644 --- a/engine/routines/correcterrorsinplayerparty.asm +++ b/engine/routines/correcterrorsinplayerparty.asm @@ -1,5 +1,5 @@ Unreferenced_CorrectErrorsInPlayerParty: - ld hl, PartyCount + ld hl, wPartyCount ld a, [hl] and a ret z @@ -27,7 +27,7 @@ Unreferenced_CorrectErrorsInPlayerParty: push hl push bc ld a, c - ld hl, PartyMon1Species + ld hl, wPartyMon1Species call GetPartyLocation ld [hl], SMEARGLE pop bc @@ -40,8 +40,8 @@ Unreferenced_CorrectErrorsInPlayerParty: jr nz, .loop1 ld [hl], $ff - ld hl, PartyMon1 - ld a, [PartyCount] + ld hl, wPartyMon1 + ld a, [wPartyCount] ld d, a ld e, 0 .loop2 @@ -59,14 +59,14 @@ Unreferenced_CorrectErrorsInPlayerParty: ld [hl], SMEARGLE push de ld d, 0 - ld hl, PartySpecies + ld hl, wPartySpecies add hl, de pop de ld a, SMEARGLE ld [hl], a .check_level - ld [CurSpecies], a + ld [wCurSpecies], a call GetBaseData ld hl, MON_LEVEL add hl, bc @@ -81,7 +81,7 @@ Unreferenced_CorrectErrorsInPlayerParty: .invalid_level ld [hl], a .load_level - ld [CurPartyLevel], a + ld [wCurPartyLevel], a ld hl, MON_MAXHP add hl, bc @@ -99,8 +99,8 @@ Unreferenced_CorrectErrorsInPlayerParty: dec d jr nz, .loop2 - ld de, PartyMonNicknames - ld a, [PartyCount] + ld de, wPartyMonNicknames + ld a, [wPartyCount] ld b, a ld c, 0 .loop3 @@ -114,7 +114,7 @@ Unreferenced_CorrectErrorsInPlayerParty: push bc push hl - ld hl, PartySpecies + ld hl, wPartySpecies push bc ld b, 0 add hl, bc @@ -125,7 +125,7 @@ Unreferenced_CorrectErrorsInPlayerParty: jr z, .got_nickname ld [wd265], a call GetPokemonName - ld hl, StringBuffer1 + ld hl, wStringBuffer1 .got_nickname pop de ld bc, MON_NAME_LENGTH @@ -137,8 +137,8 @@ Unreferenced_CorrectErrorsInPlayerParty: dec b jr nz, .loop3 - ld de, PartyMonOT - ld a, [PartyCount] + ld de, wPartyMonOT + ld a, [wPartyCount] ld b, a ld c, 0 .loop4 @@ -150,7 +150,7 @@ Unreferenced_CorrectErrorsInPlayerParty: jr nc, .valid_ot_name ld d, h ld e, l - ld hl, PlayerName + ld hl, wPlayerName ld bc, NAME_LENGTH call CopyBytes .valid_ot_name @@ -159,8 +159,8 @@ Unreferenced_CorrectErrorsInPlayerParty: dec b jr nz, .loop4 - ld hl, PartyMon1Moves - ld a, [PartyCount] + ld hl, wPartyMon1Moves + ld a, [wPartyCount] ld b, a .loop5 push hl diff --git a/engine/routines/getbreedmonlevelgrowth.asm b/engine/routines/getbreedmonlevelgrowth.asm index b029043d6..dc22db798 100644 --- a/engine/routines/getbreedmonlevelgrowth.asm +++ b/engine/routines/getbreedmonlevelgrowth.asm @@ -1,6 +1,6 @@ GetBreedMon1LevelGrowth: ; e698 ld hl, wBreedMon1Stats - ld de, TempMon + ld de, wTempMon ld bc, BOXMON_STRUCT_LENGTH call CopyBytes callfar CalcLevel @@ -14,7 +14,7 @@ GetBreedMon1LevelGrowth: ; e698 GetBreedMon2LevelGrowth: ; e6b3 ld hl, wBreedMon2Stats - ld de, TempMon + ld de, wTempMon ld bc, BOXMON_STRUCT_LENGTH call CopyBytes callfar CalcLevel diff --git a/engine/routines/initlist.asm b/engine/routines/initlist.asm index b7260e552..26c77b5bb 100644 --- a/engine/routines/initlist.asm +++ b/engine/routines/initlist.asm @@ -3,23 +3,23 @@ InitList: ; 50db9 cp INIT_ENEMYOT_LIST jr nz, .check_party_ot_name - ld hl, OTPartyCount - ld de, OTPartyMonOT + ld hl, wOTPartyCount + ld de, wOTPartyMonOT ld a, ENEMY_OT_NAME jr .done .check_party_ot_name cp INIT_PLAYEROT_LIST jr nz, .check_mon_name - ld hl, PartyCount - ld de, PartyMonOT + ld hl, wPartyCount + ld de, wPartyMonOT ld a, PARTY_OT_NAME jr .done .check_mon_name cp INIT_MON_LIST jr nz, .check_item_name - ld hl, CurMart + ld hl, wCurMart ld de, PokemonNames ld a, MON_NAME jr .done @@ -27,13 +27,13 @@ InitList: ; 50db9 .check_item_name cp INIT_BAG_ITEM_LIST jr nz, .check_ob_item_name - ld hl, NumItems + ld hl, wNumItems ld de, ItemNames ld a, ITEM_NAME jr .done .check_ob_item_name - ld hl, CurMart + ld hl, wCurMart ld de, ItemNames ld a, ITEM_NAME .done diff --git a/engine/routines/leveluphappinessmod.asm b/engine/routines/leveluphappinessmod.asm index c253e8872..8c6dd92fe 100644 --- a/engine/routines/leveluphappinessmod.asm +++ b/engine/routines/leveluphappinessmod.asm @@ -1,13 +1,13 @@ LevelUpHappinessMod: ; 2709e - ld a, [CurPartyMon] - ld hl, PartyMon1CaughtLocation + ld a, [wCurPartyMon] + ld hl, wPartyMon1CaughtLocation call GetPartyLocation ld a, [hl] and $7f ld d, a - ld a, [MapGroup] + ld a, [wMapGroup] ld b, a - ld a, [MapNumber] + ld a, [wMapNumber] ld c, a call GetWorldMapLocation cp d diff --git a/engine/routines/loadpushoam.asm b/engine/routines/loadpushoam.asm index c07c06d0f..95f67ff73 100644 --- a/engine/routines/loadpushoam.asm +++ b/engine/routines/loadpushoam.asm @@ -1,5 +1,5 @@ -LoadPushOAM:: ; 4031 - ld c, hPushOAM - $ff00 +WriteOAMDMACodeToHRAM:: ; 4031 + ld c, hTransferVirtualOAM - $ff00 ld b, .PushOAMEnd - .PushOAM ld hl, .PushOAM .loop @@ -11,7 +11,7 @@ LoadPushOAM:: ; 4031 ret .PushOAM: ; 403f - ld a, HIGH(Sprites) + ld a, HIGH(wVirtualOAM) ld [rDMA], a ld a, NUM_SPRITE_OAM_STRUCTS .pushoam_loop diff --git a/engine/routines/phonering_copytilemapatonce.asm b/engine/routines/phonering_copytilemapatonce.asm index cefe9a66d..b0d4ffa1e 100644 --- a/engine/routines/phonering_copytilemapatonce.asm +++ b/engine/routines/phonering_copytilemapatonce.asm @@ -23,7 +23,7 @@ PhoneRing_CopyTilemapAtOnce: ; 4d188 di ld a, BANK(vBGMap2) ld [rVBK], a - hlcoord 0, 0, AttrMap + hlcoord 0, 0, wAttrMap call .CopyTilemapAtOnce ld a, BANK(vBGMap0) ld [rVBK], a diff --git a/engine/routines/playslowcry.asm b/engine/routines/playslowcry.asm index 545629e51..1dc6c78ac 100644 --- a/engine/routines/playslowcry.asm +++ b/engine/routines/playslowcry.asm @@ -1,28 +1,28 @@ Special_PlaySlowCry: ; fb841 - ld a, [ScriptVar] + ld a, [wScriptVar] call LoadCry jr c, .done - ld hl, CryPitch + ld hl, wCryPitch ld a, [hli] ld h, [hl] ld l, a ld bc, -$140 add hl, bc ld a, l - ld [CryPitch], a + ld [wCryPitch], a ld a, h - ld [CryPitch + 1], a - ld hl, CryLength + ld [wCryPitch + 1], a + ld hl, wCryLength ld a, [hli] ld h, [hl] ld l, a ld bc, $60 add hl, bc ld a, l - ld [CryLength], a + ld [wCryLength], a ld a, h - ld [CryLength + 1], a + ld [wCryLength + 1], a farcall _PlayCry call WaitSFX diff --git a/engine/routines/printitemdescription.asm b/engine/routines/printitemdescription.asm index e6d087dae..2a9007b97 100644 --- a/engine/routines/printitemdescription.asm +++ b/engine/routines/printitemdescription.asm @@ -1,23 +1,23 @@ PrintItemDescription: ; 0x1c8955 -; Print the description for item [CurSpecies] at de. +; Print the description for item [wCurSpecies] at de. - ld a, [CurSpecies] + ld a, [wCurSpecies] cp TM01 jr c, .not_a_tm - ld [CurItem], a + ld [wCurItem], a push de farcall GetTMHMItemMove pop hl ld a, [wd265] - ld [CurSpecies], a + ld [wCurSpecies], a predef PrintMoveDesc ret .not_a_tm push de ld hl, ItemDescriptions - ld a, [CurSpecies] + ld a, [wCurSpecies] dec a ld c, a ld b, 0 diff --git a/engine/routines/savemenu_copytilemapatonce.asm b/engine/routines/savemenu_copytilemapatonce.asm index 5d4ed8b7d..9b50494a4 100644 --- a/engine/routines/savemenu_copytilemapatonce.asm +++ b/engine/routines/savemenu_copytilemapatonce.asm @@ -20,7 +20,7 @@ SaveMenu_CopyTilemapAtOnce: ; 4cf45 (13:4f45) di ld a, BANK(vBGMap2) ld [rVBK], a - hlcoord 0, 0, AttrMap + hlcoord 0, 0, wAttrMap call .CopyTilemapAtOnce ld a, BANK(vBGMap0) ld [rVBK], a diff --git a/engine/routines/switchpartymons.asm b/engine/routines/switchpartymons.asm index 1379dff9c..b01178417 100644 --- a/engine/routines/switchpartymons.asm +++ b/engine/routines/switchpartymons.asm @@ -1,17 +1,17 @@ _SwitchPartyMons: ld a, [wd0e3] dec a - ld [Buffer3], a + ld [wBuffer3], a ld b, a ld a, [wMenuCursorY] dec a - ld [Buffer2], a + ld [wBuffer2], a cp b jr z, .skip call .SwapMonAndMail - ld a, [Buffer3] + ld a, [wBuffer3] call .ClearSprite - ld a, [Buffer2] + ld a, [wBuffer2] call .ClearSprite .skip ret @@ -25,7 +25,7 @@ _SwitchPartyMons: ld a, " " call ByteFill pop af - ld hl, Sprite01 + ld hl, wVirtualOAMSprite00 ld bc, 4 * SPRITEOAMSTRUCT_LENGTH call AddNTimes ld de, SPRITEOAMSTRUCT_LENGTH @@ -43,14 +43,14 @@ _SwitchPartyMons: push hl push de push bc - ld bc, PartySpecies - ld a, [Buffer2] + ld bc, wPartySpecies + ld a, [wBuffer2] ld l, a ld h, $0 add hl, bc ld d, h ld e, l - ld a, [Buffer3] + ld a, [wBuffer3] ld l, a ld h, $0 add hl, bc @@ -60,16 +60,16 @@ _SwitchPartyMons: ld [hl], a pop af ld [de], a - ld a, [Buffer2] - ld hl, PartyMon1Species + ld a, [wBuffer2] + ld hl, wPartyMon1Species ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes push hl ld de, wd002 ld bc, PARTYMON_STRUCT_LENGTH call CopyBytes - ld a, [Buffer3] - ld hl, PartyMon1 + ld a, [wBuffer3] + ld hl, wPartyMon1 ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes pop de @@ -80,13 +80,13 @@ _SwitchPartyMons: ld hl, wd002 ld bc, PARTYMON_STRUCT_LENGTH call CopyBytes - ld a, [Buffer2] - ld hl, PartyMonOT + ld a, [wBuffer2] + ld hl, wPartyMonOT call SkipNames push hl call .CopyNameTowd002 - ld a, [Buffer3] - ld hl, PartyMonOT + ld a, [wBuffer3] + ld hl, wPartyMonOT call SkipNames pop de push hl @@ -94,13 +94,13 @@ _SwitchPartyMons: pop de ld hl, wd002 call .CopyName - ld hl, PartyMonNicknames - ld a, [Buffer2] + ld hl, wPartyMonNicknames + ld a, [wBuffer2] call SkipNames push hl call .CopyNameTowd002 - ld hl, PartyMonNicknames - ld a, [Buffer3] + ld hl, wPartyMonNicknames + ld a, [wBuffer3] call SkipNames pop de push hl @@ -109,7 +109,7 @@ _SwitchPartyMons: ld hl, wd002 call .CopyName ld hl, sPartyMail - ld a, [Buffer2] + ld a, [wBuffer2] ld bc, MAIL_STRUCT_LENGTH call AddNTimes push hl @@ -119,7 +119,7 @@ _SwitchPartyMons: call GetSRAMBank call CopyBytes ld hl, sPartyMail - ld a, [Buffer3] + ld a, [wBuffer3] ld bc, MAIL_STRUCT_LENGTH call AddNTimes pop de diff --git a/engine/routines/townmap_convertlinebreakcharacters.asm b/engine/routines/townmap_convertlinebreakcharacters.asm index f08b436c9..6ccd79aae 100644 --- a/engine/routines/townmap_convertlinebreakcharacters.asm +++ b/engine/routines/townmap_convertlinebreakcharacters.asm @@ -1,5 +1,5 @@ TownMap_ConvertLineBreakCharacters: ; 1de2c5 - ld hl, StringBuffer1 + ld hl, wStringBuffer1 .loop ld a, [hl] cp "@" @@ -15,7 +15,7 @@ TownMap_ConvertLineBreakCharacters: ; 1de2c5 ld [hl], "<LNBRK>" .end - ld de, StringBuffer1 + ld de, wStringBuffer1 hlcoord 9, 0 call PlaceString ret diff --git a/engine/routines/trademonfrontpic.asm b/engine/routines/trademonfrontpic.asm index e9611553b..d5f7b55de 100644 --- a/engine/routines/trademonfrontpic.asm +++ b/engine/routines/trademonfrontpic.asm @@ -6,8 +6,8 @@ GetTrademonFrontpic: ; 4d7fd push af predef GetUnownLetter pop af - ld [CurPartySpecies], a - ld [CurSpecies], a + ld [wCurPartySpecies], a + ld [wCurSpecies], a call GetBaseData pop de predef GetAnimatedFrontpic @@ -19,18 +19,18 @@ AnimateTrademonFrontpic: ; 4d81e ret c farcall ShowOTTrademonStats ld a, [wOTTrademonSpecies] - ld [CurPartySpecies], a + ld [wCurPartySpecies], a ld a, [wOTTrademonDVs] - ld [TempMonDVs], a + ld [wTempMonDVs], a ld a, [wOTTrademonDVs + 1] - ld [TempMonDVs + 1], a + ld [wTempMonDVs + 1], a ld b, SCGB_PLAYER_OR_MON_FRONTPIC_PALS call GetSGBLayout ld a, %11100100 ; 3,2,1,0 call DmgToCgbBGPals farcall TradeAnim_ShowGetmonFrontpic ld a, [wOTTrademonSpecies] - ld [CurPartySpecies], a + ld [wCurPartySpecies], a hlcoord 7, 2 ld d, $0 ld e, ANIM_MON_TRADE diff --git a/engine/routines/unreferenced_getgen1trainerclassname.asm b/engine/routines/unreferenced_getgen1trainerclassname.asm index 64c55ed84..66c80172d 100644 --- a/engine/routines/unreferenced_getgen1trainerclassname.asm +++ b/engine/routines/unreferenced_getgen1trainerclassname.asm @@ -1,6 +1,6 @@ Unreferenced_GetGen1TrainerClassName: ; 50a28 ld hl, Gen1TrainerClassNames - ld a, [TrainerClass] + ld a, [wTrainerClass] dec a ld c, a ld b, 0 @@ -9,7 +9,7 @@ Unreferenced_GetGen1TrainerClassName: ; 50a28 ld a, [hli] ld h, [hl] ld l, a - ld de, StringBuffer1 + ld de, wStringBuffer1 .copy ld a, [hli] ld [de], a diff --git a/engine/routines/updateitemdescription.asm b/engine/routines/updateitemdescription.asm index b684dd4d8..fdb1e864d 100644 --- a/engine/routines/updateitemdescription.asm +++ b/engine/routines/updateitemdescription.asm @@ -1,11 +1,11 @@ UpdateItemDescription: ; 0x244c3 - ld a, [MenuSelection] - ld [CurSpecies], a + ld a, [wMenuSelection] + ld [wCurSpecies], a hlcoord 0, 12 ld b, 4 ld c, SCREEN_WIDTH - 2 call TextBox - ld a, [MenuSelection] + ld a, [wMenuSelection] cp -1 ret z decoord 1, 14 diff --git a/engine/rtc.asm b/engine/rtc.asm index 571de9284..37e24c1ed 100755 --- a/engine/rtc.asm +++ b/engine/rtc.asm @@ -44,7 +44,7 @@ GetTimeOfDay:: ; 14032 ; get time of day inc hl ld a, [hl] - ld [TimeOfDay], a + ld [wTimeOfDay], a ret ; 14044 @@ -68,7 +68,7 @@ Unreferenced_1404e: StageRTCTimeForSave: ; 14056 call UpdateTime ld hl, wRTC - ld a, [CurDay] + ld a, [wCurDay] ld [hli], a ld a, [hHours] ld [hli], a @@ -138,7 +138,7 @@ Function140ae: ; 140ae call UpdateTime ld a, [wRTC + 0] ld b, a - ld a, [CurDay] + ld a, [wCurDay] cp b jr c, .dont_update @@ -166,9 +166,9 @@ _InitTime:: ; 140ed call GetClock call FixDays ld hl, hRTCSeconds - ld de, StartSecond + ld de, wStartSecond - ld a, [StringBuffer2 + 3] + ld a, [wStringBuffer2 + 3] sub [hl] dec hl jr nc, .okay_secs @@ -177,7 +177,7 @@ _InitTime:: ; 140ed ld [de], a dec de - ld a, [StringBuffer2 + 2] + ld a, [wStringBuffer2 + 2] sbc [hl] dec hl jr nc, .okay_mins @@ -186,7 +186,7 @@ _InitTime:: ; 140ed ld [de], a dec de - ld a, [StringBuffer2 + 1] + ld a, [wStringBuffer2 + 1] sbc [hl] dec hl jr nc, .okay_hrs @@ -195,7 +195,7 @@ _InitTime:: ; 140ed ld [de], a dec de - ld a, [StringBuffer2] + ld a, [wStringBuffer2] sbc [hl] dec hl jr nc, .okay_days diff --git a/engine/save.asm b/engine/save.asm index 4291754e9..c519e50ad 100644 --- a/engine/save.asm +++ b/engine/save.asm @@ -165,7 +165,7 @@ AddHallOfFameEntry: ; 14b5f ld a, c or b jr nz, .loop - ld hl, OverworldMap + ld hl, wOverworldMap ld de, sHallOfFame ld bc, HOF_LENGTH call CopyBytes @@ -226,15 +226,15 @@ SaveTheGame_yesorno: ; 14baf CompareLoadedAndSavedPlayerID: ; 14bcb ld a, BANK(sPlayerData) call GetSRAMBank - ld hl, sPlayerData + (PlayerID - wPlayerData) + ld hl, sPlayerData + (wPlayerID - wPlayerData) ld a, [hli] ld c, [hl] ld b, a call CloseSRAM - ld a, [PlayerID] + ld a, [wPlayerID] cp b ret nz - ld a, [PlayerID + 1] + ld a, [wPlayerID + 1] cp c ret ; 14be3 @@ -247,17 +247,17 @@ SavedTheGame: ; 14be6 ld c, $20 call DelayFrames ; copy the original text speed setting to the stack - ld a, [Options] + ld a, [wOptions] push af ; set text speed super slow ld a, 3 - ld [Options], a + ld [wOptions], a ; <PLAYER> saved the game! ld hl, Text_PlayerSavedTheGame call PrintText ; restore the original text speed setting pop af - ld [Options], a + ld [wOptions], a ld de, SFX_SAVE call WaitPlaySFX call WaitSFX @@ -332,7 +332,7 @@ UpdateStackTop: ; 14c6b FindStackTop: ; 14c90 ; Find the furthest point that sp has traversed to. ; This is distinct from the current value of sp. - ld hl, Stack - $ff + ld hl, wStack - $ff .loop ld a, [hl] or a @@ -349,17 +349,17 @@ SavingDontTurnOffThePower: ; 14c99 ld [hJoypadSum], a ld [hJoypadDown], a ; Save the text speed setting to the stack - ld a, [Options] + ld a, [wOptions] push af ; Set the text speed to super slow ld a, $3 - ld [Options], a + ld [wOptions], a ; SAVING... DON'T TURN OFF THE POWER. ld hl, Text_SavingDontTurnOffThePower call PrintText ; Restore the text speed setting pop af - ld [Options], a + ld [wOptions], a ; Wait for 16 frames ld c, $10 call DelayFrames @@ -508,11 +508,11 @@ ValidateSave: ; 14da9 SaveOptions: ; 14dbb ld a, BANK(sOptions) call GetSRAMBank - ld hl, Options + ld hl, wOptions ld de, sOptions - ld bc, OptionsEnd - Options + ld bc, wOptionsEnd - wOptions call CopyBytes - ld a, [Options] + ld a, [wOptions] and $ff ^ (1 << NO_TEXT_SCROLL) ld [sOptions], a jp CloseSRAM @@ -577,9 +577,9 @@ ValidateBackupSave: ; 14e2d SaveBackupOptions: ; 14e40 ld a, BANK(sBackupOptions) call GetSRAMBank - ld hl, Options + ld hl, wOptions ld de, sBackupOptions - ld bc, OptionsEnd - Options + ld bc, wOptionsEnd - wOptions call CopyBytes call CloseSRAM ret @@ -661,14 +661,14 @@ TryLoadSaveFile: ; 14ea5 (5:4ea5) ret .corrupt - ld a, [Options] + ld a, [wOptions] push af set NO_TEXT_SCROLL, a - ld [Options], a + ld [wOptions], a ld hl, Text_SaveFileCorrupted call PrintText pop af - ld [Options], a + ld [wOptions], a scf ret @@ -683,8 +683,8 @@ TryLoadSaveData: ; 14f1c ld a, BANK(sPlayerData) call GetSRAMBank - ld hl, sPlayerData + StartDay - wPlayerData - ld de, StartDay + ld hl, sPlayerData + wStartDay - wPlayerData + ld de, wStartDay ld bc, 8 call CopyBytes ld hl, sPlayerData + wStatusFlags - wPlayerData @@ -702,8 +702,8 @@ TryLoadSaveData: ; 14f1c ld a, BANK(sBackupPlayerData) call GetSRAMBank - ld hl, sBackupPlayerData + StartDay - wPlayerData - ld de, StartDay + ld hl, sBackupPlayerData + wStartDay - wPlayerData + ld de, wStartDay ld bc, 8 call CopyBytes ld hl, sBackupPlayerData + wStatusFlags - wPlayerData @@ -715,8 +715,8 @@ TryLoadSaveData: ; 14f1c .corrupt ld hl, DefaultOptions - ld de, Options - ld bc, OptionsEnd - Options + ld de, wOptions + ld bc, wOptionsEnd - wOptions call CopyBytes call PanicResetClock ret @@ -736,8 +736,8 @@ CheckPrimarySaveFile: ; 14f84 cp SAVE_CHECK_VALUE_2 jr nz, .nope ld hl, sOptions - ld de, Options - ld bc, OptionsEnd - Options + ld de, wOptions + ld bc, wOptionsEnd - wOptions call CopyBytes call CloseSRAM ld a, $1 @@ -758,8 +758,8 @@ CheckBackupSaveFile: ; 14faf cp SAVE_CHECK_VALUE_2 jr nz, .nope ld hl, sBackupOptions - ld de, Options - ld bc, OptionsEnd - Options + ld de, wOptions + ld bc, wOptionsEnd - wOptions call CopyBytes ld a, $2 ld [wSaveFileExists], a @@ -882,7 +882,7 @@ _SaveData: ; 1509a call CopyBytes ; This block originally had some mobile functionality, but since we're still in - ; BANK(sCrystalData), it instead overwrites the sixteen EventFlags starting at 1:a603 with + ; BANK(sCrystalData), it instead overwrites the sixteen wEventFlags starting at 1:a603 with ; garbage from wd479. This isn't an issue, since ErasePreviousSave is followed by a regular ; save that unwrites the garbage. @@ -904,7 +904,7 @@ _LoadData: ; 150b9 call CopyBytes ; This block originally had some mobile functionality to mirror _SaveData above, but instead it - ; (harmlessly) writes the aforementioned EventFlags to the unused wd479. + ; (harmlessly) writes the aforementioned wEventFlags to the unused wd479. ld hl, wd479 ld a, [$a60e + 0] diff --git a/engine/scripting.asm b/engine/scripting.asm index 84590f3c0..dd2cfffe8 100644 --- a/engine/scripting.asm +++ b/engine/scripting.asm @@ -4,14 +4,14 @@ EnableScriptMode:: push af ld a, SCRIPT_READ - ld [ScriptMode], a + ld [wScriptMode], a pop af ret ScriptEvents:: call StartScript .loop - ld a, [ScriptMode] + ld a, [wScriptMode] ld hl, .modes rst JumpTable call CheckScript @@ -31,28 +31,28 @@ EndScript: WaitScript: call StopScript - ld hl, ScriptDelay + ld hl, wScriptDelay dec [hl] ret nz farcall Function58b9 ld a, SCRIPT_READ - ld [ScriptMode], a + ld [wScriptMode], a call StartScript ret WaitScriptMovement: call StopScript - ld hl, VramState + ld hl, wVramState bit 7, [hl] ret nz farcall Function58b9 ld a, SCRIPT_READ - ld [ScriptMode], a + ld [wScriptMode], a call StartScript ret @@ -239,17 +239,17 @@ endc dw Script_check_save ; a9 StartScript: - ld hl, ScriptFlags + ld hl, wScriptFlags set SCRIPT_RUNNING, [hl] ret CheckScript: - ld hl, ScriptFlags + ld hl, wScriptFlags bit SCRIPT_RUNNING, [hl] ret StopScript: - ld hl, ScriptFlags + ld hl, wScriptFlags res SCRIPT_RUNNING, [hl] ret @@ -299,7 +299,7 @@ Script_jumptextfaceplayer: ; script command 0x51 ; parameters: text_pointer - ld a, [ScriptBank] + ld a, [wScriptBank] ld [wScriptTextBank], a call GetScriptByte ld [wScriptTextAddr], a @@ -313,7 +313,7 @@ Script_jumptext: ; script command 0x53 ; parameters: text_pointer - ld a, [ScriptBank] + ld a, [wScriptBank] ld [wScriptTextBank], a call GetScriptByte ld [wScriptTextAddr], a @@ -360,7 +360,7 @@ Script_writetext: ld l, a call GetScriptByte ld h, a - ld a, [ScriptBank] + ld a, [wScriptBank] ld b, a call MapTextbox ret @@ -429,7 +429,7 @@ Script_yesorno: jr c, .no ld a, TRUE .no - ld [ScriptVar], a + ld [wScriptVar], a ret Script_loadmenudata: @@ -441,7 +441,7 @@ Script_loadmenudata: call GetScriptByte ld h, a ld de, LoadMenuDataHeader - ld a, [ScriptBank] + ld a, [wScriptBank] call Call_a_de call UpdateSprites ret @@ -460,9 +460,9 @@ Script_pokepic: call GetScriptByte and a jr nz, .ok - ld a, [ScriptVar] + ld a, [wScriptVar] .ok - ld [CurPartySpecies], a + ld [wCurPartySpecies], a farcall Pokepic ret @@ -475,27 +475,27 @@ Script_closepokepic: Script_verticalmenu: ; script command 0x59 - ld a, [ScriptBank] + ld a, [wScriptBank] ld hl, VerticalMenu rst FarCall ld a, [wMenuCursorY] jr nc, .ok xor a .ok - ld [ScriptVar], a + ld [wScriptVar], a ret Script__2dmenu: ; script command 0x58 - ld a, [ScriptBank] + ld a, [wScriptBank] ld hl, _2DMenu rst FarCall ld a, [wMenuCursorBuffer] jr nc, .ok xor a .ok - ld [ScriptVar], a + ld [wScriptVar], a ret Script_battletowertext: @@ -514,7 +514,7 @@ Script_verbosegiveitem: call Script_giveitem call CurItemName - ld de, StringBuffer1 + ld de, wStringBuffer1 ld a, 1 call CopyConvertedText ld b, BANK(GiveItemScript) @@ -552,22 +552,22 @@ Script_verbosegiveitem2: call GetScriptByte cp -1 jr nz, .ok - ld a, [ScriptVar] + ld a, [wScriptVar] .ok - ld [CurItem], a + ld [wCurItem], a call GetScriptByte call GetVarAction ld a, [de] ld [wItemQuantityChangeBuffer], a - ld hl, NumItems + ld hl, wNumItems call ReceiveItem ld a, TRUE jr c, .ok2 xor a .ok2 - ld [ScriptVar], a + ld [wScriptVar], a call CurItemName - ld de, StringBuffer1 + ld de, wStringBuffer1 ld a, 1 call CopyConvertedText ld b, BANK(GiveItemScript) @@ -622,7 +622,7 @@ GetPocketName: ld a, [hli] ld d, [hl] ld e, a - ld hl, StringBuffer3 + ld hl, wStringBuffer3 call CopyName2 ret @@ -642,7 +642,7 @@ GetPocketName: db "TM POCKET@" CurItemName: - ld a, [CurItem] + ld a, [wCurItem] ld [wd265], a call GetItemName ret @@ -667,7 +667,7 @@ Script_pokemart: ld e, a call GetScriptByte ld d, a - ld a, [ScriptBank] + ld a, [wScriptBank] ld b, a farcall OpenMartDialog ret @@ -677,17 +677,17 @@ Script_elevator: ; parameters: floor_list_pointer xor a - ld [ScriptVar], a + ld [wScriptVar], a call GetScriptByte ld e, a call GetScriptByte ld d, a - ld a, [ScriptBank] + ld a, [wScriptBank] ld b, a farcall Elevator ret c ld a, TRUE - ld [ScriptVar], a + ld [wScriptVar], a ret Script_trade: @@ -707,7 +707,7 @@ Script_phonecall: ld e, a call GetScriptByte ld d, a - ld a, [ScriptBank] + ld a, [wScriptBank] ld b, a farcall PhoneCall ret @@ -737,7 +737,7 @@ Script_askforphonenumber: call GetScriptByte ld a, PHONE_CONTACT_REFUSED .done - ld [ScriptVar], a + ld [wScriptVar], a ret Script_describedecoration: @@ -756,7 +756,7 @@ Script_fruittree: ; parameters: tree_id call GetScriptByte - ld [CurFruitTree], a + ld [wCurFruitTree], a ld b, BANK(FruitTreeScript) ld hl, FruitTreeScript jp ScriptJump @@ -781,13 +781,13 @@ Script_trainertext: call GetScriptByte ld c, a ld b, 0 - ld hl, WalkingX + ld hl, wWalkingX add hl, bc add hl, bc ld a, [hli] ld h, [hl] ld l, a - ld a, [EngineBuffer1] + ld a, [wEngineBuffer1] ld b, a call MapTextbox ret @@ -799,7 +799,7 @@ Script_scripttalkafter: ld a, [hli] ld h, [hl] ld l, a - ld a, [EngineBuffer1] + ld a, [wEngineBuffer1] ld b, a jp ScriptJump @@ -808,7 +808,7 @@ Script_trainerflagaction: ; parameters: action xor a - ld [ScriptVar], a + ld [wScriptVar], a ld hl, wd041 ld e, [hl] inc hl @@ -820,7 +820,7 @@ Script_trainerflagaction: and a ret z ld a, TRUE - ld [ScriptVar], a + ld [wScriptVar], a ret Script_winlosstext: @@ -851,18 +851,18 @@ Script_check_just_battled: ; script command 0x67 ld a, TRUE - ld [ScriptVar], a + ld [wScriptVar], a ld a, [wRunningTrainerBattleScript] and a ret nz xor a - ld [ScriptVar], a + ld [wScriptVar], a ret Script_encountermusic: ; script command 0x80 - ld a, [OtherTrainerClass] + ld a, [wOtherTrainerClass] ld e, a farcall PlayTrainerEncounterMusic ret @@ -880,7 +880,7 @@ Script_playmusic: ld de, MUSIC_NONE call PlayMusic xor a - ld [MusicFade], a + ld [wMusicFade], a call MaxVolume call GetScriptByte ld e, a @@ -894,12 +894,12 @@ Script_musicfadeout: ; parameters: music, fadetime call GetScriptByte - ld [MusicFadeID], a + ld [wMusicFadeID], a call GetScriptByte - ld [MusicFadeID + 1], a + ld [wMusicFadeID + 1], a call GetScriptByte and $ff ^ (1 << MUSIC_FADE_IN_F) - ld [MusicFade], a + ld [wMusicFade], a ret Script_playsound: @@ -936,7 +936,7 @@ Script_cry: pop af and a jr nz, .ok - ld a, [ScriptVar] + ld a, [wScriptVar] .ok call PlayMonCry ret @@ -980,13 +980,13 @@ ApplyMovement: ld l, a call GetScriptByte ld h, a - ld a, [ScriptBank] + ld a, [wScriptBank] ld b, a call GetMovementData ret c ld a, SCRIPT_WAIT_MOVEMENT - ld [ScriptMode], a + ld [wScriptMode], a call StopScript ret @@ -1089,7 +1089,7 @@ ApplyObjectFacing: pop de ld a, e call SetSpriteDirection - ld hl, VramState + ld hl, wVramState bit 6, [hl] jr nz, .text_state call .DisableTextTiles @@ -1122,7 +1122,7 @@ Script_variablesprite: call GetScriptByte ld e, a ld d, $0 - ld hl, VariableSprites + ld hl, wVariableSprites add hl, de call GetScriptByte ld [hl], a @@ -1246,7 +1246,7 @@ Script_loademote: call GetScriptByte cp -1 jr nz, .not_var_emote - ld a, [ScriptVar] + ld a, [wScriptVar] .not_var_emote ld c, a farcall LoadEmote @@ -1257,7 +1257,7 @@ Script_showemote: ; parameters: bubble, object_id, time call GetScriptByte - ld [ScriptVar], a + ld [wScriptVar], a call GetScriptByte call GetScriptObject cp LAST_TALKED @@ -1265,7 +1265,7 @@ Script_showemote: ld [hLastTalked], a .ok call GetScriptByte - ld [ScriptDelay], a + ld [wScriptDelay], a ld b, BANK(ShowEmoteScript) ld de, ShowEmoteScript jp ScriptCall @@ -1319,9 +1319,9 @@ Script_loadpikachudata: ; script command 0x5a ld a, PIKACHU - ld [TempWildMonSpecies], a + ld [wTempWildMonSpecies], a ld a, 5 - ld [CurPartyLevel], a + ld [wCurPartyLevel], a ret Script_randomwildmon: @@ -1337,9 +1337,9 @@ Script_loadmemtrainer: ld a, (1 << 7) | 1 ld [wBattleScriptFlags], a ld a, [wTempTrainerClass] - ld [OtherTrainerClass], a + ld [wOtherTrainerClass], a ld a, [wTempTrainerID] - ld [OtherTrainerID], a + ld [wOtherTrainerID], a ret Script_loadwildmon: @@ -1349,9 +1349,9 @@ Script_loadwildmon: ld a, (1 << 7) ld [wBattleScriptFlags], a call GetScriptByte - ld [TempWildMonSpecies], a + ld [wTempWildMonSpecies], a call GetScriptByte - ld [CurPartyLevel], a + ld [wCurPartyLevel], a ret Script_loadtrainer: @@ -1361,9 +1361,9 @@ Script_loadtrainer: ld a, (1 << 7) | 1 ld [wBattleScriptFlags], a call GetScriptByte - ld [OtherTrainerClass], a + ld [wOtherTrainerClass], a call GetScriptByte - ld [OtherTrainerID], a + ld [wOtherTrainerID], a ret Script_startbattle: @@ -1373,7 +1373,7 @@ Script_startbattle: predef StartBattle ld a, [wBattleResult] and $3f - ld [ScriptVar], a + ld [wScriptVar], a ret Script_catchtutorial: @@ -1381,7 +1381,7 @@ Script_catchtutorial: ; parameters: byte call GetScriptByte - ld [BattleType], a + ld [wBattleType], a call BufferScreen farcall CatchTutorial jp Script_reloadmap @@ -1432,7 +1432,7 @@ Script_scall: ; script command 0x0 ; parameters: pointer - ld a, [ScriptBank] + ld a, [wScriptBank] ld b, a call GetScriptByte ld e, a @@ -1471,7 +1471,7 @@ ScriptCall: ; Bug: The script stack has a capacity of 5 scripts, yet there is ; nothing to stop you from pushing a sixth script. The high part ; of the script address can then be overwritten by modifications -; to ScriptDelay, causing the script to return to the rst/interrupt +; to wScriptDelay, causing the script to return to the rst/interrupt ; space. push de @@ -1484,24 +1484,24 @@ ScriptCall: add hl, de add hl, de pop de - ld a, [ScriptBank] + ld a, [wScriptBank] ld [hli], a - ld a, [ScriptPos] + ld a, [wScriptPos] ld [hli], a - ld a, [ScriptPos + 1] + ld a, [wScriptPos + 1] ld [hl], a ld a, b - ld [ScriptBank], a + ld [wScriptBank], a ld a, e - ld [ScriptPos], a + ld [wScriptPos], a ld a, d - ld [ScriptPos + 1], a + ld [wScriptPos + 1], a ret CallCallback:: - ld a, [ScriptBank] + ld a, [wScriptBank] or $80 - ld [ScriptBank], a + ld [wScriptBank], a jp ScriptCall Script_jump: @@ -1512,7 +1512,7 @@ Script_jump: ld l, a call GetScriptByte ld h, a - ld a, [ScriptBank] + ld a, [wScriptBank] ld b, a jp ScriptJump @@ -1547,7 +1547,7 @@ Script_iffalse: ; script command 0x8 ; parameters: pointer - ld a, [ScriptVar] + ld a, [wScriptVar] and a jp nz, SkipTwoScriptBytes jp Script_jump @@ -1556,7 +1556,7 @@ Script_iftrue: ; script command 0x9 ; parameters: pointer - ld a, [ScriptVar] + ld a, [wScriptVar] and a jp nz, Script_jump jp SkipTwoScriptBytes @@ -1566,7 +1566,7 @@ Script_if_equal: ; parameters: byte, pointer call GetScriptByte - ld hl, ScriptVar + ld hl, wScriptVar cp [hl] jr z, Script_jump jr SkipTwoScriptBytes @@ -1576,7 +1576,7 @@ Script_if_not_equal: ; parameters: byte, pointer call GetScriptByte - ld hl, ScriptVar + ld hl, wScriptVar cp [hl] jr nz, Script_jump jr SkipTwoScriptBytes @@ -1585,7 +1585,7 @@ Script_if_greater_than: ; script command 0xa ; parameters: byte, pointer - ld a, [ScriptVar] + ld a, [wScriptVar] ld b, a call GetScriptByte cp b @@ -1598,7 +1598,7 @@ Script_if_less_than: call GetScriptByte ld b, a - ld a, [ScriptVar] + ld a, [wScriptVar] cp b jr c, Script_jump jr SkipTwoScriptBytes @@ -1643,24 +1643,24 @@ SkipTwoScriptBytes: ScriptJump: ld a, b - ld [ScriptBank], a + ld [wScriptBank], a ld a, l - ld [ScriptPos], a + ld [wScriptPos], a ld a, h - ld [ScriptPos + 1], a + ld [wScriptPos + 1], a ret Script_priorityjump: ; script command 0x8d ; parameters: pointer - ld a, [ScriptBank] + ld a, [wScriptBank] ld [wPriorityScriptBank], a call GetScriptByte ld [wPriorityScriptAddr], a call GetScriptByte ld [wPriorityScriptAddr + 1], a - ld hl, ScriptFlags + ld hl, wScriptFlags set 3, [hl] ret @@ -1669,12 +1669,12 @@ Script_checkscene: call CheckScenes jr z, .no_scene - ld [ScriptVar], a + ld [wScriptVar], a ret .no_scene ld a, $ff - ld [ScriptVar], a + ld [wScriptVar], a ret Script_checkmapscene: @@ -1690,21 +1690,21 @@ Script_checkmapscene: or e jr z, .no_scene ld a, [de] - ld [ScriptVar], a + ld [wScriptVar], a ret .no_scene ld a, $ff - ld [ScriptVar], a + ld [wScriptVar], a ret Script_setscene: ; script command 0x14 ; parameters: scene_id - ld a, [MapGroup] + ld a, [wMapGroup] ld b, a - ld a, [MapNumber] + ld a, [wMapNumber] ld c, a jr DoScene @@ -1735,7 +1735,7 @@ Script_copybytetovar: call GetScriptByte ld h, a ld a, [hl] - ld [ScriptVar], a + ld [wScriptVar], a ret Script_copyvartobyte: @@ -1746,7 +1746,7 @@ Script_copyvartobyte: ld l, a call GetScriptByte ld h, a - ld a, [ScriptVar] + ld a, [wScriptVar] ld [hl], a ret @@ -1767,7 +1767,7 @@ Script_writebyte: ; parameters: value call GetScriptByte - ld [ScriptVar], a + ld [wScriptVar], a ret Script_addvar: @@ -1775,7 +1775,7 @@ Script_addvar: ; parameters: value call GetScriptByte - ld hl, ScriptVar + ld hl, wScriptVar add [hl] ld [hl], a ret @@ -1785,7 +1785,7 @@ Script_random: ; parameters: input call GetScriptByte - ld [ScriptVar], a + ld [wScriptVar], a and a ret z @@ -1814,11 +1814,11 @@ Script_random: .finish push af - ld a, [ScriptVar] + ld a, [wScriptVar] ld c, a pop af call SimpleDivide - ld [ScriptVar], a + ld [wScriptVar], a ret .Divide256byC: @@ -1840,7 +1840,7 @@ Script_checkcode: call GetScriptByte call GetVarAction ld a, [de] - ld [ScriptVar], a + ld [wScriptVar], a ret Script_writevarcode: @@ -1849,7 +1849,7 @@ Script_writevarcode: call GetScriptByte call GetVarAction - ld a, [ScriptVar] + ld a, [wScriptVar] ld [de], a ret @@ -1872,7 +1872,7 @@ Script_checkver: ; script command 0x18 ld a, [.gs_version] - ld [ScriptVar], a + ld [wScriptVar], a ret .gs_version: @@ -1880,16 +1880,16 @@ Script_checkver: Script_pokenamemem: ; script command 0x40 -; parameters: pokemon (0 aka USE_SCRIPT_VAR to use ScriptVar), memory +; parameters: pokemon (0 aka USE_SCRIPT_VAR to use wScriptVar), memory call GetScriptByte and a jr nz, .gotit - ld a, [ScriptVar] + ld a, [wScriptVar] .gotit ld [wd265], a call GetPokemonName - ld de, StringBuffer1 + ld de, wStringBuffer1 ConvertMemToText: call GetScriptByte @@ -1899,40 +1899,40 @@ ConvertMemToText: .ok CopyConvertedText: - ld hl, StringBuffer3 - ld bc, StringBuffer4 - StringBuffer3 + ld hl, wStringBuffer3 + ld bc, wStringBuffer4 - wStringBuffer3 call AddNTimes call CopyName2 ret Script_itemtotext: ; script command 0x41 -; parameters: item (0 aka USE_SCRIPT_VAR to use ScriptVar), memory +; parameters: item (0 aka USE_SCRIPT_VAR to use wScriptVar), memory call GetScriptByte and a ; USE_SCRIPT_VAR jr nz, .ok - ld a, [ScriptVar] + ld a, [wScriptVar] .ok ld [wd265], a call GetItemName - ld de, StringBuffer1 + ld de, wStringBuffer1 jr ConvertMemToText Script_mapnametotext: ; script command 0x42 ; parameters: memory - ld a, [MapGroup] + ld a, [wMapGroup] ld b, a - ld a, [MapNumber] + ld a, [wMapNumber] ld c, a call GetWorldMapLocation ConvertLandmarkToText: ld e, a farcall GetLandmarkName - ld de, StringBuffer1 + ld de, wStringBuffer1 jp ConvertMemToText Script_landmarktotext: @@ -1962,9 +1962,9 @@ Script_name: ContinueToGetName: call GetScriptByte - ld [CurSpecies], a + ld [wCurSpecies], a call GetName - ld de, StringBuffer1 + ld de, wStringBuffer1 jp ConvertMemToText Script_trainerclassname: @@ -1981,10 +1981,10 @@ Script_readmoney: call ResetStringBuffer1 call GetMoneyAccount - ld hl, StringBuffer1 + ld hl, wStringBuffer1 lb bc, PRINTNUM_RIGHTALIGN | 3, 6 call PrintNum - ld de, StringBuffer1 + ld de, wStringBuffer1 jp ConvertMemToText Script_readcoins: @@ -1992,11 +1992,11 @@ Script_readcoins: ; parameters: memory call ResetStringBuffer1 - ld hl, StringBuffer1 - ld de, Coins + ld hl, wStringBuffer1 + ld de, wCoins lb bc, PRINTNUM_RIGHTALIGN | 2, 6 call PrintNum - ld de, StringBuffer1 + ld de, wStringBuffer1 jp ConvertMemToText Script_vartomem: @@ -2004,15 +2004,15 @@ Script_vartomem: ; parameters: memory call ResetStringBuffer1 - ld de, ScriptVar - ld hl, StringBuffer1 + ld de, wScriptVar + ld hl, wStringBuffer1 lb bc, PRINTNUM_RIGHTALIGN | 1, 3 call PrintNum - ld de, StringBuffer1 + ld de, wStringBuffer1 jp ConvertMemToText ResetStringBuffer1: - ld hl, StringBuffer1 + ld hl, wStringBuffer1 ld bc, NAME_LENGTH ld a, "@" call ByteFill @@ -2026,10 +2026,10 @@ Script_stringtotext: ld e, a call GetScriptByte ld d, a - ld a, [ScriptBank] + ld a, [wScriptBank] ld hl, CopyName1 rst FarCall - ld de, StringBuffer2 + ld de, wStringBuffer2 jp ConvertMemToText Script_givepokeitem: @@ -2040,14 +2040,14 @@ Script_givepokeitem: ld l, a call GetScriptByte ld h, a - ld a, [ScriptBank] + ld a, [wScriptBank] call GetFarByte ld b, a push bc inc hl ld bc, MAIL_MSG_LENGTH ld de, wd002 - ld a, [ScriptBank] + ld a, [wScriptBank] call FarCopyBytes pop bc farcall GivePokeItem @@ -2061,7 +2061,7 @@ Script_checkpokeitem: ld e, a call GetScriptByte ld d, a - ld a, [ScriptBank] + ld a, [wScriptBank] ld b, a farcall CheckPokeItem ret @@ -2073,20 +2073,20 @@ Script_giveitem: call GetScriptByte cp ITEM_FROM_MEM jr nz, .ok - ld a, [ScriptVar] + ld a, [wScriptVar] .ok - ld [CurItem], a + ld [wCurItem], a call GetScriptByte ld [wItemQuantityChangeBuffer], a - ld hl, NumItems + ld hl, wNumItems call ReceiveItem jr nc, .full ld a, TRUE - ld [ScriptVar], a + ld [wScriptVar], a ret .full xor a - ld [ScriptVar], a + ld [wScriptVar], a ret Script_takeitem: @@ -2094,18 +2094,18 @@ Script_takeitem: ; parameters: item, quantity xor a - ld [ScriptVar], a + ld [wScriptVar], a call GetScriptByte - ld [CurItem], a + ld [wCurItem], a call GetScriptByte ld [wItemQuantityChangeBuffer], a ld a, -1 - ld [CurItemQuantity], a - ld hl, NumItems + ld [wCurItemQuantity], a + ld hl, wNumItems call TossItem ret nc ld a, TRUE - ld [ScriptVar], a + ld [wScriptVar], a ret Script_checkitem: @@ -2113,14 +2113,14 @@ Script_checkitem: ; parameters: item xor a - ld [ScriptVar], a + ld [wScriptVar], a call GetScriptByte - ld [CurItem], a - ld hl, NumItems + ld [wCurItem], a + ld hl, wNumItems call CheckItem ret nc ld a, TRUE - ld [ScriptVar], a + ld [wScriptVar], a ret Script_givemoney: @@ -2160,13 +2160,13 @@ CompareMoneyAction: .less ld a, HAVE_LESS .done - ld [ScriptVar], a + ld [wScriptVar], a ret GetMoneyAccount: call GetScriptByte and a - ld de, Money ; YOUR_MONEY + ld de, wMoney ; YOUR_MONEY ret z ld de, wMomsMoney ; MOMS_MONEY ret @@ -2222,13 +2222,13 @@ Script_checktime: ; parameters: time xor a - ld [ScriptVar], a + ld [wScriptVar], a farcall CheckTime call GetScriptByte and c ret z ld a, TRUE - ld [ScriptVar], a + ld [wScriptVar], a ret Script_checkpoke: @@ -2236,14 +2236,14 @@ Script_checkpoke: ; parameters: pokemon xor a - ld [ScriptVar], a + ld [wScriptVar], a call GetScriptByte - ld hl, PartySpecies + ld hl, wPartySpecies ld de, 1 call IsInArray ret nc ld a, TRUE - ld [ScriptVar], a + ld [wScriptVar], a ret Script_addcellnum: @@ -2251,13 +2251,13 @@ Script_addcellnum: ; parameters: person xor a - ld [ScriptVar], a + ld [wScriptVar], a call GetScriptByte ld c, a farcall AddPhoneNumber ret nc ld a, TRUE - ld [ScriptVar], a + ld [wScriptVar], a ret Script_delcellnum: @@ -2265,13 +2265,13 @@ Script_delcellnum: ; parameters: person xor a - ld [ScriptVar], a + ld [wScriptVar], a call GetScriptByte ld c, a farcall DelCellNum ret nc ld a, TRUE - ld [ScriptVar], a + ld [wScriptVar], a ret Script_checkcellnum: @@ -2280,13 +2280,13 @@ Script_checkcellnum: ; returns false if the cell number is not in your phone xor a - ld [ScriptVar], a + ld [wScriptVar], a call GetScriptByte ld c, a farcall CheckCellNum ret nc ld a, TRUE - ld [ScriptVar], a + ld [wScriptVar], a ret Script_specialphonecall: @@ -2308,7 +2308,7 @@ Script_checkphonecall: jr z, .ok ld a, TRUE .ok - ld [ScriptVar], a + ld [wScriptVar], a ret Script_givepoke: @@ -2316,16 +2316,16 @@ Script_givepoke: ; parameters: pokemon, level, item, trainer, trainer_name_pointer, pkmn_nickname call GetScriptByte - ld [CurPartySpecies], a + ld [wCurPartySpecies], a call GetScriptByte - ld [CurPartyLevel], a + ld [wCurPartyLevel], a call GetScriptByte - ld [CurItem], a + ld [wCurItem], a call GetScriptByte and a ld b, a jr z, .ok - ld hl, ScriptPos + ld hl, wScriptPos ld e, [hl] inc hl ld d, [hl] @@ -2336,25 +2336,25 @@ Script_givepoke: .ok farcall GivePoke ld a, b - ld [ScriptVar], a + ld [wScriptVar], a ret Script_giveegg: ; script command 0x2e ; parameters: pokemon, level -; if no room in the party, return 0 in ScriptVar; else, return 2 +; if no room in the party, return 0 in wScriptVar; else, return 2 xor a ; PARTYMON - ld [ScriptVar], a - ld [MonType], a + ld [wScriptVar], a + ld [wMonType], a call GetScriptByte - ld [CurPartySpecies], a + ld [wCurPartySpecies], a call GetScriptByte - ld [CurPartyLevel], a + ld [wCurPartyLevel], a farcall GiveEgg ret nc ld a, 2 - ld [ScriptVar], a + ld [wScriptVar], a ret Script_setevent: @@ -2396,7 +2396,7 @@ Script_checkevent: jr z, .false ld a, TRUE .false - ld [ScriptVar], a + ld [wScriptVar], a ret Script_setflag: @@ -2438,7 +2438,7 @@ Script_checkflag: jr z, .false ld a, TRUE .false - ld [ScriptVar], a + ld [wScriptVar], a ret _EngineFlagAction: @@ -2490,15 +2490,15 @@ Script_warp: call GetScriptByte and a jr z, .not_ok - ld [MapGroup], a + ld [wMapGroup], a call GetScriptByte - ld [MapNumber], a + ld [wMapNumber], a call GetScriptByte - ld [XCoord], a + ld [wXCoord], a call GetScriptByte - ld [YCoord], a + ld [wYCoord], a ld a, -1 - ld [DefaultSpawnpoint], a + ld [wDefaultSpawnpoint], a ld a, MAPSETUP_WARP ld [hMapEntryMethod], a ld a, 1 @@ -2511,7 +2511,7 @@ Script_warp: call GetScriptByte call GetScriptByte ld a, -1 - ld [DefaultSpawnpoint], a + ld [wDefaultSpawnpoint], a ld a, MAPSETUP_BADWARP ld [hMapEntryMethod], a ld a, 1 @@ -2524,11 +2524,11 @@ Script_warpmod: ; parameters: warp_id, map_group, map_id call GetScriptByte - ld [BackupWarpNumber], a + ld [wBackupWarpNumber], a call GetScriptByte - ld [BackupMapGroup], a + ld [wBackupMapGroup], a call GetScriptByte - ld [BackupMapNumber], a + ld [wBackupMapNumber], a ret Script_blackoutmod: @@ -2556,7 +2556,7 @@ Script_writecmdqueue: ld e, a call GetScriptByte ld d, a - ld a, [ScriptBank] + ld a, [wScriptBank] ld b, a farcall WriteCmdQueue ; no need to farcall ret @@ -2566,13 +2566,13 @@ Script_delcmdqueue: ; parameters: byte xor a - ld [ScriptVar], a + ld [wScriptVar], a call GetScriptByte ld b, a farcall DelCmdQueue ; no need to farcall ret c ld a, 1 - ld [ScriptVar], a + ld [wScriptVar], a ret Script_changemap: @@ -2580,11 +2580,11 @@ Script_changemap: ; parameters: map_data_pointer call GetScriptByte - ld [MapBlocksBank], a + ld [wMapBlocksBank], a call GetScriptByte - ld [MapBlocksPointer], a + ld [wMapBlocksPointer], a call GetScriptByte - ld [MapBlocksPointer + 1], a + ld [wMapBlocksPointer + 1], a call ChangeMap call BufferScreen ret @@ -2699,11 +2699,11 @@ Script_pause: call GetScriptByte and a jr z, .loop - ld [ScriptDelay], a + ld [wScriptDelay], a .loop ld c, 2 call DelayFrames - ld hl, ScriptDelay + ld hl, wScriptDelay dec [hl] jr nz, .loop ret @@ -2715,10 +2715,10 @@ Script_deactivatefacing: call GetScriptByte and a jr z, .no_time - ld [ScriptDelay], a + ld [wScriptDelay], a .no_time ld a, SCRIPT_WAIT - ld [ScriptMode], a + ld [wScriptMode], a call StopScript ret @@ -2738,10 +2738,10 @@ Script_end: .resume xor a - ld [ScriptRunning], a + ld [wScriptRunning], a ld a, SCRIPT_OFF - ld [ScriptMode], a - ld hl, ScriptFlags + ld [wScriptMode], a + ld hl, wScriptFlags res 0, [hl] call StopScript ret @@ -2752,7 +2752,7 @@ Script_return: call ExitScriptSubroutine jr c, .dummy .dummy - ld hl, ScriptFlags + ld hl, wScriptFlags res 0, [hl] call StopScript ret @@ -2774,13 +2774,13 @@ ExitScriptSubroutine: ld a, [hli] ld b, a and " " - ld [ScriptBank], a + ld [wScriptBank], a ld a, [hli] ld e, a - ld [ScriptPos], a + ld [wScriptPos], a ld a, [hl] ld d, a - ld [ScriptPos + 1], a + ld [wScriptPos + 1], a and a ret .done @@ -2792,10 +2792,10 @@ Script_end_all: xor a ld [wScriptStackSize], a - ld [ScriptRunning], a + ld [wScriptRunning], a ld a, SCRIPT_OFF - ld [ScriptMode], a - ld hl, ScriptFlags + ld [wScriptMode], a + ld hl, wScriptFlags res 0, [hl] call StopScript ret @@ -2844,13 +2844,13 @@ Script_check_save: farcall CheckSave ld a, c - ld [ScriptVar], a + ld [wScriptVar], a ret ; unused ld a, [.byte] - ld [ScriptVar], a + ld [wScriptVar], a ret .byte diff --git a/engine/scrolling_menu.asm b/engine/scrolling_menu.asm index 32acf2def..e12d4254d 100755 --- a/engine/scrolling_menu.asm +++ b/engine/scrolling_menu.asm @@ -44,7 +44,7 @@ _ScrollingMenu:: ; 245cb ScrollingMenu_InitDisplay: ; 245f1 xor a ld [hBGMapMode], a - ld hl, Options + ld hl, wOptions ld a, [hl] push af set NO_TEXT_SCROLL, [hl] @@ -52,7 +52,7 @@ ScrollingMenu_InitDisplay: ; 245f1 call ScrollingMenu_PlaceCursor call ScrollingMenu_CheckCallFunction3 pop af - ld [Options], a + ld [wOptions], a ret ; 24609 @@ -95,15 +95,15 @@ ScrollingMenuJoyAction: ; 24609 ld a, [wMenuCursorY] dec a call ScrollingMenu_GetListItemCoordAndFunctionArgs - ld a, [MenuSelection] - ld [CurItem], a - ld a, [MenuSelectionQuantity] + ld a, [wMenuSelection] + ld [wCurItem], a + ld a, [wMenuSelectionQuantity] ld [wItemQuantityBuffer], a call ScrollingMenu_GetCursorPosition dec a ld [wScrollingMenuCursorPosition], a - ld [CurItemQuantity], a - ld a, [MenuSelection] + ld [wCurItemQuantity], a + ld a, [wMenuSelection] cp -1 jr z, .b_button ld a, A_BUTTON @@ -124,7 +124,7 @@ ScrollingMenuJoyAction: ; 24609 ld a, [wMenuCursorY] dec a call ScrollingMenu_GetListItemCoordAndFunctionArgs - ld a, [MenuSelection] + ld a, [wMenuSelection] cp -1 jp z, xor_a_dec_a call ScrollingMenu_GetCursorPosition @@ -389,7 +389,7 @@ ScrollingMenu_UpdateDisplay: ; 247f0 ld [wScrollingMenuCursorPosition], a ld a, c call ScrollingMenu_GetListItemCoordAndFunctionArgs - ld a, [MenuSelection] + ld a, [wMenuSelection] cp -1 jr z, .cancel push bc @@ -531,12 +531,12 @@ ScrollingMenu_GetListItemCoordAndFunctionArgs: ; 248d5 add hl, de ld a, [wMenuData2_ItemsPointerBank] call GetFarByte - ld [MenuSelection], a - ld [CurItem], a + ld [wMenuSelection], a + ld [wCurItem], a inc hl ld a, [wMenuData2_ItemsPointerBank] call GetFarByte - ld [MenuSelectionQuantity], a + ld [wMenuSelectionQuantity], a pop hl pop de ret diff --git a/engine/search.asm b/engine/search.asm index 495d4cc5e..6c18f3e3d 100755 --- a/engine/search.asm +++ b/engine/search.asm @@ -1,66 +1,66 @@ Special_BeastsCheck: ; 0x4a6e8 ; Check if the player owns all three legendary beasts. ; They must exist in either party or PC, and have the player's OT and ID. -; Return the result in ScriptVar. +; Return the result in wScriptVar. ld a, RAIKOU - ld [ScriptVar], a + ld [wScriptVar], a call CheckOwnMonAnywhere jr nc, .notexist ld a, ENTEI - ld [ScriptVar], a + ld [wScriptVar], a call CheckOwnMonAnywhere jr nc, .notexist ld a, SUICUNE - ld [ScriptVar], a + ld [wScriptVar], a call CheckOwnMonAnywhere jr nc, .notexist ; they exist ld a, 1 - ld [ScriptVar], a + ld [wScriptVar], a ret .notexist xor a - ld [ScriptVar], a + ld [wScriptVar], a ret Special_MonCheck: ; 0x4a711 -; Check if the player owns any monsters of the species in ScriptVar. -; Return the result in ScriptVar. +; Check if the player owns any monsters of the species in wScriptVar. +; Return the result in wScriptVar. call CheckOwnMonAnywhere jr c, .exists ; doesn't exist xor a - ld [ScriptVar], a + ld [wScriptVar], a ret .exists ld a, 1 - ld [ScriptVar], a + ld [wScriptVar], a ret CheckOwnMonAnywhere: ; 0x4a721 -; Check if the player owns any monsters of the species in ScriptVar. +; Check if the player owns any monsters of the species in wScriptVar. ; It must exist in either party or PC, and have the player's OT and ID. ; If there are no monsters in the party, ; the player must not own any yet. - ld a, [PartyCount] + ld a, [wPartyCount] and a ret z ld d, a ld e, 0 - ld hl, PartyMon1Species - ld bc, PartyMonOT + ld hl, wPartyMon1Species + ld bc, wPartyMonOT ; Run CheckOwnMon on each Pokémon in the party. .partymon @@ -185,7 +185,7 @@ CheckOwnMon: ; 0x4a7ba ; inputs: ; hl, pointer to PartyMonNSpecies ; bc, pointer to PartyMonNOT -; ScriptVar should contain the species we're looking for +; wScriptVar should contain the species we're looking for ; outputs: ; sets carry if monster matches species, ID, and OT name. @@ -197,7 +197,7 @@ CheckOwnMon: ; 0x4a7ba ld e, c ; check species - ld a, [ScriptVar] ; species we're looking for + ld a, [wScriptVar] ; species we're looking for ld b, [hl] ; species we have cp b jr nz, .notfound ; species doesn't match @@ -205,11 +205,11 @@ CheckOwnMon: ; 0x4a7ba ; check ID number ld bc, MON_ID add hl, bc ; now hl points to ID number - ld a, [PlayerID] + ld a, [wPlayerID] cp [hl] jr nz, .notfound ; ID doesn't match inc hl - ld a, [PlayerID + 1] + ld a, [wPlayerID + 1] cp [hl] jr nz, .notfound ; ID doesn't match @@ -217,7 +217,7 @@ CheckOwnMon: ; 0x4a7ba ; This only checks five characters, which is fine for the Japanese version, ; but in the English version the player name is 7 characters, so this is wrong. - ld hl, PlayerName + ld hl, wPlayerName rept NAME_LENGTH_JAPANESE +- 2 ; should be PLAYER_NAME_LENGTH +- 2 ld a, [de] diff --git a/engine/search2.asm b/engine/search2.asm index 9ef5491f0..15b8ae138 100755 --- a/engine/search2.asm +++ b/engine/search2.asm @@ -1,30 +1,30 @@ _FindGreaterThanThatLevel: ; 4dbd2 - ld hl, PartyMon1Level + ld hl, wPartyMon1Level call FindGreaterThanThatLevel ret _FindAtLeastThatHappy: ; 4dbd9 - ld hl, PartyMon1Happiness + ld hl, wPartyMon1Happiness call FindAtLeastThatHappy ret _FindThatSpecies: ; 4dbe0 - ld hl, PartyMon1Species + ld hl, wPartyMon1Species jp FindThatSpecies _FindThatSpeciesYourTrainerID: ; 4dbe6 - ld hl, PartyMon1Species + ld hl, wPartyMon1Species call FindThatSpecies ret z ld a, c - ld hl, PartyMon1ID + ld hl, wPartyMon1ID ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes - ld a, [PlayerID] + ld a, [wPlayerID] cp [hl] jr nz, .nope inc hl - ld a, [PlayerID + 1] + ld a, [wPlayerID + 1] cp [hl] jr nz, .nope ld a, $1 @@ -39,7 +39,7 @@ FindAtLeastThatHappy: ; 4dc0a ; Sets the bits for the Pokemon that have a happiness greater than or equal to b. ; The lowest bits are used. Sets z if no Pokemon in your party is at least that happy. ld c, $0 - ld a, [PartyCount] + ld a, [wPartyCount] ld d, a .loop ld a, d @@ -71,7 +71,7 @@ FindAtLeastThatHappy: ; 4dc0a FindGreaterThanThatLevel: ; 4dc31 ld c, $0 - ld a, [PartyCount] + ld a, [wPartyCount] ld d, a .loop ld a, d @@ -104,7 +104,7 @@ FindThatSpecies: ; 4dc56 ; If that species is in your party, returns its location in c, and nz. ; Otherwise, returns z. ld c, -1 - ld hl, PartySpecies + ld hl, wPartySpecies .loop ld a, [hli] cp -1 @@ -118,7 +118,7 @@ FindThatSpecies: ; 4dc56 RetroactivelyIgnoreEggs: ; 4dc67 ld e, -2 - ld hl, PartySpecies + ld hl, wPartySpecies .loop ld a, [hli] cp -1 diff --git a/engine/select_menu.asm b/engine/select_menu.asm index e92c3ee50..2135cd5bf 100755 --- a/engine/select_menu.asm +++ b/engine/select_menu.asm @@ -22,7 +22,7 @@ ItemMayBeRegisteredText: ; 13340 CheckRegisteredItem: ; 13345 - ld a, [WhichRegisteredItem] + ld a, [wWhichRegisteredItem] and a jr z, .NoRegisteredItem and REGISTERED_POCKET @@ -39,7 +39,7 @@ CheckRegisteredItem: ; 13345 dw .CheckTMHM .CheckItem: - ld hl, NumItems + ld hl, wNumItems call .CheckRegisteredNo jr c, .NoRegisteredItem inc hl @@ -53,18 +53,18 @@ CheckRegisteredItem: ; 13345 ret .CheckKeyItem: - ld a, [RegisteredItem] - ld hl, KeyItems + ld a, [wRegisteredItem] + ld hl, wKeyItems ld de, 1 call IsInArray jr nc, .NoRegisteredItem - ld a, [RegisteredItem] - ld [CurItem], a + ld a, [wRegisteredItem] + ld [wCurItem], a and a ret .CheckBall: - ld hl, NumBalls + ld hl, wNumBalls call .CheckRegisteredNo jr nc, .NoRegisteredItem inc hl @@ -81,20 +81,20 @@ CheckRegisteredItem: ; 13345 .NoRegisteredItem: xor a - ld [WhichRegisteredItem], a - ld [RegisteredItem], a + ld [wWhichRegisteredItem], a + ld [wRegisteredItem], a scf ret ; 133a6 .CheckRegisteredNo: ; 133a6 - ld a, [WhichRegisteredItem] + ld a, [wWhichRegisteredItem] and REGISTERED_NUMBER dec a cp [hl] jr nc, .NotEnoughItems - ld [CurItemQuantity], a + ld [wCurItemQuantity], a and a ret @@ -105,10 +105,10 @@ CheckRegisteredItem: ; 13345 .IsSameItem: ; 133b6 - ld a, [RegisteredItem] + ld a, [wRegisteredItem] cp [hl] jr nz, .NotSameItem - ld [CurItem], a + ld [wCurItem], a and a ret diff --git a/engine/sgb_layouts.asm b/engine/sgb_layouts.asm index 5f2b8e12e..24bdc952e 100644 --- a/engine/sgb_layouts.asm +++ b/engine/sgb_layouts.asm @@ -5,7 +5,7 @@ LoadSGBLayout: ; 864c ld a, b cp SCGB_RAM jr nz, .not_ram - ld a, [SGBPredef] + ld a, [wSGBPredef] .not_ram cp SCGB_PARTY_MENU_HP_PALS jp z, SGB_ApplyPartyMenuHPPals @@ -71,7 +71,7 @@ LoadSGBLayout: ; 864c ld bc, PALPACKET_LENGTH call CopyBytes - ld a, [PlayerHPPal] + ld a, [wPlayerHPPal] ld l, a ld h, 0 add hl, hl @@ -88,7 +88,7 @@ LoadSGBLayout: ; 864c ld a, [hl] ld [wSGBPals + 6], a - ld a, [EnemyHPPal] + ld a, [wEnemyHPPal] ld l, a ld h, 0 add hl, hl @@ -133,7 +133,7 @@ LoadSGBLayout: ; 864c ld hl, wSGBPals ld de, wSGBPals + PALPACKET_LENGTH ld a, SCGB_BATTLE_COLORS - ld [SGBPredef], a + ld [wSGBPredef], a ret ; 873c @@ -148,7 +148,7 @@ LoadSGBLayout: ; 864c inc hl inc hl - ld a, [PlayerHPPal] + ld a, [wPlayerHPPal] add PREDEFPAL_HP_GREEN ld [hl], a ld hl, wSGBPals @@ -182,8 +182,8 @@ LoadSGBLayout: ; 864c ld [wSGBPals + 5], a ld a, [hl] ld [wSGBPals + 6], a - ld a, [CurPartySpecies] - ld bc, TempMonDVs + ld a, [wCurPartySpecies] + ld bc, wTempMonDVs call GetPlayerOrMonPalettePointer ld a, [hli] ld [wSGBPals + 9], a @@ -217,7 +217,7 @@ LoadSGBLayout: ; 864c ld [hl], LOW(palred 26 + palgreen 10 + palblue 6) inc hl ld [hl], HIGH(palred 26 + palgreen 10 + palblue 6) - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] call GetMonPalettePointer_ ld a, [hli] ld [wSGBPals + 9], a @@ -245,8 +245,8 @@ LoadSGBLayout: ; 864c ld [hl], LOW(palred 26 + palgreen 10 + palblue 6) inc hl ld [hl], HIGH(palred 26 + palgreen 10 + palblue 6) - ld a, [CurPartySpecies] - ld bc, TempMonDVs + ld a, [wCurPartySpecies] + ld bc, wTempMonDVs call GetPlayerOrMonPalettePointer ld a, [hli] ld [wSGBPals + 9], a @@ -336,7 +336,7 @@ endr ld hl, PalPacket_GSTitleScreen ld de, BlkPacket_GSTitleScreen ld a, SCGB_DIPLOMA - ld [SGBPredef], a + ld [wSGBPredef], a ret ; 8890 @@ -354,7 +354,7 @@ endr .SGB11: ; 889e ld hl, BlkPacket_9a86 - ld de, PlayerLightScreenCount ; ??? + ld de, wPlayerLightScreenCount ; ??? ld bc, PALPACKET_LENGTH call CopyBytes ld hl, PalPacket_SCGB_11 @@ -372,7 +372,7 @@ endr ld [hld], a ld de, BlkPacket_9a86 ld a, SCGB_MAPPALS - ld [SGBPredef], a + ld [wSGBPredef], a ret ; 88cd @@ -398,13 +398,13 @@ endr jr .done .partymon - ld hl, PartyMon1DVs + ld hl, wPartyMon1DVs ld bc, PARTYMON_STRUCT_LENGTH - ld a, [CurPartyMon] + ld a, [wCurPartyMon] call AddNTimes ld c, l ld b, h - ld a, [PlayerHPPal] + ld a, [wPlayerHPPal] call GetPlayerOrMonPalettePointer ld a, [hli] ld [wSGBPals + 3], a @@ -469,7 +469,7 @@ endr ld de, wSGBPals ld bc, PALPACKET_LENGTH call CopyBytes - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] ld l, a ld h, 0 add hl, hl @@ -508,8 +508,8 @@ endr ld de, wSGBPals ld bc, PALPACKET_LENGTH call CopyBytes - ld a, [CurPartySpecies] - ld bc, TempMonDVs + ld a, [wCurPartySpecies] + ld bc, wTempMonDVs call GetPlayerOrMonPalettePointer ld a, [hli] ld [wSGBPals + 3], a @@ -535,8 +535,8 @@ endr ld de, wSGBPals ld bc, PALPACKET_LENGTH call CopyBytes - ld a, [CurPartySpecies] - ld bc, TempMonDVs + ld a, [wCurPartySpecies] + ld bc, wTempMonDVs call GetFrontpicPalettePointer ld a, [hli] ld [wSGBPals + 3], a @@ -552,7 +552,7 @@ endr ; 8a0c .GetMapPalsIndex: ; 8a0c - ld a, [TimeOfDayPal] + ld a, [wTimeOfDayPal] cp NITE_F jr c, .morn_day ld a, PREDEFPAL_NITE @@ -570,7 +570,7 @@ endr jr z, .perm5 cp GATE jr z, .gate - ld a, [MapGroup] + ld a, [wMapGroup] ld e, a ld d, 0 ld hl, MapGroupRoofSGBPalInds diff --git a/engine/slot_machine.asm b/engine/slot_machine.asm index cfec11091..fe9ea52d9 100755 --- a/engine/slot_machine.asm +++ b/engine/slot_machine.asm @@ -75,7 +75,7 @@ SLOTS_END_LOOP_F EQU 7 const REEL_ACTION_DROP_REEL _SlotMachine: - ld hl, Options + ld hl, wOptions set NO_TEXT_SCROLL, [hl] call .InitGFX call DelayFrame @@ -88,7 +88,7 @@ _SlotMachine: call WaitSFX call ClearBGPalettes farcall StubbedTrainerRankings_EndSlotsWinStreak - ld hl, Options + ld hl, wOptions res NO_TEXT_SCROLL, [hl] ld hl, rLCDC res rLCDC_SPRITE_SIZE, [hl] ; 8x8 @@ -211,7 +211,7 @@ SlotsLoop: ; 927af (24:67af) ret .matching_sevens - ld a, [TextDelayFrames] + ld a, [wTextDelayFrames] and $7 ret nz ld a, [rBGP] @@ -223,7 +223,7 @@ SlotsLoop: ; 927af (24:67af) .PrintCoinsAndPayout: ; 927f8 (24:67f8) hlcoord 5, 1 - ld de, Coins + ld de, wCoins lb bc, PRINTNUM_LEADINGZEROS | 2, 4 call PrintNum hlcoord 11, 1 @@ -261,7 +261,7 @@ Unreferenced_Function9282c: ; 9282c inc [hl] and $7 ret nz - ld hl, Sprite17TileID + ld hl, wVirtualOAMSprite16TileID ld c, NUM_SPRITE_OAM_STRUCTS - 16 .loop ld a, [hl] @@ -480,7 +480,7 @@ SlotsAction_PayoutAnim: ; 929a4 (24:69a4) ld [hl], e dec hl ld [hl], d - ld hl, Coins + ld hl, wCoins ld d, [hl] inc hl ld e, [hl] @@ -671,7 +671,7 @@ Slots_InitReelTiles: ; 92a98 (24:6a98) ld bc, wReel1 ld hl, REEL_OAM_ADDR add hl, bc - ld de, Sprite17 + ld de, wVirtualOAMSprite16 ld [hl], e inc hl ld [hl], d @@ -689,7 +689,7 @@ Slots_InitReelTiles: ; 92a98 (24:6a98) ld bc, wReel2 ld hl, REEL_OAM_ADDR add hl, bc - ld de, Sprite25 + ld de, wVirtualOAMSprite24 ld [hl], e inc hl ld [hl], d @@ -707,7 +707,7 @@ Slots_InitReelTiles: ; 92a98 (24:6a98) ld bc, wReel3 ld hl, REEL_OAM_ADDR add hl, bc - ld de, Sprite33 + ld de, wVirtualOAMSprite32 ld [hl], e inc hl ld [hl], d @@ -1725,7 +1725,7 @@ Slots_InitBias: ; 93002 (24:7002) and a ret z ld hl, .Normal - ld a, [ScriptVar] + ld a, [wScriptVar] and a jr z, .okay ld hl, .Lucky @@ -1819,7 +1819,7 @@ Slots_AskBet: ; 9307c (24:707c) ld a, 4 sub b ld [wSlotBet], a - ld hl, Coins + ld hl, wCoins ld c, a ld a, [hli] and a @@ -1832,7 +1832,7 @@ Slots_AskBet: ; 9307c (24:707c) jr .loop .Start: - ld hl, Coins + 1 + ld hl, wCoins + 1 ld a, [hl] sub c ld [hld], a @@ -1883,7 +1883,7 @@ Slots_AskBet: ; 9307c (24:707c) ; 0x930e9 Slots_AskPlayAgain: ; 930e9 (24:70e9) - ld hl, Coins + ld hl, wCoins ld a, [hli] or [hl] jr nz, .you_have_coins @@ -1971,7 +1971,7 @@ Slots_PayoutText: ; 93158 (24:7158) add hl, de add hl, de add hl, de - ld de, StringBuffer2 + ld de, wStringBuffer2 ld bc, 4 call CopyBytes ld a, [hli] diff --git a/engine/spawn_points.asm b/engine/spawn_points.asm index daebb6159..1a3d12441 100644 --- a/engine/spawn_points.asm +++ b/engine/spawn_points.asm @@ -2,10 +2,10 @@ INCLUDE "data/maps/spawn_points.asm" LoadSpawnPoint: ; 1531f - ; loads the spawn point in DefaultSpawnpoint + ; loads the spawn point in wDefaultSpawnpoint push hl push de - ld a, [DefaultSpawnpoint] + ld a, [wDefaultSpawnpoint] cp SPAWN_N_A jr z, .spawn_n_a ld l, a @@ -15,13 +15,13 @@ LoadSpawnPoint: ; 1531f ld de, SpawnPoints add hl, de ld a, [hli] - ld [MapGroup], a + ld [wMapGroup], a ld a, [hli] - ld [MapNumber], a + ld [wMapNumber], a ld a, [hli] - ld [XCoord], a + ld [wXCoord], a ld a, [hli] - ld [YCoord], a + ld [wYCoord], a .spawn_n_a pop de pop hl diff --git a/engine/specials.asm b/engine/specials.asm index 965e3d58b..facb1eb25 100644 --- a/engine/specials.asm +++ b/engine/specials.asm @@ -21,22 +21,22 @@ DummySpecial_c224: ; c224 ; c225 Special_SetPlayerPalette: ; c225 - ld a, [ScriptVar] + ld a, [wScriptVar] ld d, a farcall SetPlayerPalette ret ; c230 Special_GameCornerPrizeMonCheckDex: ; c230 - ld a, [ScriptVar] + ld a, [wScriptVar] dec a call CheckCaughtMon ret nz - ld a, [ScriptVar] + ld a, [wScriptVar] dec a call SetSeenAndCaughtMon call FadeToMenu - ld a, [ScriptVar] + ld a, [wScriptVar] ld [wd265], a farcall NewPokedexEntry call ExitAllMenus @@ -44,35 +44,35 @@ Special_GameCornerPrizeMonCheckDex: ; c230 ; c252 UnusedSpecial_SeenMon: ; c252 - ld a, [ScriptVar] + ld a, [wScriptVar] dec a call SetSeenMon ret ; c25a Special_FindGreaterThanThatLevel: ; c25a - ld a, [ScriptVar] + ld a, [wScriptVar] ld b, a farcall _FindGreaterThanThatLevel jr z, FoundNone jr FoundOne Special_FindAtLeastThatHappy: ; c268 - ld a, [ScriptVar] + ld a, [wScriptVar] ld b, a farcall _FindAtLeastThatHappy jr z, FoundNone jr FoundOne Special_FindThatSpecies: ; c276 - ld a, [ScriptVar] + ld a, [wScriptVar] ld b, a farcall _FindThatSpecies jr z, FoundNone jr FoundOne Special_FindThatSpeciesYourTrainerID: ; c284 - ld a, [ScriptVar] + ld a, [wScriptVar] ld b, a farcall _FindThatSpeciesYourTrainerID jr z, FoundNone @@ -80,21 +80,21 @@ Special_FindThatSpeciesYourTrainerID: ; c284 FoundOne: ; c292 ld a, TRUE - ld [ScriptVar], a + ld [wScriptVar], a ret FoundNone: ; c298 xor a - ld [ScriptVar], a + ld [wScriptVar], a ret ; c29d Special_NameRival: ; 0xc29d ld b, $2 ; rival - ld de, RivalName + ld de, wRivalName farcall _NamingScreen ; default to "SILVER" - ld hl, RivalName + ld hl, wRivalName ld de, DefaultRivalName call InitName ret @@ -131,10 +131,10 @@ Special_DisplayLinkRecord: ; c2da Special_KrissHousePC: ; c2e7 xor a - ld [ScriptVar], a + ld [wScriptVar], a farcall _KrissHousePC ld a, c - ld [ScriptVar], a + ld [wScriptVar], a ret ; c2f6 @@ -147,7 +147,7 @@ Special_CheckMysteryGift: ; c2f6 inc a .no - ld [ScriptVar], a + ld [wScriptVar], a call CloseSRAM ret ; c309 @@ -156,28 +156,28 @@ Special_GetMysteryGiftItem: ; c309 ld a, BANK(sMysteryGiftItem) call GetSRAMBank ld a, [sMysteryGiftItem] - ld [CurItem], a + ld [wCurItem], a ld a, 1 ld [wItemQuantityChangeBuffer], a - ld hl, NumItems + ld hl, wNumItems call ReceiveItem jr nc, .no_room xor a ld [sMysteryGiftItem], a call CloseSRAM - ld a, [CurItem] + ld a, [wCurItem] ld [wd265], a call GetItemName ld hl, .ReceiveItemText call PrintText ld a, TRUE - ld [ScriptVar], a + ld [wScriptVar], a ret .no_room call CloseSRAM xor a - ld [ScriptVar], a + ld [wScriptVar], a ret ; c345 @@ -190,12 +190,12 @@ Special_GetMysteryGiftItem: ; c309 Special_BugContestJudging: ; c34a farcall _BugContestJudging ld a, b - ld [ScriptVar], a + ld [wScriptVar], a ret ; c355 Special_MapRadio: ; c355 - ld a, [ScriptVar] + ld a, [wScriptVar] ld e, a farcall PlayRadio ret @@ -205,7 +205,7 @@ Special_UnownPuzzle: ; c360 call FadeToMenu farcall UnownPuzzle ld a, [wSolvedUnownPuzzle] - ld [ScriptVar], a + ld [wScriptVar], a call ExitAllMenus ret ; c373 @@ -253,13 +253,13 @@ Special_StartGameCornerGame: ; c39a ; c3ae Special_CheckCoins: ; c3ae - ld hl, Coins + ld hl, wCoins ld a, [hli] or [hl] jr z, .no_coins ld a, COIN_CASE - ld [CurItem], a - ld hl, NumItems + ld [wCurItem], a + ld hl, wNumItems call CheckItem jr nc, .no_coin_case and a @@ -299,23 +299,23 @@ Special_ClearBGPalettesBufferScreen: ; c3db ScriptReturnCarry: ; c3e2 jr c, .carry xor a - ld [ScriptVar], a + ld [wScriptVar], a ret .carry ld a, 1 - ld [ScriptVar], a + ld [wScriptVar], a ret ; c3ef UnusedSpecial_CheckUnusedTwoDayTimer: ; c3ef farcall CheckUnusedTwoDayTimer ld a, [wUnusedTwoDayTimer] - ld [ScriptVar], a + ld [wScriptVar], a ret ; c3fc Special_ActivateFishingSwarm: ; c3fc - ld a, [ScriptVar] + ld a, [wScriptVar] ld [wFishingSwarmFlag], a ret ; c403 @@ -365,16 +365,16 @@ Special_SnorlaxAwake: ; 0xc43d ; next to Snorlax. ; outputs: -; ScriptVar is 1 if the conditions are met, otherwise 0. +; wScriptVar is 1 if the conditions are met, otherwise 0. ; check background music ld a, [wMapMusic] cp MUSIC_POKE_FLUTE_CHANNEL jr nz, .nope - ld a, [XCoord] + ld a, [wXCoord] ld b, a - ld a, [YCoord] + ld a, [wYCoord] ld c, a ld hl, .ProximityCoords @@ -398,7 +398,7 @@ Special_SnorlaxAwake: ; 0xc43d .nope xor a .done - ld [ScriptVar], a + ld [wScriptVar], a ret .ProximityCoords: @@ -412,7 +412,7 @@ Special_SnorlaxAwake: ; 0xc43d Special_PlayCurMonCry: ; c472 - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] jp PlayMonCry ; c478 @@ -435,17 +435,17 @@ Special_GameboyCheck: ; c478 .cgb ld a, GBCHECK_CGB .done - ld [ScriptVar], a + ld [wScriptVar], a ret Special_FadeOutMusic: ; c48f ld a, LOW(MUSIC_NONE) - ld [MusicFadeID], a + ld [wMusicFadeID], a ld a, HIGH(MUSIC_NONE) - ld [MusicFadeID + 1], a + ld [wMusicFadeID + 1], a ld a, $2 - ld [MusicFade], a + ld [wMusicFade], a ret ; c49f @@ -467,5 +467,5 @@ Special_TrainerHouse: ; 0xc4b9 ld a, BANK(sMysteryGiftTrainerHouseFlag) call GetSRAMBank ld a, [sMysteryGiftTrainerHouseFlag] - ld [ScriptVar], a + ld [wScriptVar], a jp CloseSRAM diff --git a/engine/sprites.asm b/engine/sprites.asm index 7928fe1f0..277b75124 100755 --- a/engine/sprites.asm +++ b/engine/sprites.asm @@ -23,7 +23,7 @@ PlaySpriteAnimations: ; 8cf69 push bc push af - ld a, LOW(Sprites) + ld a, LOW(wVirtualOAM) ld [wCurrSpriteOAMAddr], a call DoNextFrameForAllSprites @@ -60,11 +60,11 @@ DoNextFrameForAllSprites: ; 8cf7a ld a, [wCurrSpriteOAMAddr] ld l, a - ld h, HIGH(Sprites) + ld h, HIGH(wVirtualOAM) -.loop2 ; Clear (Sprites + [wCurrSpriteOAMAddr] --> SpritesEnd) +.loop2 ; Clear (wVirtualOAM + [wCurrSpriteOAMAddr] --> wVirtualOAMEnd) ld a, l - cp LOW(SpritesEnd) + cp LOW(wVirtualOAMEnd) jr nc, .done xor a ld [hli], a @@ -100,11 +100,11 @@ DoNextFrameForFirst16Sprites: ; 8cfa8 (23:4fa8) ld a, [wCurrSpriteOAMAddr] ld l, a - ld h, HIGH(Sprite17) + ld h, HIGH(wVirtualOAMSprite16) -.loop2 ; Clear (Sprites + [wCurrSpriteOAMAddr] --> Sprites + $40) +.loop2 ; Clear (wVirtualOAM + [wCurrSpriteOAMAddr] --> Sprites + $40) ld a, l - cp LOW(Sprite17) + cp LOW(wVirtualOAMSprite16) jr nc, .done xor a ld [hli], a @@ -253,7 +253,7 @@ UpdateAnimFrame: ; 8d04c push bc ld a, [wCurrSpriteOAMAddr] ld e, a - ld d, HIGH(Sprites) + ld d, HIGH(wVirtualOAM) ld a, [hli] ld c, a ; number of objects .loop @@ -302,7 +302,7 @@ UpdateAnimFrame: ; 8d04c inc de ld a, e ld [wCurrSpriteOAMAddr], a - cp LOW(SpritesEnd) + cp LOW(wVirtualOAMEnd) jr nc, .reached_the_end dec c jr nz, .loop @@ -649,7 +649,7 @@ AnimateEndOfExpBar: ; 8e79d ; 8e7c6 .AnimateFrame: ; 8e7c6 - ld hl, Sprite01 + ld hl, wVirtualOAMSprite00 ld c, 8 ; number of animated circles .anim_loop ld a, c diff --git a/engine/start_menu.asm b/engine/start_menu.asm index c0c4a38a3..f0cacc5b1 100755 --- a/engine/start_menu.asm +++ b/engine/start_menu.asm @@ -88,7 +88,7 @@ StartMenu:: ; 125cd call .DrawMenuAccount call SetUpMenu ld a, $ff - ld [MenuSelection], a + ld [wMenuSelection], a .loop call .PrintMenuAccount call GetScrollingMenuJoypad @@ -166,7 +166,7 @@ StartMenu:: ; 125cd .MenuData: db STATICMENU_CURSOR | STATICMENU_WRAP | STATICMENU_ENABLE_START ; flags dn 0, 0 ; rows, columns - dw MenuItemsList + dw wMenuItemsList dw .MenuString dw .Items @@ -220,7 +220,7 @@ StartMenu:: ; 125cd .OpenMenu: ; 127e5 - ld a, [MenuSelection] + ld a, [wMenuSelection] call .GetMenuAccountTextPointer ld a, [hli] ld h, [hl] @@ -230,7 +230,7 @@ StartMenu:: ; 125cd .MenuString: ; 127ef push de - ld a, [MenuSelection] + ld a, [wMenuSelection] call .GetMenuAccountTextPointer inc hl inc hl @@ -244,7 +244,7 @@ StartMenu:: ; 125cd .MenuDesc: ; 12800 push de - ld a, [MenuSelection] + ld a, [wMenuSelection] cp $ff jr z, .none call .GetMenuAccountTextPointer @@ -289,7 +289,7 @@ endr call .AppendMenuList .no_pokedex - ld a, [PartyCount] + ld a, [wPartyCount] and a jr z, .no_pokemon ld a, 1 ; pokemon @@ -333,19 +333,19 @@ endr ld a, 6 ; exit call .AppendMenuList ld a, c - ld [MenuItemsList], a + ld [wMenuItemsList], a ret ; 1288d .FillMenuList: ; 1288d xor a - ld hl, MenuItemsList + ld hl, wMenuItemsList ld [hli], a ld a, -1 - ld bc, MenuItemsListEnd - (MenuItemsList + 1) + ld bc, wMenuItemsListEnd - (wMenuItemsList + 1) call ByteFill - ld de, MenuItemsList + 1 + ld de, wMenuItemsList + 1 ld c, 0 ret ; 128a0 @@ -382,7 +382,7 @@ endr ; 128cb .IsMenuAccountOn: ; 128cb - ld a, [Options2] + ld a, [wOptions2] and 1 ret ; 128d1 @@ -473,7 +473,7 @@ StartMenu_Status: ; 12928 StartMenu_Pokedex: ; 12937 - ld a, [PartyCount] + ld a, [wPartyCount] and a jr z, .asm_12949 @@ -517,7 +517,7 @@ StartMenu_Pack: ; 1295b StartMenu_Pokemon: ; 12976 - ld a, [PartyCount] + ld a, [wPartyCount] and a jr z, .return @@ -525,7 +525,7 @@ StartMenu_Pokemon: ; 12976 .choosemenu xor a - ld [PartyMenuActionText], a ; Choose a POKéMON. + ld [wPartyMenuActionText], a ; Choose a POKéMON. call ClearBGPalettes .menu @@ -566,16 +566,16 @@ StartMenu_Pokemon: ; 12976 ; 129d5 HasNoItems: ; 129d5 - ld a, [NumItems] + ld a, [wNumItems] and a ret nz - ld a, [NumKeyItems] + ld a, [wNumKeyItems] and a ret nz - ld a, [NumBalls] + ld a, [wNumBalls] and a ret nz - ld hl, TMsHMs + ld hl, wTMsHMs ld b, NUM_TMS + NUM_HMS .loop ld a, [hli] @@ -612,7 +612,7 @@ TossItemFromPC: ; 129f4 pop af jr c, .quit pop hl - ld a, [CurItemQuantity] + ld a, [wCurItemQuantity] call TossItem call PartyMonItemName ld hl, .TossedThisMany @@ -667,7 +667,7 @@ CantUseItemText: ; 12a67 PartyMonItemName: ; 12a6c - ld a, [CurItem] + ld a, [wCurItem] ld [wd265], a call GetItemName call CopyName1 @@ -689,7 +689,7 @@ PokemonActionSubmenu: ; 12a88 call ClearBox farcall MonSubmenu call GetCurNick - ld a, [MenuSelection] + ld a, [wMenuSelection] ld hl, .Actions ld de, 3 call IsInArray @@ -732,11 +732,11 @@ PokemonActionSubmenu: ; 12a88 SwitchPartyMons: ; 12aec ; Don't try if there's nothing to switch! - ld a, [PartyCount] + ld a, [wPartyCount] cp 2 jr c, .DontSwitch - ld a, [CurPartyMon] + ld a, [wCurPartyMon] inc a ld [wSwitchMon], a @@ -744,7 +744,7 @@ SwitchPartyMons: ; 12aec farcall InitPartyMenuNoCancel ld a, PARTYMENUACTION_MOVE - ld [PartyMenuActionText], a + ld [wPartyMenuActionText], a farcall WritePartyMenuTilemap farcall PrintPartyMenuText @@ -765,7 +765,7 @@ SwitchPartyMons: ; 12aec farcall _SwitchPartyMons xor a - ld [PartyMenuActionText], a + ld [wPartyMenuActionText], a farcall LoadPartyMenuGFX farcall InitPartyMenuWithCancel @@ -776,7 +776,7 @@ SwitchPartyMons: ; 12aec .DontSwitch: xor a - ld [PartyMenuActionText], a + ld [wPartyMenuActionText], a call CancelPokemonAction ret ; 12b60 @@ -785,7 +785,7 @@ SwitchPartyMons: ; 12aec GiveTakePartyMonItem: ; 12b60 ; Eggs can't hold items! - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] cp EGG jr z, .cancel @@ -796,7 +796,7 @@ GiveTakePartyMonItem: ; 12b60 jr c, .cancel call GetCurNick - ld hl, StringBuffer1 + ld hl, wStringBuffer1 ld de, wMonOrItemNameBuffer ld bc, MON_NAME_LENGTH call CopyBytes @@ -896,23 +896,23 @@ TryGiveItemToPartymon: ; 12bd9 call GiveItemToPokemon ld a, [wd265] push af - ld a, [CurItem] + ld a, [wCurItem] ld [wd265], a pop af - ld [CurItem], a + ld [wCurItem], a call ReceiveItemFromPokemon jr nc, .bag_full ld hl, TookAndMadeHoldText call MenuTextBoxBackup ld a, [wd265] - ld [CurItem], a + ld [wCurItem], a call GivePartyItem ret .bag_full ld a, [wd265] - ld [CurItem], a + ld [wCurItem], a call ReceiveItemFromPokemon ld hl, ItemStorageIsFullText call MenuTextBoxBackup @@ -925,7 +925,7 @@ TryGiveItemToPartymon: ; 12bd9 GivePartyItem: ; 12c4c call GetPartyItemLocation - ld a, [CurItem] + ld a, [wCurItem] ld [hl], a ld d, a farcall ItemIsMail @@ -945,7 +945,7 @@ TakePartyItem: ; 12c60 and a jr z, .asm_12c8c - ld [CurItem], a + ld [wCurItem], a call ReceiveItemFromPokemon jr nc, .asm_12c94 @@ -1040,7 +1040,7 @@ GetPartyItemLocation: ; 12cd7 ReceiveItemFromPokemon: ; 12cdf ld a, $1 ld [wItemQuantityChangeBuffer], a - ld hl, NumItems + ld hl, wNumItems jp ReceiveItem ; 12cea @@ -1048,7 +1048,7 @@ ReceiveItemFromPokemon: ; 12cdf GiveItemToPokemon: ; 12cea (4:6cea) ld a, $1 ld [wItemQuantityChangeBuffer], a - ld hl, NumItems + ld hl, wNumItems jp TossItem StartMenuYesNo: ; 12cf5 @@ -1061,19 +1061,19 @@ StartMenuYesNo: ; 12cf5 ComposeMailMessage: ; 12cfe (4:6cfe) ld de, wTempMailMessage farcall _ComposeMailMessage - ld hl, PlayerName + ld hl, wPlayerName ld de, wTempMailAuthor ld bc, NAME_LENGTH - 1 call CopyBytes - ld hl, PlayerID + ld hl, wPlayerID ld bc, 2 call CopyBytes - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] ld [de], a inc de - ld a, [CurItem] + ld a, [wCurItem] ld [de], a - ld a, [CurPartyMon] + ld a, [wCurPartyMon] ld hl, sPartyMail ld bc, MAIL_STRUCT_LENGTH call AddNTimes @@ -1121,7 +1121,7 @@ MonMailAction: ; 12d45 ld hl, .sendmailtopctext call StartMenuYesNo jr c, .RemoveMailToBag - ld a, [CurPartyMon] + ld a, [wCurPartyMon] ld b, a farcall SendMailToPC jr c, .MailboxFull @@ -1140,7 +1140,7 @@ MonMailAction: ; 12d45 jr c, .done call GetPartyItemLocation ld a, [hl] - ld [CurItem], a + ld [wCurItem], a call ReceiveItemFromPokemon jr nc, .BagIsFull call GetPartyItemLocation @@ -1219,7 +1219,7 @@ OpenPartyStats: ; 12e00 call ClearSprites ; PartyMon xor a - ld [MonType], a + ld [wMonType], a call LowVolume predef StatsScreenInit call MaxVolume @@ -1379,7 +1379,7 @@ MonMenu_Softboiled_MilkDrink: ; 12ee6 .finish xor a - ld [PartyMenuActionText], a + ld [wPartyMenuActionText], a ld a, $3 ret ; 12f00 @@ -1448,7 +1448,7 @@ MonMenu_SweetScent: ; 12f50 ; 12f5b ChooseMoveToDelete: ; 12f5b - ld hl, Options + ld hl, wOptions ld a, [hl] push af set NO_TEXT_SCROLL, [hl] @@ -1456,7 +1456,7 @@ ChooseMoveToDelete: ; 12f5b call .ChooseMoveToDelete pop bc ld a, b - ld [Options], a + ld [wOptions], a push af call ClearBGPalettes pop af @@ -1513,16 +1513,16 @@ DeleteMoveScreenAttrs: ; 12fb2 ; 12fba ManagePokemonMoves: ; 12fba - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] cp EGG jr z, .egg - ld hl, Options + ld hl, wOptions ld a, [hl] push af set NO_TEXT_SCROLL, [hl] call MoveScreenLoop pop af - ld [Options], a + ld [wOptions], a call ClearBGPalettes .egg @@ -1531,7 +1531,7 @@ ManagePokemonMoves: ; 12fba ; 12fd5 MoveScreenLoop: ; 12fd5 - ld a, [CurPartyMon] + ld a, [wCurPartyMon] inc a ld [wPartyMenuCursor], a call SetUpMoveScreenBG @@ -1597,12 +1597,12 @@ MoveScreenLoop: ; 12fd5 and a jp nz, .joy_loop - ld a, [CurPartyMon] + ld a, [wCurPartyMon] ld b, a push bc call .cycle_right pop bc - ld a, [CurPartyMon] + ld a, [wCurPartyMon] cp b jp z, .joy_loop jp MoveScreenLoop @@ -1611,23 +1611,23 @@ MoveScreenLoop: ; 12fd5 ld a, [wMoveSwapBuffer] and a jp nz, .joy_loop - ld a, [CurPartyMon] + ld a, [wCurPartyMon] ld b, a push bc call .cycle_left pop bc - ld a, [CurPartyMon] + ld a, [wCurPartyMon] cp b jp z, .joy_loop jp MoveScreenLoop .cycle_right - ld a, [CurPartyMon] + ld a, [wCurPartyMon] inc a - ld [CurPartyMon], a + ld [wCurPartyMon], a ld c, a ld b, 0 - ld hl, PartySpecies + ld hl, wPartySpecies add hl, bc ld a, [hl] cp -1 @@ -1637,21 +1637,21 @@ MoveScreenLoop: ; 12fd5 jr .cycle_right .cycle_left - ld a, [CurPartyMon] + ld a, [wCurPartyMon] and a ret z .cycle_left_loop - ld a, [CurPartyMon] + ld a, [wCurPartyMon] dec a - ld [CurPartyMon], a + ld [wCurPartyMon], a ld c, a ld b, 0 - ld hl, PartySpecies + ld hl, wPartySpecies add hl, bc ld a, [hl] cp EGG ret nz - ld a, [CurPartyMon] + ld a, [wCurPartyMon] and a jr z, .cycle_right jr .cycle_left_loop @@ -1669,9 +1669,9 @@ MoveScreenLoop: ; 12fd5 jp .moving_move .place_move - ld hl, PartyMon1Moves + ld hl, wPartyMon1Moves ld bc, PARTYMON_STRUCT_LENGTH - ld a, [CurPartyMon] + ld a, [wCurPartyMon] call AddNTimes push hl call .copy_move @@ -1681,9 +1681,9 @@ MoveScreenLoop: ; 12fd5 call .copy_move ld a, [wBattleMode] jr z, .swap_moves - ld hl, BattleMonMoves + ld hl, wBattleMonMoves ld bc, $20 - ld a, [CurPartyMon] + ld a, [wCurPartyMon] call AddNTimes push hl call .copy_move @@ -1760,10 +1760,10 @@ SetUpMoveScreenBG: ; 13172 ld [hBGMapMode], a farcall LoadStatsScreenPageTilesGFX farcall ClearSpriteAnims2 - ld a, [CurPartyMon] + ld a, [wCurPartyMon] ld e, a ld d, $0 - ld hl, PartySpecies + ld hl, wPartySpecies add hl, de ld a, [hl] ld [wd265], a @@ -1781,9 +1781,9 @@ SetUpMoveScreenBG: ; 13172 lb bc, 2, 3 call ClearBox xor a - ld [MonType], a - ld hl, PartyMonNicknames - ld a, [CurPartyMon] + ld [wMonType], a + ld hl, wPartyMonNicknames + ld a, [wCurPartyMon] call GetNick hlcoord 5, 1 call PlaceString @@ -1791,7 +1791,7 @@ SetUpMoveScreenBG: ; 13172 farcall CopyPkmnToTempMon pop hl call PrintLevel - ld hl, PlayerHPPal + ld hl, wPlayerHPPal call SetHPPal ld b, SCGB_MOVE_LIST call GetSGBLayout @@ -1804,14 +1804,14 @@ SetUpMoveList: ; 131ef xor a ld [hBGMapMode], a ld [wMoveSwapBuffer], a - ld [MonType], a + ld [wMonType], a predef CopyPkmnToTempMon - ld hl, TempMonMoves + ld hl, wTempMonMoves ld de, wListMoves_MoveIndicesBuffer ld bc, NUM_MOVES call CopyBytes ld a, SCREEN_WIDTH * 2 - ld [Buffer1], a + ld [wBuffer1], a hlcoord 2, 3 predef ListMoves hlcoord 10, 4 @@ -1828,9 +1828,9 @@ SetUpMoveList: ; 131ef ; 13235 PrepareToPlaceMoveData: ; 13235 - ld hl, PartyMon1Moves + ld hl, wPartyMon1Moves ld bc, PARTYMON_STRUCT_LENGTH - ld a, [CurPartyMon] + ld a, [wCurPartyMon] call AddNTimes ld a, [wMenuCursorY] dec a @@ -1838,7 +1838,7 @@ PrepareToPlaceMoveData: ; 13235 ld b, $0 add hl, bc ld a, [hl] - ld [CurMove], a + ld [wCurMove], a hlcoord 1, 12 lb bc, 5, 18 jp ClearBox @@ -1856,11 +1856,11 @@ PlaceMoveData: ; 13256 hlcoord 12, 12 ld de, String_132ca call PlaceString - ld a, [CurMove] + ld a, [wCurMove] ld b, a hlcoord 2, 12 predef PrintMoveType - ld a, [CurMove] + ld a, [wCurMove] dec a ld hl, Moves + MOVE_POWER ld bc, MOVE_LENGTH @@ -1908,13 +1908,13 @@ Function132d3: ; 132d3 ; 132da Function132da: ; 132da - ld a, [CurPartyMon] + ld a, [wCurPartyMon] and a ret z ld c, a ld e, a ld d, 0 - ld hl, PartyCount + ld hl, wPartyCount add hl, de .loop ld a, [hl] @@ -1938,15 +1938,15 @@ Function132da: ; 132da ; 132fe Function132fe: ; 132fe - ld a, [CurPartyMon] + ld a, [wCurPartyMon] inc a ld c, a - ld a, [PartyCount] + ld a, [wPartyCount] cp c ret z ld e, c ld d, 0 - ld hl, PartySpecies + ld hl, wPartySpecies add hl, de .loop ld a, [hl] diff --git a/engine/stats_screen.asm b/engine/stats_screen.asm index a65cecc8a..e55c85c86 100755 --- a/engine/stats_screen.asm +++ b/engine/stats_screen.asm @@ -156,7 +156,7 @@ MonStatsInit: ; 4dd72 (13:5d72) call ClearTileMap farcall HDMATransferTileMapToWRAMBank3 call StatsScreen_CopyToTempMon - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] cp EGG jr z, .egg call StatsScreen_InitUpperHalf @@ -227,24 +227,24 @@ StatsScreenWaitCry: ; 4dde6 (13:5de6) ret StatsScreen_CopyToTempMon: ; 4ddf2 (13:5df2) - ld a, [MonType] + ld a, [wMonType] cp TEMPMON jr nz, .breedmon ld a, [wBufferMon] - ld [CurSpecies], a + ld [wCurSpecies], a call GetBaseData ld hl, wBufferMon - ld de, TempMon + ld de, wTempMon ld bc, PARTYMON_STRUCT_LENGTH call CopyBytes jr .done .breedmon farcall CopyPkmnToTempMon - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] cp EGG jr z, .done - ld a, [MonType] + ld a, [wMonType] cp BOXMON jr c, .done farcall CalcTempmonStats @@ -254,7 +254,7 @@ StatsScreen_CopyToTempMon: ; 4ddf2 (13:5df2) StatsScreen_GetJoypad: ; 4de2c (13:5e2c) call GetJoypad - ld a, [MonType] + ld a, [wMonType] cp TEMPMON jr nz, .notbreedmon push hl @@ -301,22 +301,22 @@ StatsScreen_JoypadAction: ; 4de54 (13:5e54) jr .done .d_down - ld a, [MonType] + ld a, [wMonType] cp BOXMON jr nc, .done and a - ld a, [PartyCount] + ld a, [wPartyCount] jr z, .next_mon - ld a, [OTPartyCount] + ld a, [wOTPartyCount] .next_mon ld b, a - ld a, [CurPartyMon] + ld a, [wCurPartyMon] inc a cp b jr z, .done - ld [CurPartyMon], a + ld [wCurPartyMon], a ld b, a - ld a, [MonType] + ld a, [wMonType] and a jr nz, .load_mon ld a, b @@ -325,13 +325,13 @@ StatsScreen_JoypadAction: ; 4de54 (13:5e54) jr .load_mon .d_up - ld a, [CurPartyMon] + ld a, [wCurPartyMon] and a jr z, .done dec a - ld [CurPartyMon], a + ld [wCurPartyMon], a ld b, a - ld a, [MonType] + ld a, [wMonType] and a jr nz, .load_mon ld a, b @@ -383,9 +383,9 @@ StatsScreen_InitUpperHalf: ; 4deea (13:5eea) call .PlaceHPBar xor a ld [hBGMapMode], a - ld a, [BaseDexNo] + ld a, [wBaseDexNo] ld [wd265], a - ld [CurSpecies], a + ld [wCurSpecies], a hlcoord 8, 0 ld [hl], "№" inc hl @@ -407,7 +407,7 @@ StatsScreen_InitUpperHalf: ; 4deea (13:5eea) hlcoord 9, 4 ld a, "/" ld [hli], a - ld a, [BaseDexNo] + ld a, [wBaseDexNo] ld [wd265], a call GetPokemonName call PlaceString @@ -417,11 +417,11 @@ StatsScreen_InitUpperHalf: ; 4deea (13:5eea) ret .PlaceHPBar: ; 4df45 (13:5f45) - ld hl, TempMonHP + ld hl, wTempMonHP ld a, [hli] ld b, a ld c, [hl] - ld hl, TempMonMaxHP + ld hl, wTempMonMaxHP ld a, [hli] ld d, a ld e, [hl] @@ -447,8 +447,8 @@ StatsScreen_InitUpperHalf: ; 4deea (13:5eea) ; 4df77 (13:5f77) .NicknamePointers: ; 4df77 - dw PartyMonNicknames - dw OTPartyMonNicknames + dw wPartyMonNicknames + dw wOTPartyMonNicknames dw sBoxMonNicknames dw wBufferMonNick ; 4df7f @@ -484,7 +484,7 @@ StatsScreen_PlacePageSwitchArrows: ; 4df9b (13:5f9b) ret StatsScreen_PlaceShinyIcon: ; 4dfa6 (13:5fa6) - ld bc, TempMonDVs + ld bc, wTempMonDVs farcall CheckShininess ret nc hlcoord 19, 0 @@ -492,9 +492,9 @@ StatsScreen_PlaceShinyIcon: ; 4dfa6 (13:5fa6) ret StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6) - ld a, [BaseDexNo] + ld a, [wBaseDexNo] ld [wd265], a - ld [CurSpecies], a + ld [wCurSpecies], a xor a ld [hBGMapMode], a call .ClearBox @@ -553,7 +553,7 @@ StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6) ld de, .Status_Type hlcoord 0, 12 call PlaceString - ld a, [TempMonPokerusStatus] + ld a, [wTempMonPokerusStatus] ld b, a and $f jr nz, .HasPokerus @@ -563,12 +563,12 @@ StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6) hlcoord 8, 8 ld [hl], "." ; Pokérus immunity dot .NotImmuneToPkrs: - ld a, [MonType] + ld a, [wMonType] cp BOXMON jr z, .StatusOK hlcoord 6, 13 push hl - ld de, TempMonStatus + ld de, wTempMonStatus predef PlaceStatusString pop hl jr nz, .done_status @@ -600,12 +600,12 @@ StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6) call .PrintNextLevel hlcoord 13, 10 lb bc, 3, 7 - ld de, TempMonExp + ld de, wTempMonExp call PrintNum call .CalcExpToNextLevel hlcoord 13, 13 lb bc, 3, 7 - ld de, Buffer1 + ld de, wBuffer1 call PrintNum ld de, .LevelUpStr hlcoord 10, 12 @@ -614,9 +614,9 @@ StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6) hlcoord 14, 14 call PlaceString hlcoord 11, 16 - ld a, [TempMonLevel] + ld a, [wTempMonLevel] ld b, a - ld de, TempMonExp + 2 + ld de, wTempMonExp + 2 predef FillInExpBar hlcoord 10, 16 ld [hl], $40 ; left exp bar end cap @@ -625,42 +625,42 @@ StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6) ret .PrintNextLevel: ; 4e0d3 (13:60d3) - ld a, [TempMonLevel] + ld a, [wTempMonLevel] push af cp MAX_LEVEL jr z, .AtMaxLevel inc a - ld [TempMonLevel], a + ld [wTempMonLevel], a .AtMaxLevel: call PrintLevel pop af - ld [TempMonLevel], a + ld [wTempMonLevel], a ret .CalcExpToNextLevel: ; 4e0e7 (13:60e7) - ld a, [TempMonLevel] + ld a, [wTempMonLevel] cp MAX_LEVEL jr z, .AlreadyAtMaxLevel inc a ld d, a farcall CalcExpAtLevel - ld hl, TempMonExp + 2 - ld hl, TempMonExp + 2 + ld hl, wTempMonExp + 2 + ld hl, wTempMonExp + 2 ld a, [hQuotient + 2] sub [hl] dec hl - ld [Buffer3], a + ld [wBuffer3], a ld a, [hQuotient + 1] sbc [hl] dec hl - ld [Buffer2], a + ld [wBuffer2], a ld a, [hQuotient] sbc [hl] - ld [Buffer1], a + ld [wBuffer1], a ret .AlreadyAtMaxLevel: - ld hl, Buffer1 + ld hl, wBuffer1 xor a ld [hli], a ld [hli], a @@ -703,23 +703,23 @@ StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6) ld de, .Move hlcoord 0, 10 call PlaceString - ld hl, TempMonMoves + ld hl, wTempMonMoves ld de, wListMoves_MoveIndicesBuffer ld bc, NUM_MOVES call CopyBytes hlcoord 8, 10 ld a, SCREEN_WIDTH * 2 - ld [Buffer1], a + ld [wBuffer1], a predef ListMoves hlcoord 12, 11 ld a, SCREEN_WIDTH * 2 - ld [Buffer1], a + ld [wBuffer1], a predef ListMovePP ret .GetItemName: ; 4e189 (13:6189) ld de, .ThreeDashes - ld a, [TempMonItem] + ld a, [wTempMonItem] and a ret z ld b, a @@ -767,7 +767,7 @@ StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6) call PlaceString hlcoord 2, 10 lb bc, PRINTNUM_LEADINGZEROS | 2, 5 - ld de, TempMonID + ld de, wTempMonID call PrintNum ld hl, .OTNamePointers call GetNicknamePointer @@ -775,7 +775,7 @@ StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6) farcall CheckNickErrors hlcoord 2, 13 call PlaceString - ld a, [TempMonCaughtGender] + ld a, [wTempMonCaughtGender] and a jr z, .done cp $7f @@ -792,8 +792,8 @@ StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6) ; 4e216 (13:6216) .OTNamePointers: ; 4e216 - dw PartyMonOT - dw OTPartyMonOT + dw wPartyMonOT + dw wOTPartyMonOT dw sBoxMonOT dw wBufferMonOT ; 4e21e @@ -807,7 +807,7 @@ OTString: ; 4e222 StatsScreen_PlaceFrontpic: ; 4e226 (13:6226) - ld hl, TempMonDVs + ld hl, wTempMonDVs predef GetUnownLetter call StatsScreen_GetAnimationParam jr c, .egg @@ -828,14 +828,14 @@ StatsScreen_PlaceFrontpic: ; 4e226 (13:6226) .cry call SetPalettes call .AnimateMon - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] call PlayMonCry2 ret .AnimateMon: ; 4e253 (13:6253) ld hl, wcf64 set 5, [hl] - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] cp UNOWN jr z, .unown hlcoord 0, 0 @@ -850,7 +850,7 @@ StatsScreen_PlaceFrontpic: ; 4e226 (13:6226) ret .AnimateEgg: ; 4e271 (13:6271) - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] cp UNOWN jr z, .unownegg ld a, TRUE @@ -865,7 +865,7 @@ StatsScreen_PlaceFrontpic: ; 4e226 (13:6226) ret .get_animation ; 4e289 (13:6289) - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] call IsAPokemon ret c call StatsScreen_LoadTextBoxSpaceGFX @@ -880,7 +880,7 @@ StatsScreen_PlaceFrontpic: ; 4e226 (13:6226) ret StatsScreen_GetAnimationParam: ; 4e2ad (13:62ad) - ld a, [MonType] + ld a, [wMonType] ld hl, .Jumptable rst JumpTable ret @@ -893,8 +893,8 @@ StatsScreen_GetAnimationParam: ; 4e2ad (13:62ad) dw .Wildmon .PartyMon: ; 4e2bf (13:62bf) - ld a, [CurPartyMon] - ld hl, PartyMon1 + ld a, [wCurPartyMon] + ld hl, wPartyMon1 ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes ld b, h @@ -908,7 +908,7 @@ StatsScreen_GetAnimationParam: ; 4e2ad (13:62ad) .BoxMon: ; 4e2d1 (13:62d1) ld hl, sBoxMons ld bc, PARTYMON_STRUCT_LENGTH - ld a, [CurPartyMon] + ld a, [wCurPartyMon] call AddNTimes ld b, h ld c, l @@ -921,11 +921,11 @@ StatsScreen_GetAnimationParam: ; 4e2ad (13:62ad) ret .Tempmon: ; 4e2ed (13:62ed) - ld bc, TempMonSpecies + ld bc, wTempMonSpecies jr .CheckEggFaintedFrzSlp ; utterly pointless .CheckEggFaintedFrzSlp: ; 4e2f2 (13:62f2) - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] cp EGG jr z, .egg call CheckFaintedFrzSlp @@ -996,7 +996,7 @@ EggStatsScreen: ; 4e33a ld de, FiveQMarkString hlcoord 11, 5 call PlaceString - ld a, [TempMonHappiness] ; egg status + ld a, [wTempMonHappiness] ; egg status ld de, EggSoonString cp $6 jr c, .picked @@ -1019,7 +1019,7 @@ EggStatsScreen: ; 4e33a farcall HDMATransferTileMapToWRAMBank3 call StatsScreen_AnimateEgg - ld a, [TempMonHappiness] + ld a, [wTempMonHappiness] cp 6 ret nc ld de, SFX_2_BOOPS @@ -1059,7 +1059,7 @@ EggALotMoreTimeString: ; 0x4e46e StatsScreen_AnimateEgg: ; 4e497 (13:6497) call StatsScreen_GetAnimationParam ret nc - ld a, [TempMonHappiness] + ld a, [wTempMonHappiness] ld e, $7 cp 6 jr c, .animate @@ -1116,11 +1116,11 @@ StatsScreen_LoadPageIndicators: ; 4e4cd (13:64cd) ret CopyNickname: ; 4e505 (13:6505) - ld de, StringBuffer1 + ld de, wStringBuffer1 ld bc, MON_NAME_LENGTH jr .okay ; utterly pointless .okay - ld a, [MonType] + ld a, [wMonType] cp BOXMON jr nz, .partymon ld a, BANK(sBoxMonNicknames) @@ -1138,7 +1138,7 @@ CopyNickname: ; 4e505 (13:6505) ret GetNicknamePointer: ; 4e528 (13:6528) - ld a, [MonType] + ld a, [wMonType] add a ld c, a ld b, 0 @@ -1146,10 +1146,10 @@ GetNicknamePointer: ; 4e528 (13:6528) ld a, [hli] ld h, [hl] ld l, a - ld a, [MonType] + ld a, [wMonType] cp TEMPMON ret z - ld a, [CurPartyMon] + ld a, [wCurPartyMon] jp SkipNames diff --git a/engine/tempmon.asm b/engine/tempmon.asm index be989d14b..03bec3755 100644 --- a/engine/tempmon.asm +++ b/engine/tempmon.asm @@ -1,20 +1,20 @@ CopyPkmnToTempMon: ; 5084a ; gets the BaseData of a Pkmn -; and copys the PkmnStructure to TempMon +; and copys the PkmnStructure to wTempMon - ld a, [CurPartyMon] + ld a, [wCurPartyMon] ld e, a call GetPkmnSpecies - ld a, [CurPartySpecies] - ld [CurSpecies], a + ld a, [wCurPartySpecies] + ld [wCurSpecies], a call GetBaseData - ld a, [MonType] - ld hl, PartyMon1Species + ld a, [wMonType] + ld hl, wPartyMon1Species ld bc, PARTYMON_STRUCT_LENGTH and a jr z, .copywholestruct - ld hl, OTPartyMon1Species + ld hl, wOTPartyMon1Species ld bc, PARTYMON_STRUCT_LENGTH cp OTPARTYMON jr z, .copywholestruct @@ -23,9 +23,9 @@ CopyPkmnToTempMon: ; 5084a jr .done .copywholestruct - ld a, [CurPartyMon] + ld a, [wCurPartyMon] call AddNTimes - ld de, TempMon + ld de, wTempMon ld bc, PARTYMON_STRUCT_LENGTH call CopyBytes @@ -37,12 +37,12 @@ CalcwBufferMonStats: ; 5088b jr _TempMonStatsCalculation CalcTempmonStats: ; 50890 - ld bc, TempMon + ld bc, wTempMon _TempMonStatsCalculation: ; 50893 ld hl, MON_LEVEL add hl, bc ld a, [hl] - ld [CurPartyLevel], a + ld [wCurPartyLevel], a ld hl, MON_MAXHP add hl, bc ld d, h @@ -57,7 +57,7 @@ _TempMonStatsCalculation: ; 50893 add hl, bc ld d, h ld e, l - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] cp EGG jr nz, .not_egg xor a @@ -83,10 +83,10 @@ _TempMonStatsCalculation: ; 50893 ret GetPkmnSpecies: ; 508d5 -; [MonType] has the type of the Pkmn -; e = Nr. of Pkmn (i.e. [CurPartyMon]) +; [wMonType] has the type of the Pkmn +; e = Nr. of Pkmn (i.e. [wCurPartyMon]) - ld a, [MonType] + ld a, [wMonType] and a ; PARTYMON jr z, .partymon cp OTPARTYMON @@ -98,11 +98,11 @@ GetPkmnSpecies: ; 508d5 ; WILDMON .partymon - ld hl, PartySpecies + ld hl, wPartySpecies jr .done .otpartymon - ld hl, OTPartySpecies + ld hl, wOTPartySpecies jr .done .boxmon @@ -123,5 +123,5 @@ GetPkmnSpecies: ; 508d5 ld a, [hl] .done2 - ld [CurPartySpecies], a + ld [wCurPartySpecies], a ret diff --git a/engine/tile_events.asm b/engine/tile_events.asm index 23a7a3c85..705c0e427 100755 --- a/engine/tile_events.asm +++ b/engine/tile_events.asm @@ -1,6 +1,6 @@ CheckWarpCollision:: ; 1499a ; Is this tile a warp? - ld a, [PlayerStandingTile] + ld a, [wPlayerStandingTile] cp COLL_PIT jr z, .warp cp COLL_PIT_68 @@ -19,7 +19,7 @@ CheckWarpCollision:: ; 1499a CheckDirectionalWarp:: ; 149af ; If this is a directional warp, clear carry (press the designated button to warp). ; Else, set carry (immediate warp). - ld a, [PlayerStandingTile] + ld a, [wPlayerStandingTile] cp COLL_WARP_CARPET_DOWN jr z, .directional cp COLL_WARP_CARPET_LEFT @@ -39,7 +39,7 @@ CheckDirectionalWarp:: ; 149af CheckWarpFacingDown: ; 149c6 ld de, 1 ld hl, .blocks - ld a, [PlayerStandingTile] + ld a, [wPlayerStandingTile] call IsInArray ret ; 149d3 @@ -58,7 +58,7 @@ CheckWarpFacingDown: ; 149c6 ; 149dd CheckGrassCollision:: ; 149dd - ld a, [PlayerStandingTile] + ld a, [wPlayerStandingTile] ld hl, .blocks ld de, 1 call IsInArray @@ -98,7 +98,7 @@ CheckCutCollision: ; 149f5 ; 14a07 GetWarpSFX:: ; 14a07 - ld a, [PlayerStandingTile] + ld a, [wPlayerStandingTile] ld de, SFX_ENTER_DOOR cp COLL_DOOR ret z diff --git a/engine/tileset_anims.asm b/engine/tileset_anims.asm index 5113ae9a3..9c32d7821 100644 --- a/engine/tileset_anims.asm +++ b/engine/tileset_anims.asm @@ -4,9 +4,9 @@ _AnimateTileset:: ; fc000 ; Typically in wra1, vra0 - ld a, [TilesetAnim] + ld a, [wTilesetAnim] ld e, a - ld a, [TilesetAnim + 1] + ld a, [wTilesetAnim + 1] ld d, a ld a, [hTileAnimFrame] @@ -301,20 +301,20 @@ WaitTileAnimation: ; fc2fe ; fc2ff StandingTileFrame8: ; fc2ff - ld a, [TileAnimationTimer] + ld a, [wTileAnimationTimer] inc a and %111 - ld [TileAnimationTimer], a + ld [wTileAnimationTimer], a ret ; fc309 ScrollTileRightLeft: ; fc309 ; Scroll right for 4 ticks, then left for 4 ticks. - ld a, [TileAnimationTimer] + ld a, [wTileAnimationTimer] inc a and %111 - ld [TileAnimationTimer], a + ld [wTileAnimationTimer], a and %100 jr nz, ScrollTileLeft jr ScrollTileRight @@ -322,10 +322,10 @@ ScrollTileRightLeft: ; fc309 ScrollTileUpDown: ; fc318 ; Scroll up for 4 ticks, then down for 4 ticks. - ld a, [TileAnimationTimer] + ld a, [wTileAnimationTimer] inc a and %111 - ld [TileAnimationTimer], a + ld [wTileAnimationTimer], a and %100 jr nz, ScrollTileDown jr ScrollTileUp @@ -423,7 +423,7 @@ AnimateFountain: ; fc387 ld b, h ld c, l ld hl, .frames - ld a, [TileAnimationTimer] + ld a, [wTileAnimationTimer] and %111 add a add l @@ -465,7 +465,7 @@ AnimateWaterTile: ; fc402 ld b, h ld c, l - ld a, [TileAnimationTimer] + ld a, [wTileAnimationTimer] ; 4 tile graphics, updated every other frame. and %110 @@ -481,7 +481,7 @@ AnimateWaterTile: ; fc402 adc HIGH(WaterTileFrames) ld h, a -; Stack now points to the start of the tile for this frame. +; The stack now points to the start of the tile for this frame. ld sp, hl ld l, e @@ -508,7 +508,7 @@ ForestTreeLeftAnimation: ; fc45c jr .asm_fc47d .asm_fc46c - ld a, [TileAnimationTimer] + ld a, [wTileAnimationTimer] call GetForestTreeFrame add a add a @@ -550,7 +550,7 @@ ForestTreeRightAnimation: ; fc4c4 jr .asm_fc4eb .asm_fc4d4 - ld a, [TileAnimationTimer] + ld a, [wTileAnimationTimer] call GetForestTreeFrame add a add a @@ -585,7 +585,7 @@ ForestTreeLeftAnimation2: ; fc4f2 jr .asm_fc515 .asm_fc502 - ld a, [TileAnimationTimer] + ld a, [wTileAnimationTimer] call GetForestTreeFrame xor 2 add a @@ -617,7 +617,7 @@ ForestTreeRightAnimation2: ; fc51c jr .asm_fc545 .asm_fc52c - ld a, [TileAnimationTimer] + ld a, [wTileAnimationTimer] call GetForestTreeFrame xor 2 add a @@ -675,7 +675,7 @@ AnimateFlowerTile: ; fc56d ld c, l ; Alternate tile graphic every other frame - ld a, [TileAnimationTimer] + ld a, [wTileAnimationTimer] and %10 ld e, a @@ -709,7 +709,7 @@ LavaBubbleAnim1: ; fc5cc ld hl, sp+0 ld b, h ld c, l - ld a, [TileAnimationTimer] + ld a, [wTileAnimationTimer] and %110 srl a inc a @@ -731,7 +731,7 @@ LavaBubbleAnim2: ; fc5eb ld hl, sp+0 ld b, h ld c, l - ld a, [TileAnimationTimer] + ld a, [wTileAnimationTimer] and %110 add a add a @@ -763,7 +763,7 @@ AnimateTowerPillarTile: ; fc645 ld b, h ld c, l - ld a, [TileAnimationTimer] + ld a, [wTileAnimationTimer] and %111 ; Get frame index a @@ -803,7 +803,7 @@ AnimateTowerPillarTile: ; fc645 StandingTileFrame: ; fc673 - ld hl, TileAnimationTimer + ld hl, wTileAnimationTimer inc [hl] ret ; fc678 @@ -833,7 +833,7 @@ AnimateWhirlpoolTile: ; fc678 ; Tile address is now at hl. ; Get the tile for this frame. - ld a, [TileAnimationTimer] + ld a, [wTileAnimationTimer] and %11 ; 4 frames x2 swap a ; * 16 bytes per tile @@ -845,7 +845,7 @@ AnimateWhirlpoolTile: ; fc678 adc h ld h, a -; Stack now points to the desired frame. +; The stack now points to the desired frame. ld sp, hl ld l, e @@ -929,7 +929,7 @@ TileAnimationPalette: ; fc6d7 ret nz ; Only update on even frames. - ld a, [TileAnimationTimer] + ld a, [wTileAnimationTimer] ld l, a and 1 ; odd ret nz diff --git a/engine/tileset_palettes.asm b/engine/tileset_palettes.asm index 5a2190fc7..e2c39c0ab 100644 --- a/engine/tileset_palettes.asm +++ b/engine/tileset_palettes.asm @@ -1,5 +1,5 @@ LoadSpecialMapPalette: ; 494ac - ld a, [wTileset] + ld a, [wMapTileset] cp TILESET_POKECOM_CENTER jr z, .pokecom_2f cp TILESET_BATTLE_TOWER diff --git a/engine/time.asm b/engine/time.asm index 29c811810..9013fd79f 100755 --- a/engine/time.asm +++ b/engine/time.asm @@ -188,13 +188,13 @@ CheckBugContestTimer:: ; 114a4 (4:54a4) InitializeStartDay: ; 114dd call UpdateTime - ld hl, wStartDay + ld hl, wTimerEventStartDay call CopyDayToHL ret ; 114e7 CheckPokerusTick:: ; 114e7 - ld hl, wStartDay + ld hl, wTimerEventStartDay call CalcDaysSince call GetDaysSince and a @@ -271,15 +271,15 @@ DoMysteryGiftIfDayHasPassed: ; 11548 call GetSRAMBank ld hl, sMysteryGiftTimer ld a, [hli] - ld [Buffer1], a + ld [wBuffer1], a ld a, [hl] - ld [Buffer2], a + ld [wBuffer2], a call CloseSRAM - ld hl, Buffer1 + ld hl, wBuffer1 call CheckDayDependentEventHL jr nc, .not_timed_out - ld hl, Buffer1 + ld hl, wBuffer1 call InitOneDayCountdown call CloseSRAM farcall Function1050c8 @@ -287,7 +287,7 @@ DoMysteryGiftIfDayHasPassed: ; 11548 .not_timed_out ld a, BANK(sMysteryGiftTimer) call GetSRAMBank - ld hl, Buffer1 + ld hl, wBuffer1 ld a, [hli] ld [sMysteryGiftTimer], a ld a, [hl] @@ -417,7 +417,7 @@ _CalcHoursDaysSince: ; 115f8 ld [wHoursSince], a ; hours since _CalcDaysSince: - ld a, [CurDay] + ld a, [wCurDay] ld c, a sbc [hl] jr nc, .skip @@ -429,7 +429,7 @@ _CalcDaysSince: ; 11613 CopyDayHourMinSecToHL: ; 11613 - ld a, [CurDay] + ld a, [wCurDay] ld [hli], a ld a, [hHours] ld [hli], a @@ -441,13 +441,13 @@ CopyDayHourMinSecToHL: ; 11613 ; 11621 CopyDayToHL: ; 11621 - ld a, [CurDay] + ld a, [wCurDay] ld [hl], a ret ; 11626 CopyDayHourToHL: ; 11626 - ld a, [CurDay] + ld a, [wCurDay] ld [hli], a ld a, [hHours] ld [hli], a @@ -455,7 +455,7 @@ CopyDayHourToHL: ; 11626 ; 1162e CopyDayHourMinToHL: ; 1162e - ld a, [CurDay] + ld a, [wCurDay] ld [hli], a ld a, [hHours] ld [hli], a diff --git a/engine/time_capsule.asm b/engine/time_capsule.asm index 96f61833b..e366c1bbd 100755 --- a/engine/time_capsule.asm +++ b/engine/time_capsule.asm @@ -2,14 +2,14 @@ ValidateOTTrademon: ; fb57e ld a, [wd003] - ld hl, OTPartyMon1Species + ld hl, wOTPartyMon1Species call GetPartyLocation push hl ld a, [wd003] inc a ld c, a ld b, 0 - ld hl, OTPartyCount + ld hl, wOTPartyCount add hl, bc ld a, [hl] pop hl @@ -29,7 +29,7 @@ ValidateOTTrademon: ; fb57e ld a, [wLinkMode] cp LINK_TIMECAPSULE jr nz, .normal - ld hl, OTPartySpecies + ld hl, wOTPartySpecies ld a, [wd003] ld c, a ld b, 0 @@ -43,16 +43,16 @@ ValidateOTTrademon: ; fb57e cp MAGNETON jr z, .normal - ld [CurSpecies], a + ld [wCurSpecies], a call GetBaseData ld hl, wLinkOTPartyMonTypes add hl, bc add hl, bc - ld a, [BaseType1] + ld a, [wBaseType1] cp [hl] jr nz, .abnormal inc hl - ld a, [BaseType2] + ld a, [wBaseType2] cp [hl] jr nz, .abnormal @@ -68,7 +68,7 @@ ValidateOTTrademon: ; fb57e Functionfb5dd: ; fb5dd ld a, [wd002] ld d, a - ld a, [PartyCount] + ld a, [wPartyCount] ld b, a ld c, $0 .loop @@ -77,7 +77,7 @@ Functionfb5dd: ; fb5dd jr z, .next push bc ld a, c - ld hl, PartyMon1HP + ld hl, wPartyMon1HP call GetPartyLocation pop bc ld a, [hli] @@ -89,7 +89,7 @@ Functionfb5dd: ; fb5dd dec b jr nz, .loop ld a, [wd003] - ld hl, OTPartyMon1HP + ld hl, wOTPartyMon1HP call GetPartyLocation ld a, [hli] or [hl] @@ -104,20 +104,20 @@ Functionfb5dd: ; fb5dd PlaceTradePartnerNamesAndParty: ; fb60d hlcoord 4, 0 - ld de, PlayerName + ld de, wPlayerName call PlaceString ld a, $14 ld [bc], a hlcoord 4, 8 - ld de, OTPlayerName + ld de, wOTPlayerName call PlaceString ld a, $14 ld [bc], a hlcoord 7, 1 - ld de, PartySpecies + ld de, wPartySpecies call .PlaceSpeciesNames hlcoord 7, 9 - ld de, OTPartySpecies + ld de, wOTPartySpecies .PlaceSpeciesNames: ; fb634 ld c, $0 .loop diff --git a/engine/timeofdaypals.asm b/engine/timeofdaypals.asm index 6dfa5657a..781c2e91a 100644 --- a/engine/timeofdaypals.asm +++ b/engine/timeofdaypals.asm @@ -4,10 +4,10 @@ DummyPredef36: UpdateTimeOfDayPal:: ; 8c001 call UpdateTime - ld a, [TimeOfDay] - ld [CurTimeOfDay], a + ld a, [wTimeOfDay] + ld [wCurTimeOfDay], a call GetTimePalette - ld [TimeOfDayPal], a + ld [wTimeOfDayPal], a ret ; 8c011 @@ -21,25 +21,25 @@ _TimeOfDayPals:: ; 8c011 jr nz, .dontchange ; do we need to bother updating? - ld a, [TimeOfDay] - ld hl, CurTimeOfDay + ld a, [wTimeOfDay] + ld hl, wCurTimeOfDay cp [hl] jr z, .dontchange ; if so, the time of day has changed - ld a, [TimeOfDay] - ld [CurTimeOfDay], a + ld a, [wTimeOfDay] + ld [wCurTimeOfDay], a ; get palette id call GetTimePalette ; same palette as before? - ld hl, TimeOfDayPal + ld hl, wTimeOfDayPal cp [hl] jr z, .dontchange ; update palette id - ld [TimeOfDayPal], a + ld [wTimeOfDayPal], a ; save bg palette 7 ld hl, wBGPals1 palette PAL_BG_TEXT @@ -240,7 +240,7 @@ ReplaceTimeOfDayPals: ; 8c0e5 ; 8c117 GetTimePalette: ; 8c117 - ld a, [TimeOfDay] + ld a, [wTimeOfDay] ld e, a ld d, 0 ld hl, .TimePalettes @@ -336,7 +336,7 @@ GetTimePalFade: ; 8c17c ; else: dmg ; index - ld a, [TimeOfDayPal] + ld a, [wTimeOfDayPal] and %11 ; get fade table diff --git a/engine/timeset.asm b/engine/timeset.asm index 67aa9973e..99e4e6843 100755 --- a/engine/timeset.asm +++ b/engine/timeset.asm @@ -11,11 +11,11 @@ InitClock: ; 90672 (24:4672) ld a, $0 ld [wSpriteUpdatesEnabled], a ld a, $10 - ld [MusicFade], a + ld [wMusicFade], a ld a, LOW(MUSIC_NONE) - ld [MusicFadeID], a + ld [wMusicFadeID], a ld a, HIGH(MUSIC_NONE) - ld [MusicFadeID + 1], a + ld [wMusicFadeID + 1], a ld c, 8 call DelayFrames call RotateFourPalettesLeft @@ -72,7 +72,7 @@ InitClock: ; 90672 (24:4672) jr nc, .SetHourLoop ld a, [wInitHourBuffer] - ld [StringBuffer2 + 1], a + ld [wStringBuffer2 + 1], a call .ClearScreen ld hl, Text_WhatHrs call PrintText @@ -102,7 +102,7 @@ InitClock: ; 90672 (24:4672) jr nc, .SetMinutesLoop ld a, [wInitMinuteBuffer] - ld [StringBuffer2 + 2], a + ld [wStringBuffer2 + 2], a call .ClearScreen ld hl, Text_WhoaMins call PrintText @@ -453,7 +453,7 @@ Special_SetDayOfWeek: ; 90913 call YesNoBox jr c, .loop ld a, [wTempDayOfWeek] - ld [StringBuffer2], a + ld [wStringBuffer2], a call SetDayOfWeek call LoadStandardFont pop af @@ -534,7 +534,7 @@ Special_SetDayOfWeek: ; 90913 ; 909f2 .WeekdayStrings: ; 909f2 -; entries correspond to CurDay constants (see constants/wram_constants.asm) +; entries correspond to wCurDay constants (see constants/wram_constants.asm) dw .Sunday dw .Monday dw .Tuesday @@ -667,7 +667,7 @@ DebugDisplayTime: ; 90abc ld [hl], " " inc hl - ld de, StartDay + ld de, wStartDay call .PrintTime ld [hl], " " diff --git a/engine/title.asm b/engine/title.asm index 55ba145bf..310e4d164 100644 --- a/engine/title.asm +++ b/engine/title.asm @@ -162,7 +162,7 @@ _TitleScreen: ; 10ed67 ld a, [rSVBK] push af - ld a, BANK(LYOverrides) + ld a, BANK(wLYOverrides) ld [rSVBK], a ; Make alternating lines come in from opposite sides @@ -171,7 +171,7 @@ _TitleScreen: ; 10ed67 ; see anything until these values are overwritten!) ld b, 80 / 2 ; alternate for 80 lines - ld hl, LYOverrides + ld hl, wLYOverrides .loop ; $00 is the middle position ld [hl], +112 ; coming from the left @@ -182,9 +182,9 @@ _TitleScreen: ; 10ed67 jr nz, .loop ; Make sure the rest of the buffer is empty - ld hl, LYOverrides + 80 + ld hl, wLYOverrides + 80 xor a - ld bc, LYOverridesEnd - (LYOverrides + 80) + ld bc, wLYOverridesEnd - (wLYOverrides + 80) call ByteFill ; Let LCD Stat know we're messing around with SCX @@ -323,7 +323,7 @@ DrawTitleGraphic: ; 10eeef ; 10ef06 InitializeBackground: ; 10ef06 - ld hl, Sprite01 + ld hl, wVirtualOAMSprite00 ld d, -$22 ld e, $0 ld c, 5 @@ -366,7 +366,7 @@ AnimateTitleCrystal: ; 10ef32 ; Stop at y=6 ; y is really from the bottom of the sprite, which is two tiles high - ld hl, Sprite01YCoord + ld hl, wVirtualOAMSprite00YCoord ld a, [hl] cp 6 + 2 * TILE_WIDTH ret z diff --git a/engine/tmhm.asm b/engine/tmhm.asm index 1cdbe1fff..9db3dc291 100755 --- a/engine/tmhm.asm +++ b/engine/tmhm.asm @@ -1,8 +1,8 @@ CanLearnTMHMMove: ; 11639 - ld a, [CurPartySpecies] - ld [CurSpecies], a + ld a, [wCurPartySpecies] + ld [wCurSpecies], a call GetBaseData - ld hl, BaseTMHM + ld hl, wBaseTMHM push hl ld a, [wPutativeTMHMMove] diff --git a/engine/tmhm2.asm b/engine/tmhm2.asm index e000ef6ba..442f73cfa 100755 --- a/engine/tmhm2.asm +++ b/engine/tmhm2.asm @@ -7,10 +7,10 @@ TMHMPocket: ; 2c76f (b:476f) ret nc call PlaceHollowCursor call WaitBGMap - ld a, [CurItem] + ld a, [wCurItem] dec a - ld [CurItemQuantity], a - ld hl, TMsHMs + ld [wCurItemQuantity], a + ld hl, wTMsHMs ld c, a ld b, 0 add hl, bc @@ -21,15 +21,15 @@ TMHMPocket: ; 2c76f (b:476f) ret .ConvertItemToTMHMNumber: ; 2c798 (b:4798) - ld a, [CurItem] + ld a, [wCurItem] ld c, a callfar GetNumberedTMHM ld a, c - ld [CurItem], a + ld [wCurItem], a ret ConvertCurItemIntoCurTMHM: ; 2c7a7 (b:47a7) - ld a, [CurItem] + ld a, [wCurItem] ld c, a callfar GetTMHMNumber ld a, c @@ -42,11 +42,11 @@ GetTMHMItemMove: ; 2c7b6 (b:47b6) ret AskTeachTMHM: ; 2c7bf (b:47bf) - ld hl, Options + ld hl, wOptions ld a, [hl] push af res NO_TEXT_SCROLL, [hl] - ld a, [CurItem] + ld a, [wCurItem] cp TM01 jr c, .NotTMHM call GetTMHMItemMove @@ -55,7 +55,7 @@ AskTeachTMHM: ; 2c7bf (b:47bf) call GetMoveName call CopyName1 ld hl, Text_BootedTM ; Booted up a TM - ld a, [CurItem] + ld a, [wCurItem] cp HM01 jr c, .TM ld hl, Text_BootedHM ; Booted up an HM @@ -67,11 +67,11 @@ AskTeachTMHM: ; 2c7bf (b:47bf) .NotTMHM: pop bc ld a, b - ld [Options], a + ld [wOptions], a ret ChooseMonToLearnTMHM: ; 2c7fb - ld hl, StringBuffer2 + ld hl, wStringBuffer2 ld de, wTMHMMoveNameBackup ld bc, 12 call CopyBytes @@ -81,7 +81,7 @@ ChooseMonToLearnTMHM_NoRefresh: ; 2c80a farcall InitPartyMenuWithCancel farcall InitPartyMenuGFX ld a, PARTYMENUACTION_TEACH_TMHM - ld [PartyMenuActionText], a + ld [wPartyMenuActionText], a .loopback farcall WritePartyMenuTilemap farcall PrintPartyMenuText @@ -90,13 +90,13 @@ ChooseMonToLearnTMHM_NoRefresh: ; 2c80a call DelayFrame farcall PartyMenuSelect push af - ld a, [CurPartySpecies] + ld a, [wCurPartySpecies] cp EGG pop bc ; now contains the former contents of af jr z, .egg push bc ld hl, wTMHMMoveNameBackup - ld de, StringBuffer2 + ld de, wStringBuffer2 ld bc, 12 call CopyBytes pop af ; now contains the original contents of af @@ -121,8 +121,8 @@ TeachTMHM: ; 2c867 predef CanLearnTMHMMove push bc - ld a, [CurPartyMon] - ld hl, PartyMonNicknames + ld a, [wCurPartyMon] + ld hl, wPartyMonNicknames call GetNick pop bc @@ -147,7 +147,7 @@ TeachTMHM: ; 2c867 jr z, .nope farcall StubbedTrainerRankings_TMsHMsTaught - ld a, [CurItem] + ld a, [wCurItem] call IsHM ret c @@ -254,13 +254,13 @@ TMHM_ShowTMMoveDescription: ; 2c946 (b:4946) ld b, 4 ld c, SCREEN_WIDTH - 2 call TextBox - ld a, [CurItem] + ld a, [wCurItem] cp NUM_TMS + NUM_HMS + 1 jr nc, TMHM_JoypadLoop ld [wd265], a predef GetTMHMMove ld a, [wd265] - ld [CurSpecies], a + ld [wCurSpecies], a hlcoord 1, 14 call PrintMoveDesc jp TMHM_JoypadLoop @@ -293,7 +293,7 @@ TMHM_CheckHoveringOverCancel: ; 2c98a (b:498a) jr nz, .loop ld a, c .okay - ld [CurItem], a + ld [wCurItem], a cp -1 ret @@ -340,7 +340,7 @@ TMHM_ScrollPocket: ; 2c9b1 (b:49b1) jp TMHM_ShowTMMoveDescription TMHM_DisplayPocketItems: ; 2c9e2 (b:49e2) - ld a, [BattleType] + ld a, [wBattleType] cp BATTLETYPE_TUTORIAL jp z, Tutorial_TMHMPocket @@ -466,7 +466,7 @@ TMHM_String_Cancel: ; 2caae ; 2cab5 TMHM_GetCurrentPocketPosition: ; 2cab5 (b:4ab5) - ld hl, TMsHMs + ld hl, wTMsHMs ld a, [wTMHMPocketScrollPosition] ld b, a inc b @@ -523,7 +523,7 @@ Unreferenced_Function2cadf: ; 2cadf .CheckHaveRoomForTMHM: ; 2cafa ld a, [wd265] dec a - ld hl, TMsHMs + ld hl, wTMsHMs ld b, 0 ld c, a add hl, bc @@ -539,7 +539,7 @@ ConsumeTM: ; 2cb0c (b:4b0c) call ConvertCurItemIntoCurTMHM ld a, [wd265] dec a - ld hl, TMsHMs + ld hl, wTMsHMs ld b, 0 ld c, a add hl, bc @@ -559,7 +559,7 @@ ConsumeTM: ; 2cb0c (b:4b0c) CountTMsHMs: ; 2cb2a (b:4b2a) ld b, 0 ld c, NUM_TMS + NUM_HMS - ld hl, TMsHMs + ld hl, wTMsHMs .loop ld a, [hli] and a @@ -575,7 +575,7 @@ CountTMsHMs: ; 2cb2a (b:4b2a) PrintMoveDesc: ; 2cb3e push hl ld hl, MoveDescriptions - ld a, [CurSpecies] + ld a, [wCurSpecies] dec a ld c, a ld b, 0 diff --git a/engine/trade_animation.asm b/engine/trade_animation.asm index d662a7894..04c31df80 100755 --- a/engine/trade_animation.asm +++ b/engine/trade_animation.asm @@ -119,11 +119,11 @@ RunTradeAnimScript: ; 28fa1 push af xor a ld [hMapAnims], a - ld hl, VramState + ld hl, wVramState ld a, [hl] push af res 0, [hl] - ld hl, Options + ld hl, wOptions ld a, [hl] push af set 4, [hl] @@ -137,9 +137,9 @@ RunTradeAnimScript: ; 28fa1 call DoTradeAnimation jr nc, .anim_loop pop af - ld [Options], a + ld [wOptions], a pop af - ld [VramState], a + ld [wVramState], a pop af ld [hMapAnims], a ret @@ -831,11 +831,11 @@ TradeAnim_ScrollOutRight2: ; 2940c TradeAnim_ShowGivemonData: ; 2942e call ShowPlayerTrademonStats ld a, [wPlayerTrademonSpecies] - ld [CurPartySpecies], a + ld [wCurPartySpecies], a ld a, [wPlayerTrademonDVs] - ld [TempMonDVs], a + ld [wTempMonDVs], a ld a, [wPlayerTrademonDVs + 1] - ld [TempMonDVs + 1], a + ld [wTempMonDVs + 1], a ld b, SCGB_PLAYER_OR_MON_FRONTPIC_PALS call GetSGBLayout ld a, %11100100 ; 3,2,1,0 @@ -858,11 +858,11 @@ TradeAnim_ShowGivemonData: ; 2942e TradeAnim_ShowGetmonData: ; 29461 call ShowOTTrademonStats ld a, [wOTTrademonSpecies] - ld [CurPartySpecies], a + ld [wCurPartySpecies], a ld a, [wOTTrademonDVs] - ld [TempMonDVs], a + ld [wTempMonDVs], a ld a, [wOTTrademonDVs + 1] - ld [TempMonDVs + 1], a + ld [wTempMonDVs + 1], a ld b, SCGB_PLAYER_OR_MON_FRONTPIC_PALS call GetSGBLayout ld a, %11100100 ; 3,2,1,0 @@ -885,8 +885,8 @@ TradeAnim_GetFrontpic: ; 29491 push af predef GetUnownLetter pop af - ld [CurPartySpecies], a - ld [CurSpecies], a + ld [wCurPartySpecies], a + ld [wCurSpecies], a call GetBaseData pop de predef GetMonFrontpic @@ -898,7 +898,7 @@ TradeAnim_GetNickname: ; 294a9 push de ld [wd265], a call GetPokemonName - ld hl, StringBuffer1 + ld hl, wStringBuffer1 pop de ld bc, NAME_LENGTH call CopyBytes diff --git a/engine/trainer_card.asm b/engine/trainer_card.asm index 6d59660f7..cd6705e5c 100755 --- a/engine/trainer_card.asm +++ b/engine/trainer_card.asm @@ -9,11 +9,11 @@ const TRAINERCARDSTATE_QUIT ; 6 TrainerCard: ; 25105 - ld a, [VramState] + ld a, [wVramState] push af xor a - ld [VramState], a - ld hl, Options + ld [wVramState], a + ld hl, wOptions ld a, [hl] push af set NO_TEXT_SCROLL, [hl] @@ -33,9 +33,9 @@ TrainerCard: ; 25105 .quit pop af - ld [Options], a + ld [wOptions], a pop af - ld [VramState], a + ld [wVramState], a ret .InitRAM: ; 2513b (9:513b) @@ -237,14 +237,14 @@ TrainerCard_PrintTopHalfOfCard: ; 25299 (9:5299) ld de, .ID_No call TrainerCardSetup_PlaceTilemapString hlcoord 7, 2 - ld de, PlayerName + ld de, wPlayerName call PlaceString hlcoord 5, 4 - ld de, PlayerID + ld de, wPlayerID lb bc, PRINTNUM_LEADINGZEROS | 2, 5 call PrintNum hlcoord 7, 6 - ld de, Money + ld de, wMoney lb bc, PRINTNUM_MONEY | 3, 6 call PrintNum hlcoord 1, 3 @@ -278,8 +278,8 @@ TrainerCard_Page1_PrintDexCaught_GameTime: ; 2530a (9:530a) hlcoord 10, 15 ld de, .Badges call PlaceString - ld hl, PokedexCaught - ld b, EndPokedexCaught - PokedexCaught + ld hl, wPokedexCaught + ld b, wEndPokedexCaught - wPokedexCaught call CountSetBits ld de, wd265 hlcoord 15, 10 @@ -444,11 +444,11 @@ TrainerCard_Page2_3_PlaceLeadersFaces: ; 253f4 (9:53f4) TrainerCard_Page1_PrintGameTime: ; 25415 (9:5415) hlcoord 11, 12 - ld de, GameTimeHours + ld de, wGameTimeHours lb bc, 2, 4 call PrintNum inc hl - ld de, GameTimeMinutes + ld de, wGameTimeMinutes lb bc, PRINTNUM_LEADINGZEROS | 1, 2 call PrintNum ld a, [hVBlankCounter] @@ -479,7 +479,7 @@ TrainerCard_Page2_3_OAMUpdate: ; 25448 (9:5448) ld d, a ld a, [de] ld c, a - ld de, Sprite01 + ld de, wVirtualOAMSprite00 ld b, NUM_JOHTO_BADGES .loop srl c diff --git a/engine/types.asm b/engine/types.asm index 931e98b92..dc0df61ae 100644 --- a/engine/types.asm +++ b/engine/types.asm @@ -1,5 +1,5 @@ PrintMonTypes: ; 5090d -; Print one or both types of [CurSpecies] +; Print one or both types of [wCurSpecies] ; on the stats screen at hl. push hl @@ -7,14 +7,14 @@ PrintMonTypes: ; 5090d pop hl push hl - ld a, [BaseType1] + ld a, [wBaseType1] call .Print ; Single-typed monsters really ; have two of the same type. - ld a, [BaseType1] + ld a, [wBaseType1] ld b, a - ld a, [BaseType2] + ld a, [wBaseType2] cp b pop hl jr z, .hide_type_2 @@ -49,10 +49,10 @@ PrintMoveType: ; 5093a ld bc, MOVE_LENGTH ld hl, Moves call AddNTimes - ld de, StringBuffer1 + ld de, wStringBuffer1 ld a, BANK(Moves) call FarCopyBytes - ld a, [StringBuffer1 + MOVE_TYPE] + ld a, [wStringBuffer1 + MOVE_TYPE] pop hl ld b, a @@ -79,7 +79,7 @@ PrintType: ; 50953 GetTypeName: ; 50964 -; Copy the name of type [wd265] to StringBuffer1. +; Copy the name of type [wd265] to wStringBuffer1. ld a, [wd265] ld hl, TypeNames @@ -90,7 +90,7 @@ GetTypeName: ; 50964 ld a, [hli] ld h, [hl] ld l, a - ld de, StringBuffer1 + ld de, wStringBuffer1 ld bc, MOVE_NAME_LENGTH jp CopyBytes ; 5097b diff --git a/engine/unown_puzzle.asm b/engine/unown_puzzle.asm index 36f6dacd2..dcad1ce20 100755 --- a/engine/unown_puzzle.asm +++ b/engine/unown_puzzle.asm @@ -549,7 +549,7 @@ RedrawUnownPuzzlePieces: ; e14d9 ld hl, .OAM_NotHoldingPiece .load - ld de, Sprite01 + ld de, wVirtualOAMSprite00 .loop ld a, [hli] cp -1 @@ -834,7 +834,7 @@ PuzzlePieceBorderData: ; e1703 INCBIN "gfx/unown_puzzle/tile_borders.2bpp" LoadUnownPuzzlePiecesGFX: ; e17a3 - ld a, [ScriptVar] + ld a, [wScriptVar] maskbits NUM_UNOWN_PUZZLES ld e, a ld d, 0 diff --git a/engine/unused_title.asm b/engine/unused_title.asm index 516fc902e..8e52a71bb 100644 --- a/engine/unused_title.asm +++ b/engine/unused_title.asm @@ -49,7 +49,7 @@ UnusedTitleScreen: ; 10c000 jr nz, .copy ld hl, UnusedTitleFG_OAM - ld de, Sprite01 + ld de, wVirtualOAMSprite00 ld bc, SPRITEOAMSTRUCT_LENGTH * NUM_SPRITE_OAM_STRUCTS call CopyBytes diff --git a/engine/variables.asm b/engine/variables.asm index 56c49f085..89026fdba 100755 --- a/engine/variables.asm +++ b/engine/variables.asm @@ -29,36 +29,36 @@ _GetVarAction:: ; 80648 (20:4648) ret .loadstringbuffer2 ; 8066c (20:466c) - ld de, StringBuffer2 + ld de, wStringBuffer2 ld [de], a ret ; 80671 (20:4671) .VarActionTable: ; 80671 ; entries correspond to VAR_* constants - ; RETVAR_STRBUF2: copy [de] to StringBuffer2 + ; RETVAR_STRBUF2: copy [de] to wStringBuffer2 ; RETVAR_ADDR_DE: return address in de ; RETVAR_EXECUTE: call function - dwb StringBuffer2, RETVAR_STRBUF2 - dwb PartyCount, RETVAR_STRBUF2 + dwb wStringBuffer2, RETVAR_STRBUF2 + dwb wPartyCount, RETVAR_STRBUF2 dwb .BattleResult, RETVAR_EXECUTE - dwb BattleType, RETVAR_ADDR_DE - dwb TimeOfDay, RETVAR_STRBUF2 + dwb wBattleType, RETVAR_ADDR_DE + dwb wTimeOfDay, RETVAR_STRBUF2 dwb .CountCaughtMons, RETVAR_EXECUTE dwb .CountSeenMons, RETVAR_EXECUTE dwb .CountBadges, RETVAR_EXECUTE - dwb PlayerState, RETVAR_ADDR_DE + dwb wPlayerState, RETVAR_ADDR_DE dwb .PlayerFacing, RETVAR_EXECUTE dwb hHours, RETVAR_STRBUF2 dwb .DayOfWeek, RETVAR_EXECUTE - dwb MapGroup, RETVAR_STRBUF2 - dwb MapNumber, RETVAR_STRBUF2 + dwb wMapGroup, RETVAR_STRBUF2 + dwb wMapNumber, RETVAR_STRBUF2 dwb .UnownCaught, RETVAR_EXECUTE - dwb wEnvironment, RETVAR_STRBUF2 + dwb wEnvironment, RETVAR_STRBUF2 dwb .BoxFreeSpace, RETVAR_EXECUTE dwb wBugContestMinsRemaining, RETVAR_STRBUF2 - dwb XCoord, RETVAR_STRBUF2 - dwb YCoord, RETVAR_STRBUF2 + dwb wXCoord, RETVAR_STRBUF2 + dwb wYCoord, RETVAR_STRBUF2 dwb wSpecialPhoneCallID, RETVAR_STRBUF2 dwb wNrOfBeatenBattleTowerTrainers, RETVAR_STRBUF2 dwb wKurtApricornQuantity, RETVAR_STRBUF2 @@ -71,8 +71,8 @@ _GetVarAction:: ; 80648 (20:4648) .CountCaughtMons: ; 806c5 ; Caught mons. - ld hl, PokedexCaught - ld b, EndPokedexCaught - PokedexCaught + ld hl, wPokedexCaught + ld b, wEndPokedexCaught - wPokedexCaught call CountSetBits ld a, [wd265] jp .loadstringbuffer2 @@ -80,8 +80,8 @@ _GetVarAction:: ; 80648 (20:4648) .CountSeenMons: ; 806d3 ; Seen mons. - ld hl, PokedexSeen - ld b, EndPokedexSeen - PokedexSeen + ld hl, wPokedexSeen + ld b, wEndPokedexSeen - wPokedexSeen call CountSetBits ld a, [wd265] jp .loadstringbuffer2 @@ -89,7 +89,7 @@ _GetVarAction:: ; 80648 (20:4648) .CountBadges: ; 806e1 ; Number of owned badges. - ld hl, Badges + ld hl, wBadges ld b, 2 call CountSetBits ld a, [wd265] @@ -98,7 +98,7 @@ _GetVarAction:: ; 80648 (20:4648) .PlayerFacing: ; 806ef ; The direction the player is facing. - ld a, [PlayerDirection] + ld a, [wPlayerDirection] and $c rrca rrca @@ -118,7 +118,7 @@ _GetVarAction:: ; 80648 (20:4648) jp .loadstringbuffer2 .count - ld hl, UnownDex + ld hl, wUnownDex ld b, 0 .loop ld a, [hli] diff --git a/engine/warp_connection.asm b/engine/warp_connection.asm index e15809c04..8d673de44 100755 --- a/engine/warp_connection.asm +++ b/engine/warp_connection.asm @@ -30,24 +30,24 @@ EnterMapConnection: ; 1045d6 ret .west - ld a, [WestConnectedMapGroup] - ld [MapGroup], a - ld a, [WestConnectedMapNumber] - ld [MapNumber], a - ld a, [WestConnectionStripXOffset] - ld [XCoord], a - ld a, [WestConnectionStripYOffset] - ld hl, YCoord + ld a, [wWestConnectedMapGroup] + ld [wMapGroup], a + ld a, [wWestConnectedMapNumber] + ld [wMapNumber], a + ld a, [wWestConnectionStripXOffset] + ld [wXCoord], a + ld a, [wWestConnectionStripYOffset] + ld hl, wYCoord add [hl] ld [hl], a ld c, a - ld hl, WestConnectionWindow + ld hl, wWestConnectionWindow ld a, [hli] ld h, [hl] ld l, a srl c jr z, .skip_to_load - ld a, [WestConnectedMapWidth] + ld a, [wWestConnectedMapWidth] add 6 ld e, a ld d, 0 @@ -65,24 +65,24 @@ EnterMapConnection: ; 1045d6 jp .done .east - ld a, [EastConnectedMapGroup] - ld [MapGroup], a - ld a, [EastConnectedMapNumber] - ld [MapNumber], a - ld a, [EastConnectionStripXOffset] - ld [XCoord], a - ld a, [EastConnectionStripYOffset] - ld hl, YCoord + ld a, [wEastConnectedMapGroup] + ld [wMapGroup], a + ld a, [wEastConnectedMapNumber] + ld [wMapNumber], a + ld a, [wEastConnectionStripXOffset] + ld [wXCoord], a + ld a, [wEastConnectionStripYOffset] + ld hl, wYCoord add [hl] ld [hl], a ld c, a - ld hl, EastConnectionWindow + ld hl, wEastConnectionWindow ld a, [hli] ld h, [hl] ld l, a srl c jr z, .skip_to_load2 - ld a, [EastConnectedMapWidth] + ld a, [wEastConnectedMapWidth] add 6 ld e, a ld d, 0 @@ -100,18 +100,18 @@ EnterMapConnection: ; 1045d6 jp .done .north - ld a, [NorthConnectedMapGroup] - ld [MapGroup], a - ld a, [NorthConnectedMapNumber] - ld [MapNumber], a - ld a, [NorthConnectionStripYOffset] - ld [YCoord], a - ld a, [NorthConnectionStripXOffset] - ld hl, XCoord + ld a, [wNorthConnectedMapGroup] + ld [wMapGroup], a + ld a, [wNorthConnectedMapNumber] + ld [wMapNumber], a + ld a, [wNorthConnectionStripYOffset] + ld [wYCoord], a + ld a, [wNorthConnectionStripXOffset] + ld hl, wXCoord add [hl] ld [hl], a ld c, a - ld hl, NorthConnectionWindow + ld hl, wNorthConnectionWindow ld a, [hli] ld h, [hl] ld l, a @@ -125,18 +125,18 @@ EnterMapConnection: ; 1045d6 jp .done .south - ld a, [SouthConnectedMapGroup] - ld [MapGroup], a - ld a, [SouthConnectedMapNumber] - ld [MapNumber], a - ld a, [SouthConnectionStripYOffset] - ld [YCoord], a - ld a, [SouthConnectionStripXOffset] - ld hl, XCoord + ld a, [wSouthConnectedMapGroup] + ld [wMapGroup], a + ld a, [wSouthConnectedMapNumber] + ld [wMapNumber], a + ld a, [wSouthConnectionStripYOffset] + ld [wYCoord], a + ld a, [wSouthConnectionStripXOffset] + ld hl, wXCoord add [hl] ld [hl], a ld c, a - ld hl, SouthConnectionWindow + ld hl, wSouthConnectionWindow ld a, [hli] ld h, [hl] ld l, a @@ -156,11 +156,11 @@ LoadWarpData: ; 1046c6 call .SaveDigWarp call .SetSpawn ld a, [wNextWarp] - ld [WarpNumber], a + ld [wWarpNumber], a ld a, [wNextMapGroup] - ld [MapGroup], a + ld [wMapGroup], a ld a, [wNextMapNumber] - ld [MapNumber], a + ld [wMapNumber], a ret .SaveDigWarp: ; 1046df (41:46df) @@ -228,7 +228,7 @@ LoadWarpData: ; 1046c6 ret LoadMapTimeOfDay: ; 104750 - ld hl, VramState + ld hl, wVramState res 6, [hl] ld a, $1 ld [wSpriteUpdatesEnabled], a @@ -274,7 +274,7 @@ LoadMapTimeOfDay: ; 104750 and a ret z - decoord 0, 0, AttrMap + decoord 0, 0, wAttrMap ld a, $1 ld [rVBK], a .copy @@ -324,7 +324,7 @@ RefreshMapSprites: ; 1047f0 ld hl, wPlayerSpriteSetupFlags bit 6, [hl] jr nz, .skip - ld hl, VramState + ld hl, wVramState set 0, [hl] call SafeUpdateSprites .skip @@ -349,10 +349,10 @@ CheckMovingOffEdgeOfMap:: ; 104820 (41:4820) ret .down - ld a, [PlayerStandingMapY] + ld a, [wPlayerStandingMapY] sub 4 ld b, a - ld a, [MapHeight] + ld a, [wMapHeight] add a cp b jr z, .ok @@ -360,7 +360,7 @@ CheckMovingOffEdgeOfMap:: ; 104820 (41:4820) ret .up - ld a, [PlayerStandingMapY] + ld a, [wPlayerStandingMapY] sub 4 cp -1 jr z, .ok @@ -368,7 +368,7 @@ CheckMovingOffEdgeOfMap:: ; 104820 (41:4820) ret .left - ld a, [PlayerStandingMapX] + ld a, [wPlayerStandingMapX] sub 4 cp -1 jr z, .ok @@ -376,10 +376,10 @@ CheckMovingOffEdgeOfMap:: ; 104820 (41:4820) ret .right - ld a, [PlayerStandingMapX] + ld a, [wPlayerStandingMapX] sub 4 ld b, a - ld a, [MapWidth] + ld a, [wMapWidth] add a cp b jr z, .ok @@ -392,8 +392,8 @@ CheckMovingOffEdgeOfMap:: ; 104820 (41:4820) GetCoordOfUpperLeftCorner:: ; 10486d - ld hl, OverworldMap - ld a, [XCoord] + ld hl, wOverworldMap + ld a, [wXCoord] bit 0, a jr nz, .increment_then_halve1 srl a @@ -408,11 +408,11 @@ GetCoordOfUpperLeftCorner:: ; 10486d ld c, a ld b, $0 add hl, bc - ld a, [MapWidth] + ld a, [wMapWidth] add $6 ld c, a ld b, $0 - ld a, [YCoord] + ld a, [wYCoord] bit 0, a jr nz, .increment_then_halve2 srl a @@ -429,10 +429,10 @@ GetCoordOfUpperLeftCorner:: ; 10486d ld [wOverworldMapAnchor], a ld a, h ld [wOverworldMapAnchor + 1], a - ld a, [YCoord] + ld a, [wYCoord] and $1 ld [wMetatileStandingY], a - ld a, [XCoord] + ld a, [wXCoord] and $1 ld [wMetatileStandingX], a ret diff --git a/engine/wildmons.asm b/engine/wildmons.asm index 50d4ea250..f578a4f84 100755 --- a/engine/wildmons.asm +++ b/engine/wildmons.asm @@ -193,8 +193,8 @@ TryWildEncounter:: ; 2a0e7 .no_battle xor a ; BATTLETYPE_NORMAL - ld [TempWildMonSpecies], a - ld [BattleType], a + ld [wTempWildMonSpecies], a + ld [wBattleType], a ld a, 1 and a ret @@ -214,7 +214,7 @@ GetMapEncounterRate: ; 2a111 call CheckOnWater ld a, wWaterEncounterRate - wMornEncounterRate jr z, .ok - ld a, [TimeOfDay] + ld a, [wTimeOfDay] .ok ld c, a ld b, 0 @@ -243,9 +243,9 @@ ApplyMusicEffectOnEncounterRate:: ; 2a124 ApplyCleanseTagEffectOnEncounterRate:: ; 2a138 ; Cleanse Tag halves encounter rate. - ld hl, PartyMon1Item + ld hl, wPartyMon1Item ld de, PARTYMON_STRUCT_LENGTH - ld a, [PartyCount] + ld a, [wPartyCount] ld c, a .loop ld a, [hl] @@ -275,7 +275,7 @@ ChooseWildEncounter: ; 2a14f jr z, .watermon inc hl inc hl - ld a, [TimeOfDay] + ld a, [wTimeOfDay] ld bc, $e call AddNTimes ld de, GrassMonProbTable @@ -326,7 +326,7 @@ ChooseWildEncounter: ; 2a14f ; Store the level .ok ld a, b - ld [CurPartyLevel], a + ld [wCurPartyLevel], a ld b, [hl] ; ld a, b call ValidateTempWildMonSpecies @@ -350,7 +350,7 @@ ChooseWildEncounter: ; 2a14f .loadwildmon ld a, b - ld [TempWildMonSpecies], a + ld [wTempWildMonSpecies], a .startwildbattle xor a @@ -365,7 +365,7 @@ CheckRepelEffect:: ; 2a1df and a jr z, .encounter ; Get the first Pokemon in your party that isn't fainted. - ld hl, PartyMon1HP + ld hl, wPartyMon1HP ld bc, PARTYMON_STRUCT_LENGTH - 1 .loop ld a, [hli] @@ -380,7 +380,7 @@ rept 4 dec hl endr - ld a, [CurPartyLevel] + ld a, [wCurPartyLevel] cp [hl] jr nc, .encounter and a @@ -470,9 +470,9 @@ _NormalWildmonOK ; 2a27f CopyCurrMapDE: ; 2a27f - ld a, [MapGroup] + ld a, [wMapGroup] ld d, a - ld a, [MapNumber] + ld a, [wMapNumber] ld e, a ret ; 2a288 @@ -585,11 +585,11 @@ CheckEncounterRoamMon: ; 2a2ce dec hl dec hl ld a, [hli] - ld [TempWildMonSpecies], a + ld [wTempWildMonSpecies], a ld a, [hl] - ld [CurPartyLevel], a + ld [wCurPartyLevel], a ld a, BATTLETYPE_ROAMING - ld [BattleType], a + ld [wBattleType], a pop hl scf @@ -756,11 +756,11 @@ JumpRoamMon: ; 2a3cd jr .innerloop2 ; Check to see if the selected map is the one the player is currently in. If so, try again. .ok - ld a, [MapGroup] + ld a, [wMapGroup] cp [hl] jr nz, .done inc hl - ld a, [MapNumber] + ld a, [wMapNumber] cp [hl] jr z, .loop dec hl @@ -777,9 +777,9 @@ _BackUpMapIndices: ; 2a3f6 ld [wRoamMons_LastMapNumber], a ld a, [wRoamMons_CurrentMapGroup] ld [wRoamMons_LastMapGroup], a - ld a, [MapNumber] + ld a, [wMapNumber] ld [wRoamMons_CurrentMapNumber], a - ld a, [MapGroup] + ld a, [wMapGroup] ld [wRoamMons_CurrentMapGroup], a ret ; 2a40f @@ -820,7 +820,7 @@ Special_RandomUnseenWildMon: ; 2a4ab push hl ld bc, 5 + 4 * 2 ; Location of the level of the 5th wild Pokemon in that map add hl, bc - ld a, [TimeOfDay] + ld a, [wTimeOfDay] ld bc, NUM_GRASSMON * 2 call AddNTimes .randloop1 @@ -855,7 +855,7 @@ Special_RandomUnseenWildMon: ; 2a4ab pop bc jr nz, .done ; Since we haven't seen it, have the caller tell us about it. - ld de, StringBuffer1 + ld de, wStringBuffer1 call CopyName1 ld a, c ld [wNamedObjectIndexBuffer], a @@ -863,12 +863,12 @@ Special_RandomUnseenWildMon: ; 2a4ab ld hl, .SawRareMonText call PrintText xor a - ld [ScriptVar], a + ld [wScriptVar], a ret .done ld a, $1 - ld [ScriptVar], a + ld [wScriptVar], a ret .SawRareMonText: @@ -891,7 +891,7 @@ Special_RandomPhoneWildMon: ; 2a51f .ok ld bc, 5 + 0 * 2 add hl, bc - ld a, [TimeOfDay] + ld a, [wTimeOfDay] inc a ld bc, NUM_GRASSMON * 2 .loop @@ -911,8 +911,8 @@ Special_RandomPhoneWildMon: ; 2a51f ld a, [hl] ld [wNamedObjectIndexBuffer], a call GetPokemonName - ld hl, StringBuffer1 - ld de, StringBuffer4 + ld hl, wStringBuffer1 + ld de, wStringBuffer4 ld bc, MON_NAME_LENGTH jp CopyBytes ; 2a567 @@ -995,8 +995,8 @@ Special_RandomPhoneMon: ; 2a567 call GetFarByte ld [wNamedObjectIndexBuffer], a call GetPokemonName - ld hl, StringBuffer1 - ld de, StringBuffer4 + ld hl, wStringBuffer1 + ld de, wStringBuffer4 ld bc, MON_NAME_LENGTH jp CopyBytes ; 2a5e9 |