Implement & link m_museum.c

This commit is contained in:
Cuyler36
2023-07-26 12:00:08 -04:00
parent 6c366bab8e
commit f7fb676f55
11 changed files with 770 additions and 16 deletions
+1
View File
@@ -104,6 +104,7 @@ extern void mCoBG_BgCheckControll(xyz_t* reverse_pos, ACTOR* actor, f32 check_ra
extern int mCoBG_Height2GetLayer(f32 height);
extern void mCoBG_SetPlussOffset(xyz_t wpos, s16 offset, s16 new_attrib);
extern int mCoBG_GetLayer(const xyz_t* wpos);
extern int mCoBG_BnumUnum2HoleNumber(int block_x, int block_z, int ut_x, int ut_z);
extern f32 mCoBG_GetWaterHeight_File(xyz_t wpos, char* file, int line);
#define mCoBG_GetWaterHeight(wpos) mCoBG_GetWaterHeight_File(wpos, __FILE__, __LINE__)
+1
View File
@@ -153,6 +153,7 @@ extern void mFI_FieldMove(xyz_t player_wpos);
extern int mFI_search_unit_around(xyz_t* wpos, mActor_name_t item);
extern void mFI_BlockDepositOFF(u16* deposit, int ut_x, int ut_z);
extern void mFI_PullTanukiPathTrees();
extern int mFI_CheckBlockKind_OR(int block_x, int block_z, u32 kind);
extern void mFI_PrintNowBGNum(gfxprint_t* gfxprint);
extern void mFI_PrintFgAttr(gfxprint_t* gfxprint);
+11
View File
@@ -19,6 +19,8 @@ extern "C" {
#define mMl_POSTOFFICE_GIFT_NUM 4
#define mMl_MUSEUM_INFO_MAIL_NO 189 // TODO: enum?
enum {
mMl_NAME_TYPE_PLAYER,
mMl_NAME_TYPE_NPC,
@@ -38,6 +40,15 @@ enum {
};
enum {
mMl_DATA,
mMl_DATA2,
mMl_DATA_NUM
};
enum {
mMl_TYPE_MUSEUM = 0,
mMl_TYPE_1 = 1,
mMl_TYPE_SHOP_SALE_LEAFLET = 2,
mMl_TYPE_BROKER_SALE_LEAFLET = 3
};
+38 -11
View File
@@ -3,36 +3,63 @@
#include "types.h"
#include "m_actor_type.h"
#include "m_mail.h"
#include "m_museum_display.h"
#include "m_collision_bg.h"
#ifdef __cplusplus
extern "C" {
#endif
#define mMsm_REMAIL_SLOTS 30
#define mMsm_MAX_MAIL 3
#define mMsm_DEPOSIT_FOSSIL_MAX 5
/* sizeof(mMsm_remail_display_c) = 1 */
typedef struct museum_remail_display_s {
u8 display_type_upper:4;
u8 display_type_lower:4;
} mMsm_remail_display_c;
enum {
mMsm_FOSSIL_TYPE_SINGLE,
mMsm_FOSSIL_TYPE_MULTI,
mMsm_FOSSIL_TYPE_NUM
};
enum {
mMsm_REMAIL_KIND_CLEAR,
mMsm_REMAIL_KIND_CANNOT_DONATE,
mMsm_REMAIL_KIND_DONATED,
mMsm_REMAIL_KIND_ALREADY_DONATED,
mMsm_REMAIL_KIND_FOREIGNER,
mMsm_REMAIL_KIND_NUM,
};
/* sizeof(mMsm_remail_info_c) == 0x4C */
typedef struct museum_remail_info_s {
/* 0x00 */ mMsm_remail_display_c types[mMsm_REMAIL_SLOTS / 2]; /* display types for items */
/* 0x00 */ u8 types[mMsm_REMAIL_SLOTS / 2]; /* display types for items */
/* 0x10 */ mActor_name_t items[mMsm_REMAIL_SLOTS]; /* item storage */
} mMsm_remail_info_c;
/* sizeof(mMsm_mail_info_c) == 0x4E */
typedef struct museum_mail_info_s {
/* sizeof(mMsm_record_c) == 0x4E */
typedef struct museum_record_s {
u8 contacted:1; /* set to TRUE when the museum has contacted the player */
u8 unused:1; /* unused where this is used, if at all */
u8 remail_pending:1; /* set to TRUE when the museum has non-fossil letters pending */
u8 send_info_mail:1; /* if set to true, museum info mail will be sent */
u8 stored_item_num:5; /* number of stored items */
u8 stored_fossil_num:5; /* number of stored fossils */
mMsm_remail_info_c remail_info; /* remail info */
} mMsm_mail_info_c;
} mMsm_record_c;
extern void mMsm_ClearRecord(mMsm_record_c* record);
extern void mMsm_GetMuseumMailName(Mail_nm_c* name);
extern void mMsm_SendInformationMail();
extern void mMsm_SendMuseumMail(Mail_c* mail);
extern int mMsm_GetDepositAbleNum(mActor_name_t* fg_items, mCoBG_Collision_u* col_data);
extern void mMsm_DepositItemBlock_cancel(mActor_name_t* fg_items, mActor_name_t deposit_item, mCoBG_Collision_u* col_data, u16* deposit, u16* cancel_ut, u8 valid_ut_count);
extern void mMsm_DepositItemBlock(mActor_name_t* fg_items, mActor_name_t item, int block_x, int block_z, u16* deposit, u8 valid_ut_count);
extern int mMsm_RecordDepositFossil(u8* record, mActor_name_t item, int block_x);
extern u8 mMsm_GetDepositBlockNum(u8 record);
extern void mMsm_DepositFossil(u8 deposit_record, int fossil_count, u16* cancel_ut, int send_order_info);
extern void mMsm_SetCompMail();
extern void mMsm_SendCompMail();
#ifdef __cplusplus
}
+21
View File
@@ -2,6 +2,7 @@
#define M_MUSEUM_DISPLAY_H
#include "types.h"
#include "m_actor_type.h"
#ifdef __cplusplus
extern "C" {
@@ -14,6 +15,19 @@ extern "C" {
#define mMmd_FISH_BIT_NUM 21
#define mMmd_INSECT_BIT_NUM 21
#define mMmd_FOSSIL_NUM 25
#define mMmd_ART_NUM 15
#define mMmd_INSECT_NUM 40
#define mMmd_FISH_NUM 40
enum {
mMmd_DISPLAY_CANNOT_DONATE, /* Item cannot be donated */
mMmd_DISPLAY_CAN_DONATE, /* Item can be donated */
mMmd_DISPLAY_ALREADY_DONATED, /* Item has already been donated */
mMmd_DISPLAY_NUM
};
/* 4 bits per donatable item */
#define mMmd_BIT_INFO(info, category, index) \
(((info).category[(index) / 2] >> (((index) & 1) << 2)) & 0x0F)
@@ -31,6 +45,13 @@ typedef struct museum_display_info_s {
/* 0x2A */ u8 insect_bit[mMmd_INSECT_BIT_NUM];
} mMmd_info_c;
extern int mMmd_GetDisplayInfo(mActor_name_t item);
extern int mMmd_RequestMuseumDisplay(mActor_name_t item);
extern int mMmd_CountDisplayedFossil();
extern int mMmd_CountDisplayedArt();
extern int mMmd_CountDisplayedInsect();
extern int mMmd_CountDisplayedFish();
#ifdef __cplusplus
}
#endif
+8
View File
@@ -142,6 +142,8 @@ extern int mNT_check_unknown(mActor_name_t item_no);
#define GRASS_B (GRASS_A + 1)
#define GRASS_C (GRASS_B + 1)
#define BURIED_PITFALL0 0x002A
#define TREE_BEES 0x005E
#define TREE_FTR (TREE_BEES + 1)
#define TREE_LIGHTS (TREE_FTR + 1)
@@ -375,6 +377,10 @@ extern int mNT_check_unknown(mActor_name_t item_no);
#define FTR_TAPEDECK 0x1E58
#define FTR_DINO_TRICERA_SKULL 0x1EEC
#define FTR_DINO_TRILOBITE_WEST 0x1F4F
#define FTR_PIGGY_BANK 0x1FAC
#define FTR_TISSUE 0x1FB0
@@ -882,6 +888,8 @@ extern int mNT_check_unknown(mActor_name_t item_no);
#define FTR_POST_MODEL 0x3020
#define FTR_MUSEUM_MODEL 0x3030
#define FTR_ORANGEBOX 0x30F8
#define FTR_COLLEGERULE 0x30FC
+3 -1
View File
@@ -25,6 +25,8 @@ extern "C" {
#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
#define mPr_FLAG_MUSEUM_COMP_HANDBILL_SCHEDULED (1 << 6) // player is scheduled to receive completion letter & reward
#define mPr_FLAG_MUSEUM_COMP_HANDBILL_RECEIVED (1 << 7) // player has received the completion letter & reward
#define mPr_MONEY_POWER_MIN -80
@@ -178,7 +180,7 @@ struct private_s {
/* 0x0014 */ s8 gender; /* gender/sex of player */
/* 0x0015 */ s8 face; /* face type of player */
/* 0x0016 */ u8 reset_count; /* times player has reset */
/* 0x0017 */ mMsm_mail_info_c museum_mail_info; /* museum items & remail info */
/* 0x0017 */ mMsm_record_c museum_record; /* museum items & remail info */
/* must be a struct due to alignment of first member */
/* 0x0068 */ struct {
+1
View File
@@ -129,6 +129,7 @@ extern void mSP_RandomUmbSelect(mActor_name_t* item_buf, int item_buf_count);
extern int mSP_GetShopLevel();
extern u32 mSP_ItemNo2ItemPrice(mActor_name_t item_no);
extern int mSP_SearchItemCategoryPriority(mActor_name_t item_no, int category, int priority, GAME* unused); // not sure if it's actually a GAME*
extern mActor_name_t mSP_RandomOneFossilSelect(int multi_fossil);
extern void mItemDebug_ItemDebugMain();
extern void mItemDebug_ItemDebugDraw(gfxprint_t* gfxprint);