Fix giftRibbons Field in SaveBlock1 & Relabel Gift Ribbons in pokemon.h

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.
This commit is contained in:
Deokishisu
2021-02-15 11:40:16 -05:00
parent 5f58ea02c6
commit b89c3e901e
21 changed files with 168 additions and 131 deletions

View File

@@ -164,15 +164,15 @@
#define MON_DATA_VICTORY_RIBBON 69
#define MON_DATA_ARTIST_RIBBON 70
#define MON_DATA_EFFORT_RIBBON 71
#define MON_DATA_GIFT_RIBBON_1 72
#define MON_DATA_GIFT_RIBBON_2 73
#define MON_DATA_GIFT_RIBBON_3 74
#define MON_DATA_GIFT_RIBBON_4 75
#define MON_DATA_GIFT_RIBBON_5 76
#define MON_DATA_GIFT_RIBBON_6 77
#define MON_DATA_GIFT_RIBBON_7 78
#define MON_DATA_FATEFUL_ENCOUNTER 79
#define MON_DATA_OBEDIENCE 80
#define MON_DATA_MARINE_RIBBON 72
#define MON_DATA_LAND_RIBBON 73
#define MON_DATA_SKY_RIBBON 74
#define MON_DATA_COUNTRY_RIBBON 75
#define MON_DATA_NATIONAL_RIBBON 76
#define MON_DATA_EARTH_RIBBON 77
#define MON_DATA_WORLD_RIBBON 78
#define MON_DATA_FILLER 79
#define MON_DATA_FATEFUL_ENCOUNTER 80
#define MON_DATA_KNOWN_MOVES 81
#define MON_DATA_RIBBON_COUNT 82
#define MON_DATA_RIBBONS 83

View File

@@ -898,6 +898,41 @@ struct MysteryEventStruct
/*0x344 0x3570*/ u32 unk_344[2][5];
}; // 0x36C 0x3598
// For external event data storage. The majority of these may have never been used.
struct ExternalEventData
{
u8 unknownExternalDataFields1[7]; // if actually used, may be broken up into different fields.
u32 currentPokeCoupons; // PokéCoupons stored by Pokémon Colosseum and XD from Mt. Battle runs. Earned PokéCoupons are also added to totalEarnedPokeCoupons.
u32 totalEarnedPokeCoupons; // Used by the JP Colosseum bonus disc. Determines PokéCoupon rank to distribute rewards. Unread in International games.
u8 unknownExternalDataFields2[5]; // if actually used, may be broken up into different fields.
} __attribute__((packed)); /*size = 0x14*/
// For external event flags. The majority of these may have never been used.
struct ExternalEventFlags
{
u8 unknownFlag1;
u8 receivedWishmakerJirachi; // may also be used for Ageto Celebi?
u8 unknownFlag3;
u8 unknownFlag4;
u8 unknownFlag5;
u8 unknownFlag6;
u8 unknownFlag7;
u8 unknownFlag8;
u8 unknownFlag9;
u8 unknownFlag10;
u8 unknownFlag11;
u8 unknownFlag12;
u8 unknownFlag13;
u8 unknownFlag14;
u8 unknownFlag15;
u8 unknownFlag16;
u8 unknownFlag17;
u8 unknownFlag18;
u8 unknownFlag19;
u8 unknownFlag20;
};/*size = 0x14*/
struct SaveBlock1
{
/*0x00*/ struct Coords16 pos;
@@ -971,7 +1006,9 @@ struct SaveBlock1
/*0x2e90*/ struct ContestWinner contestWinners[NUM_CONTEST_WINNERS]; // see CONTEST_WINNER_*
/*0x3030*/ struct DayCare daycare;
/*0x3150*/ struct LinkBattleRecords linkBattleRecords;
/*0x31A8*/ u8 giftRibbons[52];
/*0x31A8*/ u8 giftRibbons[11];
/*0x31B3*/ struct ExternalEventData externalEventData;
/*0x31C7*/ struct ExternalEventFlags externalEventFlags;
/*0x31DC*/ struct Roamer roamer;
/*0x31F8*/ struct EnigmaBerry enigmaBerry;
/*0x322C*/ struct MEventBuffers unk_322C;

View File

@@ -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);