From 0a6917bd8cc72ae81acae7935cc8d1589cf5c70b Mon Sep 17 00:00:00 2001 From: Cuyler36 Date: Mon, 24 Apr 2023 03:43:13 -0400 Subject: [PATCH] Add acre and fg item data along with other misc data to save file struct --- include/m_common_data.h | 19 +++++++++++++++---- include/m_field_info.h | 3 --- include/m_field_make.h | 35 +++++++++++++++++++++++++++++++++++ include/m_home.h | 4 ++-- 4 files changed, 52 insertions(+), 9 deletions(-) create mode 100644 include/m_field_make.h diff --git a/include/m_common_data.h b/include/m_common_data.h index 66681006..d88d44e8 100644 --- a/include/m_common_data.h +++ b/include/m_common_data.h @@ -9,6 +9,7 @@ #include "m_home.h" #include "m_private.h" #include "m_npc.h" +#include "m_field_make.h" #ifdef __cplusplus extern "C" { @@ -35,16 +36,26 @@ typedef struct time_s { typedef struct Save_s { /* 0x000000 */ mFRm_chk_t save_check; /* save information */ /* 0x000014 */ int scene_no; /* current 'scene' id */ - /* 0x000018 */ u8 _tmp0[0x9108]; + /* 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 */ /* 0x009120 */ mLd_land_info_c land_info; /* town name & id */ - /* 0x00912C */ u8 _tmp1[0xBBC]; + /* 0x00912C */ u8 _tmp1[0xBBC]; /* notice board info goes here */ /* 0x009CE8 */ mHm_hs_c homes[PLAYER_NUM]; /* player house data */ - /* 0x0137A8 */ u8 _tmp2[0x3C90]; + /* 0x0137A8 */ mFM_fg_c fg[FG_BLOCK_Z_NUM][FG_BLOCK_X_NUM]; /* fg items (fg = foreground?) */ + /* 0x0173A8 */ mFM_combination_c combi_table[BLOCK_Z_NUM][BLOCK_X_NUM]; /* acre 'combination' data */ /* 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]; + /* 0x020F18 */ u8 station_type; /* train station type */ + /* 0x020F19 */ u8 weather; /* upper nibble is intensity, lower nibble is type */ + /* 0x020F1A */ u8 save_exist; /* unsure, set in mCD_SaveHome_bg_set_data (1) & mCD_SaveHome_bg (bss) */ + /* 0x020F1B */ u8 npc_force_go_home; /* when set to 1, forces the 'm_go_home' code to activate */ + /* 0x020F1C */ u16 deposit[FG_BLOCK_X_NUM * FG_BLOCK_Z_NUM][UT_Z_NUM]; /* flags for which items are buried around town */ + /* 0x0212DC */ lbRTC_time_c last_grow_time; /* last time that a new villager moved into town */ + /* 0x0212E4 */ u8 _tmp4[0xAA]; /* 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 */ diff --git a/include/m_field_info.h b/include/m_field_info.h index 3a651644..6698a26d 100644 --- a/include/m_field_info.h +++ b/include/m_field_info.h @@ -9,9 +9,6 @@ extern "C" { #endif -#define UT_X_NUM 16 /* Spaces per block (acre) in x direction */ -#define UT_Z_NUM 16 /* Spaces per block (acre) in z direction */ - /* Not sure about these other than the island one */ enum { mFI_CLIMATE_0, diff --git a/include/m_field_make.h b/include/m_field_make.h new file mode 100644 index 00000000..a7124f69 --- /dev/null +++ b/include/m_field_make.h @@ -0,0 +1,35 @@ +#ifndef M_FIELD_MAKE_H +#define M_FIELD_MAKE_H + +#include "types.h" +#include "m_actor_type.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define BLOCK_X_NUM 7 +#define BLOCK_Z_NUM 10 + +#define FG_BLOCK_X_NUM (BLOCK_X_NUM - 2) /* 5 */ +#define FG_BLOCK_Z_NUM (BLOCK_Z_NUM - 4) /* 6 */ + +#define UT_X_NUM 16 /* Spaces per block (acre) in x direction */ +#define UT_Z_NUM 16 /* Spaces per block (acre) in z direction */ + +/* sizeof(mFM_combination_c) == 2 */ +typedef struct block_combination_s { + /* 0x00 */ u16 combination_type:14; /* acre type index */ + /* 0x00 */ u16 height:2; /* 0, 1, 2, or 3 (unused) */ +} mFM_combination_c; + +/* sizeof(mFM_fg_c) == 0x200 */ +typedef struct fg_items_s { + /* 0x000 */ mActor_name_t items[UT_Z_NUM][UT_X_NUM]; +} mFM_fg_c; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/m_home.h b/include/m_home.h index 887daab4..9d9e2821 100644 --- a/include/m_home.h +++ b/include/m_home.h @@ -2,7 +2,7 @@ #define M_HOME_H #include "types.h" -#include "m_field_info.h" +#include "m_field_make.h" #include "m_actor_type.h" #include "m_personal_id.h" #include "audio.h" @@ -62,7 +62,7 @@ typedef struct home_goki_s { /* sizeof(mHm_lyr_c) == 0x228 */ typedef struct home_layer_s { - /* 0x000 */ mActor_name_t items[UT_X_NUM][UT_Z_NUM]; /* Furniture item actors */ + /* 0x000 */ mActor_name_t items[UT_Z_NUM][UT_X_NUM]; /* Furniture item actors */ /* 0x200 */ u64 ftr_switch; /* Bitfield for controlling which furniture items are active, max of 64 */ /* 0x208 */ u32 unk_208[8]; /* Only referenced in mISL_gc_to_agb_layer */ } mHm_lyr_c;