chore: fix bugs
Some checks failed
CI / build (push) Failing after 1m18s

This commit is contained in:
Giulia Sanguineti
2025-10-01 10:11:42 +02:00
parent d138ed1bd4
commit 4c8d3e962f
44 changed files with 236 additions and 235 deletions

View File

@@ -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]

View File

@@ -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

View File

@@ -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

View File

@@ -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]

View File

@@ -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

View File

@@ -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

View File

@@ -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