From d001ced41b53271373753de835a9c3b3413dc318 Mon Sep 17 00:00:00 2001 From: vulcandth Date: Thu, 13 Jul 2023 20:27:56 -0500 Subject: Add macros, constants, and labels for map scripts and text (#367) This introduces `def_script_pointers`, `def_text_pointers`, and `object_const_def` macros, and applies them to all maps. Most other map labels have also been identified. --- engine/events/hidden_objects/safari_game.asm | 2 +- engine/items/item_effects.asm | 2 +- engine/overworld/auto_movement.asm | 4 ++-- engine/overworld/ledges.asm | 2 +- engine/overworld/player_state.asm | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) (limited to 'engine') diff --git a/engine/events/hidden_objects/safari_game.asm b/engine/events/hidden_objects/safari_game.asm index ea00be5a..6fac1afa 100644 --- a/engine/events/hidden_objects/safari_game.asm +++ b/engine/events/hidden_objects/safari_game.asm @@ -49,7 +49,7 @@ SafariZoneGameOver: ldh [hWarpDestinationMap], a ld a, $3 ld [wDestinationWarpID], a - ld a, $5 + ld a, SCRIPT_SAFARIZONEGATE_LEAVING_SAFARI ld [wSafariZoneGateCurScript], a SetEvent EVENT_SAFARI_GAME_OVER ld a, 1 diff --git a/engine/items/item_effects.asm b/engine/items/item_effects.asm index a89031b4..466b1423 100644 --- a/engine/items/item_effects.asm +++ b/engine/items/item_effects.asm @@ -1507,7 +1507,7 @@ ItemUseEscapeRope: ResetEvent EVENT_IN_SAFARI_ZONE xor a ld [wNumSafariBalls], a - ld [wSafariZoneGateCurScript], a + ld [wSafariZoneGateCurScript], a ; SCRIPT_SAFARIZONEGATE_DEFAULT inc a ld [wEscapedFromBattle], a ld [wActionResultOrTookBattleTurn], a ; item used diff --git a/engine/overworld/auto_movement.asm b/engine/overworld/auto_movement.asm index 9c078f08..75816886 100644 --- a/engine/overworld/auto_movement.asm +++ b/engine/overworld/auto_movement.asm @@ -3,7 +3,7 @@ PlayerStepOutFromDoor:: res 1, [hl] call IsPlayerStandingOnDoorTile jr nc, .notStandingOnDoor - ld a, $fc + ld a, SELECT | START | D_RIGHT | D_LEFT | D_UP | D_DOWN ld [wJoyIgnore], a ld hl, wd736 set 1, [hl] @@ -81,7 +81,7 @@ PalletMovementScript_OakMoveLeft: .done ld hl, wFlags_D733 set 1, [hl] - ld a, $fc + ld a, SELECT | START | D_RIGHT | D_LEFT | D_UP | D_DOWN ld [wJoyIgnore], a ret diff --git a/engine/overworld/ledges.asm b/engine/overworld/ledges.asm index f01ae5ef..89e4ef57 100644 --- a/engine/overworld/ledges.asm +++ b/engine/overworld/ledges.asm @@ -39,7 +39,7 @@ HandleLedges:: ldh a, [hJoyHeld] and e ret z - ld a, $ff + ld a, A_BUTTON | B_BUTTON | SELECT | START | D_RIGHT | D_LEFT | D_UP | D_DOWN ld [wJoyIgnore], a ld hl, wd736 set 6, [hl] ; jumping down ledge diff --git a/engine/overworld/player_state.asm b/engine/overworld/player_state.asm index 8d652cdf..80b132ac 100644 --- a/engine/overworld/player_state.asm +++ b/engine/overworld/player_state.asm @@ -56,12 +56,12 @@ CheckForceBikeOrSurf:: jr nz, .loop ; incorrect x-coord, check next item ld a, [wCurMap] cp SEAFOAM_ISLANDS_B3F - ld a, $2 + ld a, SCRIPT_SEAFOAMISLANDSB3F_MOVE_OBJECT ld [wSeafoamIslandsB3FCurScript], a jr z, .forceSurfing ld a, [wCurMap] cp SEAFOAM_ISLANDS_B4F - ld a, $2 + ld a, SCRIPT_SEAFOAMISLANDSB4F_MOVE_OBJECT ld [wSeafoamIslandsB4FCurScript], a jr z, .forceSurfing ;force bike riding -- cgit v1.3.1-sl0p From f46db37d508f0111ad44ad062ed3d83ba3282d1d Mon Sep 17 00:00:00 2001 From: SatoMew Date: Sat, 15 Jul 2023 23:36:59 +0100 Subject: Thoroughly document debug code (#410) --- constants/item_constants.asm | 2 +- constants/misc_constants.asm | 3 ++ data/maps/special_warps.asm | 10 +++--- engine/battle/core.asm | 25 +++++++++----- engine/battle/init_battle_variables.asm | 2 +- engine/debug/debug_menu.asm | 23 +++++++------ engine/debug/debug_party.asm | 24 ++++++------- engine/menus/main_menu.asm | 13 ++++--- engine/movie/oak_speech/oak_speech.asm | 17 ++++++--- engine/movie/title.asm | 8 ++--- engine/overworld/special_warps.asm | 61 ++++++++++++++++----------------- gfx/font.asm | 4 +-- home/npc_movement.asm | 6 ++-- home/overworld.asm | 10 +++--- home/text.asm | 6 +++- home/trainers.asm | 2 ++ ram/wram.asm | 19 +++------- scripts/HallOfFame.asm | 2 +- 18 files changed, 128 insertions(+), 109 deletions(-) (limited to 'engine') diff --git a/constants/item_constants.asm b/constants/item_constants.asm index edd70379..e25aadba 100644 --- a/constants/item_constants.asm +++ b/constants/item_constants.asm @@ -13,7 +13,7 @@ const POKE_BALL ; $04 const TOWN_MAP ; $05 const BICYCLE ; $06 - const SURFBOARD ; $07 buggy? + const SURFBOARD ; $07 const SAFARI_BALL ; $08 const POKEDEX ; $09 const MOON_STONE ; $0A diff --git a/constants/misc_constants.asm b/constants/misc_constants.asm index 84775608..a230b3d7 100644 --- a/constants/misc_constants.asm +++ b/constants/misc_constants.asm @@ -16,3 +16,6 @@ DEF TEXT_DELAY_SLOW EQU %101 ; 5 const_def 6 const BIT_BATTLE_SHIFT ; 6 const BIT_BATTLE_ANIMATION ; 7 + +; wd732 flags +DEF BIT_DEBUG_MODE EQU 1 diff --git a/data/maps/special_warps.asm b/data/maps/special_warps.asm index cad320ed..28cdbf6c 100644 --- a/data/maps/special_warps.asm +++ b/data/maps/special_warps.asm @@ -44,15 +44,15 @@ MACRO special_warp_spec db \4 ENDM -FirstMapSpec: +NewGameWarp: special_warp_spec REDS_HOUSE_2F, 3, 6, REDS_HOUSE_2 -TradeCenterSpec1: +TradeCenterPlayerWarp: special_warp_spec TRADE_CENTER, 3, 4, CLUB -TradeCenterSpec2: +TradeCenterFriendWarp: special_warp_spec TRADE_CENTER, 6, 4, CLUB -ColosseumSpec1: +ColosseumPlayerWarp: special_warp_spec COLOSSEUM, 3, 4, CLUB -ColosseumSpec2: +ColosseumFriendWarp: special_warp_spec COLOSSEUM, 6, 4, CLUB diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 4a0263e2..f976674a 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -2493,9 +2493,9 @@ MoveSelectionMenu: ; so it is necessary to put the di ei block to not cause tearing call TextBoxBorder hlcoord 4, 12 - ld [hl], $7a + ld [hl], "─" hlcoord 10, 12 - ld [hl], $7e + ld [hl], "┘" ei hlcoord 6, 13 call .writemoves @@ -2557,11 +2557,12 @@ MoveSelectionMenu: ld a, [wLinkState] cp LINK_STATE_BATTLING jr z, .matchedkeyspicked + ; Disable left, right, and START buttons in regular battles. ld a, [wFlags_D733] bit BIT_TEST_BATTLE, a ld b, D_UP | D_DOWN | A_BUTTON | B_BUTTON | SELECT jr z, .matchedkeyspicked - ld b, $ff + ld b, D_UP | D_DOWN | D_LEFT | D_RIGHT | A_BUTTON | B_BUTTON | SELECT | START .matchedkeyspicked ld a, b ld [hli], a ; wMenuWatchedKeys @@ -2585,8 +2586,12 @@ SelectMenuItem: call PlaceString jr .select .battleselect + ; Hide move swap cursor in TestBattle. ld a, [wFlags_D733] bit BIT_TEST_BATTLE, a + ; This causes PrintMenuItem to not run in TestBattle. + ; MoveSelectionMenu still draws part of its window, an issue + ; which did not seem to exist in the Japanese versions. jr nz, .select call PrintMenuItem ld a, [wMenuItemToSwap] @@ -2648,8 +2653,9 @@ SelectMenuItem: jr z, .disabled ld a, [wPlayerBattleStatus3] bit 3, a ; transformed - jr nz, .dummy ; game freak derp -.dummy + jr nz, .transformedMoveSelected +.transformedMoveSelected ; pointless + ; Allow moves copied by Transform to be used. ld a, [wCurrentMenuItem] ld hl, wBattleMonMoves ld c, a @@ -6085,6 +6091,7 @@ GetCurrentMove: jr .selected .player ld de, wPlayerMoveNum + ; Apply InitBattleVariables to TestBattle. ld a, [wFlags_D733] bit BIT_TEST_BATTLE, a ld a, [wTestBattlePlayerSelectedMove] @@ -6768,12 +6775,12 @@ InitOpponent: DetermineWildOpponent: ld a, [wd732] - bit 1, a - jr z, .notDebug + bit BIT_DEBUG_MODE, a + jr z, .notDebugMode ldh a, [hJoyHeld] - bit BIT_B_BUTTON, a + bit BIT_B_BUTTON, a ; disable wild encounters ret nz -.notDebug +.notDebugMode ld a, [wNumberOfNoRandomBattleStepsLeft] and a ret nz diff --git a/engine/battle/init_battle_variables.asm b/engine/battle/init_battle_variables.asm index dd9f9714..aa081296 100644 --- a/engine/battle/init_battle_variables.asm +++ b/engine/battle/init_battle_variables.asm @@ -20,7 +20,7 @@ InitBattleVariables: ld [hli], a ; wPlayerHPBarColor ld [hl], a ; wEnemyHPBarColor ld hl, wCanEvolveFlags - ld b, $3c + ld b, wMiscBattleDataEnd - wMiscBattleData .loop ld [hli], a dec b diff --git a/engine/debug/debug_menu.asm b/engine/debug/debug_menu.asm index 907acb8a..fbf136fe 100644 --- a/engine/debug/debug_menu.asm +++ b/engine/debug/debug_menu.asm @@ -56,7 +56,7 @@ IF DEF(_DEBUG) ; DEBUG ld hl, wd732 - set 1, [hl] + set BIT_DEBUG_MODE, [hl] jp StartNewGameDebug DebugBattlePlayerName: @@ -72,18 +72,23 @@ ELSE ret ENDC -TestBattle: +TestBattle: ; unreferenced except in _DEBUG .loop call GBPalNormal - ; Don't mess around - ; with obedience. + ; Don't mess around with obedience. ld a, 1 << BIT_EARTHBADGE ld [wObtainedBadges], a ld hl, wFlags_D733 set BIT_TEST_BATTLE, [hl] + ; wNumBagItems and wBagItems are not initialized here, + ; and their garbage values happen to act as if EXP_ALL + ; is in the bag at the end of the test battle. + ; pokeyellow fixes this by initializing them with a + ; list of items. + ; Reset the party. ld hl, wPartyCount xor a @@ -91,8 +96,7 @@ TestBattle: dec a ld [hl], a - ; Give the player a - ; level 20 Rhydon. + ; Give the player a level 20 Rhydon. ld a, RHYDON ld [wcf91], a ld a, 20 @@ -102,15 +106,14 @@ TestBattle: ld [wCurMap], a call AddPartyMon - ; Fight against a - ; level 20 Rhydon. + ; Fight against a level 20 Rhydon. ld a, RHYDON ld [wCurOpponent], a predef InitOpponent - ; When the battle ends, - ; do it all again. + ; When the battle ends, do it all again. + ; There are some graphical quirks in SGB mode. ld a, 1 ld [wUpdateSpritesEnabled], a ldh [hAutoBGTransferEnabled], a diff --git a/engine/debug/debug_party.asm b/engine/debug/debug_party.asm index 36eb8e6f..0c76bde1 100644 --- a/engine/debug/debug_party.asm +++ b/engine/debug/debug_party.asm @@ -1,13 +1,5 @@ -; This function is a debugging feature to give the player Tsunekazu Ishihara's -; favorite Pokemon. This is indicated by the overpowered Exeggutor, which -; Ishihara (president of Creatures Inc.) said was his favorite Pokemon in an ABC -; interview on February 8, 2000. -; "Exeggutor is my favorite. That's because I was always using this character -; while I was debugging the program." -; http://www.ign.com/articles/2000/02/09/abc-news-pokamon-chat-transcript - -SetIshiharaTeam: - ld de, IshiharaTeam +SetDebugNewGameParty: ; unreferenced except in _DEBUG + ld de, DebugNewGameParty .loop ld a, [de] cp -1 @@ -20,7 +12,11 @@ SetIshiharaTeam: call AddPartyMon jr .loop -IshiharaTeam: +DebugNewGameParty: ; unreferenced except in _DEBUG + ; Exeggutor is the only debug party member shared with Red, Green, and Japanese Blue. + ; "Tsunekazu Ishihara: Exeggutor is my favorite. That's because I was + ; always using this character while I was debugging the program." + ; From https://web.archive.org/web/20000607152840/http://pocket.ign.com/news/14973.html db EXEGGUTOR, 90 IF DEF(_DEBUG) db MEW, 5 @@ -35,13 +31,13 @@ IF DEF(_DEBUG) ENDC db -1 ; end -DebugStart: +PrepareNewGameDebug: ; dummy except in _DEBUG IF DEF(_DEBUG) xor a ; PLAYER_PARTY_DATA ld [wMonDataLocation], a ; Fly anywhere. - dec a ; $ff + dec a ; $ff (all bits) ld [wTownVisitedFlag], a ld [wTownVisitedFlag + 1], a @@ -49,7 +45,7 @@ IF DEF(_DEBUG) ld a, ~(1 << BIT_EARTHBADGE) ld [wObtainedBadges], a - call SetIshiharaTeam + call SetDebugNewGameParty ; Exeggutor gets four HM moves. ld hl, wPartyMon1Moves diff --git a/engine/menus/main_menu.asm b/engine/menus/main_menu.asm index 024def28..69b3b918 100644 --- a/engine/menus/main_menu.asm +++ b/engine/menus/main_menu.asm @@ -121,7 +121,7 @@ MainMenu: ld [wDestinationMap], a ld hl, wd732 set 2, [hl] ; fly warp or dungeon warp - call SpecialWarpIn + call PrepareForSpecialWarp jp SpecialEnterMap InitOptions: @@ -268,10 +268,10 @@ LinkMenu: ld c, 50 call DelayFrames ld hl, wd732 - res 1, [hl] + res BIT_DEBUG_MODE, [hl] ld a, [wDefaultMap] ld [wDestinationMap], a - call SpecialWarpIn + call PrepareForSpecialWarp ld c, 20 call DelayFrames xor a @@ -308,7 +308,12 @@ LinkCanceledText: StartNewGame: ld hl, wd732 - res 1, [hl] + ; Ensure debug mode is not used when + ; starting a regular new game. + ; Debug mode persists in saved games for + ; both debug and non-debug builds, and is + ; only reset here by the main menu. + res BIT_DEBUG_MODE, [hl] ; fallthrough StartNewGameDebug: call OakSpeech diff --git a/engine/movie/oak_speech/oak_speech.asm b/engine/movie/oak_speech/oak_speech.asm index 3a08372d..4ed4735e 100644 --- a/engine/movie/oak_speech/oak_speech.asm +++ b/engine/movie/oak_speech/oak_speech.asm @@ -3,6 +3,11 @@ PrepareOakSpeech: push af ld a, [wOptions] push af + ; Retrieve BIT_DEBUG_MODE set in DebugMenu for StartNewGameDebug. + ; BUG: StartNewGame carries over bit 5 from previous save files, + ; which causes CheckForceBikeOrSurf to not return. + ; To fix this in debug builds, reset bit 5 here or in StartNewGame. + ; In non-debug builds, the instructions can be removed. ld a, [wd732] push af ld hl, wPlayerName @@ -24,6 +29,7 @@ PrepareOakSpeech: call z, InitOptions ; These debug names are used for StartNewGameDebug. ; TestBattle uses the debug names from DebugMenu. + ; A variant of this process is performed in PrepareTitleScreen. ld hl, DebugNewGamePlayerName ld de, wPlayerName ld bc, NAME_LENGTH @@ -49,15 +55,15 @@ OakSpeech: ld [wcf91], a ld a, 1 ld [wItemQuantity], a - call AddItemToInventory ; give one potion + call AddItemToInventory ld a, [wDefaultMap] ld [wDestinationMap], a - call SpecialWarpIn + call PrepareForSpecialWarp xor a ldh [hTileAnimations], a ld a, [wd732] - bit 1, a ; possibly a debug mode bit - jp nz, .skipChoosingNames + bit BIT_DEBUG_MODE, a + jp nz, .skipSpeech ld de, ProfOakPic lb bc, BANK(ProfOakPic), $00 call IntroDisplayPicCenteredOrUpperRight @@ -93,7 +99,7 @@ OakSpeech: ld hl, IntroduceRivalText call PrintText call ChooseRivalName -.skipChoosingNames +.skipSpeech call GBFadeOutToWhite call ClearScreen ld de, RedPicFront @@ -159,6 +165,7 @@ OakSpeechText1: text_end OakSpeechText2: text_far _OakSpeechText2A + ; BUG: The cry played does not match the sprite displayed. sound_cry_nidorina text_far _OakSpeechText2B text_end diff --git a/engine/movie/title.asm b/engine/movie/title.asm index ad5f6ebf..36a28b0d 100644 --- a/engine/movie/title.asm +++ b/engine/movie/title.asm @@ -1,4 +1,4 @@ -CopyDebugName: +CopyDebugName: ; unused ld bc, NAME_LENGTH jp CopyData @@ -42,10 +42,10 @@ DisplayTitleScreen: ld bc, 5 tiles ld a, BANK(NintendoCopyrightLogoGraphics) call FarCopyData2 - ld hl, GamefreakLogoGraphics + ld hl, GameFreakLogoGraphics ld de, vTitleLogo2 tile (16 + 5) ld bc, 9 tiles - ld a, BANK(GamefreakLogoGraphics) + ld a, BANK(GameFreakLogoGraphics) call FarCopyData2 ld hl, PokemonLogoGraphics ld de, vTitleLogo @@ -378,7 +378,7 @@ LoadCopyrightAndTextBoxTiles: LoadCopyrightTiles: ld de, NintendoCopyrightLogoGraphics ld hl, vChars2 tile $60 - lb bc, BANK(NintendoCopyrightLogoGraphics), (GamefreakLogoGraphicsEnd - NintendoCopyrightLogoGraphics) / $10 + lb bc, BANK(NintendoCopyrightLogoGraphics), (GameFreakLogoGraphicsEnd - NintendoCopyrightLogoGraphics) / $10 call CopyVideoData hlcoord 2, 7 ld de, CopyrightTextString diff --git a/engine/overworld/special_warps.asm b/engine/overworld/special_warps.asm index 61356a03..c538938b 100644 --- a/engine/overworld/special_warps.asm +++ b/engine/overworld/special_warps.asm @@ -1,60 +1,60 @@ -SpecialWarpIn:: +PrepareForSpecialWarp:: call LoadSpecialWarpData predef LoadTilesetHeader ld hl, wd732 bit 2, [hl] ; dungeon warp or fly warp? res 2, [hl] - jr z, .next -; if dungeon warp or fly warp + jr z, .debugNewGameWarp ld a, [wDestinationMap] - jr .next2 + jr .next +.debugNewGameWarp + bit BIT_DEBUG_MODE, [hl] + jr z, .setNewGameMatWarp ; apply to StartNewGameDebug only + call PrepareNewGameDebug +.setNewGameMatWarp + ; This is called by OakSpeech during StartNewGame and + ; loads the first warp event for the specified map index. + ld a, PALLET_TOWN .next - bit 1, [hl] - jr z, .next3 - call DebugStart -.next3 - ld a, 0 -.next2 ld b, a ld a, [wd72d] and a - jr nz, .next4 + jr nz, .next2 ld a, b -.next4 +.next2 ld hl, wd732 - bit 4, [hl] ; dungeon warp? + bit 4, [hl] ; dungeon warp ret nz -; if not dungeon warp ld [wLastMap], a ret -; gets the map ID, tile block map view pointer, tileset, and coordinates LoadSpecialWarpData: ld a, [wd72d] cp TRADE_CENTER jr nz, .notTradeCenter - ld hl, TradeCenterSpec1 + ld hl, TradeCenterPlayerWarp ldh a, [hSerialConnectionStatus] - cp USING_INTERNAL_CLOCK ; which gameboy is clocking determines who is on the left and who is on the right + cp USING_INTERNAL_CLOCK jr z, .copyWarpData - ld hl, TradeCenterSpec2 + ld hl, TradeCenterFriendWarp jr .copyWarpData .notTradeCenter cp COLOSSEUM jr nz, .notColosseum - ld hl, ColosseumSpec1 + ld hl, ColosseumPlayerWarp ldh a, [hSerialConnectionStatus] cp USING_INTERNAL_CLOCK jr z, .copyWarpData - ld hl, ColosseumSpec2 + ld hl, ColosseumFriendWarp jr .copyWarpData .notColosseum ld a, [wd732] - bit 1, a - jr nz, .notFirstMap + bit BIT_DEBUG_MODE, a + ; warp to wLastMap (PALLET_TOWN) for StartNewGameDebug + jr nz, .notNewGameWarp bit 2, a - jr nz, .notFirstMap - ld hl, FirstMapSpec + jr nz, .notNewGameWarp + ld hl, NewGameWarp .copyWarpData ld de, wCurMap ld c, $7 @@ -68,18 +68,17 @@ LoadSpecialWarpData: ld [wCurMapTileset], a xor a jr .done -.notFirstMap +.notNewGameWarp 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 - bit 6, [hl] ; return to last pokemon center (or player's house)? + bit 4, [hl] ; dungeon warp + jr nz, .usedDungeonWarp + bit 6, [hl] ; blacked out res 6, [hl] jr z, .otherDestination -; return to last pokemon center or player's house ld a, [wLastBlackoutMap] jr .usedFlyWarp -.usedDunegonWarp +.usedDungeonWarp ld hl, wd72d res 4, [hl] ld a, [wDungeonWarpDestinationMap] @@ -142,7 +141,7 @@ LoadSpecialWarpData: .done ld [wYOffsetSinceLastSpecialWarp], a ld [wXOffsetSinceLastSpecialWarp], a - ld a, $ff ; the player's coordinates have already been updated using a special warp, so don't use any of the normal warps + ld a, -1 ; exclude normal warps ld [wDestinationWarpID], a ret diff --git a/gfx/font.asm b/gfx/font.asm index fc2aff4f..daff3632 100644 --- a/gfx/font.asm +++ b/gfx/font.asm @@ -15,8 +15,8 @@ BattleHudTiles3End: NintendoCopyrightLogoGraphics: INCBIN "gfx/splash/copyright.2bpp" -GamefreakLogoGraphics: INCBIN "gfx/title/gamefreak_inc.2bpp" -GamefreakLogoGraphicsEnd: +GameFreakLogoGraphics: INCBIN "gfx/title/gamefreak_inc.2bpp" +GameFreakLogoGraphicsEnd: TextBoxGraphics:: INCBIN "gfx/font/font_extra.2bpp" TextBoxGraphicsEnd:: diff --git a/home/npc_movement.asm b/home/npc_movement.asm index a3367f9a..23a85427 100644 --- a/home/npc_movement.asm +++ b/home/npc_movement.asm @@ -50,10 +50,12 @@ RunNPCMovementScript:: EndNPCMovementScript:: farjp _EndNPCMovementScript -DebugPressedOrHeldB:: +DebugPressedOrHeldB:: ; dummy except in _DEBUG +; This is used to skip Trainer battles, the +; Safari Game step counter, and some NPC scripts. IF DEF(_DEBUG) ld a, [wd732] - bit 1, a + bit BIT_DEBUG_MODE, a ret z ldh a, [hJoyHeld] bit BIT_B_BUTTON, a diff --git a/home/overworld.asm b/home/overworld.asm index be1e6b24..1ebc794b 100644 --- a/home/overworld.asm +++ b/home/overworld.asm @@ -117,7 +117,7 @@ OverworldLoopLessDelay:: predef LoadSAV ld a, [wCurMap] ld [wDestinationMap], a - call SpecialWarpIn + call PrepareForSpecialWarp ld a, [wCurMap] call SwitchToMapRomBank ; switch to the ROM bank of the current map ld hl, wCurMapTileset @@ -762,11 +762,11 @@ HandleBlackOut:: call StopMusic ld hl, wd72e res 5, [hl] - ld a, BANK(ResetStatusAndHalveMoneyOnBlackout) ; also BANK(SpecialWarpIn) and BANK(SpecialEnterMap) + ld a, BANK(ResetStatusAndHalveMoneyOnBlackout) ; also BANK(PrepareForSpecialWarp) and BANK(SpecialEnterMap) ldh [hLoadedROMBank], a ld [MBC1RomBank], a call ResetStatusAndHalveMoneyOnBlackout - call SpecialWarpIn + call PrepareForSpecialWarp call PlayDefaultMusicFadeOutCurrent jp SpecialEnterMap @@ -793,10 +793,10 @@ HandleFlyWarpOrDungeonWarp:: set 2, [hl] ; fly warp or dungeon warp res 5, [hl] ; forced to ride bike call LeaveMapAnim - ld a, BANK(SpecialWarpIn) + ld a, BANK(PrepareForSpecialWarp) ldh [hLoadedROMBank], a ld [MBC1RomBank], a - call SpecialWarpIn + call PrepareForSpecialWarp jp SpecialEnterMap LeaveMapAnim:: diff --git a/home/text.asm b/home/text.asm index 836f3986..9462c749 100644 --- a/home/text.asm +++ b/home/text.asm @@ -111,10 +111,14 @@ NextChar:: inc de jp PlaceNextChar -NullChar:: +NullChar:: ; unused ld b, h ld c, l pop hl + ; A "" character in a printed string + ; displays an error message with the current value + ; of hSpriteIndexOrTextID in decimal format. + ; This is a debugging leftover. ld de, TextIDErrorText dec de ret diff --git a/home/trainers.asm b/home/trainers.asm index 4dc63fef..e0195729 100644 --- a/home/trainers.asm +++ b/home/trainers.asm @@ -135,7 +135,9 @@ ENDC ld a, [wSpriteIndex] cp $ff jr nz, .trainerEngaging +IF DEF(_DEBUG) .trainerNotEngaging +ENDC xor a ld [wSpriteIndex], a ld [wTrainerHeaderFlagBit], a diff --git a/ram/wram.asm b/ram/wram.asm index ac382f79..0d7de416 100644 --- a/ram/wram.asm +++ b/ram/wram.asm @@ -420,6 +420,7 @@ wAddedToParty:: ; The purpose of these flags is to track which mons levelled up during the ; current battle at the end of the battle when evolution occurs. ; Other methods of evolution simply set it by calling TryEvolvingMon. +wMiscBattleData:: wCanEvolveFlags:: db wForceEvolution:: db @@ -433,8 +434,7 @@ wAILayer2Encouragement:: db wPlayerSubstituteHP:: db wEnemySubstituteHP:: db -; The player's selected move during a test battle. -; InitBattleVariables sets it to the move Pound. +; used for TestBattle (unused in non-debug builds) wTestBattlePlayerSelectedMove:: db ds 1 @@ -502,6 +502,7 @@ wEnemyNumHits:: ; db wEnemyBideAccumulatedDamage:: dw ds 8 +wMiscBattleDataEnd:: ENDU ; This union spans 39 bytes. @@ -2155,17 +2156,7 @@ wd730:: db ds 1 ; bit 0: play time being counted -; bit 1: remnant of debug mode; only set by the debug build. -; if it is set: -; 1. skips most of Prof. Oak's speech, and uses NINTEN as the player's name and SONY as the rival's name -; 2. does not have the player start in floor two of the player's house (instead sending them to [wLastMap]) -; 3. allows wild battles to be avoided by holding down B -; furthermore, in the debug build: -; 4. allows trainers to be avoided by holding down B -; 5. skips Safari Zone step counter by holding down B -; 6. skips the NPC who blocks Route 3 before beating Brock by holding down B -; 7. skips Cerulean City rival battle by holding down B -; 8. skips Pokémon Tower rival battle by holding down B +; bit 1: debug mode (unused and incomplete in non-debug builds) ; bit 2: the target warp is a fly warp (bit 3 set or blacked out) or a dungeon warp (bit 4 set) ; bit 3: used warp pad, escape rope, dig, teleport, or fly, so the target warp is a "fly warp" ; bit 4: jumped into hole (Pokemon Mansion, Seafoam Islands, Victory Road) or went down waterfall (Seafoam Islands), so the target warp is a "dungeon warp" @@ -2173,7 +2164,7 @@ wd730:: db ; bit 6: map destination is [wLastBlackoutMap] (usually the last used pokemon center, but could be the player's house) wd732:: db -; bit 0: running a test battle +; bit 0: running a test battle (unused in non-debug builds) ; 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 diff --git a/scripts/HallOfFame.asm b/scripts/HallOfFame.asm index 9fc7da18..523567df 100644 --- a/scripts/HallOfFame.asm +++ b/scripts/HallOfFame.asm @@ -32,7 +32,7 @@ HallOfFameResetEventsAndSaveScript: ld hl, wFlags_D733 res 1, [hl] inc hl - set 0, [hl] + set BIT_TEST_BATTLE, [hl] ; debug, unused? xor a ; SCRIPT_*_DEFAULT ld hl, wLoreleisRoomCurScript ld [hli], a ; wLoreleisRoomCurScript -- cgit v1.3.1-sl0p From c42b7167ced16cd6ac5d23e906db555583d45f83 Mon Sep 17 00:00:00 2001 From: Linus Unnebäck Date: Sun, 16 Jul 2023 23:21:20 +0200 Subject: Use charmap in link_battle_versus_text (#415) --- engine/battle/link_battle_versus_text.asm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engine') diff --git a/engine/battle/link_battle_versus_text.asm b/engine/battle/link_battle_versus_text.asm index 29c11356..374dcabc 100644 --- a/engine/battle/link_battle_versus_text.asm +++ b/engine/battle/link_battle_versus_text.asm @@ -13,9 +13,9 @@ DisplayLinkBattleVersusTextBox: call PlaceString ; place bold "VS" tiles between the names hlcoord 9, 8 - ld a, $69 + ld a, "" ld [hli], a - ld [hl], $6a + ld [hl], "" xor a ld [wUpdateSpritesEnabled], a callfar SetupPlayerAndEnemyPokeballs -- cgit v1.3.1-sl0p From a38c7922dda3b6650a1dfe0fe544175ded259b19 Mon Sep 17 00:00:00 2001 From: SatoMew Date: Mon, 17 Jul 2023 02:22:06 +0100 Subject: Improve comment about the "ED" tile bug (#421) --- engine/menus/naming_screen.asm | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'engine') diff --git a/engine/menus/naming_screen.asm b/engine/menus/naming_screen.asm index a0062dcd..c2e63aef 100644 --- a/engine/menus/naming_screen.asm +++ b/engine/menus/naming_screen.asm @@ -326,9 +326,8 @@ DisplayNamingScreen: LoadEDTile: ld de, ED_Tile ld hl, vFont tile $70 - ld bc, (ED_TileEnd - ED_Tile) / $8 - ; to fix the graphical bug on poor emulators - ;lb bc, BANK(ED_Tile), (ED_TileEnd - ED_Tile) / $8 + ; BUG: BANK("Home") should be BANK(ED_Tile), although it coincidentally works as-is + lb bc, BANK("Home"), (ED_TileEnd - ED_Tile) / $8 jp CopyVideoDataDouble ED_Tile: -- cgit v1.3.1-sl0p From 30c244ae4f1acc6f018499ceaa9b138367d7bedf Mon Sep 17 00:00:00 2001 From: strager Date: Wed, 20 Sep 2023 12:43:27 -0700 Subject: Use PSN constant in PoisonEffect routine (#426) --- engine/battle/effects.asm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engine') diff --git a/engine/battle/effects.asm b/engine/battle/effects.asm index aaaf20d0..e89d19f3 100644 --- a/engine/battle/effects.asm +++ b/engine/battle/effects.asm @@ -118,7 +118,7 @@ PoisonEffect: ret nc .inflictPoison dec hl - set 3, [hl] ; mon is now poisoned + set PSN, [hl] push de dec de ldh a, [hWhoseTurn] -- cgit v1.3.1-sl0p From 83b373ad734fb0bf4b476b0f38dbeec8ea205f19 Mon Sep 17 00:00:00 2001 From: Linus Unnebäck Date: Fri, 17 Nov 2023 19:50:27 +0100 Subject: Add constants for wMapConnections bits and group map header wram labels * Add constants for wMapConnections bits * Apply Vulcandth and Rangi42 feedback --------- Co-authored-by: vulcandth --- constants/map_data_constants.asm | 7 +++++++ engine/menus/save.asm | 2 +- home/overworld.asm | 21 ++++++++++----------- home/predef_text.asm | 10 +++++----- home/text_script.asm | 2 +- ram/wram.asm | 15 +++++++-------- scripts/OaksLab.asm | 4 ++-- scripts/ViridianMart.asm | 4 ++-- 8 files changed, 35 insertions(+), 30 deletions(-) (limited to 'engine') diff --git a/constants/map_data_constants.asm b/constants/map_data_constants.asm index 1877e6a0..b28b3d79 100644 --- a/constants/map_data_constants.asm +++ b/constants/map_data_constants.asm @@ -3,6 +3,13 @@ DEF MAP_BORDER EQU 3 ; connection directions + const_def + const EAST_F + const WEST_F + const SOUTH_F + const NORTH_F + +; wCurMapConnections const_def shift_const EAST ; 1 shift_const WEST ; 2 diff --git a/engine/menus/save.asm b/engine/menus/save.asm index b74b9058..1857d6f5 100644 --- a/engine/menus/save.asm +++ b/engine/menus/save.asm @@ -372,7 +372,7 @@ ChangeBox:: call GetBoxSRAMLocation ld de, wBoxDataStart call CopyBoxToOrFromSRAM ; copy new box from SRAM to WRAM - ld hl, wMapTextPtr + ld hl, wCurMapTextPtr ld de, wChangeBoxSavedMapTextPointer ld a, [hli] ld [de], a diff --git a/home/overworld.asm b/home/overworld.asm index 1ebc794b..defa1728 100644 --- a/home/overworld.asm +++ b/home/overworld.asm @@ -910,9 +910,9 @@ LoadTileBlockMap:: add hl, bc ld c, MAP_BORDER add hl, bc ; this puts us past the (west) border - ld a, [wMapDataPtr] ; tile map pointer + ld a, [wCurMapDataPtr] ; tile map pointer ld e, a - ld a, [wMapDataPtr + 1] + ld a, [wCurMapDataPtr + 1] ld d, a ; de = tile map pointer ld a, [wCurMapHeight] ld b, a @@ -1966,7 +1966,7 @@ RunMapScript:: call RunNPCMovementScript ld a, [wCurMap] ; current map number call SwitchToMapRomBank ; change to the ROM bank the map's data is in - ld hl, wMapScriptPtr + ld hl, wCurMapScriptPtr ld a, [hli] ld h, [hl] ld l, a @@ -2035,9 +2035,8 @@ LoadMapHeader:: ld a, [hli] ld h, [hl] ld l, a ; hl = base of map header -; copy the first 10 bytes (the fixed area) of the map data to D367-D370 - ld de, wCurMapTileset - ld c, $0a + ld de, wCurMapHeader + ld c, wCurMapHeaderEnd - wCurMapHeader .copyFixedHeaderLoop ld a, [hli] ld [de], a @@ -2051,25 +2050,25 @@ LoadMapHeader:: ld [wWestConnectedMap], a ld [wEastConnectedMap], a ; copy connection data (if any) to WRAM - ld a, [wMapConnections] + ld a, [wCurMapConnections] ld b, a .checkNorth - bit 3, b + bit NORTH_F, b jr z, .checkSouth ld de, wNorthConnectionHeader call CopyMapConnectionHeader .checkSouth - bit 2, b + bit SOUTH_F, b jr z, .checkWest ld de, wSouthConnectionHeader call CopyMapConnectionHeader .checkWest - bit 1, b + bit WEST_F, b jr z, .checkEast ld de, wWestConnectionHeader call CopyMapConnectionHeader .checkEast - bit 0, b + bit EAST_F, b jr z, .getObjectDataPointer ld de, wEastConnectionHeader call CopyMapConnectionHeader diff --git a/home/predef_text.asm b/home/predef_text.asm index b494a2c8..1537ad5b 100644 --- a/home/predef_text.asm +++ b/home/predef_text.asm @@ -7,7 +7,7 @@ PrintPredefTextID:: call DisplayTextID RestoreMapTextPointer:: - ld hl, wMapTextPtr + ld hl, wCurMapTextPtr ldh a, [hSavedMapTextPtr] ld [hli], a ldh a, [hSavedMapTextPtr + 1] @@ -15,14 +15,14 @@ RestoreMapTextPointer:: ret SetMapTextPointer:: - ld a, [wMapTextPtr] + ld a, [wCurMapTextPtr] ldh [hSavedMapTextPtr], a - ld a, [wMapTextPtr + 1] + ld a, [wCurMapTextPtr + 1] ldh [hSavedMapTextPtr + 1], a ld a, l - ld [wMapTextPtr], a + ld [wCurMapTextPtr], a ld a, h - ld [wMapTextPtr + 1], a + ld [wCurMapTextPtr + 1], a ret INCLUDE "data/text_predef_pointers.asm" diff --git a/home/text_script.asm b/home/text_script.asm index 9e1ba275..ceae1a0a 100644 --- a/home/text_script.asm +++ b/home/text_script.asm @@ -13,7 +13,7 @@ DisplayTextID:: .skipSwitchToMapBank ld a, 30 ; half a second ldh [hFrameCounter], a ; used as joypad poll timer - ld hl, wMapTextPtr + ld hl, wCurMapTextPtr ld a, [hli] ld h, [hl] ld l, a ; hl = map text pointer diff --git a/ram/wram.asm b/ram/wram.asm index df286676..753a9678 100644 --- a/ram/wram.asm +++ b/ram/wram.asm @@ -1795,17 +1795,16 @@ wLastMap:: db wUnusedD366:: db +wCurMapHeader:: wCurMapTileset:: db - -; blocks -wCurMapHeight:: db +wCurMapHeight:: db wCurMapWidth:: db +wCurMapDataPtr:: dw +wCurMapTextPtr:: dw +wCurMapScriptPtr:: dw +wCurMapConnections:: db +wCurMapHeaderEnd:: -wMapDataPtr:: dw -wMapTextPtr:: dw -wMapScriptPtr:: dw - -wMapConnections:: db wNorthConnectionHeader:: map_connection_struct wNorth wSouthConnectionHeader:: map_connection_struct wSouth wWestConnectionHeader:: map_connection_struct wWest diff --git a/scripts/OaksLab.asm b/scripts/OaksLab.asm index 407ee3e5..30ee93ed 100644 --- a/scripts/OaksLab.asm +++ b/scripts/OaksLab.asm @@ -715,9 +715,9 @@ OaksLabCalcRivalMovementScript: OaksLabLoadTextPointers2Script: ld hl, OaksLab_TextPointers2 ld a, l - ld [wMapTextPtr], a + ld [wCurMapTextPtr], a ld a, h - ld [wMapTextPtr + 1], a + ld [wCurMapTextPtr + 1], a ret OaksLab_TextPointers: diff --git a/scripts/ViridianMart.asm b/scripts/ViridianMart.asm index 2e78a036..8f91afd6 100644 --- a/scripts/ViridianMart.asm +++ b/scripts/ViridianMart.asm @@ -14,9 +14,9 @@ ViridianMartCheckParcelDeliveredScript: ld hl, ViridianMart_TextPointers2 .done ld a, l - ld [wMapTextPtr], a + ld [wCurMapTextPtr], a ld a, h - ld [wMapTextPtr+1], a + ld [wCurMapTextPtr+1], a ret ViridianMart_ScriptPointers: -- cgit v1.3.1-sl0p From 64061e2092a47095f4ad6a8c2ac35f38db4bc107 Mon Sep 17 00:00:00 2001 From: vulcandth Date: Fri, 17 Nov 2023 22:36:21 -0600 Subject: .calculateHPBarCoords incorrectly referenced OAM Resolves #411 Co-Authored-By: SnDream <12762219+sndream@users.noreply.github.com> --- engine/items/item_effects.asm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engine') diff --git a/engine/items/item_effects.asm b/engine/items/item_effects.asm index 466b1423..927f54cb 100644 --- a/engine/items/item_effects.asm +++ b/engine/items/item_effects.asm @@ -1175,7 +1175,7 @@ ItemUseMedicine: xor a ld [wBattleMonStatus], a ; remove the status ailment in the in-battle pokemon data .calculateHPBarCoords - ld hl, wShadowOAMSprite36 + hlcoord 4, -1 ld bc, 2 * SCREEN_WIDTH inc d .calculateHPBarCoordsLoop -- cgit v1.3.1-sl0p From 26a342b104e48bede16b9e2324c2f8f57df5bd50 Mon Sep 17 00:00:00 2001 From: Rangi42 Date: Sat, 18 Nov 2023 19:44:03 -0500 Subject: Identify more map script labels --- engine/events/cinnabar_lab.asm | 24 ++++++++++++------------ scripts/CeladonMartElevator.asm | 22 +++++++++++----------- scripts/CeruleanBadgeHouse.asm | 10 +++++----- scripts/CeruleanCity.asm | 12 ++++++------ scripts/ChampionsRoom.asm | 12 ++++++------ scripts/CinnabarGym.asm | 6 +++--- scripts/FightingDojo.asm | 9 ++++----- scripts/GameCorner.asm | 24 ++++++++++++------------ scripts/HallOfFame.asm | 6 +++--- scripts/MtMoonB2F.asm | 8 ++++---- scripts/RocketHideoutB4F.asm | 8 ++++---- scripts/RocketHideoutElevator.asm | 14 +++++++------- scripts/Route16.asm | 10 +++++----- scripts/Route22.asm | 4 ++-- scripts/Route23.asm | 12 ++++++------ scripts/SilphCoElevator.asm | 14 +++++++------- text/CinnabarLabFossilRoom.asm | 8 ++++---- 17 files changed, 101 insertions(+), 102 deletions(-) (limited to 'engine') diff --git a/engine/events/cinnabar_lab.asm b/engine/events/cinnabar_lab.asm index 547f782e..545baf13 100644 --- a/engine/events/cinnabar_lab.asm +++ b/engine/events/cinnabar_lab.asm @@ -52,40 +52,40 @@ GiveFossilToCinnabarLab:: ld a, b ld [wFossilMon], a call LoadFossilItemAndMonName - ld hl, LabFossil_610ae + ld hl, .ScientistSeesFossilText call PrintText call YesNoChoice ld a, [wCurrentMenuItem] and a jr nz, .cancelledGivingFossil - ld hl, LabFossil_610b3 + ld hl, .ScientistTakesFossilText call PrintText ld a, [wFossilItem] ldh [hItemToRemoveID], a farcall RemoveItemByID - ld hl, LabFossil_610b8 + ld hl, .GoForAWalkText call PrintText SetEvents EVENT_GAVE_FOSSIL_TO_LAB, EVENT_LAB_STILL_REVIVING_FOSSIL ret .cancelledGivingFossil - ld hl, LabFossil_610bd + ld hl, .ComeAgainText call PrintText ret -LabFossil_610ae: - text_far _Lab4Text_610ae +.ScientistSeesFossilText: + text_far _CinnabarLabFossilRoomScientist1SeesFossilText text_end -LabFossil_610b3: - text_far _Lab4Text_610b3 +.ScientistTakesFossilText: + text_far _CinnabarLabFossilRoomScientist1TakesFossilText text_end -LabFossil_610b8: - text_far _Lab4Text_610b8 +.GoForAWalkText: + text_far _CinnabarLabFossilRoomScientist1GoForAWalkText2 text_end -LabFossil_610bd: - text_far _Lab4Text_610bd +.ComeAgainText: + text_far _CinnabarLabFossilRoomScientist1ComeAgainText text_end PrintFossilsInBag: diff --git a/scripts/CeladonMartElevator.asm b/scripts/CeladonMartElevator.asm index c13ecd73..9a2842f3 100644 --- a/scripts/CeladonMartElevator.asm +++ b/scripts/CeladonMartElevator.asm @@ -3,26 +3,26 @@ CeladonMartElevator_Script: bit 5, [hl] res 5, [hl] push hl - call nz, CeladonMartElevatorScript_4861c + call nz, CeladonMartElevatorStoreWarpEntriesScript pop hl bit 7, [hl] res 7, [hl] - call nz, CeladonMartElevatorScript_48654 + call nz, CeladonMartElevatorShakeScript xor a ld [wAutoTextBoxDrawingControl], a inc a ld [wDoNotWaitForButtonPressAfterDisplayingText], a ret -CeladonMartElevatorScript_4861c: +CeladonMartElevatorStoreWarpEntriesScript: ld hl, wWarpEntries ld a, [wWarpedFromWhichWarp] ld b, a ld a, [wWarpedFromWhichMap] ld c, a - call CeladonMartElevatorScript_4862a - -CeladonMartElevatorScript_4862a: + call .StoreWarpEntry + ; fallthrough +.StoreWarpEntry: inc hl inc hl ld a, b @@ -31,12 +31,12 @@ CeladonMartElevatorScript_4862a: ld [hli], a ret -CeladonMartElevatorScript_48631: +CeladonMartElevatorCopyWarpMapsScript: ld hl, CeladonMartElevatorFloors call LoadItemList ld hl, CeladonMartElevatorWarpMaps ld de, wElevatorWarpMaps - ld bc, CeladonMartElevatorWarpMapsEnd - CeladonMartElevatorWarpMaps + ld bc, CeladonMartElevatorWarpMaps.End - CeladonMartElevatorWarpMaps jp CopyData CeladonMartElevatorFloors: @@ -56,9 +56,9 @@ CeladonMartElevatorWarpMaps: db 2, CELADON_MART_3F db 2, CELADON_MART_4F db 2, CELADON_MART_5F -CeladonMartElevatorWarpMapsEnd: +.End: -CeladonMartElevatorScript_48654: +CeladonMartElevatorShakeScript: farjp ShakeElevator CeladonMartElevator_TextPointers: @@ -67,7 +67,7 @@ CeladonMartElevator_TextPointers: CeladonMartElevatorText: text_asm - call CeladonMartElevatorScript_48631 + call CeladonMartElevatorCopyWarpMapsScript ld hl, CeladonMartElevatorWarpMaps predef DisplayElevatorFloorMenu jp TextScriptEnd diff --git a/scripts/CeruleanBadgeHouse.asm b/scripts/CeruleanBadgeHouse.asm index de457ab8..417198e1 100644 --- a/scripts/CeruleanBadgeHouse.asm +++ b/scripts/CeruleanBadgeHouse.asm @@ -16,7 +16,7 @@ CeruleanBadgeHouseMiddleAgedManText: xor a ld [wCurrentMenuItem], a ld [wListScrollOffset], a -.asm_74e23 +.loop ld hl, .WhichBadgeText call PrintText ld hl, .BadgeItemList @@ -32,7 +32,7 @@ CeruleanBadgeHouseMiddleAgedManText: ld a, SPECIALLISTMENU ld [wListMenuID], a call DisplayListMenuID - jr c, .asm_74e60 + jr c, .done ld hl, CeruleanBadgeHouseBadgeTextPointers ld a, [wcf91] sub BOULDERBADGE @@ -44,8 +44,8 @@ CeruleanBadgeHouseMiddleAgedManText: ld h, [hl] ld l, a call PrintText - jr .asm_74e23 -.asm_74e60 + jr .loop +.done xor a ld [wListScrollOffset], a ld hl, .VisitAnyTimeText @@ -54,7 +54,7 @@ CeruleanBadgeHouseMiddleAgedManText: .BadgeItemList: table_width 1, .BadgeItemList - db NUM_BADGES + db NUM_BADGES ; # db BOULDERBADGE db CASCADEBADGE db THUNDERBADGE diff --git a/scripts/CeruleanCity.asm b/scripts/CeruleanCity.asm index 6e480285..439c31ad 100644 --- a/scripts/CeruleanCity.asm +++ b/scripts/CeruleanCity.asm @@ -4,7 +4,7 @@ CeruleanCity_Script: ld a, [wCeruleanCityCurScript] jp CallFunctionInTable -CeruleanCityScript_1948c: +CeruleanCityClearScripts: xor a ; SCRIPT_CERULEANCITY_DEFAULT ld [wJoyIgnore], a ld [wCeruleanCityCurScript], a @@ -23,7 +23,7 @@ CeruleanCity_ScriptPointers: CeruleanCityRocketDefeatedScript: ld a, [wIsInBattle] cp $ff - jp z, CeruleanCityScript_1948c + jp z, CeruleanCityClearScripts ld a, D_RIGHT | D_LEFT | D_UP | D_DOWN ld [wJoyIgnore], a SetEvent EVENT_BEAT_CERULEAN_ROCKET_THIEF @@ -117,7 +117,7 @@ CeruleanCityMovement1: db NPC_MOVEMENT_DOWN db -1 ; end -CeruleanCityScript_1955d: +CeruleanCityFaceRivalScript: ld a, CERULEANCITY_RIVAL ldh [hSpriteIndex], a xor a ; SPRITE_FACING_DOWN @@ -160,7 +160,7 @@ CeruleanCityRivalBattleScript: xor a ldh [hJoyHeld], a - call CeruleanCityScript_1955d + call CeruleanCityFaceRivalScript ld a, SCRIPT_CERULEANCITY_RIVAL_DEFEATED ld [wCeruleanCityCurScript], a ret @@ -168,8 +168,8 @@ CeruleanCityRivalBattleScript: CeruleanCityRivalDefeatedScript: ld a, [wIsInBattle] cp $ff - jp z, CeruleanCityScript_1948c - call CeruleanCityScript_1955d + jp z, CeruleanCityClearScripts + call CeruleanCityFaceRivalScript ld a, D_RIGHT | D_LEFT | D_UP | D_DOWN ld [wJoyIgnore], a SetEvent EVENT_BEAT_CERULEAN_RIVAL diff --git a/scripts/ChampionsRoom.asm b/scripts/ChampionsRoom.asm index 0837ae52..c6c7c1dd 100644 --- a/scripts/ChampionsRoom.asm +++ b/scripts/ChampionsRoom.asm @@ -100,7 +100,7 @@ ChampionsRoomRivalDefeatedScript: ld [wJoyIgnore], a ld a, TEXT_CHAMPIONSROOM_RIVAL ldh [hSpriteIndexOrTextID], a - call RivalScript_760c8 + call ChampionsRoom_DisplayTextID_AllowABSelectStart ld a, CHAMPIONSROOM_RIVAL ldh [hSpriteIndex], a call SetSpriteMovementBytesToFF @@ -112,7 +112,7 @@ ChampionsRoomOakArrivesScript: farcall Music_Cities1AlternateTempo ld a, TEXT_CHAMPIONSROOM_OAK ldh [hSpriteIndexOrTextID], a - call RivalScript_760c8 + call ChampionsRoom_DisplayTextID_AllowABSelectStart ld a, CHAMPIONSROOM_OAK ldh [hSpriteIndex], a call SetSpriteMovementBytesToFF @@ -153,7 +153,7 @@ ChampionsRoomOakCongratulatesPlayerScript: call SetSpriteFacingDirectionAndDelay ld a, TEXT_CHAMPIONSROOM_OAK_CONGRATULATES_PLAYER ldh [hSpriteIndexOrTextID], a - call RivalScript_760c8 + call ChampionsRoom_DisplayTextID_AllowABSelectStart ld a, SCRIPT_CHAMPIONSROOM_OAK_DISAPPOINTED_WITH_RIVAL ld [wChampionsRoomCurScript], a ret @@ -166,7 +166,7 @@ ChampionsRoomOakDisappointedWithRivalScript: call SetSpriteFacingDirectionAndDelay ld a, TEXT_CHAMPIONSROOM_OAK_DISAPPOINTED_WITH_RIVAL ldh [hSpriteIndexOrTextID], a - call RivalScript_760c8 + call ChampionsRoom_DisplayTextID_AllowABSelectStart ld a, SCRIPT_CHAMPIONSROOM_OAK_COME_WITH_ME ld [wChampionsRoomCurScript], a ret @@ -179,7 +179,7 @@ ChampionsRoomOakComeWithMeScript: call SetSpriteFacingDirectionAndDelay ld a, TEXT_CHAMPIONSROOM_OAK_COME_WITH_ME ldh [hSpriteIndexOrTextID], a - call RivalScript_760c8 + call ChampionsRoom_DisplayTextID_AllowABSelectStart ld de, OakExitChampionsRoomMovement ld a, CHAMPIONSROOM_OAK ldh [hSpriteIndex], a @@ -232,7 +232,7 @@ ChampionsRoomCleanupScript: ld [wChampionsRoomCurScript], a ret -RivalScript_760c8: +ChampionsRoom_DisplayTextID_AllowABSelectStart: ld a, D_RIGHT | D_LEFT | D_UP | D_DOWN ld [wJoyIgnore], a call DisplayTextID diff --git a/scripts/CinnabarGym.asm b/scripts/CinnabarGym.asm index af7646be..a962aa2f 100644 --- a/scripts/CinnabarGym.asm +++ b/scripts/CinnabarGym.asm @@ -93,7 +93,7 @@ CinnabarGymGetOpponentTextScript: CinnabarGymFlagAction: predef_jump FlagActionPredef - + ; fallthrough CinnabarGymOpenGateScript: ld a, [wIsInBattle] cp $ff @@ -107,12 +107,12 @@ CinnabarGymOpenGateScript: call CinnabarGymFlagAction ld a, c and a - jr nz, .asm_7581b + jr nz, .no_sound call WaitForSoundToFinish ld a, SFX_GO_INSIDE call PlaySound call WaitForSoundToFinish -.asm_7581b +.no_sound ld a, [wTrainerHeaderFlagBit] ldh [hGymGateIndex], a AdjustEventBit EVENT_BEAT_CINNABAR_GYM_TRAINER_0, 2 diff --git a/scripts/FightingDojo.asm b/scripts/FightingDojo.asm index fb9847d1..298c2fcb 100644 --- a/scripts/FightingDojo.asm +++ b/scripts/FightingDojo.asm @@ -7,7 +7,7 @@ FightingDojo_Script: ld [wFightingDojoCurScript], a ret -FightingDojoScript_5cd70: +FightingDojoResetScripts: xor a ; SCRIPT_FIGHTINGDOJO_DEFAULT ld [wJoyIgnore], a ld [wFightingDojoCurScript], a @@ -56,10 +56,10 @@ FightingDojoDefaultScript: FightingDojoKarateMasterPostBattleScript: ld a, [wIsInBattle] cp $ff - jp z, FightingDojoScript_5cd70 + jp z, FightingDojoResetScripts ld a, [wcf0d] and a - jr z, .asm_5cde4 + jr z, .already_facing ld a, PLAYER_DIR_RIGHT ld [wPlayerMovingDirection], a ld a, FIGHTINGDOJO_KARATE_MASTER @@ -67,8 +67,7 @@ FightingDojoKarateMasterPostBattleScript: ld a, SPRITE_FACING_LEFT ldh [hSpriteFacingDirection], a call SetSpriteFacingDirectionAndDelay - -.asm_5cde4 +.already_facing ld a, D_RIGHT | D_LEFT | D_UP | D_DOWN ld [wJoyIgnore], a SetEventRange EVENT_BEAT_KARATE_MASTER, EVENT_BEAT_FIGHTING_DOJO_TRAINER_3 diff --git a/scripts/GameCorner.asm b/scripts/GameCorner.asm index 3944a2f9..68cdc333 100644 --- a/scripts/GameCorner.asm +++ b/scripts/GameCorner.asm @@ -14,9 +14,9 @@ GameCornerSelectLuckySlotMachine: call Random ldh a, [hRandomAdd] cp $7 - jr nc, .asm_48be2 + jr nc, .not_max ld a, $8 -.asm_48be2 +.not_max srl a srl a srl a @@ -63,18 +63,18 @@ GameCornerRocketBattleScript: ld a, GAMECORNER_ROCKET ldh [hSpriteIndex], a call SetSpriteMovementBytesToFF - ld de, GameCornerMovement_Grunt_WalkAroundPlayer + ld de, GameCornerMovement_Rocket_WalkAroundPlayer ld a, [wYCoord] cp 6 - jr nz, .asm_48c43 - ld de, GameCornerMovement_Grunt_WalkDirect - jr .asm_48c4d -.asm_48c43 + jr nz, .not_direct_movement + ld de, GameCornerMovement_Rocket_WalkDirect + jr .got_rocket_movement +.not_direct_movement ld a, [wXCoord] cp 8 - jr nz, .asm_48c4d - ld de, GameCornerMovement_Grunt_WalkDirect -.asm_48c4d + jr nz, .got_rocket_movement + ld de, GameCornerMovement_Rocket_WalkDirect +.got_rocket_movement ld a, GAMECORNER_ROCKET ldh [hSpriteIndex], a call MoveSprite @@ -82,7 +82,7 @@ GameCornerRocketBattleScript: ld [wGameCornerCurScript], a ret -GameCornerMovement_Grunt_WalkAroundPlayer: +GameCornerMovement_Rocket_WalkAroundPlayer: db NPC_MOVEMENT_DOWN db NPC_MOVEMENT_RIGHT db NPC_MOVEMENT_RIGHT @@ -93,7 +93,7 @@ GameCornerMovement_Grunt_WalkAroundPlayer: db NPC_MOVEMENT_RIGHT db -1 ; end -GameCornerMovement_Grunt_WalkDirect: +GameCornerMovement_Rocket_WalkDirect: db NPC_MOVEMENT_RIGHT db NPC_MOVEMENT_RIGHT db NPC_MOVEMENT_RIGHT diff --git a/scripts/HallOfFame.asm b/scripts/HallOfFame.asm index 523567df..51f48af4 100644 --- a/scripts/HallOfFame.asm +++ b/scripts/HallOfFame.asm @@ -4,7 +4,7 @@ HallOfFame_Script: ld a, [wHallOfFameCurScript] jp CallFunctionInTable -HallofFameRoomScript_5a4aa: +HallofFameRoomClearScripts: ; unreferenced xor a ld [wJoyIgnore], a ld [wHallOfFameCurScript], a @@ -60,7 +60,7 @@ HallOfFameDefaultScript: ld a, A_BUTTON | B_BUTTON | SELECT | START | D_RIGHT | D_LEFT | D_UP | D_DOWN ld [wJoyIgnore], a ld hl, wSimulatedJoypadStatesEnd - ld de, RLEMovement5a528 + ld de, HallOfFakeEntryMovement call DecodeRLEList dec a ld [wSimulatedJoypadStatesIndex], a @@ -69,7 +69,7 @@ HallOfFameDefaultScript: ld [wHallOfFameCurScript], a ret -RLEMovement5a528: +HallOfFakeEntryMovement: db D_UP, 5 db -1 ; end diff --git a/scripts/MtMoonB2F.asm b/scripts/MtMoonB2F.asm index 6e2dc845..89871e35 100644 --- a/scripts/MtMoonB2F.asm +++ b/scripts/MtMoonB2F.asm @@ -7,18 +7,18 @@ MtMoonB2F_Script: ld [wMtMoonB2FCurScript], a CheckEvent EVENT_BEAT_MT_MOON_EXIT_SUPER_NERD ret z - ld hl, CoordsData_49d37 + ld hl, MtMoonB2FFossilAreaCoords call ArePlayerCoordsInArray - jr nc, .asm_49d31 + jr nc, .enable_battles ld hl, wd72e set 4, [hl] ret -.asm_49d31 +.enable_battles ld hl, wd72e res 4, [hl] ret -CoordsData_49d37: +MtMoonB2FFossilAreaCoords: dbmapcoord 11, 5 dbmapcoord 12, 5 dbmapcoord 13, 5 diff --git a/scripts/RocketHideoutB4F.asm b/scripts/RocketHideoutB4F.asm index 01584f27..24bdd4a6 100644 --- a/scripts/RocketHideoutB4F.asm +++ b/scripts/RocketHideoutB4F.asm @@ -117,11 +117,11 @@ RocketHideoutB4FGiovanniText: ld a, SCRIPT_ROCKETHIDEOUTB4F_BEAT_GIOVANNI ld [wRocketHideoutB4FCurScript], a ld [wCurMapScript], a - jr .asm_209f0 + jr .done .beat_giovanni ld hl, RocketHideoutB4FGiovanniHopeWeMeetAgainText call PrintText -.asm_209f0 +.done jp TextScriptEnd .ImpressedYouGotHereText: @@ -191,11 +191,11 @@ RocketHideoutB4FRocket2AfterBattleText: ld hl, .Text call PrintText CheckAndSetEvent EVENT_ROCKET_DROPPED_LIFT_KEY - jr nz, .asm_455e9 + jr nz, .done ld a, HS_ROCKET_HIDEOUT_B4F_ITEM_5 ld [wMissableObjectIndex], a predef ShowObject -.asm_455e9 +.done jp TextScriptEnd .Text: diff --git a/scripts/RocketHideoutElevator.asm b/scripts/RocketHideoutElevator.asm index 9352a518..71ff0758 100644 --- a/scripts/RocketHideoutElevator.asm +++ b/scripts/RocketHideoutElevator.asm @@ -3,7 +3,7 @@ RocketHideoutElevator_Script: bit 5, [hl] res 5, [hl] push hl - call nz, RocketHideoutElevatorGetWarpsScript + call nz, RocketHideoutElevatorStoreWarpEntriesScript pop hl bit 7, [hl] res 7, [hl] @@ -14,15 +14,15 @@ RocketHideoutElevator_Script: ld [wDoNotWaitForButtonPressAfterDisplayingText], a ret -RocketHideoutElevatorGetWarpsScript: +RocketHideoutElevatorStoreWarpEntriesScript: ld hl, wWarpEntries ld a, [wWarpedFromWhichWarp] ld b, a ld a, [wWarpedFromWhichMap] ld c, a - call .SetWarpEntries - -.SetWarpEntries: + call .StoreWarpEntry + ; fallthrough +.StoreWarpEntry: inc hl inc hl ld a, b @@ -36,7 +36,7 @@ RocketHideoutElevatorScript: call LoadItemList ld hl, RocketHideoutElevatorWarpMaps ld de, wElevatorWarpMaps - ld bc, RocketHideoutElevatorWarpMapsEnd - RocketHideoutElevatorWarpMaps + ld bc, RocketHideoutElevatorWarpMaps.End - RocketHideoutElevatorWarpMaps call CopyData ret @@ -53,7 +53,7 @@ RocketHideoutElevatorWarpMaps: db 4, ROCKET_HIDEOUT_B1F db 4, ROCKET_HIDEOUT_B2F db 2, ROCKET_HIDEOUT_B4F -RocketHideoutElevatorWarpMapsEnd: +.End: RocketHideoutElevatorShakeScript: call Delay3 diff --git a/scripts/Route16.asm b/scripts/Route16.asm index a1a6af78..f51bd00e 100644 --- a/scripts/Route16.asm +++ b/scripts/Route16.asm @@ -7,7 +7,7 @@ Route16_Script: ld [wRoute16CurScript], a ret -Route16Script_59946: +Route16ResetScripts: xor a ; SCRIPT_ROUTE16_DEFAULT ld [wJoyIgnore], a ld [wRoute16CurScript], a @@ -19,7 +19,7 @@ Route16_ScriptPointers: dw_const Route16DefaultScript, SCRIPT_ROUTE16_DEFAULT dw_const DisplayEnemyTrainerTextAndStartBattle, SCRIPT_ROUTE16_START_BATTLE dw_const EndTrainerBattle, SCRIPT_ROUTE16_END_BATTLE - dw_const Route16SnorlaxBattleScript, SCRIPT_ROUTE16_SNORLAX_BATTLE + dw_const Route16SnorlaxPostBattleScript, SCRIPT_ROUTE16_SNORLAX_POST_BATTLE Route16DefaultScript: CheckEventHL EVENT_BEAT_ROUTE16_SNORLAX @@ -38,15 +38,15 @@ Route16DefaultScript: ld [wMissableObjectIndex], a predef HideObject call UpdateSprites - ld a, SCRIPT_ROUTE16_SNORLAX_BATTLE + ld a, SCRIPT_ROUTE16_SNORLAX_POST_BATTLE ld [wRoute16CurScript], a ld [wCurMapScript], a ret -Route16SnorlaxBattleScript: +Route16SnorlaxPostBattleScript: ld a, [wIsInBattle] cp $ff - jp z, Route16Script_59946 + jp z, Route16ResetScripts call UpdateSprites ld a, [wBattleResult] cp $2 diff --git a/scripts/Route22.asm b/scripts/Route22.asm index f692cb37..abf6c8e4 100644 --- a/scripts/Route22.asm +++ b/scripts/Route22.asm @@ -40,9 +40,9 @@ Route22MoveRivalRightScript: ld de, Route22RivalMovementData ld a, [wcf0d] cp $1 - jr z, .asm_50ef1 + jr z, .skip_first_right inc de -.asm_50ef1 +.skip_first_right call MoveSprite ld a, SPRITE_FACING_RIGHT ldh [hSpriteFacingDirection], a diff --git a/scripts/Route23.asm b/scripts/Route23.asm index 7863f8ac..044d5e50 100644 --- a/scripts/Route23.asm +++ b/scripts/Route23.asm @@ -26,25 +26,25 @@ Route23_ScriptPointers: dw_const Route23ResetToDefaultScript, SCRIPT_ROUTE23_RESET_TO_DEFAULT Route23DefaultScript: - ld hl, YCoordsData_51255 + ld hl, Route23GuardsYCoords ld a, [wYCoord] ld b, a ld e, $0 EventFlagBit c, EVENT_PASSED_EARTHBADGE_CHECK + 1, EVENT_PASSED_CASCADEBADGE_CHECK -.asm_51224 +.loop ld a, [hli] cp -1 ret z inc e dec c cp b - jr nz, .asm_51224 + jr nz, .loop cp 35 - jr nz, .asm_51237 + jr nz, .not_past_victory_road ld a, [wXCoord] cp 14 ret nc -.asm_51237 +.not_past_victory_road ld a, e ldh [hSpriteIndexOrTextID], a ld a, c @@ -61,7 +61,7 @@ Route23DefaultScript: ldh [hJoyHeld], a ret -YCoordsData_51255: +Route23GuardsYCoords: db 35 db 56 db 85 diff --git a/scripts/SilphCoElevator.asm b/scripts/SilphCoElevator.asm index 1d728e6b..a2ed009e 100644 --- a/scripts/SilphCoElevator.asm +++ b/scripts/SilphCoElevator.asm @@ -3,25 +3,25 @@ SilphCoElevator_Script: bit 5, [hl] res 5, [hl] push hl - call nz, SilphCoElevatorScript_457dc + call nz, SilphCoElevatorStoreWarpEntriesScript pop hl bit 7, [hl] res 7, [hl] - call nz, SilphCoElevatorShakeElevatorScript + call nz, SilphCoElevatorShakeScript xor a ld [wAutoTextBoxDrawingControl], a inc a ld [wDoNotWaitForButtonPressAfterDisplayingText], a ret -SilphCoElevatorScript_457dc: +SilphCoElevatorStoreWarpEntriesScript: ld hl, wWarpEntries ld a, [wWarpedFromWhichWarp] ld b, a ld a, [wWarpedFromWhichMap] ld c, a call .StoreWarpEntry - + ; fallthrough .StoreWarpEntry: inc hl inc hl @@ -36,7 +36,7 @@ SilphCoElevatorCopyWarpMapsScript: call LoadItemList ld hl, SilphCoElevatorWarpMaps ld de, wElevatorWarpMaps - ld bc, SilphCoElevatorWarpMapsEnd - SilphCoElevatorWarpMaps + ld bc, SilphCoElevatorWarpMaps.End - SilphCoElevatorWarpMaps call CopyData ret @@ -69,9 +69,9 @@ SilphCoElevatorWarpMaps: db 2, SILPH_CO_9F db 2, SILPH_CO_10F db 1, SILPH_CO_11F -SilphCoElevatorWarpMapsEnd: +.End: -SilphCoElevatorShakeElevatorScript: +SilphCoElevatorShakeScript: call Delay3 farcall ShakeElevator ret diff --git a/text/CinnabarLabFossilRoom.asm b/text/CinnabarLabFossilRoom.asm index 161342e4..6701bbd0 100644 --- a/text/CinnabarLabFossilRoom.asm +++ b/text/CinnabarLabFossilRoom.asm @@ -35,7 +35,7 @@ _CinnabarLabFossilRoomScientist1FossilIsBackToLifeText:: line "like I think!" prompt -_Lab4Text_610ae:: +_CinnabarLabFossilRoomScientist1SeesFossilText:: text "Oh! That is" line "@" text_ram wcd6d @@ -54,7 +54,7 @@ _Lab4Text_610ae:: cont "again!" done -_Lab4Text_610b3:: +_CinnabarLabFossilRoomScientist1TakesFossilText:: text "So! You hurry and" line "give me that!" @@ -64,7 +64,7 @@ _Lab4Text_610b3:: text "!" prompt -_Lab4Text_610b8:: +_CinnabarLabFossilRoomScientist1GoForAWalkText2:: text "I take a little" line "time!" @@ -72,7 +72,7 @@ _Lab4Text_610b8:: line "little while!" done -_Lab4Text_610bd:: +_CinnabarLabFossilRoomScientist1ComeAgainText:: text "Aiyah! You come" line "again!" done -- cgit v1.3.1-sl0p From 5739aea99068b83604bf64f7c2d27682b3df51de Mon Sep 17 00:00:00 2001 From: Vortyne <104168801+Vortyne@users.noreply.github.com> Date: Sun, 19 Nov 2023 16:09:33 -0500 Subject: Name unnamed labels in seafoam islands and pokemon mansion script files (#435) * Update PokemonMansion1F.asm * Name unnamed seafoam/mansion labels --- engine/overworld/push_boulder.asm | 2 +- scripts/PokemonMansion1F.asm | 28 +++++++++++++-------------- scripts/PokemonMansion2F.asm | 22 ++++++++++----------- scripts/PokemonMansion3F.asm | 24 +++++++++++------------ scripts/PokemonMansionB1F.asm | 24 +++++++++++------------ scripts/SeafoamIslands1F.asm | 12 ++++++------ scripts/SeafoamIslandsB1F.asm | 12 ++++++------ scripts/SeafoamIslandsB2F.asm | 12 ++++++------ scripts/SeafoamIslandsB3F.asm | 40 +++++++++++++++++++-------------------- scripts/SeafoamIslandsB4F.asm | 34 ++++++++++++++++----------------- 10 files changed, 105 insertions(+), 105 deletions(-) (limited to 'engine') diff --git a/engine/overworld/push_boulder.asm b/engine/overworld/push_boulder.asm index a8e532d3..96c506c0 100644 --- a/engine/overworld/push_boulder.asm +++ b/engine/overworld/push_boulder.asm @@ -94,7 +94,7 @@ DoBoulderDustAnimation:: call DiscardButtonPresses ld [wJoyIgnore], a call ResetBoulderPushFlags - set 7, [hl] + set 7, [hl] ; [wFlags_0xcd60] ld a, [wBoulderSpriteIndex] ldh [hSpriteIndex], a call GetSpriteMovementByte2Pointer diff --git a/scripts/PokemonMansion1F.asm b/scripts/PokemonMansion1F.asm index c1fef205..b294a247 100644 --- a/scripts/PokemonMansion1F.asm +++ b/scripts/PokemonMansion1F.asm @@ -1,5 +1,5 @@ PokemonMansion1F_Script: - call Mansion1Subscript1 + call Mansion1CheckReplaceSwitchDoorBlocks call EnableAutoTextBoxDrawing ld hl, Mansion1TrainerHeaders ld de, PokemonMansion1F_ScriptPointers @@ -8,37 +8,37 @@ PokemonMansion1F_Script: ld [wPokemonMansion1FCurScript], a ret -Mansion1Subscript1: +Mansion1CheckReplaceSwitchDoorBlocks: ld hl, wCurrentMapScriptFlags bit 5, [hl] res 5, [hl] ret z CheckEvent EVENT_MANSION_SWITCH_ON - jr nz, .asm_442ec + jr nz, .switchTurnedOn lb bc, 6, 12 - call Mansion1Script_4430b + call Mansion1LoadEmptyFloorTileBlock lb bc, 3, 8 - call Mansion1Script_44304 + call Mansion1LoadHorizontalGateBlock lb bc, 8, 10 - call Mansion1Script_44304 + call Mansion1LoadHorizontalGateBlock lb bc, 13, 13 - jp Mansion1Script_44304 -.asm_442ec + jp Mansion1LoadHorizontalGateBlock +.switchTurnedOn lb bc, 6, 12 - call Mansion1Script_44304 + call Mansion1LoadHorizontalGateBlock lb bc, 3, 8 - call Mansion1Script_4430b + call Mansion1LoadEmptyFloorTileBlock lb bc, 8, 10 - call Mansion1Script_4430b + call Mansion1LoadEmptyFloorTileBlock lb bc, 13, 13 - jp Mansion1Script_4430b + jp Mansion1LoadEmptyFloorTileBlock -Mansion1Script_44304: +Mansion1LoadHorizontalGateBlock: ld a, $2d ld [wNewTileBlockID], a jr Mansion1ReplaceBlock -Mansion1Script_4430b: +Mansion1LoadEmptyFloorTileBlock: ld a, $e ld [wNewTileBlockID], a Mansion1ReplaceBlock: diff --git a/scripts/PokemonMansion2F.asm b/scripts/PokemonMansion2F.asm index a4322da7..bc3d78e9 100644 --- a/scripts/PokemonMansion2F.asm +++ b/scripts/PokemonMansion2F.asm @@ -1,5 +1,5 @@ PokemonMansion2F_Script: - call Mansion2Script_51fee + call Mansion2CheckReplaceSwitchDoorBlocks call EnableAutoTextBoxDrawing ld hl, Mansion2TrainerHeaders ld de, PokemonMansion2F_ScriptPointers @@ -8,36 +8,36 @@ PokemonMansion2F_Script: ld [wPokemonMansion2FCurScript], a ret -Mansion2Script_51fee: +Mansion2CheckReplaceSwitchDoorBlocks: ld hl, wCurrentMapScriptFlags bit 5, [hl] res 5, [hl] ret z CheckEvent EVENT_MANSION_SWITCH_ON - jr nz, .asm_52016 + jr nz, .switchTurnedOn ld a, $e lb bc, 2, 4 - call Mansion2Script_5202f + call Mansion2ReplaceBlock ld a, $54 lb bc, 4, 9 - call Mansion2Script_5202f + call Mansion2ReplaceBlock ld a, $5f lb bc, 11, 3 - call Mansion2Script_5202f + call Mansion2ReplaceBlock ret -.asm_52016 +.switchTurnedOn ld a, $5f lb bc, 2, 4 - call Mansion2Script_5202f + call Mansion2ReplaceBlock ld a, $e lb bc, 4, 9 - call Mansion2Script_5202f + call Mansion2ReplaceBlock ld a, $e lb bc, 11, 3 - call Mansion2Script_5202f + call Mansion2ReplaceBlock ret -Mansion2Script_5202f: +Mansion2ReplaceBlock: ld [wNewTileBlockID], a predef_jump ReplaceTileBlock diff --git a/scripts/PokemonMansion3F.asm b/scripts/PokemonMansion3F.asm index ddded4e9..c3a9fba8 100644 --- a/scripts/PokemonMansion3F.asm +++ b/scripts/PokemonMansion3F.asm @@ -1,5 +1,5 @@ PokemonMansion3F_Script: - call Mansion3Script_52204 + call Mansion3CheckReplaceSwitchDoorBlocks call EnableAutoTextBoxDrawing ld hl, Mansion3TrainerHeaders ld de, PokemonMansion3F_ScriptPointers @@ -8,27 +8,27 @@ PokemonMansion3F_Script: ld [wPokemonMansion3FCurScript], a ret -Mansion3Script_52204: +Mansion3CheckReplaceSwitchDoorBlocks: ld hl, wCurrentMapScriptFlags bit 5, [hl] res 5, [hl] ret z CheckEvent EVENT_MANSION_SWITCH_ON - jr nz, .asm_52224 + jr nz, .switchTurnedOn ld a, $e lb bc, 2, 7 - call Mansion2Script_5202f + call Mansion2ReplaceBlock ld a, $5f lb bc, 5, 7 - call Mansion2Script_5202f + call Mansion2ReplaceBlock ret -.asm_52224 +.switchTurnedOn ld a, $5f lb bc, 2, 7 - call Mansion2Script_5202f + call Mansion2ReplaceBlock ld a, $e lb bc, 5, 7 - call Mansion2Script_5202f + call Mansion2ReplaceBlock ret PokemonMansion3F_ScriptPointers: @@ -38,8 +38,8 @@ PokemonMansion3F_ScriptPointers: dw_const EndTrainerBattle, SCRIPT_POKEMONMANSION3F_END_BATTLE PokemonMansion3FDefaultScript: - ld hl, CoordsData_52254 - call Mansion3Script_5225b + ld hl, .holeCoords + call .isPlayerFallingDownHole ld a, [wWhichDungeonWarp] and a jp z, CheckFightingMapTrainers @@ -51,13 +51,13 @@ PokemonMansion3FDefaultScript: ld [wDungeonWarpDestinationMap], a ret -CoordsData_52254: +.holeCoords: dbmapcoord 16, 14 dbmapcoord 17, 14 dbmapcoord 19, 14 db -1 ; end -Mansion3Script_5225b: +.isPlayerFallingDownHole: xor a ld [wWhichDungeonWarp], a ld a, [wd72d] diff --git a/scripts/PokemonMansionB1F.asm b/scripts/PokemonMansionB1F.asm index 187a765f..74f1648e 100644 --- a/scripts/PokemonMansionB1F.asm +++ b/scripts/PokemonMansionB1F.asm @@ -1,5 +1,5 @@ PokemonMansionB1F_Script: - call Mansion4Script_523cf + call MansionB1FCheckReplaceSwitchDoorBlocks call EnableAutoTextBoxDrawing ld hl, Mansion4TrainerHeaders ld de, PokemonMansionB1F_ScriptPointers @@ -8,39 +8,39 @@ PokemonMansionB1F_Script: ld [wPokemonMansionB1FCurScript], a ret -Mansion4Script_523cf: +MansionB1FCheckReplaceSwitchDoorBlocks: ld hl, wCurrentMapScriptFlags bit 5, [hl] res 5, [hl] ret z CheckEvent EVENT_MANSION_SWITCH_ON - jr nz, .asm_523ff + jr nz, .switchTurnedOn ld a, $e ld bc, $80d - call Mansion2Script_5202f + call Mansion2ReplaceBlock ld a, $e ld bc, $b06 - call Mansion2Script_5202f + call Mansion2ReplaceBlock ld a, $5f ld bc, $304 - call Mansion2Script_5202f + call Mansion2ReplaceBlock ld a, $54 ld bc, $808 - call Mansion2Script_5202f + call Mansion2ReplaceBlock ret -.asm_523ff +.switchTurnedOn ld a, $2d ld bc, $80d - call Mansion2Script_5202f + call Mansion2ReplaceBlock ld a, $5f ld bc, $b06 - call Mansion2Script_5202f + call Mansion2ReplaceBlock ld a, $e ld bc, $304 - call Mansion2Script_5202f + call Mansion2ReplaceBlock ld a, $e ld bc, $808 - call Mansion2Script_5202f + call Mansion2ReplaceBlock ret Mansion4Script_Switches:: diff --git a/scripts/SeafoamIslands1F.asm b/scripts/SeafoamIslands1F.asm index eda3051b..27ddc276 100644 --- a/scripts/SeafoamIslands1F.asm +++ b/scripts/SeafoamIslands1F.asm @@ -4,34 +4,34 @@ SeafoamIslands1F_Script: ld hl, wFlags_0xcd60 bit 7, [hl] res 7, [hl] - jr z, .asm_4483b + jr z, .noBoulderWasPushed ld hl, Seafoam1HolesCoords call CheckBoulderCoords ret nc EventFlagAddress hl, EVENT_SEAFOAM1_BOULDER1_DOWN_HOLE ld a, [wCoordIndex] cp $1 - jr nz, .asm_44819 + jr nz, .boulder2FellDownHole SetEventReuseHL EVENT_SEAFOAM1_BOULDER1_DOWN_HOLE ld a, HS_SEAFOAM_ISLANDS_1F_BOULDER_1 ld [wObjectToHide], a ld a, HS_SEAFOAM_ISLANDS_B1F_BOULDER_1 ld [wObjectToShow], a - jr .asm_44825 -.asm_44819 + jr .hideAndShowBoulderObjects +.boulder2FellDownHole SetEventAfterBranchReuseHL EVENT_SEAFOAM1_BOULDER2_DOWN_HOLE, EVENT_SEAFOAM1_BOULDER1_DOWN_HOLE ld a, HS_SEAFOAM_ISLANDS_1F_BOULDER_2 ld [wObjectToHide], a ld a, HS_SEAFOAM_ISLANDS_B1F_BOULDER_2 ld [wObjectToShow], a -.asm_44825 +.hideAndShowBoulderObjects ld a, [wObjectToHide] ld [wMissableObjectIndex], a predef HideObject ld a, [wObjectToShow] ld [wMissableObjectIndex], a predef_jump ShowObject -.asm_4483b +.noBoulderWasPushed ld a, SEAFOAM_ISLANDS_B1F ld [wDungeonWarpDestinationMap], a ld hl, Seafoam1HolesCoords diff --git a/scripts/SeafoamIslandsB1F.asm b/scripts/SeafoamIslandsB1F.asm index 6a56c337..271775ed 100644 --- a/scripts/SeafoamIslandsB1F.asm +++ b/scripts/SeafoamIslandsB1F.asm @@ -3,34 +3,34 @@ SeafoamIslandsB1F_Script: ld hl, wFlags_0xcd60 bit 7, [hl] res 7, [hl] - jr z, .asm_46362 + jr z, .noBoulderWasPushed ld hl, Seafoam2HolesCoords call CheckBoulderCoords ret nc EventFlagAddress hl, EVENT_SEAFOAM2_BOULDER1_DOWN_HOLE ld a, [wCoordIndex] cp $1 - jr nz, .asm_46340 + jr nz, .boulder2FellDownHole SetEventReuseHL EVENT_SEAFOAM2_BOULDER1_DOWN_HOLE ld a, HS_SEAFOAM_ISLANDS_B1F_BOULDER_1 ld [wObjectToHide], a ld a, HS_SEAFOAM_ISLANDS_B2F_BOULDER_1 ld [wObjectToShow], a - jr .asm_4634c -.asm_46340 + jr .hideAndShowBoulderObjects +.boulder2FellDownHole SetEventAfterBranchReuseHL EVENT_SEAFOAM2_BOULDER2_DOWN_HOLE, EVENT_SEAFOAM2_BOULDER1_DOWN_HOLE ld a, HS_SEAFOAM_ISLANDS_B1F_BOULDER_2 ld [wObjectToHide], a ld a, HS_SEAFOAM_ISLANDS_B2F_BOULDER_2 ld [wObjectToShow], a -.asm_4634c +.hideAndShowBoulderObjects ld a, [wObjectToHide] ld [wMissableObjectIndex], a predef HideObject ld a, [wObjectToShow] ld [wMissableObjectIndex], a predef_jump ShowObject -.asm_46362 +.noBoulderWasPushed ld a, SEAFOAM_ISLANDS_B2F ld [wDungeonWarpDestinationMap], a ld hl, Seafoam2HolesCoords diff --git a/scripts/SeafoamIslandsB2F.asm b/scripts/SeafoamIslandsB2F.asm index 635d923f..71ae2e1a 100644 --- a/scripts/SeafoamIslandsB2F.asm +++ b/scripts/SeafoamIslandsB2F.asm @@ -3,34 +3,34 @@ SeafoamIslandsB2F_Script: ld hl, wFlags_0xcd60 bit 7, [hl] res 7, [hl] - jr z, .asm_4649e + jr z, .noBoulderWasPushed ld hl, Seafoam3HolesCoords call CheckBoulderCoords ret nc EventFlagAddress hl, EVENT_SEAFOAM3_BOULDER1_DOWN_HOLE ld a, [wCoordIndex] cp $1 - jr nz, .asm_4647c + jr nz, .boulder2FellDownHole SetEventReuseHL EVENT_SEAFOAM3_BOULDER1_DOWN_HOLE ld a, HS_SEAFOAM_ISLANDS_B2F_BOULDER_1 ld [wObjectToHide], a ld a, HS_SEAFOAM_ISLANDS_B3F_BOULDER_3 ld [wObjectToShow], a - jr .asm_46488 -.asm_4647c + jr .hideAndShowBoulderObjects +.boulder2FellDownHole SetEventAfterBranchReuseHL EVENT_SEAFOAM3_BOULDER2_DOWN_HOLE, EVENT_SEAFOAM3_BOULDER1_DOWN_HOLE ld a, HS_SEAFOAM_ISLANDS_B2F_BOULDER_2 ld [wObjectToHide], a ld a, HS_SEAFOAM_ISLANDS_B3F_BOULDER_4 ld [wObjectToShow], a -.asm_46488 +.hideAndShowBoulderObjects ld a, [wObjectToHide] ld [wMissableObjectIndex], a predef HideObject ld a, [wObjectToShow] ld [wMissableObjectIndex], a predef_jump ShowObject -.asm_4649e +.noBoulderWasPushed ld a, SEAFOAM_ISLANDS_B3F ld [wDungeonWarpDestinationMap], a ld hl, Seafoam3HolesCoords diff --git a/scripts/SeafoamIslandsB3F.asm b/scripts/SeafoamIslandsB3F.asm index a1e17833..8c225dcc 100644 --- a/scripts/SeafoamIslandsB3F.asm +++ b/scripts/SeafoamIslandsB3F.asm @@ -3,35 +3,35 @@ SeafoamIslandsB3F_Script: ld hl, wFlags_0xcd60 bit 7, [hl] res 7, [hl] - jr z, .asm_465dc + jr z, .noBoulderWasPushed ld hl, Seafoam4HolesCoords call CheckBoulderCoords ret nc EventFlagAddress hl, EVENT_SEAFOAM4_BOULDER1_DOWN_HOLE ld a, [wCoordIndex] cp $1 - jr nz, .asm_465b8 + jr nz, .boulder2FellDownHole SetEventReuseHL EVENT_SEAFOAM4_BOULDER1_DOWN_HOLE ld a, HS_SEAFOAM_ISLANDS_B3F_BOULDER_1 ld [wObjectToHide], a ld a, HS_SEAFOAM_ISLANDS_B4F_BOULDER_1 ld [wObjectToShow], a - jr .asm_465c4 -.asm_465b8 + jr .hideAndShowBoulderObjects +.boulder2FellDownHole SetEventAfterBranchReuseHL EVENT_SEAFOAM4_BOULDER2_DOWN_HOLE, EVENT_SEAFOAM4_BOULDER1_DOWN_HOLE ld a, HS_SEAFOAM_ISLANDS_B3F_BOULDER_2 ld [wObjectToHide], a ld a, HS_SEAFOAM_ISLANDS_B4F_BOULDER_2 ld [wObjectToShow], a -.asm_465c4 +.hideAndShowBoulderObjects ld a, [wObjectToHide] ld [wMissableObjectIndex], a predef HideObject ld a, [wObjectToShow] ld [wMissableObjectIndex], a predef ShowObject - jr .asm_465ed -.asm_465dc + jr .runCurrentMapScript +.noBoulderWasPushed ld a, SEAFOAM_ISLANDS_B4F ld [wDungeonWarpDestinationMap], a ld hl, Seafoam4HolesCoords @@ -39,7 +39,7 @@ SeafoamIslandsB3F_Script: ld a, [wd732] bit 4, a ret nz -.asm_465ed +.runCurrentMapScript ld hl, SeafoamIslandsB3F_ScriptPointers ld a, [wSeafoamIslandsB3FCurScript] jp CallFunctionInTable @@ -67,7 +67,7 @@ SeafoamIslandsB3FDefaultScript: cp 15 ret nz ld hl, wSimulatedJoypadStatesEnd - ld de, RLEMovement46632 + ld de, RLEList_ForcedSurfingStrongCurrentNearSteps call DecodeRLEList dec a ld [wSimulatedJoypadStatesIndex], a @@ -78,7 +78,7 @@ SeafoamIslandsB3FDefaultScript: ld [wSeafoamIslandsB3FCurScript], a ret -RLEMovement46632: +RLEList_ForcedSurfingStrongCurrentNearSteps: db D_DOWN, 6 db D_RIGHT, 5 db D_DOWN, 3 @@ -97,15 +97,15 @@ SeafoamIslandsB3FMoveObjectScript: ret z ld a, [wXCoord] cp 18 - jr z, .asm_4665e + jr z, .playerFellThroughHoleLeft cp 19 ld a, SCRIPT_SEAFOAMISLANDSB3F_DEFAULT - jr nz, .asm_4667b - ld de, RLEData_4667f - jr .asm_46661 -.asm_4665e - ld de, RLEData_46688 -.asm_46661 + jr nz, .playerNotInStrongCurrent + ld de, .RLEList_StrongCurrentNearRightBoulder + jr .forceSurfMovement +.playerFellThroughHoleLeft + ld de, .RLEList_StrongCurrentNearLeftBoulder +.forceSurfMovement ld hl, wSimulatedJoypadStatesEnd call DecodeRLEList dec a @@ -117,18 +117,18 @@ SeafoamIslandsB3FMoveObjectScript: ld hl, wFlags_D733 set 2, [hl] ld a, SCRIPT_SEAFOAMISLANDSB3F_OBJECT_MOVING2 -.asm_4667b +.playerNotInStrongCurrent ld [wSeafoamIslandsB3FCurScript], a ret -RLEData_4667f: +.RLEList_StrongCurrentNearRightBoulder: db D_DOWN, 6 db D_RIGHT, 2 db D_DOWN, 4 db D_LEFT, 1 db -1 ; end -RLEData_46688: +.RLEList_StrongCurrentNearLeftBoulder: db D_DOWN, 6 db D_RIGHT, 2 db D_DOWN, 4 diff --git a/scripts/SeafoamIslandsB4F.asm b/scripts/SeafoamIslandsB4F.asm index 98ea0a5b..7584cd81 100644 --- a/scripts/SeafoamIslandsB4F.asm +++ b/scripts/SeafoamIslandsB4F.asm @@ -4,7 +4,7 @@ SeafoamIslandsB4F_Script: ld hl, SeafoamIslandsB4F_ScriptPointers jp CallFunctionInTable -SeafoamIslands5Script_467a5: +SeafoamIslandsB4FResetScript: xor a ld [wSeafoamIslandsB4FCurScript], a ld [wJoyIgnore], a @@ -22,7 +22,7 @@ SeafoamIslandsB4F_ScriptPointers: SeafoamIslandsB4FObjectMoving3Script: ld a, [wIsInBattle] cp $ff - jr z, SeafoamIslands5Script_467a5 + jr z, SeafoamIslandsB4FResetScript call EndTrainerBattle ld a, SCRIPT_SEAFOAMISLANDSB4F_DEFAULT ld [wSeafoamIslandsB4FCurScript], a @@ -36,14 +36,14 @@ SeafoamIslandsB4FDefaultScript: ret nc ld a, [wCoordIndex] cp $3 - jr nc, .asm_467e6 + jr nc, .only1UpInputNeeded ld a, NPC_MOVEMENT_UP ld [wSimulatedJoypadStatesEnd + 1], a ld a, 2 - jr .asm_467e8 -.asm_467e6 + jr .forcePlayerUpFromSurfExit +.only1UpInputNeeded ld a, 1 -.asm_467e8 +.forcePlayerUpFromSurfExit ld [wSimulatedJoypadStatesIndex], a ld a, D_UP ld [wSimulatedJoypadStatesEnd], a @@ -74,26 +74,26 @@ SeafoamIslandsB4FObjectMoving1Script: SeafoamIslandsB4FMoveObjectScript: CheckBothEventsSet EVENT_SEAFOAM4_BOULDER1_DOWN_HOLE, EVENT_SEAFOAM4_BOULDER2_DOWN_HOLE ld a, SCRIPT_SEAFOAMISLANDSB4F_DEFAULT - jr z, .asm_46849 + jr z, .playerNotInStrongCurrent ld hl, .Coords call ArePlayerCoordsInArray ld a, SCRIPT_SEAFOAMISLANDSB4F_DEFAULT - jr nc, .asm_46849 + jr nc, .playerNotInStrongCurrent ld a, [wCoordIndex] cp $1 - jr nz, .asm_46837 - ld de, RLEMovementData_46859 - jr .asm_4683a -.asm_46837 - ld de, RLEMovementData_46852 -.asm_4683a + jr nz, .nearRightBoulder + ld de, .RLEList_StrongCurrentNearLeftBoulder + jr .forceSurfMovement +.nearRightBoulder + ld de, .RLEList_StrongCurrentNearRightBoulder +.forceSurfMovement ld hl, wSimulatedJoypadStatesEnd call DecodeRLEList dec a ld [wSimulatedJoypadStatesIndex], a call StartSimulatingJoypadStates ld a, SCRIPT_SEAFOAMISLANDSB4F_OBJECT_MOVING2 -.asm_46849 +.playerNotInStrongCurrent ld [wSeafoamIslandsB4FCurScript], a ret @@ -102,13 +102,13 @@ SeafoamIslandsB4FMoveObjectScript: dbmapcoord 5, 14 db -1 ; end -RLEMovementData_46852: +.RLEList_StrongCurrentNearRightBoulder: db D_UP, 3 db D_RIGHT, 2 db D_UP, 1 db -1 ; end -RLEMovementData_46859: +.RLEList_StrongCurrentNearLeftBoulder: db D_UP, 3 db D_RIGHT, 3 db D_UP, 1 -- cgit v1.3.1-sl0p