Skip to content

Commit

Permalink
HandleSpeciesGfxDataChange uses the correct battler index rh-hideout#…
Browse files Browse the repository at this point in the history
…4486 and fix battle script clearing specialBattleType rh-hideout#4536
  • Loading branch information
Pawkkie committed May 29, 2024
1 parent e859709 commit 5070eb7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/battle_gfx_sfx_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -896,13 +896,13 @@ void HandleSpeciesGfxDataChange(u8 battlerAtk, u8 battlerDef, bool32 megaEvo, bo
{
if (B_TRANSFORM_SHINY >= GEN_4 && trackEnemyPersonality)
{
personalityValue = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerAtk]], MON_DATA_PERSONALITY);
isShiny = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerAtk]], MON_DATA_IS_SHINY);
personalityValue = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerDef]], MON_DATA_PERSONALITY);
isShiny = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerDef]], MON_DATA_IS_SHINY);
}
else
{
personalityValue = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerAtk]], MON_DATA_PERSONALITY);
isShiny = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerAtk]], MON_DATA_IS_SHINY);
personalityValue = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerDef]], MON_DATA_PERSONALITY);
isShiny = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerDef]], MON_DATA_IS_SHINY);
}

HandleLoadSpecialPokePic(FALSE,
Expand Down
2 changes: 2 additions & 0 deletions src/battle_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2973,11 +2973,13 @@ static void ClearSetBScriptingStruct(void)
{
// windowsType is set up earlier in BattleInitBgsAndWindows, so we need to save the value
u32 temp = gBattleScripting.windowsType;
u32 specialBattleType = gBattleScripting.specialTrainerBattleType;
memset(&gBattleScripting, 0, sizeof(gBattleScripting));

gBattleScripting.windowsType = temp;
gBattleScripting.battleStyle = gSaveBlock2Ptr->optionsBattleStyle;
gBattleScripting.expOnCatch = (B_EXP_CATCH >= GEN_6);
gBattleScripting.specialTrainerBattleType = specialBattleType;
}

static void BattleStartClearSetData(void)
Expand Down

0 comments on commit 5070eb7

Please sign in to comment.