From 5509dd4d6ad9e674c25139351997ae5d566f567d Mon Sep 17 00:00:00 2001 From: Cuyler36 Date: Wed, 26 Apr 2023 20:28:21 -0400 Subject: [PATCH] Add island struct & update animal struct with unions --- include/m_island.h | 34 ++++++++++++++++++++++++++++++++++ include/m_npc.h | 28 ++++++++++++++++++++++++---- 2 files changed, 58 insertions(+), 4 deletions(-) diff --git a/include/m_island.h b/include/m_island.h index 19c4d3dd..fab30676 100644 --- a/include/m_island.h +++ b/include/m_island.h @@ -2,12 +2,46 @@ #define M_ISLAND_H #include "types.h" +#include "m_personal_id.h" +#include "m_npc.h" +#include "m_land.h" +#include "m_field_make.h" +#include "m_home.h" +#include "m_needlework.h" #ifdef __cplusplus extern "C" { #endif +#define mISL_ISLAND_NAME_LEN 8 +#define mISL_FG_BLOCK_X_NUM 2 +#define mISL_FG_BLOCK_Z_NUM 1 + +enum { + mISL_ISLAND_BLOCK_LEFT, + mISL_ISLAND_BLOCK_RIGHT, + + mISL_ISLAND_BLOCK_NUM +}; + +/* sizeof(Island_c) == 0x1900 */ +typedef struct island_s { + /* 0x0000 */ u8 name[mISL_ISLAND_NAME_LEN]; /* island name */ + /* 0x0008 */ mLd_land_info_c landinfo; /* land info for town */ + /* 0x0014 */ mFM_fg_c fgblock[mISL_FG_BLOCK_Z_NUM][mISL_FG_BLOCK_X_NUM]; /* island item actor data */ + /* 0x0418 */ mHm_cottage_c cottage; /* player shared cottage data */ + /* 0x0CE0 */ mNW_original_design_c flag_design; /* island flag design */ + /* 0x0F00 */ Animal_c animal; /* islander info */ + /* 0x1888 */ u16 deposit[mISL_FG_BLOCK_X_NUM * mISL_FG_BLOCK_Z_NUM][UT_Z_NUM]; /* buried item bitfield */ + /* 0x18C8 */ u8 bg_data[mISL_ISLAND_BLOCK_NUM]; /* island acre ids */ + /* 0x18CA */ lbRTC_time_c renew_time; /* last time island was visited? */ + /* 0x18D2 */ u8 unused_18D2[14]; /* unused */ + /* 0x18E0 */ u8 grass_tex_type; /* grass type */ + /* 0x18E1 */ u8 last_song_male; /* last song kapp'n sang for a male character */ + /* 0x18E2 */ u8 last_song_female; /* last song kapp'n sang for a female character */ + /* 0x18E3 */ u8 unused_18E3[29]; /* unused */ +} Island_c; #ifdef __cplusplus } diff --git a/include/m_npc.h b/include/m_npc.h index 8a9dafab..bfcdea41 100644 --- a/include/m_npc.h +++ b/include/m_npc.h @@ -25,6 +25,8 @@ extern "C" { #define ANIMAL_HP_MAIL_NUM 4 #define ANIMAL_NAME_LEN PLAYER_NAME_LEN +#define mNpc_ISLAND_FTR_SAVE_NUM 4 + /* sizeof(Anmremail_c) == 0x16 */ typedef struct animal_remail_s { lbRTC_ymd_t date; /* date sent */ @@ -68,18 +70,35 @@ typedef struct animal_letter_info_s { u8 bit5_7:3; /* seemingly unused */ } Anmlet_c; +/* sizeof(Anmlnd_c) == 0xA */ +typedef struct animal_land_mem_s { + /* 0x00 */ u8 name[LAND_NAME_SIZE]; + /* 0x08 */ u16 id; +} Anmlnd_c; + +/* sizeof(memuni_U) == 0x12 */ +typedef union { + Anmlnd_c land; /* size = 0xA */ + u32 check; /* size = 4 */ +} memuni_u; + /* 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 */ + /* 0x01C */ memuni_u memuni; /* union between town NPC land memory & islander player action memory */ /* 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(anmuni) == 8 */ +typedef union { + u8 previous_land_name[LAND_NAME_SIZE]; + mActor_name_t island_ftr[mNpc_ISLAND_FTR_SAVE_NUM]; +} anmuni_u; + /* sizeof(AnmHPMail_c) == 0x1C */ typedef struct animal_password_mail_s { /* 0x00 */ lbRTC_time_c receive_time; @@ -94,7 +113,7 @@ typedef struct animal_s { /* 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 */ + /* 0x8D8 */ anmuni_u anmuni; /* name of the last town the villager lived in or saved island ftr */ /* 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 */ @@ -104,7 +123,8 @@ typedef struct animal_s { /* 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 */ + /* 0x8EC */ s8 umbrella_id; /* 0xFF when no umbrella, 0-31 when a standard umbrella, 32-35 when using an Able Sister's pattern + /* 0x8ED */ u8 unk_8ED; /* Exists according to mISL_gc_to_agb_animal, but seems unused in practice */ /* 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 */