Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
red031000 authored Jul 2, 2023
2 parents 8f1c145 + dac4e2c commit e554831
Show file tree
Hide file tree
Showing 24 changed files with 798 additions and 797 deletions.
18 changes: 9 additions & 9 deletions include/battle.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ typedef struct UnkBtlCtxSub_76 {
u16 unkA0[2];
u8 unkA4[4];
MOVE moveData[468];
ITEMDATA *itemData;
ItemData *itemData;
u16 unk280[4];
u16 unk288[4];
} UnkBtlCtxSub_76;
Expand Down Expand Up @@ -185,14 +185,14 @@ typedef struct UnkBattlemonSub {
int unk30;
} UnkBattlemonSub;

typedef struct BATTLEMON {
typedef struct BattleMon {
u16 species;
u16 atk;
u16 def;
u16 speed;
u16 spAtk;
u16 spDef;
u16 moves[4];
u16 moves[MAX_MON_MOVES];
u32 hpIV:5;
u32 atkIV:5;
u32 defIV:5;
Expand All @@ -201,7 +201,7 @@ typedef struct BATTLEMON {
u32 spDefIV:5;
u32 isEgg:1;
u32 hasNickname:1;
s8 statChanges[8];
s8 statChanges[NUM_BATTLE_STATS];
int weight;
u8 type1;
u8 type2;
Expand All @@ -221,11 +221,11 @@ typedef struct BATTLEMON {
u32 moldBreakerFlag:1;
u32 pressureFlag:1;
u32 unk28_B:21;
u8 movePPCur[4];
u8 movePP[4];
u8 movePPCur[MAX_MON_MOVES];
u8 movePP[MAX_MON_MOVES];
u8 level;
u8 friendship;
u16 nickname[11];
u16 nickname[POKEMON_NAME_LENGTH + 1];
int hp;
u32 maxHp;
u16 unk54[8];
Expand All @@ -244,7 +244,7 @@ typedef struct BATTLEMON {
u32 moveEffectFlags;
u32 unk80;
UnkBattlemonSub unk88;
} BATTLEMON;
} BattleMon;

typedef struct BATTLECONTEXT {
u8 unk_0[4];
Expand Down Expand Up @@ -360,7 +360,7 @@ typedef struct BATTLECONTEXT {
u8 unk_2200[4][4][16];
u8 unk_2300[4][256];
int battleScriptBuffer[400];
BATTLEMON battleMons[4];
BattleMon battleMons[4];
u32 moveNoTemp;
u32 moveNoCur;
u32 moveNoPrev;
Expand Down
54 changes: 27 additions & 27 deletions include/daycare.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,44 +4,44 @@
#include "mail.h"
#include "pokemon.h"

typedef struct DAYCAREMAIL {
MAIL mail;
typedef struct DaycareMail {
Mail mail;
u16 ot_name[PLAYER_NAME_LENGTH + 1];
u16 nickname[POKEMON_NAME_LENGTH + 1];
u8 padding_5E[2];
} DAYCAREMAIL;
} DaycareMail;

typedef struct DAYCAREMON {
typedef struct DaycareMon {
BoxPokemon mon;
DAYCAREMAIL mail;
DaycareMail mail;
u32 steps;
} DAYCAREMON;
} DaycareMon;

typedef struct DAYCARE {
DAYCAREMON mons[2];
typedef struct Daycare {
DaycareMon mons[2];
u32 egg_pid;
u8 egg_cycles;
u8 padding_1DD[3];
} DAYCARE;
} Daycare;

u32 Save_Daycare_sizeof(void);
void Save_Daycare_Init(DAYCARE* daycare);
DAYCAREMON* Save_DayCare_GetMonX(DAYCARE* daycare, int i);
BoxPokemon *DayCareMon_GetBoxMon(DAYCAREMON* dcmon);
DAYCAREMAIL* DayCareMon_GetExtras(DAYCAREMON* dcmon);
int DayCareMon_GetSteps(DAYCAREMON* dcmon);
MAIL* DayCareMail_GetMailPtr(DAYCAREMAIL* dcmail);
u32 Save_DayCare_GetEggPID(DAYCARE* daycare);
u8 Save_DayCare_GetEggCycleCounter(DAYCARE* daycare);
void DayCareMon_SetSteps(DAYCAREMON* dcmon, u32 steps);
void DayCareMon_AddSteps(DAYCAREMON* dcmon, u32 steps);
void Save_DayCare_SetEggPID(DAYCARE* daycare, u32 pid);
void Save_DayCare_SetEggCycleCounter(DAYCARE* daycare, int count);
BOOL Save_DayCare_MasudaCheck(DAYCARE* daycare);
void DayCareMon_Copy(DAYCAREMON* dest, const DAYCAREMON* src);
void DayCareMon_Extras_Init(DAYCAREMAIL* mail);
void DayCareMon_Init(DAYCAREMON* mon);
DAYCARE* Save_DayCare_Get(SaveData* savedata);
BOOL Save_DayCare_HasEgg(DAYCARE* daycare);
void Save_Daycare_Init(Daycare* daycare);
DaycareMon* Save_DayCare_GetMonX(Daycare* daycare, int i);
BoxPokemon *DayCareMon_GetBoxMon(DaycareMon* dcmon);
DaycareMail* DayCareMon_GetExtras(DaycareMon* dcmon);
int DayCareMon_GetSteps(DaycareMon* dcmon);
Mail* DayCareMail_GetMailPtr(DaycareMail* dcmail);
u32 Save_DayCare_GetEggPID(Daycare* daycare);
u8 Save_DayCare_GetEggCycleCounter(Daycare* daycare);
void DayCareMon_SetSteps(DaycareMon* dcmon, u32 steps);
void DayCareMon_AddSteps(DaycareMon* dcmon, u32 steps);
void Save_DayCare_SetEggPID(Daycare* daycare, u32 pid);
void Save_DayCare_SetEggCycleCounter(Daycare* daycare, int count);
BOOL Save_DayCare_MasudaCheck(Daycare* daycare);
void DayCareMon_Copy(DaycareMon* dest, const DaycareMon* src);
void DayCareMon_Extras_Init(DaycareMail* mail);
void DayCareMon_Init(DaycareMon* mon);
Daycare* Save_DayCare_Get(SaveData* savedata);
BOOL Save_DayCare_HasEgg(Daycare* daycare);

#endif
28 changes: 14 additions & 14 deletions include/get_egg.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@
#include "daycare.h"
#include "script.h"

BoxPokemon *Daycare_GetBoxMonI(DAYCARE *daycare, int idx);
void Save_DayCare_PutMonIn(PARTY *party, u8 partyIdx, DAYCARE *dayCare, SaveData *saveData);
u16 Save_DayCare_RetrieveMon(PARTY *party, MessageFormat *msgFmt, DAYCARE *daycare, u8 whomst);
int DayCareMon_CalcLevelGrowth(DAYCAREMON *daycareMon);
u16 Save_DayCare_BufferMonNickAndRetrievalPrice(DAYCARE *dayCare, u8 slot, MessageFormat *msgFmt);
u8 Save_DayCare_BufferGrowthAndNick(DAYCARE *dayCare, u32 slot, MessageFormat *msgFmt);
void Save_DayCare_ResetEggStats(DAYCARE *dayCare);
BoxPokemon *Daycare_GetBoxMonI(Daycare *daycare, int idx);
void Save_DayCare_PutMonIn(PARTY *party, u8 partyIdx, Daycare *dayCare, SaveData *saveData);
u16 Save_DayCare_RetrieveMon(PARTY *party, MessageFormat *msgFmt, Daycare *daycare, u8 whomst);
int DayCareMon_CalcLevelGrowth(DaycareMon *daycareMon);
u16 Save_DayCare_BufferMonNickAndRetrievalPrice(Daycare *dayCare, u8 slot, MessageFormat *msgFmt);
u8 Save_DayCare_BufferGrowthAndNick(Daycare *dayCare, u32 slot, MessageFormat *msgFmt);
void Save_DayCare_ResetEggStats(Daycare *dayCare);
void SetEggStats(Pokemon *mon, int species, u8 metLocation, PlayerProfile *profile, int a4, int a5);
void GiveEggToPlayer(DAYCARE *dayCare, PARTY *party, PlayerProfile* profile);
BOOL HandleDayCareStep(DAYCARE *dayCare, PARTY *party, FieldSystem *fsys);
void GiveEggToPlayer(Daycare *dayCare, PARTY *party, PlayerProfile* profile);
BOOL HandleDayCareStep(Daycare *dayCare, PARTY *party, FieldSystem *fsys);
Pokemon *sub_0206CE44(PARTY *party);
void Save_DayCare_BufferStoredMonNicks(DAYCARE *dayCare, MessageFormat *msgFmt);
void Save_DayCare_BufferMonStats(DAYCARE *dayCare, u32 nickname_idx, u32 level_idx, u32 gender_idx, u8 slot, MessageFormat *msgFmt);
u16 Save_DayCare_BufferTailMonNick(DAYCARE *dayCare, MessageFormat *msgFmt);
u8 Save_DayCare_GetState(DAYCARE *dayCare);
u8 Save_DayCare_CalcCompatibility(DAYCARE *dayCare);
void Save_DayCare_BufferStoredMonNicks(Daycare *dayCare, MessageFormat *msgFmt);
void Save_DayCare_BufferMonStats(Daycare *dayCare, u32 nickname_idx, u32 level_idx, u32 gender_idx, u8 slot, MessageFormat *msgFmt);
u16 Save_DayCare_BufferTailMonNick(Daycare *dayCare, MessageFormat *msgFmt);
u8 Save_DayCare_GetState(Daycare *dayCare);
u8 Save_DayCare_CalcCompatibility(Daycare *dayCare);
void sub_0206D328(Pokemon *mon, HeapID heapId);

#endif
22 changes: 11 additions & 11 deletions include/item.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ typedef struct ItemSlot {
* Bit array describing the effects of using the item on a
* party member.
*/
typedef struct ItemPartyUseParam
typedef struct ItemPartyParam
{
u8 slp_heal:1;
u8 psn_heal:1;
Expand Down Expand Up @@ -66,7 +66,7 @@ typedef struct ItemPartyUseParam
s8 friendship_mod_med_param;
s8 friendship_mod_hi_param;
u8 paddding[2];
} ITEMPARTYPARAM;
} ItemPartyParam;

/*
* Item parameter data, loaded from itemtool/itemdata/item_data.narc
Expand All @@ -91,10 +91,10 @@ typedef struct ItemData
u8 padding_0D;
union {
u8 dummy;
ITEMPARTYPARAM partyUseParam;
ItemPartyParam partyUseParam;
};
u8 padding_22[2];
} ITEMDATA;
} ItemData;

/*
* void MoveItemSlotInList(ItemSlot *slots, int from, int to, int pocket, HeapID heap_id)
Expand Down Expand Up @@ -168,7 +168,7 @@ int GetItemIconAnim(void);
* @param heap_id: ID of heap to allocate the result from
*
* @returns: Pointer to loaded data. If attrNo is ... then ...
* ITEMNARC_PARAM: ITEMDATA* from itemtool/itemdata/item_data.narc
* ITEMNARC_PARAM: ItemData* from itemtool/itemdata/item_data.narc
* ITEMNARC_NCGR: NCGR from itemtool/itemdata/item_icon.narc
* ITEMNARC_NCLR: NCLR from itemtool/itemdata/item_icon.narc
*
Expand Down Expand Up @@ -205,7 +205,7 @@ void GetItemDescIntoString(String *dest, u16 itemId, HeapID heap_id);
*
* @param itemId: The item you want to query
* @param attrno: The attribute you want to read
* @param heap_id: Heap in which to allocate the temporary ITEMDATA
* @param heap_id: Heap in which to allocate the temporary ItemData
*
* @returns: Integer attribute value
*/
Expand All @@ -221,7 +221,7 @@ s32 GetItemAttr(u16 itemId, u16 attrno, HeapID heap_id);
*
* @returns: Integer attribute value
*/
s32 GetItemAttr_PreloadedItemData(ITEMDATA *itemData, u16 attrno);
s32 GetItemAttr_PreloadedItemData(ItemData *itemData, u16 attrno);

/*
* u16 TMHMGetMove(u16 itemId)
Expand Down Expand Up @@ -346,18 +346,18 @@ u16 BerryToItemId(u8 berryId);
String *GetNutName(u16 berryId, HeapID heap_id);

/*
* ITEMDATA *LoadAllItemData(HeapID heap_id)
* ItemData *LoadAllItemData(HeapID heap_id)
*
* Reads the entire FIMG of itemtool/itemdata/item_data.narc into a new buffer
*
* @param heap_id: Heap to allocate the array from
*
* @returns: Pointer to new array.
*/
ITEMDATA *LoadAllItemData(HeapID heap_id);
ItemData *LoadAllItemData(HeapID heap_id);

/*
* ITEMDATA *GetItemDataPtrFromArray(ITEMDATA *itemData, u32 itemDataIdx)
* ItemData *GetItemDataPtrFromArray(ItemData *itemData, u32 itemDataIdx)
*
* Gets the pointer to the selected member of the array returned by LoadAllItemData above. This function exists because scrub dev is scrub.
*
Expand All @@ -366,7 +366,7 @@ ITEMDATA *LoadAllItemData(HeapID heap_id);
*
* @returns: Pointer to &itemData[itemDataIdx]
*/
ITEMDATA *GetItemDataPtrFromArray(ITEMDATA *itemData, u32 itemDataIdx);
ItemData *GetItemDataPtrFromArray(ItemData *itemData, u32 itemDataIdx);

/*
* BOOL ItemIdIsNotJohtoBall(u16 itemId)
Expand Down
50 changes: 25 additions & 25 deletions include/mail.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,37 +10,37 @@
#define MAILBOX_MSG_COUNT (20)

typedef struct Mailbox {
MAIL msgs[MAILBOX_MSG_COUNT];
Mail msgs[MAILBOX_MSG_COUNT];
} MAILBOX;

MAIL *Mail_New(HeapID heap_id);
void Mail_Copy(const MAIL *src, MAIL *dest);
void Mail_Init(MAIL *mail);
BOOL Mail_TypeIsValid(MAIL *mail);
BOOL Mail_Compare(const MAIL *a, const MAIL *b);
void Mail_SetNewMessageDetails(MAIL *mail, u8 mailType, u8 mon_no, SaveData *saveData);
u32 Mail_GetOTID(const MAIL *mail);
u16 *Mail_GetAuthorNamePtr(MAIL *mail);
u8 Mail_GetAuthorGender(const MAIL *mail);
u8 Mail_GetType(const MAIL *mail);
void Mail_SetType(MAIL *mail, u8 mailType);
u8 Mail_GetLanguage(const MAIL *mail);
u8 Mail_GetVersion(const MAIL *mail);
u16 sub_0202B404(MAIL *mail, u8 r1, u8 r4, u16 r3);
u16 sub_0202B4E4(const MAIL *mail);
MAIL_MESSAGE *Mail_GetUnk20Array(MAIL *mail, int i);
void Mail_SetMessage(MAIL *mail, const MAIL_MESSAGE *src, int i);
Mail *Mail_New(HeapID heap_id);
void Mail_Copy(const Mail *src, Mail *dest);
void Mail_Init(Mail *mail);
BOOL Mail_TypeIsValid(Mail *mail);
BOOL Mail_Compare(const Mail *a, const Mail *b);
void Mail_SetNewMessageDetails(Mail *mail, u8 mailType, u8 mon_no, SaveData *saveData);
u32 Mail_GetOTID(const Mail *mail);
u16 *Mail_GetAuthorNamePtr(Mail *mail);
u8 Mail_GetAuthorGender(const Mail *mail);
u8 Mail_GetType(const Mail *mail);
void Mail_SetType(Mail *mail, u8 mailType);
u8 Mail_GetLanguage(const Mail *mail);
u8 Mail_GetVersion(const Mail *mail);
u16 sub_0202B404(Mail *mail, u8 r1, u8 r4, u16 r3);
u16 sub_0202B4E4(const Mail *mail);
MAIL_MESSAGE *Mail_GetUnk20Array(Mail *mail, int i);
void Mail_SetMessage(Mail *mail, const MAIL_MESSAGE *src, int i);
MAILBOX *Save_Mailbox_Get(SaveData *saveData);
u32 Save_Mailbox_sizeof(void);
void Save_Mailbox_Init(MAILBOX *mailbox);
MAIL *Mailbox_AllocAndFetchMailI(MAIL *msgs, int n, int i, HeapID heapId);
Mail *Mailbox_AllocAndFetchMailI(Mail *msgs, int n, int i, HeapID heapId);
int Mailbox_GetFirstEmptySlotIdx(MAILBOX *mailbox);
void Mailbox_DeleteSlotI(MAIL *msgs, int n, int i);
void Mailbox_CopyMailToSlotI(MAIL *msgs, int n, int i, const MAIL *src);
void Mailbox_DeleteSlotI(Mail *msgs, int n, int i);
void Mailbox_CopyMailToSlotI(Mail *msgs, int n, int i, const Mail *src);
u32 Mailbox_CountMessages(MAILBOX *mailbox, int unused);
void Mailbox_FetchMailToBuffer(MAIL *msgs, int n, int i, MAIL *dest);
int MailArray_GetFirstEmptySlotIdx(MAIL *msgs, int n);
u32 MailArray_CountMessages(MAIL *msgs, int n);
MAIL *CreateKenyaMail(Pokemon *mon, u8 mailType, u8 gender, String *name, u8 otId);
void Mailbox_FetchMailToBuffer(Mail *msgs, int n, int i, Mail *dest);
int MailArray_GetFirstEmptySlotIdx(Mail *msgs, int n);
u32 MailArray_CountMessages(Mail *msgs, int n);
Mail *CreateKenyaMail(Pokemon *mon, u8 mailType, u8 gender, String *name, u8 otId);

#endif //POKEHEARTGOLD_MAIL_H
4 changes: 2 additions & 2 deletions include/mail_misc.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ typedef struct {
u8 partyIdx;
u8 unkF;
SaveData *saveData;
MAIL *mail;
Mail *mail;
MAILBOX *mailbox;
u8 unk1C[0x4];
} Unk02090E68;
Expand Down Expand Up @@ -69,6 +69,6 @@ u32 sub_02090F6C(Unk02090E68 *a0);
BOOL sub_02090F70(Unk02090E68 *a0, Pokemon *mon);
void sub_02090F90(Unk02090E68 *a0);
int sub_02090FA8(MAILBOX *mailbox, Pokemon *mon, HeapID heapId);
int sub_02091004(MAIL *msgs, int i, Pokemon *mon, HeapID heapId);
int sub_02091004(Mail *msgs, int i, Pokemon *mon, HeapID heapId);

#endif //POKEHEARTGOLD_MAIL_MISC_H
2 changes: 1 addition & 1 deletion include/npc_trade.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ typedef struct NPCTradeAppData {
NPCTradeAppData *NPCTradeApp_Init(HeapID heapId, u32 tradeno);
void NPCTradeApp_Delete(NPCTradeAppData *work);
void NPCTrade_MakeAndGiveLoanMon(FieldSystem *fsys, u8 tradeno, u8 level, u16 mapno);
MAIL *NPCTrade_MakeKenyaMail(void);
Mail *NPCTrade_MakeKenyaMail(void);
int NPCTrade_CanGiveUpLoanMon(FieldSystem *fsys, u8 tradeno, u8 idx);
int NPCTradeApp_GetOfferedSpecies(NPCTradeAppData *work);
int NPCTradeApp_GetRequestedSpecies(NPCTradeAppData *work);
Expand Down
4 changes: 2 additions & 2 deletions include/overlay_12_0224E4FC.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ void ov12_0224EDC0(BATTLECONTEXT *ctx, int battlerId);
int GetBattlerVar(BATTLECONTEXT *ctx, int battlerId, u32 varId, void *data);
void SetBattlerVar(BATTLECONTEXT *ctx, int battlerId, u32 varId, void *data);
void ov12_0224F794(BATTLECONTEXT *ctx, int battlerId, u32 varId, int data);
void AddBattlerVar(BATTLEMON *mon, u32 varId, int data);
void AddBattlerVar(BattleMon *mon, u32 varId, int data);
u8 CheckSortSpeed(BattleSystem *bsys, BATTLECONTEXT *ctx, int battlerId1, int battlerId2, int flag);
void BattleSystem_ClearExperienceEarnFlags(BATTLECONTEXT *ctx, int battlerId);
void BattleSystem_SetExperienceEarnFlags(BattleSystem *bsys, BATTLECONTEXT *ctx, int battlerId);
Expand All @@ -37,7 +37,7 @@ void InitFaintedWork(BattleSystem *bsys, BATTLECONTEXT *ctx, int battlerId);
void ov12_02251710(BattleSystem *bsys, BATTLECONTEXT *ctx);
u32 StruggleCheck(BattleSystem *bsys, BATTLECONTEXT *ctx, int battlerId, u32 nonSelectableMoves, u32 a4);
BOOL ov12_02251A28(BattleSystem *bsys, BATTLECONTEXT *ctx, int battlerId, int movePos, BATTLEMSG *msg);
int BattleMon_GetMoveIndex(BATTLEMON *mon, u16 move);
int BattleMon_GetMoveIndex(BattleMon *mon, u16 move);
int ov12_02251D28(BattleSystem *bsys, BATTLECONTEXT *ctx, int moveNo, int moveTypeDefault, int battlerIdAttacker, int battlerIdTarget, int damage, u32 *moveStatusFlag);
void ov12_02252054(BATTLECONTEXT *ctx, int moveNo, int moveTypeDefault, int abilityAttacker, int abilityTarget, int item, int type1, int type2, u32 *moveStatusFlag);
BOOL ov12_02252218(BATTLECONTEXT *ctx, int battlerId);
Expand Down
4 changes: 2 additions & 2 deletions include/pokemon_types_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ typedef struct Mail
union MailPatternData mon_icons[3];
u16 form_flags; // bitfield of three 5-bit values
MAIL_MESSAGE unk_20[3];
} MAIL;
} Mail;

typedef struct PartyPokemon {
/* 0x088 */ u32 status; // slp:3, psn:1, brn:1, frz:1, prz:1, tox:1, ...
Expand All @@ -168,7 +168,7 @@ typedef struct PartyPokemon {
/* 0x096 */ u16 speed;
/* 0x098 */ u16 spatk;
/* 0x09A */ u16 spdef;
/* 0x09C */ MAIL mail;
/* 0x09C */ Mail mail;
/* 0x0D4 */ CAPSULE sealCoords; // seal coords
} PARTYMON;

Expand Down
2 changes: 1 addition & 1 deletion include/use_item_on_mon.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ BOOL MonMoveRestorePP(Pokemon *mon, int moveIdx, int ppRestore);
BOOL BoostMonMovePpUpBy(Pokemon *mon, int moveIdx, int nPpUp);
void RestoreMonHPBy(Pokemon *mon, u32 hp, u32 maxHp, u32 restoration);
s32 TryModEV(s32 ev, s32 evSum, s32 by);
BOOL CanItemModFriendship(Pokemon *mon, ITEMDATA *itemData);
BOOL CanItemModFriendship(Pokemon *mon, ItemData *itemData);
BOOL DoItemFriendshipMod(Pokemon *mon, s32 friendship, s32 mod, u16 location, HeapID heapID);
void HealParty(PARTY *party);

Expand Down
Loading

0 comments on commit e554831

Please sign in to comment.