diff --git a/include/m_common_data.h b/include/m_common_data.h index d9f1cb68..66681006 100644 --- a/include/m_common_data.h +++ b/include/m_common_data.h @@ -8,6 +8,7 @@ #include "m_flashrom.h" #include "m_home.h" #include "m_private.h" +#include "m_npc.h" #ifdef __cplusplus extern "C" { @@ -32,19 +33,22 @@ typedef struct time_s { } Time_c; typedef struct Save_s { - /* 0x000000 */ mFRm_chk_t save_check; - /* 0x000014 */ int scene_no; + /* 0x000000 */ mFRm_chk_t save_check; /* save information */ + /* 0x000014 */ int scene_no; /* current 'scene' id */ /* 0x000018 */ u8 _tmp0[0x9108]; - /* 0x009120 */ mLd_land_info_c land_info; + /* 0x009120 */ mLd_land_info_c land_info; /* town name & id */ /* 0x00912C */ u8 _tmp1[0xBBC]; - /* 0x009CE8 */ mHm_hs_c homes[PLAYER_NUM]; - /* 0x0137A8 */ u8 _tmp2[0xD76C]; - /* 0x020F14 */ lbRTC_ymd_t renew_time; - /* 0x020F18 */ u8 _tmp3[0x476]; - /* 0x02138E */ u8 saved_rom_debug; - /* 0x02138F */ u8 _tmp4[0x1199]; - /* 0x022528 */ OSTime time_delta; - /* 0x022530 */ u8 _tmp5[0x3AD0]; + /* 0x009CE8 */ mHm_hs_c homes[PLAYER_NUM]; /* player house data */ + /* 0x0137A8 */ u8 _tmp2[0x3C90]; + /* 0x017438 */ Animal_c animals[ANIMAL_NUM_MAX]; /* villagers in town */ + /* 0x020330 */ AnmPersonalID_c last_removed_animal_id; /* ID of last villager who left town */ + /* 0x02033E */ u8 _tmp3[0xBD6]; + /* 0x020F14 */ lbRTC_ymd_t renew_time; /* next renew date */ + /* 0x020F18 */ u8 _tmp4[0x476]; + /* 0x02138E */ u8 saved_rom_debug; /* flag to set save to 'debug rom' mode */ + /* 0x02138F */ u8 _tmp5[0x1199]; + /* 0x022528 */ OSTime time_delta; /* time delta against GC RTC */ + /* 0x022530 */ u8 _tmp6[0x3AD0]; } Save_t; typedef union save_u { @@ -54,7 +58,7 @@ typedef union save_u { typedef struct common_data_s { /* 0x000000 */ Save save; - /* 0x026000 */ u8 game_1_patu; + /* 0x026000 */ u8 game_started; /* 0x026001 */ u8 field_type; /* 0x026002 */ u8 field_draw_type; /* 0x026003 */ u8 player_no; diff --git a/include/m_npc.h b/include/m_npc.h index cb82d58a..b503b65c 100644 --- a/include/m_npc.h +++ b/include/m_npc.h @@ -3,11 +3,110 @@ #include "types.h" #include "libu64/gfxprint.h" +#include "m_actor_type.h" +#include "m_land_h.h" +#include "m_mail.h" +#include "lb_rtc.h" +#include "m_personal_id.h" +#include "m_quest.h" #ifdef __cplusplus extern "C" { #endif +#define mNpc_GET_IDX(npc_id) ((npc_id) & 0x0FFF) +#define mNpc_GET_TYPE(npc_id) ((npc_id) & 0xF000) +#define mNpc_IS_SPECIAL(npc_id) (mNpc_GET_TYPE(npc_id) == 0xD000) + +#define ANIMAL_NUM_MAX 15 /* Maximum number of villagers possible in town */ +#define ANIMAL_MEMORY_NUM 7 +#define ANIMAL_CATCHPHRASE_LEN 10 +#define ANIMAL_HP_MAIL_NUM 4 + +/* 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(Anmplmail_c) == 0x104 */ +typedef struct animal_player_maiL_s { + /* 0x000 */ u8 font; /* 'font' to use for letter info */ + /* 0x001 */ u8 paper_type; + /* 0x002 */ mActor_name_t present; + /* 0x004 */ u8 header_back_start; /* position for name insertion in header */ + /* 0x005 */ u8 header[MAIL_HEADER_LEN]; + /* 0x01D */ u8 body[MAIL_BODY_LEN]; + /* 0x0DD */ u8 footer[MAIL_FOOTER_LEN]; + /* 0x0FD */ u8 pad0; /* likely pad */ + /* 0x0FE */ lbRTC_ymd_t date; /* sent date */ +} Anmplmail_c; + +/* sizeof(Anmhome_c) == 5 */ +typedef struct animal_home_s { + /* 0x00 */ u8 type_unused; /* Likely the house type, but seems to be unused outside of SChk_Anmhome_c_sub */ + /* 0x01 */ u8 block_x; /* acre x position */ + /* 0x02 */ u8 block_z; /* acre y position */ + /* 0x03 */ u8 ut_x; /* unit x position */ + /* 0x04 */ u8 ut_z; /* unit z position */ +} Anmhome_c; + +/* sizeof(Anmlet_c) == 1 */ +typedef struct animal_letter_info_s { + u8 exists:1; /* letter received by villager and exists */ + u8 password_letter:1; /* set when the letter contains a 'key' symbol and is considered a password letter */ + u8 send_reply:1; /* set when the villager should reply */ + u8 has_present_cloth:1; /* set when the villager's held present shirt is from this letter */ + u8 wearing_present_cloth:1; /* set when a villager is wearing the shirt sent with the saved letter */ + u8 bit5_7:3; /* seemingly unused */ +} Anmlet_c; + +/* sizeof(Anmmem_c) == 0x138 */ +typedef struct animal_memory_s { + /* 0x000 */ PersonalID_c memory_player_id; /* personal id of the player memory belongs to */ + /* 0x014 */ lbRTC_time_c last_speak_time; /* time the player last spoke to this villager */ + /* 0x01C */ u8 land_name[LAND_NAME_SIZE]; /* memory origin land name */ + /* 0x024 */ u16 land_id; /* memory origin land id */ + /* 0x028 */ u64 saved_town_tune; /* memory origin town tune */ + /* 0x030 */ s8 friendship; /* friendship with the player */ + /* 0x031 */ Anmlet_c letter_info; /* saved letter flags */ + /* 0x032 */ Anmplmail_c letter; /* saved letter */ +} Anmmem_c; + +/* sizeof(AnmHPMail_c) == 0x1C */ +typedef struct animal_password_mail_s { + /* 0x00 */ lbRTC_time_c receive_time; + /* 0x08 */ u8 password[20]; /* TODO: this should not be a hardcoded length */ +} AnmHPMail_c; + +/* sizeof(Animal_c) == 0x988 */ +typedef struct animal_s { + /* 0x000 */ AnmPersonalID_c id; /* this villager's ID */ + /* 0x010 */ Anmmem_c memories[ANIMAL_MEMORY_NUM]; /* memories of players who've spoken to this villager */ + /* 0x898 */ Anmhome_c home_info; /* home position info */ + /* 0x89D */ u8 catchphrase[ANIMAL_CATCHPHRASE_LEN]; /* may be called 'word_ending' */ + /* 0x8A8 */ mQst_contest_c contest_quest; /* current contest quest information */ + /* 0x8D0 */ u8 parent_name[PLAYER_NAME_LEN]; /* name of the player who 'spawned' the villager in, unsure why this is tracked */ + /* 0x8D8 */ u8 previous_land_name[LAND_NAME_SIZE]; /* name of the last town the villager lived in */ + /* 0x8E0 */ u16 previous_land_id; /* id of the previous town the villager lived in */ + /* 0x8E2 */ u8 mood; /* probably called 'feel' based on code */ + /* 0x8E3 */ u8 mood_time; /* probably called 'feel_tim' based on code */ + /* 0x8E4 */ mActor_name_t cloth; /* shirt the villager is wearing */ + /* 0x8E6 */ u16 remove_info; /* info about villager moving between towns? kinda stubbed */ + /* 0x8E8 */ u8 is_home; /* TRUE when the villager is home, otherwise FALSE */ + /* 0x8E9 */ u8 moved_in; /* TRUE when the villager moved in after town creation, FALSE if they started out in town */ + /* 0x8EA */ u8 removing; /* TRUE when the villager is leaving town, FALSE otherwise */ + /* 0x8EB */ s8 cloth_original_id; /* 0xFF when not wearing an Able Sister's pattern, otherwise 0-3 indicating which pattern */ + /* 0x8EC */ s8 umbrella_id; /* 0xFF when no umbrella, 0-31 when a standard umbrella, 32-35 when using an Able Sister's pattern */ + /* 0x8EE */ mActor_name_t present_cloth; /* The most recently received shirt from a letter which the villager may change into */ + /* 0x8F0 */ u8 animal_relations[ANIMAL_NUM_MAX]; /* relationships between all villagers in town, starts at 128 which is neutral */ + /* 0x900 */ AnmHPMail_c hp_mail[ANIMAL_HP_MAIL_NUM]; /* mail password info storage */ + /* 0x000 */ u8 unused[24]; /* unknown usage/unused */ +} Animal_c; + extern void mNpc_PrintRemoveInfo(gfxprint_t* gfxprint); extern void mNpc_PrintFriendship_fdebug(gfxprint_t* gfxprint); diff --git a/include/m_quest.h b/include/m_quest.h index 6a2878e9..c6d66e49 100644 --- a/include/m_quest.h +++ b/include/m_quest.h @@ -3,11 +3,66 @@ #include "types.h" #include "libu64/gfxprint.h" +#include "lb_rtc.h" +#include "m_actor_type.h" +#include "m_personal_id.h" #ifdef __cplusplus extern "C" { #endif +enum { + mQst_QUEST_TYPE_DELIVERY, /* Deliver item quest */ + mQst_QUEST_TYPE_ERRAND, /* Villager 'can I help' quests */ + mQst_QUEST_TYPE_CONTEST, /* Villager send letter, plant flowers, bring ball, etc */ + 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 */ + /* 0x00 */ u32 quest_kind:6; /* kind, differs by type */ + /* 0x01 */ u32 time_limit_enabled:1; /* when set, the time limit will be utilized */ + /* 0x01 */ u32 progress:4; /* progress towards quest goal */ + /* 0x01 */ u32 give_reward:1; /* set to true when player cannot take the item, and will skip quest completion checks */ + /* 0x01 */ u32 unused:2; + + /* 0x02 */ lbRTC_time_c time_limit; +} mQst_base_c; + +/* sizeof(mQst_contest_info_u) == 4 */ +typedef union quest_contest_info_s { + struct { + /* 0x00 */ u8 flowers_requested; /* number of flowers village requests be planted in acre */ + } flower_data; + + struct { + /* 0x00 */ u8 score; /* score rank of letter */ + /* 0x02 */ mActor_name_t present; /* present sent with letter */ + } letter_data; +} mQst_contest_info_u; + +/* sizeof(mQst_contest_c) == 0x28 */ +typedef struct quest_contest_s { + /* 0x00 */ mQst_base_c base; /* quest base struct */ + /* 0x0C */ mActor_name_t requested_item; /* item (if any) requested by the villager */ + /* 0x0E */ PersonalID_c player_id; /* personal id of the player */ + /* 0x22 */ s8 type; /* type of quest, seems to be repeat of data in quest base */ + /* 0x24 */ mQst_contest_info_u info; /* contest info for flower & letter quests */ +} mQst_contest_c; + extern void mQst_PrintQuestInfo(gfxprint_t* gfxprint); #ifdef __cplusplus