diff options
148 files changed, 1714 insertions, 1521 deletions
@@ -1,14 +1,14 @@ # Linux - sudo apt-get install make gcc bison git python python-setuptools - sudo easy_install pypng + sudo apt-get install make gcc bison git python python-pip + sudo pip install pypng - git clone git://github.com/bentley/rgbds.git + git clone https://github.com/bentley/rgbds cd rgbds sudo make install cd .. - git clone --recursive git://github.com/luckytyphlosion/pokeyellow.git + git clone --recursive https://github.com/pret/pokeyellow cd pokeyellow To build **pokeyellow.gbc**: @@ -17,17 +17,17 @@ To build **pokeyellow.gbc**: # Mac -In the shell, run: +In **Terminal**, run: xcode-select --install sudo easy_install pypng - git clone git://github.com/bentley/rgbds.git + git clone https://github.com/bentley/rgbds cd rgbds sudo make install cd .. - git clone --recursive git://github.com/luckytyphlosion/pokeyellow.git + git clone --recursive https://github.com/pret/pokeyellow cd pokeyellow Copy the ROM "Pokemon Yellow (U) [C][!].gbc" to the same directory as the disassembly under the name "baserom.gbc". @@ -39,18 +39,20 @@ Then run (in the shell): # Windows -To build on Windows, use [**Cygwin**](http://cygwin.com/install.html) (32-bit). +To build on Windows, use [**Cygwin**](http://cygwin.com/install.html). Use the default settings. -In the installer, select the following packages: `make` `git` `gettext` `python` `python-setuptools` +In the installer, select the following packages: `make` `git` `python` `gettext` Then get the most recent version of [**rgbds**](https://github.com/bentley/rgbds/releases/). -Put `rgbasm.exe`, `rgblink.exe` and `rgbfix.exe` in `C:\cygwin\usr\local\bin`. +Extract the archive and put `rgbasm.exe`, `rgblink.exe` and `rgbfix.exe` in `C:\cygwin\usr\local\bin`. In the **Cygwin terminal**: - easy_install pypng - git clone --recursive git://github.com/luckytyphlosion/pokeyellow.git + lynx -source bootstrap.pypa.io/get-pip.py | python + pip install pypng + + git clone --recursive https://github.com/pret/pokeyellow cd pokeyellow Copy the ROM "Pokemon Yellow (U) [C][!].gbc" to the same directory as the disassembly under the name "baserom.gbc". diff --git a/constants/event_constants.asm b/constants/event_constants.asm index 9c40b013..d2bf1123 100644 --- a/constants/event_constants.asm +++ b/constants/event_constants.asm @@ -1121,15 +1121,15 @@ const_value = 0 const EVENT_BEAT_ROCK_TUNNEL_1_TRAINER_6 ; 45E, (D7D2, bit 6) const EVENT_BEAT_ROCK_TUNNEL_1_TRAINER_7 ; 45F, (D7D2, bit 7) const EVENT_460 ; 460, (D7D3, bit 0) - const EVENT_BEAT_POWER_PLANT_TRAINER_0 ; 461, (D7D3, bit 1) - const EVENT_BEAT_POWER_PLANT_TRAINER_1 ; 462, (D7D3, bit 2) - const EVENT_BEAT_POWER_PLANT_TRAINER_2 ; 463, (D7D3, bit 3) - const EVENT_BEAT_POWER_PLANT_TRAINER_3 ; 464, (D7D3, bit 4) - const EVENT_BEAT_POWER_PLANT_TRAINER_4 ; 465, (D7D3, bit 5) - const EVENT_BEAT_POWER_PLANT_TRAINER_5 ; 466, (D7D3, bit 6) - const EVENT_BEAT_POWER_PLANT_TRAINER_6 ; 467, (D7D3, bit 7) - const EVENT_BEAT_POWER_PLANT_TRAINER_7 ; 468, (D7D4, bit 0) - const EVENT_BEAT_POWER_PLANT_TRAINER_8 ; 469, (D7D4, bit 1) + const EVENT_BEAT_POWER_PLANT_VOLTORB_0 ; 461, (D7D3, bit 1) + const EVENT_BEAT_POWER_PLANT_VOLTORB_1 ; 462, (D7D3, bit 2) + const EVENT_BEAT_POWER_PLANT_VOLTORB_2 ; 463, (D7D3, bit 3) + const EVENT_BEAT_POWER_PLANT_VOLTORB_3 ; 464, (D7D3, bit 4) + const EVENT_BEAT_POWER_PLANT_VOLTORB_4 ; 465, (D7D3, bit 5) + const EVENT_BEAT_POWER_PLANT_VOLTORB_5 ; 466, (D7D3, bit 6) + const EVENT_BEAT_POWER_PLANT_VOLTORB_6 ; 467, (D7D3, bit 7) + const EVENT_BEAT_POWER_PLANT_VOLTORB_7 ; 468, (D7D4, bit 0) + const EVENT_BEAT_ZAPDOS ; 469, (D7D4, bit 1) const EVENT_46A ; 46A, (D7D4, bit 2) const EVENT_46B ; 46B, (D7D4, bit 3) const EVENT_46C ; 46C, (D7D4, bit 4) @@ -1342,7 +1342,7 @@ const_value = 0 const EVENT_BEAT_VICTORY_ROAD_2_TRAINER_3 ; 53B, (D7EE, bit 3) const EVENT_BEAT_VICTORY_ROAD_2_TRAINER_4 ; 53C, (D7EE, bit 4) const EVENT_BEAT_VICTORY_ROAD_2_TRAINER_5 ; 53D, (D7EE, bit 5) - const EVENT_BEAT_VICTORY_ROAD_2_TRAINER_6 ; 53E, (D7EE, bit 6) + const EVENT_BEAT_MOLTRES ; 53E, (D7EE, bit 6) const EVENT_VICTORY_ROAD_2_BOULDER_ON_SWITCH2 ; 53F, (D7EE, bit 7) const EVENT_GOT_NUGGET ; 540, (D7EF, bit 0) const EVENT_BEAT_ROUTE24_ROCKET ; 541, (D7EF, bit 1) @@ -2241,7 +2241,7 @@ const_value = 0 const EVENT_8BE ; 8BE, (D85E, bit 6) const EVENT_8BF ; 8BF, (D85E, bit 7) const EVENT_8C0 ; 8C0, (D85F, bit 0) - const EVENT_BEAT_UNKNOWN_DUNGEON_3_TRAINER_0 ; 8C1, (D85F, bit 1) + const EVENT_BEAT_MEWTWO ; 8C1, (D85F, bit 1) const EVENT_8C2 ; 8C2, (D85F, bit 2) const EVENT_8C3 ; 8C3, (D85F, bit 3) const EVENT_8C4 ; 8C4, (D85F, bit 4) @@ -2522,7 +2522,7 @@ const_value = 0 const EVENT_9D7 ; 9D7, (D881, bit 7) const EVENT_9D8 ; 9D8, (D882, bit 0) const EVENT_9D9 ; 9D9, (D882, bit 1) - const EVENT_BEAT_SEAFOAM_ISLANDS_5_TRAINER_0 ; 9DA, (D882, bit 2) + const EVENT_BEAT_ARTICUNO ; 9DA, (D882, bit 2) const EVENT_9DB ; 9DB, (D882, bit 3) const EVENT_9DC ; 9DC, (D882, bit 4) const EVENT_9DD ; 9DD, (D882, bit 5) diff --git a/constants/item_constants.asm b/constants/item_constants.asm index 1a7f2cc8..fe6fcb15 100755 --- a/constants/item_constants.asm +++ b/constants/item_constants.asm @@ -56,7 +56,7 @@ SAFARI_ROCK EQU $16 ; overload const FULL_HEAL ; $34 const REVIVE ; $35 const MAX_REVIVE ; $36 - const GUARD_SPEC ; $37 + const GUARD_SPEC ; $37 const SUPER_REPEL ; $38 const MAX_REPEL ; $39 const DIRE_HIT ; $3A @@ -64,7 +64,7 @@ SAFARI_ROCK EQU $16 ; overload const FRESH_WATER ; $3C const SODA_POP ; $3D const LEMONADE ; $3E - const S_S_TICKET ; $3F + const S_S_TICKET ; $3F const GOLD_TEETH ; $40 const X_ATTACK ; $41 const X_DEFEND ; $42 @@ -76,7 +76,7 @@ SAFARI_ROCK EQU $16 ; overload const SILPH_SCOPE ; $48 const POKE_FLUTE ; $49 const LIFT_KEY ; $4A - const EXP_ALL ; $4B + const EXP_ALL ; $4B const OLD_ROD ; $4C const GOOD_ROD ; $4D const SUPER_ROD ; $4E diff --git a/constants/misc_constants.asm b/constants/misc_constants.asm index c6945a42..8e5b9866 100644 --- a/constants/misc_constants.asm +++ b/constants/misc_constants.asm @@ -10,6 +10,9 @@ PARTY_LENGTH EQU 6 MONS_PER_BOX EQU 20 NUM_BOXES EQU 12 +BAG_ITEM_CAPACITY EQU 20 +PC_ITEM_CAPACITY EQU 50 + HOF_MON EQU $10 HOF_TEAM EQU PARTY_LENGTH * HOF_MON HOF_TEAM_CAPACITY EQU 50 @@ -52,14 +55,6 @@ NPC_MOVEMENT_UP EQU $40 NPC_MOVEMENT_LEFT EQU $80 NPC_MOVEMENT_RIGHT EQU $C0 -; battle types -const_value set $0 - const NORMAL_BATTLE ; $0 - const OLD_MAN_BATTLE ; $1 - const SAFARI_BATTLE ; $2 - const HURRY_RUN_AWAY_BATTLE ; $3 - const STARTER_PIKACHU_BATTLE ; $4 - ; text box IDs MESSAGE_BOX EQU $01 FIELD_MOVE_MON_MENU EQU $04 @@ -180,6 +175,13 @@ HP_BAR_RED EQU 2 ; D733 flags BIT_TEST_BATTLE EQU 0 +; battle type constants +BATTLE_TYPE_NORMAL EQU 0 +BATTLE_TYPE_OLD_MAN EQU 1 +BATTLE_TYPE_SAFARI EQU 2 +BATTLE_TYPE_RUN EQU 3 +BATTLE_TYPE_PIKACHU EQU 4 + ; serial ESTABLISH_CONNECTION_WITH_INTERNAL_CLOCK EQU $01 diff --git a/data/hidden_objects.asm b/data/hidden_objects.asm index ccf32510..6738d597 100755 --- a/data/hidden_objects.asm +++ b/data/hidden_objects.asm @@ -299,7 +299,7 @@ SaffronPokecenterHiddenObjects: RedsHouse2FHiddenObjects: hidden_object 1, 0, SPRITE_FACING_UP, OpenRedsPC - hidden_object 5, 3, $d0, PrintRedsNESText + hidden_object 5, 3, $d0, PrintRedSNESText db $ff BluesHouseHiddenObjects: diff --git a/data/trades.asm b/data/trades.asm index b1430089..77fc55f4 100755 --- a/data/trades.asm +++ b/data/trades.asm @@ -1,12 +1,12 @@ TradeMons: ; 71c1d (1c:5c1d) ; givemonster, getmonster, textstring, nickname (11 bytes), 14 bytes total - db LICKITUNG, DUGTRIO, 0,"GURIO@@@@@@" - db CLEFAIRY, MR_MIME, 0,"MILES@@@@@@" - db BUTTERFREE,BEEDRILL, 2,"STINGER@@@@" - db KANGASKHAN,MUK, 0,"STICKY@@@@@" - db MEW, MEW, 2,"BART@@@@@@@" - db TANGELA, PARASECT, 0,"SPIKE@@@@@@" - db PIDGEOT, PIDGEOT, 1,"MARTY@@@@@@" - db GOLDUCK, RHYDON, 1,"BUFFY@@@@@@" - db GROWLITHE, DEWGONG, 2,"CEZANNE@@@@" - db CUBONE, MACHOKE, 2,"RICKY@@@@@@" + db LICKITUNG, DUGTRIO, 0,"GURIO@@@@@@" + db CLEFAIRY, MR_MIME, 0,"MILES@@@@@@" + db BUTTERFREE,BEEDRILL,2,"STINGER@@@@" + db KANGASKHAN,MUK, 0,"STICKY@@@@@" + db MEW, MEW, 2,"BART@@@@@@@" + db TANGELA, PARASECT,0,"SPIKE@@@@@@" + db PIDGEOT, PIDGEOT, 1,"MARTY@@@@@@" + db GOLDUCK, RHYDON, 1,"BUFFY@@@@@@" + db GROWLITHE, DEWGONG, 2,"CEZANNE@@@@" + db CUBONE, MACHOKE, 2,"RICKY@@@@@@" diff --git a/engine/bank3c.asm b/engine/bank3c.asm index 83e010ff..1f3c967f 100644 --- a/engine/bank3c.asm +++ b/engine/bank3c.asm @@ -65,12 +65,12 @@ Func_f02da:: ; f02da (3c:42da) ret .asm_f02ee - ld hl, wd126 + ld hl, wCurrentMapScriptFlags set 6, [hl] ret .asm_f02f4 - ld hl, wd126 + ld hl, wCurrentMapScriptFlags set 5, [hl] ret diff --git a/engine/bank3d.asm b/engine/bank3d.asm index bf84e096..fbf816b6 100644 --- a/engine/bank3d.asm +++ b/engine/bank3d.asm @@ -456,12 +456,15 @@ Text_f5b28: ; f5b28 (3d:5b28) TX_FAR _CanMoveBouldersText ; 2d:4193 db "@" -CheckForForcedBikeSurf: ; f5b2d (3d:5b2d) +IsSurfingAllowed: ; f5b2d (3d:5b2d) +; Returns whether surfing is allowed in bit 1 of wd728. +; Surfing isn't allowed on the Cycling Road or in the lowest level of the +; Seafoam Islands before the current has been slowed with boulders. ld hl, wd728 set 1, [hl] ld a, [wd732] bit 5, a - jr nz, .asm_f5b59 + jr nz, .forcedToRideBike ld a, [wCurMap] cp SEAFOAM_ISLANDS_5 ret nz @@ -474,7 +477,7 @@ CheckForForcedBikeSurf: ; f5b2d (3d:5b2d) res 1, [hl] ld hl, CurrentTooFastText jp PrintText -.asm_f5b59 +.forcedToRideBike ld hl, wd728 res 1, [hl] ld hl, CyclingIsFunText @@ -499,7 +502,7 @@ AddItemToInventory_: ; f5b70 (3d:5b70) push de push hl push hl - ld d, 50 ; PC box can hold 50 items + ld d, PC_ITEM_CAPACITY ; how many items the PC can hold ld a, wNumBagItems & $FF cp l jr nz, .checkIfInventoryFull @@ -507,7 +510,7 @@ AddItemToInventory_: ; f5b70 (3d:5b70) cp h jr nz, .checkIfInventoryFull ; if the destination is the bag - ld d, 20 ; bag can hold 20 items + ld d, BAG_ITEM_CAPACITY ; how many items the bag can hold .checkIfInventoryFull ld a, [hl] sub d diff --git a/engine/battle/common_text.asm b/engine/battle/common_text.asm index 0ca9ce96..a0c44346 100644 --- a/engine/battle/common_text.asm +++ b/engine/battle/common_text.asm @@ -9,8 +9,8 @@ PrintBeginningBattleText: ; f4000 (3d:4000) jr c, .pokemonTower .notPokemonTower ld a,[wBattleType] - cp $4 ; new battle type? - jr nz,.notnewbattletype + cp BATTLE_TYPE_PIKACHU + jr nz,.notPikachuBattle callab IsPlayerPikachuAsleepInParty ld e,$24 jr c,.asm_f4026 @@ -18,7 +18,7 @@ PrintBeginningBattleText: ; f4000 (3d:4000) .asm_f4026 callab PlayPikachuSoundClip jr .continue -.notnewbattletype +.notPikachuBattle ld a, [wEnemyMonSpecies2] call PlayCry .continue diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 565525ea..24b3863b 100755 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -250,9 +250,9 @@ StartBattle: ; 3c127 (f:4127) call SaveScreenTilesToBuffer1 .checkAnyPartyAlive ld a, [wBattleType] - cp $3 + cp BATTLE_TYPE_RUN jp z, .specialBattle - cp $4 + cp BATTLE_TYPE_PIKACHU jp z, .specialBattle call AnyPartyAlive ld a, d @@ -1625,9 +1625,9 @@ TryRunningFromBattle: ; 3cb1e (f:4b1e) call IsGhostBattle jp z, .canEscape ; jump if it's a ghost battle ld a, [wBattleType] - cp $2 + cp BATTLE_TYPE_SAFARI jp z, .canEscape ; jump if it's a safari battle - cp $3 + cp BATTLE_TYPE_RUN jp z, .canEscape ; hurry, get away? ld a, [wLinkState] cp LINK_STATE_BATTLING @@ -1770,7 +1770,7 @@ LoadBattleMonFromParty: ; 3cc10 (f:4c10) ld bc, NUM_MOVES call CopyData ld de, wBattleMonLevel - ld bc, $b + ld bc, wBattleMonPP - wBattleMonLevel call CopyData ld a, [wBattleMonSpecies2] ld [wd0b5], a @@ -1814,7 +1814,7 @@ LoadEnemyMonFromParty: ; 3cc7d (f:4c7d) ld bc, NUM_MOVES call CopyData ld de, wEnemyMonLevel - ld bc, $b + ld bc, wEnemyMonPP - wEnemyMonLevel call CopyData ld a, [wEnemyMonSpecies] ld [wd0b5], a @@ -1990,11 +1990,11 @@ DrawPlayerHUDAndHPBar: ; 3ce25 (f:4e25) call PlaceString ld hl, wBattleMonSpecies ld de, wLoadedMon - ld bc, $c + ld bc, wBattleMonDVs - wBattleMonSpecies call CopyData ld hl, wBattleMonLevel ld de, wLoadedMonLevel - ld bc, $b + ld bc, wBattleMonPP - wBattleMonLevel call CopyData coord hl, 14, 8 push hl @@ -2171,7 +2171,7 @@ DisplayBattleMenu: ; 3cf78 (f:4f78) call SaveScreenTilesToBuffer1 .nonstandardbattle ld a, [wBattleType] - cp $2 ; safari + cp BATTLE_TYPE_SAFARI ld a, BATTLE_MENU_TEMPLATE jr nz, .menuselected ld a, SAFARI_BATTLE_MENU_TEMPLATE @@ -2179,9 +2179,9 @@ DisplayBattleMenu: ; 3cf78 (f:4f78) ld [wTextBoxID], a call DisplayTextBoxID ld a, [wBattleType] - cp $1 + cp BATTLE_TYPE_OLD_MAN jr z, .doSimulatedMenuInput ; simulate menu input if it's the old man or prof. oak pikachu battle - cp $4 + cp BATTLE_TYPE_PIKACHU jr z, .doSimulatedMenuInput jp .handleBattleMenuInput ; the following happens for the old man tutorial and prof. oak pikachu battle @@ -2234,7 +2234,7 @@ DisplayBattleMenu: ; 3cf78 (f:4f78) jr .rightColumn .leftColumn ; put cursor in left column of menu ld a, [wBattleType] - cp $2 + cp BATTLE_TYPE_SAFARI ld a, " " jr z, .safariLeftColumn ; put cursor in left column for normal battle menu (i.e. when it's not a Safari battle) @@ -2267,7 +2267,7 @@ DisplayBattleMenu: ; 3cf78 (f:4f78) jr .AButtonPressed ; the A button was pressed .rightColumn ; put cursor in right column of menu ld a, [wBattleType] - cp $2 + cp BATTLE_TYPE_SAFARI ld a, " " jr z, .safariRightColumn ; put cursor in right column for normal battle menu (i.e. when it's not a Safari battle) @@ -2304,10 +2304,10 @@ DisplayBattleMenu: ; 3cf78 (f:4f78) .AButtonPressed call PlaceUnfilledArrowMenuCursor ld a, [wBattleType] - cp HURRY_RUN_AWAY_BATTLE + cp BATTLE_TYPE_RUN jr z, .handleUnusedBattle ld a, [wBattleType] - cp SAFARI_BATTLE ; is it a Safari battle? + cp BATTLE_TYPE_SAFARI ld a, [wCurrentMenuItem] ld [wBattleAndStartSavedMenuItem], a jr z, .handleMenuSelection @@ -2329,7 +2329,7 @@ DisplayBattleMenu: ; 3cf78 (f:4f78) jr nz, .upperLeftMenuItemWasNotSelected ; the upper left menu item was selected ld a, [wBattleType] - cp $2 + cp BATTLE_TYPE_SAFARI jr z, .throwSafariBallWasSelected ; the "FIGHT" menu was selected xor a @@ -2368,7 +2368,7 @@ DisplayBattleMenu: ; 3cf78 (f:4f78) .notLinkBattle call SaveScreenTilesToBuffer2 ld a, [wBattleType] - cp $2 ; is it a safari battle? + cp BATTLE_TYPE_SAFARI jr nz, BagWasSelected ; bait was selected @@ -2386,9 +2386,9 @@ BagWasSelected: ; 3d10a (f:510a) call DrawHUDsAndHPBars .next ld a, [wBattleType] - cp OLD_MAN_BATTLE ; is it the old man tutorial? + cp BATTLE_TYPE_OLD_MAN ; is it the old man tutorial? jr z, .simulatedInputBattle - cp STARTER_PIKACHU_BATTLE ; is it the prof oak battle with pikachu? + cp BATTLE_TYPE_PIKACHU ; is it the prof oak battle with pikachu? jr z, .simulatedInputBattle jr DisplayPlayerBag .simulatedInputBattle @@ -2441,7 +2441,7 @@ UseBagItem: ; 3c162 (f:5162) xor a ld [wCurrentMenuItem], a ld a, [wBattleType] - cp SAFARI_BATTLE ; is it a safari battle? + cp BATTLE_TYPE_SAFARI jr z, .checkIfMonCaptured ld a, [wActionResultOrTookBattleTurn] @@ -2463,7 +2463,7 @@ UseBagItem: ; 3c162 (f:5162) jr nz, .returnAfterCapturingMon ld a, [wBattleType] - cp SAFARI_BATTLE ; is it a safari battle? + cp BATTLE_TYPE_SAFARI jr z, .returnAfterUsingItem_NoCapture ; not a safari battle call LoadScreenTilesFromBuffer1 @@ -2494,7 +2494,7 @@ PartyMenuOrRockOrRun: ; 3d1cd (f:51cd) ; party menu or rock was selected call SaveScreenTilesToBuffer2 ld a, [wBattleType] - cp $2 ; is it a safari battle? + cp BATTLE_TYPE_SAFARI jr nz, .partyMenuWasSelected ; safari battle ld a, SAFARI_ROCK @@ -3626,7 +3626,7 @@ CheckPlayerStatusConditions: ; 3d9c6 (f:59c6) ld a,[wPlayerBattleStatus1] add a ; is player confused? jr nc,.TriedToUseDisabledMoveCheck - ld hl,W_PLAYERCONFUSEDCOUNTER + ld hl,wPlayerConfusedCounter dec [hl] jr nz,.IsConfused ld hl,wPlayerBattleStatus1 @@ -3764,7 +3764,7 @@ CheckPlayerStatusConditions: ; 3d9c6 (f:59c6) and a,3 inc a inc a ; confused for 2-5 turns - ld [W_PLAYERCONFUSEDCOUNTER],a + ld [wPlayerConfusedCounter],a pop hl ; skip DecrementPP jp .returnToHL @@ -6126,7 +6126,7 @@ CheckEnemyStatusConditions: ; 3ea15 (f:6a15) ld a, [wEnemyBattleStatus1] add a ; check if enemy mon is confused jp nc, .checkIfTriedToUseDisabledMove - ld hl, W_ENEMYCONFUSEDCOUNTER + ld hl, wEnemyConfusedCounter dec [hl] jr nz, .isConfused ld hl, wEnemyBattleStatus1 @@ -6298,7 +6298,7 @@ CheckEnemyStatusConditions: ; 3ea15 (f:6a15) and $3 inc a inc a ; confused for 2-5 turns - ld [W_ENEMYCONFUSEDCOUNTER], a + ld [wEnemyConfusedCounter], a pop hl ; skip DecrementPP jp .enemyReturnToHL .checkIfUsingMultiturnMove @@ -6576,10 +6576,10 @@ SwapPlayerAndEnemyLevels: ; 3ee07 (f:6e07) LoadPlayerBackPic: ; 3ee18 (f:6e18) ld a, [wBattleType] ld de, OldManPic - cp OLD_MAN_BATTLE ; is it the old man tutorial? + cp BATTLE_TYPE_OLD_MAN ; is it the old man tutorial? jr z, .next ld de, ProfOakPicBack - cp STARTER_PIKACHU_BATTLE ; is it the pikachu battle at the beginning of the game? + cp BATTLE_TYPE_PIKACHU ; is it the pikachu battle at the beginning of the game? jr z, .next ld de, RedPicBack .next @@ -6624,7 +6624,7 @@ LoadPlayerBackPic: ; 3ee18 (f:6e18) ld a, $0 call SwitchSRAMBankAndLatchClockData ld hl, vSprites - ld de, S_SPRITEBUFFER1 + ld de, sSpriteBuffer1 ld a, [H_LOADEDROMBANK] ld b, a ld c, 7 * 7 @@ -8292,11 +8292,11 @@ ConfusionSideEffectSuccess: ; 3f94a (f:794a) ld a, [H_WHOSETURN] and a ld hl, wEnemyBattleStatus1 - ld bc, W_ENEMYCONFUSEDCOUNTER + ld bc, wEnemyConfusedCounter ld a, [wPlayerMoveEffect] jr z, .confuseTarget ld hl, wPlayerBattleStatus1 - ld bc, W_PLAYERCONFUSEDCOUNTER + ld bc, wPlayerConfusedCounter ld a, [wEnemyMoveEffect] .confuseTarget bit Confused, [hl] ; is mon confused? diff --git a/engine/battle/init_battle_variables.asm b/engine/battle/init_battle_variables.asm index 8c43e8f8..74ea3814 100644 --- a/engine/battle/init_battle_variables.asm +++ b/engine/battle/init_battle_variables.asm @@ -32,7 +32,7 @@ InitBattleVariables: ; f6236 (3d:6236) jr c, .notSafariBattle cp SAFARI_ZONE_REST_HOUSE_1 jr nc, .notSafariBattle - ld a, $2 ; safari battle + ld a, BATTLE_TYPE_SAFARI ld [wBattleType], a .notSafariBattle jpab PlayBattleMusic diff --git a/engine/battle/moveEffects/pay_day_effect.asm b/engine/battle/moveEffects/pay_day_effect.asm index 2fa6b53f..0236e3e4 100644 --- a/engine/battle/moveEffects/pay_day_effect.asm +++ b/engine/battle/moveEffects/pay_day_effect.asm @@ -1,4 +1,4 @@ -PayDayEffect_ ; f6511 (3d:6511) +PayDayEffect_: ; f6511 (3d:6511) xor a ld hl, wcd6d ld [hli], a diff --git a/engine/battle/scale_sprites.asm b/engine/battle/scale_sprites.asm index 03495c82..c829fa13 100644 --- a/engine/battle/scale_sprites.asm +++ b/engine/battle/scale_sprites.asm @@ -9,12 +9,12 @@ ScaleSpriteByTwo: ; 2fd79 (b:7d79) ret ScaleSpriteByTwo_: ; 2fd85 (b:7d85) - ld de, S_SPRITEBUFFER1 + (4*4*8) - 5 ; last byte of input data, last 4 rows already skipped - ld hl, S_SPRITEBUFFER0 + SPRITEBUFFERSIZE - 1 ; end of destination buffer + ld de, sSpriteBuffer1 + (4*4*8) - 5 ; last byte of input data, last 4 rows already skipped + ld hl, sSpriteBuffer0 + SPRITEBUFFERSIZE - 1 ; end of destination buffer call ScaleLastSpriteColumnByTwo ; last tile column is special case call ScaleFirstThreeSpriteColumnsByTwo ; scale first 3 tile columns - ld de, S_SPRITEBUFFER2 + (4*4*8) - 5 ; last byte of input data, last 4 rows already skipped - ld hl, S_SPRITEBUFFER1 + SPRITEBUFFERSIZE - 1 ; end of destination buffer + ld de, sSpriteBuffer2 + (4*4*8) - 5 ; last byte of input data, last 4 rows already skipped + ld hl, sSpriteBuffer1 + SPRITEBUFFERSIZE - 1 ; end of destination buffer call ScaleLastSpriteColumnByTwo ; last tile column is special case ScaleFirstThreeSpriteColumnsByTwo: ; 2fd9a (b:7d9a) diff --git a/engine/diploma_3a.asm b/engine/diploma_3a.asm index 520d9f96..f85cc288 100755 --- a/engine/diploma_3a.asm +++ b/engine/diploma_3a.asm @@ -91,12 +91,12 @@ Func_e9ad3: coord hl, 2, 15 call PlaceString coord hl, 12, 15 - ld de, wPlayTimeHours + 1 + ld de, wPlayTimeHours lb bc, $40 | 1, 3 call PrintNumber ld [hl], $16 inc hl - ld de, wPlayTimeMinutes + 1 + ld de, wPlayTimeMinutes lb bc, $80 | 1, 2 call PrintNumber ld a, [wNumSetBits] diff --git a/engine/hall_of_fame.asm b/engine/hall_of_fame.asm index ee138737..c8e6de3b 100755 --- a/engine/hall_of_fame.asm +++ b/engine/hall_of_fame.asm @@ -202,8 +202,8 @@ HoFLoadPlayerPics: ; 70390 (1c:433e) call UncompressSpriteFromDE ld a,$0 call SwitchSRAMBankAndLatchClockData - ld hl, S_SPRITEBUFFER1 - ld de, S_SPRITEBUFFER0 + ld hl, sSpriteBuffer1 + ld de, sSpriteBuffer0 ld bc, $310 call CopyData call PrepareRTCDataAndDisableSRAM @@ -238,12 +238,12 @@ HoFDisplayPlayerStats: ; 703d1 (1c:43d1) ld de, HoFPlayTimeText call PlaceString coord hl, 5, 7 - ld de, wPlayTimeHours + 1 + ld de, wPlayTimeHours lb bc, 1, 3 call PrintNumber ld [hl], $6d inc hl - ld de, wPlayTimeMinutes + 1 + ld de, wPlayTimeMinutes lb bc, LEADING_ZEROES | 1, 2 call PrintNumber coord hl, 1, 9 diff --git a/engine/hidden_object_functions17.asm b/engine/hidden_object_functions17.asm index 31f9befc..78950150 100755 --- a/engine/hidden_object_functions17.asm +++ b/engine/hidden_object_functions17.asm @@ -1,4 +1,4 @@ -PrintRedsNESText: ; 5dbae (17:5bae) +PrintRedSNESText: ; 5dbae (17:5bae) call EnableAutoTextBoxDrawing tx_pre_jump RedBedroomSNESText @@ -122,7 +122,7 @@ LinkCableHelp: ; 5dc29 (17:5c29) ld hl, LinkCableHelpText1 call PrintText xor a - ld [wAnimationID], a + ld [wMenuItemOffset], a ld [wCurrentMenuItem], a ld [wLastMenuItem], a ld a, A_BUTTON | B_BUTTON @@ -205,7 +205,7 @@ ViridianSchoolBlackboard: ; 5dced (17:5ced) ld hl, ViridianSchoolBlackboardText1 call PrintText xor a - ld [wAnimationID], a + ld [wMenuItemOffset], a ld [wCurrentMenuItem], a ld [wLastMenuItem], a ld a, D_LEFT | D_RIGHT | A_BUTTON | B_BUTTON @@ -242,8 +242,8 @@ ViridianSchoolBlackboard: ; 5dced (17:5ced) ld [wTopMenuItemY], a ld a, $6 ld [wTopMenuItemX], a - ld a, $3 - ld [wAnimationID], a + ld a, $3 ; in the the right column, use an offset to prevent overlap + ld [wMenuItemOffset], a jr .blackboardLoop .didNotPressRight bit 5, a ; pressed left @@ -256,7 +256,7 @@ ViridianSchoolBlackboard: ; 5dced (17:5ced) ld a, $1 ld [wTopMenuItemX], a xor a - ld [wAnimationID], a + ld [wMenuItemOffset], a jr .blackboardLoop .didNotPressLeftOrRight ld a, [wCurrentMenuItem] @@ -306,7 +306,7 @@ StatusAilmentText2: ; 5ddbb (17:5dbb) ViridianBlackboardStatusPointers: ; 5ddcc (17:5ddc) dw ViridianBlackboardSleepText dw ViridianBlackboardPoisonText - dw ViridianBlackbaordPrlzText + dw ViridianBlackboardPrlzText dw ViridianBlackboardBurnText dw ViridianBlackboardFrozenText @@ -318,8 +318,8 @@ ViridianBlackboardPoisonText: ; 5dddb (17:5ddb) TX_FAR _ViridianBlackboardPoisonText db "@" -ViridianBlackbaordPrlzText: ; 5dde0 (17:5de0) - TX_FAR _ViridianBlackbaordPrlzText +ViridianBlackboardPrlzText: ; 5dde0 (17:5de0) + TX_FAR _ViridianBlackboardPrlzText db "@" ViridianBlackboardBurnText: ; 5dde5 (17:5de5) @@ -366,7 +366,7 @@ GymTrashScript: ; 5ddfc (17:5dfc) ; Next can is trying for the second switch. SetEvent EVENT_1ST_LOCK_OPENED callab Func_f2d0c - tx_pre_id VermilionGymTrashSuccesText1 + tx_pre_id VermilionGymTrashSuccessText1 jr .done .trySecondLock @@ -392,10 +392,10 @@ GymTrashScript: ; 5ddfc (17:5dfc) .openSecondLock ; Completed the trash can puzzle. SetEvent EVENT_2ND_LOCK_OPENED - ld hl, wd126 + ld hl, wCurrentMapScriptFlags set 6, [hl] - tx_pre_id VermilionGymTrashSuccesText3 + tx_pre_id VermilionGymTrashSuccessText3 .done jp PrintPredefTextID @@ -425,8 +425,8 @@ GymTrashCans: ; 5de7d (17:5e7d) db 2, 11, 13, -1, -1 ; 14 ; 5dec8 -VermilionGymTrashSuccesText1: ; 5dec8 (17:5ec8) - TX_FAR _VermilionGymTrashSuccesText1 +VermilionGymTrashSuccessText1: ; 5dec8 (17:5ec8) + TX_FAR _VermilionGymTrashSuccessText1 TX_ASM call WaitForSoundToFinish ld a, SFX_SWITCH @@ -435,8 +435,8 @@ VermilionGymTrashSuccesText1: ; 5dec8 (17:5ec8) jp TextScriptEnd ; unused -VermilionGymTrashSuccesText2: ; 5dedb (17:5edb) - TX_FAR _VermilionGymTrashSuccesText2 +VermilionGymTrashSuccessText2: ; 5dedb (17:5edb) + TX_FAR _VermilionGymTrashSuccessText2 db "@" ; unused @@ -448,8 +448,8 @@ VermilionGymTrashSuccesPlaySfx: ; 5dee0 (17:5ee0) call WaitForSoundToFinish jp TextScriptEnd -VermilionGymTrashSuccesText3: ; 5deef (17:5eef) - TX_FAR _VermilionGymTrashSuccesText3 +VermilionGymTrashSuccessText3: ; 5deef (17:5eef) + TX_FAR _VermilionGymTrashSuccessText3 TX_ASM call WaitForSoundToFinish ld a, SFX_GO_INSIDE diff --git a/engine/hidden_object_functions7.asm b/engine/hidden_object_functions7.asm index 6e232664..4867b447 100755 --- a/engine/hidden_object_functions7.asm +++ b/engine/hidden_object_functions7.asm @@ -22,9 +22,10 @@ DisplayOakLabRightPoster: ; 1e2fe (7:62fe) ld a, [wNumSetBits] cp 2 tx_pre_id SaveOptionText - jr c, .ownOneMon + jr c, .ownLessThanTwo + ; own two or more mon tx_pre_id StrengthsAndWeaknessesText -.ownOneMon +.ownLessThanTwo jp PrintPredefTextID SaveOptionText: ; 1e317 (7:6317) @@ -209,7 +210,7 @@ CinnabarGymQuiz_1ea92: ; 1e43a (7:643a) ld a, [wCurrentMenuItem] cp c jr nz, .wrongAnswer - ld hl, wd126 + ld hl, wCurrentMapScriptFlags set 5, [hl] ld a, [hGymGateIndex] ld [$ffe0], a @@ -434,7 +435,7 @@ BillsHousePokemonList: ; 1e5dc (7:65dc) ld hl, BillsHousePokemonListText1 call PrintText xor a - ld [wAnimationID], a + ld [wMenuItemOffset], a ld [wCurrentMenuItem], a ld [wLastMenuItem], a ld a, A_BUTTON | B_BUTTON diff --git a/engine/items/items.asm b/engine/items/items.asm index 197e5e5d..1858c5f0 100755 --- a/engine/items/items.asm +++ b/engine/items/items.asm @@ -101,240 +101,341 @@ ItemUsePtrTable: ; d307 (3:5307) dw ItemUsePPRestore ; MAX_ELIXER ItemUseBall: ; d3ad (3:53ad) - ld a, [wIsInBattle] + +; Balls can't be used out of battle. + ld a,[wIsInBattle] and a - jp z, ItemUseNotTime ; not in battle + jp z,ItemUseNotTime + +; Balls can't catch trainers' Pokémon. dec a - jp nz, ThrowBallAtTrainerMon - ld a, [wBattleType] - cp $1 - jr z, .UseBall - cp $4 ; pikachu battle? - jr z, .UseBall - ld a, [wPartyCount] ;is Party full? - cp PARTY_LENGTH - jr nz, .UseBall - ld a, [wNumInBox] ;is Box full? - cp MONS_PER_BOX - jp z, BoxFullCannotThrowBall -.UseBall -;ok, you can use a ball + jp nz,ThrowBallAtTrainerMon + +; If this is for the old man battle, skip checking if the party & box are full. + ld a,[wBattleType] + cp BATTLE_TYPE_OLD_MAN + jr z,.canUseBall + cp BATTLE_TYPE_PIKACHU + jr z,.canUseBall + + ld a,[wPartyCount] ; is party full? + cp a,PARTY_LENGTH + jr nz,.canUseBall + ld a,[wNumInBox] ; is box full? + cp a,MONS_PER_BOX + jp z,BoxFullCannotThrowBall + +.canUseBall xor a - ld [wCapturedMonSpecies], a - ld a, [wBattleType] - cp 2 ;SafariBattle - jr nz, .skipSafariZoneCode + ld [wCapturedMonSpecies],a + + ld a,[wBattleType] + cp a,BATTLE_TYPE_SAFARI + jr nz,.skipSafariZoneCode + .safariZone - ; remove a Safari Ball from inventory - ld hl, wNumSafariBalls - dec [hl] + ld hl,wNumSafariBalls + dec [hl] ; remove a Safari Ball + .skipSafariZoneCode call RunDefaultPaletteCommand - ld a, $43 - ld [wd11e], a - call LoadScreenTilesFromBuffer1 ;restore screenBuffer from Backup - ld hl, ItemUseText00 + + ld a,$43 ; successful capture value + ld [wPokeBallAnimData],a + + call LoadScreenTilesFromBuffer1 + ld hl,ItemUseText00 call PrintText + +; If the player is fighting an unidentified ghost, set the value that indicates +; the Pokémon can't be caught and skip the capture calculations. callab IsGhostBattle - ld b, $10 - jp z, .next12 - ld a, [wBattleType] - cp $1 - jr z, .oldManBattle - cp $4 - jr z, .oldManBattle ; pikachu battle technically old man battle + ld b,$10 ; can't be caught value + jp z,.setAnimData + + ld a,[wBattleType] + cp BATTLE_TYPE_OLD_MAN + jr z,.oldManBattle + cp BATTLE_TYPE_PIKACHU + jr z,.oldManBattle ; pikachu battle technically old man battle jr .notOldManBattle .oldManBattle - ld hl, wGrassRate - ld de, wPlayerName - ld bc, NAME_LENGTH - call CopyData ; save the player's name in the Wild Monster data + ld hl,wGrassRate + ld de,wPlayerName + ld bc,NAME_LENGTH + call CopyData ; save the player's name in the Wild Monster data (part of the Cinnabar Island Missingno. glitch) ld a, [wBattleType] - cp MASTER_BALL - jp nz, .BallSuccess - ld a, $1 + cp BATTLE_TYPE_OLD_MAN + jp nz,.captured + ld a,$1 ld [wCapturedMonSpecies], a CheckEvent EVENT_02F ld b, $63 - jp nz, .next12 - jp .BallSuccess - + jp nz,.setAnimData + jp .captured .notOldManBattle - ld a, [wCurMap] - cp POKEMONTOWER_6 - jr nz, .loop - ld a, [wEnemyMonSpecies2] - cp MAROWAK - ld b, $10 - jp z, .next12 -; if not fighting ghost Marowak, loop until a random number in the current -; pokeball's allowed range is found +; If the player is fighting the ghost Marowak, set the value that indicates the +; Pokémon can't be caught and skip the capture calculations. + ld a,[wCurMap] + cp a,POKEMONTOWER_6 + jr nz,.loop + ld a,[wEnemyMonSpecies2] + cp a,MAROWAK + ld b,$10 ; can't be caught value + jp z,.setAnimData + +; Get the first random number. Let it be called Rand1. +; Rand1 must be within a certain range according the kind of ball being thrown. +; The ranges are as follows. +; Poké Ball: [0, 255] +; Great Ball: [0, 200] +; Ultra/Safari Ball: [0, 150] +; Loop until an acceptable number is found. + .loop call Random - ld b, a - ld hl, wcf91 + ld b,a + +; Get the item ID. + ld hl,wcf91 .asm_d54a - ld a, [hl] - cp MASTER_BALL - jp z, .BallSuccess - cp POKE_BALL - jr z, .checkForAilments - ld a, 200 + ld a,[hl] + +; The Master Ball always succeeds. + cp a,MASTER_BALL + jp z,.captured + +; Anything will do for the basic Poké Ball. + cp a,POKE_BALL + jr z,.checkForAilments + +; If it's a Great/Ultra/Safari Ball and Rand1 is greater than 200, try again. + ld a,200 cp b - jr c, .loop ;get only numbers <= 200 for Great Ball - ld a, [hl] - cp GREAT_BALL - jr z, .checkForAilments - ld a, 150 ;get only numbers <= 150 for Ultra Ball + jr c,.loop + +; Less than or equal to 200 is good enough for a Great Ball. + ld a,[hl] + cp a,GREAT_BALL + jr z,.checkForAilments + +; If it's an Ultra/Safari Ball and Rand1 is greater than 150, try again. + ld a,150 cp b - jr c, .loop + jr c,.loop + .checkForAilments -; pokemon can be caught more easily with any (primary) status ailment -; Frozen/Asleep pokemon are relatively even easier to catch -; for Frozen/Asleep pokemon, any random number from 0-24 ensures a catch. -; for the others, a random number from 0-11 ensures a catch. - ld a, [wEnemyMonStatus] ;status ailments +; Pokémon can be caught more easily with a status ailment. +; Depending on the status ailment, a certain value will be subtracted from +; Rand1. Let this value be called Status. +; The larger Status is, the more easily the Pokémon can be caught. +; no status ailment: Status = 0 +; Burn/Paralysis/Poison: Status = 12 +; Freeze/Sleep: Status = 25 +; If Status is greater than Rand1, the Pokémon will be caught for sure. + ld a,[wEnemyMonStatus] and a - jr z, .noAilments - and 1 << FRZ | SLP ;is frozen and/or asleep? - ld c, 12 - jr z, .notFrozenOrAsleep - ld c, 25 + jr z,.skipAilmentValueSubtraction ; no ailments + and a, 1 << FRZ | SLP + ld c,12 + jr z,.notFrozenOrAsleep + ld c,25 .notFrozenOrAsleep ld a, b sub c - jp c, .BallSuccess - ld b, a -.noAilments - push bc ;save RANDOM number + jp c,.captured + ld b,a + +.skipAilmentValueSubtraction + push bc ; save (Rand1 - Status) + +; Calculate MaxHP * 255. xor a - ld [H_MULTIPLICAND], a - ld hl, wEnemyMonMaxHP - ld a, [hli] - ld [H_MULTIPLICAND + 1], a - ld a, [hl] - ld [H_MULTIPLICAND + 2], a - ld a, 255 - ld [H_MULTIPLIER], a - call Multiply ; MaxHP * 255 - ld a, [wcf91] + ld [H_MULTIPLICAND],a + ld hl,wEnemyMonMaxHP + ld a,[hli] + ld [H_MULTIPLICAND + 1],a + ld a,[hl] + ld [H_MULTIPLICAND + 2],a + ld a,255 + ld [H_MULTIPLIER],a + call Multiply + +; Determine BallFactor. It's 8 for Great Balls and 12 for the others. + ld a,[wcf91] cp GREAT_BALL - ld a, 12 ;any other BallFactor - jr nz, .next7 - ld a, 8 -.next7 - ld [H_DIVISOR], a - ld b, 4 ; number of bytes in dividend + ld a,12 + jr nz,.skip1 + ld a,8 + +.skip1 +; Note that the results of all division operations are floored. + +; Calculate (MaxHP * 255) / BallFactor. + ld [H_DIVISOR],a + ld b,4 ; number of bytes in dividend call Divide - ld hl, wEnemyMonHP - ld a, [hli] - ld b, a - ld a, [hl] -; explanation: we have a 16-bit value equal to [b << 8 | a]. -; This number is divided by 4. The result is 8 bit (reg. a). -; Always bigger than zero. +; Divide the enemy's current HP by 4. HP is not supposed to exceed 999 so +; the result should fit in a. If the division results in a quotient of 0, +; change it to 1. + ld hl,wEnemyMonHP + ld a,[hli] + ld b,a + ld a,[hl] srl b rr a srl b - rr a ; a = current HP / 4 + rr a and a - jr nz, .next8 + jr nz,.skip2 inc a -.next8 - ld [H_DIVISOR], a - ld b, 4 - call Divide ; ((MaxHP * 255) / BallFactor) / (CurHP / 4) - ld a, [H_QUOTIENT + 2] + +.skip2 + +; Let W = ((MaxHP * 255) / BallFactor) / max(HP / 4, 1). Calculate W. + ld [H_DIVISOR],a + ld b,4 + call Divide + +; If W > 255, store 255 in [H_QUOTIENT + 3]. +; Let X = min(W, 255) = [H_QUOTIENT + 3]. + ld a,[H_QUOTIENT + 2] and a - jr z, .next9 - ld a, 255 - ld [H_QUOTIENT + 3], a -.next9 - pop bc - ld a, [wEnemyMonCatchRate] ;enemy: Catch Rate + jr z,.skip3 + ld a,255 + ld [H_QUOTIENT + 3],a + +.skip3 + pop bc ; b = Rand1 - Status + +; If Rand1 - Status > CatchRate, the ball fails to capture the Pokémon. + ld a,[wEnemyMonCatchRate] cp b - jr c, .next10 - ld a, [H_QUOTIENT + 2] + jr c,.failedToCapture + +; If W > 255, the ball captures the Pokémon. + ld a,[H_QUOTIENT + 2] and a - jr nz, .BallSuccess ; if ((MaxHP * 255) / BallFactor) / (CurHP / 4) > 0x255, automatic success - call Random - ld b, a - ld a, [H_QUOTIENT + 3] + jr nz,.captured + + call Random ; Let this random number be called Rand2. + +; If Rand2 > X, the ball fails to capture the Pokémon. + ld b,a + ld a,[H_QUOTIENT + 3] cp b - jr c, .next10 -.BallSuccess - jr .BallSuccess2 + jr c,.failedToCapture -.next10 - ld a, [H_QUOTIENT + 3] - ld [wd11e], a +.captured + jr .skipShakeCalculations + +.failedToCapture + ld a,[H_QUOTIENT + 3] + ld [wPokeBallCaptureCalcTemp],a ; Save X. + +; Calculate CatchRate * 100. xor a - ld [H_MULTIPLICAND], a - ld [H_MULTIPLICAND + 1], a - ld a, [wEnemyMonCatchRate] ;enemy: Catch Rate - ld [H_MULTIPLICAND + 2], a - ld a, 100 - ld [H_MULTIPLIER], a - call Multiply ; CatchRate * 100 - ld a, [wcf91] - ld b, 255 + ld [H_MULTIPLICAND],a + ld [H_MULTIPLICAND + 1],a + ld a,[wEnemyMonCatchRate] + ld [H_MULTIPLICAND + 2],a + ld a,100 + ld [H_MULTIPLIER],a + call Multiply + +; Determine BallFactor2. +; Poké Ball: BallFactor2 = 255 +; Great Ball: BallFactor2 = 200 +; Ultra/Safari Ball: BallFactor2 = 150 + ld a,[wcf91] + ld b,255 cp POKE_BALL - jr z, .next11 - ld b, 200 + jr z,.skip4 + ld b,200 cp GREAT_BALL - jr z, .next11 - ld b, 150 + jr z,.skip4 + ld b,150 cp ULTRA_BALL - jr z, .next11 -.next11 - ld a, b - ld [H_DIVISOR], a - ld b, 4 + jr z,.skip4 + +.skip4 + +; Let Y = (CatchRate * 100) / BallFactor2. Calculate Y. + ld a,b + ld [H_DIVISOR],a + ld b,4 call Divide - ld a, [H_QUOTIENT + 2] + +; If Y > 255, there are 3 shakes. +; Note that this shouldn't be possible. +; The maximum value of Y is (255 * 100) / 150 = 170. + ld a,[H_QUOTIENT + 2] and a - ld b, $63 - jr nz, .next12 - ld a, [wd11e] - ld [H_MULTIPLIER], a + ld b,$63 ; 3 shakes + jr nz,.setAnimData + +; Calculate X * Y. + ld a,[wPokeBallCaptureCalcTemp] + ld [H_MULTIPLIER],a call Multiply - ld a, 255 - ld [H_DIVISOR], a - ld b, 4 + +; Calculate (X * Y) / 255. + ld a,255 + ld [H_DIVISOR],a + ld b,4 call Divide - ld a, [wEnemyMonStatus] ;status ailments + +; Determine Status2. +; no status ailment: Status2 = 0 +; Burn/Paralysis/Poison: Status2 = 5 +; Freeze/Sleep: Status2 = 10 + ld a,[wEnemyMonStatus] and a - jr z, .next13 + jr z,.skip5 and 1 << FRZ | SLP - ld b, 5 - jr z, .next14 - ld b, 10 -.next14 - ld a, [H_QUOTIENT + 3] + ld b,5 + jr z,.addAilmentValue + ld b,10 + +.addAilmentValue +; If the Pokémon has a status ailment, add Status2. + ld a,[H_QUOTIENT + 3] add b - ld [H_QUOTIENT + 3], a -.next13 - ld a, [H_QUOTIENT + 3] - cp 10 - ld b, $20 - jr c, .next12 - cp 30 - ld b, $61 - jr c, .next12 - cp 70 - ld b, $62 - jr c, .next12 - ld b, $63 -.next12 - ld a, b - ld [wPokeBallAnimData], a -.BallSuccess2 - ld c, 20 + ld [H_QUOTIENT + 3],a + +.skip5 +; Finally determine the number of shakes. +; Let Z = ((X * Y) / 255) + Status2 = [H_QUOTIENT + 3]. +; The number of shakes depend on the range Z is in. +; 0 ≤ Z < 10: 0 shakes (the ball misses) +; 10 ≤ Z < 30: 1 shake +; 30 ≤ Z < 70: 2 shakes +; 70 ≤ Z: 3 shakes + ld a,[H_QUOTIENT + 3] + cp a,10 + ld b,$20 + jr c,.setAnimData + cp a,30 + ld b,$61 + jr c,.setAnimData + cp a,70 + ld b,$62 + jr c,.setAnimData + ld b,$63 + +.setAnimData + ld a,b + ld [wPokeBallAnimData],a + +.skipShakeCalculations + ld c,20 call DelayFrames - ld a, TOSS_ANIM - ld [wAnimationID], a + +; Do the animation. + ld a,TOSS_ANIM + ld [wAnimationID],a xor a ld [H_WHOSETURN], a ld [wAnimationType], a @@ -347,48 +448,63 @@ ItemUseBall: ; d3ad (3:53ad) pop af ld [wcf91], a pop af - ld [wWhichPokemon], a - ld a, [wPokeBallAnimData] - cp $10 - ld hl, ItemUseBallText00 - jp z, .printText0 - cp $20 - ld hl, ItemUseBallText01 - jp z, .printText0 - cp $61 - ld hl, ItemUseBallText02 - jp z, .printText0 - cp $62 - ld hl, ItemUseBallText03 - jp z, .printText0 - cp $63 - ld hl, ItemUseBallText04 - jp z, .printText0 - ld hl, wEnemyMonHP ;current HP - ld a, [hli] + ld [wWhichPokemon],a + +; Determine the message to display from the animation. + ld a,[wPokeBallAnimData] + cp a,$10 + ld hl,ItemUseBallText00 + jp z,.printMessage + cp a,$20 + ld hl,ItemUseBallText01 + jp z,.printMessage + cp a,$61 + ld hl,ItemUseBallText02 + jp z,.printMessage + cp a,$62 + ld hl,ItemUseBallText03 + jp z,.printMessage + cp a,$63 + ld hl,ItemUseBallText04 + jp z,.printMessage + +; Save current HP. + ld hl,wEnemyMonHP + ld a,[hli] push af - ld a, [hli] - push af ;backup currentHP... + ld a,[hli] + push af + +; Save status ailment. inc hl - ld a, [hl] - push af ;...and status ailments + ld a,[hl] + push af + push hl - ld hl, wEnemyBattleStatus3 - bit Transformed, [hl] - jr z, .next15 - ld a, $4c - ld [wEnemyMonSpecies2], a - jr .next16 - -.next15 - set Transformed, [hl] - ld hl, wTransformedEnemyMonOriginalDVs - ld a, [wEnemyMonDVs] - ld [hli], a - ld a, [wEnemyMonDVs + 1] - ld [hl], a -.next16 - ld a, [wcf91] + +; If the Pokémon is transformed, the Pokémon is assumed to be a Ditto. +; This is a bug because a wild Pokémon could have used Transform via +; Mirror Move even though the only wild Pokémon that knows Transform is Ditto. + ld hl,wEnemyBattleStatus3 + bit Transformed,[hl] + jr z,.notTransformed + ld a,DITTO + ld [wEnemyMonSpecies2],a + jr .skip6 + +.notTransformed +; If the Pokémon is not transformed, set the transformed bit and copy the +; DVs to wTransformedEnemyMonOriginalDVs so that LoadEnemyMonData won't generate +; new DVs. + set Transformed,[hl] + ld hl,wTransformedEnemyMonOriginalDVs + ld a,[wEnemyMonDVs] + ld [hli],a + ld a,[wEnemyMonDVs + 1] + ld [hl],a + +.skip6 + ld a,[wcf91] push af ld a, [wEnemyMonSpecies2] ld [wcf91], a @@ -404,18 +520,20 @@ ItemUseBall: ; d3ad (3:53ad) pop af ld [hld], a pop af - ld [hl], a - ld a, [wEnemyMonSpecies] ;enemy - ld [wCapturedMonSpecies], a - ld [wcf91], a - ld [wd11e], a - ld a, [wBattleType] - cp $1 - jp z, .printText1 ; just barely out of reach for a relative jump - cp $4 - jr z, .printText1 - ld hl, ItemUseBallText05 + ld [hl],a + ld a,[wEnemyMonSpecies] + ld [wCapturedMonSpecies],a + ld [wcf91],a + ld [wd11e],a + ld a,[wBattleType] + cp BATTLE_TYPE_OLD_MAN ; is this the old man battle? + jp z,.oldManCaughtMon ; if so, don't give the player the caught Pokémon + cp BATTLE_TYPE_PIKACHU + jr z,.oldManCaughtMon ; same with Pikachu battle + ld hl,ItemUseBallText05 call PrintText + +; Add the caught Pokémon to the Pokédex. predef IndexToPokedex ld a, [wd11e] dec a @@ -431,51 +549,58 @@ ItemUseBall: ; d3ad (3:53ad) ld b, FLAG_SET predef FlagActionPredef pop af - and a - jr nz, .checkParty - ld hl, ItemUseBallText06 + + and a ; was the Pokémon already in the Pokédex? + jr nz,.skipShowingPokedexData ; if so, don't show the Pokédex data + + ld hl,ItemUseBallText06 call PrintText call ClearSprites - ld a, [wEnemyMonSpecies] ;caught mon_ID - ld [wd11e], a + ld a,[wEnemyMonSpecies] + ld [wd11e],a predef ShowPokedexData -.checkParty + +.skipShowingPokedexData ld a, $1 ld [wd49c], a ld a, $85 ld [wPikachuMood], a - ld a, [wPartyCount] - cp PARTY_LENGTH ;is party full? - jr z, .sendToBox + ld a,[wPartyCount] + cp PARTY_LENGTH ; is party full? + jr z,.sendToBox xor a ; PLAYER_PARTY_DATA ld [wMonDataLocation], a call ClearSprites ld hl, .emptyString call PrintText - call AddPartyMon ;add mon to Party - jr .End + call AddPartyMon + jr .done .sendToBox call ClearSprites call SendNewMonToBox - ld hl, ItemUseBallText07 + ld hl,ItemUseBallText07 CheckEvent EVENT_MET_BILL - jr nz, .sendToBox2 - ld hl, ItemUseBallText08 -.sendToBox2 + jr nz,.printTransferredToPCText + ld hl,ItemUseBallText08 +.printTransferredToPCText call PrintText - jr .End + jr .done + +.oldManCaughtMon + ld hl,ItemUseBallText05 -.printText1 - ld hl, ItemUseBallText05 -.printText0 +.printMessage call PrintText call ClearSprites -.End - ld a, [wBattleType] - and a - ret nz - ld hl, wNumBagItems + +.done + ld a,[wBattleType] + and a ; is this the old man battle? + ret nz ; if so, don't remove a ball from the bag + +; Remove a ball from the bag. + ld hl,wNumBagItems inc a ld [wItemQuantity], a jp RemoveItemFromInventory @@ -839,9 +964,9 @@ ItemUseMedicine: ; d8ae (3:58ae) jr nc, .healHP ; if it's a Full Restore or one of the potions ; fall through if it's one of the status-specifc healing items .cureStatusAilment - ld bc, 4 - add hl, bc ; hl now points to status - ld a, [wcf91] + ld bc,wPartyMon1Status - wPartyMon1 + add hl,bc ; hl now points to status + ld a,[wcf91] lb bc, ANTIDOTE_MSG, 1 << PSN cp ANTIDOTE jr z, .checkMonStatus @@ -877,10 +1002,10 @@ ItemUseMedicine: ; d8ae (3:58ae) ld hl, wPlayerBattleStatus3 res BadlyPoisoned, [hl] ; heal Toxic status pop hl - ld bc, 30 - add hl, bc ; hl now points to party stats - ld de, wBattleMonMaxHP - ld bc, 10 + ld bc,wPartyMon1Stats - wPartyMon1Status + add hl,bc ; hl now points to party stats + ld de,wBattleMonStats + ld bc,NUM_STATS * 2 call CopyData ; copy party stats to in-battle stat data predef DoubleOrHalveSelectedStats jp .doneHealing @@ -952,8 +1077,8 @@ ItemUseMedicine: ; d8ae (3:58ae) .compareCurrentHPToMaxHP push hl push bc - ld bc, 32 - add hl, bc ; hl now points to max HP + ld bc,wPartyMon1MaxHP - (wPartyMon1HP + 1) + add hl,bc ; hl now points to max HP pop bc ld a, [hli] cp b @@ -985,13 +1110,13 @@ ItemUseMedicine: ; d8ae (3:58ae) ld [wChannelSoundIDs + CH4], a push hl push de - ld bc, 32 - add hl, bc ; hl now points to max HP - ld a, [hli] - ld [wHPBarMaxHP+1], a - ld a, [hl] - ld [wHPBarMaxHP], a ; max HP stored at wHPBarMaxHP (2 bytes, big-endian) - ld a, [wPseudoItemID] + ld bc,wPartyMon1MaxHP - (wPartyMon1HP + 1) + add hl,bc ; hl now points to max HP + ld a,[hli] + ld [wHPBarMaxHP+1],a + ld a,[hl] + ld [wHPBarMaxHP],a ; max HP stored at wHPBarMaxHP (2 bytes, big-endian) + ld a,[wPseudoItemID] and a ; using Softboiled? jp z, .notUsingSoftboiled2 ; if using softboiled @@ -1018,8 +1143,8 @@ ItemUseMedicine: ; d8ae (3:58ae) ld [H_DIVISOR], a ld b, 2 ; number of bytes call Divide ; get 1/5 of max HP of pokemon that used Softboiled - ld bc, wPartyMon1HP - wPartyMon1MaxHP - add hl, bc ; hl now points to LSB of current HP of pokemon that used Softboiled + ld bc,(wPartyMon1HP + 1) - (wPartyMon1MaxHP + 1) + add hl,bc ; hl now points to LSB of current HP of pokemon that used Softboiled ; subtract 1/5 of max HP from current HP of pokemon that used Softboiled ld a, [H_QUOTIENT + 3] push af @@ -1096,16 +1221,16 @@ ItemUseMedicine: ; d8ae (3:58ae) .noCarry push de inc hl - ld d, h - ld e, l ; de now points to current HP - ld hl, 33 - add hl, de ; hl now points to max HP - ld a, [wcf91] - cp REVIVE - jr z, .setCurrentHPToHalfMaxHP - ld a, [hld] - ld b, a - ld a, [de] + ld d,h + ld e,l ; de now points to current HP + ld hl,(wPartyMon1MaxHP + 1) - (wPartyMon1HP + 1) + add hl,de ; hl now points to max HP + ld a,[wcf91] + cp a,REVIVE + jr z,.setCurrentHPToHalfMaxHP + ld a,[hld] + ld b,a + ld a,[de] sub b dec de ld b, [hl] @@ -1144,11 +1269,11 @@ ItemUseMedicine: ; d8ae (3:58ae) ld [wHPBarNewHP], a dec de .doneHealingPartyHP ; done updating the pokemon's current HP in the party data structure - ld a, [wcf91] - cp FULL_RESTORE - jr nz, .updateInBattleData - ld bc, -31 - add hl, bc + ld a,[wcf91] + cp a,FULL_RESTORE + jr nz,.updateInBattleData + ld bc,wPartyMon1Status - (wPartyMon1MaxHP + 1) + add hl,bc xor a ld [hl], a ; remove the status ailment in the party data .updateInBattleData @@ -1169,8 +1294,8 @@ ItemUseMedicine: ; d8ae (3:58ae) xor a ld [wBattleMonStatus], a ; remove the status ailment in the in-battle pokemon data .calculateHPBarCoords - ld hl, wOAMBuffer + $90 - ld bc, 2 * 20 + ld hl,wOAMBuffer + $90 + ld bc,2 * SCREEN_WIDTH inc d .calculateHPBarCoordsLoop add hl, bc @@ -1252,13 +1377,13 @@ ItemUseMedicine: ; d8ae (3:58ae) .useVitamin push hl - ld a, [hl] - ld [wd0b5], a - ld [wd11e], a - ld bc, 33 - add hl, bc ; hl now points to level - ld a, [hl] ; a = level - ld [wCurEnemyLVL], a ; store level + ld a,[hl] + ld [wd0b5],a + ld [wd11e],a + ld bc,wPartyMon1Level - wPartyMon1 + add hl,bc ; hl now points to level + ld a,[hl] ; a = level + ld [wCurEnemyLVL],a ; store level call GetMonHeader push de ld a, d @@ -1272,8 +1397,8 @@ ItemUseMedicine: ; d8ae (3:58ae) push hl sub HP_UP add a - ld bc, 17 - add hl, bc + ld bc,wPartyMon1HPExp - wPartyMon1 + add hl,bc add l ld l, a jr nc, .noCarry2 @@ -1323,21 +1448,21 @@ ItemUseMedicine: ; d8ae (3:58ae) jp GBPalWhiteOut .recalculateStats - ld bc, 34 - add hl, bc - ld d, h - ld e, l ; de now points to stats - ld bc, -18 - add hl, bc ; hl now points to byte 3 of experience - ld b, 1 + ld bc,wPartyMon1Stats - wPartyMon1 + add hl,bc + ld d,h + ld e,l ; de now points to stats + ld bc,(wPartyMon1Exp + 2) - wPartyMon1Stats + add hl,bc ; hl now points to LSB of experience + ld b,1 jp CalcStats ; recalculate stats .useRareCandy push hl - ld bc, 33 - add hl, bc ; hl now points to level - ld a, [hl] ; a = level - cp MAX_LEVEL - jr z, .vitaminNoEffect ; can't raise level above 100 + ld bc,wPartyMon1Level - wPartyMon1 + add hl,bc ; hl now points to level + ld a,[hl] ; a = level + cp a, MAX_LEVEL + jr z,.vitaminNoEffect ; can't raise level above 100 inc a ld [hl], a ; store incremented level ld [wCurEnemyLVL], a @@ -1347,8 +1472,8 @@ ItemUseMedicine: ; d8ae (3:58ae) callab CalcExperience ; calculate experience for next level and store it at $ff96 pop de pop hl - ld bc, -19 - add hl, bc ; hl now points to experience + ld bc,wPartyMon1Exp - wPartyMon1Level + add hl,bc ; hl now points to MSB of experience ; update experience to minimum for new level ld a, [hExperience] ld [hli], a @@ -1363,18 +1488,18 @@ ItemUseMedicine: ; d8ae (3:58ae) push af push de push hl - ld bc, 34 - add hl, bc ; hl now points to MSB of max HP - ld a, [hli] - ld b, a - ld c, [hl] + ld bc,wPartyMon1MaxHP - wPartyMon1 + add hl,bc ; hl now points to MSB of max HP + ld a,[hli] + ld b,a + ld c,[hl] pop hl push bc push hl call .recalculateStats pop hl - ld bc, 35 ; hl now points to LSB of max HP - add hl, bc + ld bc,(wPartyMon1MaxHP + 1) - wPartyMon1 + add hl,bc ; hl now points to LSB of max HP pop bc ld a, [hld] sub c @@ -1383,9 +1508,9 @@ ItemUseMedicine: ; d8ae (3:58ae) sbc b ld b, a ; bc = the amount of max HP gained from leveling up ; add the amount gained to the current HP - ld de, -32 - add hl, de ; hl now points to MSB of current HP - ld a, [hl] + ld de,(wPartyMon1HP + 1) - wPartyMon1MaxHP + add hl,de ; hl now points to LSB of current HP + ld a,[hl] add c ld [hld], a ld a, [hl] @@ -1575,10 +1700,10 @@ ItemUseCardKey: ; de57 (3:de57) xor a ld [wUnusedD71F], a call GetTileAndCoordsInFrontOfPlayer - ld a, [GetTileAndCoordsInFrontOfPlayer] ; $4586 - cp $18 - jr nz, .next0 - ld hl, CardKeyTable1 + ld a,[GetTileAndCoordsInFrontOfPlayer] + cp a,$18 + jr nz,.next0 + ld hl,CardKeyTable1 jr .next1 .next0 @@ -2153,12 +2278,12 @@ ItemUsePPRestore: ; e1f7 (3:61f7) cp ETHER jr nc, .useEther ; if Ether or Max Ether .usePPUp - ld bc, 21 - add hl, bc - ld a, [hl] ; move PP - cp 3 << 6 ; have 3 PP Ups already been used? - jr c, .PPNotMaxedOut - ld hl, PPMaxedOutText + ld bc,wPartyMon1PP - wPartyMon1Moves + add hl,bc + ld a,[hl] ; move PP + cp a,3 << 6 ; have 3 PP Ups already been used? + jr c,.PPNotMaxedOut + ld hl,PPMaxedOutText call PrintText jr .chooseMove diff --git a/engine/menu/link_menu.asm b/engine/menu/link_menu.asm index becefd47..4d0beb7e 100644 --- a/engine/menu/link_menu.asm +++ b/engine/menu/link_menu.asm @@ -776,7 +776,7 @@ LinkMenu: ; f580c (3d:580c) call DelayFrames ld hl, wd732 res 1, [hl] - ld a, [wAnimationID] + ld a, [wDefaultMap] ld [wDestinationMap], a callab SpecialWarpIn ld c, 20 diff --git a/engine/menu/main_menu.asm b/engine/menu/main_menu.asm index fb3fb6b9..669b2ba8 100755 --- a/engine/menu/main_menu.asm +++ b/engine/menu/main_menu.asm @@ -20,7 +20,7 @@ MainMenu: ; 5ba6 (1:5ba6) ld [hli],a ld [hli],a ld [hl],a - ld [wAnimationID],a + ld [wDefaultMap],a ld hl,wd72e res 6,[hl] call ClearScreen @@ -88,7 +88,7 @@ MainMenu: ; 5ba6 (1:5ba6) jp .mainMenuLoop .choseContinue call DisplayContinueGameInfo - ld hl,wd126 + ld hl,wCurrentMapScriptFlags set 5,[hl] .inputLoop xor a @@ -247,12 +247,12 @@ PrintNumOwnedMons: ; 5daa (1:5daa) jp PrintNumber PrintPlayTime: ; 5dbd (1:5dbd) - ld de, wPlayTimeHours + 1 + ld de, wPlayTimeHours lb bc, 1, 3 call PrintNumber ld [hl], $6d inc hl - ld de, wPlayTimeMinutes + 1 + ld de, wPlayTimeMinutes lb bc, LEADING_ZEROES | 1, 2 jp PrintNumber diff --git a/engine/menu/naming_screen.asm b/engine/menu/naming_screen.asm index de0c696c..0eacc8f6 100755 --- a/engine/menu/naming_screen.asm +++ b/engine/menu/naming_screen.asm @@ -164,7 +164,7 @@ DisplayNamingScreen: ; 6307 (1:6307) call RunDefaultPaletteCommand call GBPalNormal xor a - ld [wSubAnimTransform], a + ld [wAnimCounter], a ld hl, wd730 res 6, [hl] ld a, [wIsInBattle] diff --git a/engine/menu/start_sub_menus.asm b/engine/menu/start_sub_menus.asm index e2491253..792903b7 100755 --- a/engine/menu/start_sub_menus.asm +++ b/engine/menu/start_sub_menus.asm @@ -163,7 +163,7 @@ StartMenu_Pokemon: ; 11c36 (4:5c36) .surf ; 11d66 (4:5d66) bit 4,a ; does the player have the Soul Badge? jp z,.newBadgeRequired - callba CheckForForcedBikeSurf + callba IsSurfingAllowed ld hl,wd728 bit 1,[hl] res 1,[hl] @@ -618,12 +618,12 @@ DrawTrainerInfo: ; 1204c (4:604c) ld c,$e3 call PrintBCDNumber coord hl, 9, 6 - ld de,wPlayTimeHours + 1 ; hours + ld de,wPlayTimeHours ; hours lb bc, LEFT_ALIGN | 1, 3 call PrintNumber ld [hl],$d6 ; colon tile ID inc hl - ld de,wPlayTimeMinutes + 1 ; minutes + ld de,wPlayTimeMinutes ; minutes lb bc, LEADING_ZEROES | 1, 2 jp PrintNumber diff --git a/engine/oak_speech.asm b/engine/oak_speech.asm index 925ff913..2726c651 100755 --- a/engine/oak_speech.asm +++ b/engine/oak_speech.asm @@ -56,7 +56,7 @@ OakSpeech: ; 5e85 (1:5e85) ld a,1 ld [wItemQuantity],a call AddItemToInventory ; give one potion - ld a,[wAnimationID] + ld a,[wDefaultMap] ld [wDestinationMap],a call SpecialWarpIn xor a @@ -225,8 +225,8 @@ IntroDisplayPicCenteredOrUpperRight: ; 6010 (1:6010) call UncompressSpriteFromDE ld a, $0 call SwitchSRAMBankAndLatchClockData - ld hl,S_SPRITEBUFFER1 - ld de,S_SPRITEBUFFER0 + ld hl,sSpriteBuffer1 + ld de,sSpriteBuffer0 ld bc,$310 call CopyData call PrepareRTCDataAndDisableSRAM diff --git a/engine/overworld/card_key.asm b/engine/overworld/card_key.asm index 62d1d4fb..3560c8e8 100755 --- a/engine/overworld/card_key.asm +++ b/engine/overworld/card_key.asm @@ -50,7 +50,7 @@ PrintCardKeyText: ; 525d8 (14:65d8) .replaceCardKeyDoorTileBlock ld [wNewTileBlockID], a predef ReplaceTileBlock - ld hl, wd126 + ld hl, wCurrentMapScriptFlags set 5, [hl] ld a, SFX_GO_INSIDE jp PlaySound diff --git a/engine/overworld/cinnabar_lab.asm b/engine/overworld/cinnabar_lab.asm index f81324e0..f7c5e326 100755 --- a/engine/overworld/cinnabar_lab.asm +++ b/engine/overworld/cinnabar_lab.asm @@ -48,9 +48,9 @@ GiveFossilToCinnabarLab: ; 61006 (18:5006) .choseDomeFossil ld b, KABUTO .fossilSelected - ld [W_FOSSILITEM], a + ld [wFossilItem], a ld a, b - ld [W_FOSSILMON], a + ld [wFossilMon], a call LoadFossilItemAndMonName ld hl, LabFossil_610ae call PrintText @@ -60,7 +60,7 @@ GiveFossilToCinnabarLab: ; 61006 (18:5006) jr nz, .cancelledGivingFossil ld hl, LabFossil_610b3 call PrintText - ld a, [W_FOSSILITEM] + ld a, [wFossilItem] ld [hItemToRemoveID], a callba RemoveItemByID ld hl, LabFossil_610b8 @@ -113,11 +113,11 @@ PrintFossilsInBag: ; 610c2 (18:50c2) ; loads the names of the fossil item and the resulting mon LoadFossilItemAndMonName: ; 610eb (18:50eb) - ld a, [W_FOSSILMON] + ld a, [wFossilMon] ld [wd11e], a call GetMonName call CopyStringToCF4B - ld a, [W_FOSSILITEM] + ld a, [wFossilItem] ld [wd11e], a call GetItemName ret diff --git a/engine/overworld/movement.asm b/engine/overworld/movement.asm index 5f929ce3..d69e2fbc 100644 --- a/engine/overworld/movement.asm +++ b/engine/overworld/movement.asm @@ -118,8 +118,8 @@ UpdateNPCSprite: ; 4e3e (1:4e3e) ld l, a inc l ld a, [hl] ; c1x1 - bit 7, a - jp nz, InitializeSpriteFacingDirection ; c1x1 >= $80 + bit 7, a ; is the face player flag set? + jp nz, MakeNPCFacePlayer ld b, a ld a, [wFontLoaded] bit 0, a @@ -156,7 +156,7 @@ UpdateNPCSprite: ; 4e3e (1:4e3e) call LoadDEPlusA ; a = [wNPCMovementDirections + movement byte 1] cp $e0 jp z, ChangeFacingDirection - cp $ff + cp STAY jr nz, .next ; reached end of wNPCMovementDirections list ld [hl], a ; store $ff in movement byte 1, disabling scripted movement @@ -167,7 +167,7 @@ UpdateNPCSprite: ; 4e3e (1:4e3e) ld [wWastedByteCD3A], a ret .next - cp $fe + cp WALK jr nz, .asm_4ecb ; current NPC movement data is $fe. this seems buggy ld [hl], $1 ; set movement byte 1 to $1 @@ -359,7 +359,11 @@ notYetMoving: ; 4fc5 (1:4fc5) ld [hl], $0 ; c1x8 = 0 (walk animation frame) jp UpdateSpriteImage -InitializeSpriteFacingDirection: ; 4fd1 (1:4fd1) +MakeNPCFacePlayer: ; 507f (1:507f) +; Make an NPC face the player if the player has spoken to him or her. + +; Check if the behaviour of the NPC facing the player when spoken to is +; disabled. This is only done when rubbing the S.S. Anne captain's back. ld a, [wd72d] bit 5, a jr nz, notYetMoving diff --git a/engine/overworld/special_warps.asm b/engine/overworld/special_warps.asm index 29000d98..8c1b4159 100644 --- a/engine/overworld/special_warps.asm +++ b/engine/overworld/special_warps.asm @@ -69,7 +69,7 @@ LoadSpecialWarpData: ; 6073 (1:6073) xor a jr .done .notFirstMap - ld a, [wLastMap] + ld a, [wLastMap] ; this value is overwritten before it's ever read ld hl, wd732 bit 4, [hl] ; used dungeon warp (jumped down hole/waterfall)? jr nz, .usedDunegonWarp diff --git a/engine/pikachu_pic_animation.asm b/engine/pikachu_pic_animation.asm index 1ec102f1..a49e9bc2 100755 --- a/engine/pikachu_pic_animation.asm +++ b/engine/pikachu_pic_animation.asm @@ -1105,10 +1105,10 @@ DecompressRequestPikaPicAnimGFX: ; fe128 jr c, .failed ld a, b call UncompressSpriteFromDE - ld a, BANK(S_SPRITEBUFFER1) + ld a, BANK(sSpriteBuffer1) call SwitchSRAMBankAndLatchClockData - ld hl, S_SPRITEBUFFER1 - ld de, S_SPRITEBUFFER0 + ld hl, sSpriteBuffer1 + ld de, sSpriteBuffer0 ld bc, SPRITEBUFFERSIZE * 2 call CopyData call PrepareRTCDataAndDisableSRAM diff --git a/engine/predefs7.asm b/engine/predefs7.asm index 9138897f..1bf4c018 100755 --- a/engine/predefs7.asm +++ b/engine/predefs7.asm @@ -25,7 +25,7 @@ DisplayElevatorFloorMenu: ; 1c264 (7:4264) ld a, b ld [wListScrollOffset], a ret c - ld hl, wd126 + ld hl, wCurrentMapScriptFlags set 7, [hl] ld hl, wElevatorWarpMaps ld a, [wWhichPokemon] diff --git a/engine/titlescreen.asm b/engine/titlescreen.asm index c10e0315..c6068813 100755 --- a/engine/titlescreen.asm +++ b/engine/titlescreen.asm @@ -362,7 +362,7 @@ IncrementResetCounter: ; 4405 (1:4405) FillSpriteBuffer0WithAA: ; 4418 (1:4418) xor a call SwitchSRAMBankAndLatchClockData - ld hl, S_SPRITEBUFFER0 + ld hl, sSpriteBuffer0 ld bc, $20 ld a, $aa call FillMemory diff --git a/engine/town_map.asm b/engine/town_map.asm index 82e24d75..47812db0 100755 --- a/engine/town_map.asm +++ b/engine/town_map.asm @@ -454,8 +454,12 @@ WritePlayerOrBirdSpriteOAM: ; 712f6 (1c:52f6) WriteTownMapSpriteOAM: ; 71302 (1c:5302) push hl + +; Subtract 4 from c (X coord) and 4 from b (Y coord). However, the carry from c +; is added to b, so the net result is that only 3 is subtracted from b. lb hl, -4, -4 - add hl, bc ; subtract 4 from c (X coord) and 4 from b (Y coord) + add hl, bc + ld b, h ld c, l pop hl @@ -778,9 +778,9 @@ UncompressMonSprite:: ; 1407 (0:1407) ld bc, wMonHeader add hl, bc ld a, [hli] - ld [W_SPRITEINPUTPTR], a ; fetch sprite input pointer + ld [wSpriteInputPtr], a ; fetch sprite input pointer ld a, [hl] - ld [W_SPRITEINPUTPTR + 1], a + ld [wSpriteInputPtr + 1], a ; define (by index number) the bank that a pokemon's image is in ; index = Mew, bank 1 ; index = Kabutops fossil, bank $B @@ -867,15 +867,15 @@ LoadUncompressedSpriteData:: ; 1672 (0:1672) ld [H_SPRITEOFFSET], a ld a, $0 call SwitchSRAMBankAndLatchClockData - ld hl, S_SPRITEBUFFER0 + ld hl, sSpriteBuffer0 call ZeroSpriteBuffer ; zero buffer 0 - ld de, S_SPRITEBUFFER1 - ld hl, S_SPRITEBUFFER0 + ld de, sSpriteBuffer1 + ld hl, sSpriteBuffer0 call AlignSpriteDataCentered ; copy and align buffer 1 to 0 (containing the MSB of the 2bpp sprite) - ld hl, S_SPRITEBUFFER1 + ld hl, sSpriteBuffer1 call ZeroSpriteBuffer ; zero buffer 1 - ld de, S_SPRITEBUFFER2 - ld hl, S_SPRITEBUFFER1 + ld de, sSpriteBuffer2 + ld hl, sSpriteBuffer1 call AlignSpriteDataCentered ; copy and align buffer 2 to 1 (containing the LSB of the 2bpp sprite) call PrepareRTCDataAndDisableSRAM pop de @@ -927,9 +927,9 @@ InterlaceMergeSpriteBuffers:: ; 14c7 (0:14c7) ld a, $0 call SwitchSRAMBankAndLatchClockData push de - ld hl, S_SPRITEBUFFER2 + (SPRITEBUFFERSIZE - 1) ; destination: end of buffer 2 - ld de, S_SPRITEBUFFER1 + (SPRITEBUFFERSIZE - 1) ; source 2: end of buffer 1 - ld bc, S_SPRITEBUFFER0 + (SPRITEBUFFERSIZE - 1) ; source 1: end of buffer 0 + ld hl, sSpriteBuffer2 + (SPRITEBUFFERSIZE - 1) ; destination: end of buffer 2 + ld de, sSpriteBuffer1 + (SPRITEBUFFERSIZE - 1) ; source 2: end of buffer 1 + ld bc, sSpriteBuffer0 + (SPRITEBUFFERSIZE - 1) ; source 1: end of buffer 0 ld a, SPRITEBUFFERSIZE/2 ; $c4 ld [H_SPRITEINTERLACECOUNTER], a .interlaceLoop @@ -953,7 +953,7 @@ InterlaceMergeSpriteBuffers:: ; 14c7 (0:14c7) and a jr z, .notFlipped ld bc, 2*SPRITEBUFFERSIZE - ld hl, S_SPRITEBUFFER1 + ld hl, sSpriteBuffer1 .swapLoop swap [hl] ; if flipped swap nybbles in all bytes inc hl @@ -963,7 +963,7 @@ InterlaceMergeSpriteBuffers:: ; 14c7 (0:14c7) jr nz, .swapLoop .notFlipped pop hl - ld de, S_SPRITEBUFFER1 + ld de, sSpriteBuffer1 ld c, (2*SPRITEBUFFERSIZE)/16 ; $31, number of 16 byte chunks to be copied ld a, [H_LOADEDROMBANK] ld b, a @@ -2366,12 +2366,12 @@ ExecuteCurMapScriptInTable:: ; 30fc (0:30fc) bit 4, [hl] res 4, [hl] jr z, .useProvidedIndex ; test if map script index was overridden manually - ld a, [W_CURMAPSCRIPT] + ld a, [wCurMapScript] .useProvidedIndex pop hl - ld [W_CURMAPSCRIPT], a + ld [wCurMapScript], a call JumpTable - ld a, [W_CURMAPSCRIPT] + ld a, [wCurMapScript] ret LoadGymLeaderAndCityName:: ; 311b (0:311b) @@ -2467,7 +2467,7 @@ TalkToTrainer:: ; 3168 (0:3168) ret nz ; if the player talked to the trainer of his own volition call EngageMapTrainer - ld hl, W_CURMAPSCRIPT + ld hl, wCurMapScript inc [hl] ; increment map script index before StartTrainerBattle increments it again (next script function is usually EndTrainerBattle) jp StartTrainerBattle @@ -2493,7 +2493,7 @@ CheckFightingMapTrainers:: ; 31b5 (0:31b5) xor a ld [hJoyHeld], a call TrainerWalkUpToPlayer_Bank0 - ld hl, W_CURMAPSCRIPT + ld hl, wCurMapScript inc [hl] ; increment map script index (next script function is usually DisplayEnemyTrainerTextAndStartBattle) ret @@ -2517,12 +2517,12 @@ StartTrainerBattle:: ; 31f9 (0:31f9) set 7, [hl] ld hl, wd72e set 1, [hl] - ld hl, W_CURMAPSCRIPT + ld hl, wCurMapScript inc [hl] ; increment map script index (next script function is usually EndTrainerBattle) ret EndTrainerBattle:: ; 3211 (0:3211) - ld hl, wd126 + ld hl, wCurrentMapScriptFlags set 5, [hl] set 6, [hl] ld hl, wd72d @@ -2538,7 +2538,7 @@ EndTrainerBattle:: ; 3211 (0:3211) ld c, a ld b, FLAG_SET call TrainerFlagAction ; flag trainer as fought - ld a, [W_ENEMYMONORTRAINERCLASS] + ld a, [wEnemyMonOrTrainerClass] cp 200 jr nc, .skipRemoveSprite ; test if trainer was fought (in that case skip removing the corresponding sprite) ld hl, wMissableObjectList @@ -2561,7 +2561,7 @@ ResetButtonPressedAndMapScript:: ; 325d (0:325d) ld [hJoyHeld], a ld [hJoyPressed], a ld [hJoyReleased], a - ld [W_CURMAPSCRIPT], a ; reset battle status + ld [wCurMapScript], a ; reset battle status ret ; calls TrainerWalkUpToPlayer @@ -2572,7 +2572,7 @@ TrainerWalkUpToPlayer_Bank0:: ; 326b (0:326b) InitBattleEnemyParameters:: ; 3273 (0:3273) ld a, [wEngagedTrainerClass] ld [wCurOpponent], a - ld [W_ENEMYMONORTRAINERCLASS], a + ld [wEnemyMonOrTrainerClass], a cp 200 ld a, [wEngagedTrainerSet] jr c, .noTrainer @@ -3338,7 +3338,7 @@ LoadHpBarAndStatusTilePatterns:: ; 36c3 (0:36c3) UncompressSpriteFromDE:: ; 36e3 (0:36e3) ; Decompress pic at a:de. - ld hl, W_SPRITEINPUTPTR + ld hl, wSpriteInputPtr ld [hl], e inc hl ld [hl], d @@ -3362,7 +3362,7 @@ LoadScreenTilesFromBuffer2DisableBGTransfer:: ; 3700 (0:3700) ld [H_AUTOBGTRANSFERENABLED], a ld hl, wTileMapBackup2 coord de, 0, 0 - ld bc, $168 + ld bc, SCREEN_WIDTH * SCREEN_HEIGHT jp CopyData SaveScreenTilesToBuffer1:: ; 370f (0:370f) @@ -4926,9 +4926,9 @@ const_value = 1 add_tx_pre WhatGoesAroundComesAroundText ; 3A add_tx_pre NewBicycleText ; 3B add_tx_pre IndigoPlateauStatues ; 3C XXX unused - add_tx_pre VermilionGymTrashSuccesText1 ; 3D - add_tx_pre VermilionGymTrashSuccesText2 ; 3E - add_tx_pre VermilionGymTrashSuccesText3 ; 3F + add_tx_pre VermilionGymTrashSuccessText1 ; 3D + add_tx_pre VermilionGymTrashSuccessText2 ; 3E + add_tx_pre VermilionGymTrashSuccessText3 ; 3F add_tx_pre VermilionGymTrashFailText ; 40 add_tx_pre TownMapText ; 41 add_tx_pre BookOrSculptureText ; 42 diff --git a/home/overworld.asm b/home/overworld.asm index f29cfd51..e80b829c 100644 --- a/home/overworld.asm +++ b/home/overworld.asm @@ -34,7 +34,7 @@ EnterMap:: ; 01d7 (0:01d7) ld hl, wd72d res 5, [hl] call UpdateSprites - ld hl, wd126 + ld hl, wCurrentMapScriptFlags set 5, [hl] set 6, [hl] xor a @@ -279,7 +279,7 @@ OverworldLoopLessDelay:: ; 0245 (0:0245) res 6, [hl] ld hl, wFlags_D733 res 3, [hl] - ld hl, wd126 + ld hl, wCurrentMapScriptFlags set 5, [hl] set 6, [hl] xor a @@ -531,7 +531,7 @@ CheckMapConnections:: ; 05db (0:05db) ld a, [wXCoord] cp $ff jr nz, .checkEastMap - ld a, [W_MAPCONN3PTR] + ld a, [wMapConn3Ptr] ld [wCurMap], a ld a, [wWestConnectedMapXAlignment] ; new X coordinate upon entering west map ld [wXCoord], a @@ -568,7 +568,7 @@ CheckMapConnections:: ; 05db (0:05db) ld a, [wCurrentMapWidth2] ; map width cp b jr nz, .checkNorthMap - ld a, [W_MAPCONN4PTR] + ld a, [wMapConn4Ptr] ld [wCurMap], a ld a, [wEastConnectedMapXAlignment] ; new X coordinate upon entering east map ld [wXCoord], a @@ -604,7 +604,7 @@ CheckMapConnections:: ; 05db (0:05db) ld a, [wYCoord] cp $ff jr nz, .checkSouthMap - ld a, [W_MAPCONN1PTR] + ld a, [wMapConn1Ptr] ld [wCurMap], a ld a, [wNorthConnectedMapYAlignment] ; new Y coordinate upon entering north map ld [wYCoord], a @@ -632,7 +632,7 @@ CheckMapConnections:: ; 05db (0:05db) ld a, [wCurrentMapHeight2] cp b jr nz, .didNotEnterConnectedMap - ld a, [W_MAPCONN2PTR] + ld a, [wMapConn2Ptr] ld [wCurMap], a ld a, [wSouthConnectedMapYAlignment] ; new Y coordinate upon entering south map ld [wYCoord], a @@ -901,9 +901,9 @@ LoadTileBlockMap:: ; 083c (0:083c) add hl, bc ld c, MAP_BORDER add hl, bc ; this puts us past the (west) border - ld a, [W_MAPDATAPTR] ; tile map pointer + ld a, [wMapDataPtr] ; tile map pointer ld e, a - ld a, [W_MAPDATAPTR + 1] + ld a, [wMapDataPtr + 1] ld d, a ; de = tile map pointer ld a, [wCurMapHeight] ld b, a @@ -928,7 +928,7 @@ LoadTileBlockMap:: ; 083c (0:083c) dec b jr nz, .rowLoop .northConnection - ld a, [W_MAPCONN1PTR] + ld a, [wMapConn1Ptr] cp $ff jr z, .southConnection call SwitchToMapRomBank @@ -946,7 +946,7 @@ LoadTileBlockMap:: ; 083c (0:083c) ld [hNorthSouthConnectedMapWidth], a call LoadNorthSouthConnectionsTileMap .southConnection - ld a, [W_MAPCONN2PTR] + ld a, [wMapConn2Ptr] cp $ff jr z, .westConnection call SwitchToMapRomBank @@ -964,7 +964,7 @@ LoadTileBlockMap:: ; 083c (0:083c) ld [hNorthSouthConnectedMapWidth], a call LoadNorthSouthConnectionsTileMap .westConnection - ld a, [W_MAPCONN3PTR] + ld a, [wMapConn3Ptr] cp $ff jr z, .eastConnection call SwitchToMapRomBank @@ -982,7 +982,7 @@ LoadTileBlockMap:: ; 083c (0:083c) ld [hEastWestConnectedMapWidth], a call LoadEastWestConnectionsTileMap .eastConnection - ld a, [W_MAPCONN4PTR] + ld a, [wMapConn4Ptr] cp $ff jr z, .done call SwitchToMapRomBank @@ -1078,7 +1078,7 @@ IsSpriteOrSignInFrontOfPlayer:: ; 095e (0:095e) .extendRangeOverCounter ; check if the player is front of a counter in a pokemon center, pokemart, etc. and if so, extend the range at which he can talk to the NPC predef GetTileAndCoordsInFrontOfPlayer ; get the tile in front of the player in c - ld hl, W_TILESETTALKINGOVERTILES ; list of tiles that extend talking range (counter tiles) + ld hl, wTileSetTalkingOverTiles ; list of tiles that extend talking range (counter tiles) ld b, 3 ld d, $20 ; talking range in pixels (long range) .counterTilesLoop @@ -1169,8 +1169,8 @@ IsSpriteInFrontOfPlayer2:: ; 0985 (0:0985) ld a, l and $f0 inc a - ld l, a - set 7, [hl] + ld l, a ; hl = $c1x1 + set 7, [hl] ; set flag to make the sprite face the player ld a, e ld [hSpriteIndexOrTextID], a ld a, [hSpriteIndexOrTextID] ; possible useless read because a already has the value of the read address @@ -1584,9 +1584,9 @@ ScheduleWestColumnRedraw:: ; 0c0c (0:0c0c) ; Input: c = tile block ID, hl = destination address DrawTileBlock:: ; 0c21 (0:0c21) push hl - ld a, [W_TILESETBLOCKSPTR] ; pointer to tiles + ld a, [wTileSetBlocksPtr] ; pointer to tiles ld l, a - ld a, [W_TILESETBLOCKSPTR + 1] + ld a, [wTileSetBlocksPtr + 1] ld h, a ld a, c swap a @@ -1779,7 +1779,7 @@ RunMapScript:: ; 0d2c (0:0d2c) call RunNPCMovementScript ld a, [wCurMap] ; current map number call SwitchToMapRomBank ; change to the ROM bank the map's data is in - ld hl, W_MAPSCRIPTPTR + ld hl, wMapScriptPtr ld a, [hli] ld h, [hl] ld l, a @@ -1873,32 +1873,32 @@ asm_0dbd jr nz, .copyFixedHeaderLoop ; initialize all the connected maps to disabled at first, before loading the actual values ld a, $ff - ld [W_MAPCONN1PTR], a - ld [W_MAPCONN2PTR], a - ld [W_MAPCONN3PTR], a - ld [W_MAPCONN4PTR], a + ld [wMapConn1Ptr], a + ld [wMapConn2Ptr], a + ld [wMapConn3Ptr], a + ld [wMapConn4Ptr], a ; copy connection data (if any) to WRAM - ld a, [W_MAPCONNECTIONS] + ld a, [wMapConnections] ld b, a .checkNorth bit 3, b jr z, .checkSouth - ld de, W_MAPCONN1PTR + ld de, wMapConn1Ptr call CopyMapConnectionHeader .checkSouth bit 2, b jr z, .checkWest - ld de, W_MAPCONN2PTR + ld de, wMapConn2Ptr call CopyMapConnectionHeader .checkWest bit 1, b jr z, .checkEast - ld de, W_MAPCONN3PTR + ld de, wMapConn3Ptr call CopyMapConnectionHeader .checkEast bit 0, b jr z, .getObjectDataPointer - ld de, W_MAPCONN4PTR + ld de, wMapConn4Ptr call CopyMapConnectionHeader .getObjectDataPointer ld a, [hli] diff --git a/home/pic.asm b/home/pic.asm index 25a2ceb5..37abaecd 100644 --- a/home/pic.asm +++ b/home/pic.asm @@ -1,5 +1,5 @@ ; bankswitches and runs _UncompressSpriteData -; bank is given in a, sprite input stream is pointed to in W_SPRITEINPUTPTR +; bank is given in a, sprite input stream is pointed to in wSpriteInputPtr UncompressSpriteData:: ; 23f8 (0:23f8) ld b, a ld a, [H_LOADEDROMBANK] @@ -16,51 +16,51 @@ UncompressSpriteData:: ; 23f8 (0:23f8) ; initializes necessary data to load a sprite and runs UncompressSpriteDataLoop _UncompressSpriteData:: ; 2410 (0:2410) - ld hl, S_SPRITEBUFFER1 + ld hl, sSpriteBuffer1 ld c, (2*SPRITEBUFFERSIZE) % $100 ld b, (2*SPRITEBUFFERSIZE) / $100 xor a call FillMemory ; clear sprite buffer 1 and 2 ld a, $1 - ld [W_SPRITEINPUTBITCOUNTER], a + ld [wSpriteInputBitCounter], a ld a, $3 - ld [W_SPRITEOUTPUTBITOFFSET], a + ld [wSpriteOutputBitOffset], a xor a - ld [W_SPRITECURPOSX], a - ld [W_SPRITECURPOSY], a - ld [W_SPRITELOADFLAGS], a + ld [wSpriteCurPosX], a + ld [wSpriteCurPosY], a + ld [wSpriteLoadFlags], a call ReadNextInputByte ; first byte of input determines sprite width (high nybble) and height (low nybble) in tiles (8x8 pixels) ld b, a and $f add a add a add a - ld [W_SPRITEHEIGHT], a + ld [wSpriteHeight], a ld a, b swap a and $f add a add a add a - ld [W_SPRITEWITDH], a + ld [wSpriteWidth], a call ReadNextInputBit - ld [W_SPRITELOADFLAGS], a ; initialite bit1 to 0 and bit0 to the first input bit - ; this will load two chunks of data to S_SPRITEBUFFER1 and S_SPRITEBUFFER2 + ld [wSpriteLoadFlags], a ; initialite bit1 to 0 and bit0 to the first input bit + ; this will load two chunks of data to sSpriteBuffer1 and sSpriteBuffer2 ; bit 0 decides in which one the first chunk is placed ; fall through -; uncompresses a chunk from the sprite input data stream (pointed to at wd0da) into S_SPRITEBUFFER1 or S_SPRITEBUFFER2 +; uncompresses a chunk from the sprite input data stream (pointed to at wd0da) into sSpriteBuffer1 or sSpriteBuffer2 ; each chunk is a 1bpp sprite. A 2bpp sprite consist of two chunks which are merged afterwards ; note that this is an endless loop which is terminated during a call to MoveToNextBufferPosition by manipulating the stack UncompressSpriteDataLoop:: ; 244c (0:244c) - ld hl, S_SPRITEBUFFER1 - ld a, [W_SPRITELOADFLAGS] + ld hl, sSpriteBuffer1 + ld a, [wSpriteLoadFlags] bit 0, a jr z, .useSpriteBuffer1 ; check which buffer to use - ld hl, S_SPRITEBUFFER2 + ld hl, sSpriteBuffer2 .useSpriteBuffer1 call StoreSpriteOutputPointer - ld a, [W_SPRITELOADFLAGS] + ld a, [wSpriteLoadFlags] bit 1, a jr z, .startDecompression ; check if last iteration call ReadNextInputBit ; if last chunk, read 1-2 bit unpacking mode @@ -69,7 +69,7 @@ UncompressSpriteDataLoop:: ; 244c (0:244c) call ReadNextInputBit ; 1 0 -> mode 1 inc a ; 1 1 -> mode 2 .unpackingMode0 - ld [W_SPRITEUNPACKMODE], a + ld [wSpriteUnpackMode], a .startDecompression call ReadNextInputBit and a @@ -143,69 +143,69 @@ UncompressSpriteDataLoop:: ; 244c (0:244c) ; also cancels the calling function if the all output is done (by removing the return pointer from stack) ; and calls postprocessing functions according to the unpack mode MoveToNextBufferPosition:: ; 24ce (0:24ce) - ld a, [W_SPRITEHEIGHT] + ld a, [wSpriteHeight] ld b, a - ld a, [W_SPRITECURPOSY] + ld a, [wSpriteCurPosY] inc a cp b jr z, .curColumnDone - ld [W_SPRITECURPOSY], a - ld a, [W_SPRITEOUTPUTPTR] + ld [wSpriteCurPosY], a + ld a, [wSpriteOutputPtr] inc a - ld [W_SPRITEOUTPUTPTR], a + ld [wSpriteOutputPtr], a ret nz - ld a, [W_SPRITEOUTPUTPTR+1] + ld a, [wSpriteOutputPtr+1] inc a - ld [W_SPRITEOUTPUTPTR+1], a + ld [wSpriteOutputPtr+1], a ret .curColumnDone xor a - ld [W_SPRITECURPOSY], a - ld a, [W_SPRITEOUTPUTBITOFFSET] + ld [wSpriteCurPosY], a + ld a, [wSpriteOutputBitOffset] and a jr z, .bitOffsetsDone dec a - ld [W_SPRITEOUTPUTBITOFFSET], a - ld hl, W_SPRITEOUTPUTPTRCACHED + ld [wSpriteOutputBitOffset], a + ld hl, wSpriteOutputPtrCached ld a, [hli] - ld [W_SPRITEOUTPUTPTR], a + ld [wSpriteOutputPtr], a ld a, [hl] - ld [W_SPRITEOUTPUTPTR+1], a + ld [wSpriteOutputPtr+1], a ret .bitOffsetsDone ld a, $3 - ld [W_SPRITEOUTPUTBITOFFSET], a - ld a, [W_SPRITECURPOSX] + ld [wSpriteOutputBitOffset], a + ld a, [wSpriteCurPosX] add $8 - ld [W_SPRITECURPOSX], a + ld [wSpriteCurPosX], a ld b, a - ld a, [W_SPRITEWITDH] + ld a, [wSpriteWidth] cp b jr z, .allColumnsDone - ld a, [W_SPRITEOUTPUTPTR] + ld a, [wSpriteOutputPtr] ld l, a - ld a, [W_SPRITEOUTPUTPTR+1] + ld a, [wSpriteOutputPtr+1] ld h, a inc hl jp StoreSpriteOutputPointer .allColumnsDone pop hl xor a - ld [W_SPRITECURPOSX], a - ld a, [W_SPRITELOADFLAGS] + ld [wSpriteCurPosX], a + ld a, [wSpriteLoadFlags] bit 1, a jr nz, .done ; test if there is one more sprite to go xor $1 set 1, a - ld [W_SPRITELOADFLAGS], a + ld [wSpriteLoadFlags], a jp UncompressSpriteDataLoop .done jp UnpackSprite -; writes 2 bits (from a) to the output buffer (pointed to from W_SPRITEOUTPUTPTR) +; writes 2 bits (from a) to the output buffer (pointed to from wSpriteOutputPtr) WriteSpriteBitsToBuffer:: ; 253f (0:253f) ld e, a - ld a, [W_SPRITEOUTPUTBITOFFSET] + ld a, [wSpriteOutputBitOffset] and a jr z, .offset0 cp $2 @@ -221,9 +221,9 @@ WriteSpriteBitsToBuffer:: ; 253f (0:253f) .offset2 swap e .offset0 - ld a, [W_SPRITEOUTPUTPTR] + ld a, [wSpriteOutputPtr] ld l, a - ld a, [W_SPRITEOUTPUTPTR+1] + ld a, [wSpriteOutputPtr+1] ld h, a ld a, [hl] or e @@ -232,32 +232,32 @@ WriteSpriteBitsToBuffer:: ; 253f (0:253f) ; reads next bit from input stream and returns it in a ReadNextInputBit:: ; 2566 (0:2566) - ld a, [W_SPRITEINPUTBITCOUNTER] + ld a, [wSpriteInputBitCounter] dec a jr nz, .curByteHasMoreBitsToRead call ReadNextInputByte - ld [W_SPRITEINPUTCURBYTE], a + ld [wSpriteInputCurByte], a ld a, $8 .curByteHasMoreBitsToRead - ld [W_SPRITEINPUTBITCOUNTER], a - ld a, [W_SPRITEINPUTCURBYTE] + ld [wSpriteInputBitCounter], a + ld a, [wSpriteInputCurByte] rlca - ld [W_SPRITEINPUTCURBYTE], a + ld [wSpriteInputCurByte], a and $1 ret ; reads next byte from input stream and returns it in a ReadNextInputByte:: ; 2581 (0:2581) - ld a, [W_SPRITEINPUTPTR] + ld a, [wSpriteInputPtr] ld l, a - ld a, [W_SPRITEINPUTPTR+1] + ld a, [wSpriteInputPtr+1] ld h, a ld a, [hli] ld b, a ld a, l - ld [W_SPRITEINPUTPTR], a + ld [wSpriteInputPtr], a ld a, h - ld [W_SPRITEINPUTPTR+1], a + ld [wSpriteInputPtr+1], a ld a, b ret @@ -282,22 +282,22 @@ LengthEncodingOffsetList:: ; 2595 (0:2595) ; unpacks the sprite data depending on the unpack mode UnpackSprite:: ; 25b5 (0:25b5) - ld a, [W_SPRITEUNPACKMODE] + ld a, [wSpriteUnpackMode] cp $2 jp z, UnpackSpriteMode2 and a jp nz, XorSpriteChunks - ld hl, S_SPRITEBUFFER1 + ld hl, sSpriteBuffer1 call SpriteDifferentialDecode - ld hl, S_SPRITEBUFFER2 + ld hl, sSpriteBuffer2 ; fall through ; decodes differential encoded sprite data ; input bit value 0 preserves the current bit value and input bit value 1 toggles it (starting from initial value 0). SpriteDifferentialDecode:: ; 25ca (0:25ca) xor a - ld [W_SPRITECURPOSX], a - ld [W_SPRITECURPOSY], a + ld [wSpriteCurPosX], a + ld [wSpriteCurPosY], a call StoreSpriteOutputPointer ld a, [wSpriteFlipped] and a @@ -310,18 +310,18 @@ SpriteDifferentialDecode:: ; 25ca (0:25ca) ld de, DecodeNybble1Table .storeDecodeTablesPointers ld a, l - ld [W_SPRITEDECODETABLE0PTR], a + ld [wSpriteDecodeTable0Ptr], a ld a, h - ld [W_SPRITEDECODETABLE0PTR+1], a + ld [wSpriteDecodeTable0Ptr+1], a ld a, e - ld [W_SPRITEDECODETABLE1PTR], a + ld [wSpriteDecodeTable1Ptr], a ld a, d - ld [W_SPRITEDECODETABLE1PTR+1], a + ld [wSpriteDecodeTable1Ptr+1], a ld e, $0 ; last decoded nybble, initialized to 0 .decodeNextByteLoop - ld a, [W_SPRITEOUTPUTPTR] + ld a, [wSpriteOutputPtr] ld l, a - ld a, [W_SPRITEOUTPUTPTR+1] + ld a, [wSpriteOutputPtr+1] ld h, a ld a, [hl] ld b, a @@ -335,47 +335,47 @@ SpriteDifferentialDecode:: ; 25ca (0:25ca) call DifferentialDecodeNybble ; decode low nybble or d ld b, a - ld a, [W_SPRITEOUTPUTPTR] + ld a, [wSpriteOutputPtr] ld l, a - ld a, [W_SPRITEOUTPUTPTR+1] + ld a, [wSpriteOutputPtr+1] ld h, a ld a, b ld [hl], a ; write back decoded data - ld a, [W_SPRITEHEIGHT] + ld a, [wSpriteHeight] add l ; move on to next column jr nc, .noCarry inc h .noCarry - ld [W_SPRITEOUTPUTPTR], a + ld [wSpriteOutputPtr], a ld a, h - ld [W_SPRITEOUTPUTPTR+1], a - ld a, [W_SPRITECURPOSX] + ld [wSpriteOutputPtr+1], a + ld a, [wSpriteCurPosX] add $8 - ld [W_SPRITECURPOSX], a + ld [wSpriteCurPosX], a ld b, a - ld a, [W_SPRITEWITDH] + ld a, [wSpriteWidth] cp b jr nz, .decodeNextByteLoop ; test if current row is done xor a ld e, a - ld [W_SPRITECURPOSX], a - ld a, [W_SPRITECURPOSY] ; move on to next row + ld [wSpriteCurPosX], a + ld a, [wSpriteCurPosY] ; move on to next row inc a - ld [W_SPRITECURPOSY], a + ld [wSpriteCurPosY], a ld b, a - ld a, [W_SPRITEHEIGHT] + ld a, [wSpriteHeight] cp b jr z, .done ; test if all rows finished - ld a, [W_SPRITEOUTPUTPTRCACHED] + ld a, [wSpriteOutputPtrCached] ld l, a - ld a, [W_SPRITEOUTPUTPTRCACHED+1] + ld a, [wSpriteOutputPtrCached+1] ld h, a inc hl call StoreSpriteOutputPointer jr .decodeNextByteLoop .done xor a - ld [W_SPRITECURPOSY], a + ld [wSpriteCurPosY], a ret ; decodes the nybble stored in a. Last decoded data is assumed to be in e (needed to determine if initial value is 0 or 1) @@ -396,14 +396,14 @@ DifferentialDecodeNybble:: ; 2663 (0:2663) .selectLookupTable ld e, l jr nz, .initialValue1 ; load the appropriate table - ld a, [W_SPRITEDECODETABLE0PTR] + ld a, [wSpriteDecodeTable0Ptr] ld l, a - ld a, [W_SPRITEDECODETABLE0PTR+1] + ld a, [wSpriteDecodeTable0Ptr+1] jr .tableLookup .initialValue1 - ld a, [W_SPRITEDECODETABLE1PTR] + ld a, [wSpriteDecodeTable1Ptr] ld l, a - ld a, [W_SPRITEDECODETABLE1PTR+1] + ld a, [wSpriteDecodeTable1Ptr+1] .tableLookup ld h, a ld a, e @@ -461,22 +461,22 @@ DecodeNybble1TableFlipped:: ; 26b5 (0:26b5) ; combines the two loaded chunks with xor (the chunk loaded second is the destination). The source chunk is differeintial decoded beforehand. XorSpriteChunks:: ; 26bd (0:26bd) xor a - ld [W_SPRITECURPOSX], a - ld [W_SPRITECURPOSY], a + ld [wSpriteCurPosX], a + ld [wSpriteCurPosY], a call ResetSpriteBufferPointers - ld a, [W_SPRITEOUTPUTPTR] ; points to buffer 1 or 2, depending on flags + ld a, [wSpriteOutputPtr] ; points to buffer 1 or 2, depending on flags ld l, a - ld a, [W_SPRITEOUTPUTPTR+1] + ld a, [wSpriteOutputPtr+1] ld h, a call SpriteDifferentialDecode ; decode buffer 1 or 2, depending on flags call ResetSpriteBufferPointers - ld a, [W_SPRITEOUTPUTPTR] ; source buffer, points to buffer 1 or 2, depending on flags + ld a, [wSpriteOutputPtr] ; source buffer, points to buffer 1 or 2, depending on flags ld l, a - ld a, [W_SPRITEOUTPUTPTR+1] + ld a, [wSpriteOutputPtr+1] ld h, a - ld a, [W_SPRITEOUTPUTPTRCACHED] ; destination buffer, points to buffer 2 or 1, depending on flags + ld a, [wSpriteOutputPtrCached] ; destination buffer, points to buffer 2 or 1, depending on flags ld e, a - ld a, [W_SPRITEOUTPUTPTRCACHED+1] + ld a, [wSpriteOutputPtrCached+1] ld d, a .xorChunksLoop ld a, [wSpriteFlipped] @@ -503,24 +503,24 @@ XorSpriteChunks:: ; 26bd (0:26bd) xor b ld [de], a inc de - ld a, [W_SPRITECURPOSY] + ld a, [wSpriteCurPosY] inc a - ld [W_SPRITECURPOSY], a ; go to next row + ld [wSpriteCurPosY], a ; go to next row ld b, a - ld a, [W_SPRITEHEIGHT] + ld a, [wSpriteHeight] cp b jr nz, .xorChunksLoop ; test if column finished xor a - ld [W_SPRITECURPOSY], a - ld a, [W_SPRITECURPOSX] + ld [wSpriteCurPosY], a + ld a, [wSpriteCurPosX] add $8 - ld [W_SPRITECURPOSX], a ; go to next column + ld [wSpriteCurPosX], a ; go to next column ld b, a - ld a, [W_SPRITEWITDH] + ld a, [wSpriteWidth] cp b jr nz, .xorChunksLoop ; test if all columns finished xor a - ld [W_SPRITECURPOSX], a + ld [wSpriteCurPosX], a ret ; reverses the bits in the nybble given in register a @@ -534,26 +534,26 @@ ReverseNybble:: ; 272d (0:272d) ld a, [de] ret -; resets sprite buffer pointers to buffer 1 and 2, depending on W_SPRITELOADFLAGS +; resets sprite buffer pointers to buffer 1 and 2, depending on wSpriteLoadFlags ResetSpriteBufferPointers:: ; 2737 (0:2737) - ld a, [W_SPRITELOADFLAGS] ; wd0a8 + ld a, [wSpriteLoadFlags] ; wd0a8 bit 0, a jr nz, .buffer2Selected - ld de, S_SPRITEBUFFER1 - ld hl, S_SPRITEBUFFER2 + ld de, sSpriteBuffer1 + ld hl, sSpriteBuffer2 jr .storeBufferPointers .buffer2Selected - ld de, S_SPRITEBUFFER2 - ld hl, S_SPRITEBUFFER1 + ld de, sSpriteBuffer2 + ld hl, sSpriteBuffer1 .storeBufferPointers ld a, l - ld [W_SPRITEOUTPUTPTR], a + ld [wSpriteOutputPtr], a ld a, h - ld [W_SPRITEOUTPUTPTR+1], a + ld [wSpriteOutputPtr+1], a ld a, e - ld [W_SPRITEOUTPUTPTRCACHED], a + ld [wSpriteOutputPtrCached], a ld a, d - ld [W_SPRITEOUTPUTPTRCACHED+1], a + ld [wSpriteOutputPtrCached+1], a ret ; maps each nybble to its reverse @@ -567,9 +567,9 @@ UnpackSpriteMode2:: ; 276d (0:276d) push af xor a ld [wSpriteFlipped], a ; temporarily clear flipped flag for decoding the destination chunk - ld a, [W_SPRITEOUTPUTPTRCACHED] + ld a, [wSpriteOutputPtrCached] ld l, a - ld a, [W_SPRITEOUTPUTPTRCACHED+1] + ld a, [wSpriteOutputPtrCached+1] ld h, a call SpriteDifferentialDecode call ResetSpriteBufferPointers @@ -580,9 +580,9 @@ UnpackSpriteMode2:: ; 276d (0:276d) ; stores hl into the output pointers StoreSpriteOutputPointer:: ; 278d (0:278d) ld a, l - ld [W_SPRITEOUTPUTPTR], a - ld [W_SPRITEOUTPUTPTRCACHED], a + ld [wSpriteOutputPtr], a + ld [wSpriteOutputPtrCached], a ld a, h - ld [W_SPRITEOUTPUTPTR+1], a - ld [W_SPRITEOUTPUTPTRCACHED+1], a + ld [wSpriteOutputPtr+1], a + ld [wSpriteOutputPtrCached+1], a ret diff --git a/home/play_time.asm b/home/play_time.asm index 09c894fc..8044d15c 100644 --- a/home/play_time.asm +++ b/home/play_time.asm @@ -6,7 +6,7 @@ TrackPlayTime: ; 1ef5 (0:1ef5) ld a,[wd732] bit 0,a ret z - ld a, [wPlayTimeMinutes] + ld a, [wPlayTimeMaxed] and a ret nz ld a, [wPlayTimeFrames] @@ -23,16 +23,16 @@ TrackPlayTime: ; 1ef5 (0:1ef5) ret nz xor a ld [wPlayTimeSeconds], a - ld a, [wPlayTimeMinutes + 1] + ld a, [wPlayTimeMinutes] inc a - ld [wPlayTimeMinutes + 1], a + ld [wPlayTimeMinutes], a cp 60 ret nz xor a - ld [wPlayTimeMinutes + 1], a - ld a, [wPlayTimeHours + 1] + ld [wPlayTimeMinutes], a + ld a, [wPlayTimeHours] inc a - ld [wPlayTimeHours + 1], a + ld [wPlayTimeHours], a cp $ff ret nz ld hl, wd47a @@ -40,10 +40,10 @@ TrackPlayTime: ; 1ef5 (0:1ef5) .maxIGT ld a, 59 ld [wPlayTimeSeconds], a - ld [wPlayTimeMinutes + 1], a - ld a, $ff - ld [wPlayTimeHours + 1], a ld [wPlayTimeMinutes], a + ld a, $ff + ld [wPlayTimeHours], a + ld [wPlayTimeMaxed], a ret CountDownIgnoreInputBitReset: ; 1f54 (0:1f54) @@ -406,6 +406,10 @@ tx_pre_jump: MACRO jp PrintPredefTextID ENDM +sound0x0A: macro + db $11 +endm + WALK EQU $FE STAY EQU $FF diff --git a/scripts/agatha.asm b/scripts/agatha.asm index c116e855..6f611071 100755 --- a/scripts/agatha.asm +++ b/scripts/agatha.asm @@ -1,33 +1,34 @@ AgathaScript: - call AgathaScript_76443 + call AgathaShowOrHideExitBlock call EnableAutoTextBoxDrawing ld hl, AgathaTrainerHeaders ld de, AgathaScriptPointers - ld a, [W_AGATHACURSCRIPT] + ld a, [wAgathaCurScript] call ExecuteCurMapScriptInTable - ld [W_AGATHACURSCRIPT], a + ld [wAgathaCurScript], a ret -AgathaScript_76443: - ld hl, wd126 +AgathaShowOrHideExitBlock: +; Blocks or clears the exit to the next room. + ld hl, wCurrentMapScriptFlags bit 5, [hl] res 5, [hl] ret z CheckEvent EVENT_BEAT_AGATHAS_ROOM_TRAINER_0 - jr z, .asm_76457 + jr z, .blockExitToNextRoom ld a, $e - jp AgathaScript_76459 -.asm_76457 + jp .setExitBlock +.blockExitToNextRoom ld a, $3b -AgathaScript_76459: +.setExitBlock ld [wNewTileBlockID], a lb bc, 0, 2 predef_jump ReplaceTileBlock -AgathaScript_76464: +ResetAgathaScript: xor a - ld [W_AGATHACURSCRIPT], a + ld [wAgathaCurScript], a ret AgathaScriptPointers: @@ -40,7 +41,8 @@ AgathaScriptPointers: AgathaScript4: ret -AgathaScript_76474: +AgathaScriptWalkIntoRoom: +; Walk six steps upward. ld hl, wSimulatedJoypadStatesEnd ld a, D_UP ld [hli], a @@ -53,12 +55,12 @@ AgathaScript_76474: ld [wSimulatedJoypadStatesIndex], a call StartSimulatingJoypadStates ld a, $3 - ld [W_AGATHACURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wAgathaCurScript], a + ld [wCurMapScript], a ret AgathaScript0: - ld hl, CoordsData_764d1 + ld hl, AgathaEntranceCoords call ArePlayerCoordsInArray jp nc, CheckFightingMapTrainers xor a @@ -67,25 +69,25 @@ AgathaScript0: ld [wSimulatedJoypadStatesEnd], a ld [wSimulatedJoypadStatesIndex], a ld a, [wCoordIndex] - cp $3 - jr c, .asm_764b4 + cp $3 ; Is player standing one tile above the exit? + jr c, .stopPlayerFromLeaving CheckAndSetEvent EVENT_AUTOWALKED_INTO_AGATHAS_ROOM - jr z, AgathaScript_76474 -.asm_764b4 + jr z, AgathaScriptWalkIntoRoom +.stopPlayerFromLeaving ld a, $2 ld [hSpriteIndexOrTextID], a - call DisplayTextID + call DisplayTextID ; "Don't run away!" ld a, D_UP ld [wSimulatedJoypadStatesEnd], a ld a, $1 ld [wSimulatedJoypadStatesIndex], a call StartSimulatingJoypadStates ld a, $3 - ld [W_AGATHACURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wAgathaCurScript], a + ld [wCurMapScript], a ret -CoordsData_764d1: +AgathaEntranceCoords: db $0A,$04 db $0A,$05 db $0B,$04 @@ -99,20 +101,20 @@ AgathaScript3: call Delay3 xor a ld [wJoyIgnore], a - ld [W_AGATHACURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wAgathaCurScript], a + ld [wCurMapScript], a ret AgathaScript2: call EndTrainerBattle ld a, [wIsInBattle] cp $ff - jp z, AgathaScript_76464 + jp z, ResetAgathaScript ld a, $1 ld [hSpriteIndexOrTextID], a call DisplayTextID ld a, $1 - ld [W_GARYCURSCRIPT], a + ld [wGaryCurScript], a ret AgathaTextPointers: diff --git a/scripts/billshouse.asm b/scripts/billshouse.asm index 3abbeb7a..c7fd74f9 100755 --- a/scripts/billshouse.asm +++ b/scripts/billshouse.asm @@ -1,7 +1,7 @@ BillsHouseScript: call BillsHouseScript_1e09e call EnableAutoTextBoxDrawing - ld a, [W_BILLSHOUSECURSCRIPT] + ld a, [wBillsHouseCurScript] ld hl, BillsHouseScriptPointers call JumpTable ret @@ -34,7 +34,7 @@ BillsHouseScript_1e09e: .asm_1e0b3 ld a, $9 .asm_1e0b5 - ld [W_BILLSHOUSECURSCRIPT], a + ld [wBillsHouseCurScript], a ret BillsHouseScript0: @@ -48,7 +48,7 @@ BillsHouseScript0: xor a ld [wJoyIgnore], a ld a, $1 - ld [W_BILLSHOUSECURSCRIPT], a + ld [wBillsHouseCurScript], a ret BillsHouseScript1: @@ -71,7 +71,7 @@ BillsHouseScript2: ld [H_SPRITEINDEX], a call MoveSprite ld a, $3 - ld [W_BILLSHOUSECURSCRIPT], a + ld [wBillsHouseCurScript], a ret MovementData_1e79c: @@ -111,7 +111,7 @@ BillsHouseScript3: ld [wJoyIgnore], a SetEvent EVENT_BILL_SAID_USE_CELL_SEPARATOR ld a, $4 - ld [W_BILLSHOUSECURSCRIPT], a + ld [wBillsHouseCurScript], a ret PikachuMovementData_1e14d: @@ -137,7 +137,7 @@ BillsHouseScript4: ld a, $fc ld [wJoyIgnore], a ld a, $5 - ld [W_BILLSHOUSECURSCRIPT], a + ld [wBillsHouseCurScript], a ret BillsHouseScript5: @@ -181,7 +181,7 @@ BillsHouseScript5: ld de, MovementData_1e807 call MoveSprite ld a, $6 - ld [W_BILLSHOUSECURSCRIPT], a + ld [wBillsHouseCurScript], a ret MovementData_1e807: @@ -204,7 +204,7 @@ BillsHouseScript6: SetEvent EVENT_MET_BILL_2 ; this event seems redundant SetEvent EVENT_MET_BILL ld a, $7 - ld [W_BILLSHOUSECURSCRIPT], a + ld [wBillsHouseCurScript], a ret BillsHouseScript7: @@ -221,7 +221,7 @@ BillsHouseScript7: ld [wSimulatedJoypadStatesIndex], a call StartSimulatingJoypadStates ld a, $8 - ld [W_BILLSHOUSECURSCRIPT], a + ld [wBillsHouseCurScript], a ret RLE_1e219: @@ -247,7 +247,7 @@ BillsHouseScript8: ld [hSpriteIndexOrTextID], a call DisplayTextID ld a, $9 - ld [W_BILLSHOUSECURSCRIPT], a + ld [wBillsHouseCurScript], a ret BillsHouseScript9: diff --git a/scripts/billshouse2.asm b/scripts/billshouse2.asm index 8e0c1765..87016aa8 100755 --- a/scripts/billshouse2.asm +++ b/scripts/billshouse2.asm @@ -9,7 +9,7 @@ Func_f2418: ld hl, BillsHouseText_f2440 call PrintText ld a, $2 - ld [W_BILLSHOUSECURSCRIPT], a + ld [wBillsHouseCurScript], a ret .asm_f2433 @@ -89,7 +89,7 @@ Func_f24ae: jr nz, .asm_f24d2 call CheckPikachuFollowingPlayer jr z, .asm_f24d2 - ld a, [W_BILLSHOUSECURSCRIPT] + ld a, [wBillsHouseCurScript] cp $5 ld e, $1b ret z diff --git a/scripts/blueshouse.asm b/scripts/blueshouse.asm index 5d1c0723..161955c1 100755 --- a/scripts/blueshouse.asm +++ b/scripts/blueshouse.asm @@ -14,7 +14,7 @@ BluesHouseScript0: ; trigger the next script ld a, 1 - ld [W_BLUESHOUSECURSCRIPT], a + ld [wBluesHouseCurScript], a BluesHouseScript1: ret @@ -65,7 +65,8 @@ DaisyOfferMapText: GotMapText: TX_FAR _GotMapText - db $11, "@" + sound0x0A + db "@" DaisyBagFullText: TX_FAR _DaisyBagFullText diff --git a/scripts/bruno.asm b/scripts/bruno.asm index fcf18b8d..a10a1e49 100755 --- a/scripts/bruno.asm +++ b/scripts/bruno.asm @@ -1,33 +1,34 @@ BrunoScript: - call BrunoScript_762ec + call BrunoShowOrHideExitBlock call EnableAutoTextBoxDrawing ld hl, BrunoTrainerHeaders ld de, BrunoScriptPointers - ld a, [W_BRUNOCURSCRIPT] + ld a, [wBrunoCurScript] call ExecuteCurMapScriptInTable - ld [W_BRUNOCURSCRIPT], a + ld [wBrunoCurScript], a ret -BrunoScript_762ec: - ld hl, wd126 +BrunoShowOrHideExitBlock: +; Blocks or clears the exit to the next room. + ld hl, wCurrentMapScriptFlags bit 5, [hl] res 5, [hl] ret z CheckEvent EVENT_BEAT_BRUNOS_ROOM_TRAINER_0 - jr z, .asm_76300 + jr z, .blockExitToNextRoom ld a, $5 - jp BrunoScript_76302 -.asm_76300 + jp .setExitBlock +.blockExitToNextRoom ld a, $24 -BrunoScript_76302: +.setExitBlock ld [wNewTileBlockID], a lb bc, 0, 2 predef_jump ReplaceTileBlock -BrunoScript_7630d: +ResetBrunoScript: xor a - ld [W_BRUNOCURSCRIPT], a + ld [wBrunoCurScript], a ret BrunoScriptPointers: @@ -40,7 +41,8 @@ BrunoScriptPointers: BrunoScript4: ret -BrunoScript_7631d: +BrunoScriptWalkIntoRoom: +; Walk six steps upward. ld hl, wSimulatedJoypadStatesEnd ld a, D_UP ld [hli], a @@ -53,12 +55,12 @@ BrunoScript_7631d: ld [wSimulatedJoypadStatesIndex], a call StartSimulatingJoypadStates ld a, $3 - ld [W_BRUNOCURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wBrunoCurScript], a + ld [wCurMapScript], a ret BrunoScript0: - ld hl, CoordsData_7637a + ld hl, BrunoEntranceCoords call ArePlayerCoordsInArray jp nc, CheckFightingMapTrainers xor a @@ -67,25 +69,25 @@ BrunoScript0: ld [wSimulatedJoypadStatesEnd], a ld [wSimulatedJoypadStatesIndex], a ld a, [wCoordIndex] - cp $3 - jr c, .asm_7635d + cp $3 ; Is player standing one tile above the exit? + jr c, .stopPlayerFromLeaving CheckAndSetEvent EVENT_AUTOWALKED_INTO_BRUNOS_ROOM - jr z, BrunoScript_7631d -.asm_7635d + jr z, BrunoScriptWalkIntoRoom +.stopPlayerFromLeaving ld a, $2 ld [hSpriteIndexOrTextID], a - call DisplayTextID + call DisplayTextID ; "Don't run away!" ld a, D_UP ld [wSimulatedJoypadStatesEnd], a ld a, $1 ld [wSimulatedJoypadStatesIndex], a call StartSimulatingJoypadStates ld a, $3 - ld [W_BRUNOCURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wBrunoCurScript], a + ld [wCurMapScript], a ret -CoordsData_7637a: +BrunoEntranceCoords: db $0A,$04 db $0A,$05 db $0B,$04 @@ -99,15 +101,15 @@ BrunoScript3: call Delay3 xor a ld [wJoyIgnore], a - ld [W_BRUNOCURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wBrunoCurScript], a + ld [wCurMapScript], a ret BrunoScript2: call EndTrainerBattle ld a, [wIsInBattle] cp $ff - jp z, BrunoScript_7630d + jp z, ResetBrunoScript ld a, $1 ld [hSpriteIndexOrTextID], a jp DisplayTextID diff --git a/scripts/celadoncity.asm b/scripts/celadoncity.asm index c36c4ad7..04fa0a28 100755 --- a/scripts/celadoncity.asm +++ b/scripts/celadoncity.asm @@ -1,7 +1,7 @@ CeladonCityScript: call EnableAutoTextBoxDrawing ld hl, CeladonCityScriptPointers - ld a, [W_CELADONCITYCURSCRIPT] + ld a, [wCeladonCityCurScript] call JumpTable ret diff --git a/scripts/celadongamecorner.asm b/scripts/celadongamecorner.asm index d0433efd..43aae927 100755 --- a/scripts/celadongamecorner.asm +++ b/scripts/celadongamecorner.asm @@ -3,11 +3,11 @@ CeladonGameCornerScript: call CeladonGameCornerScript_48bec call EnableAutoTextBoxDrawing ld hl, CeladonGameCornerScriptPointers - ld a, [W_CELADONGAMECORNERCURSCRIPT] + ld a, [wCeladonGameCornerCurScript] jp JumpTable CeladonGameCornerScript_48bcf: - ld hl, wd126 + ld hl, wCurrentMapScriptFlags bit 6, [hl] res 6, [hl] ret z @@ -24,7 +24,7 @@ CeladonGameCornerScript_48bcf: ret CeladonGameCornerScript_48bec: - ld hl, wd126 + ld hl, wCurrentMapScriptFlags bit 5, [hl] res 5, [hl] ret z @@ -38,8 +38,8 @@ CeladonGameCornerScript_48bec: CeladonGameCornerScript_48c07: xor a ld [wJoyIgnore], a - ld [W_CELADONGAMECORNERCURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wCeladonGameCornerCurScript], a + ld [wCurMapScript], a ret CeladonGameCornerScriptPointers: @@ -82,7 +82,7 @@ CeladonGameCornerScript1: ld [H_SPRITEINDEX], a call MoveSprite ld a, $2 - ld [W_CELADONGAMECORNERCURSCRIPT], a + ld [wCeladonGameCornerCurScript], a ret MovementData_48c5a: @@ -113,11 +113,11 @@ CeladonGameCornerScript2: ld a, HS_GAME_CORNER_ROCKET ld [wMissableObjectIndex], a predef HideObject - ld hl, wd126 + ld hl, wCurrentMapScriptFlags set 5, [hl] set 6, [hl] ld a, $0 - ld [W_CELADONGAMECORNERCURSCRIPT], a + ld [wCeladonGameCornerCurScript], a ret CeladonGameCornerTextPointers: @@ -429,7 +429,7 @@ CeladonGameCornerText11: ld [hJoyPressed], a ld [hJoyReleased], a ld a, $1 - ld [W_CELADONGAMECORNERCURSCRIPT], a + ld [wCeladonGameCornerCurScript], a jp TextScriptEnd CeladonGameCornerText_48ece: diff --git a/scripts/celadongym.asm b/scripts/celadongym.asm index 1021aef1..903ef508 100755 --- a/scripts/celadongym.asm +++ b/scripts/celadongym.asm @@ -1,14 +1,14 @@ CeladonGymScript: - ld hl, wd126 + ld hl, wCurrentMapScriptFlags bit 6, [hl] res 6, [hl] call nz, CeladonGymScript_48927 call EnableAutoTextBoxDrawing ld hl, CeladonGymTrainerHeaders ld de, CeladonGymScriptPointers - ld a, [W_CELADONGYMCURSCRIPT] + ld a, [wCeladonGymCurScript] call ExecuteCurMapScriptInTable - ld [W_CELADONGYMCURSCRIPT], a + ld [wCeladonGymCurScript], a ret CeladonGymScript_48927: @@ -25,8 +25,8 @@ Gym4LeaderName: CeladonGymText_48943: xor a ld [wJoyIgnore], a - ld [W_CELADONGYMCURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wCeladonGymCurScript], a + ld [wCurMapScript], a ret CeladonGymScriptPointers: @@ -178,8 +178,8 @@ CeladonGymText1: ld a, $4 ld [wGymLeaderNo], a ld a, $3 - ld [W_CELADONGYMCURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wCeladonGymCurScript], a + ld [wCurMapScript], a .asm_48a5b jp TextScriptEnd diff --git a/scripts/celadonmartelevator.asm b/scripts/celadonmartelevator.asm index 2dbeca04..e78d86fc 100755 --- a/scripts/celadonmartelevator.asm +++ b/scripts/celadonmartelevator.asm @@ -1,5 +1,5 @@ CeladonMartElevatorScript: - ld hl, wd126 + ld hl, wCurrentMapScriptFlags bit 5, [hl] res 5, [hl] push hl diff --git a/scripts/ceruleancity.asm b/scripts/ceruleancity.asm index 4eaa66b9..4243d35c 100755 --- a/scripts/ceruleancity.asm +++ b/scripts/ceruleancity.asm @@ -1,13 +1,13 @@ CeruleanCityScript: call EnableAutoTextBoxDrawing ld hl, CeruleanCityScriptPointers - ld a, [W_CERULEANCITYCURSCRIPT] + ld a, [wCeruleanCityCurScript] jp JumpTable CeruleanCityScript_1948c: xor a ld [wJoyIgnore], a - ld [W_CERULEANCITYCURSCRIPT], a + ld [wCeruleanCityCurScript], a ld a, HS_CERULEAN_RIVAL ld [wMissableObjectIndex], a predef_jump HideObject @@ -31,7 +31,7 @@ CeruleanCityScript4: call DisplayTextID xor a ld [wJoyIgnore], a - ld [W_CERULEANCITYCURSCRIPT], a + ld [wCeruleanCityCurScript], a ret CeruleanCityScript0: @@ -91,7 +91,7 @@ CeruleanCityScript0: ld [H_SPRITEINDEX], a call MoveSprite ld a, $1 - ld [W_CERULEANCITYCURSCRIPT], a + ld [wCeruleanCityCurScript], a ret CeruleanCityCoords1: @@ -140,7 +140,7 @@ CeruleanCityScript1: ld [hJoyHeld], a call CeruleanCityScript_1955d ld a, $2 - ld [W_CERULEANCITYCURSCRIPT], a + ld [wCeruleanCityCurScript], a ret CeruleanCityScript2: @@ -171,7 +171,7 @@ CeruleanCityScript2: ld [H_SPRITEINDEX], a call MoveSprite ld a, $3 - ld [W_CERULEANCITYCURSCRIPT], a + ld [wCeruleanCityCurScript], a ret CeruleanCityMovement3: @@ -205,7 +205,7 @@ CeruleanCityScript3: ld [wJoyIgnore], a call PlayDefaultMusic ld a, $0 - ld [W_CERULEANCITYCURSCRIPT], a + ld [wCeruleanCityCurScript], a ret CeruleanCityTextPointers: @@ -275,7 +275,7 @@ CeruleanCityText2: call EngageMapTrainer call InitBattleEnemyParameters ld a, $4 - ld [W_CERULEANCITYCURSCRIPT], a + ld [wCeruleanCityCurScript], a jp TextScriptEnd .asm_4ca20 ld hl, CeruleanCityText_196f3 diff --git a/scripts/ceruleangym.asm b/scripts/ceruleangym.asm index eae1b364..448ce744 100755 --- a/scripts/ceruleangym.asm +++ b/scripts/ceruleangym.asm @@ -1,14 +1,14 @@ CeruleanGymScript: - ld hl, wd126 + ld hl, wCurrentMapScriptFlags bit 6, [hl] res 6, [hl] call nz, CeruleanGymScript_5c6d0 call EnableAutoTextBoxDrawing ld hl, CeruleanGymTrainerHeaders ld de, CeruleanGymScriptPointers - ld a, [W_CERULEANGYMCURSCRIPT] + ld a, [wCeruleanGymCurScript] call ExecuteCurMapScriptInTable - ld [W_CERULEANGYMCURSCRIPT], a + ld [wCeruleanGymCurScript], a ret CeruleanGymScript_5c6d0: @@ -25,8 +25,8 @@ Gym2LeaderName: CeruleanGymScript_5c6ed: xor a ld [wJoyIgnore], a - ld [W_CERULEANGYMCURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wCeruleanGymCurScript], a + ld [wCurMapScript], a ret CeruleanGymScriptPointers: @@ -132,7 +132,7 @@ CeruleanGymText1: xor a ld [hJoyHeld], a ld a, $3 - ld [W_CERULEANGYMCURSCRIPT], a + ld [wCeruleanGymCurScript], a .asm_5c7bb jp TextScriptEnd diff --git a/scripts/cinnabargym.asm b/scripts/cinnabargym.asm index 02122490..1ebf943a 100755 --- a/scripts/cinnabargym.asm +++ b/scripts/cinnabargym.asm @@ -2,11 +2,11 @@ CinnabarGymScript: call CinnabarGymScript_75759 call EnableAutoTextBoxDrawing ld hl, CinnabarGymScriptPointers - ld a, [W_CINNABARGYMCURSCRIPT] + ld a, [wCinnabarGymCurScript] jp JumpTable CinnabarGymScript_75759: - ld hl, wd126 + ld hl, wCurrentMapScriptFlags bit 6, [hl] res 6, [hl] push hl @@ -30,8 +30,8 @@ Gym7LeaderName: CinnabarGymScript_75792: xor a ld [wJoyIgnore], a - ld [W_CINNABARGYMCURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wCinnabarGymCurScript], a + ld [wCurMapScript], a ld [wOpponentAfterWrongAnswer], a ret @@ -73,8 +73,8 @@ CinnabarGymScript0: .asm_757cb call MoveSprite ld a, $1 - ld [W_CINNABARGYMCURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wCinnabarGymCurScript], a + ld [wCurMapScript], a ret MovementData_757d7: @@ -160,8 +160,8 @@ CinnabarGymScript2: ld [wJoyIgnore], a ld [wOpponentAfterWrongAnswer], a ld a, $0 - ld [W_CINNABARGYMCURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wCinnabarGymCurScript], a + ld [wCurMapScript], a ret CinnabarGymScript_75023: @@ -225,7 +225,7 @@ CinnabarGymScript3_75857: ; deactivate gym trainers SetEventRange EVENT_BEAT_CINNABAR_GYM_TRAINER_0, EVENT_BEAT_CINNABAR_GYM_TRAINER_6 - ld hl, wd126 + ld hl, wCurrentMapScriptFlags set 5, [hl] jp CinnabarGymScript_75792 @@ -260,8 +260,8 @@ CinnabarGymScript_750c3: .asm_758d4 ld a, $3 .asm_758d6 - ld [W_CINNABARGYMCURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wCinnabarGymCurScript], a + ld [wCurMapScript], a jp TextScriptEnd CinnabarGymText1: diff --git a/scripts/cinnabarisland.asm b/scripts/cinnabarisland.asm index 2c6fda4e..4dbec159 100755 --- a/scripts/cinnabarisland.asm +++ b/scripts/cinnabarisland.asm @@ -1,11 +1,11 @@ CinnabarIslandScript: call EnableAutoTextBoxDrawing - ld hl, wd126 + ld hl, wCurrentMapScriptFlags set 5, [hl] ResetEvent EVENT_MANSION_SWITCH_ON ResetEvent EVENT_LAB_STILL_REVIVING_FOSSIL ld hl, CinnabarIslandScriptPointers - ld a, [W_CINNABARISLANDCURSCRIPT] + ld a, [wCinnabarIslandCurScript] jp JumpTable CinnabarIslandScriptPointers: @@ -38,7 +38,7 @@ CinnabarIslandScript0: ld [wPlayerFacingDirection], a ld [wJoyIgnore], a ld a, $1 - ld [W_CINNABARISLANDCURSCRIPT], a + ld [wCinnabarIslandCurScript], a ret CinnabarIslandScript1: @@ -47,7 +47,7 @@ CinnabarIslandScript1: ret nz call Delay3 ld a, $0 - ld [W_CINNABARISLANDCURSCRIPT], a + ld [wCinnabarIslandCurScript], a ret CinnabarIslandTextPointers: diff --git a/scripts/fanclub.asm b/scripts/fanclub.asm index 44c55168..01d6269b 100755 --- a/scripts/fanclub.asm +++ b/scripts/fanclub.asm @@ -1,7 +1,7 @@ FanClubScript: call EnableAutoTextBoxDrawing ld hl, FanClubScriptPointers - ld a, [W_FANCLUBCURSCRIPT] + ld a, [wFanClubCurScript] call JumpTable ret @@ -39,7 +39,7 @@ FanClubScript_59a44: callab CheckPikachuFaintedOrStatused ret c ld a, $1 - ld [W_FANCLUBCURSCRIPT], a + ld [wFanClubCurScript], a xor a ld [wPlayerMovingDirection], a call UpdateSprites diff --git a/scripts/fightingdojo.asm b/scripts/fightingdojo.asm index 9a79506e..9d28046f 100755 --- a/scripts/fightingdojo.asm +++ b/scripts/fightingdojo.asm @@ -2,16 +2,16 @@ FightingDojoScript: call EnableAutoTextBoxDrawing ld hl, FightingDojoTrainerHeaders ld de, FightingDojoScriptPointers - ld a, [W_FIGHTINGDOJOCURSCRIPT] + ld a, [wFightingDojoCurScript] call ExecuteCurMapScriptInTable - ld [W_FIGHTINGDOJOCURSCRIPT], a + ld [wFightingDojoCurScript], a ret FightingDojoScript_5cd70: xor a ld [wJoyIgnore], a - ld [W_FIGHTINGDOJOCURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wFightingDojoCurScript], a + ld [wCurMapScript], a ret FightingDojoScriptPointers: @@ -76,8 +76,8 @@ FightingDojoScript3: call DisplayTextID xor a ld [wJoyIgnore], a - ld [W_FIGHTINGDOJOCURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wFightingDojoCurScript], a + ld [wCurMapScript], a ret FightingDojoTextPointers: @@ -148,8 +148,8 @@ FightingDojoText1: call EngageMapTrainer call InitBattleEnemyParameters ld a, $3 - ld [W_FIGHTINGDOJOCURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wFightingDojoCurScript], a + ld [wCurMapScript], a jr .asm_9dba4 .continue1 ld hl, FightingDojoText_5ce9d diff --git a/scripts/fuchsiagym.asm b/scripts/fuchsiagym.asm index a67cc0c8..8268930d 100755 --- a/scripts/fuchsiagym.asm +++ b/scripts/fuchsiagym.asm @@ -3,13 +3,13 @@ FuchsiaGymScript: call EnableAutoTextBoxDrawing ld hl, FuchsiaGymTrainerHeaders ld de, FuchsiaGymScriptPointers - ld a, [W_FUCHSIAGYMCURSCRIPT] + ld a, [wFuchsiaGymCurScript] call ExecuteCurMapScriptInTable - ld [W_FUCHSIAGYMCURSCRIPT], a + ld [wFuchsiaGymCurScript], a ret FuchsiaGymScript_75453: - ld hl, wd126 + ld hl, wCurrentMapScriptFlags bit 6, [hl] res 6, [hl] ret z @@ -26,8 +26,8 @@ Gym5LeaderName: FuchsiaGymScript_75477: xor a ld [wJoyIgnore], a - ld [W_FUCHSIAGYMCURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wFuchsiaGymCurScript], a + ld [wCurMapScript], a ret FuchsiaGymScriptPointers: @@ -171,7 +171,7 @@ FuchsiaGymText1: xor a ld [hJoyHeld], a ld a, $3 - ld [W_FUCHSIAGYMCURSCRIPT], a + ld [wFuchsiaGymCurScript], a .asm_e84c6 jp TextScriptEnd diff --git a/scripts/gary.asm b/scripts/gary.asm index a000cc87..ef1a7328 100755 --- a/scripts/gary.asm +++ b/scripts/gary.asm @@ -1,14 +1,14 @@ GaryScript: call EnableAutoTextBoxDrawing ld hl, GaryScriptPointers - ld a, [W_GARYCURSCRIPT] + ld a, [wGaryCurScript] call JumpTable ret -GaryScript_75f29: +ResetGaryScript: xor a ld [wJoyIgnore], a - ld [W_GARYCURSCRIPT], a + ld [wGaryCurScript], a ret GaryScriptPointers: @@ -31,16 +31,16 @@ GaryScript1: ld a, $ff ld [wJoyIgnore], a ld hl, wSimulatedJoypadStatesEnd - ld de, RLEMovement75f63 + ld de, GaryEntrance_RLEMovement call DecodeRLEList dec a ld [wSimulatedJoypadStatesIndex], a call StartSimulatingJoypadStates ld a, $2 - ld [W_GARYCURSCRIPT], a + ld [wGaryCurScript], a ret -RLEMovement75f63: +GaryEntrance_RLEMovement: db D_UP, 1 db D_RIGHT, 1 db D_UP, 3 @@ -54,7 +54,7 @@ GaryScript2: xor a ld [wJoyIgnore], a ld hl, wOptions - res 7, [hl] + res 7, [hl] ; Turn on battle animations to make the battle feel more epic. ld a, $1 ld [hSpriteIndexOrTextID], a call DisplayTextID @@ -62,27 +62,27 @@ GaryScript2: ld hl, wd72d set 6, [hl] set 7, [hl] - ld hl, GaryText_760f9 - ld de, GaryText_760fe + ld hl, GaryDefeatedText + ld de, GaryVictoryText call SaveEndBattleTextPointers ld a, OPP_SONY3 ld [wCurOpponent], a ; select which team to use during the encounter - ld a, [W_RIVALSTARTER] + ld a, [wRivalStarter] add $0 ; Wow GameFreak ld [wTrainerNo], a xor a ld [hJoyHeld], a ld a, $3 - ld [W_GARYCURSCRIPT], a + ld [wGaryCurScript], a ret GaryScript3: ld a, [wIsInBattle] cp $ff - jp z, GaryScript_75f29 + jp z, ResetGaryScript call UpdateSprites SetEvent EVENT_BEAT_CHAMPION_RIVAL ld a, $f0 @@ -94,7 +94,7 @@ GaryScript3: ld [H_SPRITEINDEX], a call SetSpriteMovementBytesToFF ld a, $4 - ld [W_GARYCURSCRIPT], a + ld [wGaryCurScript], a ret GaryScript4: @@ -105,7 +105,7 @@ GaryScript4: ld a, $2 ld [H_SPRITEINDEX], a call SetSpriteMovementBytesToFF - ld de, MovementData_76014 + ld de, OakEntranceAfterVictoryMovement ld a, $2 ld [H_SPRITEINDEX], a call MoveSprite @@ -113,10 +113,10 @@ GaryScript4: ld [wMissableObjectIndex], a predef ShowObject ld a, $5 - ld [W_GARYCURSCRIPT], a + ld [wGaryCurScript], a ret -MovementData_76014: +OakEntranceAfterVictoryMovement: db NPC_MOVEMENT_UP db NPC_MOVEMENT_UP db NPC_MOVEMENT_UP @@ -144,7 +144,7 @@ GaryScript5: ld [hSpriteIndexOrTextID], a call GaryScript_760c8 ld a, $6 - ld [W_GARYCURSCRIPT], a + ld [wGaryCurScript], a ret GaryScript6: @@ -157,7 +157,7 @@ GaryScript6: ld [hSpriteIndexOrTextID], a call GaryScript_760c8 ld a, $7 - ld [W_GARYCURSCRIPT], a + ld [wGaryCurScript], a ret GaryScript7: @@ -169,15 +169,15 @@ GaryScript7: ld a, $5 ld [hSpriteIndexOrTextID], a call GaryScript_760c8 - ld de, MovementData_76080 + ld de, OakExitGaryRoomMovement ld a, $2 ld [H_SPRITEINDEX], a call MoveSprite ld a, $8 - ld [W_GARYCURSCRIPT], a + ld [wGaryCurScript], a ret -MovementData_76080: +OakExitGaryRoomMovement: db NPC_MOVEMENT_UP db NPC_MOVEMENT_UP db $FF @@ -190,23 +190,23 @@ GaryScript8: ld [wMissableObjectIndex], a predef HideObject ld a, $9 - ld [W_GARYCURSCRIPT], a + ld [wGaryCurScript], a ret GaryScript9: ld a, $ff ld [wJoyIgnore], a ld hl, wSimulatedJoypadStatesEnd - ld de, RLEMovement760b4 + ld de, WalkToHallOfFame_RLEMovment call DecodeRLEList dec a ld [wSimulatedJoypadStatesIndex], a call StartSimulatingJoypadStates ld a, $a - ld [W_GARYCURSCRIPT], a + ld [wGaryCurScript], a ret -RLEMovement760b4: +WalkToHallOfFame_RLEMovment: db D_UP, 4 db D_LEFT, 1 db $ff @@ -218,7 +218,7 @@ GaryScript10: xor a ld [wJoyIgnore], a ld a, $0 - ld [W_GARYCURSCRIPT], a + ld [wGaryCurScript], a ret GaryScript_760c8: @@ -239,23 +239,23 @@ GaryTextPointers: GaryText1: TX_ASM CheckEvent EVENT_BEAT_CHAMPION_RIVAL - ld hl, GaryText_760f4 - jr z, .asm_17e9f + ld hl, GaryChampionIntroText + jr z, .printText ld hl, GaryText_76103 -.asm_17e9f +.printText call PrintText jp TextScriptEnd -GaryText_760f4: +GaryChampionIntroText: TX_FAR _GaryChampionIntroText db "@" -GaryText_760f9: - TX_FAR _GaryText_760f9 +GaryDefeatedText: + TX_FAR _GaryDefeatedText db "@" -GaryText_760fe: - TX_FAR _GaryText_760fe +GaryVictoryText: + TX_FAR _GaryVictoryText db "@" GaryText_76103: @@ -268,7 +268,7 @@ GaryText2: GaryText3: TX_ASM - ld a, [W_PLAYERSTARTER] + ld a, [wPlayerStarter] ld [wd11e], a call GetMonName ld hl, GaryText_76120 diff --git a/scripts/halloffameroom.asm b/scripts/halloffameroom.asm index 8e5d1907..1bba347b 100755 --- a/scripts/halloffameroom.asm +++ b/scripts/halloffameroom.asm @@ -1,13 +1,13 @@ HallofFameRoomScript: call EnableAutoTextBoxDrawing ld hl, HallofFameRoomScriptPointers - ld a, [W_HALLOFFAMEROOMCURSCRIPT] + ld a, [wHallOfFameRoomCurScript] jp JumpTable HallofFameRoomScript_5a4aa: xor a ld [wJoyIgnore], a - ld [W_HALLOFFAMEROOMCURSCRIPT], a + ld [wHallOfFameRoomCurScript], a ret HallofFameRoomScriptPointers: @@ -33,25 +33,25 @@ HallofFameRoomScript2: inc hl set 0, [hl] xor a - ld hl, W_LORELEICURSCRIPT + ld hl, wLoreleiCurScript ld [hli], a ld [hli], a ld [hl], a - ld [W_LANCECURSCRIPT], a - ld [W_HALLOFFAMEROOMCURSCRIPT], a + ld [wLanceCurScript], a + ld [wHallOfFameRoomCurScript], a ; Elite 4 events ResetEventRange ELITE4_EVENTS_START, ELITE4_CHAMPION_EVENTS_END, 1 xor a - ld [W_HALLOFFAMEROOMCURSCRIPT], a + ld [wHallOfFameRoomCurScript], a ld a, PALLET_TOWN ld [wLastBlackoutMap], a callba SaveSAVtoSRAM ld b, 5 -.asm_5a4ff +.delayLoop ld c, 600 / 5 call DelayFrames dec b - jr nz, .asm_5a4ff + jr nz, .delayLoop call WaitForTextScrollButtonPress jp Init @@ -65,7 +65,7 @@ HallofFameRoomScript0: ld [wSimulatedJoypadStatesIndex], a call StartSimulatingJoypadStates ld a, $1 - ld [W_HALLOFFAMEROOMCURSCRIPT], a + ld [wHallOfFameRoomCurScript], a ret RLEMovement5a528: @@ -98,7 +98,7 @@ HallofFameRoomScript1: ld [wMissableObjectIndex], a predef HideObject ld a, $2 - ld [W_HALLOFFAMEROOMCURSCRIPT], a + ld [wHallOfFameRoomCurScript], a ret HallofFameRoomTextPointers: diff --git a/scripts/indigoplateaulobby.asm b/scripts/indigoplateaulobby.asm index 93653931..63f228d0 100755 --- a/scripts/indigoplateaulobby.asm +++ b/scripts/indigoplateaulobby.asm @@ -1,7 +1,7 @@ IndigoPlateauLobbyScript: call Serial_TryEstablishingExternallyClockedConnection call EnableAutoTextBoxDrawing - ld hl, wd126 + ld hl, wCurrentMapScriptFlags bit 6, [hl] res 6, [hl] ret z diff --git a/scripts/lab4.asm b/scripts/lab4.asm index 8177a64c..7d0db339 100755 --- a/scripts/lab4.asm +++ b/scripts/lab4.asm @@ -74,7 +74,7 @@ Lab4Text1: ld hl, Lab4Text_75dd5 call PrintText SetEvent EVENT_LAB_HANDING_OVER_FOSSIL_MON - ld a, [W_FOSSILMON] + ld a, [wFossilMon] ld b, a ld c, 30 call GivePokemon diff --git a/scripts/lance.asm b/scripts/lance.asm index b2cf9207..7d67f6cd 100755 --- a/scripts/lance.asm +++ b/scripts/lance.asm @@ -1,42 +1,44 @@ LanceScript: - call LanceScript_5a2c4 + call LanceShowOrHideEntranceBlocks call EnableAutoTextBoxDrawing ld hl, LanceTrainerHeaders ld de, LanceScriptPointers - ld a, [W_LANCECURSCRIPT] + ld a, [wLanceCurScript] call ExecuteCurMapScriptInTable - ld [W_LANCECURSCRIPT], a + ld [wLanceCurScript], a ret -LanceScript_5a2c4: - ld hl, wd126 +LanceShowOrHideEntranceBlocks: + ld hl, wCurrentMapScriptFlags bit 5, [hl] res 5, [hl] ret z CheckEvent EVENT_LANCES_ROOM_LOCK_DOOR - jr nz, .asm_5a2da + jr nz, .closeEntrance + ; open entrance ld a, $31 ld b, $32 - jp .asm_5a2de + jp .LanceSetEntranceBlocks -.asm_5a2da +.closeEntrance ld a, $72 ld b, $73 -.asm_5a2de +.LanceSetEntranceBlocks +; Replaces the tile blocks so the player can't leave. push bc ld [wNewTileBlockID], a lb bc, 6, 2 - call .asm_5a2f0 + call .LanceSetEntranceBlock pop bc ld a, b ld [wNewTileBlockID], a lb bc, 6, 3 -.asm_5a2f0 +.LanceSetEntranceBlock predef_jump ReplaceTileBlock -LanceScript_5a2f5: +ResetLanceScript: xor a - ld [W_LANCECURSCRIPT], a + ld [wLanceCurScript], a ret LanceScriptPointers: @@ -52,29 +54,29 @@ LanceScript4: LanceScript0: CheckEvent EVENT_BEAT_LANCE ret nz - ld hl, CoordsData_5a33e + ld hl, LanceTriggerMovementCoords call ArePlayerCoordsInArray jp nc, CheckFightingMapTrainers xor a ld [hJoyHeld], a ld a, [wCoordIndex] - cp $3 - jr nc, .asm_5a325 + cp $3 ; Is player standing next to Lance's sprite? + jr nc, .notStandingNextToLance ld a, $1 ld [hSpriteIndexOrTextID], a jp DisplayTextID -.asm_5a325 - cp $5 - jr z, LanceScript_5a35b +.notStandingNextToLance + cp $5 ; Is player standing on the entrance staircase? + jr z, WalkToLance CheckAndSetEvent EVENT_LANCES_ROOM_LOCK_DOOR ret nz - ld hl, wd126 + ld hl, wCurrentMapScriptFlags set 5, [hl] ld a, SFX_GO_INSIDE call PlaySound - jp LanceScript_5a2c4 + jp LanceShowOrHideEntranceBlocks -CoordsData_5a33e: +LanceTriggerMovementCoords: db $01,$05 db $02,$06 db $0B,$05 @@ -86,26 +88,27 @@ LanceScript2: call EndTrainerBattle ld a, [wIsInBattle] cp $ff - jp z, LanceScript_5a2f5 + jp z, ResetLanceScript ld a, $1 ld [hSpriteIndexOrTextID], a jp DisplayTextID -LanceScript_5a35b: +WalkToLance: +; Moves the player down the hallway to Lance's room. ld a, $ff ld [wJoyIgnore], a ld hl, wSimulatedJoypadStatesEnd - ld de, RLEList_5a379 + ld de, WalkToLance_RLEList call DecodeRLEList dec a ld [wSimulatedJoypadStatesIndex], a call StartSimulatingJoypadStates ld a, $3 - ld [W_LANCECURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wLanceCurScript], a + ld [wCurMapScript], a ret -RLEList_5a379: +WalkToLance_RLEList: db D_UP, $0D db D_LEFT, $0C db D_DOWN, $07 @@ -119,8 +122,8 @@ LanceScript3: call Delay3 xor a ld [wJoyIgnore], a - ld [W_LANCECURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wLanceCurScript], a + ld [wCurMapScript], a ret LanceTextPointers: diff --git a/scripts/lorelei.asm b/scripts/lorelei.asm index d85dc192..60be524d 100755 --- a/scripts/lorelei.asm +++ b/scripts/lorelei.asm @@ -1,34 +1,35 @@ LoreleiScript: - call LoreleiScript_76191 + call LoreleiShowOrHideExitBlock call EnableAutoTextBoxDrawing ld hl, LoreleiTrainerHeaders ld de, LoreleiScriptPointers - ld a, [W_LORELEICURSCRIPT] + ld a, [wLoreleiCurScript] call ExecuteCurMapScriptInTable - ld [W_LORELEICURSCRIPT], a + ld [wLoreleiCurScript], a ret -LoreleiScript_76191: - ld hl, wd126 +LoreleiShowOrHideExitBlock: +; Blocks or clears the exit to the next room. + ld hl, wCurrentMapScriptFlags bit 5, [hl] res 5, [hl] ret z ld hl, wBeatLorelei set 1, [hl] CheckEvent EVENT_BEAT_LORELEIS_ROOM_TRAINER_0 - jr z, .asm_761a9 + jr z, .blockExitToNextRoom ld a, $5 - jr .asm_761ab -.asm_761a9 + jr .setExitBlock +.blockExitToNextRoom ld a, $24 -.asm_761ab +.setExitBlock ld [wNewTileBlockID], a lb bc, 0, 2 predef_jump ReplaceTileBlock -LoreleiScript_761b6: +ResetLoreleiScript: xor a - ld [W_LORELEICURSCRIPT], a + ld [wLoreleiCurScript], a ret LoreleiScriptPointers: @@ -41,7 +42,8 @@ LoreleiScriptPointers: LoreleiScript4: ret -LoreleiScript_761c6: +LoreleiScriptWalkIntoRoom: +; Walk six steps upward. ld hl, wSimulatedJoypadStatesEnd ld a, D_UP ld [hli], a @@ -54,12 +56,12 @@ LoreleiScript_761c6: ld [wSimulatedJoypadStatesIndex], a call StartSimulatingJoypadStates ld a, $3 - ld [W_LORELEICURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wLoreleiCurScript], a + ld [wCurMapScript], a ret LoreleiScript0: - ld hl, CoordsData_76223 + ld hl, LoreleiEntranceCoords call ArePlayerCoordsInArray jp nc, CheckFightingMapTrainers xor a @@ -68,25 +70,25 @@ LoreleiScript0: ld [wSimulatedJoypadStatesEnd], a ld [wSimulatedJoypadStatesIndex], a ld a, [wCoordIndex] - cp $3 - jr c, .asm_76206 + cp $3 ; Is player standing one tile above the exit? + jr c, .stopPlayerFromLeaving CheckAndSetEvent EVENT_AUTOWALKED_INTO_LORELEIS_ROOM - jr z, LoreleiScript_761c6 -.asm_76206 + jr z, LoreleiScriptWalkIntoRoom +.stopPlayerFromLeaving ld a, $2 ld [hSpriteIndexOrTextID], a - call DisplayTextID + call DisplayTextID ; "Don't run away!" ld a, D_UP ld [wSimulatedJoypadStatesEnd], a ld a, $1 ld [wSimulatedJoypadStatesIndex], a call StartSimulatingJoypadStates ld a, $3 - ld [W_LORELEICURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wLoreleiCurScript], a + ld [wCurMapScript], a ret -CoordsData_76223: +LoreleiEntranceCoords: db $0A,$04 db $0A,$05 db $0B,$04 @@ -100,14 +102,15 @@ LoreleiScript3: call Delay3 xor a ld [wJoyIgnore], a - ld [W_LORELEICURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wLoreleiCurScript], a + ld [wCurMapScript], a ret + LoreleiScript2: call EndTrainerBattle ld a, [wIsInBattle] cp $ff - jp z, LoreleiScript_761b6 + jp z, ResetLoreleiScript ld a, $1 ld [hSpriteIndexOrTextID], a jp DisplayTextID diff --git a/scripts/mansion1.asm b/scripts/mansion1.asm index 6ee7984e..fb0a92bc 100755 --- a/scripts/mansion1.asm +++ b/scripts/mansion1.asm @@ -3,13 +3,13 @@ Mansion1Script: call EnableAutoTextBoxDrawing ld hl, Mansion1TrainerHeaders ld de, Mansion1ScriptPointers - ld a, [W_MANSION1CURSCRIPT] + ld a, [wMansion1CurScript] call ExecuteCurMapScriptInTable - ld [W_MANSION1CURSCRIPT], a + ld [wMansion1CurScript], a ret Mansion1Subscript1: - ld hl, wd126 + ld hl, wCurrentMapScriptFlags bit 5, [hl] res 5, [hl] ret z @@ -106,7 +106,7 @@ Mansion1Text4: jr nz, .asm_4438c ld a, $1 ld [wDoNotWaitForButtonPressAfterDisplayingText], a - ld hl, wd126 + ld hl, wCurrentMapScriptFlags set 5, [hl] ld hl, MansionSwitchPressedText call PrintText diff --git a/scripts/mansion2.asm b/scripts/mansion2.asm index df0d0c36..0ba8a245 100755 --- a/scripts/mansion2.asm +++ b/scripts/mansion2.asm @@ -3,13 +3,13 @@ Mansion2Script: call EnableAutoTextBoxDrawing ld hl, Mansion2TrainerHeaders ld de, Mansion2ScriptPointers - ld a, [W_MANSION2CURSCRIPT] + ld a, [wMansion2CurScript] call ExecuteCurMapScriptInTable - ld [W_MANSION2CURSCRIPT], a + ld [wMansion2CurScript], a ret Mansion2Script_51fee: - ld hl, wd126 + ld hl, wCurrentMapScriptFlags bit 5, [hl] res 5, [hl] ret z @@ -112,7 +112,7 @@ Mansion2Text5: jr nz, .asm_520b9 ld a, $1 ld [wDoNotWaitForButtonPressAfterDisplayingText], a - ld hl, wd126 + ld hl, wCurrentMapScriptFlags set 5, [hl] ld hl, Mansion2Text_520c7 call PrintText diff --git a/scripts/mansion3.asm b/scripts/mansion3.asm index e0ad97c2..c71979d5 100755 --- a/scripts/mansion3.asm +++ b/scripts/mansion3.asm @@ -3,13 +3,13 @@ Mansion3Script: call EnableAutoTextBoxDrawing ld hl, Mansion3TrainerHeader0 ld de, Mansion3ScriptPointers - ld a, [W_MANSION3CURSCRIPT] + ld a, [wMansion3CurScript] call ExecuteCurMapScriptInTable - ld [W_MANSION3CURSCRIPT], a + ld [wMansion3CurScript], a ret Mansion3Script_52204: - ld hl, wd126 + ld hl, wCurrentMapScriptFlags bit 5, [hl] res 5, [hl] ret z diff --git a/scripts/mansion4.asm b/scripts/mansion4.asm index 028ecc32..12420990 100755 --- a/scripts/mansion4.asm +++ b/scripts/mansion4.asm @@ -3,13 +3,13 @@ Mansion4Script: call EnableAutoTextBoxDrawing ld hl, Mansion4TrainerHeader0 ld de, Mansion4ScriptPointers - ld a, [W_MANSION4CURSCRIPT] + ld a, [wMansion4CurScript] call ExecuteCurMapScriptInTable - ld [W_MANSION4CURSCRIPT], a + ld [wMansion4CurScript], a ret Mansion4Script_523cf: - ld hl, wd126 + ld hl, wCurrentMapScriptFlags bit 5, [hl] res 5, [hl] ret z diff --git a/scripts/mtmoon1.asm b/scripts/mtmoon1.asm index c8a43a66..604e490a 100755 --- a/scripts/mtmoon1.asm +++ b/scripts/mtmoon1.asm @@ -2,9 +2,9 @@ MtMoon1Script: call EnableAutoTextBoxDrawing ld hl, MtMoon1TrainerHeader0 ld de, MtMoon1ScriptPointers - ld a, [W_MTMOON1CURSCRIPT] + ld a, [wMtMoon1CurScript] call ExecuteCurMapScriptInTable - ld [W_MTMOON1CURSCRIPT], a + ld [wMtMoon1CurScript], a ret MtMoon1ScriptPointers: diff --git a/scripts/mtmoon3.asm b/scripts/mtmoon3.asm index ab6ce1c2..b8d14bd5 100755 --- a/scripts/mtmoon3.asm +++ b/scripts/mtmoon3.asm @@ -2,9 +2,9 @@ MtMoon3Script: call EnableAutoTextBoxDrawing ld hl, MtMoon3TrainerHeaders ld de, MtMoon3ScriptPointers - ld a, [W_MTMOON3CURSCRIPT] + ld a, [wMtMoon3CurScript] call ExecuteCurMapScriptInTable - ld [W_MTMOON3CURSCRIPT], a + ld [wMtMoon3CurScript], a CheckEvent EVENT_BEAT_MT_MOON_EXIT_SUPER_NERD ret z ld hl, CoordsData_49d37 @@ -43,8 +43,8 @@ MtMoon3Script_49cd7: xor a ld [wJoyIgnore], a MtMoon3Script_49ce5: - ld [W_MTMOON3CURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wMtMoon3CurScript], a + ld [wCurMapScript], a ret MtMoon3Script_49cec: diff --git a/scripts/museum1f.asm b/scripts/museum1f.asm index 47959247..30e6f594 100755 --- a/scripts/museum1f.asm +++ b/scripts/museum1f.asm @@ -4,7 +4,7 @@ Museum1FScript: xor a ld [wDoNotWaitForButtonPressAfterDisplayingText], a ld hl, Museum1FScriptPointers - ld a, [W_MUSEUM1FCURSCRIPT] + ld a, [wMuseum1FCurScript] call JumpTable ret diff --git a/scripts/museum1f2.asm b/scripts/museum1f2.asm index cefc0fce..7e8878a2 100755 --- a/scripts/museum1f2.asm +++ b/scripts/museum1f2.asm @@ -85,7 +85,7 @@ Func_f1c1b: .asm_f1cd7 ld a, $1 - ld [W_MUSEUM1FCURSCRIPT], a + ld [wMuseum1FCurScript], a jr .asm_f1cfc .asm_f1cde diff --git a/scripts/oakslab.asm b/scripts/oakslab.asm index 63f09015..5a6b9456 100755 --- a/scripts/oakslab.asm +++ b/scripts/oakslab.asm @@ -6,7 +6,7 @@ OaksLabScript: xor a ld [wDoNotWaitForButtonPressAfterDisplayingText], a ld hl, OaksLabScriptPointers - ld a, [W_OAKSLABCURSCRIPT] + ld a, [wOaksLabCurScript] call JumpTable ret @@ -48,7 +48,7 @@ OaksLabScript0: res 4, [hl] ld a, $1 - ld [W_OAKSLABCURSCRIPT], a + ld [wOaksLabCurScript], a ret OaksLabScript1: @@ -58,7 +58,7 @@ OaksLabScript1: call MoveSprite ld a, $2 - ld [W_OAKSLABCURSCRIPT], a + ld [wOaksLabCurScript], a ret OakEntryMovement: @@ -79,7 +79,7 @@ OaksLabScript2: predef ShowObject ld a, $3 - ld [W_OAKSLABCURSCRIPT], a + ld [wOaksLabCurScript], a ret OaksLabScript3: @@ -102,7 +102,7 @@ OaksLabScript3: call SetSpriteFacingDirectionAndDelay ld a, $4 - ld [W_OAKSLABCURSCRIPT], a + ld [wOaksLabCurScript], a ret PlayerEntryMovementRLE: @@ -125,7 +125,7 @@ OaksLabScript4: call PlayDefaultMusic ld a, $5 - ld [W_OAKSLABCURSCRIPT], a + ld [wOaksLabCurScript], a ret OaksLabScript5: @@ -155,7 +155,7 @@ OaksLabScript5: ld [wJoyIgnore], a ld a, $6 - ld [W_OAKSLABCURSCRIPT], a + ld [wOaksLabCurScript], a ret OaksLabScript6: @@ -185,7 +185,7 @@ OaksLabScript6: ld [wPlayerMovingDirection], a ld a, $7 - ld [W_OAKSLABCURSCRIPT], a + ld [wOaksLabCurScript], a ret OaksLabScript7: @@ -195,7 +195,7 @@ OaksLabScript7: call Delay3 ld a, $6 - ld [W_OAKSLABCURSCRIPT], a + ld [wOaksLabCurScript], a ret OaksLabScript8: @@ -204,7 +204,7 @@ OaksLabScript8: ld de, .SonyPushesPlayerAwayFromEeveeBall call MoveSprite ld a, $9 - ld [W_OAKSLABCURSCRIPT], a + ld [wOaksLabCurScript], a ret .SonyPushesPlayerAwayFromEeveeBall @@ -227,7 +227,7 @@ OaksLabScript9: ld [hSpriteFacingDirection], a call SetSpriteFacingDirectionAndDelay ld a, 1 - ld [W_RIVALSTARTER], a + ld [wRivalStarter], a ld a, EEVEE ld [wd11e], a call GetMonName @@ -238,7 +238,7 @@ OaksLabScript9: call DisplayTextID ld a, $a - ld [W_OAKSLABCURSCRIPT], a + ld [wOaksLabCurScript], a ret .asm_1c564 @@ -277,7 +277,7 @@ OaksLabScript10: .asm_1c5a6 call StartSimulatingJoypadStates ld a, $b - ld [W_OAKSLABCURSCRIPT], a + ld [wOaksLabCurScript], a ret OaksLabRLE_PlayerWalksToOak: @@ -298,7 +298,7 @@ OaksLabScript11: ld [wJoyIgnore], a ld a, $c - ld [W_OAKSLABCURSCRIPT], a + ld [wOaksLabCurScript], a ret OaksLabScript12: @@ -333,7 +333,7 @@ OaksLabScript12: ld [hSpriteIndexOrTextID], a call MoveSprite ld a, $d - ld [W_OAKSLABCURSCRIPT], a + ld [wOaksLabCurScript], a ret OaksLabScript13: @@ -358,7 +358,7 @@ OaksLabScript13: ld a, PLAYER_DIR_UP ld [wPlayerMovingDirection], a ld a, $e - ld [W_OAKSLABCURSCRIPT], a + ld [wOaksLabCurScript], a ret OaksLabScript14: @@ -376,7 +376,7 @@ OaksLabScript14: ld b, $2 .asm_1c660 ld a, b - ld [W_RIVALSTARTER], a + ld [wRivalStarter], a ld a, $ff ^ (A_BUTTON | B_BUTTON) ld [wJoyIgnore], a @@ -393,7 +393,7 @@ OaksLabScript14: predef HealParty SetEvent EVENT_BATTLED_RIVAL_IN_OAKS_LAB ld a, $f - ld [W_OAKSLABCURSCRIPT], a + ld [wOaksLabCurScript], a ret OaksLabScript15: @@ -418,7 +418,7 @@ OaksLabScript15: .asm_1c6bd ld [wNPCMovementDirections], a ld a, $10 - ld [W_OAKSLABCURSCRIPT], a + ld [wOaksLabCurScript], a ret .OaksLabMovement_RivalWalksOut1 @@ -442,7 +442,7 @@ OaksLabScript16: predef HideObject call PlayDefaultMusic ld a, $11 - ld [W_OAKSLABCURSCRIPT], a + ld [wOaksLabCurScript], a ret .asm_1c6ed @@ -479,7 +479,7 @@ OaksLabScript17: ld [hSpriteIndexOrTextID], a call DisplayTextID ld a, $12 - ld [W_OAKSLABCURSCRIPT], a + ld [wOaksLabCurScript], a ret OaksLabScript18: @@ -489,7 +489,7 @@ OaksLabScript18: xor a ld [wJoyIgnore], a ld a, $16 - ld [W_OAKSLABCURSCRIPT], a + ld [wOaksLabCurScript], a ret OaksLabScript19: @@ -519,7 +519,7 @@ OaksLabScript19: ld de, wNPCMovementDirections2 call MoveSprite ld a, $14 - ld [W_OAKSLABCURSCRIPT], a + ld [wOaksLabCurScript], a ret OaksLabScript_1c78e: @@ -583,7 +583,7 @@ OaksLabScript20: call DisplayTextID SetEvent EVENT_GOT_POKEDEX ld a, $1 - ld [W_VIRIDIANCITYCURSCRIPT], a + ld [wViridianCityCurScript], a SetEvent EVENT_OAK_GOT_PARCEL ld a, HS_LYING_OLD_MAN ld [wMissableObjectIndex], a @@ -605,7 +605,7 @@ OaksLabScript20: ld de, wNPCMovementDirections2 call MoveSprite ld a, $15 - ld [W_OAKSLABCURSCRIPT], a + ld [wOaksLabCurScript], a ret OaksLabScript21: @@ -625,7 +625,7 @@ OaksLabScript21: xor a ld [wJoyIgnore], a ld a, $16 - ld [W_OAKSLABCURSCRIPT], a + ld [wOaksLabCurScript], a ret OaksLabScript22: @@ -801,7 +801,7 @@ OaksLabScript_1c9ac: ld [wWhichEmotionBubble], a predef EmotionBubble ld a, $8 - ld [W_OAKSLABCURSCRIPT], a + ld [wOaksLabCurScript], a jp TextScriptEnd OaksLabText3: @@ -863,7 +863,7 @@ OaksLabText3: call PrintText call OaksLabScript_1c897 ld a, $13 - ld [W_OAKSLABCURSCRIPT], a + ld [wOaksLabCurScript], a jr .asm_1ca6f .asm_1ca4a @@ -1025,7 +1025,7 @@ OaksLabText_1cb3a: OaksLabText18: TX_ASM ld a, PIKACHU - ld [W_PLAYERSTARTER], a + ld [wPlayerStarter], a ld [wd11e], a call GetMonName ld a, $1 diff --git a/scripts/pallettown.asm b/scripts/pallettown.asm index ad7ca079..803aa4f3 100755 --- a/scripts/pallettown.asm +++ b/scripts/pallettown.asm @@ -5,7 +5,7 @@ PalletTownScript: .next call EnableAutoTextBoxDrawing ld hl, PalletTownScriptPointers - ld a, [W_PALLETTOWNCURSCRIPT] + ld a, [wPalletTownCurScript] jp JumpTable PalletTownScriptPointers: @@ -47,7 +47,7 @@ PalletTownScript0: ; trigger the next script ld a, 1 - ld [W_PALLETTOWNCURSCRIPT], a + ld [wPalletTownCurScript], a ret PalletTownScript1: @@ -75,7 +75,7 @@ PalletTownScript1: ld a, SPRITE_FACING_UP ld [wSpriteStateData1 + 1 * $10 + 9], a ld a, 2 - ld [W_PALLETTOWNCURSCRIPT], a + ld [wPalletTownCurScript], a ret PalletTownScript2: @@ -98,7 +98,7 @@ PalletTownScript2: ; trigger the next script ld a, 3 - ld [W_PALLETTOWNCURSCRIPT], a + ld [wPalletTownCurScript], a ret PalletTownScript3: @@ -130,7 +130,7 @@ PalletTownScript3: ; trigger the next script ld a, 4 - ld [W_PALLETTOWNCURSCRIPT], a + ld [wPalletTownCurScript], a ret PalletTownScript4: @@ -139,7 +139,7 @@ PalletTownScript4: ld [wJoyIgnore], a xor a ld [wListScrollOffset], a - ld a, STARTER_PIKACHU_BATTLE + ld a, BATTLE_TYPE_PIKACHU ld [wBattleType], a ld a, PIKACHU ld [wCurOpponent], a @@ -148,7 +148,7 @@ PalletTownScript4: ; trigger the next script ld a, 5 - ld [W_PALLETTOWNCURSCRIPT], a + ld [wPalletTownCurScript], a ret PalletTownScript5: @@ -169,7 +169,7 @@ PalletTownScript5: ; trigger the next script ld a, 6 - ld [W_PALLETTOWNCURSCRIPT], a + ld [wPalletTownCurScript], a ret PalletTownScript6: @@ -186,7 +186,7 @@ PalletTownScript6: ; trigger the next script ld a, 7 - ld [W_PALLETTOWNCURSCRIPT], a + ld [wPalletTownCurScript], a ret PalletTownScript7: @@ -196,7 +196,7 @@ PalletTownScript7: ; trigger the next script ld a, 8 - ld [W_PALLETTOWNCURSCRIPT], a + ld [wPalletTownCurScript], a ret PalletTownScript8: diff --git a/scripts/pewtercity.asm b/scripts/pewtercity.asm index da29d814..b7271b05 100755 --- a/scripts/pewtercity.asm +++ b/scripts/pewtercity.asm @@ -3,7 +3,7 @@ PewterCityScript: ld hl, wd492 res 7, [hl] ld hl, PewterCityScriptPointers - ld a, [W_PEWTERCITYCURSCRIPT] + ld a, [wPewterCityCurScript] call JumpTable ret @@ -18,7 +18,7 @@ PewterCityScriptPointers: PewterCityScript0: xor a - ld [W_MUSEUM1FCURSCRIPT], a + ld [wMuseum1FCurScript], a ResetEvent EVENT_BOUGHT_MUSEUM_TICKET call PewterCityScript_1925e ret @@ -76,7 +76,7 @@ PewterCityScript1: ld de, MovementData_PewterMuseumGuyExit call MoveSprite ld a, $2 - ld [W_PEWTERCITYCURSCRIPT], a + ld [wPewterCityCurScript], a ret MovementData_PewterMuseumGuyExit: @@ -94,7 +94,7 @@ PewterCityScript2: ld [wMissableObjectIndex], a predef HideObject ld a, $3 - ld [W_PEWTERCITYCURSCRIPT], a + ld [wPewterCityCurScript], a ret PewterCityScript3: @@ -107,7 +107,7 @@ PewterCityScript3: xor a ld [wJoyIgnore], a ld a, $0 - ld [W_PEWTERCITYCURSCRIPT], a + ld [wPewterCityCurScript], a ret PewterCityScript4: @@ -141,7 +141,7 @@ PewterCityScript4: ld de, MovementData_PewterGymGuyExit call MoveSprite ld a, $5 - ld [W_PEWTERCITYCURSCRIPT], a + ld [wPewterCityCurScript], a ret MovementData_PewterGymGuyExit: @@ -160,7 +160,7 @@ PewterCityScript5: ld [wMissableObjectIndex], a predef HideObject ld a, $6 - ld [W_PEWTERCITYCURSCRIPT], a + ld [wPewterCityCurScript], a ret PewterCityScript6: @@ -173,7 +173,7 @@ PewterCityScript6: xor a ld [wJoyIgnore], a ld a, $0 - ld [W_PEWTERCITYCURSCRIPT], a + ld [wPewterCityCurScript], a ret PewterCityTextPointers: @@ -226,7 +226,7 @@ PewterCityText3: ld [wSpriteIndex], a call GetSpritePosition2 ld a, $1 - ld [W_PEWTERCITYCURSCRIPT], a + ld [wPewterCityCurScript], a .asm_193ee jp TextScriptEnd @@ -290,7 +290,7 @@ PewterCityText5: ld [wSpriteIndex], a call GetSpritePosition2 ld a, $4 - ld [W_PEWTERCITYCURSCRIPT], a + ld [wPewterCityCurScript], a jp TextScriptEnd PewterCityText_1945d: diff --git a/scripts/pewtergym.asm b/scripts/pewtergym.asm index 922a3d3e..6014cf33 100755 --- a/scripts/pewtergym.asm +++ b/scripts/pewtergym.asm @@ -1,14 +1,14 @@ PewterGymScript: - ld hl, wd126 + ld hl, wCurrentMapScriptFlags bit 6, [hl] res 6, [hl] call nz, PewterGymScript_5c3a4 call EnableAutoTextBoxDrawing ld hl, PewterGymTrainerHeaders ld de, PewterGymScriptPointers - ld a, [W_PEWTERGYMCURSCRIPT] + ld a, [wPewterGymCurScript] call ExecuteCurMapScriptInTable - ld [W_PEWTERGYMCURSCRIPT], a + ld [wPewterGymCurScript], a ret PewterGymScript_5c3a4: @@ -26,8 +26,8 @@ Gym1LeaderName: PewterGymScript_5c3bf: xor a ld [wJoyIgnore], a - ld [W_PEWTERGYMCURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wPewterGymCurScript], a + ld [wCurMapScript], a ret PewterGymScriptPointers: @@ -131,8 +131,8 @@ PewterGymText1: xor a ld [hJoyHeld], a ld a, $3 - ld [W_PEWTERGYMCURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wPewterGymCurScript], a + ld [wCurMapScript], a .asm_5c49b jp TextScriptEnd diff --git a/scripts/pokemontower2.asm b/scripts/pokemontower2.asm index 28e57d22..0a0aa3d5 100755 --- a/scripts/pokemontower2.asm +++ b/scripts/pokemontower2.asm @@ -1,14 +1,14 @@ PokemonTower2Script: call EnableAutoTextBoxDrawing ld hl, PokemonTower2ScriptPointers - ld a, [W_POKEMONTOWER2CURSCRIPT] + ld a, [wPokemonTower2CurScript] jp JumpTable PokemonTower2Script_604fe: xor a ld [wJoyIgnore], a - ld [W_POKEMONTOWER2CURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wPokemonTower2CurScript], a + ld [wCurMapScript], a ret PokemonTower2ScriptPointers: @@ -78,8 +78,8 @@ PokemonTower2Script1: call StopAllMusic callba Music_RivalAlternateStart ld a, $2 - ld [W_POKEMONTOWER2CURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wPokemonTower2CurScript], a + ld [wCurMapScript], a ret MovementData_605a9: @@ -115,8 +115,8 @@ PokemonTower2Script2: ld [wJoyIgnore], a call PlayDefaultMusic ld a, $0 - ld [W_POKEMONTOWER2CURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wPokemonTower2CurScript], a + ld [wCurMapScript], a ret PokemonTower2TextPointers: @@ -141,13 +141,13 @@ PokemonTower2Text1: call SaveEndBattleTextPointers ld a, OPP_SONY2 ld [wCurOpponent], a - ld a, [W_RIVALSTARTER] + ld a, [wRivalStarter] add $1 ld [wTrainerNo], a ld a, $1 - ld [W_POKEMONTOWER2CURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wPokemonTower2CurScript], a + ld [wCurMapScript], a .asm_41852 jp TextScriptEnd diff --git a/scripts/pokemontower3.asm b/scripts/pokemontower3.asm index 453f6baa..8be15c9e 100755 --- a/scripts/pokemontower3.asm +++ b/scripts/pokemontower3.asm @@ -2,9 +2,9 @@ PokemonTower3Script: call EnableAutoTextBoxDrawing ld hl, PokemonTower3TrainerHeaders ld de, PokemonTower3ScriptPointers - ld a, [W_POKEMONTOWER3CURSCRIPT] + ld a, [wPokemonTower3CurScript] call ExecuteCurMapScriptInTable - ld [W_POKEMONTOWER3CURSCRIPT], a + ld [wPokemonTower3CurScript], a ret PokemonTower3ScriptPointers: diff --git a/scripts/pokemontower4.asm b/scripts/pokemontower4.asm index 2264f6d8..fe7a4e08 100755 --- a/scripts/pokemontower4.asm +++ b/scripts/pokemontower4.asm @@ -2,9 +2,9 @@ PokemonTower4Script: call EnableAutoTextBoxDrawing ld hl, PokemonTower4TrainerHeaders ld de, PokemonTower4ScriptPointers - ld a, [W_POKEMONTOWER4CURSCRIPT] + ld a, [wPokemonTower4CurScript] call ExecuteCurMapScriptInTable - ld [W_POKEMONTOWER4CURSCRIPT], a + ld [wPokemonTower4CurScript], a ret PokemonTower4ScriptPointers: diff --git a/scripts/pokemontower5.asm b/scripts/pokemontower5.asm index d5d5e1b7..82b912b5 100755 --- a/scripts/pokemontower5.asm +++ b/scripts/pokemontower5.asm @@ -2,9 +2,9 @@ PokemonTower5Script: call EnableAutoTextBoxDrawing ld hl, PokemonTower5TrainerHeaders ld de, PokemonTower5ScriptPointers - ld a, [W_POKEMONTOWER5CURSCRIPT] + ld a, [wPokemonTower5CurScript] call ExecuteCurMapScriptInTable - ld [W_POKEMONTOWER5CURSCRIPT], a + ld [wPokemonTower5CurScript], a ret PokemonTower5ScriptPointers: diff --git a/scripts/pokemontower6.asm b/scripts/pokemontower6.asm index a9b21a89..82c39a41 100755 --- a/scripts/pokemontower6.asm +++ b/scripts/pokemontower6.asm @@ -2,16 +2,16 @@ PokemonTower6Script: call EnableAutoTextBoxDrawing ld hl, PokemonTower6TrainerHeaders ld de, PokemonTower6ScriptPointers - ld a, [W_POKEMONTOWER6CURSCRIPT] + ld a, [wPokemonTower6CurScript] call ExecuteCurMapScriptInTable - ld [W_POKEMONTOWER6CURSCRIPT], a + ld [wPokemonTower6CurScript], a ret PokemonTower6Script_60b02: xor a ld [wJoyIgnore], a - ld [W_POKEMONTOWER6CURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wPokemonTower6CurScript], a + ld [wCurMapScript], a ret PokemonTower6ScriptPointers: @@ -37,8 +37,8 @@ PokemonTower6Script0: ld a, 30 ld [wCurEnemyLVL], a ld a, $4 - ld [W_POKEMONTOWER6CURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wPokemonTower6CurScript], a + ld [wCurMapScript], a ret CoordsData_60b45: @@ -66,8 +66,8 @@ PokemonTower6Script4: xor a ld [wJoyIgnore], a ld a, $0 - ld [W_POKEMONTOWER6CURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wPokemonTower6CurScript], a + ld [wCurMapScript], a ret .asm_60b82 ld a, $1 @@ -80,8 +80,8 @@ PokemonTower6Script4: ld hl, wd730 set 7, [hl] ld a, $3 - ld [W_POKEMONTOWER6CURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wPokemonTower6CurScript], a + ld [wCurMapScript], a ret PokemonTower6Script3: @@ -90,8 +90,8 @@ PokemonTower6Script3: ret nz call Delay3 xor a - ld [W_POKEMONTOWER6CURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wPokemonTower6CurScript], a + ld [wCurMapScript], a ret PokemonTower6TextPointers: diff --git a/scripts/pokemontower7.asm b/scripts/pokemontower7.asm index 34345db9..9a016d84 100755 --- a/scripts/pokemontower7.asm +++ b/scripts/pokemontower7.asm @@ -1,7 +1,7 @@ PokemonTower7Script: call EnableAutoTextBoxDrawing ld hl, PokemonTower7ScriptPointers - ld a, [W_POKEMONTOWER7CURSCRIPT] + ld a, [wPokemonTower7CurScript] call JumpTable ret @@ -9,7 +9,7 @@ PokemonTower7Script_60d01: xor a ld [wJoyIgnore], a PokemonTower7Script_60d05: - ld [W_POKEMONTOWER7CURSCRIPT], a + ld [wPokemonTower7CurScript], a ret PokemonTower7ScriptPointers: @@ -245,7 +245,7 @@ PokemonTower7Script11: ld hl, wd72d set 3, [hl] ld a, $0 - ld [W_POKEMONTOWER7CURSCRIPT], a + ld [wPokemonTower7CurScript], a ret PokemonTower7TextPointers: @@ -307,7 +307,7 @@ PokemonTower7Text3: ld [wMissableObjectIndex], a predef ShowObject ld a, $b - ld [W_POKEMONTOWER7CURSCRIPT], a + ld [wPokemonTower7CurScript], a jp TextScriptEnd PokemonTower7Text_60f75: diff --git a/scripts/powerplant.asm b/scripts/powerplant.asm index 353ab2f4..c7a5625f 100755 --- a/scripts/powerplant.asm +++ b/scripts/powerplant.asm @@ -1,27 +1,27 @@ PowerPlantScript: call EnableAutoTextBoxDrawing ld hl, PowerPlantTrainerHeaders - ld de, PowerPlantScriptPointers - ld a, [W_POWERPLANTCURSCRIPT] + ld de, .ScriptPointers + ld a, [wPowerPlantCurScript] call ExecuteCurMapScriptInTable - ld [W_POWERPLANTCURSCRIPT], a + ld [wPowerPlantCurScript], a ret -PowerPlantScriptPointers: +.ScriptPointers dw CheckFightingMapTrainers dw DisplayEnemyTrainerTextAndStartBattle dw EndTrainerBattle PowerPlantTextPointers: - dw PowerPlantText1 - dw PowerPlantText2 - dw PowerPlantText3 - dw PowerPlantText4 - dw PowerPlantText5 - dw PowerPlantText6 - dw PowerPlantText7 - dw PowerPlantText8 - dw PowerPlantText9 + dw Voltorb0Text + dw Voltorb1Text + dw Voltorb2Text + dw Voltorb3Text + dw Voltorb4Text + dw Voltorb5Text + dw Voltorb6Text + dw Voltorb7Text + dw ZapdosText dw PickUpItemText dw PickUpItemText dw PickUpItemText @@ -29,82 +29,82 @@ PowerPlantTextPointers: dw PickUpItemText PowerPlantTrainerHeaders: -PowerPlantTrainerHeader0: - dbEventFlagBit EVENT_BEAT_POWER_PLANT_TRAINER_0 +Voltorb0TrainerHeader: + dbEventFlagBit EVENT_BEAT_POWER_PLANT_VOLTORB_0 db 0 ; view range - dwEventFlagAddress EVENT_BEAT_POWER_PLANT_TRAINER_0 + dwEventFlagAddress EVENT_BEAT_POWER_PLANT_VOLTORB_0 dw VoltorbBattleText ; TextBeforeBattle dw VoltorbBattleText ; TextAfterBattle dw VoltorbBattleText ; TextEndBattle dw VoltorbBattleText ; TextEndBattle -PowerPlantTrainerHeader1: - dbEventFlagBit EVENT_BEAT_POWER_PLANT_TRAINER_1 +Voltorb1TrainerHeader: + dbEventFlagBit EVENT_BEAT_POWER_PLANT_VOLTORB_1 db 0 ; view range - dwEventFlagAddress EVENT_BEAT_POWER_PLANT_TRAINER_1 + dwEventFlagAddress EVENT_BEAT_POWER_PLANT_VOLTORB_1 dw VoltorbBattleText ; TextBeforeBattle dw VoltorbBattleText ; TextAfterBattle dw VoltorbBattleText ; TextEndBattle dw VoltorbBattleText ; TextEndBattle -PowerPlantTrainerHeader2: - dbEventFlagBit EVENT_BEAT_POWER_PLANT_TRAINER_2 +Voltorb2TrainerHeader: + dbEventFlagBit EVENT_BEAT_POWER_PLANT_VOLTORB_2 db 0 ; view range - dwEventFlagAddress EVENT_BEAT_POWER_PLANT_TRAINER_2 + dwEventFlagAddress EVENT_BEAT_POWER_PLANT_VOLTORB_2 dw VoltorbBattleText ; TextBeforeBattle dw VoltorbBattleText ; TextAfterBattle dw VoltorbBattleText ; TextEndBattle dw VoltorbBattleText ; TextEndBattle -PowerPlantTrainerHeader3: - dbEventFlagBit EVENT_BEAT_POWER_PLANT_TRAINER_3 +Voltorb3TrainerHeader: + dbEventFlagBit EVENT_BEAT_POWER_PLANT_VOLTORB_3 db 0 ; view range - dwEventFlagAddress EVENT_BEAT_POWER_PLANT_TRAINER_3 + dwEventFlagAddress EVENT_BEAT_POWER_PLANT_VOLTORB_3 dw VoltorbBattleText ; TextBeforeBattle dw VoltorbBattleText ; TextAfterBattle dw VoltorbBattleText ; TextEndBattle dw VoltorbBattleText ; TextEndBattle -PowerPlantTrainerHeader4: - dbEventFlagBit EVENT_BEAT_POWER_PLANT_TRAINER_4 +Voltorb4TrainerHeader: + dbEventFlagBit EVENT_BEAT_POWER_PLANT_VOLTORB_4 db 0 ; view range - dwEventFlagAddress EVENT_BEAT_POWER_PLANT_TRAINER_4 + dwEventFlagAddress EVENT_BEAT_POWER_PLANT_VOLTORB_4 dw VoltorbBattleText ; TextBeforeBattle dw VoltorbBattleText ; TextAfterBattle dw VoltorbBattleText ; TextEndBattle dw VoltorbBattleText ; TextEndBattle -PowerPlantTrainerHeader5: - dbEventFlagBit EVENT_BEAT_POWER_PLANT_TRAINER_5 +Voltorb5TrainerHeader: + dbEventFlagBit EVENT_BEAT_POWER_PLANT_VOLTORB_5 db 0 ; view range - dwEventFlagAddress EVENT_BEAT_POWER_PLANT_TRAINER_5 + dwEventFlagAddress EVENT_BEAT_POWER_PLANT_VOLTORB_5 dw VoltorbBattleText ; TextBeforeBattle dw VoltorbBattleText ; TextAfterBattle dw VoltorbBattleText ; TextEndBattle dw VoltorbBattleText ; TextEndBattle -PowerPlantTrainerHeader6: - dbEventFlagBit EVENT_BEAT_POWER_PLANT_TRAINER_6 +Voltorb6TrainerHeader: + dbEventFlagBit EVENT_BEAT_POWER_PLANT_VOLTORB_6 db 0 ; view range - dwEventFlagAddress EVENT_BEAT_POWER_PLANT_TRAINER_6 + dwEventFlagAddress EVENT_BEAT_POWER_PLANT_VOLTORB_6 dw VoltorbBattleText ; TextBeforeBattle dw VoltorbBattleText ; TextAfterBattle dw VoltorbBattleText ; TextEndBattle dw VoltorbBattleText ; TextEndBattle -PowerPlantTrainerHeader7: - dbEventFlagBit EVENT_BEAT_POWER_PLANT_TRAINER_7, 1 +Voltorb7TrainerHeader: + dbEventFlagBit EVENT_BEAT_POWER_PLANT_VOLTORB_7, 1 db 0 ; view range - dwEventFlagAddress EVENT_BEAT_POWER_PLANT_TRAINER_7, 1 + dwEventFlagAddress EVENT_BEAT_POWER_PLANT_VOLTORB_7, 1 dw VoltorbBattleText ; TextBeforeBattle dw VoltorbBattleText ; TextAfterBattle dw VoltorbBattleText ; TextEndBattle dw VoltorbBattleText ; TextEndBattle -PowerPlantTrainerHeader8: - dbEventFlagBit EVENT_BEAT_POWER_PLANT_TRAINER_8, 1 +ZapdosTrainerHeader: + dbEventFlagBit EVENT_BEAT_ZAPDOS, 1 db 0 ; view range - dwEventFlagAddress EVENT_BEAT_POWER_PLANT_TRAINER_8, 1 + dwEventFlagAddress EVENT_BEAT_ZAPDOS, 1 dw ZapdosBattleText ; TextBeforeBattle dw ZapdosBattleText ; TextAfterBattle dw ZapdosBattleText ; TextEndBattle @@ -114,53 +114,53 @@ PowerPlantTrainerHeader8: InitVoltorbBattle: call TalkToTrainer - ld a, [W_CURMAPSCRIPT] - ld [W_POWERPLANTCURSCRIPT], a + ld a, [wCurMapScript] + ld [wPowerPlantCurScript], a jp TextScriptEnd -PowerPlantText1: +Voltorb0Text: TX_ASM - ld hl, PowerPlantTrainerHeader0 + ld hl, Voltorb0TrainerHeader jr InitVoltorbBattle -PowerPlantText2: +Voltorb1Text: TX_ASM - ld hl, PowerPlantTrainerHeader1 + ld hl, Voltorb1TrainerHeader jr InitVoltorbBattle -PowerPlantText3: +Voltorb2Text: TX_ASM - ld hl, PowerPlantTrainerHeader2 + ld hl, Voltorb2TrainerHeader jr InitVoltorbBattle -PowerPlantText4: +Voltorb3Text: TX_ASM - ld hl, PowerPlantTrainerHeader3 + ld hl, Voltorb3TrainerHeader jr InitVoltorbBattle -PowerPlantText5: +Voltorb4Text: TX_ASM - ld hl, PowerPlantTrainerHeader4 + ld hl, Voltorb4TrainerHeader jr InitVoltorbBattle -PowerPlantText6: +Voltorb5Text: TX_ASM - ld hl, PowerPlantTrainerHeader5 + ld hl, Voltorb5TrainerHeader jr InitVoltorbBattle -PowerPlantText7: +Voltorb6Text: TX_ASM - ld hl, PowerPlantTrainerHeader6 + ld hl, Voltorb6TrainerHeader jr InitVoltorbBattle -PowerPlantText8: +Voltorb7Text: TX_ASM - ld hl, PowerPlantTrainerHeader7 + ld hl, Voltorb7TrainerHeader jr InitVoltorbBattle -PowerPlantText9: +ZapdosText: TX_ASM - ld hl, PowerPlantTrainerHeader8 + ld hl, ZapdosTrainerHeader jr InitVoltorbBattle VoltorbBattleText: diff --git a/scripts/rockethideout1.asm b/scripts/rockethideout1.asm index ac699aba..35c9026a 100755 --- a/scripts/rockethideout1.asm +++ b/scripts/rockethideout1.asm @@ -3,13 +3,13 @@ RocketHideout1Script: call EnableAutoTextBoxDrawing ld hl, RocketHideout1TrainerHeaders ld de, RocketHideout1ScriptPointers - ld a, [W_ROCKETHIDEOUT1CURSCRIPT] + ld a, [wRocketHideout1CurScript] call ExecuteCurMapScriptInTable - ld [W_ROCKETHIDEOUT1CURSCRIPT], a + ld [wRocketHideout1CurScript], a ret RocketHideout1Script_44be0: - ld hl, wd126 + ld hl, wCurrentMapScriptFlags bit 5, [hl] res 5, [hl] ret z diff --git a/scripts/rockethideout2.asm b/scripts/rockethideout2.asm index 1436f7c4..b29e5396 100755 --- a/scripts/rockethideout2.asm +++ b/scripts/rockethideout2.asm @@ -2,9 +2,9 @@ RocketHideout2Script: call EnableAutoTextBoxDrawing ld hl, RocketHideout2TrainerHeaders ld de, RocketHideout2ScriptPointers - ld a, [W_ROCKETHIDEOUT2CURSCRIPT] + ld a, [wRocketHideout2CurScript] call ExecuteCurMapScriptInTable - ld [W_ROCKETHIDEOUT2CURSCRIPT], a + ld [wRocketHideout2CurScript], a ret RocketHideout2ScriptPointers: @@ -30,7 +30,7 @@ RocketHideout2Script0: ld a, $ff ld [wJoyIgnore], a ld a, $3 - ld [W_CURMAPSCRIPT], a + ld [wCurMapScript], a ret ;format: @@ -310,7 +310,7 @@ RocketHideout2Script3: ld hl, wd736 res 7, [hl] ld a, $0 - ld [W_CURMAPSCRIPT], a + ld [wCurMapScript], a ret LoadSpinnerArrowTiles: diff --git a/scripts/rockethideout3.asm b/scripts/rockethideout3.asm index 4e83b32a..ac08e868 100755 --- a/scripts/rockethideout3.asm +++ b/scripts/rockethideout3.asm @@ -2,9 +2,9 @@ RocketHideout3Script: call EnableAutoTextBoxDrawing ld hl, RocketHideout3TrainerHeaders ld de, RocketHideout3ScriptPointers - ld a, [W_ROCKETHIDEOUT3CURSCRIPT] + ld a, [wRocketHideout3CurScript] call ExecuteCurMapScriptInTable - ld [W_ROCKETHIDEOUT3CURSCRIPT], a + ld [wRocketHideout3CurScript], a ret RocketHideout3ScriptPointers: @@ -30,7 +30,7 @@ RocketHideout3Script0: ld a, $ff ld [wJoyIgnore], a ld a, $3 - ld [W_CURMAPSCRIPT], a + ld [wCurMapScript], a ret ;format: @@ -140,7 +140,7 @@ RocketHideout3Script3: ld hl, wd736 res 7, [hl] ld a, $0 - ld [W_CURMAPSCRIPT], a + ld [wCurMapScript], a ret RocketHideout3TextPointers: diff --git a/scripts/rockethideout4.asm b/scripts/rockethideout4.asm index 9c2c4d82..2b3e0e89 100755 --- a/scripts/rockethideout4.asm +++ b/scripts/rockethideout4.asm @@ -2,9 +2,9 @@ RocketHideout4Script: call EnableAutoTextBoxDrawing ld hl, RocketHideout4TrainerHeader0 ld de, RocketHideout4ScriptPointers - ld a, [W_ROCKETHIDEOUT4CURSCRIPT] + ld a, [wRocketHideout4CurScript] call ExecuteCurMapScriptInTable - ld [W_ROCKETHIDEOUT4CURSCRIPT], a + ld [wRocketHideout4CurScript], a ret RocketHideout4Script_45510: @@ -13,8 +13,8 @@ RocketHideout4Script_45510: xor a ld [wJoyIgnore], a RocketHideout4Script_4551e: - ld [W_ROCKETHIDEOUT4CURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wRocketHideout4CurScript], a + ld [wCurMapScript], a ret RocketHideout4Script_45525: @@ -61,11 +61,11 @@ RocketHideout4Script3: call GBFadeInFromBlack xor a ld [wJoyIgnore], a - ld hl, wd126 + ld hl, wCurrentMapScriptFlags set 5, [hl] ld a, $0 - ld [W_ROCKETHIDEOUT4CURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wRocketHideout4CurScript], a + ld [wCurMapScript], a ret RocketHideout4Script0: @@ -363,8 +363,8 @@ RocketHideout4Text0: xor a ld [hJoyHeld], a ld a, $3 - ld [W_ROCKETHIDEOUT4CURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wRocketHideout4CurScript], a + ld [wCurMapScript], a jr .asm_45801 .asm_457fb diff --git a/scripts/rockethideoutelevator.asm b/scripts/rockethideoutelevator.asm index 5a5e7ae2..526ac3cc 100755 --- a/scripts/rockethideoutelevator.asm +++ b/scripts/rockethideoutelevator.asm @@ -1,5 +1,5 @@ RocketHideoutElevatorScript: - ld hl, wd126 + ld hl, wCurrentMapScriptFlags bit 5, [hl] res 5, [hl] push hl diff --git a/scripts/rocktunnel1.asm b/scripts/rocktunnel1.asm index c32c1036..2819c350 100755 --- a/scripts/rocktunnel1.asm +++ b/scripts/rocktunnel1.asm @@ -2,9 +2,9 @@ RockTunnel1Script: call EnableAutoTextBoxDrawing ld hl, RockTunnel1TrainerHeaders ld de, RockTunnel1ScriptPointers - ld a, [W_ROCKTUNNEL1CURSCRIPT] + ld a, [wRockTunnel1CurScript] call ExecuteCurMapScriptInTable - ld [W_ROCKTUNNEL1CURSCRIPT], a + ld [wRockTunnel1CurScript], a ret RockTunnel1ScriptPointers: diff --git a/scripts/rocktunnel2.asm b/scripts/rocktunnel2.asm index d522ba0e..7ac3f426 100755 --- a/scripts/rocktunnel2.asm +++ b/scripts/rocktunnel2.asm @@ -2,9 +2,9 @@ RockTunnel2Script: call EnableAutoTextBoxDrawing ld hl, RockTunnel2TrainerHeaders ld de, RockTunnel2ScriptPointers - ld a, [W_ROCKTUNNEL2CURSCRIPT] + ld a, [wRockTunnel2CurScript] call ExecuteCurMapScriptInTable - ld [W_ROCKTUNNEL2CURSCRIPT], a + ld [wRockTunnel2CurScript], a ret RockTunnel2ScriptPointers: diff --git a/scripts/route10.asm b/scripts/route10.asm index 3337f870..ca0ab190 100755 --- a/scripts/route10.asm +++ b/scripts/route10.asm @@ -2,9 +2,9 @@ Route10Script: call EnableAutoTextBoxDrawing ld hl, Route10TrainerHeaders ld de, Route10ScriptPointers - ld a, [W_ROUTE10CURSCRIPT] + ld a, [wRoute10CurScript] call ExecuteCurMapScriptInTable - ld [W_ROUTE10CURSCRIPT], a + ld [wRoute10CurScript], a ret Route10ScriptPointers: diff --git a/scripts/route11.asm b/scripts/route11.asm index 0c41f113..ab3509c5 100755 --- a/scripts/route11.asm +++ b/scripts/route11.asm @@ -2,9 +2,9 @@ Route11Script: call EnableAutoTextBoxDrawing ld hl, Route11TrainerHeaders ld de, Route11ScriptPointers - ld a, [W_ROUTE11CURSCRIPT] + ld a, [wRoute11CurScript] call ExecuteCurMapScriptInTable - ld [W_ROUTE11CURSCRIPT], a + ld [wRoute11CurScript], a ret Route11ScriptPointers: diff --git a/scripts/route12.asm b/scripts/route12.asm index 5aad5bd0..e61f41c0 100755 --- a/scripts/route12.asm +++ b/scripts/route12.asm @@ -2,16 +2,16 @@ Route12Script: call EnableAutoTextBoxDrawing ld hl, Route12TrainerHeaders ld de, Route12ScriptPointers - ld a, [W_ROUTE12CURSCRIPT] + ld a, [wRoute12CurScript] call ExecuteCurMapScriptInTable - ld [W_ROUTE12CURSCRIPT], a + ld [wRoute12CurScript], a ret Route12Script_59606: xor a ld [wJoyIgnore], a - ld [W_ROUTE12CURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wRoute12CurScript], a + ld [wCurMapScript], a ret Route12ScriptPointers: @@ -37,8 +37,8 @@ Route12Script0: ld [wMissableObjectIndex], a predef HideObject ld a, $3 - ld [W_ROUTE12CURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wRoute12CurScript], a + ld [wCurMapScript], a ret Route12Script3: @@ -56,8 +56,8 @@ Route12Script3: SetEvent EVENT_BEAT_ROUTE12_SNORLAX call Delay3 ld a, $0 - ld [W_ROUTE12CURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wRoute12CurScript], a + ld [wCurMapScript], a ret Route12TextPointers: diff --git a/scripts/route13.asm b/scripts/route13.asm index 9c6cff5e..61f43ee9 100755 --- a/scripts/route13.asm +++ b/scripts/route13.asm @@ -2,9 +2,9 @@ Route13Script: call EnableAutoTextBoxDrawing ld hl, Route13TrainerHeaders ld de, Route13ScriptPointers - ld a, [W_ROUTE13CURSCRIPT] + ld a, [wRoute13CurScript] call ExecuteCurMapScriptInTable - ld [W_ROUTE13CURSCRIPT], a + ld [wRoute13CurScript], a ret Route13ScriptPointers: diff --git a/scripts/route14.asm b/scripts/route14.asm index e4e82e2b..70f747c5 100755 --- a/scripts/route14.asm +++ b/scripts/route14.asm @@ -2,9 +2,9 @@ Route14Script: call EnableAutoTextBoxDrawing ld hl, Route14TrainerHeaders ld de, Route14ScriptPointers - ld a, [W_ROUTE14CURSCRIPT] + ld a, [wRoute14CurScript] call ExecuteCurMapScriptInTable - ld [W_ROUTE14CURSCRIPT], a + ld [wRoute14CurScript], a ret Route14ScriptPointers: diff --git a/scripts/route15.asm b/scripts/route15.asm index eb2e67d9..e3329ab4 100755 --- a/scripts/route15.asm +++ b/scripts/route15.asm @@ -2,9 +2,9 @@ Route15Script: call EnableAutoTextBoxDrawing ld hl, Route15TrainerHeaders ld de, Route15ScriptPointers - ld a, [W_ROUTE15CURSCRIPT] + ld a, [wRoute15CurScript] call ExecuteCurMapScriptInTable - ld [W_ROUTE15CURSCRIPT], a + ld [wRoute15CurScript], a ret Route15ScriptPointers: diff --git a/scripts/route16.asm b/scripts/route16.asm index e2777f0a..fe38fac4 100755 --- a/scripts/route16.asm +++ b/scripts/route16.asm @@ -2,16 +2,16 @@ Route16Script: call EnableAutoTextBoxDrawing ld hl, Route16TrainerHeaders ld de, Route16ScriptPointers - ld a, [W_ROUTE16CURSCRIPT] + ld a, [wRoute16CurScript] call ExecuteCurMapScriptInTable - ld [W_ROUTE16CURSCRIPT], a + ld [wRoute16CurScript], a ret Route16Script_59946: xor a ld [wJoyIgnore], a - ld [W_ROUTE16CURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wRoute16CurScript], a + ld [wCurMapScript], a ret Route16ScriptPointers: @@ -38,8 +38,8 @@ Route16Script0: predef HideObject call UpdateSprites ld a, $3 - ld [W_ROUTE16CURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wRoute16CurScript], a + ld [wCurMapScript], a ret Route16Script3: @@ -57,8 +57,8 @@ Route16Script3: SetEvent EVENT_BEAT_ROUTE16_SNORLAX call Delay3 ld a, $0 - ld [W_ROUTE16CURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wRoute16CurScript], a + ld [wCurMapScript], a ret Route16TextPointers: diff --git a/scripts/route16gate.asm b/scripts/route16gate.asm index 5af4e0b2..df478b1f 100755 --- a/scripts/route16gate.asm +++ b/scripts/route16gate.asm @@ -2,7 +2,7 @@ Route16GateScript: ld hl, wd732 res 5, [hl] call EnableAutoTextBoxDrawing - ld a, [W_ROUTE16GATECURSCRIPT] + ld a, [wRoute16GateCurScript] ld hl, Route16GateScriptPointers jp JumpTable @@ -36,11 +36,11 @@ Route16GateScript0: call FillMemory call StartSimulatingJoypadStates ld a, $1 - ld [W_ROUTE16GATECURSCRIPT], a + ld [wRoute16GateCurScript], a ret .asm_4970e ld a, $2 - ld [W_ROUTE16GATECURSCRIPT], a + ld [wRoute16GateCurScript], a ret CoordsData_49714: @@ -67,7 +67,7 @@ Route16GateScript2: ld [wSimulatedJoypadStatesEnd], a call StartSimulatingJoypadStates ld a, $3 - ld [W_ROUTE16GATECURSCRIPT], a + ld [wRoute16GateCurScript], a ret Route16GateScript3: @@ -79,7 +79,7 @@ Route16GateScript3: ld hl, wd730 res 7, [hl] ld a, $0 - ld [W_ROUTE16GATECURSCRIPT], a + ld [wRoute16GateCurScript], a ret Route16GateScript_49755: diff --git a/scripts/route17.asm b/scripts/route17.asm index edb8be9f..ddf92c2d 100755 --- a/scripts/route17.asm +++ b/scripts/route17.asm @@ -2,9 +2,9 @@ Route17Script: call EnableAutoTextBoxDrawing ld hl, Route17TrainerHeaders ld de, Route17ScriptPointers - ld a, [W_ROUTE17CURSCRIPT] + ld a, [wRoute17CurScript] call ExecuteCurMapScriptInTable - ld [W_ROUTE17CURSCRIPT], a + ld [wRoute17CurScript], a ret Route17ScriptPointers: diff --git a/scripts/route18.asm b/scripts/route18.asm index af2698be..7b654e7c 100755 --- a/scripts/route18.asm +++ b/scripts/route18.asm @@ -2,9 +2,9 @@ Route18Script: call EnableAutoTextBoxDrawing ld hl, Route18TrainerHeaders ld de, Route18ScriptPointers - ld a, [W_ROUTE18CURSCRIPT] + ld a, [wRoute18CurScript] call ExecuteCurMapScriptInTable - ld [W_ROUTE18CURSCRIPT], a + ld [wRoute18CurScript], a ret Route18ScriptPointers: diff --git a/scripts/route18gate.asm b/scripts/route18gate.asm index a58805bb..186ea61b 100755 --- a/scripts/route18gate.asm +++ b/scripts/route18gate.asm @@ -2,7 +2,7 @@ Route18GateScript: ld hl, wd732 res 5, [hl] call EnableAutoTextBoxDrawing - ld a, [W_ROUTE18GATECURSCRIPT] + ld a, [wRoute18GateCurScript] ld hl, Route18GateScriptPointers jp JumpTable @@ -36,11 +36,11 @@ Route18GateScript0: call FillMemory call StartSimulatingJoypadStates ld a, $1 - ld [W_ROUTE18GATECURSCRIPT], a + ld [wRoute18GateCurScript], a ret .asm_498c6 ld a, $2 - ld [W_ROUTE18GATECURSCRIPT], a + ld [wRoute18GateCurScript], a ret CoordsData_498cc: @@ -67,7 +67,7 @@ Route18GateScript2: ld [wSimulatedJoypadStatesEnd], a call StartSimulatingJoypadStates ld a, $3 - ld [W_ROUTE18GATECURSCRIPT], a + ld [wRoute18GateCurScript], a ret Route18GateScript3: @@ -79,7 +79,7 @@ Route18GateScript3: ld hl, wd730 res 7, [hl] ld a, $0 - ld [W_ROUTE18GATECURSCRIPT], a + ld [wRoute18GateCurScript], a ret Route18GateTextPointers: diff --git a/scripts/route19.asm b/scripts/route19.asm index d3f56977..162c4548 100755 --- a/scripts/route19.asm +++ b/scripts/route19.asm @@ -2,9 +2,9 @@ Route19Script: call EnableAutoTextBoxDrawing ld hl, Route19TrainerHeaders ld de, Route19ScriptPointers - ld a, [W_ROUTE19CURSCRIPT] + ld a, [wRoute19CurScript] call ExecuteCurMapScriptInTable - ld [W_ROUTE19CURSCRIPT], a + ld [wRoute19CurScript], a ret Route19ScriptPointers: diff --git a/scripts/route20.asm b/scripts/route20.asm index cea1e01c..012c9c53 100755 --- a/scripts/route20.asm +++ b/scripts/route20.asm @@ -4,9 +4,9 @@ Route20Script: call EnableAutoTextBoxDrawing ld hl, Route20TrainerHeader0 ld de, Route20ScriptPointers - ld a, [W_ROUTE20CURSCRIPT] + ld a, [wRoute20CurScript] call ExecuteCurMapScriptInTable - ld [W_ROUTE20CURSCRIPT], a + ld [wRoute20CurScript], a ret Route20Script_50cc6: diff --git a/scripts/route21.asm b/scripts/route21.asm index de17ca11..89874e58 100755 --- a/scripts/route21.asm +++ b/scripts/route21.asm @@ -2,9 +2,9 @@ Route21Script: call EnableAutoTextBoxDrawing ld hl, Route21TrainerHeaders ld de, Route21ScriptPointers - ld a, [W_ROUTE21CURSCRIPT] + ld a, [wRoute21CurScript] call ExecuteCurMapScriptInTable - ld [W_ROUTE21CURSCRIPT], a + ld [wRoute21CurScript], a ret Route21ScriptPointers: diff --git a/scripts/route22.asm b/scripts/route22.asm index 49c57a47..fe881366 100755 --- a/scripts/route22.asm +++ b/scripts/route22.asm @@ -1,7 +1,7 @@ Route22Script: call EnableAutoTextBoxDrawing ld hl, Route22ScriptPointers - ld a, [W_ROUTE22CURSCRIPT] + ld a, [wRoute22CurScript] jp JumpTable Route22ScriptPointers: @@ -17,7 +17,7 @@ Route22ScriptPointers: Route22Script_50ece: xor a ld [wJoyIgnore], a - ld [W_ROUTE22CURSCRIPT], a + ld [wRoute22CurScript], a Route22Script7: ret @@ -31,7 +31,7 @@ Route22Script_50ed6: Route22Script_50ee1: ld a, OPP_SONY2 ld [wCurOpponent], a - ld a, [W_RIVALSTARTER] + ld a, [wRivalStarter] add 7 ld [wTrainerNo], a ret @@ -98,7 +98,7 @@ Route22Script0: ld [H_SPRITEINDEX], a call Route22MoveRivalSprite ld a, $1 - ld [W_ROUTE22CURSCRIPT], a + ld [wRoute22CurScript], a ret Route22Script1: @@ -132,7 +132,7 @@ Route22Script1: call SaveEndBattleTextPointers call Route22Script_50ed6 ld a, $2 - ld [W_ROUTE22CURSCRIPT], a + ld [wRoute22CurScript], a ret Route22RivalDefeatedText1: @@ -147,11 +147,11 @@ Route22Script2: ld a, [wIsInBattle] cp $ff jp z, Route22Script_50ece - ld a, [W_RIVALSTARTER] + ld a, [wRivalStarter] cp 2 jr nz, .asm_50fc9 ld a, $1 - ld [W_RIVALSTARTER], a + ld [wRivalStarter], a .asm_50fc9 ld a, [wPlayerFacingDirection] and a ; cp SPRITE_FACING_DOWN @@ -182,7 +182,7 @@ Route22Script2: call Route22Script_5100d .asm_51002 ld a, $3 - ld [W_ROUTE22CURSCRIPT], a + ld [wRoute22CurScript], a ret Route22Script_51008: @@ -231,7 +231,7 @@ Route22Script3: call PlayDefaultMusic ResetEvents EVENT_1ST_ROUTE22_RIVAL_BATTLE, EVENT_ROUTE22_RIVAL_WANTS_BATTLE ld a, $0 - ld [W_ROUTE22CURSCRIPT], a + ld [wRoute22CurScript], a ret Route22Script_5104e: @@ -251,7 +251,7 @@ Route22Script_5104e: ld [H_SPRITEINDEX], a call Route22MoveRivalSprite ld a, $4 - ld [W_ROUTE22CURSCRIPT], a + ld [wRoute22CurScript], a ret Route22Script4: @@ -287,7 +287,7 @@ Route22Script4: call SaveEndBattleTextPointers call Route22Script_50ee1 ld a, $5 - ld [W_ROUTE22CURSCRIPT], a + ld [wRoute22CurScript], a ret Route22RivalDefeatedText2: @@ -335,7 +335,7 @@ Route22Script5: call Route22Script_51142 .asm_51137 ld a, $6 - ld [W_ROUTE22CURSCRIPT], a + ld [wRoute22CurScript], a ret Route22Script_5113d: @@ -370,7 +370,7 @@ Route22Script6: call PlayDefaultMusic ResetEvents EVENT_2ND_ROUTE22_RIVAL_BATTLE, EVENT_ROUTE22_RIVAL_WANTS_BATTLE ld a, $7 - ld [W_ROUTE22CURSCRIPT], a + ld [wRoute22CurScript], a ret Route22TextPointers: diff --git a/scripts/route22gate.asm b/scripts/route22gate.asm index 9fd7c9cd..05fbc7e9 100755 --- a/scripts/route22gate.asm +++ b/scripts/route22gate.asm @@ -1,7 +1,7 @@ Route22GateScript: call EnableAutoTextBoxDrawing ld hl, Route22GateScriptPointers - ld a, [W_ROUTE22GATECURSCRIPT] + ld a, [wRoute22GateCurScript] call JumpTable ld a, [wYCoord] cp $4 @@ -52,7 +52,7 @@ Route22GateScript1: ld [wJoyIgnore], a call Delay3 ld a, $0 - ld [W_ROUTE22GATECURSCRIPT], a + ld [wRoute22GateCurScript], a Route22GateScript2: ret @@ -74,7 +74,7 @@ Route22GateText1: call PrintText ld a, $2 .asm_1e6fe - ld [W_ROUTE22GATECURSCRIPT], a + ld [wRoute22GateCurScript], a jp TextScriptEnd Route22GateText_1e704: diff --git a/scripts/route23.asm b/scripts/route23.asm index ca980843..b82ab505 100755 --- a/scripts/route23.asm +++ b/scripts/route23.asm @@ -2,11 +2,11 @@ Route23Script: call Route23Script_511e9 call EnableAutoTextBoxDrawing ld hl, Route23ScriptPointers - ld a, [W_ROUTE23CURSCRIPT] + ld a, [wRoute23CurScript] jp JumpTable Route23Script_511e9: - ld hl, wd126 + ld hl, wCurrentMapScriptFlags bit 6, [hl] res 6, [hl] ret z @@ -128,7 +128,7 @@ Route23Script1: ret nz Route23Script2: ld a, $0 - ld [W_ROUTE23CURSCRIPT], a + ld [wRoute23CurScript], a ret Route23TextPointers: @@ -199,7 +199,7 @@ Route23Script_51346: call PrintText call Route23Script_512d8 ld a, $1 - ld [W_ROUTE23CURSCRIPT], a + ld [wRoute23CurScript], a ret .asm_5136e ld hl, VictoryRoadGuardText2 @@ -210,7 +210,7 @@ Route23Script_51346: EventFlagAddress hl, EVENT_PASSED_CASCADEBADGE_CHECK predef FlagActionPredef ld a, $2 - ld [W_ROUTE23CURSCRIPT], a + ld [wRoute23CurScript], a ret Route23Script_51388: diff --git a/scripts/route24.asm b/scripts/route24.asm index b0db448d..d2872ccc 100755 --- a/scripts/route24.asm +++ b/scripts/route24.asm @@ -2,16 +2,16 @@ Route24Script: call EnableAutoTextBoxDrawing ld hl, Route24TrainerHeaders ld de, Route24ScriptPointers - ld a, [W_ROUTE24CURSCRIPT] + ld a, [wRoute24CurScript] call ExecuteCurMapScriptInTable - ld [W_ROUTE24CURSCRIPT], a + ld [wRoute24CurScript], a ret Route24Script_513c0: xor a ld [wJoyIgnore], a - ld [W_ROUTE24CURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wRoute24CurScript], a + ld [wCurMapScript], a ret Route24ScriptPointers: @@ -40,8 +40,8 @@ Route24Script0: ld [wSimulatedJoypadStatesIndex], a call StartSimulatingJoypadStates ld a, $4 - ld [W_ROUTE24CURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wRoute24CurScript], a + ld [wCurMapScript], a ret CoordsData_5140e: @@ -53,8 +53,8 @@ Route24Script4: ret nz call Delay3 ld a, $0 - ld [W_ROUTE24CURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wRoute24CurScript], a + ld [wCurMapScript], a ret Route24Script3: @@ -71,8 +71,8 @@ Route24Script3: xor a ld [wJoyIgnore], a ld a, $0 - ld [W_ROUTE24CURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wRoute24CurScript], a + ld [wCurMapScript], a ret Route24TextPointers: @@ -171,8 +171,8 @@ Route24Text1: xor a ld [hJoyHeld], a ld a, $3 - ld [W_ROUTE24CURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wRoute24CurScript], a + ld [wCurMapScript], a jp TextScriptEnd .asm_514f9 ld hl, Route24Text_51530 diff --git a/scripts/route25.asm b/scripts/route25.asm index cf1599ca..cc2e1d9d 100755 --- a/scripts/route25.asm +++ b/scripts/route25.asm @@ -2,9 +2,9 @@ Route25Script: call EnableAutoTextBoxDrawing ld hl, Route25TrainerHeaders ld de, Route25ScriptPointers - ld a, [W_ROUTE25CURSCRIPT] + ld a, [wRoute25CurScript] call ExecuteCurMapScriptInTable - ld [W_ROUTE25CURSCRIPT], a + ld [wRoute25CurScript], a call Route25Script_515e1 ret @@ -15,8 +15,8 @@ Route25Script_515e1: res 4, [hl] res 7, [hl] xor a - ld [W_BILLSHOUSECURSCRIPT], a - ld hl, wd126 + ld [wBillsHouseCurScript], a + ld hl, wCurrentMapScriptFlags bit 6, [hl] res 6, [hl] ret z diff --git a/scripts/route3.asm b/scripts/route3.asm index 739c3b03..b2c5de3e 100755 --- a/scripts/route3.asm +++ b/scripts/route3.asm @@ -2,9 +2,9 @@ Route3Script: call EnableAutoTextBoxDrawing ld hl, Route3TrainerHeader0 ld de, Route3ScriptPointers - ld a, [W_ROUTE3CURSCRIPT] + ld a, [wRoute3CurScript] call ExecuteCurMapScriptInTable - ld [W_ROUTE3CURSCRIPT], a + ld [wRoute3CurScript], a ret Route3ScriptPointers: diff --git a/scripts/route4.asm b/scripts/route4.asm index ff3be806..559f2006 100755 --- a/scripts/route4.asm +++ b/scripts/route4.asm @@ -2,9 +2,9 @@ Route4Script: call EnableAutoTextBoxDrawing ld hl, Route4TrainerHeaders ld de, Route4ScriptPointers - ld a, [W_ROUTE4CURSCRIPT] + ld a, [wRoute4CurScript] call ExecuteCurMapScriptInTable - ld [W_ROUTE4CURSCRIPT], a + ld [wRoute4CurScript], a ret Route4ScriptPointers: diff --git a/scripts/route5gate.asm b/scripts/route5gate.asm index 63072d55..b3ad0aa3 100755 --- a/scripts/route5gate.asm +++ b/scripts/route5gate.asm @@ -1,6 +1,6 @@ Route5GateScript: call EnableAutoTextBoxDrawing - ld a, [W_ROUTE5GATECURSCRIPT] + ld a, [wRoute5GateCurScript] ld hl, Route5GateScriptPointers jp JumpTable @@ -35,7 +35,7 @@ Route5GateScript0: call DisplayTextID call Route5GateScript_1df43 ld a, $1 - ld [W_ROUTE5GATECURSCRIPT], a + ld [wRoute5GateCurScript], a ret .asm_1df82 ld a, $3 @@ -57,7 +57,7 @@ Route5GateScript1: call Delay3 xor a ld [wJoyIgnore], a - ld [W_ROUTE5GATECURSCRIPT], a + ld [wRoute5GateCurScript], a ret Route5GateTextPointers: @@ -81,7 +81,7 @@ Route5GateText1: call PrintText call Route5GateScript_1df43 ld a, $1 - ld [W_ROUTE5GATECURSCRIPT], a + ld [wRoute5GateCurScript], a jp TextScriptEnd .asm_768a2 ld hl, Route5GateText3 diff --git a/scripts/route6.asm b/scripts/route6.asm index b499b2ef..7f3a5dda 100755 --- a/scripts/route6.asm +++ b/scripts/route6.asm @@ -2,9 +2,9 @@ Route6Script: call EnableAutoTextBoxDrawing ld hl, Route6TrainerHeaders ld de, Route6ScriptPointers - ld a, [W_ROUTE6CURSCRIPT] + ld a, [wRoute6CurScript] call ExecuteCurMapScriptInTable - ld [W_ROUTE6CURSCRIPT], a + ld [wRoute6CurScript], a ret Route6ScriptPointers: diff --git a/scripts/route6gate.asm b/scripts/route6gate.asm index b8876185..001a295c 100755 --- a/scripts/route6gate.asm +++ b/scripts/route6gate.asm @@ -1,7 +1,7 @@ Route6GateScript: call EnableAutoTextBoxDrawing ld hl, Route6GateScriptPointers - ld a, [W_ROUTE6GATECURSCRIPT] + ld a, [wRoute6GateCurScript] call JumpTable ret @@ -29,7 +29,7 @@ Route6GateScript0: call DisplayTextID call Route6GateScript_1e0a1 ld a, $1 - ld [W_ROUTE6GATECURSCRIPT], a + ld [wRoute6GateCurScript], a ret .asm_1e080 ld hl, wd728 @@ -49,7 +49,7 @@ Route6GateScript1: call Delay3 xor a ld [wJoyIgnore], a - ld [W_ROUTE6GATECURSCRIPT], a + ld [wRoute6GateCurScript], a ret Route6GateScript_1e0a1: diff --git a/scripts/route7gate.asm b/scripts/route7gate.asm index f97cb03b..6e62c73c 100755 --- a/scripts/route7gate.asm +++ b/scripts/route7gate.asm @@ -1,6 +1,6 @@ Route7GateScript: call EnableAutoTextBoxDrawing - ld a, [W_ROUTE7GATECURSCRIPT] + ld a, [wRoute7GateCurScript] ld hl, Route7GateScriptPointers call JumpTable ret @@ -41,7 +41,7 @@ Route7GateScript0: call DisplayTextID call Route7GateScript_1e111 ld a, $1 - ld [W_ROUTE7GATECURSCRIPT], a + ld [wRoute7GateCurScript], a ret .asm_1e15a ld a, $3 @@ -63,8 +63,8 @@ Route7GateScript1: call Delay3 xor a ld [wJoyIgnore], a - ld [W_ROUTE7GATECURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wRoute7GateCurScript], a + ld [wCurMapScript], a ret Route7GateTextPointers: diff --git a/scripts/route8.asm b/scripts/route8.asm index 0e437775..34e6aba4 100755 --- a/scripts/route8.asm +++ b/scripts/route8.asm @@ -2,9 +2,9 @@ Route8Script: call EnableAutoTextBoxDrawing ld hl, Route8TrainerHeaders ld de, Route8ScriptPointers - ld a, [W_ROUTE8CURSCRIPT] + ld a, [wRoute8CurScript] call ExecuteCurMapScriptInTable - ld [W_ROUTE8CURSCRIPT], a + ld [wRoute8CurScript], a ret Route8ScriptPointers: diff --git a/scripts/route8gate.asm b/scripts/route8gate.asm index fe414ae1..b86458d8 100755 --- a/scripts/route8gate.asm +++ b/scripts/route8gate.asm @@ -1,7 +1,7 @@ Route8GateScript: call EnableAutoTextBoxDrawing ld hl, Route8GateScriptPointers - ld a, [W_ROUTE8GATECURSCRIPT] + ld a, [wRoute8GateCurScript] jp JumpTable Route8GateScriptPointers: @@ -40,7 +40,7 @@ Route8GateScript0: call DisplayTextID call Route8GateScript_1e1d7 ld a, $1 - ld [W_ROUTE8GATECURSCRIPT], a + ld [wRoute8GateCurScript], a ret .asm_1e220 ld hl, wd728 @@ -61,7 +61,7 @@ Route8GateScript1: call Delay3 xor a ld [wJoyIgnore], a - ld [W_ROUTE8GATECURSCRIPT], a + ld [wRoute8GateCurScript], a ret Route8GateTextPointers: diff --git a/scripts/route9.asm b/scripts/route9.asm index 8dbb19cb..f08e9790 100755 --- a/scripts/route9.asm +++ b/scripts/route9.asm @@ -2,9 +2,9 @@ Route9Script: call EnableAutoTextBoxDrawing ld hl, Route9TrainerHeaders ld de, Route9ScriptPointers - ld a, [W_ROUTE9CURSCRIPT] + ld a, [wRoute9CurScript] call ExecuteCurMapScriptInTable - ld [W_ROUTE9CURSCRIPT], a + ld [wRoute9CurScript], a ret Route9ScriptPointers: diff --git a/scripts/saffrongym.asm b/scripts/saffrongym.asm index a3ab60b2..146d31f9 100755 --- a/scripts/saffrongym.asm +++ b/scripts/saffrongym.asm @@ -1,14 +1,14 @@ SaffronGymScript: - ld hl, wd126 + ld hl, wCurrentMapScriptFlags bit 6, [hl] res 6, [hl] call nz, .extra call EnableAutoTextBoxDrawing ld hl, SaffronGymTrainerHeader0 ld de, SaffronGymScriptPointers - ld a, [W_SAFFRONGYMCURSCRIPT] + ld a, [wSaffronGymCurScript] call ExecuteCurMapScriptInTable - ld [W_SAFFRONGYMCURSCRIPT], a + ld [wSaffronGymCurScript], a ret .extra @@ -25,8 +25,8 @@ Gym6LeaderName: SaffronGymText_5d048: xor a ld [wJoyIgnore], a - ld [W_SAFFRONGYMCURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wSaffronGymCurScript], a + ld [wCurMapScript], a ret SaffronGymScriptPointers: @@ -179,7 +179,7 @@ SaffronGymText1: ld a, $6 ld [wGymLeaderNo], a ld a, $3 - ld [W_SAFFRONGYMCURSCRIPT], a + ld [wSaffronGymCurScript], a .asm_5d15f jp TextScriptEnd diff --git a/scripts/seafoamislands5.asm b/scripts/seafoamislands5.asm index af1672a7..478946fa 100755 --- a/scripts/seafoamislands5.asm +++ b/scripts/seafoamislands5.asm @@ -8,7 +8,7 @@ SeafoamIslands5Script_467a5: xor a ld [wJoyIgnore], a ld [wSeafoamIslands5CurScript], a - ld [W_CURMAPSCRIPT], a + ld [wCurMapScript], a ret SeafoamIslands5ScriptPointers: @@ -30,7 +30,7 @@ SeafoamIslands5Script4: SeafoamIslands5Script0: CheckBothEventsSet EVENT_SEAFOAM3_BOULDER1_DOWN_HOLE, EVENT_SEAFOAM3_BOULDER2_DOWN_HOLE ret z - ld hl, CoordsData_467fe + ld hl, .Coords call ArePlayerCoordsInArray ret nc ld a, [wCoordIndex] @@ -53,7 +53,7 @@ SeafoamIslands5Script0: ld [wSeafoamIslands5CurScript], a ret -CoordsData_467fe: +.Coords db $11,$14 db $11,$15 db $10,$14 @@ -74,7 +74,7 @@ SeafoamIslands5Script2: CheckBothEventsSet EVENT_SEAFOAM4_BOULDER1_DOWN_HOLE, EVENT_SEAFOAM4_BOULDER2_DOWN_HOLE ld a, $0 jr z, .asm_46849 - ld hl, CoordsData_4684d + ld hl, .Coords call ArePlayerCoordsInArray ld a, $0 jr nc, .asm_46849 @@ -96,7 +96,7 @@ SeafoamIslands5Script2: ld [wSeafoamIslands5CurScript], a ret -CoordsData_4684d: +.Coords db $0E,$04 db $0E,$05 db $FF @@ -134,32 +134,31 @@ SeaFoamIslands5Script_46872: SeafoamIslands5TextPointers: dw BoulderText dw BoulderText - dw SeafoamIslands5Text3 + dw ArticunoText dw SeafoamIslands5Text4 dw SeafoamIslands5Text5 -SeafoamIslands5TrainerHeaders: -SeafoamIslands5TrainerHeader0: - dbEventFlagBit EVENT_BEAT_SEAFOAM_ISLANDS_5_TRAINER_0 +ArticunoTrainerHeader: + dbEventFlagBit EVENT_BEAT_ARTICUNO db ($0 << 4) ; trainer's view range - dwEventFlagAddress EVENT_BEAT_SEAFOAM_ISLANDS_5_TRAINER_0 - dw SeafoamIslands5BattleText2 ; TextBeforeBattle - dw SeafoamIslands5BattleText2 ; TextAfterBattle - dw SeafoamIslands5BattleText2 ; TextEndBattle - dw SeafoamIslands5BattleText2 ; TextEndBattle + dwEventFlagAddress EVENT_BEAT_ARTICUNO + dw ArticunoBattleText ; TextBeforeBattle + dw ArticunoBattleText ; TextAfterBattle + dw ArticunoBattleText ; TextEndBattle + dw ArticunoBattleText ; TextEndBattle db $ff -SeafoamIslands5Text3: +ArticunoText: TX_ASM - ld hl, SeafoamIslands5TrainerHeader0 + ld hl, ArticunoTrainerHeader call TalkToTrainer ld a, $4 ld [wSeafoamIslands5CurScript], a jp TextScriptEnd -SeafoamIslands5BattleText2: - TX_FAR _SeafoamIslands5BattleText2 +ArticunoBattleText: + TX_FAR _ArticunoBattleText TX_ASM ld a, ARTICUNO call PlayCry diff --git a/scripts/silphco10.asm b/scripts/silphco10.asm index ed8b9ec9..6b35a05a 100755 --- a/scripts/silphco10.asm +++ b/scripts/silphco10.asm @@ -3,13 +3,13 @@ SilphCo10Script: call EnableAutoTextBoxDrawing ld hl, SilphCo10TrainerHeaders ld de, SilphCo10ScriptPointers - ld a, [W_SILPHCO10CURSCRIPT] + ld a, [wSilphCo10CurScript] call ExecuteCurMapScriptInTable - ld [W_SILPHCO10CURSCRIPT], a + ld [wSilphCo10CurScript], a ret SilphCo10Script_5a14f: - ld hl, wd126 + ld hl, wCurrentMapScriptFlags bit 5, [hl] res 5, [hl] ret z diff --git a/scripts/silphco11.asm b/scripts/silphco11.asm index 47924524..cd5a818d 100755 --- a/scripts/silphco11.asm +++ b/scripts/silphco11.asm @@ -3,13 +3,13 @@ SilphCo11Script: call EnableAutoTextBoxDrawing ld hl, SilphCo11TrainerHeaders ld de, SilphCo11ScriptPointers - ld a, [W_SILPHCO11CURSCRIPT] + ld a, [wSilphCo11CurScript] call ExecuteCurMapScriptInTable - ld [W_SILPHCO11CURSCRIPT], a + ld [wSilphCo11CurScript], a ret SilphCo11Script_62127: - ld hl, wd126 + ld hl, wCurrentMapScriptFlags bit 5, [hl] res 5, [hl] ret z @@ -75,8 +75,8 @@ SilphCo11Script_62185: xor a ld [wJoyIgnore], a SilphCo11Script_62189: - ld [W_SILPHCO11CURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wSilphCo11CurScript], a + ld [wCurMapScript], a ret SilphCo11ScriptPointers: diff --git a/scripts/silphco2.asm b/scripts/silphco2.asm index 51bb62bc..3a5d3650 100755 --- a/scripts/silphco2.asm +++ b/scripts/silphco2.asm @@ -3,13 +3,13 @@ SilphCo2Script: call EnableAutoTextBoxDrawing ld hl, SilphCo2TrainerHeaders ld de, SilphCo2ScriptPointers - ld a, [W_SILPHCO2CURSCRIPT] + ld a, [wSilphCo2CurScript] call ExecuteCurMapScriptInTable - ld [W_SILPHCO2CURSCRIPT], a + ld [wSilphCo2CurScript], a ret SilphCo2Script_59d07: - ld hl, wd126 + ld hl, wCurrentMapScriptFlags bit 5, [hl] res 5, [hl] ret z diff --git a/scripts/silphco3.asm b/scripts/silphco3.asm index 7be07e6c..b8dfb7fb 100755 --- a/scripts/silphco3.asm +++ b/scripts/silphco3.asm @@ -3,13 +3,13 @@ SilphCo3Script: call EnableAutoTextBoxDrawing ld hl, SilphCo3TrainerHeaders ld de, SilphCo3ScriptPointers - ld a, [W_SILPHCO3CURSCRIPT] + ld a, [wSilphCo3CurScript] call ExecuteCurMapScriptInTable - ld [W_SILPHCO3CURSCRIPT], a + ld [wSilphCo3CurScript], a ret SilphCo3Script_59f71: - ld hl, wd126 + ld hl, wCurrentMapScriptFlags bit 5, [hl] res 5, [hl] ret z diff --git a/scripts/silphco4.asm b/scripts/silphco4.asm index 33f2f884..a0682c8d 100755 --- a/scripts/silphco4.asm +++ b/scripts/silphco4.asm @@ -3,13 +3,13 @@ SilphCo4Script: call EnableAutoTextBoxDrawing ld hl, SilphCo4TrainerHeaders ld de, SilphCo4ScriptPointers - ld a, [W_SILPHCO4CURSCRIPT] + ld a, [wSilphCo4CurScript] call ExecuteCurMapScriptInTable - ld [W_SILPHCO4CURSCRIPT], a + ld [wSilphCo4CurScript], a ret SilphCo4Script_19d21: - ld hl, wd126 + ld hl, wCurrentMapScriptFlags bit 5, [hl] res 5, [hl] ret z diff --git a/scripts/silphco5.asm b/scripts/silphco5.asm index fa10a7a9..42577498 100755 --- a/scripts/silphco5.asm +++ b/scripts/silphco5.asm @@ -3,13 +3,13 @@ SilphCo5Script: call EnableAutoTextBoxDrawing ld hl, SilphCo5TrainerHeaders ld de, SilphCo5ScriptPointers - ld a, [W_SILPHCO5CURSCRIPT] + ld a, [wSilphCo5CurScript] call ExecuteCurMapScriptInTable - ld [W_SILPHCO5CURSCRIPT], a + ld [wSilphCo5CurScript], a ret SilphCo5Script_19f4d: - ld hl, wd126 + ld hl, wCurrentMapScriptFlags bit 5, [hl] res 5, [hl] ret z diff --git a/scripts/silphco6.asm b/scripts/silphco6.asm index 28f1eeba..c40c7d70 100755 --- a/scripts/silphco6.asm +++ b/scripts/silphco6.asm @@ -3,13 +3,13 @@ SilphCo6Script: call EnableAutoTextBoxDrawing ld hl, SilphCo6TrainerHeaders ld de, SilphCo6ScriptPointers - ld a, [W_SILPHCO6CURSCRIPT] + ld a, [wSilphCo6CurScript] call ExecuteCurMapScriptInTable - ld [W_SILPHCO6CURSCRIPT], a + ld [wSilphCo6CurScript], a ret SilphCo6Script_1a1bf: - ld hl, wd126 + ld hl, wCurrentMapScriptFlags bit 5, [hl] res 5, [hl] ret z diff --git a/scripts/silphco7.asm b/scripts/silphco7.asm index 6281783a..2e93d92a 100755 --- a/scripts/silphco7.asm +++ b/scripts/silphco7.asm @@ -3,13 +3,13 @@ SilphCo7Script: call EnableAutoTextBoxDrawing ld hl, SilphCo7TrainerHeaders ld de, SilphCo7ScriptPointers - ld a, [W_SILPHCO7CURSCRIPT] + ld a, [wSilphCo7CurScript] call ExecuteCurMapScriptInTable - ld [W_SILPHCO7CURSCRIPT], a + ld [wSilphCo7CurScript], a ret SilphCo7Script_51b77: - ld hl, wd126 + ld hl, wCurrentMapScriptFlags bit 5, [hl] res 5, [hl] ret z @@ -106,8 +106,8 @@ SilphCo7Text_51c0c: ld [wJoyIgnore], a SilphCo7Text_51c10: - ld [W_SILPHCO7CURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wSilphCo7CurScript], a + ld [wCurMapScript], a ret SilphCo7ScriptPointers: @@ -183,7 +183,7 @@ SilphCo7Script3: call SaveEndBattleTextPointers ld a, OPP_SONY2 ld [wCurOpponent], a - ld a, [W_RIVALSTARTER] + ld a, [wRivalStarter] add 4 ld [wTrainerNo], a ld a, $4 diff --git a/scripts/silphco8.asm b/scripts/silphco8.asm index c093c669..399f7bd5 100755 --- a/scripts/silphco8.asm +++ b/scripts/silphco8.asm @@ -3,13 +3,13 @@ SilphCo8Script: call EnableAutoTextBoxDrawing ld hl, SilphCo8TrainerHeader0 ld de, SilphCo8ScriptPointers - ld a, [W_SILPHCO8CURSCRIPT] + ld a, [wSilphCo8CurScript] call ExecuteCurMapScriptInTable - ld [W_SILPHCO8CURSCRIPT], a + ld [wSilphCo8CurScript], a ret SilphCo8Script_5651a: - ld hl, wd126 + ld hl, wCurrentMapScriptFlags bit 5, [hl] res 5, [hl] ret z diff --git a/scripts/silphco9.asm b/scripts/silphco9.asm index 3dde7b13..6757eb49 100755 --- a/scripts/silphco9.asm +++ b/scripts/silphco9.asm @@ -3,13 +3,13 @@ SilphCo9Script: call EnableAutoTextBoxDrawing ld hl, SilphCo9TrainerHeaders ld de, SilphCo9ScriptPointers - ld a, [W_SILPHCO9CURSCRIPT] + ld a, [wSilphCo9CurScript] call ExecuteCurMapScriptInTable - ld [W_SILPHCO9CURSCRIPT], a + ld [wSilphCo9CurScript], a ret SilphCo9Script_5d7d1: - ld hl, wd126 + ld hl, wCurrentMapScriptFlags bit 5, [hl] res 5, [hl] ret z diff --git a/scripts/silphcoelevator.asm b/scripts/silphcoelevator.asm index 9e8f0fe9..df4d08c7 100755 --- a/scripts/silphcoelevator.asm +++ b/scripts/silphcoelevator.asm @@ -1,5 +1,5 @@ SilphCoElevatorScript: - ld hl, wd126 + ld hl, wCurrentMapScriptFlags bit 5, [hl] res 5, [hl] push hl diff --git a/scripts/ssanne10.asm b/scripts/ssanne10.asm index 363e24c5..45c8dba5 100755 --- a/scripts/ssanne10.asm +++ b/scripts/ssanne10.asm @@ -2,9 +2,9 @@ SSAnne10Script: call EnableAutoTextBoxDrawing ld hl, SSAnne10TrainerHeaders ld de, SSAnne10ScriptPointers - ld a, [W_SSANNE10CURSCRIPT] + ld a, [wSSAnne10CurScript] call ExecuteCurMapScriptInTable - ld [W_SSANNE10CURSCRIPT], a + ld [wSSAnne10CurScript], a ret SSAnne10ScriptPointers: diff --git a/scripts/ssanne2.asm b/scripts/ssanne2.asm index 9b011075..4f0ffa2f 100755 --- a/scripts/ssanne2.asm +++ b/scripts/ssanne2.asm @@ -1,13 +1,13 @@ SSAnne2Script: call EnableAutoTextBoxDrawing ld hl, SSAnne2ScriptPointers - ld a, [W_SSANNE2CURSCRIPT] + ld a, [wSSAnne2CurScript] jp JumpTable SSAnne2Script_613ab: xor a ld [wJoyIgnore], a - ld [W_SSANNE2CURSCRIPT], a + ld [wSSAnne2CurScript], a ret SSAnne2ScriptPointers: @@ -51,7 +51,7 @@ SSAnne2Script0: .asm_61403 call MoveSprite ld a, $1 - ld [W_SSANNE2CURSCRIPT], a + ld [wSSAnne2CurScript], a ret MovementData_6140c: @@ -101,7 +101,7 @@ SSAnne2Script1: ld [wTrainerNo], a call SSAnne2Script_61416 ld a, $2 - ld [W_SSANNE2CURSCRIPT], a + ld [wSSAnne2CurScript], a ret SSAnne2Script2: @@ -131,7 +131,7 @@ SSAnne2Script2: call StopAllMusic callba Music_RivalAlternateStart ld a, $3 - ld [W_SSANNE2CURSCRIPT], a + ld [wSSAnne2CurScript], a ret MovementData_614b7: @@ -156,7 +156,7 @@ SSAnne2Script3: predef HideObject call PlayDefaultMusic ld a, $4 - ld [W_SSANNE2CURSCRIPT], a + ld [wSSAnne2CurScript], a ret SSAnne2TextPointers: diff --git a/scripts/ssanne5.asm b/scripts/ssanne5.asm index 99fb47cf..a398a381 100755 --- a/scripts/ssanne5.asm +++ b/scripts/ssanne5.asm @@ -2,9 +2,9 @@ SSAnne5Script: call EnableAutoTextBoxDrawing ld hl, SSAnne5TrainerHeader0 ld de, SSAnne5ScriptPointers - ld a, [W_SSANNE5CURSCRIPT] + ld a, [wSSAnne5CurScript] call ExecuteCurMapScriptInTable - ld [W_SSANNE5CURSCRIPT], a + ld [wSSAnne5CurScript], a ret SSAnne5ScriptPointers: diff --git a/scripts/ssanne8.asm b/scripts/ssanne8.asm index 0f0e3850..e7cbef3e 100755 --- a/scripts/ssanne8.asm +++ b/scripts/ssanne8.asm @@ -2,9 +2,9 @@ SSAnne8Script: call EnableAutoTextBoxDrawing ld hl, SSAnne8TrainerHeaders ld de, SSAnne8ScriptPointers - ld a, [W_SSANNE8CURSCRIPT] + ld a, [wSSAnne8CurScript] call ExecuteCurMapScriptInTable - ld [W_SSANNE8CURSCRIPT], a + ld [wSSAnne8CurScript], a ret SSAnne8ScriptPointers: diff --git a/scripts/ssanne9.asm b/scripts/ssanne9.asm index ab11ebc9..6e658e5f 100755 --- a/scripts/ssanne9.asm +++ b/scripts/ssanne9.asm @@ -2,9 +2,9 @@ SSAnne9Script: call DisableAutoTextBoxDrawing ld hl, SSAnne9TrainerHeaders ld de, SSAnne9ScriptPointers - ld a, [W_SSANNE9CURSCRIPT] + ld a, [wSSAnne9CurScript] call ExecuteCurMapScriptInTable - ld [W_SSANNE9CURSCRIPT], a + ld [wSSAnne9CurScript], a ret SSAnne9ScriptPointers: diff --git a/scripts/unknowndungeon3.asm b/scripts/unknowndungeon3.asm index d239c52f..46a1cafd 100755 --- a/scripts/unknowndungeon3.asm +++ b/scripts/unknowndungeon3.asm @@ -1,44 +1,44 @@ UnknownDungeon3Script: call EnableAutoTextBoxDrawing ld hl, UnknownDungeon3TrainerHeaders - ld de, UnknownDungeon3ScriptPointers - ld a, [W_UNKNOWNDUNGEON3CURSCRIPT] + ld de, .ScriptPointers + ld a, [wUnknownDungeon3CurScript] call ExecuteCurMapScriptInTable - ld [W_UNKNOWNDUNGEON3CURSCRIPT], a + ld [wUnknownDungeon3CurScript], a ret -UnknownDungeon3ScriptPointers: +.ScriptPointers: dw CheckFightingMapTrainers dw DisplayEnemyTrainerTextAndStartBattle dw EndTrainerBattle UnknownDungeon3TextPointers: - dw UnknownDungeon3Text1 + dw MewtwoText dw PickUpItemText dw PickUpItemText dw PickUpItemText dw PickUpItemText UnknownDungeon3TrainerHeaders: -UnknownDungeon3TrainerHeader0: - dbEventFlagBit EVENT_BEAT_UNKNOWN_DUNGEON_3_TRAINER_0 +MewtwoTrainerHeader: + dbEventFlagBit EVENT_BEAT_MEWTWO db ($0 << 4) ; trainer's view range - dwEventFlagAddress EVENT_BEAT_UNKNOWN_DUNGEON_3_TRAINER_0 - dw UnknownDungeon3MewtwoText ; TextBeforeBattle - dw UnknownDungeon3MewtwoText ; TextAfterBattle - dw UnknownDungeon3MewtwoText ; TextEndBattle - dw UnknownDungeon3MewtwoText ; TextEndBattle + dwEventFlagAddress EVENT_BEAT_MEWTWO + dw MewtwoBattleText ; TextBeforeBattle + dw MewtwoBattleText ; TextAfterBattle + dw MewtwoBattleText ; TextEndBattle + dw MewtwoBattleText ; TextEndBattle db $ff -UnknownDungeon3Text1: +MewtwoText: TX_ASM - ld hl, UnknownDungeon3TrainerHeader0 + ld hl, MewtwoTrainerHeader call TalkToTrainer jp TextScriptEnd -UnknownDungeon3MewtwoText: - TX_FAR _UnknownDungeon3MewtwoText +MewtwoBattleText: + TX_FAR _MewtwoBattleText TX_ASM ld a, MEWTWO call PlayCry diff --git a/scripts/vermilioncity.asm b/scripts/vermilioncity.asm index 5121cfd9..b73797bb 100755 --- a/scripts/vermilioncity.asm +++ b/scripts/vermilioncity.asm @@ -2,7 +2,7 @@ VermilionCityScript: call EnableAutoTextBoxDrawing ld hl, wd492 res 7, [hl] - ld hl, wd126 + ld hl, wCurrentMapScriptFlags bit 6, [hl] res 6, [hl] push hl @@ -12,7 +12,7 @@ VermilionCityScript: res 5, [hl] call nz, VermilionCityScript_197c0 ld hl, VermilionCityScriptPointers - ld a, [W_VERMILIONCITYCURSCRIPT] + ld a, [wVermilionCityCurScript] call JumpTable call VermilionCityScript_19869 ret @@ -42,7 +42,7 @@ VermilionCityScript_197cb: SetEventReuseHL EVENT_WALKED_PAST_GUARD_AFTER_SS_ANNE_LEFT ret nz ld a, $2 - ld [W_VERMILIONCITYCURSCRIPT], a + ld [wVermilionCityCurScript], a ret VermilionCityScriptPointers: @@ -79,7 +79,7 @@ VermilionCityScript0: ld [wSimulatedJoypadStatesIndex], a call StartSimulatingJoypadStates ld a, $1 - ld [W_VERMILIONCITYCURSCRIPT], a + ld [wVermilionCityCurScript], a ret .asm_198de @@ -94,7 +94,7 @@ VermilionCityScript4: call ArePlayerCoordsInArray ret c ld a, $0 - ld [W_VERMILIONCITYCURSCRIPT], a + ld [wVermilionCityCurScript], a ret VermilionCityScript2: @@ -107,7 +107,7 @@ VermilionCityScript2: ld [wSimulatedJoypadStatesIndex], a call StartSimulatingJoypadStates ld a, $3 - ld [W_VERMILIONCITYCURSCRIPT], a + ld [wVermilionCityCurScript], a ret VermilionCityScript3: @@ -118,7 +118,7 @@ VermilionCityScript3: ld [wJoyIgnore], a ld [hJoyHeld], a ld a, $0 - ld [W_VERMILIONCITYCURSCRIPT], a + ld [wVermilionCityCurScript], a ret VermilionCityScript1: @@ -128,7 +128,7 @@ VermilionCityScript1: ld c, 10 call DelayFrames ld a, $0 - ld [W_VERMILIONCITYCURSCRIPT], a + ld [wVermilionCityCurScript], a ret VermilionCityTextPointers: @@ -201,7 +201,7 @@ VermilionCityText3: ld hl, SSAnneFlashedTicketText call PrintText ld a, $4 - ld [W_VERMILIONCITYCURSCRIPT], a + ld [wVermilionCityCurScript], a jr .asm_198fc .asm_198f6 ld hl, SSAnneNotHereText diff --git a/scripts/vermiliongym.asm b/scripts/vermiliongym.asm index 6933890f..41ca1e53 100755 --- a/scripts/vermiliongym.asm +++ b/scripts/vermiliongym.asm @@ -1,5 +1,5 @@ -VermilionGymScript: - ld hl, wd126 +VermilionGymScript: ; 5ca26 (17:4a26) + ld hl, wCurrentMapScriptFlags bit 5, [hl] res 5, [hl] push hl @@ -11,9 +11,9 @@ VermilionGymScript: call EnableAutoTextBoxDrawing ld hl, VermilionGymTrainerHeader0 ld de, VermilionGymScriptPointers - ld a, [W_VERMILIONGYMCURSCRIPT] + ld a, [wVermilionGymCurScript] call ExecuteCurMapScriptInTable - ld [W_VERMILIONGYMCURSCRIPT], a + ld [wVermilionGymCurScript], a ret VermilionGymScript_5ca4c: @@ -44,8 +44,8 @@ VermilionGymScript_5ca6d: VermilionGymScript_5ca8a: xor a ld [wJoyIgnore], a - ld [W_VERMILIONGYMCURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wVermilionGymCurScript], a + ld [wCurMapScript], a ret VermilionGymScriptPointers: @@ -160,8 +160,8 @@ VermilionGymText1: xor a ld [hJoyHeld], a ld a, $3 - ld [W_VERMILIONGYMCURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wVermilionGymCurScript], a + ld [wCurMapScript], a .asm_5cb6a jp TextScriptEnd diff --git a/scripts/victoryroad1.asm b/scripts/victoryroad1.asm index 71c3823d..0f4de43e 100755 --- a/scripts/victoryroad1.asm +++ b/scripts/victoryroad1.asm @@ -1,14 +1,14 @@ VictoryRoad1Script: - ld hl, wd126 + ld hl, wCurrentMapScriptFlags bit 5, [hl] res 5, [hl] call nz, .next call EnableAutoTextBoxDrawing ld hl, VictoryRoad1TrainerHeaders ld de, VictoryRoad1ScriptPointers - ld a, [W_VICTORYROAD1CURSCRIPT] + ld a, [wVictoryRoad1CurScript] call ExecuteCurMapScriptInTable - ld [W_VICTORYROAD1CURSCRIPT], a + ld [wVictoryRoad1CurScript], a ret .next CheckEvent EVENT_VICTORY_ROAD_1_BOULDER_ON_SWITCH @@ -32,7 +32,7 @@ VictoryRoad1Script0: ld a, [H_SPRITEINDEX] cp $f jp z, CheckFightingMapTrainers - ld hl, wd126 + ld hl, wCurrentMapScriptFlags set 5, [hl] SetEvent EVENT_VICTORY_ROAD_1_BOULDER_ON_SWITCH ret diff --git a/scripts/victoryroad2.asm b/scripts/victoryroad2.asm index a638018f..20a80461 100755 --- a/scripts/victoryroad2.asm +++ b/scripts/victoryroad2.asm @@ -1,18 +1,18 @@ VictoryRoad2Script: - ld hl, wd126 + ld hl, wCurrentMapScriptFlags bit 6, [hl] res 6, [hl] call nz, VictoryRoad2Script_517c4 - ld hl, wd126 + ld hl, wCurrentMapScriptFlags bit 5, [hl] res 5, [hl] call nz, VictoryRoad2Script_517c9 call EnableAutoTextBoxDrawing ld hl, VictoryRoad2TrainerHeaders ld de, VictoryRoad2ScriptPointers - ld a, [W_VICTORYROAD2CURSCRIPT] + ld a, [wVictoryRoad2CurScript] call ExecuteCurMapScriptInTable - ld [W_VICTORYROAD2CURSCRIPT], a + ld [wVictoryRoad2CurScript], a ret VictoryRoad2Script_517c4: @@ -60,7 +60,7 @@ VictoryRoad2Script0: SetEventReuseHL EVENT_VICTORY_ROAD_2_BOULDER_ON_SWITCH2 ret nz .asm_51810 - ld hl, wd126 + ld hl, wCurrentMapScriptFlags set 5, [hl] ret @@ -75,7 +75,7 @@ VictoryRoad2TextPointers: dw VictoryRoad2Text3 dw VictoryRoad2Text4 dw VictoryRoad2Text5 - dw VictoryRoad2Text6 + dw MoltresText dw PickUpItemText dw PickUpItemText dw PickUpItemText @@ -130,14 +130,14 @@ VictoryRoad2TrainerHeader5: dw VictoryRoad2EndBattleText5 ; TextEndBattle dw VictoryRoad2EndBattleText5 ; TextEndBattle -VictoryRoad2TrainerHeader6: - dbEventFlagBit EVENT_BEAT_VICTORY_ROAD_2_TRAINER_6 +MoltresTrainerHeader: + dbEventFlagBit EVENT_BEAT_MOLTRES db ($0 << 4) ; trainer's view range - dwEventFlagAddress EVENT_BEAT_VICTORY_ROAD_2_TRAINER_6 - dw VictoryRoad2BattleText6 ; TextBeforeBattle - dw VictoryRoad2BattleText6 ; TextAfterBattle - dw VictoryRoad2BattleText6 ; TextEndBattle - dw VictoryRoad2BattleText6 ; TextEndBattle + dwEventFlagAddress EVENT_BEAT_MOLTRES + dw MoltresBattleText ; TextBeforeBattle + dw MoltresBattleText ; TextAfterBattle + dw MoltresBattleText ; TextEndBattle + dw MoltresBattleText ; TextEndBattle db $ff @@ -171,14 +171,14 @@ VictoryRoad2Text5: call TalkToTrainer jp TextScriptEnd -VictoryRoad2Text6: +MoltresText: TX_ASM - ld hl, VictoryRoad2TrainerHeader6 + ld hl, MoltresTrainerHeader call TalkToTrainer jp TextScriptEnd -VictoryRoad2BattleText6: - TX_FAR _VictoryRoad2BattleText6 +MoltresBattleText: + TX_FAR _MoltresBattleText TX_ASM ld a, MOLTRES call PlayCry diff --git a/scripts/victoryroad3.asm b/scripts/victoryroad3.asm index 33ed97de..31e06053 100755 --- a/scripts/victoryroad3.asm +++ b/scripts/victoryroad3.asm @@ -3,13 +3,13 @@ VictoryRoad3Script: call EnableAutoTextBoxDrawing ld hl, VictoryRoad3TrainerHeaders ld de, VictoryRoad3ScriptPointers - ld a, [W_VICTORYROAD3CURSCRIPT] + ld a, [wVictoryRoad3CurScript] call ExecuteCurMapScriptInTable - ld [W_VICTORYROAD3CURSCRIPT], a + ld [wVictoryRoad3CurScript], a ret VictoryRoad3Script_44996: - ld hl, wd126 + ld hl, wCurrentMapScriptFlags bit 5, [hl] res 5, [hl] ret z @@ -39,7 +39,7 @@ VictoryRoad3Script0: ld a, [hSpriteIndexOrTextID] cp $f ; Pikachu jp z, .asm_449fe - ld hl, wd126 + ld hl, wCurrentMapScriptFlags set 5, [hl] SetEvent EVENT_VICTORY_ROAD_3_BOULDER_ON_SWITCH1 ret diff --git a/scripts/viridiancity.asm b/scripts/viridiancity.asm index 9ba0c714..5aa1dbbc 100755 --- a/scripts/viridiancity.asm +++ b/scripts/viridiancity.asm @@ -1,7 +1,7 @@ ViridianCityScript: call EnableAutoTextBoxDrawing ld hl, ViridianCityScriptPointers - ld a, [W_VIRIDIANCITYCURSCRIPT] + ld a, [wViridianCityCurScript] call JumpTable ret @@ -58,7 +58,7 @@ ViridianCityScript_1905b: ld [wJoyIgnore], a ld [hJoyHeld], a ld a, $6 - ld [W_VIRIDIANCITYCURSCRIPT], a + ld [wViridianCityCurScript], a ret ViridianCityScript6: @@ -67,7 +67,7 @@ ViridianCityScript6: ret nz call Delay3 ld a, $2 - ld [W_VIRIDIANCITYCURSCRIPT], a + ld [wViridianCityCurScript], a ret ViridianCityScript_190ab: @@ -84,7 +84,7 @@ ViridianCityScript_190ab: ld [hJoyHeld], a call ViridianCityScript_1914d ld a, $5 - ld [W_VIRIDIANCITYCURSCRIPT], a + ld [wViridianCityCurScript], a ret ViridianCityScript3: @@ -92,13 +92,13 @@ ViridianCityScript3: call ViridianCityScript_190db ResetEvent EVENT_02F ld a, $4 - ld [W_VIRIDIANCITYCURSCRIPT], a + ld [wViridianCityCurScript], a ret ViridianCityScript_190db: xor a ld [wListScrollOffset], a - ld a, OLD_MAN_BATTLE + ld a, BATTLE_TYPE_OLD_MAN ld [wBattleType], a ld a, 5 ld [wCurEnemyLVL], a @@ -131,7 +131,7 @@ ViridianCityScript4: ld [wBattleType], a ld [wJoyIgnore], a ld a, $2 - ld [W_VIRIDIANCITYCURSCRIPT], a + ld [wViridianCityCurScript], a ret ViridianCityScript_1912a: @@ -151,7 +151,7 @@ ViridianCityScript5: ret nz call Delay3 ld a, $0 - ld [W_VIRIDIANCITYCURSCRIPT], a + ld [wViridianCityCurScript], a ret ViridianCityScript_1914d: @@ -195,7 +195,7 @@ ViridianCityScript7: ld a, D_UP | D_DOWN | D_LEFT | D_RIGHT | START | SELECT ld [wJoyIgnore], a ld a, $8 - ld [W_VIRIDIANCITYCURSCRIPT], a + ld [wViridianCityCurScript], a ret ViridianCityScript8: @@ -213,7 +213,7 @@ ViridianCityScript8: dec a ld [wJoyIgnore], a ld a, $9 - ld [W_VIRIDIANCITYCURSCRIPT], a + ld [wViridianCityCurScript], a ret ViridianCityScript9: @@ -228,7 +228,7 @@ ViridianCityScript9: ld [hSpriteIndexOrTextID], a call MoveSprite ld a, $a - ld [W_VIRIDIANCITYCURSCRIPT], a + ld [wViridianCityCurScript], a ret ViridianCityOldManMovementData1: @@ -252,7 +252,7 @@ ViridianCityScript10: xor a ld [wJoyIgnore], a ld a, $2 - ld [W_VIRIDIANCITYCURSCRIPT], a + ld [wViridianCityCurScript], a ret ViridianCityTextPointers: @@ -321,7 +321,7 @@ ViridianCityText_7: ld c, 2 call DelayFrames ld a, $7 - ld [W_VIRIDIANCITYCURSCRIPT], a + ld [wViridianCityCurScript], a jr .asm_192ac .asm_192a6 diff --git a/scripts/viridiancity2.asm b/scripts/viridiancity2.asm index 2b6a4001..532d57d7 100755 --- a/scripts/viridiancity2.asm +++ b/scripts/viridiancity2.asm @@ -78,7 +78,7 @@ Func_f192c: ld a, D_DOWN ld [wSimulatedJoypadStatesEnd], a ld a, $5 - ld [W_VIRIDIANCITYCURSCRIPT], a + ld [wViridianCityCurScript], a ret ViridianCityText_f1945: @@ -137,7 +137,7 @@ Func_f198e: ld hl, ViridianCityText_f19bb call PrintText ld a, $3 - ld [W_VIRIDIANCITYCURSCRIPT], a + ld [wViridianCityCurScript], a jr .asm_f19b5 .asm_f19af diff --git a/scripts/viridianforest.asm b/scripts/viridianforest.asm index ce27d81c..b1b2f951 100755 --- a/scripts/viridianforest.asm +++ b/scripts/viridianforest.asm @@ -2,9 +2,9 @@ ViridianForestScript: call EnableAutoTextBoxDrawing ld hl, ViridianForestTrainerHeaders ld de, ViridianForestScriptPointers - ld a, [W_VIRIDIANFORESTCURSCRIPT] + ld a, [wViridianForestCurScript] call ExecuteCurMapScriptInTable - ld [W_VIRIDIANFORESTCURSCRIPT], a + ld [wViridianForestCurScript], a ret ViridianForestScriptPointers: diff --git a/scripts/viridiangym.asm b/scripts/viridiangym.asm index 6cc7e2a7..1557f68a 100755 --- a/scripts/viridiangym.asm +++ b/scripts/viridiangym.asm @@ -5,9 +5,9 @@ ViridianGymScript: call EnableAutoTextBoxDrawing ld hl, ViridianGymTrainerHeaders ld de, ViridianGymScriptPointers - ld a, [W_VIRIDIANGYMCURSCRIPT] + ld a, [wViridianGymCurScript] call ExecuteCurMapScriptInTable - ld [W_VIRIDIANGYMCURSCRIPT], a + ld [wViridianGymCurScript], a ret Gym8CityName: @@ -18,8 +18,8 @@ Gym8LeaderName: ViridianGymScript_748d6: xor a ld [wJoyIgnore], a - ld [W_VIRIDIANGYMCURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wViridianGymCurScript], a + ld [wCurMapScript], a ret ViridianGymScriptPointers: @@ -46,7 +46,7 @@ ViridianGymScript0: ld a, $ff ld [wJoyIgnore], a ld a, $4 - ld [W_CURMAPSCRIPT], a + ld [wCurMapScript], a ret ;format: @@ -125,7 +125,7 @@ ViridianGymScript4: ld hl, wd736 res 7, [hl] ld a, $0 - ld [W_CURMAPSCRIPT], a + ld [wCurMapScript], a ret .asm_74980 jpba LoadSpinnerArrowTiles @@ -297,7 +297,7 @@ ViridianGymText1: ld a, $8 ld [wGymLeaderNo], a ld a, $3 - ld [W_VIRIDIANGYMCURSCRIPT], a + ld [wViridianGymCurScript], a .asm_6dff7 jp TextScriptEnd diff --git a/scripts/viridianmart.asm b/scripts/viridianmart.asm index e03694d1..64c0eda0 100755 --- a/scripts/viridianmart.asm +++ b/scripts/viridianmart.asm @@ -2,7 +2,7 @@ ViridianMartScript: call ViridianMartScript_1d47d call EnableAutoTextBoxDrawing ld hl, ViridianMartScriptPointers - ld a, [W_VIRIDIANMARKETCURSCRIPT] + ld a, [wViridianMarketCurScript] call JumpTable ret @@ -37,7 +37,7 @@ ViridianMartScript0: ld [wSimulatedJoypadStatesIndex], a call StartSimulatingJoypadStates ld a, $1 - ld [W_VIRIDIANMARKETCURSCRIPT], a + ld [wViridianMarketCurScript], a ret RLEMovement1d4bb: @@ -57,7 +57,7 @@ ViridianMartScript1: call GiveItem SetEvent EVENT_GOT_OAKS_PARCEL ld a, $2 - ld [W_VIRIDIANMARKETCURSCRIPT], a + ld [wViridianMarketCurScript], a ret ViridianMartScript2: @@ -1,8 +1,8 @@ SECTION "Sprite Buffers", SRAM, BANK[0] -S_SPRITEBUFFER0:: ds SPRITEBUFFERSIZE ; a000 -S_SPRITEBUFFER1:: ds SPRITEBUFFERSIZE ; a188 -S_SPRITEBUFFER2:: ds SPRITEBUFFERSIZE ; a310 +sSpriteBuffer0:: ds SPRITEBUFFERSIZE ; a000 +sSpriteBuffer1:: ds SPRITEBUFFERSIZE ; a188 +sSpriteBuffer2:: ds SPRITEBUFFERSIZE ; a310 ds $100 @@ -1,16 +1,16 @@ INCLUDE "charmap.asm" INCLUDE "constants/text_constants.asm" TEXT_1 EQU $26 -TEXT_2 EQU $27 -TEXT_3 EQU $28 -TEXT_4 EQU $29 -TEXT_5 EQU $2a -TEXT_6 EQU $2b -TEXT_7 EQU $2c -TEXT_8 EQU $2d +TEXT_2 EQU TEXT_1 + 1 +TEXT_3 EQU TEXT_2 + 1 +TEXT_4 EQU TEXT_3 + 1 +TEXT_5 EQU TEXT_4 + 1 +TEXT_6 EQU TEXT_5 + 1 +TEXT_7 EQU TEXT_6 + 1 +TEXT_8 EQU TEXT_7 + 1 -POKEDEX_TEXT EQU $2e -MOVE_NAMES EQU $2f +POKEDEX_TEXT EQU TEXT_8 + 1 +MOVE_NAMES EQU POKEDEX_TEXT + 1 INCLUDE "macros.asm" INCLUDE "hram.asm" @@ -940,7 +940,7 @@ _ViridianBlackboardPoisonText:: line "to cure poison!" prompt -_ViridianBlackbaordPrlzText:: +_ViridianBlackboardPrlzText:: text "Paralysis could" line "make #MON" cont "moves misfire!" @@ -983,7 +983,7 @@ _VermilionGymTrashText:: line "only trash here." done -_VermilionGymTrashSuccesText1:: +_VermilionGymTrashSuccessText1:: text "Hey! There's a" line "switch under the" cont "trash!" @@ -992,14 +992,14 @@ _VermilionGymTrashSuccesText1:: para "The 1st electric" line "lock opened!@@" -_VermilionGymTrashSuccesText2:: +_VermilionGymTrashSuccessText2:: text "Hey! There's" line "another switch" cont "under the trash!" cont "Turn it on!" prompt -_VermilionGymTrashSuccesText3:: +_VermilionGymTrashSuccessText3:: text "The 2nd electric" line "lock opened!" diff --git a/text/maps/champion.asm b/text/maps/champion.asm index 079c2ed4..3ca7aadf 100644 --- a/text/maps/champion.asm +++ b/text/maps/champion.asm @@ -35,7 +35,7 @@ _GaryChampionIntroText:: cont "in the world!" done -_GaryText_760f9:: +_GaryDefeatedText:: text "NO!" line "That can't be!" cont "You beat my best!" @@ -49,7 +49,7 @@ _GaryText_760f9:: cont "It's not fair!" prompt -_GaryText_760fe:: +_GaryVictoryText:: text "Hahaha!" line "I won, I won!" diff --git a/text/maps/seafoam_islands_b4f.asm b/text/maps/seafoam_islands_b4f.asm index 04ff0d9b..608d165f 100644 --- a/text/maps/seafoam_islands_b4f.asm +++ b/text/maps/seafoam_islands_b4f.asm @@ -1,4 +1,4 @@ -_SeafoamIslands5BattleText2:: +_ArticunoBattleText:: text "Gyaoo!@@" _SeafoamIslands5Text4:: diff --git a/text/maps/unknown_dungeon_b1f.asm b/text/maps/unknown_dungeon_b1f.asm index 7fa72a82..0918a3ce 100644 --- a/text/maps/unknown_dungeon_b1f.asm +++ b/text/maps/unknown_dungeon_b1f.asm @@ -1,2 +1,2 @@ -_UnknownDungeon3MewtwoText:: +_MewtwoBattleText:: text "Mew!@@" diff --git a/text/maps/victory_road_2f.asm b/text/maps/victory_road_2f.asm index 9241619e..cdcf6e36 100644 --- a/text/maps/victory_road_2f.asm +++ b/text/maps/victory_road_2f.asm @@ -1,4 +1,4 @@ -_VictoryRoad2BattleText6:: +_MoltresBattleText:: text "Gyaoo!@@" _VictoryRoad2BattleText1:: @@ -50,6 +50,7 @@ battle_struct: MACRO \1Moves:: ds NUM_MOVES \1DVs:: ds 2 \1Level:: db +\1Stats:: \1MaxHP:: dw \1Attack:: dw \1Defense:: dw @@ -2008,7 +2009,7 @@ wPlayerNumAttacksLeft:: ; d069 ; when the player is attacking multiple times, the number of attacks left ds 1 -W_PLAYERCONFUSEDCOUNTER:: ; d06a +wPlayerConfusedCounter:: ; d06a ds 1 wPlayerToxicCounter:: ; d06b @@ -2024,7 +2025,7 @@ wEnemyNumAttacksLeft:: ; d06e ; when the enemy is attacking multiple times, the number of attacks left ds 1 -W_ENEMYCONFUSEDCOUNTER:: ; d06f +wEnemyConfusedCounter:: ; d06f ds 1 wEnemyToxicCounter:: ; d070 @@ -2062,6 +2063,11 @@ wObjectToShow:: ; d079 ds 1 +wDefaultMap:: ; d07b +; the map you will start at when the debug bit is set + +wMenuItemOffset:: ; d07b + wAnimationID:: ; d07b ; ID number of the current battle animation ds 1 @@ -2232,50 +2238,50 @@ wSlideMonUpBottomRowLeftTile:: ; d09e wDisableVBlankWYUpdate:: ds 1 ; if non-zero, don't update WY during V-blank ; d09f -W_SPRITECURPOSX:: ; d0a0 +wSpriteCurPosX:: ; d0a0 ds 1 -W_SPRITECURPOSY:: ; d0a1 +wSpriteCurPosY:: ; d0a1 ds 1 -W_SPRITEWITDH:: ; d0a2 +wSpriteWidth:: ; d0a2 ds 1 -W_SPRITEHEIGHT:: ; d0a3 +wSpriteHeight:: ; d0a3 ds 1 -W_SPRITEINPUTCURBYTE:: ; d0a4 +wSpriteInputCurByte:: ; d0a4 ; current input byte ds 1 -W_SPRITEINPUTBITCOUNTER:: ; d0a5 +wSpriteInputBitCounter:: ; d0a5 ; bit offset of last read input bit ds 1 -W_SPRITEOUTPUTBITOFFSET:: ; d0a6; determines where in the output byte the two bits are placed. Each byte contains four columns (2bpp data) +wSpriteOutputBitOffset:: ; d0a6; determines where in the output byte the two bits are placed. Each byte contains four columns (2bpp data) ; 3 -> XX000000 1st column ; 2 -> 00XX0000 2nd column ; 1 -> 0000XX00 3rd column ; 0 -> 000000XX 4th column ds 1 -W_SPRITELOADFLAGS:: ; d0a7 +wSpriteLoadFlags:: ; d0a7 ; bit 0 determines used buffer (0 -> $a188, 1 -> $a310) ; bit 1 loading last sprite chunk? (there are at most 2 chunks per load operation) ds 1 -W_SPRITEUNPACKMODE:: ; d0a8 +wSpriteUnpackMode:: ; d0a8 ds 1 wSpriteFlipped:: ; d0a9 ds 1 -W_SPRITEINPUTPTR:: ; d0aa +wSpriteInputPtr:: ; d0aa ; pointer to next input byte ds 2 -W_SPRITEOUTPUTPTR:: ; d0ac +wSpriteOutputPtr:: ; d0ac ; pointer to current output byte ds 2 -W_SPRITEOUTPUTPTRCACHED:: ; d0ae +wSpriteOutputPtrCached:: ; d0ae ; used to revert pointer for different bit offsets ds 2 -W_SPRITEDECODETABLE0PTR:: ; d0b0 +wSpriteDecodeTable0Ptr:: ; d0b0 ; pointer to differential decoding table (assuming initial value 0) ds 2 -W_SPRITEDECODETABLE1PTR:: ; d0b2 +wSpriteDecodeTable1Ptr:: ; d0b2 ; pointer to differential decoding table (assuming initial value 1) ds 2 @@ -2295,7 +2301,7 @@ wMonHIndex:: ; d0b7 ds 1 wMonHBaseStats:: ; d0b8 -W_MONHBASEHP:: ; d0b8 +wMonHBaseHP:: ; d0b8 ds 1 wMonHBaseAttack:: ; d0b9 ds 1 @@ -2381,6 +2387,8 @@ wFirstMonsNotOutYet:: ; d11c ; which will be the first mon sent out. ds 1 +wPokeBallCaptureCalcTemp:: ; d11e + ; lower nybble: number of shakes ; upper nybble: number of animations to play wPokeBallAnimData:: ; d11d @@ -2424,7 +2432,7 @@ wIsKeyItem:: ; d123 wTextBoxID:: ; d124 ds 1 -wd126:: ds 1 ; not exactly sure what this is used for, but it seems to be used as a multipurpose temp flag value ; d125 +wCurrentMapScriptFlags:: ds 1 ; not exactly sure what this is used for, but it seems to be used as a multipurpose temp flag value ; d125 wCurEnemyLVL:: ; d126 ds 1 @@ -2592,7 +2600,7 @@ wNumBagItems:: ; d31c ds 1 wBagItems:: ; d31d ; item, quantity - ds 20 * 2 + ds BAG_ITEM_CAPACITY * 2 ds 1 ; end wPlayerMoney:: ; d346 @@ -2615,7 +2623,7 @@ wOptions:: ; d354 ds 1 wObtainedBadges:: ; d355 - ds 1 + flag_array 8 ds 1 @@ -2678,20 +2686,20 @@ wCurMapWidth:: ; d368 ; blocks ds 1 -W_MAPDATAPTR:: ; d369 +wMapDataPtr:: ; d369 ds 2 wMapTextPtr:: ; d36b ds 2 -W_MAPSCRIPTPTR:: ; d36d +wMapScriptPtr:: ; d36d ds 2 -W_MAPCONNECTIONS:: ; d36f +wMapConnections:: ; d36f ; connection byte ds 1 -W_MAPCONN1PTR:: ; d370 +wMapConn1Ptr:: ; d370 ds 1 wNorthConnectionStripSrc:: ; d371 @@ -2715,7 +2723,7 @@ wNorthConnectedMapXAlignment:: ; d378 wNorthConnectedMapViewPointer:: ; d379 ds 2 -W_MAPCONN2PTR:: ; d37b +wMapConn2Ptr:: ; d37b ds 1 wSouthConnectionStripSrc:: ; d37c @@ -2739,7 +2747,7 @@ wSouthConnectedMapXAlignment:: ; d383 wSouthConnectedMapViewPointer:: ; d384 ds 2 -W_MAPCONN3PTR:: ; d386 +wMapConn3Ptr:: ; d386 ds 1 wWestConnectionStripSrc:: ; d387 @@ -2763,7 +2771,7 @@ wWestConnectedMapXAlignment:: ; d38e wWestConnectedMapViewPointer:: ; d38f ds 2 -W_MAPCONN4PTR:: ; d391 +wMapConn4Ptr:: ; d391 ds 1 wEastConnectionStripSrc:: ; d392 @@ -2949,7 +2957,7 @@ wPlayerDirection:: ; d529 wTilesetBank:: ; d52a ds 1 -W_TILESETBLOCKSPTR:: ; d52b +wTileSetBlocksPtr:: ; d52b ; maps blocks (4x4 tiles) to tiles ds 2 @@ -2960,7 +2968,7 @@ wTilesetCollisionPtr:: ; d52f ; list of all walkable tiles ds 2 -W_TILESETTALKINGOVERTILES:: ; d531 +wTileSetTalkingOverTiles:: ; d531 ds 3 wGrassTile:: ; d534 @@ -2972,7 +2980,7 @@ wNumBoxItems:: ; d539 ds 1 wBoxItems:: ; d53a ; item, quantity - ds 50 * 2 + ds PC_ITEM_CAPACITY * 2 ds 1 ; end wCurrentBoxNum:: ; d59f @@ -3009,217 +3017,217 @@ wMissableObjectList:: ; d5cd wGameProgressFlags:: ; d5e9 ; $c8 bytes -W_OAKSLABCURSCRIPT:: ; d5e9 +wOaksLabCurScript:: ; d5e9 ds 1 -W_PALLETTOWNCURSCRIPT:: ; d5f0 +wPalletTownCurScript:: ; d5f0 ds 1 ds 1 -W_BLUESHOUSECURSCRIPT:: ; d5f2 +wBluesHouseCurScript:: ; d5f2 ds 1 -W_VIRIDIANCITYCURSCRIPT:: ; d5f3 +wViridianCityCurScript:: ; d5f3 ds 1 ds 2 -W_PEWTERCITYCURSCRIPT:: ; d5f6 +wPewterCityCurScript:: ; d5f6 ds 1 -W_ROUTE3CURSCRIPT:: ; d5f7 +wRoute3CurScript:: ; d5f7 ds 1 -W_ROUTE4CURSCRIPT:: ; d5f8 +wRoute4CurScript:: ; d5f8 ds 1 -W_FANCLUBCURSCRIPT:: ; d5f9 +wFanClubCurScript:: ; d5f9 ds 1 -W_VIRIDIANGYMCURSCRIPT:: ; d5fa +wViridianGymCurScript:: ; d5fa ds 1 -W_PEWTERGYMCURSCRIPT:: ; d5fb +wPewterGymCurScript:: ; d5fb ds 1 -W_CERULEANGYMCURSCRIPT:: ; d5fc +wCeruleanGymCurScript:: ; d5fc ds 1 -W_VERMILIONGYMCURSCRIPT:: ; d5fd +wVermilionGymCurScript:: ; d5fd ds 1 -W_CELADONGYMCURSCRIPT:: ; d5fe +wCeladonGymCurScript:: ; d5fe ds 1 -W_ROUTE6CURSCRIPT:: ; d5ff +wRoute6CurScript:: ; d5ff ds 1 -W_ROUTE8CURSCRIPT:: ; d600 +wRoute8CurScript:: ; d600 ds 1 -W_ROUTE24CURSCRIPT:: ; d601 +wRoute24CurScript:: ; d601 ds 1 -W_ROUTE25CURSCRIPT:: ; d602 +wRoute25CurScript:: ; d602 ds 1 -W_ROUTE9CURSCRIPT:: ; d603 +wRoute9CurScript:: ; d603 ds 1 -W_ROUTE10CURSCRIPT:: ; d604 +wRoute10CurScript:: ; d604 ds 1 -W_MTMOON1CURSCRIPT:: ; d605 +wMtMoon1CurScript:: ; d605 ds 1 -W_MTMOON3CURSCRIPT:: ; d606 +wMtMoon3CurScript:: ; d606 ds 1 -W_SSANNE8CURSCRIPT:: ; d607 +wSSAnne8CurScript:: ; d607 ds 1 -W_SSANNE9CURSCRIPT:: ; d608 +wSSAnne9CurScript:: ; d608 ds 1 -W_ROUTE22CURSCRIPT:: ; d609 +wRoute22CurScript:: ; d609 ds 1 ds 1 -W_REDSHOUSE2CURSCRIPT:: ; d60b +wRedsHouse2CurScript:: ; d60b ds 1 -W_VIRIDIANMARKETCURSCRIPT:: ; d60c +wViridianMarketCurScript:: ; d60c ds 1 -W_ROUTE22GATECURSCRIPT:: ; d60d +wRoute22GateCurScript:: ; d60d ds 1 -W_CERULEANCITYCURSCRIPT:: ; d60e +wCeruleanCityCurScript:: ; d60e ds 1 ds 7 -W_SSANNE5CURSCRIPT:: ; d616 +wSSAnne5CurScript:: ; d616 ds 1 -W_VIRIDIANFORESTCURSCRIPT:: ; d617 +wViridianForestCurScript:: ; d617 ds 1 -W_MUSEUM1FCURSCRIPT:: ; d618 +wMuseum1FCurScript:: ; d618 ds 1 -W_ROUTE13CURSCRIPT:: ; d619 +wRoute13CurScript:: ; d619 ds 1 -W_ROUTE14CURSCRIPT:: ; d61a +wRoute14CurScript:: ; d61a ds 1 -W_ROUTE17CURSCRIPT:: ; d61b +wRoute17CurScript:: ; d61b ds 1 -W_ROUTE19CURSCRIPT:: ; d61c +wRoute19CurScript:: ; d61c ds 1 -W_ROUTE21CURSCRIPT:: ; d61d +wRoute21CurScript:: ; d61d ds 1 wSafariZoneEntranceCurScript:: ; d61e ds 1 -W_ROCKTUNNEL2CURSCRIPT:: ; d61f +wRockTunnel2CurScript:: ; d61f ds 1 -W_ROCKTUNNEL1CURSCRIPT:: ; d620 +wRockTunnel1CurScript:: ; d620 ds 1 ds 1 -W_ROUTE11CURSCRIPT:: ; d622 +wRoute11CurScript:: ; d622 ds 1 -W_ROUTE12CURSCRIPT:: ; d623 +wRoute12CurScript:: ; d623 ds 1 -W_ROUTE15CURSCRIPT:: ; d624 +wRoute15CurScript:: ; d624 ds 1 -W_ROUTE16CURSCRIPT:: ; d625 +wRoute16CurScript:: ; d625 ds 1 -W_ROUTE18CURSCRIPT:: ; d626 +wRoute18CurScript:: ; d626 ds 1 -W_ROUTE20CURSCRIPT:: ; d627 +wRoute20CurScript:: ; d627 ds 1 -W_SSANNE10CURSCRIPT:: ; d628 +wSSAnne10CurScript:: ; d628 ds 1 -W_VERMILIONCITYCURSCRIPT:: ; d629 +wVermilionCityCurScript:: ; d629 ds 1 -W_POKEMONTOWER2CURSCRIPT:: ; d62a +wPokemonTower2CurScript:: ; d62a ds 1 -W_POKEMONTOWER3CURSCRIPT:: ; d62b +wPokemonTower3CurScript:: ; d62b ds 1 -W_POKEMONTOWER4CURSCRIPT:: ; d62c +wPokemonTower4CurScript:: ; d62c ds 1 -W_POKEMONTOWER5CURSCRIPT:: ; d62d +wPokemonTower5CurScript:: ; d62d ds 1 -W_POKEMONTOWER6CURSCRIPT:: ; d62e +wPokemonTower6CurScript:: ; d62e ds 1 -W_POKEMONTOWER7CURSCRIPT:: ; d62f +wPokemonTower7CurScript:: ; d62f ds 1 -W_ROCKETHIDEOUT1CURSCRIPT:: ; d630 +wRocketHideout1CurScript:: ; d630 ds 1 -W_ROCKETHIDEOUT2CURSCRIPT:: ; d631 +wRocketHideout2CurScript:: ; d631 ds 1 -W_ROCKETHIDEOUT3CURSCRIPT:: ; d632 +wRocketHideout3CurScript:: ; d632 ds 1 -W_ROCKETHIDEOUT4CURSCRIPT:: ; d633 +wRocketHideout4CurScript:: ; d633 ds 2 -W_ROUTE6GATECURSCRIPT:: ; d635 +wRoute6GateCurScript:: ; d635 ds 1 -W_ROUTE8GATECURSCRIPT:: ; d636 +wRoute8GateCurScript:: ; d636 ds 2 -W_CINNABARISLANDCURSCRIPT:: ; d638 +wCinnabarIslandCurScript:: ; d638 ds 1 -W_MANSION1CURSCRIPT:: ; d639 +wMansion1CurScript:: ; d639 ds 2 -W_MANSION2CURSCRIPT:: ; d63b +wMansion2CurScript:: ; d63b ds 1 -W_MANSION3CURSCRIPT:: ; d63c +wMansion3CurScript:: ; d63c ds 1 -W_MANSION4CURSCRIPT:: ; d63d +wMansion4CurScript:: ; d63d ds 1 -W_VICTORYROAD2CURSCRIPT:: ; d63e +wVictoryRoad2CurScript:: ; d63e ds 1 -W_VICTORYROAD3CURSCRIPT:: ; d63f +wVictoryRoad3CurScript:: ; d63f ds 1 -W_CELADONCITYCURSCRIPT:: ; d640 +wCeladonCityCurScript:: ; d640 ds 1 -W_FIGHTINGDOJOCURSCRIPT:: ; d641 +wFightingDojoCurScript:: ; d641 ds 1 -W_SILPHCO2CURSCRIPT:: ; d642 +wSilphCo2CurScript:: ; d642 ds 1 -W_SILPHCO3CURSCRIPT:: ; d643 +wSilphCo3CurScript:: ; d643 ds 1 -W_SILPHCO4CURSCRIPT:: ; d644 +wSilphCo4CurScript:: ; d644 ds 1 -W_SILPHCO5CURSCRIPT:: ; d645 +wSilphCo5CurScript:: ; d645 ds 1 -W_SILPHCO6CURSCRIPT:: ; d646 +wSilphCo6CurScript:: ; d646 ds 1 -W_SILPHCO7CURSCRIPT:: ; d647 +wSilphCo7CurScript:: ; d647 ds 1 -W_SILPHCO8CURSCRIPT:: ; d648 +wSilphCo8CurScript:: ; d648 ds 1 -W_SILPHCO9CURSCRIPT:: ; d649 +wSilphCo9CurScript:: ; d649 ds 1 -W_HALLOFFAMEROOMCURSCRIPT:: ; d64a +wHallOfFameRoomCurScript:: ; d64a ds 1 -W_GARYCURSCRIPT:: ; d64b +wGaryCurScript:: ; d64b ds 1 -W_LORELEICURSCRIPT:: ; d64c +wLoreleiCurScript:: ; d64c ds 1 -W_BRUNOCURSCRIPT:: ; d64d +wBrunoCurScript:: ; d64d ds 1 -W_AGATHACURSCRIPT:: ; d64e +wAgathaCurScript:: ; d64e ds 1 -W_UNKNOWNDUNGEON3CURSCRIPT:: ; d64f +wUnknownDungeon3CurScript:: ; d64f ds 1 -W_VICTORYROAD1CURSCRIPT:: ; d650 +wVictoryRoad1CurScript:: ; d650 ds 1 ds 1 -W_LANCECURSCRIPT:: ; d652 +wLanceCurScript:: ; d652 ds 1 ds 4 -W_SILPHCO10CURSCRIPT:: ; d657 +wSilphCo10CurScript:: ; d657 ds 1 -W_SILPHCO11CURSCRIPT:: ; d658 +wSilphCo11CurScript:: ; d658 ds 1 ds 1 -W_FUCHSIAGYMCURSCRIPT:: ; d65a +wFuchsiaGymCurScript:: ; d65a ds 1 -W_SAFFRONGYMCURSCRIPT:: ; d65b +wSaffronGymCurScript:: ; d65b ds 1 ds 1 -W_CINNABARGYMCURSCRIPT:: ; d65d +wCinnabarGymCurScript:: ; d65d ds 1 -W_CELADONGAMECORNERCURSCRIPT:: ; d65e +wCeladonGameCornerCurScript:: ; d65e ds 1 -W_ROUTE16GATECURSCRIPT:: ; d65f +wRoute16GateCurScript:: ; d65f ds 1 -W_BILLSHOUSECURSCRIPT:: ; d660 +wBillsHouseCurScript:: ; d660 ds 1 -W_ROUTE5GATECURSCRIPT:: ; d661 +wRoute5GateCurScript:: ; d661 ds 1 -W_POWERPLANTCURSCRIPT:: ; d662 +wPowerPlantCurScript:: ; d662 ; overload ds 0 -W_ROUTE7GATECURSCRIPT:: ; d662 +wRoute7GateCurScript:: ; d662 ; overload ds 1 ds 1 -W_SSANNE2CURSCRIPT:: ; d664 +wSSAnne2CurScript:: ; d664 ds 1 wSeafoamIslands4CurScript:: ; d665 ds 1 -W_ROUTE23CURSCRIPT:: ; d666 +wRoute23CurScript:: ; d666 ds 1 wSeafoamIslands5CurScript:: ; d667 ds 1 -W_ROUTE18GATECURSCRIPT:: ; d668 +wRoute18GateCurScript:: ; d668 ds 1 ds 78 @@ -3248,29 +3256,29 @@ wSafariSteps:: ; d70c ; starts at 502 ds 2 -W_FOSSILITEM:: ; d70e +wFossilItem:: ; d70e ; item given to cinnabar lab ds 1 -W_FOSSILMON:: ; d70f +wFossilMon:: ; d70f ; mon that will result from the item ds 1 ds 2 -W_ENEMYMONORTRAINERCLASS:: ; d712 +wEnemyMonOrTrainerClass:: ; d712 ; trainer classes start at 200 ds 1 wPlayerJumpingYScreenCoordsIndex:: ; d713 ds 1 -W_RIVALSTARTER:: ; d714 +wRivalStarter:: ; d714 ds 1 ds 1 -W_PLAYERSTARTER:: ; d716 +wPlayerStarter:: ; d716 ds 1 wBoulderSpriteIndex:: ; d717 @@ -3307,6 +3315,12 @@ wUnusedD71F:: ; d71e wd728:: ; d727 ; bit 0: using Strength outside of battle +; bit 1: set by IsSurfingAllowed when surfing's allowed, but the caller resets it after checking the result +; bit 3: received Old Rod +; bit 4: received Good Rod +; bit 5: received Super Rod +; bit 6: gave one of the Saffron guards a drink +; bit 7: set by ItemUseCardKey, which is leftover code from a previous implementation of the Card Key ds 1 ds 1 @@ -3320,15 +3334,34 @@ wBeatGymFlags:: ; d729 wd72c:: ; d72b ; bit 0: if not set, the 3 minimum steps between random battles have passed +; bit 1: prevent audio fade out ds 1 -wd72d:: ds 1 ; misc temp flags? (in some scripts, bit 6 and 7 set after a special battle (e.g. gym leaders) has been won) - ; also used as a start menu flag - ; d72c +wd72d:: ; d72c +; This variable is used for temporary flags and as the destination map when +; warping to the Trade Center or Colosseum. +; bit 0: sprite facing directions have been initialised in the Trade Center +; bit 3: do scripted warp (used to warp back to Lavender Town from the top of the pokemon tower) +; bit 4: on a dungeon warp +; bit 5: don't make NPCs face the player when spoken to +; Bits 6 and 7 are set by scripts when starting major battles in the storyline, +; but they do not appear to affect anything. Bit 6 is reset after all battles +; and bit 7 is reset after trainer battles (but it's only set before trainer +; battles anyway). + ds 1 wd72e:: ; d72d +; bit 0: the player has received Lapras in the Silph Co. building +; bit 1: set in various places, but doesn't appear to have an effect +; bit 2: the player has healed pokemon at a pokemon center at least once +; bit 3: the player has a received a pokemon from Prof. Oak +; bit 4: disable battles +; bit 5: set when a battle ends and when the player blacks out in the overworld due to poison +; bit 6: using the link feature ; bit 7: set if scripted NPC movement has been initialised - ds 2 ; more temp misc flags, used with npc movement, main menu and other stuff + ds 1 + + ds 1 wd730:: ; d72f ; bit 0: NPC sprite being moved by script @@ -3355,7 +3388,10 @@ wd732:: ; d731 wFlags_D733:: ; d732 ; bit 0: running a test battle -; bit 4: use variable [W_CURMAPSCRIPT] instead of the provided index for next frame's map script (used to start battle when talking to trainers) +; bit 1: prevent music from changing when entering new map +; bit 2: skip the joypad check in CheckWarpsNoCollision (used for the forced warp down the waterfall in the Seafoam Islands) +; bit 3: trainer wants to battle +; bit 4: use variable [wCurMapScript] instead of the provided index for next frame's map script (used to start battle when talking to trainers) ; bit 7: used fly out of battle ds 1 @@ -3462,17 +3498,19 @@ wOpponentAfterWrongAnswer:: ; da37 wUnusedDA38:: ; da37 ds 1 -W_CURMAPSCRIPT:: ; da38 +wCurMapScript:: ; da38 ; index of current map script, mostly used as index for function pointer array ; mostly copied from map-specific map script pointer and wirtten back later ds 1 - ds 6 + ds 7 -wPlayTimeHours:: ; da3f - ds 2 -wPlayTimeMinutes:: ; da41 - ds 2 +wPlayTimeHours:: ; da40 + ds 1 +wPlayTimeMaxed:: ; da41 + ds 1 +wPlayTimeMinutes:: ; da42 + ds 1 wPlayTimeSeconds:: ; da43 ds 1 wPlayTimeFrames:: ; da44 |