Merge branch 'master' of https://github.com/pret/pokeemerald into constants-num-frames

This commit is contained in:
GriffinR
2023-02-01 15:59:02 -05:00
890 changed files with 40310 additions and 37715 deletions

View File

@@ -1388,7 +1388,7 @@ const s8 gNatureStatTable[NUM_NATURES][NUM_NATURE_STATS] =
#include "data/pokemon/trainer_class_lookups.h"
#include "data/pokemon/cry_ids.h"
#include "data/pokemon/experience_tables.h"
#include "data/pokemon/base_stats.h"
#include "data/pokemon/species_info.h"
#include "data/pokemon/level_up_learnsets.h"
#include "data/pokemon/evolution.h"
#include "data/pokemon/level_up_learnset_pointers.h"
@@ -2245,8 +2245,8 @@ void CreateBoxMon(struct BoxPokemon *boxMon, u16 species, u8 level, u8 fixedIV,
SetBoxMonData(boxMon, MON_DATA_LANGUAGE, &gGameLanguage);
SetBoxMonData(boxMon, MON_DATA_OT_NAME, gSaveBlock2Ptr->playerName);
SetBoxMonData(boxMon, MON_DATA_SPECIES, &species);
SetBoxMonData(boxMon, MON_DATA_EXP, &gExperienceTables[gBaseStats[species].growthRate][level]);
SetBoxMonData(boxMon, MON_DATA_FRIENDSHIP, &gBaseStats[species].friendship);
SetBoxMonData(boxMon, MON_DATA_EXP, &gExperienceTables[gSpeciesInfo[species].growthRate][level]);
SetBoxMonData(boxMon, MON_DATA_FRIENDSHIP, &gSpeciesInfo[species].friendship);
value = GetCurrentRegionMapSectionId();
SetBoxMonData(boxMon, MON_DATA_MET_LOCATION, &value);
SetBoxMonData(boxMon, MON_DATA_MET_LEVEL, &level);
@@ -2286,7 +2286,7 @@ void CreateBoxMon(struct BoxPokemon *boxMon, u16 species, u8 level, u8 fixedIV,
SetBoxMonData(boxMon, MON_DATA_SPDEF_IV, &iv);
}
if (gBaseStats[species].abilities[1])
if (gSpeciesInfo[species].abilities[1])
{
value = personality & 1;
SetBoxMonData(boxMon, MON_DATA_ABILITY_NUM, &value);
@@ -2806,7 +2806,7 @@ static u16 CalculateBoxMonChecksum(struct BoxPokemon *boxMon)
#define CALC_STAT(base, iv, ev, statIndex, field) \
{ \
u8 baseStat = gBaseStats[species].base; \
u8 baseStat = gSpeciesInfo[species].base; \
s32 n = (((2 * baseStat + iv + ev / 4) * level) / 100) + 5; \
u8 nature = GetNature(mon); \
n = ModifyStatByNature(nature, n, statIndex); \
@@ -2841,7 +2841,7 @@ void CalculateMonStats(struct Pokemon *mon)
}
else
{
s32 n = 2 * gBaseStats[species].baseHP + hpIV;
s32 n = 2 * gSpeciesInfo[species].baseHP + hpIV;
newMaxHP = (((n + hpEV / 4) * level) / 100) + level + 10;
}
@@ -2901,7 +2901,7 @@ u8 GetLevelFromMonExp(struct Pokemon *mon)
u32 exp = GetMonData(mon, MON_DATA_EXP, NULL);
s32 level = 1;
while (level <= MAX_LEVEL && gExperienceTables[gBaseStats[species].growthRate][level] <= exp)
while (level <= MAX_LEVEL && gExperienceTables[gSpeciesInfo[species].growthRate][level] <= exp)
level++;
return level - 1;
@@ -2913,7 +2913,7 @@ u8 GetLevelFromBoxMonExp(struct BoxPokemon *boxMon)
u32 exp = GetBoxMonData(boxMon, MON_DATA_EXP, NULL);
s32 level = 1;
while (level <= MAX_LEVEL && gExperienceTables[gBaseStats[species].growthRate][level] <= exp)
while (level <= MAX_LEVEL && gExperienceTables[gSpeciesInfo[species].growthRate][level] <= exp)
level++;
return level - 1;
@@ -3442,15 +3442,15 @@ u8 GetBoxMonGender(struct BoxPokemon *boxMon)
u16 species = GetBoxMonData(boxMon, MON_DATA_SPECIES, NULL);
u32 personality = GetBoxMonData(boxMon, MON_DATA_PERSONALITY, NULL);
switch (gBaseStats[species].genderRatio)
switch (gSpeciesInfo[species].genderRatio)
{
case MON_MALE:
case MON_FEMALE:
case MON_GENDERLESS:
return gBaseStats[species].genderRatio;
return gSpeciesInfo[species].genderRatio;
}
if (gBaseStats[species].genderRatio > (personality & 0xFF))
if (gSpeciesInfo[species].genderRatio > (personality & 0xFF))
return MON_FEMALE;
else
return MON_MALE;
@@ -3458,15 +3458,15 @@ u8 GetBoxMonGender(struct BoxPokemon *boxMon)
u8 GetGenderFromSpeciesAndPersonality(u16 species, u32 personality)
{
switch (gBaseStats[species].genderRatio)
switch (gSpeciesInfo[species].genderRatio)
{
case MON_MALE:
case MON_FEMALE:
case MON_GENDERLESS:
return gBaseStats[species].genderRatio;
return gSpeciesInfo[species].genderRatio;
}
if (gBaseStats[species].genderRatio > (personality & 0xFF))
if (gSpeciesInfo[species].genderRatio > (personality & 0xFF))
return MON_FEMALE;
else
return MON_MALE;
@@ -4495,9 +4495,9 @@ u8 GetMonsStateToDoubles_2(void)
u8 GetAbilityBySpecies(u16 species, u8 abilityNum)
{
if (abilityNum)
gLastUsedAbility = gBaseStats[species].abilities[1];
gLastUsedAbility = gSpeciesInfo[species].abilities[1];
else
gLastUsedAbility = gBaseStats[species].abilities[0];
gLastUsedAbility = gSpeciesInfo[species].abilities[0];
return gLastUsedAbility;
}
@@ -4651,8 +4651,8 @@ void CopyPlayerPartyMonToBattleData(u8 battlerId, u8 partyIndex)
gBattleMons[battlerId].isEgg = GetMonData(&gPlayerParty[partyIndex], MON_DATA_IS_EGG, 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].type1 = gBaseStats[gBattleMons[battlerId].species].type1;
gBattleMons[battlerId].type2 = gBaseStats[gBattleMons[battlerId].species].type2;
gBattleMons[battlerId].type1 = gSpeciesInfo[gBattleMons[battlerId].species].types[0];
gBattleMons[battlerId].type2 = gSpeciesInfo[gBattleMons[battlerId].species].types[1];
gBattleMons[battlerId].ability = GetAbilityBySpecies(gBattleMons[battlerId].species, gBattleMons[battlerId].abilityNum);
GetMonData(&gPlayerParty[partyIndex], MON_DATA_NICKNAME, nickname);
StringCopy_Nickname(gBattleMons[battlerId].nickname, nickname);
@@ -4869,7 +4869,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
if ((itemEffect[i] & ITEM3_LEVEL_UP)
&& GetMonData(mon, MON_DATA_LEVEL, NULL) != MAX_LEVEL)
{
dataUnsigned = gExperienceTables[gBaseStats[GetMonData(mon, MON_DATA_SPECIES, NULL)].growthRate][GetMonData(mon, MON_DATA_LEVEL, NULL) + 1];
dataUnsigned = gExperienceTables[gSpeciesInfo[GetMonData(mon, MON_DATA_SPECIES, NULL)].growthRate][GetMonData(mon, MON_DATA_LEVEL, NULL) + 1];
SetMonData(mon, MON_DATA_EXP, &dataUnsigned);
CalculateMonStats(mon);
retVal = FALSE;
@@ -5948,22 +5948,22 @@ void MonGainEVs(struct Pokemon *mon, u16 defeatedSpecies)
switch (i)
{
case STAT_HP:
evIncrease = gBaseStats[defeatedSpecies].evYield_HP * multiplier;
evIncrease = gSpeciesInfo[defeatedSpecies].evYield_HP * multiplier;
break;
case STAT_ATK:
evIncrease = gBaseStats[defeatedSpecies].evYield_Attack * multiplier;
evIncrease = gSpeciesInfo[defeatedSpecies].evYield_Attack * multiplier;
break;
case STAT_DEF:
evIncrease = gBaseStats[defeatedSpecies].evYield_Defense * multiplier;
evIncrease = gSpeciesInfo[defeatedSpecies].evYield_Defense * multiplier;
break;
case STAT_SPEED:
evIncrease = gBaseStats[defeatedSpecies].evYield_Speed * multiplier;
evIncrease = gSpeciesInfo[defeatedSpecies].evYield_Speed * multiplier;
break;
case STAT_SPATK:
evIncrease = gBaseStats[defeatedSpecies].evYield_SpAttack * multiplier;
evIncrease = gSpeciesInfo[defeatedSpecies].evYield_SpAttack * multiplier;
break;
case STAT_SPDEF:
evIncrease = gBaseStats[defeatedSpecies].evYield_SpDefense * multiplier;
evIncrease = gSpeciesInfo[defeatedSpecies].evYield_SpDefense * multiplier;
break;
}
@@ -6165,12 +6165,12 @@ bool8 TryIncrementMonLevel(struct Pokemon *mon)
u16 species = GetMonData(mon, MON_DATA_SPECIES, 0);
u8 nextLevel = GetMonData(mon, MON_DATA_LEVEL, 0) + 1;
u32 expPoints = GetMonData(mon, MON_DATA_EXP, 0);
if (expPoints > gExperienceTables[gBaseStats[species].growthRate][MAX_LEVEL])
if (expPoints > gExperienceTables[gSpeciesInfo[species].growthRate][MAX_LEVEL])
{
expPoints = gExperienceTables[gBaseStats[species].growthRate][MAX_LEVEL];
expPoints = gExperienceTables[gSpeciesInfo[species].growthRate][MAX_LEVEL];
SetMonData(mon, MON_DATA_EXP, &expPoints);
}
if (nextLevel > MAX_LEVEL || expPoints < gExperienceTables[gBaseStats[species].growthRate][nextLevel])
if (nextLevel > MAX_LEVEL || expPoints < gExperienceTables[gSpeciesInfo[species].growthRate][nextLevel])
{
return FALSE;
}
@@ -6494,7 +6494,7 @@ bool32 IsHMMove2(u16 move)
bool8 IsMonSpriteNotFlipped(u16 species)
{
return gBaseStats[species].noFlip;
return gSpeciesInfo[species].noFlip;
}
s8 GetMonFlavorRelation(struct Pokemon *mon, u8 flavor)
@@ -6615,26 +6615,26 @@ void SetWildMonHeldItem(void)
if (rnd < chanceNoItem)
return;
if (rnd < chanceNotRare)
SetMonData(&gEnemyParty[0], MON_DATA_HELD_ITEM, &gBaseStats[species].itemCommon);
SetMonData(&gEnemyParty[0], MON_DATA_HELD_ITEM, &gSpeciesInfo[species].itemCommon);
else
SetMonData(&gEnemyParty[0], MON_DATA_HELD_ITEM, &gBaseStats[species].itemRare);
SetMonData(&gEnemyParty[0], MON_DATA_HELD_ITEM, &gSpeciesInfo[species].itemRare);
}
}
else
{
if (gBaseStats[species].itemCommon == gBaseStats[species].itemRare && gBaseStats[species].itemCommon != ITEM_NONE)
if (gSpeciesInfo[species].itemCommon == gSpeciesInfo[species].itemRare && gSpeciesInfo[species].itemCommon != ITEM_NONE)
{
// Both held items are the same, 100% chance to hold item
SetMonData(&gEnemyParty[0], MON_DATA_HELD_ITEM, &gBaseStats[species].itemCommon);
SetMonData(&gEnemyParty[0], MON_DATA_HELD_ITEM, &gSpeciesInfo[species].itemCommon);
}
else
{
if (rnd < chanceNoItem)
return;
if (rnd < chanceNotRare)
SetMonData(&gEnemyParty[0], MON_DATA_HELD_ITEM, &gBaseStats[species].itemCommon);
SetMonData(&gEnemyParty[0], MON_DATA_HELD_ITEM, &gSpeciesInfo[species].itemCommon);
else
SetMonData(&gEnemyParty[0], MON_DATA_HELD_ITEM, &gBaseStats[species].itemRare);
SetMonData(&gEnemyParty[0], MON_DATA_HELD_ITEM, &gSpeciesInfo[species].itemRare);
}
}
}