Refactored code
This commit is contained in:
parent
14e2ba358e
commit
d67a91b473
@ -5,8 +5,8 @@
|
||||
|
||||
Animation::Animation()
|
||||
{
|
||||
json.LoadData(search_categories, selected_item);
|
||||
Cutscene::json.LoadData(Cutscene::categories, Cutscene::selected);
|
||||
anim_data.json.LoadData(anim_data.categories, anim_data.selected);
|
||||
Cutscene::data.json.LoadData(Cutscene::data.categories, Cutscene::data.selected);
|
||||
|
||||
Events::processScriptsEvent += []
|
||||
{
|
||||
@ -81,7 +81,7 @@ void Animation::Draw()
|
||||
if (ImGui::BeginChild("Anims Child"))
|
||||
{
|
||||
ImGui::Spacing();
|
||||
Ui::DrawJSON(json, search_categories, selected_item, filter, &PlayAnimation, &RemoveAnimation);
|
||||
Ui::DrawJSON(anim_data.json, anim_data.categories, anim_data.selected, anim_data.filter, &PlayAnimation, &RemoveAnimation);
|
||||
ImGui::EndChild();
|
||||
}
|
||||
ImGui::EndTabItem();
|
||||
@ -126,8 +126,8 @@ void Animation::Draw()
|
||||
ImGui::Spacing();
|
||||
if (ImGui::Button("Add animation", Ui::GetSize()))
|
||||
{
|
||||
json.data["Custom"][anim_buffer] = ("0, " + std::string(ifp_buffer));
|
||||
json.WriteToDisk();
|
||||
anim_data.json.data["Custom"][anim_buffer] = ("0, " + std::string(ifp_buffer));
|
||||
anim_data.json.WriteToDisk();
|
||||
}
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
@ -153,7 +153,7 @@ void Animation::Draw()
|
||||
if (ImGui::BeginChild("Cutscene Child"))
|
||||
{
|
||||
ImGui::Spacing();
|
||||
Ui::DrawJSON(Cutscene::json, Cutscene::categories, Cutscene::selected, Cutscene::filter, &PlayCutscene, nullptr);
|
||||
Ui::DrawJSON(Cutscene::data.json, Cutscene::data.categories, Cutscene::data.selected, Cutscene::data.filter, &PlayCutscene, nullptr);
|
||||
ImGui::EndChild();
|
||||
}
|
||||
ImGui::EndTabItem();
|
||||
@ -186,8 +186,8 @@ void Animation::RemoveAnimation(std::string& ifp, std::string& anim, std::string
|
||||
{
|
||||
if (ifp == "Custom")
|
||||
{
|
||||
json.data["Custom"].erase(anim);
|
||||
json.WriteToDisk();
|
||||
anim_data.json.data["Custom"].erase(anim);
|
||||
anim_data.json.WriteToDisk();
|
||||
CHud::SetHelpMessage("Animation removed", false, false, false);
|
||||
}
|
||||
else
|
||||
|
@ -5,23 +5,16 @@ private:
|
||||
inline static bool loop = false;
|
||||
inline static bool secondary = false;
|
||||
|
||||
inline static CJson json = CJson("animation");
|
||||
inline static ImGuiTextFilter filter = "";
|
||||
inline static std::vector<std::string> search_categories;
|
||||
inline static std::string selected_item = "All";
|
||||
inline static SearchData anim_data{"animation"};
|
||||
|
||||
struct Cutscene
|
||||
{
|
||||
inline static CJson json = CJson("cutscene");
|
||||
inline static ImGuiTextFilter filter = "";
|
||||
inline static std::vector<std::string> categories;
|
||||
inline static std::string selected = "All";
|
||||
inline static SearchData data{ "cutscene" };
|
||||
inline static std::string scene_name = "";
|
||||
inline static int interior = 0;
|
||||
inline static bool running = false;
|
||||
};
|
||||
|
||||
|
||||
inline static char anim_buffer[INPUT_BUFFER_SIZE] = "";
|
||||
inline static char ifp_buffer[INPUT_BUFFER_SIZE] = "";
|
||||
|
||||
|
@ -26,7 +26,7 @@ void Game::RealTimeClock()
|
||||
|
||||
Game::Game()
|
||||
{
|
||||
json.LoadData(search_categories, selected_item);
|
||||
mission_data.json.LoadData(mission_data.categories, mission_data.selected);
|
||||
stat::json.LoadData(stat::search_categories, stat::selected_item);
|
||||
freecam::fov = TheCamera.FindCamFOV();
|
||||
|
||||
@ -502,7 +502,7 @@ It's recommanded not to save your game after using this. Use it at your own risk
|
||||
|
||||
ImGui::Spacing();
|
||||
|
||||
Ui::DrawJSON(json, search_categories, selected_item, filter, SetPlayerMission, nullptr);
|
||||
Ui::DrawJSON(mission_data.json, mission_data.categories, mission_data.selected, mission_data.filter, SetPlayerMission, nullptr);
|
||||
}
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
|
@ -2,10 +2,7 @@
|
||||
class Game
|
||||
{
|
||||
public:
|
||||
inline static CJson json = CJson("mission");
|
||||
inline static ImGuiTextFilter filter = "";
|
||||
inline static std::vector<std::string> search_categories;
|
||||
inline static std::string selected_item = "All";
|
||||
inline static SearchData mission_data{ "mission" };
|
||||
inline static std::vector<std::string> day_names = { "Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday" };
|
||||
|
||||
inline static char save_game_name[22] = "";
|
||||
|
@ -3,6 +3,9 @@
|
||||
|
||||
CJson::CJson(const char* name)
|
||||
{
|
||||
if (name == "")
|
||||
return;
|
||||
|
||||
file_path = PLUGIN_PATH((char*)"/CheatMenu/json/") + std::string(name) + ".json";
|
||||
|
||||
if (fs::exists(file_path))
|
||||
|
@ -105,7 +105,7 @@ public:
|
||||
Saves json data to disk
|
||||
*/
|
||||
void WriteToDisk();
|
||||
CJson(const char* text);
|
||||
CJson(const char* text = "");
|
||||
};
|
||||
|
||||
|
||||
|
@ -12,7 +12,7 @@ Ped::Ped()
|
||||
{
|
||||
if (!images_loaded)
|
||||
{
|
||||
Util::LoadTexturesInDirRecursive(PLUGIN_PATH((char*)"CheatMenu\\peds\\"), ".jpg", search_categories, peds_vec);
|
||||
Util::LoadTexturesInDirRecursive(PLUGIN_PATH((char*)"CheatMenu\\peds\\"), ".jpg", ped_data.categories, ped_data.images);
|
||||
images_loaded = true;
|
||||
}
|
||||
};
|
||||
@ -20,7 +20,7 @@ Ped::Ped()
|
||||
|
||||
Ped::~Ped()
|
||||
{
|
||||
Util::ReleaseTextures(peds_vec);
|
||||
Util::ReleaseTextures(ped_data.images);
|
||||
for (CPed* ped : spawn_ped::list)
|
||||
{
|
||||
CWorld::Remove(ped);
|
||||
@ -36,7 +36,7 @@ void Ped::SpawnPed(std::string& model)
|
||||
return;
|
||||
}
|
||||
|
||||
if (Ped::ped_json.data.contains(model))
|
||||
if (Ped::ped_data.json.data.contains(model))
|
||||
{
|
||||
CPlayerPed* player = FindPlayerPed();
|
||||
CVector pos = player->GetPosition();
|
||||
@ -226,8 +226,8 @@ void Ped::Draw()
|
||||
{
|
||||
ImGui::Spacing();
|
||||
|
||||
Ui::DrawImages(peds_vec, ImVec2(65, 110), search_categories, selected_item, filter, SpawnPed, nullptr,
|
||||
[](std::string str) {return ped_json.data[str].get<std::string>(); });
|
||||
Ui::DrawImages(ped_data.images, ImVec2(65, 110), ped_data.categories, ped_data.selected, ped_data.filter, SpawnPed, nullptr,
|
||||
[](std::string str) {return ped_data.json.data[str].get<std::string>(); });
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
if (ImGui::BeginTabItem("Config"))
|
||||
@ -253,12 +253,12 @@ void Ped::Draw()
|
||||
Ui::ListBox("Ped type", spawn_ped::ped_type, spawn_ped::selected_ped_type);
|
||||
|
||||
ImGui::Spacing();
|
||||
ImGui::Text("Selected weapon: %s", Weapon::weapon_json.data[std::to_string(spawn_ped::weapon_id)].get<std::string>());
|
||||
ImGui::Text("Selected weapon: %s", Weapon::weapon_data.json.data[std::to_string(spawn_ped::weapon_id)].get<std::string>());
|
||||
ImGui::Spacing();
|
||||
Ui::DrawImages(Weapon::weapon_vec, ImVec2(65, 65), Weapon::search_categories, Weapon::selected_item, Weapon::filter,
|
||||
Ui::DrawImages(Weapon::weapon_data.images, ImVec2(65, 65), Weapon::weapon_data.categories, Weapon::weapon_data.selected, Weapon::weapon_data.filter,
|
||||
[](std::string str) { spawn_ped::weapon_id = std::stoi(str); },
|
||||
nullptr,
|
||||
[](std::string str) {return Weapon::weapon_json.data[str].get<std::string>(); },
|
||||
[](std::string str) {return Weapon::weapon_data.json.data[str].get<std::string>(); },
|
||||
[](std::string str) {return str != "-1"; /*Jetpack*/ }
|
||||
);
|
||||
|
||||
|
@ -5,14 +5,9 @@
|
||||
class Ped
|
||||
{
|
||||
private:
|
||||
inline static ImGuiTextFilter filter = "";
|
||||
inline static std::string selected_item = "All";
|
||||
inline static std::vector<std::string> search_categories;
|
||||
inline static std::vector<std::unique_ptr<TextureStructure>> peds_vec;
|
||||
inline static bool images_loaded = false;
|
||||
|
||||
inline static CJson ped_json = CJson("ped");
|
||||
inline static SearchData ped_data{ "ped" };
|
||||
inline static CJson pedspecial_json = CJson("ped special");
|
||||
inline static bool images_loaded = false;
|
||||
|
||||
inline static std::vector<std::string> gang_names =
|
||||
{
|
||||
@ -22,7 +17,8 @@ private:
|
||||
inline static bool exgangwars_installed = false;
|
||||
inline static int ped_remove_radius = 5;
|
||||
|
||||
struct spawn_ped {
|
||||
struct spawn_ped
|
||||
{
|
||||
inline static std::vector<CPed*> list;
|
||||
inline static int accuracy = 50;
|
||||
inline static int health = 100;
|
||||
|
@ -50,7 +50,7 @@ Player::Player()
|
||||
|
||||
if (!images_loaded)
|
||||
{
|
||||
Util::LoadTexturesInDirRecursive(PLUGIN_PATH((char*)"CheatMenu\\clothes\\"), ".jpg", search_categories, clothes_vec);
|
||||
Util::LoadTexturesInDirRecursive(PLUGIN_PATH((char*)"CheatMenu\\clothes\\"), ".jpg", cloth_data.categories, cloth_data.images);
|
||||
images_loaded = true;
|
||||
}
|
||||
|
||||
@ -118,7 +118,7 @@ Player::Player()
|
||||
|
||||
Player::~Player()
|
||||
{
|
||||
Util::ReleaseTextures(clothes_vec);
|
||||
Util::ReleaseTextures(cloth_data.images);
|
||||
}
|
||||
|
||||
void Player::ChangePlayerCloth(std::string& name)
|
||||
@ -161,7 +161,7 @@ void Player::ChangePlayerCloth(std::string& name)
|
||||
void Player::ChangePlayerModel(std::string& model)
|
||||
{
|
||||
bool custom_skin = std::find(custom_skins::store_vec.begin(), custom_skins::store_vec.end(), model) != custom_skins::store_vec.end();
|
||||
if (Ped::ped_json.data.contains(model) || custom_skin)
|
||||
if (Ped::ped_data.json.data.contains(model) || custom_skin)
|
||||
{
|
||||
CPlayerPed* player = FindPlayerPed();
|
||||
if (Ped::pedspecial_json.data.contains(model) || custom_skin)
|
||||
@ -373,7 +373,7 @@ void Player::Draw()
|
||||
}
|
||||
ImGui::Spacing();
|
||||
|
||||
Ui::DrawImages(clothes_vec, ImVec2(70, 100), search_categories, selected_item, filter, ChangePlayerCloth, nullptr,
|
||||
Ui::DrawImages(cloth_data.images, ImVec2(70, 100), cloth_data.categories, cloth_data.selected, cloth_data.filter, ChangePlayerCloth, nullptr,
|
||||
[](std::string str)
|
||||
{
|
||||
std::stringstream ss(str);
|
||||
@ -400,8 +400,8 @@ void Player::Draw()
|
||||
}
|
||||
if (ImGui::BeginTabItem("Ped skins"))
|
||||
{
|
||||
Ui::DrawImages(Ped::peds_vec, ImVec2(65, 110), Ped::search_categories, Ped::selected_item, Ped::filter, ChangePlayerModel, nullptr,
|
||||
[](std::string str) {return Ped::ped_json.data[str].get<std::string>(); });
|
||||
Ui::DrawImages(Ped::ped_data.images, ImVec2(65, 110), Ped::ped_data.categories, Ped::ped_data.selected, Ped::ped_data.filter, ChangePlayerModel, nullptr,
|
||||
[](std::string str) {return Ped::ped_data.json.data[str].get<std::string>(); });
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
if (ImGui::BeginTabItem("Custom skins"))
|
||||
@ -410,7 +410,7 @@ void Player::Draw()
|
||||
|
||||
if (modloader_installed)
|
||||
{
|
||||
Ui::FilterWithHint("Search", filter, std::string("Total skins: " + std::to_string(custom_skins::store_vec.size())).c_str());
|
||||
Ui::FilterWithHint("Search", cloth_data.filter, std::string("Total skins: " + std::to_string(custom_skins::store_vec.size())).c_str());
|
||||
Ui::ShowTooltip("Place your dff & txd files inside 'modloader/Custom Skins'");
|
||||
ImGui::Spacing();
|
||||
ImGui::TextWrapped("Note: Your txd & dff names can't exceed 8 characters. Don't change names while the game is running.");
|
||||
@ -428,7 +428,16 @@ void Player::Draw()
|
||||
}
|
||||
else
|
||||
{
|
||||
ImGui::TextWrapped("Modloader is not installed. Please install modloader.");
|
||||
ImGui::TextWrapped("Custom skin allows to change player skins without replacing any existing game ped skins.\n\
|
||||
Steps to enable 'Custom Skins',\n\n\
|
||||
1. Download & install modloader\n\
|
||||
2. Create a folder inside 'modloader' folder with the name 'Custom Skins'\n\
|
||||
3. Download ped skins online ( .dff & .txd files) and put them inside.\n\
|
||||
4. Restart your game.\n\n\n\
|
||||
Limitations:\n\
|
||||
1. Your .dff & .txd file names must not exceed 8 characters.\n\
|
||||
2. Do not rename them while the game is running\n\
|
||||
\nDoing so will crash your game.");
|
||||
ImGui::Spacing();
|
||||
if (ImGui::Button("Download Modloader", ImVec2(Ui::GetSize(1))))
|
||||
ShellExecute(NULL, "open", "https://gtaforums.com/topic/669520-mod-loader/", NULL, NULL, SW_SHOWNORMAL);
|
||||
|
@ -10,10 +10,7 @@ private:
|
||||
inline static bool god_mode = false;
|
||||
inline static int body = 0;
|
||||
inline static bool aim_skin_changer = false;
|
||||
inline static ImGuiTextFilter filter = "";
|
||||
inline static std::string selected_item = "All";
|
||||
inline static std::vector<std::string> search_categories;
|
||||
inline static std::vector<std::unique_ptr<TextureStructure>> clothes_vec;
|
||||
inline static SearchData cloth_data;
|
||||
inline static bool images_loaded = false;
|
||||
|
||||
struct custom_skins
|
||||
|
@ -16,7 +16,7 @@ void Teleport::FetchRadarSpriteData()
|
||||
if (cur_timer - timer < 5000)
|
||||
return;
|
||||
|
||||
json.data.erase("Radar");
|
||||
tp_data.json.data.erase("Radar");
|
||||
|
||||
// 175 is the max number of sprites, FLA can increase this limit, might need to update this
|
||||
for (int i = 0; i != 175; ++i)
|
||||
@ -26,7 +26,7 @@ void Teleport::FetchRadarSpriteData()
|
||||
std::string sprite_name = sprite_name_json.data[std::to_string(sprite)].get<std::string>();
|
||||
std::string key_name = sprite_name + ", " + Util::GetLocationName(&pos);
|
||||
|
||||
json.data["Radar"][key_name] = "0, " + std::to_string(pos.x) + ", " + std::to_string(pos.y) + ", " + std::to_string(pos.z);
|
||||
tp_data.json.data["Radar"][key_name] = "0, " + std::to_string(pos.x) + ", " + std::to_string(pos.y) + ", " + std::to_string(pos.z);
|
||||
|
||||
/*
|
||||
"Radar" : {
|
||||
@ -38,7 +38,7 @@ void Teleport::FetchRadarSpriteData()
|
||||
|
||||
Teleport::Teleport()
|
||||
{
|
||||
json.LoadData(search_categories, selected_item);
|
||||
tp_data.json.LoadData(tp_data.categories, tp_data.selected);
|
||||
quick_teleport = config.GetValue("quick_teleport", false);
|
||||
|
||||
Events::processScriptsEvent += []
|
||||
@ -153,9 +153,9 @@ void Teleport::RemoveTeleportEntry(std::string& category, std::string& key, std:
|
||||
{
|
||||
if (category == "Custom")
|
||||
{
|
||||
json.data["Custom"].erase(key);
|
||||
tp_data.json.data["Custom"].erase(key);
|
||||
CHud::SetHelpMessage("Location removed", false, false, false);
|
||||
json.WriteToDisk();
|
||||
tp_data.json.WriteToDisk();
|
||||
}
|
||||
else CHud::SetHelpMessage("You can only remove custom location", false, false, false);
|
||||
}
|
||||
@ -228,7 +228,7 @@ void Teleport::Draw()
|
||||
{
|
||||
FetchRadarSpriteData();
|
||||
ImGui::Spacing();
|
||||
Ui::DrawJSON(json, search_categories, selected_item, filter, &TeleportToLocation, &RemoveTeleportEntry);
|
||||
Ui::DrawJSON(tp_data.json, tp_data.categories, tp_data.selected, tp_data.filter, &TeleportToLocation, &RemoveTeleportEntry);
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
|
||||
@ -240,13 +240,13 @@ void Teleport::Draw()
|
||||
ImGui::Spacing();
|
||||
if (ImGui::Button("Add location", Ui::GetSize()))
|
||||
{
|
||||
json.data["Custom"][location_buffer] = ("0, " + std::string(input_buffer));
|
||||
tp_data.json.data["Custom"][location_buffer] = ("0, " + std::string(input_buffer));
|
||||
|
||||
// Clear the Radar coordinates
|
||||
json.data.erase("Radar");
|
||||
json.data["Radar"] = {};
|
||||
tp_data.json.data.erase("Radar");
|
||||
tp_data.json.data["Radar"] = {};
|
||||
|
||||
json.WriteToDisk();
|
||||
tp_data.json.WriteToDisk();
|
||||
}
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
|
@ -8,10 +8,7 @@ private:
|
||||
inline static bool insert_coord = false;
|
||||
inline static bool quick_teleport = false;
|
||||
inline static char input_buffer[INPUT_BUFFER_SIZE] = "";
|
||||
inline static CJson json = CJson("teleport");
|
||||
inline static ImGuiTextFilter filter = "";
|
||||
inline static std::vector<std::string> search_categories;
|
||||
inline static std::string selected_item = "All";
|
||||
inline static SearchData tp_data{ "teleport" };
|
||||
inline static char location_buffer[INPUT_BUFFER_SIZE] = "";
|
||||
inline static uint quick_teleport_timer = 0;
|
||||
|
||||
|
@ -12,9 +12,9 @@ Vehicle::Vehicle()
|
||||
{
|
||||
if (!images_loaded)
|
||||
{
|
||||
Util::LoadTexturesInDirRecursive(PLUGIN_PATH((char*)"CheatMenu\\vehicles\\images\\"), ".jpg", spawner::search_categories, spawner::image_vec);
|
||||
Util::LoadTexturesInDirRecursive(PLUGIN_PATH((char*)"CheatMenu\\vehicles\\components\\"), ".jpg", tune::search_categories, tune::image_vec);
|
||||
Util::LoadTexturesInDirRecursive(PLUGIN_PATH((char*)"CheatMenu\\vehicles\\paintjobs\\"), ".png", texture9::search_categories, texture9::image_vec);
|
||||
Util::LoadTexturesInDirRecursive(PLUGIN_PATH((char*)"CheatMenu\\vehicles\\images\\"), ".jpg", spawner::veh_data.categories, spawner::veh_data.images);
|
||||
Util::LoadTexturesInDirRecursive(PLUGIN_PATH((char*)"CheatMenu\\vehicles\\components\\"), ".jpg", tune_data.categories, tune_data.images);
|
||||
Util::LoadTexturesInDirRecursive(PLUGIN_PATH((char*)"CheatMenu\\vehicles\\paintjobs\\"), ".png", texture_data.categories, texture_data.images);
|
||||
|
||||
images_loaded = true;
|
||||
}
|
||||
@ -153,9 +153,9 @@ Vehicle::Vehicle()
|
||||
|
||||
Vehicle::~Vehicle()
|
||||
{
|
||||
Util::ReleaseTextures(spawner::image_vec);
|
||||
Util::ReleaseTextures(tune::image_vec);
|
||||
Util::ReleaseTextures(texture9::image_vec);
|
||||
Util::ReleaseTextures(spawner::veh_data.images);
|
||||
Util::ReleaseTextures(tune_data.images);
|
||||
Util::ReleaseTextures(texture_data.images);
|
||||
}
|
||||
|
||||
void Vehicle::AddComponent(const std::string& component, const bool display_message)
|
||||
@ -922,7 +922,7 @@ void Vehicle::Draw()
|
||||
ImGui::SetNextItemWidth(ImGui::GetWindowContentRegionWidth() - 2.5);
|
||||
ImGui::InputTextWithHint("##LicenseText", "License plate text", spawner::license_text, 9);
|
||||
|
||||
Ui::DrawImages(spawner::image_vec, ImVec2(100, 75), spawner::search_categories, spawner::selected_item, spawner::filter, SpawnVehicle, nullptr,
|
||||
Ui::DrawImages(spawner::veh_data.images, ImVec2(100, 75), spawner::veh_data.categories, spawner::veh_data.selected, spawner::veh_data.filter, SpawnVehicle, nullptr,
|
||||
[](std::string str)
|
||||
{
|
||||
return GetNameFromModel(std::stoi(str));
|
||||
@ -1104,7 +1104,7 @@ Only some vehicles will have them.");
|
||||
ImGui::SameLine();
|
||||
ImGui::Checkbox("Material filter", &color::material_filter);
|
||||
ImGui::Spacing();
|
||||
Ui::DrawImages(texture9::image_vec, ImVec2(100, 80), texture9::search_categories, texture9::selected_item, texture9::filter,
|
||||
Ui::DrawImages(texture_data.images, ImVec2(100, 80), texture_data.categories, texture_data.selected, texture_data.filter,
|
||||
[](std::string& str)
|
||||
{
|
||||
Paint::SetNodeTexture(FindPlayerPed()->m_pVehicle, Paint::veh_nodes::selected, str, color::material_filter);
|
||||
@ -1118,7 +1118,7 @@ Only some vehicles will have them.");
|
||||
if (ImGui::BeginTabItem("Tune"))
|
||||
{
|
||||
ImGui::Spacing();
|
||||
Ui::DrawImages(tune::image_vec, ImVec2(100, 80), tune::search_categories, tune::selected_item, tune::filter,
|
||||
Ui::DrawImages(tune_data.images, ImVec2(100, 80), tune_data.categories, tune_data.selected, tune_data.filter,
|
||||
[](std::string& str) {AddComponent(str);},
|
||||
[](std::string& str) {RemoveComponent(str); },
|
||||
[](std::string& str) {return str;},
|
||||
|
@ -41,32 +41,16 @@ private:
|
||||
|
||||
struct spawner
|
||||
{
|
||||
inline static ImGuiTextFilter filter = "";
|
||||
inline static std::string selected_item = "All";
|
||||
inline static std::vector<std::string> search_categories;
|
||||
inline static std::vector<std::unique_ptr<TextureStructure>> image_vec;
|
||||
inline static SearchData veh_data;
|
||||
inline static bool spawn_inside = true;
|
||||
inline static bool spawn_in_air = true;
|
||||
inline static char license_text[9] = "";
|
||||
};
|
||||
|
||||
struct texture9
|
||||
{
|
||||
inline static ImGuiTextFilter filter = "";
|
||||
inline static std::string selected_item = "All";
|
||||
inline static std::vector<std::string> search_categories;
|
||||
inline static std::vector<std::unique_ptr<TextureStructure>> image_vec;
|
||||
};
|
||||
inline static SearchData texture_data;
|
||||
inline static SearchData tune_data;
|
||||
inline static bool images_loaded = false;
|
||||
|
||||
struct tune
|
||||
{
|
||||
inline static ImGuiTextFilter filter = "";
|
||||
inline static std::string selected_item = "All";
|
||||
inline static std::vector<std::string> search_categories;
|
||||
inline static std::vector<std::unique_ptr<TextureStructure>> image_vec;
|
||||
};
|
||||
|
||||
struct unlimited_nitro
|
||||
{
|
||||
inline static bool enabled = false;
|
||||
|
@ -10,7 +10,7 @@ Weapon::Weapon()
|
||||
{
|
||||
if (!images_loaded)
|
||||
{
|
||||
Util::LoadTexturesInDirRecursive(PLUGIN_PATH((char*)"CheatMenu\\weapons\\"), ".jpg", Weapon::search_categories, Weapon::weapon_vec);
|
||||
Util::LoadTexturesInDirRecursive(PLUGIN_PATH((char*)"CheatMenu\\weapons\\"), ".jpg", Weapon::weapon_data.categories, Weapon::weapon_data.images);
|
||||
images_loaded = true;
|
||||
}
|
||||
|
||||
@ -63,7 +63,7 @@ Weapon::Weapon()
|
||||
|
||||
Weapon::~Weapon()
|
||||
{
|
||||
Util::ReleaseTextures(Weapon::weapon_vec);
|
||||
Util::ReleaseTextures(Weapon::weapon_data.images);
|
||||
}
|
||||
|
||||
void Weapon::SetGangWeapon(std::string& weapon_type)
|
||||
@ -198,10 +198,10 @@ void Weapon::Draw()
|
||||
ImGui::Columns(1);
|
||||
|
||||
ImGui::Spacing();
|
||||
ImGui::Text("Current weapon: %s", weapon_json.data[std::to_string(gang_weapons[selected_gang][selected_weapon_count])].get<std::string>());
|
||||
ImGui::Text("Current weapon: %s", weapon_data.json.data[std::to_string(gang_weapons[selected_gang][selected_weapon_count])].get<std::string>().c_str());
|
||||
ImGui::Spacing();
|
||||
Ui::DrawImages(weapon_vec, ImVec2(65, 65), search_categories, selected_item, filter, SetGangWeapon, nullptr,
|
||||
[](std::string str) {return weapon_json.data[str].get<std::string>(); },
|
||||
Ui::DrawImages(weapon_data.images, ImVec2(65, 65), weapon_data.categories, weapon_data.selected, weapon_data.filter, SetGangWeapon, nullptr,
|
||||
[](std::string str) {return weapon_data.json.data[str].get<std::string>(); },
|
||||
[](std::string str) {return str != "-1"; /*Jetpack*/ }
|
||||
);
|
||||
ImGui::EndTabItem();
|
||||
@ -214,8 +214,8 @@ void Weapon::Draw()
|
||||
ammo_count = (ammo_count < 0) ? 0 : ammo_count;
|
||||
ammo_count = (ammo_count > 99999) ? 99999 : ammo_count;
|
||||
}
|
||||
Ui::DrawImages(weapon_vec, ImVec2(65, 65), search_categories, selected_item, filter, GiveWeaponToPlayer, nullptr,
|
||||
[](std::string str) {return weapon_json.data[str].get<std::string>(); },
|
||||
Ui::DrawImages(weapon_data.images, ImVec2(65, 65), weapon_data.categories, weapon_data.selected, weapon_data.filter, GiveWeaponToPlayer, nullptr,
|
||||
[](std::string str) {return weapon_data.json.data[str].get<std::string>(); },
|
||||
[](std::string str) {return str != "0"; /*Unarmed*/ }
|
||||
);
|
||||
ImGui::EndTabItem();
|
||||
|
@ -3,14 +3,9 @@
|
||||
class Weapon
|
||||
{
|
||||
public:
|
||||
inline static ImGuiTextFilter filter = "";
|
||||
inline static std::string selected_item = "All";
|
||||
inline static std::vector<std::string> search_categories;
|
||||
inline static std::vector<std::unique_ptr<TextureStructure>> weapon_vec;
|
||||
inline static SearchData weapon_data{ "weapon" };
|
||||
inline static bool images_loaded = false;
|
||||
|
||||
inline static CJson weapon_json = CJson("weapon");
|
||||
|
||||
inline static bool auto_aim = false;
|
||||
inline static bool fast_reload = false;
|
||||
inline static bool huge_damage = false;
|
||||
|
@ -102,4 +102,14 @@ struct HotKeyData
|
||||
int key1;
|
||||
int key2;
|
||||
bool is_down = false;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
struct SearchData
|
||||
{
|
||||
CJson json;
|
||||
ImGuiTextFilter filter = "";
|
||||
std::vector<std::string> categories;
|
||||
std::string selected = "All";
|
||||
std::vector<std::unique_ptr<TextureStructure>> images;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user