diff options
author | DizzyEggg <jajkodizzy@wp.pl> | 2018-02-05 17:39:26 +0100 |
---|---|---|
committer | DizzyEggg <jajkodizzy@wp.pl> | 2018-02-05 17:39:26 +0100 |
commit | ae8e89a10ddfb736afc23a2477c20b6897b0313d (patch) | |
tree | 03ead636462c868b93cad1046867ac338f9788b0 /src | |
parent | eb6aed50e56f36ce416f7ecc8edfacea1da61bf1 (diff) |
move some pokemon data to c
Diffstat (limited to 'src')
-rw-r--r-- | src/battle_controller_link_opponent.c | 18 | ||||
-rw-r--r-- | src/battle_dome_cards.c | 6 | ||||
-rw-r--r-- | src/battle_script_commands.c | 6 | ||||
-rw-r--r-- | src/daycare.c | 4 | ||||
-rw-r--r-- | src/evolution_scene.c | 29 | ||||
-rwxr-xr-x | src/item_use.c | 8 | ||||
-rw-r--r-- | src/pokemon_1.c | 59 | ||||
-rw-r--r-- | src/pokemon_2.c | 8 | ||||
-rw-r--r-- | src/pokemon_3.c | 58 |
9 files changed, 126 insertions, 70 deletions
diff --git a/src/battle_controller_link_opponent.c b/src/battle_controller_link_opponent.c index cb510bb5b..d4cdb7968 100644 --- a/src/battle_controller_link_opponent.c +++ b/src/battle_controller_link_opponent.c @@ -58,7 +58,7 @@ extern u16 gTrainerBattleOpponent_B; extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[]; extern const struct BattleMove gBattleMoves[]; -extern const u8 gUnknown_0831F578[]; +extern const u8 gFacilityClassToPicIndex[]; extern void sub_8172EF0(u8 bank, struct Pokemon *mon); extern void sub_806A068(u16, u8); @@ -1280,17 +1280,17 @@ static void LinkOpponentHandleDrawTrainerPic(void) || (gLinkPlayers[GetBankMultiplayerId(gActiveBank)].version & 0xFF) == VERSION_LEAF_GREEN) { if (gLinkPlayers[GetBankMultiplayerId(gActiveBank)].gender != 0) - trainerPicId = gUnknown_0831F578[0x4F]; + trainerPicId = gFacilityClassToPicIndex[0x4F]; else - trainerPicId = gUnknown_0831F578[0x4E]; + trainerPicId = gFacilityClassToPicIndex[0x4E]; } else if ((gLinkPlayers[GetBankMultiplayerId(gActiveBank)].version & 0xFF) == VERSION_RUBY || (gLinkPlayers[GetBankMultiplayerId(gActiveBank)].version & 0xFF) == VERSION_SAPPHIRE) { if (gLinkPlayers[GetBankMultiplayerId(gActiveBank)].gender != 0) - trainerPicId = gUnknown_0831F578[0x51]; + trainerPicId = gFacilityClassToPicIndex[0x51]; else - trainerPicId = gUnknown_0831F578[0x50]; + trainerPicId = gFacilityClassToPicIndex[0x50]; } else { @@ -1309,17 +1309,17 @@ static void LinkOpponentHandleDrawTrainerPic(void) || (gLinkPlayers[GetMultiplayerId() ^ BIT_SIDE].version & 0xFF) == VERSION_LEAF_GREEN) { if (gLinkPlayers[GetMultiplayerId() ^ BIT_SIDE].gender != 0) - trainerPicId = gUnknown_0831F578[0x4F]; + trainerPicId = gFacilityClassToPicIndex[0x4F]; else - trainerPicId = gUnknown_0831F578[0x4E]; + trainerPicId = gFacilityClassToPicIndex[0x4E]; } else if ((gLinkPlayers[GetMultiplayerId() ^ BIT_SIDE].version & 0xFF) == VERSION_RUBY || (gLinkPlayers[GetMultiplayerId() ^ BIT_SIDE].version & 0xFF) == VERSION_SAPPHIRE) { if (gLinkPlayers[GetMultiplayerId() ^ BIT_SIDE].gender != 0) - trainerPicId = gUnknown_0831F578[0x51]; + trainerPicId = gFacilityClassToPicIndex[0x51]; else - trainerPicId = gUnknown_0831F578[0x50]; + trainerPicId = gFacilityClassToPicIndex[0x50]; } else { diff --git a/src/battle_dome_cards.c b/src/battle_dome_cards.c index d549856f2..076a4d342 100644 --- a/src/battle_dome_cards.c +++ b/src/battle_dome_cards.c @@ -19,7 +19,7 @@ extern const union AffineAnimCmd *const gUnknown_082FF694[]; extern const union AnimCmd *const gUnknown_082FF70C[]; extern const union AnimCmd *const *const gMonAnimationsSpriteAnimsPtrTable[NUM_SPECIES]; extern const union AnimCmd *const *const gUnknown_0830536C[]; -extern const u8 gUnknown_0831F578[]; +extern const u8 gFacilityClassToPicIndex[]; // Static type declarations @@ -421,9 +421,9 @@ u8 sub_818D97C(u8 a0, u8 a1) switch (a0) { default: - return gUnknown_0831F578[0x3F]; + return gFacilityClassToPicIndex[0x3F]; case 0: - return gUnknown_0831F578[0x3C]; + return gFacilityClassToPicIndex[0x3C]; } } return a0; diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index c7976fc2a..b4cdcc61b 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -956,11 +956,11 @@ static const u16 sRarePickupItems[] = ITEM_FULL_RESTORE, ITEM_ETHER, ITEM_WHITE_HERB, - ITEM_TM44, + ITEM_TM44_REST, ITEM_ELIXIR, - ITEM_TM01, + ITEM_TM01_FOCUS_PUNCH, ITEM_LEFTOVERS, - ITEM_TM26, + ITEM_TM26_EARTHQUAKE, }; static const u8 sPickupProbabilities[] = diff --git a/src/daycare.c b/src/daycare.c index 59ee562bd..346241a42 100644 --- a/src/daycare.c +++ b/src/daycare.c @@ -413,7 +413,7 @@ static u16 GetEggSpecies(u16 species) { for (k = 0; k < EVOS_PER_MON; k++) { - if (gEvolutionTable[j].evolutions[k].targetSpecies == species) + if (gEvolutionTable[j][k].targetSpecies == species) { species = j; found = TRUE; @@ -694,7 +694,7 @@ static void BuildEggMoveset(struct Pokemon *egg, struct BoxPokemon *father, stru { for (j = 0; j < NUM_TECHNICAL_MACHINES + NUM_HIDDEN_MACHINES; j++) { - if (sHatchedEggFatherMoves[i] == ItemIdToBattleMoveId(ITEM_TM01 + j) && CanMonLearnTMHM(egg, j)) + if (sHatchedEggFatherMoves[i] == ItemIdToBattleMoveId(ITEM_TM01_FOCUS_PUNCH + j) && CanMonLearnTMHM(egg, j)) { if (GiveMoveToMon(egg, sHatchedEggFatherMoves[i]) == 0xffff) DeleteFirstMoveAndGiveMoveToMon(egg, sHatchedEggFatherMoves[i]); diff --git a/src/evolution_scene.c b/src/evolution_scene.c index cbd37be52..ec99fb030 100644 --- a/src/evolution_scene.c +++ b/src/evolution_scene.c @@ -113,7 +113,7 @@ static const u16 sUnknown_085B5884[] = INCBIN_U16("graphics/evolution_scene/tran static const u8 Text_ShedinjaJapaneseName[] = _("ヌケニン"); -static const u8 sUnknown_085B58C9[][4] = +static const u8 sUnknown_085B58C9[][4] = { { 0x00, 0x0C, 0x01, 0x06 }, { 0x0D, 0x24, 0x05, 0x02 }, @@ -575,16 +575,16 @@ static void CB2_TradeEvolutionSceneUpdate(void) static void CreateShedinja(u16 preEvoSpecies, struct Pokemon* mon) { u32 data = 0; - if (gEvolutionTable[preEvoSpecies].evolutions[0].method == EVO_LEVEL_NINJASK && gPlayerPartyCount < 6) + if (gEvolutionTable[preEvoSpecies][0].method == EVO_LEVEL_NINJASK && gPlayerPartyCount < 6) { s32 i; - struct Pokemon* Shedinja = &gPlayerParty[gPlayerPartyCount]; - const struct EvolutionData* evoTable; - const struct EvolutionData* evos; + struct Pokemon* shedinja = &gPlayerParty[gPlayerPartyCount]; + const struct Evolution *evos; + const struct Evolution *evos2; CopyMon(&gPlayerParty[gPlayerPartyCount], mon, sizeof(struct Pokemon)); - SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_SPECIES, (&gEvolutionTable[preEvoSpecies].evolutions[1].targetSpecies)); - SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_NICKNAME, (gSpeciesNames[gEvolutionTable[preEvoSpecies].evolutions[1].targetSpecies])); + SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_SPECIES, (&gEvolutionTable[preEvoSpecies][1].targetSpecies)); + SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_NICKNAME, (gSpeciesNames[gEvolutionTable[preEvoSpecies][1].targetSpecies])); SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_HELD_ITEM, (&data)); SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_MARKINGS, (&data)); SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_10, (&data)); @@ -602,15 +602,16 @@ static void CreateShedinja(u16 preEvoSpecies, struct Pokemon* mon) CalculatePlayerPartyCount(); // can't match it otherwise, ehh - evoTable = gEvolutionTable; - evos = evoTable + preEvoSpecies; - GetSetPokedexFlag(SpeciesToNationalPokedexNum(evos->evolutions[1].targetSpecies), FLAG_SET_SEEN); - GetSetPokedexFlag(SpeciesToNationalPokedexNum(evos->evolutions[1].targetSpecies), FLAG_SET_CAUGHT); + evos2 = gEvolutionTable[0]; + evos = evos2 + EVOS_PER_MON * preEvoSpecies; - if (GetMonData(Shedinja, MON_DATA_SPECIES) == SPECIES_SHEDINJA - && GetMonData(Shedinja, MON_DATA_LANGUAGE) == LANGUAGE_JAPANESE + GetSetPokedexFlag(SpeciesToNationalPokedexNum(evos[1].targetSpecies), FLAG_SET_SEEN); + GetSetPokedexFlag(SpeciesToNationalPokedexNum(evos[1].targetSpecies), FLAG_SET_CAUGHT); + + if (GetMonData(shedinja, MON_DATA_SPECIES) == SPECIES_SHEDINJA + && GetMonData(shedinja, MON_DATA_LANGUAGE) == LANGUAGE_JAPANESE && GetMonData(mon, MON_DATA_SPECIES) == SPECIES_NINJASK) - SetMonData(Shedinja, MON_DATA_NICKNAME, Text_ShedinjaJapaneseName); + SetMonData(shedinja, MON_DATA_NICKNAME, Text_ShedinjaJapaneseName); } } diff --git a/src/item_use.c b/src/item_use.c index 8fe705a50..81a9fadf4 100755 --- a/src/item_use.c +++ b/src/item_use.c @@ -379,12 +379,12 @@ bool8 ItemfinderCheckForHiddenItems(struct MapEvents *events, u8 taskId) newDistanceX = distanceX - x; distanceY = (u16)events->bgEvents[i].y + 7; newDistanceY = distanceY - y; - + if ((u16)(newDistanceX + 7) < 15 && (newDistanceY >= -5) && (newDistanceY < 6)) sub_80FD8E0(taskId, newDistanceX, newDistanceY); } } - + sub_80FD7C8(taskId); if (gTasks[taskId].data[2] == TRUE) return TRUE; @@ -929,7 +929,7 @@ void ItemUseOutOfBattle_RareCandy(u8 taskId) void ItemUseOutOfBattle_TMHM(u8 taskId) { - if (gSpecialVar_ItemId >= ITEM_HM01) + if (gSpecialVar_ItemId >= ITEM_HM01_CUT) DisplayItemMessage(taskId, 1, gText_BootedUpHM, sub_80FDF90); // HM else DisplayItemMessage(taskId, 1, gText_BootedUpTM, sub_80FDF90); // TM @@ -992,7 +992,7 @@ void ItemUseOutOfBattle_Repel(u8 taskId) void sub_80FE124(u8 taskId) { s16* data = gTasks[taskId].data; - + if (++data[8] > 7) { data[8] = 0; diff --git a/src/pokemon_1.c b/src/pokemon_1.c index 98a35454f..26d66162f 100644 --- a/src/pokemon_1.c +++ b/src/pokemon_1.c @@ -2,7 +2,11 @@ #include "pokemon.h" #include "random.h" #include "main.h" +#include "constants/species.h" +#include "constants/abilities.h" #include "constants/items.h" +#include "constants/trainers.h" +#include "constants/moves.h" #include "string_util.h" #include "text.h" @@ -14,6 +18,57 @@ extern u8 sav1_map_get_name(void); +// const rom data +const struct SpindaSpot gSpindaSpotGraphics[] = +{ + {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" +#include "data/pokemon/experience_tables.h" +#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" + +// code void ZeroBoxMonData(struct BoxPokemon *boxMon) { u8 *raw = (u8 *)boxMon; @@ -43,14 +98,14 @@ void ZeroMonData(struct Pokemon *mon) void ZeroPlayerPartyMons(void) { s32 i; - for (i = 0; i < 6; i++) + for (i = 0; i < PARTY_SIZE; i++) ZeroMonData(&gPlayerParty[i]); } void ZeroEnemyPartyMons(void) { s32 i; - for (i = 0; i < 6; i++) + for (i = 0; i < PARTY_SIZE; i++) ZeroMonData(&gEnemyParty[i]); } diff --git a/src/pokemon_2.c b/src/pokemon_2.c index db176e025..67d82fa82 100644 --- a/src/pokemon_2.c +++ b/src/pokemon_2.c @@ -1222,20 +1222,20 @@ void CreateSecretBaseEnemyParty(struct SecretBaseRecord *secretBaseRecord) } } -extern const u8 gUnknown_0831F578[]; -extern const u8 gTrainerClassToNameIndex[]; +extern const u8 gFacilityClassToPicIndex[]; +extern const u8 gFacilityClassToTrainerClass[]; extern const u8 gSecretBaseTrainerClasses[][5]; u8 GetSecretBaseTrainerPicIndex(void) { u8 trainerClass = gSecretBaseTrainerClasses[gBattleResources->secretBase->gender][gBattleResources->secretBase->trainerId[0] % 5]; - return gUnknown_0831F578[trainerClass]; + return gFacilityClassToPicIndex[trainerClass]; } u8 GetSecretBaseTrainerNameIndex(void) { u8 trainerClass = gSecretBaseTrainerClasses[gBattleResources->secretBase->gender][gBattleResources->secretBase->trainerId[0] % 5]; - return gTrainerClassToNameIndex[trainerClass]; + return gFacilityClassToTrainerClass[trainerClass]; } bool8 IsPlayerPartyAndPokemonStorageFull(void) diff --git a/src/pokemon_3.c b/src/pokemon_3.c index 7ffb2f36a..1816c4a15 100644 --- a/src/pokemon_3.c +++ b/src/pokemon_3.c @@ -301,56 +301,56 @@ u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 type, u16 evolutionItem) for (i = 0; i < 5; i++) { - switch (gEvolutionTable[species].evolutions[i].method) + switch (gEvolutionTable[species][i].method) { case EVO_FRIENDSHIP: if (friendship >= 220) - targetSpecies = gEvolutionTable[species].evolutions[i].targetSpecies; + targetSpecies = gEvolutionTable[species][i].targetSpecies; break; case EVO_FRIENDSHIP_DAY: RtcCalcLocalTime(); if (gLocalTime.hours >= 12 && gLocalTime.hours < 24 && friendship >= 220) - targetSpecies = gEvolutionTable[species].evolutions[i].targetSpecies; + targetSpecies = gEvolutionTable[species][i].targetSpecies; break; case EVO_FRIENDSHIP_NIGHT: RtcCalcLocalTime(); if (gLocalTime.hours >= 0 && gLocalTime.hours < 12 && friendship >= 220) - targetSpecies = gEvolutionTable[species].evolutions[i].targetSpecies; + targetSpecies = gEvolutionTable[species][i].targetSpecies; break; case EVO_LEVEL: - if (gEvolutionTable[species].evolutions[i].param <= level) - targetSpecies = gEvolutionTable[species].evolutions[i].targetSpecies; + if (gEvolutionTable[species][i].param <= level) + targetSpecies = gEvolutionTable[species][i].targetSpecies; break; case EVO_LEVEL_ATK_GT_DEF: - if (gEvolutionTable[species].evolutions[i].param <= level) + if (gEvolutionTable[species][i].param <= level) if (GetMonData(mon, MON_DATA_ATK, 0) > GetMonData(mon, MON_DATA_DEF, 0)) - targetSpecies = gEvolutionTable[species].evolutions[i].targetSpecies; + targetSpecies = gEvolutionTable[species][i].targetSpecies; break; case EVO_LEVEL_ATK_EQ_DEF: - if (gEvolutionTable[species].evolutions[i].param <= level) + if (gEvolutionTable[species][i].param <= level) if (GetMonData(mon, MON_DATA_ATK, 0) == GetMonData(mon, MON_DATA_DEF, 0)) - targetSpecies = gEvolutionTable[species].evolutions[i].targetSpecies; + targetSpecies = gEvolutionTable[species][i].targetSpecies; break; case EVO_LEVEL_ATK_LT_DEF: - if (gEvolutionTable[species].evolutions[i].param <= level) + if (gEvolutionTable[species][i].param <= level) if (GetMonData(mon, MON_DATA_ATK, 0) < GetMonData(mon, MON_DATA_DEF, 0)) - targetSpecies = gEvolutionTable[species].evolutions[i].targetSpecies; + targetSpecies = gEvolutionTable[species][i].targetSpecies; break; case EVO_LEVEL_SILCOON: - if (gEvolutionTable[species].evolutions[i].param <= level && (upperPersonality % 10) <= 4) - targetSpecies = gEvolutionTable[species].evolutions[i].targetSpecies; + if (gEvolutionTable[species][i].param <= level && (upperPersonality % 10) <= 4) + targetSpecies = gEvolutionTable[species][i].targetSpecies; break; case EVO_LEVEL_CASCOON: - if (gEvolutionTable[species].evolutions[i].param <= level && (upperPersonality % 10) > 4) - targetSpecies = gEvolutionTable[species].evolutions[i].targetSpecies; + if (gEvolutionTable[species][i].param <= level && (upperPersonality % 10) > 4) + targetSpecies = gEvolutionTable[species][i].targetSpecies; break; case EVO_LEVEL_NINJASK: - if (gEvolutionTable[species].evolutions[i].param <= level) - targetSpecies = gEvolutionTable[species].evolutions[i].targetSpecies; + if (gEvolutionTable[species][i].param <= level) + targetSpecies = gEvolutionTable[species][i].targetSpecies; break; case EVO_BEAUTY: - if (gEvolutionTable[species].evolutions[i].param <= beauty) - targetSpecies = gEvolutionTable[species].evolutions[i].targetSpecies; + if (gEvolutionTable[species][i].param <= beauty) + targetSpecies = gEvolutionTable[species][i].targetSpecies; break; } } @@ -358,17 +358,17 @@ u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 type, u16 evolutionItem) case 1: for (i = 0; i < 5; i++) { - switch (gEvolutionTable[species].evolutions[i].method) + switch (gEvolutionTable[species][i].method) { case EVO_TRADE: - targetSpecies = gEvolutionTable[species].evolutions[i].targetSpecies; + targetSpecies = gEvolutionTable[species][i].targetSpecies; break; case EVO_TRADE_ITEM: - if (gEvolutionTable[species].evolutions[i].param == heldItem) + if (gEvolutionTable[species][i].param == heldItem) { heldItem = 0; SetMonData(mon, MON_DATA_HELD_ITEM, (u8 *)&heldItem); - targetSpecies = gEvolutionTable[species].evolutions[i].targetSpecies; + targetSpecies = gEvolutionTable[species][i].targetSpecies; } break; } @@ -378,10 +378,10 @@ u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 type, u16 evolutionItem) case 3: for (i = 0; i < 5; i++) { - if (gEvolutionTable[species].evolutions[i].method == EVO_ITEM - && gEvolutionTable[species].evolutions[i].param == evolutionItem) + if (gEvolutionTable[species][i].method == EVO_ITEM + && gEvolutionTable[species][i].param == evolutionItem) { - targetSpecies = gEvolutionTable[species].evolutions[i].targetSpecies; + targetSpecies = gEvolutionTable[species][i].targetSpecies; break; } } @@ -1652,11 +1652,11 @@ u8 sub_806EF84(u8 arg0, u8 arg1) return i; } -extern const u8 gUnknown_0831F578[]; +extern const u8 gFacilityClassToPicIndex[]; u16 sub_806EFF0(u16 arg0) { - return gUnknown_0831F578[arg0]; + return gFacilityClassToPicIndex[arg0]; } u16 PlayerGenderToFrontTrainerPicId(u8 playerGender) |