Skip to content

Commit

Permalink
Clear BattleScripting struct at the battle start (#3776)
Browse files Browse the repository at this point in the history
  • Loading branch information
DizzyEggg authored Dec 20, 2023
1 parent 0697697 commit 3b7782e
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/battle_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2961,6 +2961,10 @@ static void BattleStartClearSetData(void)
memset(&gSideTimers, 0, sizeof(gSideTimers));
memset(&gWishFutureKnock, 0, sizeof(gWishFutureKnock));
memset(&gBattleResults, 0, sizeof(gBattleResults));
memset(&gBattleScripting, 0, sizeof(gBattleScripting));

gBattleScripting.battleStyle = gSaveBlock2Ptr->optionsBattleStyle;
gBattleScripting.expOnCatch = (B_EXP_CATCH >= GEN_6);

for (i = 0; i < MAX_BATTLERS_COUNT; i++)
{
Expand Down Expand Up @@ -2997,7 +3001,6 @@ static void BattleStartClearSetData(void)
gBattlerAttacker = 0;
gBattlerTarget = 0;
gEffectBattler = 0;
gBattleScripting.battler = 0;
gBattlerAbility = 0;
gBattleWeather = 0;
gHitMarker = 0;
Expand All @@ -3012,12 +3015,7 @@ static void BattleStartClearSetData(void)
gHitMarker |= HITMARKER_NO_ANIMATIONS;
}

gBattleScripting.battleStyle = gSaveBlock2Ptr->optionsBattleStyle;
gBattleScripting.expOnCatch = (B_EXP_CATCH >= GEN_6);
gBattleScripting.monCaught = FALSE;

gMultiHitCounter = 0;
gBattleScripting.savedDmg = 0;
gBattleOutcome = 0;
gBattleControllerExecFlags = 0;
gPaydayMoney = 0;
Expand All @@ -3030,8 +3028,6 @@ static void BattleStartClearSetData(void)
gPauseCounterBattle = 0;
gBattleMoveDamage = 0;
gIntroSlideFlags = 0;
gBattleScripting.animTurn = 0;
gBattleScripting.animTargetsHit = 0;
gLeveledUpInBattle = 0;
gAbsentBattlerFlags = 0;
gBattleStruct->runTries = 0;
Expand Down

0 comments on commit 3b7782e

Please sign in to comment.