diff options
author | luckytyphlosion <alan.rj.huang@gmail.com> | 2015-10-29 14:23:30 -0400 |
---|---|---|
committer | luckytyphlosion <alan.rj.huang@gmail.com> | 2015-10-29 14:23:30 -0400 |
commit | cb414f1480e9117e5d6ee0ab5cb81903e83cde9a (patch) | |
tree | e44bd6299c61335a9a0476db57b565aadcd0b4d7 | |
parent | 2ea331ebb341505df1cd8429b140c52e345a5af4 (diff) |
overworld item & movement code, cable club code, remove more instances of W_, add PIKAHAPPY_TRADE
Also make replace.sh take args
115 files changed, 1146 insertions, 952 deletions
@@ -361,13 +361,13 @@ PlayBattleMusic:: ; 9064 (2:5064) call StopAllMusic call DelayFrame ld c, $8 ; BANK(Music_GymLeaderBattle) - ld a, [W_GYMLEADERNO] + ld a, [wGymLeaderNo] and a jr z, .notGymLeaderBattle ld a, $ea ; MUSIC_GYM_LEADER_BATTLE jr .playSong .notGymLeaderBattle - ld a, [W_CUROPPONENT] + ld a, [wCurOpponent] cp 200 jr c, .wildBattle cp OPP_SONY3 diff --git a/audio/engine_1.asm b/audio/engine_1.asm index 39035834..9a83e563 100644 --- a/audio/engine_1.asm +++ b/audio/engine_1.asm @@ -1556,7 +1556,7 @@ Audio1_HWChannelDisableMasks: ; 996a (2:596a) Audio1_9972: ; 9972 (2:5972) push af push bc - ld a, [W_OPTIONS] + ld a, [wOptions] and %110000 ; channel options srl a ld c, a diff --git a/constants/hide_show_constants.asm b/constants/hide_show_constants.asm index 5a517afc..1a44b1e7 100755 --- a/constants/hide_show_constants.asm +++ b/constants/hide_show_constants.asm @@ -2,7 +2,7 @@ ; sprites marked with an X are constants that are never used ; because those sprites are not (de)activated in a map's script ; (they are either items or sprites that deactivate after battle -; and are detected in W_MISSABLEOBJECTLIST) +; and are detected in wMissableObjectList) const_value = 0 diff --git a/constants/misc_constants.asm b/constants/misc_constants.asm index f85ca3bf..527152fe 100644 --- a/constants/misc_constants.asm +++ b/constants/misc_constants.asm @@ -208,4 +208,4 @@ const_value set 1 const PIKAHAPPY_FAINTED const PIKAHAPPY_PSNFNT const PIKAHAPPY_10 - const PIKAHAPPY_11 + const PIKAHAPPY_TRADE diff --git a/data/hide_show_data.asm b/data/hide_show_data.asm index d465dfb3..4e3fe2c2 100755 --- a/data/hide_show_data.asm +++ b/data/hide_show_data.asm @@ -264,7 +264,7 @@ MapHSPointers: ; c69b (3:469b) ; a) Map_ID = $FF ; b) Map_ID ≠ currentMapID ; -; This Data is loaded into RAM at wd5ce-$D5F?. (W_MISSABLEOBJECTLIST) +; This Data is loaded into RAM at wd5ce-$D5F?. (wMissableObjectList) ; These constants come from the bytes for Predef functions: Hide equ $11 diff --git a/engine/bank3c/main.asm b/engine/bank3c/main.asm index 6253f971..468a6412 100644 --- a/engine/bank3c/main.asm +++ b/engine/bank3c/main.asm @@ -161,7 +161,7 @@ ResetStatusAndHalveMoneyOnBlackout:: ; f0274 (3c:4274) xor a ; gamefreak copypasting functions (double xor a) ld [wBattleResult], a ld [wWalkBikeSurfState], a - ld [W_ISINBATTLE], a + ld [wIsInBattle], a ld [wMapPalOffset], a ld [wNPCMovementScriptFunctionNum], a ld [hJoyHeld], a @@ -204,7 +204,7 @@ ResetStatusAndHalveMoneyOnBlackout:: ; f0274 (3c:4274) predef_jump HealParty Func_f02da:: ; f02da (3c:42da) - ld a,[W_CURMAP] + ld a,[wCurMap] cp VERMILION_GYM ; ??? new thing about verm gym? jr z,.asm_f02ee ld c,a @@ -248,7 +248,7 @@ Func_f0a55:: ; f0a55 (3c:4a55) cp a,$ff ret z ld b,a - ld a,[W_CURMAP] + ld a,[wCurMap] cp b jr z,.asm_f0a68 inc hl @@ -263,7 +263,7 @@ Func_f0a55:: ; f0a55 (3c:4a55) ld a,[hli] ld h,[hl] ld l,a - ld de,W_MISSABLEOBJECTLIST + ld de,wMissableObjectList call CopyData ret diff --git a/engine/bank3c/overworld.asm b/engine/bank3c/overworld.asm index d7e6274f..e02fb129 100644 --- a/engine/bank3c/overworld.asm +++ b/engine/bank3c/overworld.asm @@ -9,12 +9,12 @@ _AdvancePlayerSprite:: ; f010c (3c:410c) ; if it's the end of the animation, update the player's map coordinates ld hl, wd430 res 5, [hl] - ld a,[W_YCOORD] + ld a,[wYCoord] add b - ld [W_YCOORD],a - ld a,[W_XCOORD] + ld [wYCoord],a + ld a,[wXCoord] add c - ld [W_XCOORD],a + ld [wXCoord],a .afterUpdateMapCoords ld a,[wWalkCounter] ; walking animation counter cp a,$07 @@ -81,7 +81,7 @@ _AdvancePlayerSprite:: ; f010c (3c:410c) and a jr z,.pointlessJump ; mistake? .pointlessJump - ld hl,W_XBLOCKCOORD + ld hl,wXBlockCoord ld a,[hl] add c ld [hl],a @@ -107,7 +107,7 @@ _AdvancePlayerSprite:: ; f010c (3c:410c) call MoveTileBlockMapPointerWest jr .updateMapView .adjustYCoordWithinBlock - ld hl,W_YBLOCKCOORD + ld hl,wYBlockCoord ld a,[hl] add b ld [hl],a @@ -119,7 +119,7 @@ _AdvancePlayerSprite:: ; f010c (3c:410c) ld hl,wYOffsetSinceLastSpecialWarp inc [hl] ld de,wCurrentTileBlockMapViewPointer - ld a,[W_CURMAPWIDTH] + ld a,[wCurMapWidth] call MoveTileBlockMapPointerSouth jr .updateMapView .checkForMoveToNorthBlock @@ -131,7 +131,7 @@ _AdvancePlayerSprite:: ; f010c (3c:410c) ld hl,wYOffsetSinceLastSpecialWarp dec [hl] ld de,wCurrentTileBlockMapViewPointer - ld a,[W_CURMAPWIDTH] + ld a,[wCurMapWidth] call MoveTileBlockMapPointerNorth .updateMapView call LoadCurrentMapView diff --git a/engine/bank3d/bank3d_battle.asm b/engine/bank3d/bank3d_battle.asm index 5c5acd15..1f84d314 100644 --- a/engine/bank3d/bank3d_battle.asm +++ b/engine/bank3d/bank3d_battle.asm @@ -1,10 +1,10 @@ InitBattle: ; f5ff2 (3d:5ff2) - ld a, [W_CUROPPONENT] + ld a, [wCurOpponent] and a jr z, asm_f6003 InitOpponent: ; f5ff8 (3d:5ff8) - ld a, [W_CUROPPONENT] + ld a, [wCurOpponent] ld [wcf91], a ld [wEnemyMonSpecies2], a jr asm_f601d @@ -47,10 +47,10 @@ asm_f601d: ; f601d (f:601d) ld a, $ff ld [wEnemyMonPartyPos], a ld a, $2 - ld [W_ISINBATTLE], a + ld [wIsInBattle], a ; Is this a major story battle? - ld a,[W_LONEATTACKNO] + ld a,[wLoneAttackNo] and a jp z,InitBattle_Common callabd_ModifyPikachuHappiness PIKAHAPPY_GYMLEADER ; useless since already in bank3d @@ -58,16 +58,16 @@ asm_f601d: ; f601d (f:601d) InitWildBattle: ; f607c (3d:607c) ld a, $1 - ld [W_ISINBATTLE], a + ld [wIsInBattle], a callab LoadEnemyMonData callab DoBattleTransitionAndInitBattleVariables - ld a, [W_CUROPPONENT] + ld a, [wCurOpponent] cp MAROWAK jr z, .isGhost callab IsGhostBattle jr nz, .isNoGhost .isGhost - ld hl, W_MONHSPRITEDIM + ld hl, wMonHSpriteDim ld a, $66 ld [hli], a ; write sprite dimensions ld bc, GhostPic @@ -131,7 +131,7 @@ InitBattle_Common: ; f60eb (3d:60eb) ld bc, $40a call ClearScreenArea call ClearSprites - ld a, [W_ISINBATTLE] + ld a, [wIsInBattle] dec a ; is it a wild battle? ld hl, DrawEnemyHUDAndHPBar ld b,BANK(DrawEnemyHUDAndHPBar) @@ -175,7 +175,7 @@ LoadMonBackPic: ; f6178 (3d:6178) coord hl, 1, 5 ld bc,$708 call ClearScreenArea - ld hl, W_MONHBACKSPRITE - W_MONHEADER + ld hl, wMonHBackSprite - wMonHeader call UncompressMonSprite predef ScaleSpriteByTwo ld de, vBackPic @@ -195,7 +195,7 @@ Func_f61a6: ; f61a6 (3d:f61a6) ld a, [$ffe1] ld [H_DOWNARROWBLINKCNT1], a ld b, $4c - ld a, [W_ISINBATTLE] + ld a, [wIsInBattle] and a jr z, .asm_f61ef add b diff --git a/engine/bank3d/main.asm b/engine/bank3d/main.asm index 131f4fca..c64dd26f 100644 --- a/engine/bank3d/main.asm +++ b/engine/bank3d/main.asm @@ -461,7 +461,7 @@ Func_f5b2d:: ; f5b2d (3d:5b2d) ld a,[wd732] bit 5,a jr nz,.asm_f5b59 - ld a,[W_CURMAP] + ld a,[wCurMap] cp SEAFOAM_ISLANDS_5 ret nz ld a,[wd881] @@ -640,12 +640,13 @@ RemoveItemFromInventory_: ; f5be1 (3d:5be1) ret TrainerInfoTextBoxTileGraphics: INCBIN "gfx/trainer_info.2bpp" +TrainerInfoTextBoxTileGraphicsEnd: BlankLeaderNames: INCBIN "gfx/blank_leader_names.2bpp" CircleTile: INCBIN "gfx/circle_tile.2bpp" BadgeNumbersTileGraphics: INCBIN "gfx/badge_numbers.2bpp" ReadSuperRodData:: ; f5ea4 (3d:5ea4) - ld a,[W_CURMAP] + ld a,[wCurMap] ld c,a ld hl,FishingSlots .loop diff --git a/engine/bank3f/main.asm b/engine/bank3f/main.asm index ae79a5ca..72942405 100644 --- a/engine/bank3f/main.asm +++ b/engine/bank3f/main.asm @@ -61,10 +61,10 @@ Func_fc534:: ; fc534 (3f:4534) Func_fc53f:: ; fc53f (3f:453f) ld bc,wSpriteStateData1 + $f0 - ld a,[W_YCOORD] + ld a,[wYCoord] add $4 ld e,a - ld a,[W_XCOORD] + ld a,[wXCoord] add $4 ld d,a ld a,[wd431] @@ -178,7 +178,7 @@ Func_fc5bc:: ; fc5bc (3f:45bc) ret Func_fc5fa:: ; fc5fa (3f:45fa) - ld a,[W_CURMAP] + ld a,[wCurMap] cp OAKS_LAB jr z,.asm_fc63d cp ROUTE_22_GATE @@ -187,11 +187,11 @@ Func_fc5fa:: ; fc5fa (3f:45fa) jr z,.asm_fc635 cp ROCK_TUNNEL_1 jr z,.asm_fc645 - ld a,[W_CURMAP] + ld a,[wCurMap] ld hl,Pointer_fc64b call Func_1568 ; similar to IsInArray, but not the same jr c,.asm_fc639 - ld a,[W_CURMAP] + ld a,[wCurMap] ld hl,Pointer_fc653 call Func_1568 jr nc,.asm_fc641 @@ -231,12 +231,12 @@ Pointer_fc653:: ; fc653 (3f:4653) db $2f,$e6,$3e,$5e,$80,$31,$a4,$ff Func_fc65b:: ; fc65b (3f:465b) - ld a,[W_CURMAP] + ld a,[wCurMap] cp VIRIDIAN_FOREST_EXIT jr z,.asm_fc673 cp VIRIDIAN_FOREST_ENTRANCE jr z,.asm_fc67c - ld a,[W_CURMAP] + ld a,[wCurMap] ld hl,Pointer_fc68e call Func_1568 jr c,.asm_fc688 @@ -264,7 +264,7 @@ Pointer_fc68e:: ; fc68e (3f:468e) db $33,$dd,$df,$e0,$e1,$de,$ec,$7f,$a8,$a9,$aa,$ff Func_fc69a:: ; fc69a (3f:469a) - ld a,[W_CURMAP] + ld a,[wCurMap] cp ROUTE_22_GATE jr z,.asm_fc6a7 cp ROUTE_2_GATE @@ -407,7 +407,7 @@ asm_fc76a: ; fc76a (3f:476a) call Func_fc82e jr c,.asm_fc783 push bc - callab Func_5012 + callab InitializeSpriteScreenPosition pop bc .asm_fc783 ld hl,$1 @@ -422,7 +422,7 @@ asm_fc76a: ; fc76a (3f:476a) Func_fc793: ; fc793 (3f:4793) call Func_fcba1 push bc - callab Func_5012 + callab InitializeSpriteScreenPosition pop bc ld hl,$2 add hl,bc @@ -966,12 +966,12 @@ Func_fca99: ; fca99 (3f:4a99) Func_fcae2: ; fcae2 (3f:4ae2) ld hl,$104 add hl,bc - ld a,[W_YCOORD] + ld a,[wYCoord] add $4 cp [hl] jr nz,.asm_fcaff inc hl - ld a,[W_XCOORD] + ld a,[wXCoord] add $4 cp [hl] jr nz,.asm_fcaff @@ -989,10 +989,10 @@ Func_fcb01: ; fcb01 (3f:4b01) push de push hl ld bc,wSpriteStateData1 + $f0 - ld a,[W_XCOORD] + ld a,[wXCoord] add $4 ld d,a - ld a,[W_YCOORD] + ld a,[wYCoord] add $4 ld e,a ld hl,$104 @@ -1045,10 +1045,10 @@ Func_fcb4d: ; fcb4d (3f:4b4d) Func_fcb52: ; fcb52 (3f:4b52) ld bc,wSpriteStateData1 + $f0 - ld a,[W_XCOORD] + ld a,[wXCoord] add $4 ld d,a - ld a,[W_YCOORD] + ld a,[wYCoord] add $4 ld e,a ld hl,$104 @@ -1111,7 +1111,7 @@ Func_fcbac: ; fcbac (3f:4bac) ld bc,wSpriteStateData1 + $f0 ld hl,$104 add hl,bc - ld a,[W_YCOORD] + ld a,[wYCoord] add $4 sub [hl] jr z,.asm_fcbd7 @@ -1138,7 +1138,7 @@ Func_fcbac: ; fcbac (3f:4bac) .asm_fcbd7 ld hl,$105 add hl,bc - ld a,[W_XCOORD] + ld a,[wXCoord] add $4 sub [hl] jr z,.asm_fcbff @@ -1304,10 +1304,10 @@ Func_fccb2:: ; fccb2 (3f:4cb2) add a jr .asm_fccea .asm_fccbf - ld a,[W_YCOORD] + ld a,[wYCoord] add $4 ld d,a - ld a,[W_XCOORD] + ld a,[wXCoord] add $4 ld e,a ld a,[wSpriteStateData2 + $f4] @@ -1381,7 +1381,7 @@ Func_fcd25: ; fcd25 (3f:4d25) add $4 ld l,a ld b,[hl] - ld a,[W_YCOORD] + ld a,[wYCoord] cp b jr z,.asm_fcd3a jr nc,.asm_fcd63 @@ -1391,7 +1391,7 @@ Func_fcd25: ; fcd25 (3f:4d25) .asm_fcd3a inc l ld b,[hl] - ld a,[W_XCOORD] + ld a,[wXCoord] cp b jr z,.asm_fcd49 jr nc,.asm_fcd63 @@ -1429,7 +1429,7 @@ Func_fcd25: ; fcd25 (3f:4d25) ld a,[H_CURRENTSPRITEOFFSET] add $7 ld l,a - ld a,[W_GRASSTILE] + ld a,[wGrassTile] cp e ld a,$0 jr nz,.asm_fcd80 diff --git a/engine/battle/animations.asm b/engine/battle/animations.asm index 626eea9e..f0f5c6d3 100755 --- a/engine/battle/animations.asm +++ b/engine/battle/animations.asm @@ -389,7 +389,7 @@ MoveAnimation: ; 78d5e (1e:4d5e) .MoveAnimation ; check if battle animations are disabled in the options - ld a,[W_OPTIONS] + ld a,[wOptions] bit 7,a jr nz,.AnimationsDisabled call ShareMoveAnimations @@ -736,7 +736,7 @@ DoBallTossSpecialEffects: ; 78f3e (1e:4f3e) ld a,SFX_BALL_TOSS call PlaySound .skipPlayingSound - ld a,[W_ISINBATTLE] + ld a,[wIsInBattle] cp a,02 ; is it a trainer battle? jr z,.isTrainerBattle ld a,[wd11e] @@ -2945,7 +2945,7 @@ BattleAnimCopyTileMapToVRAM: ; 79e0d (1e:5e0d) jp Delay3 TossBallAnimation: ; 79e16 (1e:5e16) - ld a,[W_ISINBATTLE] + ld a,[wIsInBattle] cp a,2 jr z,.BlockBall ; if in trainer battle, play different animation ld a,[wPokeBallAnimData] diff --git a/engine/battle/battle_transitions.asm b/engine/battle/battle_transitions.asm index c5c4ffbe..e3527897 100644 --- a/engine/battle/battle_transitions.asm +++ b/engine/battle/battle_transitions.asm @@ -81,7 +81,7 @@ BattleTransitions: ; 70a3c (1c:4a3c) dw BattleTransition_Split ; %111 GetBattleTransitionID_WildOrTrainer: ; 70a4c (1c:4a4c) - ld a, [W_CUROPPONENT] + ld a, [wCurOpponent] cp 200 jr nc, .trainer res 0, c @@ -105,7 +105,7 @@ GetBattleTransitionID_CompareLevels: ; 70a59 (1c:4a59) ld a, [hl] add $3 ld e, a - ld a, [W_CURENEMYLVL] + ld a, [wCurEnemyLVL] sub e jr nc, .highLevelEnemy res 1, c @@ -122,7 +122,7 @@ GetBattleTransitionID_CompareLevels: ; 70a59 (1c:4a59) ; MANSION_1, SEAFOAM_ISLANDS_[2-5], POWER_PLANT, DIGLETTS_CAVE ; and SILPH_CO_[9-11]F as dungeon maps GetBattleTransitionID_IsDungeonMap: ; 70a83 (1c:4a83) - ld a, [W_CURMAP] + ld a, [wCurMap] ld e, a ld hl, DungeonMaps1 .loop1 @@ -151,7 +151,7 @@ GetBattleTransitionID_IsDungeonMap: ; 70a83 (1c:4a83) res 2, c ret -; GetBattleTransitionID_IsDungeonMap checks if W_CURMAP +; GetBattleTransitionID_IsDungeonMap checks if wCurMap ; is equal to one of these maps DungeonMaps1: ; 70aa9 (1c:4aa9) db VIRIDIAN_FOREST @@ -160,7 +160,7 @@ DungeonMaps1: ; 70aa9 (1c:4aa9) db ROCK_TUNNEL_2 db $FF -; GetBattleTransitionID_IsDungeonMap checks if W_CURMAP +; GetBattleTransitionID_IsDungeonMap checks if wCurMap ; is in between or equal to each pair of maps DungeonMaps2: ; 70aac (1c:4aac) ; all MT_MOON maps diff --git a/engine/battle/common_text.asm b/engine/battle/common_text.asm index 449fc1ab..0cbf70f0 100644 --- a/engine/battle/common_text.asm +++ b/engine/battle/common_text.asm @@ -1,8 +1,8 @@ PrintBeginningBattleText: ; f4000 (3d:4000) - ld a, [W_ISINBATTLE] ; W_ISINBATTLE + ld a, [wIsInBattle] ; W_ISINBATTLE dec a jr nz, .trainerBattle - ld a, [W_CURMAP] + ld a, [wCurMap] cp POKEMONTOWER_3 jr c, .notPokemonTower cp LAVENDER_HOUSE_1 diff --git a/engine/battle/core.asm b/engine/battle/core.asm index e5fd98f8..ac7ddcdc 100755 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -239,7 +239,7 @@ StartBattle: ; 3c11e (f:411e) .foundFirstAliveEnemyMon ld a, d ld [wSerialExchangeNybbleReceiveData], a - ld a, [W_ISINBATTLE] + ld a, [wIsInBattle] dec a ; is it a trainer battle? call nz, EnemySendOutFirstMon ; if it is a trainer battle, send out enemy mon ld c, 40 @@ -261,7 +261,7 @@ StartBattle: ; 3c11e (f:411e) ld a, [wActionResultOrTookBattleTurn] and a ; was the item used successfully? jr z, .displaySafariZoneBattleMenu ; if not, display the menu again; XXX does this ever jump? - ld a, [W_NUMSAFARIBALLS] + ld a, [wNumSafariBalls] and a jr nz, .notOutOfSafariBalls call LoadScreenTilesFromBuffer1 @@ -798,7 +798,7 @@ HandleEnemyMonFainted: ; 3c525 (f:4525) ld a, [hli] or [hl] ; is battle mon HP zero? call nz, DrawPlayerHUDAndHPBar ; if battle mon HP is not zero, draw player HD and HP bar - ld a, [W_ISINBATTLE] + ld a, [wIsInBattle] dec a ret z ; return if it's a wild battle call AnyEnemyPokemonAliveCheck @@ -821,7 +821,7 @@ HandleEnemyMonFainted: ; 3c525 (f:4525) FaintEnemyPokemon: ; 0x3c567 call ReadPlayerMonCurHPAndStatus - ld a, [W_ISINBATTLE] + ld a, [wIsInBattle] dec a jr z, .wild ld a, [wEnemyMonPartyPos] @@ -863,7 +863,7 @@ FaintEnemyPokemon: ; 0x3c567 coord hl, 0, 0 lb bc, 4, 11 call ClearScreenArea - ld a, [W_ISINBATTLE] + ld a, [wIsInBattle] dec a jr z, .wild_win xor a @@ -1003,7 +1003,7 @@ ReplaceFaintedEnemyMon: ; 3c664 (f:4664) TrainerBattleVictory: ; 3c696 (f:4696) call EndLowHealthAlarm ld b, MUSIC_DEFEATED_GYM_LEADER - ld a, [W_GYMLEADERNO] + ld a, [wGymLeaderNo] and a jr nz, .gymleader ld b, MUSIC_DEFEATED_TRAINER @@ -1068,7 +1068,7 @@ HandlePlayerMonFainted: ; 3c700 (f:4700) jr nz, .doUseNextMonDialogue ; if not, jump ; the enemy mon has 0 HP call FaintEnemyPokemon - ld a, [W_ISINBATTLE] + ld a, [wIsInBattle] dec a ret z ; if wild encounter, battle is over call AnyEnemyPokemonAliveCheck @@ -1140,7 +1140,7 @@ PlayerMonFaintedText: ; 3c796 (f:4796) DoUseNextMonDialogue: ; 3c79b (f:479b) call PrintEmptyString call SaveScreenTilesToBuffer1 - ld a, [W_ISINBATTLE] + ld a, [wIsInBattle] and a dec a ret nz ; return if it's a trainer battle @@ -1221,7 +1221,7 @@ HandlePlayerBlackOut: ; 3c837 (f:4837) ld a, [wLinkState] cp LINK_STATE_BATTLING jr z, .notSony1Battle - ld a, [W_CUROPPONENT] + ld a, [wCurOpponent] cp OPP_SONY1 jr nz, .notSony1Battle coord hl, 0, 0 ; sony 1 battle @@ -1232,7 +1232,7 @@ HandlePlayerBlackOut: ; 3c837 (f:4837) call DelayFrames ld hl, Sony1WinText call PrintText - ld a, [W_CURMAP] + ld a, [wCurMap] cp OAKS_LAB ret z ; starter battle in oak's lab: don't black out .notSony1Battle @@ -1432,7 +1432,7 @@ EnemySendOutFirstMon: ; 3c92a (f:492a) ld bc,wEnemyMon2 - wEnemyMon1 call AddNTimes ld a,[hl] - ld [W_CURENEMYLVL],a + ld [wCurEnemyLVL],a ld a,[wWhichPokemon] inc a ld hl,wEnemyPartyCount @@ -1459,7 +1459,7 @@ EnemySendOutFirstMon: ; 3c92a (f:492a) ld a,[wLinkState] cp LINK_STATE_BATTLING jr z,.next4 - ld a,[W_OPTIONS] + ld a,[wOptions] bit 6,a jr nz,.next4 ld hl, TrainerAboutToUseText @@ -1589,7 +1589,7 @@ TryRunningFromBattle: ; 3cab9 (f:4ab9) ld a, [wLinkState] cp LINK_STATE_BATTLING jp z, .canEscape - ld a, [W_ISINBATTLE] + ld a, [wIsInBattle] dec a jr nz, .trainerBattle ; jump if it's a trainer battle ld a, [wNumRunAttempts] @@ -1787,7 +1787,7 @@ LoadEnemyMonFromParty: ; 3cc13 (f:4c13) ld bc, 1 + NUM_STATS * 2 call CopyData call ApplyBurnAndParalysisPenaltiesToEnemy - ld hl, W_MONHBASESTATS + ld hl, wMonHBaseStats ld de, wEnemyMonBaseStats ld b, NUM_STATS .copyBaseStatsLoop @@ -2106,7 +2106,7 @@ DisplayBattleMenu: ; 3ceb3 (f:4eb3) jp nz, .handleBattleMenuInput ; handle menu input if it's not the old man tutorial ; the following happens for the old man tutorial ld hl, wPlayerName - ld de, W_GRASSRATE + ld de, wGrassRate ld bc, NAME_LENGTH call CopyData ; temporarily save the player name in unused space, ; which is supposed to get overwritten when entering a @@ -2156,7 +2156,7 @@ DisplayBattleMenu: ; 3ceb3 (f:4eb3) Coorda 13, 14 Coorda 13, 16 coord hl, 7, 14 - ld de, W_NUMSAFARIBALLS + ld de, wNumSafariBalls lb bc, 1, 2 call PrintNumber ld b, $1 ; top menu item X @@ -2189,7 +2189,7 @@ DisplayBattleMenu: ; 3ceb3 (f:4eb3) Coorda 1, 14 ; clear upper cursor position in left column Coorda 1, 16 ; clear lower cursor position in left column coord hl, 7, 14 - ld de, W_NUMSAFARIBALLS + ld de, wNumSafariBalls lb bc, 1, 2 call PrintNumber ld b, $d ; top menu item X @@ -3039,7 +3039,7 @@ SelectEnemyMove: ; 3d564 (f:5564) ld a, STRUGGLE ; struggle if the only move is disabled jr nz, .done .atLeastTwoMovesAvailable - ld a, [W_ISINBATTLE] + ld a, [wIsInBattle] dec a jr z, .chooseRandomMove ; wild encounter callab AIEnemyTrainerChooseMoves @@ -3364,10 +3364,10 @@ GetOutText: ; 3d835 (f:5835) db "@" IsGhostBattle: ; 3d83a (f:583a) - ld a,[W_ISINBATTLE] + ld a,[wIsInBattle] dec a ret nz - ld a,[W_CURMAP] + ld a,[wCurMap] cp a,POKEMONTOWER_1 jr c,.next cp a,LAVENDER_HOUSE_1 @@ -3541,7 +3541,7 @@ CheckPlayerStatusConditions: ; 3d854 (f:5854) jr z,.ThrashingAboutCheck xor a ld [W_PLAYERMOVENUM],a - ld hl,W_DAMAGE + ld hl,wDamage ld a,[hli] ld b,a ld c,[hl] @@ -3568,10 +3568,10 @@ CheckPlayerStatusConditions: ; 3d854 (f:5854) ld a,[hld] add a ld b,a - ld [W_DAMAGE + 1],a + ld [wDamage + 1],a ld a,[hl] rl a ; double the damage - ld [W_DAMAGE],a + ld [wDamage],a or b jr nz,.next ld a,1 @@ -3943,7 +3943,7 @@ PrintMoveFailureText: ; 3dbe2 (f:5be2) ret nz ; if you get here, the mon used jump kick or hi jump kick and missed - ld hl, W_DAMAGE ; since the move missed, W_DAMAGE will always contain 0 at this point. + ld hl, wDamage ; since the move missed, W_DAMAGE will always contain 0 at this point. ; Thus, recoil damage will always be equal to 1 ; even if it was intended to be potential damage/8. ld a, [hli] @@ -4230,7 +4230,7 @@ IgnoredOrdersText: ; 3ddca (f:5dca) ; sets b, c, d, and e for the CalculateDamage routine in the case of an attack by the player mon GetDamageVarsForPlayerAttack: ; 3ddcf (f:5dcf) xor a - ld hl, W_DAMAGE ; damage to eventually inflict, initialise to zero + ld hl, wDamage ; damage to eventually inflict, initialise to zero ldi [hl], a ld [hl], a ld hl, W_PLAYERMOVEPOWER @@ -4342,7 +4342,7 @@ GetDamageVarsForPlayerAttack: ; 3ddcf (f:5dcf) ; sets b, c, d, and e for the CalculateDamage routine in the case of an attack by the enemy mon GetDamageVarsForEnemyAttack: ; 3de75 (f:5e75) - ld hl, W_DAMAGE ; damage to eventually inflict, initialise to zero + ld hl, wDamage ; damage to eventually inflict, initialise to zero xor a ld [hli], a ld [hl], a @@ -4479,7 +4479,7 @@ GetEnemyMonStat: ; 3df1c (f:5f1c) ret .notLinkBattle ld a, [wEnemyMonLevel] - ld [W_CURENEMYLVL], a + ld [wCurEnemyLVL], a ld a, [wEnemyMonSpecies] ld [wd0b5], a call GetMonHeader @@ -4585,7 +4585,7 @@ CalculateDamage: ; 3df65 (f:5f65) ld b, 4 call Divide - ld hl, W_DAMAGE + ld hl, wDamage ld b, [hl] ld a, [H_QUOTIENT + 3] add b @@ -4688,7 +4688,7 @@ CriticalHitTest: ; 3e023 (f:6023) .asm_3e032 ld [wd0b5], a call GetMonHeader - ld a, [W_MONHBASESPEED] + ld a, [wMonHBaseSpeed] ld b, a srl b ; (effective (base speed/2)) ld a, [H_WHOSETURN] @@ -4793,11 +4793,11 @@ HandleCounterMove: ; 3e093 (f:6093) xor a ret .counterableType - ld hl,W_DAMAGE + ld hl,wDamage ld a,[hli] or [hl] ret z ; If we made it here, Counter still misses if the last move used in battle did no damage to its target. - ; W_DAMAGE is shared by both players, so Counter may strike back damage dealt by the Counter user itself + ; wDamage is shared by both players, so Counter may strike back damage dealt by the Counter user itself ; if the conditions meet, even though 99% of the times damage will come from the target. ; if it did damage, double it ld a,[hl] @@ -4833,7 +4833,7 @@ ApplyAttackToEnemyPokemon: ; 3e0df (f:60df) .superFangEffect ; set the damage to half the target's HP ld hl,wEnemyMonHP - ld de,W_DAMAGE + ld de,wDamage ld a,[hli] srl a ld [de],a @@ -4878,14 +4878,14 @@ ApplyAttackToEnemyPokemon: ; 3e0df (f:60df) jr nc,.loop ld b,a .storeDamage ; store damage value at b - ld hl,W_DAMAGE + ld hl,wDamage xor a ld [hli],a ld a,b ld [hl],a ApplyDamageToEnemyPokemon: ; 3e142 (f:6142) - ld hl,W_DAMAGE + ld hl,wDamage ld a,[hli] ld b,a ld a,[hl] @@ -4909,7 +4909,7 @@ ApplyDamageToEnemyPokemon: ; 3e142 (f:6142) sbc b ld [wEnemyMonHP],a jr nc,.animateHpBar -; if more damage was done than the current HP, zero the HP and set the damage (W_DAMAGE) +; if more damage was done than the current HP, zero the HP and set the damage (wDamage) ; equal to how much HP the pokemon had before the attack ld a,[wHPBarOldHP+1] ld [hli],a @@ -4952,7 +4952,7 @@ ApplyAttackToPlayerPokemon: ; 3e1a0 (f:61a0) .superFangEffect ; set the damage to half the target's HP ld hl,wBattleMonHP - ld de,W_DAMAGE + ld de,wDamage ld a,[hli] srl a ld [de],a @@ -4997,14 +4997,14 @@ ApplyAttackToPlayerPokemon: ; 3e1a0 (f:61a0) jr nc,.loop ld b,a .storeDamage - ld hl,W_DAMAGE + ld hl,wDamage xor a ld [hli],a ld a,b ld [hl],a ApplyDamageToPlayerPokemon: ; 3e200 (f:6200) - ld hl,W_DAMAGE + ld hl,wDamage ld a,[hli] ld b,a ld a,[hl] @@ -5029,7 +5029,7 @@ ApplyDamageToPlayerPokemon: ; 3e200 (f:6200) ld [wBattleMonHP],a ld [wHPBarNewHP+1],a jr nc,.animateHpBar -; if more damage was done than the current HP, zero the HP and set the damage (W_DAMAGE) +; if more damage was done than the current HP, zero the HP and set the damage (wDamage) ; equal to how much HP the pokemon had before the attack ld a,[wHPBarOldHP+1] ld [hli],a @@ -5075,7 +5075,7 @@ AttackSubstitute: ; 3e25e (f:625e) ld de,wPlayerSubstituteHP ld bc,W_PLAYERBATTSTATUS2 .applyDamageToSubstitute - ld hl,W_DAMAGE + ld hl,wDamage ld a,[hli] and a jr nz,.substituteBroke ; damage > 0xFF always breaks substitutes @@ -5085,7 +5085,7 @@ AttackSubstitute: ; 3e25e (f:625e) ld [de],a ret nc .substituteBroke -; If the target's Substitute breaks, W_DAMAGE isn't updated with the amount of HP +; If the target's Substitute breaks, wDamage isn't updated with the amount of HP ; the Substitute had before being attacked. ld h,b ld l,c @@ -5315,7 +5315,7 @@ AdjustDamageForMoveType: ; 3e3a5 (f:63a5) jr .skipSameTypeAttackBonus .sameTypeAttackBonus ; if the move type matches one of the attacker's types - ld hl,W_DAMAGE + 1 + ld hl,wDamage + 1 ld a,[hld] ld h,[hl] ld l,a ; hl = damage @@ -5326,9 +5326,9 @@ AdjustDamageForMoveType: ; 3e3a5 (f:63a5) add hl,bc ; hl = floor(1.5 * damage) ; store damage ld a,h - ld [W_DAMAGE],a + ld [wDamage],a ld a,l - ld [W_DAMAGE + 1],a + ld [wDamage + 1],a ld hl,wDamageMultipliers set 7,[hl] .skipSameTypeAttackBonus @@ -5361,7 +5361,7 @@ AdjustDamageForMoveType: ; 3e3a5 (f:63a5) ld [wDamageMultipliers],a xor a ld [H_MULTIPLICAND],a - ld hl,W_DAMAGE + ld hl,wDamage ld a,[hli] ld [H_MULTIPLICAND + 1],a ld a,[hld] @@ -5536,7 +5536,7 @@ MoveHitTest: ; 3e56b (f:656b) ret .moveMissed xor a - ld hl,W_DAMAGE ; zero the damage + ld hl,wDamage ; zero the damage ld [hli],a ld [hl],a inc a @@ -5627,7 +5627,7 @@ CalcHitChance: ; 3e624 (f:6624) ; multiplies damage by a random percentage from ~85% to 100% RandomizeDamage: ; 3e687 (f:6687) - ld hl, W_DAMAGE + ld hl, wDamage ld a, [hli] and a jr nz, .DamageGreaterThanOne @@ -5656,7 +5656,7 @@ RandomizeDamage: ; 3e687 (f:6687) call Divide ; divide the result by 255 ; store the modified damage ld a, [H_QUOTIENT + 2] - ld hl, W_DAMAGE + ld hl, wDamage ld [hli], a ld a, [H_QUOTIENT + 3] ld [hl], a @@ -6067,7 +6067,7 @@ CheckEnemyStatusConditions: ; 3e88f (f:688f) jr z, .checkIfThrashingAbout xor a ld [W_ENEMYMOVENUM], a - ld hl, W_DAMAGE + ld hl, wDamage ld a, [hli] ld b, a ld c, [hl] @@ -6094,10 +6094,10 @@ CheckEnemyStatusConditions: ; 3e88f (f:688f) ld a, [hld] add a ld b, a - ld [W_DAMAGE + 1], a + ld [wDamage + 1], a ld a, [hl] rl a ; double the damage - ld [W_DAMAGE], a + ld [wDamage], a or b jr nz, .next ld a, $1 @@ -6209,7 +6209,7 @@ LoadEnemyMonData: ; 3eb01 (f:6b01) ld a, [hli] ld b, [hl] jr nz, .storeDVs - ld a, [W_ISINBATTLE] + ld a, [wIsInBattle] cp $2 ; is it a trainer battle? ; fixed DVs for trainer mon ld a, $98 @@ -6224,7 +6224,7 @@ LoadEnemyMonData: ; 3eb01 (f:6b01) ld [hli], a ld [hl], b ld de, wEnemyMonLevel - ld a, [W_CURENEMYLVL] + ld a, [wCurEnemyLVL] ld [de], a inc de ld b, $0 @@ -6232,7 +6232,7 @@ LoadEnemyMonData: ; 3eb01 (f:6b01) push hl call CalcStats pop hl - ld a, [W_ISINBATTLE] + ld a, [wIsInBattle] cp $2 ; is it a trainer battle? jr z, .copyHPAndStatusFromPartyData ld a, [W_ENEMYBATTSTATUS3] @@ -6264,7 +6264,7 @@ LoadEnemyMonData: ; 3eb01 (f:6b01) ld [wEnemyMonStatus], a jr .copyTypes .copyTypes - ld hl, W_MONHTYPES + ld hl, wMonHTypes ld de, wEnemyMonType ld a, [hli] ; copy type 1 ld [de], a @@ -6275,7 +6275,7 @@ LoadEnemyMonData: ; 3eb01 (f:6b01) ld a, [hli] ; copy catch rate ld [de], a inc de - ld a, [W_ISINBATTLE] + ld a, [wIsInBattle] cp $2 ; is it a trainer battle? jr nz, .copyStandardMoves ; if it's a trainer battle, copy moves from enemy party data @@ -6288,7 +6288,7 @@ LoadEnemyMonData: ; 3eb01 (f:6b01) jr .loadMovePPs .copyStandardMoves ; for a wild mon, first copy default moves from the mon header - ld hl, W_MONHMOVES + ld hl, wMonHMoves ld a, [hli] ld [de], a inc de @@ -6310,7 +6310,7 @@ LoadEnemyMonData: ; 3eb01 (f:6b01) ld hl, wEnemyMonMoves ld de, wEnemyMonPP - 1 predef LoadMovePPs - ld hl, W_MONHBASESTATS + ld hl, wMonHBaseStats ld de, wEnemyMonBaseStats ld b, NUM_STATS .copyBaseStatsLoop @@ -6319,7 +6319,7 @@ LoadEnemyMonData: ; 3eb01 (f:6b01) inc de dec b jr nz, .copyBaseStatsLoop - ld hl, W_MONHCATCHRATE + ld hl, wMonHCatchRate ld a, [hli] ld [de], a inc de @@ -7751,10 +7751,10 @@ SwitchAndTeleportEffect: ; 3f739 (f:7739) ld a, [H_WHOSETURN] and a jr nz, .asm_3f791 - ld a, [W_ISINBATTLE] + ld a, [wIsInBattle] dec a jr nz, .asm_3f77e - ld a, [W_CURENEMYLVL] + ld a, [wCurEnemyLVL] ld b, a ld a, [wBattleMonLevel] cp b @@ -7793,12 +7793,12 @@ SwitchAndTeleportEffect: ; 3f739 (f:7739) jp nz, PrintText jp PrintButItFailedText_ .asm_3f791 - ld a, [W_ISINBATTLE] + ld a, [wIsInBattle] dec a jr nz, .asm_3f7d1 ld a, [wBattleMonLevel] ld b, a - ld a, [W_CURENEMYLVL] + ld a, [wCurEnemyLVL] cp b jr nc, .asm_3f7c1 add b diff --git a/engine/battle/draw_hud_pokeball_gfx.asm b/engine/battle/draw_hud_pokeball_gfx.asm index c1387b7b..cc0219eb 100644 --- a/engine/battle/draw_hud_pokeball_gfx.asm +++ b/engine/battle/draw_hud_pokeball_gfx.asm @@ -1,7 +1,7 @@ DrawAllPokeballs: ; 3a849 (e:6849) call LoadPartyPokeballGfx call SetupOwnPartyPokeballs - ld a, [W_ISINBATTLE] + ld a, [wIsInBattle] dec a ret z ; return if wild pokémon jp SetupEnemyPartyPokeballs diff --git a/engine/battle/end_of_battle.asm b/engine/battle/end_of_battle.asm index f1de313c..2f84c6fe 100755 --- a/engine/battle/end_of_battle.asm +++ b/engine/battle/end_of_battle.asm @@ -47,10 +47,10 @@ EndOfBattle: ; 137aa (4:77aa) xor a ld [wLowHealthAlarm], a ;disable low health alarm ld [wChannelSoundIDs + CH4], a - ld [W_ISINBATTLE], a + ld [wIsInBattle], a ld [W_BATTLETYPE], a ld [W_MOVEMISSED], a - ld [W_CUROPPONENT], a + ld [wCurOpponent], a ld [wForcePlayerToChooseMon], a ld [wNumRunAttempts], a ld [wEscapedFromBattle], a diff --git a/engine/battle/experience.asm b/engine/battle/experience.asm index ab3e3c19..65e18999 100644 --- a/engine/battle/experience.asm +++ b/engine/battle/experience.asm @@ -83,7 +83,7 @@ GainExperience: ; 5524f (15:524f) ld a, 1 .next ld [wGainBoostedExp], a - ld a, [W_ISINBATTLE] + ld a, [wIsInBattle] dec a ; is it a trainer battle? call nz, BoostExp ; if so, boost exp inc hl @@ -160,11 +160,11 @@ GainExperience: ; 5524f (15:524f) ld a, [hl] ; current level cp d jp z, .nextMon ; if level didn't change, go to next mon - ld a, [W_CURENEMYLVL] + ld a, [wCurEnemyLVL] push af push hl ld a, d - ld [W_CURENEMYLVL], a + ld [wCurEnemyLVL], a ld [hl], a ld bc, wPartyMon1Species - wPartyMon1Level add hl, bc @@ -261,7 +261,7 @@ GainExperience: ; 5524f (15:524f) predef FlagActionPredef pop hl pop af - ld [W_CURENEMYLVL], a + ld [wCurEnemyLVL], a .nextMon ld a, [wPartyCount] diff --git a/engine/battle/get_trainer_name.asm b/engine/battle/get_trainer_name.asm index d393b800..cf09ac66 100644 --- a/engine/battle/get_trainer_name.asm +++ b/engine/battle/get_trainer_name.asm @@ -1,5 +1,5 @@ GetTrainerName_: ; f67a5 (3d:67a5) - ld hl, W_GRASSRATE + ld hl, wGrassRate ld a, [wLinkState] and a jr nz, .foundName diff --git a/engine/battle/init_battle_variables.asm b/engine/battle/init_battle_variables.asm index 78f4ad22..5383a546 100644 --- a/engine/battle/init_battle_variables.asm +++ b/engine/battle/init_battle_variables.asm @@ -27,7 +27,7 @@ InitBattleVariables: ; f6236 (3d:6236) jr nz, .loop inc a ; POUND ld [wTestBattlePlayerSelectedMove], a - ld a, [W_CURMAP] + ld a, [wCurMap] cp SAFARI_ZONE_EAST jr c, .notSafariBattle cp SAFARI_ZONE_REST_HOUSE_1 diff --git a/engine/battle/moveEffects/drain_hp_effect.asm b/engine/battle/moveEffects/drain_hp_effect.asm index 1096794f..e977af32 100644 --- a/engine/battle/moveEffects/drain_hp_effect.asm +++ b/engine/battle/moveEffects/drain_hp_effect.asm @@ -1,5 +1,5 @@ DrainHPEffect_: ; 783f (1:783f) - ld hl, W_DAMAGE + ld hl, wDamage ld a, [hl] srl a ; divide damage by 2 ld [hli], a @@ -36,12 +36,12 @@ DrainHPEffect_: ; 783f (1:783f) dec bc ld [bc], a ; add damage to attacker's HP and copy new HP to wHPBarNewHP - ld a, [W_DAMAGE + 1] + ld a, [wDamage + 1] ld b, [hl] add b ld [hld], a ld [wHPBarNewHP], a - ld a, [W_DAMAGE] + ld a, [wDamage] ld b, [hl] adc b ld [hli], a diff --git a/engine/battle/moveEffects/one_hit_ko_effect.asm b/engine/battle/moveEffects/one_hit_ko_effect.asm index c1dde6ff..12f70b90 100644 --- a/engine/battle/moveEffects/one_hit_ko_effect.asm +++ b/engine/battle/moveEffects/one_hit_ko_effect.asm @@ -1,5 +1,5 @@ OneHitKOEffect_: ; f64db (3d:64db) - ld hl, W_DAMAGE + ld hl, wDamage xor a ld [hli], a ld [hl], a ; set the damage output to zero @@ -24,7 +24,7 @@ OneHitKOEffect_: ; f64db (3d:64db) ld a, [hl] sbc b jr c, .userIsSlower - ld hl, W_DAMAGE + ld hl, wDamage ld a, $ff ld [hli], a ld [hl], a diff --git a/engine/battle/moveEffects/recoil_effect.asm b/engine/battle/moveEffects/recoil_effect.asm index 51232af6..9b165932 100644 --- a/engine/battle/moveEffects/recoil_effect.asm +++ b/engine/battle/moveEffects/recoil_effect.asm @@ -8,9 +8,9 @@ RecoilEffect_: ; 1392c (4:792c) ld hl, wEnemyMonMaxHP .recoilEffect ld d, a - ld a, [W_DAMAGE] + ld a, [wDamage] ld b, a - ld a, [W_DAMAGE + 1] + ld a, [wDamage + 1] ld c, a srl b rr c diff --git a/engine/battle/moveEffects/substitute_effect.asm b/engine/battle/moveEffects/substitute_effect.asm index c72fffbe..54b752ef 100644 --- a/engine/battle/moveEffects/substitute_effect.asm +++ b/engine/battle/moveEffects/substitute_effect.asm @@ -44,7 +44,7 @@ SubstituteEffect_: ; 17dad (5:7dad) ld h, b ld l, c set HasSubstituteUp, [hl] - ld a, [W_OPTIONS] + ld a, [wOptions] bit 7, a ; battle animation is enabled? ld hl, PlayCurrentMoveAnimation ld b, BANK(PlayCurrentMoveAnimation) diff --git a/engine/battle/moveEffects/transform_effect.asm b/engine/battle/moveEffects/transform_effect.asm index fef6f7aa..bf252600 100644 --- a/engine/battle/moveEffects/transform_effect.asm +++ b/engine/battle/moveEffects/transform_effect.asm @@ -29,7 +29,7 @@ TransformEffect_: ; f637f (3d:637f) ld hl, HideSubstituteShowMonAnim ld b, BANK(HideSubstituteShowMonAnim) call nz, Bankswitch - ld a, [W_OPTIONS] + ld a, [wOptions] add a ld hl, PlayCurrentMoveAnimation ld b, BANK(PlayCurrentMoveAnimation) diff --git a/engine/battle/print_type.asm b/engine/battle/print_type.asm index 38c701a8..0270f8b7 100644 --- a/engine/battle/print_type.asm +++ b/engine/battle/print_type.asm @@ -6,11 +6,11 @@ PrintMonType: ; 27d6b (9:7d6b) call GetMonHeader pop hl push hl - ld a, [W_MONHTYPE1] + ld a, [wMonHType1] call PrintType - ld a, [W_MONHTYPE1] + ld a, [wMonHType1] ld b, a - ld a, [W_MONHTYPE2] + ld a, [wMonHType2] cp b pop hl jr z, EraseType2Text diff --git a/engine/battle/read_trainer_party.asm b/engine/battle/read_trainer_party.asm index 37a45476..9f94981e 100755 --- a/engine/battle/read_trainer_party.asm +++ b/engine/battle/read_trainer_party.asm @@ -15,7 +15,7 @@ ReadTrainer: ; 39c53 (e:5c53) ld [hl],a ; get the pointer to trainer data for this class - ld a,[W_CUROPPONENT] + ld a,[wCurOpponent] sub $C9 ; convert value from pokemon to trainer add a,a ld hl,TrainerDataPointers @@ -43,13 +43,13 @@ ReadTrainer: ; 39c53 (e:5c53) ; if the first byte of trainer data is FF, ; - each pokemon has a specific level ; (as opposed to the whole team being of the same level) -; - if [W_LONEATTACKNO] != 0, one pokemon on the team has a special move +; - if [wLoneAttackNo] != 0, one pokemon on the team has a special move ; else the first byte is the level of every pokemon on the team .IterateTrainer ld a,[hli] cp $FF ; is the trainer special? jr z,.SpecialTrainer ; if so, check for special moves - ld [W_CURENEMYLVL],a + ld [wCurEnemyLVL],a .LoopTrainerData ld a,[hli] and a ; have we reached the end of the trainer data? @@ -65,11 +65,11 @@ ReadTrainer: ; 39c53 (e:5c53) ; if this code is being run: ; - each pokemon has a specific level ; (as opposed to the whole team being of the same level) -; - if [W_LONEATTACKNO] != 0, one pokemon on the team has a special move +; - if [wLoneAttackNo] != 0, one pokemon on the team has a special move ld a,[hli] and a ; have we reached the end of the trainer data? jr z,.AddLoneMove - ld [W_CURENEMYLVL],a + ld [wCurEnemyLVL],a ld a,[hli] ld [wcf91],a ld a,ENEMY_PARTY_DATA @@ -80,7 +80,7 @@ ReadTrainer: ; 39c53 (e:5c53) jr .SpecialTrainer .AddLoneMove ; does the trainer have a single monster with a different move - ld a,[W_LONEATTACKNO] ; Brock is 01, Misty is 02, Erika is 04, etc + ld a,[wLoneAttackNo] ; Brock is 01, Misty is 02, Erika is 04, etc and a jr z,.AddTeamMove dec a @@ -100,7 +100,7 @@ ReadTrainer: ; 39c53 (e:5c53) ; check if our trainer's team has special moves ; get trainer class number - ld a,[W_CUROPPONENT] + ld a,[wCurOpponent] sub 200 ld b,a ld hl,TeamMoves @@ -150,7 +150,7 @@ ReadTrainer: ; 39c53 (e:5c53) ld [de],a inc de ld [de],a - ld a,[W_CURENEMYLVL] + ld a,[wCurEnemyLVL] ld b,a .LastLoop ; update wAmountMoneyWon addresses (money to win) based on enemy's level @@ -162,5 +162,5 @@ ReadTrainer: ; 39c53 (e:5c53) inc de inc de dec b - jr nz,.LastLoop ; repeat W_CURENEMYLVL times + jr nz,.LastLoop ; repeat wCurEnemyLVL times ret diff --git a/engine/battle/safari_zone.asm b/engine/battle/safari_zone.asm index 00627d74..69439199 100755 --- a/engine/battle/safari_zone.asm +++ b/engine/battle/safari_zone.asm @@ -18,7 +18,7 @@ PrintSafariZoneBattleText: ; 4111 (1:4111) ld a, [wEnemyMonSpecies] ld [wd0b5], a call GetMonHeader - ld a, [W_MONHCATCHRATE] + ld a, [wMonHCatchRate] ld [wEnemyMonCatchRate], a pop hl .asm_4138 diff --git a/engine/battle/trainer_ai.asm b/engine/battle/trainer_ai.asm index afb04216..072d3c8a 100644 --- a/engine/battle/trainer_ai.asm +++ b/engine/battle/trainer_ai.asm @@ -338,7 +338,7 @@ INCLUDE "data/trainer_parties.asm" TrainerAI: ; 3a52e (e:652e) and a - ld a,[W_ISINBATTLE] + ld a,[wIsInBattle] dec a ret z ; if not a trainer, we're done here ld a,[wLinkState] diff --git a/engine/battle/wild_encounters.asm b/engine/battle/wild_encounters.asm index 908bd493..044f7ea5 100644 --- a/engine/battle/wild_encounters.asm +++ b/engine/battle/wild_encounters.asm @@ -27,24 +27,24 @@ TryDoWildEncounter: ; 13870 (4:7870) ; is the bottom right tile (9,9) of the half-block we're standing in a grass/water tile? coord hl, 9, 9 ld c, [hl] - ld a, [W_GRASSTILE] + ld a, [wGrassTile] cp c - ld a, [W_GRASSRATE] + ld a, [wGrassRate] jr z, .CanEncounter ld a, $14 ; in all tilesets with a water tile, this is its id cp c - ld a, [W_WATERRATE] + ld a, [wWaterRate] jr z, .CanEncounter ; even if not in grass/water, standing anywhere we can encounter pokemon ; so long as the map is "indoor" and has wild pokemon defined. ; ...as long as it's not Viridian Forest or Safari Zone. - ld a, [W_CURMAP] + ld a, [wCurMap] cp REDS_HOUSE_1F ; is this an indoor map? jr c, .CantEncounter2 ld a, [wCurMapTileset] cp FOREST ; Viridian Forest/Safari Zone jr z, .CantEncounter2 - ld a, [W_GRASSRATE] + ld a, [wGrassRate] .CanEncounter ; compare encounter chance with a random number to determine if there will be an encounter ld b, a @@ -63,18 +63,18 @@ TryDoWildEncounter: ; 13870 (4:7870) .gotEncounterSlot ; determine which wild pokemon (grass or water) can appear in the half-block we're standing in ld c, [hl] - ld hl, W_GRASSMONS + ld hl, wGrassMons aCoord 8, 9 cp $14 ; is the bottom left tile (8,9) of the half-block we're standing in a water tile? jr nz, .gotWildEncounterType ; else, it's treated as a grass tile by default - ld hl, W_WATERMONS + ld hl, wWaterMons ; since the bottom right tile of a "left shore" half-block is $14 but the bottom left tile is not, ; "left shore" half-blocks (such as the one in the east coast of Cinnabar) load grass encounters. .gotWildEncounterType ld b, 0 add hl, bc ld a, [hli] - ld [W_CURENEMYLVL], a + ld [wCurEnemyLVL], a ld a, [hl] ld [wcf91], a ld [wEnemyMonSpecies2], a @@ -83,7 +83,7 @@ TryDoWildEncounter: ; 13870 (4:7870) jr z, .willEncounter ld a, [wPartyMon1Level] ld b, a - ld a, [W_CURENEMYLVL] + ld a, [wCurEnemyLVL] cp b jr c, .CantEncounter2 ; repel prevents encounters if the leading party mon's level is higher than the wild mon jr .willEncounter diff --git a/engine/cable_club.asm b/engine/cable_club.asm index 059b309a..2ec470df 100755 --- a/engine/cable_club.asm +++ b/engine/cable_club.asm @@ -1,7 +1,7 @@ ; performs the appropriate action when the player uses the gameboy on the table in the Colosseum or Trade Center ; In the Colosseum, it starts a battle. In the Trade Center, it displays the trade selection screen. ; Before doing either action, it swaps random numbers, trainer names and party data with the other gameboy. -CableClub_DoBattleOrTrade: ; 5317 (1:5317) +CableClub_DoBattleOrTrade: ; 53a5 (1:53a5) ld c, 80 call DelayFrames call ClearScreen @@ -10,8 +10,7 @@ CableClub_DoBattleOrTrade: ; 5317 (1:5317) call LoadHpBarAndStatusTilePatterns call LoadTrainerInfoTextBoxTiles coord hl, 3, 8 - ld b, 2 - ld c, 12 + lb bc, 2, 12 call CableClub_TextBoxBorder coord hl, 4, 10 ld de, PleaseWaitString @@ -23,14 +22,14 @@ CableClub_DoBattleOrTrade: ; 5317 (1:5317) ; fall through ; This is called after completing a trade. -CableClub_DoBattleOrTradeAgain: ; 5345 +CableClub_DoBattleOrTradeAgain: ; 53d2 (1:53d2) ld hl, wSerialPlayerDataBlock ld a, SERIAL_PREAMBLE_BYTE ld b, 6 -.writePlayeDataBlockPreambleLoop +.writePlayerDataBlockPreambleLoop ld [hli], a dec b - jr nz, .writePlayeDataBlockPreambleLoop + jr nz, .writePlayerDataBlockPreambleLoop ld hl, wSerialRandomNumberListBlock ld a, SERIAL_PREAMBLE_BYTE ld b, 7 @@ -57,8 +56,8 @@ CableClub_DoBattleOrTradeAgain: ; 5345 ld [hli], a dec b jr nz, .zeroPlayerDataPatchListLoop - ld hl, W_GRASSRATE - ld bc, W_TRAINERHEADERPTR - W_GRASSRATE + ld hl, wGrassRate + ld bc, wTrainerHeaderPtr - wGrassRate .zeroEnemyPartyLoop xor a ld [hli], a @@ -119,6 +118,7 @@ CableClub_DoBattleOrTradeAgain: ; 5345 ld [rSC], a .skipSendingTwoZeroBytes call Delay3 + call StopAllMusic ld a, (1 << SERIAL) ld [rIE], a ld hl, wSerialRandomNumberListBlock @@ -139,8 +139,6 @@ CableClub_DoBattleOrTradeAgain: ; 5345 call Serial_ExchangeBytes ld a, (1 << SERIAL) | (1 << TIMER) | (1 << VBLANK) ld [rIE], a - ld a, $ff - call PlaySound ld a, [hSerialConnectionStatus] cp USING_INTERNAL_CLOCK jr z, .skipCopyingRandomNumberList ; the list generated by the gameboy clocking the connection is used by both gameboys @@ -186,7 +184,7 @@ CableClub_DoBattleOrTradeAgain: ; 5345 dec c jr nz, .copyEnemyNameLoop ld de, wEnemyPartyCount - ld bc, W_TRAINERHEADERPTR - wEnemyPartyCount + ld bc, wTrainerHeaderPtr - wEnemyPartyCount .copyEnemyPartyLoop ld a, [hli] cp SERIAL_NO_DATA_BYTE @@ -255,14 +253,13 @@ CableClub_DoBattleOrTradeAgain: ; 5345 ld hl, wEnemyMons + (SERIAL_PREAMBLE_BYTE - 1) dec c jr nz, .unpatchEnemyMonsLoop - ld a, wEnemyMonOT % $100 + ld a, wEnemyMonOT & $ff ld [wUnusedCF8D], a ld a, wEnemyMonOT / $100 ld [wUnusedCF8D + 1], a xor a ld [wTradeCenterPointerTableIndex], a - ld a, $ff - call PlaySound + call StopAllMusic ld a, [hSerialConnectionStatus] cp USING_INTERNAL_CLOCK ld c, 66 @@ -271,28 +268,36 @@ CableClub_DoBattleOrTradeAgain: ; 5345 cp LINK_STATE_START_BATTLE ld a, LINK_STATE_TRADING ld [wLinkState], a - jr nz, .asm_5506 + jr nz, .asm_55a0 ld a, LINK_STATE_BATTLING ld [wLinkState], a ld a, OPP_SONY1 - ld [W_CUROPPONENT], a + ld [wCurOpponent], a call ClearScreen call Delay3 - ld hl, W_OPTIONS + ld b, $9 + call RunPaletteCommand + ld hl, wOptions res 7, [hl] + ld a, [wLetterPrintingDelayFlags] + push af + xor a + ld [wLetterPrintingDelayFlags], a predef InitOpponent + pop af + ld [wLetterPrintingDelayFlags], a predef HealParty jp ReturnToCableClubRoom -.asm_5506 +.asm_55a0 ld c, BANK(Music_GameCorner) ld a, MUSIC_GAME_CORNER call PlayMusic jr CallCurrentTradeCenterFunction -PleaseWaitString: ; 550f (1:550f) +PleaseWaitString: ; 55a9 (1:55a9) db "PLEASE WAIT!@" -CallCurrentTradeCenterFunction: +CallCurrentTradeCenterFunction: ; 55b6 (1:55b6) ld hl, TradeCenterPointerTable ld b, 0 ld a, [wTradeCenterPointerTableIndex] @@ -306,8 +311,11 @@ CallCurrentTradeCenterFunction: ld l, a jp [hl] -TradeCenter_SelectMon: +TradeCenter_SelectMon: ; 55ca (1:55ca) call ClearScreen + call Delay3 + ld b, $9 + call RunPaletteCommand call LoadTrainerInfoTextBoxTiles call TradeCenter_DrawPartyLists call TradeCenter_DrawCancelBox @@ -438,6 +446,7 @@ TradeCenter_SelectMon: ld a, [wEnemyPartyCount] dec a cp b + ; continue jr nc, .notPastLastEnemyMon ; when switching to the enemy mon menu, if the menu selection would be past the last enemy mon, select the last enemy mon ld [wCurrentMenuItem], a @@ -465,8 +474,7 @@ TradeCenter_SelectMon: .displayStatsTradeMenu push af coord hl, 0, 14 - ld b, 2 - ld c, 18 + lb bc, 2, 18 call CableClub_TextBoxBorder coord hl, 2, 16 ld de, .statsTrade @@ -576,7 +584,7 @@ TradeCenter_SelectMon: jr nz, .cancelMenuItem_Loop ; fall through -ReturnToCableClubRoom: ; 577d (1:577d) +ReturnToCableClubRoom: ; 581e (1:581e) call GBPalWhiteOutWithDelay3 ld hl, wFontLoaded ld a, [hl] @@ -595,23 +603,22 @@ ReturnToCableClubRoom: ; 577d (1:577d) call GBFadeInFromWhite ret -TradeCenter_DrawCancelBox: +TradeCenter_DrawCancelBox: ; 5843 (1:5843) coord hl, 11, 15 ld a, $7e ld bc, 2 * SCREEN_WIDTH + 9 call FillMemory coord hl, 0, 15 - ld b, 1 - ld c, 9 + lb bc, 1, 9 call CableClub_TextBoxBorder coord hl, 2, 16 ld de, CancelTextString jp PlaceString -CancelTextString: +CancelTextString: ; 5860 (1:5860) db "CANCEL@" -TradeCenter_PlaceSelectedEnemyMonMenuCursor: +TradeCenter_PlaceSelectedEnemyMonMenuCursor: ; 5867 (1:5867) ld a, [wSerialSyncAndExchangeNybbleReceiveData] coord hl, 1, 9 ld bc, SCREEN_WIDTH @@ -619,24 +626,25 @@ TradeCenter_PlaceSelectedEnemyMonMenuCursor: ld [hl], $ec ; cursor ret -TradeCenter_DisplayStats: +TradeCenter_DisplayStats: ; 5876 (1:5876) ld a, [wCurrentMenuItem] ld [wWhichPokemon], a predef StatusScreen predef StatusScreen2 + call Delay3 + ld b, $9 + call RunPaletteCommand call GBPalNormal call LoadTrainerInfoTextBoxTiles call TradeCenter_DrawPartyLists jp TradeCenter_DrawCancelBox -TradeCenter_DrawPartyLists: +TradeCenter_DrawPartyLists: ; 589a (1:589a) coord hl, 0, 0 - ld b, 6 - ld c, 18 + lb bc, 6, 18 call CableClub_TextBoxBorder coord hl, 0, 8 - ld b, 6 - ld c, 18 + lb bc, 6, 18 call CableClub_TextBoxBorder coord hl, 5, 0 ld de, wPlayerName @@ -651,7 +659,7 @@ TradeCenter_DrawPartyLists: ld de, wEnemyPartyMons ; fall through -TradeCenter_PrintPartyListNames: +TradeCenter_PrintPartyListNames: ; 58cd (1:58cd) ld c, $0 .loop ld a, [de] @@ -676,7 +684,7 @@ TradeCenter_PrintPartyListNames: inc c jr .loop -TradeCenter_Trade: +TradeCenter_Trade: ; 58ef (1:58ef) ld c, 100 call DelayFrames xor a @@ -685,8 +693,7 @@ TradeCenter_Trade: ld [wMenuWatchMovingOutOfBounds], a ld [wMenuJoypadPollCount], a coord hl, 0, 12 - ld b, 4 - ld c, 18 + lb bc, 4, 18 call CableClub_TextBoxBorder ld a, [wTradingWhichPlayerMon] ld hl, wPartySpecies @@ -727,8 +734,7 @@ TradeCenter_Trade: ld a, $1 ld [wSerialExchangeNybbleSendData], a coord hl, 0, 12 - ld b, 4 - ld c, 18 + lb bc, 4, 18 call CableClub_TextBoxBorder coord hl, 1, 14 ld de, TradeCanceled @@ -744,8 +750,7 @@ TradeCenter_Trade: jr nz, .doTrade ; if the other person cancelled coord hl, 0, 12 - ld b, 4 - ld c, 18 + lb bc, 4, 18 call CableClub_TextBoxBorder coord hl, 1, 14 ld de, TradeCanceled @@ -792,6 +797,7 @@ TradeCenter_Trade: add hl, bc ld a, [hl] ld [wTradedPlayerMonSpecies], a + callabd_ModifyPikachuHappiness PIKAHAPPY_TRADE xor a ld [wRemoveMonFromBox], a call RemovePokemon @@ -845,15 +851,18 @@ TradeCenter_Trade: .usingExternalClock predef ExternalClockTradeAnim .tradeCompleted +; continue callab TryEvolvingMon call ClearScreen call LoadTrainerInfoTextBoxTiles call Serial_PrintWaitingTextAndSyncAndExchangeNybble ld c, 40 call DelayFrames + call Delay3 + ld b, $9 + call RunPaletteCommand coord hl, 0, 12 - ld b, 4 - ld c, 18 + lb bc, 4, 18 call CableClub_TextBoxBorder coord hl, 1, 14 ld de, TradeCompleted @@ -871,22 +880,22 @@ TradeCenter_Trade: ld [wTradeCenterPointerTableIndex], a jp CallCurrentTradeCenterFunction -WillBeTradedText: ; 5a24 (1:5a24) +WillBeTradedText: ; 5ad8 (1:5ad8) TX_FAR _WillBeTradedText db "@" -TradeCompleted: +TradeCompleted: ; 5add (1:5add) db "Trade completed!@" -TradeCanceled: +TradeCanceled: ; 5aee (1:5aee) db "Too bad! The trade" next "was canceled!@" -TradeCenterPointerTable: ; 5a5b (1:5a5b) +TradeCenterPointerTable: ; 5b0f (1:5b0f) dw TradeCenter_SelectMon dw TradeCenter_Trade -CableClub_Run: ; 5a5f (1:5a5f) +CableClub_Run: ; 5b13 (1:5b13) ld a, [wLinkState] cp LINK_STATE_START_TRADE jr z, .doBattleOrTrade @@ -900,18 +909,18 @@ CableClub_Run: ; 5a5f (1:5a5f) call CableClub_DoBattleOrTrade ld hl, Club_GFX ld a, h - ld [W_TILESETGFXPTR + 1], a + ld [wTilesetGFXPtr + 1], a ld a, l - ld [W_TILESETGFXPTR], a + ld [wTilesetGFXPtr], a ld a, Bank(Club_GFX) - ld [W_TILESETBANK], a + ld [wTilesetBank], a ld hl, Club_Coll ld a, h - ld [W_TILESETCOLLISIONPTR + 1], a + ld [wTilesetCollisionPtr + 1], a ld a, l - ld [W_TILESETCOLLISIONPTR], a + ld [wTilesetCollisionPtr], a xor a - ld [W_GRASSRATE], a + ld [wGrassRate], a inc a ; LINK_STATE_IN_CABLE_CLUB ld [wLinkState], a ld [$ffb5], a @@ -923,15 +932,15 @@ CableClub_Run: ; 5a5f (1:5a5f) ld [wNewSoundID], a jp PlaySound -EmptyFunc3: ; 5aaf (1:5aaf) +EmptyFunc3: ; 5b63 (1:5b63) ret -Diploma_TextBoxBorder: ; 5ab0 (1:5ab0) +Diploma_TextBoxBorder: ; 5b64 (1:5b64) call GetPredefRegisters ; b = height ; c = width -CableClub_TextBoxBorder: ; 5ab3 (1:5ab3) +CableClub_TextBoxBorder: ; 5b67 (1:5b67) push hl ld a, $78 ; border upper left corner tile ld [hli], a @@ -962,10 +971,10 @@ CableClub_TextBoxBorder: ; 5ab3 (1:5ab3) ret ; c = width -CableClub_DrawHorizontalLine: ; 5ae0 (1:5ae0) +CableClub_DrawHorizontalLine: ; 5b94 (1:5b94) ld d, c -.asm_5ae1 +.drawHorizontalLineLoop ld [hli], a dec d - jr nz, .asm_5ae1 - ret + jr nz, .drawHorizontalLineLoop + ret
\ No newline at end of file diff --git a/engine/evos_moves.asm b/engine/evos_moves.asm index 056c125e..2113e50a 100755 --- a/engine/evos_moves.asm +++ b/engine/evos_moves.asm @@ -105,7 +105,7 @@ Evolution_PartyMonLoop: ; loop over party mons cp b ; is the mon's level greater than the evolution requirement? jp c, .nextEvoEntry2 ; if so, go the next evolution entry .doEvolution - ld [W_CURENEMYLVL], a + ld [wCurEnemyLVL], a ld a, 1 ld [wEvolutionOccurred], a push hl @@ -163,10 +163,10 @@ Evolution_PartyMonLoop: ; loop over party mons ld hl, BaseStats ld bc, MonBaseStatsEnd - MonBaseStats call AddNTimes - ld de, W_MONHEADER + ld de, wMonHeader call CopyData ld a, [wd0b5] - ld [W_MONHINDEX], a + ld [wMonHIndex], a pop af ld [wd11e], a ld hl, wLoadedMonHPExp - 1 @@ -210,7 +210,7 @@ Evolution_PartyMonLoop: ; loop over party mons call LearnMoveFromLevelUp pop hl predef SetPartyMonTypes - ld a, [W_ISINBATTLE] + ld a, [wIsInBattle] and a call z, Evolution_ReloadTilesetTilePatterns predef IndexToPokedex @@ -249,7 +249,7 @@ Evolution_PartyMonLoop: ; loop over party mons ld a, [wLinkState] cp LINK_STATE_TRADING ret z - ld a, [W_ISINBATTLE] + ld a, [wIsInBattle] and a ret nz ld a, [wEvolutionOccurred] @@ -262,7 +262,7 @@ RenameEvolvedMon: ; 3aef7 (e:6ef7) ; nickname, in which case the nickname is kept. ld a, [wd0b5] push af - ld a, [W_MONHINDEX] + ld a, [wMonHIndex] ld [wd0b5], a call GetName pop af @@ -340,7 +340,7 @@ LearnMoveFromLevelUp: ; 3af5b (e:6f5b) and a ; have we reached the end of the learn set? jr z, .done ; if we've reached the end of the learn set, jump ld b, a ; level the move is learnt at - ld a, [W_CURENEMYLVL] + ld a, [wCurEnemyLVL] cp b ; is the move learnt at the mon's current level? ld a, [hli] ; move ID jr nz, .learnSetLoop @@ -375,7 +375,7 @@ LearnMoveFromLevelUp: ; 3af5b (e:6f5b) ld [wd11e], a ret -; writes the moves a mon has at level [W_CURENEMYLVL] to [de] +; writes the moves a mon has at level [wCurEnemyLVL] to [de] ; move slots are being filled up sequentially and shifted if all slots are full WriteMonMoves: ; 3afb8 (e:6fb8) call GetPredefRegisters @@ -407,7 +407,7 @@ WriteMonMoves: ; 3afb8 (e:6fb8) and a jp z, .done ; end of list ld b, a - ld a, [W_CURENEMYLVL] + ld a, [wCurEnemyLVL] cp b jp c, .done ; mon level < move level (assumption: learnset is sorted by level) ld a, [wLearningMovesFromDayCare] diff --git a/engine/experience.asm b/engine/experience.asm index b43fbcf9..e1037950 100755 --- a/engine/experience.asm +++ b/engine/experience.asm @@ -29,7 +29,7 @@ CalcLevelFromExperience: ; 58f43 (16:4f43) ; calculates the amount of experience needed for level d CalcExperience: ; 58f6a (16:4f6a) - ld a, [W_MONHGROWTHRATE] + ld a, [wMonHGrowthRate] add a add a ld c, a diff --git a/engine/hidden_object_functions18.asm b/engine/hidden_object_functions18.asm index 0a93fd44..ab66a818 100755 --- a/engine/hidden_object_functions18.asm +++ b/engine/hidden_object_functions18.asm @@ -7,7 +7,7 @@ GymStatues: ; 62419 (18:6419) cp SPRITE_FACING_UP ret nz ld hl, .BadgeFlags - ld a, [W_CURMAP] + ld a, [wCurMap] ld b, a .loop ld a, [hli] @@ -50,7 +50,7 @@ GymStatueText2: ; 62458 (18:6458) PrintBenchGuyText: ; 6245d (18:645d) call EnableAutoTextBoxDrawing ld hl, BenchGuyTextPointers - ld a, [W_CURMAP] + ld a, [wCurMap] ld b, a .loop ld a, [hli] diff --git a/engine/hidden_object_functions3.asm b/engine/hidden_object_functions3.asm index ba6d1fd3..e43ae451 100755 --- a/engine/hidden_object_functions3.asm +++ b/engine/hidden_object_functions3.asm @@ -78,7 +78,7 @@ IndigoPlateauStatues: ; fa4d (3:7a4d) TX_ASM ld hl, IndigoPlateauStatuesText1 call PrintText - ld a, [W_XCOORD] + ld a, [wXCoord] bit 0, a ld hl, IndigoPlateauStatuesText2 jr nz, .asm_fa61 diff --git a/engine/hidden_object_functions7.asm b/engine/hidden_object_functions7.asm index 02d3928a..b61dc68a 100755 --- a/engine/hidden_object_functions7.asm +++ b/engine/hidden_object_functions7.asm @@ -38,7 +38,7 @@ StrengthsAndWeaknessesText: ; 1e983 (7:6983) SafariZoneCheck: ; 1e988 (7:6988) CheckEventHL EVENT_IN_SAFARI_ZONE ; if we are not in the Safari Zone, jr z, SafariZoneGameStillGoing ; don't bother printing game over text - ld a, [W_NUMSAFARIBALLS] + ld a, [wNumSafariBalls] and a jr z, SafariZoneGameOver jr SafariZoneGameStillGoing @@ -97,7 +97,7 @@ PrintSafariGameOverText: ; 1e9ed (7:69ed) SafariGameOverText: ; 1e9f7 (7:69f7) TX_ASM - ld a, [W_NUMSAFARIBALLS] + ld a, [wNumSafariBalls] and a jr z, .asm_1ea04 ld hl, TimesUpText diff --git a/engine/in_game_trades.asm b/engine/in_game_trades.asm index 553f550d..80cb27f3 100755 --- a/engine/in_game_trades.asm +++ b/engine/in_game_trades.asm @@ -100,20 +100,20 @@ InGameTrade_DoTrade: ; 71ca9 (1c:5ca9) ld bc, wPartyMon2 - wPartyMon1 call AddNTimes ld a,[hl] - ld [W_CURENEMYLVL],a + ld [wCurEnemyLVL],a ld b,FLAG_SET call InGameTrade_FlagActionPredef ld hl, ConnectCableText call PrintText ld a,[wWhichPokemon] push af - ld a,[W_CURENEMYLVL] + ld a,[wCurEnemyLVL] push af call LoadHpBarAndStatusTilePatterns call InGameTrade_PrepareTradeData predef InternalClockTradeAnim pop af - ld [W_CURENEMYLVL],a + ld [wCurEnemyLVL],a pop af ld [wWhichPokemon],a ld a,[wInGameTradeReceiveMonSpecies] diff --git a/engine/intro.asm b/engine/intro.asm index 6d2e350c..5a14dca7 100755 --- a/engine/intro.asm +++ b/engine/intro.asm @@ -312,7 +312,7 @@ PlayShootingStar: ; 4188a (10:588a) call ClearScreen call DisableLCD xor a - ld [W_CUROPPONENT], a + ld [wCurOpponent], a call IntroDrawBlackBars call LoadIntroGraphics call EnableLCD diff --git a/engine/items/itemfinder.asm b/engine/items/itemfinder.asm index 5da72388..d638b0b8 100755 --- a/engine/items/itemfinder.asm +++ b/engine/items/itemfinder.asm @@ -3,7 +3,7 @@ HiddenItemNear: ; 7481f (1d:481f) ld b, 0 .loop ld de, 3 - ld a, [W_CURMAP] + ld a, [wCurMap] call IsInRestOfArray ret nc ; return if current map has no hidden items push bc @@ -24,19 +24,19 @@ HiddenItemNear: ; 7481f (1d:481f) inc hl jr nz, .loop ; if the item has already been obtained ; check if the item is within 4-5 tiles (depending on the direction of item) - ld a, [W_YCOORD] + ld a, [wYCoord] call Sub5ClampTo0 cp d jr nc, .loop - ld a, [W_YCOORD] + ld a, [wYCoord] add 4 cp d jr c, .loop - ld a, [W_XCOORD] + ld a, [wXCoord] call Sub5ClampTo0 cp e jr nc, .loop - ld a, [W_XCOORD] + ld a, [wXCoord] add 5 cp e jr c, .loop diff --git a/engine/items/items.asm b/engine/items/items.asm index 2b3c1840..8671e34a 100755 --- a/engine/items/items.asm +++ b/engine/items/items.asm @@ -101,7 +101,7 @@ ItemUsePtrTable: ; d307 (3:5307) dw ItemUsePPRestore ; MAX_ELIXER ItemUseBall: ; d3ad (3:53ad) - ld a,[W_ISINBATTLE] + ld a,[wIsInBattle] and a jp z,ItemUseNotTime ; not in battle dec a @@ -126,7 +126,7 @@ ItemUseBall: ; d3ad (3:53ad) jr nz,.skipSafariZoneCode .safariZone ; remove a Safari Ball from inventory - ld hl,W_NUMSAFARIBALLS + ld hl,wNumSafariBalls dec [hl] .skipSafariZoneCode call RunDefaultPaletteCommand @@ -145,7 +145,7 @@ ItemUseBall: ; d3ad (3:53ad) jr z,.oldManBattle ; pikachu battle technically old man battle jr .notOldManBattle .oldManBattle - ld hl,W_GRASSRATE + ld hl,wGrassRate ld de,wPlayerName ld bc,NAME_LENGTH call CopyData ; save the player's name in the Wild Monster data @@ -160,7 +160,7 @@ ItemUseBall: ; d3ad (3:53ad) jp nz,.next12 jp .BallSuccess .notOldManBattle - ld a,[W_CURMAP] + ld a,[wCurMap] cp a,POKEMONTOWER_6 jr nz,.loop ld a,[wEnemyMonSpecies2] @@ -390,7 +390,7 @@ ItemUseBall: ; d3ad (3:53ad) ld a,[wEnemyMonSpecies2] ld [wcf91],a ld a,[wEnemyMonLevel] - ld [W_CURENEMYLVL],a + ld [wCurEnemyLVL],a callab LoadEnemyMonData pop af ld [wcf91],a @@ -522,13 +522,13 @@ ItemUseBallText06: ; d6c1 (3:56c1) db "@" ItemUseTownMap: ; d6c8 (3:56c8) - ld a,[W_ISINBATTLE] + ld a,[wIsInBattle] and a jp nz,ItemUseNotTime jpba DisplayTownMap ItemUseBicycle: ; d6d7 (3:56d7) - ld a,[W_ISINBATTLE] + ld a,[wIsInBattle] and a jp nz,ItemUseNotTime ld a,[wWalkBikeSurfState] @@ -652,7 +652,7 @@ ItemUsePokedex: ; d7cb (3:57cb) predef_jump ShowPokedexMenu ItemUseEvoStone: ; d7d0 (3:57d0) - ld a,[W_ISINBATTLE] + ld a,[wIsInBattle] and a jp nz,ItemUseNotTime ld a,[wWhichPokemon] @@ -757,7 +757,7 @@ RefusingText: ; d8a2 (3:58a2) db "@" ItemUseVitamin: ; d8a7 (3:58a7) - ld a,[W_ISINBATTLE] + ld a,[wIsInBattle] and a jp nz,ItemUseNotTime @@ -903,7 +903,7 @@ ItemUseMedicine: ; d8ae (3:58ae) pop af ld [wWhichPokemon], a - ld a,[W_ISINBATTLE] + ld a,[wIsInBattle] and a jr z,.compareCurrentHPToMaxHP push hl @@ -1221,7 +1221,7 @@ ItemUseMedicine: ; d8ae (3:58ae) ret nz ; if so, return call GBPalWhiteOut call z,RunDefaultPaletteCommand - ld a,[W_ISINBATTLE] + ld a,[wIsInBattle] and a ret nz jp ReloadMapData @@ -1233,7 +1233,7 @@ ItemUseMedicine: ; d8ae (3:58ae) ld bc,33 add hl,bc ; hl now points to level ld a,[hl] ; a = level - ld [W_CURENEMYLVL],a ; store level + ld [wCurEnemyLVL],a ; store level call GetMonHeader push de ld a,d @@ -1312,7 +1312,7 @@ ItemUseMedicine: ; d8ae (3:58ae) jr z,.vitaminNoEffect ; can't raise level above 100 inc a ld [hl],a ; store incremented level - ld [W_CURENEMYLVL],a + ld [wCurEnemyLVL],a push hl push de ld d,a @@ -1473,10 +1473,10 @@ ThrewRockText: ; ddca (3:5dca) ; also used for Dig out-of-battle effect ItemUseEscapeRope: ; ddcf (3:5dcf) - ld a,[W_ISINBATTLE] + ld a,[wIsInBattle] and a jr nz,.notUsable - ld a,[W_CURMAP] + ld a,[wCurMap] cp a,AGATHAS_ROOM jr z,.notUsable cp a,BILLS_HOUSE @@ -1501,7 +1501,7 @@ ItemUseEscapeRope: ; ddcf (3:5dcf) ld hl,wd790 res 7,[hl] xor a - ld [W_NUMSAFARIBALLS],a + ld [wNumSafariBalls],a ld [W_SAFARIZONEENTRANCECURSCRIPT],a inc a ld [wEscapedFromBattle],a @@ -1524,7 +1524,7 @@ ItemUseRepel: ; de2e (3:5e2e) ld b,100 ItemUseRepelCommon: ; e005 (3:6005) - ld a,[W_ISINBATTLE] + ld a,[wIsInBattle] and a jp nz,ItemUseNotTime ld a,b @@ -1533,7 +1533,7 @@ ItemUseRepelCommon: ; e005 (3:6005) ; handles X Accuracy item ItemUseXAccuracy: ; de3e (3:5e3e) - ld a,[W_ISINBATTLE] + ld a,[wIsInBattle] and a jp z,ItemUseNotTime ld hl,W_PLAYERBATTSTATUS2 @@ -1562,7 +1562,7 @@ ItemUseCardKey: ; de57 (3:de57) jp nz,ItemUseNotTime ld hl,CardKeyTable3 .next1 - ld a,[W_CURMAP] + ld a,[wCurMap] ld b,a .loop ld a,[hli] @@ -1635,7 +1635,7 @@ CardKeyTable3: ; def9 (3:5ef9) db $ff ItemUsePokedoll: ; df02 (3:5f02) - ld a,[W_ISINBATTLE] + ld a,[wIsInBattle] dec a jp nz,ItemUseNotTime ld a,$01 @@ -1643,7 +1643,7 @@ ItemUsePokedoll: ; df02 (3:5f02) jp PrintItemUseTextAndRemoveItem ItemUseGuardSpec: ; df11 (3:5f11) - ld a,[W_ISINBATTLE] + ld a,[wIsInBattle] and a jp z,ItemUseNotTime @@ -1668,7 +1668,7 @@ ItemUseMaxRepel: ; df3d (3:5f3d) jp ItemUseRepelCommon ItemUseDireHit: ; df42 (3:5f42) - ld a,[W_ISINBATTLE] + ld a,[wIsInBattle] and a jp z,ItemUseNotTime @@ -1685,7 +1685,7 @@ ItemUseDireHit: ; df42 (3:5f42) jp PrintItemUseTextAndRemoveItem ItemUseXStat: ; df69 (3:df69) - ld a,[W_ISINBATTLE] + ld a,[wIsInBattle] and a jr nz,.inBattle call ItemUseNotTime @@ -1727,12 +1727,12 @@ ItemUseXStat: ; df69 (3:df69) ret ItemUsePokeflute: ; dfbd (3:5fbd) - ld a,[W_ISINBATTLE] + ld a,[wIsInBattle] and a jr nz,.inBattle ; if not in battle call ItemUseReloadOverworldData - ld a,[W_CURMAP] + ld a,[wCurMap] cp a,ROUTE_12 jr nz,.notRoute12 ld a, [wd7d8] @@ -1784,7 +1784,7 @@ ItemUsePokeflute: ; dfbd (3:5fbd) ld b,~SLP & $ff ld hl,wPartyMon1Status call WakeUpEntireParty - ld a,[W_ISINBATTLE] + ld a,[wIsInBattle] dec a ; is it a trainer battle? jr z,.skipWakingUpEnemyParty ; if it's a trainer battle @@ -1883,7 +1883,7 @@ PlayedFluteHadEffectText: ; e0c4 (3:60c4) TX_FAR _PlayedFluteHadEffectText db $06 TX_ASM - ld a,[W_ISINBATTLE] + ld a,[wIsInBattle] and a jr nz,.done ; play out-of-battle pokeflute music @@ -1900,7 +1900,7 @@ PlayedFluteHadEffectText: ; e0c4 (3:60c4) jp TextScriptEnd ; end text ItemUseCoinCase: ; e0e7 (3:60e7) - ld a,[W_ISINBATTLE] + ld a,[wIsInBattle] and a jp nz,ItemUseNotTime ld hl,CoinCaseNumCoinsText @@ -1974,9 +1974,9 @@ RodResponse: ; e15b (3:615b) ld a, 1 ld [W_MOVEMISSED], a ld a, b ; level - ld [W_CURENEMYLVL], a + ld [wCurEnemyLVL], a ld a, c ; species - ld [W_CUROPPONENT], a + ld [wCurOpponent], a DoNotGenerateFishingEncounter: ; e16e (3:616e) ld hl, wWalkBikeSurfState @@ -1993,7 +1993,7 @@ DoNotGenerateFishingEncounter: ; e16e (3:616e) ; checks if fishing is possible and if so, runs initialization code common to all rods ; unsets carry if fishing is possible, sets carry if not FishingInit: ; e182 (3:6182) - ld a,[W_ISINBATTLE] + ld a,[wIsInBattle] and a jr z,.notInBattle scf ; can't fish during battle @@ -2025,7 +2025,7 @@ ItemUseOaksParcel: ; e1b7 (3:61b7) jp ItemUseNotYoursToUse ItemUseItemfinder: ; e1ba (3:61ba) - ld a,[W_ISINBATTLE] + ld a,[wIsInBattle] and a jp nz,ItemUseNotTime call ItemUseReloadOverworldData @@ -2053,7 +2053,7 @@ ItemfinderFoundNothingText: ; e1eb (3:61eb) db "@" ItemUsePPUp: ; e1f0 (3:61f0) - ld a,[W_ISINBATTLE] + ld a,[wIsInBattle] and a jp nz,ItemUseNotTime @@ -2071,7 +2071,7 @@ ItemUsePPRestore: ; e1f7 (3:61f7) jr nc,.chooseMove jp .itemNotUsed .chooseMove - ld a, [W_ISINBATTLE] + ld a, [wIsInBattle] and a jr z, .usePPItem ld a, [wWhichPokemon] @@ -2274,7 +2274,7 @@ UnusableItem: ; e371 (3:6371) jp ItemUseNotTime ItemUseTMHM: ; e374 (3:6374) - ld a,[W_ISINBATTLE] + ld a,[wIsInBattle] and a jp nz,ItemUseNotTime ld a,[wcf91] @@ -2929,7 +2929,7 @@ SendNewMonToBox: ; e6e8 (3:66e8) ld [de], a inc de push de - ld a, [W_CURENEMYLVL] + ld a, [wCurEnemyLVL] ld d, a callab CalcExperience pop de diff --git a/engine/items/tms.asm b/engine/items/tms.asm index 23912b34..7d00f7f3 100755 --- a/engine/items/tms.asm +++ b/engine/items/tms.asm @@ -3,7 +3,7 @@ CanLearnTM: ; 1373e (4:773e) ld a, [wcf91] ld [wd0b5], a call GetMonHeader - ld hl, W_MONHLEARNSET + ld hl, wMonHLearnset push hl ld a, [wMoveNum] ld b, a diff --git a/engine/learn_move.asm b/engine/learn_move.asm index ba96f29f..ec087d0c 100755 --- a/engine/learn_move.asm +++ b/engine/learn_move.asm @@ -53,7 +53,7 @@ DontAbandonLearning: ; 6e5b (1:6e5b) pop de pop hl ld [hl], a - ld a, [W_ISINBATTLE] + ld a, [wIsInBattle] and a jp z, PrintLearnedMove ld a, [wWhichPokemon] diff --git a/engine/menu/bills_pc.asm b/engine/menu/bills_pc.asm index 3ef1f95a..986bb339 100644 --- a/engine/menu/bills_pc.asm +++ b/engine/menu/bills_pc.asm @@ -559,7 +559,7 @@ CableClubLeftGameboy:: ; 21867 (8:5867) ld a, [wSpriteStateData1 + 9] ; player's sprite facing direction cp SPRITE_FACING_RIGHT ret nz - ld a, [W_CURMAP] + ld a, [wCurMap] cp TRADE_CENTER ld a, LINK_STATE_START_TRADE jr z, .next @@ -576,7 +576,7 @@ CableClubRightGameboy:: ; 21887 (8:5887) ld a, [wSpriteStateData1 + 9] ; player's sprite facing direction cp SPRITE_FACING_LEFT ret nz - ld a, [W_CURMAP] + ld a, [wCurMap] cp TRADE_CENTER ld a, LINK_STATE_START_TRADE jr z, .next diff --git a/engine/menu/main_menu.asm b/engine/menu/main_menu.asm index 98f1efdd..2e88dbcb 100755 --- a/engine/menu/main_menu.asm +++ b/engine/menu/main_menu.asm @@ -114,7 +114,7 @@ MainMenu: ; 5af2 (1:5af2) ld a,[wNumHoFTeams] and a jp z,SpecialEnterMap - ld a,[W_CURMAP] ; map ID + ld a,[wCurMap] ; map ID cp a,HALL_OF_FAME jp nz,SpecialEnterMap xor a @@ -128,7 +128,7 @@ InitOptions: ; 5bff (1:5bff) ld a,1 ; no delay ld [wLetterPrintingDelayFlags],a ld a,3 ; medium speed - ld [W_OPTIONS],a + ld [wOptions],a ret LinkMenu: ; 5c0a (1:5c0a) @@ -626,13 +626,13 @@ SetOptionsFromCursorPositions: ; 601f (1:601f) res 6,d .storeOptions ld a,d - ld [W_OPTIONS],a + ld [wOptions],a ret ; reads the options variable and places menu cursors in the correct positions within the options menu SetCursorPositionsFromOptions: ; 604c (1:604c) ld hl,TextSpeedOptionData + 1 - ld a,[W_OPTIONS] + ld a,[wOptions] ld c,a and a,$3f push bc diff --git a/engine/menu/naming_screen.asm b/engine/menu/naming_screen.asm index 978216c8..167def51 100755 --- a/engine/menu/naming_screen.asm +++ b/engine/menu/naming_screen.asm @@ -2,7 +2,7 @@ AskName: ; 64eb (1:64eb) call SaveScreenTilesToBuffer1 call GetPredefRegisters push hl - ld a, [W_ISINBATTLE] + ld a, [wIsInBattle] dec a coord hl, 0, 0 ld b, 4 @@ -30,7 +30,7 @@ AskName: ; 64eb (1:64eb) ld a, NAME_MON_SCREEN ld [wNamingScreenType], a call DisplayNamingScreen - ld a, [W_ISINBATTLE] + ld a, [wIsInBattle] and a jr nz, .inBattle call ReloadMapSpriteTilePatterns @@ -169,7 +169,7 @@ DisplayNamingScreen: ; 6596 (1:6596) ld [W_SUBANIMTRANSFORM], a ld hl, wd730 res 6, [hl] - ld a, [W_ISINBATTLE] + ld a, [wIsInBattle] and a jp z, LoadTextBoxTilePatterns jpab LoadHudTilePatterns diff --git a/engine/menu/prize_menu.asm b/engine/menu/prize_menu.asm index 409f0bdb..626f670a 100755 --- a/engine/menu/prize_menu.asm +++ b/engine/menu/prize_menu.asm @@ -300,7 +300,7 @@ GetPrizeMonLevel: ; 52977 (14:6977) jr .loop .matchFound ld a,[hl] - ld [W_CURENEMYLVL],a + ld [wCurEnemyLVL],a ret INCLUDE "data/prize_mon_levels.asm" diff --git a/engine/menu/status_screen.asm b/engine/menu/status_screen.asm index 8775a8d9..807dce59 100755 --- a/engine/menu/status_screen.asm +++ b/engine/menu/status_screen.asm @@ -71,7 +71,7 @@ StatusScreen: ; 12953 (4:6953) ; mon is in a box or daycare ld a, [wLoadedMonBoxLevel] ld [wLoadedMonLevel], a - ld [W_CURENEMYLVL], a + ld [wCurEnemyLVL], a ld hl, wLoadedMonHPExp - 1 ld de, wLoadedMonStats ld b, $1 @@ -138,7 +138,7 @@ StatusScreen: ; 12953 (4:6953) call PlaceString ; "STATUS/" coord hl, 14, 2 call PrintLevel ; Pokémon level - ld a, [W_MONHINDEX] + ld a, [wMonHIndex] ld [wd11e], a ld [wd0b5], a predef IndexToPokedex @@ -196,13 +196,13 @@ OTPointers: ; 12a95 (4:6a95) dw wPartyMonOT dw wEnemyMonOT dw wBoxMonOT - dw W_DAYCAREMONOT + dw wDayCareMonOT NamePointers2: ; 12a9d (4:6a9d) dw wPartyMonNicks dw wEnemyMonNicks dw wBoxMonNicks - dw W_DAYCAREMONNAME + dw wDayCareMonName Type1Text: ; 12aa5 (4:6aa5) db "TYPE1/", $4e @@ -417,7 +417,7 @@ StatusScreen2: ; 12b57 (4:6b57) call StatusScreen_ClearName coord hl, 9, 1 call StatusScreen_ClearName - ld a, [W_MONHINDEX] + ld a, [wMonHIndex] ld [wd11e], a call GetMonName coord hl, 9, 1 diff --git a/engine/oak_speech.asm b/engine/oak_speech.asm index 0de7ffad..2e28afc6 100755 --- a/engine/oak_speech.asm +++ b/engine/oak_speech.asm @@ -1,7 +1,7 @@ SetDefaultNames: ; 60ca (1:60ca) ld a, [wLetterPrintingDelayFlags] push af - ld a, [W_OPTIONS] + ld a, [wOptions] push af ld a, [wd732] push af @@ -16,7 +16,7 @@ SetDefaultNames: ; 60ca (1:60ca) pop af ld [wd732], a pop af - ld [W_OPTIONS], a + ld [wOptions], a pop af ld [wLetterPrintingDelayFlags], a ld a, [wOptionsInitialized] diff --git a/engine/overworld/card_key.asm b/engine/overworld/card_key.asm index cc9fe3a7..2ef7529c 100755 --- a/engine/overworld/card_key.asm +++ b/engine/overworld/card_key.asm @@ -1,6 +1,6 @@ PrintCardKeyText: ; 52673 (14:6673) ld hl, SilphCoMapList - ld a, [W_CURMAP] + ld a, [wCurMap] ld b, a .silphCoMapListLoop ld a, [hli] @@ -15,7 +15,7 @@ PrintCardKeyText: ; 52673 (14:6673) cp $24 jr z, .cardKeyDoorInFrontOfPlayer ld b, a - ld a, [W_CURMAP] + ld a, [wCurMap] cp SILPH_CO_11F ret nz ld a, b @@ -39,7 +39,7 @@ PrintCardKeyText: ; 52673 (14:6673) ld a, e ld c, a ld [wCardKeyDoorX], a - ld a, [W_CURMAP] + ld a, [wCurMap] cp SILPH_CO_11F jr nz, .notSilphCo11F ld a, $3 @@ -84,9 +84,9 @@ CardKeyFailText: ; 526f8 (14:66f8) ; d = Y ; e = X GetCoordsInFrontOfPlayer: ; 526fd (14:66fd) - ld a, [W_YCOORD] + ld a, [wYCoord] ld d, a - ld a, [W_XCOORD] + ld a, [wXCoord] ld e, a ld a, [wSpriteStateData1 + 9] ; player's sprite facing direction and a diff --git a/engine/overworld/cut.asm b/engine/overworld/cut.asm index 8c863bf2..3a2b38cf 100755 --- a/engine/overworld/cut.asm +++ b/engine/overworld/cut.asm @@ -178,7 +178,7 @@ ReplaceTreeTileBlock: ; ef1f (3:6f1f) ; player (i.e. where the tree is) and replace it with the corresponding tile ; block that doesn't have the tree. push de - ld a, [W_CURMAPWIDTH] + ld a, [wCurMapWidth] add 6 ld c, a ld b, 0 @@ -196,22 +196,22 @@ ReplaceTreeTileBlock: ; ef1f (3:6f1f) cp SPRITE_FACING_LEFT jr z, .left ; right - ld a, [W_XBLOCKCOORD] + ld a, [wXBlockCoord] and a jr z, .centerTileBlock jr .rightOfCenter .down - ld a, [W_YBLOCKCOORD] + ld a, [wYBlockCoord] and a jr z, .centerTileBlock jr .belowCenter .up - ld a, [W_YBLOCKCOORD] + ld a, [wYBlockCoord] and a jr z, .aboveCenter jr .centerTileBlock .left - ld a, [W_XBLOCKCOORD] + ld a, [wXBlockCoord] and a jr z, .leftOfCenter jr .centerTileBlock diff --git a/engine/overworld/hidden_items.asm b/engine/overworld/hidden_items.asm index 28528116..f7f81070 100755 --- a/engine/overworld/hidden_items.asm +++ b/engine/overworld/hidden_items.asm @@ -135,7 +135,7 @@ FindHiddenItemOrCoinsIndex: ; 76857 (1d:6857) ld d, a ld a, [wHiddenObjectX] ld e, a - ld a, [W_CURMAP] + ld a, [wCurMap] ld b, a ld c, -1 .loop diff --git a/engine/overworld/hidden_objects.asm b/engine/overworld/hidden_objects.asm index cabfc093..1fc20e5c 100755 --- a/engine/overworld/hidden_objects.asm +++ b/engine/overworld/hidden_objects.asm @@ -29,7 +29,7 @@ CheckForHiddenObject: ; 469a0 (11:69a0) ld b, a cp $ff jr z, .noMatch - ld a, [W_CURMAP] + ld a, [wCurMap] cp b jr z, .foundMatchingMap inc de @@ -95,30 +95,30 @@ CheckIfCoordsInFrontOfPlayerMatch: ; 46a01 (11:6a01) cp SPRITE_FACING_RIGHT jr z, .facingRight ; facing down - ld a, [W_YCOORD] + ld a, [wYCoord] inc a jr .upDownCommon .facingUp - ld a, [W_YCOORD] + ld a, [wYCoord] dec a .upDownCommon cp b jr nz, .didNotMatch - ld a, [W_XCOORD] + ld a, [wXCoord] cp c jr nz, .didNotMatch jr .matched .facingLeft - ld a, [W_XCOORD] + ld a, [wXCoord] dec a jr .leftRightCommon .facingRight - ld a, [W_XCOORD] + ld a, [wXCoord] inc a .leftRightCommon cp c jr nz, .didNotMatch - ld a, [W_YCOORD] + ld a, [wYCoord] cp b jr nz, .didNotMatch .matched diff --git a/engine/overworld/is_player_just_outside_map.asm b/engine/overworld/is_player_just_outside_map.asm index 24e434b3..e9ba204a 100644 --- a/engine/overworld/is_player_just_outside_map.asm +++ b/engine/overworld/is_player_just_outside_map.asm @@ -1,13 +1,13 @@ ; returns whether the player is one tile outside the map in Z IsPlayerJustOutsideMap: ; 128d8 (4:68d8) - ld a, [W_YCOORD] + ld a, [wYCoord] ld b, a - ld a, [W_CURMAPHEIGHT] + ld a, [wCurMapHeight] call .compareCoordWithMapDimension ret z - ld a, [W_XCOORD] + ld a, [wXCoord] ld b, a - ld a, [W_CURMAPWIDTH] + ld a, [wCurMapWidth] .compareCoordWithMapDimension add a cp b diff --git a/engine/overworld/item.asm b/engine/overworld/item.asm index 6fbe823d..f4f46535 100644 --- a/engine/overworld/item.asm +++ b/engine/overworld/item.asm @@ -1,9 +1,9 @@ -PickUpItem: +PickUpItem: ; 4d55 (1:4d55) call EnableAutoTextBoxDrawing ld a, [hSpriteIndexOrTextID] ld b, a - ld hl, W_MISSABLEOBJECTLIST + ld hl, wMissableObjectList .missableObjectsListLoop ld a, [hli] cp $ff @@ -17,7 +17,7 @@ PickUpItem: ld a, [hl] ld [$ffdb], a - ld hl, W_MAPSPRITEEXTRADATA + ld hl, wMapSpriteExtraData ld a, [hSpriteIndexOrTextID] dec a add a @@ -44,11 +44,11 @@ PickUpItem: call PrintText ret -FoundItemText: +FoundItemText: ; 4d9a (1:4d9a) TX_FAR _FoundItemText db $0B db "@" -NoMoreRoomForItemText: +NoMoreRoomForItemText: ; 4da0 (1:4da0) TX_FAR _NoMoreRoomForItemText - db "@" + db "@"
\ No newline at end of file diff --git a/engine/overworld/map_sprites.asm b/engine/overworld/map_sprites.asm index 84d67b36..eb4e2c03 100755 --- a/engine/overworld/map_sprites.asm +++ b/engine/overworld/map_sprites.asm @@ -30,12 +30,12 @@ _InitMapSprites: ; 1785b (5:785b) ; InitOutsideMapSprites. ; Loads tile pattern data for sprites into VRAM. LoadMapSpriteTilePatterns: ; 17871 (5:7871) - ld a,[W_NUMSPRITES] + ld a,[wNumSprites] and a ; are there any sprites? jr nz,.spritesExist ret .spritesExist - ld c,a ; c = [W_NUMSPRITES] + ld c,a ; c = [wNumSprites] ld b,$10 ; number of sprite slots ld hl,wSpriteStateData2 + $0d xor a @@ -251,7 +251,7 @@ ReadSpriteSheetData: ; 17971 (5:7971) ; Loads sprite set for outside maps (cities and routes) and sets VRAM slots. ; sets carry if the map is a city or route, unsets carry if not InitOutsideMapSprites: ; 1797b (5:797b) - ld a,[W_CURMAP] + ld a,[wCurMap] cp a,REDS_HOUSE_1F ; is the map a city or a route (map ID less than $25)? ret nc ; if not, return ld hl,MapSpriteSets @@ -317,13 +317,13 @@ InitOutsideMapSprites: ; 1797b (5:797b) ld [hl],a ; $C2XD (sprite picture ID) dec b jr nz,.zeroRemainingSlotsLoop - ld a,[W_NUMSPRITES] + ld a,[wNumSprites] push af ; save number of sprites ld a,11 ; 11 sprites in sprite set - ld [W_NUMSPRITES],a + ld [wNumSprites],a call LoadMapSpriteTilePatterns pop af - ld [W_NUMSPRITES],a ; restore number of sprites + ld [wNumSprites],a ; restore number of sprites ld hl,wSpriteStateData2 + $1e ld b,$0f ; The VRAM tile pattern slots that LoadMapSpriteTilePatterns set are in the @@ -399,10 +399,10 @@ GetSplitMapSpriteSetID: ; 17a1a (5:7a1a) ld b,a jr z,.eastWestDivide .northSouthDivide - ld a,[W_YCOORD] + ld a,[wYCoord] jr .compareCoord .eastWestDivide - ld a,[W_XCOORD] + ld a,[wXCoord] .compareCoord cp b jr c,.loadSpriteSetID @@ -415,7 +415,7 @@ GetSplitMapSpriteSetID: ; 17a1a (5:7a1a) ; Route 20 is a special case because the two map sections have a more complex ; shape instead of the map simply being split horizontally or vertically. .route20 - ld hl,W_XCOORD + ld hl,wXCoord ld a,[hl] cp a,$2b ld a,$01 @@ -430,7 +430,7 @@ GetSplitMapSpriteSetID: ; 17a1a (5:7a1a) jr nc,.next ld b,$0d .next - ld a,[W_YCOORD] + ld a,[wYCoord] cp b ld a,$0a ret c diff --git a/engine/overworld/movement.asm b/engine/overworld/movement.asm index be10fd69..dfd1c012 100644 --- a/engine/overworld/movement.asm +++ b/engine/overworld/movement.asm @@ -1,4 +1,4 @@ -UpdatePlayerSprite: ; 4e31 (1:4e31) +UpdatePlayerSprite: ; 4da5 (1:4da5) ld a, [wSpriteStateData2] and a jr z, .checkIfTextBoxInFrontOfSprite @@ -20,7 +20,13 @@ UpdatePlayerSprite: ; 4e31 (1:4e31) ld [wSpriteStateData1 + 2], a ret .lowerLeftTileIsMapTile + ld a, [wUpdateSpritesEnabled] + push af + ld a, $ff + ld [wUpdateSpritesEnabled], a call DetectCollisionBetweenSprites + pop af + ld [wUpdateSpritesEnabled], a ld h, wSpriteStateData1 / $100 ld a, [wWalkCounter] and a @@ -46,42 +52,24 @@ UpdatePlayerSprite: ; 4e31 (1:4e31) jr z, .notMoving ld a, SPRITE_FACING_RIGHT jr .next +.next + ld [wSpriteStateData1 + 9], a ; facing direction + ld a, [wFontLoaded] + bit 0, a + jr z, .moving .notMoving ; zero the animation counters xor a ld [wSpriteStateData1 + 7], a ld [wSpriteStateData1 + 8], a - jr .calcImageIndex -.next - ld [wSpriteStateData1 + 9], a ; facing direction - ld a, [wFontLoaded] - bit 0, a - jr nz, .notMoving + call Func_4e32 + jr .skipSpriteAnim .moving ld a, [wd736] bit 7, a ; is the player sprite spinning due to a spin tile? jr nz, .skipSpriteAnim - ld a, [H_CURRENTSPRITEOFFSET] - add $7 - ld l, a - ld a, [hl] - inc a - ld [hl], a - cp 4 - jr nz, .calcImageIndex - xor a - ld [hl], a - inc hl - ld a, [hl] - inc a - and $3 - ld [hl], a -.calcImageIndex - ld a, [wSpriteStateData1 + 8] - ld b, a - ld a, [wSpriteStateData1 + 9] - add b - ld [wSpriteStateData1 + 2], a + call Func_5274 + call Func_4e32 .skipSpriteAnim ; If the player is standing on a grass tile, make the player's sprite have ; lower priority than the background so that it's partially obscured by the @@ -89,7 +77,7 @@ UpdatePlayerSprite: ; 4e31 (1:4e31) ; bit set by later logic. ld a, [hTilePlayerStandingOn] ld c, a - ld a, [W_GRASSTILE] + ld a, [wGrassTile] cp c ld a, $0 jr nz, .next2 @@ -98,28 +86,25 @@ UpdatePlayerSprite: ; 4e31 (1:4e31) ld [wSpriteStateData2 + $07], a ret -UnusedReadSpriteDataFunction: ; 4ec7 (1:4ec7) - push bc - push af - ld a, [H_CURRENTSPRITEOFFSET] - ld c, a - pop af - add c - ld l, a - pop bc +Func_4e32: ; 4e32 (1:4e32) + ld a, [wSpriteStateData1 + 8] + ld b, a + ld a, [wSpriteStateData1 + 9] + add b + ld [wSpriteStateData1 + 2], a ret - -UpdateNPCSprite: ; 4ed1 (1:4ed1) + +UpdateNPCSprite: ; 4e3e (1:4e3e) ld a, [H_CURRENTSPRITEOFFSET] swap a dec a add a - ld hl, W_MAPSPRITEDATA + ld hl, wMapSpriteData add l ld l, a ld a, [hl] ; read movement byte 2 ld [wCurSpriteMovement2], a - ld h, $c1 + ld h, wSpriteStateData1 / $100 ld a, [H_CURRENTSPRITEOFFSET] ld l, a inc l @@ -128,7 +113,7 @@ UpdateNPCSprite: ; 4ed1 (1:4ed1) jp z, InitializeSpriteStatus call CheckSpriteAvailability ret c ; if sprite is invisible, on tile >=$60, in grass or player is currently walking - ld h, $c1 + ld h, wSpriteStateData1 / $100 ld a, [H_CURRENTSPRITEOFFSET] ld l, a inc l @@ -144,19 +129,21 @@ UpdateNPCSprite: ; 4ed1 (1:4ed1) jp z, UpdateSpriteMovementDelay ; c1x1 == 2 cp $3 jp z, UpdateSpriteInWalkingAnimation ; c1x1 == 3 + cp $4 + jp z, Func_5357 ld a, [wWalkCounter] and a ret nz ; don't do anything yet if player is currently moving (redundant, already tested in CheckSpriteAvailability) call InitializeSpriteScreenPosition - ld h, $c2 + ld h, wSpriteStateData2 / $100 ld a, [H_CURRENTSPRITEOFFSET] add $6 ld l, a ld a, [hl] ; c2x6: movement byte 1 inc a - jr z, .randomMovement ; value $FF + jp z, .randomMovement ; value $FF inc a - jr z, .randomMovement ; value $FE + jp z, .randomMovement ; value $FE ; scripted movement dec a ld [hl], a ; increment movement byte 1 (movement data index) @@ -181,12 +168,18 @@ UpdateNPCSprite: ; 4ed1 (1:4ed1) ret .next cp $fe - jr nz, .determineDirection + jr nz, .asm_4ecb ; current NPC movement data is $fe. this seems buggy ld [hl], $1 ; set movement byte 1 to $1 ld de, wNPCMovementDirections call LoadDEPlusA ; a = [wNPCMovementDirections + $fe] (?) - jr .determineDirection +.asm_4ecb + push af + call Func_5288 + pop bc + ld a, b + jr nc, .determineDirection + ret .randomMovement call GetTileSpriteStandsOn call Random @@ -249,7 +242,7 @@ UpdateNPCSprite: ; 4ed1 (1:4ed1) jr TryWalking ; changes facing direction by zeroing the movement delta and calling TryWalking -ChangeFacingDirection: ; 4fc8 (1:4fc8) +ChangeFacingDirection: ; 4f43 (1:4f43) ld de, $0 ; fall through @@ -259,61 +252,27 @@ ChangeFacingDirection: ; 4fc8 (1:4fc8) ; e: X movement delta (-1, 0 or 1) ; hl: pointer to tile the sprite would walk onto ; set carry on failure, clears carry on success -TryWalking: ; 4fcb (1:4fcb) +TryWalking: ; 4f46 (1:4f46) push hl - ld h, $c1 - ld a, [H_CURRENTSPRITEOFFSET] - add $9 - ld l, a - ld [hl], c ; c1x9 (update facing direction) - ld a, [H_CURRENTSPRITEOFFSET] - add $3 - ld l, a - ld [hl], d ; c1x3 (update Y movement delta) - inc l - inc l - ld [hl], e ; c1x5 (update X movement delta) + call Func_5337 pop hl push de - ld c, [hl] ; read tile to walk onto + ld c, [hl] call CanWalkOntoTile pop de - ret c ; cannot walk there (reinitialization of delay values already done) - ld h, $c2 + ret c + call Func_5349 ld a, [H_CURRENTSPRITEOFFSET] - add $4 ld l, a - ld a, [hl] ; c2x4: Y position - add d - ld [hli], a ; update Y position - ld a, [hl] ; c2x5: X position - add e - ld [hl], a ; update X position - ld a, [H_CURRENTSPRITEOFFSET] - ld l, a - ld [hl], $10 ; c2x0=16: walk animation counter + ld [hl], $10 ; c1x9 (update facing direction) dec h inc l - ld [hl], $3 ; c1x1: set movement status to walking + ld [hl], $3 jp UpdateSpriteImage ; update the walking animation parameters for a sprite that is currently walking -UpdateSpriteInWalkingAnimation: ; 4ffe (1:4ffe) - ld a, [H_CURRENTSPRITEOFFSET] - add $7 - ld l, a - ld a, [hl] ; c1x7 (counter until next walk animation frame) - inc a - ld [hl], a ; c1x7 += 1 - cp $4 - jr nz, .noNextAnimationFrame - xor a - ld [hl], a ; c1x7 = 0 - inc l - ld a, [hl] ; c1x8 (walk animation frame) - inc a - and $3 - ld [hl], a ; advance to next animation frame every 4 ticks (16 ticks total for one step) +UpdateSpriteInWalkingAnimation: ; 4f61 (1:4f61) + call Func_5274 .noNextAnimationFrame ld a, [H_CURRENTSPRITEOFFSET] add $3 @@ -371,7 +330,7 @@ UpdateSpriteInWalkingAnimation: ; 4ffe (1:4ffe) ret ; update delay value (c2x8) for sprites in the delayed state (c1x1) -UpdateSpriteMovementDelay: ; 5057 (1:5057) +UpdateSpriteMovementDelay: ; 4fa9 (1:4fa9) ld h, $c2 ld a, [H_CURRENTSPRITEOFFSET] add $6 @@ -392,15 +351,15 @@ UpdateSpriteMovementDelay: ; 5057 (1:5057) inc a ld l, a ld [hl], $1 ; c1x1 = 1 (mark as ready to move) -notYetMoving: ; 5073 (1:5073) - ld h, $c1 +notYetMoving: ; 4fc5 (1:4fc5) + ld h, wSpriteStateData1 / $100 ld a, [H_CURRENTSPRITEOFFSET] add $8 ld l, a ld [hl], $0 ; c1x8 = 0 (walk animation frame) jp UpdateSpriteImage -InitializeSpriteFacingDirection: ; 507f (1:507f) +InitializeSpriteFacingDirection: ; 4fd1 (1:4fd1) ld a, [wd72d] bit 5, a jr nz, notYetMoving @@ -429,7 +388,7 @@ InitializeSpriteFacingDirection: ; 507f (1:507f) ld [hl], c ; c1x9: set facing direction jr notYetMoving -InitializeSpriteStatus: ; 50ad (1:50ad) +InitializeSpriteStatus: ; 4fff (1:4fff) ld [hl], $1 ; $c1x1: set movement status to ready inc l ld [hl], $ff ; $c1x2: set sprite image to $ff (invisible/off screen) @@ -440,39 +399,52 @@ InitializeSpriteStatus: ; 50ad (1:50ad) ld a, $8 ld [hli], a ; $c2x2: set Y displacement to 8 ld [hl], a ; $c2x3: set X displacement to 8 + call InitializeSpriteScreenPosition ; could have done fallthrough here ret ; calculates the spprite's scrren position form its map position and the player position -InitializeSpriteScreenPosition: ; 50bd (1:50bd) - ld h, $c2 +InitializeSpriteScreenPosition: ; 5012 (1:5012) + ld h, wSpriteStateData2 / $100 ld a, [H_CURRENTSPRITEOFFSET] add $4 ld l, a - ld a, [W_YCOORD] + ld a, [wYCoord] ld b, a ld a, [hl] ; c2x4 (Y position + 4) sub b ; relative to player position - swap a ; * 16 + call Func_5033 sub $4 ; - 4 dec h ld [hli], a ; c1x4 (screen Y position) inc h - ld a, [W_XCOORD] + ld a, [wXCoord] ld b, a ld a, [hli] ; c2x6 (X position + 4) sub b ; relative to player position - swap a ; * 16 + call Func_5033 dec h ld [hl], a ; c1x6 (screen X position) ret +Func_5033: ; 5033 (1:5033) + jr nc, .asm_503c + cpl + inc a + swap a + cpl + inc a + ret +.asm_503c + swap a + ret + ; tests if sprite is off screen or otherwise unable to do anything -CheckSpriteAvailability: ; 50dc (1:50dc) +CheckSpriteAvailability: ; 503f (1:503f) predef IsObjectHidden ld a, [$ffe5] and a jp nz, .spriteInvisible - ld h, $c2 + ld h, wSpriteStateData2 / $100 ld a, [H_CURRENTSPRITEOFFSET] add $6 ld l, a @@ -483,7 +455,7 @@ CheckSpriteAvailability: ; 50dc (1:50dc) add $4 ld l, a ld b, [hl] ; c2x4: Y pos (+4) - ld a, [W_YCOORD] + ld a, [wYCoord] cp b jr z, .skipYVisibilityTest jr nc, .spriteInvisible ; above screen region @@ -493,7 +465,7 @@ CheckSpriteAvailability: ; 50dc (1:50dc) .skipYVisibilityTest inc l ld b, [hl] ; c2x5: X pos (+4) - ld a, [W_XCOORD] + ld a, [wXCoord] cp b jr z, .skipXVisibilityTest jr nc, .spriteInvisible ; left of screen region @@ -520,7 +492,7 @@ CheckSpriteAvailability: ; 50dc (1:50dc) cp d jr c, .spriteVisible ; standing on tile with ID >=$60 (top right tile) .spriteInvisible - ld h, $c1 + ld h, wSpriteStateData1 / $100 ld a, [H_CURRENTSPRITEOFFSET] add $2 ld l, a @@ -537,7 +509,7 @@ CheckSpriteAvailability: ; 50dc (1:50dc) ld a, [H_CURRENTSPRITEOFFSET] add $7 ld l, a - ld a, [W_GRASSTILE] + ld a, [wGrassTile] cp c ld a, $0 jr nz, .notInGrass @@ -548,7 +520,7 @@ CheckSpriteAvailability: ; 50dc (1:50dc) .done ret -UpdateSpriteImage: ; 5157 (1:5157) +UpdateSpriteImage: ; 50ba (1:50ba) ld h, $c1 ld a, [H_CURRENTSPRITEOFFSET] add $8 @@ -573,8 +545,8 @@ UpdateSpriteImage: ; 5157 (1:5157) ; d: Y movement delta (-1, 0 or 1) ; e: X movement delta (-1, 0 or 1) ; set carry on failure, clears carry on success -CanWalkOntoTile: ; 516e (1:516e) - ld h, $c2 +CanWalkOntoTile: ; 50d1 (1:50d1) + ld h, wSpriteStateData2 / $100 ld a, [H_CURRENTSPRITEOFFSET] add $6 ld l, a @@ -585,24 +557,16 @@ CanWalkOntoTile: ; 516e (1:516e) and a ret .notScripted - ld a, [W_TILESETCOLLISIONPTR] - ld l, a - ld a, [W_TILESETCOLLISIONPTR+1] - ld h, a -.tilePassableLoop - ld a, [hli] - cp $ff - jr z, .impassable - cp c - jr nz, .tilePassableLoop - ld h, $c2 + call _IsTilePassable + jr c, .impassable + ld h, wSpriteStateData2 / $100 ld a, [H_CURRENTSPRITEOFFSET] add $6 ld l, a ld a, [hl] ; $c2x6 (movement byte 1) inc a jr z, .impassable ; if $ff, no movement allowed (however, changing direction is) - ld h, $c1 + ld h, wSpriteStateData1 / $100 ld a, [H_CURRENTSPRITEOFFSET] add $4 ld l, a @@ -618,17 +582,23 @@ CanWalkOntoTile: ; 516e (1:516e) jr nc, .impassable ; don't walk off screen push de push bc + ld a, [wUpdateSpritesEnabled] + push af + ld a, $ff + ld [wUpdateSpritesEnabled], a call DetectCollisionBetweenSprites + pop af + ld [wUpdateSpritesEnabled], a pop bc pop de - ld h, $c1 + ld h, wSpriteStateData1 / $100 ld a, [H_CURRENTSPRITEOFFSET] add $c ld l, a ld a, [hl] ; c1xc (directions in which sprite collision would occur) and b ; check against chosen direction (1,2,4 or 8) jr nz, .impassable ; collision between sprites, don't go there - ld h, $c2 + ld h, wSpriteStateData2 / $100 ld a, [H_CURRENTSPRITEOFFSET] add $2 ld l, a @@ -637,7 +607,7 @@ CanWalkOntoTile: ; 516e (1:516e) jr nz, .upwards add d cp $5 - jr c, .impassable ; if c2x2+d < 5, don't go ;bug: this tests probably were supposed to prevent sprites + ;jr c, .impassable (bugfix) ; if c2x2+d < 5, don't go ;bug: this tests probably were supposed to prevent sprites jr .checkHorizontal ; from walking out too far, but this line makes sprites get stuck .upwards ; whenever they walked upwards 5 steps sub $1 ; on the other hand, the amount a sprite can walk out to the @@ -659,7 +629,7 @@ CanWalkOntoTile: ; 516e (1:516e) and a ; clear carry (marking success) ret .impassable - ld h, $c1 + ld h, wSpriteStateData1 / $100 ld a, [H_CURRENTSPRITEOFFSET] inc a ld l, a @@ -684,14 +654,14 @@ CanWalkOntoTile: ; 516e (1:516e) ; calculates the tile pointer pointing to the tile the current sprite stancs on ; this is always the lower left tile of the 2x2 tile blocks all sprites are snapped to ; hl: output pointer -GetTileSpriteStandsOn: ; 5207 (1:5207) - ld h, $c1 +GetTileSpriteStandsOn: ; 516a (1:516a) + ld h, wSpriteStateData1 / $100 ld a, [H_CURRENTSPRITEOFFSET] add $4 ld l, a ld a, [hli] ; c1x4: screen Y position add $4 ; align to 2*2 tile blocks (Y position is always off 4 pixels to the top) - and $f0 ; in case object is currently moving + and $f8 ; in case object is currently moving (XXX why changed to $f8?) srl a ; screen Y tile * 4 ld c, a ld b, $0 @@ -713,7 +683,7 @@ GetTileSpriteStandsOn: ; 5207 (1:5207) ret ; loads [de+a] into a -LoadDEPlusA: ; 522f (1:522f) +LoadDEPlusA: ; 5192 (1:5192) add e ld e, a jr nc, .noCarry @@ -722,7 +692,7 @@ LoadDEPlusA: ; 522f (1:522f) ld a, [de] ret -DoScriptedNPCMovement: ; 5236 (1:5236) +DoScriptedNPCMovement: ; 5199 (1:5199) ; This is an alternative method of scripting an NPC's movement and is only used ; a few times in the game. It is used when the NPC and player must walk together ; in sync, such as when the player is following the NPC somewhere. An NPC can't @@ -793,23 +763,23 @@ DoScriptedNPCMovement: ; 5236 (1:5236) inc [hl] ret -InitScriptedNPCMovement: ; 52a6 (1:52a6) +InitScriptedNPCMovement: ; 5209 (1:5209) xor a ld [wNPCMovementDirections2Index], a ld a, 8 ld [wScriptedNPCWalkCounter], a jp AnimScriptedNPCMovement -GetSpriteScreenYPointer: ; 52b2 (1:52b2) +GetSpriteScreenYPointer: ; 5215 (1:5215) ld a, $4 ld b, a jr GetSpriteScreenXYPointerCommon -GetSpriteScreenXPointer: ; 52b7 (1:52b7) +GetSpriteScreenXPointer: ; 521a (1:521a) ld a, $6 ld b, a -GetSpriteScreenXYPointerCommon: ; 52ba (1:52ba) +GetSpriteScreenXYPointerCommon: ; 521d (1:521d) ld hl, wSpriteStateData1 ld a, [H_CURRENTSPRITEOFFSET] add l @@ -817,7 +787,7 @@ GetSpriteScreenXYPointerCommon: ; 52ba (1:52ba) ld l, a ret -AnimScriptedNPCMovement: ; 52c3 (1:52c3) +AnimScriptedNPCMovement: ; 5226 (1:5226) ld hl, wSpriteStateData2 ld a, [H_CURRENTSPRITEOFFSET] add $e @@ -856,21 +826,236 @@ AnimScriptedNPCMovement: ; 52c3 (1:52c3) ld [hl], a ret -AdvanceScriptedNPCAnimFrameCounter: ; 5301 (1:5301) +AdvanceScriptedNPCAnimFrameCounter: ; 5264 (1:5264) + call Func_5274 + ld h, wSpriteStateData1 / $100 ld a, [H_CURRENTSPRITEOFFSET] - add $7 + add $8 ld l, a ld a, [hl] ; intra-animation frame counter + and $3 + ld [hSpriteAnimFrameCounter], a + ret + +Func_5274: ; 5274 (1:5274) + ld a, [H_CURRENTSPRITEOFFSET] + add $7 + ld l, a + ld h, wSpriteStateData1 / $100 + ld a, [hl] ; c1x7 (counter until next walk animation frame) inc a - ld [hl], a - cp 4 - ret nz - xor a - ld [hl], a ; reset intra-animation frame counter + and $3 + ld [hl], a ; c1x7 += 1 + ret nz ; c1x7 = 0 inc l - ld a, [hl] ; animation frame counter + ld a, [hl] ; c1x8 (walk animation frame) inc a and $3 + ld [hl], a ; advance to next animation frame every 4 ticks (16 ticks total for one step) + ret + +Func_5288: ; 5288 (1:5288) +; nice lookup table +; a is supposedly [wNPCMovementDirections + $fe] + cp $5 + jr z, .asm_52af + cp $4 + jr z, .asm_52aa + cp $6 + jr z, .asm_52b4 + cp $7 + jr z, .asm_52b9 + cp $11 + jr z, .asm_52c3 + cp $12 + jr z, .asm_52be + cp $13 + jr z, .asm_52c8 + cp $14 + jr z, .asm_52cd + xor a + ret +; set 1? +.asm_52aa + call Func_531f + jr .asm_52e6 +.asm_52af + call Func_5325 + jr .asm_52e6 +.asm_52b4 + call Func_5331 + jr .asm_52e6 +.asm_52b9 + call Func_532b + jr .asm_52e6 +; set 2? +.asm_52be + call Func_531f + jr .asm_52fa +.asm_52c3 + call Func_5325 + jr .asm_52fa +.asm_52c8 + call Func_5331 + jr .asm_52fa +.asm_52cd + call Func_532b + jr .asm_52fa +; set 3? (unused) +.asm_52d2 + call Func_531f + jr .asm_530b +.asm_52d7 + call Func_5325 + jr .asm_530b +.asm_52dc + call Func_5331 + jr .asm_530b +.asm_52e1 + call Func_532b + jr .asm_530b + +.asm_52e6 + call Func_5337 + call Func_5349 + ld a, [H_CURRENTSPRITEOFFSET] + ld l, a + ld [hl], $8 + dec h + inc l + ld [hl], $4 + call UpdateSpriteImage + scf + ret + +.asm_52fa + call Func_5337 + ld a, [H_CURRENTSPRITEOFFSET] + ld l, a + ld [hl], $8 + dec h + inc l + ld [hl], $3 + call UpdateSpriteImage + scf + ret + +.asm_530b + call Func_5337 + call Func_5349 + ld a, [H_CURRENTSPRITEOFFSET] + ld l, a + ld [hl], $8 + dec h + inc l + ld [hl], $3 + call UpdateSpriteImage + scf + ret + +Func_531f: ; 531f (1:531f) + lb de, 1, 0 + ld c, SPRITE_FACING_DOWN + ret + +Func_5325: ; 5325 (1:5325) + lb de, -1, 0 + ld c, SPRITE_FACING_UP + ret + +Func_532b: ; 532b (1:532b) + lb de, 0, 1 + ld c, SPRITE_FACING_RIGHT + ret + +Func_5331: ; 5331 (1:5331) + lb de, 0, -1 + ld c, SPRITE_FACING_LEFT + ret + +Func_5337: ; 5337 (1:5337) + ld a, [H_CURRENTSPRITEOFFSET] + add $9 + ld l, a + ld h, wSpriteStateData1 / $100 + ld [hl], c ; c1x9 (update facing direction) + ld a, [H_CURRENTSPRITEOFFSET] + add $3 + ld l, a + ld [hl], d ; c1x3 (update Y movement delta) + inc l + inc l + ld [hl], e ; c1x5 (update X movement delta) + ret + +Func_5349: ; 5349 (1:5349) + ld h, wSpriteStateData2 / $100 + ld a, [H_CURRENTSPRITEOFFSET] + add $4 + ld l, a + ld a, [hl] ; c2x4: Y position + add d + ld [hli], a ; update Y position + ld a, [hl] ; c2x5: X position + add e + ld [hl], a ; update X position + ret + +Func_5357: ; 5357 (1:5357) + call Func_5274 + ld a, [H_CURRENTSPRITEOFFSET] + add $3 + ld l, a + ld h, wSpriteStateData1 / $100 + ld a, [hli] + add a + ld b, a + ld a, [hl] + add b + ld [hli], a + ld a, [hli] + add a + ld b, a + ld a, [hl] + add b ld [hl], a - ld [hSpriteAnimFrameCounter], a + ld a, [H_CURRENTSPRITEOFFSET] + ld l, a + ld h, wSpriteStateData2 / $100 + dec [hl] + ret nz + ld a, $6 + add l + ld l, a + ld a, [hl] + cp $fe + jr nc, .asm_5386 + ld a, [H_CURRENTSPRITEOFFSET] + inc a + ld l, a + ld h, wSpriteStateData1 / $100 + ld [hl], $1 ret +.asm_5386 + call Random + ld a, [H_CURRENTSPRITEOFFSET] + add $8 + ld l, a + ld h, wSpriteStateData2 / $100 + ld a, [hRandomAdd] + and $7f + ld [hl], a + dec h + ld a, [H_CURRENTSPRITEOFFSET] + inc a + ld l, a + ld [hl], $2 + inc l + inc l + xor a + ld b, [hl] + ld [hli], a + inc l + ld c, [hl] + ld [hl], a + ret
\ No newline at end of file diff --git a/engine/overworld/npc_movement.asm b/engine/overworld/npc_movement.asm index 098be875..a609fb60 100755 --- a/engine/overworld/npc_movement.asm +++ b/engine/overworld/npc_movement.asm @@ -52,7 +52,7 @@ PalletMovementScriptPointerTable: ; 1a442 (6:6442) dw PalletMovementScript_Done PalletMovementScript_OakMoveLeft: ; 1a44c (6:644c) - ld a, [W_XCOORD] + ld a, [wXCoord] sub $a ld [wNumStepsToTake], a jr z, .playerOnLeftTile @@ -267,7 +267,7 @@ RLEList_PewterGymGuy: ; 1a5da (6:65da) db $FF FreezeEnemyTrainerSprite: ; 1a5e7 (6:65e7) - ld a, [W_CURMAP] + ld a, [wCurMap] cp POKEMONTOWER_7 ret z ; the Rockets on Pokemon Tower 7F leave after battling, so don't freeze them ld hl, RivalIDs diff --git a/engine/overworld/oam.asm b/engine/overworld/oam.asm index e81375a3..f51c839f 100644 --- a/engine/overworld/oam.asm +++ b/engine/overworld/oam.asm @@ -213,7 +213,7 @@ Func_4a7b: ; 4a7b (1:4a7b) INCLUDE "engine/oam_dma.asm" _IsTilePassable:: ; 4aaa (1:4aaa) - ld hl,W_TILESETCOLLISIONPTR ; pointer to list of passable tiles + ld hl,wTilesetCollisionPtr ; pointer to list of passable tiles ld a,[hli] ld h,[hl] ld l,a ; hl now points to passable tiles diff --git a/engine/overworld/pewter_guys.asm b/engine/overworld/pewter_guys.asm index 4ac60e00..543dac91 100755 --- a/engine/overworld/pewter_guys.asm +++ b/engine/overworld/pewter_guys.asm @@ -17,9 +17,9 @@ PewterGuys: ; 37ca1 (d:7ca1) ld a, [hli] ld h, [hl] ld l, a - ld a, [W_YCOORD] + ld a, [wYCoord] ld b, a - ld a, [W_XCOORD] + ld a, [wXCoord] ld c, a .findMatchingCoordsLoop ld a, [hli] diff --git a/engine/overworld/trainers.asm b/engine/overworld/trainers.asm index 7d2ec0dd..66ae20ce 100755 --- a/engine/overworld/trainers.asm +++ b/engine/overworld/trainers.asm @@ -291,7 +291,7 @@ CheckSpriteCanSeePlayer: ; 569af (15:69af) ; tests if the player is in front of the sprite (rather than behind it) CheckPlayerIsInFrontOfSprite: ; 569e3 (15:69e3) - ld a, [W_CURMAP] + ld a, [wCurMap] cp POWER_PLANT jp z, .engage ; bypass this for power plant to get voltorb fake items to work ld a, [wTrainerSpriteOffset] diff --git a/engine/palettes.asm b/engine/palettes.asm index 722b7804..94b20469 100755 --- a/engine/palettes.asm +++ b/engine/palettes.asm @@ -152,7 +152,7 @@ SetPal_Overworld: ; 71fa5 (1c:5fa5) jr z, .PokemonTowerOrAgatha cp CAVERN jr z, .caveOrBruno - ld a, [W_CURMAP] + ld a, [wCurMap] cp REDS_HOUSE_1F jr c, .townOrRoute cp UNKNOWN_DUNGEON_2 @@ -396,7 +396,7 @@ Func_7213b:: ; 7213b (1c:613b) jr z, .PokemonTowerOrAgatha cp CAVERN jr z, .caveOrBruno - ld a, [W_CURMAP] + ld a, [wCurMap] cp REDS_HOUSE_1F jr c, .townOrRoute cp UNKNOWN_DUNGEON_2 diff --git a/engine/predefs17_2.asm b/engine/predefs17_2.asm index a2dac120..c0df7d0a 100755 --- a/engine/predefs17_2.asm +++ b/engine/predefs17_2.asm @@ -8,8 +8,8 @@ SetPartyMonTypes: ; 5db5e (17:5b5e) push hl call GetMonHeader pop hl - ld a, [W_MONHTYPE1] + ld a, [wMonHType1] ld [hli], a - ld a, [W_MONHTYPE2] + ld a, [wMonHType2] ld [hl], a ret diff --git a/engine/town_map.asm b/engine/town_map.asm index ea60e5a4..aff126ee 100755 --- a/engine/town_map.asm +++ b/engine/town_map.asm @@ -7,7 +7,7 @@ DisplayTownMap: ; 70eb7 (1c:4eb7) push hl ld a, $1 ld [hJoy7], a - ld a, [W_CURMAP] + ld a, [wCurMap] push af ld b, $0 call DrawPlayerOrBirdSprite ; player sprite @@ -167,7 +167,7 @@ LoadTownMap_Fly: ; 71014 (1c:5014) coord hl, 0, 0 ld de, ToText call PlaceString - ld a, [W_CURMAP] + ld a, [wCurMap] ld b, $0 call DrawPlayerOrBirdSprite ld hl, wFlyLocationsList @@ -262,9 +262,9 @@ BuildFlyLocationsList: ; 710fb (1c:50fb) ld hl, wFlyLocationsList - 1 ld [hl], $ff inc hl - ld a, [W_TOWNVISITEDFLAG] + ld a, [wTownVisitedFlag] ld e, a - ld a, [W_TOWNVISITEDFLAG + 1] + ld a, [wTownVisitedFlag + 1] ld d, a ld bc, SAFFRON_CITY + 1 .loop @@ -415,7 +415,7 @@ DisplayWildLocations: ; 71279 (1c:5279) call PlaceString jr .done .drawPlayerSprite - ld a, [W_CURMAP] + ld a, [wCurMap] ld b, $0 call DrawPlayerOrBirdSprite .done diff --git a/engine/trade.asm b/engine/trade.asm index 66afa47e..4bf90f8a 100755 --- a/engine/trade.asm +++ b/engine/trade.asm @@ -18,14 +18,14 @@ ExternalClockTradeAnim: ; 410f3 (10:50f3) ld de, ExternalClockTradeFuncSequence TradeAnimCommon: ; 41102 (10:5102) - ld a, [W_OPTIONS] + ld a, [wOptions] push af ld a, [hSCY] push af ld a, [hSCX] push af xor a - ld [W_OPTIONS], a + ld [wOptions], a ld [hSCY], a ld [hSCX], a push de @@ -53,7 +53,7 @@ TradeAnimCommon: ; 41102 (10:5102) pop af ld [hSCY], a pop af - ld [W_OPTIONS], a + ld [wOptions], a ret addtradefunc: MACRO @@ -289,7 +289,7 @@ DrawHPBar:: ; 10f8 (0:10f8) ; loads pokemon data from one of multiple sources to wLoadedMon -; loads base stats to W_MONHEADER +; loads base stats to wMonHeader ; INPUT: ; [wWhichPokemon] = index of pokemon within party/box ; [wMonDataLocation] = source @@ -618,7 +618,7 @@ GetwMoves:: ; 1326 (0:1326) ld a,[hl] ret -; copies the base stat data of a pokemon to W_MONHEADER +; copies the base stat data of a pokemon to wMonHeader ; INPUT: ; [wd0b5] = pokemon ID GetMonHeader:: ; 132f (0:132f) @@ -651,12 +651,12 @@ GetMonHeader:: ; 132f (0:132f) ld bc,28 ld hl,BaseStats call AddNTimes - ld de,W_MONHEADER + ld de,wMonHeader ld bc,28 call CopyData jr .done .specialID - ld hl,W_MONHSPRITEDIM + ld hl,wMonHSpriteDim ld [hl],b ; write sprite dimensions inc hl ld [hl],e ; write front sprite pointer @@ -664,7 +664,7 @@ GetMonHeader:: ; 132f (0:132f) ld [hl],d .done ld a,[wd0b5] - ld [W_MONHINDEX],a + ld [wMonHIndex],a pop af ld [wd11e],a pop hl @@ -775,7 +775,7 @@ PrintBCDDigit:: ; 13e4 (0:13e4) ; assumes the corresponding mon header is already loaded ; hl contains offset to sprite pointer ($b for front or $d for back) UncompressMonSprite:: ; 1407 (0:1407) - ld bc,W_MONHEADER + ld bc,wMonHeader add hl,bc ld a,[hli] ld [W_SPRITEINPUTPTR],a ; fetch sprite input pointer @@ -821,9 +821,9 @@ UncompressMonSprite:: ; 1407 (0:1407) ; de: destination location LoadMonFrontSprite:: ; 143e (0:143e) push de - ld hl, W_MONHFRONTSPRITE - W_MONHEADER + ld hl, wMonHFrontSprite - wMonHeader call UncompressMonSprite - ld hl, W_MONHSPRITEDIM + ld hl, wMonHSpriteDim ld a, [hli] ld c, a pop de @@ -1242,7 +1242,7 @@ DisplayTextID:: ; 2817 (0:2817) bit 0,[hl] res 0,[hl] jr nz,.skipSwitchToMapBank - ld a,[W_CURMAP] + ld a,[wCurMap] call SwitchToMapRomBank .skipSwitchToMapBank ld a,30 ; half a second @@ -1266,7 +1266,7 @@ DisplayTextID:: ; 2817 (0:2817) jp z,DisplayPlayerBlackedOutText cp a,TEXT_REPEL_WORE_OFF jp z,DisplayRepelWoreOffText - ld a,[W_NUMSPRITES] + ld a,[wNumSprites] ld e,a ld a,[hSpriteIndexOrTextID] ; sprite ID cp e @@ -1280,7 +1280,7 @@ DisplayTextID:: ; 2817 (0:2817) ;callba UpdateSpriteFacingOffsetAndDelayMovement ; update the graphics of the sprite the player is talking to (to face the right direction) ;pop bc ;pop de - ld hl,W_MAPSPRITEDATA ; NPC text entries + ld hl,wMapSpriteData ; NPC text entries ld a,[hSpriteIndexOrTextID] dec a add a @@ -1343,7 +1343,7 @@ HoldTextDisplayOpen:: ; 28cf (0:28cf) jr nz,HoldTextDisplayOpen CloseTextDisplay:: ; 28d8 (0:28d8) - ld a,[W_CURMAP] + ld a,[wCurMap] call SwitchToMapRomBank ld a,$90 ld [hWY],a ; move the window off the screen @@ -1440,7 +1440,7 @@ DisplayPlayerBlackedOutText:: ; 2988 (0:2988) bit 7,a jr z,.didnotblackoutinsafari xor a - ld [W_NUMSAFARIBALLS],a + ld [wNumSafariBalls],a ld [wSafariSteps],a ld [wSafariSteps+1],a ld [wd790],a @@ -2203,7 +2203,7 @@ GetMoveName:: ; 2f4d (0:2f4d) ReloadMapData:: ; 2f66 (0:2f66) ld a,[H_LOADEDROMBANK] push af - ld a,[W_CURMAP] + ld a,[wCurMap] call SwitchToMapRomBank call DisableLCD call LoadTextBoxTilePatterns @@ -2218,7 +2218,7 @@ ReloadMapData:: ; 2f66 (0:2f66) ReloadTilesetTilePatterns:: ; 2f83 (0:2f83) ld a,[H_LOADEDROMBANK] push af - ld a,[W_CURMAP] + ld a,[wCurMap] call SwitchToMapRomBank call DisableLCD call LoadTilesetTilePatternData @@ -2459,12 +2459,12 @@ EndNPCMovementScript:: ; 30ea (0:30ea) EmptyFunc2:: ; 30f2 (0:30f2) ret -; stores hl in [W_TRAINERHEADERPTR] +; stores hl in [wTrainerHeaderPtr] StoreTrainerHeaderPointer:: ; 30f3 (0:30f3) ld a, h - ld [W_TRAINERHEADERPTR], a + ld [wTrainerHeaderPtr], a ld a, l - ld [W_TRAINERHEADERPTR+1], a + ld [wTrainerHeaderPtr+1], a ret ; executes the current map script from the function pointer array provided in hl. @@ -2498,7 +2498,7 @@ LoadGymLeaderAndCityName:: ; 311b (0:311b) ld bc, NAME_LENGTH jp CopyData ; load gym leader name -; reads specific information from trainer header (pointed to at W_TRAINERHEADERPTR) +; reads specific information from trainer header (pointed to at wTrainerHeaderPtr) ; a: offset in header data ; 0 -> flag's bit (into wTrainerHeaderFlagBit) ; 2 -> flag's byte ptr (into hl) @@ -2510,7 +2510,7 @@ ReadTrainerHeaderInfo:: ; 312f (0:312f) push af ld d, $0 ld e, a - ld hl, W_TRAINERHEADERPTR + ld hl, wTrainerHeaderPtr ld a, [hli] ld l, [hl] ld h, a @@ -2643,7 +2643,7 @@ EndTrainerBattle:: ; 3211 (0:3211) res 7, [hl] ld hl, wFlags_0xcd60 res 0, [hl] ; player is no longer engaged by any trainer - ld a, [W_ISINBATTLE] + ld a, [wIsInBattle] cp $ff jp z, ResetButtonPressedAndMapScript ld a, $2 @@ -2655,7 +2655,7 @@ EndTrainerBattle:: ; 3211 (0:3211) ld a, [W_ENEMYMONORTRAINERCLASS] cp 200 jr nc, .skipRemoveSprite ; test if trainer was fought (in that case skip removing the corresponding sprite) - ld hl, W_MISSABLEOBJECTLIST + ld hl, wMissableObjectList ld de, $2 ld a, [wSpriteIndex] call IsInArray ; search for sprite ID @@ -2685,7 +2685,7 @@ TrainerWalkUpToPlayer_Bank0:: ; 326b (0:326b) ; sets opponent type and mon set/lvl based on the engaging trainer data InitBattleEnemyParameters:: ; 3273 (0:3273) ld a, [wEngagedTrainerClass] - ld [W_CUROPPONENT], a + ld [wCurOpponent], a ld [W_ENEMYMONORTRAINERCLASS], a cp 200 ld a, [wEngagedTrainerSet] @@ -2693,7 +2693,7 @@ InitBattleEnemyParameters:: ; 3273 (0:3273) ld [W_TRAINERNO], a ret .noTrainer - ld [W_CURENEMYLVL], a + ld [wCurEnemyLVL], a ret GetSpritePosition1:: ; 328b (0:328b) @@ -2778,7 +2778,7 @@ SaveEndBattleTextPointers:: ; 32f0 (0:32f0) ; loads data of some trainer on the current map and plays pre-battle music ; [wSpriteIndex]: sprite ID of trainer who is engaged EngageMapTrainer:: ; 3306 (0:3306) - ld hl, W_MAPSPRITEEXTRADATA + ld hl, wMapSpriteExtraData ld d, $0 ld a, [wSpriteIndex] dec a @@ -2846,7 +2846,7 @@ PlayTrainerMusic:: ; 3379 (0:3379) ret z cp OPP_SONY3 ret z - ld a, [W_GYMLEADERNO] + ld a, [wGymLeaderNo] and a ret nz xor a @@ -3060,9 +3060,9 @@ SpriteFunc_34a1:: ; 34a1 (0:34a1) ; [wCoordIndex] = if there is match, the matching array index ; sets carry if the coordinates are in the array, clears carry if not ArePlayerCoordsInArray:: ; 34bc (0:34bc) - ld a,[W_YCOORD] + ld a,[wYCoord] ld b,a - ld a,[W_XCOORD] + ld a,[wXCoord] ld c,a ; fallthrough @@ -3197,7 +3197,7 @@ GetSpriteMovementByte1Pointer:: ; 354b (0:354b) ; returns the sprite movement byte 2 pointer for sprite [H_SPRITEINDEX] in hl GetSpriteMovementByte2Pointer:: ; 3555 (0:3555) push de - ld hl,W_MAPSPRITEDATA + ld hl,wMapSpriteData ld a,[H_SPRITEINDEX] dec a add a @@ -3826,7 +3826,7 @@ PrintLetterDelay:: ; 38c8 (0:38c8) ld a,[wLetterPrintingDelayFlags] bit 0,a jr z,.waitOneFrame - ld a,[W_OPTIONS] + ld a,[wOptions] and $f ld [H_FRAMECOUNTER],a jr .checkButtons @@ -3916,7 +3916,7 @@ CalcStat:: ; 393f (0:393f) ld a, b ld d, a push hl - ld hl, W_MONHEADER + ld hl, wMonHeader ld b, $0 add hl, bc ld a, [hl] ; read base value of stat @@ -4030,7 +4030,7 @@ CalcStat:: ; 393f (0:393f) ld [H_MULTIPLICAND+1], a xor a ld [H_MULTIPLICAND], a - ld a, [W_CURENEMYLVL] + ld a, [wCurEnemyLVL] ld [H_MULTIPLIER], a call Multiply ; ((Base + IV) * 2 + ceil(Sqrt(stat exp)) / 4) * Level ld a, [H_MULTIPLICAND] @@ -4048,7 +4048,7 @@ CalcStat:: ; 393f (0:393f) cp $1 ld a, 5 ; + 5 for non-HP stat jr nz, .notHPStat - ld a, [W_CURENEMYLVL] + ld a, [wCurEnemyLVL] ld b, a ld a, [H_MULTIPLICAND+2] add b @@ -4854,7 +4854,7 @@ GivePokemon:: ; 3e59 (0:3e59) ld a, b ld [wcf91], a ld a, c - ld [W_CURENEMYLVL], a + ld [wCurEnemyLVL], a xor a ; PLAYER_PARTY_DATA ld [wMonDataLocation], a jpba _GivePokemon ; 3d:66fa diff --git a/home/audio.asm b/home/audio.asm index e165d80d..d22990fb 100644 --- a/home/audio.asm +++ b/home/audio.asm @@ -69,7 +69,7 @@ PlayDefaultMusicCommon:: ; 2118 (0:2118) Func_21c8:: ; 21c8 (0:21c8) ; probably used to not change music upon getting on bike - ld a,[W_CURMAP] + ld a,[wCurMap] cp ROUTE_23 jr z,.asm_21e1 cp VICTORY_ROAD_1 diff --git a/home/fade.asm b/home/fade.asm index 2bdcbf01..7ac2e1c2 100644 --- a/home/fade.asm +++ b/home/fade.asm @@ -1,7 +1,7 @@ ; These routines manage gradual fading ; (e.g., entering a doorway) LoadGBPal:: ; 1e6f (0:1e6f) - ld a, [wMapPalOffset] ; tells if W_CURMAP is dark (requires HM5_FLASH?) + ld a, [wMapPalOffset] ; tells if wCurMap is dark (requires HM5_FLASH?) ld b, a ld hl, FadePal4 ld a, l diff --git a/home/overworld.asm b/home/overworld.asm index d851db7e..9d9b804a 100644 --- a/home/overworld.asm +++ b/home/overworld.asm @@ -62,7 +62,7 @@ OverworldLoopLessDelay:: ; 0245 (0:0245) ld a,[wd732] and a,1 << 4 | 1 << 3 ; fly warp or dungeon warp jp nz,HandleFlyWarpOrDungeonWarp - ld a,[W_CUROPPONENT] + ld a,[wCurOpponent] and a jp nz,.newBattle ld a,[wd730] @@ -117,15 +117,15 @@ OverworldLoopLessDelay:: ; 0245 (0:0245) ld [wLinkTimeoutCounter],a jp EnterMap ; predef LoadSAV -; ld a,[W_CURMAP] +; ld a,[wCurMap] ; ld [wDestinationMap],a ; call SpecialWarpIn -; ld a,[W_CURMAP] +; ld a,[wCurMap] ; call SwitchToMapRomBank ; switch to the ROM bank of the current map ; ld hl,wCurMapTileset ; set 7,[hl] .checkForOpponent - ld a,[W_CUROPPONENT] + ld a,[wCurOpponent] and a jp nz,.newBattle jp OverworldLoop @@ -252,7 +252,7 @@ OverworldLoopLessDelay:: ; 0245 (0:0245) and a jp nz,WarpFound2 .notSafariZone - ld a,[W_ISINBATTLE] + ld a,[wIsInBattle] and a jp nz,CheckWarpsNoCollision predef ApplyOutOfBattlePoisonDamage ; also increment daycare mon exp @@ -274,7 +274,7 @@ OverworldLoopLessDelay:: ; 0245 (0:0245) set 6,[hl] xor a ld [hJoyHeld],a - ld a,[W_CURMAP] + ld a,[wCurMap] cp a,CINNABAR_GYM jr nz,.notCinnabarGym ld hl,wd79b @@ -282,7 +282,7 @@ OverworldLoopLessDelay:: ; 0245 (0:0245) .notCinnabarGym ld hl,wd72e set 5,[hl] - ld a,[W_CURMAP] + ld a,[wCurMap] cp a,OAKS_LAB jp z,.noFaintCheck ; no blacking out if the player lost to the rival in Oak's lab callab AnyPartyAlive @@ -314,7 +314,7 @@ StepCountCheck:: ; 0457 (0:0457) AllPokemonFainted:: ; 0475 (0:0475) ld a,$ff - ld [W_ISINBATTLE],a + ld [wIsInBattle],a call RunMapScript jp HandleBlackOut @@ -344,7 +344,7 @@ DoBikeSpeedup:: ; 049d (0:049d) ld a,[wNPCMovementScriptPointerTableNum] and a ret nz - ld a,[W_CURMAP] + ld a,[wCurMap] cp ROUTE_17 ; cycling road jr nz,.goFaster ld a,[hJoyHeld] @@ -362,9 +362,9 @@ CheckWarpsNoCollision:: ; 04bd (0:04bd) ld b,0 ld a,[wNumberOfWarps] ld c,a - ld a,[W_YCOORD] + ld a,[wYCoord] ld d,a - ld a,[W_XCOORD] + ld a,[wXCoord] ld e,a ld hl,wWarpEntries CheckWarpsNoCollisionLoop:: ; 04d5 (0:04d5) @@ -422,12 +422,12 @@ CheckWarpsCollision:: ; 051a (0:051a) .loop ld a,[hli] ; Y coordinate of warp ld b,a - ld a,[W_YCOORD] + ld a,[wYCoord] cp b jr nz,.retry1 ld a,[hli] ; X coordinate of warp ld b,a - ld a,[W_XCOORD] + ld a,[wXCoord] cp b jr nz,.retry2 ld a,[hli] @@ -454,17 +454,17 @@ WarpFound2:: ; 054a (0:054a) ld a,[wNumberOfWarps] sub c ld [wWarpedFromWhichWarp],a ; save ID of used warp - ld a,[W_CURMAP] + ld a,[wCurMap] ld [wWarpedFromWhichMap],a call CheckIfInOutsideMap jr nz,.indoorMaps ; this is for handling "outside" maps that can't have the 0xFF destination map - ld a,[W_CURMAP] + ld a,[wCurMap] ld [wLastMap],a - ld a,[W_CURMAPWIDTH] + ld a,[wCurMapWidth] ld [wUnusedD366],a ; not read ld a,[hWarpDestinationMap] - ld [W_CURMAP],a + ld [wCurMap],a cp a,ROCK_TUNNEL_1 jr nz,.notRockTunnel ld a,$06 @@ -480,7 +480,7 @@ WarpFound2:: ; 054a (0:054a) cp a,$ff jr z,.goBackOutside ; if not going back to the previous map - ld [W_CURMAP],a + ld [wCurMap],a callba IsPlayerStandingOnWarpPadOrHole ld a,[wStandingOnWarpPadOrHole] dec a ; is the player on a warp pad? @@ -501,7 +501,7 @@ WarpFound2:: ; 054a (0:054a) .goBackOutside callab Func_fc69a ; 3f:469a ld a,[wLastMap] - ld [W_CURMAP],a + ld [wCurMap],a call PlayMapChangeSound xor a ld [wMapPalOffset],a @@ -514,19 +514,19 @@ WarpFound2:: ; 054a (0:054a) ; if no matching warp was found CheckMapConnections:: ; 05db (0:05db) .checkWestMap - ld a,[W_XCOORD] + ld a,[wXCoord] cp a,$ff jr nz,.checkEastMap ld a,[W_MAPCONN3PTR] - ld [W_CURMAP],a + ld [wCurMap],a ld a,[wWestConnectedMapXAlignment] ; new X coordinate upon entering west map - ld [W_XCOORD],a - ld a,[W_YCOORD] + ld [wXCoord],a + ld a,[wYCoord] ld c,a ld a,[wWestConnectedMapYAlignment] ; Y adjustment upon entering west map add c ld c,a - ld [W_YCOORD],a + ld [wYCoord],a ld a,[wWestConnectedMapViewPointer] ; pointer to upper left corner of map without adjustment for Y position ld l,a ld a,[wWestConnectedMapViewPointer + 1] @@ -554,15 +554,15 @@ CheckMapConnections:: ; 05db (0:05db) cp b jr nz,.checkNorthMap ld a,[W_MAPCONN4PTR] - ld [W_CURMAP],a + ld [wCurMap],a ld a,[wEastConnectedMapXAlignment] ; new X coordinate upon entering east map - ld [W_XCOORD],a - ld a,[W_YCOORD] + ld [wXCoord],a + ld a,[wYCoord] ld c,a ld a,[wEastConnectedMapYAlignment] ; Y adjustment upon entering east map add c ld c,a - ld [W_YCOORD],a + ld [wYCoord],a ld a,[wEastConnectedMapViewPointer] ; pointer to upper left corner of map without adjustment for Y position ld l,a ld a,[wEastConnectedMapViewPointer + 1] @@ -585,19 +585,19 @@ CheckMapConnections:: ; 05db (0:05db) ld [wCurrentTileBlockMapViewPointer + 1],a jp .loadNewMap .checkNorthMap - ld a,[W_YCOORD] + ld a,[wYCoord] cp a,$ff jr nz,.checkSouthMap ld a,[W_MAPCONN1PTR] - ld [W_CURMAP],a + ld [wCurMap],a ld a,[wNorthConnectedMapYAlignment] ; new Y coordinate upon entering north map - ld [W_YCOORD],a - ld a,[W_XCOORD] + ld [wYCoord],a + ld a,[wXCoord] ld c,a ld a,[wNorthConnectedMapXAlignment] ; X adjustment upon entering north map add c ld c,a - ld [W_XCOORD],a + ld [wXCoord],a ld a,[wNorthConnectedMapViewPointer] ; pointer to upper left corner of map without adjustment for X position ld l,a ld a,[wNorthConnectedMapViewPointer + 1] @@ -616,15 +616,15 @@ CheckMapConnections:: ; 05db (0:05db) cp b jr nz,.didNotEnterConnectedMap ld a,[W_MAPCONN2PTR] - ld [W_CURMAP],a + ld [wCurMap],a ld a,[wSouthConnectedMapYAlignment] ; new Y coordinate upon entering south map - ld [W_YCOORD],a - ld a,[W_XCOORD] + ld [wYCoord],a + ld a,[wXCoord] ld c,a ld a,[wSouthConnectedMapXAlignment] ; X adjustment upon entering south map add c ld c,a - ld [W_XCOORD],a + ld [wXCoord],a ld a,[wSouthConnectedMapViewPointer] ; pointer to upper left corner of map without adjustment for X position ld l,a ld a,[wSouthConnectedMapViewPointer + 1] @@ -690,7 +690,7 @@ CheckIfInOutsideMap:: ; 0712 (0:0712) ; "function 2" passes when the the tile in front of the player is among a certain set ; sets carry if the check passes, otherwise clears carry ExtraWarpCheck:: ; 071a (0:071a) - ld a, [W_CURMAP] + ld a, [wCurMap] cp SS_ANNE_3 jr z, .useFunction1 cp ROCKET_HIDEOUT_1 @@ -755,7 +755,7 @@ HandleFlyWarpOrDungeonWarp:: ; 0794 (0:0794) call Delay3 xor a ld [wBattleResult], a - ld [W_ISINBATTLE], a + ld [wIsInBattle], a ld [wMapPalOffset], a ld hl, wd732 set 2, [hl] ; fly warp or dungeon warp @@ -823,7 +823,7 @@ IsBikeRidingAllowed:: ; 0805 (0:0805) ; or maps with tilesets in BikeRidingTilesets. ; Return carry if biking is allowed. - ld a, [W_CURMAP] + ld a, [wCurMap] cp ROUTE_23 jr z, .allowed cp INDIGO_PLATEAU @@ -849,13 +849,13 @@ INCLUDE "data/bike_riding_tilesets.asm" ; load the tile pattern data of the current tileset into VRAM LoadTilesetTilePatternData:: ; 0828 (0:0828) - ld a,[W_TILESETGFXPTR] + ld a,[wTilesetGFXPtr] ld l,a - ld a,[W_TILESETGFXPTR + 1] + ld a,[wTilesetGFXPtr + 1] ld h,a ld de,vTileset ld bc,$600 - ld a,[W_TILESETBANK] + ld a,[wTilesetBank] jp FarCopyData ; this loads the current maps complete tile map (which references blocks, not individual tiles) to C6E8 @@ -869,7 +869,7 @@ LoadTileBlockMap:: ; 083c (0:083c) ; load tile map of current map (made of tile block IDs) ; a 3-byte border at the edges of the map is kept so that there is space for map connections ld hl,wOverworldMap - ld a,[W_CURMAPWIDTH] + ld a,[wCurMapWidth] ld [hMapWidth],a add a,MAP_BORDER * 2 ; east and west ld [hMapStride],a ; map width + border @@ -885,7 +885,7 @@ LoadTileBlockMap:: ; 083c (0:083c) ld e,a ld a,[W_MAPDATAPTR + 1] ld d,a ; de = tile map pointer - ld a,[W_CURMAPHEIGHT] + ld a,[wCurMapHeight] ld b,a .rowLoop ; copy one row each iteration push hl @@ -1003,7 +1003,7 @@ LoadNorthSouthConnectionsTileMap:: ; 0919 (0:0919) jr nc,.noCarry1 inc h .noCarry1 - ld a,[W_CURMAPWIDTH] + ld a,[wCurMapWidth] add a,MAP_BORDER * 2 add e ld e,a @@ -1032,7 +1032,7 @@ LoadEastWestConnectionsTileMap:: ; 093d (0:093d) jr nc,.noCarry1 inc h .noCarry1 - ld a,[W_CURMAPWIDTH] + ld a,[wCurMapWidth] add a,MAP_BORDER * 2 add e ld e,a @@ -1359,7 +1359,7 @@ TilePairCollisionsWater:: ; 0afc (0:0afc) LoadCurrentMapView:: ; 0b06 (0:0b06) ld a,[H_LOADEDROMBANK] push af - ld a,[W_TILESETBANK] ; tile data ROM bank + ld a,[wTilesetBank] ; tile data ROM bank call BankswitchCommon ; switch to ROM bank that contains tile data ld a,[wCurrentTileBlockMapViewPointer] ; address of upper left corner of current map view ld e,a @@ -1390,7 +1390,7 @@ LoadCurrentMapView:: ; 0b06 (0:0b06) jr nz,.rowInnerLoop ; update tile block map pointer to next row's address pop de - ld a,[W_CURMAPWIDTH] + ld a,[wCurMapWidth] add a,MAP_BORDER * 2 add e ld e,a @@ -1410,13 +1410,13 @@ LoadCurrentMapView:: ; 0b06 (0:0b06) ld hl,wTileMapBackup ld bc,$0000 .adjustForYCoordWithinTileBlock - ld a,[W_YBLOCKCOORD] + ld a,[wYBlockCoord] and a jr z,.adjustForXCoordWithinTileBlock ld bc,$0030 add hl,bc .adjustForXCoordWithinTileBlock - ld a,[W_XBLOCKCOORD] + ld a,[wXBlockCoord] and a jr z,.copyToVisibleAreaBuffer ld bc,$0002 @@ -1606,7 +1606,7 @@ ForceBikeDown:: ; 0c65 (0:0c65) ld a,[W_FLAGS_D733] bit 3,a ; check if a trainer wants a challenge ret nz - ld a,[W_CURMAP] + ld a,[wCurMap] cp a,ROUTE_17 ; Cycling Road ret nz ld a,[hJoyHeld] @@ -1743,7 +1743,7 @@ RunMapScript:: ; 0d2c (0:0d2c) pop de pop hl call RunNPCMovementScript - ld a,[W_CURMAP] ; current map number + ld a,[wCurMap] ; current map number call SwitchToMapRomBank ; change to the ROM bank the map's data is in ld hl,W_MAPSCRIPTPTR ld a,[hli] @@ -1816,7 +1816,7 @@ LoadMapHeader:: ; 0dab (0:0dab) .asm_0dbd ld a,[wCurMapTileset] ld [wUnusedD119],a - ld a,[W_CURMAP] + ld a,[wCurMap] call SwitchToMapRomBank ld a,[wCurMapTileset] ld b,a @@ -1914,13 +1914,13 @@ LoadMapHeader:: ; 0dab (0:0dab) .asm_0e73 callab LoadWildData ; 3:4b62 pop hl ; restore hl from before going to the warp/sign/sprite data (this value was saved for seemingly no purpose) - ld a,[W_CURMAPHEIGHT] ; map height in 4x4 tile blocks + ld a,[wCurMapHeight] ; map height in 4x4 tile blocks add a ; double it ld [wCurrentMapHeight2],a ; store map height in 2x2 tile blocks - ld a,[W_CURMAPWIDTH] ; map width in 4x4 tile blocks + ld a,[wCurMapWidth] ; map width in 4x4 tile blocks add a ; double it ld [wCurrentMapWidth2],a ; map width in 2x2 tile blocks - ld a,[W_CURMAP] + ld a,[wCurMap] ld c,a ld b,$00 ld a,[H_LOADEDROMBANK] @@ -2010,7 +2010,7 @@ Func_0f16:: ; 0f16 (0:0f16) push af call DisableLCD call ResetMapVariables - ld a,[W_CURMAP] + ld a,[wCurMap] call SwitchToMapRomBank call LoadScreenRelatedData call CopyMapViewToVRAM @@ -2024,7 +2024,7 @@ Func_0f16:: ; 0f16 (0:0f16) Func_0f3d:: ; 0f3d (0:0f3d) ld a,[H_LOADEDROMBANK] push af - ld a,[W_CURMAP] + ld a,[wCurMap] call SwitchToMapRomBank call LoadTileBlockMap pop af @@ -2097,7 +2097,7 @@ GetMapHeaderPointer:: ; 0fa7 (0:0fa7) push af switchbank MapHeaderPointers ; 3f:41f2 push de - ld a,[W_CURMAP] + ld a,[wCurMap] ld e,a ld d,$0 ld hl,MapHeaderPointers @@ -2154,20 +2154,20 @@ Func_0ffe:: ; 0ffe (0:0ffe) InitSprites:: ; 1006 (0:1006) ld a,[hli] - ld [W_NUMSPRITES],a ; save the number of sprites + ld [wNumSprites],a ; save the number of sprites push hl push de push bc call ZeroSpriteStateData call DisableRegularSprites - ld hl,W_MAPSPRITEDATA + ld hl,wMapSpriteData ld bc,$20 xor a call FillMemory pop bc pop de pop hl - ld a,[W_NUMSPRITES] + ld a,[wNumSprites] and a ; are sprites existant? ret z ; don't copy sprite data if not ld b,a @@ -2236,7 +2236,7 @@ DisableRegularSprites:: ; 1060 (0:1060) LoadSprite:: ; 106f (0:106f) push hl ld b,$0 - ld hl,W_MAPSPRITEDATA + ld hl,wMapSpriteData add hl,bc ld a,[$ff8d] ld [hli],a ; store movement byte 2 in byte 0 of sprite entry @@ -2254,7 +2254,7 @@ LoadSprite:: ; 106f (0:106f) jr nz,.itemBallSprite ; for regular sprites push hl - ld hl,W_MAPSPRITEEXTRADATA + ld hl,wMapSpriteExtraData add hl,bc ; zero both bytes, since regular sprites don't use this extra space xor a @@ -2269,7 +2269,7 @@ LoadSprite:: ; 106f (0:106f) ld a,[hli] ld [$ff8e],a ; save trainer number (within class) push hl - ld hl,W_MAPSPRITEEXTRADATA + ld hl,wMapSpriteExtraData add hl,bc ld a,[$ff8d] ld [hli],a ; store trainer class in byte 0 of the entry @@ -2282,7 +2282,7 @@ LoadSprite:: ; 106f (0:106f) ld a,[hli] ld [$ff8d],a ; save item number push hl - ld hl,W_MAPSPRITEEXTRADATA + ld hl,wMapSpriteExtraData add hl,bc ld a,[$ff8d] ld [hli],a ; store item number in byte 0 of the entry @@ -38,7 +38,7 @@ LoadMonData_: ; 2: boxmon ; 3: daycaremon ; Return monster id at wcf91 and its data at wLoadedMon. -; Also load base stats at W_MONHEADER for convenience. +; Also load base stats at wMonHeader for convenience. ld a, [wDayCareMonSpecies] ld [wcf91], a @@ -113,7 +113,7 @@ PrintWaitingText: coord hl, 3, 10 ld b, $1 ld c, $b - ld a, [W_ISINBATTLE] + ld a, [wIsInBattle] and a jr z, .asm_4c17 call TextBoxBorder @@ -514,16 +514,16 @@ TestBattle: ld a, RHYDON ld [wcf91], a ld a, 20 - ld [W_CURENEMYLVL], a + ld [wCurEnemyLVL], a xor a ld [wMonDataLocation], a - ld [W_CURMAP], a + ld [wCurMap], a call AddPartyMon ; Fight against a ; level 20 Rhydon. ld a, RHYDON - ld [W_CUROPPONENT], a + ld [wCurOpponent], a predef InitOpponent @@ -607,7 +607,7 @@ LoadSpecialWarpData: ; 62ff (1:62ff) jr nz, .notFirstMap ld hl, FirstMapSpec .copyWarpData - ld de, W_CURMAP + ld de, wCurMap ld c, $7 .copyWarpDataLoop ld a, [hli] @@ -635,7 +635,7 @@ LoadSpecialWarpData: ; 62ff (1:62ff) res 4, [hl] ld a, [wDungeonWarpDestinationMap] ld b, a - ld [W_CURMAP], a + ld [wCurMap], a ld a, [wWhichDungeonWarp] ld c, a ld hl, DungeonWarpList @@ -665,7 +665,7 @@ LoadSpecialWarpData: ; 62ff (1:62ff) ld a, [wDestinationMap] .usedFlyWarp ld b, a - ld [W_CURMAP], a + ld [wCurMap], a ld hl, FlyWarpDataPtr .flyWarpDataPtrLoop ld a, [hli] @@ -717,7 +717,7 @@ SetIshiharaTeam: ; 64ca (1:64ca) ld [wcf91], a inc de ld a, [de] - ld [W_CURENEMYLVL], a + ld [wCurEnemyLVL], a inc de call AddPartyMon jr .loop @@ -918,7 +918,7 @@ SetLastBlackoutMap: push hl ld hl, SafariZoneRestHouses - ld a, [W_CURMAP] + ld a, [wCurMap] ld b, a .loop ld a, [hli] @@ -2006,7 +2006,7 @@ ClearVariablesAfterLoadingMapData: ; c07c (3:407c) xor a ld [H_AUTOBGTRANSFERENABLED], a ld [wStepCounter], a - ld [W_LONEATTACKNO], a + ld [wLoneAttackNo], a ld [hJoyPressed], a ld [hJoyReleased], a ld [hJoyHeld], a @@ -2028,11 +2028,11 @@ IsPlayerStandingOnWarp: ; c0a6 (3:40a6) ld c, a ld hl, wWarpEntries .loop - ld a, [W_YCOORD] + ld a, [wYCoord] cp [hl] jr nz, .nextWarp1 inc hl - ld a, [W_XCOORD] + ld a, [wXCoord] cp [hl] jr nz, .nextWarp2 inc hl @@ -2058,11 +2058,11 @@ CheckForceBikeOrSurf: ; c0d2 (3:40d2) bit 5, [hl] ret nz ld hl, ForcedBikeOrSurfMaps - ld a, [W_YCOORD] + ld a, [wYCoord] ld b, a - ld a, [W_XCOORD] + ld a, [wXCoord] ld c, a - ld a, [W_CURMAP] + ld a, [wCurMap] ld d, a .loop ld a, [hli] @@ -2076,15 +2076,15 @@ CheckForceBikeOrSurf: ; c0d2 (3:40d2) ld a, [hli] cp c ;compare x-coord jr nz, .loop ; incorrect x-coord, check next item - ld a, [W_CURMAP] + ld a, [wCurMap] cp SEAFOAM_ISLANDS_4 ld a, $2 - ld [W_SEAFOAMISLANDS4CURSCRIPT], a + ld [wSeafoamIslands4CurScript], a jr z, .forceSurfing - ld a, [W_CURMAP] + ld a, [wCurMap] cp SEAFOAM_ISLANDS_5 ld a, $2 - ld [W_SEAFOAMISLANDS5CURSCRIPT], a + ld [wSeafoamIslands5CurScript], a jr z, .forceSurfing ;force bike riding ld hl, wd732 @@ -2119,9 +2119,9 @@ IsPlayerFacingEdgeOfMap: ; c148 (3:4148) ld a, [hli] ld h, [hl] ld l, a - ld a, [W_YCOORD] + ld a, [wYCoord] ld b, a - ld a, [W_XCOORD] + ld a, [wXCoord] ld c, a ld de, .returnaddress push de @@ -2139,7 +2139,7 @@ IsPlayerFacingEdgeOfMap: ; c148 (3:4148) dw .facingRight .facingDown - ld a, [W_CURMAPHEIGHT] + ld a, [wCurMapHeight] add a dec a cp b @@ -2159,7 +2159,7 @@ IsPlayerFacingEdgeOfMap: ; c148 (3:4148) jr .resetCarry .facingRight - ld a, [W_CURMAPWIDTH] + ld a, [wCurMapWidth] add a dec a cp c @@ -2177,7 +2177,7 @@ IsWarpTileInFrontOfPlayer: ; c197 (3:4197) push de push bc call _GetTileAndCoordsInFrontOfPlayer - ld a, [W_CURMAP] + ld a, [wCurMap] cp SS_ANNE_5 jr z, .ssAnne5 ld a, [wSpriteStateData1 + 9] ; player sprite's facing direction @@ -2256,7 +2256,7 @@ IsPlayerStandingOnDoorTileOrWarpTile: ; c1e6 (3:41e6) INCLUDE "data/warp_tile_ids.asm" PrintSafariZoneSteps: ; c52f (3:452f) - ld a, [W_CURMAP] + ld a, [wCurMap] cp SAFARI_ZONE_EAST ret c cp UNKNOWN_DUNGEON_2 @@ -2274,7 +2274,7 @@ PrintSafariZoneSteps: ; c52f (3:452f) coord hl, 1, 3 ld de, SafariBallText call PlaceString - ld a, [W_NUMSAFARIBALLS] + ld a, [wNumSafariBalls] cp 10 jr nc, .numSafariBallsTwoDigits coord hl, 5, 3 @@ -2282,7 +2282,7 @@ PrintSafariZoneSteps: ; c52f (3:452f) ld [hl], a .numSafariBallsTwoDigits coord hl, 6, 3 - ld de, W_NUMSAFARIBALLS + ld de, wNumSafariBalls lb bc, 1, 2 jp PrintNumber @@ -2296,9 +2296,9 @@ GetTileAndCoordsInFrontOfPlayer: ; c2d4 (3:42d4) call GetPredefRegisters _GetTileAndCoordsInFrontOfPlayer: ; c2d4 (3:42d4) - ld a, [W_YCOORD] + ld a, [wYCoord] ld d, a - ld a, [W_XCOORD] + ld a, [wXCoord] ld e, a ld a, [wSpriteStateData1 + 9] ; player's sprite facing direction and a ; cp SPRITE_FACING_DOWN @@ -2335,7 +2335,7 @@ _GetTileAndCoordsInFrontOfPlayer: ; c2d4 (3:42d4) GetTileTwoStepsInFrontOfPlayer: ; c309 (3:4309) xor a ld [$ffdb], a - ld hl, W_YCOORD + ld hl, wYCoord ld a, [hli] ld d, a ld e, [hl] @@ -2410,7 +2410,7 @@ CheckForBoulderCollisionWithSprites: ; c378 (3:4378) ld [$ffdc], a ld a, [hl] ; map X position ld [$ffdd], a - ld a, [W_NUMSPRITES] + ld a, [wNumSprites] ld c, a ld de, $f ld hl, wSpriteStateData2 + $14 @@ -2638,7 +2638,7 @@ LoadTilesetHeader: ; c4f4 (3:44f4) add hl, de add hl, de add hl, de - ld de, W_TILESETBANK + ld de, wTilesetBank ld bc, $b call CopyData ld a, [hl] @@ -2665,12 +2665,12 @@ LoadTilesetHeader: ; c4f4 (3:44f4) cp $ff jr z, .done call LoadDestinationWarpPosition - ld a, [W_YCOORD] + ld a, [wYCoord] and $1 - ld [W_YBLOCKCOORD], a - ld a, [W_XCOORD] + ld [wYBlockCoord], a + ld a, [wXCoord] and $1 - ld [W_XBLOCKCOORD], a + ld [wXBlockCoord], a .done ret @@ -2679,7 +2679,7 @@ INCLUDE "data/dungeon_tilesets.asm" INCLUDE "data/tileset_headers.asm" IncrementDayCareMonExp: ; c684 (3:4684) - ld a, [W_DAYCARE_IN_USE] + ld a, [wDayCareInUse] and a ret z ld hl, wDayCareMonExp + 2 @@ -2725,7 +2725,7 @@ CheckForForcedBikeSurf: ; cdc0 (3:4dc0) ld a, [wd732] bit 5, a jr nz, .asm_cdec - ld a, [W_CURMAP] + ld a, [wCurMap] cp SEAFOAM_ISLANDS_5 ret nz CheckBothEventsSet EVENT_SEAFOAM4_BOULDER1_DOWN_HOLE, EVENT_SEAFOAM4_BOULDER2_DOWN_HOLE @@ -2758,7 +2758,7 @@ CyclingIsFunText: ; cdff (3:4dff) LoadWildData: ; ceb8 (3:4eb8) ld hl,WildDataPointers - ld a,[W_CURMAP] + ld a,[wCurMap] ; get wild data for current map ld c,a @@ -2769,11 +2769,11 @@ LoadWildData: ; ceb8 (3:4eb8) ld h,[hl] ld l,a ; hl now points to wild data for current map ld a,[hli] - ld [W_GRASSRATE],a + ld [wGrassRate],a and a jr z,.NoGrassData ; if no grass data, skip to surfing data push hl - ld de,W_GRASSMONS ; otherwise, load grass data + ld de,wGrassMons ; otherwise, load grass data ld bc,$0014 call CopyData pop hl @@ -2781,10 +2781,10 @@ LoadWildData: ; ceb8 (3:4eb8) add hl,bc .NoGrassData ld a,[hli] - ld [W_WATERRATE],a + ld [wWaterRate],a and a ret z ; if no water data, we're done - ld de,W_WATERMONS ; otherwise, load surfing data + ld de,wWaterMons ; otherwise, load surfing data ld bc,$0014 jp CopyData @@ -2920,7 +2920,7 @@ GymLeaderFaceAndBadgeTileGraphics: ; e91b (3:691b) ReplaceTileBlock: ; ed1b (3:6d1b) call GetPredefRegisters ld hl, wOverworldMap - ld a, [W_CURMAPWIDTH] + ld a, [wCurMapWidth] add $6 ld e, a ld d, $0 @@ -2962,7 +2962,7 @@ ReplaceTileBlock: ; ed1b (3:6d1b) ret c ; return if the replaced tile block is above the map view in memory RedrawMapView: ; ed59 (3:6d59) - ld a, [W_ISINBATTLE] + ld a, [wIsInBattle] inc a ret z ld a, [H_AUTOBGTRANSFERENABLED] @@ -3043,16 +3043,16 @@ CompareHLWithBC: ; edcb (3:6dcb) INCLUDE "engine/overworld/cut.asm" MarkTownVisitedAndLoadMissableObjects: ; ef93 (3:6f93) - ld a, [W_CURMAP] + ld a, [wCurMap] cp ROUTE_1 jr nc, .notInTown ld c, a ld b, FLAG_SET - ld hl, W_TOWNVISITEDFLAG ; mark town as visited (for flying) + ld hl, wTownVisitedFlag ; mark town as visited (for flying) predef FlagActionPredef .notInTown ld hl, MapHSPointers - ld a, [W_CURMAP] + ld a, [wCurMap] ld b, $0 ld c, a add hl, bc @@ -3082,11 +3082,11 @@ MarkTownVisitedAndLoadMissableObjects: ; ef93 (3:6f93) ld [H_DIVISOR], a ld b, $2 call Divide ; divide difference by 3, resulting in the global offset (number of missable items before ours) - ld a, [W_CURMAP] + ld a, [wCurMap] ld b, a ld a, [H_DIVIDEND+3] ld c, a ; store global offset in c - ld de, W_MISSABLEOBJECTLIST + ld de, wMissableObjectList pop hl .writeMissableObjectsListLoop ld a, [hli] @@ -3109,8 +3109,8 @@ MarkTownVisitedAndLoadMissableObjects: ; ef93 (3:6f93) ret InitializeMissableObjectsFlags: ; eff1 (3:6ff1) - ld hl, W_MISSABLEOBJECTFLAGS - ld bc, wMissableObjectFlagsEnd - W_MISSABLEOBJECTFLAGS + ld hl, wMissableObjectFlags + ld bc, wMissableObjectFlagsEnd - wMissableObjectFlags xor a call FillMemory ; clear missable objects flags ld hl, MapHS00 @@ -3125,7 +3125,7 @@ InitializeMissableObjectsFlags: ; eff1 (3:6ff1) ld a, [hl] cp Hide jr nz, .skip - ld hl, W_MISSABLEOBJECTFLAGS + ld hl, wMissableObjectFlags ld a, [wMissableObjectCounter] ld c, a ld b, FLAG_SET @@ -3143,7 +3143,7 @@ IsObjectHidden: ; f022 (3:7022) ld a, [H_CURRENTSPRITEOFFSET] swap a ld b, a - ld hl, W_MISSABLEOBJECTLIST + ld hl, wMissableObjectList .loop ld a, [hli] cp $ff @@ -3153,7 +3153,7 @@ IsObjectHidden: ; f022 (3:7022) jr nz, .loop ld c, a ld b, FLAG_TEST - ld hl, W_MISSABLEOBJECTFLAGS + ld hl, wMissableObjectFlags call MissableObjectFlagAction ld a, c and a @@ -3168,7 +3168,7 @@ IsObjectHidden: ; f022 (3:7022) ; [wMissableObjectIndex]: index of the missable object to be added (global index) ShowObject: ; f044 (3:7044) ShowObject2: - ld hl, W_MISSABLEOBJECTFLAGS + ld hl, wMissableObjectFlags ld a, [wMissableObjectIndex] ld c, a ld b, FLAG_RESET @@ -3178,7 +3178,7 @@ ShowObject2: ; removes missable object (items, leg. pokemon, etc.) from the map ; [wMissableObjectIndex]: index of the missable object to be removed (global index) HideObject: ; f053 (3:7053) - ld hl, W_MISSABLEOBJECTFLAGS + ld hl, wMissableObjectFlags ld a, [wMissableObjectIndex] ld c, a ld b, FLAG_SET @@ -3431,7 +3431,7 @@ _AddPartyMon: ; f161 (3:7161) ld a, [wcf91] ld [wd0b5], a call GetMonHeader - ld hl, W_MONHEADER + ld hl, wMonHeader ld a, [hli] ld [de], a ; species inc de @@ -3470,7 +3470,7 @@ _AddPartyMon: ; f161 (3:7161) pop hl push hl - ld a, [W_ISINBATTLE] + ld a, [wIsInBattle] and a ; is this a wild mon caught in battle? jr nz, .copyEnemyMonData @@ -3525,7 +3525,7 @@ _AddPartyMon: ; f161 (3:7161) ld [de], a inc de .copyMonTypesAndMoves - ld hl, W_MONHTYPES + ld hl, wMonHTypes ld a, [hli] ; type 1 ld [de], a inc de @@ -3539,7 +3539,7 @@ _AddPartyMon: ; f161 (3:7161) ld a, $60 ; twistedspoon in gen 2 ld [de], a .skipGivingTwistedSpoon - ld hl, W_MONHMOVES + ld hl, wMonHMoves ld a, [hli] inc de push de @@ -3568,7 +3568,7 @@ _AddPartyMon: ; f161 (3:7161) inc de ld [de], a push de - ld a, [W_CURENEMYLVL] + ld a, [wCurEnemyLVL] ld d, a callab CalcExperience pop de @@ -3593,10 +3593,10 @@ _AddPartyMon: ; f161 (3:7161) pop hl call AddPartyMon_WriteMovePP inc de - ld a, [W_CURENEMYLVL] + ld a, [wCurEnemyLVL] ld [de], a inc de - ld a, [W_ISINBATTLE] + ld a, [wIsInBattle] dec a jr nz, .calcFreshStats ld hl, wEnemyMonMaxHP @@ -3794,7 +3794,7 @@ _MoveMon: ; f3a4 (3:73a4) .asm_f439 ld a, [wMoveMonType] cp PARTY_TO_DAYCARE - ld de, W_DAYCAREMONOT + ld de, wDayCareMonOT jr z, .asm_f459 dec a ld hl, wPartyMonOT @@ -3812,7 +3812,7 @@ _MoveMon: ; f3a4 (3:73a4) ld a, [wMoveMonType] and a jr z, .asm_f46c - ld hl, W_DAYCAREMONOT + ld hl, wDayCareMonOT cp DAYCARE_TO_PARTY jr z, .asm_f472 ld hl, wPartyMonOT @@ -3824,7 +3824,7 @@ _MoveMon: ; f3a4 (3:73a4) call CopyData ld a, [wMoveMonType] cp PARTY_TO_DAYCARE - ld de, W_DAYCAREMONNAME + ld de, wDayCareMonName jr z, .asm_f497 dec a ld hl, wPartyMonNicks @@ -3842,7 +3842,7 @@ _MoveMon: ; f3a4 (3:73a4) ld a, [wMoveMonType] and a jr z, .asm_f4aa - ld hl, W_DAYCAREMONNAME + ld hl, wDayCareMonName cp DAYCARE_TO_PARTY jr z, .asm_f4b0 ld hl, wPartyMonNicks @@ -3865,7 +3865,7 @@ _MoveMon: ; f3a4 (3:73a4) call LoadMonData callba CalcLevelFromExperience ld a, d - ld [W_CURENEMYLVL], a + ld [wCurEnemyLVL], a pop hl ld bc, wBoxMon2 - wBoxMon1 add hl, bc @@ -1,3 +1,3 @@ -sed -i 's/\<foo\>/bar/' $(git grep -l foo) -# foo: phrase to find -# bar: phrase to replace foo
\ No newline at end of file +sed -i 's/\<'$1'\>/'$2'/' $(git grep -l $1) +# $1: phrase to find +# $2: phrase to replace $1
\ No newline at end of file diff --git a/scripts/agatha.asm b/scripts/agatha.asm index 1e34c99c..39db37d5 100755 --- a/scripts/agatha.asm +++ b/scripts/agatha.asm @@ -105,7 +105,7 @@ AgathaScript3: ; 764da (1d:64da) AgathaScript2: ; 764ed (1d:64ed) call EndTrainerBattle - ld a, [W_ISINBATTLE] + ld a, [wIsInBattle] cp $ff jp z, AgathaScript_76464 ld a, $1 diff --git a/scripts/bruno.asm b/scripts/bruno.asm index bdfd7e24..5318ecba 100755 --- a/scripts/bruno.asm +++ b/scripts/bruno.asm @@ -105,7 +105,7 @@ BrunoScript3: ; 76383 (1d:6383) BrunoScript2: ; 76396 (1d:6396) call EndTrainerBattle - ld a, [W_ISINBATTLE] + ld a, [wIsInBattle] cp $ff jp z, BrunoScript_7630d ld a, $1 diff --git a/scripts/celadongamecorner.asm b/scripts/celadongamecorner.asm index 787a2f3d..c3872bab 100755 --- a/scripts/celadongamecorner.asm +++ b/scripts/celadongamecorner.asm @@ -51,7 +51,7 @@ CeladonGameCornerScript0: ; 48c18 (12:4c18) ret CeladonGameCornerScript1: ; 48c19 (12:4c19) - ld a, [W_ISINBATTLE] + ld a, [wIsInBattle] cp $ff jp z, CeladonGameCornerScript_48c07 ld a, $f0 @@ -63,13 +63,13 @@ CeladonGameCornerScript1: ; 48c19 (12:4c19) ld [H_SPRITEINDEX], a call SetSpriteMovementBytesToFF ld de, MovementData_48c5a - ld a, [W_YCOORD] + ld a, [wYCoord] cp $6 jr nz, .asm_48c43 ld de, MovementData_48c63 jr .asm_48c4d .asm_48c43 - ld a, [W_XCOORD] + ld a, [wXCoord] cp $8 jr nz, .asm_48c4d ld de, MovementData_48c63 diff --git a/scripts/celadongym.asm b/scripts/celadongym.asm index 459ba4b5..6588b25e 100755 --- a/scripts/celadongym.asm +++ b/scripts/celadongym.asm @@ -36,7 +36,7 @@ CeladonGymScriptPointers: ; 4894e (12:494e) dw CeladonGymScript3 CeladonGymScript3: ; 48956 (12:4956) - ld a, [W_ISINBATTLE] + ld a, [wIsInBattle] cp $ff jp z, CeladonGymText_48943 ld a, $f0 @@ -176,7 +176,7 @@ CeladonGymText1: ; 48a11 (12:4a11) call EngageMapTrainer call InitBattleEnemyParameters ld a, $4 - ld [W_GYMLEADERNO], a + ld [wGymLeaderNo], a ld a, $3 ld [W_CELADONGYMCURSCRIPT], a ld [W_CURMAPSCRIPT], a diff --git a/scripts/ceruleancity.asm b/scripts/ceruleancity.asm index e0444a1c..58c67e9d 100755 --- a/scripts/ceruleancity.asm +++ b/scripts/ceruleancity.asm @@ -20,7 +20,7 @@ CeruleanCityScriptPointers: ; 1949d (6:549d) dw CeruleanCityScript4 CeruleanCityScript4: ; 194a7 (6:54a7) - ld a, [W_ISINBATTLE] + ld a, [wIsInBattle] cp $ff jp z, CeruleanCityScript_1948c ld a, $f0 @@ -75,7 +75,7 @@ CeruleanCityScript0: ; 194c8 (6:54c8) ld [hJoyHeld], a ld a, $f0 ld [wJoyIgnore], a - ld a, [W_XCOORD] + ld a, [wXCoord] cp $14 jr z, .asm_19535 ld a, $1 @@ -135,7 +135,7 @@ CeruleanCityScript1: ; 19567 (6:5567) ld de, CeruleanCityText_19672 call SaveEndBattleTextPointers ld a, OPP_SONY1 - ld [W_CUROPPONENT], a + ld [wCurOpponent], a ; select which team to use during the encounter ld a, [W_RIVALSTARTER] @@ -161,7 +161,7 @@ CeruleanCityScript1: ; 19567 (6:5567) ret CeruleanCityScript2: ; 195b1 (6:55b1) - ld a, [W_ISINBATTLE] + ld a, [wIsInBattle] cp $ff jp z, CeruleanCityScript_1948c call CeruleanCityScript_1955d @@ -178,7 +178,7 @@ CeruleanCityScript2: ; 195b1 (6:55b1) ld a, $1 ld [H_SPRITEINDEX], a call SetSpriteMovementBytesToFF - ld a, [W_XCOORD] + ld a, [wXCoord] cp $14 jr nz, .asm_195f0 ld de, CeruleanCityMovement4 diff --git a/scripts/ceruleangym.asm b/scripts/ceruleangym.asm index 0507a1d4..fe0faea0 100755 --- a/scripts/ceruleangym.asm +++ b/scripts/ceruleangym.asm @@ -36,7 +36,7 @@ CeruleanGymScriptPointers: ; 5c6f8 (17:46f8) dw CeruleanGymScript3 CeruleanGymScript3: ; 5c700 (17:4700) - ld a, [W_ISINBATTLE] + ld a, [wIsInBattle] cp $ff jp z, CeruleanGymScript_5c6ed ld a, $f0 @@ -127,7 +127,7 @@ CeruleanGymText1: ; 5c771 (17:4771) call EngageMapTrainer call InitBattleEnemyParameters ld a, $2 - ld [W_GYMLEADERNO], a + ld [wGymLeaderNo], a xor a ld [hJoyHeld], a ld a, $3 diff --git a/scripts/cinnabargym.asm b/scripts/cinnabargym.asm index 73aad423..649609b3 100755 --- a/scripts/cinnabargym.asm +++ b/scripts/cinnabargym.asm @@ -92,7 +92,7 @@ CinnabarGymFlagAction: ; 757f1 (1d:57f1) predef_jump FlagActionPredef CinnabarGymScript2: ; 757f6 (1d:57f6) - ld a, [W_ISINBATTLE] + ld a, [wIsInBattle] cp $ff jp z, CinnabarGymScript_75792 ld a, [wTrainerHeaderFlagBit] @@ -134,7 +134,7 @@ CinnabarGymScript2: ; 757f6 (1d:57f6) ret CinnabarGymScript3: ; 7584a (1d:584a) - ld a, [W_ISINBATTLE] + ld a, [wIsInBattle] cp $ff jp z, CinnabarGymScript_75792 ld a, $f0 @@ -224,7 +224,7 @@ CinnabarGymText1: ; 758df (1d:58df) ld de, BlaineEndBattleText call SaveEndBattleTextPointers ld a, $7 - ld [W_GYMLEADERNO], a + ld [wGymLeaderNo], a jp CinnabarGymScript_758b7 BlaineBattleText: ; 75914 (1d:5914) diff --git a/scripts/cinnabarisland.asm b/scripts/cinnabarisland.asm index c06c784c..48ded740 100755 --- a/scripts/cinnabarisland.asm +++ b/scripts/cinnabarisland.asm @@ -16,10 +16,10 @@ CinnabarIslandScript0: ; 1ca38 (7:4a38) ld b, SECRET_KEY call IsItemInBag ret nz - ld a, [W_YCOORD] + ld a, [wYCoord] cp $4 ret nz - ld a, [W_XCOORD] + ld a, [wXCoord] cp $12 ret nz ld a, PLAYER_DIR_UP diff --git a/scripts/daycarem.asm b/scripts/daycarem.asm index 3eabb0bc..4a46e648 100755 --- a/scripts/daycarem.asm +++ b/scripts/daycarem.asm @@ -7,7 +7,7 @@ DayCareMTextPointers: ; 56252 (15:6252) DayCareMText1: ; 56254 (15:6254) TX_ASM call SaveScreenTilesToBuffer2 - ld a, [W_DAYCARE_IN_USE] + ld a, [wDayCareInUse] and a jp nz, .daycareInUse ld hl, DayCareIntroText @@ -46,7 +46,7 @@ DayCareMText1: ; 56254 (15:6254) ld hl, DayCareWillLookAfterMonText call PrintText ld a, 1 - ld [W_DAYCARE_IN_USE], a + ld [wDayCareInUse], a ld a, PARTY_TO_DAYCARE ld [wMoveMonType], a call MoveMon @@ -60,7 +60,7 @@ DayCareMText1: ; 56254 (15:6254) .daycareInUse xor a - ld hl, W_DAYCAREMONNAME + ld hl, wDayCareMonName call GetPartyMonName ld a, DAYCARE_DATA ld [wMonDataLocation], a @@ -150,7 +150,7 @@ DayCareMText1: ; 56254 (15:6254) .enoughMoney xor a - ld [W_DAYCARE_IN_USE], a + ld [wDayCareInUse], a ld hl, wDayCareNumLevelsGrown ld [hli], a inc hl diff --git a/scripts/fightingdojo.asm b/scripts/fightingdojo.asm index fa05d486..101701b1 100755 --- a/scripts/fightingdojo.asm +++ b/scripts/fightingdojo.asm @@ -32,10 +32,10 @@ FightingDojoScript1: ; 5cd83 (17:4d83) xor a ld [hJoyHeld], a ld [wcf0d], a - ld a, [W_YCOORD] + ld a, [wYCoord] cp $3 ret nz - ld a, [W_XCOORD] + ld a, [wXCoord] cp $4 ret nz ld a, $1 @@ -53,7 +53,7 @@ FightingDojoScript1: ; 5cd83 (17:4d83) ret FightingDojoScript3: ; 5cdc6 (17:4dc6) - ld a, [W_ISINBATTLE] + ld a, [wIsInBattle] cp $ff jp z, FightingDojoScript_5cd70 ld a, [wcf0d] diff --git a/scripts/fuchsiagym.asm b/scripts/fuchsiagym.asm index e10f534e..70f9fff0 100755 --- a/scripts/fuchsiagym.asm +++ b/scripts/fuchsiagym.asm @@ -37,7 +37,7 @@ FuchsiaGymScriptPointers: ; 75482 (1d:5482) dw FuchsiaGymScript3 FuchsiaGymScript3: ; 7548a (1d:548a) - ld a, [W_ISINBATTLE] + ld a, [wIsInBattle] cp $ff jp z, FuchsiaGymScript_75477 ld a, $f0 @@ -167,7 +167,7 @@ FuchsiaGymText1: ; 75534 (1d:5534) call EngageMapTrainer call InitBattleEnemyParameters ld a, $5 - ld [W_GYMLEADERNO], a + ld [wGymLeaderNo], a xor a ld [hJoyHeld], a ld a, $3 diff --git a/scripts/gary.asm b/scripts/gary.asm index 3215a04f..197ed93b 100755 --- a/scripts/gary.asm +++ b/scripts/gary.asm @@ -52,7 +52,7 @@ GaryScript2: ; 75f6a (1d:5f6a) call Delay3 xor a ld [wJoyIgnore], a - ld hl, W_OPTIONS + ld hl, wOptions res 7, [hl] ld a, $1 ld [hSpriteIndexOrTextID], a @@ -65,7 +65,7 @@ GaryScript2: ; 75f6a (1d:5f6a) ld de, GaryText_760fe call SaveEndBattleTextPointers ld a, OPP_SONY3 - ld [W_CUROPPONENT], a + ld [wCurOpponent], a ; select which team to use during the encounter ld a, [W_RIVALSTARTER] @@ -90,7 +90,7 @@ GaryScript2: ; 75f6a (1d:5f6a) ret GaryScript3: ; 75fbb (1d:5fbb) - ld a, [W_ISINBATTLE] + ld a, [wIsInBattle] cp $ff jp z, GaryScript_75f29 call UpdateSprites diff --git a/scripts/lance.asm b/scripts/lance.asm index e2c43614..4d9d393c 100755 --- a/scripts/lance.asm +++ b/scripts/lance.asm @@ -85,7 +85,7 @@ CoordsData_5a33e: ; 5a33e (16:633e) LanceScript2: ; 5a349 (16:6349) call EndTrainerBattle - ld a, [W_ISINBATTLE] + ld a, [wIsInBattle] cp $ff jp z, LanceScript_5a2f5 ld a, $1 diff --git a/scripts/lorelei.asm b/scripts/lorelei.asm index 43eee966..d50fc1dc 100755 --- a/scripts/lorelei.asm +++ b/scripts/lorelei.asm @@ -105,7 +105,7 @@ LoreleiScript3: ; 7622c (1d:622c) ret LoreleiScript2: ; 7623f (1d:623f) call EndTrainerBattle - ld a, [W_ISINBATTLE] + ld a, [wIsInBattle] cp $ff jp z, LoreleiScript_761b6 ld a, $1 diff --git a/scripts/mtmoon3.asm b/scripts/mtmoon3.asm index 84c00981..b3a994e2 100755 --- a/scripts/mtmoon3.asm +++ b/scripts/mtmoon3.asm @@ -55,10 +55,10 @@ MtMoon3ScriptPointers: ; 49d63 (12:5d63) MtMoon3Script0: ; 49d6f (12:5d6f) CheckEvent EVENT_BEAT_MT_MOON_EXIT_SUPER_NERD jp nz, MtMoon3Script_49d91 - ld a, [W_YCOORD] + ld a, [wYCoord] cp $8 jp nz, MtMoon3Script_49d91 - ld a, [W_XCOORD] + ld a, [wXCoord] cp $d jp nz, MtMoon3Script_49d91 xor a @@ -73,7 +73,7 @@ MtMoon3Script_49d91: ; 49d91 (12:5d91) ret MtMoon3Script3: ; 49d9a (12:5d9a) - ld a, [W_ISINBATTLE] + ld a, [wIsInBattle] cp $ff jp z, MtMoon3Script_49d58 call UpdateSprites diff --git a/scripts/museum1f.asm b/scripts/museum1f.asm index ac552c6d..75dc1ce8 100755 --- a/scripts/museum1f.asm +++ b/scripts/museum1f.asm @@ -12,13 +12,13 @@ Museum1FScriptPointers: ; 5c109 (17:4109) dw Museum1FScript1 Museum1FScript0: ; 5c10d (17:410d) - ld a, [W_YCOORD] + ld a, [wYCoord] cp $4 ret nz - ld a, [W_XCOORD] + ld a, [wXCoord] cp $9 jr z, .asm_5c120 - ld a, [W_XCOORD] + ld a, [wXCoord] cp $a ret nz .asm_5c120 @@ -40,17 +40,17 @@ Museum1FTextPointers: ; 5c12b (17:412b) Museum1FText1: ; 5c135 (17:4135) TX_ASM - ld a, [W_YCOORD] + ld a, [wYCoord] cp $4 jr nz, .asm_8774b - ld a, [W_XCOORD] + ld a, [wXCoord] cp $d jp z, Museum1FScript_5c1f9 jr .asm_b8709 .asm_8774b cp $3 jr nz, .asm_d49e7 - ld a, [W_XCOORD] + ld a, [wXCoord] cp $c jp z, Museum1FScript_5c1f9 .asm_d49e7 diff --git a/scripts/oakslab.asm b/scripts/oakslab.asm index c5ca2e6e..d6494078 100755 --- a/scripts/oakslab.asm +++ b/scripts/oakslab.asm @@ -151,7 +151,7 @@ OaksLabScript5: ; 1cbfd (7:4bfd) ret OaksLabScript6: ; 1cc36 (7:4c36) - ld a, [W_YCOORD] + ld a, [wYCoord] cp $6 ret nz ld a, $5 @@ -199,7 +199,7 @@ OaksLabScript8: ; 1cc80 (7:4c80) jr .Bulbasaur .Charmander ld de, .MiddleBallMovement1 - ld a, [W_YCOORD] + ld a, [wYCoord] cp $4 ; is the player standing below the table? jr z, .asm_1ccf3 ld de, .MiddleBallMovement2 @@ -223,7 +223,7 @@ OaksLabScript8: ; 1cc80 (7:4c80) .Squirtle ld de, .RightBallMovement1 - ld a, [W_YCOORD] + ld a, [wYCoord] cp $4 ; is the player standing below the table? jr z, .asm_1ccf3 ld de, .RightBallMovement2 @@ -249,7 +249,7 @@ OaksLabScript8: ; 1cc80 (7:4c80) .Bulbasaur ld de, .LeftBallMovement1 - ld a, [W_XCOORD] + ld a, [wXCoord] cp $9 ; is the player standing to the right of the table? jr nz, .asm_1ccf3 push hl @@ -340,7 +340,7 @@ OaksLabScript9: ; 1cd00 (7:4d00) ret OaksLabScript10: ; 1cd6d (7:4d6d) - ld a, [W_YCOORD] + ld a, [wYCoord] cp $6 ret nz ld a, $1 @@ -382,7 +382,7 @@ OaksLabScript11: ; 1cdb9 (7:4db9) ; define which team rival uses, and fight it ld a, OPP_SONY1 - ld [W_CUROPPONENT], a + ld [wCurOpponent], a ld a, [W_RIVALSTARTER] cp STARTER2 jr nz, .NotSquirtle @@ -446,7 +446,7 @@ OaksLabScript13: ; 1ce32 (7:4e32) ld [H_SPRITEINDEX], a ld de, .RivalExitMovement call MoveSprite - ld a, [W_XCOORD] + ld a, [wXCoord] cp $4 ; move left or right depending on where the player is standing jr nz, .moveLeft @@ -488,7 +488,7 @@ OaksLabScript14: ; 1ce6d (7:4e6d) ld a, [wNPCNumScriptedSteps] cp $5 jr nz, .asm_1cea8 - ld a, [W_XCOORD] + ld a, [wXCoord] cp $4 jr nz, .asm_1cea1 ld a, SPRITE_FACING_RIGHT @@ -675,7 +675,7 @@ OaksLabScript_1d02b: ; 1d02b (7:502b) ld [$ffeb], a ld a, $8 ld [$ffee], a - ld a, [W_YCOORD] + ld a, [wYCoord] cp $3 jr nz, .asm_1d045 ld a, $4 @@ -695,7 +695,7 @@ OaksLabScript_1d02b: ; 1d02b (7:502b) ld a, $3 ld [wNPCMovementDirections2Index], a ld b, $a - ld a, [W_XCOORD] + ld a, [wXCoord] cp $4 jr nz, .asm_1d066 ld a, $40 @@ -925,7 +925,7 @@ OaksLabMonChoiceMenu: ; 1d1b3 (7:51b3) xor a ; PLAYER_PARTY_DATA ld [wMonDataLocation], a ld a, 5 - ld [W_CURENEMYLVL], a + ld [wCurEnemyLVL], a ld a, [wcf91] ld [wd11e], a call AddPartyMon diff --git a/scripts/pallettown.asm b/scripts/pallettown.asm index e4c3f135..106d8ec0 100755 --- a/scripts/pallettown.asm +++ b/scripts/pallettown.asm @@ -20,7 +20,7 @@ PalletTownScriptPointers: ; 18e73 (6:4e73) PalletTownScript0: ; 18e81 (6:4e81) CheckEvent EVENT_FOLLOWED_OAK_INTO_LAB ret nz - ld a,[W_YCOORD] + ld a,[wYCoord] cp 1 ; is player near north exit? ret nz xor a @@ -67,7 +67,7 @@ PalletTownScript2: ; 18ed2 (6:4ed2) call SetSpriteFacingDirectionAndDelay call Delay3 ld a,1 - ld [W_YCOORD],a + ld [wYCoord],a ld a,1 ld [hNPCPlayerRelativePosPerspective],a ld a,1 diff --git a/scripts/pewtergym.asm b/scripts/pewtergym.asm index 608fa4cd..1e6e5476 100755 --- a/scripts/pewtergym.asm +++ b/scripts/pewtergym.asm @@ -36,7 +36,7 @@ PewterGymScriptPointers: ; 5c3ca (17:43ca) dw PewterGymScript3 PewterGymScript3: ; 5c3d2 (17:43d2) - ld a, [W_ISINBATTLE] + ld a, [wIsInBattle] cp $ff jp z, PewterGymScript_5c3bf ld a, $f0 @@ -126,7 +126,7 @@ PewterGymText1: ; 5c44e (17:444e) call EngageMapTrainer call InitBattleEnemyParameters ld a, $1 - ld [W_GYMLEADERNO], a + ld [wGymLeaderNo], a xor a ld [hJoyHeld], a ld a, $3 diff --git a/scripts/pokemontower2.asm b/scripts/pokemontower2.asm index bee2b3b2..078c0147 100755 --- a/scripts/pokemontower2.asm +++ b/scripts/pokemontower2.asm @@ -59,7 +59,7 @@ CoordsData_6055e: ; 6055e (18:455e) db $0F ; isn't this supposed to end in $ff? PokemonTower2Script1: ; 60563 (18:4563) - ld a, [W_ISINBATTLE] + ld a, [wIsInBattle] cp $ff jp z, PokemonTower2Script_604fe ld a, $f0 @@ -143,7 +143,7 @@ PokemonTower2Text1: ; 605df (18:45df) ld de, PokemonTower2Text_60637 call SaveEndBattleTextPointers ld a, OPP_SONY2 - ld [W_CUROPPONENT], a + ld [wCurOpponent], a ; select which team to use during the encounter ld a, [W_RIVALSTARTER] diff --git a/scripts/pokemontower6.asm b/scripts/pokemontower6.asm index 37ca1b33..1c3b1050 100755 --- a/scripts/pokemontower6.asm +++ b/scripts/pokemontower6.asm @@ -33,9 +33,9 @@ PokemonTower6Script0: ; 60b17 (18:4b17) ld [hSpriteIndexOrTextID], a call DisplayTextID ld a, MAROWAK - ld [W_CUROPPONENT], a + ld [wCurOpponent], a ld a, 30 - ld [W_CURENEMYLVL], a + ld [wCurEnemyLVL], a ld a, $4 ld [W_POKEMONTOWER6CURSCRIPT], a ld [W_CURMAPSCRIPT], a @@ -45,7 +45,7 @@ CoordsData_60b45: ; 60b45 (18:4b45) db $10,$0A,$FF PokemonTower6Script4: ; 60b48 (18:4b48) - ld a, [W_ISINBATTLE] + ld a, [wIsInBattle] cp $ff jp z, PokemonTower6Script_60b02 ld a, $ff diff --git a/scripts/pokemontower7.asm b/scripts/pokemontower7.asm index a4635aa3..eb6d62e4 100755 --- a/scripts/pokemontower7.asm +++ b/scripts/pokemontower7.asm @@ -24,7 +24,7 @@ PokemonTower7ScriptPointers: PokemonTower7Script2: ; 60d23 (18:4d23) ld hl, wFlags_0xcd60 res 0, [hl] - ld a, [W_ISINBATTLE] + ld a, [wIsInBattle] cp $ff jp z, PokemonTower7Script_60d18 call EndTrainerBattle @@ -43,7 +43,7 @@ PokemonTower7Script3: ; 60d56 (18:4d56) ld a, [wd730] bit 0, a ret nz - ld hl, W_MISSABLEOBJECTLIST + ld hl, wMissableObjectList ld a, [wSpriteIndex] ld b, a .missableObjectsListLoop @@ -92,9 +92,9 @@ PokemonTower7Script_60db6: ; 60db6 (18:4db6) ld d, $0 ld e, a add hl, de - ld a, [W_YCOORD] + ld a, [wYCoord] ld b, a - ld a, [W_XCOORD] + ld a, [wXCoord] ld c, a .asm_60dcb ld a, [hli] diff --git a/scripts/rockethideout2.asm b/scripts/rockethideout2.asm index ec4a536e..0b45967f 100755 --- a/scripts/rockethideout2.asm +++ b/scripts/rockethideout2.asm @@ -14,9 +14,9 @@ RocketHideout2ScriptPointers: ; 44e3a (11:4e3a) dw RocketHideout2Script3 RocketHideout2Script0: ; 44e42 (11:4e42) - ld a, [W_YCOORD] + ld a, [wYCoord] ld b, a - ld a, [W_XCOORD] + ld a, [wXCoord] ld c, a ld hl, RocketHideout2ArrowTilePlayerMovement call DecodeArrowMovementRLE diff --git a/scripts/rockethideout3.asm b/scripts/rockethideout3.asm index 1f6d5b41..4cdacea3 100755 --- a/scripts/rockethideout3.asm +++ b/scripts/rockethideout3.asm @@ -14,9 +14,9 @@ RocketHideout3ScriptPointers: ; 45238 (11:5238) dw RocketHideout3Script3 RocketHideout3Script0: ; 45240 (11:5240) - ld a, [W_YCOORD] + ld a, [wYCoord] ld b, a - ld a, [W_XCOORD] + ld a, [wXCoord] ld c, a ld hl, RocketHideout3ArrowTilePlayerMovement call DecodeArrowMovementRLE diff --git a/scripts/rockethideout4.asm b/scripts/rockethideout4.asm index a71e444c..815f6090 100755 --- a/scripts/rockethideout4.asm +++ b/scripts/rockethideout4.asm @@ -44,7 +44,7 @@ RocketHideout4ScriptPointers: ; 454ae (11:54ae)c dw RocketHideout4Script3 RocketHideout4Script3: ; 454b6 (11:54b6) - ld a, [W_ISINBATTLE] + ld a, [wIsInBattle] cp $ff jp z, RocketHideout4Script_454a3 call UpdateSprites diff --git a/scripts/route12.asm b/scripts/route12.asm index 4057ce03..01a5e93c 100755 --- a/scripts/route12.asm +++ b/scripts/route12.asm @@ -30,9 +30,9 @@ Route12Script0: ; 59619 (16:5619) ld [hSpriteIndexOrTextID], a call DisplayTextID ld a, SNORLAX - ld [W_CUROPPONENT], a + ld [wCurOpponent], a ld a, 30 - ld [W_CURENEMYLVL], a + ld [wCurEnemyLVL], a ld a, HS_ROUTE_12_SNORLAX ld [wMissableObjectIndex], a predef HideObject @@ -42,7 +42,7 @@ Route12Script0: ; 59619 (16:5619) ret Route12Script3: ; 5964c (16:564c) - ld a, [W_ISINBATTLE] + ld a, [wIsInBattle] cp $ff jr z, Route12Script_59606 call UpdateSprites diff --git a/scripts/route16.asm b/scripts/route16.asm index c762c999..760beb01 100755 --- a/scripts/route16.asm +++ b/scripts/route16.asm @@ -30,9 +30,9 @@ Route16Script0: ; 59959 (16:5959) ld [hSpriteIndexOrTextID], a call DisplayTextID ld a, SNORLAX - ld [W_CUROPPONENT], a + ld [wCurOpponent], a ld a, 30 - ld [W_CURENEMYLVL], a + ld [wCurEnemyLVL], a ld a, HS_ROUTE_16_SNORLAX ld [wMissableObjectIndex], a predef HideObject @@ -43,7 +43,7 @@ Route16Script0: ; 59959 (16:5959) ret Route16Script3: ; 5998f (16:598f) - ld a, [W_ISINBATTLE] + ld a, [wIsInBattle] cp $ff jp z, Route16Script_59946 call UpdateSprites diff --git a/scripts/route22.asm b/scripts/route22.asm index 1244f0ff..ff506793 100755 --- a/scripts/route22.asm +++ b/scripts/route22.asm @@ -132,7 +132,7 @@ Route22Script1: ; 50f62 (14:4f62) ld de, Route22Text_511bc call SaveEndBattleTextPointers ld a, OPP_SONY1 - ld [W_CUROPPONENT], a + ld [wCurOpponent], a ld hl, StarterMons_50faf call Route22Script_50ed6 ld a, $2 @@ -146,7 +146,7 @@ StarterMons_50faf: ; 50faf (14:4faf) db STARTER1,$06 Route22Script2: ; 50fb5 (14:4fb5) - ld a, [W_ISINBATTLE] + ld a, [wIsInBattle] cp $ff jp z, Route22Script_50ece ld a, [wSpriteStateData1 + 9] @@ -288,7 +288,7 @@ Route22Script4: ; 51087 (14:5087) ld de, Route22Text_511d0 call SaveEndBattleTextPointers ld a, OPP_SONY2 - ld [W_CUROPPONENT], a + ld [wCurOpponent], a ld hl, StarterMons_510d9 call Route22Script_50ed6 ld a, $5 @@ -301,7 +301,7 @@ StarterMons_510d9: ; 510d9 (14:50d9) db STARTER1,$0c Route22Script5: ; 510df (14:50df) - ld a, [W_ISINBATTLE] + ld a, [wIsInBattle] cp $ff jp z, Route22Script_50ece ld a, $2 diff --git a/scripts/route22gate.asm b/scripts/route22gate.asm index e17380f5..f0b5b92d 100755 --- a/scripts/route22gate.asm +++ b/scripts/route22gate.asm @@ -3,7 +3,7 @@ Route22GateScript: ; 1e683 (7:6683) ld hl, Route22GateScriptPointers ld a, [W_ROUTE22GATECURSCRIPT] call CallFunctionInTable - ld a, [W_YCOORD] + ld a, [wYCoord] cp $4 ld a, ROUTE_23 jr c, .asm_1e69a diff --git a/scripts/route23.asm b/scripts/route23.asm index 6462ec88..6fc0eef1 100755 --- a/scripts/route23.asm +++ b/scripts/route23.asm @@ -26,7 +26,7 @@ Route23ScriptPointers: ; 51213 (14:5213) Route23Script0: ; 51219 (14:5219) ld hl, YCoordsData_51255 - ld a, [W_YCOORD] + ld a, [wYCoord] ld b, a ld e, $0 EventFlagBit c, EVENT_PASSED_EARTHBADGE_CHECK + 1, EVENT_PASSED_CASCADEBADGE_CHECK @@ -40,7 +40,7 @@ Route23Script0: ; 51219 (14:5219) jr nz, .asm_51224 cp $23 jr nz, .asm_51237 - ld a, [W_XCOORD] + ld a, [wXCoord] cp $e ret nc .asm_51237 diff --git a/scripts/route24.asm b/scripts/route24.asm index 6eba1d35..61df4377 100755 --- a/scripts/route24.asm +++ b/scripts/route24.asm @@ -58,7 +58,7 @@ Route24Script4: ; 51411 (14:5411) ret Route24Script3: ; 51422 (14:5422) - ld a, [W_ISINBATTLE] + ld a, [wIsInBattle] cp $ff jp z, Route24Script_513c0 call UpdateSprites diff --git a/scripts/safarizoneentrance-yellow.asm b/scripts/safarizoneentrance-yellow.asm index 4a37f0e6..ac51c2d5 100644 --- a/scripts/safarizoneentrance-yellow.asm +++ b/scripts/safarizoneentrance-yellow.asm @@ -56,7 +56,7 @@ ld a,30 lb hl, (502 / $100), (502 % $100) .xf1ff2 - ld [W_NUMSAFARIBALLS],a + ld [wNumSafariBalls],a ld a,h ld [wSafariSteps],a ld a,l diff --git a/scripts/safarizoneentrance.asm b/scripts/safarizoneentrance.asm index e4e2e2a8..a24b790f 100755 --- a/scripts/safarizoneentrance.asm +++ b/scripts/safarizoneentrance.asm @@ -84,7 +84,7 @@ SafariZoneEntranceScriptPointers: ; 751d9 (1d:51d9) ld [hSpriteIndexOrTextID], a call DisplayTextID xor a - ld [W_NUMSAFARIBALLS], a + ld [wNumSafariBalls], a ld a, D_DOWN ld c, $3 call SafariZoneEntranceAutoWalk @@ -181,7 +181,7 @@ SafariZoneEntranceTextPointers: ; 752b9 (1d:52b9) ld hl,.MakePaymentText call PrintText ld a,30 - ld [W_NUMSAFARIBALLS],a + ld [wNumSafariBalls],a ld a,502 / $100 ld [wSafariSteps],a ld a, 502 % $100 diff --git a/scripts/saffrongym.asm b/scripts/saffrongym.asm index 567f79d8..cae60f45 100755 --- a/scripts/saffrongym.asm +++ b/scripts/saffrongym.asm @@ -36,7 +36,7 @@ SaffronGymScriptPointers: ; 5d053 (17:5053) dw SaffronGymScript3 SaffronGymScript3: ; 5d05b (17:505b) - ld a, [W_ISINBATTLE] + ld a, [wIsInBattle] cp $ff jp z, SaffronGymText_5d048 ld a, $f0 @@ -177,7 +177,7 @@ SaffronGymText1: ; 5d118 (17:5118) call EngageMapTrainer call InitBattleEnemyParameters ld a, $6 - ld [W_GYMLEADERNO], a + ld [wGymLeaderNo], a ld a, $3 ld [W_SAFFRONGYMCURSCRIPT], a .asm_5d15f diff --git a/scripts/seafoamislands4.asm b/scripts/seafoamislands4.asm index f7407e48..90d282cf 100755 --- a/scripts/seafoamislands4.asm +++ b/scripts/seafoamislands4.asm @@ -41,7 +41,7 @@ SeafoamIslands4Script: ; 4658d (11:658d) ret nz .asm_465ed ld hl, SeafoamIslands4ScriptPointers - ld a, [W_SEAFOAMISLANDS4CURSCRIPT] + ld a, [wSeafoamIslands4CurScript] jp CallFunctionInTable Seafoam4HolesCoords: ; 465f6 (11:65f6) @@ -58,10 +58,10 @@ SeafoamIslands4ScriptPointers: ; 465fb (11:65fb) SeafoamIslands4Script0: ; 46603 (11:6603) CheckBothEventsSet EVENT_SEAFOAM3_BOULDER1_DOWN_HOLE, EVENT_SEAFOAM3_BOULDER2_DOWN_HOLE ret z - ld a, [W_YCOORD] + ld a, [wYCoord] cp $8 ret nz - ld a, [W_XCOORD] + ld a, [wXCoord] cp $f ret nz ld hl, wSimulatedJoypadStatesEnd @@ -73,7 +73,7 @@ SeafoamIslands4Script0: ; 46603 (11:6603) ld hl, W_FLAGS_D733 set 2, [hl] ld a, $1 - ld [W_SEAFOAMISLANDS4CURSCRIPT], a + ld [wSeafoamIslands4CurScript], a ret RLEMovement46632: ; 46632 (11:6632) @@ -87,13 +87,13 @@ SeafoamIslands4Script1: ; 46639 (11:6639) and a ret nz ld a, $0 - ld [W_SEAFOAMISLANDS4CURSCRIPT], a + ld [wSeafoamIslands4CurScript], a ret SeafoamIslands4Script2: ; 46644 (11:6644) CheckBothEventsSet EVENT_SEAFOAM3_BOULDER1_DOWN_HOLE, EVENT_SEAFOAM3_BOULDER2_DOWN_HOLE ret z - ld a, [W_XCOORD] + ld a, [wXCoord] cp $12 jr z, .asm_4665e cp $13 @@ -116,7 +116,7 @@ SeafoamIslands4Script2: ; 46644 (11:6644) set 2, [hl] ld a, $3 .asm_4667b - ld [W_SEAFOAMISLANDS4CURSCRIPT], a + ld [wSeafoamIslands4CurScript], a ret RLEData_4667f: ; 4667f (11:667f) @@ -137,7 +137,7 @@ SeafoamIslands4Script3: ; 4668f (11:668f) and a ret nz ld a, $0 - ld [W_SEAFOAMISLANDS4CURSCRIPT], a + ld [wSeafoamIslands4CurScript], a ret SeafoamIslands4TextPointers: ; 4669a (11:669a) diff --git a/scripts/seafoamislands5.asm b/scripts/seafoamislands5.asm index 87942ca0..17ea82cb 100755 --- a/scripts/seafoamislands5.asm +++ b/scripts/seafoamislands5.asm @@ -1,12 +1,12 @@ SeafoamIslands5Script: ; 46799 (11:6799) call EnableAutoTextBoxDrawing - ld a, [W_SEAFOAMISLANDS5CURSCRIPT] + ld a, [wSeafoamIslands5CurScript] ld hl, SeafoamIslands5ScriptPointers jp CallFunctionInTable SeafoamIslands5Script_467a5: ; 467a5 (11:67a5) xor a - ld [W_SEAFOAMISLANDS5CURSCRIPT], a + ld [wSeafoamIslands5CurScript], a ld [wJoyIgnore], a ret @@ -18,12 +18,12 @@ SeafoamIslands5ScriptPointers: ; 467ad (11:67ad) dw SeafoamIslands5Script4 SeafoamIslands5Script4: ; 467b7 (11:67b7) - ld a, [W_ISINBATTLE] + ld a, [wIsInBattle] cp $ff jr z, SeafoamIslands5Script_467a5 call EndTrainerBattle ld a, $0 - ld [W_SEAFOAMISLANDS5CURSCRIPT], a + ld [wSeafoamIslands5CurScript], a ret SeafoamIslands5Script0: ; 467c7 (11:67c7) @@ -49,7 +49,7 @@ SeafoamIslands5Script0: ; 467c7 (11:67c7) ld hl, W_FLAGS_D733 res 2, [hl] ld a, $1 - ld [W_SEAFOAMISLANDS5CURSCRIPT], a + ld [wSeafoamIslands5CurScript], a ret CoordsData_467fe: ; 467fe (11:67fe) @@ -66,7 +66,7 @@ SeafoamIslands5Script1: ; 46807 (11:6807) xor a ld [wJoyIgnore], a ld a, $0 - ld [W_SEAFOAMISLANDS5CURSCRIPT], a + ld [wSeafoamIslands5CurScript], a ret SeafoamIslands5Script2: ; 46816 (11:6816) @@ -92,7 +92,7 @@ SeafoamIslands5Script2: ; 46816 (11:6816) call StartSimulatingJoypadStates ld a, $3 .asm_46849 - ld [W_SEAFOAMISLANDS5CURSCRIPT], a + ld [wSeafoamIslands5CurScript], a ret CoordsData_4684d: ; 4684d (11:684d) @@ -121,7 +121,7 @@ SeafoamIslands5Script3: ; 46860 (11:6860) and a ret nz ld a, $0 - ld [W_SEAFOAMISLANDS5CURSCRIPT], a + ld [wSeafoamIslands5CurScript], a ret SeaFoamIslands5Script_46872: ; 46872 (11:6872) @@ -154,7 +154,7 @@ SeafoamIslands5Text3: ; 46893 (11:6893) ld hl, SeafoamIslands5TrainerHeader0 call TalkToTrainer ld a, $4 - ld [W_SEAFOAMISLANDS5CURSCRIPT], a + ld [wSeafoamIslands5CurScript], a jp TextScriptEnd SeafoamIslands5BattleText2: ; 468a2 (11:68a2) diff --git a/scripts/silphco11.asm b/scripts/silphco11.asm index 4c83c20d..6cb2e7ed 100755 --- a/scripts/silphco11.asm +++ b/scripts/silphco11.asm @@ -205,7 +205,7 @@ SilphCo11Script_6221a: ; 6221a (18:621a) jp SetSpriteFacingDirectionAndDelay SilphCo11Script5: ; 62227 (18:6227) - ld a, [W_ISINBATTLE] + ld a, [wIsInBattle] cp $ff jp z, SilphCo11Script_621c4 ld a, [wcf0d] diff --git a/scripts/silphco7.asm b/scripts/silphco7.asm index 5333e07f..d535c04b 100755 --- a/scripts/silphco7.asm +++ b/scripts/silphco7.asm @@ -184,7 +184,7 @@ SilphCo7Script3: ; 51c82 (14:5c82) ld de, SilphCo7Text_51ecd call SaveEndBattleTextPointers ld a, OPP_SONY2 - ld [W_CUROPPONENT], a + ld [wCurOpponent], a ld a, [W_RIVALSTARTER] cp STARTER2 jr nz, .asm_51cb6 @@ -203,7 +203,7 @@ SilphCo7Script3: ; 51c82 (14:5c82) jp SilphCo7Text_51c10 SilphCo7Script4: ; 51cc8 (14:5cc8) - ld a, [W_ISINBATTLE] + ld a, [wIsInBattle] cp $ff jp z, SilphCo7Text_51c0c ld a, $f0 diff --git a/scripts/ssanne2.asm b/scripts/ssanne2.asm index 8bcc2b17..52b9792c 100755 --- a/scripts/ssanne2.asm +++ b/scripts/ssanne2.asm @@ -71,7 +71,7 @@ CoordsData_61411: ; 61411 (18:5411) db $FF SSAnne2Script_61416: ; 61416 (18:5416) - ld a, [W_XCOORD] + ld a, [wXCoord] cp $25 jr nz, .asm_61426 ld a, PLAYER_DIR_LEFT @@ -98,7 +98,7 @@ SSAnne2Script1: ; 61430 (18:5430) call DisplayTextID call Delay3 ld a, OPP_SONY2 - ld [W_CUROPPONENT], a + ld [wCurOpponent], a ; select which team to use during the encounter ld a, [W_RIVALSTARTER] @@ -122,7 +122,7 @@ SSAnne2Script1: ; 61430 (18:5430) ret SSAnne2Script2: ; 6146d (18:546d) - ld a, [W_ISINBATTLE] + ld a, [wIsInBattle] cp $ff jp z, SSAnne2Script_613ab call SSAnne2Script_61416 @@ -134,7 +134,7 @@ SSAnne2Script2: ; 6146d (18:546d) ld a, $2 ld [H_SPRITEINDEX], a call SetSpriteMovementBytesToFF - ld a, [W_XCOORD] + ld a, [wXCoord] cp $25 jr nz, .asm_61497 ld de, MovementData_614b9 diff --git a/scripts/vermiliongym.asm b/scripts/vermiliongym.asm index 6dae0751..d672a419 100755 --- a/scripts/vermiliongym.asm +++ b/scripts/vermiliongym.asm @@ -55,7 +55,7 @@ VermilionGymScriptPointers: ; 5ca95 (17:4a95) dw VermilionGymScript3 VermilionGymScript3: ; 5ca9d (17:4a9d) - ld a, [W_ISINBATTLE] + ld a, [wIsInBattle] cp $ff jp z, VermilionGymScript_5ca8a ld a, $f0 @@ -156,7 +156,7 @@ VermilionGymText1: ; 5cb1d (17:4b1d) call EngageMapTrainer call InitBattleEnemyParameters ld a, $3 - ld [W_GYMLEADERNO], a + ld [wGymLeaderNo], a xor a ld [hJoyHeld], a ld a, $3 diff --git a/scripts/viridiancity.asm b/scripts/viridiancity.asm index be7872e6..a660898b 100755 --- a/scripts/viridiancity.asm +++ b/scripts/viridiancity.asm @@ -23,10 +23,10 @@ ViridianCityScript_1900b: ; 1900b (6:500b) SetEvent EVENT_VIRIDIAN_GYM_OPEN ret .asm_1901e - ld a, [W_YCOORD] + ld a, [wYCoord] cp $8 ret nz - ld a, [W_XCOORD] + ld a, [wXCoord] cp $20 ret nz ld a, $e @@ -42,10 +42,10 @@ ViridianCityScript_1900b: ; 1900b (6:500b) ViridianCityScript_1903d: ; 1903d (6:503d) CheckEvent EVENT_GOT_POKEDEX ret nz - ld a, [W_YCOORD] + ld a, [wYCoord] cp $9 ret nz - ld a, [W_XCOORD] + ld a, [wXCoord] cp $13 ret nz ld a, $5 @@ -74,9 +74,9 @@ ViridianCityScript1: ; 19062 (6:5062) ld a, $1 ld [W_BATTLETYPE], a ld a, 5 - ld [W_CURENEMYLVL], a + ld [wCurEnemyLVL], a ld a, WEEDLE - ld [W_CUROPPONENT], a + ld [wCurOpponent], a ld a, $2 ld [W_VIRIDIANCITYCURSCRIPT], a ret diff --git a/scripts/viridiangym.asm b/scripts/viridiangym.asm index 1848e5f0..873a397d 100755 --- a/scripts/viridiangym.asm +++ b/scripts/viridiangym.asm @@ -30,9 +30,9 @@ ViridianGymScriptPointers: ; 748e1 (1d:48e1) dw ViridianGymScript4 ViridianGymScript0: ; 748eb (1d:48eb) - ld a, [W_YCOORD] + ld a, [wYCoord] ld b, a - ld a, [W_XCOORD] + ld a, [wXCoord] ld c, a ld hl, ViridianGymArrowTilePlayerMovement call DecodeArrowMovementRLE @@ -131,7 +131,7 @@ ViridianGymScript4: ; 7496b (1d:496b) jpba LoadSpinnerArrowTiles ViridianGymScript3: ; 74988 (1d:4988) - ld a, [W_ISINBATTLE] + ld a, [wIsInBattle] cp $ff jp z, ViridianGymScript_748d6 ld a, $f0 @@ -295,7 +295,7 @@ ViridianGymText1: ; 74a69 (1d:4a69) call EngageMapTrainer call InitBattleEnemyParameters ld a, $8 - ld [W_GYMLEADERNO], a + ld [wGymLeaderNo], a ld a, $3 ld [W_VIRIDIANGYMCURSCRIPT], a .asm_6dff7 @@ -263,7 +263,7 @@ _TradeWentToText:: TX_RAM wcf4b text " went" line "to @" - TX_RAM W_GRASSRATE + TX_RAM wGrassRate text "." done @@ -275,7 +275,7 @@ _TradeForText:: done _TradeSendsText:: - TX_RAM W_GRASSRATE + TX_RAM wGrassRate text " sends" line "@" TX_RAM wcd6d @@ -283,7 +283,7 @@ _TradeSendsText:: done _TradeWavesFarewellText:: - TX_RAM W_GRASSRATE + TX_RAM wGrassRate text " waves" line "farewell as" done @@ -302,7 +302,7 @@ _TradeTakeCareText:: done _TradeWillTradeText:: - TX_RAM W_GRASSRATE + TX_RAM wGrassRate text " will" line "trade @" TX_RAM wcd6d @@ -1490,7 +1490,7 @@ _GrewLevelText:: TX_RAM wcd6d text " grew" line "to level @" - TX_NUM W_CURENEMYLVL, 1, 3 + TX_NUM wCurEnemyLVL, 1, 3 text "!@@" _SuperEffectiveText:: @@ -1695,7 +1695,7 @@ _RareCandyText:: TX_RAM wcd6d text " grew" line "to level @" - TX_NUM W_CURENEMYLVL, $1,$3 + TX_NUM wCurEnemyLVL, $1,$3 text "!@@" _TurnedOnPC1Text:: diff --git a/text/maps/daycare.asm b/text/maps/daycare.asm index 4f4b1950..dbca93d6 100644 --- a/text/maps/daycare.asm +++ b/text/maps/daycare.asm @@ -44,7 +44,7 @@ _DayCareOweMoneyText:: _DayCareGotMonBackText:: text $52, " got" line "@" - TX_RAM W_DAYCAREMONNAME + TX_RAM wDayCareMonName text " back!" done @@ -1586,7 +1586,7 @@ W_TRAINERNAME:: ; d04a ; unused trailing letters ds 13 -W_ISINBATTLE:: ; d057 +wIsInBattle:: ; d057 ; lost battle, this is -1 ; no battle, this is 0 ; wild battle, this is 1 @@ -1597,7 +1597,7 @@ wPartyGainExpFlags:: ; d058 ; flags that indicate which party members should be be given exp when GainExperience is called flag_array 6 -W_CUROPPONENT:: ; d059 +wCurOpponent:: ; d059 ; in a wild battle, this is the species of pokemon ; in a trainer battle, this is the trainer class + 200 ds 1 @@ -1617,9 +1617,9 @@ wDamageMultipliers:: ; d05b ; bit 7: STAB ds 1 -W_LONEATTACKNO:: ; d05c +wLoneAttackNo:: ; d05c ; which entry in LoneAttacks to use -W_GYMLEADERNO:: ; d05c +wGymLeaderNo:: ; d05c ; it's actually the same thing as ^ ds 1 W_TRAINERNO:: ; d05d @@ -1970,49 +1970,49 @@ wNameListType:: ; d0b6 wPredefBank:: ; d0b7 ds 1 -W_MONHEADER:: ; d0b8 +wMonHeader:: ; d0b8 -W_MONHINDEX:: ; d0b8 +wMonHIndex:: ; d0b8 ; In the ROM base stats data stucture, this is the dex number, but it is ; overwritten with the internal index number after the header is copied to WRAM. ds 1 -W_MONHBASESTATS:: ; d0b9 +wMonHBaseStats:: ; d0b9 W_MONHBASEHP:: ; d0b9 ds 1 -W_MONHBASEATTACK:: ; d0ba +wMonHBaseAttack:: ; d0ba ds 1 -W_MONHBASEDEFENSE:: ; d0bb +wMonHBaseDefense:: ; d0bb ds 1 -W_MONHBASESPEED:: ; d0bc +wMonHBaseSpeed:: ; d0bc ds 1 -W_MONHBASESPECIAL:: ; d0bd +wMonHBaseSpecial:: ; d0bd ds 1 -W_MONHTYPES:: ; d0be -W_MONHTYPE1:: ; d0be +wMonHTypes:: ; d0be +wMonHType1:: ; d0be ds 1 -W_MONHTYPE2:: ; d0bf +wMonHType2:: ; d0bf ds 1 -W_MONHCATCHRATE:: ; d0c0 +wMonHCatchRate:: ; d0c0 ds 1 -W_MONHBASEXP:: ; d0c1 +wMonHBaseEXP:: ; d0c1 ds 1 -W_MONHSPRITEDIM:: ; d0c2 +wMonHSpriteDim:: ; d0c2 ds 1 -W_MONHFRONTSPRITE:: ; d0c3 +wMonHFrontSprite:: ; d0c3 ds 2 -W_MONHBACKSPRITE:: ; d0c5 +wMonHBackSprite:: ; d0c5 ds 2 -W_MONHMOVES:: ; d0c7 +wMonHMoves:: ; d0c7 ds 4 -W_MONHGROWTHRATE:: ; d0cb +wMonHGrowthRate:: ; d0cb ds 1 -W_MONHLEARNSET:: ; d0cc +wMonHLearnset:: ; d0cc ; bit field flag_array 50 + 5 ds 1 @@ -2023,10 +2023,7 @@ wSavedTilesetType:: ; d0d4 ds 2 -W_MONHPADDING:: ; d0d7 - - -W_DAMAGE:: ; d0d7 +wDamage:: ; d0d7 ds 2 ds 2 @@ -2112,7 +2109,7 @@ wTextBoxID:: ; d125 wd126:: ds 1 ; not exactly sure what this is used for, but it seems to be used as a multipurpose temp flag value -W_CURENEMYLVL:: ; d127 +wCurEnemyLVL:: ; d127 ds 1 wItemListPointer:: ; d128 @@ -2286,7 +2283,7 @@ wPlayerMoney:: ; d347 W_RIVALNAME:: ; d34a ds NAME_LENGTH -W_OPTIONS:: ; d355 +wOptions:: ; d355 ; bit 7 = battle animation ; 0: On ; 1: Off @@ -2325,25 +2322,25 @@ wMapPalOffset:: ; d35d ; normally, it is 0. it is 6 when Flash is needed, causing FadePal2 to be used instead of FadePal4 ds 1 -W_CURMAP:: ; d35e +wCurMap:: ; d35e ds 1 wCurrentTileBlockMapViewPointer:: ; d35f ; pointer to the upper left corner of the current view in the tile block map ds 2 -W_YCOORD:: ; d361 +wYCoord:: ; d361 ; player’s position on the current map ds 1 -W_XCOORD:: ; d362 +wXCoord:: ; d362 ds 1 -W_YBLOCKCOORD:: ; d363 +wYBlockCoord:: ; d363 ; player's y position (by block) ds 1 -W_XBLOCKCOORD:: ; d364 +wXBlockCoord:: ; d364 ds 1 wLastMap:: ; d365 @@ -2355,11 +2352,11 @@ wUnusedD366:: ; d366 wCurMapTileset:: ; d367 ds 1 -W_CURMAPHEIGHT:: ; d368 +wCurMapHeight:: ; d368 ; blocks ds 1 -W_CURMAPWIDTH:: ; d369 +wCurMapWidth:: ; d369 ; blocks ds 1 @@ -2557,7 +2554,7 @@ wSignCoords:: ; d4b1 wSignTextIDs:: ; d4d1 ds 16 -W_NUMSPRITES:: ; d4e1 +wNumSprites:: ; d4e1 ; number of sprites on the current map ds 1 @@ -2568,11 +2565,11 @@ wYOffsetSinceLastSpecialWarp:: ; d4e2 wXOffsetSinceLastSpecialWarp:: ; d4e3 ds 1 -W_MAPSPRITEDATA:: ; d4e4 +wMapSpriteData:: ; d4e4 ; two bytes per sprite (movement byte 2, text ID) ds 32 -W_MAPSPRITEEXTRADATA:: ; d504 +wMapSpriteExtraData:: ; d504 ; two bytes per sprite (trainer class/item ID, trainer set ID) ds 32 @@ -2606,24 +2603,24 @@ wPlayerDirection:: ; d52a ; if the player is not moving, the last the direction in which the player moved ds 1 -W_TILESETBANK:: ; d52b +wTilesetBank:: ; d52b ds 1 W_TILESETBLOCKSPTR:: ; d52c ; maps blocks (4x4 tiles) to tiles ds 2 -W_TILESETGFXPTR:: ; d52e +wTilesetGFXPtr:: ; d52e ds 2 -W_TILESETCOLLISIONPTR:: ; d530 +wTilesetCollisionPtr:: ; d530 ; list of all walkable tiles ds 2 W_TILESETTALKINGOVERTILES:: ; d532 ds 3 -W_GRASSTILE:: ; d535 +wGrassTile:: ; d535 ds 1 ds 4 @@ -2650,7 +2647,7 @@ wUnusedD5A3:: ; d5a3 wPlayerCoins:: ; d5a4 ds 2 ; BCD -W_MISSABLEOBJECTFLAGS:: ; d5a6 +wMissableObjectFlags:: ; d5a6 ; bit array of missable objects. set = removed ds 32 wMissableObjectFlagsEnd:: @@ -2659,10 +2656,10 @@ wMissableObjectFlagsEnd:: wd5cd:: ds 1 ; temp copy of c1x2 (sprite facing/anim) -W_MISSABLEOBJECTLIST:: ; d5ce +wMissableObjectList:: ; d5ce ; each entry consists of 2 bytes ; * the sprite ID (depending on the current map) -; * the missable object index (global, used for W_MISSABLEOBJECTFLAGS) +; * the missable object index (global, used for wMissableObjectFlags) ; terminated with $FF ds 17 * 2 @@ -2871,11 +2868,11 @@ W_ROUTE7GATECURSCRIPT:: ; d663 ds 1 W_SSANNE2CURSCRIPT:: ; d665 ds 1 -W_SEAFOAMISLANDS4CURSCRIPT:: ; d666 +wSeafoamIslands4CurScript:: ; d666 ds 1 W_ROUTE23CURSCRIPT:: ; d667 ds 1 -W_SEAFOAMISLANDS5CURSCRIPT:: ; d668 +wSeafoamIslands5CurScript:: ; d668 ds 1 W_ROUTE18GATECURSCRIPT:: ; d669 ds 1 @@ -2899,7 +2896,7 @@ wWalkBikeSurfState:: ; d700 ds 10 -W_TOWNVISITEDFLAG:: ; d70b +wTownVisitedFlag:: ; d70b flag_array 13 wSafariSteps:: ; d70d @@ -3198,10 +3195,10 @@ wd882:: ds 5 wLinkEnemyTrainerName:: ; d887 ; linked game's trainer name -W_GRASSRATE:: ; d887 +wGrassRate:: ; d887 ds 1 -W_GRASSMONS:: ; d888 +wGrassMons:: ; d888 ; ds 20 ds 11 @@ -3212,10 +3209,10 @@ wSerialEnemyDataBlock:: ; d893 wEnemyPartyCount:: ds 1 ; d89c wEnemyPartyMons:: ds PARTY_LENGTH + 1 ; d89d -W_WATERRATE:: db ; d8a4 -W_WATERMONS:: db ; d8a5 +wWaterRate:: db ; d8a4 +wWaterMons:: db ; d8a5 - ds W_WATERRATE - @ + ds wWaterRate - @ wEnemyMons:: ; d8a4 wEnemyMon1:: party_struct wEnemyMon1 @@ -3229,7 +3226,7 @@ wEnemyMonOT:: ds NAME_LENGTH * PARTY_LENGTH ; d9ac wEnemyMonNicks:: ds NAME_LENGTH * PARTY_LENGTH ; d9ee -W_TRAINERHEADERPTR:: ; da30 +wTrainerHeaderPtr:: ; da30 ds 2 ds 6 @@ -3260,17 +3257,17 @@ W_PLAYTIMEFRAMES:: ; da45 wSafariZoneGameOver:: ; da46 ds 1 -W_NUMSAFARIBALLS:: ; da47 +wNumSafariBalls:: ; da47 ds 1 -W_DAYCARE_IN_USE:: ; da48 +wDayCareInUse:: ; da48 ; 0 if no pokemon is in the daycare ; 1 if pokemon is in the daycare ds 1 -W_DAYCAREMONNAME:: ds NAME_LENGTH ; da49 -W_DAYCAREMONOT:: ds NAME_LENGTH ; da54 +wDayCareMonName:: ds NAME_LENGTH ; da49 +wDayCareMonOT:: ds NAME_LENGTH ; da54 wDayCareMon:: box_struct wDayCareMon ; da5f diff --git a/yellow/main.asm b/yellow/main.asm index 61a1cfe4..b28f6529 100755 --- a/yellow/main.asm +++ b/yellow/main.asm @@ -29,7 +29,7 @@ LoadMonData_: ; 442b (1:442b) ; 2: boxmon ; 3: daycaremon ; Return monster id at wcf91 and its data at wLoadedMon. -; Also load base stats at W_MONHEADER for convenience. +; Also load base stats at wMonHeader for convenience. ld a, [wDayCareMonSpecies] ld [wcf91], a @@ -120,7 +120,7 @@ INCLUDE "engine/overworld/oam.asm" PrintWaitingText: ; 4b89 (1:4b89) coord hl, 3, 10 lb bc, 1, 11 - ld a, [W_ISINBATTLE] + ld a, [wIsInBattle] and a jr z, .asm_4b9a call TextBoxBorder @@ -528,17 +528,17 @@ SpriteCollisionBitTable: ; 4d35 (1:4d35) db %01000000,%00000000 db %10000000,%00000000 - dr $4d55,$4da5 -UpdatePlayerSprite: ; 4da5 (1:4da5) - dr $4da5,$4e3e -UpdateNPCSprite: ; 4e3e (1:4e3e) - dr $4e3e,$5012 -Func_5012: ; 5012 (1:5012) - dr $5012,$5199 -DoScriptedNPCMovement: ; 5199 (1:5199) - dr $5199,$5b67 -CableClub_TextBoxBorder: ; 5b67 (1:5b67) - dr $5b67,$5ba6 +INCLUDE "engine/overworld/item.asm" +INCLUDE "engine/overworld/movement.asm" + +INCLUDE "engine/cable_club.asm" + +LoadTrainerInfoTextBoxTiles: ; 5b9a (1:5b9a) + ld de, TrainerInfoTextBoxTileGraphics + ld hl, vChars2 + $760 + lb bc, BANK(TrainerInfoTextBoxTileGraphics), (TrainerInfoTextBoxTileGraphicsEnd - TrainerInfoTextBoxTileGraphics) / $10 + jp CopyVideoData + MainMenu: ; 5ba6 (1:5ba6) dr $5ba6,$5ce4 Func_5ce4: ; 5ce4 (1:5ce4) @@ -583,7 +583,7 @@ ClearVariablesAfterLoadingMapData: ; c07c (3:407c) xor a ld [H_AUTOBGTRANSFERENABLED], a ld [wStepCounter], a - ld [W_LONEATTACKNO], a ; W_GYMLEADERNO + ld [wLoneAttackNo], a ; wGymLeaderNo ld [hJoyPressed], a ld [hJoyReleased], a ld [hJoyHeld], a @@ -605,11 +605,11 @@ IsPlayerStandingOnWarp: ; c0a6 (3:40a6) ld c, a ld hl, wWarpEntries .loop - ld a, [W_YCOORD] + ld a, [wYCoord] cp [hl] jr nz, .nextWarp1 inc hl - ld a, [W_XCOORD] + ld a, [wXCoord] cp [hl] jr nz, .nextWarp2 inc hl @@ -635,11 +635,11 @@ CheckForceBikeOrSurf: ; c0d2 (3:40d2) bit 5, [hl] ret nz ld hl, ForcedBikeOrSurfMaps - ld a, [W_YCOORD] + ld a, [wYCoord] ld b, a - ld a, [W_XCOORD] + ld a, [wXCoord] ld c, a - ld a, [W_CURMAP] + ld a, [wCurMap] ld d, a .loop ld a, [hli] @@ -653,15 +653,15 @@ CheckForceBikeOrSurf: ; c0d2 (3:40d2) ld a, [hli] cp c ;compare x-coord jr nz, .loop ; incorrect x-coord, check next item - ld a, [W_CURMAP] + ld a, [wCurMap] cp SEAFOAM_ISLANDS_4 ld a, $2 - ld [W_SEAFOAMISLANDS4CURSCRIPT], a + ld [wSeafoamIslands4CurScript], a jr z, .forceSurfing - ld a, [W_CURMAP] + ld a, [wCurMap] cp SEAFOAM_ISLANDS_5 ld a, $2 - ld [W_SEAFOAMISLANDS5CURSCRIPT], a + ld [wSeafoamIslands5CurScript], a jr z, .forceSurfing ;force bike riding ld hl, wd732 @@ -698,9 +698,9 @@ IsPlayerFacingEdgeOfMap: ; c148 (3:4148) ld a, [hli] ld h, [hl] ld l, a - ld a, [W_YCOORD] + ld a, [wYCoord] ld b, a - ld a, [W_XCOORD] + ld a, [wXCoord] ld c, a ld de, .returnaddress push de @@ -718,7 +718,7 @@ IsPlayerFacingEdgeOfMap: ; c148 (3:4148) dw .facingRight .facingDown - ld a, [W_CURMAPHEIGHT] + ld a, [wCurMapHeight] add a dec a cp b @@ -738,7 +738,7 @@ IsPlayerFacingEdgeOfMap: ; c148 (3:4148) jr .resetCarry .facingRight - ld a, [W_CURMAPWIDTH] + ld a, [wCurMapWidth] add a dec a cp c @@ -756,7 +756,7 @@ IsWarpTileInFrontOfPlayer: ; c197 (3:4197) push de push bc call _GetTileAndCoordsInFrontOfPlayer - ld a, [W_CURMAP] + ld a, [wCurMap] cp SS_ANNE_5 jr z, .ssAnne5 ld a, [wSpriteStateData1 + 9] ; player sprite's facing direction @@ -835,7 +835,7 @@ IsPlayerStandingOnDoorTileOrWarpTile: ; c1e6 (3:41e6) INCLUDE "data/warp_tile_ids.asm" PrintSafariZoneSteps: ; c27b (3:427b) - ld a, [W_CURMAP] + ld a, [wCurMap] cp SAFARI_ZONE_EAST ret c cp UNKNOWN_DUNGEON_2 @@ -853,7 +853,7 @@ PrintSafariZoneSteps: ; c27b (3:427b) coord hl, 1, 3 ld de, SafariBallText call PlaceString - ld a, [W_NUMSAFARIBALLS] + ld a, [wNumSafariBalls] cp 10 jr nc, .numSafariBallsTwoDigits coord hl, 5, 3 @@ -861,7 +861,7 @@ PrintSafariZoneSteps: ; c27b (3:427b) ld [hl], a .numSafariBallsTwoDigits coord hl, 6, 3 - ld de, W_NUMSAFARIBALLS + ld de, wNumSafariBalls lb bc, 1, 2 jp PrintNumber @@ -875,9 +875,9 @@ GetTileAndCoordsInFrontOfPlayer: ; c2d4 (3:42d1) call GetPredefRegisters _GetTileAndCoordsInFrontOfPlayer: ; c2d4 (3:42d4) - ld a, [W_YCOORD] + ld a, [wYCoord] ld d, a - ld a, [W_XCOORD] + ld a, [wXCoord] ld e, a ld a, [wSpriteStateData1 + 9] ; player's sprite facing direction and a ; cp SPRITE_FACING_DOWN @@ -914,7 +914,7 @@ _GetTileAndCoordsInFrontOfPlayer: ; c2d4 (3:42d4) GetTileTwoStepsInFrontOfPlayer: ; c309 (3:4309) xor a ld [$ffdb], a - ld hl, W_YCOORD + ld hl, wYCoord ld a, [hli] ld d, a ld e, [hl] @@ -989,7 +989,7 @@ CheckForBoulderCollisionWithSprites: ; c378 (3:4378) ld [$ffdc], a ld a, [hl] ; map X position ld [$ffdd], a - ld a, [W_NUMSPRITES] + ld a, [wNumSprites] ld c, a ld de, $f ld hl, wSpriteStateData2 + $14 @@ -1218,7 +1218,7 @@ LoadTilesetHeader: ; c4f4 (3:44f4) add hl, de add hl, de add hl, de - ld de, W_TILESETBANK + ld de, wTilesetBank ld bc, $b call CopyData ld a, [hl] @@ -1245,12 +1245,12 @@ LoadTilesetHeader: ; c4f4 (3:44f4) cp $ff jr z, .done call LoadDestinationWarpPosition - ld a, [W_YCOORD] + ld a, [wYCoord] and $1 - ld [W_YBLOCKCOORD], a - ld a, [W_XCOORD] + ld [wYBlockCoord], a + ld a, [wXCoord] and $1 - ld [W_XBLOCKCOORD], a + ld [wXBlockCoord], a .done ret @@ -1259,7 +1259,7 @@ INCLUDE "data/dungeon_tilesets.asm" INCLUDE "data/tileset_headers.asm" IncrementDayCareMonExp: ; c684 (3:4684) - ld a, [W_DAYCARE_IN_USE] + ld a, [wDayCareInUse] and a ret z ld hl, wDayCareMonExp + 2 @@ -1281,7 +1281,7 @@ INCLUDE "data/hide_show_data.asm" LoadWildData: ; cb62 (3:4b62) ld hl,WildDataPointers - ld a,[W_CURMAP] + ld a,[wCurMap] ; get wild data for current map ld c,a @@ -1292,11 +1292,11 @@ LoadWildData: ; cb62 (3:4b62) ld h,[hl] ld l,a ; hl now points to wild data for current map ld a,[hli] - ld [W_GRASSRATE],a + ld [wGrassRate],a and a jr z,.NoGrassData ; if no grass data, skip to surfing data push hl - ld de,W_GRASSMONS ; otherwise, load grass data + ld de,wGrassMons ; otherwise, load grass data ld bc,$0014 call CopyData pop hl @@ -1304,10 +1304,10 @@ LoadWildData: ; cb62 (3:4b62) add hl,bc .NoGrassData ld a,[hli] - ld [W_WATERRATE],a + ld [wWaterRate],a and a ret z ; if no water data, we're done - ld de,W_WATERMONS ; otherwise, load surfing data + ld de,wWaterMons ; otherwise, load surfing data ld bc,$0014 jp CopyData @@ -1443,7 +1443,7 @@ GymLeaderFaceAndBadgeTileGraphics: ; e91b (3:691b) ReplaceTileBlock: ; ed1b (3:6d1b) call GetPredefRegisters ld hl, wOverworldMap - ld a, [W_CURMAPWIDTH] + ld a, [wCurMapWidth] add $6 ld e, a ld d, $0 @@ -1485,7 +1485,7 @@ ReplaceTileBlock: ; ed1b (3:6d1b) ret c ; return if the replaced tile block is above the map view in memory RedrawMapView: ; ed59 (3:6d59) - ld a, [W_ISINBATTLE] + ld a, [wIsInBattle] inc a ret z ld a, [H_AUTOBGTRANSFERENABLED] @@ -1566,16 +1566,16 @@ CompareHLWithBC: ; edcb (3:6dcb) INCLUDE "engine/overworld/cut.asm" MarkTownVisitedAndLoadMissableObjects: ; ef93 (3:6f93) - ld a, [W_CURMAP] + ld a, [wCurMap] cp ROUTE_1 jr nc, .notInTown ld c, a ld b, FLAG_SET - ld hl, W_TOWNVISITEDFLAG ; mark town as visited (for flying) + ld hl, wTownVisitedFlag ; mark town as visited (for flying) predef FlagActionPredef .notInTown ld hl, MapHSPointers - ld a, [W_CURMAP] + ld a, [wCurMap] ld b, $0 ld c, a add hl, bc @@ -1605,11 +1605,11 @@ MarkTownVisitedAndLoadMissableObjects: ; ef93 (3:6f93) ld [H_DIVISOR], a ld b, $2 call Divide ; divide difference by 3, resulting in the global offset (number of missable items before ours) - ld a, [W_CURMAP] + ld a, [wCurMap] ld b, a ld a, [H_DIVIDEND+3] ld c, a ; store global offset in c - ld de, W_MISSABLEOBJECTLIST + ld de, wMissableObjectList pop hl .writeMissableObjectsListLoop ld a, [hli] @@ -1632,8 +1632,8 @@ MarkTownVisitedAndLoadMissableObjects: ; ef93 (3:6f93) ret InitializeMissableObjectsFlags: ; eff1 (3:6ff1) - ld hl, W_MISSABLEOBJECTFLAGS - ld bc, wMissableObjectFlagsEnd - W_MISSABLEOBJECTFLAGS + ld hl, wMissableObjectFlags + ld bc, wMissableObjectFlagsEnd - wMissableObjectFlags xor a call FillMemory ; clear missable objects flags ld hl, MapHS00 @@ -1648,7 +1648,7 @@ InitializeMissableObjectsFlags: ; eff1 (3:6ff1) ld a, [hl] cp Hide jr nz, .skip - ld hl, W_MISSABLEOBJECTFLAGS + ld hl, wMissableObjectFlags ld a, [wMissableObjectCounter] ld c, a ld b, FLAG_SET @@ -1666,7 +1666,7 @@ IsObjectHidden: ; f022 (3:7022) ld a, [H_CURRENTSPRITEOFFSET] swap a ld b, a - ld hl, W_MISSABLEOBJECTLIST + ld hl, wMissableObjectList .loop ld a, [hli] cp $ff @@ -1676,7 +1676,7 @@ IsObjectHidden: ; f022 (3:7022) jr nz, .loop ld c, a ld b, FLAG_TEST - ld hl, W_MISSABLEOBJECTFLAGS + ld hl, wMissableObjectFlags call MissableObjectFlagAction ld a, c and a @@ -1691,7 +1691,7 @@ IsObjectHidden: ; f022 (3:7022) ; [wMissableObjectIndex]: index of the missable object to be added (global index) ShowObject: ; f044 (3:7044) ShowObject2: - ld hl, W_MISSABLEOBJECTFLAGS + ld hl, wMissableObjectFlags ld a, [wMissableObjectIndex] ld c, a ld b, FLAG_RESET @@ -1701,7 +1701,7 @@ ShowObject2: ; removes missable object (items, leg. pokemon, etc.) from the map ; [wMissableObjectIndex]: index of the missable object to be removed (global index) HideObject: ; f053 (3:7053) - ld hl, W_MISSABLEOBJECTFLAGS + ld hl, wMissableObjectFlags ld a, [wMissableObjectIndex] ld c, a ld b, FLAG_SET @@ -1954,7 +1954,7 @@ _AddPartyMon: ; f161 (3:7161) ld a, [wcf91] ld [wd0b5], a call GetMonHeader - ld hl, W_MONHEADER + ld hl, wMonHeader ld a, [hli] ld [de], a ; species inc de @@ -1993,7 +1993,7 @@ _AddPartyMon: ; f161 (3:7161) pop hl push hl - ld a, [W_ISINBATTLE] + ld a, [wIsInBattle] and a ; is this a wild mon caught in battle? jr nz, .copyEnemyMonData @@ -2048,7 +2048,7 @@ _AddPartyMon: ; f161 (3:7161) ld [de], a inc de .copyMonTypesAndMoves - ld hl, W_MONHTYPES + ld hl, wMonHTypes ld a, [hli] ; type 1 ld [de], a inc de @@ -2063,7 +2063,7 @@ _AddPartyMon: ; f161 (3:7161) ld a, $60 ; twistedspoon in gen 2 ld [de], a .skipGivingTwistedSpoon - ld hl, W_MONHMOVES + ld hl, wMonHMoves ld a, [hli] inc de push de @@ -2092,7 +2092,7 @@ _AddPartyMon: ; f161 (3:7161) inc de ld [de], a push de - ld a, [W_CURENEMYLVL] + ld a, [wCurEnemyLVL] ld d, a callab CalcExperience pop de @@ -2117,10 +2117,10 @@ _AddPartyMon: ; f161 (3:7161) pop hl call AddPartyMon_WriteMovePP inc de - ld a, [W_CURENEMYLVL] + ld a, [wCurEnemyLVL] ld [de], a inc de - ld a, [W_ISINBATTLE] + ld a, [wIsInBattle] dec a jr nz, .calcFreshStats ld hl, wEnemyMonMaxHP @@ -2318,7 +2318,7 @@ _MoveMon: ; f3a4 (3:73a4) .asm_f43a ld a, [wMoveMonType] cp PARTY_TO_DAYCARE - ld de, W_DAYCAREMONOT + ld de, wDayCareMonOT jr z, .asm_f459 dec a ld hl, wPartyMonOT @@ -2336,7 +2336,7 @@ _MoveMon: ; f3a4 (3:73a4) ld a, [wMoveMonType] and a jr z, .asm_f46c - ld hl, W_DAYCAREMONOT + ld hl, wDayCareMonOT cp DAYCARE_TO_PARTY jr z, .asm_f472 ld hl, wPartyMonOT @@ -2348,7 +2348,7 @@ _MoveMon: ; f3a4 (3:73a4) call CopyData ld a, [wMoveMonType] cp PARTY_TO_DAYCARE - ld de, W_DAYCAREMONNAME + ld de, wDayCareMonName jr z, .asm_f497 dec a ld hl, wPartyMonNicks @@ -2366,7 +2366,7 @@ _MoveMon: ; f3a4 (3:73a4) ld a, [wMoveMonType] and a jr z, .asm_f4aa - ld hl, W_DAYCAREMONNAME + ld hl, wDayCareMonName cp DAYCARE_TO_PARTY jr z, .asm_f4b0 ld hl, wPartyMonNicks @@ -2389,7 +2389,7 @@ _MoveMon: ; f3a4 (3:73a4) call LoadMonData callba CalcLevelFromExperience ld a, d - ld [W_CURENEMYLVL], a + ld [wCurEnemyLVL], a pop hl ld bc, wBoxMon2 - wBoxMon1 add hl, bc @@ -3389,7 +3389,9 @@ CryData: ; 39462 (e:5462) TrainerPicAndMoneyPointers: ; 39893 (e:5893) dr $39893,$3997e TrainerNames: ; 3997e (e:597e) - dr $3997e,$39bb6 + dr $3997e,$39b54 +InitList: ; 39b54 (e:5b54) + dr $39b54,$39bb6 ReadTrainer: ; 39bb6 (e:5bb6) dr $39bb6,$3a8df DrawAllPokeballs: ; 3a8df (e:68df) |