From 13a26c462ebff4817b3c9dd7b36e5a07ecd759e1 Mon Sep 17 00:00:00 2001 From: Rachel Date: Wed, 30 Oct 2024 10:09:54 -0700 Subject: [PATCH] Display the correct shadow size when sending out a new Pokemon (#5618) --- src/battle_gfx_sfx_util.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/battle_gfx_sfx_util.c b/src/battle_gfx_sfx_util.c index 3729a4f73f..e2a583dcc9 100644 --- a/src/battle_gfx_sfx_util.c +++ b/src/battle_gfx_sfx_util.c @@ -26,6 +26,7 @@ #include "constants/rgb.h" #include "constants/battle_palace.h" #include "constants/battle_move_effects.h" +#include "constants/event_objects.h" // only for SHADOW_SIZE constants // this file's functions static u8 GetBattlePalaceMoveGroup(u8 battler, u16 move); @@ -1130,8 +1131,9 @@ void SetBattlerSpriteAffineMode(u8 affineMode) } } -#define tBattlerId data[0] -#define tSpriteSide data[1] +#define tBattlerId data[0] +#define tSpriteSide data[1] +#define tBaseTileNum data[2] #define SPRITE_SIDE_LEFT 0 #define SPRITE_SIDE_RIGHT 1 @@ -1152,7 +1154,8 @@ void CreateEnemyShadowSprite(u32 battler) struct Sprite *sprite = &gSprites[gBattleSpritesDataPtr->healthBoxesData[battler].shadowSpriteIdPrimary]; sprite->tBattlerId = battler; sprite->tSpriteSide = SPRITE_SIDE_LEFT; - sprite->oam.tileNum += 8 * size; + sprite->tBaseTileNum = sprite->oam.tileNum; + sprite->oam.tileNum = sprite->tBaseTileNum + (8 * size); sprite->invisible = TRUE; } @@ -1165,7 +1168,8 @@ void CreateEnemyShadowSprite(u32 battler) struct Sprite *sprite = &gSprites[gBattleSpritesDataPtr->healthBoxesData[battler].shadowSpriteIdSecondary]; sprite->tBattlerId = battler; sprite->tSpriteSide = SPRITE_SIDE_RIGHT; - sprite->oam.tileNum += (8 * size) + 4; + sprite->tBaseTileNum = sprite->oam.tileNum + 4; + sprite->oam.tileNum = sprite->tBaseTileNum + (8 * size); sprite->invisible = TRUE; } } @@ -1179,6 +1183,7 @@ void CreateEnemyShadowSprite(u32 battler) { struct Sprite *sprite = &gSprites[gBattleSpritesDataPtr->healthBoxesData[battler].shadowSpriteIdPrimary]; sprite->tBattlerId = battler; + sprite->tBaseTileNum = sprite->oam.tileNum; sprite->invisible = TRUE; } } @@ -1234,13 +1239,14 @@ void SpriteCB_EnemyShadow(struct Sprite *shadowSprite) return; } - s8 xOffset = 0, yOffset = 0; + s8 xOffset = 0, yOffset = 0, size = SHADOW_SIZE_S; if (gAnimScriptActive || battlerSprite->invisible) invisible = TRUE; else if (transformSpecies != SPECIES_NONE) { xOffset = gSpeciesInfo[transformSpecies].enemyShadowXOffset; yOffset = gSpeciesInfo[transformSpecies].enemyShadowYOffset; + size = gSpeciesInfo[transformSpecies].enemyShadowSize; invisible = (B_ENEMY_MON_SHADOW_STYLE >= GEN_4 && P_GBA_STYLE_SPECIES_GFX == FALSE) ? gSpeciesInfo[transformSpecies].suppressEnemyShadow @@ -1251,6 +1257,7 @@ void SpriteCB_EnemyShadow(struct Sprite *shadowSprite) u16 species = SanitizeSpeciesId(gBattleMons[battler].species); xOffset = gSpeciesInfo[species].enemyShadowXOffset + (shadowSprite->tSpriteSide == SPRITE_SIDE_LEFT ? -16 : 16); yOffset = gSpeciesInfo[species].enemyShadowYOffset + 16; + size = gSpeciesInfo[species].enemyShadowSize; } else { @@ -1264,6 +1271,9 @@ void SpriteCB_EnemyShadow(struct Sprite *shadowSprite) shadowSprite->x2 = battlerSprite->x2; shadowSprite->y = battlerSprite->y + yOffset; shadowSprite->invisible = invisible; + + if (B_ENEMY_MON_SHADOW_STYLE >= GEN_4 && P_GBA_STYLE_SPECIES_GFX == FALSE) + shadowSprite->oam.tileNum = shadowSprite->tBaseTileNum + (8 * size); } #undef tBattlerId