Merge pull request #1822 from AsparagusEduardo/pret/doc/typesEggGroups

Made Types and Egg Groups into arrays
This commit is contained in:
GriffinR 2023-01-15 00:27:20 -05:00 committed by GitHub
commit 18384894e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 845 additions and 1621 deletions

View File

@ -295,8 +295,7 @@ struct SpeciesInfo
/* 0x03 */ u8 baseSpeed; /* 0x03 */ u8 baseSpeed;
/* 0x04 */ u8 baseSpAttack; /* 0x04 */ u8 baseSpAttack;
/* 0x05 */ u8 baseSpDefense; /* 0x05 */ u8 baseSpDefense;
/* 0x06 */ u8 type1; /* 0x06 */ u8 types[2];
/* 0x07 */ u8 type2;
/* 0x08 */ u8 catchRate; /* 0x08 */ u8 catchRate;
/* 0x09 */ u8 expYield; /* 0x09 */ u8 expYield;
/* 0x0A */ u16 evYield_HP:2; /* 0x0A */ u16 evYield_HP:2;
@ -311,8 +310,7 @@ struct SpeciesInfo
/* 0x11 */ u8 eggCycles; /* 0x11 */ u8 eggCycles;
/* 0x12 */ u8 friendship; /* 0x12 */ u8 friendship;
/* 0x13 */ u8 growthRate; /* 0x13 */ u8 growthRate;
/* 0x14 */ u8 eggGroup1; /* 0x14 */ u8 eggGroups[2];
/* 0x15 */ u8 eggGroup2;
/* 0x16 */ u8 abilities[2]; /* 0x16 */ u8 abilities[2];
/* 0x18 */ u8 safariZoneFleeRate; /* 0x18 */ u8 safariZoneFleeRate;
/* 0x19 */ u8 bodyColor : 7; /* 0x19 */ u8 bodyColor : 7;

View File

@ -703,8 +703,8 @@ u8 GetMostSuitableMonToSwitchInto(void)
&& i != *(gBattleStruct->monToSwitchIntoId + battlerIn1) && i != *(gBattleStruct->monToSwitchIntoId + battlerIn1)
&& i != *(gBattleStruct->monToSwitchIntoId + battlerIn2)) && i != *(gBattleStruct->monToSwitchIntoId + battlerIn2))
{ {
u8 type1 = gSpeciesInfo[species].type1; u8 type1 = gSpeciesInfo[species].types[0];
u8 type2 = gSpeciesInfo[species].type2; u8 type2 = gSpeciesInfo[species].types[1];
u8 typeDmg = TYPE_MUL_NORMAL; u8 typeDmg = TYPE_MUL_NORMAL;
ModulateByTypeEffectiveness(gBattleMons[opposingBattler].type1, type1, type2, &typeDmg); ModulateByTypeEffectiveness(gBattleMons[opposingBattler].type1, type1, type2, &typeDmg);
ModulateByTypeEffectiveness(gBattleMons[opposingBattler].type2, type1, type2, &typeDmg); ModulateByTypeEffectiveness(gBattleMons[opposingBattler].type2, type1, type2, &typeDmg);

View File

@ -2348,8 +2348,8 @@ static void InitDomeTrainers(void)
rankingScores[0] += GetMonData(&gPlayerParty[trainerId], MON_DATA_SPDEF, NULL); rankingScores[0] += GetMonData(&gPlayerParty[trainerId], MON_DATA_SPDEF, NULL);
rankingScores[0] += GetMonData(&gPlayerParty[trainerId], MON_DATA_SPEED, NULL); rankingScores[0] += GetMonData(&gPlayerParty[trainerId], MON_DATA_SPEED, NULL);
rankingScores[0] += GetMonData(&gPlayerParty[trainerId], MON_DATA_MAX_HP, NULL); rankingScores[0] += GetMonData(&gPlayerParty[trainerId], MON_DATA_MAX_HP, NULL);
monTypesBits |= gBitTable[gSpeciesInfo[GetMonData(&gPlayerParty[trainerId], MON_DATA_SPECIES, NULL)].type1]; monTypesBits |= gBitTable[gSpeciesInfo[GetMonData(&gPlayerParty[trainerId], MON_DATA_SPECIES, NULL)].types[0]];
monTypesBits |= gBitTable[gSpeciesInfo[GetMonData(&gPlayerParty[trainerId], MON_DATA_SPECIES, NULL)].type2]; monTypesBits |= gBitTable[gSpeciesInfo[GetMonData(&gPlayerParty[trainerId], MON_DATA_SPECIES, NULL)].types[1]];
} }
// Count the number of types in the players party, to factor into the ranking // Count the number of types in the players party, to factor into the ranking
@ -2383,8 +2383,8 @@ static void InitDomeTrainers(void)
rankingScores[i] += statValues[STAT_SPDEF]; rankingScores[i] += statValues[STAT_SPDEF];
rankingScores[i] += statValues[STAT_SPEED]; rankingScores[i] += statValues[STAT_SPEED];
rankingScores[i] += statValues[STAT_HP]; rankingScores[i] += statValues[STAT_HP];
monTypesBits |= gBitTable[gSpeciesInfo[gFacilityTrainerMons[DOME_MONS[i][j]].species].type1]; monTypesBits |= gBitTable[gSpeciesInfo[gFacilityTrainerMons[DOME_MONS[i][j]].species].types[0]];
monTypesBits |= gBitTable[gSpeciesInfo[gFacilityTrainerMons[DOME_MONS[i][j]].species].type2]; monTypesBits |= gBitTable[gSpeciesInfo[gFacilityTrainerMons[DOME_MONS[i][j]].species].types[1]];
} }
for (monTypesCount = 0, j = 0; j < 32; j++) for (monTypesCount = 0, j = 0; j < 32; j++)
@ -2750,8 +2750,8 @@ static int GetTypeEffectivenessPoints(int move, int targetSpecies, int mode)
if (move == MOVE_NONE || move == MOVE_UNAVAILABLE || gBattleMoves[move].power == 0) if (move == MOVE_NONE || move == MOVE_UNAVAILABLE || gBattleMoves[move].power == 0)
return 0; return 0;
defType1 = gSpeciesInfo[targetSpecies].type1; defType1 = gSpeciesInfo[targetSpecies].types[0];
defType2 = gSpeciesInfo[targetSpecies].type2; defType2 = gSpeciesInfo[targetSpecies].types[1];
defAbility = gSpeciesInfo[targetSpecies].abilities[0]; defAbility = gSpeciesInfo[targetSpecies].abilities[0];
moveType = gBattleMoves[move].type; moveType = gBattleMoves[move].type;
@ -5883,8 +5883,8 @@ static void InitRandomTourneyTreeResults(void)
statSums[i] += statValues[STAT_SPDEF]; statSums[i] += statValues[STAT_SPDEF];
statSums[i] += statValues[STAT_SPEED]; statSums[i] += statValues[STAT_SPEED];
statSums[i] += statValues[STAT_HP]; statSums[i] += statValues[STAT_HP];
monTypesBits |= gBitTable[gSpeciesInfo[gFacilityTrainerMons[DOME_MONS[i][j]].species].type1]; monTypesBits |= gBitTable[gSpeciesInfo[gFacilityTrainerMons[DOME_MONS[i][j]].species].types[0]];
monTypesBits |= gBitTable[gSpeciesInfo[gFacilityTrainerMons[DOME_MONS[i][j]].species].type2]; monTypesBits |= gBitTable[gSpeciesInfo[gFacilityTrainerMons[DOME_MONS[i][j]].species].types[1]];
} }
// Because GF hates temporary vars, trainerId acts like monTypesCount here. // Because GF hates temporary vars, trainerId acts like monTypesCount here.

View File

@ -618,9 +618,9 @@ static void GetOpponentMostCommonMonType(void)
for (i = 0; i < FRONTIER_PARTY_SIZE; i++) for (i = 0; i < FRONTIER_PARTY_SIZE; i++)
{ {
u32 species = gFacilityTrainerMons[gFrontierTempParty[i]].species; u32 species = gFacilityTrainerMons[gFrontierTempParty[i]].species;
typeCounts[gSpeciesInfo[species].type1]++; typeCounts[gSpeciesInfo[species].types[0]]++;
if (gSpeciesInfo[species].type1 != gSpeciesInfo[species].type2) if (gSpeciesInfo[species].types[0] != gSpeciesInfo[species].types[1])
typeCounts[gSpeciesInfo[species].type2]++; typeCounts[gSpeciesInfo[species].types[1]]++;
} }
// Determine which are the two most-common types. // Determine which are the two most-common types.

View File

@ -3332,8 +3332,8 @@ void FaintClearSetData(void)
gBattleResources->flags->flags[gActiveBattler] = 0; gBattleResources->flags->flags[gActiveBattler] = 0;
gBattleMons[gActiveBattler].type1 = gSpeciesInfo[gBattleMons[gActiveBattler].species].type1; gBattleMons[gActiveBattler].type1 = gSpeciesInfo[gBattleMons[gActiveBattler].species].types[0];
gBattleMons[gActiveBattler].type2 = gSpeciesInfo[gBattleMons[gActiveBattler].species].type2; gBattleMons[gActiveBattler].type2 = gSpeciesInfo[gBattleMons[gActiveBattler].species].types[1];
ClearBattlerMoveHistory(gActiveBattler); ClearBattlerMoveHistory(gActiveBattler);
ClearBattlerAbilityHistory(gActiveBattler); ClearBattlerAbilityHistory(gActiveBattler);
@ -3400,8 +3400,8 @@ static void BattleIntroDrawTrainersOrMonsSprites(void)
for (i = 0; i < sizeof(struct BattlePokemon); i++) for (i = 0; i < sizeof(struct BattlePokemon); i++)
ptr[i] = gBattleBufferB[gActiveBattler][4 + i]; ptr[i] = gBattleBufferB[gActiveBattler][4 + i];
gBattleMons[gActiveBattler].type1 = gSpeciesInfo[gBattleMons[gActiveBattler].species].type1; gBattleMons[gActiveBattler].type1 = gSpeciesInfo[gBattleMons[gActiveBattler].species].types[0];
gBattleMons[gActiveBattler].type2 = gSpeciesInfo[gBattleMons[gActiveBattler].species].type2; gBattleMons[gActiveBattler].type2 = gSpeciesInfo[gBattleMons[gActiveBattler].species].types[1];
gBattleMons[gActiveBattler].ability = GetAbilityBySpecies(gBattleMons[gActiveBattler].species, gBattleMons[gActiveBattler].abilityNum); gBattleMons[gActiveBattler].ability = GetAbilityBySpecies(gBattleMons[gActiveBattler].species, gBattleMons[gActiveBattler].abilityNum);
hpOnSwitchout = &gBattleStruct->hpOnSwitchout[GetBattlerSide(gActiveBattler)]; hpOnSwitchout = &gBattleStruct->hpOnSwitchout[GetBattlerSide(gActiveBattler)];
*hpOnSwitchout = gBattleMons[gActiveBattler].hp; *hpOnSwitchout = gBattleMons[gActiveBattler].hp;

View File

@ -845,21 +845,21 @@ static bool8 DoesTypePreventStatus(u16 species, u32 status)
switch (status) switch (status)
{ {
case STATUS1_TOXIC_POISON: case STATUS1_TOXIC_POISON:
if (gSpeciesInfo[species].type1 == TYPE_STEEL || gSpeciesInfo[species].type1 == TYPE_POISON if (gSpeciesInfo[species].types[0] == TYPE_STEEL || gSpeciesInfo[species].types[0] == TYPE_POISON
|| gSpeciesInfo[species].type2 == TYPE_STEEL || gSpeciesInfo[species].type2 == TYPE_POISON) || gSpeciesInfo[species].types[1] == TYPE_STEEL || gSpeciesInfo[species].types[1] == TYPE_POISON)
ret = TRUE; ret = TRUE;
break; break;
case STATUS1_FREEZE: case STATUS1_FREEZE:
if (gSpeciesInfo[species].type1 == TYPE_ICE || gSpeciesInfo[species].type2 == TYPE_ICE) if (gSpeciesInfo[species].types[0] == TYPE_ICE || gSpeciesInfo[species].types[1] == TYPE_ICE)
ret = TRUE; ret = TRUE;
break; break;
case STATUS1_PARALYSIS: case STATUS1_PARALYSIS:
if (gSpeciesInfo[species].type1 == TYPE_GROUND || gSpeciesInfo[species].type1 == TYPE_ELECTRIC if (gSpeciesInfo[species].types[0] == TYPE_GROUND || gSpeciesInfo[species].types[0] == TYPE_ELECTRIC
|| gSpeciesInfo[species].type2 == TYPE_GROUND || gSpeciesInfo[species].type2 == TYPE_ELECTRIC) || gSpeciesInfo[species].types[1] == TYPE_GROUND || gSpeciesInfo[species].types[1] == TYPE_ELECTRIC)
ret = TRUE; ret = TRUE;
break; break;
case STATUS1_BURN: case STATUS1_BURN:
if (gSpeciesInfo[species].type1 == TYPE_FIRE || gSpeciesInfo[species].type2 == TYPE_FIRE) if (gSpeciesInfo[species].types[0] == TYPE_FIRE || gSpeciesInfo[species].types[1] == TYPE_FIRE)
ret = TRUE; ret = TRUE;
break; break;
case STATUS1_SLEEP: case STATUS1_SLEEP:

View File

@ -1595,7 +1595,7 @@ u8 AI_TypeCalc(u16 move, u16 targetSpecies, u8 targetAbility)
{ {
s32 i = 0; s32 i = 0;
u8 flags = 0; u8 flags = 0;
u8 type1 = gSpeciesInfo[targetSpecies].type1, type2 = gSpeciesInfo[targetSpecies].type2; u8 type1 = gSpeciesInfo[targetSpecies].types[0], type2 = gSpeciesInfo[targetSpecies].types[1];
u8 moveType; u8 moveType;
if (move == MOVE_STRUGGLE) if (move == MOVE_STRUGGLE)
@ -4604,8 +4604,8 @@ static void Cmd_switchindataupdate(void)
for (i = 0; i < sizeof(struct BattlePokemon); i++) for (i = 0; i < sizeof(struct BattlePokemon); i++)
monData[i] = gBattleBufferB[gActiveBattler][4 + i]; monData[i] = gBattleBufferB[gActiveBattler][4 + i];
gBattleMons[gActiveBattler].type1 = gSpeciesInfo[gBattleMons[gActiveBattler].species].type1; gBattleMons[gActiveBattler].type1 = gSpeciesInfo[gBattleMons[gActiveBattler].species].types[0];
gBattleMons[gActiveBattler].type2 = gSpeciesInfo[gBattleMons[gActiveBattler].species].type2; gBattleMons[gActiveBattler].type2 = gSpeciesInfo[gBattleMons[gActiveBattler].species].types[1];
gBattleMons[gActiveBattler].ability = GetAbilityBySpecies(gBattleMons[gActiveBattler].species, gBattleMons[gActiveBattler].abilityNum); gBattleMons[gActiveBattler].ability = GetAbilityBySpecies(gBattleMons[gActiveBattler].species, gBattleMons[gActiveBattler].abilityNum);
// check knocked off item // check knocked off item

View File

@ -5320,7 +5320,7 @@ static void SetMoveSpecificAnimData(u8 contestant)
switch (move) switch (move)
{ {
case MOVE_CURSE: case MOVE_CURSE:
if (gSpeciesInfo[species].type1 == TYPE_GHOST || gSpeciesInfo[species].type2 == TYPE_GHOST) if (gSpeciesInfo[species].types[0] == TYPE_GHOST || gSpeciesInfo[species].types[1] == TYPE_GHOST)
gAnimMoveTurn = 0; gAnimMoveTurn = 0;
else else
gAnimMoveTurn = 1; gAnimMoveTurn = 1;

File diff suppressed because it is too large Load Diff

View File

@ -1031,8 +1031,8 @@ static u8 GetDaycareCompatibilityScore(struct DayCare *daycare)
trainerIds[i] = GetBoxMonData(&daycare->mons[i].mon, MON_DATA_OT_ID); trainerIds[i] = GetBoxMonData(&daycare->mons[i].mon, MON_DATA_OT_ID);
personality = GetBoxMonData(&daycare->mons[i].mon, MON_DATA_PERSONALITY); personality = GetBoxMonData(&daycare->mons[i].mon, MON_DATA_PERSONALITY);
genders[i] = GetGenderFromSpeciesAndPersonality(species[i], personality); genders[i] = GetGenderFromSpeciesAndPersonality(species[i], personality);
eggGroups[i][0] = gSpeciesInfo[species[i]].eggGroup1; eggGroups[i][0] = gSpeciesInfo[species[i]].eggGroups[0];
eggGroups[i][1] = gSpeciesInfo[species[i]].eggGroup2; eggGroups[i][1] = gSpeciesInfo[species[i]].eggGroups[1];
} }
// check unbreedable egg group // check unbreedable egg group

View File

@ -1196,7 +1196,7 @@ void IsGrassTypeInParty(void)
if (GetMonData(pokemon, MON_DATA_SANITY_HAS_SPECIES) && !GetMonData(pokemon, MON_DATA_IS_EGG)) if (GetMonData(pokemon, MON_DATA_SANITY_HAS_SPECIES) && !GetMonData(pokemon, MON_DATA_IS_EGG))
{ {
species = GetMonData(pokemon, MON_DATA_SPECIES); species = GetMonData(pokemon, MON_DATA_SPECIES);
if (gSpeciesInfo[species].type1 == TYPE_GRASS || gSpeciesInfo[species].type2 == TYPE_GRASS) if (gSpeciesInfo[species].types[0] == TYPE_GRASS || gSpeciesInfo[species].types[1] == TYPE_GRASS)
{ {
gSpecialVar_Result = TRUE; gSpecialVar_Result = TRUE;
return; return;

View File

@ -4727,8 +4727,8 @@ static int DoPokedexSearch(u8 dexMode, u8 order, u8 abcGroup, u8 bodyColor, u8 t
{ {
species = NationalPokedexNumToSpecies(sPokedexView->pokedexList[i].dexNum); species = NationalPokedexNumToSpecies(sPokedexView->pokedexList[i].dexNum);
types[0] = gSpeciesInfo[species].type1; types[0] = gSpeciesInfo[species].types[0];
types[1] = gSpeciesInfo[species].type2; types[1] = gSpeciesInfo[species].types[1];
if (types[0] == type1 || types[1] == type1) if (types[0] == type1 || types[1] == type1)
{ {
sPokedexView->pokedexList[resultsCount] = sPokedexView->pokedexList[i]; sPokedexView->pokedexList[resultsCount] = sPokedexView->pokedexList[i];
@ -4745,8 +4745,8 @@ static int DoPokedexSearch(u8 dexMode, u8 order, u8 abcGroup, u8 bodyColor, u8 t
{ {
species = NationalPokedexNumToSpecies(sPokedexView->pokedexList[i].dexNum); species = NationalPokedexNumToSpecies(sPokedexView->pokedexList[i].dexNum);
types[0] = gSpeciesInfo[species].type1; types[0] = gSpeciesInfo[species].types[0];
types[1] = gSpeciesInfo[species].type2; types[1] = gSpeciesInfo[species].types[1];
if ((types[0] == type1 && types[1] == type2) || (types[0] == type2 && types[1] == type1)) if ((types[0] == type1 && types[1] == type2) || (types[0] == type2 && types[1] == type1))
{ {
sPokedexView->pokedexList[resultsCount] = sPokedexView->pokedexList[i]; sPokedexView->pokedexList[resultsCount] = sPokedexView->pokedexList[i];

View File

@ -4651,8 +4651,8 @@ void CopyPlayerPartyMonToBattleData(u8 battlerId, u8 partyIndex)
gBattleMons[battlerId].isEgg = GetMonData(&gPlayerParty[partyIndex], MON_DATA_IS_EGG, NULL); gBattleMons[battlerId].isEgg = GetMonData(&gPlayerParty[partyIndex], MON_DATA_IS_EGG, NULL);
gBattleMons[battlerId].abilityNum = GetMonData(&gPlayerParty[partyIndex], MON_DATA_ABILITY_NUM, NULL); gBattleMons[battlerId].abilityNum = GetMonData(&gPlayerParty[partyIndex], MON_DATA_ABILITY_NUM, NULL);
gBattleMons[battlerId].otId = GetMonData(&gPlayerParty[partyIndex], MON_DATA_OT_ID, NULL); gBattleMons[battlerId].otId = GetMonData(&gPlayerParty[partyIndex], MON_DATA_OT_ID, NULL);
gBattleMons[battlerId].type1 = gSpeciesInfo[gBattleMons[battlerId].species].type1; gBattleMons[battlerId].type1 = gSpeciesInfo[gBattleMons[battlerId].species].types[0];
gBattleMons[battlerId].type2 = gSpeciesInfo[gBattleMons[battlerId].species].type2; gBattleMons[battlerId].type2 = gSpeciesInfo[gBattleMons[battlerId].species].types[1];
gBattleMons[battlerId].ability = GetAbilityBySpecies(gBattleMons[battlerId].species, gBattleMons[battlerId].abilityNum); gBattleMons[battlerId].ability = GetAbilityBySpecies(gBattleMons[battlerId].species, gBattleMons[battlerId].abilityNum);
GetMonData(&gPlayerParty[partyIndex], MON_DATA_NICKNAME, nickname); GetMonData(&gPlayerParty[partyIndex], MON_DATA_NICKNAME, nickname);
StringCopy_Nickname(gBattleMons[battlerId].nickname, nickname); StringCopy_Nickname(gBattleMons[battlerId].nickname, nickname);

View File

@ -3789,10 +3789,10 @@ static void SetMonTypeIcons(void)
} }
else else
{ {
SetTypeSpritePosAndPal(gSpeciesInfo[summary->species].type1, 120, 48, SPRITE_ARR_ID_TYPE); SetTypeSpritePosAndPal(gSpeciesInfo[summary->species].types[0], 120, 48, SPRITE_ARR_ID_TYPE);
if (gSpeciesInfo[summary->species].type1 != gSpeciesInfo[summary->species].type2) if (gSpeciesInfo[summary->species].types[0] != gSpeciesInfo[summary->species].types[1])
{ {
SetTypeSpritePosAndPal(gSpeciesInfo[summary->species].type2, 160, 48, SPRITE_ARR_ID_TYPE + 1); SetTypeSpritePosAndPal(gSpeciesInfo[summary->species].types[1], 160, 48, SPRITE_ARR_ID_TYPE + 1);
SetSpriteInvisibility(SPRITE_ARR_ID_TYPE + 1, FALSE); SetSpriteInvisibility(SPRITE_ARR_ID_TYPE + 1, FALSE);
} }
else else

View File

@ -2465,8 +2465,8 @@ int GetUnionRoomTradeMessageId(struct RfuGameCompatibilityData player, struct Rf
else else
{ {
// Player's Pokémon must be of the type the partner requested // Player's Pokémon must be of the type the partner requested
if (gSpeciesInfo[playerSpecies2].type1 != requestedType if (gSpeciesInfo[playerSpecies2].types[0] != requestedType
&& gSpeciesInfo[playerSpecies2].type2 != requestedType) && gSpeciesInfo[playerSpecies2].types[1] != requestedType)
return UR_TRADE_MSG_NOT_MON_PARTNER_WANTS; return UR_TRADE_MSG_NOT_MON_PARTNER_WANTS;
} }

View File

@ -4187,7 +4187,7 @@ static s32 IsRequestedTradeInPlayerParty(u32 type, u32 species)
for (i = 0; i < gPlayerPartyCount; i++) for (i = 0; i < gPlayerPartyCount; i++)
{ {
species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2); species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2);
if (gSpeciesInfo[species].type1 == type || gSpeciesInfo[species].type2 == type) if (gSpeciesInfo[species].types[0] == type || gSpeciesInfo[species].types[1] == type)
return UR_TRADE_MATCH; return UR_TRADE_MATCH;
} }
return UR_TRADE_NOTYPE; return UR_TRADE_NOTYPE;

View File

@ -913,7 +913,7 @@ static bool8 TryGetRandomWildMonIndexByType(const struct WildPokemon *wildMon, u
for (validMonCount = 0, i = 0; i < numMon; i++) for (validMonCount = 0, i = 0; i < numMon; i++)
{ {
if (gSpeciesInfo[wildMon[i].species].type1 == type || gSpeciesInfo[wildMon[i].species].type2 == type) if (gSpeciesInfo[wildMon[i].species].types[0] == type || gSpeciesInfo[wildMon[i].species].types[1] == type)
validIndexes[validMonCount++] = i; validIndexes[validMonCount++] = i;
} }