summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjiangzhengwenjz <jiangzhengwenjzw@qq.com>2019-07-14 05:31:17 +0800
committerjiangzhengwenjz <jiangzhengwenjzw@qq.com>2019-07-14 05:31:17 +0800
commit1caed4e6320570e9815ef43a4f0ebd14cc52c066 (patch)
tree0461d66291d97b28b2f6e994a35d01538b5af299
parent0985206a2998d69c984c6bb4494dec442209c4ca (diff)
updated headers
-rw-r--r--include/battle.h1
-rw-r--r--include/battle_ai_script_commands.h2
-rw-r--r--include/data2.h6
-rw-r--r--include/pokemon.h117
-rw-r--r--include/pokemon_3.h12
-rw-r--r--include/strings.h1
-rw-r--r--src/oak_speech.c2
-rw-r--r--src/pokemon.c55
-rw-r--r--sym_ewram.txt8
9 files changed, 97 insertions, 107 deletions
diff --git a/include/battle.h b/include/battle.h
index 381f7cdbd..277f79c51 100644
--- a/include/battle.h
+++ b/include/battle.h
@@ -951,5 +951,6 @@ extern u16 gBattlerPartyIndexes[MAX_BATTLERS_COUNT];
extern s32 gBattleMoveDamage;
extern u8 gBattleOutcome;
+extern u8 gBattleMonForms[MAX_BATTLERS_COUNT];
#endif // GUARD_BATTLE_H
diff --git a/include/battle_ai_script_commands.h b/include/battle_ai_script_commands.h
index 5f8c4419b..3786d4a8c 100644
--- a/include/battle_ai_script_commands.h
+++ b/include/battle_ai_script_commands.h
@@ -3,6 +3,8 @@
#include "global.h"
+extern u8 sBattler_AI;
+
void BattleAI_HandleItemUseBeforeAISetup(u8 defaultScoreMoves);
void BattleAI_SetupAIData(u8 defaultScoreMoves);
u8 BattleAI_ChooseMoveOrAction(void);
diff --git a/include/data2.h b/include/data2.h
index e383b1c9a..cc4998f32 100644
--- a/include/data2.h
+++ b/include/data2.h
@@ -19,4 +19,10 @@ extern const u8 gMoveNames[][13];
extern const u8 gAbilityNames[][13];
extern const u8 gTypeNames[][7];
+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[];
+
#endif // GUARD_DATA2_H
diff --git a/include/pokemon.h b/include/pokemon.h
index 9ddb63af0..e84778fa3 100644
--- a/include/pokemon.h
+++ b/include/pokemon.h
@@ -547,20 +547,25 @@ void CreateMonWithGenderNatureLetter(struct Pokemon *mon, u16 species, u8 level,
void CreateMaleMon(struct Pokemon *mon, u16 species, u8 level);
void CreateMonWithIVsPersonality(struct Pokemon *mon, u16 species, u8 level, u32 ivs, u32 personality);
void CreateMonWithEVSpread(struct Pokemon *mon, u16 species, u8 level, u8 fixedIV, u8 evSpread);
+void CreateBattleTowerMon(struct Pokemon *mon, struct BattleTowerPokemon *src);
+void sub_803E23C(struct Pokemon *mon, struct BattleTowerPokemon *dest);
void CalculateMonStats(struct Pokemon *mon);
+void BoxMonToMon(struct BoxPokemon *src, struct Pokemon *dest);
u8 GetLevelFromBoxMonExp(struct BoxPokemon *boxMon);
u16 GiveMoveToMon(struct Pokemon *mon, 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);
+u16 MonTryLearningNewMove(struct Pokemon *mon, bool8 firstMove);
void DeleteFirstMoveAndGiveMoveToMon(struct Pokemon *mon, 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);
-
+s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *defender, u32 move, u16 sideStatus, u16 powerOverride, u8 typeOverride, u8 battlerIdAtk, u8 battlerIdDef);
+u8 CountAliveMons(u8 a1);
+u8 GetDefaultMoveTarget(u8 a1);
u8 GetMonGender(struct Pokemon *mon);
u8 GetBoxMonGender(struct BoxPokemon *boxMon);
u8 GetGenderFromSpeciesAndPersonality(u16 species, u32 personality);
+void SetMultiuseSpriteTemplateToPokemon(u16 speciesTag, u8 battlerPosition);
+void SetMultiuseSpriteTemplateToTrainerBack(u16 trainerSpriteId, u8 battlerPosition);
// These are full type signatures for GetMonData() and GetBoxMonData(),
// but they are not used since some code erroneously omits the third arg.
@@ -575,13 +580,13 @@ u32 GetMonData();
u32 GetBoxMonData();
#endif // IS_POKEMON_C
-void SetMonData(struct Pokemon *mon, s32 field, const void *data);
-void SetBoxMonData(struct BoxPokemon *boxMon, s32 field, const void *data);
+void SetMonData(struct Pokemon *mon, s32 field, const void *dataArg);
+void SetBoxMonData(struct BoxPokemon *boxMon, s32 field, const void *dataArg);
void CopyMon(void *dest, void *src, size_t size);
u8 GiveMonToPlayer(struct Pokemon *mon);
u8 CalculatePlayerPartyCount(void);
u8 CalculateEnemyPartyCount(void);
-
+u8 GetMonsStateToDoubles(void);
u8 GetAbilityBySpecies(u16 species, bool8 altAbility);
u8 GetMonAbility(struct Pokemon *mon);
u8 GetSecretBaseTrainerPicIndex(void);
@@ -591,67 +596,65 @@ 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);
-
+bool8 ExecuteTableBasedItemEffect(struct Pokemon *mon, u16 item, u8 partyIndex, u8 moveIndex);
+bool8 PokemonUseItemEffects(struct Pokemon *pkmn, u16 item, u8 partyIndex, u8 moveIndex, u8 e);
+bool8 PokemonUseItemEffects2(struct Pokemon *pkmn, u16 item, u8 partyIndex, u8 moveIndex, u8 e);
+u8 GetItemEffectParamOffset(u16 itemId, u8 effectByte, u8 effectBit);
+const u8 *Battle_PrintStatBoosterEffectMessage(u16 itemId);
u8 GetNature(struct Pokemon *mon);
-void MonRestorePP(struct Pokemon *);
-void BoxMonRestorePP(struct BoxPokemon *);
-
+u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 type, u16 evolutionItem);
u16 NationalPokedexNumToSpecies(u16 nationalNum);
-u16 NationalToHoennOrder(u16);
-u16 SpeciesToNationalPokedexNum(u16);
-u16 HoennToNationalOrder(u16);
+u16 SpeciesToNationalPokedexNum(u16 species);
+u16 HoennToNationalOrder(u16 hoennNum);
u16 SpeciesToCryId(u16 species);
-void DrawSpindaSpots(u16, u32, u8 *, u8);
-void AdjustFriendship(struct Pokemon *, u8);
-u8 CheckPartyHasHadPokerus(struct Pokemon *, u8);
-void UpdatePartyPokerusTime(u16);
-u32 CanMonLearnTMHM(struct Pokemon *, u8);
-u32 CanSpeciesLearnTMHM(u16 species, u8 tm);
+void DrawSpindaSpots(u16 species, u32 personality, u8 *dest, u8 a4);
+void EvolutionRenameMon(struct Pokemon *mon, u16 oldSpecies, u16 newSpecies);
+bool8 sub_80435E0(void);
+bool8 GetLinkTrainerFlankId(u8 linkPlayerId);
+s32 GetBankMultiplayerId(u16 a1);
+u8 GetTrainerEncounterMusicId(u16 trainer);
+void AdjustFriendship(struct Pokemon *mon, u8 event);
+void MonGainEVs(struct Pokemon *mon, u16 defeatedSpecies);
+u16 GetMonEVCount(struct Pokemon *mon);
+void sub_8043A68(void);
+u8 CheckPartyPokerus(struct Pokemon *party, u8 selection);
+u8 CheckPartyHasHadPokerus(struct Pokemon *party, u8 selection);
+void sub_8043B40(void);
+bool8 TryIncrementMonLevel(struct Pokemon *mon);
+u32 CanMonLearnTMHM(struct Pokemon *mon, u8 tm);
u8 GetMoveRelearnerMoves(struct Pokemon *mon, u16 *moves);
+u8 GetLevelUpMovesBySpecies(u16 species, u16 *moves);
+u8 GetNumberOfRelearnableMoves(struct Pokemon *mon);
+u16 sub_8043F90(u16 species);
void ClearBattleMonForms(void);
+void PlayBattleBGM(void);
+void PlayMapChosenOrBattleBGM(u16 songId);
const u32 *GetMonFrontSpritePal(struct Pokemon *mon);
-const u32 *GetFrontSpritePalFromSpeciesAndPersonality(u16, u32, u32);
-const struct CompressedSpritePalette *sub_80409C8(u16, u32, u32);
-bool8 IsOtherTrainer(u32, u8 *);
-void SetWildMonHeldItem(void);
-u16 GetMonEVCount(struct Pokemon *);
-
+const u32 *GetFrontSpritePalFromSpeciesAndPersonality(u16 species, u32 otId, u32 personality);
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);
-
-void MonGainEVs(struct Pokemon *mon, u16 defeatedSpecies);
+s8 GetFlavorRelationByPersonality(u32 personality, u8 flavor);
bool8 IsTradedMon(struct Pokemon *mon);
+bool8 IsOtherTrainer(u32 otId, u8 *otName);
+void MonRestorePP(struct Pokemon *mon);
+void BoxMonRestorePP(struct BoxPokemon *boxMon);
+void sub_8044348(void);
+void SetWildMonHeldItem(void);
+bool8 IsMonShiny(struct Pokemon *mon);
+u8 *GetTrainerPartnerName(void);
+u8 GetPlayerPartyHighestLevel(void);
+u16 FacilityClassToPicIndex(u16 facilityClass);
+bool8 sub_804455C(u8 caseId, u8 battlerId);
+void SetDeoxysStats(void);
+u16 sub_80447AC(void);
+u16 sub_80447F0(void);
+void CreateObedientEnemyMon(void);
void HandleSetPokedexFlag(u16 nationalNum, u8 caseId, u32 personality);
-s32 GetBankMultiplayerId(u16 a1);
-u16 MonTryLearningNewMove(struct Pokemon* mon, bool8);
-bool8 HasTwoFramesAnimation(u16 species);
-u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 type, u16 evolutionItem);
-void RandomlyGivePartyPokerus(struct Pokemon *party);
-u8 CheckPartyPokerus(struct Pokemon *party, u8 selection);
-u8 CheckPartyHasHadPokerus(struct Pokemon *party, u8 selection);
-void UpdatePartyPokerusTime(u16 days);
-void PartySpreadPokerus(struct Pokemon *party);
-s8 GetFlavorRelationByPersonality(u32 personality, u8 a2);
-u8 GetItemEffectParamOffset(u16 itemId, u8 effectByte, u8 effectBit);
-u8 GetDefaultMoveTarget(u8 atkBank);
-u16 PlayerGenderToFrontTrainerPicId(u8 playerGender);
-u8 GetSecretBaseTrainerPicIndex(void);
-bool8 TryIncrementMonLevel(struct Pokemon *mon);
-void BoxMonToMon(struct BoxPokemon *srcMon, struct Pokemon *dstMon);
-u8 GetLevelUpMovesBySpecies(u16 species, u16 *moves);
-
-void DoMonFrontSpriteAnimation(struct Sprite* sprite, u16 species, bool8 noCry, u8 arg3);
-void BattleAnimateFrontSprite(struct Sprite* sprite, u16 species, bool8 noCry, u8 arg3);
-void BattleAnimateBackSprite(struct Sprite* sprite, u16 species);
-
-void PlayMapChosenOrBattleBGM(u16 songId);
-u8 GetMonsStateToDoubles(void);
-void CreateBattleTowerMon(struct Pokemon *mon, struct BattleTowerPokemon *src);
-void SetMultiuseSpriteTemplateToPokemon(u16 trainerSpriteId, u8 battlerPosition);
-
-const u8 * Battle_PrintStatBoosterEffectMessage(u16 itemId);
+bool8 CheckBattleTypeGhost(struct Pokemon *mon, u8 bank);
+struct OakSpeechNidoranFStruct *OakSpeechNidoranFSetup(u8 battlePosition, bool8 enable);
+void OakSpeechNidoranFFreeResources(void);
+void *OakSpeechNidoranFGetBuffer(u8 bufferId);
#endif // GUARD_POKEMON_H
diff --git a/include/pokemon_3.h b/include/pokemon_3.h
deleted file mode 100644
index 9a32d4771..000000000
--- a/include/pokemon_3.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef GUARD_POKEMON_3_H
-#define GUARD_POKEMON_3_H
-
-#include "global.h"
-
-const u8* GetTrainerClassNameFromId(u16 trainerId);
-const u8* GetTrainerNameFromId(u16 trainerId);
-void * OakSpeechNidoranFSetup(u8, u8);
-void OakSpeechNidoranFFreeResources(void);
-void * OakSpeechNidoranFGetBuffer(u8 buffId);
-
-#endif // GUARD_POKEMON_3_H
diff --git a/include/strings.h b/include/strings.h
index 3d62928d1..0bb7223be 100644
--- a/include/strings.h
+++ b/include/strings.h
@@ -179,6 +179,7 @@ extern const u8 gUnknown_84169DC[];
extern const u8 gUnknown_84162BD[];
extern const u8 gUnknown_841D148[];
+// pokemon.c
extern const u8 BattleText_Rose[];
extern const u8 BattleText_UnknownString3[];
extern const u8 BattleText_GetPumped[];
diff --git a/src/oak_speech.c b/src/oak_speech.c
index 491ac463c..43ff133de 100644
--- a/src/oak_speech.c
+++ b/src/oak_speech.c
@@ -14,7 +14,7 @@
#include "menu.h"
#include "help_system.h"
#include "new_menu_helpers.h"
-#include "pokemon_3.h"
+#include "pokemon.h"
#include "sound.h"
#include "event_scripts.h"
#include "scanline_effect.h"
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:
diff --git a/sym_ewram.txt b/sym_ewram.txt
index cca185dd8..2b6f96a66 100644
--- a/sym_ewram.txt
+++ b/sym_ewram.txt
@@ -487,13 +487,7 @@ gUnknown_2024414: @ 2024414
gUnknown_2024478: @ 2024478
.space 0x64
-gMultiuseSpriteTemplate: @ 20244DC
- .space 0x18
-
-sOakSpeechNidoranResources: @ 20244F4
- .space 0x4
-
- .align 2
+ .include "src/pokemon.o"
.include "src/daycare.o"
.align 2
.include "src/load_save.o"