diff --git a/engine/menus/save.asm b/engine/menus/save.asm index dc677c8ca..98a3a25c5 100644 --- a/engine/menus/save.asm +++ b/engine/menus/save.asm @@ -314,7 +314,7 @@ UpdateStackTop: FindStackTop: ; Find the furthest point that sp has traversed to. ; This is distinct from the current value of sp. - ld hl, wStack - $ff + ld hl, wStackBottom .loop ld a, [hl] or a diff --git a/engine/overworld/map_objects.asm b/engine/overworld/map_objects.asm index 5e2691fc1..27a09509b 100644 --- a/engine/overworld/map_objects.asm +++ b/engine/overworld/map_objects.asm @@ -2781,12 +2781,12 @@ InitSprites: .DeterminePriorities: xor a - ld hl, wMovementPointer + ld hl, wObjectPriorities ld bc, NUM_OBJECT_STRUCTS call ByteFill ld d, 0 ld bc, wObjectStructs - ld hl, wMovementPointer + ld hl, wObjectPriorities .loop push hl call DoesObjectHaveASprite @@ -2833,7 +2833,7 @@ InitSprites: ret .InitSpritesByPriority: - ld hl, wMovementPointer + ld hl, wObjectPriorities .next_sprite ld a, [hli] ld d, a diff --git a/wram.asm b/wram.asm index 464cc6c8e..0e2a83c4f 100644 --- a/wram.asm +++ b/wram.asm @@ -166,18 +166,26 @@ wScriptVar:: db ; c2dd wPlayerNextMovement:: db wPlayerMovement:: db + ds 2 + wc2e2:: wMovementObject:: db wMovementDataBank:: db wMovementDataAddress:: dw -wc2e6:: ds 4 +wc2e6:: dw + + ds 2 + wMovementByteWasControlSwitch:: db + +UNION ; c2eb +wObjectPriorities:: ds NUM_OBJECT_STRUCTS ; c2eb + +NEXTU ; c2eb wMovementPointer:: dw ; c2eb - ds 3 - wTempObjectCopyMapObjectIndex:: db ; c2f0 wTempObjectCopySprite:: db ; c2f1 wTempObjectCopySpriteVTile:: db ; c2f2 @@ -187,6 +195,7 @@ wTempObjectCopyRange:: db ; c2f5 wTempObjectCopyX:: db ; c2f6 wTempObjectCopyY:: db ; c2f7 wTempObjectCopyRadius:: db ; c2f8 +ENDU ; c2f8 ds 1 @@ -2466,7 +2475,7 @@ wStartMinute:: db ; d4b8 wStartSecond:: db ; d4b9 wRTC:: ds 4 ; d4ba - + ds 4 wDST:: ; d4c2