diff --git a/include/m_calendar.h b/include/m_calendar.h new file mode 100644 index 00000000..73c1dc95 --- /dev/null +++ b/include/m_calendar.h @@ -0,0 +1,25 @@ +#ifndef M_CALENDAR_H +#define M_CALENDAR_H + +#include "types.h" +#include "lb_rtc.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* sizeof(mCD_player_calendar_c) == 0x68 */ +typedef struct calendar_player_info_s { + u32 played_days[lbRTC_MONTHS_MAX]; /* bitfield of days where 1 bit represents a day played */ + u32 event_days[lbRTC_MONTHS_MAX]; /* bitfield of events where 1 bit represents an event was on that day */ + u16 event_flags; /* flags for specific event days the player played on */ + u16 edit; /* unsure, might have something to do with saving an edit */ + lbRTC_year_t year; /* year calendar was last updated */ + lbRTC_month_t month; /* month calendar was last updated */ +} mCD_player_calendar_c; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/m_common_data.h b/include/m_common_data.h index d88d44e8..44137c53 100644 --- a/include/m_common_data.h +++ b/include/m_common_data.h @@ -39,7 +39,8 @@ typedef struct Save_s { /* 0x000018 */ u8 now_npc_max; /* current number of villagers living in town (see mNpc_(Add/Sub)NowNpcMax) */ /* 0x000019 */ u8 remove_animal_idx; /* index of the villager which is scheduled to leave town, 0xFF when none selected */ /* 0x00001A */ u16 copy_protect; /* 'unique' value between [1, 65520] used for copy protection (see mCD_get_land_copyProtect) */ - /* 0x00001C */ u8 _tmp0[0x9104]; /* Private_c struct [4] goes here starting at 0x20 */ + /* 0x00001C */ u8 pad_1C[4]; + /* 0x000020 */ Private_c private[PLAYER_NUM]; /* 0x009120 */ mLd_land_info_c land_info; /* town name & id */ /* 0x00912C */ u8 _tmp1[0xBBC]; /* notice board info goes here */ /* 0x009CE8 */ mHm_hs_c homes[PLAYER_NUM]; /* player house data */ diff --git a/include/m_museum.h b/include/m_museum.h new file mode 100644 index 00000000..b4cb5db3 --- /dev/null +++ b/include/m_museum.h @@ -0,0 +1,39 @@ +#ifndef M_MUSEUM_H +#define M_MUSEUM_H + +#include "types.h" +#include "m_actor_type.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define mMsm_REMAIL_SLOTS 30 + +/* sizeof(mMsm_remail_display_c) = 1 */ +typedef struct museum_remail_display_s { + u8 display_type_upper:4; + u8 display_type_lower:4; +} mMsm_remail_display_c; + +/* sizeof(mMsm_remail_info_c) == 0x4C */ +typedef struct museum_remail_info_s { + /* 0x00 */ mMsm_remail_display_c types[mMsm_REMAIL_SLOTS / 2]; /* display types for items */ + /* 0x10 */ mActor_name_t items[mMsm_REMAIL_SLOTS]; /* item storage */ +} mMsm_remail_info_c; + +/* sizeof(mMsm_mail_info_c) == 0x4E */ +typedef struct museum_mail_info_s { + u8 contacted:1; /* set to TRUE when the museum has contacted the player */ + u8 unused:1; /* unused where this is used, if at all */ + u8 send_info_mail:1; /* if set to true, museum info mail will be sent */ + u8 stored_item_num:5; /* number of stored items */ + + mMsm_remail_info_c remail_info; /* remail info */ +} mMsm_mail_info_c; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/m_needlework.h b/include/m_needlework.h new file mode 100644 index 00000000..c0670121 --- /dev/null +++ b/include/m_needlework.h @@ -0,0 +1,28 @@ +#ifndef M_NEEDLEWORK_H +#define M_NEEDLEWORK_H + +#include "types.h" +#include "m_personal_id.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define mNW_ORIGINAL_DESIGN_NAME_LEN 16 +#define mNW_ORIGINAL_DESIGN_WIDTH 32 +#define mNW_ORIGINAL_DESIGN_HEIGHT 32 + +/* sizeof(mNW_original_design_c) == 0x220 */ +typedef struct original_data_s { + /* 0x000 */ u8 name[mNW_ORIGINAL_DESIGN_NAME_LEN]; + /* 0x010 */ u8 palette; + /* 0x011 */ u8 pad[15]; + + /* 0x020 */ u8 design[mNW_ORIGINAL_DESIGN_HEIGHT * (mNW_ORIGINAL_DESIGN_WIDTH / 2)]; +} mNW_original_design_c; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/m_npc.h b/include/m_npc.h index b503b65c..b59de054 100644 --- a/include/m_npc.h +++ b/include/m_npc.h @@ -2,6 +2,7 @@ #define M_NPC_H #include "types.h" +#include "m_npc_personal_id.h" #include "libu64/gfxprint.h" #include "m_actor_type.h" #include "m_land_h.h" @@ -22,15 +23,18 @@ extern "C" { #define ANIMAL_MEMORY_NUM 7 #define ANIMAL_CATCHPHRASE_LEN 10 #define ANIMAL_HP_MAIL_NUM 4 +#define ANIMAL_NAME_LEN PLAYER_NAME_LEN -/* sizeof(AnmPersonalID_c) == 0xE */ -typedef struct animal_personal_id_s { - /* 0x00 */ mActor_name_t npc_id; /* id */ - /* 0x02 */ u16 land_id; /* town id */ - /* 0x04 */ u8 land_name[LAND_NAME_SIZE]; /* town name */ - /* 0x0C */ u8 name_id; /* lower byte of the id */ - /* 0x0D */ u8 looks; /* internal name for personality */ -} AnmPersonalID_c; +/* sizeof(Anmremail_c) == 0x16 */ +typedef struct animal_remail_s { + lbRTC_ymd_t date; /* date sent */ + u8 name[ANIMAL_NAME_LEN]; /* villager name */ + u8 land_name[LAND_NAME_SIZE]; /* town name */ + struct { + u8 password_letter:1; /* is mail normal or password */ + u8 looks:7; /* personality */ + } flags; +} Anmremail_c; /* sizeof(Anmplmail_c) == 0x104 */ typedef struct animal_player_maiL_s { diff --git a/include/m_npc_personal_id.h b/include/m_npc_personal_id.h new file mode 100644 index 00000000..b503be91 --- /dev/null +++ b/include/m_npc_personal_id.h @@ -0,0 +1,25 @@ +#ifndef M_NPC_DEF_H +#define M_NPC_DEF_H + +#include "types.h" +#include "m_land_h.h" +#include "m_actor_type.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* sizeof(AnmPersonalID_c) == 0xE */ +typedef struct animal_personal_id_s { + /* 0x00 */ mActor_name_t npc_id; /* id */ + /* 0x02 */ u16 land_id; /* town id */ + /* 0x04 */ u8 land_name[LAND_NAME_SIZE]; /* town name */ + /* 0x0C */ u8 name_id; /* lower byte of the id */ + /* 0x0D */ u8 looks; /* internal name for personality */ +} AnmPersonalID_c; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/m_private.h b/include/m_private.h index 43adda4c..537de221 100644 --- a/include/m_private.h +++ b/include/m_private.h @@ -3,12 +3,158 @@ #include "types.h" #include "libu64/gfxprint.h" +#include "m_personal_id.h" +#include "m_npc.h" +#include "m_museum.h" +#include "m_mail.h" +#include "m_needlework.h" +#include "m_calendar.h" #ifdef __cplusplus extern "C" { #endif #define PLAYER_NUM 4 +#define mPr_POCKETS_SLOT_COUNT 15 +#define mPr_INVENTORY_MAIL_COUNT 10 +#define mPr_DELIVERY_QUEST_NUM mPr_POCKETS_SLOT_COUNT +#define mPr_ERRAND_QUEST_NUM 5 +#define mPr_CATALOG_ORDER_NUM 5 +#define mPr_FOREIGN_MAP_COUNT 8 +#define mPr_ORIGINAL_DESIGN_COUNT 8 + +#define mPr_SUNBURN_MIN_RANK 0 +#define mPr_SUNBURN_MAX_RANK 8 + +enum { + mPr_DESTINY_NORMAL, /* standard fortune state */ + mPr_DESTINY_POPULAR, /* good luck with villagers */ + mPr_DESTINY_UNPOPULAR, /* bad luck with villagers */ + mPr_DESTINY_BAD_LUCK, /* bad luck in general */ + mPr_DESTINY_MONEY_LUCK, /* good money luck */ + mPr_DESTINY_GOODS_LUCK /* good goods/item luck */ +}; + +/* sizeof(mPr_destiny_c) == 0xA */ +typedef struct player_destiny_s { + /* 0x00 */ lbRTC_time_c received_time; /* time fortune was received */ + /* 0x08 */ u8 type; /* fortune type */ +} mPr_destiny_c; + +/* sizeof(mPr_birthday_c) == 4 */ +typedef struct player_birthday_s { + /* 0x00 */ u16 year; /* assumed, set in mPr_ClearPrivateBirthday but goes unused elsewhere */ + /* 0x02 */ u8 month; + /* 0x03 */ u8 day; +} mPr_birthday_c; + +/* sizeof(mPr_catalog_order_c) == 4 */ +typedef struct player_catalog_order_s { + /* 0x00 */ mActor_name_t item; /* ordered item */ + /* 0x02 */ u8 shop_level; /* shop 'level' at time of order */ +} mPr_catalog_order_c; + +/* sizeof(mPr_animal_memory_c) == 0xA */ +typedef struct player_animal_memory_s { + /* 0x00 */ mActor_name_t npc_id; + /* 0x02 */ u8 land_name[LAND_NAME_SIZE]; +} mPr_animal_memory_c; + +/* sizeof(mPr_map_info_c) == 0xA */ +typedef struct player_map_s { + /* 0x00 */ u8 land_name[LAND_NAME_SIZE]; + /* 0x08 */ u16 land_id; +} mPr_map_info_c; + +/* sizeof(mPr_day_day_c) == 6 */ +typedef struct player_day_day_s { + /* 0x00 */ lbRTC_ymd_t last_date; /* last date modified */ + /* 0x04 */ u8 days; /* number of unique days */ +} mPr_day_day_c; + +/* sizeof(mPr_sunburn_c) == 6 */ +typedef struct player_sunburn_s { + /* 0x00 */ lbRTC_ymd_t last_changed_date; /* last date that the sunburn rank changed */ + /* 0x04 */ s8 rank; /* level of sunburn, 0-8 */ + /* 0x05 */ s8 rankdown_days; /* days until sunburn rank decreases */ +} mPr_sunburn_c; + +/* sizeof(mPr_carde_data_c) == 0x32 */ +typedef struct player_ecard_data_s { + /* 0x00 */ lbRTC_ymd_t letter_send_date; /* date the latest eCard letter was sent */ + /* 0x04 */ u8 card_letters_sent[46]; /* bitfield keeping track of which eCard letters have been sent to the player [0, 366] */ +} mPr_carde_data_c; + +typedef struct private_s { + /* 0x0000 */ PersonalID_c player_ID; /* player's id info */ + /* 0x0014 */ s8 gender; /* gender/sex of player */ + /* 0x0015 */ s8 face; /* face type of player */ + /* 0x0016 */ u8 reset_count; /* times player has reset */ + /* 0x0017 */ mMsm_mail_info_c museum_mail_info; /* museum items & remail info */ + + /* must be a struct due to alignment of first member */ + /* 0x0068 */ struct { + /* 0x0068 */ mActor_name_t pockets[mPr_POCKETS_SLOT_COUNT]; /* items in inventory */ + /* 0x0086 */ u8 lotto_ticket_expiry_month; + /* 0x0087 */ u8 lotto_ticket_mail_storage; + /* 0x0088 */ u32 item_conditions; /* bitfield (15 values), 2 bits per pocket slot */ + /* 0x008C */ u32 wallet; + /* 0x0090 */ u32 loan; + } inventory; + + /* 0x0094 */ mQst_delivery_c deliveries[mPr_DELIVERY_QUEST_NUM]; /* delivery quests */ + /* 0x02EC */ mQst_errand_c errands[mPr_ERRAND_QUEST_NUM]; /* errand quests */ + + /* 0x04A4 */ mActor_name_t equipment; /* equipped item */ + + /* 0x04A6 */ Mail_hs_c saved_mail_header; /* saved mail header/footer which is inserted when writing new letters */ + /* 0x04E0 */ Mail_c mail[mPr_INVENTORY_MAIL_COUNT]; /* letters in inventory */ + /* 0x1084 */ mActor_name_t backgound_texture; /* inventory background shirt item id */ + /* 0x1086 */ u8 exists; /* 0/1 if player exists or not */ + /* 0x1087 */ u8 hint_count; /* total hints heard from villagers (initial dialog) */ + + /* 0x1088 */ u16 cloth_idx; /* index value for texture? */ + /* 0x108A */ mActor_name_t cloth; /* shirt item */ + + /* 0x108C */ AnmPersonalID_c stored_anm_id; /* not sure what the function of this is */ + + /* 0x109A */ mPr_destiny_c destiny; /* player fortune, seemingly called destiny */ + /* 0x10A4 */ mPr_birthday_c birthday; /* player birthday */ + /* 0x10A8 */ mPr_catalog_order_c catalog_orders[mPr_CATALOG_ORDER_NUM]; /* items ordered from catalog to be mailed */ + /* 0x10BC */ u8 unk_10A8[24]; /* seemingly unused? */ + /* 0x10D4 */ u32 aircheck_collect_bitfield[2]; /* TODO: this should be a define like #define mPr_AIRCHECK_BITFIELD_NUM ((MD_COUNT / 32) + 1) */ + /* 0x10DC */ Anmremail_c remail; /* scheduled mail received from a foreign villager? */ + /* 0x10F4 */ u32 reset_code; /* 0 when not reset, random value after reset */ + /* 0x10F8 */ mPr_animal_memory_c animal_memory; /* id and town of last animal to move to another town */ + /* 0x1102 */ u8 complete_fish_insect_flags; /* bit0 = completed fish, bit1 = villager acknowledged completed fish, bit2 = completed insect, bit3 = villager acknowledged complete insect */ + /* 0x1104 */ lbRTC_year_t celebrated_birthday_year; /* last year a birthday was celebrated by card or visitor */ + + /* catalog */ + /* 0x1108 */ u32 furniture_collected_bitfield[43]; + /* 0x11B4 */ u32 wall_collected_bitfield[3]; + /* 0x11C0 */ u32 carpet_collected_bitfield[3]; + /* 0x11CC */ u32 paper_collected_bitfield[2]; + /* 0x11D4 */ u32 music_collected_bitfield[2]; + + /* 0x11DC */ mPr_map_info_c maps[mPr_FOREIGN_MAP_COUNT]; /* maps 'collected' for foreign towns */ + + /* 0x122C */ u32 bank_account; /* probably 'deposit' interally */ + /* 0x1230 */ u8 unused_1230[16]; + /* 0x1240 */ mNW_original_design_c my_org[mPr_ORIGINAL_DESIGN_COUNT]; /* Able Sisters' designs */ + /* 0x2340 */ u8 my_org_no_table[mPr_ORIGINAL_DESIGN_COUNT]; /* order of designs */ + /* 0x2348 */ u32 state_flags; /* TODO: this might be a bitfield/struct, also document bits */ + /* 0x234C */ mCD_player_calendar_c calendar; /* player calendar data */ + /* 0x23B4 */ u32 soncho_trophy_field0; /* first 28 tortimer event flags */ + /* 0x23B8 */ mPr_day_day_c needlework_day; /* info for how many unique days the player has talked to Sable */ + /* 0x23BE */ mPr_day_day_c radio_day; /* radio stamp days */ + /* 0x23C4 */ mPr_sunburn_c sunburn; /* sunburn state */ + /* 0x23CA */ u8 unused_23CA[14]; /* seemingly unused data */ + /* 0x23D8 */ mActor_name_t birthday_present_npc; /* npc id of the 'best friend' villger who will gift the player a present on their birthday (at the door) */ + /* 0x23DA */ u16 golden_items_collected; /* bitfield tracking which golden items the player has received */ + /* 0x23DC */ u32 soncho_trophy_field1; /* remaining tortimer event flags */ + /* 0x23E0 */ mPr_carde_data_c ecard_letter_data; /* info relating to scanned e-Card letters */ + /* 0x2412 */ u8 unused_2412[46]; +} Private_c; extern s16 mPr_GetGoodsPower(); extern s16 mPr_GetMoneyPower(); diff --git a/include/m_quest.h b/include/m_quest.h index c6d66e49..9cafcf36 100644 --- a/include/m_quest.h +++ b/include/m_quest.h @@ -6,6 +6,7 @@ #include "lb_rtc.h" #include "m_actor_type.h" #include "m_personal_id.h" +#include "m_npc_personal_id.h" #ifdef __cplusplus extern "C" { @@ -18,18 +19,6 @@ enum { mQst_QUEST_TYPE_NONE }; -enum { - mQst_CONTEST_KIND_FRUIT, /* get fruit for villager */ - mQst_CONTEST_KIND_SOCCER, /* get ball for villager */ - mQst_CONTEST_KIND_SNOWMAN, /* build snowman for villager */ - mQst_CONTEST_KIND_FLOWER, /* plant flowers for villager */ - mQst_CONTEST_KIND_FISH, /* get fish for villager */ - mQst_CONTEST_KIND_INSECT, /* get insect for villager */ - mQst_CONTEST_KIND_LETTER /* send letter to villager */ -}; - -/* TODO: delivery & errand quests, along with chore quests (first job) */ - /* sizeof(mQst_base_c) == 0xC */ typedef struct quest_base_s { /* 0x00 */ u32 quest_type:2; /* type, 0 = delivery, 1 = errand, 2 = contest, 3 = none */ @@ -42,6 +31,18 @@ typedef struct quest_base_s { /* 0x02 */ lbRTC_time_c time_limit; } mQst_base_c; +/* Contest Quest */ + +enum { + mQst_CONTEST_KIND_FRUIT, /* get fruit for villager */ + mQst_CONTEST_KIND_SOCCER, /* get ball for villager */ + mQst_CONTEST_KIND_SNOWMAN, /* build snowman for villager */ + mQst_CONTEST_KIND_FLOWER, /* plant flowers for villager */ + mQst_CONTEST_KIND_FISH, /* get fish for villager */ + mQst_CONTEST_KIND_INSECT, /* get insect for villager */ + mQst_CONTEST_KIND_LETTER /* send letter to villager */ +}; + /* sizeof(mQst_contest_info_u) == 4 */ typedef union quest_contest_info_s { struct { @@ -63,6 +64,55 @@ typedef struct quest_contest_s { /* 0x24 */ mQst_contest_info_u info; /* contest info for flower & letter quests */ } mQst_contest_c; +/* Delivery Quest */ + +/* sizeof(mQst_delivery_c) == 0x28 */ +typedef struct quest_delivery_s { + /* 0x00 */ mQst_base_c base; /* quest base info */ + /* 0x0C */ AnmPersonalID_c recipient; /* villager who will receive it */ + /* 0x1A */ AnmPersonalID_c sender; /* villager who sent it */ +} mQst_delivery_c; + +/* Errand Quest */ +#define mQst_ERRAND_FIRST_JOB_ANIMAL_NUM 2 +#define mQst_ERRAND_CHAIN_ANIMAL_NUM 3 + +enum { + mQst_ERRAND_TYPE_NONE, + mQst_ERRAND_TYPE_CHAIN, + mQst_ERRAND_TYPE_FIRST_JOB +}; + +/* sizeof(mQst_first_job_c) == 0x20 */ +typedef struct quest_first_job_s { + /* 0x00 */ AnmPersonalID_c used_ids[mQst_ERRAND_FIRST_JOB_ANIMAL_NUM]; /* villagers already used for first job quest (furniture, then letter) */ + /* 0x1C */ u8 used_num:7; /* used count for 'used_ids' */ + /* 0x1C */ u8 wrong_cloth:1; /* set to TRUE if player changes out of work uniform during chores */ +} mQst_firstjob_c; + +/* sizeof(mQst_errand_chain_c) == 0x2C */ +typedef struct quest_errand_chain_s { + /* 0x00 */ AnmPersonalID_c used_ids[mQst_ERRAND_CHAIN_ANIMAL_NUM]; + /* 0x2A */ u8 used_num; +} mQst_errand_chain_c; + +/* sizeof(mQst_errand_info_u) == 0x2C */ +typedef union { + mQst_errand_chain_c chain; + mQst_firstjob_c first_job; +} mQst_errand_info_u; + +/* sizeof(mQst_errand_c) == 0x58 */ +typedef struct quest_errand_s { + /* 0x00 */ mQst_base_c base; /* quest base info */ + /* 0x0C */ AnmPersonalID_c recipient; /* villager who will receive it */ + /* 0x1A */ AnmPersonalID_c sender; /* villager who sent it */ + /* 0x28 */ mActor_name_t item; /* errand item */ + /* 0x2A */ s8 pockets_idx:5; /* index in player pockets where the errand item is */ + /* 0x2A */ s8 errand_type:3; /* errand type */ + /* 0x2C */ mQst_errand_info_u info; /* errand type-specific data */ +} mQst_errand_c; + extern void mQst_PrintQuestInfo(gfxprint_t* gfxprint); #ifdef __cplusplus