From 29072ac56a6f78188cfba30d74cb97f3d8be176a Mon Sep 17 00:00:00 2001 From: korenkonder Date: Sun, 7 May 2023 20:11:57 +0300 Subject: [PATCH] Various changes --- src/CRE/auth_2d.cpp | 51 +- src/CRE/auth_2d.hpp | 8 + src/CRE/gl_state.cpp | 170 +++---- src/CRE/gl_state.hpp | 72 +-- src/CRE/object.cpp | 10 +- src/CRE/object.hpp | 8 +- src/CRE/ogg_vorbis.cpp | 2 +- src/CRE/pv_expression.cpp | 4 +- src/CRE/pv_param.cpp | 56 +++ src/CRE/pv_param.hpp | 14 +- src/CRE/render_context.cpp | 8 +- src/CRE/rob/ex_block.cpp | 108 ++--- src/CRE/rob/motion.cpp | 10 +- src/CRE/rob/motion.hpp | 6 +- src/CRE/rob/rob.cpp | 635 +++++++++++++------------ src/CRE/rob/rob.hpp | 85 ++-- src/CRE/rob/skin_param.cpp | 69 ++- src/CRE/rob/skin_param.hpp | 12 + src/CRE/sound.cpp | 6 + src/CRE/sound.hpp | 1 + src/CRE/sprite.cpp | 224 +++++---- src/CRE/sprite.hpp | 27 -- src/CRE/texture.cpp | 5 +- src/CRE/texture.hpp | 3 +- src/DivaGL/bone_data.cpp | 48 +- src/ReDIVA/pv_game.cpp | 943 +++++++++++++++++++++++++++---------- src/ReDIVA/pv_game.hpp | 454 +++++++++++++++--- src/ReDIVA/x_pv_game.cpp | 377 +++++++++------ src/ReDIVA/x_pv_game.hpp | 4 +- 29 files changed, 2230 insertions(+), 1190 deletions(-) diff --git a/src/CRE/auth_2d.cpp b/src/CRE/auth_2d.cpp index ab7cc85e..91d48bf4 100644 --- a/src/CRE/auth_2d.cpp +++ b/src/CRE/auth_2d.cpp @@ -174,7 +174,7 @@ public: bool GetSetReady(uint32_t index); void GetSetSceneCompLayerNames(std::vector& vec, aet_info info); float_t GetSetSceneEndTime(aet_info info); - float GetSetSceneLayerEndTime(aet_info info, const char* layer_name); + float_t GetSetSceneLayerEndTime(aet_info info, const char* layer_name); void GetSetSceneLayerMarkerNames(std::vector& vec, aet_info info, const char* layer_name); float_t GetSetSceneLayerMarkerTime(aet_info info, const char* scene_name, const char* marker_name); float_t GetSetSceneLayerStartTime(aet_info info, const char* layer_name); @@ -244,6 +244,24 @@ aet_layout_data* AetComp::Find(const char* name) { return 0; } +void AetComp::put_number_sprite(int32_t value, int32_t max_digits, + AetComp* comp, const char** names, const int32_t* spr_ids, spr::SprPrio prio, + vec2* pos, bool all_digits, const sprite_database* spr_db) { + if (!comp || !names || !spr_ids) + return; + + for (int32_t i = 0; i < max_digits && (all_digits || value); i++) { + int32_t digit = value % 10; + value /= 10; + + aet_layout_data* layout = comp->Find(names[i]); + if (layout) + aet_layout_data::put_sprite(spr_ids[digit], + spr::SPR_ATTR_CTR_CC, prio, pos, layout, spr_db); + } +} + + aet_layout_data::aet_layout_data() : width(), height() { mat = mat4_identity; opacity = 1.0f; @@ -251,6 +269,35 @@ aet_layout_data::aet_layout_data() : width(), height() { mode = RESOLUTION_MODE_HD; } + +void aet_layout_data::put_sprite(int32_t spr_id, spr::SprAttr attr, spr::SprPrio prio, + vec2* pos, aet_layout_data* layout, const sprite_database* spr_db) { + if (!layout) + return; + + spr::SprArgs args; + aet_layout_data::set_args(layout, &args); + args.id.id = spr_id; + args.attr = attr; + args.prio = prio; + if (pos) { + args.trans.x = args.trans.x + pos->x; + args.trans.y = args.trans.y + pos->y; + } + spr::put_sprite(args, spr_db); +} + +void aet_layout_data::set_args(aet_layout_data* layout, spr::SprArgs* args) { + if (!layout || !args) + return; + + args->trans = layout->position; + args->center = layout->anchor; + args->scale.x = layout->mat.row0.x; + args->scale.y = layout->mat.row1.y; + args->scale.z = layout->mat.row2.z; +} + void aet_manager_init() { if (!aet_manager) aet_manager = new AetMgr; @@ -1602,7 +1649,7 @@ float_t AetMgr::GetSetSceneEndTime(aet_info info) { return GetSet(info.set_index)->GetSceneEndTime(info.index) - 1.0f; } -float AetMgr::GetSetSceneLayerEndTime(aet_info info, const char* layer_name) { +float_t AetMgr::GetSetSceneLayerEndTime(aet_info info, const char* layer_name) { AetSet* set = GetSet(info.set_index); return set->GetSceneLayer(set->GetSceneByInfo(info), layer_name)->end_time - 1.0f; } diff --git a/src/CRE/auth_2d.hpp b/src/CRE/auth_2d.hpp index b6cd714b..fe46dc63 100644 --- a/src/CRE/auth_2d.hpp +++ b/src/CRE/auth_2d.hpp @@ -80,6 +80,10 @@ struct aet_layout_data { resolution_mode mode; aet_layout_data(); + + static void put_sprite(int32_t spr_id, spr::SprAttr attr, spr::SprPrio prio, + vec2* pos, aet_layout_data* layout, const sprite_database* spr_db); + static void set_args(aet_layout_data* layout, spr::SprArgs* args); }; struct AetComp { @@ -90,6 +94,10 @@ struct AetComp { void Add(const char* name, aet_layout_data& data); aet_layout_data* Find(const char* name); + + static void put_number_sprite(int32_t value, int32_t max_digits, + AetComp* comp, const char** names, const int32_t* spr_ids, spr::SprPrio prio, + vec2* pos, bool all_digits, const sprite_database* spr_db); }; extern void aet_manager_init(); diff --git a/src/CRE/gl_state.cpp b/src/CRE/gl_state.cpp index 6e75caa5..37e7f97d 100644 --- a/src/CRE/gl_state.cpp +++ b/src/CRE/gl_state.cpp @@ -7,9 +7,9 @@ gl_state_struct gl_state; -void gl_state_active_bind_texture_2d(int32_t index, GLuint texture) { - if (gl_state.texture_binding_2d[index] != texture) { - if (gl_state.active_texture_index != index) { +void gl_state_active_bind_texture_2d(int32_t index, GLuint texture, bool force) { + if (force || gl_state.texture_binding_2d[index] != texture) { + if (force || gl_state.active_texture_index != index) { glActiveTexture((GLenum)(GL_TEXTURE0 + index)); gl_state.active_texture = (GLenum)(GL_TEXTURE0 + index); gl_state.active_texture_index = (GLuint)index; @@ -19,9 +19,9 @@ void gl_state_active_bind_texture_2d(int32_t index, GLuint texture) { } } -void gl_state_active_bind_texture_cube_map(int32_t index, GLuint texture) { - if (gl_state.texture_binding_cube_map[index] != texture) { - if (gl_state.active_texture_index != index) { +void gl_state_active_bind_texture_cube_map(int32_t index, GLuint texture, bool force) { + if (force || gl_state.texture_binding_cube_map[index] != texture) { + if (force || gl_state.active_texture_index != index) { glActiveTexture((GLenum)(GL_TEXTURE0 + index)); gl_state.active_texture = (GLenum)(GL_TEXTURE0 + index); gl_state.active_texture_index = (GLuint)index; @@ -31,16 +31,16 @@ void gl_state_active_bind_texture_cube_map(int32_t index, GLuint texture) { } } -void gl_state_active_texture(size_t index) { - if (gl_state.active_texture_index != index) { +void gl_state_active_texture(size_t index, bool force) { + if (force || gl_state.active_texture_index != index) { glActiveTexture((GLenum)(GL_TEXTURE0 + index)); gl_state.active_texture = (GLenum)(GL_TEXTURE0 + index); gl_state.active_texture_index = (GLuint)index; } } -void gl_state_bind_framebuffer(GLuint framebuffer) { - if (gl_state.read_framebuffer_binding != framebuffer +void gl_state_bind_framebuffer(GLuint framebuffer, bool force) { + if (force || gl_state.read_framebuffer_binding != framebuffer || gl_state.draw_framebuffer_binding != framebuffer) { glBindFramebuffer(GL_FRAMEBUFFER, framebuffer); gl_state.read_framebuffer_binding = framebuffer; @@ -48,50 +48,50 @@ void gl_state_bind_framebuffer(GLuint framebuffer) { } } -void gl_state_bind_read_framebuffer(GLuint framebuffer) { - if (gl_state.read_framebuffer_binding != framebuffer) { +void gl_state_bind_read_framebuffer(GLuint framebuffer, bool force) { + if (force || gl_state.read_framebuffer_binding != framebuffer) { glBindFramebuffer(GL_READ_FRAMEBUFFER, framebuffer); gl_state.read_framebuffer_binding = framebuffer; } } -void gl_state_bind_draw_framebuffer(GLuint framebuffer) { - if (gl_state.draw_framebuffer_binding != framebuffer) { +void gl_state_bind_draw_framebuffer(GLuint framebuffer, bool force) { + if (force || gl_state.draw_framebuffer_binding != framebuffer) { glBindFramebuffer(GL_DRAW_FRAMEBUFFER, framebuffer); gl_state.draw_framebuffer_binding = framebuffer; } } void gl_state_bind_vertex_array(GLuint array, bool force) { - if (gl_state.vertex_array_binding != array || force) { + if (force || gl_state.vertex_array_binding != array) { glBindVertexArray(array); gl_state.vertex_array_binding = array; } } void gl_state_bind_array_buffer(GLuint buffer, bool force) { - if (gl_state.array_buffer_binding != buffer || force) { + if (force || gl_state.array_buffer_binding != buffer) { glBindBuffer(GL_ARRAY_BUFFER, buffer); gl_state.array_buffer_binding = buffer; } } void gl_state_bind_element_array_buffer(GLuint buffer, bool force) { - if (gl_state.element_array_buffer_binding != buffer || force) { + if (force || gl_state.element_array_buffer_binding != buffer) { glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, buffer); gl_state.element_array_buffer_binding = buffer; } } void gl_state_bind_uniform_buffer(GLuint buffer, bool force) { - if (gl_state.uniform_buffer_binding != buffer || force) { + if (force || gl_state.uniform_buffer_binding != buffer) { glBindBuffer(GL_UNIFORM_BUFFER, buffer); gl_state.uniform_buffer_binding = buffer; } } void gl_state_bind_uniform_buffer_base(GLuint index, GLuint buffer, bool force) { - if (gl_state.uniform_buffer_bindings[index] != buffer || force) { + if (force || gl_state.uniform_buffer_bindings[index] != buffer) { glBindBufferBase(GL_UNIFORM_BUFFER, index, buffer); gl_state.uniform_buffer_bindings[index] = buffer; gl_state.uniform_buffer_offsets[index] = 0; @@ -101,9 +101,9 @@ void gl_state_bind_uniform_buffer_base(GLuint index, GLuint buffer, bool force) void gl_state_bind_uniform_buffer_range(GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size, bool force) { - if (gl_state.uniform_buffer_bindings[index] != buffer + if (force || gl_state.uniform_buffer_bindings[index] != buffer || gl_state.uniform_buffer_offsets[index] != offset - || gl_state.uniform_buffer_sizes[index] != size || force) { + || gl_state.uniform_buffer_sizes[index] != size) { glBindBufferRange(GL_UNIFORM_BUFFER, index, buffer, offset, size); gl_state.uniform_buffer_bindings[index] = buffer; gl_state.uniform_buffer_offsets[index] = offset; @@ -112,14 +112,14 @@ void gl_state_bind_uniform_buffer_range(GLuint index, } void gl_state_bind_shader_storage_buffer(GLuint buffer, bool force) { - if (gl_state.shader_storage_buffer_binding != buffer || force) { + if (force || gl_state.shader_storage_buffer_binding != buffer) { glBindBuffer(GL_SHADER_STORAGE_BUFFER, buffer); gl_state.shader_storage_buffer_binding = buffer; } } void gl_state_bind_shader_storage_buffer_base(GLuint index, GLuint buffer, bool force) { - if (gl_state.shader_storage_buffer_bindings[index] != buffer || force) { + if (force || gl_state.shader_storage_buffer_bindings[index] != buffer) { glBindBufferBase(GL_SHADER_STORAGE_BUFFER, index, buffer); gl_state.shader_storage_buffer_bindings[index] = buffer; gl_state.shader_storage_buffer_offsets[index] = 0; @@ -129,9 +129,9 @@ void gl_state_bind_shader_storage_buffer_base(GLuint index, GLuint buffer, bool void gl_state_bind_shader_storage_buffer_range(GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size, bool force) { - if (gl_state.shader_storage_buffer_bindings[index] != buffer + if (force || gl_state.shader_storage_buffer_bindings[index] != buffer || gl_state.shader_storage_buffer_offsets[index] != offset - || gl_state.shader_storage_buffer_sizes[index] != size || force) { + || gl_state.shader_storage_buffer_sizes[index] != size) { glBindBufferRange(GL_SHADER_STORAGE_BUFFER, index, buffer, offset, size); gl_state.shader_storage_buffer_bindings[index] = buffer; gl_state.shader_storage_buffer_offsets[index] = offset; @@ -139,22 +139,22 @@ void gl_state_bind_shader_storage_buffer_range(GLuint index, } } -void gl_state_bind_texture_2d(GLuint texture) { +void gl_state_bind_texture_2d(GLuint texture, bool force) { if (gl_state.texture_binding_2d[gl_state.active_texture_index] != texture) { glBindTexture(GL_TEXTURE_2D, texture); gl_state.texture_binding_2d[gl_state.active_texture_index] = texture; } } -void gl_state_bind_texture_cube_map(GLuint texture) { - if (gl_state.texture_binding_cube_map[gl_state.active_texture_index] != texture) { +void gl_state_bind_texture_cube_map(GLuint texture, bool force) { + if (force || gl_state.texture_binding_cube_map[gl_state.active_texture_index] != texture) { glBindTexture(GL_TEXTURE_CUBE_MAP, texture); gl_state.texture_binding_cube_map[gl_state.active_texture_index] = texture; } } -void gl_state_bind_sampler(int32_t index, GLuint sampler) { - if (gl_state.sampler_binding[index] != sampler) { +void gl_state_bind_sampler(int32_t index, GLuint sampler, bool force) { + if (force || gl_state.sampler_binding[index] != sampler) { glBindSampler(index, sampler); gl_state.sampler_binding[index] = sampler; } @@ -188,99 +188,99 @@ bool gl_state_check_sampler_binding(int32_t index, GLuint sampler) { return gl_state.sampler_binding[index] != 0; } -void gl_state_disable_blend() { - if (gl_state.blend) { +void gl_state_disable_blend(bool force) { + if (force || gl_state.blend) { glDisable(GL_BLEND); gl_state.blend = GL_FALSE; } } -void gl_state_disable_cull_face() { - if (gl_state.cull_face) { +void gl_state_disable_cull_face(bool force) { + if (force || gl_state.cull_face) { glDisable(GL_CULL_FACE); gl_state.cull_face = GL_FALSE; } } -void gl_state_disable_depth_test() { - if (gl_state.depth_test) { +void gl_state_disable_depth_test(bool force) { + if (force || gl_state.depth_test) { glDisable(GL_DEPTH_TEST); gl_state.depth_test = GL_FALSE; } } -void gl_state_disable_multisample() { - if (gl_state.multisample) { +void gl_state_disable_multisample(bool force) { + if (force || gl_state.multisample) { glDisable(GL_MULTISAMPLE); gl_state.multisample = GL_FALSE; } } -void gl_state_disable_primitive_restart() { - if (gl_state.primitive_restart) { +void gl_state_disable_primitive_restart(bool force) { + if (force || gl_state.primitive_restart) { glDisable(GL_PRIMITIVE_RESTART); gl_state.primitive_restart = GL_FALSE; } } -void gl_state_disable_scissor_test() { - if (gl_state.scissor_test) { +void gl_state_disable_scissor_test(bool force) { + if (force || gl_state.scissor_test) { glDisable(GL_SCISSOR_TEST); gl_state.scissor_test = GL_FALSE; } } -void gl_state_disable_stencil_test() { - if (gl_state.stencil_test) { +void gl_state_disable_stencil_test(bool force) { + if (force || gl_state.stencil_test) { glDisable(GL_STENCIL_TEST); gl_state.stencil_test = GL_FALSE; } } -void gl_state_enable_blend() { - if (!gl_state.blend) { +void gl_state_enable_blend(bool force) { + if (force || !gl_state.blend) { glEnable(GL_BLEND); gl_state.blend = GL_TRUE; } } -void gl_state_enable_cull_face() { - if (!gl_state.cull_face) { +void gl_state_enable_cull_face(bool force) { + if (force || !gl_state.cull_face) { glEnable(GL_CULL_FACE); gl_state.cull_face = GL_TRUE; } } -void gl_state_enable_depth_test() { - if (!gl_state.depth_test) { +void gl_state_enable_depth_test(bool force) { + if (force || !gl_state.depth_test) { glEnable(GL_DEPTH_TEST); gl_state.depth_test = GL_TRUE; } } -void gl_state_enable_multisample() { - if (!gl_state.multisample) { +void gl_state_enable_multisample(bool force) { + if (force || !gl_state.multisample) { glEnable(GL_MULTISAMPLE); gl_state.multisample = GL_TRUE; } } -void gl_state_enable_primitive_restart() { - if (!gl_state.primitive_restart) { +void gl_state_enable_primitive_restart(bool force) { + if (force || !gl_state.primitive_restart) { glEnable(GL_PRIMITIVE_RESTART); gl_state.primitive_restart = GL_TRUE; } } -void gl_state_enable_scissor_test() { - if (!gl_state.scissor_test) { +void gl_state_enable_scissor_test(bool force) { + if (force || !gl_state.scissor_test) { glEnable(GL_SCISSOR_TEST); gl_state.scissor_test = GL_TRUE; } } -void gl_state_enable_stencil_test() { - if (!gl_state.stencil_test) { +void gl_state_enable_stencil_test(bool force) { + if (force || !gl_state.stencil_test) { glEnable(GL_STENCIL_TEST); gl_state.stencil_test = GL_TRUE; } @@ -361,8 +361,8 @@ GLuint gl_state_get_program() { return gl_state.program; } -void gl_state_set_blend_func(GLenum src, GLenum dst) { - if (gl_state.blend_src_rgb != src || gl_state.blend_dst_rgb != dst +void gl_state_set_blend_func(GLenum src, GLenum dst, bool force) { + if (force || gl_state.blend_src_rgb != src || gl_state.blend_dst_rgb != dst || gl_state.blend_src_alpha != GL_ONE || gl_state.blend_dst_alpha != GL_ONE_MINUS_SRC_ALPHA) { glBlendFuncSeparate(src, dst, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); gl_state.blend_src_rgb = src; @@ -373,8 +373,8 @@ void gl_state_set_blend_func(GLenum src, GLenum dst) { } void gl_state_set_blend_func_separate(GLenum src_rgb, GLenum dst_rgb, - GLenum src_alpha, GLenum dst_alpha) { - if (gl_state.blend_src_rgb != src_rgb || gl_state.blend_dst_rgb != dst_rgb + GLenum src_alpha, GLenum dst_alpha, bool force) { + if (force || gl_state.blend_src_rgb != src_rgb || gl_state.blend_dst_rgb != dst_rgb || gl_state.blend_src_alpha != src_alpha || gl_state.blend_dst_alpha != dst_alpha) { glBlendFuncSeparate(src_rgb, dst_rgb, src_alpha, dst_alpha); gl_state.blend_src_rgb = src_rgb; @@ -384,24 +384,25 @@ void gl_state_set_blend_func_separate(GLenum src_rgb, GLenum dst_rgb, } } -void gl_state_set_blend_equation(GLenum mode) { - if (gl_state.blend_mode_rgb != mode || gl_state.blend_mode_alpha != mode) { +void gl_state_set_blend_equation(GLenum mode, bool force) { + if (force || gl_state.blend_mode_rgb != mode || gl_state.blend_mode_alpha != mode) { glBlendEquationSeparate(mode, mode); gl_state.blend_mode_rgb = mode; gl_state.blend_mode_alpha = mode; } } -void gl_state_set_blend_equation_separate(GLenum mode_rgb, GLenum mode_alpha) { - if (gl_state.blend_mode_rgb != mode_rgb || gl_state.blend_mode_alpha != mode_alpha) { +void gl_state_set_blend_equation_separate(GLenum mode_rgb, GLenum mode_alpha, bool force) { + if (force || gl_state.blend_mode_rgb != mode_rgb || gl_state.blend_mode_alpha != mode_alpha) { glBlendEquationSeparate(mode_rgb, mode_alpha); gl_state.blend_mode_rgb = mode_rgb; gl_state.blend_mode_alpha = mode_alpha; } } -void gl_state_set_color_mask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) { - if (gl_state.color_mask[0] != red || gl_state.color_mask[1] != green +void gl_state_set_color_mask(GLboolean red, GLboolean green, + GLboolean blue, GLboolean alpha, bool force) { + if (force || gl_state.color_mask[0] != red || gl_state.color_mask[1] != green || gl_state.color_mask[2] != blue || gl_state.color_mask[3] != alpha) { glColorMask(red, green, blue, alpha); gl_state.color_mask[0] = red; @@ -411,43 +412,44 @@ void gl_state_set_color_mask(GLboolean red, GLboolean green, GLboolean blue, GLb } } -void gl_state_set_cull_face_mode(GLenum mode) { - if (gl_state.cull_face_mode != mode) { +void gl_state_set_cull_face_mode(GLenum mode, bool force) { + if (force || gl_state.cull_face_mode != mode) { glCullFace(mode); gl_state.cull_face_mode = mode; } } -void gl_state_set_depth_func(GLenum func) { - if (gl_state.depth_func != func) { +void gl_state_set_depth_func(GLenum func, bool force) { + if (force || gl_state.depth_func != func) { glDepthFunc(func); gl_state.depth_func = func; } } -void gl_state_set_depth_mask(GLboolean flag) { - if (gl_state.depth_mask != flag) { +void gl_state_set_depth_mask(GLboolean flag, bool force) { + if (force || gl_state.depth_mask != flag) { glDepthMask(flag); gl_state.depth_mask = flag; } } -void gl_state_set_polygon_mode(GLenum face, GLenum mode) { +void gl_state_set_polygon_mode(GLenum face, GLenum mode, bool force) { switch (face) { case GL_FRONT: - if (gl_state.polygon_front_face_mode != mode) { + if (force || gl_state.polygon_front_face_mode != mode) { glPolygonMode(GL_FRONT, mode); gl_state.polygon_front_face_mode = mode; } break; case GL_BACK: - if (gl_state.polygon_back_face_mode != mode) { + if (force || gl_state.polygon_back_face_mode != mode) { glPolygonMode(GL_BACK, mode); gl_state.polygon_back_face_mode = mode; } break; case GL_FRONT_AND_BACK: - if (gl_state.polygon_front_face_mode != mode && gl_state.polygon_back_face_mode != mode) { + if (force || gl_state.polygon_front_face_mode != mode + && gl_state.polygon_back_face_mode != mode) { glPolygonMode(GL_FRONT_AND_BACK, mode); gl_state.polygon_front_face_mode = mode; gl_state.polygon_back_face_mode = mode; @@ -464,22 +466,22 @@ void gl_state_set_polygon_mode(GLenum face, GLenum mode) { } } -void gl_state_set_primitive_restart_index(GLuint index) { - if (gl_state.primitive_restart_index != index) { +void gl_state_set_primitive_restart_index(GLuint index, bool force) { + if (force || gl_state.primitive_restart_index != index) { glPrimitiveRestartIndex(index); gl_state.primitive_restart_index = index; } } -void gl_state_set_stencil_mask(GLuint mask) { - if (gl_state.stencil_mask != mask) { +void gl_state_set_stencil_mask(GLuint mask, bool force) { + if (force || gl_state.stencil_mask != mask) { glStencilMask(mask); gl_state.stencil_mask = mask; } } -void gl_state_use_program(GLuint program) { - if (gl_state.program != program) { +void gl_state_use_program(GLuint program, bool force) { + if (force || gl_state.program != program) { glUseProgram(program); gl_state.program = program; } diff --git a/src/CRE/gl_state.hpp b/src/CRE/gl_state.hpp index fa13ab62..15844116 100644 --- a/src/CRE/gl_state.hpp +++ b/src/CRE/gl_state.hpp @@ -53,12 +53,12 @@ struct gl_state_struct { extern gl_state_struct gl_state; -extern void gl_state_active_bind_texture_2d(int32_t index, GLuint texture); -extern void gl_state_active_bind_texture_cube_map(int32_t index, GLuint texture); -extern void gl_state_active_texture(size_t index); -extern void gl_state_bind_framebuffer(GLuint framebuffer); -extern void gl_state_bind_read_framebuffer(GLuint framebuffer); -extern void gl_state_bind_draw_framebuffer(GLuint framebuffer); +extern void gl_state_active_bind_texture_2d(int32_t index, GLuint texture, bool force = false); +extern void gl_state_active_bind_texture_cube_map(int32_t index, GLuint texture, bool force = false); +extern void gl_state_active_texture(size_t index, bool force = false); +extern void gl_state_bind_framebuffer(GLuint framebuffer, bool force = false); +extern void gl_state_bind_read_framebuffer(GLuint framebuffer, bool force = false); +extern void gl_state_bind_draw_framebuffer(GLuint framebuffer, bool force = false); extern void gl_state_bind_vertex_array(GLuint array, bool force = false); extern void gl_state_bind_array_buffer(GLuint buffer, bool force = false); extern void gl_state_bind_element_array_buffer(GLuint buffer, bool force = false); @@ -70,9 +70,9 @@ extern void gl_state_bind_shader_storage_buffer(GLuint buffer, bool force = fals extern void gl_state_bind_shader_storage_buffer_base(GLuint index, GLuint buffer, bool force = false); extern void gl_state_bind_shader_storage_buffer_range(GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size, bool force = false); -extern void gl_state_bind_texture_2d(GLuint texture); -extern void gl_state_bind_texture_cube_map(GLuint texture); -extern void gl_state_bind_sampler(int32_t index, GLuint sampler); +extern void gl_state_bind_texture_2d(GLuint texture, bool force = false); +extern void gl_state_bind_texture_cube_map(GLuint texture, bool force = false); +extern void gl_state_bind_sampler(int32_t index, GLuint sampler, bool force = false); extern bool gl_state_check_uniform_buffer_binding(); extern bool gl_state_check_uniform_buffer_binding_base(size_t index); extern bool gl_state_check_shader_storage_buffer_binding(); @@ -80,34 +80,36 @@ extern bool gl_state_check_shader_storage_buffer_binding_base(size_t index); extern bool gl_state_check_texture_binding_2d(size_t index); extern bool gl_state_check_texture_binding_cube_map(size_t index); extern bool gl_state_check_sampler_binding(int32_t index, GLuint sampler); -extern void gl_state_disable_blend(); -extern void gl_state_disable_cull_face(); -extern void gl_state_disable_depth_test(); -extern void gl_state_disable_multisample(); -extern void gl_state_disable_primitive_restart(); -extern void gl_state_disable_scissor_test(); -extern void gl_state_disable_stencil_test(); -extern void gl_state_enable_blend(); -extern void gl_state_enable_cull_face(); -extern void gl_state_enable_depth_test(); -extern void gl_state_enable_multisample(); -extern void gl_state_enable_primitive_restart(); -extern void gl_state_enable_scissor_test(); -extern void gl_state_enable_stencil_test(); +extern void gl_state_disable_blend(bool force = false); +extern void gl_state_disable_cull_face(bool force = false); +extern void gl_state_disable_depth_test(bool force = false); +extern void gl_state_disable_multisample(bool force = false); +extern void gl_state_disable_primitive_restart(bool force = false); +extern void gl_state_disable_scissor_test(bool force = false); +extern void gl_state_disable_stencil_test(bool force = false); +extern void gl_state_enable_blend(bool force = false); +extern void gl_state_enable_cull_face(bool force = false); +extern void gl_state_enable_depth_test(bool force = false); +extern void gl_state_enable_multisample(bool force = false); +extern void gl_state_enable_primitive_restart(bool force = false); +extern void gl_state_enable_scissor_test(bool force = false); +extern void gl_state_enable_stencil_test(bool force = false); extern void gl_state_get(); extern void gl_state_get_all_gl_errors(); extern GLenum gl_state_get_error(); extern GLuint gl_state_get_program(); -extern void gl_state_set_blend_func(GLenum src, GLenum dst); +extern void gl_state_set_blend_func(GLenum src, GLenum dst, bool force = false); extern void gl_state_set_blend_func_separate(GLenum src_rgb, GLenum dst_rgb, - GLenum src_alpha, GLenum dst_alpha); -extern void gl_state_set_blend_equation(GLenum mode); -extern void gl_state_set_blend_equation_separate(GLenum mode_rgb, GLenum mode_alpha); -extern void gl_state_set_color_mask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); -extern void gl_state_set_cull_face_mode(GLenum mode); -extern void gl_state_set_depth_func(GLenum func); -extern void gl_state_set_depth_mask(GLboolean flag); -extern void gl_state_set_polygon_mode(GLenum face, GLenum mode); -extern void gl_state_set_primitive_restart_index(GLuint index); -extern void gl_state_set_stencil_mask(GLuint mask); -extern void gl_state_use_program(GLuint program); + GLenum src_alpha, GLenum dst_alpha, bool force = false); +extern void gl_state_set_blend_equation(GLenum mode, bool force = false); +extern void gl_state_set_blend_equation_separate( + GLenum mode_rgb, GLenum mode_alpha, bool force = false); +extern void gl_state_set_color_mask(GLboolean red, GLboolean green, + GLboolean blue, GLboolean alpha, bool force = false); +extern void gl_state_set_cull_face_mode(GLenum mode, bool force = false); +extern void gl_state_set_depth_func(GLenum func, bool force = false); +extern void gl_state_set_depth_mask(GLboolean flag, bool force = false); +extern void gl_state_set_polygon_mode(GLenum face, GLenum mode, bool force = false); +extern void gl_state_set_primitive_restart_index(GLuint index, bool force = false); +extern void gl_state_set_stencil_mask(GLuint mask, bool force = false); +extern void gl_state_use_program(GLuint program, bool force = false); diff --git a/src/CRE/object.cpp b/src/CRE/object.cpp index 5d3d0697..054eec90 100644 --- a/src/CRE/object.cpp +++ b/src/CRE/object.cpp @@ -1435,8 +1435,8 @@ void object_material_msgpack_write(const char* path, const char* set_name, uint3 } } -inline void object_storage_init(object_database* obj_db) { - object_set_info* obj_set = obj_db->object_set.data(); +inline void object_storage_init(const object_database* obj_db) { + const object_set_info* obj_set = obj_db->object_set.data(); size_t count = obj_db->object_set.size(); object_storage_data.resize(count); for (size_t i = 0; i < count; i++) { @@ -1840,7 +1840,7 @@ inline std::vector* object_storage_get_obj_set_textures(int32_t set) { return 0; } -int32_t object_storage_load_set(void* data, object_database* obj_db, const char* name) { +int32_t object_storage_load_set(void* data, const object_database* obj_db, const char* name) { const object_set_info* set_info = obj_db->get_object_set_info(name); if (!set_info) return 1; @@ -1877,7 +1877,7 @@ int32_t object_storage_load_set(void* data, object_database* obj_db, const char* return 0; } -int32_t object_storage_load_set(void* data, object_database* obj_db, uint32_t set_id) { +int32_t object_storage_load_set(void* data, const object_database* obj_db, uint32_t set_id) { const object_set_info* set_info = obj_db->get_object_set_info(set_id); if (!set_info) return 1; @@ -2110,7 +2110,7 @@ bool object_storage_load_obj_set_check_not_read(uint32_t set_id, return true; } -inline void object_storage_unload_set(object_database* obj_db, const char* name) { +inline void object_storage_unload_set(const object_database* obj_db, const char* name) { const object_set_info* set_info = obj_db->get_object_set_info(name); if (!set_info) return; diff --git a/src/CRE/object.hpp b/src/CRE/object.hpp index f2e8fad7..d96a83a5 100644 --- a/src/CRE/object.hpp +++ b/src/CRE/object.hpp @@ -122,7 +122,7 @@ extern void object_material_msgpack_read(const char* path, const char* set_name, extern void object_material_msgpack_write(const char* path, const char* set_name, uint32_t set_id, obj_set* obj_set, txp_set* txp_set, object_database* obj_db, texture_database* tex_db); -extern void object_storage_init(object_database* obj_db); +extern void object_storage_init(const object_database* obj_db); extern obj* object_storage_get_obj(object_info obj_info); extern obj_set_handler* object_storage_get_obj_set_handler(uint32_t set_id); extern obj_set_handler* object_storage_get_obj_set_handler_by_index(size_t index); @@ -145,11 +145,11 @@ extern obj_vertex_buffer* object_storage_get_obj_vertex_buffers(uint32_t set_id) extern obj_mesh_vertex_buffer* object_storage_get_obj_mesh_vertex_buffer(object_info obj_info); extern texture* obj_database_get_obj_set_texture(int32_t set, uint32_t tex_id); extern std::vector* object_storage_get_obj_set_textures(int32_t set); -extern int32_t object_storage_load_set(void* data, object_database* obj_db, const char* name); -extern int32_t object_storage_load_set(void* data, object_database* obj_db, uint32_t set_id); +extern int32_t object_storage_load_set(void* data, const object_database* obj_db, const char* name); +extern int32_t object_storage_load_set(void* data, const object_database* obj_db, uint32_t set_id); extern int32_t object_storage_load_set_hash(void* data, uint32_t hash); extern bool object_storage_load_obj_set_check_not_read(uint32_t set_id, object_database* obj_db = 0, texture_database* tex_db = 0); -extern void object_storage_unload_set(object_database* obj_db, const char* name); +extern void object_storage_unload_set(const object_database* obj_db, const char* name); extern void object_storage_unload_set(uint32_t set_id); extern void object_storage_free(); \ No newline at end of file diff --git a/src/CRE/ogg_vorbis.cpp b/src/CRE/ogg_vorbis.cpp index 520ad017..39df7832 100644 --- a/src/CRE/ogg_vorbis.cpp +++ b/src/CRE/ogg_vorbis.cpp @@ -253,7 +253,7 @@ bool OggFile::OpenFile(const char* path, double_t time_seek) { while (*user_comments) { std::string user_comment = *user_comments++; for (char& c : user_comment) - if (c > 0x40 && c < 0x5B) + if (c >= 'A' && c <= 'Z') c += 0x20; if (user_comment.size() >= 10 && !memcmp(user_comment.c_str(), "loop_begin", 10)) { diff --git a/src/CRE/pv_expression.cpp b/src/CRE/pv_expression.cpp index 7fe16452..07c69688 100644 --- a/src/CRE/pv_expression.cpp +++ b/src/CRE/pv_expression.cpp @@ -410,8 +410,8 @@ void pv_expression::face_set_data(float_t frame) { motion_database* aft_mot_db = &aft_data->data_ft.mot_db; int32_t mottbl_index = expression_id_to_mottbl_index(expression_id); - rob_chr->set_face_mottbl_motion(0, mottbl_index, value, mottbl_index >= 214 && mottbl_index <= 223 ? 1 : 0, - duration, 0.0f, 1.0f, -1, offset, false, aft_mot_db); + rob_chr->set_face_mottbl_motion(0, mottbl_index, value, mottbl_index >= 214 + && mottbl_index <= 223 ? 1 : 0, duration, 0.0f, 1.0f, -1, offset, false, aft_mot_db); } face_data_prev = prev; diff --git a/src/CRE/pv_param.cpp b/src/CRE/pv_param.cpp index 7a58eafc..56f4c489 100644 --- a/src/CRE/pv_param.cpp +++ b/src/CRE/pv_param.cpp @@ -881,4 +881,60 @@ namespace pv_param_task { chara_item_alpha.Reset(); return true; } + + bool post_process_task_add_task() { + return app::TaskWork::AddTask(&post_process_task, "PV POST PROCESS TASK"); + } + + void post_process_task_set_bloom_data( + pv_param::bloom& data, float_t duration) { + PostProcessCtrlBloom& bloom = post_process_task.bloom; + bloom.frame = 0.0f; + bloom.duration = duration; + bloom.data.data = data; + } + + void post_process_task_set_color_correction_data( + pv_param::color_correction& data, float_t duration) { + PostProcessCtrlCC& cc = post_process_task.cc; + cc.frame = 0.0f; + cc.duration = duration; + cc.data.data = data; + } + + void post_process_task_set_dof_data( + pv_param::dof& data, float_t duration) { + PostProcessCtrlDof& dof = post_process_task.dof; + dof.frame = 0.0f; + dof.duration = duration; + dof.data.data = data; + } + + void post_process_task_set_chara_alpha( + int32_t chara_id, int32_t type, float_t alpha, float_t duration) { + PostProcessCtrlCharaAlpha& chara_alpha = post_process_task.chara_alpha; + pv_param::chara_alpha& chara_alpha_data = chara_alpha.data.data[chara_id]; + chara_alpha_data.type = type; + chara_alpha_data.frame = 0.0f; + chara_alpha_data.alpha = alpha; + chara_alpha_data.duration = duration; + } + + void post_process_task_set_chara_item_alpha( + int32_t chara_id, int32_t type, float_t alpha, float_t duration, + PostProcessCtrlCharaItemAlpha::Callback callback, void* callback_data) { + PostProcessCtrlCharaItemAlpha& chara_item_alpha = post_process_task.chara_item_alpha; + pv_param::chara_alpha& chara_item_alpha_data = chara_item_alpha.data.data[chara_id]; + chara_item_alpha_data.type = type; + chara_item_alpha_data.frame = 0.0f; + chara_item_alpha_data.alpha = alpha; + chara_item_alpha_data.duration = duration; + + chara_item_alpha.callback[chara_id] = callback; + chara_item_alpha.callback_data[chara_id] = callback_data; + } + + bool post_process_task_del_task() { + return post_process_task.DelTask(); + } } diff --git a/src/CRE/pv_param.hpp b/src/CRE/pv_param.hpp index c918c669..dd7a3f7a 100644 --- a/src/CRE/pv_param.hpp +++ b/src/CRE/pv_param.hpp @@ -230,5 +230,17 @@ namespace pv_param_task { virtual bool Dest() override; }; - extern PostProcessTask post_process_task; + extern bool post_process_task_add_task(); + extern void post_process_task_set_bloom_data( + pv_param::bloom& data, float_t duration); + extern void post_process_task_set_color_correction_data( + pv_param::color_correction& data, float_t duration); + extern void post_process_task_set_dof_data( + pv_param::dof& data, float_t duration); + extern void post_process_task_set_chara_alpha( + int32_t chara_id, int32_t type, float_t alpha, float_t duration); + extern void post_process_task_set_chara_item_alpha( + int32_t chara_id, int32_t type, float_t alpha, float_t duration, + PostProcessCtrlCharaItemAlpha::Callback callback, void* callback_data); + extern bool post_process_task_del_task(); } diff --git a/src/CRE/render_context.cpp b/src/CRE/render_context.cpp index 420f11d9..72c6448a 100644 --- a/src/CRE/render_context.cpp +++ b/src/CRE/render_context.cpp @@ -2184,7 +2184,7 @@ namespace rndr { static const vec4 border_color = 0.0f; - glCreateSamplers(18, samplers); + glGenSamplers(18, samplers); for (int32_t i = 0; i < 18; i++) { GLuint sampler = samplers[i]; @@ -2224,7 +2224,7 @@ namespace rndr { } GLuint sampler; - glCreateSamplers(3, sprite_samplers); + glGenSamplers(3, sprite_samplers); sampler = sprite_samplers[0]; glSamplerParameteri(sampler, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST); glSamplerParameteri(sampler, GL_TEXTURE_MAG_FILTER, GL_LINEAR); @@ -2573,14 +2573,14 @@ matrix_buffer(), box_vao(), box_vbo(), empty_texture_2d(), empty_texture_cube_ma glGenTextures(1, &empty_texture_2d); gl_state_bind_texture_2d(empty_texture_2d); - texture_set_params(empty_texture_2d, GL_TEXTURE_2D, 0, false); + texture_set_params(GL_TEXTURE_2D, 0, false); glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, 4, 4, 0, 8, empty_texture_data); gl_state_bind_texture_2d(0); glGenTextures(1, &empty_texture_cube_map); gl_state_bind_texture_cube_map(empty_texture_cube_map); - texture_set_params(empty_texture_cube_map, GL_TEXTURE_CUBE_MAP, 0, false); + texture_set_params(GL_TEXTURE_CUBE_MAP, 0, false); for (int32_t side = 0; side < 6; side++) glCompressedTexImage2D(target_cube_map_array[side], 0, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, 4, 4, 0, 8, empty_texture_data); diff --git a/src/CRE/rob/ex_block.cpp b/src/CRE/rob/ex_block.cpp index 86672eeb..7ab93311 100644 --- a/src/CRE/rob/ex_block.cpp +++ b/src/CRE/rob/ex_block.cpp @@ -77,23 +77,23 @@ static void sub_14021AA60(RobCloth* rob_cls, float_t step, bool a3); static void sub_14021D480(RobCloth* rob_cls); static void sub_14021DC60(RobCloth* rob_cls, float_t step); static void sub_14021D840(RobCloth* rob_cls); -static void sub_14047C800(RobOsage* rob_osg, mat4* mat, vec3* parent_scale, +static void sub_14047C800(RobOsage* rob_osg, mat4* root_matrix, vec3* parent_scale, float_t step, bool disable_external_force, bool ring_coli, bool has_children_node); static void sub_14047E1C0(RobOsage* rob_osg, vec3* scale); static void sub_14047F110(RobOsage* rob_osg, mat4* mat, vec3* parent_scale, bool init_rot); -static void sub_1404803B0(RobOsage* rob_osg, mat4* mat, vec3* parent_scale, bool has_children_node); +static void sub_1404803B0(RobOsage* rob_osg, mat4* root_matrix, vec3* parent_scale, bool has_children_node); static void sub_140482180(RobOsageNode* node, float_t a2); static void sub_140482300(vec3* a1, vec3* a2, vec3* a3, float_t osage_gravity_const, float_t weight); static void sub_140482490(RobOsageNode* node, float_t step, float_t a3); static void sub_140482F30(vec3* pos1, vec3* pos2, float_t length); -static void sub_14047D8C0(RobOsage* rob_osg, mat4* mat, vec3* parent_scale, float_t step, bool a5); -static void sub_14047C750(RobOsage* rob_osg, mat4* mat, vec3* parent_scale, float_t step); -static void sub_14047C770(RobOsage* rob_osg, mat4* mat, +static void sub_14047D8C0(RobOsage* rob_osg, mat4* root_matrix, vec3* parent_scale, float_t step, bool a5); +static void sub_14047C750(RobOsage* rob_osg, mat4* root_matrix, vec3* parent_scale, float_t step); +static void sub_14047C770(RobOsage* rob_osg, mat4* root_matrix, vec3* parent_scale, float_t step, bool disable_external_force); static void sub_14047D620(RobOsage* rob_osg, float_t step); static void sub_14047ECA0(RobOsage* rob_osg, float_t step); -static void sub_14047F990(RobOsage* rob_osg, mat4* a2, vec3* parent_scale, bool a4); -static void sub_140480260(RobOsage* rob_osg, mat4* mat, +static void sub_14047F990(RobOsage* rob_osg, mat4* root_matrix, vec3* parent_scale, bool a4); +static void sub_140480260(RobOsage* rob_osg, mat4* root_matrix, vec3* parent_scale, float_t step, bool disable_external_force); static void sub_140482100(struc_476* a1, opd_blend_data* a2, struc_477* a3); static void sub_140482DF0(struc_477* dst, struc_477* src0, struc_477* src1, float_t blend); @@ -243,7 +243,7 @@ void ExNullBlock::Field_50() { } void ExNullBlock::InitData(rob_chara_item_equip_object* itm_eq_obj, - obj_skin_block_constraint* cns_data, const char* cns_data_name, bone_database* bone_data) { + obj_skin_block_constraint* cns_data, const char* cns_data_name, const bone_database* bone_data) { bone_node* node = itm_eq_obj->get_bone_node(cns_data_name, bone_data); type = EX_NONE; bone_node_ptr = node; @@ -977,7 +977,7 @@ void RobCloth::Disp(const mat4* mat, render_context* rctx) { void RobCloth::InitData(size_t root_count, size_t nodes_count, obj_skin_block_cloth_root* root, obj_skin_block_cloth_node* nodes, mat4* mats, int32_t a7, - rob_chara_item_equip_object* itm_eq_obj, bone_database* bone_data) { + rob_chara_item_equip_object* itm_eq_obj, const bone_database* bone_data) { this->itm_eq_obj = itm_eq_obj; obj* obj = object_storage_get_obj(itm_eq_obj->obj_info); if (!obj) @@ -1110,7 +1110,7 @@ void RobCloth::InitData(size_t root_count, size_t nodes_count, obj_skin_block_cl } void RobCloth::InitDataParent(obj_skin_block_cloth* cls_data, - rob_chara_item_equip_object* itm_eq_obj, bone_database* bone_data) { + rob_chara_item_equip_object* itm_eq_obj, const bone_database* bone_data) { ResetData(); this->cls_data = cls_data; InitData(cls_data->num_root, cls_data->num_node, cls_data->root_array, @@ -1135,7 +1135,7 @@ float_t* RobCloth::LoadOpdData(size_t node_index, float_t* opd_data, size_t opd_ return opd_data; } -void RobCloth::LoadSkinParam(void* kv, const char* name, bone_database* bone_data) { +void RobCloth::LoadSkinParam(void* kv, const char* name, const bone_database* bone_data) { key_val* _kv = (key_val*)kv; skin_param_osage_root root; skin_param_osage_root_parse(_kv, name, root, bone_data); @@ -1531,7 +1531,7 @@ void ExClothBlock::ColiSet() { } void ExClothBlock::InitData(rob_chara_item_equip_object* itm_eq_obj, - obj_skin_block_cloth* cls_data, skin_param_osage_root* skp_root, bone_database* bone_data) { + obj_skin_block_cloth* cls_data, skin_param_osage_root* skp_root, const bone_database* bone_data) { type = EX_CLOTH; bone_node_ptr = 0; this->cls_data = cls_data; @@ -1576,7 +1576,7 @@ void ExClothBlock::SetSkinParamOsageRoot(skin_param_osage_root* skp_root) { } RobOsage::RobOsage() : skin_param_ptr(), osage_setting(), field_2A0(), field_2A1(), field_2A4(), -wind_direction(), field_1EB4(), yz_order(), field_1EBC(), parent_mat_ptr(), parent_mat(), move_cancel(), +wind_direction(), field_1EB4(), yz_order(), field_1EBC(), root_matrix_ptr(), root_matrix(), move_cancel(), field_1F0C(), osage_reset(), field_1F0E(), field_1F0F(), set_external_force(), external_force(), reset_data_list() { } @@ -1618,7 +1618,7 @@ void RobOsage::ApplyResetData(mat4* mat) { mat4_mult_vec3(mat, &i->reset_data.trans_diff, &i->trans_diff); mat4_mult_vec3_trans(mat, &i->reset_data.trans, &i->trans); } - parent_mat = *parent_mat_ptr; + root_matrix = *root_matrix_ptr; } bool RobOsage::CheckPartsBits(rob_osage_parts_bit parts_bits) { @@ -1737,7 +1737,7 @@ float_t* RobOsage::LoadOpdData(size_t node_index, float_t* opd_data, size_t opd_ } void RobOsage::LoadSkinParam(void* kv, const char* name, - skin_param_osage_root& skp_root, object_info* obj_info, bone_database* bone_data) { + skin_param_osage_root& skp_root, object_info* obj_info, const bone_database* bone_data) { key_val* _kv = (key_val*)kv; skin_param_ptr = &skin_param; for (RobOsageNode& i : nodes) @@ -1778,8 +1778,8 @@ void RobOsage::Reset() { field_2A1 = false; set_external_force = false; external_force = 0.0f; - parent_mat_ptr = 0; - parent_mat = mat4_null; + root_matrix_ptr = 0; + root_matrix = mat4_null; } void RobOsage::ResetExtrenalForce() { @@ -1875,7 +1875,7 @@ void RobOsage::SetNodesForce(float_t force) { } // 0x14047E240 -void RobOsage::SetOsagePlayData(mat4* parent_mat, +void RobOsage::SetOsagePlayData(mat4* root_matrix, vec3& parent_scale, std::vector& opd_blend_data) { if (!opd_blend_data.size()) return; @@ -1931,8 +1931,8 @@ void RobOsage::SetOsagePlayData(mat4* parent_mat, v77.y = opd_y[next_key]; v77.z = opd_z[next_key]; - mat4_mult_vec3_trans(parent_mat, &v62, &v62); - mat4_mult_vec3_trans(parent_mat, &v77, &v77); + mat4_mult_vec3_trans(root_matrix, &v62, &v62); + mat4_mult_vec3_trans(root_matrix, &v77, &v77); vec3 v82 = v62 * inv_blend + v77 * blend; @@ -2066,18 +2066,18 @@ void ExOsageBlock::Field_18(int32_t stage, bool disable_external_force) { if (rob_itm_equip->opd_blend_data.size() && rob_itm_equip->opd_blend_data[0].field_C) step = 1.0f; - mat4* parent_node_mat = parent_bone_node->ex_data_mat; + mat4* root_matrix = parent_bone_node->ex_data_mat; vec3 parent_scale = parent_bone_node->exp_data.parent_scale; switch (stage) { case 0: - sub_1404803B0(&rob, parent_node_mat, &parent_scale, has_children_node); + sub_1404803B0(&rob, root_matrix, &parent_scale, has_children_node); break; case 1: case 2: if ((stage == 1 && field_58) || (stage == 2 && rob.field_2A0)) { SetWindDirection(); - sub_14047C800(&rob, parent_node_mat, - &parent_scale, step, disable_external_force, true, has_children_node); + sub_14047C800(&rob, root_matrix, &parent_scale, step, + disable_external_force, true, has_children_node); } break; case 3: @@ -2088,8 +2088,8 @@ void ExOsageBlock::Field_18(int32_t stage, bool disable_external_force) { sub_14047D620(&rob, step); break; case 5: { - sub_14047D8C0(&rob, parent_node_mat, &parent_scale, step, false); - sub_140480260(&rob, parent_node_mat, &parent_scale, step, disable_external_force); + sub_14047D8C0(&rob, root_matrix, &parent_scale, step, false); + sub_140480260(&rob, root_matrix, &parent_scale, step, disable_external_force); field_59 = true; } break; } @@ -2110,14 +2110,14 @@ void ExOsageBlock::Field_20() { vec3 parent_scale = parent_bone_node->exp_data.parent_scale; vec3 scale = parent_bone_node->exp_data.scale; - mat4 mat = *parent_bone_node->ex_data_mat; + mat4 root_matrix = *parent_bone_node->ex_data_mat; if (scale.x != 1.0f || scale.y != 1.0f || scale.z != 1.0f) { scale = 1.0f / scale; - mat4_scale_rot(&mat, &scale, &mat); + mat4_scale_rot(&root_matrix, &scale, &root_matrix); } SetWindDirection(); rob.ColiSet(mats); - sub_14047C750(&rob, &mat, &parent_scale, step); + sub_14047C750(&rob, &root_matrix, &parent_scale, step); } void ExOsageBlock::SetOsagePlayData() { @@ -2449,7 +2449,7 @@ void ExConstraintBlock::DataSet() { } void ExConstraintBlock::InitData(rob_chara_item_equip_object* itm_eq_obj, - obj_skin_block_constraint* cns_data, const char* cns_data_name, bone_database* bone_data) { + obj_skin_block_constraint* cns_data, const char* cns_data_name, const bone_database* bone_data) { bone_node* node = itm_eq_obj->get_bone_node(cns_data_name, bone_data); type = EX_CONSTRAINT; bone_node_ptr = node; @@ -2628,7 +2628,7 @@ void ExExpressionBlock::DataSet() { void ExExpressionBlock::InitData(rob_chara_item_equip_object* itm_eq_obj, obj_skin_block_expression* exp_data, const char* exp_data_name, object_info a4, - size_t index, bone_database* bone_data) { + size_t index, const bone_database* bone_data) { ex_expression_block_stack* stack_buf[28]; ex_expression_block_stack** stack_buf_val = stack_buf; @@ -3371,19 +3371,19 @@ static void sub_14021D840(RobCloth* rob_cls) { sub_140218560(rob_cls, 1.0f, true); } -static void sub_14047C800(RobOsage* rob_osg, mat4* mat, vec3* parent_scale, +static void sub_14047C800(RobOsage* rob_osg, mat4* root_matrix, vec3* parent_scale, float_t step, bool disable_external_force, bool ring_coli, bool has_children_node) { if (!rob_osg->nodes.size()) return; const float_t osage_gravity_const = get_osage_gravity_const(); - sub_1404803B0(rob_osg, mat, parent_scale, false); + sub_1404803B0(rob_osg, root_matrix, parent_scale, false); RobOsageNode* v17 = &rob_osg->nodes.data()[0]; v17->trans_orig = v17->trans; vec3 v113 = rob_osg->exp_data.position * *parent_scale; - mat4 v130 = *mat; + mat4 v130 = *root_matrix; mat4_mult_vec3_trans(&v130, &v113, &v17->trans); v17->trans_diff = v17->trans - v17->trans_orig; @@ -3560,14 +3560,14 @@ static void sub_14047F110(RobOsage* rob_osg, mat4* mat, vec3* parent_scale, bool mat4_rotate_zyx_mult(mat, &rot, mat); } -static void sub_1404803B0(RobOsage* rob_osg, mat4* mat, vec3* parent_scale, bool has_children_node) { - mat4 v47 = *mat; +static void sub_1404803B0(RobOsage* rob_osg, mat4* root_matrix, vec3* parent_scale, bool has_children_node) { + mat4 v47 = *root_matrix; vec3 v45 = rob_osg->exp_data.position * *parent_scale; mat4_mult_vec3_trans(&v47, &v45, &rob_osg->nodes.data()[0].trans); if (rob_osg->osage_reset && !rob_osg->field_1F0E) { rob_osg->field_1F0E = true; - rob_osg->ApplyResetData(mat); + rob_osg->ApplyResetData(root_matrix); } if (!rob_osg->field_1F0C) { @@ -3582,8 +3582,8 @@ static void sub_1404803B0(RobOsage* rob_osg, mat4* mat, vec3* parent_scale, bool RobOsageNode* i_end = rob_osg->nodes.data() + rob_osg->nodes.size(); for (RobOsageNode* i = i_begin; i != i_end; i++) { vec3 v44; - mat4_mult_vec3_inv_trans(&rob_osg->parent_mat, &i->trans, &v44); - mat4_mult_vec3_trans(rob_osg->parent_mat_ptr, &v44, &v44); + mat4_mult_vec3_inv_trans(&rob_osg->root_matrix, &i->trans, &v44); + mat4_mult_vec3_trans(rob_osg->root_matrix_ptr, &v44, &v44); i->trans += (v44 - i->trans) * move_cancel; } } @@ -3674,7 +3674,7 @@ static void sub_140482F30(vec3* pos1, vec3* pos2, float_t length) { *pos1 = *pos2 + diff * (length / sqrtf(dist)); } -static void sub_14047D8C0(RobOsage* rob_osg, mat4* mat, vec3* parent_scale, float_t step, bool a5) { +static void sub_14047D8C0(RobOsage* rob_osg, mat4* root_matrix, vec3* parent_scale, float_t step, bool a5) { if (!rob_osg->osage_reset && step <= 0.0f) return; @@ -3690,7 +3690,7 @@ static void sub_14047D8C0(RobOsage* rob_osg, mat4* mat, vec3* parent_scale, floa if (a5) v64 = *rob_osg->nodes.data()[0].bone_node_mat; else { - v64 = *mat; + v64 = *root_matrix; vec3 trans = rob_osg->exp_data.position * *parent_scale; mat4_mult_vec3_trans(&v64, &trans, &rob_osg->nodes.data()[0].trans); @@ -3789,8 +3789,8 @@ static void sub_14047D8C0(RobOsage* rob_osg, mat4* mat, vec3* parent_scale, floa if (v55 > v23 * v23) v35->trans_diff *= v23 / sqrtf(v55); - mat4_mult_vec3_inv_trans(mat, &v35->trans, &v35->reset_data.trans); - mat4_mult_vec3_inv(mat, &v35->trans_diff, &v35->reset_data.trans_diff); + mat4_mult_vec3_inv_trans(root_matrix, &v35->trans, &v35->reset_data.trans); + mat4_mult_vec3_inv(root_matrix, &v35->trans_diff, &v35->reset_data.trans_diff); } if (rob_osg->nodes.size() && rob_osg->node.bone_node_mat) { @@ -3803,15 +3803,15 @@ static void sub_14047D8C0(RobOsage* rob_osg, mat4* mat, vec3* parent_scale, floa } } -static void sub_14047C750(RobOsage* rob_osg, mat4* mat, vec3* parent_scale, float_t step) { - sub_14047C770(rob_osg, mat, parent_scale, step, false); +static void sub_14047C750(RobOsage* rob_osg, mat4* root_matrix, vec3* parent_scale, float_t step) { + sub_14047C770(rob_osg, root_matrix, parent_scale, step, false); } -static void sub_14047C770(RobOsage* rob_osg, mat4* mat, +static void sub_14047C770(RobOsage* rob_osg, mat4* root_matrix, vec3* parent_scale, float_t step, bool disable_external_force) { - sub_14047C800(rob_osg, mat, parent_scale, step, disable_external_force, false, false); - sub_14047D8C0(rob_osg, mat, parent_scale, step, true); - sub_140480260(rob_osg, mat, parent_scale, step, disable_external_force); + sub_14047C800(rob_osg, root_matrix, parent_scale, step, disable_external_force, false, false); + sub_14047D8C0(rob_osg, root_matrix, parent_scale, step, true); + sub_140480260(rob_osg, root_matrix, parent_scale, step, disable_external_force); } static void sub_14047D620(RobOsage* rob_osg, float_t step) { @@ -3877,12 +3877,12 @@ static void sub_14047ECA0(RobOsage* rob_osg, float_t step) { } } -static void sub_14047F990(RobOsage* rob_osg, mat4* a2, vec3* parent_scale, bool a4) { +static void sub_14047F990(RobOsage* rob_osg, mat4* root_matrix, vec3* parent_scale, bool a4) { if (!rob_osg->nodes.size()) return; vec3 v76 = rob_osg->exp_data.position * *parent_scale; - mat4_mult_vec3_trans(a2, &v76, &v76); + mat4_mult_vec3_trans(root_matrix, &v76, &v76); RobOsageNode* v12 = &rob_osg->nodes.data()[0]; v12->trans = v76; v12->trans_orig = v76; @@ -3899,7 +3899,7 @@ static void sub_14047F990(RobOsage* rob_osg, mat4* a2, vec3* parent_scale, bool else ring_height = rob_osg->ring.ring_height; - mat4 v78 = *a2; + mat4 v78 = *root_matrix; sub_14047F110(rob_osg, &v78, parent_scale, true); vec3 v60 = { 1.0f, 0.0f, 0.0f }; mat4_mult_vec3(&v78, &v60, &v60); @@ -3956,7 +3956,7 @@ static void sub_14047F990(RobOsage* rob_osg, mat4* a2, vec3* parent_scale, bool } } -static void sub_140480260(RobOsage* rob_osg, mat4* mat, +static void sub_140480260(RobOsage* rob_osg, mat4* root_matrix, vec3* parent_scale, float_t step, bool disable_external_force) { if (!disable_external_force) { rob_osg->SetNodesExternalForce(0, 1.0f); @@ -3977,7 +3977,7 @@ static void sub_140480260(RobOsage* rob_osg, mat4* mat, i.field_CC = 1.0f; } - rob_osg->parent_mat = *rob_osg->parent_mat_ptr; + rob_osg->root_matrix = *rob_osg->root_matrix_ptr; } static void sub_140482100(struc_476* a1, opd_blend_data* a2, struc_477* a3) { diff --git a/src/CRE/rob/motion.cpp b/src/CRE/rob/motion.cpp index 86bf16d0..c52d81b9 100644 --- a/src/CRE/rob/motion.cpp +++ b/src/CRE/rob/motion.cpp @@ -26,7 +26,7 @@ struct MotFile { std::map motion_storage_data; -void motion_set_load_motion(uint32_t set, std::string&& mdata_dir, motion_database* mot_db) { +void motion_set_load_motion(uint32_t set, std::string&& mdata_dir, const motion_database* mot_db) { const motion_set_info* set_info = mot_db->get_motion_set_by_id(set); if (!set_info) return; @@ -52,11 +52,11 @@ bool motion_storage_check_mot_file_not_ready(uint32_t set_id) { return false; } -const mot_data* motion_storage_get_mot_data(uint32_t motion_id, motion_database* mot_db) { +const mot_data* motion_storage_get_mot_data(uint32_t motion_id, const motion_database* mot_db) { uint32_t set_id = -1; size_t motion_index = -1; - for (motion_set_info& i : mot_db->motion_set) { - for (motion_info& j : i.motion) + for (const motion_set_info& i : mot_db->motion_set) { + for (const motion_info& j : i.motion) if (j.id == motion_id) { set_id = i.id; motion_index = &j - i.motion.data(); @@ -77,7 +77,7 @@ const mot_data* motion_storage_get_mot_data(uint32_t motion_id, motion_database* return 0; } -float_t motion_storage_get_mot_data_frame_count(uint32_t motion_id, motion_database* mot_db) { +float_t motion_storage_get_mot_data_frame_count(uint32_t motion_id, const motion_database* mot_db) { const mot_data* mot = motion_storage_get_mot_data(motion_id, mot_db); if (mot) return mot->frame_count; diff --git a/src/CRE/rob/motion.hpp b/src/CRE/rob/motion.hpp index fa12e776..0a3f325a 100644 --- a/src/CRE/rob/motion.hpp +++ b/src/CRE/rob/motion.hpp @@ -7,12 +7,12 @@ #include "rob.hpp" -extern void motion_set_load_motion(uint32_t set, std::string&& mdata_dir, motion_database* mot_db); +extern void motion_set_load_motion(uint32_t set, std::string&& mdata_dir, const motion_database* mot_db); extern void motion_set_unload_motion(uint32_t set); extern bool motion_storage_check_mot_file_not_ready(uint32_t set_id); -extern const mot_data* motion_storage_get_mot_data(uint32_t motion_id, motion_database* mot_db); -extern float_t motion_storage_get_mot_data_frame_count(uint32_t motion_id, motion_database* mot_db); +extern const mot_data* motion_storage_get_mot_data(uint32_t motion_id, const motion_database* mot_db); +extern float_t motion_storage_get_mot_data_frame_count(uint32_t motion_id, const motion_database* mot_db); extern const mot_set* motion_storage_get_motion_set(uint32_t set_id); extern void motion_init(); diff --git a/src/CRE/rob/rob.cpp b/src/CRE/rob/rob.cpp index cfd2f0fc..a96cb019 100644 --- a/src/CRE/rob/rob.cpp +++ b/src/CRE/rob/rob.cpp @@ -133,7 +133,7 @@ struct struc_527 { int32_t field_68; struc_527(rob_chara* rob_chr, int32_t stage_index, uint32_t motion_id, - float_t frame, bone_database* bone_data, motion_database* mot_db); + float_t frame, const bone_database* bone_data, const motion_database* mot_db); ~struc_527(); }; @@ -222,7 +222,8 @@ struct mothead_func_data { bool is_x; }; -typedef void(*mothead_func)(mothead_func_data*, void*, const mothead_data*, int32_t, motion_database*); +typedef void(*mothead_func)(mothead_func_data*, void*, + const mothead_data*, int32_t, const motion_database*); struct mothead_func_struct { mothead_func func; @@ -545,16 +546,16 @@ public: void FreeLoadedReqData(ReqData* req_data); void FreeLoadedReqDataObj(ReqDataObj* req_data_obj); void LoadCharaItem(chara_index chara_index, - int32_t item_no, void* data, object_database* obj_db); + 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, - item_cos_data* cos, void* data, object_database* obj_db); + 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, - item_cos_data* cos, void* data, object_database* obj_db); + item_cos_data* cos, void* data, const object_database* obj_db); void LoadCharaObjSetMotionSet(chara_index chara_index, - void* data, object_database* obj_db, motion_database* mot_db); + void* data, const object_database* obj_db, const motion_database* mot_db); bool LoadCharaObjSetMotionSetCheck(chara_index chara_index); void ResetReqData(); void ResetReqDataObj(); @@ -732,14 +733,14 @@ static bool bone_data_mult_1_exp_data(bone_data* a1, bone_node_expression_data* static void bone_data_mult_ik(bone_data* a1, int32_t skeleton_select); static void bone_data_parent_data_init(bone_data_parent* bone, - rob_chara_bone_data* rob_bone_data, bone_database* bone_data); + 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_translation, const vec3* translation); static void bone_data_parent_load_rob_chara(bone_data_parent* bone); static void mot_blend_interpolate(mot_blend* a1, std::vector* bones, std::vector* bone_indices, bone_database_skeleton_type skeleton_type); -static void mot_blend_load_motion(mot_blend* a1, int32_t motion_id, motion_database* mot_db); +static void mot_blend_load_motion(mot_blend* a1, int32_t motion_id, const motion_database* mot_db); static void mot_blend_set_blend_duration(mot_blend* a1, float_t duration, float_t step, float_t offset); static void mot_blend_set_frame(mot_blend* a1, float_t frame); @@ -755,180 +756,180 @@ static void mot_key_data_init_key_sets(mot_key_data* a1, bone_database_skeleton_ size_t motion_bone_count, size_t ik_bone_count); static void mot_key_data_interpolate(mot_key_data* a1, float_t frame, uint32_t key_set_offset, uint32_t key_set_count); -static const mot_data* mot_key_data_load_file(mot_key_data* a1, int32_t motion_id, motion_database* mot_db); +static const mot_data* mot_key_data_load_file(mot_key_data* a1, int32_t motion_id, const motion_database* mot_db); static void mot_key_data_reserve_key_sets(mot_key_data* a1); static void mothead_func_0(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_1(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_2(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_3(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_4(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_5(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_6(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_7(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_8(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_9(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_10(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_11(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_12(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_13(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_14(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_15(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_16(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_17(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_18(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_19(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_20(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_21(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_22(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_23(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_24(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_25(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_26(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_27(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_28(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_29(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_30(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_31(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_32(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_33(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_34(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_35(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_36(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_37(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_38(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_39(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_40(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_41(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_42(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_43(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_44(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_45(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_46(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_47(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_48(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_49(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_50_set_face_motion_id(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_51(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_52(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_53_set_face_mottbl_motion(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_54_set_hand_r_mottbl_motion(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_55_set_hand_l_mottbl_motion(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_56_set_mouth_mottbl_motion(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_57_set_eyes_mottbl_motion(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_58_set_eyelid_mottbl_motion(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_59_set_rob_chara_head_object(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_60(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_61_set_eyelid_motion_from_face(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_62_rob_parts_adjust(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_63(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_64_osage_reset(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_65_motion_skin_param(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_66_osage_step(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_67_sleeve(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_68(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_69_motion_max_frame(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_70(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_71_osage_move_cancel(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_72(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_73_rob_hand_adjust(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_74(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_75_rob_adjust_global(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_76_rob_arm_adjust(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_77_disable_eye_motion(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_78(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_79_rob_chara_coli_ring(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_func_80_adjust_get_global_trans(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db); + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db); static void mothead_mot_msgpack_read(const char* path, const char* set_name, mothead* mhd); // X static void motion_blend_mot_interpolate(motion_blend_mot* a1); static void motion_blend_mot_load_bone_data(motion_blend_mot* a1, - rob_chara_bone_data* a2, PFNMOTIONBONECHECKFUNC bone_check_func, bone_database* bone_data); + rob_chara_bone_data* a2, PFNMOTIONBONECHECKFUNC bone_check_func, const bone_database* bone_data); static bool motion_blend_mot_interpolate_get_reverse(int32_t* a1); static void motion_blend_mot_load_file(motion_blend_mot* a1, int32_t motion_id, - MotionBlendType blend_type, float_t blend, bone_database* bone_data, motion_database* mot_db); + MotionBlendType blend_type, float_t blend, const bone_database* bone_data, const motion_database* mot_db); static void motion_blend_mot_mult_mat(motion_blend_mot* a1, mat4* mat); static void motion_blend_mot_set_blend(motion_blend_mot* a1, MotionBlendType blend_type, float_t blend); @@ -949,7 +950,7 @@ static void rob_base_rob_chara_ctrl_thread_main(rob_chara* rob_chr); static void rob_base_rob_chara_free(rob_chara* rob_chr); static void rob_disp_rob_chara_init(rob_chara* rob_chr, - bone_database* bone_data, void* data, object_database* obj_db); + const bone_database* bone_data, void* data, const object_database* obj_db); static void rob_disp_rob_chara_ctrl(rob_chara* rob_chr); static void rob_disp_rob_chara_ctrl_thread_main(rob_chara* rob_chr); static void rob_disp_rob_chara_disp(rob_chara* rob_chr); @@ -986,39 +987,39 @@ static void rob_chara_bone_data_calculate_bones(rob_chara_bone_data* rob_bone_da static void rob_chara_bone_data_eyes_xrot_adjust(rob_chara_bone_data* rob_bone_data, const struc_241* a2, eyes_adjust* a3); static void rob_chara_bone_data_get_ik_scale( - rob_chara_bone_data* rob_bone_data, bone_database* bone_data); + 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 void rob_chara_bone_data_ik_scale_calculate( rob_chara_bone_data_ik_scale* ik_scale, std::vector* bones, bone_database_skeleton_type base_skeleton_type, - bone_database_skeleton_type skeleton_type, bone_database* bone_data); + bone_database_skeleton_type 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, bone_database* bone_data); + bone_database_skeleton_type 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, bone_database* bone_data); + bone_database_skeleton_type skeleton_type, const bone_database* bone_data); static void rob_chara_bone_data_interpolate(rob_chara_bone_data* rob_bone_data); static void rob_chara_bone_data_load_eyelid_motion(rob_chara_bone_data* rob_bone_data, - int32_t motion_id, motion_database* mot_db); + int32_t motion_id, const motion_database* mot_db); static void rob_chara_bone_data_load_eyes_motion(rob_chara_bone_data* rob_bone_data, - int32_t motion_id, motion_database* mot_db); + int32_t motion_id, const motion_database* mot_db); static void rob_chara_bone_data_load_face_motion(rob_chara_bone_data* rob_bone_data, - int32_t motion_id, motion_database* mot_db); + int32_t motion_id, const motion_database* mot_db); static void rob_chara_bone_data_load_hand_l_motion(rob_chara_bone_data* rob_bone_data, - int32_t motion_id, motion_database* mot_db); + int32_t motion_id, const motion_database* mot_db); static void rob_chara_bone_data_load_hand_r_motion(rob_chara_bone_data* rob_bone_data, - int32_t motion_id, motion_database* mot_db); + int32_t motion_id, const motion_database* mot_db); static void rob_chara_bone_data_load_mouth_motion(rob_chara_bone_data* rob_bone_data, - int32_t motion_id, motion_database* mot_db); + int32_t motion_id, const motion_database* mot_db); 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, size_t last_index); static void rob_chara_bone_data_motion_blend_mot_list_init(rob_chara_bone_data* rob_bone_data); static void rob_chara_bone_data_motion_load(rob_chara_bone_data* rob_bone_data, - int32_t motion_id, MotionBlendType blend_type, bone_database* bone_data, motion_database* mot_db); + int32_t motion_id, MotionBlendType blend_type, const bone_database* bone_data, const motion_database* mot_db); static void rob_chara_bone_data_reserve(rob_chara_bone_data* rob_bone_data); static void rob_chara_bone_data_set_eyelid_anim_blend_duration(rob_chara_bone_data* rob_bone_data, float_t duration, float_t step, float_t offset); @@ -1058,9 +1059,9 @@ static void rob_chara_age_age_ctrl(rob_chara* rob_chr, int32_t part_id, const ch 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 void rob_chara_load_default_motion(rob_chara* rob_chr, - bone_database* bone_data, motion_database* mot_db); + 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, - int32_t motion_id, bone_database* bone_data, motion_database* mot_db); + int32_t motion_id, const bone_database* bone_data, const motion_database* mot_db); 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); @@ -2195,7 +2196,7 @@ const float_t get_osage_gravity_const() { return 0.00299444468691945f; } -void motion_set_load_mothead(uint32_t set, std::string&& mdata_dir, motion_database* mot_db) { +void motion_set_load_mothead(uint32_t set, std::string&& mdata_dir, const motion_database* mot_db) { const motion_set_info* set_info = mot_db->get_motion_set_by_id(set); if (!set_info) return; @@ -2917,7 +2918,7 @@ static void mothead_apply2(struc_223* a1, rob_chara* rob_chr, const mothead_data } static void sub_14053A9C0(struc_223* a1, rob_chara* rob_chr, - uint32_t motion_id, float_t frame_count, motion_database* mot_db) { + uint32_t motion_id, float_t frame_count, const motion_database* mot_db) { a1->field_0.motion_id = motion_id; a1->field_0.field_78 = 0.0f; a1->field_0.frame_count = frame_count; @@ -2994,7 +2995,7 @@ static void sub_14053A9C0(struc_223* a1, rob_chara* rob_chr, } void rob_chara::load_motion(int32_t motion_id, bool a3, float_t frame, - MotionBlendType blend_type, bone_database* bone_data, motion_database* mot_db) { + 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.field_24.x; @@ -3102,7 +3103,7 @@ void rob_chara::load_motion(int32_t motion_id, bool a3, float_t frame, } void rob_chara::load_outfit_object_info(item_id id, object_info obj_info, - bool osage_reset, bone_database* bone_data, void* data, object_database* obj_db) { + 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); } @@ -3128,7 +3129,7 @@ static void sub_140513C60(rob_chara_item_equip* rob_itm_equip, item_id id, bool } void rob_chara::reset_data(rob_chara_pv_data* pv_data, - bone_database* bone_data, motion_database* mot_db) { + 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); @@ -3216,7 +3217,7 @@ static bool sub_14053F270(RobPartialMotion* a1); static bool sub_14053F2B0(RobPartialMotion* a1); static void rob_chara_set_eyelid_motion(rob_chara* rob_chr, - RobEyelidMotion* motion, int32_t type, motion_database* mot_db) { + RobEyelidMotion* motion, int32_t type, const motion_database* mot_db) { if (type == 1 || type == 2) { rob_chr->data.motion.field_3B0.eyelid.data = motion->data; if (!(rob_chr->data.motion.field_29 & 0x80)) @@ -3236,7 +3237,7 @@ static void rob_chara_set_eyelid_motion(rob_chara* rob_chr, } static void rob_chara_set_eyes_motion(rob_chara* rob_chr, - RobEyesMotion* motion, int32_t type, motion_database* mot_db) { + RobEyesMotion* motion, int32_t type, const motion_database* mot_db) { if (type == 1 || type == 2) { rob_chr->data.motion.field_3B0.eyes.data = motion->data; if (!(rob_chr->data.motion.field_29 & 0x40)) @@ -3256,7 +3257,7 @@ static void rob_chara_set_eyes_motion(rob_chara* rob_chr, } static void rob_chara_set_face_motion(rob_chara* rob_chr, - RobFaceMotion* motion, int32_t type, motion_database* mot_db) { + RobFaceMotion* motion, int32_t type, const motion_database* mot_db) { if (type == 2 || type == 1) { rob_chr->data.motion.field_3B0.face.data = motion->data; if (!(rob_chr->data.motion.field_29 & 0x04)) @@ -3276,7 +3277,7 @@ static void rob_chara_set_face_motion(rob_chara* rob_chr, } static void rob_chara_set_hand_l_motion(rob_chara* rob_chr, - RobHandMotion* motion, int32_t type, motion_database* mot_db) { + RobHandMotion* motion, int32_t type, const motion_database* mot_db) { if (type == 2) { rob_chr->data.motion.field_3B0.hand_l.data = motion->data; if (!(rob_chr->data.motion.field_29 & 0x08) || (rob_chr->data.motion.field_2A & 0x04)) @@ -3301,7 +3302,7 @@ static void rob_chara_set_hand_l_motion(rob_chara* rob_chr, } static void rob_chara_set_hand_r_motion(rob_chara* rob_chr, - RobHandMotion* motion, int32_t type, motion_database* mot_db) { + RobHandMotion* motion, int32_t type, const motion_database* mot_db) { if (type == 2) { rob_chr->data.motion.field_3B0.hand_r.data = motion->data; if (!(rob_chr->data.motion.field_29 & 0x10) || (rob_chr->data.motion.field_2A & 0x08)) @@ -3326,7 +3327,7 @@ static void rob_chara_set_hand_r_motion(rob_chara* rob_chr, } static void rob_chara_set_mouth_motion(rob_chara* rob_chr, - RobMouthMotion* motion, int32_t type, motion_database* mot_db) { + RobMouthMotion* motion, int32_t type, const motion_database* mot_db) { if (type == 1 || type == 2) { rob_chr->data.motion.field_3B0.mouth.data = motion->data; if (!(rob_chr->data.motion.field_29 & 0x20)) @@ -3402,7 +3403,7 @@ static void sub_1405500F0(rob_chara* rob_chr) { } void rob_chara::set_eyelid_mottbl_motion_from_face(int32_t a2, - float_t blend_duration, float_t value, float_t blend_offset, motion_database* mot_db) { + float_t blend_duration, float_t value, float_t blend_offset, const motion_database* mot_db) { if (!a2) a2 = data.motion.field_150.field_1C0; @@ -3510,7 +3511,7 @@ void rob_chara::set_eyelid_mottbl_motion_from_face(int32_t a2, void rob_chara::set_eyelid_mottbl_motion(int32_t type, int32_t mottbl_index, float_t value, int32_t state, float_t blend_duration, - float_t a7, float_t step, int32_t a9, float_t blend_offset, motion_database* mot_db) { + float_t a7, float_t step, int32_t a9, float_t blend_offset, const motion_database* mot_db) { RobEyelidMotion motion; motion.data.motion_id = get_rob_cmn_mottbl_motion_id(mottbl_index); motion.data.mottbl_index = mottbl_index; @@ -3538,7 +3539,7 @@ void rob_chara::set_eyelid_mottbl_motion(int32_t type, void rob_chara::set_eyes_mottbl_motion(int32_t type, int32_t mottbl_index, float_t value, int32_t state, float_t blend_duration, - float_t a7, float_t step, int32_t a9, float_t blend_offset, motion_database* mot_db) { + float_t a7, float_t step, int32_t a9, float_t blend_offset, const motion_database* mot_db) { RobEyesMotion motion; motion.data.motion_id = get_rob_cmn_mottbl_motion_id(mottbl_index); motion.data.mottbl_index = mottbl_index; @@ -3568,7 +3569,7 @@ static void sub_140553970(rob_chara* rob_chr, object_info a2, int32_t type) { void rob_chara::set_face_mottbl_motion(int32_t type, int32_t mottbl_index, float_t value, int32_t state, float_t blend_duration, - float_t a7, float_t step, int32_t a9, float_t blend_offset, bool a11, motion_database* mot_db) { + float_t a7, float_t step, int32_t a9, float_t blend_offset, bool a11, const motion_database* mot_db) { RobFaceMotion motion; motion.data.motion_id = get_rob_cmn_mottbl_motion_id(mottbl_index); motion.data.mottbl_index = mottbl_index; @@ -3676,7 +3677,7 @@ void rob_chara::set_frame(float_t frame) { void rob_chara::set_hand_l_mottbl_motion(int32_t type, int32_t mottbl_index, float_t value, int32_t state, float_t blend_duration, - float_t a7, float_t step, int32_t a9, float_t blend_offset, motion_database* mot_db) { + float_t a7, float_t step, int32_t a9, float_t blend_offset, const motion_database* mot_db) { RobHandMotion motion; motion.data.motion_id = get_rob_cmn_mottbl_motion_id(mottbl_index); motion.data.mottbl_index = mottbl_index; @@ -3699,7 +3700,7 @@ void rob_chara::set_hand_l_mottbl_motion(int32_t type, void rob_chara::set_hand_r_mottbl_motion(int32_t type, int32_t mottbl_index, float_t value, int32_t state, float_t blend_duration, - float_t a7, float_t step, int32_t a9, float_t blend_offset, motion_database* mot_db) { + float_t a7, float_t step, int32_t a9, float_t blend_offset, const motion_database* mot_db) { RobHandMotion motion; motion.data.motion_id = get_rob_cmn_mottbl_motion_id(mottbl_index); motion.data.mottbl_index = mottbl_index; @@ -3722,7 +3723,7 @@ void rob_chara::set_hand_r_mottbl_motion(int32_t type, bool rob_chara::set_motion_id(int32_t motion_id, float_t frame, float_t blend_duration, bool a5, bool set_motion_reset_data, - MotionBlendType blend_type, bone_database* bone_data, motion_database* mot_db) { + MotionBlendType blend_type, const bone_database* bone_data, const motion_database* mot_db) { if (!a5 && data.motion.motion_id == motion_id) return false; @@ -3758,7 +3759,7 @@ void rob_chara::set_motion_skin_param(int32_t motion_id, float_t frame) { void rob_chara::set_mouth_mottbl_motion(int32_t type, int32_t mottbl_index, float_t value, int32_t state, float_t blend_duration, - float_t a7, float_t step, int32_t a9, float_t blend_offset, motion_database* mot_db) { + float_t a7, float_t step, int32_t a9, float_t blend_offset, const motion_database* mot_db) { RobMouthMotion motion; motion.data.motion_id = get_rob_cmn_mottbl_motion_id(mottbl_index); motion.data.mottbl_index = mottbl_index; @@ -4411,7 +4412,7 @@ static vec3* bone_data_set_key_data(bone_data* data, vec3* keyframe_data, } static void bone_data_parent_data_init(bone_data_parent* bone, - rob_chara_bone_data* rob_bone_data, bone_database* bone_data) { + 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); @@ -4495,7 +4496,7 @@ static void bone_data_parent_load_bone_database(bone_data_parent* bone, } static void bone_data_parent_load_bone_indices_from_mot(bone_data_parent* a1, - const mot_data* a2, bone_database* bone_data, motion_database* mot_db) { + const mot_data* a2, const bone_database* bone_data, const motion_database* mot_db) { if (!a2) return; @@ -4508,7 +4509,7 @@ static void bone_data_parent_load_bone_indices_from_mot(bone_data_parent* a1, 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); - std::string* bone_names = mot_db->bone_name.data(); + const std::string* bone_names = 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++) { @@ -4571,7 +4572,7 @@ static void mot_blend_interpolate(mot_blend* a1, std::vector* bones, } } -static void mot_blend_load_motion(mot_blend* a1, int32_t motion_id, motion_database* mot_db) { +static void mot_blend_load_motion(mot_blend* a1, int32_t motion_id, const motion_database* mot_db) { mot_key_data_load_file(&a1->mot_key_data, motion_id, mot_db); a1->blend.Reset(); } @@ -4871,7 +4872,7 @@ static void mot_key_data_interpolate(mot_key_data* a1, float_t frame, &a1->key_set.data()[key_set_offset], key_set_count, &a1->field_68); } -static const mot_data* mot_key_data_load_file(mot_key_data* a1, int32_t motion_id, motion_database* mot_db) { +static const mot_data* mot_key_data_load_file(mot_key_data* a1, int32_t motion_id, const motion_database* mot_db) { if (a1->motion_id != motion_id) { const mot_data* mot_data = motion_storage_get_mot_data(motion_id, mot_db); a1->mot_data = mot_data; @@ -4901,17 +4902,17 @@ static void mot_key_data_reserve_key_sets(mot_key_data* a1) { } static void mothead_func_0(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { } static void mothead_func_1(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { } static void mothead_func_2(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + 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 & 8) @@ -4921,27 +4922,27 @@ static void mothead_func_2(mothead_func_data* func_data, } static void mothead_func_3(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + 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); } static void mothead_func_4(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + 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)); } static void mothead_func_5(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + 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; rob_chr_data->motion.field_28 ^= (rob_chr_data->motion.field_28 ^ ~rob_chr_data->motion.field_28) & 0x04; } static void mothead_func_6(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + 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; @@ -4960,7 +4961,7 @@ static void sub_140551AF0(rob_chara* rob_chr) { } static void mothead_func_7(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + 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) @@ -4977,32 +4978,32 @@ static void mothead_func_7(mothead_func_data* func_data, } static void mothead_func_8(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { //sub_14036D130(0, &((int16_t*)data)[2]); } static void mothead_func_9(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { } static void mothead_func_10(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { } static void mothead_func_11(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { } static void mothead_func_12(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { } static void mothead_func_13(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { /*rob_chara* rob_chr; // r8 rob_chara_data* v5; // r9 int32_t v6; // ecx @@ -5045,22 +5046,22 @@ static void mothead_func_13(mothead_func_data* func_data, } static void mothead_func_14(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { } static void mothead_func_15(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { } static void mothead_func_16(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { } static void mothead_func_17(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { /*__int16 v4; // r14 rob_chara_data* v5; // rsi float_t v8; // xmm3_4 @@ -5214,62 +5215,62 @@ LABEL_27: } static void mothead_func_18(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { } static void mothead_func_19(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { } static void mothead_func_20(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { } static void mothead_func_21(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { } static void mothead_func_22(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { } static void mothead_func_23(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { } static void mothead_func_24(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { } static void mothead_func_25(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { } static void mothead_func_26(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { } static void mothead_func_27(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { } static void mothead_func_28(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { } static void mothead_func_29(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { /*char* v5; // rbx __int16 v8; // r9 int32_t v9; // eax @@ -5354,13 +5355,13 @@ static void mothead_func_29(mothead_func_data* func_data, } static void mothead_func_30(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + 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; } static void mothead_func_31(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { } @@ -5379,7 +5380,7 @@ static int32_t sub_140533440(int32_t a1) { } static void mothead_func_32(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + 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; if (func_data->is_x) { // X @@ -5430,7 +5431,7 @@ static uint64_t sub_1405333D0(uint32_t a1) { } static void mothead_func_33(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + 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] @@ -5454,149 +5455,149 @@ static void mothead_func_33(mothead_func_data* func_data, } static void mothead_func_34(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { } static void mothead_func_35(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { } static void mothead_func_36(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { } static void mothead_func_37(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { } static void mothead_func_38(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { } static void mothead_func_39(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { } static void mothead_func_40(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { } static void mothead_func_41(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { } static void mothead_func_42(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { } static void mothead_func_43(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { } static void mothead_func_44(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { } static void mothead_func_45(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { } static void mothead_func_46(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { } static void mothead_func_47(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { } static void mothead_func_48(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { } static void mothead_func_49(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { } static void rob_chara_set_face_motion_id(rob_chara* rob_chr, int32_t motion_id, float_t frame, int32_t state, float_t blend_duration, float_t a6, - float_t step, int32_t a8, float_t blend_offset, motion_database* mot_db); + float_t step, int32_t a8, float_t blend_offset, const motion_database* mot_db); static void mothead_func_50_set_face_motion_id(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { rob_chara_set_face_motion_id(func_data->rob_chr, ((int32_t*)data)[0], ((float_t*)data)[1], 0, 0.0f, 0.0f, 1.0f, -1, 0.0f, mot_db); } static void mothead_func_51(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { } static void mothead_func_52(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { } static void mothead_func_53_set_face_mottbl_motion(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { func_data->rob_chr->set_face_mottbl_motion(0, ((int32_t*)data)[0], ((float_t*)data)[1], ((int32_t*)data)[3], ((float_t*)data)[2] * 6.0f, ((float_t*)data)[4], 1.0f, -1, 0.0f, false, mot_db); } static void mothead_func_54_set_hand_r_mottbl_motion(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { func_data->rob_chr->set_hand_r_mottbl_motion(0, ((int32_t*)data)[0], ((float_t*)data)[1], ((int32_t*)data)[3], ((float_t*)data)[2] * 12.0f, ((float_t*)data)[4], 1.0f, -1, 0.0f, mot_db); } static void mothead_func_55_set_hand_l_mottbl_motion(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { func_data->rob_chr->set_hand_l_mottbl_motion(0, ((int32_t*)data)[0], ((float_t*)data)[1], ((int32_t*)data)[3], ((float_t*)data)[2] * 12.0f, ((float_t*)data)[4], 1.0f, -1, 0.0f, mot_db); } static void mothead_func_56_set_mouth_mottbl_motion(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { func_data->rob_chr->set_mouth_mottbl_motion(0, ((int32_t*)data)[0], ((float_t*)data)[1], ((int32_t*)data)[3], ((float_t*)data)[2] * 6.0f, ((float_t*)data)[4], 1.0f, -1, 0.0f, mot_db); } static void mothead_func_57_set_eyes_mottbl_motion(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { func_data->rob_chr->set_eyes_mottbl_motion(0, ((int32_t*)data)[0], ((float_t*)data)[1], ((int32_t*)data)[3], ((float_t*)data)[2] * 6.0f, ((float_t*)data)[4], 1.0f, -1, 0.0f, mot_db); } static void mothead_func_58_set_eyelid_mottbl_motion(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { func_data->rob_chr->set_eyelid_mottbl_motion(0, ((int32_t*)data)[0], ((float_t*)data)[1], ((int32_t*)data)[3], ((float_t*)data)[2] * 6.0f, ((float_t*)data)[4], 1.0f, -1, 0.0f, mot_db); } static void rob_chara_set_eyelid_motion_id(rob_chara* rob_chr, int32_t motion_id, float_t frame, int32_t state, float_t blend_duration, float_t a6, - float_t step, int32_t a8, float_t blend_offset, motion_database* mot_db); + float_t step, int32_t a8, float_t blend_offset, const motion_database* mot_db); static void rob_chara_set_eyes_motion_id(rob_chara* rob_chr, int32_t motion_id, float_t frame, int32_t state, float_t blend_duration, float_t a6, - float_t step, int32_t a8, float_t blend_offset, motion_database* mot_db); + float_t step, int32_t a8, float_t blend_offset, const motion_database* mot_db); -static void rob_chara_set_head_object(rob_chara* rob_chr, int32_t head_object_id, motion_database* mot_db) { +static void rob_chara_set_head_object(rob_chara* rob_chr, int32_t head_object_id, const motion_database* mot_db) { rob_chr->data.motion.field_150.head_object = rob_chara_get_head_object(rob_chr, head_object_id); rob_chara_set_face_motion_id(rob_chr, -1, 0.0f, -1, 0.0f, 0.0f, 1.0f, -1, 0.0f, mot_db); rob_chara_set_eyelid_motion_id(rob_chr, -1, 0.0f, -1, 0.0f, 0.0f, 1.0f, -1, 0.0f, mot_db); @@ -5605,7 +5606,7 @@ static void rob_chara_set_head_object(rob_chara* rob_chr, int32_t head_object_id } static void mothead_func_59_set_rob_chara_head_object(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { rob_chara_set_head_object(func_data->rob_chr, ((int32_t*)data)[0], mot_db); } @@ -5640,13 +5641,13 @@ static void sub_140554830(rob_chara* rob_chr, uint8_t a2, uint8_t a3, } static void mothead_func_60(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { sub_140554830(func_data->rob_chr, 1, ((int32_t*)data)[0] != 0, ((float_t*)data)[1], ((float_t*)data)[2], ((float_t*)data)[3] * 6.0f, 0.25f, 0.0f, 0); } static void mothead_func_61_set_eyelid_motion_from_face(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { func_data->rob_chr->set_eyelid_mottbl_motion_from_face( ((int32_t*)data)[0], ((float_t*)data)[1] * 6.0f, -1.0f, 0.0f, mot_db); } @@ -5660,7 +5661,7 @@ static void rob_chara_set_parts_adjust_by_index(rob_chara* rob_chr, } static void mothead_func_62_rob_parts_adjust(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { rob_chara* rob_chr = func_data->rob_chr; rob_chara_data_adjust v16; @@ -5697,17 +5698,17 @@ static void mothead_func_62_rob_parts_adjust(mothead_func_data* func_data, } static void mothead_func_63(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { } static void mothead_func_64_osage_reset(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { func_data->rob_chr->set_osage_reset(); } static void mothead_func_65_motion_skin_param(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { rob_chara* rob_chr = func_data->rob_chr; int32_t motion_id = rob_chr->data.motion.motion_id; float_t _frame = (float_t)mhd_data->frame; @@ -5716,12 +5717,12 @@ static void mothead_func_65_motion_skin_param(mothead_func_data* func_data, } static void mothead_func_66_osage_step(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { func_data->rob_chr->set_step(((float_t*)data)[0]); } static void mothead_func_67_sleeve(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { bool v5 = false; bool v6 = false; switch (((int32_t*)data)[0]) { @@ -5744,7 +5745,7 @@ static void mothead_func_67_sleeve(mothead_func_data* func_data, } static void mothead_func_68(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { motion_blend_mot* v2 = func_data->rob_chr->bone_data->motion_loaded.front(); v2->mot_key_data.frame = -1.0f; v2->mot_key_data.field_68.field_0 = ((int32_t*)data)[0]; @@ -5752,7 +5753,7 @@ static void mothead_func_68(mothead_func_data* func_data, } static void mothead_func_69_motion_max_frame(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { float_t max_frame = (float_t)*(int32_t*)data; func_data->rob_chr->bone_data->set_motion_max_frame(max_frame); /*pv_game* v6 = pv_game_get(); @@ -5761,7 +5762,7 @@ static void mothead_func_69_motion_max_frame(mothead_func_data* func_data, } static void mothead_func_70(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { /*pv_game* v5 = pv_game_data_get(); if (!v5) return; @@ -5777,12 +5778,12 @@ static void mothead_func_70(mothead_func_data* func_data, } static void mothead_func_71_osage_move_cancel(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { func_data->rob_chr->set_osage_move_cancel(((uint8_t*)data)[0], ((float_t*)data)[1]); } static void mothead_func_72(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { rob_chara_adjust_data* v6 = &func_data->rob_chr->data.adjust_data; v6->offset.x = ((float_t*)data)[0]; v6->offset.y = ((float_t*)data)[1]; @@ -5793,7 +5794,7 @@ static void mothead_func_72(mothead_func_data* func_data, } static void mothead_func_73_rob_hand_adjust(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { rob_chara_motion* v4 = &func_data->rob_chr->data.motion; int32_t hand = ((int16_t*)data)[0]; @@ -5843,7 +5844,7 @@ static void sub_140555120(rob_chara* rob_chr, rob_osage_parts a2, bool a3) { } static void mothead_func_74(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { sub_140555120(func_data->rob_chr, (rob_osage_parts)((uint8_t*)data)[0], !!((uint8_t*)data)[1]); } @@ -5853,7 +5854,7 @@ void rob_chara_set_adjust_global(rob_chara* rob_chr, rob_chara_data_adjust* a2) } static void mothead_func_75_rob_adjust_global(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { rob_chara* rob_chr = func_data->rob_chr; rob_chara_data_adjust v14; @@ -5886,7 +5887,7 @@ static void mothead_func_75_rob_adjust_global(mothead_func_data* func_data, } static void mothead_func_76_rob_arm_adjust(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { rob_chara* rob_chr = func_data->rob_chr; rob_chara_data_arm_adjust* arm_adjust = &rob_chr->data.motion.arm_adjust[((int16_t*)data)[0]]; @@ -5898,12 +5899,12 @@ static void mothead_func_76_rob_arm_adjust(mothead_func_data* func_data, } static void mothead_func_77_disable_eye_motion(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { rob_chara_bone_data_set_disable_eye_motion(func_data->rob_chr->bone_data, ((uint8_t*)data)[0] != 0); } static void mothead_func_78(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { static const int16_t word_140A2D430[] = { 1, 0, 3, 2, 4, 0, 0, 0 }; @@ -5960,12 +5961,12 @@ static void mothead_func_78(mothead_func_data* func_data, } static void mothead_func_79_rob_chara_coli_ring(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { //rob_chara_set_coli_ring(func_data->rob_chr, ((int8_t*)data)[0]); } static void mothead_func_80_adjust_get_global_trans(mothead_func_data* func_data, - void* data, const mothead_data* mhd_data, int32_t frame, motion_database* mot_db) { + void* data, const mothead_data* mhd_data, int32_t frame, const motion_database* mot_db) { func_data->rob_chr_data->adjust_data.get_global_trans = ((uint8_t*)data)[0]; } @@ -6357,7 +6358,7 @@ static void sub_140413350(struc_240* a1, PFNMOTIONBONECHECKFUNC bone_check_func, } static void motion_blend_mot_load_bone_data(motion_blend_mot* a1, - rob_chara_bone_data* a2, PFNMOTIONBONECHECKFUNC bone_check_func, bone_database* bone_data) { + rob_chara_bone_data* a2, PFNMOTIONBONECHECKFUNC bone_check_func, const bone_database* bone_data) { bone_data_parent_data_init(&a1->bone_data, a2, bone_data); mot_key_data_init_key_sets( &a1->mot_key_data, @@ -6413,7 +6414,7 @@ static void sub_140412F20(mot_blend* a1, std::vector* a2) { } static void motion_blend_mot_load_file(motion_blend_mot* a1, int32_t motion_id, - MotionBlendType blend_type, float_t blend, bone_database* bone_data, motion_database* mot_db) { + MotionBlendType blend_type, float_t blend, const bone_database* bone_data, const motion_database* mot_db) { motion_blend_mot_set_blend(a1, blend_type, blend); const mot_data* v6 = mot_key_data_load_file(&a1->mot_key_data, motion_id, mot_db); bone_data_parent* v7 = &a1->bone_data; @@ -6854,7 +6855,7 @@ static void sub_140514540(rob_chara* rob_chr) { rob_chr->data.field_8.field_2C.field_0 = 0; } -static void sub_1405145F0(rob_chara* rob_chr, bone_database* bone_data, motion_database* mot_db) { +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) return; @@ -6870,14 +6871,14 @@ static void sub_1405145F0(rob_chara* rob_chr, bone_database* bone_data, motion_d rob_chr->data.field_8.field_0++; } -static void sub_1405144C0(rob_chara* rob_chr, bone_database* bone_data, motion_database* mot_db) { +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) { pv_expression_array_ctrl(rob_chr); sub_1405145F0(rob_chr, bone_data, mot_db); } } -static void sub_140514520(rob_chara* rob_chr, bone_database* bone_data, motion_database* mot_db) { +static void sub_140514520(rob_chara* rob_chr, const bone_database* bone_data, const motion_database* mot_db) { sub_140514540(rob_chr); sub_1405144C0(rob_chr, bone_data, mot_db); } @@ -6979,7 +6980,7 @@ static void* sub_140551F60(rob_chara* rob_chr, uint32_t* a2) { return 0; } -static void sub_1405077D0(rob_chara* rob_chr, bone_database* bone_data, motion_database* mot_db) { +static void sub_1405077D0(rob_chara* rob_chr, const bone_database* bone_data, const motion_database* mot_db) { void* v2 = sub_140551F60(rob_chr, &rob_chr->data.motion.field_30); void* v3 = v2; if (!v2) @@ -7015,7 +7016,7 @@ static bool sub_140419E90(rob_chara_bone_data* rob_bone_data) { return sub_140413710(&rob_bone_data->motion_loaded.front()->mot_play_data); } -static void sub_140505310(rob_chara* rob_chr, bone_database* bone_data, motion_database* mot_db) { +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) { case -1: { rob_chr->data.field_1588.field_0.field_20.field_0 &= ~0x81; @@ -7125,7 +7126,7 @@ LABEL_23: } } -static void mothead_apply(struc_223* a1, rob_chara* rob_chr, float_t frame, motion_database* mot_db) { +static void mothead_apply(struc_223* a1, rob_chara* rob_chr, float_t frame, const motion_database* mot_db) { a1->field_330.field_338 = 0; struc_377& v4 = a1->field_330.field_0; @@ -7268,7 +7269,7 @@ static void sub_1405044B0(rob_chara* rob_chr) { rob_chr->data.motion.field_140.z = 0.0f; } -static void sub_1405070E0(rob_chara* rob_chr, bone_database* bone_data, motion_database* mot_db) { +static void sub_1405070E0(rob_chara* rob_chr, const bone_database* bone_data, const motion_database* mot_db) { if (sub_140419E90(rob_chr->bone_data) || rob_chr->bone_data->get_motion_has_looped()) sub_140505310(rob_chr, bone_data, mot_db); sub_140505980(rob_chr); @@ -7316,7 +7317,7 @@ static void rob_chara_arm_adjust_ctrl(rob_chara* rob_chr) { } static void rob_chara_set_face_motion(rob_chara* rob_chr, - RobFaceMotion* motion, int32_t type, motion_database* mot_db); + RobFaceMotion* motion, int32_t type, const motion_database* mot_db); static bool sub_14053F290(RobPartialMotion* a1) { return a1->data.state == 1; @@ -7358,7 +7359,7 @@ static bool sub_14053F1B0(RobPartialMotion* a1) { static void rob_chara_set_face_motion_id(rob_chara* rob_chr, int32_t motion_id, float_t frame, int32_t state, float_t blend_duration, float_t a6, - float_t step, int32_t a8, float_t blend_offset, motion_database* mot_db) { + float_t step, int32_t a8, float_t blend_offset, const motion_database* mot_db) { RobFaceMotion motion; motion.data.blend_duration = blend_duration; motion.data.blend_offset = blend_offset; @@ -7378,17 +7379,17 @@ static void rob_chara_set_face_motion_id(rob_chara* rob_chr, int32_t motion_id, rob_chara_set_face_motion(rob_chr, &motion, 0, mot_db); } -static void sub_1405509D0(rob_chara* rob_chr, motion_database* mot_db) { +static void sub_1405509D0(rob_chara* rob_chr, const motion_database* mot_db) { if (sub_14053F1B0(&rob_chr->data.motion.field_150.face)) rob_chara_set_face_motion_id(rob_chr, -1, 0.0f, -1, 6.0f, 0.0f, 1.0f, -1, 0.0f, mot_db); } static void rob_chara_set_hand_l_motion(rob_chara* rob_chr, - RobHandMotion* motion, int32_t type, motion_database* mot_db); + RobHandMotion* motion, int32_t type, const motion_database* mot_db); static void sub_140553E30(rob_chara* rob_chr, int32_t motion_id, float_t frame, int32_t state, float_t blend_duration, float_t a6, - float_t step, int32_t a8, float_t blend_offset, motion_database* mot_db) { + float_t step, int32_t a8, float_t blend_offset, const motion_database* mot_db) { RobHandMotion motion; motion.data.blend_duration = blend_duration; motion.data.blend_offset = blend_offset; @@ -7408,17 +7409,17 @@ static void sub_140553E30(rob_chara* rob_chr, int32_t motion_id, rob_chara_set_hand_l_motion(rob_chr, &motion, 0, mot_db); } -static void sub_140550A40(rob_chara* rob_chr, motion_database* mot_db) { +static void sub_140550A40(rob_chara* rob_chr, const motion_database* mot_db) { if (sub_14053F1B0(&rob_chr->data.motion.field_150.hand_l)) sub_140553E30(rob_chr, -1, 0.0f, -1, 12.0f, 0.0f, 1.0f, -1, 0.0f, mot_db); } static void rob_chara_set_hand_r_motion(rob_chara* rob_chr, - RobHandMotion* motion, int32_t type, motion_database* mot_db); + RobHandMotion* motion, int32_t type, const motion_database* mot_db); static void sub_140554370(rob_chara* rob_chr, int32_t motion_id, float_t frame, int32_t state, float_t blend_duration, float_t a6, - float_t step, int32_t a8, float_t blend_offset, motion_database* mot_db) { + float_t step, int32_t a8, float_t blend_offset, const motion_database* mot_db) { RobHandMotion motion; motion.data.blend_duration = blend_duration; motion.data.blend_offset = blend_offset; @@ -7438,17 +7439,17 @@ static void sub_140554370(rob_chara* rob_chr, int32_t motion_id, rob_chara_set_hand_r_motion(rob_chr, &motion, 0, mot_db); } -static void sub_140550AB0(rob_chara* rob_chr, motion_database* mot_db) { +static void sub_140550AB0(rob_chara* rob_chr, const motion_database* mot_db) { if (sub_14053F1B0(&rob_chr->data.motion.field_150.hand_r)) sub_140553E30(rob_chr, -1, 0.0f, -1, 12.0f, 0.0f, 1.0f, -1, 0.0f, mot_db); } static void rob_chara_set_mouth_motion(rob_chara* rob_chr, - RobMouthMotion* motion, int32_t type, motion_database* mot_db); + RobMouthMotion* motion, int32_t type, const motion_database* mot_db); static void sub_140554C40(rob_chara* rob_chr, int32_t motion_id, float_t frame, int32_t state, float_t blend_duration, float_t a6, - float_t step, int32_t a8, float_t blend_offset, motion_database* mot_db) { + float_t step, int32_t a8, float_t blend_offset, const motion_database* mot_db) { RobMouthMotion motion; motion.data.blend_duration = blend_duration; motion.data.blend_offset = blend_offset; @@ -7468,17 +7469,17 @@ static void sub_140554C40(rob_chara* rob_chr, int32_t motion_id, rob_chara_set_mouth_motion(rob_chr, &motion, 0, mot_db); } -static void sub_140550B20(rob_chara* rob_chr, motion_database* mot_db) { +static void sub_140550B20(rob_chara* rob_chr, const motion_database* mot_db) { if (sub_14053F1B0(&rob_chr->data.motion.field_150.mouth)) sub_140554C40(rob_chr, -1, 0.0f, -1, 6.0f, 0.0f, 1.0f, -1, 0.0f, mot_db); } static void rob_chara_set_eyes_motion(rob_chara* rob_chr, - RobEyesMotion* motion, int32_t type, motion_database* mot_db); + RobEyesMotion* motion, int32_t type, const motion_database* mot_db); static void rob_chara_set_eyes_motion_id(rob_chara* rob_chr, int32_t motion_id, float_t frame, int32_t state, float_t blend_duration, float_t a6, - float_t step, int32_t a8, float_t blend_offset, motion_database* mot_db) { + float_t step, int32_t a8, float_t blend_offset, const motion_database* mot_db) { RobEyesMotion motion; motion.data.blend_duration = blend_duration; motion.data.blend_offset = blend_offset; @@ -7498,17 +7499,17 @@ static void rob_chara_set_eyes_motion_id(rob_chara* rob_chr, int32_t motion_id, rob_chara_set_eyes_motion(rob_chr, &motion, 0, mot_db); } -static void sub_140550960(rob_chara* rob_chr, motion_database* mot_db) { +static void sub_140550960(rob_chara* rob_chr, const motion_database* mot_db) { if (sub_14053F1B0(&rob_chr->data.motion.field_150.eyes)) rob_chara_set_eyes_motion_id(rob_chr, -1, 0.0f, -1, 6.0f, 0.0f, 1.0f, -1, 0.0f, mot_db); } static void rob_chara_set_eyelid_motion(rob_chara* rob_chr, - RobEyelidMotion* motion, int32_t type, motion_database* mot_db); + RobEyelidMotion* motion, int32_t type, const motion_database* mot_db); static void rob_chara_set_eyelid_motion_id(rob_chara* rob_chr, int32_t motion_id, float_t frame, int32_t state, float_t blend_duration, float_t a6, - float_t step, int32_t a8, float_t blend_offset, motion_database* mot_db) { + float_t step, int32_t a8, float_t blend_offset, const motion_database* mot_db) { RobEyelidMotion motion; motion.data.blend_duration = blend_duration; motion.data.blend_offset = blend_offset; @@ -7528,7 +7529,7 @@ static void rob_chara_set_eyelid_motion_id(rob_chara* rob_chr, int32_t motion_id rob_chara_set_eyelid_motion(rob_chr, &motion, 0, mot_db); } -static void sub_1405508F0(rob_chara* rob_chr, motion_database* mot_db) { +static void sub_1405508F0(rob_chara* rob_chr, const motion_database* mot_db) { if (sub_14053F1B0(&rob_chr->data.motion.field_150.eyelid)) rob_chara_set_eyelid_motion_id(rob_chr, -1, 0.0f, -1, 6.0f, 0.0f, 1.0f, -1, 0.0f, mot_db); } @@ -7537,7 +7538,7 @@ static bool sub_1404190E0(rob_chara_bone_data* rob_bone_data) { return rob_bone_data->eyelid.blend.enable || rob_bone_data->eyelid.blend.rot_y; } -static void sub_140555F70(rob_chara* rob_chr, motion_database* mot_db) { +static void sub_140555F70(rob_chara* rob_chr, const motion_database* mot_db) { if (sub_1404190E0(rob_chr->bone_data)) return; @@ -7688,8 +7689,8 @@ static void sub_140504F00(rob_chara* rob_chr) { } } -static void sub_140504710(rob_chara* rob_chr, motion_database* mot_db, - bone_database* bone_data, void* data, object_database* obj_db) { +static void sub_140504710(rob_chara* rob_chr, const motion_database* mot_db, + const bone_database* bone_data, void* data, const object_database* obj_db) { sub_1405509D0(rob_chr, mot_db); sub_140550A40(rob_chr, mot_db); sub_140550AB0(rob_chr, mot_db); @@ -7881,7 +7882,7 @@ static void rob_base_rob_chara_free(rob_chara* rob_chr) { } static void rob_disp_rob_chara_init(rob_chara* rob_chr, - bone_database* bone_data, void* data, object_database* obj_db) { + const bone_database* bone_data, void* data, const object_database* obj_db) { 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; @@ -9638,7 +9639,7 @@ static void rob_chara_bone_data_eyes_xrot_adjust(rob_chara_bone_data* rob_bone_d } static void rob_chara_bone_data_get_ik_scale( - rob_chara_bone_data* rob_bone_data, bone_database* bone_data) { + rob_chara_bone_data* rob_bone_data, const bone_database* bone_data) { if (rob_bone_data->motion_loaded.size() < 0) return; @@ -9667,7 +9668,7 @@ static bone_node* rob_chara_bone_data_get_node(rob_chara_bone_data* rob_bone_dat static void rob_chara_bone_data_ik_scale_calculate( rob_chara_bone_data_ik_scale* ik_scale, std::vector* bones, bone_database_skeleton_type base_skeleton_type, - bone_database_skeleton_type skeleton_type, bone_database* bone_data) { + 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); @@ -9694,7 +9695,7 @@ static void rob_chara_bone_data_ik_scale_calculate( } static void mot_key_data_reserve_key_sets_by_skeleton_type(mot_key_data* a1, - bone_database_skeleton_type type, bone_database* bone_data) { + 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); if (!bones) @@ -9706,7 +9707,7 @@ static void mot_key_data_reserve_key_sets_by_skeleton_type(mot_key_data* a1, } static void mot_blend_reserve_key_sets(mot_blend* blend, bone_database_skeleton_type type, - PFNMOTIONBONECHECKFUNC bone_check_func, size_t motion_bone_count, bone_database* bone_data) { + PFNMOTIONBONECHECKFUNC bone_check_func, size_t motion_bone_count, const bone_database* bone_data) { mot_key_data_reserve_key_sets_by_skeleton_type(&blend->mot_key_data, type, bone_data); sub_140413350(&blend->field_0, bone_check_func, motion_bone_count); } @@ -9746,7 +9747,7 @@ static bool mot_blend_eyelid_check(motion_bone_index 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, bone_database* bone_data) { + bone_database_skeleton_type 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) motion_blend_mot_load_bone_data(i, rob_bone_data, @@ -9769,7 +9770,7 @@ 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, bone_database* bone_data) { + bone_database_skeleton_type 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; @@ -10168,7 +10169,7 @@ static void sub_14041BA60(rob_chara_bone_data* rob_bone_data) { } static void rob_chara_bone_data_motion_load(rob_chara_bone_data* rob_bone_data, int32_t motion_id, - MotionBlendType blend_type, bone_database* bone_data, motion_database* mot_db) { + MotionBlendType blend_type, const bone_database* bone_data, const motion_database* mot_db) { if (!rob_bone_data->motion_loaded.size()) return; @@ -11004,13 +11005,13 @@ 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 void rob_chara_load_default_motion(rob_chara* rob_chr, - bone_database* bone_data, motion_database* mot_db) { + const bone_database* bone_data, const motion_database* mot_db) { int32_t motion_id = rob_chr->get_rob_cmn_mottbl_motion_id(0); rob_chara_load_default_motion_sub(rob_chr, 1, motion_id, bone_data, mot_db); } static void rob_chara_bone_data_load_face_motion(rob_chara_bone_data* rob_bone_data, - int32_t motion_id, motion_database* mot_db) { + int32_t motion_id, const motion_database* mot_db) { sub_14041AD90(rob_bone_data); sub_140412F20(&rob_bone_data->face, &rob_bone_data->motion_loaded.front()->bone_data.bones); sub_1404146F0(&rob_bone_data->face.field_0); @@ -11018,31 +11019,31 @@ static void rob_chara_bone_data_load_face_motion(rob_chara_bone_data* rob_bone_d } static void rob_chara_bone_data_load_hand_l_motion(rob_chara_bone_data* rob_bone_data, - int32_t motion_id, motion_database* mot_db) { + int32_t motion_id, const motion_database* mot_db) { sub_140412F20(&rob_bone_data->hand_l, &rob_bone_data->motion_loaded.front()->bone_data.bones); mot_blend_load_motion(&rob_bone_data->hand_l, motion_id, mot_db); } static void rob_chara_bone_data_load_hand_r_motion(rob_chara_bone_data* rob_bone_data, - int32_t motion_id, motion_database* mot_db) { + int32_t motion_id, const motion_database* mot_db) { sub_140412F20(&rob_bone_data->hand_r, &rob_bone_data->motion_loaded.front()->bone_data.bones); mot_blend_load_motion(&rob_bone_data->hand_r, motion_id, mot_db); } static void rob_chara_bone_data_load_mouth_motion(rob_chara_bone_data* rob_bone_data, - int32_t motion_id, motion_database* mot_db) { + int32_t motion_id, const motion_database* mot_db) { sub_140412F20(&rob_bone_data->mouth, &rob_bone_data->motion_loaded.front()->bone_data.bones); mot_blend_load_motion(&rob_bone_data->mouth, motion_id, mot_db); } static void rob_chara_bone_data_load_eyes_motion(rob_chara_bone_data* rob_bone_data, - int32_t motion_id, motion_database* mot_db) { + int32_t motion_id, const motion_database* mot_db) { sub_140412F20(&rob_bone_data->eyes, &rob_bone_data->motion_loaded.front()->bone_data.bones); mot_blend_load_motion(&rob_bone_data->eyes, motion_id, mot_db); } static void rob_chara_bone_data_load_eyelid_motion(rob_chara_bone_data* rob_bone_data, - int32_t motion_id, motion_database* mot_db) { + int32_t motion_id, const motion_database* mot_db) { sub_14041AD50(rob_bone_data); sub_140412F20(&rob_bone_data->eyelid, &rob_bone_data->motion_loaded.front()->bone_data.bones); sub_1404146F0(&rob_bone_data->eyelid.field_0); @@ -11054,7 +11055,7 @@ static void sub_140419820(rob_chara_bone_data* rob_bone_data, int32_t skeleton_s } static void rob_chara_load_default_motion_sub(rob_chara* rob_chr, int32_t skeleton_select, - int32_t motion_id, bone_database* bone_data, motion_database* mot_db) { + int32_t motion_id, const bone_database* bone_data, const motion_database* mot_db) { rob_chara_bone_data_load_face_motion(rob_chr->bone_data, -1, mot_db); rob_chara_bone_data_load_hand_l_motion(rob_chr->bone_data, -1, mot_db); rob_chara_bone_data_load_hand_r_motion(rob_chr->bone_data, -1, mot_db); @@ -12342,7 +12343,7 @@ void rob_chara_item_equip_object::disp(const mat4* mat, render_context* rctx) { rctx->disp_manager.set_obj_flags(v2); } -int32_t rob_chara_item_equip_object::get_bone_index(const char* name, bone_database* bone_data) { +int32_t rob_chara_item_equip_object::get_bone_index(const char* name, const bone_database* bone_data) { 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) @@ -12361,7 +12362,7 @@ bone_node* rob_chara_item_equip_object::get_bone_node( return 0; } -bone_node* rob_chara_item_equip_object::get_bone_node(const char* name, bone_database* bone_data) { +bone_node* rob_chara_item_equip_object::get_bone_node(const char* name, const bone_database* bone_data) { return get_bone_node(get_bone_index(name, bone_data)); } @@ -12400,7 +12401,7 @@ RobOsageNode* rob_chara_item_equip_object::get_normal_ref_osage_node(std::string return node; } -void rob_chara_item_equip_object::get_parent_bone_nodes(bone_node* bone_nodes, bone_database* bone_data) { +void rob_chara_item_equip_object::get_parent_bone_nodes(bone_node* bone_nodes, const bone_database* bone_data) { this->bone_nodes = bone_nodes; mats = bone_nodes->mat; for (ExNodeBlock*& i : node_blocks) @@ -12462,7 +12463,7 @@ void rob_chara_item_equip_object::init_members(size_t index) { } void rob_chara_item_equip_object::load_ex_data(obj_skin_ex_data* ex_data, - bone_database* bone_data, void* data, object_database* obj_db) { + const bone_database* bone_data, void* data, const object_database* obj_db) { if (!ex_data->block_array) return; @@ -12598,8 +12599,8 @@ void rob_chara_item_equip_object::load_ex_data(obj_skin_ex_data* ex_data, } if (parent_bone_node && parent_bone_node->ex_data_mat) { - osg->rob.parent_mat_ptr = parent_bone_node->ex_data_mat; - osg->rob.parent_mat = *parent_bone_node->ex_data_mat; + osg->rob.root_matrix_ptr = parent_bone_node->ex_data_mat; + osg->rob.root_matrix = *parent_bone_node->ex_data_mat; } } @@ -12639,7 +12640,7 @@ void rob_chara_item_equip_object::load_ex_data(obj_skin_ex_data* ex_data, } void rob_chara_item_equip_object::load_object_info_ex_data(object_info obj_info, bone_node* bone_nodes, - bool osage_reset, bone_database* bone_data, void* data, object_database* obj_db) { + bool osage_reset, const bone_database* bone_data, void* data, const object_database* obj_db) { this->obj_info = obj_info; this->bone_nodes = bone_nodes; mats = bone_nodes->mat; @@ -12664,7 +12665,7 @@ void rob_chara_item_equip_object::load_object_info_ex_data(object_info obj_info, } void rob_chara_item_equip::load_outfit_object_info(item_id id, object_info obj_info, - bool osage_reset, bone_database* bone_data, void* data, object_database* obj_db) { + 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); @@ -12799,7 +12800,7 @@ void rob_chara_item_equip_object::set_texture_pattern(texture_pattern_struct* te texture_pattern.push_back(tex_pat[i]); } -void rob_chara_item_equip_object::skp_load(void* kv, bone_database* bone_data) { +void rob_chara_item_equip_object::skp_load(void* kv, const bone_database* bone_data) { key_val* _kv = (key_val*)kv; if (_kv->key.size() < 1) return; @@ -12822,7 +12823,7 @@ void rob_chara_item_equip_object::skp_load(void* kv, bone_database* bone_data) { } void rob_chara_item_equip_object::skp_load(skin_param_osage_root& skp_root, - std::vector& vec, skin_param_file_data* skp_file_data, bone_database* bone_data) { + std::vector& vec, skin_param_file_data* skp_file_data, const bone_database* bone_data) { set_collision_target_osage(skp_root, &skp_file_data->skin_param); skp_file_data->field_88 |= skp_file_data->skin_param.coli_type > 0; @@ -12854,8 +12855,8 @@ bool rob_chara_item_equip_object::skp_load_boc( } void rob_chara_item_equip_object::skp_load_file(void* data, - bone_database* bone_data, object_database* obj_db) { - key_val* kv_ptr = 0;//sub_14060B4B0(itm_eq_obj->object_info); + const bone_database* bone_data, const object_database* obj_db) { + key_val* kv_ptr = skin_param_storage_get_key_val(obj_info); if (kv_ptr) { skp_load(kv_ptr, bone_data); return; @@ -12865,9 +12866,12 @@ void rob_chara_item_equip_object::skp_load_file(void* data, const char* name = obj_db->get_object_name(obj_info); sprintf_s(buf, sizeof(buf), "ext_skp_%s.txt", name); - for (int32_t i = 0; buf[i]; i++) - if (buf[i] > 0x40 && buf[i] < 0x5B) - buf[i] += 0x20; + for (int32_t i = 0; buf[i]; i++) { + char c = buf[i]; + if (c >= 'A' && c <= 'Z') + c += 0x20; + buf[i] = c; + } key_val kv; ((data_struct*)data)->load_file(&kv, "rom/skin_param/", buf, key_val::load_file); @@ -13047,7 +13051,7 @@ object_info rob_chara_item_equip::get_object_info(item_id id) { return {}; } -void rob_chara_item_equip::get_parent_bone_nodes(bone_node* bone_nodes, bone_database* bone_data) { +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->mat; for (int32_t i = first_item_equip_object; i < max_item_equip_object; i++) @@ -13058,8 +13062,15 @@ const mat4* rob_chara_item_equip::get_ex_data_bone_node_mat(item_id id, const ch return item_equip_object[id].get_ex_data_bone_node_mat(name); } +void rob_chara_item_equip::load_body_parts_object_info(item_id id, + object_info obj_info, const bone_database* bone_data, void* data, const object_database* obj_db) { + if (id <= ITEM_BODY || id >= ITEM_MAX) + 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, bone_database* bone_data, void* data, object_database* obj_db) { + 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; @@ -13236,7 +13247,7 @@ void rob_chara_item_equip::set_texture_pattern(texture_pattern_struct* tex_pat, } void rob_chara_item_equip::skp_load(item_id id, skin_param_osage_root& skp_root, - std::vector& vec, skin_param_file_data* skp_file_data, bone_database* bone_data) { + 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); } @@ -13426,15 +13437,8 @@ static void sub_14052CCC0(rob_chara_item_cos_data* item_cos_data, rob_chara_item item_cos_data->texture_pattern[id].data(), item_cos_data->texture_pattern[id].size()); } -static void rob_chara_item_equip_load_body_parts_object_info(rob_chara_item_equip* rob_itm_equip, - item_id id, object_info obj_info, bone_database* bone_data, void* data, object_database* obj_db) { - if (id <= ITEM_BODY || id >= ITEM_MAX) - obj_info = {}; - rob_itm_equip->load_object_info(obj_info, id, false, bone_data, data, obj_db); -} - static void sub_140522A30(rob_chara_item_cos_data* item_cos_data, rob_chara_item_equip* rob_itm_equip, - bone_database* bone_data, void* data, object_database* obj_db) { + 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, @@ -13447,8 +13451,7 @@ static void sub_140522A30(rob_chara_item_cos_data* item_cos_data, rob_chara_item } for (int32_t i = ITEM_KAMI; i < ITEM_MAX; i++) { - rob_chara_item_equip_load_body_parts_object_info(rob_itm_equip, - (item_id)i, {}, bone_data, data, obj_db); + rob_itm_equip->load_body_parts_object_info((item_id)i, {}, bone_data, data, obj_db); sub_14052B4C0(item_cos_data, rob_itm_equip, (item_id)i, false); } sub_14052B4C0(item_cos_data, rob_itm_equip, ITEM_NONE, true); @@ -13486,7 +13489,7 @@ static item_id sub_140512EF0(rob_chara_item_equip* rob_itm_eq, item_id id) { } static void sub_140513B90(rob_chara_item_equip* rob_itm_equip, item_id id, object_info a3, object_info a4, - bone_database* bone_data, void* data, object_database* obj_db) { + const bone_database* bone_data, void* data, const object_database* obj_db) { if (id <= ITEM_BODY || id >= ITEM_MAX) { a4 = {}; a3 = {}; @@ -13500,7 +13503,7 @@ static void sub_140513B90(rob_chara_item_equip* rob_itm_equip, item_id id, objec 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, - bone_database* bone_data, void* data, object_database* obj_db) { + 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; @@ -13520,8 +13523,7 @@ static void sub_14052C560(rob_chara_item_cos_data* item_sub_data, item_id id = sub_140525B90(item_sub_data, sub_id); if (id != ITEM_NONE) { - rob_chara_item_equip_load_body_parts_object_info(rob_itm_equip, - id, i.obj_info, bone_data, data, obj_db); + 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 }); if (item->attr & 0xC) item_sub_data->set_texture_pattern(rob_itm_equip, item_no, id, false); @@ -13536,8 +13538,7 @@ static void sub_14052C560(rob_chara_item_cos_data* item_sub_data, v8 = true; } else - rob_chara_item_equip_load_body_parts_object_info(rob_itm_equip, - id, i.obj_info, bone_data, data, obj_db); + 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 }); if (item->attr & 0xC) item_sub_data->set_texture_pattern(rob_itm_equip, item_no, id, v8); @@ -13560,7 +13561,7 @@ 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, - bone_database* bone_data, void* data, object_database* obj_db) { + const bone_database* bone_data, void* data, const object_database* obj_db) { if (!item_table_handler_array_get_table(item_cos_data->chara_index)) return; @@ -13583,8 +13584,9 @@ static void sub_140522C60(rob_chara_item_cos_data* item_cos_data, rob_chara_item } } -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, bone_database* bone_data, void* data, object_database* obj_db) { +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, + 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; @@ -13604,8 +13606,7 @@ static void sub_14052C8C0(rob_chara_item_cos_data* item_cos_data, rob_chara_item if (v13 == ITEM_NONE) continue; - rob_chara_item_equip_load_body_parts_object_info(rob_itm_equip, - v13, i.obj_info, bone_data, data, obj_db); + rob_itm_equip->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; @@ -13614,8 +13615,7 @@ static void sub_14052C8C0(rob_chara_item_cos_data* item_cos_data, rob_chara_item else if (item->type == 0) { id = sub_140512EF0(rob_itm_equip, ITEM_ITEM09); if (id != ITEM_NONE) { - rob_chara_item_equip_load_body_parts_object_info(rob_itm_equip, - id, i.obj_info, bone_data, data, obj_db); + 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 }); continue; } @@ -13629,7 +13629,7 @@ static void sub_14052C8C0(rob_chara_item_cos_data* item_cos_data, rob_chara_item } static void sub_140522D00(rob_chara_item_cos_data* item_cos_data, rob_chara_item_equip* rob_itm_equip, - bone_database* bone_data, void* data, object_database* obj_db) { + const bone_database* bone_data, void* data, const object_database* obj_db) { if (!item_table_handler_array_get_table(item_cos_data->chara_index)) return; @@ -13650,15 +13650,14 @@ static void sub_140522D00(rob_chara_item_cos_data* item_cos_data, rob_chara_item } static void sub_140525D90(rob_chara_item_cos_data* item_cos_data, rob_chara_item_equip* rob_itm_equip, - int32_t a3, bone_database* bone_data, void* data, object_database* obj_db) { + 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_chara_item_equip_load_body_parts_object_info(rob_itm_equip, - (item_id)elem->second, {}, bone_data, data, obj_db); + rob_itm_equip->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, - bone_database* bone_data, void* data, object_database* obj_db) { + const bone_database* bone_data, void* data, const object_database* obj_db) { if (!item_table_handler_array_get_table(item_cos_data->chara_index)) return; @@ -13683,8 +13682,7 @@ static void sub_140522D90(rob_chara_item_cos_data* item_cos_data, rob_chara_item continue; item_id id = sub_140525B90(item_cos_data, *v6); - rob_chara_item_equip_load_body_parts_object_info(rob_itm_equip, - id, i.obj_info, bone_data, data, obj_db); + 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 }); if (item->attr & 0xC) item_cos_data->set_texture_pattern(rob_itm_equip, item_no, id, false); @@ -13808,7 +13806,7 @@ static void sub_1405234E0(rob_chara_item_cos_data* item_cos_data) { } void rob_chara_item_cos_data::reload_items(int32_t chara_id, - bone_database* bone_data, void* data, object_database* obj_db) { + 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); sub_140522990(this); sub_140522A30(this, rob_itm_equip, bone_data, data, obj_db); @@ -14833,7 +14831,8 @@ bool mothead_storage_check_mhd_file_not_ready(uint32_t set_id) { return false; } -const mothead_mot* mothead_storage_get_mot_by_motion_id(uint32_t motion_id, motion_database* mot_db) { +const mothead_mot* mothead_storage_get_mot_by_motion_id( + uint32_t motion_id, const motion_database* mot_db) { uint32_t set_id = mot_db->get_motion_set_id_by_motion_id(motion_id); if (set_id == -1) return &mothead_mot_null; @@ -15201,7 +15200,7 @@ static void sub_14053D3E0(struc_527* a1) { sub_14053D450(a1); } -static void sub_14053D6C0(struc_527* a1, motion_database* mot_db) { +static void sub_14053D6C0(struc_527* a1, const motion_database* mot_db) { sub_14053D450(a1); struc_528* v3 = new struc_528; if (v3) { @@ -16069,7 +16068,7 @@ static void sub_140479950(struc_655* a1, chara_index chara_index, int32_t* a3) { } static void sub_140479AA0(OpdMaker::Data* a1, rob_chara* rob_chr, std::vector& motions, - void* data, object_database* obj_db, motion_database* mot_db) { + void* data, const object_database* obj_db, const motion_database* mot_db) { if (!a1->empty || !rob_chr) return; @@ -16288,7 +16287,7 @@ bool OpdMakeWorker::AddTask(bool a2) { } struc_527::struc_527(rob_chara* rob_chr, int32_t stage_index, uint32_t motion_id, - float_t frame, bone_database* bone_data, motion_database* mot_db) : rob_chr(), + float_t frame, const bone_database* bone_data, const motion_database* mot_db) : rob_chr(), motion_id(), frame(), last_frame(), type_62(), type_62_data(), type_75(), type_75_data(), type_67(), type_67_data(), type_74(), type_74_data(), type_79(), type_79_data(), field_68() { type_62 = 0; @@ -18497,7 +18496,7 @@ void TaskRobLoad::FreeLoadedReqDataObj(ReqDataObj* req_data_obj) { } void TaskRobLoad::LoadCharaItem(chara_index chara_index, - int32_t item_no, void* data, object_database* obj_db) { + int32_t item_no, void* data, const object_database* obj_db) { if (!item_no) return; @@ -18527,7 +18526,7 @@ bool TaskRobLoad::LoadCharaItemCheckNotRead(chara_index chara_index, int32_t ite } void TaskRobLoad::LoadCharaItems(chara_index chara_index, - item_cos_data* cos, void* data, object_database* obj_db) { + item_cos_data* cos, void* data, const object_database* obj_db) { for (int32_t i = ITEM_SUB_ZUJO; i < ITEM_SUB_MAX; i++) LoadCharaItem(chara_index, cos->arr[i], data, obj_db); } @@ -18545,14 +18544,14 @@ bool TaskRobLoad::LoadCharaItemsCheckNotReadParent(chara_index chara_index, item } void TaskRobLoad::LoadCharaItemsParent(chara_index chara_index, - item_cos_data* cos, void* data, object_database* obj_db) { + item_cos_data* cos, void* data, const object_database* obj_db) { LoadCharaItems(chara_index, cos, data, obj_db); if (cos->data.kami == 649) object_storage_load_set(data, obj_db, 3291); } void TaskRobLoad::LoadCharaObjSetMotionSet(chara_index chara_index, - void* data, object_database* obj_db, motion_database* mot_db) { + 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); object_storage_load_set(data, obj_db, chr_init_data->object_set); motion_set_load_motion(cmn_set_id, "", mot_db); diff --git a/src/CRE/rob/rob.hpp b/src/CRE/rob/rob.hpp index 8b78b0a4..310a4fa9 100644 --- a/src/CRE/rob/rob.hpp +++ b/src/CRE/rob/rob.hpp @@ -1451,7 +1451,7 @@ public: virtual void Field_50() override; void InitData(rob_chara_item_equip_object* itm_eq_obj, obj_skin_block_constraint* cns_data, - const char* cns_data_name, bone_database* bone_data); + const char* cns_data_name, const bone_database* bone_data); }; struct RobOsageNode; @@ -1846,11 +1846,11 @@ struct RobCloth : public CLOTH { void Disp(const mat4* mat, render_context* rctx); void InitData(size_t root_count, size_t nodes_count, obj_skin_block_cloth_root* root, obj_skin_block_cloth_node* nodes, mat4* mats, int32_t a7, - rob_chara_item_equip_object* itm_eq_obj, bone_database* bone_data); + rob_chara_item_equip_object* itm_eq_obj, const bone_database* bone_data); void InitDataParent(obj_skin_block_cloth* cls_data, - rob_chara_item_equip_object* itm_eq_obj, bone_database* bone_data); + rob_chara_item_equip_object* itm_eq_obj, const bone_database* bone_data); float_t* LoadOpdData(size_t node_index, float_t* opd_data, size_t opd_count); - void LoadSkinParam(void* kv, const char* name, bone_database* bone_data); + void LoadSkinParam(void* kv, const char* name, const bone_database* bone_data); void ResetExtrenalForce(); void SetForceAirRes(float_t force, float_t force_gain, float_t air_res); void SetMotionResetData(int32_t motion_id, float_t frame); @@ -1888,7 +1888,7 @@ public: void AddMotionResetData(int32_t motion_id, float_t frame); void ColiSet(); void InitData(rob_chara_item_equip_object* itm_eq_obj, obj_skin_block_cloth* cls_data, - skin_param_osage_root* skp_root, bone_database* bone_data); + skin_param_osage_root* skp_root, const bone_database* bone_data); float_t* LoadOpdData(size_t node_index, float_t* opd_data, size_t opd_count); void SetMotionResetData(int32_t motion_id, float_t frame); float_t* SetOsagePlayDataInit(float_t* opdi_data); @@ -1929,8 +1929,8 @@ struct RobOsage { float_t field_1EB4; int32_t yz_order; int32_t field_1EBC; - mat4* parent_mat_ptr; - mat4 parent_mat; + mat4* root_matrix_ptr; + mat4 root_matrix; float_t move_cancel; bool field_1F0C; bool osage_reset; @@ -1954,7 +1954,7 @@ struct RobOsage { bone_node* ex_data_bone_nodes, obj_skin* skin); float_t* LoadOpdData(size_t node_index, 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, bone_database* bone_data); + skin_param_osage_root& skp_root, object_info* obj_info, const bone_database* bone_data); void Reset(); void ResetExtrenalForce(); void SetAirRes(float_t air_res); @@ -2036,7 +2036,7 @@ public: void Calc(); void DataSet(); void InitData(rob_chara_item_equip_object* itm_eq_obj, obj_skin_block_constraint* cns_data, - const char* cns_data_name, bone_database* bone_data); + const char* cns_data_name, const bone_database* bone_data); static void sub_1405F10D0(mat4* mat, vec3* a2, float_t a3, float_t a4); static void sub_1401EB410(mat4* mat, vec3* a2, vec3* target_offset); @@ -2114,7 +2114,7 @@ public: void Calc(); void DataSet(); void InitData(rob_chara_item_equip_object* itm_eq_obj, obj_skin_block_expression* exp_data, - const char* exp_data_name, object_info a4, size_t index, bone_database* bone_data); + const char* exp_data_name, object_info a4, size_t index, const bone_database* bone_data); }; struct ex_data_name_bone_index { @@ -2165,18 +2165,18 @@ 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); - int32_t get_bone_index(const char* name, bone_database* bone_data); + int32_t get_bone_index(const char* name, const bone_database* bone_data); bone_node* get_bone_node(int32_t bone_index); - bone_node* get_bone_node(const char* name, bone_database* bone_data); + bone_node* get_bone_node(const char* name, const bone_database* bone_data); const mat4* get_ex_data_bone_node_mat(const char* name); RobOsageNode* get_normal_ref_osage_node(std::string& name, size_t* index); - void get_parent_bone_nodes(bone_node* bone_nodes, bone_database* bone_data); + 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 init_members(size_t index = 0xDEADBEEF); void load_ex_data(obj_skin_ex_data* ex_data, - bone_database* bone_data, void* data, object_database* obj_db); + const bone_database* bone_data, void* data, const object_database* obj_db); void load_object_info_ex_data(object_info object_info, bone_node* bone_nodes, - bool osage_reset, bone_database* bone_data, void* data, object_database* obj_db); + bool osage_reset, const bone_database* bone_data, void* data, const object_database* obj_db); void reset_external_force(); void set_alpha_obj_flags(float_t alpha, int32_t flags); bool set_boc(skin_param_osage_root& skp_root, ExOsageBlock* osg); @@ -2188,11 +2188,11 @@ struct rob_chara_item_equip_object { void set_osage_reset(); void set_osage_move_cancel(float_t value); void set_texture_pattern(texture_pattern_struct* tex_pat, size_t count); - void skp_load(void* kv, bone_database* bone_data); + void skp_load(void* kv, const bone_database* bone_data); void skp_load(skin_param_osage_root& skp_root, std::vector& vec, - skin_param_file_data* skp_file_data, bone_database* bone_data); + skin_param_file_data* skp_file_data, const bone_database* bone_data); bool skp_load_boc(skin_param_osage_root& skp_root, std::vector* node_data); - void skp_load_file(void* data, bone_database* bone_data, object_database* obj_db); + void skp_load_file(void* data, const bone_database* bone_data, const object_database* obj_db); bool skp_load_normal_ref(skin_param_osage_root& skp_root, std::vector* node_data); }; @@ -2258,12 +2258,14 @@ struct rob_chara_item_equip { 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, bone_database* bone_data); + 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, 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, bone_database* bone_data, void* data, object_database* obj_db); + 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, - bool osage_reset, bone_database* bone_data, void* data, object_database* obj_db); + bool osage_reset, const bone_database* bone_data, void* data, const object_database* obj_db); void reset(); void reset_external_force(); void reset_init_data(bone_node* bone_nodes); @@ -2282,8 +2284,8 @@ struct rob_chara_item_equip { void set_shadow_type(int32_t chara_id); void set_step(float_t value); void set_texture_pattern(texture_pattern_struct* tex_pat, size_t count); - void skp_load(item_id id, skin_param_osage_root& skp_root, - std::vector& vec, skin_param_file_data* skp_file_data, bone_database* bone_data); + void skp_load(item_id id, skin_param_osage_root& skp_root, std::vector& vec, + skin_param_file_data* skp_file_data, const bone_database* bone_data); }; struct item_cos_texture_change_tex { @@ -2303,7 +2305,7 @@ struct rob_chara_item_cos_data { std::map> texture_change; std::map> item_change; std::map field_F0; - std::map field_100; + std::map field_100; std::vector texture_pattern[31]; std::map head_replace; @@ -2315,7 +2317,7 @@ struct rob_chara_item_cos_data { object_info get_head_object_replace(int32_t head_object_id); float_t get_max_face_depth(); void reload_items(int32_t chara_id, - bone_database* bone_data, void* data, object_database* obj_db); + 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); @@ -3415,11 +3417,11 @@ struct rob_chara { int32_t get_rob_cmn_mottbl_motion_id(int32_t id); bool is_visible(); void load_motion(int32_t motion_id, bool a3, float_t frame, - MotionBlendType blend_type, bone_database* bone_data, motion_database* mot_db); + 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, - bool osage_reset, bone_database* bone_data, void* data, object_database* obj_db); + bool osage_reset, const bone_database* bone_data, void* data, const object_database* obj_db); void reset_data(rob_chara_pv_data* pv_data, - bone_database* bone_data, motion_database* mot_db); + const bone_database* bone_data, const motion_database* mot_db); void reset_osage(); void set_bone_data_frame(float_t frame); void set_chara_height_adjust(bool value); @@ -3427,31 +3429,31 @@ struct rob_chara { void set_chara_pos_adjust_y(float_t value); void set_chara_size(float_t value); void set_eyelid_mottbl_motion_from_face(int32_t a2, - float_t blend_duration, float_t value, float_t blend_offset, motion_database* mot_db); + float_t blend_duration, float_t value, float_t blend_offset, const motion_database* mot_db); void set_eyelid_mottbl_motion(int32_t type, int32_t mottbl_index, float_t value, int32_t state, float_t blend_duration, - float_t a7, float_t step, int32_t a9, float_t blend_offset, motion_database* mot_db); + float_t a7, float_t step, int32_t a9, float_t blend_offset, const motion_database* mot_db); void set_eyes_mottbl_motion(int32_t type, int32_t mottbl_index, float_t value, int32_t state, float_t blend_duration, - float_t a7, float_t step, int32_t a9, float_t blend_offset, motion_database* mot_db); + float_t a7, float_t step, int32_t a9, float_t blend_offset, const motion_database* mot_db); void set_face_mottbl_motion(int32_t type, int32_t mottbl_index, float_t value, int32_t state, float_t blend_duration, float_t a7, - float_t step, int32_t a9, float_t blend_offset, bool a11, motion_database* mot_db); + float_t step, int32_t a9, float_t blend_offset, bool a11, const motion_database* mot_db); void set_frame(float_t frame); void set_hand_l_mottbl_motion(int32_t type, int32_t mottbl_index, float_t value, int32_t state, float_t blend_duration, float_t a7, - float_t step, int32_t a9, float_t blend_offset, motion_database* mot_db); + float_t step, int32_t a9, float_t blend_offset, const motion_database* mot_db); void set_hand_r_mottbl_motion(int32_t type, int32_t mottbl_index, float_t value, int32_t state, float_t blend_duration, float_t a7, - float_t step, int32_t a9, float_t blend_offset, motion_database* mot_db); + float_t step, int32_t a9, float_t blend_offset, const motion_database* mot_db); bool set_motion_id(int32_t motion_id, float_t frame, float_t blend_duration, bool a5, bool set_motion_reset_data, - MotionBlendType blend_type, bone_database* bone_data, motion_database* mot_db); + MotionBlendType blend_type, const bone_database* bone_data, const motion_database* mot_db); void set_motion_reset_data(int32_t motion_id, float_t frame); void set_motion_skin_param(int32_t motion_id, float_t frame); void set_mouth_mottbl_motion(int32_t type, int32_t mottbl_index, float_t value, int32_t state, float_t blend_duration, float_t a7, - float_t step, int32_t a9, float_t blend_offset, motion_database* mot_db); + float_t step, int32_t a9, float_t blend_offset, const motion_database* mot_db); void set_osage_move_cancel(uint8_t id, float_t value); void set_osage_reset(); void set_parts_disp(item_id id, bool disp); @@ -3492,7 +3494,7 @@ extern bool check_module_index_is_501(int32_t module_index); extern const float_t get_osage_gravity_const(); -extern void motion_set_load_mothead(uint32_t set, std::string&& mdata_dir, motion_database* mot_db); +extern void motion_set_load_mothead(uint32_t set, std::string&& mdata_dir, const motion_database* mot_db); extern void motion_set_unload_mothead(uint32_t set); extern bool opd_make_manager_del_task(); @@ -3565,15 +3567,10 @@ extern bool task_rob_manager_del_task(); extern void mothead_storage_init(); extern bool mothead_storage_check_mhd_file_not_ready(uint32_t set_id); -extern const mothead_mot* mothead_storage_get_mot_by_motion_id(uint32_t motion_id, motion_database* mot_db); +extern const mothead_mot* mothead_storage_get_mot_by_motion_id( + uint32_t motion_id, const motion_database* mot_db); extern void mothead_storage_free(); -extern void skin_param_osage_node_parse(void* kv, const char* name, - std::vector* a3, skin_param_osage_root& skp_root); - -extern void skin_param_osage_root_parse(void* kv, const char* name, - skin_param_osage_root& skp_root, bone_database* bone_data); - extern int32_t expression_id_to_mottbl_index(int32_t expression_id); extern int32_t hand_anim_id_to_mottbl_index(int32_t hand_anim_id); extern int32_t look_anim_id_to_mottbl_index(int32_t look_anim_id); diff --git a/src/CRE/rob/skin_param.cpp b/src/CRE/rob/skin_param.cpp index 2d5db712..b2d14c87 100644 --- a/src/CRE/rob/skin_param.cpp +++ b/src/CRE/rob/skin_param.cpp @@ -4,7 +4,7 @@ */ #include "rob.hpp" -#include "../../KKdLib/key_val.hpp" +#include "../../KKdLib/prj/algorithm.hpp" #include "../../KKdLib/str_utils.hpp" #include "../mdata_manager.hpp" #include "skin_param.hpp" @@ -94,6 +94,9 @@ sp_skp_db* sp_skp_db_data; SkinParamManager* skin_param_manager; +std::map> skin_param_storage; + + SkinParam::CollisionParam::CollisionParam() : type(), node_idx(), pos() { radius = 0.2f; } @@ -191,6 +194,8 @@ void skin_param_data_init() { if (!skin_param_manager) skin_param_manager = new SkinParamManager[ROB_CHARA_COUNT]; + + skin_param_storage = {}; } void skin_param_data_load() { @@ -199,6 +204,8 @@ void skin_param_data_load() { } void skin_param_data_free() { + skin_param_storage.clear(); + if (skin_param_manager) { delete[] skin_param_manager; skin_param_manager = 0; @@ -306,7 +313,7 @@ void skin_param_osage_node_parse(void* kv, const char* name, } void skin_param_osage_root_parse(void* kv, const char* name, - skin_param_osage_root& skp_root, bone_database* bone_data) { + skin_param_osage_root& skp_root, const bone_database* bone_data) { key_val* _kv = (key_val*)kv; if (!_kv->open_scope(name)) return; @@ -427,17 +434,17 @@ 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); +bone_database_skeleton_type_to_string(BONE_DATABASE_SKELETON_COMMON), bone1_name); - vec3 bone1_pos = 0.0f; - if (!_kv->read("bone.1.posx", bone1_pos.x) - || !_kv->read("bone.1.posy", bone1_pos.y) - || !_kv->read("bone.1.posz", bone1_pos.z)) { - _kv->close_scope(); - break; - } +vec3 bone1_pos = 0.0f; +if (!_kv->read("bone.1.posx", bone1_pos.x) + || !_kv->read("bone.1.posy", bone1_pos.y) + || !_kv->read("bone.1.posz", bone1_pos.z)) { + _kv->close_scope(); + break; +} - c->pos[1] = bone1_pos; +c->pos[1] = bone1_pos; } _kv->close_scope(); } @@ -502,6 +509,46 @@ void skin_param_osage_root_parse(void* kv, const char* name, _kv->close_scope(); } +key_val* skin_param_storage_get_key_val(object_info obj_info) { + auto elem = skin_param_storage.find(obj_info); + if (elem != skin_param_storage.end()) + return elem->second.get(); + return 0; +} + +void skin_param_storage_load(std::vector& obj_infos, + void* data, const object_database* obj_db) { + prj::sort_unique(obj_infos); + for (const object_info& i : obj_infos) { + if (i.is_null()) + continue; + + const char* obj_name = obj_db->get_object_name(i); + if (!obj_name) + continue; + + char buf[0x200]; + sprintf_s(buf, sizeof(buf), "ext_skp_%s.txt", obj_name); + + for (int32_t i = 0; buf[i]; i++) { + char c = buf[i]; + if (c >= 'A' && c <= 'Z') + c += 0x20; + buf[i] = c; + } + + if (((data_struct*)data)->check_file_exists("rom/skin_param/", buf)) { + prj::shared_ptr kv = prj::shared_ptr(new key_val); + ((data_struct*)data)->load_file(kv.get(), "rom/skin_param/", buf, key_val::load_file); + skin_param_storage.insert({ i, kv }); + } + } +} + +void skin_param_storage_reset() { + skin_param_storage.clear(); +} + osage_setting::osage_setting() { } diff --git a/src/CRE/rob/skin_param.hpp b/src/CRE/rob/skin_param.hpp index ea27ba7c..4e74f318 100644 --- a/src/CRE/rob/skin_param.hpp +++ b/src/CRE/rob/skin_param.hpp @@ -6,6 +6,7 @@ #pragma once #include "rob.hpp" +#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); @@ -22,3 +23,14 @@ extern bool skin_param_manager_check_task_ready(int32_t chara_id); extern std::vector* skin_param_manager_get_skin_param_file_data( int32_t chara_id, object_info obj_info, int32_t motion_id, int32_t frame); extern void skin_param_manager_reset(int32_t chara_id); + +extern void skin_param_osage_node_parse(void* kv, const char* name, + std::vector* a3, skin_param_osage_root& skp_root); + +extern void skin_param_osage_root_parse(void* kv, const char* name, + skin_param_osage_root& skp_root, const bone_database* bone_data); + +extern key_val* skin_param_storage_get_key_val(object_info obj_info); +extern void skin_param_storage_load(std::vector& obj_infos, + void* data, const object_database* obj_db); +extern void skin_param_storage_reset(); diff --git a/src/CRE/sound.cpp b/src/CRE/sound.cpp index 9cfd7974..35f6d9e2 100644 --- a/src/CRE/sound.cpp +++ b/src/CRE/sound.cpp @@ -1766,6 +1766,12 @@ bool sound_work_release_stream(int32_t index) { return stream->stop(); } +void sound_work_reset_all_se() { + for (SoundCue& i : sound_work->cues) + if ((!i.se_channel || i.property) && i.queue_index) + i.ReleaseProt(true); +} + bool sound_work_stream_set_pause(int32_t index, bool value) { if (index < 0 || index >= SOUND_WORK_STREAM_COUNT || !sound_work->stream_enable[index]) return false; diff --git a/src/CRE/sound.hpp b/src/CRE/sound.hpp index 017855bc..348d1331 100644 --- a/src/CRE/sound.hpp +++ b/src/CRE/sound.hpp @@ -357,6 +357,7 @@ extern void sound_work_release_farc_se(const char* file_path); extern bool sound_work_release_se(const char* name, bool force_release = true); extern bool sound_work_release_stream(int32_t index); extern bool sound_work_stream_set_pause(int32_t index, bool value); +extern void sound_work_reset_all_se(); extern float_t sound_cue_queue_volume_array_get_max(int32_t queue_index); extern float_t sound_cue_queue_volume_array_get_min(int32_t queue_index); extern sound::wasapi::System* sound_wasapi_system_data_get(); diff --git a/src/CRE/sprite.cpp b/src/CRE/sprite.cpp index 4b08f145..5f2465c7 100644 --- a/src/CRE/sprite.cpp +++ b/src/CRE/sprite.cpp @@ -82,7 +82,48 @@ struct sprite_draw_param { }; namespace spr { + struct TexCoord { + struct UV { + float_t u; + float_t v; + + inline UV() : u(), v() { + + } + }; + + UV uv[4]; + + inline TexCoord() { + + } + }; + + struct TexParam { + texture* texture; + TexCoord texcoord; + //int32_t pad[2]; + + inline TexParam() : texture()/*, pad()*/ { + + } + }; + struct SpriteManager { + struct RenderData { + std::vector draw_param_buffer; + std::vector vertex_buffer; + GLuint vao; + GLuint vbo; + size_t vbo_vertex_count; + + RenderData(); + ~RenderData(); + + void Clear(); + void Update(); + }; + std::map sets; std::list reqlist[4][2][SPR_PRIO_MAX]; float_t aspect[2]; @@ -94,11 +135,7 @@ namespace spr { uint32_t set_counter; - std::vector draw_param_buffer; - std::vector vertex_buffer; - GLuint vao; - GLuint vbo; - size_t vbo_vertex_count; + RenderData render_data; SpriteManager(); ~SpriteManager(); @@ -148,7 +185,7 @@ size_t sprite_vertex_array_count; extern render_context* rctx_ptr; -const GLenum spr_blend_param[6][4] = { +static const GLenum spr_blend_param[6][4] = { { GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ZERO, GL_ONE }, { GL_SRC_ALPHA, GL_ONE_MINUS_SRC_COLOR, GL_ZERO, GL_ONE }, { GL_SRC_ALPHA, GL_ONE, GL_ZERO, GL_ONE }, @@ -480,22 +517,7 @@ void sprite_manager_free() { } namespace spr { - SpriteManager::SpriteManager() : aspect(), index(), set_counter() { - ResetIndex(); - resolution_mode = RESOLUTION_MODE_MAX; - - resolution_struct res = resolution_struct(RESOLUTION_MODE_HD); - - aspect[0] = (float_t)res.aspect; - field_1018[0].first = res.resolution_mode; - field_1018[0].second = { 0.0f, 0.0f, (float_t)res.width, (float_t)res.height }; - - aspect[1] = (float_t)res.aspect; - field_1018[1].first = res.resolution_mode; - field_1018[1].second = { 0.0f, 0.0f, (float_t)res.width, (float_t)res.height }; - - mat = mat4_identity; - + SpriteManager::RenderData::RenderData() { glGenVertexArrays(1, &vao); gl_state_bind_vertex_array(vao, true); @@ -528,12 +550,9 @@ namespace spr { gl_state_bind_array_buffer(0); gl_state_bind_vertex_array(0); - } - SpriteManager::~SpriteManager() { - Clear(); - + SpriteManager::RenderData::~RenderData() { if (vbo) { glDeleteBuffers(1, &vbo); vbo = 0; @@ -545,6 +564,83 @@ namespace spr { } } + void SpriteManager::RenderData::Clear() { + draw_param_buffer.clear(); + vertex_buffer.clear(); + } + + void SpriteManager::RenderData::Update() { + static const GLsizei buffer_size = sizeof(sprite_draw_vertex); + + if (vbo_vertex_count < vertex_buffer.size()) { + while (vbo_vertex_count < vertex_buffer.size()) + vbo_vertex_count *= 2; + + glDeleteBuffers(1, &vbo); + glGenBuffers(1, &vbo); + + gl_state_bind_vertex_array(vao, true); + gl_state_bind_array_buffer(vbo, true); + + if (GLAD_GL_VERSION_4_4) + glBufferStorage(GL_ARRAY_BUFFER, + (GLsizeiptr)(buffer_size * vbo_vertex_count), 0, GL_DYNAMIC_STORAGE_BIT); + else + glBufferData(GL_ARRAY_BUFFER, + (GLsizeiptr)(buffer_size * vbo_vertex_count), 0, GL_DYNAMIC_DRAW); + glBufferSubData(GL_ARRAY_BUFFER, 0, (GLsizeiptr)(buffer_size + * vertex_buffer.size()), vertex_buffer.data()); + + glEnableVertexAttribArray(0); + glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, buffer_size, + (void*)offsetof(sprite_draw_vertex, pos)); + glEnableVertexAttribArray(1); + glVertexAttribPointer(1, 4, GL_UNSIGNED_BYTE, GL_TRUE, buffer_size, + (void*)offsetof(sprite_draw_vertex, color)); + glEnableVertexAttribArray(2); + glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, buffer_size, + (void*)offsetof(sprite_draw_vertex, uv[0])); + glEnableVertexAttribArray(3); + glVertexAttribPointer(3, 2, GL_FLOAT, GL_FALSE, buffer_size, + (void*)offsetof(sprite_draw_vertex, uv[1])); + + gl_state_bind_array_buffer(0); + gl_state_bind_vertex_array(0); + } + else { + if (GLAD_GL_VERSION_4_5) + glNamedBufferSubData(vbo, 0, (GLsizeiptr)(buffer_size + * vertex_buffer.size()), vertex_buffer.data()); + else { + gl_state_bind_array_buffer(vbo); + glBufferSubData(GL_ARRAY_BUFFER, 0, (GLsizeiptr)(buffer_size + * vertex_buffer.size()), vertex_buffer.data()); + gl_state_bind_array_buffer(0); + } + } + } + + SpriteManager::SpriteManager() : aspect(), index(), set_counter() { + ResetIndex(); + resolution_mode = RESOLUTION_MODE_MAX; + + resolution_struct res = resolution_struct(RESOLUTION_MODE_HD); + + aspect[0] = (float_t)res.aspect; + field_1018[0].first = res.resolution_mode; + field_1018[0].second = { 0.0f, 0.0f, (float_t)res.width, (float_t)res.height }; + + aspect[1] = (float_t)res.aspect; + field_1018[1].first = res.resolution_mode; + field_1018[1].second = { 0.0f, 0.0f, (float_t)res.width, (float_t)res.height }; + + mat = mat4_identity; + } + + SpriteManager::~SpriteManager() { + Clear(); + } + uint32_t SpriteManager::AddSetModern() { uint32_t index = this->set_counter; //for (; index <= 0x0FFF; index++) { @@ -591,8 +687,7 @@ namespace spr { i.second.Unload(); sets.clear(); - draw_param_buffer.clear(); - vertex_buffer.clear(); + render_data.Clear(); } void SpriteManager::Draw(render_context* rctx, @@ -677,69 +772,21 @@ namespace spr { mat4_transpose(&projection, &shader_data.g_transform); rctx->sprite_scene_ubo.WriteMapMemory(shader_data); - draw_param_buffer.clear(); - vertex_buffer.clear(); + render_data.Clear(); for (uint32_t j = SPR_PRIO_MAX; j; j--, reqlist++) for (auto& k : *reqlist) draw_sprite(rctx, k, font, mat, x_min, y_min, x_max, y_max, - draw_param_buffer, vertex_buffer); + render_data.draw_param_buffer, render_data.vertex_buffer); - static const GLsizei buffer_size = sizeof(sprite_draw_vertex); - - if (vbo_vertex_count < vertex_buffer.size()) { - while (vbo_vertex_count < vertex_buffer.size()) - vbo_vertex_count *= 2; - - glDeleteBuffers(1, &vbo); - glGenBuffers(1, &vbo); - - gl_state_bind_vertex_array(vao, true); - gl_state_bind_array_buffer(vbo, true); - - if (GLAD_GL_VERSION_4_4) - glBufferStorage(GL_ARRAY_BUFFER, - (GLsizeiptr)(buffer_size * vbo_vertex_count), 0, GL_DYNAMIC_STORAGE_BIT); - else - glBufferData(GL_ARRAY_BUFFER, - (GLsizeiptr)(buffer_size * vbo_vertex_count), 0, GL_DYNAMIC_DRAW); - glBufferSubData(GL_ARRAY_BUFFER, 0, (GLsizeiptr)(buffer_size - * vertex_buffer.size()), vertex_buffer.data()); - - glEnableVertexAttribArray(0); - glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, buffer_size, - (void*)offsetof(sprite_draw_vertex, pos)); - glEnableVertexAttribArray(1); - glVertexAttribPointer(1, 4, GL_UNSIGNED_BYTE, GL_TRUE, buffer_size, - (void*)offsetof(sprite_draw_vertex, color)); - glEnableVertexAttribArray(2); - glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, buffer_size, - (void*)offsetof(sprite_draw_vertex, uv[0])); - glEnableVertexAttribArray(3); - glVertexAttribPointer(3, 2, GL_FLOAT, GL_FALSE, buffer_size, - (void*)offsetof(sprite_draw_vertex, uv[1])); - - gl_state_bind_array_buffer(0); - gl_state_bind_vertex_array(0); - } - else { - if (GLAD_GL_VERSION_4_5) - glNamedBufferSubData(vbo, 0, (GLsizeiptr)(buffer_size - * vertex_buffer.size()), vertex_buffer.data()); - else { - gl_state_bind_array_buffer(vbo); - glBufferSubData(GL_ARRAY_BUFFER, 0, (GLsizeiptr)(buffer_size - * vertex_buffer.size()), vertex_buffer.data()); - gl_state_bind_array_buffer(0); - } - } + render_data.Update(); rctx->sprite_scene_ubo.Bind(0); gl_state_active_bind_texture_2d(7, tex->tex); - gl_state_bind_vertex_array(vao); - for (sprite_draw_param& j : draw_param_buffer) { + gl_state_bind_vertex_array(render_data.vao); + for (sprite_draw_param& j : render_data.draw_param_buffer) { if (j.blend) { gl_state_enable_blend(); gl_state_set_blend_func_separate( @@ -780,7 +827,7 @@ namespace spr { shaders_ft.set(j.shader); shaders_ft.draw_arrays(j.mode, j.first, j.count); } - gl_state_bind_array_buffer(0); + gl_state_bind_vertex_array(0); } if (index == 2 && resolution_mode != RESOLUTION_MODE_MAX) @@ -1400,6 +1447,11 @@ namespace spr { } } break; case SPR_KIND_ARROW_AB: { + if (!args.num_vertex) { + draw_param_buffer.pop_back(); + return; + } + draw_param.mode = GL_LINE_STRIP; draw_param.first = (GLint)vertex_buffer.size(); draw_param.count = (GLsizei)args.num_vertex; @@ -1416,6 +1468,11 @@ namespace spr { } } break; case SPR_KIND_TRIANGLE: { + if (!args.num_vertex) { + draw_param_buffer.pop_back(); + return; + } + draw_param.mode = GL_TRIANGLE_STRIP; draw_param.first = (GLint)vertex_buffer.size(); draw_param.count = (GLsizei)args.num_vertex; @@ -1625,6 +1682,7 @@ namespace spr { gl_state_bind_sampler(0, 0); gl_state_active_bind_texture_2d(1, rctx->empty_texture_2d); gl_state_bind_sampler(1, 0); + gl_state_bind_sampler(7, 0); gl_state_set_blend_func_separate(GL_ONE, GL_ZERO, GL_ONE, GL_ZERO); } @@ -1634,6 +1692,8 @@ namespace spr { gl_state_bind_sampler(0, 0); gl_state_active_bind_texture_2d(1, 0); gl_state_bind_sampler(1, 0); + gl_state_active_bind_texture_2d(7, 0); + gl_state_bind_sampler(7, 0); gl_state_set_blend_func_separate(GL_ONE, GL_ZERO, GL_ONE, GL_ZERO); shader::unbind(); } diff --git a/src/CRE/sprite.hpp b/src/CRE/sprite.hpp index 98c03890..8c5c431c 100644 --- a/src/CRE/sprite.hpp +++ b/src/CRE/sprite.hpp @@ -202,33 +202,6 @@ namespace spr { static void SetNext(SprArgs* args, SprArgs* next); }; - struct TexCoord { - struct UV { - float_t u; - float_t v; - - inline UV() : u(), v() { - - } - }; - - UV uv[4]; - - inline TexCoord() { - - } - }; - - struct TexParam { - texture* texture; - TexCoord texcoord; - //int32_t pad[2]; - - inline TexParam() : texture()/*, pad()*/ { - - } - }; - vec2 proj_sprite_3d_line(vec3 vec, bool offset); void put_cross(const mat4& mat, vec4u8 color_x, vec4u8 color_y, vec4u8 color_z); diff --git a/src/CRE/texture.cpp b/src/CRE/texture.cpp index 3051977f..c684e70f 100644 --- a/src/CRE/texture.cpp +++ b/src/CRE/texture.cpp @@ -183,8 +183,7 @@ void texture_array_free(texture** arr) { free_def(arr); } -void texture_set_params(GLuint texture, GLenum target, - int32_t max_mipmap_level, bool use_high_anisotropy) { +void texture_set_params(GLenum target, int32_t max_mipmap_level, bool use_high_anisotropy) { glTexParameteri(target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexParameteri(target, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE); @@ -526,7 +525,7 @@ static texture* texture_load_tex(texture_id id, GLenum target, gl_state_bind_texture_cube_map(tex->tex); break; } - texture_set_params(tex->tex, target, max_mipmap_level, use_high_anisotropy); + texture_set_params(target, max_mipmap_level, use_high_anisotropy); GLint swizzle[4]; switch (internal_format) { diff --git a/src/CRE/texture.hpp b/src/CRE/texture.hpp index 29b2e818..49c9388d 100644 --- a/src/CRE/texture.hpp +++ b/src/CRE/texture.hpp @@ -85,8 +85,7 @@ extern void texture_free(texture* tex); extern void texture_array_free(texture** arr); -extern void texture_set_params(GLuint texture, GLenum target, - int32_t max_mipmap_level, bool use_high_anisotropy); +extern void texture_set_params(GLenum target, int32_t max_mipmap_level, bool use_high_anisotropy); extern bool texture_txp_set_load(txp_set* t, texture*** texs, uint32_t* ids); extern bool texture_txp_set_load(txp_set* t, texture*** texs, texture_id* ids); diff --git a/src/DivaGL/bone_data.cpp b/src/DivaGL/bone_data.cpp index 2a5f643b..bdc91240 100644 --- a/src/DivaGL/bone_data.cpp +++ b/src/DivaGL/bone_data.cpp @@ -204,7 +204,8 @@ void ExOsageBlock__Init(ExOsageBlock* osg) { osg->base.__vftable->Reset(&osg->base); } -static void sub_14047EE90(rob_osage* rob_osg, mat4* mat) { +// 0x14047EE90 +static void rob_osage_apply_reset_data(rob_osage* rob_osg, mat4* mat) { if (rob_osg->reset_data_list) { list_RobOsageNodeResetData_node* v5 = rob_osg->reset_data_list->head->next; for (rob_osage_node* v6 = rob_osg->nodes.begin + 1; v6 != rob_osg->nodes.end; v6++) { @@ -305,15 +306,15 @@ static bool sub_140482FF0(mat4* mat, vec3* trans, skin_param_hinge* hinge, vec3* return clipped; } -static void sub_1404803B0(rob_osage* rob_osg, mat4* mat, vec3* parent_scale, bool has_children_node) { - mat4 v47 = *mat; +static void sub_1404803B0(rob_osage* rob_osg, mat4* root_matrix, vec3* parent_scale, bool has_children_node) { + mat4 v47 = *root_matrix; vec3 v45 = rob_osg->exp_data.position * *parent_scale; mat4_transpose(&v47, &v47); mat4_mult_vec3_trans(&v47, &v45, &rob_osg->nodes.begin[0].trans); if (rob_osg->osage_reset && !rob_osg->field_1F0E) { rob_osg->field_1F0E = true; - sub_14047EE90(rob_osg, mat); + rob_osage_apply_reset_data(rob_osg, root_matrix); } if (!rob_osg->field_1F0C) { @@ -440,19 +441,19 @@ static void sub_140482180(rob_osage_node* node, float_t a2) { node->field_C8 += 1.0f; } -static void sub_14047C800(rob_osage* rob_osg, mat4* mat, vec3* parent_scale, +static void sub_14047C800(rob_osage* rob_osg, mat4* root_matrix, vec3* parent_scale, float_t step, bool disable_external_force, bool ring_coli, bool has_children_node) { if (!vector_old_length(rob_osg->nodes)) return; const float_t osage_gravity_const = get_osage_gravity_const(); - sub_1404803B0(rob_osg, mat, parent_scale, false); + sub_1404803B0(rob_osg, root_matrix, parent_scale, false); rob_osage_node* v17 = &rob_osg->nodes.begin[0]; v17->trans_orig = v17->trans; vec3 v113 = rob_osg->exp_data.position * *parent_scale; - mat4 v130 = *mat; + mat4 v130 = *root_matrix; mat4_transpose(&v130, &v130); mat4_mult_vec3_trans(&v130, &v113, &v17->trans); v17->trans_diff = v17->trans - v17->trans_orig; @@ -1057,7 +1058,7 @@ static void sub_14047D620(rob_osage* rob_osg, float_t step) { nodes->begin[0].trans = v7; } -static void sub_14047D8C0(rob_osage* rob_osg, mat4* mat, vec3* parent_scale, float_t step, bool a5) { +static void sub_14047D8C0(rob_osage* rob_osg, mat4* root_matrix, vec3* parent_scale, float_t step, bool a5) { if (!rob_osg->osage_reset && step <= 0.0f) return; @@ -1073,7 +1074,7 @@ static void sub_14047D8C0(rob_osage* rob_osg, mat4* mat, vec3* parent_scale, flo if (a5) v64 = *rob_osg->nodes.begin[0].bone_node_mat; else { - v64 = *mat; + v64 = *root_matrix; vec3 trans = rob_osg->exp_data.position * *parent_scale; mat4_transpose(&v64, &v64); @@ -1176,7 +1177,7 @@ static void sub_14047D8C0(rob_osage* rob_osg, mat4* mat, vec3* parent_scale, flo v35->trans_diff *= v23 / sqrtf(v55); mat4 v65; - mat4_transpose(mat, &v65); + mat4_transpose(root_matrix, &v65); mat4_mult_vec3_inv_trans(&v65, &v35->trans, &v35->reset_data.trans); mat4_mult_vec3_inv(&v65, &v35->trans_diff, &v35->reset_data.trans_diff); } @@ -1228,7 +1229,7 @@ static void rob_osage_set_nodes_force(rob_osage* rob_osg, float_t force) { i->force = force; } -static void sub_140480260(rob_osage* rob_osg, mat4* mat, +static void sub_140480260(rob_osage* rob_osg, mat4* root_matrix, vec3* parent_scale, float_t step, bool disable_external_force) { if (!disable_external_force) { rob_osage_set_nodes_external_force(rob_osg, 0, 1.0f); @@ -1261,17 +1262,17 @@ void ExOsageBlock__Field_18(ExOsageBlock* osg, int32_t stage, bool disable_exter step = 1.0f; bone_node* parent_node = osg->base.parent_bone_node; - mat4* parent_node_mat = parent_node->ex_data_mat; + mat4* root_matrix = parent_node->ex_data_mat; vec3 parent_scale = parent_node->exp_data.parent_scale; switch (stage) { case 0: - sub_1404803B0(&osg->rob, parent_node_mat, &parent_scale, osg->base.has_children_node); + sub_1404803B0(&osg->rob, root_matrix, &parent_scale, osg->base.has_children_node); break; case 1: case 2: if ((stage == 1 && osg->base.field_58) || (stage == 2 && osg->rob.field_2A0)) { ExOsageBlock__SetWindDirection(osg); - sub_14047C800(&osg->rob, parent_node_mat, + sub_14047C800(&osg->rob, root_matrix, &parent_scale, step, disable_external_force, true, osg->base.has_children_node); } break; @@ -1283,21 +1284,22 @@ void ExOsageBlock__Field_18(ExOsageBlock* osg, int32_t stage, bool disable_exter sub_14047D620(&osg->rob, step); break; case 5: - sub_14047D8C0(&osg->rob, parent_node_mat, &parent_scale, step, false); - sub_140480260(&osg->rob, parent_node_mat, &parent_scale, step, disable_external_force); + sub_14047D8C0(&osg->rob, root_matrix, &parent_scale, step, false); + sub_140480260(&osg->rob, root_matrix, &parent_scale, step, disable_external_force); osg->base.field_59 = true; break; } } -static void sub_14047C770(rob_osage* rob_osg, mat4* mat, vec3* parent_scale, float_t step, bool a5) { - sub_14047C800(rob_osg, mat, parent_scale, step, a5, false, false); - sub_14047D8C0(rob_osg, mat, parent_scale, step, true); - sub_140480260(rob_osg, mat, parent_scale, step, a5); +static void sub_14047C770(rob_osage* rob_osg, mat4* root_matrix, + vec3* parent_scale, float_t step, bool disable_external_force) { + sub_14047C800(rob_osg, root_matrix, parent_scale, step, disable_external_force, false, false); + sub_14047D8C0(rob_osg, root_matrix, parent_scale, step, true); + sub_140480260(rob_osg, root_matrix, parent_scale, step, disable_external_force); } -static void sub_14047C750(rob_osage* rob_osg, mat4* mat, vec3* parent_scale, float_t step) { - sub_14047C770(rob_osg, mat, parent_scale, step, 0); +static void sub_14047C750(rob_osage* rob_osg, mat4* root_matrix, vec3* parent_scale, float_t step) { + sub_14047C770(rob_osg, root_matrix, parent_scale, step, false); } void ExOsageBlock__Field_20(ExOsageBlock* osg) { @@ -1515,7 +1517,7 @@ void ExOsageBlock__Field_50(ExOsageBlock* osg) { bone_node* parent_node = osg->base.parent_bone_node; vec3 parent_scale = parent_node->exp_data.parent_scale; rob_osage_coli_set(&osg->rob, osg->mat); - sub_14047C770(&osg->rob, parent_node->ex_data_mat, &parent_scale, osg->step, 1); + sub_14047C770(&osg->rob, parent_node->ex_data_mat, &parent_scale, osg->step, true); float_t step = 0.5f * osg->step; osg->step = max_def(step, 1.0f); } diff --git a/src/ReDIVA/pv_game.cpp b/src/ReDIVA/pv_game.cpp index b12a61a3..0fa6b22a 100644 --- a/src/ReDIVA/pv_game.cpp +++ b/src/ReDIVA/pv_game.cpp @@ -7,13 +7,15 @@ #include "../CRE/Glitter/glitter.hpp" #include "../CRE/light_param/light.hpp" #include "../CRE/light_param.hpp" +#include "../CRE/rob/motion.hpp" #include "../CRE/rob/rob.hpp" +#include "../CRE/rob/skin_param.hpp" #include "../CRE/data.hpp" #include "../CRE/object.hpp" -#include "../CRE/ogg_vorbis.hpp" #include "../CRE/pv_expression.hpp" #include "../CRE/pv_param.hpp" #include "../CRE/sound.hpp" +#include "../CRE/stage.hpp" #include "../KKdLib/farc.hpp" #include "../KKdLib/sort.hpp" #include "imgui_helper.hpp" @@ -129,120 +131,37 @@ enum dsc_ft_func { DSC_FT_MAX, }; -enum pv_game_music_action { - PV_GAME_MUSIC_ACTION_NONE = 0, - PV_GAME_MUSIC_ACTION_STOP, - PV_GAME_MUSIC_ACTION_PAUSE, - PV_GAME_MUSIC_ACTION_PLAY, - PV_GAME_MUSIC_ACTION_MAX, -}; - -enum pv_game_music_flags : uint8_t { - PV_GAME_MUSIC_OGG = 0x04, - PV_GAME_MUSIC_ALL = 0xFF, -}; - -struct pv_game_music_fade { - int32_t start; - int32_t value; - float_t time; - float_t remain; - pv_game_music_action action; - bool enable; - - void reset(); -}; - -struct pv_game_music_args { - int32_t type; - std::string file_path; - float_t start; - bool field_2C; - - pv_game_music_args(); - ~pv_game_music_args(); -}; - -struct pv_game_music_ogg { - OggPlayback* playback; - std::string file_path; - - pv_game_music_ogg(); - ~pv_game_music_ogg(); -}; - -struct pv_game_music { - pv_game_music_flags flags; - bool pause; - int32_t volume; - int32_t master_volume; - int32_t channel_pair_volume[4]; - pv_game_music_fade fade_in; - pv_game_music_fade fade_out; - bool no_fade; - float_t no_fade_remain; - float_t fade_out_time_req; - pv_game_music_action fade_out_action_req; - int32_t type; - std::string file_path; - float_t start; - float_t end; - bool play_on_end; - float_t fade_in_time; - float_t fade_out_time; - bool field_9C; - pv_game_music_args args; - bool loaded; - pv_game_music_ogg* ogg; - - pv_game_music(); - ~pv_game_music(); - - bool check_args(int32_t type, std::string& file_path, float_t start); - void ctrl(float_t delta_time); - void exclude_flags(pv_game_music_flags flags); - void fade_in_end(); - void fade_out_end(); - void file_load(int32_t type, std::string& file_path, bool play_on_end, - float_t start, float end, float fade_in_time, float_t fade_out_time, bool a9); - int32_t get_master_volume(int32_t index); - int32_t get_volume(int32_t index); - int32_t include_flags(pv_game_music_flags flags); - int32_t load(int32_t type, std::string& file_path, bool wait_load, float_t time, bool a6); - void ogg_free(); - int32_t ogg_init(); - int32_t ogg_load(std::string& file_path, float_t start); - int32_t ogg_reset(); - int32_t ogg_stop(); - int32_t play(); - int32_t play(int32_t type, std::string& file_path, bool play_on_end, - float_t start, float end, float fade_in_time, float_t fade_out_time, bool a9); - void play(int32_t type, std::string& file_path, float_t start, - float_t end, bool play_on_end, bool a7, float_t fade_out_time, bool a10); - int32_t play_or_stop(); - void reset(); - void reset_args(); - void set_args(int32_t type, std::string& file_path, float_t start, bool a5); - int32_t set_channel_pair_volume(int32_t channel_pair, int32_t value); - int32_t set_channel_pair_volume_map(int32_t channel_pair, int32_t value); - int32_t set_fade_out(float_t time, uint8_t stop); - int32_t set_master_volume(int32_t value); - int32_t set_ogg_args(std::string& file_path, float_t start, bool wait_load); - int32_t set_ogg_pause_state(uint8_t pause_state); - int32_t set_pause(int32_t pause); - void set_volume_map(int32_t index, int32_t value); - int32_t stop(); - void stop_reset_flags(); +struct struc_14 { + int32_t field_0; + int32_t difficulty; + int32_t edition; + uint32_t pv; + int8_t field_10; + int8_t field_11; + int8_t field_12; + int8_t field_13; + int32_t field_14; + int32_t field_18; + int32_t field_1C; + float_t field_20; + int8_t field_24; + int8_t field_25; + int8_t field_26; + int8_t field_27; }; pv_game* _pv_game; TaskPvGame* task_pv_game; pv_game_music* pv_game_music_data; +struc_14 stru_140C94438; + extern render_context* rctx_ptr; static pv_game_music* pv_game_music_get(); +static struc_14* sub_14013C8C0(); + pv_play_data_motion_data::pv_play_data_motion_data() : rob_chr(), current_time(), duration(), start_pos(), end_pos(), start_rot(), end_rot() { mot_smooth_len = 12.0f; @@ -294,9 +213,9 @@ pv_disp2d::~pv_disp2d() { } -pv_game_dsc_data::pv_game_dsc_data() : field_0(), state(), play(), dsc_buffer(), dsc_buffer_counter(), +pv_game_pv_data::pv_game_pv_data() : field_0(), state(), play(), dsc_buffer(), dsc_buffer_counter(), field_2BF30(), field_2BF38(), curr_time(), curr_time_float(), prev_time_float(), field_2BF50(), field_2BF58(), -field_2BF60(), field_2BF64(), field_2BF68(), chara_id(), pv_game()/*, field_2BF80(), field_2BF88()*/, +field_2BF60(), field_2BF64(), field_2BF68(), chara_id(), pv_game()/*, field_2BF80()*/, music(), dsc_file_handler(), target_anim_fps(), anim_frame_speed(), target_flying_time(), time_signature(), dsc_time(), field_2BFB0(), field_2BFB4(), field_2BFB8(), field_2BFBC(), field_2BFC0(), music_play(), field_2BFC4(), pv_end(), fov(), min_dist(), field_2BFD4(), field_2BFD5(), data_camera(), change_field_branch_time(), scene_fade_enable(), @@ -306,41 +225,49 @@ field_2C550(), branch_mode(), first_challenge_note(), last_challenge_note(), fie } -pv_game_dsc_data::~pv_game_dsc_data() { +pv_game_pv_data::~pv_game_pv_data() { } -pv_game_data_chara::pv_game_data_chara() : chara_index(), cos(), chara_id(), pv_data(), rob_chr() { +pv_game_play_data::pv_game_play_data() { } -pv_game_data_chara::~pv_game_data_chara() { +pv_game_play_data::~pv_game_play_data() { } -pv_game_data_field::pv_game_data_field() : stage_index(), light_auth_3d_uid(), light_auth_3d_id(), +pv_game_chara::pv_game_chara() : chara_index(), cos(), chara_id(), pv_data(), rob_chr() { + +} + +pv_game_chara::~pv_game_chara() { + +} + +pv_game_field::pv_game_field() : stage_index(), light_auth_3d_uid(), light_auth_3d_id(), light_frame(), spr_set_back_id(), stage_flag(), npr_type(), cam_blur(), sdw_off() { } -pv_game_data_field::~pv_game_data_field() { +pv_game_field::~pv_game_field() { } -struc_78::struc_78() : field_30(), field_34() { +struc_269::struc_269() : field_30(), field_34() { } -struc_78::~struc_78() { +struc_269::~struc_269() { } -pv_game_data_chreff::pv_game_data_chreff() : src_chara_index(), +pv_game_chreff::pv_game_chreff() : src_chara_index(), dst_chara_index(), src_auth_3d_uid(), dst_auth_3d_uid() { } -pv_game_data_chreff::~pv_game_data_chreff() { +pv_game_chreff::~pv_game_chreff() { } @@ -354,24 +281,25 @@ pv_effect_resource::~pv_effect_resource() { pv_game_data::pv_game_data() : field_2CE98(), field_2CE9C(), field_2CF1C(), field_2CF20(), field_2CF24(), field_2CF28(), field_2CF2C(), field_2CF30(), field_2CF34(), field_2CF38(), life_gauge(), score_final(), -challenge_time_total_bonus(), combo(), challenge_time_combo_count(), max_combo(), total_hit_count(), hit_count(), -current_reference_score(), target_count(), field_2CF84(), field_2CF88(), field_2CF8C(), score_slide_chain_bonus(), -slide_chain_length(), field_2CF98(), field_2CF9C(), field_2CFA0(), field_2CFA4(), pv(), field_2CFB0(), field_2CFB4(), -reference_score(), field_2CFBC(), field_2CFC0(), field_2CFC4(), field_2CFE0(), field_2CFE4(), notes_passed(), -field_2CFF0(), score_percentage(), score_percentage_clear(), score_percentage_border(), life_gauge_safety_time(), -life_gauge_border(), field_2D008(), field_2D00C(), no_fail(), field_2D00E(), field_2D00F(), challenge_time_start(), -challenge_time_end(), max_time(), max_time_float(), current_time_float(), current_time(), current_time_float_dup(), -field_2D03C(), score_hold_multi(), score_hold(), score_slide(), field_2D04C(), chance_time_ended(), pv_disp2d(), -life_gauge_final(), hit_border(), field_2D05D(), field_2D05E(), field_2D05F(), title_image_init(), field_2D061(), -field_2D062(), field_2D063(), has_auth_3d_frame(), has_light_frame(), field_2D066(), field_2D068(), field_2D069(), -field_2D06A(), field_2D06C(), field_index(), edit_effect_index(), slidertouch_counter(), -change_field_branch_success_counter(), field_2D080(), field_2D084(), life_gauge_bonus(), life_gauge_total_bonus(), -field_2D090(), field_2D091(), field_2D092(), field_2D093(), field_2D094(), field_2D095(), field_2D096(), success(), -field_2D098(), field_2D09C(), field_2D0A0(), pv_end_fadeout(), rival_percentage(), field_2D0A8(), field_2D0AC(), -field_2D0B0(), field_2D0BC(), field_2D0BD(), field_2D0BE(), field_2D0BF(), field_2D0C0(), field_2D0C4(), -field_2D7E8(), field_2D7EC(), field_2D808(), field_2D80C(), field_2D858(), camera_auth_3d_uid(), field_2D874(), -field_2D878(), field_2D87C(), current_field(), field_2D8A0(), field_2D8A4(), data_camera_id(), -field_2D954(), field_2DAC8(), field_2DACC(), field_2DB28(), field_2DB2C(), field_2DB34() { +challenge_time_total_bonus(), combo(), challenge_time_combo_count(), max_combo(), total_hit_count(), +hit_count(), current_reference_score(), target_count(), field_2CF84(), field_2CF88(), field_2CF8C(), +score_slide_chain_bonus(), slide_chain_length(), field_2CF98(), field_2CF9C(), field_2CFA0(), field_2CFA4(), +pv(), field_2CFB0(), chance_point(), reference_score(), field_2CFBC(), field_2CFC0(), field_2CFC4(), +field_2CFE0(), field_2CFE4(), notes_passed(), field_2CFF0(), song_energy(), song_energy_base(), +song_energy_border(), life_gauge_safety_time(), life_gauge_border(), stage_index(), field_2D00C(), +no_fail(), field_2D00E(), changed_field(), challenge_time_start(), challenge_time_end(), max_time(), +max_time_float(), current_time_float(), current_time(), current_time_float_dup(), field_2D03C(), +score_hold_multi(), score_hold(), score_slide(), has_slide(), has_success_se(), pv_disp2d(), +life_gauge_final(), hit_border(), field_2D05D(), field_2D05E(), field_2D05F(), title_image_init(), +field_2D061(), field_2D062(), field_2D063(), has_auth_3d_frame(), has_light_frame(), has_aet_frame(), +has_aet_list(), field_index(), edit_effect_index(), slidertouch_counter(), change_field_branch_success_counter(), +field_2D080(), field_2D084(), life_gauge_bonus(), life_gauge_total_bonus(), field_2D090(), field_2D091(), +field_2D092(), field_2D093(), field_2D094(), field_2D095(), field_2D096(), success(), field_2D098(), +field_2D09C(), use_osage_play_data(), pv_end_fadeout(), rival_percentage(), field_2D0A8(), field_2D0AC(), +field_2D0B0(), field_2D0BC(), next_stage(), field_2D0BE(), field_2D0BF(), field_2D0C0(), field_2D0C4(), +field_2D7E8(), field_2D7EC(), field_2D808(), field_2D80C(), edit_effect(), camera_auth_3d_uid(), +field_2D874(), task_effect_init(), field_2D87C(), current_field(), field_2D8A0(), field_2D8A4(), +data_camera_id(), field_2D954(), field_2DAC8(), field_2DACC(), field_2DB28(), field_2DB2C(), field_2DB34() { } @@ -395,6 +323,534 @@ pv_game::~pv_game() { } +void pv_game::ctrl() { + +} + +void pv_game::disp() { + +} + +std::string pv_game::get_effect_se_file_name() { + pv_db_pv_difficulty* diff = data.pv->get_difficulty( + sub_14013C8C0()->difficulty, sub_14013C8C0()->edition); + if (diff) + return diff->effect_se_file_name; + return {}; +} + +void pv_game::load() { + +} + +void pv_game::reset() { + loaded = false; + field_1 = false; + field_2 = false; + end_pv = false; + field_4 = false; + field_14 = false; + + data.play_data.field_5F4 = 1.0f; + memset(data.play_data.lyric, 0, sizeof(data.play_data.lyric)); + + data.play_data.lyric_index = 0; + data.play_data.lyrics_color = { 0xFF, 0xFF, 0xFF, 0xFF }; + + memset(data.field_2CE9C, 0i64, sizeof(data.field_2CE9C)); + data.field_2CF1C = 0; + data.field_2CF20 = 0; + data.field_2CF8C = 0.0f; + data.field_2CF9C = 0; + data.field_2CFA0 = 0; + data.field_2CFA4 = 0; + + data.play_data.field_3B0 = -1; + data.play_data.field_3B4 = -1; + data.play_data.field_3B8 = -1; + data.play_data.field_3BC = -1; + + pv_id = -1; + + data.field_2CFB0 = 0; + data.chance_point = 0; + + for (auto& i : data.chara) { + i.chara_index = CHARA_MAX; + i.cos = -1; + i.chara_id = -1; + i.pv_data = {}; + i.rob_chr = 0; + i.motion_ids.clear(); + i.motion_face_ids.clear(); + } + + data.motion_set_ids.clear(); + data.motion_set_face_ids.clear(); + + data.obj_set_itmpv.clear(); + data.obj_set_handitem.clear(); + data.chreff_auth_3d_obj_set_ids.clear(); + data.field_2D770.clear(); + data.stgpvhrc_obj_set_ids.clear(); + data.ex_song_ex_auth_obj_set_ids.clear(); + + data.stage_indices.clear(); + data.stage_infos.clear(); + + data.field_2D7E8 = false; + data.spr_set_back_ids.clear(); + + data.field_2D808 = -1; + + data.edit_effect_spr_set_ids.clear(); + data.edit_effect_aet_ids.clear(); + data.edit_effect.field_0 = -1; + data.edit_effect.field_4 = 1.0f; + data.edit_effect.field_8 = 0.0f; + data.edit_effect.field_C = 0.0f; + data.edit_effect.field_10 = 1.0f; + data.edit_effect.field_14 = false; + + data.current_field = 0; + data.field_data.clear(); + + data.field_2D8A0 = true; + + data.camera_auth_3d_uid = -1; + data.campv_string.clear(); + data.campv_auth_3d_uids.clear(); + data.data_camera_id = 0; + data.campv.clear(); + + data.itmpv_string.clear(); + data.itmpv_auth_3d_uids.clear(); + for (auto& i : data.itmpv) + i.clear(); + data.itmpv_uids.clear(); + + for (auto& i : data.field_2DA08) { + i.data.clear(); + i.auth_3d_ids.clear(); + i.field_30 = -1; + } + + data.auth_3d.clear(); + data.field_2DAC8 = false; + data.auth_3d_categories.clear(); + data.loaded_auth_3d_uids.clear(); + + data.auth_3d_time.clear(); + data.light_time.clear(); + + for (auto& i : data.aet_time) + i.clear(); + + data.chreff_auth_3d.clear(); + data.chreff_auth_3d_obj.clear(); + + data.reference_score = 0; + data.field_2CFBC = 0; + data.field_2CFC0 = 0; + data.field_2CFC8.clear(); + data.field_2CFE0 = 0; + data.field_2D092 = data.field_2D00E; + data.notes_passed = 0; + data.field_2CFF0 = 0; + data.song_energy = 0.0f; + data.song_energy_border = 0.0f; + data.max_time_float = 0.0f; + data.current_time_float = 0.0f; + data.max_time = 0; + data.current_time = 0; + data.current_time_float_dup = 0.0f; + data.field_2D03C = 0.0f; + data.score_hold_multi = 0; + data.score_hold = 0; + data.score_slide = 0; + data.has_slide = false; + data.has_success_se = false; + data.pv_disp2d = 0; + data.hit_border = false; + data.field_2D05D = 0; + data.field_2D05F = 1; + data.title_image_init = false; + data.field_index = 0; + data.edit_effect_index = -1; + data.slidertouch_counter = 0; + data.change_field_branch_success_counter = 0; + data.field_2D05E = 0; + data.field_2D080 = 0; + data.field_2D084 = 0; + data.life_gauge_bonus = 0; + data.life_gauge_total_bonus = 0; + data.field_2D090 = 0; + data.field_2D091 = 0; + data.field_2D093 = 0; + data.field_2D094 = 0; + data.field_2D095 = false; + data.field_2D096 = false; + data.use_osage_play_data = false; + data.pv_end_fadeout = false; + data.field_2D098 = 0; + data.field_2D09C = 0; + data.rival_percentage = 0.0f; + data.play_data.se_name.clear(); + data.play_data.pvbranch_success_se_name.clear(); + data.play_data.slide_name.clear(); + data.play_data.chainslide_first_name.clear(); + data.play_data.chainslide_sub_name.clear(); + data.play_data.chainslide_success_name.clear(); + data.play_data.chainslide_failure_name.clear(); + data.play_data.slidertouch_name.clear(); + data.play_data.song_file_name.clear(); + data.play_data.field_5E8 = -1; + data.field_2DB28 = 0; + data.field_2DB2C = 0; + data.play_data.aix = false; + data.play_data.ogg = false; + data.play_data.field_64C = 0; + data.field_2CF30 = 4; + data.field_2CF34 = 0; + data.play_data.field_650 = 43; + data.play_data.field_654 = 0.0f; + data.field_2CF24 = 3; + data.field_2CF28 = 0.0f; + data.field_2CF38 = 0; + data.play_data.field_658 = 0; + data.play_data.field_65C = 0.0f; + data.field_2CF2C = 0.0; + data.target_count = 0; + data.field_2CF84 = 0; + data.current_reference_score = 0; + data.combo = 0; + data.challenge_time_combo_count = 0; + data.life_gauge = 127; + data.score_final = 0; + data.life_gauge_final = 127; + data.max_combo = 0; + data.challenge_time_total_bonus = 0; + data.field_2CF88 = 0; + data.pv = 0i64; + data.score_slide_chain_bonus = 0; + data.slide_chain_length = 0; + data.field_2D0BC = false; + data.next_stage = false; + data.field_2D0BE = false; + data.field_2D0C0 = -1; + + data.field_2CE98 = 0; + + for (int32_t& i : data.total_hit_count) + i = 0; + + for (int32_t& i : data.hit_count) + i = 0; + + data.changed_field = 0; + + data.has_auth_3d_frame = false; + data.has_light_frame = false; + + for (bool& i : data.has_aet_frame) + i = false; + + for (bool& i : data.has_aet_list) + i = false; + + data.success = data.field_2D063; + data.field_2CE98 = 0; + data.field_2D874 = -1; + data.field_2DB34 = 0; + data.field_2D0A8 = 0; + data.field_2D0AC = 0; + data.field_2D0B0[0] = 0; + data.field_2D0B0[1] = 0; + data.field_2D0B0[2] = 0; + + data.effect_rs_list.clear(); + data.effect_rs_list_hashes.clear(); + + data.task_effect_init = false; +} + +bool pv_game::unload() { + data_struct* aft_data = &data_list[DATA_AFT]; + aet_database* aft_aet_db = &aft_data->data_ft.aet_db; + sprite_database* aft_spr_db = &aft_data->data_ft.spr_db; + texture_database* aft_tex_db = &aft_data->data_ft.tex_db; + + switch (data.field_2D09C) { + case 0: { + pv_game_music_get()->stop(); + + /*for (int32_t i = 0; i < 2; i++) + if (app::TaskWork::CheckTaskReady(task_movie_get())) + sub_14041F4E0(task_movie_get());*/ + + std::string effect_se_file_name = get_effect_se_file_name(); + if (effect_se_file_name.size()) + sound_work_unload_farc(effect_se_file_name.data()); + + if (data.play_data.slidertouch_name.size()) { + char buf[0x200]; + sprintf_s(buf, sizeof(buf), "rom/sound/%s.farc", data.play_data.slidertouch_name.c_str()); + sound_work_unload_farc(buf); + } + + wave_audio_storage_clear(); + + if (data.play_data.aix) + pv_game_music_get()->exclude_flags(PV_GAME_MUSIC_AIX); + + pv_game_music_get()->set_channel_pair_volume_map(0, 100); + pv_game_music_get()->set_channel_pair_volume_map(1, 100); + + data.field_2CF30 = 4; + + post_process& pp = rctx_ptr->post_process; + int32_t frame_texture_index = 0; + for (pv_db_pv_frame_texture& i : data.pv->frame_texture) { + if (i.data.size()) { + texture* tex = texture_storage_get_texture(aft_tex_db->get_texture_id(i.data.c_str())); + //if (tex) + // post_process_free_frame_texture(&pp, frame_texture_index, tex); + } + frame_texture_index++; + } + + if (data.field_2D0BE) { + //post_process_reset_frame_textures(&pp); + data.field_2D0BE = false; + } + + //data.pv_data->reset(); + + if (data.play_data.ogg) + pv_game_music_get()->exclude_flags(PV_GAME_MUSIC_OGG); + + data.field_2D09C = 1; + } + case 1: + pv_osage_manager_array_set_not_reset_true(); + if (pv_osage_manager_array_get_disp()) + return false; + + data.field_2D09C = 2; + break; + } + + for (auto& i : data.chara) { + if (i.chara_id != -1 && i.rob_chr) { + skin_param_manager_reset(i.chara_id); + rob_chara_array_free_chara_id(i.chara_id); + } + + i.chara_index = CHARA_MAX; + i.cos = -1; + i.chara_id = -1; + i.pv_data = {}; + i.rob_chr = 0; + i.motion_ids.clear(); + i.motion_face_ids.clear(); + } + + //osage_play_data_manager_clear_data(); + + for (uint32_t& i: data.motion_set_ids) { + motion_set_unload_motion(i); + motion_set_unload_mothead(i); + } + data.motion_set_ids.clear(); + + for (uint32_t& i : data.motion_set_face_ids) + motion_set_unload_motion(i); + data.motion_set_face_ids.clear(); + + pv_expression_file_unload(data.pv->pv_expression_file_name.c_str()); + + data.stage_indices.clear(); + data.stage_infos.clear(); + + task_stage_unload_task(); + + if (data.field_2D7E8) + for (int32_t& i : data.spr_set_back_ids) + sprite_manager_unload_set(i, aft_spr_db); + + data.field_2D7E8 = false; + data.spr_set_back_ids.clear(); + + data.current_field = 0; + data.field_data.clear(); + + data.field_2D8A0 = true; + + for (auto& i : data.auth_3d) + i.second.unload_id(rctx_ptr); + + for (auto& i : data.field_2DA08) + for (auto& j : i.auth_3d_ids) + j.unload_id(rctx_ptr); + + if (data.field_2DAC8) + for (std::string& i : data.auth_3d_categories) + auth_3d_data_unload_category(i.c_str()); + + data.camera_auth_3d_uid = -1; + data.campv_string.clear(); + data.campv_auth_3d_uids.clear(); + data.data_camera_id = 0; + data.campv.clear(); + + data.itmpv_string.clear(); + data.itmpv_auth_3d_uids.clear(); + for (auto& i : data.itmpv) + i.clear(); + data.itmpv_uids.clear(); + + for (auto& i : data.field_2DA08) { + i.data.clear(); + i.auth_3d_ids.clear(); + i.field_30 = -1; + } + + data.auth_3d.clear(); + data.field_2DAC8 = false; + data.auth_3d_categories.clear(); + data.loaded_auth_3d_uids.clear(); + + data.auth_3d_time.clear(); + data.light_time.clear(); + + for (auto& i : data.aet_time) + i.clear(); + + data.chreff_auth_3d.clear(); + data.chreff_auth_3d_obj.clear(); + + for (int32_t& i : data.edit_effect_aet_set_ids) + sprite_manager_unload_set(i, aft_spr_db); + data.edit_effect_aet_set_ids.clear(); + + for (int32_t& i : data.edit_effect_spr_set_ids) + aet_manager_unload_set(i, aft_aet_db); + + data.edit_effect_spr_set_ids.clear(); + data.edit_effect_aet_ids.clear(); + data.edit_effect.field_0 = -1; + data.edit_effect.field_4 = 1.0f; + data.edit_effect.field_8 = 0.0f; + data.edit_effect.field_C = 0.0f; + data.edit_effect.field_10 = 1.0f; + data.edit_effect.field_14 = false; + + //pv_param::light_data_clear_data(); + pv_param::post_process_data_clear_data(); + + for (uint32_t& i : data.obj_set_itmpv) + object_storage_unload_set(i); + data.obj_set_itmpv.clear(); + + for (uint32_t& i : data.obj_set_handitem) + object_storage_unload_set(i); + data.obj_set_handitem.clear(); + + skin_param_storage_reset(); + + for (uint32_t& i : data.chreff_auth_3d_obj_set_ids) + object_storage_unload_set(i); + data.chreff_auth_3d_obj_set_ids.clear(); + + for (uint32_t& i : data.field_2D770) + object_storage_unload_set(i); + data.field_2D770.clear(); + + for (uint32_t& i : data.stgpvhrc_obj_set_ids) + object_storage_unload_set(i); + data.stgpvhrc_obj_set_ids.clear(); + + for (uint32_t& i : data.ex_song_ex_auth_obj_set_ids) + object_storage_unload_set(i); + data.ex_song_ex_auth_obj_set_ids.clear(); + + for (uint64_t& i : data.effect_rs_list_hashes) + Glitter::glt_particle_manager->UnloadEffectGroup(i); + data.effect_rs_list.clear(); + data.effect_rs_list_hashes.clear(); + + /*for (int32_t i = 0; i < 2; i++) { + TaskMovie* task_movie = task_movie_get(i16); + if (!app::TaskWork::CheckTaskReady(task_movie)) + continue; + + sub_14041F4E0(task_movie); + app::Task::DelTask(task_movie); + }*/ + + data.field_2D098 = 0; + + //stage_param_data_coli_data_clear(); + + data.play_data.field_3B0 = -1; + data.play_data.field_3B4 = -1; + data.play_data.field_3B8 = -1; + data.play_data.field_3BC = -1; + + //sub_14012BDA0(sub_14013C8F0()); + + //data.play_data->unload(); + + data.play_data.field_64C = 0; + + field_1 = false; + field_2 = false; + end_pv = false; + + //sub_14013C8C0()->field_26 = 0; + + /*struc_14* v85 = sub_14013C8C0(); + v85->field_14 = 0; + v85->field_18 = 0; + v85->field_1C = 0; + v85->field_20 = 1.0;*/ + + //sub_14013C8C0()->field_24 = false; + //sub_14013C8C0()->field_25 = false; + + loaded = false; + + data.field_2CFC8.clear(); + data.notes_passed = 0; + data.field_2CFF0 = 0; + data.field_2CFE0 = 0; + data.field_2D0C0 = -1; + + light_param_data_storage_data_reset(); + + post_process& pp = rctx_ptr->post_process; + pp.tone_map->set_saturate_coeff(1.0f); + pp.dof->set_dof_pv(); + pp.tone_map->set_scene_fade(0.0f); + + /*if (!sub_140192E20()) + post_process_set_taa(&pp, 1);*/ + + //sub_1404A9480(&pp, 0, -1); + + rctx_ptr->disp_manager.object_culling = true; + rctx_ptr->render_manager.shadow_ptr->range = 1.0f; + rctx_ptr->render_manager.set_effect_texture(0); + + sound_work_reset_all_se(); + + pv_param_task::post_process_task_del_task(); + + data.current_time_float = 0.0f; + data.current_time = 0; + return true; +} + pv_game_init_data::pv_game_init_data() : pv_id(), difficulty(), field_C(), score_percentage_clear(), life_gauge_safety_time(), life_gauge_border(), field_18(), modules(), items() { @@ -559,15 +1015,6 @@ bool task_pv_game_del_task() { return false; } -void pv_game_music_fade::reset() { - start = 0; - value = 0; - time = 0.0f; - remain = 0.0f; - action = PV_GAME_MUSIC_ACTION_NONE; - enable = false; -} - pv_game_music_args::pv_game_music_args() : type(), start(), field_2C() { } @@ -577,38 +1024,32 @@ pv_game_music_args::~pv_game_music_args() { } pv_game_music_ogg::pv_game_music_ogg() : playback() { - + playback = ogg_playback_data_get(0); } pv_game_music_ogg::~pv_game_music_ogg() { - + if (playback) { + playback->Reset(); + playback = 0; + } } -pv_game_music::pv_game_music() : flags(), pause(), fade_in(), fade_out(), no_fade(), -no_fade_remain(), fade_out_time_req(), fade_out_action_req(), type(), start(), end(), -play_on_end(), fade_in_time(), fade_out_time(), field_9C(), loaded(), ogg() { +pv_game_music::pv_game_music() : flags(), pause(), channel_pair_volume(), fade_in(), +fade_out(), no_fade(), no_fade_remain(), fade_out_time_req(), fade_out_action_req(), +type(), start(), end(), play_on_end(), fade_in_time(), field_9C(), loaded(), ogg() { volume = 100; master_volume = 100; - channel_pair_volume[0] = 100; - channel_pair_volume[1] = 100; - channel_pair_volume[2] = 100; - channel_pair_volume[3] = 100; - reset(); + for (int32_t& i : channel_pair_volume) + i = 100; + fade_out_time = 3.0f; } pv_game_music::~pv_game_music() { } -bool pv_game_music::check_args(int32_t type, std::string& file_path, float_t start) { - bool ret = true; - if (args.type != type) - ret = false; - if (args.file_path.compare(file_path)) - ret = false; - if (args.start != start) - ret = false; - return ret; +bool pv_game_music::check_args(int32_t type, std::string&& file_path, float_t start) { + return args.type == type && !args.file_path.compare(file_path) && args.start == start; } void pv_game_music::ctrl(float_t delta_time) { @@ -621,6 +1062,7 @@ void pv_game_music::ctrl(float_t delta_time) { fade_out.time = fade_out_time_req; fade_out.remain = fade_out_time_req; fade_out.action = fade_out_action_req; + no_fade = false; no_fade_remain = 0.0f; fade_out_time_req = 0.0f; @@ -633,7 +1075,8 @@ void pv_game_music::ctrl(float_t delta_time) { if (fade_in.remain > 0.0f) { int32_t value = fade_in.value; if (fade_in.time > 0.0f) - value = (int32_t)((float_t)value - (float_t)(value - fade_in.start) * (fade_in.remain / fade_in.time)); + value = (int32_t)((float_t)value - (float_t)(value + - fade_in.start) * (fade_in.remain / fade_in.time)); set_volume_map(0, value); } else @@ -645,7 +1088,8 @@ void pv_game_music::ctrl(float_t delta_time) { if (fade_out.remain > 0.0f) { int32_t value = fade_out.value; if (fade_out.time > 0.0f) - value = (int32_t)((float_t)value - (float_t)(value - fade_out.start) * (fade_out.remain / fade_out.time)); + value = (int32_t)((float_t)value - (float_t)(value + - fade_out.start) * (fade_out.remain / fade_out.time)); set_volume_map(0, value); } else @@ -653,18 +1097,19 @@ void pv_game_music::ctrl(float_t delta_time) { } if (flags & PV_GAME_MUSIC_OGG) { - if (ogg->playback->GetFileState() == OGG_FILE_HANDLER_FILE_STATE_STOPPED) - ogg->playback->Stop(); - if (ogg->playback->GetFileState() == OGG_FILE_HANDLER_FILE_STATE_STOPPED) + OggPlayback* playback = ogg->playback; + if (playback->GetFileState() == OGG_FILE_HANDLER_FILE_STATE_STOPPED) + playback->Stop(); + if (playback->GetFileState() == OGG_FILE_HANDLER_FILE_STATE_STOPPED) play_or_stop(); - OggPlayback::SetChannelPairVolumePan(ogg->playback); + OggPlayback::SetChannelPairVolumePan(playback); } } void pv_game_music::exclude_flags(pv_game_music_flags flags) { if ((this->flags & PV_GAME_MUSIC_OGG) && (flags & PV_GAME_MUSIC_OGG)) ogg_free(); - enum_and(flags, ~flags); + enum_and(this->flags, ~flags); } void pv_game_music::fade_in_end() { @@ -680,7 +1125,7 @@ void pv_game_music::fade_in_end() { stop(); break; case PV_GAME_MUSIC_ACTION_PAUSE: - set_pause(true); + set_pause(1); break; case PV_GAME_MUSIC_ACTION_PLAY: play(); @@ -701,7 +1146,7 @@ void pv_game_music::fade_out_end() { stop(); break; case PV_GAME_MUSIC_ACTION_PAUSE: - set_pause(true); + set_pause(1); break; case PV_GAME_MUSIC_ACTION_PLAY: play(); @@ -709,8 +1154,8 @@ void pv_game_music::fade_out_end() { } } -void pv_game_music::file_load(int32_t type, std::string& file_path, bool play_on_end, - float_t start, float end, float fade_in_time, float_t fade_out_time, bool a9) { +void pv_game_music::file_load(int32_t type, std::string&& file_path, bool play_on_end, + float_t start, float_t end, float_t fade_in_time, float_t fade_out_time, bool a9) { this->type = type; this->file_path.assign(file_path); this->start = start; @@ -718,15 +1163,15 @@ void pv_game_music::file_load(int32_t type, std::string& file_path, bool play_on this->play_on_end = play_on_end; this->fade_out_time = fade_out_time; this->fade_in_time = fade_in_time; - field_9C = a9; + this->field_9C = a9; if (fade_in_time > 0.0f) { fade_in.start = 0; fade_in.value = 100; fade_in.time = fade_in_time; fade_in.remain = fade_in_time; - fade_in.enable = true; fade_in.action = PV_GAME_MUSIC_ACTION_NONE; + fade_in.enable = true; } if (end <= 0.0f) { @@ -734,26 +1179,28 @@ void pv_game_music::file_load(int32_t type, std::string& file_path, bool play_on fade_out.value = 0; fade_out.time = 0.0f; fade_out.remain = 0.0f; - fade_out.action = play_on_end ? PV_GAME_MUSIC_ACTION_PLAY : PV_GAME_MUSIC_ACTION_STOP; + fade_out.action = play_on_end + ? PV_GAME_MUSIC_ACTION_PLAY : PV_GAME_MUSIC_ACTION_STOP; } else { no_fade = true; no_fade_remain = end + fade_in_time; fade_out_time_req = fade_out_time; - fade_out_action_req = play_on_end ? PV_GAME_MUSIC_ACTION_PLAY : PV_GAME_MUSIC_ACTION_STOP; + fade_out_action_req = play_on_end + ? PV_GAME_MUSIC_ACTION_PLAY : PV_GAME_MUSIC_ACTION_STOP; } } int32_t pv_game_music::get_master_volume(int32_t index) { - if (index) - return 0; - return master_volume; + if (!index) + return master_volume; + return 0; } int32_t pv_game_music::get_volume(int32_t index) { - if (index) - return 0; - return volume; + if (!index) + return volume; + return 0; } int32_t pv_game_music::include_flags(pv_game_music_flags flags) { @@ -763,28 +1210,22 @@ int32_t pv_game_music::include_flags(pv_game_music_flags flags) { return 0; } -int32_t pv_game_music::load(int32_t type, std::string& file_path, bool wait_load, float_t time, bool a6) { - if (type == 4 && (set_ogg_args(file_path, time, wait_load) < 0)) +int32_t pv_game_music::load(int32_t type, std::string&& file_path, bool wait_load, float_t time, bool a6) { + if (type == 4 && (set_ogg_args(std::string(file_path), time, wait_load) < 0)) return -6; reset(); reset_args(); - set_args(type, file_path, time, a6); + set_args(type, std::string(file_path), time, a6); pause = true; return 0; } void pv_game_music::ogg_free() { - if (!ogg) - return; - - pv_game_music_ogg* ogg = this->ogg; - if (ogg->playback) { - ogg->playback->Reset(); - ogg->playback = 0; + if (ogg) { + delete ogg; + ogg = 0; } - delete ogg; - this->ogg = 0; } int32_t pv_game_music::ogg_init() { @@ -792,13 +1233,10 @@ int32_t pv_game_music::ogg_init() { return 0; ogg = new pv_game_music_ogg; - ogg->playback = ogg_playback_data_get(0); - if (ogg->playback) - return 0; - return -1; + return ogg->playback ? 0 : -1; } -int32_t pv_game_music::ogg_load(std::string& file_path, float_t start) { +int32_t pv_game_music::ogg_load(std::string&& file_path, float_t start) { if (!(flags & PV_GAME_MUSIC_OGG)) return -2; @@ -809,12 +1247,12 @@ int32_t pv_game_music::ogg_load(std::string& file_path, float_t start) { OggFileHandlerFileState file_state = playback->GetFileState(); OggFileHandlerPauseState pause_state = playback->GetPauseState(); - if (!check_args(4, file_path, start) + if (!check_args(4, std::string(file_path), start) || file_state != OGG_FILE_HANDLER_FILE_STATE_PLAYING || pause_state != OGG_FILE_HANDLER_PAUSE_STATE_PAUSE) { playback->Stop(); playback->SetLoadTimeSeek(start); - playback->SetPath(file_path);; + playback->SetPath(file_path); } playback->SetPauseState(OGG_FILE_HANDLER_PAUSE_STATE_PLAY); @@ -840,25 +1278,25 @@ int32_t pv_game_music::ogg_stop() { } int32_t pv_game_music::play() { - return play(type, file_path, play_on_end, start, end, fade_in_time, fade_out_time, false); + return play(type, std::string(file_path), play_on_end, start, end, fade_in_time, fade_out_time, false); } -int32_t pv_game_music::play(int32_t type, std::string& file_path, bool play_on_end, - float_t start, float end, float fade_in_time, float_t fade_out_time, bool a9) { +int32_t pv_game_music::play(int32_t type, std::string&& file_path, bool play_on_end, + float_t start, float_t end, float_t fade_in_time, float_t fade_out_time, bool a9) { set_volume_map(0, 100); - if (type == 4 && (ogg_load(file_path, start) < 0)) + if (type == 4 && ogg_load(std::string(file_path), start) < 0) return -7; reset(); reset_args(); - file_load(type, file_path, play_on_end, start, end, fade_in_time, fade_out_time, a9); + file_load(type, std::string(file_path), play_on_end, start, end, fade_in_time, fade_out_time, a9); pause = false; return 0; } -void pv_game_music::play(int32_t type, std::string& file_path, float_t start, +void pv_game_music::play_fade_in(int32_t type, std::string&& file_path, float_t start, float_t end, bool play_on_end, bool a7, float_t fade_out_time, bool a10) { - play(type, file_path, play_on_end, start, end, 0.0f, fade_out_time, a10); + play(type, std::string(file_path), play_on_end, start, end, 0.0f, fade_out_time, a10); } int32_t pv_game_music::play_or_stop() { @@ -869,8 +1307,8 @@ int32_t pv_game_music::play_or_stop() { } void pv_game_music::reset() { - fade_in.reset(); - fade_out.reset(); + fade_in = {}; + fade_out = {}; no_fade = false; no_fade_remain = 0.0f; fade_out_time_req = 0.0f; @@ -892,7 +1330,7 @@ void pv_game_music::reset_args() { args.field_2C = false; } -void pv_game_music::set_args(int32_t type, std::string& file_path, float_t start, bool a5) { +void pv_game_music::set_args(int32_t type, std::string&& file_path, float_t start, bool a5) { args.type = type; args.file_path.assign(file_path); args.start = start; @@ -908,35 +1346,31 @@ int32_t pv_game_music::set_channel_pair_volume(int32_t channel_pair, int32_t val } int32_t pv_game_music::set_channel_pair_volume_map(int32_t channel_pair, int32_t value) { - if (channel_pair < 0 || channel_pair >= 4) - return -1; - - set_channel_pair_volume(channel_pair, value); - switch (channel_pair) { - case 0: - set_channel_pair_volume_map(2, value); - break; - case 1: - set_channel_pair_volume_map(3, value); - break; - } - channel_pair_volume[channel_pair] = value; - return 0; -} - -int32_t pv_game_music::set_fade_out(float_t time, uint8_t stop) { - reset(); - if (time == 0.0f) { - this->stop(); + if (channel_pair >= 0 && channel_pair <= 3) { + set_channel_pair_volume(channel_pair, value); + if (!channel_pair) + set_channel_pair_volume_map(2, value); + else if (channel_pair == 1) + set_channel_pair_volume_map(3, value); + channel_pair_volume[channel_pair] = value; return 0; } + return -1; +} - fade_out.start = get_volume(0); - fade_out.value = 0; - fade_out.time = time; - fade_out.remain = time; - fade_out.action = stop ? PV_GAME_MUSIC_ACTION_STOP : PV_GAME_MUSIC_ACTION_PAUSE; - fade_out.enable = true; +int32_t pv_game_music::set_fade_out(float_t time, bool stop) { + reset(); + if (time == 0.0f) + pv_game_music::stop(); + else { + fade_out.start = get_volume(0); + fade_out.value = 0; + fade_out.time = time; + fade_out.remain = time; + fade_out.enable = true; + fade_out.action = stop ? PV_GAME_MUSIC_ACTION_STOP + : PV_GAME_MUSIC_ACTION_PAUSE; + } return 0; } @@ -944,11 +1378,12 @@ int32_t pv_game_music::set_master_volume(int32_t value) { if (!(flags & PV_GAME_MUSIC_OGG)) return -2; - ogg->playback->SetMasterVolume(ratio_to_db((float)(value * get_master_volume(0) / 100) * 0.01f)); + ogg->playback->SetMasterVolume(ratio_to_db( + (float_t)(value * get_master_volume(0) / 100) * 0.01f)); return 0; } -int32_t pv_game_music::set_ogg_args(std::string& file_path, float_t start, bool wait_load) { +int32_t pv_game_music::set_ogg_args(std::string&& file_path, float_t start, bool wait_load) { if (!(flags & PV_GAME_MUSIC_OGG)) return -2; @@ -959,7 +1394,7 @@ int32_t pv_game_music::set_ogg_args(std::string& file_path, float_t start, bool OggFileHandlerFileState file_state = playback->GetFileState(); OggFileHandlerPauseState pause_state = playback->GetPauseState(); - if (!check_args(4, file_path, start) + if (!check_args(4, std::string(file_path), start) || file_state != OGG_FILE_HANDLER_FILE_STATE_PLAYING || pause_state != OGG_FILE_HANDLER_PAUSE_STATE_PAUSE) { playback->Stop(); @@ -970,9 +1405,9 @@ int32_t pv_game_music::set_ogg_args(std::string& file_path, float_t start, bool if (wait_load) { OggFileHandlerFileState file_state = playback->GetFileState(); - while (!(file_state == OGG_FILE_HANDLER_FILE_STATE_PLAYING - || file_state == OGG_FILE_HANDLER_FILE_STATE_STOPPED - || file_state == OGG_FILE_HANDLER_FILE_STATE_MAX)) + while (file_state != OGG_FILE_HANDLER_FILE_STATE_PLAYING + && file_state != OGG_FILE_HANDLER_FILE_STATE_STOPPED + && file_state != OGG_FILE_HANDLER_FILE_STATE_MAX) file_state = playback->GetFileState(); } } @@ -983,8 +1418,9 @@ int32_t pv_game_music::set_ogg_pause_state(uint8_t pause_state) { if ((flags & PV_GAME_MUSIC_OGG) == 0) return -2; - if (ogg->playback->GetFileState() == OGG_FILE_HANDLER_FILE_STATE_PLAYING) - ogg->playback->SetPauseState((OggFileHandlerPauseState)pause_state); + OggPlayback* playback = ogg->playback; + if (playback->GetFileState() == OGG_FILE_HANDLER_FILE_STATE_PLAYING) + playback->SetPauseState((OggFileHandlerPauseState)pause_state); return 0; } @@ -996,12 +1432,11 @@ int32_t pv_game_music::set_pause(int32_t pause) { } void pv_game_music::set_volume_map(int32_t index, int32_t value) { - if (index) - return; - - if (flags & PV_GAME_MUSIC_OGG) - set_master_volume(value); - volume = value; + if (!index) { + if (flags & PV_GAME_MUSIC_OGG) + set_master_volume(value); + volume = value; + } } int32_t pv_game_music::stop() { @@ -1021,3 +1456,7 @@ void pv_game_music::stop_reset_flags() { static pv_game_music* pv_game_music_get() { return pv_game_music_data; } + +static struc_14* sub_14013C8C0() { + return &stru_140C94438; +} diff --git a/src/ReDIVA/pv_game.hpp b/src/ReDIVA/pv_game.hpp index d4ef0120..1d9ff94e 100644 --- a/src/ReDIVA/pv_game.hpp +++ b/src/ReDIVA/pv_game.hpp @@ -12,12 +12,220 @@ #include #include "../KKdLib/dsc.hpp" #include "../CRE/rob/rob.hpp" +#include "../CRE/auth_2d.hpp" #include "../CRE/auth_3d.hpp" +#include "../CRE/ogg_vorbis.hpp" #include "../CRE/pv_db.hpp" #include "../CRE/stage.hpp" #include "../CRE/task.hpp" #include "task_window.hpp" +enum pv_game_aet { + PV_GAME_AET_0 = 0, + PV_GAME_AET_1, + PV_GAME_AET_VALUE_TEXT, + PV_GAME_AET_COMBO, + PV_GAME_AET_CHANCE_TXT, + PV_GAME_AET_CHANCE_POINT, + PV_GAME_AET_SLIDE_POINT, + PV_GAME_AET_MAX_SLIDE_POINT, + PV_GAME_AET_MAX_SLIDE_NUM_PLUS, + PV_GAME_AET_MAX_SLIDE_NUM_0, + PV_GAME_AET_MAX_SLIDE_NUM_1, + PV_GAME_AET_MAX_SLIDE_NUM_2, + PV_GAME_AET_MAX_SLIDE_NUM_3, + PV_GAME_AET_MAX_SLIDE_NUM_4, + PV_GAME_AET_MAX_SLIDE_NUM_5, + PV_GAME_AET_MAX_SLIDE_NUM_6, + PV_GAME_AET_FRAME_BOTTOM, + PV_GAME_AET_FRAME_UP, + PV_GAME_AET_CHANCE_FRAME_BOTTOM, + PV_GAME_AET_CHANCE_FRAME_TOP, + PV_GAME_AET_20, + PV_GAME_AET_STAGE_INFO, + PV_GAME_AET_SONG_ENERGY_BASE, + PV_GAME_AET_SONG_ENERGY_BASE_REACH, + PV_GAME_AET_SONG_ENERGY_NORMAL, + PV_GAME_AET_SONG_ENERGY_REACH, + PV_GAME_AET_SONG_ENERGY_FULL, + PV_GAME_AET_SONG_ENERGY_EFF_NORMAL, + PV_GAME_AET_SONG_ENERGY_EFF_REACH, + PV_GAME_AET_SONG_ENERGY_CLEAR_TXT, + PV_GAME_AET_SONG_ENERGY_BORDER_GREAT, + PV_GAME_AET_SONG_ENERGY_BORDER_EXCELLENT, + PV_GAME_AET_SONG_ENERGY_BORDER_RIVAL, + PV_GAME_AET_SONG_ENERGY_EDGE_LINE02, + PV_GAME_AET_SONG_ENERGY_BORDER, + PV_GAME_AET_SONG_ENERGY_NOT_CLEAR, + PV_GAME_AET_SONG_ENERGY_NOT_CLEAR_TXT, + PV_GAME_AET_NEXT_INFO, + PV_GAME_AET_LEVEL_INFO, + PV_GAME_AET_OPTION_INFO_BASE, + PV_GAME_AET_OPTION_INFO_HISPEED, + PV_GAME_AET_OPTION_INFO_HIDDEN, + PV_GAME_AET_OPTION_INFO_SUDDEN, + PV_GAME_AET_SONG_ICON, + PV_GAME_AET_SUCCESS_INFO, + PV_GAME_AET_DEMO_LOGO, + PV_GAME_AET_46, + PV_GAME_AET_DEMO_FONT, + PV_GAME_AET_FRONT_0, + PV_GAME_AET_FRONT_1, + PV_GAME_AET_FRONT_2, + PV_GAME_AET_FRONT_3, + PV_GAME_AET_FRONT_4, + PV_GAME_AET_FRONT_5, + PV_GAME_AET_FRONT_6, + PV_GAME_AET_FRONT_7, + PV_GAME_AET_FRONT_LOW_0, + PV_GAME_AET_FRONT_LOW_1, + PV_GAME_AET_FRONT_LOW_2, + PV_GAME_AET_FRONT_LOW_3, + PV_GAME_AET_FRONT_LOW_4, + PV_GAME_AET_FRONT_LOW_5, + PV_GAME_AET_FRONT_LOW_6, + PV_GAME_AET_FRONT_LOW_7, + PV_GAME_AET_FRONT_3D_SURF_0, + PV_GAME_AET_FRONT_3D_SURF_1, + PV_GAME_AET_FRONT_3D_SURF_2, + PV_GAME_AET_FRONT_3D_SURF_3, + PV_GAME_AET_FRONT_3D_SURF_4, + PV_GAME_AET_FRONT_3D_SURF_5, + PV_GAME_AET_FRONT_3D_SURF_6, + PV_GAME_AET_FRONT_3D_SURF_7, + PV_GAME_AET_BACK_0, + PV_GAME_AET_BACK_1, + PV_GAME_AET_BACK_2, + PV_GAME_AET_BACK_3, + PV_GAME_AET_BACK_4, + PV_GAME_AET_BACK_5, + PV_GAME_AET_BACK_6, + PV_GAME_AET_BACK_7, + PV_GAME_AET_TITLE_IMAGE, + PV_GAME_AET_WHITE_FADE, + PV_GAME_AET_BLACK_FADE, + PV_GAME_AET_83, + PV_GAME_AET_84, + PV_GAME_AET_TOP_FRONT, + PV_GAME_AET_BOTTOM_FRONT, + PV_GAME_AET_TOP_BACK, + PV_GAME_AET_BOTTOM_BACK, + PV_GAME_AET_EDIT_EFFECT, + PV_GAME_AET_MAX, +}; + +enum pv_game_music_action { + PV_GAME_MUSIC_ACTION_NONE = 0, + PV_GAME_MUSIC_ACTION_STOP, + PV_GAME_MUSIC_ACTION_PAUSE, + PV_GAME_MUSIC_ACTION_PLAY, + PV_GAME_MUSIC_ACTION_MAX, +}; + +enum pv_game_music_flags : uint8_t { + PV_GAME_MUSIC_FLAG_1 = 0x01, + PV_GAME_MUSIC_AIX = 0x02, + PV_GAME_MUSIC_OGG = 0x04, + PV_GAME_MUSIC_FLAG_8 = 0x08, + PV_GAME_MUSIC_FLAG_10 = 0x10, + PV_GAME_MUSIC_FLAG_20 = 0x20, + PV_GAME_MUSIC_FLAG_40 = 0x40, + PV_GAME_MUSIC_FLAG_80 = 0x80, + + PV_GAME_MUSIC_ALL = 0xFF, +}; + +struct pv_game_music_fade { + int32_t start; + int32_t value; + float_t time; + float_t remain; + pv_game_music_action action; + bool enable; +}; + +struct pv_game_music_args { + int32_t type; + std::string file_path; + float_t start; + bool field_2C; + + pv_game_music_args(); + ~pv_game_music_args(); +}; + +struct pv_game_music_ogg { + OggPlayback* playback; + std::string file_path; + + pv_game_music_ogg(); + ~pv_game_music_ogg(); +}; + +struct pv_game_music { + pv_game_music_flags flags; + bool pause; + int32_t volume; + int32_t master_volume; + int32_t channel_pair_volume[4]; + pv_game_music_fade fade_in; + pv_game_music_fade fade_out; + bool no_fade; + float_t no_fade_remain; + float_t fade_out_time_req; + pv_game_music_action fade_out_action_req; + int32_t type; + std::string file_path; + float_t start; + float_t end; + bool play_on_end; + float_t fade_in_time; + float_t fade_out_time; + bool field_9C; + pv_game_music_args args; + bool loaded; + pv_game_music_ogg* ogg; + + pv_game_music(); + ~pv_game_music(); + + bool check_args(int32_t type, std::string&& file_path, float_t start); + void ctrl(float_t delta_time); + void exclude_flags(pv_game_music_flags flags); + void fade_in_end(); + void fade_out_end(); + void file_load(int32_t type, std::string&& file_path, bool play_on_end, + float_t start, float_t end, float_t fade_in_time, float_t fade_out_time, bool a9); + int32_t get_master_volume(int32_t index); + int32_t get_volume(int32_t index); + int32_t include_flags(pv_game_music_flags flags); + int32_t load(int32_t type, std::string&& file_path, bool wait_load, float_t time, bool a6); + void ogg_free(); + int32_t ogg_init(); + int32_t ogg_load(std::string&& file_path, float_t start); + int32_t ogg_reset(); + int32_t ogg_stop(); + int32_t play(); + int32_t play(int32_t type, std::string&& file_path, bool play_on_end, + float_t start, float_t end, float_t fade_in_time, float_t fade_out_time, bool a9); + void play_fade_in(int32_t type, std::string&& file_path, float_t start, + float_t end, bool play_on_end, bool a7, float_t fade_out_time, bool a10); + int32_t play_or_stop(); + void reset(); + void reset_args(); + void set_args(int32_t type, std::string&& file_path, float_t start, bool a5); + int32_t set_channel_pair_volume(int32_t channel_pair, int32_t value); + int32_t set_channel_pair_volume_map(int32_t channel_pair, int32_t value); + int32_t set_fade_out(float_t time, bool stop); + int32_t set_master_volume(int32_t value); + int32_t set_ogg_args(std::string&& file_path, float_t start, bool wait_load); + int32_t set_ogg_pause_state(uint8_t pause_state); + int32_t set_pause(int32_t pause); + void set_volume_map(int32_t index, int32_t value); + int32_t stop(); + void stop_reset_flags(); +}; + struct pv_play_data_set_motion { float_t frame_speed; int32_t motion_id; @@ -106,11 +314,6 @@ struct pv_data_camera { int64_t time; }; -struct pv_game_dsc_data_change_field { - int32_t time; - int32_t field; -}; - struct struc_540 { int32_t field_0; vec2 field_4; @@ -162,7 +365,7 @@ struct struc_676 { struct pv_game; -struct pv_game_dsc_data { +struct pv_game_pv_data { int8_t field_0; int32_t state; bool play; @@ -181,7 +384,7 @@ struct pv_game_dsc_data { int32_t chara_id; pv_game* pv_game; //struc_162* field_2BF80; - //pv_game_music* music; + pv_game_music* music; p_file_handler dsc_file_handler; float_t target_anim_fps; float_t anim_frame_speed; @@ -205,8 +408,8 @@ struct pv_game_dsc_data { std::vector data_camera_branch_fail; std::vector data_camera_branch_success; std::vector set_motion[6]; - std::vector change_field_branch_fail; - std::vector change_field_branch_success; + prj::vector_pair change_field_branch_fail; + prj::vector_pair change_field_branch_success; int64_t change_field_branch_time; bool scene_fade_enable; float_t scene_fade_frame; @@ -218,7 +421,7 @@ struct pv_game_dsc_data { bool has_perf_id; int32_t field_2C4E4; std::vector field_2C4E8; - int64_t field_2C500; + size_t field_2C500; float_t scene_rot_y; mat4 scene_rot_mat; float_t field_2C54C; @@ -228,11 +431,112 @@ struct pv_game_dsc_data { int32_t last_challenge_note; struc_676 field_2C560; - pv_game_dsc_data(); - ~pv_game_dsc_data(); + pv_game_pv_data(); + ~pv_game_pv_data(); }; -struct pv_game_data_chara { +struct pv_game_play_data { + bool pv_set; + uint32_t aet_ids[PV_GAME_AET_MAX]; + bool aet_ids_enable[PV_GAME_AET_MAX]; + float_t field_1C8[2]; + float_t field_1D0[2]; + float_t field_1D8[2]; + float_t field_1E0[2]; + float_t field_1E8[2]; + float_t field_1F0[2]; + bool disp[2]; + int32_t field_1FC[2]; + float_t field_204[2]; + float_t field_20C[2]; + int32_t frame_state; + int8_t field_218; + bool fade_begin; + bool fade_end; + pv_game_aet fade; + int32_t skin_danger_frame; + aet_layout_data song_txt[2]; + int32_t field_2FC; + int32_t chance_result; + int32_t chance_points; + vec2 chance_points_pos; + int32_t field_310; + int32_t slide_points; + vec2 slide_points_pos; + int32_t max_slide_points; + vec2 max_slide_points_pos; + int32_t pv_spr_set_id; + int32_t pv_aet_set_id; + int32_t pv_main_aet_id; + int32_t stage_index; + int32_t field_33C; + AetComp comp; + float_t field_350; + bool field_354; + int32_t value_text_spr_index; + int8_t not_clear; + int32_t spr_set_back_id; + bool loaded; + int32_t state; + int32_t field_36C; + bool score_preview_update; + int32_t field_374; + int8_t field_378; + float_t field_37C; + float_t score_preview_speed; + uint32_t score_preview; + int32_t value_text_display; + float_t field_38C; + int32_t value_text_index; + float_t value_text_time_offset; + int32_t combo_state; + int32_t combo_count; + float_t combo_disp_time; + float_t draw_x; + float_t draw_y; + int32_t field_3AC; + int32_t field_3B0; + int32_t field_3B4; + int32_t field_3B8; + int32_t field_3BC; + bool aix; + bool ogg; + int32_t field_3C4; + std::string field_3C8; + std::string se_name; + std::string pvbranch_success_se_name; + std::string slide_name; + std::string chainslide_first_name; + std::string chainslide_sub_name; + std::string chainslide_success_name; + std::string chainslide_failure_name; + std::string slidertouch_name; + std::string other_se_name; + std::string other_slide_name; + std::string other_chainslide_first_name; + std::string other_chainslide_sub_name; + std::string other_chainslide_success_name; + std::string other_chainslide_failure_name; + std::string other_slidertouch_name; + std::string song_file_name; + int32_t field_5E8; + float_t field_5EC; + int32_t option; + float_t field_5F4; + int8_t lyric[76]; + uint8_t lyric_index; + vec4u8 lyrics_color; + bool field_64C; + int32_t field_650; + float_t field_654; + int32_t field_658; + float_t field_65C; + + pv_game_play_data(); + ~pv_game_play_data(); +}; + +struct pv_game_chara { chara_index chara_index; int32_t cos; int32_t chara_id; @@ -241,20 +545,20 @@ struct pv_game_data_chara { std::vector motion_ids; std::vector motion_face_ids; - pv_game_data_chara(); - ~pv_game_data_chara(); + pv_game_chara(); + ~pv_game_chara(); }; -struct struc_675 { +struct pv_game_edit_effect { int8_t field_0; float_t field_4; float_t field_8; float_t field_C; float_t field_10; - int8_t field_14; + bool field_14; }; -struct pv_game_data_field { +struct pv_game_field { int32_t stage_index; std::vector auth_3d_uids; std::vector auth_3d_ids; @@ -274,27 +578,27 @@ struct pv_game_data_field { std::vector stop_eff_list; std::vector field_1A0; - pv_game_data_field(); - ~pv_game_data_field(); + pv_game_field(); + ~pv_game_field(); }; -struct pv_game_data_itmpv { +struct pv_game_itmpv { int32_t auth_3d_id; int32_t field_4; int64_t time; }; -struct struc_78 { - std::vector field_0; - std::vector field_18; +struct struc_269 { + prj::vector_pair data; + std::vector auth_3d_ids; int32_t field_30; int32_t field_34; - struc_78(); - ~struc_78(); + struc_269(); + ~struc_269(); }; -struct pv_game_data_chreff { +struct pv_game_chreff { chara_index src_chara_index; chara_index dst_chara_index; std::bitset<128> type; @@ -305,8 +609,8 @@ struct pv_game_data_chreff { int32_t src_auth_3d_uid; int32_t dst_auth_3d_uid; - pv_game_data_chreff(); - ~pv_game_data_chreff(); + pv_game_chreff(); + ~pv_game_chreff(); }; struct pv_effect_resource { @@ -318,8 +622,8 @@ struct pv_effect_resource { }; struct pv_game_data { - pv_game_dsc_data dsc_data; - //pv_game_ui_data ui_data; + pv_game_pv_data pv_data; + pv_game_play_data play_data; int32_t field_2CE98; int8_t field_2CE9C[128]; int32_t field_2CF1C; @@ -347,11 +651,11 @@ struct pv_game_data { int32_t slide_chain_length; int32_t field_2CF98; int32_t field_2CF9C; - __int16 field_2CFA0; + int16_t field_2CFA0; int32_t field_2CFA4; pv_db_pv* pv; int32_t field_2CFB0; - int32_t field_2CFB4; + int32_t chance_point; int32_t reference_score; int32_t field_2CFBC; int32_t field_2CFC0; @@ -361,16 +665,16 @@ struct pv_game_data { int32_t field_2CFE4; size_t notes_passed; int32_t field_2CFF0; - float_t score_percentage; - float_t score_percentage_clear; - float_t score_percentage_border; + float_t song_energy; + float_t song_energy_base; + float_t song_energy_border; int32_t life_gauge_safety_time; int32_t life_gauge_border; - int32_t field_2D008; - int8_t field_2D00C; + int32_t stage_index; + bool field_2D00C; bool no_fail; int8_t field_2D00E; - bool field_2D00F; + bool changed_field; int64_t challenge_time_start; int64_t challenge_time_end; int64_t max_time; @@ -382,8 +686,8 @@ struct pv_game_data { int32_t score_hold_multi; uint32_t score_hold; int32_t score_slide; - uint8_t field_2D04C; - uint8_t chance_time_ended; + bool has_slide; + bool has_success_se; pv_disp2d* pv_disp2d; int32_t life_gauge_final; bool hit_border; @@ -393,14 +697,11 @@ struct pv_game_data { bool title_image_init; int8_t field_2D061; int8_t field_2D062; - int8_t field_2D063; + bool field_2D063; bool has_auth_3d_frame; bool has_light_frame; - int8_t field_2D066[2]; - int8_t field_2D068; - int8_t field_2D069; - int8_t field_2D06A[2]; - int32_t field_2D06C; + bool has_aet_frame[4]; + bool has_aet_list[4]; uint32_t field_index; int32_t edit_effect_index; int32_t slidertouch_counter; @@ -414,35 +715,35 @@ struct pv_game_data { int8_t field_2D092; int8_t field_2D093; uint8_t field_2D094; - int8_t field_2D095; + bool field_2D095; int8_t field_2D096; bool success; int32_t field_2D098; int32_t field_2D09C; - int8_t field_2D0A0; + bool use_osage_play_data; bool pv_end_fadeout; float_t rival_percentage; int32_t field_2D0A8; int32_t field_2D0AC; int32_t field_2D0B0[3]; bool field_2D0BC; - int8_t field_2D0BD; - int8_t field_2D0BE; + bool next_stage; + bool field_2D0BE; int8_t field_2D0BF; int32_t field_2D0C0; int32_t field_2D0C4; - pv_game_data_chara chara[6]; + pv_game_chara chara[6]; std::vector motion_set_ids; std::vector motion_set_face_ids; - std::vector obj_set_itmpv; - std::vector obj_set_handitem; - std::vector chreff_auth_3d_obj_set_ids; - std::vector field_2D770; - std::vector stgpvhrc_obj_set_ids; - std::vector ex_song_ex_auth_obj_set_ids; + std::vector obj_set_itmpv; + std::vector obj_set_handitem; + std::vector chreff_auth_3d_obj_set_ids; + std::vector field_2D770; + std::vector stgpvhrc_obj_set_ids; + std::vector ex_song_ex_auth_obj_set_ids; std::vector stage_indices; std::vector stage_infos; - int8_t field_2D7E8; + bool field_2D7E8; int32_t field_2D7EC; std::vector spr_set_back_ids; int32_t field_2D808; @@ -450,14 +751,14 @@ struct pv_game_data { std::vector edit_effect_aet_set_ids; std::vector edit_effect_spr_set_ids; std::vector edit_effect_aet_ids; - struc_675 field_2D858; - int32_t camera_auth_3d_uid; + pv_game_edit_effect edit_effect; + uint32_t camera_auth_3d_uid; int32_t field_2D874; - bool field_2D878; + bool task_effect_init; int32_t field_2D87C; size_t current_field; - std::vector field_data; - int8_t field_2D8A0; + std::vector field_data; + bool field_2D8A0; int32_t field_2D8A4; std::map auth_3d_time; std::map light_time; @@ -469,16 +770,16 @@ struct pv_game_data { int32_t field_2D954; std::string itmpv_string; std::vector itmpv_auth_3d_uids; - std::map itmpv[6]; - std::vector field_2D9F0; - struc_78 field_2DA08[3]; + std::map itmpv[6]; + std::vector itmpv_uids; + struc_269 field_2DA08[3]; std::vector loaded_auth_3d_uids; - int8_t field_2DAC8; + bool field_2DAC8; int32_t field_2DACC; std::vector auth_3d_categories; - std::map auth_3d; - std::vector chreff_auth_3d; - std::vector chreff_auth_3d_obj; + std::map auth_3d; + std::vector chreff_auth_3d; + std::vector chreff_auth_3d_obj; int8_t field_2DB28; vec2 field_2DB2C; int32_t field_2DB34; @@ -501,11 +802,11 @@ struct pv_game { bool field_1; bool field_2; bool end_pv; - int32_t field_4; + bool field_4; int32_t state; int32_t field_C; int32_t pv_id; - int32_t field_14; + bool field_14; int32_t modules[6]; rob_chara_pv_data_item items[6]; pv_game_item_mask items_mask[6]; @@ -513,6 +814,13 @@ struct pv_game { pv_game(); ~pv_game(); + + void ctrl(); + void disp(); + std::string get_effect_se_file_name(); + void load(); + void reset(); + bool unload(); }; struct pv_game_init_data { diff --git a/src/ReDIVA/x_pv_game.cpp b/src/ReDIVA/x_pv_game.cpp index f3bcacfd..e65ab618 100644 --- a/src/ReDIVA/x_pv_game.cpp +++ b/src/ReDIVA/x_pv_game.cpp @@ -1640,7 +1640,7 @@ void x_pv_game_music::ctrl(float_t delta_time) { if (no_fade && !pause) { no_fade_remain -= delta_time; if (no_fade_remain <= 0.0f) { - fade_out.enable = 1; + fade_out.enable = true; fade_out.start = get_volume(0); fade_out.value = 0; fade_out.time = fade_out_time_req; @@ -1659,8 +1659,8 @@ void x_pv_game_music::ctrl(float_t delta_time) { if (fade_in.remain > 0.0f) { int32_t value = fade_in.value; if (fade_in.time > 0.0) - value = (int32_t)(value - ((float_t)(value - - fade_in.start) * (fade_in.remain / fade_in.time))); + value = (int32_t)((float_t)value - (float_t)(value + - fade_in.start) * (fade_in.remain / fade_in.time)); set_volume_map(0, value); } else @@ -1681,11 +1681,12 @@ void x_pv_game_music::ctrl(float_t delta_time) { } if (flags & X_PV_GAME_MUSIC_OGG) { - if (ogg->playback->GetFileState() == OGG_FILE_HANDLER_FILE_STATE_STOPPED) - ogg->playback->Stop(); - if (ogg->playback->GetFileState() == OGG_FILE_HANDLER_FILE_STATE_STOPPED) + OggPlayback* playback = ogg->playback; + if (playback->GetFileState() == OGG_FILE_HANDLER_FILE_STATE_STOPPED) + playback->Stop(); + if (playback->GetFileState() == OGG_FILE_HANDLER_FILE_STATE_STOPPED) play_or_stop(); - ogg->playback->SetChannelPairVolumePan(ogg->playback); + OggPlayback::SetChannelPairVolumePan(playback); } } @@ -1702,6 +1703,7 @@ void x_pv_game_music::fade_in_end() { fade_in.enable = false; fade_in.remain = 0.0f; set_volume_map(0, fade_in.value); + switch (fade_in.action) { case X_PV_GAME_MUSIC_ACTION_STOP: stop(); @@ -1722,6 +1724,7 @@ void x_pv_game_music::fade_out_end() { fade_out.enable = false; fade_out.remain = 0.0f; set_volume_map(0, fade_out.value); + switch (fade_out.action) { case X_PV_GAME_MUSIC_ACTION_STOP: stop(); @@ -1736,7 +1739,7 @@ void x_pv_game_music::fade_out_end() { } void x_pv_game_music::file_load(int32_t type, std::string&& file_path, bool play_on_end, - float_t start, float end, float fade_in_time, float_t fade_out_time, bool a9) { + float_t start, float_t end, float_t fade_in_time, float_t fade_out_time, bool a9) { this->type = type; this->file_path.assign(file_path); this->start = start; @@ -1823,20 +1826,21 @@ int32_t x_pv_game_music::ogg_load(std::string&& file_path, float_t start) { start = max_def(start, 0.0f); - OggFileHandlerFileState file_state = ogg->playback->GetFileState(); - OggFileHandlerPauseState pause_state = ogg->playback->GetPauseState(); + OggPlayback* playback = ogg->playback; + + OggFileHandlerFileState file_state = playback->GetFileState(); + OggFileHandlerPauseState pause_state = playback->GetPauseState(); if (!check_args(4, std::string(file_path), start) || file_state != OGG_FILE_HANDLER_FILE_STATE_PLAYING || pause_state != OGG_FILE_HANDLER_PAUSE_STATE_PAUSE) { - ogg->playback->Stop(); - ogg->playback->SetLoadTimeSeek(start); - ogg->playback->SetPath(file_path); - ogg->playback->SetPauseState(OGG_FILE_HANDLER_PAUSE_STATE_PLAY); + playback->Stop(); + playback->SetLoadTimeSeek(start); + playback->SetPath(file_path); } - else - ogg->playback->SetPauseState(OGG_FILE_HANDLER_PAUSE_STATE_PLAY); - this->file_path.assign(file_path); + + playback->SetPauseState(OGG_FILE_HANDLER_PAUSE_STATE_PLAY); + ogg->file_path.assign(file_path); loaded = true; return 0; } @@ -1862,7 +1866,7 @@ int32_t x_pv_game_music::play() { } int32_t x_pv_game_music::play(int32_t type, std::string&& file_path, bool play_on_end, - float_t start, float end, float fade_in_time, float_t fade_out_time, bool a9) { + float_t start, float_t end, float_t fade_in_time, float_t fade_out_time, bool a9) { set_volume_map(0, 100); if (type == 4 && ogg_load(std::string(file_path), start) < 0) return -7; @@ -1969,23 +1973,26 @@ int32_t x_pv_game_music::set_ogg_args(std::string&& file_path, float_t start, bo start = max_def(start, 0.0f); - OggFileHandlerFileState file_state = ogg->playback->GetFileState(); - OggFileHandlerPauseState pause_state = ogg->playback->GetPauseState(); + OggPlayback* playback = ogg->playback; + + OggFileHandlerFileState file_state = playback->GetFileState(); + OggFileHandlerPauseState pause_state = playback->GetPauseState(); if (!check_args(4, std::string(file_path), start) || file_state != OGG_FILE_HANDLER_FILE_STATE_PLAYING || pause_state != OGG_FILE_HANDLER_PAUSE_STATE_PAUSE) { - ogg->playback->Stop(); - ogg->playback->SetLoadTimeSeek(start); - ogg->playback->SetPath(file_path); - ogg->playback->SetPauseState(OGG_FILE_HANDLER_PAUSE_STATE_PAUSE); + playback->Stop(); + playback->SetLoadTimeSeek(start); + playback->SetPath(file_path); + playback->SetPauseState(OGG_FILE_HANDLER_PAUSE_STATE_PAUSE); ogg->file_path.assign(file_path); + if (wait_load) { - OggFileHandlerFileState file_state = ogg->playback->GetFileState(); + OggFileHandlerFileState file_state = playback->GetFileState(); while (file_state != OGG_FILE_HANDLER_FILE_STATE_PLAYING && file_state != OGG_FILE_HANDLER_FILE_STATE_STOPPED && file_state != OGG_FILE_HANDLER_FILE_STATE_MAX) - file_state = ogg->playback->GetFileState(); + file_state = playback->GetFileState(); } } return 0; @@ -1995,8 +2002,9 @@ int32_t x_pv_game_music::set_ogg_pause_state(uint8_t pause_state) { if (!(flags & X_PV_GAME_MUSIC_OGG)) return -2; - if (ogg->playback->GetFileState() == OGG_FILE_HANDLER_FILE_STATE_PLAYING) - ogg->playback->SetPauseState((OggFileHandlerPauseState)pause_state); + OggPlayback* playback = ogg->playback; + if (playback->GetFileState() == OGG_FILE_HANDLER_FILE_STATE_PLAYING) + playback->SetPauseState((OggFileHandlerPauseState)pause_state); return 0; } @@ -2625,7 +2633,7 @@ void x_pv_game_stage_env::reset_env() { env_index = -1; } -static const float env_aet_opacity = 0.65f; +static const float_t env_aet_opacity = 0.65f; #pragma warning(push) #pragma warning(disable: 6385) @@ -4229,22 +4237,22 @@ bool x_pv_game::Ctrl() { light_auth_3d_id = {}; { data_struct* aft_data = &data_list[DATA_AFT]; - auth_3d_database* auth_3d_db = &aft_data->data_ft.auth_3d_db; + auth_3d_database* aft_auth_3d_db = &aft_data->data_ft.auth_3d_db; char buf[0x200]; sprintf_s(buf, sizeof(buf), "STGPV%03d_EFF_LT_000", pv_data[pv_index].pv_id == 832 ? 800 : pv_data[pv_index].pv_id); uint32_t light_auth_3d_hash = hash_utf8_murmurhash(buf); - for (auth_3d_database_uid& i : auth_3d_db->uid) + for (auth_3d_database_uid& i : aft_auth_3d_db->uid) if (hash_string_murmurhash(i.name) == light_auth_3d_hash) { light_auth_3d_id = auth_3d_data_load_uid( - (int32_t)(&i - auth_3d_db->uid.data()), auth_3d_db); + (int32_t)(&i - aft_auth_3d_db->uid.data()), aft_auth_3d_db); if (!light_auth_3d_id.check_not_empty()) { light_auth_3d_id = {}; break; } - light_auth_3d_id.read_file(auth_3d_db); + light_auth_3d_id.read_file(aft_auth_3d_db); light_auth_3d_id.set_enable(false); light_auth_3d_id.set_visibility(false); break; @@ -4264,7 +4272,7 @@ bool x_pv_game::Ctrl() { x_pv_game_dsc_data& dsc_data = pv_data[pv_index].dsc_data; - app::TaskWork::AddTask(&pv_param_task::post_process_task, "PV POST PROCESS TASK"); + pv_param_task::post_process_task_add_task(); { data_struct* x_data = &data_list[DATA_X]; @@ -5685,7 +5693,7 @@ bool x_pv_game::Unload() { i = 0; Glitter::glt_particle_manager->draw_all = true; - pv_param_task::post_process_task.DelTask(); + pv_param_task::post_process_task_del_task(); return true; } @@ -5800,6 +5808,13 @@ XPVGameSelector::XPVGameSelector() : charas(), modules(), start(), exit() { for (int32_t& i : modules) i = 0; + pv_id = 816; + stage_id = 16; + + charas[0] = CHARA_LEN; + + modules[0] = 0; + #if BAKE_PV826 pv_id = 826; stage_id = 26; @@ -7117,29 +7132,17 @@ static bool x_pv_game_dsc_process(x_pv_game* a1, int64_t curr_time) { int32_t id = (int32_t)data[0]; float_t duration = (float_t)(int32_t)data[1]; - pv_param::bloom& bloom_data = pv_param::post_process_data_get_bloom_data(id); - - pv_param_task::PostProcessCtrlBloom& bloom - = pv_param_task::post_process_task.bloom; - bloom.frame = 0.0f; - bloom.duration = duration; - bloom.data.data = bloom_data; + pv_param_task::post_process_task_set_bloom_data( + pv_param::post_process_data_get_bloom_data(id), duration); } break; case DSC_X_COLOR_CORRECTION: { int32_t enable = (int32_t)data[0]; int32_t id = (int32_t)data[1]; float_t duration = (float_t)(int32_t)data[2]; - if (enable == 1) { - pv_param::color_correction& cc_data - = pv_param::post_process_data_get_color_correction_data(id); - - pv_param_task::PostProcessCtrlCC& cc - = pv_param_task::post_process_task.cc; - cc.frame = 0.0f; - cc.duration = duration; - cc.data.data = cc_data; - } + if (enable == 1) + pv_param_task::post_process_task_set_color_correction_data( + pv_param::post_process_data_get_color_correction_data(id), duration); } break; case DSC_X_DOF: { int32_t enable = (int32_t)data[0]; @@ -7147,15 +7150,9 @@ static bool x_pv_game_dsc_process(x_pv_game* a1, int64_t curr_time) { float_t duration = (float_t)(int32_t)data[2]; rctx_ptr->post_process.dof->data.pv.enable = enable == 1; - if (enable == 1) { - pv_param::dof& dof_data = pv_param::post_process_data_get_dof_data(id); - - pv_param_task::PostProcessCtrlDof& dof - = pv_param_task::post_process_task.dof; - dof.frame = 0.0f; - dof.duration = duration; - dof.data.data = dof_data; - } + if (enable == 1) + pv_param_task::post_process_task_set_dof_data( + pv_param::post_process_data_get_dof_data(id), duration); } break; case DSC_X_CHARA_ALPHA: { a1->chara_id = (int32_t)data[0]; @@ -7164,16 +7161,9 @@ static bool x_pv_game_dsc_process(x_pv_game* a1, int64_t curr_time) { float_t duration = (float_t)(int32_t)data[2]; int32_t type = (int32_t)data[3]; - if (a1->chara_id >= 0 && a1->chara_id < ROB_CHARA_COUNT) { - pv_param_task::PostProcessCtrlCharaAlpha& chara_alpha - = pv_param_task::post_process_task.chara_alpha; - pv_param::chara_alpha& chara_alpha_data = chara_alpha.data.data[a1->chara_id]; - chara_alpha_data.type = type; - chara_alpha_data.frame = 0.0f; - chara_alpha_data.alpha = alpha; - chara_alpha_data.duration = duration * 2.0f; - } - + if (a1->chara_id >= 0 && a1->chara_id < ROB_CHARA_COUNT) + pv_param_task::post_process_task_set_chara_alpha( + a1->chara_id, type, alpha, duration * 2.0f); } break; case DSC_X_AUTO_CAPTURE_BEGIN: { @@ -7195,17 +7185,9 @@ static bool x_pv_game_dsc_process(x_pv_game* a1, int64_t curr_time) { int32_t type = (int32_t)data[3]; if (a1->chara_id >= 0 && a1->chara_id < ROB_CHARA_COUNT) { - pv_param_task::PostProcessCtrlCharaItemAlpha& chara_item_alpha - = pv_param_task::post_process_task.chara_item_alpha; - - pv_param::chara_alpha& chara_item_alpha_data = chara_item_alpha.data.data[a1->chara_id]; - chara_item_alpha_data.type = type; - chara_item_alpha_data.frame = 0.0f; - chara_item_alpha_data.alpha = alpha; - chara_item_alpha_data.duration = duration * 2.0f; - - chara_item_alpha.callback[a1->chara_id] = x_pv_game_chara_item_alpha_callback; - chara_item_alpha.callback_data[a1->chara_id] = a1; + pv_param_task::post_process_task_set_chara_item_alpha( + a1->chara_id, type, alpha, duration * 2.0f, + x_pv_game_chara_item_alpha_callback, a1); } } break; case DSC_X_MOVIE_CUT: { @@ -8495,63 +8477,91 @@ void material_list_data::optimize() { if (type < 2) return; - kft3* keys = morph.data(); - size_t length = morph.size(); + while (true) { + std::vector color(this->color); + std::vector morph(this->morph); - if (color.size() > 2) - for (size_t i = 0; i < length - 2; i++) - for (size_t j = i + 2; j < length; ) { - size_t count = j - i; - if (j + count >= length) - break; + kft3* keys = morph.data(); + size_t length = morph.size(); + if (color.size() > 1) { + auto i_begin = color.begin(); + auto i_end = color.end() - 1; - material_list_color* color_data = color.data(); - bool equal = true; - for (size_t k = 0, l = count; k <= count; k++, l++) - if (memcmp(&color_data[(int32_t)keys[i + k].value], - &color_data[(int32_t)keys[i + l].value], - sizeof(material_list_color))) { - equal = false; - break; - } - - if (!equal) { - j++; - continue; + for (auto i = i_begin; i != i_end;) + if (!memcmp(&i[0], &i[1], sizeof(material_list_color))) { + float_t value = (float_t)(int32_t)(i - i_begin + 1); + for (size_t k = i - i_begin + 1; k < length; k++) + if (keys[k].value >= value) + keys[k].value -= 1.0f; + i = color.erase(i); + i_begin = color.begin(); + i_end = color.end() - 1; } + else + i++; + } - morph.insert(morph.begin() + j, morph.data()[j]); + if (morph.size() > 1) { + if (length > 1 && *(uint32_t*)&keys[0].frame != *(uint32_t*)&keys[1].frame + && *(uint32_t*)&keys[0].value == *(uint32_t*)&keys[1].value) { + morph.erase(morph.begin()); keys = morph.data(); length = morph.size(); - - float_t start_value = keys[j].value - keys[j - count].value; - for (size_t k = j + 1; k < length; k++) - keys[k].value -= start_value; - - auto elem = color.begin() + ((size_t)(int32_t)start_value + 1); - color.erase(elem, elem + count); - break; } - if (color.size() > 1) { - auto i_begin = color.begin(); - auto i_end = color.end() - 1; - - for (auto i = i_begin; i != i_end;) - if (!memcmp(&i[0], &i[1], sizeof(material_list_color))) { - float_t value = (float_t)(int32_t)(i - i_begin + 1); - for (size_t k = i - i_begin + 1; k < length; k++) - if (keys[k].value >= value) - keys[k].value -= 1.0f; - i = color.erase(i); - i_end = color.end() - 1; + if (length > 1 && *(uint32_t*)&keys[length - 2].frame != *(uint32_t*)&keys[length - 1].frame + && *(uint32_t*)&keys[length - 2].value == *(uint32_t*)&keys[length - 1].value) { + morph.erase(morph.end() - 1); + keys = morph.data(); + length = morph.size(); } - else - i++; - } + } + + if (color.size() > 2) + for (size_t i = 0; i < length - 2; i++) + for (size_t j = i + 2; j < length; ) { + size_t count = j - i; + if (j + count >= length) + break; + + material_list_color* color_data = color.data(); + bool equal = true; + for (size_t k = 0, l = count; k <= count; k++, l++) + if (memcmp(&color_data[(int32_t)keys[i + k].value], + &color_data[(int32_t)keys[i + l].value], + sizeof(material_list_color))) { + equal = false; + break; + } + + if (!equal) { + j++; + continue; + } + + bool smaller_value = false; + for (size_t k = 0; k < count * 2; k++) + if (keys[i + k].value > keys[i + k + 1].value) { + smaller_value = true; + break; + } + + if (smaller_value) + break; + + morph.insert(morph.begin() + j, morph.data()[j]); + keys = morph.data(); + length = morph.size(); + + float_t start_value = keys[j].value - keys[j - count].value; + for (size_t k = j + 1; k < length; k++) + keys[k].value -= start_value; + + auto elem = color.begin() + ((size_t)(int32_t)start_value + 1); + color.erase(elem, elem + count); + break; + } - while (color.size() > 2) { - bool optimized = false; for (size_t i = 0; i < length - 1; i++) for (size_t j = i + 1; j < length; j++) { size_t count = j - i; @@ -8574,26 +8584,25 @@ void material_list_data::optimize() { float_t start_value = keys[i].value; float_t end_value = keys[i + count * 2].value; - for (size_t k = 1, l = count - 1; k <= count; k++, l--) { - keys[i + k + 0].tangent2 = -keys[i + k + 0].tangent2; - keys[i + k + 1].value = (float_t)(int32_t)l + start_value; - keys[i + k + 1].tangent1 = -keys[i + k + 1].tangent1; + if (*(uint32_t*)&start_value == *(uint32_t*)&end_value) + break; + else if (i + count * 2 + 1 < length + && *(uint32_t*)&keys[i + count * 2].frame != *(uint32_t*)&keys[i + count * 2 + 1].frame) + break; + + for (size_t k = count, l = count - 1; k < count * 2; k++, l--) { + if (keys[i + k].value < keys[i + k + 1].value && keys[i + l + 1].value > keys[i + l].value + || keys[i + k].value > keys[i + k + 1].value && keys[i + l + 1].value < keys[i + l].value) { + keys[i + k + 0].tangent2 = -keys[i + k + 0].tangent2; + keys[i + k + 1].tangent1 = -keys[i + k + 1].tangent1; + } + keys[i + k + 1].value = keys[i + l].value; } - if (i + count * 2 + 1 == length) - color.erase(color.begin() + (int32_t)end_value); - i += count * 2; - optimized = true; break; } - if (!optimized) - break; - } - - while (color.size() > 2) { - bool optimized = false; for (size_t i = 0; i < length - 1; i++) for (size_t j = i + 1; j < length; j++) { size_t count = j - i; @@ -8616,22 +8625,81 @@ void material_list_data::optimize() { float_t start_value = keys[i].value; float_t end_value = keys[i + count * 2 + 1].value; - for (size_t k = 1, l = count - 1; k <= count; k++, l--) { - keys[i + k + 1].tangent2 = -keys[i + k + 0].tangent2; - keys[i + k + 2].value = (float_t)(int32_t)l + start_value; - keys[i + k + 2].tangent1 = -keys[i + k + 1].tangent1; + if (*(uint32_t*)&start_value == *(uint32_t*)&end_value) + break; + else if (i + count * 2 + 2 < length + && *(uint32_t*)&keys[i + count * 2 + 1].frame != *(uint32_t*)&keys[i + count * 2 + 2].frame) + break; + + for (size_t k = count, l = count - 1; k < count * 2; k++, l--) { + if (keys[i + k].value < keys[i + k + 1].value && keys[i + l + 1].value > keys[i + l].value + || keys[i + k].value > keys[i + k + 1].value && keys[i + l + 1].value < keys[i + l].value) { + keys[i + k + 1].tangent2 = -keys[i + k + 1].tangent2; + keys[i + k + 2].tangent1 = -keys[i + k + 2].tangent1; + } + keys[i + k + 2].value = keys[i + l].value; } - if (i + count * 2 + 2 == length) - color.erase(color.begin() + (int32_t)end_value); - i += count * 2; - optimized = true; break; } - if (!optimized) - break; + int32_t max_value = 0; + for (kft3& i : morph) + max_value = max_def(max_value, (int32_t)i.value); + max_value++; + + if (max_value < color.size()) + color.resize(max_value); + + if (color.size() < this->color.size() || morph.size() < this->morph.size()) { + this->color.assign(color.begin(), color.end()); + this->morph.assign(morph.begin(), morph.end()); + continue; + } + break; + } + + if (color.size() > 2) { + material_list_color* color_data = color.data(); + size_t color_length = color.size(); + + kft3* keys = morph.data(); + size_t length = morph.size(); + for (size_t i = 0, j = 2; j < color_length; i++, j++) { + if (memcmp(&color_data[i], &color_data[j], sizeof(material_list_color))) + continue; + + float_t src_value = (float_t)(int32_t)j; + float_t dst_value = (float_t)(int32_t)i; + bool removed = false; + for (size_t k = 0, l = 1, m = 2; l < length; k++, l++, m++) { + if (*(uint32_t*)&keys[l].value != *(uint32_t*)&src_value) + continue; + + keys[k].tangent2 = -keys[k].tangent2; + keys[l].tangent1 = -keys[l].tangent1; + keys[l].value = dst_value; + if (m < length) { + keys[l].tangent2 = -keys[l].tangent2; + keys[m].tangent1 = -keys[m].tangent1; + } + removed = true; + } + + if (removed) { + color.erase(color.begin() + (i + 2)); + color_length = color.size(); + } + } + + int32_t max_value = 0; + for (kft3& i : morph) + max_value = max_def(max_value, (int32_t)i.value); + max_value++; + + if (max_value < color.size()) + color.resize(max_value); } if (morph.size() > 1) { @@ -8643,6 +8711,7 @@ void material_list_data::optimize() { && *(uint32_t*)&i[0].value == *(uint32_t*)&i[1].value) { i[1].tangent1 = i[0].tangent1; i = morph.erase(i); + i_begin = morph.begin(); i_end = morph.end() - 1; } else @@ -9105,6 +9174,8 @@ static void x_pv_game_split_auth_3d_material_list(x_pv_game* xpvgm, stage_data_effect_auth_3ds.sort_unique(); stage_data_change_effect_auth_3ds.sort_unique(); + printf_debug(""); + for (auto& i : stage_data_effect_auth_3ds) { auth_3d* auth = i.first.get_auth_3d(); diff --git a/src/ReDIVA/x_pv_game.hpp b/src/ReDIVA/x_pv_game.hpp index 28f1186d..a51d7d73 100644 --- a/src/ReDIVA/x_pv_game.hpp +++ b/src/ReDIVA/x_pv_game.hpp @@ -424,7 +424,7 @@ struct x_pv_game_music { void fade_in_end(); void fade_out_end(); void file_load(int32_t type, std::string&& file_path, bool play_on_end, - float_t start, float end, float fade_in_time, float_t fade_out_time, bool a9); + float_t start, float_t end, float_t fade_in_time, float_t fade_out_time, bool a9); int32_t get_master_volume(int32_t index); int32_t get_volume(int32_t index); int32_t include_flags(x_pv_game_music_flags flags); @@ -436,7 +436,7 @@ struct x_pv_game_music { int32_t ogg_stop(); int32_t play(); int32_t play(int32_t type, std::string&& file_path, bool play_on_end, - float_t start, float end, float fade_in_time, float_t fade_out_time, bool a9); + float_t start, float_t end, float_t fade_in_time, float_t fade_out_time, bool a9); void play_fade_in(int32_t type, std::string&& file_path, float_t start, float_t end, bool play_on_end, bool a7, float_t fade_out_time, bool a10); int32_t play_or_stop();