feat(Outfit Editor): Add [+] & [-] buttons (#1441)
* And other general UI improvements
This commit is contained in:
parent
8bc6648100
commit
1eae251012
@ -1,8 +1,8 @@
|
||||
include(FetchContent)
|
||||
FetchContent_Declare(
|
||||
imgui
|
||||
GIT_REPOSITORY https://github.com/YimMenu/imgui.git
|
||||
GIT_TAG a241dc7990b631fde6575771173c2442d43d2812
|
||||
GIT_REPOSITORY https://github.com/ocornut/imgui.git
|
||||
GIT_TAG 94c46d74869ec991c101c187088da0f25d6c8e40
|
||||
GIT_PROGRESS TRUE
|
||||
)
|
||||
message("ImGui")
|
||||
|
@ -7,11 +7,14 @@
|
||||
#include "file_manager.hpp"
|
||||
|
||||
#include <bitset>
|
||||
#include <imgui.h>
|
||||
#include <rage/rlSessionInfo.hpp>
|
||||
#include <weapon/CAmmoInfo.hpp>
|
||||
#include <weapon/CWeaponInfo.hpp>
|
||||
|
||||
#define IMGUI_DEFINE_MATH_OPERATORS
|
||||
#include <imgui.h>
|
||||
|
||||
|
||||
class CNetGamePlayer;
|
||||
|
||||
namespace rage
|
||||
@ -735,6 +738,7 @@ namespace big
|
||||
ImFont* font_small = nullptr;
|
||||
ImFont* font_icon = nullptr;
|
||||
|
||||
bool demo = false;
|
||||
bool switched_view = true;
|
||||
|
||||
struct ingame_overlay
|
||||
@ -762,7 +766,7 @@ namespace big
|
||||
NLOHMANN_DEFINE_TYPE_INTRUSIVE(vehicle_control, operation_animation, max_summon_range, render_distance_on_veh)
|
||||
} vehicle_control{};
|
||||
|
||||
NLOHMANN_DEFINE_TYPE_INTRUSIVE(window, background_color, text_color, button_color, frame_color, gui_scale, switched_view, ingame_overlay, vehicle_control)
|
||||
NLOHMANN_DEFINE_TYPE_INTRUSIVE(window, background_color, demo, text_color, button_color, frame_color, gui_scale, switched_view, ingame_overlay, vehicle_control)
|
||||
} window{};
|
||||
|
||||
struct context_menu
|
||||
|
@ -17,7 +17,7 @@ namespace big
|
||||
g_handling_service->load_files();
|
||||
}
|
||||
|
||||
if (ImGui::ListBoxHeader("##handling_profiles"))
|
||||
if (ImGui::BeginListBox("##handling_profiles"))
|
||||
{
|
||||
for (auto& [name, profile] : g_handling_service->profiles())
|
||||
{
|
||||
|
@ -42,6 +42,22 @@ namespace big::outfit
|
||||
{8, "OUTFIT_UNK4"_T.data()}};
|
||||
};
|
||||
|
||||
inline void check_bounds_drawable(outfit_t* item)
|
||||
{
|
||||
if(item->drawable_id > item->drawable_id_max)
|
||||
item->drawable_id = item->drawable_id_max;
|
||||
if(item->drawable_id < -1)
|
||||
item->drawable_id = -1;
|
||||
}
|
||||
|
||||
inline void check_bounds_texture(outfit_t* item)
|
||||
{
|
||||
if(item->texture_id > item->texture_id_max)
|
||||
item->texture_id = item->texture_id_max;
|
||||
if(item->texture_id < -1)
|
||||
item->texture_id = -1;
|
||||
}
|
||||
|
||||
inline char* get_slot_name_address(int slot)
|
||||
{
|
||||
return script_global(2359296).at(0, 5568).at(681).at(2460).at(slot, 8).as<char*>();
|
||||
|
@ -40,7 +40,8 @@ namespace big
|
||||
// can't easily get used item count using pools, so keeping replay interface for now
|
||||
if (auto replay_interface = *g_pointers->m_gta.m_replay_interface; g.window.ingame_overlay.show_replay_interface)
|
||||
{
|
||||
ImGui::Separator();
|
||||
if (replay_interface->m_ped_interface || replay_interface->m_vehicle_interface || replay_interface->m_object_interface)
|
||||
ImGui::Separator();
|
||||
|
||||
if (replay_interface->m_ped_interface)
|
||||
ImGui::Text(std::format("Ped Pool: {}/{}",
|
||||
|
@ -10,5 +10,8 @@ namespace big
|
||||
view::active_view();
|
||||
|
||||
debug::main();
|
||||
|
||||
if (g.window.demo) // It is not the YimMenu way.
|
||||
ImGui::ShowDemoWindow(&g.window.demo);
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ namespace big
|
||||
ImGui::SetNextItemWidth(400);
|
||||
components::input_text_with_hint("", "Dictionary", ¤t_dict);
|
||||
|
||||
if (animations::has_anim_list_been_populated() && ImGui::ListBoxHeader("##dictionaries", ImVec2(400, 200)))
|
||||
if (animations::has_anim_list_been_populated() && ImGui::BeginListBox("##dictionaries", ImVec2(400, 200)))
|
||||
{
|
||||
for (auto& entry : animations::all_dicts)
|
||||
{
|
||||
@ -45,10 +45,10 @@ namespace big
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::ListBoxFooter();
|
||||
ImGui::EndListBox();
|
||||
}
|
||||
|
||||
if (selected_dict_anim_list.size() > 0 && ImGui::ListBoxHeader("##animations", ImVec2(400, 200)))
|
||||
if (selected_dict_anim_list.size() > 0 && ImGui::BeginListBox("##animations", ImVec2(400, 200)))
|
||||
{
|
||||
for (auto& entry : selected_dict_anim_list)
|
||||
{
|
||||
@ -63,7 +63,7 @@ namespace big
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::ListBoxFooter();
|
||||
ImGui::EndListBox();
|
||||
}
|
||||
|
||||
components::button("Stop", [] {
|
||||
|
@ -82,6 +82,8 @@ namespace big
|
||||
g_notification_service->push_error("Find safe pos", "Failed to find a safe position");
|
||||
});
|
||||
|
||||
ImGui::Checkbox("ImGui Demo", &g.window.demo);
|
||||
|
||||
components::command_button<"fastquit">();
|
||||
|
||||
if (ImGui::TreeNode("ADDRESSES"_T.data()))
|
||||
|
@ -21,7 +21,7 @@ namespace big
|
||||
|
||||
if (g.debug.logs.script_event.filter_player)
|
||||
{
|
||||
ImGui::ListBoxHeader("##filter_player");
|
||||
ImGui::BeginListBox("##filter_player");
|
||||
for (const auto& [_, player] : g_player_service->players())
|
||||
{
|
||||
if (components::selectable(player->get_name(), g.debug.logs.script_event.player_id == player->id()))
|
||||
|
@ -55,7 +55,7 @@ namespace big
|
||||
if (!num_landmarks)
|
||||
num_landmarks = g_tunables_service->get_tunable<int*>(RAGE_JOAAT("HUNT_THE_BEAST_NUMBER_OF_ACTIVE_LANDMARKS"));
|
||||
|
||||
if (ImGui::ListBoxHeader("##beastlandmarks", ImVec2(400, 300)))
|
||||
if (ImGui::BeginListBox("##beastlandmarks", ImVec2(400, 300)))
|
||||
{
|
||||
for (int i = 0; i < (num_landmarks ? *num_landmarks : 10); i++)
|
||||
{
|
||||
@ -71,7 +71,7 @@ namespace big
|
||||
teleport::teleport_player_to_coords(g.player.spectating ? beast : g_player_service->get_self(), script_local_land_mark);
|
||||
});
|
||||
}
|
||||
ImGui::ListBoxFooter();
|
||||
ImGui::EndListBox();
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -22,7 +22,7 @@ namespace big
|
||||
{
|
||||
ImGui::BeginGroup();
|
||||
components::sub_title("Rid joiner");
|
||||
if (ImGui::ListBoxHeader("##ridjoiner", get_listbox_dimensions()))
|
||||
if (ImGui::BeginListBox("##ridjoiner", get_listbox_dimensions()))
|
||||
{
|
||||
static uint64_t rid = 0;
|
||||
static char username[20];
|
||||
@ -58,7 +58,7 @@ namespace big
|
||||
});
|
||||
|
||||
ImGui::PopItemWidth();
|
||||
ImGui::ListBoxFooter();
|
||||
ImGui::EndListBox();
|
||||
}
|
||||
ImGui::EndGroup();
|
||||
}
|
||||
@ -67,7 +67,7 @@ namespace big
|
||||
{
|
||||
ImGui::BeginGroup();
|
||||
components::sub_title("SESSION_SWITCHER"_T);
|
||||
if (ImGui::ListBoxHeader("###session_switch", get_listbox_dimensions()))
|
||||
if (ImGui::BeginListBox("###session_switch", get_listbox_dimensions()))
|
||||
{
|
||||
if (ImGui::BeginCombo("##regionswitcher", "Regions"))
|
||||
{
|
||||
@ -99,7 +99,7 @@ namespace big
|
||||
ImGui::BeginGroup();
|
||||
|
||||
components::sub_title("Misc");
|
||||
if (ImGui::ListBoxHeader("##miscsession", get_listbox_dimensions()))
|
||||
if (ImGui::BeginListBox("##miscsession", get_listbox_dimensions()))
|
||||
{
|
||||
ImGui::Checkbox("Join Sctv", &g.session.join_in_sctv_slots); //CHANGE TRANSLATION JOIN_IN_SCTV
|
||||
if (ImGui::IsItemHovered())
|
||||
@ -122,7 +122,7 @@ namespace big
|
||||
|
||||
components::script_patch_checkbox("REVEAL_OTR_PLAYERS"_T, &g.session.decloak_players);
|
||||
|
||||
ImGui::ListBoxFooter();
|
||||
ImGui::EndListBox();
|
||||
}
|
||||
|
||||
ImGui::EndGroup();
|
||||
@ -133,7 +133,7 @@ namespace big
|
||||
ImGui::BeginGroup();
|
||||
|
||||
components::sub_title("Chat");
|
||||
if (ImGui::ListBoxHeader("##chat", get_listbox_dimensions()))
|
||||
if (ImGui::BeginListBox("##chat", get_listbox_dimensions()))
|
||||
{
|
||||
static char msg[256];
|
||||
ImGui::Checkbox("AUTO_KICK_CHAT_SPAMMERS"_T.data(), &g.session.kick_chat_spammers);
|
||||
@ -182,7 +182,7 @@ namespace big
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::ListBoxFooter();
|
||||
ImGui::EndListBox();
|
||||
}
|
||||
|
||||
ImGui::EndGroup();
|
||||
@ -193,7 +193,7 @@ namespace big
|
||||
ImGui::BeginGroup();
|
||||
|
||||
components::sub_title("Globals");
|
||||
if (ImGui::ListBoxHeader("##globals", get_listbox_dimensions()))
|
||||
if (ImGui::BeginListBox("##globals", get_listbox_dimensions()))
|
||||
{
|
||||
static int global_wanted_level = 0;
|
||||
|
||||
@ -220,7 +220,7 @@ namespace big
|
||||
scr_globals::globalplayer_bd.as<GlobalPlayerBD*>()->Entries[self::id].RemoteWantedLevelAmount = global_wanted_level;
|
||||
}
|
||||
|
||||
ImGui::ListBoxFooter();
|
||||
ImGui::EndListBox();
|
||||
}
|
||||
|
||||
ImGui::EndGroup();
|
||||
@ -482,4 +482,4 @@ namespace big
|
||||
ImGui::SameLine();
|
||||
components::script_patch_checkbox("Block CEO Raids", &g.session.block_ceo_raids, "For the entire session");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ namespace big
|
||||
ImGui::SetNextItemWidth(300.f);
|
||||
components::input_text_with_hint("PLAYER"_T, "SEARCH"_T, search, sizeof(search), ImGuiInputTextFlags_None);
|
||||
|
||||
if (ImGui::ListBoxHeader("###players", {180, static_cast<float>(*g_pointers->m_gta.m_resolution_y - 400 - 38 * 4)}))
|
||||
if (ImGui::BeginListBox("###players", {180, static_cast<float>(*g_pointers->m_gta.m_resolution_y - 400 - 38 * 4)}))
|
||||
{
|
||||
auto& item_arr = g_player_database_service->get_sorted_players();
|
||||
if (item_arr.size() > 0)
|
||||
@ -91,7 +91,7 @@ namespace big
|
||||
ImGui::Text("NO_STORED_PLAYERS"_T.data());
|
||||
}
|
||||
|
||||
ImGui::ListBoxFooter();
|
||||
ImGui::EndListBox();
|
||||
}
|
||||
|
||||
if (auto selected = g_player_database_service->get_selected())
|
||||
|
@ -23,7 +23,7 @@ namespace big
|
||||
|
||||
ImGui::SetNextItemWidth(300.f);
|
||||
|
||||
if (ImGui::ListBoxHeader("###sessions", {300, static_cast<float>(*g_pointers->m_gta.m_resolution_y - 400 - 38 * 4)}))
|
||||
if (ImGui::BeginListBox("###sessions", {300, static_cast<float>(*g_pointers->m_gta.m_resolution_y - 400 - 38 * 4)}))
|
||||
{
|
||||
if (g_matchmaking_service->get_num_found_sessions())
|
||||
{
|
||||
@ -56,7 +56,7 @@ namespace big
|
||||
ImGui::Text("NO_SESSIONS"_T.data());
|
||||
}
|
||||
|
||||
ImGui::ListBoxFooter();
|
||||
ImGui::EndListBox();
|
||||
}
|
||||
|
||||
if (selected_session_idx != -1)
|
||||
|
@ -16,7 +16,7 @@ namespace big
|
||||
ImGui::BeginGroup();
|
||||
components::sub_title("Info");
|
||||
|
||||
if (ImGui::ListBoxHeader("##infobox", get_listbox_dimensions()))
|
||||
if (ImGui::BeginListBox("##infobox", get_listbox_dimensions()))
|
||||
{
|
||||
uint32_t ped_damage_bits = 0;
|
||||
uint32_t ped_task_flag = 0;
|
||||
@ -203,7 +203,7 @@ namespace big
|
||||
ImGui::PopID();
|
||||
}
|
||||
|
||||
ImGui::ListBoxFooter();
|
||||
ImGui::EndListBox();
|
||||
}
|
||||
ImGui::EndGroup();
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ namespace big
|
||||
{
|
||||
ImGui::BeginGroup();
|
||||
components::sub_title("Kick");
|
||||
if (ImGui::ListBoxHeader("##kick", get_listbox_dimensions()))
|
||||
if (ImGui::BeginListBox("##kick", get_listbox_dimensions()))
|
||||
{
|
||||
auto const is_session_host = [] {
|
||||
return gta_util::get_network()->m_game_session_ptr->is_host();
|
||||
@ -39,7 +39,7 @@ namespace big
|
||||
ImGui::SameLine();
|
||||
components::player_command_button<"desync">(g_player_service->get_selected());
|
||||
|
||||
ImGui::ListBoxFooter();
|
||||
ImGui::EndListBox();
|
||||
}
|
||||
|
||||
ImGui::EndGroup();
|
||||
|
@ -10,7 +10,7 @@ namespace big
|
||||
{
|
||||
ImGui::BeginGroup();
|
||||
components::sub_title("Misc");
|
||||
if (ImGui::ListBoxHeader("##misc", get_listbox_dimensions()))
|
||||
if (ImGui::BeginListBox("##misc", get_listbox_dimensions()))
|
||||
{
|
||||
components::player_command_button<"joinceo">(g_player_service->get_selected());
|
||||
ImGui::SameLine();
|
||||
@ -31,7 +31,7 @@ namespace big
|
||||
ImGui::Checkbox("NEVER_WANTED"_T.data(), &g_player_service->get_selected()->never_wanted);
|
||||
ImGui::Checkbox("SEMI_GODMODE"_T.data(), &g_player_service->get_selected()->semi_godmode);
|
||||
|
||||
ImGui::ListBoxFooter();
|
||||
ImGui::EndListBox();
|
||||
}
|
||||
|
||||
ImGui::EndGroup();
|
||||
|
@ -13,7 +13,7 @@ namespace big
|
||||
|
||||
components::sub_title("Teleport");
|
||||
|
||||
if (ImGui::ListBoxHeader("##teleport", get_listbox_dimensions()))
|
||||
if (ImGui::BeginListBox("##teleport", get_listbox_dimensions()))
|
||||
{
|
||||
components::player_command_button<"playertp">(g_player_service->get_selected());
|
||||
ImGui::SameLine();
|
||||
@ -133,7 +133,7 @@ namespace big
|
||||
std::copy(std::begin(current_location), std::end(current_location), std::begin(new_location));
|
||||
}
|
||||
|
||||
ImGui::ListBoxFooter();
|
||||
ImGui::EndListBox();
|
||||
}
|
||||
ImGui::EndGroup();
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ namespace big
|
||||
{
|
||||
ImGui::BeginGroup();
|
||||
components::sub_title("Toxic");
|
||||
if (ImGui::ListBoxHeader("##toxic", get_listbox_dimensions()))
|
||||
if (ImGui::BeginListBox("##toxic", get_listbox_dimensions()))
|
||||
{
|
||||
components::player_command_button<"kill">(g_player_service->get_selected(), {});
|
||||
ImGui::SameLine();
|
||||
@ -121,7 +121,7 @@ namespace big
|
||||
troll::set_bounty_on_player(g_player_service->get_selected(), bounty_value, g.session.anonymous_bounty);
|
||||
});
|
||||
|
||||
ImGui::ListBoxFooter();
|
||||
ImGui::EndListBox();
|
||||
}
|
||||
ImGui::EndGroup();
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ namespace big
|
||||
{
|
||||
ImGui::BeginGroup();
|
||||
components::sub_title("Vehicle");
|
||||
if (ImGui::ListBoxHeader("##veh", get_listbox_dimensions()))
|
||||
if (ImGui::BeginListBox("##veh", get_listbox_dimensions()))
|
||||
{
|
||||
components::player_command_button<"vehkick">(g_player_service->get_selected(), {});
|
||||
ImGui::SameLine();
|
||||
@ -42,7 +42,7 @@ namespace big
|
||||
|
||||
components::player_command_button<"rcplayer">(g_player_service->get_selected());
|
||||
|
||||
ImGui::ListBoxFooter();
|
||||
ImGui::EndListBox();
|
||||
}
|
||||
ImGui::EndGroup();
|
||||
}
|
||||
|
@ -92,9 +92,11 @@ namespace big
|
||||
ImGui::BeginGroup();
|
||||
for (auto& item : components.items)
|
||||
{
|
||||
ImGui::SetNextItemWidth(60);
|
||||
if (ImGui::InputInt(std::format("{} [0,{}]", item.label, item.drawable_id_max).c_str(), &item.drawable_id, 0))
|
||||
ImGui::SetNextItemWidth(120);
|
||||
if (ImGui::InputInt(std::format("{} [0,{}]##1", item.label, item.drawable_id_max).c_str(), &item.drawable_id))
|
||||
{
|
||||
outfit::check_bounds_drawable(&item); // The game does this on it's own but seems to crash if we call OOB values to fast.
|
||||
|
||||
g_fiber_pool->queue_job([item] {
|
||||
PED::SET_PED_COMPONENT_VARIATION(self::ped, item.id, item.drawable_id, 0, PED::GET_PED_PALETTE_VARIATION(self::ped, item.id));
|
||||
});
|
||||
@ -107,9 +109,11 @@ namespace big
|
||||
ImGui::BeginGroup();
|
||||
for (auto& item : components.items)
|
||||
{
|
||||
ImGui::SetNextItemWidth(60);
|
||||
if (ImGui::InputInt(std::format("{} {} [0,{}]", item.label, "OUTFIT_TEX"_T, item.texture_id_max).c_str(), &item.texture_id, 0))
|
||||
ImGui::SetNextItemWidth(120);
|
||||
if (ImGui::InputInt(std::format("{} {} [0,{}]##2", item.label, "OUTFIT_TEX"_T, item.texture_id_max).c_str(), &item.texture_id))
|
||||
{
|
||||
outfit::check_bounds_texture(&item); // The game does this on it's own but seems to crash if we call OOB values to fast.
|
||||
|
||||
g_fiber_pool->queue_job([item] {
|
||||
PED::SET_PED_COMPONENT_VARIATION(self::ped, item.id, item.drawable_id, item.texture_id, PED::GET_PED_PALETTE_VARIATION(self::ped, item.id));
|
||||
});
|
||||
@ -122,9 +126,11 @@ namespace big
|
||||
ImGui::BeginGroup();
|
||||
for (auto& item : props.items)
|
||||
{
|
||||
ImGui::SetNextItemWidth(60);
|
||||
if (ImGui::InputInt(std::format("{} [0,{}]", item.label, item.drawable_id_max).c_str(), &item.drawable_id, 0))
|
||||
ImGui::SetNextItemWidth(120);
|
||||
if (ImGui::InputInt(std::format("{} [0,{}]##3", item.label, item.drawable_id_max).c_str(), &item.drawable_id))
|
||||
{
|
||||
outfit::check_bounds_drawable(&item); // The game does this on it's own but seems to crash if we call OOB values to fast.
|
||||
|
||||
g_fiber_pool->queue_job([item] {
|
||||
if (item.drawable_id == -1)
|
||||
PED::CLEAR_PED_PROP(self::ped, item.id, 1);
|
||||
@ -140,9 +146,11 @@ namespace big
|
||||
ImGui::BeginGroup();
|
||||
for (auto& item : props.items)
|
||||
{
|
||||
ImGui::SetNextItemWidth(60);
|
||||
if (ImGui::InputInt(std::format("{} {} [0,{}]", item.label, "OUTFIT_TEX"_T, item.texture_id_max).c_str(), &item.texture_id, 0))
|
||||
ImGui::SetNextItemWidth(120);
|
||||
if (ImGui::InputInt(std::format("{} {} [0,{}]##4", item.label, "OUTFIT_TEX"_T, item.texture_id_max).c_str(), &item.texture_id))
|
||||
{
|
||||
outfit::check_bounds_texture(&item); // The game does this on it's own but seems to crash if we call OOB values to fast.
|
||||
|
||||
g_fiber_pool->queue_job([item] {
|
||||
PED::SET_PED_PROP_INDEX(self::ped, item.id, item.drawable_id, item.texture_id, TRUE, 1);
|
||||
});
|
||||
|
@ -85,8 +85,8 @@ namespace big
|
||||
ImGui::BeginGroup();
|
||||
for (auto& item : components.items)
|
||||
{
|
||||
ImGui::SetNextItemWidth(60);
|
||||
ImGui::InputInt(std::format("{} [0,{}]", item.label, item.drawable_id_max).c_str(), outfit::get_component_drawable_id_address(slot, item.id), 0);
|
||||
ImGui::SetNextItemWidth(120);
|
||||
ImGui::InputInt(std::format("{} [0,{}]##1", item.label, item.drawable_id_max).c_str(), outfit::get_component_drawable_id_address(slot, item.id));
|
||||
}
|
||||
ImGui::EndGroup();
|
||||
|
||||
@ -95,8 +95,8 @@ namespace big
|
||||
ImGui::BeginGroup();
|
||||
for (auto& item : components.items)
|
||||
{
|
||||
ImGui::SetNextItemWidth(60);
|
||||
ImGui::InputInt(std::format("{} {} [0,{}]", item.label, "OUTFIT_TEX"_T, item.texture_id_max).c_str(), outfit::get_component_texture_id_address(slot, item.id), 0);
|
||||
ImGui::SetNextItemWidth(120);
|
||||
ImGui::InputInt(std::format("{} {} [0,{}]##2", item.label, "OUTFIT_TEX"_T, item.texture_id_max).c_str(), outfit::get_component_texture_id_address(slot, item.id));
|
||||
}
|
||||
ImGui::EndGroup();
|
||||
|
||||
@ -105,8 +105,8 @@ namespace big
|
||||
ImGui::BeginGroup();
|
||||
for (auto& item : props.items)
|
||||
{
|
||||
ImGui::SetNextItemWidth(60);
|
||||
ImGui::InputInt(std::format("{} [0,{}]", item.label, item.drawable_id_max).c_str(), outfit::get_prop_drawable_id_address(slot, item.id), 0);
|
||||
ImGui::SetNextItemWidth(120);
|
||||
ImGui::InputInt(std::format("{} [0,{}]##3", item.label, item.drawable_id_max).c_str(), outfit::get_prop_drawable_id_address(slot, item.id));
|
||||
}
|
||||
ImGui::EndGroup();
|
||||
|
||||
@ -115,8 +115,8 @@ namespace big
|
||||
ImGui::BeginGroup();
|
||||
for (auto& item : props.items)
|
||||
{
|
||||
ImGui::SetNextItemWidth(60);
|
||||
ImGui::InputInt(std::format("{} {} [0,{}]", item.label, "OUTFIT_TEX"_T, item.texture_id_max).c_str(), outfit::get_prop_texture_id_address(slot, item.id), 0);
|
||||
ImGui::SetNextItemWidth(120);
|
||||
ImGui::InputInt(std::format("{} {} [0,{}]##4", item.label, "OUTFIT_TEX"_T, item.texture_id_max).c_str(), outfit::get_prop_texture_id_address(slot, item.id));
|
||||
}
|
||||
ImGui::EndGroup();
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ namespace big
|
||||
ImGui::PushItemWidth(250);
|
||||
components::sub_title("Loaded Lua Scipts");
|
||||
|
||||
if (ImGui::ListBoxHeader("##empty", ImVec2(200, 200)))
|
||||
if (ImGui::BeginListBox("##empty", ImVec2(200, 200)))
|
||||
{
|
||||
auto& modules = g_lua_manager->get_modules();
|
||||
|
||||
@ -33,7 +33,7 @@ namespace big
|
||||
ImGui::Text("No scripts loaded");
|
||||
}
|
||||
|
||||
ImGui::ListBoxFooter();
|
||||
ImGui::EndListBox();
|
||||
}
|
||||
|
||||
ImGui::SameLine();
|
||||
|
@ -268,7 +268,7 @@ namespace big
|
||||
ImGui::BeginGroup();
|
||||
|
||||
components::sub_title("SLOT"_T);
|
||||
if (ImGui::ListBoxHeader("##slot", ImVec2(200, 200)))
|
||||
if (ImGui::BeginListBox("##slot", ImVec2(200, 200)))
|
||||
{
|
||||
for (const auto& [slot, name] : slot_display_names)
|
||||
{
|
||||
@ -277,7 +277,7 @@ namespace big
|
||||
selected_slot = slot;
|
||||
}
|
||||
}
|
||||
ImGui::ListBoxFooter();
|
||||
ImGui::EndListBox();
|
||||
}
|
||||
|
||||
ImGui::EndGroup();
|
||||
@ -307,7 +307,7 @@ namespace big
|
||||
ImGui::BeginGroup();
|
||||
|
||||
components::sub_title("MOD"_T);
|
||||
if (ImGui::ListBoxHeader("##mod", ImVec2(240, 200)))
|
||||
if (ImGui::BeginListBox("##mod", ImVec2(240, 200)))
|
||||
{
|
||||
for (const auto& it : mod_display_names[selected_slot])
|
||||
{
|
||||
@ -357,7 +357,7 @@ namespace big
|
||||
});
|
||||
}
|
||||
}
|
||||
ImGui::ListBoxFooter();
|
||||
ImGui::EndListBox();
|
||||
}
|
||||
|
||||
ImGui::EndGroup();
|
||||
@ -375,7 +375,7 @@ namespace big
|
||||
ImGui::BeginGroup();
|
||||
|
||||
components::sub_title("STYLE"_T);
|
||||
if (ImGui::ListBoxHeader("##style", ImVec2(200, 200)))
|
||||
if (ImGui::BeginListBox("##style", ImVec2(200, 200)))
|
||||
{
|
||||
std::string mod_name = mod_display_names[selected_slot][*wheel_stock_mod];
|
||||
auto wheel_mods = wheel_map[mod_name];
|
||||
@ -412,7 +412,7 @@ namespace big
|
||||
});
|
||||
}
|
||||
}
|
||||
ImGui::ListBoxFooter();
|
||||
ImGui::EndListBox();
|
||||
}
|
||||
|
||||
ImGui::EndGroup();
|
||||
@ -504,7 +504,7 @@ namespace big
|
||||
color_type = 8;
|
||||
}
|
||||
|
||||
if (ImGui::ListBoxHeader("##color_options", ImVec2(120, 254)))
|
||||
if (ImGui::BeginListBox("##color_options", ImVec2(120, 254)))
|
||||
{
|
||||
if (ImGui::Selectable("PRIMARY"_T.data(), color_to_change == 0, ImGuiSelectableFlags_SelectOnClick))
|
||||
{
|
||||
@ -576,7 +576,7 @@ namespace big
|
||||
color_type = 8;
|
||||
}
|
||||
|
||||
ImGui::ListBoxFooter();
|
||||
ImGui::EndListBox();
|
||||
}
|
||||
|
||||
|
||||
@ -590,7 +590,7 @@ namespace big
|
||||
// primary and secondary color
|
||||
|
||||
ImGui::SameLine();
|
||||
if (ImGui::ListBoxHeader("##colors", ImVec2(140, 254)))
|
||||
if (ImGui::BeginListBox("##colors", ImVec2(140, 254)))
|
||||
{
|
||||
if (ImGui::Selectable("CUSTOM"_T.data(), color_type == 8, ImGuiSelectableFlags_SelectOnClick))
|
||||
{
|
||||
@ -627,7 +627,7 @@ namespace big
|
||||
{
|
||||
color_type = 3;
|
||||
}
|
||||
ImGui::ListBoxFooter();
|
||||
ImGui::EndListBox();
|
||||
}
|
||||
}
|
||||
else if (color_to_change == 7)
|
||||
@ -671,7 +671,7 @@ namespace big
|
||||
if (color_to_change == 5)
|
||||
{
|
||||
ImGui::SameLine();
|
||||
if (ImGui::ListBoxHeader("##tire_smoke_rgb", ImVec2(140, 254)))
|
||||
if (ImGui::BeginListBox("##tire_smoke_rgb", ImVec2(140, 254)))
|
||||
{
|
||||
for (const auto& it : lsc_tire_smoke_rgb)
|
||||
{
|
||||
@ -689,13 +689,13 @@ namespace big
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::ListBoxFooter();
|
||||
ImGui::EndListBox();
|
||||
}
|
||||
}
|
||||
else if (color_to_change == 8)
|
||||
{
|
||||
ImGui::SameLine();
|
||||
if (ImGui::ListBoxHeader("##neon_rgb", ImVec2(140, 254)))
|
||||
if (ImGui::BeginListBox("##neon_rgb", ImVec2(140, 254)))
|
||||
{
|
||||
for (const auto& it : lsc_neon_rgb)
|
||||
{
|
||||
@ -713,7 +713,7 @@ namespace big
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::ListBoxFooter();
|
||||
ImGui::EndListBox();
|
||||
}
|
||||
}
|
||||
|
||||
@ -761,7 +761,7 @@ namespace big
|
||||
ImGui::SameLine();
|
||||
}
|
||||
|
||||
if (ImGui::ListBoxHeader("##color", ImVec2(180, 254)))
|
||||
if (ImGui::BeginListBox("##color", ImVec2(180, 254)))
|
||||
{
|
||||
switch (color_type)
|
||||
{
|
||||
@ -938,7 +938,7 @@ namespace big
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::ListBoxFooter();
|
||||
ImGui::EndListBox();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ namespace big
|
||||
ImGui::PushItemWidth(250);
|
||||
ImGui::Text("SAVED_VEHICLES"_T.data());
|
||||
|
||||
if (ImGui::ListBoxHeader("##empty", ImVec2(200, 200)))
|
||||
if (ImGui::BeginListBox("##empty", ImVec2(200, 200)))
|
||||
{
|
||||
for (const auto& pair : vehicle_files)
|
||||
{
|
||||
@ -55,7 +55,7 @@ namespace big
|
||||
selected_vehicle_file = pair;
|
||||
}
|
||||
|
||||
ImGui::ListBoxFooter();
|
||||
ImGui::EndListBox();
|
||||
}
|
||||
|
||||
ImGui::SameLine();
|
||||
|
@ -8,175 +8,175 @@
|
||||
|
||||
namespace big
|
||||
{
|
||||
void view::pv()
|
||||
{
|
||||
ImGui::SetWindowSize({0.f, (float)*g_pointers->m_gta.m_resolution_y}, ImGuiCond_Always);
|
||||
void view::pv()
|
||||
{
|
||||
ImGui::SetWindowSize({0.f, (float)*g_pointers->m_gta.m_resolution_y}, ImGuiCond_Always);
|
||||
|
||||
if (ImGui::Checkbox("PREVIEW"_T.data(), &g.clone_pv.preview_vehicle))
|
||||
{
|
||||
if (!g.clone_pv.preview_vehicle)
|
||||
{
|
||||
g_model_preview_service->stop_preview();
|
||||
}
|
||||
}
|
||||
ImGui::SameLine();
|
||||
ImGui::Checkbox("SPAWN_IN"_T.data(), &g.clone_pv.spawn_inside);
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Checkbox("PREVIEW"_T.data(), &g.clone_pv.preview_vehicle))
|
||||
{
|
||||
if (!g.clone_pv.preview_vehicle)
|
||||
{
|
||||
g_model_preview_service->stop_preview();
|
||||
}
|
||||
}
|
||||
ImGui::SameLine();
|
||||
ImGui::Checkbox("SPAWN_IN"_T.data(), &g.clone_pv.spawn_inside);
|
||||
ImGui::SameLine();
|
||||
|
||||
static char plate_buf[9] = {0};
|
||||
int num_of_rows = 3;
|
||||
static char plate_buf[9] = {0};
|
||||
int num_of_rows = 3;
|
||||
|
||||
ImGui::Checkbox("SPAWN_CLONE"_T.data(), &g.clone_pv.spawn_clone);
|
||||
if (g.clone_pv.spawn_clone)
|
||||
{
|
||||
num_of_rows = 5;
|
||||
ImGui::Checkbox("SPAWN_CLONE"_T.data(), &g.clone_pv.spawn_clone);
|
||||
if (g.clone_pv.spawn_clone)
|
||||
{
|
||||
num_of_rows = 5;
|
||||
|
||||
ImGui::Checkbox("SPAWN_MAXED"_T.data(), &g.clone_pv.spawn_maxed);
|
||||
ImGui::Checkbox("SPAWN_MAXED"_T.data(), &g.clone_pv.spawn_maxed);
|
||||
|
||||
ImGui::SameLine();
|
||||
ImGui::Checkbox("CLONE_PV_PLATE"_T.data(), &g.clone_pv.clone_plate);
|
||||
if (g.clone_pv.clone_plate)
|
||||
{
|
||||
num_of_rows = 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
ImGui::SetNextItemWidth(300.f);
|
||||
ImGui::SameLine();
|
||||
ImGui::Checkbox("CLONE_PV_PLATE"_T.data(), &g.clone_pv.clone_plate);
|
||||
if (g.clone_pv.clone_plate)
|
||||
{
|
||||
num_of_rows = 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
ImGui::SetNextItemWidth(300.f);
|
||||
|
||||
strncpy(plate_buf, g.clone_pv.plate.c_str(), 9);
|
||||
components::input_text_with_hint("PLATE"_T, "PLATE_NUMBER"_T, plate_buf, sizeof(plate_buf), ImGuiInputTextFlags_None, [] {
|
||||
g.clone_pv.plate = plate_buf;
|
||||
});
|
||||
}
|
||||
}
|
||||
strncpy(plate_buf, g.clone_pv.plate.c_str(), 9);
|
||||
components::input_text_with_hint("PLATE"_T, "PLATE_NUMBER"_T, plate_buf, sizeof(plate_buf), ImGuiInputTextFlags_None, [] {
|
||||
g.clone_pv.plate = plate_buf;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int selected_class = -1;
|
||||
const auto& class_arr = g_gta_data_service->vehicle_classes();
|
||||
static int selected_class = -1;
|
||||
const auto& class_arr = g_gta_data_service->vehicle_classes();
|
||||
|
||||
ImGui::SetNextItemWidth(300.f);
|
||||
if (ImGui::BeginCombo("VEHICLE_CLASS"_T.data(),
|
||||
selected_class == -1 ? "ALL"_T.data() : class_arr[selected_class].c_str()))
|
||||
{
|
||||
if (ImGui::Selectable("ALL"_T.data(), selected_class == -1))
|
||||
{
|
||||
selected_class = -1;
|
||||
}
|
||||
ImGui::SetNextItemWidth(300.f);
|
||||
if (ImGui::BeginCombo("VEHICLE_CLASS"_T.data(),
|
||||
selected_class == -1 ? "ALL"_T.data() : class_arr[selected_class].c_str()))
|
||||
{
|
||||
if (ImGui::Selectable("ALL"_T.data(), selected_class == -1))
|
||||
{
|
||||
selected_class = -1;
|
||||
}
|
||||
|
||||
for (int i = 0; i < class_arr.size(); i++)
|
||||
{
|
||||
if (ImGui::Selectable(class_arr[i].c_str(), selected_class == i))
|
||||
{
|
||||
selected_class = i;
|
||||
}
|
||||
for (int i = 0; i < class_arr.size(); i++)
|
||||
{
|
||||
if (ImGui::Selectable(class_arr[i].c_str(), selected_class == i))
|
||||
{
|
||||
selected_class = i;
|
||||
}
|
||||
|
||||
if (selected_class == i)
|
||||
{
|
||||
ImGui::SetItemDefaultFocus();
|
||||
}
|
||||
}
|
||||
if (selected_class == i)
|
||||
{
|
||||
ImGui::SetItemDefaultFocus();
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
|
||||
|
||||
static char search[64];
|
||||
static char search[64];
|
||||
|
||||
ImGui::SetNextItemWidth(300.f);
|
||||
components::input_text_with_hint("MODEL_NAME"_T, "SEARCH"_T, search, sizeof(search), ImGuiInputTextFlags_None);
|
||||
ImGui::SetNextItemWidth(300.f);
|
||||
components::input_text_with_hint("MODEL_NAME"_T, "SEARCH"_T, search, sizeof(search), ImGuiInputTextFlags_None);
|
||||
|
||||
g_mobile_service->refresh_personal_vehicles();
|
||||
if (ImGui::ListBoxHeader("###personal_veh_list", {300, static_cast<float>(*g_pointers->m_gta.m_resolution_y - 188 - 38 * num_of_rows)}))
|
||||
{
|
||||
if (g_mobile_service->personal_vehicles().empty())
|
||||
{
|
||||
ImGui::Text("NO_PERSONAL_VEHICLES"_T.data());
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string lower_search = search;
|
||||
std::transform(lower_search.begin(), lower_search.end(), lower_search.begin(), tolower);
|
||||
g_mobile_service->refresh_personal_vehicles();
|
||||
if (ImGui::BeginListBox("###personal_veh_list", {300, static_cast<float>(*g_pointers->m_gta.m_resolution_y - 188 - 38 * num_of_rows)}))
|
||||
{
|
||||
if (g_mobile_service->personal_vehicles().empty())
|
||||
{
|
||||
ImGui::Text("NO_PERSONAL_VEHICLES"_T.data());
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string lower_search = search;
|
||||
std::transform(lower_search.begin(), lower_search.end(), lower_search.begin(), tolower);
|
||||
|
||||
for (const auto& it : g_mobile_service->personal_vehicles())
|
||||
{
|
||||
const auto& label = it.first;
|
||||
const auto& personal_veh = it.second;
|
||||
const auto& item = g_gta_data_service->vehicle_by_hash(personal_veh->get_hash());
|
||||
for (const auto& it : g_mobile_service->personal_vehicles())
|
||||
{
|
||||
const auto& label = it.first;
|
||||
const auto& personal_veh = it.second;
|
||||
const auto& item = g_gta_data_service->vehicle_by_hash(personal_veh->get_hash());
|
||||
|
||||
std::string vehicle_class = item.m_vehicle_class;
|
||||
std::string display_name = label;
|
||||
std::string display_manufacturer = item.m_display_manufacturer;
|
||||
std::transform(display_name.begin(), display_name.end(), display_name.begin(), ::tolower);
|
||||
std::transform(display_manufacturer.begin(), display_manufacturer.end(), display_manufacturer.begin(), ::tolower);
|
||||
std::string vehicle_class = item.m_vehicle_class;
|
||||
std::string display_name = label;
|
||||
std::string display_manufacturer = item.m_display_manufacturer;
|
||||
std::transform(display_name.begin(), display_name.end(), display_name.begin(), ::tolower);
|
||||
std::transform(display_manufacturer.begin(), display_manufacturer.end(), display_manufacturer.begin(), ::tolower);
|
||||
|
||||
if ((selected_class == -1 || class_arr[selected_class] == vehicle_class)
|
||||
&& (display_name.find(lower_search) != std::string::npos || display_manufacturer.find(lower_search) != std::string::npos))
|
||||
{
|
||||
ImGui::PushID('v' << 24 & personal_veh->get_id());
|
||||
components::selectable(label, false, [&personal_veh] {
|
||||
if (g.clone_pv.spawn_clone)
|
||||
{
|
||||
Vector3 spawn_location =
|
||||
vehicle::get_spawn_location(g.spawn_vehicle.spawn_inside, personal_veh->get_hash());
|
||||
float spawn_heading = ENTITY::GET_ENTITY_HEADING(self::ped);
|
||||
if ((selected_class == -1 || class_arr[selected_class] == vehicle_class)
|
||||
&& (display_name.find(lower_search) != std::string::npos || display_manufacturer.find(lower_search) != std::string::npos))
|
||||
{
|
||||
ImGui::PushID('v' << 24 & personal_veh->get_id());
|
||||
components::selectable(label, false, [&personal_veh] {
|
||||
if (g.clone_pv.spawn_clone)
|
||||
{
|
||||
Vector3 spawn_location =
|
||||
vehicle::get_spawn_location(g.spawn_vehicle.spawn_inside, personal_veh->get_hash());
|
||||
float spawn_heading = ENTITY::GET_ENTITY_HEADING(self::ped);
|
||||
|
||||
auto vehicle_idx = personal_veh->get_vehicle_idx();
|
||||
auto owned_mods = vehicle::get_owned_mods_from_vehicle_idx(vehicle_idx);
|
||||
auto vehicle_idx = personal_veh->get_vehicle_idx();
|
||||
auto owned_mods = vehicle::get_owned_mods_from_vehicle_idx(vehicle_idx);
|
||||
|
||||
const char* spawn_plate_buf = plate_buf;
|
||||
if (g.clone_pv.clone_plate)
|
||||
{
|
||||
spawn_plate_buf = personal_veh->get_plate();
|
||||
}
|
||||
const char* spawn_plate_buf = plate_buf;
|
||||
if (g.clone_pv.clone_plate)
|
||||
{
|
||||
spawn_plate_buf = personal_veh->get_plate();
|
||||
}
|
||||
|
||||
auto veh = vehicle::clone_from_owned_mods(owned_mods, spawn_location, spawn_heading);
|
||||
auto veh = vehicle::clone_from_owned_mods(owned_mods, spawn_location, spawn_heading);
|
||||
|
||||
if (veh == 0)
|
||||
{
|
||||
g_notification_service->push_error("VEHICLE"_T.data(), "UNABLE_TO_SPAWN_VEHICLE"_T.data());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (g.clone_pv.spawn_maxed)
|
||||
{
|
||||
vehicle::max_vehicle(veh);
|
||||
}
|
||||
if (veh == 0)
|
||||
{
|
||||
g_notification_service->push_error("VEHICLE"_T.data(), "UNABLE_TO_SPAWN_VEHICLE"_T.data());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (g.clone_pv.spawn_maxed)
|
||||
{
|
||||
vehicle::max_vehicle(veh);
|
||||
}
|
||||
|
||||
vehicle::set_plate(veh, spawn_plate_buf);
|
||||
vehicle::set_plate(veh, spawn_plate_buf);
|
||||
|
||||
if (g.clone_pv.spawn_inside)
|
||||
{
|
||||
vehicle::teleport_into_vehicle(veh);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(search, "");
|
||||
personal_veh->summon();
|
||||
}
|
||||
if (g.clone_pv.spawn_inside)
|
||||
{
|
||||
vehicle::teleport_into_vehicle(veh);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(search, "");
|
||||
personal_veh->summon();
|
||||
}
|
||||
|
||||
g_model_preview_service->stop_preview();
|
||||
});
|
||||
ImGui::PopID();
|
||||
g_model_preview_service->stop_preview();
|
||||
});
|
||||
ImGui::PopID();
|
||||
|
||||
if (!g.clone_pv.preview_vehicle || (g.clone_pv.preview_vehicle && !ImGui::IsAnyItemHovered()))
|
||||
{
|
||||
g_model_preview_service->stop_preview();
|
||||
}
|
||||
else if (ImGui::IsItemHovered())
|
||||
{
|
||||
g_fiber_pool->queue_job([&personal_veh] {
|
||||
g_model_preview_service->show_vehicle(
|
||||
vehicle::get_owned_mods_from_vehicle_idx(personal_veh->get_vehicle_idx()),
|
||||
g.clone_pv.spawn_maxed);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!g.clone_pv.preview_vehicle || (g.clone_pv.preview_vehicle && !ImGui::IsAnyItemHovered()))
|
||||
{
|
||||
g_model_preview_service->stop_preview();
|
||||
}
|
||||
else if (ImGui::IsItemHovered())
|
||||
{
|
||||
g_fiber_pool->queue_job([&personal_veh] {
|
||||
g_model_preview_service->show_vehicle(
|
||||
vehicle::get_owned_mods_from_vehicle_idx(personal_veh->get_vehicle_idx()),
|
||||
g.clone_pv.spawn_maxed);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::ListBoxFooter();
|
||||
}
|
||||
}
|
||||
ImGui::EndListBox();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,193 +7,193 @@
|
||||
|
||||
namespace big
|
||||
{
|
||||
void view::spawn_vehicle()
|
||||
{
|
||||
ImGui::SetWindowSize({0.f, (float)*g_pointers->m_gta.m_resolution_y}, ImGuiCond_Always);
|
||||
void view::spawn_vehicle()
|
||||
{
|
||||
ImGui::SetWindowSize({0.f, (float)*g_pointers->m_gta.m_resolution_y}, ImGuiCond_Always);
|
||||
|
||||
if (ImGui::Checkbox("PREVIEW"_T.data(), &g.spawn_vehicle.preview_vehicle))
|
||||
{
|
||||
if (!g.spawn_vehicle.preview_vehicle)
|
||||
{
|
||||
g_model_preview_service->stop_preview();
|
||||
}
|
||||
}
|
||||
ImGui::SameLine();
|
||||
components::command_checkbox<"spawnin">();
|
||||
ImGui::SameLine();
|
||||
components::command_checkbox<"spawnmaxed">();
|
||||
if (ImGui::Checkbox("PREVIEW"_T.data(), &g.spawn_vehicle.preview_vehicle))
|
||||
{
|
||||
if (!g.spawn_vehicle.preview_vehicle)
|
||||
{
|
||||
g_model_preview_service->stop_preview();
|
||||
}
|
||||
}
|
||||
ImGui::SameLine();
|
||||
components::command_checkbox<"spawnin">();
|
||||
ImGui::SameLine();
|
||||
components::command_checkbox<"spawnmaxed">();
|
||||
|
||||
static char plate_buf[9] = {0};
|
||||
strncpy(plate_buf, g.spawn_vehicle.plate.c_str(), 9);
|
||||
static char plate_buf[9] = {0};
|
||||
strncpy(plate_buf, g.spawn_vehicle.plate.c_str(), 9);
|
||||
|
||||
ImGui::SetNextItemWidth(300.f);
|
||||
components::input_text_with_hint("PLATE"_T, "PLATE_NUMBER"_T, plate_buf, sizeof(plate_buf), ImGuiInputTextFlags_None, [] {
|
||||
g.spawn_vehicle.plate = plate_buf;
|
||||
});
|
||||
ImGui::SetNextItemWidth(300.f);
|
||||
components::input_text_with_hint("PLATE"_T, "PLATE_NUMBER"_T, plate_buf, sizeof(plate_buf), ImGuiInputTextFlags_None, [] {
|
||||
g.spawn_vehicle.plate = plate_buf;
|
||||
});
|
||||
|
||||
static int selected_class = -1;
|
||||
const auto& class_arr = g_gta_data_service->vehicle_classes();
|
||||
static int selected_class = -1;
|
||||
const auto& class_arr = g_gta_data_service->vehicle_classes();
|
||||
|
||||
ImGui::SetNextItemWidth(300.f);
|
||||
if (ImGui::BeginCombo("VEHICLE_CLASS"_T.data(),
|
||||
selected_class == -1 ? "ALL"_T.data() : class_arr[selected_class].c_str()))
|
||||
{
|
||||
if (ImGui::Selectable("ALL"_T.data(), selected_class == -1))
|
||||
{
|
||||
selected_class = -1;
|
||||
}
|
||||
ImGui::SetNextItemWidth(300.f);
|
||||
if (ImGui::BeginCombo("VEHICLE_CLASS"_T.data(),
|
||||
selected_class == -1 ? "ALL"_T.data() : class_arr[selected_class].c_str()))
|
||||
{
|
||||
if (ImGui::Selectable("ALL"_T.data(), selected_class == -1))
|
||||
{
|
||||
selected_class = -1;
|
||||
}
|
||||
|
||||
for (int i = 0; i < class_arr.size(); i++)
|
||||
{
|
||||
if (ImGui::Selectable(class_arr[i].c_str(), selected_class == i))
|
||||
{
|
||||
selected_class = i;
|
||||
}
|
||||
for (int i = 0; i < class_arr.size(); i++)
|
||||
{
|
||||
if (ImGui::Selectable(class_arr[i].c_str(), selected_class == i))
|
||||
{
|
||||
selected_class = i;
|
||||
}
|
||||
|
||||
if (selected_class == i)
|
||||
{
|
||||
ImGui::SetItemDefaultFocus();
|
||||
}
|
||||
}
|
||||
if (selected_class == i)
|
||||
{
|
||||
ImGui::SetItemDefaultFocus();
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
|
||||
|
||||
static char search[64];
|
||||
static char search[64];
|
||||
|
||||
ImGui::SetNextItemWidth(300.f);
|
||||
components::input_text_with_hint("MODEL_NAME"_T, "SEARCH"_T, search, sizeof(search), ImGuiInputTextFlags_None);
|
||||
ImGui::SetNextItemWidth(300.f);
|
||||
components::input_text_with_hint("MODEL_NAME"_T, "SEARCH"_T, search, sizeof(search), ImGuiInputTextFlags_None);
|
||||
|
||||
|
||||
if (ImGui::ListBoxHeader("###vehicles", {300, static_cast<float>(*g_pointers->m_gta.m_resolution_y - 188 - 38 * 4)}))
|
||||
{
|
||||
if (self::veh)
|
||||
{
|
||||
static auto veh_hash = 0;
|
||||
if (ImGui::BeginListBox("###vehicles", {300, static_cast<float>(*g_pointers->m_gta.m_resolution_y - 188 - 38 * 4)}))
|
||||
{
|
||||
if (self::veh)
|
||||
{
|
||||
static auto veh_hash = 0;
|
||||
|
||||
g_fiber_pool->queue_job([] {
|
||||
veh_hash = ENTITY::GET_ENTITY_MODEL(self::veh);
|
||||
});
|
||||
g_fiber_pool->queue_job([] {
|
||||
veh_hash = ENTITY::GET_ENTITY_MODEL(self::veh);
|
||||
});
|
||||
|
||||
if (veh_hash)
|
||||
{
|
||||
const auto& item = g_gta_data_service->vehicle_by_hash(veh_hash);
|
||||
if (veh_hash)
|
||||
{
|
||||
const auto& item = g_gta_data_service->vehicle_by_hash(veh_hash);
|
||||
|
||||
components::selectable(std::vformat("SPAWN_VEHICLE_CURRENT_VEHICLE"_T, std::make_format_args(item.m_display_name)), false, [] {
|
||||
if (self::veh)
|
||||
{
|
||||
Vector3 spawn_location = vehicle::get_spawn_location(g.spawn_vehicle.spawn_inside, veh_hash);
|
||||
float spawn_heading = ENTITY::GET_ENTITY_HEADING(self::ped);
|
||||
components::selectable(std::vformat("SPAWN_VEHICLE_CURRENT_VEHICLE"_T, std::make_format_args(item.m_display_name)), false, [] {
|
||||
if (self::veh)
|
||||
{
|
||||
Vector3 spawn_location = vehicle::get_spawn_location(g.spawn_vehicle.spawn_inside, veh_hash);
|
||||
float spawn_heading = ENTITY::GET_ENTITY_HEADING(self::ped);
|
||||
|
||||
auto owned_mods = vehicle::get_owned_mods_from_vehicle(self::veh);
|
||||
auto owned_mods = vehicle::get_owned_mods_from_vehicle(self::veh);
|
||||
|
||||
auto veh = vehicle::clone_from_owned_mods(owned_mods, spawn_location, spawn_heading);
|
||||
auto veh = vehicle::clone_from_owned_mods(owned_mods, spawn_location, spawn_heading);
|
||||
|
||||
if (veh == 0)
|
||||
{
|
||||
g_notification_service->push_error("VEHICLE"_T.data(), "UNABLE_TO_SPAWN_VEHICLE"_T.data());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (g.spawn_vehicle.spawn_maxed)
|
||||
{
|
||||
vehicle::max_vehicle(veh);
|
||||
}
|
||||
if (veh == 0)
|
||||
{
|
||||
g_notification_service->push_error("VEHICLE"_T.data(), "UNABLE_TO_SPAWN_VEHICLE"_T.data());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (g.spawn_vehicle.spawn_maxed)
|
||||
{
|
||||
vehicle::max_vehicle(veh);
|
||||
}
|
||||
|
||||
vehicle::set_plate(veh, plate_buf);
|
||||
vehicle::set_plate(veh, plate_buf);
|
||||
|
||||
if (g.spawn_vehicle.spawn_inside)
|
||||
{
|
||||
vehicle::teleport_into_vehicle(veh);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (g.spawn_vehicle.spawn_inside)
|
||||
{
|
||||
vehicle::teleport_into_vehicle(veh);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
g_model_preview_service->stop_preview();
|
||||
});
|
||||
g_model_preview_service->stop_preview();
|
||||
});
|
||||
|
||||
if (!g.spawn_vehicle.preview_vehicle || (g.spawn_vehicle.preview_vehicle && !ImGui::IsAnyItemHovered()))
|
||||
{
|
||||
g_model_preview_service->stop_preview();
|
||||
}
|
||||
else if (ImGui::IsItemHovered())
|
||||
{
|
||||
g_fiber_pool->queue_job([] {
|
||||
g_model_preview_service->show_vehicle(vehicle::get_owned_mods_from_vehicle(self::veh),
|
||||
g.spawn_vehicle.spawn_maxed);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!g.spawn_vehicle.preview_vehicle || (g.spawn_vehicle.preview_vehicle && !ImGui::IsAnyItemHovered()))
|
||||
{
|
||||
g_model_preview_service->stop_preview();
|
||||
}
|
||||
else if (ImGui::IsItemHovered())
|
||||
{
|
||||
g_fiber_pool->queue_job([] {
|
||||
g_model_preview_service->show_vehicle(vehicle::get_owned_mods_from_vehicle(self::veh),
|
||||
g.spawn_vehicle.spawn_maxed);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const auto& item_arr = g_gta_data_service->vehicles();
|
||||
if (item_arr.size() > 0)
|
||||
{
|
||||
std::string lower_search = search;
|
||||
std::transform(lower_search.begin(), lower_search.end(), lower_search.begin(), tolower);
|
||||
const auto& item_arr = g_gta_data_service->vehicles();
|
||||
if (item_arr.size() > 0)
|
||||
{
|
||||
std::string lower_search = search;
|
||||
std::transform(lower_search.begin(), lower_search.end(), lower_search.begin(), tolower);
|
||||
|
||||
for (auto& item : item_arr)
|
||||
{
|
||||
const auto& vehicle = item.second;
|
||||
for (auto& item : item_arr)
|
||||
{
|
||||
const auto& vehicle = item.second;
|
||||
|
||||
std::string display_name = vehicle.m_display_name;
|
||||
std::string display_manufacturer = vehicle.m_display_manufacturer;
|
||||
std::string clazz = vehicle.m_vehicle_class;
|
||||
std::string display_name = vehicle.m_display_name;
|
||||
std::string display_manufacturer = vehicle.m_display_manufacturer;
|
||||
std::string clazz = vehicle.m_vehicle_class;
|
||||
|
||||
std::transform(display_name.begin(), display_name.end(), display_name.begin(), ::tolower);
|
||||
std::transform(display_manufacturer.begin(), display_manufacturer.end(), display_manufacturer.begin(), ::tolower);
|
||||
std::transform(display_name.begin(), display_name.end(), display_name.begin(), ::tolower);
|
||||
std::transform(display_manufacturer.begin(), display_manufacturer.end(), display_manufacturer.begin(), ::tolower);
|
||||
|
||||
if ((selected_class == -1 || class_arr[selected_class] == clazz)
|
||||
&& (display_name.find(lower_search) != std::string::npos || display_manufacturer.find(lower_search) != std::string::npos))
|
||||
{
|
||||
ImGui::PushID(vehicle.m_hash);
|
||||
components::selectable(vehicle.m_display_name, false, [&vehicle] {
|
||||
const auto spawn_location =
|
||||
vehicle::get_spawn_location(g.spawn_vehicle.spawn_inside, vehicle.m_hash);
|
||||
const auto spawn_heading = ENTITY::GET_ENTITY_HEADING(self::ped);
|
||||
if ((selected_class == -1 || class_arr[selected_class] == clazz)
|
||||
&& (display_name.find(lower_search) != std::string::npos || display_manufacturer.find(lower_search) != std::string::npos))
|
||||
{
|
||||
ImGui::PushID(vehicle.m_hash);
|
||||
components::selectable(vehicle.m_display_name, false, [&vehicle] {
|
||||
const auto spawn_location =
|
||||
vehicle::get_spawn_location(g.spawn_vehicle.spawn_inside, vehicle.m_hash);
|
||||
const auto spawn_heading = ENTITY::GET_ENTITY_HEADING(self::ped);
|
||||
|
||||
const auto veh = vehicle::spawn(vehicle.m_hash, spawn_location, spawn_heading);
|
||||
const auto veh = vehicle::spawn(vehicle.m_hash, spawn_location, spawn_heading);
|
||||
|
||||
if (veh == 0)
|
||||
{
|
||||
g_notification_service->push_error("VEHICLE"_T.data(), "UNABLE_TO_SPAWN_VEHICLE"_T.data());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (g.spawn_vehicle.spawn_maxed)
|
||||
{
|
||||
vehicle::max_vehicle(veh);
|
||||
}
|
||||
if (veh == 0)
|
||||
{
|
||||
g_notification_service->push_error("VEHICLE"_T.data(), "UNABLE_TO_SPAWN_VEHICLE"_T.data());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (g.spawn_vehicle.spawn_maxed)
|
||||
{
|
||||
vehicle::max_vehicle(veh);
|
||||
}
|
||||
|
||||
vehicle::set_plate(veh, plate_buf);
|
||||
vehicle::set_plate(veh, plate_buf);
|
||||
|
||||
if (g.spawn_vehicle.spawn_inside)
|
||||
{
|
||||
vehicle::teleport_into_vehicle(veh);
|
||||
}
|
||||
}
|
||||
if (g.spawn_vehicle.spawn_inside)
|
||||
{
|
||||
vehicle::teleport_into_vehicle(veh);
|
||||
}
|
||||
}
|
||||
|
||||
g_model_preview_service->stop_preview();
|
||||
});
|
||||
ImGui::PopID();
|
||||
g_model_preview_service->stop_preview();
|
||||
});
|
||||
ImGui::PopID();
|
||||
|
||||
if (!g.spawn_vehicle.preview_vehicle || (g.spawn_vehicle.preview_vehicle && !ImGui::IsAnyItemHovered()))
|
||||
{
|
||||
g_model_preview_service->stop_preview();
|
||||
}
|
||||
else if (ImGui::IsItemHovered())
|
||||
{
|
||||
g_model_preview_service->show_vehicle(vehicle.m_hash, g.spawn_vehicle.spawn_maxed);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ImGui::Text("NO_VEHICLE_IN_REGISTRY"_T.data());
|
||||
}
|
||||
ImGui::ListBoxFooter();
|
||||
}
|
||||
}
|
||||
if (!g.spawn_vehicle.preview_vehicle || (g.spawn_vehicle.preview_vehicle && !ImGui::IsAnyItemHovered()))
|
||||
{
|
||||
g_model_preview_service->stop_preview();
|
||||
}
|
||||
else if (ImGui::IsItemHovered())
|
||||
{
|
||||
g_model_preview_service->show_vehicle(vehicle.m_hash, g.spawn_vehicle.spawn_maxed);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ImGui::Text("NO_VEHICLE_IN_REGISTRY"_T.data());
|
||||
}
|
||||
ImGui::EndListBox();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ namespace big
|
||||
ImGui::PushItemWidth(250);
|
||||
components::sub_title("CREATOR_SAVED_JOBS"_T);
|
||||
|
||||
if (ImGui::ListBoxHeader("##empty", ImVec2(200, 200)))
|
||||
if (ImGui::BeginListBox("##empty", ImVec2(200, 200)))
|
||||
{
|
||||
for (const auto& pair : creator_files)
|
||||
{
|
||||
@ -31,7 +31,7 @@ namespace big
|
||||
selected_creator_file = pair;
|
||||
}
|
||||
|
||||
ImGui::ListBoxFooter();
|
||||
ImGui::EndListBox();
|
||||
}
|
||||
|
||||
ImGui::SameLine();
|
||||
|
@ -121,7 +121,7 @@ namespace big
|
||||
|
||||
if (!new_template.m_ped_model.empty() && ped_found == g_gta_data_service->peds().end())
|
||||
{
|
||||
if (ImGui::ListBoxHeader("##pedlist", ImVec2(250, 200)))
|
||||
if (ImGui::BeginListBox("##pedlist", ImVec2(250, 200)))
|
||||
{
|
||||
for (auto& p : g_gta_data_service->peds() | std::ranges::views::values)
|
||||
{
|
||||
@ -135,7 +135,7 @@ namespace big
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::ListBoxFooter();
|
||||
ImGui::EndListBox();
|
||||
}
|
||||
}
|
||||
|
||||
@ -149,7 +149,7 @@ namespace big
|
||||
|
||||
if (!new_template.m_vehicle_model.empty() && veh_found == g_gta_data_service->vehicles().end())
|
||||
{
|
||||
if (ImGui::ListBoxHeader("##vehlist", ImVec2(250, 200)))
|
||||
if (ImGui::BeginListBox("##vehlist", ImVec2(250, 200)))
|
||||
{
|
||||
for (auto& p : g_gta_data_service->vehicles() | std::ranges::views::values)
|
||||
{
|
||||
@ -163,7 +163,7 @@ namespace big
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::ListBoxFooter();
|
||||
ImGui::EndListBox();
|
||||
}
|
||||
}
|
||||
|
||||
@ -177,7 +177,7 @@ namespace big
|
||||
|
||||
if (!new_template.m_weapon_model.empty() && weap_found == g_gta_data_service->weapons().end())
|
||||
{
|
||||
if (ImGui::ListBoxHeader("##weaplist", ImVec2(250, 200)))
|
||||
if (ImGui::BeginListBox("##weaplist", ImVec2(250, 200)))
|
||||
{
|
||||
for (auto& p : g_gta_data_service->weapons() | std::ranges::views::values)
|
||||
{
|
||||
@ -191,7 +191,7 @@ namespace big
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::ListBoxFooter();
|
||||
ImGui::EndListBox();
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user