From 68ce97cd906164aadbd3db5b318a59285af962dc Mon Sep 17 00:00:00 2001 From: gruxor <95389790+gruxor@users.noreply.github.com> Date: Sun, 2 Jul 2023 19:41:47 -0400 Subject: [PATCH 1/3] Fixed shadows in viewer (#3094) * Fixed shadows in viewer + minor arg signature fix * Unfixed castform functions, upcoming removal --- src/pokemon_debug.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/pokemon_debug.c b/src/pokemon_debug.c index 2e9f04506..d3277caa9 100644 --- a/src/pokemon_debug.c +++ b/src/pokemon_debug.c @@ -1298,8 +1298,9 @@ static void ApplyOffsetSpriteValues(struct PokemonDebugMenu *data) gSprites[data->backspriteId].y = DEBUG_MON_BACK_Y + gMonBackPicCoords[species].y_offset + data->offsetsSpriteValues.offset_back_picCoords; //Front gSprites[data->frontspriteId].y = GetBattlerSpriteFinal_YCustom(species, data->offsetsSpriteValues.offset_front_picCoords, data->offsetsSpriteValues.offset_front_elevation); - //Shadow if one was added - UpdateShadowSpriteInvisible(data); + + if (data->currentSubmenu == 2) + UpdateShadowSpriteInvisible(data); } static void UpdateSubmenuOneOptionValue(u8 taskId, bool8 increment) From 81522554c22885c227704ae398bb1489a67582ae Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Tue, 4 Jul 2023 12:19:38 -0400 Subject: [PATCH 2/3] Fixed KNOWN_FAILING tests running memory leak checks when unneeded (#3102) --- test/test_runner.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_runner.c b/test/test_runner.c index c0459fbe6..450dc77a6 100644 --- a/test/test_runner.c +++ b/test/test_runner.c @@ -155,7 +155,7 @@ void CB2_TestRunner(void) if (gTestRunnerState.test->runner->tearDown) gTestRunnerState.test->runner->tearDown(gTestRunnerState.test->data); - if (gTestRunnerState.result == gTestRunnerState.expectedResult + if (gTestRunnerState.result == TEST_RESULT_PASS && !gTestRunnerState.expectLeaks) { const struct MemBlock *head = HeapHead(); From 34aff01d3a8dbea5cc08e6728f9a279aabf61ee7 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Wed, 5 Jul 2023 20:52:24 +0200 Subject: [PATCH 3/3] Fix graphical/exp bugs with 2 vs 1 trainer battles (#3105) --- src/battle_anim_throw.c | 6 +++--- src/battle_controller_player.c | 2 +- src/battle_gfx_sfx_util.c | 2 +- src/battle_script_commands.c | 7 ++----- src/reshow_battle_screen.c | 6 ++---- 5 files changed, 9 insertions(+), 14 deletions(-) mode change 100755 => 100644 src/battle_anim_throw.c diff --git a/src/battle_anim_throw.c b/src/battle_anim_throw.c old mode 100755 new mode 100644 index 4a3cf7cf2..8f244717a --- a/src/battle_anim_throw.c +++ b/src/battle_anim_throw.c @@ -2491,11 +2491,11 @@ void TryShinyAnimation(u8 battler, struct Pokemon *mon) illusionMon = GetIllusionMonPtr(battler); if (illusionMon != NULL) mon = illusionMon; - + otId = GetMonData(mon, MON_DATA_OT_ID); personality = GetMonData(mon, MON_DATA_PERSONALITY); - if (IsBattlerSpriteVisible(battler)) + if (IsBattlerSpriteVisible(battler) && IsValidForBattle(mon)) { shinyValue = GET_SHINY_VALUE(otId, personality); if (shinyValue < SHINY_ODDS) @@ -2771,7 +2771,7 @@ void AnimTask_GetTrappedMoveAnimId(u8 taskId) gBattleAnimArgs[0] = TRAP_ANIM_BIND; break; } - + DestroyAnimVisualTask(taskId); } diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c index c88dbff78..294eee9aa 100644 --- a/src/battle_controller_player.c +++ b/src/battle_controller_player.c @@ -1377,7 +1377,7 @@ static void Task_GiveExpToMon(u8 taskId) u8 battlerId = gTasks[taskId].tExpTask_battler; s32 gainedExp = GetTaskExpValue(taskId); - if (IsDoubleBattle() == TRUE || monId != gBattlerPartyIndexes[battlerId]) // Give exp without moving the expbar. + if (WhichBattleCoords(battlerId) == 1 || monId != gBattlerPartyIndexes[battlerId]) // Give exp without moving the expbar. { struct Pokemon *mon = &gPlayerParty[monId]; u16 species = GetMonData(mon, MON_DATA_SPECIES); diff --git a/src/battle_gfx_sfx_util.c b/src/battle_gfx_sfx_util.c index 5f168d88b..06fc26f74 100644 --- a/src/battle_gfx_sfx_util.c +++ b/src/battle_gfx_sfx_util.c @@ -558,7 +558,7 @@ static void BattleLoadMonSpriteGfx(struct Pokemon *mon, u32 battlerId, bool32 op if (illusionMon != NULL) mon = illusionMon; - if (GetMonData(mon, MON_DATA_IS_EGG)) // Don't load GFX of egg pokemon. + if (GetMonData(mon, MON_DATA_IS_EGG) || GetMonData(mon, MON_DATA_SPECIES) == SPECIES_NONE) // Don't load GFX of egg pokemon. return; monsPersonality = GetMonData(mon, MON_DATA_PERSONALITY); diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index b8d8c6866..d4975fd7b 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -4268,9 +4268,7 @@ static void Cmd_getexp(void) for (viaSentIn = 0, i = 0; i < PARTY_SIZE; i++) { - if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES) == SPECIES_NONE || GetMonData(&gPlayerParty[i], MON_DATA_HP) == 0) - continue; - if (GetMonData(&gPlayerParty[i], MON_DATA_IS_EGG)) + if (!IsValidForBattle(&gPlayerParty[i])) continue; if (gBitTable[i] & sentIn) viaSentIn++; @@ -4361,8 +4359,7 @@ static void Cmd_getexp(void) gBattleStruct->wildVictorySong++; } - if (GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_HP) - && !GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_IS_EGG)) + if (IsValidForBattle(&gPlayerParty[gBattleStruct->expGetterMonId])) { if (gBattleStruct->sentInPokes & 1) gBattleMoveDamage = *exp; diff --git a/src/reshow_battle_screen.c b/src/reshow_battle_screen.c index b24db3f87..e9b817ff2 100644 --- a/src/reshow_battle_screen.c +++ b/src/reshow_battle_screen.c @@ -256,9 +256,7 @@ static void CreateBattlerSprite(u8 battler) } else { - if (GetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_HP) == 0) - return; - if (GetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_IS_EGG)) + if (!IsValidForBattle(&gPlayerParty[gBattlerPartyIndexes[battler]])) return; SetMultiuseSpriteTemplateToPokemon(GetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_SPECIES), GetBattlerPosition(battler)); @@ -313,7 +311,7 @@ static void CreateHealthboxSprite(u8 battler) } else if (!(gBattleTypeFlags & BATTLE_TYPE_SAFARI)) { - if (GetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_HP) == 0 || GetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_IS_EGG)) + if (!IsValidForBattle(&gPlayerParty[gBattlerPartyIndexes[battler]])) SetHealthboxSpriteInvisible(healthboxSpriteId); } }