From c5a0a9753d48eaa2874158efebeaa97e0f288f8a Mon Sep 17 00:00:00 2001 From: korenkonder Date: Sun, 14 Dec 2025 03:36:15 +0300 Subject: [PATCH] PV Game: Edit Instrument Yet it's unused --- src/ReDIVA/pv_game/pv_game.cpp | 125 ++++++++++++------------- src/ReDIVA/pv_game/pv_game.hpp | 17 ++-- src/ReDIVA/pv_game/pv_game_pv_data.cpp | 4 +- 3 files changed, 72 insertions(+), 74 deletions(-) diff --git a/src/ReDIVA/pv_game/pv_game.cpp b/src/ReDIVA/pv_game/pv_game.cpp index 0e4c45b5..bc408a1c 100644 --- a/src/ReDIVA/pv_game/pv_game.cpp +++ b/src/ReDIVA/pv_game/pv_game.cpp @@ -259,11 +259,11 @@ pv_game_field::~pv_game_field() { } -struc_269::struc_269() : field_30(), field_34() { +pv_game_edit_instrument::pv_game_edit_instrument() : index() { } -struc_269::~struc_269() { +pv_game_edit_instrument::~pv_game_edit_instrument() { } @@ -1940,6 +1940,22 @@ void pv_game::edit_effect_set(int32_t index, float_t speed, float_t delta_time) data.edit_effect.data.delta_time = speed * delta_time; } +void pv_game::edit_instrument_reset() { + for (pv_game_edit_instrument& i : data.edit_instrument) + for (auth_3d_id& j : i.auth_3d_ids) + j.set_enable(false); +} + +void pv_game::edit_instrument_set_disp(int32_t chara_id, bool value) { + pv_game_edit_instrument& v4 = data.edit_instrument[chara_id]; + int32_t v5 = v4.index; + if (v5 >= 0 && v4.auth_3d_ids.size()) { + auth_3d_id& id = v4.auth_3d_ids[v5]; + if (id.check_not_empty()) + id.set_visibility(value); + } +} + void pv_game::end(bool complete, bool set_fade) { data.play_data.ended = true; data.complete = complete; @@ -3368,7 +3384,7 @@ bool pv_game::load() { } itmpv_reset(); - for (struc_269& i : data.field_2DA08) { + for (pv_game_edit_instrument& i : data.edit_instrument) { for (auto& j : i.data) { auth_3d_id id = auth_3d_id(j.second, aft_auth_3d_db); if (!id.check_not_empty()) @@ -3525,7 +3541,7 @@ bool pv_game::load() { for (auto& i : data.auth_3d) i.second.read_file(aft_auth_3d_db); - for (struc_269& i : data.field_2DA08) + for (pv_game_edit_instrument& i : data.edit_instrument) for (auth_3d_id& j : i.auth_3d_ids) j.read_file(aft_auth_3d_db); @@ -3547,7 +3563,7 @@ bool pv_game::load() { if (!i.second.check_loaded()) wait_load |= true; - for (struc_269& i : data.field_2DA08) + for (pv_game_edit_instrument& i : data.edit_instrument) for (auth_3d_id& j : i.auth_3d_ids) if (!j.check_loaded()) wait_load |= true; @@ -3889,7 +3905,7 @@ bool pv_game::load() { } itmpv_reset(); - sub_140113730(); + edit_instrument_reset(); data.current_field = 0; for (pv_game_field& i : data.field_data) { @@ -4080,10 +4096,10 @@ void pv_game::reset() { i.clear(); data.itmpv_uids.clear(); - for (auto& i : data.field_2DA08) { + for (auto& i : data.edit_instrument) { i.data.clear(); i.auth_3d_ids.clear(); - i.field_30 = -1; + i.index = -1; } data.auth_3d.clear(); @@ -4351,7 +4367,7 @@ void pv_game::restart() { } itmpv_reset(); - sub_140113730(); + edit_instrument_reset(); data.edit_effect.data.reset(); @@ -4449,6 +4465,40 @@ void pv_game::set_data_itmpv_visibility(int32_t chara_id, int32_t index, bool va elem->second.first.set_visibility(value); } +void pv_game::set_edit_instrument(int32_t chara_id, bool disp, int32_t index, float_t frame, float_t frame_speed) { + if (chara_id < 0 || chara_id >= 3) + return; + + pv_game_edit_instrument& edit_instrument = data.edit_instrument[chara_id]; + if (edit_instrument.index >= 0) { + if (edit_instrument.index >= edit_instrument.auth_3d_ids.size()) + return; + + auth_3d_id& id = edit_instrument.auth_3d_ids[edit_instrument.index]; + id.set_enable(false); + } + + if (index >= 0) { + if (index >= edit_instrument.auth_3d_ids.size()) + return; + + auth_3d_id& id = edit_instrument.auth_3d_ids[index]; + if (id.check_not_empty()) { + id.set_enable(true); + id.set_visibility(disp); + id.set_paused(false); + id.set_req_frame(frame); + id.set_chara_id(chara_id); + id.set_last_frame(id.get_play_control_size() - 1.0f); + + FrameRateControl* sys_frame_rate = sys_frame_rate_get(chara_id); + sys_frame_rate->set_frame_speed(frame_speed); + id.set_frame_rate(sys_frame_rate); + } + } + edit_instrument.index = index; +} + void pv_game::set_eyes_adjust(pv_game_chara* chr) { chr->pv_data.eyes_adjust.xrot_adjust = data.pv->eyes_xrot_adjust; if (data.pv->eyes_base_adjust_type != EYES_BASE_ADJUST_NONE) @@ -4740,7 +4790,7 @@ bool pv_game::unload() { for (auto& i : data.auth_3d) i.second.unload(rctx_ptr); - for (auto& i : data.field_2DA08) + for (auto& i : data.edit_instrument) for (auto& j : i.auth_3d_ids) j.unload(rctx_ptr); @@ -4760,10 +4810,10 @@ bool pv_game::unload() { i.clear(); data.itmpv_uids.clear(); - for (auto& i : data.field_2DA08) { + for (auto& i : data.edit_instrument) { i.data.clear(); i.auth_3d_ids.clear(); - i.field_30 = -1; + i.index = -1; } data.auth_3d.clear(); @@ -4990,57 +5040,6 @@ int32_t pv_game::sub_140112C00(int32_t index) { return 0; } -void pv_game::sub_140113730() { - for (struc_269& i : data.field_2DA08) - for (auth_3d_id& j : i.auth_3d_ids) - j.set_enable(false); -} - -void pv_game::sub_140115C10(int32_t chara_id, bool value) { - struc_269& v4 = data.field_2DA08[chara_id]; - int32_t v5 = v4.field_30; - if (v5 >= 0 && v4.auth_3d_ids.size()) { - auth_3d_id& id = v4.auth_3d_ids[v5]; - if (id.check_not_empty()) - id.set_visibility(value); - } -} - -void pv_game::sub_140115C90(int32_t chara_id, bool disp, int32_t index, float_t frame, float_t frame_speed) { - if (chara_id < 0 || chara_id >= 3) - return; - - struc_269& v19 = data.field_2DA08[chara_id]; - int32_t v11 = v19.field_30; - if (v11 >= 0) { - if (v11 >= v19.auth_3d_ids.size()) - return; - - auth_3d_id& id = v19.auth_3d_ids[v11]; - id.set_enable(false); - } - - if (index >= 0) { - if (index >= v19.auth_3d_ids.size()) - return; - - auth_3d_id& id = v19.auth_3d_ids[index]; - if (id.check_not_empty()) { - id.set_enable(true); - id.set_visibility(disp); - id.set_paused(false); - id.set_req_frame(frame); - id.set_chara_id(chara_id); - id.set_last_frame(id.get_play_control_size() - 1.0f); - - FrameRateControl* sys_frame_rate = sys_frame_rate_get(chara_id); - sys_frame_rate->set_frame_speed(frame_speed); - id.set_frame_rate(sys_frame_rate); - } - } - v19.field_30 = index; -} - void pv_game::sub_1401230A0() { data.challenge_time_total_bonus = 0; data.challenge_time_combo_count = 0; diff --git a/src/ReDIVA/pv_game/pv_game.hpp b/src/ReDIVA/pv_game/pv_game.hpp index 77899879..46ba5720 100644 --- a/src/ReDIVA/pv_game/pv_game.hpp +++ b/src/ReDIVA/pv_game/pv_game.hpp @@ -105,14 +105,13 @@ struct pv_game_field { ~pv_game_field(); }; -struct struc_269 { +struct pv_game_edit_instrument { prj::vector_pair data; std::vector auth_3d_ids; - int32_t field_30; - int32_t field_34; + int32_t index; - struc_269(); - ~struc_269(); + pv_game_edit_instrument(); + ~pv_game_edit_instrument(); }; struct pv_game_chreff { @@ -285,7 +284,7 @@ struct pv_game_data { std::vector itmpv_auth_3d_uids; std::map> itmpv[ROB_CHARA_COUNT]; std::vector itmpv_uids; - struc_269 field_2DA08[3]; + pv_game_edit_instrument edit_instrument[3]; std::vector loaded_auth_3d_uids; bool field_2DAC8; int32_t field_2DACC; @@ -377,6 +376,8 @@ struct pv_game { void disp_song_name(); void edit_effect_ctrl(float_t delta_time); void edit_effect_set(int32_t index, float_t frame_speed, float_t delta_time); + void edit_instrument_reset(); + void edit_instrument_set_disp(int32_t chara_id, bool value); void end(bool complete, bool set_fade); float_t get_aet_frame_max_frame(int32_t aet_frame, int32_t aet_index, std::pair& aet_name_id, int64_t dsc_time, int64_t curr_time, float_t* max_frame); @@ -439,6 +440,7 @@ struct pv_game { void set_data_itmpv_max_frame(int32_t chara_id, int32_t index, float_t value); void set_data_itmpv_visibility(int32_t chara_id, bool value); void set_data_itmpv_visibility(int32_t chara_id, int32_t index, bool value); + void set_edit_instrument(int32_t chara_id, bool disp, int32_t index, float_t frame, float_t frame_speed); void set_eyes_adjust(pv_game_chara* chr); void set_item(size_t performer, rob_chara_pv_data_item& value); void set_item_mask(size_t performer, size_t item, bool value); @@ -464,9 +466,6 @@ struct pv_game { void sub_14010F030(); int32_t sub_14010F930(); int32_t sub_140112C00(int32_t index); - void sub_140113730(); - void sub_140115C10(int32_t chara_id, bool value); - void sub_140115C90(int32_t chara_id, bool disp, int32_t index, float_t frame, float_t frame_speed); void sub_1401230A0(); static void chara_item_alpha_callback(void* data, int32_t chara_id, int32_t type, float_t alpha); diff --git a/src/ReDIVA/pv_game/pv_game_pv_data.cpp b/src/ReDIVA/pv_game/pv_game_pv_data.cpp index 8c174092..ac3bf58b 100644 --- a/src/ReDIVA/pv_game/pv_game_pv_data.cpp +++ b/src/ReDIVA/pv_game/pv_game_pv_data.cpp @@ -1452,7 +1452,7 @@ bool pv_game_pv_data::dsc_ctrl(float_t delta_time, int64_t curr_time, else rob_chr->set_visibility(false); - pv_game->sub_140115C10(chara_id, playdata->disp); + pv_game->edit_instrument_set_disp(chara_id, playdata->disp); } break; case DSC_FT_AIM: { chara_id = data[0]; @@ -1848,7 +1848,7 @@ bool pv_game_pv_data::dsc_ctrl(float_t delta_time, int64_t curr_time, field_2C560.field_288[chara_id] = index != -1; field_2C560.field_290[chara_id] = index; field_2C560.field_2A8[chara_id] = frame_speed; - pv_game->sub_140115C90(chara_id, playdata->disp, index, rob_chr->get_frame(), frame_speed); + pv_game->set_edit_instrument(chara_id, playdata->disp, index, rob_chr->get_frame(), frame_speed); } } break; case DSC_FT_PV_END_FADEOUT: {