Implement & link m_mushroom.c

This commit is contained in:
Cuyler36
2023-05-15 19:36:28 -04:00
parent c02dbb8e6e
commit ad272c7a9c
9 changed files with 765 additions and 1 deletions
+4 -1
View File
@@ -22,6 +22,7 @@
#include "m_museum_display.h"
#include "m_lib.h"
#include "m_field_assessment.h"
#include "m_mushroom.h"
#ifdef __cplusplus
extern "C" {
@@ -92,7 +93,9 @@ typedef struct Save_s {
/* 0x020F1B */ u8 npc_force_go_home; /* when set to 1, forces the 'm_go_home' code to activate */
/* 0x020F1C */ u16 deposit[FG_BLOCK_X_NUM * FG_BLOCK_Z_NUM][UT_Z_NUM]; /* flags for which items are buried around town */
/* 0x0212DC */ lbRTC_time_c last_grow_time; /* last time that a new villager moved into town */
/* 0x0212E4 */ u8 _tmp4[0x02137E - 0x0212E4];
/* 0x0212E4 */ u8 _tmp4[0x02131C - 0x0212E4];
/* 0x02131C */ mMsr_MushTime_c mushroom_time; /* last time mushroom season info was updated */
/* 0x021322 */ u8 _tmp21322[0x02137E - 0x021322];
/* 0x02137E */ lbRTC_time_c treasure_buried_time; /* last time treasure was actually buried */
/* 0x021386 */ lbRTC_time_c treasure_checked_time; /* last time check to bury treasure was executed */
/* 0x02138E */ u8 saved_rom_debug; /* flag to set save to 'debug rom' mode */
+14
View File
@@ -3,6 +3,7 @@
#include "types.h"
#include "libu64/gfxprint.h"
#include "m_time.h"
#ifdef __cplusplus
extern "C" {
@@ -107,9 +108,22 @@ enum week_type {
mEv_WEEKTYPE_SPECIAL
};
enum event_table {
mEv_EVENT_MUSHROOM_SEASON = 47
};
#define mEv_STATUS_ACTIVE (1 << 0) /* event is active */
#define mEv_STATUS_STOP (1 << 1) /* event is stopped */
#define mEv_STATUS_SHOW (1 << 2) /* event is shown */
#define mEv_STATUS_PLAYSOUND (1 << 3) /* event should play sound */
#define mEv_STATUS_RUN (1 << 4) /* event should run */
#define mEv_STATUS_ERROR (1 << 5) /* event is in error state */
#define mEv_STATUS_TALK (1 << 6) /* event requires talking to player */
extern int mEv_CheckFirstJob();
extern int mEv_CheckArbeit();
extern int mEv_CheckTitleDemo();
extern int mEv_check_status(int event, s16 status);
extern int mEv_weekday2day(lbRTC_month_t month, int week_type, lbRTC_weekday_t weekday);
+5
View File
@@ -3,6 +3,7 @@
#include "types.h"
#include "libu64/gfxprint.h"
#include "m_lib.h"
#ifdef __cplusplus
@@ -69,8 +70,12 @@ extern mActor_name_t mFI_GetFieldId();
extern int mFI_GetClimate();
extern mActor_name_t* mFI_BkNumtoUtFGTop(int block_x, int block_z);
extern void mFI_ClearDeposit(int block_x, int block_z);
extern int mFI_GetLineDeposit(u16* deposit, int ut_x);
extern void mFI_GetSpecialBlockNum(int* block_pos_tbl, u32* kind_list, int kind_num);
extern int mFI_SetTreasure(int* block_x, int* block_z, mActor_name_t item_no);
extern void mFI_SetFGUpData();
extern int mFI_ClearBlockItemRandom_common(mActor_name_t item_no, int count, mActor_name_t* fg_items, u16* deposit, int include_deposited);
extern void mFI_Wpos2BlockNum(int* block_x, int* block_z, xyz_t world_pos);
extern void mFI_PrintNowBGNum(gfxprint_t* gfxprint);
extern void mFI_PrintFgAttr(gfxprint_t* gfxprint);
+34
View File
@@ -0,0 +1,34 @@
#ifndef M_MUSHROOM_H
#define M_MUSHROOM_H
#include "types.h"
#include "m_lib.h"
#ifdef __cplusplus
extern "C" {
#endif
#define mMsr_ACTIVE_HOUR 8
#define mMsr_NUM_MUSHROOMS 5
/* sizeof(mMsr_Mushtime_c) == 6 */
typedef struct mushroom_time_s {
/* 0x00 */ u16 year:12;
/* 0x01 */ u16 month:4;
/* 0x02 */ u8 day:5;
/* 0x02 */ u8 pad0:3;
/* 0x03 */ u8 hour:5;
/* 0x03 */ u8 pad1:3;
/* 0x04 */ u8 hour_quarter:4;
/* 0x04 */ u8 active:1; /* probably a better name for this */
/* 0x04 */ u8 pad2:3;
} mMsr_MushTime_c;
extern void mMsr_FirstClearMushroom();
extern void mMsr_SetMushroom(xyz_t player_pos);
#ifdef __cplusplus
}
#endif
#endif
+4
View File
@@ -251,6 +251,10 @@ enum {
#define ITM_DUST2_OLD_TIRE 0x2510
#define ITM_PITFALL 0x2512
#define ITM_FOOD_START 0x2800
#define ITM_FOOD_MUSHROOM 0x2805
#define ITM_ENV_START 0x2900
#define ITM_SAPLING ITM_ENV_START
#define ITM_CEDAR_SAPLING 0x2901
+1
View File
@@ -14,6 +14,7 @@ extern "C" {
enum scene_table {
/* TODO: finish */
SCENE_FG = 0x07, /* outdoors/FG */
SCENE_ISLAND_COTTAGE = 0x2F,
/* TODO: finish */
};
+1
View File
@@ -74,6 +74,7 @@ extern const lbRTC_ymd_t mTM_rtcTime_ymd_clear_code;
extern const lbRTC_time_c mTM_rtcTime_default_code;
#define mTM_IsTimeCleared(time) (lbRTC_IsEqualTime((time), &mTM_rtcTime_clear_code, lbRTC_CHECK_ALL) == TRUE)
#define mTM_AreTimesEqual(t0, t1) (lbRTC_IsEqualTime(t0, t1, lbRTC_CHECK_ALL))
#ifdef __cplusplus
}