From 5b0dcd72fa2d741f34934308f360b4aa831a2f2f Mon Sep 17 00:00:00 2001 From: Grinch_ Date: Sat, 18 Jun 2022 14:01:31 +0600 Subject: [PATCH] Update txd names --- resource/CheatMenuSA/{ped.txd => peds.txd} | Bin .../CheatMenuSA/{weapon.txd => weapons.txd} | Bin resource/common/locale/English.toml | 2 + src/animation.cpp | 28 +++++------- src/defines.h | 2 +- src/filehandler.cpp | 43 +----------------- src/menu.cpp | 7 +++ src/menu.h | 3 +- src/ui.cpp | 20 +++++--- 9 files changed, 39 insertions(+), 66 deletions(-) rename resource/CheatMenuSA/{ped.txd => peds.txd} (100%) rename resource/CheatMenuSA/{weapon.txd => weapons.txd} (100%) diff --git a/resource/CheatMenuSA/ped.txd b/resource/CheatMenuSA/peds.txd similarity index 100% rename from resource/CheatMenuSA/ped.txd rename to resource/CheatMenuSA/peds.txd diff --git a/resource/CheatMenuSA/weapon.txd b/resource/CheatMenuSA/weapons.txd similarity index 100% rename from resource/CheatMenuSA/weapon.txd rename to resource/CheatMenuSA/weapons.txd diff --git a/resource/common/locale/English.toml b/resource/common/locale/English.toml index e70e39a..a2488c9 100644 --- a/resource/common/locale/English.toml +++ b/resource/common/locale/English.toml @@ -216,6 +216,8 @@ TeleportCMDText = """ Teleports player to specified coordinates. Example: tp x y z""" TextColor = "Text color" +TextOnlyMode = "Text only" +TextOnlyModeHint = "Disables all images and shows only text" Usage = "Usage" UpdaterInfo1 = "It's highly recommanded to update to the latest version. Newer version contains new features and bug fixes." UpdaterInfo2 = "To know what changes are made or to download, click on the 'Download page' button. Follow the instructions there. If you're still having issues, let me know on discord." diff --git a/src/animation.cpp b/src/animation.cpp index a6ace7b..25bb149 100644 --- a/src/animation.cpp +++ b/src/animation.cpp @@ -28,31 +28,27 @@ void Animation::PlayCutscene(std::string& rootKey, std::string& cutsceneId, std: } CPlayerPed* pPlayer = FindPlayerPed(); - if (!pPlayer) + if (pPlayer) { - return; + m_Cutscene::m_SceneName = cutsceneId; + Command(cutsceneId.c_str()); + m_Cutscene::m_nInterior = pPlayer->m_nAreaCode; + pPlayer->m_nAreaCode = std::stoi(interior); + Command(pPlayer->m_nAreaCode); } - - m_Cutscene::m_SceneName = cutsceneId; - Command(cutsceneId.c_str()); - m_Cutscene::m_nInterior = pPlayer->m_nAreaCode; - pPlayer->m_nAreaCode = std::stoi(interior); - Command(pPlayer->m_nAreaCode); } void Animation::PlayParticle(std::string& rootKey, std::string& particle, std::string& dummy) { CPlayerPed* pPlayer = FindPlayerPed(); - if (!pPlayer) + if (pPlayer) { - return; + CVector pos = pPlayer->GetPosition(); + int handle; + Command(particle.c_str(), pos.x, pos.y, pos.z, 1, &handle); + Command(handle); + m_Particle::m_nParticleList.push_back(handle); } - CVector pos = pPlayer->GetPosition(); - - int handle; - Command(particle.c_str(), pos.x, pos.y, pos.z, 1, &handle); - Command(handle); - m_Particle::m_nParticleList.push_back(handle); } diff --git a/src/defines.h b/src/defines.h index 63c9ea7..0604bce 100644 --- a/src/defines.h +++ b/src/defines.h @@ -9,7 +9,7 @@ #define MENU_NAME "Cheat Menu" #define MENU_VERSION_NUMBER "3.3" #define MENU_VERSION MENU_VERSION_NUMBER"-beta" -#define BUILD_NUMBER "20220616" +#define BUILD_NUMBER "20220618" #define MENU_TITLE MENU_NAME " v" MENU_VERSION #ifdef GTASA diff --git a/src/filehandler.cpp b/src/filehandler.cpp index f46a017..7d8d4db 100644 --- a/src/filehandler.cpp +++ b/src/filehandler.cpp @@ -107,52 +107,11 @@ void FileHandler::FetchHandlingID(std::map& storeMap) char model[32], txd[32], type[32], handling[32]; if (sscanf(buf, "%d %s %s %s %s", &id, model, txd, type, handling) == 5) { - // storeMap[id] = std::string(handling); + storeMap[id] = std::string(handling); } } fclose(pFile); } - - // std::ifstream file(m_FilePath); - // std::string line; - // while (getline(file, line)) - // { - // /* - // Format: model, modelname, txdname, type, handlingId, ... - // Skip if first thing isn't model id - // */ - // if (line[0] <= '0' || line[0] >= '9') - // { - // continue; - // } - - // // running inside try block to handle user errors, mostly commas - // try - // { - // std::string temp; - // std::stringstream ss(line); - - // // get model - // getline(ss, temp, ','); - // int model = std::stoi(temp); - - // // get modelname, txd, type, handlingId - // getline(ss, temp, ','); - // getline(ss, temp, ','); - // getline(ss, temp, ','); - // getline(ss, temp, ','); - - // temp.erase(std::remove_if(temp.begin(), temp.end(), isspace), temp.end()); - - // storeMap[model] = temp; - // } - // catch (...) - // { - // Log::Print("Failed parsing vehicles.ide, {}", line); - // } - // } - - // file.close(); } #endif diff --git a/src/menu.cpp b/src/menu.cpp index d7c3919..75cac8e 100644 --- a/src/menu.cpp +++ b/src/menu.cpp @@ -32,6 +32,7 @@ void Menu::Init() m_Overlay::textColor[2] = gConfig.Get("Overlay.TextColor.Blue", 1.0f); m_Overlay::textColor[3] = gConfig.Get("Overlay.TextColor.Alpha", 1.0f); m_bDiscordRPC = gConfig.Get("Menu.DiscordRPC", false); + m_bTextOnlyMode = gConfig.Get("Menu.TextOnlyMode", false); Util::GetCPUUsageInit(); MEMORYSTATUSEX memInfo; @@ -363,6 +364,12 @@ void Menu::ShowPage() gConfig.Set("Menu.DiscordRPC", m_bDiscordRPC); } ImGui::NextColumn(); + + if (gRenderer == Render_DirectX9 + && Ui::CheckboxWithHint(TEXT("Menu.TextOnlyMode"), &m_bTextOnlyMode, TEXT("Menu.TextOnlyModeHint"))) + { + gConfig.Set("Menu.TextOnlyMode", m_bTextOnlyMode); + } ImGui::Columns(1); ImGui::EndTabItem(); diff --git a/src/menu.h b/src/menu.h index 2ac8177..f32db52 100644 --- a/src/menu.h +++ b/src/menu.h @@ -45,7 +45,8 @@ public: static inline char m_nInputBuffer[INPUT_BUFFER_SIZE] = ""; }; static inline bool m_bDiscordRPC; - + static inline bool m_bTextOnlyMode; + Menu() = delete; Menu(const Menu&) = delete; diff --git a/src/ui.cpp b/src/ui.cpp index 68bb98d..7f73d84 100644 --- a/src/ui.cpp +++ b/src/ui.cpp @@ -2,6 +2,7 @@ #include "util.h" #include "ui.h" #include "../depend/imgui/imgui_internal.h" +#include "menu.h" // Really messy code, cleanup someday bool Ui::DrawTitleBar() @@ -544,6 +545,12 @@ void Ui::DrawImages(ResourceStore &store, std::function onLe m_ImageSize.x = ImGui::GetWindowContentRegionWidth() - style.ItemSpacing.x * (imagesInRow-1); m_ImageSize.x /= imagesInRow; + bool showImages = !Menu::m_bTextOnlyMode; + if (gRenderer == Render_DirectX11) + { + showImages = false; + } + ImGui::Spacing(); // Hide the popup if right clicked again @@ -568,7 +575,7 @@ void Ui::DrawImages(ResourceStore &store, std::function onLe ImGui::Spacing(); ImGui::BeginChild("DrawImages"); - if (gRenderer == Render_DirectX9) + if (showImages) { ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(3, 3)); ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(3, 3)); @@ -590,16 +597,17 @@ void Ui::DrawImages(ResourceStore &store, std::function onLe Couldn't figure out how to laod images for Dx11 Using texts for now */ - if (gRenderer == Render_DirectX11) + if (showImages) { - if (ImGui::MenuItem(modelName.c_str())) + if (Ui::RoundedImageButton(store.m_ImagesList[i]->m_pTexture, m_ImageSize, modelName.c_str())) { onLeftClick(text); } + } else { - if (Ui::RoundedImageButton(store.m_ImagesList[i]->m_pTexture, m_ImageSize, modelName.c_str())) + if (ImGui::MenuItem(modelName.c_str())) { onLeftClick(text); } @@ -612,7 +620,7 @@ void Ui::DrawImages(ResourceStore &store, std::function onLe imgPopup.value = modelName; } - if (gRenderer != Render_DirectX11) + if (showImages) { if (imageCount % imagesInRow != 0) { @@ -623,7 +631,7 @@ void Ui::DrawImages(ResourceStore &store, std::function onLe } } - if (gRenderer == Render_DirectX9) + if (showImages) { ImGui::PopStyleVar(4); }