Bug fixes & code cleanup

1. Fixes some issues with the last commit
2. Fixed a bug with remove all vehicles in radius
3. Added some tooltips in the ui
4. Added option to hide the updater screen
5. Fixed a bug with vehicles tab
This commit is contained in:
Grinch_ 2021-06-19 19:00:13 +06:00
parent 355db293b9
commit 157f22e681
18 changed files with 401 additions and 396 deletions

View File

@ -3,39 +3,39 @@
#include "Ui.h"
#include "Util.h"
CAnimation::CAnimation()
Animation::Animation()
{
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);
m_Cutscene::m_Data.m_Json.LoadData(m_Cutscene::m_Data.m_Categories, m_Cutscene::m_Data.m_Selected);
Events::processScriptsEvent += [this]
{
if (m_Cutscene.m_bRunning)
if (m_Cutscene::m_bRunning)
{
if (Command<Commands::HAS_CUTSCENE_FINISHED>())
{
Command<Commands::CLEAR_CUTSCENE>();
m_Cutscene.m_bRunning = false;
m_Cutscene.m_SceneName = "";
m_Cutscene::m_bRunning = false;
m_Cutscene::m_SceneName = "";
CPlayerPed* player = FindPlayerPed();
player->m_nAreaCode = m_Cutscene.m_nInterior;
player->m_nAreaCode = m_Cutscene::m_nInterior;
Command<Commands::SET_AREA_VISIBLE>(player->m_nAreaCode);
m_Cutscene.m_nInterior = 0;
m_Cutscene::m_nInterior = 0;
TheCamera.Fade(0, 1);
}
}
else
{
if (m_Cutscene.m_SceneName != "" && Command<Commands::HAS_CUTSCENE_LOADED>())
if (m_Cutscene::m_SceneName != "" && Command<Commands::HAS_CUTSCENE_LOADED>())
{
Command<Commands::START_CUTSCENE>();
m_Cutscene.m_bRunning = true;
m_Cutscene::m_bRunning = true;
}
}
};
}
void CAnimation::PlayCutscene(std::string& rootKey, std::string& cutsceneId, std::string& interior)
void Animation::PlayCutscene(std::string& rootKey, std::string& cutsceneId, std::string& interior)
{
if (Util::IsOnCutscene())
{
@ -43,15 +43,15 @@ void CAnimation::PlayCutscene(std::string& rootKey, std::string& cutsceneId, std
return;
}
m_Cutscene.m_SceneName = cutsceneId;
m_Cutscene::m_SceneName = cutsceneId;
Command<Commands::LOAD_CUTSCENE>(cutsceneId.c_str());
CPlayerPed* pPlayer = FindPlayerPed();
m_Cutscene.m_nInterior = pPlayer->m_nAreaCode;
m_Cutscene::m_nInterior = pPlayer->m_nAreaCode;
pPlayer->m_nAreaCode = std::stoi(interior);
Command<Commands::SET_AREA_VISIBLE>(pPlayer->m_nAreaCode);
}
void CAnimation::Draw()
void Animation::Draw()
{
if (ImGui::BeginTabBar("Animation", ImGuiTabBarFlags_NoTooltip + ImGuiTabBarFlags_FittingPolicyScroll))
{
@ -73,8 +73,10 @@ void CAnimation::Draw()
ImGui::Columns(2, nullptr, false);
ImGui::Checkbox("Loop", &m_Loop);
Ui::ShowTooltip("Keep playing the animation on repeat");
ImGui::NextColumn();
ImGui::Checkbox("Secondary", &m_bSecondary);
Ui::ShowTooltip("Player can move while playing the animation");
ImGui::Columns(1);
ImGui::Spacing();
@ -91,12 +93,12 @@ void CAnimation::Draw()
if (ImGui::BeginTabItem("Misc"))
{
ImGui::Spacing();
if (Ui::ListBox("Fighting", m_FightingStyleList, m_nFightingStyle))
if (Ui::ListBox("Fighting style", m_FightingStyleList, m_nFightingStyle))
{
Command<Commands::GIVE_MELEE_ATTACK_TO_CHAR>(hPlayer, m_nFightingStyle + 4, 6);
CHud::SetHelpMessage("Fighting anim set", false, false, false);
}
if (Ui::ListBoxStr("Walking", m_WalkingStyleList, m_nWalkingStyle))
if (Ui::ListBoxStr("Walking style", m_WalkingStyleList, m_nWalkingStyle))
{
if (m_nWalkingStyle == "default")
{
@ -135,15 +137,15 @@ void CAnimation::Draw()
ImGui::Spacing();
if (ImGui::Button("Stop cutscene", Ui::GetSize()))
{
if (m_Cutscene.m_bRunning)
if (m_Cutscene::m_bRunning)
{
Command<Commands::CLEAR_CUTSCENE>();
m_Cutscene.m_bRunning = false;
m_Cutscene.m_SceneName = "";
m_Cutscene::m_bRunning = false;
m_Cutscene::m_SceneName = "";
CPlayerPed* player = FindPlayerPed();
player->m_nAreaCode = m_Cutscene.m_nInterior;
player->m_nAreaCode = m_Cutscene::m_nInterior;
Command<Commands::SET_AREA_VISIBLE>(player->m_nAreaCode);
m_Cutscene.m_nInterior = 0;
m_Cutscene::m_nInterior = 0;
TheCamera.Fade(0, 1);
}
}
@ -152,8 +154,8 @@ void CAnimation::Draw()
if (ImGui::BeginChild("Cutscene Child"))
{
ImGui::Spacing();
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);
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 +164,7 @@ void CAnimation::Draw()
}
}
void CAnimation::PlayAnimation(std::string& ifp, std::string& anim, std::string& ifpRepeat)
void Animation::PlayAnimation(std::string& ifp, std::string& anim, std::string& ifpRepeat)
{
int hplayer = CPools::GetPedRef(FindPlayerPed());
@ -182,7 +184,7 @@ void CAnimation::PlayAnimation(std::string& ifp, std::string& anim, std::string&
Command<Commands::REMOVE_ANIMATION>(ifp.c_str());
}
void CAnimation::RemoveAnimation(std::string& ifp, std::string& anim, std::string& ifpRepeat)
void Animation::RemoveAnimation(std::string& ifp, std::string& anim, std::string& ifpRepeat)
{
if (ifp == "Custom")
{

View File

@ -1,22 +1,21 @@
#pragma once
class CAnimation
class Animation
{
private:
inline static char m_nAnimBuffer[INPUT_BUFFER_SIZE] = "";
inline static char m_nAnimBuffer[INPUT_BUFFER_SIZE];
inline static SSearchData m_AnimData{ "animation" };
static struct
struct m_Cutscene
{
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_SceneName;
inline static int m_nInterior;
inline static bool m_bRunning;
};
inline static int m_nFightingStyle;
inline static char m_nIfpBuffer[INPUT_BUFFER_SIZE];
inline static bool m_Loop;
inline static bool m_bSecondary;
inline static std::string m_nWalkingStyle = "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 =
{
@ -26,7 +25,7 @@ private:
};
protected:
CAnimation();
Animation();
public:
static void Draw();

View File

@ -12,7 +12,7 @@ void CheatMenu::DrawWindow()
m_bShowMouse = false;
else
{
if (Globals::m_bShowMenu || m_Commands.m_bShowMenu)
if (Globals::m_bShowMenu || m_Commands::m_bShowMenu)
{
if (Globals::m_bShowMenu)
{
@ -59,17 +59,17 @@ CheatMenu::CheatMenu()
{
if (Globals::m_bInit && !FrontEndMenuManager.m_bMenuActive)
{
if (Ui::HotKeyPressed(m_HotKeys.menuOpen))
if (Ui::HotKeyPressed(Menu::m_HotKeys::menuOpen))
Globals::m_bShowMenu = !Globals::m_bShowMenu;
if (Ui::HotKeyPressed(m_HotKeys.commandWindow))
if (Ui::HotKeyPressed(Menu::m_HotKeys::commandWindow))
{
if (m_Commands.m_bShowMenu)
if (m_Commands::m_bShowMenu)
{
ProcessCommands();
strcpy(m_Commands.m_nInputBuffer, "");
strcpy(m_Commands::m_nInputBuffer, "");
}
m_Commands.m_bShowMenu = !m_Commands.m_bShowMenu;
m_Commands::m_bShowMenu = !m_Commands::m_bShowMenu;
}
if (m_bShowMouse != Globals::m_bShowMenu)

View File

@ -1,4 +1,6 @@
/*
Author: Grinch_
Copyright GPLv3 2019-2021
Required:
DirectX 9 SDK
Plugin SDK
@ -18,14 +20,14 @@
#include "Visual.h"
#include "Weapon.h"
class CheatMenu : Hook, CAnimation, CGame, Menu, Ped, Player, Teleport, Vehicle, Visual, Weapon
class CheatMenu : Hook, Animation, Game, Menu, Ped, Player, Teleport, Vehicle, Visual, Weapon
{
private:
inline static CallbackTable header
{
{"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}
{"Animation", &Animation::Draw}, {"Vehicle", &Vehicle::Draw}, {"Weapon", &Weapon::Draw},
{"Game", &Game::Draw}, {"Visual", &Visual::Draw}, {"Menu", &Menu::Draw}
};
static void ApplyStyle();

View File

@ -6,7 +6,7 @@
#include "CIplStore.h"
// Thanks to aap
void CGame::RealTimeClock()
void Game::RealTimeClock()
{
static int lastday;
time_t tmp = time(nullptr);
@ -24,22 +24,22 @@ void CGame::RealTimeClock()
CClock::ms_nGameClockSeconds = now->tm_sec;
}
CGame::CGame()
Game::Game()
{
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();
m_Freecam::m_fFOV = TheCamera.FindCamFOV();
// Generate enabled cheats vector
for (auto element : m_RandomCheats.m_Json.m_Data.items())
for (auto element : m_RandomCheats::m_Json.m_Data.items())
{
/*
[
cheat_id = [ cheat_name, state (true/false) ]
]
*/
m_RandomCheats.m_EnabledCheats[std::stoi(element.key())][0] = element.value().get<std::string>();
m_RandomCheats.m_EnabledCheats[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 += []
@ -50,14 +50,14 @@ CGame::CGame()
if (m_bScreenShot)
{
if (Ui::HotKeyPressed(Menu::m_HotKeys.quickSceenShot))
if (Ui::HotKeyPressed(Menu::m_HotKeys::quickSceenShot))
{
Command<Commands::TAKE_PHOTO>();
CHud::SetHelpMessage("Screenshot taken", false, false, false);
}
}
if (m_HardMode.m_bEnabled)
if (m_HardMode::m_bEnabled)
{
if (pPlayer->m_fHealth > 50.0f)
pPlayer->m_fHealth = 50.0f;
@ -108,8 +108,8 @@ CGame::CGame()
m_nSyncTimer = timer;
}
if (m_RandomCheats.m_bEnabled
&& (timer - m_RandomCheats.m_nTimer) > (static_cast<uint>(m_RandomCheats.m_nInterval) * 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 @@ CGame::CGame()
{
if (i == id)
{
if (m_RandomCheats.m_EnabledCheats[i][1] == "true")
if (m_RandomCheats::m_EnabledCheats[i][1] == "true")
{
((void(*)(int))0x00438370)(id); // cheatEnableLegimate(int CheatID)
CHud::SetHelpMessage(m_RandomCheats.m_EnabledCheats[i][0].c_str(), false, false, false);
m_RandomCheats.m_nTimer = timer;
CHud::SetHelpMessage(m_RandomCheats::m_EnabledCheats[i][0].c_str(), false, false, false);
m_RandomCheats::m_nTimer = timer;
}
break;
}
}
}
if (Ui::HotKeyPressed(Menu::m_HotKeys.freeCam))
if (Ui::HotKeyPressed(Menu::m_HotKeys::freeCam))
{
if (m_Freecam.m_bEnabled)
if (m_Freecam::m_bEnabled)
{
m_Freecam.m_bEnabled = false;
m_Freecam::m_bEnabled = false;
ClearFreecamStuff();
}
else m_Freecam.m_bEnabled = true;
else m_Freecam::m_bEnabled = true;
}
if (m_Freecam.m_bEnabled)
if (m_Freecam::m_bEnabled)
FreeCam();
};
}
@ -158,12 +158,12 @@ void SetPlayerMission(std::string& rootkey, std::string& name, std::string& id)
else CHud::SetHelpMessage("Can't start mission now", false, false, false);
}
void CGame::FreeCam()
void Game::FreeCam()
{
int deltaSpeed = m_Freecam.m_fSpeed * (CTimer::m_snTimeInMillisecondsNonClipped -
int deltaSpeed = m_Freecam::m_fSpeed * (CTimer::m_snTimeInMillisecondsNonClipped -
CTimer::m_snPreviousTimeInMillisecondsNonClipped);
if (!m_Freecam.m_bInitDone)
if (!m_Freecam::m_bInitDone)
{
CPlayerPed* player = FindPlayerPed(-1);
Command<Commands::SET_EVERYONE_IGNORE_PLAYER>(0, true);
@ -172,41 +172,41 @@ void CGame::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, &m_Freecam.m_nPed);
m_Freecam.m_pPed = CPools::GetPed(m_Freecam.m_nPed);
m_Freecam.m_pPed->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>(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);
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);
m_Freecam.m_fTotalMouse.x = player->GetHeading() + 89.6f;
m_Freecam.m_fTotalMouse.y = 0;
m_Freecam::m_fTotalMouse.x = player->GetHeading() + 89.6f;
m_Freecam::m_fTotalMouse.y = 0;
m_Freecam.m_bInitDone = true;
m_Freecam::m_bInitDone = true;
player_pos.z -= 20;
m_Freecam.m_pPed->SetPosn(player_pos);
m_Freecam::m_pPed->SetPosn(player_pos);
TheCamera.LerpFOV(TheCamera.FindCamFOV(), m_Freecam.m_fFOV, 1000, true);
TheCamera.LerpFOV(TheCamera.FindCamFOV(), m_Freecam::m_fFOV, 1000, true);
Command<Commands::CAMERA_PERSIST_FOV>(true);
}
CVector pos = m_Freecam.m_pPed->GetPosition();
CVector pos = m_Freecam::m_pPed->GetPosition();
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;
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 (m_Freecam.m_fTotalMouse.x > 150)
m_Freecam.m_fTotalMouse.y = 150;
if (m_Freecam::m_fTotalMouse.x > 150)
m_Freecam::m_fTotalMouse.y = 150;
if (m_Freecam.m_fTotalMouse.y < -150)
m_Freecam.m_fTotalMouse.y = -150;
if (m_Freecam::m_fTotalMouse.y < -150)
m_Freecam::m_fTotalMouse.y = -150;
if (Ui::HotKeyPressed(Menu::m_HotKeys.freeCamTeleportPlayer))
if (Ui::HotKeyPressed(Menu::m_HotKeys::freeCamTeleportPlayer))
{
CPlayerPed* player = FindPlayerPed(-1);
CVector pos = m_Freecam.m_pPed->GetPosition();
CVector pos = m_Freecam::m_pPed->GetPosition();
CEntity* player_entity = FindPlayerEntity(-1);
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);
@ -229,10 +229,10 @@ void CGame::FreeCam()
deltaSpeed *= -1;
float angle;
Command<Commands::GET_CHAR_HEADING>(m_Freecam.m_nPed, &angle);
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);
pos.z += deltaSpeed * 2 * sin(m_Freecam::m_fTotalMouse.y / 3 * 3.14159f / 180.0f);
}
if (KeyPressed(VK_KEY_J) || KeyPressed(VK_KEY_L))
@ -241,7 +241,7 @@ void CGame::FreeCam()
deltaSpeed *= -1;
float angle;
Command<Commands::GET_CHAR_HEADING>(m_Freecam.m_nPed, &angle);
Command<Commands::GET_CHAR_HEADING>(m_Freecam::m_nPed, &angle);
angle -= 90;
pos.x += deltaSpeed * cos(angle * 3.14159f / 180.0f);
@ -250,43 +250,43 @@ void CGame::FreeCam()
if (CPad::NewMouseControllerState.wheelUp)
{
if (m_Freecam.m_fFOV > 10.0f)
m_Freecam.m_fFOV -= 2.0f * deltaSpeed;
if (m_Freecam::m_fFOV > 10.0f)
m_Freecam::m_fFOV -= 2.0f * deltaSpeed;
TheCamera.LerpFOV(TheCamera.FindCamFOV(), m_Freecam.m_fFOV, 250, true);
TheCamera.LerpFOV(TheCamera.FindCamFOV(), m_Freecam::m_fFOV, 250, true);
Command<Commands::CAMERA_PERSIST_FOV>(true);
}
if (CPad::NewMouseControllerState.wheelDown)
{
if (m_Freecam.m_fFOV < 115.0f)
m_Freecam.m_fFOV += 2.0f * deltaSpeed;
if (m_Freecam::m_fFOV < 115.0f)
m_Freecam::m_fFOV += 2.0f * deltaSpeed;
TheCamera.LerpFOV(TheCamera.FindCamFOV(), m_Freecam.m_fFOV, 250, true);
TheCamera.LerpFOV(TheCamera.FindCamFOV(), m_Freecam::m_fFOV, 250, true);
Command<Commands::CAMERA_PERSIST_FOV>(true);
}
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);
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 CGame::ClearFreecamStuff()
void Game::ClearFreecamStuff()
{
m_Freecam.m_bInitDone = 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>(m_Freecam.m_nPed);
m_Freecam.m_pPed = 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 CGame::Draw()
void Game::Draw()
{
ImGui::Spacing();
CPlayerPed* pPlayer = FindPlayerPed();
@ -339,25 +339,25 @@ of LS without completing missions"))
ImGui::NextColumn();
if (Ui::CheckboxWithHint("Hard mode", &m_HardMode.m_bEnabled, "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 (m_HardMode.m_bEnabled)
if (m_HardMode::m_bEnabled)
{
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);
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 = 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;
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();
}
}
@ -368,7 +368,7 @@ Lowers armour, health, stamina etc."))
Command<Commands::SWITCH_DEATH_PENALTIES>(m_bKeepStuff);
}
Ui::CheckboxWithHint("Screenshot shortcut", &m_bScreenShot,
(("Take screenshot using ") + Ui::GetHotKeyNameString(Menu::m_HotKeys.quickSceenShot)
(("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."))
@ -404,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", &m_Freecam.m_bEnabled, "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 (!m_Freecam.m_bEnabled)
if (!m_Freecam::m_bEnabled)
ClearFreecamStuff();
}
ImGui::Spacing();
if (ImGui::SliderFloat("Field of view", &m_Freecam.m_fFOV, 5.0f, 120.0f))
if (ImGui::SliderFloat("Field of view", &m_Freecam::m_fFOV, 5.0f, 120.0f))
{
TheCamera.LerpFOV(TheCamera.FindCamFOV(), m_Freecam.m_fFOV, 250.0f, true);
TheCamera.LerpFOV(TheCamera.FindCamFOV(), m_Freecam::m_fFOV, 250.0f, true);
Command<Commands::CAMERA_PERSIST_FOV>(true);
}
ImGui::SliderFloat("Movement Speed", &m_Freecam.m_fSpeed, 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();
@ -543,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", &m_RandomCheats.m_bEnabled);
ImGui::Checkbox("Enable", &m_RandomCheats::m_bEnabled);
ImGui::Spacing();
ImGui::PushItemWidth(ImGui::GetWindowContentRegionWidth() / 2);
ImGui::SliderInt("Activate cheat timer", &m_RandomCheats.m_nInterval, 5, 60);
ImGui::SliderInt("Activate cheat timer", &m_RandomCheats::m_nInterval, 5, 60);
Ui::ShowTooltip("Wait time after a cheat is activated.");
ImGui::PopItemWidth();
@ -557,7 +557,7 @@ 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 : m_RandomCheats.m_EnabledCheats)
for (auto element : m_RandomCheats::m_EnabledCheats)
{
bool selected = (element[1] == "true") ? true : false;

View File

@ -1,5 +1,5 @@
#pragma once
class CGame
class Game
{
public:
inline static SSearchData m_MissionData{"mission"};
@ -7,15 +7,15 @@ public:
{
"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
};
static struct
struct m_RandomCheats
{
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
};
struct m_Freecam
{
inline static bool m_bEnabled;
inline static float m_fSpeed = 0.08f;
@ -25,15 +25,15 @@ public:
inline static int m_nPed = -1;
inline static CVector m_fMouse;
inline static CVector m_fTotalMouse;
} m_Freecam;
static struct
};
struct m_HardMode
{
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;
@ -49,7 +49,7 @@ public:
inline static SSearchData m_StatData{ "stat" };
CGame();
Game();
static void Draw();
static void FreeCam();
static void ClearFreecamStuff();

View File

@ -12,81 +12,81 @@ Menu::Menu()
{
// TODO: use structs
// Load config data
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);
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
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);
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);
m_HotKeys.freeCam.m_key1 = config.GetValue("hotkey.freecam.key1", VK_F6);
m_HotKeys.freeCam.m_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);
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);
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);
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);
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);
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);
m_HotKeys::menuOpen.m_key1 = VK_LCONTROL; config.GetValue("hotkey.menu_open.key1", VK_LCONTROL);
m_HotKeys::menuOpen.m_key2 = VK_KEY_M; config.GetValue("hotkey.menu_open.key2", VK_KEY_M);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
m_Overlay.mTotalRam = static_cast<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 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));
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));
const float offset = 10.0f;
ImGuiIO& io = ImGui::GetIO();
ImGuiWindowFlags window_flags = ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_AlwaysAutoResize |
ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoNav;
if (m_Overlay.mSelectedPos == DISPLAY_POS::CUSTOM)
if (m_Overlay::mSelectedPos == DISPLAY_POS::CUSTOM)
{
if (m_Overlay.fPosX != NULL && m_Overlay.fPosY != NULL)
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);
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
@ -94,25 +94,25 @@ void Menu::DrawOverlay()
window_flags |= ImGuiWindowFlags_NoMove;
ImVec2 pos, pivot;
if (m_Overlay.mSelectedPos == DISPLAY_POS::TOP_LEFT)
if (m_Overlay::mSelectedPos == DISPLAY_POS::TOP_LEFT)
{
pos = ImVec2(offset, offset);
pivot = ImVec2(0.0f, 0.0f);
}
if (m_Overlay.mSelectedPos == DISPLAY_POS::TOP_RIGHT)
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)
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)
if (m_Overlay::mSelectedPos == DISPLAY_POS::BOTTOM_RIGHT)
{
pos = ImVec2(io.DisplaySize.x - offset, io.DisplaySize.y - offset);
pivot = ImVec2(1.0f, 1.0f);
@ -121,7 +121,7 @@ void Menu::DrawOverlay()
ImGui::SetNextWindowPos(pos, ImGuiCond_Always, pivot);
}
ImGui::SetNextWindowBgAlpha(m_Overlay.bTransparent ? 0.0f : 0.5f);
ImGui::SetNextWindowBgAlpha(m_Overlay::bTransparent ? 0.0f : 0.5f);
if (m_bShowMenu && ImGui::Begin("Overlay", nullptr, window_flags))
{
@ -129,47 +129,47 @@ void Menu::DrawOverlay()
CVector pos = player->GetPosition();
size_t game_ms = CTimer::m_snTimeInMilliseconds;
if (game_ms - m_Overlay.mLastInterval > m_Overlay.mInterval)
if (game_ms - m_Overlay::mLastInterval > m_Overlay::mInterval)
{
m_Overlay.fCpuUsage = static_cast<float>(Util::GetCurrentCPUUsage());
m_Overlay::fCpuUsage = static_cast<float>(Util::GetCurrentCPUUsage());
MEMORYSTATUSEX memInfo;
memInfo.dwLength = sizeof(MEMORYSTATUSEX);
GlobalMemoryStatusEx(&memInfo);
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);
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);
m_Overlay.mLastInterval = game_ms;
m_Overlay::mLastInterval = game_ms;
}
if (m_Overlay.bCoord)
if (m_Overlay::bCoord)
ImGui::Text("Coord: %.2f, %.2f, %.2f", pos.x, pos.y, pos.z);
if (m_Overlay.bCpuUsage)
ImGui::Text("CPU usage: %.2f%%", m_Overlay.fCpuUsage);
if (m_Overlay::bCpuUsage)
ImGui::Text("CPU usage: %.2f%%", m_Overlay::fCpuUsage);
if (m_Overlay.bFPS)
ImGui::Text("Frames: %d", m_Overlay.mFPS);
if (m_Overlay::bFPS)
ImGui::Text("Frames: %d", m_Overlay::mFPS);
if (m_Overlay.bLocName)
if (m_Overlay::bLocName)
ImGui::Text("Location: %s", Util::GetLocationName(&pos).c_str());
if (m_Overlay.bMemUsage)
ImGui::Text("RAM usage: %.2f%%", m_Overlay.fMemUsage);
if (m_Overlay::bMemUsage)
ImGui::Text("RAM usage: %.2f%%", m_Overlay::fMemUsage);
if (player->m_pVehicle && player->m_pVehicle->IsDriver(player))
{
if (m_Overlay.bVehHealth)
if (m_Overlay::bVehHealth)
ImGui::Text("Veh Health: %.f", player->m_pVehicle->m_fHealth);
if (m_Overlay.bVehSpeed)
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();
m_Overlay.fPosX = windowPos.x;
m_Overlay.fPosY = windowPos.y;
m_Overlay::fPosX = windowPos.x;
m_Overlay::fPosY = windowPos.y;
ImGui::End();
}
@ -195,12 +195,12 @@ void Menu::DrawShortcutsWindow()
ImGui::SetNextItemWidth(resX);
ImGui::SetKeyboardFocusHere(-1);
if (ImGui::InputTextWithHint("##TEXTFIELD", "Enter command", m_Commands.m_nInputBuffer, INPUT_BUFFER_SIZE,
if (ImGui::InputTextWithHint("##TEXTFIELD", "Enter command", m_Commands::m_nInputBuffer, INPUT_BUFFER_SIZE,
ImGuiInputTextFlags_EnterReturnsTrue))
{
ProcessCommands();
m_Commands.m_bShowMenu = false;
strcpy(m_Commands.m_nInputBuffer, "");
m_Commands::m_bShowMenu = false;
strcpy(m_Commands::m_nInputBuffer, "");
}
ImGui::PopStyleVar(2);
@ -210,7 +210,7 @@ void Menu::DrawShortcutsWindow()
void Menu::ProcessCommands()
{
std::stringstream ss(m_Commands.m_nInputBuffer);
std::stringstream ss(m_Commands::m_nInputBuffer);
std::string command;
ss >> command;
@ -324,37 +324,37 @@ void Menu::Draw()
ImGui::Spacing();
ImGui::Spacing();
ImGui::SameLine();
if (Ui::ListBox("Overlay", m_Overlay.posNames, (int&)m_Overlay.mSelectedPos))
config.SetValue("overlay.mSelectedPos", m_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, nullptr, false);
if (ImGui::Checkbox("No background", &m_Overlay.bTransparent))
config.SetValue("overlay.bTransparent", m_Overlay.bTransparent);
if (ImGui::Checkbox("No background", &m_Overlay::bTransparent))
config.SetValue("overlay.bTransparent", m_Overlay::bTransparent);
if (ImGui::Checkbox("Show coordinates", &m_Overlay.bCoord))
config.SetValue("overlay.bCoord", m_Overlay.bCoord);
if (ImGui::Checkbox("Show coordinates", &m_Overlay::bCoord))
config.SetValue("overlay.bCoord", m_Overlay::bCoord);
if (ImGui::Checkbox("Show CPU usage", &m_Overlay.bCpuUsage))
config.SetValue("overlay.bCpuUsage", m_Overlay.bCpuUsage);
if (ImGui::Checkbox("Show CPU usage", &m_Overlay::bCpuUsage))
config.SetValue("overlay.bCpuUsage", m_Overlay::bCpuUsage);
if (ImGui::Checkbox("Show FPS", &m_Overlay.bFPS))
config.SetValue("overlay.bFPS", m_Overlay.bFPS);
if (ImGui::Checkbox("Show FPS", &m_Overlay::bFPS))
config.SetValue("overlay.bFPS", m_Overlay::bFPS);
ImGui::NextColumn();
if (ImGui::Checkbox("Show location", &m_Overlay.bLocName))
config.SetValue("overlay.bLocName", m_Overlay.bLocName);
if (ImGui::Checkbox("Show location", &m_Overlay::bLocName))
config.SetValue("overlay.bLocName", m_Overlay::bLocName);
if (ImGui::Checkbox("Show RAM usage", &m_Overlay.bMemUsage))
config.SetValue("overlay.bMemUsage", m_Overlay.bMemUsage);
if (ImGui::Checkbox("Show RAM usage", &m_Overlay::bMemUsage))
config.SetValue("overlay.bMemUsage", m_Overlay::bMemUsage);
if (ImGui::Checkbox("Show veh health", &m_Overlay.bVehHealth))
config.SetValue("overlay.bVehHealth", m_Overlay.bVehHealth);
if (ImGui::Checkbox("Show veh health", &m_Overlay::bVehHealth))
config.SetValue("overlay.bVehHealth", m_Overlay::bVehHealth);
if (ImGui::Checkbox("Show veh speed", &m_Overlay.bVehSpeed))
config.SetValue("overlay.bVehSpeed", m_Overlay.bVehSpeed);
if (ImGui::Checkbox("Show veh speed", &m_Overlay::bVehSpeed))
config.SetValue("overlay.bVehSpeed", m_Overlay::bVehSpeed);
ImGui::Columns(1);
@ -368,76 +368,76 @@ void Menu::Draw()
"\nRight click disables hotkey.");
ImGui::Spacing();
ImGui::BeginChild("Hotkeys");
if (Ui::HotKey("Open/ close cheat menu", m_HotKeys.menuOpen))
if (Ui::HotKey("Open/ close cheat menu", m_HotKeys::menuOpen))
{
config.SetValue("hotkey.menu_open.key1", m_HotKeys.menuOpen.m_key1);
config.SetValue("hotkey.menu_open.key2", m_HotKeys.menuOpen.m_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", m_HotKeys.commandWindow))
if (Ui::HotKey("Open/ close command window", m_HotKeys::commandWindow))
{
config.SetValue("hotkey.command_window.key1", m_HotKeys.commandWindow.m_key1);
config.SetValue("hotkey.command_window.key2", m_HotKeys.commandWindow.m_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", m_HotKeys.aimSkinChanger))
if (Ui::HotKey("Activate aim skin changer", m_HotKeys::aimSkinChanger))
{
config.SetValue("hotkey.aim_skin_changer.key1", m_HotKeys.aimSkinChanger.m_key1);
config.SetValue("hotkey.aim_skin_changer.key2", m_HotKeys.aimSkinChanger.m_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", m_HotKeys.freeCam))
if (Ui::HotKey("Freecam", m_HotKeys::freeCam))
{
config.SetValue("hotkey.freecam.key1", m_HotKeys.freeCam.m_key1);
config.SetValue("hotkey.freecam.key2", m_HotKeys.freeCam.m_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", m_HotKeys.quickSceenShot))
if (Ui::HotKey("Take quick screenshot", m_HotKeys::quickSceenShot))
{
config.SetValue("hotkey.quick_screenshot.key1", m_HotKeys.quickSceenShot.m_key1);
config.SetValue("hotkey.quick_screenshot.key2", m_HotKeys.quickSceenShot.m_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", m_HotKeys.quickTeleport))
if (Ui::HotKey("Toggle quick teleport", m_HotKeys::quickTeleport))
{
config.SetValue("hotkey.quick_tp.key1", m_HotKeys.quickTeleport.m_key1);
config.SetValue("hotkey.quick_tp.key2", m_HotKeys.quickTeleport.m_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", m_HotKeys.fixVeh))
if (Ui::HotKey("Fix current vehicle", m_HotKeys::fixVeh))
{
config.SetValue("hotkey.fix_veh.key1", m_HotKeys.fixVeh.m_key1);
config.SetValue("hotkey.fix_veh.key2", m_HotKeys.fixVeh.m_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", m_HotKeys.flipVeh))
if (Ui::HotKey("Flip current vehicle", m_HotKeys::flipVeh))
{
config.SetValue("hotkey.flip_veh.key1", m_HotKeys.flipVeh.m_key1);
config.SetValue("hotkey.flip_veh.key2", m_HotKeys.flipVeh.m_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", m_HotKeys.godMode))
if (Ui::HotKey("Toggle god mode", m_HotKeys::godMode))
{
config.SetValue("hotkey.god_mode.key1", m_HotKeys.godMode.m_key1);
config.SetValue("hotkey.god_mode.key2", m_HotKeys.godMode.m_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", m_HotKeys.vehEngine))
if (Ui::HotKey("Toggle veh engine", m_HotKeys::vehEngine))
{
config.SetValue("hotkey.veh_engine.key1", m_HotKeys.vehEngine.m_key1);
config.SetValue("hotkey.veh_engine.key2", m_HotKeys.vehEngine.m_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", m_HotKeys.vehInstantStart))
if (Ui::HotKey("Vehicle instant start", m_HotKeys::vehInstantStart))
{
config.SetValue("hotkey.veh_instant_start.key1", m_HotKeys.vehInstantStart.m_key1);
config.SetValue("hotkey.veh_instant_start.key2", m_HotKeys.vehInstantStart.m_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", m_HotKeys.vehInstantStop))
if (Ui::HotKey("Vehicle instant stop", m_HotKeys::vehInstantStop))
{
config.SetValue("hotkey.veh_instant_stop.key1", m_HotKeys.vehInstantStop.m_key1);
config.SetValue("hotkey.veh_instant_stop.key2", m_HotKeys.vehInstantStop.m_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));
@ -451,7 +451,7 @@ void Menu::Draw()
{
ImGui::TextWrapped(
std::string(
"Open or close command window using " + Ui::GetHotKeyNameString(m_HotKeys.commandWindow)).
"Open or close command window using " + Ui::GetHotKeyNameString(m_HotKeys::commandWindow)).
c_str());
ImGui::Spacing();
if (ImGui::CollapsingHeader("Set health"))

View File

@ -13,7 +13,7 @@ private:
BOTTOM_RIGHT
};
static struct
struct m_Overlay
{
inline static bool bCoord = false;
inline static bool bFPS = false;
@ -35,10 +35,10 @@ private:
inline static size_t mInterval = 1000;
inline static size_t mLastInterval = 0;
inline static int mTotalRam = 0;
} m_Overlay;
};
public:
static struct
struct m_HotKeys
{
inline static HotKeyData aimSkinChanger;
inline static HotKeyData freeCam;
@ -53,13 +53,13 @@ public:
inline static HotKeyData vehEngine;
inline static HotKeyData vehInstantStart;
inline static HotKeyData vehInstantStop;
} m_HotKeys;
};
static struct
struct m_Commands
{
inline static bool m_bShowMenu = false;
inline static char m_nInputBuffer[INPUT_BUFFER_SIZE] = "";
} m_Commands;
};
Menu();
static void Draw();

View File

@ -22,7 +22,7 @@ Ped::Ped()
Ped::~Ped()
{
Util::ReleaseTextures(m_PedData.m_ImagesList);
for (CPed* ped : m_SpawnPed.m_List)
for (CPed* ped : m_SpawnPed::m_List)
{
CWorld::Remove(ped);
ped->Remove();
@ -31,7 +31,7 @@ Ped::~Ped()
void Ped::SpawnPed(std::string& model)
{
if (m_SpawnPed.m_List.size() == SPAWN_PED_LIMIT)
if (m_SpawnPed::m_List.size() == SPAWN_PED_LIMIT)
{
CHud::SetHelpMessage("Max limit reached", false, false, false);
return;
@ -57,7 +57,7 @@ void Ped::SpawnPed(std::string& model)
CStreaming::RequestSpecialChar(1, name.c_str(), PRIORITY_REQUEST);
CStreaming::LoadAllRequestedModels(true);
Command<Commands::CREATE_CHAR>(m_SpawnPed.m_nSelectedPedType + 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
@ -66,29 +66,29 @@ void Ped::SpawnPed(std::string& model)
CStreaming::RequestModel(iModel, eStreamingFlags::PRIORITY_REQUEST);
CStreaming::LoadAllRequestedModels(false);
Command<Commands::CREATE_CHAR>(m_SpawnPed.m_nSelectedPedType + 4, iModel, pos.x, pos.y, pos.z + 1, &hplayer);
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 (m_SpawnPed.m_bPedMove)
m_SpawnPed.m_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 = m_SpawnPed.m_bPedBleed;
ped->m_nWeaponAccuracy = m_SpawnPed.m_nAccuracy;
ped->m_fHealth = m_SpawnPed.m_nPedHealth;
ped->m_nPedFlags.bPedIsBleeding = m_SpawnPed::m_bPedBleed;
ped->m_nWeaponAccuracy = m_SpawnPed::m_nAccuracy;
ped->m_fHealth = m_SpawnPed::m_nPedHealth;
if (m_SpawnPed.m_nWeaponId != 0)
if (m_SpawnPed::m_nWeaponId != 0)
{
int model = 0;
Command<Commands::GET_WEAPONTYPE_MODEL>(m_SpawnPed.m_nWeaponId, &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, m_SpawnPed.m_nWeaponId, 999);
Command<Commands::GIVE_WEAPON_TO_CHAR>(hplayer, m_SpawnPed::m_nWeaponId, 999);
}
}
}
@ -214,12 +214,12 @@ void Ped::Draw()
ImGui::Spacing();
if (ImGui::Button("Remove frozen peds", Ui::GetSize(1)))
{
for (CPed* ped : m_SpawnPed.m_List)
for (CPed* ped : m_SpawnPed::m_List)
{
CWorld::Remove(ped);
ped->Remove();
}
m_SpawnPed.m_List.clear();
m_SpawnPed::m_List.clear();
}
ImGui::Spacing();
if (ImGui::BeginTabBar("SpawnPedBar"))
@ -240,30 +240,30 @@ void Ped::Draw()
ImGui::Spacing();
ImGui::BeginChild("PedCOnfig");
ImGui::Columns(2, 0, false);
Ui::CheckboxWithHint("Don't move", &m_SpawnPed.m_bPedMove);
Ui::CheckboxWithHint("Don't move", &m_SpawnPed::m_bPedMove);
ImGui::NextColumn();
Ui::CheckboxWithHint("Ped bleed", &m_SpawnPed.m_bPedBleed);
Ui::CheckboxWithHint("Ped bleed", &m_SpawnPed::m_bPedBleed);
ImGui::Columns(1);
ImGui::Spacing();
ImGui::SliderInt("Accuracy", &m_SpawnPed.m_nAccuracy, 0.0, 100.0);
if (ImGui::InputInt("Health", &m_SpawnPed.m_nPedHealth))
ImGui::SliderInt("Accuracy", &m_SpawnPed::m_nAccuracy, 0.0, 100.0);
if (ImGui::InputInt("Health", &m_SpawnPed::m_nPedHealth))
{
if (m_SpawnPed.m_nPedHealth > 1000)
m_SpawnPed.m_nPedHealth = 1000;
if (m_SpawnPed::m_nPedHealth > 1000)
m_SpawnPed::m_nPedHealth = 1000;
if (m_SpawnPed.m_nPedHealth < 0)
m_SpawnPed.m_nPedHealth = 0;
if (m_SpawnPed::m_nPedHealth < 0)
m_SpawnPed::m_nPedHealth = 0;
}
Ui::ListBox("Ped type", m_SpawnPed.m_PedTypeList, m_SpawnPed.m_nSelectedPedType);
Ui::ListBox("Ped type", m_SpawnPed::m_PedTypeList, m_SpawnPed::m_nSelectedPedType);
ImGui::Spacing();
ImGui::Text("Selected weapon: %s",
Weapon::m_WeaponData.m_Json.m_Data[std::to_string(m_SpawnPed.m_nWeaponId)].get<std::string>());
Weapon::m_WeaponData.m_Json.m_Data[std::to_string(m_SpawnPed::m_nWeaponId)].get<std::string>());
ImGui::Spacing();
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); },
[](std::string str) { m_SpawnPed::m_nWeaponId = std::stoi(str); },
nullptr,
[](std::string str)
{

View File

@ -10,7 +10,7 @@ private:
inline static bool m_bImagesLoaded;
inline static bool m_bExGangWarsInstalled;
inline static int m_nPedRemoveRadius = 5;
static struct
struct m_SpawnPed
{
inline static std::vector<CPed*> m_List;
inline static int m_nAccuracy = 50;
@ -25,7 +25,7 @@ private:
"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",

View File

@ -23,22 +23,22 @@ Player::Player()
// Custom skins setup
if (GetModuleHandle("modloader.asi"))
{
if (fs::is_directory(m_CustomSkins.m_Path))
if (fs::is_directory(m_CustomSkins::m_Path))
{
for (auto& p : fs::recursive_directory_iterator(m_CustomSkins.m_Path))
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)
m_CustomSkins.m_List.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(m_CustomSkins.m_Path);
else fs::create_directory(m_CustomSkins::m_Path);
m_bModloaderInstalled = true;
}
@ -55,21 +55,21 @@ Player::Player()
m_bImagesLoaded = true;
}
if (m_KeepPosition.m_bEnabled)
if (m_KeepPosition::m_bEnabled)
{
if (!player->IsAlive())
{
m_KeepPosition.m_fPos = player->GetPosition();
m_KeepPosition::m_fPos = player->GetPosition();
}
else
{
CVector cur_pos = player->GetPosition();
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)
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(m_KeepPosition.m_fPos, false);
m_KeepPosition.m_fPos = CVector(0, 0, 0);
player->Teleport(m_KeepPosition::m_fPos, false);
m_KeepPosition::m_fPos = CVector(0, 0, 0);
}
}
}
@ -84,7 +84,7 @@ Player::Player()
player->m_nPhysicalFlags.bMeeleProof = 1;
}
if (m_bAimSkinChanger && Ui::HotKeyPressed(Menu::m_HotKeys.aimSkinChanger))
if (m_bAimSkinChanger && Ui::HotKeyPressed(Menu::m_HotKeys::aimSkinChanger))
{
CPed* target_ped = player->m_pPlayerTargettedPed;
if (target_ped)
@ -94,7 +94,7 @@ Player::Player()
}
}
if (Ui::HotKeyPressed(Menu::m_HotKeys.godMode))
if (Ui::HotKeyPressed(Menu::m_HotKeys::godMode))
{
if (m_bGodMode)
{
@ -162,8 +162,8 @@ void Player::ChangePlayerCloth(std::string& name)
void Player::ChangePlayerModel(std::string& model)
{
bool custom_skin = std::find(m_CustomSkins.m_List.begin(), m_CustomSkins.m_List.end(), model) !=
m_CustomSkins.m_List.end();
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();
@ -243,7 +243,7 @@ void Player::Draw()
ImGui::NextColumn();
Ui::CheckboxWithHint("Keep position", &m_KeepPosition.m_bEnabled, "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;
@ -354,8 +354,8 @@ void Player::Draw()
{
ImGui::Spacing();
if (Ui::CheckboxWithHint("Aim skin changer", &m_bAimSkinChanger,
(("Activate using Aim ped + ") + Ui::GetHotKeyNameString(
Menu::m_HotKeys.aimSkinChanger)).c_str()))
(("Changes to the ped, player is targeting with a weapon.\nTo use aim a ped with a weapon and press ")
+ Ui::GetHotKeyNameString(Menu::m_HotKeys::aimSkinChanger)).c_str()))
config.SetValue("aim_skin_changer", m_bAimSkinChanger);
if (ImGui::BeginTabBar("AppearanceTabBar"))
@ -418,16 +418,16 @@ void Player::Draw()
if (m_bModloaderInstalled)
{
Ui::FilterWithHint("Search", m_ClothData.m_Filter,
std::string("Total skins: " + std::to_string(m_CustomSkins.m_List.size()))
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::Spacing();
for (std::string name : m_CustomSkins.m_List)
for (std::string name : m_CustomSkins::m_List)
{
if (m_CustomSkins.m_Filter.PassFilter(name.c_str()))
if (m_CustomSkins::m_Filter.PassFilter(name.c_str()))
{
if (ImGui::MenuItem(name.c_str()))
{

View File

@ -8,17 +8,17 @@ private:
inline static SSearchData m_ClothData;
inline static bool m_bImagesLoaded;
inline static bool m_bModloaderInstalled;
static struct
struct m_KeepPosition
{
inline static bool m_bEnabled = false;
inline static CVector m_fPos;
} m_KeepPosition;
static struct
};
struct m_CustomSkins
{
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();

View File

@ -44,21 +44,21 @@ Teleport::Teleport()
Events::processScriptsEvent += []
{
if ((m_Teleport.m_bEnabled == true) && ((CTimer::m_snTimeInMilliseconds - m_Teleport.m_nTimer) > 500))
if ((m_Teleport::m_bEnabled == true) && ((CTimer::m_snTimeInMilliseconds - m_Teleport::m_nTimer) > 500))
{
CPlayerPed* player = FindPlayerPed();
CEntity* player_entity = FindPlayerEntity(-1);
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;
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(m_Teleport.m_fPos, false);
pVeh->Teleport(m_Teleport::m_fPos, false);
else
player->Teleport(m_Teleport.m_fPos, false);
player->Teleport(m_Teleport::m_fPos, false);
m_Teleport.m_bEnabled = 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);
@ -66,7 +66,7 @@ Teleport::Teleport()
if (m_bQuickTeleport)
{
if (Ui::HotKeyPressed(Menu::m_HotKeys.quickTeleport)
if (Ui::HotKeyPressed(Menu::m_HotKeys::quickTeleport)
&& ((CTimer::m_snTimeInMilliseconds - m_nQuickTeleportTimer) > 500))
{
m_nQuickTeleportTimer = CTimer::m_snTimeInMilliseconds;
@ -87,16 +87,16 @@ void Teleport::TeleportPlayer(bool get_marker, CVector pos, short interior_id)
if (targetBlip.m_nBlipSprite != RADAR_SPRITE_WAYPOINT)
{
CHud::SetHelpMessage("No blip found", false, false, false);
CHud::SetHelpMessage("Target blip not found. You need to place it on the map first.", false, false, false);
return;
}
CEntity* pPlayerEntity = FindPlayerEntity(-1);
pos = targetBlip.m_vPosition;
pos.z = CWorld::FindGroundZFor3DCoord(pos.x, pos.y, 1000, nullptr, &pPlayerEntity) + 50.f;
m_Teleport.m_fPos = pos;
m_Teleport.m_nTimer = CTimer::m_snTimeInMilliseconds;
m_Teleport.m_bEnabled = 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);
}
@ -177,8 +177,8 @@ void Teleport::Draw()
ImGui::Checkbox("Insert coordinates", &m_bInsertCoord);
ImGui::NextColumn();
if (Ui::CheckboxWithHint("Quick teleport", &m_bQuickTeleport,
(std::string("Teleport to marker using ") + Ui::GetHotKeyNameString(
Menu::m_HotKeys.quickTeleport)).c_str()))
(std::string("Teleport to the location of your radar\ntarget blip using ")
+ Ui::GetHotKeyNameString(Menu::m_HotKeys::quickTeleport)).c_str()))
{
config.SetValue("quick_teleport", m_bQuickTeleport);
}
@ -199,7 +199,7 @@ void Teleport::Draw()
ImGui::Spacing();
if (ImGui::Button("Teleport to bCoord", Ui::GetSize(2)))
if (ImGui::Button("Teleport to Coord", Ui::GetSize(2)))
{
std::stringstream ss(m_nInputBuffer);
std::string temp;

View File

@ -12,12 +12,12 @@ private:
inline static char m_nLocationBuffer[INPUT_BUFFER_SIZE];
inline static uint m_nQuickTeleportTimer;
inline static CJson m_SpriteJson = CJson("radar sprite");
static struct
struct m_Teleport
{
inline static bool m_bEnabled;
inline static CVector m_fPos = {-1, -1, -1};
inline static uint m_nTimer;
} m_Teleport;
};
/*

View File

@ -13,8 +13,8 @@ Vehicle::Vehicle()
if (!m_bImagesLoaded)
{
Util::LoadTexturesInDirRecursive(
PLUGIN_PATH((char*)"CheatMenu\\vehicles\\images\\"), ".jpg", m_Spawner.m_VehData.m_Categories,
m_Spawner.m_VehData.m_ImagesList);
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);
@ -33,7 +33,7 @@ Vehicle::Vehicle()
{
int hveh = CPools::GetVehicleRef(veh);
if (Ui::HotKeyPressed(Menu::m_HotKeys.flipVeh))
if (Ui::HotKeyPressed(Menu::m_HotKeys::flipVeh))
{
float roll;
Command<Commands::GET_CAR_ROLL>(hveh, &roll);
@ -42,14 +42,14 @@ Vehicle::Vehicle()
Command<Commands::SET_CAR_ROLL>(hveh, roll); // z rot fix
}
if (Ui::HotKeyPressed(Menu::m_HotKeys.fixVeh))
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::m_HotKeys.vehEngine))
if (Ui::HotKeyPressed(Menu::m_HotKeys::vehEngine))
{
bool state = !veh->m_nVehicleFlags.bEngineBroken || veh->m_nVehicleFlags.bEngineOn;
@ -62,10 +62,10 @@ Vehicle::Vehicle()
veh->m_nVehicleFlags.bEngineOn = !state;
}
if (Ui::HotKeyPressed(Menu::m_HotKeys.vehInstantStart))
if (Ui::HotKeyPressed(Menu::m_HotKeys::vehInstantStart))
Command<Commands::SET_CAR_FORWARD_SPEED>(hveh, 40.0f);
if (Ui::HotKeyPressed(Menu::m_HotKeys.vehInstantStop))
if (Ui::HotKeyPressed(Menu::m_HotKeys::vehInstantStop))
Command<Commands::SET_CAR_FORWARD_SPEED>(hveh, 0);
if (m_bNoDamage)
@ -82,25 +82,25 @@ Vehicle::Vehicle()
Command<Commands::SET_CAR_HEAVY>(hveh, m_bVehHeavy);
Command<Commands::SET_CAR_WATERTIGHT>(hveh, m_bVehWatertight);
if (m_UnlimitedNitro.m_bEnabled && 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 (!m_UnlimitedNitro.m_bCompAdded)
if (!m_UnlimitedNitro::m_bCompAdded)
{
AddComponent("1010", false);
m_UnlimitedNitro.m_bCompAdded = true;
m_UnlimitedNitro::m_bCompAdded = true;
}
}
else
{
if (m_UnlimitedNitro.m_bCompAdded)
if (m_UnlimitedNitro::m_bCompAdded)
{
RemoveComponent("1010", false);
m_UnlimitedNitro.m_bCompAdded = false;
m_UnlimitedNitro::m_bCompAdded = false;
}
}
}
@ -108,18 +108,18 @@ Vehicle::Vehicle()
if (m_bLockSpeed)
Command<Commands::SET_CAR_FORWARD_SPEED>(hveh, m_fLockSpeed);
if (m_Neon.m_bRainbowEffect && timer - m_Neon.m_nRainbowTimer > 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);
m_Neon.m_nRainbowTimer = timer;
m_Neon::m_nRainbowTimer = timer;
}
}
// Traffic neons
if (m_Neon.m_bApplyOnTraffic && timer - m_Neon.m_bTrafficTimer > 1000)
if (m_Neon::m_bApplyOnTraffic && timer - m_Neon::m_bTrafficTimer > 1000)
{
for (CVehicle* veh : CPools::ms_pVehiclePool)
{
@ -137,7 +137,7 @@ Vehicle::Vehicle()
if (chance == 1 && !IsNeonInstalled(veh) && veh->m_pDriver != player)
InstallNeon(veh, Random(0, 255), Random(0, 255), Random(0, 255));
}
m_Neon.m_bTrafficTimer = timer;
m_Neon::m_bTrafficTimer = timer;
}
if (m_bBikeFly && veh && veh->IsDriver(player))
@ -159,7 +159,7 @@ Vehicle::Vehicle()
Vehicle::~Vehicle()
{
Util::ReleaseTextures(m_Spawner.m_VehData.m_ImagesList);
Util::ReleaseTextures(m_Spawner::m_VehData.m_ImagesList);
Util::ReleaseTextures(m_TuneData.m_ImagesList);
Util::ReleaseTextures(m_TextureData.m_ImagesList);
}
@ -399,7 +399,7 @@ void Vehicle::SpawnVehicle(std::string& smodel)
CVector pos = player->GetPosition();
int speed = 0;
if (player->m_nPedFlags.bInVehicle && m_Spawner.m_bSpawnInside)
if (player->m_nPedFlags.bInVehicle && m_Spawner::m_bSpawnInside)
{
int hveh = 0;
Command<Commands::GET_CAR_CHAR_IS_USING>(hplayer, &hveh);
@ -417,7 +417,7 @@ void Vehicle::SpawnVehicle(std::string& smodel)
}
if (interior == 0)
if (m_Spawner.m_bSpawnInAir && (CModelInfo::IsHeliModel(imodel) || CModelInfo::IsPlaneModel(imodel)))
if (m_Spawner::m_bSpawnInAir && (CModelInfo::IsHeliModel(imodel) || CModelInfo::IsPlaneModel(imodel)))
pos.z = 400;
else
pos.z -= 5;
@ -454,7 +454,7 @@ void Vehicle::SpawnVehicle(std::string& smodel)
if (veh->m_pDriver)
Command<Commands::DELETE_CHAR>(CPools::GetPedRef(veh->m_pDriver));
if (m_Spawner.m_bSpawnInside)
if (m_Spawner::m_bSpawnInside)
{
Command<Commands::WARP_CHAR_INTO_CAR>(hplayer, hveh);
Command<Commands::SET_CAR_FORWARD_SPEED>(hveh, speed);
@ -473,11 +473,11 @@ void Vehicle::SpawnVehicle(std::string& smodel)
CStreaming::RequestModel(imodel, PRIORITY_REQUEST);
CStreaming::LoadAllRequestedModels(false);
if (m_Spawner.m_nLicenseText[0] != '\0')
Command<Commands::CUSTOM_PLATE_FOR_NEXT_CAR>(imodel, m_Spawner.m_nLicenseText);
if (m_Spawner::m_nLicenseText[0] != '\0')
Command<Commands::CUSTOM_PLATE_FOR_NEXT_CAR>(imodel, m_Spawner::m_nLicenseText);
int hveh = 0;
if (m_Spawner.m_bSpawnInside)
if (m_Spawner::m_bSpawnInside)
{
Command<Commands::CREATE_CAR>(imodel, pos.x, pos.y, pos.z + 4.0f, &hveh);
veh = CPools::GetVehicle(hveh);
@ -664,7 +664,7 @@ void Vehicle::Draw()
Ui::CheckboxAddress("Green traffic lights", 0x96914E);
Ui::CheckboxAddress("Perfect handling", 0x96914C);
Ui::CheckboxAddress("Tank mode", 0x969164);
Ui::CheckboxWithHint("Unlimited nitro", &m_UnlimitedNitro.m_bEnabled, "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", &m_bVehWatertight);
Ui::CheckboxAddress("Wheels only", 0x96914B);
@ -806,11 +806,13 @@ void Vehicle::Draw()
if (ImGui::Button("Remove vehicles", Ui::GetSize(1)))
{
CPlayerPed* player = FindPlayerPed();
for (CVehicle* veh : CPools::ms_pVehiclePool)
for (CVehicle *pVeh : CPools::ms_pVehiclePool)
{
if (DistanceBetweenPoints(veh->GetPosition(), player->GetPosition()) < m_nVehRemoveRadius
&& player->m_pVehicle != veh)
Command<Commands::DELETE_CAR>(CPools::GetVehicleRef(veh));
if (DistanceBetweenPoints(pVeh->GetPosition(), player->GetPosition()) < m_nVehRemoveRadius
&& !(player->m_nPedFlags.bInVehicle && player->m_pVehicle == pVeh))
{
Command<Commands::DELETE_CAR>(CPools::GetVehicleRef(pVeh));
}
}
}
ImGui::Spacing();
@ -932,18 +934,18 @@ void Vehicle::Draw()
{
ImGui::Spacing();
ImGui::Columns(2, 0, false);
Ui::CheckboxWithHint("Spawn inside", &m_Spawner.m_bSpawnInside, "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", &m_Spawner.m_bSpawnInAir);
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", m_Spawner.m_nLicenseText, 9);
ImGui::InputTextWithHint("##LicenseText", "License plate text", m_Spawner::m_nLicenseText, 9);
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,
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));
@ -969,23 +971,23 @@ void Vehicle::Draw()
Ui::ListBoxStr("Component", Paint::veh_nodes::names_vec, Paint::veh_nodes::selected);
if (ImGui::ColorEdit3("Color picker", m_Color.m_fColorPicker))
if (ImGui::ColorEdit3("Color picker", m_Color::m_fColorPicker))
{
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);
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", &m_Color.m_bMatFilter);
ImGui::RadioButton("Primary", &m_Color.m_nRadioButton, 1);
ImGui::RadioButton("Secondary", &m_Color.m_nRadioButton, 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", &m_Color.bShowAll);
ImGui::RadioButton("Tertiary", &m_Color.m_nRadioButton, 3);
ImGui::RadioButton("Quaternary", &m_Color.m_nRadioButton, 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:");
@ -1000,11 +1002,11 @@ void Vehicle::Draw()
ImGui::BeginChild("Colorss");
if (m_Color.bShowAll)
if (m_Color::bShowAll)
for (int colorId = 0; colorId < count; ++colorId)
{
if (Ui::ColorButton(colorId, m_CarcolsColorData[colorId], ImVec2(btnSize, btnSize)))
*(uint8_replacement*)(int(veh) + 0x433 + m_Color.m_nRadioButton) = colorId;
*(uint8_replacement*)(int(veh) + 0x433 + m_Color::m_nRadioButton) = colorId;
if ((colorId + 1) % btnsInRow != 0)
ImGui::SameLine(0.0, 4.0);
@ -1021,7 +1023,7 @@ void Vehicle::Draw()
{
if (Ui::ColorButton(colorId, m_CarcolsColorData[colorId],
ImVec2(btnSize, btnSize)))
*(uint8_replacement*)(int(veh) + 0x433 + m_Color.m_nRadioButton) = colorId;
*(uint8_replacement*)(int(veh) + 0x433 + m_Color::m_nRadioButton) = colorId;
if (count % btnsInRow != 0)
ImGui::SameLine(0.0, 4.0);
@ -1052,17 +1054,17 @@ void Vehicle::Draw()
if (Ui::CheckboxWithHint("Pulsing neons", &pulsing))
SetPulsing(veh, pulsing);
Ui::CheckboxWithHint("Rainbow neons", &m_Neon.m_bRainbowEffect, "Rainbow effect to neon lights");
Ui::CheckboxWithHint("Rainbow neons", &m_Neon::m_bRainbowEffect, "Rainbow effect to neon lights");
ImGui::NextColumn();
Ui::CheckboxWithHint("Traffic neons", &m_Neon.m_bApplyOnTraffic, "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", m_Neon.m_fColorPicker))
InstallNeon(veh, m_Neon.m_fColorPicker[0] * 255, m_Neon.m_fColorPicker[1] * 255,
m_Neon.m_fColorPicker[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:");
@ -1127,14 +1129,14 @@ Only some vehicles will have them.");
ImGui::Spacing();
ImGui::SameLine();
ImGui::Checkbox("Material filter", &m_Color.m_bMatFilter);
ImGui::Checkbox("Material filter", &m_Color::m_bMatFilter);
ImGui::Spacing();
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);
m_Color::m_bMatFilter);
},
nullptr,
[](std::string& str)

View File

@ -19,36 +19,36 @@ private:
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
struct m_Color
{
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
};
struct m_Neon
{
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
};
struct m_Spawner
{
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
struct m_UnlimitedNitro
{
inline static bool m_bEnabled;
inline static bool m_bCompAdded;
} m_UnlimitedNitro;
};
inline static std::vector<std::string> (m_HandlingFlagNames) = // 32 flags
{

View File

@ -371,27 +371,27 @@ void Visual::Draw()
int hour = CClock::ms_nGameClockHours;
int minute = CClock::ms_nGameClockMinutes;
if (CGame::m_bSyncTime)
if (Game::m_bSyncTime)
{
ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true);
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * 0.5f);
}
if (ImGui::InputInt("Hour", &hour) & !CGame::m_bSyncTime)
if (ImGui::InputInt("Hour", &hour) & !Game::m_bSyncTime)
{
if (hour < 0) hour = 23;
if (hour > 23) hour = 0;
CClock::ms_nGameClockHours = hour;
}
if (ImGui::InputInt("Minute", &minute) & !CGame::m_bSyncTime)
if (ImGui::InputInt("Minute", &minute) & !Game::m_bSyncTime)
{
if (minute < 0) minute = 59;
if (minute > 59) minute = 0;
CClock::ms_nGameClockMinutes = minute;
}
if (CGame::m_bSyncTime)
if (Game::m_bSyncTime)
{
ImGui::PopStyleVar();
ImGui::PopItemFlag();

View File

@ -80,7 +80,7 @@ struct Globals
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_bShowMenu = false;
inline static bool m_bInit;
inline static Renderer renderer = Render_Unknown;
inline static void* device;