Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Battle Debug Menu Score/Dmg Cycle Battlers #4134

Merged
merged 2 commits into from
Feb 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 39 additions & 14 deletions src/battle_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -764,6 +764,22 @@ static void PutMovesPointsText(struct BattleDebugMenu *data)
Free(text);
}

static void CleanUpAiInfoWindow(u8 taskId)
{
u32 i;
struct BattleDebugMenu *data = GetStructPtr(taskId);

FreeMonIconPalettes();
for (i = 0; i < MAX_BATTLERS_COUNT; i++)
{
if (data->spriteIds.aiIconSpriteIds[i] != 0xFF)
FreeAndDestroyMonIconSprite(&gSprites[data->spriteIds.aiIconSpriteIds[i]]);
}
FreeAndDestroyMonPicSprite(data->aiMonSpriteId);
ClearWindowTilemap(data->aiMovesWindowId);
RemoveWindow(data->aiMovesWindowId);
}

static void Task_ShowAiPoints(u8 taskId)
{
u32 i, count;
Expand All @@ -784,6 +800,7 @@ static void Task_ShowAiPoints(u8 taskId)
if (++data->aiBattlerId >= gBattlersCount)
data->aiBattlerId = 0;
}
data->battlerId = data->aiBattlerId;

LoadMonIconPalettes();
for (count = 0, i = 0; i < MAX_BATTLERS_COUNT; i++)
Expand Down Expand Up @@ -822,7 +839,27 @@ static void Task_ShowAiPoints(u8 taskId)
break;
// Input
case 2:
if (JOY_NEW(SELECT_BUTTON | B_BUTTON))
if (JOY_NEW(R_BUTTON) && IsDoubleBattle())
{
CleanUpAiInfoWindow(taskId);
do {
data->battlerId++;
data->battlerId %= gBattlersCount;
} while (!IsBattlerAlive(data->battlerId));
data->aiViewState = 0;
}
else if (JOY_NEW(L_BUTTON) && IsDoubleBattle())
{
CleanUpAiInfoWindow(taskId);
do {
if (data->battlerId == 0)
data->battlerId = gBattlersCount - 1;
else
data->battlerId--;
} while (!IsBattlerAlive(data->battlerId) || !BattlerHasAi(data->battlerId));
data->aiViewState = 0;
}
else if (JOY_NEW(SELECT_BUTTON | B_BUTTON))
{
SwitchToDebugView(taskId);
HideBg(1);
Expand Down Expand Up @@ -1093,19 +1130,7 @@ static void SwitchToDebugViewFromAiParty(u8 taskId)

static void SwitchToDebugView(u8 taskId)
{
u32 i;
struct BattleDebugMenu *data = GetStructPtr(taskId);

FreeMonIconPalettes();
for (i = 0; i < MAX_BATTLERS_COUNT; i++)
{
if (data->spriteIds.aiIconSpriteIds[i] != 0xFF)
FreeAndDestroyMonIconSprite(&gSprites[data->spriteIds.aiIconSpriteIds[i]]);
}
FreeAndDestroyMonPicSprite(data->aiMonSpriteId);
ClearWindowTilemap(data->aiMovesWindowId);
RemoveWindow(data->aiMovesWindowId);

CleanUpAiInfoWindow(taskId);
gTasks[taskId].func = Task_DebugMenuProcessInput;
}

Expand Down
Loading