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) static s8 AdvanceMonIndex(s8 delta)
{ {
struct Pokemon *mon = sMonSummaryScreen->monList.mons; struct Pokemon *mon = sMonSummaryScreen->monList.mons;
u8 index = sMonSummaryScreen->curMonIndex;
u8 numMons = sMonSummaryScreen->maxMonIndex + 1;
delta += numMons;
if (sMonSummaryScreen->currPageIndex == PSS_PAGE_INFO) index = (index + delta) % numMons;
{
if (delta == -1 && sMonSummaryScreen->curMonIndex == 0) // skip over any Eggs unless on the Info Page
return -1; if (sMonSummaryScreen->currPageIndex != PSS_PAGE_INFO)
else if (delta == 1 && sMonSummaryScreen->curMonIndex >= sMonSummaryScreen->maxMonIndex) 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; return -1;
else else
return sMonSummaryScreen->curMonIndex + delta;
}
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; return index;
}
} }
static s8 AdvanceMultiBattleMonIndex(s8 delta) static s8 AdvanceMultiBattleMonIndex(s8 delta)