mirror of
https://github.com/rh-hideout/pokeemerald-expansion.git
synced 2026-05-20 05:28:08 -05:00
Reduce battle heap usge outside main battle screen (#9906)
Some checks failed
CI / build-emerald (push) Has been cancelled
CI / build-firered (push) Has been cancelled
CI / build-leafgreen (push) Has been cancelled
CI / release (push) Has been cancelled
CI / test (push) Has been cancelled
CI / docs_validate (push) Has been cancelled
CI / allcontributors (push) Has been cancelled
CI / build (push) Has been cancelled
Some checks failed
CI / build-emerald (push) Has been cancelled
CI / build-firered (push) Has been cancelled
CI / build-leafgreen (push) Has been cancelled
CI / release (push) Has been cancelled
CI / test (push) Has been cancelled
CI / docs_validate (push) Has been cancelled
CI / allcontributors (push) Has been cancelled
CI / build (push) Has been cancelled
This commit is contained in:
parent
8c5cbb1363
commit
63fbcce1cd
|
|
@ -6,5 +6,7 @@ void FreeBattleResources(void);
|
|||
void AdjustFriendshipOnBattleFaint(enum BattlerId battler);
|
||||
void SwitchPartyOrderInGameMulti(enum BattlerId battler, u8 arg1);
|
||||
u32 BattlePalace_TryEscapeStatus(enum BattlerId battler);
|
||||
void AllocateBattleGfxResources(void);
|
||||
void CloseMainBattleScreen(void);
|
||||
|
||||
#endif // GUARD_BATTLE_UTIL_H
|
||||
|
|
|
|||
|
|
@ -302,7 +302,7 @@ static void OpenPartyMenuToChooseMon(enum BattlerId battler)
|
|||
gBattlerControllerFuncs[battler] = WaitForMonSelection;
|
||||
caseId = gTasks[gBattleControllerData[battler]].data[0];
|
||||
DestroyTask(gBattleControllerData[battler]);
|
||||
FreeAllWindowBuffers();
|
||||
CloseMainBattleScreen();
|
||||
OpenPartyMenuInBattle(caseId);
|
||||
}
|
||||
}
|
||||
|
|
@ -325,7 +325,7 @@ static void OpenBagAndChooseItem(enum BattlerId battler)
|
|||
{
|
||||
gBattlerControllerFuncs[battler] = CompleteWhenChoseItem;
|
||||
ReshowBattleScreenDummy();
|
||||
FreeAllWindowBuffers();
|
||||
CloseMainBattleScreen();
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_FIRST_BATTLE)
|
||||
CB2_BagMenuFromBattle();
|
||||
else
|
||||
|
|
|
|||
|
|
@ -1587,7 +1587,7 @@ static void OpenPartyMenuToChooseMon(enum BattlerId battler)
|
|||
gBattlerControllerFuncs[battler] = WaitForMonSelection;
|
||||
caseId = gTasks[gBattleControllerData[battler]].data[0];
|
||||
DestroyTask(gBattleControllerData[battler]);
|
||||
FreeAllWindowBuffers();
|
||||
CloseMainBattleScreen();
|
||||
OpenPartyMenuInBattle(caseId);
|
||||
}
|
||||
}
|
||||
|
|
@ -1614,7 +1614,7 @@ static void OpenBagAndChooseItem(enum BattlerId battler)
|
|||
{
|
||||
gBattlerControllerFuncs[battler] = CompleteWhenChoseItem;
|
||||
ReshowBattleScreenDummy();
|
||||
FreeAllWindowBuffers();
|
||||
CloseMainBattleScreen();
|
||||
CB2_BagMenuFromBattle();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -209,7 +209,7 @@ static void SafariOpenPokeblockCase(enum BattlerId battler)
|
|||
if (!gPaletteFade.active)
|
||||
{
|
||||
gBattlerControllerFuncs[battler] = CompleteWhenChosePokeblock;
|
||||
FreeAllWindowBuffers();
|
||||
CloseMainBattleScreen();
|
||||
OpenPokeblockCaseInBattle();
|
||||
}
|
||||
}
|
||||
|
|
@ -230,7 +230,7 @@ static void OpenPartyMenuToChooseMon(enum BattlerId battler)
|
|||
gBattlerControllerFuncs[battler] = WaitForMonSelection;
|
||||
u8 caseId = gTasks[gBattleControllerData[battler]].data[0];
|
||||
DestroyTask(gBattleControllerData[battler]);
|
||||
FreeAllWindowBuffers();
|
||||
CloseMainBattleScreen();
|
||||
OpenPartyMenuInBattle(caseId);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -191,7 +191,7 @@ static void OpenBagAfterPaletteFade(enum BattlerId battler)
|
|||
{
|
||||
gBattlerControllerFuncs[battler] = CompleteOnChosenItem;
|
||||
ReshowBattleScreenDummy();
|
||||
FreeAllWindowBuffers();
|
||||
CloseMainBattleScreen();
|
||||
DoWallyTutorialBagMenu();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5659,7 +5659,7 @@ static void TryEvolvePokemon(void)
|
|||
|
||||
if (species != SPECIES_NONE)
|
||||
{
|
||||
FreeAllWindowBuffers();
|
||||
CloseMainBattleScreen();
|
||||
gBattleMainFunc = WaitForEvoSceneToFinish;
|
||||
GetEvolutionTargetSpecies(&gParties[B_TRAINER_0][i], mode, evolutionItemArg, NULL, &canStopEvo, DO_EVO);
|
||||
EvolutionScene(&gParties[B_TRAINER_0][i], species, canStopEvo, i);
|
||||
|
|
|
|||
|
|
@ -5976,7 +5976,7 @@ static void Cmd_yesnoboxlearnmove(void)
|
|||
case 2:
|
||||
if (!gPaletteFade.active)
|
||||
{
|
||||
FreeAllWindowBuffers();
|
||||
CloseMainBattleScreen();
|
||||
ShowSelectMovePokemonSummaryScreen(gParties[B_TRAINER_0], gBattleStruct->expGetterMonId, ReshowBattleScreenAfterMenu, gMoveToLearn);
|
||||
gBattleScripting.learnMoveState++;
|
||||
}
|
||||
|
|
@ -11126,7 +11126,7 @@ static void Cmd_displaydexinfo(void)
|
|||
case 1:
|
||||
if (!gPaletteFade.active)
|
||||
{
|
||||
FreeAllWindowBuffers();
|
||||
CloseMainBattleScreen();
|
||||
gBattleCommunication[TASK_ID] = DisplayCaughtMonDexPage(species,
|
||||
GetMonData(mon, MON_DATA_IS_SHINY),
|
||||
GetMonData(mon, MON_DATA_PERSONALITY));
|
||||
|
|
@ -11284,7 +11284,7 @@ static void Cmd_trygivecaughtmonnick(void)
|
|||
{
|
||||
struct Pokemon *caughtMon = GetBattlerMon(gBattlerTarget);
|
||||
GetMonData(caughtMon, MON_DATA_NICKNAME, gBattleStruct->caughtMonNick);
|
||||
FreeAllWindowBuffers();
|
||||
CloseMainBattleScreen();
|
||||
MainCallback callback = CalculatePlayerPartyCount() == PARTY_SIZE ? ReshowBlankBattleScreenAfterMenu : BattleMainCB2;
|
||||
|
||||
DoNamingScreen(NAMING_SCREEN_CAUGHT_MON, gBattleStruct->caughtMonNick,
|
||||
|
|
|
|||
|
|
@ -11,8 +11,27 @@
|
|||
#include "constants/abilities.h"
|
||||
#include "random.h"
|
||||
#include "battle_scripts.h"
|
||||
#include "window.h"
|
||||
#include "constants/battle_string_ids.h"
|
||||
|
||||
void AllocateBattleGfxResources(void)
|
||||
{
|
||||
gBattleAnimBgTileBuffer = AllocZeroed(0x2000);
|
||||
gBattleAnimBgTilemapBuffer = AllocZeroed(0x1000);
|
||||
}
|
||||
|
||||
static void FreeBattleGfxResources(void)
|
||||
{
|
||||
FREE_AND_SET_NULL(gBattleAnimBgTileBuffer);
|
||||
FREE_AND_SET_NULL(gBattleAnimBgTilemapBuffer);
|
||||
}
|
||||
|
||||
void CloseMainBattleScreen(void)
|
||||
{
|
||||
FreeBattleGfxResources();
|
||||
FreeAllWindowBuffers();
|
||||
}
|
||||
|
||||
void AllocateBattleResources(void)
|
||||
{
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_TRAINER_TOWER && gMapHeader.regionMapSectionId == MAPSEC_TRAINER_TOWER_2)
|
||||
|
|
@ -40,8 +59,7 @@ void AllocateBattleResources(void)
|
|||
gLinkBattleSendBuffer = AllocZeroed(BATTLE_BUFFER_LINK_SIZE);
|
||||
gLinkBattleRecvBuffer = AllocZeroed(BATTLE_BUFFER_LINK_SIZE);
|
||||
|
||||
gBattleAnimBgTileBuffer = AllocZeroed(0x2000);
|
||||
gBattleAnimBgTilemapBuffer = AllocZeroed(0x1000);
|
||||
AllocateBattleGfxResources();
|
||||
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_SECRET_BASE)
|
||||
{
|
||||
|
|
@ -76,8 +94,7 @@ void FreeBattleResources(void)
|
|||
FREE_AND_SET_NULL(gLinkBattleSendBuffer);
|
||||
FREE_AND_SET_NULL(gLinkBattleRecvBuffer);
|
||||
|
||||
FREE_AND_SET_NULL(gBattleAnimBgTileBuffer);
|
||||
FREE_AND_SET_NULL(gBattleAnimBgTilemapBuffer);
|
||||
FreeBattleGfxResources();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ static void CB2_ReshowBattleScreenAfterMenu(void)
|
|||
case 0:
|
||||
ScanlineEffect_Clear();
|
||||
BattleInitBgsAndWindows();
|
||||
AllocateBattleGfxResources();
|
||||
SetBgAttribute(1, BG_ATTR_CHARBASEINDEX, 0);
|
||||
SetBgAttribute(2, BG_ATTR_CHARBASEINDEX, 0);
|
||||
ShowBg(0);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user