diff --git a/include/MSL_C/w_math.h b/include/MSL_C/w_math.h index 98efcecd..9230e9d3 100644 --- a/include/MSL_C/w_math.h +++ b/include/MSL_C/w_math.h @@ -37,6 +37,24 @@ extern inline float sqrtf(float x) } #endif +// hack to get some functions matching where the static const locals are needed +extern inline float sqrtf2(float x) +{ + static const double _half=.5; + static const double _three=3.0; + volatile float y; + if(x > 0.0f) + { + double guess = __frsqrte((double)x); // returns an approximation to + guess = _half*guess*(_three - guess*guess*x); // now have 12 sig bits + guess = _half*guess*(_three - guess*guess*x); // now have 24 sig bits + guess = _half*guess*(_three - guess*guess*x); // now have 32 sig bits + y=(float)(x*guess); + return y; + } + return x; +} + extern inline double fabs(double x) { return __fabs(x) ; diff --git a/include/audio.h b/include/audio.h index d818fe9d..442dbbe6 100644 --- a/include/audio.h +++ b/include/audio.h @@ -2,6 +2,7 @@ #define AUDIO_H #include "types.h" +#include "audio_defs.h" #ifdef __cplusplus extern "C" { @@ -16,6 +17,11 @@ typedef struct audio_tempo_beat_s { extern void sAdo_GameFrame(); extern void sAdo_SoftReset(); +extern void sAdo_SysLevStop(u8 id); +extern void sAdo_SysLevStart(u8 id); + +extern void sAdo_SysTrgStart(u16 id); + /* Not sure about the last param name */ extern void sAdo_VoiceSe(u8 num, u8 num2, u8 num3, s16 character_idx, u8 scale, u8 mode); diff --git a/include/audio_defs.h b/include/audio_defs.h new file mode 100644 index 00000000..1a49cf54 --- /dev/null +++ b/include/audio_defs.h @@ -0,0 +1,20 @@ +#ifndef AUDIO_DEFS_H +#define AUDIO_DEFS_H + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* audio is monophonic */ +#define MONO(id) (id | 0x1000) + +#define SE_COIN 0x4C +#define SE_REGISTER MONO(0x50) + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/libu64/u64types.h b/include/libu64/u64types.h index 98749408..c05977a6 100644 --- a/include/libu64/u64types.h +++ b/include/libu64/u64types.h @@ -7,6 +7,18 @@ extern "C" { #endif +typedef struct xy_s { + f32 x, y; +} xy_t; + +typedef struct xyz_s { + f32 x, y, z; +} xyz_t; + +typedef struct s_xyz_s { + s16 x, y, z; +} s_xyz; + typedef struct { u32 r:8; u32 g:8; diff --git a/include/m_camera2.h b/include/m_camera2.h new file mode 100644 index 00000000..09cb9c1d --- /dev/null +++ b/include/m_camera2.h @@ -0,0 +1,331 @@ +#ifndef M_CAMERA2_H +#define M_CAMERA2_H + +#include "types.h" +#include "m_lib.h" +#include "m_actor.h" + +#ifdef __cplusplus +extern "C" { +#endif + +enum { + CAMERA2_PROCESS_STOP, + CAMERA2_PROCESS_NORMAL, + CAMERA2_PROCESS_WADE, + CAMERA2_PROCESS_TALK, + CAMERA2_PROCESS_DEMO, + CAMERA2_PROCESS_ITEM, + CAMERA2_PROCESS_LOCK, + CAMERA2_PROCESS_DOOR, + CAMERA2_PROCESS_SIMPLE, + CAMERA2_PROCESS_CUST_TALK, + CAMERA2_PROCESS_INTER, + CAMERA2_PROCESS_STAFF_ROLL, + CAMERA2_PROCESS_INTER2, + + CAMERA2_PROCESS_NUM +}; + +typedef struct camera_main_cust_talk_s { + ACTOR* speaker_actor; + ACTOR* listener_actor; + f32 center_ratio; + f32 cull_timer; + s16 angle_x; + s16 angle_y; + f32 distance; +} CameraCustTalk; + +typedef struct camera_main_demo_s { + xyz_t starting_center_pos; + f32 starting_distance; + s_xyz starting_direction; + + xyz_t goal_center_pos; + f32 goal_distance; + s_xyz goal_direction; + + f32 goal_delta; + f32 acceleration_delta; + f32 braking_delta; + f32 now_delta; +} CameraDemo; + +typedef struct camera_main_door_s { + u32 flags; + int morph_counter; + xyz_t center_position; +} CameraDoor; + +typedef struct camera_main_inter_s { + xyz_t starting_center_pos; + xyz_t starting_eye_pos; + + xyz_t goal_center_pos; + xyz_t goal_eye_pos; + + f32 slope0; + f32 slope1; + + u32 flags; + + int now_delta; + int max_delta; + + int pad[2]; +} CameraInter; + +typedef struct camera_main_item_s { + int type; + f32 cull_timer; +} CameraItem; + +typedef struct camera_main_lock_s { + xyz_t center_pos; + xyz_t eye_pos; + + f32 fov_y; + + int morph_counter; + + f32 near; + f32 far; +} CameraLock; + +typedef struct camera_main_normal_s { + u32 flags; + + int last_indoor_distance_addition_idx; + int last_indoor_direction_addition_idx; + + int morph_counter; +} CameraNormal; + +typedef struct camera_main_simple_s { + xyz_t center_pos; + xyz_t eye_pos; + f32 distance; + + int morph_counter; + int mode; + + f32 cull_timer; +} CameraSimple; + +typedef struct camera_main_staff_roll_s { + xyz_t last_center_pos; + xyz_t last_eye_pos; + f32 last_distance; + + ACTOR* speaker_actor; + ACTOR* listener_actor; + + s16 rotation_y_delta; + s16 r_delta; + s16 rotation_x_delta; + + u16 flags; + u16 morph_counter; + u16 pad; + u16 dist_counter; + s_xyz last_direction; +} CameraStaffRoll; + +typedef struct camera_main_talk_s { + ACTOR* speaker_actor; + ACTOR* listener_actor; + + xyz_t listener_pos; + + f32 cull_timer; + u32 flags; + + xyz_t goal_center_pos; +} CameraTalk; + +typedef struct camera_main_wade_s { + f32 timer; + + xyz_t start_pos; + xyz_t goal_pos; + + f32 goal_time; +} CameraWade; + +typedef union camera_main_data_u { + CameraCustTalk cust_talk; + CameraDemo demo; + CameraDoor door; + CameraInter inter; + CameraItem item; + CameraLock lock; + CameraNormal normal; + CameraSimple simple; + CameraStaffRoll staff_roll; + CameraTalk talk; + CameraWade wade; + + u64 align; +} CameraMainData; + +/* request index data */ + +typedef struct camera_request_cust_talk_s { + ACTOR* speaker_actor; + ACTOR* listener_actor; + f32 center_ratio; + f32 cull_timer; + s16 angle_x; + s16 angle_y; + f32 distance; +} CameraRequestCustTalk; + +typedef struct camera_request_demo_s { + xyz_t starting_center_pos; + f32 starting_distance; + s_xyz starting_direction; + + xyz_t goal_center_pos; + f32 goal_distance; + s_xyz goal_direction; + + f32 goal_delta; + f32 acceleration_delta; + f32 braking_delta; +} CameraRequestDemo; + +typedef struct camera_request_door_s { + ACTOR* door_actor; + u32 flags; +} CameraRequestDoor; + +typedef struct camera_request_inter_s { + xyz_t starting_center_pos; + xyz_t starting_eye_pos; + + xyz_t goal_center_pos; + xyz_t goal_eye_pos; + + f32 slope0; + f32 slope1; + + u32 flags; + + int morph_counter; + + int pad[2]; +} CameraRequestInter; + +typedef struct camera_request_item_s { + int type; +} CameraRequestItem; + +typedef struct camera_request_lock_s { + xyz_t center_pos; + xyz_t eye_pos; + + f32 fov_y; + + int morph_counter; + + f32 near; + f32 far; +} CameraRequestLock; + +typedef struct camera_request_normal_s { + xyz_t position; + + int flags; +} CameraRequestNormal; + +typedef struct camera_request_simple_s { + xyz_t center_pos; + s_xyz angle; + f32 distance; + + int morph_counter; + int mode; +} CameraRequestSimple; + +typedef struct camera_request_staff_roll_s { + ACTOR* speaker_actor; + ACTOR* listener_actor; +} CameraRequestStaffRoll; + +typedef struct camera_request_talk_s { + ACTOR* speaker_actor; + ACTOR* listener_actor; + + xyz_t listener_pos; + + u32 flags; +} CameraRequestTalk; + +typedef struct camera_request_wade_s { + xyz_t goal_pos; + f32 goal_time; +} CameraRequestWade; + +typedef union camera_request_data_u { + CameraRequestCustTalk cust_talk; + CameraRequestDemo demo; + CameraRequestDoor door; + CameraRequestInter inter; + CameraRequestItem item; + CameraRequestLock lock; + CameraRequestNormal normal; + CameraRequestSimple simple; + CameraRequestStaffRoll staff_roll; + CameraRequestTalk talk; + CameraRequestWade wade; + + u64 align; +} CameraRequestData; + +typedef struct camera_s { + struct { + xyz_t eye; + xyz_t center; + xyz_t up; + } lookat; + + struct { + f32 fov_y; + f32 aspect_ratio; + f32 near; + f32 far; + f32 scale; + } perspective; + + s_xyz direction; /* camera orientation */ + s_xyz direction_velocity; /* camera orentation rate of change */ + + xyz_t movement_velocity; /* camera world position velocity */ + + f32 focus_distance; /* distance to the camera focal point/subject */ + f32 focus_distance_velocity; /* rate of change of the camera focus */ + + int indoor_distance_addition_idx; /* index of indoor distance adjustment LUT value to apply */ + int indoor_direction_addition_idx; /* index of indoor direction adjustment LUT value to apply */ + + int now_main_index; /* current main index type */ + int last_main_index; /* previous main index type */ + int requested_main_index; /* requested main index type */ + int requested_main_index_priority; /* requested main index priority value */ + int requested_main_index_flag; /* TRUE/FALSE requested main index has been set */ + + CameraMainData main_data; /* current main index data */ + CameraRequestData request_data; /* requested index data */ + + xyz_t mic_pos; /* mic position */ + u32 flags; /* camera flags */ + + xyz_t unused[2]; // potentially unused, idk if it's even xyz_t +} Camera2; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/m_event.h b/include/m_event.h index f76b4a5b..d6795abf 100644 --- a/include/m_event.h +++ b/include/m_event.h @@ -137,6 +137,7 @@ typedef struct ghost_common_s { } mEv_gst_common_c; extern int mEv_CheckFirstJob(); +extern int mEv_CheckFirstIntro(); extern int mEv_CheckArbeit(); extern int mEv_CheckTitleDemo(); extern int mEv_check_status(int event, s16 status); diff --git a/include/m_field_info.h b/include/m_field_info.h index 8bec7ea0..a71f5d76 100644 --- a/include/m_field_info.h +++ b/include/m_field_info.h @@ -33,6 +33,15 @@ enum field_type { mFI_FIELDTYPE_NUM }; +enum field_type2 { + mFI_FIELDTYPE2_FG, + mFI_FIELDTYPE2_PLAYER_ROOM, + mFI_FIELDTYPE2_NPC_ROOM, + mFI_FIELDTYPE2_ROOM, + + mFI_FIELDTYPE2_NUM +}; + #define mFI_TO_FIELD_ID(type, index) (((type) << 12) | (index)) #define mFI_GET_TYPE(field_id) ((field_id) & 0xF000) #define mFI_TYPE(type) ((type) << 12) diff --git a/include/m_lib.h b/include/m_lib.h index 64da89c4..bdad8af6 100644 --- a/include/m_lib.h +++ b/include/m_lib.h @@ -2,10 +2,11 @@ #define M_LIB_H #include "types.h" -#include "m_play.h" +#include "m_play_h.h" #include "m_actor_type.h" #include "MSL_C/math.h" -#include "PR/mbi.h" +#include "libu64/u64types.h" +#include "game.h" #ifdef __cplusplus extern "C" { @@ -33,18 +34,6 @@ extern "C" { /* short angle -> degrees */ #define SHORT2DEG_ANGLE(s) ((((f32)(s)) / (65536.0f / 360.0f))) -typedef struct xy_s { - f32 x, y; -} xy_t; - -typedef struct xyz_s { - f32 x, y, z; -} xyz_t; - -typedef struct s_xyz_s { - s16 x, y, z; -} s_xyz; - typedef struct rgba_t { //can be put in other place u8 r, g, b, a; } rgba_t; diff --git a/include/m_msg.h b/include/m_msg.h index f14359f7..25926a3e 100644 --- a/include/m_msg.h +++ b/include/m_msg.h @@ -21,6 +21,8 @@ extern void mMsg_debug_draw(gfxprint_t* gfxprint); extern void mMsg_aram_init(); +extern int mMsg_Check_MainHide(M_MSG_WINDOW* msg); + #ifdef __cplusplus } #endif diff --git a/include/m_name_table.h b/include/m_name_table.h index 792c4a5f..91ab61b0 100644 --- a/include/m_name_table.h +++ b/include/m_name_table.h @@ -343,7 +343,14 @@ extern int mNT_check_unknown(mActor_name_t item_no); #define ITM_PAPER_STACK_TWO_START 0x2040 #define ITM_PAPER_STACK_THREE_START 0x2080 #define ITM_PAPER_STACK_FOUR_START 0x20C0 -#define ITM_PAPER_END 0x2FFF +#define ITM_PAPER_END 0x20FF + +#define ITM_MONEY_START 0x2100 +#define ITM_MONEY_1000 ITM_MONEY_START // 0x2100 +#define ITM_MONEY_10000 (ITM_MONEY_1000 + 1) // 0x2101 +#define ITM_MONEY_30000 (ITM_MONEY_10000 + 1) // 0x2102 +#define ITM_MONEY_100 (ITM_MONEY_30000 + 1) // 0x2103 +#define ITM_MONEY_END ITM_MONEY_100 // 0x2103 #define ITM_TOOL_START 0x2200 #define ITM_NET ITM_TOOL_START diff --git a/include/m_olib.h b/include/m_olib.h index 961df972..87fc7ba8 100644 --- a/include/m_olib.h +++ b/include/m_olib.h @@ -3,9 +3,12 @@ #include "types.h" #include "libu64/u64types.h" -#include "m_lib.h" #include "libc/math.h" +#ifdef __cplusplus +extern "C" { +#endif + //gotta put these somewhere else #define TRUNCF_BINANG(f) (s16)(s32)(f) #define CAM_DEG_TO_BINANG(degrees) (s16)TRUNCF_BINANG((degrees) * 182.04167f + .5f) @@ -16,7 +19,11 @@ typedef struct rect_s { int l, r; } rect; -void radianxy_by_2pos(xyz_t* dest, xyz_t* sub, xyz_t* min); -s_xyz sanglexy_by_2pos(xyz_t* sub, xyz_t* min); +extern void radianxy_by_2pos(xyz_t* dest, xyz_t* sub, xyz_t* min); +extern s_xyz sanglexy_by_2pos(xyz_t* sub, xyz_t* min); + +#ifdef __cplusplus +} +#endif #endif diff --git a/include/m_play.h b/include/m_play.h index 8e6191c1..5530d3ea 100644 --- a/include/m_play.h +++ b/include/m_play.h @@ -4,18 +4,27 @@ #include "types.h" #include "game.h" #include "libultra/ultratypes.h" +#include "m_view.h" +#include "m_camera2.h" +#include "m_submenu.h" +#include "m_play_h.h" #ifdef __cplusplus extern "C" { #endif /* sizeof(struct game_play_s) == 0x2600 */ -typedef struct game_play_s { +struct game_play_s { /* 0x0000 */ GAME game; // TODO: finish - /* 0x00E0 */ u8 d[0x1CC0]; - /* 0x1DA0 */ int isPause; - /* 0x1DA4 */ u8 _temp[0x268]; + /* 0x00E0 */ u8 _00E0[0x1A68 - 0x00E0]; + /* 0x1A68 */ View view; + /* 0x1B88 */ Camera2 camera; + /* 0x1CC0 */ u8 _1CC0[0x1DA0 - 0x1CC0]; + /* 0x1DA0 */ int isPause; + /* 0x1DA4 */ u8 _1DA4[0x1DEC - 0x1DA4]; + /* 0x1DEC */ Submenu submenu; + /* 0x1FA4 */ u8 _1FA4[0x200C - 0x1FA4]; /* 0x200C */ MtxF matrix; /* 0x204C */ u8 _204C[0x20D0-0x204C]; /* 0x20D0 */ u8 fb_fade_type; @@ -23,7 +32,7 @@ typedef struct game_play_s { /* 0x20D2 */ u8 fb_mode; /* 0x20D3 */ u8 fb_wipe_mode; /* 0x20D4 */ u8 _20D4[0x2600 - 0x20D4]; -} GAME_PLAY; +}; extern void play_init(GAME_PLAY* play); extern void play_cleanup(GAME_PLAY* play); diff --git a/include/m_play_h.h b/include/m_play_h.h new file mode 100644 index 00000000..fb02e421 --- /dev/null +++ b/include/m_play_h.h @@ -0,0 +1,16 @@ +#ifndef M_PLAY_H_H +#define M_PLAY_H_H + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct game_play_s GAME_PLAY; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/m_player_lib.h b/include/m_player_lib.h index 1266d840..37cec152 100644 --- a/include/m_player_lib.h +++ b/include/m_player_lib.h @@ -12,6 +12,8 @@ extern PLAYER_ACTOR* get_player_actor_withoutCheck(GAME_PLAY* play); extern void mPlib_SetData1_controller_data_for_title_demo(f32 stick_x, f32 stick_y, int btn_a, int btn_b); extern void mPlib_SetData2_controller_data_for_title_demo(mActor_name_t tool); extern void mPlib_request_main_invade_type1(GAME_PLAY* play); +extern mActor_name_t mPlib_Get_itemNo_forWindow(); +extern int mPlib_check_able_change_camera_normal_index(); #ifdef __cplusplus } diff --git a/include/m_private.h b/include/m_private.h index ee530c2d..e74d4252 100644 --- a/include/m_private.h +++ b/include/m_private.h @@ -28,6 +28,14 @@ enum { mPr_PLAYER_NUM }; +enum { + mPr_ITEM_COND_NORMAL, + mPr_ITEM_COND_PRESENT, + mPr_ITEM_COND_QUEST, + + mPr_ITEM_COND_NUM +}; + #define mPr_ECARD_NUM 367 #define mPr_ECARD_LETTER_NUM ((mPr_ECARD_NUM + 7) / 8) // 46 @@ -182,6 +190,7 @@ extern void mPr_CopyPersonalID(PersonalID_c* dst, PersonalID_c* src); extern void mPr_ClearPrivateInfo(Private_c* private_data); extern int mPr_CheckCmpPlayerName(u8* str0, u8* str1); extern void mPr_RandomSetPlayerData_title_demo(); +extern int mPr_GetPossessionItemSumWithCond(Private_c* priv, mActor_name_t item_no, u32 cond); #ifdef __cplusplus } diff --git a/include/m_room_type.h b/include/m_room_type.h index 1a8954dd..627beea6 100644 --- a/include/m_room_type.h +++ b/include/m_room_type.h @@ -107,5 +107,6 @@ extern int mRmTp_FtrItemNo2FtrIdx(mActor_name_t ftr_item_no); extern mActor_name_t mRmTp_FtrIdx2FtrItemNo(int ftr_idx, int rotation); extern int mRmTp_GetFurnitureData(mActor_name_t ftr, int ut_x, int ut_z, mRmTp_FtrPlaceInfo_t* place_info); extern int mRmTp_FurnitureIdx2FurnitureKind(int ftr_idx); +extern int mRmTp_PleaseDrawLightSwitch(); #endif \ No newline at end of file diff --git a/include/m_scene_table.h b/include/m_scene_table.h index a31cea59..dc4876af 100644 --- a/include/m_scene_table.h +++ b/include/m_scene_table.h @@ -13,10 +13,33 @@ extern "C" { */ enum scene_table { - /* TODO: finish */ - SCENE_FG = 0x07, /* outdoors/FG */ + SCENE_TEST1, + SCENE_TEST2, + SCENE_TEST3, + SCENE_WATER_TEST, + SCENE_FOOTPRINT_TEST, + SCENE_NPC_TEST, + SCENE_NPC_HOUSE, /* npc house interior */ + SCENE_FG, /* outdoors/FG */ + SCENE_RANDOM_NPC_TEST, + SCENE_SHOP0 = 0x09, /* nook's cranny */ + SCENE_BROKER_SHOP = 0x0C, /* crazy redd's tent */ + SCENE_POST_OFFICE = 0x0E, /* post office */ + SCENE_START_DEMO = 0x0F, /* after player select */ + SCENE_START_DEMO2 = 0x10, /* */ + SCENE_BUGGY = 0x12, + SCENE_PLAYERSELECT = 0x13, + SCENE_CONVENI = 0x17, /* nook 'n' go */ + SCENE_SUPER = 0x18, /* nookway */ + SCENE_DEPART = 0x19, /* nookington's 1st floor */ + SCENE_DEPART_2 = 0x1D, /* nookington's 2nd floor */ SCENE_TITLE_DEMO = 0x21, /* title screen demo */ - SCENE_ISLAND_COTTAGE = 0x2F, + SCENE_PLAYERSELECT_SAVE = 0x22, + SCENE_MUSEUM_ENTRANCE = 0x23, + SCENE_MUSEUM_ROOM = 0x24, + SCENE_NEEDLEWORK = 0x2E, /* able sister's */ + SCENE_COTTAGE_MY = 0x2F, + SCENE_COTTAGE_NPC = 0x30, /* TODO: finish */ }; diff --git a/include/m_submenu.h b/include/m_submenu.h new file mode 100644 index 00000000..229161f5 --- /dev/null +++ b/include/m_submenu.h @@ -0,0 +1,35 @@ +#ifndef M_SUBMENU_H +#define M_SUBMENU_H + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +enum { + mSM_PROCESS_WAIT, + mSM_PROCESS_PREWAIT, + mSM_PROCESS_LINKWAIT, + mSM_PROCESS_PLAY, + mSM_PROCESS_END, + + mSM_PROCESS_NUM +}; + +/* sizeof (Submenu) == 0x1B8 */ +typedef struct submenu_s { + /* 0x000 */ int mode; + /* 0x004 */ int menu_type; + /* 0x008 */ int current_menu_type; + + /* 0x00C */ int process_status; + /* 0x010 */ u8 _10[0x1B8 - 0x010]; + // TODO: finish +} Submenu; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/m_watch_my_step.h b/include/m_watch_my_step.h new file mode 100644 index 00000000..b1e22763 --- /dev/null +++ b/include/m_watch_my_step.h @@ -0,0 +1,40 @@ +#ifndef M_WATCH_MY_STEP_H +#define M_WATCH_MY_STEP_H + +#include "types.h" +#include "m_play.h" +#include "main.h" + +#ifdef __cplusplus +extern "C" { +#endif + +extern Gfx fki_win_mode[]; +extern Gfx fki_win_w3T_model[]; +extern Gfx fki_win_w2T_model[]; +extern Gfx fki_win_w4_model[]; +extern Gfx fki_win_w1T_model[]; + +extern Gfx cam_win_winT_model[]; +extern Gfx cam_win_cT_model[]; +extern Gfx cam_win_mojiT_model[]; +extern Gfx cam_win_yajirushi_model[]; + +extern Gfx elc_win_winT_model[]; +extern Gfx elc_win_zT_model[]; +extern Gfx elc_win_moji_model[]; +extern Gfx elc_win_moji2T_model[]; + +extern Gfx mny_win_ueT_model[]; +extern Gfx mny_win_beruT_model[]; +extern Gfx mny_win_mojiT_model[]; + +extern void watch_my_step_ct(); +extern void watch_my_step_move(GAME_PLAY* play); +extern void watch_my_step_draw(GAME_PLAY* play); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/rel/m_cockroach.c b/rel/m_cockroach.c index 9146b4dd..cb0a6055 100644 --- a/rel/m_cockroach.c +++ b/rel/m_cockroach.c @@ -86,7 +86,7 @@ extern void mCkRh_InitGokiSaveData_AllRoom() { * @param scene_id The current scene id **/ extern void mCkRh_SetGoingOutCottageTime(int scene_id) { - if (scene_id == SCENE_ISLAND_COTTAGE) { + if (scene_id == SCENE_COTTAGE_MY) { Save_Set(island.cottage.goki.time.year, Common_Get(time.rtc_time.year)); Save_Set(island.cottage.goki.time.month, Common_Get(time.rtc_time.month)); Save_Set(island.cottage.goki.time.day, Common_Get(time.rtc_time.day)); @@ -212,7 +212,7 @@ extern int mCkRh_PlussGokiN_NowRoom(int count, int scene_no) { return TRUE; } } - else if (scene_no == SCENE_ISLAND_COTTAGE) { + else if (scene_no == SCENE_COTTAGE_MY) { u8* goki_num = Save_GetPointer(island.cottage.goki.num); *goki_num = mCkRh_GokiFamilyCount2Good(count + *goki_num); } @@ -237,7 +237,7 @@ extern int mCkRh_MinusGokiN_NowRoom(int count, int scene_id) { return TRUE; } } - else if (scene_id == SCENE_ISLAND_COTTAGE) { + else if (scene_id == SCENE_COTTAGE_MY) { u8* goki_num = Save_GetPointer(island.cottage.goki.num); *goki_num = mCkRh_GokiFamilyCount2Good(*goki_num - count); } @@ -258,7 +258,7 @@ extern int mCkRh_NowSceneGokiFamilyCount() { if (mFI_IS_PLAYER_ROOM(fieldid)) { return Save_Get(homes[mFI_GET_PLAYER_ROOM_NO(fieldid)].goki.num); } - else if (Save_Get(scene_no) == SCENE_ISLAND_COTTAGE) { + else if (Save_Get(scene_no) == SCENE_COTTAGE_MY) { return Save_Get(island.cottage.goki.num); } diff --git a/rel/m_olib.c b/rel/m_olib.c index 9c40466d..d0affd93 100644 --- a/rel/m_olib.c +++ b/rel/m_olib.c @@ -1,5 +1,6 @@ #include "m_olib.h" -void radianxy_by_2pos(xyz_t* dest, xyz_t* sub, xyz_t* min){ + +extern void radianxy_by_2pos(xyz_t* dest, xyz_t* sub, xyz_t* min) { xyz_t ret; @@ -10,13 +11,13 @@ void radianxy_by_2pos(xyz_t* dest, xyz_t* sub, xyz_t* min){ *dest = ret; } -s_xyz sanglexy_by_2pos(xyz_t* sub, xyz_t* min) { +extern s_xyz sanglexy_by_2pos(xyz_t* sub, xyz_t* min) { s_xyz sangle; xyz_t conv; xyz_t angle; - radianxy_by_2pos(&angle, sub,min); + radianxy_by_2pos(&angle, sub, min); conv = angle; sangle.x = CAM_DEG_TO_BINANG(RAD_TO_DEG(conv.x)); sangle.y = CAM_DEG_TO_BINANG(RAD_TO_DEG(conv.y)); @@ -24,4 +25,4 @@ s_xyz sanglexy_by_2pos(xyz_t* sub, xyz_t* min) { return sangle; -} \ No newline at end of file +} diff --git a/rel/m_trademark.c b/rel/m_trademark.c index af1d1923..364e4718 100644 --- a/rel/m_trademark.c +++ b/rel/m_trademark.c @@ -30,6 +30,7 @@ #include "libjsys/jsyswrapper.h" #include "libc64/qrand.h" #include "m_common_data.h" +#include "m_play.h" static int mTR_first_flag = TRUE; diff --git a/rel/m_watch_my_step.c b/rel/m_watch_my_step.c new file mode 100644 index 00000000..2bd4fc24 --- /dev/null +++ b/rel/m_watch_my_step.c @@ -0,0 +1,651 @@ +#include "m_watch_my_step.h" + +#include "libultra/libultra.h" +#include "m_play.h" +#include "m_actor_type.h" +#include "m_item_name.h" +#include "m_name_table.h" +#include "m_player.h" +#include "m_player_lib.h" +#include "m_event.h" +#include "m_field_info.h" +#include "m_font.h" +#include "m_mail.h" +#include "m_common_data.h" +#include "sys_matrix.h" +#include "m_room_type.h" +#include "m_msg.h" +#include "audio.h" +#include "m_scene.h" +#include "m_private.h" + +typedef struct watch_my_step_s { + f32 pos_x; + f32 pos_y; + + f32 opacity; + + f32 trans_x; + f32 trans_y; + + f32 scale; + + s16 timer; + + mActor_name_t item_no; + + u8 mode; + u8 item_name[mIN_ITEM_NAME_LEN]; + u8 draw_type; +} mWt_watch_my_step_c; + +static mWt_watch_my_step_c S_watch_my_step; + +typedef struct navigate_s { + f32 opacity; + s16 timer; + u8 mode; + u8 draw_type; +} mWt_navigate_c; + +static mWt_navigate_c S_navigate; + +typedef struct mybell_confirmation_s { + f32 opacity; + u32 all_money; + s16 coin_sfx_timer; + u8 mode; + u8 draw_type; + u8 update_money; + u8 play_finish_sfx; +} mWt_mybell_confirmation_c; + +static mWt_mybell_confirmation_c S_mybell_conf; + +static void navigate_camera_ct(); +static void mWt_mybell_confirmation_ct(); + +extern void watch_my_step_ct() { + bzero(&S_watch_my_step, sizeof(mWt_watch_my_step_c)); + S_watch_my_step.item_no = EMPTY_NO; + navigate_camera_ct(); + mWt_mybell_confirmation_ct(); +} + +static void navigate_camera_move(GAME_PLAY* play); +static void mWt_mybell_confirmation_move(GAME_PLAY* play); + +extern void watch_my_step_move(GAME_PLAY* play) { + mActor_name_t window_item; + PLAYER_ACTOR* player_actor = get_player_actor_withoutCheck(play); + int can_show = play->camera.now_main_index == CAMERA2_PROCESS_NORMAL && play->camera.main_data.normal.morph_counter > 20; + + navigate_camera_move(play); + mWt_mybell_confirmation_move(play); + + S_watch_my_step.draw_type = 0; + + if (mEv_CheckTitleDemo() <= 0) { + window_item = mPlib_Get_itemNo_forWindow(); + + switch (S_watch_my_step.mode) { + case 0: + { + if (window_item != EMPTY_NO && !can_show) { + S_watch_my_step.opacity = 0.0f; + S_watch_my_step.timer = 2; + S_watch_my_step.mode++; + } + break; + } + + case 1: + case 2: + { + if (S_watch_my_step.timer-- == 0) { + S_watch_my_step.timer = 2; + S_watch_my_step.mode++; + } + break; + } + + case 3: + { + add_calc(&S_watch_my_step.opacity, 1.0f, 1.0f - sqrtf2(0.5), 0.25f, 0.15f); + if (window_item == EMPTY_NO || can_show == TRUE) { + S_watch_my_step.mode++; + } + break; + } + + case 4: + { + add_calc(&S_watch_my_step.opacity, 0.0f, 1.0f - sqrtf2(0.5), 0.1f, 0.05f); + add_calc(&S_watch_my_step.opacity, 0.0f, 1.0f - sqrtf2(0.5), 0.005f, 0.005f); + + if (S_watch_my_step.opacity < 0.01f) { + S_watch_my_step.mode = 0; + } + break; + } + + default: + { + S_watch_my_step.mode = 0; + break; + } + } + + if (S_watch_my_step.mode != 0) { + xyz_t position = player_actor->actor_class.world_position; + xyz_t screen_pos; + position.y += 30.0f; + + /* convert player position plus 75% of a unit up to screen position */ + Game_play_Projection_Trans(play, &position, &screen_pos); + + if (S_watch_my_step.mode < 4) { + S_watch_my_step.trans_x = 1.0f; + + if (screen_pos.x > 200.0f) { + S_watch_my_step.trans_x = -1.0f; + } + else if (screen_pos.x > 120.0f && player_actor->actor_class.shape_info.rotation.y >= 0) { + S_watch_my_step.trans_x = -1.0f; + } + + S_watch_my_step.trans_y = 1.0f; + if (screen_pos.y < 68.0f) { + S_watch_my_step.trans_y = -1.0f; + } + + S_watch_my_step.pos_x = screen_pos.x - (S_watch_my_step.trans_x * -40.0f + 160.0f); + S_watch_my_step.pos_y = screen_pos.y - (S_watch_my_step.trans_y * 42.0f + 120.0f); + } + + if (window_item != EMPTY_NO) { + f32 size; + int len; + + if (S_watch_my_step.item_no != window_item || S_watch_my_step.item_no == EMPTY_NO) { + S_watch_my_step.item_no = window_item; + mIN_copy_name_str(S_watch_my_step.item_name, (mActor_name_t)window_item); + } + + len = mMl_strlen(S_watch_my_step.item_name, mIN_ITEM_NAME_LEN, CHAR_SPACE); + size = (f32)(mFont_GetStringWidth(S_watch_my_step.item_name, len, TRUE)) * 0.875f - 17.5f; + + if (size < 0.0f) { + size = 0.0f; + } + + S_watch_my_step.scale = size / 122.5f; + } + else { + S_watch_my_step.item_no = EMPTY_NO; + } + + if (S_watch_my_step.mode != 0) { + if ((mFI_GET_TYPE(mFI_GetFieldId()) == mFI_TYPE(mFI_FIELDTYPE_FG) && mEv_CheckFirstIntro() != TRUE) || // all items when correct mode outside but not during nook intro + (Common_Get(field_type) == mFI_FIELDTYPE2_PLAYER_ROOM && !ITEM_IS_FTR(window_item)) // Non-furniture items when in player house + ) { + S_watch_my_step.draw_type = 1; + } + } + } + } +} + +static void navigate_camera_draw(GAME_PLAY*); +static void mWt_mybell_confirmation_draw(GAME_PLAY*); + +// TODO: @nonmatching +extern void watch_my_step_draw(GAME_PLAY* play) { + GAME* game = (GAME*)play; + GRAPH* g = play->game.graph; + Mtx* font_mtx; + + OPEN_DISP(g); + + font_mtx = GRAPH_ALLOC_TYPE(g, Mtx, 1); + + navigate_camera_draw(play); + mWt_mybell_confirmation_draw(play); + + if (S_watch_my_step.draw_type == 0) { + return; + } + + /* load new world-view projection matrix for font */ + if (font_mtx != NULL) { + mFont_CulcOrthoMatrix(font_mtx); + gSPMatrix(NOW_FONT_DISP++, font_mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); + } + + Matrix_scale(16.0f, 16.0f, 16.0f, 0); + Matrix_translate(S_watch_my_step.pos_x, -S_watch_my_step.pos_y, 0.0f, 1); + + { + Gfx* font_gfx = NOW_FONT_DISP; + gSPMatrix(font_gfx++, _Matrix_to_Mtx_new(g), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(font_gfx++, fki_win_mode); + gDPSetRenderMode(font_gfx++, G_RM_CLD_SURF, G_RM_CLD_SURF2); + + switch (S_watch_my_step.mode) { + case 3: + { + Matrix_push(); + Matrix_scale( + S_watch_my_step.opacity * (S_watch_my_step.scale * 0.75f + 0.25f), + S_watch_my_step.opacity * (S_watch_my_step.scale * 0.23333335f + 0.76666665f), + S_watch_my_step.opacity, + 1 + ); + + gSPMatrix(font_gfx++, _Matrix_to_Mtx_new(g), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + Matrix_pull(); + gSPDisplayList(font_gfx++, fki_win_w3T_model); + } + /* fallthrough 3 -> 2 */ + case 2: + { + Matrix_push(); + Matrix_translate( + S_watch_my_step.trans_x * -1.0f, + S_watch_my_step.trans_y * -20.0f, + 0.0f, + 1 + ); + + gSPMatrix(font_gfx++, _Matrix_to_Mtx_new(g), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + Matrix_pull(); + gSPDisplayList(font_gfx++, fki_win_w2T_model); + } + /* fallthrough 2 -> 1 */ + case 1: + { + Matrix_push(); + Matrix_translate( + S_watch_my_step.trans_x * -13.0f, + S_watch_my_step.trans_y * -30.0f, + 0.0f, + 1 + ); + + gSPMatrix(font_gfx++, _Matrix_to_Mtx_new(g), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + Matrix_pull(); + gSPDisplayList(font_gfx++, fki_win_w1T_model); + break; + } + + case 4: + { + int a = S_watch_my_step.opacity * 255.0f; + gDPSetPrimColor(font_gfx++, 0, a, 255, 255, 215, a); + + Matrix_push(); + Matrix_scale( + S_watch_my_step.scale * 0.75f + 0.25f, + S_watch_my_step.scale * 0.23333335f + 0.76666665f, + 0.1f, + 1 + ); + + gSPMatrix(font_gfx++, _Matrix_to_Mtx_new(g), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + Matrix_pull(); + gSPDisplayList(font_gfx++, fki_win_w4_model); + break; + } + } + + /* Reset font matrix scale */ + Matrix_scale(1.0f, 1.0f, 1.0f, 0); + gSPMatrix(font_gfx++, _Matrix_to_Mtx_new(g), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + SET_FONT_DISP(font_gfx); + } + + CLOSE_DISP(g); + + if (S_watch_my_step.mode >= 3) { + f32 text_opacity = (S_watch_my_step.opacity - 0.5f) * 2.0f; + + if (text_opacity > 0.0f) { + /* nonmatch starts here */ + int a = text_opacity * 255.0f; + f32 x = 160.0f + (S_watch_my_step.pos_x - 0.5f * (S_watch_my_step.scale * 120.0f + 40.0f)); + f32 y = 120.0f + (S_watch_my_step.pos_y - 0.5f * (S_watch_my_step.scale * 7.0f + 23.0f)); + mFont_SetLineStrings( + game, + S_watch_my_step.item_name, mIN_ITEM_NAME_LEN, + (1.0f - S_watch_my_step.scale) + x + 10.0f, + S_watch_my_step.scale * 3.0f + y + 5.0f, + 45, 45, 35, a, + FALSE, + TRUE, + 0.875f, 0.875f, + mFont_MODE_POLY + ); + } + } +} + +static void navigate_camera_ct() { + bzero(&S_navigate, sizeof(mWt_navigate_c)); +} + +static void navigate_camera_move(GAME_PLAY* play) { + S_navigate.draw_type = 0; + + switch (S_navigate.mode) { + case 0: + { + if (mPlib_check_able_change_camera_normal_index() != 0 && play->fb_fade_type == 0) { + S_navigate.timer = 150; + S_navigate.mode++; + } + break; + } + + case 1: + { + add_calc(&S_navigate.opacity, 1.0f, 1.0f - sqrtf(0.8), 0.075f, 0.005f); + S_navigate.timer--; + + if (S_navigate.timer == 0 || play->submenu.process_status != mSM_PROCESS_WAIT || mMsg_Check_MainHide(mMsg_Get_base_window_p()) == FALSE) { + S_navigate.mode++; + } + + if (mRmTp_PleaseDrawLightSwitch()) { + S_navigate.draw_type = 2; + } + else { + S_navigate.draw_type = 1; + } + break; + } + + case 2: + { + add_calc(&S_navigate.opacity, 0.0f, 1.0f - sqrtf(0.8), 0.075f, 0.005f); + + if (S_navigate.opacity < 0.0001f) { + S_navigate.mode++; + } + else if (mRmTp_PleaseDrawLightSwitch()) { + S_navigate.draw_type = 2; + } + else { + S_navigate.draw_type = 1; + } + + break; + } + + case 3: + { + break; + } + } +} + +static void navigate_camera_draw(GAME_PLAY* play) { + GRAPH* g = play->game.graph; + Gfx* font_gfx; + Mtx* font_mtx; + + OPEN_DISP(g); + + font_mtx = GRAPH_ALLOC_TYPE(g, Mtx, 1); + + if (S_navigate.draw_type != 0) { + u8 a = S_navigate.opacity * 255.0f; + + if (font_mtx != NULL) { + mFont_CulcOrthoMatrix(font_mtx); + gSPMatrix(NOW_FONT_DISP++, font_mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); + } + + Matrix_scale(16.0f, 16.0f, 16.0f, 0); + + font_gfx = NOW_FONT_DISP; + gSPMatrix(font_gfx++, _Matrix_to_Mtx_new(g), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(font_gfx++, fki_win_mode); + + /* draw camera movement guide gfx */ + gDPSetPrimColor(font_gfx++, 0, 255, 40, 40, 140, a); + gSPDisplayList(font_gfx++, cam_win_winT_model); + + gDPSetPrimColor(font_gfx++, 0, 255, 245, 245, 30, a); + gSPDisplayList(font_gfx++, cam_win_cT_model); + + gDPSetPrimColor(font_gfx++, 0, 255, 255, 255, 255, a); + gSPDisplayList(font_gfx++, cam_win_mojiT_model); + + gDPSetPrimColor(font_gfx++, 0, 255, 30, 165, 30, a); + gSPDisplayList(font_gfx++, cam_win_yajirushi_model); + + if (S_navigate.draw_type == 2) { + /* draw light switch guide */ + gDPSetPrimColor(font_gfx++, 0, 255, 40, 40, 140, a); + gSPDisplayList(font_gfx++, elc_win_winT_model); + + gDPSetPrimColor(font_gfx++, 0, 255, 30, 0, 50, a); + gSPDisplayList(font_gfx++, elc_win_zT_model); + + gDPSetPrimColor(font_gfx++, 0, 255, 215, 225, 255, a); + gSPDisplayList(font_gfx++, elc_win_moji_model); + + gDPSetPrimColor(font_gfx++, 0, 255, 255, 255, 255, a); + gSPDisplayList(font_gfx++, elc_win_moji2T_model); + } + + SET_FONT_DISP(font_gfx); // comenting this out fixes above flow but is wrong + } + + CLOSE_DISP(g); +} + +static void mWt_set_coin_se(int play_flag) { + static int S_se_play_flg; + + if (play_flag == FALSE) { + if (S_se_play_flg == TRUE) { + sAdo_SysLevStop(SE_COIN); // TODO: enum for sound effects + S_mybell_conf.update_money = FALSE; + S_mybell_conf.play_finish_sfx = FALSE; + S_mybell_conf.coin_sfx_timer = 0; + } + } + else if (S_se_play_flg == FALSE) { + sAdo_SysLevStart(SE_COIN); + S_mybell_conf.update_money = TRUE; + S_mybell_conf.play_finish_sfx = FALSE; + S_mybell_conf.coin_sfx_timer = 300; + } + + S_se_play_flg = play_flag; +} + +static u32 get_all_money(); + +static void mWt_mybell_confirmation_ct() { + bzero(&S_mybell_conf, sizeof(S_mybell_conf)); + + S_mybell_conf.all_money = get_all_money(); + mWt_set_coin_se(FALSE); +} + +static void mWt_mybell_confirmation_move(GAME_PLAY* play) { + static int place_chk[8] = { + SCENE_SHOP0, SCENE_CONVENI, SCENE_SUPER, SCENE_DEPART, + SCENE_DEPART_2, SCENE_BROKER_SHOP, SCENE_POST_OFFICE, SCENE_NEEDLEWORK + }; + + int i; + + S_mybell_conf.draw_type = 0; + + if (S_mybell_conf.play_finish_sfx == TRUE) { + sAdo_SysTrgStart(SE_REGISTER); + S_mybell_conf.play_finish_sfx = FALSE; + } + + if (S_mybell_conf.coin_sfx_timer != 0) { + if (--S_mybell_conf.coin_sfx_timer <= 0) { + mWt_set_coin_se(FALSE); + } + } + + for (i = 0; i < 8; i++) { + if (Save_Get(scene_no) == place_chk[i]) { + break; + } + } + + if ((u32)i == 8 || mEv_CheckFirstJob() == TRUE || (i <= 4 && Common_Get(nook_shop_state) == 3)) { // TODO: shop state enum, this is likely raffle + if (S_mybell_conf.update_money == TRUE) { + S_mybell_conf.all_money = get_all_money(); + mWt_set_coin_se(FALSE); + } + + S_mybell_conf.update_money = FALSE; + } + else { + switch (S_mybell_conf.mode) { + case 0: + { + if (play->submenu.process_status == mSM_PROCESS_WAIT) { + S_mybell_conf.mode++; + } + break; + } + + case 1: + { + f32 money = S_mybell_conf.all_money; + u32 now_money = get_all_money(); + + if (S_mybell_conf.all_money != now_money) { + mWt_set_coin_se(TRUE); + } + + if (play->submenu.process_status != mSM_PROCESS_WAIT) { + S_mybell_conf.mode++; + } + + if ((S_mybell_conf.update_money == TRUE) && (S_mybell_conf.all_money == now_money || S_mybell_conf.mode == 2)) { + mWt_set_coin_se(FALSE); + if (S_mybell_conf.all_money == now_money) { + S_mybell_conf.play_finish_sfx = TRUE; + } + } + + add_calc(&money, now_money, 0.1f, 10000.0f, 1.0f); + S_mybell_conf.all_money = money; + add_calc(&S_mybell_conf.opacity, 1.0f, 1.0f - sqrtf(0.8), 0.075f, 0.005f); + S_mybell_conf.draw_type = 1; + break; + } + + case 2: + { + add_calc(&S_mybell_conf.opacity, 0.0f, 1.0f - sqrtf(0.8), 0.05f, 0.005f); + + if (S_mybell_conf.opacity < 0.0001f) { + S_mybell_conf.mode = 0; + } + else { + S_mybell_conf.draw_type = 1; + } + break; + } + + case 3: + { + break; + } + } + } +} + +static void mWt_mybell_confirmation_draw(GAME_PLAY* play) { + GAME* game = (GAME*)play; + GRAPH* g = play->game.graph; + Mtx* font_mtx; + Gfx* font_gfx; + + + font_mtx = GRAPH_ALLOC_TYPE(g, Mtx, 1); + + if (S_mybell_conf.draw_type != 0) { + u8 a = S_mybell_conf.opacity * 255.0f; + + OPEN_DISP(g); + + if (font_mtx != NULL) { + mFont_CulcOrthoMatrix(font_mtx); + gSPMatrix(NOW_FONT_DISP++, font_mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); + } + + Matrix_scale(16.0f, 16.0f, 16.0f, 0); + + font_gfx = NOW_FONT_DISP; + gSPMatrix(font_gfx++, _Matrix_to_Mtx_new(g), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(font_gfx++, fki_win_mode); + + gDPSetRenderMode(font_gfx++, G_RM_CLD_SURF, G_RM_CLD_SURF2); + gDPSetPrimColor(font_gfx++, 0, a, 95, 50, 175, a); + gSPDisplayList(font_gfx++, mny_win_ueT_model); + + gDPSetRenderMode(font_gfx++, G_RM_XLU_SURF, G_RM_XLU_SURF2); + gDPSetPrimColor(font_gfx++, 0, a, 255, 245, 255, a); + gSPDisplayList(font_gfx++, mny_win_beruT_model); + + /* Draw "Bells" string (as pre-rendered image) */ + gDPSetPrimColor(font_gfx++, 0, a, 255, 245, 255, a); + gSPDisplayList(font_gfx++, mny_win_mojiT_model); + + Matrix_scale(1.0f, 1.0f, 1.0f, 0); + gSPMatrix(font_gfx++, _Matrix_to_Mtx_new(g), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + + SET_FONT_DISP(font_gfx); + + CLOSE_DISP(g); + /* Draw bell amount */ + { + u8 bell_str[7]; + f32 t; + int len; + + mFont_UnintToString(bell_str, 7, S_mybell_conf.all_money, 6, TRUE, FALSE, TRUE); + len = mMl_strlen(bell_str, 7, CHAR_SPACE); + + mFont_SetLineStrings( + game, + bell_str, 7, + 260.0f - (mFont_GetStringWidth(bell_str, len, TRUE) * 0.75f), + 48.0f, + 255, 245, 0, a, + FALSE, + TRUE, + 0.75f, 0.75f, + mFont_MODE_FONT + ); + } + } +} + +static u32 get_all_money() { + static mActor_name_t fg_name[MONEY_NUM] = { ITM_MONEY_1000, ITM_MONEY_10000, ITM_MONEY_30000, ITM_MONEY_100 }; + static u32 amount[MONEY_NUM] = { 1000, 10000, 30000, 100 }; + + u32 money = Common_Get(now_private)->inventory.wallet; + int i; + + for (i = 0; i < MONEY_NUM; i++) { + int sum = mPr_GetPossessionItemSumWithCond(Common_Get(now_private), fg_name[i], mPr_ITEM_COND_NORMAL); + money += sum * amount[i]; + } + + return money; +}