Added X/Y-style wrapping summary screen

This commit is contained in:
Ninjdai 2023-11-11 00:24:25 +01:00
parent ee34b4f09d
commit 304447ee2d

View File

@ -1778,28 +1778,22 @@ static void Task_ChangeSummaryMon(u8 taskId)
static s8 AdvanceMonIndex(s8 delta)
{
struct Pokemon *mon = sMonSummaryScreen->monList.mons;
u8 index = sMonSummaryScreen->curMonIndex;
u8 numMons = sMonSummaryScreen->maxMonIndex + 1;
delta += numMons;
if (sMonSummaryScreen->currPageIndex == PSS_PAGE_INFO)
{
if (delta == -1 && sMonSummaryScreen->curMonIndex == 0)
return -1;
else if (delta == 1 && sMonSummaryScreen->curMonIndex >= sMonSummaryScreen->maxMonIndex)
return -1;
else
return sMonSummaryScreen->curMonIndex + delta;
}
index = (index + delta) % numMons;
// skip over any Eggs unless on the Info Page
if (sMonSummaryScreen->currPageIndex != PSS_PAGE_INFO)
while (GetMonData(&mon[index], MON_DATA_IS_EGG))
index = (index + delta) % numMons;
// to avoid "scrolling" to the same Pokemon
if (index == sMonSummaryScreen->curMonIndex)
return -1;
else
{
s8 index = sMonSummaryScreen->curMonIndex;
do
{
index += delta;
if (index < 0 || index > sMonSummaryScreen->maxMonIndex)
return -1;
} while (GetMonData(&mon[index], MON_DATA_IS_EGG));
return index;
}
}
static s8 AdvanceMultiBattleMonIndex(s8 delta)