mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-11-16 19:47:35 +01:00
Change Mega evo sprites from 3per battler to 1 per battler (#3087)
This commit is contained in:
commit
a0ad8c817c
@ -196,8 +196,8 @@ static void SpriteCB_StatusSummaryBalls_OnSwitchout(struct Sprite *);
|
||||
static void SpriteCb_MegaTrigger(struct Sprite *);
|
||||
static void MegaIndicator_SetVisibilities(u32 healthboxId, bool32 invisible);
|
||||
static void MegaIndicator_UpdateLevel(u32 healthboxId, u32 level);
|
||||
static void MegaIndicator_CreateSprites(u32 battlerId, u32 healthboxSpriteId);
|
||||
static void MegaIndicator_UpdateOamPriorities(u32 healthboxId, u32 oamPriority);
|
||||
static void MegaIndicator_CreateSprite(u32 battlerId, u32 healthboxSpriteId);
|
||||
static void MegaIndicator_UpdateOamPriority(u32 healthboxId, u32 oamPriority);
|
||||
static void SpriteCb_MegaIndicator(struct Sprite *);
|
||||
|
||||
static u8 GetStatusIconForBattlerId(u8, u8);
|
||||
@ -683,7 +683,7 @@ static const struct SpriteTemplate sSpriteTemplate_MegaTrigger =
|
||||
|
||||
// data fields for healthboxMain
|
||||
// oam.affineParam holds healthboxRight spriteId
|
||||
#define hMain_MegaIndicatorIds data[3] // Mega, Alpha, Omega as u8 in data[3], data[3] + 1, data[4]
|
||||
#define hMain_MegaIndicatorId data[3]
|
||||
#define hMain_HealthBarSpriteId data[5]
|
||||
#define hMain_Battler data[6]
|
||||
#define hMain_Data7 data[7]
|
||||
@ -798,8 +798,8 @@ u8 CreateBattlerHealthboxSprites(u8 battlerId)
|
||||
healthBarSpritePtr->hBar_Data6 = data6;
|
||||
healthBarSpritePtr->invisible = TRUE;
|
||||
|
||||
// Create mega indicator sprites.
|
||||
MegaIndicator_CreateSprites(battlerId, healthboxLeftSpriteId);
|
||||
// Create mega indicator sprite.
|
||||
MegaIndicator_CreateSprite(battlerId, healthboxLeftSpriteId);
|
||||
|
||||
gBattleStruct->ballSpriteIds[0] = MAX_SPRITES;
|
||||
gBattleStruct->ballSpriteIds[1] = MAX_SPRITES;
|
||||
@ -934,7 +934,7 @@ void UpdateOamPriorityInAllHealthboxes(u8 priority, bool32 hideHPBoxes)
|
||||
gSprites[healthboxRightSpriteId].oam.priority = priority;
|
||||
gSprites[healthbarSpriteId].oam.priority = priority;
|
||||
|
||||
MegaIndicator_UpdateOamPriorities(healthboxLeftSpriteId, priority);
|
||||
MegaIndicator_UpdateOamPriority(healthboxLeftSpriteId, priority);
|
||||
|
||||
#if B_HIDE_HEALTHBOX_IN_ANIMS
|
||||
if (hideHPBoxes && IsBattlerAlive(i))
|
||||
@ -1509,77 +1509,72 @@ void MegaIndicator_LoadSpritesGfx(void)
|
||||
LoadSpritePalettes(sMegaIndicator_SpritePalettes);
|
||||
}
|
||||
|
||||
static bool32 MegaIndicator_ShouldBeInvisible(u32 battlerId, u32 indicatorType)
|
||||
static bool32 MegaIndicator_ShouldBeInvisible(u32 battlerId, struct Sprite *sprite)
|
||||
{
|
||||
u32 side = GetBattlerSide(battlerId);
|
||||
if (indicatorType == INDICATOR_MEGA)
|
||||
{
|
||||
if (IsBattlerMegaEvolved(battlerId))
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (indicatorType == INDICATOR_ALPHA && gBattleMons[battlerId].species != SPECIES_KYOGRE_PRIMAL)
|
||||
return TRUE;
|
||||
else if (indicatorType == INDICATOR_OMEGA && gBattleMons[battlerId].species != SPECIES_GROUDON_PRIMAL)
|
||||
return TRUE;
|
||||
if (IsBattlerPrimalReverted(battlerId))
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
bool32 megaEvolved = IsBattlerMegaEvolved(battlerId);
|
||||
bool32 primalReverted = IsBattlerPrimalReverted(battlerId);
|
||||
|
||||
if (!megaEvolved && !primalReverted)
|
||||
return TRUE;
|
||||
|
||||
if (megaEvolved)
|
||||
sprite->tType = INDICATOR_MEGA;
|
||||
else if (primalReverted && gBattleMons[battlerId].species == SPECIES_KYOGRE_PRIMAL)
|
||||
sprite->tType = INDICATOR_ALPHA;
|
||||
else if (primalReverted && gBattleMons[battlerId].species == SPECIES_GROUDON_PRIMAL)
|
||||
sprite->tType = INDICATOR_OMEGA;
|
||||
|
||||
sprite->oam.tileNum = GetSpriteTileStartByTag(sMegaIndicatorTags[sprite->tType][0]);
|
||||
sprite->oam.paletteNum = IndexOfSpritePaletteTag(sMegaIndicatorTags[sprite->tType][1]);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static u8 *MegaIndicator_GetSpriteIds(u32 healthboxSpriteId)
|
||||
static u8 *MegaIndicator_GetSpriteId(u32 healthboxSpriteId)
|
||||
{
|
||||
u8 *spriteIds = (u8 *)(&gSprites[healthboxSpriteId].hMain_MegaIndicatorIds);
|
||||
return spriteIds;
|
||||
u8 *spriteId = (u8 *)(&gSprites[healthboxSpriteId].hMain_MegaIndicatorId);
|
||||
return spriteId;
|
||||
}
|
||||
|
||||
void MegaIndicator_SetVisibilities(u32 healthboxId, bool32 invisible)
|
||||
{
|
||||
u32 i;
|
||||
u8 *spriteIds = MegaIndicator_GetSpriteIds(healthboxId);
|
||||
u8 *spriteId = MegaIndicator_GetSpriteId(healthboxId);
|
||||
u32 battlerId = gSprites[healthboxId].hMain_Battler;
|
||||
|
||||
if (GetSafariZoneFlag())
|
||||
return;
|
||||
|
||||
for (i = 0; i < INDICATOR_COUNT; i++)
|
||||
{
|
||||
if (invisible == TRUE)
|
||||
gSprites[spriteIds[i]].invisible = TRUE;
|
||||
else // Try visible.
|
||||
gSprites[spriteIds[i]].invisible = MegaIndicator_ShouldBeInvisible(battlerId, i);
|
||||
}
|
||||
if (invisible == TRUE)
|
||||
gSprites[*spriteId].invisible = TRUE;
|
||||
else // Try visible.
|
||||
gSprites[*spriteId].invisible = MegaIndicator_ShouldBeInvisible(battlerId, &gSprites[*spriteId]);
|
||||
}
|
||||
|
||||
static void MegaIndicator_UpdateOamPriorities(u32 healthboxId, u32 oamPriority)
|
||||
static void MegaIndicator_UpdateOamPriority(u32 healthboxId, u32 oamPriority)
|
||||
{
|
||||
u32 i;
|
||||
u8 *spriteIds = MegaIndicator_GetSpriteIds(healthboxId);
|
||||
for (i = 0; i < INDICATOR_COUNT; i++)
|
||||
gSprites[spriteIds[i]].oam.priority = oamPriority;
|
||||
u8 *spriteId = MegaIndicator_GetSpriteId(healthboxId);
|
||||
gSprites[*spriteId].oam.priority = oamPriority;
|
||||
}
|
||||
|
||||
static void MegaIndicator_UpdateLevel(u32 healthboxId, u32 level)
|
||||
{
|
||||
u32 i;
|
||||
s16 xDelta = 0;
|
||||
u8 *spriteIds = MegaIndicator_GetSpriteIds(healthboxId);
|
||||
u8 *spriteId = MegaIndicator_GetSpriteId(healthboxId);
|
||||
|
||||
if (level >= 100)
|
||||
xDelta -= 4;
|
||||
else if (level < 10)
|
||||
xDelta += 5;
|
||||
|
||||
for (i = 0; i < INDICATOR_COUNT; i++)
|
||||
gSprites[spriteIds[i]].tLevelXDelta = xDelta;
|
||||
gSprites[*spriteId].tLevelXDelta = xDelta;
|
||||
}
|
||||
|
||||
static void MegaIndicator_CreateSprites(u32 battlerId, u32 healthboxSpriteId)
|
||||
static void MegaIndicator_CreateSprite(u32 battlerId, u32 healthboxSpriteId)
|
||||
{
|
||||
u32 position, i, level;
|
||||
u8 *spriteIds;
|
||||
struct SpriteTemplate sprTemplate;
|
||||
u32 position, level;
|
||||
u8 *spriteId;
|
||||
s16 xHealthbox = 0, y = 0;
|
||||
s32 x = 0;
|
||||
|
||||
@ -1589,18 +1584,15 @@ static void MegaIndicator_CreateSprites(u32 battlerId, u32 healthboxSpriteId)
|
||||
x = sIndicatorPositions[position][0];
|
||||
y += sIndicatorPositions[position][1];
|
||||
|
||||
spriteIds = MegaIndicator_GetSpriteIds(healthboxSpriteId);
|
||||
for (i = 0; i < INDICATOR_COUNT; i++)
|
||||
{
|
||||
struct SpriteTemplate sprTemplate = sSpriteTemplate_MegaIndicator;
|
||||
sprTemplate.tileTag = sMegaIndicatorTags[i][0];
|
||||
sprTemplate.paletteTag = sMegaIndicatorTags[i][1];
|
||||
spriteIds[i] = CreateSpriteAtEnd(&sprTemplate, 0, y, 0);
|
||||
gSprites[spriteIds[i]].tType = i;
|
||||
gSprites[spriteIds[i]].tBattler = battlerId;
|
||||
gSprites[spriteIds[i]].tPosX = x;
|
||||
gSprites[spriteIds[i]].invisible = TRUE;
|
||||
}
|
||||
spriteId = MegaIndicator_GetSpriteId(healthboxSpriteId);
|
||||
sprTemplate = sSpriteTemplate_MegaIndicator;
|
||||
sprTemplate.tileTag = sMegaIndicatorTags[INDICATOR_MEGA][0];
|
||||
sprTemplate.paletteTag = sMegaIndicatorTags[INDICATOR_MEGA][1];
|
||||
*spriteId = CreateSpriteAtEnd(&sprTemplate, 0, y, 0);
|
||||
gSprites[*spriteId].tType = INDICATOR_MEGA;
|
||||
gSprites[*spriteId].tBattler = battlerId;
|
||||
gSprites[*spriteId].tPosX = x;
|
||||
gSprites[*spriteId].invisible = TRUE;
|
||||
}
|
||||
|
||||
static void SpriteCb_MegaIndicator(struct Sprite *sprite)
|
||||
|
Loading…
Reference in New Issue
Block a user