Refactored & cleaned up code
This commit is contained in:
parent
d67a91b473
commit
355db293b9
@ -3,39 +3,39 @@
|
||||
#include "Ui.h"
|
||||
#include "Util.h"
|
||||
|
||||
Animation::Animation()
|
||||
CAnimation::CAnimation()
|
||||
{
|
||||
anim_data.json.LoadData(anim_data.categories, anim_data.selected);
|
||||
Cutscene::data.json.LoadData(Cutscene::data.categories, Cutscene::data.selected);
|
||||
m_AnimData.m_Json.LoadData(m_AnimData.m_Categories, m_AnimData.m_Selected);
|
||||
m_Cutscene.m_Data.m_Json.LoadData(m_Cutscene.m_Data.m_Categories, m_Cutscene.m_Data.m_Selected);
|
||||
|
||||
Events::processScriptsEvent += []
|
||||
Events::processScriptsEvent += [this]
|
||||
{
|
||||
if (Cutscene::running)
|
||||
if (m_Cutscene.m_bRunning)
|
||||
{
|
||||
if (Command<Commands::HAS_CUTSCENE_FINISHED>())
|
||||
{
|
||||
Command<Commands::CLEAR_CUTSCENE>();
|
||||
Cutscene::running = false;
|
||||
Cutscene::scene_name = "";
|
||||
m_Cutscene.m_bRunning = false;
|
||||
m_Cutscene.m_SceneName = "";
|
||||
CPlayerPed* player = FindPlayerPed();
|
||||
player->m_nAreaCode = Cutscene::interior;
|
||||
player->m_nAreaCode = m_Cutscene.m_nInterior;
|
||||
Command<Commands::SET_AREA_VISIBLE>(player->m_nAreaCode);
|
||||
Cutscene::interior = 0;
|
||||
m_Cutscene.m_nInterior = 0;
|
||||
TheCamera.Fade(0, 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Cutscene::scene_name != "" && Command<Commands::HAS_CUTSCENE_LOADED>())
|
||||
if (m_Cutscene.m_SceneName != "" && Command<Commands::HAS_CUTSCENE_LOADED>())
|
||||
{
|
||||
Command<Commands::START_CUTSCENE>();
|
||||
Cutscene::running = true;
|
||||
m_Cutscene.m_bRunning = true;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
void Animation::PlayCutscene(std::string& rootkey, std::string& cutscene_str, std::string& interior)
|
||||
void CAnimation::PlayCutscene(std::string& rootKey, std::string& cutsceneId, std::string& interior)
|
||||
{
|
||||
if (Util::IsOnCutscene())
|
||||
{
|
||||
@ -43,20 +43,20 @@ void Animation::PlayCutscene(std::string& rootkey, std::string& cutscene_str, st
|
||||
return;
|
||||
}
|
||||
|
||||
Cutscene::scene_name = cutscene_str;
|
||||
Command<Commands::LOAD_CUTSCENE>(cutscene_str.c_str());
|
||||
CPlayerPed *player =FindPlayerPed();
|
||||
Cutscene::interior = player->m_nAreaCode;
|
||||
player->m_nAreaCode = std::stoi(interior);
|
||||
Command<Commands::SET_AREA_VISIBLE>(player->m_nAreaCode);
|
||||
m_Cutscene.m_SceneName = cutsceneId;
|
||||
Command<Commands::LOAD_CUTSCENE>(cutsceneId.c_str());
|
||||
CPlayerPed* pPlayer = FindPlayerPed();
|
||||
m_Cutscene.m_nInterior = pPlayer->m_nAreaCode;
|
||||
pPlayer->m_nAreaCode = std::stoi(interior);
|
||||
Command<Commands::SET_AREA_VISIBLE>(pPlayer->m_nAreaCode);
|
||||
}
|
||||
|
||||
void Animation::Draw()
|
||||
void CAnimation::Draw()
|
||||
{
|
||||
if (ImGui::BeginTabBar("Animation", ImGuiTabBarFlags_NoTooltip + ImGuiTabBarFlags_FittingPolicyScroll))
|
||||
{
|
||||
ImGui::Spacing();
|
||||
int hplayer = CPools::GetPedRef(FindPlayerPed());
|
||||
int hPlayer = CPools::GetPedRef(FindPlayerPed());
|
||||
|
||||
ImGui::Spacing();
|
||||
|
||||
@ -65,23 +65,24 @@ void Animation::Draw()
|
||||
ImGui::Spacing();
|
||||
if (ImGui::Button("Stop animation", Ui::GetSize()))
|
||||
{
|
||||
if (hplayer)
|
||||
Command<Commands::CLEAR_CHAR_TASKS>(hplayer);
|
||||
if (hPlayer)
|
||||
Command<Commands::CLEAR_CHAR_TASKS>(hPlayer);
|
||||
}
|
||||
|
||||
ImGui::Spacing();
|
||||
|
||||
ImGui::Columns(2, 0, false);
|
||||
ImGui::Checkbox("Loop", &loop);
|
||||
ImGui::Columns(2, nullptr, false);
|
||||
ImGui::Checkbox("Loop", &m_Loop);
|
||||
ImGui::NextColumn();
|
||||
ImGui::Checkbox("Secondary", &secondary);
|
||||
ImGui::Checkbox("Secondary", &m_bSecondary);
|
||||
ImGui::Columns(1);
|
||||
ImGui::Spacing();
|
||||
|
||||
if (ImGui::BeginChild("Anims Child"))
|
||||
{
|
||||
ImGui::Spacing();
|
||||
Ui::DrawJSON(anim_data.json, anim_data.categories, anim_data.selected, anim_data.filter, &PlayAnimation, &RemoveAnimation);
|
||||
Ui::DrawJSON(m_AnimData.m_Json, m_AnimData.m_Categories, m_AnimData.m_Selected, m_AnimData.m_Filter, &PlayAnimation,
|
||||
&RemoveAnimation);
|
||||
ImGui::EndChild();
|
||||
}
|
||||
ImGui::EndTabItem();
|
||||
@ -90,29 +91,27 @@ void Animation::Draw()
|
||||
if (ImGui::BeginTabItem("Misc"))
|
||||
{
|
||||
ImGui::Spacing();
|
||||
if (Ui::ListBox("Fighting", fighting_vec, fighting_selected))
|
||||
if (Ui::ListBox("Fighting", m_FightingStyleList, m_nFightingStyle))
|
||||
{
|
||||
Command<Commands::GIVE_MELEE_ATTACK_TO_CHAR>(hplayer, fighting_selected + 4, 6);
|
||||
Command<Commands::GIVE_MELEE_ATTACK_TO_CHAR>(hPlayer, m_nFightingStyle + 4, 6);
|
||||
CHud::SetHelpMessage("Fighting anim set", false, false, false);
|
||||
}
|
||||
if (Ui::ListBoxStr("Walking", walking_vec, walking_selected))
|
||||
if (Ui::ListBoxStr("Walking", m_WalkingStyleList, m_nWalkingStyle))
|
||||
{
|
||||
if (walking_selected == "default")
|
||||
if (m_nWalkingStyle == "default")
|
||||
{
|
||||
patch::Set<DWORD>(0x609A4E, 0x4D48689, false);
|
||||
patch::Set<WORD>(0x609A52, 0, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
const char* cwalking_selected = walking_selected.c_str();
|
||||
|
||||
patch::Set<DWORD>(0x609A4E, -0x6F6F6F70, false);
|
||||
patch::Nop(0x609A52, 2, false);
|
||||
|
||||
Command<Commands::REQUEST_ANIMATION>(cwalking_selected);
|
||||
Command<Commands::REQUEST_ANIMATION>(m_nWalkingStyle.c_str());
|
||||
Command<Commands::LOAD_ALL_MODELS_NOW>();
|
||||
Command<Commands::SET_ANIM_GROUP_FOR_CHAR>(hplayer, cwalking_selected);
|
||||
Command<Commands::REMOVE_ANIMATION>(cwalking_selected);
|
||||
Command<Commands::SET_ANIM_GROUP_FOR_CHAR>(hPlayer, m_nWalkingStyle.c_str());
|
||||
Command<Commands::REMOVE_ANIMATION>(m_nWalkingStyle.c_str());
|
||||
}
|
||||
CHud::SetHelpMessage("Walking anim set", false, false, false);
|
||||
}
|
||||
@ -121,13 +120,13 @@ void Animation::Draw()
|
||||
|
||||
if (ImGui::BeginTabItem("Custom"))
|
||||
{
|
||||
ImGui::InputTextWithHint("IFP name", "ped", ifp_buffer, INPUT_BUFFER_SIZE);
|
||||
ImGui::InputTextWithHint("Anim name", "cower", anim_buffer, INPUT_BUFFER_SIZE);
|
||||
ImGui::InputTextWithHint("IFP name", "ped", m_nIfpBuffer, INPUT_BUFFER_SIZE);
|
||||
ImGui::InputTextWithHint("Anim name", "cower", m_nAnimBuffer, INPUT_BUFFER_SIZE);
|
||||
ImGui::Spacing();
|
||||
if (ImGui::Button("Add animation", Ui::GetSize()))
|
||||
{
|
||||
anim_data.json.data["Custom"][anim_buffer] = ("0, " + std::string(ifp_buffer));
|
||||
anim_data.json.WriteToDisk();
|
||||
m_AnimData.m_Json.m_Data["Custom"][m_nAnimBuffer] = ("0, " + std::string(m_nIfpBuffer));
|
||||
m_AnimData.m_Json.WriteToDisk();
|
||||
}
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
@ -136,15 +135,15 @@ void Animation::Draw()
|
||||
ImGui::Spacing();
|
||||
if (ImGui::Button("Stop cutscene", Ui::GetSize()))
|
||||
{
|
||||
if (Cutscene::running)
|
||||
if (m_Cutscene.m_bRunning)
|
||||
{
|
||||
Command<Commands::CLEAR_CUTSCENE>();
|
||||
Cutscene::running = false;
|
||||
Cutscene::scene_name = "";
|
||||
m_Cutscene.m_bRunning = false;
|
||||
m_Cutscene.m_SceneName = "";
|
||||
CPlayerPed* player = FindPlayerPed();
|
||||
player->m_nAreaCode = Cutscene::interior;
|
||||
player->m_nAreaCode = m_Cutscene.m_nInterior;
|
||||
Command<Commands::SET_AREA_VISIBLE>(player->m_nAreaCode);
|
||||
Cutscene::interior = 0;
|
||||
m_Cutscene.m_nInterior = 0;
|
||||
TheCamera.Fade(0, 1);
|
||||
}
|
||||
}
|
||||
@ -153,7 +152,8 @@ void Animation::Draw()
|
||||
if (ImGui::BeginChild("Cutscene Child"))
|
||||
{
|
||||
ImGui::Spacing();
|
||||
Ui::DrawJSON(Cutscene::data.json, Cutscene::data.categories, Cutscene::data.selected, Cutscene::data.filter, &PlayCutscene, nullptr);
|
||||
Ui::DrawJSON(m_Cutscene.m_Data.m_Json, m_Cutscene.m_Data.m_Categories, m_Cutscene.m_Data.m_Selected,
|
||||
m_Cutscene.m_Data.m_Filter, &PlayCutscene, nullptr);
|
||||
ImGui::EndChild();
|
||||
}
|
||||
ImGui::EndTabItem();
|
||||
@ -162,7 +162,7 @@ void Animation::Draw()
|
||||
}
|
||||
}
|
||||
|
||||
void Animation::PlayAnimation(std::string& ifp, std::string& anim, std::string& ifp_repeat)
|
||||
void CAnimation::PlayAnimation(std::string& ifp, std::string& anim, std::string& ifpRepeat)
|
||||
{
|
||||
int hplayer = CPools::GetPedRef(FindPlayerPed());
|
||||
|
||||
@ -173,25 +173,23 @@ void Animation::PlayAnimation(std::string& ifp, std::string& anim, std::string&
|
||||
}
|
||||
|
||||
Command<Commands::CLEAR_CHAR_TASKS>(hplayer);
|
||||
if (secondary)
|
||||
Command<Commands::TASK_PLAY_ANIM_SECONDARY>(hplayer, anim.c_str(), ifp.c_str(), 4.0, loop, 0, 0, 0, -1);
|
||||
if (m_bSecondary)
|
||||
Command<Commands::TASK_PLAY_ANIM_SECONDARY>(hplayer, anim.c_str(), ifp.c_str(), 4.0, m_Loop, 0, 0, 0, -1);
|
||||
else
|
||||
Command<Commands::TASK_PLAY_ANIM>(hplayer, anim.c_str(), ifp.c_str(), 4.0, loop, 0, 0, 0, -1);
|
||||
Command<Commands::TASK_PLAY_ANIM>(hplayer, anim.c_str(), ifp.c_str(), 4.0, m_Loop, 0, 0, 0, -1);
|
||||
|
||||
if (ifp != "PED")
|
||||
Command<Commands::REMOVE_ANIMATION>(ifp.c_str());
|
||||
}
|
||||
|
||||
void Animation::RemoveAnimation(std::string& ifp, std::string& anim, std::string& ifp_repeat)
|
||||
void CAnimation::RemoveAnimation(std::string& ifp, std::string& anim, std::string& ifpRepeat)
|
||||
{
|
||||
if (ifp == "Custom")
|
||||
{
|
||||
anim_data.json.data["Custom"].erase(anim);
|
||||
anim_data.json.WriteToDisk();
|
||||
m_AnimData.m_Json.m_Data["Custom"].erase(anim);
|
||||
m_AnimData.m_Json.WriteToDisk();
|
||||
CHud::SetHelpMessage("Animation removed", false, false, false);
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
CHud::SetHelpMessage("You can only remove custom anims", false, false, false);
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,37 +1,36 @@
|
||||
#pragma once
|
||||
class Animation
|
||||
class CAnimation
|
||||
{
|
||||
private:
|
||||
inline static bool loop = false;
|
||||
inline static bool secondary = false;
|
||||
|
||||
inline static SearchData anim_data{"animation"};
|
||||
|
||||
struct Cutscene
|
||||
inline static char m_nAnimBuffer[INPUT_BUFFER_SIZE] = "";
|
||||
inline static SSearchData m_AnimData{ "animation" };
|
||||
static struct
|
||||
{
|
||||
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] = "";
|
||||
inline static SSearchData m_Data{ "cutscene" };
|
||||
inline static std::string m_SceneName = "";
|
||||
inline static int m_nInterior = 0;
|
||||
inline static bool m_bRunning = false;
|
||||
} m_Cutscene;
|
||||
inline static int m_nFightingStyle = 0;
|
||||
inline static char m_nIfpBuffer[INPUT_BUFFER_SIZE] = "";
|
||||
inline static bool m_Loop = false;
|
||||
inline static bool m_bSecondary = false;
|
||||
inline static std::string m_nWalkingStyle = "default";
|
||||
|
||||
inline static std::vector<std::string> fighting_vec{ "Default","Boxing","Kung fu","Kick Boxing","Punch Kick" };
|
||||
inline static int fighting_selected = 0;
|
||||
inline static std::vector<std::string> walking_vec{ "default", "man", "shuffle", "oldman", "gang1", "gang2",
|
||||
"oldfatman", "fatman", "jogger", "drunkman", "blindman", "swat", "woman", "shopping", "busywoman",
|
||||
"sexywoman", "pro", "oldwoman", "fatwoman", "jogwoman", "oldfatwoman", "skate" };
|
||||
inline static std::string walking_selected = "default";
|
||||
inline static std::vector<std::string> m_FightingStyleList = {"Default", "Boxing", "Kung fu", "Kick Boxing", "Punch Kick"};
|
||||
inline static std::vector<std::string> m_WalkingStyleList =
|
||||
{
|
||||
"default", "man", "shuffle", "oldman", "gang1", "gang2", "oldfatman",
|
||||
"fatman", "jogger", "drunkman", "blindman", "swat", "woman", "shopping", "busywoman",
|
||||
"sexywoman", "pro", "oldwoman", "fatwoman", "jogwoman", "oldfatwoman", "skate"
|
||||
};
|
||||
|
||||
protected:
|
||||
Animation();
|
||||
CAnimation();
|
||||
|
||||
public:
|
||||
static void Draw();
|
||||
static void PlayAnimation(std::string& rootkey, std::string& anim, std::string& ifp);
|
||||
static void PlayCutscene(std::string& rootkey, std::string& cutscene_str, std::string& interior);
|
||||
static void RemoveAnimation(std::string& rootkey, std::string& anim, std::string& ifp);
|
||||
static void PlayAnimation(std::string& rootKey, std::string& anim, std::string& ifp);
|
||||
static void PlayCutscene(std::string& rootKey, std::string& cutsceneId, std::string& interior);
|
||||
static void RemoveAnimation(std::string& rootKey, std::string& anim, std::string& ifp);
|
||||
};
|
||||
|
||||
|
@ -9,74 +9,75 @@ void CheatMenu::DrawWindow()
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
|
||||
if (FrontEndMenuManager.m_bMenuActive)
|
||||
Hook::show_mouse = false;
|
||||
m_bShowMouse = false;
|
||||
else
|
||||
{
|
||||
if (Globals::show_menu || Menu::commands::show_menu)
|
||||
if (Globals::m_bShowMenu || m_Commands.m_bShowMenu)
|
||||
{
|
||||
if (Globals::show_menu)
|
||||
if (Globals::m_bShowMenu)
|
||||
{
|
||||
ImGui::SetNextWindowSize(Globals::menu_size);
|
||||
if (ImGui::Begin(MENU_TITLE, &Globals::show_menu, ImGuiWindowFlags_NoCollapse))
|
||||
ImGui::SetNextWindowSize(Globals::m_fMenuSize);
|
||||
if (ImGui::Begin(MENU_TITLE, &Globals::m_bShowMenu, ImGuiWindowFlags_NoCollapse))
|
||||
{
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowMinSize, ImVec2(250, 350));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(ImGui::GetWindowWidth() / 85, ImGui::GetWindowHeight() / 200));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding,
|
||||
ImVec2(ImGui::GetWindowWidth() / 85, ImGui::GetWindowHeight() / 200));
|
||||
|
||||
if (Updater::state == UPDATER_UPDATE_FOUND)
|
||||
if (Updater::m_State == UPDATER_UPDATE_FOUND)
|
||||
Updater::ShowUpdateScreen();
|
||||
else
|
||||
Ui::DrawHeaders(header);
|
||||
|
||||
Globals::menu_size = ImGui::GetWindowSize();
|
||||
config.SetValue("window.sizeX", Globals::menu_size.x);
|
||||
config.SetValue("window.sizeY", Globals::menu_size.y);
|
||||
Globals::m_fMenuSize = ImGui::GetWindowSize();
|
||||
config.SetValue("window.sizeX", Globals::m_fMenuSize.x);
|
||||
config.SetValue("window.sizeY", Globals::m_fMenuSize.y);
|
||||
|
||||
ImGui::PopStyleVar(2);
|
||||
ImGui::End();
|
||||
}
|
||||
}
|
||||
else
|
||||
Menu::DrawShortcutsWindow();
|
||||
DrawShortcutsWindow();
|
||||
}
|
||||
}
|
||||
|
||||
Menu::DrawOverlay();
|
||||
DrawOverlay();
|
||||
}
|
||||
|
||||
CheatMenu::CheatMenu()
|
||||
{
|
||||
ApplyStyle();
|
||||
Hook::window_callback = std::bind(&DrawWindow);
|
||||
window_callback = std::bind(&DrawWindow);
|
||||
|
||||
// Load menu settings
|
||||
Globals::header_id = config.GetValue("window.id", std::string(""));
|
||||
Globals::menu_size.x = config.GetValue("window.sizeX", screen::GetScreenWidth() / 4.0f);
|
||||
Globals::menu_size.y = config.GetValue("window.sizeY", screen::GetScreenHeight() / 1.2f);
|
||||
Globals::m_HeaderId = config.GetValue("window.id", std::string(""));
|
||||
Globals::m_fMenuSize.x = config.GetValue("window.sizeX", screen::GetScreenWidth() / 4.0f);
|
||||
Globals::m_fMenuSize.y = config.GetValue("window.sizeY", screen::GetScreenHeight() / 1.2f);
|
||||
srand(CTimer::m_snTimeInMilliseconds);
|
||||
|
||||
Events::processScriptsEvent += []()
|
||||
{
|
||||
if (Globals::init_done && !FrontEndMenuManager.m_bMenuActive)
|
||||
if (Globals::m_bInit && !FrontEndMenuManager.m_bMenuActive)
|
||||
{
|
||||
if (Ui::HotKeyPressed(hotkeys::menu_open))
|
||||
Globals::show_menu = !Globals::show_menu;
|
||||
if (Ui::HotKeyPressed(m_HotKeys.menuOpen))
|
||||
Globals::m_bShowMenu = !Globals::m_bShowMenu;
|
||||
|
||||
if (Ui::HotKeyPressed(hotkeys::command_window))
|
||||
if (Ui::HotKeyPressed(m_HotKeys.commandWindow))
|
||||
{
|
||||
if (Menu::commands::show_menu)
|
||||
if (m_Commands.m_bShowMenu)
|
||||
{
|
||||
Menu::ProcessCommands();
|
||||
strcpy(commands::input_buffer, "");
|
||||
ProcessCommands();
|
||||
strcpy(m_Commands.m_nInputBuffer, "");
|
||||
}
|
||||
Menu::commands::show_menu = !Menu::commands::show_menu;
|
||||
m_Commands.m_bShowMenu = !m_Commands.m_bShowMenu;
|
||||
}
|
||||
|
||||
if (Hook::show_mouse != Globals::show_menu)
|
||||
if (m_bShowMouse != Globals::m_bShowMenu)
|
||||
{
|
||||
if (Hook::show_mouse) // Only write when the menu closes
|
||||
if (m_bShowMouse) // Only write when the menu closes
|
||||
config.WriteToDisk();
|
||||
|
||||
Hook::show_mouse = Globals::show_menu;
|
||||
m_bShowMouse = Globals::m_bShowMenu;
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -181,17 +182,18 @@ void MenuThread(void* param)
|
||||
MessageBox(RsGlobal.ps->window, "SilentPatch isn't installed. Exiting CheatMenu.", "CheatMenu", MB_ICONERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
flog << "Starting...\nVersion: " MENU_TITLE "\nAuthor: Grinch_\nDiscord: " DISCORD_INVITE "\nMore Info: " GITHUB_LINK "\n" << std::endl;
|
||||
|
||||
flog << "Starting...\nVersion: " MENU_TITLE "\nAuthor: Grinch_\nDiscord: " DISCORD_INVITE "\nMore Info: "
|
||||
GITHUB_LINK "\n" << std::endl;
|
||||
CFastman92limitAdjuster::Init();
|
||||
CheatMenu *menu = new CheatMenu;
|
||||
auto menu = new CheatMenu;
|
||||
Updater::CheckForUpdate();
|
||||
|
||||
|
||||
while (true)
|
||||
{
|
||||
Sleep(5000);
|
||||
|
||||
if (Updater::state == UPDATER_CHECKING)
|
||||
|
||||
if (Updater::m_State == UPDATER_CHECKING)
|
||||
Updater::CheckForUpdate();
|
||||
}
|
||||
}
|
||||
@ -199,13 +201,13 @@ void MenuThread(void* param)
|
||||
BOOL WINAPI DllMain(HINSTANCE hDllHandle, DWORD nReason, LPVOID Reserved)
|
||||
{
|
||||
if (nReason == DLL_PROCESS_ATTACH)
|
||||
{
|
||||
{
|
||||
uint gameVersion = GetGameVersion();
|
||||
if (gameVersion == GAME_10US_HOODLUM || gameVersion == GAME_10US_COMPACT)
|
||||
CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)&MenuThread, NULL, NULL, NULL);
|
||||
CreateThread(nullptr, NULL, (LPTHREAD_START_ROUTINE)&MenuThread, nullptr, NULL, nullptr);
|
||||
else
|
||||
MessageBox(HWND_DESKTOP, "Unknown game version. GTA SA v1.0 US is required.", "CheatMenu", MB_ICONERROR);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
@ -18,14 +18,14 @@
|
||||
#include "Visual.h"
|
||||
#include "Weapon.h"
|
||||
|
||||
class CheatMenu : Hook, Animation, Game, Menu, Ped, Player, Teleport, Vehicle, Visual, Weapon
|
||||
class CheatMenu : Hook, CAnimation, CGame, Menu, Ped, Player, Teleport, Vehicle, Visual, Weapon
|
||||
{
|
||||
private:
|
||||
inline static CallbackTable header
|
||||
{
|
||||
{ "Teleport", &Teleport::Draw },{ "Player", &Player::Draw },{ "Ped", &Ped::Draw },
|
||||
{ "Animation", &Animation::Draw },{ "Vehicle", &Vehicle::Draw },{ "Weapon", &Weapon::Draw },
|
||||
{ "Game", &Game::Draw },{ "Visual", &Visual::Draw },{ "Menu", &Menu::Draw }
|
||||
{"Teleport", &Teleport::Draw}, {"Player", &Player::Draw}, {"Ped", &Ped::Draw},
|
||||
{"Animation", &CAnimation::Draw}, {"Vehicle", &Vehicle::Draw}, {"Weapon", &Weapon::Draw},
|
||||
{"Game", &CGame::Draw}, {"Visual", &Visual::Draw}, {"Menu", &Menu::Draw}
|
||||
};
|
||||
|
||||
static void ApplyStyle();
|
||||
@ -34,4 +34,3 @@ private:
|
||||
public:
|
||||
CheatMenu();
|
||||
};
|
||||
|
||||
|
2
CheatMenu/CheatMenu.vcxproj.DotSettings
Normal file
2
CheatMenu/CheatMenu.vcxproj.DotSettings
Normal file
@ -0,0 +1,2 @@
|
||||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||
<s:String x:Key="/Default/CppProjectProperties/LanguageStandard/@EntryValue">Cpp20</s:String></wpf:ResourceDictionary>
|
@ -6,10 +6,10 @@
|
||||
#include "CIplStore.h"
|
||||
|
||||
// Thanks to aap
|
||||
void Game::RealTimeClock()
|
||||
void CGame::RealTimeClock()
|
||||
{
|
||||
static int lastday;
|
||||
time_t tmp = time(NULL);
|
||||
time_t tmp = time(nullptr);
|
||||
struct tm* now = localtime(&tmp);
|
||||
|
||||
if (now->tm_yday != lastday)
|
||||
@ -24,92 +24,92 @@ void Game::RealTimeClock()
|
||||
CClock::ms_nGameClockSeconds = now->tm_sec;
|
||||
}
|
||||
|
||||
Game::Game()
|
||||
CGame::CGame()
|
||||
{
|
||||
mission_data.json.LoadData(mission_data.categories, mission_data.selected);
|
||||
stat::json.LoadData(stat::search_categories, stat::selected_item);
|
||||
freecam::fov = TheCamera.FindCamFOV();
|
||||
m_MissionData.m_Json.LoadData(m_MissionData.m_Categories, m_MissionData.m_Selected);
|
||||
m_StatData.m_Json.LoadData(m_StatData.m_Categories, m_StatData.m_Selected);
|
||||
m_Freecam.m_fFOV = TheCamera.FindCamFOV();
|
||||
|
||||
// Generate enabled cheats vector
|
||||
for (auto element : random_cheats::name_json.data.items())
|
||||
for (auto element : m_RandomCheats.m_Json.m_Data.items())
|
||||
{
|
||||
/*
|
||||
[
|
||||
cheat_id = [ cheat_name, state (true/false) ]
|
||||
]
|
||||
*/
|
||||
random_cheats::enabled_cheats[std::stoi(element.key())][0] = element.value().get<std::string>();
|
||||
random_cheats::enabled_cheats[std::stoi(element.key())][1] = "true";
|
||||
m_RandomCheats.m_EnabledCheats[std::stoi(element.key())][0] = element.value().get<std::string>();
|
||||
m_RandomCheats.m_EnabledCheats[std::stoi(element.key())][1] = "true";
|
||||
}
|
||||
|
||||
Events::processScriptsEvent += []
|
||||
{
|
||||
uint timer = CTimer::m_snTimeInMilliseconds;
|
||||
static CPlayerPed* player = FindPlayerPed();
|
||||
static int hplayer = CPools::GetPedRef(player);
|
||||
CPlayerPed* pPlayer = FindPlayerPed();
|
||||
int hplayer = CPools::GetPedRef(pPlayer);
|
||||
|
||||
if (ss_shortcut)
|
||||
if (m_bScreenShot)
|
||||
{
|
||||
if (Ui::HotKeyPressed(Menu::hotkeys::quick_ss))
|
||||
if (Ui::HotKeyPressed(Menu::m_HotKeys.quickSceenShot))
|
||||
{
|
||||
Command<Commands::TAKE_PHOTO>();
|
||||
CHud::SetHelpMessage("Screenshot taken", false, false, false);
|
||||
}
|
||||
}
|
||||
|
||||
if (hard_mode::state)
|
||||
if (m_HardMode.m_bEnabled)
|
||||
{
|
||||
if (player->m_fHealth > 50.0f)
|
||||
player->m_fHealth = 50.0f;
|
||||
if (pPlayer->m_fHealth > 50.0f)
|
||||
pPlayer->m_fHealth = 50.0f;
|
||||
|
||||
player->m_fArmour = 0.0f;
|
||||
pPlayer->m_fArmour = 0.0f;
|
||||
CStats::SetStatValue(STAT_MAX_HEALTH, 350.0f);
|
||||
CStats::SetStatValue(STAT_STAMINA, 0.0f);
|
||||
}
|
||||
|
||||
if (solid_water)
|
||||
if (m_bSolidWater)
|
||||
{
|
||||
CVector pos = player->GetPosition();
|
||||
CVector pos = pPlayer->GetPosition();
|
||||
|
||||
float water_height = 0;
|
||||
Command<Commands::GET_WATER_HEIGHT_AT_COORDS>(pos.x, pos.y, false, &water_height);
|
||||
float waterHeight = 0;
|
||||
Command<Commands::GET_WATER_HEIGHT_AT_COORDS>(pos.x, pos.y, false, &waterHeight);
|
||||
|
||||
if (!Command<Commands::IS_CHAR_IN_ANY_BOAT>(hplayer) && water_height != -1000.0f && pos.z > (water_height))
|
||||
if (!Command<Commands::IS_CHAR_IN_ANY_BOAT>(hplayer) && waterHeight != -1000.0f && pos.z > (waterHeight))
|
||||
{
|
||||
if (solid_water_object == 0)
|
||||
if (m_nSolidWaterObj == 0)
|
||||
{
|
||||
Command<Commands::CREATE_OBJECT>(3095, pos.x, pos.y, water_height, &solid_water_object);
|
||||
Command<Commands::SET_OBJECT_VISIBLE>(solid_water_object, false);
|
||||
if (pos.z < (water_height + 1))
|
||||
player->SetPosn(pos.x, pos.y, water_height + 1);
|
||||
Command<Commands::CREATE_OBJECT>(3095, pos.x, pos.y, waterHeight, &m_nSolidWaterObj);
|
||||
Command<Commands::SET_OBJECT_VISIBLE>(m_nSolidWaterObj, false);
|
||||
if (pos.z < (waterHeight + 1))
|
||||
pPlayer->SetPosn(pos.x, pos.y, waterHeight + 1);
|
||||
}
|
||||
else
|
||||
Command<Commands::SET_OBJECT_COORDINATES>(solid_water_object, pos.x, pos.y, water_height);
|
||||
Command<Commands::SET_OBJECT_COORDINATES>(m_nSolidWaterObj, pos.x, pos.y, waterHeight);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (solid_water_object != 0)
|
||||
if (m_nSolidWaterObj != 0)
|
||||
{
|
||||
Command<Commands::DELETE_OBJECT>(solid_water_object);
|
||||
solid_water_object = 0;
|
||||
Command<Commands::DELETE_OBJECT>(m_nSolidWaterObj);
|
||||
m_nSolidWaterObj = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// improve this later
|
||||
if (sync_time && timer - sync_time_timer > 50)
|
||||
if (m_bSyncTime && timer - m_nSyncTimer > 50)
|
||||
{
|
||||
std::time_t t = std::time(0);
|
||||
std::time_t t = std::time(nullptr);
|
||||
std::tm* now = std::localtime(&t);
|
||||
|
||||
CClock::ms_nGameClockHours = now->tm_hour;
|
||||
CClock::ms_nGameClockMinutes = now->tm_min;
|
||||
|
||||
sync_time_timer = timer;
|
||||
m_nSyncTimer = timer;
|
||||
}
|
||||
|
||||
if (random_cheats::enable
|
||||
&& (timer - random_cheats::timer) > (uint(random_cheats::enable_wait_time) * 1000))
|
||||
if (m_RandomCheats.m_bEnabled
|
||||
&& (timer - m_RandomCheats.m_nTimer) > (static_cast<uint>(m_RandomCheats.m_nInterval) * 1000))
|
||||
{
|
||||
int id = Random(0, 91);
|
||||
|
||||
@ -117,27 +117,27 @@ Game::Game()
|
||||
{
|
||||
if (i == id)
|
||||
{
|
||||
if (random_cheats::enabled_cheats[i][1] == "true")
|
||||
if (m_RandomCheats.m_EnabledCheats[i][1] == "true")
|
||||
{
|
||||
((void(*)(int))0x00438370)(id); // cheatEnableLegimate(int CheatID)
|
||||
CHud::SetHelpMessage(random_cheats::enabled_cheats[i][0].c_str(), false, false, false);
|
||||
random_cheats::timer = timer;
|
||||
CHud::SetHelpMessage(m_RandomCheats.m_EnabledCheats[i][0].c_str(), false, false, false);
|
||||
m_RandomCheats.m_nTimer = timer;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Ui::HotKeyPressed(Menu::hotkeys::freecam))
|
||||
if (Ui::HotKeyPressed(Menu::m_HotKeys.freeCam))
|
||||
{
|
||||
if (freecam::enable)
|
||||
if (m_Freecam.m_bEnabled)
|
||||
{
|
||||
freecam::enable = false;
|
||||
m_Freecam.m_bEnabled = false;
|
||||
ClearFreecamStuff();
|
||||
}
|
||||
else freecam::enable = true;
|
||||
else m_Freecam.m_bEnabled = true;
|
||||
}
|
||||
if (freecam::enable)
|
||||
if (m_Freecam.m_bEnabled)
|
||||
FreeCam();
|
||||
};
|
||||
}
|
||||
@ -156,14 +156,14 @@ void SetPlayerMission(std::string& rootkey, std::string& name, std::string& id)
|
||||
Command<Commands::LOAD_AND_LAUNCH_MISSION_INTERNAL>(std::stoi(id));
|
||||
}
|
||||
else CHud::SetHelpMessage("Can't start mission now", false, false, false);
|
||||
|
||||
}
|
||||
|
||||
void Game::FreeCam()
|
||||
void CGame::FreeCam()
|
||||
{
|
||||
int delta_speed = freecam::speed * (CTimer::m_snTimeInMillisecondsNonClipped - CTimer::m_snPreviousTimeInMillisecondsNonClipped);
|
||||
int deltaSpeed = m_Freecam.m_fSpeed * (CTimer::m_snTimeInMillisecondsNonClipped -
|
||||
CTimer::m_snPreviousTimeInMillisecondsNonClipped);
|
||||
|
||||
if (!freecam::init_done)
|
||||
if (!m_Freecam.m_bInitDone)
|
||||
{
|
||||
CPlayerPed* player = FindPlayerPed(-1);
|
||||
Command<Commands::SET_EVERYONE_IGNORE_PLAYER>(0, true);
|
||||
@ -172,135 +172,135 @@ void Game::FreeCam()
|
||||
CVector player_pos = player->GetPosition();
|
||||
CPad::GetPad(0)->DisablePlayerControls = true;
|
||||
|
||||
Command<Commands::CREATE_RANDOM_CHAR>(player_pos.x, player_pos.y, player_pos.z, &freecam::hped);
|
||||
freecam::ped = CPools::GetPed(freecam::hped);
|
||||
freecam::ped->m_bIsVisible = false;
|
||||
Command<Commands::CREATE_RANDOM_CHAR>(player_pos.x, player_pos.y, player_pos.z, &m_Freecam.m_nPed);
|
||||
m_Freecam.m_pPed = CPools::GetPed(m_Freecam.m_nPed);
|
||||
m_Freecam.m_pPed->m_bIsVisible = false;
|
||||
|
||||
Command<Commands::FREEZE_CHAR_POSITION_AND_DONT_LOAD_COLLISION>(freecam::hped, true);
|
||||
Command<Commands::SET_CHAR_COLLISION>(freecam::hped, false);
|
||||
Command<Commands::SET_LOAD_COLLISION_FOR_CHAR_FLAG>(freecam::hped, false);
|
||||
Command<Commands::FREEZE_CHAR_POSITION_AND_DONT_LOAD_COLLISION>(m_Freecam.m_nPed, true);
|
||||
Command<Commands::SET_CHAR_COLLISION>(m_Freecam.m_nPed, false);
|
||||
Command<Commands::SET_LOAD_COLLISION_FOR_CHAR_FLAG>(m_Freecam.m_nPed, false);
|
||||
|
||||
freecam::tmouseX = player->GetHeading() + 89.6f;
|
||||
freecam::tmouseY = 0;
|
||||
m_Freecam.m_fTotalMouse.x = player->GetHeading() + 89.6f;
|
||||
m_Freecam.m_fTotalMouse.y = 0;
|
||||
|
||||
freecam::init_done = true;
|
||||
m_Freecam.m_bInitDone = true;
|
||||
player_pos.z -= 20;
|
||||
freecam::ped->SetPosn(player_pos);
|
||||
m_Freecam.m_pPed->SetPosn(player_pos);
|
||||
|
||||
TheCamera.LerpFOV(TheCamera.FindCamFOV(), freecam::fov, 1000, true);
|
||||
TheCamera.LerpFOV(TheCamera.FindCamFOV(), m_Freecam.m_fFOV, 1000, true);
|
||||
Command<Commands::CAMERA_PERSIST_FOV>(true);
|
||||
}
|
||||
|
||||
CVector pos = freecam::ped->GetPosition();
|
||||
CVector pos = m_Freecam.m_pPed->GetPosition();
|
||||
|
||||
Command<Commands::GET_PC_MOUSE_MOVEMENT>(&freecam::mouseX, &freecam::mouseY);
|
||||
freecam::tmouseX = freecam::tmouseX - freecam::mouseX / 250;
|
||||
freecam::tmouseY = freecam::tmouseY + freecam::mouseY / 3;
|
||||
Command<Commands::GET_PC_MOUSE_MOVEMENT>(&m_Freecam.m_fMouse.x, &m_Freecam.m_fMouse.y);
|
||||
m_Freecam.m_fTotalMouse.x = m_Freecam.m_fTotalMouse.x - m_Freecam.m_fMouse.x / 250;
|
||||
m_Freecam.m_fTotalMouse.y = m_Freecam.m_fTotalMouse.y + m_Freecam.m_fMouse.y / 3;
|
||||
|
||||
if (freecam::tmouseY > 150)
|
||||
freecam::tmouseY = 150;
|
||||
if (m_Freecam.m_fTotalMouse.x > 150)
|
||||
m_Freecam.m_fTotalMouse.y = 150;
|
||||
|
||||
if (freecam::tmouseY < -150)
|
||||
freecam::tmouseY = -150;
|
||||
if (m_Freecam.m_fTotalMouse.y < -150)
|
||||
m_Freecam.m_fTotalMouse.y = -150;
|
||||
|
||||
if (Ui::HotKeyPressed(Menu::hotkeys::free_cam_tp_player))
|
||||
if (Ui::HotKeyPressed(Menu::m_HotKeys.freeCamTeleportPlayer))
|
||||
{
|
||||
CPlayerPed* player = FindPlayerPed(-1);
|
||||
CVector pos = freecam::ped->GetPosition();
|
||||
CVector pos = m_Freecam.m_pPed->GetPosition();
|
||||
CEntity* player_entity = FindPlayerEntity(-1);
|
||||
pos.z = CWorld::FindGroundZFor3DCoord(pos.x, pos.y, 1000, 0, &player_entity) + 0.5f;
|
||||
pos.z = CWorld::FindGroundZFor3DCoord(pos.x, pos.y, 1000, nullptr, &player_entity) + 0.5f;
|
||||
Command<Commands::SET_CHAR_COORDINATES>(CPools::GetPedRef(player), pos.x, pos.y, pos.z);
|
||||
|
||||
// disble them again cause they get enabled
|
||||
CHud::bScriptDontDisplayRadar = true;
|
||||
CHud::m_Wants_To_Draw_Hud = false;
|
||||
CHud::SetHelpMessage((char*)"Player telported", false, false, false);
|
||||
CHud::SetHelpMessage("Player telported", false, false, false);
|
||||
}
|
||||
|
||||
if (KeyPressed(VK_RCONTROL))
|
||||
delta_speed /= 2;
|
||||
deltaSpeed /= 2;
|
||||
|
||||
if (KeyPressed(VK_RSHIFT))
|
||||
delta_speed *= 2;
|
||||
deltaSpeed *= 2;
|
||||
|
||||
if (KeyPressed(VK_KEY_I) || KeyPressed(VK_KEY_K))
|
||||
{
|
||||
if (KeyPressed(VK_KEY_K))
|
||||
delta_speed *= -1;
|
||||
deltaSpeed *= -1;
|
||||
|
||||
float angle;
|
||||
Command<Commands::GET_CHAR_HEADING>(freecam::hped, &angle);
|
||||
pos.x += delta_speed * cos(angle * 3.14159f / 180.0f);
|
||||
pos.y += delta_speed * sin(angle * 3.14159f / 180.0f);
|
||||
pos.z += delta_speed * 2 * sin(freecam::tmouseY / 3 * 3.14159f / 180.0f);
|
||||
Command<Commands::GET_CHAR_HEADING>(m_Freecam.m_nPed, &angle);
|
||||
pos.x += deltaSpeed * cos(angle * 3.14159f / 180.0f);
|
||||
pos.y += deltaSpeed * sin(angle * 3.14159f / 180.0f);
|
||||
pos.z += deltaSpeed * 2 * sin(m_Freecam.m_fTotalMouse.y / 3 * 3.14159f / 180.0f);
|
||||
}
|
||||
|
||||
if (KeyPressed(VK_KEY_J) || KeyPressed(VK_KEY_L))
|
||||
{
|
||||
if (KeyPressed(VK_KEY_J))
|
||||
delta_speed *= -1;
|
||||
deltaSpeed *= -1;
|
||||
|
||||
float angle;
|
||||
Command<Commands::GET_CHAR_HEADING>(freecam::hped, &angle);
|
||||
Command<Commands::GET_CHAR_HEADING>(m_Freecam.m_nPed, &angle);
|
||||
angle -= 90;
|
||||
|
||||
pos.x += delta_speed * cos(angle * 3.14159f / 180.0f);
|
||||
pos.y += delta_speed * sin(angle * 3.14159f / 180.0f);
|
||||
pos.x += deltaSpeed * cos(angle * 3.14159f / 180.0f);
|
||||
pos.y += deltaSpeed * sin(angle * 3.14159f / 180.0f);
|
||||
}
|
||||
|
||||
if (CPad::NewMouseControllerState.wheelUp)
|
||||
{
|
||||
if (freecam::fov > 10.0f)
|
||||
freecam::fov -= 2.0f * delta_speed;
|
||||
if (m_Freecam.m_fFOV > 10.0f)
|
||||
m_Freecam.m_fFOV -= 2.0f * deltaSpeed;
|
||||
|
||||
TheCamera.LerpFOV(TheCamera.FindCamFOV(), freecam::fov, 250, true);
|
||||
TheCamera.LerpFOV(TheCamera.FindCamFOV(), m_Freecam.m_fFOV, 250, true);
|
||||
Command<Commands::CAMERA_PERSIST_FOV>(true);
|
||||
}
|
||||
|
||||
if (CPad::NewMouseControllerState.wheelDown)
|
||||
{
|
||||
if (freecam::fov < 115.0f)
|
||||
freecam::fov += 2.0f * delta_speed;
|
||||
if (m_Freecam.m_fFOV < 115.0f)
|
||||
m_Freecam.m_fFOV += 2.0f * deltaSpeed;
|
||||
|
||||
TheCamera.LerpFOV(TheCamera.FindCamFOV(), freecam::fov, 250, true);
|
||||
TheCamera.LerpFOV(TheCamera.FindCamFOV(), m_Freecam.m_fFOV, 250, true);
|
||||
Command<Commands::CAMERA_PERSIST_FOV>(true);
|
||||
}
|
||||
|
||||
freecam::ped->SetHeading(freecam::tmouseX);
|
||||
Command<Commands::ATTACH_CAMERA_TO_CHAR>(freecam::hped, 0.0, 0.0, 20.0, 90.0, 180, freecam::tmouseY, 0.0, 2);
|
||||
freecam::ped->SetPosn(pos);
|
||||
m_Freecam.m_pPed->SetHeading(m_Freecam.m_fTotalMouse.x);
|
||||
Command<Commands::ATTACH_CAMERA_TO_CHAR>(m_Freecam.m_nPed, 0.0, 0.0, 20.0, 90.0, 180, m_Freecam.m_fTotalMouse.y, 0.0, 2);
|
||||
m_Freecam.m_pPed->SetPosn(pos);
|
||||
CIplStore::AddIplsNeededAtPosn(pos);
|
||||
}
|
||||
|
||||
void Game::ClearFreecamStuff()
|
||||
void CGame::ClearFreecamStuff()
|
||||
{
|
||||
freecam::init_done = false;
|
||||
m_Freecam.m_bInitDone = false;
|
||||
Command<Commands::SET_EVERYONE_IGNORE_PLAYER>(0, false);
|
||||
CHud::bScriptDontDisplayRadar = false;
|
||||
CHud::m_Wants_To_Draw_Hud = true;
|
||||
CPad::GetPad(0)->DisablePlayerControls = false;
|
||||
|
||||
Command<Commands::DELETE_CHAR>(freecam::hped);
|
||||
freecam::ped = nullptr;
|
||||
Command<Commands::DELETE_CHAR>(m_Freecam.m_nPed);
|
||||
m_Freecam.m_pPed = nullptr;
|
||||
Command<Commands::CAMERA_PERSIST_FOV>(false);
|
||||
Command<Commands::RESTORE_CAMERA_JUMPCUT>();
|
||||
}
|
||||
|
||||
void Game::Draw()
|
||||
void CGame::Draw()
|
||||
{
|
||||
ImGui::Spacing();
|
||||
CPlayerPed* player = FindPlayerPed();
|
||||
int hplayer = CPools::GetPedRef(player);
|
||||
CPlayerPed* pPlayer = FindPlayerPed();
|
||||
int hplayer = CPools::GetPedRef(pPlayer);
|
||||
|
||||
if (ImGui::BeginTabBar("Game", ImGuiTabBarFlags_NoTooltip + ImGuiTabBarFlags_FittingPolicyScroll))
|
||||
{
|
||||
if (ImGui::BeginTabItem("Checkboxes"))
|
||||
{
|
||||
ImGui::Spacing();
|
||||
ImGui::Columns(2, 0, false);
|
||||
if (ImGui::Checkbox("Disable cheats", &disable_cheats))
|
||||
ImGui::Columns(2, nullptr, false);
|
||||
if (ImGui::Checkbox("Disable cheats", &m_bDisableCheats))
|
||||
{
|
||||
if (disable_cheats)
|
||||
if (m_bDisableCheats)
|
||||
{
|
||||
patch::Set<BYTE>(0x4384D0, 0xE9, false);
|
||||
patch::SetInt(0x4384D1, 0xD0, false);
|
||||
@ -313,9 +313,9 @@ void Game::Draw()
|
||||
patch::SetInt(0x4384D5, 0xCC, false);
|
||||
}
|
||||
}
|
||||
if (ImGui::Checkbox("Disable F1 & F3 replay", &disable_replay))
|
||||
if (ImGui::Checkbox("Disable F1 & F3 replay", &m_bDisableReplay))
|
||||
{
|
||||
if (disable_replay)
|
||||
if (m_bDisableReplay)
|
||||
patch::SetInt(0x460500, 0xC3, false);
|
||||
else
|
||||
patch::SetInt(0x460500, 0xBD844BB, false);
|
||||
@ -323,10 +323,10 @@ void Game::Draw()
|
||||
|
||||
Ui::CheckboxAddress("Faster clock", 0x96913B);
|
||||
|
||||
if (Ui::CheckboxWithHint("Forbidden area wl", &forbidden_area_wl, "Wanted levels that appears outside \
|
||||
if (Ui::CheckboxWithHint("Forbidden area wl", &m_bForbiddenArea, "Wanted levels that appears outside \
|
||||
of LS without completing missions"))
|
||||
{
|
||||
if (forbidden_area_wl)
|
||||
if (m_bForbiddenArea)
|
||||
patch::Set<BYTE>(0x441770, 0x83, false);
|
||||
else
|
||||
patch::Set<BYTE>(0x441770, 0xC3, false);
|
||||
@ -334,52 +334,54 @@ of LS without completing missions"))
|
||||
|
||||
Ui::CheckboxAddress("Free pay n spray", 0x96C009);
|
||||
|
||||
if (ImGui::Checkbox("Freeze misson timer", &freeze_mission_timer))
|
||||
Command<Commands::FREEZE_ONSCREEN_TIMER>(freeze_mission_timer);
|
||||
if (ImGui::Checkbox("Freeze misson timer", &m_bMissionTimer))
|
||||
Command<Commands::FREEZE_ONSCREEN_TIMER>(m_bMissionTimer);
|
||||
|
||||
ImGui::NextColumn();
|
||||
|
||||
if (Ui::CheckboxWithHint("Hard mode", &hard_mode::state, "Makes the game more challanging to play. \n\
|
||||
if (Ui::CheckboxWithHint("Hard mode", &m_HardMode.m_bEnabled, "Makes the game more challanging to play. \n\
|
||||
Lowers armour, health, stamina etc."))
|
||||
{
|
||||
CPlayerPed* player = FindPlayerPed();
|
||||
|
||||
if (hard_mode::state)
|
||||
if (m_HardMode.m_bEnabled)
|
||||
{
|
||||
hard_mode::prev_armour = player->m_fArmour;
|
||||
hard_mode::prev_health = player->m_fHealth;
|
||||
hard_mode::prev_max_health = CStats::GetStatValue(STAT_MAX_HEALTH);
|
||||
hard_mode::prev_stamina = CStats::GetStatValue(STAT_STAMINA);
|
||||
m_HardMode.m_fBacArmour = player->m_fArmour;
|
||||
m_HardMode.m_fBacHealth = player->m_fHealth;
|
||||
m_HardMode.m_fBacMaxHealth = CStats::GetStatValue(STAT_MAX_HEALTH);
|
||||
m_HardMode.m_fBacStamina = CStats::GetStatValue(STAT_STAMINA);
|
||||
player->m_fHealth = 50.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
player->m_fArmour = hard_mode::prev_armour;
|
||||
CStats::SetStatValue(STAT_STAMINA, hard_mode::prev_stamina);
|
||||
CStats::SetStatValue(STAT_MAX_HEALTH, hard_mode::prev_max_health);
|
||||
player->m_fHealth = hard_mode::prev_health;
|
||||
player->m_fArmour = m_HardMode.m_fBacArmour;
|
||||
CStats::SetStatValue(STAT_STAMINA, m_HardMode.m_fBacStamina);
|
||||
CStats::SetStatValue(STAT_MAX_HEALTH, m_HardMode.m_fBacMaxHealth);
|
||||
player->m_fHealth = m_HardMode.m_fBacHealth;
|
||||
CWeaponInfo::LoadWeaponData();
|
||||
}
|
||||
}
|
||||
|
||||
if (Ui::CheckboxWithHint("Keep stuff", &keep_stuff, "Keep stuff after arrest/death"))
|
||||
if (Ui::CheckboxWithHint("Keep stuff", &m_bKeepStuff, "Keep stuff after arrest/death"))
|
||||
{
|
||||
Command<Commands::SWITCH_ARREST_PENALTIES>(keep_stuff);
|
||||
Command<Commands::SWITCH_DEATH_PENALTIES>(keep_stuff);
|
||||
Command<Commands::SWITCH_ARREST_PENALTIES>(m_bKeepStuff);
|
||||
Command<Commands::SWITCH_DEATH_PENALTIES>(m_bKeepStuff);
|
||||
}
|
||||
Ui::CheckboxWithHint("Screenshot shortcut", &ss_shortcut, (("Take screenshot using ") + Ui::GetHotKeyNameString(Menu::hotkeys::quick_ss)
|
||||
+ "\nSaved inside 'GTA San Andreas User Files\\Gallery'").c_str());
|
||||
if (Ui::CheckboxWithHint("Solid water", &solid_water, "Player can walk on water\nTurn this off if you want to swim."))
|
||||
Ui::CheckboxWithHint("Screenshot shortcut", &m_bScreenShot,
|
||||
(("Take screenshot using ") + Ui::GetHotKeyNameString(Menu::m_HotKeys.quickSceenShot)
|
||||
+ "\nSaved inside 'GTA San Andreas User Files\\Gallery'").c_str());
|
||||
if (Ui::CheckboxWithHint("Solid water", &m_bSolidWater,
|
||||
"Player can walk on water\nTurn this off if you want to swim."))
|
||||
{
|
||||
if (!solid_water && solid_water_object != 0)
|
||||
if (!m_bSolidWater && m_nSolidWaterObj != 0)
|
||||
{
|
||||
Command<Commands::DELETE_OBJECT>(solid_water_object);
|
||||
solid_water_object = 0;
|
||||
Command<Commands::DELETE_OBJECT>(m_nSolidWaterObj);
|
||||
m_nSolidWaterObj = 0;
|
||||
}
|
||||
}
|
||||
if (ImGui::Checkbox("Sync system time", &sync_time))
|
||||
if (ImGui::Checkbox("Sync system time", &m_bSyncTime))
|
||||
{
|
||||
if (sync_time)
|
||||
if (m_bSyncTime)
|
||||
patch::RedirectCall(0x53BFBD, &RealTimeClock);
|
||||
else
|
||||
patch::RedirectCall(0x53BFBD, &CClock::Update);
|
||||
@ -393,7 +395,7 @@ Lowers armour, health, stamina etc."))
|
||||
if (ImGui::CollapsingHeader("Current day"))
|
||||
{
|
||||
int day = CClock::CurrentDay - 1;
|
||||
if (Ui::ListBox("Select day", day_names, day))
|
||||
if (Ui::ListBox("Select day", m_DayNames, day))
|
||||
CClock::CurrentDay = day + 1;
|
||||
ImGui::Spacing();
|
||||
ImGui::Separator();
|
||||
@ -402,20 +404,20 @@ Lowers armour, health, stamina etc."))
|
||||
Ui::EditReference("FPS limit", RsGlobal.frameLimit, 1, 30, 60);
|
||||
if (ImGui::CollapsingHeader("Free cam"))
|
||||
{
|
||||
if (Ui::CheckboxWithHint("Enable", &freecam::enable, "Forward: I\tBackward: K\
|
||||
if (Ui::CheckboxWithHint("Enable", &m_Freecam.m_bEnabled, "Forward: I\tBackward: K\
|
||||
\nLeft: J\t\t Right: L\n\nSlower: RCtrl\tFaster: RShift\n\nZoom: Mouse wheel"))
|
||||
{
|
||||
if (!freecam::enable)
|
||||
if (!m_Freecam.m_bEnabled)
|
||||
ClearFreecamStuff();
|
||||
}
|
||||
ImGui::Spacing();
|
||||
|
||||
if (ImGui::SliderFloat("Field of view", &freecam::fov, 5.0f, 120.0f))
|
||||
if (ImGui::SliderFloat("Field of view", &m_Freecam.m_fFOV, 5.0f, 120.0f))
|
||||
{
|
||||
TheCamera.LerpFOV(TheCamera.FindCamFOV(), freecam::fov, 250.0f, true);
|
||||
TheCamera.LerpFOV(TheCamera.FindCamFOV(), m_Freecam.m_fFOV, 250.0f, true);
|
||||
Command<Commands::CAMERA_PERSIST_FOV>(true);
|
||||
}
|
||||
ImGui::SliderFloat("Movement Speed", &freecam::speed, 0.0f, 0.5f);
|
||||
ImGui::SliderFloat("Movement Speed", &m_Freecam.m_fSpeed, 0.0f, 0.5f);
|
||||
ImGui::Spacing();
|
||||
ImGui::TextWrapped("Press Enter to teleport player to camera location");
|
||||
ImGui::Spacing();
|
||||
@ -447,12 +449,14 @@ Lowers armour, health, stamina etc."))
|
||||
ImGui::Separator();
|
||||
}
|
||||
|
||||
static std::vector<Ui::NamedMemory> themes{ { "Beach", 0x969159 }, { "Country" ,0x96917D }, { "Fun house" ,0x969176 }, { "Ninja" ,0x96915C } };
|
||||
static std::vector<Ui::NamedMemory> themes{
|
||||
{"Beach", 0x969159}, {"Country", 0x96917D}, {"Fun house", 0x969176}, {"Ninja", 0x96915C}
|
||||
};
|
||||
Ui::EditRadioButtonAddress("Themes", themes);
|
||||
|
||||
if (ImGui::CollapsingHeader("Weather"))
|
||||
{
|
||||
typedef void func(void);
|
||||
using func = void(void);
|
||||
if (ImGui::Button("Foggy", Ui::GetSize(3)))
|
||||
((func*)0x438F80)();
|
||||
|
||||
@ -484,13 +488,13 @@ Lowers armour, health, stamina etc."))
|
||||
{
|
||||
ImGui::Spacing();
|
||||
|
||||
if (!mission_warning_shown)
|
||||
if (!m_bMissionLoaderWarningShown)
|
||||
{
|
||||
ImGui::TextWrapped("Mission loader might cause unintended changes to your game. \
|
||||
It's recommanded not to save your game after using this. Use it at your own risk!");
|
||||
ImGui::Spacing();
|
||||
if (ImGui::Button("Show mission loader", ImVec2(Ui::GetSize())))\
|
||||
mission_warning_shown = true;
|
||||
if (ImGui::Button("Show mission loader", ImVec2(Ui::GetSize())))
|
||||
m_bMissionLoaderWarningShown = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -502,7 +506,8 @@ It's recommanded not to save your game after using this. Use it at your own risk
|
||||
|
||||
ImGui::Spacing();
|
||||
|
||||
Ui::DrawJSON(mission_data.json, mission_data.categories, mission_data.selected, mission_data.filter, SetPlayerMission, nullptr);
|
||||
Ui::DrawJSON(m_MissionData.m_Json, m_MissionData.m_Categories, m_MissionData.m_Selected, m_MissionData.m_Filter,
|
||||
SetPlayerMission, nullptr);
|
||||
}
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
@ -512,22 +517,22 @@ It's recommanded not to save your game after using this. Use it at your own risk
|
||||
ImGui::Spacing();
|
||||
|
||||
ImGui::PushItemWidth(ImGui::GetContentRegionAvailWidth() / 2 - 5);
|
||||
Ui::ListBoxStr("##Categories", stat::search_categories, stat::selected_item);
|
||||
Ui::ListBoxStr("##Categories", m_StatData.m_Categories, m_StatData.m_Selected);
|
||||
ImGui::SameLine();
|
||||
Ui::FilterWithHint("##Filter", stat::filter, "Search");
|
||||
Ui::FilterWithHint("##Filter", m_StatData.m_Filter, "Search");
|
||||
ImGui::PopItemWidth();
|
||||
|
||||
ImGui::Spacing();
|
||||
|
||||
ImGui::BeginChild("STATCHILD");
|
||||
for (auto root : stat::json.data.items())
|
||||
for (auto root : m_StatData.m_Json.m_Data.items())
|
||||
{
|
||||
if (root.key() == stat::selected_item || stat::selected_item == "All")
|
||||
if (root.key() == m_StatData.m_Selected || m_StatData.m_Selected == "All")
|
||||
{
|
||||
for (auto _data : root.value().items())
|
||||
{
|
||||
std::string name = _data.value().get<std::string>();
|
||||
if (stat::filter.PassFilter(name.c_str()))
|
||||
auto name = _data.value().get<std::string>();
|
||||
if (m_StatData.m_Filter.PassFilter(name.c_str()))
|
||||
Ui::EditStat(name.c_str(), std::stoi(_data.key()));
|
||||
}
|
||||
}
|
||||
@ -538,12 +543,12 @@ It's recommanded not to save your game after using this. Use it at your own risk
|
||||
if (ImGui::BeginTabItem("Random cheats"))
|
||||
{
|
||||
ImGui::Spacing();
|
||||
ImGui::Checkbox("Enable", &random_cheats::enable);
|
||||
ImGui::Checkbox("Enable", &m_RandomCheats.m_bEnabled);
|
||||
ImGui::Spacing();
|
||||
|
||||
ImGui::PushItemWidth(ImGui::GetWindowContentRegionWidth() / 2);
|
||||
|
||||
ImGui::SliderInt("Activate cheat timer", &random_cheats::enable_wait_time, 5, 60);
|
||||
ImGui::SliderInt("Activate cheat timer", &m_RandomCheats.m_nInterval, 5, 60);
|
||||
Ui::ShowTooltip("Wait time after a cheat is activated.");
|
||||
|
||||
ImGui::PopItemWidth();
|
||||
@ -552,11 +557,11 @@ It's recommanded not to save your game after using this. Use it at your own risk
|
||||
ImGui::Separator();
|
||||
if (ImGui::BeginChild("Cheats list"))
|
||||
{
|
||||
for (auto element : random_cheats::enabled_cheats)
|
||||
for (auto element : m_RandomCheats.m_EnabledCheats)
|
||||
{
|
||||
bool selected = (element[1] == "true") ? true : false;
|
||||
|
||||
if (ImGui::MenuItem(element[0].c_str(), 0, selected))
|
||||
if (ImGui::MenuItem(element[0].c_str(), nullptr, selected))
|
||||
element[1] = selected ? "false" : "true";
|
||||
}
|
||||
ImGui::EndChild();
|
||||
|
@ -1,69 +1,57 @@
|
||||
#pragma once
|
||||
class Game
|
||||
class CGame
|
||||
{
|
||||
public:
|
||||
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] = "";
|
||||
|
||||
struct random_cheats
|
||||
inline static SSearchData m_MissionData{"mission"};
|
||||
inline static std::vector<std::string> m_DayNames =
|
||||
{
|
||||
inline static bool enable = false;
|
||||
inline static int enable_wait_time = 10;
|
||||
inline static CJson name_json = CJson("cheat name");
|
||||
inline static uint timer = 0;
|
||||
inline static std::string enabled_cheats[92][2];
|
||||
"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
|
||||
};
|
||||
|
||||
struct freecam
|
||||
static struct
|
||||
{
|
||||
inline static bool enable = false;
|
||||
inline static float speed = 0.08f;
|
||||
inline static float fov = -1;
|
||||
inline static bool init_done = false;
|
||||
inline static CPed* ped = nullptr;
|
||||
inline static int hped = -1;
|
||||
inline static float mouseX = 0.0f;
|
||||
inline static float mouseY = 0.0f;
|
||||
inline static float tmouseX = 0.0f;
|
||||
inline static float tmouseY = 0.0f;
|
||||
};
|
||||
|
||||
struct hard_mode
|
||||
inline static bool m_bEnabled;
|
||||
inline static std::string m_EnabledCheats[92][2];
|
||||
inline static int m_nInterval = 10;
|
||||
inline static CJson m_Json = CJson("cheat name");
|
||||
inline static uint m_nTimer;
|
||||
} m_RandomCheats;
|
||||
static struct
|
||||
{
|
||||
inline static bool state = false;
|
||||
inline static float prev_health = 0.0f;
|
||||
inline static float prev_max_health = 0.0f;
|
||||
inline static float prev_armour = 0.0f;
|
||||
inline static float prev_stamina = 0.0f;
|
||||
};
|
||||
|
||||
inline static bool disable_cheats = false;
|
||||
inline static bool disable_replay = false;
|
||||
inline static bool forbidden_area_wl = true;
|
||||
inline static bool freeze_mission_timer = false;
|
||||
inline static bool freeze_time = false;
|
||||
inline static bool keep_stuff = false;
|
||||
inline static bool solid_water = false;
|
||||
inline static bool ss_shortcut = false;
|
||||
inline static bool sync_time = false;
|
||||
inline static uint sync_time_timer = 0;
|
||||
inline static uint solid_water_object = 0;
|
||||
inline static bool mission_warning_shown = false;
|
||||
|
||||
struct stat
|
||||
inline static bool m_bEnabled;
|
||||
inline static float m_fSpeed = 0.08f;
|
||||
inline static float m_fFOV = -1;
|
||||
inline static bool m_bInitDone;
|
||||
inline static CPed* m_pPed;
|
||||
inline static int m_nPed = -1;
|
||||
inline static CVector m_fMouse;
|
||||
inline static CVector m_fTotalMouse;
|
||||
} m_Freecam;
|
||||
static struct
|
||||
{
|
||||
inline static CJson json = CJson("stat");
|
||||
inline static ImGuiTextFilter filter = "";
|
||||
inline static std::vector<std::string> search_categories;
|
||||
inline static std::string selected_item = "All";
|
||||
};
|
||||
inline static bool m_bEnabled;
|
||||
inline static float m_fBacHealth = 0.0f;
|
||||
inline static float m_fBacMaxHealth = 0.0f;
|
||||
inline static float m_fBacArmour = 0.0f;
|
||||
inline static float m_fBacStamina = 0.0f;
|
||||
} m_HardMode;
|
||||
inline static bool m_bDisableCheats;
|
||||
inline static bool m_bDisableReplay;
|
||||
inline static bool m_bForbiddenArea = true;
|
||||
inline static bool m_bMissionTimer;
|
||||
inline static bool m_bFreezeTime;
|
||||
inline static bool m_bKeepStuff;
|
||||
inline static bool m_bSolidWater;
|
||||
inline static bool m_bScreenShot;
|
||||
inline static bool m_bSyncTime;
|
||||
inline static uint m_nSyncTimer;
|
||||
inline static uint m_nSolidWaterObj;
|
||||
inline static bool m_bMissionLoaderWarningShown;
|
||||
|
||||
Game();
|
||||
inline static SSearchData m_StatData{ "stat" };
|
||||
|
||||
CGame();
|
||||
static void Draw();
|
||||
static void FreeCam();
|
||||
static void ClearFreecamStuff();
|
||||
static void RealTimeClock();
|
||||
};
|
||||
|
||||
|
@ -6,7 +6,7 @@ LRESULT Hook::WndProc(const HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
ImGui_ImplWin32_WndProcHandler(hWnd, uMsg, wParam, lParam);
|
||||
|
||||
if (Hook::show_mouse)
|
||||
if (m_bShowMouse)
|
||||
{
|
||||
patch::Nop(0x4EB9F4, 5); // disable radio scroll
|
||||
CPad::ClearMouseHistory();
|
||||
@ -35,20 +35,20 @@ HRESULT Hook::Reset(IDirect3DDevice9* pDevice, D3DPRESENT_PARAMETERS* pPresentat
|
||||
|
||||
void Hook::RenderFrame(void* ptr)
|
||||
{
|
||||
if (!ImGui::GetCurrentContext() || Globals::menu_closing)
|
||||
if (!ImGui::GetCurrentContext())
|
||||
return;
|
||||
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
|
||||
if (Globals::init_done)
|
||||
{
|
||||
Hook::ShowMouse(show_mouse);
|
||||
if (Globals::m_bInit)
|
||||
{
|
||||
ShowMouse(m_bShowMouse);
|
||||
|
||||
// handle window scaling here
|
||||
ImVec2 size(screen::GetScreenWidth(), screen::GetScreenHeight());
|
||||
if (Globals::screen_size.x != size.x && Globals::screen_size.y != size.y)
|
||||
if (Globals::m_fScreenSize.x != size.x && Globals::m_fScreenSize.y != size.y)
|
||||
{
|
||||
int font_size = int(size.y / 54.85f); // manually tested
|
||||
int font_size = static_cast<int>(size.y / 54.85f); // manually tested
|
||||
|
||||
io.FontDefault = io.Fonts->AddFontFromFileTTF("C:/Windows/Fonts/trebucbd.ttf", font_size);
|
||||
io.Fonts->Build();
|
||||
@ -58,10 +58,10 @@ void Hook::RenderFrame(void* ptr)
|
||||
else
|
||||
ImGui_ImplDX11_InvalidateDeviceObjects();
|
||||
|
||||
if (Globals::screen_size.x != -1 && Globals::screen_size.y != -1)
|
||||
if (Globals::m_fScreenSize.x != -1 && Globals::m_fScreenSize.y != -1)
|
||||
{
|
||||
Globals::menu_size.x += (size.x - Globals::screen_size.x) / 4.0f;
|
||||
Globals::menu_size.y += (size.y - Globals::screen_size.y) / 1.2f;
|
||||
Globals::m_fMenuSize.x += (size.x - Globals::m_fScreenSize.x) / 4.0f;
|
||||
Globals::m_fMenuSize.y += (size.y - Globals::m_fScreenSize.y) / 1.2f;
|
||||
}
|
||||
|
||||
ImGuiStyle* style = &ImGui::GetStyle();
|
||||
@ -74,7 +74,7 @@ void Hook::RenderFrame(void* ptr)
|
||||
style->IndentSpacing = 20 * scale_x;
|
||||
style->ItemInnerSpacing = ImVec2(4 * scale_x, 4 * scale_y);
|
||||
|
||||
Globals::screen_size = size;
|
||||
Globals::m_fScreenSize = size;
|
||||
}
|
||||
|
||||
ImGui_ImplWin32_NewFrame();
|
||||
@ -85,7 +85,7 @@ void Hook::RenderFrame(void* ptr)
|
||||
|
||||
ImGui::NewFrame();
|
||||
|
||||
if (window_callback != NULL)
|
||||
if (window_callback != nullptr)
|
||||
window_callback();
|
||||
|
||||
ImGui::EndFrame();
|
||||
@ -98,7 +98,7 @@ void Hook::RenderFrame(void* ptr)
|
||||
}
|
||||
else
|
||||
{
|
||||
Globals::init_done = true;
|
||||
Globals::m_bInit = true;
|
||||
ImGui::CreateContext();
|
||||
|
||||
ImGuiStyle& style = ImGui::GetStyle();
|
||||
@ -116,7 +116,7 @@ void Hook::RenderFrame(void* ptr)
|
||||
else
|
||||
{
|
||||
// for dx11 device ptr is swapchain
|
||||
reinterpret_cast<IDXGISwapChain*>(ptr)->GetDevice(__uuidof(ID3D11Device), (void**)&Globals::device);
|
||||
reinterpret_cast<IDXGISwapChain*>(ptr)->GetDevice(__uuidof(ID3D11Device), &Globals::device);
|
||||
ID3D11DeviceContext* context;
|
||||
reinterpret_cast<ID3D11Device*>(Globals::device)->GetImmediateContext(&context);
|
||||
|
||||
@ -125,8 +125,8 @@ void Hook::RenderFrame(void* ptr)
|
||||
|
||||
ImGui_ImplWin32_EnableDpiAwareness();
|
||||
|
||||
io.IniFilename = NULL;
|
||||
io.LogFilename = NULL;
|
||||
io.IniFilename = nullptr;
|
||||
io.LogFilename = nullptr;
|
||||
io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad && ImGuiConfigFlags_NavEnableKeyboard;
|
||||
|
||||
style.WindowTitleAlign = ImVec2(0.5, 0.5);
|
||||
@ -163,16 +163,17 @@ void Hook::ShowMouse(bool state)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mouse_visibility != show_mouse)
|
||||
if (m_bMouseVisibility != m_bShowMouse)
|
||||
{
|
||||
patch::SetUChar(0x6194A0, 0xE9); // jmp setup
|
||||
patch::SetUChar(0x746ED0, 0xA1);
|
||||
patch::SetRaw(0x53F41F, (void*)"\x85\xC0\x0F\x8C", 4); // xor eax, eax -> test eax, eax , enable camera mouse movement
|
||||
// jz loc_53F526 -> jl loc_53F526
|
||||
patch::SetRaw(0x53F41F, (void*)"\x85\xC0\x0F\x8C", 4);
|
||||
// xor eax, eax -> test eax, eax , enable camera mouse movement
|
||||
// jz loc_53F526 -> jl loc_53F526
|
||||
}
|
||||
}
|
||||
|
||||
if (mouse_visibility != show_mouse)
|
||||
if (m_bMouseVisibility != m_bShowMouse)
|
||||
{
|
||||
CPad::ClearMouseHistory();
|
||||
CPad::UpdatePads();
|
||||
@ -182,7 +183,7 @@ void Hook::ShowMouse(bool state)
|
||||
|
||||
CPad::NewMouseControllerState.X = 0;
|
||||
CPad::NewMouseControllerState.Y = 0;
|
||||
mouse_visibility = show_mouse;
|
||||
m_bMouseVisibility = m_bShowMouse;
|
||||
}
|
||||
}
|
||||
|
||||
@ -191,14 +192,14 @@ Hook::Hook()
|
||||
ImGui::CreateContext();
|
||||
|
||||
// gtaRenderHook
|
||||
if (kiero::init(kiero::RenderType::D3D11) == kiero::Status::Success)
|
||||
if (init(kiero::RenderType::D3D11) == kiero::Status::Success)
|
||||
{
|
||||
Globals::renderer = Render_DirectX11;
|
||||
kiero::bind(8, (void**)&oPresent11, Dx11Handler);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (kiero::init(kiero::RenderType::D3D9) == kiero::Status::Success)
|
||||
if (init(kiero::RenderType::D3D9) == kiero::Status::Success)
|
||||
{
|
||||
Globals::renderer = Render_DirectX9;
|
||||
kiero::bind(16, (void**)&oReset, Reset);
|
||||
@ -214,4 +215,4 @@ Hook::~Hook()
|
||||
ImGui_ImplWin32_Shutdown();
|
||||
ImGui::DestroyContext();
|
||||
kiero::shutdown();
|
||||
}
|
||||
}
|
||||
|
@ -1,33 +1,31 @@
|
||||
#pragma once
|
||||
#include "pch.h"
|
||||
|
||||
typedef HRESULT(CALLBACK* f_EndScene)(IDirect3DDevice9*);
|
||||
typedef HRESULT(CALLBACK* f_Present11)(IDXGISwapChain*, UINT, UINT);
|
||||
typedef HRESULT(CALLBACK* f_Reset)(IDirect3DDevice9*, D3DPRESENT_PARAMETERS*);
|
||||
using f_EndScene = HRESULT(CALLBACK*)(IDirect3DDevice9*);
|
||||
using f_Present11 = HRESULT(CALLBACK*)(IDXGISwapChain*, UINT, UINT);
|
||||
using f_Reset = HRESULT(CALLBACK*)(IDirect3DDevice9*, D3DPRESENT_PARAMETERS*);
|
||||
|
||||
extern IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
class Hook
|
||||
{
|
||||
private:
|
||||
inline static WNDPROC oWndProc = NULL;
|
||||
inline static f_Present11 oPresent11 = NULL;
|
||||
inline static f_EndScene oEndScene = NULL;
|
||||
inline static f_Reset oReset = NULL;
|
||||
inline static bool mouse_visibility = false;
|
||||
inline static WNDPROC oWndProc;
|
||||
inline static f_Present11 oPresent11;
|
||||
inline static f_EndScene oEndScene;
|
||||
inline static f_Reset oReset;
|
||||
inline static bool m_bMouseVisibility;
|
||||
|
||||
static void CALLBACK RenderFrame(void* ptr);
|
||||
static HRESULT CALLBACK Dx9Handler(IDirect3DDevice9* pDevice);
|
||||
static HRESULT CALLBACK Dx11Handler(IDXGISwapChain* pSwapChain, UINT SyncInterval, UINT Flags);
|
||||
static HRESULT CALLBACK Reset(IDirect3DDevice9* pDevice, D3DPRESENT_PARAMETERS* pPresentationParameters);
|
||||
static LRESULT CALLBACK WndProc(const HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
static void ShowMouse(bool state);
|
||||
|
||||
protected:
|
||||
inline static bool show_mouse = false;
|
||||
inline static std::function<void()> window_callback = NULL;
|
||||
inline static bool m_bShowMouse = false;
|
||||
inline static std::function<void()> window_callback = nullptr;
|
||||
Hook();
|
||||
~Hook();
|
||||
};
|
||||
|
||||
|
||||
|
@ -6,42 +6,42 @@ CJson::CJson(const char* name)
|
||||
if (name == "")
|
||||
return;
|
||||
|
||||
file_path = PLUGIN_PATH((char*)"/CheatMenu/json/") + std::string(name) + ".json";
|
||||
m_FilePath = PLUGIN_PATH((char*)"/CheatMenu/json/") + std::string(name) + ".json";
|
||||
|
||||
if (fs::exists(file_path))
|
||||
if (fs::exists(m_FilePath))
|
||||
{
|
||||
try
|
||||
{
|
||||
std::ifstream file(file_path);
|
||||
file >> data;
|
||||
std::ifstream file(m_FilePath);
|
||||
file >> m_Data;
|
||||
file.close();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
flog << "Error trying to read " << file_path << std::endl;
|
||||
data = "{}"_json;
|
||||
flog << "Error trying to read " << m_FilePath << std::endl;
|
||||
m_Data = "{}"_json;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
data = "{}"_json;
|
||||
m_Data = "{}"_json;
|
||||
|
||||
if (file_path.find("config"))
|
||||
if (m_FilePath.find("config"))
|
||||
flog << "Creating config.json file" << std::endl;
|
||||
else
|
||||
flog << "Failed to locate file " << file_path << std::endl;
|
||||
flog << "Failed to locate file " << m_FilePath << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void CJson::WriteToDisk()
|
||||
{
|
||||
std::ofstream file(file_path);
|
||||
file << data.dump(4, ' ', false, nlohmann::json::error_handler_t::replace) << std::endl;
|
||||
std::ofstream file(m_FilePath);
|
||||
file << m_Data.dump(4, ' ', false, nlohmann::json::error_handler_t::replace) << std::endl;
|
||||
file.close();
|
||||
}
|
||||
|
||||
void CJson::LoadData(std::vector<std::string>& vec, std::string& selected) // Test
|
||||
{
|
||||
for (auto element : data.items())
|
||||
for (auto element : m_Data.items())
|
||||
vec.push_back(element.key());
|
||||
}
|
||||
}
|
||||
|
@ -3,11 +3,10 @@
|
||||
|
||||
class CJson
|
||||
{
|
||||
|
||||
private:
|
||||
std::string file_path;
|
||||
std::string m_FilePath;
|
||||
public:
|
||||
nlohmann::json data;
|
||||
nlohmann::json m_Data;
|
||||
|
||||
/*
|
||||
Returns a value from json structure hierarchy using '.'
|
||||
@ -16,13 +15,14 @@ public:
|
||||
// specialize since typeid(std::string) doesn't work
|
||||
|
||||
template <typename T>
|
||||
T GetValue(std::string&& key, T&& default_val)
|
||||
T GetValue(std::string&& key, T&& defaultVal)
|
||||
{
|
||||
try {
|
||||
try
|
||||
{
|
||||
std::stringstream ss(key);
|
||||
std::string line;
|
||||
|
||||
nlohmann::json* json = &data;
|
||||
nlohmann::json* json = &m_Data;
|
||||
|
||||
while (getline(ss, line, '.'))
|
||||
json = &((*json)[line]);
|
||||
@ -32,30 +32,32 @@ public:
|
||||
{
|
||||
return ((json->get<int>() == 1) ? true : false);
|
||||
}
|
||||
else
|
||||
return json->get<T>();
|
||||
return json->get<T>();
|
||||
}
|
||||
catch (...) {
|
||||
return default_val;
|
||||
catch (...)
|
||||
{
|
||||
return defaultVal;
|
||||
}
|
||||
}
|
||||
|
||||
template<>
|
||||
std::string GetValue(std::string&& key, std::string&& default_val)
|
||||
template <>
|
||||
std::string GetValue(std::string&& key, std::string&& defaultVal)
|
||||
{
|
||||
try {
|
||||
try
|
||||
{
|
||||
std::stringstream ss(key);
|
||||
std::string line;
|
||||
|
||||
nlohmann::json* json = &data;
|
||||
nlohmann::json* json = &m_Data;
|
||||
|
||||
while (getline(ss, line, '.'))
|
||||
json = &((*json)[line]);
|
||||
|
||||
return json->get<std::string>();
|
||||
}
|
||||
catch (...) {
|
||||
return default_val;
|
||||
catch (...)
|
||||
{
|
||||
return defaultVal;
|
||||
}
|
||||
}
|
||||
|
||||
@ -70,7 +72,7 @@ public:
|
||||
std::stringstream ss(key);
|
||||
std::string line;
|
||||
|
||||
nlohmann::json* json = &data;
|
||||
nlohmann::json* json = &m_Data;
|
||||
|
||||
while (getline(ss, line, '.'))
|
||||
json = &((*json)[line]);
|
||||
@ -82,19 +84,20 @@ public:
|
||||
*json = val;
|
||||
}
|
||||
|
||||
template<>
|
||||
template <>
|
||||
void SetValue(std::string&& key, std::string& val)
|
||||
{
|
||||
std::stringstream ss(key);
|
||||
std::string line;
|
||||
|
||||
nlohmann::json* json = &data;
|
||||
nlohmann::json* json = &m_Data;
|
||||
|
||||
while (getline(ss, line, '.'))
|
||||
json = &((*json)[line]);
|
||||
|
||||
*json = val;
|
||||
}
|
||||
|
||||
/*
|
||||
Loads the section names into a category vector.
|
||||
Used to create drop down category menus
|
||||
@ -107,5 +110,3 @@ public:
|
||||
void WriteToDisk();
|
||||
CJson(const char* text = "");
|
||||
};
|
||||
|
||||
|
||||
|
@ -12,143 +12,164 @@ Menu::Menu()
|
||||
{
|
||||
// TODO: use structs
|
||||
// Load config data
|
||||
overlay::bCoord = config.GetValue("overlay.bCoord", false);
|
||||
overlay::bCpuUsage = config.GetValue("overlay.bCpuUsage", false);
|
||||
overlay::bFPS = config.GetValue("overlay.bFPS", false);
|
||||
overlay::bLocName = config.GetValue("overlay.bLocName", false);
|
||||
overlay::bTransparent = config.GetValue("overlay.bTransparent", false);
|
||||
overlay::bMemUsage = config.GetValue("overlay.bMemUsage", false);
|
||||
overlay::bVehHealth = config.GetValue("overlay.bVehHealth", false);
|
||||
overlay::bVehSpeed = config.GetValue("overlay.bVehSpeed", false);
|
||||
overlay::mSelectedPos = config.GetValue("overlay.mSelectedPos", 4);
|
||||
overlay::fPosX = config.GetValue("overlay.fPosX", 0);
|
||||
overlay::fPosY = config.GetValue("overlay.fPosY", 0);
|
||||
m_Overlay.bCoord = config.GetValue("overlay.bCoord", false);
|
||||
m_Overlay.bCpuUsage = config.GetValue("overlay.bCpuUsage", false);
|
||||
m_Overlay.bFPS = config.GetValue("overlay.bFPS", false);
|
||||
m_Overlay.bLocName = config.GetValue("overlay.bLocName", false);
|
||||
m_Overlay.bTransparent = config.GetValue("overlay.bTransparent", false);
|
||||
m_Overlay.bMemUsage = config.GetValue("overlay.bMemUsage", false);
|
||||
m_Overlay.bVehHealth = config.GetValue("overlay.bVehHealth", false);
|
||||
m_Overlay.bVehSpeed = config.GetValue("overlay.bVehSpeed", false);
|
||||
m_Overlay.mSelectedPos = (DISPLAY_POS)config.GetValue("overlay.mSelectedPos", (int)DISPLAY_POS::BOTTOM_RIGHT);
|
||||
m_Overlay.fPosX = config.GetValue("overlay.fPosX", 0);
|
||||
m_Overlay.fPosY = config.GetValue("overlay.fPosY", 0);
|
||||
|
||||
// Hotkeys
|
||||
hotkeys::aim_skin_changer.key1 = config.GetValue("hotkey.aim_skin_changer.key1", VK_RETURN);
|
||||
hotkeys::aim_skin_changer.key2 = config.GetValue("hotkey.aim_skin_changer.key2", VK_RETURN);
|
||||
m_HotKeys.aimSkinChanger.m_key1 = config.GetValue("hotkey.aim_skin_changer.key1", VK_RETURN);
|
||||
m_HotKeys.aimSkinChanger.m_key2 = config.GetValue("hotkey.aim_skin_changer.key2", VK_RETURN);
|
||||
|
||||
hotkeys::freecam.key1 = config.GetValue("hotkey.freecam.key1", VK_F6);
|
||||
hotkeys::freecam.key2 = config.GetValue("hotkey.freecam.key2", VK_F6);
|
||||
m_HotKeys.freeCam.m_key1 = config.GetValue("hotkey.freecam.key1", VK_F6);
|
||||
m_HotKeys.freeCam.m_key2 = config.GetValue("hotkey.freecam.key2", VK_F6);
|
||||
|
||||
hotkeys::quick_ss.key1 = config.GetValue("hotkey.quick_screenshot.key1", VK_F5);
|
||||
hotkeys::quick_ss.key2 = config.GetValue("hotkey.quick_screenshot.key2", VK_F5);
|
||||
m_HotKeys.quickSceenShot.m_key1 = config.GetValue("hotkey.quick_screenshot.key1", VK_F5);
|
||||
m_HotKeys.quickSceenShot.m_key2 = config.GetValue("hotkey.quick_screenshot.key2", VK_F5);
|
||||
|
||||
hotkeys::quick_tp.key1 = config.GetValue("hotkey.quick_tp.key1", VK_KEY_X);
|
||||
hotkeys::quick_tp.key2 = config.GetValue("hotkey.quick_tp.key2", VK_KEY_Y);
|
||||
m_HotKeys.quickTeleport.m_key1 = config.GetValue("hotkey.quick_tp.key1", VK_KEY_X);
|
||||
m_HotKeys.quickTeleport.m_key2 = config.GetValue("hotkey.quick_tp.key2", VK_KEY_Y);
|
||||
|
||||
hotkeys::menu_open.key1 = config.GetValue("hotkey.menu_open.key1", VK_LCONTROL);
|
||||
hotkeys::menu_open.key2 = config.GetValue("hotkey.menu_open.key2", VK_KEY_M);
|
||||
m_HotKeys.menuOpen.m_key1 = config.GetValue("hotkey.menu_open.key1", VK_LCONTROL);
|
||||
m_HotKeys.menuOpen.m_key2 = config.GetValue("hotkey.menu_open.key2", VK_KEY_M);
|
||||
|
||||
hotkeys::command_window.key1 = config.GetValue("hotkey.command_window.key1", VK_LMENU);
|
||||
hotkeys::command_window.key2 = config.GetValue("hotkey.command_window.key2", VK_KEY_C);
|
||||
m_HotKeys.commandWindow.m_key1 = config.GetValue("hotkey.command_window.key1", VK_LMENU);
|
||||
m_HotKeys.commandWindow.m_key2 = config.GetValue("hotkey.command_window.key2", VK_KEY_C);
|
||||
|
||||
hotkeys::flip_veh.key1 = config.GetValue("hotkey.flip_veh.key1", VK_NONE);
|
||||
hotkeys::flip_veh.key2 = config.GetValue("hotkey.flip_veh.key2", VK_NONE);
|
||||
m_HotKeys.flipVeh.m_key1 = config.GetValue("hotkey.flip_veh.key1", VK_NONE);
|
||||
m_HotKeys.flipVeh.m_key2 = config.GetValue("hotkey.flip_veh.key2", VK_NONE);
|
||||
|
||||
hotkeys::fix_veh.key1 = config.GetValue("hotkey.fix_veh.key1", VK_NONE);
|
||||
hotkeys::fix_veh.key2 = config.GetValue("hotkey.fix_veh.key2", VK_NONE);
|
||||
m_HotKeys.fixVeh.m_key1 = config.GetValue("hotkey.fix_veh.key1", VK_NONE);
|
||||
m_HotKeys.fixVeh.m_key2 = config.GetValue("hotkey.fix_veh.key2", VK_NONE);
|
||||
|
||||
hotkeys::god_mode.key1 = config.GetValue("hotkey.god_mode.key1", VK_NONE);
|
||||
hotkeys::god_mode.key2 = config.GetValue("hotkey.god_mode.key2", VK_NONE);
|
||||
m_HotKeys.godMode.m_key1 = config.GetValue("hotkey.god_mode.key1", VK_NONE);
|
||||
m_HotKeys.godMode.m_key2 = config.GetValue("hotkey.god_mode.key2", VK_NONE);
|
||||
|
||||
hotkeys::veh_engine.key1 = config.GetValue("hotkey.veh_engine.key1", VK_NONE);
|
||||
hotkeys::veh_engine.key2 = config.GetValue("hotkey.veh_engine.key2", VK_NONE);
|
||||
m_HotKeys.vehEngine.m_key1 = config.GetValue("hotkey.veh_engine.key1", VK_NONE);
|
||||
m_HotKeys.vehEngine.m_key2 = config.GetValue("hotkey.veh_engine.key2", VK_NONE);
|
||||
|
||||
hotkeys::veh_instant_start.key1 = config.GetValue("hotkey.veh_instant_start.key1", VK_NONE);
|
||||
hotkeys::veh_instant_start.key2 = config.GetValue("hotkey.veh_instant_start.key2", VK_NONE);
|
||||
m_HotKeys.vehInstantStart.m_key1 = config.GetValue("hotkey.veh_instant_start.key1", VK_NONE);
|
||||
m_HotKeys.vehInstantStart.m_key2 = config.GetValue("hotkey.veh_instant_start.key2", VK_NONE);
|
||||
|
||||
hotkeys::veh_instant_stop.key1 = config.GetValue("hotkey.veh_instant_stop.key1", VK_NONE);
|
||||
hotkeys::veh_instant_stop.key2 = config.GetValue("hotkey.veh_instant_stop.key2", VK_NONE);
|
||||
m_HotKeys.vehInstantStop.m_key1 = config.GetValue("hotkey.veh_instant_stop.key1", VK_NONE);
|
||||
m_HotKeys.vehInstantStop.m_key2 = config.GetValue("hotkey.veh_instant_stop.key2", VK_NONE);
|
||||
|
||||
Util::GetCPUUsageInit();
|
||||
MEMORYSTATUSEX memInfo;
|
||||
memInfo.dwLength = sizeof(MEMORYSTATUSEX);
|
||||
GlobalMemoryStatusEx(&memInfo);
|
||||
|
||||
overlay::mTotalRam = int(memInfo.ullTotalPhys * 1e-6); // Bytes -> MegaBytes
|
||||
m_Overlay.mTotalRam = static_cast<int>(memInfo.ullTotalPhys * 1e-6); // Bytes -> MegaBytes
|
||||
}
|
||||
|
||||
void Menu::DrawOverlay()
|
||||
{
|
||||
CPlayerPed* player = FindPlayerPed();
|
||||
bool show_menu = overlay::bCoord || overlay::bFPS || overlay::bLocName ||
|
||||
((overlay::bVehHealth || overlay::bVehSpeed) && player->m_pVehicle && player->m_pVehicle->IsDriver(player));
|
||||
bool m_bShowMenu = m_Overlay.bCoord || m_Overlay.bFPS || m_Overlay.bLocName || m_Overlay.bCpuUsage || m_Overlay.bMemUsage ||
|
||||
((m_Overlay.bVehHealth || m_Overlay.bVehSpeed) && player->m_pVehicle && player->m_pVehicle->IsDriver(player));
|
||||
|
||||
int corner = overlay::mSelectedPos - 1;
|
||||
const float offset = 10.0f;
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
ImGuiWindowFlags window_flags = ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoNav;
|
||||
ImGuiWindowFlags window_flags = ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_AlwaysAutoResize |
|
||||
ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoNav;
|
||||
|
||||
if (corner != -1)
|
||||
if (m_Overlay.mSelectedPos == DISPLAY_POS::CUSTOM)
|
||||
{
|
||||
window_flags |= ImGuiWindowFlags_NoMove;
|
||||
ImVec2 window_pos = ImVec2((corner & 1) ? io.DisplaySize.x - offset : offset, (corner & 2) ? io.DisplaySize.y - offset : offset);
|
||||
ImVec2 window_pos_pivot = ImVec2((corner & 1) ? 1.0f : 0.0f, (corner & 2) ? 1.0f : 0.0f);
|
||||
ImGui::SetNextWindowPos(window_pos, ImGuiCond_Always, window_pos_pivot);
|
||||
if (m_Overlay.fPosX != NULL && m_Overlay.fPosY != NULL)
|
||||
{
|
||||
config.SetValue("overlay.fPosX", m_Overlay.fPosX);
|
||||
config.SetValue("overlay.fPosY", m_Overlay.fPosY);
|
||||
ImGui::SetNextWindowPos(ImVec2(m_Overlay.fPosX, m_Overlay.fPosY), ImGuiCond_Once);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (overlay::fPosX != NULL && overlay::fPosY != NULL)
|
||||
window_flags |= ImGuiWindowFlags_NoMove;
|
||||
ImVec2 pos, pivot;
|
||||
|
||||
if (m_Overlay.mSelectedPos == DISPLAY_POS::TOP_LEFT)
|
||||
{
|
||||
config.SetValue("overlay.fPosX", overlay::fPosX);
|
||||
config.SetValue("overlay.fPosY", overlay::fPosY);
|
||||
ImGui::SetNextWindowPos(ImVec2(overlay::fPosX, overlay::fPosY), ImGuiCond_Once);
|
||||
pos = ImVec2(offset, offset);
|
||||
pivot = ImVec2(0.0f, 0.0f);
|
||||
}
|
||||
|
||||
if (m_Overlay.mSelectedPos == DISPLAY_POS::TOP_RIGHT)
|
||||
{
|
||||
pos = ImVec2(io.DisplaySize.x - offset, offset);
|
||||
pivot = ImVec2(1.0f, 0.0f);
|
||||
}
|
||||
|
||||
if (m_Overlay.mSelectedPos == DISPLAY_POS::BOTTOM_LEFT)
|
||||
{
|
||||
pos = ImVec2(offset, io.DisplaySize.y - offset);
|
||||
pivot = ImVec2(0.0f, 1.0f);
|
||||
}
|
||||
|
||||
if (m_Overlay.mSelectedPos == DISPLAY_POS::BOTTOM_RIGHT)
|
||||
{
|
||||
pos = ImVec2(io.DisplaySize.x - offset, io.DisplaySize.y - offset);
|
||||
pivot = ImVec2(1.0f, 1.0f);
|
||||
}
|
||||
|
||||
ImGui::SetNextWindowPos(pos, ImGuiCond_Always, pivot);
|
||||
}
|
||||
|
||||
ImGui::SetNextWindowBgAlpha(overlay::bTransparent ? 0.0f : 0.5f);
|
||||
ImGui::SetNextWindowBgAlpha(m_Overlay.bTransparent ? 0.0f : 0.5f);
|
||||
|
||||
if (show_menu && ImGui::Begin("Overlay", NULL, window_flags))
|
||||
if (m_bShowMenu && ImGui::Begin("Overlay", nullptr, window_flags))
|
||||
{
|
||||
CPlayerPed* player = FindPlayerPed();
|
||||
CVector pos = player->GetPosition();
|
||||
size_t game_ms = CTimer::m_snTimeInMilliseconds;
|
||||
|
||||
if (game_ms - overlay::mLastInterval > overlay::mInterval)
|
||||
if (game_ms - m_Overlay.mLastInterval > m_Overlay.mInterval)
|
||||
{
|
||||
overlay::fCpuUsage = (float)Util::GetCurrentCPUUsage();
|
||||
m_Overlay.fCpuUsage = static_cast<float>(Util::GetCurrentCPUUsage());
|
||||
|
||||
MEMORYSTATUSEX memInfo;
|
||||
memInfo.dwLength = sizeof(MEMORYSTATUSEX);
|
||||
GlobalMemoryStatusEx(&memInfo);
|
||||
int mUsedRam = int((memInfo.ullTotalPhys - memInfo.ullAvailPhys) * 1e-6);
|
||||
overlay::fMemUsage = 100.0f * (float(mUsedRam) / float(overlay::mTotalRam));
|
||||
overlay::mFPS = (size_t)CTimer::game_FPS;
|
||||
int mUsedRam = static_cast<int>((memInfo.ullTotalPhys - memInfo.ullAvailPhys) * 1e-6);
|
||||
m_Overlay.fMemUsage = 100.0f * (static_cast<float>(mUsedRam) / static_cast<float>(m_Overlay.mTotalRam));
|
||||
m_Overlay.mFPS = static_cast<size_t>(CTimer::game_FPS);
|
||||
|
||||
overlay::mLastInterval = game_ms;
|
||||
m_Overlay.mLastInterval = game_ms;
|
||||
}
|
||||
|
||||
if (overlay::bCoord)
|
||||
if (m_Overlay.bCoord)
|
||||
ImGui::Text("Coord: %.2f, %.2f, %.2f", pos.x, pos.y, pos.z);
|
||||
|
||||
if (overlay::bCpuUsage)
|
||||
ImGui::Text("CPU usage: %.2f%%", overlay::fCpuUsage);
|
||||
if (m_Overlay.bCpuUsage)
|
||||
ImGui::Text("CPU usage: %.2f%%", m_Overlay.fCpuUsage);
|
||||
|
||||
if (overlay::bFPS)
|
||||
ImGui::Text("Frames: %d", overlay::mFPS);
|
||||
if (m_Overlay.bFPS)
|
||||
ImGui::Text("Frames: %d", m_Overlay.mFPS);
|
||||
|
||||
if (overlay::bLocName)
|
||||
if (m_Overlay.bLocName)
|
||||
ImGui::Text("Location: %s", Util::GetLocationName(&pos).c_str());
|
||||
|
||||
if (overlay::bMemUsage)
|
||||
ImGui::Text("RAM usage: %.2f%%", overlay::fMemUsage);
|
||||
if (m_Overlay.bMemUsage)
|
||||
ImGui::Text("RAM usage: %.2f%%", m_Overlay.fMemUsage);
|
||||
|
||||
if (player->m_pVehicle && player->m_pVehicle->IsDriver(player))
|
||||
{
|
||||
if (overlay::bVehHealth)
|
||||
if (m_Overlay.bVehHealth)
|
||||
ImGui::Text("Veh Health: %.f", player->m_pVehicle->m_fHealth);
|
||||
|
||||
if (overlay::bVehSpeed)
|
||||
{
|
||||
int speed = player->m_pVehicle->m_vecMoveSpeed.Magnitude() * 50; // 02E3 - GET_CAR_SPEED
|
||||
ImGui::Text("Veh Speed: %d", speed);
|
||||
}
|
||||
if (m_Overlay.bVehSpeed)
|
||||
ImGui::Text("Veh Speed: %d", int(player->m_pVehicle->m_vecMoveSpeed.Magnitude()) * 50); // 02E3 - GET_CAR_SPEED
|
||||
}
|
||||
|
||||
ImVec2 windowPos = ImGui::GetWindowPos();
|
||||
overlay::fPosX = windowPos.x;
|
||||
overlay::fPosY = windowPos.y;
|
||||
m_Overlay.fPosX = windowPos.x;
|
||||
m_Overlay.fPosY = windowPos.y;
|
||||
|
||||
ImGui::End();
|
||||
}
|
||||
@ -156,16 +177,17 @@ void Menu::DrawOverlay()
|
||||
|
||||
void Menu::DrawShortcutsWindow()
|
||||
{
|
||||
int resX = int(screen::GetScreenWidth());
|
||||
int resY = int(screen::GetScreenHeight());
|
||||
int resX = static_cast<int>(screen::GetScreenWidth());
|
||||
int resY = static_cast<int>(screen::GetScreenHeight());
|
||||
|
||||
ImGui::SetNextWindowPos(ImVec2(0, resY - 40), ImGuiCond_Always);
|
||||
ImGui::SetNextWindowSize(ImVec2(resX, 40));
|
||||
|
||||
ImGuiWindowFlags flags = ImGuiWindowFlags_NoDecoration + ImGuiWindowFlags_AlwaysAutoResize + ImGuiWindowFlags_NoSavedSettings
|
||||
ImGuiWindowFlags flags = ImGuiWindowFlags_NoDecoration + ImGuiWindowFlags_AlwaysAutoResize +
|
||||
ImGuiWindowFlags_NoSavedSettings
|
||||
+ ImGuiWindowFlags_NoMove;
|
||||
|
||||
if (ImGui::Begin("Shortcuts window", NULL, flags))
|
||||
if (ImGui::Begin("Shortcuts window", nullptr, flags))
|
||||
{
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(ImGui::GetStyle().FramePadding.x, resY / 130));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(3, 3));
|
||||
@ -173,11 +195,12 @@ void Menu::DrawShortcutsWindow()
|
||||
ImGui::SetNextItemWidth(resX);
|
||||
ImGui::SetKeyboardFocusHere(-1);
|
||||
|
||||
if (ImGui::InputTextWithHint("##TEXTFIELD", "Enter command", commands::input_buffer, INPUT_BUFFER_SIZE, ImGuiInputTextFlags_EnterReturnsTrue))
|
||||
if (ImGui::InputTextWithHint("##TEXTFIELD", "Enter command", m_Commands.m_nInputBuffer, INPUT_BUFFER_SIZE,
|
||||
ImGuiInputTextFlags_EnterReturnsTrue))
|
||||
{
|
||||
ProcessCommands();
|
||||
commands::show_menu = false;
|
||||
strcpy(commands::input_buffer, "");
|
||||
m_Commands.m_bShowMenu = false;
|
||||
strcpy(m_Commands.m_nInputBuffer, "");
|
||||
}
|
||||
|
||||
ImGui::PopStyleVar(2);
|
||||
@ -187,7 +210,7 @@ void Menu::DrawShortcutsWindow()
|
||||
|
||||
void Menu::ProcessCommands()
|
||||
{
|
||||
std::stringstream ss(commands::input_buffer);
|
||||
std::stringstream ss(m_Commands.m_nInputBuffer);
|
||||
|
||||
std::string command;
|
||||
ss >> command;
|
||||
@ -200,7 +223,8 @@ void Menu::ProcessCommands()
|
||||
ss >> temp;
|
||||
FindPlayerPed()->m_fHealth = std::stof(temp);
|
||||
}
|
||||
catch (...) {
|
||||
catch (...)
|
||||
{
|
||||
CHud::SetHelpMessage("Invalid value", false, false, false);
|
||||
}
|
||||
}
|
||||
@ -216,14 +240,16 @@ void Menu::ProcessCommands()
|
||||
ss >> temp;
|
||||
CClock::ms_nGameClockMinutes = std::stoi(temp);
|
||||
}
|
||||
catch (...) {
|
||||
catch (...)
|
||||
{
|
||||
CHud::SetHelpMessage("Invalid value", false, false, false);
|
||||
}
|
||||
}
|
||||
|
||||
if (command == "tp")
|
||||
{
|
||||
try {
|
||||
try
|
||||
{
|
||||
CVector pos;
|
||||
std::string temp;
|
||||
|
||||
@ -238,7 +264,8 @@ void Menu::ProcessCommands()
|
||||
|
||||
Teleport::TeleportPlayer(false, pos, 0);
|
||||
}
|
||||
catch (...) {
|
||||
catch (...)
|
||||
{
|
||||
CHud::SetHelpMessage("Invalid location", false, false, false);
|
||||
}
|
||||
}
|
||||
@ -285,8 +312,6 @@ void Menu::ProcessCommands()
|
||||
}
|
||||
else
|
||||
CHud::SetHelpMessage("Invalid command", false, false, false);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -299,37 +324,37 @@ void Menu::Draw()
|
||||
ImGui::Spacing();
|
||||
ImGui::Spacing();
|
||||
ImGui::SameLine();
|
||||
if (Ui::ListBox("Overlay", overlay::posNames, overlay::mSelectedPos))
|
||||
config.SetValue("overlay.mSelectedPos", overlay::mSelectedPos);
|
||||
if (Ui::ListBox("Overlay", m_Overlay.posNames, (int&)m_Overlay.mSelectedPos))
|
||||
config.SetValue("overlay.mSelectedPos", m_Overlay.mSelectedPos);
|
||||
|
||||
ImGui::Spacing();
|
||||
|
||||
ImGui::Columns(2, NULL, false);
|
||||
if (ImGui::Checkbox("No background", &overlay::bTransparent))
|
||||
config.SetValue("overlay.bTransparent", overlay::bTransparent);
|
||||
ImGui::Columns(2, nullptr, false);
|
||||
if (ImGui::Checkbox("No background", &m_Overlay.bTransparent))
|
||||
config.SetValue("overlay.bTransparent", m_Overlay.bTransparent);
|
||||
|
||||
if (ImGui::Checkbox("Show coordinates", &overlay::bCoord))
|
||||
config.SetValue("overlay.bCoord", overlay::bCoord);
|
||||
if (ImGui::Checkbox("Show coordinates", &m_Overlay.bCoord))
|
||||
config.SetValue("overlay.bCoord", m_Overlay.bCoord);
|
||||
|
||||
if (ImGui::Checkbox("Show CPU usage", &overlay::bCpuUsage))
|
||||
config.SetValue("overlay.bCpuUsage", overlay::bCpuUsage);
|
||||
if (ImGui::Checkbox("Show CPU usage", &m_Overlay.bCpuUsage))
|
||||
config.SetValue("overlay.bCpuUsage", m_Overlay.bCpuUsage);
|
||||
|
||||
if (ImGui::Checkbox("Show FPS", &overlay::bFPS))
|
||||
config.SetValue("overlay.bFPS", overlay::bFPS);
|
||||
if (ImGui::Checkbox("Show FPS", &m_Overlay.bFPS))
|
||||
config.SetValue("overlay.bFPS", m_Overlay.bFPS);
|
||||
|
||||
ImGui::NextColumn();
|
||||
|
||||
if (ImGui::Checkbox("Show location", &overlay::bLocName))
|
||||
config.SetValue("overlay.bLocName", overlay::bLocName);
|
||||
if (ImGui::Checkbox("Show location", &m_Overlay.bLocName))
|
||||
config.SetValue("overlay.bLocName", m_Overlay.bLocName);
|
||||
|
||||
if (ImGui::Checkbox("Show RAM usage", &overlay::bMemUsage))
|
||||
config.SetValue("overlay.bMemUsage", overlay::bMemUsage);
|
||||
if (ImGui::Checkbox("Show RAM usage", &m_Overlay.bMemUsage))
|
||||
config.SetValue("overlay.bMemUsage", m_Overlay.bMemUsage);
|
||||
|
||||
if (ImGui::Checkbox("Show veh health", &overlay::bVehHealth))
|
||||
config.SetValue("overlay.bVehHealth", overlay::bVehHealth);
|
||||
if (ImGui::Checkbox("Show veh health", &m_Overlay.bVehHealth))
|
||||
config.SetValue("overlay.bVehHealth", m_Overlay.bVehHealth);
|
||||
|
||||
if (ImGui::Checkbox("Show veh speed", &overlay::bVehSpeed))
|
||||
config.SetValue("overlay.bVehSpeed", overlay::bVehSpeed);
|
||||
if (ImGui::Checkbox("Show veh speed", &m_Overlay.bVehSpeed))
|
||||
config.SetValue("overlay.bVehSpeed", m_Overlay.bVehSpeed);
|
||||
|
||||
ImGui::Columns(1);
|
||||
|
||||
@ -340,79 +365,79 @@ void Menu::Draw()
|
||||
ImGui::Spacing();
|
||||
ImGui::Text("Usage");
|
||||
Ui::ShowTooltip("Left-click selects hotkey.\nLeft clicking outside deselects."
|
||||
"\nRight click disables hotkey.");
|
||||
"\nRight click disables hotkey.");
|
||||
ImGui::Spacing();
|
||||
ImGui::BeginChild("Hotkeys");
|
||||
if (Ui::HotKey("Open/ close cheat menu", hotkeys::menu_open))
|
||||
if (Ui::HotKey("Open/ close cheat menu", m_HotKeys.menuOpen))
|
||||
{
|
||||
config.SetValue("hotkey.menu_open.key1", hotkeys::menu_open.key1);
|
||||
config.SetValue("hotkey.menu_open.key2", hotkeys::menu_open.key2);
|
||||
config.SetValue("hotkey.menu_open.key1", m_HotKeys.menuOpen.m_key1);
|
||||
config.SetValue("hotkey.menu_open.key2", m_HotKeys.menuOpen.m_key2);
|
||||
}
|
||||
if (Ui::HotKey("Open/ close command window", hotkeys::command_window))
|
||||
if (Ui::HotKey("Open/ close command window", m_HotKeys.commandWindow))
|
||||
{
|
||||
config.SetValue("hotkey.command_window.key1", hotkeys::command_window.key1);
|
||||
config.SetValue("hotkey.command_window.key2", hotkeys::command_window.key2);
|
||||
config.SetValue("hotkey.command_window.key1", m_HotKeys.commandWindow.m_key1);
|
||||
config.SetValue("hotkey.command_window.key2", m_HotKeys.commandWindow.m_key2);
|
||||
}
|
||||
|
||||
ImGui::Dummy(ImVec2(0, 10));
|
||||
|
||||
if (Ui::HotKey("Activate aim skin changer", hotkeys::aim_skin_changer))
|
||||
if (Ui::HotKey("Activate aim skin changer", m_HotKeys.aimSkinChanger))
|
||||
{
|
||||
config.SetValue("hotkey.aim_skin_changer.key1", hotkeys::aim_skin_changer.key1);
|
||||
config.SetValue("hotkey.aim_skin_changer.key2", hotkeys::aim_skin_changer.key2);
|
||||
config.SetValue("hotkey.aim_skin_changer.key1", m_HotKeys.aimSkinChanger.m_key1);
|
||||
config.SetValue("hotkey.aim_skin_changer.key2", m_HotKeys.aimSkinChanger.m_key2);
|
||||
}
|
||||
if (Ui::HotKey("Freecam", hotkeys::freecam))
|
||||
if (Ui::HotKey("Freecam", m_HotKeys.freeCam))
|
||||
{
|
||||
config.SetValue("hotkey.freecam.key1", hotkeys::freecam.key1);
|
||||
config.SetValue("hotkey.freecam.key2", hotkeys::freecam.key2);
|
||||
config.SetValue("hotkey.freecam.key1", m_HotKeys.freeCam.m_key1);
|
||||
config.SetValue("hotkey.freecam.key2", m_HotKeys.freeCam.m_key2);
|
||||
}
|
||||
if (Ui::HotKey("Take quick screenshot", hotkeys::quick_ss))
|
||||
if (Ui::HotKey("Take quick screenshot", m_HotKeys.quickSceenShot))
|
||||
{
|
||||
config.SetValue("hotkey.quick_screenshot.key1", hotkeys::quick_ss.key1);
|
||||
config.SetValue("hotkey.quick_screenshot.key2", hotkeys::quick_ss.key2);
|
||||
config.SetValue("hotkey.quick_screenshot.key1", m_HotKeys.quickSceenShot.m_key1);
|
||||
config.SetValue("hotkey.quick_screenshot.key2", m_HotKeys.quickSceenShot.m_key2);
|
||||
}
|
||||
if (Ui::HotKey("Toggle quick teleport", hotkeys::quick_tp))
|
||||
if (Ui::HotKey("Toggle quick teleport", m_HotKeys.quickTeleport))
|
||||
{
|
||||
config.SetValue("hotkey.quick_tp.key1", hotkeys::quick_tp.key1);
|
||||
config.SetValue("hotkey.quick_tp.key2", hotkeys::quick_tp.key2);
|
||||
config.SetValue("hotkey.quick_tp.key1", m_HotKeys.quickTeleport.m_key1);
|
||||
config.SetValue("hotkey.quick_tp.key2", m_HotKeys.quickTeleport.m_key2);
|
||||
}
|
||||
|
||||
ImGui::Dummy(ImVec2(0, 10));
|
||||
|
||||
if (Ui::HotKey("Fix current vehicle", hotkeys::fix_veh))
|
||||
if (Ui::HotKey("Fix current vehicle", m_HotKeys.fixVeh))
|
||||
{
|
||||
config.SetValue("hotkey.fix_veh.key1", hotkeys::fix_veh.key1);
|
||||
config.SetValue("hotkey.fix_veh.key2", hotkeys::fix_veh.key2);
|
||||
config.SetValue("hotkey.fix_veh.key1", m_HotKeys.fixVeh.m_key1);
|
||||
config.SetValue("hotkey.fix_veh.key2", m_HotKeys.fixVeh.m_key2);
|
||||
}
|
||||
|
||||
if (Ui::HotKey("Flip current vehicle", hotkeys::flip_veh))
|
||||
if (Ui::HotKey("Flip current vehicle", m_HotKeys.flipVeh))
|
||||
{
|
||||
config.SetValue("hotkey.flip_veh.key1", hotkeys::flip_veh.key1);
|
||||
config.SetValue("hotkey.flip_veh.key2", hotkeys::flip_veh.key2);
|
||||
config.SetValue("hotkey.flip_veh.key1", m_HotKeys.flipVeh.m_key1);
|
||||
config.SetValue("hotkey.flip_veh.key2", m_HotKeys.flipVeh.m_key2);
|
||||
}
|
||||
|
||||
if (Ui::HotKey("Toggle god mode", hotkeys::god_mode))
|
||||
if (Ui::HotKey("Toggle god mode", m_HotKeys.godMode))
|
||||
{
|
||||
config.SetValue("hotkey.god_mode.key1", hotkeys::god_mode.key1);
|
||||
config.SetValue("hotkey.god_mode.key2", hotkeys::god_mode.key2);
|
||||
config.SetValue("hotkey.god_mode.key1", m_HotKeys.godMode.m_key1);
|
||||
config.SetValue("hotkey.god_mode.key2", m_HotKeys.godMode.m_key2);
|
||||
}
|
||||
|
||||
if (Ui::HotKey("Toggle veh engine", hotkeys::veh_engine))
|
||||
if (Ui::HotKey("Toggle veh engine", m_HotKeys.vehEngine))
|
||||
{
|
||||
config.SetValue("hotkey.veh_engine.key1", hotkeys::veh_engine.key1);
|
||||
config.SetValue("hotkey.veh_engine.key2", hotkeys::veh_engine.key2);
|
||||
config.SetValue("hotkey.veh_engine.key1", m_HotKeys.vehEngine.m_key1);
|
||||
config.SetValue("hotkey.veh_engine.key2", m_HotKeys.vehEngine.m_key2);
|
||||
}
|
||||
|
||||
if (Ui::HotKey("Vehicle instant start", hotkeys::veh_instant_start))
|
||||
if (Ui::HotKey("Vehicle instant start", m_HotKeys.vehInstantStart))
|
||||
{
|
||||
config.SetValue("hotkey.veh_instant_start.key1", hotkeys::veh_instant_start.key1);
|
||||
config.SetValue("hotkey.veh_instant_start.key2", hotkeys::veh_instant_start.key2);
|
||||
config.SetValue("hotkey.veh_instant_start.key1", m_HotKeys.vehInstantStart.m_key1);
|
||||
config.SetValue("hotkey.veh_instant_start.key2", m_HotKeys.vehInstantStart.m_key2);
|
||||
}
|
||||
|
||||
if (Ui::HotKey("Vehicle instant stop", hotkeys::veh_instant_stop))
|
||||
if (Ui::HotKey("Vehicle instant stop", m_HotKeys.vehInstantStop))
|
||||
{
|
||||
config.SetValue("hotkey.veh_instant_stop.key1", hotkeys::veh_instant_stop.key1);
|
||||
config.SetValue("hotkey.veh_instant_stop.key2", hotkeys::veh_instant_stop.key2);
|
||||
config.SetValue("hotkey.veh_instant_stop.key1", m_HotKeys.vehInstantStop.m_key1);
|
||||
config.SetValue("hotkey.veh_instant_stop.key2", m_HotKeys.vehInstantStop.m_key2);
|
||||
}
|
||||
|
||||
ImGui::Dummy(ImVec2(0, 10));
|
||||
@ -424,7 +449,10 @@ void Menu::Draw()
|
||||
{
|
||||
if (ImGui::BeginChild("CommandsChild"))
|
||||
{
|
||||
ImGui::TextWrapped(std::string("Open or close command window using " + Ui::GetHotKeyNameString(hotkeys::command_window)).c_str());
|
||||
ImGui::TextWrapped(
|
||||
std::string(
|
||||
"Open or close command window using " + Ui::GetHotKeyNameString(m_HotKeys.commandWindow)).
|
||||
c_str());
|
||||
ImGui::Spacing();
|
||||
if (ImGui::CollapsingHeader("Set health"))
|
||||
{
|
||||
@ -465,26 +493,26 @@ void Menu::Draw()
|
||||
ImGui::Spacing();
|
||||
|
||||
if (ImGui::Button("Check update", ImVec2(Ui::GetSize(3))))
|
||||
{
|
||||
if (Updater::state == UPDATER_IDLE)
|
||||
Updater::state = UPDATER_CHECKING;
|
||||
{
|
||||
if (Updater::m_State == UPDATER_IDLE)
|
||||
Updater::m_State = UPDATER_CHECKING;
|
||||
}
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
if (ImGui::Button("Discord server", ImVec2(Ui::GetSize(3))))
|
||||
ShellExecute(NULL, "open", DISCORD_INVITE, NULL, NULL, SW_SHOWNORMAL);
|
||||
ShellExecute(nullptr, "open", DISCORD_INVITE, nullptr, nullptr, SW_SHOWNORMAL);
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
if (ImGui::Button("GitHub repo", ImVec2(Ui::GetSize(3))))
|
||||
ShellExecute(NULL, "open", GITHUB_LINK, NULL, NULL, SW_SHOWNORMAL);
|
||||
ShellExecute(nullptr, "open", GITHUB_LINK, nullptr, nullptr, SW_SHOWNORMAL);
|
||||
|
||||
ImGui::Spacing();
|
||||
|
||||
if (ImGui::BeginChild("AboutChild"))
|
||||
{
|
||||
ImGui::Columns(2, NULL, false);
|
||||
ImGui::Columns(2, nullptr, false);
|
||||
ImGui::Text("Author: Grinch_");
|
||||
|
||||
ImGui::Text("Version: %s",MENU_VERSION);
|
||||
@ -509,4 +537,4 @@ void Menu::Draw()
|
||||
}
|
||||
ImGui::EndTabBar();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,17 @@
|
||||
class Menu
|
||||
{
|
||||
private:
|
||||
struct overlay
|
||||
|
||||
enum DISPLAY_POS
|
||||
{
|
||||
CUSTOM,
|
||||
TOP_LEFT,
|
||||
TOP_RIGHT,
|
||||
BOTTOM_LEFT,
|
||||
BOTTOM_RIGHT
|
||||
};
|
||||
|
||||
static struct
|
||||
{
|
||||
inline static bool bCoord = false;
|
||||
inline static bool bFPS = false;
|
||||
@ -16,36 +26,40 @@ private:
|
||||
inline static float fCpuUsage = 0.0f;
|
||||
inline static bool bMemUsage = false;
|
||||
inline static float fMemUsage = 0.0f;
|
||||
inline static std::vector<std::string> posNames = { "Custom", "Top left", "Top right", "Bottom left", "Bottom right" };
|
||||
inline static int mSelectedPos = 4; // TODO: Create Enum
|
||||
inline static std::vector<std::string> posNames = {
|
||||
"Custom", "Top left", "Top right", "Bottom left", "Bottom right"
|
||||
};
|
||||
inline static DISPLAY_POS mSelectedPos = DISPLAY_POS::BOTTOM_RIGHT;
|
||||
inline static float fPosX = 0.0f;
|
||||
inline static float fPosY = 0.0f;
|
||||
inline static size_t mInterval = 1000;
|
||||
inline static size_t mLastInterval = 0;
|
||||
inline static int mTotalRam = 0;
|
||||
};
|
||||
} m_Overlay;
|
||||
|
||||
public:
|
||||
struct hotkeys
|
||||
static struct
|
||||
{
|
||||
inline static HotKeyData aim_skin_changer;
|
||||
inline static HotKeyData freecam;
|
||||
inline static HotKeyData command_window;
|
||||
inline static HotKeyData fix_veh;
|
||||
inline static HotKeyData flip_veh;
|
||||
inline static HotKeyData free_cam_tp_player{VK_RETURN,VK_RETURN};
|
||||
inline static HotKeyData god_mode;
|
||||
inline static HotKeyData menu_open;
|
||||
inline static HotKeyData quick_ss;
|
||||
inline static HotKeyData quick_tp;
|
||||
inline static HotKeyData veh_engine;
|
||||
inline static HotKeyData veh_instant_start;
|
||||
inline static HotKeyData veh_instant_stop;
|
||||
};
|
||||
struct commands
|
||||
inline static HotKeyData aimSkinChanger;
|
||||
inline static HotKeyData freeCam;
|
||||
inline static HotKeyData commandWindow;
|
||||
inline static HotKeyData fixVeh;
|
||||
inline static HotKeyData flipVeh;
|
||||
inline static HotKeyData freeCamTeleportPlayer{VK_RETURN,VK_RETURN};
|
||||
inline static HotKeyData godMode;
|
||||
inline static HotKeyData menuOpen;
|
||||
inline static HotKeyData quickSceenShot;
|
||||
inline static HotKeyData quickTeleport;
|
||||
inline static HotKeyData vehEngine;
|
||||
inline static HotKeyData vehInstantStart;
|
||||
inline static HotKeyData vehInstantStop;
|
||||
} m_HotKeys;
|
||||
|
||||
static struct
|
||||
{
|
||||
inline static bool show_menu = false;
|
||||
inline static char input_buffer[INPUT_BUFFER_SIZE] = "";
|
||||
};
|
||||
inline static bool m_bShowMenu = false;
|
||||
inline static char m_nInputBuffer[INPUT_BUFFER_SIZE] = "";
|
||||
} m_Commands;
|
||||
|
||||
Menu();
|
||||
static void Draw();
|
||||
@ -53,4 +67,3 @@ public:
|
||||
static void DrawShortcutsWindow();
|
||||
static void ProcessCommands();
|
||||
};
|
||||
|
||||
|
@ -3,4 +3,4 @@
|
||||
#define MENU_VERSION_NUMBER "2.7"
|
||||
#define MENU_VERSION MENU_VERSION_NUMBER"-beta"
|
||||
#define BUILD_NUMBER "20210615"
|
||||
#define MENU_TITLE MENU_NAME " v" MENU_VERSION "(" BUILD_NUMBER ")"
|
||||
#define MENU_TITLE MENU_NAME " v" MENU_VERSION "(" BUILD_NUMBER ")"
|
||||
|
@ -1,10 +1,7 @@
|
||||
#include "pch.h"
|
||||
#include "Events.h"
|
||||
|
||||
namespace plugin
|
||||
namespace plugin::Events
|
||||
{
|
||||
namespace Events
|
||||
{
|
||||
decltype(vehicleResetAfterRender) vehicleResetAfterRender;
|
||||
}
|
||||
decltype(vehicleResetAfterRender) vehicleResetAfterRender;
|
||||
}
|
||||
|
@ -1,9 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
namespace plugin
|
||||
namespace plugin::Events
|
||||
{
|
||||
namespace Events
|
||||
{
|
||||
extern ThiscallEvent<AddressList<0x55332A, H_CALL>, PRIORITY_BEFORE, ArgPickN<CVehicle*, 0>, void(CVehicle*)> vehicleResetAfterRender;
|
||||
}
|
||||
extern ThiscallEvent<AddressList<0x55332A, H_CALL>, PRIORITY_BEFORE, ArgPickN<CVehicle*, 0>, void(CVehicle*)>
|
||||
vehicleResetAfterRender;
|
||||
}
|
||||
|
@ -2,33 +2,34 @@
|
||||
#include "Neon.h"
|
||||
#include "Util.h"
|
||||
|
||||
void Neon::RenderEvent(CVehicle *pVeh)
|
||||
void Neon::RenderEvent(CVehicle* pVeh)
|
||||
{
|
||||
NeonData* data = &VehNeon.Get(pVeh);
|
||||
if (data->neon_installed && !pVeh->IsUpsideDown())
|
||||
NeonData* data = &m_VehNeon.Get(pVeh);
|
||||
if (data->m_bNeonInstalled && !pVeh->IsUpsideDown())
|
||||
{
|
||||
CVector Pos = CModelInfo::GetModelInfo(pVeh->m_nModelIndex)->m_pColModel->m_boundBox.m_vecMin;
|
||||
CVector center = pVeh->TransformFromObjectSpace(CVector(0.0f, 0.0f, 0.0f));
|
||||
CVector up = pVeh->TransformFromObjectSpace(CVector(0.0f, -Pos.y - data->val, 0.0f)) - center;
|
||||
CVector right = pVeh->TransformFromObjectSpace(CVector(Pos.x + data->val, 0.0f, 0.0f)) - center;
|
||||
CShadows::StoreShadowToBeRendered(5, neon_texture, ¢er, up.x, up.y, right.x, right.y, 180, data->color.r, data->color.g, data->color.b, 2.0f, false, 1.0f, 0, true);
|
||||
CVector up = pVeh->TransformFromObjectSpace(CVector(0.0f, -Pos.y - data->m_fVal, 0.0f)) - center;
|
||||
CVector right = pVeh->TransformFromObjectSpace(CVector(Pos.x + data->m_fVal, 0.0f, 0.0f)) - center;
|
||||
CShadows::StoreShadowToBeRendered(5, m_pNeonTexture, ¢er, up.x, up.y, right.x, right.y, 180, data->m_Color.r,
|
||||
data->m_Color.g, data->m_Color.b, 2.0f, false, 1.0f, 0, true);
|
||||
|
||||
if (CTimer::m_snTimeInMilliseconds - data->timer > 150)
|
||||
if (CTimer::m_snTimeInMilliseconds - data->m_nTimer > 150)
|
||||
{
|
||||
data->timer = CTimer::m_snTimeInMilliseconds;
|
||||
data->m_nTimer = CTimer::m_snTimeInMilliseconds;
|
||||
|
||||
if (data->pulsing)
|
||||
if (data->m_bPulsing)
|
||||
{
|
||||
if (data->val < 0.0f)
|
||||
data->increment = true;
|
||||
if (data->m_fVal < 0.0f)
|
||||
data->m_bIncrement = true;
|
||||
|
||||
if (data->val > 0.3f)
|
||||
data->increment = false;
|
||||
if (data->m_fVal > 0.3f)
|
||||
data->m_bIncrement = false;
|
||||
|
||||
if (data->increment)
|
||||
data->val += 0.1f;
|
||||
if (data->m_bIncrement)
|
||||
data->m_fVal += 0.1f;
|
||||
else
|
||||
data->val -= 0.1f;
|
||||
data->m_fVal -= 0.1f;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -38,58 +39,58 @@ Neon::Neon()
|
||||
{
|
||||
Events::processScriptsEvent += [this]
|
||||
{
|
||||
if (!mask_loaded)
|
||||
if (!m_bMaskLoaded)
|
||||
{
|
||||
neon_texture = Util::LoadTextureFromPngFile(PLUGIN_PATH((char*)"CheatMenu\\vehicles\\neon_mask.png"));
|
||||
if (!neon_texture)
|
||||
m_pNeonTexture = Util::LoadTextureFromPngFile(PLUGIN_PATH((char*)"CheatMenu\\vehicles\\neon_mask.png"));
|
||||
if (!m_pNeonTexture)
|
||||
flog << "Failed to load neon mask" << std::endl;
|
||||
|
||||
mask_loaded = true;
|
||||
m_bMaskLoaded = true;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Events::vehicleRenderEvent += RenderEvent;
|
||||
}
|
||||
|
||||
Neon::~Neon()
|
||||
{
|
||||
{
|
||||
Events::vehicleRenderEvent -= RenderEvent;
|
||||
|
||||
if (neon_texture)
|
||||
if (m_pNeonTexture)
|
||||
{
|
||||
RwTextureDestroy(neon_texture);
|
||||
neon_texture = nullptr;
|
||||
RwTextureDestroy(m_pNeonTexture);
|
||||
m_pNeonTexture = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
bool Neon::IsNeonInstalled(CVehicle* pVeh)
|
||||
{
|
||||
return VehNeon.Get(pVeh).neon_installed;
|
||||
return m_VehNeon.Get(pVeh).m_bNeonInstalled;
|
||||
}
|
||||
|
||||
bool Neon::IsPulsingEnabled(CVehicle* pVeh)
|
||||
{
|
||||
return VehNeon.Get(pVeh).pulsing;
|
||||
return m_VehNeon.Get(pVeh).m_bPulsing;
|
||||
}
|
||||
|
||||
void Neon::SetPulsing(CVehicle* pVeh, bool state)
|
||||
{
|
||||
VehNeon.Get(pVeh).pulsing = state;
|
||||
m_VehNeon.Get(pVeh).m_bPulsing = state;
|
||||
}
|
||||
|
||||
void Neon::InstallNeon(CVehicle* pVeh, int red, int green, int blue)
|
||||
{
|
||||
CRGBA& color = VehNeon.Get(pVeh).color;
|
||||
CRGBA& color = m_VehNeon.Get(pVeh).m_Color;
|
||||
|
||||
color.r = red;
|
||||
color.g = green;
|
||||
color.b = blue;
|
||||
color.a = 255;
|
||||
|
||||
VehNeon.Get(pVeh).neon_installed = true;
|
||||
m_VehNeon.Get(pVeh).m_bNeonInstalled = true;
|
||||
}
|
||||
|
||||
void Neon::RemoveNeon(CVehicle* pVeh)
|
||||
{
|
||||
VehNeon.Get(pVeh).neon_installed = false;
|
||||
m_VehNeon.Get(pVeh).m_bNeonInstalled = false;
|
||||
}
|
||||
|
@ -1,30 +1,31 @@
|
||||
#pragma once
|
||||
#include "extender\VehicleExtender.h"
|
||||
#include "extender/VehicleExtender.h"
|
||||
|
||||
class Neon
|
||||
{
|
||||
private:
|
||||
class NeonData {
|
||||
class NeonData
|
||||
{
|
||||
public:
|
||||
CRGBA color;
|
||||
bool neon_installed;
|
||||
float val;
|
||||
uint timer;
|
||||
bool increment;
|
||||
bool pulsing;
|
||||
CRGBA m_Color;
|
||||
bool m_bNeonInstalled;
|
||||
float m_fVal;
|
||||
uint m_nTimer;
|
||||
bool m_bIncrement;
|
||||
bool m_bPulsing;
|
||||
|
||||
NeonData(CVehicle* pVeh)
|
||||
{
|
||||
neon_installed = false;
|
||||
val = 0.0;
|
||||
timer = 0;
|
||||
increment = true;
|
||||
m_bNeonInstalled = false;
|
||||
m_fVal = 0.0;
|
||||
m_nTimer = 0;
|
||||
m_bIncrement = true;
|
||||
}
|
||||
};
|
||||
|
||||
inline static bool mask_loaded = false;
|
||||
inline static RwTexture* neon_texture = nullptr;
|
||||
inline static VehicleExtendedData<NeonData> VehNeon;
|
||||
|
||||
inline static bool m_bMaskLoaded = false;
|
||||
inline static RwTexture* m_pNeonTexture = nullptr;
|
||||
inline static VehicleExtendedData<NeonData> m_VehNeon;
|
||||
|
||||
public:
|
||||
Neon();
|
||||
@ -36,4 +37,3 @@ public:
|
||||
static void RemoveNeon(CVehicle* veh);
|
||||
static void RenderEvent(CVehicle* veh);
|
||||
};
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
||||
|
||||
void Paint::RenderEvent(CVehicle* pVeh)
|
||||
{
|
||||
VehData& data = vehdata.Get(pVeh);
|
||||
VehData& data = m_VehData.Get(pVeh);
|
||||
|
||||
// reset custom color if color id changed
|
||||
if (pVeh->m_nPrimaryColor != data.primary_color
|
||||
@ -70,7 +70,7 @@ void Paint::RenderEvent(CVehicle* pVeh)
|
||||
|
||||
void Paint::ResetAfterRenderEvent(CVehicle* pVeh)
|
||||
{
|
||||
for (auto& it : vehdata.Get(pVeh).materialProperties)
|
||||
for (auto& it : m_VehData.Get(pVeh).materialProperties)
|
||||
{
|
||||
if (it.second._recolor)
|
||||
{
|
||||
@ -88,17 +88,17 @@ Paint::Paint()
|
||||
{
|
||||
Events::processScriptsEvent += [this]
|
||||
{
|
||||
if (!images_loaded)
|
||||
if (!m_bImagesLoaded)
|
||||
{
|
||||
for (auto& p : fs::recursive_directory_iterator(PLUGIN_PATH((char*)"\\CheatMenu\\vehicles\\paintjobs\\")))
|
||||
{
|
||||
if (p.path().extension() == ".png")
|
||||
{
|
||||
std::string file_name = p.path().stem().string();
|
||||
textures[file_name] = std::make_shared<RwTexture>(*(Util::LoadTextureFromPngFile(p.path())));
|
||||
m_Textures[file_name] = std::make_shared<RwTexture>(*(Util::LoadTextureFromPngFile(p.path())));
|
||||
}
|
||||
}
|
||||
images_loaded = true;
|
||||
m_bImagesLoaded = true;
|
||||
}
|
||||
};
|
||||
|
||||
@ -143,7 +143,7 @@ void Paint::VehData::resetMaterialColor(RpMaterial* material)
|
||||
{
|
||||
auto& matProps = materialProperties[material];
|
||||
matProps._recolor = false;
|
||||
matProps._color = { 0, 0, 0, 0 };
|
||||
matProps._color = {0, 0, 0, 0};
|
||||
}
|
||||
|
||||
void Paint::VehData::resetMaterialTexture(RpMaterial* material)
|
||||
@ -199,7 +199,8 @@ void Paint::SetNodeColor(CVehicle* pVeh, std::string node_name, CRGBA color, boo
|
||||
|
||||
if (node_name == "Default" || node_name == name)
|
||||
{
|
||||
RwFrameForAllObjects(frame, [](RwObject* object, void* data) -> RwObject* {
|
||||
RwFrameForAllObjects(frame, [](RwObject* object, void* data) -> RwObject*
|
||||
{
|
||||
if (object->type == rpATOMIC)
|
||||
{
|
||||
RpAtomic* atomic = reinterpret_cast<RpAtomic*>(object);
|
||||
@ -208,10 +209,11 @@ void Paint::SetNodeColor(CVehicle* pVeh, std::string node_name, CRGBA color, boo
|
||||
CRGBA* color = &st->_color;
|
||||
bool filter_mat = st->_filter;
|
||||
|
||||
VehData& data = vehdata.Get(FindPlayerPed()->m_pVehicle);
|
||||
VehData& data = m_VehData.Get(FindPlayerPed()->m_pVehicle);
|
||||
|
||||
for (int i = 0; i < atomic->geometry->matList.numMaterials; ++i)
|
||||
data.setMaterialColor(atomic->geometry->matList.materials[i], atomic->geometry, { color->r,color->g,color->b, 255 }, filter_mat);
|
||||
data.setMaterialColor(atomic->geometry->matList.materials[i], atomic->geometry,
|
||||
{color->r, color->g, color->b, 255}, filter_mat);
|
||||
}
|
||||
return object;
|
||||
}, &st);
|
||||
@ -234,23 +236,24 @@ void Paint::SetNodeTexture(CVehicle* pVeh, std::string node_name, std::string te
|
||||
bool _filter;
|
||||
} st;
|
||||
|
||||
st._textures = textures;
|
||||
st._textures = m_Textures;
|
||||
st._texturename = texturename;
|
||||
st._filter = filter_mat;
|
||||
|
||||
if (node_name == "Default" || node_name == name)
|
||||
{
|
||||
RwFrameForAllObjects(frame, [](RwObject* object, void* data) -> RwObject* {
|
||||
|
||||
RwFrameForAllObjects(frame, [](RwObject* object, void* data) -> RwObject*
|
||||
{
|
||||
if (object->type == rpATOMIC)
|
||||
{
|
||||
RpAtomic* atomic = reinterpret_cast<RpAtomic*>(object);
|
||||
|
||||
ST* st = reinterpret_cast<ST*>(data);
|
||||
VehData& data = vehdata.Get(FindPlayerPed()->m_pVehicle);
|
||||
VehData& data = m_VehData.Get(FindPlayerPed()->m_pVehicle);
|
||||
|
||||
for (int i = 0; i < atomic->geometry->matList.numMaterials; ++i)
|
||||
data.setMaterialTexture(atomic->geometry->matList.materials[i], st->_textures[st->_texturename], st->_filter);
|
||||
data.setMaterialTexture(atomic->geometry->matList.materials[i], st->_textures[st->_texturename],
|
||||
st->_filter);
|
||||
}
|
||||
return object;
|
||||
}, &st);
|
||||
@ -268,11 +271,12 @@ void Paint::ResetNodeColor(CVehicle* pVeh, std::string node_name)
|
||||
|
||||
if (node_name == "Default" || node_name == name)
|
||||
{
|
||||
RwFrameForAllObjects(frame, [](RwObject* object, void* data) -> RwObject* {
|
||||
RwFrameForAllObjects(frame, [](RwObject* object, void* data) -> RwObject*
|
||||
{
|
||||
if (object->type == rpATOMIC)
|
||||
{
|
||||
RpAtomic* atomic = reinterpret_cast<RpAtomic*>(object);
|
||||
VehData& data = vehdata.Get(FindPlayerPed()->m_pVehicle);
|
||||
VehData& data = m_VehData.Get(FindPlayerPed()->m_pVehicle);
|
||||
|
||||
for (int i = 0; i < atomic->geometry->matList.numMaterials; ++i)
|
||||
data.resetMaterialColor(atomic->geometry->matList.materials[i]);
|
||||
@ -293,13 +297,13 @@ void Paint::ResetNodeTexture(CVehicle* pVeh, std::string node_name)
|
||||
|
||||
if (node_name == "Default" || node_name == name)
|
||||
{
|
||||
RwFrameForAllObjects(frame, [](RwObject* object, void* data) -> RwObject* {
|
||||
|
||||
RwFrameForAllObjects(frame, [](RwObject* object, void* data) -> RwObject*
|
||||
{
|
||||
if (object->type == rpATOMIC)
|
||||
{
|
||||
RpAtomic* atomic = reinterpret_cast<RpAtomic*>(object);
|
||||
|
||||
VehData& data = vehdata.Get(FindPlayerPed()->m_pVehicle);
|
||||
VehData& data = m_VehData.Get(FindPlayerPed()->m_pVehicle);
|
||||
|
||||
for (int i = 0; i < atomic->geometry->matList.numMaterials; ++i)
|
||||
data.resetMaterialTexture(atomic->geometry->matList.materials[i]);
|
||||
@ -308,4 +312,4 @@ void Paint::ResetNodeTexture(CVehicle* pVeh, std::string node_name)
|
||||
}, nullptr);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -27,22 +27,20 @@
|
||||
|
||||
class Paint
|
||||
{
|
||||
|
||||
private:
|
||||
|
||||
// store vehicle specific data
|
||||
struct VehData
|
||||
{
|
||||
struct MaterialProperties
|
||||
{
|
||||
MaterialProperties() :
|
||||
_color{ 0, 0, 0, 0 },
|
||||
_color{0, 0, 0, 0},
|
||||
_recolor(false),
|
||||
_retexture(false),
|
||||
_originalColor{ 0, 0, 0, 0 },
|
||||
_geometry(nullptr),
|
||||
_originalColor{0, 0, 0, 0},
|
||||
_originalTexture(nullptr),
|
||||
_originalGeometryFlags(0),
|
||||
_geometry(nullptr)
|
||||
_originalGeometryFlags(0)
|
||||
{
|
||||
}
|
||||
|
||||
@ -73,15 +71,15 @@ private:
|
||||
void resetMaterialTexture(RpMaterial* material);
|
||||
};
|
||||
|
||||
inline static bool images_loaded = false;
|
||||
inline static VehicleExtendedData<VehData> vehdata;
|
||||
inline static bool m_bImagesLoaded = false;
|
||||
inline static VehicleExtendedData<VehData> m_VehData;
|
||||
|
||||
protected:
|
||||
inline static std::map<std::string, std::shared_ptr<RwTexture>> m_Textures;
|
||||
|
||||
inline static std::map<std::string, std::shared_ptr<RwTexture>> textures;
|
||||
struct veh_nodes
|
||||
{
|
||||
inline static std::vector<std::string> names_vec{ "Default" };
|
||||
inline static std::vector<std::string> names_vec{"Default"};
|
||||
inline static std::string selected = "Default";
|
||||
};
|
||||
|
||||
@ -96,4 +94,3 @@ protected:
|
||||
static void RenderEvent(CVehicle* pVeh);
|
||||
static void ResetAfterRenderEvent(CVehicle* pVeh);
|
||||
};
|
||||
|
||||
|
@ -6,22 +6,23 @@
|
||||
Ped::Ped()
|
||||
{
|
||||
if (GetModuleHandle("ExGangWars.asi"))
|
||||
exgangwars_installed = true;
|
||||
m_bExGangWarsInstalled = true;
|
||||
|
||||
Events::processScriptsEvent += []
|
||||
{
|
||||
if (!images_loaded)
|
||||
if (!m_bImagesLoaded)
|
||||
{
|
||||
Util::LoadTexturesInDirRecursive(PLUGIN_PATH((char*)"CheatMenu\\peds\\"), ".jpg", ped_data.categories, ped_data.images);
|
||||
images_loaded = true;
|
||||
Util::LoadTexturesInDirRecursive(
|
||||
PLUGIN_PATH((char*)"CheatMenu\\peds\\"), ".jpg", m_PedData.m_Categories, m_PedData.m_ImagesList);
|
||||
m_bImagesLoaded = true;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Ped::~Ped()
|
||||
{
|
||||
Util::ReleaseTextures(ped_data.images);
|
||||
for (CPed* ped : spawn_ped::list)
|
||||
Util::ReleaseTextures(m_PedData.m_ImagesList);
|
||||
for (CPed* ped : m_SpawnPed.m_List)
|
||||
{
|
||||
CWorld::Remove(ped);
|
||||
ped->Remove();
|
||||
@ -30,13 +31,13 @@ Ped::~Ped()
|
||||
|
||||
void Ped::SpawnPed(std::string& model)
|
||||
{
|
||||
if (spawn_ped::list.size() == SPAWN_PED_LIMIT)
|
||||
if (m_SpawnPed.m_List.size() == SPAWN_PED_LIMIT)
|
||||
{
|
||||
CHud::SetHelpMessage("Max limit reached", false, false, false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (Ped::ped_data.json.data.contains(model))
|
||||
if (m_PedData.m_Json.m_Data.contains(model))
|
||||
{
|
||||
CPlayerPed* player = FindPlayerPed();
|
||||
CVector pos = player->GetPosition();
|
||||
@ -45,49 +46,49 @@ void Ped::SpawnPed(std::string& model)
|
||||
CPed* ped;
|
||||
int hplayer;
|
||||
|
||||
if (Ped::pedspecial_json.data.contains(model))
|
||||
if (m_SpecialPedJson.m_Data.contains(model))
|
||||
{
|
||||
std::string name;
|
||||
if (Ped::pedspecial_json.data.contains(model))
|
||||
name = Ped::pedspecial_json.data[model].get<std::string>().c_str();
|
||||
if (m_SpecialPedJson.m_Data.contains(model))
|
||||
name = m_SpecialPedJson.m_Data[model].get<std::string>().c_str();
|
||||
else
|
||||
name = model;
|
||||
|
||||
CStreaming::RequestSpecialChar(1, name.c_str(), PRIORITY_REQUEST);
|
||||
CStreaming::LoadAllRequestedModels(true);
|
||||
|
||||
Command <Commands::CREATE_CHAR>(spawn_ped::selected_ped_type + 4, 291, pos.x, pos.y, pos.z + 1, &hplayer);
|
||||
Command<Commands::CREATE_CHAR>(m_SpawnPed.m_nSelectedPedType + 4, 291, pos.x, pos.y, pos.z + 1, &hplayer);
|
||||
CStreaming::SetSpecialCharIsDeletable(291);
|
||||
}
|
||||
else
|
||||
{
|
||||
int imodel = std::stoi(model);
|
||||
CStreaming::RequestModel(imodel, eStreamingFlags::PRIORITY_REQUEST);
|
||||
int iModel = std::stoi(model);
|
||||
CStreaming::RequestModel(iModel, eStreamingFlags::PRIORITY_REQUEST);
|
||||
CStreaming::LoadAllRequestedModels(false);
|
||||
|
||||
Command <Commands::CREATE_CHAR>(spawn_ped::selected_ped_type + 4, imodel, pos.x, pos.y, pos.z + 1, &hplayer);
|
||||
CStreaming::SetModelIsDeletable(imodel);
|
||||
Command<Commands::CREATE_CHAR>(m_SpawnPed.m_nSelectedPedType + 4, iModel, pos.x, pos.y, pos.z + 1, &hplayer);
|
||||
CStreaming::SetModelIsDeletable(iModel);
|
||||
}
|
||||
|
||||
ped = CPools::GetPed(hplayer);
|
||||
|
||||
if (spawn_ped::dont_move)
|
||||
spawn_ped::list.push_back(ped);
|
||||
if (m_SpawnPed.m_bPedMove)
|
||||
m_SpawnPed.m_List.push_back(ped);
|
||||
else
|
||||
{
|
||||
Command<Commands::MARK_CHAR_AS_NO_LONGER_NEEDED>(hplayer);
|
||||
}
|
||||
ped->m_nPedFlags.bPedIsBleeding = spawn_ped::ped_bleed;
|
||||
ped->m_nWeaponAccuracy = spawn_ped::accuracy;
|
||||
ped->m_fHealth = spawn_ped::health;
|
||||
ped->m_nPedFlags.bPedIsBleeding = m_SpawnPed.m_bPedBleed;
|
||||
ped->m_nWeaponAccuracy = m_SpawnPed.m_nAccuracy;
|
||||
ped->m_fHealth = m_SpawnPed.m_nPedHealth;
|
||||
|
||||
if (spawn_ped::weapon_id != 0)
|
||||
if (m_SpawnPed.m_nWeaponId != 0)
|
||||
{
|
||||
int model = 0;
|
||||
Command<Commands::GET_WEAPONTYPE_MODEL>(spawn_ped::weapon_id, &model);
|
||||
Command<Commands::GET_WEAPONTYPE_MODEL>(m_SpawnPed.m_nWeaponId, &model);
|
||||
CStreaming::RequestModel(model, PRIORITY_REQUEST);
|
||||
CStreaming::LoadAllRequestedModels(false);
|
||||
Command<Commands::GIVE_WEAPON_TO_CHAR>(hplayer, spawn_ped::weapon_id, 999);
|
||||
Command<Commands::GIVE_WEAPON_TO_CHAR>(hplayer, m_SpawnPed.m_nWeaponId, 999);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -151,12 +152,12 @@ void Ped::Draw()
|
||||
CZone szone = CZone();
|
||||
CZone* pZone = &szone;
|
||||
|
||||
CZoneExtraInfo* zone_info = CTheZones::GetZoneInfo(&pos, &pZone);
|
||||
int density = zone_info->m_nGangDensity[i];
|
||||
CZoneExtraInfo* zoneInfo = CTheZones::GetZoneInfo(&pos, &pZone);
|
||||
int density = zoneInfo->m_nGangDensity[i];
|
||||
|
||||
if (ImGui::SliderInt(Ped::gang_names[i].c_str(), &density, 0, 127))
|
||||
if (ImGui::SliderInt(m_GangNames[i].c_str(), &density, 0, 127))
|
||||
{
|
||||
zone_info->m_nGangDensity[i] = static_cast<char>(density);
|
||||
zoneInfo->m_nGangDensity[i] = static_cast<char>(density);
|
||||
Command<Commands::CLEAR_SPECIFIC_ZONES_TO_TRIGGER_GANG_WAR>();
|
||||
CGangWars::bGangWarsActive = true;
|
||||
}
|
||||
@ -164,12 +165,13 @@ void Ped::Draw()
|
||||
ImGui::PopItemWidth();
|
||||
ImGui::Spacing();
|
||||
|
||||
if (!exgangwars_installed)
|
||||
if (!m_bExGangWarsInstalled)
|
||||
{
|
||||
ImGui::TextWrapped("You'll need ExGangWars plugin to display some turf colors");
|
||||
ImGui::Spacing();
|
||||
if (ImGui::Button("Download ExGangWars", Ui::GetSize(1)))
|
||||
ShellExecute(NULL, "open", "https://gtaforums.com/topic/682194-extended-gang-wars/", NULL, NULL, SW_SHOWNORMAL);
|
||||
ShellExecute(NULL, "open", "https://gtaforums.com/topic/682194-extended-gang-wars/", NULL, NULL,
|
||||
SW_SHOWNORMAL);
|
||||
}
|
||||
|
||||
ImGui::Spacing();
|
||||
@ -180,22 +182,24 @@ void Ped::Draw()
|
||||
|
||||
if (ImGui::CollapsingHeader("Recruit anyone"))
|
||||
{
|
||||
static std::vector<Ui::NamedMemory> select_weapon{ {"9mm", 0x96917C}, { "AK47", 0x96917D }, { "Rockets", 0x96917E } };
|
||||
Ui::RadioButtonAddress("Select weapon", select_weapon);
|
||||
static std::vector<Ui::NamedMemory> selectWeapon{
|
||||
{"9mm", 0x96917C}, {"AK47", 0x96917D}, {"Rockets", 0x96917E}
|
||||
};
|
||||
Ui::RadioButtonAddress("Select weapon", selectWeapon);
|
||||
ImGui::Spacing();
|
||||
ImGui::Separator();
|
||||
}
|
||||
if (ImGui::CollapsingHeader("Remove peds in radius"))
|
||||
{
|
||||
ImGui::InputInt("Radius", &ped_remove_radius);
|
||||
ImGui::InputInt("Radius", &m_nPedRemoveRadius);
|
||||
ImGui::Spacing();
|
||||
if (ImGui::Button("Remove peds", Ui::GetSize(1)))
|
||||
{
|
||||
CPlayerPed* player = FindPlayerPed();
|
||||
for (CPed* ped : CPools::ms_pPedPool)
|
||||
{
|
||||
if (DistanceBetweenPoints(ped->GetPosition(), player->GetPosition()) < ped_remove_radius
|
||||
&& ped->m_pVehicle == nullptr && ped != player)
|
||||
if (DistanceBetweenPoints(ped->GetPosition(), player->GetPosition()) < m_nPedRemoveRadius
|
||||
&& ped->m_pVehicle == nullptr && ped != player)
|
||||
Command<Commands::DELETE_CHAR>(CPools::GetPedRef(ped));
|
||||
}
|
||||
}
|
||||
@ -210,12 +214,12 @@ void Ped::Draw()
|
||||
ImGui::Spacing();
|
||||
if (ImGui::Button("Remove frozen peds", Ui::GetSize(1)))
|
||||
{
|
||||
for (CPed* ped : spawn_ped::list)
|
||||
for (CPed* ped : m_SpawnPed.m_List)
|
||||
{
|
||||
CWorld::Remove(ped);
|
||||
ped->Remove();
|
||||
}
|
||||
spawn_ped::list.clear();
|
||||
m_SpawnPed.m_List.clear();
|
||||
}
|
||||
ImGui::Spacing();
|
||||
if (ImGui::BeginTabBar("SpawnPedBar"))
|
||||
@ -226,8 +230,9 @@ void Ped::Draw()
|
||||
{
|
||||
ImGui::Spacing();
|
||||
|
||||
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>(); });
|
||||
Ui::DrawImages(m_PedData.m_ImagesList, ImVec2(65, 110), m_PedData.m_Categories, m_PedData.m_Selected,
|
||||
m_PedData.m_Filter, SpawnPed, nullptr,
|
||||
[](std::string str) { return m_PedData.m_Json.m_Data[str].get<std::string>(); });
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
if (ImGui::BeginTabItem("Config"))
|
||||
@ -235,31 +240,36 @@ void Ped::Draw()
|
||||
ImGui::Spacing();
|
||||
ImGui::BeginChild("PedCOnfig");
|
||||
ImGui::Columns(2, 0, false);
|
||||
Ui::CheckboxWithHint("Don't move", &spawn_ped::dont_move);
|
||||
Ui::CheckboxWithHint("Don't move", &m_SpawnPed.m_bPedMove);
|
||||
ImGui::NextColumn();
|
||||
Ui::CheckboxWithHint("Ped bleed", &spawn_ped::ped_bleed);
|
||||
Ui::CheckboxWithHint("Ped bleed", &m_SpawnPed.m_bPedBleed);
|
||||
ImGui::Columns(1);
|
||||
|
||||
ImGui::Spacing();
|
||||
ImGui::SliderInt("Accuracy", &spawn_ped::accuracy, 0.0, 100.0);
|
||||
if (ImGui::InputInt("Health", &spawn_ped::health))
|
||||
ImGui::SliderInt("Accuracy", &m_SpawnPed.m_nAccuracy, 0.0, 100.0);
|
||||
if (ImGui::InputInt("Health", &m_SpawnPed.m_nPedHealth))
|
||||
{
|
||||
if (spawn_ped::health > 1000)
|
||||
spawn_ped::health = 1000;
|
||||
if (m_SpawnPed.m_nPedHealth > 1000)
|
||||
m_SpawnPed.m_nPedHealth = 1000;
|
||||
|
||||
if (spawn_ped::health < 0)
|
||||
spawn_ped::health = 0;
|
||||
if (m_SpawnPed.m_nPedHealth < 0)
|
||||
m_SpawnPed.m_nPedHealth = 0;
|
||||
}
|
||||
Ui::ListBox("Ped type", spawn_ped::ped_type, spawn_ped::selected_ped_type);
|
||||
Ui::ListBox("Ped type", m_SpawnPed.m_PedTypeList, m_SpawnPed.m_nSelectedPedType);
|
||||
|
||||
ImGui::Spacing();
|
||||
ImGui::Text("Selected weapon: %s", Weapon::weapon_data.json.data[std::to_string(spawn_ped::weapon_id)].get<std::string>());
|
||||
ImGui::Text("Selected weapon: %s",
|
||||
Weapon::m_WeaponData.m_Json.m_Data[std::to_string(m_SpawnPed.m_nWeaponId)].get<std::string>());
|
||||
ImGui::Spacing();
|
||||
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_data.json.data[str].get<std::string>(); },
|
||||
[](std::string str) {return str != "-1"; /*Jetpack*/ }
|
||||
Ui::DrawImages(Weapon::m_WeaponData.m_ImagesList, ImVec2(65, 65), Weapon::m_WeaponData.m_Categories,
|
||||
Weapon::m_WeaponData.m_Selected, Weapon::m_WeaponData.m_Filter,
|
||||
[](std::string str) { m_SpawnPed.m_nWeaponId = std::stoi(str); },
|
||||
nullptr,
|
||||
[](std::string str)
|
||||
{
|
||||
return Weapon::m_WeaponData.m_Json.m_Data[str].get<std::string>();
|
||||
},
|
||||
[](std::string str) { return str != "-1"; /*Jetpack*/ }
|
||||
);
|
||||
|
||||
ImGui::Spacing();
|
||||
@ -273,4 +283,3 @@ void Ped::Draw()
|
||||
ImGui::EndTabBar();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,33 +5,31 @@
|
||||
class Ped
|
||||
{
|
||||
private:
|
||||
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 =
|
||||
inline static SSearchData m_PedData{"ped"};
|
||||
inline static CJson m_SpecialPedJson = CJson("ped special");
|
||||
inline static bool m_bImagesLoaded;
|
||||
inline static bool m_bExGangWarsInstalled;
|
||||
inline static int m_nPedRemoveRadius = 5;
|
||||
static struct
|
||||
{
|
||||
inline static std::vector<CPed*> m_List;
|
||||
inline static int m_nAccuracy = 50;
|
||||
inline static int m_nPedHealth = 100;
|
||||
inline static bool m_bPedMove;
|
||||
inline static bool m_bPedBleed;
|
||||
inline static int m_nSelectedPedType;
|
||||
inline static int m_nWeaponId;
|
||||
inline static std::vector<std::string> m_PedTypeList =
|
||||
{
|
||||
"Civ male", "Civ female", "Cop", "Ballas", "Grove Street Families", "Los Santos Vagos",
|
||||
"San Fierro Rifa", "Da Nang Boys", "Mafia", "Mountain Cloud Triads", "Varrio Los Aztecas",
|
||||
"Gang 9", "Medic", "Dealer", "Criminal", "Fireman", "Prostitute"
|
||||
};
|
||||
} m_SpawnPed;
|
||||
inline static std::vector<std::string> m_GangNames =
|
||||
{
|
||||
"Ballas", "Grove street families", "Los santos vagos", "San fierro rifa",
|
||||
"Da nang boys", "Mafia", "Mountain cloud triad", "Varrio los aztecas", "Gang9", "Gang10"
|
||||
};
|
||||
inline static bool exgangwars_installed = false;
|
||||
inline static int ped_remove_radius = 5;
|
||||
|
||||
struct spawn_ped
|
||||
{
|
||||
inline static std::vector<CPed*> list;
|
||||
inline static int accuracy = 50;
|
||||
inline static int health = 100;
|
||||
inline static bool dont_move = false;
|
||||
inline static bool ped_bleed = false;
|
||||
inline static std::vector<std::string> ped_type =
|
||||
{
|
||||
"Civ male","Civ female","Cop","Ballas","Grove Street Families","Los Santos Vagos",
|
||||
"San Fierro Rifa","Da Nang Boys","Mafia","Mountain Cloud Triads","Varrio Los Aztecas",
|
||||
"Gang 9","Medic","Dealer","Criminal","Fireman","Prostitute"
|
||||
};
|
||||
inline static int selected_ped_type;
|
||||
inline static int weapon_id = 0;
|
||||
"Da nang boys", "Mafia", "Mountain cloud triad", "Varrio los aztecas", "Gang9", "Gang10"
|
||||
};
|
||||
|
||||
friend class Player;
|
||||
@ -42,4 +40,3 @@ public:
|
||||
static void Draw();
|
||||
static void SpawnPed(std::string& model);
|
||||
};
|
||||
|
||||
|
@ -7,10 +7,10 @@
|
||||
|
||||
inline static void PlayerModelBrokenFix()
|
||||
{
|
||||
CPlayerPed* player = FindPlayerPed();
|
||||
CPlayerPed* pPlayer = FindPlayerPed();
|
||||
|
||||
if (player->m_nModelIndex == 0)
|
||||
Call<0x5A81E0>(0, player->m_pPlayerData->m_pPedClothesDesc, 0xBC1C78, false);
|
||||
if (pPlayer->m_nModelIndex == 0)
|
||||
Call<0x5A81E0>(0, pPlayer->m_pPlayerData->m_pPedClothesDesc, 0xBC1C78, false);
|
||||
}
|
||||
|
||||
Player::Player()
|
||||
@ -18,29 +18,29 @@ Player::Player()
|
||||
// Fix player model being broken after rebuild
|
||||
patch::RedirectCall(0x5A834D, &PlayerModelBrokenFix);
|
||||
|
||||
aim_skin_changer = config.GetValue("aim_skin_changer", false);
|
||||
m_bAimSkinChanger = config.GetValue("aim_skin_changer", false);
|
||||
|
||||
// Custom skins setup
|
||||
if (GetModuleHandle("modloader.asi"))
|
||||
{
|
||||
if (fs::is_directory(custom_skins::dir))
|
||||
if (fs::is_directory(m_CustomSkins.m_Path))
|
||||
{
|
||||
for (auto& p : fs::recursive_directory_iterator(custom_skins::dir))
|
||||
for (auto& p : fs::recursive_directory_iterator(m_CustomSkins.m_Path))
|
||||
{
|
||||
if (p.path().extension() == ".dff")
|
||||
{
|
||||
std::string file_name = p.path().stem().string();
|
||||
|
||||
if (file_name.size() < 9)
|
||||
custom_skins::store_vec.push_back(file_name);
|
||||
m_CustomSkins.m_List.push_back(file_name);
|
||||
else
|
||||
flog << "Custom Skin longer than 8 characters " << file_name << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
else fs::create_directory(custom_skins::dir);
|
||||
else fs::create_directory(m_CustomSkins.m_Path);
|
||||
|
||||
modloader_installed = true;
|
||||
m_bModloaderInstalled = true;
|
||||
}
|
||||
|
||||
Events::processScriptsEvent += []
|
||||
@ -48,32 +48,33 @@ Player::Player()
|
||||
uint timer = CTimer::m_snTimeInMilliseconds;
|
||||
static CPlayerPed* player = FindPlayerPed();
|
||||
|
||||
if (!images_loaded)
|
||||
if (!m_bImagesLoaded)
|
||||
{
|
||||
Util::LoadTexturesInDirRecursive(PLUGIN_PATH((char*)"CheatMenu\\clothes\\"), ".jpg", cloth_data.categories, cloth_data.images);
|
||||
images_loaded = true;
|
||||
Util::LoadTexturesInDirRecursive(
|
||||
PLUGIN_PATH((char*)"CheatMenu\\clothes\\"), ".jpg", m_ClothData.m_Categories, m_ClothData.m_ImagesList);
|
||||
m_bImagesLoaded = true;
|
||||
}
|
||||
|
||||
if (keep_position::state)
|
||||
if (m_KeepPosition.m_bEnabled)
|
||||
{
|
||||
if (!player->IsAlive())
|
||||
{
|
||||
keep_position::pos = player->GetPosition();
|
||||
m_KeepPosition.m_fPos = player->GetPosition();
|
||||
}
|
||||
else
|
||||
{
|
||||
CVector cur_pos = player->GetPosition();
|
||||
|
||||
if (keep_position::pos.x != 0 && keep_position::pos.x != cur_pos.x
|
||||
&& keep_position::pos.y != 0 && keep_position::pos.y != cur_pos.y)
|
||||
if (m_KeepPosition.m_fPos.x != 0 && m_KeepPosition.m_fPos.x != cur_pos.x
|
||||
&& m_KeepPosition.m_fPos.y != 0 && m_KeepPosition.m_fPos.y != cur_pos.y)
|
||||
{
|
||||
player->Teleport(keep_position::pos, false);
|
||||
keep_position::pos = CVector(0, 0, 0);
|
||||
player->Teleport(m_KeepPosition.m_fPos, false);
|
||||
m_KeepPosition.m_fPos = CVector(0, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (god_mode)
|
||||
if (m_bGodMode)
|
||||
{
|
||||
patch::Set<bool>(0x96916D, 1, false);
|
||||
player->m_nPhysicalFlags.bBulletProof = 1;
|
||||
@ -83,7 +84,7 @@ Player::Player()
|
||||
player->m_nPhysicalFlags.bMeeleProof = 1;
|
||||
}
|
||||
|
||||
if (aim_skin_changer && Ui::HotKeyPressed(Menu::hotkeys::aim_skin_changer))
|
||||
if (m_bAimSkinChanger && Ui::HotKeyPressed(Menu::m_HotKeys.aimSkinChanger))
|
||||
{
|
||||
CPed* target_ped = player->m_pPlayerTargettedPed;
|
||||
if (target_ped)
|
||||
@ -93,24 +94,24 @@ Player::Player()
|
||||
}
|
||||
}
|
||||
|
||||
if (Ui::HotKeyPressed(Menu::hotkeys::god_mode))
|
||||
if (Ui::HotKeyPressed(Menu::m_HotKeys.godMode))
|
||||
{
|
||||
if (god_mode)
|
||||
if (m_bGodMode)
|
||||
{
|
||||
CHud::SetHelpMessage("God mode disabled", false, false, false);
|
||||
|
||||
patch::Set<bool>(0x96916D, god_mode, false);
|
||||
patch::Set<bool>(0x96916D, m_bGodMode, false);
|
||||
player->m_nPhysicalFlags.bBulletProof = false;
|
||||
player->m_nPhysicalFlags.bCollisionProof = false;
|
||||
player->m_nPhysicalFlags.bExplosionProof = false;
|
||||
player->m_nPhysicalFlags.bFireProof = false;
|
||||
player->m_nPhysicalFlags.bMeeleProof = false;
|
||||
god_mode = false;
|
||||
m_bGodMode = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
CHud::SetHelpMessage("God mode enabled", false, false, false);
|
||||
god_mode = true;
|
||||
m_bGodMode = true;
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -118,7 +119,7 @@ Player::Player()
|
||||
|
||||
Player::~Player()
|
||||
{
|
||||
Util::ReleaseTextures(cloth_data.images);
|
||||
Util::ReleaseTextures(m_ClothData.m_ImagesList);
|
||||
}
|
||||
|
||||
void Player::ChangePlayerCloth(std::string& name)
|
||||
@ -152,7 +153,8 @@ void Player::ChangePlayerCloth(std::string& name)
|
||||
if (texture9 == "12myfac")
|
||||
player->m_pPlayerData->m_pPedClothesDesc->SetTextureAndModel(-1750049245, 1393983095, body_part);
|
||||
else
|
||||
player->m_pPlayerData->m_pPedClothesDesc->SetTextureAndModel(texture9.c_str(), model.c_str(), body_part);
|
||||
player->m_pPlayerData->m_pPedClothesDesc->
|
||||
SetTextureAndModel(texture9.c_str(), model.c_str(), body_part);
|
||||
}
|
||||
}
|
||||
CClothes::RebuildPlayer(player, false);
|
||||
@ -160,15 +162,16 @@ 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_data.json.data.contains(model) || custom_skin)
|
||||
bool custom_skin = std::find(m_CustomSkins.m_List.begin(), m_CustomSkins.m_List.end(), model) !=
|
||||
m_CustomSkins.m_List.end();
|
||||
if (Ped::m_PedData.m_Json.m_Data.contains(model) || custom_skin)
|
||||
{
|
||||
CPlayerPed* player = FindPlayerPed();
|
||||
if (Ped::pedspecial_json.data.contains(model) || custom_skin)
|
||||
if (Ped::m_SpecialPedJson.m_Data.contains(model) || custom_skin)
|
||||
{
|
||||
std::string name;
|
||||
if (Ped::pedspecial_json.data.contains(model))
|
||||
name = Ped::pedspecial_json.data[model].get<std::string>().c_str();
|
||||
if (Ped::m_SpecialPedJson.m_Data.contains(model))
|
||||
name = Ped::m_SpecialPedJson.m_Data[model].get<std::string>().c_str();
|
||||
else
|
||||
name = model;
|
||||
|
||||
@ -193,13 +196,13 @@ void Player::ChangePlayerModel(std::string& model)
|
||||
|
||||
void Player::Draw()
|
||||
{
|
||||
CPlayerPed* player = FindPlayerPed();
|
||||
int hplayer = CPools::GetPedRef(player);
|
||||
CPad* pad = player->GetPadFromPlayer();
|
||||
CPlayerPed* pPlayer = FindPlayerPed();
|
||||
int hplayer = CPools::GetPedRef(pPlayer);
|
||||
CPad* pad = pPlayer->GetPadFromPlayer();
|
||||
|
||||
if (ImGui::Button("Copy coordinates", ImVec2(Ui::GetSize(2))))
|
||||
{
|
||||
CVector pos = player->GetPosition();
|
||||
CVector pos = pPlayer->GetPosition();
|
||||
std::string text = std::to_string(pos.x) + ", " + std::to_string(pos.y) + ", " + std::to_string(pos.z);
|
||||
|
||||
ImGui::SetClipboardText(text.c_str());
|
||||
@ -207,7 +210,7 @@ void Player::Draw()
|
||||
}
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("Suicide", ImVec2(Ui::GetSize(2))))
|
||||
player->m_fHealth = 0.0;
|
||||
pPlayer->m_fHealth = 0.0;
|
||||
|
||||
ImGui::Spacing();
|
||||
|
||||
@ -222,25 +225,25 @@ void Player::Draw()
|
||||
ImGui::Columns(2, 0, false);
|
||||
|
||||
Ui::CheckboxAddress("Bounty on yourself", 0x96913F);
|
||||
if (Ui::CheckboxWithHint("God mode", &god_mode))
|
||||
if (Ui::CheckboxWithHint("God mode", &m_bGodMode))
|
||||
{
|
||||
patch::Set<bool>(0x96916D, god_mode, false);
|
||||
player->m_nPhysicalFlags.bBulletProof = god_mode;
|
||||
player->m_nPhysicalFlags.bCollisionProof = god_mode;
|
||||
player->m_nPhysicalFlags.bExplosionProof = god_mode;
|
||||
player->m_nPhysicalFlags.bFireProof = god_mode;
|
||||
player->m_nPhysicalFlags.bMeeleProof = god_mode;
|
||||
patch::Set<bool>(0x96916D, m_bGodMode, false);
|
||||
pPlayer->m_nPhysicalFlags.bBulletProof = m_bGodMode;
|
||||
pPlayer->m_nPhysicalFlags.bCollisionProof = m_bGodMode;
|
||||
pPlayer->m_nPhysicalFlags.bExplosionProof = m_bGodMode;
|
||||
pPlayer->m_nPhysicalFlags.bFireProof = m_bGodMode;
|
||||
pPlayer->m_nPhysicalFlags.bMeeleProof = m_bGodMode;
|
||||
}
|
||||
|
||||
Ui::CheckboxAddress("Higher cycle jumps", 0x969161);
|
||||
Ui::CheckboxAddress("Infinite oxygen", 0x96916E);
|
||||
Ui::CheckboxAddress("Infinite run", 0xB7CEE4);
|
||||
if (Ui::CheckboxBitFlag("Invisible player", player->m_nPedFlags.bDontRender))
|
||||
player->m_nPedFlags.bDontRender = (player->m_nPedFlags.bDontRender == 1) ? 0 : 1;
|
||||
if (Ui::CheckboxBitFlag("Invisible player", pPlayer->m_nPedFlags.bDontRender))
|
||||
pPlayer->m_nPedFlags.bDontRender = (pPlayer->m_nPedFlags.bDontRender == 1) ? 0 : 1;
|
||||
|
||||
ImGui::NextColumn();
|
||||
|
||||
Ui::CheckboxWithHint("Keep position", &keep_position::state, "Teleport to the position you died from");
|
||||
Ui::CheckboxWithHint("Keep position", &m_KeepPosition.m_bEnabled, "Teleport to the position you died from");
|
||||
if (Ui::CheckboxBitFlag("Lock control", pad->bPlayerSafe))
|
||||
pad->bPlayerSafe = (pad->bPlayerSafe == 1) ? 0 : 1;
|
||||
|
||||
@ -262,23 +265,23 @@ void Player::Draw()
|
||||
{
|
||||
ImGui::BeginChild("PlayerMenus");
|
||||
|
||||
Ui::EditReference("Armour", player->m_fArmour, 0, 100, 150);
|
||||
Ui::EditReference("Armour", pPlayer->m_fArmour, 0, 100, 150);
|
||||
if (ImGui::CollapsingHeader("Body"))
|
||||
{
|
||||
if (player->m_nModelIndex == 0)
|
||||
if (pPlayer->m_nModelIndex == 0)
|
||||
{
|
||||
ImGui::Columns(3, 0, false);
|
||||
if (ImGui::RadioButton("Fat", &body, 2))
|
||||
if (ImGui::RadioButton("Fat", &m_nUiBodyState, 2))
|
||||
CCheat::FatCheat();
|
||||
|
||||
ImGui::NextColumn();
|
||||
|
||||
if (ImGui::RadioButton("Muscle", &body, 1))
|
||||
if (ImGui::RadioButton("Muscle", &m_nUiBodyState, 1))
|
||||
CCheat::MuscleCheat();
|
||||
|
||||
ImGui::NextColumn();
|
||||
|
||||
if (ImGui::RadioButton("Skinny", &body, 0))
|
||||
if (ImGui::RadioButton("Skinny", &m_nUiBodyState, 0))
|
||||
CCheat::SkinnyCheat();
|
||||
|
||||
ImGui::Columns(1);
|
||||
@ -290,8 +293,8 @@ void Player::Draw()
|
||||
|
||||
if (ImGui::Button("Change to CJ skin", ImVec2(Ui::GetSize(1))))
|
||||
{
|
||||
player->SetModelIndex(0);
|
||||
Util::ClearCharTasksVehCheck(player);
|
||||
pPlayer->SetModelIndex(0);
|
||||
Util::ClearCharTasksVehCheck(pPlayer);
|
||||
}
|
||||
}
|
||||
ImGui::Spacing();
|
||||
@ -300,7 +303,7 @@ void Player::Draw()
|
||||
|
||||
Ui::EditStat("Energy", STAT_ENERGY);
|
||||
Ui::EditStat("Fat", STAT_FAT);
|
||||
Ui::EditReference("Health", player->m_fHealth, 0, 100, static_cast<int>(player->m_fMaxHealth));
|
||||
Ui::EditReference("Health", pPlayer->m_fHealth, 0, 100, static_cast<int>(pPlayer->m_fMaxHealth));
|
||||
Ui::EditStat("Lung capacity", STAT_LUNG_CAPACITY);
|
||||
Ui::EditStat("Max health", STAT_MAX_HEALTH, 0, 569, 1450);
|
||||
Ui::EditAddress<int>("Money", 0xB7CE50, -99999999, 0, 99999999);
|
||||
@ -309,8 +312,8 @@ void Player::Draw()
|
||||
Ui::EditStat("Stamina", STAT_STAMINA);
|
||||
if (ImGui::CollapsingHeader("Wanted level"))
|
||||
{
|
||||
int val = player->m_pPlayerData->m_pWanted->m_nWantedLevel;
|
||||
int max_wl = player->m_pPlayerData->m_pWanted->MaximumWantedLevel;
|
||||
int val = pPlayer->m_pPlayerData->m_pWanted->m_nWantedLevel;
|
||||
int max_wl = pPlayer->m_pPlayerData->m_pWanted->MaximumWantedLevel;
|
||||
|
||||
ImGui::Columns(3, 0, false);
|
||||
ImGui::Text("Min: 0");
|
||||
@ -323,21 +326,21 @@ void Player::Draw()
|
||||
ImGui::Spacing();
|
||||
|
||||
if (ImGui::InputInt("Set value##Wanted level", &val))
|
||||
player->CheatWantedLevel(val);
|
||||
pPlayer->CheatWantedLevel(val);
|
||||
|
||||
ImGui::Spacing();
|
||||
if (ImGui::Button("Minimum##Wanted level", Ui::GetSize(3)))
|
||||
player->CheatWantedLevel(0);
|
||||
pPlayer->CheatWantedLevel(0);
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
if (ImGui::Button("Default##Wanted level", Ui::GetSize(3)))
|
||||
player->CheatWantedLevel(0);
|
||||
pPlayer->CheatWantedLevel(0);
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
if (ImGui::Button("Maximum##Wanted level", Ui::GetSize(3)))
|
||||
player->CheatWantedLevel(max_wl);
|
||||
pPlayer->CheatWantedLevel(max_wl);
|
||||
|
||||
ImGui::Spacing();
|
||||
ImGui::Separator();
|
||||
@ -350,8 +353,10 @@ void Player::Draw()
|
||||
if (ImGui::BeginTabItem("Appearance"))
|
||||
{
|
||||
ImGui::Spacing();
|
||||
if (Ui::CheckboxWithHint("Aim skin changer", &aim_skin_changer, (("Activate using Aim ped + ") + Ui::GetHotKeyNameString(Menu::hotkeys::aim_skin_changer)).c_str()))
|
||||
config.SetValue("aim_skin_changer", aim_skin_changer);
|
||||
if (Ui::CheckboxWithHint("Aim skin changer", &m_bAimSkinChanger,
|
||||
(("Activate using Aim ped + ") + Ui::GetHotKeyNameString(
|
||||
Menu::m_HotKeys.aimSkinChanger)).c_str()))
|
||||
config.SetValue("aim_skin_changer", m_bAimSkinChanger);
|
||||
|
||||
if (ImGui::BeginTabBar("AppearanceTabBar"))
|
||||
{
|
||||
@ -359,7 +364,7 @@ void Player::Draw()
|
||||
{
|
||||
ImGui::Spacing();
|
||||
|
||||
if (player->m_nModelIndex == 0)
|
||||
if (pPlayer->m_nModelIndex == 0)
|
||||
{
|
||||
if (ImGui::Button("Remove clothes", ImVec2(Ui::GetSize())))
|
||||
{
|
||||
@ -373,17 +378,18 @@ void Player::Draw()
|
||||
}
|
||||
ImGui::Spacing();
|
||||
|
||||
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);
|
||||
std::string temp;
|
||||
Ui::DrawImages(m_ClothData.m_ImagesList, ImVec2(70, 100), m_ClothData.m_Categories, m_ClothData.m_Selected,
|
||||
m_ClothData.m_Filter, ChangePlayerCloth, nullptr,
|
||||
[](std::string str)
|
||||
{
|
||||
std::stringstream ss(str);
|
||||
std::string temp;
|
||||
|
||||
getline(ss, temp, '$');
|
||||
getline(ss, temp, '$');
|
||||
getline(ss, temp, '$');
|
||||
getline(ss, temp, '$');
|
||||
|
||||
return temp;
|
||||
});
|
||||
return temp;
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -392,32 +398,36 @@ void Player::Draw()
|
||||
|
||||
if (ImGui::Button("Change to CJ skin", ImVec2(Ui::GetSize(1))))
|
||||
{
|
||||
player->SetModelIndex(0);
|
||||
Util::ClearCharTasksVehCheck(player);
|
||||
pPlayer->SetModelIndex(0);
|
||||
Util::ClearCharTasksVehCheck(pPlayer);
|
||||
}
|
||||
}
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
if (ImGui::BeginTabItem("Ped skins"))
|
||||
{
|
||||
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>(); });
|
||||
Ui::DrawImages(Ped::m_PedData.m_ImagesList, ImVec2(65, 110), Ped::m_PedData.m_Categories,
|
||||
Ped::m_PedData.m_Selected, Ped::m_PedData.m_Filter, ChangePlayerModel, nullptr,
|
||||
[](std::string str) { return Ped::m_PedData.m_Json.m_Data[str].get<std::string>(); });
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
if (ImGui::BeginTabItem("Custom skins"))
|
||||
{
|
||||
ImGui::Spacing();
|
||||
|
||||
if (modloader_installed)
|
||||
if (m_bModloaderInstalled)
|
||||
{
|
||||
Ui::FilterWithHint("Search", cloth_data.filter, std::string("Total skins: " + std::to_string(custom_skins::store_vec.size())).c_str());
|
||||
Ui::FilterWithHint("Search", m_ClothData.m_Filter,
|
||||
std::string("Total skins: " + std::to_string(m_CustomSkins.m_List.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.");
|
||||
ImGui::TextWrapped(
|
||||
"Note: Your txd & dff names can't exceed 8 characters. Don't change names while the game is running.");
|
||||
ImGui::Spacing();
|
||||
for (std::string name : custom_skins::store_vec)
|
||||
for (std::string name : m_CustomSkins.m_List)
|
||||
{
|
||||
if (custom_skins::filter.PassFilter(name.c_str()))
|
||||
if (m_CustomSkins.m_Filter.PassFilter(name.c_str()))
|
||||
{
|
||||
if (ImGui::MenuItem(name.c_str()))
|
||||
{
|
||||
@ -428,7 +438,8 @@ void Player::Draw()
|
||||
}
|
||||
else
|
||||
{
|
||||
ImGui::TextWrapped("Custom skin allows to change player skins without replacing any existing game ped skins.\n\
|
||||
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\
|
||||
@ -440,7 +451,8 @@ Limitations:\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);
|
||||
ShellExecute(NULL, "open", "https://gtaforums.com/topic/669520-mod-loader/", NULL, NULL,
|
||||
SW_SHOWNORMAL);
|
||||
}
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
|
@ -2,24 +2,23 @@
|
||||
class Player
|
||||
{
|
||||
private:
|
||||
struct keep_position
|
||||
inline static bool m_bGodMode;
|
||||
inline static int m_nUiBodyState;
|
||||
inline static bool m_bAimSkinChanger;
|
||||
inline static SSearchData m_ClothData;
|
||||
inline static bool m_bImagesLoaded;
|
||||
inline static bool m_bModloaderInstalled;
|
||||
static struct
|
||||
{
|
||||
inline static bool state = false;
|
||||
inline static CVector pos;
|
||||
};
|
||||
inline static bool god_mode = false;
|
||||
inline static int body = 0;
|
||||
inline static bool aim_skin_changer = false;
|
||||
inline static SearchData cloth_data;
|
||||
inline static bool images_loaded = false;
|
||||
|
||||
struct custom_skins
|
||||
inline static bool m_bEnabled = false;
|
||||
inline static CVector m_fPos;
|
||||
} m_KeepPosition;
|
||||
static struct
|
||||
{
|
||||
inline static std::string dir = paths::GetGameDirPathA() + std::string("\\modloader\\Custom Skins\\");;
|
||||
inline static ImGuiTextFilter filter = "";
|
||||
inline static std::vector<std::string> store_vec;
|
||||
};
|
||||
inline static bool modloader_installed = false;
|
||||
inline static std::string m_Path = paths::GetGameDirPathA() + std::string("\\modloader\\Custom Skins\\");;
|
||||
inline static ImGuiTextFilter m_Filter;
|
||||
inline static std::vector<std::string> m_List;
|
||||
} m_CustomSkins;
|
||||
|
||||
public:
|
||||
Player();
|
||||
@ -28,4 +27,3 @@ public:
|
||||
static void ChangePlayerModel(std::string& model);
|
||||
static void Draw();
|
||||
};
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include "Util.h"
|
||||
|
||||
// FlA
|
||||
tRadarTrace* CRadar::ms_RadarTrace = reinterpret_cast<tRadarTrace *>(patch::GetPointer(0x5838B0 + 2));
|
||||
tRadarTrace* CRadar::ms_RadarTrace = reinterpret_cast<tRadarTrace*>(patch::GetPointer(0x5838B0 + 2));
|
||||
|
||||
void Teleport::FetchRadarSpriteData()
|
||||
{
|
||||
@ -16,17 +16,18 @@ void Teleport::FetchRadarSpriteData()
|
||||
if (cur_timer - timer < 5000)
|
||||
return;
|
||||
|
||||
tp_data.json.data.erase("Radar");
|
||||
tp_data.m_Json.m_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)
|
||||
for (int i = 0; i != 175; ++i)
|
||||
{
|
||||
CVector pos = CRadar::ms_RadarTrace[i].m_vPosition;
|
||||
uchar sprite = CRadar::ms_RadarTrace[i].m_nBlipSprite;
|
||||
std::string sprite_name = sprite_name_json.data[std::to_string(sprite)].get<std::string>();
|
||||
auto sprite_name = m_SpriteJson.m_Data[std::to_string(sprite)].get<std::string>();
|
||||
std::string key_name = sprite_name + ", " + Util::GetLocationName(&pos);
|
||||
|
||||
tp_data.json.data["Radar"][key_name] = "0, " + std::to_string(pos.x) + ", " + std::to_string(pos.y) + ", " + std::to_string(pos.z);
|
||||
tp_data.m_Json.m_Data["Radar"][key_name] = "0, " + std::to_string(pos.x) + ", " + std::to_string(pos.y) + ", " +
|
||||
std::to_string(pos.z);
|
||||
|
||||
/*
|
||||
"Radar" : {
|
||||
@ -38,36 +39,37 @@ void Teleport::FetchRadarSpriteData()
|
||||
|
||||
Teleport::Teleport()
|
||||
{
|
||||
tp_data.json.LoadData(tp_data.categories, tp_data.selected);
|
||||
quick_teleport = config.GetValue("quick_teleport", false);
|
||||
tp_data.m_Json.LoadData(tp_data.m_Categories, tp_data.m_Selected);
|
||||
m_bQuickTeleport = config.GetValue("quick_teleport", false);
|
||||
|
||||
Events::processScriptsEvent += []
|
||||
{
|
||||
if ((STeleport::_bool == true) && ((CTimer::m_snTimeInMilliseconds - STeleport::timer) > 500))
|
||||
if ((m_Teleport.m_bEnabled == true) && ((CTimer::m_snTimeInMilliseconds - m_Teleport.m_nTimer) > 500))
|
||||
{
|
||||
CPlayerPed *player = FindPlayerPed();
|
||||
CPlayerPed* player = FindPlayerPed();
|
||||
|
||||
CEntity* player_entity = FindPlayerEntity(-1);
|
||||
STeleport::pos.z = CWorld::FindGroundZFor3DCoord(Teleport::STeleport::pos.x, Teleport::STeleport::pos.y, STeleport::pos.z + 100.0f, 0, &player_entity) + 1.0f;
|
||||
CVehicle *pVeh = player->m_pVehicle;
|
||||
m_Teleport.m_fPos.z = CWorld::FindGroundZFor3DCoord(m_Teleport.m_fPos.x, m_Teleport.m_fPos.y,
|
||||
m_Teleport.m_fPos.z + 100.0f, nullptr, &player_entity) + 1.0f;
|
||||
CVehicle* pVeh = player->m_pVehicle;
|
||||
|
||||
if (pVeh && player->m_nPedFlags.bInVehicle)
|
||||
pVeh->Teleport(STeleport::pos, false);
|
||||
pVeh->Teleport(m_Teleport.m_fPos, false);
|
||||
else
|
||||
player->Teleport(STeleport::pos, false);
|
||||
player->Teleport(m_Teleport.m_fPos, false);
|
||||
|
||||
STeleport::_bool = false;
|
||||
m_Teleport.m_bEnabled = false;
|
||||
Command<Commands::FREEZE_CHAR_POSITION_AND_DONT_LOAD_COLLISION>(CPools::GetPedRef(player), false);
|
||||
Command<Commands::RESTORE_CAMERA_JUMPCUT>();
|
||||
TheCamera.Fade(0,1);
|
||||
TheCamera.Fade(0, 1);
|
||||
}
|
||||
|
||||
if (quick_teleport)
|
||||
|
||||
if (m_bQuickTeleport)
|
||||
{
|
||||
if (Ui::HotKeyPressed(Menu::hotkeys::quick_tp)
|
||||
&& ((CTimer::m_snTimeInMilliseconds - quick_teleport_timer) > 500))
|
||||
if (Ui::HotKeyPressed(Menu::m_HotKeys.quickTeleport)
|
||||
&& ((CTimer::m_snTimeInMilliseconds - m_nQuickTeleportTimer) > 500))
|
||||
{
|
||||
quick_teleport_timer = CTimer::m_snTimeInMilliseconds;
|
||||
m_nQuickTeleportTimer = CTimer::m_snTimeInMilliseconds;
|
||||
TeleportPlayer(true);
|
||||
}
|
||||
}
|
||||
@ -76,35 +78,34 @@ Teleport::Teleport()
|
||||
|
||||
void Teleport::TeleportPlayer(bool get_marker, CVector pos, short interior_id)
|
||||
{
|
||||
CPlayerPed *player = FindPlayerPed();
|
||||
CVehicle *pVeh = player->m_pVehicle;
|
||||
CPlayerPed* pPlayer = FindPlayerPed();
|
||||
CVehicle* pVeh = pPlayer->m_pVehicle;
|
||||
|
||||
if (get_marker)
|
||||
{
|
||||
auto target_blip = CRadar::ms_RadarTrace[LOWORD(FrontEndMenuManager.m_nTargetBlipIndex)];
|
||||
tRadarTrace targetBlip = CRadar::ms_RadarTrace[LOWORD(FrontEndMenuManager.m_nTargetBlipIndex)];
|
||||
|
||||
|
||||
if (target_blip.m_nBlipSprite != RADAR_SPRITE_WAYPOINT)
|
||||
if (targetBlip.m_nBlipSprite != RADAR_SPRITE_WAYPOINT)
|
||||
{
|
||||
CHud::SetHelpMessage("No blip found", false, false, false);
|
||||
return;
|
||||
}
|
||||
CEntity* player_entity = FindPlayerEntity(-1);
|
||||
pos = target_blip.m_vPosition;
|
||||
pos.z = CWorld::FindGroundZFor3DCoord(pos.x, pos.y, 1000, 0, &player_entity) + 50.f;
|
||||
CEntity* pPlayerEntity = FindPlayerEntity(-1);
|
||||
pos = targetBlip.m_vPosition;
|
||||
pos.z = CWorld::FindGroundZFor3DCoord(pos.x, pos.y, 1000, nullptr, &pPlayerEntity) + 50.f;
|
||||
|
||||
Teleport::STeleport::pos = pos;
|
||||
Teleport::STeleport::timer = CTimer::m_snTimeInMilliseconds;
|
||||
Teleport::STeleport::_bool = true;
|
||||
TheCamera.Fade(0,0);
|
||||
Command<Commands::FREEZE_CHAR_POSITION_AND_DONT_LOAD_COLLISION>(CPools::GetPedRef(player), true);
|
||||
m_Teleport.m_fPos = pos;
|
||||
m_Teleport.m_nTimer = CTimer::m_snTimeInMilliseconds;
|
||||
m_Teleport.m_bEnabled = true;
|
||||
TheCamera.Fade(0, 0);
|
||||
Command<Commands::FREEZE_CHAR_POSITION_AND_DONT_LOAD_COLLISION>(CPools::GetPedRef(pPlayer), true);
|
||||
}
|
||||
|
||||
CStreaming::LoadScene(&pos);
|
||||
CStreaming::LoadSceneCollision(&pos);
|
||||
CStreaming::LoadAllRequestedModels(false);
|
||||
|
||||
if (pVeh && player->m_nPedFlags.bInVehicle)
|
||||
|
||||
if (pVeh && pPlayer->m_nPedFlags.bInVehicle)
|
||||
{
|
||||
pVeh->Teleport(pos, false);
|
||||
|
||||
@ -112,19 +113,20 @@ void Teleport::TeleportPlayer(bool get_marker, CVector pos, short interior_id)
|
||||
reinterpret_cast<CBike*>(pVeh)->PlaceOnRoadProperly();
|
||||
else if (pVeh->m_nVehicleClass != VEHICLE_BOAT)
|
||||
reinterpret_cast<CAutomobile*>(pVeh)->PlaceOnRoadProperly();
|
||||
|
||||
|
||||
pVeh->m_nAreaCode = interior_id;
|
||||
}
|
||||
else
|
||||
player->Teleport(pos, false);
|
||||
pPlayer->Teleport(pos, false);
|
||||
|
||||
player->m_nAreaCode = interior_id;
|
||||
pPlayer->m_nAreaCode = interior_id;
|
||||
Command<Commands::SET_AREA_VISIBLE>(interior_id);
|
||||
}
|
||||
|
||||
void Teleport::TeleportToLocation(std::string& rootkey, std::string& bLocName,std::string& loc)
|
||||
void Teleport::TeleportToLocation(std::string& rootkey, std::string& bLocName, std::string& loc)
|
||||
{
|
||||
try {
|
||||
try
|
||||
{
|
||||
int interior = 0;
|
||||
CVector pos;
|
||||
std::stringstream ss(loc);
|
||||
@ -142,9 +144,10 @@ void Teleport::TeleportToLocation(std::string& rootkey, std::string& bLocName,st
|
||||
std::getline(ss, temp, ',');
|
||||
pos.z = std::stof(temp);
|
||||
|
||||
Teleport::TeleportPlayer(false, pos, static_cast<short>(interior));
|
||||
TeleportPlayer(false, pos, static_cast<short>(interior));
|
||||
}
|
||||
catch (...) {
|
||||
catch (...)
|
||||
{
|
||||
CHud::SetHelpMessage("Invalid location", false, false, false);
|
||||
}
|
||||
}
|
||||
@ -153,16 +156,16 @@ void Teleport::RemoveTeleportEntry(std::string& category, std::string& key, std:
|
||||
{
|
||||
if (category == "Custom")
|
||||
{
|
||||
tp_data.json.data["Custom"].erase(key);
|
||||
tp_data.m_Json.m_Data["Custom"].erase(key);
|
||||
CHud::SetHelpMessage("Location removed", false, false, false);
|
||||
tp_data.json.WriteToDisk();
|
||||
tp_data.m_Json.WriteToDisk();
|
||||
}
|
||||
else CHud::SetHelpMessage("You can only remove custom location", false, false, false);
|
||||
}
|
||||
|
||||
void Teleport::Draw()
|
||||
{
|
||||
if (ImGui::BeginTabBar("Teleport",ImGuiTabBarFlags_NoTooltip+ImGuiTabBarFlags_FittingPolicyScroll))
|
||||
if (ImGui::BeginTabBar("Teleport", ImGuiTabBarFlags_NoTooltip + ImGuiTabBarFlags_FittingPolicyScroll))
|
||||
{
|
||||
ImGui::Spacing();
|
||||
if (ImGui::BeginTabItem("Teleport"))
|
||||
@ -170,36 +173,40 @@ void Teleport::Draw()
|
||||
ImGui::Spacing();
|
||||
if (ImGui::BeginChild("Teleport Child"))
|
||||
{
|
||||
ImGui::Columns(2, 0, false);
|
||||
ImGui::Checkbox("Insert coordinates", &insert_coord);
|
||||
ImGui::Columns(2, nullptr, false);
|
||||
ImGui::Checkbox("Insert coordinates", &m_bInsertCoord);
|
||||
ImGui::NextColumn();
|
||||
if (Ui::CheckboxWithHint("Quick teleport", &quick_teleport,
|
||||
(std::string("Teleport to marker using ") + Ui::GetHotKeyNameString(Menu::hotkeys::quick_tp)).c_str()))
|
||||
if (Ui::CheckboxWithHint("Quick teleport", &m_bQuickTeleport,
|
||||
(std::string("Teleport to marker using ") + Ui::GetHotKeyNameString(
|
||||
Menu::m_HotKeys.quickTeleport)).c_str()))
|
||||
{
|
||||
config.SetValue("quick_teleport", quick_teleport);
|
||||
config.SetValue("quick_teleport", m_bQuickTeleport);
|
||||
}
|
||||
|
||||
ImGui::Columns(1);
|
||||
ImGui::Spacing();
|
||||
|
||||
if (insert_coord)
|
||||
if (m_bInsertCoord)
|
||||
{
|
||||
CVector pos = FindPlayerPed()->GetPosition();
|
||||
|
||||
strcpy(input_buffer,(std::to_string(int(pos.x)) + ", " + std::to_string(int(pos.y)) + ", " + std::to_string(int(pos.z))).c_str());
|
||||
strcpy(m_nInputBuffer,
|
||||
(std::to_string(static_cast<int>(pos.x)) + ", " + std::to_string(static_cast<int>(pos.y)) +
|
||||
", " + std::to_string(static_cast<int>(pos.z))).c_str());
|
||||
}
|
||||
|
||||
ImGui::InputTextWithHint("Coordinates", "x, y, z", input_buffer, IM_ARRAYSIZE(input_buffer));
|
||||
|
||||
ImGui::InputTextWithHint("Coordinates", "x, y, z", m_nInputBuffer, IM_ARRAYSIZE(m_nInputBuffer));
|
||||
|
||||
ImGui::Spacing();
|
||||
|
||||
|
||||
if (ImGui::Button("Teleport to bCoord", Ui::GetSize(2)))
|
||||
{
|
||||
std::stringstream ss(input_buffer);
|
||||
std::stringstream ss(m_nInputBuffer);
|
||||
std::string temp;
|
||||
CVector pos(0,0,0);
|
||||
CVector pos(0, 0, 0);
|
||||
|
||||
try {
|
||||
try
|
||||
{
|
||||
getline(ss, temp, ',');
|
||||
pos.x = std::stof(temp);
|
||||
|
||||
@ -209,15 +216,16 @@ void Teleport::Draw()
|
||||
getline(ss, temp, ',');
|
||||
pos.z = std::stof(temp) + 1.0f;
|
||||
|
||||
Teleport::TeleportPlayer(false,pos);
|
||||
TeleportPlayer(false, pos);
|
||||
}
|
||||
catch (...) {
|
||||
catch (...)
|
||||
{
|
||||
CHud::SetHelpMessage("Invalid coordinate", false, false, false);
|
||||
}
|
||||
}
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("Teleport to marker", Ui::GetSize(2)))
|
||||
Teleport::TeleportPlayer(true);
|
||||
TeleportPlayer(true);
|
||||
|
||||
ImGui::EndChild();
|
||||
}
|
||||
@ -228,28 +236,29 @@ void Teleport::Draw()
|
||||
{
|
||||
FetchRadarSpriteData();
|
||||
ImGui::Spacing();
|
||||
Ui::DrawJSON(tp_data.json, tp_data.categories, tp_data.selected, tp_data.filter, &TeleportToLocation, &RemoveTeleportEntry);
|
||||
Ui::DrawJSON(tp_data.m_Json, tp_data.m_Categories, tp_data.m_Selected, tp_data.m_Filter, &TeleportToLocation,
|
||||
&RemoveTeleportEntry);
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
|
||||
if (ImGui::BeginTabItem("Custom"))
|
||||
{
|
||||
ImGui::Spacing();
|
||||
ImGui::InputTextWithHint("Location", "Groove Street", location_buffer, IM_ARRAYSIZE(input_buffer));
|
||||
ImGui::InputTextWithHint("Coordinates", "x, y, z", input_buffer, IM_ARRAYSIZE(input_buffer));
|
||||
ImGui::InputTextWithHint("Location", "Groove Street", m_nLocationBuffer, IM_ARRAYSIZE(m_nInputBuffer));
|
||||
ImGui::InputTextWithHint("Coordinates", "x, y, z", m_nInputBuffer, IM_ARRAYSIZE(m_nInputBuffer));
|
||||
ImGui::Spacing();
|
||||
if (ImGui::Button("Add location", Ui::GetSize()))
|
||||
{
|
||||
tp_data.json.data["Custom"][location_buffer] = ("0, " + std::string(input_buffer));
|
||||
tp_data.m_Json.m_Data["Custom"][m_nLocationBuffer] = ("0, " + std::string(m_nInputBuffer));
|
||||
|
||||
// Clear the Radar coordinates
|
||||
tp_data.json.data.erase("Radar");
|
||||
tp_data.json.data["Radar"] = {};
|
||||
tp_data.m_Json.m_Data.erase("Radar");
|
||||
tp_data.m_Json.m_Data["Radar"] = {};
|
||||
|
||||
tp_data.json.WriteToDisk();
|
||||
tp_data.m_Json.WriteToDisk();
|
||||
}
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
ImGui::EndTabBar();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,21 +5,20 @@
|
||||
class Teleport
|
||||
{
|
||||
private:
|
||||
inline static bool insert_coord = false;
|
||||
inline static bool quick_teleport = false;
|
||||
inline static char input_buffer[INPUT_BUFFER_SIZE] = "";
|
||||
inline static SearchData tp_data{ "teleport" };
|
||||
inline static char location_buffer[INPUT_BUFFER_SIZE] = "";
|
||||
inline static uint quick_teleport_timer = 0;
|
||||
|
||||
struct STeleport
|
||||
inline static bool m_bInsertCoord;
|
||||
inline static bool m_bQuickTeleport;
|
||||
inline static char m_nInputBuffer[INPUT_BUFFER_SIZE];
|
||||
inline static SSearchData tp_data{"teleport"};
|
||||
inline static char m_nLocationBuffer[INPUT_BUFFER_SIZE];
|
||||
inline static uint m_nQuickTeleportTimer;
|
||||
inline static CJson m_SpriteJson = CJson("radar sprite");
|
||||
static struct
|
||||
{
|
||||
inline static bool _bool = false;
|
||||
inline static CVector pos = { -1, -1, -1 };
|
||||
inline static uint timer = 0;
|
||||
};
|
||||
inline static bool m_bEnabled;
|
||||
inline static CVector m_fPos = {-1, -1, -1};
|
||||
inline static uint m_nTimer;
|
||||
} m_Teleport;
|
||||
|
||||
inline static CJson sprite_name_json = CJson("radar sprite");
|
||||
|
||||
/*
|
||||
Generates radar sprite coordinates on the fly.
|
||||
@ -30,10 +29,8 @@ private:
|
||||
protected:
|
||||
Teleport();
|
||||
public:
|
||||
|
||||
static void Draw();
|
||||
static void TeleportPlayer(bool get_marker = false, CVector pos = CVector(0, 0, 0), short interior_id = 0);
|
||||
static void TeleportToLocation(std::string& rootkey, std::string& bLocName, std::string& loc);
|
||||
static void RemoveTeleportEntry(std::string& rootkey, std::string& key, std::string& val);
|
||||
|
||||
};
|
||||
};
|
||||
|
@ -1,97 +1,97 @@
|
||||
uchar* m_nDirectionalMult = (uchar*)0x55F7C7; //m_nDirectionalMult[184]
|
||||
uchar* m_nDirectionalMult = (uchar*)0x55F7C7; //m_nDirectionalMult[184]
|
||||
|
||||
uchar* m_nWaterFogAlpha = (uchar*)0x55F7B8; //m_nWaterFogAlpha[184]
|
||||
uchar* m_nWaterFogAlpha = (uchar*)0x55F7B8; //m_nWaterFogAlpha[184]
|
||||
|
||||
uchar* m_nHighLightMinIntensity = (uchar*)0x55F7A9; //m_nHighLightMinIntensity[184]
|
||||
uchar* m_nHighLightMinIntensity = (uchar*)0x55F7A9; //m_nHighLightMinIntensity[184]
|
||||
|
||||
uchar* m_fCloudAlpha = (uchar*)0x55F793; //m_fCloudAlpha[184]
|
||||
uchar* m_fCloudAlpha = (uchar*)0x55F793; //m_fCloudAlpha[184]
|
||||
|
||||
uchar* m_fPostFx2Alpha = (uchar*)0x55F77D; //m_fPostFx2Alpha[184]
|
||||
uchar* m_fPostFx2Alpha = (uchar*)0x55F77D; //m_fPostFx2Alpha[184]
|
||||
|
||||
uchar* m_fPostFx2Blue = (uchar*)0x55F767; //m_fPostFx2Blue[184]
|
||||
uchar* m_fPostFx2Blue = (uchar*)0x55F767; //m_fPostFx2Blue[184]
|
||||
|
||||
uchar* m_fPostFx2Green = (uchar*)0x55F751; //m_fPostFx2Green[184]
|
||||
uchar* m_fPostFx2Green = (uchar*)0x55F751; //m_fPostFx2Green[184]
|
||||
|
||||
uchar* m_fPostFx2Red = (uchar*)0x55F73B; //m_fPostFx2Red[184]
|
||||
uchar* m_fPostFx2Red = (uchar*)0x55F73B; //m_fPostFx2Red[184]
|
||||
|
||||
uchar* m_fPostFx1Alpha = (uchar*)0x55F725; //m_fPostFx1Alpha[184]
|
||||
uchar* m_fPostFx1Alpha = (uchar*)0x55F725; //m_fPostFx1Alpha[184]
|
||||
|
||||
uchar* m_fPostFx1Blue = (uchar*)0x55F70F; //m_fPostFx1Blue[184]
|
||||
uchar* m_fPostFx1Blue = (uchar*)0x55F70F; //m_fPostFx1Blue[184]
|
||||
|
||||
uchar* m_fPostFx1Green = (uchar*)0x55F6FC; //m_fPostFx1Green[184]
|
||||
uchar* m_fPostFx1Green = (uchar*)0x55F6FC; //m_fPostFx1Green[184]
|
||||
|
||||
uchar* m_fPostFx1Red = (uchar*)0x55F6E9; //m_fPostFx1Red[184]
|
||||
uchar* m_fPostFx1Red = (uchar*)0x55F6E9; //m_fPostFx1Red[184]
|
||||
|
||||
uchar* m_fWaterAlpha = (uchar*)0x55F6D6; //m_fWaterAlpha[184]
|
||||
uchar* m_fWaterAlpha = (uchar*)0x55F6D6; //m_fWaterAlpha[184]
|
||||
|
||||
uchar* m_fWaterBlue = (uchar*)0x55F6C3; //m_fWaterBlue[184]
|
||||
uchar* m_fWaterBlue = (uchar*)0x55F6C3; //m_fWaterBlue[184]
|
||||
|
||||
uchar* m_fWaterGreen = (uchar*)0x55F6B0; //m_fWaterGreen[184]
|
||||
uchar* m_fWaterGreen = (uchar*)0x55F6B0; //m_fWaterGreen[184]
|
||||
|
||||
uchar* m_fWaterRed = (uchar*)0x55F69C; //m_fWaterRed[184]
|
||||
uchar* m_fWaterRed = (uchar*)0x55F69C; //m_fWaterRed[184]
|
||||
|
||||
uchar* m_nFluffyCloudsBottomBlue = (uchar*)0x55F690; //m_nFluffyCloudsBottomBlue[184]
|
||||
|
||||
uchar* m_nFluffyCloudsBottomGreen = (uchar*)0x55F683;//m_nFluffyCloudsBottomGreen[184]
|
||||
uchar* m_nFluffyCloudsBottomGreen = (uchar*)0x55F683; //m_nFluffyCloudsBottomGreen[184]
|
||||
|
||||
uchar* m_nFluffyCloudsBottomRed = (uchar*)0x55F677; //m_nFluffyCloudsBottomRed[184]
|
||||
uchar* m_nFluffyCloudsBottomRed = (uchar*)0x55F677; //m_nFluffyCloudsBottomRed[184]
|
||||
|
||||
uchar* m_nLowCloudsBlue = (uchar*)0x55F66B; //m_nLowCloudsBlue[184]
|
||||
uchar* m_nLowCloudsBlue = (uchar*)0x55F66B; //m_nLowCloudsBlue[184]
|
||||
|
||||
uchar* m_nLowCloudsGreen = (uchar*)0x55F65F; //m_nLowCloudsGreen[184]
|
||||
uchar* m_nLowCloudsGreen = (uchar*)0x55F65F; //m_nLowCloudsGreen[184]
|
||||
|
||||
uchar* m_nLowCloudsRed = (uchar*)0x55F653; //m_nLowCloudsRed[184]
|
||||
uchar* m_nLowCloudsRed = (uchar*)0x55F653; //m_nLowCloudsRed[184]
|
||||
|
||||
uchar* m_fLightsOnGroundBrightness = (uchar*)0x55F640;//m_fLightsOnGroundBrightness[184]
|
||||
uchar* m_fLightsOnGroundBrightness = (uchar*)0x55F640; //m_fLightsOnGroundBrightness[184]
|
||||
|
||||
short* m_fFogStart = (short*)0x55F62E; //m_fFogStart[184]
|
||||
short* m_fFogStart = (short*)0x55F62E; //m_fFogStart[184]
|
||||
|
||||
short* m_fFarClip = (short*)0x55F61B; //m_fFarClip[184]
|
||||
short* m_fFarClip = (short*)0x55F61B; //m_fFarClip[184]
|
||||
|
||||
uchar* m_nPoleShadowStrength = (uchar*)0x55F60F; //m_nPoleShadowStrength[184]
|
||||
uchar* m_nPoleShadowStrength = (uchar*)0x55F60F; //m_nPoleShadowStrength[184]
|
||||
|
||||
uchar* m_nLightShadowStrength = (uchar*)0x55F603; //m_nLightShadowStrength[184]
|
||||
uchar* m_nLightShadowStrength = (uchar*)0x55F603; //m_nLightShadowStrength[184]
|
||||
|
||||
uchar* m_nShadowStrength = (uchar*)0x55F5F7; //m_nShadowStrength[184]
|
||||
uchar* m_nShadowStrength = (uchar*)0x55F5F7; //m_nShadowStrength[184]
|
||||
|
||||
uchar* m_fSpriteBrightness = (uchar*)0x55F5E4; //m_fSpriteBrightness[184]
|
||||
uchar* m_fSpriteBrightness = (uchar*)0x55F5E4; //m_fSpriteBrightness[184]
|
||||
|
||||
uchar* m_fSpriteSize = (uchar*)0x55F5D2; //m_fSpriteSize[184]
|
||||
uchar* m_fSpriteSize = (uchar*)0x55F5D2; //m_fSpriteSize[184]
|
||||
|
||||
uchar* m_fSunSize = (uchar*)0x55F5C0; //m_fSunSize[184]
|
||||
uchar* m_fSunSize = (uchar*)0x55F5C0; //m_fSunSize[184]
|
||||
|
||||
uchar* m_nSunCoronaBlue = (uchar*)0x55F5B5; //m_nSunCoronaBlue[184]
|
||||
uchar* m_nSunCoronaBlue = (uchar*)0x55F5B5; //m_nSunCoronaBlue[184]
|
||||
|
||||
uchar* m_nSunCoronaGreen = (uchar*)0x55F5A9; //m_nSunCoronaGreen[184]
|
||||
uchar* m_nSunCoronaGreen = (uchar*)0x55F5A9; //m_nSunCoronaGreen[184]
|
||||
|
||||
uchar* m_nSunCoronaRed = (uchar*)0x55F59D; //m_nSunCoronaRed[184]
|
||||
uchar* m_nSunCoronaRed = (uchar*)0x55F59D; //m_nSunCoronaRed[184]
|
||||
|
||||
uchar* m_nSunCoreBlue = (uchar*)0x55F591; //m_nSunCoreBlue[184]
|
||||
uchar* m_nSunCoreBlue = (uchar*)0x55F591; //m_nSunCoreBlue[184]
|
||||
|
||||
uchar* m_nSunCoreGreen = (uchar*)0x55F585; //m_nSunCoreGreen[184]
|
||||
uchar* m_nSunCoreGreen = (uchar*)0x55F585; //m_nSunCoreGreen[184]
|
||||
|
||||
uchar* m_nSunCoreRed = (uchar*)0x55F579; //m_nSunCoreRed[184]
|
||||
uchar* m_nSunCoreRed = (uchar*)0x55F579; //m_nSunCoreRed[184]
|
||||
|
||||
uchar* m_nSkyBottomBlue = (uchar*)0x55F56D; //m_nSkyBottomBlue[184]
|
||||
uchar* m_nSkyBottomBlue = (uchar*)0x55F56D; //m_nSkyBottomBlue[184]
|
||||
|
||||
uchar* m_nSkyBottomGreen = (uchar*)0x55F561; //m_nSkyBottomGreen[184]
|
||||
uchar* m_nSkyBottomGreen = (uchar*)0x55F561; //m_nSkyBottomGreen[184]
|
||||
|
||||
uchar* m_nSkyBottomRed = (uchar*)0x55F555; //m_nSkyBottomRed[184]
|
||||
uchar* m_nSkyBottomRed = (uchar*)0x55F555; //m_nSkyBottomRed[184]
|
||||
|
||||
uchar* m_nSkyTopBlue = (uchar*)0x55F549; //m_nSkyTopBlue[45]
|
||||
uchar* m_nSkyTopBlue = (uchar*)0x55F549; //m_nSkyTopBlue[45]
|
||||
|
||||
uchar* m_nSkyTopGreen = (uchar*)0x55F53D; //m_nSkyTopGreen[45]
|
||||
uchar* m_nSkyTopGreen = (uchar*)0x55F53D; //m_nSkyTopGreen[45]
|
||||
|
||||
uchar* m_nSkyTopRed = (uchar*)0x55F531; //m_nSkyTopRed[45]
|
||||
uchar* m_nSkyTopRed = (uchar*)0x55F531; //m_nSkyTopRed[45]
|
||||
|
||||
uchar* m_nAmbientBlue_Obj = (uchar*)0x55F51E; //m_nAmbientBlue_Obj[184]
|
||||
uchar* m_nAmbientBlue_Obj = (uchar*)0x55F51E; //m_nAmbientBlue_Obj[184]
|
||||
|
||||
uchar* m_nAmbientGreen_Obj = (uchar*)0x55F50C; //m_nAmbientGreen_Obj[184]
|
||||
uchar* m_nAmbientGreen_Obj = (uchar*)0x55F50C; //m_nAmbientGreen_Obj[184]
|
||||
|
||||
uchar* m_nAmbientRed_Obj = (uchar*)0x55F4FA; //m_nAmbientRed_Obj[184]
|
||||
uchar* m_nAmbientRed_Obj = (uchar*)0x55F4FA; //m_nAmbientRed_Obj[184]
|
||||
|
||||
uchar* m_nAmbientBlue = (uchar*)0x55F4E8; //m_nAmbientBlue[184]
|
||||
uchar* m_nAmbientBlue = (uchar*)0x55F4E8; //m_nAmbientBlue[184]
|
||||
|
||||
uchar* m_nAmbientGreen = (uchar*)0x55F4D6; //m_nAmbientGreen[184]
|
||||
uchar* m_nAmbientGreen = (uchar*)0x55F4D6; //m_nAmbientGreen[184]
|
||||
|
||||
uchar* m_nAmbientRed = (uchar*)0x560C61; //m_nAmbientRed[184]
|
||||
uchar* m_nAmbientRed = (uchar*)0x560C61; //m_nAmbientRed[184]
|
||||
|
192
CheatMenu/Ui.cpp
192
CheatMenu/Ui.cpp
@ -73,7 +73,6 @@ void Ui::CenterdText(const std::string& text)
|
||||
|
||||
void Ui::DrawHeaders(CallbackTable& data)
|
||||
{
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 0));
|
||||
|
||||
short i = 1;
|
||||
@ -84,7 +83,7 @@ void Ui::DrawHeaders(CallbackTable& data)
|
||||
{
|
||||
const char* btn_text = it->first.c_str();
|
||||
|
||||
if (btn_text == Globals::header_id)
|
||||
if (btn_text == Globals::m_HeaderId)
|
||||
{
|
||||
colors[ImGuiCol_Button] = colors[ImGuiCol_ButtonActive];
|
||||
func = it->second;
|
||||
@ -93,8 +92,8 @@ void Ui::DrawHeaders(CallbackTable& data)
|
||||
|
||||
if (ImGui::Button(btn_text, GetSize(3, false)))
|
||||
{
|
||||
Globals::header_id = btn_text;
|
||||
config.SetValue("window.id", Globals::header_id);
|
||||
Globals::m_HeaderId = btn_text;
|
||||
config.SetValue("window.id", Globals::m_HeaderId);
|
||||
func = it->second;
|
||||
}
|
||||
|
||||
@ -107,35 +106,35 @@ void Ui::DrawHeaders(CallbackTable& data)
|
||||
ImGui::PopStyleVar();
|
||||
ImGui::Dummy(ImVec2(0, 10));
|
||||
|
||||
if (Globals::header_id == "")
|
||||
if (Globals::m_HeaderId == "")
|
||||
{
|
||||
// Show Welcome page
|
||||
ImGui::NewLine();
|
||||
|
||||
Ui::CenterdText("Welcome to Cheat Menu");
|
||||
Ui::CenterdText("Author: Grinch_");
|
||||
CenterdText("Welcome to Cheat Menu");
|
||||
CenterdText("Author: Grinch_");
|
||||
|
||||
ImGui::NewLine();
|
||||
ImGui::TextWrapped("Please ensure you have the latest version from GitHub.");
|
||||
ImGui::NewLine();
|
||||
if (ImGui::Button("Discord server", ImVec2(Ui::GetSize(2))))
|
||||
ShellExecute(NULL, "open", DISCORD_INVITE, NULL, NULL, SW_SHOWNORMAL);
|
||||
if (ImGui::Button("Discord server", ImVec2(GetSize(2))))
|
||||
ShellExecute(nullptr, "open", DISCORD_INVITE, nullptr, nullptr, SW_SHOWNORMAL);
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
if (ImGui::Button("GitHub repo", ImVec2(Ui::GetSize(2))))
|
||||
ShellExecute(NULL, "open", GITHUB_LINK, NULL, NULL, SW_SHOWNORMAL);
|
||||
if (ImGui::Button("GitHub repo", ImVec2(GetSize(2))))
|
||||
ShellExecute(nullptr, "open", GITHUB_LINK, nullptr, nullptr, SW_SHOWNORMAL);
|
||||
|
||||
ImGui::NewLine();
|
||||
ImGui::TextWrapped("If you find bugs or have suggestions, you can let me know on discord :)");
|
||||
ImGui::NewLine();
|
||||
Ui::CenterdText("Copyright GPLv3 2019-2021");
|
||||
CenterdText("Copyright GPLv3 2019-2021");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (func != nullptr && ImGui::BeginChild("TABSBAR"))
|
||||
{
|
||||
((void(*)(void))func)();
|
||||
static_cast<void(*)()>(func)();
|
||||
ImGui::EndChild();
|
||||
}
|
||||
}
|
||||
@ -159,7 +158,7 @@ bool Ui::CheckboxWithHint(const char* label, bool* v, const char* hint, bool is_
|
||||
// set things up
|
||||
bool pressed = false;
|
||||
const ImGuiStyle& style = ImGui::GetStyle();
|
||||
const ImVec2 text_size = ImGui::CalcTextSize(label, NULL, true);
|
||||
const ImVec2 text_size = ImGui::CalcTextSize(label, nullptr, true);
|
||||
float square_sz = ImGui::GetFrameHeight();
|
||||
ImDrawList* drawlist = ImGui::GetWindowDrawList();
|
||||
ImU32 color = ImGui::GetColorU32(ImGuiCol_FrameBg);
|
||||
@ -183,17 +182,18 @@ bool Ui::CheckboxWithHint(const char* label, bool* v, const char* hint, bool is_
|
||||
ImVec2 max = ImGui::GetItemRectMax();
|
||||
drawlist->AddRectFilled(min, max, color);
|
||||
|
||||
int pad = int(square_sz / 6.0);
|
||||
int pad = static_cast<int>(square_sz / 6.0);
|
||||
pad = (pad < 1) ? 1 : pad;
|
||||
|
||||
if (*v)
|
||||
{ // draw the checkmark
|
||||
{
|
||||
// draw the checkmark
|
||||
float sz = (square_sz - pad * 2.0);
|
||||
float thickness = sz / 5.0;
|
||||
thickness = (thickness < 1.0) ? 1.0 : thickness;
|
||||
sz = sz - thickness * 0.5;
|
||||
|
||||
ImVec2 pos = ImVec2(min.x + pad, min.y + pad);
|
||||
auto pos = ImVec2(min.x + pad, min.y + pad);
|
||||
pos.x = pos.x + thickness * 0.25;
|
||||
pos.y = pos.y + thickness * 0.25;
|
||||
|
||||
@ -209,7 +209,7 @@ bool Ui::CheckboxWithHint(const char* label, bool* v, const char* hint, bool is_
|
||||
|
||||
// draw label
|
||||
ImGui::SameLine(0, style.ItemInnerSpacing.x);
|
||||
if (ImGui::InvisibleButton(label, ImVec2(ImGui::CalcTextSize(label, NULL, true).x, square_sz)) && !is_disabled)
|
||||
if (ImGui::InvisibleButton(label, ImVec2(ImGui::CalcTextSize(label, nullptr, true).x, square_sz)) && !is_disabled)
|
||||
{
|
||||
pressed = true;
|
||||
*v = !*v;
|
||||
@ -221,9 +221,10 @@ bool Ui::CheckboxWithHint(const char* label, bool* v, const char* hint, bool is_
|
||||
if (hint != nullptr)
|
||||
{
|
||||
ImGui::SameLine(0, style.ItemInnerSpacing.x);
|
||||
ImGui::InvisibleButton("?", ImGui::CalcTextSize("?", NULL, true));
|
||||
ImGui::InvisibleButton("?", ImGui::CalcTextSize("?", nullptr, true));
|
||||
min = ImGui::GetItemRectMin();
|
||||
drawlist->AddText(ImVec2(min.x, min.y + style.ItemInnerSpacing.y), ImGui::GetColorU32(ImGuiCol_TextDisabled), "?");
|
||||
drawlist->AddText(ImVec2(min.x, min.y + style.ItemInnerSpacing.y), ImGui::GetColorU32(ImGuiCol_TextDisabled),
|
||||
"?");
|
||||
|
||||
if (ImGui::IsItemHovered() && !is_disabled)
|
||||
{
|
||||
@ -290,7 +291,8 @@ bool Ui::CheckboxAddressVar(const char* label, bool val, int addr, const char* h
|
||||
return rtn;
|
||||
}
|
||||
|
||||
bool Ui::CheckboxAddressVarEx(const char* label, bool val, int addr, int enabled_val, int disabled_val, const char* hint)
|
||||
bool Ui::CheckboxAddressVarEx(const char* label, bool val, int addr, int enabled_val, int disabled_val,
|
||||
const char* hint)
|
||||
{
|
||||
bool rtn = false;
|
||||
bool state = val;
|
||||
@ -320,7 +322,10 @@ bool Ui::CheckboxBitFlag(const char* label, uint flag, const char* hint)
|
||||
return rtn;
|
||||
}
|
||||
|
||||
void Ui::DrawJSON(CJson& json, std::vector<std::string>& combo_items, std::string& selected_item, ImGuiTextFilter& filter, std::function<void(std::string&, std::string&, std::string&)> func_left_click, std::function<void(std::string&, std::string&, std::string&)> func_right_click)
|
||||
void Ui::DrawJSON(CJson& json, std::vector<std::string>& combo_items, std::string& selected_item,
|
||||
ImGuiTextFilter& filter,
|
||||
std::function<void(std::string&, std::string&, std::string&)> func_left_click,
|
||||
std::function<void(std::string&, std::string&, std::string&)> func_right_click)
|
||||
{
|
||||
ImGui::PushItemWidth(ImGui::GetContentRegionAvailWidth() / 2 - 5);
|
||||
ListBoxStr("##Categories", combo_items, selected_item);
|
||||
@ -343,17 +348,16 @@ void Ui::DrawJSON(CJson& json, std::vector<std::string>& combo_items, std::strin
|
||||
ImGui::Spacing();
|
||||
|
||||
if (ImGui::IsMouseClicked(1))
|
||||
json_popup.function = nullptr;
|
||||
jsonPopup.function = nullptr;
|
||||
|
||||
|
||||
ImGui::BeginChild(1);
|
||||
for (auto root : json.data.items())
|
||||
for (auto root : json.m_Data.items())
|
||||
{
|
||||
if (root.key() == selected_item || selected_item == "All")
|
||||
{
|
||||
for (auto _data : root.value().items())
|
||||
{
|
||||
|
||||
std::string name = _data.key();
|
||||
if (filter.PassFilter(name.c_str()))
|
||||
{
|
||||
@ -368,28 +372,28 @@ void Ui::DrawJSON(CJson& json, std::vector<std::string>& combo_items, std::strin
|
||||
|
||||
if (ImGui::IsItemClicked(1) && func_right_click != nullptr)
|
||||
{
|
||||
json_popup.function = func_right_click;
|
||||
json_popup.root_key = root.key();
|
||||
json_popup.key = name;
|
||||
json_popup.value = _data.value();
|
||||
jsonPopup.function = func_right_click;
|
||||
jsonPopup.rootKey = root.key();
|
||||
jsonPopup.key = name;
|
||||
jsonPopup.value = _data.value();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (json_popup.function != nullptr)
|
||||
if (jsonPopup.function != nullptr)
|
||||
{
|
||||
if (ImGui::BeginPopupContextWindow())
|
||||
{
|
||||
ImGui::Text(json_popup.key.c_str());
|
||||
ImGui::Text(jsonPopup.key.c_str());
|
||||
ImGui::Separator();
|
||||
if (ImGui::MenuItem("Remove"))
|
||||
json_popup.function(json_popup.root_key, json_popup.key, json_popup.value);
|
||||
jsonPopup.function(jsonPopup.rootKey, jsonPopup.key, jsonPopup.value);
|
||||
|
||||
|
||||
if (ImGui::MenuItem("Close"))
|
||||
json_popup.function = nullptr;
|
||||
jsonPopup.function = nullptr;
|
||||
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
@ -404,7 +408,7 @@ void Ui::EditStat(const char* label, const int stat_id, const int min, const int
|
||||
{
|
||||
int val = static_cast<int>(CStats::GetStatValue(stat_id));
|
||||
|
||||
ImGui::Columns(3, 0, false);
|
||||
ImGui::Columns(3, nullptr, false);
|
||||
ImGui::Text("Min: %d", min);
|
||||
ImGui::NextColumn();
|
||||
ImGui::Text("Def: %d", def);
|
||||
@ -419,17 +423,17 @@ void Ui::EditStat(const char* label, const int stat_id, const int min, const int
|
||||
|
||||
ImGui::Spacing();
|
||||
|
||||
if (ImGui::Button(("Minimum##" + std::string(label)).c_str(), Ui::GetSize(3)))
|
||||
if (ImGui::Button(("Minimum##" + std::string(label)).c_str(), GetSize(3)))
|
||||
CStats::SetStatValue(stat_id, static_cast<float>(min));
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
if (ImGui::Button(("Default##" + std::string(label)).c_str(), Ui::GetSize(3)))
|
||||
if (ImGui::Button(("Default##" + std::string(label)).c_str(), GetSize(3)))
|
||||
CStats::SetStatValue(stat_id, static_cast<float>(def));
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
if (ImGui::Button(("Maximum##" + std::string(label)).c_str(), Ui::GetSize(3)))
|
||||
if (ImGui::Button(("Maximum##" + std::string(label)).c_str(), GetSize(3)))
|
||||
CStats::SetStatValue(stat_id, static_cast<float>(max));
|
||||
|
||||
ImGui::Spacing();
|
||||
@ -454,25 +458,26 @@ void Ui::FilterWithHint(const char* label, ImGuiTextFilter& filter, const char*
|
||||
}
|
||||
|
||||
// clean up the code someday
|
||||
void Ui::DrawImages(std::vector<std::unique_ptr<TextureStructure>>& img_vec, ImVec2 image_size,
|
||||
std::vector<std::string>& category_vec, std::string& selected_item, ImGuiTextFilter& filter,
|
||||
std::function<void(std::string&)> on_left_click, std::function<void(std::string&)> on_right_click,
|
||||
std::function<std::string(std::string&)> get_name_func, std::function<bool(std::string&)> verify_func)
|
||||
void Ui::DrawImages(std::vector<std::unique_ptr<STextureStructure>>& img_vec, ImVec2 image_size,
|
||||
std::vector<std::string>& category_vec, std::string& selected_item, ImGuiTextFilter& filter,
|
||||
std::function<void(std::string&)> on_left_click, std::function<void(std::string&)> on_right_click,
|
||||
std::function<std::string(std::string&)> get_name_func,
|
||||
std::function<bool(std::string&)> verify_func)
|
||||
{
|
||||
|
||||
// scale image size
|
||||
image_size.x *= screen::GetScreenWidth() / 1366.0f;
|
||||
image_size.y *= screen::GetScreenHeight() / 768.0f;
|
||||
|
||||
int images_in_row = static_cast<int>(ImGui::GetWindowContentRegionWidth() / image_size.x);
|
||||
image_size.x = ImGui::GetWindowContentRegionWidth() / images_in_row - int(ImGuiStyleVar_ItemSpacing) * 0.65f;
|
||||
image_size.x = ImGui::GetWindowContentRegionWidth() / images_in_row - static_cast<int>(ImGuiStyleVar_ItemSpacing) *
|
||||
0.65f;
|
||||
|
||||
int images_count = 1;
|
||||
|
||||
ImGui::Spacing();
|
||||
|
||||
if (ImGui::IsMouseClicked(1))
|
||||
img_popup.function = nullptr;
|
||||
imgPopup.function = nullptr;
|
||||
|
||||
ImGui::PushItemWidth(ImGui::GetContentRegionAvailWidth() / 2 - 5);
|
||||
ListBoxStr("##Categories", category_vec, selected_item);
|
||||
@ -484,21 +489,22 @@ void Ui::DrawImages(std::vector<std::unique_ptr<TextureStructure>>& img_vec, ImV
|
||||
ImGui::BeginChild("DrawImages");
|
||||
for (uint i = 0; i < img_vec.size(); i++)
|
||||
{
|
||||
std::string text = img_vec[i]->file_name;
|
||||
std::string text = img_vec[i]->m_FileName;
|
||||
std::string model_name = get_name_func(text);
|
||||
|
||||
if (filter.PassFilter(model_name.c_str())
|
||||
&& (img_vec[i]->category_name == selected_item || selected_item == "All")
|
||||
&& (img_vec[i]->m_CategoryName == selected_item || selected_item == "All")
|
||||
&& (verify_func == nullptr || verify_func(text))
|
||||
)
|
||||
)
|
||||
{
|
||||
if (ImGui::ImageButton(img_vec[i]->texture, image_size, ImVec2(0, 0), ImVec2(1, 1), 1, ImVec4(1, 1, 1, 1), ImVec4(1, 1, 1, 1)))
|
||||
if (ImGui::ImageButton(img_vec[i]->m_pTexture, image_size, ImVec2(0, 0), ImVec2(1, 1), 1, ImVec4(1, 1, 1, 1),
|
||||
ImVec4(1, 1, 1, 1)))
|
||||
on_left_click(text);
|
||||
|
||||
if (ImGui::IsItemClicked(1) && on_right_click != nullptr)
|
||||
{
|
||||
img_popup.function = on_right_click;
|
||||
img_popup.value = model_name;
|
||||
imgPopup.function = on_right_click;
|
||||
imgPopup.value = model_name;
|
||||
}
|
||||
|
||||
if (ImGui::IsItemHovered())
|
||||
@ -514,7 +520,8 @@ void Ui::DrawImages(std::vector<std::unique_ptr<TextureStructure>>& img_vec, ImV
|
||||
if (text_size.x < image_size.x)
|
||||
{
|
||||
float offsetX = (ImGui::GetItemRectSize().x - text_size.x) / 2;
|
||||
drawlist->AddText(ImVec2(btn_min.x + offsetX, btn_min.y + 10), ImGui::GetColorU32(ImGuiCol_Text), model_name.c_str());
|
||||
drawlist->AddText(ImVec2(btn_min.x + offsetX, btn_min.y + 10), ImGui::GetColorU32(ImGuiCol_Text),
|
||||
model_name.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -527,10 +534,10 @@ void Ui::DrawImages(std::vector<std::unique_ptr<TextureStructure>>& img_vec, ImV
|
||||
{
|
||||
text_size = ImGui::CalcTextSize(buff.c_str());
|
||||
float offsetX = (ImGui::GetItemRectSize().x - text_size.x) / 2;
|
||||
drawlist->AddText(ImVec2(btn_min.x + offsetX, btn_min.y + 10 * count), ImGui::GetColorU32(ImGuiCol_Text), buff.c_str());
|
||||
drawlist->AddText(ImVec2(btn_min.x + offsetX, btn_min.y + 10 * count),
|
||||
ImGui::GetColorU32(ImGuiCol_Text), buff.c_str());
|
||||
++count;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -541,18 +548,18 @@ void Ui::DrawImages(std::vector<std::unique_ptr<TextureStructure>>& img_vec, ImV
|
||||
}
|
||||
}
|
||||
|
||||
if (img_popup.function != nullptr)
|
||||
if (imgPopup.function != nullptr)
|
||||
{
|
||||
if (ImGui::BeginPopupContextWindow())
|
||||
{
|
||||
ImGui::Text(img_popup.value.c_str());
|
||||
ImGui::Text(imgPopup.value.c_str());
|
||||
ImGui::Separator();
|
||||
if (ImGui::MenuItem("Remove"))
|
||||
img_popup.function(img_popup.value);
|
||||
imgPopup.function(imgPopup.value);
|
||||
|
||||
|
||||
if (ImGui::MenuItem("Close"))
|
||||
img_popup.function = nullptr;
|
||||
imgPopup.function = nullptr;
|
||||
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
@ -565,7 +572,7 @@ void Ui::RadioButtonAddress(const char* label, std::vector<NamedMemory>& named_m
|
||||
size_t btn_in_column = named_mem.size() / 2 - 1;
|
||||
|
||||
ImGui::Text(label);
|
||||
ImGui::Columns(2, 0, false);
|
||||
ImGui::Columns(2, nullptr, false);
|
||||
|
||||
bool state = true;
|
||||
|
||||
@ -604,7 +611,7 @@ void Ui::RadioButtonAddressEx(const char* label, int addr, std::vector<NamedValu
|
||||
size_t btn_in_column = named_val.size() / 2;
|
||||
|
||||
ImGui::Text(label);
|
||||
ImGui::Columns(2, 0, false);
|
||||
ImGui::Columns(2, nullptr, false);
|
||||
|
||||
int mem_val = 0;
|
||||
patch::GetRaw(addr, &mem_val, 1, false);
|
||||
@ -671,7 +678,7 @@ void Ui::ColorPickerAddress(const char* label, int base_addr, ImVec4&& default_c
|
||||
}
|
||||
ImGui::Spacing();
|
||||
|
||||
if (ImGui::Button("Reset to default", Ui::GetSize()))
|
||||
if (ImGui::Button("Reset to default", GetSize()))
|
||||
{
|
||||
patch::Set<BYTE>(base_addr, default_color.x, false);
|
||||
patch::Set<BYTE>(base_addr + 1, default_color.y, false);
|
||||
@ -686,16 +693,16 @@ void Ui::ColorPickerAddress(const char* label, int base_addr, ImVec4&& default_c
|
||||
|
||||
void Ui::EditBits(const char* label, const int address, const std::vector<std::string>& names)
|
||||
{
|
||||
int* mem_val = (int*)address;
|
||||
auto mem_val = (int*)address;
|
||||
|
||||
if (ImGui::CollapsingHeader(label))
|
||||
{
|
||||
ImGui::Columns(2, NULL, false);
|
||||
ImGui::Columns(2, nullptr, false);
|
||||
|
||||
for (int i = 0; i < 32; ++i)
|
||||
{
|
||||
int mask = 1 << i;
|
||||
bool state = static_cast<bool>(*mem_val & mask);
|
||||
bool state = *mem_val & mask;
|
||||
|
||||
if (ImGui::Checkbox(names[i].c_str(), &state))
|
||||
*mem_val ^= mask;
|
||||
@ -710,7 +717,8 @@ void Ui::EditBits(const char* label, const int address, const std::vector<std::s
|
||||
}
|
||||
}
|
||||
|
||||
void Ui::EditFloat(const char* label, const int address, const float min, const float def, const float max, const float mul)
|
||||
void Ui::EditFloat(const char* label, const int address, const float min, const float def, const float max,
|
||||
const float mul)
|
||||
{
|
||||
if (ImGui::CollapsingHeader(label))
|
||||
{
|
||||
@ -721,7 +729,7 @@ void Ui::EditFloat(const char* label, const int address, const float min, const
|
||||
if (min == def)
|
||||
items = 2;
|
||||
|
||||
ImGui::Columns(items, 0, false);
|
||||
ImGui::Columns(items, nullptr, false);
|
||||
|
||||
ImGui::Text("Min: %f", min);
|
||||
|
||||
@ -760,20 +768,20 @@ void Ui::EditFloat(const char* label, const int address, const float min, const
|
||||
|
||||
ImGui::Spacing();
|
||||
|
||||
if (ImGui::Button(("Minimum##" + std::string(label)).c_str(), Ui::GetSize(items)))
|
||||
if (ImGui::Button(("Minimum##" + std::string(label)).c_str(), GetSize(items)))
|
||||
patch::Set<float>(address, min / mul, false);
|
||||
|
||||
if (items == 3)
|
||||
{
|
||||
ImGui::SameLine();
|
||||
|
||||
if (ImGui::Button(("Default##" + std::string(label)).c_str(), Ui::GetSize(items)))
|
||||
if (ImGui::Button(("Default##" + std::string(label)).c_str(), GetSize(items)))
|
||||
patch::Set<float>(address, def / mul, false);
|
||||
}
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
if (ImGui::Button(("Maximum##" + std::string(label)).c_str(), Ui::GetSize(items)))
|
||||
if (ImGui::Button(("Maximum##" + std::string(label)).c_str(), GetSize(items)))
|
||||
patch::Set<float>(address, max / mul, false);
|
||||
|
||||
ImGui::Spacing();
|
||||
@ -783,7 +791,7 @@ void Ui::EditFloat(const char* label, const int address, const float min, const
|
||||
|
||||
bool Ui::HotKey(const char* label, HotKeyData& key_data)
|
||||
{
|
||||
bool active = current_hotkey == label;
|
||||
bool active = m_CurrentHotkey == label;
|
||||
bool state = false;
|
||||
|
||||
if (active)
|
||||
@ -795,7 +803,7 @@ bool Ui::HotKey(const char* label, HotKeyData& key_data)
|
||||
{
|
||||
if (KeyPressed(key))
|
||||
{
|
||||
key_data.key1 = key;
|
||||
key_data.m_key1 = key;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -804,7 +812,7 @@ bool Ui::HotKey(const char* label, HotKeyData& key_data)
|
||||
{
|
||||
if (KeyPressed(key))
|
||||
{
|
||||
key_data.key2 = key;
|
||||
key_data.m_key2 = key;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -813,21 +821,22 @@ bool Ui::HotKey(const char* label, HotKeyData& key_data)
|
||||
|
||||
std::string text;
|
||||
|
||||
if (key_data.key1 != VK_NONE)
|
||||
text = key_names[key_data.key1 - 1];
|
||||
if (key_data.m_key1 != VK_NONE)
|
||||
text = key_names[key_data.m_key1 - 1];
|
||||
else
|
||||
text = "None";
|
||||
|
||||
if (key_data.key1 != key_data.key2)
|
||||
text += (" + " + key_names[key_data.key2 - 1]);
|
||||
if (key_data.m_key1 != key_data.m_key2)
|
||||
text += (" + " + key_names[key_data.m_key2 - 1]);
|
||||
|
||||
if (ImGui::Button((text + std::string("##") + std::string(label)).c_str(), ImVec2(ImGui::GetWindowContentRegionWidth() / 3.5, ImGui::GetFrameHeight())))
|
||||
if (ImGui::Button((text + std::string("##") + std::string(label)).c_str(),
|
||||
ImVec2(ImGui::GetWindowContentRegionWidth() / 3.5, ImGui::GetFrameHeight())))
|
||||
if (!active)
|
||||
current_hotkey = label;
|
||||
m_CurrentHotkey = label;
|
||||
|
||||
if (active && ImGui::IsMouseClicked(ImGuiMouseButton_Left))
|
||||
{
|
||||
current_hotkey = "";
|
||||
m_CurrentHotkey = "";
|
||||
state = true;
|
||||
}
|
||||
|
||||
@ -835,11 +844,11 @@ bool Ui::HotKey(const char* label, HotKeyData& key_data)
|
||||
{
|
||||
if (ImGui::IsItemHovered())
|
||||
{
|
||||
key_data.key1 = VK_NONE;
|
||||
key_data.key2 = VK_NONE;
|
||||
key_data.m_key1 = VK_NONE;
|
||||
key_data.m_key2 = VK_NONE;
|
||||
}
|
||||
else
|
||||
current_hotkey = "";
|
||||
m_CurrentHotkey = "";
|
||||
|
||||
state = true;
|
||||
}
|
||||
@ -855,14 +864,14 @@ bool Ui::HotKey(const char* label, HotKeyData& key_data)
|
||||
|
||||
bool Ui::HotKeyPressed(HotKeyData& hotkey)
|
||||
{
|
||||
if (KeyPressed(hotkey.key1) && KeyPressed(hotkey.key2))
|
||||
hotkey.is_down = true;
|
||||
if (KeyPressed(hotkey.m_key1) && KeyPressed(hotkey.m_key2))
|
||||
hotkey.m_bPressed = true;
|
||||
else
|
||||
{
|
||||
if (hotkey.is_down)
|
||||
if (hotkey.m_bPressed)
|
||||
{
|
||||
hotkey.is_down = false;
|
||||
return current_hotkey == "";
|
||||
hotkey.m_bPressed = false;
|
||||
return m_CurrentHotkey == "";
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@ -872,13 +881,13 @@ std::string Ui::GetHotKeyNameString(HotKeyData& hotkey)
|
||||
{
|
||||
std::string text;
|
||||
|
||||
if (hotkey.key1 != VK_NONE)
|
||||
text = key_names[hotkey.key1 - 1];
|
||||
if (hotkey.m_key1 != VK_NONE)
|
||||
text = key_names[hotkey.m_key1 - 1];
|
||||
else
|
||||
text = "None";
|
||||
|
||||
if (hotkey.key1 != hotkey.key2)
|
||||
text += (" + " + key_names[hotkey.key2 - 1]);
|
||||
if (hotkey.m_key1 != hotkey.m_key2)
|
||||
text += (" + " + key_names[hotkey.m_key2 - 1]);
|
||||
|
||||
return text;
|
||||
}
|
||||
@ -894,7 +903,8 @@ bool Ui::ColorButton(int color_id, std::vector<float>& color, ImVec2 size)
|
||||
if (ImGui::IsItemHovered())
|
||||
{
|
||||
ImDrawList* drawlist = ImGui::GetWindowDrawList();
|
||||
drawlist->AddRectFilled(ImGui::GetItemRectMin(), ImGui::GetItemRectMax(), ImGui::GetColorU32(ImGuiCol_ModalWindowDimBg));
|
||||
drawlist->AddRectFilled(ImGui::GetItemRectMin(), ImGui::GetItemRectMax(),
|
||||
ImGui::GetColorU32(ImGuiCol_ModalWindowDimBg));
|
||||
}
|
||||
|
||||
return rtn;
|
||||
|
@ -3,17 +3,18 @@
|
||||
|
||||
class Ui
|
||||
{
|
||||
|
||||
private:
|
||||
inline static std::string current_hotkey = "";
|
||||
inline static std::string m_CurrentHotkey;
|
||||
|
||||
public:
|
||||
struct NamedMemory {
|
||||
struct NamedMemory
|
||||
{
|
||||
std::string name;
|
||||
int addr;
|
||||
};
|
||||
|
||||
struct NamedValue {
|
||||
struct NamedValue
|
||||
{
|
||||
std::string name;
|
||||
int value;
|
||||
};
|
||||
@ -22,7 +23,7 @@ public:
|
||||
{
|
||||
std::function<void(std::string&, std::string&, std::string&)> function;
|
||||
std::string key;
|
||||
std::string root_key;
|
||||
std::string rootKey;
|
||||
std::string value;
|
||||
};
|
||||
|
||||
@ -31,35 +32,42 @@ public:
|
||||
std::function<void(std::string&)> function;
|
||||
std::string value;
|
||||
};
|
||||
inline static JsonPopUpData json_popup;
|
||||
inline static ImgPopUpData img_popup;
|
||||
|
||||
inline static JsonPopUpData jsonPopup;
|
||||
inline static ImgPopUpData imgPopup;
|
||||
|
||||
static void CenterdText(const std::string& text);
|
||||
static bool ColorButton(int color_id, std::vector<float>& color, ImVec2 size);
|
||||
static bool CheckboxAddress(const char* label, const int addr = NULL, const char* hint = nullptr);
|
||||
static bool CheckboxAddressEx(const char* label, const int addr = NULL, int enabled_val = 1, int disabled_val = 0, const char* hint = nullptr);
|
||||
static bool CheckboxAddress(const char* label, int addr = NULL, const char* hint = nullptr);
|
||||
static bool CheckboxAddressEx(const char* label, int addr = NULL, int enabled_val = 1, int disabled_val = 0,
|
||||
const char* hint = nullptr);
|
||||
static bool CheckboxAddressVar(const char* label, bool val, int addr, const char* hint = nullptr);
|
||||
static bool CheckboxAddressVarEx(const char* label, bool val, int addr, int enabled_val, int disabled_val, const char* hint = nullptr);
|
||||
static bool CheckboxAddressVarEx(const char* label, bool val, int addr, int enabled_val, int disabled_val,
|
||||
const char* hint = nullptr);
|
||||
static bool CheckboxBitFlag(const char* label, uint flag, const char* hint = nullptr);
|
||||
static bool CheckboxWithHint(const char* label, bool* state, const char* hint = nullptr, const bool is_disabled = false);
|
||||
static bool CheckboxWithHint(const char* label, bool* state, const char* hint = nullptr, bool is_disabled = false);
|
||||
static void DrawHeaders(CallbackTable& data);
|
||||
|
||||
static void DrawJSON(CJson& json, std::vector<std::string>& combo_items, std::string& selected_item, ImGuiTextFilter& filter,
|
||||
std::function<void(std::string&, std::string&, std::string&)> func_left_click, std::function<void(std::string&, std::string&, std::string&)> func_right_click);
|
||||
static void DrawImages(std::vector<std::unique_ptr<TextureStructure>>& img_vec, ImVec2 image_size,
|
||||
std::vector<std::string>& category_vec, std::string& selected_item, ImGuiTextFilter& filter,
|
||||
std::function<void(std::string&)> on_left_click, std::function<void(std::string&)> on_right_click,
|
||||
std::function<std::string(std::string&)> get_name_func, std::function<bool(std::string&)> verify_func = nullptr);
|
||||
static void DrawJSON(CJson& json, std::vector<std::string>& combo_items, std::string& selected_item,
|
||||
ImGuiTextFilter& filter,
|
||||
std::function<void(std::string&, std::string&, std::string&)> func_left_click,
|
||||
std::function<void(std::string&, std::string&, std::string&)> func_right_click);
|
||||
static void DrawImages(std::vector<std::unique_ptr<STextureStructure>>& img_vec, ImVec2 image_size,
|
||||
std::vector<std::string>& category_vec, std::string& selected_item, ImGuiTextFilter& filter,
|
||||
std::function<void(std::string&)> on_left_click,
|
||||
std::function<void(std::string&)> on_right_click,
|
||||
std::function<std::string(std::string&)> get_name_func,
|
||||
std::function<bool(std::string&)> verify_func = nullptr);
|
||||
|
||||
template <typename T>
|
||||
static void EditAddress(const char* label, const int address, const int min = 0, const int def = 0, const int max = 100);
|
||||
static void EditBits(const char* label, const int address, const std::vector<std::string>& names);
|
||||
static void EditFloat(const char* label, const int address, const float min, const float def, const float max, const float mul = 1);
|
||||
static void EditAddress(const char* label, int address, int min = 0, int def = 0, int max = 100);
|
||||
static void EditBits(const char* label, int address, const std::vector<std::string>& names);
|
||||
static void EditFloat(const char* label, int address, float min, float def, float max, float mul = 1);
|
||||
template <typename T>
|
||||
static void EditReference(const char* label, T& address, const int min = 0, const int def = 0, const int max = 100);
|
||||
static void EditReference(const char* label, T& address, int min = 0, int def = 0, int max = 100);
|
||||
static void EditRadioButtonAddress(const char* label, std::vector<NamedMemory>& named_mem);
|
||||
static void EditRadioButtonAddressEx(const char* label, int addr, std::vector<NamedValue>& named_val);
|
||||
static void EditStat(const char* label, const int stat_id, const int min = 0, const int def = 0, const int max = 1000);
|
||||
static void EditStat(const char* label, int stat_id, int min = 0, int def = 0, int max = 1000);
|
||||
|
||||
static void FilterWithHint(const char* label, ImGuiTextFilter& filter, const char* hint);
|
||||
|
||||
@ -84,14 +92,14 @@ void Ui::EditAddress(const char* label, const int address, const int min, const
|
||||
{
|
||||
if (ImGui::CollapsingHeader(label))
|
||||
{
|
||||
int val = patch::Get<T>(address, false);;
|
||||
int val = patch::Get<T>(address, false);
|
||||
|
||||
int items = 3;
|
||||
|
||||
if (min == def)
|
||||
items = 2;
|
||||
|
||||
ImGui::Columns(items, 0, false);
|
||||
ImGui::Columns(items, nullptr, false);
|
||||
ImGui::Text(("Min: " + std::to_string(min)).c_str());
|
||||
|
||||
if (items == 3)
|
||||
@ -117,20 +125,20 @@ void Ui::EditAddress(const char* label, const int address, const int min, const
|
||||
if (val > max)
|
||||
val = max;
|
||||
|
||||
if (ImGui::Button(("Minimum##" + std::string(label)).c_str(), Ui::GetSize(items)))
|
||||
if (ImGui::Button(("Minimum##" + std::string(label)).c_str(), GetSize(items)))
|
||||
patch::Set<T>(address, min, false);
|
||||
|
||||
if (items == 3)
|
||||
{
|
||||
ImGui::SameLine();
|
||||
|
||||
if (ImGui::Button(("Default##" + std::string(label)).c_str(), Ui::GetSize(3)))
|
||||
if (ImGui::Button(("Default##" + std::string(label)).c_str(), GetSize(3)))
|
||||
patch::Set<T>(address, def, false);
|
||||
}
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
if (ImGui::Button(("Maximum##" + std::string(label)).c_str(), Ui::GetSize(items)))
|
||||
if (ImGui::Button(("Maximum##" + std::string(label)).c_str(), GetSize(items)))
|
||||
patch::Set<T>(address, max, false);
|
||||
|
||||
ImGui::Spacing();
|
||||
@ -145,7 +153,7 @@ void Ui::EditReference(const char* label, T& address, const int min, const int d
|
||||
{
|
||||
int val = static_cast<int>(address);
|
||||
|
||||
ImGui::Columns(3, 0, false);
|
||||
ImGui::Columns(3, nullptr, false);
|
||||
ImGui::Text(("Min: " + std::to_string(min)).c_str());
|
||||
ImGui::NextColumn();
|
||||
ImGui::Text(("Def: " + std::to_string(def)).c_str());
|
||||
@ -160,20 +168,20 @@ void Ui::EditReference(const char* label, T& address, const int min, const int d
|
||||
|
||||
ImGui::Spacing();
|
||||
|
||||
if (ImGui::Button(("Minimum##" + std::string(label)).c_str(), Ui::GetSize(3)))
|
||||
if (ImGui::Button(("Minimum##" + std::string(label)).c_str(), GetSize(3)))
|
||||
address = static_cast<float>(min);
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
if (ImGui::Button(("Default##" + std::string(label)).c_str(), Ui::GetSize(3)))
|
||||
if (ImGui::Button(("Default##" + std::string(label)).c_str(), GetSize(3)))
|
||||
address = static_cast<float>(def);
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
if (ImGui::Button(("Maximum##" + std::string(label)).c_str(), Ui::GetSize(3)))
|
||||
if (ImGui::Button(("Maximum##" + std::string(label)).c_str(), GetSize(3)))
|
||||
address = static_cast<float>(max);
|
||||
|
||||
ImGui::Spacing();
|
||||
ImGui::Separator();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,52 +5,65 @@
|
||||
|
||||
void Updater::CheckForUpdate()
|
||||
{
|
||||
const char* link = "https://api.github.com/repos/user-grinch/Cheat-Menu/tags";
|
||||
char* path = PLUGIN_PATH((char*)"CheatMenu/json/versioninfo.json");
|
||||
HRESULT res = URLDownloadToFile(NULL, link, path, 0, NULL);
|
||||
const char* link = "https://api.github.com/repos/user-grinch/Cheat-Menu/tags";
|
||||
char* path = PLUGIN_PATH((char*)"CheatMenu/json/versioninfo.json");
|
||||
HRESULT res = URLDownloadToFile(NULL, link, path, 0, NULL);
|
||||
|
||||
if (res == E_OUTOFMEMORY || res == INET_E_DOWNLOAD_FAILURE)
|
||||
{
|
||||
CHud::SetHelpMessage("Failed to check for updates",false,false,false);
|
||||
return;
|
||||
}
|
||||
CJson verinfo = CJson("versioninfo");
|
||||
if (res == E_OUTOFMEMORY || res == INET_E_DOWNLOAD_FAILURE)
|
||||
{
|
||||
CHud::SetHelpMessage("Failed to check for updates", false, false, false);
|
||||
return;
|
||||
}
|
||||
CJson verinfo = CJson("versioninfo");
|
||||
|
||||
// fetch the version number
|
||||
latest_version = verinfo.data.items().begin().value()["name"].get<std::string>();
|
||||
// fetch the version number
|
||||
m_LatestVersion = verinfo.m_Data.items().begin().value()["name"].get<std::string>();
|
||||
|
||||
if (latest_version > MENU_VERSION_NUMBER)
|
||||
{
|
||||
CHud::SetHelpMessage("Update found",false,false,false);
|
||||
state = UPDATER_UPDATE_FOUND;
|
||||
}
|
||||
else
|
||||
{
|
||||
CHud::SetHelpMessage("No update found.",false,false,false);
|
||||
Updater::state = UPDATER_IDLE;
|
||||
}
|
||||
if (m_LatestVersion > MENU_VERSION_NUMBER)
|
||||
{
|
||||
CHud::SetHelpMessage("Update found", false, false, false);
|
||||
m_State = UPDATER_UPDATE_FOUND;
|
||||
}
|
||||
else
|
||||
{
|
||||
CHud::SetHelpMessage("No update found.", false, false, false);
|
||||
Updater::m_State = UPDATER_IDLE;
|
||||
}
|
||||
}
|
||||
|
||||
void Updater::ShowUpdateScreen()
|
||||
{
|
||||
ImGui::Dummy(ImVec2(0,20));
|
||||
Ui::CenterdText("A new version of the mod is available.");
|
||||
Ui::CenterdText(std::string("Current version: ") + MENU_VERSION);
|
||||
Ui::CenterdText("Latest version: " + Updater::latest_version);
|
||||
ImGui::Dummy(ImVec2(0,10));
|
||||
ImGui::TextWrapped("In order to keep using the menu, you need to update to the latest version."
|
||||
" This is to ensure everything is using the most up-to-date version.");
|
||||
ImGui::Dummy(ImVec2(0,10));
|
||||
ImGui::TextWrapped("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.");
|
||||
ImGui::Dummy(ImVec2(0, 20));
|
||||
Ui::CenterdText("A new version of the mod is available.");
|
||||
Ui::CenterdText(std::string("Current version: ") + MENU_VERSION);
|
||||
Ui::CenterdText("Latest version: " + Updater::m_LatestVersion);
|
||||
ImGui::Dummy(ImVec2(0, 10));
|
||||
ImGui::TextWrapped("In order to keep using the menu, you need to update to the latest version."
|
||||
" This is to ensure everything is using the most up-to-date version.");
|
||||
ImGui::Dummy(ImVec2(0, 10));
|
||||
ImGui::TextWrapped("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.");
|
||||
|
||||
ImGui::Dummy(ImVec2(0,5));
|
||||
if (ImGui::Button("Discord server", ImVec2(Ui::GetSize(2))))
|
||||
ImGui::Dummy(ImVec2(0, 5));
|
||||
if (ImGui::Button("Discord server", ImVec2(Ui::GetSize(3))))
|
||||
{
|
||||
ShellExecute(NULL, "open", DISCORD_INVITE, NULL, NULL, SW_SHOWNORMAL);
|
||||
}
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
if (ImGui::Button("Download page",Ui::GetSize(2)))
|
||||
ShellExecute(NULL, "open", std::string("https://github.com/user-grinch/Cheat-Menu/releases/tag/" +
|
||||
Updater::latest_version).c_str(), NULL, NULL, SW_SHOWNORMAL);
|
||||
}
|
||||
ImGui::SameLine();
|
||||
|
||||
if (ImGui::Button("Download page", Ui::GetSize(3)))
|
||||
{
|
||||
ShellExecute(NULL, "open", std::string("https://github.com/user-grinch/Cheat-Menu/releases/tag/" +
|
||||
Updater::m_LatestVersion).c_str(), NULL, NULL, SW_SHOWNORMAL);
|
||||
}
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
if (ImGui::Button("Hide page", Ui::GetSize(3)))
|
||||
{
|
||||
Updater::m_State = UPDATER_IDLE;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -3,17 +3,17 @@
|
||||
|
||||
enum UPDATER_STATE
|
||||
{
|
||||
UPDATER_IDLE,
|
||||
UPDATER_CHECKING,
|
||||
UPDATER_UPDATE_FOUND
|
||||
UPDATER_IDLE,
|
||||
UPDATER_CHECKING,
|
||||
UPDATER_UPDATE_FOUND
|
||||
};
|
||||
|
||||
class Updater
|
||||
class Updater
|
||||
{
|
||||
public:
|
||||
inline static UPDATER_STATE state = UPDATER_IDLE;
|
||||
inline static std::string latest_version = "";
|
||||
|
||||
static void CheckForUpdate();
|
||||
static void ShowUpdateScreen();
|
||||
inline static UPDATER_STATE m_State = UPDATER_IDLE;
|
||||
inline static std::string m_LatestVersion;
|
||||
|
||||
static void CheckForUpdate();
|
||||
static void ShowUpdateScreen();
|
||||
};
|
||||
|
@ -25,8 +25,8 @@ void Util::ClearCharTasksVehCheck(CPed* ped)
|
||||
}
|
||||
}
|
||||
|
||||
void Util::ReleaseTextures(std::vector<std::unique_ptr<TextureStructure>> &store_vec)
|
||||
{
|
||||
void Util::ReleaseTextures(std::vector<std::unique_ptr<STextureStructure>>& store_vec)
|
||||
{
|
||||
// for (auto &it : store_vec)
|
||||
// {
|
||||
// if (Globals::renderer == Render_DirectX9)
|
||||
@ -39,28 +39,32 @@ void Util::ReleaseTextures(std::vector<std::unique_ptr<TextureStructure>> &store
|
||||
// }
|
||||
}
|
||||
|
||||
void Util::LoadTexturesInDirRecursive(const char* path, const char* file_ext, std::vector<std::string>& category_vec, std::vector<std::unique_ptr<TextureStructure>>& store_vec)
|
||||
void Util::LoadTexturesInDirRecursive(const char* path, const char* file_ext, std::vector<std::string>& category_vec,
|
||||
std::vector<std::unique_ptr<STextureStructure>>& store_vec)
|
||||
{
|
||||
std::string folder = "";
|
||||
for (auto& p : fs::recursive_directory_iterator(path))
|
||||
{
|
||||
if (p.path().extension() == file_ext)
|
||||
{
|
||||
store_vec.push_back(std::make_unique<TextureStructure>());
|
||||
store_vec.push_back(std::make_unique<STextureStructure>());
|
||||
HRESULT hr = -1;
|
||||
|
||||
if (Globals::renderer == Render_DirectX9)
|
||||
hr = D3DXCreateTextureFromFileA(GetD3DDevice(), p.path().string().c_str(), reinterpret_cast<PDIRECT3DTEXTURE9*>(&store_vec.back().get()->texture));
|
||||
hr = D3DXCreateTextureFromFileA(GetD3DDevice(), p.path().string().c_str(),
|
||||
reinterpret_cast<PDIRECT3DTEXTURE9*>(&store_vec.back().get()->m_pTexture));
|
||||
else
|
||||
{
|
||||
if (LoadTextureFromFileDx11(p.path().string().c_str(), reinterpret_cast<ID3D11ShaderResourceView**>(&store_vec.back().get()->texture)))
|
||||
if (LoadTextureFromFileDx11(p.path().string().c_str(),
|
||||
reinterpret_cast<ID3D11ShaderResourceView**>(&store_vec.back().get()->
|
||||
m_pTexture)))
|
||||
hr = S_OK;
|
||||
}
|
||||
|
||||
if (hr == S_OK)
|
||||
{
|
||||
store_vec.back().get()->file_name = p.path().stem().string();
|
||||
store_vec.back().get()->category_name = folder;
|
||||
store_vec.back().get()->m_FileName = p.path().stem().string();
|
||||
store_vec.back().get()->m_CategoryName = folder;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -81,8 +85,8 @@ bool Util::LoadTextureFromFileDx11(const char* filename, ID3D11ShaderResourceVie
|
||||
// Load from disk into a raw RGBA buffer
|
||||
int image_width = 0;
|
||||
int image_height = 0;
|
||||
unsigned char* image_data = stbi_load(filename, &image_width, &image_height, NULL, 4);
|
||||
if (image_data == NULL)
|
||||
unsigned char* image_data = stbi_load(filename, &image_width, &image_height, nullptr, 4);
|
||||
if (image_data == nullptr)
|
||||
return false;
|
||||
|
||||
// Create texture
|
||||
@ -98,7 +102,7 @@ bool Util::LoadTextureFromFileDx11(const char* filename, ID3D11ShaderResourceVie
|
||||
desc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
|
||||
desc.CPUAccessFlags = 0;
|
||||
|
||||
ID3D11Texture2D* pTexture = NULL;
|
||||
ID3D11Texture2D* pTexture = nullptr;
|
||||
D3D11_SUBRESOURCE_DATA subResource;
|
||||
subResource.pSysMem = image_data;
|
||||
subResource.SysMemPitch = desc.Width * 4;
|
||||
@ -123,7 +127,8 @@ bool Util::LoadTextureFromFileDx11(const char* filename, ID3D11ShaderResourceVie
|
||||
|
||||
bool Util::IsOnMission()
|
||||
{
|
||||
return FindPlayerPed()->CanPlayerStartMission() && !*(patch::Get<char*>(0x5D5380, false) + CTheScripts::OnAMissionFlag);
|
||||
return FindPlayerPed()->CanPlayerStartMission() && !*(patch::Get<char*>(0x5D5380, false) +
|
||||
CTheScripts::OnAMissionFlag);
|
||||
}
|
||||
|
||||
bool Util::IsOnCutscene()
|
||||
@ -143,25 +148,23 @@ std::string Util::GetLocationName(CVector* pos)
|
||||
|
||||
switch (city)
|
||||
{
|
||||
case 0:
|
||||
town = "CS";
|
||||
break;
|
||||
case 1:
|
||||
town = "LS";
|
||||
break;
|
||||
case 2:
|
||||
town = "SF";
|
||||
break;
|
||||
case 3:
|
||||
town = "LV";
|
||||
break;
|
||||
case 0:
|
||||
town = "CS";
|
||||
break;
|
||||
case 1:
|
||||
town = "LS";
|
||||
break;
|
||||
case 2:
|
||||
town = "SF";
|
||||
break;
|
||||
case 3:
|
||||
town = "LV";
|
||||
break;
|
||||
}
|
||||
|
||||
if (interior == 0)
|
||||
return CTheZones::FindSmallestZoneForPosition(*pos, true)->GetTranslatedName() + std::string(", ") + town;
|
||||
else
|
||||
return std::string("Interior ") + std::to_string(interior) + ", " + town;
|
||||
|
||||
return std::string("Interior ") + std::to_string(interior) + ", " + town;
|
||||
}
|
||||
|
||||
int Util::GetLargestGangInZone()
|
||||
@ -171,7 +174,7 @@ int Util::GetLargestGangInZone()
|
||||
for (int i = 0; i != 10; ++i)
|
||||
{
|
||||
CVector pos = FindPlayerPed()->GetPosition();
|
||||
CZone* zone = new CZone();
|
||||
auto zone = new CZone();
|
||||
|
||||
CZoneExtraInfo* zone_info = CTheZones::GetZoneInfo(&pos, &zone);
|
||||
int density = zone_info->m_nGangDensity[i];
|
||||
@ -198,7 +201,7 @@ CVehicle* Util::GetClosestVehicle()
|
||||
CVehicle* veh = nullptr;
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
veh = (CVehicle*)pedintel->m_vehicleScanner.m_apEntities[i];
|
||||
veh = static_cast<CVehicle*>(pedintel->m_vehicleScanner.m_apEntities[i]);
|
||||
if (veh && !veh->m_nVehicleFlags.bFadeOut)
|
||||
break;
|
||||
veh = nullptr;
|
||||
@ -219,7 +222,7 @@ CPed* Util::GetClosestPed()
|
||||
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
ped = (CPed*)pedintel->m_pedScanner.m_apEntities[i];
|
||||
ped = static_cast<CPed*>(pedintel->m_pedScanner.m_apEntities[i]);
|
||||
if (ped && ped != player && (ped->m_nCreatedBy & 0xFF) == 1 && !ped->m_nPedFlags.bFadeOut)
|
||||
break;
|
||||
ped = nullptr;
|
||||
@ -261,7 +264,7 @@ RwTexture* Util::LoadTextureFromPngFile(fs::path path)
|
||||
|
||||
void Util::GetCPUUsageInit()
|
||||
{
|
||||
PdhOpenQuery(NULL, NULL, &cpuQuery);
|
||||
PdhOpenQuery(nullptr, NULL, &cpuQuery);
|
||||
PdhAddEnglishCounter(cpuQuery, "\\Processor(_Total)\\% Processor Time", NULL, &cpuTotal);
|
||||
PdhCollectQueryData(cpuQuery);
|
||||
}
|
||||
@ -271,6 +274,6 @@ double Util::GetCurrentCPUUsage()
|
||||
PDH_FMT_COUNTERVALUE counterVal;
|
||||
|
||||
PdhCollectQueryData(cpuQuery);
|
||||
PdhGetFormattedCounterValue(cpuTotal, PDH_FMT_DOUBLE, NULL, &counterVal);
|
||||
PdhGetFormattedCounterValue(cpuTotal, PDH_FMT_DOUBLE, nullptr, &counterVal);
|
||||
return counterVal.doubleValue;
|
||||
}
|
||||
}
|
||||
|
@ -15,17 +15,18 @@ private:
|
||||
|
||||
public:
|
||||
static void ClearCharTasksVehCheck(CPed* ped);
|
||||
static CPed *GetClosestPed();
|
||||
static CVehicle *GetClosestVehicle();
|
||||
static CPed* GetClosestPed();
|
||||
static CVehicle* GetClosestVehicle();
|
||||
static int GetLargestGangInZone();
|
||||
static void LoadTexturesInDirRecursive(const char * path, const char * file_ext, std::vector<std::string>& category_vec, std::vector<std::unique_ptr<TextureStructure>> &store_vec);
|
||||
static void ReleaseTextures(std::vector<std::unique_ptr<TextureStructure>> &store_vec);
|
||||
static void LoadTexturesInDirRecursive(const char* path, const char* file_ext,
|
||||
std::vector<std::string>& category_vec,
|
||||
std::vector<std::unique_ptr<STextureStructure>>& store_vec);
|
||||
static void ReleaseTextures(std::vector<std::unique_ptr<STextureStructure>>& store_vec);
|
||||
static bool IsOnCutscene();
|
||||
static bool IsOnMission();
|
||||
static std::string GetLocationName(CVector *pos);
|
||||
static void RainbowValues(int &r, int&g, int &b, float speed);
|
||||
static std::string GetLocationName(CVector* pos);
|
||||
static void RainbowValues(int& r, int& g, int& b, float speed);
|
||||
static RwTexture* LoadTextureFromPngFile(fs::path path);
|
||||
static void GetCPUUsageInit();
|
||||
static double GetCurrentCPUUsage();
|
||||
};
|
||||
|
||||
|
@ -1,41 +1,41 @@
|
||||
#pragma once
|
||||
|
||||
#define VK_NONE -1
|
||||
#define VK_KEY_0 0x30
|
||||
#define VK_KEY_1 0x31
|
||||
#define VK_KEY_2 0x32
|
||||
#define VK_KEY_3 0x33
|
||||
#define VK_KEY_4 0x34
|
||||
#define VK_KEY_5 0x35
|
||||
#define VK_KEY_6 0x36
|
||||
#define VK_KEY_7 0x37
|
||||
#define VK_KEY_8 0x38
|
||||
#define VK_KEY_0 0x30
|
||||
#define VK_KEY_1 0x31
|
||||
#define VK_KEY_2 0x32
|
||||
#define VK_KEY_3 0x33
|
||||
#define VK_KEY_4 0x34
|
||||
#define VK_KEY_5 0x35
|
||||
#define VK_KEY_6 0x36
|
||||
#define VK_KEY_7 0x37
|
||||
#define VK_KEY_8 0x38
|
||||
#define VK_KEY_9 0x39
|
||||
#define VK_KEY_A 0x41
|
||||
#define VK_KEY_B 0x42
|
||||
#define VK_KEY_C 0x43
|
||||
#define VK_KEY_D 0x44
|
||||
#define VK_KEY_E 0x45
|
||||
#define VK_KEY_F 0x46
|
||||
#define VK_KEY_G 0x47
|
||||
#define VK_KEY_H 0x48
|
||||
#define VK_KEY_I 0x49
|
||||
#define VK_KEY_J 0x4A
|
||||
#define VK_KEY_K 0x4B
|
||||
#define VK_KEY_L 0x4C
|
||||
#define VK_KEY_M 0x4D
|
||||
#define VK_KEY_N 0x4E
|
||||
#define VK_KEY_O 0x4F
|
||||
#define VK_KEY_P 0x50
|
||||
#define VK_KEY_Q 0x51
|
||||
#define VK_KEY_R 0x52
|
||||
#define VK_KEY_S 0x53
|
||||
#define VK_KEY_T 0x54
|
||||
#define VK_KEY_U 0x55
|
||||
#define VK_KEY_V 0x56
|
||||
#define VK_KEY_W 0x57
|
||||
#define VK_KEY_X 0x58
|
||||
#define VK_KEY_Y 0x59
|
||||
#define VK_KEY_A 0x41
|
||||
#define VK_KEY_B 0x42
|
||||
#define VK_KEY_C 0x43
|
||||
#define VK_KEY_D 0x44
|
||||
#define VK_KEY_E 0x45
|
||||
#define VK_KEY_F 0x46
|
||||
#define VK_KEY_G 0x47
|
||||
#define VK_KEY_H 0x48
|
||||
#define VK_KEY_I 0x49
|
||||
#define VK_KEY_J 0x4A
|
||||
#define VK_KEY_K 0x4B
|
||||
#define VK_KEY_L 0x4C
|
||||
#define VK_KEY_M 0x4D
|
||||
#define VK_KEY_N 0x4E
|
||||
#define VK_KEY_O 0x4F
|
||||
#define VK_KEY_P 0x50
|
||||
#define VK_KEY_Q 0x51
|
||||
#define VK_KEY_R 0x52
|
||||
#define VK_KEY_S 0x53
|
||||
#define VK_KEY_T 0x54
|
||||
#define VK_KEY_U 0x55
|
||||
#define VK_KEY_V 0x56
|
||||
#define VK_KEY_W 0x57
|
||||
#define VK_KEY_X 0x58
|
||||
#define VK_KEY_Y 0x59
|
||||
#define VK_KEY_Z 0x5A
|
||||
|
||||
|
||||
@ -207,4 +207,4 @@ static std::string key_names[]
|
||||
"RCtrl",
|
||||
"LMenu",
|
||||
"RMenu"
|
||||
};
|
||||
};
|
||||
|
@ -10,13 +10,19 @@ Vehicle::Vehicle()
|
||||
ParseCarcolsDAT();
|
||||
Events::processScriptsEvent += [this]
|
||||
{
|
||||
if (!images_loaded)
|
||||
if (!m_bImagesLoaded)
|
||||
{
|
||||
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);
|
||||
Util::LoadTexturesInDirRecursive(
|
||||
PLUGIN_PATH((char*)"CheatMenu\\vehicles\\images\\"), ".jpg", m_Spawner.m_VehData.m_Categories,
|
||||
m_Spawner.m_VehData.m_ImagesList);
|
||||
Util::LoadTexturesInDirRecursive(
|
||||
PLUGIN_PATH((char*)"CheatMenu\\vehicles\\components\\"), ".jpg", m_TuneData.m_Categories,
|
||||
m_TuneData.m_ImagesList);
|
||||
Util::LoadTexturesInDirRecursive(
|
||||
PLUGIN_PATH((char*)"CheatMenu\\vehicles\\paintjobs\\"), ".png", m_TextureData.m_Categories,
|
||||
m_TextureData.m_ImagesList);
|
||||
|
||||
images_loaded = true;
|
||||
m_bImagesLoaded = true;
|
||||
}
|
||||
|
||||
uint timer = CTimer::m_snTimeInMilliseconds;
|
||||
@ -27,7 +33,7 @@ Vehicle::Vehicle()
|
||||
{
|
||||
int hveh = CPools::GetVehicleRef(veh);
|
||||
|
||||
if (Ui::HotKeyPressed(Menu::hotkeys::flip_veh))
|
||||
if (Ui::HotKeyPressed(Menu::m_HotKeys.flipVeh))
|
||||
{
|
||||
float roll;
|
||||
Command<Commands::GET_CAR_ROLL>(hveh, &roll);
|
||||
@ -36,14 +42,14 @@ Vehicle::Vehicle()
|
||||
Command<Commands::SET_CAR_ROLL>(hveh, roll); // z rot fix
|
||||
}
|
||||
|
||||
if (Ui::HotKeyPressed(Menu::hotkeys::fix_veh))
|
||||
if (Ui::HotKeyPressed(Menu::m_HotKeys.fixVeh))
|
||||
{
|
||||
player->m_pVehicle->Fix();
|
||||
player->m_pVehicle->m_fHealth = 1000.0f;
|
||||
CHud::SetHelpMessage("Vehicle fixed", false, false, false);
|
||||
}
|
||||
|
||||
if (Ui::HotKeyPressed(Menu::hotkeys::veh_engine))
|
||||
if (Ui::HotKeyPressed(Menu::m_HotKeys.vehEngine))
|
||||
{
|
||||
bool state = !veh->m_nVehicleFlags.bEngineBroken || veh->m_nVehicleFlags.bEngineOn;
|
||||
|
||||
@ -56,13 +62,13 @@ Vehicle::Vehicle()
|
||||
veh->m_nVehicleFlags.bEngineOn = !state;
|
||||
}
|
||||
|
||||
if (Ui::HotKeyPressed(Menu::hotkeys::veh_instant_start))
|
||||
if (Ui::HotKeyPressed(Menu::m_HotKeys.vehInstantStart))
|
||||
Command<Commands::SET_CAR_FORWARD_SPEED>(hveh, 40.0f);
|
||||
|
||||
if (Ui::HotKeyPressed(Menu::hotkeys::veh_instant_stop))
|
||||
if (Ui::HotKeyPressed(Menu::m_HotKeys.vehInstantStop))
|
||||
Command<Commands::SET_CAR_FORWARD_SPEED>(hveh, 0);
|
||||
|
||||
if (veh_nodmg)
|
||||
if (m_bNoDamage)
|
||||
{
|
||||
veh->m_nPhysicalFlags.bBulletProof = true;
|
||||
veh->m_nPhysicalFlags.bExplosionProof = true;
|
||||
@ -72,48 +78,48 @@ Vehicle::Vehicle()
|
||||
veh->m_nVehicleFlags.bCanBeDamaged = true;
|
||||
}
|
||||
|
||||
player->m_nPedFlags.CantBeKnockedOffBike = dont_fall_bike ? 1 : 2;
|
||||
Command<Commands::SET_CAR_HEAVY>(hveh, veh_heavy);
|
||||
Command<Commands::SET_CAR_WATERTIGHT>(hveh, veh_watertight);
|
||||
player->m_nPedFlags.CantBeKnockedOffBike = m_bDontFallBike ? 1 : 2;
|
||||
Command<Commands::SET_CAR_HEAVY>(hveh, m_bVehHeavy);
|
||||
Command<Commands::SET_CAR_WATERTIGHT>(hveh, m_bVehWatertight);
|
||||
|
||||
if (unlimited_nitro::enabled && player->m_pVehicle->m_nVehicleSubClass == VEHICLE_AUTOMOBILE)
|
||||
if (m_UnlimitedNitro.m_bEnabled && player->m_pVehicle->m_nVehicleSubClass == VEHICLE_AUTOMOBILE)
|
||||
{
|
||||
patch::Set<BYTE>(0x969165, 0, true); // All cars have nitro
|
||||
patch::Set<BYTE>(0x96918B, 0, true); // All taxis have nitro
|
||||
|
||||
if (KeyPressed(VK_LBUTTON))
|
||||
{
|
||||
if (!unlimited_nitro::comp_added)
|
||||
if (!m_UnlimitedNitro.m_bCompAdded)
|
||||
{
|
||||
AddComponent("1010", false);
|
||||
unlimited_nitro::comp_added = true;
|
||||
m_UnlimitedNitro.m_bCompAdded = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (unlimited_nitro::comp_added)
|
||||
if (m_UnlimitedNitro.m_bCompAdded)
|
||||
{
|
||||
RemoveComponent("1010", false);
|
||||
unlimited_nitro::comp_added = false;
|
||||
m_UnlimitedNitro.m_bCompAdded = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (lock_speed)
|
||||
Command<Commands::SET_CAR_FORWARD_SPEED>(hveh, lock_speed_val);
|
||||
if (m_bLockSpeed)
|
||||
Command<Commands::SET_CAR_FORWARD_SPEED>(hveh, m_fLockSpeed);
|
||||
|
||||
if (neon::rainbow && timer - neon::rainbow_timer > 50)
|
||||
if (m_Neon.m_bRainbowEffect && timer - m_Neon.m_nRainbowTimer > 50)
|
||||
{
|
||||
int red, green, blue;
|
||||
|
||||
Util::RainbowValues(red, green, blue, 0.25);
|
||||
InstallNeon(veh, red, green, blue);
|
||||
neon::rainbow_timer = timer;
|
||||
m_Neon.m_nRainbowTimer = timer;
|
||||
}
|
||||
}
|
||||
|
||||
// Traffic neons
|
||||
if (neon::traffic && timer - neon::traffic_timer > 1000)
|
||||
if (m_Neon.m_bApplyOnTraffic && timer - m_Neon.m_bTrafficTimer > 1000)
|
||||
{
|
||||
for (CVehicle* veh : CPools::ms_pVehiclePool)
|
||||
{
|
||||
@ -131,18 +137,18 @@ Vehicle::Vehicle()
|
||||
if (chance == 1 && !IsNeonInstalled(veh) && veh->m_pDriver != player)
|
||||
InstallNeon(veh, Random(0, 255), Random(0, 255), Random(0, 255));
|
||||
}
|
||||
neon::traffic_timer = timer;
|
||||
m_Neon.m_bTrafficTimer = timer;
|
||||
}
|
||||
|
||||
if (bike_fly && veh && veh->IsDriver(player))
|
||||
if (m_bBikeFly && veh && veh->IsDriver(player))
|
||||
{
|
||||
if (veh->m_nVehicleSubClass == VEHICLE_BIKE || veh->m_nVehicleSubClass == VEHICLE_BMX)
|
||||
{
|
||||
if (sqrt(veh->m_vecMoveSpeed.x * veh->m_vecMoveSpeed.x
|
||||
+ veh->m_vecMoveSpeed.y * veh->m_vecMoveSpeed.y
|
||||
+ veh->m_vecMoveSpeed.z * veh->m_vecMoveSpeed.z
|
||||
) > 0.0
|
||||
&& CTimer::ms_fTimeStep > 0.0)
|
||||
+ veh->m_vecMoveSpeed.y * veh->m_vecMoveSpeed.y
|
||||
+ veh->m_vecMoveSpeed.z * veh->m_vecMoveSpeed.z
|
||||
) > 0.0
|
||||
&& CTimer::ms_fTimeStep > 0.0)
|
||||
{
|
||||
veh->FlyingControl(3, -9999.9902f, -9999.9902f, -9999.9902f, -9999.9902f);
|
||||
}
|
||||
@ -153,14 +159,15 @@ Vehicle::Vehicle()
|
||||
|
||||
Vehicle::~Vehicle()
|
||||
{
|
||||
Util::ReleaseTextures(spawner::veh_data.images);
|
||||
Util::ReleaseTextures(tune_data.images);
|
||||
Util::ReleaseTextures(texture_data.images);
|
||||
Util::ReleaseTextures(m_Spawner.m_VehData.m_ImagesList);
|
||||
Util::ReleaseTextures(m_TuneData.m_ImagesList);
|
||||
Util::ReleaseTextures(m_TextureData.m_ImagesList);
|
||||
}
|
||||
|
||||
void Vehicle::AddComponent(const std::string& component, const bool display_message)
|
||||
{
|
||||
try {
|
||||
try
|
||||
{
|
||||
CPlayerPed* player = FindPlayerPed();
|
||||
int icomp = std::stoi(component);
|
||||
int hveh = CPools::GetVehicleRef(player->m_pVehicle);
|
||||
@ -182,7 +189,8 @@ void Vehicle::AddComponent(const std::string& component, const bool display_mess
|
||||
|
||||
void Vehicle::RemoveComponent(const std::string& component, const bool display_message)
|
||||
{
|
||||
try {
|
||||
try
|
||||
{
|
||||
CPlayerPed* player = FindPlayerPed();
|
||||
int icomp = std::stoi(component);
|
||||
int hveh = CPools::GetVehicleRef(player->m_pVehicle);
|
||||
@ -202,29 +210,29 @@ void Vehicle::RemoveComponent(const std::string& component, const bool display_m
|
||||
int Vehicle::GetRandomTrainIdForModel(int model)
|
||||
{
|
||||
static int train_ids[] = {
|
||||
8,9, // model 449
|
||||
0,3,6,10,12,13, // model 537
|
||||
1,5,15 // model 538
|
||||
8, 9, // model 449
|
||||
0, 3, 6, 10, 12, 13, // model 537
|
||||
1, 5, 15 // model 538
|
||||
};
|
||||
int _start = 0, _end = 0;
|
||||
|
||||
switch (model)
|
||||
{
|
||||
case 449:
|
||||
_start = 0;
|
||||
_end = 1;
|
||||
break;
|
||||
case 537:
|
||||
_start = 2;
|
||||
_end = 7;
|
||||
break;
|
||||
case 538:
|
||||
_start = 8;
|
||||
_end = 10;
|
||||
break;
|
||||
default:
|
||||
CHud::SetHelpMessage("Invalid train model", false, false, false);
|
||||
return -1;
|
||||
case 449:
|
||||
_start = 0;
|
||||
_end = 1;
|
||||
break;
|
||||
case 537:
|
||||
_start = 2;
|
||||
_end = 7;
|
||||
break;
|
||||
case 538:
|
||||
_start = 8;
|
||||
_end = 10;
|
||||
break;
|
||||
default:
|
||||
CHud::SetHelpMessage("Invalid train model", false, false, false);
|
||||
return -1;
|
||||
}
|
||||
int id = Random(_start, _end);
|
||||
return train_ids[id];
|
||||
@ -233,11 +241,11 @@ int Vehicle::GetRandomTrainIdForModel(int model)
|
||||
// Get vehicle HandlingId
|
||||
void Vehicle::ParseVehiclesIDE()
|
||||
{
|
||||
std::string file_path = std::string(paths::GetGameDirPathA()) + "/data/vehicles.ide";
|
||||
std::string m_FilePath = std::string(paths::GetGameDirPathA()) + "/data/vehicles.ide";
|
||||
|
||||
if (fs::exists(file_path))
|
||||
if (fs::exists(m_FilePath))
|
||||
{
|
||||
std::ifstream file(file_path);
|
||||
std::ifstream file(m_FilePath);
|
||||
std::string line;
|
||||
|
||||
while (getline(file, line))
|
||||
@ -263,7 +271,7 @@ void Vehicle::ParseVehiclesIDE()
|
||||
|
||||
temp.erase(std::remove_if(temp.begin(), temp.end(), ::isspace), temp.end());
|
||||
|
||||
vehicle_ide[model] = temp;
|
||||
m_VehicleIDE[model] = temp;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
@ -278,11 +286,11 @@ void Vehicle::ParseVehiclesIDE()
|
||||
|
||||
void Vehicle::ParseCarcolsDAT()
|
||||
{
|
||||
std::string file_path = std::string(paths::GetGameDirPathA()) + "/data/carcols.dat";
|
||||
std::string m_FilePath = std::string(paths::GetGameDirPathA()) + "/data/carcols.dat";
|
||||
|
||||
if (fs::exists(file_path))
|
||||
if (fs::exists(m_FilePath))
|
||||
{
|
||||
std::ifstream file(file_path);
|
||||
std::ifstream file(m_FilePath);
|
||||
std::string line;
|
||||
|
||||
bool car_section = false;
|
||||
@ -331,8 +339,8 @@ void Vehicle::ParseCarcolsDAT()
|
||||
getline(ss, temp, ',');
|
||||
int blue = std::stoi(temp);
|
||||
|
||||
std::vector<float> color = { red / 255.0f,green / 255.0f,blue / 255.0f };
|
||||
carcols_color_values.push_back(color);
|
||||
std::vector<float> color = {red / 255.0f, green / 255.0f, blue / 255.0f};
|
||||
m_CarcolsColorData.push_back(color);
|
||||
|
||||
++count;
|
||||
}
|
||||
@ -353,13 +361,15 @@ void Vehicle::ParseCarcolsDAT()
|
||||
{
|
||||
try
|
||||
{
|
||||
std::for_each(name.begin(), name.end(), [](char& c) {
|
||||
std::for_each(name.begin(), name.end(), [](char& c)
|
||||
{
|
||||
c = ::toupper(c);
|
||||
});
|
||||
|
||||
int val = std::stoi(temp);
|
||||
if (!(std::find(carcols_car_data[name].begin(), carcols_car_data[name].end(), val) != carcols_car_data[name].end()))
|
||||
carcols_car_data[name].push_back(val);
|
||||
if (!(std::find(m_CarcolsCarData[name].begin(), m_CarcolsCarData[name].end(), val) !=
|
||||
m_CarcolsCarData[name].end()))
|
||||
m_CarcolsCarData[name].push_back(val);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
@ -389,7 +399,7 @@ void Vehicle::SpawnVehicle(std::string& smodel)
|
||||
CVector pos = player->GetPosition();
|
||||
int speed = 0;
|
||||
|
||||
if (player->m_nPedFlags.bInVehicle && spawner::spawn_inside)
|
||||
if (player->m_nPedFlags.bInVehicle && m_Spawner.m_bSpawnInside)
|
||||
{
|
||||
int hveh = 0;
|
||||
Command<Commands::GET_CAR_CHAR_IS_USING>(hplayer, &hveh);
|
||||
@ -407,7 +417,7 @@ void Vehicle::SpawnVehicle(std::string& smodel)
|
||||
}
|
||||
|
||||
if (interior == 0)
|
||||
if (spawner::spawn_in_air && (CModelInfo::IsHeliModel(imodel) || CModelInfo::IsPlaneModel(imodel)))
|
||||
if (m_Spawner.m_bSpawnInAir && (CModelInfo::IsHeliModel(imodel) || CModelInfo::IsPlaneModel(imodel)))
|
||||
pos.z = 400;
|
||||
else
|
||||
pos.z -= 5;
|
||||
@ -436,14 +446,15 @@ void Vehicle::SpawnVehicle(std::string& smodel)
|
||||
CTrain* carraige = nullptr;
|
||||
int track = Random(0, 1);
|
||||
int node = CTrain::FindClosestTrackNode(pos, &track);
|
||||
CTrain::CreateMissionTrain(pos, (Random(0, 1)) == 1 ? true : false, train_id, &train, &carraige, node, track, false);
|
||||
CTrain::CreateMissionTrain(pos, (Random(0, 1)) == 1 ? true : false, train_id, &train, &carraige, node,
|
||||
track, false);
|
||||
|
||||
veh = (CVehicle*)train;
|
||||
hveh = CPools::GetVehicleRef(veh);
|
||||
if (veh->m_pDriver)
|
||||
Command<Commands::DELETE_CHAR>(CPools::GetPedRef(veh->m_pDriver));
|
||||
|
||||
if (spawner::spawn_inside)
|
||||
if (m_Spawner.m_bSpawnInside)
|
||||
{
|
||||
Command<Commands::WARP_CHAR_INTO_CAR>(hplayer, hveh);
|
||||
Command<Commands::SET_CAR_FORWARD_SPEED>(hveh, speed);
|
||||
@ -462,11 +473,11 @@ void Vehicle::SpawnVehicle(std::string& smodel)
|
||||
CStreaming::RequestModel(imodel, PRIORITY_REQUEST);
|
||||
CStreaming::LoadAllRequestedModels(false);
|
||||
|
||||
if (spawner::license_text[0] != '\0')
|
||||
Command<Commands::CUSTOM_PLATE_FOR_NEXT_CAR>(imodel, spawner::license_text);
|
||||
if (m_Spawner.m_nLicenseText[0] != '\0')
|
||||
Command<Commands::CUSTOM_PLATE_FOR_NEXT_CAR>(imodel, m_Spawner.m_nLicenseText);
|
||||
|
||||
int hveh = 0;
|
||||
if (spawner::spawn_inside)
|
||||
if (m_Spawner.m_bSpawnInside)
|
||||
{
|
||||
Command<Commands::CREATE_CAR>(imodel, pos.x, pos.y, pos.z + 4.0f, &hveh);
|
||||
veh = CPools::GetVehicle(hveh);
|
||||
@ -513,7 +524,7 @@ void Vehicle::GenerateHandlingDataFile(int phandling)
|
||||
{
|
||||
FILE* fp = fopen("handling.txt", "w");
|
||||
|
||||
std::string handlingId = vehicle_ide[FindPlayerPed()->m_pVehicle->m_nModelIndex];
|
||||
std::string handlingId = m_VehicleIDE[FindPlayerPed()->m_pVehicle->m_nModelIndex];
|
||||
float fMass = patch::Get<float>(phandling + 0x4);
|
||||
float fTurnMass = patch::Get<float>(phandling + 0xC);
|
||||
float fDragMult = patch::Get<float>(phandling + 0x10);
|
||||
@ -554,11 +565,17 @@ void Vehicle::GenerateHandlingDataFile(int phandling)
|
||||
int nNumberOfGears = patch::Get<BYTE>(phandling + 0x76);
|
||||
float fSeatOffsetDistance = patch::Get<float>(phandling + 0xD4);
|
||||
|
||||
fprintf(fp, "\n%s\t%.5g\t%.5g\t%.5g\t%.5g\t%.5g\t%.5g\t%d\t%.5g\t%.5g\t%.5g\t%d\t%d\t%.5g\t%.5g\t%c\t%c\t%.5g\t%.5g\t%d\t%.5g\t%.5g\t%.5g\t%.5g\t%.5g\t%.5g\t%.5g\t%.5g\t%.5g\t%.5g\t%d\t%d\t%d\t%d\t%d\t%d",
|
||||
handlingId.c_str(), fMass, fTurnMass, fDragMult, CentreOfMassX, CentreOfMassY, CentreOfMassZ, nPercentSubmerged, fTractionMultiplier, fTractionLoss, TractionBias, nNumberOfGears,
|
||||
MaxVelocity, fEngineAcceleration, fEngineInertia, nDriveType, nEngineType, BrakeDeceleration, BrakeBias, ABS, SteeringLock, SuspensionForceLevel, SuspensionDampingLevel,
|
||||
SuspensionHighSpdComDamp, Suspension_upper_limit, Suspension_lower_limit, Suspension_bias, Suspension_anti_dive_multiplier, fSeatOffsetDistance,
|
||||
fCollisionDamageMultiplier, nMonetaryValue, modelFlags, handlingFlags, front_lights, rear_lights, vehicle_anim_group);
|
||||
fprintf(
|
||||
fp,
|
||||
"\n%s\t%.5g\t%.5g\t%.5g\t%.5g\t%.5g\t%.5g\t%d\t%.5g\t%.5g\t%.5g\t%d\t%d\t%.5g\t%.5g\t%c\t%c\t%.5g\t%.5g\t%d\t%.5g\t%.5g\t%.5g\t%.5g\t%.5g\t%.5g\t%.5g\t%.5g\t%.5g\t%.5g\t%d\t%d\t%d\t%d\t%d\t%d",
|
||||
handlingId.c_str(), fMass, fTurnMass, fDragMult, CentreOfMassX, CentreOfMassY, CentreOfMassZ, nPercentSubmerged,
|
||||
fTractionMultiplier, fTractionLoss, TractionBias, nNumberOfGears,
|
||||
MaxVelocity, fEngineAcceleration, fEngineInertia, nDriveType, nEngineType, BrakeDeceleration, BrakeBias, ABS,
|
||||
SteeringLock, SuspensionForceLevel, SuspensionDampingLevel,
|
||||
SuspensionHighSpdComDamp, Suspension_upper_limit, Suspension_lower_limit, Suspension_bias,
|
||||
Suspension_anti_dive_multiplier, fSeatOffsetDistance,
|
||||
fCollisionDamageMultiplier, nMonetaryValue, modelFlags, handlingFlags, front_lights, rear_lights,
|
||||
vehicle_anim_group);
|
||||
|
||||
fclose(fp);
|
||||
}
|
||||
@ -582,7 +599,6 @@ void Vehicle::Draw()
|
||||
player->m_pVehicle->Fix();
|
||||
player->m_pVehicle->m_fHealth = 1000.0f;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ImGui::SameLine();
|
||||
@ -620,13 +636,14 @@ void Vehicle::Draw()
|
||||
Ui::CheckboxAddress("Aim while driving", 0x969179);
|
||||
Ui::CheckboxAddress("All cars have nitro", 0x969165);
|
||||
Ui::CheckboxAddress("All taxis have nitro", 0x96918B);
|
||||
Ui::CheckboxWithHint("Bikes fly", &bike_fly);
|
||||
Ui::CheckboxWithHint("Bikes fly", &m_bBikeFly);
|
||||
Ui::CheckboxAddress("Boats fly", 0x969153);
|
||||
Ui::CheckboxAddress("Cars fly", 0x969160);
|
||||
Ui::CheckboxWithHint("Cars heavy", &veh_heavy);
|
||||
if (Ui::CheckboxWithHint("Damage proof", &veh_nodmg, "Every vehicle entered will be damage proof\nBullet, Collision, Explosion, Fire, Meele etc"))
|
||||
Ui::CheckboxWithHint("Cars heavy", &m_bVehHeavy);
|
||||
if (Ui::CheckboxWithHint("Damage proof", &m_bNoDamage,
|
||||
"Every vehicle entered will be damage proof\nBullet, Collision, Explosion, Fire, Meele etc"))
|
||||
{
|
||||
if (pVeh && !veh_nodmg)
|
||||
if (pVeh && !m_bNoDamage)
|
||||
{
|
||||
pVeh->m_nVehicleFlags.bCanBeDamaged = true;
|
||||
pVeh->m_nPhysicalFlags.bBulletProof = false;
|
||||
@ -640,16 +657,16 @@ void Vehicle::Draw()
|
||||
|
||||
ImGui::NextColumn();
|
||||
|
||||
Ui::CheckboxWithHint("Don't fall off bike", &dont_fall_bike);
|
||||
Ui::CheckboxWithHint("Don't fall off bike", &m_bDontFallBike);
|
||||
Ui::CheckboxAddress("Drive on water", 0x969152);
|
||||
Ui::CheckboxAddressEx("Lock train camera", 0x52A52F, 171, 6);
|
||||
Ui::CheckboxAddress("Float away when hit", 0x969166);
|
||||
Ui::CheckboxAddress("Green traffic lights", 0x96914E);
|
||||
Ui::CheckboxAddress("Perfect handling", 0x96914C);
|
||||
Ui::CheckboxAddress("Tank mode", 0x969164);
|
||||
Ui::CheckboxWithHint("Unlimited nitro", &unlimited_nitro::enabled, "Nitro will activate when left clicked\n\
|
||||
Ui::CheckboxWithHint("Unlimited nitro", &m_UnlimitedNitro.m_bEnabled, "Nitro will activate when left clicked\n\
|
||||
\nEnabling this would disable\nAll cars have nitro\nAll taxis have nitro");
|
||||
Ui::CheckboxWithHint("Watertight car", &veh_watertight);
|
||||
Ui::CheckboxWithHint("Watertight car", &m_bVehWatertight);
|
||||
Ui::CheckboxAddress("Wheels only", 0x96914B);
|
||||
ImGui::Columns(1);
|
||||
|
||||
@ -665,11 +682,11 @@ void Vehicle::Draw()
|
||||
pVeh->m_nVehicleFlags.bAlwaysSkidMarks = state;
|
||||
|
||||
state = pVeh->m_nPhysicalFlags.bBulletProof;
|
||||
if (Ui::CheckboxWithHint("Bullet proof", &state, nullptr, veh_nodmg))
|
||||
if (Ui::CheckboxWithHint("Bullet proof", &state, nullptr, m_bNoDamage))
|
||||
pVeh->m_nPhysicalFlags.bBulletProof = state;
|
||||
|
||||
state = pVeh->m_nPhysicalFlags.bCollisionProof;
|
||||
if (Ui::CheckboxWithHint("Collision proof", &state, nullptr, veh_nodmg))
|
||||
if (Ui::CheckboxWithHint("Collision proof", &state, nullptr, m_bNoDamage))
|
||||
pVeh->m_nPhysicalFlags.bCollisionProof = state;
|
||||
|
||||
state = pVeh->m_nVehicleFlags.bDisableParticles;
|
||||
@ -687,11 +704,11 @@ void Vehicle::Draw()
|
||||
pVeh->m_nVehicleFlags.bEngineOn = state;
|
||||
}
|
||||
state = pVeh->m_nPhysicalFlags.bExplosionProof;
|
||||
if (Ui::CheckboxWithHint("Explosion proof", &state, nullptr, veh_nodmg))
|
||||
if (Ui::CheckboxWithHint("Explosion proof", &state, nullptr, m_bNoDamage))
|
||||
pVeh->m_nPhysicalFlags.bExplosionProof = state;
|
||||
|
||||
state = pVeh->m_nPhysicalFlags.bFireProof;
|
||||
if (Ui::CheckboxWithHint("Fire proof", &state, nullptr, veh_nodmg))
|
||||
if (Ui::CheckboxWithHint("Fire proof", &state, nullptr, m_bNoDamage))
|
||||
pVeh->m_nPhysicalFlags.bFireProof = state;
|
||||
|
||||
ImGui::NextColumn();
|
||||
@ -718,7 +735,7 @@ void Vehicle::Draw()
|
||||
}
|
||||
|
||||
state = pVeh->m_nPhysicalFlags.bMeeleProof;
|
||||
if (Ui::CheckboxWithHint("Melee proof", &state, nullptr, veh_nodmg))
|
||||
if (Ui::CheckboxWithHint("Melee proof", &state, nullptr, m_bNoDamage))
|
||||
pVeh->m_nPhysicalFlags.bMeeleProof = state;
|
||||
|
||||
state = pVeh->m_nVehicleFlags.bPetrolTankIsWeakPoint;
|
||||
@ -771,7 +788,8 @@ void Vehicle::Draw()
|
||||
if (i % 2 != 1)
|
||||
ImGui::SameLine();
|
||||
|
||||
if (ImGui::Button((std::string("Passenger ") + std::to_string(i + 1)).c_str(), ImVec2(Ui::GetSize(2))))
|
||||
if (ImGui::Button((std::string("Passenger ") + std::to_string(i + 1)).c_str(),
|
||||
ImVec2(Ui::GetSize(2))))
|
||||
Command<Commands::WARP_CHAR_INTO_CAR_AS_PASSENGER>(hplayer, veh, i);
|
||||
}
|
||||
}
|
||||
@ -783,15 +801,15 @@ void Vehicle::Draw()
|
||||
}
|
||||
if (ImGui::CollapsingHeader("Remove vehicles in radius"))
|
||||
{
|
||||
ImGui::InputInt("Radius", &veh_remove_radius);
|
||||
ImGui::InputInt("Radius", &m_nVehRemoveRadius);
|
||||
ImGui::Spacing();
|
||||
if (ImGui::Button("Remove vehicles", Ui::GetSize(1)))
|
||||
{
|
||||
CPlayerPed* player = FindPlayerPed();
|
||||
for (CVehicle* veh : CPools::ms_pVehiclePool)
|
||||
{
|
||||
if (DistanceBetweenPoints(veh->GetPosition(), player->GetPosition()) < veh_remove_radius
|
||||
&& player->m_pVehicle != veh)
|
||||
if (DistanceBetweenPoints(veh->GetPosition(), player->GetPosition()) < m_nVehRemoveRadius
|
||||
&& player->m_pVehicle != veh)
|
||||
Command<Commands::DELETE_CAR>(CPools::GetVehicleRef(veh));
|
||||
}
|
||||
}
|
||||
@ -800,8 +818,10 @@ void Vehicle::Draw()
|
||||
}
|
||||
if (ImGui::CollapsingHeader("Traffic options"))
|
||||
{
|
||||
static std::vector<Ui::NamedMemory> color{ {"Black", 0x969151}, { "Pink",0x969150 } };
|
||||
static std::vector<Ui::NamedMemory> type{ {"Cheap", 0x96915E}, { "Country",0x96917B }, { "Fast",0x96915F } };
|
||||
static std::vector<Ui::NamedMemory> color{{"Black", 0x969151}, {"Pink", 0x969150}};
|
||||
static std::vector<Ui::NamedMemory> type{
|
||||
{"Cheap", 0x96915E}, {"Country", 0x96917B}, {"Fast", 0x96915F}
|
||||
};
|
||||
|
||||
Ui::RadioButtonAddress("Color", color);
|
||||
ImGui::Spacing();
|
||||
@ -812,69 +832,69 @@ void Vehicle::Draw()
|
||||
|
||||
if (player && player->m_pVehicle)
|
||||
{
|
||||
CVehicle* veh = player->m_pVehicle;
|
||||
int hveh = CPools::GetVehicleRef(veh);
|
||||
CVehicle* pVeh = player->m_pVehicle;
|
||||
int hVeh = CPools::GetVehicleRef(pVeh);
|
||||
|
||||
Ui::EditFloat("Dirt level", (int)veh + 0x4B0, 0, 7.5, 15);
|
||||
if (veh->m_nVehicleClass == VEHICLE_AUTOMOBILE && ImGui::CollapsingHeader("Doors"))
|
||||
Ui::EditFloat("Dirt level", (int)pVeh + 0x4B0, 0, 7.5, 15);
|
||||
if (pVeh->m_nVehicleClass == VEHICLE_AUTOMOBILE && ImGui::CollapsingHeader("Doors"))
|
||||
{
|
||||
ImGui::Columns(2, 0, false);
|
||||
ImGui::RadioButton("Damage", &door_menu_button, 0);
|
||||
ImGui::RadioButton("Fix", &door_menu_button, 1);
|
||||
ImGui::RadioButton("Damage", &m_nDoorMenuButton, 0);
|
||||
ImGui::RadioButton("Fix", &m_nDoorMenuButton, 1);
|
||||
ImGui::NextColumn();
|
||||
ImGui::RadioButton("Open", &door_menu_button, 2);
|
||||
ImGui::RadioButton("Pop", &door_menu_button, 3);
|
||||
ImGui::RadioButton("Open", &m_nDoorMenuButton, 2);
|
||||
ImGui::RadioButton("Pop", &m_nDoorMenuButton, 3);
|
||||
ImGui::Columns(1);
|
||||
ImGui::Spacing();
|
||||
|
||||
int seats = veh->m_nMaxPassengers + 1; // passenger + driver
|
||||
int seats = pVeh->m_nMaxPassengers + 1; // passenger + driver
|
||||
int doors = seats == 4 ? 6 : 4;
|
||||
int hveh = CPools::GetVehicleRef(veh);
|
||||
int hveh = CPools::GetVehicleRef(pVeh);
|
||||
|
||||
if (ImGui::Button("All", ImVec2(Ui::GetSize())))
|
||||
{
|
||||
for (int i = 0; i < doors; ++i)
|
||||
{
|
||||
switch (door_menu_button)
|
||||
switch (m_nDoorMenuButton)
|
||||
{
|
||||
case 0:
|
||||
Command<Commands::DAMAGE_CAR_DOOR>(hveh, i);
|
||||
break;
|
||||
case 1:
|
||||
Command<Commands::FIX_CAR_DOOR>(hveh, i);
|
||||
break;
|
||||
case 2:
|
||||
Command<Commands::OPEN_CAR_DOOR>(hveh, i);
|
||||
break;
|
||||
case 3:
|
||||
Command<Commands::POP_CAR_DOOR>(hveh, i);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case 0:
|
||||
Command<Commands::DAMAGE_CAR_DOOR>(hveh, i);
|
||||
break;
|
||||
case 1:
|
||||
Command<Commands::FIX_CAR_DOOR>(hveh, i);
|
||||
break;
|
||||
case 2:
|
||||
Command<Commands::OPEN_CAR_DOOR>(hveh, i);
|
||||
break;
|
||||
case 3:
|
||||
Command<Commands::POP_CAR_DOOR>(hveh, i);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i != doors; ++i)
|
||||
{
|
||||
if (ImGui::Button(door_names[i].c_str(), ImVec2(Ui::GetSize(2))))
|
||||
if (ImGui::Button(m_DoorNames[i].c_str(), ImVec2(Ui::GetSize(2))))
|
||||
{
|
||||
switch (door_menu_button)
|
||||
switch (m_nDoorMenuButton)
|
||||
{
|
||||
case 0:
|
||||
Command<Commands::DAMAGE_CAR_DOOR>(hveh, i);
|
||||
break;
|
||||
case 1:
|
||||
Command<Commands::FIX_CAR_DOOR>(hveh, i);
|
||||
break;
|
||||
case 2:
|
||||
Command<Commands::OPEN_CAR_DOOR>(hveh, i);
|
||||
break;
|
||||
case 3:
|
||||
Command<Commands::POP_CAR_DOOR>(hveh, i);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case 0:
|
||||
Command<Commands::DAMAGE_CAR_DOOR>(hveh, i);
|
||||
break;
|
||||
case 1:
|
||||
Command<Commands::FIX_CAR_DOOR>(hveh, i);
|
||||
break;
|
||||
case 2:
|
||||
Command<Commands::OPEN_CAR_DOOR>(hveh, i);
|
||||
break;
|
||||
case 3:
|
||||
Command<Commands::POP_CAR_DOOR>(hveh, i);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -888,21 +908,21 @@ void Vehicle::Draw()
|
||||
|
||||
if (ImGui::CollapsingHeader("Set speed"))
|
||||
{
|
||||
Ui::CheckboxWithHint("Lock speed", &lock_speed);
|
||||
Ui::CheckboxWithHint("Lock speed", &m_bLockSpeed);
|
||||
ImGui::Spacing();
|
||||
ImGui::InputFloat("Set", &lock_speed_val);
|
||||
ImGui::InputFloat("Set", &m_fLockSpeed);
|
||||
ImGui::Spacing();
|
||||
|
||||
lock_speed_val = lock_speed_val > 100 ? 100 : lock_speed_val;
|
||||
lock_speed_val = lock_speed_val < 0 ? 0 : lock_speed_val;
|
||||
m_fLockSpeed = m_fLockSpeed > 100 ? 100 : m_fLockSpeed;
|
||||
m_fLockSpeed = m_fLockSpeed < 0 ? 0 : m_fLockSpeed;
|
||||
|
||||
if (ImGui::Button("Set speed##brn", ImVec2(Ui::GetSize(2))))
|
||||
Command<Commands::SET_CAR_FORWARD_SPEED>(hveh, lock_speed_val);
|
||||
Command<Commands::SET_CAR_FORWARD_SPEED>(hVeh, m_fLockSpeed);
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
if (ImGui::Button("Instant stop##brn", ImVec2(Ui::GetSize(2))))
|
||||
Command<Commands::SET_CAR_FORWARD_SPEED>(hveh, 0);
|
||||
Command<Commands::SET_CAR_FORWARD_SPEED>(hVeh, 0);
|
||||
}
|
||||
}
|
||||
ImGui::EndChild();
|
||||
@ -912,21 +932,22 @@ void Vehicle::Draw()
|
||||
{
|
||||
ImGui::Spacing();
|
||||
ImGui::Columns(2, 0, false);
|
||||
Ui::CheckboxWithHint("Spawn inside", &spawner::spawn_inside, "Spawn inside vehicle as driver");
|
||||
Ui::CheckboxWithHint("Spawn inside", &m_Spawner.m_bSpawnInside, "Spawn inside vehicle as driver");
|
||||
ImGui::NextColumn();
|
||||
Ui::CheckboxWithHint("Spawn aircraft in air", &spawner::spawn_in_air);
|
||||
Ui::CheckboxWithHint("Spawn aircraft in air", &m_Spawner.m_bSpawnInAir);
|
||||
ImGui::Columns(1);
|
||||
|
||||
|
||||
ImGui::Spacing();
|
||||
ImGui::SetNextItemWidth(ImGui::GetWindowContentRegionWidth() - 2.5);
|
||||
ImGui::InputTextWithHint("##LicenseText", "License plate text", spawner::license_text, 9);
|
||||
ImGui::InputTextWithHint("##LicenseText", "License plate text", m_Spawner.m_nLicenseText, 9);
|
||||
|
||||
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));
|
||||
});
|
||||
Ui::DrawImages(m_Spawner.m_VehData.m_ImagesList, ImVec2(100, 75), m_Spawner.m_VehData.m_Categories,
|
||||
m_Spawner.m_VehData.m_Selected, m_Spawner.m_VehData.m_Filter, SpawnVehicle, nullptr,
|
||||
[](std::string str)
|
||||
{
|
||||
return GetNameFromModel(std::stoi(str));
|
||||
});
|
||||
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
@ -948,59 +969,61 @@ void Vehicle::Draw()
|
||||
|
||||
Ui::ListBoxStr("Component", Paint::veh_nodes::names_vec, Paint::veh_nodes::selected);
|
||||
|
||||
if (ImGui::ColorEdit3("Color picker", color::color_picker))
|
||||
if (ImGui::ColorEdit3("Color picker", m_Color.m_fColorPicker))
|
||||
{
|
||||
uchar r = color::color_picker[0] * 255;
|
||||
uchar g = color::color_picker[1] * 255;
|
||||
uchar b = color::color_picker[2] * 255;
|
||||
Paint::SetNodeColor(veh, Paint::veh_nodes::selected, { r,g,b,255 }, color::material_filter);
|
||||
uchar r = m_Color.m_fColorPicker[0] * 255;
|
||||
uchar g = m_Color.m_fColorPicker[1] * 255;
|
||||
uchar b = m_Color.m_fColorPicker[2] * 255;
|
||||
Paint::SetNodeColor(veh, Paint::veh_nodes::selected, {r, g, b, 255}, m_Color.m_bMatFilter);
|
||||
}
|
||||
|
||||
ImGui::Spacing();
|
||||
ImGui::Columns(2, NULL, false);
|
||||
ImGui::Checkbox("Material filter", &color::material_filter);
|
||||
ImGui::RadioButton("Primary", &color::radio_btn, 1);
|
||||
ImGui::RadioButton("Secondary", &color::radio_btn, 2);
|
||||
ImGui::Checkbox("Material filter", &m_Color.m_bMatFilter);
|
||||
ImGui::RadioButton("Primary", &m_Color.m_nRadioButton, 1);
|
||||
ImGui::RadioButton("Secondary", &m_Color.m_nRadioButton, 2);
|
||||
ImGui::NextColumn();
|
||||
ImGui::Checkbox("Show all", &color::show_all);
|
||||
ImGui::RadioButton("Tertiary", &color::radio_btn, 3);
|
||||
ImGui::RadioButton("Quaternary", &color::radio_btn, 4);
|
||||
ImGui::Checkbox("Show all", &m_Color.bShowAll);
|
||||
ImGui::RadioButton("Tertiary", &m_Color.m_nRadioButton, 3);
|
||||
ImGui::RadioButton("Quaternary", &m_Color.m_nRadioButton, 4);
|
||||
ImGui::Spacing();
|
||||
ImGui::Columns(1);
|
||||
ImGui::Text("Select color preset:");
|
||||
ImGui::Spacing();
|
||||
|
||||
int count = (int)carcols_color_values.size();
|
||||
int count = (int)m_CarcolsColorData.size();
|
||||
|
||||
ImVec2 size = Ui::GetSize();
|
||||
int btns_in_row = ImGui::GetWindowContentRegionWidth() / (size.y * 2);
|
||||
int btn_size = (ImGui::GetWindowContentRegionWidth() - int(ImGuiStyleVar_ItemSpacing) * (btns_in_row - 0.6 * btns_in_row)) / btns_in_row;
|
||||
int btnsInRow = ImGui::GetWindowContentRegionWidth() / (size.y * 2);
|
||||
int btnSize = (ImGui::GetWindowContentRegionWidth() - int(ImGuiStyleVar_ItemSpacing) * (btnsInRow -
|
||||
0.6 * btnsInRow)) / btnsInRow;
|
||||
|
||||
ImGui::BeginChild("Colorss");
|
||||
|
||||
if (color::show_all)
|
||||
for (int color_id = 0; color_id < count; ++color_id)
|
||||
if (m_Color.bShowAll)
|
||||
for (int colorId = 0; colorId < count; ++colorId)
|
||||
{
|
||||
if (Ui::ColorButton(color_id, carcols_color_values[color_id], ImVec2(btn_size, btn_size)))
|
||||
*(uint8_replacement*)(int(veh) + 0x433 + color::radio_btn) = color_id;
|
||||
if (Ui::ColorButton(colorId, m_CarcolsColorData[colorId], ImVec2(btnSize, btnSize)))
|
||||
*(uint8_replacement*)(int(veh) + 0x433 + m_Color.m_nRadioButton) = colorId;
|
||||
|
||||
if ((color_id + 1) % btns_in_row != 0)
|
||||
if ((colorId + 1) % btnsInRow != 0)
|
||||
ImGui::SameLine(0.0, 4.0);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string veh_name = GetNameFromModel(player->m_pVehicle->m_nModelIndex);
|
||||
for (auto entry : carcols_car_data)
|
||||
std::string vehName = GetNameFromModel(player->m_pVehicle->m_nModelIndex);
|
||||
for (auto entry : m_CarcolsCarData)
|
||||
{
|
||||
if (entry.first == veh_name)
|
||||
if (entry.first == vehName)
|
||||
{
|
||||
int count = 1;
|
||||
for (int color_id : entry.second)
|
||||
for (int colorId : entry.second)
|
||||
{
|
||||
if (Ui::ColorButton(color_id, carcols_color_values[color_id], ImVec2(btn_size, btn_size)))
|
||||
*(uint8_replacement*)(int(veh) + 0x433 + color::radio_btn) = color_id;
|
||||
if (Ui::ColorButton(colorId, m_CarcolsColorData[colorId],
|
||||
ImVec2(btnSize, btnSize)))
|
||||
*(uint8_replacement*)(int(veh) + 0x433 + m_Color.m_nRadioButton) = colorId;
|
||||
|
||||
if (count % btns_in_row != 0)
|
||||
if (count % btnsInRow != 0)
|
||||
ImGui::SameLine(0.0, 4.0);
|
||||
++count;
|
||||
}
|
||||
@ -1029,36 +1052,38 @@ void Vehicle::Draw()
|
||||
if (Ui::CheckboxWithHint("Pulsing neons", &pulsing))
|
||||
SetPulsing(veh, pulsing);
|
||||
|
||||
Ui::CheckboxWithHint("Rainbow neons", &neon::rainbow, "Rainbow effect to neon lights");
|
||||
Ui::CheckboxWithHint("Rainbow neons", &m_Neon.m_bRainbowEffect, "Rainbow effect to neon lights");
|
||||
ImGui::NextColumn();
|
||||
Ui::CheckboxWithHint("Traffic neons", &neon::traffic, "Adds neon lights to traffic vehicles.\n\
|
||||
Ui::CheckboxWithHint("Traffic neons", &m_Neon.m_bApplyOnTraffic, "Adds neon lights to traffic vehicles.\n\
|
||||
Only some vehicles will have them.");
|
||||
ImGui::Columns(1);
|
||||
|
||||
ImGui::Spacing();
|
||||
|
||||
if (ImGui::ColorEdit3("Color picker", neon::color_picker))
|
||||
InstallNeon(veh, neon::color_picker[0] * 255, neon::color_picker[1] * 255, neon::color_picker[2] * 255);
|
||||
if (ImGui::ColorEdit3("Color picker", m_Neon.m_fColorPicker))
|
||||
InstallNeon(veh, m_Neon.m_fColorPicker[0] * 255, m_Neon.m_fColorPicker[1] * 255,
|
||||
m_Neon.m_fColorPicker[2] * 255);
|
||||
|
||||
ImGui::Spacing();
|
||||
ImGui::Text("Select neon preset:");
|
||||
|
||||
int count = (int)carcols_color_values.size();
|
||||
int count = (int)m_CarcolsColorData.size();
|
||||
ImVec2 size = Ui::GetSize();
|
||||
int btns_in_row = ImGui::GetWindowContentRegionWidth() / (size.y * 2);
|
||||
int btn_size = (ImGui::GetWindowContentRegionWidth() - int(ImGuiStyleVar_ItemSpacing) * (btns_in_row - 0.6 * btns_in_row)) / btns_in_row;
|
||||
int btnsInRow = ImGui::GetWindowContentRegionWidth() / (size.y * 2);
|
||||
int btnSize = (ImGui::GetWindowContentRegionWidth() - int(ImGuiStyleVar_ItemSpacing) * (btnsInRow -
|
||||
0.6 * btnsInRow)) / btnsInRow;
|
||||
|
||||
ImGui::BeginChild("Neonss");
|
||||
|
||||
for (int color_id = 0; color_id < count; ++color_id)
|
||||
{
|
||||
if (Ui::ColorButton(color_id, carcols_color_values[color_id], ImVec2(btn_size, btn_size)))
|
||||
if (Ui::ColorButton(color_id, m_CarcolsColorData[color_id], ImVec2(btnSize, btnSize)))
|
||||
{
|
||||
std::vector<float>& color = carcols_color_values[color_id];
|
||||
std::vector<float>& color = m_CarcolsColorData[color_id];
|
||||
InstallNeon(veh, color[0] * 255, color[1] * 255, color[2] * 255);
|
||||
}
|
||||
|
||||
if ((color_id + 1) % btns_in_row != 0)
|
||||
if ((color_id + 1) % btnsInRow != 0)
|
||||
ImGui::SameLine(0.0, 4.0);
|
||||
}
|
||||
|
||||
@ -1102,30 +1127,35 @@ Only some vehicles will have them.");
|
||||
|
||||
ImGui::Spacing();
|
||||
ImGui::SameLine();
|
||||
ImGui::Checkbox("Material filter", &color::material_filter);
|
||||
ImGui::Checkbox("Material filter", &m_Color.m_bMatFilter);
|
||||
ImGui::Spacing();
|
||||
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);
|
||||
},
|
||||
nullptr,
|
||||
[](std::string& str) {return str;
|
||||
});
|
||||
Ui::DrawImages(m_TextureData.m_ImagesList, ImVec2(100, 80), m_TextureData.m_Categories, m_TextureData.m_Selected,
|
||||
m_TextureData.m_Filter,
|
||||
[](std::string& str)
|
||||
{
|
||||
Paint::SetNodeTexture(FindPlayerPed()->m_pVehicle, Paint::veh_nodes::selected, str,
|
||||
m_Color.m_bMatFilter);
|
||||
},
|
||||
nullptr,
|
||||
[](std::string& str)
|
||||
{
|
||||
return str;
|
||||
});
|
||||
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
if (ImGui::BeginTabItem("Tune"))
|
||||
{
|
||||
ImGui::Spacing();
|
||||
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;},
|
||||
[](std::string& str)
|
||||
{
|
||||
return ((bool(*)(int, CVehicle*))0x49B010)(std::stoi(str), player->m_pVehicle);
|
||||
}
|
||||
Ui::DrawImages(m_TuneData.m_ImagesList, ImVec2(100, 80), m_TuneData.m_Categories, m_TuneData.m_Selected,
|
||||
m_TuneData.m_Filter,
|
||||
[](std::string& str) { AddComponent(str); },
|
||||
[](std::string& str) { RemoveComponent(str); },
|
||||
[](std::string& str) { return str; },
|
||||
[](std::string& str)
|
||||
{
|
||||
return ((bool(*)(int, CVehicle*))0x49B010)(std::stoi(str), player->m_pVehicle);
|
||||
}
|
||||
);
|
||||
|
||||
ImGui::EndTabItem();
|
||||
@ -1135,9 +1165,9 @@ Only some vehicles will have them.");
|
||||
ImGui::Spacing();
|
||||
|
||||
CBaseModelInfo* info = CModelInfo::GetModelInfo(player->m_pVehicle->m_nModelIndex);
|
||||
int phandling = patch::Get<WORD>((int)info + 0x4A, false);
|
||||
phandling *= 0xE0;
|
||||
phandling += 0xC2B9DC;
|
||||
int pHandling = patch::Get<WORD>((int)info + 0x4A, false);
|
||||
pHandling *= 0xE0;
|
||||
pHandling += 0xC2B9DC;
|
||||
|
||||
if (ImGui::Button("Reset handling", ImVec2(Ui::GetSize(3))))
|
||||
{
|
||||
@ -1149,72 +1179,75 @@ Only some vehicles will have them.");
|
||||
|
||||
if (ImGui::Button("Save to file", ImVec2(Ui::GetSize(3))))
|
||||
{
|
||||
GenerateHandlingDataFile(phandling);
|
||||
GenerateHandlingDataFile(pHandling);
|
||||
CHud::SetHelpMessage("Handling saved", false, false, false);
|
||||
}
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
if (ImGui::Button("Read more", ImVec2(Ui::GetSize(3))))
|
||||
ShellExecute(NULL, "open", "https://projectcerbera.com/gta/sa/tutorials/handling", NULL, NULL, SW_SHOWNORMAL);
|
||||
ShellExecute(NULL, "open", "https://projectcerbera.com/gta/sa/tutorials/handling", NULL, NULL,
|
||||
SW_SHOWNORMAL);
|
||||
|
||||
ImGui::Spacing();
|
||||
|
||||
ImGui::BeginChild("HandlingChild");
|
||||
|
||||
static std::vector<Ui::NamedValue> abs{ { "On", 1 }, { "Off", 0 } };
|
||||
Ui::EditRadioButtonAddressEx("Abs", phandling + 0x9C, abs);
|
||||
static std::vector<Ui::NamedValue> abs{{"On", 1}, {"Off", 0}};
|
||||
Ui::EditRadioButtonAddressEx("Abs", pHandling + 0x9C, abs);
|
||||
|
||||
Ui::EditFloat("Anti dive multiplier", phandling + 0xC4, 0.0f, 0.0f, 1.0f);
|
||||
Ui::EditFloat("Brake bias", phandling + 0x98, 0.0f, 0.0f, 1.0f);
|
||||
Ui::EditFloat("Brake deceleration", phandling + 0x94, 0.0f, 0.0f, 20.0f, 2500.0f);
|
||||
Ui::EditFloat("Centre of mass X", phandling + 0x14, -10.0f, -10.0f, 10.0f);
|
||||
Ui::EditFloat("Centre of mass Y", phandling + 0x18, -10.0f, -10.0f, 10.0f);
|
||||
Ui::EditFloat("Centre of mass Z", phandling + 0x1C, -10.0f, -10.0f, 10.0f);
|
||||
Ui::EditFloat("Collision damage multiplier", phandling + 0xC8, 0.0f, 0.0f, 1.0f, 0.3381f);
|
||||
Ui::EditFloat("Damping level", phandling + 0xB0, -10.0f, -10.0f, 10.0f); // test later
|
||||
Ui::EditFloat("Drag mult", phandling + 0x10, 0.0f, 0.0f, 30.0f);
|
||||
Ui::EditFloat("Anti dive multiplier", pHandling + 0xC4, 0.0f, 0.0f, 1.0f);
|
||||
Ui::EditFloat("Brake bias", pHandling + 0x98, 0.0f, 0.0f, 1.0f);
|
||||
Ui::EditFloat("Brake deceleration", pHandling + 0x94, 0.0f, 0.0f, 20.0f, 2500.0f);
|
||||
Ui::EditFloat("Centre of mass X", pHandling + 0x14, -10.0f, -10.0f, 10.0f);
|
||||
Ui::EditFloat("Centre of mass Y", pHandling + 0x18, -10.0f, -10.0f, 10.0f);
|
||||
Ui::EditFloat("Centre of mass Z", pHandling + 0x1C, -10.0f, -10.0f, 10.0f);
|
||||
Ui::EditFloat("Collision damage multiplier", pHandling + 0xC8, 0.0f, 0.0f, 1.0f, 0.3381f);
|
||||
Ui::EditFloat("Damping level", pHandling + 0xB0, -10.0f, -10.0f, 10.0f); // test later
|
||||
Ui::EditFloat("Drag mult", pHandling + 0x10, 0.0f, 0.0f, 30.0f);
|
||||
|
||||
static std::vector<Ui::NamedValue> drive_type{ { "Front wheel drive", 70 }, { "Rear wheel drive", 82 }, { "Four wheel drive", 52 } };
|
||||
Ui::EditRadioButtonAddressEx("Drive type", phandling + 0x74, drive_type);
|
||||
static std::vector<Ui::NamedValue> drive_type{
|
||||
{"Front wheel drive", 70}, {"Rear wheel drive", 82}, {"Four wheel drive", 52}
|
||||
};
|
||||
Ui::EditRadioButtonAddressEx("Drive type", pHandling + 0x74, drive_type);
|
||||
|
||||
Ui::EditFloat("Engine acceleration", phandling + 0x7C, 0.0f, 0.0f, 49.0f, 12500.0f);
|
||||
Ui::EditFloat("Engine inertia", phandling + 0x80, 0.0f, 0.0f, 400.0f);
|
||||
Ui::EditFloat("Engine acceleration", pHandling + 0x7C, 0.0f, 0.0f, 49.0f, 12500.0f);
|
||||
Ui::EditFloat("Engine inertia", pHandling + 0x80, 0.0f, 0.0f, 400.0f);
|
||||
|
||||
static std::vector<Ui::NamedValue> engine_type{ { "Petrol", 80 }, { "Diseal", 68 }, { "Electric", 69 } };
|
||||
Ui::EditRadioButtonAddressEx("Engine type", phandling + 0x75, engine_type);
|
||||
static std::vector<Ui::NamedValue> engine_type{{"Petrol", 80}, {"Diseal", 68}, {"Electric", 69}};
|
||||
Ui::EditRadioButtonAddressEx("Engine type", pHandling + 0x75, engine_type);
|
||||
|
||||
std::vector<Ui::NamedValue> front_lights{ { "Long", 0 }, { "Small", 1 }, { "Big", 2 }, { "Tall", 3 } };
|
||||
Ui::EditRadioButtonAddressEx("Front lights", phandling + 0xDC, front_lights);
|
||||
std::vector<Ui::NamedValue> front_lights{{"Long", 0}, {"Small", 1}, {"Big", 2}, {"Tall", 3}};
|
||||
Ui::EditRadioButtonAddressEx("Front lights", pHandling + 0xDC, front_lights);
|
||||
|
||||
Ui::EditFloat("Force level", phandling + 0xAC, -10.0f, -10.0f, 10.0f); // test later
|
||||
Ui::EditFloat("Force level", pHandling + 0xAC, -10.0f, -10.0f, 10.0f); // test later
|
||||
|
||||
Ui::EditBits("Handling flags", phandling + 0xD0, handling_flag_names);
|
||||
Ui::EditBits("Handling flags", pHandling + 0xD0, m_HandlingFlagNames);
|
||||
|
||||
Ui::EditFloat("High speed damping", phandling + 0xB4, -10.0f, -10.0f, 10.0f);// test later
|
||||
Ui::EditFloat("Lower limit", phandling + 0xBC, -10.0f, -10.0f, 10.0f);// test later
|
||||
Ui::EditFloat("Mass", phandling + 0x4, 1.0f, 1.0f, 50000.0f);
|
||||
Ui::EditFloat("High speed damping", pHandling + 0xB4, -10.0f, -10.0f, 10.0f); // test later
|
||||
Ui::EditFloat("Lower limit", pHandling + 0xBC, -10.0f, -10.0f, 10.0f); // test later
|
||||
Ui::EditFloat("Mass", pHandling + 0x4, 1.0f, 1.0f, 50000.0f);
|
||||
|
||||
///fcommon.UpdateAddress({ name = 'Max velocity',address = phandling + 0x84 ,size = 4,min = 0,max = 2,is_float = true,cvalue = 0.01 , save = false })
|
||||
|
||||
Ui::EditBits("Model flags", phandling + 0xCC, model_flag_names);
|
||||
Ui::EditBits("Model flags", pHandling + 0xCC, m_ModelFlagNames);
|
||||
|
||||
Ui::EditAddress<int>("Monetary value", phandling + 0xD8, 1, 1, 100000);
|
||||
Ui::EditAddress<BYTE>("Number of gears", phandling + 0x76, 1, 1, 10);
|
||||
Ui::EditAddress<BYTE>("Percent submerged", phandling + 0x20, 10, 10, 120);
|
||||
Ui::EditAddress<int>("Monetary value", pHandling + 0xD8, 1, 1, 100000);
|
||||
Ui::EditAddress<BYTE>("Number of gears", pHandling + 0x76, 1, 1, 10);
|
||||
Ui::EditAddress<BYTE>("Percent submerged", pHandling + 0x20, 10, 10, 120);
|
||||
|
||||
static std::vector<Ui::NamedValue> rear_lights{ { "Long", 0 }, { "Small", 1 }, { "Big", 2 }, { "Tall", 3 } };
|
||||
Ui::EditRadioButtonAddressEx("Rear lights", phandling + 0xDD, rear_lights);
|
||||
static std::vector<Ui::NamedValue> rear_lights{{"Long", 0}, {"Small", 1}, {"Big", 2}, {"Tall", 3}};
|
||||
Ui::EditRadioButtonAddressEx("Rear lights", pHandling + 0xDD, rear_lights);
|
||||
|
||||
Ui::EditFloat("Seat offset distance", phandling + 0xD4, 0.0f, 0.0f, 1.0f);
|
||||
Ui::EditFloat("Steering lock", phandling + 0xA0, 10.0f, 10.0f, 50.0f);
|
||||
Ui::EditFloat("Suspension bias", phandling + 0xC0, 0.0f, 0.0f, 1.0f);
|
||||
Ui::EditFloat("Traction bias", phandling + 0xA8, 0.0f, 0.0f, 1.0f);
|
||||
Ui::EditFloat("Traction loss", phandling + 0xA4, 0.0f, 0.0f, 1.0f);
|
||||
Ui::EditFloat("Traction multiplier", phandling + 0x28, 0.5f, 0.5f, 2.0f);
|
||||
Ui::EditFloat("Turn mass", phandling + 0xC, 20.0f, 20.0f, 1000.0f); // test later
|
||||
Ui::EditFloat("Upper limit", phandling + 0xB8, -1.0f, -1.0f, 1.0f);
|
||||
Ui::EditAddress<BYTE>("Vehicle anim group", phandling + 0xDE, 0, 0, 20);
|
||||
Ui::EditFloat("Seat offset distance", pHandling + 0xD4, 0.0f, 0.0f, 1.0f);
|
||||
Ui::EditFloat("Steering lock", pHandling + 0xA0, 10.0f, 10.0f, 50.0f);
|
||||
Ui::EditFloat("Suspension bias", pHandling + 0xC0, 0.0f, 0.0f, 1.0f);
|
||||
Ui::EditFloat("Traction bias", pHandling + 0xA8, 0.0f, 0.0f, 1.0f);
|
||||
Ui::EditFloat("Traction loss", pHandling + 0xA4, 0.0f, 0.0f, 1.0f);
|
||||
Ui::EditFloat("Traction multiplier", pHandling + 0x28, 0.5f, 0.5f, 2.0f);
|
||||
Ui::EditFloat("Turn mass", pHandling + 0xC, 20.0f, 20.0f, 1000.0f); // test later
|
||||
Ui::EditFloat("Upper limit", pHandling + 0xB8, -1.0f, -1.0f, 1.0f);
|
||||
Ui::EditAddress<BYTE>("Vehicle anim group", pHandling + 0xDE, 0, 0, 20);
|
||||
|
||||
ImGui::EndChild();
|
||||
|
||||
|
@ -5,77 +5,77 @@
|
||||
class Vehicle : Paint, Neon
|
||||
{
|
||||
private:
|
||||
inline static bool bike_fly = false;
|
||||
inline static bool dont_fall_bike = false;
|
||||
inline static bool veh_heavy = false;
|
||||
inline static bool veh_watertight = false;
|
||||
inline static bool veh_nodmg = false;
|
||||
inline static int door_menu_button = 0;
|
||||
inline static std::string door_names[6] =
|
||||
{ "Hood","Boot","Front left door","Front right door","Rear left door","Rear right door" };
|
||||
inline static int veh_remove_radius = 0;
|
||||
|
||||
inline static bool lock_speed = false;
|
||||
inline static float lock_speed_val = 0.0f;
|
||||
|
||||
inline static std::map<int, std::string> vehicle_ide;
|
||||
inline static std::vector<std::vector<float>> carcols_color_values;
|
||||
inline static std::map<std::string, std::vector<int>> carcols_car_data;
|
||||
|
||||
struct color
|
||||
inline static bool m_bBikeFly;
|
||||
inline static bool m_bDontFallBike;
|
||||
inline static bool m_bVehHeavy;
|
||||
inline static bool m_bVehWatertight;
|
||||
inline static bool m_bNoDamage;
|
||||
inline static int m_nDoorMenuButton;
|
||||
inline static std::string m_DoorNames[6] =
|
||||
{"Hood", "Boot", "Front left door", "Front right door", "Rear left door", "Rear right door"};
|
||||
inline static int m_nVehRemoveRadius;
|
||||
inline static bool m_bLockSpeed;
|
||||
inline static float m_fLockSpeed;
|
||||
inline static std::map<int, std::string> m_VehicleIDE;
|
||||
inline static std::vector<std::vector<float>> m_CarcolsColorData;
|
||||
inline static std::map<std::string, std::vector<int>> m_CarcolsCarData;
|
||||
static struct
|
||||
{
|
||||
inline static bool material_filter = true;
|
||||
inline static int radio_btn = 1;
|
||||
inline static bool show_all = false;
|
||||
inline static float color_picker[3]{ 0,0,0 };
|
||||
inline static bool m_bMatFilter = true;
|
||||
inline static int m_nRadioButton = 1;
|
||||
inline static bool bShowAll;
|
||||
inline static float m_fColorPicker[3]{0, 0, 0};
|
||||
} m_Color;
|
||||
static struct
|
||||
{
|
||||
inline static float m_fColorPicker[3]{0, 0, 0};
|
||||
inline static bool m_bRainbowEffect;
|
||||
inline static uint m_nRainbowTimer;
|
||||
inline static bool m_bApplyOnTraffic;
|
||||
inline static uint m_bTrafficTimer;
|
||||
} m_Neon;
|
||||
static struct
|
||||
{
|
||||
inline static SSearchData m_VehData;
|
||||
inline static bool m_bSpawnInside = true;
|
||||
inline static bool m_bSpawnInAir = true;
|
||||
inline static char m_nLicenseText[9];
|
||||
} m_Spawner;
|
||||
inline static SSearchData m_TextureData;
|
||||
inline static SSearchData m_TuneData;
|
||||
inline static bool m_bImagesLoaded;
|
||||
static struct
|
||||
{
|
||||
inline static bool m_bEnabled;
|
||||
inline static bool m_bCompAdded;
|
||||
} m_UnlimitedNitro;
|
||||
|
||||
inline static std::vector<std::string> (m_HandlingFlagNames) = // 32 flags
|
||||
{
|
||||
"1G_BOOST", "2G_BOOST", "NPC_ANTI_ROLL", "NPC_NEUTRAL_HANDL", "NO_HANDBRAKE", "STEER_REARWHEELS",
|
||||
"HB_REARWHEEL_STEER", "ALT_STEER_OPT",
|
||||
"WHEEL_F_NARROW2", "WHEEL_F_NARROW", "WHEEL_F_WIDE", "WHEEL_F_WIDE2", "WHEEL_R_NARROW2", "WHEEL_R_NARROW",
|
||||
"WHEEL_R_WIDE", "WHEEL_R_WIDE2",
|
||||
"HYDRAULIC_GEOM", "HYDRAULIC_INST", "HYDRAULIC_NONE", "NOS_INST", "OFFROAD_ABILITY", "OFFROAD_ABILITY2",
|
||||
"HALOGEN_LIGHTS", "PROC_REARWHEEL_1ST",
|
||||
"USE_MAXSP_LIMIT", "LOW_RIDER", "STREET_RACER", "SWINGING_CHASSIS", "Unused 1", "Unused 2", "Unused 3",
|
||||
"Unused 4"
|
||||
};
|
||||
|
||||
struct neon
|
||||
inline static std::vector<std::string> (m_ModelFlagNames) = // 32 flags
|
||||
{
|
||||
inline static float color_picker[3]{ 0,0,0 };
|
||||
inline static bool rainbow = false;
|
||||
inline static uint rainbow_timer = 0;
|
||||
inline static bool traffic = false;
|
||||
inline static uint traffic_timer = 0;
|
||||
};
|
||||
|
||||
struct spawner
|
||||
{
|
||||
inline static SearchData veh_data;
|
||||
inline static bool spawn_inside = true;
|
||||
inline static bool spawn_in_air = true;
|
||||
inline static char license_text[9] = "";
|
||||
};
|
||||
|
||||
inline static SearchData texture_data;
|
||||
inline static SearchData tune_data;
|
||||
inline static bool images_loaded = false;
|
||||
|
||||
struct unlimited_nitro
|
||||
{
|
||||
inline static bool enabled = false;
|
||||
inline static bool comp_added = false;
|
||||
};
|
||||
|
||||
inline static std::vector<std::string>(handling_flag_names) = // 32 flags
|
||||
{
|
||||
"1G_BOOST","2G_BOOST","NPC_ANTI_ROLL","NPC_NEUTRAL_HANDL","NO_HANDBRAKE","STEER_REARWHEELS","HB_REARWHEEL_STEER","ALT_STEER_OPT",
|
||||
"WHEEL_F_NARROW2","WHEEL_F_NARROW","WHEEL_F_WIDE","WHEEL_F_WIDE2","WHEEL_R_NARROW2","WHEEL_R_NARROW","WHEEL_R_WIDE","WHEEL_R_WIDE2",
|
||||
"HYDRAULIC_GEOM","HYDRAULIC_INST","HYDRAULIC_NONE","NOS_INST","OFFROAD_ABILITY","OFFROAD_ABILITY2","HALOGEN_LIGHTS","PROC_REARWHEEL_1ST",
|
||||
"USE_MAXSP_LIMIT","LOW_RIDER","STREET_RACER","SWINGING_CHASSIS","Unused 1","Unused 2","Unused 3","Unused 4"
|
||||
};
|
||||
|
||||
inline static std::vector<std::string>(model_flag_names) = // 32 flags
|
||||
{
|
||||
"IS_VAN","IS_BUS","IS_LOW","IS_BIG","REVERSE_BONNET","HANGING_BOOT","TAILGATE_BOOT","NOSWING_BOOT","NO_DOORS","TANDEM_SEATS",
|
||||
"SIT_IN_BOAT","CONVERTIBLE","NO_EXHAUST","DOUBLE_EXHAUST","NO1FPS_LOOK_BEHIND","FORCE_DOOR_CHECK","AXLE_F_NOTILT","AXLE_F_SOLID","AXLE_F_MCPHERSON",
|
||||
"AXLE_F_REVERSE","AXLE_R_NOTILT","AXLE_R_SOLID","AXLE_R_MCPHERSON","AXLE_R_REVERSE","IS_BIKE","IS_HELI","IS_PLANE","IS_BOAT","BOUNCE_PANELS",
|
||||
"DOUBLE_RWHEELS","FORCE_GROUND_CLEARANCE","IS_HATCHBAC1K"
|
||||
"IS_VAN", "IS_BUS", "IS_LOW", "IS_BIG", "REVERSE_BONNET", "HANGING_BOOT", "TAILGATE_BOOT", "NOSWING_BOOT",
|
||||
"NO_DOORS", "TANDEM_SEATS",
|
||||
"SIT_IN_BOAT", "CONVERTIBLE", "NO_EXHAUST", "DOUBLE_EXHAUST", "NO1FPS_LOOK_BEHIND", "FORCE_DOOR_CHECK",
|
||||
"AXLE_F_NOTILT", "AXLE_F_SOLID", "AXLE_F_MCPHERSON",
|
||||
"AXLE_F_REVERSE", "AXLE_R_NOTILT", "AXLE_R_SOLID", "AXLE_R_MCPHERSON", "AXLE_R_REVERSE", "IS_BIKE", "IS_HELI",
|
||||
"IS_PLANE", "IS_BOAT", "BOUNCE_PANELS",
|
||||
"DOUBLE_RWHEELS", "FORCE_GROUND_CLEARANCE", "IS_HATCHBAC1K"
|
||||
};
|
||||
|
||||
public:
|
||||
static void AddComponent(const std::string& component, const bool display_message = true);
|
||||
static void RemoveComponent(const std::string& component, const bool display_message = true);
|
||||
static void AddComponent(const std::string& component, bool display_message = true);
|
||||
static void RemoveComponent(const std::string& component, bool display_message = true);
|
||||
static std::string GetNameFromModel(int model);
|
||||
static int GetModelFromName(const char* name);
|
||||
static void SpawnVehicle(std::string& name);
|
||||
@ -87,4 +87,3 @@ public:
|
||||
~Vehicle();
|
||||
static void Draw();
|
||||
};
|
||||
|
||||
|
@ -9,33 +9,28 @@
|
||||
Visual::Visual()
|
||||
{
|
||||
if (GetModuleHandle("timecycle24.asi"))
|
||||
timecyc_hour = 24;
|
||||
m_nTimecycHour = 24;
|
||||
|
||||
Events::processScriptsEvent += []
|
||||
{
|
||||
// TODO: Needs improvement
|
||||
if (lock_weather)
|
||||
if (m_bLockWeather)
|
||||
{
|
||||
CWeather::OldWeatherType = weather_type_backup;
|
||||
CWeather::NewWeatherType = weather_type_backup;
|
||||
CWeather::OldWeatherType = m_nBacWeatherType;
|
||||
CWeather::NewWeatherType = m_nBacWeatherType;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Visual::~Visual()
|
||||
{
|
||||
}
|
||||
|
||||
// Thanks to GuruGuru
|
||||
int Visual::GetCurrentHourTimeId(int hour)
|
||||
{
|
||||
{
|
||||
if (hour == -1)
|
||||
{
|
||||
hour = CClock::ms_nGameClockHours;
|
||||
}
|
||||
|
||||
if (timecyc_hour == 24)
|
||||
if (m_nTimecycHour == 24)
|
||||
return hour;
|
||||
|
||||
if (hour < 5) return 0;
|
||||
@ -44,26 +39,26 @@ int Visual::GetCurrentHourTimeId(int hour)
|
||||
if (hour == 6) return 2;
|
||||
|
||||
if (7 <= hour && hour < 12) return 3;
|
||||
if (12 <= hour && hour < 19) return 4;
|
||||
if (12 <= hour && hour < 19) return 4;
|
||||
|
||||
if (hour == 19) return 5;
|
||||
if (hour == 19) return 5;
|
||||
if (hour == 20 || hour == 21) return 6;
|
||||
if (hour == 22 || hour == 23) return 7;
|
||||
|
||||
return NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool Visual::TimeCycColorEdit3(const char* label, uchar *r, uchar *g, uchar *b, ImGuiColorEditFlags flags)
|
||||
bool Visual::TimeCycColorEdit3(const char* label, uchar* r, uchar* g, uchar* b, ImGuiColorEditFlags flags)
|
||||
{
|
||||
bool rtn = false;
|
||||
int val = 23 * GetCurrentHourTimeId() + CWeather::OldWeatherType;
|
||||
|
||||
uchar *red = (uchar*)patch::GetPointer(int(r));
|
||||
uchar *green = (uchar*)patch::GetPointer(int(g));
|
||||
uchar *blue = (uchar*)patch::GetPointer(int(b));
|
||||
auto red = static_cast<uchar*>(patch::GetPointer(int(r)));
|
||||
auto green = static_cast<uchar*>(patch::GetPointer(int(g)));
|
||||
auto blue = static_cast<uchar*>(patch::GetPointer(int(b)));
|
||||
|
||||
float col[3]{red[val] / 255.0f, green[val] / 255.0f, blue[val] / 255.0f};
|
||||
|
||||
float col[3]{red[val]/255.0f,green[val]/255.0f,blue[val]/255.0f};
|
||||
|
||||
if (ImGui::ColorEdit3(label, col, flags))
|
||||
{
|
||||
red[val] = col[0] * 255;
|
||||
@ -71,22 +66,22 @@ bool Visual::TimeCycColorEdit3(const char* label, uchar *r, uchar *g, uchar *b,
|
||||
blue[val] = col[2] * 255;
|
||||
rtn = true;
|
||||
}
|
||||
|
||||
|
||||
return rtn;
|
||||
}
|
||||
|
||||
bool Visual::TimeCycColorEdit4(const char* label, uchar *r, uchar *g, uchar *b, uchar *a, ImGuiColorEditFlags flags)
|
||||
bool Visual::TimeCycColorEdit4(const char* label, uchar* r, uchar* g, uchar* b, uchar* a, ImGuiColorEditFlags flags)
|
||||
{
|
||||
bool rtn = false;
|
||||
int val = 23 * GetCurrentHourTimeId() + CWeather::OldWeatherType;
|
||||
|
||||
uchar *red = (uchar*)patch::GetPointer(int(r));
|
||||
uchar *green = (uchar*)patch::GetPointer(int(g));
|
||||
uchar *blue = (uchar*)patch::GetPointer(int(b));
|
||||
uchar *alpha = (uchar*)patch::GetPointer(int(a));
|
||||
|
||||
float col[4]{red[val]/255.0f,green[val]/255.0f,blue[val]/255.0f,alpha[val]/255.0f};
|
||||
|
||||
auto red = static_cast<uchar*>(patch::GetPointer(int(r)));
|
||||
auto green = static_cast<uchar*>(patch::GetPointer(int(g)));
|
||||
auto blue = static_cast<uchar*>(patch::GetPointer(int(b)));
|
||||
auto alpha = static_cast<uchar*>(patch::GetPointer(int(a)));
|
||||
|
||||
float col[4]{red[val] / 255.0f, green[val] / 255.0f, blue[val] / 255.0f, alpha[val] / 255.0f};
|
||||
|
||||
if (ImGui::ColorEdit4(label, col, flags))
|
||||
{
|
||||
red[val] = col[0] * 255;
|
||||
@ -98,29 +93,31 @@ bool Visual::TimeCycColorEdit4(const char* label, uchar *r, uchar *g, uchar *b,
|
||||
|
||||
return rtn;
|
||||
}
|
||||
template<typename T>
|
||||
inline int GetTCVal(T *addr, int index)
|
||||
|
||||
template <typename T>
|
||||
int GetTCVal(T* addr, int index)
|
||||
{
|
||||
T *arr = (T*)patch::GetPointer(int(addr));
|
||||
return int(arr[index]);
|
||||
T* arr = static_cast<T*>(patch::GetPointer(int(addr)));
|
||||
return static_cast<int>(arr[index]);
|
||||
}
|
||||
|
||||
void Visual::GenerateTimecycFile()
|
||||
{
|
||||
std::ofstream file;
|
||||
if (timecyc_hour == 24)
|
||||
if (m_nTimecycHour == 24)
|
||||
file = std::ofstream("timecyc_24h.dat");
|
||||
else
|
||||
file = std::ofstream("timecyc.dat");
|
||||
|
||||
for (uint i = 0; i < weather_names.size(); ++i)
|
||||
for (uint i = 0; i < m_WeatherNames.size(); ++i)
|
||||
{
|
||||
file << "\n\n//////////// " << weather_names[i] << "\n";
|
||||
file << "//\tAmb\t\t\t\t\tAmb Obj \t\t\t\tDir \t\t\t\t\tSky top\t\t\t\tSky bot\t\t\t\tSunCore\t\t\t\t\tSunCorona\t\t\tSunSz\tSprSz\tSprBght\t\tShdw\tLightShd\tPoleShd\t\tFarClp\t\tFogSt\tLightOnGround\tLowCloudsRGB\tBottomCloudRGB\t\tWaterRGBA\t\t\t\tARGB1\t\t\t\t\tARGB2\t\t\tCloudAlpha\t\tIntensityLimit\t\tWaterFogAlpha\tDirMult \n\n";
|
||||
file << "\n\n//////////// " << m_WeatherNames[i] << "\n";
|
||||
file <<
|
||||
"//\tAmb\t\t\t\t\tAmb Obj \t\t\t\tDir \t\t\t\t\tSky top\t\t\t\tSky bot\t\t\t\tSunCore\t\t\t\t\tSunCorona\t\t\tSunSz\tSprSz\tSprBght\t\tShdw\tLightShd\tPoleShd\t\tFarClp\t\tFogSt\tLightOnGround\tLowCloudsRGB\tBottomCloudRGB\t\tWaterRGBA\t\t\t\tARGB1\t\t\t\t\tARGB2\t\t\tCloudAlpha\t\tIntensityLimit\t\tWaterFogAlpha\tDirMult \n\n";
|
||||
|
||||
for (int j = 0; j < timecyc_hour; ++j)
|
||||
for (int j = 0; j < m_nTimecycHour; ++j)
|
||||
{
|
||||
if (timecyc_hour == 24)
|
||||
if (m_nTimecycHour == 24)
|
||||
{
|
||||
if (j >= 12)
|
||||
file << "// " << j << " PM\n";
|
||||
@ -129,49 +126,65 @@ void Visual::GenerateTimecycFile()
|
||||
}
|
||||
else
|
||||
{
|
||||
if (j == 0) file << "// Midnight\n";
|
||||
if (j == 1) file << "// 5 AM\n";
|
||||
if (j == 2) file << "// 6 AM\n";
|
||||
if (j == 3) file << "// 7 AM\n";
|
||||
if (j == 4) file << "// Midday\n";
|
||||
if (j == 5) file << "// 7 PM\n";
|
||||
if (j == 6) file << "// 8 PM\n";
|
||||
if (j == 7) file << "// 10 PM\n";
|
||||
if (j == 0) file << "// Midnight\n";
|
||||
if (j == 1) file << "// 5 AM\n";
|
||||
if (j == 2) file << "// 6 AM\n";
|
||||
if (j == 3) file << "// 7 AM\n";
|
||||
if (j == 4) file << "// Midday\n";
|
||||
if (j == 5) file << "// 7 PM\n";
|
||||
if (j == 6) file << "// 8 PM\n";
|
||||
if (j == 7) file << "// 10 PM\n";
|
||||
}
|
||||
|
||||
int val = 23 * j + i;
|
||||
|
||||
file << "\t" << GetTCVal(m_nAmbientRed,val) << " " << GetTCVal(m_nAmbientGreen,val) << " " << GetTCVal(m_nAmbientBlue,val) << " \t\t"
|
||||
file << "\t" << GetTCVal(m_nAmbientRed, val) << " " << GetTCVal(m_nAmbientGreen, val) << " " << GetTCVal(
|
||||
m_nAmbientBlue, val) << " \t\t"
|
||||
|
||||
<< "\t" << GetTCVal(m_nAmbientRed_Obj,val) << " " << GetTCVal(m_nAmbientGreen_Obj,val) << " " << GetTCVal(m_nAmbientBlue_Obj,val) << " \t\t"
|
||||
<< "\t" << GetTCVal(m_nAmbientRed_Obj, val) << " " << GetTCVal(m_nAmbientGreen_Obj, val) << " " <<
|
||||
GetTCVal(m_nAmbientBlue_Obj, val) << " \t\t"
|
||||
|
||||
<< "\t255 255 255\t\t" // unused
|
||||
|
||||
<< "\t" << GetTCVal(m_nSkyTopRed,val) << " " << GetTCVal(m_nSkyTopGreen,val) << " " << GetTCVal(m_nSkyTopBlue,val) << " \t\t"
|
||||
<< "\t" << GetTCVal(m_nSkyTopRed, val) << " " << GetTCVal(m_nSkyTopGreen, val) << " " << GetTCVal(
|
||||
m_nSkyTopBlue, val) << " \t\t"
|
||||
|
||||
<< "\t" << GetTCVal(m_nSkyBottomRed,val) << " " << GetTCVal(m_nSkyBottomGreen,val) << " " << GetTCVal(m_nSkyBottomBlue,val) << " \t\t"
|
||||
<< "\t" << GetTCVal(m_nSkyBottomRed, val) << " " << GetTCVal(m_nSkyBottomGreen, val) << " " << GetTCVal(
|
||||
m_nSkyBottomBlue, val) << " \t\t"
|
||||
|
||||
<< "\t" << GetTCVal(m_nSunCoreRed,val) << " " << GetTCVal(m_nSunCoreGreen,val) << " " << GetTCVal(m_nSunCoreBlue,val) << " \t\t"
|
||||
<< "\t" << GetTCVal(m_nSunCoreRed, val) << " " << GetTCVal(m_nSunCoreGreen, val) << " " << GetTCVal(
|
||||
m_nSunCoreBlue, val) << " \t\t"
|
||||
|
||||
<< "\t" << GetTCVal(m_nSunCoronaRed,val) << " " << GetTCVal(m_nSunCoronaGreen,val) << " " << GetTCVal(m_nSunCoronaBlue,val) << " \t\t"
|
||||
<< "\t" << GetTCVal(m_nSunCoronaRed, val) << " " << GetTCVal(m_nSunCoronaGreen, val) << " " << GetTCVal(
|
||||
m_nSunCoronaBlue, val) << " \t\t"
|
||||
|
||||
<< "\t" << (GetTCVal(m_fSunSize,val) - 0.5f) / 10.0f << " " << (GetTCVal(m_fSpriteSize,val) - 0.5f) / 10.0f << " " << (GetTCVal(m_fSpriteBrightness,val) - 0.5f) / 10.0f << " \t\t"
|
||||
<< "\t" << (GetTCVal(m_fSunSize, val) - 0.5f) / 10.0f << " " << (GetTCVal(m_fSpriteSize, val) - 0.5f) /
|
||||
10.0f << " " << (GetTCVal(m_fSpriteBrightness, val) - 0.5f) / 10.0f << " \t\t"
|
||||
|
||||
<< "\t" << GetTCVal(m_nShadowStrength,val) << " " << GetTCVal(m_nLightShadowStrength,val) << " " << GetTCVal(m_nPoleShadowStrength,val) << " \t\t"
|
||||
<< "\t" << GetTCVal(m_nShadowStrength, val) << " " << GetTCVal(m_nLightShadowStrength, val) << " " <<
|
||||
GetTCVal(m_nPoleShadowStrength, val) << " \t\t"
|
||||
|
||||
<< "\t" << GetTCVal(m_fFarClip,val) << " " << GetTCVal(m_fFogStart,val) << " " << (GetTCVal(m_fLightsOnGroundBrightness,val) - 0.5) / 10.0f << " \t\t"
|
||||
<< "\t" << GetTCVal(m_fFarClip, val) << " " << GetTCVal(m_fFogStart, val) << " " << (GetTCVal(
|
||||
m_fLightsOnGroundBrightness, val) - 0.5) / 10.0f << " \t\t"
|
||||
|
||||
<< "\t" << GetTCVal(m_nLowCloudsRed,val) << " " << GetTCVal(m_nLowCloudsGreen,val) << " " << GetTCVal(m_nLowCloudsBlue,val) << " \t\t"
|
||||
<< "\t" << GetTCVal(m_nLowCloudsRed, val) << " " << GetTCVal(m_nLowCloudsGreen, val) << " " << GetTCVal(
|
||||
m_nLowCloudsBlue, val) << " \t\t"
|
||||
|
||||
<< "\t" << GetTCVal(m_nFluffyCloudsBottomRed,val) << " " <<GetTCVal(m_nFluffyCloudsBottomGreen,val) << " " << GetTCVal(m_nFluffyCloudsBottomBlue,val) << " \t\t"
|
||||
<< "\t" << GetTCVal(m_nFluffyCloudsBottomRed, val) << " " << GetTCVal(m_nFluffyCloudsBottomGreen, val)
|
||||
<< " " << GetTCVal(m_nFluffyCloudsBottomBlue, val) << " \t\t"
|
||||
|
||||
<< "\t" << GetTCVal(m_fWaterRed,val) << " " << GetTCVal(m_fWaterGreen,val) << " " << GetTCVal(m_fWaterBlue,val) << " " << GetTCVal(m_fWaterAlpha,val) << " \t\t"
|
||||
<< "\t" << GetTCVal(m_fWaterRed, val) << " " << GetTCVal(m_fWaterGreen, val) << " " <<
|
||||
GetTCVal(m_fWaterBlue, val) << " " << GetTCVal(m_fWaterAlpha, val) << " \t\t"
|
||||
|
||||
<< "\t" << GetTCVal(m_fPostFx1Alpha,val) << " " << GetTCVal(m_fPostFx1Red,val) << " " << GetTCVal(m_fPostFx1Green,val) << " " << GetTCVal(m_fPostFx1Blue,val) << " \t\t"
|
||||
<< "\t" << GetTCVal(m_fPostFx1Alpha, val) << " " << GetTCVal(m_fPostFx1Red, val) << " " <<
|
||||
GetTCVal(m_fPostFx1Green, val) << " " << GetTCVal(m_fPostFx1Blue, val) << " \t\t"
|
||||
|
||||
<< "\t" << GetTCVal(m_fPostFx2Alpha,val) << " " << GetTCVal(m_fPostFx2Red,val) << " " << GetTCVal(m_fPostFx2Green,val) << " " << GetTCVal(m_fPostFx2Blue,val) << " \t\t"
|
||||
<< "\t" << GetTCVal(m_fPostFx2Alpha, val) << " " << GetTCVal(m_fPostFx2Red, val) << " " <<
|
||||
GetTCVal(m_fPostFx2Green, val) << " " << GetTCVal(m_fPostFx2Blue, val) << " \t\t"
|
||||
|
||||
<< "\t" << GetTCVal(m_fCloudAlpha,val) << " " << GetTCVal(m_nHighLightMinIntensity,val) << " " << GetTCVal(m_nWaterFogAlpha,val) << " " << GetTCVal(m_nDirectionalMult,val) / 100.0 << " \t\t" << std::endl;
|
||||
<< "\t" << GetTCVal(m_fCloudAlpha, val) << " " << GetTCVal(m_nHighLightMinIntensity, val) << " " <<
|
||||
GetTCVal(m_nWaterFogAlpha, val) << " " << GetTCVal(m_nDirectionalMult, val) / 100.0 << " \t\t" <<
|
||||
std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -183,7 +196,7 @@ void Visual::Draw()
|
||||
if (ImGui::BeginTabItem("Checkboxes"))
|
||||
{
|
||||
ImGui::Spacing();
|
||||
ImGui::Columns(2, 0, false);
|
||||
ImGui::Columns(2, nullptr, false);
|
||||
Ui::CheckboxAddress("Armour border", 0x589123);
|
||||
Ui::CheckboxAddress("Armour percentage", 0x589125);
|
||||
Ui::CheckboxAddress("Breath border", 0x589207);
|
||||
@ -204,8 +217,8 @@ void Visual::Draw()
|
||||
Command<Commands::DISPLAY_RADAR>(!CHud::bScriptDontDisplayRadar);
|
||||
|
||||
Ui::CheckboxAddressEx("Hide wanted level", 0x58DD1B, 0x90, 1);
|
||||
if (Ui::CheckboxWithHint("Lock weather", &lock_weather))
|
||||
weather_type_backup = CWeather::OldWeatherType;
|
||||
if (Ui::CheckboxWithHint("Lock weather", &m_bLockWeather))
|
||||
m_nBacWeatherType = CWeather::OldWeatherType;
|
||||
|
||||
if (Ui::CheckboxWithHint("Show hud", &CHud::m_Wants_To_Draw_Hud))
|
||||
Command<Commands::DISPLAY_HUD>(CHud::m_Wants_To_Draw_Hud);
|
||||
@ -244,7 +257,7 @@ void Visual::Draw()
|
||||
patch::SetPointer(0x583500, &radar_posY);
|
||||
patch::SetPointer(0x5834F6, &radar_height);
|
||||
patch::SetPointer(0x5834C2, &radar_width);
|
||||
|
||||
|
||||
patch::SetPointer(0x58A79B, &radar_posX);
|
||||
patch::SetPointer(0x58A7C7, &radar_posY);
|
||||
patch::SetPointer(0x58A801, &radar_height);
|
||||
@ -261,7 +274,7 @@ void Visual::Draw()
|
||||
patch::SetPointer(0x58A9C7, &radar_posY);
|
||||
patch::SetPointer(0x58A9D5, &radar_height);
|
||||
patch::SetPointer(0x58A99D, &radar_width);
|
||||
|
||||
|
||||
patch::SetPointer(0x5890FC, &armour_bar);
|
||||
patch::SetChar(0x5890F5, 0);
|
||||
patch::SetPointer(0x589331, &health_bar);
|
||||
@ -269,7 +282,7 @@ void Visual::Draw()
|
||||
patch::SetChar(0x5891E4, 0);
|
||||
patch::SetPointer(0x58EBD1, &clock_bar);
|
||||
patch::SetChar(0x58EBCA, 0);
|
||||
|
||||
|
||||
patch::SetPointer(0x58F5FC, &money_posX);
|
||||
patch::SetPointer(0x58F11F, &breath_posX);
|
||||
patch::SetPointer(0x58F100, &breath_posY);
|
||||
@ -278,13 +291,14 @@ void Visual::Draw()
|
||||
patch::SetPointer(0x58F913, &weapon_icon_posY);
|
||||
patch::SetPointer(0x58FA02, &weapon_ammo_posX);
|
||||
patch::SetPointer(0x58F9E6, &weapon_ammo_posY);
|
||||
|
||||
|
||||
init_patches = true;
|
||||
}
|
||||
|
||||
|
||||
if (ImGui::BeginChild("VisualsChild"))
|
||||
{
|
||||
ImGui::TextWrapped("These options won't work if you got any mods that drastically changes the game hud. i.e. Mobile Hud, GTA 5 Hud etc.");
|
||||
ImGui::TextWrapped(
|
||||
"These options won't work if you got any mods that drastically changes the game hud. i.e. Mobile Hud, GTA 5 Hud etc.");
|
||||
ImGui::Spacing();
|
||||
Ui::ColorPickerAddress("Armourbar color", *(int*)0x5890FC, ImVec4(180, 25, 29, 255));
|
||||
Ui::EditAddress<float>("Armourbar posX", 0x866B78, -999, 94, 999);
|
||||
@ -302,9 +316,11 @@ void Visual::Draw()
|
||||
Ui::ColorPickerAddress("Money color", 0xBAB230, ImVec4(54, 104, 44, 255));
|
||||
Ui::EditAddress<float>("Money posX", *(int*)0x58F5FC, -999, 32, 999);
|
||||
Ui::EditAddress<float>("Money posY", 0x866C88, -999, 89, 999);
|
||||
static std::vector<Ui::NamedValue> font_outline{ { "No outline", 0 }, { "Thin outline" ,1 }, { "Default outline" ,2 } };
|
||||
static std::vector<Ui::NamedValue> font_outline{
|
||||
{"No outline", 0}, {"Thin outline", 1}, {"Default outline", 2}
|
||||
};
|
||||
Ui::EditRadioButtonAddressEx("Money font outline", 0x58F58D, font_outline);
|
||||
static std::vector<Ui::NamedValue> style{ { "Style 1", 1 }, { "Style 2" ,2 }, { "Default style" ,3 } };
|
||||
static std::vector<Ui::NamedValue> style{{"Style 1", 1}, {"Style 2", 2}, {"Default style", 3}};
|
||||
Ui::EditRadioButtonAddressEx("Money font style", 0x58F57F, style);
|
||||
Ui::EditAddress<float>("Radar Height", *(int*)0x5834F6, 0, 76, 999);
|
||||
Ui::EditAddress<float>("Radar Width", *(int*)0x5834C2, 0, 94, 999);
|
||||
@ -312,7 +328,7 @@ void Visual::Draw()
|
||||
Ui::EditAddress<float>("Radar posY", *(int*)0x583500, -999, 104, 999);
|
||||
Ui::EditAddress<int>("Radar zoom", 0xA444A3, 0, 0, 170);
|
||||
Ui::ColorPickerAddress("Radio station color", 0xBAB24C, ImVec4(150, 150, 150, 255));
|
||||
static std::vector<Ui::NamedValue> star_border{ { "No border", 0 }, { "Default" ,1 }, { "Bold border" ,2 } };
|
||||
static std::vector<Ui::NamedValue> star_border{{"No border", 0}, {"Default", 1}, {"Bold border", 2}};
|
||||
Ui::EditRadioButtonAddressEx("Wanted star border", 0x58DD41, star_border);
|
||||
Ui::EditAddress<float>("Wanted posX", *(int*)0x58DD0F, -999, 29, 999);
|
||||
Ui::EditAddress<float>("Wanted posY", *(int*)0x58DDFC, -999, 114, 999);
|
||||
@ -327,7 +343,7 @@ void Visual::Draw()
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
|
||||
if ( timecyc_hour == 8 ? ImGui::BeginTabItem("Timecyc") : ImGui::BeginTabItem("Timecyc 24h"))
|
||||
if (m_nTimecycHour == 8 ? ImGui::BeginTabItem("Timecyc") : ImGui::BeginTabItem("Timecyc 24h"))
|
||||
{
|
||||
ImGui::Spacing();
|
||||
if (ImGui::Button("Generate timecyc file", Ui::GetSize(2)))
|
||||
@ -344,38 +360,38 @@ void Visual::Draw()
|
||||
ImGui::Spacing();
|
||||
|
||||
int weather = CWeather::OldWeatherType;
|
||||
if (Ui::ListBox("Current weather", weather_names, weather))
|
||||
if (Ui::ListBox("Current weather", m_WeatherNames, weather))
|
||||
CWeather::OldWeatherType = weather;
|
||||
|
||||
weather = CWeather::NewWeatherType;
|
||||
if (Ui::ListBox("Next weather", weather_names, weather))
|
||||
if (Ui::ListBox("Next weather", m_WeatherNames, weather))
|
||||
CWeather::NewWeatherType = weather;
|
||||
|
||||
ImGui::Spacing();
|
||||
int hour = CClock::ms_nGameClockHours;
|
||||
int minute = CClock::ms_nGameClockMinutes;
|
||||
|
||||
if (Game::sync_time)
|
||||
if (CGame::m_bSyncTime)
|
||||
{
|
||||
ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * 0.5f);
|
||||
}
|
||||
|
||||
if (ImGui::InputInt("Hour", &hour) & !Game::sync_time)
|
||||
|
||||
if (ImGui::InputInt("Hour", &hour) & !CGame::m_bSyncTime)
|
||||
{
|
||||
if (hour < 0) hour = 23;
|
||||
if (hour > 23) hour = 0;
|
||||
CClock::ms_nGameClockHours = hour;
|
||||
}
|
||||
|
||||
if (ImGui::InputInt("Minute", &minute) & !Game::sync_time)
|
||||
if (ImGui::InputInt("Minute", &minute) & !CGame::m_bSyncTime)
|
||||
{
|
||||
if (minute < 0) minute = 59;
|
||||
if (minute > 59) minute = 0;
|
||||
CClock::ms_nGameClockMinutes = minute;
|
||||
}
|
||||
|
||||
if (Game::sync_time)
|
||||
if (CGame::m_bSyncTime)
|
||||
{
|
||||
ImGui::PopStyleVar();
|
||||
ImGui::PopItemFlag();
|
||||
@ -392,12 +408,13 @@ void Visual::Draw()
|
||||
|
||||
TimeCycColorEdit3("Ambient", m_nAmbientRed, m_nAmbientGreen, m_nAmbientBlue);
|
||||
TimeCycColorEdit3("Ambient obj", m_nAmbientRed_Obj, m_nAmbientGreen_Obj, m_nAmbientBlue_Obj);
|
||||
TimeCycColorEdit3("Fluffy clouds", m_nFluffyCloudsBottomRed , m_nFluffyCloudsBottomGreen, m_nFluffyCloudsBottomBlue);
|
||||
TimeCycColorEdit3("Fluffy clouds", m_nFluffyCloudsBottomRed, m_nFluffyCloudsBottomGreen,
|
||||
m_nFluffyCloudsBottomBlue);
|
||||
TimeCycColorEdit3("Low clouds", m_nLowCloudsRed, m_nLowCloudsGreen, m_nLowCloudsBlue);
|
||||
|
||||
|
||||
TimeCycColorEdit4("Postfx 1", m_fPostFx1Red, m_fPostFx1Green, m_fPostFx1Blue, m_fPostFx1Alpha);
|
||||
TimeCycColorEdit4("Postfx 2", m_fPostFx2Red, m_fPostFx2Green, m_fPostFx2Blue, m_fPostFx1Alpha);
|
||||
|
||||
|
||||
TimeCycColorEdit3("Sky bottom", m_nSkyBottomRed, m_nSkyBottomGreen, m_nSkyBottomBlue);
|
||||
TimeCycColorEdit3("Sun core", m_nSunCoreRed, m_nSunCoreGreen, m_nSunCoreBlue);
|
||||
TimeCycColorEdit3("Sun corona", m_nSunCoronaRed, m_nSunCoronaGreen, m_nSunCoronaBlue);
|
||||
@ -413,7 +430,7 @@ void Visual::Draw()
|
||||
ImGui::BeginChild("TimecycMisc");
|
||||
ImGui::PushItemWidth(ImGui::GetWindowContentRegionWidth() / 2);
|
||||
TimecycSlider("Cloud alpha", m_fCloudAlpha, 0, 255);
|
||||
TimecycSlider("Directional mult", m_nDirectionalMult , 0, 255);
|
||||
TimecycSlider("Directional mult", m_nDirectionalMult, 0, 255);
|
||||
TimecycSlider("Far clip", m_fFarClip, 0, 2000);
|
||||
TimecycSlider("Fog start", m_fFogStart, 0, 1500);
|
||||
TimecycSlider("High light min intensity", m_nHighLightMinIntensity, 0, 255);
|
||||
|
@ -2,37 +2,39 @@
|
||||
class Visual
|
||||
{
|
||||
private:
|
||||
inline static bool lock_weather = false;
|
||||
inline static int weather_type_backup = 0;
|
||||
inline static bool m_bLockWeather;
|
||||
inline static int m_nBacWeatherType;
|
||||
|
||||
// Timecyc
|
||||
inline static int timecyc_hour = 8;
|
||||
inline static std::vector<std::string> weather_names
|
||||
inline static int m_nTimecycHour = 8;
|
||||
inline static std::vector<std::string> m_WeatherNames
|
||||
{
|
||||
"EXTRASUNNY LA","SUNNY LA","EXTRASUNNY SMOG LA","SUNNY SMOG LA","CLOUDY LA","SUNNY SF","EXTRASUNNY SF","CLOUDY SF","RAINY SF","FOGGY SF",
|
||||
"SUNNY VEGAS","EXTRASUNNY VEGAS","CLOUDY VEGAS","EXTRASUNNY COUNTRYSIDE","SUNNY COUNTRYSIDE","CLOUDY COUNTRYSIDE","RAINY COUNTRYSIDE",
|
||||
"EXTRASUNNY DESERT","SUNNY DESERT","SANDSTORM DESERT","UNDERWATER","EXTRACOLOURS 1","EXTRACOLOURS 2"
|
||||
"EXTRASUNNY LA", "SUNNY LA", "EXTRASUNNY SMOG LA", "SUNNY SMOG LA", "CLOUDY LA", "SUNNY SF", "EXTRASUNNY SF",
|
||||
"CLOUDY SF", "RAINY SF", "FOGGY SF",
|
||||
"SUNNY VEGAS", "EXTRASUNNY VEGAS", "CLOUDY VEGAS", "EXTRASUNNY COUNTRYSIDE", "SUNNY COUNTRYSIDE",
|
||||
"CLOUDY COUNTRYSIDE", "RAINY COUNTRYSIDE",
|
||||
"EXTRASUNNY DESERT", "SUNNY DESERT", "SANDSTORM DESERT", "UNDERWATER", "EXTRACOLOURS 1", "EXTRACOLOURS 2"
|
||||
};
|
||||
|
||||
static void GenerateTimecycFile();
|
||||
static int GetCurrentHourTimeId(int hour = -1);
|
||||
static bool TimeCycColorEdit3(const char* label, uchar* r, uchar* g, uchar* b, ImGuiColorEditFlags flags = 0);
|
||||
static bool TimeCycColorEdit4(const char* label, uchar* r, uchar* g, uchar* b, uchar* a, ImGuiColorEditFlags flags = 0);
|
||||
template<typename T>
|
||||
static bool TimeCycColorEdit4(const char* label, uchar* r, uchar* g, uchar* b, uchar* a,
|
||||
ImGuiColorEditFlags flags = 0);
|
||||
template <typename T>
|
||||
static void TimecycSlider(const char* label, T* data, int min, int max);
|
||||
public:
|
||||
Visual();
|
||||
~Visual();
|
||||
static void Draw();
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
template <typename T>
|
||||
void Visual::TimecycSlider(const char* label, T* ptr, int min, int max)
|
||||
{
|
||||
int val = 23 * GetCurrentHourTimeId() + CWeather::OldWeatherType;
|
||||
T* arr = (T*)patch::GetPointer(int(ptr));
|
||||
T* arr = static_cast<T*>(patch::GetPointer(int(ptr)));
|
||||
int a = arr[val];
|
||||
|
||||
if (ImGui::SliderInt(label, &a, min, max))
|
||||
arr[val] = (T)a;
|
||||
}
|
||||
arr[val] = static_cast<T>(a);
|
||||
}
|
||||
|
@ -8,14 +8,16 @@ Weapon::Weapon()
|
||||
{
|
||||
Events::processScriptsEvent += []
|
||||
{
|
||||
if (!images_loaded)
|
||||
if (!m_bImagesLoaded)
|
||||
{
|
||||
Util::LoadTexturesInDirRecursive(PLUGIN_PATH((char*)"CheatMenu\\weapons\\"), ".jpg", Weapon::weapon_data.categories, Weapon::weapon_data.images);
|
||||
images_loaded = true;
|
||||
Util::LoadTexturesInDirRecursive(
|
||||
PLUGIN_PATH((char*)"CheatMenu\\weapons\\"), ".jpg", Weapon::m_WeaponData.m_Categories,
|
||||
Weapon::m_WeaponData.m_ImagesList);
|
||||
m_bImagesLoaded = true;
|
||||
}
|
||||
|
||||
CPlayerPed *player = FindPlayerPed();
|
||||
if (auto_aim)
|
||||
|
||||
CPlayerPed* player = FindPlayerPed();
|
||||
if (m_bAutoAim)
|
||||
{
|
||||
if (CPad::NewMouseControllerState.X == 0 && CPad::NewMouseControllerState.Y == 0)
|
||||
{
|
||||
@ -27,15 +29,15 @@ Weapon::Weapon()
|
||||
}
|
||||
|
||||
uchar slot = player->m_nActiveWeaponSlot;
|
||||
if (cur_weapon_slot != slot)
|
||||
if (m_nCurrentWeaponSlot != slot)
|
||||
{
|
||||
auto weapon_type = player->m_aWeapons[slot].m_nType;
|
||||
CWeaponInfo *pweapon_info = CWeaponInfo::GetWeaponInfo(weapon_type, player->GetWeaponSkill(weapon_type));
|
||||
CWeaponInfo* pweapon_info = CWeaponInfo::GetWeaponInfo(weapon_type, player->GetWeaponSkill(weapon_type));
|
||||
|
||||
if (huge_damage)
|
||||
if (m_bHugeDamage)
|
||||
pweapon_info->m_nDamage = 1000;
|
||||
|
||||
if (long_range)
|
||||
if (m_bLongRange)
|
||||
{
|
||||
pweapon_info->m_fTargetRange = 1000.0f;
|
||||
pweapon_info->m_fWeaponRange = 1000.0f;
|
||||
@ -43,19 +45,20 @@ Weapon::Weapon()
|
||||
pweapon_info->m_nFlags.bReload2Start = true;
|
||||
}
|
||||
|
||||
if (rapid_fire && weapon_type != WEAPON_MINIGUN) // mingun doesn't work with rapidfire
|
||||
if (m_bRapidFire && weapon_type != WEAPON_MINIGUN) // mingun doesn't work with rapidfire
|
||||
pweapon_info->m_nFlags.bContinuosFire = true;
|
||||
|
||||
if (dual_weild && (weapon_type == WEAPON_PISTOL || weapon_type == WEAPON_MICRO_UZI || weapon_type == WEAPON_TEC9 || weapon_type == WEAPON_SAWNOFF))
|
||||
if (m_bDualWeild && (weapon_type == WEAPON_PISTOL || weapon_type == WEAPON_MICRO_UZI || weapon_type ==
|
||||
WEAPON_TEC9 || weapon_type == WEAPON_SAWNOFF))
|
||||
pweapon_info->m_nFlags.bTwinPistol = true;
|
||||
|
||||
if (move_aim)
|
||||
if (m_bMoveAim)
|
||||
pweapon_info->m_nFlags.bMoveAim = true;
|
||||
|
||||
if (move_fire)
|
||||
|
||||
if (m_bMoveFire)
|
||||
pweapon_info->m_nFlags.bMoveFire = true;
|
||||
|
||||
cur_weapon_slot = slot;
|
||||
m_nCurrentWeaponSlot = slot;
|
||||
}
|
||||
};
|
||||
}
|
||||
@ -63,13 +66,14 @@ Weapon::Weapon()
|
||||
|
||||
Weapon::~Weapon()
|
||||
{
|
||||
Util::ReleaseTextures(Weapon::weapon_data.images);
|
||||
Util::ReleaseTextures(Weapon::m_WeaponData.m_ImagesList);
|
||||
}
|
||||
|
||||
void Weapon::SetGangWeapon(std::string& weapon_type)
|
||||
{
|
||||
gang_weapons[selected_gang][selected_weapon_count] = std::stoi(weapon_type);
|
||||
CGangs::SetGangWeapons(selected_gang, gang_weapons[selected_gang][0], gang_weapons[selected_gang][1], gang_weapons[selected_gang][2]);
|
||||
m_nGangWeaponList[m_nSelectedGang][m_nSelectedWeapon] = std::stoi(weapon_type);
|
||||
CGangs::SetGangWeapons(m_nSelectedGang, m_nGangWeaponList[m_nSelectedGang][0], m_nGangWeaponList[m_nSelectedGang][1],
|
||||
m_nGangWeaponList[m_nSelectedGang][2]);
|
||||
}
|
||||
|
||||
void Weapon::GiveWeaponToPlayer(std::string& weapon_type)
|
||||
@ -86,25 +90,25 @@ void Weapon::GiveWeaponToPlayer(std::string& weapon_type)
|
||||
int model = NULL;
|
||||
Command<Commands::GET_WEAPONTYPE_MODEL>(iweapon_type, &model);
|
||||
|
||||
CStreaming::RequestModel(model,PRIORITY_REQUEST);
|
||||
CStreaming::RequestModel(model, PRIORITY_REQUEST);
|
||||
|
||||
if (model == 363) // remote bomb
|
||||
CStreaming::RequestModel(364,PRIORITY_REQUEST); // detonator
|
||||
CStreaming::RequestModel(364, PRIORITY_REQUEST); // detonator
|
||||
|
||||
CStreaming::LoadAllRequestedModels(false);
|
||||
|
||||
Command<Commands::GIVE_WEAPON_TO_CHAR>(hplayer, iweapon_type, ammo_count);
|
||||
Command<Commands::GIVE_WEAPON_TO_CHAR>(hplayer, iweapon_type, m_nAmmoCount);
|
||||
|
||||
if (model == 363) // remote bomb
|
||||
Command<Commands::MARK_MODEL_AS_NO_LONGER_NEEDED>(364); // detonator
|
||||
|
||||
Command<Commands::MARK_MODEL_AS_NO_LONGER_NEEDED>(model);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Weapon::Draw()
|
||||
{
|
||||
CPlayerPed *player = FindPlayerPed();
|
||||
CPlayerPed* player = FindPlayerPed();
|
||||
uint hplayer = CPools::GetPedRef(player);
|
||||
|
||||
ImGui::Spacing();
|
||||
@ -113,10 +117,10 @@ void Weapon::Draw()
|
||||
float x, y, z;
|
||||
Command<Commands::GET_OFFSET_FROM_CHAR_IN_WORLD_COORDS>(hplayer, 0.0, 3.0, 0.0, &x, &y, &z);
|
||||
auto type = player->m_aWeapons[player->m_nActiveWeaponSlot].m_nType;
|
||||
|
||||
|
||||
if (type)
|
||||
{
|
||||
int model =0, pickup = 0;
|
||||
int model = 0, pickup = 0;
|
||||
|
||||
Command<Commands::GET_WEAPONTYPE_MODEL>(type, &model);
|
||||
Command<Commands::CREATE_PICKUP_WITH_AMMO>(model, 3, 999, x, y, z, &pickup);
|
||||
@ -142,42 +146,43 @@ void Weapon::Draw()
|
||||
ImGui::BeginChild("CheckboxesChild");
|
||||
ImGui::Columns(2, 0, false);
|
||||
|
||||
Ui::CheckboxWithHint("Auto aim", &auto_aim, "Enables aim assist on keyboard\n\nQ = left E = right");
|
||||
if (Ui::CheckboxWithHint("Dual weild", &dual_weild,"Dual weild pistol, shawoff, uzi, tec9\n(Other weapons don't work)"))
|
||||
Ui::CheckboxWithHint("Auto aim", &m_bAutoAim, "Enables aim assist on keyboard\n\nQ = left E = right");
|
||||
if (Ui::CheckboxWithHint("Dual weild", &m_bDualWeild,
|
||||
"Dual weild pistol, shawoff, uzi, tec9\n(Other weapons don't work)"))
|
||||
{
|
||||
if (!dual_weild)
|
||||
if (!m_bDualWeild)
|
||||
CWeaponInfo::LoadWeaponData();
|
||||
}
|
||||
if (Ui::CheckboxWithHint("Huge damage", &huge_damage))
|
||||
if (Ui::CheckboxWithHint("Huge damage", &m_bHugeDamage))
|
||||
{
|
||||
if (!huge_damage)
|
||||
if (!m_bHugeDamage)
|
||||
CWeaponInfo::LoadWeaponData();
|
||||
}
|
||||
if (Ui::CheckboxWithHint("Fast reload", &fast_reload))
|
||||
Command<Commands::SET_PLAYER_FAST_RELOAD>(hplayer, fast_reload);
|
||||
if (Ui::CheckboxWithHint("Fast reload", &m_bFastReload))
|
||||
Command<Commands::SET_PLAYER_FAST_RELOAD>(hplayer, m_bFastReload);
|
||||
|
||||
Ui::CheckboxAddress("Infinite ammo", 0x969178);
|
||||
|
||||
ImGui::NextColumn();
|
||||
|
||||
if (Ui::CheckboxWithHint("Long range", &long_range))
|
||||
|
||||
if (Ui::CheckboxWithHint("Long range", &m_bLongRange))
|
||||
{
|
||||
if (!long_range)
|
||||
if (!m_bLongRange)
|
||||
CWeaponInfo::LoadWeaponData();
|
||||
}
|
||||
if (Ui::CheckboxWithHint("Move when aiming", &move_aim))
|
||||
if (Ui::CheckboxWithHint("Move when aiming", &m_bMoveAim))
|
||||
{
|
||||
if (!move_aim)
|
||||
if (!m_bMoveAim)
|
||||
CWeaponInfo::LoadWeaponData();
|
||||
}
|
||||
if (Ui::CheckboxWithHint("Move when firing", &move_fire))
|
||||
if (Ui::CheckboxWithHint("Move when firing", &m_bMoveFire))
|
||||
{
|
||||
if (!move_fire)
|
||||
if (!m_bMoveFire)
|
||||
CWeaponInfo::LoadWeaponData();
|
||||
}
|
||||
if (Ui::CheckboxWithHint("Rapid fire", &rapid_fire))
|
||||
if (Ui::CheckboxWithHint("Rapid fire", &m_bRapidFire))
|
||||
{
|
||||
if (!rapid_fire)
|
||||
if (!m_bRapidFire)
|
||||
CWeaponInfo::LoadWeaponData();
|
||||
}
|
||||
ImGui::Columns(1, 0, false);
|
||||
@ -187,36 +192,40 @@ void Weapon::Draw()
|
||||
if (ImGui::BeginTabItem("Gang weapon editor"))
|
||||
{
|
||||
ImGui::Spacing();
|
||||
Ui::ListBox("Select gang", Ped::gang_names, selected_gang);
|
||||
Ui::ListBox("Select gang", Ped::m_GangNames, m_nSelectedGang);
|
||||
|
||||
ImGui::Columns(3, 0, false);
|
||||
ImGui::RadioButton("Weap 1", &selected_weapon_count, 0);
|
||||
ImGui::RadioButton("Weap 1", &m_nSelectedWeapon, 0);
|
||||
ImGui::NextColumn();
|
||||
ImGui::RadioButton("Weap 2", &selected_weapon_count, 1);
|
||||
ImGui::RadioButton("Weap 2", &m_nSelectedWeapon, 1);
|
||||
ImGui::NextColumn();
|
||||
ImGui::RadioButton("Weap 3", &selected_weapon_count, 2);
|
||||
ImGui::RadioButton("Weap 3", &m_nSelectedWeapon, 2);
|
||||
ImGui::Columns(1);
|
||||
|
||||
ImGui::Spacing();
|
||||
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::Text("Current weapon: %s",
|
||||
m_WeaponData.m_Json.m_Data[std::to_string(m_nGangWeaponList[m_nSelectedGang][m_nSelectedWeapon])].get<
|
||||
std::string>().c_str());
|
||||
ImGui::Spacing();
|
||||
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*/ }
|
||||
Ui::DrawImages(m_WeaponData.m_ImagesList, ImVec2(65, 65), m_WeaponData.m_Categories, m_WeaponData.m_Selected,
|
||||
m_WeaponData.m_Filter, SetGangWeapon, nullptr,
|
||||
[](std::string str) { return m_WeaponData.m_Json.m_Data[str].get<std::string>(); },
|
||||
[](std::string str) { return str != "-1"; /*Jetpack*/ }
|
||||
);
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
if (ImGui::BeginTabItem("Spawn"))
|
||||
{
|
||||
ImGui::Spacing();
|
||||
if (ImGui::InputInt("Ammo", &ammo_count))
|
||||
if (ImGui::InputInt("Ammo", &m_nAmmoCount))
|
||||
{
|
||||
ammo_count = (ammo_count < 0) ? 0 : ammo_count;
|
||||
ammo_count = (ammo_count > 99999) ? 99999 : ammo_count;
|
||||
m_nAmmoCount = (m_nAmmoCount < 0) ? 0 : m_nAmmoCount;
|
||||
m_nAmmoCount = (m_nAmmoCount > 99999) ? 99999 : m_nAmmoCount;
|
||||
}
|
||||
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*/ }
|
||||
Ui::DrawImages(m_WeaponData.m_ImagesList, ImVec2(65, 65), m_WeaponData.m_Categories, m_WeaponData.m_Selected,
|
||||
m_WeaponData.m_Filter, GiveWeaponToPlayer, nullptr,
|
||||
[](std::string str) { return m_WeaponData.m_Json.m_Data[str].get<std::string>(); },
|
||||
[](std::string str) { return str != "0"; /*Unarmed*/ }
|
||||
);
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
|
@ -3,35 +3,32 @@
|
||||
class Weapon
|
||||
{
|
||||
public:
|
||||
inline static SearchData weapon_data{ "weapon" };
|
||||
inline static bool images_loaded = false;
|
||||
|
||||
inline static bool auto_aim = false;
|
||||
inline static bool fast_reload = false;
|
||||
inline static bool huge_damage = false;
|
||||
inline static bool long_range = false;
|
||||
inline static bool rapid_fire = false;
|
||||
inline static bool dual_weild = false;
|
||||
inline static bool move_aim = false;
|
||||
inline static bool move_fire = false;
|
||||
|
||||
inline static int ammo_count = 99999;
|
||||
inline static uchar cur_weapon_slot = -1;
|
||||
|
||||
inline static int selected_gang = 0;
|
||||
inline static int selected_weapon_count = 0;
|
||||
inline static int gang_weapons[10][3] =
|
||||
inline static SSearchData m_WeaponData{"weapon"};
|
||||
inline static bool m_bImagesLoaded;
|
||||
inline static bool m_bAutoAim;
|
||||
inline static bool m_bFastReload;
|
||||
inline static bool m_bHugeDamage;
|
||||
inline static bool m_bLongRange;
|
||||
inline static bool m_bRapidFire;
|
||||
inline static bool m_bDualWeild;
|
||||
inline static bool m_bMoveAim;
|
||||
inline static bool m_bMoveFire;
|
||||
inline static int m_nAmmoCount = 99999;
|
||||
inline static uchar m_nCurrentWeaponSlot = -1;
|
||||
inline static int m_nSelectedGang;
|
||||
inline static int m_nSelectedWeapon;
|
||||
inline static int m_nGangWeaponList[10][3] =
|
||||
{
|
||||
{WEAPON_PISTOL, WEAPON_MICRO_UZI, WEAPON_UNARMED }, // Ballas
|
||||
{WEAPON_PISTOL, WEAPON_UNARMED, WEAPON_UNARMED}, // Grove
|
||||
{WEAPON_PISTOL, WEAPON_UNARMED, WEAPON_UNARMED}, // Vagos
|
||||
{WEAPON_UNARMED, WEAPON_UNARMED, WEAPON_UNARMED}, // SF Rifa
|
||||
{WEAPON_PISTOL, WEAPON_MICRO_UZI, WEAPON_UNARMED}, // Da Nang Boys
|
||||
{WEAPON_DESERT_EAGLE , WEAPON_UNARMED, WEAPON_UNARMED}, // Mafia
|
||||
{WEAPON_PISTOL, WEAPON_AK47, WEAPON_UNARMED}, // Triads
|
||||
{WEAPON_PISTOL, WEAPON_MICRO_UZI, WEAPON_UNARMED}, // VLA
|
||||
{WEAPON_UNARMED, WEAPON_UNARMED, WEAPON_UNARMED}, // Gang 9
|
||||
{WEAPON_UNARMED, WEAPON_UNARMED, WEAPON_UNARMED}, // Gang 10
|
||||
{WEAPON_PISTOL, WEAPON_MICRO_UZI, WEAPON_UNARMED}, // Ballas
|
||||
{WEAPON_PISTOL, WEAPON_UNARMED, WEAPON_UNARMED}, // Grove
|
||||
{WEAPON_PISTOL, WEAPON_UNARMED, WEAPON_UNARMED}, // Vagos
|
||||
{WEAPON_UNARMED, WEAPON_UNARMED, WEAPON_UNARMED}, // SF Rifa
|
||||
{WEAPON_PISTOL, WEAPON_MICRO_UZI, WEAPON_UNARMED}, // Da Nang Boys
|
||||
{WEAPON_DESERT_EAGLE, WEAPON_UNARMED, WEAPON_UNARMED}, // Mafia
|
||||
{WEAPON_PISTOL, WEAPON_AK47, WEAPON_UNARMED}, // Triads
|
||||
{WEAPON_PISTOL, WEAPON_MICRO_UZI, WEAPON_UNARMED}, // VLA
|
||||
{WEAPON_UNARMED, WEAPON_UNARMED, WEAPON_UNARMED}, // Gang 9
|
||||
{WEAPON_UNARMED, WEAPON_UNARMED, WEAPON_UNARMED}, // Gang 10
|
||||
};
|
||||
|
||||
Weapon();
|
||||
@ -41,4 +38,3 @@ public:
|
||||
static void GiveWeaponToPlayer(std::string& weapon_type);
|
||||
static void SetGangWeapon(std::string& weapon_type);
|
||||
};
|
||||
|
||||
|
@ -64,7 +64,7 @@
|
||||
#include "VKeys.h"
|
||||
|
||||
// Globals
|
||||
typedef std::vector<std::pair<std::string, void(*)()>> CallbackTable;
|
||||
using CallbackTable = std::vector<std::pair<std::string, void(*)()>>;
|
||||
using namespace plugin;
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
@ -77,39 +77,37 @@ enum Renderer
|
||||
|
||||
struct Globals
|
||||
{
|
||||
inline static std::string header_id = "";
|
||||
inline static ImVec2 menu_size = ImVec2(screen::GetScreenWidth() / 4, screen::GetScreenHeight() / 1.2);
|
||||
inline static ImVec2 screen_size = ImVec2(-1, -1);
|
||||
inline static bool show_menu = false;
|
||||
inline static bool init_done = false;
|
||||
inline static bool menu_closing = false;
|
||||
inline static std::string m_HeaderId;
|
||||
inline static ImVec2 m_fMenuSize = ImVec2(screen::GetScreenWidth() / 4, screen::GetScreenHeight() / 1.2);
|
||||
inline static ImVec2 m_fScreenSize = ImVec2(-1, -1);
|
||||
inline static bool m_bShowMenu;
|
||||
inline static bool m_bInit;
|
||||
inline static Renderer renderer = Render_Unknown;
|
||||
inline static void* device = nullptr;
|
||||
inline static void* device;
|
||||
};
|
||||
|
||||
extern std::ofstream flog;
|
||||
extern CJson config;
|
||||
|
||||
struct TextureStructure
|
||||
struct STextureStructure
|
||||
{
|
||||
std::string file_name;
|
||||
std::string category_name;
|
||||
void* texture = nullptr;
|
||||
std::string m_FileName;
|
||||
std::string m_CategoryName;
|
||||
void* m_pTexture;
|
||||
};
|
||||
|
||||
struct HotKeyData
|
||||
{
|
||||
int key1;
|
||||
int key2;
|
||||
bool is_down = false;
|
||||
int m_key1;
|
||||
int m_key2;
|
||||
bool m_bPressed;
|
||||
};
|
||||
|
||||
|
||||
struct SearchData
|
||||
struct SSearchData
|
||||
{
|
||||
CJson json;
|
||||
ImGuiTextFilter filter = "";
|
||||
std::vector<std::string> categories;
|
||||
std::string selected = "All";
|
||||
std::vector<std::unique_ptr<TextureStructure>> images;
|
||||
CJson m_Json;
|
||||
ImGuiTextFilter m_Filter = "";
|
||||
std::vector<std::string> m_Categories;
|
||||
std::string m_Selected = "All";
|
||||
std::vector<std::unique_ptr<STextureStructure>> m_ImagesList;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user