Some more documentation and cleanup (#8020)
This commit is contained in:
parent
fb660061ab
commit
fbd702e3a4
@ -1185,7 +1185,7 @@ static inline u32 GetBattlerSide(u32 battler)
|
||||
return GetBattlerPosition(battler) & BIT_SIDE;
|
||||
}
|
||||
|
||||
static inline u32 IsOnPlayerSide(u32 battler)
|
||||
static inline bool32 IsOnPlayerSide(u32 battler)
|
||||
{
|
||||
return GetBattlerSide(battler) == B_SIDE_PLAYER;
|
||||
}
|
||||
@ -1206,7 +1206,7 @@ static inline struct Pokemon* GetBattlerMon(u32 battler)
|
||||
return !IsOnPlayerSide(battler) ? &gEnemyParty[index] : &gPlayerParty[index];
|
||||
}
|
||||
|
||||
static inline struct Pokemon *GetSideParty(u32 side)
|
||||
static inline struct Pokemon *GetSideParty(enum BattleSide side)
|
||||
{
|
||||
return side == B_SIDE_PLAYER ? gPlayerParty : gEnemyParty;
|
||||
}
|
||||
|
||||
@ -364,7 +364,7 @@ void BtlController_HandleSpriteInvisibility(u32 battler);
|
||||
bool32 TwoPlayerIntroMons(u32 battlerId); // Double battle with both player pokemon active.
|
||||
bool32 TwoOpponentIntroMons(u32 battlerId); // Double battle with both opponent pokemon active.
|
||||
void BtlController_HandleIntroTrainerBallThrow(u32 battler, u16 tagTrainerPal, const u16 *trainerPal, s16 framesToWait, void (*controllerCallback)(u32 battler));
|
||||
void BtlController_HandleDrawPartyStatusSummary(u32 battler, u32 side, bool32 considerDelay);
|
||||
void BtlController_HandleDrawPartyStatusSummary(u32 battler, enum BattleSide side, bool32 considerDelay);
|
||||
void BtlController_HandleHidePartyStatusSummary(u32 battler);
|
||||
void BtlController_HandleBattleAnimation(u32 battler);
|
||||
|
||||
|
||||
@ -45,9 +45,12 @@ enum BattlerId
|
||||
#define BATTLE_OPPOSITE(id) ((id) ^ BIT_SIDE)
|
||||
#define BATTLE_PARTNER(id) ((id) ^ BIT_FLANK)
|
||||
|
||||
#define B_SIDE_PLAYER 0
|
||||
#define B_SIDE_OPPONENT 1
|
||||
#define NUM_BATTLE_SIDES 2
|
||||
enum BattleSide
|
||||
{
|
||||
B_SIDE_PLAYER = 0,
|
||||
B_SIDE_OPPONENT = 1,
|
||||
NUM_BATTLE_SIDES = 2,
|
||||
};
|
||||
|
||||
#define B_FLANK_LEFT 0
|
||||
#define B_FLANK_RIGHT 1
|
||||
|
||||
@ -13,7 +13,6 @@ void DestroyNamebox(void);
|
||||
void FillNamebox(void);
|
||||
void DrawNamebox(u32 windowId, u32 tileNum, bool32 copyToVram);
|
||||
void ClearNamebox(u32 windowId, bool32 copyToVram);
|
||||
void SetSpeakerName(const u8 *name);
|
||||
u32 GetNameboxWidth(void);
|
||||
void TrySpawnAndShowNamebox(const u8 *speaker, u32 tileNum);
|
||||
|
||||
|
||||
@ -885,7 +885,7 @@ u16 MonTryLearningNewMoveEvolution(struct Pokemon *mon, bool8 firstMove);
|
||||
void RemoveIVIndexFromList(u8 *ivs, u8 selectedIv);
|
||||
void TrySpecialOverworldEvo(void);
|
||||
bool32 SpeciesHasGenderDifferences(u16 species);
|
||||
bool32 TryFormChange(u32 monId, u32 side, enum FormChanges method);
|
||||
bool32 TryFormChange(u32 monId, enum BattleSide side, enum FormChanges method);
|
||||
void TryToSetBattleFormChangeMoves(struct Pokemon *mon, enum FormChanges method);
|
||||
u32 GetMonFriendshipScore(struct Pokemon *pokemon);
|
||||
u32 GetMonAffectionHearts(struct Pokemon *pokemon);
|
||||
|
||||
@ -888,7 +888,7 @@ struct moveWithPP {
|
||||
void SetFlagForTest(u32 sourceLine, u16 flagId);
|
||||
void TestSetConfig(u32 sourceLine, enum GenConfigTag configTag, u32 value);
|
||||
void ClearFlagAfterTest(void);
|
||||
void OpenPokemon(u32 sourceLine, u32 side, u32 species);
|
||||
void OpenPokemon(u32 sourceLine, enum BattleSide side, u32 species);
|
||||
void ClosePokemon(u32 sourceLine);
|
||||
|
||||
void RNGSeed_(u32 sourceLine, rng_value_t seed);
|
||||
|
||||
@ -168,36 +168,36 @@ static void InitBtlControllersInternal(void)
|
||||
if (isLink)
|
||||
{
|
||||
if (isDouble && isMulti && !isMaster)
|
||||
gBattlerControllerFuncs[gBattlerPositions[B_BATTLER_0]] = SetControllerToLinkPartner;
|
||||
gBattlerControllerFuncs[GetBattlerPosition(B_BATTLER_0)] = SetControllerToLinkPartner;
|
||||
else
|
||||
gBattlerControllerFuncs[gBattlerPositions[B_BATTLER_0]] = SetControllerToPlayer;
|
||||
gBattlerControllerFuncs[GetBattlerPosition(B_BATTLER_0)] = SetControllerToPlayer;
|
||||
|
||||
if (!isDouble || !isMulti || !isMaster)
|
||||
{
|
||||
gBattlerControllerFuncs[gBattlerPositions[B_BATTLER_1]] = SetControllerToLinkOpponent;
|
||||
gBattlerControllerFuncs[gBattlerPositions[B_BATTLER_2]] = SetControllerToPlayer;
|
||||
gBattlerControllerFuncs[gBattlerPositions[B_BATTLER_3]] = SetControllerToLinkOpponent;
|
||||
gBattlerControllerFuncs[GetBattlerPosition(B_BATTLER_1)] = SetControllerToLinkOpponent;
|
||||
gBattlerControllerFuncs[GetBattlerPosition(B_BATTLER_2)] = SetControllerToPlayer;
|
||||
gBattlerControllerFuncs[GetBattlerPosition(B_BATTLER_3)] = SetControllerToLinkOpponent;
|
||||
}
|
||||
else
|
||||
{
|
||||
gBattlerControllerFuncs[gBattlerPositions[B_BATTLER_1]] = SetControllerToOpponent;
|
||||
gBattlerControllerFuncs[gBattlerPositions[B_BATTLER_2]] = SetControllerToLinkPartner;
|
||||
gBattlerControllerFuncs[gBattlerPositions[B_BATTLER_3]] = SetControllerToOpponent;
|
||||
gBattlerControllerFuncs[GetBattlerPosition(B_BATTLER_1)] = SetControllerToOpponent;
|
||||
gBattlerControllerFuncs[GetBattlerPosition(B_BATTLER_2)] = SetControllerToLinkPartner;
|
||||
gBattlerControllerFuncs[GetBattlerPosition(B_BATTLER_3)] = SetControllerToOpponent;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Player 1
|
||||
if (isRecorded)
|
||||
gBattlerControllerFuncs[gBattlerPositions[B_BATTLER_0]] = SetControllerToRecordedPlayer;
|
||||
gBattlerControllerFuncs[GetBattlerPosition(B_BATTLER_0)] = SetControllerToRecordedPlayer;
|
||||
else if (gBattleTypeFlags & BATTLE_TYPE_SAFARI)
|
||||
gBattlerControllerFuncs[gBattlerPositions[B_BATTLER_0]] = SetControllerToSafari;
|
||||
gBattlerControllerFuncs[GetBattlerPosition(B_BATTLER_0)] = SetControllerToSafari;
|
||||
else if (gBattleTypeFlags & BATTLE_TYPE_WALLY_TUTORIAL)
|
||||
gBattlerControllerFuncs[gBattlerPositions[B_BATTLER_0]] = SetControllerToWally;
|
||||
gBattlerControllerFuncs[GetBattlerPosition(B_BATTLER_0)] = SetControllerToWally;
|
||||
else if (isAIvsAI)
|
||||
gBattlerControllerFuncs[gBattlerPositions[B_BATTLER_0]] = SetControllerToPlayerPartner;
|
||||
gBattlerControllerFuncs[GetBattlerPosition(B_BATTLER_0)] = SetControllerToPlayerPartner;
|
||||
else
|
||||
gBattlerControllerFuncs[gBattlerPositions[B_BATTLER_0]] = SetControllerToPlayer;
|
||||
gBattlerControllerFuncs[GetBattlerPosition(B_BATTLER_0)] = SetControllerToPlayer;
|
||||
|
||||
// Opponent 1
|
||||
bool32 isOpponent1Recorded;
|
||||
@ -207,25 +207,25 @@ static void InitBtlControllersInternal(void)
|
||||
isOpponent1Recorded = isRecorded && isRecordedLink;
|
||||
|
||||
if (isOpponent1Recorded)
|
||||
gBattlerControllerFuncs[gBattlerPositions[B_BATTLER_1]] = SetControllerToRecordedOpponent;
|
||||
gBattlerControllerFuncs[GetBattlerPosition(B_BATTLER_1)] = SetControllerToRecordedOpponent;
|
||||
else
|
||||
gBattlerControllerFuncs[gBattlerPositions[B_BATTLER_1]] = SetControllerToOpponent;
|
||||
gBattlerControllerFuncs[GetBattlerPosition(B_BATTLER_1)] = SetControllerToOpponent;
|
||||
|
||||
// Player 2
|
||||
if (isInGamePartner)
|
||||
gBattlerControllerFuncs[gBattlerPositions[B_BATTLER_2]] = SetControllerToPlayerPartner;
|
||||
gBattlerControllerFuncs[GetBattlerPosition(B_BATTLER_2)] = SetControllerToPlayerPartner;
|
||||
else if (isRecorded)
|
||||
gBattlerControllerFuncs[gBattlerPositions[B_BATTLER_2]] = SetControllerToRecordedPlayer;
|
||||
gBattlerControllerFuncs[GetBattlerPosition(B_BATTLER_2)] = SetControllerToRecordedPlayer;
|
||||
else if (isAIvsAI)
|
||||
gBattlerControllerFuncs[gBattlerPositions[B_BATTLER_2]] = SetControllerToPlayerPartner;
|
||||
gBattlerControllerFuncs[GetBattlerPosition(B_BATTLER_2)] = SetControllerToPlayerPartner;
|
||||
else
|
||||
gBattlerControllerFuncs[gBattlerPositions[B_BATTLER_2]] = SetControllerToPlayer;
|
||||
gBattlerControllerFuncs[GetBattlerPosition(B_BATTLER_2)] = SetControllerToPlayer;
|
||||
|
||||
// Opponent 2
|
||||
if (isInGamePartner || !isRecorded || isMulti || !isRecordedLink)
|
||||
gBattlerControllerFuncs[gBattlerPositions[B_BATTLER_3]] = SetControllerToOpponent;
|
||||
gBattlerControllerFuncs[GetBattlerPosition(B_BATTLER_3)] = SetControllerToOpponent;
|
||||
else
|
||||
gBattlerControllerFuncs[gBattlerPositions[B_BATTLER_3]] = SetControllerToRecordedOpponent;
|
||||
gBattlerControllerFuncs[GetBattlerPosition(B_BATTLER_3)] = SetControllerToRecordedOpponent;
|
||||
}
|
||||
|
||||
bool32 bufferPartyOrders;
|
||||
@ -2676,7 +2676,7 @@ bool32 TwoOpponentIntroMons(u32 battler) // Double battle with both opponent pok
|
||||
void BtlController_HandleIntroTrainerBallThrow(u32 battler, u16 tagTrainerPal, const u16 *trainerPal, s16 framesToWait, void (*controllerCallback)(u32 battler))
|
||||
{
|
||||
u8 paletteNum, taskId;
|
||||
u32 side = GetBattlerSide(battler);
|
||||
enum BattleSide side = GetBattlerSide(battler);
|
||||
|
||||
SetSpritePrimaryCoordsFromSecondaryCoords(&gSprites[gBattleStruct->trainerSlideSpriteIds[battler]]);
|
||||
if (side == B_SIDE_PLAYER)
|
||||
@ -2802,7 +2802,7 @@ static void SpriteCB_FreeOpponentSprite(struct Sprite *sprite)
|
||||
|
||||
#undef sBattlerId
|
||||
|
||||
void BtlController_HandleDrawPartyStatusSummary(u32 battler, u32 side, bool32 considerDelay)
|
||||
void BtlController_HandleDrawPartyStatusSummary(u32 battler, enum BattleSide side, bool32 considerDelay)
|
||||
{
|
||||
if (gBattleResources->bufferA[battler][1] != 0 && IsOnPlayerSide(battler))
|
||||
{
|
||||
@ -3005,7 +3005,7 @@ void BtlController_HandleSwitchInSoundAndEnd(u32 battler)
|
||||
|
||||
void BtlController_HandleSwitchInShowHealthbox(u32 battler)
|
||||
{
|
||||
u32 side = GetBattlerSide(battler);
|
||||
enum BattleSide side = GetBattlerSide(battler);
|
||||
if (gBattleSpritesDataPtr->healthBoxesData[battler].finishedShinyMonAnim
|
||||
&& (side == B_SIDE_PLAYER || gSprites[gBattlerSpriteIds[battler]].callback == SpriteCallbackDummy))
|
||||
{
|
||||
|
||||
@ -5603,7 +5603,7 @@ static void HandleEndTurn_FinishBattle(void)
|
||||
| BATTLE_TYPE_TRAINER_HILL
|
||||
| BATTLE_TYPE_FRONTIER)))
|
||||
{
|
||||
for (u32 side = 0; side < NUM_BATTLE_SIDES; side++)
|
||||
for (enum BattleSide side = 0; side < NUM_BATTLE_SIDES; side++)
|
||||
{
|
||||
struct Pokemon *party = GetSideParty(side);
|
||||
|
||||
|
||||
@ -5673,7 +5673,7 @@ static bool32 HandleMoveEndMoveBlock(u32 moveEffect)
|
||||
return FALSE;
|
||||
|
||||
u32 effect = FALSE;
|
||||
u32 side = GetBattlerSide(gBattlerTarget);
|
||||
enum BattleSide side = GetBattlerSide(gBattlerTarget);
|
||||
switch (moveEffect)
|
||||
{
|
||||
case EFFECT_KNOCK_OFF:
|
||||
|
||||
@ -3300,7 +3300,7 @@ bool32 ChangeTypeBasedOnTerrain(u32 battler)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static inline u8 GetSideFaintCounter(u32 side)
|
||||
static inline u8 GetSideFaintCounter(enum BattleSide side)
|
||||
{
|
||||
return (side == B_SIDE_PLAYER) ? gBattleResults.playerFaintCounter : gBattleResults.opponentFaintCounter;
|
||||
}
|
||||
@ -9554,7 +9554,7 @@ void TryRestoreHeldItems(void)
|
||||
|
||||
bool32 CanStealItem(u32 battlerStealing, u32 battlerItem, u16 item)
|
||||
{
|
||||
u8 stealerSide = GetBattlerSide(battlerStealing);
|
||||
enum BattleSide stealerSide = GetBattlerSide(battlerStealing);
|
||||
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_TRAINER_HILL)
|
||||
return FALSE;
|
||||
|
||||
@ -6865,7 +6865,7 @@ bool32 SpeciesHasGenderDifferences(u16 species)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool32 TryFormChange(u32 monId, u32 side, enum FormChanges method)
|
||||
bool32 TryFormChange(u32 monId, enum BattleSide side, enum FormChanges method)
|
||||
{
|
||||
struct Pokemon *party = (side == B_SIDE_PLAYER) ? gPlayerParty : gEnemyParty;
|
||||
|
||||
|
||||
@ -415,7 +415,7 @@ static void CreateSpriteAndSetTypeSpriteAttributes(u32 type, u32 x, u32 y, u32 p
|
||||
|
||||
static bool32 ShouldFlipTypeIcon(bool32 useDoubleBattleCoords, u32 position, u32 typeId)
|
||||
{
|
||||
bool32 side = (useDoubleBattleCoords) ? B_SIDE_OPPONENT : B_SIDE_PLAYER;
|
||||
enum BattleSide side = (useDoubleBattleCoords) ? B_SIDE_OPPONENT : B_SIDE_PLAYER;
|
||||
|
||||
if (GetBattlerSide(GetBattlerAtPosition(position)) != side)
|
||||
return FALSE;
|
||||
|
||||
@ -1552,7 +1552,7 @@ void ClearFlagAfterTest(void)
|
||||
}
|
||||
}
|
||||
|
||||
void OpenPokemon(u32 sourceLine, u32 side, u32 species)
|
||||
void OpenPokemon(u32 sourceLine, enum BattleSide side, u32 species)
|
||||
{
|
||||
s32 i, data;
|
||||
u8 *partySize;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user