Make sure overworld sprites don't appear after returning from overworld [bugfix] (#17)

This commit is contained in:
xCrystal 2023-10-21 19:29:29 +02:00
parent e9ad1f5612
commit 89a17c3a05
2 changed files with 9 additions and 14 deletions

View File

@ -130,6 +130,7 @@ GameMenu_WorldMap:
farcall OverworldLoop farcall OverworldLoop
; return from overworld loop ; return from overworld loop
call ClearObjectStructs
call ClearBGPalettes call ClearBGPalettes
call ClearSprites call ClearSprites
farcall AutoSaveGameOutsideOverworld farcall AutoSaveGameOutsideOverworld

View File

@ -551,7 +551,7 @@ ReadBGEvents::
ReadObjectEvents:: ReadObjectEvents::
push hl push hl
call ClearObjectStructs call ClearNonPlayerObjectStructs
pop de pop de
ld hl, wMap1Object ld hl, wMap1Object
ld a, [de] ld a, [de]
@ -618,22 +618,16 @@ CopyMapObjectEvents::
ret ret
ClearObjectStructs:: ClearObjectStructs::
ld hl, wObjectStructs
ld bc, OBJECT_LENGTH * NUM_OBJECT_STRUCTS
xor a
jp ByteFill
ClearNonPlayerObjectStructs::
ld hl, wObject1Struct ld hl, wObject1Struct
ld bc, OBJECT_LENGTH * (NUM_OBJECT_STRUCTS - 1) ld bc, OBJECT_LENGTH * (NUM_OBJECT_STRUCTS - 1)
xor a xor a
call ByteFill jp ByteFill
; Just to make sure (this is rather pointless)
ld hl, wObject1Struct
ld de, OBJECT_LENGTH
ld c, NUM_OBJECT_STRUCTS - 1
xor a
.loop
ld [hl], a
add hl, de
dec c
jr nz, .loop
ret
GetWarpDestCoords:: GetWarpDestCoords::
call GetMapScriptsBank call GetMapScriptsBank