From 4c8d3e962fb20fe4eb967befbc58db5c57f56f75 Mon Sep 17 00:00:00 2001 From: Giulia Sanguineti Date: Wed, 1 Oct 2025 10:11:42 +0200 Subject: [PATCH] chore: fix bugs --- constants/music_constants.asm | 11 +++--- data/battle/ai/sunny_day_moves.asm | 4 ++- data/maps/maps.asm | 10 +++--- data/moves/animations.asm | 3 +- data/text/common_2.asm | 6 ++-- data/trainers/dvs.asm | 3 +- engine/battle/ai/items.asm | 16 ++++----- engine/battle/ai/redundant.asm | 5 ++- engine/battle/ai/scoring.asm | 9 ++--- engine/battle/anim_hp_bar.asm | 5 ++- engine/battle/battle_transition.asm | 26 ++++++++++++-- engine/battle/core.asm | 29 +++++++++------- engine/battle/effect_commands.asm | 11 +++--- engine/battle/move_effects/sketch.asm | 5 ++- engine/battle/move_effects/teleport.asm | 4 +-- engine/battle/read_trainer_party.asm | 45 +++++++++++++++++++++++++ engine/battle/start_battle.asm | 24 ++++--------- engine/battle_anims/anim_commands.asm | 3 +- engine/events/halloffame.asm | 3 +- engine/events/magikarp.asm | 2 -- engine/events/overworld.asm | 8 ++--- engine/games/slot_machine.asm | 3 +- engine/items/item_effects.asm | 37 +++++++------------- engine/menus/options_menu.asm | 2 +- engine/movie/credits.asm | 5 ++- engine/overworld/events.asm | 3 +- engine/overworld/npc_movement.asm | 2 +- engine/overworld/overworld.asm | 4 +-- engine/overworld/player_movement.asm | 5 ++- engine/overworld/player_object.asm | 22 +++++------- engine/overworld/scripting.asm | 13 +++---- engine/overworld/wildmons.asm | 10 +++--- engine/phone/phone.asm | 19 ++--------- engine/pokedex/pokedex.asm | 9 ++--- engine/pokemon/breeding.asm | 7 ++-- engine/pokemon/experience.asm | 13 ++++++- engine/pokemon/move_mon.asm | 24 +++++++++---- engine/pokemon/party_menu.asm | 8 +++-- engine/pokemon/search_owned.asm | 3 +- engine/tilesets/tileset_anims.asm | 22 ++---------- gfx/tilesets/roofs.pal | 4 +-- home/init.asm | 3 +- home/map.asm | 18 ++++------ maps/ManiasHouse.asm | 3 +- 44 files changed, 236 insertions(+), 235 deletions(-) diff --git a/constants/music_constants.asm b/constants/music_constants.asm index e471d77f3..611933e00 100644 --- a/constants/music_constants.asm +++ b/constants/music_constants.asm @@ -107,15 +107,12 @@ const MUSIC_MOBILE_CENTER ; 66 DEF NUM_MUSIC_SONGS EQU const_value -; GetMapMusic picks music for this value (see home/map.asm) -; this overlaps with a Crystal song ID, but not one that is used for map music -DEF MUSIC_MAHOGANY_MART EQU MUSIC_SUICUNE_BATTLE +; GetMapMusic picks music for these values (see home/map.asm) +DEF MUSIC_MAHOGANY_MART EQU $fc +DEF MUSIC_RADIO_TOWER EQU $fd ; ExitPokegearRadio_HandleMusic uses these values DEF RESTART_MAP_MUSIC EQU $fe DEF ENTER_MAP_MUSIC EQU $ff -; GetMapMusic picks music for this bit flag - const_def 7 - shift_const RADIO_TOWER_MUSIC -assert NUM_MUSIC_SONGS <= RADIO_TOWER_MUSIC, "song IDs overlap RADIO_TOWER_MUSIC" +assert NUM_MUSIC_SONGS <= MUSIC_MAHOGANY_MART, "song IDs overlap special values" diff --git a/data/battle/ai/sunny_day_moves.asm b/data/battle/ai/sunny_day_moves.asm index d012ed872..e0e5f00be 100644 --- a/data/battle/ai/sunny_day_moves.asm +++ b/data/battle/ai/sunny_day_moves.asm @@ -1,13 +1,15 @@ ; AI_SMART encourages Sunny Day if it also knows these moves. SunnyDayMoves: -; BUG: "Smart" AI does not encourage Sunny Day when it knows Solar Beam, Flame Wheel, or Moonlight (see docs/bugs_and_glitches.md) db FIRE_PUNCH db EMBER db FLAMETHROWER + db SOLARBEAM db FIRE_SPIN db FIRE_BLAST + db FLAME_WHEEL db SACRED_FIRE db MORNING_SUN db SYNTHESIS + db MOONLIGHT db -1 ; end diff --git a/data/maps/maps.asm b/data/maps/maps.asm index 893a15192..c0f96072e 100644 --- a/data/maps/maps.asm +++ b/data/maps/maps.asm @@ -92,11 +92,11 @@ MapGroup_Dungeons: map BurnedTowerB1F, TILESET_CAVE, CAVE, LANDMARK_BURNED_TOWER, MUSIC_BURNED_TOWER, TRUE, PALETTE_NITE, FISHGROUP_SHORE map NationalPark, TILESET_PARK, ROUTE, LANDMARK_NATIONAL_PARK, MUSIC_NATIONAL_PARK, FALSE, PALETTE_AUTO, FISHGROUP_SHORE map NationalParkBugContest, TILESET_PARK, ROUTE, LANDMARK_NATIONAL_PARK, MUSIC_BUG_CATCHING_CONTEST, FALSE, PALETTE_AUTO, FISHGROUP_SHORE - map RadioTower1F, TILESET_RADIO_TOWER, INDOOR, LANDMARK_RADIO_TOWER, RADIO_TOWER_MUSIC | MUSIC_GOLDENROD_CITY, TRUE, PALETTE_DAY, FISHGROUP_SHORE - map RadioTower2F, TILESET_RADIO_TOWER, INDOOR, LANDMARK_RADIO_TOWER, RADIO_TOWER_MUSIC | MUSIC_GOLDENROD_CITY, TRUE, PALETTE_DAY, FISHGROUP_SHORE - map RadioTower3F, TILESET_RADIO_TOWER, INDOOR, LANDMARK_RADIO_TOWER, RADIO_TOWER_MUSIC | MUSIC_GOLDENROD_CITY, TRUE, PALETTE_DAY, FISHGROUP_SHORE - map RadioTower4F, TILESET_RADIO_TOWER, INDOOR, LANDMARK_RADIO_TOWER, RADIO_TOWER_MUSIC | MUSIC_GOLDENROD_CITY, TRUE, PALETTE_DAY, FISHGROUP_SHORE - map RadioTower5F, TILESET_RADIO_TOWER, INDOOR, LANDMARK_RADIO_TOWER, RADIO_TOWER_MUSIC | MUSIC_GOLDENROD_CITY, TRUE, PALETTE_DAY, FISHGROUP_SHORE + map RadioTower1F, TILESET_RADIO_TOWER, INDOOR, LANDMARK_RADIO_TOWER, MUSIC_RADIO_TOWER, TRUE, PALETTE_DAY, FISHGROUP_SHORE + map RadioTower2F, TILESET_RADIO_TOWER, INDOOR, LANDMARK_RADIO_TOWER, MUSIC_RADIO_TOWER, TRUE, PALETTE_DAY, FISHGROUP_SHORE + map RadioTower3F, TILESET_RADIO_TOWER, INDOOR, LANDMARK_RADIO_TOWER, MUSIC_RADIO_TOWER, TRUE, PALETTE_DAY, FISHGROUP_SHORE + map RadioTower4F, TILESET_RADIO_TOWER, INDOOR, LANDMARK_RADIO_TOWER, MUSIC_RADIO_TOWER, TRUE, PALETTE_DAY, FISHGROUP_SHORE + map RadioTower5F, TILESET_RADIO_TOWER, INDOOR, LANDMARK_RADIO_TOWER, MUSIC_RADIO_TOWER, TRUE, PALETTE_DAY, FISHGROUP_SHORE map RuinsOfAlphOutside, TILESET_JOHTO, ROUTE, LANDMARK_RUINS_OF_ALPH, MUSIC_UNION_CAVE, FALSE, PALETTE_AUTO, FISHGROUP_POND map RuinsOfAlphHoOhChamber, TILESET_RUINS_OF_ALPH, DUNGEON, LANDMARK_RUINS_OF_ALPH, MUSIC_UNION_CAVE, TRUE, PALETTE_DAY, FISHGROUP_SHORE map RuinsOfAlphKabutoChamber, TILESET_RUINS_OF_ALPH, DUNGEON, LANDMARK_RUINS_OF_ALPH, MUSIC_UNION_CAVE, TRUE, PALETTE_DAY, FISHGROUP_SHORE diff --git a/data/moves/animations.asm b/data/moves/animations.asm index f441d5752..a3a51638e 100644 --- a/data/moves/animations.asm +++ b/data/moves/animations.asm @@ -2082,9 +2082,8 @@ BattleAnim_Headbutt: anim_ret BattleAnim_Tackle: -; BUG: Tackle is missing part of its hit animation (see docs/bugs_and_glitches.md) anim_1gfx BATTLE_ANIM_GFX_HIT - anim_call BattleAnim_TargetObj_2Row + anim_call BattleAnim_TargetObj_1Row anim_bgeffect BATTLE_BG_EFFECT_TACKLE, $0, BG_EFFECT_USER, $0 anim_wait 4 anim_sound 0, 1, SFX_TACKLE diff --git a/data/text/common_2.asm b/data/text/common_2.asm index 1b41fced3..4a84cea16 100644 --- a/data/text/common_2.asm +++ b/data/text/common_2.asm @@ -100,19 +100,17 @@ Text_Gained:: text_end _BoostedExpPointsText:: -; BUG: Five-digit experience gain is printed incorrectly (see docs/bugs_and_glitches.md) text_start line "a boosted" cont "@" - text_decimal wStringBuffer2, 2, 4 + text_decimal wStringBuffer2, 2, 5 text " EXP. Points!" prompt _ExpPointsText:: -; BUG: Five-digit experience gain is printed incorrectly (see docs/bugs_and_glitches.md) text_start line "@" - text_decimal wStringBuffer2, 2, 4 + text_decimal wStringBuffer2, 2, 5 text " EXP. Points!" prompt diff --git a/data/trainers/dvs.asm b/data/trainers/dvs.asm index ce88be45b..c3e285666 100644 --- a/data/trainers/dvs.asm +++ b/data/trainers/dvs.asm @@ -43,8 +43,7 @@ TrainerClassDVs: dn 7, 8, 8, 8 ; SWIMMERF dn 9, 8, 8, 8 ; SAILOR dn 9, 8, 8, 8 ; SUPER_NERD -; BUG: RIVAL2 has lower DVs than RIVAL1 (see docs/bugs_and_glitches.md) - dn 9, 8, 8, 8 ; RIVAL2 + dn 13, 13, 13, 13 ; RIVAL2 dn 9, 8, 8, 8 ; GUITARIST dn 10, 8, 8, 8 ; HIKER dn 9, 8, 8, 8 ; BIKER diff --git a/engine/battle/ai/items.asm b/engine/battle/ai/items.asm index 3c0adb5f2..7021f0c9f 100644 --- a/engine/battle/ai/items.asm +++ b/engine/battle/ai/items.asm @@ -175,9 +175,8 @@ AI_TryItem: ld b, h ld c, l ld hl, AI_Items -; BUG: AI might use its base reward value as an item (see docs/bugs_and_glitches.md) - ld de, wEnemyTrainerItem1 .loop + ld de, wEnemyTrainerItem1 ld a, [hl] and a inc a @@ -553,14 +552,9 @@ EnemyUsedMaxPotion: jr FullRestoreContinue EnemyUsedFullRestore: -; BUG: AI use of Full Heal does not cure confusion status (see docs/bugs_and_glitches.md) call AI_HealStatus ld a, FULL_RESTORE ld [wCurEnemyItem], a - ld hl, wEnemySubStatus3 - res SUBSTATUS_CONFUSED, [hl] - xor a - ld [wEnemyConfuseCount], a ; fallthrough FullRestoreContinue: @@ -728,7 +722,6 @@ EnemyUsedFullHealRed: ; unreferenced jp PrintText_UsedItemOn_AND_AIUpdateHUD AI_HealStatus: -; BUG: AI use of Full Heal or Full Restore does not cure Nightmare status (see docs/bugs_and_glitches.md) ld a, [wCurOTMon] ld hl, wOTPartyMon1Status ld bc, PARTYMON_STRUCT_LENGTH @@ -736,6 +729,13 @@ AI_HealStatus: xor a ld [hl], a ld [wEnemyMonStatus], a + ; remove the Confusion status condition + ld [wEnemyConfuseCount], a + ld hl, wEnemySubStatus3 + res SUBSTATUS_CONFUSED, [hl] + ; remove the Nightmare substatus condition + ld hl, wEnemySubStatus1 + res SUBSTATUS_NIGHTMARE, [hl] ld hl, wEnemySubStatus5 res SUBSTATUS_TOXIC, [hl] ret diff --git a/engine/battle/ai/redundant.asm b/engine/battle/ai/redundant.asm index bb9338fb7..90b1dbc68 100644 --- a/engine/battle/ai/redundant.asm +++ b/engine/battle/ai/redundant.asm @@ -176,9 +176,8 @@ AI_Redundant: ret .FutureSight: -; BUG: AI does not discourage Future Sight when it's already been used (see docs/bugs_and_glitches.md) - ld a, [wEnemyScreens] - bit SCREENS_UNUSED, a + ld a, [wEnemyFutureSightCount] + and a ret .Heal: diff --git a/engine/battle/ai/scoring.asm b/engine/battle/ai/scoring.asm index edf4831f3..20a0a9052 100644 --- a/engine/battle/ai/scoring.asm +++ b/engine/battle/ai/scoring.asm @@ -1665,10 +1665,9 @@ AI_Smart_Thief: ret AI_Smart_Conversion2: -; BUG: "Smart" AI discourages Conversion2 after the first turn (see docs/bugs_and_glitches.md) ld a, [wLastPlayerMove] and a - jr nz, .discourage + jr z, .discourage push hl dec a @@ -1745,8 +1744,7 @@ AI_Smart_MeanLook: jp z, AIDiscourageMove ; 80% chance to greatly encourage this move if the enemy is badly poisoned. -; BUG: "Smart" AI encourages Mean Look if its own Pokémon is badly poisoned (see docs/bugs_and_glitches.md) - ld a, [wEnemySubStatus5] + ld a, [wPlayerSubStatus5] bit SUBSTATUS_TOXIC, a jr nz, .encourage @@ -3086,10 +3084,9 @@ AI_Cautious: pop hl jr nc, .loop -; BUG: "Cautious" AI may fail to discourage residual moves (see docs/bugs_and_glitches.md) call Random cp 90 percent + 1 - ret nc + jr nc, .loop inc [hl] jr .loop diff --git a/engine/battle/anim_hp_bar.asm b/engine/battle/anim_hp_bar.asm index 3e413f9f7..7400f4a40 100644 --- a/engine/battle/anim_hp_bar.asm +++ b/engine/battle/anim_hp_bar.asm @@ -179,12 +179,11 @@ LongAnim_UpdateVariables: ld c, a ld a, [hli] ld b, a -; BUG: HP bar animation is slow for high HP (see docs/bugs_and_glitches.md) call ComputeHPBarPixels + ld a, e pop bc pop de pop hl - ld a, e ld hl, wCurHPBarPixels cp [hl] jr z, .loop @@ -370,13 +369,13 @@ ShortHPBar_CalcPixelFrame: ld b, 0 .loop -; BUG: HP bar animation off-by-one error for low HP (see docs/bugs_and_glitches.md) ld a, l sub HP_BAR_LENGTH_PX ld l, a ld a, h sbc $0 ld h, a + jr z, .done jr c, .done inc b jr .loop diff --git a/engine/battle/battle_transition.asm b/engine/battle/battle_transition.asm index a3138c9e5..434311b77 100644 --- a/engine/battle/battle_transition.asm +++ b/engine/battle/battle_transition.asm @@ -213,11 +213,31 @@ DEF TRANS_NO_CAVE_F EQU 1 ; bit set in TRANS_NO_CAVE and TRANS_NO_CAVE_STRONGER StartTrainerBattle_DetermineWhichAnimation: ; The screen flashes a different number of times depending on the level of ; your lead Pokemon relative to the opponent's. -; BUG: Battle transitions fail to account for enemy's level (see docs/bugs_and_glitches.md) + ld a, [wOtherTrainerClass] + and a + jr z, .wild + farcall SetTrainerBattleLevel + +.wild + ld b, PARTY_LENGTH + ld hl, wPartyMon1HP + ld de, PARTYMON_STRUCT_LENGTH - 1 + +.loop + ld a, [hli] + or [hl] + jr nz, .okay + add hl, de + dec b + jr nz, .loop + +.okay + ld de, MON_LEVEL - MON_HP - 1 + add hl, de ld de, 0 - ld a, [wBattleMonLevel] + ld a, [hl] add 3 - ld hl, wEnemyMonLevel + ld hl, wCurPartyLevel cp [hl] jr nc, .not_stronger set TRANS_STRONGER_F, e diff --git a/engine/battle/core.asm b/engine/battle/core.asm index f91a095ea..8cbb3a32f 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -147,9 +147,8 @@ WildFled_EnemyFled_LinkBattleCanceled: call CheckMobileBattleError jr c, .skip_sfx -; BUG: SFX_RUN does not play correctly when a wild Pokémon flees from battle (see docs/bugs_and_glitches.md) ld de, SFX_RUN - call PlaySFX + call WaitPlaySFX .skip_sfx call SetPlayerTurn @@ -158,6 +157,11 @@ WildFled_EnemyFled_LinkBattleCanceled: ret BattleTurn: + ldh a, [hInMenu] + push af + ld a, 1 ; or "xor a" for the value 0 + ldh [hInMenu], a + .loop call Stubbed_Increments5_a89a call CheckContestBattleOver @@ -227,6 +231,8 @@ BattleTurn: jp .loop .quit + pop af + ldh [hInMenu], a ret Stubbed_Increments5_a89a: @@ -6166,14 +6172,13 @@ LoadEnemyMon: jr nz, .Happiness ; Get Magikarp's length -; BUG: Magikarp length limits have a unit conversion error (see docs/bugs_and_glitches.md) ld de, wEnemyMonDVs ld bc, wPlayerID callfar CalcMagikarpLength ; No reason to keep going if length > 1536 mm (i.e. if HIGH(length) > 6 feet) ld a, [wMagikarpLength] - cp HIGH(1536) + cp 5 jr nz, .CheckMagikarpArea ; 5% chance of skipping both size checks @@ -6182,7 +6187,7 @@ LoadEnemyMon: jr c, .CheckMagikarpArea ; Try again if length >= 1616 mm (i.e. if LOW(length) >= 4 inches) ld a, [wMagikarpLength + 1] - cp LOW(1616) + cp 4 jr nc, .GenerateDVs ; 20% chance of skipping this check @@ -6191,24 +6196,23 @@ LoadEnemyMon: jr c, .CheckMagikarpArea ; Try again if length >= 1600 mm (i.e. if LOW(length) >= 3 inches) ld a, [wMagikarpLength + 1] - cp LOW(1600) + cp 3 jr nc, .GenerateDVs .CheckMagikarpArea: -; BUG: Magikarp in Lake of Rage are shorter, not longer (see docs/bugs_and_glitches.md) ld a, [wMapGroup] cp GROUP_LAKE_OF_RAGE - jr z, .Happiness + jr nz, .Happiness ld a, [wMapNumber] cp MAP_LAKE_OF_RAGE - jr z, .Happiness + jr nz, .Happiness ; 40% chance of not flooring call Random cp 39 percent + 1 jr c, .Happiness ; Try again if length < 1024 mm (i.e. if HIGH(length) < 3 feet) ld a, [wMagikarpLength] - cp HIGH(1024) + cp 3 jr c, .GenerateDVs ; try again ; Finally done with DVs @@ -6410,7 +6414,7 @@ LoadEnemyMon: ld bc, NUM_BATTLE_STATS * 2 call CopyBytes -; BUG: PRZ and BRN stat reductions don't apply to switched Pokémon (see docs/bugs_and_glitches.md) + call ApplyStatusEffectOnEnemyStats ret CheckSleepingTreeMon: @@ -6803,10 +6807,11 @@ BadgeStatBoosts: ld hl, wBattleMonAttack ld c, 4 .CheckBadge: -; BUG: Glacier Badge may not boost Special Defense depending on the value of Special Attack (see docs/bugs_and_glitches.md) ld a, b srl b + push af call c, BoostStat + pop af inc hl inc hl ; Check every other badge. diff --git a/engine/battle/effect_commands.asm b/engine/battle/effect_commands.asm index 89d0c4841..4cd8c3704 100644 --- a/engine/battle/effect_commands.asm +++ b/engine/battle/effect_commands.asm @@ -1399,16 +1399,16 @@ BattleCheckTypeMatchup: ld hl, wEnemyMonType1 ldh a, [hBattleTurn] and a - jr z, CheckTypeMatchup + jr z, .get_type ld hl, wBattleMonType1 +.get_type + ld a, BATTLE_VARS_MOVE_TYPE + call GetBattleVar ; preserves hl, de, and bc ; fallthrough CheckTypeMatchup: -; BUG: AI makes a false assumption about CheckTypeMatchup (see docs/bugs_and_glitches.md) push hl push de push bc - ld a, BATTLE_VARS_MOVE_TYPE - call GetBattleVar ld d, a ld b, [hl] inc hl @@ -2083,13 +2083,14 @@ BattleCommand_FailureText: inc hl ld a, [hl] -; BUG: Beat Up may fail to raise Substitute (see docs/bugs_and_glitches.md) cp EFFECT_MULTI_HIT jr z, .multihit cp EFFECT_DOUBLE_HIT jr z, .multihit cp EFFECT_POISON_MULTI_HIT jr z, .multihit + cp EFFECT_BEAT_UP + jr z, .multihit jp EndMoveEffect .multihit diff --git a/engine/battle/move_effects/sketch.asm b/engine/battle/move_effects/sketch.asm index 35e4b92bd..0862888bd 100644 --- a/engine/battle/move_effects/sketch.asm +++ b/engine/battle/move_effects/sketch.asm @@ -11,9 +11,8 @@ BattleCommand_Sketch: ; If the opponent has a substitute up, fail. call CheckSubstituteOpp jp nz, .fail -; If the opponent is transformed, fail. -; BUG: A Transformed Pokémon can use Sketch and learn otherwise unobtainable moves (see docs/bugs_and_glitches.md) - ld a, BATTLE_VARS_SUBSTATUS5_OPP +; If the user is transformed, fail. + ld a, BATTLE_VARS_SUBSTATUS5 call GetBattleVarAddr bit SUBSTATUS_TRANSFORMED, [hl] jp nz, .fail diff --git a/engine/battle/move_effects/teleport.asm b/engine/battle/move_effects/teleport.asm index 3ea05116d..9a11d5b2a 100644 --- a/engine/battle/move_effects/teleport.asm +++ b/engine/battle/move_effects/teleport.asm @@ -66,7 +66,7 @@ BattleCommand_Teleport: inc c ; Generate a number less than c .loop_enemy -; BUG: Wild Pokémon can always Teleport regardless of level difference (see docs/bugs_and_glitches.md) +; If a random number >= player level / 4, Teleport will succeed call BattleRandom cp c jr nc, .loop_enemy @@ -74,7 +74,7 @@ BattleCommand_Teleport: srl b srl b cp b - jr nc, .run_away + jr c, .failed .run_away call UpdateBattleMonInParty diff --git a/engine/battle/read_trainer_party.asm b/engine/battle/read_trainer_party.asm index f2b978b9b..91740745e 100644 --- a/engine/battle/read_trainer_party.asm +++ b/engine/battle/read_trainer_party.asm @@ -389,3 +389,48 @@ IncompleteCopyNameFunction: ; unreferenced ret INCLUDE "data/trainers/parties.asm" + +SetTrainerBattleLevel: + ld a, 255 + ld [wCurPartyLevel], a + + ld a, [wInBattleTowerBattle] + bit IN_BATTLE_TOWER_BATTLE_F, a + ret nz + + ld a, [wLinkMode] + and a + ret nz + + ld a, [wOtherTrainerClass] + dec a + ld c, a + ld b, 0 + ld hl, TrainerGroups + add hl, bc + add hl, bc + ld a, [hli] + ld h, [hl] + ld l, a + + ld a, [wOtherTrainerID] + ld b, a +.skip_trainer + dec b + jr z, .got_trainer +.skip_party + ld a, [hli] + cp $ff + jr nz, .skip_party + jr .skip_trainer +.got_trainer + +.skip_name + ld a, [hli] + cp "@" + jr nz, .skip_name + + inc hl + ld a, [hl] + ld [wCurPartyLevel], a + ret diff --git a/engine/battle/start_battle.asm b/engine/battle/start_battle.asm index ff7f07a3c..743b13849 100644 --- a/engine/battle/start_battle.asm +++ b/engine/battle/start_battle.asm @@ -16,23 +16,6 @@ FindFirstAliveMonAndStartBattle: xor a ldh [hMapAnims], a call DelayFrame - ld b, PARTY_LENGTH - ld hl, wPartyMon1HP - ld de, PARTYMON_STRUCT_LENGTH - 1 - -.loop - ld a, [hli] - or [hl] - jr nz, .okay - add hl, de - dec b - jr nz, .loop - -.okay - ld de, MON_LEVEL - MON_HP - add hl, de - ld a, [hl] - ld [wBattleMonLevel], a predef DoBattleTransition farcall _LoadBattleFontsHPBar ld a, 1 @@ -93,12 +76,17 @@ PlayBattleMusic: cp RED jr z, .done -; BUG: Team Rocket battle music is not used for Executives or Scientists (see docs/bugs_and_glitches.md) ld de, MUSIC_ROCKET_BATTLE cp GRUNTM jr z, .done cp GRUNTF jr z, .done + cp EXECUTIVEM + jr z, .done + cp EXECUTIVEF + jr z, .done + cp SCIENTIST + jr z, .done ld de, MUSIC_KANTO_GYM_LEADER_BATTLE farcall IsKantoGymLeader diff --git a/engine/battle_anims/anim_commands.asm b/engine/battle_anims/anim_commands.asm index 2e811e612..cdc3d85cf 100644 --- a/engine/battle_anims/anim_commands.asm +++ b/engine/battle_anims/anim_commands.asm @@ -653,9 +653,8 @@ BattleAnimCmd_ResetObp0: ret BattleAnimCmd_ClearObjs: -; BUG: BattleAnimCmd only clears the first 6⅔ objects (see docs/bugs_and_glitches.md) ld hl, wActiveAnimObjects - ld a, $a0 + ld a, NUM_BATTLE_ANIM_STRUCTS * BATTLEANIMSTRUCT_LENGTH .loop ld [hl], 0 inc hl diff --git a/engine/events/halloffame.asm b/engine/events/halloffame.asm index e8a9657f0..ee478e8cb 100644 --- a/engine/events/halloffame.asm +++ b/engine/events/halloffame.asm @@ -363,9 +363,8 @@ _HallOfFamePC: call ClearBGPalettes pop hl call DisplayHOFMon -; BUG: A "HOF Master!" title for 200-Time Famers is defined but inaccessible (see docs/bugs_and_glitches.md) ld a, [wHallOfFameTempWinCount] - cp HOF_MASTER_COUNT + 1 + cp HOF_MASTER_COUNT jr c, .print_num_hof ld de, .HOFMaster hlcoord 1, 2 diff --git a/engine/events/magikarp.asm b/engine/events/magikarp.asm index acd46c24f..efb717f71 100644 --- a/engine/events/magikarp.asm +++ b/engine/events/magikarp.asm @@ -278,11 +278,9 @@ CalcMagikarpLength: ret .BCLessThanDE: -; BUG: Magikarp lengths can be miscalculated (see docs/bugs_and_glitches.md) ld a, b cp d ret c - ret nc ld a, c cp e ret diff --git a/engine/events/overworld.asm b/engine/events/overworld.asm index 6d698e2b8..7792f1ef7 100644 --- a/engine/events/overworld.asm +++ b/engine/events/overworld.asm @@ -400,7 +400,6 @@ SurfFromMenuScript: special UpdateTimePals UsedSurfScript: -; BUG: Surfing directly across a map connection does not load the new map (see docs/bugs_and_glitches.md) writetext UsedSurfText ; "used SURF!" waitbutton closetext @@ -412,9 +411,7 @@ UsedSurfScript: special UpdatePlayerSprite special PlayMapMusic -; step into the water (slow_step DIR, step_end) special SurfStartStep - applymovement PLAYER, wMovementBuffer end .stubbed_fn @@ -1442,7 +1439,6 @@ FishFunction: dw .FishNoFish .TryFish: -; BUG: You can fish on top of NPCs (see docs/bugs_and_glitches.md) ld a, [wPlayerState] cp PLAYER_SURF jr z, .fail @@ -1451,7 +1447,9 @@ FishFunction: call GetFacingTileCoord call GetTilePermission cp WATER_TILE - jr z, .facingwater + jr nz, .fail + farcall CheckFacingObject + jr nc, .facingwater .fail ld a, $3 ret diff --git a/engine/games/slot_machine.asm b/engine/games/slot_machine.asm index 157c55c65..eb73d2c01 100644 --- a/engine/games/slot_machine.asm +++ b/engine/games/slot_machine.asm @@ -485,13 +485,12 @@ SlotsAction_PayoutAnim: jr c, .okay inc de .okay -; BUG: Slot machine payout sound effects cut each other off (see docs/bugs_and_glitches.md) ld [hl], e dec hl ld [hl], d ld a, [wSlotsDelay] and $7 - ret z + ret nz ld de, SFX_GET_COIN_FROM_SLOTS call PlaySFX ret diff --git a/engine/items/item_effects.asm b/engine/items/item_effects.asm index 1797a1641..4767856e9 100644 --- a/engine/items/item_effects.asm +++ b/engine/items/item_effects.asm @@ -210,11 +210,14 @@ ItemEffects: ; NoEffect would be appropriate, with the table then being NUM_ITEMS long. PokeBallEffect: -; BUG: The Dude's catching tutorial may crash if his Poké Ball can't be used (see docs/bugs_and_glitches.md) ld a, [wBattleMode] dec a jp nz, UseBallInTrainerBattle + ld a, [wBattleType] + cp BATTLETYPE_TUTORIAL + jr z, .room_in_party + ld a, [wPartyCount] cp PARTY_LENGTH jr nz, .room_in_party @@ -227,11 +230,10 @@ PokeBallEffect: jp z, Ball_BoxIsFullMessage .room_in_party -; BUG: Using a Park Ball in non-Contest battles has a corrupt animation (see docs/bugs_and_glitches.md) xor a ld [wWildMon], a - ld a, [wCurItem] - cp PARK_BALL + ld a, [wBattleType] + cp BATTLETYPE_CONTEST call nz, ReturnToBattle_UseBall ld hl, wOptions @@ -336,12 +338,12 @@ PokeBallEffect: jr nz, .statuscheck ld a, 1 .statuscheck -; BUG: BRN/PSN/PAR do not affect catch rate (see docs/bugs_and_glitches.md) ld b, a ld a, [wEnemyMonStatus] and 1 << FRZ | SLP_MASK ld c, 10 jr nz, .addstatus + ld a, [wEnemyMonStatus] and a ld c, 5 jr nz, .addstatus @@ -353,10 +355,10 @@ PokeBallEffect: ld a, $ff .max_1 -; BUG: HELD_CATCH_CHANCE has no effect (see docs/bugs_and_glitches.md) ld d, a push de ld a, [wBattleMonItem] + ld b, a farcall GetItemHeldEffect ld a, b cp HELD_CATCH_CHANCE @@ -440,18 +442,10 @@ PokeBallEffect: push af set SUBSTATUS_TRANSFORMED, [hl] -; BUG: Catching a Transformed Pokémon always catches a Ditto (see docs/bugs_and_glitches.md) bit SUBSTATUS_TRANSFORMED, a - jr nz, .ditto - jr .not_ditto + jr nz, .load_data -.ditto - ld a, DITTO - ld [wTempEnemyMonSpecies], a - jr .load_data -.not_ditto - set SUBSTATUS_TRANSFORMED, [hl] ld hl, wEnemyBackupDVs ld a, [wEnemyMonDVs] ld [hli], a @@ -753,10 +747,10 @@ ParkBallMultiplier: ret HeavyBall_GetDexEntryBank: -; BUG: Heavy Ball uses wrong weight value for three Pokémon (see docs/bugs_and_glitches.md) push hl push de ld a, [wEnemyMonSpecies] + dec a rlca rlca maskbits NUM_DEX_ENTRY_BANKS @@ -913,15 +907,12 @@ MoonBallMultiplier: pop bc ret nz -; BUG: Moon Ball does not boost catch rate (see docs/bugs_and_glitches.md) - inc hl - inc hl inc hl push bc ld a, BANK("Evolutions and Attacks") call GetFarByte - cp MOON_STONE_RED ; BURN_HEAL + cp MOON_STONE pop bc ret nz @@ -973,12 +964,11 @@ LoveBallMultiplier: inc d ; female .got_wild_gender -; BUG: Love Ball boosts catch rate for the wrong gender (see docs/bugs_and_glitches.md) ld a, d pop de cp d pop bc - ret nz + ret z sla b jr c, .max @@ -1004,7 +994,6 @@ FastBallMultiplier: ld d, 3 .loop -; BUG: Fast Ball only boosts catch rate for three Pokémon (see docs/bugs_and_glitches.md) ld a, BANK(FleeMons) call GetFarByte @@ -1012,7 +1001,7 @@ FastBallMultiplier: cp -1 jr z, .next cp c - jr nz, .next + jr nz, .loop sla b jr c, .max diff --git a/engine/menus/options_menu.asm b/engine/menus/options_menu.asm index 3428f9e76..841b302d8 100644 --- a/engine/menus/options_menu.asm +++ b/engine/menus/options_menu.asm @@ -11,7 +11,7 @@ DEF NUM_OPTIONS EQU const_value ; 8 _Option: -; BUG: Options menu fails to clear joypad state on initialization (see docs/bugs_and_glitches.md) + call ClearJoypad ld hl, hInMenu ld a, [hl] push af diff --git a/engine/movie/credits.asm b/engine/movie/credits.asm index 6e8cfc889..eaf88eec2 100644 --- a/engine/movie/credits.asm +++ b/engine/movie/credits.asm @@ -77,11 +77,12 @@ Credits:: call GetCreditsPalette call SetDefaultBGPAndOBP -; BUG: Credits sequence changes move selection menu behavior (see docs/bugs_and_glitches.md) ldh a, [hVBlank] push af ld a, VBLANK_CREDITS ldh [hVBlank], a + ldh a, [hInMenu] + push af ld a, TRUE ldh [hInMenu], a xor a @@ -105,6 +106,8 @@ Credits:: ldh [hLCDCPointer], a ldh [hBGMapAddress], a pop af + ldh [hInMenu], a + pop af ldh [hVBlank], a pop af ldh [rWBK], a diff --git a/engine/overworld/events.asm b/engine/overworld/events.asm index b991ace5e..b5b10284f 100644 --- a/engine/overworld/events.asm +++ b/engine/overworld/events.asm @@ -551,13 +551,12 @@ TryObjectEvent: ld a, [hl] and MAPOBJECT_TYPE_MASK -; BUG: TryObjectEvent arbitrary code execution (see docs/bugs_and_glitches.md) push bc ld de, 3 ld hl, ObjectEventTypeArray call IsInArray - jr nc, .nope pop bc + jr nc, .nope inc hl ld a, [hli] diff --git a/engine/overworld/npc_movement.asm b/engine/overworld/npc_movement.asm index f4c29bb48..9102a5e5c 100644 --- a/engine/overworld/npc_movement.asm +++ b/engine/overworld/npc_movement.asm @@ -4,10 +4,10 @@ CanObjectMoveInDirection: bit SWIMMING_F, [hl] jr z, .not_swimming -; BUG: Swimming NPCs aren't limited by their movement radius (see docs/bugs_and_glitches.md) ld hl, OBJECT_FLAGS1 add hl, bc bit NOCLIP_TILES_F, [hl] + jr nz, .noclip_tiles push hl push bc call WillObjectBumpIntoLand diff --git a/engine/overworld/overworld.asm b/engine/overworld/overworld.asm index a0a61350d..ff775dbb9 100644 --- a/engine/overworld/overworld.asm +++ b/engine/overworld/overworld.asm @@ -346,8 +346,6 @@ AddSpriteGFX: ret LoadSpriteGFX: -; BUG: LoadSpriteGFX does not limit the capacity of UsedSprites (see docs/bugs_and_glitches.md) - ld hl, wUsedSprites ld b, SPRITE_GFX_LIST_CAPACITY .loop @@ -365,7 +363,9 @@ LoadSpriteGFX: ret .LoadSprite: + push bc call GetSprite + pop bc ld a, l ret diff --git a/engine/overworld/player_movement.asm b/engine/overworld/player_movement.asm index 7a7533136..27f66bc1f 100644 --- a/engine/overworld/player_movement.asm +++ b/engine/overworld/player_movement.asm @@ -391,9 +391,10 @@ DoPlayerMovement:: db FACE_UP | FACE_LEFT ; COLL_HOP_UP_LEFT .CheckWarp: -; BUG: No bump noise if standing on tile $3E (see docs/bugs_and_glitches.md) ld a, [wWalkingDirection] + cp STANDING + jr z, .not_warp ld e, a ld d, 0 ld hl, .EdgeWarps @@ -405,8 +406,6 @@ DoPlayerMovement:: ld a, TRUE ld [wWalkingIntoEdgeWarp], a ld a, [wWalkingDirection] - cp STANDING - jr z, .not_warp ld e, a ld a, [wPlayerDirection] diff --git a/engine/overworld/player_object.asm b/engine/overworld/player_object.asm index 1236fa97e..27671c14a 100644 --- a/engine/overworld/player_object.asm +++ b/engine/overworld/player_object.asm @@ -579,14 +579,6 @@ TrainerWalkToPlayer: ret SurfStartStep: - call InitMovementBuffer - call .GetMovementData - call AppendToMovementBuffer - ld a, movement_step_end - call AppendToMovementBuffer - ret - -.GetMovementData: ld a, [wPlayerDirection] srl a srl a @@ -595,14 +587,16 @@ SurfStartStep: ld d, 0 ld hl, .movement_data add hl, de - ld a, [hl] - ret + add hl, de + add hl, de + ld a, BANK(.movement_data) + jp StartAutoInput .movement_data - slow_step DOWN - slow_step UP - slow_step LEFT - slow_step RIGHT + db PAD_DOWN, 0, -1 + db PAD_UP, 0, -1 + db PAD_LEFT, 0, -1 + db PAD_RIGHT, 0, -1 FollowNotExact:: push bc diff --git a/engine/overworld/scripting.asm b/engine/overworld/scripting.asm index 90b7d1e5b..9530e7f62 100644 --- a/engine/overworld/scripting.asm +++ b/engine/overworld/scripting.asm @@ -1240,12 +1240,13 @@ Script_memcall: ; fallthrough ScriptCall: -; BUG: ScriptCall can overflow wScriptStack and crash (see docs/bugs_and_glitches.md) - - push de ld hl, wScriptStackSize - ld e, [hl] + ld a, [hl] + cp 5 + ret nc + push de inc [hl] + ld e, a ld d, 0 ld hl, wScriptStack add hl, de @@ -1267,9 +1268,6 @@ ScriptCall: ret CallCallback:: - ld a, [wScriptBank] - or $80 - ld [wScriptBank], a jp ScriptCall Script_sjump: @@ -2289,7 +2287,6 @@ ExitScriptSubroutine: add hl, de ld a, [hli] ld b, a - and $7f ld [wScriptBank], a ld a, [hli] ld e, a diff --git a/engine/overworld/wildmons.asm b/engine/overworld/wildmons.asm index 9ac8fba8b..133ce4741 100644 --- a/engine/overworld/wildmons.asm +++ b/engine/overworld/wildmons.asm @@ -313,14 +313,13 @@ ChooseWildEncounter: inc b ; Store the level .ok -; BUG: ChooseWildEncounter doesn't really validate the wild Pokemon species (see docs/bugs_and_glitches.md) ld a, b ld [wCurPartyLevel], a ld b, [hl] + ld a, b call ValidateTempWildMonSpecies jr c, .nowildbattle - ld a, b cp UNOWN jr nz, .done @@ -781,13 +780,12 @@ RandomUnseenWildMon: jr nc, .done .GetGrassmon: -; BUG: RandomUnseenWildMon always picks a morning Pokémon species (see docs/bugs_and_glitches.md) - push hl - ld bc, 5 + 4 * 2 ; Location of the level of the 5th wild Pokemon in that map - add hl, bc ld a, [wTimeOfDay] ld bc, NUM_GRASSMON * 2 call AddNTimes + push hl + ld bc, 5 + 4 * 2 ; Location of the level of the 5th wild Pokemon in that map + add hl, bc .randloop1 call Random and %11 diff --git a/engine/phone/phone.asm b/engine/phone/phone.asm index f35dc3d7e..e1ecb0e63 100644 --- a/engine/phone/phone.asm +++ b/engine/phone/phone.asm @@ -93,19 +93,6 @@ GetRemainingSpaceInPhoneList: INCLUDE "data/phone/permanent_numbers.asm" -BrokenPlaceFarString: -; This routine is not in bank 0 and will fail or crash if called. - ldh a, [hROMBank] - push af - ld a, b - rst Bankswitch - - call PlaceString - - pop af - rst Bankswitch - ret - CheckPhoneCall:: ; Check if the phone is ringing in the overworld. @@ -498,14 +485,12 @@ PhoneCall:: ld [hl], "☎" inc hl inc hl -; BUG: The unused phonecall script command may crash (see docs/bugs_and_glitches.md) - ld a, [wPhoneScriptBank] - ld b, a ld a, [wPhoneCaller] ld e, a ld a, [wPhoneCaller + 1] ld d, a - call BrokenPlaceFarString + ld a, [wPhoneScriptBank] + call PlaceFarString ret Phone_NoSignal: diff --git a/engine/pokedex/pokedex.asm b/engine/pokedex/pokedex.asm index 686016618..fe15b2609 100644 --- a/engine/pokedex/pokedex.asm +++ b/engine/pokedex/pokedex.asm @@ -464,13 +464,8 @@ DexEntryScreen_MenuActionJumptable: ret .Cry: -; BUG: Playing Entei's Pokédex cry can distort Raikou's and Suicune's (see docs/bugs_and_glitches.md) - call Pokedex_GetSelectedMon - ld a, [wTempSpecies] - call GetCryIndex - ld e, c - ld d, b - call PlayCry + ld a, [wCurPartySpecies] + call PlayMonCry ret .Print: diff --git a/engine/pokemon/breeding.asm b/engine/pokemon/breeding.asm index a344a7ec3..8b27c9a1d 100644 --- a/engine/pokemon/breeding.asm +++ b/engine/pokemon/breeding.asm @@ -620,12 +620,12 @@ GetBreedmonMovePointer: ret GetEggFrontpic: -; BUG: A hatching Unown egg would not show the right letter (see docs/bugs_and_glitches.md) push de ld [wCurPartySpecies], a ld [wCurSpecies], a call GetBaseData - ld hl, wBattleMonDVs + ld a, MON_DVS + call GetPartyParamLocation predef GetUnownLetter pop de predef_jump GetMonFrontpic @@ -635,7 +635,8 @@ GetHatchlingFrontpic: ld [wCurPartySpecies], a ld [wCurSpecies], a call GetBaseData - ld hl, wBattleMonDVs + ld a, MON_DVS + call GetPartyParamLocation predef GetUnownLetter pop de predef_jump GetAnimatedFrontpic diff --git a/engine/pokemon/experience.asm b/engine/pokemon/experience.asm index ea98af941..cb98e2d2d 100644 --- a/engine/pokemon/experience.asm +++ b/engine/pokemon/experience.asm @@ -32,7 +32,18 @@ CalcLevel: CalcExpAtLevel: ; (a/b)*n**3 + c*n**2 + d*n - e -; BUG: Experience underflow for level 1 Pokémon with Medium-Slow growth rate (see docs/bugs_and_glitches.md) + ld a, d + dec a + jr nz, .UseExpFormula +; Pokémon have 0 experience at level 1 + ld hl, hProduct + ld [hli], a + ld [hli], a + ld [hli], a + ld [hl], a + ret + +.UseExpFormula ld a, [wBaseGrowthRate] add a add a diff --git a/engine/pokemon/move_mon.asm b/engine/pokemon/move_mon.asm index 4701705f3..eddea65fb 100644 --- a/engine/pokemon/move_mon.asm +++ b/engine/pokemon/move_mon.asm @@ -879,23 +879,35 @@ RetrieveBreedmon: ld a, TRUE ld [wSkipMovesBeforeLevelUp], a predef FillMoves -; BUG: Pokémon deposited in the Day-Care might lose experience (see docs/bugs_and_glitches.md) ld a, [wPartyCount] dec a ld [wCurPartyMon], a farcall HealPartyMon - ld a, [wCurPartyLevel] - ld d, a + ld d, MAX_LEVEL callfar CalcExpAtLevel pop bc - ld hl, MON_EXP + ld hl, MON_EXP + 2 add hl, bc ldh a, [hMultiplicand] - ld [hli], a + ld b, a ldh a, [hMultiplicand + 1] - ld [hli], a + ld c, a ldh a, [hMultiplicand + 2] + ld d, a + ld a, [hld] + sub d + ld a, [hld] + sbc c + ld a, [hl] + sbc b + jr c, .not_max_exp + ld a, b + ld [hli], a + ld a, c + ld [hli], a + ld a, d ld [hl], a +.not_max_exp and a ret diff --git a/engine/pokemon/party_menu.asm b/engine/pokemon/party_menu.asm index eb7f0c7f7..93e643b68 100644 --- a/engine/pokemon/party_menu.asm +++ b/engine/pokemon/party_menu.asm @@ -385,7 +385,6 @@ PlacePartyMonEvoStoneCompatibility: ret .DetermineCompatibility: -; BUG: Only the first three evolution entries can have Stone compatibility reported correctly (see docs/bugs_and_glitches.md) ld de, wStringBuffer1 ld a, BANK(EvosAttacksPointers) ld bc, 2 @@ -396,14 +395,17 @@ PlacePartyMonEvoStoneCompatibility: ld l, a ld de, wStringBuffer1 ld a, BANK("Evolutions and Attacks") - ld bc, 10 + ld bc, STRING_BUFFER_LENGTH call FarCopyBytes ld hl, wStringBuffer1 .loop2 -; BUG: EVOLVE_STAT can break Stone compatibility reporting (see docs/bugs_and_glitches.md) ld a, [hli] and a jr z, .nope + cp EVOLVE_STAT + jr nz, .not_four_bytes + inc hl +.not_four_bytes inc hl inc hl cp EVOLVE_ITEM diff --git a/engine/pokemon/search_owned.asm b/engine/pokemon/search_owned.asm index 76674bc58..8bfcd901c 100644 --- a/engine/pokemon/search_owned.asm +++ b/engine/pokemon/search_owned.asm @@ -222,8 +222,7 @@ CheckOwnMon: ld hl, wPlayerName -; BUG: CheckOwnMon only checks the first five letters of OT names (see docs/bugs_and_glitches.md) -rept NAME_LENGTH_JAPANESE - 2 +rept PLAYER_NAME_LENGTH - 2 ld a, [de] cp [hl] jr nz, .notfound diff --git a/engine/tilesets/tileset_anims.asm b/engine/tilesets/tileset_anims.asm index 0ea240e9e..5b22f2df9 100644 --- a/engine/tilesets/tileset_anims.asm +++ b/engine/tilesets/tileset_anims.asm @@ -639,26 +639,8 @@ ForestTreeRightAnimation2: GetForestTreeFrame: ; Return 0 if a is even, or 2 if odd. - and a - jr z, .even - cp 1 - jr z, .odd - cp 2 - jr z, .even - cp 3 - jr z, .odd - cp 4 - jr z, .even - cp 5 - jr z, .odd - cp 6 - jr z, .even -.odd - ld a, 2 - scf - ret -.even - xor a + and 1 + add a ret AnimateFlowerTile: diff --git a/gfx/tilesets/roofs.pal b/gfx/tilesets/roofs.pal index 652b152c1..87c1c4efc 100644 --- a/gfx/tilesets/roofs.pal +++ b/gfx/tilesets/roofs.pal @@ -11,8 +11,8 @@ RGB 06,09,07, 04,05,06 ; nite ; group 3 (dungeons) - RGB 21,21,21, 11,11,11 ; morn/day - RGB 21,21,21, 17,08,07 ; nite + RGB 31,10,00, 18,06,00 ; morn/day + RGB 18,05,09, 17,08,07 ; nite ; group 4 (Ecruteak) RGB 31,19,00, 27,10,05 ; morn/day diff --git a/home/init.asm b/home/init.asm index 5544dfcb3..7320832e2 100644 --- a/home/init.asm +++ b/home/init.asm @@ -186,7 +186,6 @@ ClearVRAM:: ClearWRAM:: ; Wipe swappable WRAM banks (1-7) ; Assumes CGB or AGB -; BUG: ClearWRAM only clears WRAM bank 1 (see docs/bugs_and_glitches.md) ld a, 1 .bank_loop @@ -199,7 +198,7 @@ ClearWRAM:: pop af inc a cp 8 - jr nc, .bank_loop + jr c, .bank_loop ret ClearsScratch:: diff --git a/home/map.asm b/home/map.asm index 2c9a399a6..4298e8eaf 100644 --- a/home/map.asm +++ b/home/map.asm @@ -146,13 +146,13 @@ LoadMetatiles:: ld e, l ld d, h ; Set hl to the address of the current metatile data ([wTilesetBlocksAddress] + (a) tiles). -; BUG: LoadMetatiles wraps around past 128 blocks (see docs/bugs_and_glitches.md) add a ld l, a ld h, 0 add hl, hl add hl, hl add hl, hl + add hl, hl ld a, [wTilesetBlocksAddress] add l ld l, a @@ -581,13 +581,13 @@ ReadObjectEvents:: ld a, [wCurMapObjectEventCount] call CopyMapObjectEvents -; get NUM_OBJECTS - [wCurMapObjectEventCount] -; BUG: ReadObjectEvents overflows into wObjectMasks (see docs/bugs_and_glitches.md) +; get NUM_OBJECTS - [wCurMapObjectEventCount] - 1 ld a, [wCurMapObjectEventCount] ld c, a - ld a, NUM_OBJECTS + ld a, NUM_OBJECTS - 1 sub c jr z, .skip + jr c, .skip ; could have done "inc hl" instead ld bc, 1 @@ -2203,8 +2203,8 @@ GetMapMusic:: ld a, c cp MUSIC_MAHOGANY_MART jr z, .mahoganymart - bit RADIO_TOWER_MUSIC_F, c - jr nz, .radiotower + cp MUSIC_RADIO_TOWER + jr z, .radiotower farcall Function8b342 ld e, c ld d, 0 @@ -2221,11 +2221,7 @@ GetMapMusic:: jr .done .clearedradiotower - ; the rest of the byte - ld a, c - and RADIO_TOWER_MUSIC - 1 - ld e, a - ld d, 0 + ld de, MUSIC_GOLDENROD_CITY jr .done .mahoganymart diff --git a/maps/ManiasHouse.asm b/maps/ManiasHouse.asm index ecd6e007b..ed6ffd049 100644 --- a/maps/ManiasHouse.asm +++ b/maps/ManiasHouse.asm @@ -56,8 +56,7 @@ ManiaScript: ifequal SHUCKIE_WRONG_MON, .wrong ifequal SHUCKIE_REFUSED, .refused ifequal SHUCKIE_HAPPY, .superhappy -; BUG: Mania uses wrong dialogue for trying to return Shuckie with no other Pokémon (see docs/bugs_and_glitches.md) - ifequal SHUCKIE_FAINTED, .default_postevent + ifequal SHUCKIE_FAINTED, .nothingleft ; SHUCKIE_RETURNED writetext ManiaText_ThankYou waitbutton