From 620980f77d12e62af4917d8283e94103c843885f Mon Sep 17 00:00:00 2001 From: vulcandth Date: Sun, 14 Apr 2024 15:55:46 -0500 Subject: [PATCH] Fix/update sprite y-coord offscreen definitions (pret/pokecrystal#1108) --- constants/gfx_constants.asm | 2 ++ engine/battle_anims/anim_commands.asm | 2 +- engine/overworld/map_objects.asm | 2 +- engine/pokemon/switchpartymons.asm | 2 +- home/clear_sprites.asm | 2 +- 5 files changed, 6 insertions(+), 4 deletions(-) diff --git a/constants/gfx_constants.asm b/constants/gfx_constants.asm index 58a5f41cb..20f25bc73 100644 --- a/constants/gfx_constants.asm +++ b/constants/gfx_constants.asm @@ -43,3 +43,5 @@ DEF SPRITEOAMSTRUCT_LENGTH EQU _RS DEF NUM_SPRITE_OAM_STRUCTS EQU 40 ; see wShadowOAM DEF SPRITE_GFX_LIST_CAPACITY EQU 12 ; see wUsedSprites + +DEF OAM_YCOORD_HIDDEN EQU 160 ; hides an OAM offscreen diff --git a/engine/battle_anims/anim_commands.asm b/engine/battle_anims/anim_commands.asm index 21bdc44fe..43509fd31 100644 --- a/engine/battle_anims/anim_commands.asm +++ b/engine/battle_anims/anim_commands.asm @@ -628,7 +628,7 @@ BattleAnimCmd_ResetObp0: BattleAnimCmd_ClearObjs: ; BUG: BattleAnimCmd only clears the first 6⅔ objects (see docs/bugs_and_glitches.md) ld hl, wActiveAnimObjects - ld a, $a0 + ld a, OAM_YCOORD_HIDDEN .loop ld [hl], 0 inc hl diff --git a/engine/overworld/map_objects.asm b/engine/overworld/map_objects.asm index 78194d091..e24e39abc 100644 --- a/engine/overworld/map_objects.asm +++ b/engine/overworld/map_objects.asm @@ -2692,7 +2692,7 @@ _UpdateSprites:: ld h, HIGH(wShadowOAM) ld de, SPRITEOAMSTRUCT_LENGTH ld a, b - ld c, SCREEN_HEIGHT_PX + 2 * TILE_WIDTH + ld c, OAM_YCOORD_HIDDEN .loop ld [hl], c ; y add hl, de diff --git a/engine/pokemon/switchpartymons.asm b/engine/pokemon/switchpartymons.asm index 117bc3093..3934f47d4 100644 --- a/engine/pokemon/switchpartymons.asm +++ b/engine/pokemon/switchpartymons.asm @@ -31,7 +31,7 @@ _SwitchPartyMons: ld de, SPRITEOAMSTRUCT_LENGTH ld c, 4 .gfx_loop - ld [hl], SCREEN_WIDTH_PX ; y (off-screen) + ld [hl], OAM_YCOORD_HIDDEN add hl, de dec c jr nz, .gfx_loop diff --git a/home/clear_sprites.asm b/home/clear_sprites.asm index 0c1352a32..d8e257663 100644 --- a/home/clear_sprites.asm +++ b/home/clear_sprites.asm @@ -14,7 +14,7 @@ HideSprites:: ld hl, wShadowOAMSprite00YCoord ld de, SPRITEOAMSTRUCT_LENGTH ld b, NUM_SPRITE_OAM_STRUCTS - ld a, SCREEN_WIDTH_PX + ld a, OAM_YCOORD_HIDDEN .loop ld [hl], a ; y add hl, de