diff --git a/src/CRE/light_param.cpp b/src/CRE/light_param.cpp index 704dcf6d..d2b349a2 100644 --- a/src/CRE/light_param.cpp +++ b/src/CRE/light_param.cpp @@ -7,13 +7,13 @@ #include "../KKdLib/hash.hpp" #include "../KKdLib/str_utils.hpp" #include "render_context.hpp" +#include "stage_param.hpp" struct light_param_data_storage; struct light_param_data { std::string name; std::string paths[6]; - std::string files[6]; bool pv; light_param_light light; light_param_fog fog; @@ -27,7 +27,7 @@ struct light_param_data { int32_t load_file(p_file_handler file_handlers[6]); void load_pv_cut_file_names(int32_t cut_id, const std::string& name); - void load_stage_file_names(const std::string& name); + void load_stage_file_names(const int32_t& stage_index, const std::string& name); void set(light_param_data_storage* storage, light_param_data_storage_flags flags = LIGHT_PARAM_DATA_STORAGE_ALL); @@ -61,6 +61,7 @@ struct light_param_data_storage { ~light_param_data_storage(); void free_file_handlers(); + std::string get_name(); void load_stages(const std::vector& stage_indices); void load_stages(const std::vector& stage_hashes, stage_database* stage_data); int32_t load_file(bool read_now); @@ -88,6 +89,10 @@ void light_param_data_storage_data_init() { light_param_data_storage_data = new light_param_data_storage; } +std::string light_param_data_storage_data_get_name() { + return light_param_data_storage_data->get_name(); +} + int32_t light_param_data_storage_data_get_pv_id() { return light_param_data_storage_data->pv_id; } @@ -216,64 +221,49 @@ int32_t light_param_data::load_file(p_file_handler file_handlers[6]) { } void light_param_data::load_pv_cut_file_names(int32_t cut_id, const std::string& name) { - char buf[0x100]; + this->name.assign(sprintf_s_string("%s_c%03d", name.c_str(), cut_id)); - sprintf_s(buf, sizeof(buf), "%s_c%03d", name.c_str(), cut_id); - this->name.assign(buf); - - sprintf_s(buf, sizeof(buf), "%s.ibl", this->name.c_str()); paths[0].assign("rom/ibl/"); - files[0].assign(buf); + paths[0].append(sprintf_s_string("%s.ibl", this->name.c_str())); - sprintf_s(buf, sizeof(buf), "light_%s.txt", this->name.c_str()); paths[1].assign("rom/light_param/"); - files[1].assign(buf); + paths[1].append(sprintf_s_string("light_%s.txt", this->name.c_str())); - sprintf_s(buf, sizeof(buf), "fog_%s.txt", this->name.c_str()); paths[2].assign("rom/light_param/"); - files[2].assign(buf); + paths[2].append(sprintf_s_string("fog_%s.txt", this->name.c_str())); - sprintf_s(buf, sizeof(buf), "glow_%s.txt", this->name.c_str()); paths[3].assign("rom/light_param/"); - files[3].assign(buf); + paths[3].append(sprintf_s_string("glow_%s.txt", this->name.c_str())); - sprintf_s(buf, sizeof(buf), "wind_%s.txt", this->name.c_str()); paths[4].assign("rom/light_param/"); - files[4].assign(buf); + paths[4].append(sprintf_s_string("wind_%s.txt", this->name.c_str())); - sprintf_s(buf, sizeof(buf), "face_%s.txt", this->name.c_str()); paths[5].assign("rom/light_param/"); - files[5].assign(buf); + paths[5].append(sprintf_s_string("face_%s.txt", this->name.c_str())); } -void light_param_data::load_stage_file_names(const std::string& name) { - char buf[0x100]; - +void light_param_data::load_stage_file_names(const int32_t& stage_index, const std::string& name) { this->name.assign(name); - sprintf_s(buf, sizeof(buf), "%s.ibl", this->name.c_str()); paths[0].assign("rom/ibl/"); - files[0].assign(buf); + paths[0].append(sprintf_s_string("%s.ibl", this->name.c_str())); - sprintf_s(buf, sizeof(buf), "light_%s.txt", this->name.c_str()); paths[1].assign("rom/light_param/"); - files[1].assign(buf); + paths[1].append(sprintf_s_string("light_%s.txt", this->name.c_str())); - sprintf_s(buf, sizeof(buf), "fog_%s.txt", this->name.c_str()); paths[2].assign("rom/light_param/"); - files[2].assign(buf); + paths[2].append(sprintf_s_string("fog_%s.txt", this->name.c_str())); - sprintf_s(buf, sizeof(buf), "glow_%s.txt", this->name.c_str()); paths[3].assign("rom/light_param/"); - files[3].assign(buf); + paths[3].append(sprintf_s_string("glow_%s.txt", this->name.c_str())); - sprintf_s(buf, sizeof(buf), "wind_%s.txt", this->name.c_str()); paths[4].assign("rom/light_param/"); - files[4].assign(buf); + paths[4].append(sprintf_s_string("wind_%s.txt", this->name.c_str())); - sprintf_s(buf, sizeof(buf), "face_%s.txt", this->name.c_str()); paths[5].assign("rom/light_param/"); - files[5].assign(buf); + paths[5].append(sprintf_s_string("face_%s.txt", this->name.c_str())); + + stage_param_data_coli_data_get_stage_wind_file_path(paths[4], stage_index); } void light_param_data::set(light_param_data_storage* storage, light_param_data_storage_flags flags) { @@ -683,6 +673,10 @@ void light_param_data_storage::free_file_handlers() { farc_file_handler.reset(); } +std::string light_param_data_storage::get_name() { + return name; +} + void light_param_data_storage::load_stages(const std::vector& stage_indices) { if (state) for (int32_t i = 0; i < 6; ++i) @@ -705,7 +699,7 @@ void light_param_data_storage::load_stages(const std::vector& stage_ind else light_param = &stage.insert({ i, default_light_param }).first->second; - light_param->load_stage_file_names(name); + light_param->load_stage_file_names(i, name); light_param->pv = false; } current_light_param = stage.begin(); @@ -738,7 +732,7 @@ void light_param_data_storage::load_stages(const std::vector& stage_ha else light_param = &stage.insert({ i, default_light_param }).first->second; - light_param->load_stage_file_names(name); + light_param->load_stage_file_names(i, name); light_param->pv = false; } current_light_param = stage.begin(); @@ -749,9 +743,8 @@ int32_t light_param_data_storage::load_file(bool read_now) { if (state == 1) { light_param_data* light_param = ¤t_light_param->second; std::string* paths = light_param->paths; - std::string* files = light_param->files; for (int32_t i = 0; i < 6; i++) - file_handlers[i].read_file(&data_list[DATA_AFT], paths[i].c_str(), files[i].c_str()); + file_handlers[i].read_file(&data_list[DATA_AFT], paths[i].c_str()); state = 2; return 1; } diff --git a/src/CRE/light_param.hpp b/src/CRE/light_param.hpp index 41ad90a9..b0d40eeb 100644 --- a/src/CRE/light_param.hpp +++ b/src/CRE/light_param.hpp @@ -31,6 +31,7 @@ enum light_param_data_storage_flags { extern void light_param_data_storage_data_init(); extern void light_param_data_storage_data_free_file_handlers(); +extern std::string light_param_data_storage_data_get_name(); extern int32_t light_param_data_storage_data_get_pv_id(); extern int32_t light_param_data_storage_data_get_stage_index(); extern void light_param_data_storage_data_load(); diff --git a/src/CRE/rob/ex_block.cpp b/src/CRE/rob/ex_block.cpp index 914f24bd..83f2234b 100644 --- a/src/CRE/rob/ex_block.cpp +++ b/src/CRE/rob/ex_block.cpp @@ -6,6 +6,7 @@ #include "rob.hpp" #include "../../KKdLib/key_val.hpp" #include "../../KKdLib/str_utils.hpp" +#include "../data.hpp" #include "skin_param.hpp" struct exp_func_op1 { @@ -459,10 +460,6 @@ vec_center(), vec_center_length(), vec_center_length_squared(), friction() { } -OsageCollision::Work::~Work() { - -} - // 0x140485450 void OsageCollision::Work::update_cls_work(OsageCollision::Work* cls, SkinParam::CollisionParam* cls_param, const mat4* transform) { @@ -809,26 +806,172 @@ int32_t OsageCollision::osage_cls_work_list(vec3& p, const float_t& cls_r, const return 0; } -osage_ring_data::osage_ring_data() : ring_rectangle_x(), ring_rectangle_y(), -ring_rectangle_width(), ring_rectangle_height(), init() { - ring_height = -1000.0f; - ring_out_height = -1000.0f; +osage_ring_data::osage_ring_data() : rect_x(), rect_y(), +rect_width(), rect_height(), ring_height(), out_height(), init() { + reset(); } osage_ring_data::~osage_ring_data() { } +void osage_ring_data::reset() { + rect_x = 0.0f; + rect_y = 0.0f; + rect_width = 0.0f; + rect_height = 0.0f; + ring_height = -1000.0f; + out_height = -1000.0f; + init = false; + coli.work_list.clear(); + skp_root_coli.clear(); +} + inline float_t osage_ring_data::get_floor_height(const vec3& pos, const float_t coli_r) { - if (pos.x < ring_rectangle_x - coli_r - || pos.z < ring_rectangle_y - coli_r - || pos.x > ring_rectangle_x + ring_rectangle_width - || pos.z > ring_rectangle_y + ring_rectangle_height) - return ring_out_height + 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) + return out_height + coli_r; else return ring_height + coli_r; } +void osage_ring_data::parse(const std::string& path, osage_ring_data& ring) { + ring.reset(); + + data_struct* aft_data = &data_list[DATA_AFT]; + bone_database* aft_bone_data = &aft_data->data_ft.bone_data; + + key_val kv; + if (!aft_data->load_file(&kv, path.c_str(), key_val::load_file)) + return; + + int32_t count; + if (kv.read("object", "length", count)) { + for (int32_t i = 0; i < count; i++) { + if (!kv.open_scope_fmt(i)) + continue; + + int32_t type; + if (!kv.read("type", type)) + break; + + OsageCollision::Work cls; + cls.type = (SkinParam::CollisionType)type; + + float_t radius; + if (!kv.read("radius", radius)) + break; + + cls.radius = radius; + + if (kv.open_scope("pos")) { + for (int32_t j = 0; j < 2; j++) { + if (!kv.open_scope_fmt(j)) + continue; + + float_t x; + if (kv.read("x", x)) + cls.pos[j].x = x; + + float_t y; + if (kv.read("y", y)) + cls.pos[j].y = y; + + float_t z; + if (kv.read("z", z)) + cls.pos[j].z = z; + + kv.close_scope(); + } + kv.close_scope(); + } + + float_t friction; + if (kv.read("friction", friction)) + cls.friction = friction; + + + int32_t node_idx0 = -1; + int32_t node_idx1 = -1; + + const char* bone0_name; + const char* bone1_name; + if (kv.read("bone.0.name", bone0_name)) { + node_idx0 = aft_bone_data->get_skeleton_object_bone_index( + bone_database_skeleton_type_to_string(BONE_DATABASE_SKELETON_COMMON), bone0_name); + if (node_idx0 >= 0 && kv.read("bone.1.name", bone1_name)) + node_idx1 = aft_bone_data->get_skeleton_object_bone_index( + bone_database_skeleton_type_to_string(BONE_DATABASE_SKELETON_COMMON), bone1_name); + } + + if (node_idx0 >= 0) { + SkinParam::CollisionParam cls_param; + cls_param.type = cls.type; + cls_param.node_idx[0] = node_idx0; + cls_param.node_idx[1] = node_idx1; + cls_param.radius = cls.radius; + cls_param.pos[0].x = cls.pos[0].x; + cls_param.pos[0].y = cls.pos[0].y; + cls_param.pos[0].z = cls.pos[0].z; + cls_param.pos[1].x = cls.pos[1].x; + cls_param.pos[1].y = cls.pos[1].y; + cls_param.pos[1].z = cls.pos[1].z; + ring.skp_root_coli.push_back(cls_param); + } + else { + if (cls.type == SkinParam::CollisionTypeCapsule || cls.type == SkinParam::CollisionTypeEllipse) { + cls.vec_center = cls.pos[1] - cls.pos[0]; + cls.vec_center_length_squared = vec3::length_squared(cls.vec_center); + cls.vec_center_length = sqrtf(cls.vec_center_length_squared); + } + ring.coli.work_list.push_back(cls); + } + + kv.close_scope(); + } + kv.close_scope(); + } + + ring.coli.work_list.push_back({}); + ring.skp_root_coli.push_back({}); + + kv.open_scope("ring"); + + float_t rect_x; + float_t rect_y; + float_t rect_width; + float_t rect_height; + float_t ring_height; + float_t out_height; + if (kv.read("rect.x", rect_x) && kv.read("rect.y", rect_y) + && kv.read("rect.width", rect_width) && kv.read("rect.height", rect_height) + && kv.read("ring_height", ring_height) && kv.read("out_height", out_height)) { + ring.init = true; + ring.rect_x = rect_x; + ring.rect_y = rect_y; + ring.rect_width = rect_width; + ring.rect_height = rect_height; + ring.ring_height = ring_height; + ring.out_height = out_height; + } + kv.close_scope(); +} + +osage_ring_data& osage_ring_data::operator=(const osage_ring_data& ring) { + rect_x = ring.rect_x; + rect_y = ring.rect_y; + rect_width = ring.rect_width; + rect_height = ring.rect_height; + ring_height = ring.ring_height; + out_height = ring.out_height; + init = ring.init; + coli.work_list.assign(ring.coli.work_list.begin(), ring.coli.work_list.end()); + skp_root_coli.assign(ring.skp_root_coli.begin(), ring.skp_root_coli.end()); + return *this; +} + CLOTHNode::CLOTHNode() : flags(), tangent_sign(), dist_top(), dist_bottom(), dist_right(), dist_left(), reset_data() { @@ -1343,6 +1486,10 @@ const float_t* RobCloth::SetOsagePlayDataInit(const float_t* opdi_data) { return opdi_data; } +void RobCloth::SetRing(const osage_ring_data& ring) { + this->ring = ring; +} + void RobCloth::SetSkinParamOsageRoot(const skin_param_osage_root& skp_root) { SetForceAirRes(skp_root.force, skp_root.force_gain, skp_root.air_res); SetSkinParamFriction(skp_root.friction); @@ -1656,6 +1803,10 @@ void ExClothBlock::SetOsageReset() { rob.osage_reset = true; } +void ExClothBlock::SetRing(const osage_ring_data& ring) { + rob.SetRing(ring); +} + void ExClothBlock::SetSkinParam(skin_param_file_data* skp) { rob.skin_param_ptr = &skp->skin_param; } @@ -2094,6 +2245,10 @@ const float_t* RobOsage::SetOsagePlayDataInit(const float_t* opdi_data) { return opdi_data; } +void RobOsage::SetRing(const osage_ring_data& ring) { + this->ring = ring; +} + void RobOsage::SetRot(float_t rot_y, float_t rot_z) { skin_param_ptr->rot.y = rot_y * DEG_TO_RAD_FLOAT; skin_param_ptr->rot.z = rot_z * DEG_TO_RAD_FLOAT; @@ -2301,6 +2456,10 @@ void ExOsageBlock::SetOsageReset() { rob.osage_reset = true; } +void ExOsageBlock::SetRing(const osage_ring_data& ring) { + rob.SetRing(ring); +} + void ExOsageBlock::SetSkinParam(skin_param_file_data* skp) { if (skp->nodes_data.size() == rob.nodes.size() - 1) { rob.skin_param_ptr = &skp->skin_param; diff --git a/src/CRE/rob/rob.cpp b/src/CRE/rob/rob.cpp index 6eb38d7f..138b10c5 100644 --- a/src/CRE/rob/rob.cpp +++ b/src/CRE/rob/rob.cpp @@ -23,6 +23,7 @@ #include "../random.hpp" #include "../resolution_mode.hpp" #include "../stage.hpp" +#include "../stage_param.hpp" #include "motion.hpp" #include "skin_param.hpp" @@ -4666,6 +4667,27 @@ void rob_chara::set_shadow_cast(bool value) { item_equip->field_A0 &= ~0x04; } +static void rob_chara_item_equip_object_set_ring( + rob_chara_item_equip_object* itm_eq_obj, const osage_ring_data& ring) { + for (ExOsageBlock*& i : itm_eq_obj->osage_blocks) + i->SetRing(ring); + + for (ExClothBlock*& i : itm_eq_obj->cloth_blocks) + i->SetRing(ring); +} + +static void rob_chara_item_equip_set_ring(rob_chara_item_equip* rob_itm_eq, const osage_ring_data& ring) { + for (int32_t i = rob_itm_eq->first_item_equip_object; i < rob_itm_eq->max_item_equip_object; i++) + rob_chara_item_equip_object_set_ring(&rob_itm_eq->item_equip_object[i], ring); +} + +void rob_chara::set_stage_data_ring(const int32_t& stage_index) { + osage_ring_data ring; + if (stage_index != -1) + stage_param_data_coli_data_get_stage_index_data(stage_index, &ring); + rob_chara_item_equip_set_ring(item_equip, ring); +} + void rob_chara::set_step_motion_step(float_t value) { data.motion.step_data.step = value; if (value < 0.0f) @@ -7197,7 +7219,7 @@ static void mothead_func_74_disable_collision(mothead_func_data* func_data, func_data->rob_chr->set_disable_collision((rob_osage_parts)((uint8_t*)data)[0], !!((uint8_t*)data)[1]); } -void rob_chara_set_adjust_global(rob_chara* rob_chr, rob_chara_data_adjust* a2) { +static void rob_chara_set_adjust_global(rob_chara* rob_chr, rob_chara_data_adjust* a2) { rob_chara_set_adjust(rob_chr, a2, &rob_chr->data.motion.adjust_global, &rob_chr->data.motion.adjust_global_prev); } @@ -7309,9 +7331,21 @@ static void mothead_func_78(mothead_func_data* func_data, v7->field_48 = v11; } +static void rob_chara_set_coli_ring(rob_chara* rob_chr, int32_t index) { + osage_ring_data ring; + if (index >= 0) + stage_param_data_coli_data_get_mhd_id_data(index, &ring); + else { + int32_t stage_index = task_stage_get_current_stage_index(); + if (stage_index != -1) + stage_param_data_coli_data_get_stage_index_data(stage_index, &ring); + } + rob_chara_item_equip_set_ring(rob_chr->item_equip, ring); +} + static void mothead_func_79_rob_chara_coli_ring(mothead_func_data* func_data, const void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { - //rob_chara_set_coli_ring(func_data->rob_chr, ((int8_t*)data)[0]); + rob_chara_set_coli_ring(func_data->rob_chr, ((int8_t*)data)[0]); } static void mothead_func_80_adjust_get_global_pos(mothead_func_data* func_data, @@ -10040,11 +10074,11 @@ static float_t sub_14064AD10(vec3* a1, float_t a2) { if (!v3) return -1000.0f; - if (a1->x < v3->ring_rectangle_x - a2 - || a1->z < v3->ring_rectangle_y - a2 - || a1->x > v3->ring_rectangle_x + v3->ring_rectangle_width - || a1->z > v3->ring_rectangle_y + v3->ring_rectangle_height) - return v3->ring_out_height; + 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; @@ -17295,6 +17329,7 @@ rob_osage_mothead::rob_osage_mothead(rob_chara* rob_chr, int32_t stage_index, ui this->frame = frame; this->motion_id = motion_id; last_frame = rob_chr->bone_data->get_frame_count() - 1.0f; + rob_chr->set_stage_data_ring(stage_index); rob_chr->reset_osage(); rob_chr->set_bone_data_frame(frame); rob_chara_item_equip_ctrl_iterate_nodes(rob_chr->item_equip); @@ -17379,7 +17414,7 @@ void rob_osage_mothead::reset_data() { void rob_osage_mothead::set_coli_ring(const mothead_data* mhd_data) { const void* data = mhd_data->data; - //rob_chara_set_coli_ring(rob_chr, ((int8_t*)data)[0]); + rob_chara_set_coli_ring(rob_chr, ((int8_t*)data)[0]); } void rob_osage_mothead::set_frame(float_t value) { diff --git a/src/CRE/rob/rob.hpp b/src/CRE/rob/rob.hpp index b53ae48b..66cb8184 100644 --- a/src/CRE/rob/rob.hpp +++ b/src/CRE/rob/rob.hpp @@ -11,6 +11,7 @@ #include "../../KKdLib/prj/vector_pair.hpp" #include "../../KKdLib/mat.hpp" #include "../../KKdLib/mot.hpp" +#include "../../KKdLib/rectangle.hpp" #include "../../KKdLib/vec.hpp" #include "../item_table.hpp" #include "../render_context.hpp" @@ -811,41 +812,41 @@ enum ExNodeType { }; enum SubActExecType { - SUB_ACTION_EXECUTE_NONE = 0, - SUB_ACTION_EXECUTE_CRY = 1, - SUB_ACTION_EXECUTE_SHAKE_HAND = 2, - SUB_ACTION_EXECUTE_EMBARRASSED = 3, - SUB_ACTION_EXECUTE_ANGRY = 4, - SUB_ACTION_EXECUTE_LAUGH = 5, - SUB_ACTION_EXECUTE_COUNT_NUM = 6, + SUB_ACTION_EXECUTE_NONE = 0x00, + SUB_ACTION_EXECUTE_CRY = 0x01, + SUB_ACTION_EXECUTE_SHAKE_HAND = 0x02, + SUB_ACTION_EXECUTE_EMBARRASSED = 0x03, + SUB_ACTION_EXECUTE_ANGRY = 0x04, + SUB_ACTION_EXECUTE_LAUGH = 0x05, + SUB_ACTION_EXECUTE_COUNT_NUM = 0x06, }; -enum SubActParamType { - SUB_ACTION_PARAM_NONE = 0x0, - SUB_ACTION_PARAM_CRY = 0x1, - SUB_ACTION_PARAM_SHAKE_HAND = 0x2, - SUB_ACTION_PARAM_EMBARRASSED = 0x3, - SUB_ACTION_PARAM_ANGRY = 0x4, - SUB_ACTION_PARAM_LAUGH = 0x5, - SUB_ACTION_PARAM_COUNT_NUM = 0x6, +enum SubActParamType { + SUB_ACTION_PARAM_NONE = 0x00, + SUB_ACTION_PARAM_CRY = 0x01, + SUB_ACTION_PARAM_SHAKE_HAND = 0x02, + SUB_ACTION_PARAM_EMBARRASSED = 0x03, + SUB_ACTION_PARAM_ANGRY = 0x04, + SUB_ACTION_PARAM_LAUGH = 0x05, + SUB_ACTION_PARAM_COUNT_NUM = 0x06, }; namespace SkinParam { enum CollisionType { - CollisionTypeEnd = 0x0, - CollisionTypeBall = 0x1, - CollisionTypeCapsule = 0x2, - CollisionTypePlane = 0x3, - CollisionTypeEllipse = 0x4, - CollisionTypeAABB = 0x5, - CollisionTypeMax = 0x6, + CollisionTypeEnd = 0x00, + CollisionTypeBall = 0x01, + CollisionTypeCapsule = 0x02, + CollisionTypePlane = 0x03, + CollisionTypeEllipse = 0x04, + CollisionTypeAABB = 0x05, + CollisionTypeMax = 0x06, }; enum RootCollisionType { - RootCollisionTypeEnd = 0x0, - RootCollisionTypeBall = 0x1, - RootCollisionTypeCapsule = 0x2, - RootCollisionTypeMax = 0x3, + RootCollisionTypeEnd = 0x00, + RootCollisionTypeBall = 0x01, + RootCollisionTypeCapsule = 0x02, + RootCollisionTypeMax = 0x03, }; } @@ -1745,7 +1746,6 @@ struct OsageCollision { float_t friction; Work(); - ~Work(); static void update_cls_work(OsageCollision::Work* cls, SkinParam::CollisionParam* cls_param, const mat4* tranform); @@ -1778,12 +1778,12 @@ struct OsageCollision { }; struct osage_ring_data { - float_t ring_rectangle_x; - float_t ring_rectangle_y; - float_t ring_rectangle_width; - float_t ring_rectangle_height; + float_t rect_x; + float_t rect_y; + float_t rect_width; + float_t rect_height; float_t ring_height; - float_t ring_out_height; + float_t out_height; bool init; OsageCollision coli; std::vector skp_root_coli; @@ -1792,6 +1792,11 @@ struct osage_ring_data { ~osage_ring_data(); float_t get_floor_height(const vec3& pos, const float_t coli_r); + void reset(); + + static void parse(const std::string& path, osage_ring_data& ring); + + osage_ring_data& operator=(const osage_ring_data& ring); }; struct skin_param_file_data; @@ -1913,6 +1918,7 @@ struct RobCloth : public CLOTH { void SetMotionResetData(uint32_t motion_id, float_t frame); void SetOsagePlayData(std::vector& opd_blend_data); const float_t* SetOsagePlayDataInit(const float_t* opdi_data); + void SetRing(const osage_ring_data& ring); void SetSkinParamOsageRoot(const skin_param_osage_root& skp_root); void UpdateDisp(); void UpdateNormals(); @@ -1950,6 +1956,7 @@ public: void SetMotionResetData(uint32_t motion_id, float_t frame); const float_t* SetOsagePlayDataInit(const float_t* opdi_data); void SetOsageReset(); + void SetRing(const osage_ring_data& ring); void SetSkinParam(skin_param_file_data* skp); void SetSkinParamOsageRoot(skin_param_osage_root* skp_root); }; @@ -2025,6 +2032,7 @@ struct RobOsage { void SetOsagePlayData(const mat4* parent_mat, const vec3& parent_scale, std::vector& opd_blend_data); const float_t* SetOsagePlayDataInit(const float_t* opdi_data); + void SetRing(const osage_ring_data& ring); void SetRot(float_t rot_y, float_t rot_z); void SetSkinParamOsageRoot(const skin_param_osage_root& skp_root); void SetSkpOsgNodes(std::vector* skp_osg_nodes); @@ -2063,6 +2071,7 @@ public: void SetMotionResetData(uint32_t motion_id, float_t frame); const float_t* SetOsagePlayDataInit(const float_t* opdi_data); void SetOsageReset(); + void SetRing(const osage_ring_data& ring); void SetSkinParam(skin_param_file_data* skp); void SetWindDirection(); void sub_1405F3E10(obj_skin_block_osage* osg_data, obj_skin_osage_node* osg_nodes, @@ -3540,6 +3549,7 @@ struct rob_chara { void set_parts_disp(item_id id, bool disp); void set_right_hand_scale(float_t value); void set_shadow_cast(bool value); + void set_stage_data_ring(const int32_t& stage_index); void set_step_motion_step(float_t value); void set_use_opd(bool value); void set_visibility(bool value); diff --git a/src/CRE/stage.cpp b/src/CRE/stage.cpp index e69f9334..997139b5 100644 --- a/src/CRE/stage.cpp +++ b/src/CRE/stage.cpp @@ -10,6 +10,7 @@ #include "rob/rob.hpp" #include "effect.hpp" #include "light_param.hpp" +#include "stage_param.hpp" #include "render_context.hpp" namespace stage_detail { @@ -706,8 +707,8 @@ static void stage_set(stage* s, stage* other) { render_manager->light_stage_ambient = true; if (other->stage_data->flags & STAGE_DATA_LIGHT_CHARA_AMBIENT) light_chara_ambient = true; - //if (stage_param_data_coli_data.pv_id == 421) - // render_manager->field_31F = true; + if (stage_param_data_coli_data_get_pv_id() == 421) + render_manager->field_31F = true; //sub_14064DC10(); effect_manager_set_current_stage_index(other->index); } @@ -721,13 +722,11 @@ static void stage_set(stage* s, stage* other) { effect_manager_set_frame(0); - //sub_140344180(0); - - if (pv_osage_manager_array_get_disp() && other) + if (!pv_osage_manager_array_get_disp() && other) for (int32_t i = 0; i < ROB_CHARA_COUNT; i++) { rob_chara* rob_chr = rob_chara_array_get(i); - //if (rob_chr) - //rob_chara_set_stage_data_ring(rob_chr, &other->index); + if (rob_chr) + rob_chr->set_stage_data_ring(other->index); } } diff --git a/src/CRE/stage_param.cpp b/src/CRE/stage_param.cpp index dae918cb..bddc7edd 100644 --- a/src/CRE/stage_param.cpp +++ b/src/CRE/stage_param.cpp @@ -4,9 +4,27 @@ */ #include "stage_param.hpp" +#include "rob/rob.hpp" +#include "data.hpp" +#include "pv_db.hpp" -template -static T& stage_param_data_storage_get_value(std::map& map, int32_t key); +struct stage_param_data_coli { + int32_t pv_id; + std::map stage_ring_data; + std::map mhd_id_ring_data; + std::map stage_wind_file; + + stage_param_data_coli(); + ~stage_param_data_coli(); + + void get_mhd_id_data(const int32_t& mhd_id, osage_ring_data& ring); + void get_stage_index_data(const int32_t& stage_index, osage_ring_data& ring); + void get_stage_wind_file_path(std::string& result, const int32_t& stage_index); + void load(const int32_t& pv_id); + void reset(); +}; + +stage_param_data_coli stage_param_data_coli_data; std::map stage_param_data_fog_ring_storage; std::map stage_param_data_leaf_storage; @@ -17,7 +35,12 @@ std::map stage_param_data_snow_storage; std::map stage_param_data_splash_storage; std::map stage_param_data_star_storage; -void stage_param_data_storage_init() { +template +static T& stage_param_data_storage_get_value(std::map& map, int32_t key); + +void stage_param_data_init() { + stage_param_data_coli_data = {}; + stage_param_data_fog_ring_storage = {}; stage_param_data_leaf_storage = {}; stage_param_data_litproj_storage = {}; @@ -28,7 +51,9 @@ void stage_param_data_storage_init() { stage_param_data_star_storage = {}; } -void stage_param_data_storage_free() { +void stage_param_data_free() { + stage_param_data_coli_data.reset(); + stage_param_data_fog_ring_storage.clear(); stage_param_data_leaf_storage.clear(); stage_param_data_litproj_storage.clear(); @@ -39,6 +64,49 @@ void stage_param_data_storage_free() { stage_param_data_star_storage.clear(); } +void stage_param_data_coli_data_get_mhd_id_data( + const int32_t& mhd_id, void* ring) { // osage_ring_data + stage_param_data_coli_data.get_mhd_id_data(mhd_id, *(osage_ring_data*)ring); +} + +int32_t stage_param_data_coli_data_get_pv_id() { + return stage_param_data_coli_data.pv_id; +} + +void stage_param_data_coli_data_get_stage_index_data( + const int32_t& stage_index, void* ring) { // osage_ring_data + data_struct* aft_data = &data_list[DATA_AFT]; + stage_database* aft_stage_data = &aft_data->data_ft.stage_data; + + const stage_data* stage_data = aft_stage_data->get_stage_data(stage_index); + if (!stage_data) + return; + + osage_ring_data& _ring = *(osage_ring_data*)ring; + stage_param_data_coli_data.get_stage_index_data(stage_index, _ring); + if (!_ring.init) { + _ring.rect_x = stage_data->rect_x; + _ring.rect_y = stage_data->rect_y; + _ring.rect_width = stage_data->rect_width; + _ring.rect_height = stage_data->rect_height; + _ring.ring_height = stage_data->ring_height; + _ring.out_height = stage_data->out_height; + _ring.init = true; + } +} + +void stage_param_data_coli_data_get_stage_wind_file_path(std::string& path, const int32_t& stage_index) { + stage_param_data_coli_data.get_stage_wind_file_path(path, stage_index); +} + +void stage_param_data_coli_data_load(const int32_t& pv_id) { + stage_param_data_coli_data.load(pv_id); +} + +void stage_param_data_coli_data_reset() { + stage_param_data_coli_data.reset(); +} + void stage_param_data_fog_ring_storage_clear() { stage_param_data_fog_ring_storage.clear(); } @@ -175,6 +243,86 @@ void stage_param_data_star_storage_set_stage_data(int32_t stage_index, stage_par stage_param_data_star_storage, stage_index) = *value; } +stage_param_data_coli::stage_param_data_coli() : pv_id() { + reset(); +} + +stage_param_data_coli::~stage_param_data_coli() { + +} + +void stage_param_data_coli::get_mhd_id_data(const int32_t& mhd_id, osage_ring_data& ring) { + auto elem = mhd_id_ring_data.find(mhd_id); + if (elem != mhd_id_ring_data.end()) + ring = elem->second; +} + +void stage_param_data_coli::get_stage_index_data(const int32_t& stage_index, osage_ring_data& ring) { + auto elem = stage_ring_data.find(stage_index); + if (elem != stage_ring_data.end()) + ring = elem->second; +} + +void stage_param_data_coli::get_stage_wind_file_path(std::string& path, const int32_t& stage_index) { + auto elem = stage_wind_file.find(stage_index); + if (elem != stage_wind_file.end()) + path.assign(elem->second); +} + +void stage_param_data_coli::load(const int32_t& pv_id) { + data_struct* aft_data = &data_list[DATA_AFT]; + + const pv_db_pv* pv = task_pv_db_get_pv(pv_id); + if (!pv) + return; + + this->pv_id = pv->id; + for (const pv_db_pv_stage_param& i : pv->stage_param) { + if (!i.collision_file.size()) + continue; + + std::string path(pv->mdata.dir); + path.append(i.collision_file); + + if (!aft_data->check_file_exists(path.c_str())) { + path.assign(sprintf_s_string("%s/%s", "rom/stage_param", i.collision_file.c_str())); + + if (!aft_data->check_file_exists(path.c_str())) + continue; + } + + osage_ring_data* ring = 0; + if (i.stage == -1) { + if (i.mhd_id < 0) + return; + + auto elem = mhd_id_ring_data.insert({ i.mhd_id, {} }); + if (elem.second) + ring = &elem.first->second; + } + else { + auto elem = stage_ring_data.insert({ i.stage, {} }); + if (elem.second) + ring = &elem.first->second; + } + + if (ring) + osage_ring_data::parse(path, *ring); + + if (!i.wind_file.size()) + continue; + + stage_wind_file.insert({ i.stage, i.wind_file }); + } +} + +void stage_param_data_coli::reset() { + stage_ring_data.clear();; + mhd_id_ring_data.clear();; + stage_wind_file.clear();; + pv_id = -1; +} + template static T& stage_param_data_storage_get_value(std::map& map, int32_t key) { auto elem = map.find(key); diff --git a/src/CRE/stage_param.hpp b/src/CRE/stage_param.hpp index 806027dc..182c924b 100644 --- a/src/CRE/stage_param.hpp +++ b/src/CRE/stage_param.hpp @@ -15,30 +15,46 @@ #include "../KKdLib/stage_param/splash.hpp" #include "../KKdLib/stage_param/star.hpp" -extern void stage_param_data_storage_init(); -extern void stage_param_data_storage_free(); +extern void stage_param_data_init(); +extern void stage_param_data_free(); + +extern void stage_param_data_coli_data_get_mhd_id_data( + const int32_t& mhd_id, void* ring); // osage_ring_data +extern int32_t stage_param_data_coli_data_get_pv_id(); +extern void stage_param_data_coli_data_get_stage_index_data( + const int32_t& stage_index, void* ring); // osage_ring_data +extern void stage_param_data_coli_data_get_stage_wind_file_path(std::string& path, const int32_t& stage_index); +extern void stage_param_data_coli_data_load(const int32_t& pv_id); +extern void stage_param_data_coli_data_reset(); extern void stage_param_data_fog_ring_storage_clear(); extern stage_param_fog_ring* stage_param_data_fog_ring_storage_get_value(int32_t stage_index); extern void stage_param_data_fog_ring_storage_set_stage_data(int32_t stage_index, stage_param_fog_ring* value); + extern void stage_param_data_leaf_storage_clear(); extern stage_param_leaf* stage_param_data_leaf_storage_get_value(int32_t stage_index); extern void stage_param_data_leaf_storage_set_stage_data(int32_t stage_index, stage_param_leaf* value); + extern void stage_param_data_litproj_storage_clear(); extern stage_param_litproj* stage_param_data_litproj_storage_get_value(int32_t stage_index); extern void stage_param_data_litproj_storage_set_stage_data(int32_t stage_index, stage_param_litproj* value); + extern void stage_param_data_rain_storage_clear(); extern stage_param_rain* stage_param_data_rain_storage_get_value(int32_t stage_index); extern void stage_param_data_rain_storage_set_stage_data(int32_t stage_index, stage_param_rain* value); + extern void stage_param_data_ripple_storage_clear(); extern stage_param_ripple* stage_param_data_ripple_storage_get_value(int32_t stage_index); extern void stage_param_data_ripple_storage_set_stage_data(int32_t stage_index, stage_param_ripple* value); + extern void stage_param_data_snow_storage_clear(); extern stage_param_snow* stage_param_data_snow_storage_get_value(int32_t stage_index); extern void stage_param_data_snow_storage_set_stage_data(int32_t stage_index, stage_param_snow* value); + extern void stage_param_data_splash_storage_clear(); extern stage_param_splash* stage_param_data_splash_storage_get_value(int32_t stage_index); extern void stage_param_data_splash_storage_set_stage_data(int32_t stage_index, stage_param_splash* value); + extern void stage_param_data_star_storage_clear(); extern stage_param_star* stage_param_data_star_storage_get_value(int32_t stage_index); extern void stage_param_data_star_storage_set_stage_data(int32_t stage_index, stage_param_star* value); diff --git a/src/DivaGL/bone_data.cpp b/src/DivaGL/bone_data.cpp index 101cb07a..cf5cb9b9 100644 --- a/src/DivaGL/bone_data.cpp +++ b/src/DivaGL/bone_data.cpp @@ -36,11 +36,11 @@ void opd_node_data_pair::set_data(opd_blend_data* blend_data, opd_node_data&& no } inline float_t osage_ring_data::get_floor_height(const vec3& pos, const float_t coli_r) { - if (pos.x < ring_rectangle_x - coli_r - || pos.z < ring_rectangle_y - coli_r - || pos.x > ring_rectangle_x + ring_rectangle_width - || pos.z > ring_rectangle_y + ring_rectangle_height) - return ring_out_height + 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) + return out_height + coli_r; else return ring_height + coli_r; } @@ -505,12 +505,12 @@ static void RobOsage__Reset(RobOsage* rob_osg) { rob_osg->osage_reset = false; rob_osg->prev_osage_reset = false; rob_osg->ring.ring_height = -1000.0f; - rob_osg->ring.ring_rectangle_x = 0.0f; - rob_osg->ring.ring_rectangle_y = 0.0f; - rob_osg->ring.ring_rectangle_width = 0.0f; - rob_osg->ring.ring_out_height = -1000.0f; + rob_osg->ring.rect_x = 0.0f; + rob_osg->ring.rect_y = 0.0f; + rob_osg->ring.rect_width = 0.0f; + rob_osg->ring.out_height = -1000.0f; rob_osg->ring.init = false; - rob_osg->ring.ring_rectangle_height = 0.0f; + rob_osg->ring.rect_height = 0.0f; rob_osg->ring.coli.work_list.clear(); rob_osg->ring.skp_root_coli.clear(); rob_osg->disable_collision = false; diff --git a/src/DivaGL/bone_data.hpp b/src/DivaGL/bone_data.hpp index e428b2eb..a324ca4e 100644 --- a/src/DivaGL/bone_data.hpp +++ b/src/DivaGL/bone_data.hpp @@ -3233,12 +3233,12 @@ struct OsageCollision { }; struct osage_ring_data { - float_t ring_rectangle_x; - float_t ring_rectangle_y; - float_t ring_rectangle_width; - float_t ring_rectangle_height; + float_t rect_x; + float_t rect_y; + float_t rect_width; + float_t rect_height; float_t ring_height; - float_t ring_out_height; + float_t out_height; bool init; OsageCollision coli; prj::vector skp_root_coli; diff --git a/src/KKdLib/database/stage.cpp b/src/KKdLib/database/stage.cpp index fc5b1988..457e0358 100644 --- a/src/KKdLib/database/stage.cpp +++ b/src/KKdLib/database/stage.cpp @@ -34,8 +34,8 @@ stage_effects_modern::stage_effects_modern() { stage_data_file::stage_data_file() : id(), object_set_id(), lens_flare_texture(), lens_shaft_texture(), lens_ghost_texture(), unknown(), render_texture(), movie_texture(), reflect_type(), refract_enable(), -reflect(), reflect_data(), refract(), refract_data(), flags(), ring_rectangle_x(), ring_rectangle_y(), -ring_rectangle_width(), ring_rectangle_height(), ring_height(), ring_out_height(), effects_init() { +reflect(), reflect_data(), refract(), refract_data(), flags(), rect_x(), rect_y(), +rect_width(), rect_height(), ring_height(), out_height(), effects_init() { lens_shaft_inv_scale = 1.0f; } @@ -46,8 +46,8 @@ stage_data_file::~stage_data_file() { stage_data_modern_file::stage_data_modern_file() : unknown(), render_texture(), render_texture_flag(), movie_texture(), movie_texture_flag(), field_04(), field_04_flag(), field_05(), field_05_flag(), field_06(), field_06_flag(), field_07(), field_07_flag(), field_08(), field_09(), -field_10(), field_11(), field_12(), ring_rectangle_x(), ring_rectangle_y(), ring_rectangle_width(), -ring_rectangle_height(), ring_height(), ring_out_height(), field_13(), effects_init() { +field_10(), field_11(), field_12(), rect_x(), rect_y(), rect_width(), +rect_height(), ring_height(), out_height(), field_13(), effects_init() { hash = hash_murmurhash_empty; lens_shaft_inv_scale = 1.0f; } @@ -58,8 +58,8 @@ stage_data_modern_file::~stage_data_modern_file() { stage_data::stage_data() : id(), object_set_id(), lens_flare_texture(), lens_shaft_texture(), lens_ghost_texture(), unknown(), render_texture(), movie_texture(), reflect_type(), refract_enable(), -reflect(), reflect_data(), refract(), refract_data(), flags(), ring_rectangle_x(), ring_rectangle_y(), -ring_rectangle_width(), ring_rectangle_height(), ring_height(), ring_out_height(), effects_init() { +reflect(), reflect_data(), refract(), refract_data(), flags(), rect_x(), rect_y(), +rect_width(), rect_height(), ring_height(), out_height(), effects_init() { name_hash = hash_murmurhash_empty; lens_shaft_inv_scale = 1.0f; } @@ -71,8 +71,8 @@ stage_data::~stage_data() { stage_data_modern::stage_data_modern() : unknown(), render_texture(), render_texture_flag(), movie_texture(), movie_texture_flag(), field_04(), field_04_flag(), field_05(), field_05_flag(), field_06(), field_06_flag(), field_07(), field_07_flag(), field_08(), field_09(), -field_10(), field_11(), field_12(), ring_rectangle_x(), ring_rectangle_y(), ring_rectangle_width(), -ring_rectangle_height(), ring_height(), ring_out_height(), field_13(), effects_init() { +field_10(), field_11(), field_12(), rect_x(), rect_y(), rect_width(), +rect_height(), ring_height(), out_height(), field_13(), effects_init() { hash = hash_murmurhash_empty; auth_3d_name_hash = hash_murmurhash_empty; lens_shaft_inv_scale = 1.0f; @@ -313,12 +313,12 @@ void stage_database::add(stage_database_file* stage_data_file) { data->refract = i.refract; data->refract_data = i.refract_data; data->flags = i.flags; - data->ring_rectangle_x = i.ring_rectangle_x; - data->ring_rectangle_y = i.ring_rectangle_y; - data->ring_rectangle_width = i.ring_rectangle_width; - data->ring_rectangle_height = i.ring_rectangle_height; + data->rect_x = i.rect_x; + data->rect_y = i.rect_y; + data->rect_width = i.rect_width; + data->rect_height = i.rect_height; data->ring_height = i.ring_height; - data->ring_out_height = i.ring_out_height; + data->out_height = i.out_height; data->effects = i.effects; data->effects_init = i.effects_init; data->auth_3d_ids.assign(i.auth_3d_ids.begin(), i.auth_3d_ids.end()); @@ -367,12 +367,12 @@ void stage_database::add(stage_database_file* stage_data_file) { data->field_10 = i.field_10; data->field_11 = i.field_11; data->field_12 = i.field_12; - data->ring_rectangle_x = i.ring_rectangle_x; - data->ring_rectangle_y = i.ring_rectangle_y; - data->ring_rectangle_width = i.ring_rectangle_width; - data->ring_rectangle_height = i.ring_rectangle_height; + data->rect_x = i.rect_x; + data->rect_y = i.rect_y; + data->rect_width = i.rect_width; + data->rect_height = i.rect_height; data->ring_height = i.ring_height; - data->ring_out_height = i.ring_out_height; + data->out_height = i.out_height; data->field_13 = i.field_13; data->effects = i.effects; data->effects_init = i.effects_init; @@ -528,12 +528,12 @@ static void stage_database_file_classic_read_inner(stage_database_file* stage_da if (stage_data->format > STAGE_DATA_F) stage->flags = (stage_data_flags)s.read_uint32_t(); - stage->ring_rectangle_x = s.read_float_t(); - stage->ring_rectangle_y = s.read_float_t(); - stage->ring_rectangle_width = s.read_float_t(); - stage->ring_rectangle_height = s.read_float_t(); + stage->rect_x = s.read_float_t(); + stage->rect_y = s.read_float_t(); + stage->rect_width = s.read_float_t(); + stage->rect_height = s.read_float_t(); stage->ring_height = s.read_float_t(); - stage->ring_out_height = s.read_float_t(); + stage->out_height = s.read_float_t(); if (stage->object_ground.id == 0xFFFF) stage->object_ground.id = -1; @@ -773,12 +773,12 @@ static void stage_database_file_classic_write_inner(stage_database_file* stage_d if (stage_data->format > STAGE_DATA_F) s.write_uint32_t(stage->flags); - s.write_float_t(stage->ring_rectangle_x); - s.write_float_t(stage->ring_rectangle_y); - s.write_float_t(stage->ring_rectangle_width); - s.write_float_t(stage->ring_rectangle_height); + s.write_float_t(stage->rect_x); + s.write_float_t(stage->rect_y); + s.write_float_t(stage->rect_width); + s.write_float_t(stage->rect_height); s.write_float_t(stage->ring_height); - s.write_float_t(stage->ring_out_height); + s.write_float_t(stage->out_height); } s.position_pop(); @@ -877,12 +877,12 @@ static void stage_database_file_modern_read_inner(stage_database_file* stage_dat stage->field_11 = s.read_offset(header_length, is_x); stage->field_12 = s.read_offset(header_length, is_x); - stage->ring_rectangle_x = s.read_float_t_reverse_endianness(); - stage->ring_rectangle_y = s.read_float_t_reverse_endianness(); - stage->ring_rectangle_width = s.read_float_t_reverse_endianness(); - stage->ring_rectangle_height = s.read_float_t_reverse_endianness(); + stage->rect_x = s.read_float_t_reverse_endianness(); + stage->rect_y = s.read_float_t_reverse_endianness(); + stage->rect_width = s.read_float_t_reverse_endianness(); + stage->rect_height = s.read_float_t_reverse_endianness(); stage->ring_height = s.read_float_t_reverse_endianness(); - stage->ring_out_height = s.read_float_t_reverse_endianness(); + stage->out_height = s.read_float_t_reverse_endianness(); if (is_x) stage->field_13 = s.read_uint32_t_reverse_endianness(); diff --git a/src/KKdLib/database/stage.hpp b/src/KKdLib/database/stage.hpp index e7b36db7..eb32fe59 100644 --- a/src/KKdLib/database/stage.hpp +++ b/src/KKdLib/database/stage.hpp @@ -100,12 +100,12 @@ struct stage_data_file { bool refract; stage_data_refract refract_data; stage_data_flags flags; - float_t ring_rectangle_x; - float_t ring_rectangle_y; - float_t ring_rectangle_width; - float_t ring_rectangle_height; + float_t rect_x; + float_t rect_y; + float_t rect_width; + float_t rect_height; float_t ring_height; - float_t ring_out_height; + float_t out_height; stage_effects effects; bool effects_init; std::vector auth_3d_ids; @@ -142,12 +142,12 @@ struct stage_data_modern_file { uint32_t field_10; size_t field_11; size_t field_12; - float_t ring_rectangle_x; - float_t ring_rectangle_y; - float_t ring_rectangle_width; - float_t ring_rectangle_height; + float_t rect_x; + float_t rect_y; + float_t rect_width; + float_t rect_height; float_t ring_height; - float_t ring_out_height; + float_t out_height; uint32_t field_13; stage_effects_modern effects; bool effects_init; @@ -184,12 +184,12 @@ struct stage_data { bool refract; stage_data_refract refract_data; stage_data_flags flags; - float_t ring_rectangle_x; - float_t ring_rectangle_y; - float_t ring_rectangle_width; - float_t ring_rectangle_height; + float_t rect_x; + float_t rect_y; + float_t rect_width; + float_t rect_height; float_t ring_height; - float_t ring_out_height; + float_t out_height; stage_effects effects; bool effects_init; std::vector auth_3d_ids; @@ -227,12 +227,12 @@ struct stage_data_modern { uint32_t field_10; size_t field_11; size_t field_12; - float_t ring_rectangle_x; - float_t ring_rectangle_y; - float_t ring_rectangle_width; - float_t ring_rectangle_height; + float_t rect_x; + float_t rect_y; + float_t rect_width; + float_t rect_height; float_t ring_height; - float_t ring_out_height; + float_t out_height; uint32_t field_13; stage_effects_modern effects; bool effects_init; diff --git a/src/ReDIVA/app.cpp b/src/ReDIVA/app.cpp index 0a08fef1..09fc3443 100644 --- a/src/ReDIVA/app.cpp +++ b/src/ReDIVA/app.cpp @@ -526,7 +526,7 @@ static render_context* render_context_load() { stru_140EDA5B0.screen_shot_4x == 1);*/ objset_info_storage_init(aft_obj_db); - stage_param_data_storage_init(); + stage_param_data_init(); pv_expression_file_storage_init(); item_table_handler_array_init(); rand_state_array_init(); @@ -1227,7 +1227,7 @@ static void render_context_dispose(render_context* rctx) { rand_state_array_free(); item_table_handler_array_free(); pv_expression_file_storage_free(); - stage_param_data_storage_free(); + stage_param_data_free(); objset_info_storage_free(); ogg_playback_data_free(); diff --git a/src/ReDIVA/data_test/motion_test.cpp b/src/ReDIVA/data_test/motion_test.cpp index f3853b0f..2fff3b08 100644 --- a/src/ReDIVA/data_test/motion_test.cpp +++ b/src/ReDIVA/data_test/motion_test.cpp @@ -15,6 +15,7 @@ #include "../../CRE/pv_db.hpp" #include "../../CRE/resolution_mode.hpp" #include "../../CRE/stage.hpp" +#include "../../CRE/stage_param.hpp" #include "../config.hpp" #include "../dw.hpp" #include "../input_state.hpp" @@ -1152,10 +1153,10 @@ bool DtmMot::ctrl() { pv_osage_manager_array_set_pv_set_motion(chara_id, set_motion); } - /*if (pv_id >= 0) { - stage_param_data_coli_data_clear(); + if (pv_id >= 0) { + stage_param_data_coli_data_reset(); stage_param_data_coli_data_load(pv_id); - }*/ + } pv_osage_manager_array_set_pv_id(chara_id, pv_id, 0); state = 10; @@ -1164,9 +1165,9 @@ bool DtmMot::ctrl() { if (pv_osage_manager_array_get_disp()) break; - /*int32_t stage_index = task_stage_get_current_stage_index(); + int32_t stage_index = task_stage_get_current_stage_index(); if (stage_index != -1) - rob_chara_array_get(chara_id)->set_stage_data_ring(stage_index);*/ + rob_chara_array_get(chara_id)->set_stage_data_ring(stage_index); #if OPD_PLAY state = use_opd ? 5 : 11; #else @@ -1295,7 +1296,7 @@ bool DtmMot::dest() { motion_set_unload_motion(motion_set_id); motion_set_unload_mothead(motion_set_id); skin_param_manager_reset(chara_id); - //stage_param_data_coli_data_clear(); + stage_param_data_coli_data_reset(); osage_play_data_manager_reset(); set_motion.clear(); set_motion_index = 0; diff --git a/src/ReDIVA/data_test/object_test.cpp b/src/ReDIVA/data_test/object_test.cpp index 66592e33..f8d135e0 100644 --- a/src/ReDIVA/data_test/object_test.cpp +++ b/src/ReDIVA/data_test/object_test.cpp @@ -381,7 +381,6 @@ void DataTestObjectManager::set_object_set_index(int32_t object_set_index) { object_set_id = aft_obj_db->get_object_set_id(obj_set_name.c_str()); app::TaskWork::add_task(this, "DATA_TEST_OBJECT_MANAGER");; - return; } void DataTestObjectManager::set_rotation(const vec3& value) { diff --git a/src/ReDIVA/pv_game/pv_game.cpp b/src/ReDIVA/pv_game/pv_game.cpp index b8709feb..af349579 100644 --- a/src/ReDIVA/pv_game/pv_game.cpp +++ b/src/ReDIVA/pv_game/pv_game.cpp @@ -15,6 +15,7 @@ #include "../../CRE/pv_expression.hpp" #include "../../CRE/pv_param.hpp" #include "../../CRE/sound.hpp" +#include "../../CRE/stage_param.hpp" #include "../../KKdLib/prj/algorithm.hpp" #include "../game_state.hpp" #include "../imgui_helper.hpp" @@ -3135,7 +3136,7 @@ bool pv_game::load() { if (!data.stage_indices.size()) data.stage_indices.push_back(0); - //stage_param_data_coli_data_load(data.pv->id); + stage_param_data_coli_data_load(data.pv->id); task_stage_set_stage_indices(data.stage_indices); task_stage_current_set_stage_display(false, true); @@ -4633,7 +4634,7 @@ bool pv_game::unload() { data.title_image_state = 0; - //stage_param_data_coli_data_clear(); + stage_param_data_coli_data_reset(); data.play_data.field_3B0 = -1; data.play_data.field_3B4 = -1; diff --git a/src/ReDIVA/x_pv_game.cpp b/src/ReDIVA/x_pv_game.cpp index ae26b818..bf164883 100644 --- a/src/ReDIVA/x_pv_game.cpp +++ b/src/ReDIVA/x_pv_game.cpp @@ -7378,12 +7378,12 @@ bool x_pv_game::ctrl() { stage_data.collision_file_path.assign("rom/STGTST_COLI.000.bin"); stage_data.reflect_type = STAGE_DATA_REFLECT_DISABLE; stage_data.flags = (stage_data_flags)0; - stage_data.ring_rectangle_x = i.ring_rectangle_x; - stage_data.ring_rectangle_y = i.ring_rectangle_y; - stage_data.ring_rectangle_width = i.ring_rectangle_width; - stage_data.ring_rectangle_height = i.ring_rectangle_height; + stage_data.rect_x = i.rect_x; + stage_data.rect_y = i.rect_y; + stage_data.rect_width = i.rect_width; + stage_data.rect_height = i.rect_height; stage_data.ring_height = i.ring_height; - stage_data.ring_out_height = i.ring_out_height; + stage_data.out_height = i.out_height; stage_data.auth_3d_ids.reserve(i.auth_3d_ids.size()); for (const uint32_t& j : i.auth_3d_ids) {