Fix Castfrom ability pop-up and refactor one function
This commit is contained in:
parent
594b363730
commit
aaea5398f4
2 changed files with 74 additions and 122 deletions
|
@ -6257,6 +6257,7 @@ BattleScript_CastformChange::
|
||||||
end3
|
end3
|
||||||
|
|
||||||
BattleScript_82DB4AF::
|
BattleScript_82DB4AF::
|
||||||
|
copybyte gBattlerAbility, sBATTLER
|
||||||
call BattleScript_AbilityPopUp
|
call BattleScript_AbilityPopUp
|
||||||
docastformchangeanimation
|
docastformchangeanimation
|
||||||
waitstate
|
waitstate
|
||||||
|
|
|
@ -505,16 +505,12 @@ bool8 mplay_80342A4(u8 battlerId)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleLoadOpponentMonSpriteGfx(struct Pokemon *mon, u8 battlerId)
|
static void BattleLoadMonSpriteGfx(struct Pokemon *mon, u32 battlerId, bool32 opponent)
|
||||||
{
|
{
|
||||||
u32 monsPersonality, currentPersonality, otId;
|
u32 monsPersonality, currentPersonality, otId, species, paletteOffset, position;
|
||||||
u16 species;
|
|
||||||
u8 position;
|
|
||||||
u16 paletteOffset;
|
|
||||||
const void *lzPaletteData;
|
const void *lzPaletteData;
|
||||||
|
|
||||||
monsPersonality = GetMonData(mon, MON_DATA_PERSONALITY);
|
monsPersonality = GetMonData(mon, MON_DATA_PERSONALITY);
|
||||||
|
|
||||||
if (gBattleSpritesDataPtr->battlerData[battlerId].transformSpecies == SPECIES_NONE)
|
if (gBattleSpritesDataPtr->battlerData[battlerId].transformSpecies == SPECIES_NONE)
|
||||||
{
|
{
|
||||||
species = GetMonData(mon, MON_DATA_SPECIES);
|
species = GetMonData(mon, MON_DATA_SPECIES);
|
||||||
|
@ -528,9 +524,27 @@ void BattleLoadOpponentMonSpriteGfx(struct Pokemon *mon, u8 battlerId)
|
||||||
|
|
||||||
otId = GetMonData(mon, MON_DATA_OT_ID);
|
otId = GetMonData(mon, MON_DATA_OT_ID);
|
||||||
position = GetBattlerPosition(battlerId);
|
position = GetBattlerPosition(battlerId);
|
||||||
HandleLoadSpecialPokePic_DontHandleDeoxys(&gMonFrontPicTable[species],
|
if (opponent)
|
||||||
|
{
|
||||||
|
HandleLoadSpecialPokePic_DontHandleDeoxys(&gMonFrontPicTable[species],
|
||||||
gMonSpritesGfxPtr->sprites[position],
|
gMonSpritesGfxPtr->sprites[position],
|
||||||
species, currentPersonality);
|
species, currentPersonality);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (sub_80688F8(1, battlerId) == 1 || gBattleSpritesDataPtr->battlerData[battlerId].transformSpecies != SPECIES_NONE)
|
||||||
|
{
|
||||||
|
HandleLoadSpecialPokePic_DontHandleDeoxys(&gMonBackPicTable[species],
|
||||||
|
gMonSpritesGfxPtr->sprites[position],
|
||||||
|
species, currentPersonality);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
HandleLoadSpecialPokePic(&gMonBackPicTable[species],
|
||||||
|
gMonSpritesGfxPtr->sprites[position],
|
||||||
|
species, currentPersonality);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
paletteOffset = 0x100 + battlerId * 16;
|
paletteOffset = 0x100 + battlerId * 16;
|
||||||
|
|
||||||
|
@ -558,71 +572,14 @@ void BattleLoadOpponentMonSpriteGfx(struct Pokemon *mon, u8 battlerId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BattleLoadOpponentMonSpriteGfx(struct Pokemon *mon, u8 battlerId)
|
||||||
|
{
|
||||||
|
BattleLoadMonSpriteGfx(mon, battlerId, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
void BattleLoadPlayerMonSpriteGfx(struct Pokemon *mon, u8 battlerId)
|
void BattleLoadPlayerMonSpriteGfx(struct Pokemon *mon, u8 battlerId)
|
||||||
{
|
{
|
||||||
u32 monsPersonality, currentPersonality, otId;
|
BattleLoadMonSpriteGfx(mon, battlerId, FALSE);
|
||||||
u16 species;
|
|
||||||
u8 position;
|
|
||||||
u16 paletteOffset;
|
|
||||||
const void *lzPaletteData;
|
|
||||||
|
|
||||||
monsPersonality = GetMonData(mon, MON_DATA_PERSONALITY);
|
|
||||||
|
|
||||||
if (gBattleSpritesDataPtr->battlerData[battlerId].transformSpecies == SPECIES_NONE)
|
|
||||||
{
|
|
||||||
species = GetMonData(mon, MON_DATA_SPECIES);
|
|
||||||
currentPersonality = monsPersonality;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
species = gBattleSpritesDataPtr->battlerData[battlerId].transformSpecies;
|
|
||||||
currentPersonality = gTransformedPersonalities[battlerId];
|
|
||||||
}
|
|
||||||
|
|
||||||
otId = GetMonData(mon, MON_DATA_OT_ID);
|
|
||||||
position = GetBattlerPosition(battlerId);
|
|
||||||
|
|
||||||
if (sub_80688F8(1, battlerId) == 1 || gBattleSpritesDataPtr->battlerData[battlerId].transformSpecies != SPECIES_NONE)
|
|
||||||
{
|
|
||||||
HandleLoadSpecialPokePic_DontHandleDeoxys(&gMonBackPicTable[species],
|
|
||||||
gMonSpritesGfxPtr->sprites[position],
|
|
||||||
species, currentPersonality);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
HandleLoadSpecialPokePic(&gMonBackPicTable[species],
|
|
||||||
gMonSpritesGfxPtr->sprites[position],
|
|
||||||
species, currentPersonality);
|
|
||||||
}
|
|
||||||
|
|
||||||
paletteOffset = 0x100 + battlerId * 16;
|
|
||||||
|
|
||||||
if (gBattleSpritesDataPtr->battlerData[battlerId].transformSpecies == SPECIES_NONE)
|
|
||||||
lzPaletteData = GetMonFrontSpritePal(mon);
|
|
||||||
else
|
|
||||||
lzPaletteData = GetFrontSpritePalFromSpeciesAndPersonality(species, otId, monsPersonality);
|
|
||||||
|
|
||||||
LZDecompressWram(lzPaletteData, gDecompressionBuffer);
|
|
||||||
LoadPalette(gDecompressionBuffer, paletteOffset, 0x20);
|
|
||||||
LoadPalette(gDecompressionBuffer, 0x80 + battlerId * 16, 0x20);
|
|
||||||
|
|
||||||
if (species == SPECIES_CASTFORM)
|
|
||||||
{
|
|
||||||
paletteOffset = 0x100 + battlerId * 16;
|
|
||||||
LZDecompressWram(lzPaletteData, gBattleStruct->castformPalette[0]);
|
|
||||||
LoadPalette(gBattleStruct->castformPalette[gBattleMonForms[battlerId]], paletteOffset, 0x20);
|
|
||||||
}
|
|
||||||
|
|
||||||
// transform's pink color
|
|
||||||
if (gBattleSpritesDataPtr->battlerData[battlerId].transformSpecies != SPECIES_NONE)
|
|
||||||
{
|
|
||||||
BlendPalette(paletteOffset, 16, 6, RGB_WHITE);
|
|
||||||
CpuCopy32(gPlttBufferFaded + paletteOffset, gPlttBufferUnfaded + paletteOffset, 32);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void nullsub_23(void)
|
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void nullsub_24(u16 species)
|
void nullsub_24(u16 species)
|
||||||
|
@ -849,11 +806,52 @@ void CopyBattleSpriteInvisibility(u8 battlerId)
|
||||||
|
|
||||||
void HandleSpeciesGfxDataChange(u8 battlerAtk, u8 battlerDef, bool8 notTransform, bool32 megaEvo)
|
void HandleSpeciesGfxDataChange(u8 battlerAtk, u8 battlerDef, bool8 notTransform, bool32 megaEvo)
|
||||||
{
|
{
|
||||||
u16 paletteOffset;
|
u32 personalityValue, otId, position, paletteOffset, targetSpecies;
|
||||||
u32 personalityValue;
|
const void *lzPaletteData, *src;
|
||||||
u32 otId;
|
void *dst;
|
||||||
u8 position;
|
|
||||||
const u32 *lzPaletteData;
|
if (IsContest())
|
||||||
|
{
|
||||||
|
position = 0;
|
||||||
|
targetSpecies = gContestResources->field_18->unk2;
|
||||||
|
personalityValue = gContestResources->field_18->unk8;
|
||||||
|
otId = gContestResources->field_18->unkC;
|
||||||
|
|
||||||
|
HandleLoadSpecialPokePic_DontHandleDeoxys(&gMonBackPicTable[targetSpecies],
|
||||||
|
gMonSpritesGfxPtr->sprites[0],
|
||||||
|
targetSpecies,
|
||||||
|
gContestResources->field_18->unk10);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
position = GetBattlerPosition(battlerAtk);
|
||||||
|
|
||||||
|
if (GetBattlerSide(battlerDef) == B_SIDE_OPPONENT)
|
||||||
|
targetSpecies = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerDef]], MON_DATA_SPECIES);
|
||||||
|
else
|
||||||
|
targetSpecies = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerDef]], MON_DATA_SPECIES);
|
||||||
|
|
||||||
|
if (GetBattlerSide(battlerAtk) == B_SIDE_PLAYER)
|
||||||
|
{
|
||||||
|
personalityValue = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerAtk]], MON_DATA_PERSONALITY);
|
||||||
|
otId = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerAtk]], MON_DATA_OT_ID);
|
||||||
|
|
||||||
|
HandleLoadSpecialPokePic_DontHandleDeoxys(&gMonBackPicTable[targetSpecies],
|
||||||
|
gMonSpritesGfxPtr->sprites[position],
|
||||||
|
targetSpecies,
|
||||||
|
gTransformedPersonalities[battlerAtk]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
personalityValue = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerAtk]], MON_DATA_PERSONALITY);
|
||||||
|
otId = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerAtk]], MON_DATA_OT_ID);
|
||||||
|
|
||||||
|
HandleLoadSpecialPokePic_DontHandleDeoxys(&gMonFrontPicTable[targetSpecies],
|
||||||
|
gMonSpritesGfxPtr->sprites[position],
|
||||||
|
targetSpecies,
|
||||||
|
gTransformedPersonalities[battlerAtk]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (notTransform)
|
if (notTransform)
|
||||||
{
|
{
|
||||||
|
@ -870,53 +868,6 @@ void HandleSpeciesGfxDataChange(u8 battlerAtk, u8 battlerDef, bool8 notTransform
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const void *src;
|
|
||||||
void *dst;
|
|
||||||
u16 targetSpecies;
|
|
||||||
|
|
||||||
if (IsContest())
|
|
||||||
{
|
|
||||||
position = 0;
|
|
||||||
targetSpecies = gContestResources->field_18->unk2;
|
|
||||||
personalityValue = gContestResources->field_18->unk8;
|
|
||||||
otId = gContestResources->field_18->unkC;
|
|
||||||
|
|
||||||
HandleLoadSpecialPokePic_DontHandleDeoxys(&gMonBackPicTable[targetSpecies],
|
|
||||||
gMonSpritesGfxPtr->sprites[0],
|
|
||||||
targetSpecies,
|
|
||||||
gContestResources->field_18->unk10);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
position = GetBattlerPosition(battlerAtk);
|
|
||||||
|
|
||||||
if (GetBattlerSide(battlerDef) == B_SIDE_OPPONENT)
|
|
||||||
targetSpecies = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerDef]], MON_DATA_SPECIES);
|
|
||||||
else
|
|
||||||
targetSpecies = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerDef]], MON_DATA_SPECIES);
|
|
||||||
|
|
||||||
if (GetBattlerSide(battlerAtk) == B_SIDE_PLAYER)
|
|
||||||
{
|
|
||||||
personalityValue = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerAtk]], MON_DATA_PERSONALITY);
|
|
||||||
otId = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerAtk]], MON_DATA_OT_ID);
|
|
||||||
|
|
||||||
HandleLoadSpecialPokePic_DontHandleDeoxys(&gMonBackPicTable[targetSpecies],
|
|
||||||
gMonSpritesGfxPtr->sprites[position],
|
|
||||||
targetSpecies,
|
|
||||||
gTransformedPersonalities[battlerAtk]);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
personalityValue = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerAtk]], MON_DATA_PERSONALITY);
|
|
||||||
otId = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerAtk]], MON_DATA_OT_ID);
|
|
||||||
|
|
||||||
HandleLoadSpecialPokePic_DontHandleDeoxys(&gMonFrontPicTable[targetSpecies],
|
|
||||||
gMonSpritesGfxPtr->sprites[position],
|
|
||||||
targetSpecies,
|
|
||||||
gTransformedPersonalities[battlerAtk]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
src = gMonSpritesGfxPtr->sprites[position];
|
src = gMonSpritesGfxPtr->sprites[position];
|
||||||
dst = (void *)(VRAM + 0x10000 + gSprites[gBattlerSpriteIds[battlerAtk]].oam.tileNum * 32);
|
dst = (void *)(VRAM + 0x10000 + gSprites[gBattlerSpriteIds[battlerAtk]].oam.tileNum * 32);
|
||||||
DmaCopy32(3, src, dst, 0x800);
|
DmaCopy32(3, src, dst, 0x800);
|
||||||
|
|
Loading…
Reference in a new issue