Tag Ovl work

This commit is contained in:
Cuyler36
2024-05-24 14:21:13 -04:00
parent b9554ef0cc
commit 8897596c87
13 changed files with 2757 additions and 445 deletions
+1
View File
@@ -14,6 +14,7 @@ extern "C" {
#define mCL_MENU_ITEM_MAX 742
#define mCL_MENU_PAGE_SIZE 7
#define mCL_ITEM_DATA_NUM 2
#define mCL_TAG_STR_SIZE 10
enum {
mCL_MENU_FTR,
+20
View File
@@ -2,11 +2,31 @@
#define M_CPMAIL_OVL_H
#include "types.h"
#include "m_cpmail_ovl_h.h"
#include "m_submenu.h"
#ifdef __cplusplus
extern "C" {
#endif
#define mCM_PAGE_COUNT 8
#define mCM_MAIL_COUNT 20
#define mCM_FOLDER_NAME_LEN 12
/* TODO: move this to a better header */
typedef struct card_mail_s {
int count;
u8 folder_names[mCM_PAGE_COUNT][mCM_FOLDER_NAME_LEN];
Mail_c mail[mCM_PAGE_COUNT][mCM_MAIL_COUNT];
} mCD_mail_c;
struct cpmail_ovl_s {
mCD_mail_c* card_mail;
Mail_c player_mail[mPr_INVENTORY_MAIL_COUNT];
u8 page_order[mCM_PAGE_COUNT];
u8 _BB0[0xBC4 - 0xBB0];
};
extern void mCM_cpmail_ovl_construct(Submenu* submenu);
extern void mCM_cpmail_ovl_destruct(Submenu* submenu);
extern void mCM_cpmail_ovl_set_proc(Submenu* submenu);
+2
View File
@@ -7,6 +7,8 @@
extern "C" {
#endif
typedef struct cpmail_ovl_s mCM_Ovl_c;
#ifdef __cplusplus
}
#endif
+29
View File
@@ -2,14 +2,43 @@
#define M_CPORIGINAL_OVL_H
#include "types.h"
#include "m_cporiginal_ovl_h.h"
#include "m_submenu_ovl.h"
#ifdef __cplusplus
extern "C" {
#endif
#define mCO_PAGE_NUM 8
#define mCO_ORIGINAL_NUM 12
#define mCO_FOLDER_NAME_LEN 12
/* TODO: find a better place for this */
typedef struct card_original_s {
int count;
u8 folder_names[mCO_PAGE_NUM][mCO_FOLDER_NAME_LEN];
mNW_original_design_c original[mCO_PAGE_NUM][mCO_ORIGINAL_NUM];
int _CC80;
} mCD_original_c;
struct cporiginal_s {
mCD_original_c* card_original;
u8 page_order[mCO_PAGE_NUM];
u8 up_folder;
u8 chang_flg;
int _10;
u16 mark_flg;
u16 hide_flg[mCO_PAGE_NUM];
u8 _26;
u8 cloth_org_no;
u8 cloth_org_idx;
u8 image_order[mCO_PAGE_NUM][mCO_ORIGINAL_NUM + 1];
};
extern void mCO_swap_image(Submenu* submenu, mActor_name_t item0, mActor_name_t item1);
extern int mCO_top_folder(Submenu* submenu);
extern u8* mCO_get_folder_name(Submenu* submenu, int folder);
extern u8* mCO_get_image_name(Submenu* submenu, int folder, int idx);
extern int mCO_check_hide_flg(Submenu* submenu, int folder, int idx);
extern void mCO_on_hide_flg(Submenu* submenu, int folder, int idx);
extern void mCO_clear_hide_flg(Submenu* submenu);
+16
View File
@@ -0,0 +1,16 @@
#ifndef M_CPORIGINAL_H_H
#define M_CPORIGINAL_H_H
#include "types.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct cporiginal_s mCO_Ovl_c;
#ifdef __cplusplus
}
#endif
#endif
+51 -46
View File
@@ -22,82 +22,84 @@ extern "C" {
#define mMl_MUSEUM_INFO_MAIL_NO 189 // TODO: enum?
enum {
mMl_NAME_TYPE_PLAYER,
mMl_NAME_TYPE_NPC,
mMl_NAME_TYPE_MUSEUM,
mMl_NAME_TYPE_PLAYER,
mMl_NAME_TYPE_NPC,
mMl_NAME_TYPE_MUSEUM,
mMl_NAME_TYPE_NUM,
mMl_NAME_TYPE_CLEAR = 0xFF
mMl_NAME_TYPE_NUM,
mMl_NAME_TYPE_CLEAR = 0xFF
};
enum {
mMl_FONT_0,
mMl_FONT_SEND,
mMl_FONT_2,
mMl_FONT_3,
mMl_FONT_4,
mMl_FONT_0,
mMl_FONT_SEND,
mMl_FONT_2,
mMl_FONT_3,
mMl_FONT_4,
mMl_FONT_NUM
mMl_FONT_NUM
};
enum {
mMl_DATA,
mMl_DATA2,
mMl_DATA,
mMl_DATA2,
mMl_DATA_NUM
mMl_DATA_NUM
};
enum {
mMl_TYPE_MAIL = 0,
mMl_TYPE_XMAS = 1,
mMl_TYPE_SHOP_SALE_LEAFLET = 2,
mMl_TYPE_BROKER_SALE_LEAFLET = 3,
mMl_TYPE_4 = 4,
mMl_TYPE_5 = 5,
mMl_TYPE_HRA = 6,
mMl_TYPE_MAIL,
mMl_TYPE_XMAS,
mMl_TYPE_SHOP_SALE_LEAFLET,
mMl_TYPE_BROKER_SALE_LEAFLET,
mMl_TYPE_MOTHER,
mMl_TYPE_OMIKUJI,
mMl_TYPE_HRA,
mMl_TYPE_SHOP,
mMl_TYPE_SNOWMAN,
mMl_TYPE_FISHING_CONTENST,
mMl_TYPE_POSTOFFICE,
mMl_TYPE_SPNPC_PASSWORD,
mMl_TYPE_FISHING_CONTENST = 9,
mMl_TYPE_SPNPC_PASSWORD = 11,
mMl_TYPE_12 = 12
mMl_TYPE_NUM
};
/* sizeof(Mail_nm_c) == 0x16 */
typedef struct mail_nm_s {
/* 0x00 */ PersonalID_c personalID;
/* 0x14 */ u8 type;
/* 0x00 */ PersonalID_c personalID;
/* 0x14 */ u8 type;
} Mail_nm_c;
/* sizeof(mail_header_save_s) == 0x3A */
typedef struct mail_header_save_s {
/* 0x00 */ s8 header_back_start;
/* 0x01 */ u8 unknown;
/* 0x02 */ u8 header[MAIL_HEADER_LEN];
/* 0x1A */ u8 footer[MAIL_FOOTER_LEN];
/* 0x00 */ s8 header_back_start;
/* 0x01 */ u8 unknown;
/* 0x02 */ u8 header[MAIL_HEADER_LEN];
/* 0x1A */ u8 footer[MAIL_FOOTER_LEN];
} Mail_hs_c;
/* sizeof(Mail_hdr_c) == 0x2C */
typedef struct mail_header_s {
/* 0x00 */ Mail_nm_c recipient;
/* 0x16 */ Mail_nm_c sender;
/* 0x00 */ Mail_nm_c recipient;
/* 0x16 */ Mail_nm_c sender;
} Mail_hdr_c;
/* sizeof(Mail_ct_c) == 0xFC */
typedef struct mail_content_s {
/* 0x00 */ u8 font;
/* 0x01 */ u8 header_back_start;
/* 0x02 */ u8 mail_type;
/* 0x03 */ u8 paper_type;
/* 0x04 */ u8 header[MAIL_HEADER_LEN];
/* 0x1C */ u8 body[MAIL_BODY_LEN];
/* 0xDC */ u8 footer[MAIL_FOOTER_LEN];
/* 0x00 */ u8 font;
/* 0x01 */ u8 header_back_start;
/* 0x02 */ u8 mail_type;
/* 0x03 */ u8 paper_type;
/* 0x04 */ u8 header[MAIL_HEADER_LEN];
/* 0x1C */ u8 body[MAIL_BODY_LEN];
/* 0xDC */ u8 footer[MAIL_FOOTER_LEN];
} Mail_ct_c;
/* sizeof(Mail_c) == 0x12A */
typedef struct mail_s {
/* 0x000 */ Mail_hdr_c header;
/* 0x02C */ mActor_name_t present;
/* 0x02E */ Mail_ct_c content;
/* 0x000 */ Mail_hdr_c header;
/* 0x02C */ mActor_name_t present;
/* 0x02E */ Mail_ct_c content;
} Mail_c;
extern int mMl_strlen(u8* str, int size, u8 end_char);
@@ -119,9 +121,12 @@ extern int mMl_get_npcinfo_from_mail_name(AnmPersonalID_c* anm_pid, Mail_nm_c* n
extern int mMl_hunt_for_send_address(Mail_c* mail);
extern int mMl_check_send_mail(Mail_c* mail);
extern int mMl_check_set_present_myself(Mail_c* mail);
extern int mMl_send_mail_box(PersonalID_c* recipient_pid, int player_no, Mail_c* mail, mActor_name_t present, mActor_name_t paper, int mail_no, u8* sender_name, u32 proc_type);
extern int mMl_send_mail_postoffice(PersonalID_c* recipient_pid, int player_no, mActor_name_t present, mActor_name_t paper, int mail_no, u8* sender_name, u32 proc_type, u8 mail_type);
extern int mMl_send_mail(PersonalID_c* recipient_pid, int player_no, mActor_name_t present, mActor_name_t paper, int mail_no, u8* sender_name, u32 proc_type);
extern int mMl_send_mail_box(PersonalID_c* recipient_pid, int player_no, Mail_c* mail, mActor_name_t present,
mActor_name_t paper, int mail_no, u8* sender_name, u32 proc_type);
extern int mMl_send_mail_postoffice(PersonalID_c* recipient_pid, int player_no, mActor_name_t present,
mActor_name_t paper, int mail_no, u8* sender_name, u32 proc_type, u8 mail_type);
extern int mMl_send_mail(PersonalID_c* recipient_pid, int player_no, mActor_name_t present, mActor_name_t paper,
int mail_no, u8* sender_name, u32 proc_type);
extern void mMl_start_send_mail();
#ifdef __cplusplus
+1
View File
@@ -9,6 +9,7 @@ extern "C" {
#endif
extern u8 mNW_get_image_no(Submenu* submenu, int slot_no);
extern u8* mNW_get_image_name(Submenu* submenu, int idx);
extern int mNW_check_hide_flg(Submenu* submenu, int idx);
extern void mNW_on_hide_flg(Submenu* submenu, int idx);
extern void mNW_clear_hide_flg(Submenu* submenu);
+5 -3
View File
@@ -29,6 +29,8 @@
#include "m_hand_ovl_h.h"
#include "m_inventory_ovl_h.h"
#include "m_player.h"
#include "m_cpmail_ovl_h.h"
#include "m_cporiginal_ovl_h.h"
#ifdef __cplusplus
extern "C" {
@@ -183,14 +185,14 @@ struct submenu_overlay_s {
/* 0x9B4 */ mMP_Overlay_c* map_ovl;
/* 0x9B8 */ mNT_Ovl_c* notice_ovl;
/* 0x9BC */ mBR_Ovl_c* birthday_ovl;
/* 0x9C0 */ void* _9C0;
/* 0x9C0 */ mCM_Ovl_c* cpmail_ovl;
/* 0x9C4 */ void* _9C4;
/* 0x9C8 */ void* _9C8;
/* 0x9CC */ mCL_Ovl_c* catalog_ovl;
/* 0x9D0 */ mMU_Overlay_c* music_ovl;
/* 0x9D4 */ mBN_Overlay_c* bank_ovl;
/* 0x9D8 */ void* _9D8;
/* 0x9DC */ void* _9DC;
/* 0x9D8 */ void* needlework_ovl;
/* 0x9DC */ mCO_Ovl_c* cporiginal_ovl;
/* 0x9E0 */ void* _9E0;
/* 0x9E4 */ void* _9E4;
/* 0x9E8 */ mDI_Ovl_c* diary_ovl;
+20 -8
View File
@@ -10,6 +10,10 @@ extern "C" {
#endif
#define mTG_TAG_NUM 4
#define mTG_TAG_STR_LEN 16
#define mTG_TAG_SEL_STRING_LEN 35
#define mTG_TAG_FLAG_EDGE_FOOT_SELECT (1 << 0)
enum {
mTG_TYPE_NONE,
@@ -129,16 +133,24 @@ enum {
/* sizeof(mTG_tag_c) == 0xB4 */
typedef struct tag_s {
u8 type;
u8 _01;
u8 _02;
u8 _03;
u8 arrow_dir;
u8 str2_type;
u8 flags;
f32 _04[2];
f32 pos[2];
u8 _14[0x38 - 0x14];
f32 base_pos[2];
f32 body_scale[2];
f32 arrow_scale[2];
f32 body_ofs[2];
f32 text_ofs[2];
f32 _34;
int table;
int _3C;
int _40;
u8 _44[0xB4 - 0x44];
int tag_col;
int tag_row;
f32 scale;
u8 str0[mTG_TAG_SEL_STRING_LEN];
u8 str1[mTG_TAG_SEL_STRING_LEN];
u8 str2[mTG_TAG_SEL_STRING_LEN];
u8 _B1[0xB4 - 0xB1];
} mTG_tag_c;
typedef void (*mTG_INIT_TAG_DATA_ITEM_WIN_PROC)(Submenu*);
+2 -1
View File
@@ -1196,7 +1196,8 @@ static void mBD_set_writing_header(Submenu* submenu, GAME* game, mSM_MenuInfo_c*
mem_copy(tmp_header, mail_content->header, board_ovl->lengths[mBD_FIELD_HEADER]);
len = board_ovl->lengths[mBD_FIELD_HEADER];
} else if (mail_content->mail_type == mMl_TYPE_SHOP_SALE_LEAFLET ||
mail_content->mail_type == mMl_TYPE_BROKER_SALE_LEAFLET || mail_content->mail_type == mMl_TYPE_5) {
mail_content->mail_type == mMl_TYPE_BROKER_SALE_LEAFLET ||
mail_content->mail_type == mMl_TYPE_OMIKUJI) {
mem_copy(tmp_header, mail_content->header, MAIL_HEADER_LEN);
len = MAIL_HEADER_LEN;
} else {
+1 -1
View File
@@ -560,7 +560,7 @@ static void mCL_move_Play(Submenu* submenu, mSM_MenuInfo_c* menu_info) {
submenu->overlay->menu_control.tag_move_func(submenu, menu_info);
if (catalog_ovl->change_flag) {
catalog_ovl->menu_data[catalog_ovl->page_order[0]].y_idx = submenu->overlay->tag_ovl->tags[0]._40;
catalog_ovl->menu_data[catalog_ovl->page_order[0]].y_idx = submenu->overlay->tag_ovl->tags[0].tag_row;
mCL_item_data_set(submenu, catalog_ovl->page_order[0]);
catalog_ovl->change_flag = FALSE;
} else {
+2230
View File
File diff suppressed because it is too large Load Diff
+379 -386
View File
@@ -2,581 +2,574 @@
#include "m_house.h"
static int sChk_block_num_sub(u32 block_x, u32 block_z) {
int res = FALSE;
int res = FALSE;
if (block_x > FG_BLOCK_X_NUM && block_x != 0xFF) {
mFRm_ERRORLINE(79);
res = TRUE;
}
if (block_x > FG_BLOCK_X_NUM && block_x != 0xFF) {
mFRm_ERRORLINE(79);
res = TRUE;
}
if (block_z > FG_BLOCK_Z_NUM && block_z != 0xFF) {
mFRm_ERRORLINE(90);
res = TRUE;
}
if (block_z > FG_BLOCK_Z_NUM && block_z != 0xFF) {
mFRm_ERRORLINE(90);
res = TRUE;
}
if (block_z == mISL_BLOCK_Z && (block_x == mISL_BLOCK_X0 || block_x == mISL_BLOCK_X1)) {
res = FALSE;
}
if (block_z == mISL_BLOCK_Z && (block_x == mISL_BLOCK_X0 || block_x == mISL_BLOCK_X1)) {
res = FALSE;
}
return res;
return res;
}
static int sChk_ut_num_sub(u32 ut_x, u32 ut_z) {
int res = FALSE;
int res = FALSE;
if (ut_x >= UT_X_NUM && ut_x != 0xFF) {
mFRm_ERRORLINE(140);
res = TRUE;
}
if (ut_x >= UT_X_NUM && ut_x != 0xFF) {
mFRm_ERRORLINE(140);
res = TRUE;
}
if (ut_z >= UT_Z_NUM && ut_z != 0xFF) {
mFRm_ERRORLINE(151);
res = TRUE;
}
if (ut_z >= UT_Z_NUM && ut_z != 0xFF) {
mFRm_ERRORLINE(151);
res = TRUE;
}
return res;
return res;
}
static int sChk_ItemFG_sub(mActor_name_t item) {
int res = FALSE;
int res = FALSE;
if (item != EMPTY_NO && (ITEM_NAME_GET_TYPE(item) >= NAME_TYPE_WARP || ITEM_NAME_GET_TYPE(item) < NAME_TYPE_FTR0)) {
mFRm_ERRORLINE(201);
res = TRUE;
}
if (item != EMPTY_NO && (ITEM_NAME_GET_TYPE(item) >= NAME_TYPE_WARP || ITEM_NAME_GET_TYPE(item) < NAME_TYPE_FTR0)) {
mFRm_ERRORLINE(201);
res = TRUE;
}
return res;
return res;
}
static int sChk_cloth_sub(mActor_name_t item) {
int valid_cloth;
int res = FALSE;
int valid_cloth;
int res = FALSE;
valid_cloth = item == RSV_CLOTH || (item >= ITM_CLOTH_START && item < ITM_CLOTH_END);
valid_cloth = item == RSV_CLOTH || (item >= ITM_CLOTH_START && item < ITM_CLOTH_END);
if (valid_cloth == FALSE && item != EMPTY_NO) {
mFRm_ERRORLINE(247);
res = TRUE;
}
if (valid_cloth == FALSE && item != EMPTY_NO) {
mFRm_ERRORLINE(247);
res = TRUE;
}
return res;
return res;
}
static int sChk_fruit_sub(mActor_name_t item) {
int res = FALSE;
int res = FALSE;
if (item < ITM_FOOD_APPLE || item > ITM_FOOD_ORANGE) {
mFRm_ERRORLINE(288);
res = TRUE;
}
if (item < ITM_FOOD_APPLE || item > ITM_FOOD_ORANGE) {
mFRm_ERRORLINE(288);
res = TRUE;
}
return res;
return res;
}
static int sChk_OSRTCTime_sub(OSRTCTime* time) {
int res = FALSE;
int res = FALSE;
if (time->year < GAME_YEAR_MIN || time->year > GAME_YEAR_MAX) {
res = TRUE;
}
if (time->month == 0 || time->month > lbRTC_MONTHS_MAX) {
res = TRUE;
}
if (time->day == 0 || time->day > 31) {
res = TRUE;
}
if (time->weekday > lbRTC_SATURDAY) {
res = TRUE;
}
if (time->hour > 23) {
res = TRUE;
}
if (time->min > 59) {
res = TRUE;
}
if (time->sec > 59) {
res = TRUE;
}
if (res == TRUE) {
if (time->year == 0 && time->month == 0 && time->day == 0 && time->weekday == 0 && time->hour == 0 && time->min == 0 && time->sec == 0) {
res = FALSE;
if (time->year < GAME_YEAR_MIN || time->year > GAME_YEAR_MAX) {
res = TRUE;
}
else if (mTM_AreTimesEqual(time, &mTM_rtcTime_clear_code) == TRUE) {
res = FALSE;
}
else {
mFRm_ERRORLINE(379);
}
}
return res;
if (time->month == 0 || time->month > lbRTC_MONTHS_MAX) {
res = TRUE;
}
if (time->day == 0 || time->day > 31) {
res = TRUE;
}
if (time->weekday > lbRTC_SATURDAY) {
res = TRUE;
}
if (time->hour > 23) {
res = TRUE;
}
if (time->min > 59) {
res = TRUE;
}
if (time->sec > 59) {
res = TRUE;
}
if (res == TRUE) {
if (time->year == 0 && time->month == 0 && time->day == 0 && time->weekday == 0 && time->hour == 0 &&
time->min == 0 && time->sec == 0) {
res = FALSE;
} else if (mTM_AreTimesEqual(time, &mTM_rtcTime_clear_code) == TRUE) {
res = FALSE;
} else {
mFRm_ERRORLINE(379);
}
}
return res;
}
static int sChk_lbRTC_ymd_c_sub(lbRTC_ymd_c* ymd) {
int res = FALSE;
int res = FALSE;
if (ymd->year < GAME_YEAR_MIN || ymd->year > GAME_YEAR_MAX) {
res = TRUE;
}
if (ymd->month == 0 || ymd->month > lbRTC_MONTHS_MAX) {
res = TRUE;
}
if (ymd->day == 0 || ymd->day > 31) {
res = TRUE;
}
if (res == TRUE) {
if (ymd->year == 0 && ymd->month == 0 && ymd->day == 0) {
res = FALSE;
if (ymd->year < GAME_YEAR_MIN || ymd->year > GAME_YEAR_MAX) {
res = TRUE;
}
else if (ymd->year == mTM_rtcTime_ymd_clear_code.year && ymd->month == mTM_rtcTime_ymd_clear_code.month && ymd->day == mTM_rtcTime_ymd_clear_code.day) {
res = FALSE;
}
else {
mFRm_ERRORLINE(464);
}
}
return res;
if (ymd->month == 0 || ymd->month > lbRTC_MONTHS_MAX) {
res = TRUE;
}
if (ymd->day == 0 || ymd->day > 31) {
res = TRUE;
}
if (res == TRUE) {
if (ymd->year == 0 && ymd->month == 0 && ymd->day == 0) {
res = FALSE;
} else if (ymd->year == mTM_rtcTime_ymd_clear_code.year && ymd->month == mTM_rtcTime_ymd_clear_code.month &&
ymd->day == mTM_rtcTime_ymd_clear_code.day) {
res = FALSE;
} else {
mFRm_ERRORLINE(464);
}
}
return res;
}
static int sChk_Mail_nm_c_sub(Mail_nm_c* mail_name, int depth) {
int res = FALSE;
int res = FALSE;
if (mail_name->type >= mMl_NAME_TYPE_NUM && mail_name->type != mMl_NAME_TYPE_CLEAR) {
mFRm_ERRORLINE(519);
res = TRUE;
}
if (mail_name->type >= mMl_NAME_TYPE_NUM && mail_name->type != mMl_NAME_TYPE_CLEAR) {
mFRm_ERRORLINE(519);
res = TRUE;
}
return res;
return res;
}
static int sChk_Mail_hdr_c_sub(Mail_hdr_c* mail_header, int depth) {
int res = FALSE;
res |= sChk_Mail_nm_c_sub(&mail_header->recipient, depth + 1);
res |= sChk_Mail_nm_c_sub(&mail_header->sender, depth + 1);
return res;
int res = FALSE;
res |= sChk_Mail_nm_c_sub(&mail_header->recipient, depth + 1);
res |= sChk_Mail_nm_c_sub(&mail_header->sender, depth + 1);
return res;
}
static int sChk_font_sub(u8* font_p) {
int font = *font_p;
int res = FALSE;
int font = *font_p;
int res = FALSE;
/* This check seems wrong lol */
if (font != 0xFF && (font >= 0xFF || font >= mMl_FONT_NUM || font < mMl_FONT_0)) {
mFRm_ERRORLINE(612);
res = TRUE;
}
/* This check seems wrong lol */
if (font != 0xFF && (font >= 0xFF || font >= mMl_FONT_NUM || font < mMl_FONT_0)) {
mFRm_ERRORLINE(612);
res = TRUE;
}
return res;
return res;
}
static int sChk_header_back_start_sub(u8* header_back_start_p) {
int res = FALSE;
int res = FALSE;
if (*header_back_start_p > MAIL_HEADER_LEN) {
mFRm_ERRORLINE(657);
res = TRUE;
}
if (*header_back_start_p > MAIL_HEADER_LEN) {
mFRm_ERRORLINE(657);
res = TRUE;
}
return res;
return res;
}
static int sChk_paper_type_sub(u8* paper_type) {
int res = FALSE;
int res = FALSE;
if (*paper_type > (ITM_PAPER63 - ITM_PAPER00)) {
mFRm_ERRORLINE(701);
res = TRUE;
}
if (*paper_type > (ITM_PAPER63 - ITM_PAPER00)) {
mFRm_ERRORLINE(701);
res = TRUE;
}
return res;
return res;
}
static int sChk_Mail_ct_c_sub(Mail_ct_c* contents, int depth) {
int res = sChk_font_sub(&contents->font);
res |= sChk_header_back_start_sub(&contents->header_back_start);
int res = sChk_font_sub(&contents->font);
if (contents->mail_type > mMl_TYPE_12) {
mFRm_ERRORLINE(766);
res = TRUE;
}
res |= sChk_header_back_start_sub(&contents->header_back_start);
res |= sChk_paper_type_sub(&contents->paper_type);
if (contents->mail_type > mMl_TYPE_NUM) {
mFRm_ERRORLINE(766);
res = TRUE;
}
return res;
res |= sChk_paper_type_sub(&contents->paper_type);
return res;
}
static int sChk_Mail_c_sub(Mail_c* mail, int depth) {
int res = FALSE;
res |= sChk_Mail_hdr_c_sub(&mail->header, depth + 1);
res |= sChk_ItemFG_sub(mail->present);
res |= sChk_Mail_ct_c_sub(&mail->content, depth + 1);
int res = FALSE;
return res;
res |= sChk_Mail_hdr_c_sub(&mail->header, depth + 1);
res |= sChk_ItemFG_sub(mail->present);
res |= sChk_Mail_ct_c_sub(&mail->content, depth + 1);
return res;
}
static int sChk_mHm_rmsz_c_sub(mHm_rmsz_c* room_size, int depth) {
lbRTC_ymd_c order_date_copy;
int res;
lbRTC_ymd_c order_date_copy;
int res;
order_date_copy.day = room_size->upgrade_order_date.day;
order_date_copy.month = room_size->upgrade_order_date.month;
order_date_copy.year = room_size->upgrade_order_date.year;
order_date_copy.day = room_size->upgrade_order_date.day;
order_date_copy.month = room_size->upgrade_order_date.month;
order_date_copy.year = room_size->upgrade_order_date.year;
res = sChk_lbRTC_ymd_c_sub(&order_date_copy);
res = sChk_lbRTC_ymd_c_sub(&order_date_copy);
if (room_size->size >= mHm_HOMESIZE_NUM) {
mFRm_ERRORLINE(880);
res = TRUE;
}
if (room_size->size >= mHm_HOMESIZE_NUM) {
mFRm_ERRORLINE(880);
res = TRUE;
}
if (room_size->next_size >= mHm_HOMESIZE_NUM) {
mFRm_ERRORLINE(894);
res = TRUE;
}
if (room_size->next_size >= mHm_HOMESIZE_NUM) {
mFRm_ERRORLINE(894);
res = TRUE;
}
return res;
return res;
}
static int sChk_Haniwa_Item_c_sub(Haniwa_Item_c* haniwa_item, int depth) {
int res = sChk_ItemFG_sub(haniwa_item->item);
int res = sChk_ItemFG_sub(haniwa_item->item);
if (haniwa_item->exchange_type > mHm_HANIWA_TRADE_3) {
mFRm_ERRORLINE(947);
res = TRUE;
}
if (haniwa_item->exchange_type > mHm_HANIWA_TRADE_3) {
mFRm_ERRORLINE(947);
res = TRUE;
}
return res;
return res;
}
static int sChk_Haniwa_c_sub(Haniwa_c* haniwa, int depth) {
int i;
int res = FALSE;
int i;
int res = FALSE;
for (i = 0; i < HANIWA_ITEM_HOLD_NUM; i++) {
res |= sChk_Haniwa_Item_c_sub(haniwa->items + i, depth + 1);
}
for (i = 0; i < HANIWA_ITEM_HOLD_NUM; i++) {
res |= sChk_Haniwa_Item_c_sub(haniwa->items + i, depth + 1);
}
return res;
return res;
}
static int sChk_outlook_pal_sub(u8 outlook_pal) {
int res = FALSE;
int res = FALSE;
if (outlook_pal >= mHm_OUTLOOK_PAL_NUM) {
mFRm_ERRORLINE(1035);
res = TRUE;
}
if (outlook_pal >= mHm_OUTLOOK_PAL_NUM) {
mFRm_ERRORLINE(1035);
res = TRUE;
}
return res;
return res;
}
static int sChk_mHm_goki_c_sub(mHm_goki_c* goki, int depth) {
return sChk_OSRTCTime_sub(&goki->time);
return sChk_OSRTCTime_sub(&goki->time);
}
static int sChk_mHm_hs_c_sub(mHm_hs_c* house, int depth) {
int i;
int res = FALSE;
int i;
int res = FALSE;
res |= sChk_lbRTC_ymd_c_sub(&house->hra_mark_time);
res |= sChk_mHm_rmsz_c_sub(&house->size_info, depth + 1);
res |= sChk_outlook_pal_sub(house->outlook_pal);
res |= sChk_outlook_pal_sub(house->ordered_outlook_pal);
res |= sChk_outlook_pal_sub(house->next_outlook_pal);
res |= sChk_lbRTC_ymd_c_sub(&house->hra_mark_time);
res |= sChk_mHm_rmsz_c_sub(&house->size_info, depth + 1);
res |= sChk_outlook_pal_sub(house->outlook_pal);
res |= sChk_outlook_pal_sub(house->ordered_outlook_pal);
res |= sChk_outlook_pal_sub(house->next_outlook_pal);
for (i = 0; i < HOME_MAILBOX_SIZE; i++) {
res |= sChk_Mail_c_sub(house->mailbox + i, depth + 1);
}
for (i = 0; i < HOME_MAILBOX_SIZE; i++) {
res |= sChk_Mail_c_sub(house->mailbox + i, depth + 1);
}
res |= sChk_Haniwa_c_sub(&house->haniwa, depth + 1);
res |= sChk_mHm_goki_c_sub(&house->goki, depth + 1);
res |= sChk_Haniwa_c_sub(&house->haniwa, depth + 1);
res |= sChk_mHm_goki_c_sub(&house->goki, depth + 1);
return res;
return res;
}
static int sChk_AnmPersonalID_c_sub(AnmPersonalID_c* pid, int depth) {
int res = FALSE;
int res = FALSE;
if (ITEM_NAME_GET_TYPE(pid->npc_id) != NAME_TYPE_NPC && pid->npc_id != EMPTY_NO) {
mFRm_ERRORLINE(1200);
res = TRUE;
}
if (ITEM_NAME_GET_TYPE(pid->npc_id) != NAME_TYPE_NPC && pid->npc_id != EMPTY_NO) {
mFRm_ERRORLINE(1200);
res = TRUE;
}
if (pid->looks > mNpc_LOOKS_NUM) {
mFRm_ERRORLINE(1214);
res = TRUE;
}
if (pid->looks > mNpc_LOOKS_NUM) {
mFRm_ERRORLINE(1214);
res = TRUE;
}
return res;
return res;
}
static int sChk_Anmplmail_c_sub(Anmplmail_c* animal_player_mail, int depth) {
int res = FALSE;
int res = FALSE;
res |= sChk_font_sub(&animal_player_mail->font);
res |= sChk_paper_type_sub(&animal_player_mail->paper_type);
res |= sChk_ItemFG_sub(animal_player_mail->present);
res |= sChk_header_back_start_sub(&animal_player_mail->header_back_start);
res |= sChk_lbRTC_ymd_c_sub(&animal_player_mail->date);
res |= sChk_font_sub(&animal_player_mail->font);
res |= sChk_paper_type_sub(&animal_player_mail->paper_type);
res |= sChk_ItemFG_sub(animal_player_mail->present);
res |= sChk_header_back_start_sub(&animal_player_mail->header_back_start);
res |= sChk_lbRTC_ymd_c_sub(&animal_player_mail->date);
return res;
return res;
}
static int sChk_Anmmem_c_sub(Anmmem_c* animal_memory, int depth) {
int res = FALSE;
int res = FALSE;
res |= sChk_OSRTCTime_sub(&animal_memory->last_speak_time);
res |= sChk_Anmplmail_c_sub(&animal_memory->letter, depth + 1);
res |= sChk_OSRTCTime_sub(&animal_memory->last_speak_time);
res |= sChk_Anmplmail_c_sub(&animal_memory->letter, depth + 1);
return res;
return res;
}
static int sChk_Anmhome_c_sub(Anmhome_c* animal_home, int depth) {
int res = FALSE;
int res = FALSE;
if (animal_home->type_unused > 5) {
mFRm_ERRORLINE(1365);
res = TRUE;
}
if (animal_home->type_unused > 5) {
mFRm_ERRORLINE(1365);
res = TRUE;
}
res |= sChk_block_num_sub(animal_home->block_x, animal_home->block_z);
res |= sChk_ut_num_sub(animal_home->ut_x, animal_home->ut_z);
res |= sChk_block_num_sub(animal_home->block_x, animal_home->block_z);
res |= sChk_ut_num_sub(animal_home->ut_x, animal_home->ut_z);
return res;
return res;
}
static int sChk_Animal_c_sub(Animal_c* animal, int depth) {
int i;
int res = FALSE;
int i;
int res = FALSE;
res |= sChk_AnmPersonalID_c_sub(&animal->id, depth + 1);
res |= sChk_AnmPersonalID_c_sub(&animal->id, depth + 1);
for (i = 0; i < ANIMAL_MEMORY_NUM; i++) {
res |= sChk_Anmmem_c_sub(animal->memories + i, depth + 1);
}
for (i = 0; i < ANIMAL_MEMORY_NUM; i++) {
res |= sChk_Anmmem_c_sub(animal->memories + i, depth + 1);
}
res |= sChk_Anmhome_c_sub(&animal->home_info, depth + 1);
res |= sChk_Anmhome_c_sub(&animal->home_info, depth + 1);
if (animal->mood >= mNpc_MOOD_NUM) {
mFRm_ERRORLINE(1458);
res = TRUE;
}
if (animal->mood >= mNpc_MOOD_NUM) {
mFRm_ERRORLINE(1458);
res = TRUE;
}
res |= sChk_cloth_sub(animal->cloth);
res |= sChk_cloth_sub(animal->cloth);
if ((animal->is_home & ~1)) {
mFRm_ERRORLINE(1474);
res = TRUE;
}
if ((animal->is_home & ~1)) {
mFRm_ERRORLINE(1474);
res = TRUE;
}
res |= sChk_cloth_sub(animal->present_cloth);
res |= sChk_cloth_sub(animal->present_cloth);
return res;
return res;
}
static int sChk_Kabu_price_c_sub(Kabu_price_c* kabu_price, int depth) {
int res = FALSE;
int i;
int res = FALSE;
int i;
for (i = 0; i < lbRTC_WEEK; i++) {
if (kabu_price->daily_price[i] < Kabu_PRICE_MIN || kabu_price->daily_price[i] > Kabu_PRICE_MAX) {
mFRm_ERRORLINE(1531);
res = TRUE;
for (i = 0; i < lbRTC_WEEK; i++) {
if (kabu_price->daily_price[i] < Kabu_PRICE_MIN || kabu_price->daily_price[i] > Kabu_PRICE_MAX) {
mFRm_ERRORLINE(1531);
res = TRUE;
break;
break;
}
}
}
if (kabu_price->trade_market >= Kabu_TRADE_MARKET_TYPE_NUM) {
mFRm_ERRORLINE(1554);
res = TRUE;
}
if (kabu_price->trade_market >= Kabu_TRADE_MARKET_TYPE_NUM) {
mFRm_ERRORLINE(1554);
res = TRUE;
}
res |= sChk_OSRTCTime_sub(&kabu_price->update_time);
res |= sChk_OSRTCTime_sub(&kabu_price->update_time);
return res;
return res;
}
static int sChk_PostOffice_c_sub(PostOffice_c* post_office, int depth) {
int i;
int res = FALSE;
int i;
int res = FALSE;
if (post_office->keep_mail_sum_players < 0 || post_office->keep_mail_sum_players > mPO_KEEP_MAIL_PLAYERS_MAX) {
mFRm_ERRORLINE(1617);
res = TRUE;
}
if (post_office->keep_mail_sum_players < 0 || post_office->keep_mail_sum_players > mPO_KEEP_MAIL_PLAYERS_MAX) {
mFRm_ERRORLINE(1617);
res = TRUE;
}
if (post_office->keep_mail_sum_npcs < 0) {
mFRm_ERRORLINE(1632);
res = TRUE;
}
if (post_office->keep_mail_sum_npcs < 0) {
mFRm_ERRORLINE(1632);
res = TRUE;
}
if (post_office->mail_recipient_flags & (u16)(~0b1111)) {
mFRm_ERRORLINE(1647);
res = TRUE;
}
if (post_office->mail_recipient_flags & (u16)(~0b1111)) {
mFRm_ERRORLINE(1647);
res = TRUE;
}
for (i = 0; i < mPO_MAIL_STORAGE_SIZE; i++) {
res |= sChk_Mail_c_sub(post_office->mail + i, depth + 1);
}
for (i = 0; i < mPO_MAIL_STORAGE_SIZE; i++) {
res |= sChk_Mail_c_sub(post_office->mail + i, depth + 1);
}
res |= sChk_Mail_c_sub(&post_office->leaflet, depth + 1);
res |= sChk_Mail_c_sub(&post_office->event_leaflet, depth + 1);
res |= sChk_Mail_c_sub(&post_office->leaflet, depth + 1);
res |= sChk_Mail_c_sub(&post_office->event_leaflet, depth + 1);
if (post_office->leaflet_recipient_flags.leaflet_flags & (u16)(~0b1111)) {
mFRm_ERRORLINE(1668);
res = TRUE;
}
if (post_office->leaflet_recipient_flags.leaflet_flags & (u16)(~0b1111)) {
mFRm_ERRORLINE(1668);
res = TRUE;
}
if (post_office->leaflet_recipient_flags.event_flags & (u16)(~0b1111)) {
mFRm_ERRORLINE(1682);
res = TRUE;
}
if (post_office->leaflet_recipient_flags.event_flags & (u16)(~0b1111)) {
mFRm_ERRORLINE(1682);
res = TRUE;
}
res |= sChk_OSRTCTime_sub(&post_office->delivery_time);
res |= sChk_OSRTCTime_sub(&post_office->delivery_time);
return res;
return res;
}
static int sChk_PoliceBox_c_sub(PoliceBox_c* police_box, int depth) {
int i;
int res = FALSE;
int i;
int res = FALSE;
for (i = 0; i < mPB_POLICE_BOX_ITEM_STORAGE_COUNT; i++) {
res |= sChk_ItemFG_sub(police_box->keep_items[i]);
}
for (i = 0; i < mPB_POLICE_BOX_ITEM_STORAGE_COUNT; i++) {
res |= sChk_ItemFG_sub(police_box->keep_items[i]);
}
return res;
return res;
}
static int sChk_Config_c_sub(Config_c* config, int depth) {
int res = FALSE;
int res = FALSE;
if (config->sound_mode > Config_SOUND_MODE_NUM) {
mFRm_ERRORLINE(1775);
res = TRUE;
}
if (config->sound_mode > Config_SOUND_MODE_NUM) {
mFRm_ERRORLINE(1775);
res = TRUE;
}
if (config->voice_mode > Config_VOICE_MODE_NUM) {
mFRm_ERRORLINE(1789);
res = TRUE;
}
if (config->voice_mode > Config_VOICE_MODE_NUM) {
mFRm_ERRORLINE(1789);
res = TRUE;
}
if (config->vibration_enabled & (~1)) {
mFRm_ERRORLINE(1803);
res = TRUE;
}
if (config->vibration_enabled & (~1)) {
mFRm_ERRORLINE(1803);
res = TRUE;
}
return res;
return res;
}
static int sChk_mMsr_time_c_sub(mMsr_time_c* mushroom_time, int depth) {
int res = FALSE;
int res = FALSE;
if (mushroom_time->year < GAME_YEAR_MIN && mushroom_time->year > GAME_YEAR_MAX) {
res = TRUE;
}
if (mushroom_time->month == 0 || mushroom_time->month > lbRTC_DECEMBER) {
res = TRUE;
}
if (mushroom_time->day == 0 || mushroom_time->day > 31) {
res = TRUE;
}
if (mushroom_time->hour > 23) {
res = TRUE;
}
if (res == TRUE) {
if (
mushroom_time->year == 0 &&
mushroom_time->month == 0 &&
mushroom_time->day == 0 &&
mushroom_time->hour == 0 &&
mushroom_time->hour_quarter == 0
) {
res = FALSE;
if (mushroom_time->year < GAME_YEAR_MIN && mushroom_time->year > GAME_YEAR_MAX) {
res = TRUE;
}
else {
mFRm_ERRORLINE(1876);
}
}
return res;
if (mushroom_time->month == 0 || mushroom_time->month > lbRTC_DECEMBER) {
res = TRUE;
}
if (mushroom_time->day == 0 || mushroom_time->day > 31) {
res = TRUE;
}
if (mushroom_time->hour > 23) {
res = TRUE;
}
if (res == TRUE) {
if (mushroom_time->year == 0 && mushroom_time->month == 0 && mushroom_time->day == 0 &&
mushroom_time->hour == 0 && mushroom_time->hour_quarter == 0) {
res = FALSE;
} else {
mFRm_ERRORLINE(1876);
}
}
return res;
}
static int sChk_MaskCat_c_sub(MaskCat_c* mask_cat, int depth) {
int valid_cloth;
int res = FALSE;
int valid_cloth;
int res = FALSE;
if (mask_cat->palette_no >= mNW_PALETTE_NUM) {
mFRm_ERRORLINE(1935);
res = TRUE;
}
if (mask_cat->palette_no >= mNW_PALETTE_NUM) {
mFRm_ERRORLINE(1935);
res = TRUE;
}
/* This is definitely a macro */
valid_cloth = (mActor_name_t)(mask_cat->cloth_no + ITM_CLOTH_START) >= ITM_CLOTH_START && (mActor_name_t)(mask_cat->cloth_no + ITM_CLOTH_START) < ITM_CLOTH_END;
if (valid_cloth == FALSE) {
mFRm_ERRORLINE(1949);
res = TRUE;
}
/* This is definitely a macro */
valid_cloth = (mActor_name_t)(mask_cat->cloth_no + ITM_CLOTH_START) >= ITM_CLOTH_START &&
(mActor_name_t)(mask_cat->cloth_no + ITM_CLOTH_START) < ITM_CLOTH_END;
if (valid_cloth == FALSE) {
mFRm_ERRORLINE(1949);
res = TRUE;
}
if (mask_cat->talk_idx > mMC_TALK_IDX_MAX) {
mFRm_ERRORLINE(1963);
res = TRUE;
}
if (mask_cat->talk_idx > mMC_TALK_IDX_MAX) {
mFRm_ERRORLINE(1963);
res = TRUE;
}
res |= sChk_OSRTCTime_sub(&mask_cat->time);
res |= sChk_OSRTCTime_sub(&mask_cat->time);
return res;
return res;
}
static int sChk_check_save_data() {
int res = FALSE;
Save_t* save = Common_GetPointer(save.save);
int i;
int res = FALSE;
Save_t* save = Common_GetPointer(save.save);
int i;
for (i = 0; i < mHS_HOUSE_NUM; i++) {
res |= sChk_mHm_hs_c_sub(save->homes + i, 1);
}
for (i = 0; i < mHS_HOUSE_NUM; i++) {
res |= sChk_mHm_hs_c_sub(save->homes + i, 1);
}
for (i = 0; i < ANIMAL_NUM_MAX; i++) {
res |= sChk_Animal_c_sub(save->animals + i, 1);
}
for (i = 0; i < ANIMAL_NUM_MAX; i++) {
res |= sChk_Animal_c_sub(save->animals + i, 1);
}
res |= sChk_AnmPersonalID_c_sub(&save->last_removed_animal_id, 1);
res |= sChk_Kabu_price_c_sub(&save->kabu_price_schedule, 1);
res |= sChk_fruit_sub(save->fruit);
res |= sChk_OSRTCTime_sub(&save->all_grow_renew_time);
res |= sChk_PostOffice_c_sub(&save->post_office, 1);
res |= sChk_PoliceBox_c_sub(&save->police_box, 1);
res |= sChk_Config_c_sub(&save->config, 1);
res |= sChk_lbRTC_ymd_c_sub(&save->renew_time);
res |= sChk_OSRTCTime_sub(&save->last_grow_time);
res |= sChk_mMsr_time_c_sub(&save->mushroom_time, 1);
res |= sChk_lbRTC_ymd_c_sub(&save->_021322);
res |= sChk_OSRTCTime_sub(&save->_02136E);
res |= sChk_OSRTCTime_sub(&save->treasure_buried_time);
res |= sChk_OSRTCTime_sub(&save->treasure_checked_time);
res |= sChk_lbRTC_ymd_c_sub(&save->force_remove_date);
res |= sChk_MaskCat_c_sub(&save->mask_cat, 1);
res |= sChk_AnmPersonalID_c_sub(&save->last_removed_animal_id, 1);
res |= sChk_Kabu_price_c_sub(&save->kabu_price_schedule, 1);
res |= sChk_fruit_sub(save->fruit);
res |= sChk_OSRTCTime_sub(&save->all_grow_renew_time);
res |= sChk_PostOffice_c_sub(&save->post_office, 1);
res |= sChk_PoliceBox_c_sub(&save->police_box, 1);
res |= sChk_Config_c_sub(&save->config, 1);
res |= sChk_lbRTC_ymd_c_sub(&save->renew_time);
res |= sChk_OSRTCTime_sub(&save->last_grow_time);
res |= sChk_mMsr_time_c_sub(&save->mushroom_time, 1);
res |= sChk_lbRTC_ymd_c_sub(&save->_021322);
res |= sChk_OSRTCTime_sub(&save->_02136E);
res |= sChk_OSRTCTime_sub(&save->treasure_buried_time);
res |= sChk_OSRTCTime_sub(&save->treasure_checked_time);
res |= sChk_lbRTC_ymd_c_sub(&save->force_remove_date);
res |= sChk_MaskCat_c_sub(&save->mask_cat, 1);
return res;
return res;
}