From a2b7561933fd30d71c7799e6c7a351c2df64f749 Mon Sep 17 00:00:00 2001 From: Grinch_ Date: Wed, 3 Mar 2021 01:18:37 +0600 Subject: [PATCH] Refactored code --- CMakeLists.txt | 4 +- src/Animation.cpp | 20 ------ src/Animation.h | 23 ++++--- src/CheatMenu.cpp | 6 -- src/CheatMenu.h | 7 ++- src/Game.cpp | 55 +---------------- src/Game.h | 81 ++++++++++++------------ src/Hook.cpp | 10 --- src/Hook.h | 14 ++--- src/Menu.cpp | 28 --------- src/Menu.h | 50 +++++++-------- src/MenuInfo.h | 2 +- src/{Events.cpp => MoreEvents.cpp} | 0 src/{Events.h => MoreEvents.h} | 0 src/Neon.cpp | 3 - src/Neon.h | 7 +-- src/Paint.cpp | 6 -- src/Paint.h | 8 +-- src/Ped.cpp | 26 -------- src/Ped.h | 46 ++++++++------ src/Player.cpp | 20 +----- src/Player.h | 30 ++++----- src/Teleport.cpp | 17 ------ src/Teleport.h | 27 ++++---- src/TimeCycle.h | 2 - src/Ui.cpp | 5 -- src/Ui.h | 6 +- src/VehExtender.h | 36 ++++++++--- src/Vehicle.cpp | 65 -------------------- src/Vehicle.h | 98 ++++++++++++++++++------------ src/Visual.cpp | 33 ++-------- src/Visual.h | 13 ++-- src/Weapon.cpp | 37 +---------- src/Weapon.h | 65 +++++++++++--------- src/pch.cpp | 12 ---- src/pch.h | 26 ++++---- 36 files changed, 320 insertions(+), 568 deletions(-) rename src/{Events.cpp => MoreEvents.cpp} (100%) rename src/{Events.h => MoreEvents.h} (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0f732e5..7568bd4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,8 +27,6 @@ set(src_files "src/Animation.h" "src/CheatMenu.cpp" "src/CheatMenu.h" - "src/Events.cpp" - "src/Events.h" "src/Game.cpp" "src/Game.h" "src/Hook.cpp" @@ -38,6 +36,8 @@ set(src_files "src/Menu.cpp" "src/Menu.h" "src/MenuInfo.h" + "src/MoreEvents.cpp" + "src/MoreEvents.h" "src/Neon.cpp" "src/Neon.h" "src/Paint.cpp" diff --git a/src/Animation.cpp b/src/Animation.cpp index 7eb2cd9..2a4da11 100644 --- a/src/Animation.cpp +++ b/src/Animation.cpp @@ -3,26 +3,6 @@ #include "Ui.h" #include "Util.h" -bool Animation::loop = false; -bool Animation::secondary = false; -char Animation::ifp_buffer[INPUT_BUFFER_SIZE] = ""; -char Animation::anim_buffer[INPUT_BUFFER_SIZE] = ""; - -ImGuiTextFilter Animation::filter = ""; -std::vector Animation::search_categories; -std::string Animation::selected_item = "All"; - -CJson Animation::json = CJson("animation"); - -std::vector fighting_vec{ "Default","Boxing","Kung fu","Kick Boxing","Punch Kick" }; -int fighting_selected = 0; - -std::vector walking_vec{ "default", "man", "shuffle", "oldman", "gang1", "gang2", -"oldfatman", "fatman", "jogger", "drunkman", "blindman", "swat", "woman", "shopping", "busywoman", -"sexywoman", "pro", "oldwoman", "fatwoman", "jogwoman", "oldfatwoman", "skate" }; - -std::string walking_selected = "default"; - Animation::Animation() { json.LoadData(search_categories, selected_item); diff --git a/src/Animation.h b/src/Animation.h index cb128d8..79e9b22 100644 --- a/src/Animation.h +++ b/src/Animation.h @@ -2,16 +2,23 @@ class Animation { private: - static bool loop; - static bool secondary; + inline static bool loop = false; + inline static bool secondary = false; - static CJson json; - static ImGuiTextFilter filter; - static std::vector search_categories; - static std::string selected_item; + inline static CJson json = CJson("animation"); + inline static ImGuiTextFilter filter = ""; + inline static std::vector search_categories; + inline static std::string selected_item = "All"; - static char anim_buffer[INPUT_BUFFER_SIZE]; - static char ifp_buffer[INPUT_BUFFER_SIZE]; + inline static char anim_buffer[INPUT_BUFFER_SIZE] = ""; + inline static char ifp_buffer[INPUT_BUFFER_SIZE] = ""; + + inline static std::vector fighting_vec{ "Default","Boxing","Kung fu","Kick Boxing","Punch Kick" }; + inline static int fighting_selected = 0; + inline static std::vector 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"; protected: Animation(); diff --git a/src/CheatMenu.cpp b/src/CheatMenu.cpp index 17d0583..97ca17a 100644 --- a/src/CheatMenu.cpp +++ b/src/CheatMenu.cpp @@ -3,12 +3,6 @@ #include "MenuInfo.h" #include "Ui.h" -CallbackTable CheatMenu::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 } -}; - void CheatMenu::DrawWindow() { ImGuiIO& io = ImGui::GetIO(); diff --git a/src/CheatMenu.h b/src/CheatMenu.h index 254f3d7..32684a5 100644 --- a/src/CheatMenu.h +++ b/src/CheatMenu.h @@ -21,7 +21,12 @@ class CheatMenu : Hook, Animation, Game, Menu, Ped, Player, Teleport, Vehicle, Visual, Weapon { private: - static CallbackTable header; + 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 } + }; static void ApplyStyle(); static void DrawWindow(); diff --git a/src/Game.cpp b/src/Game.cpp index 500698a..388dabc 100644 --- a/src/Game.cpp +++ b/src/Game.cpp @@ -5,61 +5,8 @@ #include "Util.h" #include "CIplStore.h" -ImGuiTextFilter Game::filter = ""; -std::vector Game::search_categories; -std::string Game::selected_item = "All"; -std::vector Game::day_names{ "Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday" }; -char Game::save_game_name[22] = ""; - -CJson Game::json = CJson("mission"); - -CJson Game::stat::json = CJson("stat"); -std::vector Game::stat::search_categories; -std::string Game::stat::selected_item = "All"; -ImGuiTextFilter Game::stat::filter = ""; - -bool Game::random_cheats::enable = false; -int Game::random_cheats::enable_wait_time = 10; -uint Game::random_cheats::timer = 0; -std::string Game::random_cheats::enabled_cheats[92][2]; - -bool Game::freecam::init_done = false; -bool Game::freecam::enable = false; -float Game::freecam::speed = 0.08f; -float Game::freecam::tmouseX = 0; -float Game::freecam::tmouseY = 0; -float Game::freecam::mouseX = 0; -float Game::freecam::mouseY = 0; -int Game::freecam::hped = -1; -float Game::freecam::fov = -1; -CPed* Game::freecam::ped = nullptr; - -bool Game::hard_mode::state = false; -float Game::hard_mode::prev_armour = 0.0f; -float Game::hard_mode::prev_health = 0.0f; -float Game::hard_mode::prev_max_health = 0.0f; -float Game::hard_mode::prev_stamina = 0.0f; - -bool Game::disable_cheats = false; -bool Game::disable_replay = false; -bool Game::forbidden_area_wl = true; -bool Game::freeze_mission_timer = false; -bool Game::freeze_time = false; -bool Game::keep_stuff = false; -bool Game::solid_water = false; -bool Game::ss_shortcut = false; -bool Game::sync_time = false; - -uint Game::sync_time_timer = 0; - -uint Game::solid_water_object = 0; - -CJson Game::random_cheats::name_json = CJson("cheat name"); - -static bool mission_warning_shown = false; - // Thanks to aap -void RealTimeClock(void) +void Game::RealTimeClock() { static int lastday; time_t tmp = time(NULL); diff --git a/src/Game.h b/src/Game.h index 8eb8fb2..bc54b2f 100644 --- a/src/Game.h +++ b/src/Game.h @@ -2,66 +2,71 @@ class Game { public: - static CJson json; - static ImGuiTextFilter filter; - static std::vector search_categories; - static std::string selected_item; - static std::vector day_names; + inline static CJson json = CJson("mission"); + inline static ImGuiTextFilter filter = ""; + inline static std::vector search_categories; + inline static std::string selected_item = "All"; + inline static std::vector day_names = { "Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday" }; - static char save_game_name[22]; + inline static char save_game_name[22] = ""; struct random_cheats { - static bool enable; - static int enable_wait_time; - static CJson name_json; - static uint timer; - static std::string enabled_cheats[92][2]; + 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]; }; struct freecam { - static bool enable; - static float speed; - static float fov; - static bool init_done; - static CPed* ped; - static int hped; - static float mouseX, mouseY, tmouseX, tmouseY; + 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 { - static bool state; - static float prev_health; - static float prev_max_health; - static float prev_armour; - static float prev_stamina; + 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; }; - static bool disable_cheats; - static bool disable_replay; - static bool forbidden_area_wl; - static bool freeze_mission_timer; - static bool freeze_time; - static bool keep_stuff; - static bool solid_water; - static bool ss_shortcut; - static bool sync_time; - static uint sync_time_timer; - static uint solid_water_object; + 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 { - static CJson json; - static ImGuiTextFilter filter; - static std::vector search_categories; - static std::string selected_item; + inline static CJson json = CJson("stat"); + inline static ImGuiTextFilter filter = ""; + inline static std::vector search_categories; + inline static std::string selected_item = "All"; }; Game(); static void Draw(); static void FreeCam(); static void ClearFreecamStuff(); + static void RealTimeClock(); }; diff --git a/src/Hook.cpp b/src/Hook.cpp index f1e6c51..8ad70da 100644 --- a/src/Hook.cpp +++ b/src/Hook.cpp @@ -2,16 +2,6 @@ #include "kiero/kiero.h" #include "kiero/minhook/MinHook.h" -WNDPROC Hook::oWndProc = NULL; -f_Present11 Hook::oPresent11 = NULL; -f_Present9 Hook::oPresent9 = NULL; -f_Reset Hook::oReset9 = NULL; - -bool Hook::mouse_visibility = false; -bool Hook::show_mouse = false; - -std::function Hook::window_callback = NULL; - LRESULT Hook::WndProc(const HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { ImGui_ImplWin32_WndProcHandler(hWnd, uMsg, wParam, lParam); diff --git a/src/Hook.h b/src/Hook.h index 034a8bc..f9abf17 100644 --- a/src/Hook.h +++ b/src/Hook.h @@ -10,11 +10,11 @@ extern IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg class Hook { private: - static WNDPROC oWndProc; - static f_Present11 oPresent11; - static f_Present9 oPresent9; - static f_Reset oReset9; - static bool mouse_visibility; + inline static WNDPROC oWndProc = NULL; + inline static f_Present11 oPresent11 = NULL; + inline static f_Present9 oPresent9 = NULL; + inline static f_Reset oReset9 = NULL; + inline static bool mouse_visibility = false; static void CALLBACK Present(void* ptr); static HRESULT CALLBACK PresentDx9Handler(IDirect3DDevice9* pDevice, RECT* pSourceRect, RECT* pDestRect, HWND hDestWindowOverride, RGNDATA* pDirtyRegion); @@ -24,8 +24,8 @@ private: static void ShowMouse(bool state); protected: - static bool show_mouse; - static std::function window_callback; + inline static bool show_mouse = false; + inline static std::function window_callback = NULL; Hook(); ~Hook(); }; diff --git a/src/Menu.cpp b/src/Menu.cpp index 385c70e..189a8fd 100644 --- a/src/Menu.cpp +++ b/src/Menu.cpp @@ -7,34 +7,6 @@ #include "Ui.h" #include "Util.h" -bool Menu::overlay::coord = false; -bool Menu::overlay::fps = false; -bool Menu::overlay::loc_name = false; -bool Menu::overlay::transparent = false; -bool Menu::overlay::veh_health = false; -bool Menu::overlay::veh_speed = false; -std::vector Menu::overlay::pos_names{ "Custom", "Top left", "Top right", "Bottom left", "Bottom right" }; -int Menu::overlay::selected_pos = 4; -float Menu::overlay::posX = NULL; -float Menu::overlay::posY = NULL; - -HotKeyData Menu::hotkeys::aim_skin_changer{}; -HotKeyData Menu::hotkeys::freecam{}; -HotKeyData Menu::hotkeys::command_window{}; -HotKeyData Menu::hotkeys::flip_veh{}; -HotKeyData Menu::hotkeys::fix_veh{}; -HotKeyData Menu::hotkeys::free_cam_tp_player{ VK_RETURN,VK_RETURN }; -HotKeyData Menu::hotkeys::god_mode{}; -HotKeyData Menu::hotkeys::menu_open{}; -HotKeyData Menu::hotkeys::quick_ss{}; -HotKeyData Menu::hotkeys::quick_tp{}; -HotKeyData Menu::hotkeys::veh_engine{}; -HotKeyData Menu::hotkeys::veh_instant_start{}; -HotKeyData Menu::hotkeys::veh_instant_stop{}; - -bool Menu::commands::show_menu = false; -char Menu::commands::input_buffer[INPUT_BUFFER_SIZE] = ""; - Menu::Menu() { // TODO: use structs diff --git a/src/Menu.h b/src/Menu.h index 4c8be07..5b50b3c 100644 --- a/src/Menu.h +++ b/src/Menu.h @@ -5,38 +5,38 @@ class Menu private: struct overlay { - static bool coord; - static bool fps; - static bool loc_name; - static bool transparent; - static bool veh_health; - static bool veh_speed; - static std::vector pos_names; - static int selected_pos; - static float posX; - static float posY; + inline static bool coord = false; + inline static bool fps = false; + inline static bool loc_name = false; + inline static bool transparent = false; + inline static bool veh_health = false; + inline static bool veh_speed = false; + inline static std::vector pos_names = { "Custom", "Top left", "Top right", "Bottom left", "Bottom right" }; + inline static int selected_pos = 4; // TODO: Create Enum + inline static float posX = 0.0f; + inline static float posY = 0.0f; }; public: struct hotkeys { - static HotKeyData aim_skin_changer; - static HotKeyData freecam; - static HotKeyData command_window; - static HotKeyData fix_veh; - static HotKeyData flip_veh; - static HotKeyData free_cam_tp_player; - static HotKeyData god_mode; - static HotKeyData menu_open; - static HotKeyData quick_ss; - static HotKeyData quick_tp; - static HotKeyData veh_engine; - static HotKeyData veh_instant_start; - static HotKeyData veh_instant_stop; + 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 { - static bool show_menu; - static char input_buffer[INPUT_BUFFER_SIZE]; + inline static bool show_menu = false; + inline static char input_buffer[INPUT_BUFFER_SIZE] = ""; }; Menu(); diff --git a/src/MenuInfo.h b/src/MenuInfo.h index 272d013..1b175b9 100644 --- a/src/MenuInfo.h +++ b/src/MenuInfo.h @@ -1,5 +1,5 @@ #pragma once #define MENU_NAME "Cheat Menu" #define MENU_VERSION "2.6-beta" -#define BUILD_NUMBER "20210225" +#define BUILD_NUMBER "20210303" #define MENU_TITLE MENU_NAME " v" MENU_VERSION "(" BUILD_NUMBER ")" \ No newline at end of file diff --git a/src/Events.cpp b/src/MoreEvents.cpp similarity index 100% rename from src/Events.cpp rename to src/MoreEvents.cpp diff --git a/src/Events.h b/src/MoreEvents.h similarity index 100% rename from src/Events.h rename to src/MoreEvents.h diff --git a/src/Neon.cpp b/src/Neon.cpp index d38c79d..643dd38 100644 --- a/src/Neon.cpp +++ b/src/Neon.cpp @@ -2,9 +2,6 @@ #include "Neon.h" #include "Util.h" -VehExtender Neon::VehNeon; -RwTexture* Neon::neon_texture = nullptr; - void Neon::RenderEvent(CVehicle *pVeh) { NeonData* data = &VehNeon.Get(pVeh); diff --git a/src/Neon.h b/src/Neon.h index 34eb1e3..3f08413 100644 --- a/src/Neon.h +++ b/src/Neon.h @@ -3,8 +3,6 @@ class Neon { private: - static RwTexture* neon_texture; - class NeonData { public: CRGBA color; @@ -22,8 +20,9 @@ private: increment = true; } }; - - static VehExtender VehNeon; + + inline static RwTexture* neon_texture = nullptr; + inline static VehExtender VehNeon; public: Neon(); diff --git a/src/Paint.cpp b/src/Paint.cpp index 793911b..6fa25ab 100644 --- a/src/Paint.cpp +++ b/src/Paint.cpp @@ -28,12 +28,6 @@ #include "NodeName.h" #include "Util.h" -std::vector Paint::veh_nodes::names_vec{ "Default" }; -std::string Paint::veh_nodes::selected = "Default"; -VehExtender Paint::vehdata; - -std::map> Paint::textures; - void Paint::RenderEvent(CVehicle* pVeh) { VehData& data = vehdata.Get(pVeh); diff --git a/src/Paint.h b/src/Paint.h index f11dcf5..1413938 100644 --- a/src/Paint.h +++ b/src/Paint.h @@ -73,15 +73,15 @@ private: void resetMaterialTexture(RpMaterial* material); }; - static VehExtender vehdata; + inline static VehExtender vehdata; protected: - static std::map> textures; + inline static std::map> textures; struct veh_nodes { - static std::vector names_vec; - static std::string selected; + inline static std::vector names_vec{ "Default" }; + inline static std::string selected = "Default"; }; Paint(); diff --git a/src/Ped.cpp b/src/Ped.cpp index 867ee52..6ad3439 100644 --- a/src/Ped.cpp +++ b/src/Ped.cpp @@ -3,32 +3,6 @@ #include "Ui.h" #include "Util.h" -ImGuiTextFilter Ped::filter = ""; -std::string Ped::selected_item = "All"; -std::vector Ped::search_categories; -std::vector> Ped::peds_vec; -bool Ped::images_loaded = false; - -CJson Ped::ped_json = CJson("ped"); -CJson Ped::pedspecial_json = CJson("ped special"); - -std::vector Ped::gang_names = { "Ballas", "Grove street families", "Los santos vagos", "San fierro rifa", -"Da nang boys", "Mafia", "Mountain cloud triad", "Varrio los aztecas", "Gang9", "Gang10" }; - -bool Ped::exgangwars_installed = false; -int Ped::ped_remove_radius = 5; - -std::vector Ped::spawn_ped::list; -int Ped::spawn_ped::accuracy = 50; -int Ped::spawn_ped::health = 100; -int Ped::spawn_ped::selected_ped_type = 0; -bool Ped::spawn_ped::dont_move = false; -bool Ped::spawn_ped::ped_bleed = false; -int Ped::spawn_ped::weapon_id = 0; - -std::vector Ped::spawn_ped::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" }; Ped::Ped() { if (GetModuleHandle("ExGangWars.asi")) diff --git a/src/Ped.h b/src/Ped.h index f71fe8b..43589e3 100644 --- a/src/Ped.h +++ b/src/Ped.h @@ -5,29 +5,37 @@ class Ped { private: - static ImGuiTextFilter filter; - static std::string selected_item; - static std::vector search_categories; - static std::vector> peds_vec; - static bool images_loaded; + inline static ImGuiTextFilter filter = ""; + inline static std::string selected_item = "All"; + inline static std::vector search_categories; + inline static std::vector> peds_vec; + inline static bool images_loaded = false; - static CJson ped_json; - static CJson pedspecial_json; + inline static CJson ped_json = CJson("ped"); + inline static CJson pedspecial_json = CJson("ped special"); - static std::vector gang_names; - static bool exgangwars_installed; - - static int ped_remove_radius; + inline static std::vector gang_names = + { + "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 { - static std::vector list; - static int accuracy; - static int health; - static bool dont_move; - static bool ped_bleed; - static std::vector ped_type; - static int selected_ped_type; - static int weapon_id; + inline static std::vector 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 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; }; friend class Player; diff --git a/src/Player.cpp b/src/Player.cpp index 10892c9..aea3e0e 100644 --- a/src/Player.cpp +++ b/src/Player.cpp @@ -5,25 +5,7 @@ #include "Ui.h" #include "Util.h" -bool Player::keep_position::state = false; -CVector Player::keep_position::pos = CVector(); -bool Player::god_mode = false; -int Player::body = 0; -bool Player::aim_skin_changer = false; - -ImGuiTextFilter Player::filter = ""; -std::vector Player::search_categories; -std::vector> Player::clothes_vec; -std::string Player::selected_item = "All"; -bool Player::images_loaded = false; - -std::string Player::custom_skins::dir = paths::GetGameDirPathA() + std::string("\\modloader\\Custom Skins\\"); -std::vector Player::custom_skins::store_vec; -ImGuiTextFilter Player::custom_skins::filter = ""; - -bool Player::modloader_installed = false; - -static void PlayerModelBrokenFix() +inline static void PlayerModelBrokenFix() { CPlayerPed* player = FindPlayerPed(); diff --git a/src/Player.h b/src/Player.h index 3fed33e..094e9e3 100644 --- a/src/Player.h +++ b/src/Player.h @@ -4,30 +4,30 @@ class Player private: struct keep_position { - static bool state; - static CVector pos; + inline static bool state = false; + inline static CVector pos; }; - static bool god_mode; - static int body; - static bool aim_skin_changer; - static ImGuiTextFilter filter; - static std::string selected_item; - static std::vector search_categories; - static std::vector> clothes_vec; - static bool images_loaded; + inline static bool god_mode = false; + inline static int body = 0; + inline static bool aim_skin_changer = false; + inline static ImGuiTextFilter filter = ""; + inline static std::string selected_item = "All"; + inline static std::vector search_categories; + inline static std::vector> clothes_vec; + inline static bool images_loaded = false; struct custom_skins { - static std::string dir; - static ImGuiTextFilter filter; - static std::vector store_vec; + inline static std::string dir = paths::GetGameDirPathA() + std::string("\\modloader\\Custom Skins\\");; + inline static ImGuiTextFilter filter = ""; + inline static std::vector store_vec; }; - static bool modloader_installed; + inline static bool modloader_installed = false; public: + Player(); static void ChangePlayerCloth(std::string& model); static void ChangePlayerModel(std::string& model); - Player(); static void Draw(); }; diff --git a/src/Teleport.cpp b/src/Teleport.cpp index 1d50ce3..4b04ce3 100644 --- a/src/Teleport.cpp +++ b/src/Teleport.cpp @@ -7,23 +7,6 @@ // FlA tRadarTrace* CRadar::ms_RadarTrace = reinterpret_cast(patch::GetPointer(0x5838B0 + 2)); -bool Teleport::insert_coord = false; -bool Teleport::quick_teleport = false; -char Teleport::input_buffer[INPUT_BUFFER_SIZE] = ""; -char Teleport::location_buffer[INPUT_BUFFER_SIZE] = ""; - -CVector Teleport::STeleport::pos{ -1, -1, -1 }; -bool Teleport::STeleport::_bool = false; -uint Teleport::STeleport::timer = 0; -ImGuiTextFilter Teleport::filter = ""; -std::vector Teleport::search_categories; -std::string Teleport::selected_item = "All"; - -uint quick_teleport_timer = 0; - -CJson Teleport::json = CJson("teleport"); -CJson Teleport::sprite_name_json = CJson("radar sprite"); - void Teleport::FetchRadarSpriteData() { uint cur_timer = CTimer::m_snTimeInMilliseconds; diff --git a/src/Teleport.h b/src/Teleport.h index 773e62a..4c25765 100644 --- a/src/Teleport.h +++ b/src/Teleport.h @@ -5,23 +5,24 @@ class Teleport { private: - static bool insert_coord; - static bool quick_teleport; - static char input_buffer[INPUT_BUFFER_SIZE]; - static CJson json; - static ImGuiTextFilter filter; - static std::vector search_categories; - static std::string selected_item; - static char location_buffer[INPUT_BUFFER_SIZE]; - + inline static bool insert_coord = false; + inline static bool quick_teleport = false; + inline static char input_buffer[INPUT_BUFFER_SIZE] = ""; + inline static CJson json = CJson("teleport"); + inline static ImGuiTextFilter filter = ""; + inline static std::vector search_categories; + inline static std::string selected_item = "All"; + inline static char location_buffer[INPUT_BUFFER_SIZE] = ""; + inline static uint quick_teleport_timer = 0; + struct STeleport { - static bool _bool; - static CVector pos; - static uint timer; + inline static bool _bool = false; + inline static CVector pos = { -1, -1, -1 }; + inline static uint timer = 0; }; - static CJson sprite_name_json; + inline static CJson sprite_name_json = CJson("radar sprite"); /* Generates radar sprite coordinates on the fly. diff --git a/src/TimeCycle.h b/src/TimeCycle.h index 86c2236..2dfb78e 100644 --- a/src/TimeCycle.h +++ b/src/TimeCycle.h @@ -1,5 +1,3 @@ -#include "plugin.h" - uchar* m_nDirectionalMult = (uchar*)0x55F7C7; //m_nDirectionalMult[184] uchar* m_nWaterFogAlpha = (uchar*)0x55F7B8; //m_nWaterFogAlpha[184] diff --git a/src/Ui.cpp b/src/Ui.cpp index 45dd1dc..47b4c55 100644 --- a/src/Ui.cpp +++ b/src/Ui.cpp @@ -1,11 +1,6 @@ #include "pch.h" #include "Ui.h" -std::string Ui::current_hotkey = ""; - -static Ui::JsonPopUpData json_popup; -static Ui::ImgPopUpData img_popup; - bool Ui::ListBox(const char* label, std::vector& all_items, int& selected) { bool rtn = false; diff --git a/src/Ui.h b/src/Ui.h index 3bb55a3..f607fbd 100644 --- a/src/Ui.h +++ b/src/Ui.h @@ -5,7 +5,8 @@ class Ui { private: - static std::string current_hotkey; + inline static std::string current_hotkey = ""; + public: struct NamedMemory { std::string name; @@ -30,6 +31,9 @@ public: std::function function; std::string value; }; + inline static JsonPopUpData json_popup; + inline static ImgPopUpData img_popup; + static void CenterdText(const std::string& text); static bool ColorButton(int color_id, std::vector& color, ImVec2 size); static bool CheckboxAddress(const char* label, const int addr = NULL, const char* hint = nullptr); diff --git a/src/VehExtender.h b/src/VehExtender.h index 1ef6714..5307427 100644 --- a/src/VehExtender.h +++ b/src/VehExtender.h @@ -5,25 +5,43 @@ #pragma once #include #include "CVehicle.h" +#include "Events.h" template class VehExtender { -public: - VehExtender(){}; - VehExtender(const VehExtender&) = delete; - - T& Get(CVehicle *veh) - { - static std::vector> data; +private: + inline static std::vector> data; +public: + static void RemoveVehEntry(CVehicle *pVeh) + { for (auto it = data.begin(); it < data.end(); ++it) { - if (it->first == veh) + if (it->first == pVeh) + data.erase(it); + } + } + + VehExtender() + { + plugin::Events::vehicleCtorEvent.after += RemoveVehEntry; + } + ~VehExtender() + { + plugin::Events::vehicleCtorEvent.after -= RemoveVehEntry; + } + VehExtender(const VehExtender&) = delete; + + T& Get(CVehicle *pVeh) + { + for (auto it = data.begin(); it < data.end(); ++it) + { + if (it->first == pVeh) return it->second; } - data.push_back({veh, T(veh)}); + data.push_back({pVeh, T(pVeh)}); return data.back().second; } }; \ No newline at end of file diff --git a/src/Vehicle.cpp b/src/Vehicle.cpp index 218be7c..42b7f97 100644 --- a/src/Vehicle.cpp +++ b/src/Vehicle.cpp @@ -4,71 +4,6 @@ #include "Ui.h" #include "Util.h" -bool Vehicle::bike_fly = false; -bool Vehicle::dont_fall_bike = false; -bool Vehicle::veh_heavy = false; -bool Vehicle::veh_watertight = false; -bool Vehicle::veh_nodmg = false; -int Vehicle::veh_remove_radius = 5; -bool Vehicle::lock_speed = false; -float Vehicle::lock_speed_val = 0; - -int Vehicle::door_menu_button = 0; -std::string Vehicle::door_names[6] = { "Hood","Boot","Front left door","Front right door","Rear left door","Rear right door" }; - -std::map Vehicle::vehicle_ide; -std::vector> Vehicle::carcols_color_values; -std::map> Vehicle::carcols_car_data; - -int Vehicle::color::radio_btn = 1; -bool Vehicle::color::show_all = false; -bool Vehicle::color::material_filter = true; -float Vehicle::color::color_picker[3]{ 0,0,0 }; - -ImGuiTextFilter Vehicle::spawner::filter = ""; -std::vector Vehicle::spawner::search_categories; -std::vector> Vehicle::spawner::image_vec; -std::string Vehicle::spawner::selected_item = "All"; -bool Vehicle::spawner::spawn_inside = true; -bool Vehicle::spawner::spawn_in_air = true; -char Vehicle::spawner::license_text[9] = ""; - -ImGuiTextFilter Vehicle::texture9::filter = ""; -std::vector Vehicle::texture9::search_categories; -std::vector> Vehicle::texture9::image_vec; -std::string Vehicle::texture9::selected_item = "All"; - -ImGuiTextFilter Vehicle::tune::filter = ""; -std::vector Vehicle::tune::search_categories; -std::vector> Vehicle::tune::image_vec; -std::string Vehicle::tune::selected_item = "All"; -bool Vehicle::images_loaded = false; - -float Vehicle::neon::color_picker[3]{ 0,0,0 }; -bool Vehicle::neon::rainbow = false; -uint Vehicle::neon::rainbow_timer = 0; -bool Vehicle::neon::traffic = false; -uint Vehicle::neon::traffic_timer = 0; - -bool Vehicle::unlimited_nitro::enabled = false; -bool Vehicle::unlimited_nitro::comp_added = false; - -static std::vector(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" -}; - -static std::vector(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" -}; - Vehicle::Vehicle() { ParseVehiclesIDE(); diff --git a/src/Vehicle.h b/src/Vehicle.h index a115aa6..7a356fb 100644 --- a/src/Vehicle.h +++ b/src/Vehicle.h @@ -5,72 +5,90 @@ class Vehicle : Paint, Neon { private: - static bool bike_fly; - static bool dont_fall_bike; - static bool veh_heavy; - static bool veh_watertight; - static bool veh_nodmg; - static int door_menu_button; - static std::string door_names[6]; - static int veh_remove_radius; + 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; - static bool lock_speed; - static float lock_speed_val; + inline static bool lock_speed = false; + inline static float lock_speed_val = 0.0f; - static std::map vehicle_ide; - static std::vector> carcols_color_values; - static std::map> carcols_car_data; + inline static std::map vehicle_ide; + inline static std::vector> carcols_color_values; + inline static std::map> carcols_car_data; struct color { - static bool material_filter; - static int radio_btn; - static bool show_all; - static float color_picker[3]; + 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 }; }; struct neon { - static float color_picker[3]; - static bool rainbow; - static uint rainbow_timer; - static bool traffic; - static uint traffic_timer; + 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 { - static ImGuiTextFilter filter; - static std::string selected_item; - static std::vector search_categories; - static std::vector> image_vec; - static bool spawn_inside; - static bool spawn_in_air; - static char license_text[9]; + inline static ImGuiTextFilter filter = ""; + inline static std::string selected_item = "All"; + inline static std::vector search_categories; + inline static std::vector> image_vec; + inline static bool spawn_inside = true; + inline static bool spawn_in_air = true; + inline static char license_text[9] = ""; }; struct texture9 { - static ImGuiTextFilter filter; - static std::string selected_item; - static std::vector search_categories; - static std::vector> image_vec; + inline static ImGuiTextFilter filter = ""; + inline static std::string selected_item = "All"; + inline static std::vector search_categories; + inline static std::vector> image_vec; }; - static bool images_loaded; + inline static bool images_loaded = false; struct tune { - static ImGuiTextFilter filter; - static std::string selected_item; - static std::vector search_categories; - static std::vector> image_vec; + inline static ImGuiTextFilter filter = ""; + inline static std::string selected_item = "All"; + inline static std::vector search_categories; + inline static std::vector> image_vec; }; struct unlimited_nitro { - static bool enabled; - static bool comp_added; + inline static bool enabled = false; + inline static bool comp_added = false; }; + + inline static std::vector(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(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" + }; + 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); diff --git a/src/Visual.cpp b/src/Visual.cpp index 7f6b55e..897a95d 100644 --- a/src/Visual.cpp +++ b/src/Visual.cpp @@ -6,26 +6,6 @@ #include "CHudColours.h" #include "TimeCycle.h" - -bool Visual::lock_weather = false; -int Visual::weather_type_backup = 0; -int Visual::timecyc_hour = 8; - -std::vector Visual::weather_names{ -"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" -}; - -// Let's just use our own variables -static float radar_posX; -static float radar_posY; -static float radar_width = 76.0f; -static float radar_height = 104.0f; -static CHudColour health_bar; -//static CHudColour armour_bar; -static bool init_patches = false; - Visual::Visual() { if (GetModuleHandle("timecycle24.asi")) @@ -226,17 +206,17 @@ void Visual::Draw() } if (ImGui::BeginTabItem("Menus")) { + static bool init_patches = false; + static float radar_posX = *(float*)*(int*)0x5834D4; + static float radar_posY = *(float*)*(int*)0x583500; + static float radar_width = *(float*)*(int*)0x5834C2; + static float radar_height = *(float*)*(int*)0x5834F6; + static CHudColour health_bar = HudColour.m_aColours[0]; if (!init_patches) { // read those values from game health_bar = HudColour.m_aColours[0]; - //armour_bar = HudColour.m_aColours[4]; - - radar_posX = *(float*)*(int*)0x5834D4; - radar_posY = *(float*)*(int*)0x583500; - radar_height = *(float*)*(int*)0x5834F6; - radar_width = *(float*)*(int*)0x5834C2; // patch radar stuff oof patch::SetPointer(0x5834D4, &radar_posX); @@ -262,7 +242,6 @@ void Visual::Draw() patch::SetPointer(0x58A99D, &radar_width); patch::SetPointer(0x589331, &health_bar); - //patch::SetPointer(0x5890FC,&armour_bar); init_patches = true; } diff --git a/src/Visual.h b/src/Visual.h index 15c8a08..d39ac52 100644 --- a/src/Visual.h +++ b/src/Visual.h @@ -2,12 +2,17 @@ class Visual { private: - static bool lock_weather; - static int weather_type_backup; + inline static bool lock_weather = false; + inline static int weather_type_backup = 0; // Timecyc - static std::vector weather_names; - static int timecyc_hour; + inline static int timecyc_hour = 8; + inline static std::vector weather_names + { + "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(); diff --git a/src/Weapon.cpp b/src/Weapon.cpp index 2f4a985..3f0685c 100644 --- a/src/Weapon.cpp +++ b/src/Weapon.cpp @@ -2,42 +2,7 @@ #include "Weapon.h" #include "Ui.h" #include "Util.h" - -ImGuiTextFilter Weapon::filter = ""; -std::string Weapon::selected_item = "All"; -std::vector Weapon::search_categories; -std::vector> Weapon::weapon_vec; -bool Weapon::images_loaded = false; - -CJson Weapon::weapon_json = CJson("weapon"); -bool Weapon::auto_aim = false; -bool Weapon::fast_reload = false; -bool Weapon::huge_damage = false; -bool Weapon::long_range = false; -bool Weapon::rapid_fire = false; -bool Weapon::dual_weild = false; -bool Weapon::move_aim = false; -bool Weapon::move_fire = false; - -uchar Weapon::cur_weapon_slot = -1; -int Weapon::ammo_count = 99999; - -int Weapon::selected_gang = 0; -int Weapon::selected_weapon_count = 0; - -int Weapon::gang_weapons[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 -}; +#include "Ped.h" Weapon::Weapon() { diff --git a/src/Weapon.h b/src/Weapon.h index 41014b2..bc5c759 100644 --- a/src/Weapon.h +++ b/src/Weapon.h @@ -1,35 +1,44 @@ #pragma once -#include "Ped.h" + class Weapon { -private: - static ImGuiTextFilter filter; - static std::string selected_item; - static std::vector search_categories; - static std::vector> weapon_vec; - static bool images_loaded; - - static CJson weapon_json; - - static bool auto_aim; - static bool fast_reload; - static bool huge_damage; - static bool long_range; - static bool rapid_fire; - static bool dual_weild; - static bool move_aim; - static bool move_fire; - - static int ammo_count; - static uchar cur_weapon_slot; - - static int selected_gang; - static int selected_weapon_count; - static int cur_weapon; - static int gang_weapons[10][3]; - - friend class Ped; public: + inline static ImGuiTextFilter filter = ""; + inline static std::string selected_item = "All"; + inline static std::vector search_categories; + inline static std::vector> weapon_vec; + inline static bool images_loaded = false; + + inline static CJson weapon_json = CJson("weapon"); + + inline static bool auto_aim = false; + inline static bool fast_reload = false; + inline static bool huge_damage = false; + 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] = + { + {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(); ~Weapon(); diff --git a/src/pch.cpp b/src/pch.cpp index dd3cf83..1d9f38c 100644 --- a/src/pch.cpp +++ b/src/pch.cpp @@ -1,13 +1 @@ #include "pch.h" - -std::string Globals::header_id = ""; -ImVec2 Globals::menu_size = ImVec2(screen::GetScreenWidth() / 4, screen::GetScreenHeight() / 1.2); -ImVec2 Globals::screen_size = ImVec2(-1, -1); -bool Globals::show_menu = false; -bool Globals::init_done = false; -Renderer Globals::renderer = Render_Unknown; -void* Globals::device = nullptr; -bool Globals::game_init = false; - -std::ofstream flog = std::ofstream("CheatMenu.log"); -CJson config = CJson("config"); diff --git a/src/pch.h b/src/pch.h index ed9543a..17fc879 100644 --- a/src/pch.h +++ b/src/pch.h @@ -58,7 +58,7 @@ #include "imgui/imgui_impl_dx11.h" #include "imgui/imgui_impl_win32.h" -#include "Events.h" +#include "MoreEvents.h" #include "Json.h" #include "VKeys.h" #include "VehExtender.h" @@ -77,16 +77,19 @@ enum Renderer struct Globals { - static std::string header_id; - static ImVec2 menu_size; - static ImVec2 screen_size; - static bool show_menu; - static bool init_done; - static bool game_init; - static Renderer renderer; - static void* device; + 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 game_init = false; + inline static Renderer renderer = Render_Unknown; + inline static void* device = nullptr; }; +inline static std::ofstream flog = std::ofstream("CheatMenu.log"); +inline static CJson config = CJson("config"); + struct TextureStructure { std::string file_name; @@ -99,7 +102,4 @@ struct HotKeyData int key1; int key2; bool is_down = false; -}; - -extern CJson config; -extern std::ofstream flog; \ No newline at end of file +}; \ No newline at end of file