From b0b5ed2eb8625952f26d01e9ac1642948b3aa10e 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 (#1108) --- constants/gfx_constants.asm | 2 ++ engine/movie/splash.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 4a56ce2b6af..e41fe82c7f9 100644 --- a/constants/gfx_constants.asm +++ b/constants/gfx_constants.asm @@ -55,3 +55,5 @@ DEF SPRITE_GFX_LIST_CAPACITY EQU 32 ; see wUsedSprites const ANIM_MON_HOF const ANIM_MON_EGG1 const ANIM_MON_EGG2 + +DEF OAM_YCOORD_HIDDEN EQU 160 ; hides an OAM offscreen diff --git a/engine/movie/splash.asm b/engine/movie/splash.asm index a9a60ab695f..af3b911f72a 100644 --- a/engine/movie/splash.asm +++ b/engine/movie/splash.asm @@ -93,7 +93,7 @@ GameFreakPresentsInit: call InitSpriteAnimStruct ld hl, SPRITEANIMSTRUCT_YOFFSET add hl, bc - ld [hl], 160 + ld [hl], OAM_YCOORD_HIDDEN ld hl, SPRITEANIMSTRUCT_VAR1 add hl, bc ld [hl], 96 diff --git a/engine/overworld/map_objects.asm b/engine/overworld/map_objects.asm index 1e8c226a54d..f3c21aa7ac0 100644 --- a/engine/overworld/map_objects.asm +++ b/engine/overworld/map_objects.asm @@ -2757,7 +2757,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 117bc309366..3934f47d474 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 0c1352a327f..d8e25766344 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