mirror of
https://github.com/pret/pokeemerald.git
synced 2026-06-02 22:05:46 -05:00
Add AI thinking cycle count display to frame count
This commit is contained in:
parent
899438a1c2
commit
926a7437da
|
|
@ -797,8 +797,9 @@ struct BattleStruct
|
|||
u8 itemMoveIndex[MAX_BATTLERS_COUNT];
|
||||
u8 pledgeMove:1;
|
||||
u8 isSkyBattle:1;
|
||||
u32 aiDelayTimer; // Counts number of frames AI takes to choose an action.
|
||||
u32 aiDelayFrames; // Number of frames it took to choose an action.
|
||||
s32 aiDelayTimer; // Counts number of frames AI takes to choose an action.
|
||||
s32 aiDelayFrames; // Number of frames it took to choose an action.
|
||||
s32 aiDelayCycles; // Number of cycles it took to choose an action.
|
||||
u8 timesGotHit[NUM_BATTLE_SIDES][PARTY_SIZE];
|
||||
u8 transformZeroToHero[NUM_BATTLE_SIDES];
|
||||
u8 stickySyrupdBy[MAX_BATTLERS_COUNT];
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@
|
|||
|
||||
#define FEATURE_FLAG_ASSERT(flag, id) STATIC_ASSERT(flag > TEMP_FLAGS_END || flag == 0, id)
|
||||
|
||||
#ifndef NDEBUG
|
||||
#if !(defined (NDEBUG)) || DEBUG_AI_DELAY_TIMER
|
||||
static inline void CycleCountStart()
|
||||
{
|
||||
REG_TM2CNT_H = 0;
|
||||
|
|
|
|||
|
|
@ -473,6 +473,9 @@ void SetAiLogicDataForTurn(struct AiLogicData *aiData)
|
|||
battlersCount = gBattlersCount;
|
||||
|
||||
AI_DATA->aiCalcInProgress = TRUE;
|
||||
#if DEBUG_AI_DELAY_TIMER
|
||||
CycleCountStart();
|
||||
#endif
|
||||
for (battlerAtk = 0; battlerAtk < battlersCount; battlerAtk++)
|
||||
{
|
||||
if (!IsBattlerAlive(battlerAtk))
|
||||
|
|
@ -488,6 +491,10 @@ void SetAiLogicDataForTurn(struct AiLogicData *aiData)
|
|||
|
||||
SetBattlerAiMovesData(aiData, battlerAtk, battlersCount, weather);
|
||||
}
|
||||
#if DEBUG_AI_DELAY_TIMER
|
||||
// We add to existing to compound multiple calls
|
||||
gBattleStruct->aiDelayCycles += CycleCountEnd();
|
||||
#endif
|
||||
AI_DATA->aiCalcInProgress = FALSE;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2013,9 +2013,14 @@ static void HandleChooseActionAfterDma3(u32 battler)
|
|||
gBattleStruct->aiDelayTimer = 0;
|
||||
#if DEBUG_AI_DELAY_TIMER
|
||||
{
|
||||
static const u8 sText_AIDelay[] = _("AI delay:\n{B_BUFF1} frames");
|
||||
PREPARE_HWORD_NUMBER_BUFFER(gBattleTextBuff1, 3, gBattleStruct->aiDelayFrames);
|
||||
BattleStringExpandPlaceholdersToDisplayedString(sText_AIDelay);
|
||||
static const u8 sFramesText[] = _(" frames thinking\n");
|
||||
static const u8 sCyclesText[] = _(" cycles");
|
||||
ConvertIntToDecimalStringN(gDisplayedStringBattle, gBattleStruct->aiDelayFrames, STR_CONV_MODE_RIGHT_ALIGN, 3);
|
||||
u8* end = StringAppend(gDisplayedStringBattle, sFramesText);
|
||||
ConvertIntToDecimalStringN(end, gBattleStruct->aiDelayCycles, STR_CONV_MODE_RIGHT_ALIGN, 8);
|
||||
// Clear old result once read out
|
||||
gBattleStruct->aiDelayCycles = 0;
|
||||
StringAppend(gDisplayedStringBattle, sCyclesText);
|
||||
BattlePutTextOnWindow(gDisplayedStringBattle, B_WIN_ACTION_PROMPT);
|
||||
}
|
||||
#endif // DEBUG_AI_DELAY_TIMER
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user