summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/69CB30.h9
-rw-r--r--include/6E2300.h2
-rw-r--r--include/6EDD10.h5
-rw-r--r--include/m_common_data.h7
-rw-r--r--include/m_field_info.h2
-rw-r--r--include/m_land.h8
-rw-r--r--include/m_mail.h2
-rw-r--r--include/m_msg_main.h21
-rw-r--r--include/m_museum.h35
-rw-r--r--include/m_name_table.h2
-rw-r--r--include/m_player_lib.h4
-rw-r--r--include/m_private.h206
-rw-r--r--include/m_private_internals.h46
-rw-r--r--linker_scripts/jp/symbol_addrs_code.txt154
-rw-r--r--src/code/m_field_info.c2
-rw-r--r--src/code/m_mail.c4
-rw-r--r--src/code/m_private.c1397
-rw-r--r--src/code/m_start_data_init.c6
-rw-r--r--src/overlays/gamestates/ovl_play/m_play.c8
-rw-r--r--yamls/jp/code.yaml8
20 files changed, 1693 insertions, 235 deletions
diff --git a/include/69CB30.h b/include/69CB30.h
index 60fe607..74d3b3e 100644
--- a/include/69CB30.h
+++ b/include/69CB30.h
@@ -3,7 +3,10 @@
#include "ultra64.h"
-s32 func_80078E90_jp(s32 arg0, s32 arg1);
+struct Animal_c;
+struct PrivateInfo;
+
+s32 func_80078E90_jp(void* arg0, s32 arg1);
// void func_80078EB4_jp();
// void func_80078EE0_jp();
// void func_80078F08_jp();
@@ -18,7 +21,7 @@ s32 func_80078E90_jp(s32 arg0, s32 arg1);
// void func_80079378_jp();
// void func_800793A8_jp();
// void mCPk_SavePak();
-// void func_8007942C_jp();
+s32 func_8007942C_jp(struct PrivateInfo*, struct Animal_c*, void*);
// void func_800794E4_jp();
// void func_8007967C_jp();
// void func_80079708_jp();
@@ -37,7 +40,7 @@ s32 func_80078E90_jp(s32 arg0, s32 arg1);
// void func_80079EDC_jp();
// void func_80079F44_jp();
// void func_8007A008_jp();
-s32 mCPk_get_pkinfo(void);
+void* mCPk_get_pkinfo(void);
// void func_8007A080_jp();
#endif
diff --git a/include/6E2300.h b/include/6E2300.h
index 9cf664e..bd5902d 100644
--- a/include/6E2300.h
+++ b/include/6E2300.h
@@ -16,7 +16,7 @@
// void func_800BEE50_jp();
// void func_800BEEB4_jp();
// void func_800BEEC4_jp();
-// void func_800BEFCC_jp();
+u16 mRmTp_Item1ItemNo2FtrItemNo_AtPlayerRoom(u16 item);
// void func_800BF10C_jp();
// void func_800BF230_jp();
// void func_800BF26C_jp();
diff --git a/include/6EDD10.h b/include/6EDD10.h
index de4a3d9..905fd1e 100644
--- a/include/6EDD10.h
+++ b/include/6EDD10.h
@@ -3,13 +3,16 @@
#include "ultra64.h"
+struct lbRTC_ymd_t;
+struct lbRTC_time_c;
+
// void func_800CA070_jp();
void mTM_set_season(void);
// void func_800CA230_jp();
// void func_800CA240_jp();
// void func_800CA278_jp();
// void func_800CA2A8_jp();
-// void func_800CA2BC_jp();
+void mTM_set_renew_time(struct lbRTC_ymd_t*, struct lbRTC_time_c*);
void mTM_renewal_renew_time(void);
// void func_800CA350_jp();
// void func_800CA570_jp();
diff --git a/include/m_common_data.h b/include/m_common_data.h
index c98be21..78e2240 100644
--- a/include/m_common_data.h
+++ b/include/m_common_data.h
@@ -244,9 +244,10 @@ typedef struct CommonData {
/* 0x105A4 */ NpsSchedule npcSchedule[ANIMAL_NUM_MAX];
/* 0x10694 */ NpcWalking npcWalk;
/* 0x10710 */ NpcEvent npcEvent[5];
- /* 0x1074C */ UNK_TYPE unk_1074C;
- /* 0x10750 */ UNK_TYPE1 unk_10750[0x4];
- /* 0x10754 */ UNK_TYPE unk_10754;
+ /* 0x1074C */ s32 unk_1074C;
+ /* 0x10750 */ s16 moneyPower;
+ /* 0x10752 */ s16 goodsPower;
+ /* 0x10754 */ s32 unk_10754;
/* 0x10758 */ UNK_TYPE1 unk_10758[0x48];
/* 0x107A0 */ UNK_TYPE unk_107A0;
/* 0x107A4 */ UNK_TYPE1 unk_107A4[0x12];
diff --git a/include/m_field_info.h b/include/m_field_info.h
index da6a455..b9a6f13 100644
--- a/include/m_field_info.h
+++ b/include/m_field_info.h
@@ -207,7 +207,7 @@ void mFI_Wpos2DepositOFF(xyz_t);
// void func_8008D268_jp();
// void func_8008D3A4_jp();
// void func_8008D574_jp();
-// void func_8008D6E0_jp();
+u16 mFI_GetOtherFruit(void);
s32 func_8008D7B0_jp(u16);
// void func_8008D884_jp();
s32 mFI_GetWaveUtinBlock(s32* arg0, s32* arg1, s32 arg2, s32 arg3);
diff --git a/include/m_land.h b/include/m_land.h
index 9b2af3a..92c3243 100644
--- a/include/m_land.h
+++ b/include/m_land.h
@@ -3,6 +3,8 @@
#include "ultra64.h"
+#define mLd_CHECK_LAND_ID(id) (((id) & 0xFF00) == 0x3000)
+
// Town name character count
#define LAND_NAME_SIZE 6
#define LAND_NAME_MURA_SIZE (LAND_NAME_SIZE + 2)
@@ -13,8 +15,8 @@ typedef struct LandInfo {
/* 0x8 */u16 id;
} LandInfo; // size = 0xA
-// void func_80094DD0_jp();
-// void func_80094E10_jp();
+s32 mLd_NullCheckLandName(char*);
+s32 mLd_CheckId(u16);
s32 mLd_CheckCmpLandName(char* name1, char* name2);
s32 mLd_CheckCmpLand(char* name1, u16 id1, char* name2, u16 id2);
void mLd_ClearLandName(char* name);
@@ -24,7 +26,7 @@ void mLd_CopyLandName(char* arg0, char* arg1);
// void func_8009504C_jp();
char* mLd_GetLandName(void);
// void func_800950E8_jp();
-// void func_8009519C_jp();
+s32 mLd_PlayerManKindCheckNo(u8 playerNumber);
s32 mLd_PlayerManKindCheck(void);
s32 mLd_CheckThisLand(char* arg0, u16 arg1);
// void func_80095218_jp();
diff --git a/include/m_mail.h b/include/m_mail.h
index 59473f0..b42392a 100644
--- a/include/m_mail.h
+++ b/include/m_mail.h
@@ -71,7 +71,7 @@ s32 mMl_check_not_used_mail(Mail_c* mail);
void mMl_copy_header_name(mMl_unk_00* arg0, mMl_unk_00* arg1);
void mMl_set_from_name(Mail_c* arg0, Mail_c* arg1);
void mMl_set_to_name(Mail_c* arg0, Mail_c* arg1);
-void mMl_set_to_plname(Mail_c* arg0, Mail_c* arg1);
+void mMl_set_to_plname(Mail_c* arg0, PersonalID_c* arg1);
void mMl_set_playername(Mail_c* mail, PersonalID_c* arg1);
void mMl_init_mail(Mail_c* mail, PersonalID_c* arg1);
s32 mMl_chk_mail_free_space(Mail_c mail[], s32 arg1);
diff --git a/include/m_msg_main.h b/include/m_msg_main.h
index c937273..2fbefee 100644
--- a/include/m_msg_main.h
+++ b/include/m_msg_main.h
@@ -289,27 +289,6 @@ void func_800A3304_jp(struct Game_Play* game_play);
// void func_800A332C_jp();
void mMsg_Main(struct Game_Play* game_play);
void mMsg_Draw(struct Game_Play* game_play);
-// void func_800A3400_jp();
-// void func_800A3420_jp();
-// void func_800A345C_jp();
-// void func_800A34E8_jp();
-// void func_800A35C8_jp();
-// void func_800A3658_jp();
-void mMsm_SendInformationMail(void);
-// void func_800A3784_jp();
-// void func_800A37D0_jp();
-// void func_800A3810_jp();
-// void func_800A3A5C_jp();
-// void func_800A3B84_jp();
-// void func_800A3C18_jp();
-// void func_800A3CF0_jp();
-// void func_800A3E34_jp();
-// void func_800A3F70_jp();
-// void func_800A3FB4_jp();
-// void func_800A4184_jp();
-// void func_800A41BC_jp();
-// void func_800A4254_jp();
-// void func_800A43C0_jp();
// void func_800A4448_jp();
// void func_800A44D4_jp();
// void func_800A4508_jp();
diff --git a/include/m_museum.h b/include/m_museum.h
new file mode 100644
index 0000000..e6c3751
--- /dev/null
+++ b/include/m_museum.h
@@ -0,0 +1,35 @@
+#ifndef M_MUSEUM_H
+#define M_MUSEUM_H
+
+#include "ultra64.h"
+
+typedef struct MuseumRecord {
+ u8 contacted:1; /* set to TRUE when the museum has contacted the player */
+ u8 remailPending:1; /* set to TRUE when the museum has non-fossil letters pending */
+ u8 sendInfoMail:1; /* if set to true, museum info mail will be sent */
+ u8 storedFossils:5; /* number of stored fossils */
+} MuseumRecord;
+
+void mMsm_ClearRecord(MuseumRecord*);
+// void func_800A3420_jp();
+// void func_800A345C_jp();
+// void func_800A34E8_jp();
+// void func_800A35C8_jp();
+// void func_800A3658_jp();
+void mMsm_SendInformationMail(void);
+// void func_800A3784_jp();
+// void func_800A37D0_jp();
+// void func_800A3810_jp();
+// void func_800A3A5C_jp();
+// void func_800A3B84_jp();
+// void func_800A3C18_jp();
+// void func_800A3CF0_jp();
+// void func_800A3E34_jp();
+// void func_800A3F70_jp();
+// void func_800A3FB4_jp();
+// void func_800A4184_jp();
+// void func_800A41BC_jp();
+// void func_800A4254_jp();
+// void func_800A43C0_jp();
+
+#endif
diff --git a/include/m_name_table.h b/include/m_name_table.h
index 4bee1cb..141a16e 100644
--- a/include/m_name_table.h
+++ b/include/m_name_table.h
@@ -5,6 +5,8 @@
extern u8 npc_looks_table[];
+#define GET_NAME_ITEM_CATEGORY(f) (((f) & 0x0F00) >> 8)
+
#define EMPTY_NO 0x0000
#define ITM_MONEY_START 0x2100
diff --git a/include/m_player_lib.h b/include/m_player_lib.h
index d53f9f7..0cd50ca 100644
--- a/include/m_player_lib.h
+++ b/include/m_player_lib.h
@@ -5,7 +5,7 @@
struct Player;
struct Game_Play;
-
+struct PrivateInfo;
// void func_800B1160_jp();
// void func_800B11B0_jp();
@@ -50,7 +50,7 @@ struct Player* get_player_actor_withoutCheck(struct Game_Play* game_play);
UNK_RET func_800B1D94_jp(void* segment, UNK_TYPE arg1);
// void func_800B1DE8_jp();
// void func_800B1E94_jp();
-// void func_800B1EB0_jp();
+void mPlib_change_player_cloth_info_lv2(struct PrivateInfo*, u16);
// void func_800B1EDC_jp();
// void func_800B1F74_jp();
// void func_800B1F84_jp();
diff --git a/include/m_private.h b/include/m_private.h
index e566576..2eecc56 100644
--- a/include/m_private.h
+++ b/include/m_private.h
@@ -6,10 +6,13 @@
#include "m_quest.h"
#include "m_private_internals.h"
#include "m_npc.h"
+#include "m_museum.h"
#include "unk.h"
#define mPr_FOREIGN_MAP_COUNT 8
+#define mPr_INVENTORY_MAIL_COUNT 10
#define PLAYER_NUM 4
+#define mPR_FOREIGNER_NUMBER 4
typedef enum mPr_SEX {
/* 0 */ mPr_SEX_MALE,
@@ -26,6 +29,8 @@ typedef enum mPr_ITEM_COND{
/* 3 */ mPr_ITEM_COND_NUM
} mPr_ITEM_COND;
+#define mPr_GET_ITEM_COND(allCond, slot) (((allCond) >> (((u32)(slot)) << 1)) & mPr_ITEM_COND_NUM)
+
typedef enum mPr_FACE_TYPE {
/* 0 */ mPr_FACE_TYPE0,
/* 1 */ mPr_FACE_TYPE1,
@@ -42,112 +47,125 @@ typedef struct PrivateInfo {
/* 0x000 */ PersonalID_c playerId;
/* 0x010 */ s8 gender;
/* 0x011 */ s8 face;
- /* 0x012 */ UNK_TYPE1 unk_012[0x2];
+ /* 0x012 */ s8 resetCount;
+ /* 0x013 */ MuseumRecord museumRecord;
/* 0x014 */ PrivateInventory inventory;
/* 0x040 */ mQst_delivery_c deliveries[mPr_DELIVERY_QUEST_NUM]; /* delivery quests */
/* 0x25C */ QuestErrand errands[mPr_ERRAND_QUEST_NUM]; /* errand quests */
/* 0x3EC */ UNK_TYPE1 unk_3EC[0x2];
- /* 0x3EE */ MailHeaderCommon unk_3EE;
- /* 0x40A */ Mail_c unk_40A[10];
- /* 0xA72 */ UNK_TYPE1 unk_A72[0x2];
+ /* 0x3EE */ MailHeaderCommon savedMailHeader;
+ /* 0x40A */ Mail_c mail[mPr_INVENTORY_MAIL_COUNT];
+ /* 0xA72 */ s16 backgroundTextureId;
/* 0xA74 */ u8 exists;
- /* 0xA75 */ UNK_TYPE1 unkA75[1];
+ /* 0xA75 */ u8 hintCount;
/* 0xA76 */ PrivateCloth cloth;
- /* 0xA7A */ UNK_TYPE1 unkA7A[0xC];
- /* 0xA86 */ Private_Sub_A86 unk_A86;
- /* 0xA90 */ UNK_TYPE1 unk_A90[0x3C];
- /* 0xACC */ Anmremail remail;
+ /* 0xA7A */ AnmPersonalID_c storedAnmId;
+ /* 0xA86 */ PrivateDestiny destiny;
+ /* 0xA90 */ PrivateBirthday birthday;
+ /* 0xA94 */ UNK_TYPE1 unk_A94[0x28];
+ /* 0xABC */ s32 completedFish;
+ /* 0xAC0 */ s32 completedInsect;
+ /* 0xAC4 */ UNK_TYPE1 unk_AC4[0x8];
+ /* 0xACC */ Anmremail remail;
/* 0xADE */ UNK_TYPE1 unk_ADE[0x6];
/* 0xAE4 */ PrivateAnimalMemory animalMemory;
- /* 0xAEC */ UNK_TYPE1 unk_AEC[0x9C];
- /* 0xB88 */ mPr_map_info_c maps[mPr_FOREIGN_MAP_COUNT]; /* maps 'collected' for foreign towns */
+ /* 0xAEC */ u8 completeFishInsectFlags;
+ /* 0xAEF */ UNK_TYPE1 unk_AEF[0x2];
+ /* 0x108 */ u32 catalogFurniture[30];
+ /* 0x1B4 */ u32 catalogWallpaper[2];
+ /* 0x1C0 */ u32 catalogCarpet[2];
+ /* 0x1CC */ u32 catalogPaper[2];
+ /* 0x1D4 */ u32 catalogMusic[2];
+ /* 0xB88 */ mPr_map_info_c maps[mPr_FOREIGN_MAP_COUNT];
/* 0xBC8 */ UNK_TYPE1 unk_BC8[0x8];
} PrivateInfo; // size = 0xBD0
-void mPr_ClearPlayerName(char* arg0);
+void mPr_ClearPlayerName(char* buf);
void mPr_CopyPlayerName(char* dst, char* src);
-s32 mPr_NullCheckPlayerName(char* arg0);
-// void func_800B7804_jp();
-// void func_800B785C_jp();
-s32 mPr_NullCheckPersonalID(PersonalID_c* arg0);
-void mPr_ClearPersonalID(PersonalID_c* arg0);
-// void func_800B7998_jp();
-void mPr_CopyPersonalID(PersonalID_c* arg0, PersonalID_c* arg1);
-s32 mPr_CheckCmpPersonalID(PersonalID_c* arg0, PersonalID_c* arg1);
-// void func_800B7A94_jp();
-// void func_800B7AB0_jp();
-void mPr_ClearPrivateInfo(PrivateInfo* private);
-// void func_800B7B8C_jp();
-// void func_800B7BC0_jp();
-// void func_800B7CD0_jp();
-// void func_800B7D50_jp();
-void mPr_InitPrivateInfo(PrivateInfo* private);
-// void func_800B7F00_jp();
-// void func_800B7F48_jp();
-s32 mPr_CheckPrivate(PrivateInfo* private);
-// void func_800B7FA0_jp();
-s32 mPr_GetPrivateIdx(PersonalID_c* arg0);
-// void func_800B8068_jp();
-// void func_800B80B4_jp();
-// void func_800B8128_jp();
-// void func_800B81A4_jp();
-// void func_800B8204_jp();
-// void func_800B828C_jp();
-// void func_800B8318_jp();
-// void func_800B83D4_jp();
-// void func_800B8544_jp();
-// void func_800B86EC_jp();
-// void func_800B88EC_jp();
-// void func_800B8A88_jp();
-void mPr_SetPossessionItem(PrivateInfo* priv, int idx, u16 item, u32 cond);
-// void func_800B8B8C_jp();
-// void func_800B8BE4_jp();
-// void func_800B8C10_jp();
-// void func_800B8C20_jp();
-// void func_800B8C34_jp();
-// void func_800B8C9C_jp();
-// void func_800B8D18_jp();
-// void func_800B8D3C_jp();
-s32 func_800B8D64_jp(u8 player_no, s32 arg1);
-void mPr_ClearMotherMailInfo(PrivateMotherMail* arg0);
-// void func_800B8F20_jp();
-// void func_800B8FB8_jp();
-// void func_800B9038_jp();
-// void func_800B9170_jp();
-// void func_800B9350_jp();
-// void func_800B93AC_jp();
-// void func_800B947C_jp();
-// void func_800B94E0_jp();
-// void func_800B9704_jp();
-// void func_800B9790_jp();
-// void func_800B97C8_jp();
-// void func_800B97F8_jp();
-// void func_800B996C_jp();
-// void func_800B9AF0_jp();
-void func_800B9B2C_jp(void);
-// void func_800B9C34_jp();
-void mPr_SendForeingerAnimalMail(PrivateInfo* privateInfo);
+s32 mPr_NullCheckPlayerName(char* name);
+s32 mPr_CheckCmpPlayerName(char* name0, char* name1);
+s32 mPr_GetPlayerName(char* buf, s32 playerNumber);
+s32 mPr_NullCheckPersonalID(PersonalID_c* pid);
+void mPr_ClearPersonalID(PersonalID_c* pid);
+void mPr_ClearAnyPersonalID(PersonalID_c* pid, s32 count);
+void mPr_CopyPersonalID(PersonalID_c* dst, PersonalID_c* src);
+s32 mPr_CheckCmpPersonalID(PersonalID_c* pid0, PersonalID_c* pid1);
+void mPr_ClearPrivateBirthday(PrivateBirthday* birthday);
+void mPr_ClearAnimalMemory(PrivateAnimalMemory* memory);
+void mPr_ClearPrivateInfo(PrivateInfo* info);
+s32 mPr_GetRandomFace(void);
+s32 mPr_GetRandomOriginalFace(void);
+u16 mPr_GetRandomCloth(u8 sex);
+void mPr_SetNowPrivateCloth(void);
+void mPr_InitPrivateInfo(PrivateInfo* priv);
+void mPr_InitAnyPrivates(PrivateInfo* info, s32 amount);
+void mPr_CopyPrivateInfo(PrivateInfo* dst, PrivateInfo* src);
+s32 mPr_CheckPrivate(PrivateInfo* priv);
+s32 mPr_CheckCmpPrivate(PrivateInfo* priv0, PrivateInfo* priv1);
+s32 mPr_GetPrivateIdx(PersonalID_c* pid);
+s32 mPr_GetPossessionItemIdx(PrivateInfo* priv, u16 item);
+s32 mPr_GetPossessionItemIdxWithCond(PrivateInfo* priv, u16 item, u32 cond);
+s32 mPr_GetPossessionItemIdxFGTypeWithCond_cancel(PrivateInfo* priv, u16 fg_type, u32 cond);
+s32 mPr_GetPossessionItemIdxItem1Category(PrivateInfo* priv, u8 type);
+s32 mPr_GetPossessionItemIdxItem1CategoryWithCond_cancel(PrivateInfo* priv, u8 itemType, u32 cond);
+s32 mPr_GetPossessionItemIdxKindWithCond(PrivateInfo* priv, u16 kind_start, u16 kind_end, u32 cond);
+s32 mPr_GetPossessionItemSum(PrivateInfo* priv, u16 item);
+s32 mPr_GetPossessionItemSumWithCond(PrivateInfo* priv, u16 item, u32 cond);
+s32 mPr_GetPossessionItemSumFGTypeWithCond_cancel(PrivateInfo* priv, u16 fg_type, u32 cond);
+s32 mPr_GetPossessionItemSumItemCategoryWithCond_cancel(PrivateInfo* priv, u8 itemType, u32 cond);
+void mPr_SetItemCollectBit(u16 item);
+u16 mPr_DummyPresentToTruePresent(void);
+void mPr_SetPossessionItem(PrivateInfo* priv, s32 idx, u16 item, u32 cond);
+s32 mPr_SetFreePossessionItem(PrivateInfo* priv, u16 item, u32 cond);
+void mPr_AddFirstJobHint(PrivateInfo* priv);
+s32 mPr_GetFirstJobHintTime(PrivateInfo* priv);
+s32 mPr_CheckFirstJobHint(PrivateInfo* priv);
+s16 mPr_GetMoneyPower(void);
+s16 mPr_GetGoodsPower(void);
+s32 mPr_CheckMuseumAddress(PrivateInfo* priv);
+s32 mPr_CheckMuseumInfoMail(PrivateInfo* priv);
+s32 mPr_LoadPak_and_SetPrivateInfo2(u8 player, void* pak);
+void mPr_ClearMotherMailInfo(PrivateMotherMail* motherMail);
+s32 mPr_GetMotherMailPaperType(s32 month, s32 day);
+void mPr_GetMotherMail(Mail_c* mail, PersonalID_c* pid, u16 present, s32 stationery, s32 mailNumber);
+s32 mPr_SendMotherMailPost(PersonalID_c* pid, s32 playerNumber, u16 present, s32 stationery, s32 mailNumber);
+s32 mPr_SendMotherMailDate(PrivateMotherMail* motherMail, lbRTC_time_c* sendTime);
+s32 mPr_CheckMotherMailMonthly(PrivateMotherMailData* sendData, s32 month, s32 idx);
+s32 mPr_GetMotherMailMonthlyNotSendNum(PrivateMotherMailData* sendData, s32 month);
+void mPr_SetMotherMailMonthly(PrivateMotherMailData* sendData, s32 month, s32 idx);
+void mPr_GetMotherMailMonthlyData(PrivateMotherMailData* sendData, s32* mailNumber, u16* present,
+ s32* eventNumber, s32 month, s32 notSendNum);
+s32 mPr_GetMotherMailNormalNotSendNum(PrivateMotherMailData* sendData);
+void mPr_SetMotherMailNormal(PrivateMotherMailData* sendData, s32 idx);
+s32 mPr_CheckMotherMailNormal(PrivateMotherMailData* sendData, s32 idx);
+void mPr_GetMotherMailNormalData(PrivateMotherMailData* sendData, s32* mailNumber, u16* present, s32* eventNumber,
+ s32 noSendNum);
+void mPr_SendMotherMailNormal(PrivateMotherMail* motherMail, lbRTC_time_c* sendTime);
+void mPr_SendMotherMail(PrivateMotherMail* motherMail, lbRTC_time_c* sendTime);
+void mPr_SendMailFromMother(void);
+void mPr_GetForeingerAnimalMail(Mail_c* mail, PrivateInfo* priv, PrivateAnimalMemory* animalMemory);
+void mPr_SendForeingerAnimalMail(PrivateInfo* priv);
void mPr_StartSetCompleteTalkInfo(void);
-// void func_800B9E90_jp();
-// void func_800B9EB4_jp();
-// void func_800B9ED4_jp();
-// void func_800B9F00_jp();
-// void func_800B9F74_jp();
-// void func_800B9FA0_jp();
-// void func_800BA014_jp();
-// void func_800BA054_jp();
-// void func_800BA09C_jp();
-// void func_800BA0E4_jp();
-// void func_800BA130_jp();
-// void func_800BA150_jp();
-// void func_800BA18C_jp();
-// void func_800BA214_jp();
-// void func_800BA2B0_jp();
-// void func_800BA2D4_jp();
-// void func_800BA344_jp();
-// void func_800BA3D0_jp();
-void mPr_RenewalMapInfo(mPr_map_info_c* maps, s32 count, struct LandInfo* landInfo);
-// void mPr_RandomSetPlayerData_title_demo();
-// void mPr_PrintMapInfo_debug();
+void mPr_SetCompleteTalk(u8* flags, s32 type);
+s32 mPr_GetCompleteTalk(u8 flags, s32 type);
+void mPr_SetFishCompleteTalk(void);
+s32 mPr_CheckFishCompleteTalk(u8 playerNumber);
+void mPr_SetInsectCompleteTalk(void);
+s32 mPr_CheckInsectCompleteTalk(u8 playerNumber);
+s32 mPr_GetTalkPermission(u8 flags, s32 type);
+s32 mPr_GetFishCompTalkPermission(void);
+s32 mPr_GetInsectCompTalkPermission(void);
+void mPr_ClearMapInfo(mPr_map_info_c* mapInfo, s32 max);
+void mPr_CopyMapInfo(mPr_map_info_c* dst, mPr_map_info_c* src);
+void mPr_SetMapThisLand(mPr_map_info_c* mapInfo);
+s32 mPr_GetMapFreeIdx(mPr_map_info_c* mapInfo, s32 max);
+s32 mPr_GetLandMapIdx(mPr_map_info_c* mapInfo, s32 max, LandInfo* landInfo);
+s32 mPr_GetThisLandMapIdx(mPr_map_info_c* map_info, s32 max);
+void mPr_PushMapInfo(mPr_map_info_c* map_info, s32 max);
+void mPr_SetNewMap(mPr_map_info_c* map_info, s32 max);
+void mPr_SetUseMap(mPr_map_info_c* map_info, s32 max);
+void mPr_RenewalMapInfo(mPr_map_info_c* mapInfo, s32 max, LandInfo* landInfo);
+void mPr_RandomSetPlayerData_title_demo(void);
+void mPr_PrintMapInfo_debug(gfxprint* gfxprint);
#endif
diff --git a/include/m_private_internals.h b/include/m_private_internals.h
index 2bdd1f2..a88c70d 100644
--- a/include/m_private_internals.h
+++ b/include/m_private_internals.h
@@ -3,11 +3,15 @@
#include "ultra64.h"
#include "m_land.h"
+#include "lb_rtc.h"
#define mPr_POCKETS_SLOT_COUNT 15
#define mPr_DELIVERY_QUEST_NUM mPr_POCKETS_SLOT_COUNT
#define mPr_ERRAND_QUEST_NUM 5
+#define mPr_MOTHER_MAIL_NORMAL_NUM 7
+#define mPr_MOTHER_MAIL_MONTHLY_NUM 2
+
#define PLAYER_NAME_LEN 6
typedef struct PersonalID_c {
@@ -17,27 +21,15 @@ typedef struct PersonalID_c {
/* 0x0E */ u16 landId;
} PersonalID_c; // size = 0x10
-typedef struct Private_Sub_A86 {
- /* 0x00 */ char unk00[0x3];
- /* 0x03 */ u8 unk_03;
- /* 0x04 */ char unk04[0x1];
- /* 0x05 */ u8 unk_05;
- /* 0x06 */ u16 unk_06;
- /* 0x08 */ u8 unk_08;
-} Private_Sub_A86; // size >= 0xA
-
typedef struct mPr_map_info_c {
- /* 0x00 */ char unk00[0x8];
+ /* 0x00 */ char landName[LAND_NAME_SIZE];
+ /* 0x06 */ u16 landId;
} mPr_map_info_c; // size = 0x8
-typedef struct PrivateMotherMail {
- /* 0x00 */ UNK_TYPE1 unk_00[0xE];
-} PrivateMotherMail; // size = 0xE
-
-typedef struct PrivateAnimalMemory{
+typedef struct PrivateAnimalMemory {
/* 0x00 */ u16 npcId;
/* 0x02 */ char landName[LAND_NAME_SIZE];
-}PrivateAnimalMemory; // size 0x8
+} PrivateAnimalMemory; // size 0x8
typedef struct PrivateInventory {
/* 0x00 */ u16 pockets[mPr_POCKETS_SLOT_COUNT]; /* items in inventory */
@@ -53,5 +45,27 @@ typedef struct PrivateCloth {
/* 0x02 */ u16 item;
} PrivateCloth; // size = 0x4
+typedef struct PrivateDestiny {
+ /* 0x00 */ lbRTC_time_c receivedTime; /* time fortune was received */
+ /* 0x08 */ u8 type; /* fortune type */
+} PrivateDestiny; // size = 0xA
+
+typedef struct PrivateMotherMailData {
+ /* 0x0 */ u8 normal[mPr_MOTHER_MAIL_NORMAL_NUM];
+ /* 0x7 */ u8 monthly[mPr_MOTHER_MAIL_MONTHLY_NUM];
+ /* 0x9 */ u8 august; // unique byte for month of august
+} PrivateMotherMailData; // size = 0xA
+
+typedef struct PrivateMotherMail {
+ /* 0x0 */ lbRTC_ymd_t date;
+ /* 0x8 */ PrivateMotherMailData data;
+} PrivateMotherMail; // size = 0xE
+
+typedef struct PrivateBirthday {
+ /* 0x0 */ u16 year;
+ /* 0x2 */ u8 month;
+ /* 0x3 */ u8 day;
+} PrivateBirthday; // size = 0x4
+
#endif
diff --git a/linker_scripts/jp/symbol_addrs_code.txt b/linker_scripts/jp/symbol_addrs_code.txt
index e17ecdc..d37c324 100644
--- a/linker_scripts/jp/symbol_addrs_code.txt
+++ b/linker_scripts/jp/symbol_addrs_code.txt
@@ -1465,7 +1465,7 @@ func_8008D12C_jp = 0x8008D12C; // type:func
func_8008D268_jp = 0x8008D268; // type:func
func_8008D3A4_jp = 0x8008D3A4; // type:func
func_8008D574_jp = 0x8008D574; // type:func
-func_8008D6E0_jp = 0x8008D6E0; // type:func
+mFI_GetOtherFruit = 0x8008D6E0; // type:func
func_8008D7B0_jp = 0x8008D7B0; // type:func
func_8008D884_jp = 0x8008D884; // type:func
mFI_GetWaveUtinBlock = 0x8008D928; // type:func
@@ -1652,8 +1652,8 @@ mHS_get_arrange_idx = 0x80094BF4; // type:func
func_80094C10_jp = 0x80094C10; // type:func
func_80094C44_jp = 0x80094C44; // type:func
func_80094CAC_jp = 0x80094CAC; // type:func
-func_80094DD0_jp = 0x80094DD0; // type:func
-func_80094E10_jp = 0x80094E10; // type:func
+mLd_NullCheckLandName = 0x80094DD0; // type:func
+mLd_CheckId = 0x80094E10; // type:func
mLd_CheckCmpLandName = 0x80094E38; // type:func
mLd_CheckCmpLand = 0x80094E90; // type:func
mLd_ClearLandName = 0x80094EE0; // type:func
@@ -1663,7 +1663,7 @@ func_80094F84_jp = 0x80094F84; // type:func
func_8009504C_jp = 0x8009504C; // type:func
mLd_GetLandName = 0x800950D8; // type:func
func_800950E8_jp = 0x800950E8; // type:func
-func_8009519C_jp = 0x8009519C; // type:func
+mLd_PlayerManKindCheckNo = 0x8009519C; // type:func
mLd_PlayerManKindCheck = 0x800951C0; // type:func
mLd_CheckThisLand = 0x800951E4; // type:func
func_80095218_jp = 0x80095218; // type:func
@@ -2184,7 +2184,7 @@ func_800A3304_jp = 0x800A3304; // type:func
func_800A332C_jp = 0x800A332C; // type:func
mMsg_Main = 0x800A339C; // type:func
mMsg_Draw = 0x800A33D8; // type:func
-func_800A3400_jp = 0x800A3400; // type:func
+mMsm_ClearRecord = 0x800A3400; // type:func
func_800A3420_jp = 0x800A3420; // type:func
func_800A345C_jp = 0x800A345C; // type:func
func_800A34E8_jp = 0x800A34E8; // type:func
@@ -2545,7 +2545,7 @@ func_800B1D68_jp = 0x800B1D68; // type:func
func_800B1D94_jp = 0x800B1D94; // type:func
func_800B1DE8_jp = 0x800B1DE8; // type:func
func_800B1E94_jp = 0x800B1E94; // type:func
-func_800B1EB0_jp = 0x800B1EB0; // type:func
+mPlib_change_player_cloth_info_lv2 = 0x800B1EB0; // type:func
func_800B1EDC_jp = 0x800B1EDC; // type:func
func_800B1F74_jp = 0x800B1F74; // type:func
func_800B1F84_jp = 0x800B1F84; // type:func
@@ -2714,85 +2714,85 @@ func_800B7700_jp = 0x800B7700; // type:func
mPr_ClearPlayerName = 0x800B7780; // type:func
mPr_CopyPlayerName = 0x800B77A4; // type:func
mPr_NullCheckPlayerName = 0x800B77C4; // type:func
-func_800B7804_jp = 0x800B7804; // type:func
-func_800B785C_jp = 0x800B785C; // type:func
+mPr_CheckCmpPlayerName = 0x800B7804; // type:func
+mPr_GetPlayerName = 0x800B785C; // type:func
mPr_NullCheckPersonalID = 0x800B7914; // type:func
mPr_ClearPersonalID = 0x800B795C; // type:func
-func_800B7998_jp = 0x800B7998; // type:func
+mPr_ClearAnyPersonalID = 0x800B7998; // type:func
mPr_CopyPersonalID = 0x800B79E0; // type:func
mPr_CheckCmpPersonalID = 0x800B7A00; // type:func
-func_800B7A94_jp = 0x800B7A94; // type:func
-func_800B7AB0_jp = 0x800B7AB0; // type:func
+mPr_ClearPrivateBirthday = 0x800B7A94; // type:func
+mPr_ClearAnimalMemory = 0x800B7AB0; // type:func
mPr_ClearPrivateInfo = 0x800B7ADC; // type:func
-func_800B7B8C_jp = 0x800B7B8C; // type:func
-func_800B7BC0_jp = 0x800B7BC0; // type:func
-func_800B7CD0_jp = 0x800B7CD0; // type:func
-func_800B7D50_jp = 0x800B7D50; // type:func
+mPr_GetRandomFace = 0x800B7B8C; // type:func
+mPr_GetRandomOriginalFace = 0x800B7BC0; // type:func
+mPr_GetRandomCloth = 0x800B7CD0; // type:func
+mPr_SetNowPrivateCloth = 0x800B7D50; // type:func
mPr_InitPrivateInfo = 0x800B7D90; // type:func
-func_800B7F00_jp = 0x800B7F00; // type:func
-func_800B7F48_jp = 0x800B7F48; // type:func
+mPr_InitAnyPrivates = 0x800B7F00; // type:func
+mPr_CopyPrivateInfo = 0x800B7F48; // type:func
mPr_CheckPrivate = 0x800B7F78; // type:func
-func_800B7FA0_jp = 0x800B7FA0; // type:func
+mPr_CheckCmpPrivate = 0x800B7FA0; // type:func
mPr_GetPrivateIdx = 0x800B7FD4; // type:func
-func_800B8068_jp = 0x800B8068; // type:func
-func_800B80B4_jp = 0x800B80B4; // type:func
-func_800B8128_jp = 0x800B8128; // type:func
-func_800B81A4_jp = 0x800B81A4; // type:func
-func_800B8204_jp = 0x800B8204; // type:func
-func_800B828C_jp = 0x800B828C; // type:func
-func_800B8318_jp = 0x800B8318; // type:func
-func_800B83D4_jp = 0x800B83D4; // type:func
-func_800B8544_jp = 0x800B8544; // type:func
-func_800B86EC_jp = 0x800B86EC; // type:func
-func_800B88EC_jp = 0x800B88EC; // type:func
-func_800B8A88_jp = 0x800B8A88; // type:func
+mPr_GetPossessionItemIdx = 0x800B8068; // type:func
+mPr_GetPossessionItemIdxWithCond = 0x800B80B4; // type:func
+mPr_GetPossessionItemIdxFGTypeWithCond_cancel = 0x800B8128; // type:func
+mPr_GetPossessionItemIdxItem1Category = 0x800B81A4; // type:func
+mPr_GetPossessionItemIdxItem1CategoryWithCond_cancel = 0x800B8204; // type:func
+mPr_GetPossessionItemIdxKindWithCond = 0x800B828C; // type:func
+mPr_GetPossessionItemSum = 0x800B8318; // type:func
+mPr_GetPossessionItemSumWithCond = 0x800B83D4; // type:func
+mPr_GetPossessionItemSumFGTypeWithCond_cancel = 0x800B8544; // type:func
+mPr_GetPossessionItemSumItemCategoryWithCond_cancel = 0x800B86EC; // type:func
+mPr_SetItemCollectBit = 0x800B88EC; // type:func
+mPr_DummyPresentToTruePresent = 0x800B8A88; // type:func
mPr_SetPossessionItem = 0x800B8B08; // type:func
-func_800B8B8C_jp = 0x800B8B8C; // type:func
-func_800B8BE4_jp = 0x800B8BE4; // type:func
-func_800B8C10_jp = 0x800B8C10; // type:func
-func_800B8C20_jp = 0x800B8C20; // type:func
-func_800B8C34_jp = 0x800B8C34; // type:func
-func_800B8C9C_jp = 0x800B8C9C; // type:func
-func_800B8D18_jp = 0x800B8D18; // type:func
-func_800B8D3C_jp = 0x800B8D3C; // type:func
-func_800B8D64_jp = 0x800B8D64; // type:func
+mPr_SetFreePossessionItem = 0x800B8B8C; // type:func
+mPr_AddFirstJobHint = 0x800B8BE4; // type:func
+mPr_GetFirstJobHintTime = 0x800B8C10; // type:func
+mPr_CheckFirstJobHint = 0x800B8C20; // type:func
+mPr_GetMoneyPower = 0x800B8C34; // type:func
+mPr_GetGoodsPower = 0x800B8C9C; // type:func
+mPr_CheckMuseumAddress = 0x800B8D18; // type:func
+mPr_CheckMuseumInfoMail = 0x800B8D3C; // type:func
+mPr_LoadPak_and_SetPrivateInfo2 = 0x800B8D64; // type:func
mPr_ClearMotherMailInfo = 0x800B8EE4; // type:func
-func_800B8F20_jp = 0x800B8F20; // type:func
-func_800B8FB8_jp = 0x800B8FB8; // type:func
-func_800B9038_jp = 0x800B9038; // type:func
-func_800B9170_jp = 0x800B9170; // type:func
-func_800B9350_jp = 0x800B9350; // type:func
-func_800B93AC_jp = 0x800B93AC; // type:func
-func_800B947C_jp = 0x800B947C; // type:func
-func_800B94E0_jp = 0x800B94E0; // type:func
-func_800B9704_jp = 0x800B9704; // type:func
-func_800B9790_jp = 0x800B9790; // type:func
-func_800B97C8_jp = 0x800B97C8; // type:func
-func_800B97F8_jp = 0x800B97F8; // type:func
-func_800B996C_jp = 0x800B996C; // type:func
-func_800B9AF0_jp = 0x800B9AF0; // type:func
-func_800B9B2C_jp = 0x800B9B2C; // type:func
-func_800B9C34_jp = 0x800B9C34; // type:func
+mPr_GetMotherMailPaperType = 0x800B8F20; // type:func
+mPr_GetMotherMail = 0x800B8FB8; // type:func
+mPr_SendMotherMailPost = 0x800B9038; // type:func
+mPr_SendMotherMailDate = 0x800B9170; // type:func
+mPr_CheckMotherMailMonthly = 0x800B9350; // type:func
+mPr_GetMotherMailMonthlyNotSendNum = 0x800B93AC; // type:func
+mPr_SetMotherMailMonthly = 0x800B947C; // type:func
+mPr_GetMotherMailMonthlyData = 0x800B94E0; // type:func
+mPr_GetMotherMailNormalNotSendNum = 0x800B9704; // type:func
+mPr_SetMotherMailNormal = 0x800B9790; // type:func
+mPr_CheckMotherMailNormal = 0x800B97C8; // type:func
+mPr_GetMotherMailNormalData = 0x800B97F8; // type:func
+mPr_SendMotherMailNormal = 0x800B996C; // type:func
+mPr_SendMotherMail = 0x800B9AF0; // type:func
+mPr_SendMailFromMother = 0x800B9B2C; // type:func
+mPr_GetForeingerAnimalMail = 0x800B9C34; // type:func
mPr_SendForeingerAnimalMail = 0x800B9DAC; // type:func
mPr_StartSetCompleteTalkInfo = 0x800B9E44; // type:func
-func_800B9E90_jp = 0x800B9E90; // type:func
-func_800B9EB4_jp = 0x800B9EB4; // type:func
-func_800B9ED4_jp = 0x800B9ED4; // type:func
-func_800B9F00_jp = 0x800B9F00; // type:func
-func_800B9F74_jp = 0x800B9F74; // type:func
-func_800B9FA0_jp = 0x800B9FA0; // type:func
-func_800BA014_jp = 0x800BA014; // type:func
-func_800BA054_jp = 0x800BA054; // type:func
-func_800BA09C_jp = 0x800BA09C; // type:func
-func_800BA0E4_jp = 0x800BA0E4; // type:func
-func_800BA130_jp = 0x800BA130; // type:func
-func_800BA150_jp = 0x800BA150; // type:func
-func_800BA18C_jp = 0x800BA18C; // type:func
-func_800BA214_jp = 0x800BA214; // type:func
-func_800BA2B0_jp = 0x800BA2B0; // type:func
-func_800BA2D4_jp = 0x800BA2D4; // type:func
-func_800BA344_jp = 0x800BA344; // type:func
-func_800BA3D0_jp = 0x800BA3D0; // type:func
+mPr_SetCompleteTalk = 0x800B9E90; // type:func
+mPr_GetCompleteTalk = 0x800B9EB4; // type:func
+mPr_SetFishCompleteTalk = 0x800B9ED4; // type:func
+mPr_CheckFishCompleteTalk = 0x800B9F00; // type:func
+mPr_SetInsectCompleteTalk = 0x800B9F74; // type:func
+mPr_CheckInsectCompleteTalk = 0x800B9FA0; // type:func
+mPr_GetTalkPermission = 0x800BA014; // type:func
+mPr_GetFishCompTalkPermission = 0x800BA054; // type:func
+mPr_GetInsectCompTalkPermission = 0x800BA09C; // type:func
+mPr_ClearMapInfo = 0x800BA0E4; // type:func
+mPr_CopyMapInfo = 0x800BA130; // type:func
+mPr_SetMapThisLand = 0x800BA150; // type:func
+mPr_GetMapFreeIdx = 0x800BA18C; // type:func
+mPr_GetLandMapIdx = 0x800BA214; // type:func
+mPr_GetThisLandMapIdx = 0x800BA2B0; // type:func
+mPr_PushMapInfo = 0x800BA2D4; // type:func
+mPr_SetNewMap = 0x800BA344; // type:func
+mPr_SetUseMap = 0x800BA3D0; // type:func
mPr_RenewalMapInfo = 0x800BA404; // type:func
mPr_RandomSetPlayerData_title_demo = 0x800BA494; // type:func
mPr_PrintMapInfo_debug = 0x800BA50C; // type:func
@@ -2926,7 +2926,7 @@ func_800BED5C_jp = 0x800BED5C; // type:func
func_800BEE50_jp = 0x800BEE50; // type:func
func_800BEEB4_jp = 0x800BEEB4; // type:func
func_800BEEC4_jp = 0x800BEEC4; // type:func
-func_800BEFCC_jp = 0x800BEFCC; // type:func
+mRmTp_Item1ItemNo2FtrItemNo_AtPlayerRoom = 0x800BEFCC; // type:func
func_800BF10C_jp = 0x800BF10C; // type:func
func_800BF230_jp = 0x800BF230; // type:func
func_800BF26C_jp = 0x800BF26C; // type:func
@@ -3181,7 +3181,7 @@ func_800CA230_jp = 0x800CA230; // type:func
func_800CA240_jp = 0x800CA240; // type:func
func_800CA278_jp = 0x800CA278; // type:func
func_800CA2A8_jp = 0x800CA2A8; // type:func
-func_800CA2BC_jp = 0x800CA2BC; // type:func
+mTM_set_renew_time = 0x800CA2BC; // type:func
mTM_renewal_renew_time = 0x800CA2DC; // type:func
func_800CA350_jp = 0x800CA350; // type:func
func_800CA570_jp = 0x800CA570; // type:func
@@ -6124,8 +6124,8 @@ Player_actor_draw_func = 0x8014390C; //
B_80143910_jp = 0x80143910; //
B_80143960_jp = 0x80143960; // type:s8
B_8014399C_jp = 0x8014399C; // type:s16
-B_801439A0_jp = 0x801439A0; //
-B_80144570_jp = 0x80144570; //
+g_foreigner_private = 0x801439A0; //
+l_mpr_mail = 0x80144570; // size = 0xA4
B_80144620_jp = 0x80144620; // type:s16
B_80144624_jp = 0x80144624; //
B_80144628_jp = 0x80144628; //
diff --git a/src/code/m_field_info.c b/src/code/m_field_info.c
index ec2873c..6284156 100644
--- a/src/code/m_field_info.c
+++ b/src/code/m_field_info.c
@@ -343,7 +343,7 @@
#pragma GLOBAL_ASM("asm/jp/nonmatchings/code/m_field_info/func_8008D574_jp.s")
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/code/m_field_info/func_8008D6E0_jp.s")
+#pragma GLOBAL_ASM("asm/jp/nonmatchings/code/m_field_info/mFI_GetOtherFruit.s")
#pragma GLOBAL_ASM("asm/jp/nonmatchings/code/m_field_info/func_8008D7B0_jp.s")
diff --git a/src/code/m_mail.c b/src/code/m_mail.c
index d967753..540fd6c 100644
--- a/src/code/m_mail.c
+++ b/src/code/m_mail.c
@@ -94,8 +94,8 @@ void mMl_set_to_name(Mail_c* arg0, Mail_c* arg1) {
mMl_copy_header_name(&arg0->header.recipient, &arg1->header.recipient);
}
-void mMl_set_to_plname(Mail_c* arg0, Mail_c* arg1) {
- mPr_CopyPersonalID(&arg0->header.recipient.personalID, &arg1->header.recipient.personalID);
+void mMl_set_to_plname(Mail_c* arg0, PersonalID_c* arg1) {
+ mPr_CopyPersonalID(&arg0->header.recipient.personalID, arg1);
arg0->header.recipient.type = 0;
}
diff --git a/src/code/m_private.c b/src/code/m_private.c
new file mode 100644
index 0000000..b799f9a
--- /dev/null
+++ b/src/code/m_private.c
@@ -0,0 +1,1397 @@
+#include "m_private.h"
+#include "m_lib.h"
+#include "m_land.h"
+#include "m_name_table.h"
+#include "m_time.h"
+#include "m_player_lib.h"
+#include "6E2300.h"
+#include "m_field_info.h"
+#include "6E30B0.h"
+#include "69CB30.h"
+#include "m_handbill.h"
+#include "m_house.h"
+#include "6DA460.h"
+#include "6EDD10.h"
+
+PrivateInfo g_foreigner_private;
+Mail_c l_mpr_mail;
+
+void mPr_ClearPlayerName(char* buf) {
+ mem_clear((u8*)buf, PLAYER_NAME_LEN, ' ');
+}
+
+void mPr_CopyPlayerName(char* dst, char* src) {
+ mem_copy((u8*)dst, (u8*)src, PLAYER_NAME_LEN);
+}
+
+s32 mPr_NullCheckPlayerName(char* name) {
+ s32 res = FALSE;
+ s32 i;
+
+ for (i = 0; i < PLAYER_NAME_LEN; i++) {
+ if (name[0] != ' ') {
+ break;
+ }
+ name++;
+ }
+
+ if (i == PLAYER_NAME_LEN) {
+ res = TRUE;
+ }
+
+ return res;
+}
+
+s32 mPr_CheckCmpPlayerName(char* name0, char* name1) {
+ s32 res = FALSE;
+
+ if (mPr_NullCheckPlayerName(name0) == FALSE && mPr_NullCheckPlayerName(name1) == FALSE) {
+ res = mem_cmp((u8*)name0, (u8*)name1, PLAYER_NAME_LEN);
+ }
+
+ return res;
+}
+
+s32 mPr_GetPlayerName(char* buf, s32 playerNumber) {
+ char* name;
+ s32 res = FALSE;
+
+ if (mLd_PlayerManKindCheckNo(playerNumber) == FALSE) {
+ if (mPr_NullCheckPersonalID(&common_data.saveFilePrivateInfo[playerNumber].playerId) == FALSE) {
+ mPr_CopyPlayerName(buf, common_data.saveFilePrivateInfo[playerNumber].playerId.playerName);
+ res = TRUE;
+ }
+ } else if (mLd_PlayerManKindCheckNo(common_data.playerNumber) == TRUE) {
+
+ name = (common_data.privateInfo)->playerId.playerName;
+ mPr_CopyPlayerName(buf, name);
+ res = TRUE;
+ }
+
+ return res;
+}
+
+s32 mPr_NullCheckPersonalID(PersonalID_c* pid) {
+ s32 res = FALSE;
+
+ if (pid->landId == 0xFFFF && mPr_NullCheckPlayerName(pid->playerName) == TRUE) {
+ res = TRUE;
+ }
+
+ return res;
+}
+
+void mPr_ClearPersonalID(PersonalID_c* pid) {
+ mPr_ClearPlayerName(pid->playerName);
+ mLd_ClearLandName(pid->landName);
+ pid->landId = 0xFFFF;
+ pid->playerId = 0xFFFF;
+}
+
+void mPr_ClearAnyPersonalID(PersonalID_c* pid, s32 count) {
+ for (; count != 0; count--) {
+ mPr_ClearPersonalID(pid);
+ pid++;
+ }
+}
+
+void mPr_CopyPersonalID(PersonalID_c* dst, PersonalID_c* src) {
+ mem_copy((u8*)dst, (u8*)src, sizeof(PersonalID_c));
+}
+
+s32 mPr_CheckCmpPersonalID(PersonalID_c* pid0, PersonalID_c* pid1) {
+ s32 res = FALSE;
+
+ if (pid0->landId == pid1->landId && pid0->playerId == pid1->playerId &&
+ mLd_CheckCmpLandName(pid0->landName, pid1->landName) == TRUE &&
+ mPr_CheckCmpPlayerName(pid0->playerName, pid1->playerName) == TRUE) {
+ res = TRUE;
+ }
+
+ return res;
+}
+
+void mPr_ClearPrivateBirthday(PrivateBirthday* birthday) {
+ birthday->year = 0xFFFF;
+ birthday->month = 0xFF;
+ birthday->day = 0xFF;
+}
+
+void mPr_ClearAnimalMemory(PrivateAnimalMemory* memory) {
+ memory->npcId = 0xFFFF;
+ mLd_ClearLandName(memory->landName);
+}
+
+void mPr_ClearPrivateInfo(PrivateInfo* info) {
+ bzero(info, sizeof(PrivateInfo));
+
+ mPr_ClearPersonalID(&info->playerId);
+ info->gender = mPr_SEX_MALE;
+ mQst_ClearDelivery(info->deliveries, mPr_DELIVERY_QUEST_NUM);
+ mQst_ClearErrand(info->errands, mPr_ERRAND_QUEST_NUM);
+ mMl_clear_mail_box(info->mail, mPr_INVENTORY_MAIL_COUNT);
+ mMl_clear_mail_header_common(&info->savedMailHeader);
+ mPlib_change_player_cloth_info_lv2(info, 0x2401);
+ mNpc_ClearAnimalPersonalID(&info->storedAnmId);
+ mPr_ClearPrivateBirthday(&info->birthday);
+ info->backgroundTextureId = 0x24E2;
+ mNpc_ClearRemail(&info->remail);
+ mPr_ClearAnimalMemory(&info->animalMemory);
+ mPr_ClearMapInfo(info->maps, mPr_FOREIGN_MAP_COUNT);
+ mMsm_ClearRecord(&info->museumRecord);
+}
+
+s32 mPr_GetRandomFace() {
+ return fqrand() * (f32)mPr_FACE_TYPE_NUM;
+}
+
+s32 mPr_GetRandomOriginalFace() {
+ PrivateInfo* priv = common_data.saveFilePrivateInfo;
+ PrivateInfo* pr2;
+ s32 j;
+ PrivateInfo* pr = priv;
+ s32 playerExist = 0;
+ s32 face;
+ s32 i;
+
+ for (i = 0; i < PLAYER_NUM; i++) {
+ if (pr != NULL && mPr_NullCheckPersonalID(&pr->playerId) == FALSE) {
+ playerExist++;
+ }
+ pr++;
+ }
+
+ face = RANDOM(mPr_FACE_TYPE_NUM - playerExist);
+ for (; playerExist > 0; playerExist--) {
+ pr2 = priv;
+ for (j = 0; j < PLAYER_NUM; j++) {
+ if (pr2 != NULL && mPr_NullCheckPersonalID(&pr2->playerId) == FALSE && pr2->face == face) {
+ face++;
+
+ if (face >= mPr_FACE_TYPE_NUM) {
+ face = mPr_FACE_TYPE0;
+ }
+ break;
+ }
+
+ pr2++;
+ }
+ }
+
+ return face;
+}
+
+u16 mPr_boy_cloth_table[8] = {
+ 0x2400, 0x2401, 0x2402, 0x2403, 0x2404, 0x2405, 0x2406, 0x2407,
+};
+u16 mPr_girl_cloth_table[8] = {
+ 0x2408, 0x2409, 0x240A, 0x240B, 0x240C, 0x240D, 0x240E, 0x240F,
+};
+
+u16 mPr_GetRandomCloth(u8 sex) {
+ static u16* cloth_table[mPr_SEX_NUM] = { mPr_boy_cloth_table, mPr_girl_cloth_table };
+ static s32 cloth_max[mPr_SEX_NUM] = { 8, 8 };
+
+ u16* table;
+ s32 idx;
+ u16 temp;
+
+ temp = mPr_SEX_NUM;
+ if (sex >= temp) {
+ sex = mPr_SEX_MALE;
+ }
+
+ table = cloth_table[sex];
+ idx = RANDOM_F2(cloth_max[sex]);
+ temp = table[idx];
+ return temp;
+}
+
+void mPr_SetNowPrivateCloth() {
+ PrivateInfo* priv = common_data.privateInfo;
+
+ if (priv != NULL) {
+ mPlib_change_player_cloth_info_lv2(priv, mPr_GetRandomCloth(priv->gender));
+ }
+}
+
+void mPr_InitPrivateInfo(PrivateInfo* priv) {
+ PrivateInfo* ogPriv;
+ u16 pid;
+ s32 i;
+ s32 face;
+ s32 exists;
+
+ exists = FALSE;
+ face = mPr_GetRandomOriginalFace();
+
+ priv->playerId.landId = common_data.landInfo.id;
+ mLd_CopyLandName(priv->playerId.landName, common_data.landInfo.name);
+
+ pid = RANDOM_F(253);
+ ogPriv = common_data.saveFilePrivateInfo;
+
+ for (i = 0; i < PLAYER_NUM - 1; i++, exists = FALSE) {
+ s32 j;
+ for (j = 0; j < PLAYER_NUM; j++) {
+
+ if (pid == ogPriv[j].playerId.playerId) {
+ pid = pid + 1;
+ exists = TRUE;
+ break;
+ }
+ }
+
+ if (exists == FALSE) {
+ break;
+ }
+ }
+
+ priv->playerId.playerId = 0xF000 | pid;
+ priv->exists = TRUE;
+ mPlib_change_player_cloth_info_lv2(priv, mPr_GetRandomCloth(mPr_SEX_MALE));
+ priv->gender = mPr_SEX_MALE;
+ priv->inventory.loan = 100;
+ priv->face = face;
+}
+
+void mPr_InitAnyPrivates(PrivateInfo* info, s32 amount) {
+
+ for (; amount != 0; amount--, info++) {
+ mPr_InitPrivateInfo(info);
+ }
+}
+
+void mPr_CopyPrivateInfo(PrivateInfo* dst, PrivateInfo* src) {
+ bcopy(src, dst, sizeof(PrivateInfo));
+}
+
+s32 mPr_CheckPrivate(PrivateInfo* priv) {
+ s32 res = FALSE;
+
+ if (mLd_CHECK_LAND_ID(priv->playerId.landId)) {
+ res = TRUE;
+ }
+
+ return res;
+}
+
+s32 mPr_CheckCmpPrivate(PrivateInfo* priv0, PrivateInfo* priv1) {
+ s32 res = FALSE;
+
+ if (mPr_CheckCmpPersonalID(&priv0->playerId, &priv1->playerId) == TRUE) {
+ res = TRUE;
+ }
+
+ return res;
+}
+
+s32 mPr_GetPrivateIdx(PersonalID_c* pid) {
+ PrivateInfo* priv = common_data.saveFilePrivateInfo;
+ s32 res = -1;
+ s32 i;
+
+ for (i = 0; i < PLAYER_NUM; i++) {
+ if ((mPr_NullCheckPersonalID(pid) == FALSE) && (mPr_CheckCmpPersonalID(pid, &priv->playerId) == TRUE)) {
+ res = i;
+ break;
+ }
+
+ priv++;
+ }
+
+ return res;
+}
+
+s32 mPr_GetPossessionItemIdx(PrivateInfo* priv, u16 item) {
+ s32 idx = -1;
+
+ if (priv != NULL) {
+ u16* pockets = priv->inventory.pockets;
+ s32 i;
+
+ for (i = 0; i < mPr_POCKETS_SLOT_COUNT; i++) {
+ if (*pockets == item) {
+ idx = i;
+ break;
+ }
+
+ pockets++;
+ }
+ }
+
+ return idx;
+}
+
+s32 mPr_GetPossessionItemIdxWithCond(PrivateInfo* priv, u16 item, u32 cond) {
+ s32 idx = -1;
+
+ if (priv != NULL) {
+ u16* pockets = priv->inventory.pockets;
+ s32 i;
+
+ for (i = 0; i < mPr_POCKETS_SLOT_COUNT; i++) {
+ if (*pockets == item && cond == mPr_GET_ITEM_COND(priv->inventory.item_conditions, i)) {
+ idx = i;
+ break;
+ }
+
+ pockets++;
+ }
+ }
+
+ return idx;
+}
+
+s32 mPr_GetPossessionItemIdxFGTypeWithCond_cancel(PrivateInfo* priv, u16 fg_type, u32 cond) {
+ s32 idx = -1;
+
+ if (priv != NULL) {
+ u16* pockets = priv->inventory.pockets;
+ s32 i;
+
+ for (i = 0; i < mPr_POCKETS_SLOT_COUNT; i++) {
+ if (ACTOR_FGNAME_GET_F000(*pockets) == fg_type &&
+ cond == mPr_GET_ITEM_COND(priv->inventory.item_conditions, i)) {
+ idx = i;
+ break;
+ }
+
+ pockets++;
+ }
+ }
+
+ return idx;
+}
+
+s32 mPr_GetPossessionItemIdxItem1Category(PrivateInfo* priv, u8 type) {
+ s32 idx = -1;
+
+ if (priv != NULL) {
+ u16* pockets = priv->inventory.pockets;
+ s32 i;
+
+ for (i = 0; i < mPr_POCKETS_SLOT_COUNT; i++) {
+ if (ACTOR_FGNAME_GET_F000(*pockets) == 2 && GET_NAME_ITEM_CATEGORY(*pockets) == type) {
+ idx = i;
+ break;
+ }
+ pockets++;
+ }
+ }
+
+ return idx;
+}
+
+s32 mPr_GetPossessionItemIdxItem1CategoryWithCond_cancel(PrivateInfo* priv, u8 itemType, u32 cond) {
+ s32 idx = -1;
+
+ if (priv != NULL) {
+ u16* pockets = priv->inventory.pockets;
+ s32 i;
+
+ for (i = 0; i < mPr_POCKETS_SLOT_COUNT; i++) {
+ if (ACTOR_FGNAME_GET_F000(*pockets) == 2 && GET_NAME_ITEM_CATEGORY(*pockets) == itemType &&
+ cond == mPr_GET_ITEM_COND(priv->inventory.item_conditions, i)) {
+ idx = i;
+ break;
+ }
+ pockets++;
+ }
+ }
+
+ return idx;
+}
+s32 mPr_GetPossessionItemIdxKindWithCond(PrivateInfo* priv, u16 kind_start, u16 kind_end, u32 cond) {
+ s32 idx = -1;
+
+ if (priv != NULL) {
+ u16* pockets = priv->inventory.pockets;
+ s32 i;
+
+ for (i = 0; i < mPr_POCKETS_SLOT_COUNT; i++) {
+ if (*pockets >= kind_start && *pockets < kind_end &&
+ cond == mPr_GET_ITEM_COND(priv->inventory.item_conditions, i)) {
+ idx = i;
+ break;
+ }
+ pockets++;
+ }
+ }
+
+ return idx;
+}
+
+s32 mPr_GetPossessionItemSum(PrivateInfo* priv, u16 item) {
+ s32 sum = 0;
+
+ if (priv != NULL) {
+ u16* pockets = priv->inventory.pockets;
+ s32 i;
+
+ for (i = 0; i < mPr_POCKETS_SLOT_COUNT; i++) {
+ if (*pockets == item) {
+ sum++;
+ }
+ pockets++;
+ }
+ }
+
+ return sum;
+}
+
+s32 mPr_GetPossessionItemSumWithCond(PrivateInfo* priv, u16 item, u32 cond) {
+ s32 sum = 0;
+
+ if (priv != NULL) {
+ u16* pockets = priv->inventory.pockets;
+ s32 i;
+
+ for (i = 0; i < mPr_POCKETS_SLOT_COUNT; i++) {
+ if (*pockets == item && cond == mPr_GET_ITEM_COND(priv->inventory.item_conditions, i)) {
+ sum++;
+ }
+ pockets++;
+ }
+ }
+
+ return sum;
+}
+
+s32 mPr_GetPossessionItemSumFGTypeWithCond_cancel(PrivateInfo* priv, u16 fg_type, u32 cond) {
+ s32 sum = 0;
+
+ if (priv != NULL) {
+ u16* pockets = priv->inventory.pockets;
+ s32 i;
+
+ for (i = 0; i < mPr_POCKETS_SLOT_COUNT; i++) {
+ if (ACTOR_FGNAME_GET_F000(*pockets) == fg_type &&
+ cond == mPr_GET_ITEM_COND(priv->inventory.item_conditions, i)) {
+ sum++;
+ }
+ pockets++;
+ }
+ }
+
+ return sum;
+}
+
+s32 mPr_GetPossessionItemSumItemCategoryWithCond_cancel(PrivateInfo* priv, u8 itemType, u32 cond) {
+ s32 sum = 0;
+
+ if (priv != NULL) {
+ u16* pockets = priv->inventory.pockets;
+ s32 i;
+
+ for (i = 0; i < mPr_POCKETS_SLOT_COUNT; i++) {
+ if (ACTOR_FGNAME_GET_F000(*pockets) == 2 && GET_NAME_ITEM_CATEGORY(*pockets) == itemType &&
+ cond == mPr_GET_ITEM_COND(priv->inventory.item_conditions, i)) {
+ sum++;
+ }
+ pockets++;
+ }
+ }
+
+ return sum;
+}
+
+void mPr_SetItemCollectBit(u16 item) {
+ u16 furnitureItemNumber = mRmTp_Item1ItemNo2FtrItemNo_AtPlayerRoom(item);
+ s32 item_type;
+
+ if ((furnitureItemNumber >= 0x1C28 && furnitureItemNumber < 0x1CA8) ||
+ (furnitureItemNumber >= 0x1BA8 && furnitureItemNumber < 0x1C28)) {
+ return;
+ }
+
+ item_type = ACTOR_FGNAME_GET_F000(furnitureItemNumber);
+
+ if (item_type == 1) {
+
+ common_data.privateInfo->catalogFurniture[(furnitureItemNumber - 0x1000) >> 2 >> 5] |=
+ (1 << ((furnitureItemNumber - 0x1000) >> 2 & 31));
+
+ } else if (item_type == 2) {
+ s32 category = GET_NAME_ITEM_CATEGORY(furnitureItemNumber);
+ u16 idx;
+ if (category == 0) {
+ idx = (furnitureItemNumber - 0x2000);
+ common_data.privateInfo->catalogPaper[idx >> 5] |= (1 << (idx & 31));
+ } else if (category == 6) {
+ idx = furnitureItemNumber - 0x2600;
+ common_data.privateInfo->catalogCarpet[idx >> 5] |= (1 << (idx & 31));
+ } else if (category == 7) {
+ idx = furnitureItemNumber - 0x2700;
+ common_data.privateInfo->catalogWallpaper[idx >> 5] |= (1 << (idx & 31));
+ } else if (category == 10) {
+ idx = furnitureItemNumber - 0x2A00;
+ common_data.privateInfo->catalogMusic[idx >> 5] |= (1 << (idx & 31));
+ }
+ }
+}
+u16 mPr_DummyPresentToTruePresent() {
+ u16 truePresent = 0;
+
+ if (RANDOM(5) != 0) {
+ mSP_SelectRandomItem_New(NULL, &truePresent, 1, NULL, 0, 0, 2);
+ }
+
+ if (truePresent == 0) {
+ truePresent = mFI_GetOtherFruit();
+ }
+
+ return truePresent;
+}
+
+void mPr_SetPossessionItem(PrivateInfo* priv, s32 idx, u16 item, u32 cond) {
+
+ if (item == 0x251C) {
+ item = mPr_DummyPresentToTruePresent();
+ cond = mPr_ITEM_COND_PRESENT;
+ }
+
+ // FAKEMATCH!!
+ priv->inventory.pockets[idx & 0xFFFFFFFF] = item;
+ priv->inventory.item_conditions = ((priv->inventory.item_conditions & (~(3 << (idx * 2)))) | (cond << (idx * 2)));
+
+ if (cond == mPr_ITEM_COND_NORMAL) {
+ mPr_SetItemCollectBit(item);
+ }
+}
+
+s32 mPr_SetFreePossessionItem(PrivateInfo* priv, u16 item, u32 cond) {
+ s32 idx = mPr_GetPossessionItemIdx(priv, 0);
+
+ if (idx == -1) {
+ return 0;
+ } else {
+ mPr_SetPossessionItem(priv, idx, item, cond);
+ return 1;
+ }
+}
+
+void mPr_AddFirstJobHint(PrivateInfo* priv) {
+ u8 hints = priv->hintCount + 1;
+ if ((hints & 0x7F) >= 10) {
+ hints = 0x80;
+ }
+
+ priv->hintCount = hints;
+}
+
+s32 mPr_GetFirstJobHintTime(PrivateInfo* priv) {
+ s32 hints = priv->hintCount & 0x7F;
+ return hints;
+}
+
+s32 mPr_CheckFirstJobHint(PrivateInfo* priv) {
+ s32 hints = (priv->hintCount >> 7) & 1;
+
+ return hints;
+}
+
+s16 mPr_GetMoneyPower() {
+ s16 moneyPower = common_data.moneyPower;
+ PrivateInfo* priv = common_data.privateInfo;
+
+ if (priv != NULL) {
+ switch (priv->destiny.type) {
+ case 4: {
+ moneyPower += 100;
+ break;
+ }
+
+ case 3: {
+ moneyPower -= 50;
+ break;
+ }
+ }
+ }
+
+ if (moneyPower < -80) {
+ moneyPower = -80;
+ }
+
+ return moneyPower;
+}
+
+s16 mPr_GetGoodsPower() {
+ s16 goodsPower = common_data.goodsPower;
+ s32 type = common_data.privateInfo->destiny.type;
+
+ if (common_data.privateInfo != NULL) {
+ type = common_data.privateInfo->destiny.type;
+
+ switch (type) {
+ case 5: {
+ goodsPower += 30;
+ break;
+ }
+
+ case 3: {
+ goodsPower -= 30;
+ break;
+ }
+ }
+ }
+ if (goodsPower > 50) {
+ goodsPower = 50;
+ } else if (goodsPower < -30) {
+ goodsPower = -30;
+ }
+ return goodsPower;
+}
+
+s32 mPr_CheckMuseumAddress(PrivateInfo* priv) {
+ s32 res = FALSE;
+
+ if (priv != NULL && priv->museumRecord.contacted) {
+ res = TRUE;
+ }
+
+ return res;
+}
+
+s32 mPr_CheckMuseumInfoMail(PrivateInfo* priv) {
+ s32 res = FALSE;
+
+ if (priv != NULL && priv->museumRecord.sendInfoMail) {
+ res = TRUE;
+ }
+
+ return res;
+}
+
+s32 mPr_LoadPak_and_SetPrivateInfo2(u8 player, void* pak) {
+ PrivateInfo* priv;
+ s32 res = FALSE;
+ s32 save = func_8007942C_jp(&g_foreigner_private, mNpc_GetInAnimalP(), pak);
+
+ if (save == TRUE) {
+ if (player < 4) {
+ priv = &common_data.saveFilePrivateInfo[player];
+ if (mPr_CheckCmpPrivate(priv, &g_foreigner_private) == TRUE) {
+ mPr_CopyPrivateInfo(priv, &g_foreigner_private);
+ common_data.privateInfo = priv;
+ common_data.playerNumber = player;
+ res = TRUE;
+ }
+ } else {
+ s32 i;
+ s32 exists;
+ priv = common_data.saveFilePrivateInfo;
+
+ for (i = 0; i < PLAYER_NUM; i++, priv++) {
+ exists = mPr_CheckCmpPrivate(priv, &g_foreigner_private);
+ if (exists == TRUE) {
+ g_foreigner_private.museumRecord.contacted = priv->museumRecord.contacted;
+ mPr_CopyPrivateInfo(priv, &g_foreigner_private);
+ common_data.privateInfo = priv;
+ common_data.playerNumber = i;
+ res = TRUE;
+ break;
+ }
+ }
+ if (exists == FALSE) {
+ common_data.privateInfo = &g_foreigner_private;
+ common_data.playerNumber = mPR_FOREIGNER_NUMBER;
+ res = TRUE;
+ }
+ }
+ }
+ return res;
+}
+
+void mPr_ClearMotherMailInfo(PrivateMotherMail* motherMail) {
+ motherMail->date = mTM_rtcTime_ymd_clear_code;
+ bzero(&motherMail->data, sizeof(PrivateMotherMailData));
+}
+
+s32 mPr_GetMotherMailPaperType(s32 month, s32 day) {
+ static u8 paper_table[lbRTC_MONTHS_MAX] = { 13, 49, 32, 12, 62, 14, 19, 11, 59, 46, 47, 17 };
+
+ PrivateBirthday* birthday = &common_data.privateInfo->birthday;
+ s32 paper;
+
+ if (birthday->month == month && birthday->day == day) {
+ paper = 1;
+ } else if (month == lbRTC_JANUARY && day == 1) {
+ paper = 63;
+ } else if (month == lbRTC_AUGUST && day == 8) {
+ paper = 48;
+ } else if (month == lbRTC_DECEMBER && day == 24) {
+ paper = 23;
+ } else {
+ month--;
+ paper = paper_table[month];
+ }
+
+ return paper - 1;
+}
+
+void mPr_GetMotherMail(Mail_c* mail, PersonalID_c* pid, u16 present, s32 stationery, s32 mailNumber) {
+ s32 headerBackPos;
+
+ mMl_clear_mail(mail);
+ mHandbill_Load_HandbillFromRom(mail->content.header, &headerBackPos, mail->content.footer, mail->content.body,
+ mailNumber);
+ mail->content.headerBackStart = headerBackPos;
+ mail->content.font = 0;
+ mail->content.mailType = 4;
+ mMl_set_to_plname(mail, pid);
+ mail->present = present;
+ mail->content.paperType = stationery;
+}
+
+s32 mPr_SendMotherMailPost(PersonalID_c* pid, s32 playerNumber, u16 present, s32 stationery, s32 mailNumber) {
+ Mail_c* mail;
+ mHm_hs_c* home;
+ UNUSED s32 pad2;
+ s32 mailboxIdx;
+ s32 res = FALSE;
+ UNUSED s32 pad;
+
+ mail = &l_mpr_mail;
+ home = &common_data.homes[mHS_get_arrange_idx(playerNumber)];
+
+ if (mPr_CheckCmpPersonalID(pid, &home->ownerID) == TRUE) {
+ mailboxIdx = mMl_chk_mail_free_space(home->mailbox, HOME_MAILBOX_SIZE);
+ if (mailboxIdx != -1) {
+ mPr_GetMotherMail(mail, pid, present, stationery, mailNumber);
+ mMl_copy_mail(&home->mailbox[mailboxIdx], mail);
+ res = TRUE;
+ } else if (mPO_get_keep_mail_sum() < 5) {
+ mPr_GetMotherMail(mail, pid, present, stationery, mailNumber);
+ res = mPO_receipt_proc(mail, 0);
+ }
+ }
+
+ return res;
+}
+
+s32 mPr_SendMotherMailDate(PrivateMotherMail* motherMail, lbRTC_time_c* sendTime) {
+ UNUSED s32 pad;
+ s32 mailNumber = -1;
+ s32 letterNumber;
+ u16 present = 0;
+ s32 res = FALSE;
+ PrivateBirthday* birthday = &common_data.privateInfo->birthday;
+ s32 rand;
+
+ if (birthday->month == sendTime->month && birthday->day == sendTime->day) {
+ rand = RANDOM2(2.0f);
+ mailNumber = 0x184 + rand;
+ present = 0x11FC;
+ } else if (sendTime->month == sendTime->day) {
+ letterNumber = ((sendTime->month) * mPr_MOTHER_MAIL_MONTHLY_NUM) + RANDOM(2.0f);
+ mailNumber = 0x162 + letterNumber;
+ if (sendTime->month == 1) {
+ present = 0x2101;
+ } else if (letterNumber == 20) {
+ present = 0x2805;
+ }
+ } else if (sendTime->month == lbRTC_APRIL && sendTime->day == 1) {
+ rand = RANDOM2(2.0f);
+ mailNumber = rand + 0x180;
+ } else {
+ if (mEv_check_status(0x1C, 1) == TRUE) {
+ rand = RANDOM2(2.0f);
+ mailNumber = rand + 0x17C;
+ } else if (mEv_check_status(0x1B, 1) == TRUE) {
+ rand = RANDOM2(2.0f);
+ mailNumber = rand + 0x17E;
+ }
+ }
+
+ if (mailNumber != -1) {
+ if (mPr_SendMotherMailPost(&common_data.privateInfo->playerId, common_data.playerNumber, present,
+ mPr_GetMotherMailPaperType(sendTime->month, sendTime->day), mailNumber) == TRUE) {
+ mTM_set_renew_time(&motherMail->date, sendTime);
+ }
+
+ res = TRUE;
+ }
+
+ return res;
+}
+
+s32 mPr_CheckMotherMailMonthly(PrivateMotherMailData* sendData, s32 month, s32 idx) {
+ s32 ret;
+ if (month == lbRTC_AUGUST) {
+ ret = (sendData->august >> (idx)) & 1;
+ } else {
+ u8 monthlyTemp;
+ s32 shift;
+ s32 slot;
+
+ month--;
+ shift = month * 2;
+ slot = shift / 8;
+ monthlyTemp = sendData->monthly[slot];
+ shift -= slot * 8;
+
+ ret = (monthlyTemp >> (shift + idx)) & 1;
+ }
+
+ return ret;
+}
+
+s32 mPr_GetMotherMailMonthlyNotSendNum(PrivateMotherMailData* sendData, s32 month) {
+ s32 slot;
+ s32 notSendNum = 0;
+ s32 i;
+
+ if (month == lbRTC_AUGUST) {
+ for (i = 0; i < 8; i++) {
+ if (((sendData->august >> i) & 1) == 0) {
+ notSendNum++;
+ }
+ }
+ } else {
+ u8 byte;
+ s32 shift;
+
+ month--;
+ shift = month * 2;
+ slot = shift / 8;
+ byte = sendData->monthly[slot];
+ shift -= slot * 8;
+
+ for (i = 0; i < 2; i++) {
+ if (((byte >> shift) & 1) == 0) {
+ notSendNum++;
+ shift++;
+ }
+ }
+ }
+
+ return notSendNum;
+}
+
+void mPr_SetMotherMailMonthly(PrivateMotherMailData* sendData, s32 month, s32 idx) {
+ if (month == lbRTC_AUGUST) {
+ sendData->august |= (1 << idx);
+ } else {
+ s32 slot;
+ s32 shift;
+
+ month--;
+
+ shift = month * 2;
+ slot = shift / 8;
+ shift -= slot * 8;
+
+ sendData->monthly[slot] |= 1 << (shift + idx);
+ }
+}
+
+void mPr_GetMotherMailMonthlyData(PrivateMotherMailData* sendData, s32* mailNumber, u16* present, s32* eventNumber,
+ s32 month, s32 notSendNum) {
+ s32 mailStartIdx;
+ static s32 mail_start_no_table[4] = {
+ 0x18C,
+ 0x192,
+ 0x186,
+ 0x19E,
+ };
+ static u16 may_2_item_table[1] = { 0x2469 };
+ static u16 december_2_item_table[6] = {
+ 0x246C, 0x246D, 0x246E, 0x2490, 0x2491, 0x249C,
+ };
+ s32 selectedEvent;
+ s32 i;
+ s32 max;
+
+ *present = 0;
+ mailStartIdx = 3;
+
+ if (month <= lbRTC_FEBRUARY) {
+ mailStartIdx = 3;
+ } else if (month <= lbRTC_MAY) {
+ mailStartIdx = 0;
+ } else if (month <= lbRTC_AUGUST) {
+ mailStartIdx = 1;
+ } else if (month <= lbRTC_NOVEMBER) {
+ mailStartIdx = 2;
+ }
+
+ *mailNumber = mail_start_no_table[mailStartIdx];
+
+ selectedEvent = RANDOM(notSendNum);
+ max = mPr_MOTHER_MAIL_MONTHLY_NUM;
+
+ max = (month == lbRTC_AUGUST) ? lbRTC_AUGUST : lbRTC_FEBRUARY;
+
+ for (i = 0; i < max; i++) {
+ if (mPr_CheckMotherMailMonthly(sendData, month, i) == FALSE) {
+ if (selectedEvent <= 0) {
+ *eventNumber = i;
+ break;
+ }
+
+ selectedEvent--;
+ }
+ }
+
+ *mailNumber += (((month - (mailStartIdx * 3)) * 2) + *eventNumber) - 2;
+
+ if (month == lbRTC_MAY && *eventNumber == 1) {
+ *present = may_2_item_table[RANDOM(1.0f)];
+ } else if (month == lbRTC_DECEMBER) {
+ if (*eventNumber == 0) {
+ *present = 0x2800;
+ } else {
+ *present = december_2_item_table[RANDOM(6)];
+ }
+ } else if (month == lbRTC_NOVEMBER) {
+ *present = 0x2805;
+ }
+}
+
+s32 mPr_GetMotherMailNormalNotSendNum(PrivateMotherMailData* sendData) {
+ u8* shift = &sendData->normal[0];
+ s32 notSendNum;
+ s32 i;
+ s32 j;
+
+ for (i = notSendNum = 0; i < mPr_MOTHER_MAIL_NORMAL_NUM; i++, shift++) {
+ for (j = 0; j < 8; j++) {
+ if (((*shift >> j) & 1) == 0) {
+ notSendNum++;
+ }
+ }
+ }
+ return notSendNum;
+}
+
+void mPr_SetMotherMailNormal(PrivateMotherMailData* sendData, s32 idx) {
+ s32 slot = idx / 8;
+ u8* p = &sendData->normal[slot];
+ idx -= slot * 8;
+ *p |= (1 << idx);
+}
+
+s32 mPr_CheckMotherMailNormal(PrivateMotherMailData* sendData, s32 idx) {
+ s32 slot = idx / 8;
+ u8* p = &sendData->normal[slot];
+ s32 ret;
+ idx -= slot * 8;
+ ret = (*p >> (idx)) & 1;
+
+ return ret;
+}
+
+void mPr_GetMotherMailNormalData(PrivateMotherMailData* sendData, s32* mailNumber, u16* present, s32* eventNumber,
+ s32 noSendNum) {
+ s32 selectedEvent;
+ s32 i;
+
+ *eventNumber = -1;
+ selectedEvent = RANDOM(noSendNum);
+
+ for (i = 0; i < 56; i++) {
+ if (mPr_CheckMotherMailNormal(sendData, i) == FALSE) {
+ if (selectedEvent <= 0) {
+ *eventNumber = i;
+ break;
+ }
+
+ selectedEvent--;
+ }
+ }
+
+ *mailNumber = 0x12C + *eventNumber;
+
+ switch (*eventNumber) {
+ case 1:
+ case 16:
+ mSP_SelectRandomItem_New(NULL, present, 1, NULL, 0, 2, 8);
+ break;
+
+ case 3:
+ case 21:
+ case 22:
+ case 47:
+ *present = mFI_GetOtherFruit();
+ break;
+
+ case 12:
+ *present = 0x2100;
+ break;
+
+ case 37:
+ *present = 0x10E8;
+ break;
+
+ case 38:
+ *present = 0x13B0;
+ break;
+
+ case 40:
+ mSP_RandomUmbSelect(present, 1);
+ break;
+
+ default:
+ *present = 0;
+ break;
+ }
+}
+
+void mPr_SendMotherMailNormal(PrivateMotherMail* motherMail, lbRTC_time_c* sendTime) {
+ UNUSED s32 pad2;
+ s32 monthlyNotSendNum;
+ s32 notSendNum;
+ UNUSED s32 pad;
+ s32 mailNumber;
+ s32 eventNumber;
+ u16 present;
+
+ mailNumber = -1;
+ present = 0;
+ monthlyNotSendNum = 0;
+
+ if (RANDOM(100) < 20) {
+ notSendNum = mPr_GetMotherMailNormalNotSendNum(&motherMail->data);
+ if (notSendNum == 0) {
+ bzero(&motherMail->data, sizeof(PrivateMotherMailData));
+ monthlyNotSendNum = mPr_GetMotherMailMonthlyNotSendNum(&motherMail->data, sendTime->month);
+ }
+ if (monthlyNotSendNum > 0) {
+ mPr_GetMotherMailMonthlyData(&motherMail->data, &mailNumber, &present, &eventNumber, sendTime->month,
+ monthlyNotSendNum);
+
+ if (mPr_SendMotherMailPost(&common_data.privateInfo->playerId, common_data.playerNumber, present,
+ mPr_GetMotherMailPaperType(sendTime->month, sendTime->day),
+ mailNumber) == TRUE) {
+ mPr_SetMotherMailMonthly(&motherMail->data, sendTime->month, eventNumber);
+ }
+ } else {
+ mPr_GetMotherMailNormalData(&motherMail->data, &mailNumber, &present, &eventNumber, notSendNum);
+
+ if (mPr_SendMotherMailPost(&common_data.privateInfo->playerId, common_data.playerNumber, present,
+ mPr_GetMotherMailPaperType(sendTime->month, sendTime->day),
+ mailNumber) == TRUE) {
+ mPr_SetMotherMailNormal(&motherMail->data, eventNumber);
+ }
+ }
+ }
+
+ mTM_set_renew_time(&motherMail->date, sendTime);
+}
+
+void mPr_SendMotherMail(PrivateMotherMail* motherMail, lbRTC_time_c* sendTime) {
+ if (mPr_SendMotherMailDate(motherMail, sendTime) == FALSE) {
+ mPr_SendMotherMailNormal(motherMail, sendTime);
+ }
+}
+
+void mPr_SendMailFromMother() {
+ PrivateInfo* priv = common_data.privateInfo;
+ UNUSED s32 pad;
+ s32 playerNumber = common_data.playerNumber;
+ lbRTC_ymd_t* mailDate;
+ lbRTC_time_c* rtcTime = &common_data.time.rtcTime;
+
+ if (mLd_PlayerManKindCheckNo(playerNumber) == FALSE && priv != NULL &&
+ mPr_NullCheckPersonalID(&priv->playerId) == FALSE) {
+ mailDate = &common_data.motherMailInfo[playerNumber].date;
+
+ if (mailDate->year != mTM_rtcTime_ymd_clear_code.year && mailDate->month != mTM_rtcTime_ymd_clear_code.month &&
+ mailDate->day != mTM_rtcTime_ymd_clear_code.day) {
+ if (mailDate->year != rtcTime->year || mailDate->month != rtcTime->month || mailDate->day != rtcTime->day) {
+ mPr_SendMotherMail(&common_data.motherMailInfo[playerNumber], rtcTime);
+ }
+ } else {
+ mTM_set_renew_time(mailDate, rtcTime);
+ }
+ }
+}
+
+void mPr_GetForeingerAnimalMail(Mail_c* mail, PrivateInfo* priv, PrivateAnimalMemory* animalMemory) {
+ AnmPersonalID_c pid;
+ s32 mailNumber;
+ char npcName[6];
+ u8 header[20];
+ u8 footer[26];
+ s32 mailfct;
+ u8 looks;
+ u16 id;
+ s32 headerBackStart;
+
+ looks = mNpc_GetLooks(animalMemory->npcId);
+ mailfct = RANDOM(3);
+ mailNumber = 0xFC;
+ mailfct = mailfct + (looks * 3);
+ mailNumber += mailfct;
+ mHandbill_Set_free_str(0, priv->playerId.playerName, PLAYER_NAME_LEN);
+ id = animalMemory->npcId;
+ mNpc_LoadNpcNameString(npcName, (s8)id);
+ mHandbill_Set_free_str(1, npcName, ANIMAL_NAME_LEN);
+ mHandbill_Set_free_str(2, animalMemory->landName, LAND_NAME_SIZE);
+ mHandbill_Set_free_str(3, priv->playerId.landName, LAND_NAME_SIZE);
+ mHandbill_Load_HandbillFromRom2(header, 20, &headerBackStart, footer, 26, mail->content.body, mailNumber);
+ mem_copy(mail->content.header, header, 10);
+ mem_copy(mail->content.footer, footer, 16);
+
+ mail->content.headerBackStart = headerBackStart;
+ mail->content.font = 0;
+ mail->content.mailType = 0;
+ mail->present = 0;
+ mail->content.paperType = mNpc_GetPaperType();
+
+ pid.npcId = animalMemory->npcId;
+ pid.landId = 0x3000;
+ mLd_CopyLandName(pid.landName, animalMemory->landName);
+ pid.nameId = animalMemory->npcId & 0xFF;
+ pid.looks = looks;
+
+ mMl_set_mail_name_npcinfo(&mail->header.sender, &pid);
+ mPr_CopyPersonalID(&mail->header.recipient.personalID, &priv->playerId);
+ mail->header.recipient.type = 0;
+}
+
+void mPr_SendForeingerAnimalMail(PrivateInfo* priv) {
+ Mail_c* mail = &l_mpr_mail;
+ PrivateAnimalMemory* animalMemory = &priv->animalMemory;
+
+ if (mLd_PlayerManKindCheck() == FALSE) {
+ if (animalMemory->npcId != 0xFFFF && ACTOR_FGNAME_GET_F000(animalMemory->npcId) == 14 &&
+ mPO_get_keep_mail_sum() < 5) {
+ mMl_clear_mail(mail);
+ mPr_GetForeingerAnimalMail(mail, priv, animalMemory);
+ mPO_receipt_proc(mail, 0);
+ mPr_ClearAnimalMemory(animalMemory);
+ }
+ }
+}
+
+void mPr_StartSetCompleteTalkInfo() {
+ if (common_data.privateInfo->completedFish == -1) {
+ common_data.privateInfo->completeFishInsectFlags |= (1 << 0);
+ }
+
+ if (common_data.privateInfo->completedInsect == -1) {
+ common_data.privateInfo->completeFishInsectFlags |= (1 << 2);
+ }
+}
+
+void mPr_SetCompleteTalk(u8* flags, s32 type) {
+ *flags |= (1 << ((type * 2) + 1));
+}
+
+s32 mPr_GetCompleteTalk(u8 flags, s32 type) {
+ return (flags >> ((type * 2) + 1)) & 1;
+}
+
+void mPr_SetFishCompleteTalk() {
+ mPr_SetCompleteTalk(&common_data.privateInfo->completeFishInsectFlags, 0);
+}
+
+s32 mPr_CheckFishCompleteTalk(u8 playerNumber) {
+ s32 res = FALSE;
+
+ if (playerNumber < PLAYER_NUM &&
+ mPr_GetCompleteTalk(common_data.saveFilePrivateInfo[playerNumber].completeFishInsectFlags, 0) == TRUE) {
+ res = TRUE;
+ }
+
+ return res;
+}
+
+void mPr_SetInsectCompleteTalk() {
+ mPr_SetCompleteTalk(&common_data.privateInfo->completeFishInsectFlags, 1);
+}
+
+s32 mPr_CheckInsectCompleteTalk(u8 playerNumber) {
+ s32 res = FALSE;
+
+ if (playerNumber < PLAYER_NUM &&
+ mPr_GetCompleteTalk(common_data.saveFilePrivateInfo[playerNumber].completeFishInsectFlags, 1) == TRUE) {
+ res = TRUE;
+ }
+
+ return res;
+}
+
+s32 mPr_GetTalkPermission(u8 flags, s32 type) {
+ s32 base = type * 2;
+ s32 talk = base + 1;
+
+ s32 res = FALSE;
+ if (((flags >> base) & 1) == 0 || ((flags >> talk) & 1) == 0) {
+ res = TRUE;
+ }
+
+ return res;
+}
+
+s32 mPr_GetFishCompTalkPermission() {
+ s32 res = FALSE;
+
+ if (common_data.privateInfo->completedFish == -1) {
+ res = mPr_GetTalkPermission(common_data.privateInfo->completeFishInsectFlags, 0);
+ }
+
+ return res;
+}
+
+s32 mPr_GetInsectCompTalkPermission() {
+ s32 res = FALSE;
+
+ if (common_data.privateInfo->completedInsect == -1) {
+ res = mPr_GetTalkPermission(common_data.privateInfo->completeFishInsectFlags, 1);
+ }
+
+ return res;
+}
+
+void mPr_ClearMapInfo(mPr_map_info_c* mapInfo, s32 max) {
+ for (; max != 0; max--) {
+ mLd_ClearLandName(mapInfo->landName);
+ mapInfo->landId = 0;
+ mapInfo++;
+ }
+}
+
+void mPr_CopyMapInfo(mPr_map_info_c* dst, mPr_map_info_c* src) {
+ mem_copy((u8*)dst, (u8*)src, sizeof(mPr_map_info_c));
+}
+
+void mPr_SetMapThisLand(mPr_map_info_c* mapInfo) {
+ if (mapInfo != NULL) {
+ mLd_CopyLandName(mapInfo->landName, common_data.landInfo.name);
+ mapInfo->landId = common_data.landInfo.id;
+ }
+}
+
+s32 mPr_GetMapFreeIdx(mPr_map_info_c* mapInfo, s32 max) {
+ s32 res = -1;
+ s32 i;
+
+ for (i = 0; i < max; i++) {
+ if (!mLd_CheckId(mapInfo->landId) || mLd_NullCheckLandName(mapInfo->landName) == TRUE) {
+ res = i;
+ break;
+ }
+
+ mapInfo++;
+ }
+
+ return res;
+}
+
+s32 mPr_GetLandMapIdx(mPr_map_info_c* mapInfo, s32 max, LandInfo* landInfo) {
+ s32 res = -1;
+
+ if (mapInfo != NULL && landInfo != NULL) {
+ s32 i;
+
+ for (i = 0; i < max; i++) {
+ if (mLd_CheckCmpLand(mapInfo->landName, mapInfo->landId, landInfo->name, landInfo->id) == TRUE) {
+ res = i;
+ break;
+ }
+
+ mapInfo++;
+ }
+ }
+
+ return res;
+}
+
+s32 mPr_GetThisLandMapIdx(mPr_map_info_c* map_info, s32 max) {
+ return mPr_GetLandMapIdx(map_info, max, &common_data.landInfo);
+}
+
+void mPr_PushMapInfo(mPr_map_info_c* map_info, s32 max) {
+ if (map_info != NULL) {
+ max--;
+
+ if (max > 0) {
+ for (; max > 0; max--) {
+ mPr_CopyMapInfo(map_info, map_info + 1);
+ map_info++;
+ }
+ }
+
+ mPr_ClearMapInfo(map_info, 1);
+ }
+}
+
+void mPr_SetNewMap(mPr_map_info_c* map_info, s32 max) {
+ if (map_info != NULL && mPr_GetThisLandMapIdx(map_info, max) == -1) {
+ s32 free_idx = mPr_GetMapFreeIdx(map_info, max);
+ if (free_idx != -1) {
+ map_info += free_idx;
+ } else {
+ mPr_PushMapInfo(map_info, max);
+ free_idx = max - 1;
+ map_info += free_idx;
+ }
+
+ if (map_info != NULL) {
+ mPr_SetMapThisLand(map_info);
+ }
+ }
+}
+
+void mPr_SetUseMap(mPr_map_info_c* map_info, s32 max) {
+ if (mPr_GetThisLandMapIdx(map_info, max) != -1) {
+ common_data.unk_10140 = 1;
+ }
+}
+
+void mPr_RenewalMapInfo(mPr_map_info_c* mapInfo, s32 max, LandInfo* landInfo) {
+ mPr_map_info_c map_save;
+
+ s32 map_idx = mPr_GetLandMapIdx(mapInfo, max, landInfo);
+ if (map_idx != -1) {
+ mPr_CopyMapInfo(&map_save, mapInfo + map_idx);
+ mPr_PushMapInfo(mapInfo + map_idx, max - map_idx);
+
+ map_idx = mPr_GetMapFreeIdx(mapInfo, max);
+ if (map_idx != -1) {
+ mPr_CopyMapInfo(mapInfo + map_idx, &map_save);
+ }
+ }
+}
+
+void mPr_RandomSetPlayerData_title_demo() {
+ PrivateInfo* priv = common_data.privateInfo;
+
+ priv->gender = RANDOM(4);
+ priv->gender &= 1;
+ mPlib_change_player_cloth_info_lv2(priv, mPr_GetRandomCloth(priv->gender));
+ priv->face = mPr_GetRandomFace();
+}
+
+void mPr_PrintMapInfo_debug(gfxprint* gfxprint) {
+ PrivateInfo* priv = common_data.privateInfo;
+ mPr_map_info_c* mapInfo;
+ int i;
+
+ if (priv != NULL) {
+ mapInfo = priv->maps;
+ gfxprint_color(gfxprint, 30, 100, 100, 255);
+ gfxprint_locate8x8(gfxprint, 3, 21);
+ gfxprint_printf(gfxprint, "%04x ", common_data.landInfo.id);
+
+ gfxprint_locate8x8(gfxprint, 3, 22);
+ gfxprint_color(gfxprint, 30, 200, 70, 255);
+
+ for (i = 0; i < mPr_FOREIGN_MAP_COUNT; i++) {
+ if (i == 4) {
+ gfxprint_locate8x8(gfxprint, 3, 23);
+ }
+
+ if (mLd_CheckId(mapInfo->landId) == TRUE) {
+ gfxprint_printf(gfxprint, "%04x ", mapInfo->landId);
+ } else {
+ gfxprint_printf(gfxprint, "**** ");
+ }
+
+ mapInfo++;
+ }
+ }
+}
diff --git a/src/code/m_start_data_init.c b/src/code/m_start_data_init.c
index 9e2e00f..a50fc80 100644
--- a/src/code/m_start_data_init.c
+++ b/src/code/m_start_data_init.c
@@ -352,7 +352,7 @@ s32 mSDI_StartInitPak(Game* game2, s32 playerNumber, s32 mallocFlag) {
Game_Play* game_play = (Game_Play*)game;
UNUSED s32 pad;
s32 res = FALSE;
- s32 sp1C;
+ void* sp1C;
if (mallocFlag == 1) {
game = NULL;
@@ -364,7 +364,7 @@ s32 mSDI_StartInitPak(Game* game2, s32 playerNumber, s32 mallocFlag) {
if (mFRm_CheckSaveData() == TRUE) {
sp1C = mCPk_get_pkinfo();
- if ((func_80078E90_jp(sp1C, 0) == TRUE) && (func_800B8D64_jp(playerNumber, sp1C) == TRUE)) {
+ if ((func_80078E90_jp(sp1C, 0) == TRUE) && (mPr_LoadPak_and_SetPrivateInfo2(playerNumber, sp1C) == TRUE)) {
mFM_SetBlockKindLoadCombi(game);
mEv_init_force(&game_play->event);
mHsRm_GetHuusuiRoom(game, playerNumber);
@@ -417,7 +417,7 @@ void mSDI_StartInitAfter(Game* game, s32 renewalReserveFlag, s32 mallocFlag) {
mTRC_init(game_play);
common_data.gokiShockedFlag = FALSE;
func_800A6548_jp();
- func_800B9B2C_jp();
+ mPr_SendMailFromMother();
mNpc_Remail();
mPr_SendForeingerAnimalMail(common_data.privateInfo);
mPr_StartSetCompleteTalkInfo();
diff --git a/src/overlays/gamestates/ovl_play/m_play.c b/src/overlays/gamestates/ovl_play/m_play.c
index 4ceba43..198d4c2 100644
--- a/src/overlays/gamestates/ovl_play/m_play.c
+++ b/src/overlays/gamestates/ovl_play/m_play.c
@@ -102,13 +102,13 @@ static u16 S_back_title_timer;
static u16 S_se_endcheck_timeout;
void Game_play_Reset_destiny(void) {
- Private_Sub_A86* temp = &common_data.privateInfo->unk_A86;
+ PrivateDestiny* destiny = &common_data.privateInfo->destiny;
u8* day = &common_data.time.rtcTime.day;
u8* month = &common_data.time.rtcTime.month;
- if ((temp->unk_08 != 0) &&
- ((common_data.time.rtcTime.year != temp->unk_06) || (*month != temp->unk_05) || (*day != temp->unk_03))) {
- temp->unk_08 = 0;
+ if ((destiny->type != 0) && ((common_data.time.rtcTime.year != destiny->receivedTime.year) ||
+ (*month != destiny->receivedTime.month) || (*day != destiny->receivedTime.day))) {
+ destiny->type = 0;
}
}
diff --git a/yamls/jp/code.yaml b/yamls/jp/code.yaml
index b7be5bf..cc299ca 100644
--- a/yamls/jp/code.yaml
+++ b/yamls/jp/code.yaml
@@ -66,7 +66,7 @@
- [0x6D4E00, asm, code/m_player_lib]
- [0x6D9D80, asm, code/6D9D80]
- [0x6DA460, asm, code/6DA460]
- - [0x6DB420, asm, code/m_private]
+ - [0x6DB420, c, code/m_private]
- [0x6DE300, asm, code/6DE300]
- [0x6E08E0, asm, code/m_random_field]
- [0x6E0F50, asm, code/m_rcp]
@@ -155,6 +155,8 @@
- [0x72F7D0, .data, code/m_npc_walk]
- [0x72F980, .data, code/m_player_call]
- [0x72F9B0, data, code/72F9B0]
+ - [0x7302C0, .data, code/m_private]
+ - [0x730320, data, code/730320]
- [0x731940, .data, code/m_start_data_init]
- [0x731980, .data, code/m_submenu]
- [0x731A20, data, code/731A20]
@@ -215,7 +217,7 @@
- [0x73B000, rodata, code/m_olib]
- [0x73B020, rodata, code/m_player_lib]
- [0x73B0F0, rodata, code/73B0F0]
- - [0x73B130, rodata, code/73B130]
+ - [0x73B130, .rodata, code/m_private]
- [0x73B210, rodata, code/73B210]
- [0x73B250, rodata, code/73B250]
- [0x73B360, rodata, code/73B360]
@@ -276,6 +278,8 @@
- { start: 0x73F4D0, type: .bss, vram: 0x801438B0, name: code/m_npc_walk }
- { start: 0x73F4D0, type: .bss, vram: 0x80143900, name: code/m_player_call }
- { start: 0x73F4D0, type: bss, vram: 0x80143910, name: code/80143910 }
+ - { start: 0x73F4D0, type: .bss, vram: 0x801439A0, name: code/m_private }
+ - { start: 0x73F4D0, type: bss, vram: 0x80144620, name: code/80144620 }
- { start: 0x73F4D0, type: .bss, vram: 0x80144670, name: code/m_submenu }
- { start: 0x73F4D0, type: bss, vram: 0x80144690, name: code/80144690 }
- { start: 0x73F4D0, type: .bss, vram: 0x80144D20, name: code/audioMgr }