diff --git a/src/CRE/rob/ex_block.cpp b/src/CRE/rob/ex_block.cpp index a697d0bf..52696b97 100644 --- a/src/CRE/rob/ex_block.cpp +++ b/src/CRE/rob/ex_block.cpp @@ -894,11 +894,12 @@ void osage_ring_data::reset() { skp_root_coli.clear(); } -inline float_t osage_ring_data::get_floor_height(const vec3& pos, const float_t coli_r) { - if (pos.x < rect_x - coli_r - || pos.z < rect_y - coli_r - || pos.x > rect_x + rect_width - || pos.z > rect_y + rect_height) +inline float_t osage_ring_data::get_floor_height(const vec3& pos, const float_t coli_r) const { + const float_t x = rect_x - coli_r; + const float_t y = rect_y - coli_r; + if (pos.x < x || pos.z < y + || pos.x > x + rect_width + coli_r + || pos.z > y + rect_height + coli_r) return out_height + coli_r; else return ring_height + coli_r; diff --git a/src/CRE/rob/rob.cpp b/src/CRE/rob/rob.cpp index 02a82cc2..a625a6d0 100644 --- a/src/CRE/rob/rob.cpp +++ b/src/CRE/rob/rob.cpp @@ -9937,7 +9937,7 @@ static void sub_14040AE10(mat4* mat, const vec3 a2) { } } -static void sub_140406A70(vec3* a1, std::vector& bones, mat4* a3, vec3* a4, +static void sub_140406A70(struc_936* a1, std::vector& bones, mat4* a3, vec3* a4, const motion_bone_index* a5, float_t rotation_blend, float_t arm_length, bool solve_ik) { bone_data* v14 = &bones[a5[0]]; @@ -9990,7 +9990,7 @@ static void sub_140418A00(rob_chara_bone_data* rob_bone_data, vec3* a2, const motion_bone_index* a3, float_t rotation_blend, float_t arm_length, bool solve_ik) { motion_blend_mot* v7 = rob_bone_data->motion_loaded.front(); mat4 m = v7->field_4F8.mat; - sub_140406A70(rob_bone_data->field_76C, v7->bone_data.bones, + sub_140406A70(&rob_bone_data->field_76C, v7->bone_data.bones, &m, a2, a3, rotation_blend, arm_length, solve_ik); } @@ -10598,31 +10598,10 @@ static float_t sub_140406E90(bone_data* a1, bone_data* a2, float_t a3, vec3* a4) return v17.y; } -static float_t sub_14064AD10(vec3* a1, float_t a2) { - task_stage_info stg_info = task_stage_get_current_stage_info(); - if (stg_info.check()) { - stage* stg = task_stage_get_stage(stg_info); - if (!stg) - return -1000.0f; - - stage_data* v3 = stg->stage_data; - if (!v3) - return -1000.0f; - - if (a1->x < v3->rect_x - a2 - || a1->z < v3->rect_y - a2 - || a1->x > v3->rect_x + v3->rect_width - || a1->z > v3->rect_y + v3->rect_height) - return v3->out_height; - return v3->ring_height; - } - return -1000.0f; -} - -static void sub_140406920(vec3* a1, bone_data* a2, bone_data* a3, float_t heel_height, vec3* a5, float_t step) { +static void sub_140406920(struc_936* a1, bone_data* a2, bone_data* a3, float_t heel_height, vec3* a5, float_t step) { vec3 v18; float_t v7 = sub_140406E90(a2, a3, heel_height, &v18); - float_t v8 = sub_14064AD10(&v18, heel_height); + float_t v8 = task_stage_current_get_floor_height(v18, heel_height); if (a5->y != v8) { a5->x = a5->y; a5->z = 0.0f; @@ -10647,7 +10626,7 @@ static void sub_140406920(vec3* a1, bone_data* a2, bone_data* a3, float_t heel_h a2->ik_target.z = v18.z; } -static void sub_1404065B0(vec3* a1, std::vector* a2, mat4* a3, float_t a4, +static void sub_1404065B0(struc_936* a1, std::vector* a2, mat4* a3, float_t a4, bone_database_skeleton_type skeleton_type, const motion_bone_index* a6, const motion_bone_index* a7) { data_struct* aft_data = &data_list[DATA_AFT]; bone_database* aft_bone_data = &aft_data->data_ft.bone_data; @@ -10657,8 +10636,8 @@ static void sub_1404065B0(vec3* a1, std::vector* a2, mat4* a3, float_ if (!heel_height) return; - sub_140406920(a1, &a2->data()[a6[0]], &a2->data()[MOTION_BONE_KL_TOE_L_WJ], *heel_height, &a1[0], a4); - sub_140406920(a1, &a2->data()[a7[0]], &a2->data()[MOTION_BONE_KL_TOE_R_WJ], *heel_height, &a1[1], a4); + sub_140406920(a1, &a2->data()[a6[0]], &a2->data()[MOTION_BONE_KL_TOE_L_WJ], *heel_height, &a1->toe_l, a4); + sub_140406920(a1, &a2->data()[a7[0]], &a2->data()[MOTION_BONE_KL_TOE_R_WJ], *heel_height, &a1->toe_r, a4); ::bone_data* v7 = a2->data(); ::bone_data* v17 = &v7[a6[0]]; @@ -10685,7 +10664,7 @@ static void sub_1404065B0(vec3* a1, std::vector* a2, mat4* a3, float_ static void sub_140418810(rob_chara_bone_data* rob_bone_data, const motion_bone_index* a6, const motion_bone_index* a7) { motion_blend_mot* v3 = rob_bone_data->motion_loaded.front(); mat4 m = v3->field_4F8.mat; - sub_1404065B0(rob_bone_data->field_76C, &v3->bone_data.bones, &m, + sub_1404065B0(&rob_bone_data->field_76C, &v3->bone_data.bones, &m, v3->mot_play_data.frame_data.step, rob_bone_data->skeleton_type, a6, a7); } @@ -13243,6 +13222,15 @@ void rob_chara_look_anim_eye_param::reset() { xrot_adjust_clear_pos = 6.0f; } +struc_936::struc_936() { + +} + +void struc_936::reset() { + toe_l = 0.0f; + toe_r = 0.0f; +} + rob_chara_look_anim::rob_chara_look_anim() : bones(), update_view_point(), init_head_rotation(), head_rotation(), init_eyes_rotation(), eyes_rotation(), disable(), head_rot_strength(), eyes_rot_strength(), eyes_rot_step(), duration(), eyes_rot_frame(), step(), head_rot_frame(), field_B0(), @@ -13346,7 +13334,7 @@ void rob_chara_sleeve_adjust::reset() { } rob_chara_bone_data::rob_chara_bone_data() : field_0(), field_1(), object_bone_count(), total_bone_count(), -motion_bone_count(), ik_bone_count(), chain_pos(), disable_eye_motion(), field_76C(), look_anim() { +motion_bone_count(), ik_bone_count(), chain_pos(), disable_eye_motion(), look_anim() { base_skeleton_type = BONE_DATABASE_SKELETON_NONE; skeleton_type = BONE_DATABASE_SKELETON_NONE; } @@ -13653,8 +13641,7 @@ void rob_chara_bone_data::reset() { eyelid.reset(); disable_eye_motion = false; ik_scale = rob_chara_bone_data_ik_scale(); - field_76C[0] = 0.0f; - field_76C[0] = 0.0f; + field_76C.reset(); look_anim.reset(); sleeve_adjust.reset(); } diff --git a/src/CRE/rob/rob.hpp b/src/CRE/rob/rob.hpp index 76fb7e21..c2774c6c 100644 --- a/src/CRE/rob/rob.hpp +++ b/src/CRE/rob/rob.hpp @@ -1275,6 +1275,15 @@ struct struc_823 { float_t field_C; }; +struct struc_936 { + vec3 toe_l; + vec3 toe_r; + + struc_936(); + + void reset(); +}; + struct rob_chara_look_anim { std::vector* bones; mat4 mat; @@ -1383,7 +1392,7 @@ struct rob_chara_bone_data { partial_motion_blend_mot eyelid; bool disable_eye_motion; rob_chara_bone_data_ik_scale ik_scale; - vec3 field_76C[2]; + struc_936 field_76C; rob_chara_look_anim look_anim; rob_chara_sleeve_adjust sleeve_adjust; @@ -1897,7 +1906,7 @@ struct osage_ring_data { osage_ring_data(); ~osage_ring_data(); - float_t get_floor_height(const vec3& pos, const float_t coli_r); + float_t get_floor_height(const vec3& pos, const float_t coli_r) const; void reset(); static void parse(const std::string& path, osage_ring_data& ring); diff --git a/src/CRE/stage.cpp b/src/CRE/stage.cpp index 1d3363e4..eca96a26 100644 --- a/src/CRE/stage.cpp +++ b/src/CRE/stage.cpp @@ -62,6 +62,49 @@ lens_flare(), ground(), ring(), sky(), auth_3d_loaded(), mat(), rot_y(), obj_set } +// 0x14064AA30 +float_t stage::get_floor_height(const vec3& pos, const float_t& coli_r) const { + ::stage_data* v3 = this->stage_data; + if (!stage_data) + return -1000.0f; + + const float_t x = stage_data->rect_x - coli_r; + const float_t y = stage_data->rect_y - coli_r; + if (pos.x < x || pos.z < y + || pos.x > x + stage_data->rect_width + coli_r + || pos.z > y + stage_data->rect_height + coli_r) + return stage_data->out_height; + else + return stage_data->ring_height; +} + +// 0x14064DEA0 +void stage::set_ground(bool value) { + ground = value; +} + +// 0x14064DF90 +void stage::set_lens_flare(bool value) { + lens_flare = value; +} + +// 0x14064DF10 +void stage::set_ring(bool value) { + ring = value; +} + +// 0x14064DF50 +void stage::set_sky(bool value) { + sky = value; +} + +// 0x14064DE80 +void stage::set_stage_display(bool value, bool effect_enable) { + stage_display = value; + if (effect_enable) + effect_manager_set_enable(value); +} + stage_detail::TaskStage::TaskStage() : state(), current_stage(), stage_display(), field_FB1(), field_FB2(), field_FB3(), field_FB4(), mat(), field_FF8() { @@ -115,6 +158,14 @@ bool task_stage_info::check() const { return task_stage_get_stage(*this) != 0; } +// 0x14064A9E0 +float_t task_stage_info::get_floor_height(const vec3& pos, const float_t& coli_r) const { + stage* stg = task_stage_get_stage(*this); + if (stg) + return stg->get_floor_height(pos, coli_r); + return -1000.0f; +} + int32_t task_stage_info::get_stage_index() const { stage* stg = task_stage_get_stage(*this); if (stg) @@ -122,35 +173,44 @@ int32_t task_stage_info::get_stage_index() const { return -1; } +// 0x14064DEA0 void task_stage_info::set_ground(bool value) const { stage* stg = task_stage_get_stage(*this); if (stg) - stg->ground = value; + stg->set_ground(value); } +// 0x14064DF60 +void task_stage_info::set_lens_flare(bool value) const { + stage* stg = task_stage_get_stage(*this); + if (stg) + stg->set_lens_flare(value); +} + +// 0x14064DEE0 void task_stage_info::set_ring(bool value) const { stage* stg = task_stage_get_stage(*this); if (stg) - stg->ring = value; + stg->set_ring(value); } +// 0x14064DF20 void task_stage_info::set_sky(bool value) const { stage* stg = task_stage_get_stage(*this); if (stg) - stg->sky = value; + stg->set_sky(value); } +// 0x14064DB90 void task_stage_info::set_stage() const { stage_detail::TaskStage_SetStage(task_stage, *this); } +// 0x14064DE40 void task_stage_info::set_stage_display(bool value, bool effect_enable) const { stage* stg = task_stage_get_stage(*this); - if (stg) { - stg->stage_display = value; - if (effect_enable) - effect_manager_set_enable(value); - } + if (stg) + stg->set_stage_display(value, effect_enable); } void task_stage_init() { @@ -166,24 +226,43 @@ bool task_stage_check_not_loaded() { return task_stage->load_stage_indices.size() || task_stage->state != 6; } +// 0x14064AD10 +float_t task_stage_current_get_floor_height(const vec3& pos, const float_t coli_r) { + task_stage_info stg_info = task_stage_get_current_stage_info(); + if (stg_info.check()) + return stg_info.get_floor_height(pos, coli_r); + return -1000.0f; +} + +// 0x14064DD10 void task_stage_current_set_ground(bool value) { task_stage_info stg_info = task_stage_get_current_stage_info(); if (stg_info.check()) stg_info.set_ground(value); } +// 0x14064DDD0 +void task_stage_current_set_lens_flare(bool value) { + task_stage_info stg_info = task_stage_get_current_stage_info(); + if (stg_info.check()) + stg_info.set_lens_flare(value); +} + +// 0x14064DD50 void task_stage_current_set_ring(bool value) { task_stage_info stg_info = task_stage_get_current_stage_info(); if (stg_info.check()) stg_info.set_ring(value); } +// 0x14064DD90 void task_stage_current_set_sky(bool value) { task_stage_info stg_info = task_stage_get_current_stage_info(); if (stg_info.check()) stg_info.set_sky(value); } +// 0x14064DCC0 void task_stage_current_set_stage_display(bool value, bool effect_enable) { task_stage_info stg_info = task_stage_get_current_stage_info(); if (stg_info.check()) diff --git a/src/CRE/stage.hpp b/src/CRE/stage.hpp index 21e7c8cb..2c23ce92 100644 --- a/src/CRE/stage.hpp +++ b/src/CRE/stage.hpp @@ -28,6 +28,13 @@ struct stage { uint32_t obj_set; stage(); + + float_t get_floor_height(const vec3& pos, const float_t& coli_r) const; + void set_ground(bool value); + void set_lens_flare(bool value); + void set_ring(bool value); + void set_sky(bool value); + void set_stage_display(bool value, bool effect_enable); }; #define TASK_STAGE_STAGE_COUNT 37 @@ -66,8 +73,10 @@ struct task_stage_info { task_stage_info(int16_t load_index, uint16_t load_counter); bool check() const; + float_t get_floor_height(const vec3& pos, const float_t& coli_r) const; int32_t get_stage_index() const; void set_ground(bool value) const; + void set_lens_flare(bool value) const; void set_ring(bool value) const; void set_sky(bool value) const; void set_stage() const; @@ -77,7 +86,9 @@ struct task_stage_info { extern void task_stage_init(); extern bool task_stage_add_task(const char* name); extern bool task_stage_check_not_loaded(); +extern float_t task_stage_current_get_floor_height(const vec3& pos, const float_t coli_r); extern void task_stage_current_set_ground(bool value); +extern void task_stage_current_set_lens_flare(bool value); extern void task_stage_current_set_ring(bool value); extern void task_stage_current_set_sky(bool value); extern void task_stage_current_set_stage_display(bool value, bool effect_enable);