diff --git a/audio/engine_1.asm b/audio/engine_1.asm index e9642b326c..24bd64e84d 100644 --- a/audio/engine_1.asm +++ b/audio/engine_1.asm @@ -1186,11 +1186,11 @@ Audio1_InitPitchSlideVars: sub e ld e, a -; Bug. Instead of borrowing from the high byte of the target frequency as it -; should, it borrows from the high byte of the current frequency instead. -; This means that the result will be 0x200 greater than it should be if the -; low byte of the current frequency is greater than the low byte of the -; target frequency. + ; BUG: Instead of borrowing from the high byte of the target frequency as it + ; should, it borrows from the high byte of the current frequency instead. + ; This means that the result will be 0x200 greater than it should be if the + ; low byte of the current frequency is greater than the low byte of the + ; target frequency. ld a, d sbc b ld d, a diff --git a/audio/engine_2.asm b/audio/engine_2.asm index 2f11c02733..ff0d08d46f 100644 --- a/audio/engine_2.asm +++ b/audio/engine_2.asm @@ -1249,11 +1249,11 @@ Audio2_InitPitchSlideVars: sub e ld e, a -; Bug. Instead of borrowing from the high byte of the target frequency as it -; should, it borrows from the high byte of the current frequency instead. -; This means that the result will be 0x200 greater than it should be if the -; low byte of the current frequency is greater than the low byte of the -; target frequency. + ; BUG: Instead of borrowing from the high byte of the target frequency as it + ; should, it borrows from the high byte of the current frequency instead. + ; This means that the result will be 0x200 greater than it should be if the + ; low byte of the current frequency is greater than the low byte of the + ; target frequency. ld a, d sbc b ld d, a diff --git a/audio/engine_3.asm b/audio/engine_3.asm index f524875f7f..a1c123a3f3 100644 --- a/audio/engine_3.asm +++ b/audio/engine_3.asm @@ -1186,11 +1186,11 @@ Audio3_InitPitchSlideVars: sub e ld e, a -; Bug. Instead of borrowing from the high byte of the target frequency as it -; should, it borrows from the high byte of the current frequency instead. -; This means that the result will be 0x200 greater than it should be if the -; low byte of the current frequency is greater than the low byte of the -; target frequency. + ; BUG: Instead of borrowing from the high byte of the target frequency as it + ; should, it borrows from the high byte of the current frequency instead. + ; This means that the result will be 0x200 greater than it should be if the + ; low byte of the current frequency is greater than the low byte of the + ; target frequency. ld a, d sbc b ld d, a diff --git a/engine/battle/animations.asm b/engine/battle/animations.asm index 83f30ee217..024d1ae8c6 100644 --- a/engine/battle/animations.asm +++ b/engine/battle/animations.asm @@ -1341,7 +1341,8 @@ AdjustOAMBlockYPos2: cp 112 jr c, .skipSettingPreviousEntrysAttribute dec hl - ld a, 160 ; bug, sets previous OAM entry's attribute + ; BUG: sets previous OAM entry's attribute + ld a, 160 ld [hli], a .skipSettingPreviousEntrysAttribute ld [hl], a @@ -1833,9 +1834,9 @@ _AnimationSlideMonOff: .PlayerNextTile ld a, [hl] add 7 -; This is a bug. The lower right corner tile of the mon back pic is blanked -; while the mon is sliding off the screen. It should compare with the max tile -; plus one instead. + ; BUG: The lower right corner tile of the mon back pic is blanked + ; while the mon is sliding off the screen. It should compare with + ; the max tile plus one instead. cp $61 ret c ld a, " " @@ -1844,8 +1845,9 @@ _AnimationSlideMonOff: .EnemyNextTile ld a, [hl] sub 7 -; This has the same problem as above, but it has no visible effect because -; the lower right tile is in the first column to slide off the screen. + ; BUG: This has the same problem as above, but it has no visible effect + ; because the lower right tile is in the first column to slide off + ; the screen. cp $30 ret c ld a, " " @@ -2187,8 +2189,7 @@ AnimCopyRowRight: jr nz, AnimCopyRowRight ret -; get the sound of the move id in b -GetMoveSoundB: +GetMoveSoundB: ; unused ld a, b call GetMoveSound ld b, a diff --git a/engine/battle/core.asm b/engine/battle/core.asm index a951a0729a..58524eace4 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -544,7 +544,7 @@ HurtByLeechSeedText: text_end ; decreases the mon's current HP by 1/16 of the Max HP (multiplied by number of toxic ticks if active) -; note that the toxic ticks are considered even if the damage is not poison (hence the Leech Seed glitch) +; note that the toxic ticks are considered even if the damage is not poison (hence the Leech Seed bug) ; hl: HP pointer ; bc (out): total damage HandlePoisonBurnLeechSeed_DecreaseOwnHP: @@ -744,7 +744,7 @@ FaintEnemyPokemon: .wild ld hl, wPlayerBattleStatus1 res ATTACKING_MULTIPLE_TIMES, [hl] -; Bug. This only zeroes the high byte of the player's accumulated damage, +; BUG: This only zeroes the high byte of the player's accumulated damage, ; setting the accumulated damage to itself mod 256 instead of 0 as was probably ; intended. That alone is problematic, but this mistake has another more severe ; effect. This function's counterpart for when the player mon faints, @@ -794,7 +794,7 @@ FaintEnemyPokemon: ld a, MUSIC_DEFEATED_WILD_MON call PlayBattleVictoryMusic .sfxplayed -; bug: win sfx is played for wild battles before checking for player mon HP +; BUG: win sfx is played for wild battles before checking for player mon HP ; this can lead to odd scenarios where both player and enemy faint, as the win sfx plays yet the player never won the battle ld hl, wBattleMonHP ld a, [hli] @@ -1177,7 +1177,7 @@ LinkBattleLostText: text_end ; slides pic of fainted mon downwards until it disappears -; bug: when this is called, [hAutoBGTransferEnabled] is non-zero, so there is screen tearing +; BUG: when this is called, [hAutoBGTransferEnabled] is non-zero, so there is screen tearing SlideDownFaintedMonPic: ld a, [wStatusFlags5] push af @@ -1230,7 +1230,7 @@ SevenSpacesText: ; slides the player or enemy trainer off screen ; a is the number of tiles to slide it horizontally (always 9 for the player trainer or 8 for the enemy trainer) ; if a is 8, the slide is to the right, else it is to the left -; bug: when this is called, [hAutoBGTransferEnabled] is non-zero, so there is screen tearing +; BUG: when this is called, [hAutoBGTransferEnabled] is non-zero, so there is screen tearing SlideTrainerPicOffScreen: ldh [hSlideAmount], a ld c, a @@ -2013,26 +2013,17 @@ DisplayBattleMenu:: .menuselected ld [wTextBoxID], a call DisplayTextBoxID - ; handle menu input if it's not the old man tutorial ld a, [wBattleType] - dec a + dec a ; BATTLE_TYPE_OLD_MAN jp nz, .handleBattleMenuInput -; the following happens for the old man tutorial - ; Temporarily save the player name in wLinkEnemyTrainerName. - ; Since wLinkEnemyTrainerName == wGrassRate, this affects wild encounters. - ; The wGrassRate byte and following wGrassMons buffer are supposed - ; to get overwritten when entering a map with wild Pokémon, - ; but an oversight prevents this in Cinnabar and Route 21, - ; so the infamous MissingNo. glitch can show up. ld hl, wPlayerName - ld de, wLinkEnemyTrainerName + ld de, wLinkEnemyTrainerName ; same as wGrassRate ld bc, NAME_LENGTH call CopyData ld hl, .oldManName ld de, wPlayerName ld bc, NAME_LENGTH call CopyData -; the following simulates the keystrokes by drawing menus on screen hlcoord 9, 14 ld [hl], "▶" ld c, 80 @@ -2043,7 +2034,7 @@ DisplayBattleMenu:: ld c, 50 call DelayFrames ld [hl], "▷" - ld a, $2 ; select the "ITEM" menu + ld a, 2 ; ITEM jp .upperLeftMenuItemWasNotSelected .oldManName db "OLD MAN@" @@ -2133,19 +2124,16 @@ DisplayBattleMenu:: ld a, [wCurrentMenuItem] ld [wBattleAndStartSavedMenuItem], a jr z, .handleMenuSelection -; not Safari battle -; swap the IDs of the item menu and party menu (this is probably because they swapped the positions -; of these menu items in first generation English versions) - cp $1 ; was the item menu selected? +; Swap the ITEM and battle menu functions. +; This change applies to all Western localizations. + cp 1 ; ITEM jr nz, .notItemMenu -; item menu was selected - inc a ; increment a to 2 + inc a jr .handleMenuSelection .notItemMenu - cp $2 ; was the party menu selected? + cp 2 ; jr nz, .handleMenuSelection -; party menu selected - dec a ; decrement a to 1 + dec a .handleMenuSelection and a jr nz, .upperLeftMenuItemWasNotSelected @@ -2489,8 +2477,7 @@ MoveSelectionMenu: hlcoord 4, 12 ld b, 4 ld c, 14 - di ; out of pure coincidence, it is possible for vblank to occur between the di and ei - ; so it is necessary to put the di ei block to not cause tearing + di call TextBoxBorder hlcoord 4, 12 ld [hl], "─" @@ -4630,8 +4617,9 @@ CriticalHitTest: ld c, [hl] ; read move id ld a, [de] bit GETTING_PUMPED, a ; test for focus energy - jr nz, .focusEnergyUsed ; bug: using focus energy causes a shift to the right instead of left, - ; resulting in 1/4 the usual crit chance + ; BUG: Using Focus Energy causes a shift to the right + ; instead of left, resulting in 1/4 the usual crit chance. + jr nz, .focusEnergyUsed sla b ; (effective (base speed/2)*2) jr nc, .noFocusEnergyUsed ld b, $ff ; cap at 255/256 @@ -4675,7 +4663,7 @@ HandleCounterMove: ; This is irrelevant for the opponent's side outside of link battles, since the move selection is controlled by the AI. ; However, in the scenario where the player switches out and the opponent uses Counter, ; the outcome may be affected by the player's actions in the move selection menu prior to switching the Pokemon. -; This might also lead to desync glitches in link battles. +; This might also lead to desync bugs in link battles. ldh a, [hWhoseTurn] ; whose turn and a @@ -4977,7 +4965,7 @@ AttackSubstitute: ; Self-confusion damage as well as Hi-Jump Kick and Jump Kick recoil cause a momentary turn swap before being applied. ; If the user has a Substitute up and would take damage because of that, ; damage will be applied to the other player's Substitute. -; Normal recoil such as from Double-Edge isn't affected by this glitch, +; Normal recoil such as from Double-Edge isn't affected by this bug, ; because this function is never called in that case. ld hl, SubstituteTookDamageText @@ -5324,7 +5312,8 @@ AIGetTypeEffectiveness: inc hl ld c, [hl] ; c = type 2 of player's pokemon ; initialize to neutral effectiveness - ld a, $10 ; bug: should be EFFECTIVE (10) + ; BUG: should be EFFECTIVE (10) + ld a, $10 ld [wTypeEffectiveness], a ld hl, TypeEffects .loop @@ -6385,8 +6374,7 @@ LoadPlayerBackPic: hlcoord 1, 5 predef_jump CopyUncompressedPicToTilemap -; does nothing since no stats are ever selected (barring glitches) -DoubleOrHalveSelectedStats: +DoubleOrHalveSelectedStats: ; unused callfar DoubleSelectedStats jpfar HalveSelectedStats diff --git a/engine/battle/move_effects/substitute.asm b/engine/battle/move_effects/substitute.asm index b1fd8ac288..8386311cec 100644 --- a/engine/battle/move_effects/substitute.asm +++ b/engine/battle/move_effects/substitute.asm @@ -36,8 +36,9 @@ SubstituteEffect_: ld a, [hl] sbc 0 pop bc + ; BUG: since it only branches on carry, + ; it will possibly leave user with 0 HP. jr c, .notEnoughHP ; underflow means user would be left with negative health - ; bug: since it only branches on carry, it will possibly leave user with 0 HP .userHasZeroOrMoreHP ldi [hl], a ; save resulting HP after subtraction into current HP ld [hl], d diff --git a/engine/battle/unused_stats_functions.asm b/engine/battle/unused_stats_functions.asm index 5174adf539..bfb70f5013 100644 --- a/engine/battle/unused_stats_functions.asm +++ b/engine/battle/unused_stats_functions.asm @@ -1,5 +1,4 @@ -; does nothing since no stats are ever selected (barring glitches) -DoubleSelectedStats: +DoubleSelectedStats: ; unused ldh a, [hWhoseTurn] and a ld a, [wPlayerStatsToDouble] @@ -28,8 +27,7 @@ DoubleSelectedStats: ld [hli], a ret -; does nothing since no stats are ever selected (barring glitches) -HalveSelectedStats: +HalveSelectedStats: ; unused ldh a, [hWhoseTurn] and a ld a, [wPlayerStatsToHalve] diff --git a/engine/battle/wild_encounters.asm b/engine/battle/wild_encounters.asm index b5cf9f518e..8aaaf3e4bb 100644 --- a/engine/battle/wild_encounters.asm +++ b/engine/battle/wild_encounters.asm @@ -1,11 +1,9 @@ -; try to initiate a wild pokemon encounter -; returns success in Z TryDoWildEncounter: ld a, [wNPCMovementScriptPointerTableNum] and a ret nz ld a, [wMovementFlags] - and a ; is player exiting a door, jumping over a ledge, or fishing? + and a ret nz callfar IsPlayerStandingOnDoorTileOrWarpTile jr nc, .notStandingOnDoorOrWarpTile @@ -23,30 +21,37 @@ TryDoWildEncounter: jr z, .lastRepelStep ld [wRepelRemainingSteps], a .next -; determine if wild pokemon can appear in the half-block we're standing in -; is the bottom right tile (9,9) of the half-block we're standing in a grass/water tile? - hlcoord 9, 9 + ; BUG: This coordinates set is inconsistent with + ; the one in the .gotEncounterSlot subroutine below. + ; It was changed from the Japanese versions and + ; reverted for the Western localizations of Yellow. + ; A (9, 9) coordinates set affects wild encounters as + ; they do not occur in tile $34 of the FOREST tileset. + ; The inconsistency causes wGrassRate, which is also + ; wLinkEnemyTrainerName, in both NPC trades and the + ; old man battle type to have random wild encounter data. + ; This localization issue is infamously responsible for + ; the discovery of MISSINGNO. in English Red and Blue + ; while surfing on the eastern shore of CINNABAR_ISLAND, + ; which is actually part of the ROUTE_20 map. + hlcoord 9, 9 ; should be hlcoord 8, 9 ld c, [hl] ld a, [wGrassTile] cp c - ld a, [wGrassRate] + ld a, [wGrassRate] ; same as [wLinkEnemyTrainerName] jr z, .CanEncounter - ld a, $14 ; in all tilesets with a water tile, this is its id + ld a, $14 ; water tile cp c ld a, [wWaterRate] jr z, .CanEncounter -; even if not in grass/water, standing anywhere we can encounter pokemon -; so long as the map is "indoor" and has wild pokemon defined. -; ...as long as it's not Viridian Forest or Safari Zone. ld a, [wCurMap] - cp FIRST_INDOOR_MAP ; is this an indoor map? + cp FIRST_INDOOR_MAP jr c, .CantEncounter2 ld a, [wCurMapTileset] - cp FOREST ; Viridian Forest/Safari Zone + cp FOREST ; VIRIDIAN_FOREST, SAFARI_ZONE jr z, .CantEncounter2 - ld a, [wGrassRate] + ld a, [wGrassRate] ; same as [wLinkEnemyTrainerName] .CanEncounter -; compare encounter chance with a random number to determine if there will be an encounter ld b, a ldh a, [hRandomAdd] cp b @@ -61,15 +66,12 @@ TryDoWildEncounter: inc hl jr .determineEncounterSlot .gotEncounterSlot -; determine which wild pokemon (grass or water) can appear in the half-block we're standing in ld c, [hl] ld hl, wGrassMons lda_coord 8, 9 - cp $14 ; is the bottom left tile (8,9) of the half-block we're standing in a water tile? - jr nz, .gotWildEncounterType ; else, it's treated as a grass tile by default + cp $14 ; water tile + jr nz, .gotWildEncounterType ld hl, wWaterMons -; since the bottom right tile of a "left shore" half-block is $14 but the bottom left tile is not, -; "left shore" half-blocks (such as the one in the east coast of Cinnabar) load grass encounters. .gotWildEncounterType ld b, 0 add hl, bc @@ -85,7 +87,7 @@ TryDoWildEncounter: ld b, a ld a, [wCurEnemyLevel] cp b - jr c, .CantEncounter2 ; repel prevents encounters if the leading party mon's level is higher than the wild mon + jr c, .CantEncounter2 jr .willEncounter .lastRepelStep ld [wRepelRemainingSteps], a diff --git a/engine/debug/debug_menu.asm b/engine/debug/debug_menu.asm index 61c11c26d4..abec44e1cb 100644 --- a/engine/debug/debug_menu.asm +++ b/engine/debug/debug_menu.asm @@ -51,7 +51,7 @@ IF DEF(_DEBUG) jp nz, DisplayTitleScreen ld a, [wCurrentMenuItem] - and a ; FIGHT? + and a ; FIGHT jp z, TestBattle ; DEBUG @@ -73,10 +73,8 @@ ELSE ENDC TestBattle: ; unreferenced except in _DEBUG -.loop call GBPalNormal - ; Don't mess around with obedience. ld a, 1 << BIT_EARTHBADGE ld [wObtainedBadges], a @@ -85,18 +83,15 @@ TestBattle: ; unreferenced except in _DEBUG ; 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. + ; is in the ITEM window at the end of the test battle. + ; pokeyellow initializes TestBattle with a list of items here. - ; Reset the party. ld hl, wPartyCount xor a ld [hli], a dec a ld [hl], a - ; Give the player a level 20 Rhydon. ld a, RHYDON ld [wCurPartySpecies], a ld a, 20 @@ -106,15 +101,12 @@ TestBattle: ; unreferenced except in _DEBUG ld [wCurMap], a call AddPartyMon - ; Fight against a level 20 Rhydon. ld a, RHYDON ld [wCurOpponent], a predef InitOpponent - ; 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 - jr .loop + jr TestBattle diff --git a/engine/debug/debug_party.asm b/engine/debug/debug_party.asm index c16fe97b6e..1555ba4cd0 100644 --- a/engine/debug/debug_party.asm +++ b/engine/debug/debug_party.asm @@ -29,25 +29,23 @@ ENDC IF DEF(_DEBUG) db PIKACHU, 5 ENDC - db -1 ; end + db -1 PrepareNewGameDebug: ; dummy except in _DEBUG IF DEF(_DEBUG) xor a ; PLAYER_PARTY_DATA ld [wMonDataLocation], a - ; Fly anywhere. - dec a ; $ff (all bits) + dec a ; NUM_CITY_MAPS ld [wTownVisitedFlag], a ld [wTownVisitedFlag + 1], a - ; Get all badges except Earth Badge. ld a, ~(1 << BIT_EARTHBADGE) ld [wObtainedBadges], a call SetDebugNewGameParty - ; Exeggutor gets four HM moves. + ; EXEGGUTOR ld hl, wPartyMon1Moves ld a, FLY ld [hli], a @@ -66,7 +64,7 @@ IF DEF(_DEBUG) ld [hli], a ld [hl], a - ; Jolteon gets Thunderbolt. + ; JOLTEON ld hl, wPartyMon3Moves + 3 ld a, THUNDERBOLT ld [hl], a @@ -74,7 +72,7 @@ IF DEF(_DEBUG) ld a, 15 ld [hl], a - ; Articuno gets Fly. + ; ARTICUNO ld hl, wPartyMon5Moves ld a, FLY ld [hl], a @@ -82,7 +80,7 @@ IF DEF(_DEBUG) ld a, 15 ld [hl], a - ; Pikachu gets Surf. + ; PIKACHU ld hl, wPartyMon6Moves + 2 ld a, SURF ld [hl], a @@ -90,9 +88,8 @@ IF DEF(_DEBUG) ld a, 15 ld [hl], a - ; Get some debug items. ld hl, wNumBagItems - ld de, DebugItemsList + ld de, DebugNewGameItemsList .items_loop ld a, [de] cp -1 @@ -106,19 +103,16 @@ IF DEF(_DEBUG) jr .items_loop .items_end - ; Complete the Pokédex. ld hl, wPokedexOwned call DebugSetPokedexEntries ld hl, wPokedexSeen call DebugSetPokedexEntries SetEvent EVENT_GOT_POKEDEX - ; Rival chose Squirtle, - ; Player chose Charmander. ld hl, wRivalStarter ld a, STARTER2 ld [hli], a - inc hl ; hl = wPlayerStarter + inc hl ; wPlayerStarter ld a, STARTER1 ld [hl], a @@ -134,7 +128,7 @@ DebugSetPokedexEntries: ld [hl], %01111111 ret -DebugItemsList: +DebugNewGameItemsList: db BICYCLE, 1 db FULL_RESTORE, 99 db FULL_HEAL, 99 @@ -146,10 +140,10 @@ DebugItemsList: db CARD_KEY, 1 db S_S_TICKET, 1 db LIFT_KEY, 1 - db -1 ; end + db -1 -DebugUnusedList: - db -1 ; end +DebugUnusedList: ; unreferenced + db -1 ELSE ret ENDC diff --git a/engine/events/evolve_trade.asm b/engine/events/evolve_trade.asm index 56069fac4f..aeb3950790 100644 --- a/engine/events/evolve_trade.asm +++ b/engine/events/evolve_trade.asm @@ -1,40 +1,19 @@ -EvolveTradeMon: -; Verify the TradeMon's species name before -; attempting to initiate a trade evolution. - -; The names of the trade evolutions in Blue (JP) -; are checked. In that version, TradeMons that -; can evolve are Graveler and Haunter. - -; In localization, this check was translated -; before monster names were finalized. -; Then, Haunter's name was "Spectre". -; Since its name no longer starts with -; "SP", it is prevented from evolving. - -; This may have been why Red/Green's trades -; were used instead, where none can evolve. - -; This was fixed in Yellow. - +CheckEvolveTradeMonName: ; unused +; This routine is a leftover from Japanese Blue +; and development builds of English Red and Blue. ld a, [wInGameTradeReceiveMonName] - - ; GRAVELER - cp "G" + cp "G" ; GRAVELER jr z, .ok - - ; "SPECTRE" (HAUNTER) - cp "S" + cp "S" ; "SPECTRE" (HAUNTER) ret nz ld a, [wInGameTradeReceiveMonName + 1] - cp "P" + cp "P" ; "SPECTRE" (HAUNTER) ret nz - .ok ld a, [wPartyCount] dec a ld [wWhichPokemon], a - ld a, $1 + ld a, 1 ld [wForceEvolution], a ld a, LINK_STATE_TRADING ld [wLinkState], a diff --git a/engine/events/hidden_objects/vermilion_gym_trash.asm b/engine/events/hidden_objects/vermilion_gym_trash.asm index 92fb1406bb..c7b72dba1b 100644 --- a/engine/events/hidden_objects/vermilion_gym_trash.asm +++ b/engine/events/hidden_objects/vermilion_gym_trash.asm @@ -47,14 +47,15 @@ GymTrashScript: add hl, de ld a, [hli] -; There is a bug in this code. It should calculate a value in the range [0, 3] -; but if the mask and random number don't have any 1 bits in common, then -; the result of the AND will be 0. When 1 is subtracted from that, the value -; will become $ff. This will result in 255 being added to hl, which will cause -; hl to point to one of the zero bytes that pad the end of the ROM bank. -; Trash can 0 was intended to be able to have the second lock only when the -; first lock was in trash can 1 or 3. However, due to this bug, trash can 0 can -; have the second lock regardless of which trash can had the first lock. + ; BUG: It should calculate a value in the range [0, 3] + ; but if the mask and random number don't have any 1 bits in common, then + ; the result of the AND will be 0. When 1 is subtracted from that, the value + ; will become $ff. This will result in 255 being added to hl, which will + ; cause hl to point to one of the zero bytes that pad the end of the + ; ROM bank. + ; Trash can 0 was intended to be able to have the second lock only when the + ; first lock was in trash can 1 or 3. However, due to this bug, trash can 0 + ; can have the second lock regardless of which trash can had the first lock. ldh [hGymTrashCanRandNumMask], a push hl diff --git a/engine/events/in_game_trades.asm b/engine/events/in_game_trades.asm index ce4ffe3c4b..63ebe23707 100644 --- a/engine/events/in_game_trades.asm +++ b/engine/events/in_game_trades.asm @@ -137,7 +137,7 @@ InGameTrade_DoTrade: ld [wMonDataLocation], a call AddPartyMon call InGameTrade_CopyDataToReceivedMon - callfar EvolveTradeMon + callfar CheckEvolveTradeMonName call ClearScreen call InGameTrade_RestoreScreen farcall RedrawMapView diff --git a/engine/items/item_effects.asm b/engine/items/item_effects.asm index 9643412ca4..5d196d73e6 100644 --- a/engine/items/item_effects.asm +++ b/engine/items/item_effects.asm @@ -157,10 +157,10 @@ ItemUseBall: jr nz, .notOldManBattle .oldManBattle - ld hl, wGrassRate + ld hl, wLinkEnemyTrainerName ; same as wGrassRate ld de, wPlayerName ld bc, NAME_LENGTH - call CopyData ; save the player's name in the Wild Monster data (part of the Cinnabar Island Missingno. glitch) + call CopyData jp .captured .notOldManBattle @@ -468,9 +468,9 @@ ItemUseBall: 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. + ; BUG: If the Pokémon is transformed, the Pokémon is assumed to be a Ditto. + ; A wild Pokémon could have used Transform via Mirror Move + ; even though the only wild Pokémon that knows Transform is Ditto. ld hl, wEnemyBattleStatus3 bit TRANSFORMED, [hl] jr z, .notTransformed @@ -2077,10 +2077,11 @@ ItemUsePPRestore: ret .fullyRestorePP ld a, [hl] ; move PP -; Note that this code has a bug. It doesn't mask out the upper two bits, which -; are used to count how many PP Ups have been used on the move. So, Max Ethers -; and Max Elixirs will not be detected as having no effect on a move with full -; PP if the move has had any PP Ups used on it. + ; BUG: This code doesn't mask out the upper two bits, which + ; are used to count how many PP Ups have been used on the move. + ; So, Max Ethers and Max Elixirs will not be detected as having + ; no effect on a move with full PP if the move has had + ; any PP Ups used on it. cp b ; does current PP equal max PP? ret z jr .storeNewAmount diff --git a/engine/link/cable_club.asm b/engine/link/cable_club.asm index 92a1b5960b..e8d78aae26 100644 --- a/engine/link/cable_club.asm +++ b/engine/link/cable_club.asm @@ -57,8 +57,8 @@ CableClub_DoBattleOrTradeAgain: ld [hli], a dec b jr nz, .zeroPlayerDataPatchListLoop - ld hl, wGrassRate - ld bc, wTrainerHeaderPtr - wGrassRate + ld hl, wLinkEnemyTrainerName ; same as wGrassRate + ld bc, wTrainerHeaderPtr - wLinkEnemyTrainerName .zeroEnemyPartyLoop xor a ld [hli], a @@ -915,7 +915,7 @@ CableClub_Run: ld a, l ld [wTilesetCollisionPtr], a xor a - ld [wGrassRate], a + ld [wLinkEnemyTrainerName], a ; same as [wGrassRate] inc a ; LINK_STATE_IN_CABLE_CLUB ld [wLinkState], a ldh [hJoy5], a diff --git a/engine/movie/intro.asm b/engine/movie/intro.asm index 552b135821..0c577df223 100644 --- a/engine/movie/intro.asm +++ b/engine/movie/intro.asm @@ -211,7 +211,6 @@ IntroClearScreen: jr IntroClearCommon IntroClearMiddleOfScreen: -; clear the area of the tile map between the black bars on the top and bottom hlcoord 0, 4 ld bc, SCREEN_WIDTH * 10 @@ -275,8 +274,7 @@ CopyTileIDsFromList_ZeroBaseTileID: ld c, 0 predef_jump CopyTileIDsFromList -PlayMoveSoundB: -; unused +PlayMoveSoundB: ; unreferenced predef GetMoveSoundB ld a, b jp PlaySound @@ -325,8 +323,9 @@ PlayShootingStar: call DelayFrames farcall AnimateShootingStar push af + ; the call to LoadPresentsGraphic here was removed in localization pop af - jr c, .next ; skip the delay if the user interrupted the animation + jr c, .next ld c, 40 call DelayFrames .next @@ -341,7 +340,6 @@ PlayShootingStar: jp Delay3 IntroDrawBlackBars: -; clear the screen and draw black bars on the top and bottom call IntroClearScreen hlcoord 0, 0 ld c, SCREEN_WIDTH * 4 @@ -356,7 +354,10 @@ IntroDrawBlackBars: ld c, BG_MAP_WIDTH * 4 jp IntroPlaceBlackTiles -EmptyFunc2: +LoadPresentsGraphic: ; dummy, unreferenced + ; This routine loads the "PRESENTS" graphic + ; (tiles $67, $68, $69, $6A, $6B, and $6C) + ; at coordinates (11, 7) in the Japanese versions. ret IntroNidorinoAnimation0: @@ -462,5 +463,4 @@ FightIntroFrontMon3: ENDC FightIntroFrontMonEnd: - ds 16, $00 ; blank tile diff --git a/engine/overworld/movement.asm b/engine/overworld/movement.asm index cb65c997aa..e15546250d 100644 --- a/engine/overworld/movement.asm +++ b/engine/overworld/movement.asm @@ -644,7 +644,7 @@ CanWalkOntoTile: bit 7, d ; check if going upwards (d == -1) jr nz, .upwards add d - ; bug: these tests against $5 probably were supposed to prevent + ; BUG: these tests against $5 probably were supposed to prevent ; sprites from walking out too far, but this line makes sprites get ; stuck whenever they walked upwards 5 steps ; on the other hand, the amount a sprite can walk out to the diff --git a/engine/overworld/wild_mons.asm b/engine/overworld/wild_mons.asm index 2593e0ec76..d5a58ac57c 100644 --- a/engine/overworld/wild_mons.asm +++ b/engine/overworld/wild_mons.asm @@ -1,21 +1,19 @@ LoadWildData:: ld hl, WildDataPointers ld a, [wCurMap] - - ; get wild data for current map ld c, a ld b, 0 add hl, bc add hl, bc ld a, [hli] ld h, [hl] - ld l, a ; hl now points to wild data for current map + ld l, a ld a, [hli] - ld [wGrassRate], a + ld [wGrassRate], a ; same as [wLinkEnemyTrainerName] and a - jr z, .NoGrassData ; if no grass data, skip to surfing data + jr z, .NoGrassData push hl - ld de, wGrassMons ; otherwise, load grass data + ld de, wGrassMons ld bc, $14 call CopyData pop hl @@ -25,8 +23,8 @@ LoadWildData:: ld a, [hli] ld [wWaterRate], a and a - ret z ; if no water data, we're done - ld de, wWaterMons ; otherwise, load surfing data + ret z + ld de, wWaterMons ld bc, $14 jp CopyData diff --git a/engine/pokemon/evos_moves.asm b/engine/pokemon/evos_moves.asm index 268e522ab6..12b6f6a85b 100644 --- a/engine/pokemon/evos_moves.asm +++ b/engine/pokemon/evos_moves.asm @@ -9,7 +9,6 @@ TryEvolvingMon: call Evolution_FlagAction ; this is only called after battle -; it is supposed to do level up evolutions, though there is a bug that allows item evolutions to occur EvolutionAfterBattle: ldh a, [hTileAnimations] push af @@ -93,11 +92,13 @@ Evolution_PartyMonLoop: ; loop over party mons jp c, Evolution_PartyMonLoop ; if so, go the next mon jr .doEvolution .checkItemEvo + ; BUG: Wild encounters can cause stone evolutions without + ; having any stones available. This was patched in Yellow. ld a, [hli] - ld b, a ; evolution item - ld a, [wCurItem] - cp b ; was the evolution item in this entry used? - jp nz, .nextEvoEntry1 ; if not, go to the next evolution entry + ld b, a + ld a, [wCurItem] ; same as [wCurPartySpecies] + cp b + jp nz, .nextEvoEntry1 .checkLevel ld a, [hli] ; level requirement ld b, a diff --git a/engine/slots/slot_machine.asm b/engine/slots/slot_machine.asm index 1ed24a1a8b..1cfe9d1e3d 100644 --- a/engine/slots/slot_machine.asm +++ b/engine/slots/slot_machine.asm @@ -298,8 +298,8 @@ SlotMachine_StopWheel1Early: cp HIGH(SLOTSCHERRY) jr nz, .stopWheel ret -; It looks like this was intended to make the wheel stop when a 7 symbol was -; visible, but it has a bug and so the wheel stops randomly. + ; BUG: It looks like this was intended to make the wheel stop + ; when a 7 symbol was visible, but instead the wheel stops randomly. .sevenAndBarMode ld c, $3 .loop diff --git a/home/pokemon.asm b/home/pokemon.asm index 7cc5f2d179..99a376257c 100644 --- a/home/pokemon.asm +++ b/home/pokemon.asm @@ -110,11 +110,12 @@ LoadFrontSpriteByMonIndex:: ld [hl], b and a pop hl - jr z, .invalidDexNumber ; dex #0 invalid + jr z, .invalidDexNumber cp NUM_POKEMON + 1 - jr c, .validDexNumber ; dex >#151 invalid + jr c, .validDexNumber .invalidDexNumber - ld a, RHYDON ; $1 + ; This is the so-called "Rhydon trap". + ld a, RHYDON ld [wCurPartySpecies], a ret .validDexNumber diff --git a/scripts/HallOfFame.asm b/scripts/HallOfFame.asm index ed3d2a731f..91be3996c3 100644 --- a/scripts/HallOfFame.asm +++ b/scripts/HallOfFame.asm @@ -33,7 +33,7 @@ HallOfFameResetEventsAndSaveScript: res BIT_NO_MAP_MUSIC, [hl] assert wStatusFlags7 + 1 == wElite4Flags inc hl - set BIT_UNUSED_BEAT_ELITE_4, [hl] ; debug, unused? + set BIT_UNUSED_BEAT_ELITE_4, [hl] ; unused xor a ; SCRIPT_*_DEFAULT ld hl, wLoreleisRoomCurScript ld [hli], a ; wLoreleisRoomCurScript