diff options
153 files changed, 1727 insertions, 1461 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 2d1fab45..5b379fae 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 2d9671f9..81b03374 100644 --- a/engine/bank3c.asm +++ b/engine/bank3c.asm @@ -218,11 +218,11 @@ Func_f02da:: ; f02da (3c:42da) jr nz, .asm_f02e5 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 f86bcf21..aac3ddce 100644 --- a/engine/bank3d.asm +++ b/engine/bank3d.asm @@ -452,12 +452,15 @@ Text_f5b28:: ; f5b28 (3d:5b28) TX_FAR _CanMoveBouldersText ; 2d:4193 db "@" -CheckForForcedBikeSurf:: ; f5b2d (3d:5b2d) +IsSurfingAllowed: ; cdc0 (3:4dc0) +; 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 @@ -470,7 +473,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 @@ -495,7 +498,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 @@ -503,7 +506,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 7a3eab32..665d79f7 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 c8a7e740..60769e09 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 9649da5d..f99cf18f 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 @@ -239,12 +239,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 8e5920d5..7ef1a7c8 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 7ccfbf01..648255d9 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 31426795..92d53819 100755 --- a/engine/items/items.asm +++ b/engine/items/items.asm @@ -101,112 +101,157 @@ ItemUsePtrTable: ; d307 (3:5307) dw ItemUsePPRestore ; MAX_ELIXER ItemUseBall: ; d3ad (3:53ad) + +; 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 + +; If this is for the old man battle, skip checking if the party & box are full. ld a,[wBattleType] - cp $1 - jr z,.UseBall - cp $4 ; pikachu battle? - jr z,.UseBall - ld a,[wPartyCount] ;is Party full? + 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,.UseBall - ld a,[wNumInBox] ;is Box full? + jr nz,.canUseBall + ld a,[wNumInBox] ; is box full? cp a,MONS_PER_BOX jp z,BoxFullCannotThrowBall -.UseBall -;ok, you can use a ball + +.canUseBall xor a ld [wCapturedMonSpecies],a + ld a,[wBattleType] - cp a,2 ;SafariBattle + cp a,BATTLE_TYPE_SAFARI jr nz,.skipSafariZoneCode + .safariZone - ; remove a Safari Ball from inventory ld hl,wNumSafariBalls - dec [hl] + dec [hl] ; remove a Safari Ball + .skipSafariZoneCode call RunDefaultPaletteCommand - ld a,$43 - ld [wd11e],a - call LoadScreenTilesFromBuffer1 ;restore screenBuffer from Backup + + 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 b,$10 ; can't be caught value + jp z,.setAnimData + ld a,[wBattleType] - cp $1 + cp BATTLE_TYPE_OLD_MAN jr z,.oldManBattle - cp $4 + 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 + call CopyData ; save the player's name in the Wild Monster data (part of the Cinnabar Island Missingno. glitch) ld a, [wBattleType] - cp $1 - jp nz,.BallSuccess + cp BATTLE_TYPE_OLD_MAN + jp nz,.captured ld a,$1 ld [wCapturedMonSpecies], a ld a, [wd74c] bit 7, a ld b, $63 - jp nz,.next12 - jp .BallSuccess + jp nz,.setAnimData + jp .captured .notOldManBattle +; 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 - jp z,.next12 -; if not fighting ghost Marowak, loop until a random number in the current -; pokeball's allowed range is found + 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 + +; Get the item ID. ld hl,wcf91 .asm_d54a ld a,[hl] + +; The Master Ball always succeeds. cp a,MASTER_BALL - jp z,.BallSuccess + 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 + 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 - ld a,150 ;get only numbers <= 150 for Ultra Ball + +; If it's an Ultra/Safari Ball and Rand1 is greater than 150, try again. + ld a,150 cp b 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 a, 1 << FRZ | SLP ;is frozen and/or asleep? + 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 + jp c,.captured ld b,a -.noAilments - push bc ;save RANDOM number + +.skipAilmentValueSubtraction + push bc ; save (Rand1 - Status) + +; Calculate MaxHP * 255. xor a ld [H_MULTIPLICAND],a ld hl,wEnemyMonMaxHP @@ -216,121 +261,180 @@ ItemUseBall: ; d3ad (3:53ad) ld [H_MULTIPLICAND + 2],a ld a,255 ld [H_MULTIPLIER],a - call Multiply ; MaxHP * 255 + 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,12 + jr nz,.skip1 ld a,8 -.next7 + +.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 + ld b,4 ; number of bytes in dividend call Divide + +; 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] - -; 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. 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 + +.skip2 + +; Let W = ((MaxHP * 255) / BallFactor) / max(HP / 4, 1). Calculate W. ld [H_DIVISOR],a ld b,4 - call Divide ; ((MaxHP * 255) / BallFactor) / (CurHP / 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 + jr z,.skip3 ld a,255 ld [H_QUOTIENT + 3],a -.next9 - pop bc - ld a,[wEnemyMonCatchRate] ;enemy: Catch Rate + +.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 + 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 + 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 -.next10 + jr c,.failedToCapture + +.captured + jr .skipShakeCalculations + +.failedToCapture ld a,[H_QUOTIENT + 3] - ld [wd11e],a + 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 a,[wEnemyMonCatchRate] ld [H_MULTIPLICAND + 2],a ld a,100 ld [H_MULTIPLIER],a - call Multiply ; CatchRate * 100 + 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 + jr z,.skip4 ld b,200 cp GREAT_BALL - jr z,.next11 + jr z,.skip4 ld b,150 cp ULTRA_BALL - jr z,.next11 -.next11 + jr z,.skip4 + +.skip4 + +; Let Y = (CatchRate * 100) / BallFactor2. Calculate Y. ld a,b ld [H_DIVISOR],a ld b,4 call Divide + +; 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 b,$63 ; 3 shakes + jr nz,.setAnimData + +; Calculate X * Y. + ld a,[wPokeBallCaptureCalcTemp] ld [H_MULTIPLIER],a call Multiply + +; 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 + jr z,.addAilmentValue ld b,10 -.next14 + +.addAilmentValue +; If the Pokémon has a status ailment, add Status2. ld a,[H_QUOTIENT + 3] add b ld [H_QUOTIENT + 3],a -.next13 + +.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,.next12 + jr c,.setAnimData cp a,30 ld b,$61 - jr c,.next12 + jr c,.setAnimData cp a,70 ld b,$62 - jr c,.next12 + jr c,.setAnimData ld b,$63 -.next12 + +.setAnimData ld a,b ld [wPokeBallAnimData],a -.BallSuccess2 + +.skipShakeCalculations ld c,20 call DelayFrames + +; Do the animation. ld a,TOSS_ANIM ld [wAnimationID],a xor a @@ -346,45 +450,61 @@ ItemUseBall: ; d3ad (3:53ad) ld [wcf91],a pop af ld [wWhichPokemon],a + +; Determine the message to display from the animation. ld a,[wPokeBallAnimData] cp a,$10 ld hl,ItemUseBallText00 - jp z,.printText0 + jp z,.printMessage cp a,$20 ld hl,ItemUseBallText01 - jp z,.printText0 + jp z,.printMessage cp a,$61 ld hl,ItemUseBallText02 - jp z,.printText0 + jp z,.printMessage cp a,$62 ld hl,ItemUseBallText03 - jp z,.printText0 + jp z,.printMessage cp a,$63 ld hl,ItemUseBallText04 - jp z,.printText0 - ld hl,wEnemyMonHP ;current HP + jp z,.printMessage + +; Save current HP. + ld hl,wEnemyMonHP ld a,[hli] push af ld a,[hli] - push af ;backup currentHP... + push af + +; Save status ailment. inc hl ld a,[hl] - push af ;...and status ailments + push af + push hl + +; 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,.next15 - ld a,$4c + jr z,.notTransformed + ld a,DITTO ld [wEnemyMonSpecies2],a - jr .next16 -.next15 + 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 -.next16 + +.skip6 ld a,[wcf91] push af ld a,[wEnemyMonSpecies2] @@ -402,17 +522,19 @@ ItemUseBall: ; d3ad (3:53ad) ld [hld],a pop af ld [hl],a - ld a,[wEnemyMonSpecies] ;enemy + ld a,[wEnemyMonSpecies] 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 + 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 @@ -428,53 +550,63 @@ ItemUseBall: ; d3ad (3:53ad) ld b,FLAG_SET predef FlagActionPredef pop af - and a - jr nz,.checkParty + + 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 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? + 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 a, [wd7f1] bit 0, a - jr nz,.sendToBox2 + jr nz,.printTransferredToPCText ld hl,ItemUseBallText08 -.sendToBox2 +.printTransferredToPCText call PrintText - jr .End -.printText1 + jr .done + +.oldManCaughtMon ld hl,ItemUseBallText05 -.printText0 + +.printMessage call PrintText call ClearSprites -.End + +.done ld a,[wBattleType] - and a - ret nz + 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 + .emptyString db "@" @@ -826,7 +958,7 @@ 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 + ld bc,wPartyMon1Status - wPartyMon1 add hl,bc ; hl now points to status ld a,[wcf91] lb bc, ANTIDOTE_MSG, 1 << PSN @@ -864,10 +996,10 @@ ItemUseMedicine: ; d8ae (3:58ae) ld hl,wPlayerBattleStatus3 res BadlyPoisoned,[hl] ; heal Toxic status pop hl - ld bc,30 + ld bc,wPartyMon1Stats - wPartyMon1Status add hl,bc ; hl now points to party stats - ld de,wBattleMonMaxHP - ld bc,10 + ld de,wBattleMonStats + ld bc,NUM_STATS * 2 call CopyData ; copy party stats to in-battle stat data predef DoubleOrHalveSelectedStats jp .doneHealing @@ -936,7 +1068,7 @@ ItemUseMedicine: ; d8ae (3:58ae) .compareCurrentHPToMaxHP push hl push bc - ld bc,32 + ld bc,wPartyMon1MaxHP - (wPartyMon1HP + 1) add hl,bc ; hl now points to max HP pop bc ld a,[hli] @@ -968,7 +1100,7 @@ ItemUseMedicine: ; d8ae (3:58ae) ld [wChannelSoundIDs + CH4],a push hl push de - ld bc,32 + ld bc,wPartyMon1MaxHP - (wPartyMon1HP + 1) add hl,bc ; hl now points to max HP ld a,[hli] ld [wHPBarMaxHP+1],a @@ -1001,7 +1133,7 @@ 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 + 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] @@ -1080,7 +1212,7 @@ ItemUseMedicine: ; d8ae (3:58ae) inc hl ld d,h ld e,l ; de now points to current HP - ld hl,33 + ld hl,(wPartyMon1MaxHP + 1) - (wPartyMon1HP + 1) add hl,de ; hl now points to max HP ld a,[wcf91] cp a,REVIVE @@ -1127,7 +1259,7 @@ ItemUseMedicine: ; d8ae (3:58ae) ld a,[wcf91] cp a,FULL_RESTORE jr nz,.updateInBattleData - ld bc,-31 + ld bc,wPartyMon1Status - (wPartyMon1MaxHP + 1) add hl,bc xor a ld [hl],a ; remove the status ailment in the party data @@ -1150,7 +1282,7 @@ ItemUseMedicine: ; d8ae (3:58ae) ld [wBattleMonStatus],a ; remove the status ailment in the in-battle pokemon data .calculateHPBarCoords ld hl,wOAMBuffer + $90 - ld bc,2 * 20 + ld bc,2 * SCREEN_WIDTH inc d .calculateHPBarCoordsLoop add hl,bc @@ -1230,7 +1362,7 @@ ItemUseMedicine: ; d8ae (3:58ae) ld a,[hl] ld [wd0b5],a ld [wd11e],a - ld bc,33 + ld bc,wPartyMon1Level - wPartyMon1 add hl,bc ; hl now points to level ld a,[hl] ; a = level ld [wCurEnemyLVL],a ; store level @@ -1247,7 +1379,7 @@ ItemUseMedicine: ; d8ae (3:58ae) push hl sub a,HP_UP add a - ld bc,17 + ld bc,wPartyMon1HPExp - wPartyMon1 add hl,bc add l ld l,a @@ -1295,17 +1427,17 @@ ItemUseMedicine: ; d8ae (3:58ae) call PrintText jp GBPalWhiteOut .recalculateStats - ld bc,34 + ld bc,wPartyMon1Stats - wPartyMon1 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 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 + ld bc,wPartyMon1Level - wPartyMon1 add hl,bc ; hl now points to level ld a,[hl] ; a = level cp a, MAX_LEVEL @@ -1319,8 +1451,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 @@ -1335,7 +1467,7 @@ ItemUseMedicine: ; d8ae (3:58ae) push af push de push hl - ld bc,34 + ld bc,wPartyMon1MaxHP - wPartyMon1 add hl,bc ; hl now points to MSB of max HP ld a,[hli] ld b,a @@ -1345,8 +1477,8 @@ ItemUseMedicine: ; d8ae (3:58ae) 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 @@ -1355,8 +1487,8 @@ 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 de,(wPartyMon1HP + 1) - wPartyMon1MaxHP + add hl,de ; hl now points to LSB of current HP ld a,[hl] add c ld [hld],a @@ -1547,7 +1679,7 @@ ItemUseCardKey: ; de57 (3:de57) xor a ld [wUnusedD71F],a call GetTileAndCoordsInFrontOfPlayer - ld a,[GetTileAndCoordsInFrontOfPlayer] ; $4586 + ld a,[GetTileAndCoordsInFrontOfPlayer] cp a,$18 jr nz,.next0 ld hl,CardKeyTable1 @@ -2116,7 +2248,7 @@ ItemUsePPRestore: ; e1f7 (3:61f7) cp a,ETHER jr nc,.useEther ; if Ether or Max Ether .usePPUp - ld bc,21 + ld bc,wPartyMon1PP - wPartyMon1Moves add hl,bc ld a,[hl] ; move PP cp a,3 << 6 ; have 3 PP Ups already been used? 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 94504ffb..f7c92326 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 eeeb32c8..f07c7bb2 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 48b2380d..d2e710ae 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 9ca03ff4..418d7928 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 6d588fdb..390bf39b 100755 --- a/engine/pikachu_pic_animation.asm +++ b/engine/pikachu_pic_animation.asm @@ -2816,10 +2816,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/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 @@ -2367,12 +2367,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) @@ -2468,7 +2468,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 @@ -2494,7 +2494,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 @@ -2518,12 +2518,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 @@ -2539,7 +2539,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 @@ -2562,7 +2562,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 @@ -2573,7 +2573,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 @@ -3339,7 +3339,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 @@ -3363,7 +3363,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) @@ -4927,9 +4927,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 22860985..23fe450e 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 @@ -269,7 +269,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 @@ -517,7 +517,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 @@ -553,7 +553,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 @@ -588,7 +588,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 @@ -615,7 +615,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 @@ -881,9 +881,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 @@ -908,7 +908,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 @@ -926,7 +926,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 @@ -944,7 +944,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 @@ -962,7 +962,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 @@ -1058,7 +1058,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 @@ -1145,8 +1145,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 @@ -1553,9 +1553,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 @@ -1745,7 +1745,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 @@ -1837,32 +1837,32 @@ LoadMapHeader:: ; 0dab (0:0dab) 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 39db37d5..a96b9b43 100755 --- a/scripts/agatha.asm +++ b/scripts/agatha.asm @@ -1,33 +1,34 @@ AgathaScript: ; 7642d (1d:642d) - 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: ; 76443 (1d:6443) - ld hl, wd126 +AgathaShowOrHideExitBlock: ; 76443 (1d:6443) +; 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: ; 76459 (1d:6459) +.setExitBlock ld [wNewTileBlockID], a lb bc, 0, 2 predef_jump ReplaceTileBlock -AgathaScript_76464: ; 76464 (1d:6464) +ResetAgathaScript: ; 76464 (1d:6464) xor a - ld [W_AGATHACURSCRIPT], a + ld [wAgathaCurScript], a ret AgathaScriptPointers: ; 76469 (1d:6469) @@ -40,7 +41,8 @@ AgathaScriptPointers: ; 76469 (1d:6469) AgathaScript4: ; 76473 (1d:6473) ret -AgathaScript_76474: ; 76474 (1d:6474) +AgathaScriptWalkIntoRoom: ; 76474 (1d:6474) +; Walk six steps upward. ld hl, wSimulatedJoypadStatesEnd ld a, D_UP ld [hli], a @@ -53,12 +55,12 @@ AgathaScript_76474: ; 76474 (1d:6474) ld [wSimulatedJoypadStatesIndex], a call StartSimulatingJoypadStates ld a, $3 - ld [W_AGATHACURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wAgathaCurScript], a + ld [wCurMapScript], a ret AgathaScript0: ; 76490 (1d:6490) - ld hl, CoordsData_764d1 + ld hl, AgathaEntranceCoords call ArePlayerCoordsInArray jp nc, CheckFightingMapTrainers xor a @@ -67,25 +69,25 @@ AgathaScript0: ; 76490 (1d:6490) 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: ; 764d1 (1d:64d1) +AgathaEntranceCoords: ; 764d1 (1d:64d1) db $0A,$04 db $0A,$05 db $0B,$04 @@ -99,20 +101,20 @@ AgathaScript3: ; 764da (1d:64da) call Delay3 xor a ld [wJoyIgnore], a - ld [W_AGATHACURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wAgathaCurScript], a + ld [wCurMapScript], a ret AgathaScript2: ; 764ed (1d:64ed) 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: ; 76505 (1d:6505) diff --git a/scripts/billshouse.asm b/scripts/billshouse.asm index 5d6d668f..8c800748 100755 --- a/scripts/billshouse.asm +++ b/scripts/billshouse.asm @@ -1,7 +1,7 @@ BillsHouseScript: ; 1e76a (7:676a) call BillsHouseScript_1e09e call EnableAutoTextBoxDrawing - ld a, [W_BILLSHOUSECURSCRIPT] + ld a, [wBillsHouseCurScript] ld hl, BillsHouseScriptPointers call JumpTable ret @@ -35,7 +35,7 @@ BillsHouseScript_1e09e: .asm_1e0b3 ld a, $9 .asm_1e0b5 - ld [W_BILLSHOUSECURSCRIPT], a + ld [wBillsHouseCurScript], a ret BillsHouseScript0: ; 1e782 (7:6782) @@ -49,7 +49,7 @@ BillsHouseScript0: ; 1e782 (7:6782) xor a ld [wJoyIgnore], a ld a, $1 - ld [W_BILLSHOUSECURSCRIPT], a + ld [wBillsHouseCurScript], a ret BillsHouseScript1: ; 1e783 (7:6783) @@ -72,7 +72,7 @@ BillsHouseScript2: ld [H_SPRITEINDEX], a call MoveSprite ld a, $3 - ld [W_BILLSHOUSECURSCRIPT], a + ld [wBillsHouseCurScript], a ret MovementData_1e79c: ; 1e79c (7:679c) @@ -112,7 +112,7 @@ BillsHouseScript3: ; 1e7a6 (7:67a6) ld [wJoyIgnore], a SetEvent EVENT_BILL_SAID_USE_CELL_SEPARATOR ld a, $4 - ld [W_BILLSHOUSECURSCRIPT], a + ld [wBillsHouseCurScript], a ret PikachuMovementData_1e14d: @@ -138,7 +138,7 @@ BillsHouseScript4: ; 1e7c5 (7:67c5) ld a, $fc ld [wJoyIgnore], a ld a, $5 - ld [W_BILLSHOUSECURSCRIPT], a + ld [wBillsHouseCurScript], a ret BillsHouseScript5: @@ -182,7 +182,7 @@ BillsHouseScript5: ld de, MovementData_1e807 call MoveSprite ld a, $6 - ld [W_BILLSHOUSECURSCRIPT], a + ld [wBillsHouseCurScript], a ret MovementData_1e807: ; 1e807 (7:6807) @@ -205,7 +205,7 @@ BillsHouseScript6: ; 1e80d (7:680d) 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: @@ -222,7 +222,7 @@ BillsHouseScript7: ld [wSimulatedJoypadStatesIndex], a call StartSimulatingJoypadStates ld a, $8 - ld [W_BILLSHOUSECURSCRIPT], a + ld [wBillsHouseCurScript], a ret RLE_1e219: @@ -248,7 +248,7 @@ BillsHouseScript8: ld [hSpriteIndexOrTextID], a call DisplayTextID ld a, $9 - ld [W_BILLSHOUSECURSCRIPT], a + ld [wBillsHouseCurScript], a ret BillsHouseScript9: ; 1e827 (7:6827) diff --git a/scripts/billshouse2.asm b/scripts/billshouse2.asm index 87a39969..a93f5558 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: ; 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 959fb23e..baea53d0 100755 --- a/scripts/blueshouse.asm +++ b/scripts/blueshouse.asm @@ -14,7 +14,7 @@ BluesHouseScript0: ; 19b4b (6:5b4b) ; trigger the next script ld a, 1 - ld [W_BLUESHOUSECURSCRIPT], a + ld [wBluesHouseCurScript], a BluesHouseScript1: ; 19b56 (6:5b56) ret @@ -65,7 +65,8 @@ DaisyOfferMapText: ; 19baf (6:5baf) GotMapText: ; 19bb4 (6:5bb4) TX_FAR _GotMapText - db $11, "@" + sound0x0A + db "@" DaisyBagFullText: ; 19bba (6:5bba) TX_FAR _DaisyBagFullText diff --git a/scripts/bruno.asm b/scripts/bruno.asm index 5318ecba..416a1757 100755 --- a/scripts/bruno.asm +++ b/scripts/bruno.asm @@ -1,33 +1,34 @@ BrunoScript: ; 762d6 (1d:62d6) - 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: ; 762ec (1d:62ec) - ld hl, wd126 +BrunoShowOrHideExitBlock: ; 762ec (1d:62ec) +; 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: ; 76302 (1d:6302) +.setExitBlock ld [wNewTileBlockID], a lb bc, 0, 2 predef_jump ReplaceTileBlock -BrunoScript_7630d: ; 7630d (1d:630d) +ResetBrunoScript: ; 7630d (1d:630d) xor a - ld [W_BRUNOCURSCRIPT], a + ld [wBrunoCurScript], a ret BrunoScriptPointers: ; 76312 (1d:6312) @@ -40,7 +41,8 @@ BrunoScriptPointers: ; 76312 (1d:6312) BrunoScript4: ; 7631c (1d:631c) ret -BrunoScript_7631d: ; 7631d (1d:631d) +BrunoScriptWalkIntoRoom: ; 7631d (1d:631d) +; Walk six steps upward. ld hl, wSimulatedJoypadStatesEnd ld a, D_UP ld [hli], a @@ -53,12 +55,12 @@ BrunoScript_7631d: ; 7631d (1d:631d) ld [wSimulatedJoypadStatesIndex], a call StartSimulatingJoypadStates ld a, $3 - ld [W_BRUNOCURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wBrunoCurScript], a + ld [wCurMapScript], a ret BrunoScript0: ; 76339 (1d:6339) - ld hl, CoordsData_7637a + ld hl, BrunoEntranceCoords call ArePlayerCoordsInArray jp nc, CheckFightingMapTrainers xor a @@ -67,25 +69,25 @@ BrunoScript0: ; 76339 (1d:6339) 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: ; 7637a (1d:637a) +BrunoEntranceCoords: ; 7637a (1d:637a) db $0A,$04 db $0A,$05 db $0B,$04 @@ -99,15 +101,15 @@ BrunoScript3: ; 76383 (1d:6383) call Delay3 xor a ld [wJoyIgnore], a - ld [W_BRUNOCURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wBrunoCurScript], a + ld [wCurMapScript], a ret BrunoScript2: ; 76396 (1d:6396) 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 233b38bd..998be7d8 100755 --- a/scripts/celadoncity.asm +++ b/scripts/celadoncity.asm @@ -1,7 +1,7 @@ CeladonCityScript: ; 19a43 (6:5a43) 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 0013be1b..a8454dbd 100755 --- a/scripts/celadongamecorner.asm +++ b/scripts/celadongamecorner.asm @@ -3,11 +3,11 @@ CeladonGameCornerScript: ; 48bbd (12:4bbd) call CeladonGameCornerScript_48bec call EnableAutoTextBoxDrawing ld hl, CeladonGameCornerScriptPointers - ld a, [W_CELADONGAMECORNERCURSCRIPT] + ld a, [wCeladonGameCornerCurScript] jp JumpTable CeladonGameCornerScript_48bcf: ; 48bcf (12:4bcf) - ld hl, wd126 + ld hl, wCurrentMapScriptFlags bit 6, [hl] res 6, [hl] ret z @@ -24,7 +24,7 @@ CeladonGameCornerScript_48bcf: ; 48bcf (12:4bcf) ret CeladonGameCornerScript_48bec: ; 48bec (12:4bec) - ld hl, wd126 + ld hl, wCurrentMapScriptFlags bit 5, [hl] res 5, [hl] ret z @@ -38,8 +38,8 @@ CeladonGameCornerScript_48bec: ; 48bec (12:4bec) CeladonGameCornerScript_48c07: ; 48c07 (12:4c07) xor a ld [wJoyIgnore], a - ld [W_CELADONGAMECORNERCURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wCeladonGameCornerCurScript], a + ld [wCurMapScript], a ret CeladonGameCornerScriptPointers: ; 48c12 (12:4c12) @@ -82,7 +82,7 @@ CeladonGameCornerScript1: ; 48c19 (12:4c19) ld [H_SPRITEINDEX], a call MoveSprite ld a, $2 - ld [W_CELADONGAMECORNERCURSCRIPT], a + ld [wCeladonGameCornerCurScript], a ret MovementData_48c5a: ; 48c5a (12:4c5a) @@ -113,11 +113,11 @@ CeladonGameCornerScript2: ; 48c69 (12:4c69) 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: ; 48c8a (12:4c8a) @@ -429,7 +429,7 @@ CeladonGameCornerText11: ; 48e9d (12:4e9d) ld [hJoyPressed], a ld [hJoyReleased], a ld a, $1 - ld [W_CELADONGAMECORNERCURSCRIPT], a + ld [wCeladonGameCornerCurScript], a jp TextScriptEnd CeladonGameCornerText_48ece: ; 48ece (12:4ece) diff --git a/scripts/celadongym.asm b/scripts/celadongym.asm index 6588b25e..a9c017d0 100755 --- a/scripts/celadongym.asm +++ b/scripts/celadongym.asm @@ -1,14 +1,14 @@ CeladonGymScript: ; 4890a (12:490a) - 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: ; 48927 (12:4927) @@ -25,8 +25,8 @@ Gym4LeaderName: ; 4893d (12:493d) CeladonGymText_48943: ; 48943 (12:4943) xor a ld [wJoyIgnore], a - ld [W_CELADONGYMCURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wCeladonGymCurScript], a + ld [wCurMapScript], a ret CeladonGymScriptPointers: ; 4894e (12:494e) @@ -178,8 +178,8 @@ CeladonGymText1: ; 48a11 (12:4a11) 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 6d901613..e693d9fe 100755 --- a/scripts/celadonmartelevator.asm +++ b/scripts/celadonmartelevator.asm @@ -1,5 +1,5 @@ CeladonMartElevatorScript: ; 48600 (12:4600) - 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 59b0e525..0f4e9dce 100755 --- a/scripts/ceruleancity.asm +++ b/scripts/ceruleancity.asm @@ -1,13 +1,13 @@ CeruleanCityScript: ; 19480 (6:5480) call EnableAutoTextBoxDrawing ld hl, CeruleanCityScriptPointers - ld a, [W_CERULEANCITYCURSCRIPT] + ld a, [wCeruleanCityCurScript] jp JumpTable CeruleanCityScript_1948c: ; 1948c (6:548c) 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: ; 194a7 (6:54a7) call DisplayTextID xor a ld [wJoyIgnore], a - ld [W_CERULEANCITYCURSCRIPT], a + ld [wCeruleanCityCurScript], a ret CeruleanCityScript0: ; 194c8 (6:54c8) @@ -91,7 +91,7 @@ CeruleanCityScript0: ; 194c8 (6:54c8) ld [H_SPRITEINDEX], a call MoveSprite ld a, $1 - ld [W_CERULEANCITYCURSCRIPT], a + ld [wCeruleanCityCurScript], a ret CeruleanCityCoords1: ; 1954f (6:554f) @@ -140,7 +140,7 @@ CeruleanCityScript1: ; 19567 (6:5567) ld [hJoyHeld], a call CeruleanCityScript_1955d ld a, $2 - ld [W_CERULEANCITYCURSCRIPT], a + ld [wCeruleanCityCurScript], a ret CeruleanCityScript2: ; 195b1 (6:55b1) @@ -171,7 +171,7 @@ CeruleanCityScript2: ; 195b1 (6:55b1) ld [H_SPRITEINDEX], a call MoveSprite ld a, $3 - ld [W_CERULEANCITYCURSCRIPT], a + ld [wCeruleanCityCurScript], a ret CeruleanCityMovement3: ; 19600 (6:5600) @@ -205,7 +205,7 @@ CeruleanCityScript3: ; 19610 (6:5610) ld [wJoyIgnore], a call PlayDefaultMusic ld a, $0 - ld [W_CERULEANCITYCURSCRIPT], a + ld [wCeruleanCityCurScript], a ret CeruleanCityTextPointers: ; 1962d (6:562d) @@ -275,7 +275,7 @@ CeruleanCityText2: ; 1967c (6:567c) 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 f1ef4c43..d6abf4a1 100755 --- a/scripts/ceruleangym.asm +++ b/scripts/ceruleangym.asm @@ -1,14 +1,14 @@ CeruleanGymScript: ; 5c6b3 (17:46b3) - 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: ; 5c6d0 (17:46d0) @@ -25,8 +25,8 @@ Gym2LeaderName: ; 5c6e7 (17:46e7) CeruleanGymScript_5c6ed: ; 5c6ed (17:46ed) xor a ld [wJoyIgnore], a - ld [W_CERULEANGYMCURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wCeruleanGymCurScript], a + ld [wCurMapScript], a ret CeruleanGymScriptPointers: ; 5c6f8 (17:46f8) @@ -132,7 +132,7 @@ CeruleanGymText1: ; 5c771 (17:4771) 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 8ae77507..16fd7d7b 100755 --- a/scripts/cinnabargym.asm +++ b/scripts/cinnabargym.asm @@ -2,11 +2,11 @@ CinnabarGymScript: ; 7574a (1d:574a) call CinnabarGymScript_75759 call EnableAutoTextBoxDrawing ld hl, CinnabarGymScriptPointers - ld a, [W_CINNABARGYMCURSCRIPT] + ld a, [wCinnabarGymCurScript] jp JumpTable CinnabarGymScript_75759: ; 75759 (1d:5759) - ld hl, wd126 + ld hl, wCurrentMapScriptFlags bit 6, [hl] res 6, [hl] push hl @@ -30,8 +30,8 @@ Gym7LeaderName: ; 7578b (1d:578b) CinnabarGymScript_75792: ; 75792 (1d:5792) 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: ; 757ae (1d:57ae) .asm_757cb call MoveSprite ld a, $1 - ld [W_CINNABARGYMCURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wCinnabarGymCurScript], a + ld [wCurMapScript], a ret MovementData_757d7: ; 757d7 (1d:57d7) @@ -160,8 +160,8 @@ CinnabarGymScript2: ; 757f6 (1d:57f6) 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: ; 75857 (1d:5857) ; 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: ; 758b7 (1d:58b7) .asm_758d4 ld a, $3 .asm_758d6 - ld [W_CINNABARGYMCURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wCinnabarGymCurScript], a + ld [wCurMapScript], a jp TextScriptEnd CinnabarGymText1: ; 758df (1d:58df) diff --git a/scripts/cinnabarisland.asm b/scripts/cinnabarisland.asm index 3a2e9a2b..a0fa4172 100755 --- a/scripts/cinnabarisland.asm +++ b/scripts/cinnabarisland.asm @@ -1,11 +1,11 @@ CinnabarIslandScript: ; 1ca19 (7:4a19) 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: ; 1ca34 (7:4a34) @@ -38,7 +38,7 @@ CinnabarIslandScript0: ; 1ca38 (7:4a38) ld [wSpriteStateData1 + 9], a ld [wJoyIgnore], a ld a, $1 - ld [W_CINNABARISLANDCURSCRIPT], a + ld [wCinnabarIslandCurScript], a ret CinnabarIslandScript1: ; 1ca73 (7:4a73) @@ -47,7 +47,7 @@ CinnabarIslandScript1: ; 1ca73 (7:4a73) ret nz call Delay3 ld a, $0 - ld [W_CINNABARISLANDCURSCRIPT], a + ld [wCinnabarIslandCurScript], a ret CinnabarIslandTextPointers: ; 1ca81 (7:4a81) diff --git a/scripts/fanclub.asm b/scripts/fanclub.asm index a03fd2d7..80f8247f 100755 --- a/scripts/fanclub.asm +++ b/scripts/fanclub.asm @@ -1,7 +1,7 @@ FanClubScript: ; 59b70 (16:5b70) call EnableAutoTextBoxDrawing ld hl, FanClubScriptPointers - ld a, [W_FANCLUBCURSCRIPT] + ld a, [wFanClubCurScript] call JumpTable ret @@ -39,7 +39,7 @@ FanClubScript_59a44: callab Func_fce73 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 101701b1..fb3ea5b4 100755 --- a/scripts/fightingdojo.asm +++ b/scripts/fightingdojo.asm @@ -2,16 +2,16 @@ FightingDojoScript: ; 5cd5d (17:4d5d) 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: ; 5cd70 (17:4d70) xor a ld [wJoyIgnore], a - ld [W_FIGHTINGDOJOCURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wFightingDojoCurScript], a + ld [wCurMapScript], a ret FightingDojoScriptPointers: ; 5cd7b (17:4d7b) @@ -76,8 +76,8 @@ FightingDojoScript3: ; 5cdc6 (17:4dc6) call DisplayTextID xor a ld [wJoyIgnore], a - ld [W_FIGHTINGDOJOCURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wFightingDojoCurScript], a + ld [wCurMapScript], a ret FightingDojoTextPointers: ; 5ce03 (17:4e03) @@ -148,8 +148,8 @@ FightingDojoText1: ; 5ce44 (17:4e44) 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 70f9fff0..54c3ae1a 100755 --- a/scripts/fuchsiagym.asm +++ b/scripts/fuchsiagym.asm @@ -3,13 +3,13 @@ FuchsiaGymScript: ; 7543d (1d:543d) 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: ; 75453 (1d:5453) - ld hl, wd126 + ld hl, wCurrentMapScriptFlags bit 6, [hl] res 6, [hl] ret z @@ -26,8 +26,8 @@ Gym5LeaderName: ; 75472 (1d:5472) FuchsiaGymScript_75477: ; 75477 (1d:5477) xor a ld [wJoyIgnore], a - ld [W_FUCHSIAGYMCURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wFuchsiaGymCurScript], a + ld [wCurMapScript], a ret FuchsiaGymScriptPointers: ; 75482 (1d:5482) @@ -171,7 +171,7 @@ FuchsiaGymText1: ; 75534 (1d:5534) 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 290bd753..7babb73d 100755 --- a/scripts/gary.asm +++ b/scripts/gary.asm @@ -1,14 +1,14 @@ GaryScript: ; 75f1d (1d:5f1d) call EnableAutoTextBoxDrawing ld hl, GaryScriptPointers - ld a, [W_GARYCURSCRIPT] + ld a, [wGaryCurScript] call JumpTable ret -GaryScript_75f29: ; 75f29 (1d:5f29) +ResetGaryScript: ; 75f29 (1d:5f29) xor a ld [wJoyIgnore], a - ld [W_GARYCURSCRIPT], a + ld [wGaryCurScript], a ret GaryScriptPointers: ; 75f31 (1d:5f31) @@ -31,16 +31,16 @@ GaryScript1: ; 75f48 (1d:5f48) 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: ; 75f63 (1d:5f63) +GaryEntrance_RLEMovement: ; 75f63 (1d:5f63) db D_UP, 1 db D_RIGHT, 1 db D_UP, 3 @@ -54,7 +54,7 @@ GaryScript2: ; 75f6a (1d:5f6a) 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: ; 75f6a (1d:5f6a) 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: ; 75fbb (1d:5fbb) 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: ; 75fbb (1d:5fbb) ld [H_SPRITEINDEX], a call SetSpriteMovementBytesToFF ld a, $4 - ld [W_GARYCURSCRIPT], a + ld [wGaryCurScript], a ret GaryScript4: ; 75fe4 (1d:5fe4) @@ -105,7 +105,7 @@ GaryScript4: ; 75fe4 (1d:5fe4) 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: ; 75fe4 (1d:5fe4) ld [wMissableObjectIndex], a predef ShowObject ld a, $5 - ld [W_GARYCURSCRIPT], a + ld [wGaryCurScript], a ret -MovementData_76014: ; 76014 (1d:6014) +OakEntranceAfterVictoryMovement: ; 76014 (1d:6014) db NPC_MOVEMENT_UP db NPC_MOVEMENT_UP db NPC_MOVEMENT_UP @@ -144,7 +144,7 @@ GaryScript5: ; 7601a (1d:601a) ld [hSpriteIndexOrTextID], a call GaryScript_760c8 ld a, $6 - ld [W_GARYCURSCRIPT], a + ld [wGaryCurScript], a ret GaryScript6: ; 76047 (1d:6047) @@ -157,7 +157,7 @@ GaryScript6: ; 76047 (1d:6047) ld [hSpriteIndexOrTextID], a call GaryScript_760c8 ld a, $7 - ld [W_GARYCURSCRIPT], a + ld [wGaryCurScript], a ret GaryScript7: ; 7605f (1d:605f) @@ -169,15 +169,15 @@ GaryScript7: ; 7605f (1d:605f) 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: ; 76080 (1d:6080) +OakExitGaryRoomMovement: ; 76080 (1d:6080) db NPC_MOVEMENT_UP db NPC_MOVEMENT_UP db $FF @@ -190,23 +190,23 @@ GaryScript8: ; 76083 (1d:6083) ld [wMissableObjectIndex], a predef HideObject ld a, $9 - ld [W_GARYCURSCRIPT], a + ld [wGaryCurScript], a ret GaryScript9: ; 76099 (1d:6099) 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: ; 760b4 (1d:60b4) +WalkToHallOfFame_RLEMovment: ; 760b4 (1d:60b4) db D_UP, 4 db D_LEFT, 1 db $ff @@ -218,7 +218,7 @@ GaryScript10: ; 760b9 (1d:60b9) xor a ld [wJoyIgnore], a ld a, $0 - ld [W_GARYCURSCRIPT], a + ld [wGaryCurScript], a ret GaryScript_760c8: ; 760c8 (1d:60c8) @@ -239,23 +239,23 @@ GaryTextPointers: ; 760d6 (1d:60d6) GaryText1: ; 760e0 (1d:60e0) 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: ; 760f4 (1d:60f4) - TX_FAR _GaryText_760f4 +GaryChampionIntroText: ; 760f4 (1d:60f4) + TX_FAR _GaryChampionIntroText db "@" -GaryText_760f9: ; 760f9 (1d:60f9) - TX_FAR _GaryText_760f9 +GaryDefeatedText: ; 760f9 (1d:60f9) + TX_FAR _GaryDefeatedText db "@" -GaryText_760fe: ; 760fe (1d:60fe) - TX_FAR _GaryText_760fe +GaryVictoryText: ; 760fe (1d:60fe) + TX_FAR _GaryVictoryText db "@" GaryText_76103: ; 76103 (1d:6103) @@ -268,7 +268,7 @@ GaryText2: ; 76108 (1d:6108) GaryText3: ; 7610d (1d:610d) 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 0f975673..b5bc9ce8 100755 --- a/scripts/halloffameroom.asm +++ b/scripts/halloffameroom.asm @@ -1,13 +1,13 @@ HallofFameRoomScript: ; 5a49e (16:649e) call EnableAutoTextBoxDrawing ld hl, HallofFameRoomScriptPointers - ld a, [W_HALLOFFAMEROOMCURSCRIPT] + ld a, [wHallOfFameRoomCurScript] jp JumpTable HallofFameRoomScript_5a4aa: ; 5a4aa (16:64aa) xor a ld [wJoyIgnore], a - ld [W_HALLOFFAMEROOMCURSCRIPT], a + ld [wHallOfFameRoomCurScript], a ret HallofFameRoomScriptPointers: ; 5a4b2 (16:64b2) @@ -33,25 +33,25 @@ HallofFameRoomScript2: ; 5a4bb (16:64bb) 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: ; 5a50d (16:650d) ld [wSimulatedJoypadStatesIndex], a call StartSimulatingJoypadStates ld a, $1 - ld [W_HALLOFFAMEROOMCURSCRIPT], a + ld [wHallOfFameRoomCurScript], a ret RLEMovement5a528: ; 5a528 (16:6528) @@ -98,7 +98,7 @@ HallofFameRoomScript1: ; 5a52b (16:652b) ld [wMissableObjectIndex], a predef HideObject ld a, $2 - ld [W_HALLOFFAMEROOMCURSCRIPT], a + ld [wHallOfFameRoomCurScript], a ret HallofFameRoomTextPointers: ; 5a56a (16:656a) diff --git a/scripts/indigoplateaulobby.asm b/scripts/indigoplateaulobby.asm index c639adb7..bc82a4c6 100755 --- a/scripts/indigoplateaulobby.asm +++ b/scripts/indigoplateaulobby.asm @@ -1,7 +1,7 @@ IndigoPlateauLobbyScript: ; 19c5b (6:5c5b) 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 dab07824..7eb6bae8 100755 --- a/scripts/lab4.asm +++ b/scripts/lab4.asm @@ -74,7 +74,7 @@ Lab4Text1: ; 75d6c (1d:5d6c) 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 564e7ef1..948787cc 100755 --- a/scripts/lance.asm +++ b/scripts/lance.asm @@ -1,42 +1,44 @@ LanceScript: ; 5a2ae (16:62ae) - 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: ; 5a2c4 (16:62c4) - ld hl, wd126 +LanceShowOrHideEntranceBlocks: ; 5a2c4 (16:62c4) + 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: ; 5a2f5 (16:62f5) +ResetLanceScript: ; 5a2f5 (16:62f5) xor a - ld [W_LANCECURSCRIPT], a + ld [wLanceCurScript], a ret LanceScriptPointers: ; 5a2fa (16:62fa) @@ -52,29 +54,29 @@ LanceScript4: ; 5a304 (16:6304) LanceScript0: ; 5a305 (16:6305) 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: ; 5a33e (16:633e) +LanceTriggerMovementCoords: ; 5a33e (16:633e) db $01,$05 db $02,$06 db $0B,$05 @@ -86,26 +88,27 @@ LanceScript2: ; 5a349 (16:6349) call EndTrainerBattle ld a, [wIsInBattle] cp $ff - jp z, LanceScript_5a2f5 + jp z, ResetLanceScript ld a, $1 ld [hSpriteIndexOrTextID], a jp DisplayTextID -LanceScript_5a35b: ; 5a35b (16:635b) +WalkToLance: ; 5a35b (16:635b) +; 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: ; 5a379 (16:6379) +WalkToLance_RLEList: ; 5a379 (16:6379) db D_UP, $0D db D_LEFT, $0C db D_DOWN, $07 @@ -119,8 +122,8 @@ LanceScript3: ; 5a382 (16:6382) call Delay3 xor a ld [wJoyIgnore], a - ld [W_LANCECURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wLanceCurScript], a + ld [wCurMapScript], a ret LanceTextPointers: ; 5a395 (16:6395) diff --git a/scripts/lorelei.asm b/scripts/lorelei.asm index d50fc1dc..12784964 100755 --- a/scripts/lorelei.asm +++ b/scripts/lorelei.asm @@ -1,34 +1,35 @@ LoreleiScript: ; 7617b (1d:617b) - 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: ; 76191 (1d:6191) - ld hl, wd126 +LoreleiShowOrHideExitBlock: ; 76191 (1d:6191) +; 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: ; 761b6 (1d:61b6) +ResetLoreleiScript: ; 761b6 (1d:61b6) xor a - ld [W_LORELEICURSCRIPT], a + ld [wLoreleiCurScript], a ret LoreleiScriptPointers: ; 761bb (1d:61bb) @@ -41,7 +42,8 @@ LoreleiScriptPointers: ; 761bb (1d:61bb) LoreleiScript4: ; 761c5 (1d:61c5) ret -LoreleiScript_761c6: ; 761c6 (1d:61c6) +LoreleiScriptWalkIntoRoom: ; 761c6 (1d:61c6) +; Walk six steps upward. ld hl, wSimulatedJoypadStatesEnd ld a, D_UP ld [hli], a @@ -54,12 +56,12 @@ LoreleiScript_761c6: ; 761c6 (1d:61c6) ld [wSimulatedJoypadStatesIndex], a call StartSimulatingJoypadStates ld a, $3 - ld [W_LORELEICURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wLoreleiCurScript], a + ld [wCurMapScript], a ret LoreleiScript0: ; 761e2 (1d:61e2) - ld hl, CoordsData_76223 + ld hl, LoreleiEntranceCoords call ArePlayerCoordsInArray jp nc, CheckFightingMapTrainers xor a @@ -68,25 +70,25 @@ LoreleiScript0: ; 761e2 (1d:61e2) 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: ; 76223 (1d:6223) +LoreleiEntranceCoords: ; 76223 (1d:6223) db $0A,$04 db $0A,$05 db $0B,$04 @@ -100,14 +102,15 @@ LoreleiScript3: ; 7622c (1d:622c) call Delay3 xor a ld [wJoyIgnore], a - ld [W_LORELEICURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wLoreleiCurScript], a + ld [wCurMapScript], a ret + LoreleiScript2: ; 7623f (1d:623f) 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 bbfb0a0b..d342c295 100755 --- a/scripts/mansion1.asm +++ b/scripts/mansion1.asm @@ -3,13 +3,13 @@ Mansion1Script: ; 442af (11:42af) 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: ; 442c5 (11:42c5) - ld hl, wd126 + ld hl, wCurrentMapScriptFlags bit 5, [hl] res 5, [hl] ret z @@ -106,7 +106,7 @@ Mansion1Text4: ; 4435a (11:435a) 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 22bc2b12..7fe09e4b 100755 --- a/scripts/mansion2.asm +++ b/scripts/mansion2.asm @@ -3,13 +3,13 @@ Mansion2Script: ; 51fd8 (14:5fd8) 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: ; 51fee (14:5fee) - ld hl, wd126 + ld hl, wCurrentMapScriptFlags bit 5, [hl] res 5, [hl] ret z @@ -112,7 +112,7 @@ Mansion2Text5: ; 52087 (14:6087) 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 e49667ef..049bfeef 100755 --- a/scripts/mansion3.asm +++ b/scripts/mansion3.asm @@ -3,13 +3,13 @@ Mansion3Script: ; 521ee (14:61ee) 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: ; 52204 (14:6204) - 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 59ee3704..c506a407 100755 --- a/scripts/mansion4.asm +++ b/scripts/mansion4.asm @@ -3,13 +3,13 @@ Mansion4Script: ; 523b9 (14:63b9) 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: ; 523cf (14:63cf) - 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 a649481c..4c87ee21 100755 --- a/scripts/mtmoon1.asm +++ b/scripts/mtmoon1.asm @@ -2,9 +2,9 @@ MtMoon1Script: ; 499c8 (12:59c8) 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: ; 499db (12:59db) diff --git a/scripts/mtmoon3.asm b/scripts/mtmoon3.asm index 8aee239c..1c9bb582 100755 --- a/scripts/mtmoon3.asm +++ b/scripts/mtmoon3.asm @@ -2,9 +2,9 @@ MtMoon3Script: ; 49d0b (12:5d0b) 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: ; 49d58 (12:5d58) 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 75c0d74e..8da518cf 100755 --- a/scripts/museum1f.asm +++ b/scripts/museum1f.asm @@ -4,7 +4,7 @@ Museum1FScript: ; 5c0f7 (17:40f7) 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 6fd540d0..5b10668e 100755 --- a/scripts/oakslab.asm +++ b/scripts/oakslab.asm @@ -6,7 +6,7 @@ OaksLabScript: ; 1cb0e (7:4b0e) xor a ld [wDoNotWaitForButtonPressAfterDisplayingText], a ld hl, OaksLabScriptPointers - ld a, [W_OAKSLABCURSCRIPT] + ld a, [wOaksLabCurScript] call JumpTable ret @@ -48,7 +48,7 @@ OaksLabScript0: ; 1cb4e (7:4b4e) res 4, [hl] ld a, $1 - ld [W_OAKSLABCURSCRIPT], a + ld [wOaksLabCurScript], a ret OaksLabScript1: ; 1cb6e (7:4b6e) @@ -58,7 +58,7 @@ OaksLabScript1: ; 1cb6e (7:4b6e) call MoveSprite ld a, $2 - ld [W_OAKSLABCURSCRIPT], a + ld [wOaksLabCurScript], a ret OakEntryMovement: ; 1cb7e (7:4b7e) @@ -79,7 +79,7 @@ OaksLabScript2: ; 1cb82 (7:4b82) predef ShowObject ld a, $3 - ld [W_OAKSLABCURSCRIPT], a + ld [wOaksLabCurScript], a ret OaksLabScript3: ; 1cba2 (7:4ba2) @@ -102,7 +102,7 @@ OaksLabScript3: ; 1cba2 (7:4ba2) call SetSpriteFacingDirectionAndDelay ld a, $4 - ld [W_OAKSLABCURSCRIPT], a + ld [wOaksLabCurScript], a ret PlayerEntryMovementRLE: ; 1cbcf (7:4bcf) @@ -125,7 +125,7 @@ OaksLabScript4: ; 1cbd2 (7:445f) call PlayDefaultMusic ld a, $5 - ld [W_OAKSLABCURSCRIPT], a + ld [wOaksLabCurScript], a ret OaksLabScript5: ; 1cbfd (7:4bfd) @@ -156,7 +156,7 @@ OaksLabScript5: ; 1cbfd (7:4bfd) ld [wJoyIgnore], a ld a, $6 - ld [W_OAKSLABCURSCRIPT], a + ld [wOaksLabCurScript], a ret OaksLabScript6: ; 1cc36 (7:4c36) @@ -186,7 +186,7 @@ OaksLabScript6: ; 1cc36 (7:4c36) ld [wPlayerMovingDirection], a ld a, $7 - ld [W_OAKSLABCURSCRIPT], a + ld [wOaksLabCurScript], a ret OaksLabScript7: ; 1cc72 (7:4c72) @@ -196,7 +196,7 @@ OaksLabScript7: ; 1cc72 (7:4c72) call Delay3 ld a, $6 - ld [W_OAKSLABCURSCRIPT], a + ld [wOaksLabCurScript], a ret OaksLabScript8: ; 1cc80 (7:4c80) @@ -205,7 +205,7 @@ OaksLabScript8: ; 1cc80 (7:4c80) ld de, .SonyPushesPlayerAwayFromEeveeBall call MoveSprite ld a, $9 - ld [W_OAKSLABCURSCRIPT], a + ld [wOaksLabCurScript], a ret .SonyPushesPlayerAwayFromEeveeBall @@ -228,7 +228,7 @@ OaksLabScript9: ; 1cd00 (7:4d00) ld [hSpriteFacingDirection], a call SetSpriteFacingDirectionAndDelay ld a, 1 - ld [W_RIVALSTARTER], a + ld [wRivalStarter], a ld a, EEVEE ld [wd11e], a call GetMonName @@ -239,7 +239,7 @@ OaksLabScript9: ; 1cd00 (7:4d00) call DisplayTextID ld a, $a - ld [W_OAKSLABCURSCRIPT], a + ld [wOaksLabCurScript], a ret .asm_1c564 @@ -278,7 +278,7 @@ OaksLabScript10: ; 1cd6d (7:4d6d) .asm_1c5a6 call StartSimulatingJoypadStates ld a, $b - ld [W_OAKSLABCURSCRIPT], a + ld [wOaksLabCurScript], a ret OaksLabRLE_PlayerWalksToOak: @@ -299,7 +299,7 @@ OaksLabScript11: ld [wJoyIgnore], a ld a, $c - ld [W_OAKSLABCURSCRIPT], a + ld [wOaksLabCurScript], a ret OaksLabScript12: @@ -334,7 +334,7 @@ OaksLabScript12: ld [hSpriteIndexOrTextID], a call MoveSprite ld a, $d - ld [W_OAKSLABCURSCRIPT], a + ld [wOaksLabCurScript], a ret OaksLabScript13: @@ -359,7 +359,7 @@ OaksLabScript13: ld a, PLAYER_DIR_UP ld [wPlayerMovingDirection], a ld a, $e - ld [W_OAKSLABCURSCRIPT], a + ld [wOaksLabCurScript], a ret OaksLabScript14: @@ -377,7 +377,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 @@ -395,7 +395,7 @@ OaksLabScript14: ld hl, wd74b set 3, [hl] ld a, $f - ld [W_OAKSLABCURSCRIPT], a + ld [wOaksLabCurScript], a ret OaksLabScript15: @@ -420,7 +420,7 @@ OaksLabScript15: .asm_1c6bd ld [wNPCMovementDirections], a ld a, $10 - ld [W_OAKSLABCURSCRIPT], a + ld [wOaksLabCurScript], a ret .OaksLabMovement_RivalWalksOut1 @@ -444,7 +444,7 @@ OaksLabScript16: predef HideObject call PlayDefaultMusic ld a, $11 - ld [W_OAKSLABCURSCRIPT], a + ld [wOaksLabCurScript], a ret .asm_1c6ed @@ -481,7 +481,7 @@ OaksLabScript17: ld [hSpriteIndexOrTextID], a call DisplayTextID ld a, $12 - ld [W_OAKSLABCURSCRIPT], a + ld [wOaksLabCurScript], a ret OaksLabScript18: @@ -491,7 +491,7 @@ OaksLabScript18: xor a ld [wJoyIgnore], a ld a, $16 - ld [W_OAKSLABCURSCRIPT], a + ld [wOaksLabCurScript], a ret OaksLabScript19: @@ -521,7 +521,7 @@ OaksLabScript19: ld de, wNPCMovementDirections2 call MoveSprite ld a, $14 - ld [W_OAKSLABCURSCRIPT], a + ld [wOaksLabCurScript], a ret OaksLabScript_1c78e: @@ -585,7 +585,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 @@ -607,7 +607,7 @@ OaksLabScript20: ld de, wNPCMovementDirections2 call MoveSprite ld a, $15 - ld [W_OAKSLABCURSCRIPT], a + ld [wOaksLabCurScript], a ret OaksLabScript21: @@ -627,7 +627,7 @@ OaksLabScript21: xor a ld [wJoyIgnore], a ld a, $16 - ld [W_OAKSLABCURSCRIPT], a + ld [wOaksLabCurScript], a ret OaksLabScript22: @@ -803,7 +803,7 @@ OaksLabScript_1c9ac: ld [wWhichEmotionBubble], a predef EmotionBubble ld a, $8 - ld [W_OAKSLABCURSCRIPT], a + ld [wOaksLabCurScript], a jp TextScriptEnd OaksLabText3: @@ -865,7 +865,7 @@ OaksLabText3: call PrintText call OaksLabScript_1c897 ld a, $13 - ld [W_OAKSLABCURSCRIPT], a + ld [wOaksLabCurScript], a jr .asm_1ca6f .asm_1ca4a @@ -1027,7 +1027,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 0b383110..27bae365 100755 --- a/scripts/pallettown.asm +++ b/scripts/pallettown.asm @@ -5,7 +5,7 @@ PalletTownScript: ; 18e5b (6:4e5b) .next call EnableAutoTextBoxDrawing ld hl, PalletTownScriptPointers - ld a, [W_PALLETTOWNCURSCRIPT] + ld a, [wPalletTownCurScript] jp JumpTable PalletTownScriptPointers: ; 18e73 (6:4e73) @@ -47,7 +47,7 @@ PalletTownScript0: ; 18e81 (6:4e81) ; trigger the next script ld a, 1 - ld [W_PALLETTOWNCURSCRIPT], a + ld [wPalletTownCurScript], a ret PalletTownScript1: ; 18eb2 (6:4eb2) @@ -75,7 +75,7 @@ PalletTownScript1: ; 18eb2 (6:4eb2) ld a, SPRITE_FACING_UP ld [wSpriteStateData1 + 1 * $10 + 9], a ld a, 2 - ld [W_PALLETTOWNCURSCRIPT], a + ld [wPalletTownCurScript], a ret PalletTownScript2: ; 18ed2 (6:4ed2) @@ -98,7 +98,7 @@ PalletTownScript2: ; 18ed2 (6:4ed2) ; trigger the next script ld a, 3 - ld [W_PALLETTOWNCURSCRIPT], a + ld [wPalletTownCurScript], a ret PalletTownScript3: ; 18f12 (6:4f12) @@ -130,7 +130,7 @@ PalletTownScript3: ; 18f12 (6:4f12) ; trigger the next script ld a, 4 - ld [W_PALLETTOWNCURSCRIPT], a + ld [wPalletTownCurScript], a ret PalletTownScript4: ; 18f4b (6:4f4b) @@ -139,7 +139,7 @@ PalletTownScript4: ; 18f4b (6:4f4b) 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: ; 18f4b (6:4f4b) ; trigger the next script ld a, 5 - ld [W_PALLETTOWNCURSCRIPT], a + ld [wPalletTownCurScript], a ret PalletTownScript5: ; 18f56 (6:4f56) @@ -169,7 +169,7 @@ PalletTownScript5: ; 18f56 (6:4f56) ; trigger the next script ld a, 6 - ld [W_PALLETTOWNCURSCRIPT], a + ld [wPalletTownCurScript], a ret PalletTownScript6: ; 18f87 (6:4f87) @@ -186,7 +186,7 @@ PalletTownScript6: ; 18f87 (6:4f87) ; 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 1e9a922a..cece9d38 100755 --- a/scripts/pewtercity.asm +++ b/scripts/pewtercity.asm @@ -3,7 +3,7 @@ PewterCityScript: ; 192f5 (6:52f5) ld hl, wPreventBlackout res 7, [hl] ld hl, PewterCityScriptPointers - ld a, [W_PEWTERCITYCURSCRIPT] + ld a, [wPewterCityCurScript] call JumpTable ret @@ -18,7 +18,7 @@ PewterCityScriptPointers: ; 19307 (6:5307) PewterCityScript0: ; 19315 (6:5315) xor a - ld [W_MUSEUM1FCURSCRIPT], a + ld [wMuseum1FCurScript], a ResetEvent EVENT_BOUGHT_MUSEUM_TICKET call PewterCityScript_1925e ret @@ -76,7 +76,7 @@ PewterCityScript1: ; 19280 (6:5280) ld de, MovementData_PewterMuseumGuyExit call MoveSprite ld a, $2 - ld [W_PEWTERCITYCURSCRIPT], a + ld [wPewterCityCurScript], a ret MovementData_PewterMuseumGuyExit: ; 192ce (6:52ce) @@ -94,7 +94,7 @@ PewterCityScript2: ; 192d3 (6:52d3) ld [wMissableObjectIndex], a predef HideObject ld a, $3 - ld [W_PEWTERCITYCURSCRIPT], a + ld [wPewterCityCurScript], a ret PewterCityScript3: ; 192e9 (6:52e9) @@ -107,7 +107,7 @@ PewterCityScript3: ; 192e9 (6:52e9) xor a ld [wJoyIgnore], a ld a, $0 - ld [W_PEWTERCITYCURSCRIPT], a + ld [wPewterCityCurScript], a ret PewterCityScript4: ; 19305 (6:5305) @@ -141,7 +141,7 @@ PewterCityScript4: ; 19305 (6:5305) ld de, MovementData_PewterGymGuyExit call MoveSprite ld a, $5 - ld [W_PEWTERCITYCURSCRIPT], a + ld [wPewterCityCurScript], a ret MovementData_PewterGymGuyExit: ; 19353 (6:5353) @@ -160,7 +160,7 @@ PewterCityScript5: ; 19359 (6:5359) ld [wMissableObjectIndex], a predef HideObject ld a, $6 - ld [W_PEWTERCITYCURSCRIPT], a + ld [wPewterCityCurScript], a ret PewterCityScript6: ; 1936f (6:536f) @@ -173,7 +173,7 @@ PewterCityScript6: ; 1936f (6:536f) xor a ld [wJoyIgnore], a ld a, $0 - ld [W_PEWTERCITYCURSCRIPT], a + ld [wPewterCityCurScript], a ret PewterCityTextPointers: ; 1938b (6:538b) @@ -226,7 +226,7 @@ PewterCityText3: ; 193b1 (6:53b1) ld [wSpriteIndex], a call GetSpritePosition2 ld a, $1 - ld [W_PEWTERCITYCURSCRIPT], a + ld [wPewterCityCurScript], a .asm_193ee jp TextScriptEnd @@ -290,7 +290,7 @@ PewterCityText5: ; 19436 (6:5436) ld [wSpriteIndex], a call GetSpritePosition2 ld a, $4 - ld [W_PEWTERCITYCURSCRIPT], a + ld [wPewterCityCurScript], a jp TextScriptEnd PewterCityText_1945d: ; 1945d (6:545d) diff --git a/scripts/pewtergym.asm b/scripts/pewtergym.asm index 3e9ab693..444f5d87 100755 --- a/scripts/pewtergym.asm +++ b/scripts/pewtergym.asm @@ -1,14 +1,14 @@ PewterGymScript: ; 5c387 (17:4387) - 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: ; 5c3a4 (17:43a4) @@ -26,8 +26,8 @@ Gym1LeaderName: ; 5c3b9 (17:43b9) PewterGymScript_5c3bf: ; 5c3bf (17:43bf) xor a ld [wJoyIgnore], a - ld [W_PEWTERGYMCURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wPewterGymCurScript], a + ld [wCurMapScript], a ret PewterGymScriptPointers: ; 5c3ca (17:43ca) @@ -131,8 +131,8 @@ PewterGymText1: ; 5c44e (17:444e) 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 6b0c1f00..5e6a429d 100755 --- a/scripts/pokemontower2.asm +++ b/scripts/pokemontower2.asm @@ -1,14 +1,14 @@ PokemonTower2Script: ; 604f2 (18:44f2) call EnableAutoTextBoxDrawing ld hl, PokemonTower2ScriptPointers - ld a, [W_POKEMONTOWER2CURSCRIPT] + ld a, [wPokemonTower2CurScript] jp JumpTable PokemonTower2Script_604fe: ; 604fe (18:44fe) xor a ld [wJoyIgnore], a - ld [W_POKEMONTOWER2CURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wPokemonTower2CurScript], a + ld [wCurMapScript], a ret PokemonTower2ScriptPointers: ; 60509 (18:4509) @@ -78,8 +78,8 @@ PokemonTower2Script1: ; 60563 (18:4563) 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: ; 605a9 (18:45a9) @@ -115,8 +115,8 @@ PokemonTower2Script2: ; 605bb (18:45bb) ld [wJoyIgnore], a call PlayDefaultMusic ld a, $0 - ld [W_POKEMONTOWER2CURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wPokemonTower2CurScript], a + ld [wCurMapScript], a ret PokemonTower2TextPointers: ; 605db (18:45db) @@ -141,13 +141,13 @@ PokemonTower2Text1: ; 605df (18:45df) 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 a4fbbf18..0c3c6639 100755 --- a/scripts/pokemontower3.asm +++ b/scripts/pokemontower3.asm @@ -2,9 +2,9 @@ PokemonTower3Script: ; 606cc (18:46cc) 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: ; 606df (18:46df) diff --git a/scripts/pokemontower4.asm b/scripts/pokemontower4.asm index 2638bdc2..bd4cda11 100755 --- a/scripts/pokemontower4.asm +++ b/scripts/pokemontower4.asm @@ -2,9 +2,9 @@ PokemonTower4Script: ; 607f6 (18:47f6) 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: ; 60809 (18:4809) diff --git a/scripts/pokemontower5.asm b/scripts/pokemontower5.asm index c4e9eed9..6a2f5758 100755 --- a/scripts/pokemontower5.asm +++ b/scripts/pokemontower5.asm @@ -2,9 +2,9 @@ PokemonTower5Script: ; 60932 (18:4932) 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: ; 60945 (18:4945) diff --git a/scripts/pokemontower6.asm b/scripts/pokemontower6.asm index 1c3b1050..7bae81ea 100755 --- a/scripts/pokemontower6.asm +++ b/scripts/pokemontower6.asm @@ -2,16 +2,16 @@ PokemonTower6Script: ; 60aef (18:4aef) 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: ; 60b02 (18:4b02) xor a ld [wJoyIgnore], a - ld [W_POKEMONTOWER6CURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wPokemonTower6CurScript], a + ld [wCurMapScript], a ret PokemonTower6ScriptPointers: ; 60b0d (18:4b0d) @@ -37,8 +37,8 @@ PokemonTower6Script0: ; 60b17 (18:4b17) 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: ; 60b45 (18:4b45) @@ -66,8 +66,8 @@ PokemonTower6Script4: ; 60b48 (18:4b48) 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: ; 60b48 (18:4b48) 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: ; 60ba1 (18:4ba1) @@ -90,8 +90,8 @@ PokemonTower6Script3: ; 60ba1 (18:4ba1) ret nz call Delay3 xor a - ld [W_POKEMONTOWER6CURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wPokemonTower6CurScript], a + ld [wCurMapScript], a ret PokemonTower6TextPointers: ; 60bb1 (18:4bb1) diff --git a/scripts/pokemontower7.asm b/scripts/pokemontower7.asm index 58e6d327..49ecd5d9 100755 --- a/scripts/pokemontower7.asm +++ b/scripts/pokemontower7.asm @@ -1,7 +1,7 @@ PokemonTower7Script: ; 60d05 (18:4d05) call EnableAutoTextBoxDrawing ld hl, PokemonTower7ScriptPointers - ld a, [W_POKEMONTOWER7CURSCRIPT] + ld a, [wPokemonTower7CurScript] call JumpTable ret @@ -9,7 +9,7 @@ PokemonTower7Script_60d01: ; 60d18 (18:4d18) 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 48f291e1..c7a5625f 100755 --- a/scripts/powerplant.asm +++ b/scripts/powerplant.asm @@ -1,110 +1,110 @@ -PowerPlantScript: ; 1e2c6 (7:62c6) +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: ; 1e2d9 (7:62d9) +.ScriptPointers dw CheckFightingMapTrainers dw DisplayEnemyTrainerTextAndStartBattle dw EndTrainerBattle -PowerPlantTextPointers: ; 1e2df (7:62df) - dw PowerPlantText1 - dw PowerPlantText2 - dw PowerPlantText3 - dw PowerPlantText4 - dw PowerPlantText5 - dw PowerPlantText6 - dw PowerPlantText7 - dw PowerPlantText8 - dw PowerPlantText9 +PowerPlantTextPointers: + dw Voltorb0Text + dw Voltorb1Text + dw Voltorb2Text + dw Voltorb3Text + dw Voltorb4Text + dw Voltorb5Text + dw Voltorb6Text + dw Voltorb7Text + dw ZapdosText dw PickUpItemText dw PickUpItemText dw PickUpItemText dw PickUpItemText dw PickUpItemText -PowerPlantTrainerHeaders: ; 1e2fb (7:62fb) -PowerPlantTrainerHeader0: ; 1e2fb (7:62fb) - dbEventFlagBit EVENT_BEAT_POWER_PLANT_TRAINER_0 +PowerPlantTrainerHeaders: +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: ; 1e307 (7:6307) - 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: ; 1e313 (7:6313) - 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: ; 1e31f (7:631f) - 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: ; 1e32b (7:632b) - 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: ; 1e337 (7:6337) - 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: ; 1e343 (7:6343) - 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: ; 1e34f (7:634f) - 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: ; 1e35b (7:635b) - 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 @@ -112,62 +112,62 @@ PowerPlantTrainerHeader8: ; 1e35b (7:635b) db $ff -InitVoltorbBattle: ; 1e368 (7:6368) +InitVoltorbBattle: call TalkToTrainer - ld a, [W_CURMAPSCRIPT] - ld [W_POWERPLANTCURSCRIPT], a + ld a, [wCurMapScript] + ld [wPowerPlantCurScript], a jp TextScriptEnd -PowerPlantText1: ; 1e374 (7:6374) +Voltorb0Text: TX_ASM - ld hl, PowerPlantTrainerHeader0 + ld hl, Voltorb0TrainerHeader jr InitVoltorbBattle -PowerPlantText2: ; 1e37a (7:637a) +Voltorb1Text: TX_ASM - ld hl, PowerPlantTrainerHeader1 + ld hl, Voltorb1TrainerHeader jr InitVoltorbBattle -PowerPlantText3: ; 1e380 (7:6380) +Voltorb2Text: TX_ASM - ld hl, PowerPlantTrainerHeader2 + ld hl, Voltorb2TrainerHeader jr InitVoltorbBattle -PowerPlantText4: ; 1e386 (7:6386) +Voltorb3Text: TX_ASM - ld hl, PowerPlantTrainerHeader3 + ld hl, Voltorb3TrainerHeader jr InitVoltorbBattle -PowerPlantText5: ; 1e38c (7:638c) +Voltorb4Text: TX_ASM - ld hl, PowerPlantTrainerHeader4 + ld hl, Voltorb4TrainerHeader jr InitVoltorbBattle -PowerPlantText6: ; 1e392 (7:6392) +Voltorb5Text: TX_ASM - ld hl, PowerPlantTrainerHeader5 + ld hl, Voltorb5TrainerHeader jr InitVoltorbBattle -PowerPlantText7: ; 1e398 (7:6398) +Voltorb6Text: TX_ASM - ld hl, PowerPlantTrainerHeader6 + ld hl, Voltorb6TrainerHeader jr InitVoltorbBattle -PowerPlantText8: ; 1e39e (7:639e) +Voltorb7Text: TX_ASM - ld hl, PowerPlantTrainerHeader7 + ld hl, Voltorb7TrainerHeader jr InitVoltorbBattle -PowerPlantText9: ; 1e3a4 (7:63a4) +ZapdosText: TX_ASM - ld hl, PowerPlantTrainerHeader8 + ld hl, ZapdosTrainerHeader jr InitVoltorbBattle -VoltorbBattleText: ; 1e3aa (7:63aa) +VoltorbBattleText: TX_FAR _VoltorbBattleText db "@" -ZapdosBattleText: ; 1e3af (7:63af) +ZapdosBattleText: TX_FAR _ZapdosBattleText TX_ASM ld a, ZAPDOS diff --git a/scripts/rockethideout1.asm b/scripts/rockethideout1.asm index 82561577..d821434d 100755 --- a/scripts/rockethideout1.asm +++ b/scripts/rockethideout1.asm @@ -3,13 +3,13 @@ RocketHideout1Script: ; 44bca (11:4bca) 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: ; 44be0 (11:4be0) - 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 621e19e6..58e45d53 100755 --- a/scripts/rockethideout2.asm +++ b/scripts/rockethideout2.asm @@ -2,9 +2,9 @@ RocketHideout2Script: ; 44e27 (11:4e27) 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: ; 44e3a (11:4e3a) @@ -30,7 +30,7 @@ RocketHideout2Script0: ; 44e42 (11:4e42) ld a, $ff ld [wJoyIgnore], a ld a, $3 - ld [W_CURMAPSCRIPT], a + ld [wCurMapScript], a ret ;format: @@ -310,7 +310,7 @@ RocketHideout2Script3: ; 44fc2 (11:4fc2) ld hl, wd736 res 7, [hl] ld a, $0 - ld [W_CURMAPSCRIPT], a + ld [wCurMapScript], a ret LoadSpinnerArrowTiles: ; 45077 (11:5077) diff --git a/scripts/rockethideout3.asm b/scripts/rockethideout3.asm index 4cdacea3..82bdd394 100755 --- a/scripts/rockethideout3.asm +++ b/scripts/rockethideout3.asm @@ -2,9 +2,9 @@ RocketHideout3Script: ; 45225 (11:5225) 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: ; 45238 (11:5238) @@ -30,7 +30,7 @@ RocketHideout3Script0: ; 45240 (11:5240) ld a, $ff ld [wJoyIgnore], a ld a, $3 - ld [W_CURMAPSCRIPT], a + ld [wCurMapScript], a ret ;format: @@ -140,7 +140,7 @@ RocketHideout3Script3: ; 452e4 (11:452e4) ld hl, wd736 res 7, [hl] ld a, $0 - ld [W_CURMAPSCRIPT], a + ld [wCurMapScript], a ret RocketHideout3TextPointers: ; 452fa (11:52fa) diff --git a/scripts/rockethideout4.asm b/scripts/rockethideout4.asm index 30ed3f24..c6d48852 100755 --- a/scripts/rockethideout4.asm +++ b/scripts/rockethideout4.asm @@ -2,9 +2,9 @@ RocketHideout4Script: ; 4545d (11:545d) 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: ; 45510 (11:54a3) @@ -13,8 +13,8 @@ RocketHideout4Script_45510: ; 45510 (11:54a3) 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: ; 454b6 (11:54b6) 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: @@ -364,8 +364,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 8a0ca049..c90b0aad 100755 --- a/scripts/rockethideoutelevator.asm +++ b/scripts/rockethideoutelevator.asm @@ -1,5 +1,5 @@ RocketHideoutElevatorScript: ; 45710 (11:5710) - 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 d03a5ba1..2b917f91 100755 --- a/scripts/rocktunnel1.asm +++ b/scripts/rocktunnel1.asm @@ -2,9 +2,9 @@ RockTunnel1Script: ; 444dc (11:44dc) 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: ; 444ef (11:44ef) diff --git a/scripts/rocktunnel2.asm b/scripts/rocktunnel2.asm index 2082394a..5cc04a2d 100755 --- a/scripts/rocktunnel2.asm +++ b/scripts/rocktunnel2.asm @@ -2,9 +2,9 @@ RockTunnel2Script: ; 45feb (11:5feb) 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: ; 45ffe (11:5ffe) diff --git a/scripts/route10.asm b/scripts/route10.asm index 2d5d2ae4..5a501557 100755 --- a/scripts/route10.asm +++ b/scripts/route10.asm @@ -2,9 +2,9 @@ Route10Script: ; 59336 (16:5336) 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: ; 59349 (16:5349) diff --git a/scripts/route11.asm b/scripts/route11.asm index 3a9f1e0d..d56b7730 100755 --- a/scripts/route11.asm +++ b/scripts/route11.asm @@ -2,9 +2,9 @@ Route11Script: ; 5944c (16:544c) 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: ; 5945f (16:545f) diff --git a/scripts/route12.asm b/scripts/route12.asm index 01a5e93c..882e687a 100755 --- a/scripts/route12.asm +++ b/scripts/route12.asm @@ -2,16 +2,16 @@ Route12Script: ; 595f3 (16:55f3) 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: ; 59606 (16:5606) xor a ld [wJoyIgnore], a - ld [W_ROUTE12CURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wRoute12CurScript], a + ld [wCurMapScript], a ret Route12ScriptPointers: ; 59611 (16:5611) @@ -37,8 +37,8 @@ Route12Script0: ; 59619 (16:5619) ld [wMissableObjectIndex], a predef HideObject ld a, $3 - ld [W_ROUTE12CURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wRoute12CurScript], a + ld [wCurMapScript], a ret Route12Script3: ; 5964c (16:564c) @@ -56,8 +56,8 @@ Route12Script3: ; 5964c (16:564c) 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: ; 59675 (16:5675) diff --git a/scripts/route13.asm b/scripts/route13.asm index ab061071..911c15af 100755 --- a/scripts/route13.asm +++ b/scripts/route13.asm @@ -2,9 +2,9 @@ Route13Script: ; 5581e (15:581e) 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: ; 55831 (15:5831) diff --git a/scripts/route14.asm b/scripts/route14.asm index d65e257f..9970b817 100755 --- a/scripts/route14.asm +++ b/scripts/route14.asm @@ -2,9 +2,9 @@ Route14Script: ; 559d3 (15:59d3) 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: ; 559e6 (15:59e6) diff --git a/scripts/route15.asm b/scripts/route15.asm index 023f859c..5f58b996 100755 --- a/scripts/route15.asm +++ b/scripts/route15.asm @@ -2,9 +2,9 @@ Route15Script: ; 597ae (16:57ae) 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: ; 597c1 (16:57c1) diff --git a/scripts/route16.asm b/scripts/route16.asm index 760beb01..1f6ba9a3 100755 --- a/scripts/route16.asm +++ b/scripts/route16.asm @@ -2,16 +2,16 @@ Route16Script: ; 59933 (16:5933) 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: ; 59946 (16:5946) xor a ld [wJoyIgnore], a - ld [W_ROUTE16CURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wRoute16CurScript], a + ld [wCurMapScript], a ret Route16ScriptPointers: ; 59951 (16:5951) @@ -38,8 +38,8 @@ Route16Script0: ; 59959 (16:5959) predef HideObject call UpdateSprites ld a, $3 - ld [W_ROUTE16CURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wRoute16CurScript], a + ld [wCurMapScript], a ret Route16Script3: ; 5998f (16:598f) @@ -57,8 +57,8 @@ Route16Script3: ; 5998f (16:598f) 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: ; 599b9 (16:59b9) diff --git a/scripts/route16gate.asm b/scripts/route16gate.asm index 197b12b2..12be6b91 100755 --- a/scripts/route16gate.asm +++ b/scripts/route16gate.asm @@ -2,7 +2,7 @@ Route16GateScript: ; 496be (12:56be) 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: ; 496d7 (12:56d7) 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: ; 49714 (12:5714) @@ -67,7 +67,7 @@ Route16GateScript2: ; 49727 (12:5727) ld [wSimulatedJoypadStatesEnd], a call StartSimulatingJoypadStates ld a, $3 - ld [W_ROUTE16GATECURSCRIPT], a + ld [wRoute16GateCurScript], a ret Route16GateScript3: ; 49741 (12:5741) @@ -79,7 +79,7 @@ Route16GateScript3: ; 49741 (12:5741) ld hl, wd730 res 7, [hl] ld a, $0 - ld [W_ROUTE16GATECURSCRIPT], a + ld [wRoute16GateCurScript], a ret Route16GateScript_49755: ; 49755 (12:5755) diff --git a/scripts/route17.asm b/scripts/route17.asm index 28c43627..f2a021a7 100755 --- a/scripts/route17.asm +++ b/scripts/route17.asm @@ -2,9 +2,9 @@ Route17Script: ; 55b7a (15:5b7a) 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: ; 55b8d (15:5b8d) diff --git a/scripts/route18.asm b/scripts/route18.asm index 9544b1ec..1f0c651a 100755 --- a/scripts/route18.asm +++ b/scripts/route18.asm @@ -2,9 +2,9 @@ Route18Script: ; 59ac7 (16:5ac7) 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: ; 59ada (16:5ada) diff --git a/scripts/route18gate.asm b/scripts/route18gate.asm index 33f67e97..7067064b 100755 --- a/scripts/route18gate.asm +++ b/scripts/route18gate.asm @@ -2,7 +2,7 @@ Route18GateScript: ; 49876 (12:5876) 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: ; 4988f (12:588f) 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: ; 498cc (12:58cc) @@ -67,7 +67,7 @@ Route18GateScript2: ; 498df (12:58df) ld [wSimulatedJoypadStatesEnd], a call StartSimulatingJoypadStates ld a, $3 - ld [W_ROUTE18GATECURSCRIPT], a + ld [wRoute18GateCurScript], a ret Route18GateScript3: ; 498f9 (12:58f9) @@ -79,7 +79,7 @@ Route18GateScript3: ; 498f9 (12:58f9) ld hl, wd730 res 7, [hl] ld a, $0 - ld [W_ROUTE18GATECURSCRIPT], a + ld [wRoute18GateCurScript], a ret Route18GateTextPointers: ; 4990d (12:590d) diff --git a/scripts/route19.asm b/scripts/route19.asm index 9ed6080b..dd8a2e76 100755 --- a/scripts/route19.asm +++ b/scripts/route19.asm @@ -2,9 +2,9 @@ Route19Script: ; 55d44 (15:5d44) 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: ; 55d57 (15:5d57) diff --git a/scripts/route20.asm b/scripts/route20.asm index ce9e6f23..9c5fc387 100755 --- a/scripts/route20.asm +++ b/scripts/route20.asm @@ -4,9 +4,9 @@ Route20Script: ; 50ca9 (14:4ca9) 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: ; 50cc6 (14:4cc6) diff --git a/scripts/route21.asm b/scripts/route21.asm index 4c8087fd..821cea39 100755 --- a/scripts/route21.asm +++ b/scripts/route21.asm @@ -2,9 +2,9 @@ Route21Script: ; 55eeb (15:5eeb) 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: ; 55efe (15:5efe) diff --git a/scripts/route22.asm b/scripts/route22.asm index 5ea8178f..18dc36ac 100755 --- a/scripts/route22.asm +++ b/scripts/route22.asm @@ -1,7 +1,7 @@ Route22Script: ; 50eb2 (14:4eb2) call EnableAutoTextBoxDrawing ld hl, Route22ScriptPointers - ld a, [W_ROUTE22CURSCRIPT] + ld a, [wRoute22CurScript] jp JumpTable Route22ScriptPointers: ; 50ebe (14:4ebe) @@ -17,7 +17,7 @@ Route22ScriptPointers: ; 50ebe (14:4ebe) Route22Script_50ece: ; 50ece (14:4ece) xor a ld [wJoyIgnore], a - ld [W_ROUTE22CURSCRIPT], a + ld [wRoute22CurScript], a Route22Script7: ; 50ed5 (14:4ed5) ret @@ -31,7 +31,7 @@ Route22Script_50ed6: ; 50ed6 (14:4ed6) 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: ; 50f00 (14:4f00) ld [H_SPRITEINDEX], a call Route22MoveRivalSprite ld a, $1 - ld [W_ROUTE22CURSCRIPT], a + ld [wRoute22CurScript], a ret Route22Script1: ; 50f62 (14:4f62) @@ -132,7 +132,7 @@ Route22Script1: ; 50f62 (14:4f62) call SaveEndBattleTextPointers call Route22Script_50ed6 ld a, $2 - ld [W_ROUTE22CURSCRIPT], a + ld [wRoute22CurScript], a ret Route22RivalDefeatedText1: ; 511b7 (14:51b7) @@ -147,11 +147,11 @@ Route22Script2: ; 50fb5 (14:4fb5) 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, [wSpriteStateData1 + 9] and a ; cp SPRITE_FACING_DOWN @@ -182,7 +182,7 @@ Route22Script2: ; 50fb5 (14:4fb5) call Route22Script_5100d .asm_51002 ld a, $3 - ld [W_ROUTE22CURSCRIPT], a + ld [wRoute22CurScript], a ret Route22Script_51008: ; 51008 (14:5008) @@ -231,7 +231,7 @@ Route22Script3: ; 5102a (14:502a) 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: ; 5104e (14:504e) @@ -251,7 +251,7 @@ Route22Script_5104e: ; 5104e (14:504e) ld [H_SPRITEINDEX], a call Route22MoveRivalSprite ld a, $4 - ld [W_ROUTE22CURSCRIPT], a + ld [wRoute22CurScript], a ret Route22Script4: ; 51087 (14:5087) @@ -287,7 +287,7 @@ Route22Script4: ; 51087 (14:5087) call SaveEndBattleTextPointers call Route22Script_50ee1 ld a, $5 - ld [W_ROUTE22CURSCRIPT], a + ld [wRoute22CurScript], a ret Route22RivalDefeatedText2: ; 511cb (14:51cb) @@ -335,7 +335,7 @@ Route22Script5: ; 510df (14:50df) call Route22Script_51142 .asm_51137 ld a, $6 - ld [W_ROUTE22CURSCRIPT], a + ld [wRoute22CurScript], a ret Route22Script_5113d: ; 5113d (14:513d) @@ -370,7 +370,7 @@ Route22Script6: ; 51151 (14:5151) 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: ; 51175 (14:5175) diff --git a/scripts/route22gate.asm b/scripts/route22gate.asm index c957e4a6..c3581206 100755 --- a/scripts/route22gate.asm +++ b/scripts/route22gate.asm @@ -1,7 +1,7 @@ Route22GateScript: ; 1e683 (7:6683) call EnableAutoTextBoxDrawing ld hl, Route22GateScriptPointers - ld a, [W_ROUTE22GATECURSCRIPT] + ld a, [wRoute22GateCurScript] call JumpTable ld a, [wYCoord] cp $4 @@ -52,7 +52,7 @@ Route22GateScript1: ; 1e6cd (7:66cd) ld [wJoyIgnore], a call Delay3 ld a, $0 - ld [W_ROUTE22GATECURSCRIPT], a + ld [wRoute22GateCurScript], a Route22GateScript2: ; 1e6de (7:66de) ret @@ -74,7 +74,7 @@ Route22GateText1: ; 1e6e1 (7:66e1) call PrintText ld a, $2 .asm_1e6fe - ld [W_ROUTE22GATECURSCRIPT], a + ld [wRoute22GateCurScript], a jp TextScriptEnd Route22GateText_1e704: ; 1e704 (7:6704) diff --git a/scripts/route23.asm b/scripts/route23.asm index f324963b..6af5c082 100755 --- a/scripts/route23.asm +++ b/scripts/route23.asm @@ -2,11 +2,11 @@ Route23Script: ; 511da (14:51da) call Route23Script_511e9 call EnableAutoTextBoxDrawing ld hl, Route23ScriptPointers - ld a, [W_ROUTE23CURSCRIPT] + ld a, [wRoute23CurScript] jp JumpTable Route23Script_511e9: ; 511e9 (14:51e9) - ld hl, wd126 + ld hl, wCurrentMapScriptFlags bit 6, [hl] res 6, [hl] ret z @@ -128,7 +128,7 @@ Route23Script1: ; 512ec (14:52ec) ret nz Route23Script2: ; 512f1 (14:52f1) ld a, $0 - ld [W_ROUTE23CURSCRIPT], a + ld [wRoute23CurScript], a ret Route23TextPointers: ; 512f7 (14:52f7) @@ -199,7 +199,7 @@ Route23Script_51346: ; 51346 (14:5346) 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: ; 51346 (14:5346) EventFlagAddress hl, EVENT_PASSED_CASCADEBADGE_CHECK predef FlagActionPredef ld a, $2 - ld [W_ROUTE23CURSCRIPT], a + ld [wRoute23CurScript], a ret Route23Script_51388: ; 51388 (14:5388) diff --git a/scripts/route24.asm b/scripts/route24.asm index 15fe78b8..84107ddd 100755 --- a/scripts/route24.asm +++ b/scripts/route24.asm @@ -2,16 +2,16 @@ Route24Script: ; 51366 (14:5366) 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: ; 513c0 (14:53c0) xor a ld [wJoyIgnore], a - ld [W_ROUTE24CURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wRoute24CurScript], a + ld [wCurMapScript], a ret Route24ScriptPointers: ; 513cb (14:53cb) @@ -40,8 +40,8 @@ Route24Script0: ; 513d5 (14:53d5) 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: ; 5140e (14:540e) @@ -53,8 +53,8 @@ Route24Script4: ; 51411 (14:5411) ret nz call Delay3 ld a, $0 - ld [W_ROUTE24CURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wRoute24CurScript], a + ld [wCurMapScript], a ret Route24Script3: ; 51422 (14:5422) @@ -71,8 +71,8 @@ Route24Script3: ; 51422 (14:5422) xor a ld [wJoyIgnore], a ld a, $0 - ld [W_ROUTE24CURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wRoute24CurScript], a + ld [wCurMapScript], a ret Route24TextPointers: ; 5144b (14:544b) @@ -171,8 +171,8 @@ Route24Text1: ; 514a4 (14:54a4) 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 20dcc890..8df84d95 100755 --- a/scripts/route25.asm +++ b/scripts/route25.asm @@ -2,9 +2,9 @@ Route25Script: ; 515cb (14:55cb) 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: ; 515e1 (14:55e1) 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 50c4e00d..4640d767 100755 --- a/scripts/route3.asm +++ b/scripts/route3.asm @@ -2,9 +2,9 @@ Route3Script: ; 554f8 (15:54f8) 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: ; 5550b (15:550b) diff --git a/scripts/route4.asm b/scripts/route4.asm index f5bdd9e8..019d5582 100755 --- a/scripts/route4.asm +++ b/scripts/route4.asm @@ -2,9 +2,9 @@ Route4Script: ; 55658 (15:5658) 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: ; 5566b (15:566b) diff --git a/scripts/route5gate.asm b/scripts/route5gate.asm index 6442fd83..f35e5dea 100755 --- a/scripts/route5gate.asm +++ b/scripts/route5gate.asm @@ -1,6 +1,6 @@ Route5GateScript: ; 1df33 (7:5f33) call EnableAutoTextBoxDrawing - ld a, [W_ROUTE5GATECURSCRIPT] + ld a, [wRoute5GateCurScript] ld hl, Route5GateScriptPointers jp JumpTable @@ -35,7 +35,7 @@ Route5GateScript0: ; 1df50 (7:5f50) 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: ; 1df94 (7:5f94) call Delay3 xor a ld [wJoyIgnore], a - ld [W_ROUTE5GATECURSCRIPT], a + ld [wRoute5GateCurScript], a ret Route5GateTextPointers: ; 1dfa4 (7:5fa4) @@ -81,7 +81,7 @@ Route5GateText1: ; 1dfaa (7:5faa) 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 8ef32a42..85b7cb63 100755 --- a/scripts/route6.asm +++ b/scripts/route6.asm @@ -2,9 +2,9 @@ Route6Script: ; 590b0 (16:50b0) 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: ; 590c3 (16:50c3) diff --git a/scripts/route6gate.asm b/scripts/route6gate.asm index dd179e28..c0c19021 100755 --- a/scripts/route6gate.asm +++ b/scripts/route6gate.asm @@ -1,7 +1,7 @@ Route6GateScript: ; 1e03d (7:603d) call EnableAutoTextBoxDrawing ld hl, Route6GateScriptPointers - ld a, [W_ROUTE6GATECURSCRIPT] + ld a, [wRoute6GateCurScript] call JumpTable ret @@ -29,7 +29,7 @@ Route6GateScript0: ; 1e04e (7:604e) 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: ; 1e091 (7:6091) call Delay3 xor a ld [wJoyIgnore], a - ld [W_ROUTE6GATECURSCRIPT], a + ld [wRoute6GateCurScript], a ret Route6GateScript_1e0a1: ; 1e0a1 (7:60a1) diff --git a/scripts/route7gate.asm b/scripts/route7gate.asm index 7f87b78c..fdb94d4a 100755 --- a/scripts/route7gate.asm +++ b/scripts/route7gate.asm @@ -1,6 +1,6 @@ Route7GateScript: ; 1e100 (7:6100) call EnableAutoTextBoxDrawing - ld a, [W_ROUTE7GATECURSCRIPT] + ld a, [wRoute7GateCurScript] ld hl, Route7GateScriptPointers call JumpTable ret @@ -41,7 +41,7 @@ Route7GateScript0: ; 1e128 (7:6128) 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: ; 1e16c (7:616c) call Delay3 xor a ld [wJoyIgnore], a - ld [W_ROUTE7GATECURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wRoute7GateCurScript], a + ld [wCurMapScript], a ret Route7GateTextPointers: ; 1e17f (7:617f) diff --git a/scripts/route8.asm b/scripts/route8.asm index c734c62d..cfb4f433 100755 --- a/scripts/route8.asm +++ b/scripts/route8.asm @@ -2,9 +2,9 @@ Route8Script: ; 591b6 (16:51b6) 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: ; 591c9 (16:51c9) diff --git a/scripts/route8gate.asm b/scripts/route8gate.asm index 5a26b424..8068f153 100755 --- a/scripts/route8gate.asm +++ b/scripts/route8gate.asm @@ -1,7 +1,7 @@ Route8GateScript: ; 1e1c7 (7:61c7) call EnableAutoTextBoxDrawing ld hl, Route8GateScriptPointers - ld a, [W_ROUTE8GATECURSCRIPT] + ld a, [wRoute8GateCurScript] jp JumpTable Route8GateScriptPointers: ; 1e1d3 (7:61d3) @@ -40,7 +40,7 @@ Route8GateScript0: ; 1e1ee (7:61ee) 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: ; 1e231 (7:6231) call Delay3 xor a ld [wJoyIgnore], a - ld [W_ROUTE8GATECURSCRIPT], a + ld [wRoute8GateCurScript], a ret Route8GateTextPointers: ; 1e241 (7:6241) diff --git a/scripts/route9.asm b/scripts/route9.asm index 5de98173..fd9949eb 100755 --- a/scripts/route9.asm +++ b/scripts/route9.asm @@ -2,9 +2,9 @@ Route9Script: ; 556bc (15:56bc) 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: ; 556cf (15:56cf) diff --git a/scripts/saffrongym.asm b/scripts/saffrongym.asm index cae60f45..aae06103 100755 --- a/scripts/saffrongym.asm +++ b/scripts/saffrongym.asm @@ -1,14 +1,14 @@ SaffronGymScript: ; 5d00d (17:500d) - 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: ; 5d040 (17:5040) SaffronGymText_5d048: ; 5d048 (17:5048) xor a ld [wJoyIgnore], a - ld [W_SAFFRONGYMCURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wSaffronGymCurScript], a + ld [wCurMapScript], a ret SaffronGymScriptPointers: ; 5d053 (17:5053) @@ -179,7 +179,7 @@ SaffronGymText1: ; 5d118 (17:5118) ld a, $6 ld [wGymLeaderNo], a ld a, $3 - ld [W_SAFFRONGYMCURSCRIPT], a + ld [wSaffronGymCurScript], a .asm_5d15f jp TextScriptEnd diff --git a/scripts/seafoamislands1.asm b/scripts/seafoamislands1.asm index f9a2e7fc..52561fa7 100755 --- a/scripts/seafoamislands1.asm +++ b/scripts/seafoamislands1.asm @@ -1,4 +1,4 @@ -SeafoamIslands1Script: ; 447e9 (11:47e9) +SeafoamIslands1Script: call EnableAutoTextBoxDrawing SetEvent EVENT_IN_SEAFOAM_ISLANDS ld hl, wFlags_0xcd60 @@ -37,11 +37,11 @@ SeafoamIslands1Script: ; 447e9 (11:47e9) ld hl, Seafoam1HolesCoords jp IsPlayerOnDungeonWarp -Seafoam1HolesCoords: ; 44846 (11:4846) +Seafoam1HolesCoords: db $06,$11 db $06,$18 db $ff -SeafoamIslands1TextPointers: ; 4484b (11:484b) +SeafoamIslands1TextPointers: dw BoulderText dw BoulderText diff --git a/scripts/seafoamislands2.asm b/scripts/seafoamislands2.asm index 2c2962f8..50024bad 100755 --- a/scripts/seafoamislands2.asm +++ b/scripts/seafoamislands2.asm @@ -1,4 +1,4 @@ -SeafoamIslands2Script: ; 46315 (11:6315) +SeafoamIslands2Script: call EnableAutoTextBoxDrawing ld hl, wFlags_0xcd60 bit 7, [hl] @@ -36,11 +36,11 @@ SeafoamIslands2Script: ; 46315 (11:6315) ld hl, Seafoam2HolesCoords jp IsPlayerOnDungeonWarp -Seafoam2HolesCoords: ; 4636d (11:636d) +Seafoam2HolesCoords: db $06,$12 db $06,$17 db $ff -SeafoamIslands2TextPointers: ; 46372 (11:6372) +SeafoamIslands2TextPointers: dw BoulderText dw BoulderText diff --git a/scripts/seafoamislands3.asm b/scripts/seafoamislands3.asm index 6dda7f37..4a7848a4 100755 --- a/scripts/seafoamislands3.asm +++ b/scripts/seafoamislands3.asm @@ -1,4 +1,4 @@ -SeafoamIslands3Script: ; 46451 (11:6451) +SeafoamIslands3Script: call EnableAutoTextBoxDrawing ld hl, wFlags_0xcd60 bit 7, [hl] @@ -36,11 +36,11 @@ SeafoamIslands3Script: ; 46451 (11:6451) ld hl, Seafoam3HolesCoords jp IsPlayerOnDungeonWarp -Seafoam3HolesCoords: ; 464a9 (11:64a9) +Seafoam3HolesCoords: db $06,$13 db $06,$16 db $ff -SeafoamIslands3TextPointers: ; 464ae (11:64ae) +SeafoamIslands3TextPointers: dw BoulderText dw BoulderText diff --git a/scripts/seafoamislands4.asm b/scripts/seafoamislands4.asm index 56ccd2e3..a1e4b1d8 100755 --- a/scripts/seafoamislands4.asm +++ b/scripts/seafoamislands4.asm @@ -1,4 +1,4 @@ -SeafoamIslands4Script: ; 4658d (11:658d) +SeafoamIslands4Script: call EnableAutoTextBoxDrawing ld hl, wFlags_0xcd60 bit 7, [hl] @@ -44,18 +44,18 @@ SeafoamIslands4Script: ; 4658d (11:658d) ld a, [wSeafoamIslands4CurScript] jp JumpTable -Seafoam4HolesCoords: ; 465f6 (11:65f6) +Seafoam4HolesCoords: db $10,$03 db $10,$06 db $ff -SeafoamIslands4ScriptPointers: ; 465fb (11:65fb) +SeafoamIslands4ScriptPointers: dw SeafoamIslands4Script0 dw SeafoamIslands4Script1 dw SeafoamIslands4Script2 dw SeafoamIslands4Script3 -SeafoamIslands4Script0: ; 46603 (11:6603) +SeafoamIslands4Script0: CheckBothEventsSet EVENT_SEAFOAM3_BOULDER1_DOWN_HOLE, EVENT_SEAFOAM3_BOULDER2_DOWN_HOLE ret z ld a, [wYCoord] @@ -76,13 +76,13 @@ SeafoamIslands4Script0: ; 46603 (11:6603) ld [wSeafoamIslands4CurScript], a ret -RLEMovement46632: ; 46632 (11:6632) +RLEMovement46632: db D_DOWN,6 db D_RIGHT,5 db D_DOWN,3 db $ff -SeafoamIslands4Script1: ; 46639 (11:6639) +SeafoamIslands4Script1: ld a, [wSimulatedJoypadStatesIndex] and a ret nz @@ -90,7 +90,7 @@ SeafoamIslands4Script1: ; 46639 (11:6639) ld [wSeafoamIslands4CurScript], a ret -SeafoamIslands4Script2: ; 46644 (11:6644) +SeafoamIslands4Script2: CheckBothEventsSet EVENT_SEAFOAM3_BOULDER1_DOWN_HOLE, EVENT_SEAFOAM3_BOULDER2_DOWN_HOLE ret z ld a, [wXCoord] @@ -119,20 +119,20 @@ SeafoamIslands4Script2: ; 46644 (11:6644) ld [wSeafoamIslands4CurScript], a ret -RLEData_4667f: ; 4667f (11:667f) +RLEData_4667f: db D_DOWN,$06 db D_RIGHT,$02 db D_DOWN,$04 db D_LEFT,$01 db $FF -RLEData_46688: ; 46688 (11:6688) +RLEData_46688: db D_DOWN,$06 db D_RIGHT,$02 db D_DOWN,$04 db $FF -SeafoamIslands4Script3: ; 4668f (11:668f) +SeafoamIslands4Script3: ld a, [wSimulatedJoypadStatesIndex] and a ret nz @@ -140,7 +140,7 @@ SeafoamIslands4Script3: ; 4668f (11:668f) ld [wSeafoamIslands4CurScript], a ret -SeafoamIslands4TextPointers: ; 4669a (11:669a) +SeafoamIslands4TextPointers: dw BoulderText dw BoulderText dw BoulderText diff --git a/scripts/seafoamislands5.asm b/scripts/seafoamislands5.asm index 5901c5ca..478946fa 100755 --- a/scripts/seafoamislands5.asm +++ b/scripts/seafoamislands5.asm @@ -1,24 +1,24 @@ -SeafoamIslands5Script: ; 46799 (11:6799) +SeafoamIslands5Script: call EnableAutoTextBoxDrawing ld a, [wSeafoamIslands5CurScript] ld hl, SeafoamIslands5ScriptPointers jp JumpTable -SeafoamIslands5Script_467a5: ; 467a5 (11:67a5) +SeafoamIslands5Script_467a5: xor a ld [wJoyIgnore], a ld [wSeafoamIslands5CurScript], a - ld [W_CURMAPSCRIPT], a + ld [wCurMapScript], a ret -SeafoamIslands5ScriptPointers: ; 467ad (11:67ad) +SeafoamIslands5ScriptPointers: dw SeafoamIslands5Script0 dw SeafoamIslands5Script1 dw SeafoamIslands5Script2 dw SeafoamIslands5Script3 dw SeafoamIslands5Script4 -SeafoamIslands5Script4: ; 467b7 (11:67b7) +SeafoamIslands5Script4: ld a, [wIsInBattle] cp $ff jr z, SeafoamIslands5Script_467a5 @@ -27,10 +27,10 @@ SeafoamIslands5Script4: ; 467b7 (11:67b7) ld [wSeafoamIslands5CurScript], a ret -SeafoamIslands5Script0: ; 467c7 (11:67c7) +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,14 +53,14 @@ SeafoamIslands5Script0: ; 467c7 (11:67c7) ld [wSeafoamIslands5CurScript], a ret -CoordsData_467fe: ; 467fe (11:67fe) +.Coords db $11,$14 db $11,$15 db $10,$14 db $10,$15 db $FF -SeafoamIslands5Script1: ; 46807 (11:6807) +SeafoamIslands5Script1: ld a, [wSimulatedJoypadStatesIndex] and a ret nz @@ -70,11 +70,11 @@ SeafoamIslands5Script1: ; 46807 (11:6807) ld [wSeafoamIslands5CurScript], a ret -SeafoamIslands5Script2: ; 46816 (11:6816) +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,24 +96,24 @@ SeafoamIslands5Script2: ; 46816 (11:6816) ld [wSeafoamIslands5CurScript], a ret -CoordsData_4684d: ; 4684d (11:684d) +.Coords db $0E,$04 db $0E,$05 db $FF -RLEMovementData_46852: ; 46852 (11:6852) +RLEMovementData_46852: db D_UP,$03 db D_RIGHT,$02 db D_UP,$01 db $FF -RLEMovementData_46859: ; 46859 (11:6859) +RLEMovementData_46859: db D_UP,$03 db D_RIGHT,$03 db D_UP,$01 db $FF -SeafoamIslands5Script3: ; 46860 (11:6860) +SeafoamIslands5Script3: ld a, [wSimulatedJoypadStatesIndex] ld b, a cp $1 @@ -125,51 +125,50 @@ SeafoamIslands5Script3: ; 46860 (11:6860) ld [wSeafoamIslands5CurScript], a ret -SeaFoamIslands5Script_46872: ; 46872 (11:6872) +SeaFoamIslands5Script_46872: xor a ld [wWalkBikeSurfState], a ld [wWalkBikeSurfStateCopy], a jp ForceBikeOrSurf -SeafoamIslands5TextPointers: ; 4687c (11:687c) +SeafoamIslands5TextPointers: dw BoulderText dw BoulderText - dw SeafoamIslands5Text3 + dw ArticunoText dw SeafoamIslands5Text4 dw SeafoamIslands5Text5 -SeafoamIslands5TrainerHeaders: ; 46886 (11:6886) -SeafoamIslands5TrainerHeader0: ; 46886 (11:6886) - 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: ; 46893 (11:6893) +ArticunoText: TX_ASM - ld hl, SeafoamIslands5TrainerHeader0 + ld hl, ArticunoTrainerHeader call TalkToTrainer ld a, $4 ld [wSeafoamIslands5CurScript], a jp TextScriptEnd -SeafoamIslands5BattleText2: ; 468a2 (11:68a2) - TX_FAR _SeafoamIslands5BattleText2 +ArticunoBattleText: + TX_FAR _ArticunoBattleText TX_ASM ld a, ARTICUNO call PlayCry call WaitForSoundToFinish jp TextScriptEnd -SeafoamIslands5Text4: ; 468b2 (11:68b2) +SeafoamIslands5Text4: TX_FAR _SeafoamIslands5Text4 db "@" -SeafoamIslands5Text5: ; 468b7 (11:68b7) +SeafoamIslands5Text5: TX_FAR _SeafoamIslands5Text5 db "@" diff --git a/scripts/silphco10.asm b/scripts/silphco10.asm index a6f2f860..e254765d 100755 --- a/scripts/silphco10.asm +++ b/scripts/silphco10.asm @@ -3,13 +3,13 @@ SilphCo10Script: ; 5a139 (16:6139) 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: ; 5a14f (16:614f) - 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 42e8d574..fb341105 100755 --- a/scripts/silphco11.asm +++ b/scripts/silphco11.asm @@ -3,13 +3,13 @@ SilphCo11Script: ; 62111 (18:60fa) 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: ; 62127 (18:6110) - ld hl, wd126 + ld hl, wCurrentMapScriptFlags bit 5, [hl] res 5, [hl] ret z @@ -75,8 +75,8 @@ SilphCo11Script_62185: ; 62185 (18:61c4) xor a ld [wJoyIgnore], a SilphCo11Script_62189: ; 62189 (18:61c8) - ld [W_SILPHCO11CURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wSilphCo11CurScript], a + ld [wCurMapScript], a ret SilphCo11ScriptPointers: ; 62190 (18:6190) diff --git a/scripts/silphco2.asm b/scripts/silphco2.asm index ecb3b5a5..42a5f3c0 100755 --- a/scripts/silphco2.asm +++ b/scripts/silphco2.asm @@ -3,13 +3,13 @@ SilphCo2Script: ; 59cf1 (16:5cf1) 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: ; 59d07 (16:5d07) - 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 bdaac452..68ae7ed2 100755 --- a/scripts/silphco3.asm +++ b/scripts/silphco3.asm @@ -3,13 +3,13 @@ SilphCo3Script: ; 59f5b (16:5f5b) 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: ; 59f71 (16:5f71) - 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 0dad6f6b..12e04f69 100755 --- a/scripts/silphco4.asm +++ b/scripts/silphco4.asm @@ -3,13 +3,13 @@ SilphCo4Script: ; 19d0b (6:5d0b) 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: ; 19d21 (6:5d21) - 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 7380f98f..d09848ba 100755 --- a/scripts/silphco5.asm +++ b/scripts/silphco5.asm @@ -3,13 +3,13 @@ SilphCo5Script: ; 19f37 (6:5f37) 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: ; 19f4d (6:5f4d) - 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 fa199069..406bc373 100755 --- a/scripts/silphco6.asm +++ b/scripts/silphco6.asm @@ -3,13 +3,13 @@ SilphCo6Script: ; 1a1a9 (6:61a9) 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: ; 1a1bf (6:61bf) - 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 1634472b..cc26d117 100755 --- a/scripts/silphco7.asm +++ b/scripts/silphco7.asm @@ -3,13 +3,13 @@ SilphCo7Script: ; 51b61 (14:5b61) 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: ; 51b77 (14:5b77) - ld hl, wd126 + ld hl, wCurrentMapScriptFlags bit 5, [hl] res 5, [hl] ret z @@ -106,8 +106,8 @@ SilphCo7Text_51c0c: ; 51c0c (14:5c0c) ld [wJoyIgnore], a SilphCo7Text_51c10: ; 51c10 (14:5c10) - ld [W_SILPHCO7CURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wSilphCo7CurScript], a + ld [wCurMapScript], a ret SilphCo7ScriptPointers: ; 51c17 (14:5c17) @@ -183,7 +183,7 @@ SilphCo7Script3: ; 51c82 (14:5c82) 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 9ea985a8..86f02b60 100755 --- a/scripts/silphco8.asm +++ b/scripts/silphco8.asm @@ -3,13 +3,13 @@ SilphCo8Script: ; 56504 (15:6504) 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: ; 5651a (15:651a) - 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 02638459..589a086e 100755 --- a/scripts/silphco9.asm +++ b/scripts/silphco9.asm @@ -3,13 +3,13 @@ SilphCo9Script: ; 5d7bb (17:57bb) 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: ; 5d7d1 (17:57d1) - 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 d080cfef..386cd2e8 100755 --- a/scripts/silphcoelevator.asm +++ b/scripts/silphcoelevator.asm @@ -1,5 +1,5 @@ SilphCoElevatorScript: ; 457c0 (11:57c0) - 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 3b53b961..d39b902f 100755 --- a/scripts/ssanne10.asm +++ b/scripts/ssanne10.asm @@ -2,9 +2,9 @@ SSAnne10Script: ; 61d55 (18:5d55) 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: ; 61d68 (18:5d68) diff --git a/scripts/ssanne2.asm b/scripts/ssanne2.asm index 3a2e207a..fdd6067e 100755 --- a/scripts/ssanne2.asm +++ b/scripts/ssanne2.asm @@ -1,13 +1,13 @@ SSAnne2Script: ; 6139f (18:539f) call EnableAutoTextBoxDrawing ld hl, SSAnne2ScriptPointers - ld a, [W_SSANNE2CURSCRIPT] + ld a, [wSSAnne2CurScript] jp JumpTable SSAnne2Script_613ab: ; 613ab (18:53ab) xor a ld [wJoyIgnore], a - ld [W_SSANNE2CURSCRIPT], a + ld [wSSAnne2CurScript], a ret SSAnne2ScriptPointers: ; 613b3 (18:53b3) @@ -51,7 +51,7 @@ SSAnne2Script0: ; 613be (18:53be) .asm_61403 call MoveSprite ld a, $1 - ld [W_SSANNE2CURSCRIPT], a + ld [wSSAnne2CurScript], a ret MovementData_6140c: ; 6140c (18:540c) @@ -101,7 +101,7 @@ SSAnne2Script1: ; 61430 (18:5430) ld [wTrainerNo], a call SSAnne2Script_61416 ld a, $2 - ld [W_SSANNE2CURSCRIPT], a + ld [wSSAnne2CurScript], a ret SSAnne2Script2: ; 6146d (18:546d) @@ -131,7 +131,7 @@ SSAnne2Script2: ; 6146d (18:546d) call StopAllMusic callba Music_RivalAlternateStart ld a, $3 - ld [W_SSANNE2CURSCRIPT], a + ld [wSSAnne2CurScript], a ret MovementData_614b7: ; 614b7 (18:54b7) @@ -156,7 +156,7 @@ SSAnne2Script3: ; 614be (18:54be) predef HideObject call PlayDefaultMusic ld a, $4 - ld [W_SSANNE2CURSCRIPT], a + ld [wSSAnne2CurScript], a ret SSAnne2TextPointers: ; 614db (18:54db) diff --git a/scripts/ssanne5.asm b/scripts/ssanne5.asm index 76553563..698e9f14 100755 --- a/scripts/ssanne5.asm +++ b/scripts/ssanne5.asm @@ -2,9 +2,9 @@ SSAnne5Script: ; 616ae (18:56ae) 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: ; 616c1 (18:56c1) diff --git a/scripts/ssanne8.asm b/scripts/ssanne8.asm index 195c9a81..2e7dcf67 100755 --- a/scripts/ssanne8.asm +++ b/scripts/ssanne8.asm @@ -2,9 +2,9 @@ SSAnne8Script: ; 61976 (18:5976) 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: ; 61989 (18:5989) diff --git a/scripts/ssanne9.asm b/scripts/ssanne9.asm index 43c3991e..e7350562 100755 --- a/scripts/ssanne9.asm +++ b/scripts/ssanne9.asm @@ -2,9 +2,9 @@ SSAnne9Script: ; 61b4b (18:5b4b) 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: ; 61b64 (18:5b64) diff --git a/scripts/unknowndungeon1.asm b/scripts/unknowndungeon1.asm index 9951dc52..3b5fae5d 100755 --- a/scripts/unknowndungeon1.asm +++ b/scripts/unknowndungeon1.asm @@ -1,7 +1,7 @@ -UnknownDungeon1Script: ; 74d0c (1d:4d0c) +UnknownDungeon1Script: jp EnableAutoTextBoxDrawing -UnknownDungeon1TextPointers: ; 74d0f (1d:4d0f) +UnknownDungeon1TextPointers: dw PickUpItemText dw PickUpItemText dw PickUpItemText diff --git a/scripts/unknowndungeon2.asm b/scripts/unknowndungeon2.asm index 2bf9fdb4..55ebb752 100755 --- a/scripts/unknowndungeon2.asm +++ b/scripts/unknowndungeon2.asm @@ -1,7 +1,7 @@ -UnknownDungeon2Script: ; 45e0b (11:5e0b) +UnknownDungeon2Script: jp EnableAutoTextBoxDrawing -UnknownDungeon2TextPointers: ; 45e0e (11:5e0e) +UnknownDungeon2TextPointers: dw PickUpItemText dw PickUpItemText dw PickUpItemText diff --git a/scripts/unknowndungeon3.asm b/scripts/unknowndungeon3.asm index 265df358..46a1cafd 100755 --- a/scripts/unknowndungeon3.asm +++ b/scripts/unknowndungeon3.asm @@ -1,44 +1,44 @@ -UnknownDungeon3Script: ; 45ef0 (11:5ef0) +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: ; 45f03 (11:5f03) +.ScriptPointers: dw CheckFightingMapTrainers dw DisplayEnemyTrainerTextAndStartBattle dw EndTrainerBattle -UnknownDungeon3TextPointers: ; 45f09 (11:5f09) - dw UnknownDungeon3Text1 +UnknownDungeon3TextPointers: + dw MewtwoText dw PickUpItemText dw PickUpItemText dw PickUpItemText dw PickUpItemText -UnknownDungeon3TrainerHeaders: ; 45f0f (11:5f0f) -UnknownDungeon3TrainerHeader0: ; 45f0f (11:5f0f) - dbEventFlagBit EVENT_BEAT_UNKNOWN_DUNGEON_3_TRAINER_0 +UnknownDungeon3TrainerHeaders: +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: ; 45f1c (11:5f1c) +MewtwoText: TX_ASM - ld hl, UnknownDungeon3TrainerHeader0 + ld hl, MewtwoTrainerHeader call TalkToTrainer jp TextScriptEnd -UnknownDungeon3MewtwoText: ; 45f26 (11:5f26) - 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 a8fc8ce7..0e33efb9 100755 --- a/scripts/vermilioncity.asm +++ b/scripts/vermilioncity.asm @@ -2,7 +2,7 @@ VermilionCityScript: ; 197a1 (6:57a1) call EnableAutoTextBoxDrawing ld hl, wPreventBlackout res 7, [hl] - ld hl, wd126 + ld hl, wCurrentMapScriptFlags bit 6, [hl] res 6, [hl] push hl @@ -12,7 +12,7 @@ VermilionCityScript: ; 197a1 (6:57a1) 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: ; 197cb (6:57cb) SetEventReuseHL EVENT_WALKED_PAST_GUARD_AFTER_SS_ANNE_LEFT ret nz ld a, $2 - ld [W_VERMILIONCITYCURSCRIPT], a + ld [wVermilionCityCurScript], a ret VermilionCityScriptPointers: ; 197dc (6:57dc) @@ -79,7 +79,7 @@ VermilionCityScript0: ; 197e6 (6:57e6) ld [wSimulatedJoypadStatesIndex], a call StartSimulatingJoypadStates ld a, $1 - ld [W_VERMILIONCITYCURSCRIPT], a + ld [wVermilionCityCurScript], a ret .asm_198de @@ -94,7 +94,7 @@ VermilionCityScript4: ; 19826 (6:5826) call ArePlayerCoordsInArray ret c ld a, $0 - ld [W_VERMILIONCITYCURSCRIPT], a + ld [wVermilionCityCurScript], a ret VermilionCityScript2: ; 19833 (6:5833) @@ -107,7 +107,7 @@ VermilionCityScript2: ; 19833 (6:5833) ld [wSimulatedJoypadStatesIndex], a call StartSimulatingJoypadStates ld a, $3 - ld [W_VERMILIONCITYCURSCRIPT], a + ld [wVermilionCityCurScript], a ret VermilionCityScript3: ; 1984e (6:584e) @@ -118,7 +118,7 @@ VermilionCityScript3: ; 1984e (6:584e) ld [wJoyIgnore], a ld [hJoyHeld], a ld a, $0 - ld [W_VERMILIONCITYCURSCRIPT], a + ld [wVermilionCityCurScript], a ret VermilionCityScript1: ; 1985f (6:585f) @@ -128,7 +128,7 @@ VermilionCityScript1: ; 1985f (6:585f) ld c, 10 call DelayFrames ld a, $0 - ld [W_VERMILIONCITYCURSCRIPT], a + ld [wVermilionCityCurScript], a ret VermilionCityTextPointers: ; 1986f (6:586f) @@ -201,7 +201,7 @@ VermilionCityText3: ; 198b1 (6:58b1) 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 d672a419..cd2b5b3c 100755 --- a/scripts/vermiliongym.asm +++ b/scripts/vermiliongym.asm @@ -1,5 +1,5 @@ VermilionGymScript: ; 5ca26 (17:4a26) - ld hl, wd126 + ld hl, wCurrentMapScriptFlags bit 5, [hl] res 5, [hl] push hl @@ -11,9 +11,9 @@ VermilionGymScript: ; 5ca26 (17:4a26) 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: ; 5ca4c (17:4a4c) @@ -44,8 +44,8 @@ VermilionGymScript_5ca6d: ; 5ca6d (17:4a6d) VermilionGymScript_5ca8a: ; 5ca8a (17:4a8a) xor a ld [wJoyIgnore], a - ld [W_VERMILIONGYMCURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wVermilionGymCurScript], a + ld [wCurMapScript], a ret VermilionGymScriptPointers: ; 5ca95 (17:4a95) @@ -160,8 +160,8 @@ VermilionGymText1: ; 5cb1d (17:4b1d) 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 ee88d393..0f4de43e 100755 --- a/scripts/victoryroad1.asm +++ b/scripts/victoryroad1.asm @@ -1,14 +1,14 @@ -VictoryRoad1Script: ; 5da0a (17:5a0a) - ld hl, wd126 +VictoryRoad1Script: + 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 @@ -18,12 +18,12 @@ VictoryRoad1Script: ; 5da0a (17:5a0a) lb bc, 6, 4 predef_jump ReplaceTileBlock -VictoryRoad1ScriptPointers: ; 5da3a (17:5a3a) +VictoryRoad1ScriptPointers: dw VictoryRoad1Script0 dw DisplayEnemyTrainerTextAndStartBattle dw EndTrainerBattle -VictoryRoad1Script0: ; 5da40 (17:5a40) +VictoryRoad1Script0: CheckEvent EVENT_VICTORY_ROAD_1_BOULDER_ON_SWITCH jp nz, CheckFightingMapTrainers ld hl, CoordsData_5da5c @@ -32,15 +32,15 @@ VictoryRoad1Script0: ; 5da40 (17:5a40) 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 -CoordsData_5da5c: ; 5da5c (17:5a5c) +CoordsData_5da5c: db $0D,$11,$FF -VictoryRoad1TextPointers: ; 5da5f (17:5a5f) +VictoryRoad1TextPointers: dw VictoryRoad1Text1 dw VictoryRoad1Text2 dw PickUpItemText @@ -49,8 +49,8 @@ VictoryRoad1TextPointers: ; 5da5f (17:5a5f) dw BoulderText dw BoulderText -VictoryRoad1TrainerHeaders: ; 5da6d (17:5a6d) -VictoryRoad1TrainerHeader0: ; 5da6d (17:5a6d) +VictoryRoad1TrainerHeaders: +VictoryRoad1TrainerHeader0: dbEventFlagBit EVENT_BEAT_VICTORY_ROAD_1_TRAINER_0 db ($2 << 4) ; trainer's view range dwEventFlagAddress EVENT_BEAT_VICTORY_ROAD_1_TRAINER_0 @@ -59,7 +59,7 @@ VictoryRoad1TrainerHeader0: ; 5da6d (17:5a6d) dw VictoryRoad1EndBattleText1 ; TextEndBattle dw VictoryRoad1EndBattleText1 ; TextEndBattle -VictoryRoad1TrainerHeader1: ; 5da79 (17:5a79) +VictoryRoad1TrainerHeader1: dbEventFlagBit EVENT_BEAT_VICTORY_ROAD_1_TRAINER_1 db ($2 << 4) ; trainer's view range dwEventFlagAddress EVENT_BEAT_VICTORY_ROAD_1_TRAINER_1 @@ -70,38 +70,38 @@ VictoryRoad1TrainerHeader1: ; 5da79 (17:5a79) db $ff -VictoryRoad1Text1: ; 5da86 (17:5a86) +VictoryRoad1Text1: TX_ASM ld hl, VictoryRoad1TrainerHeader0 call TalkToTrainer jp TextScriptEnd -VictoryRoad1Text2: ; 5da90 (17:5a90) +VictoryRoad1Text2: TX_ASM ld hl, VictoryRoad1TrainerHeader1 call TalkToTrainer jp TextScriptEnd -VictoryRoad1BattleText1: ; 5da9a (17:5a9a) +VictoryRoad1BattleText1: TX_FAR _VictoryRoad1BattleText1 db "@" -VictoryRoad1EndBattleText1: ; 5da9f (17:5a9f) +VictoryRoad1EndBattleText1: TX_FAR _VictoryRoad1EndBattleText1 db "@" -VictoryRoad1AfterBattleText1: ; 5daa4 (17:5aa4) +VictoryRoad1AfterBattleText1: TX_FAR _VictoryRoad1AfterBattleText1 db "@" -VictoryRoad1BattleText2: ; 5daa9 (17:5aa9) +VictoryRoad1BattleText2: TX_FAR _VictoryRoad1BattleText2 db "@" -VictoryRoad1EndBattleText2: ; 5daae (17:5aae) +VictoryRoad1EndBattleText2: TX_FAR _VictoryRoad1EndBattleText2 db "@" -VictoryRoad1AfterBattleText2: ; 5dab3 (17:5ab3) +VictoryRoad1AfterBattleText2: TX_FAR _VictoryRoad1AfterBattleText2 db "@" diff --git a/scripts/victoryroad2.asm b/scripts/victoryroad2.asm index 87635c2e..20a80461 100755 --- a/scripts/victoryroad2.asm +++ b/scripts/victoryroad2.asm @@ -1,23 +1,23 @@ -VictoryRoad2Script: ; 5179d (14:579d) - ld hl, wd126 +VictoryRoad2Script: + 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: ; 517c4 (14:57c4) +VictoryRoad2Script_517c4: ResetEvent EVENT_VICTORY_ROAD_1_BOULDER_ON_SWITCH -VictoryRoad2Script_517c9: ; 517c9 (14:57c9) +VictoryRoad2Script_517c9: CheckEvent EVENT_VICTORY_ROAD_2_BOULDER_ON_SWITCH1 jr z, .asm_517da push af @@ -30,17 +30,17 @@ VictoryRoad2Script_517c9: ; 517c9 (14:57c9) ret z ld a, $1d lb bc, 7, 11 -VictoryRoad2Script_517e2: ; 517e2 (14:57e2) +VictoryRoad2Script_517e2: ld [wNewTileBlockID], a predef ReplaceTileBlock ret -VictoryRoad2ScriptPointers: ; 517eb (14:57eb) +VictoryRoad2ScriptPointers: dw VictoryRoad2Script0 dw DisplayEnemyTrainerTextAndStartBattle dw EndTrainerBattle -VictoryRoad2Script0: ; 517f1 (14:57f1) +VictoryRoad2Script0: ld hl, CoordsData_51816 call CheckBoulderCoords jp nc, CheckFightingMapTrainers @@ -60,22 +60,22 @@ VictoryRoad2Script0: ; 517f1 (14:57f1) SetEventReuseHL EVENT_VICTORY_ROAD_2_BOULDER_ON_SWITCH2 ret nz .asm_51810 - ld hl, wd126 + ld hl, wCurrentMapScriptFlags set 5, [hl] ret -CoordsData_51816: ; 51816 (14:5816) +CoordsData_51816: db $10,$01 db $10,$09 db $FF -VictoryRoad2TextPointers: ; 5181b (14:581b) +VictoryRoad2TextPointers: dw VictoryRoad2Text1 dw VictoryRoad2Text2 dw VictoryRoad2Text3 dw VictoryRoad2Text4 dw VictoryRoad2Text5 - dw VictoryRoad2Text6 + dw MoltresText dw PickUpItemText dw PickUpItemText dw PickUpItemText @@ -84,8 +84,8 @@ VictoryRoad2TextPointers: ; 5181b (14:581b) dw BoulderText dw BoulderText -VictoryRoad2TrainerHeaders: ; 51835 (14:5835) -VictoryRoad2TrainerHeader0: ; 51835 (14:5835) +VictoryRoad2TrainerHeaders: +VictoryRoad2TrainerHeader0: dbEventFlagBit EVENT_BEAT_VICTORY_ROAD_2_TRAINER_0 db ($4 << 4) ; trainer's view range dwEventFlagAddress EVENT_BEAT_VICTORY_ROAD_2_TRAINER_0 @@ -94,7 +94,7 @@ VictoryRoad2TrainerHeader0: ; 51835 (14:5835) dw VictoryRoad2EndBattleText1 ; TextEndBattle dw VictoryRoad2EndBattleText1 ; TextEndBattle -VictoryRoad2TrainerHeader2: ; 51841 (14:5841) +VictoryRoad2TrainerHeader2: dbEventFlagBit EVENT_BEAT_VICTORY_ROAD_2_TRAINER_2 db ($3 << 4) ; trainer's view range dwEventFlagAddress EVENT_BEAT_VICTORY_ROAD_2_TRAINER_2 @@ -103,7 +103,7 @@ VictoryRoad2TrainerHeader2: ; 51841 (14:5841) dw VictoryRoad2EndBattleText2 ; TextEndBattle dw VictoryRoad2EndBattleText2 ; TextEndBattle -VictoryRoad2TrainerHeader3: ; 5184d (14:584d) +VictoryRoad2TrainerHeader3: dbEventFlagBit EVENT_BEAT_VICTORY_ROAD_2_TRAINER_3 db ($3 << 4) ; trainer's view range dwEventFlagAddress EVENT_BEAT_VICTORY_ROAD_2_TRAINER_3 @@ -112,7 +112,7 @@ VictoryRoad2TrainerHeader3: ; 5184d (14:584d) dw VictoryRoad2EndBattleText3 ; TextEndBattle dw VictoryRoad2EndBattleText3 ; TextEndBattle -VictoryRoad2TrainerHeader4: ; 51859 (14:5859) +VictoryRoad2TrainerHeader4: dbEventFlagBit EVENT_BEAT_VICTORY_ROAD_2_TRAINER_4 db ($1 << 4) ; trainer's view range dwEventFlagAddress EVENT_BEAT_VICTORY_ROAD_2_TRAINER_4 @@ -121,7 +121,7 @@ VictoryRoad2TrainerHeader4: ; 51859 (14:5859) dw VictoryRoad2EndBattleText4 ; TextEndBattle dw VictoryRoad2EndBattleText4 ; TextEndBattle -VictoryRoad2TrainerHeader5: ; 51865 (14:5865) +VictoryRoad2TrainerHeader5: dbEventFlagBit EVENT_BEAT_VICTORY_ROAD_2_TRAINER_5 db ($3 << 4) ; trainer's view range dwEventFlagAddress EVENT_BEAT_VICTORY_ROAD_2_TRAINER_5 @@ -130,117 +130,117 @@ VictoryRoad2TrainerHeader5: ; 51865 (14:5865) dw VictoryRoad2EndBattleText5 ; TextEndBattle dw VictoryRoad2EndBattleText5 ; TextEndBattle -VictoryRoad2TrainerHeader6: ; 51871 (14:5871) - 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 -VictoryRoad2Text1: ; 5187e (14:587e) +VictoryRoad2Text1: TX_ASM ld hl, VictoryRoad2TrainerHeader0 call TalkToTrainer jp TextScriptEnd -VictoryRoad2Text2: ; 51888 (14:5888) +VictoryRoad2Text2: TX_ASM ld hl, VictoryRoad2TrainerHeader2 call TalkToTrainer jp TextScriptEnd -VictoryRoad2Text3: ; 51892 (14:5892) +VictoryRoad2Text3: TX_ASM ld hl, VictoryRoad2TrainerHeader3 call TalkToTrainer jp TextScriptEnd -VictoryRoad2Text4: ; 5189c (14:589c) +VictoryRoad2Text4: TX_ASM ld hl, VictoryRoad2TrainerHeader4 call TalkToTrainer jp TextScriptEnd -VictoryRoad2Text5: ; 518a6 (14:58a6) +VictoryRoad2Text5: TX_ASM ld hl, VictoryRoad2TrainerHeader5 call TalkToTrainer jp TextScriptEnd -VictoryRoad2Text6: ; 518b0 (14:58b0) +MoltresText: TX_ASM - ld hl, VictoryRoad2TrainerHeader6 + ld hl, MoltresTrainerHeader call TalkToTrainer jp TextScriptEnd -VictoryRoad2BattleText6: ; 518ba (14:58ba) - TX_FAR _VictoryRoad2BattleText6 +MoltresBattleText: + TX_FAR _MoltresBattleText TX_ASM ld a, MOLTRES call PlayCry call WaitForSoundToFinish jp TextScriptEnd -VictoryRoad2BattleText1: ; 518ca (14:58ca) +VictoryRoad2BattleText1: TX_FAR _VictoryRoad2BattleText1 db "@" -VictoryRoad2EndBattleText1: ; 518cf (14:58cf) +VictoryRoad2EndBattleText1: TX_FAR _VictoryRoad2EndBattleText1 db "@" -VictoryRoad2AfterBattleText1: ; 518d4 (14:58d4) +VictoryRoad2AfterBattleText1: TX_FAR _VictoryRoad2AfterBattleText1 db "@" -VictoryRoad2BattleText2: ; 518d9 (14:58d9) +VictoryRoad2BattleText2: TX_FAR _VictoryRoad2BattleText2 db "@" -VictoryRoad2EndBattleText2: ; 518de (14:58de) +VictoryRoad2EndBattleText2: TX_FAR _VictoryRoad2EndBattleText2 db "@" -VictoryRoad2AfterBattleText2: ; 518e3 (14:58e3) +VictoryRoad2AfterBattleText2: TX_FAR _VictoryRoad2AfterBattleText2 db "@" -VictoryRoad2BattleText3: ; 518e8 (14:58e8) +VictoryRoad2BattleText3: TX_FAR _VictoryRoad2BattleText3 db "@" -VictoryRoad2EndBattleText3: ; 518ed (14:58ed) +VictoryRoad2EndBattleText3: TX_FAR _VictoryRoad2EndBattleText3 db "@" -VictoryRoad2AfterBattleText3: ; 518f2 (14:58f2) +VictoryRoad2AfterBattleText3: TX_FAR _VictoryRoad2AfterBattleText3 db "@" -VictoryRoad2BattleText4: ; 518f7 (14:58f7) +VictoryRoad2BattleText4: TX_FAR _VictoryRoad2BattleText4 db "@" -VictoryRoad2EndBattleText4: ; 518fc (14:58fc) +VictoryRoad2EndBattleText4: TX_FAR _VictoryRoad2EndBattleText4 db "@" -VictoryRoad2AfterBattleText4: ; 51901 (14:5901) +VictoryRoad2AfterBattleText4: TX_FAR _VictoryRoad2AfterBattleText4 db "@" -VictoryRoad2BattleText5: ; 51906 (14:5906) +VictoryRoad2BattleText5: TX_FAR _VictoryRoad2BattleText5 db "@" -VictoryRoad2EndBattleText5: ; 5190b (14:590b) +VictoryRoad2EndBattleText5: TX_FAR _VictoryRoad2EndBattleText5 db "@" -VictoryRoad2AfterBattleText5: ; 51910 (14:5910) +VictoryRoad2AfterBattleText5: TX_FAR _VictoryRoad2AfterBattleText5 db "@" diff --git a/scripts/victoryroad3.asm b/scripts/victoryroad3.asm index 72e13775..31e06053 100755 --- a/scripts/victoryroad3.asm +++ b/scripts/victoryroad3.asm @@ -1,15 +1,15 @@ -VictoryRoad3Script: ; 44980 (11:4980) +VictoryRoad3Script: call VictoryRoad3Script_44996 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: ; 44996 (11:4996) - ld hl, wd126 +VictoryRoad3Script_44996: + ld hl, wCurrentMapScriptFlags bit 5, [hl] res 5, [hl] ret z @@ -20,12 +20,12 @@ VictoryRoad3Script_44996: ; 44996 (11:4996) lb bc, 5, 3 predef_jump ReplaceTileBlock -VictoryRoad3ScriptPointers: ; 449b1 (11:49b1) +VictoryRoad3ScriptPointers: dw VictoryRoad3Script0 dw DisplayEnemyTrainerTextAndStartBattle dw EndTrainerBattle -VictoryRoad3Script0: ; 449b7 (11:49b7) +VictoryRoad3Script0: ld hl, wFlags_0xcd60 bit 7, [hl] res 7, [hl] @@ -39,7 +39,7 @@ VictoryRoad3Script0: ; 449b7 (11:49b7) 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 @@ -53,7 +53,7 @@ VictoryRoad3Script0: ; 449b7 (11:49b7) ld [wMissableObjectIndex], a predef_jump ShowObject -.coordsData_449f9: ; 449f9 (11:49f9) +.coordsData_449f9: db $05,$03 db $0F,$17 db $FF @@ -77,7 +77,7 @@ VictoryRoad3Script0: ; 449b7 (11:49b7) jp z, CheckFightingMapTrainers ret -VictoryRoad3TextPointers: ; 44a24 (11:4a24) +VictoryRoad3TextPointers: dw VictoryRoad3Text1 dw VictoryRoad3Text2 dw VictoryRoad3Text3 @@ -89,8 +89,8 @@ VictoryRoad3TextPointers: ; 44a24 (11:4a24) dw BoulderText dw BoulderText -VictoryRoad3TrainerHeaders: ; 44a38 (11:4a38) -VictoryRoad3TrainerHeader0: ; 44a38 (11:4a38) +VictoryRoad3TrainerHeaders: +VictoryRoad3TrainerHeader0: dbEventFlagBit EVENT_BEAT_VICTORY_ROAD_3_TRAINER_0 db ($1 << 4) ; trainer's view range dwEventFlagAddress EVENT_BEAT_VICTORY_ROAD_3_TRAINER_0 @@ -99,7 +99,7 @@ VictoryRoad3TrainerHeader0: ; 44a38 (11:4a38) dw VictoryRoad3EndBattleText2 ; TextEndBattle dw VictoryRoad3EndBattleText2 ; TextEndBattle -VictoryRoad3TrainerHeader2: ; 44a44 (11:4a44) +VictoryRoad3TrainerHeader2: dbEventFlagBit EVENT_BEAT_VICTORY_ROAD_3_TRAINER_2 db ($4 << 4) ; trainer's view range dwEventFlagAddress EVENT_BEAT_VICTORY_ROAD_3_TRAINER_2 @@ -108,7 +108,7 @@ VictoryRoad3TrainerHeader2: ; 44a44 (11:4a44) dw VictoryRoad3EndBattleText3 ; TextEndBattle dw VictoryRoad3EndBattleText3 ; TextEndBattle -VictoryRoad3TrainerHeader3: ; 44a50 (11:4a50) +VictoryRoad3TrainerHeader3: dbEventFlagBit EVENT_BEAT_VICTORY_ROAD_3_TRAINER_3 db ($4 << 4) ; trainer's view range dwEventFlagAddress EVENT_BEAT_VICTORY_ROAD_3_TRAINER_3 @@ -117,7 +117,7 @@ VictoryRoad3TrainerHeader3: ; 44a50 (11:4a50) dw VictoryRoad3EndBattleText4 ; TextEndBattle dw VictoryRoad3EndBattleText4 ; TextEndBattle -VictoryRoad3TrainerHeader4: ; 44a5c (11:4a5c) +VictoryRoad3TrainerHeader4: dbEventFlagBit EVENT_BEAT_VICTORY_ROAD_3_TRAINER_4 db ($4 << 4) ; trainer's view range dwEventFlagAddress EVENT_BEAT_VICTORY_ROAD_3_TRAINER_4 @@ -128,74 +128,74 @@ VictoryRoad3TrainerHeader4: ; 44a5c (11:4a5c) db $ff -VictoryRoad3Text1: ; 44a69 (11:4a69) +VictoryRoad3Text1: TX_ASM ld hl, VictoryRoad3TrainerHeader0 call TalkToTrainer jp TextScriptEnd -VictoryRoad3Text2: ; 44a73 (11:4a73) +VictoryRoad3Text2: TX_ASM ld hl, VictoryRoad3TrainerHeader2 call TalkToTrainer jp TextScriptEnd -VictoryRoad3Text3: ; 44a7d (11:4a7d) +VictoryRoad3Text3: TX_ASM ld hl, VictoryRoad3TrainerHeader3 call TalkToTrainer jp TextScriptEnd -VictoryRoad3Text4: ; 44a87 (11:4a87) +VictoryRoad3Text4: TX_ASM ld hl, VictoryRoad3TrainerHeader4 call TalkToTrainer jp TextScriptEnd -VictoryRoad3BattleText2: ; 44a91 (11:4a91) +VictoryRoad3BattleText2: TX_FAR _VictoryRoad3BattleText2 db "@" -VictoryRoad3EndBattleText2: ; 44a96 (11:4a96) +VictoryRoad3EndBattleText2: TX_FAR _VictoryRoad3EndBattleText2 db "@" -VictoryRoad3AfterBattleText2: ; 44a9b (11:4a9b) +VictoryRoad3AfterBattleText2: TX_FAR _VictoryRoad3AfterBattleText2 db "@" -VictoryRoad3BattleText3: ; 44aa0 (11:4aa0) +VictoryRoad3BattleText3: TX_FAR _VictoryRoad3BattleText3 db "@" -VictoryRoad3EndBattleText3: ; 44aa5 (11:4aa5) +VictoryRoad3EndBattleText3: TX_FAR _VictoryRoad3EndBattleText3 db "@" -VictoryRoad3AfterBattleText3: ; 44aaa (11:4aaa) +VictoryRoad3AfterBattleText3: TX_FAR _VictoryRoad3AfterBattleText3 db "@" -VictoryRoad3BattleText4: ; 44aaf (11:4aaf) +VictoryRoad3BattleText4: TX_FAR _VictoryRoad3BattleText4 db "@" -VictoryRoad3EndBattleText4: ; 44ab4 (11:4ab4) +VictoryRoad3EndBattleText4: TX_FAR _VictoryRoad3EndBattleText4 db "@" -VictoryRoad3AfterBattleText4: ; 44ab9 (11:4ab9) +VictoryRoad3AfterBattleText4: TX_FAR _VictoryRoad3AfterBattleText4 db "@" -VictoryRoad3BattleText5: ; 44abe (11:4abe) +VictoryRoad3BattleText5: TX_FAR _VictoryRoad3BattleText5 db "@" -VictoryRoad3EndBattleText5: ; 44ac3 (11:4ac3) +VictoryRoad3EndBattleText5: TX_FAR _VictoryRoad3EndBattleText5 db "@" -VictoryRoad3AfterBattleText5: ; 44ac8 (11:4ac8) +VictoryRoad3AfterBattleText5: TX_FAR _VictoryRoad3AfterBattleText5 db "@" diff --git a/scripts/viridiancity.asm b/scripts/viridiancity.asm index c20285bc..b062111f 100755 --- a/scripts/viridiancity.asm +++ b/scripts/viridiancity.asm @@ -1,7 +1,7 @@ ViridianCityScript: ; 1902a (6:502a) 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: ; 1909d @@ -67,7 +67,7 @@ ViridianCityScript6: ; 1909d 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: ; 190ca @@ -92,13 +92,13 @@ ViridianCityScript3: ; 190ca 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: ; 19104 ld [wBattleType], a ld [wJoyIgnore], a ld a, $2 - ld [W_VIRIDIANCITYCURSCRIPT], a + ld [wViridianCityCurScript], a ret ViridianCityScript_1912a: @@ -151,7 +151,7 @@ ViridianCityScript5: ; 1913f ret nz call Delay3 ld a, $0 - ld [W_VIRIDIANCITYCURSCRIPT], a + ld [wViridianCityCurScript], a ret ViridianCityScript_1914d: @@ -195,7 +195,7 @@ ViridianCityScript7: ; 19191 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: ; 191a7 @@ -213,7 +213,7 @@ ViridianCityScript8: ; 191a7 dec a ld [wJoyIgnore], a ld a, $9 - ld [W_VIRIDIANCITYCURSCRIPT], a + ld [wViridianCityCurScript], a ret ViridianCityScript9: ; 191cf @@ -228,7 +228,7 @@ ViridianCityScript9: ; 191cf ld [hSpriteIndexOrTextID], a call MoveSprite ld a, $a - ld [W_VIRIDIANCITYCURSCRIPT], a + ld [wViridianCityCurScript], a ret ViridianCityOldManMovementData1: @@ -252,7 +252,7 @@ ViridianCityScript10: ; 191f9 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 8feffe59..33f4ee2c 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 8ac0d8a8..e0e022dd 100755 --- a/scripts/viridianforest.asm +++ b/scripts/viridianforest.asm @@ -2,9 +2,9 @@ ViridianForestScript: ; 6110d (18:510d) 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: ; 61120 (18:5120) diff --git a/scripts/viridiangym.asm b/scripts/viridiangym.asm index 873a397d..cdbe939b 100755 --- a/scripts/viridiangym.asm +++ b/scripts/viridiangym.asm @@ -5,9 +5,9 @@ ViridianGymScript: ; 748a3 (1d:48a3) 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: ; 748bf (1d:48bf) @@ -18,8 +18,8 @@ Gym8LeaderName: ; 748cd (1d:48cd) ViridianGymScript_748d6: ; 748d6 (1d:48d6) xor a ld [wJoyIgnore], a - ld [W_VIRIDIANGYMCURSCRIPT], a - ld [W_CURMAPSCRIPT], a + ld [wViridianGymCurScript], a + ld [wCurMapScript], a ret ViridianGymScriptPointers: ; 748e1 (1d:48e1) @@ -46,7 +46,7 @@ ViridianGymScript0: ; 748eb (1d:48eb) ld a, $ff ld [wJoyIgnore], a ld a, $4 - ld [W_CURMAPSCRIPT], a + ld [wCurMapScript], a ret ;format: @@ -125,7 +125,7 @@ ViridianGymScript4: ; 7496b (1d:496b) 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: ; 74a69 (1d:4a69) 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 b69e24c2..18832353 100755 --- a/scripts/viridianmart.asm +++ b/scripts/viridianmart.asm @@ -2,7 +2,7 @@ ViridianMartScript: ; 1d46e (7:546e) call ViridianMartScript_1d47d call EnableAutoTextBoxDrawing ld hl, ViridianMartScriptPointers - ld a, [W_VIRIDIANMARKETCURSCRIPT] + ld a, [wViridianMarketCurScript] call JumpTable ret @@ -37,7 +37,7 @@ ViridianMartScript0: ; 1d49b (7:549b) ld [wSimulatedJoypadStatesIndex], a call StartSimulatingJoypadStates ld a, $1 - ld [W_VIRIDIANMARKETCURSCRIPT], a + ld [wViridianMarketCurScript], a ret RLEMovement1d4bb: ; 1d4bb (7:54bb) @@ -57,7 +57,7 @@ ViridianMartScript1: ; 1d4c0 (7:54c0) call GiveItem SetEvent EVENT_GOT_OAKS_PARCEL ld a, $2 - ld [W_VIRIDIANMARKETCURSCRIPT], a + ld [wViridianMarketCurScript], a ret ViridianMartScript2: ; 1d4df (7:54df) @@ -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" @@ -947,7 +947,7 @@ _ViridianBlackboardPoisonText:: line "to cure poison!" prompt -_ViridianBlackbaordPrlzText:: +_ViridianBlackboardPrlzText:: text "Paralysis could" line "make #MON" cont "moves misfire!" @@ -990,7 +990,7 @@ _VermilionGymTrashText:: line "only trash here." done -_VermilionGymTrashSuccesText1:: +_VermilionGymTrashSuccessText1:: text "Hey! There's a" line "switch under the" cont "trash!" @@ -999,14 +999,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 eb0287af..51258818 100644 --- a/text/maps/champion.asm +++ b/text/maps/champion.asm @@ -1,4 +1,4 @@ -_GaryText_760f4:: +_GaryChampionIntroText:: text $53, ": Hey!" para "I was looking" @@ -35,7 +35,7 @@ _GaryText_760f4:: 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 c4649f4f..dccb43c0 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 bea7df28..4db8467f 100644 --- a/text/maps/unknown_dungeon_b1f.asm +++ b/text/maps/unknown_dungeon_b1f.asm @@ -1,3 +1,3 @@ -_UnknownDungeon3MewtwoText:: +_MewtwoBattleText:: text "Mew!@@" diff --git a/text/maps/victory_road_2f.asm b/text/maps/victory_road_2f.asm index 390d8d54..bc1b6cd9 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 @@ -228,7 +229,39 @@ wSpriteStateData1:: ; c100 ; C1xD ; C1xE ; C1xF - ds $10 * $10 +spritestatedata1: MACRO +\1SpriteStateData1:: +\1PictureID:: db +\1MovementStatus:: db +\1SpriteImageIdx:: db +\1YStepVector:: db +\1YPixels:: db +\1XStepVector:: db +\1XPixels:: db +\1IntraAnimFrameCounter:: db +\1AnimFrameCounter:: db +\1FacingDirection:: db + ds 6 +\1SpriteStateData1End:: +endm + + spritestatedata1 Player + spritestatedata1 Sprite01 + spritestatedata1 Sprite02 + spritestatedata1 Sprite03 + spritestatedata1 Sprite04 + spritestatedata1 Sprite05 + spritestatedata1 Sprite06 + spritestatedata1 Sprite07 + spritestatedata1 Sprite08 + spritestatedata1 Sprite09 + spritestatedata1 Sprite10 + spritestatedata1 Sprite11 + spritestatedata1 Sprite12 + spritestatedata1 Sprite13 + spritestatedata1 Sprite14 + spritestatedata1 Sprite15 + ; ds $10 * $10 ;SECTION "Sprite State Data 2", WRAM0[$c200] @@ -253,7 +286,40 @@ wSpriteStateData2:: ; c200 ; C2xD ; C2xE: sprite image base offset (in video ram, player always has value 1, used to compute c1x2) ; C2xF - ds $10 * $10 +spritestatedata2: MACRO +\1SpriteStateData2:: +\1WalkAnimationCounter:: db + ds 1 +\1YDisplacement:: db +\1XDisplacement:: db +\1MapY:: db +\1MapX:: db +\1MovementByte1:: db +\1GrassPriority:: db +\1MovementDelay:: db + ds 5 +\1SpriteImageBaseOffset:: db + ds 1 +\1SpriteStateData2End:: +endm + + spritestatedata2 Player + spritestatedata2 Sprite01 + spritestatedata2 Sprite02 + spritestatedata2 Sprite03 + spritestatedata2 Sprite04 + spritestatedata2 Sprite05 + spritestatedata2 Sprite06 + spritestatedata2 Sprite07 + spritestatedata2 Sprite08 + spritestatedata2 Sprite09 + spritestatedata2 Sprite10 + spritestatedata2 Sprite11 + spritestatedata2 Sprite12 + spritestatedata2 Sprite13 + spritestatedata2 Sprite14 + spritestatedata2 Sprite15 + ; ds $10 * $10 wSpriteDataEnd:: @@ -1854,7 +1920,7 @@ wPlayerNumAttacksLeft:: ; when the player is attacking multiple times, the number of attacks left ds 1 -W_PLAYERCONFUSEDCOUNTER:: ; d06b +wPlayerConfusedCounter:: ; d06b ds 1 wPlayerToxicCounter:: ; d06c @@ -1870,7 +1936,7 @@ wEnemyNumAttacksLeft:: ; d06f ; when the enemy is attacking multiple times, the number of attacks left ds 1 -W_ENEMYCONFUSEDCOUNTER:: ; d070 +wEnemyConfusedCounter:: ; d070 ds 1 wEnemyToxicCounter:: ; d071 @@ -1908,6 +1974,11 @@ wObjectToShow:: ; d07a ds 1 +wDefaultMap:: ; d07c +; the map you will start at when the debug bit is set + +wMenuItemOffset:: ; d07c + wAnimationID:: ; d07c ; ID number of the current battle animation ds 1 @@ -2078,50 +2149,50 @@ wSlideMonUpBottomRowLeftTile:: ; d09f wDisableVBlankWYUpdate:: ds 1 ; if non-zero, don't update WY during V-blank -W_SPRITECURPOSX:: ; d0a1 +wSpriteCurPosX:: ; d0a1 ds 1 -W_SPRITECURPOSY:: ; d0a2 +wSpriteCurPosY:: ; d0a2 ds 1 -W_SPRITEWITDH:: ; d0a3 +wSpriteWidth:: ; d0a3 ds 1 -W_SPRITEHEIGHT:: ; d0a4 +wSpriteHeight:: ; d0a4 ds 1 -W_SPRITEINPUTCURBYTE:: ; d0a5 +wSpriteInputCurByte:: ; d0a5 ; current input byte ds 1 -W_SPRITEINPUTBITCOUNTER:: ; d0a6 +wSpriteInputBitCounter:: ; d0a6 ; bit offset of last read input bit ds 1 -W_SPRITEOUTPUTBITOFFSET:: ; d0a7; determines where in the output byte the two bits are placed. Each byte contains four columns (2bpp data) +wSpriteOutputBitOffset:: ; d0a7; 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:: ; d0a8 +wSpriteLoadFlags:: ; d0a8 ; 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:: ; d0a9 +wSpriteUnpackMode:: ; d0a9 ds 1 wSpriteFlipped:: ; d0aa ds 1 -W_SPRITEINPUTPTR:: ; d0ab +wSpriteInputPtr:: ; d0ab ; pointer to next input byte ds 2 -W_SPRITEOUTPUTPTR:: ; d0ad +wSpriteOutputPtr:: ; d0ad ; pointer to current output byte ds 2 -W_SPRITEOUTPUTPTRCACHED:: ; d0af +wSpriteOutputPtrCached:: ; d0af ; used to revert pointer for different bit offsets ds 2 -W_SPRITEDECODETABLE0PTR:: ; d0b1 +wSpriteDecodeTable0Ptr:: ; d0b1 ; pointer to differential decoding table (assuming initial value 0) ds 2 -W_SPRITEDECODETABLE1PTR:: ; d0b3 +wSpriteDecodeTable1Ptr:: ; d0b3 ; pointer to differential decoding table (assuming initial value 1) ds 2 @@ -2141,7 +2212,7 @@ wMonHIndex:: ; d0b8 ds 1 wMonHBaseStats:: ; d0b9 -W_MONHBASEHP:: ; d0b9 +wMonHBaseHP:: ; d0b9 ds 1 wMonHBaseAttack:: ; d0ba ds 1 @@ -2227,6 +2298,8 @@ wFirstMonsNotOutYet:: ; d11d ; 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:: ; d11e @@ -2270,7 +2343,7 @@ wIsKeyItem:: ; d124 wTextBoxID:: ; d125 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 +wCurrentMapScriptFlags:: ds 1 ; not exactly sure what this is used for, but it seems to be used as a multipurpose temp flag value wCurEnemyLVL:: ; d127 ds 1 @@ -2438,7 +2511,7 @@ wNumBagItems:: ; d31d ds 1 wBagItems:: ; d31e ; item, quantity - ds 20 * 2 + ds BAG_ITEM_CAPACITY * 2 ds 1 ; end wPlayerMoney:: ; d347 @@ -2461,7 +2534,7 @@ wOptions:: ; d355 ds 1 wObtainedBadges:: ; d356 - ds 1 + flag_array 8 ds 1 @@ -2524,20 +2597,20 @@ wCurMapWidth:: ; d369 ; blocks ds 1 -W_MAPDATAPTR:: ; d36a +wMapDataPtr:: ; d36a ds 2 wMapTextPtr:: ; d36c ds 2 -W_MAPSCRIPTPTR:: ; d36e +wMapScriptPtr:: ; d36e ds 2 -W_MAPCONNECTIONS:: ; d370 +wMapConnections:: ; d370 ; connection byte ds 1 -W_MAPCONN1PTR:: ; d371 +wMapConn1Ptr:: ; d371 ds 1 wNorthConnectionStripSrc:: ; d372 @@ -2561,7 +2634,7 @@ wNorthConnectedMapXAlignment:: ; d379 wNorthConnectedMapViewPointer:: ; d37a ds 2 -W_MAPCONN2PTR:: ; d37c +wMapConn2Ptr:: ; d37c ds 1 wSouthConnectionStripSrc:: ; d37d @@ -2585,7 +2658,7 @@ wSouthConnectedMapXAlignment:: ; d384 wSouthConnectedMapViewPointer:: ; d385 ds 2 -W_MAPCONN3PTR:: ; d387 +wMapConn3Ptr:: ; d387 ds 1 wWestConnectionStripSrc:: ; d388 @@ -2609,7 +2682,7 @@ wWestConnectedMapXAlignment:: ; d38f wWestConnectedMapViewPointer:: ; d390 ds 2 -W_MAPCONN4PTR:: ; d392 +wMapConn4Ptr:: ; d392 ds 1 wEastConnectionStripSrc:: ; d393 @@ -2793,7 +2866,7 @@ wPlayerDirection:: ; d52a wTilesetBank:: ; d52b ds 1 -W_TILESETBLOCKSPTR:: ; d52c +wTileSetBlocksPtr:: ; d52c ; maps blocks (4x4 tiles) to tiles ds 2 @@ -2804,7 +2877,7 @@ wTilesetCollisionPtr:: ; d530 ; list of all walkable tiles ds 2 -W_TILESETTALKINGOVERTILES:: ; d532 +wTileSetTalkingOverTiles:: ; d532 ds 3 wGrassTile:: ; d535 @@ -2816,7 +2889,7 @@ wNumBoxItems:: ; d53a ds 1 wBoxItems:: ; d53b ; item, quantity - ds 50 * 2 + ds PC_ITEM_CAPACITY * 2 ds 1 ; end wCurrentBoxNum:: ; d5a0 @@ -2853,217 +2926,217 @@ wMissableObjectList:: ; d5ce 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 @@ -3092,29 +3165,29 @@ wSafariSteps:: ; d70d ; starts at 502 ds 2 -W_FOSSILITEM:: ; d70f +wFossilItem:: ; d70f ; item given to cinnabar lab ds 1 -W_FOSSILMON:: ; d710 +wFossilMon:: ; d710 ; mon that will result from the item ds 1 ds 2 -W_ENEMYMONORTRAINERCLASS:: ; d713 +wEnemyMonOrTrainerClass:: ; d713 ; trainer classes start at 200 ds 1 wPlayerJumpingYScreenCoordsIndex:: ; d714 ds 1 -W_RIVALSTARTER:: ; d715 +wRivalStarter:: ; d715 ds 1 ds 1 -W_PLAYERSTARTER:: ; d717 +wPlayerStarter:: ; d717 ds 1 wBoulderSpriteIndex:: ; d718 @@ -3149,8 +3222,14 @@ wUnusedD71F:: ; d71f ds 8 -wd728:: +wd728:: ; d728 ; 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 @@ -3164,16 +3243,36 @@ wBeatGymFlags:: ; d72a wd72c:: ; d72c ; bit 0: if not set, the 3 minimum steps between random battles have passed +; bit 1: prevent audio fade out + ds 1 + +wd72d:: ; d72d +; 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:: ; d72e +; 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 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 - -wd72e:: -; 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 -wd730:: +wd730:: ; d730 ; bit 0: NPC sprite being moved by script ; bit 5: ignore joypad input ; bit 6: print text with no delay between each letter @@ -3198,7 +3297,10 @@ wd732:: ; d732 wFlags_D733:: ; d733 ; 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 @@ -3431,17 +3533,19 @@ wOpponentAfterWrongAnswer:: ; da38 wUnusedDA38:: ; da38 ds 1 -W_CURMAPSCRIPT:: ; da39 +wCurMapScript:: ; da39 ; 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:: ; da40 - ds 2 -wPlayTimeMinutes:: ; da42 - ds 2 +wPlayTimeHours:: ; da41 + ds 1 +wPlayTimeMaxed:: ; da42 + ds 1 +wPlayTimeMinutes:: ; da43 + ds 1 wPlayTimeSeconds:: ; da44 ds 1 wPlayTimeFrames:: ; da45 |