summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/battle_util.h1
-rw-r--r--include/field_specials.h2
-rw-r--r--include/party_menu.h1
-rw-r--r--include/pokemon.h29
-rw-r--r--include/pokemon_storage_system.h1
-rw-r--r--include/strings.h9
-rw-r--r--src/pokemon.c152
7 files changed, 91 insertions, 104 deletions
diff --git a/include/battle_util.h b/include/battle_util.h
index ed070720d..a062f0743 100644
--- a/include/battle_util.h
+++ b/include/battle_util.h
@@ -87,5 +87,6 @@ void HandleAction_RunBattleScript(void);
u8 GetMoveTarget(u16 move, u8 useMoveTarget);
u8 IsMonDisobedient(void);
void MarkBufferBankForExecution(u8 battlerId);
+void sub_80174B8(u8 battlerId);
#endif // GUARD_BATTLE_UTIL_H
diff --git a/include/field_specials.h b/include/field_specials.h
index 0e4fdd787..a82cb20a2 100644
--- a/include/field_specials.h
+++ b/include/field_specials.h
@@ -11,5 +11,7 @@ void sub_80CCB68(void);
void nullsub_60(void);
void nullsub_61(void);
u8 ContextNpcGetTextColor(void);
+void set_unknown_box_id(u8);
+u16 get_unknown_box_id(void);
#endif // GUARD_FIELD_SPECIALS_H
diff --git a/include/party_menu.h b/include/party_menu.h
index 3b620c3b0..e4fc182e9 100644
--- a/include/party_menu.h
+++ b/include/party_menu.h
@@ -61,5 +61,6 @@ void sub_8126894(u8 taskId, TaskFunc followUpFunc);
void sub_81279E0(void);
void ItemUseCB_Medicine(u8 taskId, TaskFunc followUpFunc);
u8 GetItemEffectType(u16 itemId);
+u8 pokemon_order_func(u8);
#endif // GUARD_PARTY_MENU_H
diff --git a/include/pokemon.h b/include/pokemon.h
index 40d63aa89..9ddb63af0 100644
--- a/include/pokemon.h
+++ b/include/pokemon.h
@@ -2,6 +2,7 @@
#define GUARD_POKEMON_H
#include "global.h"
+#include "sprite.h"
#define MON_DATA_PERSONALITY 0
#define MON_DATA_OT_ID 1
@@ -545,30 +546,21 @@ void CreateMonWithNature(struct Pokemon *mon, u16 species, u8 level, u8 fixedIV,
void CreateMonWithGenderNatureLetter(struct Pokemon *mon, u16 species, u8 level, u8 fixedIV, u8 gender, u8 nature, u8 unownLetter);
void CreateMaleMon(struct Pokemon *mon, u16 species, u8 level);
void CreateMonWithIVsPersonality(struct Pokemon *mon, u16 species, u8 level, u32 ivs, u32 personality);
-void CreateMonWithIVsOTID(struct Pokemon *mon, u16 species, u8 level, u8 *ivs, u32 otId);
void CreateMonWithEVSpread(struct Pokemon *mon, u16 species, u8 level, u8 fixedIV, u8 evSpread);
-u16 CalculateBoxMonChecksum(struct BoxPokemon *boxMon);
void CalculateMonStats(struct Pokemon *mon);
-u8 GetLevelFromMonExp(struct Pokemon *mon);
u8 GetLevelFromBoxMonExp(struct BoxPokemon *boxMon);
u16 GiveMoveToMon(struct Pokemon *mon, u16 move);
-u16 GiveMoveToBoxMon(struct BoxPokemon *boxMon, u16 move);
u16 GiveMoveToBattleMon(struct BattlePokemon *mon, u16 move);
void MonRestorePP(struct Pokemon *mon);
void SetMonMoveSlot(struct Pokemon *mon, u16 move, u8 slot);
void SetBattleMonMoveSlot(struct BattlePokemon *mon, u16 move, u8 slot);
-void GiveMonInitialMoveset(struct Pokemon *mon);
-void GiveBoxMonInitialMoveset(struct BoxPokemon *boxMon);
void DeleteFirstMoveAndGiveMoveToMon(struct Pokemon *mon, u16 move);
-void DeleteFirstMoveAndGiveMoveToBoxMon(struct BoxPokemon *boxMon, u16 move);
bool8 ExecuteTableBasedItemEffect(struct Pokemon *mon, u16 item, u8 partyIndex, u8 moveIndex);
bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 moveIndex, u8 e);
u8 GetMonGender(struct Pokemon *mon);
u8 GetBoxMonGender(struct BoxPokemon *boxMon);
u8 GetGenderFromSpeciesAndPersonality(u16 species, u32 personality);
-void EncryptBoxMon(struct BoxPokemon *boxMon);
-void DecryptBoxMon(struct BoxPokemon *boxMon);
// These are full type signatures for GetMonData() and GetBoxMonData(),
// but they are not used since some code erroneously omits the third arg.
@@ -587,28 +579,20 @@ void SetMonData(struct Pokemon *mon, s32 field, const void *data);
void SetBoxMonData(struct BoxPokemon *boxMon, s32 field, const void *data);
void CopyMon(void *dest, void *src, size_t size);
u8 GiveMonToPlayer(struct Pokemon *mon);
-u8 SendMonToPC(struct Pokemon *mon);
u8 CalculatePlayerPartyCount(void);
u8 CalculateEnemyPartyCount(void);
u8 GetAbilityBySpecies(u16 species, bool8 altAbility);
u8 GetMonAbility(struct Pokemon *mon);
-void CreateSecretBaseEnemyParty(struct SecretBaseRecord *secretBaseRecord);
u8 GetSecretBaseTrainerPicIndex(void);
u8 GetSecretBaseTrainerNameIndex(void);
bool8 IsPlayerPartyAndPokemonStorageFull(void);
-bool8 IsPokemonStorageFull(void);
void GetSpeciesName(u8 *name, u16 species);
u8 CalculatePPWithBonus(u16 move, u8 ppBonuses, u8 moveIndex);
void RemoveMonPPBonus(struct Pokemon *mon, u8 moveIndex);
void RemoveBattleMonPPBonus(struct BattlePokemon *mon, u8 moveIndex);
-void CopyPlayerPartyMonToBattleData(u8 battleIndex, u8 partyIndex);
u8 GetNature(struct Pokemon *mon);
-u8 GetNatureFromPersonality(u32 personality);
-
-u16 ModifyStatByNature(u8 nature, u16 n, u8 statIndex);
-
void MonRestorePP(struct Pokemon *);
void BoxMonRestorePP(struct BoxPokemon *);
@@ -632,21 +616,17 @@ bool8 IsOtherTrainer(u32, u8 *);
void SetWildMonHeldItem(void);
u16 GetMonEVCount(struct Pokemon *);
-const struct CompressedSpritePalette *sub_806E794(struct Pokemon *mon);
const struct CompressedSpritePalette *GetMonSpritePalStruct(struct Pokemon *mon);
const struct CompressedSpritePalette *GetMonSpritePalStructFromOtIdPersonality(u16 species, u32 otId , u32 personality);
bool32 IsHMMove2(u16 move);
bool8 IsPokeSpriteNotFlipped(u16 species);
bool8 IsMonShiny(struct Pokemon *mon);
-bool8 IsShinyOtIdPersonality(u32 otId, u32 personality);
void MonGainEVs(struct Pokemon *mon, u16 defeatedSpecies);
bool8 IsTradedMon(struct Pokemon *mon);
void HandleSetPokedexFlag(u16 nationalNum, u8 caseId, u32 personality);
s32 GetBankMultiplayerId(u16 a1);
-bool16 sub_806D82C(u8 id);
u16 MonTryLearningNewMove(struct Pokemon* mon, bool8);
-void sub_8068AA4(void); // sets stats for deoxys
bool8 HasTwoFramesAnimation(u16 species);
u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 type, u16 evolutionItem);
void RandomlyGivePartyPokerus(struct Pokemon *party);
@@ -654,21 +634,14 @@ u8 CheckPartyPokerus(struct Pokemon *party, u8 selection);
u8 CheckPartyHasHadPokerus(struct Pokemon *party, u8 selection);
void UpdatePartyPokerusTime(u16 days);
void PartySpreadPokerus(struct Pokemon *party);
-s8 GetMonFlavorRelation(struct Pokemon *mon, u8 a2);
s8 GetFlavorRelationByPersonality(u32 personality, u8 a2);
u8 GetItemEffectParamOffset(u16 itemId, u8 effectByte, u8 effectBit);
u8 GetDefaultMoveTarget(u8 atkBank);
u16 PlayerGenderToFrontTrainerPicId(u8 playerGender);
-void sub_806A1C0(u16 arg0, u8 bankIdentity);
-void sub_806A12C(u16 trainerSpriteId, u8 bankIdentity);
u8 GetSecretBaseTrainerPicIndex(void);
bool8 TryIncrementMonLevel(struct Pokemon *mon);
void BoxMonToMon(struct BoxPokemon *srcMon, struct Pokemon *dstMon);
u8 GetLevelUpMovesBySpecies(u16 species, u16 *moves);
-bool8 HealStatusConditions(struct Pokemon *mon, u32 battlePartyId, u32 healMask, u8 battlerId);
-u16 GetDeoxysStat(struct Pokemon *mon, s32 statId);
-
-#include "sprite.h"
void DoMonFrontSpriteAnimation(struct Sprite* sprite, u16 species, bool8 noCry, u8 arg3);
void BattleAnimateFrontSprite(struct Sprite* sprite, u16 species, bool8 noCry, u8 arg3);
diff --git a/include/pokemon_storage_system.h b/include/pokemon_storage_system.h
index f2fbe85a7..8ab9e5f0e 100644
--- a/include/pokemon_storage_system.h
+++ b/include/pokemon_storage_system.h
@@ -14,5 +14,6 @@ u32 GetBoxMonDataFromAnyBox(u8 boxId, u8 monPosition, u32 request);
void sub_808BCB4(u8 boxId, u8 monPosition);
u8 * GetBoxNamePtr(u8 boxId);
void sub_808CE60(void);
+u8 StorageGetCurrentBox(void);
#endif // GUARD_POKEMON_STORAGE_SYSTEM_H
diff --git a/include/strings.h b/include/strings.h
index a16792aa5..3d62928d1 100644
--- a/include/strings.h
+++ b/include/strings.h
@@ -179,4 +179,13 @@ extern const u8 gUnknown_84169DC[];
extern const u8 gUnknown_84162BD[];
extern const u8 gUnknown_841D148[];
+extern const u8 BattleText_Rose[];
+extern const u8 BattleText_UnknownString3[];
+extern const u8 BattleText_GetPumped[];
+extern const u8 BattleText_MistShroud[];
+extern const u8 gText_EggNickname[];
+extern const u8 gText_BadEgg[];
+extern const u8 gText_PkmnsXPreventsSwitching[];
+extern u8 *gUnknown_83FD5D0[];
+
#endif //GUARD_STRINGS_H
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);
}
}