From ca484cf4ffb95913745c56833962c361bc895d31 Mon Sep 17 00:00:00 2001 From: cawtds <38510667+cawtds@users.noreply.github.com> Date: Sat, 22 Jun 2024 12:30:19 +0200 Subject: [PATCH] disable vertical stripe animation during tests --- src/battle_anim.c | 5 ++--- src/battle_controller_player.c | 12 +++++++----- src/battle_interface.c | 7 +++---- test/test_runner.c | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/battle_anim.c b/src/battle_anim.c index 2e4f8e696..7763205f9 100644 --- a/src/battle_anim.c +++ b/src/battle_anim.c @@ -208,7 +208,6 @@ static void Nop(void) void LaunchBattleAnimation(u32 animType, u16 animId) { s32 i; - bool8 isMoveAnim = (animId == ANIM_TYPE_MOVE); if (gTestRunnerEnabled) { @@ -233,7 +232,7 @@ void LaunchBattleAnimation(u32 animType, u16 animId) gAnimBattlerSpecies[i] = GetMonData(&gPlayerParty[gBattlerPartyIndexes[i]], MON_DATA_SPECIES); } - if (!isMoveAnim) + if (animType != ANIM_TYPE_MOVE) gAnimMoveIndex = 0; else gAnimMoveIndex = animId; @@ -267,7 +266,7 @@ void LaunchBattleAnimation(u32 animType, u16 animId) for (i = 0; i < ANIM_SPRITE_INDEX_COUNT; i++) sAnimSpriteIndexArray[i] = 0xFFFF; - if (isMoveAnim) + if (animType == ANIM_TYPE_MOVE) { for (i = 0; gMovesWithQuietBGM[i] != 0xFFFF; i++) { diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c index e1c5de538..6a5447b73 100644 --- a/src/battle_controller_player.c +++ b/src/battle_controller_player.c @@ -1280,10 +1280,11 @@ static void Task_GiveExpWithExpBar(u8 taskId) { u8 level; u16 species; - s32 currExp, newExpPoints, expOnNextLvl; + s32 currExp, expOnNextLvl, newExpPoints; + if (gTasks[taskId].tExpTask_frames < 13) { - ++gTasks[taskId].tExpTask_frames; + gTasks[taskId].tExpTask_frames++; } else { @@ -1300,6 +1301,7 @@ static void Task_GiveExpWithExpBar(u8 taskId) currExp = GetMonData(&gPlayerParty[monId], MON_DATA_EXP); species = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES); expOnNextLvl = gExperienceTables[gSpeciesInfo[species].growthRate][level + 1]; + if (currExp + gainedExp >= expOnNextLvl) { SetMonData(&gPlayerParty[monId], MON_DATA_EXP, &expOnNextLvl); @@ -1316,7 +1318,7 @@ static void Task_GiveExpWithExpBar(u8 taskId) } gainedExp -= expOnNextLvl - currExp; - BtlController_EmitTwoReturnValues(battler, 1, RET_VALUE_LEVELED_UP, gainedExp); + BtlController_EmitTwoReturnValues(battler, BUFFER_B, RET_VALUE_LEVELED_UP, gainedExp); gTasks[taskId].func = Task_LaunchLvlUpAnim; } else @@ -1336,7 +1338,7 @@ static void Task_LaunchLvlUpAnim(u8 taskId) u8 monIndex = gTasks[taskId].tExpTask_monId; if (IsDoubleBattle() == TRUE && monIndex == gBattlerPartyIndexes[BATTLE_PARTNER(battler)]) - battler = BATTLE_PARTNER(battler); + battler ^= BIT_FLANK; InitAndLaunchSpecialAnimation(battler, battler, battler, B_ANIM_LVL_UP); gTasks[taskId].func = Task_UpdateLvlInHealthbox; @@ -1361,7 +1363,7 @@ static void DestroyExpTaskAndCompleteOnInactiveTextPrinter(u8 taskId) { s32 battlerId = gTasks[taskId].tExpTask_battler; - if (IsBattlerSpriteVisible((u8)battlerId) == TRUE) + if (IsBattlerSpriteVisible((u8)battlerId) == TRUE && !gTestRunnerEnabled) { gTasks[taskId].func = Task_CreateLevelUpVerticalStripes; gTasks[taskId].data[15] = 0; diff --git a/src/battle_interface.c b/src/battle_interface.c index 22bafe3e8..6430a646f 100644 --- a/src/battle_interface.c +++ b/src/battle_interface.c @@ -2184,9 +2184,8 @@ s32 MoveBattleBar(u8 battlerId, u8 healthboxSpriteId, u8 whichBar, u8 unused) else // exp bar { u16 expFraction = GetScaledExpFraction(gBattleSpritesDataPtr->battleBars[battlerId].oldValue, - gBattleSpritesDataPtr->battleBars[battlerId].receivedValue, - gBattleSpritesDataPtr->battleBars[battlerId].maxValue, - B_EXPBAR_NUM_TILES); + gBattleSpritesDataPtr->battleBars[battlerId].receivedValue, + gBattleSpritesDataPtr->battleBars[battlerId].maxValue, B_EXPBAR_NUM_TILES); if (expFraction == 0) expFraction = 1; @@ -2404,7 +2403,7 @@ static u8 GetScaledExpFraction(s32 oldValue, s32 receivedValue, s32 maxValue, u8 s32 newVal, result; s8 oldToMax, newToMax; - scale *= 8; + scale *= (B_FAST_EXP_GROW) ? 2 : 8; newVal = oldValue - receivedValue; if (newVal < 0) diff --git a/test/test_runner.c b/test/test_runner.c index 2ddc58eb6..2eda5e58d 100644 --- a/test/test_runner.c +++ b/test/test_runner.c @@ -9,7 +9,7 @@ #include "test_runner.h" #include "test/test.h" -#define TIMEOUT_SECONDS 70 +#define TIMEOUT_SECONDS 55 void CB2_TestRunner(void);