From 3c41f098cf4d2d81d064763f63b1775b66e9fe1b Mon Sep 17 00:00:00 2001 From: korenkonder Date: Mon, 20 Apr 2026 17:34:18 +0300 Subject: [PATCH] Start of massive overhaul of Rob --- src/CRE/Glitter/effect_inst.cpp | 10 +- src/CRE/auth_3d.cpp | 62 +- src/CRE/auth_3d.hpp | 2 +- src/CRE/customize_item_table.cpp | 24 +- src/CRE/customize_item_table.hpp | 4 +- src/CRE/effect.cpp | 22 +- src/CRE/hand_item.cpp | 22 +- src/CRE/hand_item.hpp | 4 +- src/CRE/item_table.cpp | 57 +- src/CRE/item_table.hpp | 19 +- src/CRE/mdl/disp_manager.cpp | 24 +- src/CRE/mdl/disp_manager.hpp | 8 +- src/CRE/mdl/draw_object.cpp | 2 +- src/CRE/module_table.cpp | 44 +- src/CRE/module_table.hpp | 4 +- src/CRE/pv_db.cpp | 100 +- src/CRE/pv_db.hpp | 18 +- src/CRE/pv_expression.cpp | 10 +- src/CRE/pv_param.cpp | 8 +- src/CRE/render.cpp | 6 +- src/CRE/renderer/dof.cpp | 2 +- src/CRE/rob/ex_block.cpp | 56 +- src/CRE/rob/rob.cpp | 4741 ++++++++--------- src/CRE/rob/rob.hpp | 1730 +++--- src/CRE/rob/skin_param.cpp | 42 +- src/CRE/rob/skin_param.hpp | 2 +- src/CRE/shadow.hpp | 8 +- src/CRE/sss.cpp | 2 +- src/CRE/stage.cpp | 10 +- src/CRE/stage_modern.cpp | 10 +- src/KKdLib/database/bone.cpp | 833 +-- src/KKdLib/database/bone.hpp | 172 +- src/KKdLib/database/item_table.cpp | 136 +- src/KKdLib/database/item_table.hpp | 149 +- src/KKdLib/pv_db.hpp | 38 +- src/ReDIVA/app.cpp | 2 +- src/ReDIVA/data_edit/rob_chara_adjust.cpp | 2 +- src/ReDIVA/data_initialize.cpp | 2 +- .../data_process/effchrpv_auth_3d_to_mot.cpp | 517 +- .../data_process/effchrpv_auth_3d_to_mot.hpp | 1 + src/ReDIVA/data_test/auth_3d_test.cpp | 134 +- src/ReDIVA/data_test/auth_3d_test.hpp | 6 +- src/ReDIVA/data_test/equip_test.cpp | 154 +- src/ReDIVA/data_test/equip_test.hpp | 8 +- src/ReDIVA/data_test/motion_test.cpp | 84 +- src/ReDIVA/data_test/motion_test.hpp | 10 +- src/ReDIVA/data_test/object_test.cpp | 4 +- src/ReDIVA/data_test/opd_test.cpp | 4 +- src/ReDIVA/data_test/rob_osage_test.cpp | 183 +- src/ReDIVA/data_test/rob_osage_test.hpp | 28 +- src/ReDIVA/data_view/auth_3d.cpp | 4 +- src/ReDIVA/game_state.cpp | 2 +- src/ReDIVA/graphics/color_change.cpp | 14 +- src/ReDIVA/pv_game/pv_game.cpp | 144 +- src/ReDIVA/pv_game/pv_game.hpp | 36 +- src/ReDIVA/pv_game/pv_game_pv_data.cpp | 45 +- src/ReDIVA/pv_game/pv_game_pv_data.hpp | 24 +- src/ReDIVA/x_pv_game.cpp | 234 +- src/ReDIVA/x_pv_game.hpp | 36 +- 59 files changed, 5150 insertions(+), 4909 deletions(-) diff --git a/src/CRE/Glitter/effect_inst.cpp b/src/CRE/Glitter/effect_inst.cpp index ec012b53..f4f02f71 100644 --- a/src/CRE/Glitter/effect_inst.cpp +++ b/src/CRE/Glitter/effect_inst.cpp @@ -73,8 +73,7 @@ namespace Glitter { return -1; bone_database* bone_data = (bone_database*)GPM_VAL->bone_data; - const std::vector* motion_bone_names = 0; - if (!bone_data || bone_data->skeleton.size() < 1) + if (!bone_data) return -1; static const char* bone_names[] = { @@ -98,8 +97,7 @@ namespace Glitter { "kl_toe_r_wj" }; - return bone_data->get_skeleton_motion_bone_index( - bone_database_skeleton_type_to_string(BONE_DATABASE_SKELETON_COMMON), bone_names[node]); + return bone_data->get_bone_node_index(BONE_KIND_CMN, bone_names[node]); } EffectInstF2::ExtAnim::ExtAnim() : object_index(), mesh_index(), a3da_id(), object_is_hrc(), mesh_name() { @@ -431,7 +429,7 @@ namespace Glitter { mat4 mat = mat4_identity; chara_id = auth_3d_id(ext_anim->a3da_id).get_chara_id(); - if (chara_id >= 0 && chara_id < ROB_CHARA_COUNT) { + if (chara_id >= 0 && chara_id < ROB_ID_MAX) { rob_chara* rob_chr = rob_chara_array_get(chara_id); if (rob_chr) { mat = rob_chr->data.adjust_data.mat; @@ -1125,7 +1123,7 @@ namespace Glitter { mat4 mat = mat4_identity; int32_t chara_id = auth_3d_id(ext_anim->a3da_id).get_chara_id(); - if (chara_id >= 0 && chara_id < ROB_CHARA_COUNT) { + if (chara_id >= 0 && chara_id < ROB_ID_MAX) { rob_chara* rob_chr = rob_chara_array_get(chara_id); if (rob_chr) { mat = rob_chr->data.adjust_data.mat; diff --git a/src/CRE/auth_3d.cpp b/src/CRE/auth_3d.cpp index cb218ed0..e7421503 100644 --- a/src/CRE/auth_3d.cpp +++ b/src/CRE/auth_3d.cpp @@ -160,7 +160,7 @@ static void auth_3d_object_hrc_load(auth_3d* auth, auth_3d_object_hrc* oh, static void auth_3d_object_hrc_store(auth_3d* auth, auth_3d_object_hrc* oh, auth_3d_object_hrc_file* ohf); static bool auth_3d_object_hrc_replace_chara(auth_3d_object_hrc* oh, - chara_index src_chara, chara_index dst_chara, object_database* obj_db); + CHARA_NUM src_chara, CHARA_NUM dst_chara, object_database* obj_db); static void auth_3d_object_hrc_nodes_mat_mult(auth_3d_object_hrc* oh, const mat4* mat); static void auth_3d_object_instance_load(auth_3d* auth, auth_3d_object_instance* oi, auth_3d_object_instance_file* oif, auth_3d_m_object_hrc* moh, object_database* obj_db); @@ -242,8 +242,8 @@ auth_3d::auth_3d() : uid(), id(), mat(), enable(), camera_root_update(), visible left_right_reverse(), once(), alpha(), chara_id(), chara_item(), shadow(), reflect(), pos(), frame_rate(), frame(), req_frame(), max_frame(), frame_changed(), frame_offset(), last_frame(), paused(), event_time_next() { hash = hash_murmurhash_empty; - src_chara = CHARA_MAX; - dst_chara = CHARA_MAX; + src_chara = CN_MAX; + dst_chara = CN_MAX; reset(); } @@ -575,7 +575,7 @@ void auth_3d::load(a3da* auth_file, auth_3d_object_hrc_load(this, &object_hrc[object_hrc_index++], &i, obj_db); for (auth_3d_object_hrc& i : object_hrc) - auth_3d_object_hrc_replace_chara(&i, (chara_index)src_chara, (chara_index)dst_chara, obj_db); + auth_3d_object_hrc_replace_chara(&i, (CHARA_NUM)src_chara, (CHARA_NUM)dst_chara, obj_db); } if (auth_file->point.size()) { @@ -815,8 +815,8 @@ void auth_3d::reset() { chara_item = false; shadow = false; reflect = false; - src_chara = CHARA_MAX; - dst_chara = CHARA_MAX; + src_chara = CN_MAX; + dst_chara = CN_MAX; pos = 0; frame_rate = get_sys_frame_rate(); frame = 0.0f; @@ -1314,7 +1314,7 @@ namespace auth_3d_detail { for (auth_3d_chara& i : auth->chara) { rob_chara* rob_chr = rob_chara_array_get(i.index); if (rob_chr) - rob_chr->item_equip->disable_update = true; + rob_chr->rob_disp->disable_update = true; } effect_manager_set_frame_rate_control(&frame_rate_time_stop); } @@ -1323,7 +1323,7 @@ namespace auth_3d_detail { for (auth_3d_chara& i : auth->chara) { rob_chara* rob_chr = rob_chara_array_get(i.index); if (rob_chr) - rob_chr->item_equip->disable_update = true; + rob_chr->rob_disp->disable_update = true; } effect_manager_set_frame_rate_control(get_sys_frame_rate()); } @@ -1390,7 +1390,7 @@ namespace auth_3d_detail { if (auth->chara.size()) index = auth->chara.front().index; - if (index >= 0 && index < ROB_CHARA_COUNT) + if (index >= 0 && index < ROB_ID_MAX) sub_140532980(index, param1.c_str()); else if (sound_work_has_property(param1.c_str())) sound_work_play_se(1, param1.c_str()); @@ -2789,7 +2789,7 @@ void auth_3d_id::set_chara_id(int32_t value) { } } -void auth_3d_id::set_chara_index(size_t auth_chara_id, int32_t index) { +void auth_3d_id::set_chara_num(size_t auth_chara_id, int32_t index) { if (id >= 0 && ((id & 0x7FFF) < AUTH_3D_DATA_COUNT)) { auth_3d* auth = &auth_3d_data->data[id & 0x7FFF]; if (auth->id == id) @@ -4411,7 +4411,7 @@ static void auth_3d_camera_root_view_point_store(auth_3d* auth, auth_3d_camera_r } static void auth_3d_chara_disp(auth_3d_chara* c, auth_3d* auth, render_context* rctx) { - if (c->index <= ROB_CHARA_COUNT) + if (c->index <= ROB_ID_MAX) rob_chara_array_set_visibility(c->index, c->model_transform.visible); if (auth->pos) { @@ -4906,20 +4906,20 @@ static void auth_3d_m_object_hrc_disp(auth_3d_m_object_hrc* moh, auth_3d* auth, continue; mdl::ObjFlags flags = mdl::OBJ_SSS; - shadow_type_enum shadow_type = SHADOW_CHARA; + SHADOW_GROUP shadow_group = SHADOW_GROUP_CHARA; if (auth->shadow || i.shadow) { enum_or(flags, mdl::OBJ_4 | mdl::OBJ_SHADOW); - shadow_type = SHADOW_STAGE; + shadow_group = SHADOW_GROUP_STAGE; } if (auth->alpha < 1.0f) enum_or(flags, auth->obj_flags); disp_manager.set_obj_flags(flags); - disp_manager.set_shadow_type(shadow_type); + disp_manager.set_shadow_group(shadow_group); Shadow* shad = shadow_ptr_get(); if (shad && (flags & mdl::OBJ_SHADOW)) { - disp_manager.set_shadow_type(SHADOW_STAGE); + disp_manager.set_shadow_group(SHADOW_GROUP_STAGE); mat4* m = &moh->model_transform.mat; for (auth_3d_object_node& j : moh->node) @@ -4934,7 +4934,7 @@ static void auth_3d_m_object_hrc_disp(auth_3d_m_object_hrc* moh, auth_3d* auth, vec3 pos; mat4_get_translation(&mat, &pos); pos.y -= 0.2f; - shad->positions[shadow_type].push_back(pos); + shad->positions[shadow_group].push_back(pos); } if (i.mats.size()) @@ -4943,7 +4943,7 @@ static void auth_3d_m_object_hrc_disp(auth_3d_m_object_hrc* moh, auth_3d* auth, } disp_manager.set_obj_flags(); - disp_manager.set_shadow_type(SHADOW_CHARA); + disp_manager.set_shadow_group(SHADOW_GROUP_CHARA); } static void auth_3d_m_object_hrc_load(auth_3d* auth, auth_3d_m_object_hrc* moh, @@ -6533,16 +6533,16 @@ static void auth_3d_object_disp(auth_3d_object* o, auth_3d* auth, render_context object_database* obj_db = auth->obj_db; texture_database* tex_db = auth->tex_db; - if (auth->chara_id >= 0 && auth->chara_id < ROB_CHARA_COUNT) { + if (auth->chara_id >= 0 && auth->chara_id < ROB_ID_MAX) { if (rob_chara_pv_data_array_check_chara_id(auth->chara_id)) { rob_chara* rob_chr = rob_chara_array_get(auth->chara_id); mat4 m; - mat4_mul(&rob_chr->data.miku_rot.mat, + mat4_mul(&rob_chr->data.position.rob_mat, auth->chara_item ? &rob_chr->data.adjust_data.item_mat : &rob_chr->data.adjust_data.mat, &m); mat4_mul(&mat, &m, &mat); - disp_manager.set_shadow_type(auth->chara_id ? SHADOW_STAGE : SHADOW_CHARA); + disp_manager.set_shadow_group(auth->chara_id ? SHADOW_GROUP_STAGE : SHADOW_GROUP_CHARA); } } @@ -6827,22 +6827,22 @@ static void auth_3d_object_hrc_disp(auth_3d_object_hrc* oh, auth_3d* auth, rende enum_or(flags, auth->obj_flags); disp_manager.set_obj_flags(flags); - disp_manager.set_shadow_type(SHADOW_CHARA); + disp_manager.set_shadow_group(SHADOW_GROUP_CHARA); mat4 mat = mat4_identity; - if (auth->chara_id >= 0 && auth->chara_id < ROB_CHARA_COUNT) { + if (auth->chara_id >= 0 && auth->chara_id < ROB_ID_MAX) { if (rob_chara_pv_data_array_check_chara_id(auth->chara_id)) { rob_chara* rob_chr = rob_chara_array_get(auth->chara_id); - mat4_mul(&rob_chr->data.miku_rot.mat, + mat4_mul(&rob_chr->data.position.rob_mat, auth->chara_item ? &rob_chr->data.adjust_data.item_mat : &rob_chr->data.adjust_data.mat, &mat); if (auth->chara_id) - disp_manager.set_shadow_type(SHADOW_STAGE); + disp_manager.set_shadow_group(SHADOW_GROUP_STAGE); } } else if (flags & mdl::OBJ_SHADOW) { - disp_manager.set_shadow_type(SHADOW_STAGE); + disp_manager.set_shadow_group(SHADOW_GROUP_STAGE); mat4 mat = oh->node.front().model_transform.mat; for (auth_3d_object_node& i : oh->node) @@ -6856,7 +6856,7 @@ static void auth_3d_object_hrc_disp(auth_3d_object_hrc* oh, auth_3d* auth, rende vec3 pos; mat4_get_translation(&mat, &pos); pos.y -= 0.2f; - shad->positions[SHADOW_STAGE].push_back(pos); + shad->positions[SHADOW_GROUP_STAGE].push_back(pos); } } @@ -6865,7 +6865,7 @@ static void auth_3d_object_hrc_disp(auth_3d_object_hrc* oh, auth_3d* auth, rende oh->object_info, 0, 0, auth->alpha, oh->mats.data(), 0, 0, mat); disp_manager.set_obj_flags(); - disp_manager.set_shadow_type(SHADOW_CHARA); + disp_manager.set_shadow_group(SHADOW_GROUP_CHARA); for (auth_3d_object*& i : oh->children_object) auth_3d_object_disp(i, auth, rctx); @@ -6933,12 +6933,12 @@ static void auth_3d_object_hrc_store(auth_3d* auth, auth_3d_object_hrc* oh, } static bool auth_3d_object_hrc_replace_chara(auth_3d_object_hrc* oh, - chara_index src_chara, chara_index dst_chara, object_database* obj_db) { - if (src_chara < 0 || src_chara >= CHARA_MAX || dst_chara < 0 || dst_chara >= CHARA_MAX || src_chara == dst_chara) + CHARA_NUM src_chara, CHARA_NUM dst_chara, object_database* obj_db) { + if (src_chara < 0 || src_chara >= CN_MAX || dst_chara < 0 || dst_chara >= CN_MAX || src_chara == dst_chara) return false; - std::string src_chara_str = chara_index_get_auth_3d_name(src_chara); - std::string dst_chara_str = chara_index_get_auth_3d_name(dst_chara); + std::string src_chara_str = get_char_id_str(src_chara); + std::string dst_chara_str = get_char_id_str(dst_chara); std::string uid_name = oh->uid_name; size_t pos = uid_name.find(src_chara_str); diff --git a/src/CRE/auth_3d.hpp b/src/CRE/auth_3d.hpp index bcd7cf56..857e6bb4 100644 --- a/src/CRE/auth_3d.hpp +++ b/src/CRE/auth_3d.hpp @@ -876,7 +876,7 @@ struct auth_3d_id { void set_alpha_obj_flags(float_t alpha, mdl::ObjFlags obj_flags); void set_camera_root_update(bool value); void set_chara_id(int32_t value); - void set_chara_index(size_t auth_chara_id, int32_t index); + void set_chara_num(size_t auth_chara_id, int32_t index); void set_chara_item(bool value); void set_enable(bool value); void set_frame_rate(FrameRateControl* value); diff --git a/src/CRE/customize_item_table.cpp b/src/CRE/customize_item_table.cpp index 5d9c02b6..0fadd61d 100644 --- a/src/CRE/customize_item_table.cpp +++ b/src/CRE/customize_item_table.cpp @@ -38,7 +38,7 @@ struct customize_item_data_handler { ~customize_item_data_handler(); void add_all_customize_items(); - void get_chara_item(const std::string& name, chara_index& chara_index, int32_t& item_no); + void get_chara_item(const std::string& name, CHARA_NUM& chara_num, int32_t& item_no); void add_customize_items(); bool get_customize_item(int32_t id, customize_item_data& data); int32_t get_customize_item_obj_id(int32_t id); @@ -57,7 +57,7 @@ customize_item::~customize_item() { } -customize_item_data::customize_item_data() : id(), obj_id(), sort_index(), chara_index(), parts(), +customize_item_data::customize_item_data() : id(), obj_id(), sort_index(), chara_num(), parts(), spr_cmnitm_thmb_id_itm_img_spr_id(), field_3C(), field_3D(), field_40(), spr_cmnitm_thmb_id_spr_set_id() { reset(); } @@ -71,7 +71,7 @@ void customize_item_data::reset() { obj_id = -1; sort_index = 0; name.assign(""); - chara_index = CHARA_MIKU; + chara_num = CN_MIKU; parts = -1; spr_cmnitm_thmb_id_itm_img_spr_id = -1; field_3C = false; @@ -120,8 +120,8 @@ void customize_item_data_handler_data_add_all_customize_items() { } void customize_item_table_handler_data_get_chara_item( - const std::string& name, chara_index& chara_index, int32_t& item_no) { - customize_item_data_handler_data->get_chara_item(name, chara_index, item_no); + const std::string& name, CHARA_NUM& chara_num, int32_t& item_no) { + customize_item_data_handler_data->get_chara_item(name, chara_num, item_no); } bool customize_item_data_handler_data_get_customize_item(int32_t id, customize_item_data& data) { @@ -316,12 +316,12 @@ void customize_item_data_handler::add_all_customize_items() { } void customize_item_data_handler::get_chara_item( - const std::string& name, chara_index& chara_index, int32_t& item_no) { + const std::string& name, CHARA_NUM& chara_num, int32_t& item_no) { size_t pos = name.find('_'); if (pos < 6) return; - ::chara_index _chara_index = CHARA_MAX; + CHARA_NUM cn = CN_MAX; int32_t _item_no = atoi(name.substr(6, pos - 6).c_str()); if (!_item_no) return; @@ -330,17 +330,17 @@ void customize_item_data_handler::get_chara_item( std::string chara(name.substr(0, 3)); if (chara.compare("CMN")) - _chara_index = chara_index_get_from_chara_name(chara.c_str()); + cn = get_chara_num_from_char_id(chara.c_str()); else for (const auto& i : customize_item_table_handler_data_get_customize_items()) if (i.second.obj_id == item_no) { if (i.second.chara == 10) - _chara_index = CHARA_MIKU; + cn = CN_MIKU; break; } - if (_chara_index != CHARA_MAX) - chara_index = _chara_index; + if (cn != CN_MAX) + chara_num = cn; } void customize_item_data_handler::add_customize_items() { @@ -357,7 +357,7 @@ void customize_item_data_handler::add_customize_items() { cstm_itm.obj_id = i.second.obj_id; cstm_itm.sort_index = i.second.sort_index; cstm_itm.name.assign(i.second.name); - cstm_itm.chara_index = (chara_index)i.second.chara; + cstm_itm.chara_num = (CHARA_NUM)i.second.chara; cstm_itm.parts = i.second.parts; /*struc_781 v24; diff --git a/src/CRE/customize_item_table.hpp b/src/CRE/customize_item_table.hpp index 37183e89..8bdbc9cf 100644 --- a/src/CRE/customize_item_table.hpp +++ b/src/CRE/customize_item_table.hpp @@ -28,7 +28,7 @@ struct customize_item_data { int32_t obj_id; int32_t sort_index; std::string name; - chara_index chara_index; + CHARA_NUM chara_num; int32_t parts; int32_t spr_cmnitm_thmb_id_itm_img_spr_id; bool field_3C; @@ -55,7 +55,7 @@ extern void customize_item_table_handler_data_free(); extern void customize_item_data_handler_data_init(); extern void customize_item_data_handler_data_add_all_customize_items(); extern void customize_item_table_handler_data_get_chara_item( - const std::string& name, chara_index& chara_index, int32_t& item_no); + const std::string& name, CHARA_NUM& chara_num, int32_t& item_no); extern bool customize_item_data_handler_data_get_customize_item(int32_t id, customize_item_data& data); extern int32_t customize_item_data_handler_data_get_customize_item_obj_id(int32_t id); extern void customize_item_data_handler_data_free(); diff --git a/src/CRE/effect.cpp b/src/CRE/effect.cpp index ddd9a276..9c5b55d3 100644 --- a/src/CRE/effect.cpp +++ b/src/CRE/effect.cpp @@ -254,7 +254,7 @@ struct struc_371 { struct struc_573 { int32_t chara_index; - rob_bone_index bone_index; + BONE_ID bone_index; vec3 position; struc_573(); @@ -2481,7 +2481,7 @@ void EffectFogRing::restart_effect() { for (int32_t i = 0; i < 2; i++, v2++) { struc_573* v3 = *v2; for (int32_t j = 0; j < 5; j++, v3++) { - v3->bone_index = (rob_bone_index)0; + v3->bone_index = (BONE_ID)0; v3->position = 0.0f; } } @@ -2545,19 +2545,19 @@ void EffectFogRing::set_stage_indices(const std::vector& stage_indices) for (int32_t i = 0; i < 2; i++, v2++) { struc_573* v3 = *v2; v3[0].chara_index = i; - v3[0].bone_index = ROB_BONE_KL_TOE_R_WJ; + v3[0].bone_index = BONE_ID_KL_TOE_R_WJ; v3[0].position = 0.0f; v3[1].chara_index = i; - v3[1].bone_index = ROB_BONE_KL_TOE_L_WJ; + v3[1].bone_index = BONE_ID_KL_TOE_L_WJ; v3[1].position = 0.0f; v3[2].chara_index = i; - v3[2].bone_index = ROB_BONE_KL_TE_L_WJ; + v3[2].bone_index = BONE_ID_KL_TE_L_WJ; v3[2].position = 0.0f; v3[3].chara_index = i; - v3[3].bone_index = ROB_BONE_KL_TE_R_WJ; + v3[3].bone_index = BONE_ID_KL_TE_R_WJ; v3[3].position = 0.0f; v3[4].chara_index = i; - v3[4].bone_index = ROB_BONE_N_HARA_CP; + v3[4].bone_index = BONE_ID_N_HARA_CP; v3[4].position = 0.0f; } @@ -4431,7 +4431,7 @@ bool EffectSplashParticle::init(int32_t splash_tex_id, object_info splash_obj_id if (!splash) return false; - emitter_rob_count = dword_1409E59A8_size * ROB_CHARA_COUNT; + emitter_rob_count = dword_1409E59A8_size * ROB_ID_MAX; emitter_rob = new ParticleEmitterRob[emitter_rob_count]; if (!emitter_rob) @@ -4446,7 +4446,7 @@ bool EffectSplashParticle::init(int32_t splash_tex_id, object_info splash_obj_id for (int32_t i = 0; i < splash_count; i++) splash[i].init(5000); - for (int32_t i = 0, j = 0; i < ROB_CHARA_COUNT; i++) + for (int32_t i = 0, j = 0; i < ROB_ID_MAX; i++) for (const int32_t& l : dword_1409E59A8) { ParticleEmitterRob& ptcl_emit_rob = emitter_rob[j++]; ptcl_emit_rob.set_chara(i, l, in_water); @@ -4461,13 +4461,13 @@ bool EffectSplashParticle::init(int32_t splash_tex_id, object_info splash_obj_id if (splash_obj_id.not_null()) { splash_object.init(100); - object_emitter_rob_count = dword_1409E59A8_size * ROB_CHARA_COUNT; + object_emitter_rob_count = dword_1409E59A8_size * ROB_ID_MAX; object_emitter_rob = new ParticleEmitterRob[object_emitter_rob_count]; if (!object_emitter_rob) return false; - for (int32_t i = 0, j = 0; i < ROB_CHARA_COUNT; i++) + for (int32_t i = 0, j = 0; i < ROB_ID_MAX; i++) for (const int32_t& l : dword_1409E59A8) { ParticleEmitterRob& ptcl_emit_rob = object_emitter_rob[j++]; ptcl_emit_rob.set_chara(i, l, in_water); diff --git a/src/CRE/hand_item.cpp b/src/CRE/hand_item.cpp index 06de7c1f..be986381 100644 --- a/src/CRE/hand_item.cpp +++ b/src/CRE/hand_item.cpp @@ -16,13 +16,13 @@ struct hand_item_handler { std::list file_handlers; bool ready; - std::map, hand_item> hand_items; + std::map, hand_item> hand_items; hand_item_handler(); ~hand_item_handler(); void clear(); - const hand_item* get_hand_item(int32_t uid, chara_index chara_index); + const hand_item* get_hand_item(int32_t uid, CHARA_NUM chara_num); int32_t get_hand_item_uid(const char* str); bool load(); void parse(p_file_handler* pfhndl); @@ -30,7 +30,7 @@ struct hand_item_handler { }; static void hand_item_load(const object_database* obj_db, - std::map, hand_item>& hand_items, hnd_itm& hnd_itm_file); + std::map, hand_item>& hand_items, hnd_itm& hnd_itm_file); static int32_t mtp_hand_array_get_mottbl_index(const char* str); @@ -49,13 +49,13 @@ void hand_item_handler_data_init() { hand_item_handler_data = new hand_item_handler; } -const hand_item* hand_item_handler_data_get_hand_item(int32_t uid, chara_index chara_index) { +const hand_item* hand_item_handler_data_get_hand_item(int32_t uid, CHARA_NUM chara_num) { if (uid >= 0) - return hand_item_handler_data->get_hand_item(uid, chara_index); + return hand_item_handler_data->get_hand_item(uid, chara_num); return 0; } -const std::map, hand_item>& hand_item_handler_data_get_hand_items() { +const std::map, hand_item>& hand_item_handler_data_get_hand_items() { return hand_item_handler_data->hand_items; } @@ -100,12 +100,12 @@ void hand_item_handler::clear() { file_handlers.clear(); } -const hand_item* hand_item_handler::get_hand_item(int32_t uid, chara_index chara_index) { - auto elem0 = hand_items.find({ uid, chara_index }); +const hand_item* hand_item_handler::get_hand_item(int32_t uid, CHARA_NUM chara_num) { + auto elem0 = hand_items.find({ uid, chara_num }); if (elem0 != hand_items.end()) return &elem0->second; - auto elem1 = hand_items.find({ uid, CHARA_NONE }); + auto elem1 = hand_items.find({ uid, CN_NONE }); if (elem1 != hand_items.end()) return &elem1->second; return 0; @@ -166,7 +166,7 @@ void hand_item_handler::read() { } static void hand_item_load(const object_database* obj_db, - std::map, hand_item>& hand_items, hnd_itm& hnd_itm_file) { + std::map, hand_item>& hand_items, hnd_itm& hnd_itm_file) { for (hnd_itm_data& i : hnd_itm_file.data) { hand_item itm; itm.obj_left = obj_db->get_object_info(i.objname_left.c_str()); @@ -182,7 +182,7 @@ static void hand_item_load(const object_database* obj_db, continue; itm.hand_mottbl_index = hand_motion_id; - hand_items.insert({ { itm.uid, CHARA_NONE }, itm }); + hand_items.insert({ { itm.uid, CN_NONE }, itm }); } } diff --git a/src/CRE/hand_item.hpp b/src/CRE/hand_item.hpp index fd569462..bd8769b0 100644 --- a/src/CRE/hand_item.hpp +++ b/src/CRE/hand_item.hpp @@ -26,8 +26,8 @@ struct hand_item { }; extern void hand_item_handler_data_init(); -extern const hand_item* hand_item_handler_data_get_hand_item(int32_t uid, chara_index chara_index); -extern const std::map, hand_item>& hand_item_handler_data_get_hand_items(); +extern const hand_item* hand_item_handler_data_get_hand_item(int32_t uid, CHARA_NUM chara_num); +extern const std::map, hand_item>& hand_item_handler_data_get_hand_items(); extern int32_t hand_item_handler_data_get_hand_item_uid(const char* str); extern bool hand_item_handler_data_load(); extern void hand_item_handler_data_read(); diff --git a/src/CRE/item_table.cpp b/src/CRE/item_table.cpp index fda4542a..b6fe81f7 100644 --- a/src/CRE/item_table.cpp +++ b/src/CRE/item_table.cpp @@ -12,7 +12,7 @@ #include "mdata_manager.hpp" struct item_table_handler { - chara_index chara_index; + CHARA_NUM chara_num; std::list file_handlers; bool ready; const char* file; @@ -26,7 +26,7 @@ struct item_table_handler { bool load(); void parse(p_file_handler* pfhndl); void read(); - void set_path(::chara_index chara_index); + void set_path(CHARA_NUM chara_num); }; static void item_table_load(data_struct* data, item_table& itm_tbl, itm_table& itm_tbl_file); @@ -91,14 +91,13 @@ const item_table_item* item_table::get_item(int32_t item_no) { } void item_table_handler_array_init() { - item_table_handler_array = new item_table_handler[CHARA_MAX]; - for (int32_t i = 0; i < CHARA_MAX; i++) - item_table_handler_array[i].set_path((chara_index)i); + item_table_handler_array = new item_table_handler[CN_MAX]; + for (int32_t i = 0; i < CN_MAX; i++) + item_table_handler_array[i].set_path((CHARA_NUM)i); } -const item_cos_data* item_table_handler_array_get_item_cos_data( - chara_index chara_index, int32_t cos_id) { - const item_table* table = item_table_handler_array_get_table(chara_index); +const item_cos_data* item_table_handler_array_get_item_cos_data(CHARA_NUM cn, int32_t cos_id) { + const item_table* table = item_table_handler_array_get_table(cn); if (!table) return 0; @@ -110,52 +109,48 @@ const item_cos_data* item_table_handler_array_get_item_cos_data( return 0; } -const item_table_item* item_table_handler_array_get_item( - chara_index chara_index, int32_t item_no) { - if (chara_index >= 0 && chara_index < CHARA_MAX) - return item_table_handler_array[chara_index].get_item(item_no); +const item_table_item* item_table_handler_array_get_item(CHARA_NUM cn, int32_t item_no) { + if (cn >= 0 && cn < CN_MAX) + return item_table_handler_array[cn].get_item(item_no); return 0; } -std::string item_table_handler_array_get_item_name( - chara_index chara_index, int32_t item_no) { - const item_table_item* item = item_table_handler_array_get_item(chara_index, item_no); +std::string item_table_handler_array_get_item_name(CHARA_NUM cn, int32_t item_no) { + const item_table_item* item = item_table_handler_array_get_item(cn, item_no); if (item) return item->name; return {}; } -item_sub_id item_table_handler_array_get_item_sub_id( - chara_index chara_index, int32_t item_no) { - const item_table_item* item = item_table_handler_array_get_item(chara_index, item_no); +item_sub_id item_table_handler_array_get_item_sub_id(CHARA_NUM cn, int32_t item_no) { + const item_table_item* item = item_table_handler_array_get_item(cn, item_no); if (item) return item->sub_id; return ITEM_SUB_NONE; } -const std::vector* item_table_handler_array_get_item_objset( - chara_index chara_index, int32_t item_no) { - const item_table_item* item = item_table_handler_array_get_item(chara_index, item_no); +const std::vector* item_table_handler_array_get_item_objset(CHARA_NUM cn, int32_t item_no) { + const item_table_item* item = item_table_handler_array_get_item(cn, item_no); if (item) return &item->objset; return 0; } -const item_table* item_table_handler_array_get_table(chara_index chara_index) { - if (chara_index < 0 || chara_index >= CHARA_MAX) +const item_table* item_table_handler_array_get_table(CHARA_NUM cn) { + if (cn < 0 || cn >= CN_MAX) return 0; - return &item_table_handler_array[chara_index].table; + return &item_table_handler_array[cn].table; } bool item_table_handler_array_load() { bool ret = false; - for (int32_t i = 0; i < CHARA_MAX; i++) + for (int32_t i = 0; i < CN_MAX; i++) ret |= item_table_handler_array[i].load(); return ret; } void item_table_handler_array_read() { - for (int32_t i = 0; i < CHARA_MAX; i++) + for (int32_t i = 0; i < CN_MAX; i++) item_table_handler_array[i].read(); } @@ -164,7 +159,7 @@ void item_table_handler_array_free() { } item_table_handler::item_table_handler() : file(), ready() { - chara_index = CHARA_NONE; + chara_num = CN_NONE; } item_table_handler::~item_table_handler() { @@ -186,7 +181,7 @@ const item_table_item* item_table_handler::get_item(int32_t item_no) { } bool item_table_handler::load() { - if (chara_index < 0 || chara_index >= CHARA_MAX || ready || !file) + if (chara_num < 0 || chara_num >= CN_MAX || ready || !file) return false; for (p_file_handler*& i : file_handlers) @@ -241,7 +236,7 @@ void item_table_handler::read() { } } -void item_table_handler::set_path(::chara_index chara_index) { +void item_table_handler::set_path(CHARA_NUM chara_num) { const char* item_table_paths[] = { "mikitm_tbl.txt", "rinitm_tbl.txt", @@ -255,8 +250,8 @@ void item_table_handler::set_path(::chara_index chara_index) { "tetitm_tbl.txt", }; - this->chara_index = chara_index; - this->file = item_table_paths[chara_index]; + this->chara_num = chara_num; + this->file = item_table_paths[chara_num]; } static void item_table_load(data_struct* data, item_table& itm_tbl, itm_table& itm_tbl_file) { diff --git a/src/CRE/item_table.hpp b/src/CRE/item_table.hpp index f4ec8348..431c5af3 100644 --- a/src/CRE/item_table.hpp +++ b/src/CRE/item_table.hpp @@ -14,7 +14,7 @@ struct item_table_item_data_obj { object_info obj_info; - item_id rpk; + ROB_PARTS_KIND rpk; item_table_item_data_obj(); }; @@ -121,17 +121,12 @@ struct item_table { }; extern void item_table_handler_array_init(); -extern const item_cos_data* item_table_handler_array_get_item_cos_data( - chara_index chara_index, int32_t cos_id); -extern const item_table_item* item_table_handler_array_get_item( - chara_index chara_index, int32_t item_no); -extern std::string item_table_handler_array_get_item_name( - chara_index chara_index, int32_t item_no); -extern item_sub_id item_table_handler_array_get_item_sub_id( - chara_index chara_index, int32_t item_no); -extern const std::vector* item_table_handler_array_get_item_objset( - chara_index chara_index, int32_t item_no); -extern const item_table* item_table_handler_array_get_table(chara_index chara_index); +extern const item_cos_data* item_table_handler_array_get_item_cos_data(CHARA_NUM cn, int32_t cos_id); +extern const item_table_item* item_table_handler_array_get_item(CHARA_NUM cn, int32_t item_no); +extern std::string item_table_handler_array_get_item_name(CHARA_NUM cn, int32_t item_no); +extern item_sub_id item_table_handler_array_get_item_sub_id(CHARA_NUM cn, int32_t item_no); +extern const std::vector* item_table_handler_array_get_item_objset(CHARA_NUM cn, int32_t item_no); +extern const item_table* item_table_handler_array_get_table(CHARA_NUM cn); extern bool item_table_handler_array_load(); extern void item_table_handler_array_read(); extern void item_table_handler_array_free(); diff --git a/src/CRE/mdl/disp_manager.cpp b/src/CRE/mdl/disp_manager.cpp index 0f9d45cf..57ef40c1 100644 --- a/src/CRE/mdl/disp_manager.cpp +++ b/src/CRE/mdl/disp_manager.cpp @@ -342,7 +342,7 @@ namespace mdl { args->self_shadow = 2; else args->self_shadow = 0; - args->shadow = disp_manager->shadow_type; + args->shadow = disp_manager->shadow_group; args->texture_color_coefficients = disp_manager->texture_color_coefficients; args->texture_color_coefficients.w = disp_manager->wet_param; args->texture_color_offset = disp_manager->texture_color_offset; @@ -1046,7 +1046,7 @@ namespace mdl { gl_state.bind_element_array_buffer(0); } - DispManager::DispManager() : obj_flags(), shadow_type(), field_8(), field_C(), + DispManager::DispManager() : obj_flags(), shadow_group(), field_8(), field_C(), culling(), show_alpha_center(), show_mat_center(), texture_pattern_count(), texture_pattern_array(), wet_param(), texture_transform_count(), texture_transform_array(), material_list_count(), material_list_array() { @@ -2442,8 +2442,7 @@ namespace mdl { morph_vertex_buffer, morph_vertex_buffer_offset, instances_count, instances_mat, func, func_data); if (obj_flags & mdl::OBJ_SHADOW_OBJECT) { - entry_list((ObjType)(OBJ_TYPE_SHADOW_OBJECT_CHARA - + shadow_type), data); + entry_list((ObjType)(OBJ_TYPE_SHADOW_OBJECT_CHARA + shadow_group), data); if (obj_flags & mdl::OBJ_USER) entry_list(OBJ_TYPE_USER, data); continue; @@ -2506,7 +2505,7 @@ namespace mdl { } else { if (obj_flags & mdl::OBJ_SHADOW) - entry_list((ObjType)(OBJ_TYPE_SHADOW_CHARA + shadow_type), data); + entry_list((ObjType)(OBJ_TYPE_SHADOW_CHARA + shadow_group), data); if (obj_flags & mdl::OBJ_SSS) entry_list(OBJ_TYPE_SSS, data); @@ -2547,8 +2546,7 @@ namespace mdl { } if (obj_flags & mdl::OBJ_SHADOW) - entry_list((ObjType)(OBJ_TYPE_SHADOW_CHARA - + shadow_type), data); + entry_list((ObjType)(OBJ_TYPE_SHADOW_CHARA + shadow_group), data); if (obj_flags & mdl::OBJ_SILHOUETTE_HIGH) entry_list(OBJ_TYPE_SILHOUETTE_HIGH, data); if (obj_flags & mdl::OBJ_CHARA_REFLECT) @@ -2904,7 +2902,7 @@ namespace mdl { data->init_etc(this, mat, first, count, etc); if (etc.color.a == 0xFF) { if (obj_flags & OBJ_SHADOW) - entry_list((mdl::ObjType)(OBJ_TYPE_SHADOW_CHARA + shadow_type), data); + entry_list((mdl::ObjType)(OBJ_TYPE_SHADOW_CHARA + shadow_group), data); entry_list(OBJ_TYPE_OPAQUE, data); } else @@ -2985,8 +2983,8 @@ namespace mdl { return obj_flags; } - shadow_type_enum DispManager::get_shadow_type() { - return shadow_type; + SHADOW_GROUP DispManager::get_shadow_group() { + return shadow_group; } void DispManager::get_texture_color_coeff(vec4& value) { @@ -3242,9 +3240,9 @@ namespace mdl { morph.object = object; } - void DispManager::set_shadow_type(shadow_type_enum type) { - if (type == SHADOW_CHARA || type == SHADOW_STAGE) - shadow_type = type; + void DispManager::set_shadow_group(SHADOW_GROUP value) { + if (value >= 0 || value == SHADOW_GROUP_MAX) + shadow_group = value; } void DispManager::set_texture_color_coefficients(const vec4& value) { diff --git a/src/CRE/mdl/disp_manager.hpp b/src/CRE/mdl/disp_manager.hpp index 9d4f7dc6..9e57c7b5 100644 --- a/src/CRE/mdl/disp_manager.hpp +++ b/src/CRE/mdl/disp_manager.hpp @@ -198,7 +198,7 @@ namespace mdl { vec4 blend_color; vec4 emission; int32_t self_shadow; - shadow_type_enum shadow; + SHADOW_GROUP shadow; GLuint morph_vertex_buffer; size_t morph_vertex_buffer_offset; float_t morph_weight; @@ -486,7 +486,7 @@ namespace mdl { }; mdl::ObjFlags obj_flags; - shadow_type_enum shadow_type; + SHADOW_GROUP shadow_group; int32_t field_8; int32_t field_C; mdl::ObjList obj[mdl::OBJ_TYPE_MAX]; @@ -579,7 +579,7 @@ namespace mdl { int32_t get_obj_count(ObjTypeScreen type); int32_t get_obj_count(ObjTypeReflect type); ObjFlags get_obj_flags(); - shadow_type_enum get_shadow_type(); + SHADOW_GROUP get_shadow_group(); void get_texture_color_coeff(vec4& value); void get_texture_color_offset(vec4& value); void get_texture_pattern(int32_t& count, texture_pattern_struct*& value); @@ -602,7 +602,7 @@ namespace mdl { void set_obj_flags(ObjFlags flags = (ObjFlags)0); void set_material_list(int32_t count = 0, const material_list_struct* value = 0); void set_morph(object_info object = {}, float_t weight = 0.0f); - void set_shadow_type(shadow_type_enum type = SHADOW_CHARA); + void set_shadow_group(SHADOW_GROUP value = SHADOW_GROUP_CHARA); void set_texture_color_coefficients(const vec4& value); void set_texture_color_offset(const vec4& value); void set_texture_pattern(int32_t count = 0, const texture_pattern_struct* value = 0); diff --git a/src/CRE/mdl/draw_object.cpp b/src/CRE/mdl/draw_object.cpp index 8df28999..f46494f7 100644 --- a/src/CRE/mdl/draw_object.cpp +++ b/src/CRE/mdl/draw_object.cpp @@ -669,7 +669,7 @@ static void draw_object_material_set_default(render_data_context& rend_data_ctx, else rend_data_ctx.shader_flags.arr[U_STAGE_SHADOW] = 1; - rend_data_ctx.shader_flags.arr[U_CHARA_SHADOW2] = args->shadow > SHADOW_CHARA ? 1 : 0; + rend_data_ctx.shader_flags.arr[U_CHARA_SHADOW2] = args->shadow > SHADOW_GROUP_CHARA ? 1 : 0; rend_data_ctx.shader_flags.arr[U_CHARA_SHADOW] = rctx_ptr->draw_state->rend_data[rend_data_ctx.index].self_shadow ? 1 : 0; diff --git a/src/CRE/module_table.cpp b/src/CRE/module_table.cpp index bfc55164..ef50ca1d 100644 --- a/src/CRE/module_table.cpp +++ b/src/CRE/module_table.cpp @@ -42,31 +42,31 @@ struct module_data_handler { void add_all_modules(); void add_modules(); void add_random_modules(); - bool get_module(chara_index chara_index, int32_t cos, module_data& data); + bool get_module(CHARA_NUM chara_num, int32_t cos, module_data& data); bool get_module(int32_t id, module_data& data); }; struct module_data_random { int32_t id; int32_t sort_index; - chara_index chara_index; + CHARA_NUM chara_num; int32_t spr_sel_mdrchrcmn_spr_set_id; int32_t spr_sel_mdrchrcmn_md_img_spr_id; const char* name; }; module_data_random module_data_random_data[] = { - { -2, 0, CHARA_MIKU , 1935, 35031, u8"オール ランダム" }, - { -3, 1, CHARA_MIKU , 1947, 35043, u8"初音ミク ランダム" }, - { -4, 2, CHARA_RIN , 1951, 35047, u8"鏡音リン ランダム" }, - { -5, 3, CHARA_LEN , 1941, 35037, u8"鏡音レン ランダム" }, - { -6, 4, CHARA_LUKA , 1943, 35039, u8"巡音ルカ ランダム" }, - { -7, 8, CHARA_NERU , 1949, 35045, u8"亞北ネル ランダム" }, - { -8, 7, CHARA_HAKU , 1937, 35033, u8"弱音ハク ランダム" }, - { -9, 6, CHARA_KAITO , 1939, 35035, u8"カイト ランダム" }, - { -10, 5, CHARA_MEIKO , 1945, 35041, u8"メイコ ランダム" }, - { -11, 9, CHARA_SAKINE, 1953, 35049, u8"咲音メイコ ランダム" }, - { -12, 10, CHARA_TETO , 2400, 35051, u8"重音テト ランダム" }, + { -2, 0, CN_MIKU , 1935, 35031, u8"オール ランダム" }, + { -3, 1, CN_MIKU , 1947, 35043, u8"初音ミク ランダム" }, + { -4, 2, CN_RIN , 1951, 35047, u8"鏡音リン ランダム" }, + { -5, 3, CN_LEN , 1941, 35037, u8"鏡音レン ランダム" }, + { -6, 4, CN_LUKA , 1943, 35039, u8"巡音ルカ ランダム" }, + { -7, 8, CN_NERU , 1949, 35045, u8"亞北ネル ランダム" }, + { -8, 7, CN_HAKU , 1937, 35033, u8"弱音ハク ランダム" }, + { -9, 6, CN_KAITO , 1939, 35035, u8"カイト ランダム" }, + { -10, 5, CN_MEIKO , 1945, 35041, u8"メイコ ランダム" }, + { -11, 9, CN_SAKINE, 1953, 35049, u8"咲音メイコ ランダム" }, + { -12, 10, CN_TETO , 2400, 35051, u8"重音テト ランダム" }, }; module_table_handler* module_table_handler_data; @@ -80,7 +80,7 @@ module::~module() { } -module_data::module_data() : id(), sort_index(), chara_index(), cos(), sleeve_l(), sleeve_r(), +module_data::module_data() : id(), sort_index(), chara_num(), cos(), sleeve_l(), sleeve_r(), spr_sel_md_id_spr_set_id(), spr_sel_md_id_cmn_spr_set_id(), spr_sel_md_id_md_img_id_spr_id(), spr_sel_md_id_cmn_md_img_spr_id(), field_78(), field_79(), field_A0() { reset(); @@ -93,7 +93,7 @@ module_data::~module_data() { void module_data::reset() { id = -1; sort_index = 0; - chara_index = CHARA_MIKU; + chara_num = CN_MIKU; cos = 0; sleeve_l = {}; sleeve_r = {}; @@ -146,8 +146,8 @@ void module_data_handler_data_add_all_modules() { module_data_handler_data->add_all_modules(); } -bool module_data_handler_data_get_module(chara_index chara_index, int32_t cos, module_data& data) { - return module_data_handler_data->get_module(chara_index, cos, data); +bool module_data_handler_data_get_module(CHARA_NUM chara_num, int32_t cos, module_data& data) { + return module_data_handler_data->get_module(chara_num, cos, data); } bool module_data_handler_data_get_module(int32_t id, module_data& data) { @@ -349,11 +349,11 @@ void module_data_handler::add_modules() { mdl.id = i.second.id; mdl.sort_index = i.second.sort_index; mdl.name.assign(i.second.name); - mdl.chara_index = (chara_index)i.second.chara; + mdl.chara_num = (CHARA_NUM)i.second.chara; mdl.cos = i.second.cos; mdl.field_79 = false; - rob_sleeve_handler_data_get_sleeve_data(mdl.chara_index, mdl.cos, mdl.sleeve_l, mdl.sleeve_r); + rob_sleeve_handler_data_get_sleeve_data(mdl.chara_num, mdl.cos, mdl.sleeve_l, mdl.sleeve_r); sprintf_s(buf, sizeof(buf), "SPR_SEL_MD%03d", mdl.id); mdl.spr_sel_md_id_spr_set_id = aft_spr_db->get_spr_set_by_name(buf)->id; @@ -390,7 +390,7 @@ void module_data_handler::add_random_modules() { mdl.id = i.id; mdl.sort_index = i.sort_index; mdl.name.assign(i.name); - mdl.chara_index = i.chara_index; + mdl.chara_num = i.chara_num; mdl.cos = -1; mdl.field_79 = false; mdl.spr_sel_md_id_cmn_spr_set_id = i.spr_sel_mdrchrcmn_spr_set_id; @@ -399,9 +399,9 @@ void module_data_handler::add_random_modules() { } } -bool module_data_handler::get_module(chara_index chara_index, int32_t cos, module_data& data) { +bool module_data_handler::get_module(CHARA_NUM chara_num, int32_t cos, module_data& data) { for (module_data& i : modules) - if (i.chara_index == chara_index && i.cos == cos) { + if (i.chara_num == chara_num && i.cos == cos) { data = i; return true; diff --git a/src/CRE/module_table.hpp b/src/CRE/module_table.hpp index 3b98493e..d408260c 100644 --- a/src/CRE/module_table.hpp +++ b/src/CRE/module_table.hpp @@ -26,7 +26,7 @@ struct module { struct module_data { int32_t id; int32_t sort_index; - chara_index chara_index; + CHARA_NUM chara_num; int32_t cos; rob_sleeve_data sleeve_l; rob_sleeve_data sleeve_r; @@ -56,7 +56,7 @@ extern void module_table_handler_data_free(); extern void module_data_handler_data_init(); extern void module_data_handler_data_add_all_modules(); -extern bool module_data_handler_data_get_module(chara_index chara_index, int32_t cos, module_data& data); +extern bool module_data_handler_data_get_module(CHARA_NUM chara_num, int32_t cos, module_data& data); extern bool module_data_handler_data_get_module(int32_t id, module_data& data); extern const std::vector& module_data_handler_data_get_modules(); extern void module_data_handler_data_free(); diff --git a/src/CRE/pv_db.cpp b/src/CRE/pv_db.cpp index ded6c4e6..e5366b10 100644 --- a/src/CRE/pv_db.cpp +++ b/src/CRE/pv_db.cpp @@ -25,7 +25,7 @@ pv_db_pv_lyric::~pv_db_pv_lyric() { pv_db_pv_performer::pv_db_pv_performer() { type = PV_PERFORMER_VOCAL; - chara = (chara_index)-1; + chara = CN_NONE; costume = -1; pv_costume[0] = -1; pv_costume[1] = -1; @@ -255,7 +255,7 @@ int32_t pv_db_pv_difficulty::get_hand_item_uid(int32_t index) const { const pv_db_pv_motion& pv_db_pv_difficulty::get_motion_or_default(int32_t chara_id, int32_t index) const { static const pv_db_pv_motion pv_db_pv_motion_null; - if (chara_id < 0 || chara_id >= ROB_CHARA_COUNT) + if (chara_id < 0 || chara_id >= ROB_ID_MAX) return pv_db_pv_motion_null; for (const pv_db_pv_motion& i : motion[chara_id]) @@ -341,8 +341,8 @@ pv_db_pv_ex_song::~pv_db_pv_ex_song() { } void pv_db_pv_ex_song::reset() { - for (chara_index& i : chara) - i = (chara_index)-1; + for (CHARA_NUM& i : chara) + i = CN_NONE; file.clear(); file.shrink_to_fit(); name.clear(); @@ -490,7 +490,7 @@ pv_db_pv::~pv_db_pv() { } int32_t pv_db_pv::get_chrmot_motion_id(int32_t chara_id, - chara_index chara_index, const pv_db_pv_motion& motion) const { + CHARA_NUM chara_num, const pv_db_pv_motion& motion) const { if (!chrmot.size()) return motion.id; @@ -498,8 +498,8 @@ int32_t pv_db_pv::get_chrmot_motion_id(int32_t chara_id, motion_database* aft_mot_db = &aft_data->data_ft.mot_db; for (const pv_db_pv_chrmot& i : chrmot) - if (i.id == chara_id && chara_index_get_from_chara_name(i.chara.c_str()) - == chara_index && !i.org_name.compare(motion.name)) { + if (i.id == chara_id && get_chara_num_from_char_id(i.chara.c_str()) == chara_num + && !i.org_name.compare(motion.name)) { uint32_t motion_id = aft_mot_db->get_motion_id(i.name.c_str()); if (motion_id != -1) return motion_id; @@ -529,11 +529,11 @@ const pv_db_pv_difficulty* pv_db_pv::get_difficulty(pv_difficulty difficulty, pv return 0; } -chara_index pv_db_pv::get_performer_chara(int32_t performer) const { - if (performer < 0 || performer >= ROB_CHARA_COUNT || performer >= this->performer.size()) - return CHARA_MIKU; +CHARA_NUM pv_db_pv::get_performer_chara(int32_t performer) const { + if (performer < 0 || performer >= ROB_ID_MAX || performer >= this->performer.size()) + return CN_MIKU; - chara_index chara = this->performer[performer].chara; + CHARA_NUM chara = this->performer[performer].chara; pv_performer_type type = this->performer[performer].type; if (type >= PV_PERFORMER_PSEUDO_DEFAULT && type <= PV_PERFORMER_PSEUDO_MYCHARA) { performer = get_performer_pseudo_same_id(performer); @@ -541,14 +541,14 @@ chara_index pv_db_pv::get_performer_chara(int32_t performer) const { chara = this->performer[performer].chara; } - if (chara < 0 || chara >= CHARA_MAX) - chara = CHARA_MIKU; + if (chara < 0 || chara >= CN_MAX) + chara = CN_MIKU; return chara; } int32_t pv_db_pv::get_performer_costume(int32_t performer) const { - if (performer < 0 || performer >= ROB_CHARA_COUNT || performer >= this->performer.size()) + if (performer < 0 || performer >= ROB_ID_MAX || performer >= this->performer.size()) return -1; int32_t costume = this->performer[performer].costume; @@ -570,14 +570,14 @@ size_t pv_db_pv::get_performer_count() const { } int32_t pv_db_pv::get_performer_exclude(int32_t performer) const { - if (performer < 0 || performer >= ROB_CHARA_COUNT || performer >= this->performer.size()) + if (performer < 0 || performer >= ROB_ID_MAX || performer >= this->performer.size()) return -1; return this->performer[performer].exclude; } bool pv_db_pv::get_performer_fixed(int32_t performer) const { - if (performer < 0 || performer >= ROB_CHARA_COUNT || performer >= this->performer.size()) + if (performer < 0 || performer >= ROB_ID_MAX || performer >= this->performer.size()) return false; return this->performer[performer].fixed; @@ -592,7 +592,7 @@ size_t pv_db_pv::get_performer_fixed_count() const { } int32_t pv_db_pv::get_performer_item(int32_t performer, pv_performer_item item) const { - if (performer < 0 || performer >= ROB_CHARA_COUNT || performer >= this->performer.size()) + if (performer < 0 || performer >= ROB_ID_MAX || performer >= this->performer.size()) return -1; if (item >= 0 && item < PV_PERFORMER_ITEM_MAX) @@ -600,23 +600,23 @@ int32_t pv_db_pv::get_performer_item(int32_t performer, pv_performer_item item) return -1; } -bool pv_db_pv::get_performer_pseudo_fixed(chara_index chara_index, int32_t performer, bool a4, bool a5) const { - if (performer < 0 || performer >= ROB_CHARA_COUNT - || chara_index < 0 || chara_index >= CHARA_MAX || performer >= this->performer.size()) +bool pv_db_pv::get_performer_pseudo_fixed(CHARA_NUM chara_num, int32_t performer, bool a4, bool a5) const { + if (performer < 0 || performer >= ROB_ID_MAX + || chara_num < 0 || chara_num >= CN_MAX || performer >= this->performer.size()) return false; - ::chara_index chara = this->performer[performer].chara; + CHARA_NUM chara = this->performer[performer].chara; pv_performer_type type = this->performer[performer].type; bool v11 = (!a5 ? !a4 : false) || get_performer_fixed(performer); if (type >= PV_PERFORMER_PSEUDO_DEFAULT && type <= PV_PERFORMER_PSEUDO_MYCHARA) return true; - else if (chara < 0 || chara >= CHARA_MAX) + else if (chara < 0 || chara >= CN_MAX) return false; return v11; } int32_t pv_db_pv::get_performer_pseudo_same_id(int32_t performer) const { - if (performer < 0 || performer >= ROB_CHARA_COUNT || performer >= this->performer.size()) + if (performer < 0 || performer >= ROB_ID_MAX || performer >= this->performer.size()) return -1; pv_performer_type type = this->performer[performer].type; @@ -640,7 +640,7 @@ int32_t pv_db_pv::get_performer_pseudo_same_id(int32_t performer) const { } int32_t pv_db_pv::get_performer_pv_costume(int32_t performer, pv_difficulty difficulty) const { - if (performer < 0 || performer >= ROB_CHARA_COUNT || performer >= this->performer.size()) + if (performer < 0 || performer >= ROB_ID_MAX || performer >= this->performer.size()) return -1; const pv_db_pv_performer* perf = &this->performer[performer]; @@ -666,7 +666,7 @@ int32_t pv_db_pv::get_performer_pv_costume(int32_t performer, pv_difficulty diff } pv_performer_size pv_db_pv::get_performer_size(int32_t performer) const { - if (performer < 0 || performer >= ROB_CHARA_COUNT || performer >= this->performer.size()) + if (performer < 0 || performer >= ROB_ID_MAX || performer >= this->performer.size()) return PV_PERFORMER_NORMAL; pv_performer_size size = this->performer[performer].size; @@ -680,14 +680,14 @@ pv_performer_size pv_db_pv::get_performer_size(int32_t performer) const { } pv_performer_type pv_db_pv::get_performer_type(int32_t performer) const { - if (performer < 0 || performer >= ROB_CHARA_COUNT || performer >= this->performer.size()) + if (performer < 0 || performer >= ROB_ID_MAX || performer >= this->performer.size()) return PV_PERFORMER_VOCAL; return this->performer[performer].type; } bool pv_db_pv::is_performer_type_pseudo(int32_t performer) const { - if (performer < 0 || performer >= ROB_CHARA_COUNT || performer >= this->performer.size()) + if (performer < 0 || performer >= ROB_ID_MAX || performer >= this->performer.size()) return false; pv_performer_type type = this->performer[performer].type; @@ -695,7 +695,7 @@ bool pv_db_pv::is_performer_type_pseudo(int32_t performer) const { } bool pv_db_pv::is_performer_type_vocal(int32_t performer) const { - if (performer < 0 || performer >= ROB_CHARA_COUNT || performer >= this->performer.size()) + if (performer < 0 || performer >= ROB_ID_MAX || performer >= this->performer.size()) return false; return this->performer[performer].type == PV_PERFORMER_VOCAL; @@ -756,14 +756,14 @@ void pv_db_pv::reset() { auth_replace_by_module.shrink_to_fit(); } -int32_t pv_db_pv::get_pseudo_costume(pv_performer_type type, chara_index chara_index, int32_t costume) { +int32_t pv_db_pv::get_pseudo_costume(pv_performer_type type, CHARA_NUM chara_num, int32_t costume) { switch (type) { case PV_PERFORMER_PSEUDO_SAME: return costume; case PV_PERFORMER_PSEUDO_SWIM: - return chara_init_data_get_swim_costume(chara_index); + return rob_data_get_swim_costume(chara_num); case PV_PERFORMER_PSEUDO_SWIM_S: - return chara_init_data_get_swim_s_costume(chara_index); + return rob_data_get_swim_s_costume(chara_num); case PV_PERFORMER_PSEUDO_MYCHARA: return -1; default: @@ -1136,9 +1136,9 @@ namespace pv_db { const char* chara; if (kv.read("chara", chara)) { - chara_index chara_index = chara_index_get_from_chara_name(chara); - if (chara_index != CHARA_MAX) - performer.chara = chara_index; + CHARA_NUM chara_num = get_chara_num_from_char_id(chara); + if (chara_num != CN_MAX) + performer.chara = chara_num; } int32_t costume; @@ -1309,14 +1309,14 @@ namespace pv_db { const char* chr; if (kv.read("chr", chr)) { - chara_index chara_index = chara_index_get_from_chara_name(chr); + CHARA_NUM chara_num = get_chara_num_from_char_id(chr); float_t xp_rate; float_t xn_rate; - if (chara_index != CHARA_MAX && kv.read("xp_rate", xp_rate) && kv.read("xn_rate", xn_rate)) { + if (chara_num != CN_MAX && kv.read("xp_rate", xp_rate) && kv.read("xn_rate", xn_rate)) { pv_db_pv_eyes_rot_rate eyes_rot_rate; eyes_rot_rate.xp_rate = xp_rate; eyes_rot_rate.xn_rate = xn_rate; - pv->eyes_rot_rate.insert_or_assign(chara_index, eyes_rot_rate); + pv->eyes_rot_rate.insert_or_assign(chara_num, eyes_rot_rate); } } @@ -1325,8 +1325,8 @@ namespace pv_db { kv.close_scope(); } - int32_t pv_costumes[ROB_CHARA_COUNT][PV_DIFFICULTY_MAX]; - for (int32_t i = 0; i < ROB_CHARA_COUNT; i++) + int32_t pv_costumes[ROB_ID_MAX][PV_DIFFICULTY_MAX]; + for (int32_t i = 0; i < ROB_ID_MAX; i++) for (int32_t j = 0; j < PV_DIFFICULTY_MAX; j++) pv_costumes[i][j] = -1; @@ -1462,7 +1462,7 @@ namespace pv_db { if (kv.read("slidertouch_name", slidertouch_name)) d.slidertouch_name.assign(slidertouch_name); - for (size_t l = 0; l < ROB_CHARA_COUNT; l++) { + for (size_t l = 0; l < ROB_ID_MAX; l++) { if (l) sprintf_s(buf, sizeof(buf), "motion%zuP", l + 1); @@ -1710,7 +1710,7 @@ namespace pv_db { if (kv.read("edit_chara_scale", edit_chara_scale)) d.edit_chara_scale = edit_chara_scale == 1; - for (int32_t l = 0; l < ROB_CHARA_COUNT; l++) { + for (int32_t l = 0; l < ROB_ID_MAX; l++) { if (!kv.open_scope_fmt("performer.%d.pv_costume", l)) continue; @@ -1752,17 +1752,17 @@ namespace pv_db { kv.read("name", name); pv_db_pv_ex_song ex_song; - ex_song.chara[0] = chara_index_get_from_chara_name(chara); + ex_song.chara[0] = get_chara_num_from_char_id(chara); int32_t _chara_count = 1; bool v533 = false; - for (size_t j = 1; j < ROB_CHARA_COUNT; j++) { + for (size_t j = 1; j < ROB_ID_MAX; j++) { sprintf_s(buf, sizeof(buf), "chara%zuP", j + 1); const char* chara; if (kv.read(buf, chara)) { - ex_song.chara[j] = chara_index_get_from_chara_name(chara); + ex_song.chara[j] = get_chara_num_from_char_id(chara); if (v533) goto ex_song_reset; } @@ -1972,7 +1972,7 @@ namespace pv_db { frame_texture.type = PV_FRAME_TEXTURE_POST_PP; } - for (int32_t i = 0; i < ROB_CHARA_COUNT; i++) + for (int32_t i = 0; i < ROB_ID_MAX; i++) for (int32_t j = 0; j < PV_DIFFICULTY_MAX; j++) { int32_t pv_costume = pv_costumes[i][j]; if (pv_costume == -1) @@ -2247,14 +2247,14 @@ namespace pv_db { } } -item_id pv_performer_item_to_item_id(pv_performer_item item) { - static const item_id pv_performer_item_id_to_item_id_table[] = { - ITEM_ZUJO, ITEM_MEGANE, ITEM_KUBI, ITEM_JOHA_USHIRO, +ROB_PARTS_KIND pv_performer_item_to_rob_parts_kind(pv_performer_item item) { + static const ROB_PARTS_KIND pv_performer_item_to_rob_parts_kind_table[] = { + RPK_ZUJO, RPK_MEGANE, RPK_KUBI, RPK_JOHA_USHIRO, }; if (item >= 0 && item < PV_PERFORMER_ITEM_MAX) - return pv_performer_item_id_to_item_id_table[item]; - return ITEM_NONE; + return pv_performer_item_to_rob_parts_kind_table[item]; + return RPK_NONE; } item_sub_id pv_performer_item_to_item_sub_id(pv_performer_item item) { diff --git a/src/CRE/pv_db.hpp b/src/CRE/pv_db.hpp index cb062a01..2757568a 100644 --- a/src/CRE/pv_db.hpp +++ b/src/CRE/pv_db.hpp @@ -126,7 +126,7 @@ struct pv_db_pv_sabi { struct pv_db_pv_performer { pv_performer_type type; - chara_index chara; + CHARA_NUM chara; int32_t costume; int32_t pv_costume[PV_DIFFICULTY_MAX]; bool fixed; @@ -290,7 +290,7 @@ struct pv_db_pv_difficulty { std::string chainslide_success_name; std::string chainslide_failure_name; std::string slidertouch_name; - std::vector motion[ROB_CHARA_COUNT]; + std::vector motion[ROB_ID_MAX]; pv_db_pv_field_parent field; std::vector pv_item; std::vector hand_item; @@ -326,7 +326,7 @@ struct pv_db_pv_ex_song_ex_auth { }; struct pv_db_pv_ex_song { - chara_index chara[ROB_CHARA_COUNT]; + CHARA_NUM chara[ROB_ID_MAX]; std::string file; std::string name; std::vector ex_auth; @@ -490,7 +490,7 @@ struct pv_db_pv { bool eyes_xrot_adjust; bool is_old_pv; eyes_base_adjust_type eyes_base_adjust_type; - std::map eyes_rot_rate; + std::map eyes_rot_rate; std::vector another_song; bool pre_play_script; pv_db_pv_frame_texture frame_texture[6]; @@ -500,18 +500,18 @@ struct pv_db_pv { ~pv_db_pv(); int32_t get_chrmot_motion_id(int32_t chara_id, - chara_index chara_index, const pv_db_pv_motion& motion) const; + CHARA_NUM chara_num, const pv_db_pv_motion& motion) const; const pv_db_pv_difficulty* get_difficulty( pv_difficulty difficulty, pv_attribute_type attribute_type) const; const pv_db_pv_difficulty* get_difficulty(pv_difficulty difficulty, pv_edition edition) const; - chara_index get_performer_chara(int32_t performer) const; + CHARA_NUM get_performer_chara(int32_t performer) const; int32_t get_performer_costume(int32_t performer) const; size_t get_performer_count() const; int32_t get_performer_exclude(int32_t performer) const; bool get_performer_fixed(int32_t performer) const; size_t get_performer_fixed_count() const; int32_t get_performer_item(int32_t performer, pv_performer_item item) const; - bool get_performer_pseudo_fixed(chara_index chara_index, int32_t performer, bool a4, bool a5) const; + bool get_performer_pseudo_fixed(CHARA_NUM chara_num, int32_t performer, bool a4, bool a5) const; int32_t get_performer_pseudo_same_id(int32_t performer) const; int32_t get_performer_pv_costume(int32_t performer, pv_difficulty difficulty) const; pv_performer_size get_performer_size(int32_t performer) const; @@ -520,7 +520,7 @@ struct pv_db_pv { bool is_performer_type_vocal(int32_t performer) const; void reset(); - static int32_t get_pseudo_costume(pv_performer_type type, chara_index chara_index, int32_t costume); + static int32_t get_pseudo_costume(pv_performer_type type, CHARA_NUM chara_num, int32_t costume); }; namespace pv_db { @@ -555,7 +555,7 @@ namespace pv_db { }; } -extern item_id pv_performer_item_to_item_id(pv_performer_item item); +extern ROB_PARTS_KIND pv_performer_item_to_rob_parts_kind(pv_performer_item item); extern item_sub_id pv_performer_item_to_item_sub_id(pv_performer_item item); extern void task_pv_db_init(); diff --git a/src/CRE/pv_expression.cpp b/src/CRE/pv_expression.cpp index ab1e9a2e..5d53203b 100644 --- a/src/CRE/pv_expression.cpp +++ b/src/CRE/pv_expression.cpp @@ -52,7 +52,7 @@ struct pv_expression { bool set_motion(uint32_t hash, uint32_t motion_id); }; -pv_expression pv_expression_array[ROB_CHARA_COUNT]; +pv_expression pv_expression_array[ROB_ID_MAX]; extern render_context* rctx_ptr; @@ -92,7 +92,7 @@ void pv_expression_array_reset_data() { } void pv_expression_array_reset_motion(size_t chara_id) { - if (chara_id < 0 || chara_id >= ROB_CHARA_COUNT) + if (chara_id < 0 || chara_id >= ROB_ID_MAX) return; pv_expression& exp = pv_expression_array[chara_id]; @@ -102,7 +102,7 @@ void pv_expression_array_reset_motion(size_t chara_id) { } bool pv_expression_array_set(size_t chara_id, void* rob_chr, float_t frame_speed) { - if (chara_id < 0 || chara_id >= ROB_CHARA_COUNT) + if (chara_id < 0 || chara_id >= ROB_ID_MAX) return false; pv_expression& exp = pv_expression_array[chara_id]; @@ -113,13 +113,13 @@ bool pv_expression_array_set(size_t chara_id, void* rob_chr, float_t frame_speed } bool pv_expression_array_set_motion(const char* path, size_t chara_id, uint32_t motion_id) { - if (chara_id >= 0 && chara_id < ROB_CHARA_COUNT) + if (chara_id >= 0 && chara_id < ROB_ID_MAX) return pv_expression_array[chara_id].set_motion(path, motion_id); return false; } bool pv_expression_array_set_motion(uint32_t hash, size_t chara_id, uint32_t motion_id) { - if (chara_id >= 0 && chara_id < ROB_CHARA_COUNT) + if (chara_id >= 0 && chara_id < ROB_ID_MAX) return pv_expression_array[chara_id].set_motion(hash, motion_id); return false; } diff --git a/src/CRE/pv_param.cpp b/src/CRE/pv_param.cpp index 2394ca61..6cacecc0 100644 --- a/src/CRE/pv_param.cpp +++ b/src/CRE/pv_param.cpp @@ -731,7 +731,7 @@ namespace pv_param_task { class PostProcessCtrlCharaAlpha : public PostProcessCtrl { public: struct Data { - pv_param::chara_alpha data[ROB_CHARA_COUNT]; + pv_param::chara_alpha data[ROB_ID_MAX]; Data(); } data; @@ -745,8 +745,8 @@ namespace pv_param_task { class PostProcessCtrlCharaItemAlpha : public PostProcessCtrlCharaAlpha { public: - post_process_task_set_chara_item_alpha_callback callback[ROB_CHARA_COUNT]; - void* callback_data[ROB_CHARA_COUNT]; + post_process_task_set_chara_item_alpha_callback callback[ROB_ID_MAX]; + void* callback_data[ROB_ID_MAX]; PostProcessCtrlCharaItemAlpha(); ~PostProcessCtrlCharaItemAlpha(); @@ -1156,7 +1156,7 @@ namespace pv_param_task { else { rob_chara* rob_chr = rob_chara_array_get(data.data.chara_id); if (rob_chr) - mat4_get_translation(rob_chr->get_bone_data_mat(MOTION_BONE_CL_KAO), &trans); + mat4_get_translation(rob_chr->get_bone_data_mat(BLK_CL_KAO), &trans); } camera* cam = rctx_ptr->camera; diff --git a/src/CRE/render.cpp b/src/CRE/render.cpp index c4b16776..ad16b612 100644 --- a/src/CRE/render.cpp +++ b/src/CRE/render.cpp @@ -323,7 +323,7 @@ namespace rndr { int32_t query_index = (this->exposure_query_index + 1) % 3; this->exposure_query_index = query_index; int32_t next_query_index = (query_index + 2) % 3; - for (int32_t i = 0; i < ROB_CHARA_COUNT; i++, chara_data++) { + for (int32_t i = 0; i < ROB_ID_MAX; i++, chara_data++) { rob_chara* rob_chr = rob_chara_array_get(i); if (!rob_chr || !rob_chr->is_visible()) continue; @@ -1888,7 +1888,7 @@ namespace rndr { bool v2 = false; if (!reset_exposure) { ExposureCharaData* chara_data = exposure_chara_data; - for (int32_t i = 0; i < ROB_CHARA_COUNT; i++, chara_data++) { + for (int32_t i = 0; i < ROB_ID_MAX; i++, chara_data++) { rob_chara* rob_chr = rob_chara_array_get(i); if (!rob_chr || !rob_chr->is_visible()) continue; @@ -1984,7 +1984,7 @@ namespace rndr { }; ExposureCharaData* chara_data = exposure_chara_data; - for (int32_t i = 0; i < 4 && i < ROB_CHARA_COUNT; i++, chara_data++) + for (int32_t i = 0; i < 4 && i < ROB_ID_MAX; i++, chara_data++) for (int32_t j = 0; j < 8; j++) exposure_measure.g_spot_coefficients[i * 8 + j] = chara_data->spot_coefficients[j]; rctx->exposure_measure_ubo.WriteMemory(rend_data_ctx.state, exposure_measure); diff --git a/src/CRE/renderer/dof.cpp b/src/CRE/renderer/dof.cpp index c525cb2c..1847927f 100644 --- a/src/CRE/renderer/dof.cpp +++ b/src/CRE/renderer/dof.cpp @@ -76,7 +76,7 @@ namespace renderer { float_t focus = dof_debug_data.focus; if (dof_debug_data.flags & DOF_DEBUG_AUTO_FOCUS) { rob_chara* rob_chr = 0; - for (int32_t i = 0; i < ROB_CHARA_COUNT; i++) { + for (int32_t i = 0; i < ROB_ID_MAX; i++) { rob_chara* rob_chr = rob_chara_array_get(i); if (!rob_chr || !rob_chr->is_visible()) continue; diff --git a/src/CRE/rob/ex_block.cpp b/src/CRE/rob/ex_block.cpp index db0cc814..dd70f018 100644 --- a/src/CRE/rob/ex_block.cpp +++ b/src/CRE/rob/ex_block.cpp @@ -184,7 +184,7 @@ void ExNodeBlock::init_members() { } // 0x1405EEB80 -void ExNodeBlock::set_data(bone_node* node, ExNodeType type, +void ExNodeBlock::set_data(RobNode* node, ExNodeType type, const char* name, const rob_chara_item_equip_object* skin_disp) { init_members(); @@ -253,7 +253,7 @@ void ExNullBlock::pos_init_cont() { void ExNullBlock::set_data(const rob_chara_item_equip_object* skin_disp, const obj_skin_ex_node_constraint* data, const char* name, const bone_database* bone_data) { - bone_node* node = (bone_node*)skin_disp->get_node(name, bone_data); + RobNode* node = (RobNode*)skin_disp->get_node(name, bone_data); type = EX_NODE_TYPE_NULL; dst_node = node; this->data = data; @@ -999,11 +999,9 @@ void osage_ring_data::parse(const std::string& path, osage_ring_data& ring) { 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); + node_idx0 = aft_bone_data->get_bone_index(BONE_KIND_CMN, 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); + node_idx1 = aft_bone_data->get_bone_index(BONE_KIND_CMN, bone1_name); } if (node_idx0 >= 0) { @@ -1746,11 +1744,11 @@ void RobCloth::ctrl(const float_t dt, bool init_flag) { // 0x14021B930 void RobCloth::disp(const mat4& mat, render_context* rctx) { - obj* obj = objset_info_storage_get_obj(skin_disp->obj_info); + obj* obj = objset_info_storage_get_obj(skin_disp->obj_uid); if (!obj) return; - std::vector* textures = objset_info_storage_get_obj_set_gentex(skin_disp->obj_info.set_id); + std::vector* textures = objset_info_storage_get_obj_set_gentex(skin_disp->obj_uid.set_id); vec3 center = (vtxarg.data()[0].pos + vtxarg.data()[width * height - 1].pos) * 0.5f; @@ -1783,8 +1781,8 @@ void RobCloth::modify_obj() { calc_normal(); if (cloth_modify_flag & 0x02) { - obj_mesh* omote_mesh = objset_info_storage_get_obj_mesh(skin_disp->obj_info, data->omote_name); - obj_mesh* ura_mesh = objset_info_storage_get_obj_mesh(skin_disp->obj_info, data->ura_name); + obj_mesh* omote_mesh = objset_info_storage_get_obj_mesh(skin_disp->obj_uid, data->omote_name); + obj_mesh* ura_mesh = objset_info_storage_get_obj_mesh(skin_disp->obj_uid, data->ura_name); if (data->ura_name) { modify_cloth_object(omote_mesh, &vb[0], vtxarg.data(), 1.0f, data->num_omote_index, data->omote_index_array, false); @@ -1803,11 +1801,11 @@ void RobCloth::set_data(size_t w, size_t h, const obj_skin_ex_node_cloth_root * const rob_chara_item_equip_object* skin, const bone_database* bone_data) { skin_disp = skin; - obj* obj = objset_info_storage_get_obj(skin_disp->obj_info); + obj* obj = objset_info_storage_get_obj(skin_disp->obj_uid); if (!obj) return; - obj_mesh_index_buffer* ib = objset_info_storage_get_obj_mesh_index_buffer(skin_disp->obj_info); + obj_mesh_index_buffer* ib = objset_info_storage_get_obj_mesh_index_buffer(skin_disp->obj_uid); uint32_t omotea_mesh_index = obj->get_obj_mesh_index(data->omote_name); uint32_t ura_mesh_index = obj->get_obj_mesh_index(data->ura_name); @@ -1888,7 +1886,7 @@ void RobCloth::set_data(size_t w, size_t h, const obj_skin_ex_node_cloth_root * for (size_t i = 0; i < data->num_omote_index; i++) index_array.data()[omote_index_array[i]] = i; - obj_mesh* mesh = objset_info_storage_get_obj_mesh(skin_disp->obj_info, data->omote_name); + obj_mesh* mesh = objset_info_storage_get_obj_mesh(skin_disp->obj_uid, data->omote_name); obj_vertex_format vertex_format = (obj_vertex_format)0; obj_vertex_data* vertex_array = 0; if (mesh) { @@ -1945,7 +1943,7 @@ void RobCloth::set_data(const obj_skin_ex_node_cloth* cldata, set_data(cldata->width, cldata->height, cldata->fix_point, cldata->move_point, cldata->mat_array, cldata->ring_flag, skin, bone_data); - obj* obj = objset_info_storage_get_obj(skin->obj_info); + obj* obj = objset_info_storage_get_obj(skin->obj_uid); if (!obj) return; @@ -2778,7 +2776,7 @@ const float_t* RobOsage::LoadOpdData(size_t node_index, const float_t* opd_data, } void RobOsage::LoadSkinParam(void* kv, const char* name, - skin_param_osage_root& skp_root, object_info* obj_info, const bone_database* bone_data) { + skin_param_osage_root& skp_root, const object_info& obj_info, const bone_database* bone_data) { key_val* _kv = (key_val*)kv; skin_param_ptr = &skin_param; for (RobJointNode& i : joint_node_vec) @@ -2982,7 +2980,7 @@ RobJointNode* RobOsage::get_joint_node(size_t index) { // 0x14047F370 void RobOsage::init(const obj_skin_ex_node_osage* osg_data, const obj_skin_osage_joint* joint, - bone_node* ex_node, const obj_skin* skin) { + RobNode* ex_node, const obj_skin* skin) { dest(); transform.init(osg_data->transform.position, osg_data->transform.rotation); @@ -2992,13 +2990,13 @@ void RobOsage::init(const obj_skin_ex_node_osage* osg_data, const obj_skin_osage RobJointNode* node = joint_node_vec.data(); node->reset(); node->length_next = joint->length; - bone_node* root_node = &ex_node[osg_data->root_idx & 0x7FFF]; + RobNode* root_node = &ex_node[osg_data->root_idx & 0x7FFF]; node->dst_node = root_node; node->dst_node_mat = root_node->mat_ptr; *root_node->no_scale_mat = mat4_identity; node->distance = 0; - bone_node* parent_node_ptr = node->dst_node; + RobNode* parent_node_ptr = node->dst_node; for (uint32_t i = 0; i < osg_data->nb_joint; i++) { const obj_skin_osage_joint* osg_node = &joint[i]; RobJointNode* node = &joint_node_vec.data()[i + 1LL]; @@ -3006,7 +3004,7 @@ void RobOsage::init(const obj_skin_ex_node_osage* osg_data, const obj_skin_osage node->length_back = osg_node[0].length; if (i + 1 < osg_data->nb_joint) node->length_next = osg_node[1].length; - bone_node* node_ptr = &ex_node[osg_node->nid & 0x7FFF]; + RobNode* node_ptr = &ex_node[osg_node->nid & 0x7FFF]; node->dst_node = node_ptr; node->dst_node_mat = node_ptr->mat_ptr; node_ptr->parent = parent_node_ptr; @@ -3015,7 +3013,7 @@ void RobOsage::init(const obj_skin_ex_node_osage* osg_data, const obj_skin_osage effector.reset(); effector.length_back = joint[osg_data->nb_joint - 1].length; - bone_node* effector_node = &ex_node[osg_data->efc_idx & 0x7FFF]; + RobNode* effector_node = &ex_node[osg_data->efc_idx & 0x7FFF]; effector.dst_node = effector_node; effector.dst_node_mat = effector_node->mat_ptr; effector_node->parent = parent_node_ptr; @@ -3429,7 +3427,7 @@ void ExOsageBlock::reset_ex_force() { // 0x140 void ExOsageBlock::set_data(const rob_chara_item_equip_object* skp, const obj_skin_ex_node_osage* root, const char* name, const obj_skin_osage_joint* joint, - const bone_node* mot_node, bone_node* ex_node, const obj_skin* skin) { + const RobNode* mot_node, RobNode* ex_node, const obj_skin* skin) { ExNodeBlock::set_data(&ex_node[root->root_idx & 0x7FFF], EX_NODE_TYPE_OSAGE, name, skp); osage_work.init(root, joint, ex_node, skin); flag.pos_init = 0; @@ -3527,7 +3525,7 @@ void ExConstraintBlock::pos_init_cont() { } void ExConstraintBlock::Calc() { - bone_node* node = dst_node; + RobNode* node = dst_node; if (!node) return; @@ -3571,7 +3569,7 @@ inline void ExConstraintBlock::CalcConstraintDirection(mat4 mat) { return; mat4 rot_mat; - bone_data::orient_to_target(rot_mat, align_axis, v51); + RobBlock::orient_to_target(rot_mat, align_axis, v51); if (upvector_node) { vec3 affected_axis = direction->up_vector.affected_axis; @@ -3647,7 +3645,7 @@ void ExConstraintBlock::CalcConstraintPosition(mat4 mat) { mat4_inverse_transform_point(&mat, &up_vector_trans, &up_vector_trans); mat4 rot_mat; - bone_data::orient_to_target(rot_mat, position->up_vector.affected_axis, up_vector_trans); + RobBlock::orient_to_target(rot_mat, position->up_vector.affected_axis, up_vector_trans); mat4_mul(&rot_mat, &mat, &mat); } @@ -3685,7 +3683,7 @@ void ExConstraintBlock::CalcMatrixHS() { void ExConstraintBlock::set_data(const rob_chara_item_equip_object* skin_disp, const obj_skin_ex_node_constraint* data, const char* name, const bone_database* bone_data) { - bone_node* node = (bone_node*)skin_disp->get_node(name, bone_data); + RobNode* node = (RobNode*)skin_disp->get_node(name, bone_data); type = EX_NODE_TYPE_CONSTRAINT; dst_node = node; this->data = data; @@ -3867,12 +3865,12 @@ void ExExpressionBlock::CalcMatrixHS() { } void ExExpressionBlock::set_data(const rob_chara_item_equip_object* skin_disp, - const obj_skin_ex_node_expression* data, const char* node_name, object_info a4, + const obj_skin_ex_node_expression* data, const char* node_name, object_info objuid, size_t index, const bone_database* bone_data) { Expr_node* stack_buf[28]; Expr_node** stack_buf_val = stack_buf; - bone_node* node = (bone_node*)skin_disp->get_node(node_name, bone_data); + RobNode* node = (RobNode*)skin_disp->get_node(node_name, bone_data); type = EX_NODE_TYPE_EXPRESSION; dst_node = node; this->data = data; @@ -3925,7 +3923,7 @@ void ExExpressionBlock::set_data(const rob_chara_item_equip_object* skin_disp, expr->type = Expr_variable; int32_t index = func_str[0] - '0'; if (index >= 0 && index < 9) { - const bone_node* node = skin_disp->get_node(func_str.c_str() + 2, bone_data); + const RobNode* node = skin_disp->get_node(func_str.c_str() + 2, bone_data); if (node) expr->data.variable = node->get_transform_component(index, expr->type); else { @@ -3971,7 +3969,7 @@ void ExExpressionBlock::set_data(const rob_chara_item_equip_object* skin_disp, } } - step = !((ssize_t)index - ITEM_TE_R <= 1); + step = !(index == RPK_TE_R || index == RPK_TE_L); } static const ExpFuncUnaryTbl* ExpFuncUnaryTblFindFunc(std::string& name, const ExpFuncUnaryTbl* array) { diff --git a/src/CRE/rob/rob.cpp b/src/CRE/rob/rob.cpp index ceac3865..25175b16 100644 --- a/src/CRE/rob/rob.cpp +++ b/src/CRE/rob/rob.cpp @@ -113,8 +113,8 @@ struct OpdPlayGen { std::atomic_int32_t state; std::thread* thread; std::map>> gen_data; - std::vector set_motion[ROB_CHARA_COUNT]; - object_info obj_info[ROB_CHARA_COUNT][ITEM_OSAGE_COUNT]; + std::vector set_motion[ROB_ID_MAX]; + object_info obj_info[ROB_ID_MAX][RPK_ITEM_MAX]; OpdPlayGen(); ~OpdPlayGen(); @@ -201,9 +201,9 @@ struct opd_chara_data { uint32_t frame_count; uint32_t motion_id; uint64_t field_18; - std::vector> opd_data[ITEM_OSAGE_COUNT]; - p_farc_write opd[ITEM_OSAGE_COUNT]; - p_farc_write opdi[ITEM_OSAGE_COUNT]; + std::vector> opd_data[RPK_ITEM_MAX]; + p_farc_write opd[RPK_ITEM_MAX]; + p_farc_write opdi[RPK_ITEM_MAX]; opd_chara_data(); ~opd_chara_data(); @@ -319,22 +319,22 @@ struct OpdMakeManager : app::Task { struct CharaData { size_t left; size_t count; - CharaCostume chara_costumes[CHARA_MAX]; + CharaCostume chara_costumes[CN_MAX]; CharaData(); ~CharaData(); - void AddCostumes(const std::list>& costumes); + void AddCostumes(const std::list>& costumes); void AddObjects(const std::vector& customize_items); - bool CheckNoItems(chara_index chara_index); - void PopItems(chara_index chara_index, int32_t items[ITEM_SUB_MAX]); + bool CheckNoItems(CHARA_NUM chara_num); + void PopItems(CHARA_NUM chara_num, int32_t items[ITEM_SUB_MAX]); void Reset(); void SortUnique(); }; int32_t mode; CharaData chara_data; - chara_index chara; + CHARA_NUM chara; std::vector motion_ids; std::vector motion_set_ids; OpdMakeWorker* workers[OPD_MAKE_COUNT]; @@ -357,13 +357,13 @@ struct OpdMakeManager : app::Task { struct mothead_mot_func_data { rob_chara* rob_chara; - rob_chara_data* rob_chara_data; + rob_chara_data* rob_base; struc_223* field_10; }; struct mothead_func_data { rob_chara* rob_chr; - rob_chara_data* rob_chr_data; + rob_chara_data* rob_base; rob_chara_data* field_10; rob_chara* field_18; rob_chara_data* field_20; @@ -381,11 +381,11 @@ struct mothead_func_struct { class ReqData { public: - chara_index chara_index; + CHARA_NUM chara_num; int32_t count; ReqData(); - ReqData(::chara_index chara_index, int32_t count); + ReqData(CHARA_NUM chara_num, int32_t count); virtual ~ReqData(); virtual void Reset(); @@ -396,21 +396,21 @@ public: item_cos_data cos; ReqDataObj(); - ReqDataObj(::chara_index chara_index, int32_t count); + ReqDataObj(CHARA_NUM chara_num, int32_t count); virtual ~ReqDataObj() override; virtual void Reset() override; }; -struct rob_cmn_mottbl_sub_header { - int32_t data_offset; - int32_t field_4; +struct CmnMotTblBase { + int32_t tbl; + int32_t kamae_max; }; -struct rob_cmn_mottbl_header { - int32_t chara_count; - int32_t mottbl_indices_count; - int32_t subheaders_offset; +struct CmnMotTblHeader { + uint32_t cn_num; + uint32_t mtp_num; + uint32_t data_tbl; }; struct rob_chara_age_age_init_data { @@ -479,7 +479,7 @@ struct rob_chara_age_age_object { void calc_vertex(rob_chara_age_age_object_vertex*& vtx_data, obj_mesh* mesh, const mat4& mat, float_t alpha); - void disp(render_context* rctx, size_t chara_index, + void disp(render_context* rctx, size_t chara_num, bool npr, bool reflect, const vec3& a5, bool chara_color); bool get_objset_info_obj_index(object_info obj_info); ::obj* get_obj_set_obj(); @@ -539,13 +539,13 @@ struct rob_sleeve { struct rob_sleeve_handler { bool ready; std::list file_handlers; - std::map, rob_sleeve> sleeves; + std::map, rob_sleeve> sleeves; rob_sleeve_handler(); ~rob_sleeve_handler(); void clear(); - void get_sleeve_data(::chara_index chara_index, + void get_sleeve_data(CHARA_NUM chara_num, int32_t cos, rob_sleeve_data& l, rob_sleeve_data& r); bool load(); void parse(p_file_handler* pfhndl); @@ -653,7 +653,7 @@ struct RobThreadParent { }; struct RobThreadHandler { - RobThreadParent* arr[ROB_CHARA_COUNT]; + RobThreadParent* arr[ROB_ID_MAX]; RobThreadHandler(); ~RobThreadHandler(); @@ -683,10 +683,10 @@ public: virtual bool ctrl() override; virtual bool dest() override; - bool AppendFreeReqData(chara_index chara_index); - bool AppendFreeReqDataObj(chara_index chara_index, const item_cos_data* cos); - bool AppendLoadReqData(chara_index chara_index); - bool AppendLoadReqDataObj(chara_index chara_index, const item_cos_data* cos); + bool AppendFreeReqData(CHARA_NUM chara_num); + bool AppendFreeReqDataObj(CHARA_NUM chara_num, const item_cos_data* cos); + bool AppendLoadReqData(CHARA_NUM chara_num); + bool AppendLoadReqDataObj(CHARA_NUM chara_num, const item_cos_data* cos); void AppendLoadedReqData(ReqData* req_data); void AppendLoadedReqDataObj(ReqDataObj* req_data_obj); int32_t CtrlFunc1(); @@ -695,24 +695,24 @@ public: int32_t CtrlFunc4(); void FreeLoadedReqData(ReqData* req_data); void FreeLoadedReqDataObj(ReqDataObj* req_data_obj); - void LoadCharaItem(chara_index chara_index, + void LoadCharaItem(CHARA_NUM chara_num, int32_t item_no, void* data, const object_database* obj_db); - bool LoadCharaItemCheckNotRead(chara_index chara_index, int32_t item_no); - void LoadCharaItems(chara_index chara_index, + bool LoadCharaItemCheckNotRead(CHARA_NUM chara_num, int32_t item_no); + void LoadCharaItems(CHARA_NUM chara_num, item_cos_data* cos, void* data, const object_database* obj_db); - bool LoadCharaItemsCheckNotRead(chara_index chara_index, item_cos_data* cos); - bool LoadCharaItemsCheckNotReadParent(chara_index chara_index, item_cos_data* cos); - void LoadCharaItemsParent(chara_index chara_index, + bool LoadCharaItemsCheckNotRead(CHARA_NUM chara_num, item_cos_data* cos); + bool LoadCharaItemsCheckNotReadParent(CHARA_NUM chara_num, item_cos_data* cos); + void LoadCharaItemsParent(CHARA_NUM chara_num, item_cos_data* cos, void* data, const object_database* obj_db); - void LoadCharaObjSetMotionSet(chara_index chara_index, + void LoadCharaObjSetMotionSet(CHARA_NUM chara_num, void* data, const object_database* obj_db, const motion_database* mot_db); - bool LoadCharaObjSetMotionSetCheck(chara_index chara_index); + bool LoadCharaObjSetMotionSetCheck(CHARA_NUM chara_num); void ResetReqData(); void ResetReqDataObj(); - void UnloadCharaItem(chara_index chara_index, int32_t item_no); - void UnloadCharaItems(chara_index chara_index, item_cos_data* cos); - void UnloadCharaItemsParent(chara_index chara_index, item_cos_data* cos); - void UnloadCharaObjSetMotionSet(chara_index chara_index); + void UnloadCharaItem(CHARA_NUM chara_num, int32_t item_no); + void UnloadCharaItems(CHARA_NUM chara_num, item_cos_data* cos); + void UnloadCharaItemsParent(CHARA_NUM chara_num, item_cos_data* cos); + void UnloadCharaObjSetMotionSet(CHARA_NUM chara_num); void UnloadLoadedChara(); }; @@ -879,7 +879,8 @@ struct rob_manager_rob_impl { static void bone_data_parent_data_init(bone_data_parent* bone, rob_chara_bone_data* rob_bone_data, const bone_database* bone_data); static void bone_data_parent_load_bone_database(bone_data_parent* bone, - const std::vector* bones, const vec3* common_position, const vec3* position); + const std::vector* bones, + const CHAINPOSRADIUS* motion_chain_pos, const CHAINPOSRADIUS* disp_chain_pos); static void bone_data_parent_load_rob_chara(bone_data_parent* bone); static void mot_interpolate(const mot* a1, float_t frame, float_t* value, @@ -888,9 +889,9 @@ static uint32_t mot_load_last_key_calc(uint16_t keys_count); static bool mot_load_file(mot* a1, const mot_data* a2); static void mot_key_data_get_key_set_count_by_bone_database_bones(mot_key_data* a1, - const std::vector* a2); + const std::vector* a2); static void mot_key_data_get_key_set_count(mot_key_data* a1, size_t motion_bone_count, size_t leaf_pos); -static void mot_key_data_init_key_sets(mot_key_data* a1, bone_database_skeleton_type type, +static void mot_key_data_init_key_sets(mot_key_data* a1, BONE_KIND type, size_t motion_bone_count, size_t leaf_pos); static const mot_data* mot_key_data_load_file(mot_key_data* a1, uint32_t motion_id, const motion_database* mot_db); static void mot_key_data_reserve_key_sets(mot_key_data* a1); @@ -1239,21 +1240,18 @@ static void rob_chara_age_age_set_step_full(rob_chara_age_age* arr, int32_t chara_id, int32_t part_id); static void rob_chara_bone_data_calculate_bones(rob_chara_bone_data* rob_bone_data, - const std::vector* bones); + const std::vector* bones); static void rob_chara_bone_data_get_ik_scale( rob_chara_bone_data* rob_bone_data, const bone_database* bone_data); static mat4* rob_chara_bone_data_get_mat(rob_chara_bone_data* rob_bone_data, size_t index); -static bone_node* rob_chara_bone_data_get_node(rob_chara_bone_data* rob_bone_data, size_t index); +static RobNode* rob_chara_bone_data_get_node(rob_chara_bone_data* rob_bone_data, size_t index); static void rob_chara_bone_data_ik_scale_calculate( - rob_chara_bone_data_ik_scale* ik_scale, prj::sys_vector& bones, - bone_database_skeleton_type base_skeleton_type, - bone_database_skeleton_type skeleton_type, const bone_database* bone_data); + rob_chara_bone_data_ik_scale* ik_scale, prj::sys_vector& bones, + BONE_KIND base_skeleton_type, BONE_KIND skeleton_type, const bone_database* bone_data); static void rob_chara_bone_data_init_data(rob_chara_bone_data* rob_bone_data, - bone_database_skeleton_type base_skeleton_type, - bone_database_skeleton_type skeleton_type, const bone_database* bone_data); + BONE_KIND base_skeleton_type, BONE_KIND skeleton_type, const bone_database* bone_data); static void rob_chara_bone_data_init_skeleton(rob_chara_bone_data* rob_bone_data, - bone_database_skeleton_type base_skeleton_type, - bone_database_skeleton_type skeleton_type, const bone_database* bone_data); + BONE_KIND base_skeleton_type, BONE_KIND skeleton_type, const bone_database* bone_data); static void rob_chara_bone_data_motion_blend_mot_free(rob_chara_bone_data* rob_bone_data); static void rob_chara_bone_data_motion_blend_mot_init(rob_chara_bone_data* rob_bone_data); static void rob_chara_bone_data_motion_blend_mot_list_free(rob_chara_bone_data* rob_bone_data, @@ -1265,7 +1263,7 @@ static void rob_chara_bone_data_reserve(rob_chara_bone_data* rob_bone_data); static void rob_chara_bone_data_set_look_anim_param(rob_chara_bone_data* rob_bone_data, const rob_chara_look_anim_eye_param* params, const eyes_adjust* eyes_adjust); static void rob_chara_bone_data_set_mats(rob_chara_bone_data* rob_bone_data, - const std::vector* bones, const std::string* motion_bones); + const std::vector* bones, const std::string* motion_bones); static void rob_chara_bone_data_set_parent_mats(rob_chara_bone_data* rob_bone_data, const uint16_t* parent_indices); static void rob_chara_bone_data_set_rot_y(rob_chara_bone_data* rob_bone_data, float_t rot_y); @@ -1273,7 +1271,7 @@ static void rob_chara_bone_data_set_step(rob_chara_bone_data* rob_bone_data, flo static void rob_chara_age_age_ctrl(rob_chara* rob_chr, int32_t part_id, const char* name); static object_info rob_chara_get_head_object(rob_chara* rob_chr, int32_t head_object_id); -static object_info rob_chara_get_object_info(rob_chara* rob_chr, item_id id); +static object_info rob_chara_get_object_info(rob_chara* rob_chr, ROB_PARTS_KIND rpk); static void rob_chara_load_default_motion(rob_chara* rob_chr, const bone_database* bone_data, const motion_database* mot_db); static void rob_chara_load_default_motion_sub(rob_chara* rob_chr, int32_t skeleton_select, @@ -1282,7 +1280,7 @@ static void rob_chara_load_default_motion_sub(rob_chara* rob_chr, int32_t skelet static void rob_chara_set_adjust(rob_chara* rob_chr, rob_chara_data_adjust* adjust_new, rob_chara_data_adjust* adjust, rob_chara_data_adjust* adjust_prev); static void rob_chara_set_pv_data(rob_chara* rob_chr, int8_t chara_id, - chara_index chara_index, int32_t cos_id, const rob_chara_pv_data& pv_data); + CHARA_NUM chara_num, int32_t cos_id, const rob_chara_pv_data& pv_data); static void rob_cmn_mottbl_read(void* a1, const void* data, size_t size); @@ -1314,7 +1312,7 @@ OpdMaker* opd_maker_array; osage_play_data_database_struct* osage_play_data_database; OsagePlayDataManager* osage_play_data_manager; PvOsageManager* pv_osage_manager_array; -rob_cmn_mottbl_header* rob_cmn_mottbl_data; +CmnMotTblHeader* common_mot_tbl_header; rob_chara_age_age* rob_chara_age_age_array; rob_sleeve_handler* rob_sleeve_handler_data; RobThreadHandler* rob_thread_handler; @@ -1489,127 +1487,127 @@ static const mothead_mot_func mothead_mot_func_array[] = { mothead_mot_func_68, }; -static const struc_218 stru_140A24B50[] = { - { { 0.02f , -0.005f, 0.0f }, 0.09f , ROB_BONE_KL_KOSI_ETC_WJ, 0 }, - { { 0.17f , -0.02f , 0.03f }, 0.09f , ROB_BONE_CL_MUNE , 1 }, - { { 0.17f , -0.02f , -0.03f }, 0.09f , ROB_BONE_CL_MUNE , 1 }, - { { 0.0f , 0.02f , 0.0f }, 0.04f , ROB_BONE_KL_KUBI , 0 }, - { { 0.005f, 0.0f , 0.08f }, 0.12f , ROB_BONE_CL_KAO , 1 }, - { { 0.03f , 0.0f , 0.015f }, 0.055f, ROB_BONE_KATA_R_WJ_CU , 1 }, - { { 0.15f , 0.0f , 0.01f }, 0.05f , ROB_BONE_KATA_R_WJ_CU , 0 }, - { { 0.05f , 0.0f , 0.01f }, 0.05f , ROB_BONE_UDE_R_WJ , 0 }, - { { 0.17f , 0.0f , 0.015f }, 0.06f , ROB_BONE_UDE_R_WJ , 0 }, - { { 0.08f , 0.0f , 0.0f }, 0.07f , ROB_BONE_KL_TE_R_WJ , 1 }, - { { 0.03f , 0.0f , -0.015f }, 0.055f, ROB_BONE_KATA_L_WJ_CU , 1 }, - { { 0.15f , 0.0f , -0.01f }, 0.05f , ROB_BONE_KATA_L_WJ_CU , 0 }, - { { 0.05f , 0.0f , -0.01f }, 0.05f , ROB_BONE_UDE_L_WJ , 0 }, - { { 0.17f , 0.0f , -0.015f }, 0.06f , ROB_BONE_UDE_L_WJ , 0 }, - { { 0.08f , 0.0f , 0.0f }, 0.07f , ROB_BONE_KL_TE_L_WJ , 1 }, - { { 0.04f , -0.02f , -0.02f }, 0.13f , ROB_BONE_J_MOMO_R_WJ , 1 }, - { { 0.26f , -0.02f , -0.025f }, 0.09f , ROB_BONE_J_MOMO_R_WJ , 0 }, - { { 0.08f , 0.0f , -0.02f }, 0.09f , ROB_BONE_J_SUNE_R_WJ , 0 }, - { { 0.28f , 0.0f , -0.02f }, 0.09f , ROB_BONE_J_SUNE_R_WJ , 0 }, - { { 0.03f , -0.02f , -0.01f }, 0.07f , ROB_BONE_KL_ASI_R_WJ_CO, 0 }, - { { 0.02f , -0.02f , -0.02f }, 0.035f, ROB_BONE_KL_TOE_R_WJ , 0 }, - { { 0.04f , -0.02f , 0.02f }, 0.13f , ROB_BONE_J_MOMO_L_WJ , 1 }, - { { 0.26f , -0.02f , 0.025f }, 0.09f , ROB_BONE_J_MOMO_L_WJ , 0 }, - { { 0.09f , 0.0f , 0.02f }, 0.09f , ROB_BONE_J_SUNE_L_WJ , 0 }, - { { 0.28f , 0.0f , 0.02f }, 0.09f , ROB_BONE_J_SUNE_L_WJ , 0 }, - { { 0.03f , -0.02f , 0.01f }, 0.07f , ROB_BONE_KL_ASI_L_WJ_CO, 0 }, - { { 0.02f , -0.02f , 0.02f }, 0.035f, ROB_BONE_KL_TOE_L_WJ , 0 }, +static const RobCollisionData MIKU_cb_tbl[] = { + { { 0.02f , -0.005f, 0.0f }, 0.09f , BONE_ID_KL_KOSI_ETC_WJ, 0 }, + { { 0.17f , -0.02f , 0.03f }, 0.09f , BONE_ID_CL_MUNE , 1 }, + { { 0.17f , -0.02f , -0.03f }, 0.09f , BONE_ID_CL_MUNE , 1 }, + { { 0.0f , 0.02f , 0.0f }, 0.04f , BONE_ID_KL_KUBI , 0 }, + { { 0.005f, 0.0f , 0.08f }, 0.12f , BONE_ID_CL_KAO , 1 }, + { { 0.03f , 0.0f , 0.015f }, 0.055f, BONE_ID_KATA_R_WJ_CU , 1 }, + { { 0.15f , 0.0f , 0.01f }, 0.05f , BONE_ID_KATA_R_WJ_CU , 0 }, + { { 0.05f , 0.0f , 0.01f }, 0.05f , BONE_ID_UDE_R_WJ , 0 }, + { { 0.17f , 0.0f , 0.015f }, 0.06f , BONE_ID_UDE_R_WJ , 0 }, + { { 0.08f , 0.0f , 0.0f }, 0.07f , BONE_ID_KL_TE_R_WJ , 1 }, + { { 0.03f , 0.0f , -0.015f }, 0.055f, BONE_ID_KATA_L_WJ_CU , 1 }, + { { 0.15f , 0.0f , -0.01f }, 0.05f , BONE_ID_KATA_L_WJ_CU , 0 }, + { { 0.05f , 0.0f , -0.01f }, 0.05f , BONE_ID_UDE_L_WJ , 0 }, + { { 0.17f , 0.0f , -0.015f }, 0.06f , BONE_ID_UDE_L_WJ , 0 }, + { { 0.08f , 0.0f , 0.0f }, 0.07f , BONE_ID_KL_TE_L_WJ , 1 }, + { { 0.04f , -0.02f , -0.02f }, 0.13f , BONE_ID_J_MOMO_R_WJ , 1 }, + { { 0.26f , -0.02f , -0.025f }, 0.09f , BONE_ID_J_MOMO_R_WJ , 0 }, + { { 0.08f , 0.0f , -0.02f }, 0.09f , BONE_ID_J_SUNE_R_WJ , 0 }, + { { 0.28f , 0.0f , -0.02f }, 0.09f , BONE_ID_J_SUNE_R_WJ , 0 }, + { { 0.03f , -0.02f , -0.01f }, 0.07f , BONE_ID_KL_ASI_R_WJ_CO, 0 }, + { { 0.02f , -0.02f , -0.02f }, 0.035f, BONE_ID_KL_TOE_R_WJ , 0 }, + { { 0.04f , -0.02f , 0.02f }, 0.13f , BONE_ID_J_MOMO_L_WJ , 1 }, + { { 0.26f , -0.02f , 0.025f }, 0.09f , BONE_ID_J_MOMO_L_WJ , 0 }, + { { 0.09f , 0.0f , 0.02f }, 0.09f , BONE_ID_J_SUNE_L_WJ , 0 }, + { { 0.28f , 0.0f , 0.02f }, 0.09f , BONE_ID_J_SUNE_L_WJ , 0 }, + { { 0.03f , -0.02f , 0.01f }, 0.07f , BONE_ID_KL_ASI_L_WJ_CO, 0 }, + { { 0.02f , -0.02f , 0.02f }, 0.035f, BONE_ID_KL_TOE_L_WJ , 0 }, }; -static const struc_218 stru_140A25090[] = { - { { -0.00391f, -0.08831f, 0.0f }, 0.09f , ROB_BONE_KL_KOSI_ETC_WJ, 0 }, - { { 0.17f , -0.02f , 0.03f }, 0.09f , ROB_BONE_CL_MUNE , 1 }, - { { 0.17f , -0.02f , -0.03f }, 0.09f , ROB_BONE_CL_MUNE , 1 }, - { { 0.0f , 0.02f , 0.0f }, 0.04f , ROB_BONE_KL_KUBI , 0 }, - { { 0.05025f, 0.0f , -0.00181f }, 0.12f , ROB_BONE_CL_KAO , 1 }, - { { 0.03f , 0.0f , 0.015f }, 0.055f, ROB_BONE_KATA_R_WJ_CU , 1 }, - { { 0.15f , 0.0f , 0.01f }, 0.05f , ROB_BONE_KATA_R_WJ_CU , 0 }, - { { 0.05f , 0.0f , 0.01f }, 0.05f , ROB_BONE_UDE_R_WJ , 0 }, - { { 0.17f , 0.0f , 0.015f }, 0.06f , ROB_BONE_UDE_R_WJ , 0 }, - { { 0.08f , 0.0f , 0.0f }, 0.07f , ROB_BONE_KL_TE_R_WJ , 1 }, - { { 0.03f , 0.0f , -0.015f }, 0.055f, ROB_BONE_KATA_L_WJ_CU , 1 }, - { { 0.15f , 0.0f , -0.01f }, 0.05f , ROB_BONE_KATA_L_WJ_CU , 0 }, - { { 0.05f , 0.0f , -0.01f }, 0.05f , ROB_BONE_UDE_L_WJ , 0 }, - { { 0.17f , 0.0f , -0.015f }, 0.06f , ROB_BONE_UDE_L_WJ , 0 }, - { { 0.08f , 0.0f , 0.0f }, 0.07f , ROB_BONE_KL_TE_L_WJ , 1 }, - { { 0.04f , -0.02f , -0.02f }, 0.13f , ROB_BONE_J_MOMO_R_WJ , 1 }, - { { 0.26f , -0.02f , -0.025f }, 0.09f , ROB_BONE_J_MOMO_R_WJ , 0 }, - { { 0.08f , 0.0f , -0.02f }, 0.09f , ROB_BONE_J_SUNE_R_WJ , 0 }, - { { 0.28f , 0.0f , -0.02f }, 0.09f , ROB_BONE_J_SUNE_R_WJ , 0 }, - { { 0.03f , -0.02f , -0.01f }, 0.07f , ROB_BONE_KL_ASI_R_WJ_CO, 0 }, - { { 0.02f , -0.02f , -0.02f }, 0.035f, ROB_BONE_KL_TOE_R_WJ , 0 }, - { { 0.04f , -0.02f , 0.02f }, 0.13f , ROB_BONE_J_MOMO_L_WJ , 1 }, - { { 0.26f , -0.02f , 0.025f }, 0.09f , ROB_BONE_J_MOMO_L_WJ , 0 }, - { { 0.08f , 0.0f , 0.02f }, 0.09f , ROB_BONE_J_SUNE_L_WJ , 0 }, - { { 0.28f , 0.0f , 0.02f }, 0.09f , ROB_BONE_J_SUNE_L_WJ , 0 }, - { { 0.03f , -0.02f , 0.01f }, 0.07f , ROB_BONE_KL_ASI_L_WJ_CO, 0 }, - { { 0.02f , -0.02f , 0.02f }, 0.035f, ROB_BONE_KL_TOE_L_WJ , 0 }, +static const RobCollisionData MIKU_cb_push_tbl[] = { + { { -0.00391f, -0.08831f, 0.0f }, 0.09f , BONE_ID_KL_KOSI_ETC_WJ, 0 }, + { { 0.17f , -0.02f , 0.03f }, 0.09f , BONE_ID_CL_MUNE , 1 }, + { { 0.17f , -0.02f , -0.03f }, 0.09f , BONE_ID_CL_MUNE , 1 }, + { { 0.0f , 0.02f , 0.0f }, 0.04f , BONE_ID_KL_KUBI , 0 }, + { { 0.05025f, 0.0f , -0.00181f }, 0.12f , BONE_ID_CL_KAO , 1 }, + { { 0.03f , 0.0f , 0.015f }, 0.055f, BONE_ID_KATA_R_WJ_CU , 1 }, + { { 0.15f , 0.0f , 0.01f }, 0.05f , BONE_ID_KATA_R_WJ_CU , 0 }, + { { 0.05f , 0.0f , 0.01f }, 0.05f , BONE_ID_UDE_R_WJ , 0 }, + { { 0.17f , 0.0f , 0.015f }, 0.06f , BONE_ID_UDE_R_WJ , 0 }, + { { 0.08f , 0.0f , 0.0f }, 0.07f , BONE_ID_KL_TE_R_WJ , 1 }, + { { 0.03f , 0.0f , -0.015f }, 0.055f, BONE_ID_KATA_L_WJ_CU , 1 }, + { { 0.15f , 0.0f , -0.01f }, 0.05f , BONE_ID_KATA_L_WJ_CU , 0 }, + { { 0.05f , 0.0f , -0.01f }, 0.05f , BONE_ID_UDE_L_WJ , 0 }, + { { 0.17f , 0.0f , -0.015f }, 0.06f , BONE_ID_UDE_L_WJ , 0 }, + { { 0.08f , 0.0f , 0.0f }, 0.07f , BONE_ID_KL_TE_L_WJ , 1 }, + { { 0.04f , -0.02f , -0.02f }, 0.13f , BONE_ID_J_MOMO_R_WJ , 1 }, + { { 0.26f , -0.02f , -0.025f }, 0.09f , BONE_ID_J_MOMO_R_WJ , 0 }, + { { 0.08f , 0.0f , -0.02f }, 0.09f , BONE_ID_J_SUNE_R_WJ , 0 }, + { { 0.28f , 0.0f , -0.02f }, 0.09f , BONE_ID_J_SUNE_R_WJ , 0 }, + { { 0.03f , -0.02f , -0.01f }, 0.07f , BONE_ID_KL_ASI_R_WJ_CO, 0 }, + { { 0.02f , -0.02f , -0.02f }, 0.035f, BONE_ID_KL_TOE_R_WJ , 0 }, + { { 0.04f , -0.02f , 0.02f }, 0.13f , BONE_ID_J_MOMO_L_WJ , 1 }, + { { 0.26f , -0.02f , 0.025f }, 0.09f , BONE_ID_J_MOMO_L_WJ , 0 }, + { { 0.08f , 0.0f , 0.02f }, 0.09f , BONE_ID_J_SUNE_L_WJ , 0 }, + { { 0.28f , 0.0f , 0.02f }, 0.09f , BONE_ID_J_SUNE_L_WJ , 0 }, + { { 0.03f , -0.02f , 0.01f }, 0.07f , BONE_ID_KL_ASI_L_WJ_CO, 0 }, + { { 0.02f , -0.02f , 0.02f }, 0.035f, BONE_ID_KL_TOE_L_WJ , 0 }, }; -static const struc_218 stru_140A24E00[] = { - { { 0.02f , -0.005f, 0.0f }, 0.09f , ROB_BONE_KL_KOSI_ETC_WJ, 0 }, - { { 0.165f , -0.02f , 0.015f }, 0.105f, ROB_BONE_CL_MUNE , 1 }, - { { 0.165f , -0.02f , -0.015f }, 0.105f, ROB_BONE_CL_MUNE , 1 }, - { { 0.0f , 0.02f , 0.0f }, 0.04f , ROB_BONE_KL_KUBI , 0 }, - { { 0.005f , 0.0f , 0.08f }, 0.12f , ROB_BONE_CL_KAO , 1 }, - { { 0.03f , 0.0f , 0.015f }, 0.055f, ROB_BONE_KATA_R_WJ_CU , 1 }, - { { 0.15f , 0.0f , 0.01f }, 0.05f , ROB_BONE_KATA_R_WJ_CU , 0 }, - { { 0.05f , 0.0f , 0.01f }, 0.05f , ROB_BONE_UDE_R_WJ , 0 }, - { { 0.17f , 0.0f , 0.015f }, 0.06f , ROB_BONE_UDE_R_WJ , 0 }, - { { 0.08f , 0.0f , 0.0f }, 0.07f , ROB_BONE_KL_TE_R_WJ , 1 }, - { { 0.03f , 0.0f , -0.015f }, 0.055f, ROB_BONE_KATA_L_WJ_CU , 1 }, - { { 0.15f , 0.0f , -0.01f }, 0.05f , ROB_BONE_KATA_L_WJ_CU , 0 }, - { { 0.05f , 0.0f , -0.01f }, 0.05f , ROB_BONE_UDE_L_WJ , 0 }, - { { 0.17f , 0.0f , -0.015f }, 0.06f , ROB_BONE_UDE_L_WJ , 0 }, - { { 0.08f , 0.0f , 0.0f }, 0.07f , ROB_BONE_KL_TE_L_WJ , 1 }, - { { 0.04f , -0.02f , -0.02f }, 0.13f , ROB_BONE_J_MOMO_R_WJ , 1 }, - { { 0.26f , -0.02f , -0.025f }, 0.09f , ROB_BONE_J_MOMO_R_WJ , 0 }, - { { 0.08f , 0.0f , -0.02f }, 0.09f , ROB_BONE_J_SUNE_R_WJ , 0 }, - { { 0.28f , 0.0f , -0.02f }, 0.09f , ROB_BONE_J_SUNE_R_WJ , 0 }, - { { 0.03f , -0.02f , -0.01f }, 0.07f , ROB_BONE_KL_ASI_R_WJ_CO, 0 }, - { { 0.02f , -0.02f , -0.02f }, 0.035f, ROB_BONE_KL_TOE_R_WJ , 0 }, - { { 0.04f , -0.02f , 0.02f }, 0.13f , ROB_BONE_J_MOMO_L_WJ , 1 }, - { { 0.26f , -0.02f , 0.025f }, 0.09f , ROB_BONE_J_MOMO_L_WJ , 0 }, - { { 0.08f , 0.0f , 0.02f }, 0.09f , ROB_BONE_J_SUNE_L_WJ , 0 }, - { { 0.28f , 0.0f , 0.02f }, 0.09f , ROB_BONE_J_SUNE_L_WJ , 0 }, - { { 0.03f , -0.02f , 0.01f }, 0.07f , ROB_BONE_KL_ASI_L_WJ_CO, 0 }, - { { 0.02f , -0.02f , 0.02f }, 0.035f, ROB_BONE_KL_TOE_L_WJ , 0 }, +static const RobCollisionData LUK_cb_tbl[] = { + { { 0.02f , -0.005f, 0.0f }, 0.09f , BONE_ID_KL_KOSI_ETC_WJ, 0 }, + { { 0.165f , -0.02f , 0.015f }, 0.105f, BONE_ID_CL_MUNE , 1 }, + { { 0.165f , -0.02f , -0.015f }, 0.105f, BONE_ID_CL_MUNE , 1 }, + { { 0.0f , 0.02f , 0.0f }, 0.04f , BONE_ID_KL_KUBI , 0 }, + { { 0.005f , 0.0f , 0.08f }, 0.12f , BONE_ID_CL_KAO , 1 }, + { { 0.03f , 0.0f , 0.015f }, 0.055f, BONE_ID_KATA_R_WJ_CU , 1 }, + { { 0.15f , 0.0f , 0.01f }, 0.05f , BONE_ID_KATA_R_WJ_CU , 0 }, + { { 0.05f , 0.0f , 0.01f }, 0.05f , BONE_ID_UDE_R_WJ , 0 }, + { { 0.17f , 0.0f , 0.015f }, 0.06f , BONE_ID_UDE_R_WJ , 0 }, + { { 0.08f , 0.0f , 0.0f }, 0.07f , BONE_ID_KL_TE_R_WJ , 1 }, + { { 0.03f , 0.0f , -0.015f }, 0.055f, BONE_ID_KATA_L_WJ_CU , 1 }, + { { 0.15f , 0.0f , -0.01f }, 0.05f , BONE_ID_KATA_L_WJ_CU , 0 }, + { { 0.05f , 0.0f , -0.01f }, 0.05f , BONE_ID_UDE_L_WJ , 0 }, + { { 0.17f , 0.0f , -0.015f }, 0.06f , BONE_ID_UDE_L_WJ , 0 }, + { { 0.08f , 0.0f , 0.0f }, 0.07f , BONE_ID_KL_TE_L_WJ , 1 }, + { { 0.04f , -0.02f , -0.02f }, 0.13f , BONE_ID_J_MOMO_R_WJ , 1 }, + { { 0.26f , -0.02f , -0.025f }, 0.09f , BONE_ID_J_MOMO_R_WJ , 0 }, + { { 0.08f , 0.0f , -0.02f }, 0.09f , BONE_ID_J_SUNE_R_WJ , 0 }, + { { 0.28f , 0.0f , -0.02f }, 0.09f , BONE_ID_J_SUNE_R_WJ , 0 }, + { { 0.03f , -0.02f , -0.01f }, 0.07f , BONE_ID_KL_ASI_R_WJ_CO, 0 }, + { { 0.02f , -0.02f , -0.02f }, 0.035f, BONE_ID_KL_TOE_R_WJ , 0 }, + { { 0.04f , -0.02f , 0.02f }, 0.13f , BONE_ID_J_MOMO_L_WJ , 1 }, + { { 0.26f , -0.02f , 0.025f }, 0.09f , BONE_ID_J_MOMO_L_WJ , 0 }, + { { 0.08f , 0.0f , 0.02f }, 0.09f , BONE_ID_J_SUNE_L_WJ , 0 }, + { { 0.28f , 0.0f , 0.02f }, 0.09f , BONE_ID_J_SUNE_L_WJ , 0 }, + { { 0.03f , -0.02f , 0.01f }, 0.07f , BONE_ID_KL_ASI_L_WJ_CO, 0 }, + { { 0.02f , -0.02f , 0.02f }, 0.035f, BONE_ID_KL_TOE_L_WJ , 0 }, }; -static const struc_218 stru_140A25340[] = { - { { -0.00391f, -0.08831f, 0.0f }, 0.09f , ROB_BONE_KL_KOSI_ETC_WJ, 0 }, - { { 0.165f , -0.02f , 0.015f }, 0.105f, ROB_BONE_CL_MUNE , 1 }, - { { 0.165f , -0.02f , -0.015f }, 0.105f, ROB_BONE_CL_MUNE , 1 }, - { { 0.0f , 0.02f , 0.0f }, 0.04f , ROB_BONE_KL_KUBI , 0 }, - { { 0.05025f, 0.0f , -0.00181f }, 0.12f , ROB_BONE_CL_KAO , 1 }, - { { 0.03f , 0.0f , 0.015f }, 0.055f, ROB_BONE_KATA_R_WJ_CU , 1 }, - { { 0.15f , 0.0f , 0.01f }, 0.05f , ROB_BONE_KATA_R_WJ_CU , 0 }, - { { 0.05f , 0.0f , 0.01f }, 0.05f , ROB_BONE_UDE_R_WJ , 0 }, - { { 0.17f , 0.0f , 0.015f }, 0.06f , ROB_BONE_UDE_R_WJ , 0 }, - { { 0.08f , 0.0f , 0.0f }, 0.07f , ROB_BONE_KL_TE_R_WJ , 1 }, - { { 0.03f , 0.0f , -0.015f }, 0.055f, ROB_BONE_KATA_L_WJ_CU , 1 }, - { { 0.15f , 0.0f , -0.01f }, 0.05f , ROB_BONE_KATA_L_WJ_CU , 0 }, - { { 0.05f , 0.0f , -0.01f }, 0.05f , ROB_BONE_UDE_L_WJ , 0 }, - { { 0.17f , 0.0f , -0.015f }, 0.06f , ROB_BONE_UDE_L_WJ , 0 }, - { { 0.08f , 0.0f , 0.0f }, 0.07f , ROB_BONE_KL_TE_L_WJ , 1 }, - { { 0.04f , -0.02f , -0.02f }, 0.13f , ROB_BONE_J_MOMO_R_WJ , 1 }, - { { 0.26f , -0.02f , -0.025f }, 0.09f , ROB_BONE_J_MOMO_R_WJ , 0 }, - { { 0.08f , 0.0f , -0.02f }, 0.09f , ROB_BONE_J_SUNE_R_WJ , 0 }, - { { 0.28f , 0.0f , -0.02f }, 0.09f , ROB_BONE_J_SUNE_R_WJ , 0 }, - { { 0.03f , -0.02f , -0.01f }, 0.07f , ROB_BONE_KL_ASI_R_WJ_CO, 0 }, - { { 0.02f , -0.02f , -0.02f }, 0.035f, ROB_BONE_KL_TOE_R_WJ , 0 }, - { { 0.04f , -0.02f , 0.02f }, 0.13f , ROB_BONE_J_MOMO_L_WJ , 1 }, - { { 0.26f , -0.02f , 0.025f }, 0.09f , ROB_BONE_J_MOMO_L_WJ , 0 }, - { { 0.08f , 0.0f , 0.02f }, 0.09f , ROB_BONE_J_SUNE_L_WJ , 0 }, - { { 0.28f , 0.0f , 0.02f }, 0.09f , ROB_BONE_J_SUNE_L_WJ , 0 }, - { { 0.03f , -0.02f , 0.01f }, 0.07f , ROB_BONE_KL_ASI_L_WJ_CO, 0 }, - { { 0.02f , -0.02f , 0.02f }, 0.035f, ROB_BONE_KL_TOE_L_WJ , 0 }, +static const RobCollisionData LUK_cb_push_tbl[] = { + { { -0.00391f, -0.08831f, 0.0f }, 0.09f , BONE_ID_KL_KOSI_ETC_WJ, 0 }, + { { 0.165f , -0.02f , 0.015f }, 0.105f, BONE_ID_CL_MUNE , 1 }, + { { 0.165f , -0.02f , -0.015f }, 0.105f, BONE_ID_CL_MUNE , 1 }, + { { 0.0f , 0.02f , 0.0f }, 0.04f , BONE_ID_KL_KUBI , 0 }, + { { 0.05025f, 0.0f , -0.00181f }, 0.12f , BONE_ID_CL_KAO , 1 }, + { { 0.03f , 0.0f , 0.015f }, 0.055f, BONE_ID_KATA_R_WJ_CU , 1 }, + { { 0.15f , 0.0f , 0.01f }, 0.05f , BONE_ID_KATA_R_WJ_CU , 0 }, + { { 0.05f , 0.0f , 0.01f }, 0.05f , BONE_ID_UDE_R_WJ , 0 }, + { { 0.17f , 0.0f , 0.015f }, 0.06f , BONE_ID_UDE_R_WJ , 0 }, + { { 0.08f , 0.0f , 0.0f }, 0.07f , BONE_ID_KL_TE_R_WJ , 1 }, + { { 0.03f , 0.0f , -0.015f }, 0.055f, BONE_ID_KATA_L_WJ_CU , 1 }, + { { 0.15f , 0.0f , -0.01f }, 0.05f , BONE_ID_KATA_L_WJ_CU , 0 }, + { { 0.05f , 0.0f , -0.01f }, 0.05f , BONE_ID_UDE_L_WJ , 0 }, + { { 0.17f , 0.0f , -0.015f }, 0.06f , BONE_ID_UDE_L_WJ , 0 }, + { { 0.08f , 0.0f , 0.0f }, 0.07f , BONE_ID_KL_TE_L_WJ , 1 }, + { { 0.04f , -0.02f , -0.02f }, 0.13f , BONE_ID_J_MOMO_R_WJ , 1 }, + { { 0.26f , -0.02f , -0.025f }, 0.09f , BONE_ID_J_MOMO_R_WJ , 0 }, + { { 0.08f , 0.0f , -0.02f }, 0.09f , BONE_ID_J_SUNE_R_WJ , 0 }, + { { 0.28f , 0.0f , -0.02f }, 0.09f , BONE_ID_J_SUNE_R_WJ , 0 }, + { { 0.03f , -0.02f , -0.01f }, 0.07f , BONE_ID_KL_ASI_R_WJ_CO, 0 }, + { { 0.02f , -0.02f , -0.02f }, 0.035f, BONE_ID_KL_TOE_R_WJ , 0 }, + { { 0.04f , -0.02f , 0.02f }, 0.13f , BONE_ID_J_MOMO_L_WJ , 1 }, + { { 0.26f , -0.02f , 0.025f }, 0.09f , BONE_ID_J_MOMO_L_WJ , 0 }, + { { 0.08f , 0.0f , 0.02f }, 0.09f , BONE_ID_J_SUNE_L_WJ , 0 }, + { { 0.28f , 0.0f , 0.02f }, 0.09f , BONE_ID_J_SUNE_L_WJ , 0 }, + { { 0.03f , -0.02f , 0.01f }, 0.07f , BONE_ID_KL_ASI_L_WJ_CO, 0 }, + { { 0.02f , -0.02f , 0.02f }, 0.035f, BONE_ID_KL_TOE_L_WJ , 0 }, }; -static const struc_870 stru_140A255C8 = { +static const RobKamae kamae_data_tbl = { "COMMON_KAMAE", 1, 1, @@ -1618,14 +1616,15 @@ static const struc_870 stru_140A255C8 = { 0, }; -static const struc_870* off_140C9D068[] = { - &stru_140A255C8, +static const RobKamae* kamae_tbl_miku[] = { + &kamae_data_tbl, }; -static const chara_init_data chara_init_data_array[] = { +static const RobData rob_data[] = { { - 0x0000, BONE_DATABASE_SKELETON_MIKU, object_info(0x0000, 0x0000), + 0x0000, BONE_KIND_MIK, { + object_info(0x0000, 0x0000), object_info(0x00F7, 0x0000), object_info(), object_info(), @@ -1641,7 +1640,7 @@ static const chara_init_data chara_init_data_array[] = { object_info(), object_info(), }, - 1, 0, stru_140A24B50, stru_140A25090, off_140C9D068, + 1, 0, MIKU_cb_tbl, MIKU_cb_push_tbl, kamae_tbl_miku, 1, 0, { 0x01, 0x01, 0x1E, 0x1D }, { object_info(0x00F7, 0x0000), @@ -1673,8 +1672,9 @@ static const chara_init_data chara_init_data_array[] = { }, }, { - 0x0107, BONE_DATABASE_SKELETON_RIN, object_info(0x0000, 0x0000), + 0x0107, BONE_KIND_RIN, { + object_info(0x0000, 0x0000), object_info(0x004A, 0x0107), object_info(), object_info(), @@ -1690,7 +1690,7 @@ static const chara_init_data chara_init_data_array[] = { object_info(), object_info(), }, - 9, 0, stru_140A24B50, stru_140A25090, off_140C9D068, + 9, 0, MIKU_cb_tbl, MIKU_cb_push_tbl, kamae_tbl_miku, 1, 0, { 0x02, 0x02, 0x01, 0x01 }, { object_info(0x004A, 0x0107), @@ -1722,8 +1722,9 @@ static const chara_init_data chara_init_data_array[] = { }, }, { - 0x0105, BONE_DATABASE_SKELETON_LEN, object_info(0x0000, 0x0000), + 0x0105, BONE_KIND_LEN, { + object_info(0x0000, 0x0000), object_info(0x0040, 0x0105), object_info(), object_info(), @@ -1739,7 +1740,7 @@ static const chara_init_data chara_init_data_array[] = { object_info(), object_info(), }, - 5, 0, stru_140A24B50, stru_140A25090, off_140C9D068, + 5, 0, MIKU_cb_tbl, MIKU_cb_push_tbl, kamae_tbl_miku, 0, 0, { 0x02, 0x03, 0x01, 0x01 }, { object_info(0x0040, 0x0105), @@ -1771,8 +1772,9 @@ static const chara_init_data chara_init_data_array[] = { }, }, { - 0x0106, BONE_DATABASE_SKELETON_LUKA, object_info(0x0000, 0x0000), + 0x0106, BONE_KIND_LUK, { + object_info(0x0000, 0x0000), object_info(0x004C, 0x0106), object_info(), object_info(), @@ -1788,7 +1790,7 @@ static const chara_init_data chara_init_data_array[] = { object_info(), object_info(), }, - 6, 0, stru_140A24E00, stru_140A25340, off_140C9D068, + 6, 0, LUK_cb_tbl, LUK_cb_push_tbl, kamae_tbl_miku, 0, 0, { 0x01, 0x04, 0x01, 0x01 }, { object_info(0x004C, 0x0106), @@ -1820,8 +1822,9 @@ static const chara_init_data chara_init_data_array[] = { }, }, { - 0x0108, BONE_DATABASE_SKELETON_NERU, object_info(0x0000, 0x0000), + 0x0108, BONE_KIND_NER, { + object_info(0x0000, 0x0000), object_info(0x0019, 0x0108), object_info(), object_info(), @@ -1837,7 +1840,7 @@ static const chara_init_data chara_init_data_array[] = { object_info(), object_info(), }, - 8, 0, stru_140A24B50, stru_140A25090, off_140C9D068, + 8, 0, MIKU_cb_tbl, MIKU_cb_push_tbl, kamae_tbl_miku, 0, 0, { 0x02, 0x02, 0x02, 0x02 }, { object_info(0x0019, 0x0108), @@ -1869,8 +1872,9 @@ static const chara_init_data chara_init_data_array[] = { }, }, { - 0x0109, BONE_DATABASE_SKELETON_HAKU, object_info(0x0000, 0x0000), + 0x0109, BONE_KIND_HAK, { + object_info(0x0000, 0x0000), object_info(0x001F, 0x0109), object_info(), object_info(), @@ -1886,7 +1890,7 @@ static const chara_init_data chara_init_data_array[] = { object_info(), object_info(), }, - 3, 0, stru_140A24E00, stru_140A25340, off_140C9D068, + 3, 0, LUK_cb_tbl, LUK_cb_push_tbl, kamae_tbl_miku, 1, 0, { 0x01, 0x01, 0x02, 0x02 }, { object_info(0x001F, 0x0109), @@ -1918,8 +1922,9 @@ static const chara_init_data chara_init_data_array[] = { }, }, { - 0x010D, BONE_DATABASE_SKELETON_KAITO, object_info(0x0000, 0x0000), + 0x010D, BONE_KIND_KAI, { + object_info(0x0000, 0x0000), object_info(0x003C, 0x010D), object_info(), object_info(), @@ -1935,7 +1940,7 @@ static const chara_init_data chara_init_data_array[] = { object_info(), object_info(), }, - 4, 0, stru_140A24B50, stru_140A25090, off_140C9D068, + 4, 0, MIKU_cb_tbl, MIKU_cb_push_tbl, kamae_tbl_miku, 0, 0, { 0x00, 0x00, 0x01, 0x01 }, { object_info(0x003C, 0x010D), @@ -1967,8 +1972,9 @@ static const chara_init_data chara_init_data_array[] = { }, }, { - 0x010E, BONE_DATABASE_SKELETON_MEIKO, object_info(0x0000, 0x0000), + 0x010E, BONE_KIND_MEI, { + object_info(0x0000, 0x0000), object_info(0x0040, 0x010E), object_info(), object_info(), @@ -1984,7 +1990,7 @@ static const chara_init_data chara_init_data_array[] = { object_info(), object_info(), }, - 7, 0, stru_140A24E00, stru_140A25340, off_140C9D068, + 7, 0, LUK_cb_tbl, LUK_cb_push_tbl, kamae_tbl_miku, 1, 0, { 0x00, 0x00, 0x01, 0x01 }, { object_info(0x0040, 0x010E), @@ -2016,8 +2022,9 @@ static const chara_init_data chara_init_data_array[] = { }, }, { - 0x010F, BONE_DATABASE_SKELETON_SAKINE, object_info(0x0000, 0x0000), + 0x010F, BONE_KIND_SAK, { + object_info(0x0000, 0x0000), object_info(0x001A, 0x010F), object_info(), object_info(), @@ -2033,7 +2040,7 @@ static const chara_init_data chara_init_data_array[] = { object_info(), object_info(), }, - 10, 0, stru_140A24E00, stru_140A25340, off_140C9D068, + 10, 0, LUK_cb_tbl, LUK_cb_push_tbl, kamae_tbl_miku, 1, 0, { 0x01, 0x01, 0x02, 0x02 }, { object_info(0x001A, 0x010F), @@ -2065,8 +2072,9 @@ static const chara_init_data chara_init_data_array[] = { }, }, { - 0x063D, BONE_DATABASE_SKELETON_TETO, object_info(0x0000, 0x0000), + 0x063D, BONE_KIND_TET, { + object_info(0x0000, 0x0000), object_info(0x0000, 0x063D), object_info(), object_info(), @@ -2082,7 +2090,7 @@ static const chara_init_data chara_init_data_array[] = { object_info(), object_info(), }, - 467, 0, stru_140A24B50, stru_140A25090, off_140C9D068, + 467, 0, MIKU_cb_tbl, MIKU_cb_push_tbl, kamae_tbl_miku, 1, 0, { 0x01, 0x01, 0x02, 0x02 }, { object_info(0x0000, 0x063D), @@ -2115,77 +2123,77 @@ static const chara_init_data chara_init_data_array[] = { } }; -static const motion_bone_index rob_ik_hand_leg_bones[] = { - MOTION_BONE_C_KATA_R, MOTION_BONE_C_KATA_L, - MOTION_BONE_CL_MOMO_R, MOTION_BONE_CL_MOMO_L, +static const BONE_BLK rob_ik_hand_leg_bones[] = { + BLK_C_KATA_R, BLK_C_KATA_L, + BLK_CL_MOMO_R, BLK_CL_MOMO_L, }; -static const motion_bone_index dword_140A2DC90[] = { - MOTION_BONE_C_KATA_R, MOTION_BONE_KL_TE_R_WJ, MOTION_BONE_N_HITO_R_EX, - MOTION_BONE_NL_HITO_R_WJ, MOTION_BONE_NL_HITO_B_R_WJ, MOTION_BONE_NL_HITO_C_R_WJ, - MOTION_BONE_N_KO_R_EX, MOTION_BONE_NL_KO_R_WJ, MOTION_BONE_NL_KO_B_R_WJ, - MOTION_BONE_NL_KO_C_R_WJ, MOTION_BONE_N_KUSU_R_EX, MOTION_BONE_NL_KUSU_R_WJ, - MOTION_BONE_NL_KUSU_B_R_WJ, MOTION_BONE_NL_KUSU_C_R_WJ, MOTION_BONE_N_NAKA_R_EX, - MOTION_BONE_NL_NAKA_R_WJ, MOTION_BONE_NL_NAKA_B_R_WJ, MOTION_BONE_NL_NAKA_C_R_WJ, - MOTION_BONE_N_OYA_R_EX, MOTION_BONE_NL_OYA_R_WJ, MOTION_BONE_NL_OYA_B_R_WJ, - MOTION_BONE_NL_OYA_C_R_WJ, MOTION_BONE_N_STE_R_WJ_EX, MOTION_BONE_N_SUDE_R_WJ_EX, - MOTION_BONE_N_SUDE_B_R_WJ_EX, MOTION_BONE_N_HIJI_R_WJ_EX, MOTION_BONE_N_UP_KATA_R_EX, - MOTION_BONE_N_SKATA_R_WJ_CD_EX, MOTION_BONE_N_SKATA_B_R_WJ_CD_CU_EX, - MOTION_BONE_N_SKATA_C_R_WJ_CD_CU_EX, MOTION_BONE_NONE +static const BONE_BLK dword_140A2DC90[] = { + BLK_C_KATA_R, BLK_KL_TE_R_WJ, BLK_N_HITO_R_EX, + BLK_NL_HITO_R_WJ, BLK_NL_HITO_B_R_WJ, BLK_NL_HITO_C_R_WJ, + BLK_N_KO_R_EX, BLK_NL_KO_R_WJ, BLK_NL_KO_B_R_WJ, + BLK_NL_KO_C_R_WJ, BLK_N_KUSU_R_EX, BLK_NL_KUSU_R_WJ, + BLK_NL_KUSU_B_R_WJ, BLK_NL_KUSU_C_R_WJ, BLK_N_NAKA_R_EX, + BLK_NL_NAKA_R_WJ, BLK_NL_NAKA_B_R_WJ, BLK_NL_NAKA_C_R_WJ, + BLK_N_OYA_R_EX, BLK_NL_OYA_R_WJ, BLK_NL_OYA_B_R_WJ, + BLK_NL_OYA_C_R_WJ, BLK_N_STE_R_WJ_EX, BLK_N_SUDE_R_WJ_EX, + BLK_N_SUDE_B_R_WJ_EX, BLK_N_HIJI_R_WJ_EX, BLK_N_UP_KATA_R_EX, + BLK_N_SKATA_R_WJ_CD_EX, BLK_N_SKATA_B_R_WJ_CD_CU_EX, + BLK_N_SKATA_C_R_WJ_CD_CU_EX, BLK_DUMMY }; -static const motion_bone_index dword_140A2DD10[] = { - MOTION_BONE_C_KATA_L, MOTION_BONE_KL_TE_L_WJ, MOTION_BONE_N_HITO_L_EX, - MOTION_BONE_NL_HITO_L_WJ, MOTION_BONE_NL_HITO_B_L_WJ, MOTION_BONE_NL_HITO_C_L_WJ, - MOTION_BONE_N_KO_L_EX, MOTION_BONE_NL_KO_L_WJ, MOTION_BONE_NL_KO_B_L_WJ, - MOTION_BONE_NL_KO_C_L_WJ, MOTION_BONE_N_KUSU_L_EX, MOTION_BONE_NL_KUSU_L_WJ, - MOTION_BONE_NL_KUSU_B_L_WJ, MOTION_BONE_NL_KUSU_C_L_WJ, MOTION_BONE_N_NAKA_L_EX, - MOTION_BONE_NL_NAKA_L_WJ, MOTION_BONE_NL_NAKA_B_L_WJ, MOTION_BONE_NL_NAKA_C_L_WJ, - MOTION_BONE_N_OYA_L_EX, MOTION_BONE_NL_OYA_L_WJ, MOTION_BONE_NL_OYA_B_L_WJ, - MOTION_BONE_NL_OYA_C_L_WJ, MOTION_BONE_N_STE_L_WJ_EX, MOTION_BONE_N_SUDE_L_WJ_EX, - MOTION_BONE_N_SUDE_B_L_WJ_EX, MOTION_BONE_N_HIJI_L_WJ_EX, MOTION_BONE_N_UP_KATA_L_EX, - MOTION_BONE_N_SKATA_L_WJ_CD_EX, MOTION_BONE_N_SKATA_B_L_WJ_CD_CU_EX, - MOTION_BONE_N_SKATA_C_L_WJ_CD_CU_EX, MOTION_BONE_NONE +static const BONE_BLK dword_140A2DD10[] = { + BLK_C_KATA_L, BLK_KL_TE_L_WJ, BLK_N_HITO_L_EX, + BLK_NL_HITO_L_WJ, BLK_NL_HITO_B_L_WJ, BLK_NL_HITO_C_L_WJ, + BLK_N_KO_L_EX, BLK_NL_KO_L_WJ, BLK_NL_KO_B_L_WJ, + BLK_NL_KO_C_L_WJ, BLK_N_KUSU_L_EX, BLK_NL_KUSU_L_WJ, + BLK_NL_KUSU_B_L_WJ, BLK_NL_KUSU_C_L_WJ, BLK_N_NAKA_L_EX, + BLK_NL_NAKA_L_WJ, BLK_NL_NAKA_B_L_WJ, BLK_NL_NAKA_C_L_WJ, + BLK_N_OYA_L_EX, BLK_NL_OYA_L_WJ, BLK_NL_OYA_B_L_WJ, + BLK_NL_OYA_C_L_WJ, BLK_N_STE_L_WJ_EX, BLK_N_SUDE_L_WJ_EX, + BLK_N_SUDE_B_L_WJ_EX, BLK_N_HIJI_L_WJ_EX, BLK_N_UP_KATA_L_EX, + BLK_N_SKATA_L_WJ_CD_EX, BLK_N_SKATA_B_L_WJ_CD_CU_EX, + BLK_N_SKATA_C_L_WJ_CD_CU_EX, BLK_DUMMY }; -static const motion_bone_index dword_140A2DD90[] = { - MOTION_BONE_CL_MOMO_R, MOTION_BONE_KL_ASI_R_WJ_CO, MOTION_BONE_KL_TOE_R_WJ, - MOTION_BONE_N_HIZA_R_WJ_EX, MOTION_BONE_N_MOMO_A_R_WJ_CD_EX, - MOTION_BONE_N_MOMO_B_R_WJ_EX, MOTION_BONE_N_MOMO_C_R_WJ_EX, MOTION_BONE_NONE +static const BONE_BLK dword_140A2DD90[] = { + BLK_CL_MOMO_R, BLK_KL_ASI_R_WJ_CO, BLK_KL_TOE_R_WJ, + BLK_N_HIZA_R_WJ_EX, BLK_N_MOMO_A_R_WJ_CD_EX, + BLK_N_MOMO_B_R_WJ_EX, BLK_N_MOMO_C_R_WJ_EX, BLK_DUMMY }; -static const motion_bone_index dword_140A2DDB0[] = { - MOTION_BONE_CL_MOMO_L, MOTION_BONE_KL_ASI_L_WJ_CO, MOTION_BONE_KL_TOE_L_WJ, - MOTION_BONE_N_HIZA_L_WJ_EX, MOTION_BONE_N_MOMO_A_L_WJ_CD_EX, - MOTION_BONE_N_MOMO_B_L_WJ_EX, MOTION_BONE_N_MOMO_C_L_WJ_EX, MOTION_BONE_NONE +static const BONE_BLK dword_140A2DDB0[] = { + BLK_CL_MOMO_L, BLK_KL_ASI_L_WJ_CO, BLK_KL_TOE_L_WJ, + BLK_N_HIZA_L_WJ_EX, BLK_N_MOMO_A_L_WJ_CD_EX, + BLK_N_MOMO_B_L_WJ_EX, BLK_N_MOMO_C_L_WJ_EX, BLK_DUMMY }; -static const rob_bone_index dword_140A2DDD0[] = { - ROB_BONE_NONE, ROB_BONE_KL_TE_R_WJ, ROB_BONE_KL_TE_L_WJ, ROB_BONE_KL_ASI_R_WJ_CO, - ROB_BONE_KL_ASI_L_WJ_CO, ROB_BONE_J_SUNE_R_WJ, ROB_BONE_J_SUNE_L_WJ, - ROB_BONE_UDE_R_WJ, ROB_BONE_UDE_L_WJ, ROB_BONE_CL_KAO, ROB_BONE_NONE, - ROB_BONE_NONE, ROB_BONE_NONE, ROB_BONE_NONE, ROB_BONE_NONE, ROB_BONE_NONE, - ROB_BONE_NONE, ROB_BONE_KL_TE_R_WJ, ROB_BONE_KL_TE_L_WJ, ROB_BONE_KL_ASI_R_WJ_CO, - ROB_BONE_KL_ASI_L_WJ_CO, ROB_BONE_J_SUNE_R_WJ, ROB_BONE_J_SUNE_L_WJ, - ROB_BONE_UDE_R_WJ, ROB_BONE_UDE_L_WJ, ROB_BONE_CL_KAO, ROB_BONE_NONE, +static const BONE_ID dword_140A2DDD0[] = { + BONE_ID_DUMMY, BONE_ID_KL_TE_R_WJ, BONE_ID_KL_TE_L_WJ, BONE_ID_KL_ASI_R_WJ_CO, + BONE_ID_KL_ASI_L_WJ_CO, BONE_ID_J_SUNE_R_WJ, BONE_ID_J_SUNE_L_WJ, + BONE_ID_UDE_R_WJ, BONE_ID_UDE_L_WJ, BONE_ID_CL_KAO, BONE_ID_DUMMY, + BONE_ID_DUMMY, BONE_ID_DUMMY, BONE_ID_DUMMY, BONE_ID_DUMMY, BONE_ID_DUMMY, + BONE_ID_DUMMY, BONE_ID_KL_TE_R_WJ, BONE_ID_KL_TE_L_WJ, BONE_ID_KL_ASI_R_WJ_CO, + BONE_ID_KL_ASI_L_WJ_CO, BONE_ID_J_SUNE_R_WJ, BONE_ID_J_SUNE_L_WJ, + BONE_ID_UDE_R_WJ, BONE_ID_UDE_L_WJ, BONE_ID_CL_KAO, BONE_ID_DUMMY, }; -static const motion_bone_index rob_motion_c_kata_bones[] = { - MOTION_BONE_C_KATA_L, - MOTION_BONE_C_KATA_R, +static const BONE_BLK rob_motion_c_kata_bones[] = { + BLK_C_KATA_L, + BLK_C_KATA_R, }; -static const rob_bone_index rob_kl_te_bones[] = { - ROB_BONE_KL_TE_L_WJ, - ROB_BONE_KL_TE_R_WJ +static const BONE_ID rob_kl_te_bones[] = { + BONE_ID_KL_TE_L_WJ, + BONE_ID_KL_TE_R_WJ }; -static const motion_bone_index* off_140C9E000[] = { +static const BONE_BLK* off_140C9E000[] = { dword_140A2DC90, dword_140A2DD10, }; -static const motion_bone_index* off_140C9E020[] = { +static const BONE_BLK* off_140C9E020[] = { dword_140A2DD10, dword_140A2DC90, }; @@ -2408,30 +2416,30 @@ extern render_context* rctx_ptr; extern uint32_t cmn_set_id; -const chara_init_data* chara_init_data_get(chara_index chara_index) { - if (chara_index >= 0 && chara_index < CHARA_MAX) - return &chara_init_data_array[chara_index]; +const RobData* get_rob_data(CHARA_NUM cn) { + if (cn >= 0 && cn < CN_MAX) + return &rob_data[cn]; return 0; } -int32_t chara_init_data_get_chara_size_index(chara_index chara_index) { - const chara_init_data* chara_init_data = chara_init_data_get(chara_index); - if (chara_init_data) - return chara_init_data->field_848.chara_size_index; +int32_t rob_data_get_chara_size_index(CHARA_NUM cn) { + const RobData* rob_data = get_rob_data(cn); + if (rob_data) + return rob_data->field_848.chara_size_index; return 1; } -int32_t chara_init_data_get_swim_costume(chara_index chara_index) { - const chara_init_data* chara_init_data = chara_init_data_get(chara_index); - if (chara_init_data) - return chara_init_data->field_848.swim_costume; +int32_t rob_data_get_swim_costume(CHARA_NUM cn) { + const RobData* RobData = get_rob_data(cn); + if (rob_data) + return rob_data->field_848.swim_costume; return 0; } -int32_t chara_init_data_get_swim_s_costume(chara_index chara_index) { - const chara_init_data* chara_init_data = chara_init_data_get(chara_index); - if (chara_init_data) - return chara_init_data->field_848.swim_s_costume; +int32_t rob_data_get_swim_s_costume(CHARA_NUM cn) { + const RobData* RobData = get_rob_data(cn); + if (rob_data) + return rob_data->field_848.swim_s_costume; return 0; } @@ -2461,10 +2469,29 @@ bool check_cos_id_is_501(int32_t cos_id) { return cos_id == 501; } +// 0x1405376C0 +uint32_t get_common_rob_mot(CHARA_NUM cn, int32_t kamae_type, int32_t id) { + if (common_mot_tbl_header + && cn >= 0 && (uint32_t)cn < common_mot_tbl_header->cn_num + && id >= 0 && (uint32_t)id < common_mot_tbl_header->mtp_num) { + CmnMotTblBase* base = (CmnMotTblBase*)((uint8_t*)common_mot_tbl_header + + common_mot_tbl_header->data_tbl); + if (kamae_type >= 0 && kamae_type < base[cn].kamae_max) + return ((uint32_t*)((uint8_t*)common_mot_tbl_header + + *(uint32_t*)((uint8_t*)common_mot_tbl_header + + kamae_type * sizeof(uint32_t) + base[cn].tbl)))[id]; + } + return -1; +} + const char* get_dev_ram_opdi_dir() { return "dev_ram/opdi"; } +const float_t get_gravity() { + return 0.00299444468691945f; +} + const uint32_t* get_opd_motion_ids() { static const uint32_t opd_motion_ids[] = { 195, (uint32_t)-1, // CMN_MRA00_13_01 @@ -2481,10 +2508,6 @@ const uint32_t* get_opd_motion_set_ids() { return opd_motion_set_ids; } -const float_t get_gravity() { - return 0.00299444468691945f; -} - const char* get_ram_osage_play_data_dir() { return "ram/osage_play_data"; } @@ -2631,7 +2654,7 @@ void pv_osage_manager_array_reset(int32_t chara_id) { void rob_init() { if (!opd_chara_data_array) - opd_chara_data_array = new opd_chara_data[ROB_CHARA_COUNT]; + opd_chara_data_array = new opd_chara_data[ROB_ID_MAX]; if (!opd_checker) opd_checker = new OpdChecker; @@ -2649,16 +2672,16 @@ void rob_init() { osage_play_data_manager = new OsagePlayDataManager; if (!pv_osage_manager_array) - pv_osage_manager_array = new PvOsageManager[ROB_CHARA_COUNT]; + pv_osage_manager_array = new PvOsageManager[ROB_ID_MAX]; if (!rob_chara_age_age_array) - rob_chara_age_age_array = new rob_chara_age_age[ROB_CHARA_COUNT * 3]; + rob_chara_age_age_array = new rob_chara_age_age[ROB_ID_MAX * 3]; if (!rob_chara_array) - rob_chara_array = new rob_chara[ROB_CHARA_COUNT]; + rob_chara_array = new rob_chara[ROB_ID_MAX]; if (!rob_chara_pv_data_array) - rob_chara_pv_data_array = new rob_chara_pv_data[ROB_CHARA_COUNT]; + rob_chara_pv_data_array = new rob_chara_pv_data[ROB_ID_MAX]; { p_file_handler rob_mot_tbl_file_handler; @@ -2702,7 +2725,7 @@ void rob_free() { rob_sleeve_handler_data = 0; } - free_def(rob_cmn_mottbl_data); + free_def(common_mot_tbl_header); if (rob_chara_pv_data_array) { delete[] rob_chara_pv_data_array; @@ -2755,28 +2778,28 @@ void rob_free() { } } -static void rob_chara_item_equip_object_ctrl_step(rob_chara_item_equip_object* itm_eq_obj, bool disable_ex_force) { +static void rob_chara_item_equip_object_ctrl_step(rob_chara_item_equip_object* skin_disp, bool disable_ex_force) { for (int32_t i = 0; i < 6; i++) - for (ExNodeBlock*& j : itm_eq_obj->ex_node_block) + for (ExNodeBlock*& j : skin_disp->ex_node_block) j->CtrlStep(i, disable_ex_force); } -static void rob_chara_item_equip_object_load_opd_data(rob_chara_item_equip_object* itm_eq_obj) { - if (!itm_eq_obj->osage_blk.size() && !itm_eq_obj->cloth.size()) +static void rob_chara_item_equip_object_load_opd_data(rob_chara_item_equip_object* skin_disp) { + if (!skin_disp->osage_blk.size() && !skin_disp->cloth.size()) return; #if OPD_PLAY_GEN - rob_chara_item_equip* rob_disp = (rob_chara_item_equip*)itm_eq_obj->rob_disp; + rob_chara_item_equip* rob_disp = (rob_chara_item_equip*)skin_disp->rob_disp; size_t index = 0; for (opd_blend_data& i : rob_disp->opd_blend_data) { #else - const rob_chara_item_equip* rob_disp = itm_eq_obj->rob_disp; + const rob_chara_item_equip* rob_disp = skin_disp->rob_disp; size_t index = 0; for (const opd_blend_data& i : rob_disp->opd_blend_data) { #endif const float_t* opd_data = 0; uint32_t opd_count = 0; - osage_play_data_manager_get_opd_file_data(itm_eq_obj->obj_info, i.motion_id, opd_data, opd_count); + osage_play_data_manager_get_opd_file_data(skin_disp->obj_uid, i.motion_id, opd_data, opd_count); if (!opd_data) break; @@ -2787,60 +2810,60 @@ static void rob_chara_item_equip_object_load_opd_data(rob_chara_item_equip_objec i.no_loop = no_loop; #endif - for (ExOsageBlock*& j : itm_eq_obj->osage_blk) + for (ExOsageBlock*& j : skin_disp->osage_blk) opd_data = j->LoadOpdData(index, opd_data, opd_count); - for (ExClothBlock*& j : itm_eq_obj->cloth) + for (ExClothBlock*& j : skin_disp->cloth) opd_data = j->LoadOpdData(index, opd_data, opd_count); index++; } } -static void rob_chara_item_equip_object_ctrl(rob_chara_item_equip_object* itm_eq_obj) { +static void rob_chara_item_equip_object_ctrl(rob_chara_item_equip_object* skin_disp) { if (rob_chara_item_equip_object_disable_node_blocks) return; - if (itm_eq_obj->init_cnt > 0) { - itm_eq_obj->pos_reset(itm_eq_obj->init_cnt); - itm_eq_obj->init_cnt = 0; + if (skin_disp->init_cnt > 0) { + skin_disp->pos_reset(skin_disp->init_cnt); + skin_disp->init_cnt = 0; } - if (!itm_eq_obj->ex_node_block.size()) // Added + if (!skin_disp->ex_node_block.size()) // Added return; - for (ExNodeBlock*& i : itm_eq_obj->ex_node_block) + for (ExNodeBlock*& i : skin_disp->ex_node_block) i->CtrlBegin(); - if (itm_eq_obj->use_opd) { - itm_eq_obj->use_opd = false; - rob_chara_item_equip_object_load_opd_data(itm_eq_obj); - for (ExNodeBlock*& i : itm_eq_obj->ex_node_block) + if (skin_disp->use_opd) { + skin_disp->use_opd = false; + rob_chara_item_equip_object_load_opd_data(skin_disp); + for (ExNodeBlock*& i : skin_disp->ex_node_block) i->CtrlOsagePlayData(); } else { - if (itm_eq_obj->osage_depends_on_others) - rob_chara_item_equip_object_ctrl_step(itm_eq_obj, false); + if (skin_disp->osage_depends_on_others) + rob_chara_item_equip_object_ctrl_step(skin_disp, false); - for (ExNodeBlock*& i : itm_eq_obj->ex_node_block) + for (ExNodeBlock*& i : skin_disp->ex_node_block) i->ctrl(); } - for (ExNodeBlock*& i : itm_eq_obj->ex_node_block) + for (ExNodeBlock*& i : skin_disp->ex_node_block) i->CtrlEnd(); } -static void rob_chara_item_equip_ctrl(rob_chara_item_equip* rob_itm_equip) { - if (!osage_test_no_pause && !rob_itm_equip->disable_update) - for (int32_t i = rob_itm_equip->first_item_equip_object; i < rob_itm_equip->max_item_equip_object; i++) - rob_chara_item_equip_object_ctrl(&rob_itm_equip->item_equip_object[i]); +static void rob_chara_item_equip_ctrl(rob_chara_item_equip* rob_disp) { + if (!osage_test_no_pause && !rob_disp->disable_update) + for (int32_t i = rob_disp->disp_begin; i < rob_disp->disp_max; i++) + rob_chara_item_equip_object_ctrl(&rob_disp->skin_disp[i]); } static void rob_chara_data_adjust_ctrl(rob_chara* rob_chr, rob_chara_data_adjust* adjust, rob_chara_data_adjust* adjust_prev) { float_t cycle = adjust->cycle; adjust->frame += rob_chr->data.motion.step_data.frame; - if (rob_chr->data.field_1588.field_0.field_58 == 1) - cycle *= (60.0f / rob_chr->data.field_1588.field_0.frame); + if (rob_chr->data.motdata.field_0.field_58 == 1) + cycle *= (60.0f / rob_chr->data.motdata.field_0.frame); cycle *= adjust->frame * 2.0f * (float_t)M_PI * (float_t)(1.0 / 60.0f); float_t cycle_val = 0.0f; @@ -2859,27 +2882,26 @@ static void rob_chara_data_adjust_ctrl(rob_chara* rob_chr, switch (adjust->type) { case 1: { mat4 mat = mat4_identity; - mat4_mul_rotate_y(&mat, (float_t)((double_t)rob_chr->data.miku_rot.rot_y_int16 - * M_PI * (1.0 / 32768.0)), &mat); + mat4_mul_rotate_y(&mat, rob_chr->data.position.yang.get_rad(), &mat); mat4_transform_vector(&mat, &adjust->curr_ex_force, &adjust->curr_ex_force); } case 2: { - mat4* mat = rob_chara_bone_data_get_node(rob_chr->bone_data, MOT_BONE_KL_MUNE_B_WJ)->no_scale_mat; + mat4* mat = rob_chara_bone_data_get_node(rob_chr->bone_data, BONE_NODE_KL_MUNE_B_WJ)->no_scale_mat; if (mat) mat4_transform_vector(mat, &adjust->curr_ex_force, &adjust->curr_ex_force); } break; case 3: { - mat4* mat = rob_chara_bone_data_get_node(rob_chr->bone_data, MOT_BONE_KL_KUBI)->no_scale_mat; + mat4* mat = rob_chara_bone_data_get_node(rob_chr->bone_data, BONE_NODE_KL_KUBI)->no_scale_mat; if (mat) mat4_transform_vector(mat, &adjust->curr_ex_force, &adjust->curr_ex_force); } break; case 4: { - mat4* mat = rob_chara_bone_data_get_node(rob_chr->bone_data, MOT_BONE_FACE_ROOT)->no_scale_mat; + mat4* mat = rob_chara_bone_data_get_node(rob_chr->bone_data, BONE_NODE_FACE_ROOT)->no_scale_mat; if (mat) mat4_transform_vector(mat, &adjust->curr_ex_force, &adjust->curr_ex_force); } break; case 5: { - mat4* mat = rob_chara_bone_data_get_node(rob_chr->bone_data, MOT_BONE_KL_KOSI_ETC_WJ)->no_scale_mat; + mat4* mat = rob_chara_bone_data_get_node(rob_chr->bone_data, BONE_NODE_KL_KOSI_ETC_WJ)->no_scale_mat; if (mat) { adjust->curr_ex_force.z = -adjust->curr_ex_force.z; mat4_transform_vector(mat, &adjust->curr_ex_force, &adjust->curr_ex_force); @@ -2915,81 +2937,81 @@ static void rob_chara_data_adjust_ctrl(rob_chara* rob_chr, } static void rob_chara_item_equip_object_set_parts_ex_force( - rob_chara_item_equip_object* itm_eq_obj, const rob_osage_parts_bit& parts_bits, + rob_chara_item_equip_object* skin_disp, const rob_osage_parts_bit& parts_bits, const vec3* ex_force, const float_t& force, const float_t& gain) { - for (ExOsageBlock*& i : itm_eq_obj->osage_blk) + for (ExOsageBlock*& i : skin_disp->osage_blk) if (i->osage_work.CheckPartsBits(parts_bits)) { i->osage_work.SetNodesExternalForce(ex_force, gain); i->osage_work.SetNodesForce(force); } } -static void rob_chara_item_equip_set_parts_ex_force(rob_chara_item_equip* rob_itm_eq, +static void rob_chara_item_equip_set_parts_ex_force(rob_chara_item_equip* rob_disp, const rob_osage_parts& parts, const vec3* ex_force, const float_t& force, const float_t& strength) { - item_id id = (item_id)(parts == ROB_OSAGE_PARTS_MUFFLER ? ITEM_OUTER : ITEM_KAMI); - if (!osage_setting_data_obj_has_key(rob_itm_eq->item_equip_object[id].obj_info)) + ROB_PARTS_KIND rpk = (ROB_PARTS_KIND)(parts == ROB_OSAGE_PARTS_MUFFLER ? RPK_OUTER : RPK_KAMI); + if (!osage_setting_data_obj_has_key(rob_disp->skin_disp[rpk].obj_uid)) return; switch (parts) { case ROB_OSAGE_PARTS_SHORT_L: case ROB_OSAGE_PARTS_SHORT_R: - rob_itm_eq->parts_short = true; + rob_disp->parts_short = true; break; case ROB_OSAGE_PARTS_APPEND_L: case ROB_OSAGE_PARTS_APPEND_R: - rob_itm_eq->parts_append = true; + rob_disp->parts_append = true; break; case ROB_OSAGE_PARTS_WHITE_ONE_L: - rob_itm_eq->parts_white_one_l = true; + rob_disp->parts_white_one_l = true; break; } rob_osage_parts_bit parts_bits = (rob_osage_parts_bit)(1 << parts); - if (!rob_itm_eq->parts_short) { + if (!rob_disp->parts_short) { if (parts == ROB_OSAGE_PARTS_LEFT) enum_or(parts_bits, ROB_OSAGE_PARTS_SHORT_L_BIT); else if (parts == ROB_OSAGE_PARTS_RIGHT) enum_or(parts_bits, ROB_OSAGE_PARTS_SHORT_R_BIT); } - if (!rob_itm_eq->parts_append) { + if (!rob_disp->parts_append) { if (parts == ROB_OSAGE_PARTS_LEFT) enum_or(parts_bits, ROB_OSAGE_PARTS_APPEND_L_BIT); else if (parts == ROB_OSAGE_PARTS_RIGHT) enum_or(parts_bits, ROB_OSAGE_PARTS_APPEND_R_BIT); } - if (!rob_itm_eq->parts_white_one_l && parts == ROB_OSAGE_PARTS_LONG_C) + if (!rob_disp->parts_white_one_l && parts == ROB_OSAGE_PARTS_LONG_C) enum_or(parts_bits, ROB_OSAGE_PARTS_WHITE_ONE_L_BIT); rob_chara_item_equip_object_set_parts_ex_force( - &rob_itm_eq->item_equip_object[id], parts_bits, ex_force, force, strength); + &rob_disp->skin_disp[rpk], parts_bits, ex_force, force, strength); } static void rob_chara_item_equip_object_set_ex_force( - rob_chara_item_equip_object* itm_eq_obj, const vec3& f) { - for (ExOsageBlock*& i : itm_eq_obj->osage_blk) + rob_chara_item_equip_object* skin_disp, const vec3& f) { + for (ExOsageBlock*& i : skin_disp->osage_blk) i->set_ex_force(f); - for (ExClothBlock*& i : itm_eq_obj->cloth) + for (ExClothBlock*& i : skin_disp->cloth) i->set_ex_force(f); } static void rob_chara_item_equip_set_ex_force( - rob_chara_item_equip* rob_itm_eq, const vec3& f) { - 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_ex_force(&rob_itm_eq->item_equip_object[i], f); + rob_chara_item_equip* rob_disp, const vec3& f) { + for (int32_t i = rob_disp->disp_begin; i < rob_disp->disp_max; i++) + rob_chara_item_equip_object_set_ex_force(&rob_disp->skin_disp[i], f); } void rob_chara::adjust_ctrl() { - rob_chara_item_equip* rob_itm_equip = item_equip; + rob_chara_item_equip* rob_disp = this->rob_disp; for (int32_t i = 0; i < ROB_OSAGE_PARTS_MAX; i++) { rob_chara_data_adjust* parts_adjust = &data.motion.parts_adjust[i]; if (parts_adjust->enable) { rob_chara_data_adjust_ctrl(this, parts_adjust, &data.motion.parts_adjust_prev[i]); rob_osage_parts parts = (rob_osage_parts)i; - rob_chara_item_equip_set_parts_ex_force(rob_itm_equip, parts, + rob_chara_item_equip_set_parts_ex_force(rob_disp, parts, &parts_adjust->curr_ex_force, parts_adjust->curr_force, parts_adjust->curr_strength); } } @@ -2997,28 +3019,28 @@ void rob_chara::adjust_ctrl() { rob_chara_data_adjust* adjust_global = &data.motion.adjust_global; if (adjust_global->enable) { rob_chara_data_adjust_ctrl(this, adjust_global, &data.motion.adjust_global_prev); - rob_chara_item_equip_set_ex_force(rob_itm_equip, adjust_global->curr_ex_force); + rob_chara_item_equip_set_ex_force(rob_disp, adjust_global->curr_ex_force); } - rob_itm_equip->parts_short = false; - rob_itm_equip->parts_append = false; - rob_itm_equip->parts_white_one_l = false; + rob_disp->parts_short = false; + rob_disp->parts_append = false; + rob_disp->parts_white_one_l = false; } -static motion_bone_index rob_motion_c_kata_bone_get(int32_t index) { +static BONE_BLK rob_motion_c_kata_bone_get(int32_t index) { switch (index) { case 0: - return MOTION_BONE_C_KATA_L; + return BLK_C_KATA_L; case 1: - return MOTION_BONE_C_KATA_R; + return BLK_C_KATA_R; default: - return MOTION_BONE_NONE; + return BLK_DUMMY; } } static void rob_chara_bone_data_set_motion_arm_length(rob_chara_bone_data* rob_bone_data, - motion_bone_index motion_bone_index, float_t value) { - rob_bone_data->motion_loaded.front()->set_arm_length(motion_bone_index, value); + BONE_BLK block_id, float_t value) { + rob_bone_data->motion_loaded.front()->set_arm_length(block_id, value); } static void rob_chara_data_arm_adjust_ctrl(rob_chara* rob_chr, int32_t index, rob_chara_data_arm_adjust* arm_adjust) { @@ -3072,9 +3094,9 @@ mat4* rob_chara::get_bone_data_mat(size_t index) { return rob_chara_bone_data_get_mat(bone_data, index); } -object_info rob_chara::get_chara_init_data_face_object(int32_t index) { +object_info rob_chara::get_rob_data_face_object(int32_t index) { if (index >= 0 && index < 15) - return chara_init_data->face_objects[index]; + return rob_data->face_objects[index]; return {}; } @@ -3097,7 +3119,7 @@ uint32_t rob_chara::get_rob_cmn_mottbl_motion_id(int32_t id) { return data.motion.motion_id; else if (id >= 226 && id <= 235) return pv_data.motion_face_ids[id - 226]; - return rob_cmn_mottbl_get_motion_id(chara_index, data.field_8.field_1A4, id); + return get_common_rob_mot(chara_num, data.action.kamae_type, id); } float_t rob_chara::get_pos_scale(int32_t bone, vec3& pos) { @@ -3108,15 +3130,15 @@ float_t rob_chara::get_pos_scale(int32_t bone, vec3& pos) { } static int16_t sub_14054FE90(rob_chara* rob_chr, bool a3) { - int16_t v3 = rob_chr->data.miku_rot.rot_y_int16; - if (!a3 || !(rob_chr->data.field_0 & 0x10)) { - int16_t v4 = rob_chr->data.field_8.field_B8.field_8; + int16_t v3 = rob_chr->data.position.yang.value; + if (!a3 || !rob_chr->data.flag.bit.compel) { + int16_t v4 = rob_chr->data.action.field_B8.field_8; if (v4) return v3 + v4; } - if (rob_chr->data.field_1588.field_0.field_20.field_0 & 0x100) - return v3 + rob_chr->data.field_1588.field_0.field_274; + if (rob_chr->data.motdata.field_0.field_20.field_0 & 0x100) + return v3 + rob_chr->data.motdata.field_0.field_274; return v3; } @@ -3144,31 +3166,31 @@ static void sub_14041D720(rob_chara_bone_data* a1, bool a2) { } static float_t sub_14054FDE0(rob_chara* rob_chr) { - if (rob_chr->data.field_1588.field_0.field_2C0 >= 0.0f) - return rob_chr->data.field_1588.field_0.field_2C0; - else if (rob_chr->data.field_0 & 0x04) + if (rob_chr->data.motdata.field_0.field_2C0 >= 0.0f) + return rob_chr->data.motdata.field_0.field_2C0; + else if (rob_chr->data.flag.bit.ringout) return 10.0; - else if ((rob_chr->data.field_1588.field_0.field_10.field_0 & 0x4000) - || (rob_chr->data.field_1588.field_0.field_20.field_8 & 0x08)) + else if ((rob_chr->data.motdata.field_0.field_10.field_0 & 0x4000) + || (rob_chr->data.motdata.field_0.field_20.field_8 & 0x08)) return 5.0f; else if (rob_chr->data.motion.motion_id == rob_chr->data.motion.prev_motion_id) return 4.0f; - else if (rob_chr->data.field_1588.field_0.field_20.field_0 & 0x200) { - if (!(rob_chr->data.field_0 & 0x80) || rob_chr->data.field_0 & 0x40) + else if (rob_chr->data.motdata.field_0.field_20.field_0 & 0x200) { + if (rob_chr->data.flag.bit.old_fix_hara || rob_chr->data.flag.bit.land) return 1.0f; } else { - if (!(rob_chr->data.field_1588.field_0.field_20.field_0 & 0x8000) - || !(rob_chr->data.field_1588.field_0.field_20.field_0 & 0x01)) + if (!(rob_chr->data.motdata.field_0.field_20.field_0 & 0x8000) + || !(rob_chr->data.motdata.field_0.field_20.field_0 & 0x01)) return 7.0f; } return 3.0f; } static float_t sub_14054FEE0(rob_chara* a1) { - if (a1->data.field_1588.field_0.field_2C4 >= 0.0f) - return a1->data.field_1588.field_0.field_2C4; - else if (a1->data.field_1588.field_0.field_20.field_0 & 0x200) + if (a1->data.motdata.field_0.field_2C4 >= 0.0f) + return a1->data.motdata.field_0.field_2C4; + else if (a1->data.motdata.field_0.field_20.field_0 & 0x200) return 14.0f; else return 7.0f; @@ -3249,18 +3271,18 @@ static void sub_140555B00(rob_chara* rob_chr, bool a2) { else if (rob_chr->data.motion.prev_motion_id == -1) v3 = 0; else { - v3 = !(rob_chr->data.field_1588.field_0.field_20.field_0 & 0x400) - || !(rob_chr->data.field_1588.field_0.field_10.field_0 & 0x40) - || rob_chr->data.field_1588.field_0.field_20.field_0 & 0x100000; + v3 = !(rob_chr->data.motdata.field_0.field_20.field_0 & 0x400) + || !(rob_chr->data.motdata.field_0.field_10.field_0 & 0x40) + || rob_chr->data.motdata.field_0.field_20.field_0 & 0x100000; } bool v6; int32_t v7; - if (rob_chr->data.field_1588.field_0.field_52) { + if (rob_chr->data.motdata.field_0.field_52) { v6 = 0; v7 = 2; } - else if (rob_chr->data.field_1588.field_0.field_20.field_0 & 0x8000) { + else if (rob_chr->data.motdata.field_0.field_20.field_0 & 0x8000) { v6 = 0; v7 = 2; } @@ -3269,7 +3291,7 @@ static void sub_140555B00(rob_chara* rob_chr, bool a2) { v7 = 1; } - if (rob_chr->data.field_1588.field_0.field_52 != 3 && rob_chr->data.field_8.field_1A4) { + if (rob_chr->data.motdata.field_0.field_52 != 3 && rob_chr->data.action.kamae_type) { v6 = 0; v7 = 2; } @@ -3284,10 +3306,10 @@ static void sub_140555B00(rob_chara* rob_chr, bool a2) { if (v6) v9 = sub_14054FEE0(rob_chr); - float_t v12 = rob_chr->data.field_1588.field_0.frame; + float_t v12 = rob_chr->data.motdata.field_0.frame; float_t v13 = v12 - v9; if (v3 && v6 && (v13 < v11 || v13 <= v8)) { - float_t v14 = rob_chr->data.field_1588.field_0.frame; + float_t v14 = rob_chr->data.motdata.field_0.frame; float_t v16 = prj::floorf((v12 - v8) * 0.5f) + v8; if (v11 > v16) { float_t v17; @@ -3297,7 +3319,7 @@ static void sub_140555B00(rob_chara* rob_chr, bool a2) { v9 = v12 - v16; } else - v17 = rob_chr->data.field_1588.field_0.frame - v9; + v17 = rob_chr->data.motdata.field_0.frame - v9; v10 = v17 - v8; } else { @@ -3308,17 +3330,17 @@ static void sub_140555B00(rob_chara* rob_chr, bool a2) { rob_chr->bone_data->set_motion_blend_duration(v9, 1.0f, 1.0f); sub_14041D310(rob_chr->bone_data, v9, v13, v7); - sub_14041D340(rob_chr->bone_data, !!(rob_chr->data.field_1588.field_0.field_54 & 0x40)); - sub_14041D6C0(rob_chr->bone_data, (rob_chr->data.field_1588.field_0.field_40.field_0 & 0x10) - && (rob_chr->data.field_1588.field_0.field_20.field_0 & 0x08)); + sub_14041D340(rob_chr->bone_data, !!(rob_chr->data.motdata.field_0.field_54 & 0x40)); + sub_14041D6C0(rob_chr->bone_data, (rob_chr->data.motdata.field_0.field_40.field_0 & 0x10) + && (rob_chr->data.motdata.field_0.field_20.field_0 & 0x08)); sub_14041D6F0(rob_chr->bone_data, - !!(rob_chr->data.field_1588.field_0.field_10.field_8 & 0x18000000)); + !!(rob_chr->data.motdata.field_0.field_10.field_8 & 0x18000000)); sub_14041D720(rob_chr->bone_data, - !!(rob_chr->data.field_1588.field_0.field_30.field_8 & 0x18000000)); + !!(rob_chr->data.motdata.field_0.field_30.field_8 & 0x18000000)); sub_14041D2A0(rob_chr->bone_data, - (float_t)((double_t)rob_chr->data.field_1588.field_0.field_276 * M_PI * (1.0 / 32768.0))); + (float_t)((double_t)rob_chr->data.motdata.field_0.field_276 * M_PI * (1.0 / 32768.0))); sub_14041D270(rob_chr->bone_data, - (float_t)((double_t)rob_chr->data.field_1588.field_0.field_274 * M_PI * (1.0 / 32768.0))); + (float_t)((double_t)rob_chr->data.motdata.field_0.field_274 * M_PI * (1.0 / 32768.0))); } // 0x140536D30 @@ -3333,8 +3355,8 @@ static void mothead_apply_mot(struc_223* a1, rob_chara* rob_chr, const mothead_m mothead_mot_func_data func_data; func_data.rob_chara = rob_chr; - func_data.rob_chara_data = &rob_chr->data; - func_data.field_10 = &rob_chr->data.field_1588; + func_data.rob_base = &rob_chr->data; + func_data.field_10 = &rob_chr->data.motdata; while (mhd_mot_data->data && mhd_mot_data->type >= 0) { mothead_apply_mot_inner(&func_data, mhd_mot_data->type, mhd_mot_data); @@ -3418,21 +3440,21 @@ static void sub_14053A9C0(struc_223* a1, rob_chara* rob_chr, } } -void rob_chara::load_body_parts_object_info(item_id item_id, object_info obj_info, +void rob_chara::load_body_parts_object_info(ROB_PARTS_KIND rpk, object_info obj_info, const bone_database* bone_data, void* data, const object_database* obj_db) { - item_equip->load_body_parts_object_info(item_id, obj_info, bone_data, data, obj_db); + rob_disp->load_body_parts_object_info(rpk, obj_info, bone_data, data, obj_db); } void rob_chara::load_motion(uint32_t motion_id, bool a3, float_t frame, MotionBlendType blend_type, const bone_database* bone_data, const motion_database* mot_db) { - data.miku_rot.rot_y_int16 = sub_14054FE90(this, false); - if (!(data.field_1588.field_0.field_20.field_0 & 0x10)) { - data.miku_rot.position.x = data.miku_rot.n_hara_pos.x; - data.miku_rot.position.z = data.miku_rot.n_hara_pos.z; + data.position.yang = sub_14054FE90(this, false); + if (!(data.motdata.field_0.field_20.field_0 & 0x10)) { + data.position.pos.x = data.position.gpos.x; + data.position.pos.z = data.position.gpos.z; } - if (data.field_1588.field_0.field_20.field_8 & 0x8000000) - data.miku_rot.position.y = data.miku_rot.n_hara_pos.y; + if (data.motdata.field_0.field_20.field_8 & 0x8000000) + data.position.pos.y = data.position.gpos.y; if (a3) data.motion.field_28 ^= 0x04; @@ -3471,21 +3493,21 @@ void rob_chara::load_motion(uint32_t motion_id, bool a3, float_t frame, } this->bone_data->set_disable_eye_motion(false); - item_equip->set_osage_move_cancel(0, 0.0f); + rob_disp->set_osage_move_cancel(0, 0.0f); for (int32_t i = 0; i < ROB_OSAGE_PARTS_MAX; i++) - item_equip->set_disable_collision((rob_osage_parts)i, false); - data.field_1588.field_0.field_30 = data.field_1588.field_0.field_10; - data.field_1588.field_0.field_40 = data.field_1588.field_0.field_20; - data.field_1588.field_0.field_276 = data.field_1588.field_0.field_274; - data.field_1588.reset(); - sub_14053A9C0(&data.field_1588, this, motion_id, + rob_disp->set_disable_collision((rob_osage_parts)i, false); + data.motdata.field_0.field_30 = data.motdata.field_0.field_10; + data.motdata.field_0.field_40 = data.motdata.field_0.field_20; + data.motdata.field_0.field_276 = data.motdata.field_0.field_274; + data.motdata.reset(); + sub_14053A9C0(&data.motdata, this, motion_id, motion_storage_get_mot_data_frame_count(motion_id, mot_db), mot_db); - if (data.field_1588.field_0.field_40.field_C & 0x20) - data.field_1588.field_0.field_20.field_0 &= ~0x08; - if (data.field_1588.field_0.field_40.field_C & 0x40) - data.field_1588.field_0.field_20.field_8 |= 0x10000000; - if (!(data.field_1588.field_0.field_20.field_0 & 0x10) && frame > 0.0f) - data.field_1588.field_0.field_20.field_0 &= ~0x08; + if (data.motdata.field_0.field_40.field_C & 0x20) + data.motdata.field_0.field_20.field_0 &= ~0x08; + if (data.motdata.field_0.field_40.field_C & 0x40) + data.motdata.field_0.field_20.field_8 |= 0x10000000; + if (!(data.motdata.field_0.field_20.field_0 & 0x10) && frame > 0.0f) + data.motdata.field_0.field_20.field_0 &= ~0x08; data.motion.prev_motion_id = data.motion.motion_id; data.motion.frame_data.frame = frame; @@ -3499,42 +3521,42 @@ void rob_chara::load_motion(uint32_t motion_id, bool a3, float_t frame, float_t step = data.motion.step; if (step < 0.0f) step = data.motion.step_data.frame; - item_equip->set_osage_step(step); + rob_disp->set_osage_step(step); rob_chara_bone_data_motion_load(this->bone_data, motion_id, blend_type, bone_data, mot_db); this->bone_data->set_motion_frame(data.motion.step_data.frame, - data.motion.step_data.frame, data.field_1588.field_0.frame_count); + data.motion.step_data.frame, data.motdata.field_0.frame_count); this->bone_data->set_motion_playback_state(MOT_PLAY_FRAME_DATA_PLAYBACK_FORWARD); - if (data.field_1588.field_0.field_58 == 1) { + if (data.motdata.field_0.field_58 == 1) { this->bone_data->set_motion_loop_state(MOT_PLAY_FRAME_DATA_LOOP_CONTINUOUS); - this->bone_data->set_motion_loop(data.field_1588.field_0.loop_begin, - data.field_1588.field_0.loop_count, -1.0f); + this->bone_data->set_motion_loop(data.motdata.field_0.loop_begin, + data.motdata.field_0.loop_count, -1.0f); } rob_chara_bone_data_set_rot_y(this->bone_data, - (float_t)((double_t)data.field_1588.field_0.field_2B8 * M_PI * (1.0 / 32768.0))); - sub_14041BC40(this->bone_data, !!(data.field_1588.field_0.field_20.field_8 & 0x20000000)); + (float_t)((double_t)data.motdata.field_0.field_2B8 * M_PI * (1.0 / 32768.0))); + sub_14041BC40(this->bone_data, !!(data.motdata.field_0.field_20.field_8 & 0x20000000)); sub_14041B9D0(this->bone_data); if (type == ROB_CHARA_TYPE_2) { - sub_14041D340(this->bone_data, !!(data.field_1588.field_0.field_54 & 0x40)); - sub_14041D6C0(this->bone_data, (data.field_1588.field_0.field_40.field_0 & 0x10) - && (data.field_1588.field_0.field_20.field_0 & 0x08)); + sub_14041D340(this->bone_data, !!(data.motdata.field_0.field_54 & 0x40)); + sub_14041D6C0(this->bone_data, (data.motdata.field_0.field_40.field_0 & 0x10) + && (data.motdata.field_0.field_20.field_0 & 0x08)); sub_14041D6F0(this->bone_data, - !!(data.field_1588.field_0.field_10.field_8 & 0x18000000)); + !!(data.motdata.field_0.field_10.field_8 & 0x18000000)); sub_14041D720(this->bone_data, - !!(data.field_1588.field_0.field_30.field_8 & 0x18000000)); + !!(data.motdata.field_0.field_30.field_8 & 0x18000000)); sub_14041D2A0(this->bone_data, - (float_t)((double_t)data.field_1588.field_0.field_276 * M_PI * (1.0 / 32768.0))); + (float_t)((double_t)data.motdata.field_0.field_276 * M_PI * (1.0 / 32768.0))); sub_14041D270(this->bone_data, - (float_t)((double_t)data.field_1588.field_0.field_274 * M_PI * (1.0 / 32768.0))); + (float_t)((double_t)data.motdata.field_0.field_274 * M_PI * (1.0 / 32768.0))); } else sub_140555B00(this, blend_type >= MOTION_BLEND_FREEZE && blend_type <= MOTION_BLEND_CROSS); data.field_3DE0 = 0; } -void rob_chara::load_outfit_object_info(item_id id, object_info obj_info, +void rob_chara::load_outfit_object_info(ROB_PARTS_KIND rpk, object_info obj_info, bool osage_reset, const bone_database* bone_data, void* data, const object_database* obj_db) { - item_equip->load_outfit_object_info(id, obj_info, osage_reset, bone_data, data, obj_db); + rob_disp->load_outfit_object_info(rpk, obj_info, osage_reset, bone_data, data, obj_db); } static void rob_chara_head_adjust(rob_chara* rob_chr); @@ -3547,7 +3569,7 @@ static bool sub_14053B530(rob_chara* rob_chr) { } static void rob_chara_bone_data_set_left_hand_scale(rob_chara_bone_data* rob_bone_data, float_t scale) { - mat4* kl_te_wj_mat = rob_bone_data->get_mats_mat(ROB_BONE_KL_TE_L_WJ); + mat4* kl_te_wj_mat = rob_bone_data->get_mats_mat(BONE_ID_KL_TE_L_WJ); if (!kl_te_wj_mat) return; @@ -3559,21 +3581,21 @@ static void rob_chara_bone_data_set_left_hand_scale(rob_chara_bone_data* rob_bon mat4_scale(scale, scale, scale, &mat); mat4_set_translation(&mat, &pos); - for (int32_t i = ROB_BONE_KL_TE_L_WJ; i <= ROB_BONE_NL_OYA_C_L_WJ; i++) { + for (int32_t i = BONE_ID_KL_TE_L_WJ; i <= BONE_ID_NL_OYA_C_L_WJ; i++) { mat4* m = rob_bone_data->get_mats_mat(i); if (m) mat4_mul(m, &mat, m); } - for (int32_t i = MOT_BONE_KL_TE_L_WJ; i <= MOT_BONE_NL_OYA_C_L_WJ; i++) { - bone_node* node = rob_chara_bone_data_get_node(rob_bone_data, i); + for (int32_t i = BONE_NODE_KL_TE_L_WJ; i <= BONE_NODE_NL_OYA_C_L_WJ; i++) { + RobNode* node = rob_chara_bone_data_get_node(rob_bone_data, i); if (node) node->transform.scale = scale; } } static void rob_chara_bone_data_set_right_hand_scale(rob_chara_bone_data* rob_bone_data, float_t scale) { - mat4* kl_te_wj_mat = rob_bone_data->get_mats_mat(ROB_BONE_KL_TE_R_WJ); + mat4* kl_te_wj_mat = rob_bone_data->get_mats_mat(BONE_ID_KL_TE_R_WJ); if (!kl_te_wj_mat) return; @@ -3585,14 +3607,14 @@ static void rob_chara_bone_data_set_right_hand_scale(rob_chara_bone_data* rob_bo mat4_scale(scale, scale, scale, &mat); mat4_set_translation(&mat, &pos); - for (int32_t i = ROB_BONE_KL_TE_R_WJ; i <= ROB_BONE_NL_OYA_C_R_WJ; i++) { + for (int32_t i = BONE_ID_KL_TE_R_WJ; i <= BONE_ID_NL_OYA_C_R_WJ; i++) { mat4* m = rob_bone_data->get_mats_mat(i); if (m) mat4_mul(m, &mat, m); } - for (int32_t i = MOT_BONE_KL_TE_R_WJ; i <= MOT_BONE_NL_OYA_C_R_WJ; i++) { - bone_node* node = rob_chara_bone_data_get_node(rob_bone_data, i); + for (int32_t i = BONE_NODE_KL_TE_R_WJ; i <= BONE_NODE_NL_OYA_C_R_WJ; i++) { + RobNode* node = rob_chara_bone_data_get_node(rob_bone_data, i); if (node) node->transform.scale = scale; } @@ -3600,13 +3622,13 @@ static void rob_chara_bone_data_set_right_hand_scale(rob_chara_bone_data* rob_bo // 0x140550400 void rob_chara::pos_reset() { - item_equip->pos_reset(0); + rob_disp->pos_reset(0); } void rob_chara::rob_info_ctrl() { data.field_3DA0 = data.field_3D9C; if (data.field_1E68.field_64 > 0.01f) - data.field_2 |= 0x40; + data.flag.bit.wall_moved_mot = 1; //sub_140517CC0(this); //sub_140517B80(this); @@ -3648,7 +3670,7 @@ void rob_chara::rob_motion_modifier_ctrl() { rob_chara_bone_data_set_right_hand_scale(bone_data, right_hand_scale); } -static const struc_243& sub_140510550(chara_index chara_index) { +static const struc_243& sub_140510550(CHARA_NUM chara_num) { static const struc_243 stru_1411AD680[] = { { (float_t)(-60.0 * DEG_TO_RAD), (float_t)(35.0 * DEG_TO_RAD), @@ -3701,14 +3723,14 @@ static const struc_243& sub_140510550(chara_index chara_index) { (float_t)(35.0 * DEG_TO_RAD), (float_t)(25.0 * DEG_TO_RAD), 0.3f, 0.95f, }, }; - return stru_1411AD680[chara_index]; + return stru_1411AD680[chara_num]; } static void sub_14041C5C0(rob_chara_bone_data* rob_bone_data, const struc_243& a2) { rob_bone_data->look_anim.field_15C = a2; } -static const rob_chara_look_anim_eye_param* rob_chara_look_anim_eye_param_array_get(chara_index chara_index) { +static const rob_chara_look_anim_eye_param* rob_chara_look_anim_eye_param_array_get(CHARA_NUM chara_num) { static const rob_chara_look_anim_eye_param rob_chara_look_anim_eye_param_array[] = { { { -0.061086524f, 0.104719758f, -0.080285146f, 0.113446399f, }, @@ -3762,73 +3784,72 @@ static const rob_chara_look_anim_eye_param* rob_chara_look_anim_eye_param_array_ }, }; - return &rob_chara_look_anim_eye_param_array[chara_index]; + return &rob_chara_look_anim_eye_param_array[chara_num]; } -static void sub_140514130(rob_chara_item_equip* rob_itm_equip, item_id id, bool a3) { +static void sub_140514130(rob_chara_item_equip* rob_disp, ROB_PARTS_KIND rpk, bool a3) { if (a3) - rob_itm_equip->field_18[id] &= ~0x01; + rob_disp->parts_attr[rpk] &= ~0x01; else - rob_itm_equip->field_18[id] |= 0x01; + rob_disp->parts_attr[rpk] |= 0x01; } -static void sub_140514110(rob_chara_item_equip* rob_itm_equip, item_id id, bool a3) { +static void sub_140514110(rob_chara_item_equip* rob_disp, ROB_PARTS_KIND rpk, bool a3) { if (a3) - rob_itm_equip->field_18[id] &= ~0x02; + rob_disp->parts_attr[rpk] &= ~0x02; else - rob_itm_equip->field_18[id] |= 0x02; + rob_disp->parts_attr[rpk] |= 0x02; } -static void sub_140513C60(rob_chara_item_equip* rob_itm_equip, item_id id, bool a3) { +static void sub_140513C60(rob_chara_item_equip* rob_disp, ROB_PARTS_KIND rpk, bool a3) { if (a3) - rob_itm_equip->field_18[id] &= ~0x04; + rob_disp->parts_attr[rpk] &= ~0x04; else - rob_itm_equip->field_18[id] |= 0x04; + rob_disp->parts_attr[rpk] |= 0x04; } void rob_chara::reset_data(const rob_chara_pv_data* pv_data, const bone_database* bone_data, const motion_database* mot_db) { this->bone_data->reset(); rob_chara_bone_data_init_data(this->bone_data, - BONE_DATABASE_SKELETON_COMMON, chara_init_data->skeleton_type, bone_data); + BONE_KIND_CMN, rob_data->skeleton_type, bone_data); data.reset(); data_prev.reset(); - item_equip->get_parent_bone_nodes(rob_chara_bone_data_get_node( - this->bone_data, MOT_BONE_N_HARA_CP), bone_data); + rob_disp->set_motion_node(rob_chara_bone_data_get_node( + this->bone_data, BONE_NODE_N_HARA_CP), bone_data); type = pv_data->type; - rob_chara_data* rob_chr_data = &data; - rob_chr_data->miku_rot.rot_y_int16 = pv_data->rot_y_int16; - rob_chr_data->miku_rot.field_6 = pv_data->rot_y_int16; + rob_chara_data* base = &data; + base->position.yang = pv_data->yang; + base->position.hara_yang = pv_data->yang; float_t scale = chara_size_table_get_value(this->pv_data.chara_size_index); - rob_chr_data->adjust_data.scale = scale; - rob_chr_data->adjust_data.item_scale = scale; // X - rob_chr_data->adjust_data.height_adjust = this->pv_data.height_adjust; - rob_chr_data->adjust_data.pos_adjust_y = chara_pos_adjust_y_table_get_value(this->pv_data.chara_size_index); - rob_chr_data->field_8.field_1A8 = chara_init_data->field_838[rob_chr_data->field_8.field_1A4]; - sub_14041C5C0(this->bone_data, sub_140510550(chara_index)); + base->adjust_data.scale = scale; + base->adjust_data.item_scale = scale; // X + base->adjust_data.height_adjust = this->pv_data.height_adjust; + base->adjust_data.pos_adjust_y = chara_pos_adjust_y_table_get_value(this->pv_data.chara_size_index); + base->action.kamae_data = rob_data->kamae_tbl[base->action.kamae_type]; + sub_14041C5C0(this->bone_data, sub_140510550(chara_num)); rob_chara_bone_data_set_look_anim_param(this->bone_data, - rob_chara_look_anim_eye_param_array_get(chara_index), &pv_data->eyes_adjust); + rob_chara_look_anim_eye_param_array_get(chara_num), &pv_data->eyes_adjust); this->bone_data->sleeve_adjust.sleeve_l = pv_data->sleeve_l; this->bone_data->sleeve_adjust.sleeve_r = pv_data->sleeve_r; this->bone_data->sleeve_adjust.enable1 = true; this->bone_data->sleeve_adjust.enable2 = false; rob_chara_bone_data_get_ik_scale(this->bone_data, bone_data); rob_chara_load_default_motion(this, bone_data, mot_db); - rob_chr_data->field_8.field_4.field_0 = 1; - rob_chr_data->field_8.field_4.motion_id = get_rob_cmn_mottbl_motion_id(0); - rob_chr_data->field_8.field_0 = 0; - rob_chr_data->field_8.field_4.field_10 = pv_data->field_5; - load_motion(rob_chr_data->field_8.field_4.motion_id, - pv_data->field_5, 0.0f, MOTION_BLEND, bone_data, mot_db); + base->action.field_4.field_0 = 1; + base->action.field_4.motion_id = get_rob_cmn_mottbl_motion_id(0); + base->action.field_0 = 0; + base->action.field_4.field_10 = pv_data->field_5; + load_motion(base->action.field_4.motion_id, pv_data->field_5, 0.0f, MOTION_BLEND, bone_data, mot_db); field_C = true; - item_equip->field_DC = 0; - sub_140513C60(item_equip, ITEM_ATAMA, false); - sub_140513C60(item_equip, ITEM_TE_R, false); - sub_140513C60(item_equip, ITEM_TE_L, false); + rob_disp->field_DC = 0; + sub_140513C60(rob_disp, RPK_ATAMA, false); + sub_140513C60(rob_disp, RPK_TE_R, false); + sub_140513C60(rob_disp, RPK_TE_L, false); object_info head_obj = rob_chara_get_head_object(this, 0); - rob_chr_data->motion.field_150.head_object = head_obj; - rob_chr_data->motion.field_3B0.head_object = head_obj; - set_parts_disp(ITEM_MAX, true); + base->motion.field_150.head_object = head_obj; + base->motion.field_3B0.head_object = head_obj; + set_parts_disp(RPK_MAX, true); } void rob_chara::reset_osage() { @@ -3839,15 +3860,15 @@ void rob_chara::reset_osage() { i.reset(); for (int32_t i = 0; i < ROB_OSAGE_PARTS_MAX; i++) - item_equip->reset_nodes_ex_force((rob_osage_parts)i); + rob_disp->reset_nodes_ex_force((rob_osage_parts)i); data.motion.adjust_global.reset(); data.motion.adjust_global_prev.reset(); - item_equip->reset_ex_force(); - item_equip->parts_short = false; - item_equip->parts_append = false; - item_equip->parts_white_one_l = false; + rob_disp->reset_ex_force(); + rob_disp->parts_short = false; + rob_disp->parts_append = false; + rob_disp->parts_white_one_l = false; set_osage_step(-1.0f); } @@ -3859,7 +3880,7 @@ void rob_chara::set_bone_data_frame(float_t frame) { } void rob_chara::set_chara_color(bool value) { - item_equip->chara_color = value; + rob_disp->chara_color = value; } void rob_chara::set_chara_height_adjust(bool value) { @@ -4071,17 +4092,17 @@ static void sub_1405500F0(rob_chara* rob_chr) { } } -static vec3* rob_chara_bone_data_get_global_position(rob_chara_bone_data* rob_bone_data) { - return &rob_bone_data->motion_loaded.front()->bone_data.global_position; +static vec3* rob_chara_bone_data_get_gblctr_pos(rob_chara_bone_data* rob_bone_data) { + return &rob_bone_data->motion_loaded.front()->bone_data.gblctr_pos; } static void rob_chara_data_adjuct_set_pos(rob_chara_adjust_data* rob_chr_adj, - const vec3& pos, bool pos_adjust, const vec3* global_position) { + const vec3& pos, bool pos_adjust, const vec3* gblctr_pos) { float_t scale = rob_chr_adj->scale; float_t item_scale = rob_chr_adj->item_scale; // X vec3 _offset = rob_chr_adj->offset; - if (global_position) - _offset.y += global_position->y; + if (gblctr_pos) + _offset.y += gblctr_pos->y; vec3 _pos = pos; vec3 _item_pos = pos; @@ -4119,15 +4140,15 @@ static void rob_chara_data_adjuct_set_pos(rob_chara_adjust_data* rob_chr_adj, } void rob_chara::set_data_adjust_mat(rob_chara_adjust_data* rob_chr_adj, bool pos_adjust) { - mat4* mat = bone_data->get_mats_mat(ROB_BONE_N_HARA_CP); + mat4* mat = bone_data->get_mats_mat(BONE_ID_N_HARA_CP); vec3 pos; mat4_get_translation(mat, &pos); - vec3* global_position = 0; + vec3* gblctr_pos = 0; if (rob_chr_adj->get_global_pos) - global_position = rob_chara_bone_data_get_global_position(bone_data); - rob_chara_data_adjuct_set_pos(rob_chr_adj, pos, pos_adjust, global_position); + gblctr_pos = rob_chara_bone_data_get_gblctr_pos(bone_data); + rob_chara_data_adjuct_set_pos(rob_chr_adj, pos, pos_adjust, gblctr_pos); float_t scale = rob_chr_adj->scale; mat4_scale(scale, scale, scale, &rob_chr_adj->mat); @@ -4138,16 +4159,16 @@ void rob_chara::set_data_adjust_mat(rob_chara_adjust_data* rob_chr_adj, bool pos mat4_set_translation(&rob_chr_adj->item_mat, &rob_chr_adj->item_pos); } -void rob_chara::set_data_miku_rot_position(const vec3& value) { - data.miku_rot.position = value; +void rob_chara::set_base_position_pos(const vec3& value) { + data.position.pos = value; } -void rob_chara::set_data_miku_rot_rot_y_int16(int16_t value) { - data.miku_rot.rot_y_int16 = value; +void rob_chara::set_base_position_yang(const RobAngle& value) { + data.position.yang = value; } void rob_chara::set_disable_collision(rob_osage_parts parts, bool disable) { - item_equip->set_disable_collision(parts, disable); + rob_disp->set_disable_collision(parts, disable); } void rob_chara::set_eyelid_mottbl_motion(int32_t type, int32_t mottbl_index, @@ -4371,7 +4392,7 @@ void rob_chara::set_face_mottbl_motion(int32_t type, int32_t mottbl_index, blend_duration = 0.0f; } else if (type == 2) { - if (rob_chara_get_object_info(this, ITEM_ATAMA) != v17) { + if (rob_chara_get_object_info(this, RPK_ATAMA) != v17) { sub_140553970(this, v17, 2); blend_duration = 0.0f; } @@ -4426,7 +4447,7 @@ void rob_chara::set_face_object(object_info obj_info, int32_t a3) { } void rob_chara::set_face_object_index(int32_t index) { - set_face_object(get_chara_init_data_face_object(index), 0); + set_face_object(get_rob_data_face_object(index), 0); } void rob_chara::set_frame(float_t frame) { @@ -4504,7 +4525,7 @@ void rob_chara::set_hand_item(int32_t uid, float_t blend_duration) { float_t left_hand_scale = -1.0f; float_t right_hand_scale = -1.0f; - const hand_item* hand_item = hand_item_handler_data_get_hand_item(uid, chara_index); + const hand_item* hand_item = hand_item_handler_data_get_hand_item(uid, chara_num); if (hand_item) { if (hand_item->obj_left.not_null()) { left_hand_scale = hand_item->hand_scale; @@ -4540,7 +4561,7 @@ void rob_chara::set_hand_item(int32_t uid, float_t blend_duration) { } void rob_chara::set_hand_item_l(int32_t uid) { - const hand_item* hand_item = hand_item_handler_data_get_hand_item(uid, chara_index); + const hand_item* hand_item = hand_item_handler_data_get_hand_item(uid, chara_num); object_info obj_info = {}; if (hand_item && hand_item->obj_left.not_null()) obj_info = hand_item->obj_left; @@ -4548,7 +4569,7 @@ void rob_chara::set_hand_item_l(int32_t uid) { } void rob_chara::set_hand_item_r(int32_t uid) { - const hand_item* hand_item = hand_item_handler_data_get_hand_item(uid, chara_index); + const hand_item* hand_item = hand_item_handler_data_get_hand_item(uid, chara_num); object_info obj_info = {}; if (hand_item && hand_item->obj_right.not_null()) obj_info = hand_item->obj_right; @@ -4612,7 +4633,7 @@ void rob_chara::set_look_camera(bool update_view_point, bool rotation_enable, fl bone_data->set_look_anim(update_view_point, rotation_enable, head_rot_strength, eyes_rot_strength, blend_duration, eyes_rot_step, a8, ft); if (fabsf(blend_duration) <= 0.000001f) - data.field_2 |= 0x80; + data.flag.bit.dmy_yokerare = 1; } void rob_chara::set_look_camera_new(bool rotation_enable, float_t head_rot_strength, @@ -4644,8 +4665,8 @@ bool rob_chara::set_motion_id(uint32_t motion_id, if (set_motion_reset_data) rob_chara::set_motion_reset_data(motion_id, frame); - item_equip->item_equip_object[ITEM_TE_L].init_cnt = 60; - item_equip->item_equip_object[ITEM_TE_R].init_cnt = 60; + rob_disp->skin_disp[RPK_TE_L].init_cnt = 60; + rob_disp->skin_disp[RPK_TE_R].init_cnt = 60; if (check_for_ageageagain_module()) { rob_chara_age_age_array_set_skip(chara_id, 1); @@ -4658,18 +4679,18 @@ bool rob_chara::set_motion_id(uint32_t motion_id, void rob_chara::set_motion_loop(float_t loop_begin, float_t loop_end, int32_t loop_count) { bone_data->set_motion_loop_state(MOT_PLAY_FRAME_DATA_LOOP_CONTINUOUS); bone_data->set_motion_loop(loop_begin, loop_count, loop_end); - if (data.field_1588.field_0.field_58 != 1) { - data.field_1588.field_0.field_58 = 1; - data.field_1588.field_0.frame = data.field_1588.field_0.frame_count - 1.0f; + if (data.motdata.field_0.field_58 != 1) { + data.motdata.field_0.field_58 = 1; + data.motdata.field_0.frame = data.motdata.field_0.frame_count - 1.0f; } } void rob_chara::set_motion_reset_data(uint32_t motion_id, float_t frame) { - item_equip->set_motion_reset_data(motion_id, frame); + rob_disp->set_motion_reset_data(motion_id, frame); } void rob_chara::set_motion_skin_param(uint32_t motion_id, float_t frame) { - item_equip->set_motion_skin_param(chara_id, motion_id, (int32_t)prj::roundf(frame)); + rob_disp->set_motion_skin_param(chara_id, motion_id, (int32_t)prj::roundf(frame)); } void rob_chara::set_motion_step(float_t value) { @@ -4701,7 +4722,7 @@ void rob_chara::set_mouth_mottbl_motion(int32_t type, } void rob_chara::set_osage_move_cancel(uint8_t id, float_t mv_ccl) { - item_equip->set_osage_move_cancel(id, mv_ccl); + rob_disp->set_osage_move_cancel(id, mv_ccl); if (id < 2) { rob_chara_age_age_array_set_move_cancel(chara_id, 1, mv_ccl); rob_chara_age_age_array_set_move_cancel(chara_id, 2, mv_ccl); @@ -4709,25 +4730,25 @@ void rob_chara::set_osage_move_cancel(uint8_t id, float_t mv_ccl) { } void rob_chara::set_osage_reset() { - item_equip->set_osage_reset(); + rob_disp->set_osage_reset(); } void rob_chara::set_osage_step(float_t value) { data.motion.step = value; if (value < 0.0f) value = data.motion.step_data.frame; - item_equip->set_osage_step(value); + rob_disp->set_osage_step(value); } -void rob_chara::set_parts_disp(item_id id, bool disp) { - if (id < ITEM_BODY) +void rob_chara::set_parts_disp(ROB_PARTS_KIND rpk, bool disp) { + if (rpk < 0) return; - else if (id < ITEM_ITEM16) - item_equip->set_disp(id, disp); - else if (id == ITEM_MAX) - for (int32_t i = ITEM_ATAMA; i <= ITEM_ITEM16; i++) { - item_equip->set_disp((item_id)i, disp); - if (i == ITEM_ATAMA && check_for_ageageagain_module()) { + else if (rpk < RPK_MAX) + rob_disp->set_disp(rpk, disp); + else if (rpk == RPK_MAX) + for (int32_t i = RPK_DISP_BEGIN; i <= RPK_DISP_END; i++) { + rob_disp->set_disp((ROB_PARTS_KIND)i, disp); + if (i == RPK_ATAMA && check_for_ageageagain_module()) { rob_chara_age_age_array_set_disp(chara_id, 1, disp); rob_chara_age_age_array_set_disp(chara_id, 2, disp); rob_chara_age_age_array_set_skip(chara_id, 1); @@ -4742,30 +4763,30 @@ void rob_chara::set_right_hand_scale(float_t value) { void rob_chara::set_shadow_cast(bool value) { if (value) - item_equip->field_A0 |= 0x04; + rob_disp->shadow_flag |= 0x04; else - item_equip->field_A0 &= ~0x04; + rob_disp->shadow_flag &= ~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_blk) + rob_chara_item_equip_object* skin_disp, const osage_ring_data& ring) { + for (ExOsageBlock*& i : skin_disp->osage_blk) i->SetRing(ring); - for (ExClothBlock*& i : itm_eq_obj->cloth) + for (ExClothBlock*& i : skin_disp->cloth) 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); +static void rob_chara_item_equip_set_ring(rob_chara_item_equip* rob_disp, const osage_ring_data& ring) { + for (int32_t i = rob_disp->disp_begin; i < rob_disp->disp_max; i++) + rob_chara_item_equip_object_set_ring(&rob_disp->skin_disp[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); + rob_chara_item_equip_set_ring(rob_disp, ring); } void rob_chara::set_step_motion_step(float_t value) { @@ -4780,21 +4801,21 @@ void rob_chara::set_step_motion_step(float_t value) { float_t step = data.motion.step; if (step < 0.0f) step = data.motion.step_data.frame; - item_equip->set_osage_step(step); + rob_disp->set_osage_step(step); } void rob_chara::set_use_opd(bool value) { - item_equip->use_opd = value; + rob_disp->use_opd = value; } void rob_chara::set_visibility(bool value) { if (value) { - data.field_0 |= 0x01; - data.field_3 |= 0x01; + data.flag.bit.disp = 1; + data.flag.bit.yoketa = 1; } else { - data.field_0 &= ~0x01; - data.field_3 &= ~0x01; + data.flag.bit.disp = 0; + data.flag.bit.yoketa = 0; } if (check_for_ageageagain_module()) { @@ -4804,7 +4825,7 @@ void rob_chara::set_visibility(bool value) { } void rob_chara::set_wind_strength(float_t value) { - item_equip->wind_strength = value; + rob_disp->wind_strength = value; } static bool sub_140413710(mot_play_data* play_data) { @@ -4826,39 +4847,39 @@ static bool sub_140419E90(rob_chara_bone_data* rob_bone_data) { } static void sub_140505310(rob_chara* rob_chr, const bone_database* bone_data, const motion_database* mot_db) { - switch (rob_chr->data.field_1588.field_0.field_58) { + switch (rob_chr->data.motdata.field_0.field_58) { case -1: { - rob_chr->data.field_1588.field_0.field_20.field_0 &= ~0x81; - rob_chr->data.motion.frame_data.frame = rob_chr->data.field_1588.field_0.frame; + rob_chr->data.motdata.field_0.field_20.field_0 &= ~0x81; + rob_chr->data.motion.frame_data.frame = rob_chr->data.motdata.field_0.frame; } break; case 0: { - uint32_t motion_id = rob_chr->data.field_1588.field_0.field_5C; + uint32_t motion_id = rob_chr->data.motdata.field_0.field_5C; if (motion_id == -1) - rob_chr->data.field_1588.field_0.field_20.field_0 &= ~0x81; + rob_chr->data.motdata.field_0.field_20.field_0 &= ~0x81; else - rob_chr->load_motion(motion_id, !!(rob_chr->data.field_1588.field_0.field_60 & 0x01), + rob_chr->load_motion(motion_id, !!(rob_chr->data.motdata.field_0.field_60 & 0x01), 0.0f, MOTION_BLEND, bone_data, mot_db); } break; case 1: { - struc_223* v1 = &rob_chr->data.field_1588; - int32_t loop_count = rob_chr->data.field_1588.field_0.loop_count; + struc_223* v1 = &rob_chr->data.motdata; + int32_t loop_count = rob_chr->data.motdata.field_0.loop_count; if (loop_count > 0) { - uint32_t motion_id = rob_chr->data.field_1588.field_0.field_64; + uint32_t motion_id = rob_chr->data.motdata.field_0.field_64; if (motion_id != -1) { if (rob_chr->data.motion.loop_index >= loop_count) { int32_t v6 = mothead_storage_get_mot_by_motion_id(motion_id, mot_db)->field_0.field_0; if (!(v6 & 0x80000) && !(v6 & 0x100000)) - rob_chr->load_motion(motion_id, !!(rob_chr->data.field_1588.field_0.field_68 & 0x01), + rob_chr->load_motion(motion_id, !!(rob_chr->data.motdata.field_0.field_68 & 0x01), 0.0f, MOTION_BLEND, bone_data, mot_db); } else if (v1->field_0.field_20.field_0 & 0x80000) { - int16_t* v8 = (int16_t*)rob_chr->data.field_8.field_148; - rob_chr->data.field_8.field_146 = v1->field_0.field_220; + int16_t* v8 = (int16_t*)rob_chr->data.action.field_148; + rob_chr->data.action.field_146 = v1->field_0.field_220; if (v8) v8[711] = v1->field_0.field_220; } - else if (rob_chr->data.field_1588.field_0.field_20.field_0 & 0x100000) - rob_chr->data.field_8.field_0 = 1; + else if (rob_chr->data.motdata.field_0.field_20.field_0 & 0x100000) + rob_chr->data.action.field_0 = 1; } } @@ -4887,49 +4908,49 @@ static void sub_140505980(rob_chara* rob_chr) { } } else { - if (rob_chr->data.field_1588.field_0.field_78 > rob_chr->data.motion.frame_data.frame) + if (rob_chr->data.motdata.field_0.field_78 > rob_chr->data.motion.frame_data.frame) return; - if (rob_chr->data.field_1588.field_0.field_10.field_0 & 0x4000) { - rob_chr->data.field_1588.field_0.field_20.field_0 |= 0x4000; - if ((rob_chr->data.field_1588.field_0.field_10.field_0 & 0x20000) != 0) - rob_chr->data.field_1588.field_0.field_20.field_0 &= ~0x20000; + if (rob_chr->data.motdata.field_0.field_10.field_0 & 0x4000) { + rob_chr->data.motdata.field_0.field_20.field_0 |= 0x4000; + if ((rob_chr->data.motdata.field_0.field_10.field_0 & 0x20000) != 0) + rob_chr->data.motdata.field_0.field_20.field_0 &= ~0x20000; } - rob_chr->data.field_1588.field_0.field_20.field_0 &= ~0x02; + rob_chr->data.motdata.field_0.field_20.field_0 &= ~0x02; rob_chr->data.motion.field_24 = 1; } - if (rob_chr->data.field_1588.field_0.field_7C > rob_chr->data.motion.frame_data.frame) + if (rob_chr->data.motdata.field_0.field_7C > rob_chr->data.motion.frame_data.frame) return; - rob_chr->data.field_1588.field_0.field_20.field_0 |= 4; - rob_chr->data.field_1588.field_0.field_20.field_8 &= ~0x400000; - v3 = rob_chr->data.field_1588.field_0.field_20.field_0; + rob_chr->data.motdata.field_0.field_20.field_0 |= 4; + rob_chr->data.motdata.field_0.field_20.field_8 &= ~0x400000; + v3 = rob_chr->data.motdata.field_0.field_20.field_0; if (v3 & 0x4000) { - rob_chr->data.field_1588.field_0.field_20.field_0 = v3 & ~0x4000; - rob_chr->data.field_1588.field_0.field_88 &= ~0x02; - if (rob_chr->data.field_1588.field_0.field_88 & 0x04) - rob_chr->data.field_1588.field_0.field_20.field_0 &= ~0x8000; + rob_chr->data.motdata.field_0.field_20.field_0 = v3 & ~0x4000; + rob_chr->data.motdata.field_0.field_88 &= ~0x02; + if (rob_chr->data.motdata.field_0.field_88 & 0x04) + rob_chr->data.motdata.field_0.field_20.field_0 &= ~0x8000; } else if (v3 & 0x2000000 && (v3 & 0x01) != 0 - && !(rob_chr->data.field_1588.field_0.field_20.field_4 & 0x10000000) - && !(rob_chr->data.field_1588.field_0.field_20.field_4 & 0x20000000)) - rob_chr->data.field_1588.field_0.field_20.field_0 = v3 & ~0x01; + && !(rob_chr->data.motdata.field_0.field_20.field_4 & 0x10000000) + && !(rob_chr->data.motdata.field_0.field_20.field_4 & 0x20000000)) + rob_chr->data.motdata.field_0.field_20.field_0 = v3 & ~0x01; - v4 = rob_chr->data.field_1588.field_0.field_10.field_0; + v4 = rob_chr->data.motdata.field_0.field_10.field_0; if (v4 & 0x10000 && v4 & 0x20000) - rob_chr->data.field_1588.field_0.field_20.field_0 &= ~0x20000; + rob_chr->data.motdata.field_0.field_20.field_0 &= ~0x20000; rob_chr->data.motion.field_24 = 2; LABEL_23: - float_t v5 = rob_chr->data.field_1588.field_0.field_80; + float_t v5 = rob_chr->data.motdata.field_0.field_80; if (v5 >= 0.0f && v5 <= rob_chr->data.motion.frame_data.frame) { - if (v5 < (rob_chr->data.field_1588.field_0.frame - 1.0f) - || rob_chr->data.field_1588.field_0.field_58 == -1 - || rob_chr->data.field_1588.field_0.field_58 == 2) { - rob_chr->data.field_1588.field_0.field_20.field_0 &= ~0x2020081; - rob_chr->data.field_2 |= 0x20; + if (v5 < (rob_chr->data.motdata.field_0.frame - 1.0f) + || rob_chr->data.motdata.field_0.field_58 == -1 + || rob_chr->data.motdata.field_0.field_58 == 2) { + rob_chr->data.motdata.field_0.field_20.field_0 &= ~0x2020081; + rob_chr->data.flag.bit.mk_change_off = 1; } rob_chr->data.motion.field_24 = 3; } @@ -4960,13 +4981,13 @@ static void mothead_apply(struc_223* a1, rob_chara* rob_chr, float_t frame, cons mothead_func_data func_data; func_data.rob_chr = rob_chr; - func_data.rob_chr_data = &rob_chr->data; + func_data.rob_base = &rob_chr->data; if (rob_chr->field_20) func_data.field_10 = (rob_chara_data*)((size_t)rob_chr->field_20 + 0x440); else func_data.field_10 = 0; func_data.field_18 = rob_chr; - func_data.field_28 = &rob_chr->data.field_1588; + func_data.field_28 = &rob_chr->data.motdata; func_data.field_20 = &rob_chr->data; int32_t frame_int = (int32_t)frame; @@ -4977,18 +4998,18 @@ static void mothead_apply(struc_223* a1, rob_chara* rob_chr, float_t frame, cons } static void sub_1405044B0(rob_chara* rob_chr) { - if (rob_chr->data.field_1588.field_330.arm_adjust_duration > 0) { // X + if (rob_chr->data.motdata.field_330.arm_adjust_duration > 0) { // X float_t blend = 1.0f; - if (fabsf(rob_chr->data.field_1588.field_330.arm_adjust_duration) > 0.000001f) + if (fabsf(rob_chr->data.motdata.field_330.arm_adjust_duration) > 0.000001f) blend = (rob_chr->data.motion.frame_data.frame - - (float_t)rob_chr->data.field_1588.field_330.arm_adjust_start_frame) - / rob_chr->data.field_1588.field_330.arm_adjust_duration; + - (float_t)rob_chr->data.motdata.field_330.arm_adjust_start_frame) + / rob_chr->data.motdata.field_330.arm_adjust_duration; blend = clamp_def(blend, 0.0f, 1.0f); if (fabsf(blend - 1.0f) <= 0.000001f) - rob_chr->data.field_1588.field_330.arm_adjust_duration = -1.0f; - rob_chr->data.arm_adjust_scale = lerp_def(rob_chr->data.field_1588.field_330.arm_adjust_prev_value, - rob_chr->data.field_1588.field_330.arm_adjust_next_value, blend); + rob_chr->data.motdata.field_330.arm_adjust_duration = -1.0f; + rob_chr->data.arm_adjust_scale = lerp_def(rob_chr->data.motdata.field_330.arm_adjust_prev_value, + rob_chr->data.motdata.field_330.arm_adjust_next_value, blend); float_t default_scale = chara_size_table_get_value(1); rob_chr->data.adjust_data.item_scale = default_scale @@ -4997,19 +5018,19 @@ static void sub_1405044B0(rob_chara* rob_chr) { float_t v2 = rob_chr->bone_data->ik_scale.ratio0; float_t v4 = v2; - if (!rob_chr->data.field_1588.field_330.field_31C) { + if (!rob_chr->data.motdata.field_330.field_31C) { rob_chr->data.motion.field_138 = v2; rob_chr->data.motion.field_13C = v2; rob_chr->data.motion.field_140 = 0.0f; return; } - float_t v5 = rob_chr->data.field_1588.field_330.field_324; + float_t v5 = rob_chr->data.motdata.field_330.field_324; float_t v6 = v2; - float_t v7 = rob_chr->data.field_1588.field_330.field_32C; + float_t v7 = rob_chr->data.motdata.field_330.field_32C; float_t v8 = 0.0f; - if (rob_chr->data.field_1588.field_330.field_318 == 1) { - switch (rob_chr->data.field_1588.field_330.field_31C) { + if (rob_chr->data.motdata.field_330.field_318 == 1) { + switch (rob_chr->data.motdata.field_330.field_31C) { case 1: v6 = 1.0f; break; @@ -5047,17 +5068,17 @@ static void sub_1405044B0(rob_chara* rob_chr) { v6 *= v4; break; case 10: - if (rob_chr->data.field_1588.field_330.field_320 > 0.0f) - v6 = rob_chr->data.field_1588.field_330.field_320; + if (rob_chr->data.motdata.field_330.field_320 > 0.0f) + v6 = rob_chr->data.motdata.field_330.field_320; break; } - v8 = rob_chr->data.field_1588.field_330.field_328; + v8 = rob_chr->data.motdata.field_330.field_328; } float_t v15 = rob_chr->data.motion.frame_data.frame; - float_t v16 = rob_chr->data.field_1588.field_330.field_314; + float_t v16 = rob_chr->data.motdata.field_330.field_314; if (v15 < v16) { - float_t v17 = rob_chr->data.field_1588.field_330.field_310; + float_t v17 = rob_chr->data.motdata.field_330.field_310; if (v15 < v17) { v6 = v5; v8 = v7; @@ -5080,7 +5101,7 @@ void rob_chara::sub_1405070E0(const bone_database* bone_data, const motion_datab if (sub_140419E90(this->bone_data) || this->bone_data->get_motion_has_looped()) sub_140505310(this, bone_data, mot_db); sub_140505980(this); - mothead_apply(&data.field_1588, this, data.motion.frame_data.frame, mot_db); + mothead_apply(&data.motdata, this, data.motion.frame_data.frame, mot_db); sub_1405044B0(this); } @@ -5091,17 +5112,17 @@ void rob_chara::sub_140509D30() { mat4* v42 = data.field_1E68.field_78; mat4* v43 = data.field_1E68.field_738; - const struc_218* v3 = chara_init_data->field_828; - const struc_218* v6 = chara_init_data->field_830; + const RobCollisionData* colli = rob_data->colli_data; + const RobCollisionData* push_colli = rob_data->push_colli_data; mat4* m; mat4 mat; for (int32_t i = 0; i < 27; i++) { - m = bone_data->get_mats_mat(v3->bone_index); - mat4_mul_translate(m, &v3->bone_offset, &mat); + m = bone_data->get_mats_mat(colli->bone); + mat4_mul_translate(m, &colli->trans, &mat); *v42 = mat; - m = bone_data->get_mats_mat(v6->bone_index); - mat4_mul_translate(m, &v3->bone_offset, &mat); + m = bone_data->get_mats_mat(push_colli->bone); + mat4_mul_translate(m, &push_colli->trans, &mat); *v43 = mat; float_t chara_scale = data.adjust_data.scale; @@ -5112,13 +5133,13 @@ void rob_chara::sub_140509D30() { vec3 v29 = *(vec3*)&v43->row3 * chara_scale + data.adjust_data.pos; *(vec3*)&v43->row3 = v29; - float_t v20 = v3->scale * chara_scale; + float_t v20 = colli->scale * chara_scale; v39->scale = v20; v39->field_24 = v20; v39->prev_pos = v39->pos; v39->pos = v23; - float_t v19 = v6->scale * chara_scale; + float_t v19 = push_colli->scale * chara_scale; v40->scale = v19; v40->field_24 = v19; v40->prev_pos = v40->pos; @@ -5134,8 +5155,8 @@ void rob_chara::sub_140509D30() { v41++; v42++; v43++; - v3++; - v6++; + colli++; + push_colli++; } } @@ -5145,7 +5166,7 @@ void rob_chara::sub_1405163C0(int32_t index, mat4& mat) { } void rob_chara::sub_140551000() { - struc_223* v1 = &data.field_1588; + struc_223* v1 = &data.motdata; v1->field_330.field_0.current = v1->field_330.field_0.data; } @@ -5216,7 +5237,7 @@ osage_init_data::~osage_init_data() { OpdMakeManagerData::Worker::Worker() { mode = -1; progress = -1; - chara = CHARA_NONE; + chara = CN_NONE; } OpdMakeManagerData::Worker::~Worker() { @@ -5418,85 +5439,80 @@ void OpdChecker::sub_140471020() { static void bone_data_parent_data_init(bone_data_parent* bone, rob_chara_bone_data* rob_bone_data, const bone_database* bone_data) { - const char* base_name = bone_database_skeleton_type_to_string(rob_bone_data->base_skeleton_type); - const char* name = bone_database_skeleton_type_to_string(rob_bone_data->skeleton_type); - const std::vector* common_bones = bone_data->get_skeleton_bones(base_name); - const std::vector* common_position = bone_data->get_skeleton_positions(base_name); - const std::vector* position = bone_data->get_skeleton_positions(name); - if (!common_bones || !common_position || !position) + const std::vector* common_bones + = bone_data->get_body_type(rob_bone_data->base_skeleton_type); + const std::vector* motion_chain_pos + = bone_data->get_chain_pos_rad(rob_bone_data->base_skeleton_type); + const std::vector* disp_chain_pos + = bone_data->get_chain_pos_rad(rob_bone_data->skeleton_type); + if (!common_bones || !motion_chain_pos || !disp_chain_pos) return; bone->rob_bone_data = rob_bone_data; bone_data_parent_load_rob_chara(bone); - bone_data_parent_load_bone_database(bone, common_bones, common_position->data(), position->data()); + bone_data_parent_load_bone_database(bone, common_bones, motion_chain_pos->data(), disp_chain_pos->data()); } static void bone_data_parent_load_bone_database(bone_data_parent* bone, - const std::vector* bones, const vec3* common_position, const vec3* position) { + const std::vector* bones, const CHAINPOSRADIUS* motion_chain_pos, const CHAINPOSRADIUS* disp_chain_pos) { rob_chara_bone_data* rob_bone_data = bone->rob_bone_data; size_t chain_pos = 0; size_t node_count = 0; size_t leaf_pos = 0; - bone_data* bone_node = bone->bones.data(); - for (const bone_database_bone& i : *bones ) { - bone_node->motion_bone_index = (motion_bone_index)(&i - bones->data()); - bone_node->type = i.type; - bone_node->mirror = i.mirror; - bone_node->parent = i.parent; - bone_node->flags = i.flags; - if (i.type >= BONE_DATABASE_BONE_POSITION_ROTATION) - bone_node->key_set_count = 6; - else - bone_node->key_set_count = 3; - bone_node->local_position[0] = *common_position++; - bone_node->local_position[1] = *position++; - bone_node->node = &rob_bone_data->nodes[node_count]; - bone_node->has_parent = i.has_parent; - if (i.has_parent) - bone_node->parent_mat = &rob_bone_data->mats[i.parent]; - else - bone_node->parent_mat = 0; + RobBlock* block = bone->bones.data(); + for (const BODYTYPE& i : *bones ) { + block->block_id = (BONE_BLK)(&i - bones->data()); + block->ik_type = i.ik_type; + block->flip_block_id = (BONE_BLK)i.flip_block_id; + block->inherit_mat_id = (BONE_BLK)i.inherit_mat_id; + block->expression_id = i.expression_id; + block->key_set_count = i.ik_type >= IKT_ROOT ? 6 : 3; + block->chain_pos[0] = (*motion_chain_pos++).chain_pos; + block->chain_pos[1] = (*disp_chain_pos++).chain_pos; + block->node = &rob_bone_data->nodes[node_count]; + block->inherit_type = i.inherit_type; + block->inherit_mat_ptr = i.inherit_type ? &rob_bone_data->mats[i.inherit_mat_id] : 0; - bone_node->pole_target_mat = 0; - switch (i.type) { - case BONE_DATABASE_BONE_ROTATION: - case BONE_DATABASE_BONE_TYPE_1: - case BONE_DATABASE_BONE_POSITION: + block->up_vector_mat_ptr = 0; + switch (i.ik_type) { + case IKT_0: + case IKT_0N: + case IKT_0T: chain_pos++; node_count++; break; - case BONE_DATABASE_BONE_POSITION_ROTATION: + case IKT_ROOT: chain_pos++; leaf_pos++; node_count++; break; - case BONE_DATABASE_BONE_HEAD_IK_ROTATION: - bone_node->ik_segment_length[0] = (common_position++)->x; - bone_node->ik_segment_length[1] = (position++)->x; + case IKT_1: + block->len[0][0] = (*motion_chain_pos++).chain_pos.x; + block->len[0][1] = (*disp_chain_pos++).chain_pos.x; chain_pos += 2; leaf_pos++; node_count += 3; break; - case BONE_DATABASE_BONE_ARM_IK_ROTATION: - case BONE_DATABASE_BONE_LEGS_IK_ROTATION: - bone_node->ik_segment_length[0] = (common_position++)->x; - bone_node->ik_segment_length[1] = (position++)->x; - bone_node->ik_2nd_segment_length[0] = (common_position++)->x; - bone_node->ik_2nd_segment_length[1] = (position++)->x; + case IKT_2: + case IKT_2R: + block->len[0][0] = (*motion_chain_pos++).chain_pos.x; + block->len[0][1] = (*disp_chain_pos++).chain_pos.x; + block->len[1][0] = (*motion_chain_pos++).chain_pos.x; + block->len[1][1] = (*disp_chain_pos++).chain_pos.x; - mat4* pole_target = 0; - if (i.pole_target) - pole_target = &rob_bone_data->mats[i.pole_target]; - bone_node->pole_target_mat = pole_target; + mat4* up_vector_mat = 0; + if (i.up_vector_id) + up_vector_mat = &rob_bone_data->mats[i.up_vector_id]; + block->up_vector_mat_ptr = up_vector_mat; chain_pos += 3; leaf_pos++; node_count += 4; break; } - bone_node++; + block++; } if (node_count != rob_bone_data->node_count) @@ -5519,30 +5535,26 @@ static void bone_data_parent_load_bone_indices_from_mot(bone_data_parent* a1, if (!key_set_count) return; - bone_database_skeleton_type skeleton_type = a1->rob_bone_data->base_skeleton_type; - const char* skeleton_type_string = bone_database_skeleton_type_to_string(skeleton_type); - const std::string* bone_names = mot_db->bone_name.data(); + BONE_KIND skeleton_type = a1->rob_bone_data->base_skeleton_type; + const std::string* bone_name = mot_db->bone_name.data(); const mot_bone_info* bone_info = a2->bone_info_array; for (size_t key_set_offset = 0, i = 0; key_set_offset < key_set_count; i++) { - motion_bone_index bone_index = (motion_bone_index)bone_data->get_skeleton_bone_index( - skeleton_type_string, bone_names[bone_info[i].index].c_str()); + BONE_BLK bone_index = (BONE_BLK)bone_data->get_block_index( + skeleton_type, bone_name[bone_info[i].index].c_str()); if (bone_index == -1) { i++; - bone_index = (motion_bone_index)bone_data->get_skeleton_bone_index( - skeleton_type_string, bone_names[bone_info[i].index].c_str()); + bone_index = (BONE_BLK)bone_data->get_block_index( + skeleton_type, bone_name[bone_info[i].index].c_str()); if (bone_index == -1) break; } bone_indices.push_back((uint16_t)bone_index); - ::bone_data* bone_node = &a1->bones.data()[bone_index]; - bone_node->key_set_offset = (int32_t)key_set_offset; - bone_node->frame = -1.0f; - if (bone_node->type >= BONE_DATABASE_BONE_POSITION_ROTATION) - key_set_offset += 6; - else - key_set_offset += 3; + RobBlock* block = &a1->bones.data()[bone_index]; + block->key_set_offset = (int32_t)key_set_offset; + block->frame = -1.0f; + key_set_offset += block->ik_type >= IKT_ROOT ? 6 : 3; } } @@ -5720,7 +5732,7 @@ static bool mot_load_file(mot* a1, const mot_data* a2) { } static void mot_key_data_get_key_set_count_by_bone_database_bones(mot_key_data* a1, - const std::vector* a2) { + const std::vector* a2) { size_t object_bone_count; size_t motion_bone_count; size_t node_count; @@ -5736,9 +5748,8 @@ static void mot_key_data_get_key_set_count(mot_key_data* a1, size_t motion_bone_ } static void mot_key_data_init(mot_key_data* a1, - bone_database_skeleton_type type, const bone_database* bone_data) { - const char* name = bone_database_skeleton_type_to_string(type); - const std::vector* bones = bone_data->get_skeleton_bones(name); + BONE_KIND type, const bone_database* bone_data) { + const std::vector* bones = bone_data->get_body_type(type); if (!bones) return; @@ -5747,7 +5758,7 @@ static void mot_key_data_init(mot_key_data* a1, a1->skeleton_type = type; } -static void mot_key_data_init_key_sets(mot_key_data* a1, bone_database_skeleton_type type, +static void mot_key_data_init_key_sets(mot_key_data* a1, BONE_KIND type, size_t motion_bone_count, size_t leaf_pos) { mot_key_data_get_key_set_count(a1, motion_bone_count, leaf_pos); mot_key_data_reserve_key_sets(a1); @@ -5776,8 +5787,8 @@ static const mot_data* mot_key_data_load_file(mot_key_data* a1, uint32_t motion_ static void mot_key_data_reserve_key_sets(mot_key_data* a1) { a1->key_set.clear(); a1->key_set.resize(a1->key_set_count); - a1->key_set_data.clear(); - a1->key_set_data.resize(a1->key_set_count); + a1->fc_value.clear(); + a1->fc_value.resize(a1->key_set_count); a1->mot.key_sets = a1->key_set.data(); a1->key_sets_ready = true; @@ -5795,66 +5806,65 @@ static void mothead_func_1(mothead_func_data* func_data, static void mothead_func_2(mothead_func_data* func_data, const void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { - func_data->rob_chr_data->field_1588.field_0.field_20.field_0 |= 0x100; - rob_chara_data* rob_chr_data = func_data->rob_chr_data; - if (rob_chr_data->motion.field_28 & 0x08) - rob_chr_data->field_1588.field_0.field_274 -= ((int16_t*)data)[0]; + func_data->rob_base->motdata.field_0.field_20.field_0 |= 0x100; + rob_chara_data* rob_base = func_data->rob_base; + if (rob_base->motion.field_28 & 0x08) + rob_base->motdata.field_0.field_274 -= ((int16_t*)data)[0]; else - rob_chr_data->field_1588.field_0.field_274 += ((int16_t*)data)[0]; + rob_base->motdata.field_0.field_274 += ((int16_t*)data)[0]; } static void mothead_func_3(mothead_func_data* func_data, const void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { int32_t v4 = ((int32_t*)data)[0]; - rob_chara_data* rob_chr_data = func_data->rob_chr_data; - (&rob_chr_data->field_1588.field_0.field_20.field_0)[v4 >> 5] |= 1 << (v4 & 0x1F); + rob_chara_data* rob_base = func_data->rob_base; + (&rob_base->motdata.field_0.field_20.field_0)[v4 >> 5] |= 1 << (v4 & 0x1F); } static void mothead_func_4(mothead_func_data* func_data, const void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { int32_t v4 = ((int32_t*)data)[0]; - rob_chara_data* rob_chr_data = func_data->rob_chr_data; - (&rob_chr_data->field_1588.field_0.field_20.field_0)[v4 >> 5] &= ~(1 << (v4 & 0x1F)); + rob_chara_data* rob_base = func_data->rob_base; + (&rob_base->motdata.field_0.field_20.field_0)[v4 >> 5] &= ~(1 << (v4 & 0x1F)); } static void mothead_func_5(mothead_func_data* func_data, const void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { - func_data->rob_chr_data->motion.field_28 ^= 0x04; + func_data->rob_base->motion.field_28 ^= 0x04; } static void mothead_func_6(mothead_func_data* func_data, const void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { - func_data->rob_chr_data->field_8.field_1B4 = 0; - func_data->rob_chr_data->field_1588.field_0.field_20.field_0 |= 0x400; - func_data->rob_chr_data->field_1588.field_0.field_20.field_0 |= 0x800; + func_data->rob_base->action.field_1B4 = 0; + func_data->rob_base->motdata.field_0.field_20.field_0 |= 0x400; + func_data->rob_base->motdata.field_0.field_20.field_0 |= 0x800; } static void sub_140551AF0(rob_chara* rob_chr) { - if (!(rob_chr->data.field_0 & 0x02)) { - rob_chr->data.miku_rot.position.y = rob_chr->data.miku_rot.n_hara_pos.y; - rob_chr->data.field_0 |= 0x02; - if (!(rob_chr->data.field_1588.field_0.field_1E8 & 0x01)) { - rob_chr->data.miku_rot.position.x = rob_chr->data.miku_rot.n_hara_pos.x; - rob_chr->data.miku_rot.position.z = rob_chr->data.miku_rot.n_hara_pos.z; + if (!rob_chr->data.flag.bit.fix_hara) { + rob_chr->data.position.pos.y = rob_chr->data.position.gpos.y; + rob_chr->data.flag.bit.fix_hara = 1; + if (!(rob_chr->data.motdata.field_0.field_1E8 & 0x01)) { + rob_chr->data.position.pos.x = rob_chr->data.position.gpos.x; + rob_chr->data.position.pos.z = rob_chr->data.position.gpos.z; } } - rob_chr->data.field_1588.field_0.field_20.field_0 |= 0x40; + rob_chr->data.motdata.field_0.field_20.field_0 |= 0x40; } static void mothead_func_7(mothead_func_data* func_data, const void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { int16_t v4 = ((int16_t*)data)[0]; - rob_chara_data* rob_chr_data = func_data->rob_chr_data; - if (rob_chr_data->motion.field_28 & 0x08) + rob_chara_data* rob_base = func_data->rob_base; + if (rob_base->motion.field_28 & 0x08) v4 = -v4; - float_t v8 = (float_t)((double_t)(int16_t)(v4 + rob_chr_data->field_1588.field_0.field_2B8 - + rob_chr_data->miku_rot.rot_y_int16) * M_PI * (1.0 / 32768.0)); + float_t v8 = (v4 + rob_base->motdata.field_0.field_2B8 + rob_base->position.yang).get_rad(); float_t v9 = sinf(v8) * ((float_t*)data)[1]; float_t v10 = get_gravity() * ((float_t*)data)[2]; float_t v11 = cosf(v8) * ((float_t*)data)[1]; - rob_chr_data->miku_rot.field_30.x = v9; - rob_chr_data->miku_rot.field_30.y = v10; - rob_chr_data->miku_rot.field_30.z = v11; + rob_base->position.spd.x = v9; + rob_base->position.spd.y = v10; + rob_base->position.spd.z = v11; sub_140551AF0(func_data->rob_chr); } @@ -5898,7 +5908,7 @@ static void mothead_func_13(mothead_func_data* func_data, int32_t v14; // [rsp+30h] [rbp-18h] rob_chr = func_data->rob_chr; - v5 = func_data->rob_chr_data; + v5 = func_data->rob_base; v6 = ((int32_t*)data)[1]; v10 = -1; v11 = -1; @@ -5980,10 +5990,10 @@ static void mothead_func_17(mothead_func_data* func_data, __int16 a1; // [rsp+70h] [rbp+20h] BYREF v4 = ((int16_t*)data)[1]; - v5 = func_data->rob_chr_data; + v5 = func_data->rob_base; if (v4 & 0x02) { v8 = v5->field_1E68.field_1EB4[0].field_0; - a1 = v5->miku_rot.field_2; + a1 = v5->position.field_2; if (v8 > 4.0) return; v9 = v8 - ((float_t*)data)[5]; @@ -5991,14 +6001,14 @@ static void mothead_func_17(mothead_func_data* func_data, if (v9 < v10 && v10 >= 0.0f || (v10 = ((float_t*)data)[2], v9 > v10) && v10 >= 0.0f) v9 = v10; LABEL_8: - v11 = &v5->field_1588.field_330.field_20.x; - sub_1405357B0(&a1, &v5->miku_rot.n_hara_pos, &v5->field_1588.field_330.field_20, v9); - v5->field_1588.field_330.field_18 = 1; + v11 = &v5->motdata.field_330.field_20.x; + sub_1405357B0(&a1, &v5->position.gpos, &v5->motdata.field_330.field_20, v9); + v5->motdata.field_330.field_18 = 1; goto LABEL_27; } if (v4 & 0x04) { v12 = v5->field_1E68.field_1EB4[2].field_0; - a1 = v5->miku_rot.field_2 + 0x8000; + a1 = v5->position.field_2 + 0x8000; if (v12 > 4.0) return; v9 = v12 - ((float_t*)data)[5]; @@ -6013,7 +6023,7 @@ static void mothead_func_17(mothead_func_data* func_data, v15 = ((float_t*)data)[3]; v16 = ((float_t*)data)[5]; v17 = ((float_t*)data)[4]; - v5->field_1588.field_330.field_18 = 2; + v5->motdata.field_330.field_18 = 2; v18 = -v16; if (v18 >= *((float_t*)data + 1)) { if (v14 < 0.0f) { @@ -6024,73 +6034,73 @@ static void mothead_func_17(mothead_func_data* func_data, } else v18 = ((float_t*)data)[1]; - v5->field_1588.field_330.field_20.z = v17; - v5->field_1588.field_330.field_20.y = 0.0f; - v11 = &v5->field_1588.field_330.field_20.x; + v5->motdata.field_330.field_20.z = v17; + v5->motdata.field_330.field_20.y = 0.0f; + v11 = &v5->motdata.field_330.field_20.x; *(int64_t*)&v39.x = 0; v39.z = 0.0f; - v5->field_1588.field_330.field_20.x = v15; + v5->motdata.field_330.field_20.x = v15; v19 = ((int16_t*)data)[0]; *(int64_t*)&a3.x = 0; a3.z = 0.0f; sub_140533530(func_data, (float_t)v19, &a3); - sub_140533530(func_data, func_data->rob_chr_data->motion.frame_data.frame, &v39); - v20 = &func_data->rob_chr_data->miku_rot.field_2; + sub_140533530(func_data, func_data->rob_base->motion.frame_data.frame, &v39); + v20 = &func_data->rob_base->position.field_2; a3.x = a3.x - v39.x; a3.z = a3.z - v39.z; sub_140535710(v20, &a3.x, &a3.x); - a1 = func_data->field_10->miku_rot.field_2; - sub_140535710(&a1, &v5->field_1588.field_330.field_20.x, &v5->field_1588.field_330.field_20.x); - v21 = v5->field_1588.field_330.field_20.x - a3.x; - v22 = v5->field_1588.field_330.field_20.z - a3.z; - v5->field_1588.field_330.field_20.x = v21; - v5->field_1588.field_330.field_20.z = v22; + a1 = func_data->field_10->position.field_2; + sub_140535710(&a1, &v5->motdata.field_330.field_20.x, &v5->motdata.field_330.field_20.x); + v21 = v5->motdata.field_330.field_20.x - a3.x; + v22 = v5->motdata.field_330.field_20.z - a3.z; + v5->motdata.field_330.field_20.x = v21; + v5->motdata.field_330.field_20.z = v22; v23 = func_data->field_10; - v24 = v23->miku_rot.n_hara_pos.y + v5->field_1588.field_330.field_20.y; - v25 = v23->miku_rot.n_hara_pos.z + v5->field_1588.field_330.field_20.z; - v5->field_1588.field_330.field_20.x = v21 + v23->miku_rot.n_hara_pos.x; - v26 = func_data->rob_chr_data; - v5->field_1588.field_330.field_20.y = v24; - v5->field_1588.field_330.field_20.z = v25; - v27 = v25 - v26->miku_rot.n_hara_pos.z; - v28 = v5->field_1588.field_330.field_20.x - v26->miku_rot.n_hara_pos.x; - v5->field_1588.field_330.field_20.y = v24 - v26->miku_rot.n_hara_pos.y; - v5->field_1588.field_330.field_20.z = v27; - v5->field_1588.field_330.field_20.x = v28; - v5->field_1588.field_330.field_20.y = 0.0f; - v29 = (__m128)LODWORD(v5->field_1588.field_330.field_20.x); + v24 = v23->position.gpos.y + v5->motdata.field_330.field_20.y; + v25 = v23->position.gpos.z + v5->motdata.field_330.field_20.z; + v5->motdata.field_330.field_20.x = v21 + v23->position.gpos.x; + v26 = func_data->rob_base; + v5->motdata.field_330.field_20.y = v24; + v5->motdata.field_330.field_20.z = v25; + v27 = v25 - v26->position.gpos.z; + v28 = v5->motdata.field_330.field_20.x - v26->position.gpos.x; + v5->motdata.field_330.field_20.y = v24 - v26->position.gpos.y; + v5->motdata.field_330.field_20.z = v27; + v5->motdata.field_330.field_20.x = v28; + v5->motdata.field_330.field_20.y = 0.0f; + v29 = (__m128)LODWORD(v5->motdata.field_330.field_20.x); v29.m128_f32[0] = (float_t)((float_t)(v29.m128_f32[0] * v29.m128_f32[0]) - + (float_t)(v5->field_1588.field_330.field_20.y * v5->field_1588.field_330.field_20.y)) - + (float_t)(v5->field_1588.field_330.field_20.z * v5->field_1588.field_330.field_20.z); + + (float_t)(v5->motdata.field_330.field_20.y * v5->motdata.field_330.field_20.y)) + + (float_t)(v5->motdata.field_330.field_20.z * v5->motdata.field_330.field_20.z); if (_mm_sqrt_ps(v29).m128_f32[0] > v18) { - vec3::normalize(&v5->field_1588.field_330.field_20); + vec3::normalize(&v5->motdata.field_330.field_20); v30 = v18 * *v11; - v31 = v18 * v5->field_1588.field_330.field_20.y; - v5->field_1588.field_330.field_20.z = v18 * v5->field_1588.field_330.field_20.z; + v31 = v18 * v5->motdata.field_330.field_20.y; + v5->motdata.field_330.field_20.z = v18 * v5->motdata.field_330.field_20.z; *v11 = v30; - v5->field_1588.field_330.field_20.y = v31; + v5->motdata.field_330.field_20.y = v31; } - v32 = func_data->rob_chr_data; - v33 = v32->miku_rot.n_hara_pos.z + v5->field_1588.field_330.field_20.z; - v34 = v32->miku_rot.n_hara_pos.y + v5->field_1588.field_330.field_20.y; - *v11 = v32->miku_rot.n_hara_pos.x + *v11; - v5->field_1588.field_330.field_20.y = v34; - v5->field_1588.field_330.field_20.z = v33; + v32 = func_data->rob_base; + v33 = v32->position.gpos.z + v5->motdata.field_330.field_20.z; + v34 = v32->position.gpos.y + v5->motdata.field_330.field_20.y; + *v11 = v32->position.gpos.x + *v11; + v5->motdata.field_330.field_20.y = v34; + v5->motdata.field_330.field_20.z = v33; LABEL_27: v35 = (float_t)((int16_t*)data)[0]; - v5->field_1588.field_330.field_1C = v35; + v5->motdata.field_330.field_1C = v35; if (v4 & 0x08) { - v36 = func_data->rob_chr_data; - if (v35 < v36->field_1588.field_0.field_1F4) - v35 = v36->field_1588.field_0.field_1F4; + v36 = func_data->rob_base; + if (v35 < v36->motdata.field_0.field_1F4) + v35 = v36->motdata.field_0.field_1F4; v37 = v35 - v36->motion.frame_data.frame; if (v37 < 1.0) v37 = 1.0; - v36->miku_rot.field_30.x = (float_t)(*v11 - v36->miku_rot.n_hara_pos.x) * (float_t)(1.0 / v37); - v36->miku_rot.field_30.z = (float_t)(v5->field_1588.field_330.field_20.z - v36->miku_rot.n_hara_pos.z) + v36->position.spd.x = (float_t)(*v11 - v36->position.gpos.x) * (float_t)(1.0 / v37); + v36->position.spd.z = (float_t)(v5->motdata.field_330.field_20.z - v36->position.gpos.z) * (float_t)(1.0 / v37); - v36->miku_rot.field_30.y = get_gravity() * ((float_t*)data)[6]; - func_data->rob_chr_data->field_8.field_B8.field_10.y = 0.0f; + v36->position.spd.y = get_gravity() * ((float_t*)data)[6]; + func_data->rob_base->field_8.field_B8.field_10.y = 0.0f; sub_140551AF0(func_data->rob_chr); }*/ } @@ -6176,12 +6186,12 @@ static void mothead_func_29(mothead_func_data* func_data, v25 = (int32_t*)((char*)data + 52); if (!sub_1405333D0(&v25) || ((v8 = *((int16_t*)data + 24)) != 0 - || (v9 = *(int32_t*)&v5[4 * ((uint64_t)(int32_t)func_data->rob_chr->chara_index >> 5)], - _bittest(&v9, func_data->rob_chr->chara_index & 0x1F))) + || (v9 = *(int32_t*)&v5[4 * ((uint64_t)(int32_t)func_data->rob_chr->chara_num >> 5)], + _bittest(&v9, func_data->rob_chr->chara_num & 0x1F))) && (v8 != 1 - || (v10 = *(int32_t*)&v5[4 * ((uint64_t)(int32_t)func_data->rob_chr->chara_index >> 5)], - !_bittest(&v10, func_data->rob_chr->chara_index & 0x1F)))) { - v11 = func_data->rob_chr_data; + || (v10 = *(int32_t*)&v5[4 * ((uint64_t)(int32_t)func_data->rob_chr->chara_num >> 5)], + !_bittest(&v10, func_data->rob_chr->chara_num & 0x1F)))) { + v11 = func_data->rob_base; v12 = ((int16_t*)data)[1]; LOWORD(v13) = ((int16_t*)data)[3]; v14 = ((float_t*)data)[2]; @@ -6215,30 +6225,30 @@ static void mothead_func_29(mothead_func_data* func_data, } } v23 = v12; - v11->field_1588.field_330.field_33C[v23].field_0 = *((int16_t*)data + 2); - v11->field_1588.field_330.field_33C[v23].frame = (float_t)mhd_data->frame; - v11->field_1588.field_330.field_33C[v23].field_8 = (float_t)*(__int16*)data; + v11->motdata.field_330.field_33C[v23].field_0 = *((int16_t*)data + 2); + v11->motdata.field_330.field_33C[v23].frame = (float_t)mhd_data->frame; + v11->motdata.field_330.field_33C[v23].field_8 = (float_t)*(__int16*)data; if (((int16_t*)data)[2] != 1) { - v11->field_1588.field_330.field_33C[v23].field_C = v13; + v11->motdata.field_330.field_33C[v23].field_C = v13; v24 = *((int16_t*)data + 10); - v11->field_1588.field_330.field_33C[v23].field_10.x = v14; - v11->field_1588.field_330.field_33C[v23].field_1C.x = v18; - v11->field_1588.field_330.field_33C[v23].field_28.x = v20; - v11->field_1588.field_330.field_33C[v23].field_10.y = v17; - v11->field_1588.field_330.field_33C[v23].field_E = v24; - v11->field_1588.field_330.field_33C[v23].field_1C.y = v19; - v11->field_1588.field_330.field_33C[v23].field_28.y = v21; - v11->field_1588.field_330.field_33C[v23].field_10.z = v15; - v11->field_1588.field_330.field_33C[v23].field_1C.z = v16; - v11->field_1588.field_330.field_33C[v23].field_28.z = v22; + v11->motdata.field_330.field_33C[v23].field_10.x = v14; + v11->motdata.field_330.field_33C[v23].field_1C.x = v18; + v11->motdata.field_330.field_33C[v23].field_28.x = v20; + v11->motdata.field_330.field_33C[v23].field_10.y = v17; + v11->motdata.field_330.field_33C[v23].field_E = v24; + v11->motdata.field_330.field_33C[v23].field_1C.y = v19; + v11->motdata.field_330.field_33C[v23].field_28.y = v21; + v11->motdata.field_330.field_33C[v23].field_10.z = v15; + v11->motdata.field_330.field_33C[v23].field_1C.z = v16; + v11->motdata.field_330.field_33C[v23].field_28.z = v22; } }*/ } static void mothead_func_30(mothead_func_data* func_data, const void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { - func_data->rob_chr_data->miku_rot.field_30.x = 0.0f; - func_data->rob_chr_data->miku_rot.field_30.z = 0.0f; + func_data->rob_base->position.spd.x = 0.0f; + func_data->rob_base->position.spd.z = 0.0f; } static void mothead_func_31(mothead_func_data* func_data, @@ -6262,8 +6272,8 @@ static int32_t sub_140533440(int32_t a1) { static void mothead_func_32(mothead_func_data* func_data, const void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { - rob_chara_data* rob_chr_data = func_data->rob_chr_data; - struc_651& v2 = rob_chr_data->field_1588.field_330; + rob_chara_data* rob_base = func_data->rob_base; + struc_651& v2 = rob_base->motdata.field_330; float_t v8 = (float_t)((int16_t*)data)[0]; int32_t v5 = ((int32_t*)data)[1]; @@ -6274,17 +6284,17 @@ static void mothead_func_32(mothead_func_data* func_data, float_t value = v9; float_t duration = (float_t)v5; v2.arm_adjust_next_value = value; - v2.arm_adjust_prev_value = rob_chr_data->arm_adjust_scale; + v2.arm_adjust_prev_value = rob_base->arm_adjust_scale; v2.arm_adjust_start_frame = mhd_data->frame; v2.arm_adjust_duration = max_def(duration, 0.0f); return; } - if (rob_chr_data->motion.field_28 & 0x08) + if (rob_base->motion.field_28 & 0x08) v5 = sub_140533440(v5); - float_t v7 = rob_chr_data->field_1588.field_0.frame - 1.0f - - rob_chr_data->motion.frame_data.frame; + float_t v7 = rob_base->motdata.field_0.frame - 1.0f + - rob_base->motion.frame_data.frame; if (v7 >= v8) v7 = v8; @@ -6316,8 +6326,8 @@ static void mothead_func_33(mothead_func_data* func_data, const void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { uint32_t* v5 = (uint32_t*)((size_t)data + 16); if (sub_1405333D0(((uint32_t*)((size_t)data + 16))[0]) - && !(v5[(uint64_t)(int32_t)func_data->rob_chr->chara_index >> 5] - & (1 << (func_data->rob_chr->chara_index & 0x1F)))) + && !(v5[(uint64_t)(int32_t)func_data->rob_chr->chara_num >> 5] + & (1 << (func_data->rob_chr->chara_num & 0x1F)))) return; uint32_t* v10 = (uint32_t*)func_data->rob_chr->field_20; @@ -6325,15 +6335,15 @@ static void mothead_func_33(mothead_func_data* func_data, && (((uint32_t*)data + ((uint64_t)v10[4] >> 5))[5] & (1 << (v10[4] & 0x1F))))) return; - struc_223* v8 = &func_data->rob_chr_data->field_1588; + struc_223* v8 = &func_data->rob_base->motdata; v8->field_330.field_310 = (float_t)mhd_data->frame; v8->field_330.field_314 = (float_t)((int16_t*)data)[0]; v8->field_330.field_318 = ((uint8_t*)data)[2]; v8->field_330.field_31C = ((int32_t*)data)[1]; v8->field_330.field_320 = ((float_t*)data)[2]; - v8->field_330.field_324 = func_data->rob_chr_data->motion.field_138; + v8->field_330.field_324 = func_data->rob_base->motion.field_138; v8->field_330.field_328 = ((float_t*)data)[3]; - v8->field_330.field_32C = func_data->rob_chr_data->motion.field_140.y; + v8->field_330.field_32C = func_data->rob_base->motion.field_140.y; } static void mothead_func_34(mothead_func_data* func_data, @@ -6766,12 +6776,12 @@ static void mothead_func_78(mothead_func_data* func_data, 1, 0, 3, 2, 4, 0, 0, 0 }; - rob_chara_data* rob_chr_data = func_data->rob_chr_data; + rob_chara_data* rob_base = func_data->rob_base; uint16_t v5 = ((uint8_t*)data)[2]; - if (rob_chr_data->motion.field_28 & 0x08) + if (rob_base->motion.field_28 & 0x08) v5 = word_140A2D430[v5]; - struc_306* v7 = &rob_chr_data->field_1588.field_330.field_33C[v5]; + struc_306* v7 = &rob_base->motdata.field_330.field_33C[v5]; int32_t v8 = v7->field_38; int32_t v9 = v7->field_3C; int32_t v10 = v7->field_40; @@ -6826,7 +6836,7 @@ static void rob_chara_set_coli_ring(rob_chara* rob_chr, int32_t mhd_id) { 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); + rob_chara_item_equip_set_ring(rob_chr->rob_disp, ring); } static void mothead_func_79_rob_chara_coli_ring(mothead_func_data* func_data, @@ -6836,7 +6846,7 @@ static void mothead_func_79_rob_chara_coli_ring(mothead_func_data* func_data, static void mothead_func_80_adjust_get_global_pos(mothead_func_data* func_data, const void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { - func_data->rob_chr_data->adjust_data.get_global_pos = ((uint8_t*)data)[0]; + func_data->rob_base->adjust_data.get_global_pos = ((uint8_t*)data)[0]; } static void mothead_mot_func_0(mothead_mot_func_data* func_data, @@ -6918,7 +6928,7 @@ static void mothead_mot_func_1(mothead_mot_func_data* func_data, if (((int16_t*)data)[2] >= 0) func_data->field_10->field_0.field_80 = (float_t)((int16_t*)data)[2]; func_data->field_10->field_0.field_20.field_0 |= 0x02; - func_data->rob_chara_data->motion.field_24 = 0; + func_data->rob_base->motion.field_24 = 0; } static void mothead_mot_func_2(mothead_mot_func_data* func_data, @@ -6930,7 +6940,7 @@ static void mothead_mot_func_2(mothead_mot_func_data* func_data, func_data->field_10->field_0.field_1F8 = (float_t)((int16_t*)data)[5]; func_data->field_10->field_0.field_1FC = ((float_t*)data)[3]; func_data->field_10->field_0.field_200 += ((float_t*)data)[4]; - func_data->rob_chara_data->field_8.field_B8.field_10.y = -(get_gravity() * ((float_t*)data)[4]); + func_data->rob_base->action.field_B8.field_10.y = -(get_gravity() * ((float_t*)data)[4]); if (func_data->field_10->field_0.field_1F4 < func_data->field_10->field_0.field_1F0) func_data->field_10->field_0.field_1F4 = func_data->field_10->field_0.field_1F0; @@ -7124,12 +7134,12 @@ static void mothead_mot_func_39(mothead_mot_func_data* func_data, static void mothead_mot_func_40(mothead_mot_func_data* func_data, const void* data, const mothead_mot_data* mhd_mot_data) { func_data->field_10->field_0.field_238 = ((int16_t*)data)[0]; - if (func_data->rob_chara_data->motion.field_28 & 0x08) + if (func_data->rob_base->motion.field_28 & 0x08) func_data->field_10->field_0.field_23C = -((float_t*)data)[1]; else func_data->field_10->field_0.field_23C = ((float_t*)data)[1]; func_data->field_10->field_0.field_240 = ((int32_t*)data)[2]; - func_data->rob_chara_data->field_8.field_B8.field_10.y = -(get_gravity() * ((float_t*)data)[3]); + func_data->rob_base->action.field_B8.field_10.y = -(get_gravity() * ((float_t*)data)[3]); } static void mothead_mot_func_41(mothead_mot_func_data* func_data, @@ -7162,7 +7172,7 @@ static void mothead_mot_func_45(mothead_mot_func_data* func_data, static void mothead_mot_func_46(mothead_mot_func_data* func_data, const void* data, const mothead_mot_data* mhd_mot_data) { if (func_data->field_10->field_0.field_10.field_0 & 0x100) - if (func_data->rob_chara_data->motion.field_28 & 0x08) + if (func_data->rob_base->motion.field_28 & 0x08) func_data->field_10->field_0.field_274 = -((int16_t*)data)[0]; else func_data->field_10->field_0.field_274 = ((int16_t*)data)[0]; @@ -7190,7 +7200,7 @@ static void mothead_mot_func_50(mothead_mot_func_data* func_data, static void mothead_mot_func_51(mothead_mot_func_data* func_data, const void* data, const mothead_mot_data* mhd_mot_data) { - if (func_data->rob_chara_data->motion.field_28 & 0x08) + if (func_data->rob_base->motion.field_28 & 0x08) func_data->field_10->field_0.field_2B8 = -((int16_t*)data)[0]; else func_data->field_10->field_0.field_2B8 = ((int16_t*)data)[0]; @@ -7265,7 +7275,7 @@ static void mothead_mot_func_64(mothead_mot_func_data* func_data, static void mothead_mot_func_65(mothead_mot_func_data* func_data, const void* data, const mothead_mot_data* mhd_mot_data) { - if (func_data->rob_chara_data->motion.field_28 & 0x08) + if (func_data->rob_base->motion.field_28 & 0x08) func_data->field_10->field_0.field_318.x = -((float_t*)data)[0]; else func_data->field_10->field_0.field_318.x = ((float_t*)data)[0]; @@ -7574,7 +7584,7 @@ static void opd_encode_data(const std::vector& src, uint8_t*& dst, size } static PvOsageManager* pv_osage_manager_array_get(int32_t chara_id) { - if (chara_id < 0 || chara_id >= ROB_CHARA_COUNT) + if (chara_id < 0 || chara_id >= ROB_ID_MAX) chara_id = 0; return &pv_osage_manager_array[chara_id]; } @@ -7586,10 +7596,10 @@ static void rob_base_rob_chara_init(rob_chara* rob_chr) { static mat4* sub_140504E80(rob_chara* rob_chr) { mat4 mat; - mat4_rotate_y((float_t)((double_t)rob_chr->data.miku_rot.rot_y_int16 * M_PI * (1.0 / 32768.0)), &mat); - mat4_set_translation(&mat, &rob_chr->data.miku_rot.position); - rob_chr->data.miku_rot.mat = mat; - return &rob_chr->data.miku_rot.mat; + mat4_rotate_y(rob_chr->data.position.yang.get_rad(), &mat); + mat4_set_translation(&mat, &rob_chr->data.position.pos); + rob_chr->data.position.rob_mat = mat; + return &rob_chr->data.position.rob_mat; } static void sub_140414900(struc_308* a1, const mat4* mat) { @@ -7604,7 +7614,7 @@ static void sub_140414900(struc_308* a1, const mat4* mat) { } static void sub_14041DA50(rob_chara_bone_data* rob_bone_data, mat4* mat) { - for (bone_node& i : rob_bone_data->nodes) + for (RobNode& i : rob_bone_data->nodes) mat4_mul(i.mat_ptr, mat, i.mat_ptr); sub_140414900(&rob_bone_data->motion_loaded.front()->field_4F8, mat); @@ -7612,30 +7622,29 @@ static void sub_14041DA50(rob_chara_bone_data* rob_bone_data, mat4* mat) { static void sub_140507F60(rob_chara* rob_chr) { sub_14041DA50(rob_chr->bone_data, sub_140504E80(rob_chr)); - rob_chr->data.miku_rot.n_hara_pos_prev = rob_chr->data.miku_rot.n_hara_pos; + rob_chr->data.position.old_gpos = rob_chr->data.position.gpos; - mat4* n_hara_mat = rob_chr->bone_data->get_mats_mat(ROB_BONE_N_HARA); - mat4_get_translation(n_hara_mat, &rob_chr->data.miku_rot.n_hara_pos); - rob_chr->data.miku_rot.n_hara_pos_diff = rob_chr->data.miku_rot.n_hara_pos - - rob_chr->data.miku_rot.n_hara_pos_prev; + mat4* n_hara_mat = rob_chr->bone_data->get_mats_mat(BONE_ID_N_HARA); + mat4_get_translation(n_hara_mat, &rob_chr->data.position.gpos); + rob_chr->data.position.velocity = rob_chr->data.position.gpos + - rob_chr->data.position.old_gpos; - mat4* n_hara_cp_mat = rob_chr->bone_data->get_mats_mat(ROB_BONE_N_HARA_CP); + mat4* n_hara_cp_mat = rob_chr->bone_data->get_mats_mat(BONE_ID_N_HARA_CP); vec3 v10 = { 0.0f, 0.0f, 1.0f }; mat4_transform_vector(n_hara_cp_mat, &v10, &v10); - rob_chr->data.miku_rot.field_6 = (int32_t)((float_t)(atan2f(v10.x, v10.z) * 32768.0f) * (1.0 / M_PI)); + rob_chr->data.position.hara_yang.set_rad(atan2f(v10.x, v10.z)); } static void sub_140505B20(rob_chara* rob_chr) { - if (rob_chr->data.field_1588.field_0.field_20.field_0 & 0x100) - rob_chr->data.miku_rot.field_2 = rob_chr->data.miku_rot.rot_y_int16 - + rob_chr->data.field_1588.field_0.field_274; + if (rob_chr->data.motdata.field_0.field_20.field_0 & 0x100) + rob_chr->data.position.act_yang = rob_chr->data.position.yang + rob_chr->data.motdata.field_0.field_274; else - rob_chr->data.miku_rot.field_2 = rob_chr->data.miku_rot.rot_y_int16; + rob_chr->data.position.act_yang = rob_chr->data.position.yang; - if (rob_chr->data.field_0 & 2 && rob_chr->data.miku_rot.field_30.y > -0.000001f) - rob_chr->data.field_1 |= 0x80; + if (rob_chr->data.flag.bit.fix_hara && rob_chr->data.position.spd.y > -0.000001f) + rob_chr->data.flag.bit.jump_rise = 1; else - rob_chr->data.field_1 &= ~0x80; + rob_chr->data.flag.bit.jump_rise = 0; } static void rob_base_rob_chara_ctrl(rob_chara* rob_chr) { @@ -7647,20 +7656,20 @@ static void rob_base_rob_chara_ctrl(rob_chara* rob_chr) { } static void sub_140514680(rob_chara* rob_chr) { - rob_chr->data.field_8.field_0 = 0; - rob_chr->data.field_8.field_4 = rob_chr->data.field_8.field_2C; + rob_chr->data.action.field_0 = 0; + rob_chr->data.action.field_4 = rob_chr->data.action.field_2C; } static void sub_140514540(rob_chara* rob_chr) { - rob_chr->data.field_8.field_18 = rob_chr->data.field_8.field_4; - rob_chr->data.field_8.field_40 = rob_chr->data.field_8.field_2C; - if (rob_chr->data.field_8.field_2C.field_0 == 1) + rob_chr->data.action.field_18 = rob_chr->data.action.field_4; + rob_chr->data.action.field_40 = rob_chr->data.action.field_2C; + if (rob_chr->data.action.field_2C.field_0 == 1) sub_140514680(rob_chr); - rob_chr->data.field_8.field_2C.field_0 = 0; + rob_chr->data.action.field_2C.field_0 = 0; } static void sub_1405145F0(rob_chara* rob_chr, const bone_database* bone_data, const motion_database* mot_db) { - if (rob_chr->data.field_8.field_0) + if (rob_chr->data.action.field_0) return; float_t frame; @@ -7668,15 +7677,15 @@ static void sub_1405145F0(rob_chara* rob_chr, const bone_database* bone_data, co frame = 0.0f; else frame = rob_chr->data.motion.frame_data.last_set_frame; - rob_chr->load_motion(rob_chr->data.field_8.field_4.motion_id, - rob_chr->data.field_8.field_4.field_10, frame, MOTION_BLEND, bone_data, mot_db); + rob_chr->load_motion(rob_chr->data.action.field_4.motion_id, + rob_chr->data.action.field_4.field_10, frame, MOTION_BLEND, bone_data, mot_db); rob_chr->bone_data->set_motion_blend_duration(0.0f, 1.0f, 1.0f); - rob_chr->set_motion_reset_data(rob_chr->data.field_8.field_4.motion_id, 0.0f); - rob_chr->data.field_8.field_0 = 1; + rob_chr->set_motion_reset_data(rob_chr->data.action.field_4.motion_id, 0.0f); + rob_chr->data.action.field_0 = 1; } static void sub_1405144C0(rob_chara* rob_chr, const bone_database* bone_data, const motion_database* mot_db) { - if (rob_chr->data.field_8.field_4.field_0 == 1) { + if (rob_chr->data.action.field_4.field_0 == 1) { pv_expression_array_ctrl(rob_chr); sub_1405145F0(rob_chr, bone_data, mot_db); } @@ -7755,8 +7764,8 @@ static bool sub_14054F930(uint32_t a1, uint32_t* a2) { } static const void* sub_140551F60(rob_chara* rob_chr, uint32_t* a2) { - int16_t v2 = rob_chr->data.field_1588.field_0.field_244; - const mothead_mot_data* v3 = rob_chr->data.field_1588.field_0.field_248; + int16_t v2 = rob_chr->data.motdata.field_0.field_244; + const mothead_mot_data* v3 = rob_chr->data.motdata.field_0.field_248; if (!v2) return 0; @@ -8108,31 +8117,31 @@ static float_t sub_1405503B0(rob_chara* rob_chr) { } static void sub_140504F00(rob_chara* rob_chr) { - if (rob_chr->data.field_1588.field_0.field_20.field_0 & 0x08 - && !(rob_chr->data.field_1588.field_0.field_20.field_8 & 0x10000000)) + if (rob_chr->data.motdata.field_0.field_20.field_0 & 0x08 + && !(rob_chr->data.motdata.field_0.field_20.field_8 & 0x10000000)) return; vec3 v9 = 0.0f; sub_140419800(rob_chr->bone_data, &v9); float_t v3 = sub_1405503B0(rob_chr) * rob_chr->data.motion.step_data.frame; float_t v4 = sub_1405501F0(rob_chr) * rob_chr->data.motion.step_data.frame; - v9.x -= v3 * rob_chr->data.field_1588.field_0.field_318.x; - v9.y -= v4 * rob_chr->data.field_1588.field_0.field_318.y; - v9.z -= v3 * rob_chr->data.field_1588.field_0.field_318.z; + v9.x -= v3 * rob_chr->data.motdata.field_0.field_318.x; + v9.y -= v4 * rob_chr->data.motdata.field_0.field_318.y; + v9.z -= v3 * rob_chr->data.motdata.field_0.field_318.z; mat4 mat; - mat4_rotate_y((float_t)((double_t)rob_chr->data.miku_rot.rot_y_int16 * M_PI * (1.0 / 32768.0)), &mat); + mat4_rotate_y(rob_chr->data.position.yang.get_rad(), &mat); mat4_transform_vector(&mat, &v9, &v9); - if (!(rob_chr->data.field_1588.field_0.field_20.field_0 & 0x08)) { - rob_chr->data.field_1588.field_0.field_20.field_0 |= 0x08; - rob_chr->data.miku_rot.position.x = rob_chr->data.miku_rot.n_hara_pos.x - v9.x; - rob_chr->data.miku_rot.position.z = rob_chr->data.miku_rot.n_hara_pos.z - v9.z; + if (!(rob_chr->data.motdata.field_0.field_20.field_0 & 0x08)) { + rob_chr->data.motdata.field_0.field_20.field_0 |= 0x08; + rob_chr->data.position.pos.x = rob_chr->data.position.gpos.x - v9.x; + rob_chr->data.position.pos.z = rob_chr->data.position.gpos.z - v9.z; } - if (rob_chr->data.field_1588.field_0.field_20.field_8 & 0x10000000) { - rob_chr->data.field_1588.field_0.field_20.field_8 &= ~0x10000000; - rob_chr->data.miku_rot.position.y = rob_chr->data.miku_rot.n_hara_pos.y - v9.y; + if (rob_chr->data.motdata.field_0.field_20.field_8 & 0x10000000) { + rob_chr->data.motdata.field_0.field_20.field_8 &= ~0x10000000; + rob_chr->data.position.pos.y = rob_chr->data.position.gpos.y - v9.y; } } @@ -8147,9 +8156,9 @@ static void sub_140504710(rob_chara* rob_chr, const motion_database* mot_db, sub_140555F70(rob_chr, mot_db); sub_14041C9D0(rob_chr->bone_data, !!(rob_chr->data.motion.field_28 & 0x08)); sub_14041D2D0(rob_chr->bone_data, !!(rob_chr->data.motion.field_28 & 0x04)); - sub_14041C680(rob_chr->bone_data, !!(rob_chr->data.field_0 & 0x02)); + sub_14041C680(rob_chr->bone_data, !!rob_chr->data.flag.bit.fix_hara); sub_14041D270(rob_chr->bone_data, - (float_t)((double_t)rob_chr->data.field_1588.field_0.field_274 * M_PI * (1.0 / 32768.0))); + (float_t)((double_t)rob_chr->data.motdata.field_0.field_274 * M_PI * (1.0 / 32768.0))); sub_14041CA70(rob_chr->bone_data, rob_chr->data.motion.field_138); sub_14041CAB0(rob_chr->bone_data, rob_chr->data.motion.field_13C); sub_14041CA10(rob_chr->bone_data, &rob_chr->data.motion.field_140); @@ -8202,8 +8211,8 @@ static void sub_140504710(rob_chara* rob_chr, const motion_database* mot_db, rob_chr->bone_data->set_eyelid_step(eyelid->data.step); object_info v8 = sub_140550330(rob_chr); - if (rob_chara_get_object_info(rob_chr, ITEM_ATAMA) != v8) - rob_chr->load_outfit_object_info(ITEM_ATAMA, + if (rob_chara_get_object_info(rob_chr, RPK_ATAMA) != v8) + rob_chr->load_outfit_object_info(RPK_ATAMA, v8, false, bone_data, data, obj_db); object_info v9 = rob_chara_get_head_object(rob_chr, 1); object_info v10 = rob_chara_get_head_object(rob_chr, 7); @@ -8213,18 +8222,18 @@ static void sub_140504710(rob_chara* rob_chr, const motion_database* mot_db, rob_chr->bone_data->look_anim.disable = v11; object_info v12 = sub_140550350(rob_chr); - if (rob_chara_get_object_info(rob_chr, ITEM_TE_L) != v12) - rob_chr->load_outfit_object_info(ITEM_TE_L, + if (rob_chara_get_object_info(rob_chr, RPK_TE_L) != v12) + rob_chr->load_outfit_object_info(RPK_TE_L, v12, true, bone_data, data, obj_db); object_info v13 = sub_140550380(rob_chr); - if (rob_chara_get_object_info(rob_chr, ITEM_TE_R) != v13) - rob_chr->load_outfit_object_info(ITEM_TE_R, + if (rob_chara_get_object_info(rob_chr, RPK_TE_R) != v13) + rob_chr->load_outfit_object_info(RPK_TE_R, v13, true, bone_data, data, obj_db); object_info v14 = sub_140550310(rob_chr); - if (rob_chara_get_object_info(rob_chr, ITEM_HARA) != v14) - rob_chr->load_outfit_object_info(ITEM_HARA, + if (rob_chara_get_object_info(rob_chr, RPK_HARA) != v14) + rob_chr->load_outfit_object_info(RPK_HARA, v14, false, bone_data, data, obj_db); rob_chr->bone_data->interpolate(); @@ -8235,77 +8244,77 @@ static void sub_140504710(rob_chara* rob_chr, const motion_database* mot_db, } static void sub_140504AC0(rob_chara* rob_chr) { - vec3 v4 = rob_chr->data.miku_rot.field_30; + vec3 v4 = rob_chr->data.position.spd; vec3 v20 = 0.0f; - if (rob_chr->data.field_0 & 0x02) { - v20 = v4 + rob_chr->data.miku_rot.field_3C + rob_chr->data.field_8.field_B8.field_10; - v4.y = rob_chr->data.field_8.field_B8.field_10.y - - get_gravity() * rob_chr->data.field_1588.field_0.field_200; + if (rob_chr->data.flag.bit.fix_hara) { + v20 = v4 + rob_chr->data.position.adjust_spd + rob_chr->data.action.field_B8.field_10; + v4.y = rob_chr->data.action.field_B8.field_10.y + - get_gravity() * rob_chr->data.motdata.field_0.field_200; } - else if (!(rob_chr->data.field_1 & 0x80)) { - v20 = rob_chr->data.miku_rot.field_3C; - v20.x += v4.x + rob_chr->data.field_8.field_B8.field_10.x; - v20.z += v4.z + rob_chr->data.field_8.field_B8.field_10.z; + else if (!rob_chr->data.flag.bit.jump_rise) { + v20 = rob_chr->data.position.adjust_spd; + v20.x += v4.x + rob_chr->data.action.field_B8.field_10.x; + v20.z += v4.z + rob_chr->data.action.field_B8.field_10.z; float_t v7 = 0.4f; - if (rob_chr->data.field_1588.field_0.field_20.field_0 & 0xC00) + if (rob_chr->data.motdata.field_0.field_20.field_0 & 0xC00) v7 = 0.6f; float_t v13 = powf(v7, 1.0f); - if (rob_chr->data.field_1588.field_330.field_18) + if (rob_chr->data.motdata.field_330.field_18) v13 = 1.0f; v4.x *= v13; v4.y = 0.0f; v4.z *= v13; - rob_chr->data.field_8.field_B8.field_10.x *= v13; - rob_chr->data.field_8.field_B8.field_10.z *= v13; + rob_chr->data.action.field_B8.field_10.x *= v13; + rob_chr->data.action.field_B8.field_10.z *= v13; - if (rob_chr->data.field_0 & 0x04 - && rob_chr->data.field_1588.field_0.field_1EC > rob_chr->data.motion.frame_data.frame) { + if (rob_chr->data.flag.bit.ringout + && rob_chr->data.motdata.field_0.field_1EC > rob_chr->data.motion.frame_data.frame) { v20.x += rob_chr->data.field_3DD4; v20.z += rob_chr->data.field_3DDC; } - if (rob_chr->data.field_1588.field_330.field_18 == 3) { + if (rob_chr->data.motdata.field_330.field_18 == 3) { v20 = 0.0f; - if (rob_chr->data.field_1588.field_330.field_1C >= rob_chr->data.motion.frame_data.frame) - v20.y = rob_chr->data.field_1588.field_330.field_20.y; + if (rob_chr->data.motdata.field_330.field_1C >= rob_chr->data.motion.frame_data.frame) + v20.y = rob_chr->data.motdata.field_330.field_20.y; else - rob_chr->data.field_1588.field_330.field_18 = 0; + rob_chr->data.motdata.field_330.field_18 = 0; } - else if (rob_chr->data.field_1588.field_330.field_18) { + else if (rob_chr->data.motdata.field_330.field_18) { v20.x = 0.0f; v20.z = 0.0f; - if (rob_chr->data.motion.frame_data.frame > rob_chr->data.field_1588.field_330.field_1C - || rob_chr->data.field_1E68.field_1C && rob_chr->data.field_1588.field_330.field_18 == 1) - rob_chr->data.field_1588.field_330.field_18 = 0; + if (rob_chr->data.motion.frame_data.frame > rob_chr->data.motdata.field_330.field_1C + || rob_chr->data.field_1E68.field_1C && rob_chr->data.motdata.field_330.field_18 == 1) + rob_chr->data.motdata.field_330.field_18 = 0; else { - float_t v17 = rob_chr->data.field_1588.field_330.field_1C + float_t v17 = rob_chr->data.motdata.field_330.field_1C - rob_chr->data.motion.frame_data.frame; if (v17 < 0.0f) v17 = 0.0f; float_t v18 = 1.0f / (v17 + 1.0f); - v20.x = v18 * (rob_chr->data.field_1588.field_330.field_20.x - - rob_chr->data.miku_rot.n_hara_pos.x); - v20.z = v18 * (rob_chr->data.field_1588.field_330.field_20.z - - rob_chr->data.miku_rot.n_hara_pos.z); + v20.x = v18 * (rob_chr->data.motdata.field_330.field_20.x + - rob_chr->data.position.gpos.x); + v20.z = v18 * (rob_chr->data.motdata.field_330.field_20.z + - rob_chr->data.position.gpos.z); } } } - if (rob_chr->data.field_1588.field_0.field_20.field_4 & 0x4000000 + if (rob_chr->data.motdata.field_0.field_20.field_4 & 0x4000000 && (rob_chr->data.field_3DA0 & 0x40 && rob_chr->data.field_3D9C & 0x20 || rob_chr->data.field_3DA0 & 0x20 && rob_chr->data.field_3D9C & 0x40)) { v4.x = 0.0f; v4.z = 0.0f; } - rob_chr->data.miku_rot.field_30 = v4; - rob_chr->data.miku_rot.field_3C = 0.0f; - rob_chr->data.miku_rot.position = v20 + rob_chr->data.miku_rot.position; + rob_chr->data.position.spd = v4; + rob_chr->data.position.adjust_spd = 0.0f; + rob_chr->data.position.pos = v20 + rob_chr->data.position.pos; } static void rob_base_rob_chara_ctrl_thread_main(rob_chara* rob_chr) { @@ -8334,20 +8343,20 @@ static void rob_disp_rob_chara_init(rob_chara* rob_chr, bone_database* aft_bone_data = &aft_data->data_ft.bone_data; object_database* aft_obj_db = &aft_data->data_ft.obj_db; - rob_chara_item_equip* rob_itm_equip = rob_chr->item_equip; - const chara_init_data* chr_init_data = rob_chr->chara_init_data; - bone_node* v3 = rob_chara_bone_data_get_node(rob_chr->bone_data, MOT_BONE_N_HARA_CP); - rob_itm_equip->reset_init_data(v3); - rob_itm_equip->set_item_equip_range(rob_chr->cos_id == 501); - rob_itm_equip->load_object_info({}, ITEM_BODY, false, bone_data, data, obj_db); - for (int32_t i = ITEM_BODY; i < ITEM_ASI; i++) - rob_itm_equip->load_outfit_object_info((item_id)i, - chr_init_data->field_7E4[i], false, aft_bone_data, aft_data, aft_obj_db); - rob_itm_equip->set_shadow_type(rob_chr->chara_id); - rob_chr->item_equip->field_A0 = 0x05; + rob_chara_item_equip* rob_disp = rob_chr->rob_disp; + const RobData* rob_data = rob_chr->rob_data; + RobNode* v3 = rob_chara_bone_data_get_node(rob_chr->bone_data, BONE_NODE_N_HARA_CP); + rob_disp->reset_init_data(v3); + rob_disp->set_one_skin(rob_chr->cos_id == 501); + rob_disp->set_item({}, RPK_BODY, false, bone_data, data, obj_db); + for (int32_t i = RPK_BASE_BEGIN; i <= RPK_BASE_END; i++) + rob_disp->load_outfit_object_info((ROB_PARTS_KIND)i, + rob_data->body_obj_uid[i], false, aft_bone_data, aft_data, aft_obj_db); + rob_disp->set_shadow_group(rob_chr->chara_id); + rob_chr->rob_disp->shadow_flag = 0x05; rob_chr->item_cos_data.reload_items(rob_chr->chara_id, bone_data, data, obj_db); if (rob_chr->item_cos_data.check_for_npr_flag()) - rob_chr->item_equip->npr_flag = true; + rob_chr->rob_disp->npr_flag = true; if (rob_chr->check_for_ageageagain_module()) { rob_chara_age_age_array_load(rob_chr->chara_id, 1); @@ -8380,53 +8389,29 @@ static void rob_disp_rob_chara_ctrl_thread_main(rob_chara* rob_chr) { if (rob_chr->bone_data->get_frame() > frame_count) rob_chr->bone_data->set_frame(frame_count); - rob_chr->item_equip->set_opd_blend_data(&rob_chr->bone_data->motion_loaded); + rob_chr->rob_disp->set_opd_blend_data(&rob_chr->bone_data->motion_loaded); vec3 pos = 0.0f; rob_chr->get_pos_scale(0, pos); - rob_chr->item_equip->position = pos; - rob_chara_item_equip_ctrl(rob_chr->item_equip); + rob_chr->rob_disp->position = pos; + rob_chara_item_equip_ctrl(rob_chr->rob_disp); if (rob_chr->check_for_ageageagain_module()) { - rob_chara_age_age_array_set_step(rob_chr->chara_id, 1, rob_chr->item_equip->osage_step); + rob_chara_age_age_array_set_step(rob_chr->chara_id, 1, rob_chr->rob_disp->osage_step); rob_chara_age_age_ctrl(rob_chr, 1, "j_tail_l_006_wj"); - rob_chara_age_age_array_set_step(rob_chr->chara_id, 2, rob_chr->item_equip->osage_step); + rob_chara_age_age_array_set_step(rob_chr->chara_id, 2, rob_chr->rob_disp->osage_step); rob_chara_age_age_ctrl(rob_chr, 2, "j_tail_r_006_wj"); } } -extern void bone_data_disp(int32_t chara_id, bone_data* bone, int32_t index, int32_t skeleton_select); - static void rob_disp_rob_chara_disp(rob_chara* rob_chr) { - rob_chara_bone_data* rob_bone_data = rob_chr->bone_data; - motion_blend_mot* mot = rob_bone_data->motion_loaded.front(); - bone_data* bones = mot->bone_data.bones.data(); - bone_data_disp(rob_chr->chara_id, - &bones[MOTION_BONE_N_HARA_CP], MOTION_BONE_N_HARA_CP, mot->mot_key_data.skeleton_type); - bone_data_disp(rob_chr->chara_id, - &bones[MOTION_BONE_CL_MUNE], MOTION_BONE_CL_MUNE, mot->mot_key_data.skeleton_type); - bone_data_disp(rob_chr->chara_id, - &bones[MOTION_BONE_CL_KAO], MOTION_BONE_CL_KAO, mot->mot_key_data.skeleton_type); - bone_data_disp(rob_chr->chara_id, - &bones[MOTION_BONE_TL_UP_KATA_L], MOTION_BONE_TL_UP_KATA_L, mot->mot_key_data.skeleton_type); - bone_data_disp(rob_chr->chara_id, - &bones[MOTION_BONE_C_KATA_L], MOTION_BONE_C_KATA_L, mot->mot_key_data.skeleton_type); - bone_data_disp(rob_chr->chara_id, - &bones[MOTION_BONE_TL_UP_KATA_R], MOTION_BONE_TL_UP_KATA_R, mot->mot_key_data.skeleton_type); - bone_data_disp(rob_chr->chara_id, - &bones[MOTION_BONE_C_KATA_R], MOTION_BONE_C_KATA_R, mot->mot_key_data.skeleton_type); - bone_data_disp(rob_chr->chara_id, - &bones[MOTION_BONE_CL_MOMO_L], MOTION_BONE_CL_MOMO_L, mot->mot_key_data.skeleton_type); - bone_data_disp(rob_chr->chara_id, - &bones[MOTION_BONE_CL_MOMO_R], MOTION_BONE_CL_MOMO_R, mot->mot_key_data.skeleton_type); - - rob_chr->item_equip->texture_color_coefficients = 1.0f; - rob_chr->item_equip->mat = rob_chr->data.adjust_data.mat; - rob_chr->item_equip->disp(rob_chr->chara_id, rctx_ptr); + rob_chr->rob_disp->skin_color = 1.0f; + rob_chr->rob_disp->mat = rob_chr->data.adjust_data.mat; + rob_chr->rob_disp->disp(rob_chr->chara_id, rctx_ptr); } static void rob_disp_rob_chara_free(rob_chara* rob_chr) { rob_chara_age_age_array_reset(rob_chr->chara_id); - rob_chr->item_equip->reset(); + rob_chr->rob_disp->reset(); } static void sub_140409B70(rob_chara_look_anim* look_anim, @@ -8496,18 +8481,18 @@ static float_t sub_14040ADE0(float_t a1, float_t a2) { } static void sub_140407280(rob_chara_look_anim* look_anim, - prj::sys_vector& bones, const mat4& parent_mat, float_t step) { + prj::sys_vector& bones, const mat4& parent_mat, float_t step) { vec3 v69; - mat4_get_translation(bones[MOTION_BONE_CL_KAO].node[2].mat_ptr, &v69); + mat4_get_translation(bones[BLK_CL_KAO].node[2].mat_ptr, &v69); if (!look_anim->field_190 && !look_anim->field_191) return; float_t v14 = step * 0.25f; float_t v15 = look_anim->field_15C.field_8; float_t v16 = look_anim->field_15C.field_C; - mat4* c_kata_r_mat = bones[MOTION_BONE_C_KATA_R].node[0].mat_ptr; - mat4* c_kata_l_mat = bones[MOTION_BONE_C_KATA_L].node[0].mat_ptr; - mat4* n_kao_mat = bones[MOTION_BONE_N_KAO].node[0].mat_ptr; + mat4* c_kata_r_mat = bones[BLK_C_KATA_R].node[0].mat_ptr; + mat4* c_kata_l_mat = bones[BLK_C_KATA_L].node[0].mat_ptr; + mat4* n_kao_mat = bones[BLK_N_KAO].node[0].mat_ptr; float_t v23 = atan2f(n_kao_mat->row0.x, n_kao_mat->row2.x); float_t v24 = atan2f(c_kata_r_mat->row3.x - c_kata_l_mat->row3.x, c_kata_r_mat->row3.z - c_kata_l_mat->row3.z); @@ -8657,7 +8642,7 @@ static void sub_140407280(rob_chara_look_anim* look_anim, v48 = look_anim->field_1AC.field_0; } - mat4 cl_kao_mat = *bones[MOTION_BONE_CL_KAO].node[1].mat_ptr; + mat4 cl_kao_mat = *bones[BLK_CL_KAO].node[1].mat_ptr; float_t head_rot_angle = (v48 - atan2f(-v68.x, v68.y)) * look_anim->head_rot_blend; vec3 head_rot_axis; head_rot_axis.x = n_kao_mat->row2.x * 0.5f; @@ -8705,18 +8690,18 @@ static void sub_140407280(rob_chara_look_anim* look_anim, mat4_mul_rotate_y(&cl_kao_mat, v58 * look_anim->head_rot_blend, &cl_kao_mat); - mat4 cl_kao_mat_backup = bones[MOTION_BONE_CL_KAO].rot_mat[1]; + mat4 cl_kao_mat_backup = bones[BLK_CL_KAO].chain_rot[1]; mat4 v74; - mat4_invert(bones[MOTION_BONE_CL_KAO].node[0].mat_ptr, &v74); + mat4_invert(bones[BLK_CL_KAO].node[0].mat_ptr, &v74); mat4_clear_trans(&v74, &v74); mat4_clear_trans(&cl_kao_mat, &cl_kao_mat); - mat4_mul(&cl_kao_mat, &v74, &bones[MOTION_BONE_CL_KAO].rot_mat[1]); + mat4_mul(&cl_kao_mat, &v74, &bones[BLK_CL_KAO].chain_rot[1]); - for (int32_t i = MOTION_BONE_CL_KAO; i <= MOTION_BONE_N_KUBI_WJ_EX; i++) + for (int32_t i = BLK_CL_KAO; i <= BLK_N_KUBI_WJ_EX; i++) bones[i].mult_mat(parent_mat, bones.data(), true); - bones[MOTION_BONE_CL_KAO].rot_mat[1] = cl_kao_mat_backup; + bones[BLK_CL_KAO].chain_rot[1] = cl_kao_mat_backup; } static void sub_1404189A0(rob_chara_bone_data* rob_bone_data) { @@ -8725,7 +8710,7 @@ static void sub_1404189A0(rob_chara_bone_data* rob_bone_data) { mot->field_4F8.mat, mot->mot_play_data.frame_data.step); } -static void sub_140406FC0(rob_chara_look_anim* look_anim, bone_data* bone, mat4* eye_mat, vec3 pos, +static void sub_140406FC0(rob_chara_look_anim* look_anim, RobBlock* bone, mat4* eye_mat, vec3 pos, const vec3& rot_neg, const vec3& rot_pos, bool eyes_rot_anim, float_t eyes_rot_blend, float_t eyes_rot_step) { pos.z = fabsf(pos.z); @@ -8766,15 +8751,15 @@ static void sub_140406FC0(rob_chara_look_anim* look_anim, bone_data* bone, mat4* mat4_mul_rotate_x(&mat, rot_x, &mat); mat4_lerp_rotation(&mat4_identity, &mat, &mat, look_anim->eyes_rot_strength); if (eyes_rot_anim) - mat4_lerp_rotation(&bone->rot_mat[0], &mat, &mat, eyes_rot_blend); + mat4_lerp_rotation(&bone->chain_rot[0], &mat, &mat, eyes_rot_blend); else mat4_lerp_rotation(eye_mat, &mat, &mat, eyes_rot_step); *eye_mat = mat; - bone->rot_mat[0] = mat; + bone->chain_rot[0] = mat; } static void sub_140409170(rob_chara_look_anim* look_anim, const mat4& adjust_mat, - prj::sys_vector& bones, const mat4& mat, float_t step) { + prj::sys_vector& bones, const mat4& mat, float_t step) { if (look_anim->disable) return; @@ -8810,8 +8795,8 @@ static void sub_140409170(rob_chara_look_anim* look_anim, const mat4& adjust_mat mat4_invert(&adjust_mat, &v61); mat4_transform_point(&v61, &look_anim->view_point, &look_anim->view_point); - mat4* kl_eye_l_parent_mat = bones[MOTION_BONE_KL_EYE_L].parent_mat; - mat4* kl_eye_r_parent_mat = bones[MOTION_BONE_KL_EYE_R].parent_mat; + const mat4* kl_eye_l_parent_mat = bones[BLK_KL_EYE_L].inherit_mat_ptr; + const mat4* kl_eye_r_parent_mat = bones[BLK_KL_EYE_R].inherit_mat_ptr; float_t yrot_neg_left; float_t yrot_pos_left; @@ -8880,7 +8865,7 @@ static void sub_140409170(rob_chara_look_anim* look_anim, const mat4& adjust_mat vec3 rot_pos_left = vec3(xrot_pos, yrot_pos_left, 0.0f); vec3 pos_left; mat4_inverse_transform_point(kl_eye_l_parent_mat, &look_anim->view_point, &pos_left); - sub_140406FC0(look_anim, &bones[MOTION_BONE_KL_EYE_L], + sub_140406FC0(look_anim, &bones[BLK_KL_EYE_L], &look_anim->left_eye_mat, pos_left - look_anim->param.pos, rot_neg_left, rot_pos_left, eyes_rot_anim, eyes_rot_blend, eyes_rot_step); @@ -8889,14 +8874,14 @@ static void sub_140409170(rob_chara_look_anim* look_anim, const mat4& adjust_mat vec3 rot_pos_right = vec3(xrot_pos, yrot_pos_right, 0.0f); vec3 pos_right; mat4_inverse_transform_point(kl_eye_r_parent_mat, &look_anim->view_point, &pos_right); - sub_140406FC0(look_anim, &bones[MOTION_BONE_KL_EYE_R], + sub_140406FC0(look_anim, &bones[BLK_KL_EYE_R], &look_anim->right_eye_mat, pos_right - (look_anim->param.pos ^ _xor), rot_neg_right, rot_pos_right, eyes_rot_anim, eyes_rot_blend, eyes_rot_step); - for (int32_t i = MOTION_BONE_KL_EYE_L; i <= MOTION_BONE_KL_HIGHLIGHT_L_WJ; i++) + for (int32_t i = BLK_KL_EYE_L; i <= BLK_KL_HIGHLIGHT_L_WJ; i++) bones[i].mult_mat(mat, bones.data(), true); - for (int32_t i = MOTION_BONE_KL_EYE_R; i <= MOTION_BONE_KL_HIGHLIGHT_R_WJ; i++) + for (int32_t i = BLK_KL_EYE_R; i <= BLK_KL_HIGHLIGHT_R_WJ; i++) bones[i].mult_mat(mat, bones.data(), true); } @@ -8910,8 +8895,8 @@ static void rob_chara_head_adjust(rob_chara* rob_chr) { if (rob_chr->type != ROB_CHARA_TYPE_2) return; - bool v4 = !(rob_chr->data.field_2 & 0x80); - rob_chr->data.field_2 &= ~0x80; + bool v4 = !rob_chr->data.flag.bit.dmy_yokerare; + rob_chr->data.flag.bit.dmy_yokerare = 0; rob_chara_bone_data* rob_bone_data = rob_chr->bone_data; vec3* target_view_point = 0; @@ -9037,16 +9022,16 @@ static void sub_14040AE10(mat4* mat, const vec3& target) { } } -static void sub_140406A70(struc_936* a1, prj::sys_vector& bones, const mat4& mat, const vec3& target, - const motion_bone_index* a5, float_t rotation_blend, float_t arm_length, bool solve_ik) { - bone_data* v14 = &bones[a5[0]]; +static void sub_140406A70(struc_936* a1, prj::sys_vector& bones, const mat4& mat, const vec3& target, + const BONE_BLK* a5, float_t rotation_blend, float_t arm_length, bool solve_ik) { + RobBlock* v14 = &bones[a5[0]]; - if (v14->pole_target_mat) { + if (v14->up_vector_mat_ptr) { vec3 v36; - mat4_get_translation(v14->pole_target_mat, &v36); + mat4_get_translation(v14->up_vector_mat_ptr, &v36); mat4 v38 = *v14->node->mat_ptr; - sub_14040AE10(&v38, v14->ik_target); + sub_14040AE10(&v38, v14->leaf_pos[1]); mat4_inverse_transform_point(&v38, &v36, &v36); v38 = *v14->node->mat_ptr; @@ -9054,33 +9039,33 @@ static void sub_140406A70(struc_936* a1, prj::sys_vector& bones, cons vec3 v37; mat4_transform_point(&v38, &v36, &v37); - mat4_set_translation(v14->pole_target_mat, &v37); + mat4_set_translation((mat4*)v14->up_vector_mat_ptr, &v37); } - v14->ik_target = target; - v14->rot_mat[1] = mat4_identity; - v14->rot_mat[2] = mat4_identity; + v14->leaf_pos[1] = target; + v14->chain_rot[1] = mat4_identity; + v14->chain_rot[2] = mat4_identity; v14->get_mat_ik(1); - if (a5[1] == MOTION_BONE_NONE) + if (a5[1] == BLK_DUMMY) return; - bone_data* v25 = &bones[a5[1]]; + RobBlock* v25 = &bones[a5[1]]; if (rotation_blend > 0.0f) { mat4 v38; mat4 v39; - mat4_clear_trans(v25->parent_mat, &v38); + mat4_clear_trans(v25->inherit_mat_ptr, &v38); mat4_clear_trans(v25->node->mat_ptr, &v39); mat4_transpose(&v38, &v38); mat4_mul(&v39, &v38, &v38); if (rotation_blend < 1.0f) - mat4_lerp_rotation(&v25->rot_mat[0], &v38, &v38, rotation_blend); - v25->rot_mat[0] = v38; + mat4_lerp_rotation(&v25->chain_rot[0], &v38, &v38, rotation_blend); + v25->chain_rot[0] = v38; } if (solve_ik) { a5++; - while (*a5 != MOTION_BONE_NONE) + while (*a5 != BLK_DUMMY) bones[*a5++].mult_mat(mat, bones.data(), true); } else @@ -9088,7 +9073,7 @@ static void sub_140406A70(struc_936* a1, prj::sys_vector& bones, cons } static void sub_140418A00(rob_chara_bone_data* rob_bone_data, const vec3& target, - const motion_bone_index* a3, float_t rotation_blend, float_t arm_length, bool solve_ik) { + const BONE_BLK* a3, float_t rotation_blend, float_t arm_length, bool solve_ik) { motion_blend_mot* mot = rob_bone_data->motion_loaded.front(); mat4 m = mot->field_4F8.mat; sub_140406A70(&rob_bone_data->field_76C, mot->bone_data.bones, @@ -9167,26 +9152,26 @@ static bool sub_14053ACA0(rob_chara* rob_chr, int32_t hand) { return true; } -static void sub_140412860(motion_blend_mot* mot, motion_bone_index index, mat4* mat) { +static void sub_140412860(motion_blend_mot* mot, BONE_BLK index, mat4* mat) { if (index >= mot->bone_data.bones.size()) return; - bone_data* v4 = &mot->bone_data.bones.data()[index]; + RobBlock* v4 = &mot->bone_data.bones.data()[index]; if (!v4) return; - switch (v4->type) { - case BONE_DATABASE_BONE_HEAD_IK_ROTATION: + switch (v4->ik_type) { + case IKT_1: *mat = *v4->node[2].mat_ptr; break; - case BONE_DATABASE_BONE_ARM_IK_ROTATION: - case BONE_DATABASE_BONE_LEGS_IK_ROTATION: + case IKT_2: + case IKT_2R: *mat = *v4->node[3].mat_ptr; break; } } -static void sub_140419290(rob_chara_bone_data* rob_bone_data, motion_bone_index index, mat4* mat) { +static void sub_140419290(rob_chara_bone_data* rob_bone_data, BONE_BLK index, mat4* mat) { sub_140412860(rob_bone_data->motion_loaded.front(), index, mat); } @@ -9194,7 +9179,7 @@ static bool sub_14053B580(rob_chara* rob_chr, int32_t a2) { if (a2 < 0 || a2 > 3) return 0; - struc_306& v0 = rob_chr->data.field_1588.field_330.field_33C[a2]; + struc_306& v0 = rob_chr->data.motdata.field_330.field_33C[a2]; int16_t v7 = v0.field_C; if (v7 <= 0 || v7 >= 27 || !(v7 < 10 || rob_chr->field_20)) return false; @@ -9503,8 +9488,8 @@ LABEL_66: } static void sub_1403FA770(rob_chara_sleeve_adjust* a1) { - mat4* v4 = a1->bones->data()[MOTION_BONE_C_KATA_L].node[3].mat_ptr; - mat4* v5 = a1->bones->data()[MOTION_BONE_C_KATA_R].node[3].mat_ptr; + mat4* v4 = a1->bones->data()[BLK_C_KATA_L].node[3].mat_ptr; + mat4* v5 = a1->bones->data()[BLK_C_KATA_R].node[3].mat_ptr; vec3 v42; mat4_get_translation(v4, &v42); @@ -9566,19 +9551,19 @@ static void sub_1403FA770(rob_chara_sleeve_adjust* a1) { a1->sleeve_r.zmin, a1->sleeve_r.zmax, &a1->field_68, a1->step); if (v16 || v17) { - mat4 mat = *a1->bones->data()[MOTION_BONE_C_KATA_L].node[2].mat_ptr; + mat4 mat = *a1->bones->data()[BLK_C_KATA_L].node[2].mat_ptr; sub_14040AE10(&mat, v42 + v45); - *a1->bones->data()[MOTION_BONE_C_KATA_L].node[2].mat_ptr = mat; + *a1->bones->data()[BLK_C_KATA_L].node[2].mat_ptr = mat; } if (v19 || v18) { - mat4 mat = *a1->bones->data()[MOTION_BONE_C_KATA_R].node[2].mat_ptr; + mat4 mat = *a1->bones->data()[BLK_C_KATA_R].node[2].mat_ptr; sub_14040AE10(&mat, v43 + v44); - *a1->bones->data()[MOTION_BONE_C_KATA_R].node[2].mat_ptr = mat; + *a1->bones->data()[BLK_C_KATA_R].node[2].mat_ptr = mat; } } -static void sub_1403F9B20(rob_chara_sleeve_adjust* a1, motion_bone_index motion_bone_index) { +static void sub_1403F9B20(rob_chara_sleeve_adjust* a1, BONE_BLK block_id) { float_t sleeve_radius; float_t sleeve_cyofs; float_t sleeve_czofs; @@ -9589,7 +9574,7 @@ static void sub_1403F9B20(rob_chara_sleeve_adjust* a1, motion_bone_index motion_ float_t sleeve_zmax; vec3 sleeve_mune_ofs; float_t sleeve_mune_rad; - if (motion_bone_index == MOTION_BONE_C_KATA_L) { + if (block_id == BLK_C_KATA_L) { sleeve_radius = a1->sleeve_l.radius; sleeve_cyofs = a1->sleeve_l.cyofs; sleeve_czofs = a1->sleeve_l.czofs; @@ -9603,7 +9588,7 @@ static void sub_1403F9B20(rob_chara_sleeve_adjust* a1, motion_bone_index motion_ sleeve_mune_rad = a1->sleeve_l.mune_rad; v6 = &a1->field_74; } - else if (motion_bone_index == MOTION_BONE_C_KATA_R) { + else if (block_id == BLK_C_KATA_R) { sleeve_radius = a1->sleeve_r.radius; sleeve_cyofs = a1->sleeve_r.cyofs; sleeve_czofs = a1->sleeve_r.czofs; @@ -9620,9 +9605,9 @@ static void sub_1403F9B20(rob_chara_sleeve_adjust* a1, motion_bone_index motion_ else return; - bone_data* v15 = a1->bones->data(); - bone_node* v18 = v15[motion_bone_index].node; - mat4* v19 = v18[MOTION_BONE_KL_HARA_ETC].mat_ptr; + RobBlock* v15 = a1->bones->data(); + RobNode* v18 = v15[block_id].node; + mat4* v19 = v18[BLK_KL_HARA_ETC].mat_ptr; vec3 v39; mat4_get_translation(v19, &v39); @@ -9631,7 +9616,7 @@ static void sub_1403F9B20(rob_chara_sleeve_adjust* a1, motion_bone_index motion_ sub_1403F9A40(&v37, &v39, v19, sleeve_cyofs, sleeve_czofs); vec3 v40; - mat4* v23 = v15[MOTION_BONE_KL_MUNE_B_WJ].node->mat_ptr; + mat4* v23 = v15[BLK_KL_MUNE_B_WJ].node->mat_ptr; mat4_transform_point(v23, &sleeve_mune_ofs, &v40); vec3 v41 = v37 - v40; @@ -9650,19 +9635,19 @@ static void sub_1403F9B20(rob_chara_sleeve_adjust* a1, motion_bone_index motion_ mat4_transform_vector(v19, v6, &v41); } - mat4* v42 = v15[motion_bone_index].node[2].mat_ptr; + mat4* v42 = v15[block_id].node[2].mat_ptr; sub_14040AE10(v42, v39 + v41); } -static void sub_1403FAF30(rob_chara_sleeve_adjust* a1, prj::sys_vector& bones, float_t step) { +static void sub_1403FAF30(rob_chara_sleeve_adjust* a1, prj::sys_vector& bones, float_t step) { a1->step = step; a1->bones = &bones; if (a1->enable1) sub_1403FA770(a1); if (a1->enable2) { - sub_1403F9B20(a1, MOTION_BONE_C_KATA_L); - sub_1403F9B20(a1, MOTION_BONE_C_KATA_R); + sub_1403F9B20(a1, BLK_C_KATA_L); + sub_1403F9B20(a1, BLK_C_KATA_R); } } @@ -9682,7 +9667,7 @@ static bool rob_chara_hands_adjust(rob_chara* rob_chr) { return v2; } -static float_t sub_140406E90(bone_data* a1, bone_data* a2, float_t a3, vec3* a4) { +static float_t sub_140406E90(RobBlock* a1, RobBlock* a2, float_t a3, vec3* a4) { vec3 v18 = 0.0f; mat4_transform_point(a1->node[3].mat_ptr, &v18, &v18); *a4 = v18; @@ -9698,7 +9683,7 @@ static float_t sub_140406E90(bone_data* a1, bone_data* a2, float_t a3, vec3* a4) return v17.y; } -static void sub_140406920(struc_936* a1, bone_data* a2, bone_data* a3, float_t heel_height, vec3* a5, float_t step) { +static void sub_140406920(struc_936* a1, RobBlock* a2, RobBlock* 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 = task_stage_current_get_floor_height(v18, heel_height); @@ -9721,47 +9706,46 @@ static void sub_140406920(struc_936* a1, bone_data* a2, bone_data* a3, float_t h if (v12 < 0.0f) v12 = 0.0f; - a2->ik_target.x = v18.x; - a2->ik_target.y = v18.y + lerp_def(v12, v11, a5->z); - a2->ik_target.z = v18.z; + a2->leaf_pos[1].x = v18.x; + a2->leaf_pos[1].y = v18.y + lerp_def(v12, v11, a5->z); + a2->leaf_pos[1].z = v18.z; } -static void sub_1404065B0(struc_936* a1, prj::sys_vector* a2, const mat4& mat, float_t a4, - bone_database_skeleton_type skeleton_type, const motion_bone_index* a6, const motion_bone_index* a7) { +static void sub_1404065B0(struc_936* a1, prj::sys_vector* a2, const mat4& mat, float_t a4, + BONE_KIND skeleton_type, const BONE_BLK* a6, const BONE_BLK* a7) { data_struct* aft_data = &data_list[DATA_AFT]; bone_database* aft_bone_data = &aft_data->data_ft.bone_data; - const char* name = bone_database_skeleton_type_to_string(skeleton_type); - const float_t* heel_height = aft_bone_data->get_skeleton_heel_height(name); + const float_t* heel_height = aft_bone_data->get_heel_height(skeleton_type); if (!heel_height) return; - 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); + sub_140406920(a1, &a2->data()[a6[0]], &a2->data()[BLK_KL_TOE_L_WJ], *heel_height, &a1->toe_l, a4); + sub_140406920(a1, &a2->data()[a7[0]], &a2->data()[BLK_KL_TOE_R_WJ], *heel_height, &a1->toe_r, a4); - ::bone_data* v7 = a2->data(); - ::bone_data* v17 = &v7[a6[0]]; - v17->rot_mat[1] = mat4_identity; - v17->rot_mat[2] = mat4_identity; + RobBlock* v7 = a2->data(); + RobBlock* v17 = &v7[a6[0]]; + v17->chain_rot[1] = mat4_identity; + v17->chain_rot[2] = mat4_identity; v17->get_mat_ik(1); - ::bone_data* v20 = &v7[a7[0]]; - v20->rot_mat[1] = mat4_identity; - v20->rot_mat[2] = mat4_identity; + RobBlock* v20 = &v7[a7[0]]; + v20->chain_rot[1] = mat4_identity; + v20->chain_rot[2] = mat4_identity; v20->get_mat_ik(1); - motion_bone_index v21 = a6[1]; + BONE_BLK v21 = a6[1]; a6++; - while (*a6 != MOTION_BONE_NONE) + while (*a6 != BLK_DUMMY) v7[*a6++].mult_mat(mat, v7, true); a7++; - while (*a7 != MOTION_BONE_NONE) + while (*a7 != BLK_DUMMY) v7[*a7++].mult_mat(mat, v7, true); } -static void sub_140418810(rob_chara_bone_data* rob_bone_data, const motion_bone_index* a6, const motion_bone_index* a7) { +static void sub_140418810(rob_chara_bone_data* rob_bone_data, const BONE_BLK* a6, const BONE_BLK* 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, @@ -9769,7 +9753,7 @@ static void sub_140418810(rob_chara_bone_data* rob_bone_data, const motion_bone_ } static void sub_14053B260(rob_chara* rob_chr) { - if (rob_chr->data.field_1588.field_0.field_20.field_C & 0x10000000) + if (rob_chr->data.motdata.field_0.field_20.field_C & 0x10000000) sub_140418810(rob_chr->bone_data, dword_140A2DDB0, dword_140A2DD90); } @@ -9880,7 +9864,7 @@ static void rob_chara_age_age_set_step_full(rob_chara_age_age* arr, } static void rob_chara_bone_data_calculate_bones(rob_chara_bone_data* rob_bone_data, - const std::vector* bones) { + const std::vector* bones) { bone_database_bones_calculate_count(bones, rob_bone_data->object_bone_count, rob_bone_data->motion_bone_count, rob_bone_data->node_count, rob_bone_data->leaf_pos, rob_bone_data->chain_pos); @@ -9901,83 +9885,79 @@ static void rob_chara_bone_data_get_ik_scale( } static mat4* rob_chara_bone_data_get_mat(rob_chara_bone_data* rob_bone_data, size_t index) { - bone_node* node = rob_chara_bone_data_get_node(rob_bone_data, index); + RobNode* node = rob_chara_bone_data_get_node(rob_bone_data, index); if (node) return node->mat_ptr; return 0; } -static bone_node* rob_chara_bone_data_get_node(rob_chara_bone_data* rob_bone_data, size_t index) { +static RobNode* rob_chara_bone_data_get_node(rob_chara_bone_data* rob_bone_data, size_t index) { if (index < rob_bone_data->nodes.size()) return &rob_bone_data->nodes[index]; return 0; } static void rob_chara_bone_data_ik_scale_calculate( - rob_chara_bone_data_ik_scale* ik_scale, prj::sys_vector& bones, - bone_database_skeleton_type base_skeleton_type, - bone_database_skeleton_type skeleton_type, const bone_database* bone_data) { - const char* base_name = bone_database_skeleton_type_to_string(base_skeleton_type); - const char* name = bone_database_skeleton_type_to_string(skeleton_type); - const float_t* base_heel_height = bone_data->get_skeleton_heel_height(base_name); - const float_t* heel_height = bone_data->get_skeleton_heel_height(name); + rob_chara_bone_data_ik_scale* ik_scale, prj::sys_vector& bones, + BONE_KIND base_skeleton_type, BONE_KIND skeleton_type, const bone_database* bone_data) { + const float_t* base_heel_height = bone_data->get_heel_height(base_skeleton_type); + const float_t* heel_height = bone_data->get_heel_height(skeleton_type); if (!base_heel_height || !heel_height) return; - ::bone_data* b_cl_mune = &bones[MOTION_BONE_CL_MUNE]; - ::bone_data* b_kl_kubi = &bones[MOTION_BONE_KL_KUBI]; - ::bone_data* b_c_kata_l = &bones[MOTION_BONE_C_KATA_L]; - ::bone_data* b_cl_momo_l = &bones[MOTION_BONE_CL_MOMO_L]; + RobBlock* b_cl_mune = &bones[BLK_CL_MUNE]; + RobBlock* b_kl_kubi = &bones[BLK_KL_KUBI]; + RobBlock* b_c_kata_l = &bones[BLK_C_KATA_L]; + RobBlock* b_cl_momo_l = &bones[BLK_CL_MOMO_L]; - float_t base_height = fabsf(b_cl_momo_l->local_position[0].y) + b_cl_momo_l->ik_segment_length[0] - + b_cl_momo_l->ik_2nd_segment_length[0] + *base_heel_height; - float_t height = fabsf(b_cl_momo_l->local_position[1].y) + b_cl_momo_l->ik_segment_length[1] - + b_cl_momo_l->ik_2nd_segment_length[1] + *heel_height; + float_t base_height = fabsf(b_cl_momo_l->chain_pos[0].y) + b_cl_momo_l->len[0][0] + + b_cl_momo_l->len[1][0] + *base_heel_height; + float_t height = fabsf(b_cl_momo_l->chain_pos[1].y) + b_cl_momo_l->len[0][1] + + b_cl_momo_l->len[1][1] + *heel_height; ik_scale->ratio0 = height / base_height; - ik_scale->ratio1 = (fabsf(b_kl_kubi->local_position[1].y) + b_cl_mune->ik_segment_length[1]) - / (fabsf(b_kl_kubi->local_position[0].y) + b_cl_mune->ik_segment_length[0]); - ik_scale->ratio2 = (b_c_kata_l->ik_segment_length[1] + b_c_kata_l->ik_2nd_segment_length[1]) - / (b_c_kata_l->ik_segment_length[0] + b_c_kata_l->ik_2nd_segment_length[0]); - ik_scale->ratio3 = (fabsf(b_kl_kubi->local_position[1].y) + b_cl_mune->ik_segment_length[1] + height) - / (fabsf(b_kl_kubi->local_position[0].y) + b_cl_mune->ik_segment_length[0] + base_height); + ik_scale->ratio1 = (fabsf(b_kl_kubi->chain_pos[1].y) + b_cl_mune->len[0][1]) + / (fabsf(b_kl_kubi->chain_pos[0].y) + b_cl_mune->len[0][0]); + ik_scale->ratio2 = (b_c_kata_l->len[0][1] + b_c_kata_l->len[1][1]) + / (b_c_kata_l->len[0][0] + b_c_kata_l->len[1][0]); + ik_scale->ratio3 = (fabsf(b_kl_kubi->chain_pos[1].y) + b_cl_mune->len[0][1] + height) + / (fabsf(b_kl_kubi->chain_pos[0].y) + b_cl_mune->len[0][0] + base_height); } -static bool motion_blend_mot_check(motion_bone_index bone_index) { +static bool motion_blend_mot_check(BONE_BLK bone_index) { return true; } -static bool partial_motion_blend_mot_face_check(motion_bone_index bone_index) { - return bone_index >= MOTION_BONE_FACE_ROOT && bone_index <= MOTION_BONE_TL_TOOTH_UPPER_WJ; +static bool partial_motion_blend_mot_face_check(BONE_BLK bone_index) { + return bone_index >= BLK_FACE_ROOT && bone_index <= BLK_TL_TOOTH_UPPER_WJ; } -static bool partial_motion_blend_mot_hand_l_check(motion_bone_index bone_index) { - return bone_index >= MOTION_BONE_N_HITO_L_EX && bone_index <= MOTION_BONE_NL_OYA_C_L_WJ; +static bool partial_motion_blend_mot_hand_l_check(BONE_BLK bone_index) { + return bone_index >= BLK_N_HITO_L_EX && bone_index <= BLK_NL_OYA_C_L_WJ; } -static bool partial_motion_blend_mot_hand_r_check(motion_bone_index bone_index) { - return bone_index >= MOTION_BONE_N_HITO_R_EX && bone_index <= MOTION_BONE_NL_OYA_C_R_WJ; +static bool partial_motion_blend_mot_hand_r_check(BONE_BLK bone_index) { + return bone_index >= BLK_N_HITO_R_EX && bone_index <= BLK_NL_OYA_C_R_WJ; } -static bool partial_motion_blend_mot_mouth_check(motion_bone_index bone_index) { - return bone_index >= MOTION_BONE_N_AGO && bone_index <= MOTION_BONE_TL_TOOTH_UNDER_WJ - || bone_index >= MOTION_BONE_N_KUTI_D && bone_index <= MOTION_BONE_TL_KUTI_U_R_WJ - || bone_index >= MOTION_BONE_N_TOOTH_UPPER && bone_index <= MOTION_BONE_TL_TOOTH_UPPER_WJ; +static bool partial_motion_blend_mot_mouth_check(BONE_BLK bone_index) { + return bone_index >= BLK_N_AGO && bone_index <= BLK_TL_TOOTH_UNDER_WJ + || bone_index >= BLK_N_KUTI_D && bone_index <= BLK_TL_KUTI_U_R_WJ + || bone_index >= BLK_N_TOOTH_UPPER && bone_index <= BLK_TL_TOOTH_UPPER_WJ; } -static bool partial_motion_blend_mot_eyes_check(motion_bone_index bone_index) { - return bone_index >= MOTION_BONE_N_EYE_L && bone_index <= MOTION_BONE_KL_HIGHLIGHT_R_WJ; +static bool partial_motion_blend_mot_eyes_check(BONE_BLK bone_index) { + return bone_index >= BLK_N_EYE_L && bone_index <= BLK_KL_HIGHLIGHT_R_WJ; } -static bool partial_motion_blend_mot_eyelid_check(motion_bone_index bone_index) { - if (bone_index >= MOTION_BONE_N_MABU_L_D_A && bone_index <= MOTION_BONE_TL_MABU_R_U_C_WJ - || bone_index >= MOTION_BONE_N_EYELID_L_A && bone_index <= MOTION_BONE_TL_EYELID_R_B_WJ) +static bool partial_motion_blend_mot_eyelid_check(BONE_BLK bone_index) { + if (bone_index >= BLK_N_MABU_L_D_A && bone_index <= BLK_TL_MABU_R_U_C_WJ + || bone_index >= BLK_N_EYELID_L_A && bone_index <= BLK_TL_EYELID_R_B_WJ) return true; return partial_motion_blend_mot_eyes_check(bone_index); } static void rob_chara_bone_data_init_data(rob_chara_bone_data* rob_bone_data, - bone_database_skeleton_type base_type, - bone_database_skeleton_type type, const bone_database* bone_data) { + BONE_KIND base_type, BONE_KIND type, const bone_database* bone_data) { rob_chara_bone_data_init_skeleton(rob_bone_data, base_type, type, bone_data); for (motion_blend_mot*& i : rob_bone_data->motions) i->init(rob_bone_data, motion_blend_mot_check, bone_data); @@ -9992,16 +9972,15 @@ static void rob_chara_bone_data_init_data(rob_chara_bone_data* rob_bone_data, } static void rob_chara_bone_data_init_skeleton(rob_chara_bone_data* rob_bone_data, - bone_database_skeleton_type base_skeleton_type, - bone_database_skeleton_type skeleton_type, const bone_database* bone_data) { + BONE_KIND base_skeleton_type, BONE_KIND skeleton_type, const bone_database* bone_data) { if (rob_bone_data->base_skeleton_type == base_skeleton_type && rob_bone_data->skeleton_type == skeleton_type) return; const char* name = bone_database_skeleton_type_to_string(base_skeleton_type); - const std::vector* bones = bone_data->get_skeleton_bones(name); - const std::vector* parent_indices = bone_data->get_skeleton_parent_indices(name); - const std::vector* motion_bones = bone_data->get_skeleton_motion_bones(name); + const std::vector* bones = bone_data->get_body_type(name); + const std::vector* parent_indices = bone_data->get_parent_node(name); + const std::vector* motion_bones = bone_data->get_bone_node_name(name); if (!bones || !parent_indices || !motion_bones) return; @@ -10014,59 +9993,59 @@ static void rob_chara_bone_data_init_skeleton(rob_chara_bone_data* rob_bone_data } static void sub_14041B4E0(prj::sys_vector& vec) { - for (uint32_t i = MOTION_BONE_FACE_ROOT; i <= MOTION_BONE_TL_TOOTH_UPPER_WJ; i++) + for (uint32_t i = BLK_FACE_ROOT; i <= BLK_TL_TOOTH_UPPER_WJ; i++) vec[i] = false; } static void sub_14041B580(prj::sys_vector& vec) { - for (uint32_t i = MOTION_BONE_FACE_ROOT; i <= MOTION_BONE_TL_TOOTH_UPPER_WJ; i++) + for (uint32_t i = BLK_FACE_ROOT; i <= BLK_TL_TOOTH_UPPER_WJ; i++) vec[i] = false; - for (uint32_t i = MOTION_BONE_N_EYE_L; i <= MOTION_BONE_KL_HIGHLIGHT_R_WJ; i++) + for (uint32_t i = BLK_N_EYE_L; i <= BLK_KL_HIGHLIGHT_R_WJ; i++) vec[i] = true; } static void sub_14041B800(prj::sys_vector& vec) { - for (uint32_t i = MOTION_BONE_N_KUTI_D; i <= MOTION_BONE_TL_KUTI_U_R_WJ; i++) + for (uint32_t i = BLK_N_KUTI_D; i <= BLK_TL_KUTI_U_R_WJ; i++) vec[i] = false; - for (uint32_t i = MOTION_BONE_N_AGO; i <= MOTION_BONE_TL_TOOTH_UNDER_WJ; i++) + for (uint32_t i = BLK_N_AGO; i <= BLK_TL_TOOTH_UNDER_WJ; i++) vec[i] = false; - for (uint32_t i = MOTION_BONE_N_TOOTH_UPPER; i <= MOTION_BONE_TL_TOOTH_UPPER_WJ; i++) + for (uint32_t i = BLK_N_TOOTH_UPPER; i <= BLK_TL_TOOTH_UPPER_WJ; i++) vec[i] = false; } static void sub_14041B440(prj::sys_vector& vec) { - for (uint32_t i = MOTION_BONE_N_EYE_L; i <= MOTION_BONE_KL_HIGHLIGHT_R_WJ; i++) + for (uint32_t i = BLK_N_EYE_L; i <= BLK_KL_HIGHLIGHT_R_WJ; i++) vec[i] = false; } static void sub_14041B1C0(prj::sys_vector& vec) { - for (uint32_t i = MOTION_BONE_N_MABU_L_D_A; i <= MOTION_BONE_TL_MABU_R_U_C_WJ; i++) + for (uint32_t i = BLK_N_MABU_L_D_A; i <= BLK_TL_MABU_R_U_C_WJ; i++) vec[i] = false; - for (uint32_t i = MOTION_BONE_N_EYELID_L_A; i <= MOTION_BONE_TL_EYELID_R_B_WJ; i++) + for (uint32_t i = BLK_N_EYELID_L_A; i <= BLK_TL_EYELID_R_B_WJ; i++) vec[i] = false; sub_14041B440(vec); } static void sub_14041B6B0(prj::sys_vector& vec) { - for (uint32_t i = MOTION_BONE_N_HITO_L_EX; i <= MOTION_BONE_NL_OYA_C_L_WJ; i++) + for (uint32_t i = BLK_N_HITO_L_EX; i <= BLK_NL_OYA_C_L_WJ; i++) vec[i] = false; } static void sub_14041B750(prj::sys_vector& vec) { - for (uint32_t i = MOTION_BONE_N_HITO_R_EX; i <= MOTION_BONE_NL_OYA_C_R_WJ; i++) + for (uint32_t i = BLK_N_HITO_R_EX; i <= BLK_NL_OYA_C_R_WJ; i++) vec[i] = false; } static void sub_14041B300(prj::sys_vector& vec) { - for (uint32_t i = MOTION_BONE_N_MABU_L_D_A; i <= MOTION_BONE_TL_MABU_R_U_C_WJ; i++) + for (uint32_t i = BLK_N_MABU_L_D_A; i <= BLK_TL_MABU_R_U_C_WJ; i++) vec[i] = false; - for (uint32_t i = MOTION_BONE_N_EYELID_L_A; i <= MOTION_BONE_TL_EYELID_R_B_WJ; i++) + for (uint32_t i = BLK_N_EYELID_L_A; i <= BLK_TL_EYELID_R_B_WJ; i++) vec[i] = false; } @@ -10397,38 +10376,38 @@ static void rob_chara_bone_data_set_look_anim_param(rob_chara_bone_data* rob_bon float_t eyes_xrot_adjust_neg = v1_neg * v2_neg; float_t eyes_xrot_adjust_pos = v1_pos * v2_pos; for (motion_blend_mot*& i : rob_bone_data->motions) { - bone_data* data = i->bone_data.bones.data(); - data[MOTION_BONE_KL_EYE_L].eyes_xrot_adjust_neg = eyes_xrot_adjust_neg; - data[MOTION_BONE_KL_EYE_L].eyes_xrot_adjust_pos = eyes_xrot_adjust_pos; - data[MOTION_BONE_KL_EYE_R].eyes_xrot_adjust_neg = eyes_xrot_adjust_neg; - data[MOTION_BONE_KL_EYE_R].eyes_xrot_adjust_pos = eyes_xrot_adjust_pos; + RobBlock* data = i->bone_data.bones.data(); + data[BLK_KL_EYE_L].eyes_xrot_adjust_neg = eyes_xrot_adjust_neg; + data[BLK_KL_EYE_L].eyes_xrot_adjust_pos = eyes_xrot_adjust_pos; + data[BLK_KL_EYE_R].eyes_xrot_adjust_neg = eyes_xrot_adjust_neg; + data[BLK_KL_EYE_R].eyes_xrot_adjust_pos = eyes_xrot_adjust_pos; } rob_bone_data->look_anim.set_eyes_xrot_adjust(eyes_xrot_adjust_neg, eyes_xrot_adjust_pos); } static void rob_chara_bone_data_set_mats(rob_chara_bone_data* rob_bone_data, - const std::vector* bones, const std::string* motion_bones) { + const std::vector* bones, const std::string* motion_bones) { size_t node = 0; size_t matrix = 0; size_t matrix2 = 0; size_t leaf_pos = 0; size_t chain_pos = 0; - bone_node* nodes = rob_bone_data->nodes.data(); - for (const bone_database_bone& i : *bones) { + RobNode* nodes = rob_bone_data->nodes.data(); + for (const BODYTYPE& i : *bones) { chain_pos++; - switch (i.type) { - case BONE_DATABASE_BONE_ROTATION: - case BONE_DATABASE_BONE_TYPE_1: - case BONE_DATABASE_BONE_POSITION: + switch (i.ik_type) { + case IKT_0: + case IKT_0N: + case IKT_0T: nodes->mat_ptr = &rob_bone_data->mats[matrix++]; nodes->name = motion_bones->c_str(); nodes++; motion_bones++; break; - case BONE_DATABASE_BONE_POSITION_ROTATION: + case IKT_ROOT: nodes->mat_ptr = &rob_bone_data->mats[matrix++]; nodes->name = motion_bones->c_str(); nodes++; @@ -10436,7 +10415,7 @@ static void rob_chara_bone_data_set_mats(rob_chara_bone_data* rob_bone_data, leaf_pos++; break; - case BONE_DATABASE_BONE_HEAD_IK_ROTATION: + case IKT_1: nodes->mat_ptr = &rob_bone_data->mats2[matrix2++]; nodes->name = motion_bones->c_str(); nodes++; @@ -10456,8 +10435,8 @@ static void rob_chara_bone_data_set_mats(rob_chara_bone_data* rob_bone_data, leaf_pos++; node += 2; break; - case BONE_DATABASE_BONE_ARM_IK_ROTATION: - case BONE_DATABASE_BONE_LEGS_IK_ROTATION: + case IKT_2: + case IKT_2R: nodes->mat_ptr = &rob_bone_data->mats[matrix++]; nodes->name = motion_bones->c_str(); nodes++; @@ -10486,7 +10465,7 @@ static void rob_chara_bone_data_set_mats(rob_chara_bone_data* rob_bone_data, node++; } - for (bone_node& i : rob_bone_data->nodes) + for (RobNode& i : rob_bone_data->nodes) i.no_scale_mat = i.mat_ptr; if (node != rob_bone_data->node_count) @@ -10508,10 +10487,10 @@ static void rob_chara_bone_data_set_parent_mats(rob_chara_bone_data* rob_bone_da return; parent_indices++; - bone_node* i_begin = rob_bone_data->nodes.data(); - bone_node* i_begin_1 = rob_bone_data->nodes.data() + 1; - bone_node* i_end = rob_bone_data->nodes.data() + rob_bone_data->nodes.size(); - for (bone_node* i = i_begin_1; i != i_end; i++) + RobNode* i_begin = rob_bone_data->nodes.data(); + RobNode* i_begin_1 = rob_bone_data->nodes.data() + 1; + RobNode* i_end = rob_bone_data->nodes.data() + rob_bone_data->nodes.size(); + for (RobNode* i = i_begin_1; i != i_end; i++) i->parent = &i_begin[*parent_indices++]; } @@ -10533,97 +10512,97 @@ static void sub_140413EB0(struc_308* a1) { static void sub_1404117F0(motion_blend_mot* a1) { sub_140413EB0(&a1->field_4F8); int32_t skeleton_select = a1->mot_key_data.skeleton_select; - for (bone_data& i : a1->bone_data.bones) + for (RobBlock& i : a1->bone_data.bones) i.get_mat(skeleton_select); } static void sub_14040FBF0(motion_blend_mot* a1, float_t a2) { - bone_data* b_n_hara_cp = &a1->bone_data.bones.data()[MOTION_BONE_N_HARA_CP]; - bone_data* b_kg_hara_y = &a1->bone_data.bones.data()[MOTION_BONE_KG_HARA_Y]; - bone_data* b_kl_hara_xz = &a1->bone_data.bones.data()[MOTION_BONE_KL_HARA_XZ]; - bone_data* b_kl_hara_etc = &a1->bone_data.bones.data()[MOTION_BONE_KL_HARA_ETC]; + RobBlock* b_n_hara_cp = &a1->bone_data.bones.data()[BLK_N_HARA_CP]; + RobBlock* b_kg_hara_y = &a1->bone_data.bones.data()[BLK_KG_HARA_Y]; + RobBlock* b_kl_hara_xz = &a1->bone_data.bones.data()[BLK_KL_HARA_XZ]; + RobBlock* b_kl_hara_etc = &a1->bone_data.bones.data()[BLK_KL_HARA_ETC]; a1->field_4F8.field_90 = 0.0f; - mat4 rot_mat = b_n_hara_cp->rot_mat[0]; - mat4 mat = b_kg_hara_y->rot_mat[0]; - mat4_mul(&mat, &rot_mat, &rot_mat); - mat = b_kl_hara_xz->rot_mat[0]; - mat4_mul(&mat, &rot_mat, &rot_mat); - mat = b_kl_hara_etc->rot_mat[0]; - mat4_mul(&mat, &rot_mat, &rot_mat); - b_n_hara_cp->rot_mat[0] = rot_mat; - b_kg_hara_y->rot_mat[0] = mat4_identity; - b_kl_hara_xz->rot_mat[0] = mat4_identity; - b_kl_hara_etc->rot_mat[0] = mat4_identity; + mat4 chain_rot = b_n_hara_cp->chain_rot[0]; + mat4 mat = b_kg_hara_y->chain_rot[0]; + mat4_mul(&mat, &chain_rot, &chain_rot); + mat = b_kl_hara_xz->chain_rot[0]; + mat4_mul(&mat, &chain_rot, &chain_rot); + mat = b_kl_hara_etc->chain_rot[0]; + mat4_mul(&mat, &chain_rot, &chain_rot); + b_n_hara_cp->chain_rot[0] = chain_rot; + b_kg_hara_y->chain_rot[0] = mat4_identity; + b_kl_hara_xz->chain_rot[0] = mat4_identity; + b_kl_hara_etc->chain_rot[0] = mat4_identity; float_t v8 = a1->field_4F8.field_C0; float_t v9 = a1->field_4F8.field_C4; vec3 v10 = a1->field_4F8.field_C8; - a1->field_4F8.field_A8 = b_n_hara_cp->position; + a1->field_4F8.field_A8 = b_n_hara_cp->leaf_pos[0]; if (!a1->mot_key_data.skeleton_select) { if (a2 != v9) { - b_n_hara_cp->position.x = (b_n_hara_cp->position.x - v10.x) * v9 + v10.x; - b_n_hara_cp->position.z = (b_n_hara_cp->position.z - v10.z) * v9 + v10.z; + b_n_hara_cp->leaf_pos[0].x = (b_n_hara_cp->leaf_pos[0].x - v10.x) * v9 + v10.x; + b_n_hara_cp->leaf_pos[0].z = (b_n_hara_cp->leaf_pos[0].z - v10.z) * v9 + v10.z; } - b_n_hara_cp->position.y = ((b_n_hara_cp->position.y - v10.y) * v8) + v10.y; + b_n_hara_cp->leaf_pos[0].y = ((b_n_hara_cp->leaf_pos[0].y - v10.y) * v8) + v10.y; } else { if (a2 != v9) { v9 /= a2; - b_n_hara_cp->position.x = (b_n_hara_cp->position.x - v10.x) * v9 + v10.x; - b_n_hara_cp->position.z = (b_n_hara_cp->position.z - v10.z) * v9 + v10.z; + b_n_hara_cp->leaf_pos[0].x = (b_n_hara_cp->leaf_pos[0].x - v10.x) * v9 + v10.x; + b_n_hara_cp->leaf_pos[0].z = (b_n_hara_cp->leaf_pos[0].z - v10.z) * v9 + v10.z; } if (a2 != v8) { v8 /= a2; - b_n_hara_cp->position.y = (b_n_hara_cp->position.y - v10.y) * v8 + v10.y; + b_n_hara_cp->leaf_pos[0].y = (b_n_hara_cp->leaf_pos[0].y - v10.y) * v8 + v10.y; } } } -static void sub_140410A40(motion_blend_mot* a1, prj::sys_vector* a2, prj::sys_vector* a3) { +static void sub_140410A40(motion_blend_mot* a1, prj::sys_vector* a2, prj::sys_vector* a3) { MotionBlend* v4 = a1->blend; if (!v4 || !v4->enable) return; v4->Field_20(a2, a3); - for (bone_data& i : *a2) { - if (!a1->enabled_bones.arr[i.motion_bone_index]) + for (RobBlock& i : *a2) { + if (!a1->enabled_bones.arr[i.block_id]) continue; - bone_data* v8 = 0; + RobBlock* v8 = 0; if (a3) - v8 = &a3->data()[i.motion_bone_index]; - v4->Blend(&a2->data()[i.motion_bone_index], v8); + v8 = &a3->data()[i.block_id]; + v4->Blend(&a2->data()[i.block_id], v8); } } -static void sub_140410B70(motion_blend_mot* a1, prj::sys_vector* a2) { +static void sub_140410B70(motion_blend_mot* a1, prj::sys_vector* a2) { MotionBlend* v3 = a1->blend; if (!v3 || !v3->enable) return; v3->Field_20(&a1->bone_data.bones, a2); - for (bone_data& i : a1->bone_data.bones) { - if (!a1->enabled_bones.arr[i.motion_bone_index]) + for (RobBlock& i : a1->bone_data.bones) { + if (!a1->enabled_bones.arr[i.block_id]) continue; - bone_data* v6 = 0; + RobBlock* v6 = 0; if (a2) - v6 = &a2->data()[i.motion_bone_index]; - v3->Blend(&a1->bone_data.bones.data()[i.motion_bone_index], v6); + v6 = &a2->data()[i.block_id]; + v3->Blend(&a1->bone_data.bones.data()[i.block_id], v6); } } -static void sub_140410CB0(partial_motion_blend_mot* a1, prj::sys_vector* a2) { +static void sub_140410CB0(partial_motion_blend_mot* a1, prj::sys_vector* a2) { if (!a1->blend.enable) return; - for (bone_data& i : *a2) - if (a1->enabled_bones.arr[i.motion_bone_index]) - a1->blend.Blend(&a2->data()[i.motion_bone_index], 0); + for (RobBlock& i : *a2) + if (a1->enabled_bones.arr[i.block_id]) + a1->blend.Blend(&a2->data()[i.block_id], 0); } static void sub_1404182B0(rob_chara_bone_data* rob_bone_data) { @@ -10649,7 +10628,7 @@ static void sub_1404182B0(rob_chara_bone_data* rob_bone_data) { if (sub_1404136B0(*j)) continue; - prj::sys_vector* bones = 0; + prj::sys_vector* bones = 0; if (j != rob_bone_data->motion_loaded.rbegin()) { auto v5 = j; v5--; @@ -10668,11 +10647,11 @@ static void sub_1404182B0(rob_chara_bone_data* rob_bone_data) { sub_140410CB0(&rob_bone_data->eyes, &v3->bone_data.bones); sub_140410CB0(&rob_bone_data->eyelid, &v3->bone_data.bones); - bone_data* v7 = &v3->bone_data.bones.data()[0]; - v3->field_4F8.field_9C = v7->position; + RobBlock* v7 = &v3->bone_data.bones.data()[0]; + v3->field_4F8.field_9C = v7->leaf_pos[0]; if (sub_140413790(&v3->field_4F8)) { // WTF??? - v3->field_4F8.field_90 = v7->position; - v7->position -= v7->position; + v3->field_4F8.field_90 = v7->leaf_pos[0]; + v7->leaf_pos[0] -= v7->leaf_pos[0]; } } @@ -10765,8 +10744,8 @@ static void sub_140505C90(struc_264* a1) { a1->field_198 = 0; a1->field_19C = 0; a1->field_1A0 = 0; - a1->field_1A4 = 0; - a1->field_1A8 = 0; + a1->kamae_type = 0; + a1->kamae_data = 0; a1->field_1B0 = 0; a1->field_1B4 = 0; a1->field_1B8 = 0; @@ -10937,25 +10916,25 @@ static void sub_140505FB0(struc_209* a1) { a1->field_1F26 = 0; } -static float_t sub_140512F60(rob_chara_item_equip* rob_itm_equip) { - mat4* mats = rob_itm_equip->matrices; +static float_t sub_140512F60(rob_chara_item_equip* rob_disp) { + const mat4* motion_matrix = rob_disp->motion_matrix; float_t y = 1.0f; - y = min_def(y, mats[ROB_BONE_N_HARA_CP ].row3.y); - y = min_def(y, mats[ROB_BONE_KL_ASI_L_WJ_CO].row3.y); - y = min_def(y, mats[ROB_BONE_KL_ASI_R_WJ_CO].row3.y); - y = min_def(y, mats[ROB_BONE_KL_TE_L_WJ ].row3.y); - y = min_def(y, mats[ROB_BONE_KL_TE_R_WJ ].row3.y); + y = min_def(y, motion_matrix[BONE_ID_N_HARA_CP ].row3.y); + y = min_def(y, motion_matrix[BONE_ID_KL_ASI_L_WJ_CO].row3.y); + y = min_def(y, motion_matrix[BONE_ID_KL_ASI_R_WJ_CO].row3.y); + y = min_def(y, motion_matrix[BONE_ID_KL_TE_L_WJ ].row3.y); + y = min_def(y, motion_matrix[BONE_ID_KL_TE_R_WJ ].row3.y); return y; } static void rob_chara_add_motion_reset_data(rob_chara* rob_chr, uint32_t motion_id, float_t frame, int32_t iterations) { if (motion_id != -1) - rob_chr->item_equip->add_motion_reset_data(motion_id, frame, iterations); + rob_chr->rob_disp->add_motion_reset_data(motion_id, frame, iterations); } static void rob_chara_age_age_ctrl(rob_chara* rob_chr, int32_t part_id, const char* name) { - mat4 mat = *rob_chr->item_equip->get_ex_data_bone_node_mat(ITEM_KAMI, name); + mat4 mat = *rob_chr->rob_disp->get_ex_data_bone_node_mat(RPK_KAMI, name); if (vec3::length(rob_chr->data.adjust_data.pos_adjust) > 0.000001f) { mat4 temp; mat4_translate(&rob_chr->data.adjust_data.pos_adjust, &temp); @@ -10970,11 +10949,11 @@ static object_info rob_chara_get_head_object(rob_chara* rob_chr, int32_t head_ob object_info obj_info = rob_chr->item_cos_data.get_head_object_replace(head_object_id); if (obj_info.not_null()) return obj_info; - return rob_chr->chara_init_data->head_objects[head_object_id]; + return rob_chr->rob_data->head_objects[head_object_id]; } -static object_info rob_chara_get_object_info(rob_chara* rob_chr, item_id id) { - return rob_chr->item_equip->get_object_info(id); +static object_info rob_chara_get_object_info(rob_chara* rob_chr, ROB_PARTS_KIND rpk) { + return rob_chr->rob_disp->get_object_info(rpk); } static void rob_chara_load_default_motion(rob_chara* rob_chr, @@ -11042,29 +11021,29 @@ static void rob_chara_set_adjust(rob_chara* rob_chr, rob_chara_data_adjust* adju } static void rob_chara_set_pv_data(rob_chara* rob_chr, int8_t chara_id, - chara_index chara_index, int32_t cos_id, const rob_chara_pv_data& pv_data) { + CHARA_NUM chara_num, int32_t cos_id, const rob_chara_pv_data& pv_data) { rob_chr->chara_id = chara_id; - rob_chr->chara_index = chara_index; + rob_chr->chara_num = chara_num; rob_chr->cos_id = cos_id; rob_chr->pv_data = pv_data; - rob_chr->chara_init_data = chara_init_data_get(chara_index); + rob_chr->rob_data = get_rob_data(chara_num); if (!check_cos_id_is_501(cos_id)) { - const item_cos_data* cos = item_table_handler_array_get_item_cos_data(chara_index, cos_id); + const item_cos_data* cos = item_table_handler_array_get_item_cos_data(chara_num, cos_id); if (cos) - rob_chr->item_cos_data.set_chara_index_item_nos(chara_index, cos->arr); + rob_chr->item_cos_data.set_chara_num_item_nos(chara_num, cos->arr); } rob_chr->item_cos_data.set_item_array(pv_data.item); } static void rob_cmn_mottbl_read(void* a1, const void* data, size_t size) { - free_def(rob_cmn_mottbl_data); + free_def(common_mot_tbl_header); farc f; f.read(data, size, true); if (f.files.size()) { farc_file* ff = f.read_file("rob_cmn_mottbl.bin"); if (ff && ff->data) { - rob_cmn_mottbl_data = (rob_cmn_mottbl_header*)ff->data; + common_mot_tbl_header = (CmnMotTblHeader*)ff->data; ff->data = 0; } } @@ -11087,7 +11066,7 @@ static void opd_chara_data_array_fs_copy_file(int32_t chara_id) { } static opd_chara_data* opd_chara_data_array_get(int32_t chara_id) { - if (chara_id < 0 || chara_id >= ROB_CHARA_COUNT) + if (chara_id < 0 || chara_id >= ROB_ID_MAX) chara_id = 0; return &opd_chara_data_array[chara_id]; } @@ -11210,7 +11189,7 @@ bool rob_chara_array_check_visibility(int32_t chara_id) { } rob_chara* rob_chara_array_get(int32_t chara_id) { - if (chara_id < 0 || chara_id >= ROB_CHARA_COUNT) + if (chara_id < 0 || chara_id >= ROB_ID_MAX) return 0; if (rob_chara_pv_data_array_check_chara_id(chara_id)) @@ -11232,11 +11211,11 @@ rob_chara_item_cos_data* rob_chara_array_get_item_cos_data(int32_t chara_id) { return &rob_chara_array[chara_id].item_cos_data; } -rob_chara_item_equip* rob_chara_array_get_item_equip(int32_t chara_id) { - return rob_chara_array[chara_id].item_equip; +rob_chara_item_equip* rob_chara_array_get_rob_disp(int32_t chara_id) { + return rob_chara_array[chara_id].rob_disp; } -int32_t rob_chara_array_init_chara_index(chara_index chara_index, +int32_t rob_chara_array_init_chara_num(CHARA_NUM chara_num, const rob_chara_pv_data& pv_data, int32_t cos_id, bool can_set_default) { if (!app::TaskWork::check_task_ready(task_rob_manager) || pv_data.type < ROB_CHARA_TYPE_0|| pv_data.type > ROB_CHARA_TYPE_3) @@ -11245,20 +11224,20 @@ int32_t rob_chara_array_init_chara_index(chara_index chara_index, int32_t chara_id = 0; while (rob_chara_pv_data_array[chara_id].type != ROB_CHARA_TYPE_NONE) { chara_id++; - if (chara_id >= ROB_CHARA_COUNT) + if (chara_id >= ROB_ID_MAX) return -1; } if (can_set_default && (cos_id < 0 || cos_id > 498)) cos_id = 0; rob_chara_pv_data_array[chara_id] = pv_data; - rob_chara_set_pv_data(&rob_chara_array[chara_id], chara_id, chara_index, cos_id, pv_data); + rob_chara_set_pv_data(&rob_chara_array[chara_id], chara_id, chara_num, cos_id, pv_data); task_rob_manager->AppendInitCharaList(&rob_chara_array[chara_id]); return chara_id; } void rob_chara_array_free_chara_id(int32_t chara_id) { - if (chara_id < 0 || chara_id >= ROB_CHARA_COUNT) + if (chara_id < 0 || chara_id >= ROB_ID_MAX) return; task_rob_manager->AppendFreeCharaList(&rob_chara_array[chara_id]); @@ -11270,11 +11249,11 @@ void rob_chara_array_reset_pv_data(int32_t chara_id) { } void rob_chara_array_reset_bone_data_item_equip(int32_t chara_id) { - rob_chara_item_equip* rob_itm_equip = rob_chara_array[chara_id].item_equip; - rob_itm_equip->reset_init_data(rob_chara_bone_data_get_node( - rob_chara_array[chara_id].bone_data, MOT_BONE_N_HARA_CP)); - rob_itm_equip->set_shadow_type(chara_id); - rob_itm_equip->field_A0 = 0x05; + rob_chara_item_equip* rob_disp = rob_chara_array[chara_id].rob_disp; + rob_disp->reset_init_data(rob_chara_bone_data_get_node( + rob_chara_array[chara_id].bone_data, BONE_NODE_N_HARA_CP)); + rob_disp->set_shadow_group(chara_id); + rob_disp->shadow_flag = 0x05; } void rob_chara_array_set_alpha_obj_flags(int32_t chara_id, float_t alpha, mdl::ObjFlags flags) { @@ -11282,7 +11261,7 @@ void rob_chara_array_set_alpha_obj_flags(int32_t chara_id, float_t alpha, mdl::O if (!rob_chr) return; - rob_chr->item_equip->set_alpha_obj_flags(alpha, flags); + rob_chr->rob_disp->set_alpha_obj_flags(alpha, flags); if (rob_chr->check_for_ageageagain_module()) { rob_chara_age_age_array_set_alpha(chara_id, 1, alpha); @@ -11296,7 +11275,7 @@ void rob_chara_array_set_visibility(int32_t chara_id, bool value) { bool pv_osage_manager_array_get_disp() { bool disp = false; - for (int32_t i = 0; i < ROB_CHARA_COUNT; i++) + for (int32_t i = 0; i < ROB_ID_MAX; i++) disp |= pv_osage_manager_array_get(i)->GetDisplay(); return disp; } @@ -11314,7 +11293,7 @@ void pv_osage_manager_array_set_motion_ids( } void pv_osage_manager_array_set_not_reset_true() { - for (int32_t i = 0; i < ROB_CHARA_COUNT; i++) + for (int32_t i = 0; i < ROB_ID_MAX; i++) pv_osage_manager_array_get(i)->SetNotReset(true); } @@ -11327,32 +11306,17 @@ void pv_osage_manager_array_set_pv_set_motion( pv_osage_manager_array_get(chara_id)->SetPvSetMotion(set_motion); } -bool rob_chara_check_for_ageageagain_module(chara_index chara_index, int32_t cos_id) { - return chara_index == CHARA_MIKU && cos_id == 148; +bool rob_chara_check_for_ageageagain_module(CHARA_NUM chara_num, int32_t cos_id) { + return chara_num == CN_MIKU && cos_id == 148; } bool rob_chara_pv_data_array_check_chara_id(int32_t chara_id) { return rob_chara_pv_data_array[chara_id].type != ROB_CHARA_TYPE_NONE; } -// 0x1405376C0 -uint32_t rob_cmn_mottbl_get_motion_id(chara_index chara_index, int32_t a2, int32_t id) { - if (rob_cmn_mottbl_data - && chara_index >= 0 && chara_index < rob_cmn_mottbl_data->chara_count - && id >= 0 && id < rob_cmn_mottbl_data->mottbl_indices_count) { - rob_cmn_mottbl_sub_header* v4 = (rob_cmn_mottbl_sub_header*)((uint8_t*)rob_cmn_mottbl_data - + rob_cmn_mottbl_data->subheaders_offset); - if (a2 >= 0 && a2 < v4[chara_index].field_4) - return ((uint32_t*)((uint8_t*)rob_cmn_mottbl_data - + *(uint32_t*)((uint8_t*)rob_cmn_mottbl_data - + a2 * sizeof(uint32_t) + v4[chara_index].data_offset)))[id]; - } - return -1; -} - void rob_sleeve_handler_data_get_sleeve_data( - ::chara_index chara_index, int32_t cos, rob_sleeve_data& l, rob_sleeve_data& r) { - rob_sleeve_handler_data->get_sleeve_data(chara_index, cos, l, r); + CHARA_NUM chara_num, int32_t cos, rob_sleeve_data& l, rob_sleeve_data& r) { + rob_sleeve_handler_data->get_sleeve_data(chara_num, cos, l, r); } bool rob_sleeve_handler_data_load() { @@ -11367,20 +11331,20 @@ bool task_rob_load_add_task() { return app::TaskWork::add_task(task_rob_load, 0, "ROB LOAD", 0); } -bool task_rob_load_append_free_req_data(chara_index chara_index) { - return task_rob_load->AppendFreeReqData(chara_index); +bool task_rob_load_append_free_req_data(CHARA_NUM chara_num) { + return task_rob_load->AppendFreeReqData(chara_num); } -bool task_rob_load_append_free_req_data_obj(chara_index chara_index, const item_cos_data* cos) { - return task_rob_load->AppendFreeReqDataObj(chara_index, cos); +bool task_rob_load_append_free_req_data_obj(CHARA_NUM chara_num, const item_cos_data* cos) { + return task_rob_load->AppendFreeReqDataObj(chara_num, cos); } -bool task_rob_load_append_load_req_data(chara_index chara_index) { - return task_rob_load->AppendLoadReqData(chara_index); +bool task_rob_load_append_load_req_data(CHARA_NUM chara_num) { + return task_rob_load->AppendLoadReqData(chara_num); } -bool task_rob_load_append_load_req_data_obj(chara_index chara_index, const item_cos_data* cos) { - return task_rob_load->AppendLoadReqDataObj(chara_index, cos); +bool task_rob_load_append_load_req_data_obj(CHARA_NUM chara_num, const item_cos_data* cos) { + return task_rob_load->AppendLoadReqDataObj(chara_num, cos); } bool task_rob_load_check_load_req_data() { @@ -11399,7 +11363,7 @@ bool task_rob_manager_add_task() { } bool task_rob_manager_check_chara_loaded(int32_t chara_id) { - if (chara_id < 0 || chara_id >= ROB_CHARA_COUNT) + if (chara_id < 0 || chara_id >= ROB_ID_MAX) return false; return task_rob_manager->CheckCharaLoaded(&rob_chara_array[chara_id]); } @@ -11409,7 +11373,7 @@ bool task_rob_manager_check_task_ready() { } void task_rob_manager_free_all_chara() { - for (int32_t i = 0; i < ROB_CHARA_COUNT; i++) + for (int32_t i = 0; i < ROB_ID_MAX; i++) if (rob_chara_array[i].type != ROB_CHARA_TYPE_NONE) { task_rob_manager->AppendFreeCharaList(&rob_chara_array[i]); rob_chara_array[i].type = ROB_CHARA_TYPE_NONE; @@ -11421,7 +11385,7 @@ bool task_rob_manager_get_free_chara_list_empty() { } bool task_rob_manager_get_wait(int32_t chara_id) { - if (chara_id < 0 || chara_id >= ROB_CHARA_COUNT) + if (chara_id < 0 || chara_id >= ROB_ID_MAX) return false; return task_rob_manager->GetWait(&rob_chara_array[chara_id]); @@ -11490,11 +11454,11 @@ void RobTransform::reset_scale() { hsc = 1.0f; } -bone_node::bone_node() : name(), mat_ptr(), parent(), no_scale_mat() { +RobNode::RobNode() : name(), mat_ptr(), parent(), no_scale_mat() { } -float_t* bone_node::get_transform_component(size_t index, Expr_type& type) { +float_t* RobNode::get_transform_component(size_t index, Expr_type& type) { switch (index) { case 0: type = Expr_variable; @@ -11528,7 +11492,7 @@ float_t* bone_node::get_transform_component(size_t index, Expr_type& type) { } } -const float_t* bone_node::get_transform_component(size_t index, Expr_type& type) const { +const float_t* RobNode::get_transform_component(size_t index, Expr_type& type) const { switch (index) { case 0: type = Expr_variable; @@ -11562,7 +11526,7 @@ const float_t* bone_node::get_transform_component(size_t index, Expr_type& type) } } -void bone_node::set_name_mat_no_scale_mat(const char* name, mat4* mat, mat4* no_scale_mat) { +void RobNode::set_name_mat_no_scale_mat(const char* name, mat4* mat, mat4* no_scale_mat) { this->name = name; this->mat_ptr = mat; @@ -11578,7 +11542,7 @@ void bone_node::set_name_mat_no_scale_mat(const char* name, mat4* mat, mat4* no_ } mot_key_data::mot_key_data() : key_sets_ready(), key_set_count(), key_set(), -mot(), key_set_data(), mot_data(), skeleton_type(), skeleton_select(), field_68() { +mot(), fc_value(), mot_data(), skeleton_type(), skeleton_select(), field_68() { motion_id = -1; frame = -1.0f; } @@ -11588,13 +11552,13 @@ mot_key_data::~mot_key_data() { } void mot_key_data::interpolate(float_t frame, uint32_t key_set_offset, uint32_t key_set_count) { - mot_interpolate(&mot, frame, &key_set_data.data()[key_set_offset], + mot_interpolate(&mot, frame, &fc_value.data()[key_set_offset], &key_set.data()[key_set_offset], key_set_count, &field_68); } void mot_key_data::reset() { key_sets_ready = 0; - skeleton_type = BONE_DATABASE_SKELETON_NONE; + skeleton_type = BONE_KIND_NONE; frame = -1.0f; key_set_count = 0; mot_data = 0; @@ -11602,7 +11566,7 @@ void mot_key_data::reset() { field_68 = {}; key_set.clear(); - key_set_data.clear(); + fc_value.clear(); motion_id = -1; } @@ -11611,100 +11575,100 @@ eyes_adjust::eyes_adjust() : xrot_adjust(), base_adjust() { pos = -1.0f; } -bone_data::bone_data() : type(), has_parent(), motion_bone_index(), mirror(), parent(), -flags(), key_set_offset(), key_set_count(), frame(), ik_target(), pole_target_mat(), -parent_mat(), node(), ik_segment_length(), ik_2nd_segment_length(), arm_length() { +RobBlock::RobBlock() : ik_type(), inherit_type(), block_id(), flip_block_id(), +inherit_mat_id(), expression_id(), key_set_offset(), key_set_count(), frame(), +up_vector_mat_ptr(), inherit_mat_ptr(), node(), len(), arm_length() { eyes_xrot_adjust_neg = 1.0f; eyes_xrot_adjust_pos = 1.0f; } -bone_data::~bone_data() { +RobBlock::~RobBlock() { } -void bone_data::copy_rot_trans(const bone_data& other) { - if (check_flags_not_null()) +void RobBlock::copy_rot_trans(const RobBlock& other) { + if (check_expression_id_not_null()) return; - switch (type) { - case BONE_DATABASE_BONE_TYPE_1: - case BONE_DATABASE_BONE_POSITION: - case BONE_DATABASE_BONE_POSITION_ROTATION: - position = other.position; - position_prev[0] = other.position_prev[0]; + switch (ik_type) { + case IKT_0N: + case IKT_0T: + case IKT_ROOT: + leaf_pos[0] = other.leaf_pos[0]; + smooth_pos[0] = other.smooth_pos[0]; break; } - switch (type) { - case BONE_DATABASE_BONE_ROTATION: - case BONE_DATABASE_BONE_TYPE_1: - case BONE_DATABASE_BONE_POSITION: - case BONE_DATABASE_BONE_POSITION_ROTATION: - rot_mat[0] = other.rot_mat[0]; - rot_mat_prev[0][0] = other.rot_mat_prev[0][0]; + switch (ik_type) { + case IKT_0: + case IKT_0N: + case IKT_0T: + case IKT_ROOT: + chain_rot[0] = other.chain_rot[0]; + smooth_rot[0][0] = other.smooth_rot[0][0]; break; - case BONE_DATABASE_BONE_HEAD_IK_ROTATION: - rot_mat[0] = other.rot_mat[0]; - rot_mat[1] = other.rot_mat[1]; - rot_mat_prev[0][0] = other.rot_mat_prev[0][0]; - rot_mat_prev[1][0] = other.rot_mat_prev[1][0]; + case IKT_1: + chain_rot[0] = other.chain_rot[0]; + chain_rot[1] = other.chain_rot[1]; + smooth_rot[0][0] = other.smooth_rot[0][0]; + smooth_rot[1][0] = other.smooth_rot[1][0]; break; - case BONE_DATABASE_BONE_ARM_IK_ROTATION: - case BONE_DATABASE_BONE_LEGS_IK_ROTATION: - rot_mat[0] = other.rot_mat[0]; - rot_mat[1] = other.rot_mat[1]; - rot_mat[2] = other.rot_mat[2]; - rot_mat_prev[0][0] = other.rot_mat_prev[0][0]; - rot_mat_prev[1][0] = other.rot_mat_prev[1][0]; - rot_mat_prev[2][0] = other.rot_mat_prev[2][0]; + case IKT_2: + case IKT_2R: + chain_rot[0] = other.chain_rot[0]; + chain_rot[1] = other.chain_rot[1]; + chain_rot[2] = other.chain_rot[2]; + smooth_rot[0][0] = other.smooth_rot[0][0]; + smooth_rot[1][0] = other.smooth_rot[1][0]; + smooth_rot[2][0] = other.smooth_rot[2][0]; break; } } -bool bone_data::check_flags_not_null() { - return !!flags; +bool RobBlock::check_expression_id_not_null() { + return !!expression_id; } -bool bone_data::get_constraint_ik(const bone_data* bones) { +bool RobBlock::get_constraint_ik(const RobBlock* bones) { vec3 target; - switch (motion_bone_index) { - case MOTION_BONE_N_SKATA_L_WJ_CD_EX: - mat4_get_translation(bones[MOTION_BONE_C_KATA_L].node[2].mat_ptr, &target); + switch (block_id) { + case BLK_N_SKATA_L_WJ_CD_EX: + mat4_get_translation(bones[BLK_C_KATA_L].node[2].mat_ptr, &target); orient_x(target); break; - case MOTION_BONE_N_SKATA_R_WJ_CD_EX: - mat4_get_translation(bones[MOTION_BONE_C_KATA_R].node[2].mat_ptr, &target); + case BLK_N_SKATA_R_WJ_CD_EX: + mat4_get_translation(bones[BLK_C_KATA_R].node[2].mat_ptr, &target); orient_x(target); break; - case MOTION_BONE_N_SKATA_B_L_WJ_CD_CU_EX: - mat4_get_translation(bones[MOTION_BONE_N_UP_KATA_L_EX].node[0].mat_ptr, &target); + case BLK_N_SKATA_B_L_WJ_CD_CU_EX: + mat4_get_translation(bones[BLK_N_UP_KATA_L_EX].node[0].mat_ptr, &target); orient_x_cns(target, 0.333f); break; - case MOTION_BONE_N_SKATA_B_R_WJ_CD_CU_EX: - mat4_get_translation(bones[MOTION_BONE_N_UP_KATA_R_EX].node[0].mat_ptr, &target); + case BLK_N_SKATA_B_R_WJ_CD_CU_EX: + mat4_get_translation(bones[BLK_N_UP_KATA_R_EX].node[0].mat_ptr, &target); orient_x_cns(target, 0.333f); break; - case MOTION_BONE_N_SKATA_C_L_WJ_CD_CU_EX: - mat4_get_translation(bones[MOTION_BONE_N_UP_KATA_L_EX].node[0].mat_ptr, &target); + case BLK_N_SKATA_C_L_WJ_CD_CU_EX: + mat4_get_translation(bones[BLK_N_UP_KATA_L_EX].node[0].mat_ptr, &target); orient_x_cns(target, 0.5f); break; - case MOTION_BONE_N_SKATA_C_R_WJ_CD_CU_EX: - mat4_get_translation(bones[MOTION_BONE_N_UP_KATA_R_EX].node[0].mat_ptr, &target); + case BLK_N_SKATA_C_R_WJ_CD_CU_EX: + mat4_get_translation(bones[BLK_N_UP_KATA_R_EX].node[0].mat_ptr, &target); orient_x_cns(target, 0.5f); break; - case MOTION_BONE_N_MOMO_A_L_WJ_CD_EX: - mat4_get_translation(bones[MOTION_BONE_CL_MOMO_L].node[2].mat_ptr, &target); + case BLK_N_MOMO_A_L_WJ_CD_EX: + mat4_get_translation(bones[BLK_CL_MOMO_L].node[2].mat_ptr, &target); mat4_inverse_transform_point(node[0].mat_ptr, &target, &target); orient_y(-target); break; - case MOTION_BONE_N_MOMO_A_R_WJ_CD_EX: - mat4_get_translation(bones[MOTION_BONE_CL_MOMO_R].node[2].mat_ptr, &target); + case BLK_N_MOMO_A_R_WJ_CD_EX: + mat4_get_translation(bones[BLK_CL_MOMO_R].node[2].mat_ptr, &target); mat4_inverse_transform_point(node[0].mat_ptr, &target, &target); orient_y(-target); break; - case MOTION_BONE_N_HARA_CD_EX: - mat4_get_translation(bones[MOTION_BONE_KL_MUNE_B_WJ].node[0].mat_ptr, &target); + case BLK_N_HARA_CD_EX: + mat4_get_translation(bones[BLK_KL_MUNE_B_WJ].node[0].mat_ptr, &target); mat4_inverse_transform_point(node[0].mat_ptr, &target, &target); orient_y(target); break; @@ -11714,21 +11678,21 @@ bool bone_data::get_constraint_ik(const bone_data* bones) { return true; } -bool bone_data::get_ex_rotation(RobTransform& transform, const bone_data* bones) { - bone_node* node; +bool RobBlock::get_ex_rotation(RobTransform& transform, const RobBlock* bones) { + RobNode* node; - switch (motion_bone_index) { - case MOTION_BONE_N_EYE_L_WJ_EX: - transform.rot.x = -bones[MOTION_BONE_KL_EYE_L].node[0].transform.rot.x; - transform.rot.y = bones[MOTION_BONE_KL_EYE_L].node[0].transform.rot.y * (float_t)(-1.0 / 2.0); + switch (block_id) { + case BLK_N_EYE_L_WJ_EX: + transform.rot.x = -bones[BLK_KL_EYE_L].node[0].transform.rot.x; + transform.rot.y = bones[BLK_KL_EYE_L].node[0].transform.rot.y * (float_t)(-1.0 / 2.0); break; - case MOTION_BONE_N_EYE_R_WJ_EX: - transform.rot.x = -bones[MOTION_BONE_KL_EYE_R].node[0].transform.rot.x; - transform.rot.y = bones[MOTION_BONE_KL_EYE_R].node[0].transform.rot.y * (float_t)(-1.0 / 2.0); + case BLK_N_EYE_R_WJ_EX: + transform.rot.x = -bones[BLK_KL_EYE_R].node[0].transform.rot.x; + transform.rot.y = bones[BLK_KL_EYE_R].node[0].transform.rot.y * (float_t)(-1.0 / 2.0); break; - case MOTION_BONE_N_KUBI_WJ_EX: { - mat4 mat = bones[MOTION_BONE_CL_KAO].rot_mat[0]; - mat4_mul(&bones[MOTION_BONE_CL_KAO].rot_mat[1], &mat, &mat); + case BLK_N_KUBI_WJ_EX: { + mat4 mat = bones[BLK_CL_KAO].chain_rot[0]; + mat4_mul(&bones[BLK_CL_KAO].chain_rot[1], &mat, &mat); vec3 rotation; mat4_get_rotation_zyx(&mat, &rotation); @@ -11738,86 +11702,86 @@ bool bone_data::get_ex_rotation(RobTransform& transform, const bone_data* bones) rot += (float_t)(M_PI * 2.0); transform.rot.y = (rot - (float_t)M_PI_2) * 0.2f; } break; - case MOTION_BONE_N_HITO_L_EX: - case MOTION_BONE_N_HITO_R_EX: + case BLK_N_HITO_L_EX: + case BLK_N_HITO_R_EX: transform.rot.z = (float_t)(-9.0 * DEG_TO_RAD); break; - case MOTION_BONE_N_KO_L_EX: + case BLK_N_KO_L_EX: transform.rot.x = (float_t)(-8.0 * DEG_TO_RAD); transform.rot.z = (float_t)(16.0 * DEG_TO_RAD); break; - case MOTION_BONE_N_KUSU_L_EX: - case MOTION_BONE_N_KUSU_R_EX: + case BLK_N_KUSU_L_EX: + case BLK_N_KUSU_R_EX: transform.rot.z = (float_t)(9.0 * DEG_TO_RAD); break; - case MOTION_BONE_N_NAKA_L_EX: - case MOTION_BONE_N_NAKA_R_EX: + case BLK_N_NAKA_L_EX: + case BLK_N_NAKA_R_EX: transform.rot.z = (float_t)(-1.0 * DEG_TO_RAD); break; - case MOTION_BONE_N_OYA_L_EX: + case BLK_N_OYA_L_EX: transform.rot.x = (float_t)(75.0 * DEG_TO_RAD); transform.rot.y = (float_t)(12.0 * DEG_TO_RAD); transform.rot.z = (float_t)(-24.0 * DEG_TO_RAD); break; - case MOTION_BONE_N_STE_L_WJ_EX: - transform.rot.x = bones[MOTION_BONE_KL_TE_L_WJ].node[0].transform.rot.x; + case BLK_N_STE_L_WJ_EX: + transform.rot.x = bones[BLK_KL_TE_L_WJ].node[0].transform.rot.x; break; - case MOTION_BONE_N_SUDE_L_WJ_EX: - case MOTION_BONE_N_SUDE_B_L_WJ_EX: - node = &bones[MOTION_BONE_KL_TE_L_WJ].node[0]; - transform.rot.x = bone_data::limit_angle(node->transform.rot.x) * (float_t)(1.0 / 3.0); + case BLK_N_SUDE_L_WJ_EX: + case BLK_N_SUDE_B_L_WJ_EX: + node = &bones[BLK_KL_TE_L_WJ].node[0]; + transform.rot.x = RobBlock::limit_angle(node->transform.rot.x) * (float_t)(1.0 / 3.0); break; - case MOTION_BONE_N_SUDE_R_WJ_EX: - case MOTION_BONE_N_SUDE_B_R_WJ_EX: - node = &bones[MOTION_BONE_KL_TE_R_WJ].node[0]; - transform.rot.x = bone_data::limit_angle(node->transform.rot.x) * (float_t)(1.0 / 3.0); + case BLK_N_SUDE_R_WJ_EX: + case BLK_N_SUDE_B_R_WJ_EX: + node = &bones[BLK_KL_TE_R_WJ].node[0]; + transform.rot.x = RobBlock::limit_angle(node->transform.rot.x) * (float_t)(1.0 / 3.0); break; - case MOTION_BONE_N_HIJI_L_WJ_EX: - transform.rot.z = bones[MOTION_BONE_C_KATA_L].node[2].transform.rot.z * (float_t)(1.0 / 2.0); + case BLK_N_HIJI_L_WJ_EX: + transform.rot.z = bones[BLK_C_KATA_L].node[2].transform.rot.z * (float_t)(1.0 / 2.0); break; - case MOTION_BONE_N_UP_KATA_L_EX: - case MOTION_BONE_N_UP_KATA_R_EX: + case BLK_N_UP_KATA_L_EX: + case BLK_N_UP_KATA_R_EX: break; - case MOTION_BONE_N_KO_R_EX: + case BLK_N_KO_R_EX: transform.rot.x = (float_t)(8.0 * DEG_TO_RAD); transform.rot.z = (float_t)(16.0 * DEG_TO_RAD); break; - case MOTION_BONE_N_OYA_R_EX: + case BLK_N_OYA_R_EX: transform.rot.x = (float_t)(-75.0 * DEG_TO_RAD); transform.rot.y = (float_t)(-12.0 * DEG_TO_RAD); transform.rot.z = (float_t)(-24.0 * DEG_TO_RAD); break; - case MOTION_BONE_N_STE_R_WJ_EX: - transform.rot.x = bones[MOTION_BONE_KL_TE_R_WJ].node[0].transform.rot.x; + case BLK_N_STE_R_WJ_EX: + transform.rot.x = bones[BLK_KL_TE_R_WJ].node[0].transform.rot.x; break; - case MOTION_BONE_N_HIJI_R_WJ_EX: - transform.rot.z = bones[MOTION_BONE_C_KATA_R].node[2].transform.rot.z * (float_t)(1.0 / 2.0); + case BLK_N_HIJI_R_WJ_EX: + transform.rot.z = bones[BLK_C_KATA_R].node[2].transform.rot.z * (float_t)(1.0 / 2.0); break; - case MOTION_BONE_N_HIZA_L_WJ_EX: - transform.rot.z = bones[MOTION_BONE_CL_MOMO_L].node[2].transform.rot.z * (float_t)(1.0 / 2.0); + case BLK_N_HIZA_L_WJ_EX: + transform.rot.z = bones[BLK_CL_MOMO_L].node[2].transform.rot.z * (float_t)(1.0 / 2.0); break; - case MOTION_BONE_N_HIZA_R_WJ_EX: - transform.rot.z = bones[MOTION_BONE_CL_MOMO_R].node[2].transform.rot.z * (float_t)(1.0 / 2.0); + case BLK_N_HIZA_R_WJ_EX: + transform.rot.z = bones[BLK_CL_MOMO_R].node[2].transform.rot.z * (float_t)(1.0 / 2.0); break; - case MOTION_BONE_N_MOMO_B_L_WJ_EX: - case MOTION_BONE_N_MOMO_C_L_WJ_EX: - node = &bones[MOTION_BONE_CL_MOMO_L].node[0]; - transform.rot.y = bone_data::limit_angle(node->transform.rot.y + case BLK_N_MOMO_B_L_WJ_EX: + case BLK_N_MOMO_C_L_WJ_EX: + node = &bones[BLK_CL_MOMO_L].node[0]; + transform.rot.y = RobBlock::limit_angle(node->transform.rot.y + node->transform.rot.x) * (float_t)(1.0 / 3.0); break; - case MOTION_BONE_N_MOMO_B_R_WJ_EX: - case MOTION_BONE_N_MOMO_C_R_WJ_EX: - node = &bones[MOTION_BONE_CL_MOMO_R].node[0]; - transform.rot.y = bone_data::limit_angle(node->transform.rot.y + case BLK_N_MOMO_B_R_WJ_EX: + case BLK_N_MOMO_C_R_WJ_EX: + node = &bones[BLK_CL_MOMO_R].node[0]; + transform.rot.y = RobBlock::limit_angle(node->transform.rot.y + node->transform.rot.x) * (float_t)(1.0 / 3.0); break; - case MOTION_BONE_N_HARA_B_WJ_EX: - transform.rot.y = bones[MOTION_BONE_CL_MUNE].node[0].transform.rot.y * (float_t)(1.0 / 3.0) - + bones[MOTION_BONE_KL_KOSI_Y].node[0].transform.rot.y * (float_t)(2.0 / 3.0); + case BLK_N_HARA_B_WJ_EX: + transform.rot.y = bones[BLK_CL_MUNE].node[0].transform.rot.y * (float_t)(1.0 / 3.0) + + bones[BLK_KL_KOSI_Y].node[0].transform.rot.y * (float_t)(2.0 / 3.0); break; - case MOTION_BONE_N_HARA_C_WJ_EX: - transform.rot.y = bones[MOTION_BONE_CL_MUNE].node[0].transform.rot.y * (float_t)(2.0 / 3.0) - + bones[MOTION_BONE_KL_KOSI_Y].node[0].transform.rot.y * (float_t)(1.0 / 3.0); + case BLK_N_HARA_C_WJ_EX: + transform.rot.y = bones[BLK_CL_MUNE].node[0].transform.rot.y * (float_t)(2.0 / 3.0) + + bones[BLK_KL_KOSI_Y].node[0].transform.rot.y * (float_t)(1.0 / 3.0); break; default: return false; @@ -11825,45 +11789,40 @@ bool bone_data::get_ex_rotation(RobTransform& transform, const bone_data* bones) return true; } -void bone_data::get_mat(int32_t skeleton_select) { - if (check_flags_not_null()) +void RobBlock::get_mat(int32_t skeleton_select) { + if (check_expression_id_not_null()) return; - mat4 mat; - if (has_parent) - mat = *parent_mat; - else - mat = mat4_identity; + mat4 mat = inherit_type ? *inherit_mat_ptr : mat4_identity; - if (type == BONE_DATABASE_BONE_POSITION) { - mat4_mul_translate(&mat, &position, &mat); - rot_mat[0] = mat4_identity; + if (ik_type == IKT_0T) { + mat4_mul_translate(&mat, &leaf_pos[0], &mat); + chain_rot[0] = mat4_identity; } - else if (type == BONE_DATABASE_BONE_TYPE_1) { - mat4_inverse_transform_point(&mat, &position, &position); - mat4_mul_translate(&mat, &position, &mat); - rot_mat[0] = mat4_identity; + else if (ik_type == IKT_0N) { + mat4_inverse_transform_point(&mat, &leaf_pos[0], &leaf_pos[0]); + mat4_mul_translate(&mat, &leaf_pos[0], &mat); + chain_rot[0] = mat4_identity; } else { - if (motion_bone_index == MOTION_BONE_KL_EYE_L - || motion_bone_index == MOTION_BONE_KL_EYE_R) { - if (rotation.x > 0.0f) - rotation.x *= eyes_xrot_adjust_pos; - else if (rotation.x < 0.0f) - rotation.x *= eyes_xrot_adjust_neg; + if (block_id == BLK_KL_EYE_L || block_id == BLK_KL_EYE_R) { + if (chain_ang.x > 0.0f) + chain_ang.x *= eyes_xrot_adjust_pos; + else if (chain_ang.x < 0.0f) + chain_ang.x *= eyes_xrot_adjust_neg; } - mat4 rot_mat; - if (type == BONE_DATABASE_BONE_POSITION_ROTATION) - mat4_mul_rotate_zyx(&this->rot_mat[0], &rotation, &rot_mat); + mat4 chain_rot; + if (ik_type == IKT_ROOT) + mat4_mul_rotate_zyx(&this->chain_rot[0], &chain_ang, &chain_rot); else { - position = local_position[skeleton_select]; - mat4_rotate_zyx(&rotation, &rot_mat); + leaf_pos[0] = chain_pos[skeleton_select]; + mat4_rotate_zyx(&chain_ang, &chain_rot); } - mat4_mul_translate(&mat, &position, &mat); - mat4_mul(&rot_mat, &mat, &mat); - this->rot_mat[0] = rot_mat; + mat4_mul_translate(&mat, &leaf_pos[0], &mat); + mat4_mul(&chain_rot, &mat, &mat); + this->chain_rot[0] = chain_rot; } *node[0].mat_ptr = mat; @@ -11871,78 +11830,78 @@ void bone_data::get_mat(int32_t skeleton_select) { get_mat_ik(skeleton_select); } -void bone_data::get_mat_ik(int32_t skeleton_select) { - if (type < BONE_DATABASE_BONE_HEAD_IK_ROTATION) +void RobBlock::get_mat_ik(int32_t skeleton_select) { + if (ik_type < IKT_1) return; mat4 mat = *node[0].mat_ptr; vec3 local_target; - mat4_inverse_transform_point(&mat, &ik_target, &local_target); + mat4_inverse_transform_point(&mat, &leaf_pos[1], &local_target); float_t target_len_xy_sq = vec2::length_squared(*(vec2*)&local_target); float_t target_len_sq = vec3::length_squared(local_target); float_t target_len_xy = sqrtf(target_len_xy_sq); float_t target_len = sqrtf(target_len_sq); - mat4 rot_mat; - if (target_len_xy > 0.000001f && target_len_sq > 0.000001f) { + mat4 chain_rot; + if (fabsf(target_len_xy) > 0.000001f && fabsf(target_len_sq) > 0.000001f) { mat4_rotate_z((1.0f / target_len_xy) * local_target.y, - (1.0f / target_len_xy) * local_target.x, &rot_mat); - mat4_mul_rotate_y(&rot_mat, -(1.0f / target_len) * local_target.z, - (1.0f / target_len) * target_len_xy, &rot_mat); - mat4_mul(&rot_mat, &mat, &mat); + (1.0f / target_len_xy) * local_target.x, &chain_rot); + mat4_mul_rotate_y(&chain_rot, -(1.0f / target_len) * local_target.z, + (1.0f / target_len) * target_len_xy, &chain_rot); + mat4_mul(&chain_rot, &mat, &mat); } else - rot_mat = mat4_identity; + chain_rot = mat4_identity; - if (pole_target_mat) { - vec3 pole_target; - mat4_get_translation(pole_target_mat, &pole_target); - mat4_inverse_transform_point(&mat, &pole_target, &pole_target); - float_t pole_target_length = vec2::length(*(vec2*)&pole_target.y); - if (pole_target_length > 0.000001f) { - pole_target *= 1.0f / pole_target_length; - float_t rot_cos = pole_target.y; - float_t rot_sin = pole_target.z; + if (up_vector_mat_ptr) { + vec3 up_vector; + mat4_get_translation(up_vector_mat_ptr, &up_vector); + mat4_inverse_transform_point(&mat, &up_vector, &up_vector); + float_t up_vector_length = vec2::length(*(vec2*)&up_vector.y); + if (up_vector_length > 0.000001f) { + up_vector *= 1.0f / up_vector_length; + float_t rot_cos = up_vector.y; + float_t rot_sin = up_vector.z; mat4_mul_rotate_x(&mat, rot_sin, rot_cos, &mat); - mat4_mul_rotate_x(&rot_mat, rot_sin, rot_cos, &rot_mat); + mat4_mul_rotate_x(&chain_rot, rot_sin, rot_cos, &chain_rot); } } - if (type == BONE_DATABASE_BONE_HEAD_IK_ROTATION) { - this->rot_mat[1] = rot_mat; + if (ik_type == IKT_1) { + this->chain_rot[1] = chain_rot; *node[1].mat_ptr = mat; - mat4_mul_translate(&mat, ik_segment_length[skeleton_select], 0.0f, 0.0f, &mat); + mat4_mul_translate(&mat, len[0][skeleton_select], 0.0f, 0.0f, &mat); *node[2].mat_ptr = mat; return; } - float_t ik_segment_length = this->ik_segment_length[skeleton_select]; - float_t ik_2nd_segment_length = this->ik_2nd_segment_length[skeleton_select]; + float_t len0 = len[0][skeleton_select]; + float_t len1 = len[1][skeleton_select]; float_t rot_sin; float_t rot_cos; float_t rot_2nd_sin; float_t rot_2nd_cos; if (target_len_sq > 0.000001f) { if (arm_length > 0.0001f) { - float_t max_reach = (ik_segment_length + ik_2nd_segment_length) * arm_length; + float_t max_reach = (len0 + len1) * arm_length; if (target_len > max_reach) { target_len = max_reach; target_len_sq = max_reach * max_reach; } } - float_t proj_length = (target_len_sq - ik_2nd_segment_length * ik_2nd_segment_length) / ik_segment_length; - rot_cos = (proj_length + ik_segment_length) / (2.0f * target_len); - rot_2nd_cos = (proj_length - ik_segment_length) / (2.0f * ik_2nd_segment_length); + float_t proj_length = (target_len_sq - len1 * len1) / len0; + rot_cos = (proj_length + len0) / (2.0f * target_len); + rot_2nd_cos = (proj_length - len0) / (2.0f * len1); rot_cos = clamp_def(rot_cos, -1.0f, 1.0f); rot_2nd_cos = clamp_def(rot_2nd_cos, -1.0f, 1.0f); rot_sin = sqrtf(1.0f - rot_cos * rot_cos); rot_2nd_sin = sqrtf(1.0f - rot_2nd_cos * rot_2nd_cos); - if (type == BONE_DATABASE_BONE_LEGS_IK_ROTATION) + if (ik_type == IKT_2R) rot_sin = -rot_sin; else rot_2nd_sin = -rot_2nd_sin; @@ -11956,57 +11915,53 @@ void bone_data::get_mat_ik(int32_t skeleton_select) { mat4_mul_rotate_z(&mat, rot_sin, rot_cos, &mat); *node[1].mat_ptr = mat; - mat4_mul_rotate_z(&rot_mat, rot_sin, rot_cos, &rot_mat); - this->rot_mat[1] = rot_mat; - mat4_mul_translate(&mat, ik_segment_length, 0.0f, 0.0f, &mat); + mat4_mul_rotate_z(&chain_rot, rot_sin, rot_cos, &chain_rot); + this->chain_rot[1] = chain_rot; + mat4_mul_translate(&mat, len0, 0.0f, 0.0f, &mat); mat4_mul_rotate_z(&mat, rot_2nd_sin, rot_2nd_cos, &mat); *node[2].mat_ptr = mat; - mat4_rotate_z(rot_2nd_sin, rot_2nd_cos, &rot_mat); - this->rot_mat[2] = rot_mat; - mat4_mul_translate(&mat, ik_2nd_segment_length, 0.0f, 0.0f, &mat); + mat4_rotate_z(rot_2nd_sin, rot_2nd_cos, &chain_rot); + this->chain_rot[2] = chain_rot; + mat4_mul_translate(&mat, len1, 0.0f, 0.0f, &mat); *node[3].mat_ptr = mat; } -void bone_data::mult_mat(const mat4& parent_mat, const bone_data* bones, bool solve_ik) { - mat4 mat; - if (has_parent) - mat = *this->parent_mat; - else - mat = parent_mat; +void RobBlock::mult_mat(const mat4& parent_mat, const RobBlock* bones, bool solve_ik) { + mat4 mat = inherit_type ? *inherit_mat_ptr : parent_mat; - if (type != BONE_DATABASE_BONE_TYPE_1 && type != BONE_DATABASE_BONE_POSITION) { - if (type != BONE_DATABASE_BONE_POSITION_ROTATION) - position = local_position[1]; + if (ik_type != IKT_0N && ik_type != IKT_0T) { + if (ik_type != IKT_ROOT) + leaf_pos[0] = chain_pos[1]; - mat4_mul_translate(&mat, &position, &mat); + mat4_mul_translate(&mat, &leaf_pos[0], &mat); if (solve_ik) { node[0].transform.rot = 0.0f; - if (!check_flags_not_null()) - mat4_get_rotation_zyx(&rot_mat[0], &node[0].transform.rot); + if (!check_expression_id_not_null()) + mat4_get_rotation_zyx(&chain_rot[0], &node[0].transform.rot); else if (get_ex_rotation(node[0].transform, bones)) - mat4_rotate_zyx(&node[0].transform.rot, &rot_mat[0]); + mat4_rotate_zyx(&node[0].transform.rot, &chain_rot[0]); else { *node[0].mat_ptr = mat; if (get_constraint_ik(bones)) { - mat4 rot_mat; - mat4_invert_rotation_fast(&mat, &rot_mat); - mat4_mul(node[0].mat_ptr, &rot_mat, &rot_mat); - mat4_clear_trans(&rot_mat, &rot_mat); - mat4_get_rotation_zyx(&rot_mat, &node[0].transform.rot); - this->rot_mat[0] = rot_mat; + mat4 chain_rot; + mat4_invert_rotation_fast(&mat, &chain_rot); + mat4_mul(node[0].mat_ptr, &chain_rot, &chain_rot); + mat4_clear_trans(&chain_rot, &chain_rot); + mat4_get_rotation_zyx(&chain_rot, &node[0].transform.rot); + this->chain_rot[0] = chain_rot; } else - rot_mat[0] = mat4_identity; + chain_rot[0] = mat4_identity; } } - mat4_mul(&rot_mat[0], &mat, &mat); + mat4_mul(&chain_rot[0], &mat, &mat); } else { - mat4_mul_translate(&mat, &position, &mat); + mat4_mul_translate(&mat, &leaf_pos[0], &mat); if (solve_ik) node[0].transform.rot = 0.0f; } @@ -12014,51 +11969,51 @@ void bone_data::mult_mat(const mat4& parent_mat, const bone_data* bones, bool so *node[0].mat_ptr = mat; if (solve_ik) { - node[0].transform.pos = position; + node[0].transform.pos = leaf_pos[0]; node[0].transform.reset_scale(); } - if (type < BONE_DATABASE_BONE_HEAD_IK_ROTATION) + if (ik_type < IKT_1) return; - mat4_mul(&rot_mat[1], &mat, &mat); + mat4_mul(&chain_rot[1], &mat, &mat); *node[1].mat_ptr = mat; - if (type == BONE_DATABASE_BONE_HEAD_IK_ROTATION) { - mat4_mul_translate(&mat, ik_segment_length[1], 0.0f, 0.0f, &mat); + if (ik_type == IKT_1) { + mat4_mul_translate(&mat, len[0][1], 0.0f, 0.0f, &mat); *node[2].mat_ptr = mat; if (solve_ik) { node[1].transform.pos = 0.0f; - mat4_get_rotation_zyx(&rot_mat[1], &node[1].transform.rot); + mat4_get_rotation_zyx(&chain_rot[1], &node[1].transform.rot); node[1].transform.reset_scale(); - node[2].transform.init(ik_segment_length[1], 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + node[2].transform.init(len[0][1], 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); } } else { - mat4_mul_translate(&mat, ik_segment_length[1], 0.0f, 0.0f, &mat); - mat4_mul(&rot_mat[2], &mat, &mat); + mat4_mul_translate(&mat, len[0][1], 0.0f, 0.0f, &mat); + mat4_mul(&chain_rot[2], &mat, &mat); *node[2].mat_ptr = mat; - mat4_mul_translate(&mat, ik_2nd_segment_length[1], 0.0f, 0.0f, &mat); + mat4_mul_translate(&mat, len[1][1], 0.0f, 0.0f, &mat); *node[3].mat_ptr = mat; if (solve_ik) { node[1].transform.pos = 0.0f; - mat4_get_rotation_zyx(&rot_mat[1], &node[1].transform.rot); + mat4_get_rotation_zyx(&chain_rot[1], &node[1].transform.rot); node[1].transform.reset_scale(); - node[2].transform.pos = { ik_segment_length[1], 0.0f, 0.0f }; - mat4_get_rotation_zyx(&rot_mat[2], &node[2].transform.rot); + node[2].transform.pos = { len[0][1], 0.0f, 0.0f }; + mat4_get_rotation_zyx(&chain_rot[2], &node[2].transform.rot); node[2].transform.reset_scale(); - node[3].transform.init(ik_2nd_segment_length[1], 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + node[3].transform.init(len[1][1], 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); } } } -void bone_data::orient_x(const vec3& target) { +void RobBlock::orient_x(const vec3& target) { vec3 x_axis; mat4_inverse_transform_point(node[0].mat_ptr, &target, &x_axis); @@ -12094,16 +12049,16 @@ void bone_data::orient_x(const vec3& target) { vec3 y_axis = vec3::cross(z_axis, x_axis); - mat4 rot_mat; - mat4_set_row(&rot_mat, 0, x_axis.x, x_axis.y, x_axis.z, 0.0f); - mat4_set_row(&rot_mat, 1, y_axis.x, y_axis.y, y_axis.z, 0.0f); - mat4_set_row(&rot_mat, 2, z_axis.x, z_axis.y, z_axis.z, 0.0f); - mat4_set_row(&rot_mat, 3, 0.0f, 0.0f, 0.0f, 1.0f); + mat4 chain_rot; + mat4_set_row(&chain_rot, 0, x_axis.x, x_axis.y, x_axis.z, 0.0f); + mat4_set_row(&chain_rot, 1, y_axis.x, y_axis.y, y_axis.z, 0.0f); + mat4_set_row(&chain_rot, 2, z_axis.x, z_axis.y, z_axis.z, 0.0f); + mat4_set_row(&chain_rot, 3, 0.0f, 0.0f, 0.0f, 1.0f); - mat4_mul(&rot_mat, node[0].mat_ptr, node[0].mat_ptr); + mat4_mul(&chain_rot, node[0].mat_ptr, node[0].mat_ptr); } -void bone_data::orient_x_cns(const vec3& target, float_t weight) { +void RobBlock::orient_x_cns(const vec3& target, float_t weight) { vec3 local_target; mat4_inverse_transform_point(node[0].mat_ptr, &target, &local_target); local_target.x = 0.0f; @@ -12115,7 +12070,7 @@ void bone_data::orient_x_cns(const vec3& target, float_t weight) { } } -void bone_data::orient_y(vec3 y_axis) { +void RobBlock::orient_y(vec3 y_axis) { float_t len; len = vec3::length_squared(y_axis); if (len <= 0.000001f) @@ -12148,94 +12103,92 @@ void bone_data::orient_y(vec3 y_axis) { vec3 x_axis = vec3::cross(y_axis, z_axis); - mat4 rot_mat; - mat4_set_row(&rot_mat, 0, x_axis.x, x_axis.y, x_axis.z, 0.0f); - mat4_set_row(&rot_mat, 1, y_axis.x, y_axis.y, y_axis.z, 0.0f); - mat4_set_row(&rot_mat, 2, z_axis.x, z_axis.y, z_axis.z, 0.0f); - mat4_set_row(&rot_mat, 3, 0.0f, 0.0f, 0.0f, 1.0f); + mat4 chain_rot; + mat4_set_row(&chain_rot, 0, x_axis.x, x_axis.y, x_axis.z, 0.0f); + mat4_set_row(&chain_rot, 1, y_axis.x, y_axis.y, y_axis.z, 0.0f); + mat4_set_row(&chain_rot, 2, z_axis.x, z_axis.y, z_axis.z, 0.0f); + mat4_set_row(&chain_rot, 3, 0.0f, 0.0f, 0.0f, 1.0f); - mat4_mul(&rot_mat, node[0].mat_ptr, node[0].mat_ptr); + mat4_mul(&chain_rot, node[0].mat_ptr, node[0].mat_ptr); } -vec3* bone_data::set_key_data(vec3* keyframe_data, - bone_database_skeleton_type skeleton_type, bool get_data, bool reverse_x) { - if (type == BONE_DATABASE_BONE_POSITION_ROTATION) { +const vec3* RobBlock::set_global_leaf_sub(const vec3* val, BONE_KIND kind, bool get_data, bool flip_x) { + if (ik_type == IKT_ROOT) { if (get_data) { - position = *keyframe_data; - if (reverse_x) - position.x = -position.x; + leaf_pos[0] = *val; + if (flip_x) + leaf_pos[0].x = -leaf_pos[0].x; } - keyframe_data++; + val++; } - else if (type >= BONE_DATABASE_BONE_HEAD_IK_ROTATION - && type <= BONE_DATABASE_BONE_LEGS_IK_ROTATION) { + else if (ik_type == IKT_1 || ik_type == IKT_2 || ik_type == IKT_2R) { if (get_data) { - ik_target = *keyframe_data; - if (reverse_x) - ik_target.x = -ik_target.x; + leaf_pos[1] = *val; + if (flip_x) + leaf_pos[1].x = -leaf_pos[1].x; } - keyframe_data++; + val++; } if (get_data) { - if (type == BONE_DATABASE_BONE_TYPE_1 || type == BONE_DATABASE_BONE_POSITION) { - position = *keyframe_data; - if (reverse_x) - position.x = -position.x; + if (ik_type == IKT_0N || ik_type == IKT_0T) { + leaf_pos[0] = *val; + if (flip_x) + leaf_pos[0].x = -leaf_pos[0].x; } - else if (!flags) { - rotation = *keyframe_data; - if (reverse_x) { + else if (!expression_id) { + chain_ang = *val; + if (flip_x) { const skeleton_rotation_offset* rot_off = skeleton_rotation_offset_array; - size_t index = motion_bone_index; + size_t index = block_id; if (rot_off[index].x) - rotation.x = rot_off[index].rotation.x - rotation.x; + chain_ang.x = rot_off[index].rotation.x - chain_ang.x; if (rot_off[index].y) - rotation.y = rot_off[index].rotation.y - rotation.y; + chain_ang.y = rot_off[index].rotation.y - chain_ang.y; if (rot_off[index].z) - rotation.z = rot_off[index].rotation.z - rotation.z; + chain_ang.z = rot_off[index].rotation.z - chain_ang.z; } } } - keyframe_data++; - return keyframe_data; + val++; + return val; } -void bone_data::store_curr_rot_trans(int32_t skeleton_select) { - if (check_flags_not_null()) +void RobBlock::store_curr_rot_trans(int32_t skeleton_select) { + if (check_expression_id_not_null()) return; - switch (type) { - case BONE_DATABASE_BONE_TYPE_1: - case BONE_DATABASE_BONE_POSITION: - case BONE_DATABASE_BONE_POSITION_ROTATION: - position_prev[skeleton_select] = position; + switch (ik_type) { + case IKT_0N: + case IKT_0T: + case IKT_ROOT: + smooth_pos[skeleton_select] = leaf_pos[0]; break; } - switch (type) { - case BONE_DATABASE_BONE_ROTATION: - rot_mat_prev[0][skeleton_select] = rot_mat[0]; + switch (ik_type) { + case IKT_0: + smooth_rot[0][skeleton_select] = chain_rot[0]; break; - case BONE_DATABASE_BONE_TYPE_1: - case BONE_DATABASE_BONE_POSITION: - case BONE_DATABASE_BONE_POSITION_ROTATION: - rot_mat_prev[0][skeleton_select] = rot_mat[0]; + case IKT_0N: + case IKT_0T: + case IKT_ROOT: + smooth_rot[0][skeleton_select] = chain_rot[0]; break; - case BONE_DATABASE_BONE_HEAD_IK_ROTATION: - rot_mat_prev[0][skeleton_select] = rot_mat[0]; - rot_mat_prev[1][skeleton_select] = rot_mat[1]; + case IKT_1: + smooth_rot[0][skeleton_select] = chain_rot[0]; + smooth_rot[1][skeleton_select] = chain_rot[1]; break; - case BONE_DATABASE_BONE_ARM_IK_ROTATION: - case BONE_DATABASE_BONE_LEGS_IK_ROTATION: - rot_mat_prev[0][skeleton_select] = rot_mat[0]; - rot_mat_prev[1][skeleton_select] = rot_mat[1]; - rot_mat_prev[2][skeleton_select] = rot_mat[2]; + case IKT_2: + case IKT_2R: + smooth_rot[0][skeleton_select] = chain_rot[0]; + smooth_rot[1][skeleton_select] = chain_rot[1]; + smooth_rot[2][skeleton_select] = chain_rot[2]; break; } } -float_t bone_data::limit_angle(float_t angle) { +float_t RobBlock::limit_angle(float_t angle) { bool neg; if (angle < 0.0f) { angle = -angle; @@ -12252,7 +12205,7 @@ float_t bone_data::limit_angle(float_t angle) { } // 0x1401EB410 -void bone_data::orient_to_target(mat4& mat, vec3 target, vec3 source) { +void RobBlock::orient_to_target(mat4& mat, vec3 target, vec3 source) { target = vec3::normalize(target); source = vec3::normalize(source); @@ -12264,8 +12217,8 @@ void bone_data::orient_to_target(mat4& mat, vec3 target, vec3 source) { } bone_data_parent::bone_data_parent() : rob_bone_data(), -motion_bone_count(), leaf_pos(), chain_pos(), global_position(), -global_rotation(), bone_key_set_count(), global_key_set_count(), rot_y() { +motion_bone_count(), leaf_pos(), chain_pos(), +bone_key_set_count(), global_key_set_count(), rot_y() { } @@ -12390,81 +12343,81 @@ void MotionBlendCross::Step(struc_400* a2) { rot_y_mat = mat4_identity; } -void MotionBlendCross::Field_20(prj::sys_vector* bones_curr, prj::sys_vector* bones_prev) { +void MotionBlendCross::Field_20(prj::sys_vector* bones_curr, prj::sys_vector* bones_prev) { if (!bones_curr || !bones_prev) return; - bone_data& n_hara_cp_curr = (*bones_curr)[MOTION_BONE_N_HARA_CP]; - bone_data& n_hara_curr = (*bones_curr)[MOTION_BONE_N_HARA]; - bone_data& n_hara_cp_prev = (*bones_prev)[MOTION_BONE_N_HARA_CP]; - bone_data& n_hara_prev = (*bones_prev)[MOTION_BONE_N_HARA]; - mat4_mul(&n_hara_curr.rot_mat[0], &n_hara_cp_curr.rot_mat[0], &field_64); - mat4_mul(&n_hara_cp_prev.rot_mat[0], &rot_y_mat, &field_A4); - mat4_blend_rotation(&field_A4, &n_hara_cp_curr.rot_mat[0], &n_hara_cp_curr.rot_mat[0], blend); - mat4_mul(&n_hara_prev.rot_mat[0], &field_A4, &field_A4); - mat4_blend_rotation(&n_hara_prev.rot_mat[0], &n_hara_curr.rot_mat[0], &n_hara_curr.rot_mat[0], blend); - mat4_mul(&n_hara_curr.rot_mat[0], &n_hara_cp_curr.rot_mat[0], &field_E4); + RobBlock& n_hara_cp_curr = (*bones_curr)[BLK_N_HARA_CP]; + RobBlock& n_hara_curr = (*bones_curr)[BLK_N_HARA]; + RobBlock& n_hara_cp_prev = (*bones_prev)[BLK_N_HARA_CP]; + RobBlock& n_hara_prev = (*bones_prev)[BLK_N_HARA]; + mat4_mul(&n_hara_curr.chain_rot[0], &n_hara_cp_curr.chain_rot[0], &field_64); + mat4_mul(&n_hara_cp_prev.chain_rot[0], &rot_y_mat, &field_A4); + mat4_blend_rotation(&field_A4, &n_hara_cp_curr.chain_rot[0], &n_hara_cp_curr.chain_rot[0], blend); + mat4_mul(&n_hara_prev.chain_rot[0], &field_A4, &field_A4); + mat4_blend_rotation(&n_hara_prev.chain_rot[0], &n_hara_curr.chain_rot[0], &n_hara_curr.chain_rot[0], blend); + mat4_mul(&n_hara_curr.chain_rot[0], &n_hara_cp_curr.chain_rot[0], &field_E4); mat4_transpose(&field_E4, &field_E4); } -void MotionBlendCross::Blend(bone_data* curr, bone_data* prev) { - if (!curr || !prev || curr->check_flags_not_null()) +void MotionBlendCross::Blend(RobBlock* curr, RobBlock* prev) { + if (!curr || !prev || curr->check_expression_id_not_null()) return; mat4 prev_mat; mat4 mat; mat4 ik_mat; - switch (curr->type) { - case BONE_DATABASE_BONE_ROTATION: + switch (curr->ik_type) { + case IKT_0: default: - if (curr->motion_bone_index == MOTION_BONE_KL_KOSI_Y) { - mat4_mul(&prev->rot_mat[0], &field_A4, &prev_mat); - mat4_mul(&curr->rot_mat[0], &field_64, &mat); + if (curr->block_id == BLK_KL_KOSI_Y) { + mat4_mul(&prev->chain_rot[0], &field_A4, &prev_mat); + mat4_mul(&curr->chain_rot[0], &field_64, &mat); mat4_blend_rotation(&prev_mat, &mat, &mat, blend); - mat4_mul(&mat, &field_E4, &curr->rot_mat[0]); + mat4_mul(&mat, &field_E4, &curr->chain_rot[0]); } - else if (curr->motion_bone_index < 0 || curr->motion_bone_index > MOTION_BONE_N_HARA) - mat4_blend_rotation(&prev->rot_mat[0], &curr->rot_mat[0], &curr->rot_mat[0], blend); + else if (curr->block_id < 0 || curr->block_id > BLK_N_HARA) + mat4_blend_rotation(&prev->chain_rot[0], &curr->chain_rot[0], &curr->chain_rot[0], blend); break; - case BONE_DATABASE_BONE_TYPE_1: - case BONE_DATABASE_BONE_POSITION: - curr->position = vec3::lerp(prev->position, curr->position, blend); + case IKT_0N: + case IKT_0T: + curr->leaf_pos[0] = vec3::lerp(prev->leaf_pos[0], curr->leaf_pos[0], blend); break; - case BONE_DATABASE_BONE_POSITION_ROTATION: + case IKT_ROOT: if (trans_xz) { - curr->position.x = lerp_def(prev->position.x, curr->position.x, blend); - curr->position.z = lerp_def(prev->position.z, curr->position.z, blend); + curr->leaf_pos[0].x = lerp_def(prev->leaf_pos[0].x, curr->leaf_pos[0].x, blend); + curr->leaf_pos[0].z = lerp_def(prev->leaf_pos[0].z, curr->leaf_pos[0].z, blend); } if (trans_y) - curr->position.y = lerp_def(prev->position.y, curr->position.y, blend); + curr->leaf_pos[0].y = lerp_def(prev->leaf_pos[0].y, curr->leaf_pos[0].y, blend); break; - case BONE_DATABASE_BONE_HEAD_IK_ROTATION: - if (curr->motion_bone_index == MOTION_BONE_CL_MUNE) { - mat4_mul(&prev->rot_mat[0], &field_A4, &prev_mat); - mat4_mul(&prev->rot_mat[1], &prev_mat, &prev_mat); - mat4_mul(&curr->rot_mat[0], &field_64, &mat); - mat4_mul(&curr->rot_mat[1], &mat, &mat); + case IKT_1: + if (curr->block_id == BLK_CL_MUNE) { + mat4_mul(&prev->chain_rot[0], &field_A4, &prev_mat); + mat4_mul(&prev->chain_rot[1], &prev_mat, &prev_mat); + mat4_mul(&curr->chain_rot[0], &field_64, &mat); + mat4_mul(&curr->chain_rot[1], &mat, &mat); mat4_blend_rotation(&prev_mat, &mat, &mat, blend); mat4_mul(&mat, &field_E4, &mat); } else { - mat4_mul(&prev->rot_mat[1], &prev->rot_mat[0], &prev_mat); - mat4_mul(&curr->rot_mat[1], &curr->rot_mat[0], &mat); + mat4_mul(&prev->chain_rot[1], &prev->chain_rot[0], &prev_mat); + mat4_mul(&curr->chain_rot[1], &curr->chain_rot[0], &mat); mat4_blend_rotation(&prev_mat, &mat, &mat, blend); } - mat4_transpose(&curr->rot_mat[0], &ik_mat); - mat4_mul(&mat, &ik_mat, &curr->rot_mat[1]); + mat4_transpose(&curr->chain_rot[0], &ik_mat); + mat4_mul(&mat, &ik_mat, &curr->chain_rot[1]); break; - case BONE_DATABASE_BONE_ARM_IK_ROTATION: - case BONE_DATABASE_BONE_LEGS_IK_ROTATION: - mat4_blend_rotation(&prev->rot_mat[2], &curr->rot_mat[2], &curr->rot_mat[2], blend); - mat4_mul(&prev->rot_mat[1], &prev->rot_mat[0], &prev_mat); - mat4_mul(&curr->rot_mat[1], &curr->rot_mat[0], &mat); + case IKT_2: + case IKT_2R: + mat4_blend_rotation(&prev->chain_rot[2], &curr->chain_rot[2], &curr->chain_rot[2], blend); + mat4_mul(&prev->chain_rot[1], &prev->chain_rot[0], &prev_mat); + mat4_mul(&curr->chain_rot[1], &curr->chain_rot[0], &mat); mat4_blend_rotation(&prev_mat, &mat, &mat, blend); - mat4_transpose(&curr->rot_mat[0], &ik_mat); - mat4_mul(&mat, &ik_mat, &curr->rot_mat[1]); + mat4_transpose(&curr->chain_rot[0], &ik_mat); + mat4_mul(&mat, &ik_mat, &curr->chain_rot[1]); break; } } @@ -12570,79 +12523,79 @@ void MotionBlendFreeze::Step(struc_400* a2) { rot_y_mat = mat4_identity; } -void MotionBlendFreeze::Field_20(prj::sys_vector* bones_curr, prj::sys_vector* bones_prev) { +void MotionBlendFreeze::Field_20(prj::sys_vector* bones_curr, prj::sys_vector* bones_prev) { if (!bones_curr) return; - bone_data& n_hara_cp = (*bones_curr)[MOTION_BONE_N_HARA_CP]; - bone_data& n_hara = (*bones_curr)[MOTION_BONE_N_HARA]; - mat4_mul(&n_hara.rot_mat[0], &n_hara_cp.rot_mat[0], &field_74); - mat4_mul(&n_hara_cp.rot_mat_prev[0][field_24], &rot_y_mat, &field_B4); - mat4_blend_rotation(&field_B4, &n_hara_cp.rot_mat[0], &n_hara_cp.rot_mat[0], blend); - mat4_mul(&n_hara.rot_mat_prev[0][field_24], &field_B4, &field_B4); - mat4_blend_rotation(&n_hara.rot_mat_prev[0][field_24], &n_hara.rot_mat[0], &n_hara.rot_mat[0], blend); - mat4_mul(&n_hara.rot_mat[0], &n_hara_cp.rot_mat[0], &field_F4); + RobBlock& n_hara_cp = (*bones_curr)[BLK_N_HARA_CP]; + RobBlock& n_hara = (*bones_curr)[BLK_N_HARA]; + mat4_mul(&n_hara.chain_rot[0], &n_hara_cp.chain_rot[0], &field_74); + mat4_mul(&n_hara_cp.smooth_rot[0][field_24], &rot_y_mat, &field_B4); + mat4_blend_rotation(&field_B4, &n_hara_cp.chain_rot[0], &n_hara_cp.chain_rot[0], blend); + mat4_mul(&n_hara.smooth_rot[0][field_24], &field_B4, &field_B4); + mat4_blend_rotation(&n_hara.smooth_rot[0][field_24], &n_hara.chain_rot[0], &n_hara.chain_rot[0], blend); + mat4_mul(&n_hara.chain_rot[0], &n_hara_cp.chain_rot[0], &field_F4); mat4_transpose(&field_F4, &field_F4); } -void MotionBlendFreeze::Blend(bone_data* curr, bone_data* prev) { - if (!curr || curr->check_flags_not_null()) +void MotionBlendFreeze::Blend(RobBlock* curr, RobBlock* prev) { + if (!curr || curr->check_expression_id_not_null()) return; mat4 prev_mat; mat4 mat; mat4 ik_mat; - switch (curr->type) { - case BONE_DATABASE_BONE_ROTATION: + switch (curr->ik_type) { + case IKT_0: default: - if (curr->motion_bone_index == MOTION_BONE_KL_KOSI_Y) { - mat4_mul(&curr->rot_mat_prev[0][field_24], &field_B4, &prev_mat); - mat4_mul(&curr->rot_mat[0], &field_74, &mat); + if (curr->block_id == BLK_KL_KOSI_Y) { + mat4_mul(&curr->smooth_rot[0][field_24], &field_B4, &prev_mat); + mat4_mul(&curr->chain_rot[0], &field_74, &mat); mat4_blend_rotation(&prev_mat, &mat, &mat, blend); - mat4_mul(&mat, &field_F4, &curr->rot_mat[0]); + mat4_mul(&mat, &field_F4, &curr->chain_rot[0]); } - else if (curr->motion_bone_index < 0 || curr->motion_bone_index > MOTION_BONE_N_HARA) - mat4_blend_rotation(&curr->rot_mat_prev[0][field_24], &curr->rot_mat[0], &curr->rot_mat[0], blend); + else if (curr->block_id < 0 || curr->block_id > BLK_N_HARA) + mat4_blend_rotation(&curr->smooth_rot[0][field_24], &curr->chain_rot[0], &curr->chain_rot[0], blend); break; - case BONE_DATABASE_BONE_TYPE_1: - case BONE_DATABASE_BONE_POSITION: - curr->position = vec3::lerp(curr->position_prev[field_24], curr->position, blend); + case IKT_0N: + case IKT_0T: + curr->leaf_pos[0] = vec3::lerp(curr->smooth_pos[field_24], curr->leaf_pos[0], blend); break; - case BONE_DATABASE_BONE_POSITION_ROTATION: + case IKT_ROOT: if (trans_xz) { - curr->position.x = lerp_def(curr->position_prev[field_24].x, curr->position.x, blend); - curr->position.z = lerp_def(curr->position_prev[field_24].z, curr->position.z, blend); + curr->leaf_pos[0].x = lerp_def(curr->smooth_pos[field_24].x, curr->leaf_pos[0].x, blend); + curr->leaf_pos[0].z = lerp_def(curr->smooth_pos[field_24].z, curr->leaf_pos[0].z, blend); } if (trans_y) - curr->position.y = lerp_def(curr->position_prev[field_24].y, curr->position.y, blend); + curr->leaf_pos[0].y = lerp_def(curr->smooth_pos[field_24].y, curr->leaf_pos[0].y, blend); break; - case BONE_DATABASE_BONE_HEAD_IK_ROTATION: - if (curr->motion_bone_index == MOTION_BONE_CL_MUNE) { - mat4_mul(&curr->rot_mat_prev[0][field_24], &field_B4, &prev_mat); - mat4_mul(&curr->rot_mat_prev[1][field_24], &prev_mat, &prev_mat); - mat4_mul(&curr->rot_mat[0], &field_74, &mat); - mat4_mul(&curr->rot_mat[1], &mat, &mat); + case IKT_1: + if (curr->block_id == BLK_CL_MUNE) { + mat4_mul(&curr->smooth_rot[0][field_24], &field_B4, &prev_mat); + mat4_mul(&curr->smooth_rot[1][field_24], &prev_mat, &prev_mat); + mat4_mul(&curr->chain_rot[0], &field_74, &mat); + mat4_mul(&curr->chain_rot[1], &mat, &mat); mat4_blend_rotation(&prev_mat, &mat, &mat, blend); mat4_mul(&mat, &field_F4, &mat); } else { - mat4_mul(&curr->rot_mat_prev[1][field_24], &curr->rot_mat_prev[0][field_24], &prev_mat); - mat4_mul(&curr->rot_mat[1], &curr->rot_mat[0], &mat); + mat4_mul(&curr->smooth_rot[1][field_24], &curr->smooth_rot[0][field_24], &prev_mat); + mat4_mul(&curr->chain_rot[1], &curr->chain_rot[0], &mat); mat4_blend_rotation(&prev_mat, &mat, &mat, blend); } - mat4_transpose(&curr->rot_mat[0], &ik_mat); - mat4_mul(&mat, &ik_mat, &curr->rot_mat[1]); + mat4_transpose(&curr->chain_rot[0], &ik_mat); + mat4_mul(&mat, &ik_mat, &curr->chain_rot[1]); break; - case BONE_DATABASE_BONE_ARM_IK_ROTATION: - case BONE_DATABASE_BONE_LEGS_IK_ROTATION: - mat4_blend_rotation(&curr->rot_mat_prev[2][field_24], &curr->rot_mat[2], &curr->rot_mat[2], blend); - mat4_mul(&curr->rot_mat_prev[1][field_24], &curr->rot_mat_prev[0][field_24], &prev_mat); - mat4_mul(&curr->rot_mat[1], &curr->rot_mat[0], &mat); + case IKT_2: + case IKT_2R: + mat4_blend_rotation(&curr->smooth_rot[2][field_24], &curr->chain_rot[2], &curr->chain_rot[2], blend); + mat4_mul(&curr->smooth_rot[1][field_24], &curr->smooth_rot[0][field_24], &prev_mat); + mat4_mul(&curr->chain_rot[1], &curr->chain_rot[0], &mat); mat4_blend_rotation(&prev_mat, &mat, &mat, blend); - mat4_transpose(&curr->rot_mat[0], &ik_mat); - mat4_mul(&mat, &ik_mat, &curr->rot_mat[1]); + mat4_transpose(&curr->chain_rot[0], &ik_mat); + mat4_mul(&mat, &ik_mat, &curr->chain_rot[1]); break; } } @@ -12676,40 +12629,40 @@ void PartialMotionBlendFreeze::Step(struc_400* a1) { } void PartialMotionBlendFreeze::Field_20( - prj::sys_vector* bones_curr, prj::sys_vector* bones_prev) { + prj::sys_vector* bones_curr, prj::sys_vector* bones_prev) { } -void PartialMotionBlendFreeze::Blend(bone_data* curr, bone_data* prev) { - if (!curr || curr->check_flags_not_null()) +void PartialMotionBlendFreeze::Blend(RobBlock* curr, RobBlock* prev) { + if (!curr || curr->check_expression_id_not_null()) return; mat4 prev_mat; mat4 mat; mat4 ik_mat; - switch (curr->type) { - case BONE_DATABASE_BONE_ROTATION: + switch (curr->ik_type) { + case IKT_0: default: - mat4_lerp_rotation(&curr->rot_mat_prev[0][0], &curr->rot_mat[0], &curr->rot_mat[0], blend); + mat4_lerp_rotation(&curr->smooth_rot[0][0], &curr->chain_rot[0], &curr->chain_rot[0], blend); break; - case BONE_DATABASE_BONE_POSITION: - case BONE_DATABASE_BONE_TYPE_1: - curr->position = vec3::lerp(curr->position_prev[0], curr->position, blend); + case IKT_0T: + case IKT_0N: + curr->leaf_pos[0] = vec3::lerp(curr->smooth_pos[0], curr->leaf_pos[0], blend); break; - case BONE_DATABASE_BONE_POSITION_ROTATION: - mat4_lerp_rotation(&curr->rot_mat_prev[0][0], &curr->rot_mat[0], &curr->rot_mat[0], blend); - curr->position = vec3::lerp(curr->position_prev[0], curr->position, blend); + case IKT_ROOT: + mat4_lerp_rotation(&curr->smooth_rot[0][0], &curr->chain_rot[0], &curr->chain_rot[0], blend); + curr->leaf_pos[0] = vec3::lerp(curr->smooth_pos[0], curr->leaf_pos[0], blend); break; - case BONE_DATABASE_BONE_ARM_IK_ROTATION: - case BONE_DATABASE_BONE_LEGS_IK_ROTATION: - mat4_lerp_rotation(&curr->rot_mat_prev[2][0], &curr->rot_mat[2], &curr->rot_mat[2], blend); - case BONE_DATABASE_BONE_HEAD_IK_ROTATION: { - mat4_mul(&curr->rot_mat_prev[1][0], &curr->rot_mat_prev[0][0], &prev_mat); - mat4_mul(&curr->rot_mat[1], &curr->rot_mat[0], &mat); + case IKT_2: + case IKT_2R: + mat4_lerp_rotation(&curr->smooth_rot[2][0], &curr->chain_rot[2], &curr->chain_rot[2], blend); + case IKT_1: { + mat4_mul(&curr->smooth_rot[1][0], &curr->smooth_rot[0][0], &prev_mat); + mat4_mul(&curr->chain_rot[1], &curr->chain_rot[0], &mat); mat4_lerp_rotation(&prev_mat, &mat, &mat, blend); - mat4_transpose(&curr->rot_mat[0], &ik_mat); - mat4_mul(&mat, &ik_mat, &curr->rot_mat[1]); + mat4_transpose(&curr->chain_rot[0], &ik_mat); + mat4_mul(&mat, &ik_mat, &curr->chain_rot[1]); } break; } } @@ -12724,9 +12677,9 @@ motion_blend_mot_enabled_bones::~motion_blend_mot_enabled_bones() { // 0x1404146F0 void motion_blend_mot_enabled_bones::check() { - int32_t bone_index = MOTION_BONE_N_HARA_CP; + int32_t bone_index = BLK_N_HARA_CP; for (auto i = arr.begin(); i != arr.end(); i++) { - if (func((motion_bone_index)bone_index)) + if (func((BONE_BLK)bone_index)) *i = true; else *i = false; @@ -12770,24 +12723,24 @@ motion_blend_mot::~motion_blend_mot() { void motion_blend_mot::apply_global_transform() { mat4 mat; mat4_rotate_y(bone_data.rot_y, &mat); - mat4_mul_translate(&mat, &bone_data.global_position, &mat); - mat4_mul_rotate_zyx(&mat, &bone_data.global_rotation, &mat); + mat4_mul_translate(&mat, &bone_data.gblctr_pos, &mat); + mat4_mul_rotate_zyx(&mat, &bone_data.gblctr_rot, &mat); - for (::bone_data& i : bone_data.bones) - switch (i.type) { - case BONE_DATABASE_BONE_TYPE_1: - mat4_transform_point(&mat, &i.position, &i.position); + for (RobBlock& i : bone_data.bones) + switch (i.ik_type) { + case IKT_0N: + mat4_transform_point(&mat, &i.leaf_pos[0], &i.leaf_pos[0]); break; - case BONE_DATABASE_BONE_POSITION_ROTATION: { - mat4 rot_mat; - mat4_clear_trans(&mat, &rot_mat); - i.rot_mat[0] = rot_mat; - mat4_transform_point(&mat, &i.position, &i.position); + case IKT_ROOT: { + mat4 chain_rot; + mat4_clear_trans(&mat, &chain_rot); + i.chain_rot[0] = chain_rot; + mat4_transform_point(&mat, &i.leaf_pos[0], &i.leaf_pos[0]); } break; - case BONE_DATABASE_BONE_HEAD_IK_ROTATION: - case BONE_DATABASE_BONE_ARM_IK_ROTATION: - case BONE_DATABASE_BONE_LEGS_IK_ROTATION: - mat4_transform_point(&mat, &i.ik_target, &i.ik_target); + case IKT_1: + case IKT_2: + case IKT_2R: + mat4_transform_point(&mat, &i.leaf_pos[1], &i.leaf_pos[1]); break; } } @@ -12797,9 +12750,9 @@ void motion_blend_mot::copy_rot_trans() { } // 0x140412BB0 -void motion_blend_mot::copy_rot_trans(const prj::sys_vector<::bone_data>& bones) { - for (::bone_data& i : bone_data.bones) - i.copy_rot_trans(bones[i.motion_bone_index]); +void motion_blend_mot::copy_rot_trans(const prj::sys_vector& bones) { + for (RobBlock& i : bone_data.bones) + i.copy_rot_trans(bones[i.block_id]); } bool motion_blend_mot::get_blend_enable() { @@ -12810,7 +12763,7 @@ bool motion_blend_mot::get_blend_enable() { // 0x140412DA0 void motion_blend_mot::get_n_hara_cp_position(vec3& position) { - position = bone_data.bones[MOTION_BONE_N_HARA_CP].position; + position = bone_data.bones[BLK_N_HARA_CP].leaf_pos[0]; } MotionBlendType motion_blend_mot::get_type() { @@ -12835,24 +12788,24 @@ void motion_blend_mot::init(rob_chara_bone_data* rob_bone_data, } void motion_blend_mot::interpolate() { - vec3* keyframe_data = (vec3*)mot_key_data.key_set_data.data(); - bool reverse = motion_blend_mot::interpolate_get_reverse(field_4F8); + const vec3* fc_value = (const vec3*)mot_key_data.fc_value.data(); + bool flip = motion_blend_mot::interpolate_get_flip(field_4F8); float_t frame = mot_play_data.frame_data.frame; - bone_database_skeleton_type skeleton_type = bone_data.rob_bone_data->base_skeleton_type; - ::bone_data* bones_data = bone_data.bones.data(); + BONE_KIND skeleton_type = bone_data.rob_bone_data->base_skeleton_type; + RobBlock* bones_data = bone_data.bones.data(); for (uint16_t& i : bone_data.bone_indices) { - ::bone_data* data = &bones_data[i]; - bool get_data = enabled_bones.arr[data->motion_bone_index]; - if (reverse && data->mirror != 255) - data = &bones_data[data->mirror]; + RobBlock* data = &bones_data[i]; + bool get_data = enabled_bones.arr[data->block_id]; + if (flip && data->flip_block_id != 0xFF) + data = &bones_data[data->flip_block_id]; if (get_data && frame != data->frame) { mot_key_data.interpolate(frame, data->key_set_offset, data->key_set_count); data->frame = frame; } - keyframe_data = data->set_key_data(keyframe_data, skeleton_type, get_data, reverse); + fc_value = data->set_global_leaf_sub(fc_value, skeleton_type, get_data, flip); } uint32_t bone_key_set_count = bone_data.bone_key_set_count; @@ -12861,9 +12814,9 @@ void motion_blend_mot::interpolate() { mot_key_data.frame = frame; } - keyframe_data = (vec3*)&mot_key_data.key_set_data.data()[bone_key_set_count]; - bone_data.global_position = reverse ? -keyframe_data[0] : keyframe_data[0]; - bone_data.global_rotation = keyframe_data[1]; + const vec3* gbl_fc_value = (const vec3*)&mot_key_data.fc_value.data()[bone_key_set_count]; + bone_data.gblctr_pos = flip ? -gbl_fc_value[0] : gbl_fc_value[0]; + bone_data.gblctr_rot = gbl_fc_value[1]; apply_global_transform(); } @@ -12875,7 +12828,7 @@ void motion_blend_mot::load_file(uint32_t motion_id, MotionBlendType blend_type, bone_data_parent* v7 = &this->bone_data; if (v6) { bone_data_parent_load_bone_indices_from_mot(v7, v6, bone_data, mot_db); - ::bone_data* bone = this->bone_data.bones.data(); + RobBlock* bone = this->bone_data.bones.data(); for (uint16_t& i : this->bone_data.bone_indices) bone[i].frame = -1.0f; } @@ -12893,8 +12846,8 @@ void motion_blend_mot::mult_mat(const mat4* mat) { sub_140414900(&field_4F8, mat); mat4& m = field_4F8.mat; - ::bone_data* bones = bone_data.bones.data(); - for (::bone_data& bone : bone_data.bones) + RobBlock* bones = bone_data.bones.data(); + for (RobBlock& bone : bone_data.bones) bone.mult_mat(m, bones, true); } @@ -12918,8 +12871,8 @@ void motion_blend_mot::reset() { field_4F8.field_C8 = 0.0f; } -inline void motion_blend_mot::set_arm_length(motion_bone_index motion_bone_index, float_t value) { - bone_data.bones.data()[motion_bone_index].arm_length = value; +inline void motion_blend_mot::set_arm_length(BONE_BLK block_id, float_t value) { + bone_data.bones.data()[block_id].arm_length = value; } void motion_blend_mot::set_blend(MotionBlendType blend_type, float_t blend) { @@ -12960,15 +12913,15 @@ void motion_blend_mot::set_step(float_t step) { // 0x140412E10 void motion_blend_mot::store_curr_rot_trans(int32_t skeleton_select) { - for (::bone_data& i : bone_data.bones) - if (enabled_bones.arr[i.motion_bone_index]) { + for (RobBlock& i : bone_data.bones) + if (enabled_bones.arr[i.block_id]) { i.store_curr_rot_trans(skeleton_select); - if (i.type == BONE_DATABASE_BONE_POSITION_ROTATION && (field_4F8.field_0 & 0x02)) - i.position_prev[skeleton_select] += field_4F8.field_90; + if (i.ik_type == IKT_ROOT && (field_4F8.field_0 & 0x02)) + i.smooth_pos[skeleton_select] += field_4F8.field_90; } } -bool motion_blend_mot::interpolate_get_reverse(struc_308& a1) { +bool motion_blend_mot::interpolate_get_flip(struc_308& a1) { return a1.field_0 & 0x01 && !(a1.field_0 & 0x08) || !(a1.field_0 & 0x01) && a1.field_0 & 0x08; } @@ -12987,27 +12940,27 @@ partial_motion_blend_mot::~partial_motion_blend_mot() { } -void partial_motion_blend_mot::init(bone_database_skeleton_type type, +void partial_motion_blend_mot::init(BONE_KIND type, PFNMOTIONBONECHECKFUNC check_func, size_t motion_bone_count, const bone_database* bone_data) { mot_key_data_init(&mot_key_data, type, bone_data); enabled_bones.init(check_func, motion_bone_count); } -void partial_motion_blend_mot::interpolate(prj::sys_vector& bones, - const prj::sys_vector* bone_indices, bone_database_skeleton_type skeleton_type) { +void partial_motion_blend_mot::interpolate(prj::sys_vector& bones, + const prj::sys_vector* bone_indices, BONE_KIND skeleton_type) { if (!mot_key_data.key_sets_ready || !mot_key_data.mot_data || disable) return; float_t frame = mot_play_data.frame_data.frame; - vec3* keyframe_data = (vec3*)mot_key_data.key_set_data.data(); + const vec3* fc_value = (const vec3*)mot_key_data.fc_value.data(); for (const uint16_t& i : *bone_indices) { - bone_data* data = &bones[i]; - bool get_data = enabled_bones.arr[data->motion_bone_index]; + RobBlock* data = &bones[i]; + bool get_data = enabled_bones.arr[data->block_id]; if (get_data) { mot_key_data.interpolate(frame, data->key_set_offset, data->key_set_count); data->frame = frame; } - keyframe_data = data->set_key_data(keyframe_data, skeleton_type, get_data, false); + fc_value = data->set_global_leaf_sub(fc_value, skeleton_type, get_data, false); } } @@ -13030,9 +12983,9 @@ void partial_motion_blend_mot::set_step(float_t step) { } // 0x140412F20 -void partial_motion_blend_mot::store_curr_rot_trans(prj::sys_vector& bones) { - for (bone_data& i : bones) - if (enabled_bones.arr[i.motion_bone_index]) +void partial_motion_blend_mot::store_curr_rot_trans(prj::sys_vector& bones) { + for (RobBlock& i : bones) + if (enabled_bones.arr[i.block_id]) i.store_curr_rot_trans(0); } @@ -13186,8 +13139,8 @@ void rob_chara_sleeve_adjust::reset() { rob_chara_bone_data::rob_chara_bone_data() : field_0(), field_1(), object_bone_count(), node_count(), motion_bone_count(), leaf_pos(), chain_pos(), disable_eye_motion(), look_anim() { - base_skeleton_type = BONE_DATABASE_SKELETON_NONE; - skeleton_type = BONE_DATABASE_SKELETON_NONE; + base_skeleton_type = BONE_KIND_NONE; + skeleton_type = BONE_KIND_NONE; } rob_chara_bone_data::~rob_chara_bone_data() { @@ -13256,9 +13209,9 @@ void rob_chara_bone_data::interpolate() { for (motion_blend_mot*& i : motion_loaded) i->interpolate(); - bone_database_skeleton_type skeleton_type = base_skeleton_type; + BONE_KIND skeleton_type = base_skeleton_type; motion_blend_mot* v5 = motion_loaded.front(); - prj::sys_vector& bones = v5->bone_data.bones; + prj::sys_vector& bones = v5->bone_data.bones; prj::sys_vector* bone_indices = &v5->bone_data.bone_indices; face.interpolate(bones, bone_indices, skeleton_type); hand_l.interpolate(bones, bone_indices, skeleton_type); @@ -13470,8 +13423,8 @@ void rob_chara_bone_data::reset() { mats.clear(); mats2.clear(); nodes.clear(); - base_skeleton_type = BONE_DATABASE_SKELETON_NONE; - skeleton_type = BONE_DATABASE_SKELETON_NONE; + base_skeleton_type = BONE_KIND_NONE; + skeleton_type = BONE_KIND_NONE; if (motions.size() == 3) { rob_chara_bone_data_motion_blend_mot_list_free(this, 0); @@ -13655,7 +13608,7 @@ void rob_chara_bone_data::update(const mat4* mat) { } rob_chara_pv_data::rob_chara_pv_data() : type(), field_4(), field_5(), -field_6(), rot_y_int16(), field_16(), sleeve_l(), sleeve_r(), field_70(), +field_6(), yang(), field_16(), sleeve_l(), sleeve_r(), field_70(), motion_face_ids(), chara_size_index(), height_adjust(), item() { reset(); } @@ -13666,7 +13619,7 @@ void rob_chara_pv_data::reset() { field_5 = false; field_6 = false; field_8 = 0.0f; - rot_y_int16 = 0; + yang = 0; field_16 = 0xC9; sleeve_l = {}; sleeve_r = {}; @@ -13684,7 +13637,7 @@ RobSkinOfs::RobSkinOfs() : flag() { } rob_chara_item_equip_object::rob_chara_item_equip_object() : index(), motion_matrix(), -obj_info(), obj_uid_sub(), alpha(), obj_flags(), can_disp(), bone_kind(), +obj_uid(), obj_uid_sub(), alpha(), obj_flags(), can_disp(), bone_kind(), mat(), init_cnt(), motion_node(), field_138(), osage_depends_on_others(), osage_nodes_count(), use_opd(), skin_ex_data(), skin(), rob_disp() { init_members(0x12345678); @@ -13714,7 +13667,7 @@ void rob_chara_item_equip_object::check_no_opd(std::vector& opd_ for (::opd_blend_data& i : opd_blend_data) { const float_t* opd_data = 0; uint32_t opd_count = 0; - osage_play_data_manager_get_opd_file_data(obj_info, i.motion_id, opd_data, opd_count); + osage_play_data_manager_get_opd_file_data(obj_uid, i.motion_id, opd_data, opd_count); if (!opd_data) { use_opd = false; break; @@ -13757,7 +13710,7 @@ void rob_chara_item_equip_object::clear_ex_data() { } void rob_chara_item_equip_object::disp(const mat4& mat, render_context* rctx) { - if (obj_info.is_null()) + if (obj_uid.is_null()) return; mdl::ObjFlags flags = rctx->disp_manager->get_obj_flags(); @@ -13768,7 +13721,7 @@ void rob_chara_item_equip_object::disp(const mat4& mat, render_context* rctx) { enum_and(chara_flags, ~mdl::OBJ_ALPHA_ORDER); rctx->disp_manager->set_obj_flags(chara_flags); if (can_disp) { - rctx->disp_manager->entry_obj_by_object_info_object_skin(obj_info, + rctx->disp_manager->entry_obj_by_object_info_object_skin(obj_uid, &texchg_vec, &skn_col, alpha, motion_matrix, matrix.data(), 0, mat); for (ExNodeBlock*& i : ex_node_block) @@ -13778,24 +13731,23 @@ void rob_chara_item_equip_object::disp(const mat4& mat, render_context* rctx) { } int32_t rob_chara_item_equip_object::get_node_index(const char* name, const bone_database* bone_data) const { - int32_t bone_index = bone_data->get_skeleton_motion_bone_index( - bone_database_skeleton_type_to_string(BONE_DATABASE_SKELETON_COMMON), name); - if (bone_index == -1) + int32_t node_index = bone_data->get_bone_node_index(BONE_KIND_CMN, name); + if (node_index == -1) for (auto& i : node_name_map) if (!str_utils_compare(name, i.first)) return 0x8000 | i.second; - return bone_index; + return node_index; } -const bone_node* rob_chara_item_equip_object::get_node(int32_t bone_index) const { - if (!(bone_index & 0x8000)) - return &motion_node[bone_index & 0x7FFF]; - else if ((bone_index & 0x7FFF) < ex_node.size()) - return &ex_node[bone_index & 0x7FFF]; +const RobNode* rob_chara_item_equip_object::get_node(int32_t index) const { + if (!(index & 0x8000)) + return &motion_node[index & 0x7FFF]; + else if ((index & 0x7FFF) < ex_node.size()) + return &ex_node[index & 0x7FFF]; return 0; } -const bone_node* rob_chara_item_equip_object::get_node(const char* name, const bone_database* bone_data) const { +const RobNode* rob_chara_item_equip_object::get_node(const char* name, const bone_database* bone_data) const { return get_node(get_node_index(name, bone_data)); } @@ -13803,7 +13755,7 @@ const mat4* rob_chara_item_equip_object::get_ex_data_bone_node_mat(const char* n if (!name || !ex_node.size()) return &mat4_identity; - for (bone_node& i : ex_node) + for (RobNode& i : ex_node) if (!str_utils_compare(i.name, name)) return i.mat_ptr; @@ -13834,42 +13786,16 @@ RobJointNode* rob_chara_item_equip_object::get_normal_ref_osage_node(const std:: return node; } -void rob_chara_item_equip_object::get_parent_bone_nodes(bone_node* motion_node, const bone_database* bone_data) { - this->motion_node = motion_node; - motion_matrix = motion_node->mat_ptr; +void rob_chara_item_equip_object::set_motion_node(const RobNode* mot_node, const bone_database* bone_data) { + motion_node = mot_node; + motion_matrix = mot_node->mat_ptr; for (ExNodeBlock*& i : ex_node_block) i->parent = get_node(i->parent_name.c_str(), bone_data); } -void rob_chara_item_equip_object::init_ex_data_bone_nodes(obj_skin_ex_data* ex_data) { - ex_node.clear(); - matrix.clear(); - no_scale_matrix.clear(); - - int32_t nb_node_name = ex_data->nb_node_name; - ex_node.resize(nb_node_name); - matrix.resize(nb_node_name); - no_scale_matrix.resize(nb_node_name); - - bone_node* motion_node = ex_node.data(); - mat4* mat = matrix.data(); - mat4* no_scale_mat = no_scale_matrix.data(); - for (int32_t i = 0; i < nb_node_name; i++) - motion_node[i].mat_ptr = &mat[i]; - - if (ex_data->ex_node_name) { - node_name_map.clear(); - const char** ex_node_name = ex_data->ex_node_name; - for (int32_t i = 0; i < nb_node_name; i++) { - motion_node[i].set_name_mat_no_scale_mat(ex_node_name[i], &mat[i], &no_scale_mat[i]); - node_name_map.push_back(ex_node_name[i], i); - } - } -} - void rob_chara_item_equip_object::init_members(size_t index) { this->index = index; - obj_info = {}; + obj_uid = {}; obj_uid_sub = {}; motion_matrix = 0; texchg_vec.clear(); @@ -13895,7 +13821,147 @@ void rob_chara_item_equip_object::init_members(size_t index) { osage_nodes_count = 0; } -void rob_chara_item_equip_object::load_ex_data(obj_skin_ex_data* ex_data, +void rob_chara_item_equip::load_outfit_object_info(ROB_PARTS_KIND rpk, object_info obj_info, + bool osage_reset, const bone_database* bone_data, void* data, const object_database* obj_db) { + if (rpk < RPK_BASE_BEGIN && rpk > RPK_BASE_END) + obj_info = {}; + set_item(obj_info, rpk, osage_reset, bone_data, data, obj_db); +} + +// 0x1405F4820 +void rob_chara_item_equip_object::pos_reset(int32_t init_cnt) { + if (!ex_node_block.size()) + return; + + auto pos_init = &ExNodeBlock::pos_init; + auto pos_init_cont = &ExNodeBlock::pos_init_cont; + + for (ExNodeBlock*& i : ex_node_block) + (i->*pos_init)(); + + for (; init_cnt; init_cnt--) { + if (osage_depends_on_others) + rob_chara_item_equip_object_ctrl_step(this, true); + + for (ExNodeBlock*& i : ex_node_block) + (i->*pos_init_cont)(); + } +} + +void rob_chara_item_equip_object::reset_ex_force() { + for (ExOsageBlock*& i : osage_blk) + i->reset_ex_force(); + for (ExClothBlock*& i : cloth) + i->reset_ex_force(); +} + +void rob_chara_item_equip_object::reset_nodes_ex_force(rob_osage_parts_bit parts_bits) { + for (ExOsageBlock*& i : osage_blk) + if (i->osage_work.CheckPartsBits(parts_bits)) { + i->osage_work.SetNodesExternalForce(0, 1.0f); + i->osage_work.SetNodesForce(1.0f); + } +} + +void rob_chara_item_equip_object::set(object_info objuid, const RobNode* mot_node, + bool osage_reset, const bone_database* bone_data, void* data, const object_database* obj_db) { + obj_uid = objuid; + motion_node = mot_node; + motion_matrix = mot_node->mat_ptr; + ex_node.clear(); + node_name_map.clear(); + matrix.clear(); + clear_ex_data(); + + obj_skin* skin = objset_info_storage_get_obj_skin(obj_uid); + if (!skin) + return; + + this->skin = skin; + if (!skin->ex_data) + return; + + skin_ex_data = skin->ex_data; + set_ex_node(skin->ex_data); + set_ex_node_block(skin->ex_data, bone_data, data, obj_db); + + if (osage_reset && osage_blk.size()) + init_cnt = 60; +} + +void rob_chara_item_equip_object::set_alpha_obj_flags(float_t alpha, int32_t flags) { + obj_flags = (mdl::ObjFlags)flags; + this->alpha = clamp_def(alpha, 0.0f, 1.0f); +} + +bool rob_chara_item_equip_object::set_boc( + const skin_param_osage_root& skp_root, ExOsageBlock* osg) { + RobOsage& osage_work = osg->osage_work; + osage_work.dest_boc(); + + bool has_boc_node = false; + for (const skin_param_osage_root_boc& i : skp_root.boc) + for (ExOsageBlock*& j : osage_blk) { + if (i.ed_root.compare(j->name) + || i.ed_node + 1ULL >= osage_work.joint_node_vec.size() + || i.st_node + 1ULL >= j->osage_work.joint_node_vec.size()) + continue; + + RobJointNode* ed_node = osage_work.get_joint_node(i.ed_node + 1ULL); + RobJointNode* st_node = j->osage_work.get_joint_node(i.st_node + 1ULL); + ed_node->data_ptr->boc.push_back(st_node); + has_boc_node = true; + break; + } + return has_boc_node; +} + +void rob_chara_item_equip_object::set_collision_target_osage( + const skin_param_osage_root& skp_root, skin_param* skp) { + if (!skp_root.colli_tgt_osg.size()) + return; + + const char* colli_tgt_osg = skp_root.colli_tgt_osg.c_str(); + for (ExOsageBlock*& i : osage_blk) + if (!str_utils_compare(colli_tgt_osg, i->name)) { + skp->colli_tgt_osg = &i->osage_work.joint_node_vec; + break; + } +} + +void rob_chara_item_equip_object::set_disable_collision(rob_osage_parts_bit parts_bits, bool disable) { + for (ExOsageBlock*& i : osage_blk) + if (i->osage_work.CheckPartsBits(parts_bits)) + i->SetDisableCollision(disable); +} + +void rob_chara_item_equip_object::set_ex_node(obj_skin_ex_data* ex_data) { + ex_node.clear(); + matrix.clear(); + no_scale_matrix.clear(); + + int32_t nb_node_name = ex_data->nb_node_name; + ex_node.resize(nb_node_name); + matrix.resize(nb_node_name); + no_scale_matrix.resize(nb_node_name); + + RobNode* motion_node = ex_node.data(); + mat4* mat = matrix.data(); + mat4* no_scale_mat = no_scale_matrix.data(); + for (int32_t i = 0; i < nb_node_name; i++) + motion_node[i].mat_ptr = &mat[i]; + + if (ex_data->ex_node_name) { + node_name_map.clear(); + const char** ex_node_name = ex_data->ex_node_name; + for (int32_t i = 0; i < nb_node_name; i++) { + motion_node[i].set_name_mat_no_scale_mat(ex_node_name[i], &mat[i], &no_scale_mat[i]); + node_name_map.push_back(ex_node_name[i], i); + } + } +} + +void rob_chara_item_equip_object::set_ex_node_block(obj_skin_ex_data* ex_data, const bone_database* bone_data, void* data, const object_database* obj_db) { if (!ex_data->ex_node_table) return; @@ -13946,7 +14012,7 @@ void rob_chara_item_equip_object::load_ex_data(obj_skin_ex_data* ex_data, ex_node = exp; expression.push_back(exp); exp->set_data(this, block->expression, - ex_node_name[block->expression->node_name & 0x7FFF], obj_info, index, bone_data); + ex_node_name[block->expression->node_name & 0x7FFF], obj_uid, index, bone_data); expression_count++; } break; case OBJ_SKIN_EX_NODE_OSAGE: { @@ -13985,7 +14051,7 @@ void rob_chara_item_equip_object::load_ex_data(obj_skin_ex_data* ex_data, transform.hsc = 1.0f; ex_node->parent_name = b_transform->parent_name; - const bone_node* parent = get_node(b_transform->parent_name, bone_data); + const RobNode* parent = get_node(b_transform->parent_name, bone_data); ex_node->parent = parent; if (ex_node->dst_node) { ex_node->dst_node->transform = transform; @@ -14016,7 +14082,7 @@ void rob_chara_item_equip_object::load_ex_data(obj_skin_ex_data* ex_data, for (ExOsageBlock*& i : osage_blk) { ExOsageBlock* osg = i; const ExNodeBlock* parent_node = osg->parent_node; - const bone_node* parent = 0; + const RobNode* parent = 0; if (!parent_node || osg->is_parent) parent = osg->parent; else { @@ -14071,120 +14137,6 @@ void rob_chara_item_equip_object::load_ex_data(obj_skin_ex_data* ex_data, this->osage_nodes_count = osage_nodes_count; } -void rob_chara_item_equip_object::load_object_info_ex_data(object_info obj_info, const bone_node* motion_node, - bool osage_reset, const bone_database* bone_data, void* data, const object_database* obj_db) { - this->obj_info = obj_info; - this->motion_node = motion_node; - motion_matrix = motion_node->mat_ptr; - ex_node.clear(); - node_name_map.clear(); - matrix.clear(); - clear_ex_data(); - - obj_skin* skin = objset_info_storage_get_obj_skin(this->obj_info); - if (!skin) - return; - - this->skin = skin; - if (!skin->ex_data) - return; - - this->skin_ex_data = skin->ex_data; - init_ex_data_bone_nodes(skin->ex_data); - load_ex_data(skin->ex_data, bone_data, data, obj_db); - - if (osage_reset && osage_blk.size()) - init_cnt = 60; -} - -void rob_chara_item_equip::load_outfit_object_info(item_id id, object_info obj_info, - bool osage_reset, const bone_database* bone_data, void* data, const object_database* obj_db) { - if (id <= ITEM_BODY && id >= ITEM_KAMI) - obj_info = {}; - load_object_info(obj_info, id, osage_reset, bone_data, data, obj_db); -} - -// 0x1405F4820 -void rob_chara_item_equip_object::pos_reset(int32_t init_cnt) { - if (!ex_node_block.size()) - return; - - auto pos_init = &ExNodeBlock::pos_init; - auto pos_init_cont = &ExNodeBlock::pos_init_cont; - - for (ExNodeBlock*& i : ex_node_block) - (i->*pos_init)(); - - for (; init_cnt; init_cnt--) { - if (osage_depends_on_others) - rob_chara_item_equip_object_ctrl_step(this, true); - - for (ExNodeBlock*& i : ex_node_block) - (i->*pos_init_cont)(); - } -} - -void rob_chara_item_equip_object::reset_ex_force() { - for (ExOsageBlock*& i : osage_blk) - i->reset_ex_force(); - for (ExClothBlock*& i : cloth) - i->reset_ex_force(); -} - -void rob_chara_item_equip_object::reset_nodes_ex_force(rob_osage_parts_bit parts_bits) { - for (ExOsageBlock*& i : osage_blk) - if (i->osage_work.CheckPartsBits(parts_bits)) { - i->osage_work.SetNodesExternalForce(0, 1.0f); - i->osage_work.SetNodesForce(1.0f); - } -} - -void rob_chara_item_equip_object::set_alpha_obj_flags(float_t alpha, int32_t flags) { - obj_flags = (mdl::ObjFlags)flags; - this->alpha = clamp_def(alpha, 0.0f, 1.0f); -} - -bool rob_chara_item_equip_object::set_boc( - const skin_param_osage_root& skp_root, ExOsageBlock* osg) { - RobOsage& osage_work = osg->osage_work; - osage_work.dest_boc(); - - bool has_boc_node = false; - for (const skin_param_osage_root_boc& i : skp_root.boc) - for (ExOsageBlock*& j : osage_blk) { - if (i.ed_root.compare(j->name) - || i.ed_node + 1ULL >= osage_work.joint_node_vec.size() - || i.st_node + 1ULL >= j->osage_work.joint_node_vec.size()) - continue; - - RobJointNode* ed_node = osage_work.get_joint_node(i.ed_node + 1ULL); - RobJointNode* st_node = j->osage_work.get_joint_node(i.st_node + 1ULL); - ed_node->data_ptr->boc.push_back(st_node); - has_boc_node = true; - break; - } - return has_boc_node; -} - -void rob_chara_item_equip_object::set_collision_target_osage( - const skin_param_osage_root& skp_root, skin_param* skp) { - if (!skp_root.colli_tgt_osg.size()) - return; - - const char* colli_tgt_osg = skp_root.colli_tgt_osg.c_str(); - for (ExOsageBlock*& i : osage_blk) - if (!str_utils_compare(colli_tgt_osg, i->name)) { - skp->colli_tgt_osg = &i->osage_work.joint_node_vec; - break; - } -} - -void rob_chara_item_equip_object::set_disable_collision(rob_osage_parts_bit parts_bits, bool disable) { - for (ExOsageBlock*& i : osage_blk) - if (i->osage_work.CheckPartsBits(parts_bits)) - i->SetDisableCollision(disable); -} - void rob_chara_item_equip_object::set_motion_reset_data(uint32_t motion_id, float_t frame) { for (ExOsageBlock*& i : osage_blk) i->SetMotionResetData(motion_id, frame); @@ -14194,11 +14146,11 @@ void rob_chara_item_equip_object::set_motion_reset_data(uint32_t motion_id, floa } void rob_chara_item_equip_object::set_motion_skin_param(int8_t chara_id, uint32_t motion_id, int32_t frame) { - if (obj_info.is_null()) + if (obj_uid.is_null()) return; std::vector* skp_file_data - = skin_param_manager_get_skin_param_file_data(chara_id, obj_info, motion_id, frame); + = skin_param_manager_get_skin_param_file_data(chara_id, obj_uid, motion_id, frame); if (!skp_file_data) return; @@ -14273,7 +14225,7 @@ void rob_chara_item_equip_object::skp_load(void* kv, const bone_database* bone_d for (ExOsageBlock*& i : osage_blk) { ExOsageBlock* osg = i; skin_param_osage_root root; - osg->osage_work.LoadSkinParam(_kv, osg->name, root, &obj_info, bone_data); + osg->osage_work.LoadSkinParam(_kv, osg->name, root, obj_uid, bone_data); set_collision_target_osage(root, osg->osage_work.skin_param_ptr); osage_depends_on_others |= set_boc(root, osg); osage_depends_on_others |= root.coli_type != SkinParam::RootCollisionTypeEnd; @@ -14321,14 +14273,14 @@ bool rob_chara_item_equip_object::skp_load_boc( void rob_chara_item_equip_object::skp_load_file(void* data, const bone_database* bone_data, const object_database* obj_db) { - key_val* kv_ptr = skin_param_storage_get_key_val(obj_info); + key_val* kv_ptr = skin_param_storage_get_key_val(obj_uid); if (kv_ptr) { skp_load(kv_ptr, bone_data); return; } std::string buf = string_to_lower(sprintf_s_string( - "ext_skp_%s.txt", obj_db->get_object_name(obj_info))); + "ext_skp_%s.txt", obj_db->get_object_name(obj_uid))); key_val kv; ((data_struct*)data)->load_file(&kv, "rom/skin_param/", buf.c_str(), key_val::load_file); @@ -14357,48 +14309,45 @@ bool rob_chara_item_equip_object::skp_load_normal_ref( return true; } -rob_chara_item_equip::rob_chara_item_equip() : bone_nodes(), matrices(), item_equip_object(), field_18(), -item_equip_range(), first_item_equip_object(), max_item_equip_object(), field_A0(), shadow_type(), position(), -field_D4(), disable_update(), field_DC(), texture_color_coefficients(), wet(), wind_strength(), chara_color(), -npr_flag(), mat(), field_13C(), field_8BC(), field_8C0(), field_8C4(), field_8C8(), field_8CC(), -field_8D0(), field_8D4(), field_8D8(), field_8DC(), field_8E0(), field_8E4(), field_8E8(), field_8EC(), -field_8F0(), field_8F4(), field_8F8(), field_8FC(), field_900(), field_908(), field_910(), field_918(), -field_920(), field_928(), field_930(), use_opd(), parts_short(), parts_append(), parts_white_one_l() { - item_equip_object = new rob_chara_item_equip_object[ITEM_MAX]; +rob_chara_item_equip::rob_chara_item_equip() : motion_node(), motion_matrix(), skin_disp(), +parts_attr(), one_skin(), disp_begin(), disp_max(), shadow_flag(), shadow_group(), position(), +hyoutan_rpk(), disable_update(), field_DC(), skin_color(), wet(), wind_strength(), chara_color(), +npr_flag(), shadow_skin(), use_opd(), parts_short(), parts_append(), parts_white_one_l() { + skin_disp = new rob_chara_item_equip_object[RPK_MAX]; wind_strength = 1.0f; chara_color = true; osage_step = 1.0f; - for (int32_t i = ITEM_BODY; i < ITEM_MAX; i++) - item_equip_object[i].rob_disp = this; + for (int32_t i = 0; i < RPK_MAX; i++) + skin_disp[i].rob_disp = this; } rob_chara_item_equip::~rob_chara_item_equip() { reset(); - if (item_equip_object) { - delete[] item_equip_object; - item_equip_object = 0; + if (skin_disp) { + delete[] skin_disp; + skin_disp = 0; } } void rob_chara_item_equip::add_motion_reset_data(uint32_t motion_id, float_t frame, int32_t iterations) { - for (int32_t i = first_item_equip_object; i < max_item_equip_object; i++) - item_equip_object[i].add_motion_reset_data(motion_id, frame, iterations); + for (int32_t i = disp_begin; i < disp_max; i++) + skin_disp[i].add_motion_reset_data(motion_id, frame, iterations); } -static void sub_140512C20(rob_chara_item_equip* rob_itm_equip, render_context* rctx) { - if (rob_itm_equip->field_D0.is_null() || rob_itm_equip->field_D4 == ITEM_NONE) +static void sub_140512C20(rob_chara_item_equip* rob_disp, render_context* rctx) { + if (rob_disp->hyoutan_obj.is_null() || rob_disp->hyoutan_rpk == RPK_NONE) return; mat4 mat = mat4_identity; const char* name; - if (rob_itm_equip->field_DC == 1) { + if (rob_disp->field_DC == 1) { name = "kl_te_r_wj"; mat4_translate(0.0f, 0.0f, 0.082f, &mat); mat4_mul_rotate_zyx(&mat, (float_t)(-90.9 * DEG_TO_RAD), 0.0f, (float_t)(-179.5 * DEG_TO_RAD), &mat); } - if (rob_itm_equip->field_DC == 2) { + if (rob_disp->field_DC == 2) { name = "kl_te_l_wj"; mat4_translate(0.0f, 0.0015f, -0.0812f, &mat); mat4_mul_rotate_zyx(&mat, (float_t)(-34.5 * DEG_TO_RAD), 0.0f, (float_t)(-179.5 * DEG_TO_RAD), &mat); @@ -14409,16 +14358,16 @@ static void sub_140512C20(rob_chara_item_equip* rob_itm_equip, render_context* r data_struct* aft_data = &data_list[DATA_AFT]; bone_database* aft_bone_data = &aft_data->data_ft.bone_data; - const bone_node* node = rob_itm_equip->item_equip_object[rob_itm_equip->field_D4].get_node(name, aft_bone_data); + const RobNode* node = rob_disp->skin_disp[rob_disp->hyoutan_rpk].get_node(name, aft_bone_data); if (!node || !node->mat_ptr) return; mat4_mul(node->mat_ptr, &mat, &mat); - int32_t tex_pat_count = (int32_t)rob_itm_equip->texture_pattern.size(); - if (tex_pat_count) - rctx->disp_manager->set_texture_pattern(tex_pat_count, rob_itm_equip->texture_pattern.data()); - rctx->disp_manager->entry_obj_by_object_info(mat, rob_itm_equip->field_D0); - if (tex_pat_count) + int32_t num_texchg = (int32_t)rob_disp->hyoutan_texchg_list.size(); + if (num_texchg) + rctx->disp_manager->set_texture_pattern(num_texchg, rob_disp->hyoutan_texchg_list.data()); + rctx->disp_manager->entry_obj_by_object_info(mat, rob_disp->hyoutan_obj); + if (num_texchg) rctx->disp_manager->set_texture_pattern(); } @@ -14434,23 +14383,23 @@ void rob_chara_item_equip::disp(int32_t chara_id, render_context* rctx) { enum_or(flags, mdl::OBJ_REFRACT); mdl::DispManager& disp_manager = *rctx->disp_manager; - if (shadow_type != -1) { - if (field_A0 & 0x04) { + if (shadow_group != -1) { + if (shadow_flag & 0x04) { vec3 pos = position; pos.y -= 0.2f; - shadow_ptr_get()->positions[shadow_type].push_back(pos); + shadow_ptr_get()->positions[shadow_group].push_back(pos); float_t v9; if (sub_140512F60(this) <= -0.2f) v9 = -0.5f; else v9 = 0.05f; - shadow_ptr_get()->field_1C0[shadow_type] = v9; - disp_manager.set_shadow_type(shadow_type); + shadow_ptr_get()->field_1C0[shadow_group] = v9; + disp_manager.set_shadow_group(shadow_group); enum_or(flags, mdl::OBJ_SHADOW); } - if (field_A0 & 0x01) + if (shadow_flag & 0x01) enum_or(flags, mdl::OBJ_4); } disp_manager.set_obj_flags(flags); @@ -14459,19 +14408,19 @@ void rob_chara_item_equip::disp(int32_t chara_id, render_context* rctx) { vec4 temp_texture_color_coeff; disp_manager.get_texture_color_coeff(temp_texture_color_coeff); - disp_manager.set_texture_color_coefficients(texture_color_coefficients); + disp_manager.set_texture_color_coefficients(skin_color); disp_manager.set_wet_param(wet); rctx->render_manager->npr_mask |= npr_flag; sub_140512C20(this, rctx); rob_chara_age_age_array_disp(rctx, chara_id, rctx->chara_reflect, chara_color); - if (item_equip_range) - for (int32_t i = first_item_equip_object; i < max_item_equip_object; i++) - item_equip_object[i].disp(mat, rctx); + if (one_skin) + for (int32_t i = disp_begin; i < disp_max; i++) + skin_disp[i].disp(mat, rctx); else { - for (int32_t i = ITEM_ATAMA; i < ITEM_MAX; i++) { + for (int32_t i = RPK_DISP_BEGIN; i <= RPK_DISP_END; i++) { mdl::ObjFlags chara_flags = (mdl::ObjFlags)0; - if (!(field_18[i] & 0x02)) { + if (!(parts_attr[i] & 0x02)) { if (rctx->chara_reflect) enum_or(chara_flags, mdl::OBJ_CHARA_REFLECT); if (rctx->chara_refract) @@ -14479,106 +14428,96 @@ void rob_chara_item_equip::disp(int32_t chara_id, render_context* rctx) { } mdl::ObjFlags flags = (mdl::ObjFlags)(mdl::OBJ_4 | mdl::OBJ_SHADOW); - if (i == ITEM_HARA) + if (i == RPK_HARA) flags = (mdl::ObjFlags)0; - if (!(field_A0 & 0x04)) + if (!(shadow_flag & 0x04)) enum_and(flags, ~mdl::OBJ_SHADOW); disp_manager.set_obj_flags((mdl::ObjFlags)(chara_flags | flags | mdl::OBJ_SSS)); - item_equip_object[i].disp(mat, rctx); + skin_disp[i].disp(mat, rctx); } } disp_manager.set_texture_color_coefficients(temp_texture_color_coeff); disp_manager.set_wet_param(); disp_manager.set_chara_color(); disp_manager.set_obj_flags(); - disp_manager.set_shadow_type(); + disp_manager.set_shadow_group(); reflect_draw = false; } -rob_chara_item_equip_object* rob_chara_item_equip::get_item_equip_object(item_id id) { - if (id >= ITEM_BODY && id <= ITEM_ITEM16) - return &item_equip_object[id]; +rob_chara_item_equip_object* rob_chara_item_equip::get_skin_disp(ROB_PARTS_KIND rpk) { + if (rpk >= 0 && rpk < RPK_MAX) + return &skin_disp[rpk]; return 0; } -object_info rob_chara_item_equip::get_object_info(item_id id) { - if (id >= ITEM_BODY && id <= ITEM_ITEM16) - return item_equip_object[id].obj_info; +object_info rob_chara_item_equip::get_object_info(ROB_PARTS_KIND rpk) { + if (rpk >= 0 && rpk < RPK_MAX) + return skin_disp[rpk].obj_uid; return {}; } -void rob_chara_item_equip::get_parent_bone_nodes(bone_node* bone_nodes, const bone_database* bone_data) { - this->bone_nodes = bone_nodes; - matrices = bone_nodes->no_scale_mat; - for (int32_t i = first_item_equip_object; i < max_item_equip_object; i++) - item_equip_object[i].get_parent_bone_nodes(bone_nodes, bone_data); +void rob_chara_item_equip::set_motion_node(const RobNode* mot_node, const bone_database* bone_data) { + motion_node = mot_node; + motion_matrix = mot_node->no_scale_mat; + for (int32_t i = disp_begin; i < disp_max; i++) + skin_disp[i].set_motion_node(mot_node, bone_data); } -const mat4* rob_chara_item_equip::get_ex_data_bone_node_mat(item_id id, const char* name) { - return item_equip_object[id].get_ex_data_bone_node_mat(name); +const mat4* rob_chara_item_equip::get_ex_data_bone_node_mat(ROB_PARTS_KIND rpk, const char* name) { + return skin_disp[rpk].get_ex_data_bone_node_mat(name); } -void rob_chara_item_equip::load_body_parts_object_info(item_id id, object_info obj_info, +void rob_chara_item_equip::load_body_parts_object_info(ROB_PARTS_KIND rpk, object_info obj_info, const bone_database* bone_data, void* data, const object_database* obj_db) { - if (id <= ITEM_BODY || id >= ITEM_MAX) + if (rpk < RPK_ITEM_BEGIN || rpk > RPK_ITEM_END) obj_info = {}; - load_object_info(obj_info, id, false, bone_data, data, obj_db); -} - -void rob_chara_item_equip::load_object_info(object_info obj_info, item_id id, - bool osage_reset, const bone_database* bone_data, void* data, const object_database* obj_db) { - if (id < ITEM_BODY || id > ITEM_ITEM16 || !bone_nodes) - return; - - item_equip_object[id].load_object_info_ex_data(obj_info, - bone_nodes, osage_reset, bone_data, data, obj_db); - set_disp(id, true); + set_item(obj_info, rpk, false, bone_data, data, obj_db); } // 0x1405135E0 void rob_chara_item_equip::pos_reset(uint8_t init_cnt) { - for (int32_t i = ITEM_BODY; i < ITEM_MAX; i++) - item_equip_object[i].pos_reset(init_cnt); + for (int32_t i = 0; i < RPK_MAX; i++) + skin_disp[i].pos_reset(init_cnt); } void rob_chara_item_equip::reset() { - bone_nodes = 0; - matrices = 0; - for (int32_t i = ITEM_BODY; i < ITEM_MAX; i++) - item_equip_object[i].init_members(); - item_equip_range = false; - shadow_type = (shadow_type_enum)-1; - field_A0 = 0x05; - texture_pattern.clear(); - field_D0 = {}; - field_D4 = -1; + motion_node = 0; + motion_matrix = 0; + for (int32_t i = 0; i < RPK_MAX; i++) + skin_disp[i].init_members(); + one_skin = false; + shadow_group = (SHADOW_GROUP)-1; + shadow_flag = 0x05; + hyoutan_texchg_list.clear(); + hyoutan_obj = {}; + hyoutan_rpk = RPK_NONE; disable_update = false; parts_short = false; parts_append = false; parts_white_one_l = false; osage_step = 1.0f; use_opd = false; - first_item_equip_object = ITEM_ATAMA; - max_item_equip_object = ITEM_ITEM16; + disp_begin = RPK_DISP_BEGIN; + disp_max = RPK_DISP_END; } void rob_chara_item_equip::reset_ex_force() { - for (int32_t i = first_item_equip_object; i < max_item_equip_object; i++) - item_equip_object[i].reset_ex_force(); + for (int32_t i = disp_begin; i < disp_max; i++) + skin_disp[i].reset_ex_force(); } -void rob_chara_item_equip::reset_init_data(bone_node* bone_nodes) { +void rob_chara_item_equip::reset_init_data(RobNode* mot_node) { reset(); - this->bone_nodes = bone_nodes; - matrices = bone_nodes->mat_ptr; + motion_node = mot_node; + motion_matrix = mot_node->mat_ptr; - mat4* v7 = field_13C; - int32_t* v8 = field_18; - for (int32_t i = ITEM_BODY; i < ITEM_MAX; i++) { - item_equip_object[i].init_members(i); + mat4* v7 = parts_matrix; + int32_t* v8 = parts_attr; + for (int32_t i = 0; i < RPK_MAX; i++) { + skin_disp[i].init_members(i); *v8++ = 0; *v7++ = mat4_identity; } @@ -14592,60 +14531,69 @@ void rob_chara_item_equip::reset_init_data(bone_node* bone_nodes) { } void rob_chara_item_equip::reset_nodes_ex_force(rob_osage_parts parts) { - item_equip_object[parts == ROB_OSAGE_PARTS_MUFFLER ? ITEM_OUTER : ITEM_KAMI] + skin_disp[parts == ROB_OSAGE_PARTS_MUFFLER ? RPK_OUTER : RPK_KAMI] .reset_nodes_ex_force((rob_osage_parts_bit)(1 << parts)); } void rob_chara_item_equip::set_alpha_obj_flags(float_t alpha, mdl::ObjFlags flags) { - if (item_equip_range) - for (int32_t i = first_item_equip_object; i < max_item_equip_object; i++) - item_equip_object[i].set_alpha_obj_flags(alpha, flags); + if (one_skin) + for (int32_t i = disp_begin; i < disp_max; i++) + skin_disp[i].set_alpha_obj_flags(alpha, flags); else - for (int32_t i = ITEM_ATAMA; i < ITEM_MAX; i++) - item_equip_object[i].set_alpha_obj_flags(alpha, flags); + for (int32_t i = RPK_DISP_BEGIN; i <= RPK_DISP_END; i++) + skin_disp[i].set_alpha_obj_flags(alpha, flags); } void rob_chara_item_equip::set_disable_collision(rob_osage_parts parts, bool disable) { - item_equip_object[parts == ROB_OSAGE_PARTS_MUFFLER ? ITEM_OUTER : ITEM_KAMI] + skin_disp[parts == ROB_OSAGE_PARTS_MUFFLER ? RPK_OUTER : RPK_KAMI] .set_disable_collision((rob_osage_parts_bit)(1 << parts), disable); } -void rob_chara_item_equip::set_disp(item_id id, bool value) { - item_equip_object[id].can_disp = value; +void rob_chara_item_equip::set_disp(ROB_PARTS_KIND rpk, bool value) { + skin_disp[rpk].can_disp = value; } -void rob_chara_item_equip::set_item_equip_range(bool value) { - item_equip_range = value; - if (value) { - first_item_equip_object = ITEM_BODY; - max_item_equip_object = ITEM_ATAMA; - } - else { - first_item_equip_object = ITEM_ATAMA; - max_item_equip_object = ITEM_ITEM16; - } +void rob_chara_item_equip::set_item(object_info obj_uid, ROB_PARTS_KIND rpk, + bool osage_reset, const bone_database* bone_data, void* data, const object_database* obj_db) { + if (rpk < 0 || rpk >= RPK_MAX || !motion_node) + return; + + skin_disp[rpk].set(obj_uid, motion_node, osage_reset, bone_data, data, obj_db); + set_disp(rpk, true); } void rob_chara_item_equip::set_motion_reset_data(uint32_t motion_id, float_t frame) { - for (int32_t i = first_item_equip_object; i < max_item_equip_object; i++) - item_equip_object[i].set_motion_reset_data(motion_id, frame); + for (int32_t i = disp_begin; i < disp_max; i++) + skin_disp[i].set_motion_reset_data(motion_id, frame); task_wind->stage_wind.wind->reset(); } void rob_chara_item_equip::set_motion_skin_param(int8_t chara_id, uint32_t motion_id, int32_t frame) { - for (int32_t i = ITEM_KAMI; i < ITEM_ITEM16; i++) - item_equip_object[i].set_motion_skin_param(chara_id, motion_id, frame); + for (int32_t i = RPK_ITEM_BEGIN; i <= RPK_ITEM_END; i++) + skin_disp[i].set_motion_skin_param(chara_id, motion_id, frame); } -void rob_chara_item_equip::set_null_blocks_expression_data(item_id id, +void rob_chara_item_equip::set_null_blocks_expression_data(ROB_PARTS_KIND rpk, const vec3& position, const vec3& rotation, const vec3& scale) { - item_equip_object[id].set_null_blocks_expression_data(position, rotation, scale); + skin_disp[rpk].set_null_blocks_expression_data(position, rotation, scale); } -void rob_chara_item_equip::set_object_texture_pattern(item_id id, +void rob_chara_item_equip::set_object_texture_pattern(ROB_PARTS_KIND rpk, texture_pattern_struct* tex_pat, size_t count) { - item_equip_object[id].set_texture_pattern(tex_pat, count); + skin_disp[rpk].set_texture_pattern(tex_pat, count); +} + +void rob_chara_item_equip::set_one_skin(bool value) { + one_skin = value; + if (value) { + disp_begin = RPK_1SKIN_BEGIN; + disp_max = RPK_1SKIN_MAX; + } + else { + disp_begin = RPK_DISP_BEGIN; + disp_max = RPK_DISP_END; + } } void rob_chara_item_equip::set_opd_blend_data(std::list* a2) { @@ -14680,13 +14628,13 @@ void rob_chara_item_equip::set_opd_blend_data(std::list* a2) } if (use_opd) - for (int32_t i = ITEM_KAMI; i < ITEM_MAX; i++) - item_equip_object[i].check_no_opd(opd_blend_data); + for (int32_t i = RPK_ITEM_BEGIN; i <= RPK_ITEM_END; i++) + skin_disp[i].check_no_opd(opd_blend_data); } void rob_chara_item_equip::set_osage_reset() { - for (int32_t i = first_item_equip_object; i < max_item_equip_object; i++) - item_equip_object[i].set_osage_reset(); + for (int32_t i = disp_begin; i < disp_max; i++) + skin_disp[i].set_osage_reset(); task_wind->stage_wind.wind->reset(); } @@ -14698,41 +14646,41 @@ void rob_chara_item_equip::set_osage_step(float_t value) { void rob_chara_item_equip::set_osage_move_cancel(uint8_t id, const float_t& mv_ccl) { switch (id) { case 0: - for (int32_t i = first_item_equip_object; i < max_item_equip_object; i++) - item_equip_object[i].set_osage_move_cancel(mv_ccl); + for (int32_t i = disp_begin; i < disp_max; i++) + skin_disp[i].set_osage_move_cancel(mv_ccl); break; case 1: - item_equip_object[ITEM_KAMI].set_osage_move_cancel(mv_ccl); + skin_disp[RPK_KAMI].set_osage_move_cancel(mv_ccl); break; case 2: - item_equip_object[ITEM_OUTER].set_osage_move_cancel(mv_ccl); + skin_disp[RPK_OUTER].set_osage_move_cancel(mv_ccl); break; } } -void rob_chara_item_equip::set_osage_play_data_init(item_id id, const float_t* opdi_data) { - if (id >= ITEM_KAMI && id <= ITEM_ITEM16) - item_equip_object[id].set_osage_play_data_init(opdi_data); +void rob_chara_item_equip::set_osage_play_data_init(ROB_PARTS_KIND rpk, const float_t* opdi_data) { + if (rpk >= RPK_ITEM_BEGIN && rpk <= RPK_ITEM_END) + skin_disp[rpk].set_osage_play_data_init(opdi_data); } -void rob_chara_item_equip::set_shadow_type(int32_t chara_id) { +void rob_chara_item_equip::set_shadow_group(int32_t chara_id) { if (!chara_id) - shadow_type = SHADOW_CHARA; + shadow_group = SHADOW_GROUP_CHARA; else - shadow_type = SHADOW_STAGE; + shadow_group = SHADOW_GROUP_STAGE; } void rob_chara_item_equip::set_texture_pattern(texture_pattern_struct* tex_pat, size_t count) { - texture_pattern.clear(); + hyoutan_texchg_list.clear(); if (count && tex_pat) for (size_t i = 0; i < count; i++) - texture_pattern.push_back(tex_pat[i]); + hyoutan_texchg_list.push_back(tex_pat[i]); } -void rob_chara_item_equip::skp_load(item_id id, const skin_param_osage_root& skp_root, +void rob_chara_item_equip::skp_load(ROB_PARTS_KIND rpk, const skin_param_osage_root& skp_root, std::vector& vec, skin_param_file_data* skp_file_data, const bone_database* bone_data) { - if (id >= ITEM_BODY && id < ITEM_MAX) - item_equip_object[id].skp_load(skp_root, vec, skp_file_data, bone_data); + if (rpk >= 0 && rpk < RPK_MAX) + skin_disp[rpk].skp_load(skp_root, vec, skp_file_data, bone_data); } item_cos_texture_change_tex::item_cos_texture_change_tex() : org(), chg(), changed() { @@ -14743,7 +14691,7 @@ item_cos_texture_change_tex::~item_cos_texture_change_tex() { } -rob_chara_item_cos_data::rob_chara_item_cos_data() : curr_chara_index(), chara_index(), curr_cos(), cos() { +rob_chara_item_cos_data::rob_chara_item_cos_data() : curr_chara_num(), chara_num(), curr_cos(), cos() { } @@ -14753,7 +14701,7 @@ rob_chara_item_cos_data::~rob_chara_item_cos_data() { bool rob_chara_item_cos_data::check_for_npr_flag() { for (int32_t i = ITEM_SUB_ZUJO; i < ITEM_SUB_MAX; i++) { - const item_table_item* item = item_table_handler_array_get_item(chara_index, cos.arr[i]); + const item_table_item* item = item_table_handler_array_get_item(chara_num, cos.arr[i]); if (item && item->npr_flag) return true; } @@ -14774,7 +14722,7 @@ object_info rob_chara_item_cos_data::get_head_object_replace(int32_t head_object float_t rob_chara_item_cos_data::get_max_face_depth() { float_t max_face_depth = 0.0f; for (int32_t i = ITEM_SUB_ZUJO; i < ITEM_SUB_MAX; i++) { - const item_table_item* item = item_table_handler_array_get_item(chara_index, cos.arr[i]); + const item_table_item* item = item_table_handler_array_get_item(chara_num, cos.arr[i]); if (item && max_face_depth < item->face_depth) max_face_depth = item->face_depth; } @@ -14841,7 +14789,7 @@ static void sub_140527280(rob_chara_item_cos_data* item_cos_data, return; for (const item_table_item_data_obj& i : item->data.obj) { - if (i.rpk == ITEM_NONE) + if (i.rpk == RPK_NONE) continue; auto elem = item_cos_data->item_change.find(i.rpk); @@ -14866,7 +14814,7 @@ static void sub_140522990(rob_chara_item_cos_data* item_cos_data) { if (!item_no || sub_id == ITEM_SUB_HADA) continue; - const item_table_item* item = item_table_handler_array_get_item(item_cos_data->chara_index, item_no); + const item_table_item* item = item_table_handler_array_get_item(item_cos_data->chara_num, item_no); if (!item) continue; @@ -14875,82 +14823,82 @@ static void sub_140522990(rob_chara_item_cos_data* item_cos_data) { } } -static void sub_140522A30(rob_chara_item_cos_data* item_cos_data, rob_chara_item_equip* rob_itm_equip, +static void sub_140522A30(rob_chara_item_cos_data* item_cos_data, rob_chara_item_equip* rob_disp, const bone_database* bone_data, void* data, const object_database* obj_db) { - const chara_init_data* chr_init_data = chara_init_data_get(item_cos_data->chara_index); - for (int32_t i = ITEM_ATAMA; i < ITEM_KAMI; i++) { - rob_itm_equip->load_outfit_object_info((item_id)i, - chr_init_data->field_7E4[i - 1], false, bone_data, data, obj_db); + const RobData* rob_data = get_rob_data(item_cos_data->chara_num); + for (int32_t i = RPK_BASE_BEGIN; i <= RPK_BASE_END; i++) { + rob_disp->load_outfit_object_info((ROB_PARTS_KIND)i, + rob_data->body_obj_uid[i], false, bone_data, data, obj_db); auto elem = item_cos_data->item_change.find(i); if (elem != item_cos_data->item_change.end()) - item_cos_data->set_texture_pattern(rob_itm_equip, elem->second, (item_id)i, false); + item_cos_data->set_texture_pattern(rob_disp, elem->second, (ROB_PARTS_KIND)i, false); else - item_cos_data->set_texture_pattern(rob_itm_equip, (item_id)i, false); + item_cos_data->set_texture_pattern(rob_disp, (ROB_PARTS_KIND)i, false); } - for (int32_t i = ITEM_KAMI; i < ITEM_MAX; i++) { - rob_itm_equip->load_body_parts_object_info((item_id)i, {}, bone_data, data, obj_db); - item_cos_data->set_texture_pattern(rob_itm_equip, (item_id)i, false); + for (int32_t i = RPK_ITEM_BEGIN; i <= RPK_ITEM_END; i++) { + rob_disp->load_body_parts_object_info((ROB_PARTS_KIND)i, {}, bone_data, data, obj_db); + item_cos_data->set_texture_pattern(rob_disp, (ROB_PARTS_KIND)i, false); } - item_cos_data->set_texture_pattern(rob_itm_equip, ITEM_NONE, true); + item_cos_data->set_texture_pattern(rob_disp, RPK_NONE, true); item_cos_data->field_F0.clear(); item_cos_data->field_100.clear(); item_cos_data->head_replace.clear(); } -static item_id sub_140525B90(rob_chara_item_cos_data* item_cos_data, item_sub_id sub_id) { - const item_id v3[] = { - ITEM_ZUJO, ITEM_KAMI, ITEM_NONE, ITEM_NONE, - ITEM_MEGANE, ITEM_NONE, ITEM_KUCHI, ITEM_NONE, - ITEM_KUBI, ITEM_NONE, ITEM_OUTER, ITEM_NONE, - ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE, - ITEM_JOHA_USHIRO, ITEM_NONE, ITEM_NONE, ITEM_PANTS, - ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE, - ITEM_NONE, +static ROB_PARTS_KIND sub_140525B90(rob_chara_item_cos_data* item_cos_data, item_sub_id sub_id) { + const ROB_PARTS_KIND v3[] = { + RPK_ZUJO, RPK_KAMI, RPK_NONE, RPK_NONE, + RPK_MEGANE, RPK_NONE, RPK_KUCHI, RPK_NONE, + RPK_KUBI, RPK_NONE, RPK_OUTER, RPK_NONE, + RPK_NONE, RPK_NONE, RPK_NONE, RPK_NONE, + RPK_JOHA_USHIRO, RPK_NONE, RPK_NONE, RPK_PANTS, + RPK_NONE, RPK_NONE, RPK_NONE, RPK_NONE, + RPK_NONE, }; return v3[sub_id]; } -static item_id sub_140512EF0(rob_chara_item_equip* rob_itm_eq, item_id id) { - int32_t v2 = id; - if (id < ITEM_BODY || id >= ITEM_ITEM16) - return ITEM_NONE; +static ROB_PARTS_KIND sub_140512EF0(rob_chara_item_equip* rob_disp, ROB_PARTS_KIND rpk) { + int32_t _rpk = rpk; + if (rpk < 0 || rpk >= RPK_DISP_END) + return RPK_NONE; - for (rob_chara_item_equip_object* i = &rob_itm_eq->item_equip_object[id]; - i->obj_info.not_null(); i++) { - if (++v2 >= ITEM_ITEM16) - return ITEM_NONE; + for (rob_chara_item_equip_object* i = &rob_disp->skin_disp[rpk]; + i->obj_uid.not_null(); i++) { + if (++_rpk >= RPK_DISP_END) + return RPK_NONE; } - return (item_id)v2; + return (ROB_PARTS_KIND)_rpk; } -static void sub_140513B90(rob_chara_item_equip* rob_itm_equip, item_id id, object_info a3, object_info a4, +static void sub_140513B90(rob_chara_item_equip* rob_disp, ROB_PARTS_KIND rpk, object_info a3, object_info a4, const bone_database* bone_data, void* data, const object_database* obj_db) { - if (id <= ITEM_BODY || id >= ITEM_MAX) { + if (rpk <= RPK_BODY || rpk >= RPK_MAX) { a4 = {}; a3 = {}; } - rob_itm_equip->field_D0 = a4; - rob_itm_equip->field_D4 = id; - rob_itm_equip->load_object_info(a3, id, false, bone_data, data, obj_db); - rob_itm_equip->set_disp(id, false); + rob_disp->hyoutan_obj = a4; + rob_disp->hyoutan_rpk = rpk; + rob_disp->set_item(a3, rpk, false, bone_data, data, obj_db); + rob_disp->set_disp(rpk, false); } static void sub_14052C560(rob_chara_item_cos_data* item_sub_data, - rob_chara_item_equip* rob_itm_equip, int32_t item_no, const item_table_item* item, item_sub_id sub_id, + rob_chara_item_equip* rob_disp, int32_t item_no, const item_table_item* item, item_sub_id sub_id, const bone_database* bone_data, void* data, const object_database* obj_db) { for (const item_table_item_data_obj& i : item->data.obj) { if (i.obj_info.is_null()) break; if (item->type == 1) { - if (i.rpk != ITEM_NONE) { - rob_itm_equip->load_outfit_object_info(i.rpk, + if (i.rpk != RPK_NONE) { + rob_disp->load_outfit_object_info(i.rpk, i.obj_info, false, bone_data, data, obj_db); if (item->attr & 0x0C) - item_sub_data->set_texture_pattern(rob_itm_equip, item_no, i.rpk, false); + item_sub_data->set_texture_pattern(rob_disp, item_no, i.rpk, false); } continue; } @@ -14958,27 +14906,27 @@ static void sub_14052C560(rob_chara_item_cos_data* item_sub_data, else if (item->type) continue; - item_id id = sub_140525B90(item_sub_data, sub_id); - if (id != ITEM_NONE) { - rob_itm_equip->load_body_parts_object_info(id, i.obj_info, bone_data, data, obj_db); - item_sub_data->field_F0.insert({ i.obj_info, id }); + ROB_PARTS_KIND rpk = sub_140525B90(item_sub_data, sub_id); + if (rpk != RPK_NONE) { + rob_disp->load_body_parts_object_info(rpk, i.obj_info, bone_data, data, obj_db); + item_sub_data->field_F0.insert({ i.obj_info, rpk }); if (item->attr & 0x0C) - item_sub_data->set_texture_pattern(rob_itm_equip, item_no, id, false); + item_sub_data->set_texture_pattern(rob_disp, item_no, rpk, false); } else { - item_id id = sub_140512EF0(rob_itm_equip, ITEM_ITEM09); - if (id != ITEM_NONE && (!(item->attr & 0x10) || &i - item->data.obj.data())) { + ROB_PARTS_KIND rpk = sub_140512EF0(rob_disp, RPK_ITEM09); + if (rpk != RPK_NONE && (!(item->attr & 0x10) || &i - item->data.obj.data())) { bool v8 = false; if (item->attr & 0x10 && &i - item->data.obj.data() == 1) { - sub_140513B90(rob_itm_equip, id, item->data.obj[1].obj_info, + sub_140513B90(rob_disp, rpk, item->data.obj[1].obj_info, item->data.obj[0].obj_info, bone_data, data, obj_db); v8 = true; } else - rob_itm_equip->load_body_parts_object_info(id, i.obj_info, bone_data, data, obj_db); - item_sub_data->field_F0.insert({ i.obj_info, id }); + rob_disp->load_body_parts_object_info(rpk, i.obj_info, bone_data, data, obj_db); + item_sub_data->field_F0.insert({ i.obj_info, rpk }); if (item->attr & 0x0C) - item_sub_data->set_texture_pattern(rob_itm_equip, item_no, id, v8); + item_sub_data->set_texture_pattern(rob_disp, item_no, rpk, v8); } } } @@ -14987,7 +14935,7 @@ static void sub_14052C560(rob_chara_item_cos_data* item_sub_data, if (!(item->attr & 0x800)) return; - const char* chara_name = chara_index_get_chara_name(item_sub_data->chara_index); + const char* chara_name = get_chara_name(item_sub_data->chara_num); for (int32_t i = 0; i < 9; i++) { std::string buf = sprintf_s_string("%sITM%03d_ATAM_HEAD_%02d_SP__DIVSKN", chara_name, item_no, i); object_info obj_info = obj_db->get_object_info(buf.c_str()); @@ -14996,9 +14944,9 @@ static void sub_14052C560(rob_chara_item_cos_data* item_sub_data, } } -static void sub_140522C60(rob_chara_item_cos_data* item_cos_data, rob_chara_item_equip* rob_itm_equip, +static void sub_140522C60(rob_chara_item_cos_data* item_cos_data, rob_chara_item_equip* rob_disp, const bone_database* bone_data, void* data, const object_database* obj_db) { - if (!item_table_handler_array_get_table(item_cos_data->chara_index)) + if (!item_table_handler_array_get_table(item_cos_data->chara_num)) return; const item_sub_id dword_140A2BB70[] = { @@ -15012,47 +14960,47 @@ static void sub_140522C60(rob_chara_item_cos_data* item_cos_data, rob_chara_item while (*v6 != ITEM_SUB_MAX) { int32_t item_no = item_cos_data->cos.arr[*v6]; if (item_no) { - const item_table_item* item = item_table_handler_array_get_item(item_cos_data->chara_index, item_no); + const item_table_item* item = item_table_handler_array_get_item(item_cos_data->chara_num, item_no); if (item && item->type != 3 && item->attr & 0x01) - sub_14052C560(item_cos_data, rob_itm_equip, item_no, item, *v6, bone_data, data, obj_db); + sub_14052C560(item_cos_data, rob_disp, item_no, item, *v6, bone_data, data, obj_db); } v6++; } } static void sub_14052C8C0(rob_chara_item_cos_data* item_cos_data, - rob_chara_item_equip* rob_itm_equip, int32_t item_no, const item_table_item* item, + rob_chara_item_equip* rob_disp, int32_t item_no, const item_table_item* item, const bone_database* bone_data, void* data, const object_database* obj_db) { for (const item_table_item_data_obj& i : item->data.obj) { object_info v11 = i.obj_info; - item_id id = i.rpk; + ROB_PARTS_KIND rpk = i.rpk; if (item->type == 1) { if (v11.is_null()) { - if (id == ITEM_NONE) + if (rpk == RPK_NONE) continue; } - else if (id == ITEM_NONE) { + else if (rpk == RPK_NONE) { } else if (i.rpk < 100 || i.rpk > 105) { - rob_itm_equip->load_outfit_object_info(id, + rob_disp->load_outfit_object_info(rpk, v11, false, bone_data, data, obj_db); } else { - item_id v13 = sub_140512EF0(rob_itm_equip, ITEM_KAMI); - if (v13 == ITEM_NONE) + ROB_PARTS_KIND v13 = sub_140512EF0(rob_disp, RPK_KAMI); + if (v13 == RPK_NONE) continue; - rob_itm_equip->load_body_parts_object_info(v13, i.obj_info, bone_data, data, obj_db); + rob_disp->load_body_parts_object_info(v13, i.obj_info, bone_data, data, obj_db); item_cos_data->field_F0.insert({ i.obj_info, v13 }); - item_cos_data->field_100.insert({ id, v13 }); - id = v13; + item_cos_data->field_100.insert({ rpk, v13 }); + rpk = v13; } } else if (!item->type) { - id = sub_140512EF0(rob_itm_equip, ITEM_ITEM09); - if (id != ITEM_NONE) { - rob_itm_equip->load_body_parts_object_info(id, i.obj_info, bone_data, data, obj_db); - item_cos_data->field_F0.insert({ i.obj_info, id }); + rpk = sub_140512EF0(rob_disp, RPK_ITEM09); + if (rpk != RPK_NONE) { + rob_disp->load_body_parts_object_info(rpk, i.obj_info, bone_data, data, obj_db); + item_cos_data->field_F0.insert({ i.obj_info, rpk }); continue; } } @@ -15060,13 +15008,13 @@ static void sub_14052C8C0(rob_chara_item_cos_data* item_cos_data, continue; if (item->attr & 0x0C) - item_cos_data->set_texture_pattern(rob_itm_equip, item_no, id, false); + item_cos_data->set_texture_pattern(rob_disp, item_no, rpk, false); } } -static void sub_140522D00(rob_chara_item_cos_data* item_cos_data, rob_chara_item_equip* rob_itm_equip, +static void sub_140522D00(rob_chara_item_cos_data* item_cos_data, rob_chara_item_equip* rob_disp, const bone_database* bone_data, void* data, const object_database* obj_db) { - if (!item_table_handler_array_get_table(item_cos_data->chara_index)) + if (!item_table_handler_array_get_table(item_cos_data->chara_num)) return; const item_sub_id dword_140A2BBC8[] = { @@ -15077,24 +15025,24 @@ static void sub_140522D00(rob_chara_item_cos_data* item_cos_data, rob_chara_item while (*v6 != ITEM_SUB_MAX) { int32_t item_no = item_cos_data->cos.arr[*v6]; if (item_no) { - const item_table_item* item = item_table_handler_array_get_item(item_cos_data->chara_index, item_no); + const item_table_item* item = item_table_handler_array_get_item(item_cos_data->chara_num, item_no); if (item && item->type != 3 && item->attr & 0x01) - sub_14052C8C0(item_cos_data, rob_itm_equip, item_no, item, bone_data, data, obj_db); + sub_14052C8C0(item_cos_data, rob_disp, item_no, item, bone_data, data, obj_db); } v6++; } } -static void sub_140525D90(rob_chara_item_cos_data* item_cos_data, rob_chara_item_equip* rob_itm_equip, +static void sub_140525D90(rob_chara_item_cos_data* item_cos_data, rob_chara_item_equip* rob_disp, int32_t a3, const bone_database* bone_data, void* data, const object_database* obj_db) { auto elem = item_cos_data->field_100.find(a3); if (elem != item_cos_data->field_100.end()) - rob_itm_equip->load_body_parts_object_info(elem->second, {}, bone_data, data, obj_db); + rob_disp->load_body_parts_object_info(elem->second, {}, bone_data, data, obj_db); } -static void sub_140522D90(rob_chara_item_cos_data* item_cos_data, rob_chara_item_equip* rob_itm_equip, +static void sub_140522D90(rob_chara_item_cos_data* item_cos_data, rob_chara_item_equip* rob_disp, const bone_database* bone_data, void* data, const object_database* obj_db) { - if (!item_table_handler_array_get_table(item_cos_data->chara_index)) + if (!item_table_handler_array_get_table(item_cos_data->chara_num)) return; const item_sub_id dword_140A2BBD8[] = { @@ -15109,7 +15057,7 @@ static void sub_140522D90(rob_chara_item_cos_data* item_cos_data, rob_chara_item continue; } - const item_table_item* item = item_table_handler_array_get_item(item_cos_data->chara_index, item_no); + const item_table_item* item = item_table_handler_array_get_item(item_cos_data->chara_num, item_no); if (!item || item->type != 1) continue; @@ -15117,35 +15065,35 @@ static void sub_140522D90(rob_chara_item_cos_data* item_cos_data, rob_chara_item if (i.obj_info.is_null()) continue; - item_id id = sub_140525B90(item_cos_data, *v6); - rob_itm_equip->load_body_parts_object_info(id, i.obj_info, bone_data, data, obj_db); - item_cos_data->field_F0.insert({ i.obj_info, id }); + ROB_PARTS_KIND rpk = sub_140525B90(item_cos_data, *v6); + rob_disp->load_body_parts_object_info(rpk, i.obj_info, bone_data, data, obj_db); + item_cos_data->field_F0.insert({ i.obj_info, rpk }); if (item->attr & 0x0C) - item_cos_data->set_texture_pattern(rob_itm_equip, item_no, id, false); + item_cos_data->set_texture_pattern(rob_disp, item_no, rpk, false); - if (i.rpk == ITEM_NONE) + if (i.rpk == RPK_NONE) continue; - rob_itm_equip->load_outfit_object_info(i.rpk, + rob_disp->load_outfit_object_info(i.rpk, {}, false, bone_data, data, obj_db); switch (i.rpk) { - case ITEM_UDE_R: - sub_140525D90(item_cos_data, rob_itm_equip, 102, bone_data, data, obj_db); + case RPK_UDE_R: + sub_140525D90(item_cos_data, rob_disp, 102, bone_data, data, obj_db); break; - case ITEM_UDE_L: - sub_140525D90(item_cos_data, rob_itm_equip, 100, bone_data, data, obj_db); + case RPK_UDE_L: + sub_140525D90(item_cos_data, rob_disp, 100, bone_data, data, obj_db); break; - case ITEM_TE_R: - sub_140525D90(item_cos_data, rob_itm_equip, 103, bone_data, data, obj_db); + case RPK_TE_R: + sub_140525D90(item_cos_data, rob_disp, 103, bone_data, data, obj_db); break; - case ITEM_TE_L: - sub_140525D90(item_cos_data, rob_itm_equip, 101, bone_data, data, obj_db); + case RPK_TE_L: + sub_140525D90(item_cos_data, rob_disp, 101, bone_data, data, obj_db); break; - case ITEM_SUNE: - sub_140525D90(item_cos_data, rob_itm_equip, 104, bone_data, data, obj_db); + case RPK_SUNE: + sub_140525D90(item_cos_data, rob_disp, 104, bone_data, data, obj_db); break; - case ITEM_ASI: - sub_140525D90(item_cos_data, rob_itm_equip, 105, bone_data, data, obj_db); + case RPK_ASI: + sub_140525D90(item_cos_data, rob_disp, 105, bone_data, data, obj_db); break; } } @@ -15153,15 +15101,15 @@ static void sub_140522D90(rob_chara_item_cos_data* item_cos_data, rob_chara_item } } -static void sub_140522F90(rob_chara_item_cos_data* item_cos_data, rob_chara_item_equip* rob_itm_equip) { - if (!item_table_handler_array_get_table(item_cos_data->chara_index)) +static void sub_140522F90(rob_chara_item_cos_data* item_cos_data, rob_chara_item_equip* rob_disp) { + if (!item_table_handler_array_get_table(item_cos_data->chara_num)) return; int32_t item_no = item_cos_data->cos.arr[ITEM_SUB_HADA]; if (!item_no) return; - const item_table_item* item = item_table_handler_array_get_item(item_cos_data->chara_index, item_no); + const item_table_item* item = item_table_handler_array_get_item(item_cos_data->chara_num, item_no); if (!item || item->data.col.size()) return; @@ -15174,25 +15122,25 @@ static void sub_140522F90(rob_chara_item_cos_data* item_cos_data, rob_chara_item offset_specular = item->data.col[1].col_tone.offset; } - for (int32_t i = ITEM_ATAMA; i <= ITEM_ITEM16; i++) { - if (rob_itm_equip->get_object_info((item_id)i).is_null()) + for (int32_t i = RPK_ATAMA; i <= RPK_ITEM16; i++) { + if (rob_disp->get_object_info((ROB_PARTS_KIND)i).is_null()) continue; - rob_chara_item_equip_object* itm_eq_obj = &rob_itm_equip->item_equip_object[i]; - itm_eq_obj->skn_col.type = 0; - itm_eq_obj->skn_col.blend_color = blend_color; - itm_eq_obj->skn_col.offset_color = offset_color; - itm_eq_obj->skn_col.blend_specular = blend_specular; - itm_eq_obj->skn_col.offset_specular = offset_specular; + rob_chara_item_equip_object* skin_disp = &rob_disp->skin_disp[i]; + skin_disp->skn_col.type = 0; + skin_disp->skn_col.blend_color = blend_color; + skin_disp->skn_col.offset_color = offset_color; + skin_disp->skn_col.blend_specular = blend_specular; + skin_disp->skn_col.offset_specular = offset_specular; } } static void sub_140523230(rob_chara_item_cos_data* item_cos_data, - rob_chara_item_equip* rob_itm_equip, int32_t item_no) { + rob_chara_item_equip* rob_disp, int32_t item_no) { if (!item_no) return; - const item_table_item* item = item_table_handler_array_get_item(item_cos_data->chara_index, item_no); + const item_table_item* item = item_table_handler_array_get_item(item_cos_data->chara_num, item_no); if (!item || !((item->type + 1) & ~0x04)) return; @@ -15207,7 +15155,7 @@ static void sub_140523230(rob_chara_item_cos_data* item_cos_data, auto elem = item_cos_data->field_F0.find(j.obj_info); if (elem != item_cos_data->field_F0.end()) - rob_itm_equip->set_null_blocks_expression_data( + rob_disp->set_null_blocks_expression_data( elem->second, i.position, i.rotation, i.scale); } break; @@ -15219,20 +15167,20 @@ static void sub_140523230(rob_chara_item_cos_data* item_cos_data, auto elem = item_cos_data->field_F0.find(i.obj_info); if (elem != item_cos_data->field_F0.end()) { - item_id id = elem->second; - sub_140514130(rob_itm_equip, id, !(item->attr & 0x80)); - sub_140514110(rob_itm_equip, id, !(item->attr & 0x100)); - sub_140513C60(rob_itm_equip, id, !(item->attr & 0x400)); + ROB_PARTS_KIND rpk = elem->second; + sub_140514130(rob_disp, rpk, !(item->attr & 0x80)); + sub_140514110(rob_disp, rpk, !(item->attr & 0x100)); + sub_140513C60(rob_disp, rpk, !(item->attr & 0x400)); } } } -static void sub_1405231D0(rob_chara_item_cos_data* item_cos_data, rob_chara_item_equip* rob_itm_equip) { - if (!item_table_handler_array_get_table(item_cos_data->chara_index)) +static void sub_1405231D0(rob_chara_item_cos_data* item_cos_data, rob_chara_item_equip* rob_disp) { + if (!item_table_handler_array_get_table(item_cos_data->chara_num)) return; for (int32_t i = 0; i < ITEM_SUB_MAX; i++) - sub_140523230(item_cos_data, rob_itm_equip, item_cos_data->cos.arr[i]); + sub_140523230(item_cos_data, rob_disp, item_cos_data->cos.arr[i]); } static void sub_1405234E0(rob_chara_item_cos_data* item_cos_data) { @@ -15243,33 +15191,33 @@ static void sub_1405234E0(rob_chara_item_cos_data* item_cos_data) { void rob_chara_item_cos_data::reload_items(int32_t chara_id, const bone_database* bone_data, void* data, const object_database* obj_db) { - rob_chara_item_equip* rob_itm_equip = rob_chara_array_get_item_equip(chara_id); + rob_chara_item_equip* rob_disp = rob_chara_array_get_rob_disp(chara_id); sub_140522990(this); - sub_140522A30(this, rob_itm_equip, bone_data, data, obj_db); - sub_140522C60(this, rob_itm_equip, bone_data, data, obj_db); - sub_140522D00(this, rob_itm_equip, bone_data, data, obj_db); - sub_140522D90(this, rob_itm_equip, bone_data, data, obj_db); - sub_140522F90(this, rob_itm_equip); - sub_1405231D0(this, rob_itm_equip); + sub_140522A30(this, rob_disp, bone_data, data, obj_db); + sub_140522C60(this, rob_disp, bone_data, data, obj_db); + sub_140522D00(this, rob_disp, bone_data, data, obj_db); + sub_140522D90(this, rob_disp, bone_data, data, obj_db); + sub_140522F90(this, rob_disp); + sub_1405231D0(this, rob_disp); sub_1405234E0(this); } -void rob_chara_item_cos_data::set_chara_index(::chara_index chara_index) { - this->chara_index = chara_index; +void rob_chara_item_cos_data::set_chara_num(CHARA_NUM chara_num) { + this->chara_num = chara_num; } -void rob_chara_item_cos_data::set_chara_index_item(::chara_index chara_index, int32_t item_no) { - set_chara_index(chara_index); +void rob_chara_item_cos_data::set_chara_num_item(CHARA_NUM chara_num, int32_t item_no) { + set_chara_num(chara_num); set_item(item_no); } -void rob_chara_item_cos_data::set_chara_index_item_nos(::chara_index chara_index, const int32_t* items) { - set_chara_index(chara_index); +void rob_chara_item_cos_data::set_chara_num_item_nos(CHARA_NUM chara_num, const int32_t* items) { + set_chara_num(chara_num); set_item_nos(items); } -void rob_chara_item_cos_data::set_chara_index_item_zero(::chara_index chara_index, int32_t item_no) { - set_chara_index(chara_index); +void rob_chara_item_cos_data::set_chara_num_item_zero(CHARA_NUM chara_num, int32_t item_no) { + set_chara_num(chara_num); set_item_zero(item_no); } @@ -15277,7 +15225,7 @@ void rob_chara_item_cos_data::set_item(int32_t item_no) { if (!item_no) return; - const item_table_item* item = item_table_handler_array_get_item(chara_index, item_no); + const item_table_item* item = item_table_handler_array_get_item(chara_num, item_no); if (item) cos.arr[item->sub_id] = item_no; } @@ -15297,22 +15245,22 @@ void rob_chara_item_cos_data::set_item_nos(const int32_t* item_nos) { } void rob_chara_item_cos_data::set_item_zero(int32_t item_no) { - const item_table_item* item = item_table_handler_array_get_item(chara_index, item_no); + const item_table_item* item = item_table_handler_array_get_item(chara_num, item_no); if (item) cos.arr[item->sub_id] = 0; } -void rob_chara_item_cos_data::set_texture_pattern(rob_chara_item_equip* rob_itm_equip, - item_id id, bool tex_pat_for_all) { +void rob_chara_item_cos_data::set_texture_pattern(rob_chara_item_equip* rob_disp, + ROB_PARTS_KIND rpk, bool tex_pat_for_all) { if (tex_pat_for_all) - rob_itm_equip->set_texture_pattern(0, 0); + rob_disp->set_texture_pattern(0, 0); else - rob_itm_equip->set_object_texture_pattern(id, 0, 0); + rob_disp->set_object_texture_pattern(rpk, 0, 0); } -void rob_chara_item_cos_data::set_texture_pattern(rob_chara_item_equip* rob_itm_equip, - uint32_t item_no, item_id id, bool tex_pat_for_all) { - if (id < ITEM_BODY || id >= ITEM_MAX) +void rob_chara_item_cos_data::set_texture_pattern(rob_chara_item_equip* rob_disp, + uint32_t item_no, ROB_PARTS_KIND rpk, bool tex_pat_for_all) { + if (rpk < 0 || rpk >= RPK_MAX) return; auto elem = texture_change.find(item_no); @@ -15321,18 +15269,18 @@ void rob_chara_item_cos_data::set_texture_pattern(rob_chara_item_equip* rob_itm_ for (item_cos_texture_change_tex& i : elem->second) if (i.org && i.chg) - texture_pattern[id].push_back({ i.org->id, i.chg->id }); + texture_pattern[rpk].push_back({ i.org->id, i.chg->id }); if (tex_pat_for_all) - rob_itm_equip->set_texture_pattern(texture_pattern[id].data(), texture_pattern[id].size()); + rob_disp->set_texture_pattern(texture_pattern[rpk].data(), texture_pattern[rpk].size()); else - rob_itm_equip->set_object_texture_pattern(id, - texture_pattern[id].data(), texture_pattern[id].size()); + rob_disp->set_object_texture_pattern(rpk, + texture_pattern[rpk].data(), texture_pattern[rpk].size()); } -void rob_chara_item_cos_data::set_texture_pattern(rob_chara_item_equip* rob_itm_equip, - const std::vector& item_nos, item_id id, bool tex_pat_for_all) { - if (id < ITEM_BODY || id >= ITEM_MAX) +void rob_chara_item_cos_data::set_texture_pattern(rob_chara_item_equip* rob_disp, + const std::vector& item_nos, ROB_PARTS_KIND rpk, bool tex_pat_for_all) { + if (rpk < 0 || rpk >= RPK_MAX) return; for (const uint32_t& i : item_nos) { @@ -15342,15 +15290,15 @@ void rob_chara_item_cos_data::set_texture_pattern(rob_chara_item_equip* rob_itm_ for (item_cos_texture_change_tex& j : elem->second) if (j.org && j.chg) - texture_pattern[id].push_back({ j.org->id, j.chg->id }); + texture_pattern[rpk].push_back({ j.org->id, j.chg->id }); } if (tex_pat_for_all) - rob_itm_equip->set_texture_pattern( - texture_pattern[id].data(), texture_pattern[id].size()); + rob_disp->set_texture_pattern( + texture_pattern[rpk].data(), texture_pattern[rpk].size()); else - rob_itm_equip->set_object_texture_pattern(id, - texture_pattern[id].data(), texture_pattern[id].size()); + rob_disp->set_object_texture_pattern(rpk, + texture_pattern[rpk].data(), texture_pattern[rpk].size()); } void rob_chara_item_cos_data::texture_change_clear() { @@ -15385,7 +15333,7 @@ field_90(), field_94(), field_98(), field_9C(), field_A0(), field_A4(), field_A5 field_B0(), field_B4(), field_140(), field_144(), field_145(), field_146(), field_148(), field_150(), field_152(), field_154(), field_158(), field_15C(), field_160(), field_164(), field_168(), field_16C(), field_170(), field_174(), field_178(), field_17C(), field_180(), field_184(), field_188(), field_18C(), -field_190(), field_194(), field_198(), field_19C(), field_1A0(), field_1A4(), field_1A8(), field_1B0(), field_1B4(), +field_190(), field_194(), field_198(), field_19C(), field_1A0(), kamae_type(), kamae_data(), field_1B0(), field_1B4(), field_1B8(), field_1BC(), field_1C0(), field_1C8(), field_1C9(), field_1CA(), field_1CC(), field_1D0(), field_1D4() { } @@ -16235,30 +16183,28 @@ void struc_223::reset() { motion_set_id = -1; } -rob_chara_data_miku_rot::rob_chara_data_miku_rot() : rot_y_int16(), field_2(), field_4(), -field_6(), field_8(), field_C(), field_10(), field_14(), field_60(), field_64(), field_68() { +rob_chara_data_miku_rot::rob_chara_data_miku_rot() : revise_type(), ground_pos(), ground_last() { reset(); } void rob_chara_data_miku_rot::reset() { - rot_y_int16 = 0; - field_2 = 0; - field_4 = 0; - field_6 = 0; - field_8 = 0; - field_C = 0; - field_10 = 0.0f; - field_14 = 0; - position = 0.0f; - n_hara_pos = 0.0f; - field_30 = 0.0f; - field_3C = 0.0f; - n_hara_pos_prev = 0.0f; - n_hara_pos_diff = 0.0f; - field_60 = 0; - field_64 = 0; - field_68 = 0; - mat = mat4_identity; + yang = 0; + act_yang = 0; + hara_xang = 0; + hara_yang = 0; + hara_zang = 0; + revise_tag_yang = 0; + revise_type = (ReviseType)0; + ground_pos = 0.0f; + ground_last = 0.0f; + pos = 0.0f; + gpos = 0.0f; + spd = 0.0f; + adjust_spd = 0.0f; + old_gpos = 0.0f; + velocity = 0.0f; + pos_camera_old = 0.0f; + rob_mat = mat4_identity; } rob_chara_adjust_data::rob_chara_adjust_data() : scale(), height_adjust(), pos_adjust_y(), @@ -16346,7 +16292,7 @@ struc_209::~struc_209() { } -rob_chara_data::rob_chara_data() : field_0(), field_1(), field_2(), field_3(), field_4(), miku_rot(), +rob_chara_data::rob_chara_data() : flag(), adjust_data(), field_3D90(), field_3D94(), field_3D98(), field_3D9A(), field_3D9C(), field_3DA0(), field_3DA4(), field_3DA8(), field_3DB0(), field_3DB8(), field_3DBC(), field_3DC0(), field_3DC4(), field_3DC8(), field_3DCC(), field_3DD0(), field_3DD4(), field_3DD8(), field_3DDC(), field_3DE0(), arm_adjust_scale() { @@ -16358,11 +16304,11 @@ rob_chara_data::~rob_chara_data() { } void rob_chara_data::reset() { - sub_140505C90(&field_8); + sub_140505C90(&action); rob_sub_action.Reset(); motion.reset(); - field_1588.reset(); - miku_rot.reset(); + motdata.reset(); + position.reset(); adjust_data.reset(); sub_140505FB0(&field_1E68); field_3D90 = 0; @@ -16388,17 +16334,17 @@ void rob_chara_data::reset() { } rob_chara::rob_chara() : chara_id(), type(), field_C(), field_D(), -chara_index(), cos_id(), chara_init_data(), field_20() { +chara_num(), cos_id(), rob_data(), field_20() { frame_speed = 1.0f; bone_data = new rob_chara_bone_data(); - item_equip = new rob_chara_item_equip(); + rob_disp = new rob_chara_item_equip(); } rob_chara::~rob_chara() { delete bone_data; bone_data = 0; - delete item_equip; - item_equip = 0; + delete rob_disp; + rob_disp = 0; } int32_t expression_id_to_mottbl_index(int32_t expression_id) { @@ -16503,17 +16449,17 @@ bool OpdMaker::Data::IsValidOpdiFile(rob_chara* rob_chr, uint32_t motion_id) { if (!rob_chr) return false; - rob_chara_item_equip* rob_itm_equip = rob_chr->item_equip; - for (int32_t i = ITEM_KAMI; i < ITEM_MAX; i++) { - rob_chara_item_equip_object* itm_eq_obj = rob_itm_equip->get_item_equip_object((item_id)i); - object_info obj_info = itm_eq_obj->obj_info; - if (obj_info.not_null() && itm_eq_obj->osage_nodes_count) { + rob_chara_item_equip* rob_disp = rob_chr->rob_disp; + for (int32_t i = RPK_KAMI; i < RPK_MAX; i++) { + rob_chara_item_equip_object* skin_disp = rob_disp->get_skin_disp((ROB_PARTS_KIND)i); + object_info obj_info = skin_disp->obj_uid; + if (obj_info.not_null() && skin_disp->osage_nodes_count) { size_t data = (size_t)GetOpdiFileData(obj_info, motion_id); if (!data || *((uint16_t*)(data + 0x04)) != (uint16_t)obj_info.id || *((uint16_t*)(data + 0x06)) != (uint16_t)obj_info.set_id || *((int32_t*)(data + 0x08)) != motion_id - || *((uint16_t*)(data + 0x0C)) != itm_eq_obj->osage_nodes_count) + || *((uint16_t*)(data + 0x0C)) != skin_disp->osage_nodes_count) return false; } } @@ -16527,13 +16473,13 @@ void OpdMaker::Data::ReadOpdiFiles(rob_chara* rob_chr, std::vector& mo data_struct* aft_data = &data_list[DATA_AFT]; motion_database* aft_mot_db = &aft_data->data_ft.mot_db; - rob_chara_item_equip* rob_itm_equip = rob_chr->item_equip; - for (int32_t i = ITEM_KAMI; i < ITEM_MAX; i++) { - rob_chara_item_equip_object* itm_eq_obj = rob_itm_equip->get_item_equip_object((item_id)i); - if (itm_eq_obj->obj_info.is_null() || !itm_eq_obj->osage_nodes_count) + rob_chara_item_equip* rob_disp = rob_chr->rob_disp; + for (int32_t i = RPK_KAMI; i < RPK_MAX; i++) { + rob_chara_item_equip_object* skin_disp = rob_disp->get_skin_disp((ROB_PARTS_KIND)i); + if (skin_disp->obj_uid.is_null() || !skin_disp->osage_nodes_count) continue; - object_info obj_info = itm_eq_obj->obj_info; + object_info obj_info = skin_disp->obj_uid; const char* object_name = objset_info_storage_get_obj_name(obj_info); if (!object_name) continue; @@ -16614,8 +16560,8 @@ void OpdMaker::Ctrl() { float_t frame_count = (float_t)(int32_t)rob_chr->bone_data->get_frame_count() - 1.0f; int32_t iterations = 60; - if (rob_chr->data.field_1588.field_0.iterations > 0) - iterations = rob_chr->data.field_1588.field_0.iterations; + if (rob_chr->data.motdata.field_0.iterations > 0) + iterations = rob_chr->data.motdata.field_0.iterations; float_t start_frame = 0.0f; bool no_opdi = true; @@ -16790,15 +16736,15 @@ void OpdMaker::Reset() { } bool OpdMaker::SetOsagePlayInitData(uint32_t motion_id) { - rob_chara_item_equip* rob_itm_equip = rob_chr->item_equip; - for (int32_t i = ITEM_KAMI; i < ITEM_MAX; i++) { - rob_chara_item_equip_object* itm_eq_obj = rob_itm_equip->get_item_equip_object((item_id)i); - if (itm_eq_obj->obj_info.is_null() || !itm_eq_obj->osage_nodes_count) + rob_chara_item_equip* rob_disp = rob_chr->rob_disp; + for (int32_t i = RPK_KAMI; i < RPK_MAX; i++) { + rob_chara_item_equip_object* skin_disp = rob_disp->get_skin_disp((ROB_PARTS_KIND)i); + if (skin_disp->obj_uid.is_null() || !skin_disp->osage_nodes_count) continue; - size_t data = (size_t)this->data->GetOpdiFileData(itm_eq_obj->obj_info, motion_id); + size_t data = (size_t)this->data->GetOpdiFileData(skin_disp->obj_uid, motion_id); if (data) - rob_itm_equip->set_osage_play_data_init((item_id)i, (float_t*)(data + 0x10)); + rob_disp->set_osage_play_data_init((ROB_PARTS_KIND)i, (float_t*)(data + 0x10)); } return true; } @@ -16837,26 +16783,26 @@ bool OpdMakeWorker::ctrl() { object_database* aft_obj_db = &aft_data->data_ft.obj_db; rob_chara* rob_chr = rob_chara_array_get(chara_id); - chara_index chara_index = rob_chr->chara_index; - const chara_init_data* chr_init_data = chara_init_data_get(chara_index); + CHARA_NUM chara_num = rob_chr->chara_num; + const RobData* rob_data = get_rob_data(chara_num); switch (state) { case 1: { - opd_make_manager->chara_data.PopItems(chara_index, items); + opd_make_manager->chara_data.PopItems(chara_num, items); for (int32_t i = 0; i < ITEM_SUB_MAX; i++) { - rob_chr->item_cos_data.set_chara_index(chara_index); + rob_chr->item_cos_data.set_chara_num(chara_num); rob_chr->item_cos_data.set_item(items[i]); } - rob_chr->item_equip->reset_init_data(rob_chara_bone_data_get_node( - rob_chara_array[chara_id].bone_data, MOT_BONE_N_HARA_CP)); - rob_chr->item_equip->set_shadow_type(chara_id); - rob_chr->item_equip->field_A0 = 0x05; + rob_chr->rob_disp->reset_init_data(rob_chara_bone_data_get_node( + rob_chara_array[chara_id].bone_data, BONE_NODE_N_HARA_CP)); + rob_chr->rob_disp->set_shadow_group(chara_id); + rob_chr->rob_disp->shadow_flag = 0x05; state = 2; } case 2: { if (!task_rob_load_check_load_req_data()) { - task_rob_load_append_load_req_data_obj(chara_index, rob_chr->item_cos_data.get_cos()); + task_rob_load_append_load_req_data_obj(chara_num, rob_chr->item_cos_data.get_cos()); state = 3; } } break; @@ -16866,16 +16812,15 @@ bool OpdMakeWorker::ctrl() { rob_chr->item_cos_data.reload_items(chara_id, aft_bone_data, aft_data, aft_obj_db); - for (int32_t i = ITEM_KAMI; i < ITEM_MAX; i++) { - rob_chara_item_equip_object* itm_eq_obj = rob_chr->item_equip->get_item_equip_object((item_id)i); - if (!objset_info_storage_get_obj_name(itm_eq_obj->obj_info) && itm_eq_obj->osage_nodes_count) + for (int32_t i = RPK_ITEM_BEGIN; i <= RPK_ITEM_END; i++) { + rob_chara_item_equip_object* skin_disp = rob_chr->rob_disp->get_skin_disp((ROB_PARTS_KIND)i); + if (!objset_info_storage_get_obj_name(skin_disp->obj_uid) && skin_disp->osage_nodes_count) continue; - int32_t j = ITEM_ATAMA; - const object_info* k = chr_init_data->field_7E4; - object_info v14 = itm_eq_obj->obj_info; - for (; *k != v14; j++, k++) { - if (j < ITEM_KAMI) + const object_info* body_obj_uid = &rob_data->body_obj_uid[RPK_BASE_BEGIN]; + object_info obj_uid = skin_disp->obj_uid; + for (int32_t j = RPK_BASE_BEGIN; *body_obj_uid != obj_uid; j++, body_obj_uid++) { + if (j <= RPK_BASE_END) continue; if (opd_make_manager->use_opdi) @@ -16942,16 +16887,16 @@ bool OpdMakeWorker::ctrl() { state = 10; } case 10: { - task_rob_load_append_free_req_data_obj(chara_index, rob_chr->item_cos_data.get_cos()); + task_rob_load_append_free_req_data_obj(chara_num, rob_chr->item_cos_data.get_cos()); for (int32_t i = 0; i < ITEM_SUB_MAX; i++) { - rob_chr->item_cos_data.set_chara_index(chara_index); + rob_chr->item_cos_data.set_chara_num(chara_num); rob_chr->item_cos_data.set_item_zero(items[i]); } rob_chr->item_cos_data.reload_items(chara_id, aft_bone_data, aft_data, aft_obj_db); skin_param_manager_reset(chara_id); - if (opd_make_manager->chara_data.CheckNoItems(chara_index)) + if (opd_make_manager->chara_data.CheckNoItems(chara_num)) return true; state = 1; } break; @@ -17042,7 +16987,7 @@ void OpdPlayGen::Ctrl() { for (auto& i : gen_data) { const uint32_t motion_id = i.first; - for (int32_t chara_id = 0; chara_id < ROB_CHARA_COUNT && i.second.size(); chara_id++) { + for (int32_t chara_id = 0; chara_id < ROB_ID_MAX && i.second.size(); chara_id++) { rob_chara* rob_chr = rob_chara_array_get(chara_id); if (!rob_chr) continue; @@ -17061,10 +17006,10 @@ void OpdPlayGen::Ctrl() { continue; } - rob_chara_item_equip* rob_itm_equip = rob_chr->item_equip; + rob_chara_item_equip* rob_disp = rob_chr->rob_disp; - for (int32_t j = ITEM_KAMI; j < ITEM_ITEM16 && i.second.size(); j++) { - rob_chara_item_equip_object* itm_eq_obj = rob_itm_equip->get_item_equip_object((item_id)j); + for (int32_t j = RPK_ITEM_BEGIN; j < RPK_ITEM_END && i.second.size(); j++) { + rob_chara_item_equip_object* skin_disp = rob_disp->get_skin_disp((ROB_PARTS_KIND)j); auto find = [](std::vector>& vec, const object_info key) { auto k = vec.begin(); @@ -17083,10 +17028,10 @@ void OpdPlayGen::Ctrl() { return k; }; - auto elem = find(i.second, itm_eq_obj->obj_info); + auto elem = find(i.second, skin_disp->obj_uid); if (elem != i.second.end()) { if (elem->second.generate) { - obj_info[chara_id][j - ITEM_OSAGE_FIRST] = itm_eq_obj->obj_info; + obj_info[chara_id][j - RPK_ITEM_BEGIN] = skin_disp->obj_uid; motion_ids[chara_id].push_back(motion_id); } @@ -17096,13 +17041,13 @@ void OpdPlayGen::Ctrl() { } } - for (int32_t chara_id = 0; chara_id < ROB_CHARA_COUNT; chara_id++) { + for (int32_t chara_id = 0; chara_id < ROB_ID_MAX; chara_id++) { std::vector& _motion_ids = motion_ids[chara_id]; std::sort(_motion_ids.begin(), _motion_ids.end()); _motion_ids.erase(std::unique(_motion_ids.begin(), _motion_ids.end()), _motion_ids.end()); } - for (int32_t chara_id = 0; chara_id < ROB_CHARA_COUNT; chara_id++) { + for (int32_t chara_id = 0; chara_id < ROB_ID_MAX; chara_id++) { rob_chara* rob_chr = rob_chara_array_get(chara_id); if (!rob_chr) continue; @@ -17114,8 +17059,8 @@ void OpdPlayGen::Ctrl() { float_t frame_count = (float_t)(int32_t)rob_chr->bone_data->get_frame_count() - 1.0f; uint32_t iterations = 60; - if (rob_chr->data.field_1588.field_0.iterations > 0) - iterations = rob_chr->data.field_1588.field_0.iterations; + if (rob_chr->data.motdata.field_0.iterations > 0) + iterations = rob_chr->data.motdata.field_0.iterations; bool has_opd = false; { @@ -17155,7 +17100,7 @@ void OpdPlayGen::Ctrl() { uint32_t _motion_id = motion_id; float_t _frame = (float_t)(int64_t)frame; - rob_chara_item_equip* rob_itm_equip = rob_chr->item_equip; + rob_chara_item_equip* rob_disp = rob_chr->rob_disp; for (int32_t i = 0; i < 600; i++) // Should calm phys osg_mhd.ctrl(); @@ -17219,7 +17164,7 @@ void OpdPlayGen::Ctrl() { opd_chara_data* opd_chr_data = opd_chara_data_array_get(chara_id); - for (int32_t i = 0; i < ITEM_OSAGE_COUNT; i++) { + for (int32_t i = 0; i < RPK_ITEM_MAX; i++) { object_info obj_info = this->obj_info[chara_id][i]; this->obj_info[chara_id][i] = {}; if (obj_info.is_null()) @@ -17282,7 +17227,7 @@ void OpdPlayGen::Reset() { gen_data.clear(); - for (int32_t i = 0; i < ROB_CHARA_COUNT; i++) + for (int32_t i = 0; i < ROB_ID_MAX; i++) set_motion[i].clear(); } @@ -17330,17 +17275,17 @@ void opd_chara_data::add_frame_data() { if (!init || frame_index >= frame_count) return; - rob_chara_item_equip* rob_itm_equip = rob_chara_array_get(chara_id)->item_equip; - for (int32_t i = 0; i < ITEM_OSAGE_COUNT; i++) { - rob_chara_item_equip_object* itm_eq_obj - = rob_itm_equip->get_item_equip_object((item_id)(ITEM_OSAGE_FIRST + i)); - if (!itm_eq_obj->osage_nodes_count) + rob_chara_item_equip* rob_disp = rob_chara_array_get(chara_id)->rob_disp; + for (int32_t i = 0; i < RPK_ITEM_MAX; i++) { + rob_chara_item_equip_object* skin_disp + = rob_disp->get_skin_disp((ROB_PARTS_KIND)(RPK_ITEM_BEGIN + i)); + if (!skin_disp->osage_nodes_count) continue; std::vector>& opd_data = this->opd_data[i]; size_t node_index = 0; - for (ExOsageBlock*& j : itm_eq_obj->osage_blk) { + for (ExOsageBlock*& j : skin_disp->osage_blk) { std::vector& opd_node_data = opd_data.data()[node_index++]; RobJointNode* k_begin = j->osage_work.joint_node_vec.data() + 1; @@ -17353,7 +17298,7 @@ void opd_chara_data::add_frame_data() { } } - for (ExClothBlock*& j : itm_eq_obj->cloth) { + for (ExClothBlock*& j : skin_disp->cloth) { std::vector& opd_node_data = opd_data.data()[node_index++]; CLOTH_VERTEX* k_begin = j->cloth_work.vtxarg.data() + j->cloth_work.width; @@ -17384,18 +17329,18 @@ void opd_chara_data::encode_data() { if (!rob_chr) return; - rob_chara_item_equip* rob_itm_equip = rob_chr->item_equip; + rob_chara_item_equip* rob_disp = rob_chr->rob_disp; std::string buf = sprintf_s_string("%s/%d", get_ram_osage_play_data_tmp_dir(), chara_id); p_farc_write* opd = this->opd; - for (int32_t i = 0; i < ITEM_OSAGE_COUNT; i++, opd++) { - rob_chara_item_equip_object* itm_eq_obj - = rob_itm_equip->get_item_equip_object((item_id)(ITEM_OSAGE_FIRST + i)); - if (!itm_eq_obj->osage_nodes_count) + for (int32_t i = 0; i < RPK_ITEM_MAX; i++, opd++) { + rob_chara_item_equip_object* skin_disp + = rob_disp->get_skin_disp((ROB_PARTS_KIND)(RPK_ITEM_BEGIN + i)); + if (!skin_disp->osage_nodes_count) continue; - object_info obj_info = itm_eq_obj->obj_info; + object_info obj_info = skin_disp->obj_uid; const char* object_name = objset_info_storage_get_obj_name(obj_info); if (!object_name) continue; @@ -17418,7 +17363,7 @@ void opd_chara_data::encode_data() { opd_head->frame_count = frame_count; opd_head->motion_id = motion_id; opd_head->obj_info = { (uint16_t)obj_info.id, (uint16_t)obj_info.set_id }; - opd_head->nodes_count = (uint16_t)itm_eq_obj->osage_nodes_count; + opd_head->nodes_count = (uint16_t)skin_disp->osage_nodes_count; size_t size = sizeof(osage_play_data_header); uint8_t* d = data + size; @@ -17426,8 +17371,8 @@ void opd_chara_data::encode_data() { size_t osage_node_index = 0; bool higher_accuracy = false; for (const std::vector& j : opd_data) { - if (osage_node_index < itm_eq_obj->osage_blk.size()) - higher_accuracy = itm_eq_obj->osage_blk.data()[osage_node_index]->has_children_node; + if (osage_node_index < skin_disp->osage_blk.size()) + higher_accuracy = skin_disp->osage_blk.data()[osage_node_index]->has_children_node; for (const opd_vec3_data_vec& k : j) { size_t size_x = 0; @@ -17471,31 +17416,31 @@ void opd_chara_data::encode_init_data(uint32_t motion_id) { if (!rob_chr) return; - rob_chara_item_equip* rob_itm_equip = rob_chr->item_equip; + rob_chara_item_equip* rob_disp = rob_chr->rob_disp; p_farc_write* opdi = this->opdi; - for (int32_t i = 0; i < ITEM_OSAGE_COUNT; i++, opdi++) { - rob_chara_item_equip_object* itm_eq_obj - = rob_itm_equip->get_item_equip_object((item_id)(ITEM_OSAGE_FIRST + i)); - if (!itm_eq_obj->osage_nodes_count) + for (int32_t i = 0; i < RPK_ITEM_MAX; i++, opdi++) { + rob_chara_item_equip_object* skin_disp + = rob_disp->get_skin_disp((ROB_PARTS_KIND)(RPK_ITEM_BEGIN + i)); + if (!skin_disp->osage_nodes_count) continue; - object_info obj_info = itm_eq_obj->obj_info; + object_info obj_info = skin_disp->obj_uid; const char* object_name = objset_info_storage_get_obj_name(obj_info); if (!object_name) continue; - size_t size = sizeof(osage_play_data_init_header) + sizeof(vec3) * 2 * itm_eq_obj->osage_nodes_count; + size_t size = sizeof(osage_play_data_init_header) + sizeof(vec3) * 2 * skin_disp->osage_nodes_count; uint8_t* data = prj::MemoryManager::alloc(prj::MemCTemp, size, "OPDI_WRITE_BUF"); osage_play_data_init_header* opdi_head = (osage_play_data_init_header*)data; opdi_head->motion_id = motion_id; opdi_head->obj_info = { (uint16_t)obj_info.id, (uint16_t)obj_info.set_id }; - opdi_head->nodes_count = (uint16_t)itm_eq_obj->osage_nodes_count; + opdi_head->nodes_count = (uint16_t)skin_disp->osage_nodes_count; vec3* d = (vec3*)(data + sizeof(osage_play_data_init_header)); - for (ExOsageBlock*& j : itm_eq_obj->osage_blk) { + for (ExOsageBlock*& j : skin_disp->osage_blk) { if (!(j->osage_work.joint_node_vec.size())) break; @@ -17508,7 +17453,7 @@ void opd_chara_data::encode_init_data(uint32_t motion_id) { } } - for (ExClothBlock*& j : itm_eq_obj->cloth) { + for (ExClothBlock*& j : skin_disp->cloth) { if (!(j->cloth_work.vtxarg.size())) break; @@ -17533,18 +17478,18 @@ void opd_chara_data::fs_copy_file() { if (!rob_chr) return; - rob_chara_item_equip* rob_itm_equip = rob_chr->item_equip; + rob_chara_item_equip* rob_disp = rob_chr->rob_disp; std::string tmp_dir = sprintf_s_string("%s/%d", get_dev_ram_opdi_dir(), rob_chr->chara_id); - for (int32_t i = 0; i < ITEM_OSAGE_COUNT; i++) { - rob_chara_item_equip_object* itm_eq_obj - = rob_itm_equip->get_item_equip_object((item_id)(ITEM_OSAGE_FIRST + i)); - if (!itm_eq_obj->osage_nodes_count) + for (int32_t i = 0; i < RPK_ITEM_MAX; i++) { + rob_chara_item_equip_object* skin_disp + = rob_disp->get_skin_disp((ROB_PARTS_KIND)(RPK_ITEM_BEGIN + i)); + if (!skin_disp->osage_nodes_count) continue; opdi[i].write_file(); - const char* object_name = objset_info_storage_get_obj_name(itm_eq_obj->obj_info); + const char* object_name = objset_info_storage_get_obj_name(skin_disp->obj_uid); if (!object_name) continue; @@ -17562,20 +17507,20 @@ void opd_chara_data::init_data(uint32_t motion_id) { if (!rob_chr) return; - rob_chara_item_equip* rob_itm_equip = rob_chr->item_equip; - int32_t frame_count = (int32_t)rob_chr->data.field_1588.field_0.frame; - for (int32_t i = 0; i < ITEM_OSAGE_COUNT; i++) { - rob_chara_item_equip_object* itm_eq_obj - = rob_itm_equip->get_item_equip_object((item_id)(ITEM_OSAGE_FIRST + i)); - if (!itm_eq_obj->osage_nodes_count) + rob_chara_item_equip* rob_disp = rob_chr->rob_disp; + int32_t frame_count = (int32_t)rob_chr->data.motdata.field_0.frame; + for (int32_t i = 0; i < RPK_ITEM_MAX; i++) { + rob_chara_item_equip_object* skin_disp + = rob_disp->get_skin_disp((ROB_PARTS_KIND)(RPK_ITEM_BEGIN + i)); + if (!skin_disp->osage_nodes_count) continue; std::vector>& opd_data = this->opd_data[i]; opd_data.clear(); - opd_data.resize(itm_eq_obj->cloth.size() + itm_eq_obj->osage_blk.size()); + opd_data.resize(skin_disp->cloth.size() + skin_disp->osage_blk.size()); size_t node_index = 0; - for (ExOsageBlock*& j : itm_eq_obj->osage_blk) { + for (ExOsageBlock*& j : skin_disp->osage_blk) { std::vector& opd_node_data = opd_data.data()[node_index++]; opd_node_data.resize(j->osage_work.joint_node_vec.size() - 1); @@ -17589,7 +17534,7 @@ void opd_chara_data::init_data(uint32_t motion_id) { } } - for (ExClothBlock*& j : itm_eq_obj->cloth) { + for (ExClothBlock*& j : skin_disp->cloth) { std::vector& opd_node_data = opd_data.data()[node_index++]; opd_node_data.resize(j->cloth_work.vtxarg.size() - j->cloth_work.width); @@ -17615,13 +17560,13 @@ void opd_chara_data::open_opd_file() { if (!rob_chr) return; - rob_chara_item_equip* rob_itm_equip = rob_chr->item_equip; + rob_chara_item_equip* rob_disp = rob_chr->rob_disp; p_farc_write* opd = this->opd; - for (int32_t i = 0; i < ITEM_OSAGE_COUNT; i++, opd++) { - rob_chara_item_equip_object* itm_eq_obj - = rob_itm_equip->get_item_equip_object((item_id)(ITEM_OSAGE_FIRST + i)); - if (!itm_eq_obj->osage_nodes_count) + for (int32_t i = 0; i < RPK_ITEM_MAX; i++, opd++) { + rob_chara_item_equip_object* skin_disp + = rob_disp->get_skin_disp((ROB_PARTS_KIND)(RPK_ITEM_BEGIN + i)); + if (!skin_disp->osage_nodes_count) continue; const char* ram_osage_play_data_tmp_path = get_ram_osage_play_data_tmp_dir(); @@ -17631,7 +17576,7 @@ void opd_chara_data::open_opd_file() { if (!path_check_directory_exists(chara_dir.c_str())) path_create_directory(chara_dir.c_str()); - const char* object_name = objset_info_storage_get_obj_name(itm_eq_obj->obj_info); + const char* object_name = objset_info_storage_get_obj_name(skin_disp->obj_uid); if (!object_name) continue; @@ -17645,13 +17590,13 @@ void opd_chara_data::open_opdi_file() { if (!rob_chr) return; - rob_chara_item_equip* rob_itm_equip = rob_chr->item_equip; + rob_chara_item_equip* rob_disp = rob_chr->rob_disp; p_farc_write* opdi = this->opdi; - for (int32_t i = 0; i < ITEM_OSAGE_COUNT; i++, opdi++) { - rob_chara_item_equip_object* itm_eq_obj - = rob_itm_equip->get_item_equip_object((item_id)(ITEM_OSAGE_FIRST + i)); - if (!itm_eq_obj->osage_nodes_count) + for (int32_t i = 0; i < RPK_ITEM_MAX; i++, opdi++) { + rob_chara_item_equip_object* skin_disp + = rob_disp->get_skin_disp((ROB_PARTS_KIND)(RPK_ITEM_BEGIN + i)); + if (!skin_disp->osage_nodes_count) continue; const char* ram_osage_play_data_tmp_path = get_ram_osage_play_data_tmp_dir(); @@ -17661,7 +17606,7 @@ void opd_chara_data::open_opdi_file() { if (!path_check_directory_exists(chara_dir.c_str())) path_create_directory(chara_dir.c_str()); - const char* object_name = objset_info_storage_get_obj_name(itm_eq_obj->obj_info); + const char* object_name = objset_info_storage_get_obj_name(skin_disp->obj_uid); if (!object_name) continue; @@ -17676,7 +17621,7 @@ void opd_chara_data::reset() { frame_index = 0; frame_count = 0; field_18 = 0; - for (int32_t i = 0; i < ITEM_OSAGE_COUNT; i++) + for (int32_t i = 0; i < RPK_ITEM_MAX; i++) opd_data[i].clear(); } @@ -17685,9 +17630,9 @@ void opd_chara_data::write_file() { if (!rob_chr) return; - rob_chara_item_equip* rob_itm_equip = rob_chr->item_equip; - for (int32_t i = 0; i < ITEM_OSAGE_COUNT; i++) - if (rob_itm_equip->get_item_equip_object((item_id)(ITEM_OSAGE_FIRST + i))->osage_nodes_count) + rob_chara_item_equip* rob_disp = rob_chr->rob_disp; + for (int32_t i = 0; i < RPK_ITEM_MAX; i++) + if (rob_disp->get_skin_disp((ROB_PARTS_KIND)(RPK_ITEM_BEGIN + i))->osage_nodes_count) opd[i].write_file(); } @@ -17751,15 +17696,15 @@ void OsagePlayDataManager::AppendCharaMotionId(rob_chara* rob_chr, const std::ve if (CheckTaskReady() || !rob_chr) return; - rob_chara_item_equip* rob_itm_equip = rob_chr->item_equip; - for (int32_t i = ITEM_KAMI; i < ITEM_ITEM16; i++) { - rob_chara_item_equip_object* itm_eq_obj = rob_itm_equip->get_item_equip_object((item_id)i); - if (!itm_eq_obj || itm_eq_obj->obj_info.is_null() - || (!itm_eq_obj->osage_blk.size() && !itm_eq_obj->cloth.size())) + rob_chara_item_equip* rob_disp = rob_chr->rob_disp; + for (int32_t i = RPK_ITEM_BEGIN; i < RPK_ITEM_END; i++) { + rob_chara_item_equip_object* skin_disp = rob_disp->get_skin_disp((ROB_PARTS_KIND)i); + if (!skin_disp || skin_disp->obj_uid.is_null() + || (!skin_disp->osage_blk.size() && !skin_disp->cloth.size())) continue; for (const uint32_t j : motion_ids) - req_data.push_back(itm_eq_obj->obj_info, j); + req_data.push_back(skin_disp->obj_uid, j); } } @@ -18303,7 +18248,7 @@ void rob_osage_mothead::set_rob_parts_adjust(const mothead_data* mhd_data) { v16.strength_transition = (float_t)((int32_t*)data)[15]; } else - rob_chr->item_equip->reset_nodes_ex_force((rob_osage_parts)((uint8_t*)data)[4]); + rob_chr->rob_disp->reset_nodes_ex_force((rob_osage_parts)((uint8_t*)data)[4]); rob_chara_set_parts_adjust_by_index(rob_chr, (rob_osage_parts)((uint8_t*)data)[4], &v16); } @@ -18349,8 +18294,8 @@ OpdMakeManager::CharaData::~CharaData() { } -void OpdMakeManager::CharaData::AddCostumes(const std::list>& costumes) { - for (const std::pair& i : costumes) { +void OpdMakeManager::CharaData::AddCostumes(const std::list>& costumes) { + for (const std::pair& i : costumes) { const item_cos_data* cos = item_table_handler_array_get_item_cos_data(i.first, i.second); for (int32_t j = 0; j < ITEM_SUB_MAX; j++) { int32_t item_no = cos->arr[j]; @@ -18371,33 +18316,33 @@ void OpdMakeManager::CharaData::AddCostumes(const std::list& customize_items) { for (const std::string& i : customize_items) { - chara_index chara_index = CHARA_MAX; + CHARA_NUM chara_num = CN_MAX; int32_t item_no = 0; - customize_item_table_handler_data_get_chara_item(i, chara_index, item_no); - if (chara_index >= CHARA_MAX || !item_no) + customize_item_table_handler_data_get_chara_item(i, chara_num, item_no); + if (chara_num >= CN_MAX || !item_no) continue; - const item_table_item* item = item_table_handler_array_get_item(chara_index, item_no); + const item_table_item* item = item_table_handler_array_get_item(chara_num, item_no); if (!item) continue; if (!(item->attr & 0x0C)) - chara_costumes[chara_index].items[item->sub_id].push_back(item_no); + chara_costumes[chara_num].items[item->sub_id].push_back(item_no); else if (item->org_itm) - chara_costumes[chara_index].items[item->sub_id].push_back(item->org_itm); + chara_costumes[chara_num].items[item->sub_id].push_back(item->org_itm); } } -bool OpdMakeManager::CharaData::CheckNoItems(chara_index chara_index) { - std::vector* chara_items = chara_costumes[chara_index].items; +bool OpdMakeManager::CharaData::CheckNoItems(CHARA_NUM chara_num) { + std::vector* chara_items = chara_costumes[chara_num].items; for (int32_t i = 0; i < ITEM_SUB_MAX; i++, chara_items++) if (chara_items->size()) return false; return true; } -void OpdMakeManager::CharaData::PopItems(chara_index chara_index, int32_t items[ITEM_SUB_MAX]) { - std::vector* chara_items = chara_costumes[chara_index].items; +void OpdMakeManager::CharaData::PopItems(CHARA_NUM chara_num, int32_t items[ITEM_SUB_MAX]) { + std::vector* chara_items = chara_costumes[chara_num].items; for (int32_t i = 0; i < ITEM_SUB_MAX; i++) { items[i] = 0; if (!chara_items[i].size()) @@ -18410,7 +18355,7 @@ void OpdMakeManager::CharaData::PopItems(chara_index chara_index, int32_t items[ } void OpdMakeManager::CharaData::Reset() { - for (int32_t i = 0; i < CHARA_MAX; i++) + for (int32_t i = 0; i < CN_MAX; i++) for (int32_t j = 0; j < ITEM_SUB_MAX; j++) chara_costumes[i].items[j].clear(); @@ -18419,7 +18364,7 @@ void OpdMakeManager::CharaData::Reset() { } void OpdMakeManager::CharaData::SortUnique() { - for (int32_t i = 0; i < CHARA_MAX; i++) + for (int32_t i = 0; i < CN_MAX; i++) for (int32_t j = 0; j < ITEM_SUB_MAX; j++) { prj::sort_unique(chara_costumes[i].items[j]); count += chara_costumes[i].items[j].size(); @@ -18430,7 +18375,7 @@ void OpdMakeManager::CharaData::SortUnique() { OpdMakeManager::OpdMakeManager() : mode(), workers() { mode = 0; - chara = CHARA_MIKU; + chara = CN_MIKU; int32_t chara_id = 0; for (OpdMakeWorker*& i : workers) @@ -18508,15 +18453,15 @@ bool OpdMakeManager::ctrl() { if (wait) break; - chara = CHARA_MIKU; + chara = CN_MIKU; mode = 5; break; } break; case 5: { bool has_items = false; - for (int32_t i = 0; i < CHARA_MAX; i++) - if (!chara_data.CheckNoItems((chara_index)i)) { - chara = (chara_index)i; + for (int32_t i = 0; i < CN_MAX; i++) + if (!chara_data.CheckNoItems((CHARA_NUM)i)) { + chara = (CHARA_NUM)i; has_items = true; break; } @@ -18525,7 +18470,7 @@ bool OpdMakeManager::ctrl() { for (int32_t i = 0; i < OPD_MAKE_COUNT; i++) { rob_chara_pv_data pv_data; pv_data.type = ROB_CHARA_TYPE_3; - rob_chara_array_init_chara_index(chara, pv_data, 499, false); + rob_chara_array_init_chara_num(chara, pv_data, 499, false); } mode = 6; } @@ -18595,7 +18540,7 @@ bool OpdMakeManager::dest() { for (int32_t i = 0; i < OPD_MAKE_COUNT; i++) rob_chara_array_free_chara_id(i); - for (int32_t i = 0; i < ROB_CHARA_COUNT; i++) + for (int32_t i = 0; i < ROB_ID_MAX; i++) skin_param_manager_reset(i); for (uint32_t& i : motion_set_ids) { @@ -18625,9 +18570,9 @@ void OpdMakeManager::add_task(const OpdMakeManagerArgs& args) { if (args.modules) { const std::vector& modules = module_data_handler_data_get_modules(); - std::list> costumes; + std::list> costumes; for (const uint32_t& i : *args.modules) - costumes.push_back({ modules[i].chara_index, modules[i].cos }); + costumes.push_back({ modules[i].chara_num, modules[i].cos }); chara_data.AddCostumes(costumes); } @@ -18653,12 +18598,12 @@ OpdMakeManagerData* OpdMakeManager::GetData() { return &data; } -ReqData::ReqData() : chara_index(), count() { +ReqData::ReqData() : chara_num(), count() { } -ReqData::ReqData(::chara_index chara_index, int32_t count) { - this->chara_index = chara_index; +ReqData::ReqData(CHARA_NUM chara_num, int32_t count) { + this->chara_num = chara_num; this->count = count; } @@ -18667,15 +18612,15 @@ ReqData::~ReqData() { } void ReqData::Reset() { - chara_index = CHARA_MAX; + chara_num = CN_MAX; count = 0; } -ReqDataObj::ReqDataObj() : ReqData(chara_index, count), cos() { +ReqDataObj::ReqDataObj() : ReqData(chara_num, count), cos() { } -ReqDataObj::ReqDataObj(::chara_index chara_index, int32_t count) : ReqData(chara_index, count), cos() { +ReqDataObj::ReqDataObj(CHARA_NUM chara_num, int32_t count) : ReqData(chara_num, count), cos() { } @@ -18738,7 +18683,7 @@ void rob_chara_age_age_object::calc_vertex(rob_chara_age_age_object_vertex*& vtx vtx_data = vtx; } -void rob_chara_age_age_object::disp(render_context* rctx, size_t chara_index, +void rob_chara_age_age_object::disp(render_context* rctx, size_t chara_num, bool npr, bool reflect, const vec3& a5, bool chara_color) { int32_t disp_count = this->disp_count; if (!objset_info || !disp_count) @@ -18781,7 +18726,7 @@ void rob_chara_age_age_object::disp(render_context* rctx, size_t chara_index, enum_or(flags, mdl::OBJ_CHARA_REFLECT); rctx->disp_manager->set_obj_flags(flags); rctx->disp_manager->set_chara_color(chara_color); - rctx->disp_manager->set_shadow_type(chara_index ? SHADOW_STAGE : SHADOW_CHARA); + rctx->disp_manager->set_shadow_group(chara_num ? SHADOW_GROUP_STAGE : SHADOW_GROUP_CHARA); rctx->disp_manager->entry_obj_by_obj(mat4_identity, &obj, &get_obj_set_texture(), &obj_vert_buf, &obj_index_buf, 0, 1.0f); } @@ -19310,12 +19255,12 @@ void rob_sleeve_handler::clear() { file_handlers.clear(); } -void rob_sleeve_handler::get_sleeve_data(::chara_index chara_index, +void rob_sleeve_handler::get_sleeve_data(CHARA_NUM chara_num, int32_t cos, rob_sleeve_data& l, rob_sleeve_data& r) { l = {}; r = {}; - auto elem = sleeves.find({ chara_index, cos }); + auto elem = sleeves.find({ chara_num, cos }); if (elem != sleeves.end()) { if (elem->second.type & ROB_SLEEVE_L && elem->second.l) l = *elem->second.l; @@ -19375,9 +19320,9 @@ void rob_sleeve_handler::parse(p_file_handler* pfhndl) { else if (!str_utils_compare(type_str, "LR")) type = ROB_SLEEVE_LR; - ::chara_index chara_index = chara_index_get_from_chara_name(chara); + CHARA_NUM chara_num = get_chara_num_from_char_id(chara); - rob_sleeve& sleeve = sleeves.insert({ { chara_index, cos - 1 }, {} }).first->second; + rob_sleeve& sleeve = sleeves.insert({ { chara_num, cos - 1 }, {} }).first->second; switch (type) { case ROB_SLEEVE_L: parse_sleeve_data(kv, sleeve.l); @@ -19550,8 +19495,8 @@ void PvOsageManager::AddMotionFrameResetData(int32_t stage_index, if (iterations < 0) { iterations = 60; - if (rob_chr->data.field_1588.field_0.iterations > 0) - iterations = rob_chr->data.field_1588.field_0.iterations; + if (rob_chr->data.motdata.field_0.iterations > 0) + iterations = rob_chr->data.motdata.field_0.iterations; } rob_chara_add_motion_reset_data(rob_chr, motion_id, frame, iterations); @@ -19744,8 +19689,8 @@ void PvOsageManager::sub_1404F83A0(::osage_set_motion* a2) { return; int32_t iterations = 60; - if (rob_chr->data.field_1588.field_0.iterations > 0) - iterations = rob_chr->data.field_1588.field_0.iterations; + if (rob_chr->data.motdata.field_0.iterations > 0) + iterations = rob_chr->data.motdata.field_0.iterations; float_t frame = v34.front() - (float_t)iterations + 1.0f; while (frame < 0.0f) @@ -19823,14 +19768,14 @@ void PvOsageManager::sub_1404F8AA0() { for (const pv_db_pv_osage_init& i : pv->osage_init) { int32_t osage_init_motion_id = aft_mot_db->get_motion_id(i.motion.c_str()); if (osage_init_motion_id != -1 && osage_init_motion_id == motion_id) { - if (rob_chr->data.field_1588.field_0.field_58 == 1) + if (rob_chr->data.motdata.field_0.field_58 == 1) sub_1404F88A0(i.stage, osage_init_motion_id, (float_t)i.frame); else AddMotionFrameResetData(i.stage, osage_init_motion_id, (float_t)i.frame, -1); } } - if (rob_chr->data.field_1588.field_0.field_58 == 1) { + if (rob_chr->data.motdata.field_0.field_58 == 1) { sub_1404F83A0(&v4); } else { @@ -20012,12 +19957,12 @@ void RobThreadParent::ThreadMain(RobThreadParent* rob_thrd_parent) { } RobThreadHandler::RobThreadHandler() { - for (int32_t i = 0; i < ROB_CHARA_COUNT; i++) + for (int32_t i = 0; i < ROB_ID_MAX; i++) arr[i] = new RobThreadParent; } RobThreadHandler::~RobThreadHandler() { - for (int32_t i = 0; i < ROB_CHARA_COUNT; i++) { + for (int32_t i = 0; i < ROB_ID_MAX; i++) { delete arr[i]; arr[i] = 0; } @@ -20053,7 +19998,7 @@ void RobImplTask::disp() { } void RobImplTask::AppendList(rob_chara* rob_chr, std::list* list) { - if (!rob_chr || !list || rob_chr->chara_id >= ROB_CHARA_COUNT || list->size() >= ROB_CHARA_COUNT) + if (!rob_chr || !list || rob_chr->chara_id >= ROB_ID_MAX || list->size() >= ROB_ID_MAX) return; bool found = false; @@ -20080,7 +20025,7 @@ void RobImplTask::AppendInitCharaList(rob_chara* rob_chr) { } void RobImplTask::FreeList(int8_t* chara_id, std::list* list) { - if (!chara_id || !list || *chara_id >= ROB_CHARA_COUNT || !list->size()) + if (!chara_id || !list || *chara_id >= ROB_ID_MAX || !list->size()) return; for (auto i = list->begin(); i != list->end();) { @@ -20140,7 +20085,7 @@ bool TaskRobBase::ctrl() { rob_thread_handler->sub_14054E3F0(); for (rob_chara*& i : ctrl_chara) - if (i && !(i->data.field_3 & 0x80)) + if (i && !i->data.flag.bit.rf_31) rob_base_rob_chara_ctrl(i); for (rob_chara*& i : free_chara) @@ -20203,7 +20148,7 @@ bool TaskRobCollision::ctrl() { } /*for (rob_chara*& i : ctrl_chara) - if (i && !(i->data.field_3 & 0x80)) + if (i && !i->data.flag.bit.rf_31) sub_14050EA90(v13);*/ } @@ -20250,11 +20195,11 @@ bool TaskRobDisp::ctrl() { init_chara.clear(); for (rob_chara*& i : ctrl_chara) - if (i && !(i->data.field_3 & 0x80)) + if (i && !i->data.flag.bit.rf_31) rob_disp_rob_chara_ctrl(i); for (rob_chara*& i : ctrl_chara) - if (i && !(i->data.field_3 & 0x80)) + if (i && !i->data.flag.bit.rf_31) rob_thread_handler->AppendRobCharaFunc(i->chara_id, i, rob_disp_rob_chara_ctrl_thread_main); @@ -20295,7 +20240,7 @@ void TaskRobDisp::disp() { if (!i || pv_osage_manager_array_get_disp(i->chara_id)) continue; - if (i->is_visible() && !(i->data.field_3 & 0x80)) + if (i->is_visible() && !i->data.flag.bit.rf_31) rob_disp_rob_chara_disp(i); } } @@ -20326,7 +20271,7 @@ bool TaskRobInfo::ctrl() { init_chara.clear(); for (rob_chara*& i : ctrl_chara) - if (i && !(i->data.field_3 & 0x80)) + if (i && !i->data.flag.bit.rf_31) i->rob_info_ctrl(); free_chara.clear(); @@ -20401,31 +20346,31 @@ bool TaskRobLoad::dest() { return true; } -bool TaskRobLoad::AppendFreeReqData(chara_index chara_index) { - if (chara_index < CHARA_MIKU || chara_index > CHARA_TETO) +bool TaskRobLoad::AppendFreeReqData(CHARA_NUM chara_num) { + if (chara_num < CN_MIKU || chara_num > CN_TETO) return false; for (auto i = load_req_data.end(); i != load_req_data.begin(); ) { i--; - if (i->chara_index == chara_index) { + if (i->chara_num == chara_num) { i = load_req_data.erase(i); return true; } } ReqData value; - value.chara_index = chara_index; + value.chara_num = chara_num; free_req_data.push_back(value); return true; } -bool TaskRobLoad::AppendFreeReqDataObj(chara_index chara_index, const item_cos_data* cos) { - if (chara_index < CHARA_MIKU || chara_index > CHARA_TETO) +bool TaskRobLoad::AppendFreeReqDataObj(CHARA_NUM chara_num, const item_cos_data* cos) { + if (chara_num < CN_MIKU || chara_num > CN_TETO) return false; for (auto i = load_req_data_obj.end(); i != load_req_data_obj.begin(); ) { i--; - if (i->chara_index == chara_index + if (i->chara_num == chara_num && !memcmp(&i->cos, cos, sizeof(item_cos_data))) { i = load_req_data_obj.erase(i); return true; @@ -20433,38 +20378,38 @@ bool TaskRobLoad::AppendFreeReqDataObj(chara_index chara_index, const item_cos_d } ReqDataObj value; - value.chara_index = chara_index; + value.chara_num = chara_num; value.cos = *cos; free_req_data_obj.push_back(value); return true; } -bool TaskRobLoad::AppendLoadReqData(chara_index chara_index) { - if (chara_index < CHARA_MIKU || chara_index > CHARA_TETO) +bool TaskRobLoad::AppendLoadReqData(CHARA_NUM chara_num) { + if (chara_num < CN_MIKU || chara_num > CN_TETO) return false; for (auto i = free_req_data.end(); i != free_req_data.begin(); ) { i--; - if (i->chara_index == chara_index) { + if (i->chara_num == chara_num) { i = free_req_data.erase(i); return true; } } ReqData value; - value.chara_index = chara_index; + value.chara_num = chara_num; value.count = 1; load_req_data.push_back(value); return true; } -bool TaskRobLoad::AppendLoadReqDataObj(chara_index chara_index, const item_cos_data* cos) { - if (chara_index < CHARA_MIKU || chara_index > CHARA_TETO) +bool TaskRobLoad::AppendLoadReqDataObj(CHARA_NUM chara_num, const item_cos_data* cos) { + if (chara_num < CN_MIKU || chara_num > CN_TETO) return false; for (auto i = free_req_data_obj.end(); i != free_req_data_obj.begin(); ) { i--; - if (i->chara_index == chara_index + if (i->chara_num == chara_num && !memcmp(&i->cos, cos, sizeof(item_cos_data))) { i = free_req_data_obj.erase(i); return true; @@ -20472,7 +20417,7 @@ bool TaskRobLoad::AppendLoadReqDataObj(chara_index chara_index, const item_cos_d } ReqDataObj value; - value.chara_index = chara_index; + value.chara_num = chara_num; value.cos = *cos; value.count = 1; load_req_data_obj.push_back(value); @@ -20481,7 +20426,7 @@ bool TaskRobLoad::AppendLoadReqDataObj(chara_index chara_index, const item_cos_d void TaskRobLoad::AppendLoadedReqData(ReqData* req_data) { for (ReqData& i : loaded_req_data) - if (i.chara_index == req_data->chara_index) { + if (i.chara_num == req_data->chara_num) { if (i.count != 0x7FFFFFFF) i.count++; return; @@ -20492,7 +20437,7 @@ void TaskRobLoad::AppendLoadedReqData(ReqData* req_data) { void TaskRobLoad::AppendLoadedReqDataObj(ReqDataObj* req_data_obj) { for (ReqDataObj& i : loaded_req_data_obj) - if (i.chara_index == req_data_obj->chara_index + if (i.chara_num == req_data_obj->chara_num && !memcmp(&i.cos, &req_data_obj->cos, sizeof(item_cos_data))) { if (i.count != 0x7FFFFFFF) i.count++; @@ -20515,7 +20460,7 @@ int32_t TaskRobLoad::CtrlFunc3() { int32_t ret = -1; if (free_req_data_obj.size()) { for (ReqDataObj& i : free_req_data_obj) { - UnloadCharaItemsParent(i.chara_index, &i.cos); + UnloadCharaItemsParent(i.chara_num, &i.cos); FreeLoadedReqDataObj(&i); } free_req_data_obj.clear(); @@ -20523,7 +20468,7 @@ int32_t TaskRobLoad::CtrlFunc3() { if (free_req_data.size()) { for (ReqData& i : free_req_data) { - UnloadCharaObjSetMotionSet(i.chara_index); + UnloadCharaObjSetMotionSet(i.chara_num); FreeLoadedReqData(&i); } free_req_data.clear(); @@ -20536,7 +20481,7 @@ int32_t TaskRobLoad::CtrlFunc3() { if (load_req_data_obj.size()) { for (ReqDataObj& i : load_req_data_obj) { AppendLoadedReqDataObj(&i); - LoadCharaItemsParent(i.chara_index, &i.cos, aft_data, aft_obj_db); + LoadCharaItemsParent(i.chara_num, &i.cos, aft_data, aft_obj_db); load_item_req_data_obj.push_back(i); } load_req_data_obj.clear(); @@ -20546,7 +20491,7 @@ int32_t TaskRobLoad::CtrlFunc3() { if (load_req_data.size()) { for (ReqData& i : load_req_data) { AppendLoadedReqData(&i); - LoadCharaObjSetMotionSet(i.chara_index, aft_data, aft_obj_db, aft_mot_db); + LoadCharaObjSetMotionSet(i.chara_num, aft_data, aft_obj_db, aft_mot_db); load_item_req_data.push_back(i); } load_req_data.clear(); @@ -20558,7 +20503,7 @@ int32_t TaskRobLoad::CtrlFunc3() { int32_t TaskRobLoad::CtrlFunc4() { if (load_item_req_data_obj.size()) { for (ReqDataObj& i : load_item_req_data_obj) - if (LoadCharaItemsCheckNotReadParent(i.chara_index, &i.cos)) + if (LoadCharaItemsCheckNotReadParent(i.chara_num, &i.cos)) return -1; load_item_req_data_obj.clear(); } @@ -20567,7 +20512,7 @@ int32_t TaskRobLoad::CtrlFunc4() { if (load_item_req_data.size()) { for (ReqData& i : load_item_req_data) - if (LoadCharaObjSetMotionSetCheck(i.chara_index)) + if (LoadCharaObjSetMotionSetCheck(i.chara_num)) return -1; load_item_req_data.clear(); } @@ -20579,7 +20524,7 @@ int32_t TaskRobLoad::CtrlFunc4() { void TaskRobLoad::FreeLoadedReqData(ReqData* req_data) { for (auto i = loaded_req_data.begin(); i != loaded_req_data.end(); i++) - if (i->chara_index == req_data->chara_index) { + if (i->chara_num == req_data->chara_num) { if (i->count > 0) i->count--; @@ -20591,7 +20536,7 @@ void TaskRobLoad::FreeLoadedReqData(ReqData* req_data) { void TaskRobLoad::FreeLoadedReqDataObj(ReqDataObj* req_data_obj) { for (auto i = loaded_req_data_obj.begin(); i != loaded_req_data_obj.end(); i++) - if (i->chara_index == req_data_obj->chara_index + if (i->chara_num == req_data_obj->chara_num && !memcmp(&i->cos, &req_data_obj->cos, sizeof(item_cos_data))) { if (i->count > 0) i->count--; @@ -20602,13 +20547,13 @@ void TaskRobLoad::FreeLoadedReqDataObj(ReqDataObj* req_data_obj) { } } -void TaskRobLoad::LoadCharaItem(chara_index chara_index, +void TaskRobLoad::LoadCharaItem(CHARA_NUM chara_num, int32_t item_no, void* data, const object_database* obj_db) { if (!item_no) return; const std::vector* item_objset - = item_table_handler_array_get_item_objset(chara_index, item_no); + = item_table_handler_array_get_item_objset(chara_num, item_no); if (!item_objset) return; @@ -20617,12 +20562,12 @@ void TaskRobLoad::LoadCharaItem(chara_index chara_index, objset_info_storage_load_set(data, obj_db, i); } -bool TaskRobLoad::LoadCharaItemCheckNotRead(chara_index chara_index, int32_t item_no) { +bool TaskRobLoad::LoadCharaItemCheckNotRead(CHARA_NUM chara_num, int32_t item_no) { if (!item_no) return false; const std::vector* item_objset - = item_table_handler_array_get_item_objset(chara_index, item_no); + = item_table_handler_array_get_item_objset(chara_num, item_no); if (!item_objset) return true; @@ -20632,47 +20577,47 @@ bool TaskRobLoad::LoadCharaItemCheckNotRead(chara_index chara_index, int32_t ite return false; } -void TaskRobLoad::LoadCharaItems(chara_index chara_index, +void TaskRobLoad::LoadCharaItems(CHARA_NUM chara_num, item_cos_data* cos, void* data, const object_database* obj_db) { for (int32_t i = 0; i < ITEM_SUB_MAX; i++) - LoadCharaItem(chara_index, cos->arr[i], data, obj_db); + LoadCharaItem(chara_num, cos->arr[i], data, obj_db); } -bool TaskRobLoad::LoadCharaItemsCheckNotRead(chara_index chara_index, item_cos_data* cos) { +bool TaskRobLoad::LoadCharaItemsCheckNotRead(CHARA_NUM chara_num, item_cos_data* cos) { for (int32_t& i : cos->arr) - if (LoadCharaItemCheckNotRead(chara_index, i)) + if (LoadCharaItemCheckNotRead(chara_num, i)) return true; return false; } -bool TaskRobLoad::LoadCharaItemsCheckNotReadParent(chara_index chara_index, item_cos_data* cos) { - return TaskRobLoad::LoadCharaItemsCheckNotRead(chara_index, cos) +bool TaskRobLoad::LoadCharaItemsCheckNotReadParent(CHARA_NUM chara_num, item_cos_data* cos) { + return TaskRobLoad::LoadCharaItemsCheckNotRead(chara_num, cos) || cos->data.kami == 649 && objset_info_storage_load_obj_set_check_not_read(3291); } -void TaskRobLoad::LoadCharaItemsParent(chara_index chara_index, +void TaskRobLoad::LoadCharaItemsParent(CHARA_NUM chara_num, item_cos_data* cos, void* data, const object_database* obj_db) { - LoadCharaItems(chara_index, cos, data, obj_db); + LoadCharaItems(chara_num, cos, data, obj_db); if (cos->data.kami == 649) objset_info_storage_load_set(data, obj_db, 3291); } -void TaskRobLoad::LoadCharaObjSetMotionSet(chara_index chara_index, +void TaskRobLoad::LoadCharaObjSetMotionSet(CHARA_NUM chara_num, void* data, const object_database* obj_db, const motion_database* mot_db) { - const chara_init_data* chr_init_data = chara_init_data_get(chara_index); - objset_info_storage_load_set(data, obj_db, chr_init_data->object_set); + const RobData* rob_data = get_rob_data(chara_num); + objset_info_storage_load_set(data, obj_db, rob_data->object_set); motion_set_load_motion(cmn_set_id, "", mot_db); motion_set_load_mothead(cmn_set_id, "", mot_db); - motion_set_load_motion(chr_init_data->motion_set, "", mot_db); + motion_set_load_motion(rob_data->motfile, "", mot_db); } -bool TaskRobLoad::LoadCharaObjSetMotionSetCheck(chara_index chara_index) { - const chara_init_data* chr_init_data = chara_init_data_get(chara_index); - if (objset_info_storage_load_obj_set_check_not_read(chr_init_data->object_set) +bool TaskRobLoad::LoadCharaObjSetMotionSetCheck(CHARA_NUM chara_num) { + const RobData* rob_data = get_rob_data(chara_num); + if (objset_info_storage_load_obj_set_check_not_read(rob_data->object_set) || motion_storage_check_mot_file_not_ready(cmn_set_id) || mothead_storage_check_mhd_file_not_ready(cmn_set_id)) return true; - return motion_storage_check_mot_file_not_ready(chr_init_data->motion_set); + return motion_storage_check_mot_file_not_ready(rob_data->motfile); } void TaskRobLoad::ResetReqData() { @@ -20689,12 +20634,12 @@ void TaskRobLoad::ResetReqDataObj() { loaded_req_data_obj.clear(); } -void TaskRobLoad::UnloadCharaItem(chara_index chara_index, int32_t item_no) { +void TaskRobLoad::UnloadCharaItem(CHARA_NUM chara_num, int32_t item_no) { if (!item_no) return; const std::vector* item_objset - = item_table_handler_array_get_item_objset(chara_index, item_no); + = item_table_handler_array_get_item_objset(chara_num, item_no); if (!item_objset) return; @@ -20703,35 +20648,35 @@ void TaskRobLoad::UnloadCharaItem(chara_index chara_index, int32_t item_no) { objset_info_storage_unload_set(i); } -void TaskRobLoad::UnloadCharaItems(chara_index chara_index, item_cos_data* cos) { +void TaskRobLoad::UnloadCharaItems(CHARA_NUM chara_num, item_cos_data* cos) { for (int32_t i = 0; i < ITEM_SUB_MAX; i++) - UnloadCharaItem(chara_index, cos->arr[i]); + UnloadCharaItem(chara_num, cos->arr[i]); } -void TaskRobLoad::UnloadCharaItemsParent(chara_index chara_index, item_cos_data* cos) { +void TaskRobLoad::UnloadCharaItemsParent(CHARA_NUM chara_num, item_cos_data* cos) { if (cos->data.kami == 649) objset_info_storage_unload_set(3291); - UnloadCharaItems(chara_index, cos); + UnloadCharaItems(chara_num, cos); } -void TaskRobLoad::UnloadCharaObjSetMotionSet(chara_index chara_index) { - const chara_init_data* chr_init_data = chara_init_data_get(chara_index); - objset_info_storage_unload_set(chr_init_data->object_set); +void TaskRobLoad::UnloadCharaObjSetMotionSet(CHARA_NUM chara_num) { + const RobData* rob_data = get_rob_data(chara_num); + objset_info_storage_unload_set(rob_data->object_set); motion_set_unload_motion(cmn_set_id); motion_set_unload_mothead(cmn_set_id); - motion_set_unload_motion(chr_init_data->motion_set); + motion_set_unload_motion(rob_data->motfile); } void TaskRobLoad::UnloadLoadedChara() { for (ReqDataObj& i : loaded_req_data_obj) for (int32_t j = i.count; j; j--) - UnloadCharaItemsParent(i.chara_index, &i.cos); + UnloadCharaItemsParent(i.chara_num, &i.cos); loaded_req_data_obj.clear(); for (ReqData& i : loaded_req_data) for (int32_t j = i.count; j; j--) - UnloadCharaObjSetMotionSet(i.chara_index); + UnloadCharaObjSetMotionSet(i.chara_num); loaded_req_data.clear(); } @@ -20790,8 +20735,8 @@ bool TaskRobManager::ctrl() { if (free_chara.size()) { for (rob_chara*& i : free_chara) { - task_rob_load_append_free_req_data(i->chara_index); - task_rob_load_append_free_req_data_obj(i->chara_index, i->item_cos_data.get_cos()); + task_rob_load_append_free_req_data(i->chara_num); + task_rob_load_append_free_req_data_obj(i->chara_num, i->item_cos_data.get_cos()); FreeLoadedCharaList(&i->chara_id); } @@ -20824,8 +20769,8 @@ bool TaskRobManager::ctrl() { continue; load_chara.push_back(i); - task_rob_load_append_load_req_data(i->chara_index); - task_rob_load_append_load_req_data_obj(i->chara_index, i->item_cos_data.get_cos()); + task_rob_load_append_load_req_data(i->chara_num); + task_rob_load_append_load_req_data_obj(i->chara_num, i->item_cos_data.get_cos()); } init_chara.clear(); ctrl_state = 0; @@ -20866,7 +20811,7 @@ void TaskRobManager::disp() { } void TaskRobManager::AppendFreeCharaList(rob_chara* rob_chr) { - if (!rob_chr || rob_chr->chara_id >= ROB_CHARA_COUNT || free_chara.size() >= ROB_CHARA_COUNT) + if (!rob_chr || rob_chr->chara_id >= ROB_ID_MAX || free_chara.size() >= ROB_ID_MAX) return; int32_t chara_id = rob_chr->chara_id; @@ -20907,7 +20852,7 @@ void TaskRobManager::AppendFreeCharaList(rob_chara* rob_chr) { } void TaskRobManager::AppendInitCharaList(rob_chara* rob_chr) { - if (!rob_chr || rob_chr->chara_id >= ROB_CHARA_COUNT || init_chara.size() >= ROB_CHARA_COUNT) + if (!rob_chr || rob_chr->chara_id >= ROB_ID_MAX || init_chara.size() >= ROB_ID_MAX) return; int32_t chara_id = rob_chr->chara_id; @@ -20940,7 +20885,7 @@ void TaskRobManager::AppendInitCharaList(rob_chara* rob_chr) { } void TaskRobManager::AppendLoadedCharaList(rob_chara* rob_chr) { - if (!rob_chr || rob_chr->chara_id >= ROB_CHARA_COUNT || loaded_chara.size() >= ROB_CHARA_COUNT) + if (!rob_chr || rob_chr->chara_id >= ROB_ID_MAX || loaded_chara.size() >= ROB_ID_MAX) return; int32_t chara_id = rob_chr->chara_id; @@ -20957,7 +20902,7 @@ void TaskRobManager::AppendLoadedCharaList(rob_chara* rob_chr) { bool TaskRobManager::CheckCharaLoaded(rob_chara* rob_chr) { if (!app::TaskWork::check_task_ready(this) - || rob_chr->chara_id < 0 || rob_chr->chara_id >= ROB_CHARA_COUNT) + || rob_chr->chara_id < 0 || rob_chr->chara_id >= ROB_ID_MAX) return false; int8_t chara_id = rob_chr->chara_id; @@ -20972,7 +20917,7 @@ bool TaskRobManager::CheckCharaLoaded(rob_chara* rob_chr) { } bool TaskRobManager::CheckHasRobCharaLoad(rob_chara* rob_chr) { - if (!rob_chr || rob_chr->chara_id >= ROB_CHARA_COUNT || !load_chara.size()) + if (!rob_chr || rob_chr->chara_id >= ROB_ID_MAX || !load_chara.size()) return false; int32_t chara_id = rob_chr->chara_id; @@ -21003,7 +20948,7 @@ void TaskRobManager::CheckTypeAppendInitCharaLists(std::list* rob_ch } void TaskRobManager::FreeLoadedCharaList(int8_t* chara_id) { - if (!chara_id || *chara_id >= ROB_CHARA_COUNT || !loaded_chara.size()) + if (!chara_id || *chara_id >= ROB_ID_MAX || !loaded_chara.size()) return; for (auto i = loaded_chara.begin(); i != loaded_chara.end();) @@ -21029,7 +20974,7 @@ bool TaskRobManager::GetWait(rob_chara* rob_chr) { return false; int32_t chara_id = rob_chr->chara_id; - if (chara_id < 0 || chara_id >= ROB_CHARA_COUNT) + if (chara_id < 0 || chara_id >= ROB_ID_MAX) return false; for (auto& i : init_chara) @@ -21076,18 +21021,18 @@ static void sub_1405484A0(rob_chara* rob_chr) { float_t step = rob_chr->data.motion.step; if (step < 0.0f) step = rob_chr->data.motion.step_data.frame; - rob_chr->item_equip->set_osage_step(step); + rob_chr->rob_disp->set_osage_step(step); if (!(rob_chr->data.motion.field_28 & 0x40)) { - if (rob_chr->data.field_8.field_B8.field_7C > 0.0f) - rob_chr->data.motion.step_data.frame = rob_chr->data.field_8.field_B8.field_80; + if (rob_chr->data.action.field_B8.field_7C > 0.0f) + rob_chr->data.motion.step_data.frame = rob_chr->data.action.field_B8.field_80; return; } - if (!rob_chr->data.field_1588.field_0.field_298) + if (!rob_chr->data.motdata.field_0.field_298) return; - if (!rob_chr->field_20 || rob_chr->data.motion.frame_data.frame >= rob_chr->data.field_1588.field_0.field_29C) { + if (!rob_chr->field_20 || rob_chr->data.motion.frame_data.frame >= rob_chr->data.motdata.field_0.field_29C) { rob_chr->data.motion.step_data.frame = 1.0f; rob_chr->data.motion.field_28 &= ~0x40; return; @@ -21095,11 +21040,11 @@ static void sub_1405484A0(rob_chara* rob_chr) { float_t v6 = 1.0f; /*size_t v7 = rob_chr->field_20; - if (rob_chr->data.field_1588.field_0.field_298 & 0x200 - || (stru_140A2E410[*(int32_t*)(v7 + 6744)][rob_chr->data.field_1588.field_0.field_298 & 0xFF] + if (rob_chr->data.motdata.field_0.field_298 & 0x200 + || (stru_140A2E410[*(int32_t*)(v7 + 6744)][rob_chr->data.motdata.field_0.field_298 & 0xFF] && *(int32_t*)(v7 + 6736) & 0x02)) { - float_t v11 = rob_chr->data.field_1588.field_0.field_2A4; - switch (rob_chr->data.field_1588.field_0.field_2A0) { + float_t v11 = rob_chr->data.motdata.field_0.field_2A4; + switch (rob_chr->data.motdata.field_0.field_2A0) { case 1: v11 += *(float_t*)(v7 + 6608); break; @@ -21116,16 +21061,16 @@ static void sub_1405484A0(rob_chara* rob_chr) { float_t v12 = v11 - *(float_t*)(v7 + 1752); if (v12 > 0.0f) - v6 = (rob_chr->data.field_1588.field_0.field_29C - rob_chr->data.motion.frame_data.frame) / v12; + v6 = (rob_chr->data.motdata.field_0.field_29C - rob_chr->data.motion.frame_data.frame) / v12; }*/ - if (v6 < rob_chr->data.field_1588.field_0.field_2A8) - v6 = rob_chr->data.field_1588.field_0.field_2A8; + if (v6 < rob_chr->data.motdata.field_0.field_2A8) + v6 = rob_chr->data.motdata.field_0.field_2A8; - if (v6 <= rob_chr->data.field_1588.field_0.field_2AC) + if (v6 <= rob_chr->data.motdata.field_0.field_2AC) rob_chr->data.motion.step_data.frame = v6; else - rob_chr->data.motion.step_data.frame = rob_chr->data.field_1588.field_0.field_2AC; + rob_chr->data.motion.step_data.frame = rob_chr->data.motdata.field_0.field_2AC; return; } @@ -21225,11 +21170,11 @@ static void sub_140548660(rob_chara* rob_chr) { } static void sub_140548460(rob_chara* rob_chr) { - rob_chr->data.field_2 ^= (rob_chr->data.field_2 ^ (2 * rob_chr->data.field_2)) & 0x10; - if (rob_chr->data.field_1588.field_0.field_20.field_0 & 0x01) - rob_chr->data.field_2 |= 0x08; + rob_chr->data.flag.bit.old_not_normal = rob_chr->data.flag.bit.not_normal; + if (rob_chr->data.motdata.field_0.field_20.field_0 & 0x01) + rob_chr->data.flag.bit.not_normal = 1; else - rob_chr->data.field_2 &= ~0x08; + rob_chr->data.flag.bit.not_normal = 0; } bool TaskRobPrepareControl::ctrl() { diff --git a/src/CRE/rob/rob.hpp b/src/CRE/rob/rob.hpp index 8df48615..e419aa40 100644 --- a/src/CRE/rob/rob.hpp +++ b/src/CRE/rob/rob.hpp @@ -19,13 +19,634 @@ #include "../object.hpp" #include "../static_var.hpp" +enum BONE_BLK { + BLK_DUMMY = -1, + BLK_N_HARA_CP = 0x00, + BLK_KG_HARA_Y = 0x01, + BLK_KL_HARA_XZ = 0x02, + BLK_KL_HARA_ETC = 0x03, + BLK_N_HARA = 0x04, + BLK_CL_MUNE = 0x05, + BLK_N_MUNE_B = 0x06, + BLK_KL_MUNE_B_WJ = 0x07, + BLK_KL_KUBI = 0x08, + BLK_N_KAO = 0x09, + BLK_CL_KAO = 0x0A, + BLK_FACE_ROOT = 0x0B, + BLK_N_AGO = 0x0C, + BLK_KL_AGO_WJ = 0x0D, + BLK_N_TOOTH_UNDER = 0x0E, + BLK_TL_TOOTH_UNDER_WJ = 0x0F, + BLK_N_EYE_L = 0x10, + BLK_KL_EYE_L = 0x11, + BLK_N_EYE_L_WJ_EX = 0x12, + BLK_KL_HIGHLIGHT_L_WJ = 0x13, + BLK_N_EYE_R = 0x14, + BLK_KL_EYE_R = 0x15, + BLK_N_EYE_R_WJ_EX = 0x16, + BLK_KL_HIGHLIGHT_R_WJ = 0x17, + BLK_N_EYELID_L_A = 0x18, + BLK_TL_EYELID_L_A_WJ = 0x19, + BLK_N_EYELID_L_B = 0x1A, + BLK_TL_EYELID_L_B_WJ = 0x1B, + BLK_N_EYELID_R_A = 0x1C, + BLK_TL_EYELID_R_A_WJ = 0x1D, + BLK_N_EYELID_R_B = 0x1E, + BLK_TL_EYELID_R_B_WJ = 0x1F, + BLK_N_KUTI_D = 0x20, + BLK_TL_KUTI_D_WJ = 0x21, + BLK_N_KUTI_D_L = 0x22, + BLK_TL_KUTI_D_L_WJ = 0x23, + BLK_N_KUTI_D_R = 0x24, + BLK_TL_KUTI_D_R_WJ = 0x25, + BLK_N_KUTI_DS_L = 0x26, + BLK_TL_KUTI_DS_L_WJ = 0x27, + BLK_N_KUTI_DS_R = 0x28, + BLK_TL_KUTI_DS_R_WJ = 0x29, + BLK_N_KUTI_L = 0x2A, + BLK_TL_KUTI_L_WJ = 0x2B, + BLK_N_KUTI_M_L = 0x2C, + BLK_TL_KUTI_M_L_WJ = 0x2D, + BLK_N_KUTI_M_R = 0x2E, + BLK_TL_KUTI_M_R_WJ = 0x2F, + BLK_N_KUTI_R = 0x30, + BLK_TL_KUTI_R_WJ = 0x31, + BLK_N_KUTI_U = 0x32, + BLK_TL_KUTI_U_WJ = 0x33, + BLK_N_KUTI_U_L = 0x34, + BLK_TL_KUTI_U_L_WJ = 0x35, + BLK_N_KUTI_U_R = 0x36, + BLK_TL_KUTI_U_R_WJ = 0x37, + BLK_N_MABU_L_D_A = 0x38, + BLK_TL_MABU_L_D_A_WJ = 0x39, + BLK_N_MABU_L_D_B = 0x3A, + BLK_TL_MABU_L_D_B_WJ = 0x3B, + BLK_N_MABU_L_D_C = 0x3C, + BLK_TL_MABU_L_D_C_WJ = 0x3D, + BLK_N_MABU_L_U_A = 0x3E, + BLK_TL_MABU_L_U_A_WJ = 0x3F, + BLK_N_MABU_L_U_B = 0x40, + BLK_TL_MABU_L_U_B_WJ = 0x41, + BLK_N_EYELASHES_L = 0x42, + BLK_TL_EYELASHES_L_WJ = 0x43, + BLK_N_MABU_L_U_C = 0x44, + BLK_TL_MABU_L_U_C_WJ = 0x45, + BLK_N_MABU_R_D_A = 0x46, + BLK_TL_MABU_R_D_A_WJ = 0x47, + BLK_N_MABU_R_D_B = 0x48, + BLK_TL_MABU_R_D_B_WJ = 0x49, + BLK_N_MABU_R_D_C = 0x4A, + BLK_TL_MABU_R_D_C_WJ = 0x4B, + BLK_N_MABU_R_U_A = 0x4C, + BLK_TL_MABU_R_U_A_WJ = 0x4D, + BLK_N_MABU_R_U_B = 0x4E, + BLK_TL_MABU_R_U_B_WJ = 0x4F, + BLK_N_EYELASHES_R = 0x50, + BLK_TL_EYELASHES_R_WJ = 0x51, + BLK_N_MABU_R_U_C = 0x52, + BLK_TL_MABU_R_U_C_WJ = 0x53, + BLK_N_MAYU_L = 0x54, + BLK_TL_MAYU_L_WJ = 0x55, + BLK_N_MAYU_L_B = 0x56, + BLK_TL_MAYU_L_B_WJ = 0x57, + BLK_N_MAYU_L_C = 0x58, + BLK_TL_MAYU_L_C_WJ = 0x59, + BLK_N_MAYU_R = 0x5A, + BLK_TL_MAYU_R_WJ = 0x5B, + BLK_N_MAYU_R_B = 0x5C, + BLK_TL_MAYU_R_B_WJ = 0x5D, + BLK_N_MAYU_R_C = 0x5E, + BLK_TL_MAYU_R_C_WJ = 0x5F, + BLK_N_TOOTH_UPPER = 0x60, + BLK_TL_TOOTH_UPPER_WJ = 0x61, + BLK_N_KUBI_WJ_EX = 0x62, + BLK_N_WAKI_L = 0x63, + BLK_KL_WAKI_L_WJ = 0x64, + BLK_TL_UP_KATA_L = 0x65, + BLK_C_KATA_L = 0x66, + BLK_KL_TE_L_WJ = 0x67, + BLK_N_HITO_L_EX = 0x68, + BLK_NL_HITO_L_WJ = 0x69, + BLK_NL_HITO_B_L_WJ = 0x6A, + BLK_NL_HITO_C_L_WJ = 0x6B, + BLK_N_KO_L_EX = 0x6C, + BLK_NL_KO_L_WJ = 0x6D, + BLK_NL_KO_B_L_WJ = 0x6E, + BLK_NL_KO_C_L_WJ = 0x6F, + BLK_N_KUSU_L_EX = 0x70, + BLK_NL_KUSU_L_WJ = 0x71, + BLK_NL_KUSU_B_L_WJ = 0x72, + BLK_NL_KUSU_C_L_WJ = 0x73, + BLK_N_NAKA_L_EX = 0x74, + BLK_NL_NAKA_L_WJ = 0x75, + BLK_NL_NAKA_B_L_WJ = 0x76, + BLK_NL_NAKA_C_L_WJ = 0x77, + BLK_N_OYA_L_EX = 0x78, + BLK_NL_OYA_L_WJ = 0x79, + BLK_NL_OYA_B_L_WJ = 0x7A, + BLK_NL_OYA_C_L_WJ = 0x7B, + BLK_N_STE_L_WJ_EX = 0x7C, + BLK_N_SUDE_L_WJ_EX = 0x7D, + BLK_N_SUDE_B_L_WJ_EX = 0x7E, + BLK_N_HIJI_L_WJ_EX = 0x7F, + BLK_N_UP_KATA_L_EX = 0x80, + BLK_N_SKATA_L_WJ_CD_EX = 0x81, + BLK_N_SKATA_B_L_WJ_CD_CU_EX = 0x82, + BLK_N_SKATA_C_L_WJ_CD_CU_EX = 0x83, + BLK_N_WAKI_R = 0x84, + BLK_KL_WAKI_R_WJ = 0x85, + BLK_TL_UP_KATA_R = 0x86, + BLK_C_KATA_R = 0x87, + BLK_KL_TE_R_WJ = 0x88, + BLK_N_HITO_R_EX = 0x89, + BLK_NL_HITO_R_WJ = 0x8A, + BLK_NL_HITO_B_R_WJ = 0x8B, + BLK_NL_HITO_C_R_WJ = 0x8C, + BLK_N_KO_R_EX = 0x8D, + BLK_NL_KO_R_WJ = 0x8E, + BLK_NL_KO_B_R_WJ = 0x8F, + BLK_NL_KO_C_R_WJ = 0x90, + BLK_N_KUSU_R_EX = 0x91, + BLK_NL_KUSU_R_WJ = 0x92, + BLK_NL_KUSU_B_R_WJ = 0x93, + BLK_NL_KUSU_C_R_WJ = 0x94, + BLK_N_NAKA_R_EX = 0x95, + BLK_NL_NAKA_R_WJ = 0x96, + BLK_NL_NAKA_B_R_WJ = 0x97, + BLK_NL_NAKA_C_R_WJ = 0x98, + BLK_N_OYA_R_EX = 0x99, + BLK_NL_OYA_R_WJ = 0x9A, + BLK_NL_OYA_B_R_WJ = 0x9B, + BLK_NL_OYA_C_R_WJ = 0x9C, + BLK_N_STE_R_WJ_EX = 0x9D, + BLK_N_SUDE_R_WJ_EX = 0x9E, + BLK_N_SUDE_B_R_WJ_EX = 0x9F, + BLK_N_HIJI_R_WJ_EX = 0xA0, + BLK_N_UP_KATA_R_EX = 0xA1, + BLK_N_SKATA_R_WJ_CD_EX = 0xA2, + BLK_N_SKATA_B_R_WJ_CD_CU_EX = 0xA3, + BLK_N_SKATA_C_R_WJ_CD_CU_EX = 0xA4, + BLK_KL_KOSI_Y = 0xA5, + BLK_KL_KOSI_XZ = 0xA6, + BLK_KL_KOSI_ETC_WJ = 0xA7, + BLK_CL_MOMO_L = 0xA8, + BLK_KL_ASI_L_WJ_CO = 0xA9, + BLK_KL_TOE_L_WJ = 0xAA, + BLK_N_HIZA_L_WJ_EX = 0xAB, + BLK_CL_MOMO_R = 0xAC, + BLK_KL_ASI_R_WJ_CO = 0xAD, + BLK_KL_TOE_R_WJ = 0xAE, + BLK_N_HIZA_R_WJ_EX = 0xAF, + BLK_N_MOMO_A_L_WJ_CD_EX = 0xB0, + BLK_N_MOMO_B_L_WJ_EX = 0xB1, + BLK_N_MOMO_C_L_WJ_EX = 0xB2, + BLK_N_MOMO_A_R_WJ_CD_EX = 0xB3, + BLK_N_MOMO_B_R_WJ_EX = 0xB4, + BLK_N_MOMO_C_R_WJ_EX = 0xB5, + BLK_N_HARA_CD_EX = 0xB6, + BLK_N_HARA_B_WJ_EX = 0xB7, + BLK_N_HARA_C_WJ_EX = 0xB8, + BLK_MAX = 0xB9, +}; + +enum BONE_ID { + BONE_ID_DUMMY = -1, + BONE_ID_N_HARA_CP = 0x00, + BONE_ID_KG_HARA_Y = 0x01, + BONE_ID_KL_HARA_XZ = 0x02, + BONE_ID_KL_HARA_ETC = 0x03, + BONE_ID_N_HARA = 0x04, + BONE_ID_CL_MUNE = 0x05, + BONE_ID_N_MUNE_B = 0x06, + BONE_ID_KL_MUNE_B_WJ = 0x07, + BONE_ID_KL_KUBI = 0x08, + BONE_ID_N_KAO = 0x09, + BONE_ID_CL_KAO = 0x0A, + BONE_ID_FACE_ROOT = 0x0B, + BONE_ID_N_AGO = 0x0C, + BONE_ID_KL_AGO_WJ = 0x0D, + BONE_ID_N_TOOTH_UNDER = 0x0E, + BONE_ID_TL_TOOTH_UNDER_WJ = 0x0F, + BONE_ID_N_EYE_L = 0x10, + BONE_ID_KL_EYE_L = 0x11, + BONE_ID_N_EYE_L_WJ_EX = 0x12, + BONE_ID_KL_HIGHLIGHT_L_WJ = 0x13, + BONE_ID_N_EYE_R = 0x14, + BONE_ID_KL_EYE_R = 0x15, + BONE_ID_N_EYE_R_WJ_EX = 0x16, + BONE_ID_KL_HIGHLIGHT_R_WJ = 0x17, + BONE_ID_N_EYELID_L_A = 0x18, + BONE_ID_TL_EYELID_L_A_WJ = 0x19, + BONE_ID_N_EYELID_L_B = 0x1A, + BONE_ID_TL_EYELID_L_B_WJ = 0x1B, + BONE_ID_N_EYELID_R_A = 0x1C, + BONE_ID_TL_EYELID_R_A_WJ = 0x1D, + BONE_ID_N_EYELID_R_B = 0x1E, + BONE_ID_TL_EYELID_R_B_WJ = 0x1F, + BONE_ID_N_KUTI_D = 0x20, + BONE_ID_TL_KUTI_D_WJ = 0x21, + BONE_ID_N_KUTI_D_L = 0x22, + BONE_ID_TL_KUTI_D_L_WJ = 0x23, + BONE_ID_N_KUTI_D_R = 0x24, + BONE_ID_TL_KUTI_D_R_WJ = 0x25, + BONE_ID_N_KUTI_DS_L = 0x26, + BONE_ID_TL_KUTI_DS_L_WJ = 0x27, + BONE_ID_N_KUTI_DS_R = 0x28, + BONE_ID_TL_KUTI_DS_R_WJ = 0x29, + BONE_ID_N_KUTI_L = 0x2A, + BONE_ID_TL_KUTI_L_WJ = 0x2B, + BONE_ID_N_KUTI_M_L = 0x2C, + BONE_ID_TL_KUTI_M_L_WJ = 0x2D, + BONE_ID_N_KUTI_M_R = 0x2E, + BONE_ID_TL_KUTI_M_R_WJ = 0x2F, + BONE_ID_N_KUTI_R = 0x30, + BONE_ID_TL_KUTI_R_WJ = 0x31, + BONE_ID_N_KUTI_U = 0x32, + BONE_ID_TL_KUTI_U_WJ = 0x33, + BONE_ID_N_KUTI_U_L = 0x34, + BONE_ID_TL_KUTI_U_L_WJ = 0x35, + BONE_ID_N_KUTI_U_R = 0x36, + BONE_ID_TL_KUTI_U_R_WJ = 0x37, + BONE_ID_N_MABU_L_D_A = 0x38, + BONE_ID_TL_MABU_L_D_A_WJ = 0x39, + BONE_ID_N_MABU_L_D_B = 0x3A, + BONE_ID_TL_MABU_L_D_B_WJ = 0x3B, + BONE_ID_N_MABU_L_D_C = 0x3C, + BONE_ID_TL_MABU_L_D_C_WJ = 0x3D, + BONE_ID_N_MABU_L_U_A = 0x3E, + BONE_ID_TL_MABU_L_U_A_WJ = 0x3F, + BONE_ID_N_MABU_L_U_B = 0x40, + BONE_ID_TL_MABU_L_U_B_WJ = 0x41, + BONE_ID_N_EYELASHES_L = 0x42, + BONE_ID_TL_EYELASHES_L_WJ = 0x43, + BONE_ID_N_MABU_L_U_C = 0x44, + BONE_ID_TL_MABU_L_U_C_WJ = 0x45, + BONE_ID_N_MABU_R_D_A = 0x46, + BONE_ID_TL_MABU_R_D_A_WJ = 0x47, + BONE_ID_N_MABU_R_D_B = 0x48, + BONE_ID_TL_MABU_R_D_B_WJ = 0x49, + BONE_ID_N_MABU_R_D_C = 0x4A, + BONE_ID_TL_MABU_R_D_C_WJ = 0x4B, + BONE_ID_N_MABU_R_U_A = 0x4C, + BONE_ID_TL_MABU_R_U_A_WJ = 0x4D, + BONE_ID_N_MABU_R_U_B = 0x4E, + BONE_ID_TL_MABU_R_U_B_WJ = 0x4F, + BONE_ID_N_EYELASHES_R = 0x50, + BONE_ID_TL_EYELASHES_R_WJ = 0x51, + BONE_ID_N_MABU_R_U_C = 0x52, + BONE_ID_TL_MABU_R_U_C_WJ = 0x53, + BONE_ID_N_MAYU_L = 0x54, + BONE_ID_TL_MAYU_L_WJ = 0x55, + BONE_ID_N_MAYU_L_B = 0x56, + BONE_ID_TL_MAYU_L_B_WJ = 0x57, + BONE_ID_N_MAYU_L_C = 0x58, + BONE_ID_TL_MAYU_L_C_WJ = 0x59, + BONE_ID_N_MAYU_R = 0x5A, + BONE_ID_TL_MAYU_R_WJ = 0x5B, + BONE_ID_N_MAYU_R_B = 0x5C, + BONE_ID_TL_MAYU_R_B_WJ = 0x5D, + BONE_ID_N_MAYU_R_C = 0x5E, + BONE_ID_TL_MAYU_R_C_WJ = 0x5F, + BONE_ID_N_TOOTH_UPPER = 0x60, + BONE_ID_TL_TOOTH_UPPER_WJ = 0x61, + BONE_ID_N_KUBI_WJ_EX = 0x62, + BONE_ID_N_WAKI_L = 0x63, + BONE_ID_KL_WAKI_L_WJ = 0x64, + BONE_ID_TL_UP_KATA_L = 0x65, + BONE_ID_C_KATA_L = 0x66, + BONE_ID_KATA_L_WJ_CU = 0x67, + BONE_ID_UDE_L_WJ = 0x68, + BONE_ID_KL_TE_L_WJ = 0x69, + BONE_ID_N_HITO_L_EX = 0x6A, + BONE_ID_NL_HITO_L_WJ = 0x6B, + BONE_ID_NL_HITO_B_L_WJ = 0x6C, + BONE_ID_NL_HITO_C_L_WJ = 0x6D, + BONE_ID_N_KO_L_EX = 0x6E, + BONE_ID_NL_KO_L_WJ = 0x6F, + BONE_ID_NL_KO_B_L_WJ = 0x70, + BONE_ID_NL_KO_C_L_WJ = 0x71, + BONE_ID_N_KUSU_L_EX = 0x72, + BONE_ID_NL_KUSU_L_WJ = 0x73, + BONE_ID_NL_KUSU_B_L_WJ = 0x74, + BONE_ID_NL_KUSU_C_L_WJ = 0x75, + BONE_ID_N_NAKA_L_EX = 0x76, + BONE_ID_NL_NAKA_L_WJ = 0x77, + BONE_ID_NL_NAKA_B_L_WJ = 0x78, + BONE_ID_NL_NAKA_C_L_WJ = 0x79, + BONE_ID_N_OYA_L_EX = 0x7A, + BONE_ID_NL_OYA_L_WJ = 0x7B, + BONE_ID_NL_OYA_B_L_WJ = 0x7C, + BONE_ID_NL_OYA_C_L_WJ = 0x7D, + BONE_ID_N_STE_L_WJ_EX = 0x7E, + BONE_ID_N_SUDE_L_WJ_EX = 0x7F, + BONE_ID_N_SUDE_B_L_WJ_EX = 0x80, + BONE_ID_N_HIJI_L_WJ_EX = 0x81, + BONE_ID_N_UP_KATA_L_EX = 0x82, + BONE_ID_N_SKATA_L_WJ_CD_EX = 0x83, + BONE_ID_N_SKATA_B_L_WJ_CD_CU_EX = 0x84, + BONE_ID_N_SKATA_C_L_WJ_CD_CU_EX = 0x85, + BONE_ID_N_WAKI_R = 0x86, + BONE_ID_KL_WAKI_R_WJ = 0x87, + BONE_ID_TL_UP_KATA_R = 0x88, + BONE_ID_C_KATA_R = 0x89, + BONE_ID_KATA_R_WJ_CU = 0x8A, + BONE_ID_UDE_R_WJ = 0x8B, + BONE_ID_KL_TE_R_WJ = 0x8C, + BONE_ID_N_HITO_R_EX = 0x8D, + BONE_ID_NL_HITO_R_WJ = 0x8E, + BONE_ID_NL_HITO_B_R_WJ = 0x8F, + BONE_ID_NL_HITO_C_R_WJ = 0x90, + BONE_ID_N_KO_R_EX = 0x91, + BONE_ID_NL_KO_R_WJ = 0x92, + BONE_ID_NL_KO_B_R_WJ = 0x93, + BONE_ID_NL_KO_C_R_WJ = 0x94, + BONE_ID_N_KUSU_R_EX = 0x95, + BONE_ID_NL_KUSU_R_WJ = 0x96, + BONE_ID_NL_KUSU_B_R_WJ = 0x97, + BONE_ID_NL_KUSU_C_R_WJ = 0x98, + BONE_ID_N_NAKA_R_EX = 0x99, + BONE_ID_NL_NAKA_R_WJ = 0x9A, + BONE_ID_NL_NAKA_B_R_WJ = 0x9B, + BONE_ID_NL_NAKA_C_R_WJ = 0x9C, + BONE_ID_N_OYA_R_EX = 0x9D, + BONE_ID_NL_OYA_R_WJ = 0x9E, + BONE_ID_NL_OYA_B_R_WJ = 0x9F, + BONE_ID_NL_OYA_C_R_WJ = 0xA0, + BONE_ID_N_STE_R_WJ_EX = 0xA1, + BONE_ID_N_SUDE_R_WJ_EX = 0xA2, + BONE_ID_N_SUDE_B_R_WJ_EX = 0xA3, + BONE_ID_N_HIJI_R_WJ_EX = 0xA4, + BONE_ID_N_UP_KATA_R_EX = 0xA5, + BONE_ID_N_SKATA_R_WJ_CD_EX = 0xA6, + BONE_ID_N_SKATA_B_R_WJ_CD_CU_EX = 0xA7, + BONE_ID_N_SKATA_C_R_WJ_CD_CU_EX = 0xA8, + BONE_ID_KL_KOSI_Y = 0xA9, + BONE_ID_KL_KOSI_XZ = 0xAA, + BONE_ID_KL_KOSI_ETC_WJ = 0xAB, + BONE_ID_CL_MOMO_L = 0xAC, + BONE_ID_J_MOMO_L_WJ = 0xAD, + BONE_ID_J_SUNE_L_WJ = 0xAE, + BONE_ID_KL_ASI_L_WJ_CO = 0xAF, + BONE_ID_KL_TOE_L_WJ = 0xB0, + BONE_ID_N_HIZA_L_WJ_EX = 0xB1, + BONE_ID_CL_MOMO_R = 0xB2, + BONE_ID_J_MOMO_R_WJ = 0xB3, + BONE_ID_J_SUNE_R_WJ = 0xB4, + BONE_ID_KL_ASI_R_WJ_CO = 0xB5, + BONE_ID_KL_TOE_R_WJ = 0xB6, + BONE_ID_N_HIZA_R_WJ_EX = 0xB7, + BONE_ID_N_MOMO_A_L_WJ_CD_EX = 0xB8, + BONE_ID_N_MOMO_B_L_WJ_EX = 0xB9, + BONE_ID_N_MOMO_C_L_WJ_EX = 0xBA, + BONE_ID_N_MOMO_A_R_WJ_CD_EX = 0xBB, + BONE_ID_N_MOMO_B_R_WJ_EX = 0xBC, + BONE_ID_N_MOMO_C_R_WJ_EX = 0xBD, + BONE_ID_N_HARA_CD_EX = 0xBE, + BONE_ID_N_HARA_B_WJ_EX = 0xBF, + BONE_ID_N_HARA_C_WJ_EX = 0xC0, + BONE_ID_MAX = 0xC1, +}; + +enum BONE_NODE { + BONE_NODE_N_HARA_CP = 0x00, + BONE_NODE_KG_HARA_Y = 0x01, + BONE_NODE_KL_HARA_XZ = 0x02, + BONE_NODE_KL_HARA_ETC = 0x03, + BONE_NODE_N_HARA = 0x04, + BONE_NODE_CL_MUNE = 0x05, + BONE_NODE_J_MUNE_WJ = 0x06, + BONE_NODE_E_MUNE_CP = 0x07, + BONE_NODE_N_MUNE_B = 0x08, + BONE_NODE_KL_MUNE_B_WJ = 0x09, + BONE_NODE_KL_KUBI = 0x0A, + BONE_NODE_N_KAO = 0x0B, + BONE_NODE_CL_KAO = 0x0C, + BONE_NODE_J_KAO_WJ = 0x0D, + BONE_NODE_E_KAO_CP = 0x0E, + BONE_NODE_FACE_ROOT = 0x0F, + BONE_NODE_N_AGO = 0x10, + BONE_NODE_KL_AGO_WJ = 0x11, + BONE_NODE_N_TOOTH_UNDER = 0x12, + BONE_NODE_TL_TOOTH_UNDER_WJ = 0x13, + BONE_NODE_N_EYE_L = 0x14, + BONE_NODE_KL_EYE_L = 0x15, + BONE_NODE_N_EYE_L_WJ_EX = 0x16, + BONE_NODE_KL_HIGHLIGHT_L_WJ = 0x17, + BONE_NODE_N_EYE_R = 0x18, + BONE_NODE_KL_EYE_R = 0x19, + BONE_NODE_N_EYE_R_WJ_EX = 0x1A, + BONE_NODE_KL_HIGHLIGHT_R_WJ = 0x1B, + BONE_NODE_N_EYELID_L_A = 0x1C, + BONE_NODE_TL_EYELID_L_A_WJ = 0x1D, + BONE_NODE_N_EYELID_L_B = 0x1E, + BONE_NODE_TL_EYELID_L_B_WJ = 0x1F, + BONE_NODE_N_EYELID_R_A = 0x20, + BONE_NODE_TL_EYELID_R_A_WJ = 0x21, + BONE_NODE_N_EYELID_R_B = 0x22, + BONE_NODE_TL_EYELID_R_B_WJ = 0x23, + BONE_NODE_N_KUTI_D = 0x24, + BONE_NODE_TL_KUTI_D_WJ = 0x25, + BONE_NODE_N_KUTI_D_L = 0x26, + BONE_NODE_TL_KUTI_D_L_WJ = 0x27, + BONE_NODE_N_KUTI_D_R = 0x28, + BONE_NODE_TL_KUTI_D_R_WJ = 0x29, + BONE_NODE_N_KUTI_DS_L = 0x2A, + BONE_NODE_TL_KUTI_DS_L_WJ = 0x2B, + BONE_NODE_N_KUTI_DS_R = 0x2C, + BONE_NODE_TL_KUTI_DS_R_WJ = 0x2D, + BONE_NODE_N_KUTI_L = 0x2E, + BONE_NODE_TL_KUTI_L_WJ = 0x2F, + BONE_NODE_N_KUTI_M_L = 0x30, + BONE_NODE_TL_KUTI_M_L_WJ = 0x31, + BONE_NODE_N_KUTI_M_R = 0x32, + BONE_NODE_TL_KUTI_M_R_WJ = 0x33, + BONE_NODE_N_KUTI_R = 0x34, + BONE_NODE_TL_KUTI_R_WJ = 0x35, + BONE_NODE_N_KUTI_U = 0x36, + BONE_NODE_TL_KUTI_U_WJ = 0x37, + BONE_NODE_N_KUTI_U_L = 0x38, + BONE_NODE_TL_KUTI_U_L_WJ = 0x39, + BONE_NODE_N_KUTI_U_R = 0x3A, + BONE_NODE_TL_KUTI_U_R_WJ = 0x3B, + BONE_NODE_N_MABU_L_D_A = 0x3C, + BONE_NODE_TL_MABU_L_D_A_WJ = 0x3D, + BONE_NODE_N_MABU_L_D_B = 0x3E, + BONE_NODE_TL_MABU_L_D_B_WJ = 0x3F, + BONE_NODE_N_MABU_L_D_C = 0x40, + BONE_NODE_TL_MABU_L_D_C_WJ = 0x41, + BONE_NODE_N_MABU_L_U_A = 0x42, + BONE_NODE_TL_MABU_L_U_A_WJ = 0x43, + BONE_NODE_N_MABU_L_U_B = 0x44, + BONE_NODE_TL_MABU_L_U_B_WJ = 0x45, + BONE_NODE_N_EYELASHES_L = 0x46, + BONE_NODE_TL_EYELASHES_L_WJ = 0x47, + BONE_NODE_N_MABU_L_U_C = 0x48, + BONE_NODE_TL_MABU_L_U_C_WJ = 0x49, + BONE_NODE_N_MABU_R_D_A = 0x4A, + BONE_NODE_TL_MABU_R_D_A_WJ = 0x4B, + BONE_NODE_N_MABU_R_D_B = 0x4C, + BONE_NODE_TL_MABU_R_D_B_WJ = 0x4D, + BONE_NODE_N_MABU_R_D_C = 0x4E, + BONE_NODE_TL_MABU_R_D_C_WJ = 0x4F, + BONE_NODE_N_MABU_R_U_A = 0x50, + BONE_NODE_TL_MABU_R_U_A_WJ = 0x51, + BONE_NODE_N_MABU_R_U_B = 0x52, + BONE_NODE_TL_MABU_R_U_B_WJ = 0x53, + BONE_NODE_N_EYELASHES_R = 0x54, + BONE_NODE_TL_EYELASHES_R_WJ = 0x55, + BONE_NODE_N_MABU_R_U_C = 0x56, + BONE_NODE_TL_MABU_R_U_C_WJ = 0x57, + BONE_NODE_N_MAYU_L = 0x58, + BONE_NODE_TL_MAYU_L_WJ = 0x59, + BONE_NODE_N_MAYU_L_B = 0x5A, + BONE_NODE_TL_MAYU_L_B_WJ = 0x5B, + BONE_NODE_N_MAYU_L_C = 0x5C, + BONE_NODE_TL_MAYU_L_C_WJ = 0x5D, + BONE_NODE_N_MAYU_R = 0x5E, + BONE_NODE_TL_MAYU_R_WJ = 0x5F, + BONE_NODE_N_MAYU_R_B = 0x60, + BONE_NODE_TL_MAYU_R_B_WJ = 0x61, + BONE_NODE_N_MAYU_R_C = 0x62, + BONE_NODE_TL_MAYU_R_C_WJ = 0x63, + BONE_NODE_N_TOOTH_UPPER = 0x64, + BONE_NODE_TL_TOOTH_UPPER_WJ = 0x65, + BONE_NODE_N_KUBI_WJ_EX = 0x66, + BONE_NODE_N_WAKI_L = 0x67, + BONE_NODE_KL_WAKI_L_WJ = 0x68, + BONE_NODE_TL_UP_KATA_L = 0x69, + BONE_NODE_C_KATA_L = 0x6A, + BONE_NODE_J_KATA_L_WJ_CU = 0x6B, + BONE_NODE_J_UDE_L_WJ = 0x6C, + BONE_NODE_E_UDE_L_CP = 0x6D, + BONE_NODE_KL_TE_L_WJ = 0x6E, + BONE_NODE_N_HITO_L_EX = 0x6F, + BONE_NODE_NL_HITO_L_WJ = 0x70, + BONE_NODE_NL_HITO_B_L_WJ = 0x71, + BONE_NODE_NL_HITO_C_L_WJ = 0x72, + BONE_NODE_N_KO_L_EX = 0x73, + BONE_NODE_NL_KO_L_WJ = 0x74, + BONE_NODE_NL_KO_B_L_WJ = 0x75, + BONE_NODE_NL_KO_C_L_WJ = 0x76, + BONE_NODE_N_KUSU_L_EX = 0x77, + BONE_NODE_NL_KUSU_L_WJ = 0x78, + BONE_NODE_NL_KUSU_B_L_WJ = 0x79, + BONE_NODE_NL_KUSU_C_L_WJ = 0x7A, + BONE_NODE_N_NAKA_L_EX = 0x7B, + BONE_NODE_NL_NAKA_L_WJ = 0x7C, + BONE_NODE_NL_NAKA_B_L_WJ = 0x7D, + BONE_NODE_NL_NAKA_C_L_WJ = 0x7E, + BONE_NODE_N_OYA_L_EX = 0x7F, + BONE_NODE_NL_OYA_L_WJ = 0x80, + BONE_NODE_NL_OYA_B_L_WJ = 0x81, + BONE_NODE_NL_OYA_C_L_WJ = 0x82, + BONE_NODE_N_STE_L_WJ_EX = 0x83, + BONE_NODE_N_SUDE_L_WJ_EX = 0x84, + BONE_NODE_N_SUDE_B_L_WJ_EX = 0x85, + BONE_NODE_N_HIJI_L_WJ_EX = 0x86, + BONE_NODE_N_UP_KATA_L_EX = 0x87, + BONE_NODE_N_SKATA_L_WJ_CD_EX = 0x88, + BONE_NODE_N_SKATA_B_L_WJ_CD_CU_EX = 0x89, + BONE_NODE_N_SKATA_C_L_WJ_CD_CU_EX = 0x8A, + BONE_NODE_N_WAKI_R = 0x8B, + BONE_NODE_KL_WAKI_R_WJ = 0x8C, + BONE_NODE_TL_UP_KATA_R = 0x8D, + BONE_NODE_C_KATA_R = 0x8E, + BONE_NODE_J_KATA_R_WJ_CU = 0x8F, + BONE_NODE_J_UDE_R_WJ = 0x90, + BONE_NODE_E_UDE_R_CP = 0x91, + BONE_NODE_KL_TE_R_WJ = 0x92, + BONE_NODE_N_HITO_R_EX = 0x93, + BONE_NODE_NL_HITO_R_WJ = 0x94, + BONE_NODE_NL_HITO_B_R_WJ = 0x95, + BONE_NODE_NL_HITO_C_R_WJ = 0x96, + BONE_NODE_N_KO_R_EX = 0x97, + BONE_NODE_NL_KO_R_WJ = 0x98, + BONE_NODE_NL_KO_B_R_WJ = 0x99, + BONE_NODE_NL_KO_C_R_WJ = 0x9A, + BONE_NODE_N_KUSU_R_EX = 0x9B, + BONE_NODE_NL_KUSU_R_WJ = 0x9C, + BONE_NODE_NL_KUSU_B_R_WJ = 0x9D, + BONE_NODE_NL_KUSU_C_R_WJ = 0x9E, + BONE_NODE_N_NAKA_R_EX = 0x9F, + BONE_NODE_NL_NAKA_R_WJ = 0xA0, + BONE_NODE_NL_NAKA_B_R_WJ = 0xA1, + BONE_NODE_NL_NAKA_C_R_WJ = 0xA2, + BONE_NODE_N_OYA_R_EX = 0xA3, + BONE_NODE_NL_OYA_R_WJ = 0xA4, + BONE_NODE_NL_OYA_B_R_WJ = 0xA5, + BONE_NODE_NL_OYA_C_R_WJ = 0xA6, + BONE_NODE_N_STE_R_WJ_EX = 0xA7, + BONE_NODE_N_SUDE_R_WJ_EX = 0xA8, + BONE_NODE_N_SUDE_B_R_WJ_EX = 0xA9, + BONE_NODE_N_HIJI_R_WJ_EX = 0xAA, + BONE_NODE_N_UP_KATA_R_EX = 0xAB, + BONE_NODE_N_SKATA_R_WJ_CD_EX = 0xAC, + BONE_NODE_N_SKATA_B_R_WJ_CD_CU_EX = 0xAD, + BONE_NODE_N_SKATA_C_R_WJ_CD_CU_EX = 0xAE, + BONE_NODE_KL_KOSI_Y = 0xAF, + BONE_NODE_KL_KOSI_XZ = 0xB0, + BONE_NODE_KL_KOSI_ETC_WJ = 0xB1, + BONE_NODE_CL_MOMO_L = 0xB2, + BONE_NODE_J_MOMO_L_WJ = 0xB3, + BONE_NODE_J_SUNE_L_WJ = 0xB4, + BONE_NODE_E_SUNE_L_CP = 0xB5, + BONE_NODE_KL_ASI_L_WJ_CO = 0xB6, + BONE_NODE_KL_TOE_L_WJ = 0xB7, + BONE_NODE_N_HIZA_L_WJ_EX = 0xB8, + BONE_NODE_CL_MOMO_R = 0xB9, + BONE_NODE_J_MOMO_R_WJ = 0xBA, + BONE_NODE_J_SUNE_R_WJ = 0xBB, + BONE_NODE_E_SUNE_R_CP = 0xBC, + BONE_NODE_KL_ASI_R_WJ_CO = 0xBD, + BONE_NODE_KL_TOE_R_WJ = 0xBE, + BONE_NODE_N_HIZA_R_WJ_EX = 0xBF, + BONE_NODE_N_MOMO_A_L_WJ_CD_EX = 0xC0, + BONE_NODE_N_MOMO_B_L_WJ_EX = 0xC1, + BONE_NODE_N_MOMO_C_L_WJ_EX = 0xC2, + BONE_NODE_N_MOMO_A_R_WJ_CD_EX = 0xC3, + BONE_NODE_N_MOMO_B_R_WJ_EX = 0xC4, + BONE_NODE_N_MOMO_C_R_WJ_EX = 0xC5, + BONE_NODE_N_HARA_CD_EX = 0xC6, + BONE_NODE_N_HARA_B_WJ_EX = 0xC7, + BONE_NODE_N_HARA_C_WJ_EX = 0xC8, + BONE_NODE_MAX = 0xC9, +}; + enum Expr_type { - Expr_constant = 0x00, - Expr_variable = 0x01, - Expr_variable_rad = 0x02, - Expr_func1 = 0x03, - Expr_func2 = 0x04, - Expr_func3 = 0x05, + Expr_constant = 0, + Expr_variable, + Expr_variable_rad, + Expr_func1, + Expr_func2, + Expr_func3, +}; + +enum ROB_ID { + ROB_ID_1P = 0, + ROB_ID_2P, + ROB_ID_3P, + ROB_ID_4P, + ROB_ID_5P, + ROB_ID_6P, + ROB_ID_MAX, + + ROB_ID_NULL = -1, +}; + +enum ReviseType { + REVISE_NORMAL = 0x0, + REVISE_FAST, + REVISE_SLOW, + REVISE_GUARD, + REVISE_RISE, + REVISE_YARARE, + REVISE_STRISE, + REVISE_SLOW2, + REVISE_ATTACK_FOLLOW, + REVISE_SLOW_GUARD, + REVISE_GUARD2, + REVISE_RISE_SLOW, + REVISE_TYPE_MAX, }; enum eyes_base_adjust_type { @@ -36,211 +657,6 @@ enum eyes_base_adjust_type { EYES_BASE_ADJUST_MAX = 0x03, }; -enum mot_bone_index { - MOT_BONE_N_HARA_CP = 0x00, - MOT_BONE_KG_HARA_Y = 0x01, - MOT_BONE_KL_HARA_XZ = 0x02, - MOT_BONE_KL_HARA_ETC = 0x03, - MOT_BONE_N_HARA = 0x04, - MOT_BONE_CL_MUNE = 0x05, - MOT_BONE_J_MUNE_WJ = 0x06, - MOT_BONE_E_MUNE_CP = 0x07, - MOT_BONE_N_MUNE_B = 0x08, - MOT_BONE_KL_MUNE_B_WJ = 0x09, - MOT_BONE_KL_KUBI = 0x0A, - MOT_BONE_N_KAO = 0x0B, - MOT_BONE_CL_KAO = 0x0C, - MOT_BONE_J_KAO_WJ = 0x0D, - MOT_BONE_E_KAO_CP = 0x0E, - MOT_BONE_FACE_ROOT = 0x0F, - MOT_BONE_N_AGO = 0x10, - MOT_BONE_KL_AGO_WJ = 0x11, - MOT_BONE_N_TOOTH_UNDER = 0x12, - MOT_BONE_TL_TOOTH_UNDER_WJ = 0x13, - MOT_BONE_N_EYE_L = 0x14, - MOT_BONE_KL_EYE_L = 0x15, - MOT_BONE_N_EYE_L_WJ_EX = 0x16, - MOT_BONE_KL_HIGHLIGHT_L_WJ = 0x17, - MOT_BONE_N_EYE_R = 0x18, - MOT_BONE_KL_EYE_R = 0x19, - MOT_BONE_N_EYE_R_WJ_EX = 0x1A, - MOT_BONE_KL_HIGHLIGHT_R_WJ = 0x1B, - MOT_BONE_N_EYELID_L_A = 0x1C, - MOT_BONE_TL_EYELID_L_A_WJ = 0x1D, - MOT_BONE_N_EYELID_L_B = 0x1E, - MOT_BONE_TL_EYELID_L_B_WJ = 0x1F, - MOT_BONE_N_EYELID_R_A = 0x20, - MOT_BONE_TL_EYELID_R_A_WJ = 0x21, - MOT_BONE_N_EYELID_R_B = 0x22, - MOT_BONE_TL_EYELID_R_B_WJ = 0x23, - MOT_BONE_N_KUTI_D = 0x24, - MOT_BONE_TL_KUTI_D_WJ = 0x25, - MOT_BONE_N_KUTI_D_L = 0x26, - MOT_BONE_TL_KUTI_D_L_WJ = 0x27, - MOT_BONE_N_KUTI_D_R = 0x28, - MOT_BONE_TL_KUTI_D_R_WJ = 0x29, - MOT_BONE_N_KUTI_DS_L = 0x2A, - MOT_BONE_TL_KUTI_DS_L_WJ = 0x2B, - MOT_BONE_N_KUTI_DS_R = 0x2C, - MOT_BONE_TL_KUTI_DS_R_WJ = 0x2D, - MOT_BONE_N_KUTI_L = 0x2E, - MOT_BONE_TL_KUTI_L_WJ = 0x2F, - MOT_BONE_N_KUTI_M_L = 0x30, - MOT_BONE_TL_KUTI_M_L_WJ = 0x31, - MOT_BONE_N_KUTI_M_R = 0x32, - MOT_BONE_TL_KUTI_M_R_WJ = 0x33, - MOT_BONE_N_KUTI_R = 0x34, - MOT_BONE_TL_KUTI_R_WJ = 0x35, - MOT_BONE_N_KUTI_U = 0x36, - MOT_BONE_TL_KUTI_U_WJ = 0x37, - MOT_BONE_N_KUTI_U_L = 0x38, - MOT_BONE_TL_KUTI_U_L_WJ = 0x39, - MOT_BONE_N_KUTI_U_R = 0x3A, - MOT_BONE_TL_KUTI_U_R_WJ = 0x3B, - MOT_BONE_N_MABU_L_D_A = 0x3C, - MOT_BONE_TL_MABU_L_D_A_WJ = 0x3D, - MOT_BONE_N_MABU_L_D_B = 0x3E, - MOT_BONE_TL_MABU_L_D_B_WJ = 0x3F, - MOT_BONE_N_MABU_L_D_C = 0x40, - MOT_BONE_TL_MABU_L_D_C_WJ = 0x41, - MOT_BONE_N_MABU_L_U_A = 0x42, - MOT_BONE_TL_MABU_L_U_A_WJ = 0x43, - MOT_BONE_N_MABU_L_U_B = 0x44, - MOT_BONE_TL_MABU_L_U_B_WJ = 0x45, - MOT_BONE_N_EYELASHES_L = 0x46, - MOT_BONE_TL_EYELASHES_L_WJ = 0x47, - MOT_BONE_N_MABU_L_U_C = 0x48, - MOT_BONE_TL_MABU_L_U_C_WJ = 0x49, - MOT_BONE_N_MABU_R_D_A = 0x4A, - MOT_BONE_TL_MABU_R_D_A_WJ = 0x4B, - MOT_BONE_N_MABU_R_D_B = 0x4C, - MOT_BONE_TL_MABU_R_D_B_WJ = 0x4D, - MOT_BONE_N_MABU_R_D_C = 0x4E, - MOT_BONE_TL_MABU_R_D_C_WJ = 0x4F, - MOT_BONE_N_MABU_R_U_A = 0x50, - MOT_BONE_TL_MABU_R_U_A_WJ = 0x51, - MOT_BONE_N_MABU_R_U_B = 0x52, - MOT_BONE_TL_MABU_R_U_B_WJ = 0x53, - MOT_BONE_N_EYELASHES_R = 0x54, - MOT_BONE_TL_EYELASHES_R_WJ = 0x55, - MOT_BONE_N_MABU_R_U_C = 0x56, - MOT_BONE_TL_MABU_R_U_C_WJ = 0x57, - MOT_BONE_N_MAYU_L = 0x58, - MOT_BONE_TL_MAYU_L_WJ = 0x59, - MOT_BONE_N_MAYU_L_B = 0x5A, - MOT_BONE_TL_MAYU_L_B_WJ = 0x5B, - MOT_BONE_N_MAYU_L_C = 0x5C, - MOT_BONE_TL_MAYU_L_C_WJ = 0x5D, - MOT_BONE_N_MAYU_R = 0x5E, - MOT_BONE_TL_MAYU_R_WJ = 0x5F, - MOT_BONE_N_MAYU_R_B = 0x60, - MOT_BONE_TL_MAYU_R_B_WJ = 0x61, - MOT_BONE_N_MAYU_R_C = 0x62, - MOT_BONE_TL_MAYU_R_C_WJ = 0x63, - MOT_BONE_N_TOOTH_UPPER = 0x64, - MOT_BONE_TL_TOOTH_UPPER_WJ = 0x65, - MOT_BONE_N_KUBI_WJ_EX = 0x66, - MOT_BONE_N_WAKI_L = 0x67, - MOT_BONE_KL_WAKI_L_WJ = 0x68, - MOT_BONE_TL_UP_KATA_L = 0x69, - MOT_BONE_C_KATA_L = 0x6A, - MOT_BONE_J_KATA_L_WJ_CU = 0x6B, - MOT_BONE_J_UDE_L_WJ = 0x6C, - MOT_BONE_E_UDE_L_CP = 0x6D, - MOT_BONE_KL_TE_L_WJ = 0x6E, - MOT_BONE_N_HITO_L_EX = 0x6F, - MOT_BONE_NL_HITO_L_WJ = 0x70, - MOT_BONE_NL_HITO_B_L_WJ = 0x71, - MOT_BONE_NL_HITO_C_L_WJ = 0x72, - MOT_BONE_N_KO_L_EX = 0x73, - MOT_BONE_NL_KO_L_WJ = 0x74, - MOT_BONE_NL_KO_B_L_WJ = 0x75, - MOT_BONE_NL_KO_C_L_WJ = 0x76, - MOT_BONE_N_KUSU_L_EX = 0x77, - MOT_BONE_NL_KUSU_L_WJ = 0x78, - MOT_BONE_NL_KUSU_B_L_WJ = 0x79, - MOT_BONE_NL_KUSU_C_L_WJ = 0x7A, - MOT_BONE_N_NAKA_L_EX = 0x7B, - MOT_BONE_NL_NAKA_L_WJ = 0x7C, - MOT_BONE_NL_NAKA_B_L_WJ = 0x7D, - MOT_BONE_NL_NAKA_C_L_WJ = 0x7E, - MOT_BONE_N_OYA_L_EX = 0x7F, - MOT_BONE_NL_OYA_L_WJ = 0x80, - MOT_BONE_NL_OYA_B_L_WJ = 0x81, - MOT_BONE_NL_OYA_C_L_WJ = 0x82, - MOT_BONE_N_STE_L_WJ_EX = 0x83, - MOT_BONE_N_SUDE_L_WJ_EX = 0x84, - MOT_BONE_N_SUDE_B_L_WJ_EX = 0x85, - MOT_BONE_N_HIJI_L_WJ_EX = 0x86, - MOT_BONE_N_UP_KATA_L_EX = 0x87, - MOT_BONE_N_SKATA_L_WJ_CD_EX = 0x88, - MOT_BONE_N_SKATA_B_L_WJ_CD_CU_EX = 0x89, - MOT_BONE_N_SKATA_C_L_WJ_CD_CU_EX = 0x8A, - MOT_BONE_N_WAKI_R = 0x8B, - MOT_BONE_KL_WAKI_R_WJ = 0x8C, - MOT_BONE_TL_UP_KATA_R = 0x8D, - MOT_BONE_C_KATA_R = 0x8E, - MOT_BONE_J_KATA_R_WJ_CU = 0x8F, - MOT_BONE_J_UDE_R_WJ = 0x90, - MOT_BONE_E_UDE_R_CP = 0x91, - MOT_BONE_KL_TE_R_WJ = 0x92, - MOT_BONE_N_HITO_R_EX = 0x93, - MOT_BONE_NL_HITO_R_WJ = 0x94, - MOT_BONE_NL_HITO_B_R_WJ = 0x95, - MOT_BONE_NL_HITO_C_R_WJ = 0x96, - MOT_BONE_N_KO_R_EX = 0x97, - MOT_BONE_NL_KO_R_WJ = 0x98, - MOT_BONE_NL_KO_B_R_WJ = 0x99, - MOT_BONE_NL_KO_C_R_WJ = 0x9A, - MOT_BONE_N_KUSU_R_EX = 0x9B, - MOT_BONE_NL_KUSU_R_WJ = 0x9C, - MOT_BONE_NL_KUSU_B_R_WJ = 0x9D, - MOT_BONE_NL_KUSU_C_R_WJ = 0x9E, - MOT_BONE_N_NAKA_R_EX = 0x9F, - MOT_BONE_NL_NAKA_R_WJ = 0xA0, - MOT_BONE_NL_NAKA_B_R_WJ = 0xA1, - MOT_BONE_NL_NAKA_C_R_WJ = 0xA2, - MOT_BONE_N_OYA_R_EX = 0xA3, - MOT_BONE_NL_OYA_R_WJ = 0xA4, - MOT_BONE_NL_OYA_B_R_WJ = 0xA5, - MOT_BONE_NL_OYA_C_R_WJ = 0xA6, - MOT_BONE_N_STE_R_WJ_EX = 0xA7, - MOT_BONE_N_SUDE_R_WJ_EX = 0xA8, - MOT_BONE_N_SUDE_B_R_WJ_EX = 0xA9, - MOT_BONE_N_HIJI_R_WJ_EX = 0xAA, - MOT_BONE_N_UP_KATA_R_EX = 0xAB, - MOT_BONE_N_SKATA_R_WJ_CD_EX = 0xAC, - MOT_BONE_N_SKATA_B_R_WJ_CD_CU_EX = 0xAD, - MOT_BONE_N_SKATA_C_R_WJ_CD_CU_EX = 0xAE, - MOT_BONE_KL_KOSI_Y = 0xAF, - MOT_BONE_KL_KOSI_XZ = 0xB0, - MOT_BONE_KL_KOSI_ETC_WJ = 0xB1, - MOT_BONE_CL_MOMO_L = 0xB2, - MOT_BONE_J_MOMO_L_WJ = 0xB3, - MOT_BONE_J_SUNE_L_WJ = 0xB4, - MOT_BONE_E_SUNE_L_CP = 0xB5, - MOT_BONE_KL_ASI_L_WJ_CO = 0xB6, - MOT_BONE_KL_TOE_L_WJ = 0xB7, - MOT_BONE_N_HIZA_L_WJ_EX = 0xB8, - MOT_BONE_CL_MOMO_R = 0xB9, - MOT_BONE_J_MOMO_R_WJ = 0xBA, - MOT_BONE_J_SUNE_R_WJ = 0xBB, - MOT_BONE_E_SUNE_R_CP = 0xBC, - MOT_BONE_KL_ASI_R_WJ_CO = 0xBD, - MOT_BONE_KL_TOE_R_WJ = 0xBE, - MOT_BONE_N_HIZA_R_WJ_EX = 0xBF, - MOT_BONE_N_MOMO_A_L_WJ_CD_EX = 0xC0, - MOT_BONE_N_MOMO_B_L_WJ_EX = 0xC1, - MOT_BONE_N_MOMO_C_L_WJ_EX = 0xC2, - MOT_BONE_N_MOMO_A_R_WJ_CD_EX = 0xC3, - MOT_BONE_N_MOMO_B_R_WJ_EX = 0xC4, - MOT_BONE_N_MOMO_C_R_WJ_EX = 0xC5, - MOT_BONE_N_HARA_CD_EX = 0xC6, - MOT_BONE_N_HARA_B_WJ_EX = 0xC7, - MOT_BONE_N_HARA_C_WJ_EX = 0xC8, - MOT_BONE_MAX = 0xC9, -}; - enum mot_play_frame_data_loop_state : uint32_t { MOT_PLAY_FRAME_DATA_LOOP_NONE = (uint32_t)-1, MOT_PLAY_FRAME_DATA_LOOP_ONCE = 0x00, @@ -352,394 +768,6 @@ enum MotionBlendType { MOTION_BLEND_COMBINE = 0x03, }; -enum motion_bone_index { - MOTION_BONE_NONE = -1, - MOTION_BONE_N_HARA_CP = 0x00, - MOTION_BONE_KG_HARA_Y = 0x01, - MOTION_BONE_KL_HARA_XZ = 0x02, - MOTION_BONE_KL_HARA_ETC = 0x03, - MOTION_BONE_N_HARA = 0x04, - MOTION_BONE_CL_MUNE = 0x05, - MOTION_BONE_N_MUNE_B = 0x06, - MOTION_BONE_KL_MUNE_B_WJ = 0x07, - MOTION_BONE_KL_KUBI = 0x08, - MOTION_BONE_N_KAO = 0x09, - MOTION_BONE_CL_KAO = 0x0A, - MOTION_BONE_FACE_ROOT = 0x0B, - MOTION_BONE_N_AGO = 0x0C, - MOTION_BONE_KL_AGO_WJ = 0x0D, - MOTION_BONE_N_TOOTH_UNDER = 0x0E, - MOTION_BONE_TL_TOOTH_UNDER_WJ = 0x0F, - MOTION_BONE_N_EYE_L = 0x10, - MOTION_BONE_KL_EYE_L = 0x11, - MOTION_BONE_N_EYE_L_WJ_EX = 0x12, - MOTION_BONE_KL_HIGHLIGHT_L_WJ = 0x13, - MOTION_BONE_N_EYE_R = 0x14, - MOTION_BONE_KL_EYE_R = 0x15, - MOTION_BONE_N_EYE_R_WJ_EX = 0x16, - MOTION_BONE_KL_HIGHLIGHT_R_WJ = 0x17, - MOTION_BONE_N_EYELID_L_A = 0x18, - MOTION_BONE_TL_EYELID_L_A_WJ = 0x19, - MOTION_BONE_N_EYELID_L_B = 0x1A, - MOTION_BONE_TL_EYELID_L_B_WJ = 0x1B, - MOTION_BONE_N_EYELID_R_A = 0x1C, - MOTION_BONE_TL_EYELID_R_A_WJ = 0x1D, - MOTION_BONE_N_EYELID_R_B = 0x1E, - MOTION_BONE_TL_EYELID_R_B_WJ = 0x1F, - MOTION_BONE_N_KUTI_D = 0x20, - MOTION_BONE_TL_KUTI_D_WJ = 0x21, - MOTION_BONE_N_KUTI_D_L = 0x22, - MOTION_BONE_TL_KUTI_D_L_WJ = 0x23, - MOTION_BONE_N_KUTI_D_R = 0x24, - MOTION_BONE_TL_KUTI_D_R_WJ = 0x25, - MOTION_BONE_N_KUTI_DS_L = 0x26, - MOTION_BONE_TL_KUTI_DS_L_WJ = 0x27, - MOTION_BONE_N_KUTI_DS_R = 0x28, - MOTION_BONE_TL_KUTI_DS_R_WJ = 0x29, - MOTION_BONE_N_KUTI_L = 0x2A, - MOTION_BONE_TL_KUTI_L_WJ = 0x2B, - MOTION_BONE_N_KUTI_M_L = 0x2C, - MOTION_BONE_TL_KUTI_M_L_WJ = 0x2D, - MOTION_BONE_N_KUTI_M_R = 0x2E, - MOTION_BONE_TL_KUTI_M_R_WJ = 0x2F, - MOTION_BONE_N_KUTI_R = 0x30, - MOTION_BONE_TL_KUTI_R_WJ = 0x31, - MOTION_BONE_N_KUTI_U = 0x32, - MOTION_BONE_TL_KUTI_U_WJ = 0x33, - MOTION_BONE_N_KUTI_U_L = 0x34, - MOTION_BONE_TL_KUTI_U_L_WJ = 0x35, - MOTION_BONE_N_KUTI_U_R = 0x36, - MOTION_BONE_TL_KUTI_U_R_WJ = 0x37, - MOTION_BONE_N_MABU_L_D_A = 0x38, - MOTION_BONE_TL_MABU_L_D_A_WJ = 0x39, - MOTION_BONE_N_MABU_L_D_B = 0x3A, - MOTION_BONE_TL_MABU_L_D_B_WJ = 0x3B, - MOTION_BONE_N_MABU_L_D_C = 0x3C, - MOTION_BONE_TL_MABU_L_D_C_WJ = 0x3D, - MOTION_BONE_N_MABU_L_U_A = 0x3E, - MOTION_BONE_TL_MABU_L_U_A_WJ = 0x3F, - MOTION_BONE_N_MABU_L_U_B = 0x40, - MOTION_BONE_TL_MABU_L_U_B_WJ = 0x41, - MOTION_BONE_N_EYELASHES_L = 0x42, - MOTION_BONE_TL_EYELASHES_L_WJ = 0x43, - MOTION_BONE_N_MABU_L_U_C = 0x44, - MOTION_BONE_TL_MABU_L_U_C_WJ = 0x45, - MOTION_BONE_N_MABU_R_D_A = 0x46, - MOTION_BONE_TL_MABU_R_D_A_WJ = 0x47, - MOTION_BONE_N_MABU_R_D_B = 0x48, - MOTION_BONE_TL_MABU_R_D_B_WJ = 0x49, - MOTION_BONE_N_MABU_R_D_C = 0x4A, - MOTION_BONE_TL_MABU_R_D_C_WJ = 0x4B, - MOTION_BONE_N_MABU_R_U_A = 0x4C, - MOTION_BONE_TL_MABU_R_U_A_WJ = 0x4D, - MOTION_BONE_N_MABU_R_U_B = 0x4E, - MOTION_BONE_TL_MABU_R_U_B_WJ = 0x4F, - MOTION_BONE_N_EYELASHES_R = 0x50, - MOTION_BONE_TL_EYELASHES_R_WJ = 0x51, - MOTION_BONE_N_MABU_R_U_C = 0x52, - MOTION_BONE_TL_MABU_R_U_C_WJ = 0x53, - MOTION_BONE_N_MAYU_L = 0x54, - MOTION_BONE_TL_MAYU_L_WJ = 0x55, - MOTION_BONE_N_MAYU_L_B = 0x56, - MOTION_BONE_TL_MAYU_L_B_WJ = 0x57, - MOTION_BONE_N_MAYU_L_C = 0x58, - MOTION_BONE_TL_MAYU_L_C_WJ = 0x59, - MOTION_BONE_N_MAYU_R = 0x5A, - MOTION_BONE_TL_MAYU_R_WJ = 0x5B, - MOTION_BONE_N_MAYU_R_B = 0x5C, - MOTION_BONE_TL_MAYU_R_B_WJ = 0x5D, - MOTION_BONE_N_MAYU_R_C = 0x5E, - MOTION_BONE_TL_MAYU_R_C_WJ = 0x5F, - MOTION_BONE_N_TOOTH_UPPER = 0x60, - MOTION_BONE_TL_TOOTH_UPPER_WJ = 0x61, - MOTION_BONE_N_KUBI_WJ_EX = 0x62, - MOTION_BONE_N_WAKI_L = 0x63, - MOTION_BONE_KL_WAKI_L_WJ = 0x64, - MOTION_BONE_TL_UP_KATA_L = 0x65, - MOTION_BONE_C_KATA_L = 0x66, - MOTION_BONE_KL_TE_L_WJ = 0x67, - MOTION_BONE_N_HITO_L_EX = 0x68, - MOTION_BONE_NL_HITO_L_WJ = 0x69, - MOTION_BONE_NL_HITO_B_L_WJ = 0x6A, - MOTION_BONE_NL_HITO_C_L_WJ = 0x6B, - MOTION_BONE_N_KO_L_EX = 0x6C, - MOTION_BONE_NL_KO_L_WJ = 0x6D, - MOTION_BONE_NL_KO_B_L_WJ = 0x6E, - MOTION_BONE_NL_KO_C_L_WJ = 0x6F, - MOTION_BONE_N_KUSU_L_EX = 0x70, - MOTION_BONE_NL_KUSU_L_WJ = 0x71, - MOTION_BONE_NL_KUSU_B_L_WJ = 0x72, - MOTION_BONE_NL_KUSU_C_L_WJ = 0x73, - MOTION_BONE_N_NAKA_L_EX = 0x74, - MOTION_BONE_NL_NAKA_L_WJ = 0x75, - MOTION_BONE_NL_NAKA_B_L_WJ = 0x76, - MOTION_BONE_NL_NAKA_C_L_WJ = 0x77, - MOTION_BONE_N_OYA_L_EX = 0x78, - MOTION_BONE_NL_OYA_L_WJ = 0x79, - MOTION_BONE_NL_OYA_B_L_WJ = 0x7A, - MOTION_BONE_NL_OYA_C_L_WJ = 0x7B, - MOTION_BONE_N_STE_L_WJ_EX = 0x7C, - MOTION_BONE_N_SUDE_L_WJ_EX = 0x7D, - MOTION_BONE_N_SUDE_B_L_WJ_EX = 0x7E, - MOTION_BONE_N_HIJI_L_WJ_EX = 0x7F, - MOTION_BONE_N_UP_KATA_L_EX = 0x80, - MOTION_BONE_N_SKATA_L_WJ_CD_EX = 0x81, - MOTION_BONE_N_SKATA_B_L_WJ_CD_CU_EX = 0x82, - MOTION_BONE_N_SKATA_C_L_WJ_CD_CU_EX = 0x83, - MOTION_BONE_N_WAKI_R = 0x84, - MOTION_BONE_KL_WAKI_R_WJ = 0x85, - MOTION_BONE_TL_UP_KATA_R = 0x86, - MOTION_BONE_C_KATA_R = 0x87, - MOTION_BONE_KL_TE_R_WJ = 0x88, - MOTION_BONE_N_HITO_R_EX = 0x89, - MOTION_BONE_NL_HITO_R_WJ = 0x8A, - MOTION_BONE_NL_HITO_B_R_WJ = 0x8B, - MOTION_BONE_NL_HITO_C_R_WJ = 0x8C, - MOTION_BONE_N_KO_R_EX = 0x8D, - MOTION_BONE_NL_KO_R_WJ = 0x8E, - MOTION_BONE_NL_KO_B_R_WJ = 0x8F, - MOTION_BONE_NL_KO_C_R_WJ = 0x90, - MOTION_BONE_N_KUSU_R_EX = 0x91, - MOTION_BONE_NL_KUSU_R_WJ = 0x92, - MOTION_BONE_NL_KUSU_B_R_WJ = 0x93, - MOTION_BONE_NL_KUSU_C_R_WJ = 0x94, - MOTION_BONE_N_NAKA_R_EX = 0x95, - MOTION_BONE_NL_NAKA_R_WJ = 0x96, - MOTION_BONE_NL_NAKA_B_R_WJ = 0x97, - MOTION_BONE_NL_NAKA_C_R_WJ = 0x98, - MOTION_BONE_N_OYA_R_EX = 0x99, - MOTION_BONE_NL_OYA_R_WJ = 0x9A, - MOTION_BONE_NL_OYA_B_R_WJ = 0x9B, - MOTION_BONE_NL_OYA_C_R_WJ = 0x9C, - MOTION_BONE_N_STE_R_WJ_EX = 0x9D, - MOTION_BONE_N_SUDE_R_WJ_EX = 0x9E, - MOTION_BONE_N_SUDE_B_R_WJ_EX = 0x9F, - MOTION_BONE_N_HIJI_R_WJ_EX = 0xA0, - MOTION_BONE_N_UP_KATA_R_EX = 0xA1, - MOTION_BONE_N_SKATA_R_WJ_CD_EX = 0xA2, - MOTION_BONE_N_SKATA_B_R_WJ_CD_CU_EX = 0xA3, - MOTION_BONE_N_SKATA_C_R_WJ_CD_CU_EX = 0xA4, - MOTION_BONE_KL_KOSI_Y = 0xA5, - MOTION_BONE_KL_KOSI_XZ = 0xA6, - MOTION_BONE_KL_KOSI_ETC_WJ = 0xA7, - MOTION_BONE_CL_MOMO_L = 0xA8, - MOTION_BONE_KL_ASI_L_WJ_CO = 0xA9, - MOTION_BONE_KL_TOE_L_WJ = 0xAA, - MOTION_BONE_N_HIZA_L_WJ_EX = 0xAB, - MOTION_BONE_CL_MOMO_R = 0xAC, - MOTION_BONE_KL_ASI_R_WJ_CO = 0xAD, - MOTION_BONE_KL_TOE_R_WJ = 0xAE, - MOTION_BONE_N_HIZA_R_WJ_EX = 0xAF, - MOTION_BONE_N_MOMO_A_L_WJ_CD_EX = 0xB0, - MOTION_BONE_N_MOMO_B_L_WJ_EX = 0xB1, - MOTION_BONE_N_MOMO_C_L_WJ_EX = 0xB2, - MOTION_BONE_N_MOMO_A_R_WJ_CD_EX = 0xB3, - MOTION_BONE_N_MOMO_B_R_WJ_EX = 0xB4, - MOTION_BONE_N_MOMO_C_R_WJ_EX = 0xB5, - MOTION_BONE_N_HARA_CD_EX = 0xB6, - MOTION_BONE_N_HARA_B_WJ_EX = 0xB7, - MOTION_BONE_N_HARA_C_WJ_EX = 0xB8, - MOTION_BONE_MAX = 0xB9, -}; - -enum rob_bone_index { - ROB_BONE_NONE = -1, - ROB_BONE_N_HARA_CP = 0x00, - ROB_BONE_KG_HARA_Y = 0x01, - ROB_BONE_KL_HARA_XZ = 0x02, - ROB_BONE_KL_HARA_ETC = 0x03, - ROB_BONE_N_HARA = 0x04, - ROB_BONE_CL_MUNE = 0x05, - ROB_BONE_N_MUNE_B = 0x06, - ROB_BONE_KL_MUNE_B_WJ = 0x07, - ROB_BONE_KL_KUBI = 0x08, - ROB_BONE_N_KAO = 0x09, - ROB_BONE_CL_KAO = 0x0A, - ROB_BONE_FACE_ROOT = 0x0B, - ROB_BONE_N_AGO = 0x0C, - ROB_BONE_KL_AGO_WJ = 0x0D, - ROB_BONE_N_TOOTH_UNDER = 0x0E, - ROB_BONE_TL_TOOTH_UNDER_WJ = 0x0F, - ROB_BONE_N_EYE_L = 0x10, - ROB_BONE_KL_EYE_L = 0x11, - ROB_BONE_N_EYE_L_WJ_EX = 0x12, - ROB_BONE_KL_HIGHLIGHT_L_WJ = 0x13, - ROB_BONE_N_EYE_R = 0x14, - ROB_BONE_KL_EYE_R = 0x15, - ROB_BONE_N_EYE_R_WJ_EX = 0x16, - ROB_BONE_KL_HIGHLIGHT_R_WJ = 0x17, - ROB_BONE_N_EYELID_L_A = 0x18, - ROB_BONE_TL_EYELID_L_A_WJ = 0x19, - ROB_BONE_N_EYELID_L_B = 0x1A, - ROB_BONE_TL_EYELID_L_B_WJ = 0x1B, - ROB_BONE_N_EYELID_R_A = 0x1C, - ROB_BONE_TL_EYELID_R_A_WJ = 0x1D, - ROB_BONE_N_EYELID_R_B = 0x1E, - ROB_BONE_TL_EYELID_R_B_WJ = 0x1F, - ROB_BONE_N_KUTI_D = 0x20, - ROB_BONE_TL_KUTI_D_WJ = 0x21, - ROB_BONE_N_KUTI_D_L = 0x22, - ROB_BONE_TL_KUTI_D_L_WJ = 0x23, - ROB_BONE_N_KUTI_D_R = 0x24, - ROB_BONE_TL_KUTI_D_R_WJ = 0x25, - ROB_BONE_N_KUTI_DS_L = 0x26, - ROB_BONE_TL_KUTI_DS_L_WJ = 0x27, - ROB_BONE_N_KUTI_DS_R = 0x28, - ROB_BONE_TL_KUTI_DS_R_WJ = 0x29, - ROB_BONE_N_KUTI_L = 0x2A, - ROB_BONE_TL_KUTI_L_WJ = 0x2B, - ROB_BONE_N_KUTI_M_L = 0x2C, - ROB_BONE_TL_KUTI_M_L_WJ = 0x2D, - ROB_BONE_N_KUTI_M_R = 0x2E, - ROB_BONE_TL_KUTI_M_R_WJ = 0x2F, - ROB_BONE_N_KUTI_R = 0x30, - ROB_BONE_TL_KUTI_R_WJ = 0x31, - ROB_BONE_N_KUTI_U = 0x32, - ROB_BONE_TL_KUTI_U_WJ = 0x33, - ROB_BONE_N_KUTI_U_L = 0x34, - ROB_BONE_TL_KUTI_U_L_WJ = 0x35, - ROB_BONE_N_KUTI_U_R = 0x36, - ROB_BONE_TL_KUTI_U_R_WJ = 0x37, - ROB_BONE_N_MABU_L_D_A = 0x38, - ROB_BONE_TL_MABU_L_D_A_WJ = 0x39, - ROB_BONE_N_MABU_L_D_B = 0x3A, - ROB_BONE_TL_MABU_L_D_B_WJ = 0x3B, - ROB_BONE_N_MABU_L_D_C = 0x3C, - ROB_BONE_TL_MABU_L_D_C_WJ = 0x3D, - ROB_BONE_N_MABU_L_U_A = 0x3E, - ROB_BONE_TL_MABU_L_U_A_WJ = 0x3F, - ROB_BONE_N_MABU_L_U_B = 0x40, - ROB_BONE_TL_MABU_L_U_B_WJ = 0x41, - ROB_BONE_N_EYELASHES_L = 0x42, - ROB_BONE_TL_EYELASHES_L_WJ = 0x43, - ROB_BONE_N_MABU_L_U_C = 0x44, - ROB_BONE_TL_MABU_L_U_C_WJ = 0x45, - ROB_BONE_N_MABU_R_D_A = 0x46, - ROB_BONE_TL_MABU_R_D_A_WJ = 0x47, - ROB_BONE_N_MABU_R_D_B = 0x48, - ROB_BONE_TL_MABU_R_D_B_WJ = 0x49, - ROB_BONE_N_MABU_R_D_C = 0x4A, - ROB_BONE_TL_MABU_R_D_C_WJ = 0x4B, - ROB_BONE_N_MABU_R_U_A = 0x4C, - ROB_BONE_TL_MABU_R_U_A_WJ = 0x4D, - ROB_BONE_N_MABU_R_U_B = 0x4E, - ROB_BONE_TL_MABU_R_U_B_WJ = 0x4F, - ROB_BONE_N_EYELASHES_R = 0x50, - ROB_BONE_TL_EYELASHES_R_WJ = 0x51, - ROB_BONE_N_MABU_R_U_C = 0x52, - ROB_BONE_TL_MABU_R_U_C_WJ = 0x53, - ROB_BONE_N_MAYU_L = 0x54, - ROB_BONE_TL_MAYU_L_WJ = 0x55, - ROB_BONE_N_MAYU_L_B = 0x56, - ROB_BONE_TL_MAYU_L_B_WJ = 0x57, - ROB_BONE_N_MAYU_L_C = 0x58, - ROB_BONE_TL_MAYU_L_C_WJ = 0x59, - ROB_BONE_N_MAYU_R = 0x5A, - ROB_BONE_TL_MAYU_R_WJ = 0x5B, - ROB_BONE_N_MAYU_R_B = 0x5C, - ROB_BONE_TL_MAYU_R_B_WJ = 0x5D, - ROB_BONE_N_MAYU_R_C = 0x5E, - ROB_BONE_TL_MAYU_R_C_WJ = 0x5F, - ROB_BONE_N_TOOTH_UPPER = 0x60, - ROB_BONE_TL_TOOTH_UPPER_WJ = 0x61, - ROB_BONE_N_KUBI_WJ_EX = 0x62, - ROB_BONE_N_WAKI_L = 0x63, - ROB_BONE_KL_WAKI_L_WJ = 0x64, - ROB_BONE_TL_UP_KATA_L = 0x65, - ROB_BONE_C_KATA_L = 0x66, - ROB_BONE_KATA_L_WJ_CU = 0x67, - ROB_BONE_UDE_L_WJ = 0x68, - ROB_BONE_KL_TE_L_WJ = 0x69, - ROB_BONE_N_HITO_L_EX = 0x6A, - ROB_BONE_NL_HITO_L_WJ = 0x6B, - ROB_BONE_NL_HITO_B_L_WJ = 0x6C, - ROB_BONE_NL_HITO_C_L_WJ = 0x6D, - ROB_BONE_N_KO_L_EX = 0x6E, - ROB_BONE_NL_KO_L_WJ = 0x6F, - ROB_BONE_NL_KO_B_L_WJ = 0x70, - ROB_BONE_NL_KO_C_L_WJ = 0x71, - ROB_BONE_N_KUSU_L_EX = 0x72, - ROB_BONE_NL_KUSU_L_WJ = 0x73, - ROB_BONE_NL_KUSU_B_L_WJ = 0x74, - ROB_BONE_NL_KUSU_C_L_WJ = 0x75, - ROB_BONE_N_NAKA_L_EX = 0x76, - ROB_BONE_NL_NAKA_L_WJ = 0x77, - ROB_BONE_NL_NAKA_B_L_WJ = 0x78, - ROB_BONE_NL_NAKA_C_L_WJ = 0x79, - ROB_BONE_N_OYA_L_EX = 0x7A, - ROB_BONE_NL_OYA_L_WJ = 0x7B, - ROB_BONE_NL_OYA_B_L_WJ = 0x7C, - ROB_BONE_NL_OYA_C_L_WJ = 0x7D, - ROB_BONE_N_STE_L_WJ_EX = 0x7E, - ROB_BONE_N_SUDE_L_WJ_EX = 0x7F, - ROB_BONE_N_SUDE_B_L_WJ_EX = 0x80, - ROB_BONE_N_HIJI_L_WJ_EX = 0x81, - ROB_BONE_N_UP_KATA_L_EX = 0x82, - ROB_BONE_N_SKATA_L_WJ_CD_EX = 0x83, - ROB_BONE_N_SKATA_B_L_WJ_CD_CU_EX = 0x84, - ROB_BONE_N_SKATA_C_L_WJ_CD_CU_EX = 0x85, - ROB_BONE_N_WAKI_R = 0x86, - ROB_BONE_KL_WAKI_R_WJ = 0x87, - ROB_BONE_TL_UP_KATA_R = 0x88, - ROB_BONE_C_KATA_R = 0x89, - ROB_BONE_KATA_R_WJ_CU = 0x8A, - ROB_BONE_UDE_R_WJ = 0x8B, - ROB_BONE_KL_TE_R_WJ = 0x8C, - ROB_BONE_N_HITO_R_EX = 0x8D, - ROB_BONE_NL_HITO_R_WJ = 0x8E, - ROB_BONE_NL_HITO_B_R_WJ = 0x8F, - ROB_BONE_NL_HITO_C_R_WJ = 0x90, - ROB_BONE_N_KO_R_EX = 0x91, - ROB_BONE_NL_KO_R_WJ = 0x92, - ROB_BONE_NL_KO_B_R_WJ = 0x93, - ROB_BONE_NL_KO_C_R_WJ = 0x94, - ROB_BONE_N_KUSU_R_EX = 0x95, - ROB_BONE_NL_KUSU_R_WJ = 0x96, - ROB_BONE_NL_KUSU_B_R_WJ = 0x97, - ROB_BONE_NL_KUSU_C_R_WJ = 0x98, - ROB_BONE_N_NAKA_R_EX = 0x99, - ROB_BONE_NL_NAKA_R_WJ = 0x9A, - ROB_BONE_NL_NAKA_B_R_WJ = 0x9B, - ROB_BONE_NL_NAKA_C_R_WJ = 0x9C, - ROB_BONE_N_OYA_R_EX = 0x9D, - ROB_BONE_NL_OYA_R_WJ = 0x9E, - ROB_BONE_NL_OYA_B_R_WJ = 0x9F, - ROB_BONE_NL_OYA_C_R_WJ = 0xA0, - ROB_BONE_N_STE_R_WJ_EX = 0xA1, - ROB_BONE_N_SUDE_R_WJ_EX = 0xA2, - ROB_BONE_N_SUDE_B_R_WJ_EX = 0xA3, - ROB_BONE_N_HIJI_R_WJ_EX = 0xA4, - ROB_BONE_N_UP_KATA_R_EX = 0xA5, - ROB_BONE_N_SKATA_R_WJ_CD_EX = 0xA6, - ROB_BONE_N_SKATA_B_R_WJ_CD_CU_EX = 0xA7, - ROB_BONE_N_SKATA_C_R_WJ_CD_CU_EX = 0xA8, - ROB_BONE_KL_KOSI_Y = 0xA9, - ROB_BONE_KL_KOSI_XZ = 0xAA, - ROB_BONE_KL_KOSI_ETC_WJ = 0xAB, - ROB_BONE_CL_MOMO_L = 0xAC, - ROB_BONE_J_MOMO_L_WJ = 0xAD, - ROB_BONE_J_SUNE_L_WJ = 0xAE, - ROB_BONE_KL_ASI_L_WJ_CO = 0xAF, - ROB_BONE_KL_TOE_L_WJ = 0xB0, - ROB_BONE_N_HIZA_L_WJ_EX = 0xB1, - ROB_BONE_CL_MOMO_R = 0xB2, - ROB_BONE_J_MOMO_R_WJ = 0xB3, - ROB_BONE_J_SUNE_R_WJ = 0xB4, - ROB_BONE_KL_ASI_R_WJ_CO = 0xB5, - ROB_BONE_KL_TOE_R_WJ = 0xB6, - ROB_BONE_N_HIZA_R_WJ_EX = 0xB7, - ROB_BONE_N_MOMO_A_L_WJ_CD_EX = 0xB8, - ROB_BONE_N_MOMO_B_L_WJ_EX = 0xB9, - ROB_BONE_N_MOMO_C_L_WJ_EX = 0xBA, - ROB_BONE_N_MOMO_A_R_WJ_CD_EX = 0xBB, - ROB_BONE_N_MOMO_B_R_WJ_EX = 0xBC, - ROB_BONE_N_MOMO_C_R_WJ_EX = 0xBD, - ROB_BONE_N_HARA_CD_EX = 0xBE, - ROB_BONE_N_HARA_B_WJ_EX = 0xBF, - ROB_BONE_N_HARA_C_WJ_EX = 0xC0, - ROB_BONE_MAX = 0xC1, -}; - enum rob_chara_type { ROB_CHARA_TYPE_NONE = -1, ROB_CHARA_TYPE_0 = 0x00, @@ -889,14 +917,14 @@ struct RobTransform { void reset_scale(); }; -struct bone_node { +struct RobNode { const char* name; mat4* mat_ptr; - const bone_node* parent; + const RobNode* parent; RobTransform transform; mat4* no_scale_mat; - bone_node(); + RobNode(); float_t* get_transform_component(size_t index, Expr_type& type); const float_t* get_transform_component(size_t index, Expr_type& type) const; @@ -943,9 +971,9 @@ struct mot_key_data { size_t key_set_count; prj::sys_vector key_set; mot mot; - prj::sys_vector key_set_data; + prj::sys_vector fc_value; const mot_data* mot_data; - bone_database_skeleton_type skeleton_type; + BONE_KIND skeleton_type; int32_t skeleton_select; uint32_t motion_id; float_t frame; @@ -958,47 +986,44 @@ struct mot_key_data { void reset(); }; -struct bone_data { - bone_database_bone_type type; - int32_t has_parent; - motion_bone_index motion_bone_index; - int32_t mirror; - int32_t parent; - int32_t flags; +struct RobBlock { + IK_TYPE ik_type; + IH_TYPE inherit_type; + BONE_BLK block_id; + BONE_BLK flip_block_id; + BONE_BLK inherit_mat_id; + uint32_t expression_id; int32_t key_set_offset; int32_t key_set_count; float_t frame; - vec3 local_position[2]; - vec3 rotation; - vec3 ik_target; - vec3 position; - mat4 rot_mat[3]; - vec3 position_prev[2]; - mat4 rot_mat_prev[3][2]; - mat4* pole_target_mat; - mat4* parent_mat; - bone_node* node; - float_t ik_segment_length[2]; - float_t ik_2nd_segment_length[2]; + vec3 chain_pos[2]; + vec3 chain_ang; + vec3 leaf_pos[2]; + mat4 chain_rot[3]; + vec3 smooth_pos[2]; + mat4 smooth_rot[3][2]; + const mat4* up_vector_mat_ptr; + const mat4* inherit_mat_ptr; + RobNode* node; + float_t len[2][2]; float_t arm_length; float_t eyes_xrot_adjust_neg; float_t eyes_xrot_adjust_pos; - bone_data(); - ~bone_data(); + RobBlock(); + ~RobBlock(); - void copy_rot_trans(const bone_data& other); - bool check_flags_not_null(); - bool get_constraint_ik(const bone_data* bones); - bool get_ex_rotation(RobTransform& transform, const bone_data* bones); + void copy_rot_trans(const RobBlock& other); + bool check_expression_id_not_null(); + bool get_constraint_ik(const RobBlock* bones); + bool get_ex_rotation(RobTransform& transform, const RobBlock* bones); void get_mat(int32_t skeleton_select); void get_mat_ik(int32_t skeleton_select); - void mult_mat(const mat4& parent_mat, const bone_data* bones, bool solve_ik); + void mult_mat(const mat4& parent_mat, const RobBlock* bones, bool solve_ik); void orient_x(const vec3& target); void orient_x_cns(const vec3& target, float_t weight); void orient_y(vec3 y_axis); - vec3* set_key_data(vec3* keyframe_data, - bone_database_skeleton_type skeleton_type, bool get_data, bool reverse_x); + const vec3* set_global_leaf_sub(const vec3* val, BONE_KIND kind, bool get_data, bool flip_x); void store_curr_rot_trans(int32_t skeleton_select); static float_t limit_angle(float_t angle); @@ -1010,16 +1035,18 @@ struct bone_data_parent { size_t motion_bone_count; size_t leaf_pos; size_t chain_pos; - prj::sys_vector bones; + prj::sys_vector bones; prj::sys_vector bone_indices; - vec3 global_position; - vec3 global_rotation; + vec3 gblctr_pos; + vec3 gblctr_rot; uint32_t bone_key_set_count; uint32_t global_key_set_count; float_t rot_y; bone_data_parent(); ~bone_data_parent(); + + void ik_init(const BODYTYPE* bt, const CHAINPOSRADIUS* motion_chain_pos, const CHAINPOSRADIUS* disp_chain_pos); }; struct mot_play_frame_data { @@ -1099,8 +1126,8 @@ public: virtual void Reset(); virtual void Field_10(float_t, float_t, int32_t) = 0; virtual void Step(struc_400*) = 0; - virtual void Field_20(prj::sys_vector* bones_curr, prj::sys_vector* bones_prev) = 0; - virtual void Blend(bone_data* curr, bone_data* prev) = 0; + virtual void Field_20(prj::sys_vector* bones_curr, prj::sys_vector* bones_prev) = 0; + virtual void Blend(RobBlock* curr, RobBlock* prev) = 0; virtual bool Field_30(); void SetDuration(float_t duration, float_t step, float_t offset); @@ -1121,8 +1148,8 @@ public: virtual void Reset() override; virtual void Field_10(float_t, float_t, int32_t) override; virtual void Step(struc_400*) override; - virtual void Field_20(prj::sys_vector* bones_curr, prj::sys_vector* bones_prev) override; - virtual void Blend(bone_data* curr, bone_data* prev) override; + virtual void Field_20(prj::sys_vector* bones_curr, prj::sys_vector* bones_prev) override; + virtual void Blend(RobBlock* curr, RobBlock* prev) override; virtual bool Field_30() override; }; @@ -1154,8 +1181,8 @@ public: virtual void Reset() override; virtual void Field_10(float_t, float_t, int32_t) override; virtual void Step(struc_400*) override; - virtual void Field_20(prj::sys_vector* bones_curr, prj::sys_vector* bones_prev) override; - virtual void Blend(bone_data* curr, bone_data* prev) override; + virtual void Field_20(prj::sys_vector* bones_curr, prj::sys_vector* bones_prev) override; + virtual void Blend(RobBlock* curr, RobBlock* prev) override; }; class PartialMotionBlendFreeze : public MotionBlendFreeze { @@ -1166,11 +1193,11 @@ public: virtual void Reset() override; virtual void Field_10(float_t, float_t, int32_t) override; virtual void Step(struc_400*) override; - virtual void Field_20(prj::sys_vector* bones_curr, prj::sys_vector* bones_prev) override; - virtual void Blend(bone_data* curr, bone_data* prev) override; + virtual void Field_20(prj::sys_vector* bones_curr, prj::sys_vector* bones_prev) override; + virtual void Blend(RobBlock* curr, RobBlock* prev) override; }; -typedef bool(* PFNMOTIONBONECHECKFUNC)(motion_bone_index bone_index); +typedef bool(* PFNMOTIONBONECHECKFUNC)(BONE_BLK bone_index); struct motion_blend_mot_enabled_bones { PFNMOTIONBONECHECKFUNC func; @@ -1203,7 +1230,7 @@ struct motion_blend_mot { void apply_global_transform(); void copy_rot_trans(); - void copy_rot_trans(const prj::sys_vector<::bone_data>& bones); + void copy_rot_trans(const prj::sys_vector& bones); bool get_blend_enable(); void get_n_hara_cp_position(vec3& value); MotionBlendType get_type(); @@ -1214,13 +1241,13 @@ struct motion_blend_mot { const bone_database* bone_data, const motion_database* mot_db); void mult_mat(const mat4* mat); void reset(); - void set_arm_length(motion_bone_index motion_bone_index, float_t value); + void set_arm_length(BONE_BLK block_id, float_t value); void set_blend(MotionBlendType blend_type, float_t blend); void set_blend_duration(float_t duration, float_t step, float_t offset); void set_step(float_t step); void store_curr_rot_trans(int32_t skeleton_select); - static bool interpolate_get_reverse(struc_308& a1); + static bool interpolate_get_flip(struc_308& a1); }; struct rob_chara_bone_data_ik_scale { @@ -1242,16 +1269,16 @@ struct partial_motion_blend_mot { partial_motion_blend_mot(); ~partial_motion_blend_mot(); - void init(bone_database_skeleton_type type, + void init(BONE_KIND type, PFNMOTIONBONECHECKFUNC bone_check_func, size_t motion_bone_count, const bone_database* bone_data); - void interpolate(prj::sys_vector& bones, - const prj::sys_vector* bone_indices, bone_database_skeleton_type skeleton_type); + void interpolate(prj::sys_vector& bones, + const prj::sys_vector* bone_indices, BONE_KIND skeleton_type); void load_motion(uint32_t motion_id, const motion_database* mot_db); void reset(); void set_blend_duration(float_t duration, float_t step, float_t offset); void set_frame(float_t frame); void set_step(float_t step); - void store_curr_rot_trans(prj::sys_vector& bones); + void store_curr_rot_trans(prj::sys_vector& bones); }; struct rob_chara_look_anim_eye_param_limits { @@ -1312,7 +1339,7 @@ struct struc_936 { }; struct rob_chara_look_anim { - prj::sys_vector* bones; + prj::sys_vector* bones; mat4 mat; rob_chara_look_anim_eye_param param; bool update_view_point; @@ -1386,7 +1413,7 @@ struct rob_chara_sleeve_adjust { vec3 field_74; vec3 field_80; float_t radius; - prj::sys_vector* bones; + prj::sys_vector* bones; float_t step; rob_chara_sleeve_adjust(); @@ -1404,9 +1431,9 @@ struct rob_chara_bone_data { size_t chain_pos; std::vector mats; std::vector mats2; - std::vector nodes; - bone_database_skeleton_type base_skeleton_type; - bone_database_skeleton_type skeleton_type; + std::vector nodes; + BONE_KIND base_skeleton_type; + BONE_KIND skeleton_type; std::vector motions; std::list motion_indices; std::list motion_loaded_indices; @@ -1488,13 +1515,60 @@ union rob_chara_pv_data_item { int32_t arr[4]; }; +struct RobAngle { + int16_t value; + + inline RobAngle( ) : value() {} + inline RobAngle(int16_t value) : value(value) {} + + inline float_t get_deg() { + return (float_t)((double_t)value * 180.0 * (1.0 / 32768.0)); + } + + inline float_t get_rad() { + return (float_t)((double_t)value * M_PI * (1.0 / 32768.0)); + } + + inline void set_deg(float_t in_deg) { + value = (int16_t)(int32_t)(in_deg * 32768.0f * (float_t)(1.0 / 180.0)); + } + + inline void set_rad(float_t in_rad) { + value = (int16_t)(int32_t)((double_t)(in_rad * 32768.0f) * (1.0 / M_PI)); + } +}; + +inline RobAngle operator+(const RobAngle& left, const RobAngle& right) { + return (int16_t)(left.value + right.value); +} + +inline RobAngle operator+(const int32_t& left, const RobAngle& right) { + return (int16_t)(left + right.value); +} + +inline RobAngle operator+(const RobAngle& left, const int32_t& right) { + return (int16_t)(left.value + right); +} + +inline RobAngle operator-(const RobAngle& left, const RobAngle& right) { + return (int16_t)(left.value - right.value); +} + +inline RobAngle operator-(const int32_t& left, const RobAngle& right) { + return (int16_t)(left - right.value); +} + +inline RobAngle operator-(const RobAngle& left, const int32_t& right) { + return (int16_t)(left.value - right); +} + struct rob_chara_pv_data { rob_chara_type type; bool field_4; bool field_5; bool field_6; vec3 field_8; - int16_t rot_y_int16; + RobAngle yang; int16_t field_16; rob_sleeve_data sleeve_l; rob_sleeve_data sleeve_r; @@ -1510,10 +1584,10 @@ struct rob_chara_pv_data { void reset(); }; -struct struc_218 { - vec3 bone_offset; +struct RobCollisionData { + vec3 trans; float_t scale; - rob_bone_index bone_index; + BONE_ID bone; int32_t field_14; }; @@ -1524,8 +1598,8 @@ struct struc_344 { int32_t swim_s_costume; }; -struct struc_870 { - const char* field_0; +struct RobKamae { + const char* name; int32_t field_8; int32_t field_C; int32_t field_10; @@ -1533,16 +1607,15 @@ struct struc_870 { int32_t field_18; }; -struct chara_init_data { +struct RobData { int32_t object_set; - bone_database_skeleton_type skeleton_type; - object_info field_7E0; - object_info field_7E4[14]; - uint32_t motion_set; - int32_t field_820; - const struc_218* field_828; - const struc_218* field_830; - const struc_870** field_838; + BONE_KIND skeleton_type; + object_info body_obj_uid[15]; + uint32_t motfile; + uint32_t motfile_auth; + const RobCollisionData* colli_data; + const RobCollisionData* push_colli_data; + const RobKamae** kamae_tbl; int32_t field_840; int32_t field_844; struc_344 field_848; @@ -1561,10 +1634,10 @@ struct RobSkinOfs { class ExNodeBlock { public: - bone_node* dst_node; + RobNode* dst_node; ExNodeType type; const char* name; - const bone_node* parent; + const RobNode* parent; std::string parent_name; ExNodeBlock* parent_node; const rob_chara_item_equip_object* skin_disp; @@ -1588,7 +1661,7 @@ public: virtual void CtrlEnd(); void init_members(); - void set_data(bone_node* node, ExNodeType type, + void set_data(RobNode* node, ExNodeType type, const char* name, const rob_chara_item_equip_object* skin_disp); }; @@ -1730,7 +1803,7 @@ struct RobJointNode { vec3 vec; vec3 vel; float_t length_next; - bone_node* dst_node; + RobNode* dst_node; mat4* dst_node_mat; mat4 mat; RobJointNode* distance; @@ -2030,7 +2103,7 @@ struct CLOTH_WEIGHTED_ROOT { vec3 pos; vec3 normal; vec4 tangent; - const bone_node* node[4]; + const RobNode* node[4]; const mat4* node_mat[4]; const mat4* bone_mat[4]; float_t weight[4]; @@ -2197,7 +2270,7 @@ struct RobOsage { const float_t step, bool disable_ex_force); const float_t* LoadOpdData(size_t node_index, const float_t* opd_data, size_t opd_count); void LoadSkinParam(void* kv, const char* name, - skin_param_osage_root& skp_root, object_info* obj_info, const bone_database* bone_data); + skin_param_osage_root& skp_root, const object_info& obj_info, const bone_database* bone_data); void RotateMat(mat4& mat, const vec3& hsc, bool init_rot = false); void SetDisableCollision(const bool& value); void SetMotionResetData(uint32_t motion_id, float_t frame); @@ -2216,7 +2289,7 @@ struct RobOsage { void dest_boc(); RobJointNode* get_joint_node(size_t index); void init(const obj_skin_ex_node_osage* osg_data, const obj_skin_osage_joint* joint, - bone_node* ex_node, const obj_skin* skin); + RobNode* ex_node, const obj_skin* skin); void make_osage_coli(const mat4* motmat); void pos_init(const mat4& root_matrix, const vec3& hsc, bool dist_flag); void pos_init_cont(const mat4& root_matrix, const vec3& hsc, @@ -2277,8 +2350,8 @@ public: std::map& ex_node_list); void reset_ex_force(); void set_data(const rob_chara_item_equip_object* skin_disp, const obj_skin_ex_node_osage* root, - const char* name, const obj_skin_osage_joint* joint, const bone_node* mot_node, - bone_node* ex_node, const obj_skin* skin); + const char* name, const obj_skin_osage_joint* joint, const RobNode* mot_node, + RobNode* ex_node, const obj_skin* skin); void set_ex_force(const vec3& f); void set_move_cancel(const float_t& mv_ccl); }; @@ -2286,8 +2359,8 @@ public: class ExConstraintBlock : public ExNodeBlock { public: obj_skin_ex_node_constraint_type cns_type; - const bone_node* src_node; - const bone_node* upvector_node; + const RobNode* src_node; + const RobNode* upvector_node; const obj_skin_ex_node_constraint* data; uint32_t dst_node_id; uint32_t src_node_id; @@ -2361,7 +2434,7 @@ public: void CalcMatrixHS(); void set_data(const rob_chara_item_equip_object* skin_disp, const obj_skin_ex_node_expression* data, - const char* node_name, object_info a4, size_t index, const bone_database* bone_data); + const char* node_name, object_info objuid, size_t index, const bone_database* bone_data); }; struct rob_chara_item_equip; @@ -2369,7 +2442,7 @@ struct rob_chara_item_equip; struct rob_chara_item_equip_object { size_t index; const mat4* motion_matrix; - object_info obj_info; + object_info obj_uid; object_info obj_uid_sub; std::vector texchg_vec; RobSkinCol skn_col; @@ -2380,9 +2453,9 @@ struct rob_chara_item_equip_object { uint32_t bone_kind; mat4* mat; int32_t init_cnt; - const bone_node* motion_node; + const RobNode* motion_node; std::vector ex_node_block; - std::vector ex_node; + std::vector ex_node; std::vector matrix; std::vector no_scale_matrix; prj::vector_pair node_name_map; @@ -2406,25 +2479,25 @@ struct rob_chara_item_equip_object { void check_no_opd(std::vector& opd_blend_data); void clear_ex_data(); void disp(const mat4& mat, render_context* rctx); - const bone_node* get_node(int32_t bone_index) const; - const bone_node* get_node(const char* name, const bone_database* bone_data) const; + const RobNode* get_node(int32_t index) const; + const RobNode* get_node(const char* name, const bone_database* bone_data) const; int32_t get_node_index(const char* name, const bone_database* bone_data) const; const mat4* get_ex_data_bone_node_mat(const char* name); RobJointNode* get_normal_ref_osage_node(const std::string& str, size_t* index); - void get_parent_bone_nodes(bone_node* bone_nodes, const bone_database* bone_data); - void init_ex_data_bone_nodes(obj_skin_ex_data* ex_data); + void set_motion_node(const RobNode* mot_node, const bone_database* bone_data); void init_members(size_t index = 0xDEADBEEF); - void load_ex_data(obj_skin_ex_data* ex_data, - const bone_database* bone_data, void* data, const object_database* obj_db); - void load_object_info_ex_data(object_info object_info, const bone_node* motion_node, - bool osage_reset, const bone_database* bone_data, void* data, const object_database* obj_db); void pos_reset(int32_t init_cnt); void reset_ex_force(); void reset_nodes_ex_force(rob_osage_parts_bit parts_bits); + void set(object_info objuid, const RobNode* mot_node, + bool osage_reset, const bone_database* bone_data, void* data, const object_database* obj_db); void set_alpha_obj_flags(float_t alpha, int32_t flags); bool set_boc(const skin_param_osage_root& skp_root, ExOsageBlock* osg); void set_collision_target_osage(const skin_param_osage_root& skp_root, skin_param* skp); void set_disable_collision(rob_osage_parts_bit parts_bits, bool disable); + void set_ex_node(obj_skin_ex_data* ex_data); + void set_ex_node_block(obj_skin_ex_data* ex_data, + const bone_database* bone_data, void* data, const object_database* obj_db); void set_motion_reset_data(uint32_t motion_id, float_t frame); void set_motion_skin_param(int8_t chara_id, uint32_t motion_id, int32_t frame); void set_null_blocks_expression_data(const vec3& position, const vec3& rotation, const vec3& scale); @@ -2441,52 +2514,31 @@ struct rob_chara_item_equip_object { }; struct rob_chara_item_equip { - bone_node* bone_nodes; - mat4* matrices; - rob_chara_item_equip_object* item_equip_object; - int32_t field_18[31]; - bool item_equip_range; - item_id first_item_equip_object; - item_id max_item_equip_object; - int32_t field_A0; - shadow_type_enum shadow_type; + const RobNode* motion_node; + const mat4* motion_matrix; + rob_chara_item_equip_object* skin_disp; + int32_t parts_attr[RPK_MAX]; + bool one_skin; + int32_t disp_begin; + int32_t disp_max; + uint32_t shadow_flag; + SHADOW_GROUP shadow_group; vec3 position; - std::vector texture_pattern; - object_info field_D0; - int32_t field_D4; + std::vector hyoutan_texchg_list; + object_info hyoutan_obj; + int32_t hyoutan_rpk; bool disable_update; int32_t field_DC; - vec4 texture_color_coefficients; + vec4 skin_color; float_t wet; float_t wind_strength; bool chara_color; bool npr_flag; mat4 mat; - mat4 field_13C[30]; - int32_t field_8BC; - int32_t field_8C0; - int32_t field_8C4; - int32_t field_8C8; - int32_t field_8CC; - int32_t field_8D0; - int32_t field_8D4; - int32_t field_8D8; - int32_t field_8DC; - int32_t field_8E0; - int32_t field_8E4; - int32_t field_8E8; - int32_t field_8EC; - int32_t field_8F0; - int32_t field_8F4; - int32_t field_8F8; - int32_t field_8FC; - int64_t field_900; - int64_t field_908; - int64_t field_910; - int64_t field_918; - int64_t field_920; - int64_t field_928; - int64_t field_930; + mat4 parts_matrix[RPK_MAX]; + std::vector shadow_obj_list; + std::vector shadow_vb_list; + obj_skin* shadow_skin; float_t osage_step; bool use_opd; std::vector opd_blend_data; @@ -2499,38 +2551,38 @@ struct rob_chara_item_equip { void add_motion_reset_data(uint32_t motion_id, float_t frame, int32_t iterations); void disp(int32_t chara_id, render_context* rctx); - rob_chara_item_equip_object* get_item_equip_object(item_id id); - object_info get_object_info(item_id id); - void get_parent_bone_nodes(bone_node* bone_nodes, const bone_database* bone_data); - const mat4* get_ex_data_bone_node_mat(item_id id, const char* name); - void load_body_parts_object_info(item_id id, object_info obj_info, + rob_chara_item_equip_object* get_skin_disp(ROB_PARTS_KIND rpk); + object_info get_object_info(ROB_PARTS_KIND rpk); + void set_motion_node(const RobNode* mot_node, const bone_database* bone_data); + const mat4* get_ex_data_bone_node_mat(ROB_PARTS_KIND rpk, const char* name); + void load_body_parts_object_info(ROB_PARTS_KIND rpk, object_info obj_info, const bone_database* bone_data, void* data, const object_database* obj_db); - void load_object_info(object_info obj_info, item_id id, - bool osage_reset, const bone_database* bone_data, void* data, const object_database* obj_db); - void load_outfit_object_info(item_id id, object_info obj_info, + void load_outfit_object_info(ROB_PARTS_KIND rpk, object_info obj_info, bool osage_reset, const bone_database* bone_data, void* data, const object_database* obj_db); void pos_reset(uint8_t init_cnt); void reset(); void reset_ex_force(); - void reset_init_data(bone_node* bone_nodes); + void reset_init_data(RobNode* mot_node); void reset_nodes_ex_force(rob_osage_parts parts); void set_alpha_obj_flags(float_t alpha, mdl::ObjFlags flags); void set_disable_collision(rob_osage_parts parts, bool disable); - void set_disp(item_id id, bool value); - void set_item_equip_range(bool value); + void set_disp(ROB_PARTS_KIND rpk, bool value); + void set_item(object_info obj_uid, ROB_PARTS_KIND rpk, bool osage_reset, + const bone_database* bone_data, void* data, const object_database* obj_db); void set_motion_reset_data(uint32_t motion_id, float_t frame); void set_motion_skin_param(int8_t chara_id, uint32_t motion_id, int32_t frame); - void set_null_blocks_expression_data(item_id id, + void set_null_blocks_expression_data(ROB_PARTS_KIND rpk, const vec3& position, const vec3& rotation, const vec3& scale); - void set_object_texture_pattern(item_id id, texture_pattern_struct* tex_pat, size_t count); + void set_object_texture_pattern(ROB_PARTS_KIND rpk, texture_pattern_struct* tex_pat, size_t count); + void set_one_skin(bool value); void set_opd_blend_data(std::list* a2); - void set_osage_play_data_init(item_id id, const float_t* opdi_data); + void set_osage_play_data_init(ROB_PARTS_KIND rpk, const float_t* opdi_data); void set_osage_reset(); void set_osage_step(float_t value); void set_osage_move_cancel(uint8_t id, const float_t& mv_ccl); - void set_shadow_type(int32_t chara_id); + void set_shadow_group(int32_t chara_id); void set_texture_pattern(texture_pattern_struct* tex_pat, size_t count); - void skp_load(item_id id, const skin_param_osage_root& skp_root, std::vector& vec, + void skp_load(ROB_PARTS_KIND rpk, const skin_param_osage_root& skp_root, std::vector& vec, skin_param_file_data* skp_file_data, const bone_database* bone_data); }; @@ -2544,14 +2596,14 @@ struct item_cos_texture_change_tex { }; struct rob_chara_item_cos_data { - ::chara_index curr_chara_index; - ::chara_index chara_index; + CHARA_NUM curr_chara_num; + CHARA_NUM chara_num; item_cos_data curr_cos; item_cos_data cos; std::map> texture_change; std::map> item_change; - std::map field_F0; - std::map field_100; + std::map field_F0; + std::map field_100; std::vector texture_pattern[31]; std::map head_replace; @@ -2564,21 +2616,21 @@ struct rob_chara_item_cos_data { float_t get_max_face_depth(); void reload_items(int32_t chara_id, const bone_database* bone_data, void* data, const object_database* obj_db); - void set_chara_index(::chara_index chara_index); - void set_chara_index_item(::chara_index chara_index, int32_t item_no); - void set_chara_index_item_nos(::chara_index chara_index, const int32_t* items); - void set_chara_index_item_zero(::chara_index chara_index, int32_t item_no); + void set_chara_num(CHARA_NUM chara_num); + void set_chara_num_item(CHARA_NUM chara_num, int32_t item_no); + void set_chara_num_item_nos(CHARA_NUM chara_num, const int32_t* items); + void set_chara_num_item_zero(CHARA_NUM chara_num, int32_t item_no); void set_item(int32_t item_no); void set_item_array(const rob_chara_pv_data_item& item); void set_item_no(item_sub_id sub_id, int32_t item_no); void set_item_nos(const int32_t* item_nos); void set_item_zero(int32_t item_no); - void set_texture_pattern(rob_chara_item_equip* rob_itm_equip, - item_id id, bool tex_pat_for_all); - void set_texture_pattern(rob_chara_item_equip* rob_itm_equip, - uint32_t item_no, item_id id, bool tex_pat_for_all); - void set_texture_pattern(rob_chara_item_equip* rob_itm_equip, - const std::vector& item_nos, item_id id, bool tex_pat_for_all); + void set_texture_pattern(rob_chara_item_equip* rob_disp, + ROB_PARTS_KIND rpk, bool tex_pat_for_all); + void set_texture_pattern(rob_chara_item_equip* rob_disp, + uint32_t item_no, ROB_PARTS_KIND rpk, bool tex_pat_for_all); + void set_texture_pattern(rob_chara_item_equip* rob_disp, + const std::vector& item_nos, ROB_PARTS_KIND rpk, bool tex_pat_for_all); void texture_change_clear(); void texture_pattern_clear(); }; @@ -2689,8 +2741,8 @@ struct struc_264 { int32_t field_198; int32_t field_19C; int32_t field_1A0; - uint8_t field_1A4; - const struc_870* field_1A8; + uint8_t kamae_type; + const RobKamae* kamae_data; int32_t field_1B0; int32_t field_1B4; int32_t field_1B8; @@ -2844,6 +2896,51 @@ public: virtual void Field_20(rob_chara* rob_chr) override; }; +union RobFlag { + uint32_t u32; + struct { + int8_t disp : 1; + int8_t fix_hara : 1; + int8_t ringout : 1; + int8_t bound_wall : 1; + + int8_t compel : 1; + int8_t pl_syagami : 1; + int8_t land : 1; + int8_t old_fix_hara : 1; + + int8_t invincible : 1; + int8_t yokerare : 1; + int8_t yokerare_mot : 1; + int8_t wall_hit_ok : 1; + + int8_t own_down_pose : 1; + int8_t time_up : 1; + int8_t kabe_yoroke : 1; + int8_t jump_rise : 1; + + int8_t round_loser : 1; + int8_t wall_fix_ok : 1; + int8_t wall_fix_ng : 1; + int8_t not_normal : 1; + + int8_t old_not_normal : 1; + int8_t mk_change_off : 1; + int8_t wall_moved_mot : 1; + int8_t dmy_yokerare : 1; + + int8_t yoketa : 1; + int8_t yokerare_mot2 : 1; + int8_t mk_yoke_off : 1; + int8_t set_damage : 1; + + int8_t rf_28 : 1; + int8_t rf_29 : 1; + int8_t rf_30 : 1; + int8_t rf_31 : 1; + } bit; +}; + struct RobSubAction { struct Data { SubActExec* field_0; @@ -3387,24 +3484,23 @@ struct struc_223 { }; struct rob_chara_data_miku_rot { - int16_t rot_y_int16; - int16_t field_2; - int16_t field_4; - int16_t field_6; - int32_t field_8; - int32_t field_C; - float_t field_10; - int32_t field_14; - vec3 position; - vec3 n_hara_pos; - vec3 field_30; - vec3 field_3C; - vec3 n_hara_pos_prev; - vec3 n_hara_pos_diff; - int32_t field_60; - int32_t field_64; - int32_t field_68; - mat4 mat; + RobAngle yang; + RobAngle act_yang; + RobAngle hara_xang; + RobAngle hara_yang; + RobAngle hara_zang; + RobAngle revise_tag_yang; + ReviseType revise_type; + float_t ground_pos; + float_t ground_last; + vec3 pos; + vec3 gpos; + vec3 spd; + vec3 adjust_spd; + vec3 old_gpos; + vec3 velocity; + vec3 pos_camera_old; + mat4 rob_mat; rob_chara_data_miku_rot(); @@ -3591,16 +3687,12 @@ struct struc_209 { }; struct rob_chara_data { - uint8_t field_0; - uint8_t field_1; - uint8_t field_2; - uint8_t field_3; - int32_t field_4; - struc_264 field_8; + RobFlag flag; + struc_264 action; RobSubAction rob_sub_action; rob_chara_motion motion; - struc_223 field_1588; - rob_chara_data_miku_rot miku_rot; + struc_223 motdata; + rob_chara_data_miku_rot position; rob_chara_adjust_data adjust_data; struc_209 field_1E68; float_t field_3D90; @@ -3649,16 +3741,16 @@ struct rob_chara { rob_chara_type type; bool field_C; bool field_D; - chara_index chara_index; + CHARA_NUM chara_num; int32_t cos_id; float_t frame_speed; rob_chara* field_20; rob_chara_bone_data* bone_data; - rob_chara_item_equip* item_equip; + rob_chara_item_equip* rob_disp; rob_chara_item_cos_data item_cos_data; rob_chara_data data; rob_chara_data data_prev; - const chara_init_data* chara_init_data; + const RobData* rob_data; rob_chara_pv_data pv_data; rob_chara(); @@ -3670,17 +3762,17 @@ struct rob_chara { void autoblink_enable(); bool check_for_ageageagain_module(); mat4* get_bone_data_mat(size_t index); - object_info get_chara_init_data_face_object(int32_t index); + object_info get_rob_data_face_object(int32_t index); float_t get_frame(); float_t get_frame_count(); float_t get_max_face_depth(); uint32_t get_rob_cmn_mottbl_motion_id(int32_t id); float_t get_pos_scale(int32_t bone, vec3& pos); - void load_body_parts_object_info(item_id item_id, object_info obj_info, + void load_body_parts_object_info(ROB_PARTS_KIND rpk, object_info obj_info, const bone_database* bone_data, void* data, const object_database* obj_db); void load_motion(uint32_t motion_id, bool a3, float_t frame, MotionBlendType blend_type, const bone_database* bone_data, const motion_database* mot_db); - void load_outfit_object_info(item_id id, object_info obj_info, + void load_outfit_object_info(ROB_PARTS_KIND rpk, object_info obj_info, bool osage_reset, const bone_database* bone_data, void* data, const object_database* obj_db); void pos_reset(); void rob_info_ctrl(); @@ -3695,8 +3787,8 @@ struct rob_chara { void set_chara_pos_adjust_y(float_t value); void set_chara_size(float_t value); void set_data_adjust_mat(rob_chara_adjust_data* rob_chr_adj, bool pos_adjust = true); - void set_data_miku_rot_position(const vec3& value); - void set_data_miku_rot_rot_y_int16(int16_t value); + void set_base_position_pos(const vec3& value); + void set_base_position_yang(const RobAngle& value); void set_disable_collision(rob_osage_parts parts, bool disable); void set_eyelid_mottbl_motion(int32_t type, int32_t mottbl_index, float_t value, rob_partial_motion_playback_state playback_state, float_t blend_duration, @@ -3747,7 +3839,7 @@ struct rob_chara { void set_osage_move_cancel(uint8_t id, float_t mv_ccl); void set_osage_reset(); void set_osage_step(float_t value); - void set_parts_disp(item_id id, bool disp); + void set_parts_disp(ROB_PARTS_KIND rpk, 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); @@ -3757,7 +3849,7 @@ struct rob_chara { void set_wind_strength(float_t value); inline bool is_visible() { - return !!(data.field_0 & 0x01); + return !!data.flag.bit.disp; } void sub_1405070E0(const bone_database* bone_data, const motion_database* mot_db); @@ -3801,7 +3893,7 @@ struct OpdMakeManagerData { struct Worker { uint32_t mode; uint32_t progress; - chara_index chara; + CHARA_NUM chara; std::vector items; Worker(); @@ -3853,25 +3945,25 @@ struct OpdChecker { void sub_140471020(); }; -#define ROB_CHARA_COUNT 6 - -extern const chara_init_data* chara_init_data_get(chara_index chara_index); -extern int32_t chara_init_data_get_chara_size_index(chara_index chara_index); -extern int32_t chara_init_data_get_swim_costume(chara_index chara_index); -extern int32_t chara_init_data_get_swim_s_costume(chara_index chara_index); +extern const RobData* get_rob_data(CHARA_NUM cn); +extern int32_t rob_data_get_chara_size_index(CHARA_NUM cn); +extern int32_t rob_data_get_swim_costume(CHARA_NUM cn); +extern int32_t rob_data_get_swim_s_costume(CHARA_NUM cn); extern float_t chara_pos_adjust_y_table_get_value(uint32_t index); extern float_t chara_size_table_get_value(uint32_t index); extern bool check_cos_id_is_501(int32_t cos_id); -extern const uint32_t* get_opd_motion_ids(); -extern const uint32_t* get_opd_motion_set_ids(); +extern uint32_t get_common_rob_mot(CHARA_NUM cn, int32_t a2, int32_t id); const char* get_dev_ram_opdi_dir(); extern const float_t get_gravity(); +extern const uint32_t* get_opd_motion_ids(); +extern const uint32_t* get_opd_motion_set_ids(); + extern const char* get_ram_osage_play_data_dir(); extern const char* get_ram_osage_play_data_tmp_dir(); extern const char* get_rom_osage_play_data_dir(); @@ -3929,8 +4021,8 @@ extern rob_chara* rob_chara_array_get(int32_t chara_id); extern rob_chara_bone_data* rob_chara_array_get_bone_data(int32_t chara_id); extern float_t rob_chara_array_get_data_adjust_scale(int32_t chara_id); extern rob_chara_item_cos_data* rob_chara_array_get_item_cos_data(int32_t chara_id); -extern rob_chara_item_equip* rob_chara_array_get_item_equip(int32_t chara_id); -extern int32_t rob_chara_array_init_chara_index(chara_index chara_index, +extern rob_chara_item_equip* rob_chara_array_get_rob_disp(int32_t chara_id); +extern int32_t rob_chara_array_init_chara_num(CHARA_NUM chara_num, const rob_chara_pv_data& pv_data, int32_t cos_id, bool can_set_default); extern void rob_chara_array_free_chara_id(int32_t chara_id); extern void rob_chara_array_reset_pv_data(int32_t chara_id); @@ -3938,14 +4030,12 @@ extern void rob_chara_array_reset_bone_data_item_equip(int32_t chara_id); extern void rob_chara_array_set_alpha_obj_flags(int32_t chara_id, float_t alpha, mdl::ObjFlags flags); extern void rob_chara_array_set_visibility(int32_t chara_id, bool value); -extern bool rob_chara_check_for_ageageagain_module(chara_index chara_index, int32_t cos_id); +extern bool rob_chara_check_for_ageageagain_module(CHARA_NUM chara_num, int32_t cos_id); extern bool rob_chara_pv_data_array_check_chara_id(int32_t chara_id); -extern uint32_t rob_cmn_mottbl_get_motion_id(chara_index chara_index, int32_t a2, int32_t id); - extern void rob_sleeve_handler_data_get_sleeve_data( - ::chara_index chara_index, int32_t cos, rob_sleeve_data& l, rob_sleeve_data& r); + CHARA_NUM chara_num, int32_t cos, rob_sleeve_data& l, rob_sleeve_data& r); extern bool rob_sleeve_handler_data_load(); extern void rob_sleeve_handler_data_read(); @@ -3959,10 +4049,10 @@ extern void pv_osage_manager_array_set_pv_set_motion( int32_t chara_id, const std::vector& set_motion); extern bool task_rob_load_add_task(); -extern bool task_rob_load_append_free_req_data(chara_index chara_index); -extern bool task_rob_load_append_free_req_data_obj(chara_index chara_index, const item_cos_data* cos); -extern bool task_rob_load_append_load_req_data(chara_index chara_index); -extern bool task_rob_load_append_load_req_data_obj(chara_index chara_index, const item_cos_data* cos); +extern bool task_rob_load_append_free_req_data(CHARA_NUM chara_num); +extern bool task_rob_load_append_free_req_data_obj(CHARA_NUM chara_num, const item_cos_data* cos); +extern bool task_rob_load_append_load_req_data(CHARA_NUM chara_num); +extern bool task_rob_load_append_load_req_data_obj(CHARA_NUM chara_num, const item_cos_data* cos); extern bool task_rob_load_check_load_req_data(); extern bool task_rob_load_del_task(); @@ -3982,5 +4072,5 @@ extern int32_t look_anim_id_to_mottbl_index(int32_t look_anim_id); extern int32_t mouth_anim_id_to_mottbl_index(int32_t mouth_anim_id); inline bool rob_chara::check_for_ageageagain_module() { - return rob_chara_check_for_ageageagain_module(chara_index, cos_id); + return rob_chara_check_for_ageageagain_module(chara_num, cos_id); } diff --git a/src/CRE/rob/skin_param.cpp b/src/CRE/rob/skin_param.cpp index e4b0b725..98394187 100644 --- a/src/CRE/rob/skin_param.cpp +++ b/src/CRE/rob/skin_param.cpp @@ -19,7 +19,7 @@ struct osage_setting { void clear(); const osage_setting_osg_cat* get_cat_value( - object_info* obj_info, const char* root_node); + const object_info& obj_info, const char* root_node); void load(); void parse(key_val* kv); rob_osage_parts parse_parts_string(std::string& s); @@ -27,7 +27,7 @@ struct osage_setting { struct skin_param_file { p_file_handler* file_handler; - item_id id; + ROB_PARTS_KIND rpk; int32_t type; std::vector* data; rob_chara* rob_chr; @@ -236,7 +236,7 @@ osage_setting_osg_cat::osage_setting_osg_cat() : exf() { } const osage_setting_osg_cat* osage_setting_data_get_cat_value( - object_info* obj_info, const char* root_node) { + const object_info& obj_info, const char* root_node) { return osage_setting_data->get_cat_value(obj_info, root_node); } @@ -252,7 +252,7 @@ void skin_param_data_init() { sp_skp_db_data = new sp_skp_db; if (!skin_param_manager) - skin_param_manager = new SkinParamManager[ROB_CHARA_COUNT]; + skin_param_manager = new SkinParamManager[ROB_ID_MAX]; skin_param_storage = {}; } @@ -283,7 +283,7 @@ void skin_param_data_free() { bool skin_param_manager_array_check_task_ready() { bool ret = false; - for (int32_t i = 0; i < ROB_CHARA_COUNT; i++) + for (int32_t i = 0; i < ROB_ID_MAX; i++) ret |= app::TaskWork::check_task_ready(&skin_param_manager[i]); return ret; } @@ -483,8 +483,7 @@ void skin_param_osage_root_parse(void* kv, const char* name, break; } - c->node_idx[0] = bone_data->get_skeleton_object_bone_index( - bone_database_skeleton_type_to_string(BONE_DATABASE_SKELETON_COMMON), bone0_name); + c->node_idx[0] = bone_data->get_bone_index(BONE_KIND_CMN, bone0_name); vec3 bone0_pos = 0.0f; if (!_kv->read("bone.0.posx", bone0_pos.x) @@ -498,8 +497,7 @@ void skin_param_osage_root_parse(void* kv, const char* name, const char* bone1_name; if (_kv->read("bone.1.name", bone1_name)) { - c->node_idx[1] = bone_data->get_skeleton_object_bone_index( - bone_database_skeleton_type_to_string(BONE_DATABASE_SKELETON_COMMON), bone1_name); + c->node_idx[1] = bone_data->get_bone_index(BONE_KIND_CMN, bone1_name); vec3 bone1_pos = 0.0f; if (!_kv->read("bone.1.posx", bone1_pos.x) @@ -620,8 +618,8 @@ void osage_setting::clear() { } const osage_setting_osg_cat* osage_setting::get_cat_value( - object_info* obj_info, const char* root_node) { - auto elem_obj = osage_setting_data->obj.find(*obj_info); + const object_info& obj_info, const char* root_node) { + auto elem_obj = osage_setting_data->obj.find(obj_info); if (elem_obj == osage_setting_data->obj.end()) return 0; @@ -717,7 +715,7 @@ rob_osage_parts osage_setting::parse_parts_string(std::string& s) { return ROB_OSAGE_PARTS_NONE; } -skin_param_file::skin_param_file() : file_handler(), id(), type(), data(), rob_chr() { +skin_param_file::skin_param_file() : file_handler(), rpk(), type(), data(), rob_chr() { } @@ -783,9 +781,9 @@ void SkinParamManager::AddFiles() { files.clear(); for (osage_init_data& i : osage_init) { - rob_chara_item_equip* rob_itm_equip = i.rob_chr->item_equip; - for (int32_t j = ITEM_KAMI; j < ITEM_MAX; j++) { - object_info obj_info = rob_itm_equip->get_object_info((item_id)j); + rob_chara_item_equip* rob_disp = i.rob_chr->rob_disp; + for (int32_t j = RPK_ITEM_BEGIN; j <= RPK_ITEM_END; j++) { + object_info obj_info = rob_disp->get_object_info((ROB_PARTS_KIND)j); if (obj_info.is_null()) continue; @@ -826,7 +824,7 @@ void SkinParamManager::AddFiles() { if (!skp_file) continue; - skp_file->id = (item_id)j; + skp_file->rpk = (ROB_PARTS_KIND)j; skp_file->rob_chr = i.rob_chr; skp_file->type = -1; @@ -919,26 +917,26 @@ bool SkinParamManager::CtrlFiles() { skin_param_file* skp_file = *i; if (skp_file->file_handler->check_not_ready()) break; - else if (skp_file->id <= ITEM_NONE || skp_file->id >= ITEM_MAX) { + else if (skp_file->rpk < 0 || skp_file->rpk >= RPK_MAX) { i = files.erase(i); continue; } - rob_chara_item_equip* rob_itm_equip = skp_file->rob_chr->item_equip; + rob_chara_item_equip* rob_disp = skp_file->rob_chr->rob_disp; key_val kv; kv.parse(skp_file->file_handler->get_data(), skp_file->file_handler->get_size()); - object_info obj_info = rob_itm_equip->get_object_info(skp_file->id); + object_info obj_info = rob_disp->get_object_info(skp_file->rpk); if (!obj_info.not_null()) { i = files.erase(i); continue; } - rob_chara_item_equip_object* itm_eq_obj = &rob_itm_equip->item_equip_object[skp_file->id]; + rob_chara_item_equip_object* skin_disp = &rob_disp->skin_disp[skp_file->rpk]; skin_param_file_data* skp_file_data = skp_file->data->data(); - for (ExNodeBlock* j : itm_eq_obj->ex_node_block) { + for (ExNodeBlock* j : skin_disp->ex_node_block) { if (j->type != EX_NODE_TYPE_OSAGE && j->type != EX_NODE_TYPE_CLOTH) continue; @@ -950,7 +948,7 @@ bool SkinParamManager::CtrlFiles() { std::vector vec; skin_param_osage_node_parse(&kv, name, &vec, root); skp_file_data->nodes_data.resize(vec.size()); - rob_itm_equip->skp_load(skp_file->id, root, vec, skp_file_data, aft_bone_data); + rob_disp->skp_load(skp_file->rpk, root, vec, skp_file_data, aft_bone_data); skp_file_data++; } delete skp_file; diff --git a/src/CRE/rob/skin_param.hpp b/src/CRE/rob/skin_param.hpp index dde51010..28fec877 100644 --- a/src/CRE/rob/skin_param.hpp +++ b/src/CRE/rob/skin_param.hpp @@ -9,7 +9,7 @@ #include "../../KKdLib/key_val.hpp" extern const osage_setting_osg_cat* osage_setting_data_get_cat_value( - object_info* obj_info, const char* root_node); + const object_info& obj_info, const char* root_node); extern bool osage_setting_data_obj_has_key(object_info key); extern void skin_param_data_init(); diff --git a/src/CRE/shadow.hpp b/src/CRE/shadow.hpp index 93be467c..1ebd2d3d 100644 --- a/src/CRE/shadow.hpp +++ b/src/CRE/shadow.hpp @@ -12,10 +12,10 @@ #include "static_var.hpp" #include -enum shadow_type_enum { - SHADOW_CHARA = 0, - SHADOW_STAGE, - SHADOW_MAX, +enum SHADOW_GROUP { + SHADOW_GROUP_CHARA = 0, + SHADOW_GROUP_STAGE, + SHADOW_GROUP_MAX, }; struct Shadow { diff --git a/src/CRE/sss.cpp b/src/CRE/sss.cpp index c14f4aa5..d1f10992 100644 --- a/src/CRE/sss.cpp +++ b/src/CRE/sss.cpp @@ -131,7 +131,7 @@ void sss_data::pre_proc(const struct cam_data& cam) { chara_distance[i] = 999999.0f; rob_chara_bone_data* rob_bone_data = rob_chara_array_get_bone_data(i); if (rob_chara_pv_data_array_check_chara_id(i) && rob_chara_array_check_visibility(i)) { - mat4* mat = rob_bone_data->get_mats_mat(MOTION_BONE_N_HARA_CP); + mat4* mat = rob_bone_data->get_mats_mat(BLK_N_HARA_CP); if (mat) { mat4_get_translation(mat, &chara_position[i]); if (reflect_draw) diff --git a/src/CRE/stage.cpp b/src/CRE/stage.cpp index eca96a26..ffb321ad 100644 --- a/src/CRE/stage.cpp +++ b/src/CRE/stage.cpp @@ -620,9 +620,9 @@ static void stage_disp_shadow(stage* s) { static void stage_disp_shadow_object(object_info object, const mat4& mat) { mdl::DispManager& disp_manager = *rctx_ptr->disp_manager; - for (int32_t i = SHADOW_CHARA; i < SHADOW_MAX; i++) { - disp_manager.set_shadow_type((shadow_type_enum)i); - disp_manager.set_culling_func(i == SHADOW_CHARA + for (int32_t i = SHADOW_GROUP_CHARA; i < SHADOW_GROUP_MAX; i++) { + disp_manager.set_shadow_group((SHADOW_GROUP)i); + disp_manager.set_culling_func(i == SHADOW_GROUP_CHARA ? object_bounding_sphere_check_visibility_shadow_chara : object_bounding_sphere_check_visibility_shadow_stage); disp_manager.set_obj_flags((mdl::ObjFlags)(mdl::OBJ_NO_TRANSLUCENCY | mdl::OBJ_SHADOW_OBJECT)); @@ -631,7 +631,7 @@ static void stage_disp_shadow_object(object_info object, const mat4& mat) { disp_manager.set_obj_flags(); disp_manager.set_culling_func(); - disp_manager.set_shadow_type(); + disp_manager.set_shadow_group(); } static void stage_free(stage* s) { @@ -802,7 +802,7 @@ static void stage_set(stage* s, stage* other) { effect_manager_set_frame(0); if (!pv_osage_manager_array_get_disp() && other) - for (int32_t i = 0; i < ROB_CHARA_COUNT; i++) { + for (int32_t i = 0; i < ROB_ID_MAX; i++) { rob_chara* rob_chr = rob_chara_array_get(i); if (rob_chr) rob_chr->set_stage_data_ring(other->index); diff --git a/src/CRE/stage_modern.cpp b/src/CRE/stage_modern.cpp index 62c6cbd8..0b4f87ba 100644 --- a/src/CRE/stage_modern.cpp +++ b/src/CRE/stage_modern.cpp @@ -538,9 +538,9 @@ static void stage_modern_disp_shadow(stage_modern* s) { static void stage_modern_disp_shadow_object(object_info object, const mat4& mat) { mdl::DispManager& disp_manager = *rctx_ptr->disp_manager; - for (int32_t i = SHADOW_CHARA; i < SHADOW_MAX; i++) { - disp_manager.set_shadow_type((shadow_type_enum)i); - disp_manager.set_culling_func(i == SHADOW_CHARA + for (int32_t i = SHADOW_GROUP_CHARA; i < SHADOW_GROUP_MAX; i++) { + disp_manager.set_shadow_group((SHADOW_GROUP)i); + disp_manager.set_culling_func(i == SHADOW_GROUP_CHARA ? object_bounding_sphere_check_visibility_shadow_chara : object_bounding_sphere_check_visibility_shadow_stage); disp_manager.set_obj_flags((mdl::ObjFlags)(mdl::OBJ_NO_TRANSLUCENCY | mdl::OBJ_SHADOW_OBJECT)); @@ -549,7 +549,7 @@ static void stage_modern_disp_shadow_object(object_info object, const mat4& mat) disp_manager.set_obj_flags(); disp_manager.set_culling_func(); - disp_manager.set_shadow_type(); + disp_manager.set_shadow_group(); } static void stage_modern_free(stage_modern* s) { @@ -685,7 +685,7 @@ static void stage_modern_set(stage_modern* s, stage_modern* other) { //sub_140344180(0); if (pv_osage_manager_array_get_disp() && other) - for (int32_t i = 0; i < ROB_CHARA_COUNT; i++) { + for (int32_t i = 0; i < ROB_ID_MAX; i++) { rob_chara* rob_chr = rob_chara_array_get(i); //if (rob_chr) //rob_chara_set_stage_data_ring(rob_chr, &other->index); diff --git a/src/KKdLib/database/bone.cpp b/src/KKdLib/database/bone.cpp index e6b166ba..3ab96c1d 100644 --- a/src/KKdLib/database/bone.cpp +++ b/src/KKdLib/database/bone.cpp @@ -14,11 +14,11 @@ struct bone_database_skeleton_header { int64_t offset; int64_t bones_offset; - int64_t positions_offset; - int64_t unknown_value_offset; - int64_t object_bone_names_offset; - int64_t motion_bone_names_offset; - int64_t parent_indices_offset; + int64_t chain_pos_rad_offset; + int64_t heel_height_offset; + int64_t bone_name_offset; + int64_t bone_node_offset; + int64_t parent_node_offset; }; static void bone_database_classic_read_inner(bone_database* bone_data, stream& s); @@ -29,20 +29,20 @@ static int64_t bone_database_strings_get_string_offset(std::vector& std::vector& vec_off, const char* str); static bool bone_database_strings_push_back_check(std::vector& vec, const char* str); -bone_database_bone::bone_database_bone() : type(), -has_parent(), parent(), pole_target(), mirror(), flags() { +BODYTYPE::BODYTYPE() : ik_type(), inherit_type(), +inherit_mat_id(), up_vector_id(), flip_block_id(), expression_id() { } -bone_database_bone::~bone_database_bone() { +BODYTYPE::~BODYTYPE() { } -bone_database_skeleton::bone_database_skeleton() : heel_height() { +BoneData::BoneData() : heel_height() { } -bone_database_skeleton::~bone_database_skeleton() { +BoneData::~BoneData() { } @@ -230,153 +230,153 @@ void bone_database::write(void** data, size_t* size) { } void bone_database::clear() { - skeleton.clear(); - skeleton.shrink_to_fit(); - skeleton_names.clear(); - skeleton_names.shrink_to_fit(); + bonedata.clear(); + bonedata.shrink_to_fit(); + bonedata_map.clear(); + bonedata_map.shrink_to_fit(); } void bone_database::update() { - skeleton_names.clear(); + bonedata_map.clear(); - skeleton_names.reserve(skeleton.size()); + bonedata_map.reserve(bonedata.size()); - for (bone_database_skeleton& i : skeleton) { - skeleton_names.push_back(hash_string_murmurhash(i.name), &i); + for (BoneData& i : bonedata) { + bonedata_map.push_back(hash_string_murmurhash(i.name), &i); - i.bone_names.clear(); - i.object_bone_names.clear(); - i.motion_bone_names.clear(); + i.body_type_map.clear(); + i.bone_name_map.clear(); + i.bone_node_name_map.clear(); - i.bone_names.reserve(i.bone.size()); - i.object_bone_names.reserve(i.object_bone.size()); - i.motion_bone_names.reserve(i.motion_bone.size()); + i.body_type_map.reserve(i.body_type.size()); + i.bone_name_map.reserve(i.bone_name.size()); + i.bone_node_name_map.reserve(i.bone_node_name.size()); - for (bone_database_bone& j : i.bone) - i.bone_names.push_back(hash_string_murmurhash(j.name), &j); + for (BODYTYPE& j : i.body_type) + i.body_type_map.push_back(hash_string_murmurhash(j.name), &j); - for (std::string& j : i.object_bone) - i.object_bone_names.push_back(hash_string_murmurhash(j), &j); + for (std::string& j : i.bone_name) + i.bone_name_map.push_back(hash_string_murmurhash(j), &j); - for (std::string& j : i.motion_bone) - i.motion_bone_names.push_back(hash_string_murmurhash(j), &j); + for (std::string& j : i.bone_node_name) + i.bone_node_name_map.push_back(hash_string_murmurhash(j), &j); - i.bone_names.sort_unique(); - i.object_bone_names.sort_unique(); - i.motion_bone_names.sort_unique(); + i.body_type_map.sort_unique(); + i.bone_name_map.sort_unique(); + i.bone_node_name_map.sort_unique(); } - skeleton_names.sort_unique(); + bonedata_map.sort_unique(); } -const bone_database_skeleton* bone_database::get_skeleton(const char* name) const { - if (!name) +const BoneData* bone_database::get_bone_data(const char* kind_name) const { + if (!kind_name) return 0; - auto elem = skeleton_names.find(hash_utf8_murmurhash(name)); - if (elem != skeleton_names.end()) + auto elem = bonedata_map.find(hash_utf8_murmurhash(kind_name)); + if (elem != bonedata_map.end()) return elem->second; return 0; } -int32_t bone_database::get_skeleton_bone_index(const char* name, const char* bone_name) const { - if (!name || !bone_name) +int32_t bone_database::get_block_index(const char* kind_name, const char* name) const { + if (!kind_name || !name) return -1; - auto elem = skeleton_names.find(hash_utf8_murmurhash(name)); - if (elem != skeleton_names.end()) { - const bone_database_skeleton* skel = elem->second; - auto elem = skel->bone_names.find(hash_utf8_murmurhash(bone_name)); - if (elem != skel->bone_names.end()) - return (int32_t)(elem->second - skel->bone.data()); + auto elem = bonedata_map.find(hash_utf8_murmurhash(kind_name)); + if (elem != bonedata_map.end()) { + const BoneData* skel = elem->second; + auto elem = skel->body_type_map.find(hash_utf8_murmurhash(name)); + if (elem != skel->body_type_map.end()) + return (int32_t)(elem->second - skel->body_type.data()); } return -1; } -const std::vector* bone_database::get_skeleton_bones(const char* name) const { - if (!name) +const std::vector* bone_database::get_body_type(const char* kind_name) const { + if (!kind_name) return 0; - auto elem = skeleton_names.find(hash_utf8_murmurhash(name)); - if (elem != skeleton_names.end()) - return &elem->second->bone; + auto elem = bonedata_map.find(hash_utf8_murmurhash(kind_name)); + if (elem != bonedata_map.end()) + return &elem->second->body_type; return 0; } -const std::vector* bone_database::get_skeleton_positions(const char* name) const { - if (!name) +const std::vector* bone_database::get_chain_pos_rad(const char* kind_name) const { + if (!kind_name) return 0; - auto elem = skeleton_names.find(hash_utf8_murmurhash(name)); - if (elem != skeleton_names.end()) - return &elem->second->position; + auto elem = bonedata_map.find(hash_utf8_murmurhash(kind_name)); + if (elem != bonedata_map.end()) + return &elem->second->chain_pos_rad; return 0; } -int32_t bone_database::get_skeleton_object_bone_index(const char* name, const char* bone_name) const { - if (!name || !bone_name) +int32_t bone_database::get_bone_index(const char* kind_name, const char* name) const { + if (!kind_name || !name) return -1; - auto elem = skeleton_names.find(hash_utf8_murmurhash(name)); - if (elem != skeleton_names.end()) { - const bone_database_skeleton* skel = elem->second; - auto elem = skel->object_bone_names.find(hash_utf8_murmurhash(bone_name)); - if (elem != skel->object_bone_names.end()) - return (int32_t)(elem->second - skel->object_bone.data()); + auto elem = bonedata_map.find(hash_utf8_murmurhash(kind_name)); + if (elem != bonedata_map.end()) { + const BoneData* skel = elem->second; + auto elem = skel->bone_name_map.find(hash_utf8_murmurhash(name)); + if (elem != skel->bone_name_map.end()) + return (int32_t)(elem->second - skel->bone_name.data()); } return -1; } -const std::vector* bone_database::get_skeleton_object_bones(const char* name) const { - if (!name) +const std::vector* bone_database::get_bone_name(const char* kind_name) const { + if (!kind_name) return 0; - auto elem = skeleton_names.find(hash_utf8_murmurhash(name)); - if (elem != skeleton_names.end()) - return &elem->second->object_bone; + auto elem = bonedata_map.find(hash_utf8_murmurhash(kind_name)); + if (elem != bonedata_map.end()) + return &elem->second->bone_name; return 0; } -int32_t bone_database::get_skeleton_motion_bone_index(const char* name, const char* bone_name) const { - if (!name || !bone_name) +int32_t bone_database::get_bone_node_index(const char* kind_name, const char* name) const { + if (!kind_name || !name) return -1; - auto elem = skeleton_names.find(hash_utf8_murmurhash(name)); - if (elem != skeleton_names.end()) { - const bone_database_skeleton* skel = elem->second; - auto elem = skel->motion_bone_names.find(hash_utf8_murmurhash(bone_name)); - if (elem != skel->motion_bone_names.end()) - return (int32_t)(elem->second - skel->motion_bone.data()); + auto elem = bonedata_map.find(hash_utf8_murmurhash(kind_name)); + if (elem != bonedata_map.end()) { + const BoneData* skel = elem->second; + auto elem = skel->bone_node_name_map.find(hash_utf8_murmurhash(name)); + if (elem != skel->bone_node_name_map.end()) + return (int32_t)(elem->second - skel->bone_node_name.data()); } return -1; } -const std::vector* bone_database::get_skeleton_motion_bones(const char* name) const { - if (!name) +const std::vector* bone_database::get_bone_node_name(const char* kind_name) const { + if (!kind_name) return 0; - auto elem = skeleton_names.find(hash_utf8_murmurhash(name)); - if (elem != skeleton_names.end()) - return &elem->second->motion_bone; + auto elem = bonedata_map.find(hash_utf8_murmurhash(kind_name)); + if (elem != bonedata_map.end()) + return &elem->second->bone_node_name; return 0; } -const std::vector* bone_database::get_skeleton_parent_indices(const char* name) const { - if (!name) +const std::vector* bone_database::get_parent_node(const char* kind_name) const { + if (!kind_name) return 0; - auto elem = skeleton_names.find(hash_utf8_murmurhash(name)); - if (elem != skeleton_names.end()) - return &elem->second->parent_index; + auto elem = bonedata_map.find(hash_utf8_murmurhash(kind_name)); + if (elem != bonedata_map.end()) + return &elem->second->parent_node; return 0; } -const float_t* bone_database::get_skeleton_heel_height(const char* name) const { - if (!name) +const float_t* bone_database::get_heel_height(const char* kind_name) const { + if (!kind_name) return 0; - auto elem = skeleton_names.find(hash_utf8_murmurhash(name)); - if (elem != skeleton_names.end()) + auto elem = bonedata_map.find(hash_utf8_murmurhash(kind_name)); + if (elem != bonedata_map.end()) return &elem->second->heel_height; return 0; } @@ -397,61 +397,61 @@ bool bone_database::load_file(void* data, const char* dir, const char* file, uin return bone_data->ready; } -void bone_database_bones_calculate_count(const std::vector* bones, - size_t& object_bone_count, size_t& motion_bone_count, +void bone_database_bones_calculate_count(const std::vector* bones, + size_t& bone_name_num, size_t& bone_node_num, size_t& node_count, size_t& leaf_pos, size_t& chain_pos) { - object_bone_count = 0; - motion_bone_count = 0; + bone_name_num = 0; + bone_node_num = 0; node_count = 0; leaf_pos = 0; chain_pos = 0; - for (const bone_database_bone& i : *bones) { - object_bone_count++; + for (const BODYTYPE& i : *bones) { + bone_name_num++; node_count++; - if (i.type >= BONE_DATABASE_BONE_ARM_IK_ROTATION) - object_bone_count += 2; + if (i.ik_type >= IKT_2) + bone_name_num += 2; chain_pos++; - if (i.type >= BONE_DATABASE_BONE_HEAD_IK_ROTATION) { + if (i.ik_type >= IKT_1) { chain_pos++; node_count += 2; - if (i.type >= BONE_DATABASE_BONE_ARM_IK_ROTATION) { + if (i.ik_type >= IKT_2) { chain_pos++; node_count++; } } - if (i.type >= BONE_DATABASE_BONE_POSITION_ROTATION) + if (i.ik_type >= IKT_ROOT) leaf_pos++; - motion_bone_count++; + bone_node_num++; } } -const char* bone_database_skeleton_type_to_string(bone_database_skeleton_type type) { - switch (type) { - case BONE_DATABASE_SKELETON_COMMON: +const char* bone_database_skeleton_type_to_string(BONE_KIND kind) { + switch (kind) { + case BONE_KIND_CMN: return "CMN"; - case BONE_DATABASE_SKELETON_MIKU: + case BONE_KIND_MIK: return "MIK"; - case BONE_DATABASE_SKELETON_KAITO: + case BONE_KIND_KAI: return "KAI"; - case BONE_DATABASE_SKELETON_LEN: + case BONE_KIND_LEN: return "LEN"; - case BONE_DATABASE_SKELETON_LUKA: + case BONE_KIND_LUK: return "LUK"; - case BONE_DATABASE_SKELETON_MEIKO: + case BONE_KIND_MEI: return "MEI"; - case BONE_DATABASE_SKELETON_RIN: + case BONE_KIND_RIN: return "RIN"; - case BONE_DATABASE_SKELETON_HAKU: + case BONE_KIND_HAK: return "HAK"; - case BONE_DATABASE_SKELETON_NERU: + case BONE_KIND_NER: return "NER"; - case BONE_DATABASE_SKELETON_SAKINE: + case BONE_KIND_SAK: return "SAK"; - case BONE_DATABASE_SKELETON_TETO: + case BONE_KIND_TET: return "TET"; default: return 0; @@ -468,93 +468,93 @@ static void bone_database_classic_read_inner(bone_database* bone_data, stream& s uint32_t skeleton_name_offsets_offset = s.read_uint32_t(); s.read(0x14); - bone_data->skeleton.resize(skeleton_count); + bone_data->bonedata.resize(skeleton_count); s.position_push(skeleton_offsets_offset, SEEK_SET); for (uint32_t i = 0; i < skeleton_count; i++) { - bone_database_skeleton* skel = &bone_data->skeleton[i]; + BoneData* skel = &bone_data->bonedata[i]; uint32_t skeleton_offset = s.read_uint32_t(); s.position_push(skeleton_offset, SEEK_SET); uint32_t bones_offset = s.read_uint32_t(); - uint32_t position_count = s.read_uint32_t(); - uint32_t positions_offset = s.read_uint32_t(); - uint32_t unknown_value_offset = s.read_uint32_t(); - uint32_t object_bone_count = s.read_uint32_t(); - uint32_t object_bone_names_offset = s.read_uint32_t(); - uint32_t motion_bone_count = s.read_uint32_t(); - uint32_t motion_bone_names_offset = s.read_uint32_t(); - uint32_t parent_indices_offset = s.read_uint32_t(); + uint32_t chain_pos_rad_num = s.read_uint32_t(); + uint32_t chain_pos_rad_offset = s.read_uint32_t(); + uint32_t heel_height_offset = s.read_uint32_t(); + uint32_t bone_name_num = s.read_uint32_t(); + uint32_t bone_name_offset = s.read_uint32_t(); + uint32_t bone_node_num = s.read_uint32_t(); + uint32_t bone_node_offset = s.read_uint32_t(); + uint32_t parent_node_offset = s.read_uint32_t(); s.read(0x14); - uint32_t bone_count = 0; + uint32_t body_type_num = 0; s.position_push(bones_offset, SEEK_SET); while (true) { if (s.read_uint8_t() == 0xFF) break; s.read(0x0B); - bone_count++; + body_type_num++; } s.position_pop(); - skel->bone.resize(bone_count); + skel->body_type.resize(body_type_num); - bone_database_bone* _bone = skel->bone.data(); + BODYTYPE* body_type = skel->body_type.data(); s.position_push(bones_offset, SEEK_SET); - for (uint32_t j = 0; j < bone_count; j++) { - bone_database_bone* bone = &_bone[j]; - bone->type = (bone_database_bone_type)s.read_uint8_t(); - bone->has_parent = s.read_uint8_t() ? true : false; - bone->parent = s.read_uint8_t(); - bone->pole_target = s.read_uint8_t(); - bone->mirror = s.read_uint8_t(); - bone->flags = s.read_uint8_t(); + for (uint32_t j = 0; j < body_type_num; j++) { + BODYTYPE* bone = &body_type[j]; + bone->ik_type = (IK_TYPE)s.read_uint8_t(); + bone->inherit_type = (IH_TYPE)s.read_uint8_t(); + bone->inherit_mat_id = s.read_uint8_t(); + bone->up_vector_id = s.read_uint8_t(); + bone->flip_block_id = s.read_uint8_t(); + bone->expression_id = s.read_uint8_t(); s.read(0x02); bone->name = s.read_string_null_terminated_offset(s.read_uint32_t()); } s.position_pop(); - skel->position.resize(position_count); + skel->chain_pos_rad.resize(chain_pos_rad_num); - vec3* _position = skel->position.data(); + CHAINPOSRADIUS* chain_pos_rad = skel->chain_pos_rad.data(); - s.position_push(positions_offset, SEEK_SET); - for (uint32_t j = 0; j < position_count; j++) { - vec3* position = &_position[j]; - position->x = s.read_float_t(); - position->y = s.read_float_t(); - position->z = s.read_float_t(); + s.position_push(chain_pos_rad_offset, SEEK_SET); + for (uint32_t j = 0; j < chain_pos_rad_num; j++) { + vec3& chain_pos = chain_pos_rad[j].chain_pos; + chain_pos.x = s.read_float_t(); + chain_pos.y = s.read_float_t(); + chain_pos.z = s.read_float_t(); } s.position_pop(); - s.position_push(unknown_value_offset, SEEK_SET); + s.position_push(heel_height_offset, SEEK_SET); skel->heel_height = s.read_float_t(); s.position_pop(); - skel->object_bone.resize(object_bone_count); + skel->bone_name.resize(bone_name_num); - std::string* object_bone = skel->object_bone.data(); + std::string* bone_name = skel->bone_name.data(); - s.position_push(object_bone_names_offset, SEEK_SET); - for (uint32_t j = 0; j < object_bone_count; j++) - object_bone[j] = s.read_string_null_terminated_offset(s.read_uint32_t()); + s.position_push(bone_name_offset, SEEK_SET); + for (uint32_t j = 0; j < bone_name_num; j++) + bone_name[j] = s.read_string_null_terminated_offset(s.read_uint32_t()); s.position_pop(); - skel->motion_bone.resize(motion_bone_count); + skel->bone_node_name.resize(bone_node_num); - std::string* motion_bone = skel->motion_bone.data(); + std::string* bone_node_name = skel->bone_node_name.data(); - s.position_push(motion_bone_names_offset, SEEK_SET); - for (uint32_t j = 0; j < motion_bone_count; j++) - motion_bone[j] = s.read_string_null_terminated_offset(s.read_uint32_t()); + s.position_push(bone_node_offset, SEEK_SET); + for (uint32_t j = 0; j < bone_node_num; j++) + bone_node_name[j] = s.read_string_null_terminated_offset(s.read_uint32_t()); s.position_pop(); - skel->parent_index.resize(motion_bone_count); + skel->parent_node.resize(bone_node_num); - s.position_push(parent_indices_offset, SEEK_SET); - s.read(skel->parent_index.data(), motion_bone_count * sizeof(uint16_t)); + s.position_push(parent_node_offset, SEEK_SET); + s.read(skel->parent_node.data(), bone_node_num * sizeof(uint16_t)); s.position_pop(); s.position_pop(); } @@ -562,7 +562,7 @@ static void bone_database_classic_read_inner(bone_database* bone_data, stream& s s.position_push(skeleton_name_offsets_offset, SEEK_SET); for (uint32_t i = 0; i < skeleton_count; i++) - bone_data->skeleton[i].name = s.read_string_null_terminated_offset(s.read_uint32_t()); + bone_data->bonedata[i].name = s.read_string_null_terminated_offset(s.read_uint32_t()); s.position_pop(); bone_data->ready = true; @@ -584,16 +584,16 @@ static void bone_database_classic_write_inner(bone_database* bone_data, stream& s.write_int32_t(0); s.write_int32_t(0); - uint32_t skeleton_count = (uint32_t)bone_data->skeleton.size(); + uint32_t skeleton_count = (uint32_t)bone_data->bonedata.size(); int64_t skeleton_offsets_offset = s.get_position(); s.write(skeleton_count * 0x04ULL); int64_t skeleton_name_offset = s.get_position(); - for (bone_database_skeleton& i : bone_data->skeleton) + for (BoneData& i : bone_data->bonedata) s.write_string_null_terminated(i.name); int64_t skeleton_name_offsets_offset = s.get_position(); - for (bone_database_skeleton& i : bone_data->skeleton) { + for (BoneData& i : bone_data->bonedata) { s.write_uint32_t((uint32_t)skeleton_name_offset); skeleton_name_offset += i.name.size() + 1; } @@ -604,17 +604,17 @@ static void bone_database_classic_write_inner(bone_database* bone_data, stream& int64_t* skeleton_offsets = force_malloc(skeleton_count); for (uint32_t i = 0; i < skeleton_count; i++) { - bone_database_skeleton* skel = &bone_data->skeleton[i]; + BoneData* skel = &bone_data->bonedata[i]; - uint32_t bone_count = (uint32_t)skel->bone.size(); - uint32_t position_count = (uint32_t)skel->position.size(); - uint32_t object_bone_count = (uint32_t)skel->object_bone.size(); - uint32_t motion_bone_count = (uint32_t)skel->motion_bone.size(); + uint32_t body_type_num = (uint32_t)skel->body_type.size(); + uint32_t chain_pos_rad_num = (uint32_t)skel->chain_pos_rad.size(); + uint32_t bone_name_num = (uint32_t)skel->bone_name.size(); + uint32_t bone_node_num = (uint32_t)skel->bone_node_name.size(); - strings.reserve(bone_count); - string_offsets.reserve(bone_count); + strings.reserve(body_type_num); + string_offsets.reserve(body_type_num); - for (bone_database_bone& j : skel->bone) + for (BODYTYPE& j : skel->body_type) if (bone_database_strings_push_back_check(strings, j.name.c_str())) { string_offsets.push_back(s.get_position()); s.write_string_null_terminated(j.name); @@ -627,13 +627,13 @@ static void bone_database_classic_write_inner(bone_database* bone_data, stream& s.align_write(0x04); int64_t bones_offset = s.get_position(); - for (bone_database_bone& j : skel->bone) { - s.write_uint8_t((uint8_t)j.type); - s.write_uint8_t(j.has_parent ? 1 : 0); - s.write_uint8_t(j.parent); - s.write_uint8_t(j.pole_target); - s.write_uint8_t(j.mirror); - s.write_uint8_t(j.flags); + for (BODYTYPE& j : skel->body_type) { + s.write_uint8_t((uint8_t)j.ik_type); + s.write_uint8_t((uint8_t)j.inherit_type); + s.write_uint8_t((uint8_t)j.inherit_mat_id); + s.write_uint8_t((uint8_t)j.up_vector_id); + s.write_uint8_t((uint8_t)j.flip_block_id); + s.write_uint8_t(j.expression_id); s.write(0x02); s.write_uint32_t((uint32_t)bone_database_strings_get_string_offset(strings, string_offsets, j.name.c_str())); @@ -644,50 +644,50 @@ static void bone_database_classic_write_inner(bone_database* bone_data, stream& s.write_uint32_t((uint32_t)bone_database_strings_get_string_offset(strings, string_offsets, "End")); - int64_t positions_offset = s.get_position(); - s.write(skel->position.data(), sizeof(vec3) * position_count); + int64_t chain_pos_rad_offset = s.get_position(); + s.write(skel->chain_pos_rad.data(), sizeof(vec3) * chain_pos_rad_num); - int64_t unknown_value_offset = s.get_position(); + int64_t heel_height_offset = s.get_position(); s.write_float_t(skel->heel_height); - for (std::string& j : skel->object_bone) + for (std::string& j : skel->bone_name) if (bone_database_strings_push_back_check(strings, j.c_str())) { string_offsets.push_back(s.get_position()); s.write_string_null_terminated(j); } s.align_write(0x04); - int64_t object_bone_names_offset = s.get_position(); - for (std::string& j : skel->object_bone) + int64_t bone_name_offset = s.get_position(); + for (std::string& j : skel->bone_name) s.write_uint32_t((uint32_t)bone_database_strings_get_string_offset(strings, string_offsets, j.c_str())); - for (std::string& j : skel->motion_bone) + for (std::string& j : skel->bone_node_name) if (bone_database_strings_push_back_check(strings, j.c_str())) { string_offsets.push_back(s.get_position()); s.write_string_null_terminated(j); } s.align_write(0x04); - int64_t motion_bone_names_offset = s.get_position(); - for (std::string& j : skel->motion_bone) + int64_t bone_node_offset = s.get_position(); + for (std::string& j : skel->bone_node_name) s.write_uint32_t((uint32_t)bone_database_strings_get_string_offset(strings, string_offsets, j.c_str())); - int64_t parent_indices_offset = s.get_position(); - s.write(skel->parent_index.data(), sizeof(uint16_t) * motion_bone_count); + int64_t parent_node_offset = s.get_position(); + s.write(skel->parent_node.data(), sizeof(uint16_t) * bone_node_num); s.align_write(0x04); - skeleton_offsets[skel - bone_data->skeleton.data()] = s.get_position(); + skeleton_offsets[skel - bone_data->bonedata.data()] = s.get_position(); s.write_uint32_t((uint32_t)bones_offset); - s.write_uint32_t(position_count); - s.write_uint32_t((uint32_t)positions_offset); - s.write_uint32_t((uint32_t)unknown_value_offset); - s.write_uint32_t(object_bone_count); - s.write_uint32_t((uint32_t)object_bone_names_offset); - s.write_uint32_t(motion_bone_count); - s.write_uint32_t((uint32_t)motion_bone_names_offset); - s.write_uint32_t((uint32_t)parent_indices_offset); + s.write_uint32_t(chain_pos_rad_num); + s.write_uint32_t((uint32_t)chain_pos_rad_offset); + s.write_uint32_t((uint32_t)heel_height_offset); + s.write_uint32_t(bone_name_num); + s.write_uint32_t((uint32_t)bone_name_offset); + s.write_uint32_t(bone_node_num); + s.write_uint32_t((uint32_t)bone_node_offset); + s.write_uint32_t((uint32_t)parent_node_offset); s.write(0x14); strings.clear(); @@ -726,49 +726,49 @@ static void bone_database_modern_read_inner(bone_database* bone_data, stream& s, int64_t skeleton_offsets_offset = s.read_offset(header_length, is_x); int64_t skeleton_name_offsets_offset = s.read_offset(header_length, is_x); - bone_data->skeleton.resize(skeleton_count); + bone_data->bonedata.resize(skeleton_count); s.position_push(skeleton_offsets_offset, SEEK_SET); for (uint32_t i = 0; i < skeleton_count; i++) { - bone_database_skeleton* skel = &bone_data->skeleton[i]; + BoneData* skel = &bone_data->bonedata[i]; int64_t skeleton_offset = s.read_offset(header_length, is_x); s.position_push(skeleton_offset, SEEK_SET); int64_t bones_offset; - uint32_t position_count; - int64_t positions_offset; - int64_t unknown_value_offset; - uint32_t object_bone_count; - int64_t object_bone_names_offset; - uint32_t motion_bone_count; - int64_t motion_bone_names_offset; - int64_t parent_indices_offset; + uint32_t chain_pos_rad_num; + int64_t chain_pos_rad_offset; + int64_t heel_height_offset; + uint32_t bone_name_num; + int64_t bone_name_offset; + uint32_t bone_node_num; + int64_t bone_node_offset; + int64_t parent_node_offset; if (!is_x) { bones_offset = s.read_offset_f2(header_length); - position_count = s.read_uint32_t_reverse_endianness(); - positions_offset = s.read_offset_f2(header_length); - unknown_value_offset = s.read_offset_f2(header_length); - object_bone_count = s.read_uint32_t_reverse_endianness(); - object_bone_names_offset = s.read_offset_f2(header_length); - motion_bone_count = s.read_uint32_t_reverse_endianness(); - motion_bone_names_offset = s.read_offset_f2(header_length); - parent_indices_offset = s.read_offset_f2(header_length); + chain_pos_rad_num = s.read_uint32_t_reverse_endianness(); + chain_pos_rad_offset = s.read_offset_f2(header_length); + heel_height_offset = s.read_offset_f2(header_length); + bone_name_num = s.read_uint32_t_reverse_endianness(); + bone_name_offset = s.read_offset_f2(header_length); + bone_node_num = s.read_uint32_t_reverse_endianness(); + bone_node_offset = s.read_offset_f2(header_length); + parent_node_offset = s.read_offset_f2(header_length); s.read(0x14); } else { bones_offset = s.read_offset_x(); - position_count = s.read_uint32_t_reverse_endianness(); - positions_offset = s.read_offset_x(); - unknown_value_offset = s.read_offset_x(); - object_bone_count = s.read_uint32_t_reverse_endianness(); - object_bone_names_offset = s.read_offset_x(); - motion_bone_count = s.read_uint32_t_reverse_endianness(); - motion_bone_names_offset = s.read_offset_x(); - parent_indices_offset = s.read_offset_x(); + chain_pos_rad_num = s.read_uint32_t_reverse_endianness(); + chain_pos_rad_offset = s.read_offset_x(); + heel_height_offset = s.read_offset_x(); + bone_name_num = s.read_uint32_t_reverse_endianness(); + bone_name_offset = s.read_offset_x(); + bone_node_num = s.read_uint32_t_reverse_endianness(); + bone_node_offset = s.read_offset_x(); + parent_node_offset = s.read_offset_x(); s.read(0x28); } - uint32_t bone_count = 0; + uint32_t body_type_num = 0; s.position_push(bones_offset, SEEK_SET); if (!is_x) while (true) { @@ -776,7 +776,7 @@ static void bone_database_modern_read_inner(bone_database* bone_data, stream& s, break; s.read(0x0B); - bone_count++; + body_type_num++; } else while (true) { @@ -784,96 +784,96 @@ static void bone_database_modern_read_inner(bone_database* bone_data, stream& s, break; s.read(0x0F); - bone_count++; + body_type_num++; } s.position_pop(); - skel->bone.resize(bone_count); + skel->body_type.resize(body_type_num); - bone_database_bone* _bone = skel->bone.data(); + BODYTYPE* body_type = skel->body_type.data(); s.position_push(bones_offset, SEEK_SET); if (!is_x) - for (uint32_t j = 0; j < bone_count; j++) { - bone_database_bone* bone = &_bone[j]; - bone->type = (bone_database_bone_type)s.read_uint8_t(); - bone->has_parent = s.read_uint8_t() ? true : false; - bone->parent = s.read_uint8_t(); - bone->pole_target = s.read_uint8_t(); - bone->mirror = s.read_uint8_t(); - bone->flags = s.read_uint8_t(); + for (uint32_t j = 0; j < body_type_num; j++) { + BODYTYPE* bone = &body_type[j]; + bone->ik_type = (IK_TYPE)s.read_uint8_t(); + bone->inherit_type = (IH_TYPE)s.read_uint8_t(); + bone->inherit_mat_id = s.read_uint8_t(); + bone->up_vector_id = s.read_uint8_t(); + bone->flip_block_id = s.read_uint8_t(); + bone->expression_id = s.read_uint8_t(); s.read(0x02); bone->name = s.read_string_null_terminated_offset(s.read_offset_f2(header_length)); } else - for (uint32_t j = 0; j < bone_count; j++) { - bone_database_bone* bone = &_bone[j]; - bone->type = (bone_database_bone_type)s.read_uint8_t(); - bone->has_parent = s.read_uint8_t() ? true : false; - bone->parent = s.read_uint8_t(); - bone->pole_target = s.read_uint8_t(); - bone->mirror = s.read_uint8_t(); - bone->flags = s.read_uint8_t(); + for (uint32_t j = 0; j < body_type_num; j++) { + BODYTYPE* bone = &body_type[j]; + bone->ik_type = (IK_TYPE)s.read_uint8_t(); + bone->inherit_type = (IH_TYPE)s.read_uint8_t(); + bone->inherit_mat_id = s.read_uint8_t(); + bone->up_vector_id = s.read_uint8_t(); + bone->flip_block_id = s.read_uint8_t(); + bone->expression_id = s.read_uint8_t(); s.read(0x02); bone->name = s.read_string_null_terminated_offset(s.read_offset_x()); } s.position_pop(); - skel->position.resize(position_count); + skel->chain_pos_rad.resize(chain_pos_rad_num); - vec3* _position = skel->position.data(); + CHAINPOSRADIUS* chain_pos_rad = skel->chain_pos_rad.data(); - s.position_push(positions_offset, SEEK_SET); - for (uint32_t j = 0; j < position_count; j++) { - vec3* position = &_position[j]; - position->x = s.read_float_t_reverse_endianness(); - position->y = s.read_float_t_reverse_endianness(); - position->z = s.read_float_t_reverse_endianness(); + s.position_push(chain_pos_rad_offset, SEEK_SET); + for (uint32_t j = 0; j < chain_pos_rad_num; j++) { + vec3& chain_pos = chain_pos_rad[j].chain_pos; + chain_pos.x = s.read_float_t_reverse_endianness(); + chain_pos.y = s.read_float_t_reverse_endianness(); + chain_pos.z = s.read_float_t_reverse_endianness(); } s.position_pop(); - s.position_push(unknown_value_offset, SEEK_SET); + s.position_push(heel_height_offset, SEEK_SET); skel->heel_height = s.read_float_t_reverse_endianness(); s.position_pop(); - skel->object_bone.resize(object_bone_count); + skel->bone_name.resize(bone_name_num); - std::string* object_bone = skel->object_bone.data(); + std::string* bone_name = skel->bone_name.data(); - s.position_push(object_bone_names_offset, SEEK_SET); + s.position_push(bone_name_offset, SEEK_SET); if (!is_x) - for (uint32_t j = 0; j < object_bone_count; j++) - object_bone[j] = s.read_string_null_terminated_offset( + for (uint32_t j = 0; j < bone_name_num; j++) + bone_name[j] = s.read_string_null_terminated_offset( s.read_offset_f2(header_length)); else - for (uint32_t j = 0; j < object_bone_count; j++) - object_bone[j] = s.read_string_null_terminated_offset( + for (uint32_t j = 0; j < bone_name_num; j++) + bone_name[j] = s.read_string_null_terminated_offset( s.read_offset_x()); s.position_pop(); - skel->motion_bone.resize(motion_bone_count); + skel->bone_node_name.resize(bone_node_num); - std::string* motion_bone = skel->motion_bone.data(); + std::string* bone_node_name = skel->bone_node_name.data(); - s.position_push(motion_bone_names_offset, SEEK_SET); + s.position_push(bone_node_offset, SEEK_SET); if (!is_x) - for (uint32_t j = 0; j < motion_bone_count; j++) - motion_bone[j] = s.read_string_null_terminated_offset( + for (uint32_t j = 0; j < bone_node_num; j++) + bone_node_name[j] = s.read_string_null_terminated_offset( s.read_offset_f2(header_length)); else - for (uint32_t j = 0; j < motion_bone_count; j++) - motion_bone[j] = s.read_string_null_terminated_offset( + for (uint32_t j = 0; j < bone_node_num; j++) + bone_node_name[j] = s.read_string_null_terminated_offset( s.read_offset_x()); s.position_pop(); - skel->parent_index.resize(motion_bone_count); + skel->parent_node.resize(bone_node_num); - s.position_push(parent_indices_offset, SEEK_SET); - s.read(skel->parent_index.data(), motion_bone_count * sizeof(uint16_t)); + s.position_push(parent_node_offset, SEEK_SET); + s.read(skel->parent_node.data(), bone_node_num * sizeof(uint16_t)); if (big_endian) { - uint16_t* parent_index = skel->parent_index.data(); - for (uint32_t j = 0; j < motion_bone_count; j++) - parent_index[j] = reverse_endianness_uint16_t(parent_index[j]); + uint16_t* parent_node = skel->parent_node.data(); + for (uint32_t j = 0; j < bone_node_num; j++) + parent_node[j] = reverse_endianness_uint16_t(parent_node[j]); } s.position_pop(); s.position_pop(); @@ -883,11 +883,11 @@ static void bone_database_modern_read_inner(bone_database* bone_data, stream& s, s.position_push(skeleton_name_offsets_offset, SEEK_SET); if (!is_x) for (uint32_t i = 0; i < skeleton_count; i++) - bone_data->skeleton[i].name = s.read_string_null_terminated_offset( + bone_data->bonedata[i].name = s.read_string_null_terminated_offset( s.read_offset_f2(header_length)); else for (uint32_t i = 0; i < skeleton_count; i++) - bone_data->skeleton[i].name = s.read_string_null_terminated_offset( + bone_data->bonedata[i].name = s.read_string_null_terminated_offset( s.read_offset_x()); s.position_pop(); @@ -912,7 +912,7 @@ static void bone_database_modern_write_inner(bone_database* bone_data, stream& s enrs_entry ee; pof pof; - uint32_t skeleton_count = (uint32_t)bone_data->skeleton.size(); + uint32_t skeleton_count = (uint32_t)bone_data->bonedata.size(); if (!is_x) { uint32_t pos; @@ -929,34 +929,34 @@ static void bone_database_modern_write_inner(bone_database* bone_data, stream& s skeleton_count /= 2; for (uint32_t i = 0; i < skeleton_count; i++) { - bone_database_skeleton* skel = &bone_data->skeleton[i]; + BoneData* skel = &bone_data->bonedata[i]; - uint32_t bone_count = (uint32_t)skel->bone.size(); - uint32_t position_count = (uint32_t)skel->position.size(); - uint32_t object_bone_count = (uint32_t)skel->object_bone.size(); - uint32_t motion_bone_count = (uint32_t)skel->motion_bone.size(); + uint32_t body_type_num = (uint32_t)skel->body_type.size(); + uint32_t chain_pos_rad_num = (uint32_t)skel->chain_pos_rad.size(); + uint32_t bone_name_num = (uint32_t)skel->bone_name.size(); + uint32_t bone_node_num = (uint32_t)skel->bone_node_name.size(); ee = { off, 1, 56, 1 }; ee.append(0, 14, ENRS_DWORD); e.vec.push_back(ee); pos += off = 56; - bone_count++; + body_type_num++; off += 8; pos += 8; - ee = { off, 1, 12, bone_count }; + ee = { off, 1, 12, body_type_num }; ee.append(0, 1, ENRS_DWORD); e.vec.push_back(ee); - off = (uint32_t)(bone_count * 12ULL); + off = (uint32_t)(body_type_num * 12ULL); if (pos + off % 0x10) off -= 8; pos += off = align_val(pos + off, 0x10) - pos; - bone_count--; + body_type_num--; - ee = { off, 1, 12, position_count }; + ee = { off, 1, 12, chain_pos_rad_num }; ee.append(0, 3, ENRS_DWORD); e.vec.push_back(ee); - off = (uint32_t)(position_count * 12ULL); + off = (uint32_t)(chain_pos_rad_num * 12ULL); pos += off = align_val(off, 0x10); ee = { off, 1, 4, 1 }; @@ -964,17 +964,17 @@ static void bone_database_modern_write_inner(bone_database* bone_data, stream& s e.vec.push_back(ee); pos += off = 4; - object_bone_count += motion_bone_count; - ee = { off, 1, (uint32_t)(object_bone_count * 4ULL), 1 }; - ee.append(0, object_bone_count, ENRS_DWORD); + bone_name_num += bone_node_num; + ee = { off, 1, (uint32_t)(bone_name_num * 4ULL), 1 }; + ee.append(0, bone_name_num, ENRS_DWORD); e.vec.push_back(ee); - pos += off = (uint32_t)(object_bone_count * 4ULL); - object_bone_count -= motion_bone_count; + pos += off = (uint32_t)(bone_name_num * 4ULL); + bone_name_num -= bone_node_num; - ee = { off, 1, (uint32_t)(motion_bone_count * 2ULL), 1 }; - ee.append(0, motion_bone_count, ENRS_WORD); + ee = { off, 1, (uint32_t)(bone_node_num * 2ULL), 1 }; + ee.append(0, bone_node_num, ENRS_WORD); e.vec.push_back(ee); - off = (uint32_t)(motion_bone_count * 2ULL); + off = (uint32_t)(bone_node_num * 2ULL); pos += off = align_val(off, 0x04); } } @@ -1022,25 +1022,25 @@ static void bone_database_modern_write_inner(bone_database* bone_data, stream& s off = align_val(off, 0x10); for (uint32_t i = 0; i < skeleton_count; i++) { - bone_database_skeleton* skel = &bone_data->skeleton[i]; + BoneData* skel = &bone_data->bonedata[i]; - uint32_t bone_count = (uint32_t)skel->bone.size(); - uint32_t position_count = (uint32_t)skel->position.size(); - uint32_t object_bone_count = (uint32_t)skel->object_bone.size(); - uint32_t motion_bone_count = (uint32_t)skel->motion_bone.size(); + uint32_t body_type_num = (uint32_t)skel->body_type.size(); + uint32_t chain_pos_rad_num = (uint32_t)skel->chain_pos_rad.size(); + uint32_t bone_name_num = (uint32_t)skel->bone_name.size(); + uint32_t bone_node_num = (uint32_t)skel->bone_node_name.size(); - bone_count++; + body_type_num++; off += 8; - ee = { off, 1, 16, bone_count }; + ee = { off, 1, 16, body_type_num }; ee.append(0, 1, ENRS_QWORD); e.vec.push_back(ee); - off = (uint32_t)(bone_count * 16ULL); - bone_count--; + off = (uint32_t)(body_type_num * 16ULL); + body_type_num--; - ee = { off, 1, 12, position_count }; + ee = { off, 1, 12, chain_pos_rad_num }; ee.append(0, 3, ENRS_DWORD); e.vec.push_back(ee); - off = (uint32_t)(position_count * 12ULL); + off = (uint32_t)(chain_pos_rad_num * 12ULL); off = align_val(off, 0x10); ee = { off, 1, 4, 1 }; @@ -1049,41 +1049,41 @@ static void bone_database_modern_write_inner(bone_database* bone_data, stream& s off = 4; off = align_val(off, 0x10); - if (object_bone_count % 1) { - ee = { off, 1, 12, position_count }; + if (bone_name_num % 1) { + ee = { off, 1, 12, chain_pos_rad_num }; ee.append(0, 3, ENRS_DWORD); e.vec.push_back(ee); - off = (uint32_t)(position_count * 12ULL); + off = (uint32_t)(chain_pos_rad_num * 12ULL); off = align_val(off, 0x10); } if (skeleton_count % 2) { - ee = { off, 1, (uint32_t)(object_bone_count * 8ULL), 1 }; - ee.append(0, object_bone_count, ENRS_QWORD); + ee = { off, 1, (uint32_t)(bone_name_num * 8ULL), 1 }; + ee.append(0, bone_name_num, ENRS_QWORD); e.vec.push_back(ee); - off = (uint32_t)(object_bone_count * 8ULL); + off = (uint32_t)(bone_name_num * 8ULL); off = align_val(off, 0x10); - ee = { off, 1, (uint32_t)(motion_bone_count * 8ULL), 1 }; - ee.append(0, motion_bone_count, ENRS_QWORD); + ee = { off, 1, (uint32_t)(bone_node_num * 8ULL), 1 }; + ee.append(0, bone_node_num, ENRS_QWORD); e.vec.push_back(ee); - off = (uint32_t)(motion_bone_count * 8ULL); + off = (uint32_t)(bone_node_num * 8ULL); off = align_val(off, 0x10); } else { - object_bone_count += motion_bone_count; - ee = { off, 1, (uint32_t)(object_bone_count * 8ULL), 1 }; - ee.append(0, object_bone_count, ENRS_QWORD); + bone_name_num += bone_node_num; + ee = { off, 1, (uint32_t)(bone_name_num * 8ULL), 1 }; + ee.append(0, bone_name_num, ENRS_QWORD); e.vec.push_back(ee); - off = (uint32_t)(object_bone_count * 8ULL); + off = (uint32_t)(bone_name_num * 8ULL); off = align_val(off, 0x10); - object_bone_count -= motion_bone_count; + bone_name_num -= bone_node_num; } - ee = { off, 1, (uint32_t)(motion_bone_count * 2ULL), 1 }; - ee.append(0, motion_bone_count, ENRS_WORD); + ee = { off, 1, (uint32_t)(bone_node_num * 2ULL), 1 }; + ee.append(0, bone_node_num, ENRS_WORD); e.vec.push_back(ee); - off = (uint32_t)(motion_bone_count * 2ULL); + off = (uint32_t)(bone_node_num * 2ULL); off = align_val(off, 0x10); } } @@ -1096,20 +1096,20 @@ static void bone_database_modern_write_inner(bone_database* bone_data, stream& s int64_t skeleton_offsets_offset = s_bone.get_position(); if (!is_x) - for (bone_database_skeleton& i : bone_data->skeleton) + for (BoneData& i : bone_data->bonedata) io_write_offset_f2_pof_add(s_bone, 0, 0x40, &pof); else { - for (bone_database_skeleton& i : bone_data->skeleton) + for (BoneData& i : bone_data->bonedata) io_write_offset_x_pof_add(s_bone, 0, &pof); s_bone.align_write(0x10); } int64_t skeleton_name_offsets_offset = s_bone.get_position(); if (!is_x) - for (bone_database_skeleton& i : bone_data->skeleton) + for (BoneData& i : bone_data->bonedata) io_write_offset_f2_pof_add(s_bone, 0, 0x40, &pof); else { - for (bone_database_skeleton& i : bone_data->skeleton) + for (BoneData& i : bone_data->bonedata) io_write_offset_x_pof_add(s_bone, 0, &pof); s_bone.align_write(0x10); } @@ -1118,12 +1118,12 @@ static void bone_database_modern_write_inner(bone_database* bone_data, stream& s if (!is_x) for (uint32_t i = 0; i < skeleton_count; i++) { - bone_database_skeleton* skel = &bone_data->skeleton[i]; + BoneData* skel = &bone_data->bonedata[i]; - uint32_t bone_count = (uint32_t)skel->bone.size(); - uint32_t position_count = (uint32_t)skel->position.size(); - uint32_t object_bone_count = (uint32_t)skel->object_bone.size(); - uint32_t motion_bone_count = (uint32_t)skel->motion_bone.size(); + uint32_t body_type_num = (uint32_t)skel->body_type.size(); + uint32_t chain_pos_rad_num = (uint32_t)skel->chain_pos_rad.size(); + uint32_t bone_name_num = (uint32_t)skel->bone_name.size(); + uint32_t bone_node_num = (uint32_t)skel->bone_node_name.size(); skh[i].offset = s_bone.get_position(); io_write_offset_f2_pof_add(s_bone, 0, 0x40, &pof); @@ -1138,7 +1138,7 @@ static void bone_database_modern_write_inner(bone_database* bone_data, stream& s s_bone.write(0x14); skh[i].bones_offset = s_bone.get_position(); - for (bone_database_bone& j : skel->bone) { + for (BODYTYPE& j : skel->body_type) { s_bone.write(0x08); io_write_offset_f2_pof_add(s_bone, 0, 0x40, &pof); } @@ -1147,23 +1147,23 @@ static void bone_database_modern_write_inner(bone_database* bone_data, stream& s io_write_offset_f2_pof_add(s_bone, 0, 0x40, &pof); s_bone.align_write(0x10); - skh[i].positions_offset = s_bone.get_position(); - s_bone.write(sizeof(vec3) * position_count); + skh[i].chain_pos_rad_offset = s_bone.get_position(); + s_bone.write(sizeof(vec3) * chain_pos_rad_num); s_bone.align_write(0x10); - skh[i].unknown_value_offset = s_bone.get_position(); + skh[i].heel_height_offset = s_bone.get_position(); s_bone.write_float_t(0.0f); - skh[i].object_bone_names_offset = s_bone.get_position(); - for (std::string& j : skel->object_bone) + skh[i].bone_name_offset = s_bone.get_position(); + for (std::string& j : skel->bone_name) io_write_offset_f2_pof_add(s_bone, 0, 0x40, &pof); - skh[i].motion_bone_names_offset = s_bone.get_position(); - for (std::string& j : skel->motion_bone) + skh[i].bone_node_offset = s_bone.get_position(); + for (std::string& j : skel->bone_node_name) io_write_offset_f2_pof_add(s_bone, 0, 0x40, &pof); - skh[i].parent_indices_offset = s_bone.get_position(); - s_bone.write(sizeof(uint16_t) * motion_bone_count); + skh[i].parent_node_offset = s_bone.get_position(); + s_bone.write(sizeof(uint16_t) * bone_node_num); s_bone.align_write(0x04); } else { @@ -1183,15 +1183,15 @@ static void bone_database_modern_write_inner(bone_database* bone_data, stream& s } for (uint32_t i = 0; i < skeleton_count; i++) { - bone_database_skeleton* skel = &bone_data->skeleton[i]; + BoneData* skel = &bone_data->bonedata[i]; - uint32_t bone_count = (uint32_t)skel->bone.size(); - uint32_t position_count = (uint32_t)skel->position.size(); - uint32_t object_bone_count = (uint32_t)skel->object_bone.size(); - uint32_t motion_bone_count = (uint32_t)skel->motion_bone.size(); + uint32_t body_type_num = (uint32_t)skel->body_type.size(); + uint32_t chain_pos_rad_num = (uint32_t)skel->chain_pos_rad.size(); + uint32_t bone_name_num = (uint32_t)skel->bone_name.size(); + uint32_t bone_node_num = (uint32_t)skel->bone_node_name.size(); skh[i].bones_offset = s_bone.get_position(); - for (bone_database_bone& j : skel->bone) { + for (BODYTYPE& j : skel->body_type) { s_bone.write(0x08); io_write_offset_x_pof_add(s_bone, 0, &pof); } @@ -1200,26 +1200,26 @@ static void bone_database_modern_write_inner(bone_database* bone_data, stream& s io_write_offset_x_pof_add(s_bone, 0, &pof); s_bone.align_write(0x10); - skh[i].positions_offset = s_bone.get_position(); - s_bone.write(&s_bone, sizeof(vec3) * position_count); + skh[i].chain_pos_rad_offset = s_bone.get_position(); + s_bone.write(&s_bone, sizeof(vec3) * chain_pos_rad_num); s_bone.align_write(0x10); - skh[i].unknown_value_offset = s_bone.get_position(); + skh[i].heel_height_offset = s_bone.get_position(); s_bone.write_float_t(0.0f); s_bone.align_write(0x10); - skh[i].object_bone_names_offset = s_bone.get_position(); - for (std::string& j : skel->object_bone) + skh[i].bone_name_offset = s_bone.get_position(); + for (std::string& j : skel->bone_name) io_write_offset_x_pof_add(s_bone, 0, &pof); s_bone.align_write(0x10); - skh[i].motion_bone_names_offset = s_bone.get_position(); - for (std::string& j : skel->motion_bone) + skh[i].bone_node_offset = s_bone.get_position(); + for (std::string& j : skel->bone_node_name) io_write_offset_x_pof_add(s_bone, 0, &pof); s_bone.align_write(0x10); - skh[i].parent_indices_offset = s_bone.get_position(); - s_bone.write(sizeof(uint16_t) * motion_bone_count); + skh[i].parent_node_offset = s_bone.get_position(); + s_bone.write(sizeof(uint16_t) * bone_node_num); s_bone.align_write(0x10); } } @@ -1229,7 +1229,7 @@ static void bone_database_modern_write_inner(bone_database* bone_data, stream& s if (is_x) for (uint32_t i = 0; i < skeleton_count; i++) { - bone_database_skeleton* skel = &bone_data->skeleton[i]; + BoneData* skel = &bone_data->bonedata[i]; if (bone_database_strings_push_back_check(strings, skel->name.c_str())) { string_offsets.push_back(s_bone.get_position()); @@ -1238,9 +1238,9 @@ static void bone_database_modern_write_inner(bone_database* bone_data, stream& s } for (uint32_t i = 0; i < skeleton_count; i++) { - bone_database_skeleton* skel = &bone_data->skeleton[i]; + BoneData* skel = &bone_data->bonedata[i]; - for (bone_database_bone& j : skel->bone) + for (BODYTYPE& j : skel->body_type) if (bone_database_strings_push_back_check(strings, j.name.c_str())) { string_offsets.push_back(s_bone.get_position()); s_bone.write_string_null_terminated(j.name); @@ -1251,13 +1251,13 @@ static void bone_database_modern_write_inner(bone_database* bone_data, stream& s s_bone.write_utf8_string_null_terminated("End"); } - for (std::string& j : skel->object_bone) + for (std::string& j : skel->bone_name) if (bone_database_strings_push_back_check(strings, j.c_str())) { string_offsets.push_back(s_bone.get_position()); s_bone.write_string_null_terminated(j); } - for (std::string& j : skel->motion_bone) + for (std::string& j : skel->bone_node_name) if (bone_database_strings_push_back_check(strings, j.c_str())) { string_offsets.push_back(s_bone.get_position()); s_bone.write_string_null_terminated(j); @@ -1266,7 +1266,7 @@ static void bone_database_modern_write_inner(bone_database* bone_data, stream& s if (!is_x) for (uint32_t i = 0; i < skeleton_count; i++) { - bone_database_skeleton* skel = &bone_data->skeleton[i]; + BoneData* skel = &bone_data->bonedata[i]; if (bone_database_strings_push_back_check(strings, skel->name.c_str())) { string_offsets.push_back(s_bone.get_position()); @@ -1276,61 +1276,61 @@ static void bone_database_modern_write_inner(bone_database* bone_data, stream& s s_bone.align_write(0x10); for (uint32_t i = 0; i < skeleton_count; i++) { - bone_database_skeleton* skel = &bone_data->skeleton[i]; + BoneData* skel = &bone_data->bonedata[i]; - uint32_t bone_count = (uint32_t)skel->bone.size(); - uint32_t position_count = (uint32_t)skel->position.size(); - uint32_t object_bone_count = (uint32_t)skel->object_bone.size(); - uint32_t motion_bone_count = (uint32_t)skel->motion_bone.size(); + uint32_t body_type_num = (uint32_t)skel->body_type.size(); + uint32_t chain_pos_rad_num = (uint32_t)skel->chain_pos_rad.size(); + uint32_t bone_name_num = (uint32_t)skel->bone_name.size(); + uint32_t bone_node_num = (uint32_t)skel->bone_node_name.size(); s_bone.position_push(skh[i].offset, SEEK_SET); if (!is_x) { s_bone.write_offset_f2(skh[i].bones_offset, 0x40); - s_bone.write_uint32_t_reverse_endianness(position_count); - s_bone.write_offset_f2(skh[i].positions_offset, 0x40); - s_bone.write_offset_f2(skh[i].unknown_value_offset, 0x40); - s_bone.write_uint32_t_reverse_endianness(object_bone_count); - s_bone.write_offset_f2(skh[i].object_bone_names_offset, 0x40); - s_bone.write_uint32_t_reverse_endianness(motion_bone_count); - s_bone.write_offset_f2(skh[i].motion_bone_names_offset, 0x40); - s_bone.write_offset_f2(skh[i].parent_indices_offset, 0x40); + s_bone.write_uint32_t_reverse_endianness(chain_pos_rad_num); + s_bone.write_offset_f2(skh[i].chain_pos_rad_offset, 0x40); + s_bone.write_offset_f2(skh[i].heel_height_offset, 0x40); + s_bone.write_uint32_t_reverse_endianness(bone_name_num); + s_bone.write_offset_f2(skh[i].bone_name_offset, 0x40); + s_bone.write_uint32_t_reverse_endianness(bone_node_num); + s_bone.write_offset_f2(skh[i].bone_node_offset, 0x40); + s_bone.write_offset_f2(skh[i].parent_node_offset, 0x40); s_bone.write(0x14); } else { s_bone.write_offset_x(skh[i].bones_offset); - s_bone.write_uint32_t_reverse_endianness(position_count); - s_bone.write_offset_x(skh[i].positions_offset); - s_bone.write_offset_x(skh[i].unknown_value_offset); - s_bone.write_uint32_t_reverse_endianness(object_bone_count); - s_bone.write_offset_x(skh[i].object_bone_names_offset); - s_bone.write_uint32_t_reverse_endianness(motion_bone_count); - s_bone.write_offset_x(skh[i].motion_bone_names_offset); - s_bone.write_offset_x(skh[i].parent_indices_offset); + s_bone.write_uint32_t_reverse_endianness(chain_pos_rad_num); + s_bone.write_offset_x(skh[i].chain_pos_rad_offset); + s_bone.write_offset_x(skh[i].heel_height_offset); + s_bone.write_uint32_t_reverse_endianness(bone_name_num); + s_bone.write_offset_x(skh[i].bone_name_offset); + s_bone.write_uint32_t_reverse_endianness(bone_node_num); + s_bone.write_offset_x(skh[i].bone_node_offset); + s_bone.write_offset_x(skh[i].parent_node_offset); s_bone.write(0x28); } s_bone.position_pop(); s_bone.position_push(skh[i].bones_offset, SEEK_SET); if (!is_x) - for (bone_database_bone& j : skel->bone) { - s_bone.write_uint8_t((uint8_t)j.type); - s_bone.write_uint8_t(j.has_parent ? 1 : 0); - s_bone.write_uint8_t(j.parent); - s_bone.write_uint8_t(j.pole_target); - s_bone.write_uint8_t(j.mirror); - s_bone.write_uint8_t(j.flags); + for (BODYTYPE& j : skel->body_type) { + s_bone.write_uint8_t((uint8_t)j.ik_type); + s_bone.write_uint8_t((uint8_t)j.inherit_type); + s_bone.write_uint8_t((uint8_t)j.inherit_mat_id); + s_bone.write_uint8_t((uint8_t)j.up_vector_id); + s_bone.write_uint8_t((uint8_t)j.flip_block_id); + s_bone.write_uint8_t(j.expression_id); s_bone.write(0x02); s_bone.write_offset_f2(bone_database_strings_get_string_offset(strings, string_offsets, j.name.c_str()), 0x40); } else - for (bone_database_bone& j : skel->bone) { - s_bone.write_uint8_t((uint8_t)j.type); - s_bone.write_uint8_t(j.has_parent ? 1 : 0); - s_bone.write_uint8_t(j.parent); - s_bone.write_uint8_t(j.pole_target); - s_bone.write_uint8_t(j.mirror); - s_bone.write_uint8_t(j.flags); + for (BODYTYPE& j : skel->body_type) { + s_bone.write_uint8_t((uint8_t)j.ik_type); + s_bone.write_uint8_t((uint8_t)j.inherit_type); + s_bone.write_uint8_t((uint8_t)j.inherit_mat_id); + s_bone.write_uint8_t((uint8_t)j.up_vector_id); + s_bone.write_uint8_t((uint8_t)j.flip_block_id); + s_bone.write_uint8_t(j.expression_id); s_bone.write(&s_bone, 0x02); s_bone.write_offset_x(bone_database_strings_get_string_offset(strings, string_offsets, j.name.c_str())); @@ -1350,41 +1350,42 @@ static void bone_database_modern_write_inner(bone_database* bone_data, stream& s } s_bone.position_pop(); - s_bone.position_push(skh[i].positions_offset, SEEK_SET); - for (vec3& j : skel->position) { - s_bone.write_float_t_reverse_endianness(j.x); - s_bone.write_float_t_reverse_endianness(j.y); - s_bone.write_float_t_reverse_endianness(j.z); + s_bone.position_push(skh[i].chain_pos_rad_offset, SEEK_SET); + for (CHAINPOSRADIUS& j : skel->chain_pos_rad) { + vec3& chain_pos = j.chain_pos; + s_bone.write_float_t_reverse_endianness(chain_pos.x); + s_bone.write_float_t_reverse_endianness(chain_pos.y); + s_bone.write_float_t_reverse_endianness(chain_pos.z); } s_bone.position_pop(); - s_bone.position_push(skh[i].unknown_value_offset, SEEK_SET); + s_bone.position_push(skh[i].heel_height_offset, SEEK_SET); s_bone.write_float_t_reverse_endianness(skel->heel_height); s_bone.position_pop(); - s_bone.position_push(skh[i].object_bone_names_offset, SEEK_SET); + s_bone.position_push(skh[i].bone_name_offset, SEEK_SET); if (!is_x) - for (std::string& j : skel->object_bone) + for (std::string& j : skel->bone_name) s_bone.write_offset_f2(bone_database_strings_get_string_offset(strings, string_offsets, j.c_str()), 0x40); else - for (std::string& j : skel->object_bone) + for (std::string& j : skel->bone_name) s_bone.write_offset_x(bone_database_strings_get_string_offset(strings, string_offsets, j.c_str())); - s_bone.position_push(skh[i].motion_bone_names_offset, SEEK_SET); + s_bone.position_push(skh[i].bone_node_offset, SEEK_SET); if (!is_x) - for (std::string& j : skel->motion_bone) + for (std::string& j : skel->bone_node_name) s_bone.write_offset_f2(bone_database_strings_get_string_offset(strings, string_offsets, j.c_str()), 0x40); else - for (std::string& j : skel->motion_bone) + for (std::string& j : skel->bone_node_name) s_bone.write_offset_x(bone_database_strings_get_string_offset(strings, string_offsets, j.c_str())); s_bone.position_pop(); - s_bone.position_push(skh[i].parent_indices_offset, SEEK_SET); - for (uint16_t& j : skel->parent_index) + s_bone.position_push(skh[i].parent_node_offset, SEEK_SET); + for (uint16_t& j : skel->parent_node) s_bone.write_uint16_t_reverse_endianness(j); s_bone.position_pop(); } @@ -1407,11 +1408,11 @@ static void bone_database_modern_write_inner(bone_database* bone_data, stream& s s_bone.position_push(skeleton_name_offsets_offset, SEEK_SET); if (!is_x) - for (bone_database_skeleton& i : bone_data->skeleton) + for (BoneData& i : bone_data->bonedata) s_bone.write_offset_f2(bone_database_strings_get_string_offset(strings, string_offsets, i.name.c_str()), 0x40); else - for (bone_database_skeleton& i : bone_data->skeleton) + for (BoneData& i : bone_data->bonedata) s_bone.write_offset_x(bone_database_strings_get_string_offset(strings, string_offsets, i.name.c_str())); s_bone.position_pop(); diff --git a/src/KKdLib/database/bone.hpp b/src/KKdLib/database/bone.hpp index 177395fc..5feee2b9 100644 --- a/src/KKdLib/database/bone.hpp +++ b/src/KKdLib/database/bone.hpp @@ -11,58 +11,69 @@ #include "../prj/vector_pair.hpp" #include "../vec.hpp" -enum bone_database_bone_type { - BONE_DATABASE_BONE_ROTATION = 0x00, - BONE_DATABASE_BONE_TYPE_1 = 0x01, - BONE_DATABASE_BONE_POSITION = 0x02, - BONE_DATABASE_BONE_POSITION_ROTATION = 0x03, - BONE_DATABASE_BONE_HEAD_IK_ROTATION = 0x04, - BONE_DATABASE_BONE_ARM_IK_ROTATION = 0x05, - BONE_DATABASE_BONE_LEGS_IK_ROTATION = 0x06, +enum BONE_KIND { + BONE_KIND_NONE = -1, + BONE_KIND_CMN = 0, + BONE_KIND_MIK = 1, + BONE_KIND_KAI = 2, + BONE_KIND_LEN = 3, + BONE_KIND_LUK = 4, + BONE_KIND_MEI = 5, + BONE_KIND_RIN = 6, + BONE_KIND_HAK = 7, + BONE_KIND_NER = 8, + BONE_KIND_SAK = 9, + BONE_KIND_TET = 10, + BONE_KIND_MAX = 11, }; -enum bone_database_skeleton_type { - BONE_DATABASE_SKELETON_COMMON = 0, - BONE_DATABASE_SKELETON_MIKU = 1, - BONE_DATABASE_SKELETON_KAITO = 2, - BONE_DATABASE_SKELETON_LEN = 3, - BONE_DATABASE_SKELETON_LUKA = 4, - BONE_DATABASE_SKELETON_MEIKO = 5, - BONE_DATABASE_SKELETON_RIN = 6, - BONE_DATABASE_SKELETON_HAKU = 7, - BONE_DATABASE_SKELETON_NERU = 8, - BONE_DATABASE_SKELETON_SAKINE = 9, - BONE_DATABASE_SKELETON_TETO = 10, - BONE_DATABASE_SKELETON_NONE = -1, +enum IH_TYPE { + IHT_NO = 0x00, + IHT_MAT = 0x01, + IHT_ANG = 0x02, }; -struct bone_database_bone { - bone_database_bone_type type; - bool has_parent; - uint8_t parent; - uint8_t pole_target; - uint8_t mirror; - uint8_t flags; +enum IK_TYPE { + IKT_0 = 0x00, + IKT_0N = 0x01, + IKT_0T = 0x02, + IKT_ROOT = 0x03, + IKT_1 = 0x04, + IKT_2 = 0x05, + IKT_2R = 0x06, +}; + +struct CHAINPOSRADIUS { + vec3 chain_pos; +}; + +struct BODYTYPE { + IK_TYPE ik_type; + IH_TYPE inherit_type; + uint8_t inherit_mat_id; + uint8_t up_vector_id; + uint8_t flip_block_id; + uint8_t expression_id; std::string name; - bone_database_bone(); - ~bone_database_bone(); + BODYTYPE(); + ~BODYTYPE(); }; -struct bone_database_skeleton { - std::vector bone; - std::vector position; +struct BoneData { + std::vector body_type; + std::vector chain_pos_rad; float_t heel_height; - std::vector object_bone; - std::vector motion_bone; - std::vector parent_index; + std::vector bone_name; + std::vector bone_node_name; + std::vector parent_node; std::string name; - prj::vector_pair bone_names; - prj::vector_pair object_bone_names; - prj::vector_pair motion_bone_names; + prj::vector_pair body_type_map; + prj::vector_pair bone_name_map; + prj::vector_pair bone_node_name_map; - bone_database_skeleton(); - ~bone_database_skeleton(); + BoneData(); + ~BoneData(); }; struct bone_database { @@ -71,8 +82,8 @@ struct bone_database { bool big_endian; bool is_x; - std::vector skeleton; - prj::vector_pair skeleton_names; + std::vector bonedata; + prj::vector_pair bonedata_map; bone_database(); ~bone_database(); @@ -87,22 +98,73 @@ struct bone_database { void clear(); void update(); - const bone_database_skeleton* get_skeleton(const char* name) const; - int32_t get_skeleton_bone_index(const char* name, const char* bone_name) const; - const std::vector* get_skeleton_bones(const char* name) const; - const std::vector* get_skeleton_positions(const char* name) const; - int32_t get_skeleton_object_bone_index(const char* name, const char* bone_name) const; - const std::vector* get_skeleton_object_bones(const char* name) const; - int32_t get_skeleton_motion_bone_index(const char* name, const char* bone_name) const; - const std::vector* get_skeleton_motion_bones(const char* name) const; - const std::vector* get_skeleton_parent_indices(const char* name) const; - const float_t* get_skeleton_heel_height(const char* name) const; + const BoneData* get_bone_data(const char* kind_name) const; + int32_t get_block_index(const char* kind_name, const char* name) const; + const std::vector* get_body_type(const char* kind_name) const; + const std::vector* get_chain_pos_rad(const char* kind_name) const; + int32_t get_bone_index(const char* kind_name, const char* name) const; + const std::vector* get_bone_name(const char* kind_name) const; + int32_t get_bone_node_index(const char* kind_name, const char* name) const; + const std::vector* get_bone_node_name(const char* kind_name) const; + const std::vector* get_parent_node(const char* kind_name) const; + const float_t* get_heel_height(const char* kind_name) const; static bool load_file(void* data, const char* dir, const char* file, uint32_t hash); + + const BoneData* get_bone_data(BONE_KIND kind) const; + int32_t get_block_index(BONE_KIND kind, const char* name) const; + const std::vector* get_body_type(BONE_KIND kind) const; + const std::vector* get_chain_pos_rad(BONE_KIND kind) const; + int32_t get_bone_index(BONE_KIND kind, const char* name) const; + const std::vector* get_bone_name(BONE_KIND kind) const; + int32_t get_bone_node_index(BONE_KIND kind, const char* name) const; + const std::vector* get_bone_node_name(BONE_KIND kind) const; + const std::vector* get_parent_node(BONE_KIND kind) const; + const float_t* get_heel_height(BONE_KIND kind) const; }; -extern void bone_database_bones_calculate_count(const std::vector* bones, +extern void bone_database_bones_calculate_count(const std::vector* bones, size_t& object_bone_count, size_t& motion_bone_count, size_t& node_count, size_t& leaf_pos, size_t& chain_pos); -extern const char* bone_database_skeleton_type_to_string(bone_database_skeleton_type type); +extern const char* bone_database_skeleton_type_to_string(BONE_KIND kind); + +inline const BoneData* bone_database::get_bone_data(BONE_KIND kind) const { + return get_bone_data(bone_database_skeleton_type_to_string(kind)); +} + +inline int32_t bone_database::get_block_index(BONE_KIND kind, const char* name) const { + return get_block_index(bone_database_skeleton_type_to_string(kind), name); +} + +inline const std::vector* bone_database::get_body_type(BONE_KIND kind) const { + return get_body_type(bone_database_skeleton_type_to_string(kind)); +} + +inline const std::vector* bone_database::get_chain_pos_rad(BONE_KIND kind) const { + return get_chain_pos_rad(bone_database_skeleton_type_to_string(kind)); +} + +inline int32_t bone_database::get_bone_index(BONE_KIND kind, const char* name) const { + return get_bone_index(bone_database_skeleton_type_to_string(kind), name); +} + +inline const std::vector* bone_database::get_bone_name(BONE_KIND kind) const { + return get_bone_name(bone_database_skeleton_type_to_string(kind)); +} + +inline int32_t bone_database::get_bone_node_index(BONE_KIND kind, const char* name) const { + return get_bone_node_index(bone_database_skeleton_type_to_string(kind), name); +} + +inline const std::vector* bone_database::get_bone_node_name(BONE_KIND kind) const { + return get_bone_node_name(bone_database_skeleton_type_to_string(kind)); +} + +inline const std::vector* bone_database::get_parent_node(BONE_KIND kind) const { + return get_parent_node(bone_database_skeleton_type_to_string(kind)); +} + +inline const float_t* bone_database::get_heel_height(BONE_KIND kind) const { + return get_heel_height(bone_database_skeleton_type_to_string(kind)); +} diff --git a/src/KKdLib/database/item_table.cpp b/src/KKdLib/database/item_table.cpp index d6a5f8ca..b00d5835 100644 --- a/src/KKdLib/database/item_table.cpp +++ b/src/KKdLib/database/item_table.cpp @@ -1,4 +1,4 @@ -/* +/* by korenkonder GitHub/GitLab: korenkonder */ @@ -11,63 +11,15 @@ #include "../sort.hpp" #include "../str_utils.hpp" -const char* chara_auth_3d_names[] = { - "MIK", - "RIN", - "LEN", - "LUK", - "NER", - "HAK", - "KAI", - "MEI", - "SAK", - "TET", - "EXT", +struct RobCharaData { + const char* name; + const char* name_short; + const char* triplet; + const char* name_face_mot; + const char* name_kana; }; -const char* chara_face_mot_names[] = { - "MIK", - "RIN", - "LEN", - "LUK", - "NER", - "HAK", - "KAI", - "MEI", - "SAK", - "TET", - "EXT", -}; - -const char* chara_full_names[] = { - "MIKU", - "RIN", - "LEN", - "LUKA", - "NERU", - "HAKU", - "KAITO", - "MEIKO", - "SAKINE", - "TETO", - "EXTRA", -}; - -const char* chara_names[] = { - "MIK", - "RIN", - "LEN", - "LUK", - "NER", - "HAK", - "KAI", - "MEI", - "SAK", - "TET", - "EXT", -}; - -const char* item_id_names[] = { +const char* rob_parts_kind_str[] = { "BODY", "ATAMA", "KATA_R", @@ -101,7 +53,7 @@ const char* item_id_names[] = { "ITEM16", }; -const char* item_sub_id_names[] = { +const char* rob_item_equip_sub_id_str[] = { "ZUJO", "KAMI", "HITAI", @@ -129,6 +81,20 @@ const char* item_sub_id_names[] = { "HEAD", }; +static RobCharaData rob_chara_data_list[] = { + { "MIKU" , "MIK", "MIK", "MIK", u8"ミク" }, + { "RIN" , "RIN", "RIN", "RIN", u8"リン" }, + { "LEN" , "LEN", "LEN", "LEN", u8"レン" }, + { "LUKA" , "LUK", "LUK", "LUK", u8"ルカ" }, + { "NERU" , "NER", "NER", "NER", u8"ネル" }, + { "HAKU" , "HAK", "HAK", "HAK", u8"ハク" }, + { "KAITO" , "KAI", "KAI", "KAI", u8"カイト" }, + { "MEIKO" , "MEI", "MEI", "MEI", u8"メイコ" }, + { "SAKINE", "SAK", "SAK", "SAK", u8"サキネ" }, + { "TETO" , "TET", "TET", "TET", u8"テト" }, + { "EXTRA" , "EXT", "EXT", "EXT", u8"エクストラ" }, +}; + static void itm_table_read_inner(itm_table* itm_tbl, stream& s); static void itm_table_write_inner(itm_table* itm_tbl, stream& s); static void itm_table_read_text(itm_table* itm_tbl, void* data, size_t size); @@ -302,31 +268,37 @@ bool itm_table::load_file(void* data, const char* dir, const char* file, uint32_ return itm_tbl->ready; } -const char* chara_index_get_auth_3d_name(chara_index chara_index) { - if (chara_index >= 0 && chara_index < CHARA_MAX) - return chara_auth_3d_names[chara_index]; +const char* get_char_id_str(CHARA_NUM cname) { + if (cname >= 0 && cname < CN_MAX) + return rob_chara_data_list[cname].triplet; return 0; } -const char* chara_index_get_chara_name(chara_index chara_index) { - if (chara_index >= 0 && chara_index < CHARA_MAX) - return chara_names[chara_index]; +const char* get_chara_name(CHARA_NUM cname) { + if (cname >= 0 && cname < CN_MAX) + return rob_chara_data_list[cname].name_short; return 0; } -const char* chara_index_get_face_mot_name(chara_index chara_index) { - if (chara_index >= 0 && chara_index < CHARA_MAX) - return chara_face_mot_names[chara_index]; +const char* get_chara_name_face_mot(CHARA_NUM cname) { + if (cname >= 0 && cname < CN_MAX) + return rob_chara_data_list[cname].name_face_mot; return 0; } -chara_index chara_index_get_from_chara_name(const char* str) { - if (!str) - return CHARA_MAX; +const char* get_chara_name_full(CHARA_NUM cname) { + if (cname >= 0 && cname < CN_MAX) + return rob_chara_data_list[cname].name; + return 0; +} - for (int32_t i = 0; i < CHARA_MAX; i++) { - const char* chr_s = chara_names[i]; - const char* s = str; +CHARA_NUM get_chara_num_from_char_id(const char* in_name) { + if (!in_name) + return CN_MAX; + + for (int32_t i = 0; i < CN_MAX; i++) { + const char* chr_s = rob_chara_data_list[i].triplet; + const char* s = in_name; char chr_c; char diff; @@ -341,26 +313,20 @@ chara_index chara_index_get_from_chara_name(const char* str) { } while (chr_c); if (!diff) - return (chara_index)i; + return (CHARA_NUM)i; } - return CHARA_MAX; + return CN_MAX; } -const char* chara_index_get_name(chara_index chara_index) { - if (chara_index >= 0 && chara_index < CHARA_MAX) - return chara_full_names[chara_index]; - return 0; -} - -const char* item_id_get_name(item_id id) { - if (id >= 0 && id < ITEM_MAX) - return item_id_names[id]; +const char* item_id_get_name(ROB_PARTS_KIND rpk) { + if (rpk >= 0 && rpk < RPK_MAX) + return rob_parts_kind_str[rpk]; return 0; } const char* item_sub_id_get_name(item_sub_id sub_id) { if (sub_id >= 0 && sub_id < ITEM_SUB_MAX) - return item_sub_id_names[sub_id]; + return rob_item_equip_sub_id_str[sub_id]; return 0; } @@ -512,7 +478,7 @@ static void itm_table_read_text(itm_table* itm_tbl, void* data, size_t size) { itm_table_item_data_obj obj; int32_t rpk = 0; if (kv.read("rpk", rpk)) - obj.rpk = (item_id)rpk; + obj.rpk = (ROB_PARTS_KIND)rpk; kv.read("uid", obj.uid); vido.push_back(obj); diff --git a/src/KKdLib/database/item_table.hpp b/src/KKdLib/database/item_table.hpp index 2ff1eca2..f3a1b76b 100644 --- a/src/KKdLib/database/item_table.hpp +++ b/src/KKdLib/database/item_table.hpp @@ -13,58 +13,86 @@ #include "../image.hpp" #include "../vec.hpp" -enum chara_index { - CHARA_NONE = -1, - CHARA_MIKU = 0x00, - CHARA_RIN = 0x01, - CHARA_LEN = 0x02, - CHARA_LUKA = 0x03, - CHARA_NERU = 0x04, - CHARA_HAKU = 0x05, - CHARA_KAITO = 0x06, - CHARA_MEIKO = 0x07, - CHARA_SAKINE = 0x08, - CHARA_TETO = 0x09, - CHARA_MAX = 0x0A, +enum CHARA_NUM { + CN_NONE = -1, + CN_MIKU = 0x00, + CN_RIN = 0x01, + CN_LEN = 0x02, + CN_LUKA = 0x03, + CN_NERU = 0x04, + CN_HAKU = 0x05, + CN_KAITO = 0x06, + CN_MEIKO = 0x07, + CN_SAKINE = 0x08, + CN_TETO = 0x09, + CN_MAX = 0x0A, }; -enum item_id { - ITEM_NONE = -1, - ITEM_BODY = 0x00, - ITEM_ATAMA = 0x01, - ITEM_KATA_R = 0x02, - ITEM_MUNE = 0x03, - ITEM_KATA_L = 0x04, - ITEM_UDE_R = 0x05, - ITEM_SENAKA = 0x06, - ITEM_UDE_L = 0x07, - ITEM_HARA = 0x08, - ITEM_KOSI = 0x09, - ITEM_TE_R = 0x0A, - ITEM_TE_L = 0x0B, - ITEM_MOMO = 0x0C, - ITEM_SUNE = 0x0D, - ITEM_ASI = 0x0E, - ITEM_KAMI = 0x0F, - ITEM_OUTER = 0x10, - ITEM_PANTS = 0x11, - ITEM_ZUJO = 0x12, - ITEM_MEGANE = 0x13, - ITEM_KUBI = 0x14, - ITEM_JOHA_USHIRO = 0x15, - ITEM_KUCHI = 0x16, - ITEM_ITEM09 = 0x17, - ITEM_ITEM10 = 0x18, - ITEM_ITEM11 = 0x19, - ITEM_ITEM12 = 0x1A, - ITEM_ITEM13 = 0x1B, - ITEM_ITEM14 = 0x1C, - ITEM_ITEM15 = 0x1D, - ITEM_ITEM16 = 0x1E, - ITEM_MAX = 0x1F, +enum ROB_PARTS_KIND { + RPK_NONE = -1, + RPK_BODY = 0x00, + RPK_ATAMA = 0x01, + RPK_KATA_R = 0x02, + RPK_MUNE = 0x03, + RPK_KATA_L = 0x04, + RPK_UDE_R = 0x05, + RPK_SENAKA = 0x06, + RPK_UDE_L = 0x07, + RPK_HARA = 0x08, + RPK_KOSI = 0x09, + RPK_TE_R = 0x0A, + RPK_TE_L = 0x0B, + RPK_MOMO = 0x0C, + RPK_SUNE = 0x0D, + RPK_ASI = 0x0E, + RPK_ITEM01 = 0x0F, + RPK_ITEM02 = 0x10, + RPK_ITEM03 = 0x11, + RPK_ITEM04 = 0x12, + RPK_ITEM05 = 0x13, + RPK_ITEM06 = 0x14, + RPK_ITEM07 = 0x15, + RPK_ITEM08 = 0x16, + RPK_ITEM09 = 0x17, + RPK_ITEM10 = 0x18, + RPK_ITEM11 = 0x19, + RPK_ITEM12 = 0x1A, + RPK_ITEM13 = 0x1B, + RPK_ITEM14 = 0x1C, + RPK_ITEM15 = 0x1D, + RPK_ITEM16 = 0x1E, + RPK_MAX = 0x1F, - ITEM_OSAGE_FIRST = ITEM_KAMI, - ITEM_OSAGE_COUNT = (ITEM_MAX - ITEM_KAMI), + RPK_TOP = RPK_BODY, + + RPK_1SKIN_BEGIN = RPK_BODY, + RPK_1SKIN_END = RPK_BODY, + RPK_1SKIN_MAX = RPK_1SKIN_END - RPK_1SKIN_BEGIN + 1, + + RPK_BASE_BEGIN = RPK_ATAMA, + RPK_BASE_END = RPK_ASI, + RPK_BASE_MAX = RPK_ASI - RPK_ATAMA + 1, + + RPK_ITEM_BEGIN = RPK_ITEM01, + RPK_ITEM_END = RPK_ITEM16, + RPK_ITEM_MAX = RPK_ITEM_END - RPK_ITEM_BEGIN + 1, + + RPK_ITEM_ETC_BEGIN = RPK_ITEM09, + RPK_ITEM_ETC_END = RPK_ITEM16, + RPK_ITEM_ETC_MAX = RPK_ITEM_ETC_END - RPK_ITEM_ETC_BEGIN + 1, + + RPK_DISP_BEGIN = RPK_ATAMA, + RPK_DISP_END = RPK_ITEM16, + RPK_DISP_MAX = RPK_DISP_END - RPK_DISP_BEGIN + 1, + + RPK_KAMI = RPK_ITEM01, + RPK_OUTER = RPK_ITEM02, + RPK_PANTS = RPK_ITEM03, + RPK_ZUJO = RPK_ITEM04, + RPK_MEGANE = RPK_ITEM05, + RPK_KUBI = RPK_ITEM06, + RPK_JOHA_USHIRO = RPK_ITEM07, + RPK_KUCHI = RPK_ITEM08, }; enum item_sub_id { @@ -99,7 +127,7 @@ enum item_sub_id { struct itm_table_item_data_obj { std::string uid; - item_id rpk; + ROB_PARTS_KIND rpk; itm_table_item_data_obj(); ~itm_table_item_data_obj(); @@ -198,19 +226,14 @@ struct itm_table { static bool load_file(void* data, const char* dir, const char* file, uint32_t hash); }; -extern const char* chara_auth_3d_names[]; -extern const char* chara_face_mot_names[]; -extern const char* chara_full_names[]; -extern const char* chara_names[]; +extern const char* rob_parts_kind_str[]; +extern const char* rob_item_equip_sub_id_str[]; -extern const char* item_id_names[]; -extern const char* item_sub_id_names[]; +extern const char* get_char_id_str(CHARA_NUM cname); +extern const char* get_chara_name(CHARA_NUM cname); +extern const char* get_chara_name_face_mot(CHARA_NUM cname); +extern const char* get_chara_name_full(CHARA_NUM cname); +extern CHARA_NUM get_chara_num_from_char_id(const char* in_name); -extern const char* chara_index_get_auth_3d_name(chara_index chara_index); -extern const char* chara_index_get_chara_name(chara_index chara_index); -extern const char* chara_index_get_face_mot_name(chara_index chara_index); -extern chara_index chara_index_get_from_chara_name(const char* str); -extern const char* chara_index_get_name(chara_index chara_index); - -extern const char* item_id_get_name(item_id id); +extern const char* item_id_get_name(ROB_PARTS_KIND rpk); extern const char* item_sub_id_get_name(item_sub_id sub_id); diff --git a/src/KKdLib/pv_db.hpp b/src/KKdLib/pv_db.hpp index d8f313c6..40ee4ed3 100644 --- a/src/KKdLib/pv_db.hpp +++ b/src/KKdLib/pv_db.hpp @@ -154,7 +154,7 @@ struct pv_db_auth_replace_by_module { }; struct pv_db_chrcam { - null_def chara; + null_def chara; null_def id; std::string name; @@ -175,7 +175,7 @@ struct pv_db_chreff { }; struct pv_db_chrmot { - null_def chara; + null_def chara; null_def id; std::string name; @@ -211,7 +211,7 @@ struct pv_db_duet { }; struct pv_db_eyes_rot_rate { - null_def chr; + null_def chr; null_def xn_rate; null_def xp_rate; }; @@ -222,17 +222,17 @@ struct pv_db_ex_auth { }; struct pv_db_ex_song_ac101 { - null_def chara; + null_def chara; std::string file; std::string name; }; struct pv_db_ex_song_aft101 { - null_def chara; - null_def chara2P; // not AFT101 - null_def chara3P; // not AFT101 - null_def chara4P; // not AFT101 + null_def chara; + null_def chara2P; // not AFT101 + null_def chara3P; // not AFT101 + null_def chara4P; // not AFT101 std::string file; std::string name; @@ -241,12 +241,12 @@ struct pv_db_ex_song_aft101 { struct pv_db_ex_song_aft300 { std::vector ex_auth; // AFT621/AFT622/AFT701/FT/M39 - null_def chara; - null_def chara2P; - null_def chara3P; - null_def chara4P; - null_def chara5P; // not AFT300/AFT310/AFT400 - null_def chara6P; // not AFT300/AFT310/AFT400 + null_def chara; + null_def chara2P; + null_def chara3P; + null_def chara4P; + null_def chara5P; // not AFT300/AFT310/AFT400 + null_def chara6P; // not AFT300/AFT310/AFT400 std::string file; std::string name; @@ -429,7 +429,7 @@ struct pv_db_osage_init { }; struct pv_db_performer_aft101 { - null_def chara; + null_def chara; null_def size; null_def type; @@ -444,7 +444,7 @@ struct pv_db_performer_aft101 { }; struct pv_db_performer_aft500 { - null_def chara; + null_def chara; null_def size; null_def type; @@ -712,7 +712,7 @@ struct pv_db_pv_ac101 { pv_db_sel_2d sel_2d; // AC101 pv_db_song_info_ac200 song_info; pv_db_title_image_ac200 title_image; - null_def unlock; + null_def unlock; null_def bpm; null_def date; @@ -745,8 +745,8 @@ struct pv_db_pv_ac200 { pv_db_sabi sabi; pv_db_song_info_ac200 song_info; pv_db_title_image_ac200 title_image; - null_def unlock1p; - null_def unlock2p; + null_def unlock1p; + null_def unlock2p; null_def bpm; null_def date; diff --git a/src/ReDIVA/app.cpp b/src/ReDIVA/app.cpp index d1639fb6..b2a54d81 100644 --- a/src/ReDIVA/app.cpp +++ b/src/ReDIVA/app.cpp @@ -865,7 +865,7 @@ static render_context* render_context_load(const wchar_t* config_path) { Glitter::glt_particle_manager_add_task(); - for (int32_t i = 0; i < ROB_CHARA_COUNT; i++) + for (int32_t i = 0; i < ROB_ID_MAX; i++) rob_chara_array_reset_pv_data(i); light_param_data_storage_data_load(); diff --git a/src/ReDIVA/data_edit/rob_chara_adjust.cpp b/src/ReDIVA/data_edit/rob_chara_adjust.cpp index 5e7be723..fcdebfa7 100644 --- a/src/ReDIVA/data_edit/rob_chara_adjust.cpp +++ b/src/ReDIVA/data_edit/rob_chara_adjust.cpp @@ -175,7 +175,7 @@ void RobCharaAdjust::window() { if (ImGui::BeginCombo("##Chara", chara_name[chara_id], 0)) { input_locked |= true; - for (int32_t i = 0; i < ROB_CHARA_COUNT && i < 2; i++) + for (int32_t i = 0; i < ROB_ID_MAX && i < 2; i++) if (ImGui::Selectable(chara_name[i], chara_id == i) || ImGui::ItemKeyPressed(ImGuiKey_Enter)) chara_id = i; diff --git a/src/ReDIVA/data_initialize.cpp b/src/ReDIVA/data_initialize.cpp index b9314871..ef16ee10 100644 --- a/src/ReDIVA/data_initialize.cpp +++ b/src/ReDIVA/data_initialize.cpp @@ -131,7 +131,7 @@ bool TaskDataInit::ctrl() { //sub_140388560(); hand_item_handler_data_read(); rob_sleeve_handler_data_read(); - for (int32_t i = 0; i < ROB_CHARA_COUNT; i++) + for (int32_t i = 0; i < ROB_ID_MAX; i++) rob_chara_age_age_array_reset(i); state = 9; break; diff --git a/src/ReDIVA/data_process/effchrpv_auth_3d_to_mot.cpp b/src/ReDIVA/data_process/effchrpv_auth_3d_to_mot.cpp index 5eef06ec..fb44a527 100644 --- a/src/ReDIVA/data_process/effchrpv_auth_3d_to_mot.cpp +++ b/src/ReDIVA/data_process/effchrpv_auth_3d_to_mot.cpp @@ -56,8 +56,8 @@ struct auth_3d_to_mot_data { int32_t j_momo_r_wj; int32_t j_sune_r_wj; int32_t j_asi_r_wj; - std::map bone_keys; - std::map sec_bone_keys; + std::map bone_keys; + std::map sec_bone_keys; auth_3d_to_mot_data(auth_3d_id id); ~auth_3d_to_mot_data(); @@ -110,6 +110,22 @@ struct effchrpv_auth_3d_to_mot { mot_data_bake bake; + mat4 n_hara_cp_src; + mat4 n_hara_src; + mat4 n_mune_b_src; + mat4 n_kao_src; + mat4 n_momo_l_src; + mat4 n_momo_r_src; + + mat4 n_hara_cp_dst; + mat4 n_hara_dst; + mat4 cl_mune_dst; + mat4 n_mune_b_dst; + mat4 n_kao_dst; + mat4 cl_kao_dst; + mat4 cl_momo_l_dst; + mat4 cl_momo_r_dst; + effchrpv_auth_3d_to_mot(); ~effchrpv_auth_3d_to_mot(); @@ -350,14 +366,22 @@ effchrpv_auth_3d_to_mot::~effchrpv_auth_3d_to_mot() { } -static void set_bone_key_set_global_data(bone_data* bone_data, - std::map& bone_keys, - std::map& second_bone_keys, bool add_keys, +void effchrpv_auth_3d_to_mot::add_chara_effect_auth_3d(uint32_t hash, int32_t id) { + auth_3d_mot_ids.insert({ hash, id }); +} + +void effchrpv_auth_3d_to_mot::add_file_name(const std::string& file, const std::string& category) { + auth_3d_mot_names.insert({ file, category }); +} + +static void set_bone_key_set_global_data( + std::map& bone_keys, + std::map& second_bone_keys, bool add_keys, motion_blend_mot* mot, mot_key_set* key_set, const vec3* data, const int32_t count = 1) { if (add_keys) { - auto elem = bone_keys.find(MOTION_BONE_MAX); + auto elem = bone_keys.find(BLK_MAX); if (elem == bone_keys.end()) - elem = bone_keys.insert({ MOTION_BONE_MAX, {} }).first; + elem = bone_keys.insert({ BLK_MAX, {} }).first; auth_3d_to_mot_keys& keys = elem->second; keys.x.push_back(data[0].x); @@ -365,9 +389,9 @@ static void set_bone_key_set_global_data(bone_data* bone_data, keys.z.push_back(data[0].z); if (count == 2) { - auto elem = second_bone_keys.find(MOTION_BONE_MAX); + auto elem = second_bone_keys.find(BLK_MAX); if (elem == second_bone_keys.end()) - elem = second_bone_keys.insert({ MOTION_BONE_MAX, {} }).first; + elem = second_bone_keys.insert({ BLK_MAX, {} }).first; auth_3d_to_mot_keys& keys = elem->second; keys.x.push_back(data[1].x); @@ -386,16 +410,22 @@ static void set_bone_key_set_global_data(bone_data* bone_data, *(float_t*)&key_set[2].values[0] = data[i].z; key_set += 3; } + + mot->bone_data.gblctr_pos = data[0]; + mot->bone_data.gblctr_rot = data[1]; + + mot->apply_global_transform(); } -static void set_bone_key_set_data(bone_data* bone_data, - std::map& bone_keys, - std::map& second_bone_keys, bool add_keys, - motion_bone_index motion_bone_index, mot_key_set* key_set, const vec3* data, const int32_t count = 1) { +static void set_bone_key_set_data(RobBlock* block, + std::map& bone_keys, + std::map& second_bone_keys, bool add_keys, + BONE_BLK block_id, int32_t& curr_block_id, int32_t skeleton_select, + mot_key_set* key_set, const vec3* data, const int32_t count = 1) { if (add_keys) { - auto elem = bone_keys.find(motion_bone_index); + auto elem = bone_keys.find(block_id); if (elem == bone_keys.end()) - elem = bone_keys.insert({ motion_bone_index, {} }).first; + elem = bone_keys.insert({ block_id, {} }).first; auth_3d_to_mot_keys& keys = elem->second; keys.x.push_back(data[0].x); @@ -403,9 +433,9 @@ static void set_bone_key_set_data(bone_data* bone_data, keys.z.push_back(data[0].z); if (count == 2) { - auto elem = second_bone_keys.find(motion_bone_index); + auto elem = second_bone_keys.find(block_id); if (elem == second_bone_keys.end()) - elem = second_bone_keys.insert({ motion_bone_index, {} }).first; + elem = second_bone_keys.insert({ block_id, {} }).first; auth_3d_to_mot_keys& keys = elem->second; keys.x.push_back(data[1].x); @@ -414,8 +444,8 @@ static void set_bone_key_set_data(bone_data* bone_data, } } - bone_data += motion_bone_index; - key_set += bone_data->key_set_offset; + key_set += block[block_id].key_set_offset; + block[block_id].frame = -FLT_MAX; for (int32_t i = 0; i < count; i++) { if (key_set[0].type == MOT_KEY_SET_STATIC && key_set[0].values) *(float_t*)&key_set[0].values[0] = data[i].x; @@ -425,17 +455,106 @@ static void set_bone_key_set_data(bone_data* bone_data, *(float_t*)&key_set[2].values[0] = data[i].z; key_set += 3; } + + block[block_id].set_global_leaf_sub(data, BONE_KIND_CMN, true, false); + + while (curr_block_id <= block_id) + block[curr_block_id++].get_mat(skeleton_select); } -void effchrpv_auth_3d_to_mot::add_chara_effect_auth_3d(uint32_t hash, int32_t id) { - auth_3d_mot_ids.insert({ hash, id }); +static void rotate_euler(const mat4& src, const mat4& dst, const vec3& src_rotation, vec3& dst_rotation) { + mat4 temp; + mat4_invert(&src, &temp); + mat4 off; + mat4_mul(&dst, &temp, &off); + + mat4 off_inv; + mat4_invert(&off, &off_inv); + + mat4 rot; + mat4_rotate_zxy(&src_rotation, &rot); + + mat4_mul(&off, &rot, &temp); + mat4_mul(&temp, &off_inv, &rot); + + mat4_get_rotation_zxy(&rot, &dst_rotation); } -void effchrpv_auth_3d_to_mot::add_file_name(const std::string& file, const std::string& category) { - auth_3d_mot_names.insert({ file, category }); +static void set_bone_key_set_ik_target_data(auth_3d_to_mot_data& a2m, + const mat4& parent_mat, const vec3 rotation, RobBlock* block, mot_key_set* key_set, bool add_keys, + BONE_BLK block_id, int32_t& curr_block_id, int32_t skeleton_select, + const vec3& position, const mat4& src, const mat4& dst, const bool disable_rot[3], bool offset = true) { + vec3 data[2]; + if (offset) { + data[0] = position; + mat4_transform_point(&parent_mat, &data[0], &data[0]); + data[1] = rotation; + rotate_euler(src, dst, data[1], data[1]); + + int32_t _curr_block_id = curr_block_id; + set_bone_key_set_data(block, a2m.bone_keys, a2m.sec_bone_keys, false, + block_id, _curr_block_id, skeleton_select, key_set, data, 2); + + data[0] = position; + mat4_transform_point(block[block_id].node[0].mat_ptr, &data[0], &data[0]); + } + else + data[0] = position; + + data[1] = rotation; + rotate_euler(src, dst, data[1], data[1]); + + for (int32_t i = 0; i < 3; i++) + if (disable_rot[i]) + (&data[1].x)[i] = 0.0f; + + set_bone_key_set_data(block, a2m.bone_keys, a2m.sec_bone_keys, add_keys, + block_id, curr_block_id, skeleton_select, key_set, data, 2); +} + +static void set_bone_key_set_arm_ik_target_data(auth_3d_to_mot_data& a2m, auth_3d_object_hrc* oh, + const mat4& kata_mat, const mat4& ude_mat, const mat4& te_mat, + const vec3 c_kata_rotation, RobBlock* block, mot_key_set* key_set, bool add_keys, + BONE_BLK tl_up_kata_index, BONE_BLK c_kata_index, + int32_t& curr_block_id, int32_t skeleton_select) { + vec3 pos_kata; + vec3 pos_ude; + vec3 pos_te; + mat4_get_translation(&kata_mat, &pos_kata); + mat4_get_translation(&ude_mat, &pos_ude); + mat4_get_translation(&te_mat, &pos_te); + + RobBlock* c_kata = &block[c_kata_index]; + float_t arm_length = c_kata->len[0][0] + c_kata->len[1][0]; + vec3 pos_ude_mid = vec3::lerp(pos_kata, pos_te, c_kata->len[0][0] / arm_length); + + vec3 tl_up_kata_dir = pos_ude - pos_ude_mid; + float_t pos_middle_dist = vec3::length(tl_up_kata_dir); + if (pos_middle_dist < 0.00001f) { + const vec3 offset = { 0.0f, 0.3f, 0.0f }; + mat4_transform_vector(&kata_mat, &offset, &tl_up_kata_dir); + } + else + tl_up_kata_dir *= 0.3f / pos_middle_dist; + + vec3 data[2]; + vec3 tl_up_kata_pos = tl_up_kata_dir + pos_ude; + mat4* mat = block[BLK_KL_MUNE_B_WJ].node[0].mat_ptr; + mat4_inverse_transform_point(mat, &tl_up_kata_pos, &data[0]); + set_bone_key_set_data(block, a2m.bone_keys, a2m.sec_bone_keys, add_keys, + tl_up_kata_index, curr_block_id, skeleton_select, key_set, data); + + data[0] = pos_te; + data[1] = c_kata_rotation; + set_bone_key_set_data(block, a2m.bone_keys, a2m.sec_bone_keys, add_keys, + c_kata_index, curr_block_id, skeleton_select, key_set, data, 2); } void effchrpv_auth_3d_to_mot::get_body_anim(int32_t frame, bool add_keys) { + static bool disable_cl_mune_rot[3] = { true, false, true }; + static bool disable_cl_kao_rot[3] = { false, false, true }; + static bool disable_cl_momo_rot[3] = { false, false, true }; + for (auto& i : auth_3d_rob_mot_ids) { rob_chara* rob_chr = rob_chara_array_get(rob_chara_ids[i.first]); auth_3d_to_mot_data& a2m = i.second; @@ -453,70 +572,79 @@ void effchrpv_auth_3d_to_mot::get_body_anim(int32_t frame, bool add_keys) { rob_chr->set_visibility(oh->node[0].model_transform.visible); motion_blend_mot* mot = rob_chr->bone_data->motion_loaded.front(); - ::bone_data* bone_data = mot->bone_data.bones.data(); + RobBlock* block = mot->bone_data.bones.data(); mot_key_set* key_set = mot->mot_key_data.mot.key_sets; + int32_t curr_block_id = 0; + int32_t skeleton_select = mot->mot_key_data.skeleton_select; vec3 data[2]; data[0] = 0.0f; data[1] = oh->node[a2m.gblctr].model_transform.rotation_value; - set_bone_key_set_global_data(bone_data, a2m.bone_keys, a2m.sec_bone_keys, add_keys, + set_bone_key_set_global_data(a2m.bone_keys, a2m.sec_bone_keys, add_keys, mot, key_set, data, 2); data[0] = oh->node[a2m.gblctr].model_transform.translation_value; data[0] += oh->node[a2m.n_hara].model_transform.translation_value; data[1] = oh->node[a2m.n_hara].model_transform.rotation_value; - set_bone_key_set_data(bone_data, a2m.bone_keys, a2m.sec_bone_keys, add_keys, - MOTION_BONE_N_HARA_CP, key_set, data, 2); + set_bone_key_set_data(block, a2m.bone_keys, a2m.sec_bone_keys, add_keys, + BLK_N_HARA_CP, curr_block_id, skeleton_select, key_set, data, 2); data[0] = oh->node[a2m.n_hara_y].model_transform.rotation_value; - set_bone_key_set_data(bone_data, a2m.bone_keys, a2m.sec_bone_keys, add_keys, - MOTION_BONE_KG_HARA_Y, key_set, data); + set_bone_key_set_data(block, a2m.bone_keys, a2m.sec_bone_keys, add_keys, + BLK_KG_HARA_Y, curr_block_id, skeleton_select, key_set, data); data[0] = oh->node[a2m.j_hara_wj].model_transform.rotation_value; - set_bone_key_set_data(bone_data, a2m.bone_keys, a2m.sec_bone_keys, add_keys, - MOTION_BONE_KL_HARA_XZ, key_set, data); + set_bone_key_set_data(block, a2m.bone_keys, a2m.sec_bone_keys, add_keys, + BLK_KL_HARA_XZ, curr_block_id, skeleton_select, key_set, data); data[0] = oh->node[a2m.n_kosi].model_transform.rotation_value; - set_bone_key_set_data(bone_data, a2m.bone_keys, a2m.sec_bone_keys, add_keys, - MOTION_BONE_N_HARA, key_set, data); + set_bone_key_set_data(block, a2m.bone_keys, a2m.sec_bone_keys, add_keys, + BLK_N_HARA, curr_block_id, skeleton_select, key_set, data); - data[0] = { 0.0f, 0.945f, 0.0f }; - mat4_transform_vector(&oh->node[a2m.j_mune_wj].model_transform.mat, &data[0], &data[1]); - mat4_get_translation(&oh->node[a2m.j_mune_wj].model_transform.mat, &data[0]); - data[0] += data[1]; + /*data[0] = { 0.0f, 0.945f, 0.0f }; + mat4_transform_point(&oh->node[a2m.j_mune_wj].model_transform.mat, &data[0], &data[0]); data[1] = 0.0f; - set_bone_key_set_data(bone_data, a2m.bone_keys, a2m.sec_bone_keys, add_keys, - MOTION_BONE_CL_MUNE, key_set, data, 2); + set_bone_key_set_data(block, a2m.bone_keys, a2m.sec_bone_keys, add_keys, + BLK_CL_MUNE, curr_block_id, skeleton_select, key_set, data, 2);*/ + + set_bone_key_set_ik_target_data(a2m, oh->node[a2m.j_mune_wj].model_transform.mat, + oh->node[a2m.j_mune_wj].model_transform.rotation_value, block, key_set, add_keys, + BLK_CL_MUNE, curr_block_id, skeleton_select, + { 0.0f, 0.945f, 0.0f }, n_mune_b_src, n_mune_b_dst, disable_cl_mune_rot); data[0] = oh->node[a2m.j_mune_b_wj].model_transform.rotation_value; - set_bone_key_set_data(bone_data, a2m.bone_keys, a2m.sec_bone_keys, add_keys, - MOTION_BONE_KL_MUNE_B_WJ, key_set, data); + set_bone_key_set_data(block, a2m.bone_keys, a2m.sec_bone_keys, add_keys, + BLK_KL_MUNE_B_WJ, curr_block_id, skeleton_select, key_set, data); data[0] = oh->node[a2m.j_kubi_wj].model_transform.rotation_value; - set_bone_key_set_data(bone_data, a2m.bone_keys, a2m.sec_bone_keys, add_keys, - MOTION_BONE_KL_KUBI, key_set, data); + set_bone_key_set_data(block, a2m.bone_keys, a2m.sec_bone_keys, add_keys, + BLK_KL_KUBI, curr_block_id, skeleton_select, key_set, data); data[0] = { (float_t)(M_PI / 2.0), 0.0f, -(float_t)M_PI }; - set_bone_key_set_data(bone_data, a2m.bone_keys, a2m.sec_bone_keys, add_keys, - MOTION_BONE_N_KAO, key_set, data); + set_bone_key_set_data(block, a2m.bone_keys, a2m.sec_bone_keys, add_keys, + BLK_N_KAO, curr_block_id, skeleton_select, key_set, data); - data[0] = { 0.0f, 0.34f, 0.0f }; - mat4_transform_vector(&oh->node[a2m.j_kao_wj].model_transform.mat, &data[0], &data[1]); - mat4_get_translation(&oh->node[a2m.j_kao_wj].model_transform.mat, &data[0]); - data[0] += data[1]; + /*data[0] = { 0.0f, 0.34f, 0.0f }; + mat4_transform_point(&oh->node[a2m.j_kao_wj].model_transform.mat, &data[0], &data[0]); data[1] = oh->node[a2m.j_kao_wj].model_transform.rotation_value; - data[1].x = -data[1].x; - data[1].z = -data[1].z; - set_bone_key_set_data(bone_data, a2m.bone_keys, a2m.sec_bone_keys, add_keys, - MOTION_BONE_CL_KAO, key_set, data, 2); + //data[1].x = -data[1].x; + //data[1].z = -data[1].z; + //data[1] = 0.0f; + set_bone_key_set_data(block, a2m.bone_keys, a2m.sec_bone_keys, add_keys, + BLK_CL_KAO, curr_block_id, skeleton_select, key_set, data, 2);*/ + + set_bone_key_set_ik_target_data(a2m, oh->node[a2m.j_kao_wj].model_transform.mat, + oh->node[a2m.j_kao_wj].model_transform.rotation_value, block, key_set, add_keys, + BLK_CL_KAO, curr_block_id, skeleton_select, + { 0.0f, 0.34f, 0.0f }, n_kao_src, n_kao_dst, disable_cl_kao_rot); if (a2m.j_eye_r_wj != -1) { data[0] = oh->node[a2m.j_eye_r_wj].model_transform.rotation_value; data[0].x += (float_t)(M_PI / 2.0); data[0].y = -data[0].z; data[0].z = 0.0f; - set_bone_key_set_data(bone_data, a2m.bone_keys, a2m.sec_bone_keys, add_keys, - MOTION_BONE_KL_EYE_R, key_set, data); + set_bone_key_set_data(block, a2m.bone_keys, a2m.sec_bone_keys, add_keys, + BLK_KL_EYE_R, curr_block_id, skeleton_select, key_set, data); } if (a2m.j_eye_l_wj != -1) { @@ -524,135 +652,109 @@ void effchrpv_auth_3d_to_mot::get_body_anim(int32_t frame, bool add_keys) { data[0].x += (float_t)(M_PI / 2.0); data[0].y = -data[0].z; data[0].z = 0.0f; - set_bone_key_set_data(bone_data, a2m.bone_keys, a2m.sec_bone_keys, add_keys, - MOTION_BONE_KL_EYE_L, key_set, data); + set_bone_key_set_data(block, a2m.bone_keys, a2m.sec_bone_keys, add_keys, + BLK_KL_EYE_L, curr_block_id, skeleton_select, key_set, data); } data[0] = oh->node[a2m.n_waki_l].model_transform.rotation_value; - set_bone_key_set_data(bone_data, a2m.bone_keys, a2m.sec_bone_keys, add_keys, - MOTION_BONE_N_WAKI_L, key_set, data); + set_bone_key_set_data(block, a2m.bone_keys, a2m.sec_bone_keys, add_keys, + BLK_N_WAKI_L, curr_block_id, skeleton_select, key_set, data); data[0] = oh->node[a2m.j_waki_l_wj].model_transform.rotation_value; - set_bone_key_set_data(bone_data, a2m.bone_keys, a2m.sec_bone_keys, add_keys, - MOTION_BONE_KL_WAKI_L_WJ, key_set, data); + set_bone_key_set_data(block, a2m.bone_keys, a2m.sec_bone_keys, add_keys, + BLK_KL_WAKI_L_WJ, curr_block_id, skeleton_select, key_set, data); - { - vec3 pos_j_kata_l_wj; - vec3 pos_j_ude_l_wj; - vec3 pos_j_te_l_wj; - mat4_get_translation(&oh->node[a2m.j_kata_l_wj].model_transform.mat, &pos_j_kata_l_wj); - mat4_get_translation(&oh->node[a2m.j_ude_l_wj].model_transform.mat, &pos_j_ude_l_wj); - mat4_get_translation(&oh->node[a2m.j_te_l_wj].model_transform.mat, &pos_j_te_l_wj); - - vec3 tl_up_kata_dir = pos_j_ude_l_wj - vec3::lerp(pos_j_kata_l_wj, pos_j_te_l_wj, 0.5f); - float_t pos_middle_dist = vec3::length(tl_up_kata_dir); - if (pos_middle_dist == 0.0f) { - mat4& mat = oh->node[a2m.j_kata_l_wj].model_transform.mat; - data[0] = { 0.0f, 0.3f, 0.0f }; - mat4_transform_vector(&mat, &data[0], &tl_up_kata_dir); - } - else - tl_up_kata_dir *= 0.3f / pos_middle_dist; - - vec3 tl_up_kata_pos = tl_up_kata_dir + pos_j_ude_l_wj; - mat4& mat = oh->node[a2m.j_mune_b_wj].model_transform.mat; - mat4_inverse_transform_point(&mat, &tl_up_kata_pos, &data[0]); - set_bone_key_set_data(bone_data, a2m.bone_keys, a2m.sec_bone_keys, add_keys, - MOTION_BONE_TL_UP_KATA_L, key_set, data); - } - - mat4_get_translation(&oh->node[a2m.j_te_l_wj].model_transform.mat, &data[0]); - data[1] = { -(float_t)(M_PI / 2.0), -(float_t)(M_PI / 2.0), -(float_t)(M_PI / 2.0) }; - set_bone_key_set_data(bone_data, a2m.bone_keys, a2m.sec_bone_keys, add_keys, - MOTION_BONE_C_KATA_L, key_set, data, 2); + set_bone_key_set_arm_ik_target_data(a2m, oh, + oh->node[a2m.j_kata_l_wj].model_transform.mat, + oh->node[a2m.j_ude_l_wj].model_transform.mat, + oh->node[a2m.j_te_l_wj].model_transform.mat, + { -(float_t)(M_PI / 2.0), -(float_t)(M_PI / 2.0), -(float_t)(M_PI / 2.0) }, + block, key_set, add_keys, BLK_TL_UP_KATA_L, BLK_C_KATA_L, + curr_block_id, skeleton_select); data[0] = oh->node[a2m.j_te_l_wj].model_transform.rotation_value; - set_bone_key_set_data(bone_data, a2m.bone_keys, a2m.sec_bone_keys, add_keys, - MOTION_BONE_KL_TE_L_WJ, key_set, data); + set_bone_key_set_data(block, a2m.bone_keys, a2m.sec_bone_keys, add_keys, + BLK_KL_TE_L_WJ, curr_block_id, skeleton_select, key_set, data); data[0] = oh->node[a2m.n_waki_r].model_transform.rotation_value; - set_bone_key_set_data(bone_data, a2m.bone_keys, a2m.sec_bone_keys, add_keys, - MOTION_BONE_N_WAKI_R, key_set, data); + set_bone_key_set_data(block, a2m.bone_keys, a2m.sec_bone_keys, add_keys, + BLK_N_WAKI_R, curr_block_id, skeleton_select, key_set, data); data[0] = oh->node[a2m.j_waki_r_wj].model_transform.rotation_value; - set_bone_key_set_data(bone_data, a2m.bone_keys, a2m.sec_bone_keys, add_keys, - MOTION_BONE_KL_WAKI_R_WJ, key_set, data); + set_bone_key_set_data(block, a2m.bone_keys, a2m.sec_bone_keys, add_keys, + BLK_KL_WAKI_R_WJ, curr_block_id, skeleton_select, key_set, data); - { - vec3 pos_j_kata_r_wj; - vec3 pos_j_ude_r_wj; - vec3 pos_j_te_r_wj; - mat4_get_translation(&oh->node[a2m.j_kata_r_wj].model_transform.mat, &pos_j_kata_r_wj); - mat4_get_translation(&oh->node[a2m.j_ude_r_wj].model_transform.mat, &pos_j_ude_r_wj); - mat4_get_translation(&oh->node[a2m.j_te_r_wj].model_transform.mat, &pos_j_te_r_wj); - - vec3 tl_up_kata_dir = pos_j_ude_r_wj - vec3::lerp(pos_j_kata_r_wj, pos_j_te_r_wj, 0.5f); - float_t pos_middle_dist = vec3::length(tl_up_kata_dir); - if (pos_middle_dist == 0.0f) { - mat4& mat = oh->node[a2m.j_kata_r_wj].model_transform.mat; - data[0] = { 0.0f, 0.3f, 0.0f }; - mat4_transform_vector(&mat, &data[0], &tl_up_kata_dir); - } - else - tl_up_kata_dir *= 0.3f / pos_middle_dist; - - vec3 tl_up_kata_pos = tl_up_kata_dir + pos_j_ude_r_wj; - mat4& mat = oh->node[a2m.j_mune_b_wj].model_transform.mat; - mat4_inverse_transform_point(&mat, &tl_up_kata_pos, &data[0]); - set_bone_key_set_data(bone_data, a2m.bone_keys, a2m.sec_bone_keys, add_keys, - MOTION_BONE_TL_UP_KATA_R, key_set, data); - } - - mat4_get_translation(&oh->node[a2m.j_te_r_wj].model_transform.mat, &data[0]); - data[1] = { -(float_t)(M_PI / 2.0), (float_t)(M_PI / 2.0), (float_t)(M_PI / 2.0) }; - set_bone_key_set_data(bone_data, a2m.bone_keys, a2m.sec_bone_keys, add_keys, - MOTION_BONE_C_KATA_R, key_set, data, 2); + set_bone_key_set_arm_ik_target_data(a2m, oh, + oh->node[a2m.j_kata_r_wj].model_transform.mat, + oh->node[a2m.j_ude_r_wj].model_transform.mat, + oh->node[a2m.j_te_r_wj].model_transform.mat, + { -(float_t)(M_PI / 2.0), (float_t)(M_PI / 2.0), (float_t)(M_PI / 2.0) }, + block, key_set, add_keys, BLK_TL_UP_KATA_R, BLK_C_KATA_R, + curr_block_id, skeleton_select); data[0] = oh->node[a2m.j_te_r_wj].model_transform.rotation_value; - set_bone_key_set_data(bone_data, a2m.bone_keys, a2m.sec_bone_keys, add_keys, - MOTION_BONE_KL_TE_R_WJ, key_set, data); + set_bone_key_set_data(block, a2m.bone_keys, a2m.sec_bone_keys, add_keys, + BLK_KL_TE_R_WJ, curr_block_id, skeleton_select, key_set, data); data[0] = oh->node[a2m.j_kosi_wj].model_transform.rotation_value; - set_bone_key_set_data(bone_data, a2m.bone_keys, a2m.sec_bone_keys, add_keys, - MOTION_BONE_KL_KOSI_XZ, key_set, data); + set_bone_key_set_data(block, a2m.bone_keys, a2m.sec_bone_keys, add_keys, + BLK_KL_KOSI_XZ, curr_block_id, skeleton_select, key_set, data); - mat4_get_translation(&oh->node[a2m.j_asi_l_wj].model_transform.mat, &data[0]); + /*mat4_get_translation(&oh->node[a2m.j_asi_l_wj].model_transform.mat, &data[0]); data[0].y -= 0.033f; if (data[0].y < 0.103f) data[0].y = 0.103f; data[1] = oh->node[a2m.j_momo_l_wj].model_transform.rotation_value; data[1].z -= (float_t)(M_PI / 2.0); - set_bone_key_set_data(bone_data, a2m.bone_keys, a2m.sec_bone_keys, add_keys, - MOTION_BONE_CL_MOMO_L, key_set, data, 2); + set_bone_key_set_data(block, a2m.bone_keys, a2m.sec_bone_keys, add_keys, + BLK_CL_MOMO_L, curr_block_id, skeleton_select, key_set, data, 2);*/ - mat4_get_translation(&oh->node[a2m.j_asi_r_wj].model_transform.mat, &data[0]); + mat4_get_translation(&oh->node[a2m.j_asi_l_wj].model_transform.mat, &data[0]); + data[0].y -= 0.033f; + if (data[0].y < 0.103f) + data[0].y = 0.103f; + set_bone_key_set_ik_target_data(a2m, oh->node[a2m.j_momo_l_wj].model_transform.mat, + oh->node[a2m.j_momo_l_wj].model_transform.rotation_value, block, key_set, add_keys, + BLK_CL_MOMO_L, curr_block_id, skeleton_select, + data[0], n_momo_l_src, cl_momo_l_dst, disable_cl_momo_rot, false); + + /*mat4_get_translation(&oh->node[a2m.j_asi_r_wj].model_transform.mat, &data[0]); data[0].y -= 0.033f; if (data[0].y < 0.103f) data[0].y = 0.103f; data[1] = oh->node[a2m.j_momo_r_wj].model_transform.rotation_value; data[1].z -= (float_t)(M_PI / 2.0); - set_bone_key_set_data(bone_data, a2m.bone_keys, a2m.sec_bone_keys, add_keys, - MOTION_BONE_CL_MOMO_R, key_set, data, 2); + set_bone_key_set_data(block, a2m.bone_keys, a2m.sec_bone_keys, add_keys, + BLK_CL_MOMO_R, curr_block_id, skeleton_select, key_set, data, 2);*/ + + mat4_get_translation(&oh->node[a2m.j_asi_r_wj].model_transform.mat, &data[0]); + data[0].y -= 0.033f; + if (data[0].y < 0.103f) + data[0].y = 0.103f; + set_bone_key_set_ik_target_data(a2m, oh->node[a2m.j_momo_r_wj].model_transform.mat, + oh->node[a2m.j_momo_r_wj].model_transform.rotation_value, block, key_set, add_keys, + BLK_CL_MOMO_R, curr_block_id, skeleton_select, + data[0], n_momo_r_src, cl_momo_r_dst, disable_cl_momo_rot, false); data[0] = oh->node[a2m.j_asi_l_wj].model_transform.rotation_value; - set_bone_key_set_data(bone_data, a2m.bone_keys, a2m.sec_bone_keys, add_keys, - MOTION_BONE_KL_ASI_L_WJ_CO, key_set, data); + set_bone_key_set_data(block, a2m.bone_keys, a2m.sec_bone_keys, add_keys, + BLK_KL_ASI_L_WJ_CO, curr_block_id, skeleton_select, key_set, data); data[0] = oh->node[a2m.j_asi_r_wj].model_transform.rotation_value; - set_bone_key_set_data(bone_data, a2m.bone_keys, a2m.sec_bone_keys, add_keys, - MOTION_BONE_KL_ASI_R_WJ_CO, key_set, data); + set_bone_key_set_data(block, a2m.bone_keys, a2m.sec_bone_keys, add_keys, + BLK_KL_ASI_R_WJ_CO, curr_block_id, skeleton_select, key_set, data); data[0] = { 0.0491406508f, 0.0f, 0.0f }; - set_bone_key_set_data(bone_data, a2m.bone_keys, a2m.sec_bone_keys, add_keys, - MOTION_BONE_KL_AGO_WJ, key_set, data); + set_bone_key_set_data(block, a2m.bone_keys, a2m.sec_bone_keys, add_keys, + BLK_KL_AGO_WJ, curr_block_id, skeleton_select, key_set, data); data[0] = { 0.0f, 0.0331281610f, 0.0f }; - set_bone_key_set_data(bone_data, a2m.bone_keys, a2m.sec_bone_keys, add_keys, - MOTION_BONE_N_KUBI_WJ_EX, key_set, data); + set_bone_key_set_data(block, a2m.bone_keys, a2m.sec_bone_keys, add_keys, + BLK_N_KUBI_WJ_EX, curr_block_id, skeleton_select, key_set, data); - auth->frame = auth_frame; - auth->frame_changed = auth_frame_changed; - auth->paused = auth_paused; + //auth->frame = auth_frame; + //auth->frame_changed = auth_frame_changed; + //auth->paused = auth_paused; } } @@ -663,27 +765,25 @@ void effchrpv_auth_3d_to_mot::get_hand_anim(int32_t frame) { rob_chara_bone_data* rob_bone_data = rob_chr->bone_data; - bone_database_skeleton_type skeleton_type = rob_bone_data->base_skeleton_type; + BONE_KIND skeleton_type = rob_bone_data->base_skeleton_type; motion_blend_mot* mot = rob_bone_data->motion_loaded.front(); - prj::sys_vector* bones = &mot->bone_data.bones; + prj::sys_vector* bones = &mot->bone_data.bones; prj::sys_vector* bone_indices = &mot->bone_data.bone_indices; - bone_data* bones_data = bones->data(); + RobBlock* bones_data = bones->data(); for (uint16_t& i : *bone_indices) { - bone_data* data = &bones_data[i]; - ::motion_bone_index motion_bone_index = (::motion_bone_index)data->motion_bone_index; - if (!(motion_bone_index >= MOTION_BONE_N_HITO_L_EX - && motion_bone_index <= MOTION_BONE_NL_OYA_C_L_WJ - || motion_bone_index >= MOTION_BONE_N_HITO_R_EX - && motion_bone_index <= MOTION_BONE_NL_OYA_C_R_WJ)) + RobBlock* data = &bones_data[i]; + BONE_BLK block_id = (BONE_BLK)data->block_id; + if (!(block_id >= BLK_N_HITO_L_EX && block_id <= BLK_NL_OYA_C_L_WJ + || block_id >= BLK_N_HITO_R_EX && block_id <= BLK_NL_OYA_C_R_WJ)) continue; - auto elem = a2m.bone_keys.find(motion_bone_index); + auto elem = a2m.bone_keys.find(block_id); if (elem == a2m.bone_keys.end()) - elem = a2m.bone_keys.insert({ motion_bone_index, {} }).first; + elem = a2m.bone_keys.insert({ block_id, {} }).first; vec3 rotation; - mat4_get_rotation_zyx(&data->rot_mat[0], &rotation); + mat4_get_rotation_zyx(&data->chain_rot[0], &rotation); if (elem->second.x.size() == frame) elem->second.x.push_back(rotation.x); if (elem->second.y.size() == frame) @@ -737,6 +837,75 @@ void effchrpv_auth_3d_to_mot::load(int32_t frame) { id.set_visibility(true); id.set_req_frame(0.0f); } + + auto round_mat = [](mat4& mat) { + mat.row0.x = prj::roundf(mat.row0.x); + mat.row0.y = prj::roundf(mat.row0.y); + mat.row0.z = prj::roundf(mat.row0.z); + mat.row0.w = prj::roundf(mat.row0.w); + mat.row1.x = prj::roundf(mat.row1.x); + mat.row1.y = prj::roundf(mat.row1.y); + mat.row1.z = prj::roundf(mat.row1.z); + mat.row1.w = prj::roundf(mat.row1.w); + mat.row2.x = prj::roundf(mat.row2.x); + mat.row2.y = prj::roundf(mat.row2.y); + mat.row2.z = prj::roundf(mat.row2.z); + mat.row2.w = prj::roundf(mat.row2.w); + mat.row3.x = prj::roundf(mat.row3.x); + mat.row3.y = prj::roundf(mat.row3.y); + mat.row3.z = prj::roundf(mat.row3.z); + mat.row3.w = prj::roundf(mat.row3.w); + }; + + constexpr float_t h_pi = (float_t)(M_PI / 2.0); + constexpr float_t f_pi = (float_t)M_PI; + + mat4 temp; + n_hara_cp_src = mat4_identity; + mat4_rotate_zyx(0.0f, h_pi, 0.0f, &temp); + mat4_mul(&temp, &n_hara_cp_src, &n_hara_src); + mat4_rotate_zyx(0.0f, -h_pi, 0.0f, &temp); + mat4_mul(&temp, &n_hara_src, &n_mune_b_src); + mat4_rotate_zyx(h_pi, 0.0f, 0.0f, &temp); + mat4_mul(&temp, &n_mune_b_src, &n_kao_src); + mat4_rotate_zyx(0.0f, 0.0f, -h_pi, &temp); + mat4_mul(&temp, &n_hara_src, &n_momo_l_src); + mat4_rotate_zyx(0.0f, 0.0f, -h_pi, &temp); + mat4_mul(&temp, &n_hara_src, &n_momo_r_src); + + n_hara_cp_dst = mat4_identity; + mat4_rotate_zyx(0.0f, h_pi, 0.0f, &temp); + mat4_mul(&temp, &n_hara_cp_dst, &n_hara_dst); + mat4_rotate_zyx(0.0f, 0.0f, 0.0f, &temp); + mat4_mul(&temp, &n_hara_dst, &cl_mune_dst); + mat4 j_mune_wj_dst; + mat4_rotate_zyx(0.0f, 0.0f, h_pi, &temp); + mat4_mul(&temp, &cl_mune_dst, &j_mune_wj_dst); + mat4_rotate_zyx(0.0f, -h_pi, -h_pi, &temp); + mat4_mul(&temp, &j_mune_wj_dst, &n_mune_b_dst); + mat4_rotate_zyx(h_pi, 0.0f, -f_pi, &temp); + mat4_mul(&temp, &n_mune_b_dst, &n_kao_dst); + mat4_rotate_zyx(0.0f, 0.0f, 0.0f, &temp); + mat4_mul(&temp, &n_kao_dst, &cl_kao_dst); + mat4_rotate_zyx(0.0f, 0.0f, 0.0f, &temp); + mat4_mul(&temp, &n_hara_dst, &cl_momo_l_dst); + mat4_rotate_zyx(0.0f, 0.0f, 0.0f, &temp); + mat4_mul(&temp, &n_hara_dst, &cl_momo_r_dst); + + round_mat(n_hara_cp_src); + round_mat(n_hara_src); + round_mat(n_mune_b_src); + round_mat(n_kao_src); + round_mat(n_momo_l_src); + round_mat(n_momo_r_src); + + round_mat(n_hara_dst); + round_mat(cl_mune_dst); + round_mat(n_mune_b_dst); + round_mat(n_kao_dst); + round_mat(cl_kao_dst); + round_mat(cl_momo_l_dst); + round_mat(cl_momo_r_dst); } void effchrpv_auth_3d_to_mot::modify_play_param(pvpp* play_param) { @@ -776,7 +945,7 @@ static void fix_rotation(std::vector& vec) { if (vec.size() < 2) return; - const float_t half_pi = (float_t)(M_PI / 2.0); + const float_t h_pi = (float_t)(M_PI / 2.0); int32_t curr_rot = 0; float_t rot_fix = 0.0f; @@ -785,11 +954,11 @@ static void fix_rotation(std::vector& vec) { float_t* i_end = vec.data() + vec.size(); for (float_t* i = i_begin; i != i_end; i++) { float_t rot = *i; - if (rot < -half_pi && rot_prev > half_pi && fabsf(rot - rot_prev) > half_pi) { + if (rot < -h_pi && rot_prev > h_pi && fabsf(rot - rot_prev) > h_pi) { curr_rot++; rot_fix = (float_t)(M_PI * 2.0 * (double_t)curr_rot); } - else if (rot > half_pi && rot_prev < -half_pi && fabsf(rot - rot_prev) > half_pi) { + else if (rot > h_pi && rot_prev < -h_pi && fabsf(rot - rot_prev) > h_pi) { curr_rot--; rot_fix = (float_t)(M_PI * 2.0 * (double_t)curr_rot); } @@ -870,9 +1039,8 @@ static void mot_write_motion(mot_data_bake_data* bake_data) { if (!key_set_count) return; - const char* name = bone_database_skeleton_type_to_string(BONE_DATABASE_SKELETON_COMMON); - std::string* bone_names = aft_mot_db->bone_name.data(); - const std::vector* bones = aft_bone_data->get_skeleton_bones(name); + std::string* bone_name = aft_mot_db->bone_name.data(); + const std::vector* bones = aft_bone_data->get_body_type(BONE_KIND_CMN); if (!bones) return; @@ -880,23 +1048,23 @@ static void mot_write_motion(mot_data_bake_data* bake_data) { auth_3d_to_mot_data& a2m = *bake_data->data; const mot_bone_info* bone_info = mot_data->bone_info_array; for (size_t key_set_offset = 0, i = 0; key_set_offset < key_set_count; i++) { - motion_bone_index bone_index = (motion_bone_index)aft_bone_data->get_skeleton_bone_index( - name, bone_names[bone_info[i].index].c_str()); + BONE_BLK bone_index = (BONE_BLK)aft_bone_data->get_block_index( + BONE_KIND_CMN, bone_name[bone_info[i].index].c_str()); if (bone_index == -1) { i++; - bone_index = (motion_bone_index)aft_bone_data->get_skeleton_bone_index( - name, bone_names[bone_info[i].index].c_str()); + bone_index = (BONE_BLK)aft_bone_data->get_block_index( + BONE_KIND_CMN, bone_name[bone_info[i].index].c_str()); if (bone_index == -1) break; } - const bone_database_bone* bone = &(*bones)[bone_index]; + const BODYTYPE* bone = &(*bones)[bone_index]; auto elem = a2m.bone_keys.find(bone_index); if (elem != a2m.bone_keys.end()) { auth_3d_to_mot_keys& keys = elem->second; - if (bone->type == BONE_DATABASE_BONE_ROTATION) { + if (bone->ik_type == IKT_0) { fix_rotation(keys.x); fix_rotation(keys.y); fix_rotation(keys.z); @@ -966,7 +1134,7 @@ static void mot_write_motion(mot_data_bake_data* bake_data) { key_set_data_z.data_type = MOT_KEY_SET_DATA_F32; } - if (bone_index == MOTION_BONE_KL_AGO_WJ) { + if (bone_index == BLK_KL_AGO_WJ) { mot_key_set_data& key_set_data_x = mot_data->key_set_array[key_set_offset]; key_set_data_x.frames = 0; { @@ -992,7 +1160,7 @@ static void mot_write_motion(mot_data_bake_data* bake_data) { key_set_data_z.keys_count = 0; key_set_data_z.data_type = MOT_KEY_SET_DATA_F32; } - else if (bone_index == MOTION_BONE_N_KUBI_WJ_EX) { + else if (bone_index == BLK_N_KUBI_WJ_EX) { mot_key_set_data& key_set_data_x = mot_data->key_set_array[key_set_offset]; key_set_data_x.frames = 0; key_set_data_x.values = 0; @@ -1019,10 +1187,7 @@ static void mot_write_motion(mot_data_bake_data* bake_data) { key_set_data_z.data_type = MOT_KEY_SET_DATA_F32; } - if (bone->type >= BONE_DATABASE_BONE_POSITION_ROTATION) - key_set_offset += 6; - else - key_set_offset += 3; + key_set_offset += bone->ik_type >= IKT_ROOT ? 6 : 3; } bake_data->state = 0; diff --git a/src/ReDIVA/data_process/effchrpv_auth_3d_to_mot.hpp b/src/ReDIVA/data_process/effchrpv_auth_3d_to_mot.hpp index 948a702a..07f9357d 100644 --- a/src/ReDIVA/data_process/effchrpv_auth_3d_to_mot.hpp +++ b/src/ReDIVA/data_process/effchrpv_auth_3d_to_mot.hpp @@ -11,6 +11,7 @@ extern void effchrpv_auth_3d_to_mot_init(int32_t pv_id, const int32_t* rob_chara_ids); extern void effchrpv_auth_3d_to_mot_add_chara_effect_auth_3d(uint32_t hash, int32_t id); extern void effchrpv_auth_3d_to_mot_add_file_name(const std::string& file, const std::string& category); +extern void effchrpv_auth_3d_to_mot_disp(); extern void effchrpv_auth_3d_to_mot_get_body_anim(int32_t frame, bool add_keys); extern void effchrpv_auth_3d_to_mot_get_hand_anim(int32_t frame); extern void effchrpv_auth_3d_to_mot_load(int32_t frame); diff --git a/src/ReDIVA/data_test/auth_3d_test.cpp b/src/ReDIVA/data_test/auth_3d_test.cpp index 9a4268cc..3ab9973c 100644 --- a/src/ReDIVA/data_test/auth_3d_test.cpp +++ b/src/ReDIVA/data_test/auth_3d_test.cpp @@ -44,7 +44,7 @@ public: void Hide() override; - void GetCharaCos(::chara_index chara_index, int32_t chara_id, dw::ListBox* list_box); + void GetCharaCos(CHARA_NUM chara_index, int32_t chara_id, dw::ListBox* list_box); }; class Auth3dTestSubWindow : public dw::Shell { @@ -317,7 +317,7 @@ static void auth_3d_test_window_init(); static const char* get_dev_ram_ss_dir(); Auth3dTestTask::DataEventListener::Data::Data() : state(), field_C(), field_D(), -load_chara_index(), chara_index(), prev_chara_index(), load_cos_id(), cos_id(), chara_visible() { +load_chara_num(), chara_num(), prev_chara_num(), load_cos_id(), cos_id(), chara_visible() { } @@ -328,21 +328,21 @@ Auth3dTestTask::DataEventListener::Data::~Data() { void Auth3dTestTask::DataEventListener::Data::ctrl() { if ((state == 0 || state == 1 || state == 4) && field_C) { - if (chara_index[0] == CHARA_MAX && chara_index[1] == CHARA_MAX) + if (chara_num[0] == CN_MAX && chara_num[1] == CN_MAX) field_C = false; else { for (int32_t i = 0; i < 2; i++) { - if (chara_index[i] != CHARA_MAX) { - ::chara_index v5 = chara_index[i]; - ::chara_index v6 = load_chara_index[i]; - chara_index[i] = CHARA_MAX; - load_chara_index[i] = v5; - prev_chara_index[i] = v6; + if (chara_num[i] != CN_MAX) { + CHARA_NUM v5 = chara_num[i]; + CHARA_NUM v6 = load_chara_num[i]; + chara_num[i] = CN_MAX; + load_chara_num[i] = v5; + prev_chara_num[i] = v6; cos_id[i] = load_cos_id[i]; } - if (load_chara_index[i] == CHARA_MAX) - load_chara_index[i] = CHARA_MIKU; + if (load_chara_num[i] == CN_MAX) + load_chara_num[i] = CN_MIKU; } if (field_D) { @@ -360,16 +360,16 @@ void Auth3dTestTask::DataEventListener::Data::ctrl() { if (state == 1) { bool wait_load_chara_1p = false; bool wait_load_chara_2p = false; - if (load_chara_index[0] < CHARA_MAX) { - const chara_init_data* chara_init_data = chara_init_data_get(load_chara_index[0]); - wait_load_chara_1p = motion_storage_check_mot_file_not_ready(chara_init_data->field_820) - || mothead_storage_check_mhd_file_not_ready(chara_init_data->field_820); + if (load_chara_num[0] < CN_MAX) { + const RobData* rob_data = get_rob_data(load_chara_num[0]); + wait_load_chara_1p = motion_storage_check_mot_file_not_ready(rob_data->motfile_auth) + || mothead_storage_check_mhd_file_not_ready(rob_data->motfile_auth); } - if (load_chara_index[1] < CHARA_MAX) { - const chara_init_data* chara_init_data = chara_init_data_get(load_chara_index[1]); - wait_load_chara_2p = motion_storage_check_mot_file_not_ready(chara_init_data->field_820) - || mothead_storage_check_mhd_file_not_ready(chara_init_data->field_820); + if (load_chara_num[1] < CN_MAX) { + const RobData* rob_data = get_rob_data(load_chara_num[1]); + wait_load_chara_2p = motion_storage_check_mot_file_not_ready(rob_data->motfile_auth) + || mothead_storage_check_mhd_file_not_ready(rob_data->motfile_auth); } if (!task_rob_manager_get_free_chara_list_empty() && !wait_load_chara_1p && !wait_load_chara_2p) @@ -379,8 +379,8 @@ void Auth3dTestTask::DataEventListener::Data::ctrl() { if (state == 2) { state = 4; - dtm_eq_vs[0].SetCharaIndexCosId(load_chara_index[0], load_cos_id[0]); - dtm_eq_vs[1].SetCharaIndexCosId(load_chara_index[1], load_cos_id[1]); + dtm_eq_vs[0].SetCharaNumCosId(load_chara_num[0], load_cos_id[0]); + dtm_eq_vs[1].SetCharaNumCosId(load_chara_num[1], load_cos_id[1]); if (state == 4) { @@ -403,18 +403,18 @@ void Auth3dTestTask::DataEventListener::Data::dest() { inline void Auth3dTestTask::DataEventListener::Data::free_all_chara() { task_rob_manager_free_all_chara(); - if (prev_chara_index[0] < CHARA_MAX) { - const chara_init_data* chara_init_data = chara_init_data_get(prev_chara_index[0]); - motion_set_unload_motion(chara_init_data->field_820); - motion_set_unload_mothead(chara_init_data->field_820); - prev_chara_index[0] = CHARA_MAX; + if (prev_chara_num[0] < CN_MAX) { + const RobData* rob_data = get_rob_data(prev_chara_num[0]); + motion_set_unload_motion(rob_data->motfile_auth); + motion_set_unload_mothead(rob_data->motfile_auth); + prev_chara_num[0] = CN_MAX; } - if (prev_chara_index[1] < CHARA_MAX) { - const chara_init_data* chara_init_data = chara_init_data_get(prev_chara_index[1]); - motion_set_unload_motion(chara_init_data->field_820); - motion_set_unload_mothead(chara_init_data->field_820); - prev_chara_index[1] = CHARA_MAX; + if (prev_chara_num[1] < CN_MAX) { + const RobData* rob_data = get_rob_data(prev_chara_num[1]); + motion_set_unload_motion(rob_data->motfile_auth); + motion_set_unload_mothead(rob_data->motfile_auth); + prev_chara_num[1] = CN_MAX; } } @@ -426,13 +426,13 @@ void Auth3dTestTask::DataEventListener::Data::init() { field_D = false; state = 0; - load_chara_index[0] = CHARA_MAX; - load_chara_index[1] = CHARA_MAX; - chara_index[0] = CHARA_MAX; - chara_index[1] = CHARA_MAX; + load_chara_num[0] = CN_MAX; + load_chara_num[1] = CN_MAX; + chara_num[0] = CN_MAX; + chara_num[1] = CN_MAX; - prev_chara_index[0] = CHARA_MAX; - prev_chara_index[1] = CHARA_MAX; + prev_chara_num[0] = CN_MAX; + prev_chara_num[1] = CN_MAX; load_cos_id[0] = 0; load_cos_id[1] = 0; @@ -440,10 +440,10 @@ void Auth3dTestTask::DataEventListener::Data::init() { cos_id[0] = 0; cos_id[1] = 0; - dtm_eq_vs[0].add_task(0, CHARA_MIKU); - dtm_eq_vs[1].add_task(1, CHARA_MIKU); + dtm_eq_vs[0].add_task(0, CN_MIKU); + dtm_eq_vs[1].add_task(1, CN_MIKU); - chara_index[0] = CHARA_MIKU; + chara_num[0] = CN_MIKU; field_C = true; } @@ -453,19 +453,19 @@ void Auth3dTestTask::DataEventListener::Data::sub_140244E20() { rob_chara_pv_data pv_data; pv_data.field_4 = false; - rob_chara_array_init_chara_index(load_chara_index[0], pv_data, load_cos_id[0], true); - rob_chara_array_init_chara_index(load_chara_index[1], pv_data, load_cos_id[1], true); + rob_chara_array_init_chara_num(load_chara_num[0], pv_data, load_cos_id[0], true); + rob_chara_array_init_chara_num(load_chara_num[1], pv_data, load_cos_id[1], true); - if (load_chara_index[0] < CHARA_MAX) { - const chara_init_data* chara_init_data = chara_init_data_get(load_chara_index[0]); - motion_set_load_motion(chara_init_data->field_820, "", aft_mot_db); - motion_set_load_mothead(chara_init_data->field_820, "", aft_mot_db); + if (load_chara_num[0] < CN_MAX) { + const RobData* rob_data = get_rob_data(load_chara_num[0]); + motion_set_load_motion(rob_data->motfile_auth, "", aft_mot_db); + motion_set_load_mothead(rob_data->motfile_auth, "", aft_mot_db); } - if (load_chara_index[1] < CHARA_MAX) { - const chara_init_data* chara_init_data = chara_init_data_get(load_chara_index[1]); - motion_set_load_motion(chara_init_data->field_820, "", aft_mot_db); - motion_set_load_mothead(chara_init_data->field_820, "", aft_mot_db); + if (load_chara_num[1] < CN_MAX) { + const RobData* rob_data = get_rob_data(load_chara_num[1]); + motion_set_load_motion(rob_data->motfile_auth, "", aft_mot_db); + motion_set_load_mothead(rob_data->motfile_auth, "", aft_mot_db); } field_C = false; @@ -498,11 +498,11 @@ void Auth3dTestTask::DataEventListener::OnLoad(::auth_3d_id& id) { for (size_t i = 0; i < chara_count; i++) { auth_3d_chara* chara = id.get_chara(i); if (chara) { - ::chara_index chara_index = chara_index_get_from_chara_name(chara->name.c_str()); - if (chara_index != CHARA_MAX) { - auth_3d_test_task->data_event_listener.data.chara_index[i ? 1 : 0] = chara_index; + CHARA_NUM chara_index = get_chara_num_from_char_id(chara->name.c_str()); + if (chara_index != CN_MAX) { + auth_3d_test_task->data_event_listener.data.chara_num[i ? 1 : 0] = chara_index; auth_3d_test_task->data_event_listener.data.field_C = true; - id.set_chara_index(i, i ? 1 : 0); + id.set_chara_num(i, i ? 1 : 0); auth_3d_test_window->rob_window->chara_list[i]->SetItemIndex(chara_index); auth_3d_test_task->DispAuth3dChara(id); } @@ -728,12 +728,12 @@ void Auth3dTestTask::disp() { void Auth3dTestTask::DispAuth3dChara(::auth_3d_id& id) { id.get_uid(); // ??? - rob_chara_item_equip* rob_itm_equip = rob_chara_array_get_item_equip(0); - if (!rob_itm_equip) + rob_chara_item_equip* rob_disp = rob_chara_array_get_rob_disp(0); + if (!rob_disp) return; - for (int32_t i = ITEM_KAMI; i < ITEM_MAX; i++) - rob_itm_equip->set_disp((item_id)i, true); + for (int32_t i = RPK_ITEM_BEGIN; i <= RPK_ITEM_END; i++) + rob_disp->set_disp((ROB_PARTS_KIND)i, true); } void Auth3dTestTask::DispChara() { @@ -932,11 +932,11 @@ Auth3dTestRobWindow::SelectionListRob::~SelectionListRob() { void Auth3dTestRobWindow::SelectionListRob::Callback(dw::SelectionListener::CallbackData* data) { dw::ListBox* list_box = dynamic_cast(data->widget); if (list_box) { - ::chara_index chara_index = (::chara_index)list_box->list->selected_item; + CHARA_NUM chara_index = (CHARA_NUM)list_box->list->selected_item; int32_t chara_id = list_box->callback_data.i64 ? 1 : 0; auth_3d_test_task->data_event_listener.data - .chara_index[list_box->callback_data.i64 != 0] = chara_index; + .chara_num[list_box->callback_data.i64 != 0] = chara_index; auth_3d_test_task->data_event_listener.data.field_C = true; Auth3dTestRobWindow* rob_window = dynamic_cast(list_box->parent_comp); @@ -962,8 +962,8 @@ void Auth3dTestRobWindow::SelectionListDispStyle::Callback(dw::SelectionListener Auth3dTestRobWindow* rob_window = dynamic_cast(list_box->parent_comp); if (rob_window) { - ::chara_index chara_index = (::chara_index)rob_window->chara_list[chara_id]->list->selected_item; - auth_3d_test_task->data_event_listener.data.chara_index[chara_id] = chara_index; + CHARA_NUM chara_index = (CHARA_NUM)rob_window->chara_list[chara_id]->list->selected_item; + auth_3d_test_task->data_event_listener.data.chara_num[chara_id] = chara_index; auth_3d_test_task->data_event_listener.data.field_C = true; rob_window->GetCharaCos(chara_index, chara_id, rob_window->costume_list[chara_id]); list_box->SetItemIndex(selected_item); @@ -982,15 +982,15 @@ Auth3dTestRobWindow::Auth3dTestRobWindow() : chara_list(), costume_list()/*, fie dw::ListBox* chara_list = new dw::ListBox(this); chara_list->SetText("CHARAlist"); - for (int32_t i = 0; i < CHARA_MAX; i++) - chara_list->AddItem(chara_index_get_name((chara_index)i)); + for (int32_t i = 0; i < CN_MAX; i++) + chara_list->AddItem(get_chara_name_full((CHARA_NUM)i)); chara_list->AddSelectionListener(&selection_list_rob); chara_list->callback_data.i64 = 0; this->chara_list[0] = chara_list; dw::ListBox* costume_list = new dw::ListBox(this); costume_list->SetText("COSTUMElist"); - GetCharaCos(CHARA_MIKU, 0, costume_list); + GetCharaCos(CN_MIKU, 0, costume_list); costume_list->AddSelectionListener(&selection_list_disp_style); costume_list->callback_data.i64 = 0; costume_list->list->SetItemIndex(0); @@ -1009,7 +1009,7 @@ void Auth3dTestRobWindow::Hide() { SetDisp(); } -void Auth3dTestRobWindow::GetCharaCos(::chara_index chara_index, int32_t chara_id, dw::ListBox* list_box) { +void Auth3dTestRobWindow::GetCharaCos(CHARA_NUM chara_index, int32_t chara_id, dw::ListBox* list_box) { list_box->ClearItems(); for (const auto& i : item_table_handler_array_get_table(chara_index)->cos) { @@ -1517,7 +1517,7 @@ Auth3dTestWindow::Auth3dTestWindow() { for (auth_3d_database_category& i : aft_auth_3d_db->category) { category_list->AddItem(i.name); - if (chara_index_get_from_chara_name(i.name.c_str()) != CHARA_MAX) + if (get_chara_num_from_char_id(i.name.c_str()) != CN_MAX) chara_categories.push_back(i.name); else if (!i.name.find("STG")) stg_categories.push_back(i.name); diff --git a/src/ReDIVA/data_test/auth_3d_test.hpp b/src/ReDIVA/data_test/auth_3d_test.hpp index 893dc169..d992b378 100644 --- a/src/ReDIVA/data_test/auth_3d_test.hpp +++ b/src/ReDIVA/data_test/auth_3d_test.hpp @@ -20,9 +20,9 @@ public: int32_t state; bool field_C; bool field_D; - ::chara_index load_chara_index[2]; - ::chara_index chara_index[2]; - ::chara_index prev_chara_index[2]; + CHARA_NUM load_chara_num[2]; + CHARA_NUM chara_num[2]; + CHARA_NUM prev_chara_num[2]; int32_t load_cos_id[2]; int32_t cos_id[2]; DtmEqVs dtm_eq_vs[2]; diff --git a/src/ReDIVA/data_test/equip_test.cpp b/src/ReDIVA/data_test/equip_test.cpp index d6555fe1..c6ab1371 100644 --- a/src/ReDIVA/data_test/equip_test.cpp +++ b/src/ReDIVA/data_test/equip_test.cpp @@ -21,7 +21,7 @@ public: bool refresh; int32_t item_no; const item_cos_data* cos; - chara_index chara_index; + CHARA_NUM chara_num; int32_t cos_id; bool update_item; int32_t disp_parts; @@ -43,7 +43,7 @@ public: }; int32_t chara_id; - Data data[ROB_CHARA_COUNT]; + Data data[ROB_ID_MAX]; Item item; DataTestEquipDw(); @@ -53,7 +53,7 @@ public: void DataReset(int32_t chara_id); int32_t GetCharaID(); - chara_index GetCharaIndex(int32_t chara_id); + CHARA_NUM GetCharaNum(int32_t chara_id); const item_cos_data* GetCos(int32_t chara_id); int32_t GetCosId(int32_t chara_id); int32_t GetCurrentCharaItem(int32_t chara_id, dw::Widget* data); @@ -68,8 +68,8 @@ public: void ResetCharaItemCos(int32_t chara_id); void SetCharaDisp(int32_t chara_id, bool value); void SetCharaID(int32_t value); - void SetCharaIndex(int32_t chara_id, ::chara_index chara_index); void SetCharaItemCos(int32_t chara_id, const item_cos_data* cos); + void SetCharaNum(int32_t chara_id, CHARA_NUM chara_num); void SetCos(int32_t chara_id, const item_cos_data* cos); void SetCosId(int32_t chara_id, int32_t cos_id); void SetCurrentItemNo(int32_t chara_id, dw::Widget* data, int32_t value); @@ -113,15 +113,15 @@ DtmEqVs* dtm_eq_vs_array; DataTestEquipDw* data_test_equip_dw; int32_t data_test_item_array_load_count; -std::vector data_test_item_array[CHARA_MAX][ITEM_SUB_MAX]; +std::vector data_test_item_array[CN_MAX][ITEM_SUB_MAX]; int32_t data_test_item_equip_array_load_count; -std::vector data_test_item_equip_array[CHARA_MAX][5]; +std::vector data_test_item_equip_array[CN_MAX][5]; -chara_index data_test_equip_dw_chara_index_array[ROB_CHARA_COUNT]; +CHARA_NUM data_test_equip_dw_chara_index_array[ROB_ID_MAX]; static int32_t data_test_equip_dw_get_disp_parts(int32_t chara_id); -static void data_test_equip_dw_set_chara_index(int32_t chara_id, chara_index chara_index); +static void data_test_equip_dw_set_chara_num(int32_t chara_id, CHARA_NUM chara_num); static void data_test_equip_dw_set_chara_item_cos(int32_t chara_id, const item_cos_data* cos); static const item_cos_data* data_test_equip_dw_get_cos(int32_t chara_id); static int32_t data_test_equip_dw_get_item_no(int32_t chara_id); @@ -131,18 +131,18 @@ static void data_test_equip_dw_reset_chara_item_cos(int32_t chara_id); static void data_test_equip_dw_set_cos_id(int32_t chara_id, int32_t cos); static void data_test_equip_dw_sub_140261520(int32_t chara_id); -static std::vector* data_test_item_array_get(::chara_index chara_index); +static std::vector* data_test_item_array_get(CHARA_NUM chara_num); static void data_test_item_array_load(); static void data_test_item_array_unload(); -static std::vector* data_test_item_equip_array_get(::chara_index chara_index); +static std::vector* data_test_item_equip_array_get(CHARA_NUM chara_num); static void data_test_item_equip_array_load(); static void data_test_item_equip_array_unload(); -static int32_t data_test_item_get_item_equip(chara_index chara_index, int32_t item_no); +static int32_t data_test_item_get_item_equip(CHARA_NUM chara_num, int32_t item_no); -DtmEqVs::DtmEqVs() : chara_id(), chara_index(), -curr_chara_index(), cos_id(), curr_cos_id(), disp_parts() { +DtmEqVs::DtmEqVs() : chara_id(), chara_num(), +curr_chara_num(), cos_id(), curr_cos_id(), disp_parts() { state = -1; } @@ -175,18 +175,18 @@ bool DtmEqVs::ctrl() { bool reload = false; if (data_test_equip_dw_get_set_item_no(chara_id)) { - item_cos_data->set_chara_index_item(chara_index, item_no); + item_cos_data->set_chara_num_item(chara_num, item_no); reload = true; } if (data_test_equip_dw_get_reset_item_no(chara_id)) { - item_cos_data->set_chara_index_item_zero(chara_index, item_no); + item_cos_data->set_chara_num_item_zero(chara_num, item_no); reload = true; } const ::item_cos_data* cos = data_test_equip_dw_get_cos(chara_id); if (cos) { - item_cos_data->set_chara_index_item_nos(chara_index, cos->arr); + item_cos_data->set_chara_num_item_nos(chara_num, cos->arr); reload = true; } @@ -199,7 +199,7 @@ bool DtmEqVs::ctrl() { if (reload) { if (rob_chr) - task_rob_load_append_free_req_data_obj(rob_chr->chara_index, &temp_cos); + task_rob_load_append_free_req_data_obj(rob_chr->chara_num, &temp_cos); rob_chara_array_reset_bone_data_item_equip(chara_id); task_rob_manager_hide_task(); state = 1; @@ -208,7 +208,7 @@ bool DtmEqVs::ctrl() { break; case 1: if (rob_chr) { - task_rob_load_append_load_req_data_obj(rob_chr->chara_index, rob_chr->item_cos_data.get_cos()); + task_rob_load_append_load_req_data_obj(rob_chr->chara_num, rob_chr->item_cos_data.get_cos()); state = 2; } break; @@ -234,14 +234,14 @@ bool DtmEqVs::dest() { return true; } -bool DtmEqVs::add_task(int32_t chara_id, ::chara_index chara_index) { +bool DtmEqVs::add_task(int32_t chara_id, CHARA_NUM chara_num) { this->chara_id = chara_id; - this->chara_index = chara_index; - this->curr_chara_index = chara_index; + this->chara_num = chara_num; + this->curr_chara_num = chara_num; cos_id = 0; curr_cos_id = 0; disp_parts = 0; - data_test_equip_dw_set_chara_index(chara_id, chara_index); + data_test_equip_dw_set_chara_num(chara_id, chara_num); data_test_equip_dw_set_cos_id(chara_id, cos_id); return app::TaskWork::add_task(this, "DATA TEST EQUIP MANAGER FOR VS"); } @@ -250,20 +250,20 @@ bool DtmEqVs::del_task() { return app::Task::del(); } -void DtmEqVs::SetCharaIndexCosId(::chara_index chara_index, int32_t cos_id) { - this->chara_index = chara_index; +void DtmEqVs::SetCharaNumCosId(CHARA_NUM chara_num, int32_t cos_id) { + this->chara_num = chara_num; this->cos_id = cos_id; - data_test_equip_dw_set_chara_index(chara_id, chara_index); + data_test_equip_dw_set_chara_num(chara_id, chara_num); data_test_equip_dw_set_cos_id(chara_id, cos_id); } void DtmEqVs::CtrlChara() { - if (chara_index == curr_chara_index && cos_id == curr_cos_id) + if (chara_num == curr_chara_num && cos_id == curr_cos_id) return; - curr_chara_index = chara_index; + curr_chara_num = chara_num; curr_cos_id = cos_id; - const item_cos_data* cos = item_table_handler_array_get_item_cos_data(chara_index, cos_id); + const item_cos_data* cos = item_table_handler_array_get_item_cos_data(chara_num, cos_id); if (!check_cos_id_is_501(curr_cos_id) || !cos) { data_test_equip_dw_sub_140261520(chara_id); data_test_equip_dw_set_chara_item_cos(chara_id, cos); @@ -275,32 +275,32 @@ void DtmEqVs::CtrlDispParts() { if (this->disp_parts == disp_parts) return; - rob_chara_item_equip* rob_itm_equip = rob_chara_array_get_item_equip(chara_id); + rob_chara_item_equip* rob_disp = rob_chara_array_get_rob_disp(chara_id); bool disp = false; - item_id id; + ROB_PARTS_KIND rpk; switch (disp_parts) { default: - id = ITEM_NONE; + rpk = RPK_NONE; disp = true; break; case 1: - id = ITEM_NONE; + rpk = RPK_NONE; break; case 2: - id = ITEM_OUTER; + rpk = RPK_OUTER; break; case 3: - id = ITEM_PANTS; + rpk = RPK_PANTS; break; } - for (int32_t i = ITEM_ATAMA; i < ITEM_MAX; i++) - if (rob_itm_equip->get_object_info((item_id)i).not_null()) - rob_itm_equip->set_disp((item_id)i, true); + for (int32_t i = RPK_DISP_BEGIN; i <= RPK_DISP_END; i++) + if (rob_disp->get_object_info((ROB_PARTS_KIND)i).not_null()) + rob_disp->set_disp((ROB_PARTS_KIND)i, true); - for (int32_t i = ITEM_ATAMA; i < ITEM_MAX; i++) - if (i != id && (!disp || i != rob_itm_equip->field_D4)) - rob_itm_equip->set_disp((item_id)i, disp); + for (int32_t i = RPK_DISP_BEGIN; i <= RPK_DISP_END; i++) + if (i != rpk && (!disp || i != rob_disp->hyoutan_rpk)) + rob_disp->set_disp((ROB_PARTS_KIND)i, disp); this->disp_parts = disp_parts; } @@ -318,7 +318,7 @@ void equip_test_free() { } DataTestEquipDw::Data::Data() : disp(), set_item_no(), reset_item_no(), refresh(), item_no(), -cos(), chara_index(), cos_id(), update_item(), disp_parts(), current_items() { +cos(), chara_num(), cos_id(), update_item(), disp_parts(), current_items() { } @@ -333,9 +333,9 @@ DataTestEquipDw::Item::Item() : comp(), label(), list_box(), parts() { DataTestEquipDw::DataTestEquipDw() : chara_id() { ItemReset(); - for (int32_t i = 0; i < ROB_CHARA_COUNT; i++) { + for (int32_t i = 0; i < ROB_ID_MAX; i++) { DataReset(i); - data[i].chara_index = data_test_equip_dw_chara_index_array[i]; + data[i].chara_num = data_test_equip_dw_chara_index_array[i]; } data_test_item_array_load(); @@ -471,7 +471,7 @@ void DataTestEquipDw::DataReset(int32_t chara_id) { data.reset_item_no = false; data.refresh = false; data.item_no = 0; - data.chara_index = CHARA_MIKU; + data.chara_num = CN_MIKU; data.update_item = false; data.disp_parts = 0; @@ -489,8 +489,8 @@ int32_t DataTestEquipDw::GetCharaID() { return chara_id; } -chara_index DataTestEquipDw::GetCharaIndex(int32_t chara_id) { - return data[chara_id].chara_index; +CHARA_NUM DataTestEquipDw::GetCharaNum(int32_t chara_id) { + return data[chara_id].chara_num; } const item_cos_data* DataTestEquipDw::GetCos(int32_t chara_id) { @@ -569,10 +569,6 @@ void DataTestEquipDw::SetCharaID(int32_t value) { chara_id = value; } -void DataTestEquipDw::SetCharaIndex(int32_t chara_id, ::chara_index chara_index) { - data[chara_id].chara_index = chara_index; -} - void DataTestEquipDw::SetCharaItemCos(int32_t chara_id, const item_cos_data* cos) { if (!cos) return; @@ -596,6 +592,10 @@ void DataTestEquipDw::SetCharaItemCos(int32_t chara_id, const item_cos_data* cos } } +void DataTestEquipDw::SetCharaNum(int32_t chara_id, CHARA_NUM chara_num) { + data[chara_id].chara_num = chara_num; +} + void DataTestEquipDw::SetCos(int32_t chara_id, const item_cos_data* cos) { data[chara_id].cos = cos; } @@ -691,20 +691,20 @@ void DataTestEquipDw::PartsCallback(dw::Widget* data) { return; int32_t chara_id = data_test_equip_dw->GetCharaID(); - ::chara_index chara_index = data_test_equip_dw->GetCharaIndex(chara_id); + CHARA_NUM chara_num = data_test_equip_dw->GetCharaNum(chara_id); int32_t cos = data_test_equip_dw->GetCosId(chara_id); - const item_cos_data* v9 = item_table_handler_array_get_item_cos_data(chara_index, cos); + const item_cos_data* v9 = item_table_handler_array_get_item_cos_data(chara_num, cos); size_t selected_item = list_box->list->selected_item; switch (selected_item) { case 0: break; case 1: - v9 = item_table_handler_array_get_item_cos_data(chara_index, 499); + v9 = item_table_handler_array_get_item_cos_data(chara_num, 499); break; case 2: default: { - auto& dbgset = item_table_handler_array_get_table(chara_index)->dbgset; + auto& dbgset = item_table_handler_array_get_table(chara_num)->dbgset; auto elem = dbgset.find(list_box->GetItemStr(selected_item).c_str()); if (elem != dbgset.end()) v9 = &elem->second; @@ -778,13 +778,13 @@ void DataTestEquipDw::sub_140261520(int32_t chara_id) { void DataTestEquipDw::sub_140261580(int32_t chara_id) { DataTestEquipDw::Data& data = this->data[chara_id]; - ::chara_index chara_index = data.chara_index; + CHARA_NUM chara_num = data.chara_num; for (int32_t i = 0, j = 0; i < DATA_TEST_ITEM_EQUIP_MAX; i++) { if (!IsEquipAllowed(i)) continue; - std::vector* item_array = data_test_item_array_get(chara_index); + std::vector* item_array = data_test_item_array_get(chara_num); data.items[j].clear(); data.field_278[j].clear(); data.current_items[j] = 0; @@ -807,31 +807,31 @@ void DataTestEquipDw::sub_140261AF0(int32_t chara_id) { parts->AddItem("DEFAULT"); parts->AddItem("NUDE"); - for (auto& i : item_table_handler_array_get_table(data[chara_id].chara_index)->dbgset) + for (auto& i : item_table_handler_array_get_table(data[chara_id].chara_num)->dbgset) parts->AddItem(i.first); } void DataTestEquipDw::sub_140261C40(int32_t chara_id) { DataTestEquipDw::Data& data = this->data[chara_id]; - ::chara_index chara_index = data.chara_index; + CHARA_NUM chara_num = data.chara_num; char buf[0x20]; - sprintf_s(buf, sizeof(buf), "ITEM EQUIP (%s)", chara_index_get_name(chara_index)); + sprintf_s(buf, sizeof(buf), "ITEM EQUIP (%s)", get_chara_name_full(chara_num)); SetText(buf); for (int32_t i = 0, j = 0; i < DATA_TEST_ITEM_EQUIP_MAX; i++) { if (!IsEquipAllowed(i)) continue; - std::vector* item_array = data_test_item_array_get(chara_index); + std::vector* item_array = data_test_item_array_get(chara_num); item.list_box[j]->ClearItems(); item.list_box[j]->AddItem("REMOVE ITEM"); for (int32_t& k : item_array[data_test_equip_sub_ids[i]]) { char buf[0x200]; sprintf_s(buf, sizeof(buf), "%03d %s", k, - item_table_handler_array_get_item_name(chara_index, k).c_str()); + item_table_handler_array_get_item_name(chara_num, k).c_str()); item.list_box[j]->AddItem(buf); } j++; @@ -856,10 +856,10 @@ static int32_t data_test_equip_dw_get_disp_parts(int32_t chara_id) { return 0; } -static void data_test_equip_dw_set_chara_index(int32_t chara_id, chara_index chara_index) { +static void data_test_equip_dw_set_chara_num(int32_t chara_id, CHARA_NUM chara_num) { if (data_test_equip_dw) - data_test_equip_dw->SetCharaIndex(chara_id, chara_index); - data_test_equip_dw_chara_index_array[chara_id] = chara_index; + data_test_equip_dw->SetCharaNum(chara_id, chara_num); + data_test_equip_dw_chara_index_array[chara_id] = chara_num; } static void data_test_equip_dw_set_chara_item_cos(int32_t chara_id, const item_cos_data* cos) { @@ -906,21 +906,21 @@ static void data_test_equip_dw_sub_140261520(int32_t chara_id) { data_test_equip_dw->sub_140261520(chara_id); } -static std::vector* data_test_item_array_get(::chara_index chara_index) { - return data_test_item_array[chara_index]; +static std::vector* data_test_item_array_get(CHARA_NUM chara_num) { + return data_test_item_array[chara_num]; } static void data_test_item_array_load() { if (data_test_item_array_load_count) data_test_item_array_load_count++; else - for (int32_t i = 0; i < CHARA_MAX; i++) { - const item_table* table = item_table_handler_array_get_table((chara_index)i); + for (int32_t i = 0; i < CN_MAX; i++) { + const item_table* table = item_table_handler_array_get_table((CHARA_NUM)i); if (!table) continue; for (auto& j : table->item) { - const item_table_item* item = item_table_handler_array_get_item((chara_index)i, j.first); + const item_table_item* item = item_table_handler_array_get_item((CHARA_NUM)i, j.first); if (item && item->sub_id != -1) data_test_item_array[i][item->sub_id].push_back(j.first); } @@ -938,21 +938,21 @@ static void data_test_item_array_unload() { } } -static std::vector* data_test_item_equip_array_get(::chara_index chara_index) { - return data_test_item_equip_array[chara_index]; +static std::vector* data_test_item_equip_array_get(CHARA_NUM chara_num) { + return data_test_item_equip_array[chara_num]; } static void data_test_item_equip_array_load() { if (data_test_item_equip_array_load_count) data_test_item_equip_array_load_count++; else - for (int32_t i = 0; i < CHARA_MAX; i++) { - const item_table* table = item_table_handler_array_get_table((chara_index)i); + for (int32_t i = 0; i < CN_MAX; i++) { + const item_table* table = item_table_handler_array_get_table((CHARA_NUM)i); if (!table || !data_test_item_equip_array[i]->size()) continue; for (auto& j : table->item) { - int32_t equip = data_test_item_get_item_equip((chara_index)i, j.first); + int32_t equip = data_test_item_get_item_equip((CHARA_NUM)i, j.first); if (equip != -1) data_test_item_equip_array[i][equip].push_back(j.first); } @@ -970,15 +970,15 @@ static void data_test_item_equip_array_unload() { } } -static int32_t data_test_item_get_item_equip(chara_index chara_index, int32_t item_no) { +static int32_t data_test_item_get_item_equip(CHARA_NUM chara_num, int32_t item_no) { static const int32_t data_test_item_item_equip_array[] = { 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 2, 2, 4, 4, 4, 4, 4, 4, 2, 1, }; - if (!item_table_handler_array_get_table(chara_index)) + if (!item_table_handler_array_get_table(chara_num)) return -1; - item_sub_id sub_id = item_table_handler_array_get_item_sub_id(chara_index, item_no); + item_sub_id sub_id = item_table_handler_array_get_item_sub_id(chara_num, item_no); if (sub_id != ITEM_SUB_NONE) return data_test_item_item_equip_array[sub_id]; return -1; diff --git a/src/ReDIVA/data_test/equip_test.hpp b/src/ReDIVA/data_test/equip_test.hpp index 607e9b70..28796079 100644 --- a/src/ReDIVA/data_test/equip_test.hpp +++ b/src/ReDIVA/data_test/equip_test.hpp @@ -13,8 +13,8 @@ class DtmEqVs : public app::Task { public: int32_t state; int32_t chara_id; - ::chara_index chara_index; - ::chara_index curr_chara_index; + CHARA_NUM chara_num; + CHARA_NUM curr_chara_num; int32_t cos_id; int32_t curr_cos_id; int32_t disp_parts; @@ -26,10 +26,10 @@ public: virtual bool ctrl() override; virtual bool dest() override; - virtual bool add_task(int32_t chara_id, ::chara_index chara_index); + virtual bool add_task(int32_t chara_id, CHARA_NUM chara_index); virtual bool del_task(); - void SetCharaIndexCosId(::chara_index chara_index, int32_t cos_id); + void SetCharaNumCosId(CHARA_NUM chara_index, int32_t cos_id); void CtrlChara(); void CtrlDispParts(); diff --git a/src/ReDIVA/data_test/motion_test.cpp b/src/ReDIVA/data_test/motion_test.cpp index 31d02790..41187cb6 100644 --- a/src/ReDIVA/data_test/motion_test.cpp +++ b/src/ReDIVA/data_test/motion_test.cpp @@ -350,10 +350,10 @@ DataTestMotA3d* data_test_mot_a3d; DtmMot* dtm_mot_array; -DataTestMotDw* data_test_mot_dw_array[ROB_CHARA_COUNT]; +DataTestMotDw* data_test_mot_dw_array[ROB_ID_MAX]; DataTestMotA3dDw* data_test_mot_a3d_dw; DataTestMotCtrlDw* data_test_mot_ctrl_dw; -DataTestFaceMotDw* data_test_face_mot_dw_array[ROB_CHARA_COUNT]; +DataTestFaceMotDw* data_test_face_mot_dw_array[ROB_ID_MAX]; std::vector motion_test_objset; @@ -400,7 +400,7 @@ DataTestMot::Data::Step::Step() { array[3] = 1.0f; } -DataTestMot::Data::Data() : chara_index(), curr_chara_index(), cos_id(), curr_cos_id(), +DataTestMot::Data::Data() : chara_num(), curr_chara_num(), cos_id(), curr_cos_id(), motion_set_index(), curr_motion_set_index(), motion_index(), curr_motion_index(), rot_y(), trans_x(), offset(), start_frame(), type(), reset_mot(), reset_cam(), reload_data(), sync_frame(), field_A8(), field_A9(), running(), field_AC(), field_B0(), sync_1p_frame() { @@ -434,8 +434,8 @@ bool DataTestMot::init() { data_test_mot_a3d_dw_init(); data.reset_cam = true; data.field_A8 = true; - dtm_eq_vs_array[0].add_task(0, data.chara_index[0]); - dtm_eq_vs_array[1].add_task(1, data.chara_index[1]); + dtm_eq_vs_array[0].add_task(0, data.chara_num[0]); + dtm_eq_vs_array[1].add_task(1, data.chara_num[1]); motion_test_objset_load(); return true; } @@ -455,30 +455,30 @@ bool DataTestMot::ctrl() { v2 = true; } - if (data.chara_index[0] != data.curr_chara_index[0]) { - data.curr_chara_index[0] = data.chara_index[0]; - dtm_eq_vs_array[0].SetCharaIndexCosId(data.chara_index[0], data.cos_id[0]); + if (data.chara_num[0] != data.curr_chara_num[0]) { + data.curr_chara_num[0] = data.chara_num[0]; + dtm_eq_vs_array[0].SetCharaNumCosId(data.chara_num[0], data.cos_id[0]); v3 = true; v2 = true; } - if (data.chara_index[1] != data.curr_chara_index[1]) { - data.curr_chara_index[1] = data.chara_index[1]; - dtm_eq_vs_array[1].SetCharaIndexCosId(data.chara_index[1], data.cos_id[1]); + if (data.chara_num[1] != data.curr_chara_num[1]) { + data.curr_chara_num[1] = data.chara_num[1]; + dtm_eq_vs_array[1].SetCharaNumCosId(data.chara_num[1], data.cos_id[1]); v3 = true; v2 = true; } if (data.cos_id[0] != data.curr_cos_id[0]) { data.curr_cos_id[0] = data.cos_id[0]; - dtm_eq_vs_array[0].SetCharaIndexCosId(data.chara_index[0], data.cos_id[0]); + dtm_eq_vs_array[0].SetCharaNumCosId(data.chara_num[0], data.cos_id[0]); v3 = true; v2 = true; } if (data.cos_id[1] != data.curr_cos_id[1]) { data.curr_cos_id[1] = data.cos_id[1]; - dtm_eq_vs_array[1].SetCharaIndexCosId(data.chara_index[1], data.cos_id[1]); + dtm_eq_vs_array[1].SetCharaNumCosId(data.chara_num[1], data.cos_id[1]); v3 = true; v2 = true; } @@ -597,13 +597,13 @@ bool DataTestMot::ctrl() { if (v3) dtm_mot_array[0].del_task(); else - dtm_mot_array[0].add_task(data.chara_index[0], + dtm_mot_array[0].add_task(data.chara_num[0], data.cos_id[0], data.motion_set_index[0], data.motion_index[0]); if (v2) dtm_mot_array[1].del_task(); else - dtm_mot_array[1].add_task(data.chara_index[1], + dtm_mot_array[1].add_task(data.chara_num[1], data.cos_id[1], data.motion_set_index[1], data.motion_index[1]); if (data.reset_cam) { @@ -891,7 +891,7 @@ DtmMot::DtmMot() : rob_bone_data(), type(), rot_y(), pre_offset(), post_offset() loop(), change_motion(), use_opd(), loaded(), reset_mot(), save_only_start_frame(), state(), frame(), delta_frame(), looped(), start_frame(), ab_frame(), ab_loop(), set_motion_index() { chara_id = -1; - chara_index = CHARA_MAX; + chara_num = CN_MAX; cos_id = 502; motion_set_id = -1; motion_id = -1; @@ -917,7 +917,7 @@ bool DtmMot::init() { state = 1; looped = false; - if (chara_index < 0 || chara_index >= CHARA_MAX || cos_id >= 502) { + if (chara_num < 0 || chara_num >= CN_MAX || cos_id >= 502) { state = 0; return true; } @@ -980,19 +980,19 @@ bool DtmMot::ctrl() { state = 3; } break; case 3: { - if (chara_id >= 0 && chara_id < ROB_CHARA_COUNT && task_rob_manager_get_wait(chara_id)) + if (chara_id >= 0 && chara_id < ROB_ID_MAX && task_rob_manager_get_wait(chara_id)) break; rob_chara_pv_data pv_data; pv_data.type = ROB_CHARA_TYPE_3; module_data data; - if (module_data_handler_data_get_module(chara_index, cos_id, data)) { + if (module_data_handler_data_get_module(chara_num, cos_id, data)) { pv_data.sleeve_l = data.sleeve_l; pv_data.sleeve_r = data.sleeve_r; } - chara_id = rob_chara_array_init_chara_index(chara_index, pv_data, cos_id, true); + chara_id = rob_chara_array_init_chara_num(chara_num, pv_data, cos_id, true); state = 4; } break; case 4: { @@ -1205,7 +1205,7 @@ bool DtmMot::ctrl() { float_t frame = this->frame; if (frame >= pre_offset) - frame = min_def(rob_chr->data.field_1588.field_0.frame, frame - pre_offset); + frame = min_def(rob_chr->data.motdata.field_0.frame, frame - pre_offset); rob_bone_data->motion_step(); @@ -1328,7 +1328,7 @@ void DtmMot::basic() { rob_chara* rob_chr = rob_chara_array_get(chara_id); float_t begin = 0.0f; - float_t end = rob_chr->data.field_1588.field_0.frame; + float_t end = rob_chr->data.motdata.field_0.frame; if (ab_loop) { begin = ab_frame[0]; end = ab_frame[1]; @@ -1349,7 +1349,7 @@ void DtmMot::basic() { else if (loop) { looped = true; frame -= end; - frame += rob_chr->data.field_1588.field_0.loop_begin; + frame += rob_chr->data.motdata.field_0.loop_begin; } else frame = end; @@ -1358,12 +1358,12 @@ void DtmMot::basic() { this->frame = frame; } -bool DtmMot::add_task(::chara_index chara_index, +bool DtmMot::add_task(CHARA_NUM chara_num, int32_t cos_id, uint32_t motion_set_index, uint32_t motion_index) { if (app::TaskWork::has_task(this) || app::TaskWork::check_task_ready(this)) return true; - this->chara_index = chara_index; + this->chara_num = chara_num; this->cos_id = cos_id; this->motion_index = motion_index; this->motion_set_index = motion_set_index; @@ -1371,7 +1371,7 @@ bool DtmMot::add_task(::chara_index chara_index, return app::TaskWork::add_task(this, "DATA_TEST_MOTION_MANAGER", 0); } -bool DtmMot::add_task(::chara_index chara_index, +bool DtmMot::add_task(CHARA_NUM chara_num, int32_t cos_id, uint32_t motion_id) { if (app::TaskWork::has_task(this) || app::TaskWork::check_task_ready(this)) return true; @@ -1379,7 +1379,7 @@ bool DtmMot::add_task(::chara_index chara_index, data_struct* aft_data = &data_list[DATA_AFT]; motion_database* aft_mot_db = &aft_data->data_ft.mot_db; - this->chara_index = chara_index; + this->chara_num = chara_num; this->cos_id = cos_id; this->motion_id = motion_id; this->motion_set_id = aft_mot_db->get_motion_set_id_by_motion_id(motion_id); @@ -1401,7 +1401,7 @@ bool DtmMot::CheckFirstFrame() { if (!rob_chr) return false; - float_t frame_count = rob_chr->data.field_1588.field_0.frame + pre_offset + post_offset; + float_t frame_count = rob_chr->data.motdata.field_0.frame + pre_offset + post_offset; if (frame_count > 0.0f) return fabsf(frame_count - frame) <= 0.000001f; return false; @@ -1566,7 +1566,7 @@ void DtmMot::UpdateABFrame() { if (!rob_chr) return; - float_t v3 = rob_chr->data.field_1588.field_0.frame; + float_t v3 = rob_chr->data.motdata.field_0.frame; for (float_t& i : ab_frame) i = clamp_def(i, 0.0f, v3); @@ -1886,15 +1886,15 @@ void DataTestMotDw::CharaListBoxProc::Callback(dw::SelectionListener::CallbackDa dw::ListBox* list_box = dynamic_cast(data->widget); if (list_box) { int32_t chara_id = list_box->callback_data.i32; - ::chara_index chara_index = (::chara_index)list_box->list->selected_item; - test_mot_data->chara_index[chara_id] = chara_index; + CHARA_NUM chara_num = (CHARA_NUM)list_box->list->selected_item; + test_mot_data->chara_num[chara_id] = chara_num; DataTestMotDw* test_mot_dw = data_test_mot_dw_array_get(chara_id); if (test_mot_dw->set_change_button->value) { data_struct* aft_data = &data_list[DATA_AFT]; motion_database* aft_mot_db = &aft_data->data_ft.mot_db; - uint32_t set_id = chara_init_data_get(chara_index)->motion_set; + uint32_t set_id = get_rob_data(chara_num)->motfile; uint32_t set_index = -1; for (const motion_set_info& i : aft_mot_db->motion_set) if (i.id == set_id) { @@ -2149,10 +2149,10 @@ DataTestMotDw::DataTestMotDw(int32_t chara_id, DtmMot* dtm_mot) { dw::ListBox* chara = new dw::ListBox(chara_comp); chara->SetMaxItems(20); - for (int32_t i = 0; i < CHARA_MAX; i++) - chara->AddItem(chara_index_get_name((chara_index)i)); + for (int32_t i = 0; i < CN_MAX; i++) + chara->AddItem(get_chara_name_full((CHARA_NUM)i)); chara->callback_data.i32 = chara_id; - chara->SetItemIndex(test_mot_data->chara_index[chara_id]); + chara->SetItemIndex(test_mot_data->chara_num[chara_id]); chara->AddSelectionListener(&chara_list_box_proc); chara->SetFont(dw::p_font_type_6x12); @@ -2422,14 +2422,14 @@ void DataTestMotDw::AddModules(int32_t chara_id, dw::ListBox* list_box) { list_box->ClearItems(); - chara_index chara_index = test_mot_data->chara_index[chara_id]; - const char* chara_name = chara_index_get_chara_name(chara_index); + CHARA_NUM chara_num = test_mot_data->chara_num[chara_id]; + const char* chara_name = get_chara_name(chara_num); const std::vector& modules = module_data_handler_data_get_modules(); - for (auto& i : item_table_handler_array_get_table(chara_index)->cos) { + for (auto& i : item_table_handler_array_get_table(chara_num)->cos) { bool found = false; for (const module_data& j : modules) - if (chara_index == j.chara_index && i.first == j.cos) { + if (chara_num == j.chara_num && i.first == j.cos) { char buf[0x200]; sprintf_s(buf, sizeof(buf), "%03d:(%s%03d)%s", j.id, chara_name, i.first + 1, j.name.c_str()); list_box->AddItem(buf); @@ -2439,7 +2439,7 @@ void DataTestMotDw::AddModules(int32_t chara_id, dw::ListBox* list_box) { } if (!found && i.second.data.outer) { - const item_table_item* item = item_table_handler_array_get_item(chara_index, i.second.data.outer); + const item_table_item* item = item_table_handler_array_get_item(chara_num, i.second.data.outer); if (item) { char buf[0x200]; sprintf_s(buf, sizeof(buf), "---:(%s%03d)%s", chara_name, i.first + 1, item->name.c_str()); @@ -2990,7 +2990,7 @@ static DataTestMotCtrlDw* data_test_mot_ctrl_dw_get() { } static void data_test_face_mot_dw_array_init(int32_t chara_id) { - if (chara_id < 0 || chara_id >= ROB_CHARA_COUNT || !rob_chara_array_get(chara_id)) + if (chara_id < 0 || chara_id >= ROB_ID_MAX || !rob_chara_array_get(chara_id)) return; if (!data_test_face_mot_dw_array[chara_id]) { @@ -3002,7 +3002,7 @@ static void data_test_face_mot_dw_array_init(int32_t chara_id) { } static DataTestFaceMotDw* data_test_face_mot_dw_array_get(int32_t chara_id) { - if (chara_id >= 0 && chara_id < ROB_CHARA_COUNT) + if (chara_id >= 0 && chara_id < ROB_ID_MAX) return data_test_face_mot_dw_array[chara_id]; return 0; } diff --git a/src/ReDIVA/data_test/motion_test.hpp b/src/ReDIVA/data_test/motion_test.hpp index f576fc0e..61898b65 100644 --- a/src/ReDIVA/data_test/motion_test.hpp +++ b/src/ReDIVA/data_test/motion_test.hpp @@ -32,8 +32,8 @@ public: Step(); }; - ::chara_index chara_index[2]; - ::chara_index curr_chara_index[2]; + CHARA_NUM chara_num[2]; + CHARA_NUM curr_chara_num[2]; uint32_t cos_id[2]; uint32_t curr_cos_id[2]; uint32_t motion_set_index[2]; @@ -105,7 +105,7 @@ public: rob_chara_bone_data* rob_bone_data; int32_t chara_id; int32_t type; - ::chara_index chara_index; + CHARA_NUM chara_num; int32_t cos_id; union { uint32_t motion_set_id; @@ -154,9 +154,9 @@ public: virtual bool dest() override; virtual void basic() override; - virtual bool add_task(::chara_index chara_index, + virtual bool add_task(CHARA_NUM chara_num, int32_t cos_id, uint32_t motion_set_index, uint32_t motion_index); - virtual bool add_task(::chara_index chara_index, + virtual bool add_task(CHARA_NUM chara_num, int32_t cos_id, uint32_t motion_id); virtual bool del_task(); diff --git a/src/ReDIVA/data_test/object_test.cpp b/src/ReDIVA/data_test/object_test.cpp index 929c52a0..041eed06 100644 --- a/src/ReDIVA/data_test/object_test.cpp +++ b/src/ReDIVA/data_test/object_test.cpp @@ -313,9 +313,9 @@ void DataTestObjectManager::disp() { mat4_rotate_xyz(&rotation, &mat); vec3 pos = 0.0f; - shadow_ptr_get()->positions[SHADOW_CHARA].push_back(pos); + shadow_ptr_get()->positions[SHADOW_GROUP_CHARA].push_back(pos); - rctx_ptr->disp_manager->set_shadow_type(SHADOW_CHARA); + rctx_ptr->disp_manager->set_shadow_group(SHADOW_GROUP_CHARA); rctx_ptr->disp_manager->entry_obj_by_object_info(mat, { obj_id, obj_set_id }); rctx_ptr->disp_manager->set_obj_flags((mdl::ObjFlags)0); } diff --git a/src/ReDIVA/data_test/opd_test.cpp b/src/ReDIVA/data_test/opd_test.cpp index d5792475..7d9c68df 100644 --- a/src/ReDIVA/data_test/opd_test.cpp +++ b/src/ReDIVA/data_test/opd_test.cpp @@ -176,7 +176,7 @@ void TaskDataTestOpd::disp() { size_t worker = 0; for (OpdMakeManagerData::Worker& i : opd_make_manager_data->workers) { - if (i.chara >= CHARA_MAX) { + if (i.chara >= CN_MAX) { worker++; continue; } @@ -262,7 +262,7 @@ void TaskDataTestOpd::GetCustomizeItemObjectNames( object_database* aft_obj_db = &aft_data->data_ft.obj_db; const item_table_item* item = item_table_handler_array_get_item( - cstm.chara != 10 ? (chara_index)cstm.chara : CHARA_MIKU, cstm.obj_id); + cstm.chara != 10 ? (CHARA_NUM)cstm.chara : CN_MIKU, cstm.obj_id); if (item) for (const item_table_item_data_obj& i : item->data.obj) objects.push_back(aft_obj_db->get_object_name(i.obj_info)); diff --git a/src/ReDIVA/data_test/rob_osage_test.cpp b/src/ReDIVA/data_test/rob_osage_test.cpp index 0e4a5fb2..424f6c4a 100644 --- a/src/ReDIVA/data_test/rob_osage_test.cpp +++ b/src/ReDIVA/data_test/rob_osage_test.cpp @@ -427,9 +427,9 @@ RobOsageTest::RobOsageTest() : load(), save(), coli(), line(), osage_index(), collision_index(), collision_update() { chara_id = -1; load_chara_id = 0; - chara_index = CHARA_NONE; + chara_num = CN_NONE; cos_id = -1; - item_id = ITEM_NONE; + rpk = RPK_NONE; osage_index = -1; collision_index = -1; } @@ -454,7 +454,7 @@ bool RobOsageTest::ctrl() { if (!rob_chr) return false; - if (chara_index != rob_chr->chara_index || cos_id != rob_chr->cos_id) + if (chara_num != rob_chr->chara_num || cos_id != rob_chr->cos_id) load = true; } @@ -462,7 +462,7 @@ bool RobOsageTest::ctrl() { load = false; chara_id = load_chara_id; - chara_index = CHARA_NONE; + chara_num = CN_NONE; cos_id = -1; objects.clear(); @@ -477,28 +477,28 @@ bool RobOsageTest::ctrl() { if (!rob_chr) return false; - chara_index = rob_chr->chara_index; + chara_num = rob_chr->chara_num; cos_id = rob_chr->cos_id; - rob_chara_item_equip* rob_itm_equip = rob_chr->item_equip; - if (!rob_itm_equip) + rob_chara_item_equip* rob_disp = rob_chr->rob_disp; + if (!rob_disp) return false; data_struct* aft_data = &data_list[DATA_AFT]; bone_database* aft_bone_data = &aft_data->data_ft.bone_data; object_database* aft_obj_db = &aft_data->data_ft.obj_db; - for (int32_t i = 0; i < ITEM_MAX; i++) { - rob_chara_item_equip_object* itm_eq_obj = rob_itm_equip->get_item_equip_object((::item_id)i); - ::obj* obj = objset_info_storage_get_obj(itm_eq_obj->obj_info); - if (!obj || !itm_eq_obj->osage_blk.size() && !itm_eq_obj->cloth.size()) + for (int32_t i = 0; i < RPK_MAX; i++) { + rob_chara_item_equip_object* skin_disp = rob_disp->get_skin_disp((ROB_PARTS_KIND)i); + ::obj* obj = objset_info_storage_get_obj(skin_disp->obj_uid); + if (!obj || !skin_disp->osage_blk.size() && !skin_disp->cloth.size()) continue; - objects.push_back((::item_id)i, itm_eq_obj->obj_info); + objects.push_back((ROB_PARTS_KIND)i, skin_disp->obj_uid); rob_osage_test_dw->rob.object_list_box->AddItem(obj->name); std::string buf = string_to_lower(sprintf_s_string( - "ext_skp_%s.txt", aft_obj_db->get_object_name(itm_eq_obj->obj_info))); + "ext_skp_%s.txt", aft_obj_db->get_object_name(skin_disp->obj_uid))); std::string path("ram/skin_param/"); path.append(buf); @@ -508,24 +508,24 @@ bool RobOsageTest::ctrl() { kv.file_read(path.c_str()); else aft_data->load_file(&kv, "rom/skin_param/", buf.c_str(), key_val::load_file); - itm_eq_obj->skp_load(&kv, aft_bone_data); + skin_disp->skp_load(&kv, aft_bone_data); std::vector> ex_nodes; - ex_nodes.reserve(itm_eq_obj->osage_blk.size() + itm_eq_obj->cloth.size()); + ex_nodes.reserve(skin_disp->osage_blk.size() + skin_disp->cloth.size()); - for (ExOsageBlock*& j : itm_eq_obj->osage_blk) { + for (ExOsageBlock*& j : skin_disp->osage_blk) { ExOsageBlock* osg = j; ex_nodes.push_back({ osg->name, osg }); } - for (ExClothBlock*& j : itm_eq_obj->cloth) { + for (ExClothBlock*& j : skin_disp->cloth) { ExClothBlock* cls = j; ex_nodes.push_back({ cls->name, cls }); } prj::sort(ex_nodes); - for (ExOsageBlock*& j : itm_eq_obj->osage_blk) { + for (ExOsageBlock*& j : skin_disp->osage_blk) { ExOsageBlock* osg = j; if (!kv.open_scope(osg->name)) continue; @@ -609,7 +609,7 @@ bool RobOsageTest::ctrl() { bool found = false; for (auto& i : objects) - if (i.first == item_id && i.second == obj_info) { + if (i.first == rpk && i.second == obj_info) { found = true; break; } @@ -618,7 +618,7 @@ bool RobOsageTest::ctrl() { rob_osage_test_dw->root.list_box->ClearItems(); rob_osage_test_dw->root.list_box->SetItemIndex(-1); - item_id = ITEM_NONE; + rpk = RPK_NONE; obj_info = object_info(); osage_index = -1; collision_index = -1; @@ -632,37 +632,36 @@ bool RobOsageTest::ctrl() { const char* flt_fmt = "%0.6f"; - rob_chara_item_equip* rob_itm_equip = rob_chara_array_get_item_equip(chara_id); - if (!rob_itm_equip) + rob_chara_item_equip* rob_disp = rob_chara_array_get_rob_disp(chara_id); + if (!rob_disp) return false; data_struct* aft_data = &data_list[DATA_AFT]; bone_database* aft_bone_data = &aft_data->data_ft.bone_data; object_database* aft_obj_db = &aft_data->data_ft.obj_db; - const std::vector* object_bones = aft_bone_data->get_skeleton_object_bones( - bone_database_skeleton_type_to_string(BONE_DATABASE_SKELETON_COMMON)); + const std::vector* object_bones = aft_bone_data->get_bone_name(BONE_KIND_CMN); - for (int32_t i = 0; i < ITEM_MAX; i++) { - rob_chara_item_equip_object* itm_eq_obj = rob_itm_equip->get_item_equip_object((::item_id)i); - ::obj* obj = objset_info_storage_get_obj(itm_eq_obj->obj_info); - if (!obj || !itm_eq_obj->osage_blk.size() && !itm_eq_obj->cloth.size()) + for (int32_t i = 0; i < RPK_MAX; i++) { + rob_chara_item_equip_object* skin_disp = rob_disp->get_skin_disp((ROB_PARTS_KIND)i); + ::obj* obj = objset_info_storage_get_obj(skin_disp->obj_uid); + if (!obj || !skin_disp->osage_blk.size() && !skin_disp->cloth.size()) continue; path_create_directory("ram/skin_param/"); std::string buf = string_to_lower(sprintf_s_string( - "ext_skp_%s.txt", aft_obj_db->get_object_name(itm_eq_obj->obj_info))); + "ext_skp_%s.txt", aft_obj_db->get_object_name(skin_disp->obj_uid))); std::vector> ex_nodes; - ex_nodes.reserve(itm_eq_obj->osage_blk.size() + itm_eq_obj->cloth.size()); + ex_nodes.reserve(skin_disp->osage_blk.size() + skin_disp->cloth.size()); - for (ExOsageBlock*& i : itm_eq_obj->osage_blk) { + for (ExOsageBlock*& i : skin_disp->osage_blk) { ExOsageBlock* osg = i; ex_nodes.push_back({ osg->name, osg }); } - for (ExClothBlock*& i : itm_eq_obj->cloth) { + for (ExClothBlock*& i : skin_disp->cloth) { ExClothBlock* cls = i; ex_nodes.push_back({ cls->name, cls }); } @@ -803,7 +802,7 @@ bool RobOsageTest::ctrl() { kv.write(s, "coli_type", skp->coli_type); if (skp->colli_tgt_osg) - for (ExOsageBlock*& k : itm_eq_obj->osage_blk) + for (ExOsageBlock*& k : skin_disp->osage_blk) if (skp->colli_tgt_osg == &k->osage_work.joint_node_vec) { kv.write(s, "colli_tgt_osg", k->name); break; @@ -884,12 +883,12 @@ bool RobOsageTest::dest() { } void RobOsageTest::disp() { - if (chara_id < 0 || chara_id >= ROB_CHARA_COUNT) + if (chara_id < 0 || chara_id >= ROB_ID_MAX) return; rob_chara* rob_chr = rob_chara_array_get(chara_id); if (rob_chr && !pv_osage_manager_array_get_disp(chara_id) - && rob_chr->is_visible() && !(rob_chr->data.field_3 & 0x80)) { + && rob_chr->is_visible() && !rob_chr->data.flag.bit.rf_31) { disp_coli(); disp_line(); } @@ -904,11 +903,11 @@ void RobOsageTest::basic() { rob_osage_test_dw->UpdateLayout(); } - rob_chara_item_equip_object* itm_eq_obj = get_item_equip_object(); - if (!itm_eq_obj) + rob_chara_item_equip_object* skin_disp = get_skin_disp(); + if (!skin_disp) return; - ExOsageBlock* osg = get_osage_block(itm_eq_obj); + ExOsageBlock* osg = get_osage_block(skin_disp); if (osg) { osg->osage_work.set_force(root.force, root.gain); osg->osage_work.set_air_res(root.air_res); @@ -919,7 +918,7 @@ void RobOsageTest::basic() { osg->osage_work.set_init_angle(root.init_y_rot, root.init_z_rot); } - ExClothBlock* cls = get_cloth_block(itm_eq_obj); + ExClothBlock* cls = get_cloth_block(skin_disp); if (cls) { skin_param* skp = cls->cloth_work.skin_param_ptr; skp->force = root.force; @@ -939,11 +938,11 @@ void RobOsageTest::disp_coli() { if (!coli) return; - rob_chara_item_equip_object* itm_eq_obj = get_item_equip_object(); - if (!itm_eq_obj || itm_eq_obj->obj_info != obj_info) + rob_chara_item_equip_object* skin_disp = get_skin_disp(); + if (!skin_disp || skin_disp->obj_uid != obj_info) return; - ExNodeBlock* ex_node = get_node_block(itm_eq_obj); + ExNodeBlock* ex_node = get_node_block(skin_disp); if (!ex_node) return; @@ -996,7 +995,7 @@ void RobOsageTest::disp_coli() { etc.data.sphere.wire = false; vec3 pos; - mat4_transform_point(&itm_eq_obj->rob_disp->mat, &j->pos, &pos); + mat4_transform_point(&skin_disp->rob_disp->mat, &j->pos, &pos); mat4 mat; mat4_translate(&pos, &mat); @@ -1144,18 +1143,18 @@ void RobOsageTest::disp_line() { if (!line) return; - rob_chara_item_equip_object* itm_eq_obj = get_item_equip_object(); - if (!itm_eq_obj || itm_eq_obj->obj_info != obj_info) + rob_chara_item_equip_object* skin_disp = get_skin_disp(); + if (!skin_disp || skin_disp->obj_uid != obj_info) return; - ExNodeBlock* ex_node = get_node_block(itm_eq_obj); + ExNodeBlock* ex_node = get_node_block(skin_disp); - for (ExOsageBlock*& i : itm_eq_obj->osage_blk) { + for (ExOsageBlock*& i : skin_disp->osage_blk) { if (!i || i->osage_work.joint_node_vec.size() < 1) continue; mat4 mat; - mat4_scale_rot(i->osage_work.joint_node_vec.data()[0].bone_node_mat, 0.05f, &mat); + mat4_scale_rot(i->osage_work.joint_node_vec.data()[0].dst_node_mat, 0.05f, &mat); if (i == ex_node) spr::put_cross(mat, color_red, color_green, color_blue); else @@ -1173,11 +1172,11 @@ void RobOsageTest::disp_line() { spr::put_sprite_rect({ spr::proj_sprite_3d_line(j->pos, true) - 2.0f, 4.0f }, SCREEN_MODE_MAX, spr::SPR_PRIO_DW, rect_color); - mat4_scale_rot(i->osage_work.effector.bone_node_mat, 0.05f, &mat); + mat4_scale_rot(i->osage_work.effector.dst_node_mat, 0.05f, &mat); spr::put_cross(mat, color_dark_red, color_dark_green, color_dark_blue); } - for (ExClothBlock*& i : itm_eq_obj->cloth) { + for (ExClothBlock*& i : skin_disp->cloth) { if (!i || i->cloth_work.vtxarg.size() < i->cloth_work.width) continue; @@ -1258,10 +1257,10 @@ void RobOsageTest::disp_line_cls_param(const mat4& motion_matrix, const vec3& po SCREEN_MODE_MAX, spr::SPR_PRIO_DW, color_yellow); } -inline ExClothBlock* RobOsageTest::get_cloth_block(rob_chara_item_equip_object* itm_eq_obj) const { - if (itm_eq_obj && itm_eq_obj->obj_info == obj_info && osage_index >= itm_eq_obj->osage_blk.size() - && osage_index - itm_eq_obj->osage_blk.size() < itm_eq_obj->cloth.size()) - return itm_eq_obj->cloth[osage_index - itm_eq_obj->osage_blk.size()]; +inline ExClothBlock* RobOsageTest::get_cloth_block(rob_chara_item_equip_object* skin_disp) const { + if (skin_disp && skin_disp->obj_uid == obj_info && osage_index >= skin_disp->osage_blk.size() + && osage_index - skin_disp->osage_blk.size() < skin_disp->cloth.size()) + return skin_disp->cloth[osage_index - skin_disp->osage_blk.size()]; return 0; } @@ -1283,29 +1282,29 @@ inline SkinParam::CollisionParam* RobOsageTest::get_cls_param( return 0; } -inline rob_chara_item_equip_object* RobOsageTest::get_item_equip_object() const { - if (chara_id < 0 || chara_id >= ROB_CHARA_COUNT) +inline rob_chara_item_equip_object* RobOsageTest::get_skin_disp() const { + if (chara_id < 0 || chara_id >= ROB_ID_MAX) return 0; - rob_chara_item_equip* rob_itm_equip = rob_chara_array_get_item_equip(chara_id); - if (rob_itm_equip && item_id >= ITEM_BODY && item_id < ITEM_MAX) - return rob_itm_equip->get_item_equip_object(item_id); + rob_chara_item_equip* rob_disp = rob_chara_array_get_rob_disp(chara_id); + if (rob_disp && rpk >= 0 && rpk < RPK_MAX) + return rob_disp->get_skin_disp(rpk); return 0; } -inline ExNodeBlock* RobOsageTest::get_node_block(rob_chara_item_equip_object* itm_eq_obj) const { - if (itm_eq_obj && itm_eq_obj->obj_info == obj_info) - if (osage_index < itm_eq_obj->osage_blk.size()) - return itm_eq_obj->osage_blk[osage_index]; - else if (osage_index >= itm_eq_obj->osage_blk.size() - && osage_index - itm_eq_obj->osage_blk.size() < itm_eq_obj->cloth.size()) - return itm_eq_obj->cloth[osage_index - itm_eq_obj->osage_blk.size()]; +inline ExNodeBlock* RobOsageTest::get_node_block(rob_chara_item_equip_object* skin_disp) const { + if (skin_disp && skin_disp->obj_uid == obj_info) + if (osage_index < skin_disp->osage_blk.size()) + return skin_disp->osage_blk[osage_index]; + else if (osage_index >= skin_disp->osage_blk.size() + && osage_index - skin_disp->osage_blk.size() < skin_disp->cloth.size()) + return skin_disp->cloth[osage_index - skin_disp->osage_blk.size()]; return 0; } -inline ExOsageBlock* RobOsageTest::get_osage_block(rob_chara_item_equip_object* itm_eq_obj) const { - if (itm_eq_obj && itm_eq_obj->obj_info == obj_info && osage_index < itm_eq_obj->osage_blk.size()) - return itm_eq_obj->osage_blk[osage_index]; +inline ExOsageBlock* RobOsageTest::get_osage_block(rob_chara_item_equip_object* skin_disp) const { + if (skin_disp && skin_disp->obj_uid == obj_info && osage_index < skin_disp->osage_blk.size()) + return skin_disp->osage_blk[osage_index]; return 0; } @@ -1394,7 +1393,7 @@ void RobOsageTestDw::Rob::DefaultCallback(dw::Widget* data) { if (button) { rob_osage_test->chara_id = -1; rob_osage_test->load_chara_id = 0; - rob_osage_test->item_id = ITEM_NONE; + rob_osage_test->rpk = RPK_NONE; rob_osage_test->obj_info = object_info(); rob_osage_test->osage_index = -1; rob_osage_test->collision_index = -1; @@ -1419,7 +1418,7 @@ void RobOsageTestDw::Rob::ObjectCallback(dw::Widget* data) { dw::ListBox* list_box = dynamic_cast(data); if (list_box && list_box->list->selected_item < rob_osage_test->objects.size()) { auto elem = rob_osage_test->objects.data()[list_box->list->selected_item]; - rob_osage_test->item_id = elem.first; + rob_osage_test->rpk = elem.first; rob_osage_test->obj_info = elem.second; rob_osage_test->osage_index = -1; rob_osage_test->collision_index = -1; @@ -1428,12 +1427,12 @@ void RobOsageTestDw::Rob::ObjectCallback(dw::Widget* data) { rob_osage_test_dw->root.list_box->ClearItems(); - rob_chara_item_equip_object* itm_eq_obj = rob_osage_test->get_item_equip_object(); - if (itm_eq_obj) { - for (ExOsageBlock*& i : itm_eq_obj->osage_blk) + rob_chara_item_equip_object* skin_disp = rob_osage_test->get_skin_disp(); + if (skin_disp) { + for (ExOsageBlock*& i : skin_disp->osage_blk) rob_osage_test_dw->root.list_box->AddItem(i->name); - for (ExClothBlock*& i : itm_eq_obj->cloth) + for (ExClothBlock*& i : skin_disp->cloth) rob_osage_test_dw->root.list_box->AddItem(i->name); } } @@ -2223,8 +2222,8 @@ void RobOsageTestDw::Node::CollisionRadius::Update(bool value) { void RobOsageTestDw::Node::CollisionRadius::Callback(dw::Widget* data) { dw::Slider* slider = dynamic_cast(data); if (slider) { - rob_chara_item_equip_object* itm_eq_obj = rob_osage_test->get_item_equip_object(); - ExOsageBlock* osg = rob_osage_test->get_osage_block(itm_eq_obj); + rob_chara_item_equip_object* skin_disp = rob_osage_test->get_skin_disp(); + ExOsageBlock* osg = rob_osage_test->get_osage_block(skin_disp); if (osg) { float_t value = slider->GetValue(); RobJointNode* i_begin = osg->osage_work.joint_node_vec.data() + 1; @@ -2322,8 +2321,8 @@ void RobOsageTestDw::Node::Hinge::Update(bool value) { void RobOsageTestDw::Node::Hinge::YMinCallback(dw::Widget* data) { dw::Slider* slider = dynamic_cast(data); if (slider) { - rob_chara_item_equip_object* itm_eq_obj = rob_osage_test->get_item_equip_object(); - ExOsageBlock* osg = rob_osage_test->get_osage_block(itm_eq_obj); + rob_chara_item_equip_object* skin_disp = rob_osage_test->get_skin_disp(); + ExOsageBlock* osg = rob_osage_test->get_osage_block(skin_disp); if (osg) { float_t value = slider->GetValue() * DEG_TO_RAD_FLOAT; RobJointNode* i_begin = osg->osage_work.joint_node_vec.data() + 1; @@ -2337,8 +2336,8 @@ void RobOsageTestDw::Node::Hinge::YMinCallback(dw::Widget* data) { void RobOsageTestDw::Node::Hinge::YMaxCallback(dw::Widget* data) { dw::Slider* slider = dynamic_cast(data); if (slider) { - rob_chara_item_equip_object* itm_eq_obj = rob_osage_test->get_item_equip_object(); - ExOsageBlock* osg = rob_osage_test->get_osage_block(itm_eq_obj); + rob_chara_item_equip_object* skin_disp = rob_osage_test->get_skin_disp(); + ExOsageBlock* osg = rob_osage_test->get_osage_block(skin_disp); if (osg) { float_t value = slider->GetValue() * DEG_TO_RAD_FLOAT; RobJointNode* i_begin = osg->osage_work.joint_node_vec.data() + 1; @@ -2352,8 +2351,8 @@ void RobOsageTestDw::Node::Hinge::YMaxCallback(dw::Widget* data) { void RobOsageTestDw::Node::Hinge::ZMinCallback(dw::Widget* data) { dw::Slider* slider = dynamic_cast(data); if (slider) { - rob_chara_item_equip_object* itm_eq_obj = rob_osage_test->get_item_equip_object(); - ExOsageBlock* osg = rob_osage_test->get_osage_block(itm_eq_obj); + rob_chara_item_equip_object* skin_disp = rob_osage_test->get_skin_disp(); + ExOsageBlock* osg = rob_osage_test->get_osage_block(skin_disp); if (osg) { float_t value = slider->GetValue() * DEG_TO_RAD_FLOAT; RobJointNode* i_begin = osg->osage_work.joint_node_vec.data() + 1; @@ -2367,8 +2366,8 @@ void RobOsageTestDw::Node::Hinge::ZMinCallback(dw::Widget* data) { void RobOsageTestDw::Node::Hinge::ZMaxCallback(dw::Widget* data) { dw::Slider* slider = dynamic_cast(data); if (slider) { - rob_chara_item_equip_object* itm_eq_obj = rob_osage_test->get_item_equip_object(); - ExOsageBlock* osg = rob_osage_test->get_osage_block(itm_eq_obj); + rob_chara_item_equip_object* skin_disp = rob_osage_test->get_skin_disp(); + ExOsageBlock* osg = rob_osage_test->get_osage_block(skin_disp); if (osg) { float_t value = slider->GetValue() * DEG_TO_RAD_FLOAT; RobJointNode* i_begin = osg->osage_work.joint_node_vec.data() + 1; @@ -2426,8 +2425,8 @@ void RobOsageTestDw::Node::InertialCancel::Update(bool value) { void RobOsageTestDw::Node::InertialCancel::Callback(dw::Widget* data) { dw::Slider* slider = dynamic_cast(data); if (slider) { - rob_chara_item_equip_object* itm_eq_obj = rob_osage_test->get_item_equip_object(); - ExOsageBlock* osg = rob_osage_test->get_osage_block(itm_eq_obj); + rob_chara_item_equip_object* skin_disp = rob_osage_test->get_skin_disp(); + ExOsageBlock* osg = rob_osage_test->get_osage_block(skin_disp); if (osg) { float_t value = slider->GetValue(); RobJointNode* i_begin = osg->osage_work.joint_node_vec.data() + 1; @@ -2485,8 +2484,8 @@ void RobOsageTestDw::Node::Weight::Update(bool value) { void RobOsageTestDw::Node::Weight::Callback(dw::Widget* data) { dw::Slider* slider = dynamic_cast(data); if (slider) { - rob_chara_item_equip_object* itm_eq_obj = rob_osage_test->get_item_equip_object(); - ExOsageBlock* osg = rob_osage_test->get_osage_block(itm_eq_obj); + rob_chara_item_equip_object* skin_disp = rob_osage_test->get_skin_disp(); + ExOsageBlock* osg = rob_osage_test->get_osage_block(skin_disp); if (osg) { float_t value = slider->GetValue(); RobJointNode* i_begin = osg->osage_work.joint_node_vec.data() + 1; @@ -2570,8 +2569,7 @@ void RobOsageTestDw::Collision::Update() { data_struct* aft_data = &data_list[DATA_AFT]; bone_database* aft_bone_data = &aft_data->data_ft.bone_data; - const std::vector* object_bones = aft_bone_data->get_skeleton_object_bones( - bone_database_skeleton_type_to_string(BONE_DATABASE_SKELETON_COMMON)); + const std::vector* object_bones = aft_bone_data->get_bone_name(BONE_KIND_CMN); char buf[0x200]; int32_t index = 0; @@ -2692,8 +2690,7 @@ void RobOsageTestDw::ColliElement::Init(dw::Composite* parent) { data_struct* aft_data = &data_list[DATA_AFT]; bone_database* aft_bone_data = &aft_data->data_ft.bone_data; - const std::vector* object_bones = aft_bone_data->get_skeleton_object_bones( - bone_database_skeleton_type_to_string(BONE_DATABASE_SKELETON_COMMON)); + const std::vector* object_bones = aft_bone_data->get_bone_name(BONE_KIND_CMN); bone0_list_box = new dw::ListBox(group); bone0_list_box->SetMaxItems(20); diff --git a/src/ReDIVA/data_test/rob_osage_test.hpp b/src/ReDIVA/data_test/rob_osage_test.hpp index 1c371a74..993d471b 100644 --- a/src/ReDIVA/data_test/rob_osage_test.hpp +++ b/src/ReDIVA/data_test/rob_osage_test.hpp @@ -72,14 +72,14 @@ public: int32_t chara_id; int32_t load_chara_id; - chara_index chara_index; + CHARA_NUM chara_num; int32_t cos_id; - ::item_id item_id; + ROB_PARTS_KIND rpk; object_info obj_info; size_t osage_index; size_t collision_index; - prj::vector_pair<::item_id, object_info> objects; + prj::vector_pair objects; prj::vector_pair> bocs; prj::vector_pair> normal_refs; @@ -107,21 +107,21 @@ public: void disp_line(); void disp_line_cls_param(const mat4& transform, const vec3& pos); - ExClothBlock* get_cloth_block(rob_chara_item_equip_object* itm_eq_obj) const; + ExClothBlock* get_cloth_block(rob_chara_item_equip_object* skin_disp) const; std::vector* get_cls_list(ExNodeBlock* cls) const; SkinParam::CollisionParam* get_cls_param(std::vector* cls_list) const; - rob_chara_item_equip_object* get_item_equip_object() const; - ExNodeBlock* get_node_block(rob_chara_item_equip_object* itm_eq_obj) const; - ExOsageBlock* get_osage_block(rob_chara_item_equip_object* itm_eq_obj) const; + rob_chara_item_equip_object* get_skin_disp() const; + ExNodeBlock* get_node_block(rob_chara_item_equip_object* skin_disp) const; + ExOsageBlock* get_osage_block(rob_chara_item_equip_object* skin_disp) const; void set_node(skin_param_osage_node* skp_osg_node); void set_root(skin_param* skp); inline std::vector* get_cls_list() const { - rob_chara_item_equip_object* itm_eq_obj = get_item_equip_object(); - if (!itm_eq_obj) + rob_chara_item_equip_object* skin_disp = get_skin_disp(); + if (!skin_disp) return 0; - return get_cls_list(get_node_block(itm_eq_obj)); + return get_cls_list(get_node_block(skin_disp)); } inline SkinParam::CollisionParam* get_cls_param() const { @@ -129,8 +129,8 @@ public: } inline skin_param* get_skin_param() const { - rob_chara_item_equip_object* itm_eq_obj = get_item_equip_object(); - ExNodeBlock* ex_node = get_node_block(itm_eq_obj); + rob_chara_item_equip_object* skin_disp = get_skin_disp(); + ExNodeBlock* ex_node = get_node_block(skin_disp); if (!ex_node) return 0; @@ -142,8 +142,8 @@ public: } inline skin_param_osage_node* get_skin_param_osage_node() const { - rob_chara_item_equip_object* itm_eq_obj = get_item_equip_object(); - ExOsageBlock* osg = get_osage_block(itm_eq_obj); + rob_chara_item_equip_object* skin_disp = get_skin_disp(); + ExOsageBlock* osg = get_osage_block(skin_disp); if (osg && osg->osage_work.joint_node_vec.size() > 1) return &osg->osage_work.joint_node_vec.data()[1].data_ptr->skp_osg_node; return 0; diff --git a/src/ReDIVA/data_view/auth_3d.cpp b/src/ReDIVA/data_view/auth_3d.cpp index 1ab618cd..2d855600 100644 --- a/src/ReDIVA/data_view/auth_3d.cpp +++ b/src/ReDIVA/data_view/auth_3d.cpp @@ -162,8 +162,8 @@ void DataViewAuth3D::window() { if (auth->src_chara != auth->dst_chara) ImGui::Text("Chara Replace: %s/%s", - chara_index_get_auth_3d_name((chara_index)auth->src_chara), - chara_index_get_auth_3d_name((chara_index)auth->dst_chara)); + get_char_id_str((CHARA_NUM)auth->src_chara), + get_char_id_str((CHARA_NUM)auth->dst_chara)); if (auth->ambient.size() > 0 && ImGui::TreeNodeEx("Ambient", tree_node_flags)) { diff --git a/src/ReDIVA/game_state.cpp b/src/ReDIVA/game_state.cpp index 6b61e50c..c959d8da 100644 --- a/src/ReDIVA/game_state.cpp +++ b/src/ReDIVA/game_state.cpp @@ -1726,7 +1726,7 @@ bool SubGameState::Selector::Ctrl() { v2->field_2C.life_gauge_safety_time = 40; v2->field_2C.life_gauge_border = 30; - for (int32_t i = 0; i < ROB_CHARA_COUNT; i++) { + for (int32_t i = 0; i < ROB_ID_MAX; i++) { v2->field_2C.field_4C[i] = sel->modules[i]; v2->field_2C.field_64[i] = sel->modules[i]; v2->field_2C.field_7C[i] = {}; diff --git a/src/ReDIVA/graphics/color_change.cpp b/src/ReDIVA/graphics/color_change.cpp index 9b98df1b..0d0b6008 100644 --- a/src/ReDIVA/graphics/color_change.cpp +++ b/src/ReDIVA/graphics/color_change.cpp @@ -53,7 +53,7 @@ public: color_tone color_tone_temp; bool show; bool auto_resize; - chara_index chara_index; + CHARA_NUM chara_num; int32_t item_index; size_t item_texture_index; @@ -142,7 +142,7 @@ ColorChangeDw::ColorChangeDw() { show = true; auto_resize = true; - chara_index = CHARA_MIKU; + chara_num = CN_MIKU; item_index = 0; item_texture_index = 0; @@ -214,8 +214,8 @@ ColorChangeDw::ColorChangeDw() { item_chara = new dw::ListBox(item_group, (dw::Flags)(dw::FLAG_800 | dw::VERTICAL | dw::MULTISELECT)); item_chara->SetText("listbox0"); - for (int32_t i = 0; i < CHARA_MAX; i++) - item_chara->AddItem(chara_index_get_name((::chara_index)i)); + for (int32_t i = 0; i < CN_MAX; i++) + item_chara->AddItem(get_chara_name_full((CHARA_NUM)i)); item_chara->AddSelectionListener(new dw::SelectionListenerOnHook( (dw::SelectionListenerOnHook::CallbackFunc)ColorChangeDw::ItemCharaCallback)); item_chara->SetMaxItems(20); @@ -432,7 +432,7 @@ void ColorChangeDw::GetColorToneDefault(color_tone& value) { const item_table_item* ColorChangeDw::GetItem(int32_t item_index) { int32_t item_no = GetItemNo(item_index); if (item_no != -1) - return item_table_handler_array_get_item(this->chara_index, item_no); + return item_table_handler_array_get_item(chara_num, item_no); return 0; } @@ -454,7 +454,7 @@ const item_table_item_data* ColorChangeDw::GetItemData(int32_t item_index) { int32_t ColorChangeDw::GetItemNo(int32_t item_index) { int32_t index = 0; - const item_table* item = item_table_handler_array_get_table(chara_index); + const item_table* item = item_table_handler_array_get_table(chara_num); if (item) for (auto& i : item->item) if (i.second.attr & 0x68) { @@ -747,7 +747,7 @@ void ColorChangeDw::ItemCallback(dw::ListBox* data) { name = aft_obj_db->get_object_set_name(i); if (item->attr & 0x40) - name = aft_obj_db->get_object_set_name(chara_init_data_get(color_change_dw->chara_index)->object_set); + name = aft_obj_db->get_object_set_name(get_rob_data(color_change_dw->chara_num)->object_set); if (name) { color_change_dw->SetObjectSet(name); diff --git a/src/ReDIVA/pv_game/pv_game.cpp b/src/ReDIVA/pv_game/pv_game.cpp index 5875360c..c44f3df3 100644 --- a/src/ReDIVA/pv_game/pv_game.cpp +++ b/src/ReDIVA/pv_game/pv_game.cpp @@ -179,7 +179,7 @@ static void sub_140105010(pv_game_chara* arr, size_t max_count, pv_game_item_mas static bool sub_1401279D0(); static bool sub_140128480(); -pv_game_chara::pv_game_chara() : chara_index(), cos(), chara_id(), pv_data(), rob_chr() { +pv_game_chara::pv_game_chara() : chara_num(), cos(), chara_id(), pv_data(), rob_chr() { } @@ -194,7 +194,7 @@ bool pv_game_chara::check_chara() { } void pv_game_chara::reset() { - chara_index = CHARA_MAX; + chara_num = CN_MAX; cos = -1; chara_id = -1; pv_data.reset(); @@ -267,8 +267,8 @@ pv_game_edit_instrument::~pv_game_edit_instrument() { } -pv_game_chreff::pv_game_chreff() : src_chara_index(), -dst_chara_index(), src_auth_3d_uid(), dst_auth_3d_uid() { +pv_game_chreff::pv_game_chreff() : src_chara_num(), +dst_chara_num(), src_auth_3d_uid(), dst_auth_3d_uid() { } @@ -1520,7 +1520,7 @@ int32_t pv_game::check_chrcam(const char* name, int32_t& uid) { for (const pv_db_pv_chrcam& i : data.pv->chrcam) if (!i.org_name.compare(_name) - && !i.chara.compare(chara_index_get_auth_3d_name(data.chara[i.id].chara_index))) { + && !i.chara.compare(get_char_id_str(data.chara[i.id].chara_num))) { uid = aft_auth_3d_db->get_uid(i.name.c_str()); return 1; } @@ -2602,7 +2602,7 @@ bool pv_game::load() { break; } - for (int32_t i = 0; i < ROB_CHARA_COUNT; i++) { + for (int32_t i = 0; i < ROB_ID_MAX; i++) { pv_game_chara& j = data.chara[i]; j.reset(); j.pv_data.field_4 = false; @@ -2615,7 +2615,7 @@ bool pv_game::load() { v750.field_1C = player_data->field_0; v750.pv = data.pv; if (data.pv) - sub_140105010(data.chara, ROB_CHARA_COUNT, items_mask, v750); + sub_140105010(data.chara, ROB_ID_MAX, items_mask, v750); if (data.height_adjust) j.pv_data.height_adjust = true; @@ -2627,10 +2627,10 @@ bool pv_game::load() { j.pv_data.chara_size_index = 1; break; case PV_PERFORMER_PLAY_CHARA: - j.pv_data.chara_size_index = chara_init_data_get_chara_size_index(j.chara_index); + j.pv_data.chara_size_index = rob_data_get_chara_size_index(j.chara_num); break; case PV_PERFORMER_PV_CHARA: - j.pv_data.chara_size_index = chara_init_data_get_chara_size_index(data.pv->get_performer_chara(i)); + j.pv_data.chara_size_index = rob_data_get_chara_size_index(data.pv->get_performer_chara(i)); break; case PV_PERFORMER_SHORT: j.pv_data.chara_size_index = 2; @@ -2677,7 +2677,7 @@ bool pv_game::load() { if (!i.motion_ids.size()) continue; - i.chara_id = rob_chara_array_init_chara_index(i.chara_index, i.pv_data, i.cos, true); + i.chara_id = rob_chara_array_init_chara_num(i.chara_num, i.pv_data, i.cos, true); if (i.chara_id != -1) i.rob_chr = rob_chara_array_get(i.chara_id); } @@ -2695,7 +2695,7 @@ bool pv_game::load() { data.motion_set_face_ids.clear(); if (diff) { - for (int32_t i = 0; i < ROB_CHARA_COUNT; i++) { + for (int32_t i = 0; i < ROB_ID_MAX; i++) { pv_game_chara& chr = data.chara[i]; data.motion_set_ids.reserve(diff->motion[i].size()); data.motion_set_face_ids.reserve(diff->motion[i].size()); @@ -2707,7 +2707,7 @@ bool pv_game::load() { uint32_t motion_id = j.id; if (data.pv) - motion_id = data.pv->get_chrmot_motion_id(i, chr.chara_index, j); + motion_id = data.pv->get_chrmot_motion_id(i, chr.chara_num, j); uint32_t motion_set_id = aft_mot_db->get_motion_set_id_by_motion_id(motion_id); if (motion_set_id != -1) { @@ -2721,7 +2721,7 @@ bool pv_game::load() { continue; std::string motion_face_name; - motion_face_name.assign(chara_index_get_face_mot_name(chr.chara_index)); + motion_face_name.assign(get_chara_name_face_mot(chr.chara_num)); motion_face_name.append("_FACE_"); motion_face_name.append(j.name); @@ -2754,7 +2754,7 @@ bool pv_game::load() { if (!i.motion_ids.size()) continue; - i.chara_id = rob_chara_array_init_chara_index(i.chara_index, i.pv_data, i.cos, true); + i.chara_id = rob_chara_array_init_chara_num(i.chara_num, i.pv_data, i.cos, true); if (i.chara_id != -1) i.rob_chr = rob_chara_array_get(i.chara_id); } @@ -2895,7 +2895,7 @@ bool pv_game::load() { if (has_chara) { task_rob_manager_hide_task(); - for (int32_t i = 0; i < ROB_CHARA_COUNT; i++) { + for (int32_t i = 0; i < ROB_ID_MAX; i++) { pv_game_chara& chr = data.chara[i]; if (chr.chara_id == -1 || !chr.rob_chr) continue; @@ -2904,7 +2904,7 @@ bool pv_game::load() { int32_t item_no = data.pv->get_performer_item(i, (pv_performer_item)j); if (!item_no || item_no < 0 && !items_mask[i].arr[j]) chr.rob_chr->load_body_parts_object_info( - pv_performer_item_to_item_id((pv_performer_item)j), + pv_performer_item_to_rob_parts_kind((pv_performer_item)j), {}, aft_bone_data, aft_data, aft_obj_db); } set_osage_init(chr); @@ -2935,21 +2935,21 @@ bool pv_game::load() { return false; for (const pv_db_pv_chreff& i : data.pv->chreff) { - chara_index src_chara_index = chara_index_get_from_chara_name(i.name.c_str()); - chara_index dst_chara_index = data.chara[i.id].chara_index; + CHARA_NUM src_chara_num = get_chara_num_from_char_id(i.name.c_str()); + CHARA_NUM dst_chara_num = data.chara[i.id].chara_num; const std::string& src_name = i.name; - std::string dst_name(chara_index_get_auth_3d_name(data.chara[i.id].chara_index)); + std::string dst_name(get_char_id_str(data.chara[i.id].chara_num)); for (const pv_db_pv_chreff_data& j : i.data) { pv_game_chreff chreff; - chreff.src_chara_index = src_chara_index; - chreff.dst_chara_index = dst_chara_index; + chreff.src_chara_num = src_chara_num; + chreff.dst_chara_num = dst_chara_num; chreff.type = j.type; chreff.src_auth_3d.assign(j.name); chreff.dst_auth_3d.assign(j.name); - if (j.type && src_chara_index != dst_chara_index) { + if (j.type && src_chara_num != dst_chara_num) { size_t pos = chreff.dst_auth_3d.find(src_name); if (pos != -1) chreff.dst_auth_3d.replace(pos, 3, dst_name); @@ -2961,7 +2961,7 @@ bool pv_game::load() { } if (j.type != PV_CHREFF_DATA_AUTH3D && j.type != PV_CHREFF_DATA_AUTH3D_OBJ - && !(j.type && src_chara_index == dst_chara_index)) + && !(j.type && src_chara_num == dst_chara_num)) continue; chreff.src_auth_3d_uid = aft_auth_3d_db->get_uid(chreff.src_auth_3d.c_str()); @@ -2976,7 +2976,7 @@ bool pv_game::load() { chreff.dst_auth_3d_category.assign(dst_category); if (chreff.dst_auth_3d_uid == -1 || !dst_category.size()) { - chreff.dst_chara_index = src_chara_index; + chreff.dst_chara_num = src_chara_num; chreff.dst_auth_3d.assign(chreff.src_auth_3d); chreff.dst_auth_3d_uid = chreff.src_auth_3d_uid; chreff.dst_auth_3d_category.assign(chreff.src_auth_3d_category); @@ -2985,7 +2985,7 @@ bool pv_game::load() { continue; } - if (j.type == PV_CHREFF_DATA_AUTH3D_OBJ && src_chara_index != dst_chara_index) { + if (j.type == PV_CHREFF_DATA_AUTH3D_OBJ && src_chara_num != dst_chara_num) { std::string dst_category(chreff.dst_auth_3d_category); size_t pos = dst_category.find(src_name); if (pos != -1) { @@ -3000,8 +3000,8 @@ bool pv_game::load() { if (pos != -1) { dst_category.replace(pos, 3, src_name); if (aft_obj_db->get_object_set_id(dst_category.c_str()) != -1) { - chreff.src_chara_index = src_chara_index; - chreff.dst_chara_index = dst_chara_index; + chreff.src_chara_num = src_chara_num; + chreff.dst_chara_num = dst_chara_num; chreff.dst_auth_3d_category.assign(dst_category); data.chreff_auth_3d_obj.push_back(chreff); } @@ -3314,7 +3314,7 @@ bool pv_game::load() { for (pv_game_chreff& k : data.chreff_auth_3d_obj) if (k.dst_auth_3d_uid == j) { - id.set_src_dst_chara(k.src_chara_index, k.dst_chara_index); + id.set_src_dst_chara(k.src_chara_num, k.dst_chara_num); break; } @@ -3359,7 +3359,7 @@ bool pv_game::load() { char buf[0x200]; int32_t chara_id = -1; - for (int32_t j = 0; j < ROB_CHARA_COUNT; j++) { + for (int32_t j = 0; j < ROB_ID_MAX; j++) { sprintf_s(buf, sizeof(buf), "%s_%dP", data.itmpv_string.c_str(), j + 1); if (!uid_name.find(buf)) { chara_id = j; @@ -3466,7 +3466,7 @@ bool pv_game::load() { if (i.index < (data.height_adjust ? 0 : 1)) continue; - const hand_item* hand_item = hand_item_handler_data_get_hand_item(i.uid, (chara_index)-1); + const hand_item* hand_item = hand_item_handler_data_get_hand_item(i.uid, CN_NONE); if (hand_item) { hand_obj_infos.push_back(hand_item->obj_left); hand_obj_infos.push_back(hand_item->obj_right); @@ -4051,7 +4051,7 @@ void pv_game::reset() { data.chance_point = 0; for (pv_game_chara& i : data.chara) { - i.chara_index = CHARA_MAX; + i.chara_num = CN_MAX; i.cos = -1; i.chara_id = -1; i.pv_data = {}; @@ -4505,7 +4505,7 @@ void pv_game::set_eyes_adjust(pv_game_chara* chr) { if (data.pv->eyes_base_adjust_type != EYES_BASE_ADJUST_NONE) chr->pv_data.eyes_adjust.base_adjust = data.pv->eyes_base_adjust_type; - auto elem = data.pv->eyes_rot_rate.find(chr->chara_index); + auto elem = data.pv->eyes_rot_rate.find(chr->chara_num); if (elem != data.pv->eyes_rot_rate.end()) { chr->pv_data.eyes_adjust.neg = elem->second.xn_rate; chr->pv_data.eyes_adjust.pos = elem->second.xp_rate; @@ -4600,14 +4600,14 @@ bool pv_game::set_pv_param_post_process_bloom_data(bool set, int32_t id, float_t void pv_game::set_pv_param_post_process_chara_alpha_data(int32_t chara_id, float_t alpha, int32_t type, float_t duration) { - if (chara_id >= 0 && chara_id < ROB_CHARA_COUNT) + if (chara_id >= 0 && chara_id < ROB_ID_MAX) pv_param_task::post_process_task_set_chara_alpha( chara_id, type, alpha, duration); } void pv_game::set_pv_param_post_process_chara_item_alpha_data(int32_t chara_id, float_t alpha, int32_t type, float_t duration) { - if (chara_id >= 0 && chara_id < ROB_CHARA_COUNT) + if (chara_id >= 0 && chara_id < ROB_ID_MAX) pv_param_task::post_process_task_set_chara_item_alpha( chara_id, type, alpha, duration, pv_game::chara_item_alpha_callback, this); @@ -4748,7 +4748,7 @@ bool pv_game::unload() { rob_chara_array_free_chara_id(i.chara_id); } - i.chara_index = CHARA_MAX; + i.chara_num = CN_MAX; i.cos = -1; i.chara_id = -1; i.pv_data = {}; @@ -5051,7 +5051,7 @@ void pv_game::sub_1401230A0() { } void pv_game::chara_item_alpha_callback(void* data, int32_t chara_id, int32_t type, float_t alpha) { - if (!data || chara_id < 0 || chara_id >= ROB_CHARA_COUNT) + if (!data || chara_id < 0 || chara_id >= ROB_ID_MAX) return; mdl::ObjFlags flags; @@ -5444,7 +5444,7 @@ void TaskPvGame::load(TaskPvGame::Data& data) { sub_14013C8C0()->difficulty = data.init_data.difficulty; sub_14013C8C0()->edition = data.init_data.edition; - for (int32_t i = 0; i < ROB_CHARA_COUNT; i++) { + for (int32_t i = 0; i < ROB_ID_MAX; i++) { pv_game_ptr->set_module(i, data.init_data.modules[i]); pv_game_ptr->set_item(i, data.init_data.items[i]); for (int32_t j = 0; j < 4; j++) @@ -5658,11 +5658,15 @@ void PVGameSelector::window() { ImGui::Checkbox("Success", &success); ImGui::DisableElementPop(has_success); - for (int32_t i = 0; i < ROB_CHARA_COUNT; i++) { - chara_index chara_old = charas[i]; + const char* chara_full_names[CN_MAX]; + for (int32_t i = 0; i < CN_MAX; i++) + chara_full_names[i] = get_chara_name_full((CHARA_NUM)i); + + for (int32_t i = 0; i < ROB_ID_MAX; i++) { + CHARA_NUM chara_old = charas[i]; sprintf_s(buf, sizeof(buf), "Chara %dP", i + 1); - if (charas[i] == CHARA_MAX || pv->get_performer_fixed(i)) { + if (charas[i] == CN_MAX || pv->get_performer_fixed(i)) { const char* items = ""; int32_t index = 0; ImGui::DisableElementPush(false); @@ -5670,7 +5674,7 @@ void PVGameSelector::window() { ImGui::DisableElementPop(false); } else - ImGui::ColumnComboBox(buf, chara_full_names, CHARA_MAX, + ImGui::ColumnComboBox(buf, chara_full_names, CN_MAX, (int32_t*)&charas[i], 0, false, &focus); if (chara_old != charas[i]) { @@ -5686,7 +5690,7 @@ void PVGameSelector::window() { } } - for (int32_t i = 0; i < ROB_CHARA_COUNT; i++) { + for (int32_t i = 0; i < ROB_ID_MAX; i++) { sprintf_s(buf, sizeof(buf), "Module %dP", i + 1); ImGui::StartPropertyColumn(buf); @@ -5694,11 +5698,11 @@ void PVGameSelector::window() { if (imgui_font_arial) ImGui::PushFont(imgui_font_arial); - bool enable = charas[i] != CHARA_MAX && !pv->get_performer_fixed(i); + bool enable = charas[i] != CN_MAX && !pv->get_performer_fixed(i); ImGui::DisableElementPush(enable); if (ImGui::BeginCombo("", enable ? module_names[i].c_str() : "", 0)) { for (const auto& j : module_data_handler_data_get_modules()) { - if (j.chara_index != charas[i] || j.cos == 499) + if (j.chara_num != charas[i] || j.cos == 499) continue; ImGui::PushID(&j); @@ -5733,13 +5737,13 @@ void PVGameSelector::window() { } void PVGameSelector::reset_chara() { - for (int32_t i = 0; i < ROB_CHARA_COUNT; i++) { + for (int32_t i = 0; i < ROB_ID_MAX; i++) { charas[i] = pv->get_performer_chara(i); this->modules[i] = 0; module_names[i].clear(); if (i >= pv->performer.size()) { - charas[i] = CHARA_MAX; + charas[i] = CN_MAX; continue; } @@ -5861,7 +5865,7 @@ void task_pv_game_init_pv() { args.init_data.stage_index = stage_index; args.ex_stage = v2->field_2C.ex_stage; - for (int32_t i = 0; i < ROB_CHARA_COUNT; i++) { + for (int32_t i = 0; i < ROB_ID_MAX; i++) { args.init_data.modules[i] = v2->field_2C.field_4C[i]; for (int32_t j = 0; j < 4; j++) { int32_t item_no = 0; @@ -6288,21 +6292,21 @@ static SysFrameRate* sys_frame_rate_get(int32_t chara_id) { } static int32_t sub_1400FCFD0(pv_game_chara* arr, const pv_db_pv* pv) { - chara_index charas[ROB_CHARA_COUNT]; - for (chara_index& i : charas) - i = CHARA_MAX; + CHARA_NUM charas[ROB_ID_MAX]; + for (CHARA_NUM& i : charas) + i = CN_MAX; - for (int32_t i = 0; i < ROB_CHARA_COUNT; i++) + for (int32_t i = 0; i < ROB_ID_MAX; i++) if (i < pv->ex_song.chara_count) - charas[i] = arr[i].chara_index; + charas[i] = arr[i].chara_num; for (const pv_db_pv_ex_song& i : pv->ex_song.data) { int32_t j = 0; - for (; j < ROB_CHARA_COUNT; j++) - if (charas[j] != CHARA_MAX && i.chara[j] != charas[j]) + for (; j < ROB_ID_MAX; j++) + if (charas[j] != CN_MAX && i.chara[j] != charas[j]) break; - if (j == ROB_CHARA_COUNT) + if (j == ROB_ID_MAX) return (int32_t)(&i - pv->ex_song.data.data()); } return -1; @@ -6315,13 +6319,13 @@ static void sub_140105010(pv_game_chara* arr, size_t max_count, pv_game_item_mas { module_data mdl; if (module_data_handler_data_get_module(a4.module, mdl)) { - chr->chara_index = mdl.chara_index; + chr->chara_num = mdl.chara_num; chr->cos = mdl.cos; chr->pv_data.sleeve_l = mdl.sleeve_l; chr->pv_data.sleeve_r = mdl.sleeve_r; } else { - chr->chara_index = CHARA_MIKU; + chr->chara_num = CN_MIKU; chr->cos = 0; } } @@ -6334,22 +6338,22 @@ static void sub_140105010(pv_game_chara* arr, size_t max_count, pv_game_item_mas const pv_db_pv* pv = a4.pv; PlayerData* player_data = player_data_array_get(0); - bool v14 = pv->get_performer_pseudo_fixed(chr->chara_index, + bool v14 = pv->get_performer_pseudo_fixed(chr->chara_num, performer, a4.field_1C, !player_data->field_F40); if (sub_14013C8C0()->sub_1400E7910() == 3 && !pv->get_performer_fixed(performer)) v14 = false; - ::chara_index chara_index = CHARA_MAX; + CHARA_NUM chara_num = CN_MAX; int32_t costume; if (pv->is_performer_type_pseudo(performer)) { int32_t pseudo_performer = pv->get_performer_pseudo_same_id(performer); if (pseudo_performer >= 0) { pv_game_chara* pseudo_chr = &arr[pseudo_performer]; if (!a4.field_1C && player_data->field_F40 && sub_14013C8C0()->sub_1400E7910() != 3 - || chr->chara_index != pseudo_chr->chara_index || pv->get_performer_fixed(performer)) { - chara_index = pseudo_chr->chara_index; + || chr->chara_num != pseudo_chr->chara_num || pv->get_performer_fixed(performer)) { + chara_num = pseudo_chr->chara_num; pv_performer_type type = pv->get_performer_type(performer); - costume = pv_db_pv::get_pseudo_costume(type, pseudo_chr->chara_index, pseudo_chr->cos); + costume = pv_db_pv::get_pseudo_costume(type, pseudo_chr->chara_num, pseudo_chr->cos); pv_game::get_item_mask(type, &pseudo_chr->pv_data.item, &a3[pseudo_performer], &chr->pv_data.item, &a3[performer]); @@ -6357,19 +6361,19 @@ static void sub_140105010(pv_game_chara* arr, size_t max_count, pv_game_item_mas } } else if (v14) { - chara_index = pv->get_performer_chara(performer); + chara_num = pv->get_performer_chara(performer); costume = pv->get_performer_costume(performer); int32_t exclude = pv->get_performer_exclude(performer); - if (exclude >= 0 && exclude < max_count && arr[exclude].chara_index == chara_index) { - chara_index = pv->get_performer_chara(exclude); + if (exclude >= 0 && exclude < max_count && arr[exclude].chara_num == chara_num) { + chara_num = pv->get_performer_chara(exclude); costume = pv->get_performer_costume(exclude); } } - if (chara_index != CHARA_MAX) { + if (chara_num != CN_MAX) { module_data mdl; - module_data_handler_data_get_module(chara_index, costume != -1 ? costume : 0, mdl); - chr->chara_index = mdl.chara_index; + module_data_handler_data_get_module(chara_num, costume != -1 ? costume : 0, mdl); + chr->chara_num = mdl.chara_num; chr->cos = mdl.cos; } @@ -6377,7 +6381,7 @@ static void sub_140105010(pv_game_chara* arr, size_t max_count, pv_game_item_mas for (int32_t i = 0; i < PV_PERFORMER_ITEM_MAX; i++) { int32_t item_no = pv->get_performer_item(performer, item); if (item_no == -2) { - const item_cos_data* cos = item_table_handler_array_get_item_cos_data(chr->chara_index, chr->cos); + const item_cos_data* cos = item_table_handler_array_get_item_cos_data(chr->chara_num, chr->cos); if (!cos) continue; @@ -6389,7 +6393,7 @@ static void sub_140105010(pv_game_chara* arr, size_t max_count, pv_game_item_mas a3[performer].arr[i] = true; } else if (item_no > 0) { - const item_table_item* itm = item_table_handler_array_get_item(chr->chara_index, item_no); + const item_table_item* itm = item_table_handler_array_get_item(chr->chara_num, item_no); if (itm && itm->sub_id == pv_performer_item_to_item_sub_id(item)) chr->pv_data.item.arr[i] = item_no; } diff --git a/src/ReDIVA/pv_game/pv_game.hpp b/src/ReDIVA/pv_game/pv_game.hpp index 46ba5720..c8eeb3cc 100644 --- a/src/ReDIVA/pv_game/pv_game.hpp +++ b/src/ReDIVA/pv_game/pv_game.hpp @@ -40,7 +40,7 @@ enum hit_state { }; struct pv_game_chara { - chara_index chara_index; + CHARA_NUM chara_num; int32_t cos; int32_t chara_id; rob_chara_pv_data pv_data; @@ -115,8 +115,8 @@ struct pv_game_edit_instrument { }; struct pv_game_chreff { - chara_index src_chara_index; - chara_index dst_chara_index; + CHARA_NUM src_chara_num; + CHARA_NUM dst_chara_num; std::bitset<128> type; std::string src_auth_3d; std::string dst_auth_3d; @@ -247,7 +247,7 @@ struct pv_game_data { bool has_frame_texture; int32_t movie_index; int32_t field_2D0C4; - pv_game_chara chara[ROB_CHARA_COUNT]; + pv_game_chara chara[ROB_ID_MAX]; std::vector motion_set_ids; std::vector motion_set_face_ids; std::vector obj_set_itmpv; @@ -282,7 +282,7 @@ struct pv_game_data { int32_t field_2D954; std::string itmpv_string; std::vector itmpv_auth_3d_uids; - std::map> itmpv[ROB_CHARA_COUNT]; + std::map> itmpv[ROB_ID_MAX]; std::vector itmpv_uids; pv_game_edit_instrument edit_instrument[3]; std::vector loaded_auth_3d_uids; @@ -345,9 +345,9 @@ struct pv_game { int32_t field_C; int32_t pv_id; bool field_14; - int32_t modules[ROB_CHARA_COUNT]; - rob_chara_pv_data_item items[ROB_CHARA_COUNT]; - pv_game_item_mask items_mask[ROB_CHARA_COUNT]; + int32_t modules[ROB_ID_MAX]; + rob_chara_pv_data_item items[ROB_ID_MAX]; + pv_game_item_mask items_mask[ROB_ID_MAX]; pv_game_data data; pv_game(); @@ -482,9 +482,9 @@ struct pv_game_init_data { int32_t life_gauge_safety_time; int32_t life_gauge_border; int32_t stage_index; - int32_t modules[ROB_CHARA_COUNT]; - rob_chara_pv_data_item items[ROB_CHARA_COUNT]; - pv_game_item_mask items_mask[ROB_CHARA_COUNT]; + int32_t modules[ROB_ID_MAX]; + rob_chara_pv_data_item items[ROB_ID_MAX]; + pv_game_item_mask items_mask[ROB_ID_MAX]; pv_game_init_data(); @@ -553,10 +553,10 @@ struct struc_775 { int32_t field_44; int8_t field_48; int8_t field_49; - int32_t field_4C[ROB_CHARA_COUNT]; - int32_t field_64[ROB_CHARA_COUNT]; - pv_game_item field_7C[ROB_CHARA_COUNT]; - pv_game_item_mask field_DC[ROB_CHARA_COUNT]; + int32_t field_4C[ROB_ID_MAX]; + int32_t field_64[ROB_ID_MAX]; + pv_game_item field_7C[ROB_ID_MAX]; + pv_game_item_mask field_DC[ROB_ID_MAX]; int32_t field_F4; int32_t field_F8; @@ -871,9 +871,9 @@ public: pv_difficulty difficulty; pv_edition edition; bool success; - chara_index charas[ROB_CHARA_COUNT]; - int32_t modules[ROB_CHARA_COUNT]; - std::string module_names[ROB_CHARA_COUNT]; + CHARA_NUM charas[ROB_ID_MAX]; + int32_t modules[ROB_ID_MAX]; + std::string module_names[ROB_ID_MAX]; bool start; bool exit; diff --git a/src/ReDIVA/pv_game/pv_game_pv_data.cpp b/src/ReDIVA/pv_game/pv_game_pv_data.cpp index 615425f1..39fa2930 100644 --- a/src/ReDIVA/pv_game/pv_game_pv_data.cpp +++ b/src/ReDIVA/pv_game/pv_game_pv_data.cpp @@ -134,8 +134,10 @@ void pv_play_data_motion_data::ctrl_inner() { rot = lerp_def(start_rot, end_rot, t); } - rob_chr->set_data_miku_rot_position(pos); - rob_chr->set_data_miku_rot_rot_y_int16((int16_t)((rot * 32768.0f) * (float_t)(1.0 / 180.0))); + RobAngle ang; + ang.set_deg(rot); + rob_chr->set_base_position_pos(pos); + rob_chr->set_base_position_yang(ang); rob_chr->set_osage_reset(); if (rob_chr->check_for_ageageagain_module()) { @@ -288,7 +290,7 @@ field_290(), field_2A8(), field_2C0(), field_2C4(), field_2C8(), field_2CC(), fi } void struc_676::reset() { - for (int32_t i = 0; i < ROB_CHARA_COUNT; i++) { + for (int32_t i = 0; i < ROB_ID_MAX; i++) { field_0[i] = false; field_8[i].reset(); field_128[i] = false; @@ -467,7 +469,7 @@ bool pv_game_pv_data::dsc_ctrl(float_t delta_time, int64_t curr_time, if (rob_chr) { pos *= (pv_game->data.pv->edit == 2 ? 1.0f : 0.227f); mat4_transform_point(&scene_rot_mat, &pos, &pos); - rob_chr->set_data_miku_rot_position(pos); + rob_chr->set_base_position_pos(pos); rob_chr->set_osage_reset(); } } break; @@ -479,8 +481,9 @@ bool pv_game_pv_data::dsc_ctrl(float_t delta_time, int64_t curr_time, float_t rot = (float_t)data[1] * 0.001f; if (rob_chr) { - rob_chr->set_data_miku_rot_rot_y_int16( - (int16_t)((rot + scene_rot_y) * 32768.0f * (float_t)(1.0 / 180.0))); + RobAngle ang; + ang.set_deg(rot + scene_rot_y); + rob_chr->set_base_position_yang(ang); rob_chr->set_osage_reset(); } } break; @@ -592,7 +595,7 @@ bool pv_game_pv_data::dsc_ctrl(float_t delta_time, int64_t curr_time, uint32_t motion_id = diff->get_motion_or_default(chara_id, motion_index).id; if (pv_game_get()->data.pv) motion_id = pv_game_get()->data.pv->get_chrmot_motion_id(rob_chr->chara_id, - rob_chr->chara_index, diff->get_motion_or_default(chara_id, motion_index)); + rob_chr->chara_num, diff->get_motion_or_default(chara_id, motion_index)); if (!motion_index) { if (motion_id == -1) { @@ -1055,7 +1058,7 @@ bool pv_game_pv_data::dsc_ctrl(float_t delta_time, int64_t curr_time, motion_id = diff->get_motion_or_default(chara_id, motion_index).id; if (pv_game_get()->data.pv) motion_id = pv_game_get()->data.pv->get_chrmot_motion_id(rob_chr->chara_id, - rob_chr->chara_index, diff->get_motion_or_default(chara_id, motion_index)); + rob_chr->chara_num, diff->get_motion_or_default(chara_id, motion_index)); if (motion_id == -1) motion_id = rob_chr->get_rob_cmn_mottbl_motion_id(0); @@ -1527,7 +1530,7 @@ bool pv_game_pv_data::dsc_ctrl(float_t delta_time, int64_t curr_time, wet = clamp_def(wet, 0.0f, 1.0f); if (rob_chr) - rob_chr->item_equip->wet = wet; + rob_chr->rob_disp->wet = wet; } break; case DSC_FT_LIGHT_ROT: { } break; @@ -1588,7 +1591,7 @@ bool pv_game_pv_data::dsc_ctrl(float_t delta_time, int64_t curr_time, int32_t disp = data[2]; if (rob_chr) - rob_chr->set_parts_disp((item_id)id, disp == 1); + rob_chr->set_parts_disp((ROB_PARTS_KIND)id, disp == 1); } break; case DSC_FT_TARGET_FLYING_TIME: { /*float_t target_flying_time = (float_t)data[0] * 0.001f; @@ -1607,9 +1610,9 @@ bool pv_game_pv_data::dsc_ctrl(float_t delta_time, int64_t curr_time, int32_t chara_size_index; if (chara_size == 0) - chara_size_index = chara_init_data_get_chara_size_index(rob_chr->chara_index); + chara_size_index = rob_data_get_chara_size_index(rob_chr->chara_num); else if (chara_size == 1) - chara_size_index = chara_init_data_get_chara_size_index(pv_game->data.pv->get_performer_chara(chara_id)); + chara_size_index = rob_data_get_chara_size_index(pv_game->data.pv->get_performer_chara(chara_id)); else if (chara_size == 2) chara_size_index = 1; else if (chara_size == 3) { @@ -2199,7 +2202,7 @@ void pv_game_pv_data::find_data_camera() { } void pv_game_pv_data::find_playdata_item_anim(int32_t chara_id) { - if (chara_id < 0 || chara_id >= ROB_CHARA_COUNT) + if (chara_id < 0 || chara_id >= ROB_ID_MAX) return; std::vector& item_anim = playdata[chara_id].motion_data.item_anim; @@ -2228,7 +2231,7 @@ void pv_game_pv_data::find_playdata_item_anim(int32_t chara_id) { } void pv_game_pv_data::find_playdata_set_motion(int32_t chara_id) { - if (chara_id < 0 || chara_id >= ROB_CHARA_COUNT) + if (chara_id < 0 || chara_id >= ROB_ID_MAX) return; std::vector& set_motion = playdata[chara_id].motion_data.set_motion; @@ -2261,7 +2264,7 @@ void pv_game_pv_data::find_set_motion(const pv_db_pv_difficulty* diff) { return; std::vector change_field; - std::vector set_playdata[ROB_CHARA_COUNT]; + std::vector set_playdata[ROB_ID_MAX]; int32_t pv_branch_mode = 0; int32_t time = -1; @@ -2319,7 +2322,7 @@ void pv_game_pv_data::find_set_motion(const pv_db_pv_difficulty* diff) { data_struct* aft_data = &data_list[DATA_AFT]; motion_database* aft_mot_db = &aft_data->data_ft.mot_db; - for (int32_t i = 0; i < ROB_CHARA_COUNT; i++) { + for (int32_t i = 0; i < ROB_ID_MAX; i++) { std::vector& set_motion = this->set_motion[i]; pv_play_data& playdata = this->playdata[i]; @@ -2353,7 +2356,7 @@ void pv_game_pv_data::find_set_motion(const pv_db_pv_difficulty* diff) { rob_chara* rob_chr = playdata.rob_chr; if (rob_chr) motion_id = pv_game_get()->data.pv->get_chrmot_motion_id(rob_chr->chara_id, - rob_chr->chara_index, diff->get_motion_or_default(i, j.index)); + rob_chr->chara_num, diff->get_motion_or_default(i, j.index)); } if (motion_id != -1) @@ -2363,7 +2366,7 @@ void pv_game_pv_data::find_set_motion(const pv_db_pv_difficulty* diff) { } const std::vector* pv_game_pv_data::get_set_motion(size_t chara_id) { - if (chara_id >= 0 && chara_id < ROB_CHARA_COUNT) + if (chara_id >= 0 && chara_id < ROB_ID_MAX) return &set_motion[chara_id]; return 0; } @@ -2392,7 +2395,7 @@ void pv_game_pv_data::init(::pv_game* pv_game, bool music_play) { pv_expression_array_reset(); - for (int32_t i = 0; i < ROB_CHARA_COUNT; i++) { + for (int32_t i = 0; i < ROB_ID_MAX; i++) { pv_game_chara& chr = pv_game->data.chara[i]; if (chr.chara_id == -1 || !chr.rob_chr) continue; @@ -2598,7 +2601,7 @@ void pv_game_pv_data::set_camera_max_frame(int64_t time) { } void pv_game_pv_data::set_item_anim_max_frame(int32_t chara_id, int32_t index, int64_t time) { - if (chara_id < 0 || chara_id >= ROB_CHARA_COUNT || index < 0) + if (chara_id < 0 || chara_id >= ROB_ID_MAX || index < 0) return; for (auto& i : playdata[chara_id].motion_data.item_anim) @@ -2609,7 +2612,7 @@ void pv_game_pv_data::set_item_anim_max_frame(int32_t chara_id, int32_t index, i } void pv_game_pv_data::set_motion_max_frame(int32_t chara_id, int32_t motion_index, int64_t time) { - if (chara_id < 0 || chara_id >= ROB_CHARA_COUNT || motion_index < 0) + if (chara_id < 0 || chara_id >= ROB_ID_MAX || motion_index < 0) return; pv_play_data& playdata = this->playdata[chara_id]; diff --git a/src/ReDIVA/pv_game/pv_game_pv_data.hpp b/src/ReDIVA/pv_game/pv_game_pv_data.hpp index d4c9a3db..0e450ac0 100644 --- a/src/ReDIVA/pv_game/pv_game_pv_data.hpp +++ b/src/ReDIVA/pv_game/pv_game_pv_data.hpp @@ -234,16 +234,16 @@ struct pv_dsc_target_group { }; struct struc_676 { - bool field_0[ROB_CHARA_COUNT]; - pv_play_data_set_motion field_8[ROB_CHARA_COUNT]; - bool field_128[ROB_CHARA_COUNT]; - int32_t field_130[ROB_CHARA_COUNT]; - bool field_148[ROB_CHARA_COUNT]; - pv_play_data_set_motion field_150[ROB_CHARA_COUNT]; - float_t field_270[ROB_CHARA_COUNT]; - bool field_288[ROB_CHARA_COUNT]; - int32_t field_290[ROB_CHARA_COUNT]; - float_t field_2A8[ROB_CHARA_COUNT]; + bool field_0[ROB_ID_MAX]; + pv_play_data_set_motion field_8[ROB_ID_MAX]; + bool field_128[ROB_ID_MAX]; + int32_t field_130[ROB_ID_MAX]; + bool field_148[ROB_ID_MAX]; + pv_play_data_set_motion field_150[ROB_ID_MAX]; + float_t field_270[ROB_ID_MAX]; + bool field_288[ROB_ID_MAX]; + int32_t field_290[ROB_ID_MAX]; + float_t field_2A8[ROB_ID_MAX]; bool field_2C0; int32_t field_2C4; int32_t field_2C8; @@ -296,11 +296,11 @@ struct pv_game_pv_data { float_t min_dist; bool look_camera_enable; bool field_2BFD5; - pv_play_data playdata[ROB_CHARA_COUNT]; + pv_play_data playdata[ROB_ID_MAX]; pv_data_camera data_camera[3]; std::vector data_camera_branch_fail; std::vector data_camera_branch_success; - std::vector set_motion[ROB_CHARA_COUNT]; + std::vector set_motion[ROB_ID_MAX]; prj::vector_pair change_field_branch_fail; prj::vector_pair change_field_branch_success; int64_t change_field_branch_time; diff --git a/src/ReDIVA/x_pv_game.cpp b/src/ReDIVA/x_pv_game.cpp index 00269952..b64e8950 100644 --- a/src/ReDIVA/x_pv_game.cpp +++ b/src/ReDIVA/x_pv_game.cpp @@ -1105,7 +1105,7 @@ void x_pv_game_effect::ctrl(object_database* obj_db, texture_database* tex_db) { for (bool& i : v132.field_9) i = true; - for (int32_t k = 0; k < chara_count && k < ROB_CHARA_COUNT; k++) { + for (int32_t k = 0; k < chara_count && k < ROB_ID_MAX; k++) { bool v121 = false; if (k < play_param->chara.size()) { pvpp_chara& chara = play_param->chara[k]; @@ -1243,7 +1243,7 @@ void x_pv_game_effect::set_song_effect(int32_t index, int64_t time) { size_t chara_count = play_param->chara.size(); int32_t chara_id = play_param->effect[index].chara_id; - if (chara_id < 0 || chara_id >= ROB_CHARA_COUNT || chara_id >= chara_count) + if (chara_id < 0 || chara_id >= ROB_ID_MAX || chara_id >= chara_count) chara_id = -1; song_effect.chara_id = chara_id; @@ -1411,8 +1411,8 @@ x_pv_game_chara_effect_auth_3d::~x_pv_game_chara_effect_auth_3d() { void x_pv_game_chara_effect_auth_3d::reset() { field_0 = false; - src_chara = CHARA_MAX; - dst_chara = CHARA_MAX; + src_chara = CN_MAX; + dst_chara = CN_MAX; file.clear(); category.clear(); object_set.clear(); @@ -1505,7 +1505,7 @@ void x_pv_game_chara_effect::ctrl(int32_t pv_id, object_database* obj_db, textur vec3 x_pv_game_chara_effect::get_node_translation(int32_t chara_id, int32_t chara_effect, int32_t objhrc_index, const char* node_name) { - if (chara_id < 0 || chara_id >= ROB_CHARA_COUNT) + if (chara_id < 0 || chara_id >= ROB_ID_MAX) return 0.0f; rob_chara* rob_chr = rob_chara_array_get(chara_id); @@ -1548,7 +1548,7 @@ vec3 x_pv_game_chara_effect::get_node_translation(int32_t chara_id, } void x_pv_game_chara_effect::load(int32_t pv_id, pvpp* play_param, - FrameRateControl* frame_rate_control, chara_index charas[6]) { + FrameRateControl* frame_rate_control, CHARA_NUM charas[6]) { if (state) return; @@ -1556,30 +1556,30 @@ void x_pv_game_chara_effect::load(int32_t pv_id, pvpp* play_param, this->frame_rate_control = frame_rate_control; size_t chara_count = play_param->chara.size(); - for (int32_t i = 0; i < chara_count && i < ROB_CHARA_COUNT; i++) { + for (int32_t i = 0; i < chara_count && i < ROB_ID_MAX; i++) { pvpp_chara& chara = play_param->chara[i]; if (!chara.chara_effect_init) continue; pvpp_chara_effect& chara_effect = chara.chara_effect; - chara_index src_chara = (chara_index)chara_effect.base_chara; - chara_index dst_chara = charas[i]; - chara_index dst_chara_mei = dst_chara == CHARA_SAKINE ? CHARA_MEIKO : dst_chara; + CHARA_NUM src_chara = (CHARA_NUM)chara_effect.base_chara; + CHARA_NUM dst_chara = charas[i]; + CHARA_NUM dst_chara_mei = dst_chara == CN_SAKINE ? CN_MEIKO : dst_chara; /*if (dst_chara == CHARA_EXTRA) dst_chara = src_chara;*/ - const char* src_chara_str = chara_index_get_auth_3d_name(src_chara); - const char* dst_chara_str = chara_index_get_auth_3d_name(dst_chara); - const char* dst_chara_mei_str = chara_index_get_auth_3d_name(dst_chara_mei); + const char* src_chara_str = get_char_id_str(src_chara); + const char* dst_chara_str = get_char_id_str(dst_chara); + const char* dst_chara_mei_str = get_char_id_str(dst_chara_mei); #if BAKE_X_PACK if (pv_x_bake && pv_id == 814) { repeat: - dst_chara_mei = dst_chara == CHARA_SAKINE ? CHARA_MEIKO : dst_chara; - dst_chara_str = chara_index_get_auth_3d_name(dst_chara); - dst_chara_mei_str = chara_index_get_auth_3d_name(dst_chara_mei); + dst_chara_mei = dst_chara == CN_SAKINE ? CN_MEIKO : dst_chara; + dst_chara_str = get_char_id_str(dst_chara); + dst_chara_mei_str = get_char_id_str(dst_chara_mei); } #endif @@ -1588,22 +1588,22 @@ void x_pv_game_chara_effect::load(int32_t pv_id, pvpp* play_param, if (pv_id == 826 && !j.auth_3d.str.find("EFFCHRPV826")) { switch (&j - chara_effect.auth_3d.data()) { case 0: - src_chara = CHARA_RIN; + src_chara = CN_RIN; break; case 1: - src_chara = CHARA_LEN; + src_chara = CN_LEN; break; case 2: - src_chara = CHARA_LUKA; + src_chara = CN_LUKA; break; case 3: - src_chara = CHARA_KAITO; + src_chara = CN_KAITO; break; case 4: - src_chara = CHARA_MEIKO; + src_chara = CN_MEIKO; break; } - src_chara_str = chara_index_get_auth_3d_name(src_chara); + src_chara_str = get_char_id_str(src_chara); } #endif @@ -1667,8 +1667,8 @@ void x_pv_game_chara_effect::load(int32_t pv_id, pvpp* play_param, } #if BAKE_X_PACK if (pv_x_bake && pv_id == 814) { - dst_chara = (chara_index)((int32_t)(dst_chara + 1)); - if (dst_chara != CHARA_MAX) + dst_chara = (CHARA_NUM)((int32_t)(dst_chara + 1)); + if (dst_chara != CN_MAX) goto repeat; } #endif @@ -1707,7 +1707,7 @@ void x_pv_game_chara_effect::reset() { } void x_pv_game_chara_effect::set_chara_effect(int32_t chara_id, int32_t index, int64_t time) { - if (chara_id < 0 || chara_id >= ROB_CHARA_COUNT) + if (chara_id < 0 || chara_id >= ROB_ID_MAX) return; std::vector& auth_3d = this->auth_3d[chara_id]; @@ -1756,7 +1756,7 @@ void x_pv_game_chara_effect::set_chara_effect(int32_t chara_id, int32_t index, i } void x_pv_game_chara_effect::set_chara_effect_time(int32_t chara_id, int32_t index, int64_t time) { - if (!state || chara_id < 0 || chara_id >= ROB_CHARA_COUNT) + if (!state || chara_id < 0 || chara_id >= ROB_ID_MAX) return; for (x_pv_game_chara_effect_auth_3d& i : auth_3d[chara_id]) { @@ -1793,7 +1793,7 @@ void x_pv_game_chara_effect::stop() { } void x_pv_game_chara_effect::stop_chara_effect(int32_t chara_id, int32_t index) { - if (chara_id < 0 || chara_id >= ROB_CHARA_COUNT) + if (chara_id < 0 || chara_id >= ROB_ID_MAX) return; for (x_pv_game_chara_effect_auth_3d& i : auth_3d[chara_id]) @@ -2833,7 +2833,7 @@ bool x_pv_game_pv_data::dsc_ctrl(float_t delta_time, int64_t curr_time, break; mat4_transform_point(&scene_rot_mat, &pos, &pos); - rob_chr->set_data_miku_rot_position(pos); + rob_chr->set_base_position_pos(pos); rob_chr->set_osage_reset(); } break; case DSC_X_MIKU_ROT: { @@ -2846,8 +2846,8 @@ bool x_pv_game_pv_data::dsc_ctrl(float_t delta_time, int64_t curr_time, if (!rob_chr) break; - int16_t rot_y_int16 = (int32_t)((rot_y + scene_rot_y) * 32768.0f * (float_t)(1.0 / 180.0)); - rob_chr->data.miku_rot.rot_y_int16 = rot_y_int16; + int16_t yang = (int32_t)((rot_y + scene_rot_y) * 32768.0f * (float_t)(1.0 / 180.0)); + rob_chr->data.position.yang = yang; rob_chr->set_osage_reset(); } break; case DSC_X_MIKU_DISP: { @@ -3399,7 +3399,7 @@ bool x_pv_game_pv_data::dsc_ctrl(float_t delta_time, int64_t curr_time, wet = clamp_def(wet, 0.0f, 1.0f); if (rob_chr) - rob_chr->item_equip->wet = wet; + rob_chr->rob_disp->wet = wet; } break; case DSC_X_LIGHT_ROT: { @@ -3438,13 +3438,13 @@ bool x_pv_game_pv_data::dsc_ctrl(float_t delta_time, int64_t curr_time, playdata = &this->playdata[chara_id]; rob_chr = playdata->rob_chr; - item_id id = (item_id)data[1]; + ROB_PARTS_KIND rpk = (ROB_PARTS_KIND)data[1]; int32_t disp = data[2]; if (!rob_chr) break; - rob_chr->set_parts_disp(id, disp == 1); + rob_chr->set_parts_disp(rpk, disp == 1); } break; case DSC_X_TARGET_FLYING_TIME: { @@ -3461,16 +3461,16 @@ bool x_pv_game_pv_data::dsc_ctrl(float_t delta_time, int64_t curr_time, int32_t chara_size_index; if (chara_size == 0) - chara_size_index = chara_init_data_get_chara_size_index(rob_chr->chara_index); + chara_size_index = rob_data_get_chara_size_index(rob_chr->chara_num); else if (chara_size == 1) { - ::chara_index chara_index = CHARA_MIKU; + CHARA_NUM chara_num = CN_MIKU; if (chara_id < pv_game->get_data().play_param->chara.size()) - chara_index = (::chara_index)pv_game->get_data() + chara_num = (CHARA_NUM)pv_game->get_data() .play_param->chara[chara_id].chara_effect.base_chara; else if (pv_game->get_data().pv_id == 826 && false) - chara_index = rob_chara_array_get(chara_id)->chara_index; + chara_num = rob_chara_array_get(chara_id)->chara_num; - chara_size_index = chara_init_data_get_chara_size_index(chara_index); + chara_size_index = rob_data_get_chara_size_index(chara_num); } else if (chara_size == 2) chara_size_index = 1; @@ -3681,7 +3681,7 @@ bool x_pv_game_pv_data::dsc_ctrl(float_t delta_time, int64_t curr_time, float_t duration = (float_t)data[2]; int32_t type = data[3]; - if (chara_id >= 0 && chara_id < ROB_CHARA_COUNT) + if (chara_id >= 0 && chara_id < ROB_ID_MAX) pv_param_task::post_process_task_set_chara_alpha( chara_id, type, alpha, duration); } break; @@ -3706,7 +3706,7 @@ bool x_pv_game_pv_data::dsc_ctrl(float_t delta_time, int64_t curr_time, float_t duration = (float_t)data[2]; int32_t type = data[3]; - if (chara_id >= 0 && chara_id < ROB_CHARA_COUNT) { + if (chara_id >= 0 && chara_id < ROB_ID_MAX) { pv_param_task::post_process_task_set_chara_item_alpha( chara_id, type, alpha, duration, x_pv_game_item_alpha_callback, this->pv_game); @@ -4021,7 +4021,7 @@ void x_pv_game_pv_data::find_change_fields(std::vector& change_fields) } void x_pv_game_pv_data::find_playdata_item_anim(int32_t chara_id) { - if (chara_id < 0 || chara_id >= ROB_CHARA_COUNT) + if (chara_id < 0 || chara_id >= ROB_ID_MAX) return; x_pv_play_data* playdata = &this->playdata[chara_id]; @@ -4053,7 +4053,7 @@ void x_pv_game_pv_data::find_playdata_item_anim(int32_t chara_id) { } void x_pv_game_pv_data::find_playdata_set_motion(int32_t chara_id) { - if (chara_id < 0 || chara_id >= ROB_CHARA_COUNT) + if (chara_id < 0 || chara_id >= ROB_ID_MAX) return; x_pv_play_data* playdata = &this->playdata[chara_id]; @@ -4155,7 +4155,7 @@ void x_pv_game_pv_data::find_set_motion() { pvpp* play_param = pv_game->get_data().play_param; - for (int32_t i = 0; i < ROB_CHARA_COUNT; i++) { + for (int32_t i = 0; i < ROB_ID_MAX; i++) { x_pv_play_data& playdata = this->playdata[i]; std::vector& set_motion = this->set_motion[i]; @@ -4198,7 +4198,7 @@ void x_pv_game_pv_data::find_set_motion() { } } - for (int32_t i = 0; i < ROB_CHARA_COUNT; i++) { + for (int32_t i = 0; i < ROB_ID_MAX; i++) { if (i < 0 || i >= play_param->chara.size()) continue; @@ -4255,7 +4255,7 @@ void x_pv_game_pv_data::init(class x_pv_game* pv_game, bool music_play) { pv_expression_array_reset(); - for (int32_t i = 0; i < ROB_CHARA_COUNT; i++) { + for (int32_t i = 0; i < ROB_ID_MAX; i++) { if (pv_game->rob_chara_ids[i] == -1) continue; @@ -4334,7 +4334,7 @@ bool x_pv_game_pv_data::set_pv_param_post_process_dof_data(bool set, int32_t id, } void x_pv_game_pv_data::set_motion_max_frame(int32_t chara_id, int32_t motion_index, int64_t time) { - if (chara_id < 0 || chara_id >= ROB_CHARA_COUNT || motion_index < 0) + if (chara_id < 0 || chara_id >= ROB_ID_MAX || motion_index < 0) return; x_pv_play_data& playdata = this->playdata[chara_id]; @@ -4504,7 +4504,7 @@ void x_pv_game_data::disp() { #endif } -void x_pv_game_data::load(int32_t pv_id, FrameRateControl* frame_rate_control, chara_index charas[6]) { +void x_pv_game_data::load(int32_t pv_id, FrameRateControl* frame_rate_control, CHARA_NUM charas[6]) { if (state) return; @@ -6113,8 +6113,8 @@ void x_pv_game_stage::unload() { x_pv_game::x_pv_game() : state(), pv_count(), pv_index(), state_old(), frame(), frame_float(), time(), rob_chara_ids(), success(), task_effect_init(), pause(), step_frame(), pv_id(), stage_id(), charas(), modules() { light_auth_3d_id = {}; - for (chara_index& i : charas) - i = CHARA_MAX; + for (CHARA_NUM& i : charas) + i = CN_MAX; for (int32_t& i : modules) i = 0; } @@ -6466,20 +6466,20 @@ bool x_pv_game::ctrl() { effchrpv_auth_3d_to_mot_modify_play_param(pv_data.play_param); #endif - int32_t chara_index = 0; + int32_t chara = 0; for (pvpp_chara& i : pv_data.play_param->chara) { - if (i.motion.size() && rob_chara_ids[chara_index] == -1) { + if (i.motion.size() && rob_chara_ids[chara] == -1) { rob_chara_pv_data pv_data; - pv_data.chara_size_index = chara_init_data_get_chara_size_index(charas[chara_index]); + pv_data.chara_size_index = rob_data_get_chara_size_index(charas[chara]); rob_sleeve_handler_data_get_sleeve_data( - charas[chara_index], modules[chara_index], pv_data.sleeve_l, pv_data.sleeve_r); - int32_t chara_id = rob_chara_array_init_chara_index( - charas[chara_index], pv_data, modules[chara_index], true); - if (chara_id >= 0 && chara_id < ROB_CHARA_COUNT) - rob_chara_ids[chara_index] = chara_id; + charas[chara], modules[chara], pv_data.sleeve_l, pv_data.sleeve_r); + int32_t chara_id = rob_chara_array_init_chara_num( + charas[chara], pv_data, modules[chara], true); + if (chara_id >= 0 && chara_id < ROB_ID_MAX) + rob_chara_ids[chara] = chara_id; } - if (++chara_index >= ROB_CHARA_COUNT) + if (++chara >= ROB_ID_MAX) break; } @@ -6498,7 +6498,7 @@ bool x_pv_game::ctrl() { } break; case 3: { bool wait_load = false; - for (int32_t i = 0; i < ROB_CHARA_COUNT; i++) + for (int32_t i = 0; i < ROB_ID_MAX; i++) if (rob_chara_ids[i] != -1) wait_load |= !task_rob_manager_check_chara_loaded(rob_chara_ids[i]); @@ -6936,8 +6936,8 @@ bool x_pv_game::ctrl() { int32_t time = -1; int32_t frame = -1; - bool hand_anim_set[ROB_CHARA_COUNT] = {}; - int32_t hand_anim_set_time[ROB_CHARA_COUNT] = {}; + bool hand_anim_set[ROB_ID_MAX] = {}; + int32_t hand_anim_set_time[ROB_ID_MAX] = {}; for (dsc_data& i : pv_data.dsc.data) { if (i.func == DSC_X_END) break; @@ -6976,7 +6976,7 @@ bool x_pv_game::ctrl() { } } - for (int32_t i = 0; i < ROB_CHARA_COUNT; i++) { + for (int32_t i = 0; i < ROB_ID_MAX; i++) { if (!hand_anim_set[i]) continue; @@ -7116,7 +7116,7 @@ bool x_pv_game::ctrl() { if (wait_load) break; - for (int32_t i = 0; i < ROB_CHARA_COUNT; i++) { + for (int32_t i = 0; i < ROB_ID_MAX; i++) { #if BAKE_X_PACK if (pv_x_bake || rob_chara_ids[i] == -1) continue; @@ -7779,7 +7779,7 @@ bool x_pv_game::ctrl() { img_write = false; #endif - for (int32_t i = 0; i < ROB_CHARA_COUNT; i++) + for (int32_t i = 0; i < ROB_ID_MAX; i++) pv_expression_array_reset_motion(i); #if BAKE_DOF @@ -8163,7 +8163,7 @@ void x_pv_game::window() { ImGui::End(); } -void x_pv_game::load(int32_t pv_id, int32_t stage_id, chara_index charas[6], int32_t modules[6]) { +void x_pv_game::load(int32_t pv_id, int32_t stage_id, CHARA_NUM charas[6], int32_t modules[6]) { data_struct* aft_data = &data_list[DATA_AFT]; motion_database* aft_mot_db = &aft_data->data_ft.mot_db; @@ -8193,8 +8193,6 @@ void x_pv_game::load(int32_t pv_id, int32_t stage_id, chara_index charas[6], int sprintf_s(buf, sizeof(buf), "EFFSTGPV%03d", 800 + stage_id); light_category = buf; - int32_t chara_index = 0; - success = true; task_effect_init = false; @@ -8285,8 +8283,8 @@ bool x_pv_game::unload() { pv_id = 0; stage_id = 0; - for (chara_index& i : charas) - i = CHARA_MAX; + for (CHARA_NUM& i : charas) + i = CN_MAX; for (int32_t& i : modules) i = 0; @@ -9344,11 +9342,11 @@ XPVGameBaker::XPVGameBaker() : charas(), modules(), pv_tit_aet_set_ids(), pv_tit_spr_set_ids(), pv_tit_aet_ids(), obj_set_encode_flags(), pv_tit_init(), wait(), start(), exit(), next(), write_file(), only_firstread_x() { index = -1; - chara_index = CHARA_MIKU; + chara_num = CN_MIKU; farc = true; - for (::chara_index& i : charas) - i = CHARA_MIKU; + for (CHARA_NUM& i : charas) + i = CN_MIKU; for (int32_t& i : modules) i = 0; @@ -9506,47 +9504,47 @@ void XPVGameBaker::print_log(const char* out_dir, _In_z_ _Printf_format_string_ } #endif -static const chara_index pv_charas[][6] = { - { CHARA_MIKU, }, - { CHARA_MIKU, CHARA_LUKA, }, - { CHARA_MIKU, }, - { CHARA_MIKU, }, - { CHARA_RIN, }, - { CHARA_MIKU, }, - { CHARA_MIKU, }, - { CHARA_MIKU, }, - { CHARA_MIKU, }, - { CHARA_MIKU, }, - { CHARA_MIKU, }, - { CHARA_MIKU, }, - { CHARA_MIKU, CHARA_RIN, }, - { CHARA_MIKU, CHARA_MIKU, }, - { CHARA_LUKA, }, - { CHARA_LEN, }, - { CHARA_KAITO, CHARA_MIKU, CHARA_MEIKO, }, - { CHARA_MIKU, }, - { CHARA_MIKU, }, - { CHARA_MIKU, }, - { CHARA_MIKU, }, - { CHARA_MEIKO, CHARA_RIN, CHARA_LEN, }, - { CHARA_MIKU, }, - { CHARA_MIKU, }, - { CHARA_MIKU, }, - { CHARA_MIKU, CHARA_RIN, CHARA_LEN, CHARA_LUKA, CHARA_KAITO, CHARA_MEIKO, }, - { CHARA_MIKU, CHARA_RIN, CHARA_LUKA, }, - { CHARA_MIKU, CHARA_LUKA, CHARA_MEIKO, }, - { CHARA_MIKU, CHARA_RIN, CHARA_LEN, }, - { CHARA_MIKU, }, - { CHARA_MIKU, }, - { CHARA_MIKU, }, +static const CHARA_NUM pv_charas[][6] = { + { CN_MIKU, }, + { CN_MIKU, CN_LUKA, }, + { CN_MIKU, }, + { CN_MIKU, }, + { CN_RIN, }, + { CN_MIKU, }, + { CN_MIKU, }, + { CN_MIKU, }, + { CN_MIKU, }, + { CN_MIKU, }, + { CN_MIKU, }, + { CN_MIKU, }, + { CN_MIKU, CN_RIN, }, + { CN_MIKU, CN_MIKU, }, + { CN_LUKA, }, + { CN_LEN, }, + { CN_KAITO, CN_MIKU, CN_MEIKO, }, + { CN_MIKU, }, + { CN_MIKU, }, + { CN_MIKU, }, + { CN_MIKU, }, + { CN_MEIKO, CN_RIN, CN_LEN, }, + { CN_MIKU, }, + { CN_MIKU, }, + { CN_MIKU, }, + { CN_MIKU, CN_RIN, CN_LEN, CN_LUKA, CN_KAITO, CN_MEIKO, }, + { CN_MIKU, CN_RIN, CN_LUKA, }, + { CN_MIKU, CN_LUKA, CN_MEIKO, }, + { CN_MIKU, CN_RIN, CN_LEN, }, + { CN_MIKU, }, + { CN_MIKU, }, + { CN_MIKU, }, }; XPVGameSelector::XPVGameSelector() : charas(), modules(), start(), exit() { pv_id = 823; stage_id = 23; - for (chara_index& i : charas) - i = CHARA_MIKU; + for (CHARA_NUM& i : charas) + i = CN_MIKU; for (int32_t& i : modules) i = 0; @@ -9573,7 +9571,7 @@ XPVGameSelector::XPVGameSelector() : charas(), modules(), start(), exit() { for (const auto& i : modules_data) this->modules_data[i.second.chara].push_back(&i.second); - for (int32_t i = 0; i < ROB_CHARA_COUNT; i++) { + for (int32_t i = 0; i < ROB_ID_MAX; i++) { charas[i] = pv_charas[pv_id - 801][i]; modules[i] = 0; module_names[i].clear(); @@ -9596,7 +9594,7 @@ XPVGameSelector::XPVGameSelector() : charas(), modules(), start(), exit() { modules[5] = 31; #endif - for (int32_t i = 0; i < ROB_CHARA_COUNT; i++) { + for (int32_t i = 0; i < ROB_ID_MAX; i++) { for (const auto& j : this->modules_data[charas[i]]) if (modules[i] == j->cos) { module_names[i].assign(j->name); @@ -9728,7 +9726,7 @@ void XPVGameSelector::window() { pv_id = max_def(pv_id, 0); int32_t pv_id_temp = pv_id; if (ImGui::ColumnComboBox("PV", pv_names, 32, &pv_id_temp, 0, false, &focus) && pv_id != pv_id_temp) { - for (int32_t i = 0; i < ROB_CHARA_COUNT; i++) { + for (int32_t i = 0; i < ROB_ID_MAX; i++) { charas[i] = pv_charas[pv_id_temp][i]; modules[i] = 0; module_names[i].clear(); @@ -9748,12 +9746,16 @@ void XPVGameSelector::window() { ImGui::ColumnComboBox("Stage", stage_names, 32, &stage_id, 0, false, &focus); stage_id++; + const char* chara_full_names[CN_MAX]; + for (int32_t i = 0; i < CN_MAX; i++) + chara_full_names[i] = get_chara_name_full((CHARA_NUM)i); + char buf[0x200]; - for (int32_t i = 0; i < ROB_CHARA_COUNT; i++) { - chara_index chara_old = charas[i]; + for (int32_t i = 0; i < ROB_ID_MAX; i++) { + CHARA_NUM chara_old = charas[i]; sprintf_s(buf, sizeof(buf), "Chara %dP", i + 1); - ImGui::ColumnComboBox(buf, chara_full_names, CHARA_MAX, + ImGui::ColumnComboBox(buf, chara_full_names, CN_MAX, (int32_t*)&charas[i], 0, false, &focus); if (chara_old != charas[i]) { @@ -9768,7 +9770,7 @@ void XPVGameSelector::window() { } } - for (int32_t i = 0; i < ROB_CHARA_COUNT; i++) { + for (int32_t i = 0; i < ROB_ID_MAX; i++) { sprintf_s(buf, sizeof(buf), "Module %dP", i + 1); ImGui::StartPropertyColumn(buf); @@ -10032,7 +10034,7 @@ static vec3 x_pv_game_dof_callback(void* data, int32_t chara_id) { return pv_data.chara_effect.get_node_translation(0, (int32_t)(chara_id - pv_data.play_param->chara.size()), 0, "j_kao_wj"); - if (chara_id < 0 && chara_id >= ROB_CHARA_COUNT) + if (chara_id < 0 && chara_id >= ROB_ID_MAX) return 0.0f; rob_chara* rob_chr = rob_chara_array_get(chara_id); @@ -10040,7 +10042,7 @@ static vec3 x_pv_game_dof_callback(void* data, int32_t chara_id) { return 0.0f; vec3 trans; - mat4_get_translation(rob_chr->get_bone_data_mat(MOTION_BONE_CL_KAO), &trans); + mat4_get_translation(rob_chr->get_bone_data_mat(BLK_CL_KAO), &trans); return trans; } diff --git a/src/ReDIVA/x_pv_game.hpp b/src/ReDIVA/x_pv_game.hpp index 1a26b7ee..5ddac084 100644 --- a/src/ReDIVA/x_pv_game.hpp +++ b/src/ReDIVA/x_pv_game.hpp @@ -175,7 +175,7 @@ struct x_pv_game_song_effect_glitter { string_hash name; Glitter::SceneCounter scene_counter; bool field_8; - bool field_9[ROB_CHARA_COUNT]; + bool field_9[ROB_ID_MAX]; x_pv_game_song_effect_glitter(); ~x_pv_game_song_effect_glitter(); @@ -246,8 +246,8 @@ struct x_pv_game_effect { struct x_pv_game_chara_effect_auth_3d { bool field_0; - chara_index src_chara; - chara_index dst_chara; + CHARA_NUM src_chara; + CHARA_NUM dst_chara; string_hash file; string_hash category; string_hash object_set; @@ -267,7 +267,7 @@ struct x_pv_game_chara_effect { int32_t state; pvpp* play_param; std::vector* change_fields; - std::vector auth_3d[ROB_CHARA_COUNT]; + std::vector auth_3d[ROB_ID_MAX]; FrameRateControl* frame_rate_control; x_pv_game_chara_effect(); @@ -275,7 +275,7 @@ struct x_pv_game_chara_effect { void ctrl(int32_t pv_id, object_database* obj_db, texture_database* tex_db); vec3 get_node_translation(int32_t chara_id, int32_t chara_effect, int32_t objhrc_index, const char* node_name); - void load(int32_t pv_id, pvpp* play_param, FrameRateControl* frame_rate_control, chara_index charas[6]); + void load(int32_t pv_id, pvpp* play_param, FrameRateControl* frame_rate_control, CHARA_NUM charas[6]); void load_data(); void reset(); void set_chara_effect(int32_t chara_id, int32_t index, int64_t time); @@ -478,14 +478,14 @@ struct x_pv_game_pv_data { dsc dsc; dsc_data* dsc_data_ptr; dsc_data* dsc_data_ptr_end; - std::vector set_motion[ROB_CHARA_COUNT]; + std::vector set_motion[ROB_ID_MAX]; int32_t chara_id; class x_pv_game* pv_game; float_t measured_fps; float_t anim_frame_speed; int64_t dsc_time; bool pv_end; - x_pv_play_data playdata[ROB_CHARA_COUNT]; + x_pv_play_data playdata[ROB_ID_MAX]; float_t scene_rot_y; mat4 scene_rot_mat; int32_t branch_mode; @@ -552,7 +552,7 @@ struct x_pv_game_data { void ctrl(float_t curr_time, float_t delta_time); void ctrl_stage_effect_index(); void disp(); - void load(int32_t pv_id, FrameRateControl* frame_rate_control, chara_index charas[6]); + void load(int32_t pv_id, FrameRateControl* frame_rate_control, CHARA_NUM charas[6]); void reset(); void stop(); void unload(); @@ -756,7 +756,7 @@ public: int32_t frame; double_t frame_float; int64_t time; - int32_t rob_chara_ids[ROB_CHARA_COUNT]; + int32_t rob_chara_ids[ROB_ID_MAX]; std::string light_category; @@ -770,7 +770,7 @@ public: int32_t pv_id; int32_t stage_id; - chara_index charas[6]; + CHARA_NUM charas[6]; int32_t modules[6]; x_pv_game(); @@ -783,7 +783,7 @@ public: virtual void basic() override; virtual void window() override; - void load(int32_t pv_id, int32_t stage_id, chara_index charas[6], int32_t modules[6]); + void load(int32_t pv_id, int32_t stage_id, CHARA_NUM charas[6], int32_t modules[6]); bool unload(); void ctrl(float_t curr_time, float_t delta_time); @@ -838,9 +838,9 @@ public: }; int32_t index; - ::chara_index chara_index; - ::chara_index charas[ROB_CHARA_COUNT]; - int32_t modules[ROB_CHARA_COUNT]; + CHARA_NUM chara_num; + CHARA_NUM charas[ROB_ID_MAX]; + int32_t modules[ROB_ID_MAX]; uint32_t pv_tit_aet_set_ids[5]; uint32_t pv_tit_spr_set_ids[5]; uint32_t pv_tit_aet_ids[5]; @@ -875,10 +875,10 @@ class XPVGameSelector : public app::TaskWindow { public: int32_t pv_id; int32_t stage_id; - chara_index charas[ROB_CHARA_COUNT]; - int32_t modules[ROB_CHARA_COUNT]; - std::string module_names[ROB_CHARA_COUNT]; - std::vector modules_data[CHARA_MAX]; + CHARA_NUM charas[ROB_ID_MAX]; + int32_t modules[ROB_ID_MAX]; + std::string module_names[ROB_ID_MAX]; + std::vector modules_data[CN_MAX]; bool start; bool exit;