mirror of
https://github.com/ACreTeam/ac-decomp
synced 2026-05-23 06:34:18 -04:00
A lot of work on Australian version, actors still need to be sorted
This commit is contained in:
+12
-12
@@ -264,8 +264,8 @@ cflags_foresta = [
|
||||
if version_num >= 1:
|
||||
cflags_foresta.append("-O4,p")
|
||||
cflags_foresta.append("-inline off")
|
||||
config.linker_version = "GC/2.0"
|
||||
foresta_compiler = "GC/2.0"
|
||||
config.linker_version = "GC/2.6"
|
||||
foresta_compiler = "GC/2.6"
|
||||
else:
|
||||
cflags_foresta.append("-O4,s")
|
||||
config.linker_version = "GC/1.3.2"
|
||||
@@ -930,7 +930,7 @@ config.libs = [
|
||||
"foresta",
|
||||
[
|
||||
Object(Matching, "audio.c"),
|
||||
Object(Matching, "c_keyframe.c"),
|
||||
Object(MatchingFor("GAFE01_00"), "c_keyframe.c"),
|
||||
Object(Matching, "ev_cherry_manager.c"),
|
||||
Object(Matching, "evw_anime.c"),
|
||||
Object(Matching, "executor.c"),
|
||||
@@ -1387,7 +1387,7 @@ config.libs = [
|
||||
Object(Matching, "game/m_actor_shadow.c"),
|
||||
Object(Matching, "game/m_address_ovl.c"),
|
||||
Object(Matching, "game/m_all_grow.c"),
|
||||
Object(Matching, "game/m_all_grow_ovl.c"),
|
||||
Object(MatchingFor("GAFE01_00"), "game/m_all_grow_ovl.c"),
|
||||
Object(Matching, "game/m_bank_ovl.c"),
|
||||
Object(Matching, "game/m_banti.c"),
|
||||
Object(Matching, "game/m_bg_item.c"),
|
||||
@@ -1398,7 +1398,7 @@ config.libs = [
|
||||
Object(Matching, "game/m_calendar.c"),
|
||||
Object(Matching, "game/m_calendar_ovl.c"),
|
||||
Object(Matching, "game/m_camera2.c"),
|
||||
Object(Matching, "game/m_card.c"),
|
||||
Object(MatchingFor("GAFE01_00"), "game/m_card.c"),
|
||||
Object(Matching, "game/m_catalog_ovl.c"),
|
||||
Object(Matching, "game/m_choice.c"),
|
||||
Object(Matching, "game/m_clip.c"),
|
||||
@@ -1416,7 +1416,7 @@ config.libs = [
|
||||
Object(Matching, "game/m_cpwarning_ovl.c"),
|
||||
Object(Matching, "game/m_debug.c"),
|
||||
Object(Matching, "game/m_debug_display.c"),
|
||||
Object(Matching, "game/m_debug_hayakawa.c"),
|
||||
Object(MatchingFor("GAFE01"), "game/m_debug_hayakawa.c"),
|
||||
Object(Matching, "game/m_debug_mode.c"),
|
||||
Object(Matching, "game/m_demo.c"),
|
||||
Object(Matching, "game/m_design_ovl.c"),
|
||||
@@ -1425,7 +1425,7 @@ config.libs = [
|
||||
Object(Matching, "game/m_eappli.c"),
|
||||
Object(Matching, "game/m_editEndChk_ovl.c"),
|
||||
Object(Matching, "game/m_editor_ovl.c"),
|
||||
Object(Matching, "game/m_event.c"),
|
||||
Object(MatchingFor("GAFE01"), "game/m_event.c"),
|
||||
Object(Matching, "game/m_event_map_npc.c"),
|
||||
Object(Matching, "game/m_fbdemo.c"),
|
||||
Object(Matching, "game/m_fbdemo_fade.c"),
|
||||
@@ -1433,7 +1433,7 @@ config.libs = [
|
||||
Object(Matching, "game/m_fbdemo_wipe1.c"),
|
||||
Object(Matching, "game/m_field_assessment.c"),
|
||||
Object(Matching, "game/m_field_info.c"),
|
||||
Object(Matching, "game/m_field_make.c"),
|
||||
Object(MatchingFor("GAFE01"), "game/m_field_make.c"),
|
||||
Object(Matching, "game/m_fishrecord.c"),
|
||||
Object(Matching, "game/m_flashrom.c"),
|
||||
Object(Matching, "game/m_font.c"),
|
||||
@@ -1450,10 +1450,10 @@ config.libs = [
|
||||
Object(Matching, "game/m_huusui_room.c"),
|
||||
Object(Matching, "game/m_huusui_room_ovl.c"),
|
||||
Object(Matching, "game/m_inventory_ovl.c"),
|
||||
Object(Matching, "game/m_island.c"),
|
||||
Object(MatchingFor("GAFE01"), "game/m_island.c"),
|
||||
Object(Matching, "game/m_item_name.c"),
|
||||
Object(Matching, "game/m_kabu_manager.c"),
|
||||
Object(Matching, "game/m_kankyo.c"),
|
||||
Object(MatchingFor("GAFE01"), "game/m_kankyo.c"),
|
||||
Object(Matching, "game/m_land.c"),
|
||||
Object(Matching, "game/m_ledit_ovl.c"),
|
||||
Object(Matching, "game/m_lib.c"),
|
||||
@@ -1461,7 +1461,7 @@ config.libs = [
|
||||
Object(Matching, "game/m_mail.c"),
|
||||
Object(Matching, "game/m_mail_check.c"),
|
||||
Object(Matching, "game/m_mail_check_ovl.c"),
|
||||
Object(Matching, "game/m_mail_password_check.c"),
|
||||
Object(MatchingFor("GAFE01"), "game/m_mail_password_check.c"),
|
||||
Object(Matching, "game/m_mailbox_ovl.c"),
|
||||
Object(Matching, "game/m_malloc.c"),
|
||||
Object(Matching, "game/m_map_ovl.c"),
|
||||
@@ -1513,7 +1513,7 @@ config.libs = [
|
||||
Object(Matching, "game/m_string.c"),
|
||||
Object(Matching, "game/m_submenu.c"),
|
||||
Object(Matching, "game/m_submenu_ovl.c"),
|
||||
Object(Matching, "game/m_tag_ovl.c"),
|
||||
Object(MatchingFor("GAFE01_00"), "game/m_tag_ovl.c"),
|
||||
Object(Matching, "game/m_time.c"),
|
||||
Object(Matching, "game/m_timeIn_ovl.c"),
|
||||
Object(Matching, "game/m_titledemo.c"),
|
||||
|
||||
@@ -89,4 +89,4 @@ inline int __fpclassifyd(double __value)
|
||||
#define DBL_MAX_EXP 1024
|
||||
#define DBL_MAX_10_EXP 308
|
||||
|
||||
#endif /* _MSL_COMMON_FLOAT_H */
|
||||
#endif /* _MSL_COMMON_FLOAT_H */
|
||||
|
||||
@@ -21,6 +21,17 @@ extern double sin(double deg);
|
||||
extern double cos(double deg);
|
||||
extern double tan(double deg);
|
||||
|
||||
float sinf(float);
|
||||
float cosf(float);
|
||||
|
||||
inline float sinf(float x) {
|
||||
return (float)sin((double)x);
|
||||
}
|
||||
|
||||
inline float cosf(float x) {
|
||||
return (float)cos((double)x);
|
||||
}
|
||||
|
||||
extern double ceil(double);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
+2
-2
@@ -115,8 +115,8 @@ extern int sAdo_SubGameOK();
|
||||
extern void sAdo_Tenki(u8 mode);
|
||||
|
||||
extern void sAdos_KishaStatusTrg(u8 state);
|
||||
extern void sAdos_KishaStatusLevel(f32 speed, u32 ongenNum1, u16 angle1, f32 distance1, u32 ongenNum2, u16 angle2,
|
||||
f32 distance2);
|
||||
extern void sAdos_KishaStatusLevel(f32 speed, u32 ongenNum1, f32 distance1, u16 angle1, u32 ongenNum2,
|
||||
f32 distance2, u16 angle2);
|
||||
|
||||
extern int sAdos_GetRadioCounter(Radio_c* radio);
|
||||
extern void sAdos_GetKappaCounter(void* p);
|
||||
|
||||
@@ -67,6 +67,12 @@ struct OSThread
|
||||
|
||||
u8 *stackBase; // the thread's designated stack (high address)
|
||||
u32 *stackEnd; // last word of stack (low address)
|
||||
|
||||
// TODO: we should be using a newer SDK version
|
||||
#if VERSION >= VER_GAFU01_00
|
||||
s32 error;
|
||||
void* specific[2];
|
||||
#endif
|
||||
};
|
||||
|
||||
// Thread states
|
||||
|
||||
+16
-16
@@ -12,32 +12,32 @@ extern "C" {
|
||||
|
||||
#define IRQ_RESET_NORMAL 0
|
||||
#define IRQ_RESET_PRENMI 1
|
||||
#define IRQ_RESET_DELAY 2
|
||||
#define IRQ_RESET_DELAY 2
|
||||
|
||||
#define IRQMGR_MESSAGES_MAX 8
|
||||
|
||||
typedef struct {
|
||||
s16 type;
|
||||
s8 data[30];
|
||||
s16 type;
|
||||
s8 data[30];
|
||||
} irqmgr_mesg_t;
|
||||
|
||||
typedef struct irqmgr_client_s {
|
||||
struct irqmgr_client_s* next;
|
||||
OSMessageQueue* msgQueue;
|
||||
struct irqmgr_client_s* next;
|
||||
OSMessageQueue* msgQueue;
|
||||
} irqmgr_client_t;
|
||||
|
||||
typedef struct {
|
||||
irqmgr_mesg_t msgRetrace;
|
||||
irqmgr_mesg_t msgPreNMI;
|
||||
irqmgr_mesg_t msgDelayPreNMI;
|
||||
OSMessageQueue _msgQueue;
|
||||
OSMessage _msgBuf[IRQMGR_MESSAGES_MAX];
|
||||
OSThread thread;
|
||||
irqmgr_client_t* clients;
|
||||
u8 prenmi;
|
||||
OSTime prenmi_time;
|
||||
OSTimer timer;
|
||||
OSTime retraceTime;
|
||||
irqmgr_mesg_t msgRetrace;
|
||||
irqmgr_mesg_t msgPreNMI;
|
||||
irqmgr_mesg_t msgDelayPreNMI;
|
||||
OSMessageQueue _msgQueue;
|
||||
OSMessage _msgBuf[IRQMGR_MESSAGES_MAX];
|
||||
OSThread thread;
|
||||
irqmgr_client_t* clients;
|
||||
u8 prenmi;
|
||||
OSTime prenmi_time;
|
||||
OSTimer timer;
|
||||
OSTime retraceTime;
|
||||
} irqmgr_t;
|
||||
|
||||
extern void irqmgr_AddClient(irqmgr_client_t* client, OSMessageQueue* msgqueue);
|
||||
|
||||
+2
-2
@@ -22,8 +22,8 @@ extern "C" {
|
||||
|
||||
#define lbRk_KYUU_DAY_START 1
|
||||
|
||||
extern int lbRk_ToSeiyouReki(lbRTC_ymd_c* seiyo_ymd, const lbRTC_ymd_c* kyuu_ymd);
|
||||
extern int lbRk_ToKyuuReki(lbRTC_ymd_c* kyuu_ymd, const lbRTC_ymd_c* seiyo_ymd);
|
||||
extern int lbRk_ToSeiyouReki(lbRTC_ymd_c* seiyo_ymd, lbRTC_ymd_c* kyuu_ymd);
|
||||
extern int lbRk_ToKyuuReki(lbRTC_ymd_c* kyuu_ymd, lbRTC_ymd_c* seiyo_ymd);
|
||||
extern int lbRk_VernalEquinoxDay(int year);
|
||||
extern int lbRk_AutumnalEquinoxDay(int year);
|
||||
extern void lbRk_HarvestMoonDay(lbRTC_ymd_c* harvest_moon_day, int year);
|
||||
|
||||
+7
-7
@@ -339,7 +339,7 @@ extern xyz_t* Camera2_getMicPos_p(GAME_PLAY* play);
|
||||
extern int Camera2NormalState_get(GAME_PLAY* play);
|
||||
extern int Camera2_request_main_wade(GAME_PLAY* play, xyz_t* pos, int priority, f32 goal_time);
|
||||
extern int Camera2_request_main_talk(GAME_PLAY* play, ACTOR* speaker, ACTOR* listener, int priority);
|
||||
extern int Camera2_request_main_talk_pos(GAME_PLAY* play, ACTOR* speaker, xyz_t* listener_pos, int priority);
|
||||
extern int Camera2_request_main_talk_pos(GAME_PLAY* play, ACTOR* speaker, const xyz_t* const listener_pos, int priority);
|
||||
extern int Camera2_request_main_normal(GAME_PLAY* play, int flags, int priority);
|
||||
extern int Camera2_request_main_demo(GAME_PLAY* play, const xyz_t* start_center, const f32 start_dist,
|
||||
const s_xyz* start_dir, const xyz_t* goal_center, const f32 goal_dist,
|
||||
@@ -351,16 +351,16 @@ extern int Camera2_request_main_demo_fromNowPos(GAME_PLAY* play, const xyz_t* go
|
||||
extern int Camera2_request_main_demo_fromNowPos2(GAME_PLAY* play, const xyz_t* goal_center, const f32 goal_delta,
|
||||
const f32 accel_delta, const f32 braking_delta, const int priority);
|
||||
extern int Camera2_request_main_item(GAME_PLAY* play, int type, int priority);
|
||||
extern int Camera2_request_main_lock(GAME_PLAY* play, xyz_t* center_pos, xyz_t* eye_pos, f32 fov_y, int morph_counter,
|
||||
extern int Camera2_request_main_lock(GAME_PLAY* play, const xyz_t* center_pos, const xyz_t* eye_pos, f32 fov_y, int morph_counter,
|
||||
f32 near, f32 far, int priority);
|
||||
extern int Camera2_request_main_door(GAME_PLAY* play, ACTOR* door_actor, u32 flags, int priority);
|
||||
extern int Camera2_request_main_simple2(GAME_PLAY* play, xyz_t* center, s_xyz* dir, f32 dist, int morph_counter,
|
||||
extern int Camera2_request_main_simple2(GAME_PLAY* play, const xyz_t* center, const s_xyz* dir, f32 dist, int morph_counter,
|
||||
int mode, int priority);
|
||||
extern int Camera2_request_main_simple_kirin(GAME_PLAY* play, const xyz_t* center, int priority);
|
||||
extern int Camera2_request_main_simple_fishing(GAME_PLAY* play, const xyz_t* player_pos, const xyz_t* bobber_pos,
|
||||
int priority);
|
||||
extern int Camera2_request_main_simple_fishing_return(GAME_PLAY* play, xyz_t* player_pos, int priority);
|
||||
extern int Camera2_request_main_simple(GAME_PLAY* play, xyz_t* pos, s_xyz* dir, f32 dist, int morph_counter,
|
||||
extern int Camera2_request_main_simple_fishing_return(GAME_PLAY* play, const xyz_t* player_pos, int priority);
|
||||
extern int Camera2_request_main_simple(GAME_PLAY* play, const xyz_t* pos, const s_xyz* dir, f32 dist, int morph_counter,
|
||||
int priority);
|
||||
extern void Camera2_main_Simple_AngleDistStd(GAME_PLAY* play, s_xyz* angle, f32* dist);
|
||||
extern int Camera2_request_main_listen_front_low_talk(GAME_PLAY* play, ACTOR* speaker, ACTOR* listener, int priority);
|
||||
@@ -369,8 +369,8 @@ extern int Camera2_request_main_cust_talk(GAME_PLAY* play, ACTOR* speaker, ACTOR
|
||||
int priority, s16 angle_x, s16 angle_y, f32 distance);
|
||||
extern int Camera2_request_BuySikimono_WallPaper(GAME_PLAY* play, xyz_t* center, xyz_t* eye);
|
||||
extern int Camera2_Inter_set_reverse_mode(GAME_PLAY* play);
|
||||
extern int Camera2_request_main_inter(GAME_PLAY* play, xyz_t* start_center, xyz_t* start_eye, xyz_t* goal_center,
|
||||
xyz_t* goal_eye, f32 s0, f32 s1, u32 flags, int morph_counter, int priority);
|
||||
extern int Camera2_request_main_inter(GAME_PLAY* play, const xyz_t* start_center, const xyz_t* start_eye, const xyz_t* goal_center,
|
||||
const xyz_t* goal_eye, f32 s0, f32 s1, u32 flags, int morph_counter, int priority);
|
||||
extern int Camera2_request_main_staff_roll(GAME_PLAY* play, ACTOR* speaker, ACTOR* listener, int priority);
|
||||
extern void Init_Camera2(GAME_PLAY* play);
|
||||
extern void Camera2_process(GAME_PLAY* play);
|
||||
|
||||
+48
-40
@@ -74,45 +74,45 @@ enum background_attribute {
|
||||
mCoBG_ATTRIBUTE_WOOD,
|
||||
mCoBG_ATTRIBUTE_SEA,
|
||||
|
||||
mCoBG_ATTRIBUTE_25,
|
||||
mCoBG_ATTRIBUTE_26,
|
||||
mCoBG_ATTRIBUTE_27,
|
||||
mCoBG_ATTRIBUTE_28,
|
||||
mCoBG_ATTRIBUTE_29,
|
||||
mCoBG_ATTRIBUTE_30,
|
||||
mCoBG_ATTRIBUTE_31,
|
||||
mCoBG_ATTRIBUTE_32,
|
||||
mCoBG_ATTRIBUTE_33,
|
||||
mCoBG_ATTRIBUTE_34,
|
||||
mCoBG_ATTRIBUTE_35,
|
||||
mCoBG_ATTRIBUTE_36,
|
||||
mCoBG_ATTRIBUTE_37,
|
||||
mCoBG_ATTRIBUTE_38,
|
||||
mCoBG_ATTRIBUTE_39,
|
||||
mCoBG_ATTRIBUTE_40,
|
||||
mCoBG_ATTRIBUTE_41,
|
||||
mCoBG_ATTRIBUTE_42,
|
||||
mCoBG_ATTRIBUTE_43,
|
||||
mCoBG_ATTRIBUTE_44,
|
||||
mCoBG_ATTRIBUTE_45,
|
||||
mCoBG_ATTRIBUTE_46,
|
||||
mCoBG_ATTRIBUTE_47,
|
||||
mCoBG_ATTRIBUTE_48,
|
||||
mCoBG_ATTRIBUTE_49,
|
||||
mCoBG_ATTRIBUTE_50,
|
||||
mCoBG_ATTRIBUTE_51,
|
||||
mCoBG_ATTRIBUTE_52,
|
||||
mCoBG_ATTRIBUTE_53,
|
||||
mCoBG_ATTRIBUTE_54,
|
||||
mCoBG_ATTRIBUTE_55,
|
||||
mCoBG_ATTRIBUTE_56,
|
||||
mCoBG_ATTRIBUTE_57,
|
||||
mCoBG_ATTRIBUTE_58,
|
||||
mCoBG_ATTRIBUTE_59,
|
||||
mCoBG_ATTRIBUTE_60,
|
||||
mCoBG_ATTRIBUTE_61,
|
||||
mCoBG_ATTRIBUTE_62,
|
||||
mCoBG_ATTRIBUTE_63,
|
||||
mCoBG_ATTRIBUTE_25, // wave_se2
|
||||
mCoBG_ATTRIBUTE_26, // wave_sw2
|
||||
mCoBG_ATTRIBUTE_27, // wood bridge nw
|
||||
mCoBG_ATTRIBUTE_28, // wood bridge sw
|
||||
mCoBG_ATTRIBUTE_29, // wood bridge se
|
||||
mCoBG_ATTRIBUTE_30, // wood bridge ne
|
||||
mCoBG_ATTRIBUTE_31, // wood bridge center
|
||||
mCoBG_ATTRIBUTE_32, // stone bridge n
|
||||
mCoBG_ATTRIBUTE_33, // stone bridge e
|
||||
mCoBG_ATTRIBUTE_34, // stone bridge w
|
||||
mCoBG_ATTRIBUTE_35, // stone bridge s
|
||||
mCoBG_ATTRIBUTE_36, // wave_s
|
||||
mCoBG_ATTRIBUTE_37, // wave_se
|
||||
mCoBG_ATTRIBUTE_38, // wave_sw
|
||||
mCoBG_ATTRIBUTE_39, // river bank nw
|
||||
mCoBG_ATTRIBUTE_40, // river bank sw
|
||||
mCoBG_ATTRIBUTE_41, // river bank se
|
||||
mCoBG_ATTRIBUTE_42, // river bank ne
|
||||
mCoBG_ATTRIBUTE_43, // grass 3 north (river)
|
||||
mCoBG_ATTRIBUTE_44, // grass 3 east (river)
|
||||
mCoBG_ATTRIBUTE_45, // grass 3 west (river)
|
||||
mCoBG_ATTRIBUTE_46, // grass 3 south (river)
|
||||
mCoBG_ATTRIBUTE_47, // grass 4 north (cliff)
|
||||
mCoBG_ATTRIBUTE_48, // grass 4 east (cliff)
|
||||
mCoBG_ATTRIBUTE_49, // grass 4 west (cliff)
|
||||
mCoBG_ATTRIBUTE_50, // grass 4 south (cliff)
|
||||
mCoBG_ATTRIBUTE_51, // grass 4 tunnel left upper
|
||||
mCoBG_ATTRIBUTE_52, // grass 4 tunnel left lower
|
||||
mCoBG_ATTRIBUTE_53, // grass 4 tunnel right lower
|
||||
mCoBG_ATTRIBUTE_54, // grass 4 tunnel right upper
|
||||
mCoBG_ATTRIBUTE_55, // grass 3 north west (cliff)
|
||||
mCoBG_ATTRIBUTE_56, // grass 3 south west (cliff)
|
||||
mCoBG_ATTRIBUTE_57, // grass 3 south east (cliff)
|
||||
mCoBG_ATTRIBUTE_58, // grass 3 north east (cliff)
|
||||
mCoBG_ATTRIBUTE_59, // grass 3 north west (river bank)
|
||||
mCoBG_ATTRIBUTE_60, // grass 3 south west (river bank)
|
||||
mCoBG_ATTRIBUTE_61, // grass 3 south east (river bank)
|
||||
mCoBG_ATTRIBUTE_62, // grass 3 north east (river bank)
|
||||
mCoBG_ATTRIBUTE_63, // slate (slope)
|
||||
// ...
|
||||
|
||||
mCoBG_ATTRIBUTE_NONE = 100
|
||||
@@ -457,7 +457,11 @@ extern int mCoBG_CheckSandUt_ForFish(xyz_t* pos);
|
||||
extern int mCoBG_CheckSandHole_ClData(mCoBG_Collision_u* col);
|
||||
extern int mCoBG_BnumUnum2SandHole(int bx, int bz, int b_ux, int b_uz);
|
||||
extern int mCoBG_CheckHole(xyz_t pos);
|
||||
extern int mCoBG_CheckSkySwing(xyz_t pos);
|
||||
#if VERSION >= VER_GAFU01_00
|
||||
extern int mCoBG_CheckAirSwing(xyz_t pos);
|
||||
#else
|
||||
extern int mCoBG_CheckAirSwing(xyz_t pos);
|
||||
#endif
|
||||
extern int mCoBG_CheckGrassX_ClData(mCoBG_Collision_u* col);
|
||||
extern int mCoBG_CheckGrassX(const xyz_t* pos);
|
||||
extern int mCoBG_CheckWave_ClData(mCoBG_Collision_u* col);
|
||||
@@ -496,7 +500,11 @@ extern void mCoBG_Ut2SetDefaultOffset(int ux, int uz);
|
||||
|
||||
extern int mCoBG_LineCheck_RemoveFg(xyz_t* rev, xyz_t start_pos, xyz_t end_pos, mCoBG_COLUMN_CHECK_ITEM_TYPE_PROC check_proc, int line_check_type);
|
||||
|
||||
#if VERSION >= VER_GAFU01_00
|
||||
extern f32 mCoBG_Wpos2BgHeight_AngleSXXX(s_xyz* ground_angle, xyz_t pos, f32 ground_dist);
|
||||
#else
|
||||
extern f32 mCoBG_GetBgY_AngleS_FromWpos2(s_xyz* ground_angle, xyz_t pos, f32 ground_dist);
|
||||
#endif
|
||||
extern f32 mCoBG_GetWaterHeight_File(xyz_t pos, char* file, int line);
|
||||
#define mCoBG_GetWaterHeight(wpos) mCoBG_GetWaterHeight_File(wpos, __FILE__, __LINE__)
|
||||
extern int mCoBG_CheckWaterAttribute(u32 attr);
|
||||
|
||||
@@ -28,7 +28,7 @@ enum {
|
||||
extern void mEv_fishRecord_set(PersonalID_c* pid, int size);
|
||||
extern int mFR_fish_rndsize(int fish_size);
|
||||
extern int mFR_make_NpcRecord(lbRTC_hour_t hour);
|
||||
extern void mEv_fishRecord_holder(PersonalID_c* winning_pid, u32* winning_size, lbRTC_ymd_c* contest_date);
|
||||
extern void mEv_fishRecord_holder(PersonalID_c* winning_pid, u32* winning_size, const lbRTC_ymd_c* contest_date);
|
||||
extern int mEv_fishday(lbRTC_ymd_c* dates, lbRTC_time_c* time);
|
||||
extern void mFR_fishmail();
|
||||
|
||||
|
||||
@@ -24,6 +24,12 @@ extern "C" {
|
||||
#define mEnv_WIND_TERM_NUM 4u
|
||||
#define mEnv_WIND_CHANGE_RATE (f32)(10 * mTM_SECONDS_IN_MINUTE * 60) // 60fps, 10 minutes
|
||||
|
||||
#if VERSION == VER_GAFU01_00
|
||||
#define mEnv_CHANGE_WEATHER_ENV_RATE (1.0f/250.0f);
|
||||
#else
|
||||
#define mEnv_CHANGE_WEATHER_ENV_RATE (1.0f/600.0f);
|
||||
#endif
|
||||
|
||||
enum weather {
|
||||
mEnv_WEATHER_CLEAR,
|
||||
mEnv_WEATHER_RAIN,
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ extern "C" {
|
||||
|
||||
extern void mLd_StartFlagOn();
|
||||
extern int mLd_CheckStartFlag();
|
||||
extern int mLd_NullCheckLandName(const u8* land_name);
|
||||
extern int mLd_NullCheckLandName(u8* land_name);
|
||||
extern int mLd_CheckId(u16 land_id);
|
||||
extern int mLd_CheckCmpLandName(u8* name_a, u8* name_b);
|
||||
extern int mLd_CheckCmpLand(u8* name_a, u16 id_a, u8* name_b, u16 id_b);
|
||||
|
||||
@@ -2142,6 +2142,10 @@ struct player_actor_s {
|
||||
/* 0x0F24 */ u32 item_net_catch_label_request_force;
|
||||
/* 0x0F28 */ s8 item_net_catch_type_request_force;
|
||||
/* 0x0F2C */ int item_net_catch_insect_idx;
|
||||
#if VERSION >= VER_GAFU01_00
|
||||
/* 0x0F30 */ xyz_t item_net_catch_correct_pos;
|
||||
/* 0x0F3C */ int item_net_catch_correct_pos_set;
|
||||
#endif
|
||||
/* 0x0F30 */ ACTOR* fishing_rod_actor_p;
|
||||
/* 0x0F34 */ xyz_t item_rod_top_pos;
|
||||
/* 0x0F40 */ xyz_t item_rod_virtual_top_pos;
|
||||
|
||||
+1
-1
@@ -292,7 +292,7 @@ struct tag_ovl_s {
|
||||
};
|
||||
|
||||
extern int mTG_mark_main(Submenu*, mSM_MenuInfo_c*, int, int*);
|
||||
extern int mTG_mark_mainX(Submenu*, mSM_MenuInfo_c*, int, int, int, int*);
|
||||
extern int mTG_mark_mainX(Submenu*, const mSM_MenuInfo_c*, int, int, int, int*);
|
||||
|
||||
extern void mTG_tag_ovl_construct(Submenu* submenu);
|
||||
extern void mTG_tag_ovl_destruct(Submenu* submenu);
|
||||
|
||||
+1
-1
@@ -78,7 +78,7 @@ extern void mTM_set_season();
|
||||
extern int mTM_check_renew_time(u8 renew_flag);
|
||||
extern void mTM_off_renew_time(u8 renew_flag);
|
||||
extern void mTM_set_renew_is();
|
||||
extern void mTM_set_renew_time(lbRTC_ymd_c* renew_time, const lbRTC_time_c* time);
|
||||
extern void mTM_set_renew_time(lbRTC_ymd_c* renew_time, lbRTC_time_c* time);
|
||||
extern void mTM_ymd_2_time(lbRTC_time_c* time, lbRTC_ymd_c* ymd);
|
||||
extern void mTM_renewal_renew_time();
|
||||
extern void mTM_clear_renew_is();
|
||||
|
||||
@@ -8,8 +8,21 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if VERSION >= VER_GAFU01_00
|
||||
#define mTRC_SLOW_SPEED 2.6f // speed stopping/starting
|
||||
#define mTRC_FAST_SPEED 7.2f // speed when farther away from station
|
||||
#define mTRC_SLOW_RATE (0.21000001f) // rate at which slowing down occurs
|
||||
#define mTRC_STOP_RATE 0.0084f // rate at which stopping occurs
|
||||
#define mTRC_START_RATE 0.0047f // rate at which starting occurs
|
||||
#define mTRC_SPEEDUP_RATE 0.0047f // rate at which speeding up occurs
|
||||
#else
|
||||
#define mTRC_SLOW_SPEED 2.0f // speed stopping/starting
|
||||
#define mTRC_FAST_SPEED 6.0f // speed when farther away from station
|
||||
#define mTRC_SLOW_RATE 0.01f // rate at which slowing down occurs
|
||||
#define mTRC_STOP_RATE 0.005f // rate at which stopping occurs
|
||||
#define mTRC_START_RATE 0.00345f // rate at which starting occurs
|
||||
#define mTRC_SPEEDUP_RATE 0.00345f // rate at which speeding up occurs
|
||||
#endif
|
||||
|
||||
enum {
|
||||
mTRC_ACTION_NONE,
|
||||
|
||||
@@ -24,7 +24,12 @@ extern "C" {
|
||||
#define USHT_MIN ((f32)USHT_MIN_S)
|
||||
#define USHT_MAX ((f32)USHT_MAX_S)
|
||||
|
||||
#if VERSION >= VER_GAFU01_00
|
||||
extern u32 __float_max[];
|
||||
#define FLT_MAX *(float*)__float_max;
|
||||
#else
|
||||
#define FLT_MAX (3.4028235e+38f)
|
||||
#endif
|
||||
|
||||
/* Macro to generate a random float in the range of [0, n) */
|
||||
#define RANDOM_F(n) (fqrand() * (f32)(n))
|
||||
|
||||
@@ -73,13 +73,13 @@ extern f32 Math3DLength2D(f32 x0, f32 x1, f32 y0, f32 y1);
|
||||
extern f32 Math3DVecLengthSquare(xyz_t* v);
|
||||
extern f32 Math3DVecLength(xyz_t* v);
|
||||
extern f32 Math3DLengthSquare(xyz_t* a, xyz_t* b);
|
||||
extern f32 Math3DLength(xyz_t* a, xyz_t* b);
|
||||
extern void Math3DVectorProduct2Vec(const xyz_t* a, xyz_t* b, xyz_t* ret);
|
||||
extern f32 Math3DLength(const xyz_t* a, const xyz_t* b);
|
||||
extern void Math3DVectorProduct2Vec(const xyz_t* a, const xyz_t* b, xyz_t* ret);
|
||||
extern void Math3DVectorProductXYZ(xyz_t* va, xyz_t* vb, xyz_t* vc, xyz_t* ret);
|
||||
extern void Math3DPlane(xyz_t* va, xyz_t* vb, xyz_t* vc, f32* nox, f32* noy, f32* noz, f32* odist);
|
||||
extern f32 Math3DPlaneFunc(f32 nox, f32 noy, f32 noz, f32 odist, xyz_t* pl);
|
||||
extern f32 Math3DLengthPlaneAndPos(f32 nox, f32 noy, f32 noz, f32 odist, xyz_t* pl);
|
||||
extern f32 Math3DSignedLengthPlaneAndPos(f32 nox, f32 noy, f32 noz, f32 odist, xyz_t* pl);
|
||||
extern f32 Math3DPlaneFunc(f32 nox, f32 noy, f32 noz, f32 odist, const xyz_t* pl);
|
||||
extern f32 Math3DLengthPlaneAndPos(f32 nox, f32 noy, f32 noz, f32 odist, const xyz_t* pl);
|
||||
extern f32 Math3DSignedLengthPlaneAndPos(f32 nox, f32 noy, f32 noz, f32 odist, const xyz_t* pl);
|
||||
extern int Math3DTriangleCrossYCheck_general(xyz_t* v0, xyz_t* v1, xyz_t* v2, f32 z, f32 x, f32 dt, f32 dist, f32 noy);
|
||||
extern int Math3DTriangleCrossYLine_scope(xyz_t* v0, xyz_t* v1, xyz_t* v2, f32 nox, f32 noy, f32 noz, f32 dst, f32 z,
|
||||
f32 x, f32* yint, f32 y0, f32 y1);
|
||||
|
||||
+607
-458
File diff suppressed because it is too large
Load Diff
@@ -1,88 +0,0 @@
|
||||
int mCoBG_block_bgcheck_mode = mCoBG_BLOCK_BGCHECK_MODE_NORMAL;
|
||||
|
||||
extern void mCoBG_InitBlockBgCheckMode(void) {
|
||||
mCoBG_block_bgcheck_mode = mCoBG_BLOCK_BGCHECK_MODE_NORMAL;
|
||||
}
|
||||
|
||||
extern int mCoBG_ChangeBlockBgCheckMode(int mode) {
|
||||
mCoBG_block_bgcheck_mode = mode & 1;
|
||||
return mCoBG_block_bgcheck_mode;
|
||||
}
|
||||
|
||||
extern int mCoBG_GetBlockBgCheckMode(void) {
|
||||
return mCoBG_block_bgcheck_mode & 1;
|
||||
}
|
||||
|
||||
extern xyz_t mCoBG_UniqueWallCheck(ACTOR* actorx, f32 range, f32 y_ofs) {
|
||||
int bx;
|
||||
int bz;
|
||||
xyz_t ret = { 0.0f, 0.0f, 0.0f };
|
||||
|
||||
mCoBG_InitRevpos(&l_ActorInf.rev_pos);
|
||||
mCoBG_GetCurrentCenterPosition(&l_ActorInf.center_pos, actorx);
|
||||
mCoBG_GetOldCenterPosition(&l_ActorInf.old_center_pos, actorx);
|
||||
mCoBG_GetSpeedByWpos(l_ActorInf.speed_xz0, actorx);
|
||||
|
||||
if (mFI_Wpos2BlockNum(&bx, &bz, l_ActorInf.old_center_pos)) {
|
||||
xyz_t block_base = { 0.0f, 0.0f, 0.0f };
|
||||
|
||||
mCoBG_SetXyz_t(&l_ActorInf.rev_pos, 0.0f, 0.0f, 0.0f);
|
||||
mFI_BkNum2WposXZ(&block_base.x, &block_base.z, bx, bz);
|
||||
if (mCoBG_GetBlockBgCheckMode() == mCoBG_BLOCK_BGCHECK_MODE_INTRO_DEMO &&
|
||||
(mFI_BkNum2BlockKind(bx, bz) & mRF_BLOCKKIND_PLAYER) != 0
|
||||
) {
|
||||
block_base.x += mFI_UT_WORLDSIZE_X_F;
|
||||
block_base.z += mFI_UT_WORLDSIZE_Z_F;
|
||||
return mCoBG_ScopeWallCheck(actorx, &block_base, mFI_BK_WORLDSIZE_X - 2 * mFI_UT_WORLDSIZE_X, mFI_BK_WORLDSIZE_Z - 2 * mFI_UT_WORLDSIZE_Z, range, y_ofs);
|
||||
} else {
|
||||
return mCoBG_ScopeWallCheck(actorx, &block_base, mFI_BK_WORLDSIZE_X, mFI_BK_WORLDSIZE_Z, range, y_ofs);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
extern xyz_t mCoBG_ScopeWallCheck(ACTOR* actorx, const xyz_t* base_pos, f32 x, f32 z, f32 range, f32 y_ofs) {
|
||||
f32 start[2];
|
||||
f32 end[2];
|
||||
s16 rev_type;
|
||||
xyz_t rev = { 0.0f, 0.0f, 0.0f };
|
||||
|
||||
mCoBG_InitRevpos(&l_ActorInf.rev_pos);
|
||||
mCoBG_GetCurrentCenterPosition(&l_ActorInf.center_pos, actorx);
|
||||
mCoBG_GetOldCenterPosition(&l_ActorInf.old_center_pos, actorx);
|
||||
mCoBG_GetSpeedByWpos(l_ActorInf.speed_xz0, actorx);
|
||||
|
||||
if (l_ActorInf.speed_xz0[0] != 0.0f || l_ActorInf.speed_xz0[1] != 0.0f) {
|
||||
start[0] = (base_pos->x);
|
||||
start[1] = (base_pos->z);
|
||||
end[0] = start[0] + x;
|
||||
end[1] = start[1] + z;
|
||||
|
||||
start[0] += range;
|
||||
start[1] += range;
|
||||
|
||||
end[0] -= range;
|
||||
end[1] -= range;
|
||||
|
||||
mCoBG_SetXyz_t(&l_ActorInf.rev_pos, 0.0f, 0.0f, 0.0f);
|
||||
|
||||
if (l_ActorInf.center_pos.x < start[0]) {
|
||||
l_ActorInf.rev_pos.x = start[0] - l_ActorInf.center_pos.x;
|
||||
} else if (l_ActorInf.center_pos.x > end[0]) {
|
||||
l_ActorInf.rev_pos.x = end[0] - l_ActorInf.center_pos.x;
|
||||
}
|
||||
|
||||
if (l_ActorInf.center_pos.z < start[1]) {
|
||||
l_ActorInf.rev_pos.z = start[1] - l_ActorInf.center_pos.z;
|
||||
} else if (l_ActorInf.center_pos.z > end[1]) {
|
||||
l_ActorInf.rev_pos.z = end[1] - l_ActorInf.center_pos.z;
|
||||
}
|
||||
|
||||
mCoBG_GroundCheck(&l_ActorInf.rev_pos, &l_ActorInf, actorx, y_ofs, &actorx->bg_collision_check.result, NULL, FALSE);
|
||||
mCoBG_CarryOutReverse(actorx, l_ActorInf.rev_pos, mCoBG_REVERSE_TYPE_REVERSE);
|
||||
return l_ActorInf.rev_pos;
|
||||
}
|
||||
|
||||
return rev;
|
||||
}
|
||||
@@ -1,3 +1,121 @@
|
||||
// GAFU01 reworks how fg collisions are processed
|
||||
|
||||
static int mCoBG_it_is_hole(mActor_name_t item, ACTOR* actorx) {
|
||||
if (ITEM_IS_HOLE(item) || item == HOLE_SHINE || item == RSV_HOLE) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static int mCoBG_it_is_tree_level2(mActor_name_t item, ACTOR* actorx) {
|
||||
return IS_ITEM_SMALL_TREE(item) != FALSE;
|
||||
}
|
||||
|
||||
static int mCoBG_it_is_tree_level3(mActor_name_t item, ACTOR* actorx) {
|
||||
return IS_ITEM_MED_TREE(item) != FALSE;
|
||||
}
|
||||
|
||||
static int mCoBG_it_is_tree_level4(mActor_name_t item, ACTOR* actorx) {
|
||||
return IS_ITEM_LARGE_TREE(item) != FALSE;
|
||||
}
|
||||
|
||||
static int mCoBG_it_is_tree_level5(mActor_name_t item, ACTOR* actorx) {
|
||||
return IS_ITEM_FULL_TREE(item) != FALSE;
|
||||
}
|
||||
|
||||
static int mCoBG_it_is_stump0(mActor_name_t item, ACTOR* actorx) {
|
||||
// OK, this is just bad. There was no need to wastefully use the
|
||||
// 'IS_ITEM_TREE_STUMP' macro only to filter out the size 0 stumps.
|
||||
if (IS_ITEM_TREE_STUMP(item) && (item == TREE_STUMP001 || item == TREE_PALM_STUMP001 || item == CEDAR_TREE_STUMP001 || item == GOLD_TREE_STUMP001)) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static int mCoBG_it_is_stump1(mActor_name_t item, ACTOR* actorx) {
|
||||
// This just keeps getting worse haha
|
||||
if (IS_ITEM_TREE_STUMP(item) && !mCoBG_it_is_stump0(item, actorx)) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static int mCoBG_it_is_stone(mActor_name_t item, ACTOR* actorx) {
|
||||
return (IS_ITEM_STONE(item) || IS_ITEM_STONE_TC(item)) != FALSE;
|
||||
}
|
||||
|
||||
static int mCoBG_it_is_post(mActor_name_t item, ACTOR* actorx) {
|
||||
if (item == DUMMY_MAILBOX0 || item == DUMMY_MAILBOX1 || item == DUMMY_MAILBOX2 || item == DUMMY_MAILBOX3) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static int mCoBG_it_is_sign(mActor_name_t item, ACTOR* actorx) {
|
||||
if (item == DUMMY_RESERVE || ITEM_IS_SIGNBOARD(item)) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static int mCoBG_it_is_sign_dummy(mActor_name_t item, ACTOR* actorx) {
|
||||
return item == RSV_SIGNBOARD;
|
||||
}
|
||||
|
||||
static int mCoBG_it_is_flag(mActor_name_t item, ACTOR* actorx) {
|
||||
if (item == DUMMY_KOINOBORI || item == DUMMY_FLAG) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
typedef int (*mCoBG_COL_ITEM_CHK_PROC)(mActor_name_t item, ACTOR* actorx);
|
||||
|
||||
typedef struct {
|
||||
mCoBG_COL_ITEM_CHK_PROC chk_proc;
|
||||
f32 radius;
|
||||
f32 height;
|
||||
int chk_old_on_ground;
|
||||
} mCoBG_fg_collision_data_c;
|
||||
|
||||
static mCoBG_fg_collision_data_c mCoBG_fg_collision_data[] = {
|
||||
// clang-format off
|
||||
{ mCoBG_it_is_hole, 19.0f, 0.0f, TRUE },
|
||||
{ mCoBG_it_is_tree_level2, 19.0f, 30.0f, FALSE },
|
||||
{ mCoBG_it_is_tree_level3, 19.0f, 40.0f, FALSE },
|
||||
{ mCoBG_it_is_tree_level4, 19.0f, 60.0f, FALSE },
|
||||
{ mCoBG_it_is_tree_level5, 19.0f, 80.0f, FALSE },
|
||||
{ mCoBG_it_is_stump0, 10.0f, 30.0f, FALSE },
|
||||
{ mCoBG_it_is_stump1, 18.0f, 30.0f, FALSE },
|
||||
{ mCoBG_it_is_stone, 19.0f, 31.5f, FALSE },
|
||||
{ mCoBG_it_is_post, 15.0f, 50.0f, FALSE },
|
||||
{ mCoBG_it_is_sign, 19.0f, 45.0f, FALSE },
|
||||
{ mCoBG_it_is_sign_dummy, 10.0f, 45.0f, FALSE },
|
||||
{ mCoBG_it_is_flag, 19.0f, 160.0f, FALSE },
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
static mCoBG_fg_collision_data_c* mCoBG_get_fg_collision_data_p(ACTOR* actorx, mActor_name_t item) {
|
||||
u32 i;
|
||||
mCoBG_fg_collision_data_c* col_p = mCoBG_fg_collision_data;
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(mCoBG_fg_collision_data); i++) {
|
||||
if (col_p->chk_proc(item, actorx) == TRUE) {
|
||||
return col_p;
|
||||
}
|
||||
|
||||
col_p++;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
xyz_t pos;
|
||||
int in_use;
|
||||
@@ -133,153 +251,31 @@ extern void mCoBG_CrossOffDecalCircle(int idx) {
|
||||
}
|
||||
}
|
||||
|
||||
static int mCoBG_MakeOneColumnCollisionData(mCoBG_column_c* col, mCoBG_UnitInfo_c* ut_info, int old_on_ground, mCoBG_COLUMN_CHECK_ITEM_TYPE_PROC check_proc, int ux, int uz) {
|
||||
// GAFU01 passes in the actor and uses data driven approach
|
||||
// to process
|
||||
static int mCoBG_MakeOneColumnCollisionData(ACTOR* actorx, mCoBG_column_c* col, mCoBG_UnitInfo_c* ut_info, int old_on_ground, mCoBG_COLUMN_CHECK_ITEM_TYPE_PROC check_proc, int ux, int uz) {
|
||||
if ((check_proc != NULL && (*check_proc)(ut_info->item) == FALSE) || check_proc == NULL) {
|
||||
mCoBG_fg_collision_data_c* col_data_p;
|
||||
|
||||
if (ut_info->ut_x == ux && ut_info->ut_z == uz) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (old_on_ground == TRUE && (ITEM_IS_HOLE(ut_info->item) || ut_info->item == HOLE_SHINE || ut_info->item == RSV_HOLE)) {
|
||||
col->pos.x = mFI_UT_WORLDSIZE_HALF_X_F + mFI_UT_WORLDSIZE_X_F * ut_info->ut_x;
|
||||
col->pos.z = mFI_UT_WORLDSIZE_HALF_Z_F + mFI_UT_WORLDSIZE_Z_F * ut_info->ut_z;
|
||||
col->pos.y = 0.0f;
|
||||
col->ux = ut_info->ut_x;
|
||||
col->uz = ut_info->ut_z;
|
||||
col->pos.y = mCoBG_GetBgY_OnlyCenter_FromWpos2(col->pos, 0.0f);
|
||||
col->height = col->pos.y;
|
||||
col->radius = 19.0f;
|
||||
col->atr_wall = TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (IS_ITEM_SMALL_TREE(ut_info->item)) {
|
||||
col->pos.x = mFI_UT_WORLDSIZE_HALF_X_F + mFI_UT_WORLDSIZE_X_F * ut_info->ut_x;
|
||||
col->pos.z = mFI_UT_WORLDSIZE_HALF_Z_F + mFI_UT_WORLDSIZE_Z_F * ut_info->ut_z;
|
||||
col->pos.y = 0.0f;
|
||||
col->pos.y = mCoBG_GetBgY_OnlyCenter_FromWpos2(col->pos, 0.0f);
|
||||
col->height = col->pos.y + 30.0f;
|
||||
col->ux = ut_info->ut_x;
|
||||
col->uz = ut_info->ut_z;
|
||||
col->radius = 19.0f;
|
||||
col->atr_wall = FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (IS_ITEM_MED_TREE(ut_info->item)) {
|
||||
col->pos.x = mFI_UT_WORLDSIZE_HALF_X_F + mFI_UT_WORLDSIZE_X_F * ut_info->ut_x;
|
||||
col->pos.z = mFI_UT_WORLDSIZE_HALF_Z_F + mFI_UT_WORLDSIZE_Z_F * ut_info->ut_z;
|
||||
col->pos.y = 0.0f;
|
||||
col->pos.y = mCoBG_GetBgY_OnlyCenter_FromWpos2(col->pos, 0.0f);
|
||||
col->height = col->pos.y + 40.0f;
|
||||
col->ux = ut_info->ut_x;
|
||||
col->uz = ut_info->ut_z;
|
||||
col->radius = 19.0f;
|
||||
col->atr_wall = FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (IS_ITEM_LARGE_TREE(ut_info->item)) {
|
||||
col->pos.x = mFI_UT_WORLDSIZE_HALF_X_F + mFI_UT_WORLDSIZE_X_F * ut_info->ut_x;
|
||||
col->pos.z = mFI_UT_WORLDSIZE_HALF_Z_F + mFI_UT_WORLDSIZE_Z_F * ut_info->ut_z;
|
||||
col->pos.y = 0.0f;
|
||||
col->pos.y = mCoBG_GetBgY_OnlyCenter_FromWpos2(col->pos, 0.0f);
|
||||
col->height = col->pos.y + 60.0f;
|
||||
col->ux = ut_info->ut_x;
|
||||
col->uz = ut_info->ut_z;
|
||||
col->radius = 19.0f;
|
||||
col->atr_wall = FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (IS_ITEM_FULL_TREE(ut_info->item) || ut_info->item == RSV_TREE) {
|
||||
col->pos.x = mFI_UT_WORLDSIZE_HALF_X_F + mFI_UT_WORLDSIZE_X_F * ut_info->ut_x;
|
||||
col->pos.z = mFI_UT_WORLDSIZE_HALF_Z_F + mFI_UT_WORLDSIZE_Z_F * ut_info->ut_z;
|
||||
col->pos.y = 0.0f;
|
||||
col->pos.y = mCoBG_GetBgY_OnlyCenter_FromWpos2(col->pos, 0.0f);
|
||||
col->height = col->pos.y + 80.0f;
|
||||
col->ux = ut_info->ut_x;
|
||||
col->uz = ut_info->ut_z;
|
||||
col->radius = 19.0f;
|
||||
col->atr_wall = FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (IS_ITEM_TREE_STUMP(ut_info->item)) {
|
||||
col->pos.x = mFI_UT_WORLDSIZE_HALF_X_F + mFI_UT_WORLDSIZE_X_F * ut_info->ut_x;
|
||||
col->pos.z = mFI_UT_WORLDSIZE_HALF_Z_F + mFI_UT_WORLDSIZE_Z_F * ut_info->ut_z;
|
||||
col->pos.y = 0.0f;
|
||||
col->pos.y = mCoBG_GetBgY_OnlyCenter_FromWpos2(col->pos, 0.0f);
|
||||
col->ux = ut_info->ut_x;
|
||||
col->uz = ut_info->ut_z;
|
||||
|
||||
if (ut_info->item == TREE_STUMP001 || ut_info->item == TREE_PALM_STUMP001 || ut_info->item == CEDAR_TREE_STUMP001 || ut_info->item == GOLD_TREE_STUMP001) {
|
||||
col->radius = 10.0f;
|
||||
col->height = col->pos.y + 30.0f;
|
||||
} else {
|
||||
col->radius = 18.0f;
|
||||
col->height = col->pos.y + 30.0f;
|
||||
col_data_p = mCoBG_get_fg_collision_data_p(actorx, ut_info->item);
|
||||
if (col_data_p != NULL) {
|
||||
if (col_data_p->chk_old_on_ground == TRUE && old_on_ground != TRUE) {
|
||||
return FALSE;
|
||||
}
|
||||
col->atr_wall = FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (IS_ITEM_ROCK(ut_info->item)) {
|
||||
col->pos.x = mFI_UT_WORLDSIZE_HALF_X_F + mFI_UT_WORLDSIZE_X_F * ut_info->ut_x;
|
||||
col->pos.z = mFI_UT_WORLDSIZE_HALF_Z_F + mFI_UT_WORLDSIZE_Z_F * ut_info->ut_z;
|
||||
col->pos.y = mCoBG_GetBgY_OnlyCenter_FromWpos2(col->pos, 0.0f);
|
||||
col->pos.x = ut_info->ut_x * mFI_UT_WORLDSIZE_X_F + mFI_UT_WORLDSIZE_HALF_X_F;
|
||||
col->pos.z = ut_info->ut_z * mFI_UT_WORLDSIZE_Z_F + mFI_UT_WORLDSIZE_HALF_Z_F;
|
||||
col->pos.y = 0.0f;
|
||||
col->ux = ut_info->ut_x;
|
||||
col->uz = ut_info->ut_z;
|
||||
col->radius = 19.0f;
|
||||
col->height = col->pos.y + 31.5f;
|
||||
col->atr_wall = FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (ut_info->item == DUMMY_MAILBOX0 || ut_info->item == DUMMY_MAILBOX1 || ut_info->item == DUMMY_MAILBOX2 || ut_info->item == DUMMY_MAILBOX3) {
|
||||
col->pos.x = mFI_UT_WORLDSIZE_HALF_X_F + mFI_UT_WORLDSIZE_X_F * ut_info->ut_x;
|
||||
col->pos.z = mFI_UT_WORLDSIZE_HALF_Z_F + mFI_UT_WORLDSIZE_Z_F * ut_info->ut_z;
|
||||
col->pos.y = mCoBG_GetBgY_OnlyCenter_FromWpos2(col->pos, 0.0f);
|
||||
col->ux = ut_info->ut_x;
|
||||
col->uz = ut_info->ut_z;
|
||||
col->radius = 15.0f;
|
||||
col->height = col->pos.y + 50.0f;
|
||||
col->atr_wall = FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (ITEM_IS_SIGN(ut_info->item)) {
|
||||
col->pos.x = mFI_UT_WORLDSIZE_HALF_X_F + mFI_UT_WORLDSIZE_X_F * ut_info->ut_x;
|
||||
col->pos.z = mFI_UT_WORLDSIZE_HALF_Z_F + mFI_UT_WORLDSIZE_Z_F * ut_info->ut_z;
|
||||
col->pos.y = mCoBG_GetBgY_OnlyCenter_FromWpos2(col->pos, 0.0f);
|
||||
col->radius = 19.0f;
|
||||
col->height = col->pos.y + 45.0f;
|
||||
col->ux = ut_info->ut_x;
|
||||
col->uz = ut_info->ut_z;
|
||||
col->atr_wall = FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (ut_info->item == RSV_SIGNBOARD) {
|
||||
col->pos.x = mFI_UT_WORLDSIZE_HALF_X_F + mFI_UT_WORLDSIZE_X_F * ut_info->ut_x;
|
||||
col->pos.z = mFI_UT_WORLDSIZE_HALF_Z_F + mFI_UT_WORLDSIZE_Z_F * ut_info->ut_z;
|
||||
col->pos.y = mCoBG_GetBgY_OnlyCenter_FromWpos2(col->pos, 0.0f);
|
||||
col->radius = 10.0f;
|
||||
col->height = col->pos.y + 45.0f;
|
||||
col->ux = ut_info->ut_x;
|
||||
col->uz = ut_info->ut_z;
|
||||
col->atr_wall = FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (ut_info->item == DUMMY_KOINOBORI || ut_info->item == DUMMY_FLAG) {
|
||||
col->pos.x = mFI_UT_WORLDSIZE_HALF_X_F + mFI_UT_WORLDSIZE_X_F * ut_info->ut_x;
|
||||
col->pos.z = mFI_UT_WORLDSIZE_HALF_Z_F + mFI_UT_WORLDSIZE_Z_F * ut_info->ut_z;
|
||||
col->pos.y = mCoBG_GetBgY_OnlyCenter_FromWpos2(col->pos, 0.0f);
|
||||
col->radius = 19.0f;
|
||||
col->height = col->pos.y + 160.0f;
|
||||
col->ux = ut_info->ut_x;
|
||||
col->uz = ut_info->ut_z;
|
||||
col->atr_wall = FALSE;
|
||||
col->height = col->pos.y + col_data_p->height;
|
||||
col->radius = col_data_p->radius;
|
||||
col->atr_wall = col_data_p->chk_old_on_ground;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
@@ -287,16 +283,19 @@ static int mCoBG_MakeOneColumnCollisionData(mCoBG_column_c* col, mCoBG_UnitInfo_
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void mCoBG_MakeColumnCollisionData(mCoBG_column_c* col, int* col_count_p, mCoBG_UnitInfo_c* ut_info, int count, int old_on_ground, mCoBG_COLUMN_CHECK_ITEM_TYPE_PROC check_item_proc, int ux, int uz) {
|
||||
// GAFU01 passes in the actor
|
||||
static void mCoBG_MakeColumnCollisionData(ACTOR* actorx, mCoBG_column_c* col, int* col_count_p, mCoBG_UnitInfo_c* ut_info, int count, int old_on_ground, mCoBG_COLUMN_CHECK_ITEM_TYPE_PROC check_item_proc, int ux, int uz) {
|
||||
int count_sq = SQ(count);
|
||||
int i;
|
||||
|
||||
*col_count_p = 0;
|
||||
for (i = 0; i < count_sq; i++) {
|
||||
if (*col_count_p < 16) {
|
||||
mCoBG_MakeOneColumnCollisionData(col, ut_info, old_on_ground, check_item_proc, ux, uz);
|
||||
col++;
|
||||
(*col_count_p)++;
|
||||
// GAFU01 checks the collision exists instead of just processing it always
|
||||
if (mCoBG_MakeOneColumnCollisionData(actorx, col, ut_info, old_on_ground, check_item_proc, ux, uz)) {
|
||||
col++;
|
||||
(*col_count_p)++;
|
||||
}
|
||||
}
|
||||
|
||||
ut_info++;
|
||||
@@ -444,7 +443,7 @@ static void mCoBG_ColumnWallCheck(xyz_t* rev, mCoBG_ActorInf_c* actor_info, cons
|
||||
static f32 mCoBG_GetBGHeight_Column(const xyz_t* pos, mCoBG_UnitInfo_c* ut_info) {
|
||||
mCoBG_column_c col;
|
||||
|
||||
if (mCoBG_MakeOneColumnCollisionData(&col, ut_info, FALSE, NULL, -1, -1) && mCoBG_JudgePointInCircle_Xyz(pos, &col.pos, col.radius)) {
|
||||
if (mCoBG_MakeOneColumnCollisionData(NULL, &col, ut_info, FALSE, NULL, -1, -1) && mCoBG_JudgePointInCircle_Xyz(pos, &col.pos, col.radius)) {
|
||||
return col.height;
|
||||
}
|
||||
|
||||
@@ -553,11 +552,12 @@ static int mCoBG_LineGroundCheck_Column(xyz_t* rev, mCoBG_column_c* col, int col
|
||||
tmp_end.z = end_pos->z + reverse.z;
|
||||
|
||||
reverse = reverse0;
|
||||
vec_y = col->height - tmp_end.y;
|
||||
|
||||
vec_end_start.x = start_pos->x - tmp_end.x;
|
||||
vec_end_start.y = start_pos->y - tmp_end.y;
|
||||
vec_end_start.z = start_pos->z - tmp_end.z;
|
||||
|
||||
vec_y = col->height - tmp_end.y;
|
||||
if (!F32_IS_ZERO(vec_end_start.y)) {
|
||||
f32 mult = vec_y / vec_end_start.y;
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ extern f32 mCoBG_Wpos2BgUtCenterHeight_AddColumn(xyz_t pos) {
|
||||
mCoBG_column_c column;
|
||||
|
||||
mCoBG_Wpos2UnitInfo(&ut_info, pos);
|
||||
if (mCoBG_MakeOneColumnCollisionData(&column, &ut_info, FALSE, NULL, -1, -1)) {
|
||||
if (mCoBG_MakeOneColumnCollisionData(NULL, &column, &ut_info, FALSE, NULL, -1, -1)) {
|
||||
return column.height;
|
||||
}
|
||||
|
||||
@@ -160,11 +160,12 @@ extern int mCoBG_ScrollCheck(xyz_t start, xyz_t end, f32 radius) {
|
||||
{
|
||||
mCoBG_column_c* col2;
|
||||
int count;
|
||||
int i;
|
||||
|
||||
column = l_VecInf.column;
|
||||
mCoBG_MakeColumnCollisionData(column, &l_VecInf.col_count, l_crtutInf, 3, TRUE, NULL, -1, -1);
|
||||
mCoBG_MakeColumnCollisionData(NULL, column, &l_VecInf.col_count, l_crtutInf, 3, TRUE, NULL, -1, -1);
|
||||
count = l_VecInf.col_count;
|
||||
if (count != 0) {
|
||||
if (count > 0) {
|
||||
col2 = column;
|
||||
for (i = 0; i < count; i++) {
|
||||
f32 dx = end.x - col2->pos.x;
|
||||
@@ -597,7 +598,7 @@ extern int mCoBG_CheckHole(xyz_t pos) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
extern int mCoBG_CheckSkySwing(xyz_t pos) {
|
||||
extern int mCoBG_CheckAirSwing(xyz_t pos) {
|
||||
mCoBG_Collision_u* col = mFI_GetUnitCol(pos);
|
||||
u32 attr = col->data.unit_attribute;
|
||||
|
||||
@@ -779,7 +780,7 @@ extern int mCoBG_SearchWaterLimitDistN(xyz_t* water_pos, xyz_t pos, s16 angle, f
|
||||
|
||||
if (water_count == ARRAY_COUNT(offset)) {
|
||||
*water_pos = search;
|
||||
water_pos->y = mCoBG_GetWaterHeight_File(search, __FILE__, 1137);
|
||||
water_pos->y = mCoBG_GetWaterHeight_File(search, __FILE__, 1310);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -819,6 +820,7 @@ extern int mCoBG_CheckRoughPathInRoom(const xyz_t* pos) {
|
||||
return p;
|
||||
}
|
||||
|
||||
// GAFU01 checks for sea wave attributes
|
||||
extern f32 mCoBG_GetBalloonGroundY(const xyz_t* pos) {
|
||||
mCoBG_UnitInfo_c ut_info;
|
||||
s_xyz normal_ground_angle;
|
||||
@@ -832,7 +834,8 @@ extern f32 mCoBG_GetBalloonGroundY(const xyz_t* pos) {
|
||||
u32 block_kind = mFI_BkNum2BlockKind(bx, bz);
|
||||
|
||||
if ((block_kind & mRF_BLOCKKIND_MARINE) != 0) {
|
||||
if (mCoBG_CheckWaterAttribute(attr) == TRUE || attr == mCoBG_ATTRIBUTE_WAVE || attr == mCoBG_ATTRIBUTE_SAND || attr == mCoBG_ATTRIBUTE_SEA) {
|
||||
if (mCoBG_CheckWaterAttribute(attr) == TRUE || attr == mCoBG_ATTRIBUTE_WAVE || attr == mCoBG_ATTRIBUTE_SAND ||
|
||||
attr == mCoBG_ATTRIBUTE_SEA || attr == mCoBG_ATTRIBUTE_37 || attr == mCoBG_ATTRIBUTE_38) {
|
||||
return mFI_UNIT_BASE_SIZE_F;
|
||||
}
|
||||
}
|
||||
@@ -894,13 +897,7 @@ static f32 mCoBG_CheckBallRollingAreaRate(const xyz_t* pos, const xyz_t* start_p
|
||||
f32 dist_start_cross_x = cross[0] - start[0];
|
||||
f32 dist_start_cross_z = cross[1] - start[1];
|
||||
f32 dist_start_cross = sqrtf(SQ(dist_start_cross_x) + SQ(dist_start_cross_z));
|
||||
f32 rate;
|
||||
|
||||
if (F32_IS_ZERO(dist_start_end) == FALSE) {
|
||||
rate = dist_start_cross / dist_start_end;
|
||||
} else {
|
||||
rate = -1.0f;
|
||||
}
|
||||
f32 rate = !F32_IS_ZERO(dist_start_end) ? dist_start_cross / dist_start_end : -1.0f;
|
||||
|
||||
if (mCoBG_RangeCheckLinePoint(start, end, cross) == FALSE) {
|
||||
rate = -1.0f;
|
||||
@@ -1144,3 +1141,477 @@ extern int mCoBG_Height2GetLayer(f32 height) {
|
||||
extern int mCoBG_GetLayer(const xyz_t* pos) {
|
||||
return mCoBG_Height2GetLayer(mCoBG_GetBgY_OnlyCenter_FromWpos2(*pos, 0.0f));
|
||||
}
|
||||
|
||||
// GAFU01 renames mCoBG_GetBgY_AngleS_FromWpos2 to this
|
||||
extern f32 mCoBG_Wpos2BgHeight_AngleSXXX(s_xyz* ground_angle, xyz_t pos, f32 ground_dist) {
|
||||
mCoBG_UnitInfo_c ut_info;
|
||||
s_xyz normal_ground_angle;
|
||||
f32 normal_y;
|
||||
f32 column_y;
|
||||
static s_xyz ground_angle0 = { 0, 0, 0 };
|
||||
f32 t0;
|
||||
f32 t1;
|
||||
f32 ret;
|
||||
|
||||
if (ground_angle != NULL) {
|
||||
*ground_angle = ground_angle0;
|
||||
}
|
||||
|
||||
mCoBG_Wpos2UnitInfo(&ut_info, pos);
|
||||
normal_y = mCoBG_GetBGHeight_Normal(&normal_ground_angle, &ut_info);
|
||||
column_y = mCoBG_GetBGHeight_Column(&pos, &ut_info);
|
||||
|
||||
if (ground_angle != NULL && normal_y >= column_y && normal_y >= -100.0f) {
|
||||
*ground_angle = normal_ground_angle;
|
||||
return normal_y - ground_dist;
|
||||
}
|
||||
|
||||
t0 = MAX(normal_y, -100.0f);
|
||||
t1 = MAX(normal_y, column_y);
|
||||
if (t1 > t0) {
|
||||
ret = MAX(normal_y, column_y);
|
||||
} else {
|
||||
ret = MAX(normal_y, -100.0f);
|
||||
}
|
||||
|
||||
return ret - ground_dist;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// GAFU01 adds checks for sea attributes when checking from bridge tiles
|
||||
extern f32 mCoBG_GetWaterHeight_File(xyz_t pos, char* file, int line) {
|
||||
u32 attr;
|
||||
int ux;
|
||||
int uz;
|
||||
mCoBG_Collision_u* col;
|
||||
xyz_t mod_pos = pos;
|
||||
|
||||
mFI_Wpos2UtNum(&ux, &uz, pos);
|
||||
col = mFI_UtNum2UtCol(ux, uz);
|
||||
attr = col->data.unit_attribute;
|
||||
|
||||
if (attr == mCoBG_ATTRIBUTE_SEA || attr == mCoBG_ATTRIBUTE_37 || attr == mCoBG_ATTRIBUTE_38) {
|
||||
return 20.0f;
|
||||
}
|
||||
|
||||
if (attr >= mCoBG_ATTRIBUTE_WATER && attr <= mCoBG_ATTRIBUTE_RIVER_NE) {
|
||||
return 20.0f + mCoBG_Wpos2BgHeight_AngleSXXX(NULL, pos, 0.0f);
|
||||
}
|
||||
|
||||
if (attr >= mCoBG_ATTRIBUTE_27 && attr <= mCoBG_ATTRIBUTE_35) {
|
||||
int idx = attr - mCoBG_ATTRIBUTE_27;
|
||||
int search = mCoBG_bridge_search_water[idx];
|
||||
u32 new_attr;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < mSc_DIRECT_NUM; i++) {
|
||||
if ((search & (1 << i)) != 0) {
|
||||
int ux;
|
||||
int uz;
|
||||
|
||||
mCoBG_PlussDirectOffset(&mod_pos, pos, i);
|
||||
mFI_Wpos2UtNum(&ux, &uz, mod_pos);
|
||||
new_attr = mFI_UtNum2UtCol(ux, uz)->data.unit_attribute;
|
||||
|
||||
if (new_attr == mCoBG_ATTRIBUTE_SEA || new_attr == mCoBG_ATTRIBUTE_37 || new_attr == mCoBG_ATTRIBUTE_38) {
|
||||
return 20.0f;
|
||||
}
|
||||
|
||||
if (new_attr >= mCoBG_ATTRIBUTE_WATER && new_attr <= mCoBG_ATTRIBUTE_RIVER_NE) {
|
||||
return 20.0f + mCoBG_Wpos2BgHeight_AngleSXXX(NULL, mod_pos, 0.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (attr >= mCoBG_ATTRIBUTE_39 && attr <= mCoBG_ATTRIBUTE_42) {
|
||||
u32 attr2 = mCoBG_Wpos2Attribute(pos, NULL);
|
||||
|
||||
if (attr2 >= mCoBG_ATTRIBUTE_WATER && attr2 <= mCoBG_ATTRIBUTE_RIVER_NE) {
|
||||
int i;
|
||||
u32 new_attr;
|
||||
xyz_t new_pos;
|
||||
int idx = attr - mCoBG_ATTRIBUTE_39;
|
||||
int search = mCoBG_grass3_search_water[idx];
|
||||
|
||||
for (i = 0; i < mSc_DIRECT_NUM; i++) {
|
||||
if ((search & (1 << i)) != 0) {
|
||||
int ux;
|
||||
int uz;
|
||||
|
||||
mCoBG_PlussDirectOffset(&new_pos, pos, i);
|
||||
mFI_Wpos2UtNum(&ux, &uz, new_pos);
|
||||
new_attr = mFI_UtNum2UtCol(ux, uz)->data.unit_attribute;
|
||||
|
||||
if (new_attr >= mCoBG_ATTRIBUTE_WATER && new_attr <= mCoBG_ATTRIBUTE_RIVER_NE) {
|
||||
return 20.0f + mCoBG_Wpos2BgHeight_AngleSXXX(NULL, new_pos, 0.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return -100.0f;
|
||||
}
|
||||
|
||||
// GAFU01 checks two missing sea attributes
|
||||
extern int mCoBG_CheckWaterAttribute(u32 attr) {
|
||||
if (attr == mCoBG_ATTRIBUTE_SEA || attr == mCoBG_ATTRIBUTE_37 || attr == mCoBG_ATTRIBUTE_38) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (attr >= mCoBG_ATTRIBUTE_WATER && attr <= mCoBG_ATTRIBUTE_RIVER_NE) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
extern int mCoBG_CheckWaterAttribute_OutOfSea(u32 attr) {
|
||||
return (attr >= mCoBG_ATTRIBUTE_WATER && attr <= mCoBG_ATTRIBUTE_RIVER_NE) != FALSE;
|
||||
}
|
||||
|
||||
static f32 mCoBG_wave_cos = 0.0f;
|
||||
|
||||
extern void mCoBG_WaveCos2BgCheck(f32 value) {
|
||||
mCoBG_wave_cos = value;
|
||||
}
|
||||
|
||||
extern f32 mCoBG_WaveCos(void) {
|
||||
return mCoBG_wave_cos;
|
||||
}
|
||||
|
||||
extern int mCoBG_GetWaterFlow(xyz_t* flow, u32 attr) {
|
||||
static xyz_t flow_data[] = {
|
||||
{0.0f, 0.0f, 0.0f},
|
||||
{0.0f, -5.0f, 0.0f},
|
||||
{0.0f, 0.0f, -0.5f},
|
||||
{-0.35355338f, 0.0f, -0.35355338f},
|
||||
{-0.5f, 0.0f, 0.0f},
|
||||
{-0.35355338f, 0.0f, 0.35355338f},
|
||||
{0.0f, 0.0f, 0.5f},
|
||||
{0.35355338f, 0.0f, 0.35355338f},
|
||||
{0.5f, 0.0f, 0.0f},
|
||||
{0.35355338f, 0.0f, -0.35355338f},
|
||||
};
|
||||
|
||||
if (attr == mCoBG_ATTRIBUTE_SEA) {
|
||||
static const xyz_t sea_flow = { 0.0f, 0.0f, -1.0f };
|
||||
|
||||
*flow = sea_flow;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (mCoBG_CheckWaterAttribute(attr)) {
|
||||
int idx = attr - mCoBG_ATTRIBUTE_WATER;
|
||||
|
||||
*flow = flow_data[idx];
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
*flow = flow_data[0];
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
extern int mCoBG_CheckWaveAttr(u32 attr) {
|
||||
switch (attr) {
|
||||
case mCoBG_ATTRIBUTE_WAVE:
|
||||
case mCoBG_ATTRIBUTE_36:
|
||||
case mCoBG_ATTRIBUTE_25:
|
||||
case mCoBG_ATTRIBUTE_26:
|
||||
return TRUE;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
// @unused, @fabricated
|
||||
extern int mCoBG_CheckSand2Sea(xyz_t* pos) {
|
||||
u32 attr = mCoBG_Wpos2BgAttribute_Original(*pos);
|
||||
|
||||
if (attr == mCoBG_ATTRIBUTE_SEA || mCoBG_CheckWaveAttr(attr)) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
static u32 mCoBG_OffsetInRule(int ofs) {
|
||||
if (ofs > 31) {
|
||||
return 31;
|
||||
}
|
||||
|
||||
return CLAMP(ofs, 0, ofs);
|
||||
}
|
||||
|
||||
static void mCoBG_SetBestBgY(mCoBG_Collision_u* col, s16* change_ofs) {
|
||||
u32 max = mCoBG_GetMaxOffset(col->data.center, col->data.top_left, col->data.bot_left, col->data.bot_right, col->data.top_right);
|
||||
u32 min = mCoBG_GetMinOffset(col->data.center, col->data.top_left, col->data.bot_left, col->data.bot_right, col->data.top_right);
|
||||
}
|
||||
|
||||
static void mCoBG_TidyChangeOffset(s16* change_ofs, mCoBG_Collision_u* col) {
|
||||
if (
|
||||
// clang-format off
|
||||
col->data.center + *change_ofs > 31 ||
|
||||
col->data.top_left + *change_ofs > 31 ||
|
||||
col->data.bot_left + *change_ofs > 31 ||
|
||||
col->data.bot_right + *change_ofs > 31 ||
|
||||
col->data.top_right + *change_ofs > 31 ||
|
||||
col->data.center + *change_ofs < 0 ||
|
||||
col->data.top_left + *change_ofs < 0 ||
|
||||
col->data.bot_left + *change_ofs < 0 ||
|
||||
col->data.bot_right + *change_ofs < 0 ||
|
||||
col->data.top_right + *change_ofs < 0
|
||||
// clang-format on
|
||||
) {
|
||||
mCoBG_SetBestBgY(col, change_ofs);
|
||||
}
|
||||
}
|
||||
|
||||
// @unused, @fabricated
|
||||
extern void mCoBG_Ut2SetPlussOffset(int ux, int uz, s16 change_ofs, s16 attr) {
|
||||
xyz_t pos = { 0.0f, 0.0f, 0.0f };
|
||||
|
||||
if (mFI_UtNum2CenterWpos(&pos, ux, uz)) {
|
||||
mCoBG_SetPlussOffset(pos, change_ofs, attr);
|
||||
}
|
||||
}
|
||||
|
||||
extern void mCoBG_SetPlussOffset(xyz_t wpos, s16 change_ofs, s16 attr) {
|
||||
int ux;
|
||||
int uz;
|
||||
|
||||
if (mFI_Wpos2UtNum(&ux, &uz, wpos)) {
|
||||
mCoBG_Collision_u* col = mFI_UtNum2UtCol(ux, uz);
|
||||
u8 keep_h = mFI_UtNum2UtKeepH(ux, uz);
|
||||
|
||||
if (keep_h == col->data.center) {
|
||||
mCoBG_TidyChangeOffset(&change_ofs, col);
|
||||
} else {
|
||||
u32 gap = keep_h - col->data.center;
|
||||
|
||||
col->data.center = (u8)keep_h;
|
||||
col->data.top_left += gap;
|
||||
col->data.bot_left += gap;
|
||||
col->data.bot_right += gap;
|
||||
col->data.top_right += gap;
|
||||
mCoBG_TidyChangeOffset(&change_ofs, col);
|
||||
}
|
||||
|
||||
col->data.center += change_ofs;
|
||||
col->data.bot_left += change_ofs;
|
||||
col->data.top_left += change_ofs;
|
||||
col->data.top_right += change_ofs;
|
||||
col->data.bot_right += change_ofs;
|
||||
|
||||
if (attr != mCoBG_ATTRIBUTE_NONE) {
|
||||
col->data.unit_attribute = (s16)attr;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
extern void mCoBG_SetAttribute(xyz_t pos, s16 attr) {
|
||||
mCoBG_Collision_u* col;
|
||||
int ux;
|
||||
int uz;
|
||||
|
||||
if (mFI_Wpos2UtNum(&ux, &uz, pos)) {
|
||||
col = mFI_UtNum2UtCol(ux, uz);
|
||||
if (attr != mCoBG_ATTRIBUTE_NONE) {
|
||||
col->data.unit_attribute = (s16)attr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extern void mCoBG_Ut2SetPluss5PointOffset_file(int ux, int uz, mCoBG_OffsetTable_c ofs_data, char* file, int line) {
|
||||
xyz_t pos = { 0.0f, 0.0f, 0.0f };
|
||||
|
||||
if (mFI_UtNum2CenterWpos(&pos, ux, uz)) {
|
||||
mCoBG_SetPluss5PointOffset_file(pos, ofs_data, file, line);
|
||||
}
|
||||
}
|
||||
|
||||
extern void mCoBG_SetPluss5PointOffset_file(xyz_t pos, mCoBG_OffsetTable_c ofs_data, char* file, int line) {
|
||||
int ux;
|
||||
int uz;
|
||||
|
||||
if (mFI_Wpos2UtNum(&ux, &uz, pos)) {
|
||||
u8 keep_h = mFI_UtNum2UtKeepH(ux, uz);
|
||||
mCoBG_Collision_u* col = mFI_UtNum2UtCol(ux, uz);
|
||||
|
||||
if (
|
||||
// clang-format off
|
||||
col->data.center == col->data.top_left &&
|
||||
col->data.center == col->data.bot_left &&
|
||||
col->data.center == col->data.bot_right &&
|
||||
col->data.center == col->data.top_right
|
||||
// clang-format on
|
||||
) {
|
||||
col->data.center = mCoBG_OffsetInRule(keep_h + ofs_data.centerRight_offset);
|
||||
col->data.top_left = mCoBG_OffsetInRule(keep_h + ofs_data.leftUp_offset);
|
||||
col->data.bot_left = mCoBG_OffsetInRule(keep_h + ofs_data.leftDown_offset);
|
||||
col->data.bot_right = mCoBG_OffsetInRule(keep_h + ofs_data.rightDown_offset);
|
||||
col->data.top_right = mCoBG_OffsetInRule(keep_h + ofs_data.rightUp_offset);
|
||||
col->data.slate_flag = (s8)ofs_data.shape;
|
||||
|
||||
if (ofs_data.unit_attribute != mCoBG_ATTRIBUTE_NONE) {
|
||||
col->data.unit_attribute = ofs_data.unit_attribute;
|
||||
}
|
||||
} else if (
|
||||
// clang-format off
|
||||
ofs_data.centerRight_offset == 0 &&
|
||||
ofs_data.leftUp_offset == 0 &&
|
||||
ofs_data.leftDown_offset == 0 &&
|
||||
ofs_data.rightDown_offset == 0 &&
|
||||
ofs_data.rightUp_offset == 0
|
||||
// clang-format on
|
||||
) {
|
||||
if (col->data.slate_flag) {
|
||||
col->data.center = keep_h;
|
||||
col->data.top_left = keep_h;
|
||||
col->data.bot_left = keep_h;
|
||||
col->data.bot_right = keep_h;
|
||||
col->data.top_right = keep_h;
|
||||
col->data.slate_flag = FALSE;
|
||||
} else {
|
||||
col->data.center = keep_h;
|
||||
col->data.top_left = keep_h;
|
||||
col->data.bot_left = keep_h;
|
||||
col->data.bot_right = keep_h;
|
||||
col->data.top_right = keep_h;
|
||||
}
|
||||
|
||||
if (ofs_data.unit_attribute != mCoBG_ATTRIBUTE_NONE) {
|
||||
col->data.unit_attribute = ofs_data.unit_attribute;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
u8 src;
|
||||
u8 dst;
|
||||
} mCoBG_change_poor_c;
|
||||
|
||||
extern int mCoBG_Change2PoorAttr(mCoBG_Collision_u* col) {
|
||||
static mCoBG_change_poor_c change_data[] = {
|
||||
{ mCoBG_ATTRIBUTE_GRASS0, mCoBG_ATTRIBUTE_GRASS2 },
|
||||
{ mCoBG_ATTRIBUTE_GRASS1, mCoBG_ATTRIBUTE_GRASS2 },
|
||||
{ mCoBG_ATTRIBUTE_SOIL0, mCoBG_ATTRIBUTE_SOIL2 },
|
||||
{ mCoBG_ATTRIBUTE_SOIL1, mCoBG_ATTRIBUTE_SOIL2 },
|
||||
};
|
||||
const u8 attr = col->data.unit_attribute;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(change_data); i++) {
|
||||
if (attr == change_data[i].src) {
|
||||
col->data.unit_attribute = change_data[i].dst;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
extern void mCoBG_Ut2SetDefaultOffset(int ux, int uz) {
|
||||
static mCoBG_OffsetTable_c offset_data = { mCoBG_ATTRIBUTE_NONE, 0, 0, 0, 0, 0, FALSE };
|
||||
|
||||
mCoBG_Ut2SetPluss5PointOffset_file(ux, uz, offset_data, __FILE__, 2724);
|
||||
}
|
||||
|
||||
int mCoBG_block_bgcheck_mode = mCoBG_BLOCK_BGCHECK_MODE_NORMAL;
|
||||
|
||||
extern void mCoBG_InitBlockBgCheckMode(void) {
|
||||
mCoBG_block_bgcheck_mode = mCoBG_BLOCK_BGCHECK_MODE_NORMAL;
|
||||
}
|
||||
|
||||
extern int mCoBG_ChangeBlockBgCheckMode(int mode) {
|
||||
mCoBG_block_bgcheck_mode = mode & 1;
|
||||
return mCoBG_block_bgcheck_mode;
|
||||
}
|
||||
|
||||
extern int mCoBG_GetBlockBgCheckMode(void) {
|
||||
return mCoBG_block_bgcheck_mode & 1;
|
||||
}
|
||||
|
||||
extern xyz_t mCoBG_UniqueWallCheck(ACTOR* actorx, f32 range, f32 y_ofs) {
|
||||
int bx;
|
||||
int bz;
|
||||
xyz_t ret = { 0.0f, 0.0f, 0.0f };
|
||||
|
||||
mCoBG_InitRevpos(&l_ActorInf.rev_pos);
|
||||
mCoBG_GetCurrentCenterPosition(&l_ActorInf.center_pos, actorx);
|
||||
mCoBG_GetOldCenterPosition(&l_ActorInf.old_center_pos, actorx);
|
||||
mCoBG_GetSpeedByWpos(l_ActorInf.speed_xz0, actorx);
|
||||
|
||||
if (mFI_Wpos2BlockNum(&bx, &bz, l_ActorInf.old_center_pos)) {
|
||||
xyz_t block_base = { 0.0f, 0.0f, 0.0f };
|
||||
|
||||
mCoBG_SetXyz_t(&l_ActorInf.rev_pos, 0.0f, 0.0f, 0.0f);
|
||||
mFI_BkNum2WposXZ(&block_base.x, &block_base.z, bx, bz);
|
||||
if (mCoBG_GetBlockBgCheckMode() == mCoBG_BLOCK_BGCHECK_MODE_INTRO_DEMO &&
|
||||
(mFI_BkNum2BlockKind(bx, bz) & mRF_BLOCKKIND_PLAYER) != 0
|
||||
) {
|
||||
block_base.x += mFI_UT_WORLDSIZE_X_F;
|
||||
block_base.z += mFI_UT_WORLDSIZE_Z_F;
|
||||
return mCoBG_ScopeWallCheck(actorx, &block_base, mFI_BK_WORLDSIZE_X - 2 * mFI_UT_WORLDSIZE_X, mFI_BK_WORLDSIZE_Z - 2 * mFI_UT_WORLDSIZE_Z, range, y_ofs);
|
||||
} else {
|
||||
return mCoBG_ScopeWallCheck(actorx, &block_base, mFI_BK_WORLDSIZE_X, mFI_BK_WORLDSIZE_Z, range, y_ofs);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
// GAFU01 reworks this to check based on the actor's world position, use stack xyz_t instead of l_ActorInf.rev_pos,
|
||||
// and moves carry out reverse to before the ground check.
|
||||
extern xyz_t mCoBG_ScopeWallCheck(ACTOR* actorx, const xyz_t* base_pos, f32 x, f32 z, f32 range, f32 y_ofs) {
|
||||
f32 start[2];
|
||||
f32 end[2];
|
||||
s16 rev_type;
|
||||
xyz_t rev = { 0.0f, 0.0f, 0.0f };
|
||||
xyz_t rev_new;
|
||||
xyz_t xyz_t_why;
|
||||
|
||||
mCoBG_InitRevpos(&l_ActorInf.rev_pos);
|
||||
mCoBG_GetCurrentCenterPosition(&l_ActorInf.center_pos, actorx);
|
||||
mCoBG_GetOldCenterPosition(&l_ActorInf.old_center_pos, actorx);
|
||||
mCoBG_GetSpeedByWpos(l_ActorInf.speed_xz0, actorx);
|
||||
|
||||
if (l_ActorInf.speed_xz0[0] != 0.0f || l_ActorInf.speed_xz0[1] != 0.0f) {
|
||||
start[0] = (base_pos->x);
|
||||
start[1] = (base_pos->z);
|
||||
end[0] = start[0] + x;
|
||||
end[1] = start[1] + z;
|
||||
|
||||
start[0] += range;
|
||||
start[1] += range;
|
||||
|
||||
end[0] -= range;
|
||||
end[1] -= range;
|
||||
|
||||
mCoBG_SetXyz_t(&rev_new, 0.0f, 0.0f, 0.0f);
|
||||
|
||||
if (actorx->world.position.x < start[0]) {
|
||||
rev_new.x = start[0] - actorx->world.position.x;
|
||||
} else if (actorx->world.position.x > end[0]) {
|
||||
rev_new.x = end[0] - actorx->world.position.x;
|
||||
}
|
||||
|
||||
if (actorx->world.position.z < start[1]) {
|
||||
rev_new.z = start[1] - actorx->world.position.z;
|
||||
} else if (actorx->world.position.z > end[1]) {
|
||||
rev_new.z = end[1] - actorx->world.position.z;
|
||||
}
|
||||
|
||||
mCoBG_CarryOutReverse(actorx, rev_new, mCoBG_REVERSE_TYPE_REVERSE);
|
||||
mCoBG_GroundCheck(&l_ActorInf.rev_pos, &l_ActorInf, actorx, y_ofs, &actorx->bg_collision_check.result, NULL, FALSE);
|
||||
xyz_t_why.x = rev_new.x;
|
||||
xyz_t_why.y = l_ActorInf.rev_pos.y;
|
||||
xyz_t_why.z = rev_new.z;
|
||||
return xyz_t_why;
|
||||
}
|
||||
|
||||
return rev;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
static void mCoBG_GetSpeedXZ(f32* speed, xyz_t* start, xyz_t* end) {
|
||||
// GAFU01 changed start & end to const
|
||||
static void mCoBG_GetSpeedXZ(f32* speed, const xyz_t* start, const xyz_t* end) {
|
||||
speed[0] = end->x - start->x;
|
||||
speed[1] = end->z - start->z;
|
||||
}
|
||||
@@ -295,7 +296,8 @@ static void mCoBG_GetFlatGroundPolygon(xyz_t* v0, xyz_t* v1, xyz_t* v2, f32 bg_y
|
||||
v2->z = z + ofs[2].z;
|
||||
}
|
||||
|
||||
static int mCoBG_GetRevGroundAndLine(xyz_t* rev, mCoBG_UnitInfo_c* ut_info, xyz_t start_pos, xyz_t end_pos) {
|
||||
// GAFU01 changed start_pos & end_pos to be const xyz_t* instead of struct copies
|
||||
static int mCoBG_GetRevGroundAndLine(xyz_t* rev, mCoBG_UnitInfo_c* ut_info, const xyz_t* start_pos, const xyz_t* end_pos) {
|
||||
xyz_t v0;
|
||||
xyz_t v1;
|
||||
xyz_t v2;
|
||||
@@ -307,6 +309,7 @@ static int mCoBG_GetRevGroundAndLine(xyz_t* rev, mCoBG_UnitInfo_c* ut_info, xyz_
|
||||
f32 d;
|
||||
f32 dist_start;
|
||||
f32 dist_end;
|
||||
xyz_t tmp;
|
||||
|
||||
if (
|
||||
// clang-format off
|
||||
@@ -321,7 +324,7 @@ static int mCoBG_GetRevGroundAndLine(xyz_t* rev, mCoBG_UnitInfo_c* ut_info, xyz_
|
||||
f32 z;
|
||||
int i;
|
||||
|
||||
if (start_pos.y >= end_pos.y) {
|
||||
if (start_pos->y >= end_pos->y) {
|
||||
bg_y = ut_info->leftUp_offset;
|
||||
x = ut_info->ut_x * mFI_UT_WORLDSIZE_X_F;
|
||||
z = ut_info->ut_z * mFI_UT_WORLDSIZE_Z_F;
|
||||
@@ -330,13 +333,13 @@ static int mCoBG_GetRevGroundAndLine(xyz_t* rev, mCoBG_UnitInfo_c* ut_info, xyz_
|
||||
mCoBG_GetFlatGroundPolygon(&v0, &v1, &v2, bg_y, x, z, i);
|
||||
Math3DPlane(&v0, &v1, &v2, &a, &b, &c, &d);
|
||||
|
||||
dist_start = Math3DSignedLengthPlaneAndPos(a, b, c, d, &start_pos);
|
||||
dist_end = Math3DSignedLengthPlaneAndPos(a, b, c, d, &end_pos);
|
||||
dist_start = Math3DSignedLengthPlaneAndPos(a, b, c, d, start_pos);
|
||||
dist_end = Math3DSignedLengthPlaneAndPos(a, b, c, d, end_pos);
|
||||
if (dist_start >= 0.0f && dist_end <= 0.0f) {
|
||||
if (mCoBG_GetCrossTriangleAndLine3D(&cross, v0, v1, v2, start_pos, end_pos)) {
|
||||
rev->x = cross.x - end_pos.x;
|
||||
rev->y = cross.y - end_pos.y;
|
||||
rev->z = cross.z - end_pos.z;
|
||||
if (mCoBG_GetCrossTriangleAndLine3D(&cross, v0, v1, v2, *start_pos, *end_pos)) {
|
||||
rev->x = cross.x - end_pos->x;
|
||||
rev->y = cross.y - end_pos->y;
|
||||
rev->z = cross.z - end_pos->z;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
@@ -347,13 +350,13 @@ static int mCoBG_GetRevGroundAndLine(xyz_t* rev, mCoBG_UnitInfo_c* ut_info, xyz_
|
||||
mCoBG_GetAreaPolygon(&v0, &v1, &v2, ut_info, area);
|
||||
Math3DPlane(&v0, &v1, &v2, &a, &b, &c, &d);
|
||||
|
||||
dist_start = Math3DSignedLengthPlaneAndPos(a, b, c, d, &start_pos);
|
||||
dist_end = Math3DSignedLengthPlaneAndPos(a, b, c, d, &end_pos);
|
||||
dist_start = Math3DSignedLengthPlaneAndPos(a, b, c, d, start_pos);
|
||||
dist_end = Math3DSignedLengthPlaneAndPos(a, b, c, d, end_pos);
|
||||
if (dist_start >= 0.0f && dist_end <= 0.0f) {
|
||||
if (mCoBG_GetCrossTriangleAndLine3D(&cross, v0, v1, v2, start_pos, end_pos)) {
|
||||
rev->x = cross.x - end_pos.x;
|
||||
rev->y = cross.y - end_pos.y;
|
||||
rev->z = cross.z - end_pos.z;
|
||||
if (mCoBG_GetCrossTriangleAndLine3D(&cross, v0, v1, v2, *start_pos, *end_pos)) {
|
||||
rev->x = cross.x - end_pos->x;
|
||||
rev->y = cross.y - end_pos->y;
|
||||
rev->z = cross.z - end_pos->z;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
@@ -363,7 +366,8 @@ static int mCoBG_GetRevGroundAndLine(xyz_t* rev, mCoBG_UnitInfo_c* ut_info, xyz_
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static int mCoBG_LineGroundCheck_Move(xyz_t* rev, xyz_t* start_pos, xyz_t* end_pos) {
|
||||
// GAFU01 changed start_pos & end_pos to be const
|
||||
static int mCoBG_LineGroundCheck_Move(xyz_t* rev, const xyz_t* start_pos, const xyz_t* end_pos) {
|
||||
mCoBG_bg_regist_c* regist_p;
|
||||
mCoBG_mBgMgr_c* bg_mgr = &l_mBgMgr;
|
||||
mCoBG_bg_regist_c** regist_pp = bg_mgr->regist_p;
|
||||
@@ -477,7 +481,8 @@ static int mCoBG_LineGroundCheck_Move(xyz_t* rev, xyz_t* start_pos, xyz_t* end_p
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static int mCoBG_LineGroundCheck(xyz_t* rev, xyz_t start_pos, xyz_t end_pos) {
|
||||
// GAFU01 changed start_pos and end_pos to be const xyz_t*
|
||||
static int mCoBG_LineGroundCheck(xyz_t* rev, const xyz_t* start_pos, const xyz_t* end_pos) {
|
||||
mCoBG_UnitInfo_c* ut_info = l_crtutInf;
|
||||
int i;
|
||||
xyz_t ground_rev = { 0.0f, 0.0f, 0.0f };
|
||||
@@ -492,7 +497,7 @@ static int mCoBG_LineGroundCheck(xyz_t* rev, xyz_t start_pos, xyz_t end_pos) {
|
||||
ut_info++;
|
||||
}
|
||||
|
||||
if (mCoBG_LineGroundCheck_Move(&move_rev, &start_pos, &end_pos)) {
|
||||
if (mCoBG_LineGroundCheck_Move(&move_rev, start_pos, end_pos)) {
|
||||
*rev = move_rev;
|
||||
return TRUE;
|
||||
}
|
||||
@@ -500,24 +505,26 @@ static int mCoBG_LineGroundCheck(xyz_t* rev, xyz_t start_pos, xyz_t end_pos) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void mCoBG_MakeLineCheckCollisionData(xyz_t start_pos, xyz_t end_pos) {
|
||||
// GAFU01 changed start_pos and end_pos to be const xyz_t*
|
||||
static void mCoBG_MakeLineCheckCollisionData(const xyz_t* start_pos, const xyz_t* end_pos) {
|
||||
int ux;
|
||||
int uz;
|
||||
f32 speed[2];
|
||||
|
||||
mCoBG_GetSpeedXZ(speed, &start_pos, &end_pos);
|
||||
mFI_Wpos2UtNum(&ux, &uz, start_pos);
|
||||
mCoBG_GetSpeedXZ(speed, start_pos, end_pos);
|
||||
mFI_Wpos2UtNum(&ux, &uz, *start_pos);
|
||||
mCoBG_TransCenter(&ux, &uz, speed, 3);
|
||||
mCoBG_MakeSizeUnitInfo(l_crtutInf, ux, uz, 3);
|
||||
mCoBG_MakeUnitVector(&l_VecInf, l_crtutInf, 3, mCoBG_CHECK_TYPE_NORMAL, TRUE, FALSE, FALSE);
|
||||
}
|
||||
|
||||
static int mCoBG_JudgeStartLineCheck(xyz_t* rev, xyz_t start_pos, xyz_t end_pos) {
|
||||
// GAFU01 changed start_pos and end_pos to be const xyz_t*
|
||||
static int mCoBG_JudgeStartLineCheck(xyz_t* rev, const xyz_t* start_pos, const xyz_t* end_pos) {
|
||||
if (rev != NULL) {
|
||||
mCoBG_InitRevpos(rev);
|
||||
}
|
||||
|
||||
if (F32_IS_ZERO(start_pos.x - end_pos.x) && F32_IS_ZERO(start_pos.y - end_pos.y) && F32_IS_ZERO(start_pos.z - end_pos.z)) {
|
||||
if (F32_IS_ZERO(start_pos->x - end_pos->x) && F32_IS_ZERO(start_pos->y - end_pos->y) && F32_IS_ZERO(start_pos->z - end_pos->z)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -532,21 +539,27 @@ static void mCoBG_SetWallGroundReverse(xyz_t* rev, const xyz_t* wall_rev, const
|
||||
}
|
||||
}
|
||||
|
||||
static void mCoBG_PlusEqualPos(xyz_t* p0, xyz_t* p1) {
|
||||
p0->x += p1->x;
|
||||
p0->y += p1->y;
|
||||
p0->z += p1->z;
|
||||
}
|
||||
|
||||
extern int mCoBG_LineCheck_RemoveFg(xyz_t* rev, xyz_t start_pos, xyz_t end_pos, mCoBG_COLUMN_CHECK_ITEM_TYPE_PROC check_proc, int line_check_type) {
|
||||
int ret = 0;
|
||||
|
||||
bzero(l_crtutInf, sizeof(l_crtutInf));
|
||||
bzero(&l_VecInf, sizeof(l_VecInf));
|
||||
|
||||
if (mCoBG_JudgeStartLineCheck(rev, start_pos, end_pos)) {
|
||||
if (mCoBG_JudgeStartLineCheck(rev, &start_pos, &end_pos)) {
|
||||
xyz_t wall_rev = { 0.0f, 0.0f, 0.0f };
|
||||
xyz_t ground_rev = { 0.0f, 0.0f, 0.0f };
|
||||
xyz_t wall_col_rev = { 0.0f, 0.0f, 0.0f };
|
||||
xyz_t ground_col_rev = { 0.0f, 0.0f, 0.0f };
|
||||
|
||||
mCoBG_MakeLineCheckCollisionData(start_pos, end_pos);
|
||||
mCoBG_MakeLineCheckCollisionData(&start_pos, &end_pos);
|
||||
mCoBG_MakeMoveBgVector(&l_VecInf, &l_mBgMgr, &end_pos, mCoBG_CHECK_TYPE_PLAYER);
|
||||
mCoBG_MakeColumnCollisionData(l_VecInf.column, &l_VecInf.col_count, l_crtutInf, 3, FALSE, check_proc, -1, -1);
|
||||
mCoBG_MakeColumnCollisionData(NULL, l_VecInf.column, &l_VecInf.col_count, l_crtutInf, 3, FALSE, check_proc, -1, -1);
|
||||
|
||||
if ((line_check_type & mCoBG_LINE_CHECK_WALL) != 0) {
|
||||
if (mCoBG_LineWallCheck(&wall_rev, start_pos, end_pos)) {
|
||||
@@ -561,7 +574,7 @@ extern int mCoBG_LineCheck_RemoveFg(xyz_t* rev, xyz_t start_pos, xyz_t end_pos,
|
||||
}
|
||||
|
||||
if ((line_check_type & mCoBG_LINE_CHECK_GROUND) != 0) {
|
||||
if (mCoBG_LineGroundCheck(&ground_rev, start_pos, end_pos)) {
|
||||
if (mCoBG_LineGroundCheck(&ground_rev, &start_pos, &end_pos)) {
|
||||
ret |= mCoBG_LINE_CHECK_GROUND;
|
||||
}
|
||||
mCoBG_PlusEqualPos(&end_pos, &ground_rev);
|
||||
@@ -577,7 +590,7 @@ extern int mCoBG_LineCheck_RemoveFg(xyz_t* rev, xyz_t start_pos, xyz_t end_pos,
|
||||
ret |= mCoBG_LINE_CHECK_WATER;
|
||||
} else {
|
||||
if (mCoBG_CheckWaterAttribute(mCoBG_Wpos2Attribute(end_pos, NULL))) {
|
||||
f32 water_y = mCoBG_GetWaterHeight_File(end_pos, __FILE__, 880);
|
||||
f32 water_y = mCoBG_GetWaterHeight_File(end_pos, __FILE__, 894);
|
||||
|
||||
if (end_pos.y <= water_y + 1.0f) {
|
||||
ret |= mCoBG_LINE_CHECK_UNDERWATER;
|
||||
|
||||
@@ -110,7 +110,7 @@ extern int mCoBG_GetDimension2Idx(f32 p0, f32 p1, f32 p2) {
|
||||
return mCoBG_DIM_ALL;
|
||||
}
|
||||
|
||||
extern int mCoBG_GetCrossTriangleAndLine3D(xyz_t* cross, xyz_t v0, xyz_t v1, xyz_t v2, xyz_t line0, xyz_t line1) {
|
||||
extern int mCoBG_GetCrossTriangleAndLine3D(xyz_t* cross, xyz_t v0, xyz_t v1, xyz_t v2, const xyz_t line0, const xyz_t line1) {
|
||||
f32 x;
|
||||
f32 y;
|
||||
f32 z;
|
||||
@@ -127,10 +127,10 @@ extern int mCoBG_GetCrossTriangleAndLine3D(xyz_t* cross, xyz_t v0, xyz_t v1, xyz
|
||||
cross->z = 0.0f;
|
||||
|
||||
Math3DPlane(&v0, &v1, &v2, &nox, &noy, &noz, &dist);
|
||||
t = (nox * line0.x + noy * line0.y + noz * line0.z) + dist;
|
||||
x = line0.x - line1.x;
|
||||
y = line0.y - line1.y;
|
||||
z = line0.z - line1.z;
|
||||
t = (nox * line0.x + noy * line0.y + noz * line0.z) + dist;
|
||||
ldist = nox * x + noy * y + noz * z;
|
||||
if (!F32_IS_ZERO(ldist)) {
|
||||
int dim;
|
||||
|
||||
@@ -31,12 +31,6 @@ static void mCoBG_PlusLinePos(f32* line, f32 x, f32 z) {
|
||||
line[1] += z;
|
||||
}
|
||||
|
||||
static void mCoBG_PlusEqualPos(xyz_t* p0, xyz_t* p1) {
|
||||
p0->x += p1->x;
|
||||
p0->y += p1->y;
|
||||
p0->z += p1->z;
|
||||
}
|
||||
|
||||
extern int mCoBG_GetMoveBgHeight(f32* move_bg_height, xyz_t* pos_p) {
|
||||
mCoBG_mBgMgr_c* bg_mgr = &l_mBgMgr;
|
||||
mCoBG_bg_regist_c* regist_p;
|
||||
|
||||
@@ -1,183 +0,0 @@
|
||||
static u32 mCoBG_OffsetInRule(int ofs) {
|
||||
if (ofs > 31) {
|
||||
return 31;
|
||||
}
|
||||
|
||||
return CLAMP(ofs, 0, ofs);
|
||||
}
|
||||
|
||||
static void mCoBG_SetBestBgY(mCoBG_Collision_u* col, s16* change_ofs) {
|
||||
u32 max = mCoBG_GetMaxOffset(col->data.center, col->data.top_left, col->data.bot_left, col->data.bot_right, col->data.top_right);
|
||||
u32 min = mCoBG_GetMinOffset(col->data.center, col->data.top_left, col->data.bot_left, col->data.bot_right, col->data.top_right);
|
||||
}
|
||||
|
||||
static void mCoBG_TidyChangeOffset(s16* change_ofs, mCoBG_Collision_u* col) {
|
||||
if (
|
||||
// clang-format off
|
||||
col->data.center + *change_ofs > 31 ||
|
||||
col->data.top_left + *change_ofs > 31 ||
|
||||
col->data.bot_left + *change_ofs > 31 ||
|
||||
col->data.bot_right + *change_ofs > 31 ||
|
||||
col->data.top_right + *change_ofs > 31 ||
|
||||
col->data.center + *change_ofs < 0 ||
|
||||
col->data.top_left + *change_ofs < 0 ||
|
||||
col->data.bot_left + *change_ofs < 0 ||
|
||||
col->data.bot_right + *change_ofs < 0 ||
|
||||
col->data.top_right + *change_ofs < 0
|
||||
// clang-format on
|
||||
) {
|
||||
mCoBG_SetBestBgY(col, change_ofs);
|
||||
}
|
||||
}
|
||||
|
||||
// @unused, @fabricated
|
||||
extern void mCoBG_Ut2SetPlussOffset(int ux, int uz, s16 change_ofs, s16 attr) {
|
||||
xyz_t pos = { 0.0f, 0.0f, 0.0f };
|
||||
|
||||
if (mFI_UtNum2CenterWpos(&pos, ux, uz)) {
|
||||
mCoBG_SetPlussOffset(pos, change_ofs, attr);
|
||||
}
|
||||
}
|
||||
|
||||
extern void mCoBG_SetPlussOffset(xyz_t wpos, s16 change_ofs, s16 attr) {
|
||||
int ux;
|
||||
int uz;
|
||||
|
||||
if (mFI_Wpos2UtNum(&ux, &uz, wpos)) {
|
||||
mCoBG_Collision_u* col = mFI_UtNum2UtCol(ux, uz);
|
||||
u8 keep_h = mFI_UtNum2UtKeepH(ux, uz);
|
||||
|
||||
if (keep_h == col->data.center) {
|
||||
mCoBG_TidyChangeOffset(&change_ofs, col);
|
||||
} else {
|
||||
u32 gap = keep_h - col->data.center;
|
||||
|
||||
col->data.center = (u8)keep_h;
|
||||
col->data.top_left += gap;
|
||||
col->data.bot_left += gap;
|
||||
col->data.bot_right += gap;
|
||||
col->data.top_right += gap;
|
||||
mCoBG_TidyChangeOffset(&change_ofs, col);
|
||||
}
|
||||
|
||||
col->data.center += change_ofs;
|
||||
col->data.bot_left += change_ofs;
|
||||
col->data.top_left += change_ofs;
|
||||
col->data.top_right += change_ofs;
|
||||
col->data.bot_right += change_ofs;
|
||||
|
||||
if (attr != mCoBG_ATTRIBUTE_NONE) {
|
||||
col->data.unit_attribute = (s16)attr;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
extern void mCoBG_SetAttribute(xyz_t pos, s16 attr) {
|
||||
mCoBG_Collision_u* col;
|
||||
int ux;
|
||||
int uz;
|
||||
|
||||
if (mFI_Wpos2UtNum(&ux, &uz, pos)) {
|
||||
col = mFI_UtNum2UtCol(ux, uz);
|
||||
if (attr != mCoBG_ATTRIBUTE_NONE) {
|
||||
col->data.unit_attribute = (s16)attr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extern void mCoBG_Ut2SetPluss5PointOffset_file(int ux, int uz, mCoBG_OffsetTable_c ofs_data, char* file, int line) {
|
||||
xyz_t pos = { 0.0f, 0.0f, 0.0f };
|
||||
|
||||
if (mFI_UtNum2CenterWpos(&pos, ux, uz)) {
|
||||
mCoBG_SetPluss5PointOffset_file(pos, ofs_data, file, line);
|
||||
}
|
||||
}
|
||||
|
||||
extern void mCoBG_SetPluss5PointOffset_file(xyz_t pos, mCoBG_OffsetTable_c ofs_data, char* file, int line) {
|
||||
int ux;
|
||||
int uz;
|
||||
|
||||
if (mFI_Wpos2UtNum(&ux, &uz, pos)) {
|
||||
u8 keep_h = mFI_UtNum2UtKeepH(ux, uz);
|
||||
mCoBG_Collision_u* col = mFI_UtNum2UtCol(ux, uz);
|
||||
|
||||
if (
|
||||
// clang-format off
|
||||
col->data.center == col->data.top_left &&
|
||||
col->data.center == col->data.bot_left &&
|
||||
col->data.center == col->data.bot_right &&
|
||||
col->data.center == col->data.top_right
|
||||
// clang-format on
|
||||
) {
|
||||
col->data.center = mCoBG_OffsetInRule(keep_h + ofs_data.centerRight_offset);
|
||||
col->data.top_left = mCoBG_OffsetInRule(keep_h + ofs_data.leftUp_offset);
|
||||
col->data.bot_left = mCoBG_OffsetInRule(keep_h + ofs_data.leftDown_offset);
|
||||
col->data.bot_right = mCoBG_OffsetInRule(keep_h + ofs_data.rightDown_offset);
|
||||
col->data.top_right = mCoBG_OffsetInRule(keep_h + ofs_data.rightUp_offset);
|
||||
col->data.slate_flag = (s8)ofs_data.shape;
|
||||
|
||||
if (ofs_data.unit_attribute != mCoBG_ATTRIBUTE_NONE) {
|
||||
col->data.unit_attribute = ofs_data.unit_attribute;
|
||||
}
|
||||
} else if (
|
||||
// clang-format off
|
||||
ofs_data.centerRight_offset == 0 &&
|
||||
ofs_data.leftUp_offset == 0 &&
|
||||
ofs_data.leftDown_offset == 0 &&
|
||||
ofs_data.rightDown_offset == 0 &&
|
||||
ofs_data.rightUp_offset == 0
|
||||
// clang-format on
|
||||
) {
|
||||
if (col->data.slate_flag) {
|
||||
col->data.center = keep_h;
|
||||
col->data.top_left = keep_h;
|
||||
col->data.bot_left = keep_h;
|
||||
col->data.bot_right = keep_h;
|
||||
col->data.top_right = keep_h;
|
||||
col->data.slate_flag = FALSE;
|
||||
} else {
|
||||
col->data.center = keep_h;
|
||||
col->data.top_left = keep_h;
|
||||
col->data.bot_left = keep_h;
|
||||
col->data.bot_right = keep_h;
|
||||
col->data.top_right = keep_h;
|
||||
}
|
||||
|
||||
if (ofs_data.unit_attribute != mCoBG_ATTRIBUTE_NONE) {
|
||||
col->data.unit_attribute = ofs_data.unit_attribute;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
u8 src;
|
||||
u8 dst;
|
||||
} mCoBG_change_poor_c;
|
||||
|
||||
extern int mCoBG_Change2PoorAttr(mCoBG_Collision_u* col) {
|
||||
static mCoBG_change_poor_c change_data[] = {
|
||||
{ mCoBG_ATTRIBUTE_GRASS0, mCoBG_ATTRIBUTE_GRASS2 },
|
||||
{ mCoBG_ATTRIBUTE_GRASS1, mCoBG_ATTRIBUTE_GRASS2 },
|
||||
{ mCoBG_ATTRIBUTE_SOIL0, mCoBG_ATTRIBUTE_SOIL2 },
|
||||
{ mCoBG_ATTRIBUTE_SOIL1, mCoBG_ATTRIBUTE_SOIL2 },
|
||||
};
|
||||
u8 attr = col->data.unit_attribute;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(change_data); i++) {
|
||||
if (attr == change_data[i].src) {
|
||||
col->data.unit_attribute = change_data[i].dst;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
extern void mCoBG_Ut2SetDefaultOffset(int ux, int uz) {
|
||||
static mCoBG_OffsetTable_c offset_data = { mCoBG_ATTRIBUTE_NONE, 0, 0, 0, 0, 0, FALSE };
|
||||
|
||||
mCoBG_Ut2SetPluss5PointOffset_file(ux, uz, offset_data, __FILE__, 515);
|
||||
}
|
||||
|
||||
@@ -1,184 +0,0 @@
|
||||
extern f32 mCoBG_GetBgY_AngleS_FromWpos2(s_xyz* ground_angle, xyz_t pos, f32 ground_dist) {
|
||||
mCoBG_UnitInfo_c ut_info;
|
||||
s_xyz normal_ground_angle;
|
||||
f32 normal_y;
|
||||
f32 column_y;
|
||||
static s_xyz ground_angle0 = { 0, 0, 0 };
|
||||
f32 t0;
|
||||
f32 t1;
|
||||
f32 ret;
|
||||
|
||||
if (ground_angle != NULL) {
|
||||
*ground_angle = ground_angle0;
|
||||
}
|
||||
|
||||
mCoBG_Wpos2UnitInfo(&ut_info, pos);
|
||||
normal_y = mCoBG_GetBGHeight_Normal(&normal_ground_angle, &ut_info);
|
||||
column_y = mCoBG_GetBGHeight_Column(&pos, &ut_info);
|
||||
|
||||
if (ground_angle != NULL && normal_y >= column_y && normal_y >= -100.0f) {
|
||||
*ground_angle = normal_ground_angle;
|
||||
return normal_y - ground_dist;
|
||||
}
|
||||
|
||||
t0 = MAX(normal_y, -100.0f);
|
||||
t1 = MAX(normal_y, column_y);
|
||||
if (t1 > t0) {
|
||||
ret = MAX(normal_y, column_y);
|
||||
} else {
|
||||
ret = MAX(normal_y, -100.0f);
|
||||
}
|
||||
|
||||
return ret - ground_dist;
|
||||
}
|
||||
|
||||
extern f32 mCoBG_GetWaterHeight_File(xyz_t pos, char* file, int line) {
|
||||
u32 attr;
|
||||
int ux;
|
||||
int uz;
|
||||
mCoBG_Collision_u* col;
|
||||
xyz_t mod_pos = pos;
|
||||
|
||||
mFI_Wpos2UtNum(&ux, &uz, pos);
|
||||
col = mFI_UtNum2UtCol(ux, uz);
|
||||
attr = col->data.unit_attribute;
|
||||
|
||||
if (attr == mCoBG_ATTRIBUTE_SEA || attr == mCoBG_ATTRIBUTE_37 || attr == mCoBG_ATTRIBUTE_38) {
|
||||
return 20.0f;
|
||||
}
|
||||
|
||||
if (attr >= mCoBG_ATTRIBUTE_WATER && attr <= mCoBG_ATTRIBUTE_RIVER_NE) {
|
||||
return 20.0f + mCoBG_GetBgY_AngleS_FromWpos2(NULL, pos, 0.0f);
|
||||
}
|
||||
|
||||
if (attr >= mCoBG_ATTRIBUTE_27 && attr <= mCoBG_ATTRIBUTE_35) {
|
||||
int idx = attr - mCoBG_ATTRIBUTE_27;
|
||||
int search = mCoBG_bridge_search_water[idx];
|
||||
u32 new_attr;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < mSc_DIRECT_NUM; i++) {
|
||||
if ((search & (1 << i)) != 0) {
|
||||
int ux;
|
||||
int uz;
|
||||
|
||||
mCoBG_PlussDirectOffset(&mod_pos, pos, i);
|
||||
mFI_Wpos2UtNum(&ux, &uz, mod_pos);
|
||||
new_attr = mFI_UtNum2UtCol(ux, uz)->data.unit_attribute;
|
||||
|
||||
if (new_attr >= mCoBG_ATTRIBUTE_WATER && new_attr <= mCoBG_ATTRIBUTE_RIVER_NE) {
|
||||
return 20.0f + mCoBG_GetBgY_AngleS_FromWpos2(NULL, mod_pos, 0.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (attr >= mCoBG_ATTRIBUTE_39 && attr <= mCoBG_ATTRIBUTE_42) {
|
||||
u32 attr2 = mCoBG_Wpos2Attribute(pos, NULL);
|
||||
|
||||
if (attr2 >= mCoBG_ATTRIBUTE_WATER && attr2 <= mCoBG_ATTRIBUTE_RIVER_NE) {
|
||||
int i;
|
||||
u32 new_attr;
|
||||
xyz_t new_pos;
|
||||
int idx = attr - mCoBG_ATTRIBUTE_39;
|
||||
int search = mCoBG_grass3_search_water[idx];
|
||||
|
||||
for (i = 0; i < mSc_DIRECT_NUM; i++) {
|
||||
if ((search & (1 << i)) != 0) {
|
||||
int ux;
|
||||
int uz;
|
||||
|
||||
mCoBG_PlussDirectOffset(&new_pos, pos, i);
|
||||
mFI_Wpos2UtNum(&ux, &uz, new_pos);
|
||||
new_attr = mFI_UtNum2UtCol(ux, uz)->data.unit_attribute;
|
||||
|
||||
if (new_attr >= mCoBG_ATTRIBUTE_WATER && new_attr <= mCoBG_ATTRIBUTE_RIVER_NE) {
|
||||
return 20.0f + mCoBG_GetBgY_AngleS_FromWpos2(NULL, new_pos, 0.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return -100.0f;
|
||||
}
|
||||
|
||||
|
||||
extern int mCoBG_CheckWaterAttribute(u32 attr) {
|
||||
if (attr == mCoBG_ATTRIBUTE_SEA) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (attr >= mCoBG_ATTRIBUTE_WATER && attr <= mCoBG_ATTRIBUTE_RIVER_NE) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
extern int mCoBG_CheckWaterAttribute_OutOfSea(u32 attr) {
|
||||
if (attr >= mCoBG_ATTRIBUTE_WATER && attr <= mCoBG_ATTRIBUTE_RIVER_NE) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static f32 mCoBG_wave_cos = 0.0f;
|
||||
|
||||
extern void mCoBG_WaveCos2BgCheck(f32 value) {
|
||||
mCoBG_wave_cos = value;
|
||||
}
|
||||
|
||||
extern f32 mCoBG_WaveCos(void) {
|
||||
return mCoBG_wave_cos;
|
||||
}
|
||||
|
||||
extern int mCoBG_GetWaterFlow(xyz_t* flow, u32 attr) {
|
||||
static xyz_t flow_data[] = {
|
||||
{0.0f, 0.0f, 0.0f},
|
||||
{0.0f, -5.0f, 0.0f},
|
||||
{0.0f, 0.0f, -0.5f},
|
||||
{-0.35355338f, 0.0f, -0.35355338f},
|
||||
{-0.5f, 0.0f, 0.0f},
|
||||
{-0.35355338f, 0.0f, 0.35355338f},
|
||||
{0.0f, 0.0f, 0.5f},
|
||||
{0.35355338f, 0.0f, 0.35355338f},
|
||||
{0.5f, 0.0f, 0.0f},
|
||||
{0.35355338f, 0.0f, -0.35355338f},
|
||||
};
|
||||
|
||||
if (attr == mCoBG_ATTRIBUTE_SEA) {
|
||||
static const xyz_t sea_flow = { 0.0f, 0.0f, -1.0f };
|
||||
|
||||
*flow = sea_flow;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (mCoBG_CheckWaterAttribute(attr)) {
|
||||
int idx = attr - mCoBG_ATTRIBUTE_WATER;
|
||||
|
||||
*flow = flow_data[idx];
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
*flow = flow_data[0];
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
extern int mCoBG_CheckWaveAttr(u32 attr) {
|
||||
if (attr == mCoBG_ATTRIBUTE_WAVE || attr == mCoBG_ATTRIBUTE_36 || attr == mCoBG_ATTRIBUTE_25 || attr == mCoBG_ATTRIBUTE_26) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// @unused, @fabricated
|
||||
extern int mCoBG_CheckSand2Sea(xyz_t* pos) {
|
||||
u32 attr = mCoBG_Wpos2BgAttribute_Original(*pos);
|
||||
|
||||
if (attr == mCoBG_ATTRIBUTE_SEA || mCoBG_CheckWaveAttr(attr)) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -192,7 +192,7 @@ static void aQMgr_normal_set_free_str(QUEST_MANAGER_ACTOR* manager) {
|
||||
mMsg_SET_FREE_STR(mMsg_FREE_STR12, animal->parent_name, LAND_NAME_SIZE);
|
||||
}
|
||||
|
||||
typedef int (*aQMgr_CALENDAR_CONV_PROC)(lbRTC_ymd_c*, const lbRTC_ymd_c*);
|
||||
typedef int (*aQMgr_CALENDAR_CONV_PROC)(lbRTC_ymd_c*, lbRTC_ymd_c*);
|
||||
|
||||
static void aQMgr_set_calendar_free_str(aQMgr_CALENDAR_CONV_PROC conv_proc, int month_str_no, int day_str_no, u8 month, u8 day) {
|
||||
static u8 uru_tuki[10] = "leap month";
|
||||
@@ -1600,18 +1600,15 @@ static int aQMgr_decide_player_msg_no(QUEST_MANAGER_ACTOR* manager, int looks) {
|
||||
static Anmmem_c* aQMgr_get_other_memory(Anmmem_c* memory, int cnt, PersonalID_c* pid, int needs_letter) {
|
||||
int j;
|
||||
int mem_cnt;
|
||||
Anmmem_c* mem;
|
||||
int i;
|
||||
Anmmem_c* ret_mem = NULL;
|
||||
int i;
|
||||
int sel_idx;
|
||||
|
||||
ret_mem = NULL;
|
||||
mem_cnt = 0;
|
||||
|
||||
for (i = 0; i < cnt; i++) {
|
||||
mem = &memory[i];
|
||||
|
||||
if (!mNpc_CheckFreeAnimalMemory(mem) && mPr_CheckCmpPersonalID(pid, &mem->memory_player_id) != TRUE && (!needs_letter || mem->letter_info.exists == TRUE)) {
|
||||
if (!mNpc_CheckFreeAnimalMemory(&memory[i]) && mPr_CheckCmpPersonalID(pid, &memory[i].memory_player_id) != TRUE && (!needs_letter || memory[i].letter_info.exists == TRUE)) {
|
||||
mem_cnt++;
|
||||
}
|
||||
}
|
||||
@@ -1620,11 +1617,9 @@ static Anmmem_c* aQMgr_get_other_memory(Anmmem_c* memory, int cnt, PersonalID_c*
|
||||
sel_idx = RANDOM(mem_cnt);
|
||||
|
||||
for (j = 0; j < cnt; j++) {
|
||||
mem = &memory[j];
|
||||
|
||||
if (!mNpc_CheckFreeAnimalMemory(mem) && !mPr_CheckCmpPersonalID(pid, &mem->memory_player_id) && (!needs_letter || mem->letter_info.exists == TRUE)) {
|
||||
if (!mNpc_CheckFreeAnimalMemory(&memory[j]) && !mPr_CheckCmpPersonalID(pid, &memory[j].memory_player_id) && (!needs_letter || memory[j].letter_info.exists == TRUE)) {
|
||||
if (sel_idx == 0) {
|
||||
ret_mem = mem;
|
||||
ret_mem = &memory[j];
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -822,7 +822,7 @@ static void aQMgr_set_free_str_memory(Anmmem_c* memory) {
|
||||
aQMgr_set_number_free_str_add_nichi(memory->last_speak_time.day, mMsg_FREE_STR19);
|
||||
}
|
||||
|
||||
typedef int (*aQMgr_CALENDAR_CONV_PROC)(lbRTC_ymd_c*, const lbRTC_ymd_c*);
|
||||
typedef int (*aQMgr_CALENDAR_CONV_PROC)(lbRTC_ymd_c*, lbRTC_ymd_c*);
|
||||
|
||||
static void aQMgr_set_calendar_free_str(aQMgr_CALENDAR_CONV_PROC conv_proc, int month_str_no, int day_str_no, u8 month, u8 day) {
|
||||
static u8 uru_tuki[10] = "leap month";
|
||||
|
||||
+2
-2
@@ -253,8 +253,8 @@ extern void sAdos_KishaStatusTrg(u8 state) {
|
||||
Na_KishaStatusTrg(state);
|
||||
}
|
||||
|
||||
extern void sAdos_KishaStatusLevel(f32 speed, u32 ongenNum1, u16 angle1, f32 distance1, u32 ongenNum2, u16 angle2,
|
||||
f32 distance2) {
|
||||
extern void sAdos_KishaStatusLevel(f32 speed, u32 ongenNum1, f32 distance1, u16 angle1, u32 ongenNum2,
|
||||
f32 distance2, u16 angle2) {
|
||||
Na_KishaStatusLevel(speed, ongenNum1, angle1, distance1, ongenNum2, angle2, distance2);
|
||||
}
|
||||
|
||||
|
||||
+147
-9
@@ -365,10 +365,16 @@ extern void cKF_SkeletonInfo_R_init(cKF_SkeletonInfo_R_c* keyframe, cKF_Skeleton
|
||||
* @param keyframe Pointer to the skeleton info structure containing joint and target positions.
|
||||
*/
|
||||
static void cKF_SkeletonInfo_R_morphJoint(cKF_SkeletonInfo_R_c* keyframe) {
|
||||
f32 step;
|
||||
int i;
|
||||
s_xyz* current_joint = keyframe->current_joint;
|
||||
s_xyz* target_joint = keyframe->target_joint;
|
||||
f32 step;
|
||||
s16 next_joint_x;
|
||||
s16 next_joint_y;
|
||||
s16 next_joint_z;
|
||||
s16 next_target_x;
|
||||
s16 next_target_y;
|
||||
s16 next_target_z;
|
||||
|
||||
if (!(F32_IS_ZERO(keyframe->morph_counter))) {
|
||||
step = 0.5f / fabsf(keyframe->morph_counter);
|
||||
@@ -382,14 +388,14 @@ static void cKF_SkeletonInfo_R_morphJoint(cKF_SkeletonInfo_R_c* keyframe) {
|
||||
target_joint++;
|
||||
|
||||
for (i = 0; i < keyframe->skeleton->num_joints; i++) {
|
||||
s16 next_joint_x = current_joint->x;
|
||||
s16 next_target_x = target_joint->x;
|
||||
next_joint_x = current_joint->x;
|
||||
next_target_x = target_joint->x;
|
||||
|
||||
s16 next_joint_y = current_joint->y;
|
||||
s16 next_joint_z = current_joint->z;
|
||||
next_joint_y = current_joint->y;
|
||||
next_joint_z = current_joint->z;
|
||||
|
||||
s16 next_target_y = target_joint->y;
|
||||
s16 next_target_z = target_joint->z;
|
||||
next_target_y = target_joint->y;
|
||||
next_target_z = target_joint->z;
|
||||
|
||||
if (next_joint_x != next_target_x || next_joint_y != next_target_y || next_joint_z != next_target_z) {
|
||||
f32 difxyz = fabsf((f32)next_target_x - (f32)next_joint_x) + fabsf((f32)next_target_y - (f32)next_joint_y) +
|
||||
@@ -417,6 +423,129 @@ static void cKF_SkeletonInfo_R_morphJoint(cKF_SkeletonInfo_R_c* keyframe) {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: There's probably no difference between this and US.
|
||||
// The inlines used to match US are fake.
|
||||
#if VERSION >= VER_GAFU01_00
|
||||
extern int cKF_SkeletonInfo_R_play(cKF_SkeletonInfo_R_c* keyframe) {
|
||||
int i;
|
||||
int j;
|
||||
u8* flagTable;
|
||||
int keyTableIndex = 0;
|
||||
int fixedTableIndex = 0;
|
||||
int dataIndex = 0;
|
||||
s16* jointValuePtr;
|
||||
s16* fixedTable;
|
||||
s16* dataTable;
|
||||
s16* keyTable;
|
||||
u32 jointFlag; // Check translation (xyz)
|
||||
|
||||
// Choose between current and target joint based on morph counter
|
||||
if (F32_IS_ZERO(keyframe->morph_counter)) {
|
||||
jointValuePtr = &keyframe->current_joint->x;
|
||||
} else {
|
||||
jointValuePtr = &keyframe->target_joint->x;
|
||||
}
|
||||
|
||||
jointFlag = cKF_ANIMATION_BIT_TRANS_X;
|
||||
|
||||
// Retrieve animation tables
|
||||
fixedTable = keyframe->animation->fixed_table;
|
||||
keyTable = keyframe->animation->key_table;
|
||||
dataTable = keyframe->animation->data_table;
|
||||
flagTable = keyframe->animation->flag_table;
|
||||
|
||||
|
||||
|
||||
// Process root translation x -> y -> z
|
||||
for (j = 0; j < 3; j++) {
|
||||
if (*flagTable & jointFlag) {
|
||||
// Apply joint translation
|
||||
*jointValuePtr =
|
||||
cKF_KeyCalc(dataIndex, keyTable[keyTableIndex], dataTable, keyframe->frame_control.current_frame);
|
||||
dataIndex += keyTable[keyTableIndex];
|
||||
keyTableIndex++;
|
||||
} else {
|
||||
// Use fixed value if not flagged for keyframe animation
|
||||
*jointValuePtr = fixedTable[fixedTableIndex];
|
||||
fixedTableIndex++;
|
||||
}
|
||||
|
||||
jointFlag >>= 1; // Shift x -> y -> z
|
||||
jointValuePtr++; // Move to next joint
|
||||
}
|
||||
|
||||
// Process remaining joint rotations
|
||||
for (i = 0; i < keyframe->skeleton->num_joints; i++) {
|
||||
jointFlag = cKF_ANIMATION_BIT_ROT_X; // Reset flag for new joint
|
||||
|
||||
// Process each joint x -> y -> z
|
||||
for (j = 0; j < 3; j++) {
|
||||
f32 adjustedJointValue;
|
||||
f32 mod;
|
||||
|
||||
// Similar logic to above, but for each joint in the skeleton
|
||||
if (jointFlag & flagTable[i]) {
|
||||
*jointValuePtr =
|
||||
cKF_KeyCalc(dataIndex, keyTable[keyTableIndex], dataTable, keyframe->frame_control.current_frame);
|
||||
dataIndex += keyTable[keyTableIndex];
|
||||
keyTableIndex++;
|
||||
} else {
|
||||
*jointValuePtr = fixedTable[fixedTableIndex];
|
||||
fixedTableIndex++;
|
||||
}
|
||||
|
||||
// Reduce the value by 90% and clamp to [0, 360) degrees converted back to binangle (s16)
|
||||
// This effectively limits any joint's maximum rotation to be in the range of [-36.8, 36.7] degrees
|
||||
adjustedJointValue = *jointValuePtr * 0.1f;
|
||||
mod = MOD_F(adjustedJointValue, 360.0f);
|
||||
*jointValuePtr = DEG2SHORT_ANGLE(mod);
|
||||
jointValuePtr++;
|
||||
|
||||
|
||||
jointFlag >>= 1; // Shift flag for next component x -> y -> z
|
||||
}
|
||||
|
||||
// flagTable++;
|
||||
}
|
||||
|
||||
// Apply rotation differences if available
|
||||
if (keyframe->rotation_diff_table != NULL) {
|
||||
s_xyz* currentJointPtr = (F32_IS_ZERO(keyframe->morph_counter)) ? keyframe->current_joint : keyframe->target_joint;
|
||||
|
||||
currentJointPtr++; // Skip first joint, usually root, which is handled separately
|
||||
for (j = 0; j < keyframe->skeleton->num_joints; j++) {
|
||||
// Apply rotation differences to each joint
|
||||
currentJointPtr->x += keyframe->rotation_diff_table[j].x;
|
||||
currentJointPtr->y += keyframe->rotation_diff_table[j].y;
|
||||
currentJointPtr->z += keyframe->rotation_diff_table[j].z;
|
||||
|
||||
currentJointPtr++; // Move to next joint
|
||||
}
|
||||
}
|
||||
|
||||
// Handle morphing and play control based on morph counter
|
||||
if (F32_IS_ZERO(keyframe->morph_counter)) {
|
||||
// Play normally if no morphing is needed
|
||||
return cKF_FrameControl_play(&keyframe->frame_control);
|
||||
} else if (keyframe->morph_counter > 0.0f) {
|
||||
// Morph towards target, decreasing morph counter
|
||||
cKF_SkeletonInfo_R_morphJoint(keyframe);
|
||||
keyframe->morph_counter -= 0.5f;
|
||||
if (keyframe->morph_counter <= 0.0f) {
|
||||
keyframe->morph_counter = 0.0f; // Clamp to zero if over-decremented
|
||||
}
|
||||
return cKF_STATE_NONE;
|
||||
} else {
|
||||
// Morph from target, increasing morph counter towards zero
|
||||
cKF_SkeletonInfo_R_morphJoint(keyframe);
|
||||
keyframe->morph_counter += 0.5f;
|
||||
if (keyframe->morph_counter >= 0.0f) {
|
||||
keyframe->morph_counter = 0.0f; // Clamp to zero if over-incremented
|
||||
}
|
||||
return cKF_FrameControl_play(&keyframe->frame_control);
|
||||
}
|
||||
}
|
||||
#else
|
||||
/**
|
||||
* Retrieves the flag table from an animation structure.
|
||||
*
|
||||
@@ -574,6 +703,7 @@ extern int cKF_SkeletonInfo_R_play(cKF_SkeletonInfo_R_c* keyframe) {
|
||||
|
||||
return state;
|
||||
}
|
||||
#endif
|
||||
|
||||
extern void cKF_Si3_draw_SV_R_child(GAME* game, cKF_SkeletonInfo_R_c* keyframe, int* joint_num,
|
||||
cKF_draw_callback prerender_callback, cKF_draw_callback postrender_callback,
|
||||
@@ -909,7 +1039,11 @@ extern int cKF_SkeletonInfo_R_combine_play(cKF_SkeletonInfo_R_c* info1, cKF_Skel
|
||||
cKF_SkeletonInfo_R_combine_rotation(&joint, &combinet, &combine[0], part_table);
|
||||
|
||||
if (info1->rotation_diff_table != NULL) {
|
||||
applyjoint = (F32_IS_ZERO(info1->morph_counter)) ? info1->current_joint : info1->target_joint;
|
||||
if (F32_IS_ZERO(info1->morph_counter)) {
|
||||
applyjoint = info1->current_joint;
|
||||
} else {
|
||||
applyjoint = info1->target_joint;
|
||||
}
|
||||
|
||||
applyjoint += 1;
|
||||
for (i = 0; i < info1->skeleton->num_joints; i++) {
|
||||
@@ -972,7 +1106,11 @@ extern void cKF_SkeletonInfo_R_T_combine_play(int* state1, int* state2, int* sta
|
||||
cKF_SkeletonInfo_R_combine_rotation(&joint, &combinet, &combine[0], part_table);
|
||||
|
||||
if (info1->rotation_diff_table != NULL) {
|
||||
applyjoint = (F32_IS_ZERO(info1->morph_counter)) ? info1->current_joint : info1->target_joint;
|
||||
if (F32_IS_ZERO(info1->morph_counter)) {
|
||||
applyjoint = info1->current_joint;
|
||||
} else {
|
||||
applyjoint = info1->target_joint;
|
||||
}
|
||||
|
||||
applyjoint += 1;
|
||||
for (i = 0; i < info1->skeleton->num_joints; i++) {
|
||||
|
||||
+211
-212
@@ -4,302 +4,301 @@
|
||||
#include "libforest/gbi_extensions.h"
|
||||
#include "m_rcp.h"
|
||||
|
||||
static Gfx* evw_tex_scroll_set(GAME_PLAY* play, EVW_ANIME_SCROLL* scroll) {
|
||||
int scroll_x = scroll->x * play->game_frame;
|
||||
int scroll_y = scroll->y * play->game_frame;
|
||||
static Gfx* evw_tex_scroll_set(GAME_PLAY* play, const EVW_ANIME_SCROLL* scroll) {
|
||||
int scroll_x = scroll->x * play->game_frame;
|
||||
int scroll_y = scroll->y * play->game_frame;
|
||||
|
||||
return tex_scroll2_dolphin(play->game.graph, scroll_x, -scroll_y, scroll->width, scroll->height);
|
||||
return tex_scroll2_dolphin(play->game.graph, scroll_x, -scroll_y, scroll->width, scroll->height);
|
||||
}
|
||||
|
||||
static void evw_anime_scroll1(GAME_PLAY* play, int segment, void* evw_data) {
|
||||
EVW_ANIME_SCROLL* scroll = (EVW_ANIME_SCROLL*)evw_data;
|
||||
Gfx* scroll_gfx = evw_tex_scroll_set(play, scroll);
|
||||
GRAPH* g = play->game.graph;
|
||||
EVW_ANIME_SCROLL* scroll = (EVW_ANIME_SCROLL*)evw_data;
|
||||
Gfx* scroll_gfx = evw_tex_scroll_set(play, scroll);
|
||||
GRAPH* g = play->game.graph;
|
||||
|
||||
OPEN_DISP(g);
|
||||
OPEN_DISP(g);
|
||||
|
||||
gSPSegment(NOW_BG_OPA_DISP++, segment, scroll_gfx);
|
||||
gSPSegment(NOW_POLY_OPA_DISP++, segment, scroll_gfx);
|
||||
gSPSegment(NOW_POLY_XLU_DISP++, segment, scroll_gfx);
|
||||
gSPSegment(NOW_BG_OPA_DISP++, segment, scroll_gfx);
|
||||
gSPSegment(NOW_POLY_OPA_DISP++, segment, scroll_gfx);
|
||||
gSPSegment(NOW_POLY_XLU_DISP++, segment, scroll_gfx);
|
||||
|
||||
CLOSE_DISP(g);
|
||||
CLOSE_DISP(g);
|
||||
}
|
||||
|
||||
static Gfx* evw_two_tex_scroll_set(GAME_PLAY* play, EVW_ANIME_SCROLL* scrolls) {
|
||||
u32 frame = play->game_frame;
|
||||
|
||||
int x0 = scrolls[0].x * frame;
|
||||
int y0 = scrolls[0].y * frame;
|
||||
static Gfx* evw_two_tex_scroll_set(GAME_PLAY* play, const EVW_ANIME_SCROLL* scrolls) {
|
||||
u32 frame = play->game_frame;
|
||||
|
||||
int x1 = scrolls[1].x * frame;
|
||||
int y1 = scrolls[1].y * frame;
|
||||
int x0 = scrolls[0].x * frame;
|
||||
int y0 = scrolls[0].y * frame;
|
||||
|
||||
return two_tex_scroll_dolphin(
|
||||
play->game.graph,
|
||||
0,
|
||||
x0, -y0, scrolls[0].width, scrolls[0].height,
|
||||
1,
|
||||
x1, -y1, scrolls[1].width, scrolls[1].height
|
||||
);
|
||||
int x1 = scrolls[1].x * frame;
|
||||
int y1 = scrolls[1].y * frame;
|
||||
|
||||
return two_tex_scroll_dolphin(play->game.graph, 0, x0, -y0, scrolls[0].width, scrolls[0].height, 1, x1, -y1,
|
||||
scrolls[1].width, scrolls[1].height);
|
||||
}
|
||||
|
||||
static void evw_anime_scroll2(GAME_PLAY* play, int segment, void* evw_data) {
|
||||
EVW_ANIME_SCROLL* scrolls = (EVW_ANIME_SCROLL*)evw_data;
|
||||
Gfx* scroll_gfx = evw_two_tex_scroll_set(play, scrolls);
|
||||
GRAPH* g = play->game.graph;
|
||||
EVW_ANIME_SCROLL* scrolls = (EVW_ANIME_SCROLL*)evw_data;
|
||||
Gfx* scroll_gfx = evw_two_tex_scroll_set(play, scrolls);
|
||||
GRAPH* g = play->game.graph;
|
||||
|
||||
OPEN_DISP(g);
|
||||
OPEN_DISP(g);
|
||||
|
||||
gSPSegment(NOW_BG_OPA_DISP++, segment, scroll_gfx);
|
||||
gSPSegment(NOW_POLY_OPA_DISP++, segment, scroll_gfx);
|
||||
gSPSegment(NOW_POLY_XLU_DISP++, segment, scroll_gfx);
|
||||
gSPSegment(NOW_BG_OPA_DISP++, segment, scroll_gfx);
|
||||
gSPSegment(NOW_POLY_OPA_DISP++, segment, scroll_gfx);
|
||||
gSPSegment(NOW_POLY_XLU_DISP++, segment, scroll_gfx);
|
||||
|
||||
CLOSE_DISP(g);
|
||||
CLOSE_DISP(g);
|
||||
}
|
||||
|
||||
static void evw_color_set(GAME_PLAY* play, int segment, EVW_ANIME_COL_PRIM* prim, EVW_ANIME_COL_ENV* env) {
|
||||
Gfx* col_gfx = GRAPH_ALLOC_TYPE(play->game.graph, Gfx, 3);
|
||||
static void evw_color_set(GAME_PLAY* play, int segment, const EVW_ANIME_COL_PRIM* prim, const EVW_ANIME_COL_ENV* env) {
|
||||
Gfx* col_gfx = GRAPH_ALLOC_TYPE(play->game.graph, Gfx, 3);
|
||||
|
||||
/* Setup small display list for initializing color settings */
|
||||
gDPSetPrimColor(col_gfx + 0, 0, prim->l, prim->r, prim->g, prim->b, prim->a);
|
||||
gDPSetEnvColor(col_gfx + 1, env->r, env->g, env->b, env->a);
|
||||
gSPEndDisplayList(col_gfx + 2);
|
||||
/* Setup small display list for initializing color settings */
|
||||
gDPSetPrimColor(col_gfx + 0, 0, prim->l, prim->r, prim->g, prim->b, prim->a);
|
||||
gDPSetEnvColor(col_gfx + 1, env->r, env->g, env->b, env->a);
|
||||
gSPEndDisplayList(col_gfx + 2);
|
||||
|
||||
OPEN_DISP(play->game.graph);
|
||||
OPEN_DISP(play->game.graph);
|
||||
|
||||
/* Point the necessary Gfx buffers to our color display list */
|
||||
gSPSegment(NOW_BG_OPA_DISP++, segment, col_gfx);
|
||||
gSPSegment(NOW_POLY_OPA_DISP++, segment, col_gfx);
|
||||
gSPSegment(NOW_POLY_XLU_DISP++, segment, col_gfx);
|
||||
/* Point the necessary Gfx buffers to our color display list */
|
||||
gSPSegment(NOW_BG_OPA_DISP++, segment, col_gfx);
|
||||
gSPSegment(NOW_POLY_OPA_DISP++, segment, col_gfx);
|
||||
gSPSegment(NOW_POLY_XLU_DISP++, segment, col_gfx);
|
||||
|
||||
CLOSE_DISP(play->game.graph);
|
||||
CLOSE_DISP(play->game.graph);
|
||||
}
|
||||
|
||||
static void evw_anime_colreg_manual(GAME_PLAY* play, int segment, void* evw_data) {
|
||||
EVW_ANIME_COLREG* color_reg = (EVW_ANIME_COLREG*)evw_data;
|
||||
|
||||
int frame_idx = play->game_frame % color_reg->frame_count;
|
||||
EVW_ANIME_COL_PRIM* prim = color_reg->prim_colors;
|
||||
EVW_ANIME_COL_ENV* env = color_reg->env_colors;
|
||||
EVW_ANIME_COLREG* color_reg = (EVW_ANIME_COLREG*)evw_data;
|
||||
|
||||
prim += frame_idx;
|
||||
env += frame_idx;
|
||||
int frame_idx = play->game_frame % color_reg->frame_count;
|
||||
EVW_ANIME_COL_PRIM* prim = color_reg->prim_colors;
|
||||
EVW_ANIME_COL_ENV* env = color_reg->env_colors;
|
||||
|
||||
evw_color_set(play, segment, prim, env);
|
||||
prim += frame_idx;
|
||||
env += frame_idx;
|
||||
|
||||
evw_color_set(play, segment, prim, env);
|
||||
}
|
||||
|
||||
static int morf_calc(int now, int target, f32 rate) {
|
||||
return now + (int)(rate * (f32)(target - now));
|
||||
return now + (int)(rate * (f32)(target - now));
|
||||
}
|
||||
|
||||
static void evw_anime_colreg_linear(GAME_PLAY* play, int segment, void* evw_data) {
|
||||
EVW_ANIME_COLREG* color_reg = (EVW_ANIME_COLREG*)evw_data;
|
||||
EVW_ANIME_COL_PRIM* src_prim = color_reg->prim_colors;
|
||||
EVW_ANIME_COL_ENV* src_env = color_reg->env_colors;
|
||||
EVW_ANIME_COLREG* color_reg = (EVW_ANIME_COLREG*)evw_data;
|
||||
EVW_ANIME_COL_PRIM* src_prim = color_reg->prim_colors;
|
||||
EVW_ANIME_COL_ENV* src_env = color_reg->env_colors;
|
||||
|
||||
u16* keyframe = color_reg->keyframes;
|
||||
u32 game_frame = play->game_frame;
|
||||
int anime_frame = game_frame % color_reg->frame_count;
|
||||
int now_keyframe;
|
||||
int last_keyframe;
|
||||
int frame_idx = 1;
|
||||
int i;
|
||||
|
||||
keyframe++;
|
||||
for (i = 1; i < color_reg->key_count; i++) {
|
||||
if (anime_frame < *keyframe) {
|
||||
break;
|
||||
}
|
||||
u16* keyframe = color_reg->keyframes;
|
||||
u32 game_frame = play->game_frame;
|
||||
int anime_frame = game_frame % color_reg->frame_count;
|
||||
int now_keyframe;
|
||||
int last_keyframe;
|
||||
int frame_idx = 1;
|
||||
int i;
|
||||
|
||||
keyframe++;
|
||||
frame_idx++;
|
||||
}
|
||||
for (i = 1; i < color_reg->key_count; i++) {
|
||||
if (anime_frame < *keyframe) {
|
||||
break;
|
||||
}
|
||||
|
||||
{
|
||||
EVW_ANIME_COL_PRIM inter_prim;
|
||||
EVW_ANIME_COL_ENV inter_env;
|
||||
int a;
|
||||
int b;
|
||||
keyframe++;
|
||||
frame_idx++;
|
||||
}
|
||||
|
||||
now_keyframe = keyframe[0];
|
||||
last_keyframe = keyframe[-1];
|
||||
a = anime_frame - last_keyframe;
|
||||
b = now_keyframe - last_keyframe;
|
||||
{
|
||||
EVW_ANIME_COL_PRIM inter_prim;
|
||||
EVW_ANIME_COL_ENV inter_env;
|
||||
int a;
|
||||
int b;
|
||||
|
||||
src_prim += frame_idx;
|
||||
src_env += frame_idx;
|
||||
now_keyframe = keyframe[0];
|
||||
last_keyframe = keyframe[-1];
|
||||
a = anime_frame - last_keyframe;
|
||||
b = now_keyframe - last_keyframe;
|
||||
|
||||
/* Interpolate primitive color */
|
||||
inter_prim.r = morf_calc(src_prim[-1].r, src_prim[0].r, (f32)a / (f32)b);
|
||||
inter_prim.g = morf_calc(src_prim[-1].g, src_prim[0].g, (f32)a / (f32)b);
|
||||
inter_prim.b = morf_calc(src_prim[-1].b, src_prim[0].b, (f32)a / (f32)b);
|
||||
inter_prim.a = morf_calc(src_prim[-1].a, src_prim[0].a, (f32)a / (f32)b);
|
||||
inter_prim.l = morf_calc(src_prim[-1].l, src_prim[0].l, (f32)a / (f32)b);
|
||||
src_prim += frame_idx;
|
||||
src_env += frame_idx;
|
||||
|
||||
/* Interpolate environment color */
|
||||
inter_env.r = morf_calc(src_env[-1].r, src_env[0].r, (f32)a / (f32)b);
|
||||
inter_env.g = morf_calc(src_env[-1].g, src_env[0].g, (f32)a / (f32)b);
|
||||
inter_env.b = morf_calc(src_env[-1].b, src_env[0].b, (f32)a / (f32)b);
|
||||
inter_env.a = morf_calc(src_env[-1].a, src_env[0].a, (f32)a / (f32)b);
|
||||
/* Interpolate primitive color */
|
||||
inter_prim.r = morf_calc(src_prim[-1].r, src_prim[0].r, (f32)a / (f32)b);
|
||||
inter_prim.g = morf_calc(src_prim[-1].g, src_prim[0].g, (f32)a / (f32)b);
|
||||
inter_prim.b = morf_calc(src_prim[-1].b, src_prim[0].b, (f32)a / (f32)b);
|
||||
inter_prim.a = morf_calc(src_prim[-1].a, src_prim[0].a, (f32)a / (f32)b);
|
||||
inter_prim.l = morf_calc(src_prim[-1].l, src_prim[0].l, (f32)a / (f32)b);
|
||||
|
||||
evw_color_set(play, segment, &inter_prim, &inter_env);
|
||||
}
|
||||
/* Interpolate environment color */
|
||||
inter_env.r = morf_calc(src_env[-1].r, src_env[0].r, (f32)a / (f32)b);
|
||||
inter_env.g = morf_calc(src_env[-1].g, src_env[0].g, (f32)a / (f32)b);
|
||||
inter_env.b = morf_calc(src_env[-1].b, src_env[0].b, (f32)a / (f32)b);
|
||||
inter_env.a = morf_calc(src_env[-1].a, src_env[0].a, (f32)a / (f32)b);
|
||||
|
||||
evw_color_set(play, segment, &inter_prim, &inter_env);
|
||||
}
|
||||
}
|
||||
|
||||
// Ragrange is probably Lagrange
|
||||
static f32 RagrangeInt(int num_keyframes, f32* keyframes, f32* values, f32 now_frame) {
|
||||
f32 stack[EVW_COLOR_BUF_MAX];
|
||||
f32 res;
|
||||
f32 n;
|
||||
f32 m;
|
||||
int i;
|
||||
f32 stack[EVW_COLOR_BUF_MAX];
|
||||
f32 res;
|
||||
f32 n;
|
||||
f32 m;
|
||||
int i;
|
||||
|
||||
/* BUG: fixed stack buffer size but no input length validation. */
|
||||
for (i = 0; i < num_keyframes; i++) {
|
||||
int j;
|
||||
int k;
|
||||
n = keyframes[i];
|
||||
m = 1.0f;
|
||||
/* BUG: fixed stack buffer size but no input length validation. */
|
||||
for (i = 0; i < num_keyframes; i++) {
|
||||
int j;
|
||||
n = keyframes[i];
|
||||
m = 1.0f;
|
||||
|
||||
/* Adjust keyframe by difference between all previous keyframes and the current keyframe */
|
||||
for (j = 0; j < i; j++) {
|
||||
m *= n - keyframes[j];
|
||||
/* Adjust keyframe by difference between all previous keyframes and the current keyframe */
|
||||
for (j = 0; j < i; j++) {
|
||||
m *= n - keyframes[j];
|
||||
}
|
||||
|
||||
j++;
|
||||
for (j; j < num_keyframes; j++) {
|
||||
m *= n - keyframes[j];
|
||||
}
|
||||
|
||||
stack[i] = values[i] / m;
|
||||
}
|
||||
|
||||
for (k = j + 1; k < num_keyframes; k++) {
|
||||
m *= n - keyframes[k];
|
||||
res = 0.0f;
|
||||
for (i = 0; i < num_keyframes; i++) {
|
||||
int j;
|
||||
m = 1.0f;
|
||||
|
||||
for (j = 0; j < i; j++) {
|
||||
m *= now_frame - keyframes[j];
|
||||
}
|
||||
|
||||
j++;
|
||||
for (j; j < num_keyframes; j++) {
|
||||
m *= now_frame - keyframes[j];
|
||||
}
|
||||
|
||||
res += m * stack[i];
|
||||
}
|
||||
|
||||
stack[i] = values[i] / m;
|
||||
}
|
||||
|
||||
res = 0.0f;
|
||||
for (i = 0; i < num_keyframes; i++) {
|
||||
int j;
|
||||
int k;
|
||||
m = 1.0f;
|
||||
|
||||
for (j = 0; j < i; j++) {
|
||||
m *= now_frame - keyframes[j];
|
||||
}
|
||||
|
||||
for (k = j + 1; k < num_keyframes; k++) {
|
||||
m *= now_frame - keyframes[k];
|
||||
}
|
||||
|
||||
res += m * stack[i];
|
||||
}
|
||||
|
||||
return res;
|
||||
return res;
|
||||
}
|
||||
|
||||
static u8 RagrangeInt_Color(int num_keyframes, f32* keyframes, f32* values, f32 now_frame) {
|
||||
return (u8)(int)RagrangeInt(num_keyframes, keyframes, values, now_frame);
|
||||
return (u8)(int)RagrangeInt(num_keyframes, keyframes, values, now_frame);
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
f32 keyframe_stack[EVW_COLOR_BUF_MAX];
|
||||
|
||||
f32 prim_r_stack[EVW_COLOR_BUF_MAX];
|
||||
f32 prim_g_stack[EVW_COLOR_BUF_MAX];
|
||||
f32 prim_b_stack[EVW_COLOR_BUF_MAX];
|
||||
f32 prim_a_stack[EVW_COLOR_BUF_MAX];
|
||||
f32 prim_l_stack[EVW_COLOR_BUF_MAX];
|
||||
|
||||
f32 env_r_stack[EVW_COLOR_BUF_MAX];
|
||||
f32 env_g_stack[EVW_COLOR_BUF_MAX];
|
||||
f32 env_b_stack[EVW_COLOR_BUF_MAX];
|
||||
f32 env_a_stack[EVW_COLOR_BUF_MAX];
|
||||
f32 keyframe_stack[EVW_COLOR_BUF_MAX];
|
||||
|
||||
f32 prim_r_stack[EVW_COLOR_BUF_MAX];
|
||||
f32 prim_g_stack[EVW_COLOR_BUF_MAX];
|
||||
f32 prim_b_stack[EVW_COLOR_BUF_MAX];
|
||||
f32 prim_a_stack[EVW_COLOR_BUF_MAX];
|
||||
f32 prim_l_stack[EVW_COLOR_BUF_MAX];
|
||||
|
||||
f32 env_r_stack[EVW_COLOR_BUF_MAX];
|
||||
f32 env_g_stack[EVW_COLOR_BUF_MAX];
|
||||
f32 env_b_stack[EVW_COLOR_BUF_MAX];
|
||||
f32 env_a_stack[EVW_COLOR_BUF_MAX];
|
||||
} EVW_ANIME_COLREG_F;
|
||||
|
||||
static void evw_anime_colreg_nonlinear(GAME_PLAY* play, int segment, void* evw_data) {
|
||||
EVW_ANIME_COLREG* colreg = (EVW_ANIME_COLREG*)evw_data;
|
||||
EVW_ANIME_COLREG* colreg = (EVW_ANIME_COLREG*)evw_data;
|
||||
|
||||
EVW_ANIME_COL_PRIM* prim_p;
|
||||
EVW_ANIME_COL_ENV* env_p;
|
||||
EVW_ANIME_COL_PRIM* prim_src = colreg->prim_colors;
|
||||
EVW_ANIME_COL_ENV* env_src = colreg->env_colors;
|
||||
u16* keyframes = colreg->keyframes;
|
||||
f32 now_frame = play->game_frame % colreg->frame_count;
|
||||
int i;
|
||||
EVW_ANIME_COL_PRIM* prim_p;
|
||||
EVW_ANIME_COL_ENV* env_p;
|
||||
EVW_ANIME_COL_PRIM* prim_src = colreg->prim_colors;
|
||||
EVW_ANIME_COL_ENV* env_src = colreg->env_colors;
|
||||
u16* keyframes = colreg->keyframes;
|
||||
f32 now_frame = play->game_frame % colreg->frame_count;
|
||||
int i;
|
||||
|
||||
EVW_ANIME_COLREG_F colreg_float;
|
||||
|
||||
EVW_ANIME_COLREG_F colreg_float;
|
||||
|
||||
/* BUG: fixed stack buffer size but no input length validation. */
|
||||
for (i = 0; i < colreg->key_count; i++) {
|
||||
colreg_float.keyframe_stack[i] = (int)keyframes[i];
|
||||
/* BUG: fixed stack buffer size but no input length validation. */
|
||||
for (i = 0; i < colreg->key_count; i++) {
|
||||
colreg_float.keyframe_stack[i] = (int)keyframes[i];
|
||||
|
||||
prim_p = &prim_src[i];
|
||||
env_p = &env_src[i];
|
||||
prim_p = &prim_src[i];
|
||||
env_p = &env_src[i];
|
||||
|
||||
colreg_float.prim_r_stack[i] = (int)prim_p->r;
|
||||
colreg_float.prim_g_stack[i] = (int)prim_p->g;
|
||||
colreg_float.prim_b_stack[i] = (int)prim_p->b;
|
||||
colreg_float.prim_a_stack[i] = (int)prim_p->a;
|
||||
colreg_float.prim_l_stack[i] = (int)prim_p->l;
|
||||
colreg_float.prim_r_stack[i] = (int)prim_p->r;
|
||||
colreg_float.prim_g_stack[i] = (int)prim_p->g;
|
||||
colreg_float.prim_b_stack[i] = (int)prim_p->b;
|
||||
colreg_float.prim_a_stack[i] = (int)prim_p->a;
|
||||
colreg_float.prim_l_stack[i] = (int)prim_p->l;
|
||||
|
||||
colreg_float.env_r_stack[i] = (int)env_p->r;
|
||||
colreg_float.env_g_stack[i] = (int)env_p->g;
|
||||
colreg_float.env_b_stack[i] = (int)env_p->b;
|
||||
colreg_float.env_a_stack[i] = (int)env_p->a;
|
||||
}
|
||||
colreg_float.env_r_stack[i] = (int)env_p->r;
|
||||
colreg_float.env_g_stack[i] = (int)env_p->g;
|
||||
colreg_float.env_b_stack[i] = (int)env_p->b;
|
||||
colreg_float.env_a_stack[i] = (int)env_p->a;
|
||||
}
|
||||
|
||||
{
|
||||
EVW_ANIME_COL_PRIM nonlinear_prim;
|
||||
EVW_ANIME_COL_ENV nonlinear_env;
|
||||
{
|
||||
EVW_ANIME_COL_PRIM nonlinear_prim;
|
||||
EVW_ANIME_COL_ENV nonlinear_env;
|
||||
|
||||
nonlinear_prim.r = RagrangeInt_Color(colreg->key_count, colreg_float.keyframe_stack, colreg_float.prim_r_stack, now_frame);
|
||||
nonlinear_prim.g = RagrangeInt_Color(colreg->key_count, colreg_float.keyframe_stack, colreg_float.prim_g_stack, now_frame);
|
||||
nonlinear_prim.b = RagrangeInt_Color(colreg->key_count, colreg_float.keyframe_stack, colreg_float.prim_b_stack, now_frame);
|
||||
nonlinear_prim.a = RagrangeInt_Color(colreg->key_count, colreg_float.keyframe_stack, colreg_float.prim_a_stack, now_frame);
|
||||
nonlinear_prim.l = RagrangeInt_Color(colreg->key_count, colreg_float.keyframe_stack, colreg_float.prim_l_stack, now_frame);
|
||||
nonlinear_prim.r =
|
||||
RagrangeInt_Color(colreg->key_count, colreg_float.keyframe_stack, colreg_float.prim_r_stack, now_frame);
|
||||
nonlinear_prim.g =
|
||||
RagrangeInt_Color(colreg->key_count, colreg_float.keyframe_stack, colreg_float.prim_g_stack, now_frame);
|
||||
nonlinear_prim.b =
|
||||
RagrangeInt_Color(colreg->key_count, colreg_float.keyframe_stack, colreg_float.prim_b_stack, now_frame);
|
||||
nonlinear_prim.a =
|
||||
RagrangeInt_Color(colreg->key_count, colreg_float.keyframe_stack, colreg_float.prim_a_stack, now_frame);
|
||||
nonlinear_prim.l =
|
||||
RagrangeInt_Color(colreg->key_count, colreg_float.keyframe_stack, colreg_float.prim_l_stack, now_frame);
|
||||
|
||||
nonlinear_env.r = RagrangeInt_Color(colreg->key_count, colreg_float.keyframe_stack, colreg_float.env_r_stack, now_frame);
|
||||
nonlinear_env.g = RagrangeInt_Color(colreg->key_count, colreg_float.keyframe_stack, colreg_float.env_g_stack, now_frame);
|
||||
nonlinear_env.b = RagrangeInt_Color(colreg->key_count, colreg_float.keyframe_stack, colreg_float.env_b_stack, now_frame);
|
||||
nonlinear_env.a = RagrangeInt_Color(colreg->key_count, colreg_float.keyframe_stack, colreg_float.env_a_stack, now_frame);
|
||||
nonlinear_env.r =
|
||||
RagrangeInt_Color(colreg->key_count, colreg_float.keyframe_stack, colreg_float.env_r_stack, now_frame);
|
||||
nonlinear_env.g =
|
||||
RagrangeInt_Color(colreg->key_count, colreg_float.keyframe_stack, colreg_float.env_g_stack, now_frame);
|
||||
nonlinear_env.b =
|
||||
RagrangeInt_Color(colreg->key_count, colreg_float.keyframe_stack, colreg_float.env_b_stack, now_frame);
|
||||
nonlinear_env.a =
|
||||
RagrangeInt_Color(colreg->key_count, colreg_float.keyframe_stack, colreg_float.env_a_stack, now_frame);
|
||||
|
||||
evw_color_set(play, segment, &nonlinear_prim, &nonlinear_env);
|
||||
}
|
||||
evw_color_set(play, segment, &nonlinear_prim, &nonlinear_env);
|
||||
}
|
||||
}
|
||||
|
||||
static void evw_anime_texanime(GAME_PLAY* play, int segment, void* evw_data) {
|
||||
EVW_ANIME_TEXANIME* texanime = (EVW_ANIME_TEXANIME*)evw_data;
|
||||
GRAPH* g = play->game.graph;
|
||||
int frame = play->game_frame % (texanime->frame_count * 2); // 30fps pattern -> 60fps pattern
|
||||
void* tex_p = texanime->texture_tbl[texanime->animation_pattern[frame / 2]]; // 60fps pattern back to 30fps
|
||||
EVW_ANIME_TEXANIME* texanime = (EVW_ANIME_TEXANIME*)evw_data;
|
||||
GRAPH* g = play->game.graph;
|
||||
int frame = play->game_frame % (texanime->frame_count * 2); // 30fps pattern -> 60fps pattern
|
||||
void* tex_p = texanime->texture_tbl[texanime->animation_pattern[frame / 2]]; // 60fps pattern back to 30fps
|
||||
|
||||
OPEN_DISP(g);
|
||||
OPEN_DISP(g);
|
||||
|
||||
gSPSegment(NOW_BG_OPA_DISP++, segment, tex_p);
|
||||
gSPSegment(NOW_POLY_OPA_DISP++, segment, tex_p);
|
||||
gSPSegment(NOW_POLY_XLU_DISP++, segment, tex_p);
|
||||
gSPSegment(NOW_BG_OPA_DISP++, segment, tex_p);
|
||||
gSPSegment(NOW_POLY_OPA_DISP++, segment, tex_p);
|
||||
gSPSegment(NOW_POLY_XLU_DISP++, segment, tex_p);
|
||||
|
||||
CLOSE_DISP(g);
|
||||
CLOSE_DISP(g);
|
||||
}
|
||||
|
||||
typedef void (*EVW_ANIME_PROC)(GAME_PLAY*, int, void*);
|
||||
|
||||
extern void Evw_Anime_Set(GAME_PLAY* play, EVW_ANIME_DATA* evw_anime_data) {
|
||||
static EVW_ANIME_PROC evw_anime_proc[EVW_ANIME_TYPE_NUM] = {
|
||||
&evw_anime_scroll1,
|
||||
&evw_anime_scroll2,
|
||||
&evw_anime_colreg_manual,
|
||||
&evw_anime_colreg_linear,
|
||||
&evw_anime_colreg_nonlinear,
|
||||
&evw_anime_texanime
|
||||
};
|
||||
static EVW_ANIME_PROC evw_anime_proc[EVW_ANIME_TYPE_NUM] = {
|
||||
&evw_anime_scroll1, &evw_anime_scroll2, &evw_anime_colreg_manual,
|
||||
&evw_anime_colreg_linear, &evw_anime_colreg_nonlinear, &evw_anime_texanime,
|
||||
};
|
||||
|
||||
if (evw_anime_data != NULL) {
|
||||
int segment = evw_anime_data->segment;
|
||||
if (evw_anime_data != NULL) {
|
||||
int segment = evw_anime_data->segment;
|
||||
|
||||
if (segment != 0) {
|
||||
do {
|
||||
segment = evw_anime_data->segment;
|
||||
(*evw_anime_proc[evw_anime_data->type])(play, G_MWO_SEGMENT_7 + ABS(segment), evw_anime_data->data_p);
|
||||
evw_anime_data++;
|
||||
} while (segment >= 0);
|
||||
if (segment != 0) {
|
||||
do {
|
||||
segment = evw_anime_data->segment;
|
||||
(*evw_anime_proc[evw_anime_data->type])(play, G_MWO_SEGMENT_7 + ABS(segment), evw_anime_data->data_p);
|
||||
evw_anime_data++;
|
||||
} while (segment >= 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+10
@@ -156,7 +156,11 @@ static void game_init_hyral(GAME* this, size_t size) {
|
||||
THA_ct(&this->tha, (char*)hyral, size);
|
||||
} else {
|
||||
THA_ct(&this->tha, NULL, 0);
|
||||
#if VERSION == VER_GAFU01_00
|
||||
_dbg_hungup(__FILE__, 565);
|
||||
#elif VERSION == VER_GAFE01_00
|
||||
_dbg_hungup(__FILE__, 559);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -187,7 +191,11 @@ extern void game_resize_hyral(GAME* this, int size) {
|
||||
THA_ct(&this->tha, (char*)hyral, (u32)size);
|
||||
} else {
|
||||
THA_ct(&this->tha, NULL, 0);
|
||||
#if VERSION == VER_GAFU01_00
|
||||
_dbg_hungup(__FILE__, 639);
|
||||
#elif VERSION == VER_GAFE01_00
|
||||
_dbg_hungup(__FILE__, 633);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -208,7 +216,9 @@ extern void game_ct(GAME* this, void (*init)(GAME*), GRAPH* graph) {
|
||||
__gfxprint_default_flags |= GFXPRINT_FLAG_HIGHRES;
|
||||
init(this);
|
||||
mBGM_init();
|
||||
#if VERSION < VER_GAFU01_00
|
||||
GBAInit();
|
||||
#endif
|
||||
mVibctl_init();
|
||||
}
|
||||
|
||||
|
||||
+3
-2
@@ -145,7 +145,7 @@ static void Actor_ct(ACTOR* actor, GAME* game) {
|
||||
actor->scale.y = 0.01f;
|
||||
actor->scale.z = 0.01f;
|
||||
actor->max_velocity_y = -20.0f;
|
||||
actor->player_distance = 3.4028235E+38;
|
||||
actor->player_distance = FLT_MAX; //3.4028235E+38;
|
||||
actor->cull_width = 350.0f;
|
||||
actor->cull_height = 700.0f;
|
||||
actor->cull_distance = 1000.0f;
|
||||
@@ -274,8 +274,9 @@ extern int Actor_draw_actor_no_culling_check2(ACTOR* actor, xyz_t* camera_pos, f
|
||||
|
||||
if (-actor->cull_radius < camera_pos->z && camera_pos->z < actor->cull_distance + actor->cull_radius) {
|
||||
f32 m = camera_w < 1.0f ? 1.0f : 1.0f / camera_w;
|
||||
int width_OK = (m * (fabsf(camera_pos->x) - actor->cull_width)) < 1.0f;
|
||||
|
||||
if ((m * (fabsf(camera_pos->x) - actor->cull_width)) < 1.0f &&
|
||||
if (width_OK &&
|
||||
(m * (camera_pos->y + actor->cull_height)) > -1.0f && (m * (camera_pos->y - actor->cull_radius) < 1.0f)) {
|
||||
res = TRUE;
|
||||
}
|
||||
|
||||
@@ -311,10 +311,10 @@ static void mAD_turn_page_proc(Submenu* submenu, mSM_MenuInfo_c* menu_info) {
|
||||
int i;
|
||||
f32 pos;
|
||||
|
||||
pos = adrs_ovl->pos_x;
|
||||
if (fabsf(pos) < 14.0f) {
|
||||
pos = fabsf(adrs_ovl->pos_x);
|
||||
if (pos < 14.0f) {
|
||||
adrs_ovl->speed_x *= sqrtf(2.0f);
|
||||
} else if (fabsf(pos) > 30.0f) {
|
||||
} else if (pos > 30.0f) {
|
||||
adrs_ovl->speed_x *= sqrtf(0.5f);
|
||||
|
||||
if (fabsf(adrs_ovl->speed_x) < 0.25f) {
|
||||
@@ -345,11 +345,10 @@ static void mAD_turn_page2_proc(Submenu* submenu, mSM_MenuInfo_c* menu_info) {
|
||||
mAD_Ovl_c* adrs_ovl = submenu->overlay->address_ovl;
|
||||
f32 pos;
|
||||
|
||||
pos = adrs_ovl->pos_x;
|
||||
|
||||
if (fabsf(pos) > 30.0f) {
|
||||
pos = fabsf(adrs_ovl->pos_x);
|
||||
if (pos > 30.0f) {
|
||||
adrs_ovl->speed_x *= sqrtf(2.0f);
|
||||
} else if (fabsf(pos) < 14.0f) {
|
||||
} else if (pos < 14.0f) {
|
||||
adrs_ovl->speed_x *= sqrtf(0.5f);
|
||||
}
|
||||
|
||||
|
||||
@@ -917,8 +917,8 @@ static void mAGrw_ChangeItemBlock2(mActor_name_t* block_items, u8 changeable_num
|
||||
mActor_name_t* source_table, int table_num) {
|
||||
int changed = FALSE;
|
||||
int selected = RANDOM(changeable_num);
|
||||
int i;
|
||||
int j;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < UT_TOTAL_NUM; i++) {
|
||||
for (j = 0; j < table_num; j++) {
|
||||
@@ -1519,8 +1519,10 @@ static void mAGrw_SetCarpOnHomeBlock(mAGrw_CarpInfo_c* carp_info, mFM_fg_c* fg_b
|
||||
} else {
|
||||
block_house_info[0]++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fg_block++;
|
||||
block_info++;
|
||||
}
|
||||
|
||||
@@ -1807,8 +1809,21 @@ typedef int (*mAGrw_CHECK_FG_PROC)(mActor_name_t);
|
||||
static void mAGrw_LimitTreeLineIsland(mFM_fg_c* island_block) {
|
||||
static mAGrw_CHECK_FG_PROC check_fg[mAGrw_TREE_STAGE_NUM] = { &mAGrw_CheckTree000, &mAGrw_CheckTree001,
|
||||
&mAGrw_CheckTree002, &mAGrw_CheckTree003,
|
||||
&mAGrw_CheckTree004 };
|
||||
|
||||
&mAGrw_CheckTree004, };
|
||||
// TODO: Ordering needs to be fixed, this seems fake
|
||||
#if VERSION >= VER_GAFU01_00
|
||||
int tree_size_count_tbl[mAGrw_TREE_STAGE_NUM];
|
||||
mFM_fg_c* island_block_p;
|
||||
u8 ignored_record;
|
||||
int max_trees;
|
||||
int selected;
|
||||
mActor_name_t* items;
|
||||
int trees;
|
||||
int ut_x;
|
||||
int ut_z;
|
||||
int tree_size;
|
||||
int block;
|
||||
#else
|
||||
int tree_size_count_tbl[mAGrw_TREE_STAGE_NUM];
|
||||
mFM_fg_c* island_block_p;
|
||||
u8 ignored_record;
|
||||
@@ -1820,6 +1835,7 @@ static void mAGrw_LimitTreeLineIsland(mFM_fg_c* island_block) {
|
||||
int trees;
|
||||
int tree_size;
|
||||
int block;
|
||||
#endif
|
||||
|
||||
island_block_p = island_block;
|
||||
|
||||
@@ -2157,9 +2173,9 @@ static void mAGrw_SetblockCancelUtInfo(u16* cancel_ut, mActor_name_t* items, int
|
||||
&mAGrw_CheckCancel57, &mAGrw_CheckCancel68, &mAGrw_CheckCancel77
|
||||
};
|
||||
|
||||
int proc;
|
||||
int ut_z;
|
||||
int ut_x;
|
||||
int proc;
|
||||
|
||||
for (ut_z = 0; ut_z < UT_Z_NUM; ut_z++) {
|
||||
for (ut_x = 0; ut_x < UT_X_NUM; ut_x++) {
|
||||
|
||||
+263
-320
@@ -7,233 +7,207 @@
|
||||
#include "m_lib.h"
|
||||
#include "m_common_data.h"
|
||||
|
||||
static int aNSM_sack_amount[MONEY_NUM] = {
|
||||
100,
|
||||
1000,
|
||||
10000,
|
||||
30000
|
||||
};
|
||||
static int aNSM_sack_amount[MONEY_NUM] = { 100, 1000, 10000, 30000 };
|
||||
|
||||
static mActor_name_t aNSM_itemNo[MONEY_NUM] = {
|
||||
ITM_MONEY_100,
|
||||
ITM_MONEY_1000,
|
||||
ITM_MONEY_10000,
|
||||
ITM_MONEY_30000
|
||||
};
|
||||
static mActor_name_t aNSM_itemNo[MONEY_NUM] = { ITM_MONEY_100, ITM_MONEY_1000, ITM_MONEY_10000, ITM_MONEY_30000 };
|
||||
|
||||
static void mBN_now_bell_2_bell(mBN_Ovl_c* bank_ovl) {
|
||||
int diff = bank_ovl->now_bell - bank_ovl->player_bell;
|
||||
bank_ovl->bell = ABS(diff);
|
||||
int diff = bank_ovl->now_bell - bank_ovl->player_bell;
|
||||
bank_ovl->bell = ABS(diff);
|
||||
}
|
||||
|
||||
static int mBN_cursol_2_keta(int cursol) {
|
||||
int keta = 1;
|
||||
int i;
|
||||
int keta = 1;
|
||||
|
||||
for (i = cursol; i < mBN_CURSOL_MAX; i++) {
|
||||
keta *= 10;
|
||||
}
|
||||
while (cursol++ < mBN_CURSOL_MAX) {
|
||||
keta *= 10;
|
||||
}
|
||||
|
||||
return keta;
|
||||
return keta;
|
||||
}
|
||||
|
||||
static int mBN_total_item_bell() {
|
||||
int i;
|
||||
int total_item_bell = 0;
|
||||
int i;
|
||||
int total_item_bell = 0;
|
||||
|
||||
for (i = 0; i < MONEY_NUM; i++) {
|
||||
int possess = mPr_GetPossessionItemSumWithCond(Common_Get(now_private), aNSM_itemNo[i], mPr_ITEM_COND_NORMAL);
|
||||
for (i = 0; i < MONEY_NUM; i++) {
|
||||
int possess = mPr_GetPossessionItemSumWithCond(Common_Get(now_private), aNSM_itemNo[i], mPr_ITEM_COND_NORMAL);
|
||||
|
||||
total_item_bell += possess * aNSM_sack_amount[i];
|
||||
}
|
||||
total_item_bell += possess * aNSM_sack_amount[i];
|
||||
}
|
||||
|
||||
return total_item_bell;
|
||||
return total_item_bell;
|
||||
}
|
||||
|
||||
static void mBN_bank_ok(Submenu* submenu, mSM_MenuInfo_c* menu, mBN_Ovl_c* bank_ovl) {
|
||||
if (bank_ovl->bank_bell < 0) {
|
||||
bank_ovl->bank_bell = 0;
|
||||
}
|
||||
int total_item_bell;
|
||||
int remain_item_bell;
|
||||
int sack_idx;
|
||||
int i;
|
||||
|
||||
if (bank_ovl->bank_bell > mBN_DEPOSIT_MAX) {
|
||||
bank_ovl->bank_bell = mBN_DEPOSIT_MAX;
|
||||
}
|
||||
if (bank_ovl->bank_bell < 0) {
|
||||
bank_ovl->bank_bell = 0;
|
||||
}
|
||||
|
||||
Common_Get(now_private)->bank_account = bank_ovl->bank_bell;
|
||||
if (bank_ovl->bank_bell > mBN_DEPOSIT_MAX) {
|
||||
bank_ovl->bank_bell = mBN_DEPOSIT_MAX;
|
||||
}
|
||||
|
||||
{
|
||||
int total_item_bell = mBN_total_item_bell();
|
||||
int i = 0;
|
||||
Common_Get(now_private)->bank_account = bank_ovl->bank_bell;
|
||||
|
||||
total_item_bell = mBN_total_item_bell();
|
||||
i = 0;
|
||||
|
||||
/* Replace all money sack items with EMPTY_NO */
|
||||
while (bank_ovl->now_bell < total_item_bell && i < MONEY_NUM) {
|
||||
int sack_idx = mPr_GetPossessionItemIdxWithCond(Common_Get(now_private), aNSM_itemNo[i], mPr_ITEM_COND_NORMAL);
|
||||
if (sack_idx == -1) {
|
||||
i++; /* move onto next sack amount */
|
||||
}
|
||||
else {
|
||||
mPr_SetPossessionItem(Common_Get(now_private), sack_idx, EMPTY_NO, mPr_ITEM_COND_NORMAL);
|
||||
}
|
||||
sack_idx =
|
||||
mPr_GetPossessionItemIdxWithCond(Common_Get(now_private), aNSM_itemNo[i], mPr_ITEM_COND_NORMAL);
|
||||
if (sack_idx == -1) {
|
||||
i++; /* move onto next sack amount */
|
||||
} else {
|
||||
mPr_SetPossessionItem(Common_Get(now_private), sack_idx, EMPTY_NO, mPr_ITEM_COND_NORMAL);
|
||||
}
|
||||
|
||||
total_item_bell = mBN_total_item_bell(); /* update total bell count in sacks */
|
||||
total_item_bell = mBN_total_item_bell(); /* update total bell count in sacks */
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
/* Replace non-30k bell bags with 30k bell bags */
|
||||
int i;
|
||||
int total_item_bell = bank_ovl->now_bell - mBN_total_item_bell();
|
||||
|
||||
/* Replace non-30k bell bags with 30k bell bags */
|
||||
remain_item_bell = bank_ovl->now_bell - mBN_total_item_bell();
|
||||
i = 0;
|
||||
|
||||
while (total_item_bell > mPr_WALLET_MAX && i < MONEY_NUM - 1) {
|
||||
int sack_idx = mPr_GetPossessionItemIdxWithCond(Common_Get(now_private), aNSM_itemNo[i], mPr_ITEM_COND_NORMAL);
|
||||
|
||||
if (sack_idx == -1) {
|
||||
i++;
|
||||
}
|
||||
else {
|
||||
mPr_SetPossessionItem(Common_Get(now_private), sack_idx, ITM_MONEY_30000, mPr_ITEM_COND_NORMAL);
|
||||
total_item_bell -= 30000 - aNSM_sack_amount[i];
|
||||
}
|
||||
while (remain_item_bell > mPr_WALLET_MAX && i < MONEY_NUM - 1) {
|
||||
sack_idx =
|
||||
mPr_GetPossessionItemIdxWithCond(Common_Get(now_private), aNSM_itemNo[i], mPr_ITEM_COND_NORMAL);
|
||||
|
||||
if (sack_idx == -1) {
|
||||
i++;
|
||||
} else {
|
||||
mPr_SetPossessionItem(Common_Get(now_private), sack_idx, ITM_MONEY_30000, mPr_ITEM_COND_NORMAL);
|
||||
remain_item_bell -= 30000 - aNSM_sack_amount[i];
|
||||
}
|
||||
}
|
||||
|
||||
/* Add 30k bell bags to the inventory where empty spaces are */
|
||||
i = 0;
|
||||
while (remain_item_bell > mPr_WALLET_MAX && i < 1) {
|
||||
int sack_idx = mPr_GetPossessionItemIdxWithCond(Common_Get(now_private), EMPTY_NO, mPr_ITEM_COND_NORMAL);
|
||||
|
||||
while (total_item_bell > mPr_WALLET_MAX && i < 1) {
|
||||
int sack_idx = mPr_GetPossessionItemIdxWithCond(Common_Get(now_private), EMPTY_NO, mPr_ITEM_COND_NORMAL);
|
||||
|
||||
if (sack_idx == -1) {
|
||||
i++;
|
||||
}
|
||||
else {
|
||||
mPr_SetPossessionItem(Common_Get(now_private), sack_idx, ITM_MONEY_30000, mPr_ITEM_COND_NORMAL);
|
||||
total_item_bell -= 30000;
|
||||
}
|
||||
if (sack_idx == -1) {
|
||||
i++;
|
||||
} else {
|
||||
mPr_SetPossessionItem(Common_Get(now_private), sack_idx, ITM_MONEY_30000, mPr_ITEM_COND_NORMAL);
|
||||
remain_item_bell -= 30000;
|
||||
}
|
||||
}
|
||||
|
||||
bank_ovl->now_bell -= mBN_total_item_bell();
|
||||
|
||||
if (bank_ovl->now_bell < 0) {
|
||||
bank_ovl->now_bell = 0;
|
||||
}
|
||||
else if (bank_ovl->now_bell > mPr_WALLET_MAX) {
|
||||
bank_ovl->now_bell = mPr_WALLET_MAX;
|
||||
bank_ovl->now_bell = 0;
|
||||
} else if (bank_ovl->now_bell > mPr_WALLET_MAX) {
|
||||
bank_ovl->now_bell = mPr_WALLET_MAX;
|
||||
}
|
||||
|
||||
Common_Get(now_private)->inventory.wallet = bank_ovl->now_bell;
|
||||
(*submenu->overlay->move_chg_base_proc)(menu, mSM_MOVE_OUT_TOP);
|
||||
sAdo_SysTrgStart(NA_SE_MENU_EXIT);
|
||||
}
|
||||
}
|
||||
|
||||
static void mBN_move_Move(Submenu* submenu, mSM_MenuInfo_c* menu) {
|
||||
(*submenu->overlay->move_Move_proc)(submenu, menu);
|
||||
(*submenu->overlay->move_Move_proc)(submenu, menu);
|
||||
}
|
||||
|
||||
static void mBN_move_Play(Submenu* submenu, mSM_MenuInfo_c* menu) {
|
||||
Submenu_Overlay_c* overlay = submenu->overlay;
|
||||
int trigger = overlay->menu_control.trigger;
|
||||
mBN_Ovl_c* bank_ovl = overlay->bank_ovl;
|
||||
Submenu_Overlay_c* overlay = submenu->overlay;
|
||||
int trigger = overlay->menu_control.trigger;
|
||||
mBN_Ovl_c* bank_ovl = overlay->bank_ovl;
|
||||
|
||||
if (trigger & BUTTON_B) {
|
||||
(*overlay->move_chg_base_proc)(menu, mSM_MOVE_OUT_TOP);
|
||||
sAdo_SysTrgStart(NA_SE_MENU_EXIT);
|
||||
}
|
||||
else if (trigger & BUTTON_START) {
|
||||
mBN_bank_ok(submenu, menu, bank_ovl);
|
||||
}
|
||||
else {
|
||||
int cursol = bank_ovl->cursol;
|
||||
|
||||
if (cursol == mBN_CUSROL_OK) {
|
||||
if (trigger & BUTTON_A) {
|
||||
if (trigger & BUTTON_B) {
|
||||
(*overlay->move_chg_base_proc)(menu, mSM_MOVE_OUT_TOP);
|
||||
sAdo_SysTrgStart(NA_SE_MENU_EXIT);
|
||||
} else if (trigger & BUTTON_START) {
|
||||
mBN_bank_ok(submenu, menu, bank_ovl);
|
||||
}
|
||||
else if (trigger & (BUTTON_CLEFT | BUTTON_CUP)) {
|
||||
bank_ovl->cursol = cursol - 1;
|
||||
sAdo_SysTrgStart(NA_SE_CURSOL);
|
||||
}
|
||||
} else {
|
||||
int cursol = bank_ovl->cursol;
|
||||
|
||||
if (cursol == mBN_CUSROL_OK) {
|
||||
if (trigger & BUTTON_A) {
|
||||
mBN_bank_ok(submenu, menu, bank_ovl);
|
||||
} else if (trigger & (BUTTON_CLEFT | BUTTON_CUP)) {
|
||||
bank_ovl->cursol = cursol - 1;
|
||||
sAdo_SysTrgStart(NA_SE_CURSOL);
|
||||
}
|
||||
} else if ((trigger & BUTTON_CLEFT) && cursol > 0) {
|
||||
bank_ovl->cursol = cursol - 1;
|
||||
sAdo_SysTrgStart(NA_SE_CURSOL);
|
||||
} else if (trigger & BUTTON_CRIGHT) {
|
||||
bank_ovl->cursol += 1;
|
||||
sAdo_SysTrgStart(NA_SE_CURSOL);
|
||||
} else if ((trigger & BUTTON_CDOWN) || (trigger & BUTTON_CUP)) {
|
||||
int keta = mBN_cursol_2_keta(cursol);
|
||||
|
||||
if (trigger & BUTTON_CUP) {
|
||||
if (bank_ovl->now_bell < keta) {
|
||||
keta = bank_ovl->now_bell;
|
||||
}
|
||||
|
||||
if (keta + bank_ovl->bank_bell > mBN_DEPOSIT_MAX) {
|
||||
keta = mBN_DEPOSIT_MAX - bank_ovl->bank_bell;
|
||||
}
|
||||
|
||||
if (keta == 0) {
|
||||
sAdo_SysTrgStart(MONO(3));
|
||||
return;
|
||||
}
|
||||
|
||||
if (bank_ovl->now_bell > bank_ovl->player_bell && (bank_ovl->now_bell - keta) < bank_ovl->player_bell) {
|
||||
keta = bank_ovl->now_bell - bank_ovl->player_bell;
|
||||
}
|
||||
|
||||
bank_ovl->bank_bell += keta;
|
||||
bank_ovl->now_bell -= keta;
|
||||
} else {
|
||||
if (bank_ovl->bank_bell < keta) {
|
||||
keta = bank_ovl->bank_bell;
|
||||
}
|
||||
|
||||
if ((bank_ovl->now_bell + keta) > bank_ovl->player_max_bell) {
|
||||
keta = bank_ovl->player_max_bell - bank_ovl->now_bell;
|
||||
}
|
||||
|
||||
if (keta == 0) {
|
||||
sAdo_SysTrgStart(MONO(3));
|
||||
return;
|
||||
}
|
||||
|
||||
if (bank_ovl->now_bell < bank_ovl->player_bell && (bank_ovl->now_bell + keta) > bank_ovl->player_bell) {
|
||||
keta = bank_ovl->player_bell - bank_ovl->now_bell;
|
||||
}
|
||||
|
||||
bank_ovl->bank_bell -= keta;
|
||||
bank_ovl->now_bell += keta;
|
||||
}
|
||||
|
||||
mBN_now_bell_2_bell(bank_ovl);
|
||||
sAdo_SysTrgStart(0x426);
|
||||
}
|
||||
}
|
||||
else if ((trigger & BUTTON_CLEFT) && cursol > 0) {
|
||||
bank_ovl->cursol = cursol - 1;
|
||||
sAdo_SysTrgStart(NA_SE_CURSOL);
|
||||
}
|
||||
else if (trigger & BUTTON_CRIGHT) {
|
||||
bank_ovl->cursol += 1;
|
||||
sAdo_SysTrgStart(NA_SE_CURSOL);
|
||||
}
|
||||
else if ((trigger & BUTTON_CDOWN) || (trigger & BUTTON_CUP)) {
|
||||
int keta = mBN_cursol_2_keta(cursol);
|
||||
|
||||
if (trigger & BUTTON_CUP) {
|
||||
if (bank_ovl->now_bell < keta) {
|
||||
keta = bank_ovl->now_bell;
|
||||
}
|
||||
|
||||
if (keta + bank_ovl->bank_bell > mBN_DEPOSIT_MAX) {
|
||||
keta = mBN_DEPOSIT_MAX - bank_ovl->bank_bell;
|
||||
}
|
||||
|
||||
if (keta == 0) {
|
||||
sAdo_SysTrgStart(MONO(3));
|
||||
return;
|
||||
}
|
||||
|
||||
if (bank_ovl->now_bell > bank_ovl->player_bell && (bank_ovl->now_bell - keta) < bank_ovl->player_bell) {
|
||||
keta = bank_ovl->now_bell - bank_ovl->player_bell;
|
||||
}
|
||||
|
||||
bank_ovl->bank_bell += keta;
|
||||
bank_ovl->now_bell -= keta;
|
||||
}
|
||||
else {
|
||||
if (bank_ovl->bank_bell < keta) {
|
||||
keta = bank_ovl->bank_bell;
|
||||
}
|
||||
|
||||
if ((bank_ovl->now_bell + keta) > bank_ovl->player_max_bell) {
|
||||
keta = bank_ovl->player_max_bell - bank_ovl->now_bell;
|
||||
}
|
||||
|
||||
if (keta == 0) {
|
||||
sAdo_SysTrgStart(MONO(3));
|
||||
return;
|
||||
}
|
||||
|
||||
if (bank_ovl->now_bell < bank_ovl->player_bell && (bank_ovl->now_bell + keta) > bank_ovl->player_bell) {
|
||||
keta = bank_ovl->player_bell - bank_ovl->now_bell;
|
||||
}
|
||||
|
||||
bank_ovl->bank_bell -= keta;
|
||||
bank_ovl->now_bell += keta;
|
||||
}
|
||||
|
||||
mBN_now_bell_2_bell(bank_ovl);
|
||||
sAdo_SysTrgStart(0x426);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void mBN_move_End(Submenu* submenu, mSM_MenuInfo_c* menu) {
|
||||
(*submenu->overlay->move_End_proc)(submenu, menu);
|
||||
(*submenu->overlay->move_End_proc)(submenu, menu);
|
||||
}
|
||||
|
||||
static void mBN_bank_ovl_move(Submenu* submenu) {
|
||||
static mSM_MOVE_PROC ovl_move_proc[5] = {
|
||||
&mBN_move_Move,
|
||||
&mBN_move_Play,
|
||||
(mSM_MOVE_PROC)&none_proc1,
|
||||
(mSM_MOVE_PROC)&none_proc1,
|
||||
&mBN_move_End
|
||||
};
|
||||
static mSM_MOVE_PROC ovl_move_proc[5] = {
|
||||
&mBN_move_Move, &mBN_move_Play, (mSM_MOVE_PROC)&none_proc1, (mSM_MOVE_PROC)&none_proc1, &mBN_move_End,
|
||||
};
|
||||
|
||||
Submenu_Overlay_c* overlay = submenu->overlay;
|
||||
mSM_MenuInfo_c* menu = &overlay->menu_info[mSM_OVL_BANK];
|
||||
Submenu_Overlay_c* overlay = submenu->overlay;
|
||||
mSM_MenuInfo_c* menu = &overlay->menu_info[mSM_OVL_BANK];
|
||||
|
||||
(*menu->pre_move_func)(submenu);
|
||||
(*ovl_move_proc[menu->proc_status])(submenu, menu);
|
||||
(*menu->pre_move_func)(submenu);
|
||||
(*ovl_move_proc[menu->proc_status])(submenu, menu);
|
||||
}
|
||||
|
||||
extern Gfx tyo_win_mode[];
|
||||
@@ -242,209 +216,178 @@ extern Gfx tyo_win_moji2T_model[];
|
||||
extern Gfx tyo_win_moji3T_model[];
|
||||
|
||||
static void mBN_set_frame_dl(Submenu* submenu, GAME* game, mSM_MenuInfo_c* menu) {
|
||||
GRAPH* g = game->graph;
|
||||
mBN_Ovl_c* bank_ovl = submenu->overlay->bank_ovl;
|
||||
Gfx* gfx;
|
||||
u8 s;
|
||||
u8 t;
|
||||
GRAPH* g = game->graph;
|
||||
mBN_Ovl_c* bank_ovl = submenu->overlay->bank_ovl;
|
||||
Gfx* gfx;
|
||||
u8 s;
|
||||
u8 t;
|
||||
|
||||
Matrix_translate(menu->position[0] * 16.0f, menu->position[1] * 16.0f, 140.0f, MTX_LOAD);
|
||||
Matrix_scale(16.0f, 16.0f, 1.0f, MTX_MULT);
|
||||
Matrix_translate(menu->position[0] * 16.0f, menu->position[1] * 16.0f, 140.0f, MTX_LOAD);
|
||||
Matrix_scale(16.0f, 16.0f, 1.0f, MTX_MULT);
|
||||
|
||||
OPEN_DISP(g);
|
||||
gfx = NOW_POLY_OPA_DISP;
|
||||
OPEN_DISP(g);
|
||||
gfx = NOW_POLY_OPA_DISP;
|
||||
|
||||
gSPDisplayList(gfx++, tyo_win_mode);
|
||||
gSPMatrix(gfx++, _Matrix_to_Mtx_new(g), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
s = -submenu->overlay->menu_control.texture_pos[0] * 4.0f;
|
||||
t = -submenu->overlay->menu_control.texture_pos[1] * 4.0f;
|
||||
gDPSetTileSize_Dolphin(gfx++, 0, s, t, 32, 32);
|
||||
gSPDisplayList(gfx++, tyo_win_model);
|
||||
|
||||
gSPDisplayList(gfx++, tyo_win_mode);
|
||||
gSPMatrix(gfx++, _Matrix_to_Mtx_new(g), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
s = -submenu->overlay->menu_control.texture_pos[0] * 4.0f;
|
||||
t = -submenu->overlay->menu_control.texture_pos[1] * 4.0f;
|
||||
gDPSetTileSize_Dolphin(gfx++, 0, s, t, 32, 32);
|
||||
gSPDisplayList(gfx++, tyo_win_model);
|
||||
if (bank_ovl->now_bell <= bank_ovl->player_bell) {
|
||||
gDPSetPrimColor(gfx++, 0, 255, 165, 50, 50, 255);
|
||||
gDPSetEnvColor(gfx++, 255, 255, 255, 255);
|
||||
} else {
|
||||
gDPSetPrimColor(gfx++, 0, 255, 100, 80, 80, 255);
|
||||
gDPSetEnvColor(gfx++, 165, 155, 155, 255);
|
||||
}
|
||||
|
||||
if (bank_ovl->now_bell <= bank_ovl->player_bell) {
|
||||
gDPSetPrimColor(gfx++, 0, 255, 165, 50, 50, 255);
|
||||
gDPSetEnvColor(gfx++, 255, 255, 255, 255);
|
||||
}
|
||||
else {
|
||||
gDPSetPrimColor(gfx++, 0, 255, 100, 80, 80, 255);
|
||||
gDPSetEnvColor(gfx++, 165, 155, 155, 255);
|
||||
}
|
||||
gSPDisplayList(gfx++, tyo_win_moji2T_model);
|
||||
|
||||
gSPDisplayList(gfx++, tyo_win_moji2T_model);
|
||||
|
||||
if (bank_ovl->now_bell >= bank_ovl->player_bell) {
|
||||
gDPSetPrimColor(gfx++, 0, 255, 20, 205, 20, 255);
|
||||
gDPSetEnvColor(gfx++, 255, 255, 255, 255);
|
||||
}
|
||||
else {
|
||||
gDPSetPrimColor(gfx++, 0, 255, 70, 95, 70, 255);
|
||||
gDPSetEnvColor(gfx++, 155, 165, 155, 255);
|
||||
}
|
||||
if (bank_ovl->now_bell >= bank_ovl->player_bell) {
|
||||
gDPSetPrimColor(gfx++, 0, 255, 20, 205, 20, 255);
|
||||
gDPSetEnvColor(gfx++, 255, 255, 255, 255);
|
||||
} else {
|
||||
gDPSetPrimColor(gfx++, 0, 255, 70, 95, 70, 255);
|
||||
gDPSetEnvColor(gfx++, 155, 165, 155, 255);
|
||||
}
|
||||
|
||||
gSPDisplayList(gfx++, tyo_win_moji3T_model);
|
||||
gSPDisplayList(gfx++, tyo_win_moji3T_model);
|
||||
|
||||
|
||||
SET_POLY_OPA_DISP(gfx);
|
||||
CLOSE_DISP(g);
|
||||
SET_POLY_OPA_DISP(gfx);
|
||||
CLOSE_DISP(g);
|
||||
}
|
||||
|
||||
static void mBN_set_num_str(f32 x, f32 y, GAME* game, u32 num, f32 scale, rgba_t* color) {
|
||||
u8 str[11];
|
||||
f32 width;
|
||||
u8 str[11];
|
||||
f32 width;
|
||||
|
||||
mFont_UnintToString(str, 11, num, 9, FALSE, FALSE, TRUE);
|
||||
width = mFont_GetStringWidth(str, 11, TRUE);
|
||||
x -= scale * width;
|
||||
mFont_UnintToString(str, 11, num, 9, FALSE, FALSE, TRUE);
|
||||
width = mFont_GetStringWidth(str, 11, TRUE);
|
||||
x -= scale * width;
|
||||
|
||||
mFont_SetLineStrings(
|
||||
game,
|
||||
str, 11,
|
||||
x, y,
|
||||
color->r, color->g, color->b, 255,
|
||||
FALSE, TRUE,
|
||||
scale, scale,
|
||||
mFont_MODE_POLY
|
||||
);
|
||||
mFont_SetLineStrings(game, str, 11, x, y, color->r, color->g, color->b, 255, FALSE, TRUE, scale, scale,
|
||||
mFont_MODE_POLY);
|
||||
}
|
||||
|
||||
static void mBN_set_character_dl(Submenu* submenu, GAME* game, mSM_MenuInfo_c* menu) {
|
||||
static u8 kingaku_str[] = { CHAR_Y, CHAR_o, CHAR_u, CHAR_r, CHAR_SPACE, CHAR_A, CHAR_c, CHAR_c, CHAR_o, CHAR_u, CHAR_n, CHAR_t };
|
||||
static u8 end_str[] = { CHAR_O, CHAR_K };
|
||||
static rgba_t normal_col = { 0, 50, 255, 255 };
|
||||
static rgba_t select_col = { 195, 20, 20, 255 };
|
||||
static rgba_t bank_bell_col = { 170, 60, 145, 255 };
|
||||
static rgba_t now_bell_col = { 115, 50, 215, 255 };
|
||||
|
||||
mBN_Ovl_c* bank_ovl;
|
||||
int cursol;
|
||||
f32 width;
|
||||
f32 digit_x;
|
||||
int i;
|
||||
u8 str[7];
|
||||
f32 pos_x = menu->position[0];
|
||||
f32 pos_y = menu->position[1];
|
||||
static u8 kingaku_str[] = { CHAR_Y, CHAR_o, CHAR_u, CHAR_r, CHAR_SPACE, CHAR_A,
|
||||
CHAR_c, CHAR_c, CHAR_o, CHAR_u, CHAR_n, CHAR_t };
|
||||
static u8 end_str[] = { CHAR_O, CHAR_K };
|
||||
static rgba_t normal_col = { 0, 50, 255, 255 };
|
||||
static rgba_t select_col = { 195, 20, 20, 255 };
|
||||
static rgba_t bank_bell_col = { 170, 60, 145, 255 };
|
||||
static rgba_t now_bell_col = { 115, 50, 215, 255 };
|
||||
|
||||
bank_ovl = submenu->overlay->bank_ovl;
|
||||
mBN_Ovl_c* bank_ovl;
|
||||
int cursol;
|
||||
f32 width;
|
||||
f32 digit_x;
|
||||
int i;
|
||||
u8 str[7];
|
||||
f32 pos_x = menu->position[0];
|
||||
f32 pos_y = menu->position[1];
|
||||
|
||||
(*submenu->overlay->set_char_matrix_proc)(game->graph);
|
||||
mFont_SetLineStrings(
|
||||
game,
|
||||
kingaku_str, sizeof(kingaku_str),
|
||||
145.0f + pos_x, 65.0f - pos_y,
|
||||
255, 255, 255, 255,
|
||||
FALSE, TRUE,
|
||||
0.875f, 0.875f,
|
||||
mFont_MODE_POLY
|
||||
);
|
||||
bank_ovl = submenu->overlay->bank_ovl;
|
||||
|
||||
mBN_set_num_str(211.0f + pos_x, 157.0f - pos_y, game, bank_ovl->bank_bell, 0.875f, &bank_bell_col);
|
||||
mBN_set_num_str(211.0f + pos_x, 98.0f - pos_y, game, bank_ovl->now_bell, 0.875f, &now_bell_col);
|
||||
(*submenu->overlay->set_char_matrix_proc)(game->graph);
|
||||
mFont_SetLineStrings(game, kingaku_str, sizeof(kingaku_str), 145.0f + pos_x, 65.0f - pos_y, 255, 255, 255, 255,
|
||||
FALSE, TRUE, 0.875f, 0.875f, mFont_MODE_POLY);
|
||||
|
||||
cursol = bank_ovl->cursol;
|
||||
mBN_set_num_str(211.0f + pos_x, 157.0f - pos_y, game, bank_ovl->bank_bell, 0.875f, &bank_bell_col);
|
||||
mBN_set_num_str(211.0f + pos_x, 98.0f - pos_y, game, bank_ovl->now_bell, 0.875f, &now_bell_col);
|
||||
|
||||
if (cursol >= 3) {
|
||||
cursol++;
|
||||
}
|
||||
cursol = bank_ovl->cursol;
|
||||
|
||||
mFont_UnintToString(str, 7, bank_ovl->bell, 6, FALSE, TRUE, TRUE);
|
||||
width = mFont_GetStringWidth(str, 7, TRUE);
|
||||
if (cursol >= 3) {
|
||||
cursol++;
|
||||
}
|
||||
|
||||
/* Draw each digit one by one */
|
||||
digit_x = 211.0f + (pos_x - width);
|
||||
for (i = 0; i < 7; i++) {
|
||||
rgba_t* color = cursol == i ? &select_col : &normal_col;
|
||||
mFont_UnintToString(str, 7, bank_ovl->bell, 6, FALSE, TRUE, TRUE);
|
||||
width = mFont_GetStringWidth(str, 7, TRUE);
|
||||
|
||||
mFont_SetLineStrings(
|
||||
game,
|
||||
str + i, 1,
|
||||
digit_x, 124.0f - pos_y,
|
||||
color->r, color->g, color->b, 255,
|
||||
FALSE, TRUE,
|
||||
1.0f, 1.0f,
|
||||
mFont_MODE_POLY
|
||||
);
|
||||
/* Draw each digit one by one */
|
||||
digit_x = 211.0f + (pos_x - width);
|
||||
for (i = 0; i < 7; i++) {
|
||||
rgba_t* color = cursol == i ? &select_col : &normal_col;
|
||||
|
||||
width = mFont_GetStringWidth(str + i, 1, TRUE);
|
||||
digit_x += width;
|
||||
}
|
||||
mFont_SetLineStrings(game, str + i, 1, digit_x, 124.0f - pos_y, color->r, color->g, color->b, 255, FALSE, TRUE,
|
||||
1.0f, 1.0f, mFont_MODE_POLY);
|
||||
|
||||
{
|
||||
rgba_t* color = bank_ovl->cursol < mBN_CUSROL_OK ? &normal_col : &select_col;
|
||||
width = mFont_GetStringWidth(str + i, 1, TRUE);
|
||||
digit_x += width;
|
||||
}
|
||||
|
||||
mFont_SetLineStrings(
|
||||
game,
|
||||
end_str, sizeof(end_str),
|
||||
208.0f + pos_x, 140.0f - pos_y,
|
||||
color->r, color->g, color->b, 255,
|
||||
FALSE, TRUE,
|
||||
0.875f, 0.875f,
|
||||
mFont_MODE_POLY
|
||||
);
|
||||
}
|
||||
{
|
||||
rgba_t* color = bank_ovl->cursol < mBN_CUSROL_OK ? &normal_col : &select_col;
|
||||
|
||||
mFont_SetLineStrings(game, end_str, sizeof(end_str), 208.0f + pos_x, 140.0f - pos_y, color->r, color->g,
|
||||
color->b, 255, FALSE, TRUE, 0.875f, 0.875f, mFont_MODE_POLY);
|
||||
}
|
||||
}
|
||||
|
||||
static void mBN_bank_ovl_draw(Submenu* submenu, GAME* game) {
|
||||
mSM_MenuInfo_c* menu = &submenu->overlay->menu_info[mSM_OVL_BANK];
|
||||
|
||||
(*menu->pre_draw_func)(submenu, game);
|
||||
mBN_set_frame_dl(submenu, game, menu);
|
||||
mBN_set_character_dl(submenu, game, menu);
|
||||
mSM_MenuInfo_c* menu = &submenu->overlay->menu_info[mSM_OVL_BANK];
|
||||
|
||||
(*menu->pre_draw_func)(submenu, game);
|
||||
mBN_set_frame_dl(submenu, game, menu);
|
||||
mBN_set_character_dl(submenu, game, menu);
|
||||
}
|
||||
|
||||
extern void mBN_bank_ovl_set_proc(Submenu* submenu) {
|
||||
Submenu_Overlay_c* overlay = submenu->overlay;
|
||||
Submenu_Overlay_c* overlay = submenu->overlay;
|
||||
|
||||
overlay->menu_control.menu_move_func = &mBN_bank_ovl_move;
|
||||
overlay->menu_control.menu_draw_func = &mBN_bank_ovl_draw;
|
||||
overlay->menu_control.menu_move_func = &mBN_bank_ovl_move;
|
||||
overlay->menu_control.menu_draw_func = &mBN_bank_ovl_draw;
|
||||
}
|
||||
|
||||
static void mBN_bank_ovl_init(Submenu* submenu) {
|
||||
Submenu_Overlay_c* overlay = submenu->overlay;
|
||||
mBN_Ovl_c* bank_ovl = overlay->bank_ovl;
|
||||
int i;
|
||||
Submenu_Overlay_c* overlay = submenu->overlay;
|
||||
mBN_Ovl_c* bank_ovl = overlay->bank_ovl;
|
||||
int i;
|
||||
|
||||
overlay->menu_control.animation_flag = FALSE;
|
||||
overlay->menu_info[mSM_OVL_BANK].proc_status = 0;
|
||||
overlay->menu_info[mSM_OVL_BANK].next_proc_status = 1;
|
||||
overlay->menu_info[mSM_OVL_BANK].move_drt = 5;
|
||||
overlay->menu_control.animation_flag = FALSE;
|
||||
overlay->menu_info[mSM_OVL_BANK].proc_status = 0;
|
||||
overlay->menu_info[mSM_OVL_BANK].next_proc_status = 1;
|
||||
overlay->menu_info[mSM_OVL_BANK].move_drt = 5;
|
||||
|
||||
bank_ovl->now_bell = Common_Get(now_private)->inventory.wallet;
|
||||
bank_ovl->now_bell += mBN_total_item_bell();
|
||||
bank_ovl->player_bell = bank_ovl->now_bell;
|
||||
bank_ovl->now_bell = Common_Get(now_private)->inventory.wallet;
|
||||
bank_ovl->now_bell += mBN_total_item_bell();
|
||||
bank_ovl->player_bell = bank_ovl->now_bell;
|
||||
|
||||
mBN_now_bell_2_bell(bank_ovl);
|
||||
bank_ovl->player_max_bell = mPr_WALLET_MAX;
|
||||
mBN_now_bell_2_bell(bank_ovl);
|
||||
bank_ovl->player_max_bell = mPr_WALLET_MAX;
|
||||
|
||||
for (i = 0; i < MONEY_NUM; i++) {
|
||||
int sack_sum = mPr_GetPossessionItemSumWithCond(Common_Get(now_private), aNSM_itemNo[i], mPr_ITEM_COND_NORMAL);
|
||||
|
||||
bank_ovl->player_max_bell += sack_sum * aNSM_sack_amount[3];
|
||||
}
|
||||
for (i = 0; i < MONEY_NUM; i++) {
|
||||
int sack_sum = mPr_GetPossessionItemSumWithCond(Common_Get(now_private), aNSM_itemNo[i], mPr_ITEM_COND_NORMAL);
|
||||
|
||||
{
|
||||
int sack_sum = mPr_GetPossessionItemSumWithCond(Common_Get(now_private), EMPTY_NO, mPr_ITEM_COND_NORMAL);
|
||||
|
||||
bank_ovl->player_max_bell += sack_sum * aNSM_sack_amount[3];
|
||||
}
|
||||
bank_ovl->bank_bell = Common_Get(now_private)->bank_account;
|
||||
bank_ovl->cursol = 0;
|
||||
bank_ovl->player_max_bell += sack_sum * aNSM_sack_amount[3];
|
||||
}
|
||||
|
||||
{
|
||||
int sack_sum = mPr_GetPossessionItemSumWithCond(Common_Get(now_private), EMPTY_NO, mPr_ITEM_COND_NORMAL);
|
||||
|
||||
bank_ovl->player_max_bell += sack_sum * aNSM_sack_amount[3];
|
||||
}
|
||||
bank_ovl->bank_bell = Common_Get(now_private)->bank_account;
|
||||
bank_ovl->cursol = 0;
|
||||
}
|
||||
|
||||
static mBN_Ovl_c bn_ovl_data;
|
||||
|
||||
extern void mBN_bank_ovl_construct(Submenu* submenu) {
|
||||
Submenu_Overlay_c* overlay = submenu->overlay;
|
||||
Submenu_Overlay_c* overlay = submenu->overlay;
|
||||
|
||||
if (overlay->bank_ovl == NULL) {
|
||||
mem_clear((u8*)&bn_ovl_data, sizeof(mBN_Ovl_c), 0);
|
||||
overlay->bank_ovl = &bn_ovl_data;
|
||||
}
|
||||
if (overlay->bank_ovl == NULL) {
|
||||
mem_clear((u8*)&bn_ovl_data, sizeof(mBN_Ovl_c), 0);
|
||||
overlay->bank_ovl = &bn_ovl_data;
|
||||
}
|
||||
|
||||
mBN_bank_ovl_init(submenu);
|
||||
mBN_bank_ovl_set_proc(submenu);
|
||||
mBN_bank_ovl_init(submenu);
|
||||
mBN_bank_ovl_set_proc(submenu);
|
||||
}
|
||||
|
||||
extern void mBN_bank_ovl_destruct(Submenu* submenu) {
|
||||
submenu->overlay->bank_ovl = NULL;
|
||||
submenu->overlay->bank_ovl = NULL;
|
||||
}
|
||||
|
||||
+10
-12
@@ -186,10 +186,10 @@ static void banti_chk_anime_start() {
|
||||
u8 banti_min;
|
||||
u8 rtc_min;
|
||||
|
||||
int work1;
|
||||
int work0;
|
||||
int disp0;
|
||||
int disp1;
|
||||
int work0;
|
||||
int work1;
|
||||
|
||||
if (banti.month_anim.state == banti_ANIM_STATE_STOPPED &&
|
||||
banti.displayed_time.month != Common_GetPointer(time.rtc_time)->month) {
|
||||
@@ -203,22 +203,20 @@ static void banti_chk_anime_start() {
|
||||
banti.day_anim.state = banti_ANIM_STATE_PLAYING;
|
||||
}
|
||||
|
||||
banti_hour = banti.displayed_time.hour;
|
||||
if (banti_hour == 0 || banti_hour == 12) {
|
||||
if (banti.displayed_time.hour == 0 || banti.displayed_time.hour == 12) {
|
||||
work0 = 12;
|
||||
} else if (banti_hour > 11) {
|
||||
work0 = banti_hour - 12;
|
||||
} else if (banti.displayed_time.hour > 11) {
|
||||
work0 = banti.displayed_time.hour - 12;
|
||||
} else {
|
||||
work0 = banti_hour;
|
||||
work0 = banti.displayed_time.hour;
|
||||
}
|
||||
|
||||
rtc_hour = Common_GetPointer(time.rtc_time)->hour;
|
||||
if (rtc_hour == 0 || rtc_hour == 12) {
|
||||
if (Common_Get(time.rtc_time.hour) == 0 || Common_Get(time.rtc_time.hour) == 12) {
|
||||
work1 = 12;
|
||||
} else if (rtc_hour > 11) {
|
||||
work1 = rtc_hour - 12;
|
||||
} else if (Common_Get(time.rtc_time.hour) > 11) {
|
||||
work1 = Common_Get(time.rtc_time.hour) - 12;
|
||||
} else {
|
||||
work1 = rtc_hour;
|
||||
work1 = Common_Get(time.rtc_time.hour);
|
||||
}
|
||||
|
||||
disp0 = work0 / 10;
|
||||
|
||||
@@ -32,7 +32,11 @@ static u32 mCD_sp_soncho_chk(lbRTC_year_t year, lbRTC_month_t month, lbRTC_day_t
|
||||
|
||||
switch (month) {
|
||||
case lbRTC_JUNE:
|
||||
#if VERSION == VER_GAFU01_00
|
||||
wday = lbRTC_Week(year, month, day);
|
||||
#else
|
||||
wday = lbRTC_Week(year, month, day + 1);
|
||||
#endif
|
||||
if (wday == lbRTC_SUNDAY && 1 + ((day - wday) / lbRTC_WEEK) == 3) {
|
||||
chk = (1 << 0);
|
||||
}
|
||||
|
||||
@@ -168,15 +168,14 @@ static void mCD_set_base_dl(Submenu* submenu, GAME* game, f32 pos_x, f32 pos_y,
|
||||
int year_ofs;
|
||||
int t0;
|
||||
int flag;
|
||||
int k;
|
||||
int j;
|
||||
int k;
|
||||
int i;
|
||||
int type;
|
||||
int day;
|
||||
int day_type;
|
||||
u8* prim_p;
|
||||
u8* env_p;
|
||||
int tex_idx;
|
||||
lbRTC_time_c* rtc_time;
|
||||
|
||||
calendar = submenu->overlay->calendar_ovl;
|
||||
@@ -224,12 +223,9 @@ static void mCD_set_base_dl(Submenu* submenu, GAME* game, f32 pos_x, f32 pos_y,
|
||||
|
||||
gSPDisplayList(POLY_OPA_DISP++, cal_win_nen_before);
|
||||
|
||||
t0 = (rtc_time->year + year_ofs);
|
||||
t0--;
|
||||
for (j = 0; j < 4; j++) {
|
||||
tex_idx = t0 % 10;
|
||||
|
||||
gDPLoadTextureBlock_4b_Dolphin(POLY_OPA_DISP++, cal_win_nen_txt_table[tex_idx], G_IM_FMT_I, 16, 16, 15, GX_MIRROR, GX_MIRROR, 0, 0);
|
||||
t0 = rtc_time->year - 1 + year_ofs;
|
||||
for (j = 0; j < 4; j++, t0) {
|
||||
gDPLoadTextureBlock_4b_Dolphin(POLY_OPA_DISP++, cal_win_nen_txt_table[t0 % 10], G_IM_FMT_I, 16, 16, 15, GX_MIRROR, GX_MIRROR, 0, 0);
|
||||
gSPDisplayList(POLY_OPA_DISP++, cal_win_nen_table[j]);
|
||||
|
||||
t0 /= 10;
|
||||
|
||||
+63
-46
@@ -10,6 +10,14 @@
|
||||
#include "m_scene_table.h"
|
||||
#include "m_common_data.h"
|
||||
|
||||
#if VERSION >= VER_GAFU01_00
|
||||
#define CAMERA2_STAFFROLL_CENTER_X_ROT_STEP_DIVISOR 3333
|
||||
#define CAMERA2_STAFFROLL_CENTER_Y_ROT_STEP_DIVISOR 2166
|
||||
#else
|
||||
#define CAMERA2_STAFFROLL_CENTER_X_ROT_STEP_DIVISOR 4000
|
||||
#define CAMERA2_STAFFROLL_CENTER_Y_ROT_STEP_DIVISOR 2600
|
||||
#endif
|
||||
|
||||
static void Camera2_main_Normal_AdjustDistanceAndDirection(GAME_PLAY* play, f32* dist, s_xyz* dir);
|
||||
static void Camera2_change_main_index(GAME_PLAY* play);
|
||||
|
||||
@@ -67,25 +75,19 @@ static f32 Camera2_GetUnderBorderAdjust() {
|
||||
}
|
||||
}
|
||||
|
||||
static void Camera2_PolaPosCalc(xyz_t* eye, s16 inv_dir_x, s16 inv_dir_y, xyz_t* center, f32 dist) {
|
||||
f32 dist_x;
|
||||
f32 inv_dir_x_f;
|
||||
f32 inv_dir_y_f;
|
||||
f32 x;
|
||||
f32 y;
|
||||
f32 z;
|
||||
static void Camera2_PolaPosCalc(xyz_t* eye, s16 inv_dir_x, s16 inv_dir_y, const xyz_t* center, f32 dist) {
|
||||
f32 dist_xz;
|
||||
f32 angle_x;
|
||||
f32 angle_y;
|
||||
|
||||
angle_x = SHORTANGLE2RAD(inv_dir_x);
|
||||
angle_y = SHORTANGLE2RAD(inv_dir_y);
|
||||
|
||||
*eye = *center;
|
||||
inv_dir_x_f = inv_dir_x * SHORTANGLE2RAD(1);
|
||||
inv_dir_y_f = inv_dir_y * SHORTANGLE2RAD(1);
|
||||
y = sin(inv_dir_x_f);
|
||||
eye->y += dist * y;
|
||||
x = cos(inv_dir_x_f);
|
||||
dist_x = dist * x;
|
||||
x = sin(inv_dir_y_f);
|
||||
eye->x += dist_x * x;
|
||||
z = cos(inv_dir_y_f);
|
||||
eye->z += dist_x * z;
|
||||
eye->y += dist * sinf(angle_x);
|
||||
dist_xz = dist * cosf(angle_x);
|
||||
eye->x += dist_xz * sinf(angle_y);
|
||||
eye->z += dist_xz * cosf(angle_y);
|
||||
}
|
||||
|
||||
static void Camera2_SetEyePos_fromCenterPosCalc(GAME_PLAY* play, xyz_t* center, xyz_t* eye) {
|
||||
@@ -161,7 +163,7 @@ static void Camera2_MoveDirectionAngleXYZ(GAME_PLAY* play, const s_xyz* goal_dir
|
||||
}
|
||||
}
|
||||
|
||||
static void Camera2_SetDirectionAngleXYZ(GAME_PLAY* play, s_xyz* goal_dir, int delta) {
|
||||
static void Camera2_SetDirectionAngleXYZ(GAME_PLAY* play, const s_xyz* goal_dir, int delta) {
|
||||
Camera2* camera = &play->camera;
|
||||
s_xyz* dir = &camera->direction;
|
||||
s_xyz* dir_vel = &camera->direction_velocity;
|
||||
@@ -766,11 +768,12 @@ extern int Camera2_CheckEnterCullingArea(f32 pos_x, f32 pos_z, f32 width) {
|
||||
|
||||
extern void Camera2_ClearActorTalking_Cull(GAME_PLAY* play) {
|
||||
Actor_list* actor_list;
|
||||
ACTOR* actor;
|
||||
int i;
|
||||
|
||||
actor_list = play->actor_info.list;
|
||||
for (i = 0; i < ACTOR_PART_NUM; i++) {
|
||||
ACTOR* actor;
|
||||
|
||||
for (actor = actor_list->actor; actor != NULL; actor = actor->next_actor) {
|
||||
actor->cull_while_talking = FALSE;
|
||||
}
|
||||
@@ -1002,17 +1005,21 @@ extern int Camera2_request_main_talk(GAME_PLAY* play, ACTOR* speaker, ACTOR* lis
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
extern int Camera2_request_main_talk_pos(GAME_PLAY* play, ACTOR* speaker, xyz_t* listener_pos, int priority) {
|
||||
if ((play->camera.now_main_index == CAMERA2_PROCESS_TALK ||
|
||||
play->camera.requested_main_index == CAMERA2_PROCESS_TALK) &&
|
||||
(Math3DLength(&play->camera.request_data.talk.listener_pos, listener_pos) < 1.0f)) {
|
||||
extern int Camera2_request_main_talk_pos(GAME_PLAY* play, ACTOR* speaker, const xyz_t* const listener_pos,
|
||||
int priority) {
|
||||
Camera2* camera = &play->camera;
|
||||
|
||||
if ((camera->now_main_index == CAMERA2_PROCESS_TALK || camera->requested_main_index == CAMERA2_PROCESS_TALK) &&
|
||||
(Math3DLength(&camera->request_data.talk.listener_pos, listener_pos) < 1.0f)) {
|
||||
return FALSE;
|
||||
} else {
|
||||
if (Camera2_check_request_main_priority(play, priority) > 0) {
|
||||
play->camera.request_data.talk.speaker_actor = speaker;
|
||||
play->camera.request_data.talk.listener_actor = NULL;
|
||||
play->camera.request_data.talk.listener_pos = *listener_pos;
|
||||
play->camera.request_data.talk.flags = 1;
|
||||
CameraRequestTalk* req_p = &camera->request_data.talk;
|
||||
|
||||
req_p->speaker_actor = speaker;
|
||||
req_p->listener_actor = NULL;
|
||||
req_p->listener_pos = *listener_pos;
|
||||
req_p->flags = 1;
|
||||
Camera2_request_main_index(play, CAMERA2_PROCESS_TALK, priority);
|
||||
return TRUE;
|
||||
}
|
||||
@@ -1689,8 +1696,8 @@ static void Camera2_setup_main_Item(GAME_PLAY* play) {
|
||||
play->camera.requested_main_index_priority = 0;
|
||||
}
|
||||
|
||||
extern int Camera2_request_main_lock(GAME_PLAY* play, xyz_t* center_pos, xyz_t* eye_pos, f32 fov_y, int morph_counter,
|
||||
f32 near, f32 far, int priority) {
|
||||
extern int Camera2_request_main_lock(GAME_PLAY* play, const xyz_t* center_pos, const xyz_t* eye_pos, f32 fov_y,
|
||||
int morph_counter, f32 near, f32 far, int priority) {
|
||||
if (Camera2_check_request_main_priority(play, priority) > 0) {
|
||||
play->camera.request_data.lock.center_pos = *center_pos;
|
||||
play->camera.request_data.lock.eye_pos = *eye_pos;
|
||||
@@ -1718,7 +1725,7 @@ static void Camera2_setup_main_Lock(GAME_PLAY* play) {
|
||||
Camera2_setup_main_Base(play);
|
||||
}
|
||||
|
||||
static void Camera2_Lock_SetCenterPos(GAME_PLAY* play, xyz_t* center_pos, int step) {
|
||||
static void Camera2_Lock_SetCenterPos(GAME_PLAY* play, const xyz_t* center_pos, int step) {
|
||||
Camera2* camera = &play->camera;
|
||||
|
||||
xyz_t* center_vel_p = &camera->movement_velocity;
|
||||
@@ -1734,7 +1741,7 @@ static void Camera2_Lock_SetCenterPos(GAME_PLAY* play, xyz_t* center_pos, int st
|
||||
center_vel_p->z = center_p->z - pre_center.z;
|
||||
}
|
||||
|
||||
static void Camera2_Lock_SetEyePos(GAME_PLAY* play, xyz_t* eye, int step) {
|
||||
static void Camera2_Lock_SetEyePos(GAME_PLAY* play, const xyz_t* eye, int step) {
|
||||
xyz_t* eye_p = &play->camera.lookat.eye;
|
||||
|
||||
inter_float(&eye_p->x, eye->x, step);
|
||||
@@ -1907,8 +1914,8 @@ static void Camera2_main_Door(GAME_PLAY* play) {
|
||||
Camera2_change_main_index(play);
|
||||
}
|
||||
|
||||
extern int Camera2_request_main_simple2(GAME_PLAY* play, xyz_t* center, s_xyz* dir, f32 dist, int morph_counter,
|
||||
int mode, int priority) {
|
||||
extern int Camera2_request_main_simple2(GAME_PLAY* play, const xyz_t* center, const s_xyz* dir, f32 dist,
|
||||
int morph_counter, int mode, int priority) {
|
||||
if (Camera2_check_request_main_priority(play, priority) > 0) {
|
||||
play->camera.request_data.simple.center_pos = *center;
|
||||
play->camera.request_data.simple.angle = *dir;
|
||||
@@ -1969,7 +1976,7 @@ extern int Camera2_request_main_simple_fishing(GAME_PLAY* play, const xyz_t* pla
|
||||
|
||||
return Camera2_request_main_simple(play, ¢er, &dir, dist * dist_mult, 40, priority);
|
||||
}
|
||||
extern int Camera2_request_main_simple_fishing_return(GAME_PLAY* play, xyz_t* player_pos, int priority) {
|
||||
extern int Camera2_request_main_simple_fishing_return(GAME_PLAY* play, const xyz_t* player_pos, int priority) {
|
||||
xyz_t center_pos;
|
||||
s_xyz dir;
|
||||
f32 dist;
|
||||
@@ -1979,7 +1986,7 @@ extern int Camera2_request_main_simple_fishing_return(GAME_PLAY* play, xyz_t* pl
|
||||
return Camera2_request_main_simple(play, ¢er_pos, &dir, dist, 30, priority);
|
||||
}
|
||||
|
||||
extern int Camera2_request_main_simple(GAME_PLAY* play, xyz_t* pos, s_xyz* dir, f32 dist, int morph_counter,
|
||||
extern int Camera2_request_main_simple(GAME_PLAY* play, const xyz_t* pos, const s_xyz* dir, f32 dist, int morph_counter,
|
||||
int priority) {
|
||||
if (Camera2_check_request_main_priority(play, priority) > 0) {
|
||||
play->camera.request_data.simple.center_pos = *pos;
|
||||
@@ -2116,8 +2123,9 @@ extern int Camera2_request_main_needlework_talk(GAME_PLAY* play, ACTOR* speaker,
|
||||
angle_y = DEG2SHORT_ANGLE(-180.0f);
|
||||
}
|
||||
|
||||
diff_x = fabsf(diff_x);
|
||||
angle_x = DEG2SHORT_ANGLE(5.495f);
|
||||
if (fabsf(diff_x) < mFI_UT_WORLDSIZE_X_F) {
|
||||
if (diff_x < mFI_UT_WORLDSIZE_X_F) {
|
||||
angle_x = DEG2SHORT_ANGLE(13.735f);
|
||||
}
|
||||
|
||||
@@ -2161,6 +2169,7 @@ static void Camera2_Cust_Talk_ChangeCameraCenterPos_BetweenSpeakerToListener(GAM
|
||||
xyz_t* pos0;
|
||||
xyz_t* pos1;
|
||||
xyz_t center;
|
||||
f32 unused;
|
||||
|
||||
if (speaker == NULL) {
|
||||
pos0 = &listener->eye.position;
|
||||
@@ -2173,6 +2182,7 @@ static void Camera2_Cust_Talk_ChangeCameraCenterPos_BetweenSpeakerToListener(GAM
|
||||
pos0 = &speaker->eye.position;
|
||||
}
|
||||
|
||||
unused = fabsf(dist);
|
||||
center.x = pos0->x + center_ratio * (pos1->x - pos0->x);
|
||||
center.y = pos0->y + center_ratio * (pos1->y - pos0->y);
|
||||
center.z = pos0->z + center_ratio * (pos1->z - pos0->z);
|
||||
@@ -2247,8 +2257,9 @@ extern int Camera2_Inter_set_reverse_mode(GAME_PLAY* play) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
extern int Camera2_request_main_inter(GAME_PLAY* play, xyz_t* start_center, xyz_t* start_eye, xyz_t* goal_center,
|
||||
xyz_t* goal_eye, f32 s0, f32 s1, u32 flags, int morph_counter, int priority) {
|
||||
extern int Camera2_request_main_inter(GAME_PLAY* play, const xyz_t* start_center, const xyz_t* start_eye,
|
||||
const xyz_t* goal_center, const xyz_t* goal_eye, f32 s0, f32 s1, u32 flags,
|
||||
int morph_counter, int priority) {
|
||||
if (Camera2_check_request_main_priority(play, priority) > 0) {
|
||||
play->camera.request_data.inter.starting_center_pos = *start_center;
|
||||
play->camera.request_data.inter.starting_eye_pos = *start_eye;
|
||||
@@ -2457,17 +2468,23 @@ static void Camera2_Staff_Roll_Center(GAME_PLAY* play, ACTOR* speaker, ACTOR* li
|
||||
h *= ((1.0f + sin_s(temp2) * 0.2f) - 0.2f) * 45.0f;
|
||||
|
||||
// likely fakematch
|
||||
temp = (int)((-(f32)camera->main_data.staff_roll.rotation_y_delta / 2600.0f) * 65535.0f) + 0x10000;
|
||||
temp =
|
||||
(int)((-(f32)camera->main_data.staff_roll.rotation_y_delta / CAMERA2_STAFFROLL_CENTER_Y_ROT_STEP_DIVISOR) *
|
||||
65535.0f) +
|
||||
0x10000;
|
||||
temp += camera->main_data.staff_roll.last_direction.y;
|
||||
y_rot_x = sin_s(temp + -0x4000);
|
||||
y_rot_x = sin_s(temp + DEG2SHORT_ANGLE2(-90.0f));
|
||||
|
||||
goal_center.y = center_y;
|
||||
goal_center.x = center_x + h * y_rot_x;
|
||||
|
||||
// likely fakematch
|
||||
temp = (int)((-(f32)camera->main_data.staff_roll.rotation_y_delta / 2600.0f) * 65535.0f) + 0x10000;
|
||||
temp =
|
||||
(int)((-(f32)camera->main_data.staff_roll.rotation_y_delta / CAMERA2_STAFFROLL_CENTER_Y_ROT_STEP_DIVISOR) *
|
||||
65535.0f) +
|
||||
0x10000;
|
||||
temp += camera->main_data.staff_roll.last_direction.y;
|
||||
y_rot_z = cos_s(temp + -0x4000);
|
||||
y_rot_z = cos_s(temp + DEG2SHORT_ANGLE2(-90.0f));
|
||||
|
||||
goal_center.z = center_z + h * y_rot_z;
|
||||
|
||||
@@ -2486,10 +2503,10 @@ static void Camera2_Staff_Roll_DistAngle(GAME_PLAY* play, ACTOR* speaker, ACTOR*
|
||||
|
||||
temp = ((f32)camera->main_data.staff_roll.r_delta / 4600.0f) * 65535.0f;
|
||||
dist = ((sin_s(temp) * 0.2f + 1.0f) - 0.2f) * 575.0f;
|
||||
temp = ((f32)camera->main_data.staff_roll.rotation_x_delta / 4000.0f) * 65536.0f;
|
||||
temp = ((f32)camera->main_data.staff_roll.rotation_x_delta / CAMERA2_STAFFROLL_CENTER_X_ROT_STEP_DIVISOR) * 65536.0f;
|
||||
|
||||
angle->x = (s16)(sin_s(temp) * 5000.0f);
|
||||
angle->y = (s16)((-(f32)camera->main_data.staff_roll.rotation_y_delta / 2600.0f) * 65535.0f) +
|
||||
angle->y = (s16)((-(f32)camera->main_data.staff_roll.rotation_y_delta / CAMERA2_STAFFROLL_CENTER_Y_ROT_STEP_DIVISOR) * 65535.0f) +
|
||||
camera->main_data.staff_roll.last_direction.y + (u16)SHT_MIN_S;
|
||||
angle->z = 0;
|
||||
|
||||
@@ -2575,13 +2592,13 @@ static void Camera2_main_Staff_Roll_SetPos(GAME_PLAY* play) {
|
||||
}
|
||||
|
||||
main_data->staff_roll.rotation_x_delta++;
|
||||
if (main_data->staff_roll.rotation_x_delta > 4000) {
|
||||
if (main_data->staff_roll.rotation_x_delta > CAMERA2_STAFFROLL_CENTER_X_ROT_STEP_DIVISOR) {
|
||||
main_data->staff_roll.rotation_x_delta = 0;
|
||||
}
|
||||
}
|
||||
|
||||
main_data->staff_roll.rotation_y_delta++;
|
||||
if (main_data->staff_roll.rotation_y_delta > 2600) {
|
||||
if (main_data->staff_roll.rotation_y_delta > CAMERA2_STAFFROLL_CENTER_Y_ROT_STEP_DIVISOR) {
|
||||
main_data->staff_roll.rotation_y_delta = 0;
|
||||
}
|
||||
|
||||
|
||||
+84
-18
@@ -2479,7 +2479,7 @@ static void mCD_get_passport_comment1(char* comment1, u8* player_name) {
|
||||
}
|
||||
}
|
||||
|
||||
static void mCD_get_present_comment1(char* comment1, int num, const char* src_comment, int src_len) {
|
||||
static void mCD_get_present_comment1(char* comment1, int num, char* src_comment, int src_len) {
|
||||
int i;
|
||||
|
||||
mem_clear((u8*)comment1, 32, 0);
|
||||
@@ -2502,8 +2502,8 @@ extern int mCD_card_format_bg(s32 chan) {
|
||||
static int mCD_get_this_land_slot_no(mCD_memMgr_c* mgr) {
|
||||
mCD_memMgr_card_info_c* card_info = mgr->cards;
|
||||
Save_t* buf_save = (Save_t*)mgr->workArea;
|
||||
int i;
|
||||
int res = mCD_RESULT_ERROR;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < CARD_NUM_CHANS; i++) {
|
||||
card_info[i].result = CARD_RESULT_NOCARD;
|
||||
@@ -2535,8 +2535,8 @@ static int mCD_get_this_land_slot_no(mCD_memMgr_c* mgr) {
|
||||
static int mCD_get_this_land_slot_no_game_start(mCD_memMgr_c* mgr) {
|
||||
mCD_memMgr_card_info_c* card_info = mgr->cards;
|
||||
Save_t* buf_save = (Save_t*)mgr->workArea;
|
||||
int i;
|
||||
int res = mCD_RESULT_ERROR;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < CARD_NUM_CHANS; i++) {
|
||||
card_info[i].result = CARD_RESULT_NOCARD;
|
||||
@@ -2570,8 +2570,8 @@ static int mCD_get_this_land_slot_no_game_start(mCD_memMgr_c* mgr) {
|
||||
static int mCD_get_this_land_slot_no_nes(mCD_memMgr_c* mgr) {
|
||||
mCD_memMgr_card_info_c* card_info = mgr->cards;
|
||||
Save_t* buf_save = (Save_t*)mgr->workArea;
|
||||
int i;
|
||||
int res = mCD_RESULT_ERROR;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < CARD_NUM_CHANS; i++) {
|
||||
card_info[i].result = CARD_RESULT_NOCARD;
|
||||
@@ -2854,7 +2854,7 @@ static int mCD_CheckPresentFile(char* filename, s32* fileNo, s32 chan, s32* resu
|
||||
|
||||
static int mCD_SaveHome_bg_read_send_present(mCD_memMgr_c* mgr, mCD_memMgr_fileInfo_c* fileInfo) {
|
||||
static int icon_fileNo[mCD_PRESENT_TYPE_NUM] = { RESOURCE_TEGAMI, RESOURCE_TEGAMI2 };
|
||||
static const char* comment_p_table[mCD_PRESENT_TYPE_NUM] = { l_comment_present_1_str, l_comment_gift_1_str };
|
||||
static char* comment_p_table[mCD_PRESENT_TYPE_NUM] = { l_comment_present_1_str, l_comment_gift_1_str };
|
||||
static int comment_len_table[mCD_PRESENT_TYPE_NUM] = { 14, 13 };
|
||||
void* workArea = mgr->workArea;
|
||||
mCD_file_entry_c* present_entry;
|
||||
@@ -3303,8 +3303,10 @@ static void mCD_SetResetInfo(Private_c* priv) {
|
||||
}
|
||||
}
|
||||
|
||||
static int mCD_get_land_copyProtect(void) {
|
||||
return 1 + (u16)RANDOM(0xFFF0);
|
||||
static u16 mCD_get_land_copyProtect(void) {
|
||||
u16 code = RANDOM(0xFFF0);
|
||||
code++;
|
||||
return code;
|
||||
}
|
||||
|
||||
static int mCD_SaveHome_bg_set_data(mCD_memMgr_c* mgr, mCD_memMgr_fileInfo_c* fileInfo) {
|
||||
@@ -6236,16 +6238,19 @@ static void mCD_ReplaceKeep(Private_c* priv, mCD_PrivateItem_c* privItem) {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: probably fakematch
|
||||
#if VERSION == VER_GAFU01_00
|
||||
static int mCD_SaveStation_NextLand_set_data(mCD_memMgr_c* mgr, mCD_memMgr_fileInfo_c* fileInfo) {
|
||||
Private_c* priv;
|
||||
Save_t* save;
|
||||
Private_c* priv;
|
||||
mCD_persistent_data_c* persistant = Common_GetPointer(travel_persistent_data);
|
||||
int i;
|
||||
mActor_name_t* pocket_p;
|
||||
Animal_c* in_animal;
|
||||
mCD_persistent_data_c* persistant = Common_GetPointer(travel_persistent_data);
|
||||
int j;
|
||||
u16 copy_protect;
|
||||
s32 chan;
|
||||
int ret = mCD_RESULT_BUSY;
|
||||
int i;
|
||||
|
||||
chan = mgr->chan;
|
||||
save = (Save_t*)mgr->workArea;
|
||||
@@ -6254,12 +6259,10 @@ static int mCD_SaveStation_NextLand_set_data(mCD_memMgr_c* mgr, mCD_memMgr_fileI
|
||||
mCkRh_SavePlayTime(Common_Get(player_no));
|
||||
if (priv != NULL) {
|
||||
pocket_p = priv->inventory.pockets;
|
||||
for (i = 0; i < mPr_POCKETS_SLOT_COUNT; i++) {
|
||||
for (j = 0; j < mPr_POCKETS_SLOT_COUNT; j++, pocket_p++) {
|
||||
if (ITEM_IS_WISP(*pocket_p)) {
|
||||
mPr_SetPossessionItem(priv, i, EMPTY_NO, mPr_ITEM_COND_NORMAL);
|
||||
mPr_SetPossessionItem(priv, j, EMPTY_NO, mPr_ITEM_COND_NORMAL);
|
||||
}
|
||||
|
||||
pocket_p++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6301,6 +6304,71 @@ static int mCD_SaveStation_NextLand_set_data(mCD_memMgr_c* mgr, mCD_memMgr_fileI
|
||||
|
||||
return ret;
|
||||
}
|
||||
#else
|
||||
static int mCD_SaveStation_NextLand_set_data(mCD_memMgr_c* mgr, mCD_memMgr_fileInfo_c* fileInfo) {
|
||||
Save_t* save;
|
||||
Private_c* priv;
|
||||
mCD_persistent_data_c* persistant = Common_GetPointer(travel_persistent_data);
|
||||
mActor_name_t* pocket_p;
|
||||
Animal_c* in_animal;
|
||||
int i;
|
||||
u16 copy_protect;
|
||||
s32 chan;
|
||||
int ret = mCD_RESULT_BUSY;
|
||||
|
||||
chan = mgr->chan;
|
||||
save = (Save_t*)mgr->workArea;
|
||||
if (save != NULL && chan != -1) {
|
||||
priv = Now_Private;
|
||||
mCkRh_SavePlayTime(Common_Get(player_no));
|
||||
if (priv != NULL) {
|
||||
pocket_p = priv->inventory.pockets;
|
||||
for (i = 0; i < mPr_POCKETS_SLOT_COUNT; i++, pocket_p++) {
|
||||
if (ITEM_IS_WISP(*pocket_p)) {
|
||||
mPr_SetPossessionItem(priv, i, EMPTY_NO, mPr_ITEM_COND_NORMAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mCD_ClearResetCode();
|
||||
mHm_KeepHouseSize(Common_Get(player_no));
|
||||
in_animal = mNpc_GetInAnimalP();
|
||||
mNpc_GetRemoveAnimal(in_animal, TRUE);
|
||||
mCD_SetForeignerFile(&l_mcd_foreigner_file.file, priv, in_animal);
|
||||
if (mLd_PlayerManKindCheckNo(Common_Get(player_no)) == FALSE) {
|
||||
priv->exists = FALSE;
|
||||
mCD_ClearPrivateItem(priv, &mgr->private_item);
|
||||
mgr->_0198 = 1;
|
||||
}
|
||||
|
||||
bcopy(Save_GetPointer(land_info), &persistant->land, sizeof(mLd_land_info_c));
|
||||
// priv = Save_Get(private_data);
|
||||
for (i = 0; i < PLAYER_NUM; i++) {
|
||||
mPr_CopyPersonalID(&persistant->pid[i], &Save_Get(private_data[i]).player_ID);
|
||||
}
|
||||
|
||||
mAGrw_ClearMoneyStoneShineGround();
|
||||
Save_Set(travel_hard_time, lbRTC_HardTime());
|
||||
mgr->copy_protect = Common_Get(copy_protect);
|
||||
copy_protect = mCD_get_land_copyProtect();
|
||||
Common_Set(copy_protect, copy_protect);
|
||||
Save_Set(copy_protect, copy_protect);
|
||||
bcopy(Common_GetPointer(save), save, sizeof(Save));
|
||||
save->save_check.version = 6;
|
||||
mFRm_SetSaveCheckData(&save->save_check);
|
||||
save->save_check.checksum = mFRm_GetFlatCheckSum((u16*)save, sizeof(Save), save->save_check.checksum);
|
||||
mgr->loaded_file_type = mCD_FILE_SAVE_MAIN;
|
||||
mgr->workArea_size = mCD_get_size(mgr->loaded_file_type);
|
||||
fileInfo->proc++;
|
||||
ret = mCD_RESULT_SUCCESS;
|
||||
} else {
|
||||
fileInfo->_04 = mCD_TRANS_ERR_NOCARD;
|
||||
ret = mCD_RESULT_ERROR;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int mCD_SaveStation_NextLand_write_main(mCD_memMgr_c* mgr, mCD_memMgr_fileInfo_c* fileInfo) {
|
||||
s32 result;
|
||||
@@ -6789,10 +6857,8 @@ static int mCD_SaveStation_Passport_make_file_name(mCD_memMgr_c* mgr, mCD_memMgr
|
||||
}
|
||||
|
||||
if (count > 0) {
|
||||
u8* cond_p = cond;
|
||||
|
||||
for (i = 0; i < CARD_MAX_FILE; i++, cond_p++) {
|
||||
if (*cond_p == FALSE) {
|
||||
for (i = 0; i < CARD_MAX_FILE; i++) {
|
||||
if (cond[i] == FALSE) {
|
||||
filename_idx = i;
|
||||
break;
|
||||
}
|
||||
|
||||
+41
-41
@@ -35,67 +35,67 @@ static void mChoice_Main_Normal(mChoice_c*, GAME*);
|
||||
static void mChoice_Main_Disappear(mChoice_c*, GAME*);
|
||||
|
||||
static void mChoice_MainSetup(mChoice_c* choice, GAME* game) {
|
||||
static mChoice_MAIN_PROC proc[mChoice_MAIN_INDEX_NUM] = {
|
||||
&mChoice_MainSetup_Hide,
|
||||
&mChoice_MainSetup_Appear,
|
||||
&mChoice_MainSetup_Normal,
|
||||
&mChoice_MainSetup_Disappear
|
||||
};
|
||||
static mChoice_MAIN_PROC proc[mChoice_MAIN_INDEX_NUM] = {
|
||||
&mChoice_MainSetup_Hide,
|
||||
&mChoice_MainSetup_Appear,
|
||||
&mChoice_MainSetup_Normal,
|
||||
&mChoice_MainSetup_Disappear,
|
||||
};
|
||||
|
||||
int index = choice->requested_main_index;
|
||||
int index = choice->requested_main_index;
|
||||
|
||||
/* This is necessary lol */
|
||||
if (index < 0) {
|
||||
return;
|
||||
}
|
||||
else if (index < 0 || index >= mChoice_MAIN_INDEX_NUM || proc[index] == NULL) {
|
||||
return;
|
||||
}
|
||||
/* This is necessary lol */
|
||||
if (index < 0) {
|
||||
return;
|
||||
} else if (index < 0 || index >= mChoice_MAIN_INDEX_NUM || proc[index] == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
(*proc[index])(choice, game);
|
||||
(*proc[index])(choice, game);
|
||||
}
|
||||
|
||||
extern void mChoice_Main(mChoice_c* choice, GAME* game) {
|
||||
static mChoice_MAIN_PROC proc[mChoice_MAIN_INDEX_NUM] = {
|
||||
&mChoice_Main_Hide,
|
||||
&mChoice_Main_Appear,
|
||||
&mChoice_Main_Normal,
|
||||
&mChoice_Main_Disappear
|
||||
};
|
||||
static mChoice_MAIN_PROC proc[mChoice_MAIN_INDEX_NUM] = {
|
||||
&mChoice_Main_Hide,
|
||||
&mChoice_Main_Appear,
|
||||
&mChoice_Main_Normal,
|
||||
&mChoice_Main_Disappear,
|
||||
};
|
||||
|
||||
int index = choice->main_index;
|
||||
int index = choice->main_index;
|
||||
|
||||
if (index < 0 || index >= mChoice_MAIN_INDEX_NUM || proc[index] == NULL) {
|
||||
return;
|
||||
}
|
||||
if (index < 0 || index >= mChoice_MAIN_INDEX_NUM || proc[index] == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
(*proc[index])(choice, game);
|
||||
(*proc[index])(choice, game);
|
||||
}
|
||||
|
||||
extern void mChoice_Draw(mChoice_c* choice, GAME* game, int mode) {
|
||||
if (choice->window_visible_flag) {
|
||||
mFont_SetMatrix(game->graph, mode);
|
||||
mChoice_SetMatrix(choice, game, mode);
|
||||
mChoice_SetMatrixDisplay(choice, game, mode);
|
||||
mChoice_DrawWindowBody(choice, game, mode);
|
||||
mChoice_UnSetMatrixDisplay(game, mode);
|
||||
mChoice_DrawFont(choice, game, mode);
|
||||
mChoice_UnSetMatrix();
|
||||
mFont_UnSetMatrix(game->graph, mode);
|
||||
}
|
||||
if (choice->window_visible_flag) {
|
||||
mFont_SetMatrix(game->graph, mode);
|
||||
mChoice_SetMatrix(choice, game, mode);
|
||||
mChoice_SetMatrixDisplay(choice, game, mode);
|
||||
mChoice_DrawWindowBody(choice, game, mode);
|
||||
mChoice_UnSetMatrixDisplay(game, mode);
|
||||
mChoice_DrawFont(choice, game, mode);
|
||||
mChoice_UnSetMatrix();
|
||||
mFont_UnSetMatrix(game->graph, mode);
|
||||
}
|
||||
}
|
||||
|
||||
extern void mChoice_aram_init() {
|
||||
Choice_table_rom_start = JW_GetAramAddress(RESOURCE_SELECT_TABLE);
|
||||
Choice_rom_start = JW_GetAramAddress(RESOURCE_SELECT);
|
||||
Choice_table_rom_start = JW_GetAramAddress(RESOURCE_SELECT_TABLE);
|
||||
Choice_rom_start = JW_GetAramAddress(RESOURCE_SELECT);
|
||||
}
|
||||
|
||||
extern void mChoice_ct(mChoice_c* choice, GAME* game) {
|
||||
mChoice_check_ct(choice);
|
||||
mChoice_init(choice, game);
|
||||
mChoice_check_ct(choice);
|
||||
mChoice_init(choice, game);
|
||||
}
|
||||
|
||||
extern void mChoice_dt(mChoice_c* choice, GAME* game) { }
|
||||
extern void mChoice_dt(mChoice_c* choice, GAME* game) {
|
||||
}
|
||||
|
||||
#include "../src/game/m_choice_main.c_inc"
|
||||
#include "../src/game/m_choice_sound.c_inc"
|
||||
|
||||
+102
-123
@@ -1,168 +1,147 @@
|
||||
static void mChoice_SetMatrix(mChoice_c* choice, GAME* game, int type) {
|
||||
GRAPH* graph = game->graph;
|
||||
f32 scale = choice->scale;
|
||||
f32 x = ( choice->center_x - 160.0f) * 16.0f;
|
||||
f32 y = (-choice->center_y + 120.0f) * 16.0f;
|
||||
GRAPH* graph = game->graph;
|
||||
f32 scale = choice->scale;
|
||||
f32 x = (choice->center_x - 160.0f) * 16.0f;
|
||||
f32 y = (-choice->center_y + 120.0f) * 16.0f;
|
||||
|
||||
Matrix_push();
|
||||
Matrix_translate(x, y, 0.0f, MTX_MULT);
|
||||
Matrix_scale(scale, scale, 1.0f, MTX_MULT);
|
||||
Matrix_push();
|
||||
Matrix_translate(x, y, 0.0f, MTX_MULT);
|
||||
Matrix_scale(scale, scale, 1.0f, MTX_MULT);
|
||||
|
||||
OPEN_DISP(graph);
|
||||
OPEN_DISP(graph);
|
||||
|
||||
if (type == mFont_MODE_FONT) {
|
||||
gSPMatrix(NOW_FONT_DISP++, _Matrix_to_Mtx_new(graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
}
|
||||
else {
|
||||
gSPMatrix(NOW_POLY_OPA_DISP++, _Matrix_to_Mtx_new(graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
}
|
||||
if (type == mFont_MODE_FONT) {
|
||||
gSPMatrix(NOW_FONT_DISP++, _Matrix_to_Mtx_new(graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
} else {
|
||||
gSPMatrix(NOW_POLY_OPA_DISP++, _Matrix_to_Mtx_new(graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
}
|
||||
|
||||
CLOSE_DISP(graph);
|
||||
CLOSE_DISP(graph);
|
||||
}
|
||||
|
||||
static void mChoice_SetMatrixDisplay(mChoice_c* choice, GAME* game, int type) {
|
||||
GRAPH* graph = game->graph;
|
||||
f32 scale_x = choice->scale_x;
|
||||
f32 scale_y = choice->scale_y;
|
||||
GRAPH* graph = game->graph;
|
||||
f32 scale_x = choice->scale_x;
|
||||
f32 scale_y = choice->scale_y;
|
||||
|
||||
Matrix_push();
|
||||
Matrix_scale(scale_x, scale_y, 1.0f, MTX_MULT);
|
||||
Matrix_push();
|
||||
Matrix_scale(scale_x, scale_y, 1.0f, MTX_MULT);
|
||||
|
||||
OPEN_DISP(graph);
|
||||
OPEN_DISP(graph);
|
||||
|
||||
if (type == mFont_MODE_FONT) {
|
||||
gSPMatrix(NOW_FONT_DISP++, _Matrix_to_Mtx_new(graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
}
|
||||
else {
|
||||
gSPMatrix(NOW_POLY_OPA_DISP++, _Matrix_to_Mtx_new(graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
}
|
||||
if (type == mFont_MODE_FONT) {
|
||||
gSPMatrix(NOW_FONT_DISP++, _Matrix_to_Mtx_new(graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
} else {
|
||||
gSPMatrix(NOW_POLY_OPA_DISP++, _Matrix_to_Mtx_new(graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
}
|
||||
|
||||
CLOSE_DISP(graph);
|
||||
CLOSE_DISP(graph);
|
||||
}
|
||||
|
||||
static void mChoice_UnSetMatrix() {
|
||||
Matrix_pull();
|
||||
Matrix_pull();
|
||||
}
|
||||
|
||||
static void mChoice_UnSetMatrixDisplay(GAME* game, int type) {
|
||||
GRAPH* graph = game->graph;
|
||||
|
||||
Matrix_pull();
|
||||
GRAPH* graph = game->graph;
|
||||
|
||||
OPEN_DISP(graph);
|
||||
Matrix_pull();
|
||||
|
||||
if (type == mFont_MODE_FONT) {
|
||||
gSPMatrix(NOW_FONT_DISP++, _Matrix_to_Mtx_new(graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
}
|
||||
else {
|
||||
gSPMatrix(NOW_POLY_OPA_DISP++, _Matrix_to_Mtx_new(graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
}
|
||||
OPEN_DISP(graph);
|
||||
|
||||
CLOSE_DISP(graph);
|
||||
if (type == mFont_MODE_FONT) {
|
||||
gSPMatrix(NOW_FONT_DISP++, _Matrix_to_Mtx_new(graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
} else {
|
||||
gSPMatrix(NOW_POLY_OPA_DISP++, _Matrix_to_Mtx_new(graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
}
|
||||
|
||||
CLOSE_DISP(graph);
|
||||
}
|
||||
|
||||
static u8 con_waku_swaku3_tex[] ATTRIBUTE_ALIGN(32) = {
|
||||
#ifndef __INTELLISENSE__
|
||||
#include "assets/con_waku_swaku3_tex.inc"
|
||||
#endif
|
||||
#ifndef __INTELLISENSE__
|
||||
#include "assets/con_waku_swaku3_tex.inc"
|
||||
#endif
|
||||
};
|
||||
|
||||
static Vtx con_sentaku2_v[] = {
|
||||
#ifndef __INTELLISENSE__
|
||||
#include "assets/con_sentaku2_v.inc"
|
||||
#endif
|
||||
#ifndef __INTELLISENSE__
|
||||
#include "assets/con_sentaku2_v.inc"
|
||||
#endif
|
||||
};
|
||||
|
||||
static Gfx con_sentaku2_modelT[] = {
|
||||
gsSPTexture(0, 0, 0, 0, G_ON),
|
||||
gsDPSetPrimColor(0, 255, 255, 255, 155, 255),
|
||||
gsDPLoadTextureBlock_4b_Dolphin(con_waku_swaku3_tex, G_IM_FMT_I, 128, 64, 15, GX_MIRROR, GX_MIRROR, 0, 0),
|
||||
gsSPVertex(&con_sentaku2_v[0], 4, 0),
|
||||
gsSPNTrianglesInit_5b(
|
||||
2, // tri count
|
||||
0, 1, 2, // tri0
|
||||
0, 2, 3, // tri1
|
||||
0, 0, 0 // tri2
|
||||
),
|
||||
gsSPEndDisplayList()
|
||||
gsSPTexture(0, 0, 0, 0, G_ON),
|
||||
gsDPSetPrimColor(0, 255, 255, 255, 155, 255),
|
||||
gsDPLoadTextureBlock_4b_Dolphin(con_waku_swaku3_tex, G_IM_FMT_I, 128, 64, 15, GX_MIRROR, GX_MIRROR, 0, 0),
|
||||
gsSPVertex(&con_sentaku2_v[0], 4, 0),
|
||||
gsSPNTrianglesInit_5b(2, // tri count
|
||||
0, 1, 2, // tri0
|
||||
0, 2, 3, // tri1
|
||||
0, 0, 0 // tri2
|
||||
),
|
||||
gsSPEndDisplayList(),
|
||||
};
|
||||
|
||||
static Gfx mChoice_init_disp[] = {
|
||||
gsDPPipeSync(),
|
||||
gsSPClearGeometryMode(G_ZBUFFER | G_SHADE | G_CULL_BOTH | G_FOG | G_LIGHTING | G_TEXTURE_GEN | G_TEXTURE_GEN_LINEAR | G_LOD | G_SHADING_SMOOTH),
|
||||
gsDPSetTextureLOD(G_TL_TILE),
|
||||
gsDPSetTextureConvert(G_TC_FILT),
|
||||
gsDPSetTextureFilter(G_TF_BILERP),
|
||||
gsDPSetCycleType(G_CYC_1CYCLE),
|
||||
gsDPSetTexturePersp(G_TP_PERSP),
|
||||
gsDPSetAlphaDither(G_AD_DISABLE),
|
||||
gsDPSetColorDither(G_CD_DISABLE),
|
||||
gsDPSetCombineKey(G_CK_NONE),
|
||||
gsDPSetCombineLERP(0, 0, 0, PRIMITIVE, 0, 0, 0, TEXEL0, 0, 0, 0, PRIMITIVE, 0, 0, 0, TEXEL0),
|
||||
gsDPSetRenderMode(G_RM_XLU_SURF, G_RM_XLU_SURF2),
|
||||
gsSPEndDisplayList()
|
||||
gsDPPipeSync(),
|
||||
gsSPClearGeometryMode(G_ZBUFFER | G_SHADE | G_CULL_BOTH | G_FOG | G_LIGHTING | G_TEXTURE_GEN |
|
||||
G_TEXTURE_GEN_LINEAR | G_LOD | G_SHADING_SMOOTH),
|
||||
gsDPSetTextureLOD(G_TL_TILE),
|
||||
gsDPSetTextureConvert(G_TC_FILT),
|
||||
gsDPSetTextureFilter(G_TF_BILERP),
|
||||
gsDPSetCycleType(G_CYC_1CYCLE),
|
||||
gsDPSetTexturePersp(G_TP_PERSP),
|
||||
gsDPSetAlphaDither(G_AD_DISABLE),
|
||||
gsDPSetColorDither(G_CD_DISABLE),
|
||||
gsDPSetCombineKey(G_CK_NONE),
|
||||
gsDPSetCombineLERP(0, 0, 0, PRIMITIVE, 0, 0, 0, TEXEL0, 0, 0, 0, PRIMITIVE, 0, 0, 0, TEXEL0),
|
||||
gsDPSetRenderMode(G_RM_XLU_SURF, G_RM_XLU_SURF2),
|
||||
gsSPEndDisplayList(),
|
||||
};
|
||||
|
||||
static void mChoice_DrawWindowBody(mChoice_c* choice, GAME* game, int type) {
|
||||
GRAPH* graph = game->graph;
|
||||
GRAPH* graph = game->graph;
|
||||
|
||||
OPEN_DISP(graph);
|
||||
OPEN_DISP(graph);
|
||||
|
||||
if (type == mFont_MODE_FONT) {
|
||||
gSPDisplayList(NOW_FONT_DISP++, mChoice_init_disp);
|
||||
gSPDisplayList(NOW_FONT_DISP++, con_sentaku2_modelT);
|
||||
}
|
||||
else {
|
||||
gSPDisplayList(NOW_POLY_OPA_DISP++, mChoice_init_disp);
|
||||
gSPDisplayList(NOW_POLY_OPA_DISP++, con_sentaku2_modelT);
|
||||
}
|
||||
if (type == mFont_MODE_FONT) {
|
||||
gSPDisplayList(NOW_FONT_DISP++, mChoice_init_disp);
|
||||
gSPDisplayList(NOW_FONT_DISP++, con_sentaku2_modelT);
|
||||
} else {
|
||||
gSPDisplayList(NOW_POLY_OPA_DISP++, mChoice_init_disp);
|
||||
gSPDisplayList(NOW_POLY_OPA_DISP++, con_sentaku2_modelT);
|
||||
}
|
||||
|
||||
CLOSE_DISP(graph);
|
||||
CLOSE_DISP(graph);
|
||||
}
|
||||
|
||||
static void mChoice_DrawFont(mChoice_c* choice, GAME* game, int type) {
|
||||
int i;
|
||||
int choice_num = choice->data.choice_num;
|
||||
f32 x = choice->text_x;
|
||||
f32 y = choice->text_y;
|
||||
int selected_idx = choice->selected_choice_idx;
|
||||
int r;
|
||||
int g;
|
||||
int b;
|
||||
int i;
|
||||
int choice_num = choice->data.choice_num;
|
||||
f32 x = choice->text_x;
|
||||
f32 y = choice->text_y;
|
||||
int selected_idx = choice->selected_choice_idx;
|
||||
int r;
|
||||
int g;
|
||||
int b;
|
||||
|
||||
for (i = 0; i < choice_num; i++) {
|
||||
if (i == selected_idx) {
|
||||
r = choice->selected_choice_text_color.r;
|
||||
g = choice->selected_choice_text_color.g;
|
||||
b = choice->selected_choice_text_color.b;
|
||||
mFont_SetMarkChar(
|
||||
game,
|
||||
mFont_MARKTYPE_CHOICE,
|
||||
x - 16.0f, y,
|
||||
choice->background_color.r, choice->background_color.g, choice->background_color.b, 255,
|
||||
FALSE,
|
||||
1.0f, 1.0f,
|
||||
type
|
||||
);
|
||||
for (i = 0; i < choice_num; i++) {
|
||||
if (i == selected_idx) {
|
||||
r = choice->selected_choice_text_color.r;
|
||||
g = choice->selected_choice_text_color.g;
|
||||
b = choice->selected_choice_text_color.b;
|
||||
mFont_SetMarkChar(game, mFont_MARKTYPE_CHOICE, x - 16.0f, y, choice->background_color.r,
|
||||
choice->background_color.g, choice->background_color.b, 255, FALSE, 1.0f, 1.0f, type);
|
||||
} else {
|
||||
r = choice->text_color.r;
|
||||
g = choice->text_color.g;
|
||||
b = choice->text_color.b;
|
||||
}
|
||||
|
||||
mFont_SetLineStrings_AndSpace(game, choice->data.strings[i], choice->data.string_lens[i], x, y, r, g, b, 255,
|
||||
FALSE, TRUE, 0, 1.0f, 1.0f, type);
|
||||
|
||||
y += 16.0f;
|
||||
}
|
||||
else {
|
||||
r = choice->text_color.r;
|
||||
g = choice->text_color.g;
|
||||
b = choice->text_color.b;
|
||||
}
|
||||
|
||||
mFont_SetLineStrings_AndSpace(
|
||||
game,
|
||||
choice->data.strings[i], choice->data.string_lens[i],
|
||||
x, y,
|
||||
r, g, b, 255,
|
||||
FALSE,
|
||||
TRUE,
|
||||
0,
|
||||
1.0f, 1.0f,
|
||||
type
|
||||
);
|
||||
|
||||
y += 16.0f;
|
||||
}
|
||||
}
|
||||
|
||||
+358
-368
@@ -1,583 +1,573 @@
|
||||
extern mChoice_c* mChoice_Get_base_window_p() {
|
||||
return &mMsg_Get_base_window_p()->choice_window;
|
||||
return &mMsg_Get_base_window_p()->choice_window;
|
||||
}
|
||||
|
||||
static void mChoice_init(mChoice_c* choice, GAME* game) {
|
||||
choice->center_x = 191.0f;
|
||||
choice->center_y = 83.0f;
|
||||
choice->text_color.r = 180;
|
||||
choice->text_color.g = 150;
|
||||
choice->text_color.b = 110;
|
||||
choice->text_color.a = 255;
|
||||
choice->text_scale_x = 1.0f;
|
||||
choice->text_scale_y = 1.0f;
|
||||
choice->text_x = 104.0f;
|
||||
choice->text_y = 96.0f;
|
||||
choice->scale_x = 1.0f;
|
||||
choice->scale_y = 1.0f;
|
||||
choice->data.choice_num = mChoice_CHOICE_NUM;
|
||||
choice->selected_choice_idx = mChoice_CHOICE0;
|
||||
choice->selected_choice_text_color.r = 120;
|
||||
choice->selected_choice_text_color.g = 50;
|
||||
choice->selected_choice_text_color.b = 50;
|
||||
choice->selected_choice_text_color.a = 255;
|
||||
choice->background_color.r = 0;
|
||||
choice->background_color.g = 195;
|
||||
choice->background_color.b = 185;
|
||||
choice->background_color.a = 255;
|
||||
choice->choice_automove_timer = 0.0f;
|
||||
choice->_D4 = 232.0f;
|
||||
choice->_D8 = 104.0f;
|
||||
choice->scale = 0.0f;
|
||||
choice->main_index = mChoice_MAIN_HIDE;
|
||||
choice->requested_main_index = -1;
|
||||
choice->window_visible_flag = FALSE;
|
||||
choice->font_visible_flag = FALSE;
|
||||
choice->choice_automove_type = mChoice_AUTOMOVE_STOPPED;
|
||||
choice->choice_automove_timer = 0.0f; // duplicate set
|
||||
choice->timer = 0.0f;
|
||||
choice->no_b_flag = FALSE;
|
||||
choice->no_close_flag = FALSE;
|
||||
choice->center_x = 191.0f;
|
||||
choice->center_y = 83.0f;
|
||||
choice->text_color.r = 180;
|
||||
choice->text_color.g = 150;
|
||||
choice->text_color.b = 110;
|
||||
choice->text_color.a = 255;
|
||||
choice->text_scale_x = 1.0f;
|
||||
choice->text_scale_y = 1.0f;
|
||||
choice->text_x = 104.0f;
|
||||
choice->text_y = 96.0f;
|
||||
choice->scale_x = 1.0f;
|
||||
choice->scale_y = 1.0f;
|
||||
choice->data.choice_num = mChoice_CHOICE_NUM;
|
||||
choice->selected_choice_idx = mChoice_CHOICE0;
|
||||
choice->selected_choice_text_color.r = 120;
|
||||
choice->selected_choice_text_color.g = 50;
|
||||
choice->selected_choice_text_color.b = 50;
|
||||
choice->selected_choice_text_color.a = 255;
|
||||
choice->background_color.r = 0;
|
||||
choice->background_color.g = 195;
|
||||
choice->background_color.b = 185;
|
||||
choice->background_color.a = 255;
|
||||
choice->choice_automove_timer = 0.0f;
|
||||
choice->_D4 = 232.0f;
|
||||
choice->_D8 = 104.0f;
|
||||
choice->scale = 0.0f;
|
||||
choice->main_index = mChoice_MAIN_HIDE;
|
||||
choice->requested_main_index = -1;
|
||||
choice->window_visible_flag = FALSE;
|
||||
choice->font_visible_flag = FALSE;
|
||||
choice->choice_automove_type = mChoice_AUTOMOVE_STOPPED;
|
||||
choice->choice_automove_timer = 0.0f; // duplicate set
|
||||
choice->timer = 0.0f;
|
||||
choice->no_b_flag = FALSE;
|
||||
choice->no_close_flag = FALSE;
|
||||
}
|
||||
|
||||
extern void mChoice_Change_request_main_index(mChoice_c* choice, int request_main_index) {
|
||||
choice->requested_main_index = request_main_index;
|
||||
choice->requested_main_index = request_main_index;
|
||||
}
|
||||
|
||||
extern int mChoice_check_main_index(mChoice_c* choice) {
|
||||
return choice->main_index;
|
||||
return choice->main_index;
|
||||
}
|
||||
|
||||
extern int mChoice_check_main_normal(mChoice_c* choice) {
|
||||
if (mChoice_check_main_index(choice) == mChoice_MAIN_NORMAL) {
|
||||
return TRUE;
|
||||
}
|
||||
if (mChoice_check_main_index(choice) == mChoice_MAIN_NORMAL) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void mChoice_Init_choice_data(mChoice_c* choice) {
|
||||
choice->data.choice_num = 0;
|
||||
choice->data.choice_num = 0;
|
||||
}
|
||||
|
||||
static int mChoice_Add_choice_data(mChoice_c* choice, u8* str, int max_len) {
|
||||
if (str != NULL && max_len > 0 && max_len <= mChoice_CHOICE_STRING_LEN) {
|
||||
int num = choice->data.choice_num;
|
||||
if (str != NULL && max_len > 0 && max_len <= mChoice_CHOICE_STRING_LEN) {
|
||||
int num = choice->data.choice_num;
|
||||
|
||||
if (num < mChoice_CHOICE_NUM) {
|
||||
int len = mMsg_Get_Length_String(str, max_len);
|
||||
u8* dst = choice->data.strings[num];
|
||||
int i;
|
||||
if (num < mChoice_CHOICE_NUM) {
|
||||
int i;
|
||||
int len = mMsg_Get_Length_String(str, max_len);
|
||||
u8* dst = choice->data.strings[num];
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
*dst++ = *str++;
|
||||
}
|
||||
for (i = 0; i < len; i++) {
|
||||
*dst++ = *str++;
|
||||
}
|
||||
|
||||
choice->data.string_lens[num] = len;
|
||||
choice->data.choice_num++;
|
||||
return num;
|
||||
choice->data.string_lens[num] = len;
|
||||
choice->data.choice_num++;
|
||||
return num;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
extern void mChoice_Set_choice_data(
|
||||
mChoice_c* choice,
|
||||
u8* str0, int str0_len,
|
||||
u8* str1, int str1_len,
|
||||
u8* str2, int str2_len,
|
||||
u8* str3, int str3_len,
|
||||
u8* str4, int str4_len,
|
||||
u8* str5, int str5_len
|
||||
) {
|
||||
mChoice_Init_choice_data(choice);
|
||||
extern void mChoice_Set_choice_data(mChoice_c* choice, u8* str0, int str0_len, u8* str1, int str1_len, u8* str2,
|
||||
int str2_len, u8* str3, int str3_len, u8* str4, int str4_len, u8* str5,
|
||||
int str5_len) {
|
||||
mChoice_Init_choice_data(choice);
|
||||
|
||||
if (str0 != NULL && str0_len > 0 && str0_len <= mChoice_CHOICE_STRING_LEN) {
|
||||
mChoice_Add_choice_data(choice, str0, str0_len);
|
||||
}
|
||||
if (str0 != NULL && str0_len > 0 && str0_len <= mChoice_CHOICE_STRING_LEN) {
|
||||
mChoice_Add_choice_data(choice, str0, str0_len);
|
||||
}
|
||||
|
||||
if (str1 != NULL && str1_len > 0 && str1_len <= mChoice_CHOICE_STRING_LEN) {
|
||||
mChoice_Add_choice_data(choice, str1, str1_len);
|
||||
}
|
||||
if (str1 != NULL && str1_len > 0 && str1_len <= mChoice_CHOICE_STRING_LEN) {
|
||||
mChoice_Add_choice_data(choice, str1, str1_len);
|
||||
}
|
||||
|
||||
if (str2 != NULL && str2_len > 0 && str2_len <= mChoice_CHOICE_STRING_LEN) {
|
||||
mChoice_Add_choice_data(choice, str2, str2_len);
|
||||
}
|
||||
if (str2 != NULL && str2_len > 0 && str2_len <= mChoice_CHOICE_STRING_LEN) {
|
||||
mChoice_Add_choice_data(choice, str2, str2_len);
|
||||
}
|
||||
|
||||
if (str3 != NULL && str3_len > 0 && str3_len <= mChoice_CHOICE_STRING_LEN) {
|
||||
mChoice_Add_choice_data(choice, str3, str3_len);
|
||||
}
|
||||
if (str3 != NULL && str3_len > 0 && str3_len <= mChoice_CHOICE_STRING_LEN) {
|
||||
mChoice_Add_choice_data(choice, str3, str3_len);
|
||||
}
|
||||
|
||||
if (str4 != NULL && str4_len > 0 && str4_len <= mChoice_CHOICE_STRING_LEN) {
|
||||
mChoice_Add_choice_data(choice, str4, str4_len);
|
||||
}
|
||||
if (str4 != NULL && str4_len > 0 && str4_len <= mChoice_CHOICE_STRING_LEN) {
|
||||
mChoice_Add_choice_data(choice, str4, str4_len);
|
||||
}
|
||||
|
||||
if (str5 != NULL && str5_len > 0 && str5_len <= mChoice_CHOICE_STRING_LEN) {
|
||||
mChoice_Add_choice_data(choice, str5, str5_len);
|
||||
}
|
||||
if (str5 != NULL && str5_len > 0 && str5_len <= mChoice_CHOICE_STRING_LEN) {
|
||||
mChoice_Add_choice_data(choice, str5, str5_len);
|
||||
}
|
||||
}
|
||||
|
||||
static int mChoice_Get_MaxStringDotWidth(mChoice_c* choice) {
|
||||
int i;
|
||||
int choice_num = choice->data.choice_num;
|
||||
int max_width = 0;
|
||||
int i;
|
||||
int choice_num = choice->data.choice_num;
|
||||
int max_width = 0;
|
||||
|
||||
for (i = 0; i < choice_num; i++) {
|
||||
u8* str = choice->data.strings[i];
|
||||
int len = choice->data.string_lens[i];
|
||||
int width = mFont_GetStringWidth(str, len, TRUE);
|
||||
for (i = 0; i < choice_num; i++) {
|
||||
u8* str = choice->data.strings[i];
|
||||
int len = choice->data.string_lens[i];
|
||||
int width = mFont_GetStringWidth(str, len, TRUE);
|
||||
|
||||
if (width > max_width) {
|
||||
max_width = width;
|
||||
if (width > max_width) {
|
||||
max_width = width;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return max_width;
|
||||
return max_width;
|
||||
}
|
||||
|
||||
static int mChoice_Get_MaxStringDotHeight(mChoice_c* choice) {
|
||||
return choice->data.choice_num * 16;
|
||||
return choice->data.choice_num * 16;
|
||||
}
|
||||
|
||||
static void mChoice_Set_DisplayScaleAndDisplayPos(mChoice_c* choice) {
|
||||
int dw = mChoice_Get_MaxStringDotWidth(choice);
|
||||
f32 dotW = ((f32)dw - 24.0f) / 96.0f;
|
||||
int dh = mChoice_Get_MaxStringDotHeight(choice);
|
||||
f32 dotH = ((f32)dh - 32.0f) / 32.0f;
|
||||
f32 scaleX = (dotW * 0.5833333730697632f) + (1.0f/2.4f);
|
||||
f32 scaleY = (dotH * 0.3142857f) + (0.6857143f);
|
||||
int choice_num = choice->data.choice_num;
|
||||
f32 tempDotH;
|
||||
int dw = mChoice_Get_MaxStringDotWidth(choice);
|
||||
f32 dotW = ((f32)dw - 24.0f) / 96.0f;
|
||||
int dh = mChoice_Get_MaxStringDotHeight(choice);
|
||||
f32 dotH = ((f32)dh - 32.0f) / 32.0f;
|
||||
f32 scaleX = (dotW * 0.5833333730697632f) + (1.0f / 2.4f);
|
||||
f32 scaleY = (dotH * 0.3142857f) + (0.6857143f);
|
||||
int choice_num = choice->data.choice_num;
|
||||
f32 tempDotH;
|
||||
|
||||
choice->scale_x = scaleX;
|
||||
choice->scale_y = scaleY;
|
||||
tempDotH = dotH * -20.057144f;
|
||||
choice->text_x = (dotW * -48.0f) + 152.0f;
|
||||
|
||||
if (choice_num > 4) {
|
||||
choice->text_y = tempDotH + 105.0f + (f32)(choice_num - 3) * 2.0f;
|
||||
}
|
||||
else {
|
||||
choice->text_y = tempDotH + 105.0f;
|
||||
}
|
||||
choice->scale_x = scaleX;
|
||||
choice->scale_y = scaleY;
|
||||
tempDotH = dotH * -20.057144f;
|
||||
choice->text_x = (dotW * -48.0f) + 152.0f;
|
||||
|
||||
tempDotH = dotH * 20.057144f;
|
||||
choice->center_x = 242.0f;
|
||||
choice->center_x_begin = 242.0f;
|
||||
choice->center_x_target = 242.0f + (dotW * -35.0f);
|
||||
if (choice_num > 4) {
|
||||
choice->text_y = tempDotH + 105.0f + (f32)(choice_num - 3) * 2.0f;
|
||||
} else {
|
||||
choice->text_y = tempDotH + 105.0f;
|
||||
}
|
||||
|
||||
choice->center_y = 169.0f;
|
||||
choice->center_y_begin = 169.0f;
|
||||
tempDotH = dotH * 20.057144f;
|
||||
choice->center_x = 242.0f;
|
||||
choice->center_x_begin = 242.0f;
|
||||
choice->center_x_target = 242.0f + (dotW * -35.0f);
|
||||
|
||||
if (choice_num > 4) {
|
||||
choice->center_y_target = (169.0f + tempDotH) - (f32)(choice_num - 4) * 16.0f;
|
||||
}
|
||||
else {
|
||||
choice->center_y_target = 169.0f + tempDotH;
|
||||
}
|
||||
choice->center_y = 169.0f;
|
||||
choice->center_y_begin = 169.0f;
|
||||
|
||||
if (choice_num > 4) {
|
||||
choice->center_y_target = (169.0f + tempDotH) - (f32)(choice_num - 4) * 16.0f;
|
||||
} else {
|
||||
choice->center_y_target = 169.0f + tempDotH;
|
||||
}
|
||||
}
|
||||
|
||||
extern int mChoice_Get_ChoseNum(mChoice_c* choice) {
|
||||
return choice->data.selected_choice_idx;
|
||||
return choice->data.selected_choice_idx;
|
||||
}
|
||||
|
||||
extern void mChoice_Clear_ChoseNum(mChoice_c* choice) {
|
||||
choice->data.selected_choice_idx = -1;
|
||||
choice->data.selected_choice_idx = -1;
|
||||
}
|
||||
|
||||
static void mChoice_check_ct(mChoice_c* choice) { }
|
||||
static void mChoice_check_ct(mChoice_c* choice) {
|
||||
}
|
||||
|
||||
static void mChoice_Get_StringDataAddressAndSize(int idx, u32* addr, u32* size) {
|
||||
mMsg_Get_BodyParam(Choice_table_rom_start, Choice_rom_start, idx, addr, size);
|
||||
mMsg_Get_BodyParam(Choice_table_rom_start, Choice_rom_start, idx, addr, size);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_PLAYER_NAME(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mMsg_CopyPlayerName(data, idx, max_size, FALSE);
|
||||
return mMsg_CopyPlayerName(data, idx, max_size, FALSE);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_TALK_NAME(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mMsg_CopyTalkName(actor, data, idx, max_size, FALSE);
|
||||
return mMsg_CopyTalkName(actor, data, idx, max_size, FALSE);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_TAIL(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mMsg_CopyTail(actor, data, idx, max_size, FALSE);
|
||||
return mMsg_CopyTail(actor, data, idx, max_size, FALSE);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_YEAR(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mMsg_CopyYear(data, idx, max_size);
|
||||
return mMsg_CopyYear(data, idx, max_size);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_MONTH(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mMsg_CopyMonth(data, idx, max_size);
|
||||
return mMsg_CopyMonth(data, idx, max_size);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_WEEK(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mMsg_CopyWeek(data, idx, max_size);
|
||||
return mMsg_CopyWeek(data, idx, max_size);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_DAY(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mMsg_CopyDay(data, idx, max_size);
|
||||
return mMsg_CopyDay(data, idx, max_size);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_HOUR(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
mMsg_Window_c* msg_p = mMsg_Get_base_window_p();
|
||||
int hour = Common_Get(time.rtc_time.hour);
|
||||
mMsg_Window_c* msg_p = mMsg_Get_base_window_p();
|
||||
int hour = Common_Get(time.rtc_time.hour);
|
||||
|
||||
if (hour < 12) {
|
||||
msg_p->status_flags |= mMsg_STATUS_FLAG_USE_AM;
|
||||
}
|
||||
else {
|
||||
msg_p->status_flags &= ~mMsg_STATUS_FLAG_USE_AM;
|
||||
}
|
||||
if (hour < 12) {
|
||||
msg_p->status_flags |= mMsg_STATUS_FLAG_USE_AM;
|
||||
} else {
|
||||
msg_p->status_flags &= ~mMsg_STATUS_FLAG_USE_AM;
|
||||
}
|
||||
|
||||
return mMsg_CopyHour(data, idx, max_size);
|
||||
return mMsg_CopyHour(data, idx, max_size);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_MIN(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mMsg_CopyMin(data, idx, max_size);
|
||||
return mMsg_CopyMin(data, idx, max_size);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_SEC(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mMsg_CopySec(data, idx, max_size);
|
||||
return mMsg_CopySec(data, idx, max_size);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_FREE(u8* data, int idx, int max_size, ACTOR* actor, int free_idx) {
|
||||
return mMsg_CopyFree(mMsg_Get_base_window_p(), free_idx, data, idx, max_size, mIN_ARTICLE_NUM, FALSE);
|
||||
return mMsg_CopyFree(mMsg_Get_base_window_p(), free_idx, data, idx, max_size, mIN_ARTICLE_NUM, FALSE);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_FREE0(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mChoice_Put_String_FREE(data, idx, max_size, actor, mMsg_FREE_STR0);
|
||||
return mChoice_Put_String_FREE(data, idx, max_size, actor, mMsg_FREE_STR0);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_FREE1(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mChoice_Put_String_FREE(data, idx, max_size, actor, mMsg_FREE_STR1);
|
||||
return mChoice_Put_String_FREE(data, idx, max_size, actor, mMsg_FREE_STR1);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_FREE2(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mChoice_Put_String_FREE(data, idx, max_size, actor, mMsg_FREE_STR2);
|
||||
return mChoice_Put_String_FREE(data, idx, max_size, actor, mMsg_FREE_STR2);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_FREE3(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mChoice_Put_String_FREE(data, idx, max_size, actor, mMsg_FREE_STR3);
|
||||
return mChoice_Put_String_FREE(data, idx, max_size, actor, mMsg_FREE_STR3);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_FREE4(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mChoice_Put_String_FREE(data, idx, max_size, actor, mMsg_FREE_STR4);
|
||||
return mChoice_Put_String_FREE(data, idx, max_size, actor, mMsg_FREE_STR4);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_FREE5(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mChoice_Put_String_FREE(data, idx, max_size, actor, mMsg_FREE_STR5);
|
||||
return mChoice_Put_String_FREE(data, idx, max_size, actor, mMsg_FREE_STR5);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_FREE6(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mChoice_Put_String_FREE(data, idx, max_size, actor, mMsg_FREE_STR6);
|
||||
return mChoice_Put_String_FREE(data, idx, max_size, actor, mMsg_FREE_STR6);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_FREE7(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mChoice_Put_String_FREE(data, idx, max_size, actor, mMsg_FREE_STR7);
|
||||
return mChoice_Put_String_FREE(data, idx, max_size, actor, mMsg_FREE_STR7);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_FREE8(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mChoice_Put_String_FREE(data, idx, max_size, actor, mMsg_FREE_STR8);
|
||||
return mChoice_Put_String_FREE(data, idx, max_size, actor, mMsg_FREE_STR8);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_FREE9(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mChoice_Put_String_FREE(data, idx, max_size, actor, mMsg_FREE_STR9);
|
||||
return mChoice_Put_String_FREE(data, idx, max_size, actor, mMsg_FREE_STR9);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_FREE10(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mChoice_Put_String_FREE(data, idx, max_size, actor, mMsg_FREE_STR10);
|
||||
return mChoice_Put_String_FREE(data, idx, max_size, actor, mMsg_FREE_STR10);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_FREE11(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mChoice_Put_String_FREE(data, idx, max_size, actor, mMsg_FREE_STR11);
|
||||
return mChoice_Put_String_FREE(data, idx, max_size, actor, mMsg_FREE_STR11);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_FREE12(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mChoice_Put_String_FREE(data, idx, max_size, actor, mMsg_FREE_STR12);
|
||||
return mChoice_Put_String_FREE(data, idx, max_size, actor, mMsg_FREE_STR12);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_FREE13(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mChoice_Put_String_FREE(data, idx, max_size, actor, mMsg_FREE_STR13);
|
||||
return mChoice_Put_String_FREE(data, idx, max_size, actor, mMsg_FREE_STR13);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_FREE14(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mChoice_Put_String_FREE(data, idx, max_size, actor, mMsg_FREE_STR14);
|
||||
return mChoice_Put_String_FREE(data, idx, max_size, actor, mMsg_FREE_STR14);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_FREE15(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mChoice_Put_String_FREE(data, idx, max_size, actor, mMsg_FREE_STR15);
|
||||
return mChoice_Put_String_FREE(data, idx, max_size, actor, mMsg_FREE_STR15);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_FREE16(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mChoice_Put_String_FREE(data, idx, max_size, actor, mMsg_FREE_STR16);
|
||||
return mChoice_Put_String_FREE(data, idx, max_size, actor, mMsg_FREE_STR16);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_FREE17(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mChoice_Put_String_FREE(data, idx, max_size, actor, mMsg_FREE_STR17);
|
||||
return mChoice_Put_String_FREE(data, idx, max_size, actor, mMsg_FREE_STR17);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_FREE18(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mChoice_Put_String_FREE(data, idx, max_size, actor, mMsg_FREE_STR18);
|
||||
return mChoice_Put_String_FREE(data, idx, max_size, actor, mMsg_FREE_STR18);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_FREE19(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mChoice_Put_String_FREE(data, idx, max_size, actor, mMsg_FREE_STR19);
|
||||
return mChoice_Put_String_FREE(data, idx, max_size, actor, mMsg_FREE_STR19);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_DETERMINATION(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mMsg_CopyDetermination(mMsg_Get_base_window_p(), data, idx, max_size);
|
||||
return mMsg_CopyDetermination(mMsg_Get_base_window_p(), data, idx, max_size);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_COUNTRY_NAME(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mMsg_CopyCountryName(data, idx, max_size, FALSE);
|
||||
return mMsg_CopyCountryName(data, idx, max_size, FALSE);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_RAMDOM_NUMBER2(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mMsg_CopyRamdomNumber2(data, idx, max_size);
|
||||
return mMsg_CopyRamdomNumber2(data, idx, max_size);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_ITEM(u8* data, int idx, int max_size, ACTOR* actor, int item_idx) {
|
||||
return mMsg_CopyItem(mMsg_Get_base_window_p(), item_idx, data, idx, max_size, mIN_ARTICLE_NUM, FALSE);
|
||||
return mMsg_CopyItem(mMsg_Get_base_window_p(), item_idx, data, idx, max_size, mIN_ARTICLE_NUM, FALSE);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_ITEM0(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mChoice_Put_String_ITEM(data, idx, max_size, actor, mMsg_ITEM_STR0);
|
||||
return mChoice_Put_String_ITEM(data, idx, max_size, actor, mMsg_ITEM_STR0);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_ITEM1(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mChoice_Put_String_ITEM(data, idx, max_size, actor, mMsg_ITEM_STR1);
|
||||
return mChoice_Put_String_ITEM(data, idx, max_size, actor, mMsg_ITEM_STR1);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_ITEM2(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mChoice_Put_String_ITEM(data, idx, max_size, actor, mMsg_ITEM_STR2);
|
||||
return mChoice_Put_String_ITEM(data, idx, max_size, actor, mMsg_ITEM_STR2);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_ITEM3(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mChoice_Put_String_ITEM(data, idx, max_size, actor, mMsg_ITEM_STR3);
|
||||
return mChoice_Put_String_ITEM(data, idx, max_size, actor, mMsg_ITEM_STR3);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_ITEM4(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mChoice_Put_String_ITEM(data, idx, max_size, actor, mMsg_ITEM_STR4);
|
||||
return mChoice_Put_String_ITEM(data, idx, max_size, actor, mMsg_ITEM_STR4);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_ISLAND_NAME(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mMsg_CopyIslandName(data, idx, max_size, FALSE);
|
||||
return mMsg_CopyIslandName(data, idx, max_size, FALSE);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_AMPM(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mMsg_CopyAmPm(mMsg_Get_base_window_p(), data, idx, max_size);
|
||||
return mMsg_CopyAmPm(mMsg_Get_base_window_p(), data, idx, max_size);
|
||||
}
|
||||
|
||||
typedef int (*mChoice_PUT_STRING_PROC)(u8*, int, int, ACTOR*);
|
||||
|
||||
static int mChoice_Put_String(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
static const mChoice_PUT_STRING_PROC proc[mFont_CONT_CODE_NUM] = {
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
&mChoice_Put_String_PLAYER_NAME,
|
||||
&mChoice_Put_String_TALK_NAME,
|
||||
&mChoice_Put_String_TAIL,
|
||||
&mChoice_Put_String_YEAR,
|
||||
&mChoice_Put_String_MONTH,
|
||||
&mChoice_Put_String_WEEK,
|
||||
&mChoice_Put_String_DAY,
|
||||
&mChoice_Put_String_HOUR,
|
||||
&mChoice_Put_String_MIN,
|
||||
&mChoice_Put_String_SEC,
|
||||
&mChoice_Put_String_FREE0,
|
||||
&mChoice_Put_String_FREE1,
|
||||
&mChoice_Put_String_FREE2,
|
||||
&mChoice_Put_String_FREE3,
|
||||
&mChoice_Put_String_FREE4,
|
||||
&mChoice_Put_String_FREE5,
|
||||
&mChoice_Put_String_FREE6,
|
||||
&mChoice_Put_String_FREE7,
|
||||
&mChoice_Put_String_FREE8,
|
||||
&mChoice_Put_String_FREE9,
|
||||
&mChoice_Put_String_DETERMINATION,
|
||||
&mChoice_Put_String_COUNTRY_NAME,
|
||||
&mChoice_Put_String_RAMDOM_NUMBER2,
|
||||
&mChoice_Put_String_ITEM0,
|
||||
&mChoice_Put_String_ITEM1,
|
||||
&mChoice_Put_String_ITEM2,
|
||||
&mChoice_Put_String_ITEM3,
|
||||
&mChoice_Put_String_ITEM4,
|
||||
&mChoice_Put_String_FREE10,
|
||||
&mChoice_Put_String_FREE11,
|
||||
&mChoice_Put_String_FREE12,
|
||||
&mChoice_Put_String_FREE13,
|
||||
&mChoice_Put_String_FREE14,
|
||||
&mChoice_Put_String_FREE15,
|
||||
&mChoice_Put_String_FREE16,
|
||||
&mChoice_Put_String_FREE17,
|
||||
&mChoice_Put_String_FREE18,
|
||||
&mChoice_Put_String_FREE19,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
&mChoice_Put_String_ISLAND_NAME,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
&mChoice_Put_String_AMPM,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
static const mChoice_PUT_STRING_PROC proc[mFont_CONT_CODE_NUM] = {
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
&mChoice_Put_String_PLAYER_NAME,
|
||||
&mChoice_Put_String_TALK_NAME,
|
||||
&mChoice_Put_String_TAIL,
|
||||
&mChoice_Put_String_YEAR,
|
||||
&mChoice_Put_String_MONTH,
|
||||
&mChoice_Put_String_WEEK,
|
||||
&mChoice_Put_String_DAY,
|
||||
&mChoice_Put_String_HOUR,
|
||||
&mChoice_Put_String_MIN,
|
||||
&mChoice_Put_String_SEC,
|
||||
&mChoice_Put_String_FREE0,
|
||||
&mChoice_Put_String_FREE1,
|
||||
&mChoice_Put_String_FREE2,
|
||||
&mChoice_Put_String_FREE3,
|
||||
&mChoice_Put_String_FREE4,
|
||||
&mChoice_Put_String_FREE5,
|
||||
&mChoice_Put_String_FREE6,
|
||||
&mChoice_Put_String_FREE7,
|
||||
&mChoice_Put_String_FREE8,
|
||||
&mChoice_Put_String_FREE9,
|
||||
&mChoice_Put_String_DETERMINATION,
|
||||
&mChoice_Put_String_COUNTRY_NAME,
|
||||
&mChoice_Put_String_RAMDOM_NUMBER2,
|
||||
&mChoice_Put_String_ITEM0,
|
||||
&mChoice_Put_String_ITEM1,
|
||||
&mChoice_Put_String_ITEM2,
|
||||
&mChoice_Put_String_ITEM3,
|
||||
&mChoice_Put_String_ITEM4,
|
||||
&mChoice_Put_String_FREE10,
|
||||
&mChoice_Put_String_FREE11,
|
||||
&mChoice_Put_String_FREE12,
|
||||
&mChoice_Put_String_FREE13,
|
||||
&mChoice_Put_String_FREE14,
|
||||
&mChoice_Put_String_FREE15,
|
||||
&mChoice_Put_String_FREE16,
|
||||
&mChoice_Put_String_FREE17,
|
||||
&mChoice_Put_String_FREE18,
|
||||
&mChoice_Put_String_FREE19,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
&mChoice_Put_String_ISLAND_NAME,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
&mChoice_Put_String_AMPM,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
|
||||
int type = data[idx + 1];
|
||||
int type = data[idx + 1];
|
||||
|
||||
if (type >= 0 && type < mFont_CONT_CODE_NUM && proc[type] != NULL) {
|
||||
return (*proc[type])(data, idx, max_size, actor);
|
||||
}
|
||||
if (type >= 0 && type < mFont_CONT_CODE_NUM && proc[type] != NULL) {
|
||||
return (*proc[type])(data, idx, max_size, actor);
|
||||
}
|
||||
|
||||
return max_size;
|
||||
return max_size;
|
||||
}
|
||||
|
||||
static void mChoice_Change_ControlCode(u8* data, int max_size, ACTOR* actor) {
|
||||
u8* src_p = data;
|
||||
int new_max_size = max_size;
|
||||
int idx = 0;
|
||||
u8 code;
|
||||
u8* src_p = data;
|
||||
int new_max_size = max_size;
|
||||
int idx = 0;
|
||||
u8 code;
|
||||
|
||||
while (idx < new_max_size) {
|
||||
code = *src_p;
|
||||
while (idx < new_max_size) {
|
||||
code = *src_p;
|
||||
|
||||
if (code == CHAR_CONTROL_CODE) {
|
||||
new_max_size = mChoice_Put_String(data, idx, new_max_size, actor);
|
||||
if (code == CHAR_CONTROL_CODE) {
|
||||
new_max_size = mChoice_Put_String(data, idx, new_max_size, actor);
|
||||
} else {
|
||||
idx++;
|
||||
src_p++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
idx++;
|
||||
src_p++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extern void mChoice_Load_ChoseStringFromRom(mChoice_c* choice, u8* str, int str_no, ACTOR* actor) {
|
||||
if (str_no >= 0 && str_no < mChoice_SELECT_STR_NUM) {
|
||||
u32 addr;
|
||||
u32 size;
|
||||
if (str_no >= 0 && str_no < mChoice_SELECT_STR_NUM) {
|
||||
u32 addr;
|
||||
u32 size;
|
||||
|
||||
mChoice_Get_StringDataAddressAndSize(str_no, &addr, &size);
|
||||
mChoice_Get_StringDataAddressAndSize(str_no, &addr, &size);
|
||||
|
||||
if (size == 0) {
|
||||
mem_clear(str, mChoice_CHOICE_STRING_LEN, CHAR_SPACE);
|
||||
if (size == 0) {
|
||||
mem_clear(str, mChoice_CHOICE_STRING_LEN, CHAR_SPACE);
|
||||
} else if (addr != 0) {
|
||||
static u8 buff[80] ATTRIBUTE_ALIGN(32);
|
||||
u32 align_addr = ALIGN_PREV(addr, 32);
|
||||
u32 ofs = addr - align_addr;
|
||||
u32 align_size = ALIGN_NEXT(ofs + size, 32);
|
||||
int max;
|
||||
int i;
|
||||
u8* dst_p;
|
||||
u8* src_p;
|
||||
|
||||
_JW_GetResourceAram(align_addr, buff, align_size);
|
||||
|
||||
max = mChoice_CHOICE_STRING_LEN;
|
||||
if (size < mChoice_CHOICE_STRING_LEN) {
|
||||
max = size;
|
||||
}
|
||||
|
||||
src_p = &buff[ofs];
|
||||
dst_p = str;
|
||||
|
||||
/* Copy string from the temp aligned buffer to the destination */
|
||||
for (i = 0; i < max; i++) {
|
||||
*dst_p++ = *src_p++;
|
||||
}
|
||||
|
||||
/* Fill remaining space with space characters */
|
||||
for (i; i < mChoice_CHOICE_STRING_LEN; i++) {
|
||||
*dst_p++ = CHAR_SPACE;
|
||||
}
|
||||
|
||||
/* Process any control codes */
|
||||
mChoice_Change_ControlCode(str, mChoice_CHOICE_STRING_LEN, actor);
|
||||
}
|
||||
}
|
||||
else if (addr != 0) {
|
||||
static u8 buff[80] ATTRIBUTE_ALIGN(32);
|
||||
u32 align_addr = ALIGN_PREV(addr, 32);
|
||||
u32 ofs = addr - align_addr;
|
||||
u32 align_size = ALIGN_NEXT(ofs + size, 32);
|
||||
int max;
|
||||
int i;
|
||||
u8* src_p;
|
||||
u8* dst_p;
|
||||
|
||||
_JW_GetResourceAram(align_addr, buff, align_size);
|
||||
|
||||
max = mChoice_CHOICE_STRING_LEN;
|
||||
if (size < mChoice_CHOICE_STRING_LEN) {
|
||||
max = size;
|
||||
}
|
||||
|
||||
src_p = &buff[ofs];
|
||||
dst_p = str;
|
||||
|
||||
/* Copy string from the temp aligned buffer to the destination */
|
||||
for (i = 0; i < max; i++) {
|
||||
*dst_p++ = *src_p++;
|
||||
}
|
||||
|
||||
/* Fill remaining space with space characters */
|
||||
for (i; i < mChoice_CHOICE_STRING_LEN; i++) {
|
||||
*dst_p++ = CHAR_SPACE;
|
||||
}
|
||||
|
||||
/* Process any control codes */
|
||||
mChoice_Change_ControlCode(str, mChoice_CHOICE_STRING_LEN, actor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extern void mChoice_no_b_set(mChoice_c* choice) {
|
||||
choice->no_b_flag = TRUE;
|
||||
choice->no_b_flag = TRUE;
|
||||
}
|
||||
|
||||
extern void mChoice_no_b_close_set(mChoice_c* choice) {
|
||||
choice->no_b_flag = TRUE;
|
||||
choice->no_close_flag = TRUE;
|
||||
choice->no_b_flag = TRUE;
|
||||
choice->no_close_flag = TRUE;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
static void mChoice_Main_Hide(mChoice_c* choice, GAME* game) {
|
||||
mChoice_MainSetup(choice, game);
|
||||
mChoice_MainSetup(choice, game);
|
||||
}
|
||||
|
||||
static void mChoice_MainSetup_Hide(mChoice_c* choice, GAME* game) {
|
||||
mChoice_init(choice, game);
|
||||
mChoice_init(choice, game);
|
||||
}
|
||||
|
||||
+124
-138
@@ -1,162 +1,148 @@
|
||||
static void mChoice_determimation_set(mChoice_c* choice) {
|
||||
mChoice_Data_c* choice_data = &choice->data;
|
||||
int idx = choice->selected_choice_idx;
|
||||
mChoice_Data_c* choice_data = &choice->data;
|
||||
int idx = choice->selected_choice_idx;
|
||||
|
||||
bcopy(choice_data->strings[idx], choice_data->determination_string, mChoice_CHOICE_STRING_LEN);
|
||||
choice_data->determination_len = choice_data->string_lens[idx];
|
||||
choice_data->selected_choice_idx = idx;
|
||||
bcopy(choice_data->strings[idx], choice_data->determination_string, mChoice_CHOICE_STRING_LEN);
|
||||
choice_data->determination_len = choice_data->string_lens[idx];
|
||||
choice_data->selected_choice_idx = idx;
|
||||
}
|
||||
|
||||
static int mChoice_Main_Normal_SetChoice(mChoice_c* choice, GAME* game) {
|
||||
int res = FALSE;
|
||||
int res = FALSE;
|
||||
|
||||
if (chkTrigger(BUTTON_A)) {
|
||||
mChoice_determimation_set(choice);
|
||||
res = TRUE;
|
||||
}
|
||||
else if (choice->no_b_flag && chkTrigger(BUTTON_B)) {
|
||||
choice->selected_choice_idx = choice->data.choice_num - 1;
|
||||
mChoice_determimation_set(choice);
|
||||
res = TRUE;
|
||||
}
|
||||
else {
|
||||
f32 percent = gamePT->mcon.adjusted_pY;
|
||||
int* choice_automove_p = &choice->choice_automove_type;
|
||||
f32* choice_automove_timer_p = &choice->choice_automove_timer;
|
||||
int* selected_idx_p = &choice->selected_choice_idx;
|
||||
int cursor_sfx = FALSE;
|
||||
if (chkTrigger(BUTTON_A)) {
|
||||
mChoice_determimation_set(choice);
|
||||
res = TRUE;
|
||||
} else if (choice->no_b_flag && chkTrigger(BUTTON_B)) {
|
||||
choice->selected_choice_idx = choice->data.choice_num - 1;
|
||||
mChoice_determimation_set(choice);
|
||||
res = TRUE;
|
||||
} else {
|
||||
f32 percent = gamePT->mcon.adjusted_pY;
|
||||
int* choice_automove_p = &choice->choice_automove_type;
|
||||
f32* choice_automove_timer_p = &choice->choice_automove_timer;
|
||||
int* selected_idx_p = &choice->selected_choice_idx;
|
||||
int cursor_sfx = FALSE;
|
||||
|
||||
switch (*choice_automove_p) {
|
||||
case mChoice_AUTOMOVE_INCREMENT_WAIT:
|
||||
{
|
||||
if (percent < 0.0f || chkButton(BUTTON_CDOWN)) {
|
||||
(*choice_automove_timer_p) += 1.0f;
|
||||
switch (*choice_automove_p) {
|
||||
case mChoice_AUTOMOVE_INCREMENT_WAIT: {
|
||||
if (percent < 0.0f || chkButton(BUTTON_CDOWN)) {
|
||||
(*choice_automove_timer_p) += 1.0f;
|
||||
|
||||
if (*choice_automove_timer_p >= 18.0f) {
|
||||
*choice_automove_timer_p = 0.0f;
|
||||
*choice_automove_p = mChoice_AUTOMOVE_INCREMENT;
|
||||
(*selected_idx_p)++;
|
||||
cursor_sfx = TRUE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
*choice_automove_p = mChoice_AUTOMOVE_STOPPED;
|
||||
*choice_automove_timer_p = 0.0f;
|
||||
if (*choice_automove_timer_p >= 18.0f) {
|
||||
*choice_automove_timer_p = 0.0f;
|
||||
*choice_automove_p = mChoice_AUTOMOVE_INCREMENT;
|
||||
(*selected_idx_p)++;
|
||||
cursor_sfx = TRUE;
|
||||
}
|
||||
} else {
|
||||
*choice_automove_p = mChoice_AUTOMOVE_STOPPED;
|
||||
*choice_automove_timer_p = 0.0f;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case mChoice_AUTOMOVE_INCREMENT: {
|
||||
if (percent < 0.0f || chkButton(BUTTON_CDOWN)) {
|
||||
(*choice_automove_timer_p) += 1.0f;
|
||||
|
||||
if (*choice_automove_timer_p >= 9.0f) {
|
||||
*choice_automove_timer_p = 0.0f;
|
||||
(*selected_idx_p)++;
|
||||
cursor_sfx = TRUE;
|
||||
}
|
||||
} else {
|
||||
*choice_automove_p = mChoice_AUTOMOVE_STOPPED;
|
||||
*choice_automove_timer_p = 0.0f;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case mChoice_AUTOMOVE_DECREMENT_WAIT: {
|
||||
if (percent > 0.0f || chkButton(BUTTON_CUP)) {
|
||||
(*choice_automove_timer_p) += 1.0f;
|
||||
|
||||
if (*choice_automove_timer_p >= 18.0f) {
|
||||
*choice_automove_timer_p = 0.0f;
|
||||
*choice_automove_p = mChoice_AUTOMOVE_DECREMENT;
|
||||
(*selected_idx_p)--;
|
||||
cursor_sfx = TRUE;
|
||||
}
|
||||
} else {
|
||||
*choice_automove_p = mChoice_AUTOMOVE_STOPPED;
|
||||
*choice_automove_timer_p = 0.0f;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case mChoice_AUTOMOVE_DECREMENT: {
|
||||
if (percent > 0.0f || chkButton(BUTTON_CUP)) {
|
||||
(*choice_automove_timer_p) += 1.0f;
|
||||
|
||||
if (*choice_automove_timer_p >= 9.0f) {
|
||||
*choice_automove_timer_p = 0.0f;
|
||||
(*selected_idx_p)--;
|
||||
cursor_sfx = TRUE;
|
||||
}
|
||||
} else {
|
||||
*choice_automove_p = mChoice_AUTOMOVE_STOPPED;
|
||||
*choice_automove_timer_p = 0.0f;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default: {
|
||||
if (percent > 0.0f || chkTrigger(BUTTON_CUP)) {
|
||||
*choice_automove_p = mChoice_AUTOMOVE_DECREMENT_WAIT;
|
||||
*choice_automove_timer_p = 0.0f;
|
||||
(*selected_idx_p)--;
|
||||
cursor_sfx = TRUE;
|
||||
} else if (percent < 0.0f || chkTrigger(BUTTON_CDOWN)) {
|
||||
*choice_automove_p = mChoice_AUTOMOVE_INCREMENT_WAIT;
|
||||
*choice_automove_timer_p = 0.0f;
|
||||
(*selected_idx_p)++;
|
||||
cursor_sfx = TRUE;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case mChoice_AUTOMOVE_INCREMENT:
|
||||
{
|
||||
if (percent < 0.0f || chkButton(BUTTON_CDOWN)) {
|
||||
(*choice_automove_timer_p) += 1.0f;
|
||||
|
||||
if (*choice_automove_timer_p >= 9.0f) {
|
||||
*choice_automove_timer_p = 0.0f;
|
||||
(*selected_idx_p)++;
|
||||
cursor_sfx = TRUE;
|
||||
}
|
||||
if ((*selected_idx_p) < 0) {
|
||||
*selected_idx_p = 0;
|
||||
} else if ((*selected_idx_p) >= choice->data.choice_num) {
|
||||
*selected_idx_p = choice->data.choice_num - 1;
|
||||
} else {
|
||||
if (cursor_sfx) {
|
||||
mChoice_sound_CURSOL();
|
||||
}
|
||||
}
|
||||
else {
|
||||
*choice_automove_p = mChoice_AUTOMOVE_STOPPED;
|
||||
*choice_automove_timer_p = 0.0f;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case mChoice_AUTOMOVE_DECREMENT_WAIT:
|
||||
{
|
||||
if (percent > 0.0f || chkButton(BUTTON_CUP)) {
|
||||
(*choice_automove_timer_p) += 1.0f;
|
||||
|
||||
if (*choice_automove_timer_p >= 18.0f) {
|
||||
*choice_automove_timer_p = 0.0f;
|
||||
*choice_automove_p = mChoice_AUTOMOVE_DECREMENT;
|
||||
(*selected_idx_p)--;
|
||||
cursor_sfx = TRUE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
*choice_automove_p = mChoice_AUTOMOVE_STOPPED;
|
||||
*choice_automove_timer_p = 0.0f;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case mChoice_AUTOMOVE_DECREMENT:
|
||||
{
|
||||
if (percent > 0.0f || chkButton(BUTTON_CUP)) {
|
||||
(*choice_automove_timer_p) += 1.0f;
|
||||
|
||||
if (*choice_automove_timer_p >= 9.0f) {
|
||||
*choice_automove_timer_p = 0.0f;
|
||||
(*selected_idx_p)--;
|
||||
cursor_sfx = TRUE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
*choice_automove_p = mChoice_AUTOMOVE_STOPPED;
|
||||
*choice_automove_timer_p = 0.0f;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
if (percent > 0.0f || chkTrigger(BUTTON_CUP)) {
|
||||
*choice_automove_p = mChoice_AUTOMOVE_DECREMENT_WAIT;
|
||||
*choice_automove_timer_p = 0.0f;
|
||||
(*selected_idx_p)--;
|
||||
cursor_sfx = TRUE;
|
||||
}
|
||||
else if (percent < 0.0f || chkTrigger(BUTTON_CDOWN)) {
|
||||
*choice_automove_p = mChoice_AUTOMOVE_INCREMENT_WAIT;
|
||||
*choice_automove_timer_p = 0.0f;
|
||||
(*selected_idx_p)++;
|
||||
cursor_sfx = TRUE;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ((*selected_idx_p) < 0) {
|
||||
*selected_idx_p = 0;
|
||||
}
|
||||
else if ((*selected_idx_p) >= choice->data.choice_num) {
|
||||
*selected_idx_p = choice->data.choice_num - 1;
|
||||
}
|
||||
else {
|
||||
if (cursor_sfx) {
|
||||
mChoice_sound_CURSOL();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
return res;
|
||||
}
|
||||
|
||||
static void mChoice_request_main_index_fromNormal(mChoice_c* choice, GAME* game, int close_flag) {
|
||||
if (close_flag) {
|
||||
mChoice_Change_request_main_index(choice, mChoice_MAIN_DISAPPEAR);
|
||||
}
|
||||
if (close_flag) {
|
||||
mChoice_Change_request_main_index(choice, mChoice_MAIN_DISAPPEAR);
|
||||
}
|
||||
}
|
||||
|
||||
static void mChoice_Main_Normal(mChoice_c* choice, GAME* game) {
|
||||
int close_flag = mChoice_Main_Normal_SetChoice(choice, game);
|
||||
int close_flag = mChoice_Main_Normal_SetChoice(choice, game);
|
||||
|
||||
mChoice_request_main_index_fromNormal(choice, game, close_flag);
|
||||
mChoice_MainSetup(choice, game);
|
||||
mChoice_request_main_index_fromNormal(choice, game, close_flag);
|
||||
mChoice_MainSetup(choice, game);
|
||||
}
|
||||
|
||||
static void mChoice_MainSetup_Normal(mChoice_c* choice, GAME* game) {
|
||||
choice->scale = 1.0f;
|
||||
choice->timer = 0.0f;
|
||||
choice->requested_main_index = -1;
|
||||
choice->main_index = mChoice_MAIN_NORMAL;
|
||||
choice->font_visible_flag = TRUE;
|
||||
choice->scale = 1.0f;
|
||||
choice->timer = 0.0f;
|
||||
choice->requested_main_index = -1;
|
||||
choice->main_index = mChoice_MAIN_NORMAL;
|
||||
choice->font_visible_flag = TRUE;
|
||||
}
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
static void mChoice_sound_SENTAKU_KETTEI() {
|
||||
sAdo_SysTrgStart(NA_SE_SENTAKU_KETTEI);
|
||||
sAdo_SysTrgStart(NA_SE_SENTAKU_KETTEI);
|
||||
}
|
||||
|
||||
static void mChoice_sound_SENTAKU_OPEN() {
|
||||
sAdo_SysTrgStart(NA_SE_SENTAKU_OPEN);
|
||||
sAdo_SysTrgStart(NA_SE_SENTAKU_OPEN);
|
||||
}
|
||||
|
||||
static void mChoice_sound_CURSOL() {
|
||||
sAdo_SysTrgStart(NA_SE_CURSOL);
|
||||
sAdo_SysTrgStart(NA_SE_CURSOL);
|
||||
}
|
||||
|
||||
static void mChoice_sound_ZOOMDOWN_SHORT() {
|
||||
sAdo_SysTrgStart(SE_SINGLETON(NA_SE_ZOOMDOWN_SHORT));
|
||||
sAdo_SysTrgStart(SE_SINGLETON(NA_SE_ZOOMDOWN_SHORT));
|
||||
}
|
||||
|
||||
static void mChoice_sound_ZOOMDOWN_LONG() {
|
||||
sAdo_SysTrgStart(SE_SINGLETON(NA_SE_ZOOMDOWN_LONG));
|
||||
sAdo_SysTrgStart(SE_SINGLETON(NA_SE_ZOOMDOWN_LONG));
|
||||
}
|
||||
|
||||
+170
-149
@@ -9,16 +9,16 @@
|
||||
|
||||
/**
|
||||
* @brief Clamps the input cockroach count between [0, mCkRh_MAX_NUM].
|
||||
*
|
||||
*
|
||||
* @param count The new cockroach count
|
||||
* @return The clamped cockroach count
|
||||
**/
|
||||
static int mCkRh_GokiFamilyCount2Good(int count) {
|
||||
if (count < 0) {
|
||||
return 0;
|
||||
}
|
||||
if (count < 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return (count <= mCkRh_MAX_NUM ? count : mCkRh_MAX_NUM);
|
||||
return (count <= mCkRh_MAX_NUM ? count : mCkRh_MAX_NUM);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -26,285 +26,306 @@ static int mCkRh_GokiFamilyCount2Good(int count) {
|
||||
* when a new Player is created.
|
||||
**/
|
||||
extern void mCkRh_InitGokiSaveData_InitNewPlayer() {
|
||||
int i;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < PLAYER_NUM; i++) {
|
||||
if (mHS_get_pl_no_detail(i) == -1) {
|
||||
mCkRh_InitGokiSaveData_1Room(i);
|
||||
for (i = 0; i < PLAYER_NUM; i++) {
|
||||
if (mHS_get_pl_no_detail(i) == -1) {
|
||||
mCkRh_InitGokiSaveData_1Room(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Initializes a single house's cockroach data by house index.
|
||||
*
|
||||
*
|
||||
* @param home_no The house index whose cockroach data will be initialized
|
||||
**/
|
||||
extern void mCkRh_InitGokiSaveData_1Room(int home_no) {
|
||||
mCkRh_InitGokiSaveData_1Room_ByHomeData(Save_GetPointer(homes[home_no]));
|
||||
mCkRh_InitGokiSaveData_1Room_ByHomeData(Save_GetPointer(homes[home_no]));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Initializes a single house's cockroach data.
|
||||
*
|
||||
*
|
||||
* @param home The mHm_hs_c house whose cockroach data wil be initialized.
|
||||
**/
|
||||
extern void mCkRh_InitGokiSaveData_1Room_ByHomeData(mHm_hs_c* home) {
|
||||
home->goki.num = 0;
|
||||
home->goki.pad = 0;
|
||||
home->goki.num = 0;
|
||||
home->goki.pad = 0;
|
||||
|
||||
home->goki.time = Common_Get(time.rtc_time);
|
||||
home->goki.time = Common_Get(time.rtc_time);
|
||||
}
|
||||
|
||||
// Aus changed init time to all 0
|
||||
#if VERSION >= VER_GAFU01_00
|
||||
/**
|
||||
* @brief Initializes island cottage cockroach data.
|
||||
**/
|
||||
extern void mCkRh_InitGokiSaveData_IslandPlayerRoom() {
|
||||
const lbRTC_time_c* rtc_time = Common_GetPointer(time.rtc_time);
|
||||
|
||||
Save_Set(island.cottage.goki.num, 0);
|
||||
Save_Set(island.cottage.goki.pad, 0);
|
||||
Save_Set(island.cottage.goki.time.year, rtc_time->year);
|
||||
Save_Set(island.cottage.goki.time.month, rtc_time->month);
|
||||
Save_Set(island.cottage.goki.time.day, rtc_time->day);
|
||||
Save_Set(island.cottage.goki.num, 0);
|
||||
Save_Set(island.cottage.goki.pad, 0);
|
||||
Save_Set(island.cottage.goki.time.year, 0);
|
||||
Save_Set(island.cottage.goki.time.month, 0);
|
||||
Save_Set(island.cottage.goki.time.day, 0);
|
||||
}
|
||||
#else
|
||||
/**
|
||||
* @brief Initializes island cottage cockroach data.
|
||||
**/
|
||||
extern void mCkRh_InitGokiSaveData_IslandPlayerRoom() {
|
||||
const lbRTC_time_c* rtc_time = Common_GetPointer(time.rtc_time);
|
||||
|
||||
Save_Set(island.cottage.goki.num, 0);
|
||||
Save_Set(island.cottage.goki.pad, 0);
|
||||
Save_Set(island.cottage.goki.time.year, rtc_time->year);
|
||||
Save_Set(island.cottage.goki.time.month, rtc_time->month);
|
||||
Save_Set(island.cottage.goki.time.day, rtc_time->day);
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Initializes all houses' cockroach data even if a player owns it.
|
||||
**/
|
||||
extern void mCkRh_InitGokiSaveData_AllRoom() {
|
||||
int i;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < PLAYER_NUM; i++) {
|
||||
mCkRh_InitGokiSaveData_1Room(i);
|
||||
}
|
||||
for (i = 0; i < PLAYER_NUM; i++) {
|
||||
mCkRh_InitGokiSaveData_1Room(i);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Updates the cockroach 'last entered' time for the island cottage.
|
||||
*
|
||||
*
|
||||
* @param scene_id The current scene id
|
||||
**/
|
||||
extern void mCkRh_SetGoingOutCottageTime(int scene_id) {
|
||||
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));
|
||||
}
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Updates the cockroach 'last entered' time for a player's house.
|
||||
*
|
||||
*
|
||||
* @param player_no The index of the player whose cockroach data will be updated
|
||||
**/
|
||||
extern void mCkRh_SavePlayTime(int player_no) {
|
||||
if (player_no < PLAYER_NUM) {
|
||||
int home_no = mHS_get_arrange_idx(player_no);
|
||||
Save_Set(homes[home_no & 3].goki.time, Common_Get(time.rtc_time));
|
||||
}
|
||||
if (player_no < PLAYER_NUM) {
|
||||
int home_no = mHS_get_arrange_idx(player_no);
|
||||
Save_Set(homes[home_no & 3].goki.time, Common_Get(time.rtc_time));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns the inverval in days between the current time and
|
||||
* the last time that the player's cockroach 'last enter time'.
|
||||
*
|
||||
*
|
||||
* @param player_no The index of the player whose 'days gap' will be calculated
|
||||
* @return When a foriegner, 0, otherwise day interval
|
||||
**/
|
||||
static int mCkRh_DaysGapCompareWithSaveTime(int player_no) {
|
||||
int homeid;
|
||||
lbRTC_time_c goki_time;
|
||||
int interval;
|
||||
int homeid;
|
||||
lbRTC_time_c goki_time;
|
||||
int interval;
|
||||
|
||||
if (player_no < PLAYER_NUM) {
|
||||
homeid = mHS_get_arrange_idx(player_no) & 3;
|
||||
goki_time.year = Save_Get(homes[homeid].goki.time.year);
|
||||
goki_time.month = Save_Get(homes[homeid].goki.time.month);
|
||||
goki_time.day = Save_Get(homes[homeid].goki.time.day);
|
||||
goki_time.weekday = lbRTC_Week(goki_time.year, goki_time.month, goki_time.day);
|
||||
goki_time.hour = 1;
|
||||
goki_time.min = 1;
|
||||
goki_time.sec = 1;
|
||||
if (player_no < PLAYER_NUM) {
|
||||
homeid = mHS_get_arrange_idx(player_no) & 3;
|
||||
goki_time.year = Save_Get(homes[homeid].goki.time.year);
|
||||
goki_time.month = Save_Get(homes[homeid].goki.time.month);
|
||||
goki_time.day = Save_Get(homes[homeid].goki.time.day);
|
||||
goki_time.weekday = lbRTC_Week(goki_time.year, goki_time.month, goki_time.day);
|
||||
goki_time.hour = 1;
|
||||
goki_time.min = 1;
|
||||
goki_time.sec = 1;
|
||||
|
||||
interval = lbRTC_GetIntervalDays(&goki_time, Common_GetPointer(time.rtc_time));
|
||||
}
|
||||
else {
|
||||
interval = 0;
|
||||
}
|
||||
interval = lbRTC_GetIntervalDays(&goki_time, Common_GetPointer(time.rtc_time));
|
||||
} else {
|
||||
interval = 0;
|
||||
}
|
||||
|
||||
return interval;
|
||||
return interval;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Gets the day interval between current time and the island cottage
|
||||
* cockroach last enter time.
|
||||
*
|
||||
*
|
||||
* @return days between current time and last island cottage enter time
|
||||
**/
|
||||
static int mCkRh_DaysGapCompareWithCottageSaveTime() {
|
||||
lbRTC_time_c goki_time;
|
||||
lbRTC_time_c goki_time;
|
||||
|
||||
goki_time.year = Save_Get(island.cottage.goki.time.year);
|
||||
goki_time.month = Save_Get(island.cottage.goki.time.month);
|
||||
goki_time.day = Save_Get(island.cottage.goki.time.day);
|
||||
goki_time.weekday = lbRTC_Week(goki_time.year, goki_time.month, goki_time.day);
|
||||
goki_time.hour = 1;
|
||||
goki_time.min = 1;
|
||||
goki_time.sec = 1;
|
||||
goki_time.year = Save_Get(island.cottage.goki.time.year);
|
||||
goki_time.month = Save_Get(island.cottage.goki.time.month);
|
||||
goki_time.day = Save_Get(island.cottage.goki.time.day);
|
||||
goki_time.weekday = lbRTC_Week(goki_time.year, goki_time.month, goki_time.day);
|
||||
goki_time.hour = 1;
|
||||
goki_time.min = 1;
|
||||
goki_time.sec = 1;
|
||||
|
||||
return lbRTC_GetIntervalDays(&goki_time, Common_GetPointer(time.rtc_time));
|
||||
return lbRTC_GetIntervalDays(&goki_time, Common_GetPointer(time.rtc_time));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Determines and updates the saved cockroach number for a player.
|
||||
*
|
||||
*
|
||||
* The minimum day interval between the current time and the cockroach's
|
||||
* 'last entered time' is 7 days. The amount you get scales linearly,
|
||||
* starting with 1 new cockroach on day 7, 2 new on day 8, ...
|
||||
*
|
||||
*
|
||||
* The maximum number of cockroaches is clamped to mCkRh_MAX_NUM which stock
|
||||
* is 10 cockroaches.
|
||||
*
|
||||
*
|
||||
* @param player_no The inex of the player whose cockroach data will be updated
|
||||
**/
|
||||
extern void mCkRh_DecideNowGokiFamilyCount(int player_no) {
|
||||
int count;
|
||||
int day_gap;
|
||||
int home_no;
|
||||
int goki_num;
|
||||
int count;
|
||||
int day_gap;
|
||||
int home_no;
|
||||
int goki_num;
|
||||
|
||||
/* player must live in town */
|
||||
if (player_no < PLAYER_NUM) {
|
||||
day_gap = mCkRh_DaysGapCompareWithSaveTime(player_no);
|
||||
home_no = mHS_get_arrange_idx(player_no) & 3;
|
||||
if (day_gap > mCkRh_INTERVAL_DAYS) {
|
||||
goki_num = Save_Get(homes[home_no].goki.num);
|
||||
count = goki_num > 0 ? day_gap : day_gap - mCkRh_INTERVAL_DAYS;
|
||||
Save_Set(homes[home_no].goki.num, mCkRh_GokiFamilyCount2Good(count + goki_num));
|
||||
/* player must live in town */
|
||||
if (player_no < PLAYER_NUM) {
|
||||
day_gap = mCkRh_DaysGapCompareWithSaveTime(player_no);
|
||||
home_no = mHS_get_arrange_idx(player_no) & 3;
|
||||
if (day_gap > mCkRh_INTERVAL_DAYS) {
|
||||
goki_num = Save_Get(homes[home_no].goki.num);
|
||||
count = goki_num > 0 ? day_gap : day_gap - mCkRh_INTERVAL_DAYS;
|
||||
Save_Set(homes[home_no].goki.num, mCkRh_GokiFamilyCount2Good(count + goki_num));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
day_gap = mCkRh_DaysGapCompareWithCottageSaveTime();
|
||||
if (day_gap > mCkRh_INTERVAL_DAYS) {
|
||||
u8* goki_num = Save_GetPointer(island.cottage.goki.num);
|
||||
count = (int)*goki_num > 0 ? day_gap : day_gap - mCkRh_INTERVAL_DAYS;
|
||||
*goki_num = mCkRh_GokiFamilyCount2Good(count + (int)*goki_num);
|
||||
}
|
||||
// Aus checks the year isn't set to 0
|
||||
#if VERSION >= VER_GAFU01_00
|
||||
if (Save_Get(island).cottage.goki.time.year != 0) {
|
||||
day_gap = mCkRh_DaysGapCompareWithCottageSaveTime();
|
||||
if (day_gap > mCkRh_INTERVAL_DAYS) {
|
||||
u8* goki_num = Save_GetPointer(island.cottage.goki.num);
|
||||
count = (int)*goki_num > 0 ? day_gap : day_gap - mCkRh_INTERVAL_DAYS;
|
||||
*goki_num = mCkRh_GokiFamilyCount2Good(count + (int)*goki_num);
|
||||
}
|
||||
}
|
||||
#else
|
||||
day_gap = mCkRh_DaysGapCompareWithCottageSaveTime();
|
||||
if (day_gap > mCkRh_INTERVAL_DAYS) {
|
||||
u8* goki_num = Save_GetPointer(island.cottage.goki.num);
|
||||
count = (int)*goki_num > 0 ? day_gap : day_gap - mCkRh_INTERVAL_DAYS;
|
||||
*goki_num = mCkRh_GokiFamilyCount2Good(count + (int)*goki_num);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Adds a specific amount of cockroaches to the current player's house.
|
||||
*
|
||||
*
|
||||
* @param count The number of cockroaches to add (total clamped to mCkRh_MAX_NUM)
|
||||
* @return TRUE/FALSE cockroach data was updated
|
||||
**/
|
||||
extern int mCkRh_PlussGokiN_NowRoom(int count, int scene_no) {
|
||||
mActor_name_t fieldid = mFI_GetFieldId();
|
||||
mActor_name_t fieldid = mFI_GetFieldId();
|
||||
|
||||
if (mFI_IS_PLAYER_ROOM(fieldid)) {
|
||||
int player_no = Common_Get(player_no);
|
||||
int house_field_id = mFI_GET_PLAYER_ROOM_NO(fieldid);
|
||||
int home_id = mHS_get_arrange_idx(player_no) & 3;
|
||||
if ((player_no < PLAYER_NUM) && (house_field_id == home_id)) {
|
||||
Save_Set(homes[home_id].goki.num, mCkRh_GokiFamilyCount2Good(count + Save_Get(homes[home_id].goki.num)));
|
||||
return TRUE;
|
||||
if (mFI_IS_PLAYER_ROOM(fieldid)) {
|
||||
int player_no = Common_Get(player_no);
|
||||
int house_field_id = mFI_GET_PLAYER_ROOM_NO(fieldid);
|
||||
int home_id = mHS_get_arrange_idx(player_no) & 3;
|
||||
if ((player_no < PLAYER_NUM) && (house_field_id == home_id)) {
|
||||
Save_Set(homes[home_id].goki.num, mCkRh_GokiFamilyCount2Good(count + Save_Get(homes[home_id].goki.num)));
|
||||
return TRUE;
|
||||
}
|
||||
} else if (scene_no == SCENE_COTTAGE_MY) {
|
||||
u8* goki_num = Save_GetPointer(island.cottage.goki.num);
|
||||
*goki_num = mCkRh_GokiFamilyCount2Good(count + *goki_num);
|
||||
}
|
||||
}
|
||||
else if (scene_no == SCENE_COTTAGE_MY) {
|
||||
u8* goki_num = Save_GetPointer(island.cottage.goki.num);
|
||||
*goki_num = mCkRh_GokiFamilyCount2Good(count + *goki_num);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Removes a specific amount of cockroaches to the current player's house.
|
||||
*
|
||||
*
|
||||
* @param count The number of cockroaches to remove (minimum clamped to 0)
|
||||
* @return TRUE/FALSE cockroach data was updated
|
||||
**/
|
||||
extern int mCkRh_MinusGokiN_NowRoom(int count, int scene_id) {
|
||||
mActor_name_t field_id = mFI_GetFieldId();
|
||||
if (mFI_IS_PLAYER_ROOM(field_id)) {
|
||||
int player_no = Common_Get(player_no);
|
||||
int house_field_id = mFI_GET_PLAYER_ROOM_NO(field_id);
|
||||
int home_no = mHS_get_arrange_idx(player_no) & 3;
|
||||
if (player_no < PLAYER_NUM && house_field_id == home_no) {
|
||||
Save_Set(homes[home_no].goki.num, mCkRh_GokiFamilyCount2Good(Save_Get(homes[home_no].goki.num) - count));
|
||||
return TRUE;
|
||||
mActor_name_t field_id = mFI_GetFieldId();
|
||||
if (mFI_IS_PLAYER_ROOM(field_id)) {
|
||||
int player_no = Common_Get(player_no);
|
||||
int house_field_id = mFI_GET_PLAYER_ROOM_NO(field_id);
|
||||
int home_no = mHS_get_arrange_idx(player_no) & 3;
|
||||
if (player_no < PLAYER_NUM && house_field_id == home_no) {
|
||||
Save_Set(homes[home_no].goki.num, mCkRh_GokiFamilyCount2Good(Save_Get(homes[home_no].goki.num) - count));
|
||||
return TRUE;
|
||||
}
|
||||
} else if (scene_id == SCENE_COTTAGE_MY) {
|
||||
u8* goki_num = Save_GetPointer(island.cottage.goki.num);
|
||||
*goki_num = mCkRh_GokiFamilyCount2Good(*goki_num - count);
|
||||
}
|
||||
}
|
||||
else if (scene_id == SCENE_COTTAGE_MY) {
|
||||
u8* goki_num = Save_GetPointer(island.cottage.goki.num);
|
||||
*goki_num = mCkRh_GokiFamilyCount2Good(*goki_num - count);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Gets the cockroach count for the current scene id.
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* @return
|
||||
* - in player house: house cockroach count
|
||||
* - in island octtage: island cottage cockroach count
|
||||
* - elsewhere: 0
|
||||
**/
|
||||
extern int mCkRh_NowSceneGokiFamilyCount() {
|
||||
mActor_name_t fieldid = mFI_GetFieldId();
|
||||
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_COTTAGE_MY) {
|
||||
return Save_Get(island.cottage.goki.num);
|
||||
}
|
||||
mActor_name_t fieldid = mFI_GetFieldId();
|
||||
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_COTTAGE_MY) {
|
||||
return Save_Get(island.cottage.goki.num);
|
||||
}
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Initializes the 'can_look_goki_count' variable to 0.
|
||||
*
|
||||
*
|
||||
* This variable controls how many cockroaches are currently
|
||||
* visible to the player in a room.
|
||||
**/
|
||||
extern void mCkRh_InitCanLookGokiCount() {
|
||||
Common_Set(can_look_goki_count, 0);
|
||||
Common_Set(can_look_goki_count, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Changes the 'can_look_goki_count' variable by 'count'.
|
||||
*
|
||||
* 'can_look_goki_count' is clamped between
|
||||
*
|
||||
*
|
||||
* 'can_look_goki_count' is clamped between
|
||||
*
|
||||
* @param count The number of visible cockroaches to add/remove
|
||||
* @return TRUE/FALSE were number of visible cockroaches updated?
|
||||
**/
|
||||
extern int mCkRh_CalcCanLookGokiCount(int count) {
|
||||
count += Common_Get(can_look_goki_count);
|
||||
count += Common_Get(can_look_goki_count);
|
||||
|
||||
if (count < 0) {
|
||||
Common_Set(can_look_goki_count, 0);
|
||||
return FALSE;
|
||||
}
|
||||
if (count < 0) {
|
||||
Common_Set(can_look_goki_count, 0);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (count > mCkRh_CAN_LOOK_GOKI_NUM) {
|
||||
Common_Set(can_look_goki_count, mCkRh_CAN_LOOK_GOKI_NUM);
|
||||
return FALSE;
|
||||
}
|
||||
if (count > mCkRh_CAN_LOOK_GOKI_NUM) {
|
||||
Common_Set(can_look_goki_count, mCkRh_CAN_LOOK_GOKI_NUM);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Common_Set(can_look_goki_count, count);
|
||||
return TRUE;
|
||||
Common_Set(can_look_goki_count, count);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Retrieves the 'can_look_gooki_count' value.
|
||||
*
|
||||
*
|
||||
* @return number of cockroaches currently visible to the player
|
||||
**/
|
||||
extern int mCkRh_GetCanLookGokiCount() {
|
||||
return Common_Get(can_look_goki_count);
|
||||
return Common_Get(can_look_goki_count);
|
||||
}
|
||||
|
||||
@@ -567,7 +567,9 @@ extern int mCoBG_CheckHole(xyz_t pos) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
extern int mCoBG_CheckSkySwing(xyz_t pos) {
|
||||
// Renamed in Aus version
|
||||
#if VERSION >= VER_GAFU01_00
|
||||
extern int mCoBG_CheckAirSwing(xyz_t pos) {
|
||||
mCoBG_Collision_u* col = mFI_GetUnitCol(pos);
|
||||
u32 attr = col->data.unit_attribute;
|
||||
|
||||
@@ -589,6 +591,30 @@ extern int mCoBG_CheckSkySwing(xyz_t pos) {
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
#else
|
||||
extern int mCoBG_CheckAirSwing(xyz_t pos) {
|
||||
mCoBG_Collision_u* col = mFI_GetUnitCol(pos);
|
||||
u32 attr = col->data.unit_attribute;
|
||||
|
||||
if (attr >= mCoBG_ATTRIBUTE_WAVE && attr <= mCoBG_ATTRIBUTE_RIVER_NE) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (attr == mCoBG_ATTRIBUTE_SEA || attr == mCoBG_ATTRIBUTE_37 || attr == mCoBG_ATTRIBUTE_38) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (attr >= mCoBG_ATTRIBUTE_39 && attr <= mCoBG_ATTRIBUTE_62) {
|
||||
if (attr >= mCoBG_ATTRIBUTE_47 && attr <= mCoBG_ATTRIBUTE_54) {
|
||||
return FALSE;
|
||||
} else {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
extern int mCoBG_CheckGrassX_ClData(mCoBG_Collision_u* col) {
|
||||
u32 attr = col->data.unit_attribute;
|
||||
|
||||
@@ -347,8 +347,8 @@ void CollisionCheck_setOC_HitInfo(ClObj_c* col1, ClObjElem_c* colelem1, xyz_t* p
|
||||
|
||||
f32 weight1;
|
||||
f32 weight2;
|
||||
f32 minweight;
|
||||
f32 comweight;
|
||||
f32 minweight;
|
||||
|
||||
f32 coldis1;
|
||||
f32 coldis2;
|
||||
|
||||
@@ -347,6 +347,7 @@ static void mCM_cpmail_ovl_draw(Submenu* submenu, GAME* game) {
|
||||
}
|
||||
|
||||
static void mCM_cpmail_draw_init(mSM_MenuInfo_c* menu_info) {
|
||||
#if VERSION < VER_GAFU01_00
|
||||
mCM_disp_data_c* disp_data_p = &mCM_disp_data[0];
|
||||
int i;
|
||||
|
||||
@@ -356,6 +357,7 @@ static void mCM_cpmail_draw_init(mSM_MenuInfo_c* menu_info) {
|
||||
disp_data_p->tex_p = (u8*)disp_data_p->tex_p;
|
||||
disp_data_p++;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
extern void mCM_cpmail_ovl_set_proc(Submenu* submenu) {
|
||||
|
||||
@@ -571,15 +571,13 @@ static void mCO_set_frame_main_dl(Submenu* submenu, GAME* game, int folder) {
|
||||
|
||||
idx = 0;
|
||||
for (k = 0; k < 4; k++) {
|
||||
for (j = 0; j < 3; j++) {
|
||||
for (j = 0; j < 3; j++, idx++) {
|
||||
if (mCO_check_mark_flg(submenu, idx)) {
|
||||
Matrix_push();
|
||||
|
||||
mNW_draw_sav_mark(game, 32 * j, 44 + -k * 29);
|
||||
Matrix_pull();
|
||||
}
|
||||
|
||||
idx++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+472
-501
File diff suppressed because it is too large
Load Diff
+602
-621
File diff suppressed because it is too large
Load Diff
+14
-6
@@ -254,6 +254,8 @@ enum {
|
||||
|
||||
void mDE_setup_action(mDE_Ovl_c* design_ovl, int param_2);
|
||||
|
||||
#define mDE_EXTRACT_COMPONENT(c, s, b) (((c) & (((1 << (b)) - 1)) << (s)) >> (s))
|
||||
|
||||
static void mDE_pallet_RGB5A3_to_RGB24(mDE_Ovl_c* design_ovl) {
|
||||
int i;
|
||||
|
||||
@@ -262,14 +264,20 @@ static void mDE_pallet_RGB5A3_to_RGB24(mDE_Ovl_c* design_ovl) {
|
||||
|
||||
if (color & 0x8000) {
|
||||
// fully opaque, a1r5g5b5
|
||||
design_ovl->rgb8_pal[i].r = (((color >> 10) & 0x1F) * 255) / 31;
|
||||
design_ovl->rgb8_pal[i].g = (((color >> 5) & 0x1F) * 255) / 31;
|
||||
design_ovl->rgb8_pal[i].b = (((color >> 0) & 0x1F) * 255) / 31;
|
||||
// design_ovl->rgb8_pal[i].r = (((color >> 10) & 0x1F) * 255) / 31;
|
||||
// design_ovl->rgb8_pal[i].g = (((color >> 5) & 0x1F) * 255) / 31;
|
||||
// design_ovl->rgb8_pal[i].b = (((color >> 0) & 0x1F) * 255) / 31;
|
||||
design_ovl->rgb8_pal[i].r = (mDE_EXTRACT_COMPONENT(color, 10, 5) * 255) / 31;
|
||||
design_ovl->rgb8_pal[i].g = (mDE_EXTRACT_COMPONENT(color, 5, 5) * 255) / 31;
|
||||
design_ovl->rgb8_pal[i].b = (mDE_EXTRACT_COMPONENT(color, 0, 5) * 255) / 31;
|
||||
} else {
|
||||
// transparent color, a3r4g4b4
|
||||
design_ovl->rgb8_pal[i].r = ((color >> 8) & 0xF) * 17;
|
||||
design_ovl->rgb8_pal[i].g = ((color >> 4) & 0xF) * 17;
|
||||
design_ovl->rgb8_pal[i].b = ((color >> 0) & 0xF) * 17;
|
||||
// design_ovl->rgb8_pal[i].r = ((color >> 8) & 0xF) * 17;
|
||||
// design_ovl->rgb8_pal[i].g = ((color >> 4) & 0xF) * 17;
|
||||
// design_ovl->rgb8_pal[i].b = ((color >> 0) & 0xF) * 17;
|
||||
design_ovl->rgb8_pal[i].r = mDE_EXTRACT_COMPONENT(color, 8, 4) * 17;
|
||||
design_ovl->rgb8_pal[i].g = mDE_EXTRACT_COMPONENT(color, 4, 4) * 17;
|
||||
design_ovl->rgb8_pal[i].b = mDE_EXTRACT_COMPONENT(color, 0, 4) * 17;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+71
-80
@@ -13,124 +13,115 @@
|
||||
static u32 crcTable[256];
|
||||
|
||||
static u32 getcrc(u8* data, size_t len) {
|
||||
u32 crc = CRC32_START_VALUE;
|
||||
size_t i = 0;
|
||||
u32 crc = CRC32_START_VALUE;
|
||||
size_t i = 0;
|
||||
|
||||
do {
|
||||
crc = (crc >> 8) ^ crcTable[(crc ^ data[i]) & 0xFF];
|
||||
i++;
|
||||
} while (i != len);
|
||||
do {
|
||||
crc = (crc >> 8) ^ crcTable[(crc ^ data[i]) & 0xFF];
|
||||
i++;
|
||||
} while (i != len);
|
||||
|
||||
return crc;
|
||||
return crc;
|
||||
}
|
||||
|
||||
static void crcgen() {
|
||||
int bit;
|
||||
u32 c;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 256; i++) {
|
||||
u32 c;
|
||||
int i;
|
||||
int j;
|
||||
c = i;
|
||||
|
||||
for (j = 0; j < 8; j++) {
|
||||
bit = c & 1;
|
||||
c >>= 1;
|
||||
if (bit) {
|
||||
c ^= CRC32_POLYNOMIAL;
|
||||
}
|
||||
}
|
||||
|
||||
crcTable[i] = c;
|
||||
}
|
||||
for (i = 0; i < 256; i++) {
|
||||
c = i;
|
||||
|
||||
for (j = 0; j < 8; j++) {
|
||||
c = (c & 1) ? ((c >> 1) ^ CRC32_POLYNOMIAL) : (c >> 1);
|
||||
}
|
||||
|
||||
crcTable[i] = c;
|
||||
}
|
||||
}
|
||||
|
||||
static u32 mEA_GetCRC(u8* data, size_t len) {
|
||||
crcgen();
|
||||
return getcrc(data, len);
|
||||
crcgen();
|
||||
return getcrc(data, len);
|
||||
}
|
||||
|
||||
static void putLEWord(u8* dst, u32 word) {
|
||||
dst[0] = word >> 0;
|
||||
dst[1] = word >> 8;
|
||||
dst[2] = word >> 16;
|
||||
dst[3] = word >> 24;
|
||||
dst[0] = word >> 0;
|
||||
dst[1] = word >> 8;
|
||||
dst[2] = word >> 16;
|
||||
dst[3] = word >> 24;
|
||||
}
|
||||
|
||||
extern void mEA_InitLetterCardE() {
|
||||
mPr_carde_data_c* carde_data = &Common_Get(now_private)->ecard_letter_data;
|
||||
lbRTC_time_c* rtc_time = Common_GetPointer(time.rtc_time);
|
||||
mPr_carde_data_c* carde_data = &Common_Get(now_private)->ecard_letter_data;
|
||||
lbRTC_time_c* rtc_time = Common_GetPointer(time.rtc_time);
|
||||
|
||||
/* only reset if current date isn't same as last scan date */
|
||||
u16 year = carde_data->letter_send_date.year;
|
||||
u8 month = carde_data->letter_send_date.month;
|
||||
u8 day = carde_data->letter_send_date.day;
|
||||
if (rtc_time->year != year || rtc_time->month != month || rtc_time->day != day) {
|
||||
int i;
|
||||
for (i = 0; i < mPr_ECARD_LETTER_NUM; i++) {
|
||||
carde_data->card_letters_sent[i] = 0;
|
||||
/* only reset if current date isn't same as last scan date */
|
||||
u16 year = carde_data->letter_send_date.year;
|
||||
u8 month = carde_data->letter_send_date.month;
|
||||
u8 day = carde_data->letter_send_date.day;
|
||||
if (rtc_time->year != year || rtc_time->month != month || rtc_time->day != day) {
|
||||
int i;
|
||||
for (i = 0; i < mPr_ECARD_LETTER_NUM; i++) {
|
||||
carde_data->card_letters_sent[i] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extern int mEA_CheckLetterCardE(int card_no) {
|
||||
mPr_carde_data_c* card_data = &Common_Get(now_private)->ecard_letter_data;
|
||||
int index = card_no < mPr_ECARD_NUM ? card_no : mPr_ECARD_NUM - 1;
|
||||
mPr_carde_data_c* card_data = &Common_Get(now_private)->ecard_letter_data;
|
||||
int index = card_no < mPr_ECARD_NUM ? card_no : mPr_ECARD_NUM - 1;
|
||||
|
||||
if (index == mPr_ECARD_NUM - 1) {
|
||||
return ((card_data->card_letters_sent[index >> 3] >> (index & 7)) & 1) ? 2 : 0;
|
||||
}
|
||||
if (index == mPr_ECARD_NUM - 1) {
|
||||
return ((card_data->card_letters_sent[index >> 3] >> (index & 7)) & 1) ? 2 : 0;
|
||||
}
|
||||
|
||||
return (card_data->card_letters_sent[index >> 3] >> (index & 7)) & 1;
|
||||
return (card_data->card_letters_sent[index >> 3] >> (index & 7)) & 1;
|
||||
}
|
||||
|
||||
extern void mEA_SetLetterCardE(int card_no) {
|
||||
mPr_carde_data_c* card_data = &Common_Get(now_private)->ecard_letter_data;
|
||||
int index = card_no < mPr_ECARD_NUM ? card_no : mPr_ECARD_NUM - 1;
|
||||
lbRTC_time_c* rtc_time = Common_GetPointer(time.rtc_time);
|
||||
mPr_carde_data_c* card_data = &Common_Get(now_private)->ecard_letter_data;
|
||||
int index = card_no < mPr_ECARD_NUM ? card_no : mPr_ECARD_NUM - 1;
|
||||
lbRTC_time_c* rtc_time = Common_GetPointer(time.rtc_time);
|
||||
|
||||
card_data->card_letters_sent[index >> 3] |= 1 << (index & 7);
|
||||
card_data->letter_send_date.year = rtc_time->year;
|
||||
card_data->letter_send_date.month = rtc_time->month;
|
||||
card_data->letter_send_date.day = rtc_time->day;
|
||||
card_data->card_letters_sent[index >> 3] |= 1 << (index & 7);
|
||||
card_data->letter_send_date.year = rtc_time->year;
|
||||
card_data->letter_send_date.month = rtc_time->month;
|
||||
card_data->letter_send_date.day = rtc_time->day;
|
||||
}
|
||||
|
||||
#define MY_ORIGINAL_DESIGN_DATA_SIZE (4*(32/2)*32)
|
||||
#define MY_ORIGINAL_DESIGN_DATA_SIZE (4 * (32 / 2) * 32)
|
||||
extern void mEA_GetCardDLProgram() {
|
||||
if (Save_Get(scene_no) != SCENE_TITLE_DEMO && Common_Get(carde_program_p) == NULL) {
|
||||
u32 crc;
|
||||
|
||||
Common_Set(carde_program_size, JW_GetResSizeFileNo(RESOURCE_MY_ORIGINAL) - MY_ORIGINAL_DESIGN_DATA_SIZE); // my_original.bin also contains texture data
|
||||
Common_Set(carde_program_p, (u8*)zelda_malloc_align(Common_Get(carde_program_size), 32));
|
||||
_JW_GetResourceAram(JW_GetAramAddress(RESOURCE_MY_ORIGINAL) + MY_ORIGINAL_DESIGN_DATA_SIZE, Common_Get(carde_program_p), Common_Get(carde_program_size));
|
||||
|
||||
/* write compressed program size to vpk payload */
|
||||
putLEWord(
|
||||
Common_Get(carde_program_p) + 0x2C,
|
||||
Common_Get(carde_program_size) - 0x34
|
||||
);
|
||||
if (Save_Get(scene_no) != SCENE_TITLE_DEMO && Common_Get(carde_program_p) == NULL) {
|
||||
u32 crc;
|
||||
|
||||
/* write vpk CRC32 */
|
||||
crc = mEA_GetCRC(Common_Get(carde_program_p) + sizeof(u32), Common_Get(carde_program_size) - sizeof(u32));
|
||||
putLEWord(
|
||||
Common_Get(carde_program_p),
|
||||
crc
|
||||
);
|
||||
}
|
||||
Common_Set(carde_program_size, JW_GetResSizeFileNo(RESOURCE_MY_ORIGINAL) -
|
||||
MY_ORIGINAL_DESIGN_DATA_SIZE); // my_original.bin also contains texture data
|
||||
Common_Set(carde_program_p, (u8*)zelda_malloc_align(Common_Get(carde_program_size), 32));
|
||||
_JW_GetResourceAram(JW_GetAramAddress(RESOURCE_MY_ORIGINAL) + MY_ORIGINAL_DESIGN_DATA_SIZE,
|
||||
Common_Get(carde_program_p), Common_Get(carde_program_size));
|
||||
|
||||
/* write compressed program size to vpk payload */
|
||||
putLEWord(Common_Get(carde_program_p) + 0x2C, Common_Get(carde_program_size) - 0x34);
|
||||
|
||||
/* write vpk CRC32 */
|
||||
crc = mEA_GetCRC(Common_Get(carde_program_p) + sizeof(u32), Common_Get(carde_program_size) - sizeof(u32));
|
||||
putLEWord(Common_Get(carde_program_p), crc);
|
||||
}
|
||||
}
|
||||
|
||||
extern void mEA_CleanCardDLProgram() {
|
||||
if (Common_Get(carde_program_p) != NULL) {
|
||||
zelda_free(Common_Get(carde_program_p));
|
||||
Common_Set(carde_program_p, NULL);
|
||||
Common_Set(carde_program_size, 0);
|
||||
}
|
||||
if (Common_Get(carde_program_p) != NULL) {
|
||||
zelda_free(Common_Get(carde_program_p));
|
||||
Common_Set(carde_program_p, NULL);
|
||||
Common_Set(carde_program_size, 0);
|
||||
}
|
||||
}
|
||||
|
||||
extern u8* mEA_dl_carde_program_p() {
|
||||
return Common_Get(carde_program_p);
|
||||
return Common_Get(carde_program_p);
|
||||
}
|
||||
|
||||
extern size_t mEA_dl_carde_program_size() {
|
||||
return Common_Get(carde_program_size);
|
||||
return Common_Get(carde_program_size);
|
||||
}
|
||||
|
||||
+1848
-2073
File diff suppressed because it is too large
Load Diff
+72
-35
@@ -364,41 +364,41 @@ static int last_day_of_month(lbRTC_month_t month) {
|
||||
|
||||
static void init_weekday1st() {
|
||||
lbRTC_time_c* rtc_time = Common_GetPointer(time.rtc_time);
|
||||
lbRTC_month_t month;
|
||||
lbRTC_month_t temp;
|
||||
lbRTC_month_t i;
|
||||
int weekday;
|
||||
lbRTC_month_t j;
|
||||
lbRTC_month_t month;
|
||||
int t;
|
||||
|
||||
month = rtc_time->month & 0xF;
|
||||
weekday1st_year = rtc_time->year;
|
||||
|
||||
weekday = (rtc_time->weekday + (1 - rtc_time->day)) % lbRTC_WEEK;
|
||||
if (weekday < 0) {
|
||||
weekday += lbRTC_WEEK;
|
||||
t = (rtc_time->weekday + (1 - rtc_time->day)) % lbRTC_WEEK;
|
||||
if (t < 0) {
|
||||
t += lbRTC_WEEK;
|
||||
}
|
||||
|
||||
weekday1st[month] = weekday;
|
||||
weekday1st[month] = t;
|
||||
|
||||
for (i = month, temp = month + 1; temp <= lbRTC_MONTHS_MAX; i++, temp++) {
|
||||
int last = last_day_of_month(i);
|
||||
int t = (weekday1st[i] + (u8)last) % lbRTC_WEEK;
|
||||
for (i = month, j = month + 1; j <= lbRTC_MONTHS_MAX; i++, j++) {
|
||||
temp = last_day_of_month(i);
|
||||
t = (weekday1st[i] + temp) % lbRTC_WEEK;
|
||||
|
||||
if (t < 0) {
|
||||
t += lbRTC_WEEK;
|
||||
}
|
||||
|
||||
weekday1st[temp] = t;
|
||||
weekday1st[j] = t;
|
||||
}
|
||||
|
||||
for (temp = month - 1, i = month; temp >= lbRTC_JANUARY; i--, temp--) {
|
||||
lbRTC_day_t last_day = last_day_of_month(temp);
|
||||
|
||||
weekday = (weekday1st[i] - last_day) % lbRTC_WEEK;
|
||||
if (weekday < 0) {
|
||||
weekday += lbRTC_WEEK;
|
||||
for (j = month - 1, i = month; j >= lbRTC_JANUARY; i--, j--) {
|
||||
temp = last_day_of_month(j);
|
||||
t = (weekday1st[i] - temp) % lbRTC_WEEK;
|
||||
if (t < 0) {
|
||||
t += lbRTC_WEEK;
|
||||
}
|
||||
|
||||
weekday1st[temp] = weekday;
|
||||
weekday1st[j] = t;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -574,24 +574,21 @@ extern int mEv_weekday2day(lbRTC_month_t month, int week, int weekday) {
|
||||
}
|
||||
|
||||
static int get_end_time(u32 active_hours) {
|
||||
int hour;
|
||||
int i;
|
||||
|
||||
if ((active_hours & ((1 << 24) - 1)) == 0) {
|
||||
return -1; /* no active hours */
|
||||
}
|
||||
|
||||
hour = 23;
|
||||
for (i = 0; i < 24; i++) {
|
||||
for (i = 23; i >= 0; i--) {
|
||||
if ((active_hours & (1 << 23)) != 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
active_hours <<= 1; /* move hours left by one bit, MSB is latest hour */
|
||||
hour--;
|
||||
}
|
||||
|
||||
return hour;
|
||||
return i;
|
||||
}
|
||||
|
||||
extern int mEv_get_end_time(int event_type) {
|
||||
@@ -856,6 +853,7 @@ static int init_special_event(int new_event) {
|
||||
mEv_save_common_data_c* ev_save_common;
|
||||
u16* dates_p;
|
||||
s16 event_year;
|
||||
int t;
|
||||
|
||||
switch (Common_Get(last_scene_no)) {
|
||||
case SCENE_BUGGY:
|
||||
@@ -899,6 +897,20 @@ static int init_special_event(int new_event) {
|
||||
special_ymdh.raw = (dates_p[mEv_SAVE_DATE_SPECIAL0] << 8) & 0x000FFFF00;
|
||||
special_ymdh.year = event_year % 100;
|
||||
|
||||
|
||||
|
||||
#if VERSION >= VER_GAFU01_00
|
||||
rtc_ymdh.raw = (rtc_sched.md) << 8;
|
||||
rtc_ymdh.year = rtc_time->year % 100;
|
||||
rtc_ymdh.hour = rtc_time->hour;
|
||||
special_end_ymdh.raw = (dates_p[mEv_SAVE_DATE_SPECIAL2] << 8) & 0x000FFFF00;
|
||||
t = event_year % 100;
|
||||
if (dates_p[mEv_SAVE_DATE_SPECIAL0] > dates_p[mEv_SAVE_DATE_SPECIAL2]) {
|
||||
t++;
|
||||
}
|
||||
|
||||
special_end_ymdh.year = t;
|
||||
#else
|
||||
rtc_ymdh.raw = (rtc_sched.md) << 8;
|
||||
rtc_ymdh.year = rtc_time->year % 100;
|
||||
rtc_ymdh.hour = rtc_time->hour;
|
||||
@@ -907,6 +919,7 @@ static int init_special_event(int new_event) {
|
||||
dates_p[mEv_SAVE_DATE_SPECIAL0] > rtc_sched.md)
|
||||
? 1
|
||||
: 0);
|
||||
#endif
|
||||
|
||||
special_end_ymdh.hour = get_special_event_end_time(type);
|
||||
|
||||
@@ -945,6 +958,12 @@ static int init_special_event(int new_event) {
|
||||
}
|
||||
|
||||
special_monthday[0].raw = after_n_day(rtc_sched.md, next_event_day_gap);
|
||||
// Aus version prevents special events from happening on the last day of the year
|
||||
#if VERSION >= VER_GAFU01_00
|
||||
if (special_monthday[0].raw == mEv_MonthDay(lbRTC_DECEMBER, 31)) {
|
||||
special_monthday[0].raw = after_n_day(special_monthday[0].raw, 1);
|
||||
}
|
||||
#endif
|
||||
if (rtc_sched.md <= sale_day && sale_day <= special_monthday[0].raw) {
|
||||
/* Force the next special event to be Crazy Redd since Sale Day falls between now and the rolled
|
||||
* event date */
|
||||
@@ -1668,21 +1687,21 @@ static int effective_scene() {
|
||||
}
|
||||
|
||||
static void update_schedule_today(Event_c* event) {
|
||||
int month;
|
||||
lbRTC_time_c* rtc_time = Common_GetPointer(time.rtc_time);
|
||||
// int month;
|
||||
u8 equinox_day = 0;
|
||||
mEv_schedule_date_u today_date;
|
||||
mEv_MonthDay_u birthday_date;
|
||||
mEv_schedule_c sched;
|
||||
lbRTC_time_c* rtc_time = Common_GetPointer(time.rtc_time);
|
||||
mEv_schedule_c* sched_p = &sched;
|
||||
Private_c* priv = &Save_Get(private_data[Common_Get(player_no)]);
|
||||
int i;
|
||||
int type;
|
||||
|
||||
if (mEv_ArbeitPlayer_kari(Common_Get(player_no)) == FALSE) {
|
||||
month = rtc_time->month;
|
||||
// month = rtc_time->month;
|
||||
|
||||
today_date.d.month = month;
|
||||
today_date.d.month = rtc_time->month;
|
||||
today_date.d.day = rtc_time->day;
|
||||
today_date.d.hour = rtc_time->hour;
|
||||
today_date.d._2 = 0;
|
||||
@@ -1708,7 +1727,7 @@ static void update_schedule_today(Event_c* event) {
|
||||
if (sched.type == mEv_EVENT_SUMMER_CAMPER) {
|
||||
mEv_MonthDay_u camper_date;
|
||||
|
||||
switch (month) {
|
||||
switch (today_date.d.month) {
|
||||
case lbRTC_JUNE:
|
||||
case lbRTC_JULY:
|
||||
case lbRTC_AUGUST:
|
||||
@@ -1912,6 +1931,23 @@ extern void mEv_init_force(Event_c* event) {
|
||||
init_event(event, renewal_flag);
|
||||
}
|
||||
|
||||
// Aus checks if the save weather is set to rain, not the current weather.
|
||||
// This would prevent a bug where Morning Aerobics could be scheduled
|
||||
// in the rain because the previous weather was clear.
|
||||
#if VERSION >= VER_GAFU01_00
|
||||
extern void mEv_2nd_init(Event_c* event) {
|
||||
/* Disable morning aerobics if it is scheduled and the weather is rain */
|
||||
u8 index = index_today[mEv_EVENT_MORNING_AEROBICS];
|
||||
|
||||
if (index != 0xFF && mEnv_SAVE_GET_WEATHER_TYPE(Save_Get(weather)) == mEnv_WEATHER_RAIN) {
|
||||
mEv_event_today_c* ev_today = &event_today[index];
|
||||
|
||||
mEv_clear_status(mEv_EVENT_MORNING_AEROBICS, mEv_STATUS_ACTIVE);
|
||||
ev_today->type = -1;
|
||||
index_today[mEv_EVENT_MORNING_AEROBICS] = 0xFF;
|
||||
}
|
||||
}
|
||||
#else
|
||||
extern void mEv_2nd_init(Event_c* event) {
|
||||
/* Disable morning aerobics if it is scheduled and the weather is rain */
|
||||
if (Common_Get(weather) == mEnv_WEATHER_RAIN) {
|
||||
@@ -1926,6 +1962,7 @@ extern void mEv_2nd_init(Event_c* event) {
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
extern int mEv_PlayerOK() {
|
||||
int res = FALSE;
|
||||
@@ -2499,8 +2536,8 @@ extern int mEv_get_rumor() {
|
||||
|
||||
extern void mEv_actor_dying_message(int type, ACTOR* actor) {
|
||||
xyz_t pos = actor->world.position;
|
||||
mEv_common_data_c* ev_common = Common_GetPointer(event_common);
|
||||
mActor_name_t actor_name = actor->npc_id;
|
||||
mEv_common_data_c* ev_common = Common_GetPointer(event_common);
|
||||
int i;
|
||||
|
||||
for (i = 0; i < mEv_PLACE_NUM; i++) {
|
||||
@@ -2621,22 +2658,22 @@ extern int mEv_GetHour(Event_c* event) {
|
||||
}
|
||||
|
||||
extern void mEv_debug_print4f(gfxprint_t* gfxprint) {
|
||||
// int x = 0;
|
||||
int i;
|
||||
int event_idx = 0;
|
||||
|
||||
for (i = 0; i < mEv_TODAY_EVENT_NUM; i++) {
|
||||
if (event_today[i].type != -1 && mEv_check_status(event_today[i].type, mEv_STATUS_ACTIVE)) {
|
||||
mEv_event_today_c* ev = &event_today[i];
|
||||
|
||||
if (ev->type != -1 && mEv_check_status(ev->type, mEv_STATUS_ACTIVE)) {
|
||||
gfxprint_color(gfxprint, 245, 200, 170, 255);
|
||||
gfxprint_locate8x8(gfxprint, 3 + event_idx * 3, 5);
|
||||
gfxprint_printf(gfxprint, "%3d", event_today[i].type);
|
||||
gfxprint_printf(gfxprint, "%3d", ev->type);
|
||||
event_idx++;
|
||||
// x += 3;
|
||||
|
||||
if (event_idx >= 9) {
|
||||
if (mEv_check_status(event_today[i].type, mEv_STATUS_ERROR) == FALSE) {
|
||||
if (mEv_check_status(ev->type, mEv_STATUS_ERROR) == FALSE) {
|
||||
gfxprint_color(gfxprint, 245, 150, 120, 255);
|
||||
} else if (mEv_check_status(event_today[i].type, mEv_STATUS_RUN)) {
|
||||
} else if (mEv_check_status(ev->type, mEv_STATUS_RUN)) {
|
||||
gfxprint_color(gfxprint, 180, 150, 160, 255);
|
||||
} else {
|
||||
gfxprint_color(gfxprint, 140, 120, 120, 255);
|
||||
@@ -2770,7 +2807,7 @@ extern int mEv_someone_died() {
|
||||
|
||||
extern void mEv_special_event_soldout(int type) {
|
||||
GAME_PLAY* play = (GAME_PLAY*)gamePT;
|
||||
mEv_event_today_c* ev_today;
|
||||
mEv_event_today_c* ev_today = event_today;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < mEv_TODAY_EVENT_NUM; i++) {
|
||||
|
||||
@@ -353,11 +353,11 @@ static void mEvMN_SetNpcJointEvRandom(u8* animal_idx, int max) {
|
||||
animal_idx -= max;
|
||||
|
||||
if (animal_count > 0 && mLd_PlayerManKindCheck() == FALSE) {
|
||||
animal = Save_Get(animals);
|
||||
Animal_c* sec_animal = animal;
|
||||
|
||||
for (i = 0; i < ANIMAL_NUM_MAX; i++) {
|
||||
if (((animal_bitfield >> i) & 1) == 1 &&
|
||||
mEvMN_CheckCanJointEvent(animal[i].memories, &Now_Private->player_ID) == FALSE) {
|
||||
mEvMN_CheckCanJointEvent(sec_animal[i].memories, &Now_Private->player_ID) == FALSE) {
|
||||
animal_count--;
|
||||
animal_bitfield &= ~(1 << i);
|
||||
|
||||
|
||||
@@ -211,8 +211,8 @@ static int mFAs_GetFieldGoodBlockNum_common(int* condition_num, int* block_x, in
|
||||
int condition_result;
|
||||
int flower_num;
|
||||
int block_dust_num;
|
||||
int i;
|
||||
int dust_num;
|
||||
int i;
|
||||
int selected_block_x;
|
||||
int selected_block_z;
|
||||
int tree_num;
|
||||
|
||||
+63
-26
@@ -16,9 +16,10 @@ typedef struct collision_keep_s {
|
||||
int unk_C;
|
||||
} mFI_col_keep_c;
|
||||
|
||||
static mFI_col_keep_c l_keepcld[mFI_NUM_COL_KEEP] = { { 0xFF, 0xFF, 0 }, { 0xFF, 0xFF, 0 }, { 0xFF, 0xFF, 0 },
|
||||
{ 0xFF, 0xFF, 0 }, { 0xFF, 0xFF, 0 }, { 0xFF, 0xFF, 0 },
|
||||
{ 0xFF, 0xFF, 0 }, { 0xFF, 0xFF, 0 }, { 0xFF, 0xFF, 0 } };
|
||||
static mFI_col_keep_c l_keepcld[mFI_NUM_COL_KEEP] = {
|
||||
{ 0xFF, 0xFF, 0 }, { 0xFF, 0xFF, 0 }, { 0xFF, 0xFF, 0 }, { 0xFF, 0xFF, 0 }, { 0xFF, 0xFF, 0 },
|
||||
{ 0xFF, 0xFF, 0 }, { 0xFF, 0xFF, 0 }, { 0xFF, 0xFF, 0 }, { 0xFF, 0xFF, 0 },
|
||||
};
|
||||
|
||||
extern void mFI_ClearFieldData() {
|
||||
g_fdinfo = NULL;
|
||||
@@ -1284,10 +1285,20 @@ extern int mFI_GetBlockUtNum2FG(mActor_name_t* item, int bx, int bz, int ut_x, i
|
||||
int num = mFI_GetBlockNum(bx, bz);
|
||||
int ut_num = mFI_GetUtNum(ut_x, ut_z);
|
||||
|
||||
// Aus version added a NULL check on the acre item data pointer
|
||||
#if VERSION >= VER_GAFU01_00
|
||||
if (g_fdinfo->block_info[num].fg_info.items_p != NULL) {
|
||||
res = TRUE;
|
||||
*item = g_fdinfo->block_info[num].fg_info.items_p[ut_num];
|
||||
} else {
|
||||
*item = RSV_NO;
|
||||
}
|
||||
#else
|
||||
res = TRUE;
|
||||
item[0] = g_fdinfo->block_info[num].fg_info.items_p[ut_num];
|
||||
*item = g_fdinfo->block_info[num].fg_info.items_p[ut_num];
|
||||
#endif
|
||||
} else {
|
||||
item[0] = RSV_NO;
|
||||
*item = RSV_NO;
|
||||
}
|
||||
|
||||
return res;
|
||||
@@ -1330,8 +1341,16 @@ extern int mFI_UtNumtoFGSet_common(mActor_name_t item, int ut_x, int ut_z, int u
|
||||
|
||||
mFI_GetUtNumInBK(&b_ut_x, &b_ut_z, ut_x, ut_z);
|
||||
ut_num = mFI_GetUtNum(b_ut_x, b_ut_z);
|
||||
g_fdinfo->block_info[block_num].fg_info.items_p[ut_num] = item;
|
||||
|
||||
// Aus version added a NULL check on the acre item data pointer
|
||||
#if VERSION >= VER_GAFU01_00
|
||||
if (g_fdinfo->block_info[block_num].fg_info.items_p == NULL) {
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
g_fdinfo->block_info[block_num].fg_info.items_p[ut_num] = item;
|
||||
|
||||
if (update) {
|
||||
mFI_SetFGUpData();
|
||||
}
|
||||
@@ -2118,9 +2137,22 @@ static int mFI_LineDepositOFF(u16* deposit, int ut_x) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Aus added NULL check
|
||||
#if VERSION >= VER_GAFU01_00
|
||||
extern int mFI_GetLineDeposit(u16* deposit, int ut_x) {
|
||||
int ret = FALSE;
|
||||
|
||||
if (deposit != NULL) {
|
||||
ret = ((*deposit) >> ut_x) & 1;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
#else
|
||||
extern int mFI_GetLineDeposit(u16* deposit, int ut_x) {
|
||||
return (deposit[0] >> ut_x) & 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
typedef int (*mFI_SET_DEPOSIT_PROC)(u16*, int);
|
||||
|
||||
@@ -2369,7 +2401,11 @@ extern int mFI_GetDigStatus(mActor_name_t* item, xyz_t wpos, int golden_shovel)
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (mCoBG_CheckSkySwing(wpos) == TRUE) {
|
||||
#if VERSION >= VER_GAFU01_00
|
||||
} else if (mCoBG_CheckAirSwing(wpos) == TRUE) {
|
||||
#else
|
||||
} else if (mCoBG_CheckAirSwing(wpos) == TRUE) {
|
||||
#endif
|
||||
status = mFI_DIGSTATUS_MISS;
|
||||
}
|
||||
}
|
||||
@@ -2417,9 +2453,13 @@ extern void mFI_ClearBeecomb(int bx, int bz) {
|
||||
static void mFI_SetFGStructureKeep(mActor_name_t* item_p, mActor_name_t replace_item, int destroy_item) {
|
||||
if (destroy_item == FALSE) {
|
||||
mPB_keep_item(*item_p);
|
||||
// Aus version cleans up any snowmen here
|
||||
#if VERSION >= VER_GAFU01_00
|
||||
mSN_ClearSnowman(item_p);
|
||||
#endif
|
||||
}
|
||||
|
||||
item_p[0] = replace_item;
|
||||
*item_p = replace_item;
|
||||
}
|
||||
|
||||
static mActor_name_t l_set_fg_table[3 * 3];
|
||||
@@ -3189,16 +3229,16 @@ static void mFI_SetShellBlock(mActor_name_t* fg_p, mCoBG_Collision_u* col_p, int
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: I think this is fakematch
|
||||
static void mFI_SetShellSandyBeachBlock(u8* can_set_ut_num, u8* shell_num_inblock) {
|
||||
int bz;
|
||||
int shell_num;
|
||||
int bx;
|
||||
int i;
|
||||
u8 bz;
|
||||
|
||||
for (i = 0; i < 7; i++) {
|
||||
if (can_set_ut_num[0] != 0) {
|
||||
shell_num = shell_num_inblock[0];
|
||||
|
||||
shell_num = *shell_num_inblock;
|
||||
if (shell_num > 0) {
|
||||
bx = l_sandy_beach_bx[i];
|
||||
bz = l_sandy_beach_bz[i];
|
||||
@@ -3355,19 +3395,23 @@ static int mFI_CheckBlockSetTreasure(int* block, int bx, int bz) {
|
||||
}
|
||||
|
||||
extern int mFI_SetTreasure(int* selected_bx, int* selected_bz, mActor_name_t item) {
|
||||
static int no_check_block_table[2 * 4] = {
|
||||
static int no_check_block_table[4][2] = {
|
||||
3, 1, /* train station */
|
||||
3, 2, /* player house */
|
||||
0, 0, /* wishing well/shrine (dynamic) */
|
||||
0, 0 /* lake (dynamic) */
|
||||
};
|
||||
|
||||
u8 depositable_num_block[FG_BLOCK_TOTAL_NUM];
|
||||
mFM_fg_c* fg_block;
|
||||
mFM_fg_c* fg_block_p;
|
||||
mCoBG_Collision_u* col_p;
|
||||
u8 depositable_num_block[FG_BLOCK_TOTAL_NUM];
|
||||
u8* depositable_num_p2;
|
||||
u8* depositable_num_p;
|
||||
u8 depositable_blocks;
|
||||
int selected_block;
|
||||
int i;
|
||||
int j;
|
||||
int res;
|
||||
|
||||
fg_block = Save_Get(fg[0]);
|
||||
@@ -3377,18 +3421,15 @@ extern int mFI_SetTreasure(int* selected_bx, int* selected_bz, mActor_name_t ite
|
||||
res = FALSE;
|
||||
|
||||
if (Save_Get(scene_no) == SCENE_FG) {
|
||||
int bz;
|
||||
|
||||
bzero(depositable_num_p, FG_BLOCK_TOTAL_NUM);
|
||||
mFI_BlockKind2BkNum(&no_check_block_table[4], &no_check_block_table[5], mRF_BLOCKKIND_SHRINE);
|
||||
mFI_BlockKind2BkNum(&no_check_block_table[6], &no_check_block_table[7], mRF_BLOCKKIND_POOL);
|
||||
mFI_BlockKind2BkNum(&no_check_block_table[2][0], &no_check_block_table[2][1], mRF_BLOCKKIND_SHRINE);
|
||||
mFI_BlockKind2BkNum(&no_check_block_table[3][0], &no_check_block_table[3][1], mRF_BLOCKKIND_POOL);
|
||||
|
||||
for (bz = 0; bz < FG_BLOCK_Z_NUM; bz++) {
|
||||
int bx;
|
||||
|
||||
for (bx = 0; bx < FG_BLOCK_X_NUM; bx++) {
|
||||
if (mFI_CheckBlockSetTreasure(no_check_block_table, bx + 1, bz + 1) == TRUE) {
|
||||
mCoBG_Collision_u* col_p = mFI_GetBkNum2ColTop(bx + 1, bz + 1);
|
||||
for (i = 0; i < FG_BLOCK_Z_NUM; i++) {
|
||||
for (j = 0; j < FG_BLOCK_X_NUM; j++) {
|
||||
if (mFI_CheckBlockSetTreasure((int*)no_check_block_table, j + 1, i + 1) == TRUE) {
|
||||
col_p = mFI_GetBkNum2ColTop(j + 1, i + 1);
|
||||
|
||||
depositable_num_p[0] = mMsm_GetDepositAbleNum(fg_block_p->items[0], col_p);
|
||||
|
||||
@@ -3403,10 +3444,6 @@ extern int mFI_SetTreasure(int* selected_bx, int* selected_bz, mActor_name_t ite
|
||||
}
|
||||
|
||||
if (depositable_blocks != 0) {
|
||||
u8* depositable_num_p; // removing this line fixes regalloc but causes regswaps
|
||||
int selected_block;
|
||||
int i;
|
||||
|
||||
depositable_num_p2 = depositable_num_block;
|
||||
selected_block = RANDOM(depositable_blocks);
|
||||
for (i = 0; i < FG_BLOCK_TOTAL_NUM; i++) {
|
||||
|
||||
+1367
-1494
File diff suppressed because it is too large
Load Diff
+331
-362
@@ -11,521 +11,490 @@
|
||||
#include "m_common_data.h"
|
||||
|
||||
static void mFR_delete_record(mFR_record_c* record) {
|
||||
mem_clear((u8*)record, sizeof(mFR_record_c), 0);
|
||||
mem_clear((u8*)record, sizeof(mFR_record_c), 0);
|
||||
}
|
||||
|
||||
static void mFR_delete_after_record(lbRTC_ymd_c* after) {
|
||||
int i;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < mFR_RECORD_NUM; i++) {
|
||||
mFR_record_c* record = Save_Get(fishRecord) + i;
|
||||
for (i = 0; i < mFR_RECORD_NUM; i++) {
|
||||
mFR_record_c* record = Save_Get(fishRecord) + i;
|
||||
|
||||
int equal = lbRTC_IsEqualDate(
|
||||
after->year, after->month, after->day,
|
||||
record->time.year, record->time.month, record->time.day
|
||||
);
|
||||
int equal = lbRTC_IsEqualDate(after->year, after->month, after->day, record->time.year, record->time.month,
|
||||
record->time.day);
|
||||
|
||||
if (equal == lbRTC_LESS) {
|
||||
mFR_delete_record(record);
|
||||
if (equal == lbRTC_LESS) {
|
||||
mFR_delete_record(record);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void mFR_delete_npc_record(lbRTC_ymd_c* date) {
|
||||
int i;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < mFR_RECORD_NUM; i++) {
|
||||
mFR_record_c* record = Save_Get(fishRecord) + i;
|
||||
|
||||
if (
|
||||
record->size != 0 &&
|
||||
(
|
||||
date == NULL ||
|
||||
lbRTC_IsEqualDate( date->year, date->month, date->day, record->time.year, record->time.month, record->time.day) != lbRTC_EQUAL
|
||||
) &&
|
||||
mPr_GetPrivateIdx(&record->pid) == -1
|
||||
) {
|
||||
mFR_delete_record(record);
|
||||
for (i = 0; i < mFR_RECORD_NUM; i++) {
|
||||
mFR_record_c* record = Save_Get(fishRecord) + i;
|
||||
|
||||
if (record->size != 0 &&
|
||||
(date == NULL || lbRTC_IsEqualDate(date->year, date->month, date->day, record->time.year,
|
||||
record->time.month, record->time.day) != lbRTC_EQUAL) &&
|
||||
mPr_GetPrivateIdx(&record->pid) == -1) {
|
||||
mFR_delete_record(record);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static mFR_record_c* mFR_get_record(lbRTC_ymd_c date) {
|
||||
int i;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < mFR_RECORD_NUM; i++) {
|
||||
mFR_record_c* record = Save_Get(fishRecord) + i;
|
||||
for (i = 0; i < mFR_RECORD_NUM; i++) {
|
||||
mFR_record_c* record = Save_Get(fishRecord) + i;
|
||||
|
||||
int equal = lbRTC_IsEqualDate(
|
||||
date.year, date.month, date.day,
|
||||
record->time.year, record->time.month, record->time.day
|
||||
);
|
||||
int equal =
|
||||
lbRTC_IsEqualDate(date.year, date.month, date.day, record->time.year, record->time.month, record->time.day);
|
||||
|
||||
if (equal == lbRTC_EQUAL) {
|
||||
return record;
|
||||
if (equal == lbRTC_EQUAL) {
|
||||
return record;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static mFR_record_c* mFR_get_free_record() {
|
||||
int i;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < mFR_RECORD_NUM; i++) {
|
||||
mFR_record_c* record = Save_Get(fishRecord) + i;
|
||||
for (i = 0; i < mFR_RECORD_NUM; i++) {
|
||||
mFR_record_c* record = Save_Get(fishRecord) + i;
|
||||
|
||||
if (record->size == 0) {
|
||||
return record;
|
||||
if (record->size == 0) {
|
||||
return record;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static mFR_record_c* mFR_recycle_record() {
|
||||
int i;
|
||||
mFR_record_c* record;
|
||||
mFR_record_c* recycle = Save_GetPointer(fishRecord[0]);
|
||||
int i;
|
||||
mFR_record_c* record;
|
||||
mFR_record_c* recycle = Save_GetPointer(fishRecord[0]);
|
||||
|
||||
for (i = 1; i < mFR_RECORD_NUM; i++) {
|
||||
int equal;
|
||||
|
||||
record = Save_Get(fishRecord) + i;
|
||||
equal = lbRTC_IsEqualDate(
|
||||
recycle->time.year, recycle->time.month, recycle->time.day,
|
||||
record->time.year, record->time.month, record->time.day
|
||||
);
|
||||
for (i = 1; i < mFR_RECORD_NUM; i++) {
|
||||
int equal;
|
||||
|
||||
if (equal == lbRTC_OVER) {
|
||||
recycle = record;
|
||||
record = Save_Get(fishRecord) + i;
|
||||
equal = lbRTC_IsEqualDate(recycle->time.year, recycle->time.month, recycle->time.day, record->time.year,
|
||||
record->time.month, record->time.day);
|
||||
|
||||
if (equal == lbRTC_OVER) {
|
||||
recycle = record;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mFR_delete_record(recycle);
|
||||
return recycle;
|
||||
mFR_delete_record(recycle);
|
||||
return recycle;
|
||||
}
|
||||
|
||||
static mFR_record_c* mFR_new_record(lbRTC_ymd_c date) {
|
||||
mFR_record_c* new_record;
|
||||
|
||||
mFR_delete_after_record(&date);
|
||||
mFR_delete_npc_record(&date);
|
||||
|
||||
new_record = mFR_get_free_record();
|
||||
if (new_record != NULL) {
|
||||
return new_record;
|
||||
}
|
||||
else {
|
||||
return mFR_recycle_record();
|
||||
}
|
||||
mFR_record_c* new_record;
|
||||
|
||||
mFR_delete_after_record(&date);
|
||||
mFR_delete_npc_record(&date);
|
||||
|
||||
new_record = mFR_get_free_record();
|
||||
if (new_record != NULL) {
|
||||
return new_record;
|
||||
} else {
|
||||
return mFR_recycle_record();
|
||||
}
|
||||
}
|
||||
|
||||
extern void mEv_fishRecord_set(PersonalID_c* pid, int size) {
|
||||
lbRTC_ymd_c date;
|
||||
lbRTC_time_c* rtc_time = Common_GetPointer(time.rtc_time);
|
||||
mFR_record_c* record;
|
||||
lbRTC_ymd_c date;
|
||||
lbRTC_time_c* rtc_time = Common_GetPointer(time.rtc_time);
|
||||
mFR_record_c* record;
|
||||
|
||||
mTM_set_renew_time(&date, rtc_time);
|
||||
record = mFR_get_record(date);
|
||||
mTM_set_renew_time(&date, rtc_time);
|
||||
record = mFR_get_record(date);
|
||||
|
||||
if (record == NULL) {
|
||||
record = mFR_new_record(date);
|
||||
}
|
||||
if (record == NULL) {
|
||||
record = mFR_new_record(date);
|
||||
}
|
||||
|
||||
mPr_CopyPersonalID(&record->pid, pid);
|
||||
record->size = size;
|
||||
lbRTC_TimeCopy(&record->time, rtc_time);
|
||||
mPr_CopyPersonalID(&record->pid, pid);
|
||||
record->size = size;
|
||||
lbRTC_TimeCopy(&record->time, rtc_time);
|
||||
}
|
||||
|
||||
extern int mFR_fish_rndsize(int fish_size) {
|
||||
f32 rng = fqrand();
|
||||
f32 rng = fqrand();
|
||||
|
||||
switch(fish_size) {
|
||||
case mFR_SIZE_LARGE:
|
||||
return (50.0f + 20.0f * rng * rng) / 2.54f;
|
||||
case mFR_SIZE_MEDIUM:
|
||||
return (30.0f + 20.0f * rng) / 2.54f;
|
||||
default: /* mFR_SIZE_SMALL */
|
||||
return (30.0f - 20.0f * rng * rng) / 2.54f;
|
||||
}
|
||||
switch (fish_size) {
|
||||
case mFR_SIZE_LARGE:
|
||||
return (50.0f + 20.0f * rng * rng) / 2.54f;
|
||||
case mFR_SIZE_MEDIUM:
|
||||
return (30.0f + 20.0f * rng) / 2.54f;
|
||||
default: /* mFR_SIZE_SMALL */
|
||||
return (30.0f - 20.0f * rng * rng) / 2.54f;
|
||||
}
|
||||
}
|
||||
|
||||
extern int mFR_make_NpcRecord(lbRTC_hour_t hour) {
|
||||
int rand;
|
||||
if (hour < 9) {
|
||||
return (int)mFR_fish_rndsize(mFR_SIZE_SMALL);
|
||||
}
|
||||
else if (hour < 15) {
|
||||
rand = RANDOM(2);
|
||||
return (int)mFR_fish_rndsize(rand); /* 50/50 mFR_SIZE_SMALL, mFR_SIZE_MEDIUM */
|
||||
}
|
||||
else {
|
||||
rand = RANDOM(3);
|
||||
return (int)mFR_fish_rndsize(rand); /* equal chance for all sizes */
|
||||
}
|
||||
int rand;
|
||||
if (hour < 9) {
|
||||
return (int)mFR_fish_rndsize(mFR_SIZE_SMALL);
|
||||
} else if (hour < 15) {
|
||||
rand = RANDOM(2);
|
||||
return (int)mFR_fish_rndsize(rand); /* 50/50 mFR_SIZE_SMALL, mFR_SIZE_MEDIUM */
|
||||
} else {
|
||||
rand = RANDOM(3);
|
||||
return (int)mFR_fish_rndsize(rand); /* equal chance for all sizes */
|
||||
}
|
||||
}
|
||||
|
||||
static int mEv_fishRecord_local(PersonalID_c* pid, int* record_size, lbRTC_time_c* record_set_time, int player_record_size) {
|
||||
static u8 l_name[] = { 0x98, 0xA6, 0x8F, 0xA1, 0x20 }; /* Untranslated JP, クニッチ */
|
||||
static int mEv_fishRecord_local(PersonalID_c* pid, int* record_size, lbRTC_time_c* record_set_time,
|
||||
int player_record_size) {
|
||||
static u8 l_name[] = { 0x98, 0xA6, 0x8F, 0xA1, 0x20 }; /* Untranslated JP, クニッチ */
|
||||
|
||||
u8 name[ANIMAL_NAME_LEN];
|
||||
mActor_name_t selected_npc;
|
||||
lbRTC_time_c l_record_time;
|
||||
|
||||
fqrand(); /* unused call to fqrand..? */
|
||||
lbRTC_TimeCopy(&l_record_time, record_set_time);
|
||||
u8 name[ANIMAL_NAME_LEN];
|
||||
mActor_name_t selected_npc;
|
||||
lbRTC_time_c l_record_time;
|
||||
|
||||
/* Adjust time to 5:50 PM */
|
||||
l_record_time.hour = 17;
|
||||
l_record_time.min = 50;
|
||||
l_record_time.sec = 0;
|
||||
fqrand(); /* unused call to fqrand..? */
|
||||
lbRTC_TimeCopy(&l_record_time, record_set_time);
|
||||
|
||||
*record_size = 0;
|
||||
/* Adjust time to 5:50 PM */
|
||||
l_record_time.hour = 17;
|
||||
l_record_time.min = 50;
|
||||
l_record_time.sec = 0;
|
||||
|
||||
/* Roll potential new record size for every 30 minutes between the last record set time and 5:50PM */
|
||||
while (lbRTC_IsOverTime(&l_record_time, record_set_time) == lbRTC_LESS) {
|
||||
/* Roll a potential new record size set by an NPC */
|
||||
int npc_record = mFR_make_NpcRecord(record_set_time->hour);
|
||||
*record_size = 0;
|
||||
|
||||
if (npc_record > *record_size) {
|
||||
*record_size = npc_record;
|
||||
/* Roll potential new record size for every 30 minutes between the last record set time and 5:50PM */
|
||||
while (lbRTC_IsOverTime(&l_record_time, record_set_time) == lbRTC_LESS) {
|
||||
/* Roll a potential new record size set by an NPC */
|
||||
int npc_record = mFR_make_NpcRecord(record_set_time->hour);
|
||||
|
||||
if (npc_record > *record_size) {
|
||||
*record_size = npc_record;
|
||||
}
|
||||
|
||||
lbRTC_Add_mm(record_set_time, 30); // add 30 minutes
|
||||
}
|
||||
|
||||
lbRTC_Add_mm(record_set_time, 30); // add 30 minutes
|
||||
}
|
||||
/* Adjust set time to 6:00PM */
|
||||
record_set_time->hour = 18;
|
||||
record_set_time->min = 0;
|
||||
record_set_time->sec = 0;
|
||||
|
||||
/* Adjust set time to 6:00PM */
|
||||
record_set_time->hour = 18;
|
||||
record_set_time->min = 0;
|
||||
record_set_time->sec = 0;
|
||||
if (*record_size <= player_record_size) {
|
||||
return FALSE;
|
||||
} else {
|
||||
mPr_ClearPersonalID(pid);
|
||||
if (mEvMN_GetJointEventRandomNpc(&selected_npc) == TRUE) {
|
||||
mNpc_GetNpcWorldNameTableNo(name, selected_npc);
|
||||
} else {
|
||||
mNpc_GetRandomAnimalName(name);
|
||||
}
|
||||
|
||||
if (*record_size <= player_record_size) {
|
||||
return FALSE;
|
||||
}
|
||||
else {
|
||||
mPr_ClearPersonalID(pid);
|
||||
if (mEvMN_GetJointEventRandomNpc(&selected_npc) == TRUE) {
|
||||
mNpc_GetNpcWorldNameTableNo(name, selected_npc);
|
||||
mem_copy(pid->player_name, name, ANIMAL_NAME_LEN);
|
||||
mLd_ClearLandName(pid->land_name);
|
||||
mem_copy(pid->land_name, l_name, sizeof(l_name));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
else {
|
||||
mNpc_GetRandomAnimalName(name);
|
||||
}
|
||||
|
||||
mem_copy(pid->player_name, name, ANIMAL_NAME_LEN);
|
||||
mLd_ClearLandName(pid->land_name);
|
||||
mem_copy(pid->land_name, l_name, sizeof(l_name));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
static void mEv_fishRecord_holder1(PersonalID_c* pid, int* size, mFR_record_c* record) {
|
||||
PersonalID_c record_id;
|
||||
int record_size;
|
||||
PersonalID_c record_id;
|
||||
int record_size;
|
||||
|
||||
|
||||
if (mEv_fishRecord_local(&record_id, &record_size, &record->time, record->size) == FALSE) {
|
||||
/* Player wins */
|
||||
mPr_CopyPersonalID(pid, &Save_GetPointer(fishRecord[0])->pid);
|
||||
*size = Save_GetPointer(fishRecord[0])->size;
|
||||
}
|
||||
else {
|
||||
/* NPC wins */
|
||||
record->size = record_size;
|
||||
mPr_CopyPersonalID(&record->pid, &record_id);
|
||||
*size = record_size;
|
||||
mPr_CopyPersonalID(pid, &record_id);
|
||||
}
|
||||
if (mEv_fishRecord_local(&record_id, &record_size, &record->time, record->size) == FALSE) {
|
||||
/* Player wins */
|
||||
mPr_CopyPersonalID(pid, &Save_GetPointer(fishRecord[0])->pid);
|
||||
*size = Save_GetPointer(fishRecord[0])->size;
|
||||
} else {
|
||||
/* NPC wins */
|
||||
record->size = record_size;
|
||||
mPr_CopyPersonalID(&record->pid, &record_id);
|
||||
*size = record_size;
|
||||
mPr_CopyPersonalID(pid, &record_id);
|
||||
}
|
||||
}
|
||||
|
||||
static void mEv_fishRecord_holder2(PersonalID_c* pid, int* size) {
|
||||
/* NPC only win */
|
||||
lbRTC_time_c time;
|
||||
/* NPC only win */
|
||||
lbRTC_time_c time;
|
||||
|
||||
lbRTC_TimeCopy(&time, Common_GetPointer(time.rtc_time));
|
||||
time.hour = 6;
|
||||
time.min = 0;
|
||||
time.sec = 0;
|
||||
lbRTC_TimeCopy(&time, Common_GetPointer(time.rtc_time));
|
||||
time.hour = 6;
|
||||
time.min = 0;
|
||||
time.sec = 0;
|
||||
|
||||
mEv_fishRecord_local(pid, size, &time, 0);
|
||||
mEv_fishRecord_local(pid, size, &time, 0);
|
||||
}
|
||||
|
||||
extern void mEv_fishRecord_holder(PersonalID_c* winning_pid, u32* winning_size, lbRTC_ymd_c* contest_date) {
|
||||
int i;
|
||||
extern void mEv_fishRecord_holder(PersonalID_c* winning_pid, u32* winning_size, const lbRTC_ymd_c* contest_date) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < mFR_RECORD_NUM; i++) {
|
||||
mFR_record_c* record = Save_Get(fishRecord) + i;
|
||||
for (i = 0; i < mFR_RECORD_NUM; i++) {
|
||||
mFR_record_c* record = Save_Get(fishRecord) + i;
|
||||
|
||||
if (
|
||||
record->time.year == contest_date->year &&
|
||||
record->time.month == contest_date->month &&
|
||||
record->time.day == contest_date->day
|
||||
) {
|
||||
mEv_fishRecord_holder1(winning_pid, (int*)winning_size, record); /* found an existing record for this fishing contest */
|
||||
return;
|
||||
if (record->time.year == contest_date->year && record->time.month == contest_date->month &&
|
||||
record->time.day == contest_date->day) {
|
||||
mEv_fishRecord_holder1(winning_pid, (int*)winning_size,
|
||||
record); /* found an existing record for this fishing contest */
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* No record found for this fishing contest so generate a fake one */
|
||||
mEv_fishRecord_holder2(winning_pid, (int*)winning_size);
|
||||
/* No record found for this fishing contest so generate a fake one */
|
||||
mEv_fishRecord_holder2(winning_pid, (int*)winning_size);
|
||||
}
|
||||
|
||||
static lbRTC_ymd_c* mEv_fishday_day(lbRTC_year_t year, lbRTC_month_t month, int week) {
|
||||
static lbRTC_ymd_c ymd;
|
||||
static lbRTC_ymd_c ymd;
|
||||
|
||||
int weekday;
|
||||
int day;
|
||||
int weekday;
|
||||
int day;
|
||||
|
||||
weekday = lbRTC_Week(year, month, lbRTC_WEEK);
|
||||
ymd.year = year;
|
||||
ymd.month = month;
|
||||
day = (week * lbRTC_WEEK) + lbRTC_WEEK - weekday;
|
||||
weekday = lbRTC_Week(year, month, lbRTC_WEEK);
|
||||
ymd.year = year;
|
||||
ymd.month = month;
|
||||
day = (week * lbRTC_WEEK) + lbRTC_WEEK - weekday;
|
||||
|
||||
if (day > lbRTC_GetDaysByMonth(ymd.year, ymd.month)) {
|
||||
return NULL;
|
||||
}
|
||||
else {
|
||||
ymd.day = day;
|
||||
return &ymd;
|
||||
}
|
||||
if (day > lbRTC_GetDaysByMonth(ymd.year, ymd.month)) {
|
||||
return NULL;
|
||||
} else {
|
||||
ymd.day = day;
|
||||
return &ymd;
|
||||
}
|
||||
}
|
||||
|
||||
extern int mEv_fishday(lbRTC_ymd_c* dates, lbRTC_time_c* time) {
|
||||
lbRTC_time_c l_time;
|
||||
lbRTC_ymd_c ymd;
|
||||
int free_dates;
|
||||
int i;
|
||||
lbRTC_ymd_c* fishing_day_ymd_p;
|
||||
lbRTC_time_c l_time;
|
||||
lbRTC_ymd_c ymd;
|
||||
int free_dates;
|
||||
int i;
|
||||
lbRTC_ymd_c* fishing_day_ymd_p;
|
||||
|
||||
lbRTC_TimeCopy(&l_time, time);
|
||||
lbRTC_Add_hh(&l_time, 6);
|
||||
ymd.year = l_time.year;
|
||||
ymd.month = l_time.month;
|
||||
ymd.day = l_time.day;
|
||||
free_dates = 4;
|
||||
lbRTC_TimeCopy(&l_time, time);
|
||||
lbRTC_Add_hh(&l_time, 6);
|
||||
ymd.year = l_time.year;
|
||||
ymd.month = l_time.month;
|
||||
ymd.day = l_time.day;
|
||||
free_dates = 4;
|
||||
|
||||
if (ymd.month >= lbRTC_NOVEMBER) {
|
||||
for (i = 4; i >= 0; i--) {
|
||||
fishing_day_ymd_p = mEv_fishday_day(ymd.year, lbRTC_NOVEMBER, i);
|
||||
if (ymd.month >= lbRTC_NOVEMBER) {
|
||||
for (i = 4; i >= 0; i--) {
|
||||
fishing_day_ymd_p = mEv_fishday_day(ymd.year, lbRTC_NOVEMBER, i);
|
||||
|
||||
if (fishing_day_ymd_p != NULL && (ymd.month > lbRTC_NOVEMBER || ymd.day > fishing_day_ymd_p->day)) {
|
||||
lbRTC_ymd_c* week_date = dates + free_dates;
|
||||
if (fishing_day_ymd_p != NULL && (ymd.month > lbRTC_NOVEMBER || ymd.day > fishing_day_ymd_p->day)) {
|
||||
lbRTC_ymd_c* week_date = dates + free_dates;
|
||||
|
||||
week_date->year = fishing_day_ymd_p->year;
|
||||
week_date->month = fishing_day_ymd_p->month;
|
||||
week_date->day = fishing_day_ymd_p->day;
|
||||
week_date->year = fishing_day_ymd_p->year;
|
||||
week_date->month = fishing_day_ymd_p->month;
|
||||
week_date->day = fishing_day_ymd_p->day;
|
||||
|
||||
if (free_dates <= 0) {
|
||||
return TRUE;
|
||||
if (free_dates <= 0) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
free_dates--;
|
||||
}
|
||||
}
|
||||
|
||||
free_dates--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ymd.month >= lbRTC_JUNE) {
|
||||
for (i = 4; i >= 0; i--) {
|
||||
fishing_day_ymd_p = mEv_fishday_day(ymd.year, lbRTC_JUNE, i);
|
||||
if (ymd.month >= lbRTC_JUNE) {
|
||||
for (i = 4; i >= 0; i--) {
|
||||
fishing_day_ymd_p = mEv_fishday_day(ymd.year, lbRTC_JUNE, i);
|
||||
|
||||
if (fishing_day_ymd_p != NULL && (ymd.month > lbRTC_JUNE || ymd.day > fishing_day_ymd_p->day)) {
|
||||
lbRTC_ymd_c* week_date = dates + free_dates;
|
||||
if (fishing_day_ymd_p != NULL && (ymd.month > lbRTC_JUNE || ymd.day > fishing_day_ymd_p->day)) {
|
||||
lbRTC_ymd_c* week_date = dates + free_dates;
|
||||
|
||||
week_date->year = fishing_day_ymd_p->year;
|
||||
week_date->month = fishing_day_ymd_p->month;
|
||||
week_date->day = fishing_day_ymd_p->day;
|
||||
week_date->year = fishing_day_ymd_p->year;
|
||||
week_date->month = fishing_day_ymd_p->month;
|
||||
week_date->day = fishing_day_ymd_p->day;
|
||||
|
||||
if (free_dates <= 0) {
|
||||
return TRUE;
|
||||
if (free_dates <= 0) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
free_dates--;
|
||||
}
|
||||
}
|
||||
|
||||
free_dates--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Go through previous year */
|
||||
lbRTC_Sub_YY(&l_time, 1);
|
||||
ymd.year = l_time.year;
|
||||
/* Go through previous year */
|
||||
lbRTC_Sub_YY(&l_time, 1);
|
||||
ymd.year = l_time.year;
|
||||
|
||||
for (i = 4; i >= 0; i--) {
|
||||
fishing_day_ymd_p = mEv_fishday_day(ymd.year, lbRTC_NOVEMBER, i);
|
||||
for (i = 4; i >= 0; i--) {
|
||||
fishing_day_ymd_p = mEv_fishday_day(ymd.year, lbRTC_NOVEMBER, i);
|
||||
|
||||
if (fishing_day_ymd_p != NULL) {
|
||||
lbRTC_ymd_c* week_date = dates + free_dates;
|
||||
if (fishing_day_ymd_p != NULL) {
|
||||
lbRTC_ymd_c* week_date = dates + free_dates;
|
||||
|
||||
week_date->year = fishing_day_ymd_p->year;
|
||||
week_date->month = fishing_day_ymd_p->month;
|
||||
week_date->day = fishing_day_ymd_p->day;
|
||||
week_date->year = fishing_day_ymd_p->year;
|
||||
week_date->month = fishing_day_ymd_p->month;
|
||||
week_date->day = fishing_day_ymd_p->day;
|
||||
|
||||
if (free_dates <= 0) {
|
||||
return TRUE;
|
||||
}
|
||||
if (free_dates <= 0) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
free_dates--;
|
||||
free_dates--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 4; i >= 0; i--) {
|
||||
fishing_day_ymd_p = mEv_fishday_day(ymd.year, lbRTC_JUNE, i);
|
||||
for (i = 4; i >= 0; i--) {
|
||||
fishing_day_ymd_p = mEv_fishday_day(ymd.year, lbRTC_JUNE, i);
|
||||
|
||||
if (fishing_day_ymd_p != NULL) {
|
||||
lbRTC_ymd_c* week_date = dates + free_dates;
|
||||
if (fishing_day_ymd_p != NULL) {
|
||||
lbRTC_ymd_c* week_date = dates + free_dates;
|
||||
|
||||
week_date->year = fishing_day_ymd_p->year;
|
||||
week_date->month = fishing_day_ymd_p->month;
|
||||
week_date->day = fishing_day_ymd_p->day;
|
||||
week_date->year = fishing_day_ymd_p->year;
|
||||
week_date->month = fishing_day_ymd_p->month;
|
||||
week_date->day = fishing_day_ymd_p->day;
|
||||
|
||||
if (free_dates <= 0) {
|
||||
return TRUE;
|
||||
}
|
||||
if (free_dates <= 0) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
free_dates--;
|
||||
free_dates--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void mFR_swap_record(mFR_record_c* r0, mFR_record_c* r1) {
|
||||
mFR_record_c temp;
|
||||
mFR_record_c temp;
|
||||
|
||||
bcopy(r0, &temp, sizeof(mFR_record_c));
|
||||
bcopy(r1, r0, sizeof(mFR_record_c));
|
||||
bcopy(&temp, r1, sizeof(mFR_record_c));
|
||||
bcopy(r0, &temp, sizeof(mFR_record_c));
|
||||
bcopy(r1, r0, sizeof(mFR_record_c));
|
||||
bcopy(&temp, r1, sizeof(mFR_record_c));
|
||||
}
|
||||
|
||||
static void mFR_sort_record() {
|
||||
int i;
|
||||
int j;
|
||||
mFR_record_c* records = Save_Get(fishRecord);
|
||||
int i;
|
||||
int j;
|
||||
mFR_record_c* records = Save_Get(fishRecord);
|
||||
|
||||
for (i = 0; i < mFR_RECORD_NUM - 1; i++) {
|
||||
for (j = i + 1; j < mFR_RECORD_NUM; j++) {
|
||||
if (
|
||||
records[j].size != 0 &&
|
||||
(records[j].size == 0 || lbRTC_IsEqualDate(
|
||||
records[i].time.year, records[i].time.month, records[i].time.day,
|
||||
records[j].time.year, records[j].time.month, records[j].time.day
|
||||
) == lbRTC_OVER)
|
||||
) {
|
||||
mFR_swap_record(&records[i], &records[j]);
|
||||
}
|
||||
for (i = 0; i < mFR_RECORD_NUM - 1; i++) {
|
||||
for (j = i + 1; j < mFR_RECORD_NUM; j++) {
|
||||
if (records[j].size != 0 &&
|
||||
(records[j].size == 0 ||
|
||||
lbRTC_IsEqualDate(records[i].time.year, records[i].time.month, records[i].time.day,
|
||||
records[j].time.year, records[j].time.month, records[j].time.day) == lbRTC_OVER)) {
|
||||
mFR_swap_record(&records[i], &records[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int mFR_Fishmail_send_post(PersonalID_c* pid, Mail_c* mail) {
|
||||
int arrange_idx = mHS_get_arrange_idx(mPr_GetPrivateIdx(pid)) & 3;
|
||||
int free_mail_idx = mMl_chk_mail_free_space(Save_Get(homes[arrange_idx]).mailbox, HOME_MAILBOX_SIZE);
|
||||
int arrange_idx = mHS_get_arrange_idx(mPr_GetPrivateIdx(pid)) & 3;
|
||||
int free_mail_idx = mMl_chk_mail_free_space(Save_Get(homes[arrange_idx]).mailbox, HOME_MAILBOX_SIZE);
|
||||
|
||||
if (free_mail_idx >= 0) {
|
||||
mMl_copy_mail(Save_Get(homes[arrange_idx]).mailbox + free_mail_idx, mail);
|
||||
return TRUE;
|
||||
}
|
||||
if (free_mail_idx >= 0) {
|
||||
mMl_copy_mail(Save_Get(homes[arrange_idx]).mailbox + free_mail_idx, mail);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static int mFR_Fishmail_send_postoffice(PersonalID_c* pid, Mail_c* mail) {
|
||||
if (mPO_get_keep_mail_sum() < mPO_MAIL_STORAGE_SIZE) {
|
||||
mPO_receipt_proc(mail, mPO_SENDTYPE_MAIL);
|
||||
return TRUE;
|
||||
}
|
||||
if (mPO_get_keep_mail_sum() < mPO_MAIL_STORAGE_SIZE) {
|
||||
mPO_receipt_proc(mail, mPO_SENDTYPE_MAIL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void mFR_GetFishPresentMail(mFR_record_c* record, Mail_c* mail) {
|
||||
mActor_name_t present;
|
||||
u8 present_name[mIN_ITEM_NAME_LEN];
|
||||
int header_back_start;
|
||||
mActor_name_t present;
|
||||
u8 present_name[mIN_ITEM_NAME_LEN];
|
||||
int header_back_start;
|
||||
|
||||
mMl_clear_mail(mail);
|
||||
present = mSP_SelectFishginPresent(mPr_GetPrivateIdx(&record->pid));
|
||||
mIN_copy_name_str(present_name, present);
|
||||
mHandbill_Set_free_str(mHandbill_FREE_STR0, present_name, mIN_ITEM_NAME_LEN);
|
||||
mHandbill_Load_HandbillFromRom(
|
||||
mail->content.header, &header_back_start,
|
||||
mail->content.footer,
|
||||
mail->content.body,
|
||||
0x23E + (((record->time.day - 1) / 7) & 3)
|
||||
);
|
||||
mMl_clear_mail(mail);
|
||||
present = mSP_SelectFishginPresent(mPr_GetPrivateIdx(&record->pid));
|
||||
mIN_copy_name_str(present_name, present);
|
||||
mHandbill_Set_free_str(mHandbill_FREE_STR0, present_name, mIN_ITEM_NAME_LEN);
|
||||
mHandbill_Load_HandbillFromRom(mail->content.header, &header_back_start, mail->content.footer, mail->content.body,
|
||||
0x23E + (((record->time.day - 1) / 7) & 3));
|
||||
|
||||
mail->content.header_back_start = header_back_start;
|
||||
mail->content.font = mMl_FONT_RECV;
|
||||
mail->content.mail_type = mMl_TYPE_FISHING_CONTENST;
|
||||
mail->present = present;
|
||||
mail->content.paper_type = 15; // deep sea paper
|
||||
mPr_CopyPersonalID(&mail->header.recipient.personalID, &record->pid);
|
||||
mail->header.recipient.type = mMl_NAME_TYPE_PLAYER;
|
||||
mail->content.header_back_start = header_back_start;
|
||||
mail->content.font = mMl_FONT_RECV;
|
||||
mail->content.mail_type = mMl_TYPE_FISHING_CONTENST;
|
||||
mail->present = present;
|
||||
mail->content.paper_type = 15; // deep sea paper
|
||||
mPr_CopyPersonalID(&mail->header.recipient.personalID, &record->pid);
|
||||
mail->header.recipient.type = mMl_NAME_TYPE_PLAYER;
|
||||
}
|
||||
|
||||
static void mFR_Fishmail_send() {
|
||||
int i;
|
||||
mFR_record_c* record;
|
||||
lbRTC_time_c* rtc_time = Common_GetPointer(time.rtc_time);
|
||||
Mail_c* mail;
|
||||
int i;
|
||||
mFR_record_c* record;
|
||||
lbRTC_time_c* rtc_time = Common_GetPointer(time.rtc_time);
|
||||
Mail_c* mail;
|
||||
|
||||
mail = (Mail_c*)zelda_malloc(sizeof(Mail_c));
|
||||
mail = (Mail_c*)zelda_malloc(sizeof(Mail_c));
|
||||
|
||||
if (mail != NULL) {
|
||||
for (i = 0; i < mFR_RECORD_NUM; i++) {
|
||||
record = Save_Get(fishRecord) + i;
|
||||
if (mail != NULL) {
|
||||
for (i = 0; i < mFR_RECORD_NUM; i++) {
|
||||
record = Save_Get(fishRecord) + i;
|
||||
|
||||
if (
|
||||
record->size > 0 && /* used record */
|
||||
mPr_GetPrivateIdx(&record->pid) != -1 && /* record holder isn't an NPC or from out of town */
|
||||
lbRTC_IsOverTime(&record->time, rtc_time) == lbRTC_OVER /* record happened in the past */
|
||||
) {
|
||||
mFR_GetFishPresentMail(record, mail);
|
||||
|
||||
/* Try sending the mail to both the recipient's mailbox and the post office */
|
||||
if (mFR_Fishmail_send_post(&record->pid, mail) != FALSE) {
|
||||
mFR_delete_record(record);
|
||||
if (record->size > 0 && /* used record */
|
||||
mPr_GetPrivateIdx(&record->pid) != -1 && /* record holder isn't an NPC or from out of town */
|
||||
lbRTC_IsOverTime(&record->time, rtc_time) == lbRTC_OVER /* record happened in the past */
|
||||
) {
|
||||
mFR_GetFishPresentMail(record, mail);
|
||||
|
||||
/* Try sending the mail to both the recipient's mailbox and the post office */
|
||||
if (mFR_Fishmail_send_post(&record->pid, mail) != FALSE) {
|
||||
mFR_delete_record(record);
|
||||
} else if (mFR_Fishmail_send_postoffice(&record->pid, mail) != FALSE) {
|
||||
mFR_delete_record(record);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (mFR_Fishmail_send_postoffice(&record->pid, mail) != FALSE) {
|
||||
mFR_delete_record(record);
|
||||
}
|
||||
}
|
||||
|
||||
zelda_free(mail);
|
||||
}
|
||||
|
||||
zelda_free(mail);
|
||||
}
|
||||
}
|
||||
|
||||
static void mFR_fishRecord_last_holder() {
|
||||
mFR_record_c* record;
|
||||
int i;
|
||||
lbRTC_time_c* rtc_time = Common_GetPointer(time.rtc_time);
|
||||
PersonalID_c record_holder;
|
||||
int record_size;
|
||||
mFR_record_c* record;
|
||||
int i;
|
||||
lbRTC_time_c* rtc_time = Common_GetPointer(time.rtc_time);
|
||||
PersonalID_c record_holder;
|
||||
int record_size;
|
||||
|
||||
for (i = 0; i < mFR_RECORD_NUM; i++) {
|
||||
record = Save_Get(fishRecord) + i;
|
||||
for (i = 0; i < mFR_RECORD_NUM; i++) {
|
||||
record = Save_Get(fishRecord) + i;
|
||||
|
||||
if (
|
||||
record->size > 0 &&
|
||||
lbRTC_IsOverTime(&record->time, rtc_time) == lbRTC_OVER
|
||||
) {
|
||||
int new_record = mEv_fishRecord_local(&record_holder, &record_size, &record->time, record->size);
|
||||
if (record->size > 0 && lbRTC_IsOverTime(&record->time, rtc_time) == lbRTC_OVER) {
|
||||
int new_record = mEv_fishRecord_local(&record_holder, &record_size, &record->time, record->size);
|
||||
|
||||
if (new_record) {
|
||||
record->size = record_size;
|
||||
mPr_CopyPersonalID(&record->pid, &record_holder);
|
||||
}
|
||||
if (new_record) {
|
||||
record->size = record_size;
|
||||
mPr_CopyPersonalID(&record->pid, &record_holder);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extern void mFR_fishmail() {
|
||||
lbRTC_ymd_c now;
|
||||
lbRTC_ymd_c now;
|
||||
|
||||
mTM_set_renew_time(&now, Common_GetPointer(time.rtc_time));
|
||||
mFR_delete_after_record(&now);
|
||||
mFR_fishRecord_last_holder();
|
||||
mFR_delete_npc_record(&now);
|
||||
mFR_sort_record();
|
||||
mFR_Fishmail_send();
|
||||
mTM_set_renew_time(&now, Common_GetPointer(time.rtc_time));
|
||||
mFR_delete_after_record(&now);
|
||||
mFR_fishRecord_last_holder();
|
||||
mFR_delete_npc_record(&now);
|
||||
mFR_sort_record();
|
||||
mFR_Fishmail_send();
|
||||
}
|
||||
|
||||
+3
-6
@@ -60,14 +60,13 @@ static int mMsg_CutLeftSpace(u8* str, int str_len) {
|
||||
return str_len - i;
|
||||
}
|
||||
|
||||
static u8 mFont_suji_data[] = "0123456789";
|
||||
static u8 mFont_suji_data[10] = "0123456789";
|
||||
|
||||
static int mFont_suji_check(u8 c) {
|
||||
u8* suji = mFont_suji_data;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 10; i++) {
|
||||
if (c == suji[i]) {
|
||||
if (c == mFont_suji_data[i]) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
@@ -201,13 +200,11 @@ extern u8 mFont_small_to_capital(u8 small) {
|
||||
u8* t = (u8*)tbl;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 56; i++) {
|
||||
for (i = 0; i < 56; i++, t += 2) {
|
||||
if (t[0] == small) {
|
||||
res = t[1];
|
||||
break;
|
||||
}
|
||||
|
||||
t += 2;
|
||||
}
|
||||
|
||||
return res;
|
||||
|
||||
@@ -126,12 +126,13 @@ static void mHD_hand_position_move(Submenu* submenu) {
|
||||
dY = pos[1] - hand_ovl->info.pos[1];
|
||||
|
||||
if (fabsf(dX) > 0.01f || fabsf(dY) > 0.01f) {
|
||||
f32 dist = sqrtf(dX * dX + dY * dY);
|
||||
f32 dist2 = dist;
|
||||
f32 rate_speed = sqrtf(1.0f - rate);
|
||||
s16 p0 = (GETREG(UREG, 19));
|
||||
s16 p1 = (GETREG(UREG, 20));
|
||||
f32 calc = add_calc(&dist2, 0.0f, 1.0f - rate_speed, (12.0f + p0 * 0.1f) * 0.5f, (1.0f + p1 * 0.1f) * 0.5f);
|
||||
f32 dist;
|
||||
f32 dist2;
|
||||
f32 calc;
|
||||
|
||||
dist = dist2 = sqrtf(SQ(dX) + SQ(dY));
|
||||
dist = dist2; // this second set is necessary for Aus version, seems sus
|
||||
calc = add_calc(&dist2, 0.0f, CALC_EASE(rate), (12.0f + GETREG(UREG, 19) * 0.1f) * 0.5f, (1.0f + GETREG(UREG, 20) * 0.1f) * 0.5f);
|
||||
|
||||
if (fabsf(calc) < 0.1f) {
|
||||
if (hand_ovl->info.move_flag == mHD_MOVE_SWITCH_LEFT) {
|
||||
|
||||
+17
-21
@@ -94,21 +94,19 @@ extern void mHandbill_Set_free_str_art(int str_num, u8* str, int str_len, int ar
|
||||
}
|
||||
|
||||
static void mHandbill_CopyString(u8* dst, u8* src, int len) {
|
||||
for (len; len > 0; len--) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
*dst++ = *src++;
|
||||
}
|
||||
}
|
||||
|
||||
extern int mHandbill_MoveDataCut(u8* data, int buf_size, int dst_idx, int src_idx, int data_len, int fill_type) {
|
||||
int new_len = data_len;
|
||||
int i;
|
||||
|
||||
if (dst_idx < src_idx) {
|
||||
u8* dst = data + dst_idx;
|
||||
u8* src = data + src_idx;
|
||||
|
||||
for (i = src_idx; i < data_len; i++) {
|
||||
data[dst_idx] = data[src_idx++];
|
||||
for (src_idx; src_idx < data_len; src_idx++) {
|
||||
data[dst_idx] = data[src_idx];
|
||||
dst_idx++;
|
||||
}
|
||||
|
||||
@@ -129,6 +127,7 @@ extern int mHandbill_MoveDataCut(u8* data, int buf_size, int dst_idx, int src_id
|
||||
}
|
||||
} else if (dst_idx > src_idx) {
|
||||
int move_size = data_len - src_idx;
|
||||
int i;
|
||||
u8* dst;
|
||||
u8* src;
|
||||
|
||||
@@ -531,10 +530,10 @@ static void mHandbill_Load_SuperStringFromRom(u8* buf, int buf_size, int* header
|
||||
u32 aligned_addr = ALIGN_PREV(super_address, 32); // align to 32 bytes for ARAM DMA
|
||||
u32 data_ofs = super_address - aligned_addr; // calculate offset for desired data
|
||||
u32 size = ALIGN_NEXT(data_ofs + super_size, 32);
|
||||
int i;
|
||||
int move_size;
|
||||
u8* dst;
|
||||
u8* src;
|
||||
int i;
|
||||
|
||||
bzero(buff, 90);
|
||||
_JW_GetResourceAram(aligned_addr, buff, size);
|
||||
@@ -572,18 +571,20 @@ static void mHandbill_Load_PsStringFromRom(u8* buf, int buf_size, int ps_no) {
|
||||
u32 aligned_addr = ALIGN_PREV(ps_address, 32); // align to 32 bytes for ARAM DMA
|
||||
u32 data_ofs = ps_address - aligned_addr; // calculate offset for desired data
|
||||
u32 size = ALIGN_NEXT(data_ofs + ps_size, 32);
|
||||
int sz;
|
||||
int i;
|
||||
int sz;
|
||||
u8* dst;
|
||||
u8* src;
|
||||
|
||||
_JW_GetResourceAram(aligned_addr, buff, size);
|
||||
|
||||
/* Move desired data to output buffer */
|
||||
sz = (int)ps_size < buf_size ? ps_size : buf_size;
|
||||
dst = buf;
|
||||
src = buff + data_ofs;
|
||||
for (i = 0; i < sz; i++) {
|
||||
*dst = buff[data_ofs + i];
|
||||
dst++;
|
||||
// *dst = src[data_ofs + i];
|
||||
*dst++ = *src++;
|
||||
}
|
||||
|
||||
/* Initialize remaining buffer to spaces */
|
||||
@@ -622,8 +623,8 @@ static void mHandbill_Load_MailFromRom(u8* buf, int mail_no) {
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
u8* src = &mHandbill_mail_buff[data_ofs];
|
||||
u8* dst = buf;
|
||||
u8* src = &mHandbill_mail_buff[data_ofs];
|
||||
int sz = mHandbill_BODY_LEN;
|
||||
|
||||
if (mail_size < mHandbill_BODY_LEN) {
|
||||
@@ -726,20 +727,15 @@ static int mHandbillzDMA_body_load(mHandbillzDMA_c* dma_info) {
|
||||
_JW_GetResourceAram(aligned_addr, dma_info->ram_buf, size);
|
||||
|
||||
if (data_ofs != 0) {
|
||||
int i;
|
||||
const int size = dma_info->dma_size;
|
||||
u8* src;
|
||||
u8* dst;
|
||||
int size;
|
||||
int i;
|
||||
|
||||
dst = dma_info->ram_buf;
|
||||
src = dst + data_ofs;
|
||||
size = dma_info->dma_size;
|
||||
|
||||
for (i = 0; i < size; i++) {
|
||||
u8 b = *src;
|
||||
src++;
|
||||
*dst = b;
|
||||
dst++;
|
||||
for (i = 0; i < size; i++, dst++, src++) {
|
||||
*dst = *src;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-2
@@ -482,8 +482,7 @@ extern void mHm_CheckRehouseOrder() {
|
||||
}
|
||||
|
||||
for (i = 0; i < PLAYER_NUM; i++) {
|
||||
u32* state_flags = Save_GetPointer(private_data[i].state_flags);
|
||||
*state_flags &= (~0x200); /* TODO: these need an enum/defines */
|
||||
Save_Get(private_data[i].state_flags) &= (~0x200); /* TODO: these need an enum/defines */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+206
-205
@@ -20,10 +20,9 @@
|
||||
#define mHsRm_MONEY_BAD_PTS 10
|
||||
#define mHsRm_GOODS_BAD_PTS 5
|
||||
|
||||
|
||||
typedef struct huusui_room_ftr_info_s {
|
||||
u8 huusui_type;
|
||||
u8 has_face;
|
||||
u8 huusui_type;
|
||||
u8 has_face;
|
||||
} mHsRm_ftr_info_c;
|
||||
|
||||
/* table of feng shui data for every item, clearly copy-pasted... should be mHsRm_ftr_info */
|
||||
@@ -33,277 +32,279 @@ static mHsRm_ftr_info_c mMkRm_ftr_info[FTR_NUM] = {
|
||||
|
||||
/* maximum unit position for each main floor size */
|
||||
static int mHsRm_unit_max[mHm_HOMESIZE_NUM - 1] = {
|
||||
mHsRm_UNIT_MAX_S, /* mHm_HOMESIZE_SMALL */
|
||||
mHsRm_UNIT_MAX_M, /* mHm_HOMESIZE_MEDIUM */
|
||||
mHsRm_UNIT_MAX_L, /* mHm_HOMESIZE_LARGE */
|
||||
mHsRm_UNIT_MAX_L /* mHm_HOMESIZE_UPPER */
|
||||
mHsRm_UNIT_MAX_S, /* mHm_HOMESIZE_SMALL */
|
||||
mHsRm_UNIT_MAX_M, /* mHm_HOMESIZE_MEDIUM */
|
||||
mHsRm_UNIT_MAX_L, /* mHm_HOMESIZE_LARGE */
|
||||
mHsRm_UNIT_MAX_L, /* mHm_HOMESIZE_UPPER */
|
||||
};
|
||||
|
||||
/* number of units taken up by each furniture size */
|
||||
static int mHsRm_unit_value[mRmTp_FTRSIZE_NUM] = {
|
||||
1, /* mRmTp_FTRSIZE_1x1 */
|
||||
2, /* mRmTp_FTRSIZE_1x2 */
|
||||
4 /* mRmTp_FTRSIZE_2x2 */
|
||||
1, /* mRmTp_FTRSIZE_1x1 */
|
||||
2, /* mRmTp_FTRSIZE_1x2 */
|
||||
4, /* mRmTp_FTRSIZE_2x2 */
|
||||
};
|
||||
|
||||
/* table indices below are [directions][points] */
|
||||
|
||||
#define mHsRm_WALL_NON (0) /* No wall */
|
||||
#define mHsRm_WALL_STH (1 << mHsRm_DIRECTION_SOUTH) /* South wall */
|
||||
#define mHsRm_WALL_EST (1 << mHsRm_DIRECTION_EAST) /* East wall */
|
||||
#define mHsRm_WALL_NTH (1 << mHsRm_DIRECTION_NORTH) /* North wall */
|
||||
#define mHsRm_WALL_WST (1 << mHsRm_DIRECTION_WEST) /* West wall */
|
||||
#define mHsRm_WALL_ALL \
|
||||
(mHsRm_WALL_STH | mHsRm_WALL_EST | mHsRm_WALL_NTH | mHsRm_WALL_WST) /* any wall */
|
||||
#define mHsRm_WALL_NON (0) /* No wall */
|
||||
#define mHsRm_WALL_STH (1 << mHsRm_DIRECTION_SOUTH) /* South wall */
|
||||
#define mHsRm_WALL_EST (1 << mHsRm_DIRECTION_EAST) /* East wall */
|
||||
#define mHsRm_WALL_NTH (1 << mHsRm_DIRECTION_NORTH) /* North wall */
|
||||
#define mHsRm_WALL_WST (1 << mHsRm_DIRECTION_WEST) /* West wall */
|
||||
#define mHsRm_WALL_ALL (mHsRm_WALL_STH | mHsRm_WALL_EST | mHsRm_WALL_NTH | mHsRm_WALL_WST) /* any wall */
|
||||
|
||||
/* money power info table */
|
||||
static const int money_power_tbl[mHsRm_HUUSUI_NUM][2] = {
|
||||
{ mHsRm_WALL_NON, 0 }, /* mHsRm_HUUSUI_NONE */
|
||||
{ mHsRm_WALL_WST, 4 }, /* mHsRm_HUUSUI_YELLOW */
|
||||
{ mHsRm_WALL_NON, 0 }, /* mHsRm_HUUSUI_RED */
|
||||
{ mHsRm_WALL_NTH, 2 }, /* mHsRm_HUUSUI_ORANGE */
|
||||
{ mHsRm_WALL_STH, 2 }, /* mHsRm_HUUSUI_GREEN */
|
||||
{ mHsRm_WALL_ALL, 4 } /* mHsRm_HUUSUI_LUCKY */
|
||||
{ mHsRm_WALL_NON, 0 }, /* mHsRm_HUUSUI_NONE */
|
||||
{ mHsRm_WALL_WST, 4 }, /* mHsRm_HUUSUI_YELLOW */
|
||||
{ mHsRm_WALL_NON, 0 }, /* mHsRm_HUUSUI_RED */
|
||||
{ mHsRm_WALL_NTH, 2 }, /* mHsRm_HUUSUI_ORANGE */
|
||||
{ mHsRm_WALL_STH, 2 }, /* mHsRm_HUUSUI_GREEN */
|
||||
{ mHsRm_WALL_ALL, 4 }, /* mHsRm_HUUSUI_LUCKY */
|
||||
};
|
||||
|
||||
/* goods power info table */
|
||||
static const int goods_power_tbl[mHsRm_HUUSUI_NUM][2] = {
|
||||
{ mHsRm_WALL_NON, 0 }, /* mHsRm_HUUSUI_NONE */
|
||||
{ mHsRm_WALL_NON, 0 }, /* mHsRm_HUUSUI_YELLOW */
|
||||
{ mHsRm_WALL_EST, 8 }, /* mHsRm_HUUSUI_RED */
|
||||
{ mHsRm_WALL_NTH, 4 }, /* mHsRm_HUUSUI_ORANGE */
|
||||
{ mHsRm_WALL_STH, 4 }, /* mHsRm_HUUSUI_GREEN */
|
||||
{ mHsRm_WALL_ALL, 8 } /* mHsRm_HUUSUI_LUCKY */
|
||||
{ mHsRm_WALL_NON, 0 }, /* mHsRm_HUUSUI_NONE */
|
||||
{ mHsRm_WALL_NON, 0 }, /* mHsRm_HUUSUI_YELLOW */
|
||||
{ mHsRm_WALL_EST, 8 }, /* mHsRm_HUUSUI_RED */
|
||||
{ mHsRm_WALL_NTH, 4 }, /* mHsRm_HUUSUI_ORANGE */
|
||||
{ mHsRm_WALL_STH, 4 }, /* mHsRm_HUUSUI_GREEN */
|
||||
{ mHsRm_WALL_ALL, 8 }, /* mHsRm_HUUSUI_LUCKY */
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Feng Shui scoring algorithm for a single furniture.
|
||||
*
|
||||
*
|
||||
* This function checks which side of the room the furniture is on,
|
||||
* along with its orientation. It returns the point score for both
|
||||
* money power and goods power into 'money_power' and 'goods_power'.
|
||||
* The result can be negative if a 'doll'/'item with a face' is facing
|
||||
* the wall.
|
||||
*
|
||||
*
|
||||
* @param ftr The actor furniture number
|
||||
* @param ut_x Unit x position
|
||||
* @param ut_z Unit z position
|
||||
* @param money_power Calculated money power for the furniture position
|
||||
* @param goods_power Calculated goods power for the furniture position
|
||||
**/
|
||||
static void mHsRm_EvaluateHuusuiPoint_Single(mActor_name_t ftr, int ut_x, int ut_z, int ut_max, int* money_power, int* goods_power) {
|
||||
int i;
|
||||
int ftr_idx;
|
||||
int room_side_bits;
|
||||
int ut_value;
|
||||
int rotation_bits;
|
||||
int huusui_type;
|
||||
int room_side_tbl[mHsRm_DIRECTION_NUM];
|
||||
int rotation_tbl[mHsRm_DIRECTION_NUM];
|
||||
mRmTp_FtrPlaceInfoOne_t place_info[mRmTp_FTR_UNIT_MAX];
|
||||
int ftr_rot;
|
||||
int has_face;
|
||||
int start_ut;
|
||||
static void mHsRm_EvaluateHuusuiPoint_Single(mActor_name_t ftr, int ut_x, int ut_z, int ut_max, int* money_power,
|
||||
int* goods_power) {
|
||||
int i;
|
||||
int ftr_idx;
|
||||
int room_side_bits;
|
||||
int ut_value;
|
||||
int rotation_bits;
|
||||
int huusui_type;
|
||||
int room_side_tbl[mHsRm_DIRECTION_NUM];
|
||||
int rotation_tbl[mHsRm_DIRECTION_NUM];
|
||||
mRmTp_FtrPlaceInfoOne_t place_info[mRmTp_FTR_UNIT_MAX];
|
||||
int ftr_rot;
|
||||
int has_face;
|
||||
int start_ut;
|
||||
|
||||
*money_power = 0;
|
||||
*goods_power = 0;
|
||||
*money_power = 0;
|
||||
*goods_power = 0;
|
||||
|
||||
ftr_idx = mRmTp_FtrItemNo2FtrIdx(ftr);
|
||||
ftr_rot = FTR_GET_ROTATION(ftr);
|
||||
huusui_type = mMkRm_ftr_info[ftr_idx].huusui_type;
|
||||
has_face = mMkRm_ftr_info[ftr_idx].has_face;
|
||||
ut_value = mHsRm_unit_value[mRmTp_GetFurnitureData(ftr, ut_x, ut_z, place_info)]; /* number of units occupied by this furniture */
|
||||
ftr_idx = mRmTp_FtrItemNo2FtrIdx(ftr);
|
||||
ftr_rot = FTR_GET_ROTATION(ftr);
|
||||
huusui_type = mMkRm_ftr_info[ftr_idx].huusui_type;
|
||||
has_face = mMkRm_ftr_info[ftr_idx].has_face;
|
||||
ut_value = mHsRm_unit_value[mRmTp_GetFurnitureData(ftr, ut_x, ut_z,
|
||||
place_info)]; /* number of units occupied by this furniture */
|
||||
|
||||
/* maximum top/left position for feng shui */
|
||||
if (ut_max == mHsRm_UNIT_MAX_S && ut_value == 1) {
|
||||
start_ut = 1;
|
||||
}
|
||||
else {
|
||||
start_ut = 2;
|
||||
}
|
||||
|
||||
for (i = 0; i < mHsRm_DIRECTION_NUM; i++) {
|
||||
room_side_tbl[i] = 0;
|
||||
rotation_tbl[i] = 0;
|
||||
}
|
||||
|
||||
/* loop through all units occupied by the furniture and check feng shui parameters on each unit */
|
||||
for (i = 0; i < ut_value; i++) {
|
||||
if (place_info[i].ut_z <= start_ut) {
|
||||
room_side_tbl[mHsRm_DIRECTION_NORTH]++;
|
||||
|
||||
if (place_info[i].ut_z <= 1) {
|
||||
rotation_tbl[mHsRm_DIRECTION_NORTH]++;
|
||||
}
|
||||
}
|
||||
else if (place_info[i].ut_z >= ((ut_max - start_ut) - 1)) {
|
||||
room_side_tbl[mHsRm_DIRECTION_SOUTH]++;
|
||||
|
||||
if (place_info[i].ut_z >= ut_max - 2) {
|
||||
rotation_tbl[mHsRm_DIRECTION_SOUTH]++;
|
||||
}
|
||||
/* maximum top/left position for feng shui */
|
||||
if (ut_max == mHsRm_UNIT_MAX_S && ut_value == 1) {
|
||||
start_ut = 1;
|
||||
} else {
|
||||
start_ut = 2;
|
||||
}
|
||||
|
||||
if (place_info[i].ut_x <= start_ut) {
|
||||
room_side_tbl[mHsRm_DIRECTION_WEST]++;
|
||||
|
||||
if (place_info[i].ut_x <= 1) {
|
||||
rotation_tbl[mHsRm_DIRECTION_WEST]++;
|
||||
}
|
||||
}
|
||||
else if (place_info[i].ut_x >= ((ut_max - start_ut) - 1)) {
|
||||
room_side_tbl[mHsRm_DIRECTION_EAST]++;
|
||||
|
||||
if (place_info[i].ut_x >= ut_max - 2) {
|
||||
rotation_tbl[mHsRm_DIRECTION_EAST]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
room_side_bits = 0;
|
||||
rotation_bits = 0;
|
||||
|
||||
/* log positioning & rotation */
|
||||
for (i = 0; i < mHsRm_DIRECTION_NUM; i++) {
|
||||
/* if all units belonging to this furniture are in the same feng shui room side, add feng shui type */
|
||||
if (ut_value == room_side_tbl[i]) {
|
||||
room_side_bits |= (1 << i);
|
||||
}
|
||||
|
||||
/* if any of the furnitures units are directly adjecent to a wall, mark it for rotation check */
|
||||
if ((ut_value >= 2 && rotation_tbl[i] >= 2) || (ut_value == 1 && rotation_tbl[i] >= 1)) {
|
||||
rotation_bits |= (1 << i);
|
||||
}
|
||||
}
|
||||
|
||||
if (huusui_type == mHsRm_HUUSUI_LUCKY) {
|
||||
*money_power += mHsRm_MONEY_LUCKY_PTS;
|
||||
*goods_power += mHsRm_GOODS_LUCKY_PTS;
|
||||
}
|
||||
|
||||
if (room_side_bits != 0) {
|
||||
for (i = 0; i < mHsRm_DIRECTION_NUM; i++) {
|
||||
if (huusui_type != mHsRm_HUUSUI_LUCKY) {
|
||||
/* if the furniture was properly placed entirely in the feng shui area, check points & add */
|
||||
if (room_side_bits & (1 << i)) {
|
||||
if (money_power_tbl[huusui_type][0] & (1 << i)) {
|
||||
*money_power += money_power_tbl[huusui_type][1];
|
||||
}
|
||||
|
||||
if (goods_power_tbl[huusui_type][0] & (1 << i)) {
|
||||
*goods_power += goods_power_tbl[huusui_type][1];
|
||||
}
|
||||
}
|
||||
}
|
||||
room_side_tbl[i] = 0;
|
||||
rotation_tbl[i] = 0;
|
||||
}
|
||||
|
||||
/* If the furniture has a "face" (front side), deduct points if that side is facing the wall */
|
||||
if (has_face != 0) {
|
||||
for (i = 0; i < mHsRm_DIRECTION_NUM; i++) {
|
||||
/* check is for furniture is directly adjacent to the given wall and the rotation is the same direction as the wall */
|
||||
if ((rotation_bits & (1 << i)) && (ftr_rot == i)) {
|
||||
*money_power -= mHsRm_MONEY_BAD_PTS;
|
||||
*goods_power -= mHsRm_GOODS_BAD_PTS;
|
||||
/* loop through all units occupied by the furniture and check feng shui parameters on each unit */
|
||||
for (i = 0; i < ut_value; i++) {
|
||||
if (place_info[i].ut_z <= start_ut) {
|
||||
room_side_tbl[mHsRm_DIRECTION_NORTH]++;
|
||||
|
||||
if (place_info[i].ut_z <= 1) {
|
||||
rotation_tbl[mHsRm_DIRECTION_NORTH]++;
|
||||
}
|
||||
} else if (place_info[i].ut_z >= ((ut_max - start_ut) - 1)) {
|
||||
room_side_tbl[mHsRm_DIRECTION_SOUTH]++;
|
||||
|
||||
if (place_info[i].ut_z >= ut_max - 2) {
|
||||
rotation_tbl[mHsRm_DIRECTION_SOUTH]++;
|
||||
}
|
||||
}
|
||||
|
||||
if (place_info[i].ut_x <= start_ut) {
|
||||
room_side_tbl[mHsRm_DIRECTION_WEST]++;
|
||||
|
||||
if (place_info[i].ut_x <= 1) {
|
||||
rotation_tbl[mHsRm_DIRECTION_WEST]++;
|
||||
}
|
||||
} else if (place_info[i].ut_x >= ((ut_max - start_ut) - 1)) {
|
||||
room_side_tbl[mHsRm_DIRECTION_EAST]++;
|
||||
|
||||
if (place_info[i].ut_x >= ut_max - 2) {
|
||||
rotation_tbl[mHsRm_DIRECTION_EAST]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
room_side_bits = 0;
|
||||
rotation_bits = 0;
|
||||
|
||||
/* log positioning & rotation */
|
||||
for (i = 0; i < mHsRm_DIRECTION_NUM; i++) {
|
||||
/* if all units belonging to this furniture are in the same feng shui room side, add feng shui type */
|
||||
if (ut_value == room_side_tbl[i]) {
|
||||
room_side_bits |= (1 << i);
|
||||
}
|
||||
|
||||
/* if any of the furnitures units are directly adjecent to a wall, mark it for rotation check */
|
||||
if ((ut_value >= 2 && rotation_tbl[i] >= 2) || (ut_value == 1 && rotation_tbl[i] >= 1)) {
|
||||
rotation_bits |= (1 << i);
|
||||
}
|
||||
}
|
||||
|
||||
if (huusui_type == mHsRm_HUUSUI_LUCKY) {
|
||||
*money_power += mHsRm_MONEY_LUCKY_PTS;
|
||||
*goods_power += mHsRm_GOODS_LUCKY_PTS;
|
||||
}
|
||||
|
||||
if (room_side_bits != 0) {
|
||||
for (i = 0; i < mHsRm_DIRECTION_NUM; i++) {
|
||||
if (huusui_type != mHsRm_HUUSUI_LUCKY) {
|
||||
/* if the furniture was properly placed entirely in the feng shui area, check points & add */
|
||||
if (room_side_bits & (1 << i)) {
|
||||
if (money_power_tbl[huusui_type][0] & (1 << i)) {
|
||||
*money_power += money_power_tbl[huusui_type][1];
|
||||
}
|
||||
|
||||
if (goods_power_tbl[huusui_type][0] & (1 << i)) {
|
||||
*goods_power += goods_power_tbl[huusui_type][1];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* If the furniture has a "face" (front side), deduct points if that side is facing the wall */
|
||||
if (has_face != 0) {
|
||||
for (i = 0; i < mHsRm_DIRECTION_NUM; i++) {
|
||||
/* check is for furniture is directly adjacent to the given wall and the rotation is the same direction
|
||||
* as the wall */
|
||||
if ((rotation_bits & (1 << i)) && (ftr_rot == i)) {
|
||||
*money_power -= mHsRm_MONEY_BAD_PTS;
|
||||
*goods_power -= mHsRm_GOODS_BAD_PTS;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Scores an entire room's Feng Shui.
|
||||
*
|
||||
*
|
||||
* @param layers Pointer to array of mHm_lyr_c room layers to score (main & secondary)
|
||||
* @param ut_max The maximum unit position (both x & z) for the room's size
|
||||
* @param money_power Calculated room money power
|
||||
* @param goods_power Calculated room goods power
|
||||
**/
|
||||
static void mHsRm_EvaluateHuusuiPoint(mHm_lyr_c** layers, int ut_max, int* money_power, int* goods_power) {
|
||||
int room_money_power;
|
||||
int room_goods_power;
|
||||
mActor_name_t item_no;
|
||||
int room_money_power;
|
||||
int room_goods_power;
|
||||
int lyr;
|
||||
int ut_x;
|
||||
int ut_z;
|
||||
int item_money_power;
|
||||
int item_goods_power;
|
||||
mActor_name_t* fg_p_top;
|
||||
int z;
|
||||
|
||||
room_money_power = 0;
|
||||
room_goods_power = 0;
|
||||
|
||||
int lyr;
|
||||
int ut_x;
|
||||
int ut_z;
|
||||
/* loop through each unit on both main & secondary layers and score each ftr */
|
||||
for (lyr = 0; lyr < 2; lyr++) {
|
||||
fg_p_top = (mActor_name_t*)layers[lyr];
|
||||
for (ut_z = 0; ut_z < ut_max; ut_z++) {
|
||||
int z = ut_z * UT_X_NUM;
|
||||
|
||||
room_money_power = 0;
|
||||
room_goods_power = 0;
|
||||
|
||||
/* loop through each unit on both main & secondary layers and score each ftr */
|
||||
for (lyr = 0; lyr < 2; lyr++) {
|
||||
mHm_lyr_c* layer = layers[lyr];
|
||||
for (ut_z = 0; ut_z < ut_max; ut_z++) {
|
||||
for (ut_x = 0; ut_x < ut_max; ut_x++) {
|
||||
mActor_name_t item_no = layer->items[ut_z][ut_x];
|
||||
if (ITEM_IS_FTR(item_no)) {
|
||||
int item_money_power;
|
||||
int item_goods_power;
|
||||
|
||||
mHsRm_EvaluateHuusuiPoint_Single(item_no, ut_x, ut_z, ut_max, &item_money_power, &item_goods_power);
|
||||
room_money_power += item_money_power;
|
||||
room_goods_power += item_goods_power;
|
||||
for (ut_x = 0; ut_x < ut_max; ut_x++) {
|
||||
item_no = *((fg_p_top + z + ut_x));
|
||||
if (ITEM_IS_FTR(item_no)) {
|
||||
mHsRm_EvaluateHuusuiPoint_Single(item_no, ut_x, ut_z, ut_max, &item_money_power, &item_goods_power);
|
||||
room_money_power += item_money_power;
|
||||
room_goods_power += item_goods_power;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*money_power += room_money_power;
|
||||
*goods_power += room_goods_power;
|
||||
*money_power += room_money_power;
|
||||
*goods_power += room_goods_power;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Main Feng Shui scoring function. Will score all three rooms in house
|
||||
* depending on house size.
|
||||
*
|
||||
*
|
||||
* @param player_no The index of the player whose house will be scored for Feng Shui
|
||||
**/
|
||||
extern void mHsRm_HuusuiRoomOvl(int player_no) {
|
||||
int ut_max;
|
||||
mHm_hs_c* home;
|
||||
int money_power;
|
||||
int goods_power;
|
||||
mHm_lyr_c* layers[2];
|
||||
f32 real_goods_power;
|
||||
int ut_max;
|
||||
mHm_hs_c* home;
|
||||
int money_power;
|
||||
int goods_power;
|
||||
mHm_lyr_c* layers[2];
|
||||
f32 real_goods_power;
|
||||
|
||||
home = Save_Get(homes + mHS_get_arrange_idx(player_no));
|
||||
money_power = 0;
|
||||
goods_power = 0;
|
||||
home = Save_Get(homes + mHS_get_arrange_idx(player_no));
|
||||
money_power = 0;
|
||||
goods_power = 0;
|
||||
|
||||
/* Evaluate the main room first */
|
||||
ut_max = mHsRm_unit_max[home->size_info.size];
|
||||
layers[0] = &home->floors[mHm_ROOM_MAIN].layer_main;
|
||||
layers[1] = &home->floors[mHm_ROOM_MAIN].layer_secondary;
|
||||
mHsRm_EvaluateHuusuiPoint(layers, ut_max, &money_power, &goods_power);
|
||||
/* Evaluate the main room first */
|
||||
ut_max = mHsRm_unit_max[home->size_info.size];
|
||||
layers[0] = &home->floors[mHm_ROOM_MAIN].layer_main;
|
||||
layers[1] = &home->floors[mHm_ROOM_MAIN].layer_secondary;
|
||||
mHsRm_EvaluateHuusuiPoint(layers, ut_max, &money_power, &goods_power);
|
||||
|
||||
/* Evaluate the second floor next if it exists */
|
||||
if (home->size_info.size == mHm_HOMESIZE_UPPER) {
|
||||
layers[0] = &home->floors[mHm_ROOM_UPPER].layer_main;
|
||||
layers[1] = &home->floors[mHm_ROOM_UPPER].layer_secondary;
|
||||
mHsRm_EvaluateHuusuiPoint(layers, mHsRm_UNIT_MAX_UPPER, &money_power, &goods_power);
|
||||
}
|
||||
/* Evaluate the second floor next if it exists */
|
||||
if (home->size_info.size == mHm_HOMESIZE_UPPER) {
|
||||
layers[0] = &home->floors[mHm_ROOM_UPPER].layer_main;
|
||||
layers[1] = &home->floors[mHm_ROOM_UPPER].layer_secondary;
|
||||
mHsRm_EvaluateHuusuiPoint(layers, mHsRm_UNIT_MAX_UPPER, &money_power, &goods_power);
|
||||
}
|
||||
|
||||
/* Finally, evaluate the basement if it exists */
|
||||
if (home->flags.has_basement == TRUE) {
|
||||
layers[0] = &home->floors[mHm_ROOM_BASEMENT].layer_main;
|
||||
layers[1] = &home->floors[mHm_ROOM_BASEMENT].layer_secondary;
|
||||
mHsRm_EvaluateHuusuiPoint(layers, mHsRm_UNIT_MAX_BASEMENT, &money_power, &goods_power);
|
||||
}
|
||||
/* Finally, evaluate the basement if it exists */
|
||||
if (home->flags.has_basement == TRUE) {
|
||||
layers[0] = &home->floors[mHm_ROOM_BASEMENT].layer_main;
|
||||
layers[1] = &home->floors[mHm_ROOM_BASEMENT].layer_secondary;
|
||||
mHsRm_EvaluateHuusuiPoint(layers, mHsRm_UNIT_MAX_BASEMENT, &money_power, &goods_power);
|
||||
}
|
||||
|
||||
/* Goods power is clamed to its upper bound of 40 */
|
||||
if (goods_power > mHsRm_GOODS_POWER_MAX) {
|
||||
goods_power = mHsRm_GOODS_POWER_MAX;
|
||||
}
|
||||
/* Goods power is clamed to its upper bound of 40 */
|
||||
if (goods_power > mHsRm_GOODS_POWER_MAX) {
|
||||
goods_power = mHsRm_GOODS_POWER_MAX;
|
||||
}
|
||||
|
||||
/* Adjust goods power by dividing it in half and rounding up */
|
||||
real_goods_power = (f32)goods_power * 0.5f;
|
||||
goods_power = real_goods_power;
|
||||
/* Adjust goods power by dividing it in half and rounding up */
|
||||
real_goods_power = (f32)goods_power * 0.5f;
|
||||
goods_power = real_goods_power;
|
||||
|
||||
/* Always round up if there's any fractional part to goods_power */
|
||||
real_goods_power -= goods_power;
|
||||
if (real_goods_power > 0.0f) {
|
||||
goods_power++;
|
||||
}
|
||||
/* Always round up if there's any fractional part to goods_power */
|
||||
real_goods_power -= goods_power;
|
||||
if (real_goods_power > 0.0f) {
|
||||
goods_power++;
|
||||
}
|
||||
|
||||
Common_Set(money_power, money_power);
|
||||
Common_Set(goods_power, goods_power);
|
||||
Common_Set(money_power, money_power);
|
||||
Common_Set(goods_power, goods_power);
|
||||
}
|
||||
|
||||
@@ -1604,17 +1604,16 @@ static int mIV_is_mark_check(mIV_Ovl_c* inv_ovl, int idx) {
|
||||
extern Gfx inv_item_mode[];
|
||||
|
||||
static void mIV_set_item(Submenu* submenu, mSM_MenuInfo_c* menu_info, GRAPH* graph, f32 pos_x, f32 pos_y) {
|
||||
mTG_Ovl_c* tag_ovl;
|
||||
mTG_tag_c* tag;
|
||||
mIV_Ovl_c* inv_ovl;
|
||||
mActor_name_t* item;
|
||||
u8* scale_type;
|
||||
mTG_tag_c* tag;
|
||||
int i;
|
||||
int anim_frame;
|
||||
f32 hand_pos[2];
|
||||
f32 scale;
|
||||
int no_wc_flag;
|
||||
|
||||
|
||||
tag = &submenu->overlay->tag_ovl->tags[0];
|
||||
inv_ovl = submenu->overlay->inventory_ovl;
|
||||
item = Now_Private->inventory.pockets;
|
||||
@@ -1653,8 +1652,8 @@ static void mIV_set_item(Submenu* submenu, mSM_MenuInfo_c* menu_info, GRAPH* gra
|
||||
}
|
||||
|
||||
case mIV_ITEM_SCALE_TYPE_SHRINK: {
|
||||
anim_frame = 70 - inv_ovl->remove_timer;
|
||||
scale = (f32)inv_ovl->remove_timer * (1.0f / 12.0f);
|
||||
anim_frame = 70 - inv_ovl->remove_timer;
|
||||
|
||||
if (anim_frame >= 6) {
|
||||
anim_frame = 5;
|
||||
@@ -1663,10 +1662,10 @@ static void mIV_set_item(Submenu* submenu, mSM_MenuInfo_c* menu_info, GRAPH* gra
|
||||
}
|
||||
|
||||
default: {
|
||||
anim_frame = 0;
|
||||
scale =
|
||||
1.0f - (f32)(inv_ovl->remove_timer - 14 - (*scale_type - mIV_ITEM_SCALE_TYPE_GROW) * 14) *
|
||||
(1.0f / 12.0f);
|
||||
anim_frame = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1677,8 +1676,8 @@ static void mIV_set_item(Submenu* submenu, mSM_MenuInfo_c* menu_info, GRAPH* gra
|
||||
scale = 0.0f;
|
||||
}
|
||||
} else {
|
||||
anim_frame = 0;
|
||||
scale = 1.0f;
|
||||
anim_frame = 0;
|
||||
}
|
||||
|
||||
/* @BUG - they compare int (anim_frame) to float (0.0f) here instead of just 0 */
|
||||
@@ -1689,7 +1688,7 @@ static void mIV_set_item(Submenu* submenu, mSM_MenuInfo_c* menu_info, GRAPH* gra
|
||||
|
||||
submenu->overlay->draw_item_proc(
|
||||
graph, pos_x + hand_pos[0], pos_y + hand_pos[1], scale, *item,
|
||||
((Now_Private->inventory.item_conditions >> (i * 2)) & mPr_ITEM_COND_PRESENT) != 0,
|
||||
(NowPrivate_GetItemCond(i) & mPr_ITEM_COND_PRESENT) != 0,
|
||||
!no_wc_flag && (inv_ovl->selectable_item_bitfield & (1 << i)), anim_frame, FALSE,
|
||||
mIV_is_mark_check(inv_ovl, i));
|
||||
}
|
||||
|
||||
+16
-7
@@ -1504,8 +1504,9 @@ static void mEnv_ChangeRGBLight(u8* dst, u8* src_nxt_w0, u8* src_nxt_w1, u8* src
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
dst[0] = weather_change_bias * (f1 * (src_nxt_w0[0] + f0 * ((f32)src_nxt_w1[0] - (f32)src_nxt_w0[0]))) +
|
||||
inverse_weather_change_bias * (f1 * (src_now_w0[0] + f0 * ((f32)src_now_w1[0] - (f32)src_now_w0[0])));
|
||||
*dst =
|
||||
weather_change_bias * (f1 * (*src_nxt_w0 + f0 * ((f32)*src_nxt_w1 - (f32)*src_nxt_w0))) +
|
||||
inverse_weather_change_bias * (f1 * (*src_now_w0 + f0 * ((f32)*src_now_w1 - (f32)*src_now_w0)));
|
||||
|
||||
dst++;
|
||||
src_nxt_w0++;
|
||||
@@ -2113,7 +2114,7 @@ extern void mEnv_ManagePointLight(GAME_PLAY* play, Kankyo* kankyo, Global_light*
|
||||
|
||||
static void mEnv_ManageChangeWeatherEnvRate() {
|
||||
if (l_mEnv_electric_light.now_weather != l_mEnv_electric_light.next_weather) {
|
||||
l_mEnv_electric_light.change_weather_env_rate += (1.0f / 600.0f);
|
||||
l_mEnv_electric_light.change_weather_env_rate += mEnv_CHANGE_WEATHER_ENV_RATE;
|
||||
|
||||
if (l_mEnv_electric_light.change_weather_env_rate >= 1.0f) {
|
||||
l_mEnv_electric_light.change_weather_env_rate = 1.0f;
|
||||
@@ -2203,7 +2204,11 @@ static int mEnv_CheckNpcRoomPointLightNiceStatus() {
|
||||
schedule = Common_GetPointer(npc_schedule[ANIMAL_NUM_MAX]);
|
||||
|
||||
if (schedule != NULL) {
|
||||
if (schedule->current_type == mNPS_SCHED_IN_HOUSE && animal->is_home == TRUE &&
|
||||
if (
|
||||
#if VERSION < VER_GAFU01_00
|
||||
schedule->current_type == mNPS_SCHED_IN_HOUSE &&
|
||||
#endif
|
||||
animal->is_home == TRUE &&
|
||||
(Common_Get(time).now_sec < mEnv_NPC_LIGHTS_OFF_TIME ||
|
||||
Common_Get(time).now_sec >= mEnv_NPC_LIGHTS_ON_TIME)) {
|
||||
return TRUE;
|
||||
@@ -2216,7 +2221,11 @@ static int mEnv_CheckNpcRoomPointLightNiceStatus() {
|
||||
schedule = mNPS_get_schedule_area(&animal->id);
|
||||
|
||||
if (schedule != NULL) {
|
||||
if (schedule->current_type == mNPS_SCHED_IN_HOUSE && animal->is_home == TRUE &&
|
||||
if (
|
||||
#if VERSION < VER_GAFU01_00
|
||||
schedule->current_type == mNPS_SCHED_IN_HOUSE &&
|
||||
#endif
|
||||
animal->is_home == TRUE &&
|
||||
(Common_Get(time).now_sec < mEnv_NPC_LIGHTS_OFF_TIME ||
|
||||
Common_Get(time).now_sec >= mEnv_NPC_LIGHTS_ON_TIME)) {
|
||||
return TRUE;
|
||||
@@ -2394,8 +2403,8 @@ extern int mEnv_ReservePointLight(GAME_PLAY* play, xyz_t* pos, u8 r, u8 g, u8 b,
|
||||
if (l_mEnv_electric_light.point_light_list_buf[i] == NULL) {
|
||||
point_light = &l_mEnv_electric_light.point_lights[i];
|
||||
|
||||
Light_point_ct(point_light, pos->x, pos->y, pos->z, r, g, b, power);
|
||||
list = Global_light_list_new((GAME*)play, &play->global_light, point_light);
|
||||
Light_point_ct(&l_mEnv_electric_light.point_lights[i], pos->x, pos->y, pos->z, r, g, b, power);
|
||||
list = Global_light_list_new((GAME*)play, &play->global_light, &l_mEnv_electric_light.point_lights[i]);
|
||||
|
||||
if (list != NULL) {
|
||||
l_mEnv_electric_light.point_light_list_buf[i] = list;
|
||||
|
||||
+77
-77
@@ -2,10 +2,10 @@
|
||||
* @file m_land.c
|
||||
* @brief Functions and definitions for handling town name, town ID, and
|
||||
* determining if a player is a foreigner or not.
|
||||
*
|
||||
*
|
||||
* This file contains functions for manipulating town names and IDs, checking
|
||||
* if a player is a foreigner, and initializing land and home data.
|
||||
*
|
||||
*
|
||||
* Note: "Mura" (むら/村) is the Japanese word for village. Functions which contain that
|
||||
* word were used to concatenate the town name with it. Since this does not happen
|
||||
* in inernational releases, these functions essentially do nothing.
|
||||
@@ -49,7 +49,7 @@ static int l_mld_start_flag = FALSE;
|
||||
* @brief Turns on the start flag.
|
||||
*/
|
||||
extern void mLd_StartFlagOn() {
|
||||
l_mld_start_flag = TRUE;
|
||||
l_mld_start_flag = TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -57,7 +57,7 @@ extern void mLd_StartFlagOn() {
|
||||
* @return The value of l_mld_start_flag.
|
||||
*/
|
||||
extern int mLd_CheckStartFlag() {
|
||||
return l_mld_start_flag;
|
||||
return l_mld_start_flag;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -65,21 +65,21 @@ extern int mLd_CheckStartFlag() {
|
||||
* @param land_name Pointer to the town name.
|
||||
* @return TRUE if the town name is empty, FALSE otherwise.
|
||||
*/
|
||||
extern int mLd_NullCheckLandName(const u8* land_name) {
|
||||
int null_name = FALSE;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < LAND_NAME_SIZE; i++) {
|
||||
if (*land_name != CHAR_SPACE) {
|
||||
break;
|
||||
}
|
||||
land_name++;
|
||||
}
|
||||
extern int mLd_NullCheckLandName(u8* land_name) {
|
||||
int null_name = FALSE;
|
||||
int i;
|
||||
|
||||
if (i == LAND_NAME_SIZE) {
|
||||
null_name = TRUE;
|
||||
}
|
||||
return null_name;
|
||||
for (i = 0; i < LAND_NAME_SIZE; i++) {
|
||||
if (*land_name != CHAR_SPACE) {
|
||||
break;
|
||||
}
|
||||
land_name++;
|
||||
}
|
||||
|
||||
if (i == LAND_NAME_SIZE) {
|
||||
null_name = TRUE;
|
||||
}
|
||||
return null_name;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -88,12 +88,12 @@ extern int mLd_NullCheckLandName(const u8* land_name) {
|
||||
* @return TRUE if the land ID has the correct bitmask, FALSE otherwise.
|
||||
*/
|
||||
extern int mLd_CheckId(u16 land_id) {
|
||||
int res = FALSE;
|
||||
if (mLd_CHECK_ID(land_id)) {
|
||||
res = TRUE;
|
||||
}
|
||||
int res = FALSE;
|
||||
if (mLd_CHECK_ID(land_id)) {
|
||||
res = TRUE;
|
||||
}
|
||||
|
||||
return res;
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -103,13 +103,13 @@ extern int mLd_CheckId(u16 land_id) {
|
||||
* @return TRUE if both town names are equal, FALSE otherwise.
|
||||
*/
|
||||
extern int mLd_CheckCmpLandName(u8* name_a, u8* name_b) {
|
||||
int equal = FALSE;
|
||||
int equal = FALSE;
|
||||
|
||||
if (mLd_NullCheckLandName(name_a) == FALSE && mLd_NullCheckLandName(name_b) == FALSE) {
|
||||
equal = mem_cmp(name_a, name_b, LAND_NAME_SIZE);
|
||||
}
|
||||
if (mLd_NullCheckLandName(name_a) == FALSE && mLd_NullCheckLandName(name_b) == FALSE) {
|
||||
equal = mem_cmp(name_a, name_b, LAND_NAME_SIZE);
|
||||
}
|
||||
|
||||
return equal;
|
||||
return equal;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -121,13 +121,13 @@ extern int mLd_CheckCmpLandName(u8* name_a, u8* name_b) {
|
||||
* @return TRUE if both town names and IDs are equal, FALSE otherwise.
|
||||
*/
|
||||
extern int mLd_CheckCmpLand(u8* name_a, u16 id_a, u8* name_b, u16 id_b) {
|
||||
int equal = FALSE;
|
||||
int equal = FALSE;
|
||||
|
||||
if (id_a == id_b && mLd_CheckCmpLandName(name_a, name_b) == TRUE) {
|
||||
equal = TRUE;
|
||||
}
|
||||
if (id_a == id_b && mLd_CheckCmpLandName(name_a, name_b) == TRUE) {
|
||||
equal = TRUE;
|
||||
}
|
||||
|
||||
return equal;
|
||||
return equal;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -135,7 +135,7 @@ extern int mLd_CheckCmpLand(u8* name_a, u16 id_a, u8* name_b, u16 id_b) {
|
||||
* @param name Pointer to the town name.
|
||||
*/
|
||||
extern void mLd_ClearLandName(u8* name) {
|
||||
mem_clear(name, LAND_NAME_SIZE, CHAR_SPACE);
|
||||
mem_clear(name, LAND_NAME_SIZE, CHAR_SPACE);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -144,7 +144,7 @@ extern void mLd_ClearLandName(u8* name) {
|
||||
* @param src Pointer to the source town name.
|
||||
*/
|
||||
extern void mLd_CopyLandName(u8* dst, u8* src) {
|
||||
mem_copy(dst, src, LAND_NAME_SIZE);
|
||||
mem_copy(dst, src, LAND_NAME_SIZE);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -154,14 +154,14 @@ extern void mLd_CopyLandName(u8* dst, u8* src) {
|
||||
* @return The length of the new town name with "Mura" (むら/村) added.
|
||||
*/
|
||||
extern int mLd_AddMuraString(u8* name, int name_len) {
|
||||
u8 buf[16];
|
||||
int size;
|
||||
u8 buf[16];
|
||||
int size;
|
||||
|
||||
mString_Load_StringFromRom(buf, 16, 484); /* TODO: str_no should probably be enum or something */
|
||||
size = mMsg_Get_Length_String(buf, 16);
|
||||
mem_copy(name + name_len, buf, size);
|
||||
mString_Load_StringFromRom(buf, 16, 484); /* TODO: str_no should probably be enum or something */
|
||||
size = mMsg_Get_Length_String(buf, 16);
|
||||
mem_copy(name + name_len, buf, size);
|
||||
|
||||
return size + name_len;
|
||||
return size + name_len;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -169,19 +169,19 @@ extern int mLd_AddMuraString(u8* name, int name_len) {
|
||||
* @param buf Buffer to store the town name with "Mura" (むら/村) added.
|
||||
*/
|
||||
extern int mLd_GetLandNameStringAddMura(u8* buf) {
|
||||
int mura_size;
|
||||
int i;
|
||||
|
||||
u8* name = mLd_GetLandName();
|
||||
int size = mMsg_Get_Length_String(name, LAND_NAME_SIZE);
|
||||
mem_copy(buf, name, size);
|
||||
mura_size = mLd_AddMuraString(buf, size);
|
||||
int mura_size;
|
||||
int i;
|
||||
|
||||
for (i = mura_size; i < LAND_NAME_MURA_SIZE; i++) {
|
||||
buf[i] = CHAR_SPACE;
|
||||
}
|
||||
u8* name = mLd_GetLandName();
|
||||
int size = mMsg_Get_Length_String(name, LAND_NAME_SIZE);
|
||||
mem_copy(buf, name, size);
|
||||
mura_size = mLd_AddMuraString(buf, size);
|
||||
|
||||
return mura_size;
|
||||
for (i = mura_size; i < LAND_NAME_MURA_SIZE; i++) {
|
||||
buf[i] = CHAR_SPACE;
|
||||
}
|
||||
|
||||
return mura_size;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -190,19 +190,19 @@ extern int mLd_GetLandNameStringAddMura(u8* buf) {
|
||||
* @param free_str_no The number of the free string.
|
||||
*/
|
||||
extern void mLd_SetFreeStrLandMuraName(u8* name, int free_str_no) {
|
||||
u8 str[16];
|
||||
int name_len;
|
||||
int mura_len;
|
||||
int i;
|
||||
u8 str[16];
|
||||
int name_len;
|
||||
int mura_len;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < LAND_NAME_MURA_SIZE; i++) {
|
||||
str[i] = CHAR_SPACE;
|
||||
}
|
||||
for (i = 0; i < LAND_NAME_MURA_SIZE; i++) {
|
||||
str[i] = CHAR_SPACE;
|
||||
}
|
||||
|
||||
name_len = mMsg_Get_Length_String(name, LAND_NAME_SIZE);
|
||||
mem_copy(str, name, name_len);
|
||||
mura_len = mLd_AddMuraString(str, name_len);
|
||||
mMsg_Set_free_str(mMsg_Get_base_window_p(), free_str_no, str, mura_len);
|
||||
name_len = mMsg_Get_Length_String(name, LAND_NAME_SIZE);
|
||||
mem_copy(str, name, name_len);
|
||||
mura_len = mLd_AddMuraString(str, name_len);
|
||||
mMsg_Set_free_str(mMsg_Get_base_window_p(), free_str_no, str, mura_len);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -210,7 +210,7 @@ extern void mLd_SetFreeStrLandMuraName(u8* name, int free_str_no) {
|
||||
* @return Pointer to the town name.
|
||||
*/
|
||||
extern u8* mLd_GetLandName() {
|
||||
return Save_Get(land_info.name);
|
||||
return Save_Get(land_info.name);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -218,7 +218,7 @@ extern u8* mLd_GetLandName() {
|
||||
* @return The newly generated land ID.
|
||||
*/
|
||||
extern u16 mLd_MakeLandId() {
|
||||
return (int)(fqrand() * 256.0f) | mLd_BITMASK;
|
||||
return (int)(fqrand() * 256.0f) | mLd_BITMASK;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -227,12 +227,12 @@ extern u16 mLd_MakeLandId() {
|
||||
* @return TRUE if the player is a foreigner, FALSE otherwise.
|
||||
*/
|
||||
extern int mLd_PlayerManKindCheckNo(u8 player_no) {
|
||||
int foreigner = TRUE;
|
||||
if (player_no < PLAYER_NUM) {
|
||||
foreigner = FALSE;
|
||||
}
|
||||
int foreigner = TRUE;
|
||||
if (player_no < PLAYER_NUM) {
|
||||
foreigner = FALSE;
|
||||
}
|
||||
|
||||
return foreigner;
|
||||
return foreigner;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -240,7 +240,7 @@ extern int mLd_PlayerManKindCheckNo(u8 player_no) {
|
||||
* @return TRUE if the current player is a foreigner, FALSE otherwise.
|
||||
*/
|
||||
extern int mLd_PlayerManKindCheck() {
|
||||
return mLd_PlayerManKindCheckNo(Common_Get(player_no));
|
||||
return mLd_PlayerManKindCheckNo(Common_Get(player_no));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -250,23 +250,23 @@ extern int mLd_PlayerManKindCheck() {
|
||||
* @return TRUE if the town name and ID match the current town, FALSE otherwise.
|
||||
*/
|
||||
extern int mLd_CheckThisLand(u8* other_name, u16 other_id) {
|
||||
return mLd_CheckCmpLand(other_name, other_id, Save_Get(land_info.name), Save_Get(land_info.id));
|
||||
return mLd_CheckCmpLand(other_name, other_id, Save_Get(land_info.name), Save_Get(land_info.id));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Initializes the land information in the save data.
|
||||
*/
|
||||
extern void mLd_LandInfoInit() {
|
||||
mLd_land_info_c* land_info = Save_GetPointer(land_info);
|
||||
mLd_land_info_c* land_info = Save_GetPointer(land_info);
|
||||
|
||||
land_info->id = mLd_MakeLandId();
|
||||
land_info->exists = TRUE;
|
||||
land_info->id = mLd_MakeLandId();
|
||||
land_info->exists = TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Initializes the land data and clears all home information.
|
||||
*/
|
||||
extern void mLd_LandDataInit() {
|
||||
mLd_LandInfoInit();
|
||||
mHm_ClearAllHomeInfo();
|
||||
mLd_LandInfoInit();
|
||||
mHm_ClearAllHomeInfo();
|
||||
}
|
||||
|
||||
@@ -321,17 +321,19 @@ static void mMpswd_adjust_letter(u8* pswd_str) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < mMpswd_PASSWORD_STR_LEN; i++) {
|
||||
switch (pswd_str[i]) {
|
||||
switch (*pswd_str) {
|
||||
case CHAR_ZERO: {
|
||||
pswd_str[i] = CHAR_O; // 0 -> O
|
||||
*pswd_str = CHAR_O; // 0 -> O
|
||||
break;
|
||||
}
|
||||
|
||||
case CHAR_ONE: {
|
||||
pswd_str[i] = CHAR_l; // 1 -> l
|
||||
*pswd_str = CHAR_l; // 1 -> l
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
pswd_str++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -474,7 +476,7 @@ static void mMpswd_chg_8bits_code(u8* eightbits, u8* sixbits) {
|
||||
} while (TRUE);
|
||||
}
|
||||
|
||||
static void mMpswd_get_RSA_key_code(int* p, int* q, int* r, int** select_table, const u8* pswd) {
|
||||
static void mMpswd_get_RSA_key_code(int* p, int* q, int* r, int** select_table, u8* pswd) {
|
||||
u32 rsa_info = pswd[mMpswd_RSA_INFO_IDX];
|
||||
int p_idx = rsa_info & 3;
|
||||
int q_idx = (rsa_info >> 2) & 3;
|
||||
@@ -563,15 +565,22 @@ static void mMpswd_decode_RSA_cipher(u8* pswd) {
|
||||
pow = 1;
|
||||
|
||||
/* Calculate exponent d for decryption */
|
||||
do {
|
||||
for (pow = 1; ; pow++) {
|
||||
n = pow * pq_1 + 1;
|
||||
if (n % r == 0) {
|
||||
r = n / r;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// do {
|
||||
// n = pow * pq_1 + 1;
|
||||
// if (n % r == 0) {
|
||||
// r = n / r;
|
||||
// break;
|
||||
// }
|
||||
|
||||
pow++;
|
||||
} while (TRUE);
|
||||
// pow++;
|
||||
// } while (TRUE);
|
||||
|
||||
rsa_keysave = pswd[mMpswd_RSA_KEYSAVE_IDX];
|
||||
for (i = 0; i < 8; i++) {
|
||||
@@ -920,6 +929,7 @@ extern int mMpswd_password_zuru_check(mMpswd_password_c* password) {
|
||||
int cheated = TRUE;
|
||||
|
||||
if (password->type < mMpswd_CODETYPE_NUM) {
|
||||
u8* str_p;
|
||||
int checksum = 0;
|
||||
int i;
|
||||
|
||||
|
||||
+54
-68
@@ -404,36 +404,42 @@ static mActor_name_t mMP_GetFgBlockName(mMP_Ovl_c* map_ovl, int block_x, int blo
|
||||
}
|
||||
|
||||
static void mMP_set_house_data(mMP_Ovl_c* map_ovl, mSM_MenuInfo_c* menu) {
|
||||
static u8 akiya_str[PLAYER_NAME_LEN] = { CHAR_f, CHAR_r, CHAR_e, CHAR_e,
|
||||
CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE };
|
||||
static u8 akiya_str[PLAYER_NAME_LEN] = "free ";
|
||||
|
||||
mMP_ResidentInfo_c* resident_p = &map_ovl->player_info[0];
|
||||
mMP_LabelInfo_c* player_block_label = &map_ovl->label_info[1][2];
|
||||
Private_c* priv = Save_Get(private_data);
|
||||
mMP_HousePos_c* house_pos2;
|
||||
Animal_c* animal = Save_Get(animals);
|
||||
int residents;
|
||||
mMP_ResidentInfo_c* resident_p;
|
||||
mMP_LabelInfo_c* block_label;
|
||||
mMP_HousePos_c* house_pos;
|
||||
mMP_HousePos_c* house_pos_top;
|
||||
mMP_HousePos_Entry_c* pos_info;
|
||||
Private_c* priv;
|
||||
Animal_c* animal;
|
||||
Anmhome_c* home;
|
||||
int i;
|
||||
int j;
|
||||
int residents;
|
||||
mActor_name_t fgblock_name;
|
||||
|
||||
priv = Save_Get(private_data);
|
||||
animal = Save_Get(animals);
|
||||
resident_p = &map_ovl->player_info[0];
|
||||
block_label = &map_ovl->label_info[1][2];
|
||||
|
||||
/* Process player resident info first */
|
||||
|
||||
player_block_label->label_cnt = PLAYER_NUM;
|
||||
player_block_label->label_no = mMP_LABEL_PLAYER;
|
||||
block_label->label_cnt = PLAYER_NUM;
|
||||
block_label->label_no = mMP_LABEL_PLAYER;
|
||||
|
||||
residents = 0;
|
||||
for (i = 0; i < PLAYER_NUM; i++) {
|
||||
for (i = 0; i < PLAYER_NUM; i++, priv++) {
|
||||
if (mPr_CheckPrivate(priv) == TRUE && (Common_Get(now_private) != priv || mEv_CheckFirstIntro() == FALSE)) {
|
||||
mPr_CopyPlayerName(resident_p->name, priv->player_ID.player_name);
|
||||
resident_p->sex = priv->gender;
|
||||
resident_p->house_layer = 0;
|
||||
resident_p->house_idx = 0;
|
||||
|
||||
player_block_label->residents[residents] = resident_p;
|
||||
block_label->residents[residents] = resident_p;
|
||||
residents++;
|
||||
resident_p++;
|
||||
}
|
||||
|
||||
priv++;
|
||||
}
|
||||
|
||||
for (residents; residents < PLAYER_NUM; residents++, resident_p++) {
|
||||
@@ -441,83 +447,64 @@ static void mMP_set_house_data(mMP_Ovl_c* map_ovl, mSM_MenuInfo_c* menu) {
|
||||
resident_p->sex = -1;
|
||||
resident_p->house_layer = 0;
|
||||
|
||||
player_block_label->residents[residents] = resident_p;
|
||||
block_label->residents[residents] = resident_p;
|
||||
}
|
||||
|
||||
house_pos2 = mMP_house_pos_list;
|
||||
house_pos_top = mMP_house_pos_list;
|
||||
/* Process animal resident info next */
|
||||
resident_p = &map_ovl->animal_info[0];
|
||||
residents = 0;
|
||||
|
||||
for (i = 0; i < ANIMAL_NUM_MAX; i++, animal++, resident_p++) {
|
||||
if (mNpc_CheckFreeAnimalInfo(animal) == FALSE) {
|
||||
Anmhome_c* home = &animal->home_info;
|
||||
home = &animal->home_info;
|
||||
mNpc_GetNpcWorldNameAnm(resident_p->name, &animal->id);
|
||||
resident_p->sex = mNpc_GetLooks2Sex(animal->id.looks);
|
||||
resident_p->house_layer = mMP_check_layer(Common_Get(npclist[i].house_position.y));
|
||||
|
||||
{
|
||||
mActor_name_t fgblock_name = mMP_GetFgBlockName(map_ovl, home->block_x, home->block_z);
|
||||
mMP_HousePos_c* house_pos = house_pos2;
|
||||
mMP_HousePos_Entry_c* pos_info = house_pos[0].entries;
|
||||
fgblock_name = mMP_GetFgBlockName(map_ovl, home->block_x, home->block_z);
|
||||
house_pos = house_pos_top;
|
||||
pos_info = house_pos[0].entries;
|
||||
|
||||
for (house_pos; house_pos->fgblock_name != 0x03B8; house_pos++) {
|
||||
if (fgblock_name == house_pos->fgblock_name) {
|
||||
int j;
|
||||
pos_info = house_pos->entries;
|
||||
for (house_pos; house_pos->fgblock_name != 0x03B8; house_pos++) {
|
||||
if (fgblock_name == house_pos->fgblock_name) {
|
||||
pos_info = house_pos->entries;
|
||||
|
||||
for (j = 0; j < 3; j++, pos_info++) {
|
||||
if (pos_info->ut_x == home->ut_x && pos_info->ut_z == home->ut_z - 1) {
|
||||
break;
|
||||
}
|
||||
for (j = 0; j < 3; j++, pos_info++) {
|
||||
if (pos_info->ut_x == home->ut_x && pos_info->ut_z == home->ut_z - 1) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (j == 3) {
|
||||
pos_info = &house_pos->entries[0]; // default
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (j == 3) {
|
||||
pos_info = &house_pos->entries[0]; // default
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
resident_p->house_idx = pos_info->idx;
|
||||
}
|
||||
|
||||
{
|
||||
int bx = home->block_x - 1;
|
||||
int bz = home->block_z - 1;
|
||||
mMP_LabelInfo_c* label_info = &map_ovl->label_info[bz][bx];
|
||||
resident_p->house_idx = pos_info->idx;
|
||||
|
||||
label_info->residents[label_info->label_cnt] = resident_p;
|
||||
label_info->label_cnt++;
|
||||
label_info->label_no = mMP_LABEL_NPC;
|
||||
}
|
||||
block_label = &map_ovl->label_info[home->block_z - 1][home->block_x - 1];
|
||||
block_label->residents[block_label->label_cnt] = resident_p;
|
||||
block_label->label_cnt++;
|
||||
block_label->label_no = mMP_LABEL_NPC;
|
||||
}
|
||||
}
|
||||
|
||||
/* Sort villager houses by layer, with lower layers coming first */
|
||||
{
|
||||
mMP_ResidentInfo_c* resident;
|
||||
mMP_ResidentInfo_c* next_resident;
|
||||
mMP_LabelInfo_c* label_info = (mMP_LabelInfo_c*)map_ovl->label_info;
|
||||
for (i = 0; i < FG_BLOCK_TOTAL_NUM; i++) {
|
||||
if (label_info->label_no == mMP_LABEL_NPC && label_info->label_cnt > 1) {
|
||||
|
||||
int j;
|
||||
for (j = 0; j < label_info->label_cnt - 1; j++) {
|
||||
|
||||
resident = label_info->residents[j];
|
||||
next_resident = label_info->residents[j + 1];
|
||||
|
||||
if (resident->house_layer > next_resident->house_layer) {
|
||||
label_info->residents[j] = next_resident;
|
||||
label_info->residents[j + 1] = resident;
|
||||
j = -1;
|
||||
}
|
||||
block_label = (mMP_LabelInfo_c*)map_ovl->label_info;
|
||||
for (i = 0; i < FG_BLOCK_TOTAL_NUM; i++, block_label++) {
|
||||
if (block_label->label_no == mMP_LABEL_NPC && block_label->label_cnt > 1) {
|
||||
for (j = 0; j < block_label->label_cnt - 1; j++) {
|
||||
if (block_label->residents[j]->house_layer > block_label->residents[j + 1]->house_layer) {
|
||||
resident_p = block_label->residents[j];
|
||||
block_label->residents[j] = block_label->residents[j + 1];
|
||||
block_label->residents[j + 1] = resident_p;
|
||||
j = -1;
|
||||
}
|
||||
}
|
||||
|
||||
label_info++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -603,9 +590,8 @@ static void mMP_set_init_data(mMP_Ovl_c* map_ovl, mSM_MenuInfo_c* menu_info) {
|
||||
|
||||
mMP_set_map_texture_pal(map_ovl);
|
||||
|
||||
for (i = 0; i < FG_BLOCK_TOTAL_NUM; i++) {
|
||||
for (i = 0; i < FG_BLOCK_TOTAL_NUM; i++, label_info++) {
|
||||
label_info->label_cnt = 0;
|
||||
label_info++;
|
||||
}
|
||||
|
||||
mMP_set_house_data(map_ovl, menu_info);
|
||||
|
||||
@@ -3034,7 +3034,8 @@ static void mMkRm_EvaluateCompleteObstacle(int* points, mActor_name_t** layer_ut
|
||||
mActor_name_t item = ut_info[(ut_z * UT_Z_NUM) + ut_x];
|
||||
|
||||
if (ITEM_IS_FTR(item)) {
|
||||
int series = mMkRm_ftr_info[mRmTp_FtrItemNo2FtrIdx(item)].series;
|
||||
int ftr_no = mRmTp_FtrItemNo2FtrIdx(item);
|
||||
int series = mMkRm_ftr_info[ftr_no].series;
|
||||
|
||||
if (series != theme_idx) {
|
||||
obstacles++;
|
||||
@@ -3236,8 +3237,8 @@ static int mMkRm_EvaluateThemeSeriesComplete(int* points, int* complete_theme, m
|
||||
if (ftr_in_theme != 0) {
|
||||
u32 perfect_bit;
|
||||
int j;
|
||||
int wall_floor_idx = mMkRm_series_info[i].wall_floor_idx;
|
||||
u32 complete_bit = mMkRm_search_table[i];
|
||||
int wall_floor_idx = mMkRm_series_info[i].wall_floor_idx;
|
||||
#ifndef IMPROVEMENTS
|
||||
perfect_bit = 0;
|
||||
|
||||
@@ -3464,16 +3465,15 @@ static void mMkRm_InitSearchTable() {
|
||||
u32* search_table_p = mMkRm_search_table;
|
||||
int series;
|
||||
|
||||
for (series = 0; series < mMkRm_SERIES_NUM; series++) {
|
||||
for (series = 0; series < mMkRm_SERIES_NUM; series++, search_table_p++) {
|
||||
search_table_p[0] = 0;
|
||||
search_table_p++;
|
||||
}
|
||||
}
|
||||
|
||||
static void mMkRm_AssignIdxInGroup_BaseSeries(int series) {
|
||||
int i;
|
||||
int group_idx = mMkRm_NOT_NECESSITY;
|
||||
int num_ftr = 0;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < FTR_NUM; i++) {
|
||||
if (series == mMkRm_ftr_info[i].series) {
|
||||
@@ -3490,9 +3490,9 @@ static void mMkRm_AssignIdxInGroup_BaseSeries(int series) {
|
||||
}
|
||||
|
||||
static void mMkRm_AssignIdxInGroup_ThemeSeries(int series) {
|
||||
int i;
|
||||
int group_idx = 0;
|
||||
int num_ftr = 0;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < FTR_NUM; i++) {
|
||||
if (series == mMkRm_ftr_info[i].series) {
|
||||
@@ -3506,9 +3506,9 @@ static void mMkRm_AssignIdxInGroup_ThemeSeries(int series) {
|
||||
}
|
||||
|
||||
static void mMkRm_AssignIdxInGroup_SetSeries(int series) {
|
||||
int i;
|
||||
int group_idx = 0;
|
||||
int num_ftr = 0;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < FTR_NUM; i++) {
|
||||
if (series == mMkRm_ftr_info[i].series) {
|
||||
@@ -3522,9 +3522,9 @@ static void mMkRm_AssignIdxInGroup_SetSeries(int series) {
|
||||
}
|
||||
|
||||
static void mMkRm_AssignIdxInGroup_OneSeries(int series) {
|
||||
int i;
|
||||
int group_idx = 0;
|
||||
int num_ftr = 0;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < FTR_NUM; i++) {
|
||||
if (series == mMkRm_ftr_info[i].series) {
|
||||
|
||||
+599
-645
File diff suppressed because it is too large
Load Diff
+451
-449
File diff suppressed because it is too large
Load Diff
@@ -148,7 +148,7 @@ extern void mNW_AGB_to_GC_texture(u8* agb, u8* gc) {
|
||||
|
||||
for (i = 0; i < mNW_DESIGN_TEX_SIZE; i++) {
|
||||
u8 src = *agb++;
|
||||
*gc++ = (((src >> 4) & 0xF) | ((src & 0xF) << 4));
|
||||
*gc++ = (((src & 0xF0) >> 4) | ((src & 0xF) << 4));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -338,12 +338,11 @@ static void mNW_set_frame_dl(Submenu* submenu, GAME* game, mSM_MenuInfo_c* menu_
|
||||
extern Gfx sav_mark_winT_before_model[];
|
||||
|
||||
extern void mNW_draw_sav_mark_before(GAME* game) {
|
||||
GRAPH* graph = game->graph;
|
||||
int g;
|
||||
int prim_g;
|
||||
int env_g;
|
||||
|
||||
OPEN_POLY_OPA_DISP(graph);
|
||||
OPEN_POLY_OPA_DISP(game->graph);
|
||||
|
||||
gSPDisplayList(POLY_OPA_DISP++, sav_mark_winT_before_model);
|
||||
g = game->frame_counter % 40;
|
||||
@@ -356,7 +355,7 @@ extern void mNW_draw_sav_mark_before(GAME* game) {
|
||||
env_g = g * 3;
|
||||
gDPSetEnvColor(POLY_OPA_DISP++, env_g, 210 + g * 2, env_g, 255);
|
||||
|
||||
CLOSE_POLY_OPA_DISP(graph);
|
||||
CLOSE_POLY_OPA_DISP(game->graph);
|
||||
}
|
||||
|
||||
extern Gfx sav_mark_winT_model[];
|
||||
@@ -456,6 +455,22 @@ static void mNW_set_frame_dl_cpo(Submenu* submenu, GAME* game, mSM_MenuInfo_c* m
|
||||
CLOSE_POLY_OPA_DISP(graph);
|
||||
|
||||
mNW_draw_sav_mark_before(game);
|
||||
|
||||
// TODO: I don't like this devation. It's probably fake.
|
||||
#if VERSION >= VER_GAFU01_00
|
||||
{
|
||||
s16* y_p = mark_table_y;
|
||||
s16* x_p = mark_table_x;
|
||||
int j;
|
||||
for (j = 0; j < mNW_DESIGN_COUNT; j++, y_p++, x_p++) {
|
||||
if (mNW_check_mark_flg(submenu, j)) {
|
||||
Matrix_push();
|
||||
mNW_draw_sav_mark(game, *x_p, *y_p);
|
||||
Matrix_pull();
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
for (j = 0; j < mNW_DESIGN_COUNT; j++) {
|
||||
if (mNW_check_mark_flg(submenu, j)) {
|
||||
Matrix_push();
|
||||
@@ -463,6 +478,7 @@ static void mNW_set_frame_dl_cpo(Submenu* submenu, GAME* game, mSM_MenuInfo_c* m
|
||||
Matrix_pull();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void mNW_needlework_ovl_draw(Submenu* submenu, GAME* game) {
|
||||
|
||||
+106
-7
@@ -141,14 +141,12 @@ static void mNtc_operate_data_list() {
|
||||
|
||||
static void mNtc_sort_data_list() {
|
||||
mNtc_date_data_c replace_data;
|
||||
mNtc_date_data_c now_data;
|
||||
int replace_idx;
|
||||
int i, j;
|
||||
|
||||
/* sort from earliest to latest dates */
|
||||
for (i = 0; i < mNtc_DATA_LIST_NUM; i++) {
|
||||
now_data = mNtc_auto_nwrite_data[i];
|
||||
replace_data = now_data;
|
||||
replace_data = mNtc_auto_nwrite_data[i];
|
||||
replace_idx = i;
|
||||
|
||||
/* search through all entries ahead and find the next closest date */
|
||||
@@ -160,7 +158,7 @@ static void mNtc_sort_data_list() {
|
||||
}
|
||||
|
||||
/* swap the entries */
|
||||
mNtc_auto_nwrite_data[replace_idx] = now_data;
|
||||
mNtc_auto_nwrite_data[replace_idx] = mNtc_auto_nwrite_data[i];
|
||||
mNtc_auto_nwrite_data[i] = replace_data;
|
||||
}
|
||||
}
|
||||
@@ -283,6 +281,8 @@ static void mNtc_set_treasure_string(AnmPersonalID_c* sender_id, mActor_name_t i
|
||||
mHandbill_Set_free_str(5, land_name, land_name_len);
|
||||
}
|
||||
|
||||
// TODO: deviation implies fakematch
|
||||
#if VERSION != VER_GAFE01_00
|
||||
static void mNtc_check_treasure() {
|
||||
lbRTC_time_c* treasure_buried_time;
|
||||
lbRTC_time_c* treasure_checked_time;
|
||||
@@ -292,6 +292,104 @@ static void mNtc_check_treasure() {
|
||||
u32 comp_time_buried;
|
||||
lbRTC_time_c rtc_time;
|
||||
int valid_animal_ids[ANIMAL_NUM_MAX];
|
||||
int* valid_id_p;
|
||||
Animal_c* selected_animal;
|
||||
int valid_animal_num;
|
||||
int i;
|
||||
u8 header[mHandbill_FOOTER_LEN];
|
||||
u8 footer[mHandbill_FOOTER_LEN];
|
||||
int mem;
|
||||
int interval_days;
|
||||
int header_back_pos;
|
||||
mNtc_board_post_c post;
|
||||
mActor_name_t item;
|
||||
int b_x;
|
||||
int b_z;
|
||||
f32 rng;
|
||||
int list_type;
|
||||
|
||||
treasure_buried_time = Save_GetPointer(treasure_buried_time);
|
||||
treasure_checked_time = Save_GetPointer(treasure_checked_time);
|
||||
animal = Save_Get(animals);
|
||||
land_info = Save_GetPointer(land_info);
|
||||
valid_animal_num = 0;
|
||||
rtc_time = Common_Get(time.rtc_time);
|
||||
|
||||
if (rtc_time.hour >= mTM_FIELD_RENEW_HOUR) {
|
||||
comp_time_rtc = lbRTC_TIME_TO_U32(&rtc_time);
|
||||
comp_time_buried = lbRTC_TIME_TO_U32(treasure_buried_time);
|
||||
if (comp_time_rtc > comp_time_buried) {
|
||||
interval_days = lbRTC_GetIntervalDays(treasure_buried_time, &rtc_time);
|
||||
} else if (comp_time_rtc < comp_time_buried) {
|
||||
interval_days = lbRTC_GetIntervalDays(&rtc_time, treasure_buried_time);
|
||||
} else {
|
||||
interval_days = 0;
|
||||
}
|
||||
|
||||
if (lbRTC_IsEqualTime(treasure_buried_time, &mTM_rtcTime_clear_code, lbRTC_CHECK_ALL) ||
|
||||
interval_days >= mNtc_MIN_DAYS_BETWEEN_TREASURE) {
|
||||
if (lbRTC_IsEqualTime(treasure_checked_time, &mTM_rtcTime_clear_code, lbRTC_CHECK_ALL) ||
|
||||
treasure_checked_time->year != rtc_time.year || treasure_checked_time->month != rtc_time.month ||
|
||||
treasure_checked_time->day != rtc_time.day) {
|
||||
for (i = 0, valid_id_p = valid_animal_ids; i < ANIMAL_NUM_MAX; i++, animal++) {
|
||||
if (mNpc_CheckFreeAnimalPersonalID(&animal->id) == FALSE) {
|
||||
for (mem = 0; mem < ANIMAL_MEMORY_NUM; mem++) {
|
||||
if (animal->memories[mem].memory_player_id.land_id == land_info->id &&
|
||||
mLd_CheckCmpLandName(animal->memories[mem].memory_player_id.land_name,
|
||||
land_info->name)) {
|
||||
if (valid_animal_num == ANIMAL_NUM_MAX) {
|
||||
return;
|
||||
}
|
||||
|
||||
valid_animal_num++;
|
||||
*valid_id_p++ = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (valid_animal_num != 0 && fqrand() < mNtc_TREASURE_CHANCE) {
|
||||
b_x = 0;
|
||||
b_z = 0;
|
||||
|
||||
/* 1/3rd chance of pitfall, 2/3rds chance of rare furniture */
|
||||
rng = fqrand();
|
||||
if (rng < (1.0f / 3.0f)) {
|
||||
item = ITM_PITFALL;
|
||||
} else {
|
||||
list_type = rng < (2.0f / 3.0f)
|
||||
? mSP_LISTTYPE_LOTTERY
|
||||
: mSP_LISTTYPE_EVENT; /* 50/50 to roll redd or lottery furniture*/
|
||||
mSP_SelectRandomItem_New(NULL, &item, 1, NULL, 0, mSP_KIND_FURNITURE, list_type, FALSE);
|
||||
}
|
||||
|
||||
if (mFI_SetTreasure(&b_x, &b_z, item)) {
|
||||
selected_animal =
|
||||
Save_GetPointer(animals[valid_animal_ids[RANDOM(valid_animal_num) % valid_animal_num]]);
|
||||
mNtc_set_treasure_string(&selected_animal->id, item, b_x, b_z);
|
||||
lbRTC_TimeCopy(&post.post_time, &rtc_time);
|
||||
mHandbill_Load_HandbillFromRom(header, &header_back_pos, footer, post.message,
|
||||
0x1F0 + selected_animal->id.looks * 3 + (RANDOM(3) % 3));
|
||||
mNtc_notice_write(&post);
|
||||
lbRTC_TimeCopy(treasure_buried_time, &rtc_time);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
static void mNtc_check_treasure() {
|
||||
lbRTC_time_c* treasure_buried_time;
|
||||
lbRTC_time_c* treasure_checked_time;
|
||||
Animal_c* animal;
|
||||
mLd_land_info_c* land_info;
|
||||
u32 comp_time_rtc;
|
||||
u32 comp_time_buried;
|
||||
lbRTC_time_c rtc_time;
|
||||
int valid_animal_ids[ANIMAL_NUM_MAX];
|
||||
Animal_c* selected_animal;
|
||||
int valid_animal_num;
|
||||
int i;
|
||||
u8 header[mHandbill_FOOTER_LEN];
|
||||
@@ -362,12 +460,12 @@ static void mNtc_check_treasure() {
|
||||
}
|
||||
|
||||
if (mFI_SetTreasure(&b_x, &b_z, item)) {
|
||||
animal =
|
||||
selected_animal =
|
||||
Save_GetPointer(animals[valid_animal_ids[RANDOM(valid_animal_num) % valid_animal_num]]);
|
||||
mNtc_set_treasure_string(&animal->id, item, b_x, b_z);
|
||||
mNtc_set_treasure_string(&selected_animal->id, item, b_x, b_z);
|
||||
lbRTC_TimeCopy(&post.post_time, &rtc_time);
|
||||
mHandbill_Load_HandbillFromRom(header, &header_back_pos, footer, post.message,
|
||||
0x1F0 + animal->id.looks * 3 + (RANDOM(3) % 3));
|
||||
0x1F0 + selected_animal->id.looks * 3 + (RANDOM(3) % 3));
|
||||
mNtc_notice_write(&post);
|
||||
lbRTC_TimeCopy(treasure_buried_time, &rtc_time);
|
||||
}
|
||||
@@ -376,6 +474,7 @@ static void mNtc_check_treasure() {
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void mNtc_set_near_old_nwrite_data(lbRTC_time_c* nwrite_time, lbRTC_year_t* nwrite_year, u8* nwrite_num) {
|
||||
mNtc_date_data_c* auto_nwrite_p;
|
||||
|
||||
@@ -403,6 +403,11 @@ static void mNT_notice_ovl_move(Submenu* submenu) {
|
||||
(*ovl_move_proc[menu_info->proc_status])(submenu, menu_info);
|
||||
}
|
||||
|
||||
#if VERSION >= VER_GAFU01_00
|
||||
static void mNT_notice_draw_init(mSM_MenuInfo_c* menu_info) {
|
||||
// stubbed
|
||||
}
|
||||
#else
|
||||
static u8** mNT_notice_draw_init(mSM_MenuInfo_c* menu_info) {
|
||||
u8** tex_p = kei_win_st_tex_tbl;
|
||||
int i;
|
||||
@@ -413,6 +418,7 @@ static u8** mNT_notice_draw_init(mSM_MenuInfo_c* menu_info) {
|
||||
|
||||
return tex_p;
|
||||
}
|
||||
#endif
|
||||
|
||||
extern Gfx kei_win_model[];
|
||||
|
||||
|
||||
+119
-24
@@ -2723,14 +2723,15 @@ static void mNpc_SetNpcHome(Animal_c* animal, Anmhome_c* reserved, u8 reserved_n
|
||||
idx = fake_table_p[n];
|
||||
|
||||
if (idx >= reserved_num) {
|
||||
/* I don't like this */
|
||||
while ((idx = fake_table_p[n], idx >= reserved_num) && n < reserved_num) {
|
||||
while ((fake_table_p[n] >= reserved_num) && n < reserved_num) {
|
||||
n++;
|
||||
}
|
||||
|
||||
if (n >= reserved_num) {
|
||||
return;
|
||||
}
|
||||
|
||||
idx = fake_table_p[n];
|
||||
}
|
||||
|
||||
if (idx < reserved_num) {
|
||||
@@ -4330,6 +4331,7 @@ static int mNpc_GrowLooksNpcIdx(u8 looks) {
|
||||
}
|
||||
|
||||
if (candidates > 0) {
|
||||
looks_table = npc_looks_table;
|
||||
selected = RANDOM(candidates);
|
||||
npc_idx = 0;
|
||||
|
||||
@@ -4338,7 +4340,7 @@ static int mNpc_GrowLooksNpcIdx(u8 looks) {
|
||||
break;
|
||||
}
|
||||
|
||||
for (j = 0; j < 8; j++) {
|
||||
for (j = 0; j < 8; looks_table++, npc_idx++, j++) {
|
||||
if (npc_idx >= NPC_NUM) {
|
||||
break;
|
||||
}
|
||||
@@ -4351,8 +4353,6 @@ static int mNpc_GrowLooksNpcIdx(u8 looks) {
|
||||
selected--;
|
||||
}
|
||||
}
|
||||
|
||||
npc_idx++;
|
||||
}
|
||||
|
||||
if (res != -1) {
|
||||
@@ -4617,7 +4617,6 @@ extern int mNpc_GetMakeUtNuminBlock_hard_area(int* ut_x, int* ut_z, int bx, int
|
||||
int now_ut_x;
|
||||
int now_ut_z;
|
||||
mCoBG_Collision_u* col;
|
||||
mCoBG_Collision_u* col_p;
|
||||
mActor_name_t* items;
|
||||
int min_ut_x;
|
||||
int min_ut_z;
|
||||
@@ -4639,14 +4638,10 @@ extern int mNpc_GetMakeUtNuminBlock_hard_area(int* ut_x, int* ut_z, int bx, int
|
||||
if (items != NULL && col != NULL) {
|
||||
for (i = restrict_area; i < UT_Z_NUM - restrict_area; i++) {
|
||||
for (j = restrict_area; j < UT_X_NUM - restrict_area; j++) {
|
||||
col_p = &col[i * UT_X_NUM + j];
|
||||
|
||||
if (mNpc_CheckNpcSet_fgcol_hard(items[i * UT_X_NUM + j], col_p->data.unit_attribute) == TRUE) {
|
||||
center = col_p->data.center;
|
||||
|
||||
if (mNpc_CheckNpcSet_fgcol_hard(items[i * UT_X_NUM + j], col[i * UT_X_NUM + j].data.unit_attribute) == TRUE) {
|
||||
/* Check that the height of each point on the unit is equal*/
|
||||
if ((int)center == col_p->data.top_left && center == col_p->data.bot_left &&
|
||||
center == col_p->data.bot_right && (int)center == col_p->data.top_right) {
|
||||
if (col[i * UT_X_NUM + j].data.center == col[i * UT_X_NUM + j].data.top_left && col[i * UT_X_NUM + j].data.center == col[i * UT_X_NUM + j].data.bot_left &&
|
||||
col[i * UT_X_NUM + j].data.center == col[i * UT_X_NUM + j].data.bot_right && col[i * UT_X_NUM + j].data.center == col[i * UT_X_NUM + j].data.top_right) {
|
||||
|
||||
now_ut_x = 8 - j;
|
||||
now_ut_z = 8 - i;
|
||||
@@ -4801,10 +4796,7 @@ extern int mNpc_GetMakeUtNuminBlock_hide_hard_area(int* ut_x, int* ut_z, int bx,
|
||||
int now_ut_z;
|
||||
int now_ut_x;
|
||||
mCoBG_Collision_u* col_top;
|
||||
mCoBG_Collision_u* col_p;
|
||||
mActor_name_t* fg_top;
|
||||
mActor_name_t* item_p;
|
||||
u32 center;
|
||||
int min_ut_x;
|
||||
int min_ut_z;
|
||||
int res;
|
||||
@@ -4827,15 +4819,10 @@ extern int mNpc_GetMakeUtNuminBlock_hide_hard_area(int* ut_x, int* ut_z, int bx,
|
||||
|
||||
for (i = restrict_area; i < UT_Z_NUM - restrict_area; i++) {
|
||||
for (j = restrict_area; j < UT_X_NUM - restrict_area; j++) {
|
||||
item_p = &fg_top[i * UT_X_NUM + j];
|
||||
col_p = &col_top[i * UT_X_NUM + j];
|
||||
|
||||
if (mNpc_CheckNpcSet_fgcol_hard(item_p[0], col_p->data.unit_attribute) == TRUE) {
|
||||
center = col_p->data.center;
|
||||
|
||||
if (mNpc_CheckNpcSet_fgcol_hard(fg_top[i * UT_X_NUM + j], col_top[i * UT_X_NUM + j].data.unit_attribute) == TRUE) {
|
||||
/* Check that the height of each point on the unit is equal*/
|
||||
if ((int)center == col_p->data.top_left && center == col_p->data.bot_left &&
|
||||
center == col_p->data.bot_right && (int)center == col_p->data.top_right &&
|
||||
if (col_top[i * UT_X_NUM + j].data.center == col_top[i * UT_X_NUM + j].data.top_left && col_top[i * UT_X_NUM + j].data.center == col_top[i * UT_X_NUM + j].data.bot_left &&
|
||||
col_top[i * UT_X_NUM + j].data.center == col_top[i * UT_X_NUM + j].data.bot_right && col_top[i * UT_X_NUM + j].data.center == col_top[i * UT_X_NUM + j].data.top_right &&
|
||||
((hide_ut_bit[i] >> j) & 1) == 1) {
|
||||
|
||||
now_ut_x = 8 - j;
|
||||
@@ -5753,6 +5740,113 @@ extern int mNpc_CheckFtrIsIslandNormalFtr(mActor_name_t ftr) {
|
||||
return res;
|
||||
}
|
||||
|
||||
// TODO: The deviation here is likely fakematch
|
||||
#if VERSION != VER_GAFE01_00
|
||||
extern int mNpc_SetIslandFtr(PersonalID_c* pid, mActor_name_t ftr) {
|
||||
int n;
|
||||
Anmmem_c* memory;
|
||||
mActor_name_t* island_room;
|
||||
mActor_name_t rsv_item;
|
||||
int variant;
|
||||
int set;
|
||||
int direct;
|
||||
int i;
|
||||
int j;
|
||||
int slot;
|
||||
int mem_idx;
|
||||
|
||||
memory = Save_Get(island).animal.memories;
|
||||
island_room = mNpc_GetIslandRoomP(Save_Get(island).animal.id.npc_id);
|
||||
n = 0;
|
||||
rsv_item = EMPTY_NO;
|
||||
set = FALSE;
|
||||
slot = 0;
|
||||
direct = 0;
|
||||
|
||||
if (ITEM_IS_FTR(ftr) && island_room != NULL && pid != NULL && mPr_NullCheckPersonalID(pid) == FALSE) {
|
||||
mem_idx = mNpc_GetAnimalMemoryIdx(pid, memory, ANIMAL_MEMORY_NUM);
|
||||
|
||||
if (mem_idx == -1) {
|
||||
memory = &memory[mNpc_ForceGetFreeAnimalMemoryIdx(&Save_Get(island).animal, memory, ANIMAL_MEMORY_NUM)];
|
||||
mNpc_SetAnimalMemory(pid, &Save_Get(island).animal.id, memory);
|
||||
} else {
|
||||
memory = &memory[mem_idx];
|
||||
}
|
||||
|
||||
/* Unnecessary NULL check, memory is guaranteed to exist */
|
||||
if (memory != NULL) {
|
||||
if (mNpc_CheckFtrIsIslandBestFtr(ftr) == TRUE) {
|
||||
int idx = mNpc_GetIslandFtrIdx(ftr);
|
||||
|
||||
if (idx != -1 && mNpc_CheckIslandNpcRoomFtrIdx(idx) == -1) {
|
||||
memory->memuni.island.have_bitfield |= (1 << idx);
|
||||
set = TRUE;
|
||||
}
|
||||
} else {
|
||||
mActor_name_t ftr_variant0;
|
||||
mActor_name_t ftr_variant1;
|
||||
int ftr_unit = aMR_GetFurnitureUnit(ftr);
|
||||
|
||||
if (ftr_unit == mRmTp_FTRSIZE_1x1) {
|
||||
ftr_variant0 = RSV_ISLAND_FTR0;
|
||||
ftr_variant1 = RSV_ISLAND_FTR4;
|
||||
} else {
|
||||
ftr_variant0 = RSV_ISLAND_FTR0 + (ftr_unit + 1) * 4;
|
||||
ftr_variant1 = EMPTY_NO;
|
||||
}
|
||||
|
||||
for (i = 0; i < UT_TOTAL_NUM; i++) {
|
||||
if (ITEM_IS_FTR(*island_room)) {
|
||||
n++;
|
||||
} else if (*island_room >= RSV_ISLAND_FTR0 && *island_room <= RSV_ISLAND_FTR15) {
|
||||
variant = -1;
|
||||
|
||||
for (j = 0; j < mRmTp_DIRECT_NUM; j++) {
|
||||
if (*island_room == (mActor_name_t)(ftr_variant0 + j)) {
|
||||
direct = j;
|
||||
variant = 0;
|
||||
break;
|
||||
} else if (*island_room == (mActor_name_t)(ftr_variant1 + j)) {
|
||||
direct = j;
|
||||
variant = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (variant != -1 && mNpc_CheckIslandNpcRoomFtrIdx(n) == -1) {
|
||||
memory->memuni.island.have_bitfield |= (1 << n);
|
||||
|
||||
if (variant == 0) {
|
||||
slot = (ftr_variant0 - RSV_ISLAND_FTR0) / mNpc_ISLAND_FTR_SAVE_NUM;
|
||||
} else {
|
||||
slot = (ftr_variant1 - RSV_ISLAND_FTR0) / mNpc_ISLAND_FTR_SAVE_NUM;
|
||||
}
|
||||
|
||||
if (slot < mNpc_ISLAND_FTR_SAVE_NUM) {
|
||||
Save_Get(island).animal.anmuni.island_ftr[slot] =
|
||||
aMR_FurnitureFg_to_FurnitureFgWithDirect(ftr, direct);
|
||||
set = TRUE;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
n++;
|
||||
}
|
||||
|
||||
if (n == mNpc_ISLAND_FTR_NUM) {
|
||||
break;
|
||||
}
|
||||
|
||||
island_room++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return set;
|
||||
}
|
||||
#else
|
||||
extern int mNpc_SetIslandFtr(PersonalID_c* pid, mActor_name_t ftr) {
|
||||
int n;
|
||||
Anmmem_c* memory;
|
||||
@@ -5858,6 +5952,7 @@ extern int mNpc_SetIslandFtr(PersonalID_c* pid, mActor_name_t ftr) {
|
||||
|
||||
return set;
|
||||
}
|
||||
#endif
|
||||
|
||||
extern int mNpc_EraseIslandFtr(mActor_name_t ftr) {
|
||||
int n;
|
||||
|
||||
+34
-20
@@ -31,13 +31,13 @@
|
||||
/* Static function declarations, add as needed for intellisense */
|
||||
static void Player_actor_Item_Setup_main(ACTOR* actor, int now, int last);
|
||||
static mActor_name_t Player_actor_Get_ItemNoSubmenu(void);
|
||||
static int Player_actor_request_main_broken_axe_type_swing(GAME* game, const xyz_t* pos, mActor_name_t hit_item,
|
||||
static int Player_actor_request_main_broken_axe_type_swing(GAME* game, xyz_t* pos, mActor_name_t hit_item,
|
||||
int hit_ut_x, int hit_ut_z, int priority);
|
||||
static int Player_actor_request_main_swing_axe_all(GAME* game, const xyz_t* pos, mActor_name_t hit_item, u16 damage_no,
|
||||
static int Player_actor_request_main_swing_axe_all(GAME* game, xyz_t* pos, mActor_name_t hit_item, u16 damage_no,
|
||||
int hit_ut_x, int hit_ut_z, int priority);
|
||||
static int Player_actor_request_main_broken_axe_type_reflect(GAME* game, const xyz_t* pos, mActor_name_t hit_item,
|
||||
static int Player_actor_request_main_broken_axe_type_reflect(GAME* game, xyz_t* pos, mActor_name_t hit_item,
|
||||
ACTOR* hit_actor, int priority);
|
||||
static int Player_actor_request_main_reflect_axe_all(GAME* game, const xyz_t* pos, mActor_name_t hit_item,
|
||||
static int Player_actor_request_main_reflect_axe_all(GAME* game, xyz_t* pos, mActor_name_t hit_item,
|
||||
u16 damage_no, ACTOR* hit_actor, int priority);
|
||||
static int Player_actor_request_main_air_axe_all(GAME* game, int priority);
|
||||
static int Player_actor_request_main_rotate_umbrella_all(GAME* game, int prio);
|
||||
@@ -306,8 +306,8 @@ static int Player_actor_request_main_release_creature_all(GAME* game, int type,
|
||||
ACTOR* release_actor_p, int prio);
|
||||
static int Player_actor_request_main_complete_payment(GAME* game, int prio);
|
||||
static int Player_actor_request_main_push(GAME* game, int ftr_no, s16 angle_y, xyz_t* pos, int priority);
|
||||
static int Player_actor_request_main_pull(GAME* game, int ftr_no, s16 angle, xyz_t* start_pos, xyz_t* end_pos,
|
||||
xyz_t* ofs, int priority);
|
||||
static int Player_actor_request_main_pull(GAME* game, int ftr_no, s16 angle, const xyz_t* start_pos, const xyz_t* end_pos,
|
||||
const xyz_t* ofs, int priority);
|
||||
static int Player_actor_request_main_rotate_furniture(GAME* game, int ftr_no, s16 angle, xyz_t* pos, int type,
|
||||
int priority);
|
||||
static int Player_actor_request_main_open_furniture(GAME* game, s16 angle, xyz_t* pos, int anim_idx, int priority);
|
||||
@@ -505,18 +505,13 @@ static int Player_actor_request_main_demo_getoff_boat_all(GAME* game, const xyz_
|
||||
|
||||
static void Player_actor_init_value(ACTOR* actorx, GAME* game) {
|
||||
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
||||
GAME_PLAY* play = (GAME_PLAY*)game;
|
||||
int* shake_tree_table_ut_x_p;
|
||||
int* shake_tree_table_ut_z_p;
|
||||
s8* radio_exercise_command_ring_buffer_p;
|
||||
int i;
|
||||
|
||||
player->actor_class.gravity = -1.0f;
|
||||
player->actor_class.max_velocity_y = -8.0f;
|
||||
player->actor_class.scale.x = 0.01f;
|
||||
player->actor_class.scale.y = 0.01f;
|
||||
player->actor_class.scale.z = 0.01f;
|
||||
player->balloon_actor = Actor_info_make_actor(&play->actor_info, game, mAc_PROFILE_BALLOON,
|
||||
player->balloon_actor = Actor_info_make_actor(&((GAME_PLAY*)game)->actor_info, game, mAc_PROFILE_BALLOON,
|
||||
actorx->world.position.x, actorx->world.position.y,
|
||||
actorx->world.position.z, 0, 0, 0, -1, -1, -1, EMPTY_NO, -1, -1, -1);
|
||||
player->animation0_idx = -1;
|
||||
@@ -603,17 +598,36 @@ static void Player_actor_init_value(ACTOR* actorx, GAME* game) {
|
||||
player->Check_able_force_speak_label_proc = &Player_actor_Check_able_force_speak_label;
|
||||
player->Check_stung_mosquito_proc = &Player_actor_Check_stung_mosquito;
|
||||
|
||||
shake_tree_table_ut_x_p = player->shake_tree_ut_x;
|
||||
shake_tree_table_ut_z_p = player->shake_tree_ut_z;
|
||||
for (i = 0; i < 3; i++) {
|
||||
*shake_tree_table_ut_x_p++ = -1;
|
||||
*shake_tree_table_ut_z_p++ = -1;
|
||||
{
|
||||
int* shake_tree_table_ut_x_p = player->shake_tree_ut_x;
|
||||
int* shake_tree_table_ut_z_p = player->shake_tree_ut_z;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
*shake_tree_table_ut_x_p++ = -1;
|
||||
*shake_tree_table_ut_z_p++ = -1;
|
||||
}
|
||||
}
|
||||
|
||||
radio_exercise_command_ring_buffer_p = player->radio_exercise_command_ring_buffer;
|
||||
for (i = 0; i < 8; i++) {
|
||||
*radio_exercise_command_ring_buffer_p++ = -1;
|
||||
// TODO: I don't like this deviation between 1.3.2/US AC and 2.0/Aus AC
|
||||
#if VERSION >= VER_GAFU01_00
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 8; i++) {
|
||||
player->radio_exercise_command_ring_buffer[i] = -1;
|
||||
}
|
||||
}
|
||||
#else
|
||||
{
|
||||
s8* radio_exercise_command_ring_buffer_p = player->radio_exercise_command_ring_buffer;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 8; i++) {
|
||||
*radio_exercise_command_ring_buffer_p++ = -1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
Player_actor_Set_old_sound_frame_counter(actorx);
|
||||
}
|
||||
|
||||
@@ -3250,11 +3250,19 @@ static int Player_actor_Check_axe_after(ACTOR* actorx, xyz_t* target_pos_p, mAct
|
||||
}
|
||||
|
||||
for (i = 0; i < unit_count; i++) {
|
||||
// TODO: this feels fake, unlikely to have been changed between US and Aus
|
||||
#if VERSION == VER_GAFE01_00
|
||||
unit_center_p = &unit_center_pos[i];
|
||||
unit_exist_table[i] = mFI_Wpos2UtCenterWpos(unit_center_p, unit_pos[i]);
|
||||
if (unit_exist_table[i] != FALSE) {
|
||||
f32 dx = unit_center_p->x - player_move_pos.x;
|
||||
f32 dz = unit_center_p->z - player_move_pos.z;
|
||||
#else
|
||||
unit_exist_table[i] = mFI_Wpos2UtCenterWpos(&unit_center_pos[i], unit_pos[i]);
|
||||
if (unit_exist_table[i] != FALSE) {
|
||||
f32 dx = unit_center_pos[i].x - player_move_pos.x;
|
||||
f32 dz = unit_center_pos[i].z - player_move_pos.z;
|
||||
#endif
|
||||
f32 dist_center = Math3DVecLength2D(dx, dz);
|
||||
int angle_center = atans_table(dz, dx) - player_angle_y;
|
||||
int abs_angle_center = ABS(angle_center);
|
||||
@@ -3684,7 +3692,7 @@ static int Player_actor_Set_ScrollDemo_forDemo_wade(ACTOR* actorx) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static int Player_actor_Set_ScrollDemo_forDemo_geton_boat_wade(ACTOR* actorx, s16 angle_y, f32 border_start) {
|
||||
static int Player_actor_Set_ScrollDemo_forDemo_geton_boat_wade(ACTOR* actorx, f32 border_start, s16 angle_y) {
|
||||
int dir = Player_actor_CheckAbleMoveDemoWadeBoatBlock(actorx, angle_y, border_start);
|
||||
|
||||
if (dir != mFI_MOVEDIR_NONE) {
|
||||
@@ -4245,8 +4253,14 @@ static int Player_actor_able_request_main_index_for_reset(int request_main_index
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#if VERSION >= VER_GAFU01_00
|
||||
#define Player_actor_RESET_COUNT_FOR_RESET 4
|
||||
#else
|
||||
#define Player_actor_RESET_COUNT_FOR_RESET 2
|
||||
#endif
|
||||
|
||||
static int Player_actor_check_able_request_main_index_for_reset(int request_main_index) {
|
||||
if (Common_Get(reset_flag) && Now_Private->reset_count == 2 &&
|
||||
if (Common_Get(reset_flag) && Now_Private->reset_count == Player_actor_RESET_COUNT_FOR_RESET &&
|
||||
Player_actor_able_request_main_index_for_reset(request_main_index) != FALSE) {
|
||||
if (Common_Get(reset_type) != 3) {
|
||||
Common_Set(reset_type, 3);
|
||||
@@ -7154,7 +7168,7 @@ static void Player_actor_Get_PickupHandPosition(ACTOR* actorx, xyz_t* pos_p, f32
|
||||
pos_p->z += z;
|
||||
}
|
||||
|
||||
static void Player_actor_Get_ItemDisplayPos(xyz_t* item_pos_p, xyz_t* center_pos_p) {
|
||||
static void Player_actor_Get_ItemDisplayPos(xyz_t* item_pos_p, const xyz_t* center_pos_p) {
|
||||
if (Common_Get(clip).bg_item_clip != NULL && Common_Get(clip).bg_item_clip->rand_pos_get_proc != NULL) {
|
||||
const xyz_t pos = *center_pos_p;
|
||||
|
||||
@@ -8088,7 +8102,10 @@ static void Player_actor_Check_player_change_color_for_main(ACTOR* actorx) {
|
||||
}
|
||||
}
|
||||
|
||||
#if VERSION == VER_GAFE01_00
|
||||
static int Player_actor_Check_InBlockRadioExercise(ACTOR* actorx) {
|
||||
// @BUG - the logic in this prevents radio exercise from working
|
||||
// indoors when an aerobics event is active
|
||||
if (mEv_check_status(mEv_EVENT_MORNING_AEROBICS, mEv_STATUS_RUN) ||
|
||||
mEv_check_status(mEv_EVENT_SPORTS_FAIR_AEROBICS, mEv_STATUS_RUN)) {
|
||||
int bx;
|
||||
@@ -8115,6 +8132,33 @@ static int Player_actor_Check_InBlockRadioExercise(ACTOR* actorx) {
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
#else
|
||||
static int Player_actor_Check_InBlockRadioExercise(ACTOR* actorx) {
|
||||
int field_type = Common_Get(field_type);
|
||||
if (field_type == mFI_FIELDTYPE2_FG) {
|
||||
if (mEv_check_status(mEv_EVENT_MORNING_AEROBICS, mEv_STATUS_RUN) ||
|
||||
mEv_check_status(mEv_EVENT_SPORTS_FAIR_AEROBICS, mEv_STATUS_RUN)) {
|
||||
int bx;
|
||||
int bz;
|
||||
|
||||
if (mFI_BlockKind2BkNum(&bx, &bz, mRF_BLOCKKIND_SHRINE)) {
|
||||
int player_bx;
|
||||
int player_bz;
|
||||
|
||||
if (mFI_Wpos2BlockNum(&player_bx, &player_bz, actorx->world.position)) {
|
||||
if (player_bx == bx && player_bz == bz) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (aMR_RadioBgmNow()) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int Player_actor_Check_AbleRadioExercise(ACTOR* actorx) {
|
||||
/* Player must be in the same block as aerobics radio, or in a house room with one playing */
|
||||
@@ -8547,3 +8591,11 @@ static void Player_actor_Set_Indoor_Camera_Index(ACTOR* actorx, GAME* game) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if VERSION >= VER_GAFU01_00
|
||||
static void Player_actor_Reset_item_net_catch_correct_pos(ACTOR* actorx) {
|
||||
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actorx;
|
||||
|
||||
player->item_net_catch_correct_pos_set = FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -374,4 +374,18 @@ static void Player_actor_draw_Normal(ACTOR* actorx, GAME* game) {
|
||||
if (moving_in_boat) {
|
||||
Matrix_pull();
|
||||
}
|
||||
|
||||
#if VERSION >= VER_GAFU01_00
|
||||
if (player->item_net_catch_correct_pos_set) {
|
||||
TOOLS_ACTOR* label = (TOOLS_ACTOR*)player->item_net_catch_label;
|
||||
|
||||
if (label != NULL && player->item_net_catch_type == mPlayer_NET_CATCH_TYPE_INSECT) {
|
||||
Matrix_push();
|
||||
Matrix_translate(player->item_net_catch_correct_pos.x, player->item_net_catch_correct_pos.y, player->item_net_catch_correct_pos.z, MTX_LOAD);
|
||||
Matrix_get(&label->matrix_work);
|
||||
Matrix_pull();
|
||||
label->init_matrix = TRUE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ static s8 Player_actor_Get_ItemKind(ACTOR* actor, int kind) {
|
||||
|
||||
static int Player_actor_Get_BasicItemMainIndex_fromItemKind(int kind) {
|
||||
// clang-format off
|
||||
static const s8 data[] = {
|
||||
static const s8 data[mPlayer_ITEM_KIND_NUM+1] = {
|
||||
mPlayer_ITEM_MAIN_AXE_NORMAL,
|
||||
mPlayer_ITEM_MAIN_AXE_NORMAL,
|
||||
mPlayer_ITEM_MAIN_AXE_NORMAL,
|
||||
@@ -384,7 +384,18 @@ static void Player_actor_LoadOrDestruct_Item(ACTOR* actor, int kind, int anim_id
|
||||
}
|
||||
}
|
||||
|
||||
static void Player_actor_CorrectSomething_net(ACTOR* actor, xyz_t* pos) {
|
||||
#if VERSION >= VER_GAFU01_00
|
||||
static void Player_actor_CorrectSomething_net(ACTOR* actor, const xyz_t* pos) {
|
||||
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actor;
|
||||
TOOLS_ACTOR* label = (TOOLS_ACTOR*)player->item_net_catch_label;
|
||||
|
||||
if (label != NULL && player->item_net_catch_type == mPlayer_NET_CATCH_TYPE_INSECT && !player->item_net_catch_correct_pos_set) {
|
||||
player->item_net_catch_correct_pos = *pos;
|
||||
player->item_net_catch_correct_pos_set = TRUE;
|
||||
}
|
||||
}
|
||||
#else
|
||||
static void Player_actor_CorrectSomething_net(ACTOR* actor, const xyz_t* pos) {
|
||||
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actor;
|
||||
TOOLS_ACTOR* label = (TOOLS_ACTOR*)player->item_net_catch_label;
|
||||
|
||||
@@ -396,6 +407,7 @@ static void Player_actor_CorrectSomething_net(ACTOR* actor, xyz_t* pos) {
|
||||
label->init_matrix = TRUE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static int Player_actor_Check_ItemAnimationToItemKind(int kind, int anim) {
|
||||
int res;
|
||||
|
||||
+12
-2
@@ -2176,8 +2176,11 @@ extern int mPlib_request_main_groundhog_type1(GAME* game) {
|
||||
}
|
||||
|
||||
extern int mPlib_request_main_door_type1(GAME* game, const xyz_t* pos_p, s16 angle_y, int door_type, void* door_label) {
|
||||
return GET_PLAYER_ACTOR_GAME(game)->request_main_door_all_proc(game, pos_p, angle_y, door_type, door_label,
|
||||
mPlayer_REQUEST_PRIORITY_7) != FALSE;
|
||||
if (GET_PLAYER_ACTOR_GAME(game)->request_main_door_all_proc(game, pos_p, angle_y, door_type, door_label,
|
||||
mPlayer_REQUEST_PRIORITY_7)) {
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
extern int mPlib_request_main_door_type2(GAME* game, const xyz_t* pos_p, s16 angle_y, int door_type, void* door_label) {
|
||||
@@ -3181,6 +3184,13 @@ extern int mPlib_Check_scoop_after(GAME* game, xyz_t* pos_p, mActor_name_t* item
|
||||
/* Don't let the player hit NPCs with the shovel */
|
||||
hit_actor_p = mPlib_Search_exist_npc_inCircle_forScoop(game, pos_p, SQ(39.0f));
|
||||
if (hit_actor_p != NULL) {
|
||||
#if VERSION >= VER_GAFU01_00
|
||||
if (is_stone_tencoin) {
|
||||
*item_p = scoop_fg;
|
||||
return mPlayer_INDEX_REFLECT_SCOOP;
|
||||
}
|
||||
#endif
|
||||
|
||||
return mPlayer_INDEX_AIR_SCOOP;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
static int Player_actor_request_main_broken_axe_type_reflect(GAME* game, const xyz_t* pos, mActor_name_t hit_item,
|
||||
static int Player_actor_request_main_broken_axe_type_reflect(GAME* game, xyz_t* pos, mActor_name_t hit_item,
|
||||
ACTOR* hit_actor, int priority) {
|
||||
if (Player_actor_check_request_main_able(game, mPlayer_INDEX_BROKEN_AXE, priority)) {
|
||||
PLAYER_ACTOR* player = GET_PLAYER_ACTOR_GAME(game);
|
||||
@@ -13,7 +13,7 @@ static int Player_actor_request_main_broken_axe_type_reflect(GAME* game, const x
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
static int Player_actor_request_main_broken_axe_type_swing(GAME* game, const xyz_t* pos, mActor_name_t hit_item,
|
||||
static int Player_actor_request_main_broken_axe_type_swing(GAME* game, xyz_t* pos, mActor_name_t hit_item,
|
||||
int hit_ut_x, int hit_ut_z, int priority) {
|
||||
if (Player_actor_check_request_main_able(game, mPlayer_INDEX_BROKEN_AXE, priority)) {
|
||||
PLAYER_ACTOR* player = GET_PLAYER_ACTOR_GAME(game);
|
||||
|
||||
@@ -15,8 +15,13 @@ static void Player_actor_setup_main_Complete_payment(ACTOR* actorx, GAME* game)
|
||||
complete_payment_p->timer = 0.0f;
|
||||
complete_payment_p->msg_mode = 0;
|
||||
|
||||
#if VERSION >= VER_GAFU01_00
|
||||
Player_actor_InitAnimation_Base2(actorx, game, mPlayer_ANIM_YATTA1, mPlayer_ANIM_YATTA1, 1.0f, 1.0f, 0.6f, 0.0f,
|
||||
cKF_FRAMECONTROL_STOP, mPlayer_PART_TABLE_NORMAL);
|
||||
#else
|
||||
Player_actor_InitAnimation_Base2(actorx, game, mPlayer_ANIM_YATTA1, mPlayer_ANIM_YATTA1, 1.0f, 1.0f, 0.5f, 0.0f,
|
||||
cKF_FRAMECONTROL_STOP, mPlayer_PART_TABLE_NORMAL);
|
||||
#endif
|
||||
Player_actor_setup_main_Base(actorx, game);
|
||||
bgm_num = Player_actor_sound_Get_bgm_num_forCompletePayment();
|
||||
mBGMPsComp_make_ps_fanfare(bgm_num, 0x168);
|
||||
|
||||
@@ -109,22 +109,24 @@ static void Player_actor_BGcheck_Dash(ACTOR* actor) {
|
||||
}
|
||||
|
||||
static int Player_actor_Check_FlatPlace(ACTOR* actor) {
|
||||
static const xy_t offset[] = {
|
||||
static const float offset[][2] = {
|
||||
{ 0.0f, 0.0f }, { 20.0f, 0.0f }, { -20.0f, 0.0f }, { 0.0f, 28.284271f },
|
||||
{ 20.0f, 28.284271f }, { -20.0f, 28.284271f }, { 0.0f, 56.568542f }, { 20.0f, 56.568542f },
|
||||
{ -20, 56.568542f }, { 0.0f, 84.85281f }, { 20.0f, 84.85281f }, { -20.0f, 84.85281f },
|
||||
};
|
||||
xyz_t norm;
|
||||
s16 angle = actor->shape_info.rotation.y;
|
||||
xyz_t pos = actor->world.position;
|
||||
s16 angle = actor->shape_info.rotation.y;
|
||||
f32 sin = sin_s(angle);
|
||||
f32 cos = cos_s(angle);
|
||||
int i;
|
||||
|
||||
|
||||
for (i = 0; i < 12; i++) {
|
||||
f32 x = offset[i].x;
|
||||
f32 y = offset[i].y;
|
||||
f32 x;
|
||||
f32 y;
|
||||
|
||||
x = offset[i][0];
|
||||
y = offset[i][1];
|
||||
pos.x = actor->world.position.x + (y * sin) + (x * cos);
|
||||
pos.z = actor->world.position.z + (y * cos) - (x * sin);
|
||||
|
||||
@@ -133,6 +135,11 @@ static int Player_actor_Check_FlatPlace(ACTOR* actor) {
|
||||
if (norm.x != 0.0f || norm.z != 0.0f) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// TODO: this doesn't match 1.3.2 (AC) and I feel like it's gotta be a hack.
|
||||
#if VERSION >= VER_GAFU01_00
|
||||
pos.y = pos.y;
|
||||
#endif
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
||||
@@ -41,7 +41,12 @@ static void Player_actor_request_proc_index_fromDemo_geton_boat_wait(ACTOR* acto
|
||||
}
|
||||
|
||||
angle_y += DEG2SHORT_ANGLE2(180.0f);
|
||||
Player_actor_Set_ScrollDemo_forDemo_geton_boat_wade(actorx, angle_y, ((speed * 0.5f) * 36.0f) * 0.05f);
|
||||
// TODO: I don't like that this deviates between versions for something very simple.
|
||||
#if VERSION >= VER_GAFU01_00
|
||||
Player_actor_Set_ScrollDemo_forDemo_geton_boat_wade(actorx, ((speed * 0.5f) * 36.0f) * 0.05f, (s16)angle_y);
|
||||
#else
|
||||
Player_actor_Set_ScrollDemo_forDemo_geton_boat_wade(actorx, ((speed * 0.5f) * 36.0f) * 0.05f, angle_y);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void Player_actor_main_Demo_geton_boat_wait(ACTOR* actorx, GAME* game) {
|
||||
|
||||
@@ -94,8 +94,7 @@ static int Player_actor_Movement_Demo_walk(ACTOR* actorx, f32* over_speed_normal
|
||||
speed_mod = 0.01f + (speed_mod - 0.05f) * 0.5157895f;
|
||||
}
|
||||
|
||||
speed_mod = sqrtf(1.0f - speed_mod);
|
||||
add_calc_short_angle2(&actorx->world.angle.y, goal_angle_y, 1.0f - speed_mod, 2500, 50);
|
||||
add_calc_short_angle2(&actorx->world.angle.y, goal_angle_y, CALC_EASE(speed_mod), 2500, 50);
|
||||
if (player->animation0_idx != mPlayer_ANIM_WAIT1) {
|
||||
actorx->shape_info.rotation.y = actorx->world.angle.y;
|
||||
}
|
||||
|
||||
@@ -70,9 +70,9 @@ static int Player_actor_CulcAnimation_Hold(ACTOR* actor) {
|
||||
|
||||
static void Player_actor_Movement_Hold(ACTOR* actor) {
|
||||
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actor;
|
||||
s16 angle = player->main_data.hold.angle_y;
|
||||
f32 x = player->main_data.hold.player_pos.x;
|
||||
f32 z = player->main_data.hold.player_pos.z;
|
||||
s16 angle = player->main_data.hold.angle_y;
|
||||
|
||||
add_calc_short_angle2(&actor->shape_info.rotation.y, angle, 1.0f - sqrtf(0.5), 8192, 50);
|
||||
actor->world.angle.y = actor->shape_info.rotation.y;
|
||||
|
||||
@@ -185,8 +185,13 @@ static int Player_actor_MessageControl_Notice_net(ACTOR* actor, GAME* game, int
|
||||
if (!mMsg_Check_MainNormal(win)) {
|
||||
Player_actor_SetupItem_Base2(actor, Player_actor_Get_ItemKind_from_submenu(), mPlayer_ANIM_GET_PUTAWAY1,
|
||||
mPlayer_INDEX_RUN, -5.0f, -1.0f, 0);
|
||||
#if VERSION >= VER_GAFU01_00
|
||||
Player_actor_InitAnimation_Base2(actor, game, mPlayer_ANIM_YATTA2, mPlayer_ANIM_YATTA2, 1.0f, 1.0f,
|
||||
0.6f, -5.0f, 0, 0);
|
||||
#else
|
||||
Player_actor_InitAnimation_Base2(actor, game, mPlayer_ANIM_YATTA2, mPlayer_ANIM_YATTA2, 1.0f, 1.0f,
|
||||
0.5f, -5.0f, 0, 0);
|
||||
#endif
|
||||
mBGMPsComp_delete_ps_fanfare(0x28, 0x168);
|
||||
mBGMPsComp_make_ps_fanfare(0x4B, 0x168);
|
||||
mMsg_Set_LockContinue(win);
|
||||
|
||||
@@ -234,8 +234,13 @@ static int Player_actor_MessageControl_Notice_rod(ACTOR* actor, GAME* game, int
|
||||
|
||||
case 2:
|
||||
if (!mMsg_Check_MainNormal(win)) {
|
||||
#if VERSION >= VER_GAFU01_00
|
||||
Player_actor_InitAnimation_Base2(actor, game, mPlayer_ANIM_YATTA2, mPlayer_ANIM_YATTA2, 1.0f, 1.0f,
|
||||
0.6f, -5.0f, 0, 0);
|
||||
#else
|
||||
Player_actor_InitAnimation_Base2(actor, game, mPlayer_ANIM_YATTA2, mPlayer_ANIM_YATTA2, 1.0f, 1.0f,
|
||||
0.5f, -5.0f, 0, 0);
|
||||
#endif
|
||||
mBGMPsComp_delete_ps_fanfare(0x28, 0x168);
|
||||
mBGMPsComp_make_ps_fanfare(0x4C, 0x168);
|
||||
mMsg_Set_LockContinue(win);
|
||||
|
||||
@@ -54,7 +54,7 @@ static void Player_actor_settle_main_Pickup_furniture(ACTOR* actorx, GAME* game)
|
||||
}
|
||||
}
|
||||
|
||||
static void Player_actor_Movement_Pickup_furniture_common(ACTOR* actorx, xyz_t* target_pos_p) {
|
||||
static void Player_actor_Movement_Pickup_furniture_common(ACTOR* actorx, const xyz_t* target_pos_p) {
|
||||
xyz_t* player_pos_p = &actorx->world.position;
|
||||
f32 dx = target_pos_p->x - player_pos_p->x;
|
||||
f32 dz = target_pos_p->z - player_pos_p->z;
|
||||
|
||||
@@ -77,7 +77,7 @@ static void Player_actor_settle_main_Pickup_jump(ACTOR* actorx, GAME* game) {
|
||||
}
|
||||
}
|
||||
|
||||
static void Player_actor_Movement_Pickup_jump_common(ACTOR* actorx, xyz_t* target_pos_p) {
|
||||
static void Player_actor_Movement_Pickup_jump_common(ACTOR* actorx, const xyz_t* target_pos_p) {
|
||||
xyz_t* player_pos_p = &actorx->world.position;
|
||||
f32 dx = target_pos_p->x - player_pos_p->x;
|
||||
f32 dz = target_pos_p->z - player_pos_p->z;
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
static int Player_actor_request_main_pull(GAME* game, int ftr_no, s16 angle, xyz_t* start_pos, xyz_t* end_pos,
|
||||
xyz_t* ofs, int priority) {
|
||||
static int Player_actor_request_main_pull(GAME* game, int ftr_no, s16 angle, const xyz_t* start_pos, const xyz_t* end_pos,
|
||||
const xyz_t* ofs, int priority) {
|
||||
if (mPlib_get_player_actor_main_index(game) == mPlayer_INDEX_HOLD &&
|
||||
Player_actor_check_request_main_able(game, mPlayer_INDEX_PULL, priority)) {
|
||||
PLAYER_ACTOR* player = GET_PLAYER_ACTOR_GAME(game);
|
||||
mPlayer_request_pull_c* req_pull_p = &player->requested_main_index_data.pull;
|
||||
|
||||
player->requested_main_index_data.pull.ftrNo = ftr_no;
|
||||
player->requested_main_index_data.pull.angle_y = angle;
|
||||
player->requested_main_index_data.pull.start_pos = *start_pos;
|
||||
player->requested_main_index_data.pull.end_pos = *end_pos;
|
||||
player->requested_main_index_data.pull.ofs = *ofs;
|
||||
req_pull_p->ftrNo = ftr_no;
|
||||
req_pull_p->angle_y = angle;
|
||||
req_pull_p->start_pos = *start_pos;
|
||||
req_pull_p->end_pos = *end_pos;
|
||||
req_pull_p->ofs = *ofs;
|
||||
|
||||
Player_actor_request_main_index(game, mPlayer_INDEX_PULL, priority);
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
static void Player_actor_request_main_reflect_axe_common(mPlayer_request_reflect_axe_c* req_axe, const xyz_t* pos,
|
||||
static void Player_actor_request_main_reflect_axe_common(mPlayer_request_reflect_axe_c* req_axe, xyz_t* pos,
|
||||
mActor_name_t hit_item, u16 damage_no, ACTOR* hit_actor) {
|
||||
req_axe->goal_pos = *pos;
|
||||
req_axe->hit_item = hit_item;
|
||||
@@ -6,7 +6,7 @@ static void Player_actor_request_main_reflect_axe_common(mPlayer_request_reflect
|
||||
req_axe->axe_damage_no = damage_no;
|
||||
}
|
||||
|
||||
static int Player_actor_request_main_reflect_axe_all(GAME* game, const xyz_t* pos, mActor_name_t hit_item,
|
||||
static int Player_actor_request_main_reflect_axe_all(GAME* game, xyz_t* pos, mActor_name_t hit_item,
|
||||
u16 damage_no, ACTOR* hit_actor, int priority) {
|
||||
if (Player_actor_check_request_main_able(game, mPlayer_INDEX_REFLECT_AXE, priority)) {
|
||||
PLAYER_ACTOR* player = GET_PLAYER_ACTOR_GAME(game);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
static void Player_actor_request_main_swing_axe_common(mPlayer_request_swing_axe_c* req_axe, const xyz_t* pos,
|
||||
static void Player_actor_request_main_swing_axe_common(mPlayer_request_swing_axe_c* req_axe, xyz_t* pos,
|
||||
mActor_name_t hit_item, u16 damage_no, int hit_ut_x,
|
||||
int hit_ut_z) {
|
||||
req_axe->goal_pos = *pos;
|
||||
@@ -8,7 +8,7 @@ static void Player_actor_request_main_swing_axe_common(mPlayer_request_swing_axe
|
||||
req_axe->axe_damage_no = damage_no;
|
||||
}
|
||||
|
||||
static int Player_actor_request_main_swing_axe_all(GAME* game, const xyz_t* pos, mActor_name_t hit_item, u16 damage_no,
|
||||
static int Player_actor_request_main_swing_axe_all(GAME* game, xyz_t* pos, mActor_name_t hit_item, u16 damage_no,
|
||||
int hit_ut_x, int hit_ut_z, int priority) {
|
||||
if (Player_actor_check_request_main_able(game, mPlayer_INDEX_SWING_AXE, priority)) {
|
||||
PLAYER_ACTOR* player = GET_PLAYER_ACTOR_GAME(game);
|
||||
@@ -47,7 +47,7 @@ static void Player_actor_setup_main_Swing_axe(ACTOR* actor, GAME* game) {
|
||||
Player_actor_setup_main_Base(actor, game);
|
||||
}
|
||||
|
||||
static void Player_actor_Movement_axe_common(ACTOR* actor, xyz_t* axe_pos) {
|
||||
static void Player_actor_Movement_axe_common(ACTOR* actor, const xyz_t* axe_pos) {
|
||||
PLAYER_ACTOR* player = (PLAYER_ACTOR*)actor;
|
||||
f32 z;
|
||||
f32 x;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user