Clean up some frontier mon use in battle factory
This commit is contained in:
@@ -57,7 +57,7 @@
|
||||
|
||||
struct FactorySelecteableMon
|
||||
{
|
||||
u16 monSetId;
|
||||
u16 monId;
|
||||
u16 spriteId;
|
||||
u8 selectedId; // 0 - not selected, 1 - first pokemon, 2 - second pokemon, 3 - third pokemon
|
||||
struct Pokemon monData;
|
||||
@@ -168,7 +168,7 @@ static u8 sub_819BC9C(void);
|
||||
static u8 Select_OptionSummary(void);
|
||||
static u8 Select_OptionOthers(void);
|
||||
static u8 Select_OptionRentDeselect(void);
|
||||
static bool32 Select_AreSpeciesValid(u16 monSetId);
|
||||
static bool32 Select_AreSpeciesValid(u16 monId);
|
||||
static void Swap_DestroyAllSprites(void);
|
||||
static void Swap_ShowYesNoOptions(void);
|
||||
static void sub_819E8EC(void);
|
||||
@@ -1665,7 +1665,7 @@ static void CreateFrontierFactorySelectableMons(u8 firstMonId)
|
||||
u8 battleMode = VarGet(VAR_FRONTIER_BATTLE_MODE);
|
||||
u8 lvlMode = gSaveBlock2Ptr->frontier.lvlMode;
|
||||
u8 challengeNum = gSaveBlock2Ptr->frontier.factoryWinStreaks[battleMode][lvlMode] / 7;
|
||||
u8 var_28 = 0;
|
||||
u8 rentalRank = 0;
|
||||
|
||||
gFacilityTrainerMons = gBattleFrontierMons;
|
||||
if (gSaveBlock2Ptr->frontier.lvlMode != FRONTIER_LVL_50)
|
||||
@@ -1673,29 +1673,29 @@ static void CreateFrontierFactorySelectableMons(u8 firstMonId)
|
||||
else
|
||||
level = 50;
|
||||
|
||||
var_28 = GetNumPastRentalsRank(battleMode, lvlMode);
|
||||
rentalRank = GetNumPastRentalsRank(battleMode, lvlMode);
|
||||
otId = T1_READ_32(gSaveBlock2Ptr->playerTrainerId);
|
||||
|
||||
for (i = 0; i < SELECTABLE_MONS_COUNT; i++)
|
||||
{
|
||||
u16 monSetId = gSaveBlock2Ptr->frontier.rentalMons[i].monId;
|
||||
sFactorySelectScreen->mons[i + firstMonId].monSetId = monSetId;
|
||||
if (i < var_28)
|
||||
u16 monId = gSaveBlock2Ptr->frontier.rentalMons[i].monId;
|
||||
sFactorySelectScreen->mons[i + firstMonId].monId = monId;
|
||||
if (i < rentalRank)
|
||||
ivs = GetFactoryMonFixedIV(challengeNum + 1, 0);
|
||||
else
|
||||
ivs = GetFactoryMonFixedIV(challengeNum, 0);
|
||||
CreateMonWithEVSpreadNatureOTID(&sFactorySelectScreen->mons[i + firstMonId].monData,
|
||||
gFacilityTrainerMons[monSetId].species,
|
||||
gFacilityTrainerMons[monId].species,
|
||||
level,
|
||||
gFacilityTrainerMons[monSetId].nature,
|
||||
gFacilityTrainerMons[monId].nature,
|
||||
ivs,
|
||||
gFacilityTrainerMons[monSetId].evSpread,
|
||||
gFacilityTrainerMons[monId].evSpread,
|
||||
otId);
|
||||
happiness = 0;
|
||||
for (j = 0; j < MAX_MON_MOVES; j++)
|
||||
SetMonMoveAvoidReturn(&sFactorySelectScreen->mons[i + firstMonId].monData, gFacilityTrainerMons[monSetId].moves[j], j);
|
||||
SetMonMoveAvoidReturn(&sFactorySelectScreen->mons[i + firstMonId].monData, gFacilityTrainerMons[monId].moves[j], j);
|
||||
SetMonData(&sFactorySelectScreen->mons[i + firstMonId].monData, MON_DATA_FRIENDSHIP, &happiness);
|
||||
SetMonData(&sFactorySelectScreen->mons[i + firstMonId].monData, MON_DATA_HELD_ITEM, &gBattleFrontierHeldItems[gFacilityTrainerMons[monSetId].itemTableId]);
|
||||
SetMonData(&sFactorySelectScreen->mons[i + firstMonId].monData, MON_DATA_HELD_ITEM, &gBattleFrontierHeldItems[gFacilityTrainerMons[monId].itemTableId]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1712,20 +1712,20 @@ static void CreateTentFactorySelectableMons(u8 firstMonId)
|
||||
|
||||
for (i = 0; i < SELECTABLE_MONS_COUNT; i++)
|
||||
{
|
||||
u16 monSetId = gSaveBlock2Ptr->frontier.rentalMons[i].monId;
|
||||
sFactorySelectScreen->mons[i + firstMonId].monSetId = monSetId;
|
||||
u16 monId = gSaveBlock2Ptr->frontier.rentalMons[i].monId;
|
||||
sFactorySelectScreen->mons[i + firstMonId].monId = monId;
|
||||
CreateMonWithEVSpreadNatureOTID(&sFactorySelectScreen->mons[i + firstMonId].monData,
|
||||
gFacilityTrainerMons[monSetId].species,
|
||||
gFacilityTrainerMons[monId].species,
|
||||
level,
|
||||
gFacilityTrainerMons[monSetId].nature,
|
||||
gFacilityTrainerMons[monId].nature,
|
||||
ivs,
|
||||
gFacilityTrainerMons[monSetId].evSpread,
|
||||
gFacilityTrainerMons[monId].evSpread,
|
||||
otId);
|
||||
happiness = 0;
|
||||
for (j = 0; j < MAX_MON_MOVES; j++)
|
||||
SetMonMoveAvoidReturn(&sFactorySelectScreen->mons[i + firstMonId].monData, gFacilityTrainerMons[monSetId].moves[j], j);
|
||||
SetMonMoveAvoidReturn(&sFactorySelectScreen->mons[i + firstMonId].monData, gFacilityTrainerMons[monId].moves[j], j);
|
||||
SetMonData(&sFactorySelectScreen->mons[i + firstMonId].monData, MON_DATA_FRIENDSHIP, &happiness);
|
||||
SetMonData(&sFactorySelectScreen->mons[i + firstMonId].monData, MON_DATA_HELD_ITEM, &gBattleFrontierHeldItems[gFacilityTrainerMons[monSetId].itemTableId]);
|
||||
SetMonData(&sFactorySelectScreen->mons[i + firstMonId].monData, MON_DATA_HELD_ITEM, &gBattleFrontierHeldItems[gFacilityTrainerMons[monId].itemTableId]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1740,7 +1740,7 @@ static void Select_CopyMonsToPlayerParty(void)
|
||||
if (sFactorySelectScreen->mons[j].selectedId == i + 1)
|
||||
{
|
||||
gPlayerParty[i] = sFactorySelectScreen->mons[j].monData;
|
||||
gSaveBlock2Ptr->frontier.rentalMons[i].monId = sFactorySelectScreen->mons[j].monSetId;
|
||||
gSaveBlock2Ptr->frontier.rentalMons[i].monId = sFactorySelectScreen->mons[j].monId;
|
||||
gSaveBlock2Ptr->frontier.rentalMons[i].personality = GetMonData(&gPlayerParty[i], MON_DATA_PERSONALITY, NULL);
|
||||
gSaveBlock2Ptr->frontier.rentalMons[i].abilityNum = GetBoxMonData(&gPlayerParty[i].box, MON_DATA_ABILITY_NUM, NULL);
|
||||
gSaveBlock2Ptr->frontier.rentalMons[i].ivs = GetBoxMonData(&gPlayerParty[i].box, MON_DATA_ATK_IV, NULL);
|
||||
@@ -1871,8 +1871,8 @@ static u8 Select_RunMenuOptionFunc(void)
|
||||
static u8 Select_OptionRentDeselect(void)
|
||||
{
|
||||
u8 selectedId = sFactorySelectScreen->mons[sFactorySelectScreen->cursorPos].selectedId;
|
||||
u16 monSetId = sFactorySelectScreen->mons[sFactorySelectScreen->cursorPos].monSetId;
|
||||
if (selectedId == 0 && !Select_AreSpeciesValid(monSetId))
|
||||
u16 monId = sFactorySelectScreen->mons[sFactorySelectScreen->cursorPos].monId;
|
||||
if (selectedId == 0 && !Select_AreSpeciesValid(monId))
|
||||
{
|
||||
Select_PrintCantSelectSameMon();
|
||||
sub_819B958(3);
|
||||
@@ -2160,10 +2160,10 @@ static void Select_SetWinRegs(s16 mWin0H, s16 nWin0H, s16 mWin0V, s16 nWin0V)
|
||||
SetGpuReg(REG_OFFSET_WINOUT, WINOUT_WIN01_BG0 | WINOUT_WIN01_BG1 | WINOUT_WIN01_BG2 | WINOUT_WIN01_CLR | WINOUT_WIN01_OBJ);
|
||||
}
|
||||
|
||||
static bool32 Select_AreSpeciesValid(u16 monSetId)
|
||||
static bool32 Select_AreSpeciesValid(u16 monId)
|
||||
{
|
||||
u8 i, j;
|
||||
u32 species = gFacilityTrainerMons[monSetId].species;
|
||||
u32 species = gFacilityTrainerMons[monId].species;
|
||||
u8 selectState = sFactorySelectScreen->selectingMonsState;
|
||||
|
||||
for (i = 1; i < selectState; i++)
|
||||
@@ -2172,7 +2172,7 @@ static bool32 Select_AreSpeciesValid(u16 monSetId)
|
||||
{
|
||||
if (sFactorySelectScreen->mons[j].selectedId == i)
|
||||
{
|
||||
if (gFacilityTrainerMons[sFactorySelectScreen->mons[j].monSetId].species == species)
|
||||
if (gFacilityTrainerMons[sFactorySelectScreen->mons[j].monId].species == species)
|
||||
return FALSE;
|
||||
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user