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 AnimateFrontpic
|
||||||
add_predef Unused_HOF_AnimateAlignedFrontpic
|
add_predef Unused_HOF_AnimateAlignedFrontpic
|
||||||
add_predef HOF_AnimateFrontpic
|
add_predef HOF_AnimateFrontpic
|
||||||
dbw -1, DummyEndPredef ; pointless
|
|
||||||
|
@ -644,9 +644,8 @@ BattleAnimCmd_ResetObp0:
|
|||||||
ret
|
ret
|
||||||
|
|
||||||
BattleAnimCmd_ClearObjs:
|
BattleAnimCmd_ClearObjs:
|
||||||
; BUG: BattleAnimCmd only clears the first 6⅔ objects (see docs/bugs_and_glitches.md)
|
|
||||||
ld hl, wActiveAnimObjects
|
ld hl, wActiveAnimObjects
|
||||||
ld a, $a0
|
ld a, NUM_ANIM_OBJECTS * BATTLEANIMSTRUCT_LENGTH
|
||||||
.loop
|
.loop
|
||||||
ld [hl], 0
|
ld [hl], 0
|
||||||
inc hl
|
inc hl
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
DEF NUM_OPTIONS EQU const_value ; 8
|
DEF NUM_OPTIONS EQU const_value ; 8
|
||||||
|
|
||||||
_Option:
|
_Option:
|
||||||
; BUG: Options menu fails to clear joypad state on initialization (see docs/bugs_and_glitches.md)
|
call ClearJoypad
|
||||||
ld hl, hInMenu
|
ld hl, hInMenu
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
push af
|
push af
|
||||||
|
@ -73,11 +73,13 @@ Credits::
|
|||||||
|
|
||||||
call GetCreditsPalette
|
call GetCreditsPalette
|
||||||
call SetPalettes
|
call SetPalettes
|
||||||
; BUG: Credits sequence changes move selection menu behavior (see docs/bugs_and_glitches.md)
|
|
||||||
ldh a, [hVBlank]
|
ldh a, [hVBlank]
|
||||||
push af
|
push af
|
||||||
ld a, $5
|
ld a, $5
|
||||||
ldh [hVBlank], a
|
ldh [hVBlank], a
|
||||||
|
ldh a, [hInMenu]
|
||||||
|
push af
|
||||||
ld a, TRUE
|
ld a, TRUE
|
||||||
ldh [hInMenu], a
|
ldh [hInMenu], a
|
||||||
xor a
|
xor a
|
||||||
@ -101,6 +103,8 @@ Credits::
|
|||||||
ldh [hLCDCPointer], a
|
ldh [hLCDCPointer], a
|
||||||
ldh [hBGMapAddress], a
|
ldh [hBGMapAddress], a
|
||||||
pop af
|
pop af
|
||||||
|
ldh [hInMenu], a
|
||||||
|
pop af
|
||||||
ldh [hVBlank], a
|
ldh [hVBlank], a
|
||||||
pop af
|
pop af
|
||||||
ldh [rSVBK], a
|
ldh [rSVBK], a
|
||||||
|
@ -543,13 +543,12 @@ TryObjectEvent:
|
|||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
and MAPOBJECT_TYPE_MASK
|
and MAPOBJECT_TYPE_MASK
|
||||||
|
|
||||||
; BUG: TryObjectEvent arbitrary code execution (see docs/bugs_and_glitches.md)
|
|
||||||
push bc
|
push bc
|
||||||
ld de, 3
|
ld de, 3
|
||||||
ld hl, ObjectEventTypeArray
|
ld hl, ObjectEventTypeArray
|
||||||
call IsInArray
|
call IsInArray
|
||||||
jr nc, .nope
|
|
||||||
pop bc
|
pop bc
|
||||||
|
jr nc, .nope
|
||||||
|
|
||||||
inc hl
|
inc hl
|
||||||
ld a, [hli]
|
ld a, [hli]
|
||||||
|
@ -4,10 +4,10 @@ CanObjectMoveInDirection:
|
|||||||
bit SWIMMING_F, [hl]
|
bit SWIMMING_F, [hl]
|
||||||
jr z, .not_swimming
|
jr z, .not_swimming
|
||||||
|
|
||||||
; BUG: Swimming NPCs aren't limited by their movement radius (see docs/bugs_and_glitches.md)
|
|
||||||
ld hl, OBJECT_FLAGS1
|
ld hl, OBJECT_FLAGS1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
bit NOCLIP_TILES_F, [hl]
|
bit NOCLIP_TILES_F, [hl]
|
||||||
|
jr nz, .noclip_tiles
|
||||||
push hl
|
push hl
|
||||||
push bc
|
push bc
|
||||||
call WillObjectBumpIntoLand
|
call WillObjectBumpIntoLand
|
||||||
|
@ -316,8 +316,6 @@ AddSpriteGFX:
|
|||||||
ret
|
ret
|
||||||
|
|
||||||
LoadSpriteGFX:
|
LoadSpriteGFX:
|
||||||
; BUG: LoadSpriteGFX does not limit the capacity of UsedSprites (see docs/bugs_and_glitches.md)
|
|
||||||
|
|
||||||
ld hl, wUsedSprites
|
ld hl, wUsedSprites
|
||||||
ld b, SPRITE_GFX_LIST_CAPACITY
|
ld b, SPRITE_GFX_LIST_CAPACITY
|
||||||
.loop
|
.loop
|
||||||
@ -335,7 +333,9 @@ LoadSpriteGFX:
|
|||||||
ret
|
ret
|
||||||
|
|
||||||
.LoadSprite:
|
.LoadSprite:
|
||||||
|
push de
|
||||||
call GetSprite
|
call GetSprite
|
||||||
|
pop de
|
||||||
ld a, l
|
ld a, l
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
@ -391,9 +391,9 @@ DoPlayerMovement::
|
|||||||
db FACE_UP | FACE_LEFT ; COLL_HOP_UP_LEFT
|
db FACE_UP | FACE_LEFT ; COLL_HOP_UP_LEFT
|
||||||
|
|
||||||
.CheckWarp:
|
.CheckWarp:
|
||||||
; BUG: No bump noise if standing on tile $3E (see docs/bugs_and_glitches.md)
|
|
||||||
|
|
||||||
ld a, [wWalkingDirection]
|
ld a, [wWalkingDirection]
|
||||||
|
cp STANDING
|
||||||
|
jr z, .not_warp
|
||||||
ld e, a
|
ld e, a
|
||||||
ld d, 0
|
ld d, 0
|
||||||
ld hl, .EdgeWarps
|
ld hl, .EdgeWarps
|
||||||
@ -405,8 +405,6 @@ DoPlayerMovement::
|
|||||||
ld a, TRUE
|
ld a, TRUE
|
||||||
ld [wWalkingIntoEdgeWarp], a
|
ld [wWalkingIntoEdgeWarp], a
|
||||||
ld a, [wWalkingDirection]
|
ld a, [wWalkingDirection]
|
||||||
cp STANDING
|
|
||||||
jr z, .not_warp
|
|
||||||
|
|
||||||
ld e, a
|
ld e, a
|
||||||
ld a, [wPlayerDirection]
|
ld a, [wPlayerDirection]
|
||||||
|
@ -1238,12 +1238,13 @@ Script_memcall:
|
|||||||
; fallthrough
|
; fallthrough
|
||||||
|
|
||||||
ScriptCall:
|
ScriptCall:
|
||||||
; BUG: ScriptCall can overflow wScriptStack and crash (see docs/bugs_and_glitches.md)
|
|
||||||
|
|
||||||
push de
|
|
||||||
ld hl, wScriptStackSize
|
ld hl, wScriptStackSize
|
||||||
ld e, [hl]
|
ld a, [hl]
|
||||||
|
cp 5
|
||||||
|
ret nc
|
||||||
|
push de
|
||||||
inc [hl]
|
inc [hl]
|
||||||
|
ld e, a
|
||||||
ld d, 0
|
ld d, 0
|
||||||
ld hl, wScriptStack
|
ld hl, wScriptStack
|
||||||
add hl, de
|
add hl, de
|
||||||
|
@ -93,19 +93,6 @@ GetRemainingSpaceInPhoneList:
|
|||||||
|
|
||||||
INCLUDE "data/phone/permanent_numbers.asm"
|
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::
|
CheckPhoneCall::
|
||||||
; Check if the phone is ringing in the overworld.
|
; Check if the phone is ringing in the overworld.
|
||||||
|
|
||||||
@ -496,14 +483,12 @@ PhoneCall::
|
|||||||
ld [hl], "☎"
|
ld [hl], "☎"
|
||||||
inc hl
|
inc 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 a, [wPhoneCaller]
|
||||||
ld e, a
|
ld e, a
|
||||||
ld a, [wPhoneCaller + 1]
|
ld a, [wPhoneCaller + 1]
|
||||||
ld d, a
|
ld d, a
|
||||||
call BrokenPlaceFarString
|
ld a, [wPhoneScriptBank]
|
||||||
|
call PlaceFarString
|
||||||
ret
|
ret
|
||||||
|
|
||||||
Phone_NoSignal:
|
Phone_NoSignal:
|
||||||
|
@ -184,7 +184,6 @@ ClearVRAM::
|
|||||||
ClearWRAM::
|
ClearWRAM::
|
||||||
; Wipe swappable WRAM banks (1-7)
|
; Wipe swappable WRAM banks (1-7)
|
||||||
; Assumes CGB or AGB
|
; Assumes CGB or AGB
|
||||||
; BUG: ClearWRAM only clears WRAM bank 1 (see docs/bugs_and_glitches.md)
|
|
||||||
|
|
||||||
ld a, 1
|
ld a, 1
|
||||||
.bank_loop
|
.bank_loop
|
||||||
@ -197,7 +196,7 @@ ClearWRAM::
|
|||||||
pop af
|
pop af
|
||||||
inc a
|
inc a
|
||||||
cp 8
|
cp 8
|
||||||
jr nc, .bank_loop
|
jr c, .bank_loop
|
||||||
ret
|
ret
|
||||||
|
|
||||||
ClearsScratch::
|
ClearsScratch::
|
||||||
|
13
home/map.asm
13
home/map.asm
@ -573,13 +573,13 @@ ReadObjectEvents::
|
|||||||
ld a, [wCurMapObjectEventCount]
|
ld a, [wCurMapObjectEventCount]
|
||||||
call CopyMapObjectEvents
|
call CopyMapObjectEvents
|
||||||
|
|
||||||
; get NUM_OBJECTS - [wCurMapObjectEventCount]
|
; get NUM_OBJECTS - [wCurMapObjectEventCount] - 1
|
||||||
; BUG: ReadObjectEvents overflows into wObjectMasks (see docs/bugs_and_glitches.md)
|
|
||||||
ld a, [wCurMapObjectEventCount]
|
ld a, [wCurMapObjectEventCount]
|
||||||
ld c, a
|
ld c, a
|
||||||
ld a, NUM_OBJECTS
|
ld a, NUM_OBJECTS - 1
|
||||||
sub c
|
sub c
|
||||||
jr z, .skip
|
jr z, .skip
|
||||||
|
jr c, .skip
|
||||||
|
|
||||||
; could have done "inc hl" instead
|
; could have done "inc hl" instead
|
||||||
ld bc, 1
|
ld bc, 1
|
||||||
@ -2264,10 +2264,3 @@ LoadMapTileset::
|
|||||||
pop bc
|
pop bc
|
||||||
pop hl
|
pop hl
|
||||||
ret
|
ret
|
||||||
|
|
||||||
DummyEndPredef::
|
|
||||||
; Unused function at the end of PredefPointers.
|
|
||||||
rept 16
|
|
||||||
nop
|
|
||||||
endr
|
|
||||||
ret
|
|
||||||
|
Loading…
Reference in New Issue
Block a user