diff --git a/include/battle.h b/include/battle.h index c63d08e9bf..87aa2a45b6 100644 --- a/include/battle.h +++ b/include/battle.h @@ -27,8 +27,8 @@ #define B_ACTION_SAFARI_POKEBLOCK 6 #define B_ACTION_SAFARI_GO_NEAR 7 #define B_ACTION_SAFARI_RUN 8 +#define B_ACTION_WALLY_THROW 9 // The exact purposes of these are unclear -#define B_ACTION_WALLY_THROW 9 #define B_ACTION_EXEC_SCRIPT 10 // when executing an action #define B_ACTION_CANCEL_PARTNER 12 // when choosing an action #define B_ACTION_FINISHED 12 // when executing an action @@ -137,7 +137,7 @@ struct DisableStruct u8 disableTimer:4; u8 disableTimerStartValue:4; u8 encoredMovePos; - u8 unkD; + u8 filler_D; // Unused field. u8 encoreTimer:4; u8 encoreTimerStartValue:4; u8 perishSongTimer:4; @@ -146,7 +146,7 @@ struct DisableStruct u8 rolloutTimer:4; u8 rolloutTimerStartValue:4; u8 chargeTimer:4; - u8 chargeTimer2:4; + u8 chargeTimerStartValue:4; u8 tauntTimer:4; u8 tauntTimer2:4; u8 battlerPreventingEscape; @@ -229,7 +229,7 @@ struct WishFutureKnock u8 wishCounter[MAX_BATTLERS_COUNT]; u8 wishMonId[MAX_BATTLERS_COUNT]; u8 weatherDuration; - u8 knockedOffPokes[2]; + u8 knockedOffMons[2]; // Each battler is represented by a bit. The array entry is dependent on the battler's side. }; struct AI_ThinkingStruct @@ -302,7 +302,7 @@ struct BattleResults u8 playerSwitchesCounter; // 0x2 u8 unk3; // 0x3 u8 unk4; // 0x4 - u8 unk5_0:1; // 0x5 + u8 playerMonWasDamaged:1; // 0x5 u8 usedMasterBall:1; // 0x5 u8 caughtMonBall:4; // 0x5 u8 shinyWildMon:1; // 0x5 diff --git a/src/battle_ai_switch_items.c b/src/battle_ai_switch_items.c index a105e7edfb..40fffd6e5b 100644 --- a/src/battle_ai_switch_items.c +++ b/src/battle_ai_switch_items.c @@ -17,7 +17,7 @@ static bool8 ShouldUseItem(void); static bool8 ShouldSwitchIfPerishSong(void) { if (gStatuses3[gActiveBattler] & STATUS3_PERISH_SONG - && gDisableStructs[gActiveBattler].perishSongTimer1 == 0) + && gDisableStructs[gActiveBattler].perishSongTimer == 0) { *(gBattleStruct->AI_monToSwitchIntoId + gActiveBattler) = PARTY_SIZE; BtlController_EmitTwoReturnValues(1, B_ACTION_SWITCH, 0); diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 9785b2b7a8..685f0db7a3 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -1858,7 +1858,7 @@ static void atk0B_healthbarupdate(void) MarkBattlerForControllerExec(gActiveBattler); if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER && gBattleMoveDamage > 0) - gBattleResults.unk5_0 = 1; + gBattleResults.playerMonWasDamaged = TRUE; } } @@ -2763,7 +2763,7 @@ void SetMoveEffect(bool8 primary, u8 certain) | BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000 | BATTLE_TYPE_SECRET_BASE)) - && (gWishFutureKnock.knockedOffPokes[side] & gBitTable[gBattlerPartyIndexes[gBattlerAttacker]])) + && (gWishFutureKnock.knockedOffMons[side] & gBitTable[gBattlerPartyIndexes[gBattlerAttacker]])) { gBattlescriptCurrInstr++; } @@ -2885,7 +2885,7 @@ void SetMoveEffect(bool8 primary, u8 certain) gLastUsedItem = gBattleMons[gEffectBattler].item; gBattleMons[gEffectBattler].item = 0; - gWishFutureKnock.knockedOffPokes[side] |= gBitTable[gBattlerPartyIndexes[gEffectBattler]]; + gWishFutureKnock.knockedOffMons[side] |= gBitTable[gBattlerPartyIndexes[gEffectBattler]]; BattleScriptPush(gBattlescriptCurrInstr + 1); gBattlescriptCurrInstr = BattleScript_KnockedOff; @@ -4948,7 +4948,7 @@ static void atk4D_switchindataupdate(void) // check knocked off item i = GetBattlerSide(gActiveBattler); - if (gWishFutureKnock.knockedOffPokes[i] & gBitTable[gBattlerPartyIndexes[gActiveBattler]]) + if (gWishFutureKnock.knockedOffMons[i] & gBitTable[gBattlerPartyIndexes[gActiveBattler]]) { gBattleMons[gActiveBattler].item = 0; } @@ -9321,7 +9321,7 @@ static void atkCB_setcharge(void) { gStatuses3[gBattlerAttacker] |= STATUS3_CHARGED_UP; gDisableStructs[gBattlerAttacker].chargeTimer = 2; - gDisableStructs[gBattlerAttacker].chargeTimer2 = 2; + gDisableStructs[gBattlerAttacker].chargeTimerStartValue = 2; gBattlescriptCurrInstr++; } @@ -9427,8 +9427,8 @@ static void atkD2_tryswapitems(void) // trick | BATTLE_TYPE_FRONTIER | BATTLE_TYPE_SECRET_BASE | BATTLE_TYPE_x2000000)) - && (gWishFutureKnock.knockedOffPokes[sideAttacker] & gBitTable[gBattlerPartyIndexes[gBattlerAttacker]] - || gWishFutureKnock.knockedOffPokes[sideTarget] & gBitTable[gBattlerPartyIndexes[gBattlerTarget]])) + && (gWishFutureKnock.knockedOffMons[sideAttacker] & gBitTable[gBattlerPartyIndexes[gBattlerAttacker]] + || gWishFutureKnock.knockedOffMons[sideTarget] & gBitTable[gBattlerPartyIndexes[gBattlerTarget]])) { gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1); } diff --git a/src/battle_tv.c b/src/battle_tv.c index 6f9ee414e6..535046fd1a 100644 --- a/src/battle_tv.c +++ b/src/battle_tv.c @@ -659,7 +659,7 @@ void BattleTv_SetDataBasedOnMove(u16 move, u16 weatherFlags, struct DisableStruc tvPtr->side[atkSide].usedMoveSlot = moveSlot; AddMovePoints(0, moveSlot, gBattleMoves[move].effect, 0); AddPointsBasedOnWeather(weatherFlags, move, moveSlot); - if (disableStructPtr->chargeTimer1 != 0) + if (disableStructPtr->chargeTimer != 0) AddMovePoints(7, move, moveSlot, 0); if (move == MOVE_WISH) diff --git a/src/tv.c b/src/tv.c index d09e72abc9..af1102c2dd 100644 --- a/src/tv.c +++ b/src/tv.c @@ -936,7 +936,7 @@ void GabbyAndTyBeforeInterview(void) { gSaveBlock1Ptr->gabbyAndTyData.battleNum ++; } - gSaveBlock1Ptr->gabbyAndTyData.battleTookMoreThanOneTurn = gBattleResults.unk5_0; + gSaveBlock1Ptr->gabbyAndTyData.battleTookMoreThanOneTurn = gBattleResults.playerMonWasDamaged; if (gBattleResults.playerFaintCounter != 0) { gSaveBlock1Ptr->gabbyAndTyData.playerLostAMon = TRUE;