diff --git a/src/CRE/auth_3d.cpp b/src/CRE/auth_3d.cpp index eb69819e..257e4efe 100644 --- a/src/CRE/auth_3d.cpp +++ b/src/CRE/auth_3d.cpp @@ -2695,11 +2695,9 @@ void auth_3d_data_get_obj_sets_from_category(std::string& name, std::vectordifficulty[PV_DIFFICULTY_HARD].size()) { - pv_db_pv_difficulty& diff = pv->difficulty[PV_DIFFICULTY_HARD][0]; - - for (pv_db_pv_item& i : diff.pv_item) { + const pv_db_pv_difficulty* diff = task_pv_db_get_pv_difficulty(pv_id, PV_DIFFICULTY_HARD, 0); + if (diff) + for (const pv_db_pv_item& i : diff->pv_item) { if (i.index <= 0) continue; @@ -2707,7 +2705,6 @@ void auth_3d_data_get_obj_sets_from_category(std::string& name, std::vector* name = customize_item_table_names; diff --git a/src/CRE/module_table.cpp b/src/CRE/module_table.cpp index e6bbd60c..07facb66 100644 --- a/src/CRE/module_table.cpp +++ b/src/CRE/module_table.cpp @@ -178,7 +178,7 @@ void module_table_handler::fill_name_map() { { "MEIKO" , 7 }, { "SAKINE", 8 }, { "TETO" , 9 }, - { 0, 0 }, + { 0, 0 }, }; std::pair* name = module_table_names; @@ -334,19 +334,20 @@ void module_data_handler::add_modules() { mdl.chara_index = (chara_index)i.second.chara; mdl.cos = i.second.cos; mdl.field_79 = false; + rob_sleeve_handler_data_get_sleeve_data(mdl.chara_index, mdl.cos, mdl.sleeve_l, mdl.sleeve_r); - sprintf_s(buf, sizeof(0x80), "SPR_SEL_MD%03d", mdl.id); + sprintf_s(buf, sizeof(buf), "SPR_SEL_MD%03d", mdl.id); mdl.spr_sel_md_id_spr_set_id = aft_spr_db->get_spr_set_by_name(buf)->id; - sprintf_s(buf, sizeof(0x80), "SPR_SEL_MD%03dCMN", mdl.id); + sprintf_s(buf, sizeof(buf), "SPR_SEL_MD%03dCMN", mdl.id); mdl.spr_sel_md_id_cmn_spr_set_id = aft_spr_db->get_spr_set_by_name(buf)->id; - sprintf_s(buf, sizeof(0x80), "SPR_SEL_MD%03d_MD_IMG_%03d", mdl.id, mdl.id); - mdl.spr_sel_md_id_cmn_md_img_id_spr_id = aft_spr_db->get_spr_set_by_name(buf)->id; - - sprintf_s(buf, sizeof(0x80), "SPR_SEL_MD%03dCMN_MD_IMG", mdl.id); - mdl.spr_sel_md_id_cmn_md_img_spr_id = aft_spr_db->get_spr_set_by_name(buf)->id; + sprintf_s(buf, sizeof(buf), "SPR_SEL_MD%03d_MD_IMG_%03d", mdl.id, mdl.id); + mdl.spr_sel_md_id_cmn_md_img_id_spr_id = aft_spr_db->get_spr_by_name(buf)->id; + + sprintf_s(buf, sizeof(buf), "SPR_SEL_MD%03dCMN_MD_IMG", mdl.id); + mdl.spr_sel_md_id_cmn_md_img_spr_id = aft_spr_db->get_spr_by_name(buf)->id; /*struc_684 v17; if (sub_1402B7880()->sub_1402B7550(i.second.id, v17)) { diff --git a/src/CRE/pv_db.cpp b/src/CRE/pv_db.cpp index 92012c3b..f7ed5395 100644 --- a/src/CRE/pv_db.cpp +++ b/src/CRE/pv_db.cpp @@ -1139,8 +1139,8 @@ namespace pv_db { int32_t pv_costume; if (kv.read("pv_costume", pv_costume)) { pv_costume--; - for (int32_t j = 0; j < 5; j++) - if (performer.pv_costume[j] != -1) + for (int32_t j = 0; j < PV_DIFFICULTY_MAX; j++) + if (performer.pv_costume[j] == -1) performer.pv_costume[j] = pv_costume; } @@ -2297,7 +2297,7 @@ uint32_t task_pv_db_get_paths_count() { return (uint32_t)task_pv_db_get()->paths.size(); } -pv_db_pv* task_pv_db_get_pv(int32_t pv_id) { +const pv_db_pv* task_pv_db_get_pv(int32_t pv_id) { std::list& pv_data = task_pv_db_get()->pv_data; for (pv_db_pv& i : pv_data) if (i.id == pv_id) @@ -2307,7 +2307,7 @@ pv_db_pv* task_pv_db_get_pv(int32_t pv_id) { const pv_db_pv_difficulty* task_pv_db_get_pv_difficulty(int32_t pv_id, pv_difficulty difficulty, pv_attribute_type attribute_type) { - pv_db_pv* pv = task_pv_db_get_pv(pv_id); + const pv_db_pv* pv = task_pv_db_get_pv(pv_id); if (pv) return pv->get_difficulty(difficulty, attribute_type); return 0; @@ -2315,7 +2315,7 @@ const pv_db_pv_difficulty* task_pv_db_get_pv_difficulty(int32_t pv_id, const pv_db_pv_difficulty* task_pv_db_get_pv_difficulty(int32_t pv_id, pv_difficulty difficulty, int32_t edition) { - pv_db_pv* pv = task_pv_db_get_pv(pv_id); + const pv_db_pv* pv = task_pv_db_get_pv(pv_id); if (pv) return pv->get_difficulty(difficulty, edition); return 0; diff --git a/src/CRE/pv_db.hpp b/src/CRE/pv_db.hpp index c8cfb9aa..5ae8daa9 100644 --- a/src/CRE/pv_db.hpp +++ b/src/CRE/pv_db.hpp @@ -558,7 +558,7 @@ extern void task_pv_db_free_pv_data(); extern bool task_pv_db_del_task(); extern pv_db::TaskPvDB* task_pv_db_get(); extern uint32_t task_pv_db_get_paths_count(); -extern pv_db_pv* task_pv_db_get_pv(int32_t pv_id); +extern const pv_db_pv* task_pv_db_get_pv(int32_t pv_id); extern const pv_db_pv_difficulty* task_pv_db_get_pv_difficulty(int32_t pv_id, pv_difficulty difficulty, pv_attribute_type attribute_type); extern const pv_db_pv_difficulty* task_pv_db_get_pv_difficulty(int32_t pv_id, diff --git a/src/CRE/rob/rob.cpp b/src/CRE/rob/rob.cpp index 61a13019..7b023e4d 100644 --- a/src/CRE/rob/rob.cpp +++ b/src/CRE/rob/rob.cpp @@ -495,7 +495,7 @@ public: uint32_t motion_index; std::vector pv_set_motion; std::vector osage_set_motion; - pv_db_pv* pv; + const pv_db_pv* pv; std::map reset_frames_list; std::thread* thread; std::condition_variable cnd; @@ -18135,7 +18135,7 @@ void PvOsageManager::sub_1404F8AA0() { rob_chr->set_motion_id(motion_id, 0.0f, 0.0f, true, false, MOTION_BLEND_CROSS, aft_bone_data, aft_mot_db); if (pv) - for (pv_db_pv_osage_init& i : pv->osage_init) { + for (const pv_db_pv_osage_init& i : pv->osage_init) { int32_t osage_init_motion_id = aft_mot_db->get_motion_id(i.motion.c_str()); if (osage_init_motion_id != -1 && osage_init_motion_id == motion_id) { if (rob_chr->data.field_1588.field_0.field_58 == 1) diff --git a/src/ReDIVA/game_state.cpp b/src/ReDIVA/game_state.cpp index 30fe6060..2099dffd 100644 --- a/src/ReDIVA/game_state.cpp +++ b/src/ReDIVA/game_state.cpp @@ -15,6 +15,7 @@ #include "data_test/glitter_test.hpp" #include "data_test/motion_test.hpp" #include "data_test/stage_test.hpp" +#include "pv_game/player_data.hpp" #include "pv_game/pv_game.hpp" #include "data_edit.hpp" #include "data_initialize.hpp" @@ -856,6 +857,10 @@ bool data_test_reset = false; bool network_error; bool test_mode; +#if PV_DEBUG +bool pv_x; +#endif + GameStateEnum data_test_game_state_prev; static bool game_state_call_sub(GameState* game_state); @@ -1141,16 +1146,65 @@ bool SubGameState::PhotoModeDemo::Dest() { } bool SubGameState::Selector::Init() { +#if PV_DEBUG + if (!pv_x) { + pv_game_selector_init(); + app::TaskWork::AddTask(pv_game_selector_get(), "PVGAME SELECTOR", 0); + return true; + } +#endif x_pv_game_selector_init(); app::TaskWork::AddTask(x_pv_game_selector_get(), "X PVGAME SELECTOR", 0); return true; } bool SubGameState::Selector::Ctrl() { +#if PV_DEBUG + if (!pv_x) { + PVGameSelector* sel = pv_game_selector_get(); + if (sel->exit) { + if (sel->start && pv_game_init()) { + struc_717* v0 = sub_14038BB30(); + v0->field_0.stage_index = 0; + + struc_716* v2 = &v0->field_28[v0->field_0.stage_index]; + v2->field_2C.pv_id = sel->pv_id; + v2->field_2C.difficulty = sel->difficulty; + v2->field_2C.edition = sel->edition; + v2->field_2C.score_percentage_clear = 5000; + v2->field_2C.life_gauge_safety_time = 40; + v2->field_2C.life_gauge_border = 30; + + for (int32_t i = 0; i < ROB_CHARA_COUNT; i++) { + v2->field_2C.field_4C[i] = sel->modules[i]; + v2->field_2C.field_64[i] = sel->modules[i]; + for (int32_t j = 0; j < 4; j++) + v2->field_2C.field_7C[i].arr[j] = false; + } + + v0->field_0.no_fail = true; + v0->field_0.watch = true; + v0->field_0.success = sel->success; + + PlayerData* player_data = player_data_array_get(0); + player_data->field_0 = true; + + sub_14038BB30()->field_0.option = 0; + + task_pv_game_init_pv(); + game_state_set_sub_game_state_next(SUB_GAME_STATE_GAME_MAIN); + } + else + game_state_set_game_state_next(GAME_STATE_ADVERTISE); + return true; + } + return false; + } +#endif XPVGameSelector* sel = x_pv_game_selector_get(); if (sel->exit) { if (sel->start && x_pv_game_init()) { - app::TaskWork::AddTask(x_pv_game_get(), "X PVGAME", 0); + app::TaskWork::AddTask(x_pv_game_get(), "PVGAME", 0); x_pv_game_get()->Load(sel->pv_id, sel->stage_id, sel->charas, sel->modules); game_state_set_sub_game_state_next(SUB_GAME_STATE_GAME_MAIN); } @@ -1162,6 +1216,18 @@ bool SubGameState::Selector::Ctrl() { } bool SubGameState::Selector::Dest() { +#if PV_DEBUG + if (!pv_x) { + PVGameSelector* sel = pv_game_selector_get(); + if (!app::TaskWork::CheckTaskReady(sel)) { + pv_game_selector_free(); + return true; + } + + sel->DelTask(); + return false; + } +#endif XPVGameSelector* sel = x_pv_game_selector_get(); if (!app::TaskWork::CheckTaskReady(sel)) { x_pv_game_selector_free(); @@ -1177,12 +1243,23 @@ bool SubGameState::GameMain::Init() { } bool SubGameState::GameMain::Ctrl() { +#if PV_DEBUG + if (!pv_x) { + if (!task_pv_game_check_task_ready()) + return true; + return false; + } +#endif if (!app::TaskWork::CheckTaskReady(x_pv_game_get())) return true; return false; } bool SubGameState::GameMain::Dest() { +#if PV_DEBUG + if (!pv_x) + return pv_game_free(); +#endif return x_pv_game_free(); } diff --git a/src/ReDIVA/pv_game/game_2d.cpp b/src/ReDIVA/pv_game/game_2d.cpp index 48cd10a6..dd085a8d 100644 --- a/src/ReDIVA/pv_game/game_2d.cpp +++ b/src/ReDIVA/pv_game/game_2d.cpp @@ -28,7 +28,7 @@ const int32_t spr_p_life_safe_num_spr[] = { TaskGame2d* task_game_2d; Game2dEnergyUnit::Game2dEnergyUnit() : field_1B8(), field_1CC(), field_1D1(), no_fail(), field_1D4(), -max_value(), life_gauge_prev(), life_gauge_stable(), life_gauge_decrease(), life_gauge_increase(), +max_value(), life_gauge_prev(), life_gauge_stable(), life_gauge_decrease(), life_gauge_increase(), life_gauge_border(), life_gauge(), life_gauge_delay(), field_218(), life_gauge_safety(), life_gauge_safety_time(), life_gauge_bonus(), field_224(), field_228(), field_22C() { diff --git a/src/ReDIVA/pv_game/player_data.cpp b/src/ReDIVA/pv_game/player_data.cpp index 894b8f53..e888e976 100644 --- a/src/ReDIVA/pv_game/player_data.cpp +++ b/src/ReDIVA/pv_game/player_data.cpp @@ -271,8 +271,7 @@ void PlayerData::Reset() { field_D58.clear(); field_D70.clear(); - static prj::time start_of_2011 = prj::strptime("2011-01-01 00:00:00"); - field_D88 = start_of_2011; + field_D88 = prj::strptime("2011-01-01 00:00:00"); field_D90 = false; clear_border = 0; diff --git a/src/ReDIVA/pv_game/pv_game.cpp b/src/ReDIVA/pv_game/pv_game.cpp index 34234dd4..9b517aad 100644 --- a/src/ReDIVA/pv_game/pv_game.cpp +++ b/src/ReDIVA/pv_game/pv_game.cpp @@ -115,6 +115,10 @@ pv_game* pv_game_ptr; pv_disp2d pv_disp2d_data; TaskPvGame* task_pv_game; +#if PV_DEBUG +PVGameSelector* pv_game_selector_ptr; +#endif + struc_14 stru_140C94438; struc_717 stru_141197E00; @@ -1240,7 +1244,11 @@ void pv_game::change_field(size_t field, ssize_t dsc_time, ssize_t curr_time) { if (aet_index >= 0) { float_t end_time = -1.0f; float_t start_time = -1.0f; +#if PV_DEBUG + FrameRateControl* frame_rate_control = &sys_frame_rate; +#else FrameRateControl* frame_rate_control = 0; +#endif if (data.has_aet_frame[i]) { int32_t aet_frame = get_field_aet_frame_by_name_id(next_field_data, aet, aet_name_id); @@ -1283,7 +1291,11 @@ void pv_game::change_field(size_t field, ssize_t dsc_time, ssize_t curr_time) { else { float_t end_time = -1.0f; float_t start_time = -1.0f; +#if PV_DEBUG + FrameRateControl* frame_rate_control = &sys_frame_rate; +#else FrameRateControl* frame_rate_control = 0; +#endif if (data.has_aet_frame[i]) { int32_t aet_frame = get_field_aet_frame_by_name_id(next_field_data, aet, aet_name_id); @@ -2338,7 +2350,7 @@ bool pv_game::load() { case 1: { if (sub_14013C8C0()->sub_1400E7910() < 4) { pv_id = sub_14013C8C0()->pv; - pv_db_pv* pv = task_pv_db_get_pv(pv_id); + const pv_db_pv* pv = task_pv_db_get_pv(pv_id); if (pv) data.pv = pv; else @@ -5230,7 +5242,7 @@ void TaskPvGame::Disp() { #if PV_DEBUG void TaskPvGame::Window() { - if (pv_game_parent_data.pv_state != 1 || pv_game_parent_data.init_time) + if (data.type != 2 || pv_game_parent_data.pv_state != 1) return; if (Input::IsKeyTapped(GLFW_KEY_K, GLFW_MOD_CONTROL)) @@ -5308,7 +5320,7 @@ void TaskPvGame::Window() { } void TaskPvGame::Basic() { - if (pv_game_parent_data.pv_state != 1 || pv_game_parent_data.init_time) + if (data.type != 2 || pv_game_parent_data.pv_state != 1) return; if (step_frame) @@ -5346,7 +5358,7 @@ void TaskPvGame::Load(TaskPvGame::Data& data) { pv_game_init(); pv_game_parent_data.update_func = pv_game_parent::ctrl; - pv_game_parent_data.state = 0; + pv_game_parent_data.pv_state = 0; pv_game_parent_data.playing = true; pv_game_parent_data.state = 0; pv_game_parent_data.init_time = false; @@ -5418,6 +5430,233 @@ bool TaskPvGame::Unload() { return true; } +#if PV_DEBUG +PVGameSelector::PVGameSelector() : charas(), modules(), start(), exit() { + pv_id = 600; + pv = task_pv_db_get_pv(pv_id); + difficulty = PV_DIFFICULTY_HARD; + edition = 0; + success = true; + + difficulty = PV_DIFFICULTY_HARD; + + const prj::vector_pair_combine& modules = module_table_handler_data_get_modules(); + for (const auto& i : modules) + modules_data[i.second.chara].push_back(&i.second); + + for (int32_t i = 0; i < ROB_CHARA_COUNT; i++) + for (const auto& j : modules_data[charas[i]]) + if (this->modules[i] == j->cos) { + module_names[i].assign(j->name); + break; + } +} + +PVGameSelector::~PVGameSelector() { + +} + +bool PVGameSelector::Init() { + start = false; + exit = false; + return true; +} + +bool PVGameSelector::Ctrl() { + return false; +} + +bool PVGameSelector::Dest() { + return true; +} + +void PVGameSelector::Window() { + static const char* difficulty_names[] = { + "EASY", + "NORMAL", + "HARD", + "EXTREME", + "ENCORE", + }; + + ImGuiIO& io = ImGui::GetIO(); + ImGuiStyle& style = ImGui::GetStyle(); + ImFont* font = ImGui::GetFont(); + + extern int32_t height; + extern int32_t width; + + float_t w = 400.0f; + float_t h = (float_t)height; + h = min_def(h, 500.0f); + + ImGui::SetNextWindowPos({ (float_t)width - w, 0.0f }, ImGuiCond_Always); + ImGui::SetNextWindowSize({ w, h }, ImGuiCond_Always); + + ImGuiWindowFlags window_flags = 0; + window_flags |= ImGuiWindowFlags_NoResize; + + window_focus = false; + bool open = true; + if (!ImGui::Begin("X PV Game Selector", &open, window_flags)) { + ImGui::End(); + return; + } + else if (!open) { + start = false; + exit = true; + ImGui::End(); + return; + } + + pv_db::TaskPvDB* task_pv_db = task_pv_db_get(); + + ImGui::StartPropertyColumn("PV"); + extern ImFont* imgui_font_arial; + if (imgui_font_arial) + ImGui::PushFont(imgui_font_arial); + if (ImGui::BeginCombo("", pv->song_name.c_str(), 0)) { + for (const pv_db_pv& i : task_pv_db->pv_data) { + if (i.id == 999) + continue; + + ImGui::PushID(&i); + if (ImGui::Selectable(i.song_name.c_str(), pv_id == i.id) + || ImGui::ItemKeyPressed(ImGuiKey_Enter) + || (ImGui::IsItemFocused() && pv_id != i.id)) { + pv_id = i.id; + pv = &i; + difficulty = PV_DIFFICULTY_HARD; + edition = 0; + success = true; + } + ImGui::PopID(); + + if (pv_id == i.id) + ImGui::SetItemDefaultFocus(); + } + + window_focus |= true; + ImGui::EndCombo(); + } + if (imgui_font_arial) + ImGui::PopFont(); + ImGui::EndPropertyColumn(); + + ImGui::StartPropertyColumn("Difficulty"); + if (ImGui::BeginCombo("", difficulty_names[difficulty], 0)) { + for (int32_t i = 0; i < PV_DIFFICULTY_MAX; i++) { + if (!pv->difficulty[i].size()) + continue; + + if (ImGui::Selectable(difficulty_names[i], difficulty == i) + || ImGui::ItemKeyPressed(ImGuiKey_Enter) + || (ImGui::IsItemFocused() && difficulty != i)) { + difficulty = (pv_difficulty)i; + edition = 0; + success = true; + } + + if (difficulty == i) + ImGui::SetItemDefaultFocus(); + } + + window_focus |= true; + ImGui::EndCombo(); + } + ImGui::EndPropertyColumn(); + + char buf[0x200]; + + ImGui::StartPropertyColumn("Edition"); + sprintf_s(buf, sizeof(buf), "%d", edition); + if (ImGui::BeginCombo("", buf, 0)) { + for (const pv_db_pv_difficulty& i : pv->difficulty[difficulty]) { + ImGui::PushID(&i); + sprintf_s(buf, sizeof(buf), "%d", i.edition); + if (ImGui::Selectable(buf, edition == i.edition) + || ImGui::ItemKeyPressed(ImGuiKey_Enter) + || (ImGui::IsItemFocused() && edition != i.edition)) { + edition = i.edition; + success = true; + } + ImGui::PopID(); + + if (edition == i.edition) + ImGui::SetItemDefaultFocus(); + } + + window_focus |= true; + ImGui::EndCombo(); + } + ImGui::EndPropertyColumn(); + + bool has_success = !!pv->get_difficulty(difficulty, edition)->pvbranch_success_se_name.size(); + ImGui::DisableElementPush(has_success); + ImGui::Checkbox("Success", &success); + ImGui::DisableElementPop(has_success); + + for (int32_t i = 0; i < ROB_CHARA_COUNT; i++) { + chara_index chara_old = charas[i]; + + sprintf_s(buf, sizeof(buf), "Chara %dP", i + 1); + ImGui::ColumnComboBox(buf, chara_full_names, CHARA_MAX, + (int32_t*)&charas[i], 0, false, &window_focus); + + if (chara_old != charas[i]) { + modules[i] = 0; + module_names[i].clear(); + + for (const auto& j : modules_data[charas[i]]) + if (modules[i] == j->id) { + module_names[i].assign(j->name); + break; + } + } + } + + for (int32_t i = 0; i < ROB_CHARA_COUNT; i++) { + sprintf_s(buf, sizeof(buf), "Module %dP", i + 1); + + ImGui::StartPropertyColumn(buf); + extern ImFont* imgui_font_arial; + if (imgui_font_arial) + ImGui::PushFont(imgui_font_arial); + if (ImGui::BeginCombo("", module_names[i].c_str(), 0)) { + for (const auto& j : modules_data[charas[i]]) { + if (j->cos == 499) + continue; + + ImGui::PushID(&j); + if (ImGui::Selectable(j->name.c_str(), modules[i] == j->id) + || ImGui::ItemKeyPressed(ImGuiKey_Enter) + || (ImGui::IsItemFocused() && modules[i] != j->id)) { + modules[i] = j->id; + module_names[i].assign(j->name); + } + ImGui::PopID(); + + if (modules[i] == j->id) + ImGui::SetItemDefaultFocus(); + } + + window_focus |= true; + ImGui::EndCombo(); + } + if (imgui_font_arial) + ImGui::PopFont(); + ImGui::EndPropertyColumn(); + } + + if (ImGui::Button("Start")) { + start = true; + exit = true; + } + + ImGui::End(); +} +#endif + float_t bar_time_set_to_target_flying_time(int32_t bpm, int32_t time_signature, int64_t* time_int) { if (time_int) *time_int = (int64_t)time_signature * (int32_t)(float_t)((60.0 / (float_t)bpm) * 1000000000.0f); @@ -5597,7 +5836,7 @@ bool task_pv_game_init_demo_pv(int32_t pv_id, pv_difficulty difficulty, bool mus task_pv_game->data.init_data.life_gauge_border = 20; task_pv_game->data.init_data.stage_index = 0; - pv_db_pv* pv = task_pv_db_get_pv(pv_id); + const pv_db_pv* pv = task_pv_db_get_pv(pv_id); for (int32_t i = 0; i < 6 && (!pv || pv && i < pv->get_performer_count()); i++) { if (pv && pv->get_performer_fixed(i)) { module_data mdl; @@ -5658,6 +5897,26 @@ void task_pv_game_init_test_pv() { task_pv_game_add_task(args); } +#if PV_DEBUG +bool pv_game_selector_init() { + if (!pv_game_selector_ptr) + pv_game_selector_ptr = new PVGameSelector; + return true; +} + +PVGameSelector* pv_game_selector_get() { + return pv_game_selector_ptr; +} + +bool pv_game_selector_free() { + if (pv_game_selector_ptr) { + delete pv_game_selector_ptr; + pv_game_selector_ptr = 0; + } + return true; +} +#endif + struc_14* sub_14013C8C0() { return &stru_140C94438; } @@ -5844,6 +6103,26 @@ struc_674::struc_674() : performer(), module(), item(), field_1C(), pv() { } static bool pv_game_parent_ctrl() { +#if PV_DEBUG + if (pv_game_parent_data.init_time) { + if (task_pv_game->pause) + pv_game_parent_data.init_time = false; + + pv_game_time_data.curr_time = 0; + pv_game_time_data.last_stop_time.get_timestamp(); + pv_game_time_data.last_stop_time.get_timestamp(); + + if (!task_pv_game->pause) + pv_game_time_data.add_last_stop_time = true; + + pv_game_time_data.delta_time = 0; + pv_game_time_data.current_time.get_timestamp(); + pv_game_time_data.current_time.get_timestamp(); + + if (!task_pv_game->pause) + pv_game_time_data.add_current_time = true; + } +#else if (pv_game_parent_data.init_time) { pv_game_parent_data.init_time = false; @@ -5857,6 +6136,7 @@ static bool pv_game_parent_ctrl() { pv_game_time_data.current_time.get_timestamp(); pv_game_time_data.add_current_time = true; } +#endif int64_t curr_time = pv_game_time_data.curr_time; if (pv_game_time_data.add_last_stop_time) @@ -5963,7 +6243,7 @@ static void sub_140105010(pv_game_chara* arr, size_t max_count, pv_game_item_mas const pv_db_pv* pv = a4.pv; PlayerData* player_data = player_data_array_get(0); bool v14 = pv->get_performer_pseudo_fixed(chr->chara_index, - performer, a4.field_1C, player_data->field_F40 == 0); + performer, a4.field_1C, !player_data->field_F40); if (sub_14013C8C0()->sub_1400E7910() == 3 && !pv->get_performer_fixed(performer)) v14 = false; diff --git a/src/ReDIVA/pv_game/pv_game.hpp b/src/ReDIVA/pv_game/pv_game.hpp index f191413f..015f21e2 100644 --- a/src/ReDIVA/pv_game/pv_game.hpp +++ b/src/ReDIVA/pv_game/pv_game.hpp @@ -833,6 +833,31 @@ public: bool Unload(); }; +#if PV_DEBUG +class PVGameSelector : public app::TaskWindow { +public: + int32_t pv_id; + const pv_db_pv* pv; + pv_difficulty difficulty; + int32_t edition; + bool success; + chara_index charas[ROB_CHARA_COUNT]; + int32_t modules[ROB_CHARA_COUNT]; + std::string module_names[ROB_CHARA_COUNT]; + std::vector modules_data[CHARA_MAX]; + bool start; + bool exit; + + PVGameSelector(); + virtual ~PVGameSelector() override; + + virtual bool Init() override; + virtual bool Ctrl() override; + virtual bool Dest() override; + virtual void Window() override; +}; +#endif + extern float_t bar_time_set_to_target_flying_time(int32_t bpm, int32_t time_signature, int64_t* time_int = 0); extern float_t dsc_time_to_frame(int64_t time); @@ -848,5 +873,11 @@ extern void task_pv_game_init_pv(); extern bool task_pv_game_init_demo_pv(int32_t pv_id, pv_difficulty difficulty, bool music_play); extern void task_pv_game_init_test_pv(); +#if PV_DEBUG +extern bool pv_game_selector_init(); +extern PVGameSelector* pv_game_selector_get(); +extern bool pv_game_selector_free(); +#endif + extern struc_14* sub_14013C8C0(); extern struc_717* sub_14038BB30(); diff --git a/src/ReDIVA/render.cpp b/src/ReDIVA/render.cpp index 8eaa6669..d7d18ae3 100644 --- a/src/ReDIVA/render.cpp +++ b/src/ReDIVA/render.cpp @@ -155,11 +155,7 @@ int32_t height; static const double_t aspect = 16.0 / 9.0; -#if PV_DEBUG -static const int32_t fast_loader_speed = 0; -#else static const int32_t fast_loader_speed = 60; -#endif bool light_chara_ambient; vec4 npr_cloth_spec_color = 1.0f; @@ -912,7 +908,7 @@ static render_context* render_context_load() { io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; io.Fonts->AddFontDefault(); - + const char* font_file = "C:\\Windows\\Fonts\\ArialUni.ttf"; ImVector ranges; @@ -966,6 +962,9 @@ extern double_t input_rotate_x; extern double_t input_rotate_y; extern double_t input_roll; extern bool input_reset; +#if PV_DEBUG +extern bool pv_x; +#endif static void render_context_ctrl(render_context* rctx) { camera* cam = rctx->camera; @@ -1034,8 +1033,19 @@ static void render_context_ctrl(render_context* rctx) { if (Input::IsKeyTapped(GLFW_KEY_F4)) game_state_set_game_state_next(GAME_STATE_ADVERTISE); +#if PV_DEBUG + else if (Input::IsKeyTapped(GLFW_KEY_F5, GLFW_MOD_CONTROL)) { + pv_x = false; + game_state_set_game_state_next(GAME_STATE_GAME); + } + else if (Input::IsKeyTapped(GLFW_KEY_F5)) { + pv_x = true; + game_state_set_game_state_next(GAME_STATE_GAME); + } +#else else if (Input::IsKeyTapped(GLFW_KEY_F5)) game_state_set_game_state_next(GAME_STATE_GAME); +#endif else if (Input::IsKeyTapped(GLFW_KEY_F6)) { game_state_set_game_state_next(GAME_STATE_DATA_TEST); game_state_set_sub_game_state_next(SUB_GAME_STATE_DATA_TEST_AET); diff --git a/src/ReDIVA/x_pv_game.cpp b/src/ReDIVA/x_pv_game.cpp index 770125cc..3ee64b53 100644 --- a/src/ReDIVA/x_pv_game.cpp +++ b/src/ReDIVA/x_pv_game.cpp @@ -5832,6 +5832,13 @@ XPVGameSelector::XPVGameSelector() : charas(), modules(), start(), exit() { const prj::vector_pair_combine& modules = module_table_handler_data_get_modules(); for (const auto& i : modules) modules_data[i.second.chara].push_back(&i.second); + + for (int32_t i = 0; i < ROB_CHARA_COUNT; i++) + for (const auto& j : modules_data[charas[i]]) + if (this->modules[i] == j->cos) { + module_names[i].assign(j->name); + break; + } } XPVGameSelector::~XPVGameSelector() { @@ -5964,7 +5971,6 @@ void XPVGameSelector::Window() { stage_id++; char buf[0x200]; - char buf1[0x100]; for (int32_t i = 0; i < ROB_CHARA_COUNT; i++) { chara_index chara_old = charas[i]; @@ -5972,35 +5978,37 @@ void XPVGameSelector::Window() { ImGui::ColumnComboBox(buf, chara_full_names, CHARA_MAX, (int32_t*)&charas[i], 0, false, &window_focus); - if (chara_old != charas[i]) + if (chara_old != charas[i]) { modules[i] = 0; + module_names[i].clear(); + + for (const auto& j : modules_data[charas[i]]) + if (modules[i] == j->cos) { + module_names[i].assign(j->name); + break; + } + } } for (int32_t i = 0; i < ROB_CHARA_COUNT; i++) { sprintf_s(buf, sizeof(buf), "Module %dP", i + 1); - - buf1[0] = 0; - for (const auto& j : modules_data[charas[i]]) - if (modules[i] == j->cos) { - sprintf_s(buf1, sizeof(buf1), "%s", j->name.c_str()); - break; - } ImGui::StartPropertyColumn(buf); extern ImFont* imgui_font_arial; if (imgui_font_arial) ImGui::PushFont(imgui_font_arial); - if (ImGui::BeginCombo("", buf1, 0)) { + if (ImGui::BeginCombo("", module_names[i].c_str(), 0)) { for (const auto& j : modules_data[charas[i]]) { if (j->cos == 499) continue; ImGui::PushID(&j); - sprintf_s(buf1, sizeof(buf1), "%s", j->name.c_str()); - if (ImGui::Selectable(buf1, modules[i] == j->cos) + if (ImGui::Selectable(j->name.c_str(), modules[i] == j->cos) || ImGui::ItemKeyPressed(ImGuiKey_Enter) - || (ImGui::IsItemFocused() && modules[i] != j->cos)) + || (ImGui::IsItemFocused() && modules[i] != j->cos)) { modules[i] = j->cos; + module_names[i].assign(j->name); + } ImGui::PopID(); if (modules[i] == j->cos) diff --git a/src/ReDIVA/x_pv_game.hpp b/src/ReDIVA/x_pv_game.hpp index 11707b81..26274a52 100644 --- a/src/ReDIVA/x_pv_game.hpp +++ b/src/ReDIVA/x_pv_game.hpp @@ -805,6 +805,7 @@ public: int32_t stage_id; chara_index charas[ROB_CHARA_COUNT]; int32_t modules[ROB_CHARA_COUNT]; + std::string module_names[ROB_CHARA_COUNT]; std::vector modules_data[CHARA_MAX]; bool start; bool exit;