Merge pull request #1317 from ultima-soul/form_species_tables_ie

Add Form Species ID Tables
This commit is contained in:
ghoulslash 2021-01-20 13:54:58 -07:00 committed by GitHub
commit 9b1a482837
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 495 additions and 0 deletions

View File

@ -4,6 +4,8 @@
#include "constants/pokemon.h"
#include "sprite.h"
#define GET_BASE_SPECIES_ID(speciesId) (GetFormSpeciesId(speciesId, 0))
struct PokemonSubstruct0
{
/*0x00*/ u16 species;
@ -419,5 +421,7 @@ bool8 HasTwoFramesAnimation(u16 species);
struct Unknown_806F160_Struct *sub_806F2AC(u8 id, u8 arg1);
void sub_806F47C(u8 id);
u8 *sub_806F4F8(u8 id, u8 arg1);
u16 GetFormSpeciesId(u16 speciesId, u8 formId);
u8 GetFormIdFromFormSpeciesId(u16 formSpeciesId);
#endif // GUARD_POKEMON_H

View File

@ -0,0 +1,80 @@
const u16 *const gFormSpeciesIdTables[NUM_SPECIES] =
{
[SPECIES_VENUSAUR] = sVenusaurFormSpeciesIdTable,
[SPECIES_CHARIZARD] = sCharizardFormSpeciesIdTable,
[SPECIES_BLASTOISE] = sBlastoiseFormSpeciesIdTable,
[SPECIES_BEEDRILL] = sBeedrillFormSpeciesIdTable,
[SPECIES_PIDGEOT] = sPidgeotFormSpeciesIdTable,
[SPECIES_RATTATA] = sRattataFormSpeciesIdTable,
[SPECIES_RATICATE] = sRaticateFormSpeciesIdTable,
[SPECIES_PIKACHU] = sPikachuFormSpeciesIdTable,
[SPECIES_RAICHU] = sRaichuFormSpeciesIdTable,
[SPECIES_SANDSHREW] = sSandshrewFormSpeciesIdTable,
[SPECIES_SANDSLASH] = sSandslashFormSpeciesIdTable,
[SPECIES_VULPIX] = sVulpixFormSpeciesIdTable,
[SPECIES_NINETALES] = sNinetalesFormSpeciesIdTable,
[SPECIES_DIGLETT] = sDiglettFormSpeciesIdTable,
[SPECIES_DUGTRIO] = sDugtrioFormSpeciesIdTable,
[SPECIES_MEOWTH] = sMeowthFormSpeciesIdTable,
[SPECIES_PERSIAN] = sPersianFormSpeciesIdTable,
[SPECIES_ALAKAZAM] = sAlakazamFormSpeciesIdTable,
[SPECIES_GEODUDE] = sGeodudeFormSpeciesIdTable,
[SPECIES_GRAVELER] = sGravelerFormSpeciesIdTable,
[SPECIES_GOLEM] = sGolemFormSpeciesIdTable,
[SPECIES_PONYTA] = sPonytaFormSpeciesIdTable,
[SPECIES_RAPIDASH] = sRapidashFormSpeciesIdTable,
[SPECIES_SLOWPOKE] = sSlowpokeFormSpeciesIdTable,
[SPECIES_SLOWBRO] = sSlowbroFormSpeciesIdTable,
[SPECIES_FARFETCHD] = sFarfetchdFormSpeciesIdTable,
[SPECIES_GRIMER] = sGrimerFormSpeciesIdTable,
[SPECIES_MUK] = sMukFormSpeciesIdTable,
[SPECIES_GENGAR] = sGengarFormSpeciesIdTable,
[SPECIES_EXEGGUTOR] = sExeggutorFormSpeciesIdTable,
[SPECIES_MAROWAK] = sMarowakFormSpeciesIdTable,
[SPECIES_WEEZING] = sWeezingFormSpeciesIdTable,
[SPECIES_KANGASKHAN] = sKangaskhanFormSpeciesIdTable,
[SPECIES_MR_MIME] = sMrMimeFormSpeciesIdTable,
[SPECIES_PINSIR] = sPinsirFormSpeciesIdTable,
[SPECIES_GYARADOS] = sGyaradosFormSpeciesIdTable,
[SPECIES_AERODACTYL] = sAerodactylFormSpeciesIdTable,
[SPECIES_ARTICUNO] = sArticunoFormSpeciesIdTable,
[SPECIES_ZAPDOS] = sZapdosFormSpeciesIdTable,
[SPECIES_MOLTRES] = sMoltresFormSpeciesIdTable,
[SPECIES_MEWTWO] = sMewtwoFormSpeciesIdTable,
[SPECIES_PICHU] = sPichuFormSpeciesIdTable,
[SPECIES_AMPHAROS] = sAmpharosFormSpeciesIdTable,
[SPECIES_SLOWKING] = sSlowkingFormSpeciesIdTable,
[SPECIES_UNOWN] = sUnownFormSpeciesIdTable,
[SPECIES_STEELIX] = sSteelixFormSpeciesIdTable,
[SPECIES_SCIZOR] = sScizorFormSpeciesIdTable,
[SPECIES_HERACROSS] = sHeracrossFormSpeciesIdTable,
[SPECIES_CORSOLA] = sCorsolaFormSpeciesIdTable,
[SPECIES_HOUNDOOM] = sHoundoomFormSpeciesIdTable,
[SPECIES_TYRANITAR] = sTyranitarFormSpeciesIdTable,
[SPECIES_SCEPTILE] = sSceptileFormSpeciesIdTable,
[SPECIES_BLAZIKEN] = sBlazikenFormSpeciesIdTable,
[SPECIES_SWAMPERT] = sSwampertFormSpeciesIdTable,
[SPECIES_ZIGZAGOON] = sZigzagoonFormSpeciesIdTable,
[SPECIES_LINOONE] = sLinooneFormSpeciesIdTable,
[SPECIES_GARDEVOIR] = sGardevoirFormSpeciesIdTable,
[SPECIES_SABLEYE] = sSableyeFormSpeciesIdTable,
[SPECIES_MAWILE] = sMawileFormSpeciesIdTable,
[SPECIES_AGGRON] = sAggronFormSpeciesIdTable,
[SPECIES_MEDICHAM] = sMedichamFormSpeciesIdTable,
[SPECIES_MANECTRIC] = sManectricFormSpeciesIdTable,
[SPECIES_SHARPEDO] = sSharpedoFormSpeciesIdTable,
[SPECIES_CAMERUPT] = sCameruptFormSpeciesIdTable,
[SPECIES_ALTARIA] = sAltariaFormSpeciesIdTable,
[SPECIES_CASTFORM] = sCastformFormSpeciesIdTable,
[SPECIES_BANETTE] = sBanetteFormSpeciesIdTable,
[SPECIES_ABSOL] = sAbsolFormSpeciesIdTable,
[SPECIES_GLALIE] = sGlalieFormSpeciesIdTable,
[SPECIES_SALAMENCE] = sSalamenceFormSpeciesIdTable,
[SPECIES_METAGROSS] = sMetagrossFormSpeciesIdTable,
[SPECIES_LATIAS] = sLatiasFormSpeciesIdTable,
[SPECIES_LATIOS] = sLatiosFormSpeciesIdTable,
[SPECIES_KYOGRE] = sKyogreFormSpeciesIdTable,
[SPECIES_GROUDON] = sGroudonFormSpeciesIdTable,
[SPECIES_RAYQUAZA] = sRayquazaFormSpeciesIdTable,
[SPECIES_DEOXYS] = sDeoxysFormSpeciesIdTable,
};

View File

@ -0,0 +1,386 @@
#define FORM_SPECIES_END (0xffff)
static const u16 sVenusaurFormSpeciesIdTable[] = {
SPECIES_VENUSAUR,
FORM_SPECIES_END,
};
static const u16 sCharizardFormSpeciesIdTable[] = {
SPECIES_CHARIZARD,
FORM_SPECIES_END,
};
static const u16 sBlastoiseFormSpeciesIdTable[] = {
SPECIES_BLASTOISE,
FORM_SPECIES_END,
};
static const u16 sBeedrillFormSpeciesIdTable[] = {
SPECIES_BEEDRILL,
FORM_SPECIES_END,
};
static const u16 sPidgeotFormSpeciesIdTable[] = {
SPECIES_PIDGEOT,
FORM_SPECIES_END,
};
static const u16 sRattataFormSpeciesIdTable[] = {
SPECIES_RATTATA,
FORM_SPECIES_END,
};
static const u16 sRaticateFormSpeciesIdTable[] = {
SPECIES_RATICATE,
FORM_SPECIES_END,
};
static const u16 sPikachuFormSpeciesIdTable[] = {
SPECIES_PIKACHU,
FORM_SPECIES_END,
};
static const u16 sRaichuFormSpeciesIdTable[] = {
SPECIES_RAICHU,
FORM_SPECIES_END,
};
static const u16 sSandshrewFormSpeciesIdTable[] = {
SPECIES_SANDSHREW,
FORM_SPECIES_END,
};
static const u16 sSandslashFormSpeciesIdTable[] = {
SPECIES_SANDSLASH,
FORM_SPECIES_END,
};
static const u16 sVulpixFormSpeciesIdTable[] = {
SPECIES_VULPIX,
FORM_SPECIES_END,
};
static const u16 sNinetalesFormSpeciesIdTable[] = {
SPECIES_NINETALES,
FORM_SPECIES_END,
};
static const u16 sDiglettFormSpeciesIdTable[] = {
SPECIES_DIGLETT,
FORM_SPECIES_END,
};
static const u16 sDugtrioFormSpeciesIdTable[] = {
SPECIES_DUGTRIO,
FORM_SPECIES_END,
};
static const u16 sMeowthFormSpeciesIdTable[] = {
SPECIES_MEOWTH,
FORM_SPECIES_END,
};
static const u16 sPersianFormSpeciesIdTable[] = {
SPECIES_PERSIAN,
FORM_SPECIES_END,
};
static const u16 sAlakazamFormSpeciesIdTable[] = {
SPECIES_ALAKAZAM,
FORM_SPECIES_END,
};
static const u16 sGeodudeFormSpeciesIdTable[] = {
SPECIES_GEODUDE,
FORM_SPECIES_END,
};
static const u16 sGravelerFormSpeciesIdTable[] = {
SPECIES_GRAVELER,
FORM_SPECIES_END,
};
static const u16 sGolemFormSpeciesIdTable[] = {
SPECIES_GOLEM,
FORM_SPECIES_END,
};
static const u16 sPonytaFormSpeciesIdTable[] = {
SPECIES_PONYTA,
FORM_SPECIES_END,
};
static const u16 sRapidashFormSpeciesIdTable[] = {
SPECIES_RAPIDASH,
FORM_SPECIES_END,
};
static const u16 sSlowpokeFormSpeciesIdTable[] = {
SPECIES_SLOWPOKE,
FORM_SPECIES_END,
};
static const u16 sSlowbroFormSpeciesIdTable[] = {
SPECIES_SLOWBRO,
FORM_SPECIES_END,
};
static const u16 sFarfetchdFormSpeciesIdTable[] = {
SPECIES_FARFETCHD,
FORM_SPECIES_END,
};
static const u16 sGrimerFormSpeciesIdTable[] = {
SPECIES_GRIMER,
FORM_SPECIES_END,
};
static const u16 sMukFormSpeciesIdTable[] = {
SPECIES_MUK,
FORM_SPECIES_END,
};
static const u16 sGengarFormSpeciesIdTable[] = {
SPECIES_GENGAR,
FORM_SPECIES_END,
};
static const u16 sExeggutorFormSpeciesIdTable[] = {
SPECIES_EXEGGUTOR,
FORM_SPECIES_END,
};
static const u16 sMarowakFormSpeciesIdTable[] = {
SPECIES_MAROWAK,
FORM_SPECIES_END,
};
static const u16 sWeezingFormSpeciesIdTable[] = {
SPECIES_WEEZING,
FORM_SPECIES_END,
};
static const u16 sKangaskhanFormSpeciesIdTable[] = {
SPECIES_KANGASKHAN,
FORM_SPECIES_END,
};
static const u16 sMrMimeFormSpeciesIdTable[] = {
SPECIES_MR_MIME,
FORM_SPECIES_END,
};
static const u16 sPinsirFormSpeciesIdTable[] = {
SPECIES_PINSIR,
FORM_SPECIES_END,
};
static const u16 sGyaradosFormSpeciesIdTable[] = {
SPECIES_GYARADOS,
FORM_SPECIES_END,
};
static const u16 sAerodactylFormSpeciesIdTable[] = {
SPECIES_AERODACTYL,
FORM_SPECIES_END,
};
static const u16 sArticunoFormSpeciesIdTable[] = {
SPECIES_ARTICUNO,
FORM_SPECIES_END,
};
static const u16 sZapdosFormSpeciesIdTable[] = {
SPECIES_ZAPDOS,
FORM_SPECIES_END,
};
static const u16 sMoltresFormSpeciesIdTable[] = {
SPECIES_MOLTRES,
FORM_SPECIES_END,
};
static const u16 sMewtwoFormSpeciesIdTable[] = {
SPECIES_MEWTWO,
FORM_SPECIES_END,
};
static const u16 sPichuFormSpeciesIdTable[] = {
SPECIES_PICHU,
FORM_SPECIES_END,
};
static const u16 sAmpharosFormSpeciesIdTable[] = {
SPECIES_AMPHAROS,
FORM_SPECIES_END,
};
static const u16 sSlowkingFormSpeciesIdTable[] = {
SPECIES_SLOWKING,
FORM_SPECIES_END,
};
static const u16 sUnownFormSpeciesIdTable[] = {
SPECIES_UNOWN,
FORM_SPECIES_END,
};
static const u16 sSteelixFormSpeciesIdTable[] = {
SPECIES_STEELIX,
FORM_SPECIES_END,
};
static const u16 sScizorFormSpeciesIdTable[] = {
SPECIES_SCIZOR,
FORM_SPECIES_END,
};
static const u16 sHeracrossFormSpeciesIdTable[] = {
SPECIES_HERACROSS,
FORM_SPECIES_END,
};
static const u16 sCorsolaFormSpeciesIdTable[] = {
SPECIES_CORSOLA,
FORM_SPECIES_END,
};
static const u16 sHoundoomFormSpeciesIdTable[] = {
SPECIES_HOUNDOOM,
FORM_SPECIES_END,
};
static const u16 sTyranitarFormSpeciesIdTable[] = {
SPECIES_TYRANITAR,
FORM_SPECIES_END,
};
static const u16 sSceptileFormSpeciesIdTable[] = {
SPECIES_SCEPTILE,
FORM_SPECIES_END,
};
static const u16 sBlazikenFormSpeciesIdTable[] = {
SPECIES_BLAZIKEN,
FORM_SPECIES_END,
};
static const u16 sSwampertFormSpeciesIdTable[] = {
SPECIES_SWAMPERT,
FORM_SPECIES_END,
};
static const u16 sZigzagoonFormSpeciesIdTable[] = {
SPECIES_ZIGZAGOON,
FORM_SPECIES_END,
};
static const u16 sLinooneFormSpeciesIdTable[] = {
SPECIES_LINOONE,
FORM_SPECIES_END,
};
static const u16 sGardevoirFormSpeciesIdTable[] = {
SPECIES_GARDEVOIR,
FORM_SPECIES_END,
};
static const u16 sSableyeFormSpeciesIdTable[] = {
SPECIES_SABLEYE,
FORM_SPECIES_END,
};
static const u16 sMawileFormSpeciesIdTable[] = {
SPECIES_MAWILE,
FORM_SPECIES_END,
};
static const u16 sAggronFormSpeciesIdTable[] = {
SPECIES_AGGRON,
FORM_SPECIES_END,
};
static const u16 sMedichamFormSpeciesIdTable[] = {
SPECIES_MEDICHAM,
FORM_SPECIES_END,
};
static const u16 sManectricFormSpeciesIdTable[] = {
SPECIES_MANECTRIC,
FORM_SPECIES_END,
};
static const u16 sSharpedoFormSpeciesIdTable[] = {
SPECIES_SHARPEDO,
FORM_SPECIES_END,
};
static const u16 sCameruptFormSpeciesIdTable[] = {
SPECIES_CAMERUPT,
FORM_SPECIES_END,
};
static const u16 sAltariaFormSpeciesIdTable[] = {
SPECIES_ALTARIA,
FORM_SPECIES_END,
};
static const u16 sCastformFormSpeciesIdTable[] = {
SPECIES_CASTFORM,
FORM_SPECIES_END,
};
static const u16 sBanetteFormSpeciesIdTable[] = {
SPECIES_BANETTE,
FORM_SPECIES_END,
};
static const u16 sAbsolFormSpeciesIdTable[] = {
SPECIES_ABSOL,
FORM_SPECIES_END,
};
static const u16 sGlalieFormSpeciesIdTable[] = {
SPECIES_GLALIE,
FORM_SPECIES_END,
};
static const u16 sSalamenceFormSpeciesIdTable[] = {
SPECIES_SALAMENCE,
FORM_SPECIES_END,
};
static const u16 sMetagrossFormSpeciesIdTable[] = {
SPECIES_METAGROSS,
FORM_SPECIES_END,
};
static const u16 sLatiasFormSpeciesIdTable[] = {
SPECIES_LATIAS,
FORM_SPECIES_END,
};
static const u16 sLatiosFormSpeciesIdTable[] = {
SPECIES_LATIOS,
FORM_SPECIES_END,
};
static const u16 sKyogreFormSpeciesIdTable[] = {
SPECIES_KYOGRE,
FORM_SPECIES_END,
};
static const u16 sGroudonFormSpeciesIdTable[] = {
SPECIES_GROUDON,
FORM_SPECIES_END,
};
static const u16 sRayquazaFormSpeciesIdTable[] = {
SPECIES_RAYQUAZA,
FORM_SPECIES_END,
};
static const u16 sDeoxysFormSpeciesIdTable[] = {
SPECIES_DEOXYS,
FORM_SPECIES_END,
};

View File

@ -1386,6 +1386,8 @@ const s8 gNatureStatTable[NUM_NATURES][NUM_NATURE_STATS] =
#include "data/pokemon/level_up_learnsets.h"
#include "data/pokemon/evolution.h"
#include "data/pokemon/level_up_learnset_pointers.h"
#include "data/pokemon/form_species_tables.h"
#include "data/pokemon/form_species_table_pointers.h"
// SPECIES_NONE are ignored in the following two tables, so decrement before accessing these arrays to get the right result
@ -7013,3 +7015,26 @@ u8 *sub_806F4F8(u8 id, u8 arg1)
return structPtr->byteArrays[arg1];
}
}
u16 GetFormSpeciesId(u16 speciesId, u8 formId)
{
if (gFormSpeciesIdTables[speciesId] != NULL)
return gFormSpeciesIdTables[speciesId][formId];
else
return speciesId;
}
u8 GetFormIdFromFormSpeciesId(u16 formSpeciesId)
{
u8 targetFormId = 0;
if (gFormSpeciesIdTables[formSpeciesId] != NULL)
{
for (targetFormId = 0; gFormSpeciesIdTables[formSpeciesId][targetFormId] != FORM_SPECIES_END; targetFormId++)
{
if (formSpeciesId == gFormSpeciesIdTables[formSpeciesId][targetFormId])
break;
}
}
return targetFormId;
}