diff --git a/src/CRE/GL/uniform_buffer.hpp b/src/CRE/GL/uniform_buffer.hpp index ff0ca664..36fb7256 100644 --- a/src/CRE/GL/uniform_buffer.hpp +++ b/src/CRE/GL/uniform_buffer.hpp @@ -44,7 +44,7 @@ namespace GL { } } - + inline void Create(size_t size, const void* data) { if (buffer) return; diff --git a/src/CRE/Glitter/curve.cpp b/src/CRE/Glitter/curve.cpp index 4ecf2135..77449716 100644 --- a/src/CRE/Glitter/curve.cpp +++ b/src/CRE/Glitter/curve.cpp @@ -24,7 +24,7 @@ namespace Glitter { this->value = value; this->random_range = random_range; } - + Curve::Key::Key(KeyType type, int32_t frame, float_t value, float_t tangent1, float_t tangent2, float_t random_range) { this->type = type; diff --git a/src/CRE/Glitter/particle_inst.cpp b/src/CRE/Glitter/particle_inst.cpp index 81a6ec02..7098e1bf 100644 --- a/src/CRE/Glitter/particle_inst.cpp +++ b/src/CRE/Glitter/particle_inst.cpp @@ -206,8 +206,8 @@ namespace Glitter { rend_elem->rot_z_sin = 0.0f; rend_elem->rotation.z = random->F2GetFloat(GLT_VAL, ptcl_inst_data->data.rotation_random.z) + ptcl_inst_data->data.rotation.z; - rend_elem->rotation_add.z = random->F2GetFloat(GLT_VAL, - ptcl_inst_data->data.rotation_add_random.z) + ptcl_inst_data->data.rotation_add.z; + rend_elem->rotation_add.z = random->F2GetFloat(GLT_VAL, ptcl_inst_data->data.rotation_add_random.z) + + ptcl_inst_data->data.rotation_add.z; rend_elem->uv_scroll = 0.0f; rend_elem->uv_scroll_2nd = 0.0f; rend_elem->scale = 1.0f; @@ -220,7 +220,7 @@ namespace Glitter { rend_elem->scale_particle.y = rend_elem->scale_particle.x; else rend_elem->scale_particle.y = random->F2GetFloat(GLT_VAL, ptcl_inst_data->data.scale_random.y) - + ptcl_inst_data->data.scale.y; + + ptcl_inst_data->data.scale.y; int32_t max_uv = ptcl_inst_data->data.split_u * ptcl_inst_data->data.split_v; if (max_uv > 1 && ptcl_inst_data->data.uv_index_count > 1) { @@ -693,7 +693,7 @@ namespace Glitter { } else rend_elem->scale_particle.y = random->XGetFloat(ptcl_inst_data->data.scale_random.y) - + ptcl_inst_data->data.scale.y; + + ptcl_inst_data->data.scale.y; int32_t max_uv = ptcl_inst_data->data.split_u * ptcl_inst_data->data.split_v; if (max_uv > 1 && ptcl_inst_data->data.uv_index_count > 1) { diff --git a/src/CRE/auth_2d.cpp b/src/CRE/auth_2d.cpp index f8e70bd4..e2b2da65 100644 --- a/src/CRE/auth_2d.cpp +++ b/src/CRE/auth_2d.cpp @@ -916,7 +916,7 @@ void AetObj::Init(AetArgs& args, const aet_scene* scene, const aet_comp* comp, c const aet_marker* start_marker, const aet_marker* end_marker, resolution_mode mode) { start_time = scene->start_time; end_time = scene->end_time - 1.0f; - + if (layer) { start_time = layer->start_time; end_time = layer->end_time - 1.0f; @@ -1196,7 +1196,7 @@ void AetObj::CtrlLayer(const aet_layer* layer, float_t frame) { if (frame != 0.0f) return; - + std::string file(layer->name); auto elem = sound_replace.find(file); if (elem != sound_replace.end()) @@ -1505,7 +1505,7 @@ AetLyo::~AetLyo() { } void AetLyo::CtrlLayer(const aet_layer* layer, float_t frame) { - + } void AetLyo::DispLayer(const mat4& mat, const aet_layer* layer, diff --git a/src/CRE/auth_3d.hpp b/src/CRE/auth_3d.hpp index 5873db88..ec855898 100644 --- a/src/CRE/auth_3d.hpp +++ b/src/CRE/auth_3d.hpp @@ -796,7 +796,7 @@ struct auth_3d_id { inline auth_3d_id() { id = -1; } - + inline auth_3d_id(int32_t id) { this->id = id; } @@ -804,7 +804,7 @@ struct auth_3d_id { inline bool is_null() { return id == -1; } - + inline bool not_null() { return id != -1; } diff --git a/src/CRE/hand_item.cpp b/src/CRE/hand_item.cpp index 08c8e356..75da6584 100644 --- a/src/CRE/hand_item.cpp +++ b/src/CRE/hand_item.cpp @@ -131,7 +131,7 @@ bool hand_item_handler::load() { i = 0; } file_handlers.clear(); - + loaded = true; return false; } diff --git a/src/CRE/item_table.cpp b/src/CRE/item_table.cpp index cd5ee650..607a2041 100644 --- a/src/CRE/item_table.cpp +++ b/src/CRE/item_table.cpp @@ -135,7 +135,7 @@ bool item_table_handler_array_load() { bool ret = false; for (int32_t i = CHARA_MIKU; i < CHARA_MAX; i++) ret |= item_table_handler_array[i].load(); - return ret; + return ret; } void item_table_handler_array_read() { @@ -187,7 +187,7 @@ bool item_table_handler::load() { i = 0; } file_handlers.clear(); - + loaded = true; return false; } diff --git a/src/CRE/light_param/light.cpp b/src/CRE/light_param/light.cpp index d62c1463..13a0f490 100644 --- a/src/CRE/light_param/light.cpp +++ b/src/CRE/light_param/light.cpp @@ -345,7 +345,7 @@ void light_set::data_set(face& face, light_set_id id) { lights[LIGHT_CHARA].get_diffuse(obj_scene.g_light_env_chara_diffuse); lights[LIGHT_CHARA].get_ambient(obj_scene.g_light_env_chara_ambient); lights[LIGHT_CHARA].get_specular(obj_scene.g_light_env_chara_specular); - + lights[LIGHT_REFLECT].get_diffuse(obj_scene.g_light_env_reflect_diffuse); lights[LIGHT_REFLECT].get_ambient(obj_scene.g_light_env_reflect_ambient); diff --git a/src/CRE/render_context.hpp b/src/CRE/render_context.hpp index d2a2425a..c967b549 100644 --- a/src/CRE/render_context.hpp +++ b/src/CRE/render_context.hpp @@ -69,7 +69,7 @@ namespace mdl { OBJ_KIND_TRANSLUCENT, OBJ_KIND_MAX, }; - + enum ObjFlags : uint32_t { OBJ_SHADOW = 0x00000001, OBJ_2 = 0x00000002, @@ -357,10 +357,10 @@ namespace mdl { vec4 color; bool fog; Data data; - + void init(EtcObjType type); }; - + typedef void(*UserArgsFunc)(render_context* rctx, void* data); struct UserArgs { @@ -372,7 +372,7 @@ namespace mdl { uint32_t count; ObjSubMeshArgs* sub_mesh[40]; }; - + struct ObjData { union Args { ObjSubMeshArgs sub_mesh; diff --git a/src/CRE/render_manager.cpp b/src/CRE/render_manager.cpp index d530516c..1bab0ce1 100644 --- a/src/CRE/render_manager.cpp +++ b/src/CRE/render_manager.cpp @@ -841,7 +841,7 @@ namespace rndr { gl_state_enable_depth_test(); gl_state_disable_blend(); } - + void RenderManager::pass_sprite_fg_surf(render_context* rctx) { if (!sprite_manager_get_reqlist_count(1)) return; @@ -1555,7 +1555,7 @@ static void blur_filter_apply(render_context* rctx, GLuint dst, GLuint src, filter_scene.g_transform = { w, h, 0.0f, 0.0f }; filter_scene.g_texcoord = { 1.0f, 1.0f, 0.0f, 0.0f }; rctx->filter_scene_ubo.WriteMapMemory(filter_scene); - + imgfilter_batch_shader_data imgfilter_batch = {}; if (filter == BLUR_FILTER_32) imgfilter_batch.g_color_scale = scale * (float_t)(1.0 / 8.0); diff --git a/src/CRE/rob/rob.cpp b/src/CRE/rob/rob.cpp index 2bd03ea2..06e7b434 100644 --- a/src/CRE/rob/rob.cpp +++ b/src/CRE/rob/rob.cpp @@ -329,7 +329,7 @@ struct rob_chara_age_age_object { void load(object_info obj_info, int32_t count); void reset(); void update(rob_chara_age_age_data* data, int32_t count, float_t alpha); - + static obj_bounding_sphere combine_bounding_spheres( obj_bounding_sphere* src0, obj_bounding_sphere* src1); }; @@ -2263,7 +2263,7 @@ void rob_free() { delete[] rob_chara_age_age_array; rob_chara_age_age_array = 0; } - + if (pv_osage_manager_array) { delete[] pv_osage_manager_array; pv_osage_manager_array = 0; @@ -6937,21 +6937,24 @@ static void sub_1405077D0(rob_chara* rob_chr, bone_database* bone_data, motion_d } } -static bool sub_140419E90(rob_chara_bone_data* rob_bone_data) { - mot_play_data* v2 = &rob_bone_data->motion_loaded.front()->mot_play_data; - if (v2->loop_frames_enabled) - return v2->loop_frames <= 0.0f; - else if (v2->frame_data.loop_state >= MOT_PLAY_FRAME_DATA_LOOP_ONCE - && v2->frame_data.loop_state <= MOT_PLAY_FRAME_DATA_LOOP_REVERSE) +static bool sub_140413710(mot_play_data* a1) { + if (a1->loop_frames_enabled) + return a1->loop_frames <= 0.0f; + else if (a1->frame_data.loop_state >= MOT_PLAY_FRAME_DATA_LOOP_ONCE + && a1->frame_data.loop_state <= MOT_PLAY_FRAME_DATA_LOOP_REVERSE) return false; - else if (v2->frame_data.playback_state == MOT_PLAY_FRAME_DATA_PLAYBACK_FORWARD) - return v2->frame_data.last_frame < v2->frame_data.frame; - else if (v2->frame_data.playback_state == MOT_PLAY_FRAME_DATA_PLAYBACK_BACKWARD) - return v2->frame_data.frame < 0.0f; + else if (a1->frame_data.playback_state == MOT_PLAY_FRAME_DATA_PLAYBACK_FORWARD) + return a1->frame_data.last_frame < a1->frame_data.frame; + else if (a1->frame_data.playback_state == MOT_PLAY_FRAME_DATA_PLAYBACK_BACKWARD) + return a1->frame_data.frame < 0.0f; else return false; } +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) { switch (rob_chr->data.field_1588.field_0.field_58) { case -1: { @@ -9826,6 +9829,7 @@ static void sub_14041B1C0(struc_313* a1) { for (uint32_t i = MOTION_BONE_N_EYELID_L_A; i <= MOTION_BONE_TL_EYELID_R_B_WJ; i++) bitfield[i >> 5] &= ~(1 << (i & 0x1F)); + sub_14041B440(a1); } static void sub_14041B6B0(struc_313* a1) { diff --git a/src/CRE/sprite.cpp b/src/CRE/sprite.cpp index 217a1b5f..a67f6e18 100644 --- a/src/CRE/sprite.cpp +++ b/src/CRE/sprite.cpp @@ -868,14 +868,14 @@ namespace spr { if (set) set->ReadFile(file, mdata_dir, data); } - + void SpriteManager::ReadFile(int32_t index, const char* file, std::string&& mdata_dir, void* data) { SprSet* set = GetSet(index); if (set) set->ReadFile(file, mdata_dir, data); } - + void SpriteManager::ResetIndex() { index = 0; } diff --git a/src/CRE/task.cpp b/src/CRE/task.cpp index 7e5c9e96..d77aa13a 100644 --- a/src/CRE/task.cpp +++ b/src/CRE/task.cpp @@ -122,7 +122,7 @@ namespace app { Task_set_request(this, Task::Request::Run); return true; } - + bool Task::SuspendTask() { if (!TaskWork::HasTask(this) || !Task_check_request(this, Task::Request::Suspend)) return false; diff --git a/src/CRE/task.hpp b/src/CRE/task.hpp index c0e07cb0..52729b7e 100644 --- a/src/CRE/task.hpp +++ b/src/CRE/task.hpp @@ -39,7 +39,7 @@ namespace app { Hide, Run, }; - + enum class State { None = 0, Running, diff --git a/src/CRE/task_effect.cpp b/src/CRE/task_effect.cpp index 7991c861..9eb99040 100644 --- a/src/CRE/task_effect.cpp +++ b/src/CRE/task_effect.cpp @@ -1477,7 +1477,7 @@ void TaskEffectLitproj::SetStageIndices(std::vector& stage_indices) { texture_database* aft_tex_db = &aft_data->data_ft.tex_db; stage_param_data_litproj_current = litproj; - + light_proj* _litproj = new light_proj(width, height); rctx_ptr->litproj = _litproj; _litproj->enable = true; @@ -2491,7 +2491,7 @@ void TaskEffectParent::SetStageIndices(std::vector& stage_indices) { } prj::sort_unique(obj_set_ids); - + for (uint32_t i : obj_set_ids) object_storage_load_set(aft_data, aft_obj_db, i); state = 1; diff --git a/src/KKdLib/interpolation.cpp b/src/KKdLib/interpolation.cpp index 8e7da8b2..d88818e4 100644 --- a/src/KKdLib/interpolation.cpp +++ b/src/KKdLib/interpolation.cpp @@ -253,7 +253,7 @@ int32_t interpolate_chs_reverse_sequence(std::vector& values_src, std:: } values.push_back({ (float_t)(int32_t)(start_time + (count - 1)), arr[count - 1], t2_old, 0.0f }); - + kft3* keys = values.data(); size_t length = values.size(); for (size_t i = 0; i < count; i++) { diff --git a/src/KKdLib/mot.cpp b/src/KKdLib/mot.cpp index a1ae0f20..4e965c9e 100644 --- a/src/KKdLib/mot.cpp +++ b/src/KKdLib/mot.cpp @@ -598,7 +598,7 @@ static void mot_modern_read_inner(mot_set* ms, prj::shared_ptrkey_set_count; mot_key_set_data* key_set_array = alloc->allocate(key_set_count); m->key_set_array = key_set_array; - + s_motc.set_position(mh.key_set_types_offset, SEEK_SET); for (uint32_t j = 0, b = 0; j < key_set_count; j++) { if (j % 8 == 0) diff --git a/src/KKdLib/prj/vector_pair.hpp b/src/KKdLib/prj/vector_pair.hpp index e9e06ce7..c666e55d 100644 --- a/src/KKdLib/prj/vector_pair.hpp +++ b/src/KKdLib/prj/vector_pair.hpp @@ -46,7 +46,7 @@ namespace prj { sort(); unique(); } - + inline typename auto find(T key) { auto k = this->begin(); size_t l = this->size(); diff --git a/src/KKdLib/prj/vector_pair_combine.hpp b/src/KKdLib/prj/vector_pair_combine.hpp index 43880faf..75811dc8 100644 --- a/src/KKdLib/prj/vector_pair_combine.hpp +++ b/src/KKdLib/prj/vector_pair_combine.hpp @@ -99,7 +99,7 @@ namespace prj { inline typename auto begin() { return data.begin(); } - + inline typename auto begin() const { return data.begin(); } @@ -111,7 +111,7 @@ namespace prj { inline typename auto end() { return data.end(); } - + inline typename auto end() const { return data.end(); } @@ -123,7 +123,7 @@ namespace prj { inline typename auto rbegin() { return data.rbegin(); } - + inline typename auto rbegin() const { return data.rbegin(); } @@ -135,7 +135,7 @@ namespace prj { inline typename auto rend() { return data.rend(); } - + inline typename auto rend() const { return data.rend(); } diff --git a/src/ReDIVA/classes/glitter_editor.cpp b/src/ReDIVA/classes/glitter_editor.cpp index 329721c1..9f2ed8a3 100644 --- a/src/ReDIVA/classes/glitter_editor.cpp +++ b/src/ReDIVA/classes/glitter_editor.cpp @@ -4345,9 +4345,11 @@ static bool glitter_editor_property_particle_texture(GlitterEditor* glt_edt, case Glitter::UV_INDEX_INITIAL_RANDOM_REVERSE: { LARGE_INTEGER time; QueryPerformanceCounter(&time); - uv_index += time.LowPart % particle->data.uv_index_count; + uv_index = particle->data.uv_index_start + + time.LowPart % particle->data.uv_index_count; } break; } + uv_index = min_def(uv_index, particle->data.uv_index_end); } } else if (particle->data.uv_index_type == Glitter::UV_INDEX_INITIAL_RANDOM_FIXED) { diff --git a/src/ReDIVA/data_test/auth_2d_test.cpp b/src/ReDIVA/data_test/auth_2d_test.cpp index 14532b05..a9bac27e 100644 --- a/src/ReDIVA/data_test/auth_2d_test.cpp +++ b/src/ReDIVA/data_test/auth_2d_test.cpp @@ -402,15 +402,15 @@ DtwAet::DtwAet() : Shell(0) { frame->AddSelectionListener(new dw::SelectionListenerOnHook(DtwAet::FrameCallback)); (new dw::Label(this))->SetName("SWITCH"); - + dw::Button* lock = new dw::Button(this, dw::CHECKBOX); lock->SetName("LOCK"); lock->callback = DtwAet::LockCallback; - + dw::Button* loop = new dw::Button(this, dw::CHECKBOX); loop->SetName("LOOP"); loop->callback = DtwAet::LoopCallback; - + dw::Button* centering = new dw::Button(this, dw::CHECKBOX); centering->SetName("CENTERING"); centering->callback = DtwAet::CenteringCallback; diff --git a/src/ReDIVA/data_test/auth_3d_test.cpp b/src/ReDIVA/data_test/auth_3d_test.cpp index 078fd1ca..caa529e9 100644 --- a/src/ReDIVA/data_test/auth_3d_test.cpp +++ b/src/ReDIVA/data_test/auth_3d_test.cpp @@ -555,7 +555,7 @@ void Auth3dTestWindow::Window() { if (ImGui::Checkbox("Left Right Reverse", &auth_3d_test_task->left_right_reverse)) _frame = 0.0f; - + ImGui::Checkbox("pos", &auth_3d_test_task->pos); if (_frame != frame) { diff --git a/src/ReDIVA/dw.cpp b/src/ReDIVA/dw.cpp index 29d839e1..373ab7f5 100644 --- a/src/ReDIVA/dw.cpp +++ b/src/ReDIVA/dw.cpp @@ -41,7 +41,7 @@ namespace dw_gui_detail { Display(); ~Display(); - + void AddShell(dw::Shell* value); void CheckShells(); void Ctrl(); @@ -128,15 +128,15 @@ namespace dw { SelectionListener::SelectionListener() { } - + SelectionListener::~SelectionListener() { } - + SelectionAdapter::SelectionAdapter() { } - + SelectionAdapter::~SelectionAdapter() { } @@ -152,11 +152,11 @@ namespace dw { SelectionListenerOnHook::SelectionListenerOnHook() : callback() { } - + SelectionListenerOnHook::SelectionListenerOnHook(Widget::Callback callback) { this->callback = callback; } - + SelectionListenerOnHook::~SelectionListenerOnHook() { } @@ -169,7 +169,7 @@ namespace dw { callback_data(), free_callback(), parent() { this->flags = flags; } - + Widget::~Widget() { } @@ -232,7 +232,7 @@ namespace dw { parent_shell = parent->parent_shell; } } - + Control::~Control() { } @@ -307,7 +307,7 @@ namespace dw { v_bar->SetName("v_bar"); } } - + Scrollable::~Scrollable() { } @@ -328,7 +328,7 @@ namespace dw { Layout::~Layout() { } - + FillLayout::FillLayout(int32_t a2) { field_8 = a2; } @@ -490,7 +490,7 @@ namespace dw { Composite::Composite(Composite* parent, Flags flags) : Scrollable(parent, flags), layout() { } - + Composite::~Composite() { } @@ -528,7 +528,7 @@ namespace dw { Button::Button(Composite* parent, Flags flags) : Control(parent, flags), value(), callback() { } - + Button::~Button() { } @@ -635,7 +635,7 @@ namespace dw { for (Widget* i : vec) i->Free(); - + /*for (Menu* i : menus) i->Free(); menus.clear();*/ diff --git a/src/ReDIVA/dw.hpp b/src/ReDIVA/dw.hpp index 5d91a2de..5561bb07 100644 --- a/src/ReDIVA/dw.hpp +++ b/src/ReDIVA/dw.hpp @@ -310,7 +310,7 @@ namespace dw { virtual ~ShellCloseButton() override; virtual void Draw() override; - + static void Callback(dw::Widget* data); }; @@ -363,7 +363,7 @@ namespace dw { void ResetSetSelectedItem(size_t index); void SetSelectedItem(size_t index); }; - + class ListBox : public Composite { public: List* list; diff --git a/src/ReDIVA/main.cpp b/src/ReDIVA/main.cpp index 8636dfa6..7900c2ae 100644 --- a/src/ReDIVA/main.cpp +++ b/src/ReDIVA/main.cpp @@ -417,7 +417,7 @@ void compile_shaders(farc* f, farc* of, const shader_table* shaders_table, const strcpy_s(frag_bin_buf, sizeof(frag_bin_buf), sub_table->fp); strcat_s(frag_bin_buf, sizeof(frag_bin_buf), ".frag.bin"); - + bool has_vert_bin = of->has_file(vert_bin_buf); bool has_frag_bin = of->has_file(frag_bin_buf); diff --git a/src/ReDIVA/render.cpp b/src/ReDIVA/render.cpp index 0c6f0118..9371d755 100644 --- a/src/ReDIVA/render.cpp +++ b/src/ReDIVA/render.cpp @@ -413,12 +413,12 @@ void render_data::load_common_data() { void render_data::unload_common_data() { common_data_ubo.Destroy(); - + if (grid_vbo) { glDeleteBuffers(1, &grid_vbo); grid_vbo = 0; } - + if (grid_vao) { glDeleteVertexArrays(1, &grid_vao); grid_vao = 0;