Implement m_mail.c

This commit is contained in:
Cuyler36
2023-07-07 10:01:42 -04:00
parent 6a758648a3
commit 67b02e4529
7 changed files with 511 additions and 7 deletions
+1 -1
View File
@@ -24,7 +24,7 @@ extern int mLd_CheckCmpLand(u8* name_a, u16 id_a, u8* name_b, u16 id_b);
extern void mLd_ClearLandName(u8* name);
extern void mLd_CopyLandName(u8* dst, u8* src);
extern int mLd_AddMuraString(u8* name, int name_len);
extern void mLd_GetLandNameStringAddMura(u8* buf);
extern int mLd_GetLandNameStringAddMura(u8* buf);
extern void mLd_SetFreeStrLandMuraName(u8* name, int free_str_no);
extern u8* mLd_GetLandName();
extern u16 mLd_MakeLandId();
+36 -3
View File
@@ -3,6 +3,7 @@
#include "types.h"
#include "m_personal_id.h"
#include "m_npc_personal_id.h"
#include "m_actor_type.h"
#ifdef __cplusplus
@@ -13,6 +14,11 @@ extern "C" {
#define MAIL_FOOTER_LEN 32
#define MAIL_BODY_LEN 192
#define MAIL_FOOTER2_LEN 48
#define MAIL_HEADER2_LEN (MAIL_FOOTER2_LEN - PLAYER_NAME_LEN)
#define mMl_POSTOFFICE_GIFT_NUM 4
enum {
mMl_NAME_TYPE_PLAYER,
mMl_NAME_TYPE_NPC,
@@ -21,6 +27,16 @@ enum {
mMl_TYPE_CLEAR = 0xFF
};
enum {
mMl_FONT_0,
mMl_FONT_SEND,
mMl_FONT_2,
mMl_FONT_3,
mMl_FONT_4,
mMl_FONT_NUM
};
/* sizeof(Mail_nm_c) == 0x16 */
typedef struct mail_nm_s {
/* 0x00 */ PersonalID_c personalID;
@@ -59,12 +75,29 @@ typedef struct mail_s {
/* 0x02E */ Mail_ct_c content;
} Mail_c;
extern int mMl_strlen(u8* str, int maxlen, u8 check_char);
extern void mMl_clear_mail_box(Mail_c* mail_box, int count);
extern int mMl_strlen(u8* str, int size, u8 end_char);
extern int mMl_strlen2(int* found, u8* str, int size, u8 end_char);
extern void mMl_clear_mail_header(Mail_hdr_c* header);
extern void mMl_clear_mail(Mail_c* mail);
extern void mMl_clear_mail_box(Mail_c* mail, int num);
extern int mMl_check_not_used_mail(Mail_c* mail);
extern void mMl_copy_header_name(Mail_c* dst, Mail_c* src);
extern void mMl_set_to_plname(Mail_c* mail, PersonalID_c* pid);
extern int mMl_chk_mail_free_space(Mail_c* mailbox, int count);
extern void mMl_set_playername(Mail_c* mail, PersonalID_c* pid);
extern void mMl_init_mail(Mail_c* mail, PersonalID_c* pid);
extern int mMl_chk_mail_free_space(Mail_c* mail, int num);
extern int mMl_count_use_mail_space(Mail_c* mail, int num);
extern void mMl_copy_mail(Mail_c* dst, Mail_c* src);
extern void mMl_clear_mail_header_common(Mail_hs_c* header);
extern void mMl_set_mail_name_npcinfo(Mail_nm_c* name, AnmPersonalID_c* anm_pid);
extern int mMl_get_npcinfo_from_mail_name(AnmPersonalID_c* anm_pid, Mail_nm_c* name);
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 void mMl_start_send_mail();
#ifdef __cplusplus
}
+81 -2
View File
@@ -367,11 +367,80 @@ extern int mNT_check_unknown(mActor_name_t item_no);
#define FTR_BIRTHDAY_CAKE_NORTH 0x11FE
#define FTR_BIRTHDAY_CAKE_WEST 0x11FF
#define FTR0_END 0x1FFF
#define FTR_TAPEDECK 0x1E58
#define FTR_PIGGY_BANK 0x1FAC
#define FTR_TISSUE 0x1FB0
#define FTR0_END 0x1FFF
#define ITM_PAPER_START 0x2000
#define ITM_PAPER00 (ITM_PAPER_START + 0)
#define ITM_PAPER01 (ITM_PAPER_START + 1)
#define ITM_PAPER02 (ITM_PAPER_START + 2)
#define ITM_PAPER03 (ITM_PAPER_START + 3)
#define ITM_PAPER04 (ITM_PAPER_START + 4)
#define ITM_PAPER05 (ITM_PAPER_START + 5)
#define ITM_PAPER06 (ITM_PAPER_START + 6)
#define ITM_PAPER07 (ITM_PAPER_START + 7)
#define ITM_PAPER08 (ITM_PAPER_START + 8)
#define ITM_PAPER09 (ITM_PAPER_START + 9)
#define ITM_PAPER10 (ITM_PAPER_START + 10)
#define ITM_PAPER11 (ITM_PAPER_START + 11)
#define ITM_PAPER12 (ITM_PAPER_START + 12)
#define ITM_PAPER13 (ITM_PAPER_START + 13)
#define ITM_PAPER14 (ITM_PAPER_START + 14)
#define ITM_PAPER15 (ITM_PAPER_START + 15)
#define ITM_PAPER16 (ITM_PAPER_START + 16)
#define ITM_PAPER17 (ITM_PAPER_START + 17)
#define ITM_PAPER18 (ITM_PAPER_START + 18)
#define ITM_PAPER19 (ITM_PAPER_START + 19)
#define ITM_PAPER20 (ITM_PAPER_START + 20)
#define ITM_PAPER21 (ITM_PAPER_START + 21)
#define ITM_PAPER22 (ITM_PAPER_START + 22)
#define ITM_PAPER23 (ITM_PAPER_START + 23)
#define ITM_PAPER24 (ITM_PAPER_START + 24)
#define ITM_PAPER25 (ITM_PAPER_START + 25)
#define ITM_PAPER26 (ITM_PAPER_START + 26)
#define ITM_PAPER27 (ITM_PAPER_START + 27)
#define ITM_PAPER28 (ITM_PAPER_START + 28)
#define ITM_PAPER29 (ITM_PAPER_START + 29)
#define ITM_PAPER30 (ITM_PAPER_START + 30)
#define ITM_PAPER31 (ITM_PAPER_START + 31)
#define ITM_PAPER32 (ITM_PAPER_START + 32)
#define ITM_PAPER33 (ITM_PAPER_START + 33)
#define ITM_PAPER34 (ITM_PAPER_START + 34)
#define ITM_PAPER35 (ITM_PAPER_START + 35)
#define ITM_PAPER36 (ITM_PAPER_START + 36)
#define ITM_PAPER37 (ITM_PAPER_START + 37)
#define ITM_PAPER38 (ITM_PAPER_START + 38)
#define ITM_PAPER39 (ITM_PAPER_START + 39)
#define ITM_PAPER40 (ITM_PAPER_START + 40)
#define ITM_PAPER41 (ITM_PAPER_START + 41)
#define ITM_PAPER42 (ITM_PAPER_START + 42)
#define ITM_PAPER43 (ITM_PAPER_START + 43)
#define ITM_PAPER44 (ITM_PAPER_START + 44)
#define ITM_PAPER45 (ITM_PAPER_START + 45)
#define ITM_PAPER46 (ITM_PAPER_START + 46)
#define ITM_PAPER47 (ITM_PAPER_START + 47)
#define ITM_PAPER48 (ITM_PAPER_START + 48)
#define ITM_PAPER49 (ITM_PAPER_START + 49)
#define ITM_PAPER50 (ITM_PAPER_START + 50)
#define ITM_PAPER51 (ITM_PAPER_START + 51)
#define ITM_PAPER52 (ITM_PAPER_START + 52)
#define ITM_PAPER53 (ITM_PAPER_START + 53)
#define ITM_PAPER54 (ITM_PAPER_START + 54)
#define ITM_PAPER55 (ITM_PAPER_START + 55)
#define ITM_PAPER56 (ITM_PAPER_START + 56)
#define ITM_PAPER57 (ITM_PAPER_START + 57)
#define ITM_PAPER58 (ITM_PAPER_START + 58)
#define ITM_PAPER59 (ITM_PAPER_START + 59)
#define ITM_PAPER60 (ITM_PAPER_START + 60)
#define ITM_PAPER61 (ITM_PAPER_START + 61)
#define ITM_PAPER62 (ITM_PAPER_START + 62)
#define ITM_PAPER63 (ITM_PAPER_START + 63)
#define ITM_PAPER_STACK_TWO_START 0x2040
#define ITM_PAPER_STACK_THREE_START 0x2080
#define ITM_PAPER_STACK_FOUR_START 0x20C0
@@ -801,10 +870,20 @@ extern int mNT_check_unknown(mActor_name_t item_no);
#define ITM_KABU_100 0x2F02
#define ITM_KABU_SPOILED 0x2F03
#define FTR1_START 0x3000
#define FTR_POST_MODEL 0x3020
#define FTR_ORANGEBOX 0x30F8
#define FTR_COLLEGERULE_SOUTH 0x30FC
#define FTR_CALLIGRAPHY_PAD_WEST 0x313B
#define FTR_MAILBOX 0x3294
#define FTR1_END 0x3000
#define DOOR_START 0x4000
#define DOOR0 DOOR_START /* 0x4000 */
#define DOOR1 (DOOR0 + 1) /* 0x4001 */
+6
View File
@@ -21,6 +21,12 @@ extern "C" {
#define mPr_WALLET_MAX 99999
#define mPr_FLAG_POSTOFFICE_GIFT0 (1 << 2) // 1,000,000 Bells
#define mPr_FLAG_POSTOFFICE_GIFT1 (1 << 3) // 10,000,000 Bells
#define mPr_FLAG_POSTOFFICE_GIFT2 (1 << 4) // 100,000,000 Bells
#define mPr_FLAG_POSTOFFICE_GIFT3 (1 << 5) // 999,999,999 Bells
enum {
mPr_PLAYER_0,
mPr_PLAYER_1,