mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2024-11-16 11:27:33 -08:00
Fix some pokecrystal bug and glitches (#8)
Credits sequence changes move selection menu behavior; Swimming NPCs aren't limited by their movement radius; No bump noise if standing on tile E; The unused phonecall script command may crash; ScriptCall can overflow wScriptStack and crash; LoadSpriteGFX does not limit the capacity of UsedSprites; ReadObjectEvents overflows into wObjectMasks; ClearWRAM only clears WRAM bank 1; BattleAnimCmd_ClearObjs only clears the first 6⅔ objects; Options menu fails to clear joypad state on initialization
This commit is contained in:
parent
d30b9dd60f
commit
59bda0b36b
@ -80,4 +80,3 @@ PredefPointers::
|
||||
add_predef AnimateFrontpic
|
||||
add_predef Unused_HOF_AnimateAlignedFrontpic
|
||||
add_predef HOF_AnimateFrontpic
|
||||
dbw -1, DummyEndPredef ; pointless
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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]
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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]
|
||||
|
@ -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
|
||||
|
@ -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:
|
||||
|
@ -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::
|
||||
|
13
home/map.asm
13
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
|
||||
|
Loading…
Reference in New Issue
Block a user