diff options
Diffstat (limited to 'engine/events')
58 files changed, 765 insertions, 765 deletions
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..082a2318d 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, wSprite01TileID 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, wSprite05 + ld bc, wSpritesEnd - wSprite05 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..5fc069602 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, wSprite37 + ld bc, wSpritesEnd - wSprite37 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, wSprite01TileID 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, wSprite05 + ld bc, wSpritesEnd - wSprite05 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..5e60425f6 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, wSprite33 ld de, .PC_ElmsLab_OAM call .PlaceHealingMachineTile call .PlaceHealingMachineTile jr .LoadBallsOntoMachine .HOF_LoadBallsOntoMachine: ; 123a1 - ld hl, Sprite33 + ld hl, wSprite33 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 |