Clean battle structs
This commit is contained in:
+5
-5
@@ -27,8 +27,8 @@
|
|||||||
#define B_ACTION_SAFARI_POKEBLOCK 6
|
#define B_ACTION_SAFARI_POKEBLOCK 6
|
||||||
#define B_ACTION_SAFARI_GO_NEAR 7
|
#define B_ACTION_SAFARI_GO_NEAR 7
|
||||||
#define B_ACTION_SAFARI_RUN 8
|
#define B_ACTION_SAFARI_RUN 8
|
||||||
|
#define B_ACTION_WALLY_THROW 9
|
||||||
// The exact purposes of these are unclear
|
// 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_EXEC_SCRIPT 10 // when executing an action
|
||||||
#define B_ACTION_CANCEL_PARTNER 12 // when choosing an action
|
#define B_ACTION_CANCEL_PARTNER 12 // when choosing an action
|
||||||
#define B_ACTION_FINISHED 12 // when executing an action
|
#define B_ACTION_FINISHED 12 // when executing an action
|
||||||
@@ -137,7 +137,7 @@ struct DisableStruct
|
|||||||
u8 disableTimer:4;
|
u8 disableTimer:4;
|
||||||
u8 disableTimerStartValue:4;
|
u8 disableTimerStartValue:4;
|
||||||
u8 encoredMovePos;
|
u8 encoredMovePos;
|
||||||
u8 unkD;
|
u8 filler_D; // Unused field.
|
||||||
u8 encoreTimer:4;
|
u8 encoreTimer:4;
|
||||||
u8 encoreTimerStartValue:4;
|
u8 encoreTimerStartValue:4;
|
||||||
u8 perishSongTimer:4;
|
u8 perishSongTimer:4;
|
||||||
@@ -146,7 +146,7 @@ struct DisableStruct
|
|||||||
u8 rolloutTimer:4;
|
u8 rolloutTimer:4;
|
||||||
u8 rolloutTimerStartValue:4;
|
u8 rolloutTimerStartValue:4;
|
||||||
u8 chargeTimer:4;
|
u8 chargeTimer:4;
|
||||||
u8 chargeTimer2:4;
|
u8 chargeTimerStartValue:4;
|
||||||
u8 tauntTimer:4;
|
u8 tauntTimer:4;
|
||||||
u8 tauntTimer2:4;
|
u8 tauntTimer2:4;
|
||||||
u8 battlerPreventingEscape;
|
u8 battlerPreventingEscape;
|
||||||
@@ -229,7 +229,7 @@ struct WishFutureKnock
|
|||||||
u8 wishCounter[MAX_BATTLERS_COUNT];
|
u8 wishCounter[MAX_BATTLERS_COUNT];
|
||||||
u8 wishMonId[MAX_BATTLERS_COUNT];
|
u8 wishMonId[MAX_BATTLERS_COUNT];
|
||||||
u8 weatherDuration;
|
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
|
struct AI_ThinkingStruct
|
||||||
@@ -302,7 +302,7 @@ struct BattleResults
|
|||||||
u8 playerSwitchesCounter; // 0x2
|
u8 playerSwitchesCounter; // 0x2
|
||||||
u8 unk3; // 0x3
|
u8 unk3; // 0x3
|
||||||
u8 unk4; // 0x4
|
u8 unk4; // 0x4
|
||||||
u8 unk5_0:1; // 0x5
|
u8 playerMonWasDamaged:1; // 0x5
|
||||||
u8 usedMasterBall:1; // 0x5
|
u8 usedMasterBall:1; // 0x5
|
||||||
u8 caughtMonBall:4; // 0x5
|
u8 caughtMonBall:4; // 0x5
|
||||||
u8 shinyWildMon:1; // 0x5
|
u8 shinyWildMon:1; // 0x5
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ static bool8 ShouldUseItem(void);
|
|||||||
static bool8 ShouldSwitchIfPerishSong(void)
|
static bool8 ShouldSwitchIfPerishSong(void)
|
||||||
{
|
{
|
||||||
if (gStatuses3[gActiveBattler] & STATUS3_PERISH_SONG
|
if (gStatuses3[gActiveBattler] & STATUS3_PERISH_SONG
|
||||||
&& gDisableStructs[gActiveBattler].perishSongTimer1 == 0)
|
&& gDisableStructs[gActiveBattler].perishSongTimer == 0)
|
||||||
{
|
{
|
||||||
*(gBattleStruct->AI_monToSwitchIntoId + gActiveBattler) = PARTY_SIZE;
|
*(gBattleStruct->AI_monToSwitchIntoId + gActiveBattler) = PARTY_SIZE;
|
||||||
BtlController_EmitTwoReturnValues(1, B_ACTION_SWITCH, 0);
|
BtlController_EmitTwoReturnValues(1, B_ACTION_SWITCH, 0);
|
||||||
|
|||||||
@@ -1858,7 +1858,7 @@ static void atk0B_healthbarupdate(void)
|
|||||||
MarkBattlerForControllerExec(gActiveBattler);
|
MarkBattlerForControllerExec(gActiveBattler);
|
||||||
|
|
||||||
if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER && gBattleMoveDamage > 0)
|
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_LINK
|
||||||
| BATTLE_TYPE_x2000000
|
| BATTLE_TYPE_x2000000
|
||||||
| BATTLE_TYPE_SECRET_BASE))
|
| BATTLE_TYPE_SECRET_BASE))
|
||||||
&& (gWishFutureKnock.knockedOffPokes[side] & gBitTable[gBattlerPartyIndexes[gBattlerAttacker]]))
|
&& (gWishFutureKnock.knockedOffMons[side] & gBitTable[gBattlerPartyIndexes[gBattlerAttacker]]))
|
||||||
{
|
{
|
||||||
gBattlescriptCurrInstr++;
|
gBattlescriptCurrInstr++;
|
||||||
}
|
}
|
||||||
@@ -2885,7 +2885,7 @@ void SetMoveEffect(bool8 primary, u8 certain)
|
|||||||
|
|
||||||
gLastUsedItem = gBattleMons[gEffectBattler].item;
|
gLastUsedItem = gBattleMons[gEffectBattler].item;
|
||||||
gBattleMons[gEffectBattler].item = 0;
|
gBattleMons[gEffectBattler].item = 0;
|
||||||
gWishFutureKnock.knockedOffPokes[side] |= gBitTable[gBattlerPartyIndexes[gEffectBattler]];
|
gWishFutureKnock.knockedOffMons[side] |= gBitTable[gBattlerPartyIndexes[gEffectBattler]];
|
||||||
|
|
||||||
BattleScriptPush(gBattlescriptCurrInstr + 1);
|
BattleScriptPush(gBattlescriptCurrInstr + 1);
|
||||||
gBattlescriptCurrInstr = BattleScript_KnockedOff;
|
gBattlescriptCurrInstr = BattleScript_KnockedOff;
|
||||||
@@ -4948,7 +4948,7 @@ static void atk4D_switchindataupdate(void)
|
|||||||
|
|
||||||
// check knocked off item
|
// check knocked off item
|
||||||
i = GetBattlerSide(gActiveBattler);
|
i = GetBattlerSide(gActiveBattler);
|
||||||
if (gWishFutureKnock.knockedOffPokes[i] & gBitTable[gBattlerPartyIndexes[gActiveBattler]])
|
if (gWishFutureKnock.knockedOffMons[i] & gBitTable[gBattlerPartyIndexes[gActiveBattler]])
|
||||||
{
|
{
|
||||||
gBattleMons[gActiveBattler].item = 0;
|
gBattleMons[gActiveBattler].item = 0;
|
||||||
}
|
}
|
||||||
@@ -9321,7 +9321,7 @@ static void atkCB_setcharge(void)
|
|||||||
{
|
{
|
||||||
gStatuses3[gBattlerAttacker] |= STATUS3_CHARGED_UP;
|
gStatuses3[gBattlerAttacker] |= STATUS3_CHARGED_UP;
|
||||||
gDisableStructs[gBattlerAttacker].chargeTimer = 2;
|
gDisableStructs[gBattlerAttacker].chargeTimer = 2;
|
||||||
gDisableStructs[gBattlerAttacker].chargeTimer2 = 2;
|
gDisableStructs[gBattlerAttacker].chargeTimerStartValue = 2;
|
||||||
gBattlescriptCurrInstr++;
|
gBattlescriptCurrInstr++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -9427,8 +9427,8 @@ static void atkD2_tryswapitems(void) // trick
|
|||||||
| BATTLE_TYPE_FRONTIER
|
| BATTLE_TYPE_FRONTIER
|
||||||
| BATTLE_TYPE_SECRET_BASE
|
| BATTLE_TYPE_SECRET_BASE
|
||||||
| BATTLE_TYPE_x2000000))
|
| BATTLE_TYPE_x2000000))
|
||||||
&& (gWishFutureKnock.knockedOffPokes[sideAttacker] & gBitTable[gBattlerPartyIndexes[gBattlerAttacker]]
|
&& (gWishFutureKnock.knockedOffMons[sideAttacker] & gBitTable[gBattlerPartyIndexes[gBattlerAttacker]]
|
||||||
|| gWishFutureKnock.knockedOffPokes[sideTarget] & gBitTable[gBattlerPartyIndexes[gBattlerTarget]]))
|
|| gWishFutureKnock.knockedOffMons[sideTarget] & gBitTable[gBattlerPartyIndexes[gBattlerTarget]]))
|
||||||
{
|
{
|
||||||
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1);
|
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1);
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -659,7 +659,7 @@ void BattleTv_SetDataBasedOnMove(u16 move, u16 weatherFlags, struct DisableStruc
|
|||||||
tvPtr->side[atkSide].usedMoveSlot = moveSlot;
|
tvPtr->side[atkSide].usedMoveSlot = moveSlot;
|
||||||
AddMovePoints(0, moveSlot, gBattleMoves[move].effect, 0);
|
AddMovePoints(0, moveSlot, gBattleMoves[move].effect, 0);
|
||||||
AddPointsBasedOnWeather(weatherFlags, move, moveSlot);
|
AddPointsBasedOnWeather(weatherFlags, move, moveSlot);
|
||||||
if (disableStructPtr->chargeTimer1 != 0)
|
if (disableStructPtr->chargeTimer != 0)
|
||||||
AddMovePoints(7, move, moveSlot, 0);
|
AddMovePoints(7, move, moveSlot, 0);
|
||||||
|
|
||||||
if (move == MOVE_WISH)
|
if (move == MOVE_WISH)
|
||||||
|
|||||||
@@ -936,7 +936,7 @@ void GabbyAndTyBeforeInterview(void)
|
|||||||
{
|
{
|
||||||
gSaveBlock1Ptr->gabbyAndTyData.battleNum ++;
|
gSaveBlock1Ptr->gabbyAndTyData.battleNum ++;
|
||||||
}
|
}
|
||||||
gSaveBlock1Ptr->gabbyAndTyData.battleTookMoreThanOneTurn = gBattleResults.unk5_0;
|
gSaveBlock1Ptr->gabbyAndTyData.battleTookMoreThanOneTurn = gBattleResults.playerMonWasDamaged;
|
||||||
if (gBattleResults.playerFaintCounter != 0)
|
if (gBattleResults.playerFaintCounter != 0)
|
||||||
{
|
{
|
||||||
gSaveBlock1Ptr->gabbyAndTyData.playerLostAMon = TRUE;
|
gSaveBlock1Ptr->gabbyAndTyData.playerLostAMon = TRUE;
|
||||||
|
|||||||
Reference in New Issue
Block a user