From 43ba65ef8b733912cbbf73478b722787c528dab6 Mon Sep 17 00:00:00 2001 From: jiangzhengwenjz Date: Fri, 12 Jul 2019 09:59:49 +0800 Subject: document pokemon function symbols --- src/pokemon.c | 42 ++++++++++++++++++++---------------------- 1 file changed, 20 insertions(+), 22 deletions(-) (limited to 'src/pokemon.c') diff --git a/src/pokemon.c b/src/pokemon.c index b9b5e6d76..1482984f4 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -44,11 +44,10 @@ struct UnkStruct20244F4 }; // External symbols -extern struct UnkStruct20244F4 *gUnknown_20244F4; +extern struct UnkStruct20244F4 *sOakTutNidoranResources; extern struct SpriteTemplate gUnknown_825DEF0[]; extern struct SpriteTemplate gUnknown_825DF50[]; extern const union AnimCmd *const *const gTrainerBackAnimsPtrTable[]; -extern struct SpriteTemplate gUnknown_825DEF0[]; extern const union AnimCmd *const *const gTrainerFrontAnimsPtrTable[]; extern const union AnimCmd *const gUnknown_82349BC[]; extern const u8 gUnknown_825DEA1[]; @@ -90,7 +89,6 @@ extern u8 StorageGetCurrentBox(void); // pokemon_storage_system extern void sub_80174B8(u8 battlerId); union PokemonSubstruct *GetSubstruct(struct BoxPokemon *boxMon, u32 personality, u8 substructType); -s32 GetDeoxysStat(struct Pokemon *mon, s32 statId); // code void ZeroBoxMonData(struct BoxPokemon *boxMon) @@ -351,7 +349,7 @@ void CreateMonWithEVSpread(struct Pokemon *mon, u16 species, u8 level, u8 fixedI CalculateMonStats(mon); } -void sub_803E0A4(struct Pokemon *mon, struct BattleTowerPokemon *src) +void CreateBattleTowerMon(struct Pokemon *mon, struct BattleTowerPokemon *src) { s32 i; u8 value; @@ -476,7 +474,7 @@ u16 CalculateBoxMonChecksum(struct BoxPokemon *boxMon) u8 baseStat = gBaseStats[species].base; \ s32 n = (((2 * baseStat + iv + ev / 4) * level) / 100) + 5; \ u8 nature = GetNature(mon); \ - n = nature_stat_mod(nature, n, statIndex); \ + n = ModifyStatByNature(nature, n, statIndex); \ SetMonData(mon, field, &n); \ } @@ -1122,7 +1120,7 @@ u8 GetGenderFromSpeciesAndPersonality(u16 species, u32 personality) return MON_MALE; } -void SetMultiuseSpriteTemplateToPokemon(u16 trainerSpriteId, u8 battlerPosition) +void SetMultiuseSpriteTemplateToPokemon(u16 speciesTag, u8 battlerPosition) { if(gMonSpritesGfxPtr != NULL) { @@ -1133,12 +1131,12 @@ void SetMultiuseSpriteTemplateToPokemon(u16 trainerSpriteId, u8 battlerPosition) } else { - if(gUnknown_20244F4) + if(sOakTutNidoranResources) { - if(battlerPosition >= (s8)gUnknown_20244F4->unk0_2) // why a cast?!? changing the unk0_2 type to s8 causes extra shifts, but a cast is the correct fix. why, compiler? + if(battlerPosition >= (s8)sOakTutNidoranResources->unk0_2) // why a cast?!? changing the unk0_2 type to s8 causes extra shifts, but a cast is the correct fix. why, compiler? battlerPosition = 0; - gMultiuseSpriteTemplate = gUnknown_20244F4->unk10[battlerPosition]; + gMultiuseSpriteTemplate = sOakTutNidoranResources->unk10[battlerPosition]; } else { @@ -1148,7 +1146,7 @@ void SetMultiuseSpriteTemplateToPokemon(u16 trainerSpriteId, u8 battlerPosition) gMultiuseSpriteTemplate = gUnknown_825DEF0[battlerPosition]; } } - gMultiuseSpriteTemplate.paletteTag = trainerSpriteId; + gMultiuseSpriteTemplate.paletteTag = speciesTag; gMultiuseSpriteTemplate.anims = gUnknown_82349BC; } @@ -1290,27 +1288,27 @@ u32 GetMonData(struct Pokemon *mon, s32 field, u8* data) ret = mon->maxHP; break; case MON_DATA_ATK: - ret = (u16)GetDeoxysStat(mon, STAT_ATK); + ret = GetDeoxysStat(mon, STAT_ATK); if (!ret) ret = mon->attack; break; case MON_DATA_DEF: - ret = (u16)GetDeoxysStat(mon, STAT_DEF); + ret = GetDeoxysStat(mon, STAT_DEF); if (!ret) ret = mon->defense; break; case MON_DATA_SPEED: - ret = (u16)GetDeoxysStat(mon, STAT_SPEED); + ret = GetDeoxysStat(mon, STAT_SPEED); if (!ret) ret = mon->speed; break; case MON_DATA_SPATK: - ret = (u16)GetDeoxysStat(mon, STAT_SPATK); + ret = GetDeoxysStat(mon, STAT_SPATK); if (!ret) ret = mon->spAttack; break; case MON_DATA_SPDEF: - ret = (u16)GetDeoxysStat(mon, STAT_SPDEF); + ret = GetDeoxysStat(mon, STAT_SPDEF); if (!ret) ret = mon->spDefense; break; @@ -4928,7 +4926,7 @@ bool8 sub_80435E0(void) return retVal; } -bool8 sub_8043620(u8 id) +bool8 GetLinkTrainerFlankId(u8 id) { bool8 retVal = FALSE; switch (gLinkPlayers[id].id) @@ -4954,12 +4952,12 @@ s32 GetBankMultiplayerId(u16 a1) return id; } -u8 sub_804367C(u16 trainer) +u8 GetTrainerEncounterMusicId(u16 trainer) { return gTrainers[trainer].encounterMusic_gender & 0x7F; } -u16 nature_stat_mod(u8 nature, u16 n, u8 statIndex) +u16 ModifyStatByNature(u8 nature, u16 n, u8 statIndex) { if (statIndex < 1 || statIndex > 5) { @@ -5214,7 +5212,7 @@ void sub_8043B40(void) u8 foo[4]; // huh? } -void sub_8043B48(struct Pokemon *mon, int species, u8 unused, u32 data) +void SetMonExpWithMaxLevelCheck(struct Pokemon *mon, int species, u8 unused, u32 data) { if (data > gExperienceTables[gBaseStats[species].growthRate][100]) { @@ -5235,7 +5233,7 @@ bool8 TryIncrementMonLevel(struct Pokemon *mon) if(exp > gExperienceTables[gBaseStats[species].growthRate][newLevel]) { SetMonData(mon, MON_DATA_LEVEL, &newLevel); - sub_8043B48(mon, species, newLevel, exp); + SetMonExpWithMaxLevelCheck(mon, species, newLevel, exp); return TRUE; } else @@ -5243,7 +5241,7 @@ bool8 TryIncrementMonLevel(struct Pokemon *mon) } else { - sub_8043B48(mon, species, level, exp); + SetMonExpWithMaxLevelCheck(mon, species, level, exp); return FALSE; } } @@ -5604,7 +5602,7 @@ bool8 IsShinyOtIdPersonality(u32 otId, u32 personality) return retVal; } -u8 *sub_80444C4(void) +u8 *GetTrainerPartnerName(void) { u8 id = GetMultiplayerId(); return gLinkPlayers[GetBankMultiplayerId(gLinkPlayers[id].id ^ 2)].name; -- cgit v1.2.3 From 559ddb05e7cc1dd958686c3e2b77472fd43cb167 Mon Sep 17 00:00:00 2001 From: jiangzhengwenjz Date: Fri, 12 Jul 2019 13:39:33 +0800 Subject: thru CheckBattleTypeGhost() --- src/pokemon.c | 196 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 196 insertions(+) (limited to 'src/pokemon.c') diff --git a/src/pokemon.c b/src/pokemon.c index 1482984f4..7555f7c32 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -19,6 +19,8 @@ #include "link.h" #include "m4a.h" #include "sound.h" +#include "pokedex.h" +#include "strings.h" #include "constants/items.h" #include "constants/species.h" #include "constants/pokemon.h" @@ -78,6 +80,9 @@ extern const struct CompressedSpritePalette gMonShinyPaletteTable[]; extern const u16 sHMMoves[]; extern s8 gPokeblockFlavorCompatibilityTable[]; +extern const u16 sDeoxysBaseStats[]; +extern const u16 gLinkPlayerFacilityClasses[]; + // External functions extern u8 GetCurrentRegionMapSectionId(void); // overworld extern const struct BattleMove gBattleMoves[]; @@ -5607,3 +5612,194 @@ u8 *GetTrainerPartnerName(void) u8 id = GetMultiplayerId(); return gLinkPlayers[GetBankMultiplayerId(gLinkPlayers[id].id ^ 2)].name; } + +u8 GetPlayerPartyHighestLevel(void) +{ + s32 slot; + u8 level, monLevel; + + level = 1; + for(slot = 0; slot < PARTY_SIZE; ++slot) + { + if (GetMonData(&gPlayerParty[slot], MON_DATA_SANITY_HAS_SPECIES, NULL) == 1 && !GetMonData(&gPlayerParty[slot], MON_DATA_SANITY_IS_EGG, NULL)) + { + monLevel = GetMonData(&gPlayerParty[slot], MON_DATA_LEVEL, NULL); + if (monLevel > level) + level = monLevel; + } + } + return level; +} + +u16 FacilityClassToPicIndex(u16 facilityClass) +{ + return gFacilityClassToPicIndex[facilityClass]; +} + +bool8 sub_804455C(u8 caseId, u8 battlerId) +{ + switch (caseId) + { + case 0: + default: + return FALSE; + case 1: + if (!(gBattleTypeFlags & BATTLE_TYPE_MULTI)) + return FALSE; + if (!gMain.inBattle) + return FALSE; + if (gLinkPlayers[GetMultiplayerId()].id == battlerId) + return FALSE; + break; + case 2: + break; + case 3: + if (!(gBattleTypeFlags & BATTLE_TYPE_MULTI)) + return FALSE; + if (!gMain.inBattle) + return FALSE; + if (battlerId == 1 || battlerId == 4 || battlerId == 5) + return TRUE; + return FALSE; + case 4: + break; + case 5: + if (gBattleTypeFlags & BATTLE_TYPE_LINK) + { + if (!gMain.inBattle) + return FALSE; + if (gBattleTypeFlags & BATTLE_TYPE_MULTI) + { + if (gLinkPlayers[GetMultiplayerId()].id == battlerId) + return FALSE; + } + else + { + if (GetBattlerSide(battlerId) == B_SIDE_PLAYER) + return FALSE; + } + } + else + { + if (!gMain.inBattle) + return FALSE; + if (GetBattlerSide(battlerId) == B_SIDE_PLAYER) + return FALSE; + } + break; + } + + return TRUE; +} + +u16 GetDeoxysStat(struct Pokemon *mon, s32 statId) +{ + s32 ivVal, evVal; + u16 statValue; + u8 nature; + + if (gBattleTypeFlags & BATTLE_TYPE_20 || GetMonData(mon, MON_DATA_SPECIES, NULL) != SPECIES_DEOXYS) + { + return statValue = 0; + } + else + { + ivVal = GetMonData(mon, MON_DATA_HP_IV + statId, NULL); + evVal = GetMonData(mon, MON_DATA_HP_EV + statId, NULL); + statValue = ((sDeoxysBaseStats[statId] * 2 + ivVal + evVal / 4) * mon->level) / 100 + 5; + nature = GetNature(mon); + statValue = ModifyStatByNature(nature, statValue, (u8)statId); + } + return statValue; +} + +void SetDeoxysStats(void) +{ + s32 i, value; + + for (i = 0; i < PARTY_SIZE; i++) + { + struct Pokemon *mon = &gPlayerParty[i]; + + if (GetMonData(mon, MON_DATA_SPECIES, NULL) != SPECIES_DEOXYS) + continue; + + value = GetMonData(mon, MON_DATA_ATK, NULL); + SetMonData(mon, MON_DATA_ATK, &value); + + value = GetMonData(mon, MON_DATA_DEF, NULL); + SetMonData(mon, MON_DATA_DEF, &value); + + value = GetMonData(mon, MON_DATA_SPEED, NULL); + SetMonData(mon, MON_DATA_SPEED, &value); + + value = GetMonData(mon, MON_DATA_SPATK, NULL); + SetMonData(mon, MON_DATA_SPATK, &value); + + value = GetMonData(mon, MON_DATA_SPDEF, NULL); + SetMonData(mon, MON_DATA_SPDEF, &value); + } +} + +u16 sub_80447AC(void) +{ + u8 linkId = GetMultiplayerId() ^ 1; + u32 arrId = gLinkPlayers[linkId].trainerId & 7; + + arrId |= gLinkPlayers[linkId].gender << 3; + return FacilityClassToPicIndex(gLinkPlayerFacilityClasses[arrId]); +} + +u16 sub_80447F0(void) +{ + u8 linkId = GetMultiplayerId() ^ 1; + u32 arrId = gLinkPlayers[linkId].trainerId & 7; + + arrId |= gLinkPlayers[linkId].gender << 3; + return gFacilityClassToTrainerClass[gLinkPlayerFacilityClasses[arrId]]; +} + +void CreateObedientEnemyMon(void) +{ + s32 species = gSpecialVar_0x8004; + s32 level = gSpecialVar_0x8005; + s32 itemId = gSpecialVar_0x8006; + + ZeroEnemyPartyMons(); + CreateObedientMon(&gEnemyParty[0], species, level, 32, 0, 0, 0, 0); + if (itemId) + { + u8 heldItem[2]; + heldItem[0] = itemId; + heldItem[1] = itemId >> 8; + SetMonData(&gEnemyParty[0], MON_DATA_HELD_ITEM, heldItem); + } +} + +void HandleSetPokedexFlag(u16 nationalNum, u8 caseId, u32 personality) +{ + u8 getFlagCaseId = (caseId == FLAG_SET_SEEN) ? FLAG_GET_SEEN : FLAG_GET_CAUGHT; + if (!GetSetPokedexFlag(nationalNum, getFlagCaseId)) // don't set if it's already set + { + GetSetPokedexFlag(nationalNum, caseId); + if (NationalPokedexNumToSpecies(nationalNum) == SPECIES_UNOWN) + gSaveBlock2Ptr->pokedex.unownPersonality = personality; + if (NationalPokedexNumToSpecies(nationalNum) == SPECIES_SPINDA) + gSaveBlock2Ptr->pokedex.spindaPersonality = personality; + } +} + +bool8 CheckBattleTypeGhost(struct Pokemon *mon, u8 bank) +{ + u8 buffer[12]; + + if (gBattleTypeFlags & BATTLE_TYPE_GHOST && GetBattlerSide(bank)) + { + GetMonData(mon, MON_DATA_NICKNAME, buffer); + StringGetEnd10(buffer); + if (!StringCompare(buffer, gUnknown_841D148)) + return TRUE; + } + return FALSE; +} + -- cgit v1.2.3 From 64957876846c5892fde62ffd9ab32e6c88ec0e83 Mon Sep 17 00:00:00 2001 From: jiangzhengwenjz Date: Sat, 13 Jul 2019 05:25:38 +0800 Subject: thru OakSpeechNidoranFSetupTemplateDummy() --- src/pokemon.c | 81 +++++++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 65 insertions(+), 16 deletions(-) (limited to 'src/pokemon.c') diff --git a/src/pokemon.c b/src/pokemon.c index 7555f7c32..6d40ebafa 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -21,6 +21,7 @@ #include "sound.h" #include "pokedex.h" #include "strings.h" +#include "malloc.h" #include "constants/items.h" #include "constants/species.h" #include "constants/pokemon.h" @@ -36,17 +37,22 @@ // Extracts the lower 16 bits of a 32-bit number #define LOHALF(n) ((n) & 0xFFFF) -// TODO: what is this -struct UnkStruct20244F4 -{ - u8 unk0:4; - u8 unk0_2:4; - u8 filler1[0xF]; - struct SpriteTemplate *unk10; +struct OakSpeechNidoranFStruct +{ + u8 spriteCount:4; + u8 battlePosition:4; + u8 frameCount; + u8 enable; + bool8 enable2; + u32 sizePerSprite; + u8 *dataBuffer; + u8 **bufferPtrs; + struct SpriteTemplate *templates; + struct SpriteFrameImage *frameImages; }; // External symbols -extern struct UnkStruct20244F4 *sOakTutNidoranResources; +extern struct OakSpeechNidoranFStruct *sOakTutNidoranResources; extern struct SpriteTemplate gUnknown_825DEF0[]; extern struct SpriteTemplate gUnknown_825DF50[]; extern const union AnimCmd *const *const gTrainerBackAnimsPtrTable[]; @@ -82,6 +88,7 @@ extern s8 gPokeblockFlavorCompatibilityTable[]; extern const u16 sDeoxysBaseStats[]; extern const u16 gLinkPlayerFacilityClasses[]; +extern const struct SpriteTemplate gUnknown_825E05C; // External functions extern u8 GetCurrentRegionMapSectionId(void); // overworld @@ -1138,10 +1145,10 @@ void SetMultiuseSpriteTemplateToPokemon(u16 speciesTag, u8 battlerPosition) { if(sOakTutNidoranResources) { - if(battlerPosition >= (s8)sOakTutNidoranResources->unk0_2) // why a cast?!? changing the unk0_2 type to s8 causes extra shifts, but a cast is the correct fix. why, compiler? + if(battlerPosition >= (s8)sOakTutNidoranResources->battlePosition) // why a cast?!? changing the unk0_2 type to s8 causes extra shifts, but a cast is the correct fix. why, compiler? battlerPosition = 0; - gMultiuseSpriteTemplate = sOakTutNidoranResources->unk10[battlerPosition]; + gMultiuseSpriteTemplate = sOakTutNidoranResources->templates[battlerPosition]; } else { @@ -5723,19 +5730,14 @@ void SetDeoxysStats(void) if (GetMonData(mon, MON_DATA_SPECIES, NULL) != SPECIES_DEOXYS) continue; - value = GetMonData(mon, MON_DATA_ATK, NULL); SetMonData(mon, MON_DATA_ATK, &value); - value = GetMonData(mon, MON_DATA_DEF, NULL); SetMonData(mon, MON_DATA_DEF, &value); - value = GetMonData(mon, MON_DATA_SPEED, NULL); SetMonData(mon, MON_DATA_SPEED, &value); - value = GetMonData(mon, MON_DATA_SPATK, NULL); SetMonData(mon, MON_DATA_SPATK, &value); - value = GetMonData(mon, MON_DATA_SPDEF, NULL); SetMonData(mon, MON_DATA_SPDEF, &value); } @@ -5770,6 +5772,7 @@ void CreateObedientEnemyMon(void) if (itemId) { u8 heldItem[2]; + heldItem[0] = itemId; heldItem[1] = itemId >> 8; SetMonData(&gEnemyParty[0], MON_DATA_HELD_ITEM, heldItem); @@ -5779,7 +5782,8 @@ void CreateObedientEnemyMon(void) void HandleSetPokedexFlag(u16 nationalNum, u8 caseId, u32 personality) { u8 getFlagCaseId = (caseId == FLAG_SET_SEEN) ? FLAG_GET_SEEN : FLAG_GET_CAUGHT; - if (!GetSetPokedexFlag(nationalNum, getFlagCaseId)) // don't set if it's already set + + if (!GetSetPokedexFlag(nationalNum, getFlagCaseId)) { GetSetPokedexFlag(nationalNum, caseId); if (NationalPokedexNumToSpecies(nationalNum) == SPECIES_UNOWN) @@ -5803,3 +5807,48 @@ bool8 CheckBattleTypeGhost(struct Pokemon *mon, u8 bank) return FALSE; } +void OakSpeechNidoranFSetupTemplate(struct OakSpeechNidoranFStruct *structPtr, u8 battlePosition) +{ + u16 i = 0, j = 0; + + if (battlePosition > 3) + { + for (i = 0; i < (s8)structPtr->spriteCount; ++i) + { + structPtr->templates[i] = gUnknown_825DEF0[i]; + for (j = 0; j < structPtr->frameCount; ++j) + structPtr->frameImages[i * structPtr->frameCount + j].data = &structPtr->bufferPtrs[i][j * 0x800]; + structPtr->templates[i].images = &structPtr->frameImages[i * structPtr->frameCount]; + } + } + else + { + const struct SpriteTemplate *template = &gUnknown_825DEF0[battlePosition]; + + structPtr->templates[0] = *template; + for (j = 0; j < structPtr->frameCount; ++j) + structPtr->frameImages[j].data = &structPtr->bufferPtrs[0][j * 0x800]; + structPtr->templates[0].images = structPtr->frameImages; + } +} + +// not used +void OakSpeechNidoranFSetupTemplateDummy(struct OakSpeechNidoranFStruct *structPtr) +{ + u16 i, j; + + for (i = 0; i < (s8)structPtr->spriteCount; ++i) + { + structPtr->templates[i] = gUnknown_825E05C; + for (j = 0; j < structPtr->frameCount; ++j) + structPtr->frameImages[i * structPtr->spriteCount + j].data = &structPtr->bufferPtrs[i][j * 0x800]; + structPtr->templates[i].images = &structPtr->frameImages[i * structPtr->spriteCount]; // Bug here, it should be frameCount logically + structPtr->templates[i].anims = gUnknown_82349BC; + structPtr->templates[i].paletteTag = i; + } +} + +struct OakSpeechNidoranFStruct *OakSpeechNidoranFSetup(u8 battlePosition, bool8 enable) +{ + +} \ No newline at end of file -- cgit v1.2.3 From 2b09d272ebb31c3aac555139a1b79e55b51a7def Mon Sep 17 00:00:00 2001 From: jiangzhengwenjz Date: Sat, 13 Jul 2019 11:25:45 +0800 Subject: OakSpeechNidoranFSetup() NONMATCHING --- src/pokemon.c | 112 ++++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 106 insertions(+), 6 deletions(-) (limited to 'src/pokemon.c') diff --git a/src/pokemon.c b/src/pokemon.c index 6d40ebafa..39ccbc2d3 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -52,7 +52,7 @@ struct OakSpeechNidoranFStruct }; // External symbols -extern struct OakSpeechNidoranFStruct *sOakTutNidoranResources; +extern struct OakSpeechNidoranFStruct *sOakSpeechNidoranResources; extern struct SpriteTemplate gUnknown_825DEF0[]; extern struct SpriteTemplate gUnknown_825DF50[]; extern const union AnimCmd *const *const gTrainerBackAnimsPtrTable[]; @@ -1143,12 +1143,12 @@ void SetMultiuseSpriteTemplateToPokemon(u16 speciesTag, u8 battlerPosition) } else { - if(sOakTutNidoranResources) + if(sOakSpeechNidoranResources) { - if(battlerPosition >= (s8)sOakTutNidoranResources->battlePosition) // why a cast?!? changing the unk0_2 type to s8 causes extra shifts, but a cast is the correct fix. why, compiler? + if(battlerPosition >= (s8)sOakSpeechNidoranResources->battlePosition) // why a cast?!? changing the unk0_2 type to s8 causes extra shifts, but a cast is the correct fix. why, compiler? battlerPosition = 0; - gMultiuseSpriteTemplate = sOakTutNidoranResources->templates[battlerPosition]; + gMultiuseSpriteTemplate = sOakSpeechNidoranResources->templates[battlerPosition]; } else { @@ -5842,7 +5842,7 @@ void OakSpeechNidoranFSetupTemplateDummy(struct OakSpeechNidoranFStruct *structP structPtr->templates[i] = gUnknown_825E05C; for (j = 0; j < structPtr->frameCount; ++j) structPtr->frameImages[i * structPtr->spriteCount + j].data = &structPtr->bufferPtrs[i][j * 0x800]; - structPtr->templates[i].images = &structPtr->frameImages[i * structPtr->spriteCount]; // Bug here, it should be frameCount logically + structPtr->templates[i].images = &structPtr->frameImages[i * structPtr->spriteCount]; // should be frameCount logically structPtr->templates[i].anims = gUnknown_82349BC; structPtr->templates[i].paletteTag = i; } @@ -5850,5 +5850,105 @@ void OakSpeechNidoranFSetupTemplateDummy(struct OakSpeechNidoranFStruct *structP struct OakSpeechNidoranFStruct *OakSpeechNidoranFSetup(u8 battlePosition, bool8 enable) { + s32 size; + u8 i, flags = 0; -} \ No newline at end of file + if (sOakSpeechNidoranResources != NULL) + { + if (sOakSpeechNidoranResources->enable == 0xA3) + return NULL; + memset(sOakSpeechNidoranResources, 0, sizeof(struct OakSpeechNidoranFStruct)); + sOakSpeechNidoranResources = NULL; + } + sOakSpeechNidoranResources = AllocZeroed(0x18); + if (sOakSpeechNidoranResources == NULL) + return NULL; + switch (enable) + { + case TRUE: + if (battlePosition == 4) + { + sOakSpeechNidoranResources->spriteCount = 4; + sOakSpeechNidoranResources->battlePosition = 4; + } + else + { + if (battlePosition > 4) + battlePosition = 0; + sOakSpeechNidoranResources->spriteCount = 1; + sOakSpeechNidoranResources->battlePosition = 1; + } + sOakSpeechNidoranResources->frameCount = 4; + sOakSpeechNidoranResources->enable2 = TRUE; + break; + case FALSE: + default: + if (!battlePosition) + battlePosition = 1; + if (battlePosition > 8) + battlePosition = 8; + sOakSpeechNidoranResources->spriteCount = battlePosition; + sOakSpeechNidoranResources->battlePosition = battlePosition; + sOakSpeechNidoranResources->frameCount = 4; + sOakSpeechNidoranResources->enable2 = FALSE; + break; + } + size = sOakSpeechNidoranResources->frameCount * 0x800; + sOakSpeechNidoranResources->sizePerSprite = size; + sOakSpeechNidoranResources->dataBuffer = AllocZeroed(sOakSpeechNidoranResources->spriteCount * size); + sOakSpeechNidoranResources->bufferPtrs = AllocZeroed(sOakSpeechNidoranResources->spriteCount * 0x20); + if (sOakSpeechNidoranResources->dataBuffer == NULL || sOakSpeechNidoranResources->bufferPtrs == NULL) + { + flags |= 1; + } + else + { + for (i = 0; i < (s8)sOakSpeechNidoranResources->spriteCount; ++i) + sOakSpeechNidoranResources->bufferPtrs[i] = &sOakSpeechNidoranResources->dataBuffer[sOakSpeechNidoranResources->sizePerSprite * i]; + } + sOakSpeechNidoranResources->templates = AllocZeroed(sizeof(struct SpriteTemplate) * sOakSpeechNidoranResources->spriteCount); + sOakSpeechNidoranResources->frameImages = AllocZeroed(sOakSpeechNidoranResources->spriteCount * sizeof(struct SpriteFrameImage) * sOakSpeechNidoranResources->frameCount); + if (sOakSpeechNidoranResources->templates == NULL || sOakSpeechNidoranResources->frameImages == NULL) + { + flags |= 2; + } + else + { + for (i = 0; i < sOakSpeechNidoranResources->frameCount * sOakSpeechNidoranResources->spriteCount; ++i) + sOakSpeechNidoranResources->frameImages[i].size = 0x800; + switch (sOakSpeechNidoranResources->enable2) + { + case TRUE: + OakSpeechNidoranFSetupTemplate(sOakSpeechNidoranResources, battlePosition); + break; + case FALSE: + default: + OakSpeechNidoranFSetupTemplateDummy(sOakSpeechNidoranResources); + break; + } + } + if (flags & 2) + { + if (sOakSpeechNidoranResources->frameImages != NULL) + FREE_AND_SET_NULL(sOakSpeechNidoranResources->frameImages); + if (sOakSpeechNidoranResources->templates != NULL) + FREE_AND_SET_NULL(sOakSpeechNidoranResources->templates); + } + if (flags & 1) + { + if (sOakSpeechNidoranResources->bufferPtrs != NULL) + FREE_AND_SET_NULL(sOakSpeechNidoranResources->bufferPtrs); + if (sOakSpeechNidoranResources->dataBuffer != NULL) + FREE_AND_SET_NULL(sOakSpeechNidoranResources->dataBuffer); + } + if (flags) + { + memset(sOakSpeechNidoranResources, 0, sizeof(struct OakSpeechNidoranFStruct)); + FREE_AND_SET_NULL(sOakSpeechNidoranResources); + } + else + { + sOakSpeechNidoranResources->enable = 0xA3; + } + return sOakSpeechNidoranResources; +} -- cgit v1.2.3 From 0eb43a11847b4a20263146a61e009b86c67de1b4 Mon Sep 17 00:00:00 2001 From: jiangzhengwenjz Date: Sat, 13 Jul 2019 14:48:31 +0800 Subject: finished pokemon_3 --- src/pokemon.c | 387 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 387 insertions(+) (limited to 'src/pokemon.c') diff --git a/src/pokemon.c b/src/pokemon.c index 39ccbc2d3..9b8df60a6 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -5848,6 +5848,7 @@ void OakSpeechNidoranFSetupTemplateDummy(struct OakSpeechNidoranFStruct *structP } } +#ifdef NONMATCHING struct OakSpeechNidoranFStruct *OakSpeechNidoranFSetup(u8 battlePosition, bool8 enable) { s32 size; @@ -5952,3 +5953,389 @@ struct OakSpeechNidoranFStruct *OakSpeechNidoranFSetup(u8 battlePosition, bool8 } return sOakSpeechNidoranResources; } +#else +NAKED +struct OakSpeechNidoranFStruct *OakSpeechNidoranFSetup(u8 battlePosition, bool8 enable) +{ + asm_unified("\n\ + push {r4-r7,lr}\n\ + mov r7, r8\n\ + push {r7}\n\ + lsls r0, 24\n\ + lsrs r6, r0, 24\n\ + lsls r1, 24\n\ + lsrs r5, r1, 24\n\ + movs r0, 0\n\ + mov r8, r0\n\ + ldr r4, _08044B34 @ =sOakSpeechNidoranResources\n\ + ldr r1, [r4]\n\ + cmp r1, 0\n\ + beq _08044B1E\n\ + ldrb r0, [r1, 0x2]\n\ + cmp r0, 0xA3\n\ + beq _08044B2E\n\ + adds r0, r1, 0\n\ + movs r1, 0\n\ + movs r2, 0x18\n\ + bl memset\n\ + mov r1, r8\n\ + str r1, [r4]\n\ + _08044B1E:\n\ + ldr r4, _08044B34 @ =sOakSpeechNidoranResources\n\ + movs r0, 0x18\n\ + bl AllocZeroed\n\ + adds r2, r0, 0\n\ + str r2, [r4]\n\ + cmp r2, 0\n\ + bne _08044B38\n\ + _08044B2E:\n\ + movs r0, 0\n\ + b _08044D70\n\ + .align 2, 0\n\ + _08044B34: .4byte sOakSpeechNidoranResources\n\ + _08044B38:\n\ + cmp r5, 0\n\ + beq _08044B94\n\ + cmp r5, 0x1\n\ + bne _08044B94\n\ + cmp r6, 0x4\n\ + bne _08044B5E\n\ + ldrb r1, [r2]\n\ + movs r0, 0x10\n\ + negs r0, r0\n\ + ands r0, r1\n\ + movs r1, 0x4\n\ + orrs r0, r1\n\ + strb r0, [r2]\n\ + ldr r2, [r4]\n\ + ldrb r1, [r2]\n\ + movs r0, 0xF\n\ + ands r0, r1\n\ + movs r1, 0x40\n\ + b _08044B7C\n\ + _08044B5E:\n\ + cmp r6, 0x4\n\ + bls _08044B64\n\ + movs r6, 0\n\ + _08044B64:\n\ + ldrb r1, [r2]\n\ + movs r0, 0x10\n\ + negs r0, r0\n\ + ands r0, r1\n\ + movs r1, 0x1\n\ + orrs r0, r1\n\ + strb r0, [r2]\n\ + ldr r2, [r4]\n\ + ldrb r1, [r2]\n\ + movs r0, 0xF\n\ + ands r0, r1\n\ + movs r1, 0x10\n\ + _08044B7C:\n\ + orrs r0, r1\n\ + strb r0, [r2]\n\ + ldr r2, _08044B90 @ =sOakSpeechNidoranResources\n\ + ldr r1, [r2]\n\ + movs r0, 0x4\n\ + strb r0, [r1, 0x1]\n\ + ldr r1, [r2]\n\ + movs r0, 0x1\n\ + strb r0, [r1, 0x3]\n\ + b _08044BD0\n\ + .align 2, 0\n\ + _08044B90: .4byte sOakSpeechNidoranResources\n\ + _08044B94:\n\ + cmp r6, 0\n\ + bne _08044B9A\n\ + movs r6, 0x1\n\ + _08044B9A:\n\ + cmp r6, 0x8\n\ + bls _08044BA0\n\ + movs r6, 0x8\n\ + _08044BA0:\n\ + ldr r4, _08044C10 @ =sOakSpeechNidoranResources\n\ + ldr r3, [r4]\n\ + movs r0, 0xF\n\ + adds r1, r6, 0\n\ + ands r1, r0\n\ + ldrb r2, [r3]\n\ + movs r0, 0x10\n\ + negs r0, r0\n\ + ands r0, r2\n\ + orrs r0, r1\n\ + strb r0, [r3]\n\ + ldr r2, [r4]\n\ + lsls r3, r6, 4\n\ + ldrb r1, [r2]\n\ + movs r0, 0xF\n\ + ands r0, r1\n\ + orrs r0, r3\n\ + strb r0, [r2]\n\ + ldr r1, [r4]\n\ + movs r2, 0\n\ + movs r0, 0x4\n\ + strb r0, [r1, 0x1]\n\ + ldr r0, [r4]\n\ + strb r2, [r0, 0x3]\n\ + _08044BD0:\n\ + ldr r5, _08044C10 @ =sOakSpeechNidoranResources\n\ + ldr r0, [r5]\n\ + ldrb r1, [r0, 0x1]\n\ + lsls r1, 11\n\ + str r1, [r0, 0x4]\n\ + ldrb r0, [r0]\n\ + lsls r0, 28\n\ + lsrs r0, 28\n\ + muls r0, r1\n\ + bl AllocZeroed\n\ + ldr r1, [r5]\n\ + str r0, [r1, 0x8]\n\ + ldrb r0, [r1]\n\ + lsls r0, 28\n\ + lsrs r0, 23\n\ + bl AllocZeroed\n\ + adds r2, r0, 0\n\ + ldr r1, [r5]\n\ + str r2, [r1, 0xC]\n\ + ldr r0, [r1, 0x8]\n\ + cmp r0, 0\n\ + beq _08044C04\n\ + cmp r2, 0\n\ + bne _08044C14\n\ + _08044C04:\n\ + movs r0, 0x1\n\ + mov r1, r8\n\ + orrs r1, r0\n\ + mov r8, r1\n\ + b _08044C44\n\ + .align 2, 0\n\ + _08044C10: .4byte sOakSpeechNidoranResources\n\ + _08044C14:\n\ + ldrb r0, [r1]\n\ + lsls r0, 28\n\ + movs r4, 0\n\ + adds r3, r5, 0\n\ + cmp r0, 0\n\ + beq _08044C44\n\ + _08044C20:\n\ + ldr r3, [r5]\n\ + ldr r0, [r3, 0xC]\n\ + lsls r1, r4, 2\n\ + adds r1, r0\n\ + ldr r0, [r3, 0x4]\n\ + adds r2, r0, 0\n\ + muls r2, r4\n\ + ldr r0, [r3, 0x8]\n\ + adds r0, r2\n\ + str r0, [r1]\n\ + adds r0, r4, 0x1\n\ + lsls r0, 24\n\ + lsrs r4, r0, 24\n\ + ldrb r0, [r3]\n\ + lsls r0, 28\n\ + lsrs r0, 28\n\ + cmp r4, r0\n\ + blt _08044C20\n\ + _08044C44:\n\ + ldr r5, _08044C8C @ =sOakSpeechNidoranResources\n\ + ldr r0, [r5]\n\ + ldrb r1, [r0]\n\ + lsls r1, 28\n\ + lsrs r1, 28\n\ + lsls r0, r1, 1\n\ + adds r0, r1\n\ + lsls r0, 3\n\ + bl AllocZeroed\n\ + ldr r2, [r5]\n\ + str r0, [r2, 0x10]\n\ + ldrb r1, [r2]\n\ + lsls r1, 28\n\ + lsrs r1, 28\n\ + ldrb r0, [r2, 0x1]\n\ + lsls r0, 3\n\ + muls r0, r1\n\ + bl AllocZeroed\n\ + adds r2, r0, 0\n\ + ldr r1, [r5]\n\ + str r2, [r1, 0x14]\n\ + ldr r0, [r1, 0x10]\n\ + cmp r0, 0\n\ + beq _08044C7C\n\ + cmp r2, 0\n\ + bne _08044C90\n\ + _08044C7C:\n\ + movs r0, 0x2\n\ + mov r1, r8\n\ + orrs r1, r0\n\ + lsls r0, r1, 24\n\ + lsrs r0, 24\n\ + mov r8, r0\n\ + b _08044CE2\n\ + .align 2, 0\n\ + _08044C8C: .4byte sOakSpeechNidoranResources\n\ + _08044C90:\n\ + movs r4, 0\n\ + ldrb r0, [r1, 0x1]\n\ + ldrb r1, [r1]\n\ + lsls r1, 28\n\ + lsrs r1, 28\n\ + muls r0, r1\n\ + adds r3, r5, 0\n\ + cmp r4, r0\n\ + bge _08044CC6\n\ + adds r7, r3, 0\n\ + movs r5, 0x80\n\ + lsls r5, 4\n\ + _08044CA8:\n\ + ldr r2, [r7]\n\ + ldr r1, [r2, 0x14]\n\ + lsls r0, r4, 3\n\ + adds r0, r1\n\ + strh r5, [r0, 0x4]\n\ + adds r0, r4, 0x1\n\ + lsls r0, 24\n\ + lsrs r4, r0, 24\n\ + ldrb r1, [r2, 0x1]\n\ + ldrb r0, [r2]\n\ + lsls r0, 28\n\ + lsrs r0, 28\n\ + muls r0, r1\n\ + cmp r4, r0\n\ + blt _08044CA8\n\ + _08044CC6:\n\ + ldr r0, [r3]\n\ + ldrb r4, [r0, 0x3]\n\ + cmp r4, 0\n\ + beq _08044CDA\n\ + cmp r4, 0x1\n\ + bne _08044CDA\n\ + adds r1, r6, 0\n\ + bl OakSpeechNidoranFSetupTemplate\n\ + b _08044CE2\n\ + _08044CDA:\n\ + ldr r0, _08044D60 @ =sOakSpeechNidoranResources\n\ + ldr r0, [r0]\n\ + bl OakSpeechNidoranFSetupTemplateDummy\n\ + _08044CE2:\n\ + movs r0, 0x2\n\ + mov r1, r8\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _08044D12\n\ + ldr r4, _08044D60 @ =sOakSpeechNidoranResources\n\ + ldr r0, [r4]\n\ + ldr r0, [r0, 0x14]\n\ + cmp r0, 0\n\ + beq _08044D00\n\ + bl Free\n\ + ldr r1, [r4]\n\ + movs r0, 0\n\ + str r0, [r1, 0x14]\n\ + _08044D00:\n\ + ldr r0, [r4]\n\ + ldr r0, [r0, 0x10]\n\ + cmp r0, 0\n\ + beq _08044D12\n\ + bl Free\n\ + ldr r1, [r4]\n\ + movs r0, 0\n\ + str r0, [r1, 0x10]\n\ + _08044D12:\n\ + movs r0, 0x1\n\ + mov r1, r8\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _08044D42\n\ + ldr r4, _08044D60 @ =sOakSpeechNidoranResources\n\ + ldr r0, [r4]\n\ + ldr r0, [r0, 0xC]\n\ + cmp r0, 0\n\ + beq _08044D30\n\ + bl Free\n\ + ldr r1, [r4]\n\ + movs r0, 0\n\ + str r0, [r1, 0xC]\n\ + _08044D30:\n\ + ldr r0, [r4]\n\ + ldr r0, [r0, 0x8]\n\ + cmp r0, 0\n\ + beq _08044D42\n\ + bl Free\n\ + ldr r1, [r4]\n\ + movs r0, 0\n\ + str r0, [r1, 0x8]\n\ + _08044D42:\n\ + mov r0, r8\n\ + cmp r0, 0\n\ + beq _08044D64\n\ + ldr r4, _08044D60 @ =sOakSpeechNidoranResources\n\ + ldr r0, [r4]\n\ + movs r1, 0\n\ + movs r2, 0x18\n\ + bl memset\n\ + ldr r0, [r4]\n\ + bl Free\n\ + movs r0, 0\n\ + str r0, [r4]\n\ + b _08044D6C\n\ + .align 2, 0\n\ + _08044D60: .4byte sOakSpeechNidoranResources\n\ + _08044D64:\n\ + ldr r0, _08044D7C @ =sOakSpeechNidoranResources\n\ + ldr r1, [r0]\n\ + movs r0, 0xA3\n\ + strb r0, [r1, 0x2]\n\ + _08044D6C:\n\ + ldr r0, _08044D7C @ =sOakSpeechNidoranResources\n\ + ldr r0, [r0]\n\ + _08044D70:\n\ + pop {r3}\n\ + mov r8, r3\n\ + pop {r4-r7}\n\ + pop {r1}\n\ + bx r1\n\ + .align 2, 0\n\ + _08044D7C: .4byte sOakSpeechNidoranResources\n\ + "); +} +#endif + +void OakSpeechNidoranFFreeResources(void) +{ + if (sOakSpeechNidoranResources != NULL) + { + if (sOakSpeechNidoranResources->enable != 0xA3) + { + memset(sOakSpeechNidoranResources, 0, sizeof(struct OakSpeechNidoranFStruct)); + sOakSpeechNidoranResources = NULL; + } + else + { + if (sOakSpeechNidoranResources->frameImages != NULL) + FREE_AND_SET_NULL(sOakSpeechNidoranResources->frameImages); + if (sOakSpeechNidoranResources->templates != NULL) + FREE_AND_SET_NULL(sOakSpeechNidoranResources->templates); + if (sOakSpeechNidoranResources->bufferPtrs != NULL) + FREE_AND_SET_NULL(sOakSpeechNidoranResources->bufferPtrs); + if (sOakSpeechNidoranResources->dataBuffer != NULL) + FREE_AND_SET_NULL(sOakSpeechNidoranResources->dataBuffer); + memset(sOakSpeechNidoranResources, 0, sizeof(struct OakSpeechNidoranFStruct)); + Free(sOakSpeechNidoranResources); + sOakSpeechNidoranResources = NULL; + } + + } +} + +void *OakSpeechNidoranFGetBuffer(u8 bufferId) +{ + if (sOakSpeechNidoranResources->enable != 0xA3) + { + return NULL; + } + else + { + if (bufferId >= (s8)sOakSpeechNidoranResources->spriteCount) + bufferId = 0; + return sOakSpeechNidoranResources->bufferPtrs[bufferId]; + } +} -- cgit v1.2.3 From 0985206a2998d69c984c6bb4494dec442209c4ca Mon Sep 17 00:00:00 2001 From: jiangzhengwenjz Date: Sun, 14 Jul 2019 04:49:21 +0800 Subject: marked all static functions in pokemon.c --- src/pokemon.c | 152 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 76 insertions(+), 76 deletions(-) (limited to 'src/pokemon.c') diff --git a/src/pokemon.c b/src/pokemon.c index 9b8df60a6..232376da2 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -16,12 +16,17 @@ #include "battle_controllers.h" #include "evolution_scene.h" #include "battle_message.h" +#include "battle_util.h" +#include "battle_ai_script_commands.h" #include "link.h" #include "m4a.h" #include "sound.h" #include "pokedex.h" #include "strings.h" #include "malloc.h" +#include "overworld.h" +#include "party_menu.h" +#include "field_specials.h" #include "constants/items.h" #include "constants/species.h" #include "constants/pokemon.h" @@ -51,56 +56,59 @@ struct OakSpeechNidoranFStruct struct SpriteFrameImage *frameImages; }; -// External symbols +// resolve here and static extern struct OakSpeechNidoranFStruct *sOakSpeechNidoranResources; -extern struct SpriteTemplate gUnknown_825DEF0[]; + +// decomp here extern struct SpriteTemplate gUnknown_825DF50[]; -extern const union AnimCmd *const *const gTrainerBackAnimsPtrTable[]; -extern const union AnimCmd *const *const gTrainerFrontAnimsPtrTable[]; -extern const union AnimCmd *const gUnknown_82349BC[]; -extern const u8 gUnknown_825DEA1[]; +extern const u16 sDeoxysBaseStats[]; +extern const u16 gLinkPlayerFacilityClasses[]; +extern const struct SpriteTemplate gUnknown_825E05C; +extern s8 gPokeblockFlavorCompatibilityTable[]; +extern const u16 sHMMoves[]; extern const u8 gPPUpWriteMasks[]; -extern u8 *gUnknown_83FD5D0[]; +extern const u8 sSecretBaseFacilityClasses[2][5]; +extern const s8 sFriendshipEventDeltas[][3]; extern const u8 gUnknown_825DFF0[]; -extern const u8 gText_EggNickname[]; -extern const u8 gText_BadEgg[]; -extern const u8 BattleText_Rose[]; -extern const u8 BattleText_UnknownString3[]; -extern const u8 BattleText_GetPumped[]; -extern const u8 BattleText_MistShroud[]; -extern const u8 gText_PkmnsXPreventsSwitching[]; extern const u8 sHoldEffectToType[][2]; -extern u8 sLearningMoveTableID; -extern const u8 sSecretBaseFacilityClasses[2][5]; extern u16 gUnknown_8251CB8[]; extern u16 gUnknown_8251FEE[]; extern u16 gUnknown_8252324[]; +extern struct SpriteTemplate gUnknown_825DEF0[]; +extern const u8 gUnknown_825DEA1[]; extern u16 gUnknown_82539D4[]; extern struct SpindaSpot gSpindaSpotGraphics[]; extern s8 gNatureStatTable[][5]; -extern const s8 sFriendshipEventDeltas[][3]; extern u32 gTMHMLearnsets[][2]; +extern const u8 gUnknown_825DEA1[]; +extern const u8 gUnknown_825DEA9[]; +extern const u8 sGetMonDataEVConstants[]; + +// extern symbols +extern u8 sBattler_AI; +extern u8 sLearningMoveTableID; extern u8 gBattleMonForms[4]; extern const struct CompressedSpritePalette gMonPaletteTable[]; extern const struct CompressedSpritePalette gMonShinyPaletteTable[]; -extern const u16 sHMMoves[]; -extern s8 gPokeblockFlavorCompatibilityTable[]; - -extern const u16 sDeoxysBaseStats[]; -extern const u16 gLinkPlayerFacilityClasses[]; -extern const struct SpriteTemplate gUnknown_825E05C; - -// External functions -extern u8 GetCurrentRegionMapSectionId(void); // overworld -extern const struct BattleMove gBattleMoves[]; -extern u8 sBattler_AI; // battle_ai -extern void set_unknown_box_id(u8); // field_specials -extern u8 pokemon_order_func(u8); -extern u16 get_unknown_box_id(void); // field_specials -extern u8 StorageGetCurrentBox(void); // pokemon_storage_system -extern void sub_80174B8(u8 battlerId); +extern const union AnimCmd *const *const gTrainerBackAnimsPtrTable[]; +extern const union AnimCmd *const *const gTrainerFrontAnimsPtrTable[]; +extern const union AnimCmd *const gUnknown_82349BC[]; -union PokemonSubstruct *GetSubstruct(struct BoxPokemon *boxMon, u32 personality, u8 substructType); +static union PokemonSubstruct *GetSubstruct(struct BoxPokemon *boxMon, u32 personality, u8 substructType); +static u16 GetDeoxysStat(struct Pokemon *mon, s32 statId); +static bool8 IsShinyOtIdPersonality(u32 otId, u32 personality); +static u16 ModifyStatByNature(u8 nature, u16 n, u8 statIndex); +static u8 GetNatureFromPersonality(u32 personality); +static bool8 sub_8042BE8(struct Pokemon *mon, u32 unused, u32 healMask, u8 battleId); +static bool8 HealStatusConditions(struct Pokemon *mon, u32 unused, u32 healMask, u8 battleId); +static bool8 IsPokemonStorageFull(void); +static u8 SendMonToPC(struct Pokemon* mon); +static void EncryptBoxMon(struct BoxPokemon *boxMon); +static void DeleteFirstMoveAndGiveMoveToBoxMon(struct BoxPokemon *boxMon, u16 move); +static void GiveBoxMonInitialMoveset(struct BoxPokemon *boxMon); +static u16 GiveMoveToBoxMon(struct BoxPokemon *boxMon, u16 move); +static u8 GetLevelFromMonExp(struct Pokemon *mon); +static u16 CalculateBoxMonChecksum(struct BoxPokemon *boxMon); // code void ZeroBoxMonData(struct BoxPokemon *boxMon) @@ -317,7 +325,7 @@ void CreateMonWithIVsPersonality(struct Pokemon *mon, u16 species, u8 level, u32 CalculateMonStats(mon); } -void CreateMonWithIVsOTID(struct Pokemon *mon, u16 species, u8 level, u8 *ivs, u32 otId) +static void CreateMonWithIVsOTID(struct Pokemon *mon, u16 species, u8 level, u8 *ivs, u32 otId) { CreateMon(mon, species, level, 0, 0, 0, OT_ID_PRESET, otId); SetMonData(mon, MON_DATA_HP_IV, &ivs[0]); @@ -412,7 +420,7 @@ void CreateBattleTowerMon(struct Pokemon *mon, struct BattleTowerPokemon *src) CalculateMonStats(mon); } -void CreateObedientMon(struct Pokemon *mon, u16 species, u8 level, u8 fixedIV, u8 hasFixedPersonality, u32 fixedPersonality, u8 otIdType, u32 fixedOtId) +static void CreateObedientMon(struct Pokemon *mon, u16 species, u8 level, u8 fixedIV, u8 hasFixedPersonality, u32 fixedPersonality, u8 otIdType, u32 fixedOtId) { bool32 obedient = TRUE; @@ -457,7 +465,7 @@ void sub_803E23C(struct Pokemon *mon, struct BattleTowerPokemon *dest) GetMonData(mon, MON_DATA_NICKNAME, dest->nickname); } -u16 CalculateBoxMonChecksum(struct BoxPokemon *boxMon) +static u16 CalculateBoxMonChecksum(struct BoxPokemon *boxMon) { u16 checksum = 0; union PokemonSubstruct *substruct0 = GetSubstruct(boxMon, boxMon->personality, 0); @@ -566,7 +574,7 @@ void BoxMonToMon(struct BoxPokemon *src, struct Pokemon *dest) CalculateMonStats(dest); } -u8 GetLevelFromMonExp(struct Pokemon *mon) +static u8 GetLevelFromMonExp(struct Pokemon *mon) { u16 species = GetMonData(mon, MON_DATA_SPECIES, NULL); u32 exp = GetMonData(mon, MON_DATA_EXP, NULL); @@ -595,7 +603,7 @@ u16 GiveMoveToMon(struct Pokemon *mon, u16 move) return GiveMoveToBoxMon(&mon->box, move); } -u16 GiveMoveToBoxMon(struct BoxPokemon *boxMon, u16 move) +static u16 GiveMoveToBoxMon(struct BoxPokemon *boxMon, u16 move) { s32 i; for (i = 0; i < 4; i++) @@ -642,7 +650,7 @@ void SetBattleMonMoveSlot(struct BattlePokemon *mon, u16 move, u8 slot) mon->pp[slot] = gBattleMoves[move].pp; } -void GiveMonInitialMoveset(struct Pokemon *mon) +static void GiveMonInitialMoveset(struct Pokemon *mon) { GiveBoxMonInitialMoveset(&mon->box); } @@ -650,7 +658,7 @@ void GiveMonInitialMoveset(struct Pokemon *mon) // TODO: make level_up_learnsets.h in src/data and move this to there. #define LEVEL_UP_END 0xffff -void GiveBoxMonInitialMoveset(struct BoxPokemon *boxMon) +static void GiveBoxMonInitialMoveset(struct BoxPokemon *boxMon) { u16 species = GetBoxMonData(boxMon, MON_DATA_SPECIES, NULL); s32 level = GetLevelFromBoxMonExp(boxMon); @@ -732,7 +740,7 @@ void DeleteFirstMoveAndGiveMoveToMon(struct Pokemon *mon, u16 move) SetMonData(mon, MON_DATA_PP_BONUSES, &ppBonuses); } -void DeleteFirstMoveAndGiveMoveToBoxMon(struct BoxPokemon *boxMon, u16 move) +static void DeleteFirstMoveAndGiveMoveToBoxMon(struct BoxPokemon *boxMon, u16 move) { s32 i; u16 moves[4]; @@ -1180,7 +1188,7 @@ void SetMultiuseSpriteTemplateToTrainerBack(u16 trainerSpriteId, u8 battlerPosit } } -void EncryptBoxMon(struct BoxPokemon *boxMon) +static void EncryptBoxMon(struct BoxPokemon *boxMon) { u32 i; for (i = 0; i < 12; i++) @@ -1190,7 +1198,7 @@ void EncryptBoxMon(struct BoxPokemon *boxMon) } } -void DecryptBoxMon(struct BoxPokemon *boxMon) +static void DecryptBoxMon(struct BoxPokemon *boxMon) { u32 i; for (i = 0; i < 12; i++) @@ -1246,7 +1254,7 @@ case n: \ break; \ } \ -union PokemonSubstruct *GetSubstruct(struct BoxPokemon *boxMon, u32 personality, u8 substructType) +static union PokemonSubstruct *GetSubstruct(struct BoxPokemon *boxMon, u32 personality, u8 substructType) { union PokemonSubstruct *substruct = NULL; @@ -2075,7 +2083,7 @@ u8 GiveMonToPlayer(struct Pokemon *mon) return MON_GIVEN_TO_PARTY; } -u8 SendMonToPC(struct Pokemon* mon) +static u8 SendMonToPC(struct Pokemon* mon) { s32 boxNo, boxPos; @@ -2175,7 +2183,7 @@ u8 GetMonAbility(struct Pokemon *mon) return GetAbilityBySpecies(species, altAbility); } -void CreateSecretBaseEnemyParty(struct SecretBaseRecord *secretBaseRecord) +static void CreateSecretBaseEnemyParty(struct SecretBaseRecord *secretBaseRecord) { s32 i, j; @@ -2234,7 +2242,7 @@ bool8 IsPlayerPartyAndPokemonStorageFull(void) return IsPokemonStorageFull(); } -bool8 IsPokemonStorageFull(void) +static bool8 IsPokemonStorageFull(void) { s32 i, j; @@ -2283,7 +2291,7 @@ void RemoveBattleMonPPBonus(struct BattlePokemon *mon, u8 moveIndex) mon->ppBonuses &= gPPUpWriteMasks[moveIndex]; } -void CopyPlayerPartyMonToBattleData(u8 battlerId, u8 partyIndex) +static void CopyPlayerPartyMonToBattleData(u8 battlerId, u8 partyIndex) { u16* hpSwitchout; s32 i; @@ -2343,10 +2351,6 @@ bool8 ExecuteTableBasedItemEffect(struct Pokemon *mon, u16 item, u8 partyIndex, return PokemonUseItemEffects(mon, item, partyIndex, moveIndex, 0); } -extern const u8 gUnknown_825DEA1[]; -extern const u8 gUnknown_825DEA9[]; -extern const u8 sGetMonDataEVConstants[]; - bool8 PokemonUseItemEffects(struct Pokemon *pkmn, u16 item, u8 partyIndex, u8 moveIndex, u8 e) { u32 data; @@ -2850,7 +2854,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *pkmn, u16 item, u8 partyIndex, u8 mo return retVal; } -bool8 HealStatusConditions(struct Pokemon *mon, u32 unused, u32 healMask, u8 battleId) +static bool8 HealStatusConditions(struct Pokemon *mon, u32 unused, u32 healMask, u8 battleId) { u32 status = GetMonData(mon, MON_DATA_STATUS, 0); @@ -2868,8 +2872,6 @@ bool8 HealStatusConditions(struct Pokemon *mon, u32 unused, u32 healMask, u8 bat } } -extern bool8 sub_8042BE8(struct Pokemon *mon, u32 unused, u32 healMask, u8 battleId); - #ifdef NONMATCHING /* * This is nonmatching due to the compiler's insistence on avoiding the u8 cast @@ -4407,7 +4409,7 @@ _08042BD8:\n\ } #endif -bool8 sub_8042BE8(struct Pokemon *mon, u32 unused, u32 healMask, u8 battleId) +static bool8 sub_8042BE8(struct Pokemon *mon, u32 unused, u32 healMask, u8 battleId) { if((GetMonData(mon, MON_DATA_STATUS, NULL) & healMask) != 0) return TRUE; @@ -4528,7 +4530,7 @@ u8 GetItemEffectParamOffset(u16 itemId, u8 effectByte, u8 effectBit) return offset; } -void sub_8042D50(int stat) +static void sub_8042D50(int stat) { gBattlerTarget = gBattlerInMenuId; StringCopy(gBattleTextBuff1, gUnknown_83FD5D0[gUnknown_825DFF0[stat]]); @@ -4591,13 +4593,11 @@ u8 GetNature(struct Pokemon *mon) return GetMonData(mon, MON_DATA_PERSONALITY, 0) % 25; } -u8 GetNatureFromPersonality(u32 personality) +static u8 GetNatureFromPersonality(u32 personality) { return personality % 25; } -extern bool32 sub_806E25C(void); - u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 type, u16 evolutionItem) { int i; @@ -4728,7 +4728,7 @@ u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 type, u16 evolutionItem) // HoennPokedexNumToSpecies, but is it really Hoenn or Kanto its checking // TODO: Figure this out -u16 sub_80431B4(u16 var) +static u16 sub_80431B4(u16 var) { u16 species; @@ -4765,7 +4765,7 @@ u16 NationalPokedexNumToSpecies(u16 nationalNum) } // NationalToKantoOrder? -u16 sub_804324C(u16 nationalNum) +static u16 sub_804324C(u16 nationalNum) { u16 hoennNum; @@ -4793,7 +4793,7 @@ u16 SpeciesToNationalPokedexNum(u16 species) // these 2 functions are probably kanto and not hoenn // TODO: figure this out -u16 SpeciesToHoennPokedexNum(u16 species) +static u16 SpeciesToHoennPokedexNum(u16 species) { if (!species) return 0; @@ -4820,7 +4820,7 @@ u16 SpeciesToCryId(u16 species) return gUnknown_82539D4[species - ((SPECIES_OLD_UNOWN_Z + 1) - 1)]; } -void sub_8043338(u16 species, u32 personality, u8 *dest) +static void sub_8043338(u16 species, u32 personality, u8 *dest) { if (species == SPECIES_SPINDA && dest != gMonSpritesGfxPtr->sprites[0] @@ -4969,7 +4969,7 @@ u8 GetTrainerEncounterMusicId(u16 trainer) return gTrainers[trainer].encounterMusic_gender & 0x7F; } -u16 ModifyStatByNature(u8 nature, u16 n, u8 statIndex) +static u16 ModifyStatByNature(u8 nature, u16 n, u8 statIndex) { if (statIndex < 1 || statIndex > 5) { @@ -5214,7 +5214,7 @@ u8 CheckPartyHasHadPokerus(struct Pokemon *party, u8 selection) return retVal; } -void sub_8043B38(void) +static void sub_8043B38(void) { u8 foo[4]; // huh? } @@ -5224,7 +5224,7 @@ void sub_8043B40(void) u8 foo[4]; // huh? } -void SetMonExpWithMaxLevelCheck(struct Pokemon *mon, int species, u8 unused, u32 data) +static void SetMonExpWithMaxLevelCheck(struct Pokemon *mon, int species, u8 unused, u32 data) { if (data > gExperienceTables[gBaseStats[species].growthRate][100]) { @@ -5387,7 +5387,7 @@ void ClearBattleMonForms(void) gBattleMonForms[i] = 0; } -u16 GetMUS_ForBattle(void) +static u16 GetMUS_ForBattle(void) { if(gBattleTypeFlags & 0x1000) return 0x12A; @@ -5490,7 +5490,7 @@ bool8 IsPokeSpriteNotFlipped(u16 species) return gBaseStats[species].noFlip; } -s8 GetMonFlavorRelation(struct Pokemon *mon, u8 flavor) +static s8 GetMonFlavorRelation(struct Pokemon *mon, u8 flavor) { u8 nature = GetNature(mon); return gPokeblockFlavorCompatibilityTable[nature * 5 + flavor]; @@ -5605,7 +5605,7 @@ bool8 IsMonShiny(struct Pokemon *mon) return IsShinyOtIdPersonality(otId, personality); } -bool8 IsShinyOtIdPersonality(u32 otId, u32 personality) +static bool8 IsShinyOtIdPersonality(u32 otId, u32 personality) { bool8 retVal = FALSE; u32 shinyValue = HIHALF(otId) ^ LOHALF(otId) ^ HIHALF(personality) ^ LOHALF(personality); @@ -5699,7 +5699,7 @@ bool8 sub_804455C(u8 caseId, u8 battlerId) return TRUE; } -u16 GetDeoxysStat(struct Pokemon *mon, s32 statId) +static u16 GetDeoxysStat(struct Pokemon *mon, s32 statId) { s32 ivVal, evVal; u16 statValue; @@ -5807,7 +5807,7 @@ bool8 CheckBattleTypeGhost(struct Pokemon *mon, u8 bank) return FALSE; } -void OakSpeechNidoranFSetupTemplate(struct OakSpeechNidoranFStruct *structPtr, u8 battlePosition) +static void OakSpeechNidoranFSetupTemplate(struct OakSpeechNidoranFStruct *structPtr, u8 battlePosition) { u16 i = 0, j = 0; @@ -5833,7 +5833,7 @@ void OakSpeechNidoranFSetupTemplate(struct OakSpeechNidoranFStruct *structPtr, u } // not used -void OakSpeechNidoranFSetupTemplateDummy(struct OakSpeechNidoranFStruct *structPtr) +static void OakSpeechNidoranFSetupTemplateDummy(struct OakSpeechNidoranFStruct *structPtr) { u16 i, j; @@ -5888,6 +5888,7 @@ struct OakSpeechNidoranFStruct *OakSpeechNidoranFSetup(u8 battlePosition, bool8 battlePosition = 1; if (battlePosition > 8) battlePosition = 8; + // The following two statements refused to cooperate. sOakSpeechNidoranResources->spriteCount = battlePosition; sOakSpeechNidoranResources->battlePosition = battlePosition; sOakSpeechNidoranResources->frameCount = 4; @@ -6319,8 +6320,7 @@ void OakSpeechNidoranFFreeResources(void) if (sOakSpeechNidoranResources->dataBuffer != NULL) FREE_AND_SET_NULL(sOakSpeechNidoranResources->dataBuffer); memset(sOakSpeechNidoranResources, 0, sizeof(struct OakSpeechNidoranFStruct)); - Free(sOakSpeechNidoranResources); - sOakSpeechNidoranResources = NULL; + FREE_AND_SET_NULL(sOakSpeechNidoranResources); } } -- cgit v1.2.3 From 1caed4e6320570e9815ef43a4f0ebd14cc52c066 Mon Sep 17 00:00:00 2001 From: jiangzhengwenjz Date: Sun, 14 Jul 2019 05:31:17 +0800 Subject: updated headers --- src/pokemon.c | 55 +++++++++++++++++++++++++------------------------------ 1 file changed, 25 insertions(+), 30 deletions(-) (limited to 'src/pokemon.c') diff --git a/src/pokemon.c b/src/pokemon.c index 232376da2..2c2264f05 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -5,6 +5,7 @@ #include "random.h" #include "main.h" #include "text.h" +#include "data2.h" #include "string_util.h" #include "battle.h" #include "item.h" @@ -56,8 +57,28 @@ struct OakSpeechNidoranFStruct struct SpriteFrameImage *frameImages; }; -// resolve here and static -extern struct OakSpeechNidoranFStruct *sOakSpeechNidoranResources; +// TODO: move sLearningMoveTableID, gPlayerPartyCount, gEnemyPartyCount, +// gEnemyParty, gPlayerParty here after resolving symbol ref in between. +extern u8 sLearningMoveTableID; + +EWRAM_DATA struct SpriteTemplate gMultiuseSpriteTemplate = {0}; +static EWRAM_DATA struct OakSpeechNidoranFStruct *sOakSpeechNidoranResources = NULL; + +static union PokemonSubstruct *GetSubstruct(struct BoxPokemon *boxMon, u32 personality, u8 substructType); +static u16 GetDeoxysStat(struct Pokemon *mon, s32 statId); +static bool8 IsShinyOtIdPersonality(u32 otId, u32 personality); +static u16 ModifyStatByNature(u8 nature, u16 n, u8 statIndex); +static u8 GetNatureFromPersonality(u32 personality); +static bool8 sub_8042BE8(struct Pokemon *mon, u32 unused, u32 healMask, u8 battleId); +static bool8 HealStatusConditions(struct Pokemon *mon, u32 unused, u32 healMask, u8 battleId); +static bool8 IsPokemonStorageFull(void); +static u8 SendMonToPC(struct Pokemon* mon); +static void EncryptBoxMon(struct BoxPokemon *boxMon); +static void DeleteFirstMoveAndGiveMoveToBoxMon(struct BoxPokemon *boxMon, u16 move); +static void GiveBoxMonInitialMoveset(struct BoxPokemon *boxMon); +static u16 GiveMoveToBoxMon(struct BoxPokemon *boxMon, u16 move); +static u8 GetLevelFromMonExp(struct Pokemon *mon); +static u16 CalculateBoxMonChecksum(struct BoxPokemon *boxMon); // decomp here extern struct SpriteTemplate gUnknown_825DF50[]; @@ -84,32 +105,6 @@ extern const u8 gUnknown_825DEA1[]; extern const u8 gUnknown_825DEA9[]; extern const u8 sGetMonDataEVConstants[]; -// extern symbols -extern u8 sBattler_AI; -extern u8 sLearningMoveTableID; -extern u8 gBattleMonForms[4]; -extern const struct CompressedSpritePalette gMonPaletteTable[]; -extern const struct CompressedSpritePalette gMonShinyPaletteTable[]; -extern const union AnimCmd *const *const gTrainerBackAnimsPtrTable[]; -extern const union AnimCmd *const *const gTrainerFrontAnimsPtrTable[]; -extern const union AnimCmd *const gUnknown_82349BC[]; - -static union PokemonSubstruct *GetSubstruct(struct BoxPokemon *boxMon, u32 personality, u8 substructType); -static u16 GetDeoxysStat(struct Pokemon *mon, s32 statId); -static bool8 IsShinyOtIdPersonality(u32 otId, u32 personality); -static u16 ModifyStatByNature(u8 nature, u16 n, u8 statIndex); -static u8 GetNatureFromPersonality(u32 personality); -static bool8 sub_8042BE8(struct Pokemon *mon, u32 unused, u32 healMask, u8 battleId); -static bool8 HealStatusConditions(struct Pokemon *mon, u32 unused, u32 healMask, u8 battleId); -static bool8 IsPokemonStorageFull(void); -static u8 SendMonToPC(struct Pokemon* mon); -static void EncryptBoxMon(struct BoxPokemon *boxMon); -static void DeleteFirstMoveAndGiveMoveToBoxMon(struct BoxPokemon *boxMon, u16 move); -static void GiveBoxMonInitialMoveset(struct BoxPokemon *boxMon); -static u16 GiveMoveToBoxMon(struct BoxPokemon *boxMon, u16 move); -static u8 GetLevelFromMonExp(struct Pokemon *mon); -static u16 CalculateBoxMonChecksum(struct BoxPokemon *boxMon); - // code void ZeroBoxMonData(struct BoxPokemon *boxMon) { @@ -4938,10 +4933,10 @@ bool8 sub_80435E0(void) return retVal; } -bool8 GetLinkTrainerFlankId(u8 id) +bool8 GetLinkTrainerFlankId(u8 linkPlayerId) { bool8 retVal = FALSE; - switch (gLinkPlayers[id].id) + switch (gLinkPlayers[linkPlayerId].id) { case 0: case 3: -- cgit v1.2.3 From fc16f5ac4f937c7ecd3b196878e4d33b7f752dcd Mon Sep 17 00:00:00 2001 From: jiangzhengwenjz Date: Sun, 14 Jul 2019 08:17:42 +0800 Subject: start of data decomp and data.s setup --- src/pokemon.c | 97 +++++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 87 insertions(+), 10 deletions(-) (limited to 'src/pokemon.c') diff --git a/src/pokemon.c b/src/pokemon.c index 2c2264f05..e1c8c6d43 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -80,17 +80,9 @@ static u16 GiveMoveToBoxMon(struct BoxPokemon *boxMon, u16 move); static u8 GetLevelFromMonExp(struct Pokemon *mon); static u16 CalculateBoxMonChecksum(struct BoxPokemon *boxMon); -// decomp here extern struct SpriteTemplate gUnknown_825DF50[]; -extern const u16 sDeoxysBaseStats[]; -extern const u16 gLinkPlayerFacilityClasses[]; -extern const struct SpriteTemplate gUnknown_825E05C; extern s8 gPokeblockFlavorCompatibilityTable[]; -extern const u16 sHMMoves[]; extern const u8 gPPUpWriteMasks[]; -extern const u8 sSecretBaseFacilityClasses[2][5]; -extern const s8 sFriendshipEventDeltas[][3]; -extern const u8 gUnknown_825DFF0[]; extern const u8 sHoldEffectToType[][2]; extern u16 gUnknown_8251CB8[]; extern u16 gUnknown_8251FEE[]; @@ -103,7 +95,92 @@ extern s8 gNatureStatTable[][5]; extern u32 gTMHMLearnsets[][2]; extern const u8 gUnknown_825DEA1[]; extern const u8 gUnknown_825DEA9[]; -extern const u8 sGetMonDataEVConstants[]; + +static const u8 sSecretBaseFacilityClasses[][5] = +{ + { 0x58, 0x58, 0x58, 0x58, 0x58 }, + { 0x58, 0x58, 0x58, 0x58, 0x58 }, +}; + +static const u8 sGetMonDataEVConstants[] = +{ + MON_DATA_HP_EV, + MON_DATA_ATK_EV, + MON_DATA_DEF_EV, + MON_DATA_SPEED_EV, + MON_DATA_SPDEF_EV, + MON_DATA_SPATK_EV +}; + +static const u8 gUnknown_825DFF0[] = +{ + STAT_ATK, STAT_ATK, STAT_SPEED, STAT_DEF, STAT_SPATK, STAT_ACC +}; + +static const s8 sFriendshipEventDeltas[][3] = +{ + { 5, 3, 2 }, + { 5, 3, 2 }, + { 1, 1, 0 }, + { 3, 2, 1 }, + { 1, 1, 0 }, + { 1, 1, 1 }, + { 3, 3, 3 }, + {-1, -1, -1 }, + {-5, -5, -10 }, + {-5, -5, -10 }, +}; + +static const u16 sHMMoves[] = +{ + MOVE_CUT, MOVE_FLY, MOVE_SURF, MOVE_STRENGTH, MOVE_FLASH, + MOVE_ROCK_SMASH, MOVE_WATERFALL, MOVE_DIVE, 0xFFFF +}; + +static const u16 sDeoxysBaseStats[] = +{ + 50, // Hp + 180, // Attack + 20, // Defense + 150, // Speed + 180, // Sp.Attack + 20, // Sp.Defense +}; + +const u16 gLinkPlayerFacilityClasses[] = +{ + 0x74, 0x6F, 0x5C, 0x58, 0x6A, + 0x59, 0x6D, 0x6C, 0x75, 0x7D, + 0x5D, 0x5A, 0x89, 0x8A, 0x8C, + 0x68, 0x0, +}; + +const static struct OamData sOakSpeechNidoranFDummyOamData = +{ + .y = 0, + .affineMode = 0, + .objMode = 0, + .mosaic = 0, + .bpp = 0, + .shape = 0, + .x = 0, + .matrixNum = 0, + .size = 3, + .tileNum = 0, + .priority = 0, + .paletteNum = 0, +}; + +const struct SpriteTemplate sOakSpeechNidoranFDummyTemplate = +{ + .tileTag = SPRITE_INVALID_TAG, + .paletteTag = SPRITE_INVALID_TAG, + .oam = &sOakSpeechNidoranFDummyOamData, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy, +}; // code void ZeroBoxMonData(struct BoxPokemon *boxMon) @@ -5834,7 +5911,7 @@ static void OakSpeechNidoranFSetupTemplateDummy(struct OakSpeechNidoranFStruct * for (i = 0; i < (s8)structPtr->spriteCount; ++i) { - structPtr->templates[i] = gUnknown_825E05C; + structPtr->templates[i] = sOakSpeechNidoranFDummyTemplate; for (j = 0; j < structPtr->frameCount; ++j) structPtr->frameImages[i * structPtr->spriteCount + j].data = &structPtr->bufferPtrs[i][j * 0x800]; structPtr->templates[i].images = &structPtr->frameImages[i * structPtr->spriteCount]; // should be frameCount logically -- cgit v1.2.3 From 6e2ae504b86d0b72c797d441d7ea204bc7d5e2d3 Mon Sep 17 00:00:00 2001 From: jiangzhengwenjz Date: Sun, 14 Jul 2019 09:36:11 +0800 Subject: finished data decomp --- src/pokemon.c | 225 +++++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 193 insertions(+), 32 deletions(-) (limited to 'src/pokemon.c') diff --git a/src/pokemon.c b/src/pokemon.c index e1c8c6d43..d9e404a83 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -8,6 +8,7 @@ #include "data2.h" #include "string_util.h" #include "battle.h" +#include "battle_2.h" #include "item.h" #include "event_data.h" #include "util.h" @@ -80,21 +81,181 @@ static u16 GiveMoveToBoxMon(struct BoxPokemon *boxMon, u16 move); static u8 GetLevelFromMonExp(struct Pokemon *mon); static u16 CalculateBoxMonChecksum(struct BoxPokemon *boxMon); -extern struct SpriteTemplate gUnknown_825DF50[]; -extern s8 gPokeblockFlavorCompatibilityTable[]; -extern const u8 gPPUpWriteMasks[]; -extern const u8 sHoldEffectToType[][2]; -extern u16 gUnknown_8251CB8[]; -extern u16 gUnknown_8251FEE[]; -extern u16 gUnknown_8252324[]; -extern struct SpriteTemplate gUnknown_825DEF0[]; -extern const u8 gUnknown_825DEA1[]; -extern u16 gUnknown_82539D4[]; -extern struct SpindaSpot gSpindaSpotGraphics[]; -extern s8 gNatureStatTable[][5]; -extern u32 gTMHMLearnsets[][2]; -extern const u8 gUnknown_825DEA1[]; -extern const u8 gUnknown_825DEA9[]; +const s8 gPokeblockFlavorCompatibilityTable[] = +{ + // Cool, Beauty, Cute, Smart, Tough + 0, 0, 0, 0, 0, // Hardy + 1, 0, 0, 0, -1, // Lonely + 1, 0, -1, 0, 0, // Brave + 1, -1, 0, 0, 0, // Adamant + 1, 0, 0, -1, 0, // Naughty + -1, 0, 0, 0, 1, // Bold + 0, 0, 0, 0, 0, // Docile + 0, 0, -1, 0, 1, // Relaxed + 0, -1, 0, 0, 1, // Impish + 0, 0, 0, -1, 1, // Lax + -1, 0, 1, 0, 0, // Timid + 0, 0, 1, 0, -1, // Hasty + 0, 0, 0, 0, 0, // Serious + 0, -1, 1, 0, 0, // Jolly + 0, 0, 1, -1, 0, // Naive + -1, 1, 0, 0, 0, // Modest + 0, 1, 0, 0, -1, // Mild + 0, 1, -1, 0, 0, // Quiet + 0, 0, 0, 0, 0, // Bashful + 0, 1, 0, -1, 0, // Rash + -1, 0, 0, 1, 0, // Calm + 0, 0, 0, 1, -1, // Gentle + 0, 0, -1, 1, 0, // Sassy + 0, -1, 0, 1, 0, // Careful + 0, 0, 0, 0, 0 // Quirky +}; + +const u8 gPPUpGetMask[] = { 0x03, 0x0c, 0x30, 0xc0 }; // Masks for getting PP Up count, also PP Max values + +const u8 gPPUpSetMask[] = { 0xfc, 0xf3, 0xcf, 0x3f }; // Masks for setting PP Up count + +const u8 gPPUpAddMask[] = { 0x01, 0x04, 0x10, 0x40 }; // Values added to PP Up count + +const u8 gStatStageRatios[][2] = +{ + { 10, 40 }, + { 10, 35 }, + { 10, 30 }, + { 10, 25 }, + { 10, 20 }, + { 10, 15 }, + { 10, 10 }, + { 15, 10 }, + { 20, 10 }, + { 25, 10 }, + { 30, 10 }, + { 35, 10 }, + { 40, 10 }, + { 138, 174 }, + { 108, 120 }, +}; + +static const u8 filler = 0xFF; + +static const u8 sHoldEffectToType[][2] = +{ + {HOLD_EFFECT_BUG_POWER, TYPE_BUG}, + {HOLD_EFFECT_STEEL_POWER, TYPE_STEEL}, + {HOLD_EFFECT_GROUND_POWER, TYPE_GROUND}, + {HOLD_EFFECT_ROCK_POWER, TYPE_ROCK}, + {HOLD_EFFECT_GRASS_POWER, TYPE_GRASS}, + {HOLD_EFFECT_DARK_POWER, TYPE_DARK}, + {HOLD_EFFECT_FIGHTING_POWER, TYPE_FIGHTING}, + {HOLD_EFFECT_ELECTRIC_POWER, TYPE_ELECTRIC}, + {HOLD_EFFECT_WATER_POWER, TYPE_WATER}, + {HOLD_EFFECT_FLYING_POWER, TYPE_FLYING}, + {HOLD_EFFECT_POISON_POWER, TYPE_POISON}, + {HOLD_EFFECT_ICE_POWER, TYPE_ICE}, + {HOLD_EFFECT_GHOST_POWER, TYPE_GHOST}, + {HOLD_EFFECT_PSYCHIC_POWER, TYPE_PSYCHIC}, + {HOLD_EFFECT_FIRE_POWER, TYPE_FIRE}, + {HOLD_EFFECT_DRAGON_POWER, TYPE_DRAGON}, + {HOLD_EFFECT_NORMAL_POWER, TYPE_NORMAL}, +}; + +const struct SpriteTemplate gUnknown_825DEF0[] = +{ + { + .tileTag = SPRITE_INVALID_TAG, + .paletteTag = 0, + .oam = &gUnknown_824F018, + .anims = NULL, + .images = gUnknown_8234698, + .affineAnims = gUnknown_82348C8, + .callback = sub_80120C4, + }, + { + .tileTag = SPRITE_INVALID_TAG, + .paletteTag = 0, + .oam = &gUnknown_824F010, + .anims = NULL, + .images = gUnknown_82346B8, + .affineAnims = gUnknown_8234944, + .callback = oac_poke_opponent, + }, + { + .tileTag = SPRITE_INVALID_TAG, + .paletteTag = 0, + .oam = &gUnknown_824F018, + .anims = NULL, + .images = gUnknown_82346D8, + .affineAnims = gUnknown_82348C8, + .callback = sub_80120C4, + }, + { + .tileTag = SPRITE_INVALID_TAG, + .paletteTag = 0, + .oam = &gUnknown_824F010, + .anims = NULL, + .images = gUnknown_82346F8, + .affineAnims = gUnknown_8234944, + .callback = oac_poke_opponent, + }, +}; + +const struct SpriteTemplate gUnknown_825DF50[] = +{ + { + .tileTag = SPRITE_INVALID_TAG, + .paletteTag = 0, + .oam = &gUnknown_824F018, + .anims = NULL, + .images = gUnknown_8234718, + .affineAnims = gUnknown_82348C8, + .callback = sub_80120C4, + }, + { + .tileTag = SPRITE_INVALID_TAG, + .paletteTag = 0, + .oam = &gUnknown_824F018, + .anims = NULL, + .images = gUnknown_8234740, + .affineAnims = gUnknown_82348C8, + .callback = sub_80120C4, + }, + { + .tileTag = SPRITE_INVALID_TAG, + .paletteTag = 0, + .oam = &gUnknown_824F018, + .anims = NULL, + .images = gUnknown_82347A8, + .affineAnims = gUnknown_82348C8, + .callback = sub_80120C4, + }, + { + .tileTag = SPRITE_INVALID_TAG, + .paletteTag = 0, + .oam = &gUnknown_824F018, + .anims = NULL, + .images = gUnknown_82347C8, + .affineAnims = gUnknown_82348C8, + .callback = sub_80120C4, + }, + { + .tileTag = SPRITE_INVALID_TAG, + .paletteTag = 0, + .oam = &gUnknown_824F018, + .anims = NULL, + .images = gUnknown_8234768, + .affineAnims = gUnknown_82348C8, + .callback = sub_80120C4, + }, + { + .tileTag = SPRITE_INVALID_TAG, + .paletteTag = 0, + .oam = &gUnknown_824F018, + .anims = NULL, + .images = gUnknown_8234788, + .affineAnims = gUnknown_82348C8, + .callback = sub_80120C4, + }, +}; static const u8 sSecretBaseFacilityClasses[][5] = { @@ -2348,19 +2509,19 @@ void GetSpeciesName(u8 *name, u16 species) u8 CalculatePPWithBonus(u16 move, u8 ppBonuses, u8 moveIndex) { u8 basePP = gBattleMoves[move].pp; - return basePP + ((basePP * 20 * ((gUnknown_825DEA1[moveIndex] & ppBonuses) >> (2 * moveIndex))) / 100); + return basePP + ((basePP * 20 * ((gPPUpGetMask[moveIndex] & ppBonuses) >> (2 * moveIndex))) / 100); } void RemoveMonPPBonus(struct Pokemon *mon, u8 moveIndex) { u8 ppBonuses = GetMonData(mon, MON_DATA_PP_BONUSES, NULL); - ppBonuses &= gPPUpWriteMasks[moveIndex]; + ppBonuses &= gPPUpSetMask[moveIndex]; SetMonData(mon, MON_DATA_PP_BONUSES, &ppBonuses); } void RemoveBattleMonPPBonus(struct BattlePokemon *mon, u8 moveIndex) { - mon->ppBonuses &= gPPUpWriteMasks[moveIndex]; + mon->ppBonuses &= gPPUpSetMask[moveIndex]; } static void CopyPlayerPartyMonToBattleData(u8 battlerId, u8 partyIndex) @@ -2598,11 +2759,11 @@ bool8 PokemonUseItemEffects(struct Pokemon *pkmn, u16 item, u8 partyIndex, u8 mo if (r10 & 0x20) { r10 &= ~0x20; - data = (GetMonData(pkmn, MON_DATA_PP_BONUSES, NULL) & gUnknown_825DEA1[moveIndex]) >> (moveIndex * 2); + data = (GetMonData(pkmn, MON_DATA_PP_BONUSES, NULL) & gPPUpGetMask[moveIndex]) >> (moveIndex * 2); sp28 = CalculatePPWithBonus(GetMonData(pkmn, MON_DATA_MOVE1 + moveIndex, NULL), GetMonData(pkmn, MON_DATA_PP_BONUSES, NULL), moveIndex); if (data < 3 && sp28 > 4) { - data = GetMonData(pkmn, MON_DATA_PP_BONUSES, NULL) + gUnknown_825DEA9[moveIndex]; + data = GetMonData(pkmn, MON_DATA_PP_BONUSES, NULL) + gPPUpAddMask[moveIndex]; SetMonData(pkmn, MON_DATA_PP_BONUSES, &data); data = CalculatePPWithBonus(GetMonData(pkmn, MON_DATA_MOVE1 + moveIndex, NULL), data, moveIndex) - sp28; @@ -2827,13 +2988,13 @@ bool8 PokemonUseItemEffects(struct Pokemon *pkmn, u16 item, u8 partyIndex, u8 mo } break; case 4: - data = (GetMonData(pkmn, MON_DATA_PP_BONUSES, NULL) & gUnknown_825DEA1[moveIndex]) >> (moveIndex * 2); + data = (GetMonData(pkmn, MON_DATA_PP_BONUSES, NULL) & gPPUpGetMask[moveIndex]) >> (moveIndex * 2); if (data < 3) { r4 = CalculatePPWithBonus(GetMonData(pkmn, MON_DATA_MOVE1 + moveIndex, NULL), GetMonData(pkmn, MON_DATA_PP_BONUSES, NULL), moveIndex); data = GetMonData(pkmn, MON_DATA_PP_BONUSES, NULL); - data &= gPPUpWriteMasks[moveIndex]; - data += gUnknown_825DEA9[moveIndex] * 3; + data &= gPPUpSetMask[moveIndex]; + data += gPPUpAddMask[moveIndex] * 3; SetMonData(pkmn, MON_DATA_PP_BONUSES, &data); data = CalculatePPWithBonus(GetMonData(pkmn, MON_DATA_MOVE1 + moveIndex, NULL), data, moveIndex) - r4; @@ -3131,11 +3292,11 @@ bool8 PokemonUseItemEffects2(struct Pokemon *pkmn, u16 item, u8 partyIndex, u8 m if (r10 & 0x20) { r10 &= ~0x20; - data = (GetMonData(pkmn, MON_DATA_PP_BONUSES, NULL) & gUnknown_825DEA1[moveIndex]) >> (moveIndex * 2); + data = (GetMonData(pkmn, MON_DATA_PP_BONUSES, NULL) & gPPUpGetMask[moveIndex]) >> (moveIndex * 2); sp28 = CalculatePPWithBonus(GetMonData(pkmn, MON_DATA_MOVE1 + moveIndex, NULL), GetMonData(pkmn, MON_DATA_PP_BONUSES, NULL), moveIndex); if (data < 3 && sp28 > 4) { - //data = GetMonData(pkmn, MON_DATA_PP_BONUSES, NULL) + gUnknown_825DEA9[moveIndex]; + //data = GetMonData(pkmn, MON_DATA_PP_BONUSES, NULL) + gPPUpAddMask[moveIndex]; //SetMonData(pkmn, MON_DATA_PP_BONUSES, &data); // //data = CalculatePPWithBonus(GetMonData(pkmn, MON_DATA_MOVE1 + moveIndex, NULL), data, moveIndex) - sp28; @@ -3370,7 +3531,7 @@ bool8 PokemonUseItemEffects2(struct Pokemon *pkmn, u16 item, u8 partyIndex, u8 m } break; case 4: - data = (GetMonData(pkmn, MON_DATA_PP_BONUSES, NULL) & gUnknown_825DEA1[moveIndex]) >> (moveIndex * 2); + data = (GetMonData(pkmn, MON_DATA_PP_BONUSES, NULL) & gPPUpGetMask[moveIndex]) >> (moveIndex * 2); r4 = CalculatePPWithBonus(GetMonData(pkmn, MON_DATA_MOVE1 + moveIndex, NULL), GetMonData(pkmn, MON_DATA_PP_BONUSES, NULL), moveIndex); if (data < 3) { @@ -3379,8 +3540,8 @@ bool8 PokemonUseItemEffects2(struct Pokemon *pkmn, u16 item, u8 partyIndex, u8 m /* data = GetMonData(pkmn, MON_DATA_PP_BONUSES, NULL); - data &= gPPUpWriteMasks[moveIndex]; - data += gUnknown_825DEA9[moveIndex] * 3; + data &= gPPUpSetMask[moveIndex]; + data += gPPUpAddMask[moveIndex] * 3; SetMonData(pkmn, MON_DATA_PP_BONUSES, &data); data = CalculatePPWithBonus(GetMonData(pkmn, MON_DATA_MOVE1 + moveIndex, NULL), data, moveIndex) - r4; @@ -4041,7 +4202,7 @@ _08042850:\n\ movs r2, 0\n\ bl GetMonData\n\ adds r5, r0, 0\n\ - ldr r0, _080428DC @ =gUnknown_825DEA1\n\ + ldr r0, _080428DC @ =gPPUpGetMask\n\ ldr r1, [sp, 0x8]\n\ adds r0, r1, r0\n\ ldrb r0, [r0]\n\ @@ -4097,7 +4258,7 @@ _080428D2:\n\ ldr r0, [r0]\n\ mov pc, r0\n\ .align 2, 0\n\ -_080428DC: .4byte gUnknown_825DEA1\n\ +_080428DC: .4byte gPPUpGetMask\n\ _080428E0: .4byte _080428E4\n\ .align 2, 0\n\ _080428E4:\n\ @@ -4359,7 +4520,7 @@ _08042AF4:\n\ movs r2, 0\n\ bl GetMonData\n\ adds r5, r0, 0\n\ - ldr r0, _08042B48 @ =gUnknown_825DEA1\n\ + ldr r0, _08042B48 @ =gPPUpGetMask\n\ ldr r1, [sp, 0x8]\n\ adds r0, r1, r0\n\ ldrb r0, [r0]\n\ @@ -4393,7 +4554,7 @@ _08042AF4:\n\ str r2, [sp, 0x10]\n\ b _08042BBE\n\ .align 2, 0\n\ -_08042B48: .4byte gUnknown_825DEA1\n\ +_08042B48: .4byte gPPUpGetMask\n\ _08042B4C:\n\ mov r0, r8\n\ movs r1, 0x20\n\ -- cgit v1.2.3 From 277726fd5e8c6da021206deeecb163f40073ff3c Mon Sep 17 00:00:00 2001 From: jiangzhengwenjz Date: Sun, 14 Jul 2019 12:22:44 +0800 Subject: interpret filler with empty agbstring --- src/pokemon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/pokemon.c') diff --git a/src/pokemon.c b/src/pokemon.c index d9e404a83..f4150d5b6 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -136,7 +136,7 @@ const u8 gStatStageRatios[][2] = { 108, 120 }, }; -static const u8 filler = 0xFF; +static const u8 sFiller = _(""); static const u8 sHoldEffectToType[][2] = { -- cgit v1.2.3 From cb3722a57a45db006e2fe293b8c8b77afc944dc9 Mon Sep 17 00:00:00 2001 From: jiangzhengwenjz Date: Mon, 15 Jul 2019 06:34:49 +0800 Subject: decompiled learnset and evo table --- src/pokemon.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/pokemon.c') diff --git a/src/pokemon.c b/src/pokemon.c index f4150d5b6..a06926c77 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -61,7 +61,6 @@ struct OakSpeechNidoranFStruct // TODO: move sLearningMoveTableID, gPlayerPartyCount, gEnemyPartyCount, // gEnemyParty, gPlayerParty here after resolving symbol ref in between. extern u8 sLearningMoveTableID; - EWRAM_DATA struct SpriteTemplate gMultiuseSpriteTemplate = {0}; static EWRAM_DATA struct OakSpeechNidoranFStruct *sOakSpeechNidoranResources = NULL; @@ -81,6 +80,10 @@ static u16 GiveMoveToBoxMon(struct BoxPokemon *boxMon, u16 move); static u8 GetLevelFromMonExp(struct Pokemon *mon); static u16 CalculateBoxMonChecksum(struct BoxPokemon *boxMon); +#include "data/pokemon/level_up_learnsets.h" +#include "data/pokemon/evolution.h" +#include "data/pokemon/level_up_learnset_pointers.h" + const s8 gPokeblockFlavorCompatibilityTable[] = { // Cool, Beauty, Cute, Smart, Tough @@ -484,7 +487,7 @@ void CreateBoxMon(struct BoxPokemon *boxMon, u16 species, u8 level, u8 fixedIV, SetBoxMonData(boxMon, MON_DATA_SPDEF_IV, &iv); } - if (gBaseStats[species].ability2) + if (gBaseStats[species].abilities[1]) { value = personality & 1; SetBoxMonData(boxMon, MON_DATA_ALT_ABILITY, &value); @@ -727,7 +730,7 @@ static u16 CalculateBoxMonChecksum(struct BoxPokemon *boxMon) u8 baseStat = gBaseStats[species].base; \ s32 n = (((2 * baseStat + iv + ev / 4) * level) / 100) + 5; \ u8 nature = GetNature(mon); \ - n = ModifyStatByNature(nature, n, statIndex); \ + n = ModifyStatByNature(nature, n, statIndex); \ SetMonData(mon, field, &n); \ } @@ -888,9 +891,6 @@ static void GiveMonInitialMoveset(struct Pokemon *mon) GiveBoxMonInitialMoveset(&mon->box); } -// TODO: make level_up_learnsets.h in src/data and move this to there. -#define LEVEL_UP_END 0xffff - static void GiveBoxMonInitialMoveset(struct BoxPokemon *boxMon) { u16 species = GetBoxMonData(boxMon, MON_DATA_SPECIES, NULL); @@ -2402,9 +2402,9 @@ u8 GetMonsStateToDoubles(void) u8 GetAbilityBySpecies(u16 species, bool8 altAbility) { if (altAbility) - gLastUsedAbility = gBaseStats[species].ability2; + gLastUsedAbility = gBaseStats[species].abilities[1]; else - gLastUsedAbility = gBaseStats[species].ability1; + gLastUsedAbility = gBaseStats[species].abilities[0]; return gLastUsedAbility; } -- cgit v1.2.3 From b18ff9653ff2ff159fbabe4782e1112359c8cb97 Mon Sep 17 00:00:00 2001 From: jiangzhengwenjz Date: Mon, 15 Jul 2019 08:29:41 +0800 Subject: base_stats.h --- src/pokemon.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/pokemon.c') diff --git a/src/pokemon.c b/src/pokemon.c index a06926c77..2b4cb08a1 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -80,6 +80,7 @@ static u16 GiveMoveToBoxMon(struct BoxPokemon *boxMon, u16 move); static u8 GetLevelFromMonExp(struct Pokemon *mon); static u16 CalculateBoxMonChecksum(struct BoxPokemon *boxMon); +#include "data/pokemon/base_stats.h" #include "data/pokemon/level_up_learnsets.h" #include "data/pokemon/evolution.h" #include "data/pokemon/level_up_learnset_pointers.h" -- cgit v1.2.3 From 1e390204cb15b0fbae322fca3be3fde03b81955f Mon Sep 17 00:00:00 2001 From: jiangzhengwenjz Date: Mon, 15 Jul 2019 09:30:28 +0800 Subject: thru gTMHMLearnsets --- src/pokemon.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'src/pokemon.c') diff --git a/src/pokemon.c b/src/pokemon.c index 2b4cb08a1..3609e71e5 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -35,6 +35,8 @@ #include "constants/abilities.h" #include "constants/flags.h" #include "constants/moves.h" +#include "constants/trainer_classes.h" +#include "constants/facility_trainer_classes.h" #include "constants/hold_effects.h" #include "constants/battle_move_effects.h" @@ -80,6 +82,10 @@ static u16 GiveMoveToBoxMon(struct BoxPokemon *boxMon, u16 move); static u8 GetLevelFromMonExp(struct Pokemon *mon); static u16 CalculateBoxMonChecksum(struct BoxPokemon *boxMon); +#include "data/pokemon/tmhm_learnsets.h" +#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/level_up_learnsets.h" #include "data/pokemon/evolution.h" @@ -314,10 +320,10 @@ static const u16 sDeoxysBaseStats[] = const u16 gLinkPlayerFacilityClasses[] = { - 0x74, 0x6F, 0x5C, 0x58, 0x6A, - 0x59, 0x6D, 0x6C, 0x75, 0x7D, - 0x5D, 0x5A, 0x89, 0x8A, 0x8C, - 0x68, 0x0, + FACILITY_CLASS_COOLTRAINER_3, FACILITY_CLASS_BLACK_BELT_2, FACILITY_CLASS_CAMPER_2, FACILITY_CLASS_YOUNGSTER_2, FACILITY_CLASS_PSYCHIC_3, + FACILITY_CLASS_BUG_CATCHER_2, FACILITY_CLASS_TAMER, FACILITY_CLASS_JUGGLER, FACILITY_CLASS_COOLTRAINER_4, FACILITY_CLASS_CHANNELER, + FACILITY_CLASS_PICNICKER_2, FACILITY_CLASS_LASS_2, FACILITY_CLASS_PSYCHIC_4, FACILITY_CLASS_CRUSH_GIRL, FACILITY_CLASS_PKMN_BREEDER_3, + FACILITY_CLASS_BEAUTY_2, FACILITY_CLASS_AQUA_LEADER, }; const static struct OamData sOakSpeechNidoranFDummyOamData = @@ -5051,7 +5057,7 @@ u16 SpeciesToCryId(u16 species) if (species <= SPECIES_OLD_UNOWN_Z - 1) return SPECIES_UNOWN - 1; - return gUnknown_82539D4[species - ((SPECIES_OLD_UNOWN_Z + 1) - 1)]; + return sSpeciesIdToCryId[species - ((SPECIES_OLD_UNOWN_Z + 1) - 1)]; } static void sub_8043338(u16 species, u32 personality, u8 *dest) -- cgit v1.2.3 From 00cd1d483d76c9e63b010eb98a3e1f03386934ca Mon Sep 17 00:00:00 2001 From: jiangzhengwenjz Date: Mon, 15 Jul 2019 10:06:01 +0800 Subject: thru sSpindaSpotGraphics --- src/pokemon.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 49 insertions(+), 6 deletions(-) (limited to 'src/pokemon.c') diff --git a/src/pokemon.c b/src/pokemon.c index 3609e71e5..41860862c 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -30,6 +30,7 @@ #include "party_menu.h" #include "field_specials.h" #include "constants/items.h" +#include "constants/item_effects.h" #include "constants/species.h" #include "constants/pokemon.h" #include "constants/abilities.h" @@ -82,6 +83,48 @@ static u16 GiveMoveToBoxMon(struct BoxPokemon *boxMon, u16 move); static u8 GetLevelFromMonExp(struct Pokemon *mon); static u16 CalculateBoxMonChecksum(struct BoxPokemon *boxMon); + + +static const struct SpindaSpot sSpindaSpotGraphics[] = +{ + {16, 7, INCBIN_U16("graphics/spinda_spots/spot_0.bin")}, + {40, 8, INCBIN_U16("graphics/spinda_spots/spot_1.bin")}, + {22, 25, INCBIN_U16("graphics/spinda_spots/spot_2.bin")}, + {34, 26, INCBIN_U16("graphics/spinda_spots/spot_3.bin")} +}; + +#include "data/pokemon/item_effects.h" + +const s8 gNatureStatTable[][5] = +{ + // Atk Def Spd Sp.Atk Sp.Def + { 0, 0, 0, 0, 0}, // Hardy + { +1, -1, 0, 0, 0}, // Lonely + { +1, 0, -1, 0, 0}, // Brave + { +1, 0, 0, -1, 0}, // Adamant + { +1, 0, 0, 0, -1}, // Naughty + { -1, +1, 0, 0, 0}, // Bold + { 0, 0, 0, 0, 0}, // Docile + { 0, +1, -1, 0, 0}, // Relaxed + { 0, +1, 0, -1, 0}, // Impish + { 0, +1, 0, 0, -1}, // Lax + { -1, 0, +1, 0, 0}, // Timid + { 0, -1, +1, 0, 0}, // Hasty + { 0, 0, 0, 0, 0}, // Serious + { 0, 0, +1, -1, 0}, // Jolly + { 0, 0, +1, 0, -1}, // Naive + { -1, 0, 0, +1, 0}, // Modest + { 0, -1, 0, +1, 0}, // Mild + { 0, 0, -1, +1, 0}, // Quiet + { 0, 0, 0, 0, 0}, // Bashful + { 0, 0, 0, +1, -1}, // Rash + { -1, 0, 0, 0, +1}, // Calm + { 0, -1, 0, 0, +1}, // Gentle + { 0, 0, -1, 0, +1}, // Sassy + { 0, 0, 0, -1, +1}, // Careful + { 0, 0, 0, 0, 0}, // Quirky +}; + #include "data/pokemon/tmhm_learnsets.h" #include "data/pokemon/trainer_class_lookups.h" #include "data/pokemon/cry_ids.h" @@ -5070,13 +5113,13 @@ static void sub_8043338(u16 species, u32 personality, u8 *dest) for (i = 0; i < 4; i++) { int j; - u8 x = gSpindaSpotGraphics[i].x + ((personality & 0x0F) - 8); - u8 y = gSpindaSpotGraphics[i].y + (((personality & 0xF0) >> 4) - 8); + u8 x = sSpindaSpotGraphics[i].x + ((personality & 0x0F) - 8); + u8 y = sSpindaSpotGraphics[i].y + (((personality & 0xF0) >> 4) - 8); for (j = 0; j < 16; j++) { int k; - s32 row = gSpindaSpotGraphics[i].image[j]; + s32 row = sSpindaSpotGraphics[i].image[j]; for (k = x; k < x + 16; k++) { @@ -5115,13 +5158,13 @@ void DrawSpindaSpots(u16 species, u32 personality, u8 *dest, u8 a4) for (i = 0; i < 4; i++) { int j; - u8 x = gSpindaSpotGraphics[i].x + ((personality & 0x0F) - 8); - u8 y = gSpindaSpotGraphics[i].y + (((personality & 0xF0) >> 4) - 8); + u8 x = sSpindaSpotGraphics[i].x + ((personality & 0x0F) - 8); + u8 y = sSpindaSpotGraphics[i].y + (((personality & 0xF0) >> 4) - 8); for (j = 0; j < 16; j++) { int k; - s32 row = gSpindaSpotGraphics[i].image[j]; + s32 row = sSpindaSpotGraphics[i].image[j]; for (k = x; k < x + 16; k++) { -- cgit v1.2.3 From 51a779aa7b0318d9c4388d839b2210f963607a82 Mon Sep 17 00:00:00 2001 From: jiangzhengwenjz Date: Mon, 15 Jul 2019 13:10:29 +0800 Subject: finished pokemon data decomp --- src/pokemon.c | 1280 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 1265 insertions(+), 15 deletions(-) (limited to 'src/pokemon.c') diff --git a/src/pokemon.c b/src/pokemon.c index 41860862c..31fa5fed4 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -47,6 +47,10 @@ // Extracts the lower 16 bits of a 32-bit number #define LOHALF(n) ((n) & 0xFFFF) +#define SPECIES_TO_HOENN(name) [SPECIES_##name - 1] = HOENN_DEX_##name +#define SPECIES_TO_NATIONAL(name) [SPECIES_##name - 1] = NATIONAL_DEX_##name +#define HOENN_TO_NATIONAL(name) [HOENN_DEX_##name - 1] = NATIONAL_DEX_##name + struct OakSpeechNidoranFStruct { u8 spriteCount:4; @@ -83,7 +87,1254 @@ static u16 GiveMoveToBoxMon(struct BoxPokemon *boxMon, u16 move); static u8 GetLevelFromMonExp(struct Pokemon *mon); static u16 CalculateBoxMonChecksum(struct BoxPokemon *boxMon); +#include "data/battle_moves.h" + +static const u8 sUnreferencedData[] = { 0x34, 0x00, 0x10, 0x00, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00 }; + +static const u16 sSpeciesToHoennPokedexNum[] = // Assigns all species to the Hoenn Dex Index (Summary No. for Hoenn Dex) +{ + SPECIES_TO_HOENN(BULBASAUR), + SPECIES_TO_HOENN(IVYSAUR), + SPECIES_TO_HOENN(VENUSAUR), + SPECIES_TO_HOENN(CHARMANDER), + SPECIES_TO_HOENN(CHARMELEON), + SPECIES_TO_HOENN(CHARIZARD), + SPECIES_TO_HOENN(SQUIRTLE), + SPECIES_TO_HOENN(WARTORTLE), + SPECIES_TO_HOENN(BLASTOISE), + SPECIES_TO_HOENN(CATERPIE), + SPECIES_TO_HOENN(METAPOD), + SPECIES_TO_HOENN(BUTTERFREE), + SPECIES_TO_HOENN(WEEDLE), + SPECIES_TO_HOENN(KAKUNA), + SPECIES_TO_HOENN(BEEDRILL), + SPECIES_TO_HOENN(PIDGEY), + SPECIES_TO_HOENN(PIDGEOTTO), + SPECIES_TO_HOENN(PIDGEOT), + SPECIES_TO_HOENN(RATTATA), + SPECIES_TO_HOENN(RATICATE), + SPECIES_TO_HOENN(SPEAROW), + SPECIES_TO_HOENN(FEAROW), + SPECIES_TO_HOENN(EKANS), + SPECIES_TO_HOENN(ARBOK), + SPECIES_TO_HOENN(PIKACHU), + SPECIES_TO_HOENN(RAICHU), + SPECIES_TO_HOENN(SANDSHREW), + SPECIES_TO_HOENN(SANDSLASH), + SPECIES_TO_HOENN(NIDORAN_F), + SPECIES_TO_HOENN(NIDORINA), + SPECIES_TO_HOENN(NIDOQUEEN), + SPECIES_TO_HOENN(NIDORAN_M), + SPECIES_TO_HOENN(NIDORINO), + SPECIES_TO_HOENN(NIDOKING), + SPECIES_TO_HOENN(CLEFAIRY), + SPECIES_TO_HOENN(CLEFABLE), + SPECIES_TO_HOENN(VULPIX), + SPECIES_TO_HOENN(NINETALES), + SPECIES_TO_HOENN(JIGGLYPUFF), + SPECIES_TO_HOENN(WIGGLYTUFF), + SPECIES_TO_HOENN(ZUBAT), + SPECIES_TO_HOENN(GOLBAT), + SPECIES_TO_HOENN(ODDISH), + SPECIES_TO_HOENN(GLOOM), + SPECIES_TO_HOENN(VILEPLUME), + SPECIES_TO_HOENN(PARAS), + SPECIES_TO_HOENN(PARASECT), + SPECIES_TO_HOENN(VENONAT), + SPECIES_TO_HOENN(VENOMOTH), + SPECIES_TO_HOENN(DIGLETT), + SPECIES_TO_HOENN(DUGTRIO), + SPECIES_TO_HOENN(MEOWTH), + SPECIES_TO_HOENN(PERSIAN), + SPECIES_TO_HOENN(PSYDUCK), + SPECIES_TO_HOENN(GOLDUCK), + SPECIES_TO_HOENN(MANKEY), + SPECIES_TO_HOENN(PRIMEAPE), + SPECIES_TO_HOENN(GROWLITHE), + SPECIES_TO_HOENN(ARCANINE), + SPECIES_TO_HOENN(POLIWAG), + SPECIES_TO_HOENN(POLIWHIRL), + SPECIES_TO_HOENN(POLIWRATH), + SPECIES_TO_HOENN(ABRA), + SPECIES_TO_HOENN(KADABRA), + SPECIES_TO_HOENN(ALAKAZAM), + SPECIES_TO_HOENN(MACHOP), + SPECIES_TO_HOENN(MACHOKE), + SPECIES_TO_HOENN(MACHAMP), + SPECIES_TO_HOENN(BELLSPROUT), + SPECIES_TO_HOENN(WEEPINBELL), + SPECIES_TO_HOENN(VICTREEBEL), + SPECIES_TO_HOENN(TENTACOOL), + SPECIES_TO_HOENN(TENTACRUEL), + SPECIES_TO_HOENN(GEODUDE), + SPECIES_TO_HOENN(GRAVELER), + SPECIES_TO_HOENN(GOLEM), + SPECIES_TO_HOENN(PONYTA), + SPECIES_TO_HOENN(RAPIDASH), + SPECIES_TO_HOENN(SLOWPOKE), + SPECIES_TO_HOENN(SLOWBRO), + SPECIES_TO_HOENN(MAGNEMITE), + SPECIES_TO_HOENN(MAGNETON), + SPECIES_TO_HOENN(FARFETCHD), + SPECIES_TO_HOENN(DODUO), + SPECIES_TO_HOENN(DODRIO), + SPECIES_TO_HOENN(SEEL), + SPECIES_TO_HOENN(DEWGONG), + SPECIES_TO_HOENN(GRIMER), + SPECIES_TO_HOENN(MUK), + SPECIES_TO_HOENN(SHELLDER), + SPECIES_TO_HOENN(CLOYSTER), + SPECIES_TO_HOENN(GASTLY), + SPECIES_TO_HOENN(HAUNTER), + SPECIES_TO_HOENN(GENGAR), + SPECIES_TO_HOENN(ONIX), + SPECIES_TO_HOENN(DROWZEE), + SPECIES_TO_HOENN(HYPNO), + SPECIES_TO_HOENN(KRABBY), + SPECIES_TO_HOENN(KINGLER), + SPECIES_TO_HOENN(VOLTORB), + SPECIES_TO_HOENN(ELECTRODE), + SPECIES_TO_HOENN(EXEGGCUTE), + SPECIES_TO_HOENN(EXEGGUTOR), + SPECIES_TO_HOENN(CUBONE), + SPECIES_TO_HOENN(MAROWAK), + SPECIES_TO_HOENN(HITMONLEE), + SPECIES_TO_HOENN(HITMONCHAN), + SPECIES_TO_HOENN(LICKITUNG), + SPECIES_TO_HOENN(KOFFING), + SPECIES_TO_HOENN(WEEZING), + SPECIES_TO_HOENN(RHYHORN), + SPECIES_TO_HOENN(RHYDON), + SPECIES_TO_HOENN(CHANSEY), + SPECIES_TO_HOENN(TANGELA), + SPECIES_TO_HOENN(KANGASKHAN), + SPECIES_TO_HOENN(HORSEA), + SPECIES_TO_HOENN(SEADRA), + SPECIES_TO_HOENN(GOLDEEN), + SPECIES_TO_HOENN(SEAKING), + SPECIES_TO_HOENN(STARYU), + SPECIES_TO_HOENN(STARMIE), + SPECIES_TO_HOENN(MR_MIME), + SPECIES_TO_HOENN(SCYTHER), + SPECIES_TO_HOENN(JYNX), + SPECIES_TO_HOENN(ELECTABUZZ), + SPECIES_TO_HOENN(MAGMAR), + SPECIES_TO_HOENN(PINSIR), + SPECIES_TO_HOENN(TAUROS), + SPECIES_TO_HOENN(MAGIKARP), + SPECIES_TO_HOENN(GYARADOS), + SPECIES_TO_HOENN(LAPRAS), + SPECIES_TO_HOENN(DITTO), + SPECIES_TO_HOENN(EEVEE), + SPECIES_TO_HOENN(VAPOREON), + SPECIES_TO_HOENN(JOLTEON), + SPECIES_TO_HOENN(FLAREON), + SPECIES_TO_HOENN(PORYGON), + SPECIES_TO_HOENN(OMANYTE), + SPECIES_TO_HOENN(OMASTAR), + SPECIES_TO_HOENN(KABUTO), + SPECIES_TO_HOENN(KABUTOPS), + SPECIES_TO_HOENN(AERODACTYL), + SPECIES_TO_HOENN(SNORLAX), + SPECIES_TO_HOENN(ARTICUNO), + SPECIES_TO_HOENN(ZAPDOS), + SPECIES_TO_HOENN(MOLTRES), + SPECIES_TO_HOENN(DRATINI), + SPECIES_TO_HOENN(DRAGONAIR), + SPECIES_TO_HOENN(DRAGONITE), + SPECIES_TO_HOENN(MEWTWO), + SPECIES_TO_HOENN(MEW), + SPECIES_TO_HOENN(CHIKORITA), + SPECIES_TO_HOENN(BAYLEEF), + SPECIES_TO_HOENN(MEGANIUM), + SPECIES_TO_HOENN(CYNDAQUIL), + SPECIES_TO_HOENN(QUILAVA), + SPECIES_TO_HOENN(TYPHLOSION), + SPECIES_TO_HOENN(TOTODILE), + SPECIES_TO_HOENN(CROCONAW), + SPECIES_TO_HOENN(FERALIGATR), + SPECIES_TO_HOENN(SENTRET), + SPECIES_TO_HOENN(FURRET), + SPECIES_TO_HOENN(HOOTHOOT), + SPECIES_TO_HOENN(NOCTOWL), + SPECIES_TO_HOENN(LEDYBA), + SPECIES_TO_HOENN(LEDIAN), + SPECIES_TO_HOENN(SPINARAK), + SPECIES_TO_HOENN(ARIADOS), + SPECIES_TO_HOENN(CROBAT), + SPECIES_TO_HOENN(CHINCHOU), + SPECIES_TO_HOENN(LANTURN), + SPECIES_TO_HOENN(PICHU), + SPECIES_TO_HOENN(CLEFFA), + SPECIES_TO_HOENN(IGGLYBUFF), + SPECIES_TO_HOENN(TOGEPI), + SPECIES_TO_HOENN(TOGETIC), + SPECIES_TO_HOENN(NATU), + SPECIES_TO_HOENN(XATU), + SPECIES_TO_HOENN(MAREEP), + SPECIES_TO_HOENN(FLAAFFY), + SPECIES_TO_HOENN(AMPHAROS), + SPECIES_TO_HOENN(BELLOSSOM), + SPECIES_TO_HOENN(MARILL), + SPECIES_TO_HOENN(AZUMARILL), + SPECIES_TO_HOENN(SUDOWOODO), + SPECIES_TO_HOENN(POLITOED), + SPECIES_TO_HOENN(HOPPIP), + SPECIES_TO_HOENN(SKIPLOOM), + SPECIES_TO_HOENN(JUMPLUFF), + SPECIES_TO_HOENN(AIPOM), + SPECIES_TO_HOENN(SUNKERN), + SPECIES_TO_HOENN(SUNFLORA), + SPECIES_TO_HOENN(YANMA), + SPECIES_TO_HOENN(WOOPER), + SPECIES_TO_HOENN(QUAGSIRE), + SPECIES_TO_HOENN(ESPEON), + SPECIES_TO_HOENN(UMBREON), + SPECIES_TO_HOENN(MURKROW), + SPECIES_TO_HOENN(SLOWKING), + SPECIES_TO_HOENN(MISDREAVUS), + SPECIES_TO_HOENN(UNOWN), + SPECIES_TO_HOENN(WOBBUFFET), + SPECIES_TO_HOENN(GIRAFARIG), + SPECIES_TO_HOENN(PINECO), + SPECIES_TO_HOENN(FORRETRESS), + SPECIES_TO_HOENN(DUNSPARCE), + SPECIES_TO_HOENN(GLIGAR), + SPECIES_TO_HOENN(STEELIX), + SPECIES_TO_HOENN(SNUBBULL), + SPECIES_TO_HOENN(GRANBULL), + SPECIES_TO_HOENN(QWILFISH), + SPECIES_TO_HOENN(SCIZOR), + SPECIES_TO_HOENN(SHUCKLE), + SPECIES_TO_HOENN(HERACROSS), + SPECIES_TO_HOENN(SNEASEL), + SPECIES_TO_HOENN(TEDDIURSA), + SPECIES_TO_HOENN(URSARING), + SPECIES_TO_HOENN(SLUGMA), + SPECIES_TO_HOENN(MAGCARGO), + SPECIES_TO_HOENN(SWINUB), + SPECIES_TO_HOENN(PILOSWINE), + SPECIES_TO_HOENN(CORSOLA), + SPECIES_TO_HOENN(REMORAID), + SPECIES_TO_HOENN(OCTILLERY), + SPECIES_TO_HOENN(DELIBIRD), + SPECIES_TO_HOENN(MANTINE), + SPECIES_TO_HOENN(SKARMORY), + SPECIES_TO_HOENN(HOUNDOUR), + SPECIES_TO_HOENN(HOUNDOOM), + SPECIES_TO_HOENN(KINGDRA), + SPECIES_TO_HOENN(PHANPY), + SPECIES_TO_HOENN(DONPHAN), + SPECIES_TO_HOENN(PORYGON2), + SPECIES_TO_HOENN(STANTLER), + SPECIES_TO_HOENN(SMEARGLE), + SPECIES_TO_HOENN(TYROGUE), + SPECIES_TO_HOENN(HITMONTOP), + SPECIES_TO_HOENN(SMOOCHUM), + SPECIES_TO_HOENN(ELEKID), + SPECIES_TO_HOENN(MAGBY), + SPECIES_TO_HOENN(MILTANK), + SPECIES_TO_HOENN(BLISSEY), + SPECIES_TO_HOENN(RAIKOU), + SPECIES_TO_HOENN(ENTEI), + SPECIES_TO_HOENN(SUICUNE), + SPECIES_TO_HOENN(LARVITAR), + SPECIES_TO_HOENN(PUPITAR), + SPECIES_TO_HOENN(TYRANITAR), + SPECIES_TO_HOENN(LUGIA), + SPECIES_TO_HOENN(HO_OH), + SPECIES_TO_HOENN(CELEBI), + SPECIES_TO_HOENN(OLD_UNOWN_B), + SPECIES_TO_HOENN(OLD_UNOWN_C), + SPECIES_TO_HOENN(OLD_UNOWN_D), + SPECIES_TO_HOENN(OLD_UNOWN_E), + SPECIES_TO_HOENN(OLD_UNOWN_F), + SPECIES_TO_HOENN(OLD_UNOWN_G), + SPECIES_TO_HOENN(OLD_UNOWN_H), + SPECIES_TO_HOENN(OLD_UNOWN_I), + SPECIES_TO_HOENN(OLD_UNOWN_J), + SPECIES_TO_HOENN(OLD_UNOWN_K), + SPECIES_TO_HOENN(OLD_UNOWN_L), + SPECIES_TO_HOENN(OLD_UNOWN_M), + SPECIES_TO_HOENN(OLD_UNOWN_N), + SPECIES_TO_HOENN(OLD_UNOWN_O), + SPECIES_TO_HOENN(OLD_UNOWN_P), + SPECIES_TO_HOENN(OLD_UNOWN_Q), + SPECIES_TO_HOENN(OLD_UNOWN_R), + SPECIES_TO_HOENN(OLD_UNOWN_S), + SPECIES_TO_HOENN(OLD_UNOWN_T), + SPECIES_TO_HOENN(OLD_UNOWN_U), + SPECIES_TO_HOENN(OLD_UNOWN_V), + SPECIES_TO_HOENN(OLD_UNOWN_W), + SPECIES_TO_HOENN(OLD_UNOWN_X), + SPECIES_TO_HOENN(OLD_UNOWN_Y), + SPECIES_TO_HOENN(OLD_UNOWN_Z), + SPECIES_TO_HOENN(TREECKO), + SPECIES_TO_HOENN(GROVYLE), + SPECIES_TO_HOENN(SCEPTILE), + SPECIES_TO_HOENN(TORCHIC), + SPECIES_TO_HOENN(COMBUSKEN), + SPECIES_TO_HOENN(BLAZIKEN), + SPECIES_TO_HOENN(MUDKIP), + SPECIES_TO_HOENN(MARSHTOMP), + SPECIES_TO_HOENN(SWAMPERT), + SPECIES_TO_HOENN(POOCHYENA), + SPECIES_TO_HOENN(MIGHTYENA), + SPECIES_TO_HOENN(ZIGZAGOON), + SPECIES_TO_HOENN(LINOONE), + SPECIES_TO_HOENN(WURMPLE), + SPECIES_TO_HOENN(SILCOON), + SPECIES_TO_HOENN(BEAUTIFLY), + SPECIES_TO_HOENN(CASCOON), + SPECIES_TO_HOENN(DUSTOX), + SPECIES_TO_HOENN(LOTAD), + SPECIES_TO_HOENN(LOMBRE), + SPECIES_TO_HOENN(LUDICOLO), + SPECIES_TO_HOENN(SEEDOT), + SPECIES_TO_HOENN(NUZLEAF), + SPECIES_TO_HOENN(SHIFTRY), + SPECIES_TO_HOENN(NINCADA), + SPECIES_TO_HOENN(NINJASK), + SPECIES_TO_HOENN(SHEDINJA), + SPECIES_TO_HOENN(TAILLOW), + SPECIES_TO_HOENN(SWELLOW), + SPECIES_TO_HOENN(SHROOMISH), + SPECIES_TO_HOENN(BRELOOM), + SPECIES_TO_HOENN(SPINDA), + SPECIES_TO_HOENN(WINGULL), + SPECIES_TO_HOENN(PELIPPER), + SPECIES_TO_HOENN(SURSKIT), + SPECIES_TO_HOENN(MASQUERAIN), + SPECIES_TO_HOENN(WAILMER), + SPECIES_TO_HOENN(WAILORD), + SPECIES_TO_HOENN(SKITTY), + SPECIES_TO_HOENN(DELCATTY), + SPECIES_TO_HOENN(KECLEON), + SPECIES_TO_HOENN(BALTOY), + SPECIES_TO_HOENN(CLAYDOL), + SPECIES_TO_HOENN(NOSEPASS), + SPECIES_TO_HOENN(TORKOAL), + SPECIES_TO_HOENN(SABLEYE), + SPECIES_TO_HOENN(BARBOACH), + SPECIES_TO_HOENN(WHISCASH), + SPECIES_TO_HOENN(LUVDISC), + SPECIES_TO_HOENN(CORPHISH), + SPECIES_TO_HOENN(CRAWDAUNT), + SPECIES_TO_HOENN(FEEBAS), + SPECIES_TO_HOENN(MILOTIC), + SPECIES_TO_HOENN(CARVANHA), + SPECIES_TO_HOENN(SHARPEDO), + SPECIES_TO_HOENN(TRAPINCH), + SPECIES_TO_HOENN(VIBRAVA), + SPECIES_TO_HOENN(FLYGON), + SPECIES_TO_HOENN(MAKUHITA), + SPECIES_TO_HOENN(HARIYAMA), + SPECIES_TO_HOENN(ELECTRIKE), + SPECIES_TO_HOENN(MANECTRIC), + SPECIES_TO_HOENN(NUMEL), + SPECIES_TO_HOENN(CAMERUPT), + SPECIES_TO_HOENN(SPHEAL), + SPECIES_TO_HOENN(SEALEO), + SPECIES_TO_HOENN(WALREIN), + SPECIES_TO_HOENN(CACNEA), + SPECIES_TO_HOENN(CACTURNE), + SPECIES_TO_HOENN(SNORUNT), + SPECIES_TO_HOENN(GLALIE), + SPECIES_TO_HOENN(LUNATONE), + SPECIES_TO_HOENN(SOLROCK), + SPECIES_TO_HOENN(AZURILL), + SPECIES_TO_HOENN(SPOINK), + SPECIES_TO_HOENN(GRUMPIG), + SPECIES_TO_HOENN(PLUSLE), + SPECIES_TO_HOENN(MINUN), + SPECIES_TO_HOENN(MAWILE), + SPECIES_TO_HOENN(MEDITITE), + SPECIES_TO_HOENN(MEDICHAM), + SPECIES_TO_HOENN(SWABLU), + SPECIES_TO_HOENN(ALTARIA), + SPECIES_TO_HOENN(WYNAUT), + SPECIES_TO_HOENN(DUSKULL), + SPECIES_TO_HOENN(DUSCLOPS), + SPECIES_TO_HOENN(ROSELIA), + SPECIES_TO_HOENN(SLAKOTH), + SPECIES_TO_HOENN(VIGOROTH), + SPECIES_TO_HOENN(SLAKING), + SPECIES_TO_HOENN(GULPIN), + SPECIES_TO_HOENN(SWALOT), + SPECIES_TO_HOENN(TROPIUS), + SPECIES_TO_HOENN(WHISMUR), + SPECIES_TO_HOENN(LOUDRED), + SPECIES_TO_HOENN(EXPLOUD), + SPECIES_TO_HOENN(CLAMPERL), + SPECIES_TO_HOENN(HUNTAIL), + SPECIES_TO_HOENN(GOREBYSS), + SPECIES_TO_HOENN(ABSOL), + SPECIES_TO_HOENN(SHUPPET), + SPECIES_TO_HOENN(BANETTE), + SPECIES_TO_HOENN(SEVIPER), + SPECIES_TO_HOENN(ZANGOOSE), + SPECIES_TO_HOENN(RELICANTH), + SPECIES_TO_HOENN(ARON), + SPECIES_TO_HOENN(LAIRON), + SPECIES_TO_HOENN(AGGRON), + SPECIES_TO_HOENN(CASTFORM), + SPECIES_TO_HOENN(VOLBEAT), + SPECIES_TO_HOENN(ILLUMISE), + SPECIES_TO_HOENN(LILEEP), + SPECIES_TO_HOENN(CRADILY), + SPECIES_TO_HOENN(ANORITH), + SPECIES_TO_HOENN(ARMALDO), + SPECIES_TO_HOENN(RALTS), + SPECIES_TO_HOENN(KIRLIA), + SPECIES_TO_HOENN(GARDEVOIR), + SPECIES_TO_HOENN(BAGON), + SPECIES_TO_HOENN(SHELGON), + SPECIES_TO_HOENN(SALAMENCE), + SPECIES_TO_HOENN(BELDUM), + SPECIES_TO_HOENN(METANG), + SPECIES_TO_HOENN(METAGROSS), + SPECIES_TO_HOENN(REGIROCK), + SPECIES_TO_HOENN(REGICE), + SPECIES_TO_HOENN(REGISTEEL), + SPECIES_TO_HOENN(KYOGRE), + SPECIES_TO_HOENN(GROUDON), + SPECIES_TO_HOENN(RAYQUAZA), + SPECIES_TO_HOENN(LATIAS), + SPECIES_TO_HOENN(LATIOS), + SPECIES_TO_HOENN(JIRACHI), + SPECIES_TO_HOENN(DEOXYS), + SPECIES_TO_HOENN(CHIMECHO), +}; +static const u16 sSpeciesToNationalPokedexNum[] = // Assigns all species to the National Dex Index (Summary No. for National Dex) +{ + SPECIES_TO_NATIONAL(BULBASAUR), + SPECIES_TO_NATIONAL(IVYSAUR), + SPECIES_TO_NATIONAL(VENUSAUR), + SPECIES_TO_NATIONAL(CHARMANDER), + SPECIES_TO_NATIONAL(CHARMELEON), + SPECIES_TO_NATIONAL(CHARIZARD), + SPECIES_TO_NATIONAL(SQUIRTLE), + SPECIES_TO_NATIONAL(WARTORTLE), + SPECIES_TO_NATIONAL(BLASTOISE), + SPECIES_TO_NATIONAL(CATERPIE), + SPECIES_TO_NATIONAL(METAPOD), + SPECIES_TO_NATIONAL(BUTTERFREE), + SPECIES_TO_NATIONAL(WEEDLE), + SPECIES_TO_NATIONAL(KAKUNA), + SPECIES_TO_NATIONAL(BEEDRILL), + SPECIES_TO_NATIONAL(PIDGEY), + SPECIES_TO_NATIONAL(PIDGEOTTO), + SPECIES_TO_NATIONAL(PIDGEOT), + SPECIES_TO_NATIONAL(RATTATA), + SPECIES_TO_NATIONAL(RATICATE), + SPECIES_TO_NATIONAL(SPEAROW), + SPECIES_TO_NATIONAL(FEAROW), + SPECIES_TO_NATIONAL(EKANS), + SPECIES_TO_NATIONAL(ARBOK), + SPECIES_TO_NATIONAL(PIKACHU), + SPECIES_TO_NATIONAL(RAICHU), + SPECIES_TO_NATIONAL(SANDSHREW), + SPECIES_TO_NATIONAL(SANDSLASH), + SPECIES_TO_NATIONAL(NIDORAN_F), + SPECIES_TO_NATIONAL(NIDORINA), + SPECIES_TO_NATIONAL(NIDOQUEEN), + SPECIES_TO_NATIONAL(NIDORAN_M), + SPECIES_TO_NATIONAL(NIDORINO), + SPECIES_TO_NATIONAL(NIDOKING), + SPECIES_TO_NATIONAL(CLEFAIRY), + SPECIES_TO_NATIONAL(CLEFABLE), + SPECIES_TO_NATIONAL(VULPIX), + SPECIES_TO_NATIONAL(NINETALES), + SPECIES_TO_NATIONAL(JIGGLYPUFF), + SPECIES_TO_NATIONAL(WIGGLYTUFF), + SPECIES_TO_NATIONAL(ZUBAT), + SPECIES_TO_NATIONAL(GOLBAT), + SPECIES_TO_NATIONAL(ODDISH), + SPECIES_TO_NATIONAL(GLOOM), + SPECIES_TO_NATIONAL(VILEPLUME), + SPECIES_TO_NATIONAL(PARAS), + SPECIES_TO_NATIONAL(PARASECT), + SPECIES_TO_NATIONAL(VENONAT), + SPECIES_TO_NATIONAL(VENOMOTH), + SPECIES_TO_NATIONAL(DIGLETT), + SPECIES_TO_NATIONAL(DUGTRIO), + SPECIES_TO_NATIONAL(MEOWTH), + SPECIES_TO_NATIONAL(PERSIAN), + SPECIES_TO_NATIONAL(PSYDUCK), + SPECIES_TO_NATIONAL(GOLDUCK), + SPECIES_TO_NATIONAL(MANKEY), + SPECIES_TO_NATIONAL(PRIMEAPE), + SPECIES_TO_NATIONAL(GROWLITHE), + SPECIES_TO_NATIONAL(ARCANINE), + SPECIES_TO_NATIONAL(POLIWAG), + SPECIES_TO_NATIONAL(POLIWHIRL), + SPECIES_TO_NATIONAL(POLIWRATH), + SPECIES_TO_NATIONAL(ABRA), + SPECIES_TO_NATIONAL(KADABRA), + SPECIES_TO_NATIONAL(ALAKAZAM), + SPECIES_TO_NATIONAL(MACHOP), + SPECIES_TO_NATIONAL(MACHOKE), + SPECIES_TO_NATIONAL(MACHAMP), + SPECIES_TO_NATIONAL(BELLSPROUT), + SPECIES_TO_NATIONAL(WEEPINBELL), + SPECIES_TO_NATIONAL(VICTREEBEL), + SPECIES_TO_NATIONAL(TENTACOOL), + SPECIES_TO_NATIONAL(TENTACRUEL), + SPECIES_TO_NATIONAL(GEODUDE), + SPECIES_TO_NATIONAL(GRAVELER), + SPECIES_TO_NATIONAL(GOLEM), + SPECIES_TO_NATIONAL(PONYTA), + SPECIES_TO_NATIONAL(RAPIDASH), + SPECIES_TO_NATIONAL(SLOWPOKE), + SPECIES_TO_NATIONAL(SLOWBRO), + SPECIES_TO_NATIONAL(MAGNEMITE), + SPECIES_TO_NATIONAL(MAGNETON), + SPECIES_TO_NATIONAL(FARFETCHD), + SPECIES_TO_NATIONAL(DODUO), + SPECIES_TO_NATIONAL(DODRIO), + SPECIES_TO_NATIONAL(SEEL), + SPECIES_TO_NATIONAL(DEWGONG), + SPECIES_TO_NATIONAL(GRIMER), + SPECIES_TO_NATIONAL(MUK), + SPECIES_TO_NATIONAL(SHELLDER), + SPECIES_TO_NATIONAL(CLOYSTER), + SPECIES_TO_NATIONAL(GASTLY), + SPECIES_TO_NATIONAL(HAUNTER), + SPECIES_TO_NATIONAL(GENGAR), + SPECIES_TO_NATIONAL(ONIX), + SPECIES_TO_NATIONAL(DROWZEE), + SPECIES_TO_NATIONAL(HYPNO), + SPECIES_TO_NATIONAL(KRABBY), + SPECIES_TO_NATIONAL(KINGLER), + SPECIES_TO_NATIONAL(VOLTORB), + SPECIES_TO_NATIONAL(ELECTRODE), + SPECIES_TO_NATIONAL(EXEGGCUTE), + SPECIES_TO_NATIONAL(EXEGGUTOR), + SPECIES_TO_NATIONAL(CUBONE), + SPECIES_TO_NATIONAL(MAROWAK), + SPECIES_TO_NATIONAL(HITMONLEE), + SPECIES_TO_NATIONAL(HITMONCHAN), + SPECIES_TO_NATIONAL(LICKITUNG), + SPECIES_TO_NATIONAL(KOFFING), + SPECIES_TO_NATIONAL(WEEZING), + SPECIES_TO_NATIONAL(RHYHORN), + SPECIES_TO_NATIONAL(RHYDON), + SPECIES_TO_NATIONAL(CHANSEY), + SPECIES_TO_NATIONAL(TANGELA), + SPECIES_TO_NATIONAL(KANGASKHAN), + SPECIES_TO_NATIONAL(HORSEA), + SPECIES_TO_NATIONAL(SEADRA), + SPECIES_TO_NATIONAL(GOLDEEN), + SPECIES_TO_NATIONAL(SEAKING), + SPECIES_TO_NATIONAL(STARYU), + SPECIES_TO_NATIONAL(STARMIE), + SPECIES_TO_NATIONAL(MR_MIME), + SPECIES_TO_NATIONAL(SCYTHER), + SPECIES_TO_NATIONAL(JYNX), + SPECIES_TO_NATIONAL(ELECTABUZZ), + SPECIES_TO_NATIONAL(MAGMAR), + SPECIES_TO_NATIONAL(PINSIR), + SPECIES_TO_NATIONAL(TAUROS), + SPECIES_TO_NATIONAL(MAGIKARP), + SPECIES_TO_NATIONAL(GYARADOS), + SPECIES_TO_NATIONAL(LAPRAS), + SPECIES_TO_NATIONAL(DITTO), + SPECIES_TO_NATIONAL(EEVEE), + SPECIES_TO_NATIONAL(VAPOREON), + SPECIES_TO_NATIONAL(JOLTEON), + SPECIES_TO_NATIONAL(FLAREON), + SPECIES_TO_NATIONAL(PORYGON), + SPECIES_TO_NATIONAL(OMANYTE), + SPECIES_TO_NATIONAL(OMASTAR), + SPECIES_TO_NATIONAL(KABUTO), + SPECIES_TO_NATIONAL(KABUTOPS), + SPECIES_TO_NATIONAL(AERODACTYL), + SPECIES_TO_NATIONAL(SNORLAX), + SPECIES_TO_NATIONAL(ARTICUNO), + SPECIES_TO_NATIONAL(ZAPDOS), + SPECIES_TO_NATIONAL(MOLTRES), + SPECIES_TO_NATIONAL(DRATINI), + SPECIES_TO_NATIONAL(DRAGONAIR), + SPECIES_TO_NATIONAL(DRAGONITE), + SPECIES_TO_NATIONAL(MEWTWO), + SPECIES_TO_NATIONAL(MEW), + SPECIES_TO_NATIONAL(CHIKORITA), + SPECIES_TO_NATIONAL(BAYLEEF), + SPECIES_TO_NATIONAL(MEGANIUM), + SPECIES_TO_NATIONAL(CYNDAQUIL), + SPECIES_TO_NATIONAL(QUILAVA), + SPECIES_TO_NATIONAL(TYPHLOSION), + SPECIES_TO_NATIONAL(TOTODILE), + SPECIES_TO_NATIONAL(CROCONAW), + SPECIES_TO_NATIONAL(FERALIGATR), + SPECIES_TO_NATIONAL(SENTRET), + SPECIES_TO_NATIONAL(FURRET), + SPECIES_TO_NATIONAL(HOOTHOOT), + SPECIES_TO_NATIONAL(NOCTOWL), + SPECIES_TO_NATIONAL(LEDYBA), + SPECIES_TO_NATIONAL(LEDIAN), + SPECIES_TO_NATIONAL(SPINARAK), + SPECIES_TO_NATIONAL(ARIADOS), + SPECIES_TO_NATIONAL(CROBAT), + SPECIES_TO_NATIONAL(CHINCHOU), + SPECIES_TO_NATIONAL(LANTURN), + SPECIES_TO_NATIONAL(PICHU), + SPECIES_TO_NATIONAL(CLEFFA), + SPECIES_TO_NATIONAL(IGGLYBUFF), + SPECIES_TO_NATIONAL(TOGEPI), + SPECIES_TO_NATIONAL(TOGETIC), + SPECIES_TO_NATIONAL(NATU), + SPECIES_TO_NATIONAL(XATU), + SPECIES_TO_NATIONAL(MAREEP), + SPECIES_TO_NATIONAL(FLAAFFY), + SPECIES_TO_NATIONAL(AMPHAROS), + SPECIES_TO_NATIONAL(BELLOSSOM), + SPECIES_TO_NATIONAL(MARILL), + SPECIES_TO_NATIONAL(AZUMARILL), + SPECIES_TO_NATIONAL(SUDOWOODO), + SPECIES_TO_NATIONAL(POLITOED), + SPECIES_TO_NATIONAL(HOPPIP), + SPECIES_TO_NATIONAL(SKIPLOOM), + SPECIES_TO_NATIONAL(JUMPLUFF), + SPECIES_TO_NATIONAL(AIPOM), + SPECIES_TO_NATIONAL(SUNKERN), + SPECIES_TO_NATIONAL(SUNFLORA), + SPECIES_TO_NATIONAL(YANMA), + SPECIES_TO_NATIONAL(WOOPER), + SPECIES_TO_NATIONAL(QUAGSIRE), + SPECIES_TO_NATIONAL(ESPEON), + SPECIES_TO_NATIONAL(UMBREON), + SPECIES_TO_NATIONAL(MURKROW), + SPECIES_TO_NATIONAL(SLOWKING), + SPECIES_TO_NATIONAL(MISDREAVUS), + SPECIES_TO_NATIONAL(UNOWN), + SPECIES_TO_NATIONAL(WOBBUFFET), + SPECIES_TO_NATIONAL(GIRAFARIG), + SPECIES_TO_NATIONAL(PINECO), + SPECIES_TO_NATIONAL(FORRETRESS), + SPECIES_TO_NATIONAL(DUNSPARCE), + SPECIES_TO_NATIONAL(GLIGAR), + SPECIES_TO_NATIONAL(STEELIX), + SPECIES_TO_NATIONAL(SNUBBULL), + SPECIES_TO_NATIONAL(GRANBULL), + SPECIES_TO_NATIONAL(QWILFISH), + SPECIES_TO_NATIONAL(SCIZOR), + SPECIES_TO_NATIONAL(SHUCKLE), + SPECIES_TO_NATIONAL(HERACROSS), + SPECIES_TO_NATIONAL(SNEASEL), + SPECIES_TO_NATIONAL(TEDDIURSA), + SPECIES_TO_NATIONAL(URSARING), + SPECIES_TO_NATIONAL(SLUGMA), + SPECIES_TO_NATIONAL(MAGCARGO), + SPECIES_TO_NATIONAL(SWINUB), + SPECIES_TO_NATIONAL(PILOSWINE), + SPECIES_TO_NATIONAL(CORSOLA), + SPECIES_TO_NATIONAL(REMORAID), + SPECIES_TO_NATIONAL(OCTILLERY), + SPECIES_TO_NATIONAL(DELIBIRD), + SPECIES_TO_NATIONAL(MANTINE), + SPECIES_TO_NATIONAL(SKARMORY), + SPECIES_TO_NATIONAL(HOUNDOUR), + SPECIES_TO_NATIONAL(HOUNDOOM), + SPECIES_TO_NATIONAL(KINGDRA), + SPECIES_TO_NATIONAL(PHANPY), + SPECIES_TO_NATIONAL(DONPHAN), + SPECIES_TO_NATIONAL(PORYGON2), + SPECIES_TO_NATIONAL(STANTLER), + SPECIES_TO_NATIONAL(SMEARGLE), + SPECIES_TO_NATIONAL(TYROGUE), + SPECIES_TO_NATIONAL(HITMONTOP), + SPECIES_TO_NATIONAL(SMOOCHUM), + SPECIES_TO_NATIONAL(ELEKID), + SPECIES_TO_NATIONAL(MAGBY), + SPECIES_TO_NATIONAL(MILTANK), + SPECIES_TO_NATIONAL(BLISSEY), + SPECIES_TO_NATIONAL(RAIKOU), + SPECIES_TO_NATIONAL(ENTEI), + SPECIES_TO_NATIONAL(SUICUNE), + SPECIES_TO_NATIONAL(LARVITAR), + SPECIES_TO_NATIONAL(PUPITAR), + SPECIES_TO_NATIONAL(TYRANITAR), + SPECIES_TO_NATIONAL(LUGIA), + SPECIES_TO_NATIONAL(HO_OH), + SPECIES_TO_NATIONAL(CELEBI), + SPECIES_TO_NATIONAL(OLD_UNOWN_B), + SPECIES_TO_NATIONAL(OLD_UNOWN_C), + SPECIES_TO_NATIONAL(OLD_UNOWN_D), + SPECIES_TO_NATIONAL(OLD_UNOWN_E), + SPECIES_TO_NATIONAL(OLD_UNOWN_F), + SPECIES_TO_NATIONAL(OLD_UNOWN_G), + SPECIES_TO_NATIONAL(OLD_UNOWN_H), + SPECIES_TO_NATIONAL(OLD_UNOWN_I), + SPECIES_TO_NATIONAL(OLD_UNOWN_J), + SPECIES_TO_NATIONAL(OLD_UNOWN_K), + SPECIES_TO_NATIONAL(OLD_UNOWN_L), + SPECIES_TO_NATIONAL(OLD_UNOWN_M), + SPECIES_TO_NATIONAL(OLD_UNOWN_N), + SPECIES_TO_NATIONAL(OLD_UNOWN_O), + SPECIES_TO_NATIONAL(OLD_UNOWN_P), + SPECIES_TO_NATIONAL(OLD_UNOWN_Q), + SPECIES_TO_NATIONAL(OLD_UNOWN_R), + SPECIES_TO_NATIONAL(OLD_UNOWN_S), + SPECIES_TO_NATIONAL(OLD_UNOWN_T), + SPECIES_TO_NATIONAL(OLD_UNOWN_U), + SPECIES_TO_NATIONAL(OLD_UNOWN_V), + SPECIES_TO_NATIONAL(OLD_UNOWN_W), + SPECIES_TO_NATIONAL(OLD_UNOWN_X), + SPECIES_TO_NATIONAL(OLD_UNOWN_Y), + SPECIES_TO_NATIONAL(OLD_UNOWN_Z), + SPECIES_TO_NATIONAL(TREECKO), + SPECIES_TO_NATIONAL(GROVYLE), + SPECIES_TO_NATIONAL(SCEPTILE), + SPECIES_TO_NATIONAL(TORCHIC), + SPECIES_TO_NATIONAL(COMBUSKEN), + SPECIES_TO_NATIONAL(BLAZIKEN), + SPECIES_TO_NATIONAL(MUDKIP), + SPECIES_TO_NATIONAL(MARSHTOMP), + SPECIES_TO_NATIONAL(SWAMPERT), + SPECIES_TO_NATIONAL(POOCHYENA), + SPECIES_TO_NATIONAL(MIGHTYENA), + SPECIES_TO_NATIONAL(ZIGZAGOON), + SPECIES_TO_NATIONAL(LINOONE), + SPECIES_TO_NATIONAL(WURMPLE), + SPECIES_TO_NATIONAL(SILCOON), + SPECIES_TO_NATIONAL(BEAUTIFLY), + SPECIES_TO_NATIONAL(CASCOON), + SPECIES_TO_NATIONAL(DUSTOX), + SPECIES_TO_NATIONAL(LOTAD), + SPECIES_TO_NATIONAL(LOMBRE), + SPECIES_TO_NATIONAL(LUDICOLO), + SPECIES_TO_NATIONAL(SEEDOT), + SPECIES_TO_NATIONAL(NUZLEAF), + SPECIES_TO_NATIONAL(SHIFTRY), + SPECIES_TO_NATIONAL(NINCADA), + SPECIES_TO_NATIONAL(NINJASK), + SPECIES_TO_NATIONAL(SHEDINJA), + SPECIES_TO_NATIONAL(TAILLOW), + SPECIES_TO_NATIONAL(SWELLOW), + SPECIES_TO_NATIONAL(SHROOMISH), + SPECIES_TO_NATIONAL(BRELOOM), + SPECIES_TO_NATIONAL(SPINDA), + SPECIES_TO_NATIONAL(WINGULL), + SPECIES_TO_NATIONAL(PELIPPER), + SPECIES_TO_NATIONAL(SURSKIT), + SPECIES_TO_NATIONAL(MASQUERAIN), + SPECIES_TO_NATIONAL(WAILMER), + SPECIES_TO_NATIONAL(WAILORD), + SPECIES_TO_NATIONAL(SKITTY), + SPECIES_TO_NATIONAL(DELCATTY), + SPECIES_TO_NATIONAL(KECLEON), + SPECIES_TO_NATIONAL(BALTOY), + SPECIES_TO_NATIONAL(CLAYDOL), + SPECIES_TO_NATIONAL(NOSEPASS), + SPECIES_TO_NATIONAL(TORKOAL), + SPECIES_TO_NATIONAL(SABLEYE), + SPECIES_TO_NATIONAL(BARBOACH), + SPECIES_TO_NATIONAL(WHISCASH), + SPECIES_TO_NATIONAL(LUVDISC), + SPECIES_TO_NATIONAL(CORPHISH), + SPECIES_TO_NATIONAL(CRAWDAUNT), + SPECIES_TO_NATIONAL(FEEBAS), + SPECIES_TO_NATIONAL(MILOTIC), + SPECIES_TO_NATIONAL(CARVANHA), + SPECIES_TO_NATIONAL(SHARPEDO), + SPECIES_TO_NATIONAL(TRAPINCH), + SPECIES_TO_NATIONAL(VIBRAVA), + SPECIES_TO_NATIONAL(FLYGON), + SPECIES_TO_NATIONAL(MAKUHITA), + SPECIES_TO_NATIONAL(HARIYAMA), + SPECIES_TO_NATIONAL(ELECTRIKE), + SPECIES_TO_NATIONAL(MANECTRIC), + SPECIES_TO_NATIONAL(NUMEL), + SPECIES_TO_NATIONAL(CAMERUPT), + SPECIES_TO_NATIONAL(SPHEAL), + SPECIES_TO_NATIONAL(SEALEO), + SPECIES_TO_NATIONAL(WALREIN), + SPECIES_TO_NATIONAL(CACNEA), + SPECIES_TO_NATIONAL(CACTURNE), + SPECIES_TO_NATIONAL(SNORUNT), + SPECIES_TO_NATIONAL(GLALIE), + SPECIES_TO_NATIONAL(LUNATONE), + SPECIES_TO_NATIONAL(SOLROCK), + SPECIES_TO_NATIONAL(AZURILL), + SPECIES_TO_NATIONAL(SPOINK), + SPECIES_TO_NATIONAL(GRUMPIG), + SPECIES_TO_NATIONAL(PLUSLE), + SPECIES_TO_NATIONAL(MINUN), + SPECIES_TO_NATIONAL(MAWILE), + SPECIES_TO_NATIONAL(MEDITITE), + SPECIES_TO_NATIONAL(MEDICHAM), + SPECIES_TO_NATIONAL(SWABLU), + SPECIES_TO_NATIONAL(ALTARIA), + SPECIES_TO_NATIONAL(WYNAUT), + SPECIES_TO_NATIONAL(DUSKULL), + SPECIES_TO_NATIONAL(DUSCLOPS), + SPECIES_TO_NATIONAL(ROSELIA), + SPECIES_TO_NATIONAL(SLAKOTH), + SPECIES_TO_NATIONAL(VIGOROTH), + SPECIES_TO_NATIONAL(SLAKING), + SPECIES_TO_NATIONAL(GULPIN), + SPECIES_TO_NATIONAL(SWALOT), + SPECIES_TO_NATIONAL(TROPIUS), + SPECIES_TO_NATIONAL(WHISMUR), + SPECIES_TO_NATIONAL(LOUDRED), + SPECIES_TO_NATIONAL(EXPLOUD), + SPECIES_TO_NATIONAL(CLAMPERL), + SPECIES_TO_NATIONAL(HUNTAIL), + SPECIES_TO_NATIONAL(GOREBYSS), + SPECIES_TO_NATIONAL(ABSOL), + SPECIES_TO_NATIONAL(SHUPPET), + SPECIES_TO_NATIONAL(BANETTE), + SPECIES_TO_NATIONAL(SEVIPER), + SPECIES_TO_NATIONAL(ZANGOOSE), + SPECIES_TO_NATIONAL(RELICANTH), + SPECIES_TO_NATIONAL(ARON), + SPECIES_TO_NATIONAL(LAIRON), + SPECIES_TO_NATIONAL(AGGRON), + SPECIES_TO_NATIONAL(CASTFORM), + SPECIES_TO_NATIONAL(VOLBEAT), + SPECIES_TO_NATIONAL(ILLUMISE), + SPECIES_TO_NATIONAL(LILEEP), + SPECIES_TO_NATIONAL(CRADILY), + SPECIES_TO_NATIONAL(ANORITH), + SPECIES_TO_NATIONAL(ARMALDO), + SPECIES_TO_NATIONAL(RALTS), + SPECIES_TO_NATIONAL(KIRLIA), + SPECIES_TO_NATIONAL(GARDEVOIR), + SPECIES_TO_NATIONAL(BAGON), + SPECIES_TO_NATIONAL(SHELGON), + SPECIES_TO_NATIONAL(SALAMENCE), + SPECIES_TO_NATIONAL(BELDUM), + SPECIES_TO_NATIONAL(METANG), + SPECIES_TO_NATIONAL(METAGROSS), + SPECIES_TO_NATIONAL(REGIROCK), + SPECIES_TO_NATIONAL(REGICE), + SPECIES_TO_NATIONAL(REGISTEEL), + SPECIES_TO_NATIONAL(KYOGRE), + SPECIES_TO_NATIONAL(GROUDON), + SPECIES_TO_NATIONAL(RAYQUAZA), + SPECIES_TO_NATIONAL(LATIAS), + SPECIES_TO_NATIONAL(LATIOS), + SPECIES_TO_NATIONAL(JIRACHI), + SPECIES_TO_NATIONAL(DEOXYS), + SPECIES_TO_NATIONAL(CHIMECHO), +}; + +static const u16 sHoennToNationalOrder[] = // Assigns Hoenn Dex Pokémon (Using National Dex Index) +{ + HOENN_TO_NATIONAL(TREECKO), + HOENN_TO_NATIONAL(GROVYLE), + HOENN_TO_NATIONAL(SCEPTILE), + HOENN_TO_NATIONAL(TORCHIC), + HOENN_TO_NATIONAL(COMBUSKEN), + HOENN_TO_NATIONAL(BLAZIKEN), + HOENN_TO_NATIONAL(MUDKIP), + HOENN_TO_NATIONAL(MARSHTOMP), + HOENN_TO_NATIONAL(SWAMPERT), + HOENN_TO_NATIONAL(POOCHYENA), + HOENN_TO_NATIONAL(MIGHTYENA), + HOENN_TO_NATIONAL(ZIGZAGOON), + HOENN_TO_NATIONAL(LINOONE), + HOENN_TO_NATIONAL(WURMPLE), + HOENN_TO_NATIONAL(SILCOON), + HOENN_TO_NATIONAL(BEAUTIFLY), + HOENN_TO_NATIONAL(CASCOON), + HOENN_TO_NATIONAL(DUSTOX), + HOENN_TO_NATIONAL(LOTAD), + HOENN_TO_NATIONAL(LOMBRE), + HOENN_TO_NATIONAL(LUDICOLO), + HOENN_TO_NATIONAL(SEEDOT), + HOENN_TO_NATIONAL(NUZLEAF), + HOENN_TO_NATIONAL(SHIFTRY), + HOENN_TO_NATIONAL(TAILLOW), + HOENN_TO_NATIONAL(SWELLOW), + HOENN_TO_NATIONAL(WINGULL), + HOENN_TO_NATIONAL(PELIPPER), + HOENN_TO_NATIONAL(RALTS), + HOENN_TO_NATIONAL(KIRLIA), + HOENN_TO_NATIONAL(GARDEVOIR), + HOENN_TO_NATIONAL(SURSKIT), + HOENN_TO_NATIONAL(MASQUERAIN), + HOENN_TO_NATIONAL(SHROOMISH), + HOENN_TO_NATIONAL(BRELOOM), + HOENN_TO_NATIONAL(SLAKOTH), + HOENN_TO_NATIONAL(VIGOROTH), + HOENN_TO_NATIONAL(SLAKING), + HOENN_TO_NATIONAL(ABRA), + HOENN_TO_NATIONAL(KADABRA), + HOENN_TO_NATIONAL(ALAKAZAM), + HOENN_TO_NATIONAL(NINCADA), + HOENN_TO_NATIONAL(NINJASK), + HOENN_TO_NATIONAL(SHEDINJA), + HOENN_TO_NATIONAL(WHISMUR), + HOENN_TO_NATIONAL(LOUDRED), + HOENN_TO_NATIONAL(EXPLOUD), + HOENN_TO_NATIONAL(MAKUHITA), + HOENN_TO_NATIONAL(HARIYAMA), + HOENN_TO_NATIONAL(GOLDEEN), + HOENN_TO_NATIONAL(SEAKING), + HOENN_TO_NATIONAL(MAGIKARP), + HOENN_TO_NATIONAL(GYARADOS), + HOENN_TO_NATIONAL(AZURILL), + HOENN_TO_NATIONAL(MARILL), + HOENN_TO_NATIONAL(AZUMARILL), + HOENN_TO_NATIONAL(GEODUDE), + HOENN_TO_NATIONAL(GRAVELER), + HOENN_TO_NATIONAL(GOLEM), + HOENN_TO_NATIONAL(NOSEPASS), + HOENN_TO_NATIONAL(SKITTY), + HOENN_TO_NATIONAL(DELCATTY), + HOENN_TO_NATIONAL(ZUBAT), + HOENN_TO_NATIONAL(GOLBAT), + HOENN_TO_NATIONAL(CROBAT), + HOENN_TO_NATIONAL(TENTACOOL), + HOENN_TO_NATIONAL(TENTACRUEL), + HOENN_TO_NATIONAL(SABLEYE), + HOENN_TO_NATIONAL(MAWILE), + HOENN_TO_NATIONAL(ARON), + HOENN_TO_NATIONAL(LAIRON), + HOENN_TO_NATIONAL(AGGRON), + HOENN_TO_NATIONAL(MACHOP), + HOENN_TO_NATIONAL(MACHOKE), + HOENN_TO_NATIONAL(MACHAMP), + HOENN_TO_NATIONAL(MEDITITE), + HOENN_TO_NATIONAL(MEDICHAM), + HOENN_TO_NATIONAL(ELECTRIKE), + HOENN_TO_NATIONAL(MANECTRIC), + HOENN_TO_NATIONAL(PLUSLE), + HOENN_TO_NATIONAL(MINUN), + HOENN_TO_NATIONAL(MAGNEMITE), + HOENN_TO_NATIONAL(MAGNETON), + HOENN_TO_NATIONAL(VOLTORB), + HOENN_TO_NATIONAL(ELECTRODE), + HOENN_TO_NATIONAL(VOLBEAT), + HOENN_TO_NATIONAL(ILLUMISE), + HOENN_TO_NATIONAL(ODDISH), + HOENN_TO_NATIONAL(GLOOM), + HOENN_TO_NATIONAL(VILEPLUME), + HOENN_TO_NATIONAL(BELLOSSOM), + HOENN_TO_NATIONAL(DODUO), + HOENN_TO_NATIONAL(DODRIO), + HOENN_TO_NATIONAL(ROSELIA), + HOENN_TO_NATIONAL(GULPIN), + HOENN_TO_NATIONAL(SWALOT), + HOENN_TO_NATIONAL(CARVANHA), + HOENN_TO_NATIONAL(SHARPEDO), + HOENN_TO_NATIONAL(WAILMER), + HOENN_TO_NATIONAL(WAILORD), + HOENN_TO_NATIONAL(NUMEL), + HOENN_TO_NATIONAL(CAMERUPT), + HOENN_TO_NATIONAL(SLUGMA), + HOENN_TO_NATIONAL(MAGCARGO), + HOENN_TO_NATIONAL(TORKOAL), + HOENN_TO_NATIONAL(GRIMER), + HOENN_TO_NATIONAL(MUK), + HOENN_TO_NATIONAL(KOFFING), + HOENN_TO_NATIONAL(WEEZING), + HOENN_TO_NATIONAL(SPOINK), + HOENN_TO_NATIONAL(GRUMPIG), + HOENN_TO_NATIONAL(SANDSHREW), + HOENN_TO_NATIONAL(SANDSLASH), + HOENN_TO_NATIONAL(SPINDA), + HOENN_TO_NATIONAL(SKARMORY), + HOENN_TO_NATIONAL(TRAPINCH), + HOENN_TO_NATIONAL(VIBRAVA), + HOENN_TO_NATIONAL(FLYGON), + HOENN_TO_NATIONAL(CACNEA), + HOENN_TO_NATIONAL(CACTURNE), + HOENN_TO_NATIONAL(SWABLU), + HOENN_TO_NATIONAL(ALTARIA), + HOENN_TO_NATIONAL(ZANGOOSE), + HOENN_TO_NATIONAL(SEVIPER), + HOENN_TO_NATIONAL(LUNATONE), + HOENN_TO_NATIONAL(SOLROCK), + HOENN_TO_NATIONAL(BARBOACH), + HOENN_TO_NATIONAL(WHISCASH), + HOENN_TO_NATIONAL(CORPHISH), + HOENN_TO_NATIONAL(CRAWDAUNT), + HOENN_TO_NATIONAL(BALTOY), + HOENN_TO_NATIONAL(CLAYDOL), + HOENN_TO_NATIONAL(LILEEP), + HOENN_TO_NATIONAL(CRADILY), + HOENN_TO_NATIONAL(ANORITH), + HOENN_TO_NATIONAL(ARMALDO), + HOENN_TO_NATIONAL(IGGLYBUFF), + HOENN_TO_NATIONAL(JIGGLYPUFF), + HOENN_TO_NATIONAL(WIGGLYTUFF), + HOENN_TO_NATIONAL(FEEBAS), + HOENN_TO_NATIONAL(MILOTIC), + HOENN_TO_NATIONAL(CASTFORM), + HOENN_TO_NATIONAL(STARYU), + HOENN_TO_NATIONAL(STARMIE), + HOENN_TO_NATIONAL(KECLEON), + HOENN_TO_NATIONAL(SHUPPET), + HOENN_TO_NATIONAL(BANETTE), + HOENN_TO_NATIONAL(DUSKULL), + HOENN_TO_NATIONAL(DUSCLOPS), + HOENN_TO_NATIONAL(TROPIUS), + HOENN_TO_NATIONAL(CHIMECHO), + HOENN_TO_NATIONAL(ABSOL), + HOENN_TO_NATIONAL(VULPIX), + HOENN_TO_NATIONAL(NINETALES), + HOENN_TO_NATIONAL(PICHU), + HOENN_TO_NATIONAL(PIKACHU), + HOENN_TO_NATIONAL(RAICHU), + HOENN_TO_NATIONAL(PSYDUCK), + HOENN_TO_NATIONAL(GOLDUCK), + HOENN_TO_NATIONAL(WYNAUT), + HOENN_TO_NATIONAL(WOBBUFFET), + HOENN_TO_NATIONAL(NATU), + HOENN_TO_NATIONAL(XATU), + HOENN_TO_NATIONAL(GIRAFARIG), + HOENN_TO_NATIONAL(PHANPY), + HOENN_TO_NATIONAL(DONPHAN), + HOENN_TO_NATIONAL(PINSIR), + HOENN_TO_NATIONAL(HERACROSS), + HOENN_TO_NATIONAL(RHYHORN), + HOENN_TO_NATIONAL(RHYDON), + HOENN_TO_NATIONAL(SNORUNT), + HOENN_TO_NATIONAL(GLALIE), + HOENN_TO_NATIONAL(SPHEAL), + HOENN_TO_NATIONAL(SEALEO), + HOENN_TO_NATIONAL(WALREIN), + HOENN_TO_NATIONAL(CLAMPERL), + HOENN_TO_NATIONAL(HUNTAIL), + HOENN_TO_NATIONAL(GOREBYSS), + HOENN_TO_NATIONAL(RELICANTH), + HOENN_TO_NATIONAL(CORSOLA), + HOENN_TO_NATIONAL(CHINCHOU), + HOENN_TO_NATIONAL(LANTURN), + HOENN_TO_NATIONAL(LUVDISC), + HOENN_TO_NATIONAL(HORSEA), + HOENN_TO_NATIONAL(SEADRA), + HOENN_TO_NATIONAL(KINGDRA), + HOENN_TO_NATIONAL(BAGON), + HOENN_TO_NATIONAL(SHELGON), + HOENN_TO_NATIONAL(SALAMENCE), + HOENN_TO_NATIONAL(BELDUM), + HOENN_TO_NATIONAL(METANG), + HOENN_TO_NATIONAL(METAGROSS), + HOENN_TO_NATIONAL(REGIROCK), + HOENN_TO_NATIONAL(REGICE), + HOENN_TO_NATIONAL(REGISTEEL), + HOENN_TO_NATIONAL(LATIAS), + HOENN_TO_NATIONAL(LATIOS), + HOENN_TO_NATIONAL(KYOGRE), + HOENN_TO_NATIONAL(GROUDON), + HOENN_TO_NATIONAL(RAYQUAZA), + HOENN_TO_NATIONAL(JIRACHI), + HOENN_TO_NATIONAL(DEOXYS), + HOENN_TO_NATIONAL(BULBASAUR), // Pokémon from here onwards are UNSEEN in the HoennDex. + HOENN_TO_NATIONAL(IVYSAUR), + HOENN_TO_NATIONAL(VENUSAUR), + HOENN_TO_NATIONAL(CHARMANDER), + HOENN_TO_NATIONAL(CHARMELEON), + HOENN_TO_NATIONAL(CHARIZARD), + HOENN_TO_NATIONAL(SQUIRTLE), + HOENN_TO_NATIONAL(WARTORTLE), + HOENN_TO_NATIONAL(BLASTOISE), + HOENN_TO_NATIONAL(CATERPIE), + HOENN_TO_NATIONAL(METAPOD), + HOENN_TO_NATIONAL(BUTTERFREE), + HOENN_TO_NATIONAL(WEEDLE), + HOENN_TO_NATIONAL(KAKUNA), + HOENN_TO_NATIONAL(BEEDRILL), + HOENN_TO_NATIONAL(PIDGEY), + HOENN_TO_NATIONAL(PIDGEOTTO), + HOENN_TO_NATIONAL(PIDGEOT), + HOENN_TO_NATIONAL(RATTATA), + HOENN_TO_NATIONAL(RATICATE), + HOENN_TO_NATIONAL(SPEAROW), + HOENN_TO_NATIONAL(FEAROW), + HOENN_TO_NATIONAL(EKANS), + HOENN_TO_NATIONAL(ARBOK), + HOENN_TO_NATIONAL(NIDORAN_F), + HOENN_TO_NATIONAL(NIDORINA), + HOENN_TO_NATIONAL(NIDOQUEEN), + HOENN_TO_NATIONAL(NIDORAN_M), + HOENN_TO_NATIONAL(NIDORINO), + HOENN_TO_NATIONAL(NIDOKING), + HOENN_TO_NATIONAL(CLEFAIRY), + HOENN_TO_NATIONAL(CLEFABLE), + HOENN_TO_NATIONAL(PARAS), + HOENN_TO_NATIONAL(PARASECT), + HOENN_TO_NATIONAL(VENONAT), + HOENN_TO_NATIONAL(VENOMOTH), + HOENN_TO_NATIONAL(DIGLETT), + HOENN_TO_NATIONAL(DUGTRIO), + HOENN_TO_NATIONAL(MEOWTH), + HOENN_TO_NATIONAL(PERSIAN), + HOENN_TO_NATIONAL(MANKEY), + HOENN_TO_NATIONAL(PRIMEAPE), + HOENN_TO_NATIONAL(GROWLITHE), + HOENN_TO_NATIONAL(ARCANINE), + HOENN_TO_NATIONAL(POLIWAG), + HOENN_TO_NATIONAL(POLIWHIRL), + HOENN_TO_NATIONAL(POLIWRATH), + HOENN_TO_NATIONAL(BELLSPROUT), + HOENN_TO_NATIONAL(WEEPINBELL), + HOENN_TO_NATIONAL(VICTREEBEL), + HOENN_TO_NATIONAL(PONYTA), + HOENN_TO_NATIONAL(RAPIDASH), + HOENN_TO_NATIONAL(SLOWPOKE), + HOENN_TO_NATIONAL(SLOWBRO), + HOENN_TO_NATIONAL(FARFETCHD), + HOENN_TO_NATIONAL(SEEL), + HOENN_TO_NATIONAL(DEWGONG), + HOENN_TO_NATIONAL(SHELLDER), + HOENN_TO_NATIONAL(CLOYSTER), + HOENN_TO_NATIONAL(GASTLY), + HOENN_TO_NATIONAL(HAUNTER), + HOENN_TO_NATIONAL(GENGAR), + HOENN_TO_NATIONAL(ONIX), + HOENN_TO_NATIONAL(DROWZEE), + HOENN_TO_NATIONAL(HYPNO), + HOENN_TO_NATIONAL(KRABBY), + HOENN_TO_NATIONAL(KINGLER), + HOENN_TO_NATIONAL(EXEGGCUTE), + HOENN_TO_NATIONAL(EXEGGUTOR), + HOENN_TO_NATIONAL(CUBONE), + HOENN_TO_NATIONAL(MAROWAK), + HOENN_TO_NATIONAL(HITMONLEE), + HOENN_TO_NATIONAL(HITMONCHAN), + HOENN_TO_NATIONAL(LICKITUNG), + HOENN_TO_NATIONAL(CHANSEY), + HOENN_TO_NATIONAL(TANGELA), + HOENN_TO_NATIONAL(KANGASKHAN), + HOENN_TO_NATIONAL(MR_MIME), + HOENN_TO_NATIONAL(SCYTHER), + HOENN_TO_NATIONAL(JYNX), + HOENN_TO_NATIONAL(ELECTABUZZ), + HOENN_TO_NATIONAL(MAGMAR), + HOENN_TO_NATIONAL(TAUROS), + HOENN_TO_NATIONAL(LAPRAS), + HOENN_TO_NATIONAL(DITTO), + HOENN_TO_NATIONAL(EEVEE), + HOENN_TO_NATIONAL(VAPOREON), + HOENN_TO_NATIONAL(JOLTEON), + HOENN_TO_NATIONAL(FLAREON), + HOENN_TO_NATIONAL(PORYGON), + HOENN_TO_NATIONAL(OMANYTE), + HOENN_TO_NATIONAL(OMASTAR), + HOENN_TO_NATIONAL(KABUTO), + HOENN_TO_NATIONAL(KABUTOPS), + HOENN_TO_NATIONAL(AERODACTYL), + HOENN_TO_NATIONAL(SNORLAX), + HOENN_TO_NATIONAL(ARTICUNO), + HOENN_TO_NATIONAL(ZAPDOS), + HOENN_TO_NATIONAL(MOLTRES), + HOENN_TO_NATIONAL(DRATINI), + HOENN_TO_NATIONAL(DRAGONAIR), + HOENN_TO_NATIONAL(DRAGONITE), + HOENN_TO_NATIONAL(MEWTWO), + HOENN_TO_NATIONAL(MEW), + HOENN_TO_NATIONAL(CHIKORITA), + HOENN_TO_NATIONAL(BAYLEEF), + HOENN_TO_NATIONAL(MEGANIUM), + HOENN_TO_NATIONAL(CYNDAQUIL), + HOENN_TO_NATIONAL(QUILAVA), + HOENN_TO_NATIONAL(TYPHLOSION), + HOENN_TO_NATIONAL(TOTODILE), + HOENN_TO_NATIONAL(CROCONAW), + HOENN_TO_NATIONAL(FERALIGATR), + HOENN_TO_NATIONAL(SENTRET), + HOENN_TO_NATIONAL(FURRET), + HOENN_TO_NATIONAL(HOOTHOOT), + HOENN_TO_NATIONAL(NOCTOWL), + HOENN_TO_NATIONAL(LEDYBA), + HOENN_TO_NATIONAL(LEDIAN), + HOENN_TO_NATIONAL(SPINARAK), + HOENN_TO_NATIONAL(ARIADOS), + HOENN_TO_NATIONAL(CLEFFA), + HOENN_TO_NATIONAL(TOGEPI), + HOENN_TO_NATIONAL(TOGETIC), + HOENN_TO_NATIONAL(MAREEP), + HOENN_TO_NATIONAL(FLAAFFY), + HOENN_TO_NATIONAL(AMPHAROS), + HOENN_TO_NATIONAL(SUDOWOODO), + HOENN_TO_NATIONAL(POLITOED), + HOENN_TO_NATIONAL(HOPPIP), + HOENN_TO_NATIONAL(SKIPLOOM), + HOENN_TO_NATIONAL(JUMPLUFF), + HOENN_TO_NATIONAL(AIPOM), + HOENN_TO_NATIONAL(SUNKERN), + HOENN_TO_NATIONAL(SUNFLORA), + HOENN_TO_NATIONAL(YANMA), + HOENN_TO_NATIONAL(WOOPER), + HOENN_TO_NATIONAL(QUAGSIRE), + HOENN_TO_NATIONAL(ESPEON), + HOENN_TO_NATIONAL(UMBREON), + HOENN_TO_NATIONAL(MURKROW), + HOENN_TO_NATIONAL(SLOWKING), + HOENN_TO_NATIONAL(MISDREAVUS), + HOENN_TO_NATIONAL(UNOWN), + HOENN_TO_NATIONAL(PINECO), + HOENN_TO_NATIONAL(FORRETRESS), + HOENN_TO_NATIONAL(DUNSPARCE), + HOENN_TO_NATIONAL(GLIGAR), + HOENN_TO_NATIONAL(STEELIX), + HOENN_TO_NATIONAL(SNUBBULL), + HOENN_TO_NATIONAL(GRANBULL), + HOENN_TO_NATIONAL(QWILFISH), + HOENN_TO_NATIONAL(SCIZOR), + HOENN_TO_NATIONAL(SHUCKLE), + HOENN_TO_NATIONAL(SNEASEL), + HOENN_TO_NATIONAL(TEDDIURSA), + HOENN_TO_NATIONAL(URSARING), + HOENN_TO_NATIONAL(SWINUB), + HOENN_TO_NATIONAL(PILOSWINE), + HOENN_TO_NATIONAL(REMORAID), + HOENN_TO_NATIONAL(OCTILLERY), + HOENN_TO_NATIONAL(DELIBIRD), + HOENN_TO_NATIONAL(MANTINE), + HOENN_TO_NATIONAL(HOUNDOUR), + HOENN_TO_NATIONAL(HOUNDOOM), + HOENN_TO_NATIONAL(PORYGON2), + HOENN_TO_NATIONAL(STANTLER), + HOENN_TO_NATIONAL(SMEARGLE), + HOENN_TO_NATIONAL(TYROGUE), + HOENN_TO_NATIONAL(HITMONTOP), + HOENN_TO_NATIONAL(SMOOCHUM), + HOENN_TO_NATIONAL(ELEKID), + HOENN_TO_NATIONAL(MAGBY), + HOENN_TO_NATIONAL(MILTANK), + HOENN_TO_NATIONAL(BLISSEY), + HOENN_TO_NATIONAL(RAIKOU), + HOENN_TO_NATIONAL(ENTEI), + HOENN_TO_NATIONAL(SUICUNE), + HOENN_TO_NATIONAL(LARVITAR), + HOENN_TO_NATIONAL(PUPITAR), + HOENN_TO_NATIONAL(TYRANITAR), + HOENN_TO_NATIONAL(LUGIA), + HOENN_TO_NATIONAL(HO_OH), + HOENN_TO_NATIONAL(CELEBI), + HOENN_TO_NATIONAL(OLD_UNOWN_B), + HOENN_TO_NATIONAL(OLD_UNOWN_C), + HOENN_TO_NATIONAL(OLD_UNOWN_D), + HOENN_TO_NATIONAL(OLD_UNOWN_E), + HOENN_TO_NATIONAL(OLD_UNOWN_F), + HOENN_TO_NATIONAL(OLD_UNOWN_G), + HOENN_TO_NATIONAL(OLD_UNOWN_H), + HOENN_TO_NATIONAL(OLD_UNOWN_I), + HOENN_TO_NATIONAL(OLD_UNOWN_J), + HOENN_TO_NATIONAL(OLD_UNOWN_K), + HOENN_TO_NATIONAL(OLD_UNOWN_L), + HOENN_TO_NATIONAL(OLD_UNOWN_M), + HOENN_TO_NATIONAL(OLD_UNOWN_N), + HOENN_TO_NATIONAL(OLD_UNOWN_O), + HOENN_TO_NATIONAL(OLD_UNOWN_P), + HOENN_TO_NATIONAL(OLD_UNOWN_Q), + HOENN_TO_NATIONAL(OLD_UNOWN_R), + HOENN_TO_NATIONAL(OLD_UNOWN_S), + HOENN_TO_NATIONAL(OLD_UNOWN_T), + HOENN_TO_NATIONAL(OLD_UNOWN_U), + HOENN_TO_NATIONAL(OLD_UNOWN_V), + HOENN_TO_NATIONAL(OLD_UNOWN_W), + HOENN_TO_NATIONAL(OLD_UNOWN_X), + HOENN_TO_NATIONAL(OLD_UNOWN_Y), + HOENN_TO_NATIONAL(OLD_UNOWN_Z), +}; static const struct SpindaSpot sSpindaSpotGraphics[] = { @@ -95,7 +1346,7 @@ static const struct SpindaSpot sSpindaSpotGraphics[] = #include "data/pokemon/item_effects.h" -const s8 gNatureStatTable[][5] = +static const s8 sNatureStatTable[][5] = { // Atk Def Spd Sp.Atk Sp.Def { 0, 0, 0, 0, 0}, // Hardy @@ -134,7 +1385,7 @@ const s8 gNatureStatTable[][5] = #include "data/pokemon/evolution.h" #include "data/pokemon/level_up_learnset_pointers.h" -const s8 gPokeblockFlavorCompatibilityTable[] = +static const s8 sPokeblockFlavorCompatibilityTable[] = { // Cool, Beauty, Cute, Smart, Tough 0, 0, 0, 0, 0, // Hardy @@ -5020,7 +6271,7 @@ static u16 sub_80431B4(u16 var) species = 0; - while(species < POKEMON_SLOTS_NUMBER - 1 && gUnknown_8251CB8[species] != var) + while(species < POKEMON_SLOTS_NUMBER - 1 && sSpeciesToHoennPokedexNum[species] != var) species++; if(species == POKEMON_SLOTS_NUMBER - 1) @@ -5038,7 +6289,7 @@ u16 NationalPokedexNumToSpecies(u16 nationalNum) species = 0; - while (species < POKEMON_SLOTS_NUMBER - 1 && gUnknown_8251FEE[species] != nationalNum) + while (species < POKEMON_SLOTS_NUMBER - 1 && sSpeciesToNationalPokedexNum[species] != nationalNum) species++; if (species == POKEMON_SLOTS_NUMBER - 1) @@ -5047,8 +6298,7 @@ u16 NationalPokedexNumToSpecies(u16 nationalNum) return species + 1; } -// NationalToKantoOrder? -static u16 sub_804324C(u16 nationalNum) +static u16 NationalToHoennOrder(u16 nationalNum) { u16 hoennNum; @@ -5057,7 +6307,7 @@ static u16 sub_804324C(u16 nationalNum) hoennNum = 0; - while (hoennNum < POKEMON_SLOTS_NUMBER - 1 && gUnknown_8252324[hoennNum] != nationalNum) + while (hoennNum < POKEMON_SLOTS_NUMBER - 1 && sHoennToNationalOrder[hoennNum] != nationalNum) hoennNum++; if (hoennNum == POKEMON_SLOTS_NUMBER - 1) @@ -5071,7 +6321,7 @@ u16 SpeciesToNationalPokedexNum(u16 species) if (!species) return 0; - return gUnknown_8251FEE[species - 1]; + return sSpeciesToNationalPokedexNum[species - 1]; } // these 2 functions are probably kanto and not hoenn @@ -5081,7 +6331,7 @@ static u16 SpeciesToHoennPokedexNum(u16 species) if (!species) return 0; - return gUnknown_8251CB8[species - 1]; + return sSpeciesToHoennPokedexNum[species - 1]; } u16 HoennToNationalOrder(u16 hoennNum) @@ -5089,7 +6339,7 @@ u16 HoennToNationalOrder(u16 hoennNum) if (!hoennNum) return 0; - return gUnknown_8252324[hoennNum - 1]; + return sHoennToNationalOrder[hoennNum - 1]; } u16 SpeciesToCryId(u16 species) @@ -5263,7 +6513,7 @@ static u16 ModifyStatByNature(u8 nature, u16 n, u8 statIndex) return retVal; } - switch (gNatureStatTable[nature][statIndex - 1]) + switch (sNatureStatTable[nature][statIndex - 1]) { case 1: return (u16)(n * 110) / 100; @@ -5551,12 +6801,12 @@ u32 CanMonLearnTMHM(struct Pokemon *mon, u8 tm) else if (tm < 32) { u32 mask = 1 << tm; - return gTMHMLearnsets[species][0] & mask; + return sTMHMLearnsets[species][0] & mask; } else { u32 mask = 1 << (tm - 32); - return gTMHMLearnsets[species][1] & mask; + return sTMHMLearnsets[species][1] & mask; } } @@ -5776,13 +7026,13 @@ bool8 IsPokeSpriteNotFlipped(u16 species) static s8 GetMonFlavorRelation(struct Pokemon *mon, u8 flavor) { u8 nature = GetNature(mon); - return gPokeblockFlavorCompatibilityTable[nature * 5 + flavor]; + return sPokeblockFlavorCompatibilityTable[nature * 5 + flavor]; } s8 GetFlavorRelationByPersonality(u32 personality, u8 flavor) { u8 nature = GetNatureFromPersonality(personality); - return gPokeblockFlavorCompatibilityTable[nature * 5 + flavor]; + return sPokeblockFlavorCompatibilityTable[nature * 5 + flavor]; } bool8 IsTradedMon(struct Pokemon *mon) -- cgit v1.2.3 From f24eae3e9094f80596173aaff27f4d2cb2b5f69a Mon Sep 17 00:00:00 2001 From: jiangzhengwenjz Date: Mon, 15 Jul 2019 13:24:47 +0800 Subject: resolved several TODOs --- src/pokemon.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) (limited to 'src/pokemon.c') diff --git a/src/pokemon.c b/src/pokemon.c index 31fa5fed4..f1ab79d65 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -2386,8 +2386,7 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de spDefense = (110 * spDefense) / 100; } - // TODO: Use ARRAY_COUNT(sHoldEffectToType) - for (i = 0; i < 17; i++) + for (i = 0; i < NELEMS(sHoldEffectToType); i++) { if (attackerHoldEffect == sHoldEffectToType[i][0] && type == sHoldEffectToType[i][1]) @@ -6260,9 +6259,7 @@ u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 type, u16 evolutionItem) return targetSpecies; } -// HoennPokedexNumToSpecies, but is it really Hoenn or Kanto its checking -// TODO: Figure this out -static u16 sub_80431B4(u16 var) +static u16 HoennPokedexNumToSpecies(u16 var) { u16 species; @@ -6324,8 +6321,6 @@ u16 SpeciesToNationalPokedexNum(u16 species) return sSpeciesToNationalPokedexNum[species - 1]; } -// these 2 functions are probably kanto and not hoenn -// TODO: figure this out static u16 SpeciesToHoennPokedexNum(u16 species) { if (!species) @@ -6529,10 +6524,6 @@ static u16 ModifyStatByNature(u8 nature, u16 n, u8 statIndex) #define TRAINER_CLASS_LEADER 0x57 #define TRAINER_CLASS_CHAMPION 0x5A -// TODO: Move these too -#define FRIENDSHIP_EVENT_LEAGUE_BATTLE 0x3 -#define FRIENDSHIP_EVENT_WALKING 0x5 - void AdjustFriendship(struct Pokemon *mon, u8 event) { u16 species = GetMonData(mon, MON_DATA_SPECIES2, 0); @@ -7110,8 +7101,7 @@ void sub_8044348(void) void SetWildMonHeldItem(void) { - // TODO: Replace 0x00010000 with the right flag that isnt BATTLE_TYPE_DOME - if (!(gBattleTypeFlags & (0x00010000 | BATTLE_TYPE_LEGENDARY | BATTLE_TYPE_TRAINER))) + if (!(gBattleTypeFlags & (BATTLE_TYPE_POKEDUDE | BATTLE_TYPE_LEGENDARY | BATTLE_TYPE_TRAINER))) { u16 rnd = Random() % 100; u16 species = GetMonData(&gEnemyParty[0], MON_DATA_SPECIES, 0); -- cgit v1.2.3 From 194219e9dbe22debb96c37cf34b66af07d5a730c Mon Sep 17 00:00:00 2001 From: jiangzhengwenjz Date: Mon, 15 Jul 2019 23:27:16 +0800 Subject: fixed various problems --- src/pokemon.c | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) (limited to 'src/pokemon.c') diff --git a/src/pokemon.c b/src/pokemon.c index f1ab79d65..84ef2fb63 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -1563,8 +1563,8 @@ const struct SpriteTemplate gUnknown_825DF50[] = static const u8 sSecretBaseFacilityClasses[][5] = { - { 0x58, 0x58, 0x58, 0x58, 0x58 }, - { 0x58, 0x58, 0x58, 0x58, 0x58 }, + { FACILITY_CLASS_YOUNGSTER_2, FACILITY_CLASS_YOUNGSTER_2, FACILITY_CLASS_YOUNGSTER_2, FACILITY_CLASS_YOUNGSTER_2, FACILITY_CLASS_YOUNGSTER_2 }, + { FACILITY_CLASS_YOUNGSTER_2, FACILITY_CLASS_YOUNGSTER_2, FACILITY_CLASS_YOUNGSTER_2, FACILITY_CLASS_YOUNGSTER_2, FACILITY_CLASS_YOUNGSTER_2 }, }; static const u8 sGetMonDataEVConstants[] = @@ -2675,25 +2675,25 @@ u8 GetGenderFromSpeciesAndPersonality(u16 species, u32 personality) void SetMultiuseSpriteTemplateToPokemon(u16 speciesTag, u8 battlerPosition) { - if(gMonSpritesGfxPtr != NULL) + if (gMonSpritesGfxPtr != NULL) { - if(battlerPosition >= 4) + if (battlerPosition >= 4) battlerPosition = 0; gMultiuseSpriteTemplate = gMonSpritesGfxPtr->templates[battlerPosition]; } else { - if(sOakSpeechNidoranResources) + if (sOakSpeechNidoranResources) { - if(battlerPosition >= (s8)sOakSpeechNidoranResources->battlePosition) // why a cast?!? changing the unk0_2 type to s8 causes extra shifts, but a cast is the correct fix. why, compiler? + if (battlerPosition >= (s8)sOakSpeechNidoranResources->battlePosition) // why a cast?!? changing the unk0_2 type to s8 causes extra shifts, but a cast is the correct fix. why, compiler? battlerPosition = 0; gMultiuseSpriteTemplate = sOakSpeechNidoranResources->templates[battlerPosition]; } else { - if(battlerPosition >= 4) + if (battlerPosition >= 4) battlerPosition = 0; gMultiuseSpriteTemplate = gUnknown_825DEF0[battlerPosition]; @@ -2706,7 +2706,7 @@ void SetMultiuseSpriteTemplateToPokemon(u16 speciesTag, u8 battlerPosition) void SetMultiuseSpriteTemplateToTrainerBack(u16 trainerSpriteId, u8 battlerPosition) { gMultiuseSpriteTemplate.paletteTag = trainerSpriteId; - if(battlerPosition == B_POSITION_PLAYER_LEFT || battlerPosition == B_POSITION_PLAYER_RIGHT) + if (battlerPosition == B_POSITION_PLAYER_LEFT || battlerPosition == B_POSITION_PLAYER_RIGHT) { gMultiuseSpriteTemplate = gUnknown_825DF50[trainerSpriteId]; gMultiuseSpriteTemplate.anims = gTrainerBackAnimsPtrTable[trainerSpriteId]; @@ -4835,7 +4835,7 @@ bool8 PokemonUseItemEffects2(struct Pokemon *pkmn, u16 item, u8 partyIndex, u8 m r4 = CalculatePPWithBonus(GetMonData(pkmn, MON_DATA_MOVE1 + moveIndex, NULL), GetMonData(pkmn, MON_DATA_PP_BONUSES, NULL), moveIndex); if (data < 3) { - if(r4 <= 4) + if (r4 <= 4) break; /* @@ -5944,7 +5944,7 @@ _08042BD8:\n\ static bool8 sub_8042BE8(struct Pokemon *mon, u32 unused, u32 healMask, u8 battleId) { - if((GetMonData(mon, MON_DATA_STATUS, NULL) & healMask) != 0) + if ((GetMonData(mon, MON_DATA_STATUS, NULL) & healMask) != 0) return TRUE; else return FALSE; @@ -6263,15 +6263,15 @@ static u16 HoennPokedexNumToSpecies(u16 var) { u16 species; - if(!var) + if (!var) return 0; species = 0; - while(species < POKEMON_SLOTS_NUMBER - 1 && sSpeciesToHoennPokedexNum[species] != var) + while (species < POKEMON_SLOTS_NUMBER - 1 && sSpeciesToHoennPokedexNum[species] != var) species++; - if(species == POKEMON_SLOTS_NUMBER - 1) + if (species == POKEMON_SLOTS_NUMBER - 1) return 0; return species + 1; @@ -6345,7 +6345,7 @@ u16 SpeciesToCryId(u16 species) if (species <= SPECIES_OLD_UNOWN_Z - 1) return SPECIES_UNOWN - 1; - return sSpeciesIdToCryId[species - ((SPECIES_OLD_UNOWN_Z + 1) - 1)]; + return sHoennSpeciesIdToCryId[species - ((SPECIES_OLD_UNOWN_Z + 1) - 1)]; } static void sub_8043338(u16 species, u32 personality, u8 *dest) @@ -6764,9 +6764,9 @@ bool8 TryIncrementMonLevel(struct Pokemon *mon) u8 newLevel = level + 1; u32 exp = GetMonData(mon, MON_DATA_EXP, NULL); - if(level < 100) + if (level < 100) { - if(exp > gExperienceTables[gBaseStats[species].growthRate][newLevel]) + if (exp > gExperienceTables[gBaseStats[species].growthRate][newLevel]) { SetMonData(mon, MON_DATA_LEVEL, &newLevel); SetMonExpWithMaxLevelCheck(mon, species, newLevel, exp); @@ -6907,19 +6907,19 @@ u16 sub_8043F90(u16 species) void ClearBattleMonForms(void) { int i; - for(i = 0; i < 4; i++) + for (i = 0; i < 4; i++) gBattleMonForms[i] = 0; } static u16 GetMUS_ForBattle(void) { - if(gBattleTypeFlags & 0x1000) + if (gBattleTypeFlags & 0x1000) return 0x12A; - if(gBattleTypeFlags & 0x4000) + if (gBattleTypeFlags & 0x4000) return 0x10A; - if(gBattleTypeFlags & 0x2) + if (gBattleTypeFlags & 0x2) return 0x10A; - if(gBattleTypeFlags & 0x8) + if (gBattleTypeFlags & 0x8) { switch (gTrainers[gTrainerBattleOpponent_A].trainerClass) { @@ -7149,7 +7149,7 @@ u8 GetPlayerPartyHighestLevel(void) u8 level, monLevel; level = 1; - for(slot = 0; slot < PARTY_SIZE; ++slot) + for (slot = 0; slot < PARTY_SIZE; ++slot) { if (GetMonData(&gPlayerParty[slot], MON_DATA_SANITY_HAS_SPECIES, NULL) == 1 && !GetMonData(&gPlayerParty[slot], MON_DATA_SANITY_IS_EGG, NULL)) { -- cgit v1.2.3 From f7af77d22c84d9b8cba25145e26204a05ccf1455 Mon Sep 17 00:00:00 2001 From: jiangzhengwenjz Date: Thu, 18 Jul 2019 04:39:01 +0800 Subject: sync documentation of CountAliveMonsInBattle() --- src/pokemon.c | 41 ++++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 21 deletions(-) (limited to 'src/pokemon.c') diff --git a/src/pokemon.c b/src/pokemon.c index 84ef2fb63..755c59555 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -2475,13 +2475,13 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de if ((sideStatus & SIDE_STATUS_REFLECT) && gCritMultiplier == 1) { - if ((gBattleTypeFlags & BATTLE_TYPE_DOUBLE) && CountAliveMons(2) == 2) + if ((gBattleTypeFlags & BATTLE_TYPE_DOUBLE) && CountAliveMonsInBattle(BATTLE_ALIVE_DEF_SIDE) == 2) damage = 2 * (damage / 3); else damage /= 2; } - if ((gBattleTypeFlags & BATTLE_TYPE_DOUBLE) && gBattleMoves[move].target == 8 && CountAliveMons(2) == 2) + if ((gBattleTypeFlags & BATTLE_TYPE_DOUBLE) && gBattleMoves[move].target == 8 && CountAliveMonsInBattle(BATTLE_ALIVE_DEF_SIDE) == 2) damage /= 2; // moves always do at least 1 damage. @@ -2522,13 +2522,13 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de if ((sideStatus & SIDE_STATUS_LIGHTSCREEN) && gCritMultiplier == 1) { - if ((gBattleTypeFlags & BATTLE_TYPE_DOUBLE) && CountAliveMons(2) == 2) + if ((gBattleTypeFlags & BATTLE_TYPE_DOUBLE) && CountAliveMonsInBattle(BATTLE_ALIVE_DEF_SIDE) == 2) damage = 2 * (damage / 3); else damage /= 2; } - if ((gBattleTypeFlags & BATTLE_TYPE_DOUBLE) && gBattleMoves[move].target == 8 && CountAliveMons(2) == 2) + if ((gBattleTypeFlags & BATTLE_TYPE_DOUBLE) && gBattleMoves[move].target == 8 && CountAliveMonsInBattle(BATTLE_ALIVE_DEF_SIDE) == 2) damage /= 2; // are effects of weather negated with cloud nine or air lock @@ -2574,28 +2574,28 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de return damage + 2; } -u8 CountAliveMons(u8 a1) +u8 CountAliveMonsInBattle(u8 caseId) { s32 i; u8 retVal = 0; - switch (a1) + switch (caseId) { - case 0: + case BATTLE_ALIVE_EXCEPT_ACTIVE: for (i = 0; i < 4; i++) { if (i != gActiveBattler && !(gAbsentBattlerFlags & gBitTable[i])) retVal++; } break; - case 1: + case BATTLE_ALIVE_ATK_SIDE: for (i = 0; i < 4; i++) { if (GetBattlerSide(i) == GetBattlerSide(sBattler_AI) && !(gAbsentBattlerFlags & gBitTable[i])) retVal++; } break; - case 2: + case BATTLE_ALIVE_DEF_SIDE: for (i = 0; i < 4; i++) { if (GetBattlerSide(i) == GetBattlerSide(gBattlerTarget) && !(gAbsentBattlerFlags & gBitTable[i])) @@ -2607,29 +2607,28 @@ u8 CountAliveMons(u8 a1) return retVal; } -u8 GetDefaultMoveTarget(u8 a1) +u8 GetDefaultMoveTarget(u8 battlerId) { - u8 status = GetBattlerPosition(a1) & 1; + u8 opposing = BATTLE_OPPOSITE(GetBattlerPosition(battlerId) & BIT_SIDE); - status ^= 1; if (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE)) - return GetBattlerAtPosition(status); - if (CountAliveMons(0) > 1) + return GetBattlerAtPosition(opposing); + if (CountAliveMonsInBattle(BATTLE_ALIVE_EXCEPT_ACTIVE) > 1) { - u8 val; + u8 position; if ((Random() & 1) == 0) - val = status ^ 2; + position = BATTLE_PARTNER(opposing); else - val = status; - return GetBattlerAtPosition(val); + position = opposing; + return GetBattlerAtPosition(position); } else { - if ((gAbsentBattlerFlags & gBitTable[status])) - return GetBattlerAtPosition(status ^ 2); + if ((gAbsentBattlerFlags & gBitTable[opposing])) + return GetBattlerAtPosition(BATTLE_PARTNER(opposing)); else - return GetBattlerAtPosition(status); + return GetBattlerAtPosition(opposing); } } -- cgit v1.2.3 From 78ffd627bdfaa1abbc1638abe244dbcc363e8394 Mon Sep 17 00:00:00 2001 From: jiangzhengwenjz Date: Sat, 20 Jul 2019 13:24:59 +0800 Subject: enums for hoenn cries --- src/pokemon.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/pokemon.c') diff --git a/src/pokemon.c b/src/pokemon.c index 755c59555..b948e4033 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -32,6 +32,7 @@ #include "constants/items.h" #include "constants/item_effects.h" #include "constants/species.h" +#include "constants/hoenn_cries.h" #include "constants/pokemon.h" #include "constants/abilities.h" #include "constants/flags.h" -- cgit v1.2.3