Requested change from pkmn to mon

This commit is contained in:
tustin2121 2019-11-04 11:38:09 -05:00 committed by huderlem
parent 2fe9d7a81f
commit d4582cb874

View File

@ -128,16 +128,16 @@ enum
TDE_TASK_A_ID = 2,
};
#define NUM_PKMN_SLIDES 71
#define NUM_MON_SLIDES 71
struct CreditsData
{
u16 pkmnToShow[NUM_PKMN_SLIDES]; // List of Pokemon species ids that will show during the credits
u16 monToShow[NUM_MON_SLIDES]; // List of Pokemon species ids that will show during the credits
u16 imgCounter; //how many mon images have been shown
u16 nextImgPos; //if the next image spawns left/center/right
u16 currShownPkmn; //index into pkmnToShow
u16 numPkmnToShow; //number of pokemon to show, always NUM_PKMN_SLIDES after determine function
u16 caughtPkmnIds[NATIONAL_DEX_COUNT]; //temporary location to hold a condensed array of all caught pokemon
u16 numCaughtPkmn; //count of filled spaces in caughtPkmnIds
u16 currShownMon; //index into monToShow
u16 numMonToShow; //number of pokemon to show, always NUM_MON_SLIDES after determine function
u16 caughtMonIds[NATIONAL_DEX_COUNT]; //temporary location to hold a condensed array of all caught pokemon
u16 numCaughtMon; //count of filled spaces in caughtMonIds
u16 unk39C[7]; // unused padding?
};
@ -1248,7 +1248,7 @@ void CB2_StartCreditsSequence(void)
sCreditsData->imgCounter = 0;
sCreditsData->nextImgPos = 0;
sCreditsData->currShownPkmn = 0;
sCreditsData->currShownMon = 0;
gUnknown_0203BCE2 = taskIdA;
}
@ -1689,17 +1689,17 @@ static void sub_81760FC(u8 taskIdD)
gTasks[taskIdD].data[TDD_STATE]++;
break;
case 2:
if (sCreditsData->imgCounter == NUM_PKMN_SLIDES || gTasks[gTasks[taskIdD].data[TDD_TASK_A_ID]].func != Task_ProgressCreditTasks)
if (sCreditsData->imgCounter == NUM_MON_SLIDES || gTasks[gTasks[taskIdD].data[TDD_TASK_A_ID]].func != Task_ProgressCreditTasks)
break;
r2 = MakeMonSprite(sCreditsData->pkmnToShow[sCreditsData->currShownPkmn], sMonSpritePos[sCreditsData->nextImgPos][0], sMonSpritePos[sCreditsData->nextImgPos][1], sCreditsData->nextImgPos);
if (sCreditsData->currShownPkmn < sCreditsData->numPkmnToShow - 1)
r2 = MakeMonSprite(sCreditsData->monToShow[sCreditsData->currShownMon], sMonSpritePos[sCreditsData->nextImgPos][0], sMonSpritePos[sCreditsData->nextImgPos][1], sCreditsData->nextImgPos);
if (sCreditsData->currShownMon < sCreditsData->numMonToShow - 1)
{
sCreditsData->currShownPkmn++;
sCreditsData->currShownMon++;
gSprites[r2].data[3] = 50;
}
else
{
sCreditsData->currShownPkmn = 0;
sCreditsData->currShownMon = 0;
gSprites[r2].data[3] = 512;
}
sCreditsData->imgCounter++;
@ -2306,73 +2306,73 @@ static void DeterminePokemonToShow(void)
{
if (GetSetPokedexFlag(dexNum, FLAG_GET_CAUGHT))
{
sCreditsData->caughtPkmnIds[j] = dexNum;
sCreditsData->caughtMonIds[j] = dexNum;
j++;
}
}
// Fill the rest of the array with zeroes
for (dexNum = j; dexNum < NATIONAL_DEX_COUNT; dexNum++)
sCreditsData->caughtPkmnIds[dexNum] = 0;
sCreditsData->caughtMonIds[dexNum] = 0;
// Cap the number of pokemon we care about to NUM_PKMN_SLIDES, the max we show in the credits scene (-1 for the starter)
sCreditsData->numCaughtPkmn = j;
if (sCreditsData->numCaughtPkmn < NUM_PKMN_SLIDES)
sCreditsData->numPkmnToShow = j;
// Cap the number of pokemon we care about to NUM_MON_SLIDES, the max we show in the credits scene (-1 for the starter)
sCreditsData->numCaughtMon = j;
if (sCreditsData->numCaughtMon < NUM_MON_SLIDES)
sCreditsData->numMonToShow = j;
else
sCreditsData->numPkmnToShow = NUM_PKMN_SLIDES;
sCreditsData->numMonToShow = NUM_MON_SLIDES;
// Loop through our list of caught pokemon and select randomly from it to fill the images to show
j = 0;
do
{
// Select a random mon, insert into array
page = Random() % sCreditsData->numCaughtPkmn;
sCreditsData->pkmnToShow[j] = sCreditsData->caughtPkmnIds[page];
page = Random() % sCreditsData->numCaughtMon;
sCreditsData->monToShow[j] = sCreditsData->caughtMonIds[page];
// Remove the select mon from the array, and condense array entries
j++;
sCreditsData->caughtPkmnIds[page] = 0;
sCreditsData->numCaughtPkmn--;
if (page != sCreditsData->numCaughtPkmn)
sCreditsData->caughtMonIds[page] = 0;
sCreditsData->numCaughtMon--;
if (page != sCreditsData->numCaughtMon)
{
// Instead of looping through and moving everything down, just take from the end. Order doesn't matter after all.
sCreditsData->caughtPkmnIds[page] = sCreditsData->caughtPkmnIds[sCreditsData->numCaughtPkmn];
sCreditsData->caughtPkmnIds[sCreditsData->numCaughtPkmn] = 0;
sCreditsData->caughtMonIds[page] = sCreditsData->caughtMonIds[sCreditsData->numCaughtMon];
sCreditsData->caughtMonIds[sCreditsData->numCaughtMon] = 0;
}
}
while (sCreditsData->numCaughtPkmn != 0 && j < NUM_PKMN_SLIDES);
while (sCreditsData->numCaughtMon != 0 && j < NUM_MON_SLIDES);
// If we don't have enough pokemon in the dex to fill everything, copy the selected mon into the end of the array, so it loops
if (sCreditsData->numPkmnToShow < NUM_PKMN_SLIDES)
if (sCreditsData->numMonToShow < NUM_MON_SLIDES)
{
for (j = sCreditsData->numPkmnToShow, page = 0; j < NUM_PKMN_SLIDES; j++)
for (j = sCreditsData->numMonToShow, page = 0; j < NUM_MON_SLIDES; j++)
{
sCreditsData->pkmnToShow[j] = sCreditsData->pkmnToShow[page];
sCreditsData->monToShow[j] = sCreditsData->monToShow[page];
page++;
if (page == sCreditsData->numPkmnToShow)
if (page == sCreditsData->numMonToShow)
page = 0;
}
// Ensure the last pokemon is our starter
sCreditsData->pkmnToShow[NUM_PKMN_SLIDES-1] = starter;
sCreditsData->monToShow[NUM_MON_SLIDES-1] = starter;
}
else
{
// Check to see if our starter has already appeared in this list, break if it has
for (dexNum = 0; sCreditsData->pkmnToShow[dexNum] != starter && dexNum < NUM_PKMN_SLIDES; dexNum++);
for (dexNum = 0; sCreditsData->monToShow[dexNum] != starter && dexNum < NUM_MON_SLIDES; dexNum++);
// If it has, swap it with the last pokemon, to ensure our starter is the last image
if (dexNum < sCreditsData->numPkmnToShow - 1)
if (dexNum < sCreditsData->numMonToShow - 1)
{
sCreditsData->pkmnToShow[dexNum] = sCreditsData->pkmnToShow[NUM_PKMN_SLIDES-1];
sCreditsData->pkmnToShow[NUM_PKMN_SLIDES-1] = starter;
sCreditsData->monToShow[dexNum] = sCreditsData->monToShow[NUM_MON_SLIDES-1];
sCreditsData->monToShow[NUM_MON_SLIDES-1] = starter;
}
else
{
// Ensure the last pokemon is our starter
sCreditsData->pkmnToShow[NUM_PKMN_SLIDES-1] = starter;
sCreditsData->monToShow[NUM_MON_SLIDES-1] = starter;
}
}
sCreditsData->numPkmnToShow = NUM_PKMN_SLIDES;
sCreditsData->numMonToShow = NUM_MON_SLIDES;
}