Fixed multiple transform/form change graphical issues (#6005)
This commit is contained in:
parent
28561bca4a
commit
15a034a1d9
@ -478,9 +478,10 @@
|
||||
.byte \battler
|
||||
.endm
|
||||
|
||||
.macro switchinanim battler:req, dontClearSubstitute:req
|
||||
.macro switchinanim battler:req, dontClearTransform:req, dontClearSubstitute:req
|
||||
.byte 0x4e
|
||||
.byte \battler
|
||||
.byte \dontClearTransform
|
||||
.byte \dontClearSubstitute
|
||||
.endm
|
||||
|
||||
|
||||
@ -322,7 +322,7 @@ BattleScript_MoveSwitchOpenPartyScreen:
|
||||
printstring STRINGID_EMPTYSTRING3
|
||||
waitmessage 1
|
||||
printstring STRINGID_SWITCHINMON
|
||||
switchinanim BS_ATTACKER, TRUE
|
||||
switchinanim BS_ATTACKER, FALSE, TRUE
|
||||
waitstate
|
||||
switchineffects BS_ATTACKER
|
||||
BattleScript_MoveSwitchEnd:
|
||||
@ -469,7 +469,7 @@ BattleScript_EffectRevivalBlessingSendOut:
|
||||
getswitchedmondata BS_SCRIPTING
|
||||
switchindataupdate BS_SCRIPTING
|
||||
hpthresholds BS_SCRIPTING
|
||||
switchinanim BS_SCRIPTING, FALSE
|
||||
switchinanim BS_SCRIPTING, FALSE, FALSE
|
||||
waitstate
|
||||
switchineffects BS_SCRIPTING
|
||||
goto BattleScript_MoveEnd
|
||||
@ -2390,7 +2390,7 @@ BattleScript_EffectHealingWish::
|
||||
trytoclearprimalweather
|
||||
flushtextbox
|
||||
printstring STRINGID_SWITCHINMON
|
||||
switchinanim BS_ATTACKER, TRUE
|
||||
switchinanim BS_ATTACKER, FALSE, TRUE
|
||||
waitstate
|
||||
switchineffects BS_ATTACKER
|
||||
.endif
|
||||
@ -4386,7 +4386,7 @@ BattleScript_EffectBatonPass::
|
||||
trytoclearprimalweather
|
||||
flushtextbox
|
||||
printstring STRINGID_SWITCHINMON
|
||||
switchinanim BS_ATTACKER, TRUE
|
||||
switchinanim BS_ATTACKER, FALSE, TRUE
|
||||
waitstate
|
||||
switchineffects BS_ATTACKER
|
||||
goto BattleScript_MoveEnd
|
||||
@ -5492,7 +5492,7 @@ BattleScript_FaintedMonTryChoose:
|
||||
flushtextbox
|
||||
printstring STRINGID_SWITCHINMON
|
||||
hidepartystatussummary BS_ATTACKER
|
||||
switchinanim BS_ATTACKER, 0
|
||||
switchinanim BS_ATTACKER, FALSE, FALSE
|
||||
waitstate
|
||||
setbyte sSHIFT_SWITCHED, 1
|
||||
BattleScript_FaintedMonSendOutNew:
|
||||
@ -5504,7 +5504,7 @@ BattleScript_FaintedMonSendOutNew:
|
||||
flushtextbox
|
||||
printstring STRINGID_SWITCHINMON
|
||||
hidepartystatussummary BS_FAINTED
|
||||
switchinanim BS_FAINTED, FALSE
|
||||
switchinanim BS_FAINTED, FALSE, FALSE
|
||||
waitstate
|
||||
resetplayerfainted
|
||||
trytrainerslidelastonmsg BS_FAINTED
|
||||
@ -5538,7 +5538,7 @@ BattleScript_HandleFaintedMonLoop::
|
||||
flushtextbox
|
||||
printstring STRINGID_SWITCHINMON
|
||||
hidepartystatussummary BS_FAINTED
|
||||
switchinanim BS_FAINTED, FALSE
|
||||
switchinanim BS_FAINTED, FALSE, FALSE
|
||||
waitstate
|
||||
switchineffects BS_FAINTED_MULTIPLE_1
|
||||
jumpifbytenotequal gBattlerFainted, gBattlersCount, BattleScript_HandleFaintedMonLoop
|
||||
@ -5763,7 +5763,7 @@ BattleScript_DoSwitchOut::
|
||||
flushtextbox
|
||||
printstring STRINGID_SWITCHINMON
|
||||
hidepartystatussummary BS_ATTACKER
|
||||
switchinanim BS_ATTACKER, FALSE
|
||||
switchinanim BS_ATTACKER, FALSE, FALSE
|
||||
waitstate
|
||||
switchineffects BS_ATTACKER
|
||||
moveendcase MOVEEND_STATUS_IMMUNITY_ABILITIES
|
||||
@ -6080,7 +6080,7 @@ BattleScript_RoarSuccessSwitch::
|
||||
switchindataupdate BS_TARGET
|
||||
trytoclearprimalweather
|
||||
flushtextbox
|
||||
switchinanim BS_TARGET, FALSE
|
||||
switchinanim BS_TARGET, FALSE, FALSE
|
||||
waitstate
|
||||
printstring STRINGID_PKMNWASDRAGGEDOUT
|
||||
switchineffects BS_TARGET
|
||||
@ -7648,7 +7648,7 @@ BattleScript_EmergencyExitNoPopUp::
|
||||
switchindataupdate BS_TARGET
|
||||
hpthresholds BS_TARGET
|
||||
printstring STRINGID_SWITCHINMON
|
||||
switchinanim BS_TARGET, TRUE
|
||||
switchinanim BS_TARGET, FALSE, TRUE
|
||||
waitstate
|
||||
switchineffects BS_TARGET
|
||||
BattleScript_EmergencyExitRet:
|
||||
@ -9617,7 +9617,7 @@ BattleScript_EjectButtonActivates::
|
||||
trytoclearprimalweather
|
||||
flushtextbox
|
||||
printstring 0x3
|
||||
switchinanim BS_SCRIPTING 0x1
|
||||
switchinanim BS_SCRIPTING, FALSE, TRUE
|
||||
waitstate
|
||||
switchineffects BS_SCRIPTING
|
||||
BattleScript_EjectButtonEnd:
|
||||
@ -9981,7 +9981,7 @@ BattleScript_DynamaxBegins::
|
||||
returnatktoball
|
||||
pause B_WAIT_TIME_SHORT
|
||||
returntoball BS_SCRIPTING, TRUE
|
||||
switchinanim BS_SCRIPTING, TRUE
|
||||
switchinanim BS_SCRIPTING, TRUE, TRUE
|
||||
updatedynamax
|
||||
playanimation BS_SCRIPTING, B_ANIM_DYNAMAX_GROWTH
|
||||
waitanimation
|
||||
|
||||
@ -75,7 +75,7 @@ BattleScript_ItemRestoreHP_Party::
|
||||
return
|
||||
|
||||
BattleScript_ItemRestoreHP_SendOutRevivedBattler:
|
||||
switchinanim BS_SCRIPTING, FALSE
|
||||
switchinanim BS_SCRIPTING, FALSE, FALSE
|
||||
waitstate
|
||||
switchineffects BS_SCRIPTING
|
||||
end
|
||||
|
||||
@ -210,7 +210,7 @@ void PrepareBufferDataTransferLink(u32 battler, u32 bufferId, u16 size, u8 *data
|
||||
void BtlController_EmitGetMonData(u32 battler, u32 bufferId, u8 requestId, u8 monToCheck);
|
||||
void BtlController_EmitSetMonData(u32 battler, u32 bufferId, u8 requestId, u8 monToCheck, u8 bytes, void *data);
|
||||
void BtlController_EmitLoadMonSprite(u32 battler, u32 bufferId);
|
||||
void BtlController_EmitSwitchInAnim(u32 battler, u32 bufferId, u8 partyId, bool8 dontClearSubstituteBit);
|
||||
void BtlController_EmitSwitchInAnim(u32 battler, u32 bufferId, u8 partyId, bool8 dontClearTransform, bool8 dontClearSubstituteBit);
|
||||
void BtlController_EmitReturnMonToBall(u32 battler, u32 bufferId, bool8 skipAnim);
|
||||
void BtlController_EmitDrawTrainerPic(u32 battler, u32 bufferId);
|
||||
void BtlController_EmitTrainerSlide(u32 battler, u32 bufferId);
|
||||
@ -255,7 +255,7 @@ void BattleControllerComplete(u32 battler); // Can be used for all the controlle
|
||||
void BtlController_Empty(u32 battler); // Empty command, does nothing, only completes the execution.
|
||||
void BtlController_TerminatorNop(u32 battler); // Dummy function at the end of the table.
|
||||
void BattleControllerDummy(u32 battler);
|
||||
void StartSendOutAnim(u32 battler, bool32 dontClearSubstituteBit, bool32 doSlideIn);
|
||||
void StartSendOutAnim(u32 battler, bool32 dontClearTransform, bool32 dontClearSubstituteBit, bool32 doSlideIn);
|
||||
void Controller_WaitForString(u32 battler);
|
||||
void Controller_WaitForHealthBar(u32 battler);
|
||||
|
||||
|
||||
@ -38,7 +38,7 @@ void SpriteCB_SetInvisible(struct Sprite *sprite);
|
||||
void SetBattlerShadowSpriteCallback(u8 battler, u16 species);
|
||||
void HideBattlerShadowSprite(u8 battler);
|
||||
void FillAroundBattleWindows(void);
|
||||
void ClearTemporarySpeciesSpriteData(u8 battler, bool8 dontClearSubstitute);
|
||||
void ClearTemporarySpeciesSpriteData(u32 battler, bool32 dontClearTransform, bool32 dontClearSubstitute);
|
||||
void AllocateMonSpritesGfx(void);
|
||||
void FreeMonSpritesGfx(void);
|
||||
bool32 ShouldPlayNormalMonCry(struct Pokemon *mon);
|
||||
|
||||
@ -824,6 +824,7 @@ u8 GetItemEffectParamOffset(u32 battler, u16 itemId, u8 effectByte, u8 effectBit
|
||||
u8 *UseStatIncreaseItem(u16 itemId);
|
||||
u8 GetNature(struct Pokemon *mon);
|
||||
u8 GetNatureFromPersonality(u32 personality);
|
||||
u32 GetGMaxTargetSpecies(u32 species);
|
||||
u16 GetEvolutionTargetSpecies(struct Pokemon *mon, enum EvolutionMode mode, u16 evolutionItem, struct Pokemon *tradePartner);
|
||||
bool8 IsMonPastEvolutionLevel(struct Pokemon *mon);
|
||||
u16 NationalPokedexNumToSpecies(u16 nationalNum);
|
||||
|
||||
@ -2117,24 +2117,26 @@ s16 GetBattlerSpriteCoordAttr(u8 battlerId, u8 attr)
|
||||
}
|
||||
else
|
||||
{
|
||||
struct Pokemon *mon = GetPartyBattlerData(battlerId);
|
||||
|
||||
spriteInfo = gBattleSpritesDataPtr->battlerData;
|
||||
if (!spriteInfo[battlerId].transformSpecies)
|
||||
{
|
||||
species = GetMonData(mon, MON_DATA_SPECIES);
|
||||
personality = GetMonData(mon, MON_DATA_PERSONALITY);
|
||||
}
|
||||
else
|
||||
{
|
||||
species = spriteInfo[battlerId].transformSpecies;
|
||||
personality = gTransformedPersonalities[battlerId];
|
||||
}
|
||||
|
||||
species = SanitizeSpeciesId(species);
|
||||
if (species == SPECIES_UNOWN)
|
||||
species = GetUnownSpeciesId(personality);
|
||||
|
||||
if (GetBattlerSide(battlerId) == B_SIDE_PLAYER)
|
||||
{
|
||||
spriteInfo = gBattleSpritesDataPtr->battlerData;
|
||||
if (!spriteInfo[battlerId].transformSpecies)
|
||||
{
|
||||
species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES);
|
||||
personality = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_PERSONALITY);
|
||||
}
|
||||
else
|
||||
{
|
||||
species = spriteInfo[battlerId].transformSpecies;
|
||||
personality = gTransformedPersonalities[battlerId];
|
||||
}
|
||||
|
||||
species = SanitizeSpeciesId(species);
|
||||
if (species == SPECIES_UNOWN)
|
||||
species = GetUnownSpeciesId(personality);
|
||||
|
||||
#if P_GENDER_DIFFERENCES
|
||||
if (gSpeciesInfo[species].backPicFemale != NULL && IsPersonalityFemale(species, personality))
|
||||
size = gSpeciesInfo[species].backPicSizeFemale;
|
||||
@ -2146,22 +2148,6 @@ s16 GetBattlerSpriteCoordAttr(u8 battlerId, u8 attr)
|
||||
}
|
||||
else
|
||||
{
|
||||
spriteInfo = gBattleSpritesDataPtr->battlerData;
|
||||
if (!spriteInfo[battlerId].transformSpecies)
|
||||
{
|
||||
species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES);
|
||||
personality = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerId]], MON_DATA_PERSONALITY);
|
||||
}
|
||||
else
|
||||
{
|
||||
species = spriteInfo[battlerId].transformSpecies;
|
||||
personality = gTransformedPersonalities[battlerId];
|
||||
}
|
||||
|
||||
species = SanitizeSpeciesId(species);
|
||||
if (species == SPECIES_UNOWN)
|
||||
species = GetUnownSpeciesId(personality);
|
||||
|
||||
#if P_GENDER_DIFFERENCES
|
||||
if (gSpeciesInfo[species].frontPicFemale != NULL && IsPersonalityFemale(species, personality))
|
||||
size = gSpeciesInfo[species].frontPicSizeFemale;
|
||||
|
||||
@ -976,12 +976,12 @@ void BtlController_EmitLoadMonSprite(u32 battler, u32 bufferId)
|
||||
PrepareBufferDataTransfer(battler, bufferId, gBattleResources->transferBuffer, 4);
|
||||
}
|
||||
|
||||
void BtlController_EmitSwitchInAnim(u32 battler, u32 bufferId, u8 partyId, bool8 dontClearSubstituteBit)
|
||||
void BtlController_EmitSwitchInAnim(u32 battler, u32 bufferId, u8 partyId, bool8 dontClearTransform, bool8 dontClearSubstituteBit)
|
||||
{
|
||||
gBattleResources->transferBuffer[0] = CONTROLLER_SWITCHINANIM;
|
||||
gBattleResources->transferBuffer[1] = partyId;
|
||||
gBattleResources->transferBuffer[2] = dontClearSubstituteBit;
|
||||
gBattleResources->transferBuffer[3] = 5;
|
||||
gBattleResources->transferBuffer[2] = dontClearTransform;
|
||||
gBattleResources->transferBuffer[3] = dontClearSubstituteBit;
|
||||
PrepareBufferDataTransfer(battler, bufferId, gBattleResources->transferBuffer, 4);
|
||||
}
|
||||
|
||||
@ -2111,13 +2111,13 @@ static bool8 ShouldDoSlideInAnim(void)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void StartSendOutAnim(u32 battler, bool32 dontClearSubstituteBit, bool32 doSlideIn)
|
||||
void StartSendOutAnim(u32 battler, bool32 dontClearTransform, bool32 dontClearSubstituteBit, bool32 doSlideIn)
|
||||
{
|
||||
u16 species;
|
||||
u32 side = GetBattlerSide(battler);
|
||||
struct Pokemon *party = GetBattlerParty(battler);
|
||||
|
||||
ClearTemporarySpeciesSpriteData(battler, dontClearSubstituteBit);
|
||||
ClearTemporarySpeciesSpriteData(battler, dontClearTransform, dontClearSubstituteBit);
|
||||
gBattlerPartyIndexes[battler] = gBattleResources->bufferA[battler][1];
|
||||
species = GetIllusionMonSpecies(battler);
|
||||
if (species == SPECIES_NONE)
|
||||
@ -2462,11 +2462,11 @@ void BtlController_HandleLoadMonSprite(u32 battler, void (*controllerCallback)(u
|
||||
void BtlController_HandleSwitchInAnim(u32 battler, bool32 isPlayerSide, void (*controllerCallback)(u32 battler))
|
||||
{
|
||||
if (isPlayerSide)
|
||||
ClearTemporarySpeciesSpriteData(battler, gBattleResources->bufferA[battler][2]);
|
||||
ClearTemporarySpeciesSpriteData(battler, gBattleResources->bufferA[battler][2], gBattleResources->bufferA[battler][3]);
|
||||
gBattlerPartyIndexes[battler] = gBattleResources->bufferA[battler][1];
|
||||
if (isPlayerSide)
|
||||
BattleLoadMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[battler]], battler);
|
||||
StartSendOutAnim(battler, gBattleResources->bufferA[battler][2], FALSE);
|
||||
StartSendOutAnim(battler, gBattleResources->bufferA[battler][2], gBattleResources->bufferA[battler][3], FALSE);
|
||||
gBattlerControllerFuncs[battler] = controllerCallback;
|
||||
}
|
||||
|
||||
@ -2965,17 +2965,17 @@ static void Task_StartSendOutAnim(u8 taskId)
|
||||
if (TwoMonsAtSendOut(battler))
|
||||
{
|
||||
gBattleResources->bufferA[battler][1] = gBattlerPartyIndexes[battler];
|
||||
StartSendOutAnim(battler, FALSE, ShouldDoSlideInAnim());
|
||||
StartSendOutAnim(battler, FALSE, FALSE, ShouldDoSlideInAnim());
|
||||
|
||||
battlerPartner = battler ^ BIT_FLANK;
|
||||
gBattleResources->bufferA[battlerPartner][1] = gBattlerPartyIndexes[battlerPartner];
|
||||
BattleLoadMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[battlerPartner]], battlerPartner);
|
||||
StartSendOutAnim(battlerPartner, FALSE, ShouldDoSlideInAnim());
|
||||
StartSendOutAnim(battlerPartner, FALSE, FALSE, ShouldDoSlideInAnim());
|
||||
}
|
||||
else
|
||||
{
|
||||
gBattleResources->bufferA[battler][1] = gBattlerPartyIndexes[battler];
|
||||
StartSendOutAnim(battler, FALSE, ShouldDoSlideInAnim());
|
||||
StartSendOutAnim(battler, FALSE, FALSE, ShouldDoSlideInAnim());
|
||||
}
|
||||
gBattlerControllerFuncs[battler] = (void*)(GetWordTaskArg(taskId, tControllerFunc_1));
|
||||
DestroyTask(taskId);
|
||||
|
||||
@ -609,7 +609,7 @@ bool8 IsBattleSEPlaying(u8 battler)
|
||||
|
||||
void BattleLoadMonSpriteGfx(struct Pokemon *mon, u32 battler)
|
||||
{
|
||||
u32 monsPersonality, currentPersonality, isShiny, species, paletteOffset, position;
|
||||
u32 personalityValue, isShiny, species, paletteOffset, position;
|
||||
const void *lzPaletteData;
|
||||
struct Pokemon *illusionMon = GetIllusionMonPtr(battler);
|
||||
if (illusionMon != NULL)
|
||||
@ -618,48 +618,42 @@ void BattleLoadMonSpriteGfx(struct Pokemon *mon, u32 battler)
|
||||
if (GetMonData(mon, MON_DATA_IS_EGG) || GetMonData(mon, MON_DATA_SPECIES) == SPECIES_NONE) // Don't load GFX of egg pokemon.
|
||||
return;
|
||||
|
||||
monsPersonality = GetMonData(mon, MON_DATA_PERSONALITY);
|
||||
isShiny = GetMonData(mon, MON_DATA_IS_SHINY);
|
||||
|
||||
if (gBattleSpritesDataPtr->battlerData[battler].transformSpecies == SPECIES_NONE)
|
||||
{
|
||||
species = GetMonData(mon, MON_DATA_SPECIES);
|
||||
currentPersonality = monsPersonality;
|
||||
personalityValue = GetMonData(mon, MON_DATA_PERSONALITY);
|
||||
}
|
||||
else
|
||||
{
|
||||
species = gBattleSpritesDataPtr->battlerData[battler].transformSpecies;
|
||||
// If battler has Gigantamax factor, try convert gfx to G-Max version
|
||||
if (GetActiveGimmick(battler) == GIMMICK_DYNAMAX && GetMonData(mon, MON_DATA_GIGANTAMAX_FACTOR))
|
||||
gBattleSpritesDataPtr->battlerData[battler].transformSpecies = species = GetGMaxTargetSpecies(species);
|
||||
|
||||
if (B_TRANSFORM_SHINY >= GEN_4)
|
||||
{
|
||||
currentPersonality = gTransformedPersonalities[battler];
|
||||
personalityValue = gTransformedPersonalities[battler];
|
||||
isShiny = gTransformedShininess[battler];
|
||||
}
|
||||
else
|
||||
{
|
||||
currentPersonality = monsPersonality;
|
||||
personalityValue = GetMonData(mon, MON_DATA_PERSONALITY);
|
||||
}
|
||||
}
|
||||
|
||||
position = GetBattlerPosition(battler);
|
||||
if (GetBattlerSide(battler) == B_SIDE_OPPONENT)
|
||||
{
|
||||
HandleLoadSpecialPokePic(TRUE,
|
||||
gMonSpritesGfxPtr->spritesGfx[position],
|
||||
species, currentPersonality);
|
||||
}
|
||||
else
|
||||
{
|
||||
HandleLoadSpecialPokePic(FALSE,
|
||||
gMonSpritesGfxPtr->spritesGfx[position],
|
||||
species, currentPersonality);
|
||||
}
|
||||
HandleLoadSpecialPokePic((GetBattlerSide(battler) == B_SIDE_OPPONENT),
|
||||
gMonSpritesGfxPtr->spritesGfx[position],
|
||||
species, personalityValue);
|
||||
|
||||
paletteOffset = OBJ_PLTT_ID(battler);
|
||||
|
||||
if (gBattleSpritesDataPtr->battlerData[battler].transformSpecies == SPECIES_NONE)
|
||||
lzPaletteData = GetMonFrontSpritePal(mon);
|
||||
else
|
||||
lzPaletteData = GetMonSpritePalFromSpeciesAndPersonality(species, isShiny, currentPersonality);
|
||||
lzPaletteData = GetMonSpritePalFromSpeciesAndPersonality(species, isShiny, personalityValue);
|
||||
|
||||
LZDecompressWram(lzPaletteData, gDecompressionBuffer);
|
||||
LoadPalette(gDecompressionBuffer, paletteOffset, PLTT_SIZE_4BPP);
|
||||
@ -925,8 +919,10 @@ void CopyBattleSpriteInvisibility(u8 battler)
|
||||
void HandleSpeciesGfxDataChange(u8 battlerAtk, u8 battlerDef, bool32 megaEvo, bool8 trackEnemyPersonality)
|
||||
{
|
||||
u32 personalityValue, position, paletteOffset, targetSpecies;
|
||||
bool8 isShiny;
|
||||
bool32 isShiny;
|
||||
const void *lzPaletteData, *src;
|
||||
struct Pokemon *monAtk = GetPartyBattlerData(battlerAtk);
|
||||
struct Pokemon *monDef = GetPartyBattlerData(battlerDef);
|
||||
void *dst;
|
||||
|
||||
if (IsContest())
|
||||
@ -944,48 +940,35 @@ void HandleSpeciesGfxDataChange(u8 battlerAtk, u8 battlerDef, bool32 megaEvo, bo
|
||||
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)
|
||||
if (gBattleSpritesDataPtr->battlerData[battlerAtk].transformSpecies == SPECIES_NONE)
|
||||
{
|
||||
if (B_TRANSFORM_SHINY >= GEN_4 && trackEnemyPersonality && !megaEvo)
|
||||
{
|
||||
personalityValue = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerDef]], MON_DATA_PERSONALITY);
|
||||
isShiny = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerDef]], MON_DATA_IS_SHINY);
|
||||
}
|
||||
// Get base form if its currently Gigantamax
|
||||
if (IsGigantamaxed(battlerDef))
|
||||
targetSpecies = gBattleStruct->changedSpecies[GetBattlerSide(battlerDef)][gBattlerPartyIndexes[battlerDef]];
|
||||
else
|
||||
{
|
||||
personalityValue = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerAtk]], MON_DATA_PERSONALITY);
|
||||
isShiny = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerAtk]], MON_DATA_IS_SHINY);
|
||||
}
|
||||
|
||||
HandleLoadSpecialPokePic(FALSE,
|
||||
gMonSpritesGfxPtr->spritesGfx[position],
|
||||
targetSpecies,
|
||||
personalityValue);
|
||||
targetSpecies = GetMonData(monDef, MON_DATA_SPECIES);
|
||||
personalityValue = GetMonData(monAtk, MON_DATA_PERSONALITY);
|
||||
isShiny = GetMonData(monAtk, MON_DATA_IS_SHINY);
|
||||
}
|
||||
else
|
||||
{
|
||||
targetSpecies = gBattleSpritesDataPtr->battlerData[battlerAtk].transformSpecies;
|
||||
if (B_TRANSFORM_SHINY >= GEN_4 && trackEnemyPersonality && !megaEvo)
|
||||
{
|
||||
personalityValue = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerDef]], MON_DATA_PERSONALITY);
|
||||
isShiny = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerDef]], MON_DATA_IS_SHINY);
|
||||
personalityValue = GetMonData(monDef, MON_DATA_PERSONALITY);
|
||||
isShiny = GetMonData(monDef, MON_DATA_IS_SHINY);
|
||||
}
|
||||
else
|
||||
{
|
||||
personalityValue = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerAtk]], MON_DATA_PERSONALITY);
|
||||
isShiny = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerAtk]], MON_DATA_IS_SHINY);
|
||||
personalityValue = GetMonData(monAtk, MON_DATA_PERSONALITY);
|
||||
isShiny = GetMonData(monAtk, MON_DATA_IS_SHINY);
|
||||
}
|
||||
|
||||
HandleLoadSpecialPokePic(TRUE,
|
||||
gMonSpritesGfxPtr->spritesGfx[position],
|
||||
targetSpecies,
|
||||
personalityValue);
|
||||
}
|
||||
|
||||
HandleLoadSpecialPokePic((GetBattlerSide(battlerAtk) != B_SIDE_PLAYER),
|
||||
gMonSpritesGfxPtr->spritesGfx[position],
|
||||
targetSpecies,
|
||||
personalityValue);
|
||||
}
|
||||
src = gMonSpritesGfxPtr->spritesGfx[position];
|
||||
dst = (void *)(OBJ_VRAM0 + gSprites[gBattlerSpriteIds[battlerAtk]].oam.tileNum * 32);
|
||||
@ -1005,6 +988,24 @@ void HandleSpeciesGfxDataChange(u8 battlerAtk, u8 battlerDef, bool32 megaEvo, bo
|
||||
}
|
||||
}
|
||||
|
||||
// dynamax tint
|
||||
if (GetActiveGimmick(battlerAtk) == GIMMICK_DYNAMAX)
|
||||
{
|
||||
// Calyrex and its forms have a blue dynamax aura instead of red.
|
||||
if (GET_BASE_SPECIES_ID(targetSpecies) == SPECIES_CALYREX)
|
||||
BlendPalette(paletteOffset, 16, 4, RGB(12, 0, 31));
|
||||
else
|
||||
BlendPalette(paletteOffset, 16, 4, RGB(31, 0, 12));
|
||||
CpuCopy32(gPlttBufferFaded + paletteOffset, gPlttBufferUnfaded + paletteOffset, PLTT_SIZEOF(16));
|
||||
}
|
||||
|
||||
// Terastallization's tint
|
||||
if (GetActiveGimmick(battlerAtk) == GIMMICK_TERA)
|
||||
{
|
||||
BlendPalette(paletteOffset, 16, 8, GetTeraTypeRGB(GetBattlerTeraType(battlerAtk)));
|
||||
CpuCopy32(gPlttBufferFaded + paletteOffset, gPlttBufferUnfaded + paletteOffset, PLTT_SIZEOF(16));
|
||||
}
|
||||
|
||||
gSprites[gBattlerSpriteIds[battlerAtk]].y = GetBattlerSpriteDefault_Y(battlerAtk);
|
||||
StartSpriteAnim(&gSprites[gBattlerSpriteIds[battlerAtk]], 0);
|
||||
}
|
||||
@ -1384,9 +1385,10 @@ void FillAroundBattleWindows(void)
|
||||
}
|
||||
}
|
||||
|
||||
void ClearTemporarySpeciesSpriteData(u8 battler, bool8 dontClearSubstitute)
|
||||
void ClearTemporarySpeciesSpriteData(u32 battler, bool32 dontClearTransform, bool32 dontClearSubstitute)
|
||||
{
|
||||
gBattleSpritesDataPtr->battlerData[battler].transformSpecies = SPECIES_NONE;
|
||||
if (!dontClearTransform)
|
||||
gBattleSpritesDataPtr->battlerData[battler].transformSpecies = SPECIES_NONE;
|
||||
if (!dontClearSubstitute)
|
||||
ClearBehindSubstituteBit(battler);
|
||||
}
|
||||
|
||||
@ -6940,7 +6940,7 @@ static void Cmd_switchinanim(void)
|
||||
{
|
||||
u32 battler;
|
||||
|
||||
CMD_ARGS(u8 battler, bool8 dontClearSubstitute);
|
||||
CMD_ARGS(u8 battler, bool8 dontClearTransform, bool8 dontClearSubstitute);
|
||||
|
||||
if (gBattleControllerExecFlags)
|
||||
return;
|
||||
@ -6957,7 +6957,7 @@ static void Cmd_switchinanim(void)
|
||||
|
||||
gAbsentBattlerFlags &= ~(1u << battler);
|
||||
|
||||
BtlController_EmitSwitchInAnim(battler, BUFFER_A, gBattlerPartyIndexes[battler], cmd->dontClearSubstitute);
|
||||
BtlController_EmitSwitchInAnim(battler, BUFFER_A, gBattlerPartyIndexes[battler], cmd->dontClearTransform, cmd->dontClearSubstitute);
|
||||
MarkBattlerForControllerExec(battler);
|
||||
|
||||
gBattlescriptCurrInstr = cmd->nextInstr;
|
||||
|
||||
@ -3700,7 +3700,7 @@ void CopyPartyMonToBattleData(u32 battlerId, u32 partyIndex)
|
||||
PokemonToBattleMon(&party[partyIndex], &gBattleMons[battlerId]);
|
||||
gBattleStruct->hpOnSwitchout[side] = gBattleMons[battlerId].hp;
|
||||
UpdateSentPokesToOpponentValue(battlerId);
|
||||
ClearTemporarySpeciesSpriteData(battlerId, FALSE);
|
||||
ClearTemporarySpeciesSpriteData(battlerId, FALSE, FALSE);
|
||||
}
|
||||
|
||||
bool8 ExecuteTableBasedItemEffect(struct Pokemon *mon, u16 item, u8 partyIndex, u8 moveIndex)
|
||||
@ -4407,7 +4407,7 @@ u8 GetNatureFromPersonality(u32 personality)
|
||||
return personality % NUM_NATURES;
|
||||
}
|
||||
|
||||
static u32 GetGMaxTargetSpecies(u32 species)
|
||||
u32 GetGMaxTargetSpecies(u32 species)
|
||||
{
|
||||
const struct FormChange *formChanges = GetSpeciesFormChanges(species);
|
||||
u32 i;
|
||||
@ -4416,7 +4416,7 @@ static u32 GetGMaxTargetSpecies(u32 species)
|
||||
if (formChanges[i].method == FORM_CHANGE_BATTLE_GIGANTAMAX)
|
||||
return formChanges[i].targetSpecies;
|
||||
}
|
||||
return SPECIES_NONE;
|
||||
return species;
|
||||
}
|
||||
|
||||
u16 GetEvolutionTargetSpecies(struct Pokemon *mon, enum EvolutionMode mode, u16 evolutionItem, struct Pokemon *tradePartner)
|
||||
@ -4854,8 +4854,8 @@ u16 GetEvolutionTargetSpecies(struct Pokemon *mon, enum EvolutionMode mode, u16
|
||||
// Gigantamax Factor. We assume that is because their evolutions
|
||||
// do not have a Gigantamax Form.
|
||||
if (GetMonData(mon, MON_DATA_GIGANTAMAX_FACTOR, NULL)
|
||||
&& GetGMaxTargetSpecies(species) != SPECIES_NONE
|
||||
&& GetGMaxTargetSpecies(targetSpecies) == SPECIES_NONE)
|
||||
&& GetGMaxTargetSpecies(species) != species
|
||||
&& GetGMaxTargetSpecies(targetSpecies) == targetSpecies)
|
||||
{
|
||||
return SPECIES_NONE;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user