mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 03:34:15 +01:00
Clean battle structs
This commit is contained in:
parent
b73611bccb
commit
ecdf0fd69d
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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)
|
||||
|
2
src/tv.c
2
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;
|
||||
|
Loading…
Reference in New Issue
Block a user