diff --git a/data/predef_pointers.asm b/data/predef_pointers.asm index 14151494c..e5dfcaac0 100644 --- a/data/predef_pointers.asm +++ b/data/predef_pointers.asm @@ -80,4 +80,3 @@ PredefPointers:: add_predef AnimateFrontpic add_predef Unused_HOF_AnimateAlignedFrontpic add_predef HOF_AnimateFrontpic - dbw -1, DummyEndPredef ; pointless diff --git a/engine/battle_anims/anim_commands.asm b/engine/battle_anims/anim_commands.asm index e462c3a4e..46c22b0db 100644 --- a/engine/battle_anims/anim_commands.asm +++ b/engine/battle_anims/anim_commands.asm @@ -644,9 +644,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_ANIM_OBJECTS * BATTLEANIMSTRUCT_LENGTH .loop ld [hl], 0 inc hl diff --git a/engine/menus/options_menu.asm b/engine/menus/options_menu.asm index 41359119b..e39e1e57c 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 304bd061e..86aa79a9c 100644 --- a/engine/movie/credits.asm +++ b/engine/movie/credits.asm @@ -73,11 +73,13 @@ Credits:: call GetCreditsPalette call SetPalettes -; BUG: Credits sequence changes move selection menu behavior (see docs/bugs_and_glitches.md) + ldh a, [hVBlank] push af ld a, $5 ldh [hVBlank], a + ldh a, [hInMenu] + push af ld a, TRUE ldh [hInMenu], a xor a @@ -101,6 +103,8 @@ Credits:: ldh [hLCDCPointer], a ldh [hBGMapAddress], a pop af + ldh [hInMenu], a + pop af ldh [hVBlank], a pop af ldh [rSVBK], a diff --git a/engine/overworld/events.asm b/engine/overworld/events.asm index f0bdb9382..ec0ad4ba7 100644 --- a/engine/overworld/events.asm +++ b/engine/overworld/events.asm @@ -543,13 +543,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 a47bdc44d..5cdd25935 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 6fb186d67..8faa60773 100644 --- a/engine/overworld/overworld.asm +++ b/engine/overworld/overworld.asm @@ -316,8 +316,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 @@ -335,7 +333,9 @@ LoadSpriteGFX: ret .LoadSprite: + push de call GetSprite + pop de ld a, l ret diff --git a/engine/overworld/player_movement.asm b/engine/overworld/player_movement.asm index 0c3924844..3fe9204dd 100644 --- a/engine/overworld/player_movement.asm +++ b/engine/overworld/player_movement.asm @@ -391,9 +391,9 @@ 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 +405,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/scripting.asm b/engine/overworld/scripting.asm index d26c413b3..e647dc168 100644 --- a/engine/overworld/scripting.asm +++ b/engine/overworld/scripting.asm @@ -1238,12 +1238,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 diff --git a/engine/phone/phone.asm b/engine/phone/phone.asm index 7d6678e9c..15e4e4a4c 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. @@ -496,14 +483,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/home/init.asm b/home/init.asm index f3f9a1720..107ab2a0c 100644 --- a/home/init.asm +++ b/home/init.asm @@ -184,7 +184,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 @@ -197,7 +196,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 b2187fc42..541307809 100644 --- a/home/map.asm +++ b/home/map.asm @@ -573,13 +573,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 @@ -2264,10 +2264,3 @@ LoadMapTileset:: pop bc pop hl ret - -DummyEndPredef:: -; Unused function at the end of PredefPointers. -rept 16 - nop -endr - ret