From 769ddf22c266c2bf41d3353c5972bca8fa49c085 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Thu, 24 Dec 2020 16:18:47 -0500 Subject: Label remaining subs in battle_tower.c --- include/pokemon.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include/pokemon.h') diff --git a/include/pokemon.h b/include/pokemon.h index a956b9c40..497e8070b 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -275,7 +275,7 @@ void CreateBattleTowerMon(struct Pokemon *mon, struct BattleTowerPokemon *src); void CreateBattleTowerMon2(struct Pokemon *mon, struct BattleTowerPokemon *src, bool8 lvl50); void CreateApprenticeMon(struct Pokemon *mon, const struct Apprentice *src, u8 monId); void CreateMonWithEVSpreadNatureOTID(struct Pokemon *mon, u16 species, u8 level, u8 nature, u8 fixedIV, u8 evSpread, u32 otId); -void sub_80686FC(struct Pokemon *mon, struct BattleTowerPokemon *dest); +void ConvertPokemonToBattleTowerPokemon(struct Pokemon *mon, struct BattleTowerPokemon *dest); void CreateObedientMon(struct Pokemon *mon, u16 species, u8 level, u8 fixedIV, u8 hasFixedPersonality, u32 fixedPersonality, u8 otIdType, u32 fixedOtId); bool8 sub_80688F8(u8 caseId, u8 battlerId); void SetDeoxysStats(void); @@ -381,7 +381,7 @@ void ClearBattleMonForms(void); u16 GetBattleBGM(void); void PlayBattleBGM(void); void PlayMapChosenOrBattleBGM(u16 songId); -void sub_806E694(u16 songId); +void CreateTask_PlayMapChosenOrBattleBGM(u16 songId); const u32 *GetMonFrontSpritePal(struct Pokemon *mon); const u32 *GetMonSpritePalFromSpeciesAndPersonality(u16 species, u32 otId, u32 personality); const struct CompressedSpritePalette *GetMonSpritePalStruct(struct Pokemon *mon); -- cgit v1.2.3 From 2da0c3436eede0ac9e2d407bbc9fde2377926a04 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Fri, 15 Jan 2021 00:14:46 -0500 Subject: Make filler in PokemonSubstruct0 explicit --- include/pokemon.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/pokemon.h') diff --git a/include/pokemon.h b/include/pokemon.h index 497e8070b..addf580e9 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -11,6 +11,7 @@ struct PokemonSubstruct0 u32 experience; u8 ppBonuses; u8 friendship; + u16 filler; }; struct PokemonSubstruct1 -- cgit v1.2.3 From bc20fda6041244d83775f6e3084f74ebe81a5fda Mon Sep 17 00:00:00 2001 From: GriffinR Date: Tue, 19 Jan 2021 04:03:16 -0500 Subject: Use GET_UNOWN_LETTER macro --- include/pokemon.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'include/pokemon.h') diff --git a/include/pokemon.h b/include/pokemon.h index addf580e9..0320da1f2 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -238,6 +238,15 @@ struct Evolution u16 targetSpecies; }; +#define NUM_UNOWN_FORMS 28 + +#define GET_UNOWN_LETTER(personality) (( \ + ((personality & 0x03000000) >> 18) \ + | ((personality & 0x00030000) >> 12) \ + | ((personality & 0x00000300) >> 6) \ + | ((personality & 0x00000003) >> 0) \ +) % NUM_UNOWN_FORMS) + extern u8 gPlayerPartyCount; extern struct Pokemon gPlayerParty[PARTY_SIZE]; extern u8 gEnemyPartyCount; -- cgit v1.2.3 From 305ebdbc4a41960faa4fdde2422b443036f1edad Mon Sep 17 00:00:00 2001 From: GriffinR Date: Tue, 19 Jan 2021 12:36:36 -0500 Subject: Parentheses for GET_UNOWN_LETTER --- include/pokemon.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'include/pokemon.h') diff --git a/include/pokemon.h b/include/pokemon.h index 0320da1f2..0ff635a3f 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -240,11 +240,11 @@ struct Evolution #define NUM_UNOWN_FORMS 28 -#define GET_UNOWN_LETTER(personality) (( \ - ((personality & 0x03000000) >> 18) \ - | ((personality & 0x00030000) >> 12) \ - | ((personality & 0x00000300) >> 6) \ - | ((personality & 0x00000003) >> 0) \ +#define GET_UNOWN_LETTER(personality) (( \ + (((personality) & 0x03000000) >> 18) \ + | (((personality) & 0x00030000) >> 12) \ + | (((personality) & 0x00000300) >> 6) \ + | (((personality) & 0x00000003) >> 0) \ ) % NUM_UNOWN_FORMS) extern u8 gPlayerPartyCount; -- cgit v1.2.3 From a392cca92811c27524f1d10cd69d2fc96ea69b74 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Fri, 22 Jan 2021 23:22:37 -0500 Subject: Misc battle documentation --- include/pokemon.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include/pokemon.h') diff --git a/include/pokemon.h b/include/pokemon.h index 0ff635a3f..654af3031 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -266,7 +266,7 @@ extern const u8 gPPUpSetMask[]; extern const u8 gPPUpAddMask[]; extern const u8 gStatStageRatios[MAX_STAT_STAGE + 1][2]; extern const u16 gLinkPlayerFacilityClasses[]; -extern const struct SpriteTemplate gUnknown_08329D98[]; +extern const struct SpriteTemplate gBattlerSpriteTemplates[]; extern const s8 gNatureStatTable[][5]; void ZeroBoxMonData(struct BoxPokemon *boxMon); @@ -287,7 +287,7 @@ void CreateApprenticeMon(struct Pokemon *mon, const struct Apprentice *src, u8 m void CreateMonWithEVSpreadNatureOTID(struct Pokemon *mon, u16 species, u8 level, u8 nature, u8 fixedIV, u8 evSpread, u32 otId); void ConvertPokemonToBattleTowerPokemon(struct Pokemon *mon, struct BattleTowerPokemon *dest); void CreateObedientMon(struct Pokemon *mon, u16 species, u8 level, u8 fixedIV, u8 hasFixedPersonality, u32 fixedPersonality, u8 otIdType, u32 fixedOtId); -bool8 sub_80688F8(u8 caseId, u8 battlerId); +bool8 ShouldIgnoreDeoxysForm(u8 caseId, u8 battlerId); void SetDeoxysStats(void); u16 GetUnionRoomTrainerPic(void); u16 GetUnionRoomTrainerClass(void); -- cgit v1.2.3 From b89c3e901e1de2f3513d74fa548373d82d3f26d0 Mon Sep 17 00:00:00 2001 From: Deokishisu <6993375+Deokishisu@users.noreply.github.com> Date: Mon, 15 Feb 2021 11:40:16 -0500 Subject: Fix giftRibbons Field in SaveBlock1 & Relabel Gift Ribbons in pokemon.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The giftRibbons field has been split out into proper subfields. The new ExternalEvent structs deal with interconnectivity between external games/peripherals and Emerald, such as PokéCoupon storage and the flag for receiving Wishmaker Jirachi. The giftRibbon fields in `PokemonSubstruct3` have also been renamed to their appropriate ribbons, and commented with distribution info if applicable. The previous `fatefulEncounter` field was actually filler, and relabeled as such, while the obedient bit was renamed `fatefulEncounter`. All relevant constants and functions dealing with the Pokémon data structure were renamed with these changes in mind. --- include/pokemon.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'include/pokemon.h') diff --git a/include/pokemon.h b/include/pokemon.h index 654af3031..bec660532 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -65,15 +65,15 @@ struct PokemonSubstruct3 /* 0x0A */ u32 victoryRibbon:1; /* 0x0A */ u32 artistRibbon:1; /* 0x0A */ u32 effortRibbon:1; - /* 0x0A */ u32 giftRibbon1:1; - /* 0x0A */ u32 giftRibbon2:1; - /* 0x0A */ u32 giftRibbon3:1; - /* 0x0A */ u32 giftRibbon4:1; - /* 0x0B */ u32 giftRibbon5:1; - /* 0x0B */ u32 giftRibbon6:1; - /* 0x0B */ u32 giftRibbon7:1; - /* 0x0B */ u32 fatefulEncounter:4; - /* 0x0B */ u32 obedient:1; + /* 0x0A */ u32 marineRibbon:1; //never distributed + /* 0x0A */ u32 landRibbon:1; //never distributed + /* 0x0A */ u32 skyRibbon:1; //never distributed + /* 0x0A */ u32 countryRibbon:1; //distributed during Pokémon Festa '04 and '05 to tournament winners + /* 0x0B */ u32 nationalRibbon:1; + /* 0x0B */ u32 earthRibbon:1; + /* 0x0B */ u32 worldRibbon:1; //distributed during Pokémon Festa '04 and '05 to tournament winners + /* 0x0B */ u32 filler:4; + /* 0x0B */ u32 fatefulEncounter:1; //controls Mew and Deoxys obedience }; union PokemonSubstruct @@ -286,12 +286,12 @@ void CreateBattleTowerMon2(struct Pokemon *mon, struct BattleTowerPokemon *src, void CreateApprenticeMon(struct Pokemon *mon, const struct Apprentice *src, u8 monId); void CreateMonWithEVSpreadNatureOTID(struct Pokemon *mon, u16 species, u8 level, u8 nature, u8 fixedIV, u8 evSpread, u32 otId); void ConvertPokemonToBattleTowerPokemon(struct Pokemon *mon, struct BattleTowerPokemon *dest); -void CreateObedientMon(struct Pokemon *mon, u16 species, u8 level, u8 fixedIV, u8 hasFixedPersonality, u32 fixedPersonality, u8 otIdType, u32 fixedOtId); +void CreateFatefulEncounterMon(struct Pokemon *mon, u16 species, u8 level, u8 fixedIV, u8 hasFixedPersonality, u32 fixedPersonality, u8 otIdType, u32 fixedOtId); bool8 ShouldIgnoreDeoxysForm(u8 caseId, u8 battlerId); void SetDeoxysStats(void); u16 GetUnionRoomTrainerPic(void); u16 GetUnionRoomTrainerClass(void); -void CreateObedientEnemyMon(void); +void CreateFatefulEncounterEnemyMon(void); void CalculateMonStats(struct Pokemon *mon); void BoxMonToMon(const struct BoxPokemon *src, struct Pokemon *dest); u8 GetLevelFromMonExp(struct Pokemon *mon); -- cgit v1.2.3 From 7b2bf8c7e2249f66a04eabdbaeb2a8018855955f Mon Sep 17 00:00:00 2001 From: Deokishisu <6993375+Deokishisu@users.noreply.github.com> Date: Mon, 15 Feb 2021 14:54:35 -0500 Subject: Rename obedient/fatefulEncounter to eventLegal Per discussion on pret, `obedient`/`fatefulEncounter` has been renamed to `eventLegal`, and all related functions and constants have been modified with this in mind. Additionally, fixed some whitespace alignment issues in `script_cmd_table.h`, `pokemon.h`, and `tv.c` from the last commit. --- include/pokemon.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'include/pokemon.h') diff --git a/include/pokemon.h b/include/pokemon.h index bec660532..7d6e960d7 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -65,15 +65,15 @@ struct PokemonSubstruct3 /* 0x0A */ u32 victoryRibbon:1; /* 0x0A */ u32 artistRibbon:1; /* 0x0A */ u32 effortRibbon:1; - /* 0x0A */ u32 marineRibbon:1; //never distributed - /* 0x0A */ u32 landRibbon:1; //never distributed - /* 0x0A */ u32 skyRibbon:1; //never distributed - /* 0x0A */ u32 countryRibbon:1; //distributed during Pokémon Festa '04 and '05 to tournament winners + /* 0x0A */ u32 marineRibbon:1; // never distributed + /* 0x0A */ u32 landRibbon:1; // never distributed + /* 0x0A */ u32 skyRibbon:1; // never distributed + /* 0x0A */ u32 countryRibbon:1; // distributed during Pokémon Festa '04 and '05 to tournament winners /* 0x0B */ u32 nationalRibbon:1; /* 0x0B */ u32 earthRibbon:1; - /* 0x0B */ u32 worldRibbon:1; //distributed during Pokémon Festa '04 and '05 to tournament winners + /* 0x0B */ u32 worldRibbon:1; // distributed during Pokémon Festa '04 and '05 to tournament winners /* 0x0B */ u32 filler:4; - /* 0x0B */ u32 fatefulEncounter:1; //controls Mew and Deoxys obedience + /* 0x0B */ u32 eventLegal:1; // controls Mew & Deoxys obedience; if set, Pokémon is a fateful encounter in Gen 4+; set for in-game event island legendaries, some distributed events, and Pokémon from XD: Gale of Darkness. }; union PokemonSubstruct @@ -286,12 +286,12 @@ void CreateBattleTowerMon2(struct Pokemon *mon, struct BattleTowerPokemon *src, void CreateApprenticeMon(struct Pokemon *mon, const struct Apprentice *src, u8 monId); void CreateMonWithEVSpreadNatureOTID(struct Pokemon *mon, u16 species, u8 level, u8 nature, u8 fixedIV, u8 evSpread, u32 otId); void ConvertPokemonToBattleTowerPokemon(struct Pokemon *mon, struct BattleTowerPokemon *dest); -void CreateFatefulEncounterMon(struct Pokemon *mon, u16 species, u8 level, u8 fixedIV, u8 hasFixedPersonality, u32 fixedPersonality, u8 otIdType, u32 fixedOtId); +void CreateEventLegalMon(struct Pokemon *mon, u16 species, u8 level, u8 fixedIV, u8 hasFixedPersonality, u32 fixedPersonality, u8 otIdType, u32 fixedOtId); bool8 ShouldIgnoreDeoxysForm(u8 caseId, u8 battlerId); void SetDeoxysStats(void); u16 GetUnionRoomTrainerPic(void); u16 GetUnionRoomTrainerClass(void); -void CreateFatefulEncounterEnemyMon(void); +void CreateEventLegalEnemyMon(void); void CalculateMonStats(struct Pokemon *mon); void BoxMonToMon(const struct BoxPokemon *src, struct Pokemon *dest); u8 GetLevelFromMonExp(struct Pokemon *mon); -- cgit v1.2.3 From e059c4fdfa0fe36aceac4b283176825ad759fe5d Mon Sep 17 00:00:00 2001 From: GriffinR Date: Wed, 17 Feb 2021 14:11:45 -0500 Subject: Use new gift ribbons size, label unused ribbons --- include/pokemon.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/pokemon.h') diff --git a/include/pokemon.h b/include/pokemon.h index 7d6e960d7..82cdefeac 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -72,7 +72,7 @@ struct PokemonSubstruct3 /* 0x0B */ u32 nationalRibbon:1; /* 0x0B */ u32 earthRibbon:1; /* 0x0B */ u32 worldRibbon:1; // distributed during Pokémon Festa '04 and '05 to tournament winners - /* 0x0B */ u32 filler:4; + /* 0x0B */ u32 unusedRibbons:4; // discarded in Gen 4 /* 0x0B */ u32 eventLegal:1; // controls Mew & Deoxys obedience; if set, Pokémon is a fateful encounter in Gen 4+; set for in-game event island legendaries, some distributed events, and Pokémon from XD: Gale of Darkness. }; -- cgit v1.2.3 From 2bbaf71998337cba3c912143302f816b4116e851 Mon Sep 17 00:00:00 2001 From: Kurausukun Date: Mon, 31 May 2021 00:19:26 -0400 Subject: [LEAK-INFORMED] fix CreateShedinja fakematch info: the header change is required. accesses to the struct need to be treated as non-const, even though the array must be const. thanks to jiang for figuring this out. --- include/pokemon.h | 1 - 1 file changed, 1 deletion(-) (limited to 'include/pokemon.h') diff --git a/include/pokemon.h b/include/pokemon.h index 82cdefeac..3565bd966 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -258,7 +258,6 @@ extern const u8 gFacilityClassToPicIndex[]; extern const u8 gFacilityClassToTrainerClass[]; extern const struct BaseStats gBaseStats[]; extern const u8 *const gItemEffectTable[]; -extern const struct Evolution gEvolutionTable[][EVOS_PER_MON]; extern const u32 gExperienceTables[][MAX_LEVEL + 1]; extern const u16 *const gLevelUpLearnsets[]; extern const u8 gPPUpGetMask[]; -- cgit v1.2.3