diff options
Diffstat (limited to 'engine')
| -rw-r--r-- | engine/battle/core.asm | 17 | ||||
| -rw-r--r-- | engine/battle/effects.asm | 2 | ||||
| -rw-r--r-- | engine/battle/init_battle.asm | 8 | ||||
| -rw-r--r-- | engine/battle/init_battle_variables.asm | 2 | ||||
| -rw-r--r-- | engine/battle/link_battle_versus_text.asm | 4 | ||||
| -rw-r--r-- | engine/debug/debug_menu.asm | 7 | ||||
| -rw-r--r-- | engine/debug/debug_party.asm | 13 | ||||
| -rw-r--r-- | engine/events/cinnabar_lab.asm | 24 | ||||
| -rw-r--r-- | engine/events/hidden_objects/safari_game.asm | 2 | ||||
| -rw-r--r-- | engine/items/item_effects.asm | 6 | ||||
| -rw-r--r-- | engine/menus/link_menu.asm | 4 | ||||
| -rw-r--r-- | engine/menus/main_menu.asm | 9 | ||||
| -rw-r--r-- | engine/menus/save.asm | 2 | ||||
| -rw-r--r-- | engine/movie/oak_speech/oak_speech.asm | 16 | ||||
| -rw-r--r-- | engine/movie/title.asm | 4 | ||||
| -rw-r--r-- | engine/overworld/auto_movement.asm | 4 | ||||
| -rw-r--r-- | engine/overworld/ledges.asm | 2 | ||||
| -rw-r--r-- | engine/overworld/player_state.asm | 4 | ||||
| -rw-r--r-- | engine/overworld/push_boulder.asm | 2 | ||||
| -rw-r--r-- | engine/overworld/special_warps.asm | 61 | ||||
| -rw-r--r-- | engine/pikachu/pikachu_emotions.asm | 4 |
21 files changed, 106 insertions, 91 deletions
diff --git a/engine/battle/core.asm b/engine/battle/core.asm index addff324..3bc59a4f 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -2599,9 +2599,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 @@ -2659,11 +2659,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 @@ -2687,8 +2688,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] @@ -2758,8 +2763,9 @@ ENDC 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 @@ -6265,6 +6271,7 @@ GetCurrentMove: jr .selected .player ld de, wPlayerMoveNum + ; Apply InitBattleVariables to TestBattle. ld a, [wFlags_D733] bit BIT_TEST_BATTLE, a ld a, [wTestBattlePlayerSelectedMove] diff --git a/engine/battle/effects.asm b/engine/battle/effects.asm index f13d679c..c6ec7628 100644 --- a/engine/battle/effects.asm +++ b/engine/battle/effects.asm @@ -128,7 +128,7 @@ PoisonEffect: ret nc .inflictPoison dec hl - set 3, [hl] ; mon is now poisoned + set PSN, [hl] push de dec de ldh a, [hWhoseTurn] diff --git a/engine/battle/init_battle.asm b/engine/battle/init_battle.asm index e7be112c..e4c56d6d 100644 --- a/engine/battle/init_battle.asm +++ b/engine/battle/init_battle.asm @@ -11,12 +11,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/battle/link_battle_versus_text.asm b/engine/battle/link_battle_versus_text.asm index e55a0672..d06f7f39 100644 --- a/engine/battle/link_battle_versus_text.asm +++ b/engine/battle/link_battle_versus_text.asm @@ -12,9 +12,9 @@ DisplayLinkBattleVersusTextBox: call PlaceString ; place bold "VS" tiles between the names hlcoord 9, 8 - ld a, $69 + ld a, "<BOLD_V>" ld [hli], a - ld [hl], $6a + ld [hl], "<BOLD_S>" xor a ld [wUpdateSpritesEnabled], a callfar SetupPlayerAndEnemyPokeballs diff --git a/engine/debug/debug_menu.asm b/engine/debug/debug_menu.asm index d888743e..b90c16b2 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] ld hl, StartNewGameDebug ret @@ -70,12 +70,11 @@ DebugMenuOptions: db "FIGHT" next "DEBUG@" -TestBattle: +TestBattle: ; unreferenced except in _DEBUG ld a, 1 ldh [hJoy7], a - ; Don't mess around - ; with obedience. + ; Don't mess around with obedience. ld a, 1 << BIT_EARTHBADGE ld [wObtainedBadges], a diff --git a/engine/debug/debug_party.asm b/engine/debug/debug_party.asm index 1945950f..e00ee471 100644 --- a/engine/debug/debug_party.asm +++ b/engine/debug/debug_party.asm @@ -1,6 +1,5 @@ -; not IshiharaTeam -SetDebugTeam: - ld de, DebugTeam +SetDebugNewGameParty: ; unreferenced except in _DEBUG + ld de, DebugNewGameParty .loop ld a, [de] cp -1 @@ -13,20 +12,20 @@ SetDebugTeam: call AddPartyMon jr .loop -DebugTeam: +DebugNewGameParty: ; unreferenced except in _DEBUG db SNORLAX, 80 db PERSIAN, 80 db JIGGLYPUFF, 15 db STARTER_PIKACHU, 5 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 @@ -34,7 +33,7 @@ IF DEF(_DEBUG) ld a, ~(1 << BIT_EARTHBADGE) ld [wObtainedBadges], a - call SetDebugTeam + call SetDebugNewGameParty ; Pikachu gets Surf. ld a, SURF 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/engine/events/hidden_objects/safari_game.asm b/engine/events/hidden_objects/safari_game.asm index 2863a201..e7d1a729 100644 --- a/engine/events/hidden_objects/safari_game.asm +++ b/engine/events/hidden_objects/safari_game.asm @@ -48,7 +48,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 c495f991..4430c6fb 100644 --- a/engine/items/item_effects.asm +++ b/engine/items/item_effects.asm @@ -171,7 +171,7 @@ ItemUseBall: jp nz, .captured ld a, $1 ld [wCapturedMonSpecies], a - CheckEvent EVENT_02F + CheckEvent EVENT_INITIAL_CATCH_TRAINING ld b, $63 jp nz, .setAnimData jp .captured @@ -1295,7 +1295,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 @@ -1650,7 +1650,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/menus/link_menu.asm b/engine/menus/link_menu.asm index ada3941e..170d5d64 100644 --- a/engine/menus/link_menu.asm +++ b/engine/menus/link_menu.asm @@ -775,10 +775,10 @@ LinkMenu: ld c, 50 call DelayFrames ld hl, wd732 - res 1, [hl] + res BIT_DEBUG_MODE, [hl] ld a, [wDefaultMap] ld [wDestinationMap], a - callfar SpecialWarpIn + callfar PrepareForSpecialWarp ld c, 20 call DelayFrames xor a diff --git a/engine/menus/main_menu.asm b/engine/menus/main_menu.asm index ce0b12c5..ca837143 100644 --- a/engine/menus/main_menu.asm +++ b/engine/menus/main_menu.asm @@ -119,7 +119,7 @@ MainMenu: ld [wDestinationMap], a ld hl, wd732 set 2, [hl] ; fly warp or dungeon warp - call SpecialWarpIn + call PrepareForSpecialWarp jp SpecialEnterMap InitOptions: @@ -146,7 +146,12 @@ NotEnoughMemoryText: 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/menus/save.asm b/engine/menus/save.asm index 359830d9..b7ad5d66 100644 --- a/engine/menus/save.asm +++ b/engine/menus/save.asm @@ -366,7 +366,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/engine/movie/oak_speech/oak_speech.asm b/engine/movie/oak_speech/oak_speech.asm index 3c6b8b45..3e874560 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 a, [wPrinterSettings] @@ -32,6 +37,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 @@ -57,15 +63,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 @@ -101,7 +107,7 @@ OakSpeech: ld hl, IntroduceRivalText call PrintText call ChooseRivalName -.skipChoosingNames +.skipSpeech call GBFadeOutToWhite call ClearScreen ld de, RedPicFront diff --git a/engine/movie/title.asm b/engine/movie/title.asm index 3d054138..c012e92a 100644 --- a/engine/movie/title.asm +++ b/engine/movie/title.asm @@ -44,10 +44,10 @@ DisplayTitleScreen: ld bc, 1 tiles ld a, BANK(NineTile) call FarCopyData - ld hl, GamefreakLogoGraphics + ld hl, GameFreakLogoGraphics ld de, vTitleLogo tile $65 ld bc, 9 tiles - ld a, BANK(GamefreakLogoGraphics) + ld a, BANK(GameFreakLogoGraphics) call FarCopyData callfar LoadYellowTitleScreenGFX ld hl, vBGMap0 diff --git a/engine/overworld/auto_movement.asm b/engine/overworld/auto_movement.asm index a68da55f..65888294 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] @@ -85,7 +85,7 @@ PalletMovementScript_OakMoveLeft: call PlayMusic 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 efb56628..96441838 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 4998360d..1cedcf7c 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 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/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/engine/pikachu/pikachu_emotions.asm b/engine/pikachu/pikachu_emotions.asm index ae5d662e..71020138 100644 --- a/engine/pikachu/pikachu_emotions.asm +++ b/engine/pikachu/pikachu_emotions.asm @@ -257,11 +257,11 @@ load_expression: ret MACRO pikaemotion_def -\1_id: +\1_id:: dw \1 ENDM -PikachuEmotionTable: +PikachuEmotionTable:: pikaemotion_def PikachuEmotion0 pikaemotion_def PikachuEmotion1 pikaemotion_def PikachuEmotion2 |
