move some pokemon data to c

This commit is contained in:
DizzyEggg
2018-02-05 17:39:26 +01:00
parent eb6aed50e5
commit ae8e89a10d
65 changed files with 32297 additions and 20897 deletions
+9 -9
View File
@@ -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
{
+3 -3
View File
@@ -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;
+3 -3
View File
@@ -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[] =
+2 -2
View File
@@ -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]);
+15 -14
View File
@@ -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);
}
}
+4 -4
View File
@@ -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;
+57 -2
View File
@@ -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]);
}
+4 -4
View File
@@ -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)
+29 -29
View File
@@ -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)