Refactor code
This commit is contained in:
parent
4a4847f417
commit
b9cc290603
@ -10,7 +10,6 @@ set(GTA_SA_DIR F:/GTASanAndreas)
|
||||
# Can ignore the below paths if you got them in system paths
|
||||
set(PLUGIN_SDK_DIR $ENV{PLUGIN_SDK_DIR})
|
||||
set(DIRECTX9_SDK_DIR $ENV{DIRECTX9_SDK_DIR})
|
||||
set(VULKAN_SDK_DIR $ENV{VK_SDK_PATH})
|
||||
################################################################################
|
||||
|
||||
################################################################################
|
||||
@ -94,7 +93,6 @@ include_directories(
|
||||
"${PLUGIN_SDK_DIR}/shared"
|
||||
"${PLUGIN_SDK_DIR}/shared/game"
|
||||
"${DIRECTX9_SDK_DIR}/include"
|
||||
# "${VULKAN_SDK_DIR}/Include"
|
||||
"deps"
|
||||
)
|
||||
|
||||
@ -182,7 +180,6 @@ Depend
|
||||
target_link_directories(${PROJECT_NAME} PUBLIC
|
||||
"${PLUGIN_SDK_DIR}/output/lib/"
|
||||
"${DIRECTX9_SDK_DIR}/lib/x86/"
|
||||
# "${VULKAN_SDK_DIR}/lib32"
|
||||
"$<$<CONFIG:Release>:"
|
||||
"deps/Release/"
|
||||
">"
|
||||
|
4
deps/CMakeLists.txt
vendored
4
deps/CMakeLists.txt
vendored
@ -21,8 +21,6 @@ set(depend_files
|
||||
"imgui/imgui_impl_dx9.h"
|
||||
"imgui/imgui_impl_dx11.cpp"
|
||||
"imgui/imgui_impl_dx11.h"
|
||||
# "imgui/imgui_impl_vulkan.cpp"
|
||||
# "imgui/imgui_impl_vulkan.h"
|
||||
"imgui/imgui_impl_win32.cpp"
|
||||
"imgui/imgui_impl_win32.h"
|
||||
"imgui/imgui_internal.h"
|
||||
@ -67,8 +65,6 @@ include_directories(
|
||||
"$ENV{PLUGIN_SDK_DIR}/shared"
|
||||
"$ENV{PLUGIN_SDK_DIR}/shared/game"
|
||||
"$ENV{DIRECTX9_SDK_DIR}/include"
|
||||
# "${VULKAN_SDK_DIR}/Include"
|
||||
# "${VULKAN_SDK_DIR}/lib32"
|
||||
)
|
||||
|
||||
target_compile_options(${PROJECT_NAME} PRIVATE
|
||||
|
1414
deps/imgui/imgui_impl_vulkan.cpp
vendored
1414
deps/imgui/imgui_impl_vulkan.cpp
vendored
File diff suppressed because it is too large
Load Diff
148
deps/imgui/imgui_impl_vulkan.h
vendored
148
deps/imgui/imgui_impl_vulkan.h
vendored
@ -1,148 +0,0 @@
|
||||
// dear imgui: Renderer Backend for Vulkan
|
||||
// This needs to be used along with a Platform Backend (e.g. GLFW, SDL, Win32, custom..)
|
||||
|
||||
// Implemented features:
|
||||
// [X] Renderer: Support for large meshes (64k+ vertices) with 16-bit indices.
|
||||
// Missing features:
|
||||
// [ ] Renderer: User texture binding. Changes of ImTextureID aren't supported by this backend! See https://github.com/ocornut/imgui/pull/914
|
||||
|
||||
// You can copy and use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
|
||||
// If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp.
|
||||
// Read online: https://github.com/ocornut/imgui/tree/master/docs
|
||||
|
||||
// The aim of imgui_impl_vulkan.h/.cpp is to be usable in your engine without any modification.
|
||||
// IF YOU FEEL YOU NEED TO MAKE ANY CHANGE TO THIS CODE, please share them and your feedback at https://github.com/ocornut/imgui/
|
||||
|
||||
// Important note to the reader who wish to integrate imgui_impl_vulkan.cpp/.h in their own engine/app.
|
||||
// - Common ImGui_ImplVulkan_XXX functions and structures are used to interface with imgui_impl_vulkan.cpp/.h.
|
||||
// You will use those if you want to use this rendering backend in your engine/app.
|
||||
// - Helper ImGui_ImplVulkanH_XXX functions and structures are only used by this example (main.cpp) and by
|
||||
// the backend itself (imgui_impl_vulkan.cpp), but should PROBABLY NOT be used by your own engine/app code.
|
||||
// Read comments in imgui_impl_vulkan.h.
|
||||
|
||||
#pragma once
|
||||
#include "imgui.h" // IMGUI_IMPL_API
|
||||
|
||||
// [Configuration] in order to use a custom Vulkan function loader:
|
||||
// (1) You'll need to disable default Vulkan function prototypes.
|
||||
// We provide a '#define IMGUI_IMPL_VULKAN_NO_PROTOTYPES' convenience configuration flag.
|
||||
// In order to make sure this is visible from the imgui_impl_vulkan.cpp compilation unit:
|
||||
// - Add '#define IMGUI_IMPL_VULKAN_NO_PROTOTYPES' in your imconfig.h file
|
||||
// - Or as a compilation flag in your build system
|
||||
// - Or uncomment here (not recommended because you'd be modifying imgui sources!)
|
||||
// - Do not simply add it in a .cpp file!
|
||||
// (2) Call ImGui_ImplVulkan_LoadFunctions() before ImGui_ImplVulkan_Init() with your custom function.
|
||||
// If you have no idea what this is, leave it alone!
|
||||
//#define IMGUI_IMPL_VULKAN_NO_PROTOTYPES
|
||||
|
||||
// Vulkan includes
|
||||
#if defined(IMGUI_IMPL_VULKAN_NO_PROTOTYPES) && !defined(VK_NO_PROTOTYPES)
|
||||
#define VK_NO_PROTOTYPES
|
||||
#endif
|
||||
#include <vulkan/vulkan.h>
|
||||
|
||||
// Initialization data, for ImGui_ImplVulkan_Init()
|
||||
// [Please zero-clear before use!]
|
||||
struct ImGui_ImplVulkan_InitInfo
|
||||
{
|
||||
VkInstance Instance;
|
||||
VkPhysicalDevice PhysicalDevice;
|
||||
VkDevice Device;
|
||||
uint32_t QueueFamily;
|
||||
VkQueue Queue;
|
||||
VkPipelineCache PipelineCache;
|
||||
VkDescriptorPool DescriptorPool;
|
||||
uint32_t Subpass;
|
||||
uint32_t MinImageCount; // >= 2
|
||||
uint32_t ImageCount; // >= MinImageCount
|
||||
VkSampleCountFlagBits MSAASamples; // >= VK_SAMPLE_COUNT_1_BIT
|
||||
const VkAllocationCallbacks* Allocator;
|
||||
void (*CheckVkResultFn)(VkResult err);
|
||||
};
|
||||
|
||||
// Called by user code
|
||||
IMGUI_IMPL_API bool ImGui_ImplVulkan_Init(ImGui_ImplVulkan_InitInfo* info, VkRenderPass render_pass);
|
||||
IMGUI_IMPL_API void ImGui_ImplVulkan_Shutdown();
|
||||
IMGUI_IMPL_API void ImGui_ImplVulkan_NewFrame();
|
||||
IMGUI_IMPL_API void ImGui_ImplVulkan_RenderDrawData(ImDrawData* draw_data, VkCommandBuffer command_buffer, VkPipeline pipeline = VK_NULL_HANDLE);
|
||||
IMGUI_IMPL_API bool ImGui_ImplVulkan_CreateFontsTexture(VkCommandBuffer command_buffer);
|
||||
IMGUI_IMPL_API void ImGui_ImplVulkan_DestroyFontUploadObjects();
|
||||
IMGUI_IMPL_API void ImGui_ImplVulkan_SetMinImageCount(uint32_t min_image_count); // To override MinImageCount after initialization (e.g. if swap chain is recreated)
|
||||
|
||||
// Optional: load Vulkan functions with a custom function loader
|
||||
// This is only useful with IMGUI_IMPL_VULKAN_NO_PROTOTYPES / VK_NO_PROTOTYPES
|
||||
IMGUI_IMPL_API bool ImGui_ImplVulkan_LoadFunctions(PFN_vkVoidFunction(*loader_func)(const char* function_name, void* user_data), void* user_data = NULL);
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Internal / Miscellaneous Vulkan Helpers
|
||||
// (Used by example's main.cpp. Used by multi-viewport features. PROBABLY NOT used by your own engine/app.)
|
||||
//-------------------------------------------------------------------------
|
||||
// You probably do NOT need to use or care about those functions.
|
||||
// Those functions only exist because:
|
||||
// 1) they facilitate the readability and maintenance of the multiple main.cpp examples files.
|
||||
// 2) the upcoming multi-viewport feature will need them internally.
|
||||
// Generally we avoid exposing any kind of superfluous high-level helpers in the backends,
|
||||
// but it is too much code to duplicate everywhere so we exceptionally expose them.
|
||||
//
|
||||
// Your engine/app will likely _already_ have code to setup all that stuff (swap chain, render pass, frame buffers, etc.).
|
||||
// You may read this code to learn about Vulkan, but it is recommended you use you own custom tailored code to do equivalent work.
|
||||
// (The ImGui_ImplVulkanH_XXX functions do not interact with any of the state used by the regular ImGui_ImplVulkan_XXX functions)
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
struct ImGui_ImplVulkanH_Frame;
|
||||
struct ImGui_ImplVulkanH_Window;
|
||||
|
||||
// Helpers
|
||||
IMGUI_IMPL_API void ImGui_ImplVulkanH_CreateOrResizeWindow(VkInstance instance, VkPhysicalDevice physical_device, VkDevice device, ImGui_ImplVulkanH_Window* wnd, uint32_t queue_family, const VkAllocationCallbacks* allocator, int w, int h, uint32_t min_image_count);
|
||||
IMGUI_IMPL_API void ImGui_ImplVulkanH_DestroyWindow(VkInstance instance, VkDevice device, ImGui_ImplVulkanH_Window* wnd, const VkAllocationCallbacks* allocator);
|
||||
IMGUI_IMPL_API VkSurfaceFormatKHR ImGui_ImplVulkanH_SelectSurfaceFormat(VkPhysicalDevice physical_device, VkSurfaceKHR surface, const VkFormat* request_formats, int request_formats_count, VkColorSpaceKHR request_color_space);
|
||||
IMGUI_IMPL_API VkPresentModeKHR ImGui_ImplVulkanH_SelectPresentMode(VkPhysicalDevice physical_device, VkSurfaceKHR surface, const VkPresentModeKHR* request_modes, int request_modes_count);
|
||||
IMGUI_IMPL_API int ImGui_ImplVulkanH_GetMinImageCountFromPresentMode(VkPresentModeKHR present_mode);
|
||||
|
||||
// Helper structure to hold the data needed by one rendering frame
|
||||
// (Used by example's main.cpp. Used by multi-viewport features. Probably NOT used by your own engine/app.)
|
||||
// [Please zero-clear before use!]
|
||||
struct ImGui_ImplVulkanH_Frame
|
||||
{
|
||||
VkCommandPool CommandPool;
|
||||
VkCommandBuffer CommandBuffer;
|
||||
VkFence Fence;
|
||||
VkImage Backbuffer;
|
||||
VkImageView BackbufferView;
|
||||
VkFramebuffer Framebuffer;
|
||||
};
|
||||
|
||||
struct ImGui_ImplVulkanH_FrameSemaphores
|
||||
{
|
||||
VkSemaphore ImageAcquiredSemaphore;
|
||||
VkSemaphore RenderCompleteSemaphore;
|
||||
};
|
||||
|
||||
// Helper structure to hold the data needed by one rendering context into one OS window
|
||||
// (Used by example's main.cpp. Used by multi-viewport features. Probably NOT used by your own engine/app.)
|
||||
struct ImGui_ImplVulkanH_Window
|
||||
{
|
||||
int Width;
|
||||
int Height;
|
||||
VkSwapchainKHR Swapchain;
|
||||
VkSurfaceKHR Surface;
|
||||
VkSurfaceFormatKHR SurfaceFormat;
|
||||
VkPresentModeKHR PresentMode;
|
||||
VkRenderPass RenderPass;
|
||||
VkPipeline Pipeline; // The window pipeline may uses a different VkRenderPass than the one passed in ImGui_ImplVulkan_InitInfo
|
||||
bool ClearEnable;
|
||||
VkClearValue ClearValue;
|
||||
uint32_t FrameIndex; // Current frame being rendered to (0 <= FrameIndex < FrameInFlightCount)
|
||||
uint32_t ImageCount; // Number of simultaneous in-flight frames (returned by vkGetSwapchainImagesKHR, usually derived from min_image_count)
|
||||
uint32_t SemaphoreIndex; // Current set of swapchain wait semaphores we're using (needs to be distinct from per frame data)
|
||||
ImGui_ImplVulkanH_Frame* Frames;
|
||||
ImGui_ImplVulkanH_FrameSemaphores* FrameSemaphores;
|
||||
|
||||
ImGui_ImplVulkanH_Window()
|
||||
{
|
||||
memset(this, 0, sizeof(*this));
|
||||
PresentMode = VK_PRESENT_MODE_MAX_ENUM_KHR;
|
||||
ClearEnable = true;
|
||||
}
|
||||
};
|
||||
|
@ -17,8 +17,8 @@ CJson Animation::json = CJson("animation");
|
||||
std::vector<std::string> fighting_vec{ "Default","Boxing","Kung fu","Kick Boxing","Punch Kick" };
|
||||
int fighting_selected = 0;
|
||||
|
||||
std::vector<std::string> walking_vec{ "default", "man", "shuffle", "oldman", "gang1", "gang2",
|
||||
"oldfatman", "fatman", "jogger", "drunkman", "blindman", "swat", "woman", "shopping", "busywoman",
|
||||
std::vector<std::string> walking_vec{ "default", "man", "shuffle", "oldman", "gang1", "gang2",
|
||||
"oldfatman", "fatman", "jogger", "drunkman", "blindman", "swat", "woman", "shopping", "busywoman",
|
||||
"sexywoman", "pro", "oldwoman", "fatwoman", "jogwoman", "oldfatwoman", "skate" };
|
||||
|
||||
std::string walking_selected = "default";
|
||||
@ -28,7 +28,7 @@ Animation::Animation()
|
||||
json.LoadData(search_categories, selected_item);
|
||||
}
|
||||
|
||||
void Animation::Main()
|
||||
void Animation::Draw()
|
||||
{
|
||||
if (ImGui::BeginTabBar("Animation", ImGuiTabBarFlags_NoTooltip + ImGuiTabBarFlags_FittingPolicyScroll))
|
||||
{
|
||||
@ -70,7 +70,7 @@ void Animation::Main()
|
||||
if (Ui::ListBox("Fighting", fighting_vec, fighting_selected))
|
||||
{
|
||||
Command<Commands::GIVE_MELEE_ATTACK_TO_CHAR>(hplayer, fighting_selected + 4, 6);
|
||||
CHud::SetHelpMessage("Fighting anim set",false,false,false);
|
||||
CHud::SetHelpMessage("Fighting anim set", false, false, false);
|
||||
}
|
||||
if (Ui::ListBoxStr("Walking", walking_vec, walking_selected))
|
||||
{
|
||||
@ -90,7 +90,7 @@ void Animation::Main()
|
||||
Command<Commands::LOAD_ALL_MODELS_NOW>();
|
||||
Command<Commands::SET_ANIM_GROUP_FOR_CHAR>(hplayer, cwalking_selected);
|
||||
Command<Commands::REMOVE_ANIMATION>(cwalking_selected);
|
||||
}
|
||||
}
|
||||
CHud::SetHelpMessage("Walking anim set", false, false, false);
|
||||
}
|
||||
ImGui::EndTabItem();
|
||||
@ -127,7 +127,7 @@ void Animation::PlayAnimation(std::string& ifp, std::string& anim, std::string&
|
||||
Command<Commands::TASK_PLAY_ANIM_SECONDARY>(hplayer, anim.c_str(), ifp.c_str(), 4.0, loop, 0, 0, 0, -1);
|
||||
else
|
||||
Command<Commands::TASK_PLAY_ANIM>(hplayer, anim.c_str(), ifp.c_str(), 4.0, loop, 0, 0, 0, -1);
|
||||
|
||||
|
||||
if (ifp != "PED")
|
||||
Command<Commands::REMOVE_ANIMATION>(ifp.c_str());
|
||||
}
|
||||
@ -140,7 +140,8 @@ void Animation::RemoveAnimation(std::string& ifp, std::string& anim, std::string
|
||||
json.data["Custom"].erase(anim);
|
||||
json.WriteToDisk();
|
||||
CHud::SetHelpMessage("Animation removed", false, false, false);
|
||||
}else CHud::SetHelpMessage("You can only remove custom anims", false, false, false);
|
||||
}
|
||||
else CHud::SetHelpMessage("You can only remove custom anims", false, false, false);
|
||||
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@ protected:
|
||||
~Animation() {};
|
||||
|
||||
public:
|
||||
static void Main();
|
||||
static void Draw();
|
||||
static void PlayAnimation(std::string& rootkey, std::string& anim, std::string& ifp);
|
||||
static void RemoveAnimation(std::string& rootkey, std::string& anim, std::string& ifp);
|
||||
};
|
||||
|
@ -4,12 +4,12 @@
|
||||
#include "Ui.h"
|
||||
|
||||
unsortedMap CheatMenu::header{
|
||||
{ "Teleport", &Teleport::Main },{ "Player", &Player::Main },{ "Ped", &Ped::Main },
|
||||
{ "Animation", &Animation::Main },{ "Vehicle", &Vehicle::Main },{ "Weapon", &Weapon::Main },
|
||||
{ "Game", &Game::Main },{ "Visual", &Visual::Main },{ "Menu", &Menu::Main }
|
||||
{ "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::ProcessMenu()
|
||||
void CheatMenu::DrawMenu()
|
||||
{
|
||||
ImGui::SetNextWindowSize(Globals::menu_size);
|
||||
if (ImGui::Begin(MENU_TITLE, &Globals::show_menu, ImGuiWindowFlags_NoCollapse))
|
||||
@ -32,32 +32,32 @@ void CheatMenu::ProcessWindow()
|
||||
{
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
|
||||
if (!FrontEndMenuManager.m_bMenuActive && (Globals::show_menu || Menu::commands::show_menu))
|
||||
{
|
||||
if (Globals::show_menu)
|
||||
ProcessMenu();
|
||||
else
|
||||
Menu::ProcessShortcutsWindow();
|
||||
}
|
||||
if (FrontEndMenuManager.m_bMenuActive)
|
||||
Hook::show_mouse = false;
|
||||
else
|
||||
if (Globals::show_menu || Menu::commands::show_menu)
|
||||
{
|
||||
if (Globals::show_menu)
|
||||
DrawMenu();
|
||||
else
|
||||
Menu::DrawShortcutsWindow();
|
||||
}
|
||||
|
||||
Menu::ProcessOverlay();
|
||||
}
|
||||
|
||||
CheatMenu::CheatMenu()
|
||||
{
|
||||
ApplyImGuiStyle();
|
||||
ApplyStyle();
|
||||
Hook::window_callback = std::bind(&ProcessWindow);
|
||||
|
||||
Events::initRwEvent += []()
|
||||
{
|
||||
// Load menu settings
|
||||
Globals::header_id = config.GetValue("window.id",std::string(""));
|
||||
Globals::menu_size.x = config.GetValue("window.sizeX", screen::GetScreenWidth() / 4.0f);
|
||||
Globals::menu_size.y = config.GetValue("window.sizeY", screen::GetScreenHeight() / 1.2f);
|
||||
srand(CTimer::m_snTimeInMilliseconds);
|
||||
};
|
||||
// Load menu settings
|
||||
Globals::header_id = config.GetValue("window.id", std::string(""));
|
||||
Globals::menu_size.x = config.GetValue("window.sizeX", screen::GetScreenWidth() / 4.0f);
|
||||
Globals::menu_size.y = config.GetValue("window.sizeY", screen::GetScreenHeight() / 1.2f);
|
||||
srand(CTimer::m_snTimeInMilliseconds);
|
||||
|
||||
Events::processScriptsEvent += [this]
|
||||
Events::processScriptsEvent += []
|
||||
{
|
||||
if (Globals::init_done && !FrontEndMenuManager.m_bMenuActive)
|
||||
{
|
||||
@ -69,7 +69,7 @@ CheatMenu::CheatMenu()
|
||||
if (Menu::commands::show_menu)
|
||||
{
|
||||
Menu::ProcessCommands();
|
||||
strcpy(commands::input_buffer,"");
|
||||
strcpy(commands::input_buffer, "");
|
||||
}
|
||||
Menu::commands::show_menu = !Menu::commands::show_menu;
|
||||
}
|
||||
@ -78,32 +78,14 @@ CheatMenu::CheatMenu()
|
||||
{
|
||||
if (Hook::show_mouse) // Only write when the menu closes
|
||||
config.WriteToDisk();
|
||||
|
||||
|
||||
Hook::show_mouse = Globals::show_menu;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Events::drawMenuBackgroundEvent += [this]
|
||||
{
|
||||
if (Hook::show_mouse)
|
||||
{
|
||||
config.WriteToDisk();
|
||||
Hook::show_mouse = false;
|
||||
}
|
||||
};
|
||||
|
||||
Events::shutdownRwEvent += []
|
||||
{
|
||||
flog << "Log Finished." << std::endl;
|
||||
};
|
||||
}
|
||||
|
||||
CheatMenu::~CheatMenu()
|
||||
{
|
||||
}
|
||||
|
||||
void CheatMenu::ApplyImGuiStyle()
|
||||
void CheatMenu::ApplyStyle()
|
||||
{
|
||||
ImGuiStyle* style = &ImGui::GetStyle();
|
||||
ImVec4* colors = style->Colors;
|
||||
@ -175,4 +157,50 @@ void CheatMenu::ApplyImGuiStyle()
|
||||
colors[ImGuiCol_NavWindowingHighlight] = ImVec4(1.00f, 1.00f, 1.00f, 0.70f);
|
||||
colors[ImGuiCol_NavWindowingDimBg] = ImVec4(0.80f, 0.80f, 0.80f, 0.20f);
|
||||
colors[ImGuiCol_ModalWindowDimBg] = ImVec4(0.26f, 0.59f, 0.98f, 0.35f);
|
||||
}
|
||||
|
||||
void MenuThread(void* param)
|
||||
{
|
||||
// Wait till the game is initiallized
|
||||
Events::initGameEvent.after += []()
|
||||
{
|
||||
Globals::game_init = true;
|
||||
};
|
||||
|
||||
while (!Globals::game_init)
|
||||
Sleep(500);
|
||||
|
||||
if (GetModuleHandle("SAMP.dll"))
|
||||
{
|
||||
MessageBox(RsGlobal.ps->window, "SAMP detected. Exiting CheatMenu.", "CheatMenu", MB_ICONERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
// SP fixes some mouse issues
|
||||
if (!GetModuleHandle("SilentPatchSA.asi"))
|
||||
{
|
||||
MessageBox(RsGlobal.ps->window, "SilentPatch isn't installed. Exiting CheatMenu.", "CheatMenu", MB_ICONERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
flog << "Starting...\nVersion: " MENU_TITLE "\nAuthor: Grinch_\nDiscord: " DISCORD_INVITE "\nMore Info: " GITHUB_LINK "\n\n" << std::endl;
|
||||
CFastman92limitAdjuster::Init();
|
||||
CheatMenu cheatmenu;
|
||||
|
||||
while (true)
|
||||
Sleep(5000);
|
||||
}
|
||||
|
||||
BOOL WINAPI DllMain(HINSTANCE hDllHandle, DWORD nReason, LPVOID Reserved)
|
||||
{
|
||||
if (nReason == DLL_PROCESS_ATTACH)
|
||||
{
|
||||
uint gameVersion = GetGameVersion();
|
||||
if (gameVersion == GAME_10US_HOODLUM || gameVersion == GAME_10US_COMPACT)
|
||||
CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)&MenuThread, NULL, NULL, NULL);
|
||||
else
|
||||
MessageBox(HWND_DESKTOP, "Unknown game version. GTA SA v1.0 US is required.", "CheatMenu", MB_ICONERROR);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
@ -22,51 +22,11 @@ class CheatMenu : Hook, Animation, Game, Menu, Ped, Player, Teleport, Vehicle, V
|
||||
{
|
||||
private:
|
||||
static unsortedMap header;
|
||||
static void ProcessMenu();
|
||||
static void DrawMenu();
|
||||
static void ProcessWindow();
|
||||
static void ApplyImGuiStyle();
|
||||
static void ApplyStyle();
|
||||
|
||||
public:
|
||||
CheatMenu();
|
||||
~CheatMenu();
|
||||
};
|
||||
|
||||
class Launcher
|
||||
{
|
||||
public:
|
||||
Launcher()
|
||||
{
|
||||
Events::initRwEvent += []()
|
||||
{
|
||||
bool launch = true;
|
||||
uint gameVersion = GetGameVersion();
|
||||
if (gameVersion != GAME_10US_HOODLUM && gameVersion != GAME_10US_COMPACT) {
|
||||
MessageBox(HWND_DESKTOP, "CheatMenu requires v1.0 US of the game.", "CheatMenu", MB_ICONERROR);
|
||||
launch = false;
|
||||
}
|
||||
|
||||
if (IsPluginInstalled("SAMP.dll")) {
|
||||
MessageBox(HWND_DESKTOP, "SAMP detected. Exiting CheatMenu.", "CheatMenu", MB_ICONERROR);
|
||||
launch = false;
|
||||
}
|
||||
|
||||
/*
|
||||
Mouse is extremely buggy without SilentPatch
|
||||
Should have a better fix for this but everyone should have
|
||||
SilentPatch installed so mehh...
|
||||
*/
|
||||
if (!IsPluginInstalled("SilentPatchSA.asi")) {
|
||||
MessageBox(HWND_DESKTOP, "SilentPatch isn't installed. Exiting CheatMenu.", "CheatMenu", MB_ICONERROR);
|
||||
launch = false;
|
||||
}
|
||||
|
||||
if (launch)
|
||||
{
|
||||
flog << "Loading CheatMenu" << std::endl;
|
||||
CFastman92limitAdjuster::Init();
|
||||
static CheatMenu cheatmenu;
|
||||
}
|
||||
};
|
||||
}
|
||||
} launcher;
|
||||
|
||||
|
@ -1,12 +1,10 @@
|
||||
#include "pch.h"
|
||||
#include "Events.h"
|
||||
|
||||
|
||||
namespace plugin
|
||||
{
|
||||
namespace Events
|
||||
{
|
||||
decltype(vehicleResetAfterRender) vehicleResetAfterRender;
|
||||
decltype(renderscence) renderscence;
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,5 @@ namespace plugin
|
||||
namespace Events
|
||||
{
|
||||
extern ThiscallEvent<AddressList<0x55332A, H_CALL>, PRIORITY_BEFORE, ArgPickN<CVehicle*, 0>, void(CVehicle*)> vehicleResetAfterRender;
|
||||
extern ThiscallEvent<AddressList<0x53EABF, H_CALL>, PRIORITY_BEFORE, ArgPickNone, void()> renderscence;
|
||||
}
|
||||
}
|
||||
|
159
src/Game.cpp
159
src/Game.cpp
@ -32,7 +32,7 @@ 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;
|
||||
CPed* Game::freecam::ped = nullptr;
|
||||
|
||||
bool Game::hard_mode::state = false;
|
||||
float Game::hard_mode::prev_armour = 0.0f;
|
||||
@ -60,18 +60,18 @@ static bool mission_warning_shown = false;
|
||||
|
||||
// Thanks to aap
|
||||
void RealTimeClock(void)
|
||||
{
|
||||
{
|
||||
static int lastday;
|
||||
time_t tmp = time(NULL);
|
||||
struct tm *now = localtime(&tmp);
|
||||
|
||||
if(now->tm_yday != lastday)
|
||||
struct tm* now = localtime(&tmp);
|
||||
|
||||
if (now->tm_yday != lastday)
|
||||
CStats::SetStatValue(0x86, CStats::GetStatValue(0x86) + 1.0f);
|
||||
|
||||
lastday = now->tm_yday;
|
||||
CClock::ms_nGameClockMonth = now->tm_mon+1;
|
||||
CClock::ms_nGameClockMonth = now->tm_mon + 1;
|
||||
CClock::ms_nGameClockDays = now->tm_mday;
|
||||
CClock::CurrentDay = now->tm_wday+1;
|
||||
CClock::CurrentDay = now->tm_wday + 1;
|
||||
CClock::ms_nGameClockHours = now->tm_hour;
|
||||
CClock::ms_nGameClockMinutes = now->tm_min;
|
||||
CClock::ms_nGameClockSeconds = now->tm_sec;
|
||||
@ -79,29 +79,26 @@ void RealTimeClock(void)
|
||||
|
||||
Game::Game()
|
||||
{
|
||||
Events::initGameEvent += []
|
||||
{
|
||||
json.LoadData(search_categories, selected_item);
|
||||
stat::json.LoadData(stat::search_categories, stat::selected_item);
|
||||
freecam::fov = TheCamera.FindCamFOV();
|
||||
json.LoadData(search_categories, selected_item);
|
||||
stat::json.LoadData(stat::search_categories, stat::selected_item);
|
||||
freecam::fov = TheCamera.FindCamFOV();
|
||||
|
||||
// Generate enabled cheats vector
|
||||
for (auto element : random_cheats::name_json.data.items())
|
||||
{
|
||||
/*
|
||||
[
|
||||
cheat_id = [ cheat_name, state (true/false) ]
|
||||
]
|
||||
*/
|
||||
random_cheats::enabled_cheats[std::stoi(element.key())][0] = element.value().get<std::string>();
|
||||
random_cheats::enabled_cheats[std::stoi(element.key())][1] = "true";
|
||||
}
|
||||
};
|
||||
// Generate enabled cheats vector
|
||||
for (auto element : random_cheats::name_json.data.items())
|
||||
{
|
||||
/*
|
||||
[
|
||||
cheat_id = [ cheat_name, state (true/false) ]
|
||||
]
|
||||
*/
|
||||
random_cheats::enabled_cheats[std::stoi(element.key())][0] = element.value().get<std::string>();
|
||||
random_cheats::enabled_cheats[std::stoi(element.key())][1] = "true";
|
||||
}
|
||||
|
||||
Events::processScriptsEvent += []
|
||||
{
|
||||
uint timer = CTimer::m_snTimeInMilliseconds;
|
||||
static CPlayerPed *player = FindPlayerPed();
|
||||
static CPlayerPed* player = FindPlayerPed();
|
||||
static int hplayer = CPools::GetPedRef(player);
|
||||
|
||||
if (ss_shortcut)
|
||||
@ -135,9 +132,9 @@ Game::Game()
|
||||
if (solid_water_object == 0)
|
||||
{
|
||||
Command<Commands::CREATE_OBJECT>(3095, pos.x, pos.y, water_height, &solid_water_object);
|
||||
Command<Commands::SET_OBJECT_VISIBLE>(solid_water_object,false);
|
||||
if (pos.z < (water_height+1))
|
||||
player->SetPosn(pos.x,pos.y,water_height+1);
|
||||
Command<Commands::SET_OBJECT_VISIBLE>(solid_water_object, false);
|
||||
if (pos.z < (water_height + 1))
|
||||
player->SetPosn(pos.x, pos.y, water_height + 1);
|
||||
}
|
||||
else
|
||||
Command<Commands::SET_OBJECT_COORDINATES>(solid_water_object, pos.x, pos.y, water_height);
|
||||
@ -155,19 +152,19 @@ Game::Game()
|
||||
// improve this later
|
||||
if (sync_time && timer - sync_time_timer > 50)
|
||||
{
|
||||
std::time_t t = std::time(0);
|
||||
std::time_t t = std::time(0);
|
||||
std::tm* now = std::localtime(&t);
|
||||
|
||||
CClock::ms_nGameClockHours = now->tm_hour;
|
||||
CClock::ms_nGameClockMinutes = now->tm_min;
|
||||
|
||||
|
||||
sync_time_timer = timer;
|
||||
}
|
||||
|
||||
if (random_cheats::enable
|
||||
&& (timer - random_cheats::timer) > (uint(random_cheats::enable_wait_time)*1000))
|
||||
if (random_cheats::enable
|
||||
&& (timer - random_cheats::timer) > (uint(random_cheats::enable_wait_time) * 1000))
|
||||
{
|
||||
int id = Random(0,91);
|
||||
int id = Random(0, 91);
|
||||
|
||||
for (int i = 0; i < 92; i++)
|
||||
{
|
||||
@ -183,7 +180,7 @@ Game::Game()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (Ui::HotKeyPressed(Menu::hotkeys::freecam))
|
||||
{
|
||||
if (freecam::enable)
|
||||
@ -198,25 +195,21 @@ Game::Game()
|
||||
};
|
||||
}
|
||||
|
||||
Game::~Game()
|
||||
{
|
||||
}
|
||||
|
||||
void SetPlayerMission(std::string& rootkey, std::string& name, std::string& id)
|
||||
{
|
||||
CPlayerPed *player = FindPlayerPed();
|
||||
CPlayerPed* player = FindPlayerPed();
|
||||
uint hplayer = CPools::GetPedRef(player);
|
||||
int interior = 0;
|
||||
|
||||
Command<0x09E8>(hplayer,&interior);
|
||||
|
||||
if ( Util::IsOnMission() && interior == 0)
|
||||
Command<0x09E8>(hplayer, &interior);
|
||||
|
||||
if (Util::IsOnMission() && interior == 0)
|
||||
{
|
||||
player->SetWantedLevel(0);
|
||||
Command<Commands::LOAD_AND_LAUNCH_MISSION_INTERNAL>(std::stoi(id));
|
||||
}
|
||||
else CHud::SetHelpMessage("Can't start mission now", false, false, false);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void Game::FreeCam()
|
||||
@ -225,18 +218,18 @@ void Game::FreeCam()
|
||||
|
||||
if (!freecam::init_done)
|
||||
{
|
||||
CPlayerPed *player = FindPlayerPed(-1);
|
||||
CPlayerPed* player = FindPlayerPed(-1);
|
||||
Command<Commands::SET_EVERYONE_IGNORE_PLAYER>(0, true);
|
||||
CHud::bScriptDontDisplayRadar = true;
|
||||
CHud::m_Wants_To_Draw_Hud = false;
|
||||
CVector player_pos = player->GetPosition();
|
||||
CPad::GetPad(0)->DisablePlayerControls = true;
|
||||
|
||||
Command<Commands::CREATE_RANDOM_CHAR>(player_pos.x,player_pos.y,player_pos.z, &freecam::hped);
|
||||
Command<Commands::CREATE_RANDOM_CHAR>(player_pos.x, player_pos.y, player_pos.z, &freecam::hped);
|
||||
freecam::ped = CPools::GetPed(freecam::hped);
|
||||
freecam::ped->m_bIsVisible = false;
|
||||
|
||||
Command<Commands::FREEZE_CHAR_POSITION_AND_DONT_LOAD_COLLISION>(freecam::hped,true);
|
||||
|
||||
Command<Commands::FREEZE_CHAR_POSITION_AND_DONT_LOAD_COLLISION>(freecam::hped, true);
|
||||
Command<Commands::SET_CHAR_COLLISION>(freecam::hped, false);
|
||||
Command<Commands::SET_LOAD_COLLISION_FOR_CHAR_FLAG>(freecam::hped, false);
|
||||
|
||||
@ -247,16 +240,16 @@ void Game::FreeCam()
|
||||
player_pos.z -= 20;
|
||||
freecam::ped->SetPosn(player_pos);
|
||||
|
||||
TheCamera.LerpFOV(TheCamera.FindCamFOV(),freecam::fov,1000,true);
|
||||
TheCamera.LerpFOV(TheCamera.FindCamFOV(), freecam::fov, 1000, true);
|
||||
Command<Commands::CAMERA_PERSIST_FOV>(true);
|
||||
}
|
||||
|
||||
CVector pos = freecam::ped->GetPosition();
|
||||
|
||||
Command<Commands::GET_PC_MOUSE_MOVEMENT>(&freecam::mouseX, &freecam::mouseY);
|
||||
freecam::tmouseX = freecam::tmouseX - freecam::mouseX/250;
|
||||
freecam::tmouseY = freecam::tmouseY + freecam::mouseY/3;
|
||||
|
||||
freecam::tmouseX = freecam::tmouseX - freecam::mouseX / 250;
|
||||
freecam::tmouseY = freecam::tmouseY + freecam::mouseY / 3;
|
||||
|
||||
if (freecam::tmouseY > 150)
|
||||
freecam::tmouseY = 150;
|
||||
|
||||
@ -265,18 +258,18 @@ void Game::FreeCam()
|
||||
|
||||
if (Ui::HotKeyPressed(Menu::hotkeys::free_cam_tp_player))
|
||||
{
|
||||
CPlayerPed *player = FindPlayerPed(-1);
|
||||
CPlayerPed* player = FindPlayerPed(-1);
|
||||
CVector pos = freecam::ped->GetPosition();
|
||||
CEntity* player_entity = FindPlayerEntity(-1);
|
||||
pos.z = CWorld::FindGroundZFor3DCoord(pos.x, pos.y, 1000, 0, &player_entity) + 0.5f;
|
||||
Command<Commands::SET_CHAR_COORDINATES>(CPools::GetPedRef(player),pos.x,pos.y,pos.z);
|
||||
Command<Commands::SET_CHAR_COORDINATES>(CPools::GetPedRef(player), pos.x, pos.y, pos.z);
|
||||
|
||||
// disble them again cause they get enabled
|
||||
CHud::bScriptDontDisplayRadar = true;
|
||||
CHud::m_Wants_To_Draw_Hud = false;
|
||||
CHud::SetHelpMessage((char*)"Player telported",false,false,false);
|
||||
CHud::SetHelpMessage((char*)"Player telported", false, false, false);
|
||||
}
|
||||
|
||||
|
||||
if (KeyPressed(VK_RCONTROL))
|
||||
delta_speed /= 2;
|
||||
|
||||
@ -289,10 +282,10 @@ void Game::FreeCam()
|
||||
delta_speed *= -1;
|
||||
|
||||
float angle;
|
||||
Command<Commands::GET_CHAR_HEADING>(freecam::hped,&angle);
|
||||
pos.x += delta_speed * cos(angle * 3.14159f/180.0f);
|
||||
pos.y += delta_speed * sin(angle * 3.14159f/180.0f);
|
||||
pos.z += delta_speed* 2 * sin(freecam::tmouseY/3* 3.14159f/180.0f);
|
||||
Command<Commands::GET_CHAR_HEADING>(freecam::hped, &angle);
|
||||
pos.x += delta_speed * cos(angle * 3.14159f / 180.0f);
|
||||
pos.y += delta_speed * sin(angle * 3.14159f / 180.0f);
|
||||
pos.z += delta_speed * 2 * sin(freecam::tmouseY / 3 * 3.14159f / 180.0f);
|
||||
}
|
||||
|
||||
if (KeyPressed(VK_KEY_J) || KeyPressed(VK_KEY_L))
|
||||
@ -301,33 +294,33 @@ void Game::FreeCam()
|
||||
delta_speed *= -1;
|
||||
|
||||
float angle;
|
||||
Command<Commands::GET_CHAR_HEADING>(freecam::hped,&angle);
|
||||
Command<Commands::GET_CHAR_HEADING>(freecam::hped, &angle);
|
||||
angle -= 90;
|
||||
|
||||
pos.x += delta_speed * cos(angle * 3.14159f/180.0f);
|
||||
pos.y += delta_speed * sin(angle * 3.14159f/180.0f);
|
||||
|
||||
pos.x += delta_speed * cos(angle * 3.14159f / 180.0f);
|
||||
pos.y += delta_speed * sin(angle * 3.14159f / 180.0f);
|
||||
}
|
||||
|
||||
if ( CPad::NewMouseControllerState.wheelUp)
|
||||
if (CPad::NewMouseControllerState.wheelUp)
|
||||
{
|
||||
if (freecam::fov > 10.0f)
|
||||
freecam::fov -= 2.0f * delta_speed;
|
||||
|
||||
TheCamera.LerpFOV(TheCamera.FindCamFOV(),freecam::fov,250,true);
|
||||
TheCamera.LerpFOV(TheCamera.FindCamFOV(), freecam::fov, 250, true);
|
||||
Command<Commands::CAMERA_PERSIST_FOV>(true);
|
||||
}
|
||||
|
||||
if ( CPad::NewMouseControllerState.wheelDown)
|
||||
if (CPad::NewMouseControllerState.wheelDown)
|
||||
{
|
||||
if (freecam::fov < 115.0f)
|
||||
freecam::fov += 2.0f * delta_speed;
|
||||
|
||||
TheCamera.LerpFOV(TheCamera.FindCamFOV(),freecam::fov,250,true);
|
||||
|
||||
TheCamera.LerpFOV(TheCamera.FindCamFOV(), freecam::fov, 250, true);
|
||||
Command<Commands::CAMERA_PERSIST_FOV>(true);
|
||||
}
|
||||
|
||||
freecam::ped->SetHeading(freecam::tmouseX);
|
||||
Command<Commands::ATTACH_CAMERA_TO_CHAR>(freecam::hped,0.0,0.0,20.0,90.0,180,freecam::tmouseY,0.0,2);
|
||||
Command<Commands::ATTACH_CAMERA_TO_CHAR>(freecam::hped, 0.0, 0.0, 20.0, 90.0, 180, freecam::tmouseY, 0.0, 2);
|
||||
freecam::ped->SetPosn(pos);
|
||||
CIplStore::AddIplsNeededAtPosn(pos);
|
||||
}
|
||||
@ -346,10 +339,10 @@ void Game::ClearFreecamStuff()
|
||||
Command<Commands::RESTORE_CAMERA_JUMPCUT>();
|
||||
}
|
||||
|
||||
void Game::Main()
|
||||
void Game::Draw()
|
||||
{
|
||||
ImGui::Spacing();
|
||||
static CPlayerPed *player = FindPlayerPed();
|
||||
static CPlayerPed* player = FindPlayerPed();
|
||||
static int hplayer = CPools::GetPedRef(player);
|
||||
|
||||
if (ImGui::BeginTabBar("Game", ImGuiTabBarFlags_NoTooltip + ImGuiTabBarFlags_FittingPolicyScroll))
|
||||
@ -402,7 +395,7 @@ of LS without completing missions"))
|
||||
if (Ui::CheckboxWithHint("Hard mode", &hard_mode::state, "Makes the game more challanging to play. \n\
|
||||
Lowers armour, health, stamina etc."))
|
||||
{
|
||||
CPlayerPed *player = FindPlayerPed();
|
||||
CPlayerPed* player = FindPlayerPed();
|
||||
|
||||
if (hard_mode::state)
|
||||
{
|
||||
@ -415,7 +408,7 @@ Lowers armour, health, stamina etc."))
|
||||
else
|
||||
{
|
||||
player->m_fArmour = hard_mode::prev_armour;
|
||||
CStats::SetStatValue(STAT_STAMINA,hard_mode::prev_stamina);
|
||||
CStats::SetStatValue(STAT_STAMINA, hard_mode::prev_stamina);
|
||||
CStats::SetStatValue(STAT_MAX_HEALTH, hard_mode::prev_max_health);
|
||||
player->m_fHealth = hard_mode::prev_health;
|
||||
CWeaponInfo::LoadWeaponData();
|
||||
@ -428,7 +421,7 @@ Lowers armour, health, stamina etc."))
|
||||
Command<Commands::SWITCH_DEATH_PENALTIES>(keep_stuff);
|
||||
}
|
||||
Ui::CheckboxWithHint("Screenshot shortcut", &ss_shortcut, (("Take screenshot using ") + Ui::GetHotKeyNameString(Menu::hotkeys::quick_ss)
|
||||
+ "\nSaved inside 'GTA San Andreas User Files\\Gallery'").c_str());
|
||||
+ "\nSaved inside 'GTA San Andreas User Files\\Gallery'").c_str());
|
||||
if (Ui::CheckboxWithHint("Solid water", &solid_water, "Player can walk on water\nTurn this off if you want to swim."))
|
||||
{
|
||||
if (!solid_water && solid_water_object != 0)
|
||||
@ -452,9 +445,9 @@ Lowers armour, health, stamina etc."))
|
||||
{
|
||||
if (ImGui::CollapsingHeader("Current day"))
|
||||
{
|
||||
int day = CClock::CurrentDay-1;
|
||||
int day = CClock::CurrentDay - 1;
|
||||
if (Ui::ListBox("Select day", day_names, day))
|
||||
CClock::CurrentDay = day+1;
|
||||
CClock::CurrentDay = day + 1;
|
||||
ImGui::Spacing();
|
||||
ImGui::Separator();
|
||||
}
|
||||
@ -469,10 +462,10 @@ Lowers armour, health, stamina etc."))
|
||||
ClearFreecamStuff();
|
||||
}
|
||||
ImGui::Spacing();
|
||||
|
||||
|
||||
if (ImGui::SliderFloat("Field of view", &freecam::fov, 5.0f, 120.0f))
|
||||
{
|
||||
TheCamera.LerpFOV(TheCamera.FindCamFOV(),freecam::fov,250.0f,true);
|
||||
TheCamera.LerpFOV(TheCamera.FindCamFOV(), freecam::fov, 250.0f, true);
|
||||
Command<Commands::CAMERA_PERSIST_FOV>(true);
|
||||
}
|
||||
ImGui::SliderFloat("Movement Speed", &freecam::speed, 0.0f, 0.5f);
|
||||
@ -481,7 +474,7 @@ Lowers armour, health, stamina etc."))
|
||||
ImGui::Spacing();
|
||||
ImGui::Separator();
|
||||
}
|
||||
Ui::EditReference("Game speed", CTimer::ms_fTimeScale,1, 1, 10);
|
||||
Ui::EditReference("Game speed", CTimer::ms_fTimeScale, 1, 1, 10);
|
||||
Ui::EditFloat("Gravity", 0x863984, -1.0f, 0.008f, 1.0f);
|
||||
|
||||
if (ImGui::CollapsingHeader("Set time"))
|
||||
@ -507,13 +500,13 @@ Lowers armour, health, stamina etc."))
|
||||
ImGui::Separator();
|
||||
}
|
||||
|
||||
static std::vector<Ui::NamedMemory> themes { { "Beach", 0x969159 }, { "Country" ,0x96917D }, { "Fun house" ,0x969176 }, { "Ninja" ,0x96915C }};
|
||||
static std::vector<Ui::NamedMemory> themes{ { "Beach", 0x969159 }, { "Country" ,0x96917D }, { "Fun house" ,0x969176 }, { "Ninja" ,0x96915C } };
|
||||
Ui::EditRadioButtonAddress("Themes", themes);
|
||||
|
||||
|
||||
if (ImGui::CollapsingHeader("Weather"))
|
||||
{
|
||||
typedef void func(void);
|
||||
if (ImGui::Button("Foggy",Ui::GetSize(3)))
|
||||
if (ImGui::Button("Foggy", Ui::GetSize(3)))
|
||||
((func*)0x438F80)();
|
||||
|
||||
ImGui::SameLine();
|
||||
@ -570,7 +563,7 @@ It's recommanded not to save your game after using this. Use it at your own risk
|
||||
{
|
||||
// similat to Ui::DrawJSON()
|
||||
ImGui::Spacing();
|
||||
|
||||
|
||||
ImGui::PushItemWidth(ImGui::GetContentRegionAvailWidth() / 2 - 5);
|
||||
Ui::ListBoxStr("##Categories", stat::search_categories, stat::selected_item);
|
||||
ImGui::SameLine();
|
||||
|
@ -25,7 +25,7 @@ public:
|
||||
static float speed;
|
||||
static float fov;
|
||||
static bool init_done;
|
||||
static CPed *ped;
|
||||
static CPed* ped;
|
||||
static int hped;
|
||||
static float mouseX, mouseY, tmouseX, tmouseY;
|
||||
};
|
||||
@ -60,8 +60,7 @@ public:
|
||||
};
|
||||
|
||||
Game();
|
||||
~Game();
|
||||
static void Main();
|
||||
static void Draw();
|
||||
static void FreeCam();
|
||||
static void ClearFreecamStuff();
|
||||
};
|
||||
|
66
src/Hook.cpp
66
src/Hook.cpp
@ -6,7 +6,7 @@
|
||||
WNDPROC Hook::oWndProc = NULL;
|
||||
f_Present11 Hook::oPresent11 = NULL;
|
||||
f_Present9 Hook::oPresent9 = NULL;
|
||||
f_Reset Hook::oReset9 = NULL;
|
||||
f_Reset Hook::oReset9 = NULL;
|
||||
|
||||
bool Hook::mouse_visibility = false;
|
||||
bool Hook::show_mouse = false;
|
||||
@ -31,20 +31,20 @@ LRESULT Hook::WndProc(const HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
if (ImGui::GetIO().WantTextInput)
|
||||
{
|
||||
Call<0x53F1E0>(); // CPad::ClearKeyboardHistory
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
return CallWindowProc(oWndProc, hWnd, uMsg, wParam, lParam);
|
||||
}
|
||||
|
||||
HRESULT Hook::Reset(IDirect3DDevice9 * pDevice, D3DPRESENT_PARAMETERS * pPresentationParameters)
|
||||
HRESULT Hook::Reset(IDirect3DDevice9* pDevice, D3DPRESENT_PARAMETERS* pPresentationParameters)
|
||||
{
|
||||
ImGui_ImplDX9_InvalidateDeviceObjects();
|
||||
|
||||
return oReset9(pDevice, pPresentationParameters);
|
||||
}
|
||||
|
||||
void Hook::Present(void *ptr)
|
||||
void Hook::Present(void* ptr)
|
||||
{
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
|
||||
@ -53,7 +53,7 @@ void Hook::Present(void *ptr)
|
||||
Hook::ShowMouse(show_mouse);
|
||||
|
||||
// handle window scaling here
|
||||
ImVec2 size(screen::GetScreenWidth(),screen::GetScreenHeight());
|
||||
ImVec2 size(screen::GetScreenWidth(), screen::GetScreenHeight());
|
||||
if (Globals::screen_size.x != size.x && Globals::screen_size.y != size.y)
|
||||
{
|
||||
int font_size = int(size.y / 54.85f); // manually tested
|
||||
@ -68,8 +68,8 @@ void Hook::Present(void *ptr)
|
||||
|
||||
if (Globals::screen_size.x != -1 && Globals::screen_size.y != -1)
|
||||
{
|
||||
Globals::menu_size.x += (size.x-Globals::screen_size.x) / 4.0f;
|
||||
Globals::menu_size.y += (size.y-Globals::screen_size.y) / 1.2f;
|
||||
Globals::menu_size.x += (size.x - Globals::screen_size.x) / 4.0f;
|
||||
Globals::menu_size.y += (size.y - Globals::screen_size.y) / 1.2f;
|
||||
}
|
||||
|
||||
ImGuiStyle* style = &ImGui::GetStyle();
|
||||
@ -80,7 +80,7 @@ void Hook::Present(void *ptr)
|
||||
style->ItemSpacing = ImVec2(8 * scale_x, 4 * scale_y);
|
||||
style->ScrollbarSize = 12 * scale_x;
|
||||
style->IndentSpacing = 20 * scale_x;
|
||||
style->ItemInnerSpacing = ImVec2(4 * scale_x,4 * scale_y);
|
||||
style->ItemInnerSpacing = ImVec2(4 * scale_x, 4 * scale_y);
|
||||
|
||||
Globals::screen_size = size;
|
||||
}
|
||||
@ -112,9 +112,9 @@ void Hook::Present(void *ptr)
|
||||
ImGuiStyle& style = ImGui::GetStyle();
|
||||
|
||||
ImGui_ImplWin32_Init(RsGlobal.ps->window);
|
||||
|
||||
|
||||
// shift trigger fix
|
||||
patch::Nop(0x00531155,5);
|
||||
patch::Nop(0x00531155, 5);
|
||||
|
||||
if (Globals::renderer == Render_DirectX9)
|
||||
{
|
||||
@ -143,7 +143,7 @@ void Hook::Present(void *ptr)
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT Hook::PresentDx9Handler(IDirect3DDevice9 *pDevice, RECT* pSourceRect, RECT* pDestRect, HWND hDestWindowOverride, RGNDATA* pDirtyRegion)
|
||||
HRESULT Hook::PresentDx9Handler(IDirect3DDevice9* pDevice, RECT* pSourceRect, RECT* pDestRect, HWND hDestWindowOverride, RGNDATA* pDirtyRegion)
|
||||
{
|
||||
Present(pDevice);
|
||||
return oPresent9(pDevice, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion);;
|
||||
@ -183,11 +183,10 @@ void Hook::ShowMouse(bool state)
|
||||
{
|
||||
if (mouse_visibility != show_mouse)
|
||||
{
|
||||
patch::SetRaw(0x541DF5, (void*)"\xE8\x46\xF3\xFE\xFF", 5); // call CControllerConfigManager::AffectPadFromKeyBoard
|
||||
patch::SetUChar(0x6194A0, 0xE9); // jmp setup
|
||||
patch::SetUChar(0x746ED0, 0xA1);
|
||||
patch::SetRaw(0x53F41F, (void*)"\x85\xC0\x0F\x8C", 4); // xor eax, eax -> test eax, eax , enable camera mouse movement
|
||||
// jz loc_53F526 -> jl loc_53F526
|
||||
patch::SetUChar(0x6194A0, 0xE9); // jmp setup
|
||||
}
|
||||
}
|
||||
|
||||
@ -196,7 +195,9 @@ void Hook::ShowMouse(bool state)
|
||||
CPad::ClearMouseHistory();
|
||||
CPad::UpdatePads();
|
||||
|
||||
// TODO: Replace this with windows cursor
|
||||
ImGui::GetIO().MouseDrawCursor = state;
|
||||
|
||||
CPad::NewMouseControllerState.X = 0;
|
||||
CPad::NewMouseControllerState.Y = 0;
|
||||
mouse_visibility = show_mouse;
|
||||
@ -206,31 +207,22 @@ void Hook::ShowMouse(bool state)
|
||||
Hook::Hook()
|
||||
{
|
||||
ImGui::CreateContext();
|
||||
Events::initRwEvent += []()
|
||||
{
|
||||
if (kiero::init(kiero::RenderType::D3D9) == kiero::Status::Success)
|
||||
{
|
||||
Globals::renderer = Render_DirectX9;
|
||||
kiero::bind(16, (void**)&oReset9, Reset);
|
||||
kiero::bind(17, (void**)&oPresent9, PresentDx9Handler);
|
||||
}
|
||||
else
|
||||
{
|
||||
// gtaRenderHook
|
||||
if (kiero::init(kiero::RenderType::D3D11) == kiero::Status::Success)
|
||||
{
|
||||
Globals::renderer = Render_DirectX11;
|
||||
kiero::bind(8, (void**)&oPresent11, PresentDx11Handler);
|
||||
}
|
||||
|
||||
// if (kiero::init(kiero::RenderType::Vulkan) == kiero::Status::Success)
|
||||
// {
|
||||
// Globals::renderer = Render_Vulkan;
|
||||
// flog << "Vulkan detected!" << std::endl;
|
||||
// kiero::bind(105, (void**)&hvkCmdDraw, PresentDx11Handler);
|
||||
// }
|
||||
if (kiero::init(kiero::RenderType::D3D9) == kiero::Status::Success)
|
||||
{
|
||||
Globals::renderer = Render_DirectX9;
|
||||
kiero::bind(16, (void**)&oReset9, Reset);
|
||||
kiero::bind(17, (void**)&oPresent9, PresentDx9Handler);
|
||||
}
|
||||
else
|
||||
{
|
||||
// gtaRenderHook
|
||||
if (kiero::init(kiero::RenderType::D3D11) == kiero::Status::Success)
|
||||
{
|
||||
Globals::renderer = Render_DirectX11;
|
||||
kiero::bind(8, (void**)&oPresent11, PresentDx11Handler);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Hook::~Hook()
|
||||
|
12
src/Hook.h
12
src/Hook.h
@ -1,9 +1,9 @@
|
||||
#pragma once
|
||||
#include "pch.h"
|
||||
|
||||
typedef HRESULT(CALLBACK *f_Present9)(IDirect3DDevice9*, RECT*, RECT*, HWND, RGNDATA*);
|
||||
typedef HRESULT(CALLBACK *f_Present11)(IDXGISwapChain*, UINT, UINT);
|
||||
typedef HRESULT(CALLBACK *f_Reset)(IDirect3DDevice9*, D3DPRESENT_PARAMETERS*);
|
||||
typedef HRESULT(CALLBACK* f_Present9)(IDirect3DDevice9*, RECT*, RECT*, HWND, RGNDATA*);
|
||||
typedef HRESULT(CALLBACK* f_Present11)(IDXGISwapChain*, UINT, UINT);
|
||||
typedef HRESULT(CALLBACK* f_Reset)(IDirect3DDevice9*, D3DPRESENT_PARAMETERS*);
|
||||
|
||||
extern IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
@ -16,10 +16,10 @@ private:
|
||||
static f_Reset oReset9;
|
||||
static bool mouse_visibility;
|
||||
|
||||
static void CALLBACK Present(void *ptr);
|
||||
static HRESULT CALLBACK PresentDx9Handler(IDirect3DDevice9 *pDevice, RECT* pSourceRect, RECT* pDestRect, HWND hDestWindowOverride, RGNDATA* pDirtyRegion);
|
||||
static void CALLBACK Present(void* ptr);
|
||||
static HRESULT CALLBACK PresentDx9Handler(IDirect3DDevice9* pDevice, RECT* pSourceRect, RECT* pDestRect, HWND hDestWindowOverride, RGNDATA* pDirtyRegion);
|
||||
static HRESULT CALLBACK PresentDx11Handler(IDXGISwapChain* pSwapChain, UINT SyncInterval, UINT Flags);
|
||||
static HRESULT CALLBACK Reset(IDirect3DDevice9 * pDevice, D3DPRESENT_PARAMETERS * pPresentationParameters);
|
||||
static HRESULT CALLBACK Reset(IDirect3DDevice9* pDevice, D3DPRESENT_PARAMETERS* pPresentationParameters);
|
||||
static LRESULT CALLBACK WndProc(const HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
static void ShowMouse(bool state);
|
||||
|
||||
|
@ -3,8 +3,8 @@
|
||||
|
||||
CJson::CJson(const char* name)
|
||||
{
|
||||
file_path = "./CheatMenu/json/"+ std::string(name) +".json";
|
||||
|
||||
file_path = "./CheatMenu/json/" + std::string(name) + ".json";
|
||||
|
||||
if (fs::exists(file_path))
|
||||
{
|
||||
try
|
||||
@ -29,7 +29,7 @@ CJson::CJson(const char* name)
|
||||
void CJson::WriteToDisk()
|
||||
{
|
||||
std::ofstream file(file_path);
|
||||
file << data.dump(4,' ',false, nlohmann::json::error_handler_t::replace) << std::endl;
|
||||
file << data.dump(4, ' ', false, nlohmann::json::error_handler_t::replace) << std::endl;
|
||||
file.close();
|
||||
}
|
||||
|
||||
|
18
src/Json.h
18
src/Json.h
@ -10,7 +10,7 @@ public:
|
||||
nlohmann::json data;
|
||||
|
||||
/*
|
||||
Returns a value from json structure hierarchy using '.'
|
||||
Returns a value from json structure hierarchy using '.'
|
||||
Example: "Menu.Window.X"
|
||||
*/
|
||||
// specialize since typeid(std::string) doesn't work
|
||||
@ -22,11 +22,11 @@ public:
|
||||
std::stringstream ss(key);
|
||||
std::string line;
|
||||
|
||||
nlohmann::json *json = &data;
|
||||
nlohmann::json* json = &data;
|
||||
|
||||
while (getline(ss, line, '.'))
|
||||
json = &((*json)[line]);
|
||||
|
||||
|
||||
// json library bugs with bool, using int instead
|
||||
if (typeid(T) == typeid(bool))
|
||||
{
|
||||
@ -39,7 +39,7 @@ public:
|
||||
return default_val;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
std::string GetValue(std::string&& key, std::string&& default_val)
|
||||
{
|
||||
@ -47,7 +47,7 @@ public:
|
||||
std::stringstream ss(key);
|
||||
std::string line;
|
||||
|
||||
nlohmann::json *json = &data;
|
||||
nlohmann::json* json = &data;
|
||||
|
||||
while (getline(ss, line, '.'))
|
||||
json = &((*json)[line]);
|
||||
@ -60,7 +60,7 @@ public:
|
||||
}
|
||||
|
||||
/*
|
||||
Allows to save values in json hierarchy using '.'
|
||||
Allows to save values in json hierarchy using '.'
|
||||
Example: "Menu.Window.X"
|
||||
*/
|
||||
|
||||
@ -70,7 +70,7 @@ public:
|
||||
std::stringstream ss(key);
|
||||
std::string line;
|
||||
|
||||
nlohmann::json *json = &data;
|
||||
nlohmann::json* json = &data;
|
||||
|
||||
while (getline(ss, line, '.'))
|
||||
json = &((*json)[line]);
|
||||
@ -88,7 +88,7 @@ public:
|
||||
std::stringstream ss(key);
|
||||
std::string line;
|
||||
|
||||
nlohmann::json *json = &data;
|
||||
nlohmann::json* json = &data;
|
||||
|
||||
while (getline(ss, line, '.'))
|
||||
json = &((*json)[line]);
|
||||
@ -96,7 +96,7 @@ public:
|
||||
*json = val;
|
||||
}
|
||||
/*
|
||||
Loads the section names into a category vector.
|
||||
Loads the section names into a category vector.
|
||||
Used to create drop down category menus
|
||||
*/
|
||||
void LoadData(std::vector<std::string>& vec, std::string& selected);
|
||||
|
163
src/Menu.cpp
163
src/Menu.cpp
@ -23,7 +23,7 @@ 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::free_cam_tp_player{ VK_RETURN,VK_RETURN };
|
||||
HotKeyData Menu::hotkeys::god_mode{};
|
||||
HotKeyData Menu::hotkeys::menu_open{};
|
||||
HotKeyData Menu::hotkeys::quick_ss{};
|
||||
@ -37,67 +37,60 @@ char Menu::commands::input_buffer[INPUT_BUFFER_SIZE] = "";
|
||||
|
||||
Menu::Menu()
|
||||
{
|
||||
Events::initGameEvent += []
|
||||
{
|
||||
// improve these later, use struct
|
||||
// Load config data
|
||||
overlay::coord = config.GetValue("overlay.coord", false);
|
||||
overlay::fps = config.GetValue("overlay.fps", false);
|
||||
overlay::loc_name = config.GetValue("overlay.loc_name", false);
|
||||
overlay::transparent = config.GetValue("overlay.transparent", false);
|
||||
overlay::veh_health = config.GetValue("overlay.veh_health", false);
|
||||
overlay::veh_speed = config.GetValue("overlay.veh_speed", false);
|
||||
overlay::selected_pos = config.GetValue("overlay.selected_pos", 4);
|
||||
overlay::posX = config.GetValue("overlay.posX", 0);
|
||||
overlay::posY = config.GetValue("overlay.posY", 0);
|
||||
// TODO: use structs
|
||||
// Load config data
|
||||
overlay::coord = config.GetValue("overlay.coord", false);
|
||||
overlay::fps = config.GetValue("overlay.fps", false);
|
||||
overlay::loc_name = config.GetValue("overlay.loc_name", false);
|
||||
overlay::transparent = config.GetValue("overlay.transparent", false);
|
||||
overlay::veh_health = config.GetValue("overlay.veh_health", false);
|
||||
overlay::veh_speed = config.GetValue("overlay.veh_speed", false);
|
||||
overlay::selected_pos = config.GetValue("overlay.selected_pos", 4);
|
||||
overlay::posX = config.GetValue("overlay.posX", 0);
|
||||
overlay::posY = config.GetValue("overlay.posY", 0);
|
||||
|
||||
// Hotkeys
|
||||
hotkeys::aim_skin_changer.key1 = config.GetValue("hotkey.aim_skin_changer.key1", VK_RETURN);
|
||||
hotkeys::aim_skin_changer.key2 = config.GetValue("hotkey.aim_skin_changer.key2", VK_RETURN);
|
||||
// Hotkeys
|
||||
hotkeys::aim_skin_changer.key1 = config.GetValue("hotkey.aim_skin_changer.key1", VK_RETURN);
|
||||
hotkeys::aim_skin_changer.key2 = config.GetValue("hotkey.aim_skin_changer.key2", VK_RETURN);
|
||||
|
||||
hotkeys::freecam.key1 = config.GetValue("hotkey.freecam.key1", VK_F6);
|
||||
hotkeys::freecam.key2 = config.GetValue("hotkey.freecam.key2", VK_F6);
|
||||
hotkeys::freecam.key1 = config.GetValue("hotkey.freecam.key1", VK_F6);
|
||||
hotkeys::freecam.key2 = config.GetValue("hotkey.freecam.key2", VK_F6);
|
||||
|
||||
hotkeys::quick_ss.key1 = config.GetValue("hotkey.quick_screenshot.key1", VK_F5);
|
||||
hotkeys::quick_ss.key2 = config.GetValue("hotkey.quick_screenshot.key2", VK_F5);
|
||||
hotkeys::quick_ss.key1 = config.GetValue("hotkey.quick_screenshot.key1", VK_F5);
|
||||
hotkeys::quick_ss.key2 = config.GetValue("hotkey.quick_screenshot.key2", VK_F5);
|
||||
|
||||
hotkeys::quick_tp.key1 = config.GetValue("hotkey.quick_tp.key1", VK_KEY_X);
|
||||
hotkeys::quick_tp.key2 = config.GetValue("hotkey.quick_tp.key2", VK_KEY_Y);
|
||||
hotkeys::quick_tp.key1 = config.GetValue("hotkey.quick_tp.key1", VK_KEY_X);
|
||||
hotkeys::quick_tp.key2 = config.GetValue("hotkey.quick_tp.key2", VK_KEY_Y);
|
||||
|
||||
hotkeys::menu_open.key1 = config.GetValue("hotkey.menu_open.key1", VK_LCONTROL);
|
||||
hotkeys::menu_open.key2 = config.GetValue("hotkey.menu_open.key2", VK_KEY_M);
|
||||
hotkeys::menu_open.key1 = config.GetValue("hotkey.menu_open.key1", VK_LCONTROL);
|
||||
hotkeys::menu_open.key2 = config.GetValue("hotkey.menu_open.key2", VK_KEY_M);
|
||||
|
||||
hotkeys::command_window.key1 = config.GetValue("hotkey.command_window.key1", VK_LMENU);
|
||||
hotkeys::command_window.key2 = config.GetValue("hotkey.command_window.key2", VK_KEY_C);
|
||||
hotkeys::command_window.key1 = config.GetValue("hotkey.command_window.key1", VK_LMENU);
|
||||
hotkeys::command_window.key2 = config.GetValue("hotkey.command_window.key2", VK_KEY_C);
|
||||
|
||||
hotkeys::flip_veh.key1 = config.GetValue("hotkey.flip_veh.key1", VK_NONE);
|
||||
hotkeys::flip_veh.key2 = config.GetValue("hotkey.flip_veh.key2", VK_NONE);
|
||||
hotkeys::flip_veh.key1 = config.GetValue("hotkey.flip_veh.key1", VK_NONE);
|
||||
hotkeys::flip_veh.key2 = config.GetValue("hotkey.flip_veh.key2", VK_NONE);
|
||||
|
||||
hotkeys::fix_veh.key1 = config.GetValue("hotkey.fix_veh.key1", VK_NONE);
|
||||
hotkeys::fix_veh.key2 = config.GetValue("hotkey.fix_veh.key2", VK_NONE);
|
||||
hotkeys::fix_veh.key1 = config.GetValue("hotkey.fix_veh.key1", VK_NONE);
|
||||
hotkeys::fix_veh.key2 = config.GetValue("hotkey.fix_veh.key2", VK_NONE);
|
||||
|
||||
hotkeys::god_mode.key1 = config.GetValue("hotkey.god_mode.key1", VK_NONE);
|
||||
hotkeys::god_mode.key2 = config.GetValue("hotkey.god_mode.key2", VK_NONE);
|
||||
hotkeys::god_mode.key1 = config.GetValue("hotkey.god_mode.key1", VK_NONE);
|
||||
hotkeys::god_mode.key2 = config.GetValue("hotkey.god_mode.key2", VK_NONE);
|
||||
|
||||
hotkeys::veh_engine.key1 = config.GetValue("hotkey.veh_engine.key1", VK_NONE);
|
||||
hotkeys::veh_engine.key2 = config.GetValue("hotkey.veh_engine.key2", VK_NONE);
|
||||
hotkeys::veh_engine.key1 = config.GetValue("hotkey.veh_engine.key1", VK_NONE);
|
||||
hotkeys::veh_engine.key2 = config.GetValue("hotkey.veh_engine.key2", VK_NONE);
|
||||
|
||||
hotkeys::veh_instant_start.key1 = config.GetValue("hotkey.veh_instant_start.key1", VK_NONE);
|
||||
hotkeys::veh_instant_start.key2 = config.GetValue("hotkey.veh_instant_start.key2", VK_NONE);
|
||||
hotkeys::veh_instant_start.key1 = config.GetValue("hotkey.veh_instant_start.key1", VK_NONE);
|
||||
hotkeys::veh_instant_start.key2 = config.GetValue("hotkey.veh_instant_start.key2", VK_NONE);
|
||||
|
||||
hotkeys::veh_instant_stop.key1 = config.GetValue("hotkey.veh_instant_stop.key1", VK_NONE);
|
||||
hotkeys::veh_instant_stop.key2 = config.GetValue("hotkey.veh_instant_stop.key2", VK_NONE);
|
||||
};
|
||||
}
|
||||
|
||||
Menu::~Menu()
|
||||
{
|
||||
hotkeys::veh_instant_stop.key1 = config.GetValue("hotkey.veh_instant_stop.key1", VK_NONE);
|
||||
hotkeys::veh_instant_stop.key2 = config.GetValue("hotkey.veh_instant_stop.key2", VK_NONE);
|
||||
}
|
||||
|
||||
void Menu::ProcessOverlay()
|
||||
{
|
||||
CPlayerPed *player = FindPlayerPed();
|
||||
bool show_menu = overlay::coord || overlay::fps || overlay::loc_name ||
|
||||
CPlayerPed* player = FindPlayerPed();
|
||||
bool show_menu = overlay::coord || overlay::fps || overlay::loc_name ||
|
||||
((overlay::veh_health || overlay::veh_speed) && player->m_pVehicle && player->m_pVehicle->IsDriver(player));
|
||||
|
||||
int corner = overlay::selected_pos - 1;
|
||||
@ -126,13 +119,13 @@ void Menu::ProcessOverlay()
|
||||
|
||||
if (show_menu && ImGui::Begin("Overlay", NULL, window_flags))
|
||||
{
|
||||
CPlayerPed *player = FindPlayerPed();
|
||||
|
||||
CPlayerPed* player = FindPlayerPed();
|
||||
|
||||
if (overlay::coord)
|
||||
{
|
||||
CVector pos = player->GetPosition();
|
||||
|
||||
std::string text = "Coord: " + std::to_string(int(pos.x)) + ", " + std::to_string(int(pos.y)) + ", "
|
||||
std::string text = "Coord: " + std::to_string(int(pos.x)) + ", " + std::to_string(int(pos.y)) + ", "
|
||||
+ std::to_string(int(pos.z));
|
||||
|
||||
ImGui::Text(text.c_str());
|
||||
@ -151,7 +144,7 @@ void Menu::ProcessOverlay()
|
||||
|
||||
if (overlay::veh_speed)
|
||||
{
|
||||
int speed = player->m_pVehicle->m_vecMoveSpeed.Magnitude()*50; // 02E3 - GET_CAR_SPEED
|
||||
int speed = player->m_pVehicle->m_vecMoveSpeed.Magnitude() * 50; // 02E3 - GET_CAR_SPEED
|
||||
ImGui::Text((std::string("Veh Speed: ") + std::to_string(speed)).c_str());
|
||||
}
|
||||
}
|
||||
@ -164,35 +157,35 @@ void Menu::ProcessOverlay()
|
||||
}
|
||||
}
|
||||
|
||||
void Menu::ProcessShortcutsWindow()
|
||||
void Menu::DrawShortcutsWindow()
|
||||
{
|
||||
int resX = int(screen::GetScreenWidth());
|
||||
int resY = int(screen::GetScreenHeight());
|
||||
int resX = int(screen::GetScreenWidth());
|
||||
int resY = int(screen::GetScreenHeight());
|
||||
|
||||
ImGui::SetNextWindowPos(ImVec2(0, resY - 40), ImGuiCond_Always);
|
||||
ImGui::SetNextWindowSize(ImVec2(resX, 40));
|
||||
ImGui::SetNextWindowPos(ImVec2(0, resY - 40), ImGuiCond_Always);
|
||||
ImGui::SetNextWindowSize(ImVec2(resX, 40));
|
||||
|
||||
ImGuiWindowFlags flags = ImGuiWindowFlags_NoDecoration + ImGuiWindowFlags_AlwaysAutoResize + ImGuiWindowFlags_NoSavedSettings
|
||||
+ ImGuiWindowFlags_NoMove;
|
||||
ImGuiWindowFlags flags = ImGuiWindowFlags_NoDecoration + ImGuiWindowFlags_AlwaysAutoResize + ImGuiWindowFlags_NoSavedSettings
|
||||
+ ImGuiWindowFlags_NoMove;
|
||||
|
||||
if (ImGui::Begin("Shortcuts window", NULL, flags))
|
||||
if (ImGui::Begin("Shortcuts window", NULL, flags))
|
||||
{
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(ImGui::GetStyle().FramePadding.x, resY / 130));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(3, 3));
|
||||
|
||||
ImGui::SetNextItemWidth(resX);
|
||||
ImGui::SetKeyboardFocusHere(-1);
|
||||
|
||||
if (ImGui::InputTextWithHint("##TEXTFIELD", "Enter command", commands::input_buffer, INPUT_BUFFER_SIZE, ImGuiInputTextFlags_EnterReturnsTrue))
|
||||
{
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(ImGui::GetStyle().FramePadding.x, resY / 130));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(3, 3));
|
||||
|
||||
ImGui::SetNextItemWidth(resX);
|
||||
ImGui::SetKeyboardFocusHere(-1);
|
||||
|
||||
if (ImGui::InputTextWithHint("##TEXTFIELD", "Enter command", commands::input_buffer, INPUT_BUFFER_SIZE, ImGuiInputTextFlags_EnterReturnsTrue))
|
||||
{
|
||||
ProcessCommands();
|
||||
commands::show_menu = false;
|
||||
strcpy(commands::input_buffer,"");
|
||||
}
|
||||
|
||||
ImGui::PopStyleVar(2);
|
||||
ImGui::End();
|
||||
ProcessCommands();
|
||||
commands::show_menu = false;
|
||||
strcpy(commands::input_buffer, "");
|
||||
}
|
||||
|
||||
ImGui::PopStyleVar(2);
|
||||
ImGui::End();
|
||||
}
|
||||
}
|
||||
|
||||
void Menu::ProcessCommands()
|
||||
@ -217,7 +210,7 @@ void Menu::ProcessCommands()
|
||||
|
||||
if (command == "time")
|
||||
{
|
||||
try
|
||||
try
|
||||
{
|
||||
std::string temp;
|
||||
ss >> temp;
|
||||
@ -254,7 +247,7 @@ void Menu::ProcessCommands()
|
||||
}
|
||||
|
||||
if (command == "wep")
|
||||
{
|
||||
{
|
||||
std::string wep_name;
|
||||
ss >> wep_name;
|
||||
|
||||
@ -278,14 +271,14 @@ void Menu::ProcessCommands()
|
||||
else
|
||||
CHud::SetHelpMessage("Invalid command", false, false, false);
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
if (command == "veh")
|
||||
{
|
||||
{
|
||||
std::string veh_name;
|
||||
ss >> veh_name;
|
||||
|
||||
|
||||
int model = Vehicle::GetModelFromName(veh_name.c_str());
|
||||
if (model != 0)
|
||||
{
|
||||
@ -300,7 +293,7 @@ void Menu::ProcessCommands()
|
||||
}
|
||||
}
|
||||
|
||||
void Menu::Main()
|
||||
void Menu::Draw()
|
||||
{
|
||||
if (ImGui::BeginTabBar("Menu", ImGuiTabBarFlags_NoTooltip + ImGuiTabBarFlags_FittingPolicyScroll))
|
||||
{
|
||||
@ -336,7 +329,7 @@ void Menu::Main()
|
||||
config.SetValue("overlay.veh_speed", overlay::veh_speed);
|
||||
|
||||
ImGui::Columns(1);
|
||||
|
||||
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
if (ImGui::BeginTabItem("Hotkeys"))
|
||||
@ -358,7 +351,7 @@ void Menu::Main()
|
||||
config.SetValue("hotkey.command_window.key2", hotkeys::command_window.key2);
|
||||
}
|
||||
|
||||
ImGui::Dummy(ImVec2(0,10));
|
||||
ImGui::Dummy(ImVec2(0, 10));
|
||||
|
||||
if (Ui::HotKey("Activate aim skin changer", hotkeys::aim_skin_changer))
|
||||
{
|
||||
@ -381,7 +374,7 @@ void Menu::Main()
|
||||
config.SetValue("hotkey.quick_tp.key2", hotkeys::quick_tp.key2);
|
||||
}
|
||||
|
||||
ImGui::Dummy(ImVec2(0,10));
|
||||
ImGui::Dummy(ImVec2(0, 10));
|
||||
|
||||
if (Ui::HotKey("Fix current vehicle", hotkeys::fix_veh))
|
||||
{
|
||||
@ -475,7 +468,7 @@ void Menu::Main()
|
||||
|
||||
if (ImGui::Button("GitHub repo", ImVec2(Ui::GetSize(2))))
|
||||
ShellExecute(NULL, "open", GITHUB_LINK, NULL, NULL, SW_SHOWNORMAL);
|
||||
|
||||
|
||||
ImGui::Spacing();
|
||||
|
||||
if (ImGui::BeginChild("AboutChild"))
|
||||
@ -490,14 +483,14 @@ void Menu::Main()
|
||||
ImGui::Text((std::string("Build: ") + BUILD_NUMBER).c_str());
|
||||
|
||||
ImGui::Columns(1);
|
||||
|
||||
|
||||
ImGui::Dummy(ImVec2(0, 10));
|
||||
ImGui::TextWrapped("If you find bugs or have suggestions, let me know on discord.");
|
||||
ImGui::Dummy(ImVec2(0, 10));
|
||||
ImGui::TextWrapped("Thanks to Junior-Djjr");
|
||||
ImGui::Dummy(ImVec2(0, 10));
|
||||
Ui::CenterdText("Copyright GPLv3 2019-2021 Grinch_");
|
||||
|
||||
|
||||
ImGui::EndChild();
|
||||
}
|
||||
|
||||
|
@ -40,10 +40,9 @@ public:
|
||||
};
|
||||
|
||||
Menu();
|
||||
~Menu();
|
||||
static void Main();
|
||||
static void Draw();
|
||||
static void ProcessOverlay();
|
||||
static void ProcessShortcutsWindow();
|
||||
static void DrawShortcutsWindow();
|
||||
static void ProcessCommands();
|
||||
|
||||
};
|
||||
|
@ -1,5 +1,5 @@
|
||||
#pragma once
|
||||
#define MENU_NAME "Cheat Menu"
|
||||
#define MENU_VERSION "2.6-beta"
|
||||
#define BUILD_NUMBER "20210221"
|
||||
#define BUILD_NUMBER "20210225"
|
||||
#define MENU_TITLE MENU_NAME " v" MENU_VERSION "(" BUILD_NUMBER ")"
|
34
src/Neon.cpp
34
src/Neon.cpp
@ -7,24 +7,20 @@ RwTexture* Neon::neon_texture = nullptr;
|
||||
|
||||
Neon::Neon()
|
||||
{
|
||||
Events::initGameEvent += [this]
|
||||
{
|
||||
neon_texture = Util::LoadTextureFromPngFile(PLUGIN_PATH((char*)"CheatMenu\\vehicles\\neon_mask.png"));
|
||||
neon_texture = Util::LoadTextureFromPngFile(PLUGIN_PATH((char*)"CheatMenu\\vehicles\\neon_mask.png"));
|
||||
if (!neon_texture)
|
||||
flog << "WARN: Failed to load neon mask" << std::endl;
|
||||
|
||||
if (!neon_texture)
|
||||
flog << "Failed to load neon mask" << std::endl;
|
||||
};
|
||||
|
||||
Events::vehicleRenderEvent += [](CVehicle *pVeh)
|
||||
Events::vehicleRenderEvent += [](CVehicle* pVeh)
|
||||
{
|
||||
NeonData *data = &VehNeon.Get(pVeh);
|
||||
NeonData* data = &VehNeon.Get(pVeh);
|
||||
if (data->neon_installed && !pVeh->IsUpsideDown())
|
||||
{
|
||||
CVector Pos = CModelInfo::GetModelInfo(pVeh->m_nModelIndex)->m_pColModel->m_boundBox.m_vecMin;
|
||||
CVector center = pVeh->TransformFromObjectSpace(CVector(0.0f, 0.0f, 0.0f));
|
||||
CVector center = pVeh->TransformFromObjectSpace(CVector(0.0f, 0.0f, 0.0f));
|
||||
CVector up = pVeh->TransformFromObjectSpace(CVector(0.0f, -Pos.y - data->val, 0.0f)) - center;
|
||||
CVector right = pVeh->TransformFromObjectSpace(CVector(Pos.x + data->val, 0.0f, 0.0f)) - center;
|
||||
CShadows::StoreShadowToBeRendered(5, neon_texture, ¢er, up.x, up.y, right.x, right.y, 180, data->color.r, data->color.g, data->color.b, 2.0f, false, 1.0f, 0, true);
|
||||
CVector right = pVeh->TransformFromObjectSpace(CVector(Pos.x + data->val, 0.0f, 0.0f)) - center;
|
||||
CShadows::StoreShadowToBeRendered(5, neon_texture, ¢er, up.x, up.y, right.x, right.y, 180, data->color.r, data->color.g, data->color.b, 2.0f, false, 1.0f, 0, true);
|
||||
|
||||
if (CTimer::m_snTimeInMilliseconds - data->timer > 150)
|
||||
{
|
||||
@ -33,7 +29,7 @@ Neon::Neon()
|
||||
if (data->pulsing)
|
||||
{
|
||||
if (data->val < 0.0f)
|
||||
data->increment = true;
|
||||
data->increment = true;
|
||||
|
||||
if (data->val > 0.3f)
|
||||
data->increment = false;
|
||||
@ -53,24 +49,24 @@ Neon::~Neon()
|
||||
delete neon_texture;
|
||||
}
|
||||
|
||||
bool Neon::IsNeonInstalled(CVehicle *pVeh)
|
||||
bool Neon::IsNeonInstalled(CVehicle* pVeh)
|
||||
{
|
||||
return VehNeon.Get(pVeh).neon_installed;
|
||||
}
|
||||
|
||||
bool Neon::IsPulsingEnabled(CVehicle *pVeh)
|
||||
bool Neon::IsPulsingEnabled(CVehicle* pVeh)
|
||||
{
|
||||
return VehNeon.Get(pVeh).pulsing;
|
||||
}
|
||||
|
||||
void Neon::SetPulsing(CVehicle *pVeh, bool state)
|
||||
void Neon::SetPulsing(CVehicle* pVeh, bool state)
|
||||
{
|
||||
VehNeon.Get(pVeh).pulsing = state;
|
||||
}
|
||||
|
||||
void Neon::InstallNeon(CVehicle *pVeh, int red, int green, int blue)
|
||||
void Neon::InstallNeon(CVehicle* pVeh, int red, int green, int blue)
|
||||
{
|
||||
CRGBA &color = VehNeon.Get(pVeh).color;
|
||||
CRGBA& color = VehNeon.Get(pVeh).color;
|
||||
|
||||
color.r = red;
|
||||
color.g = green;
|
||||
@ -80,7 +76,7 @@ void Neon::InstallNeon(CVehicle *pVeh, int red, int green, int blue)
|
||||
VehNeon.Get(pVeh).neon_installed = true;
|
||||
}
|
||||
|
||||
void Neon::RemoveNeon(CVehicle *pVeh)
|
||||
void Neon::RemoveNeon(CVehicle* pVeh)
|
||||
{
|
||||
VehNeon.Get(pVeh).neon_installed = false;
|
||||
}
|
||||
|
26
src/Neon.h
26
src/Neon.h
@ -6,32 +6,32 @@ private:
|
||||
static RwTexture* neon_texture;
|
||||
|
||||
class NeonData {
|
||||
public:
|
||||
public:
|
||||
CRGBA color;
|
||||
bool neon_installed;
|
||||
bool neon_installed;
|
||||
float val;
|
||||
uint timer;
|
||||
bool increment;
|
||||
bool pulsing;
|
||||
bool pulsing;
|
||||
|
||||
NeonData(CVehicle *pVeh)
|
||||
{
|
||||
neon_installed = false;
|
||||
NeonData(CVehicle* pVeh)
|
||||
{
|
||||
neon_installed = false;
|
||||
val = 0.0;
|
||||
timer = 0;
|
||||
increment = true;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
static VehicleExtendedData<NeonData> VehNeon;
|
||||
static VehicleExtendedData<NeonData> VehNeon;
|
||||
|
||||
public:
|
||||
Neon();
|
||||
~Neon();
|
||||
static void InstallNeon(CVehicle *veh, int red, int green, int blue);
|
||||
static bool IsNeonInstalled(CVehicle *veh);
|
||||
static bool IsPulsingEnabled(CVehicle *veh);
|
||||
static void SetPulsing(CVehicle *veh, bool state);
|
||||
static void RemoveNeon(CVehicle *veh);
|
||||
static void InstallNeon(CVehicle* veh, int red, int green, int blue);
|
||||
static bool IsNeonInstalled(CVehicle* veh);
|
||||
static bool IsPulsingEnabled(CVehicle* veh);
|
||||
static void SetPulsing(CVehicle* veh, bool state);
|
||||
static void RemoveNeon(CVehicle* veh);
|
||||
};
|
||||
|
||||
|
@ -36,19 +36,16 @@ std::map<std::string, std::shared_ptr<RwTexture>> Paint::textures;
|
||||
|
||||
Paint::Paint()
|
||||
{
|
||||
Events::initGameEvent += []
|
||||
for (auto& p : fs::recursive_directory_iterator(PLUGIN_PATH((char*)"\\CheatMenu\\vehicles\\paintjobs\\")))
|
||||
{
|
||||
for (auto &p : fs::recursive_directory_iterator(PLUGIN_PATH((char*)"\\CheatMenu\\vehicles\\paintjobs\\")))
|
||||
if (p.path().extension() == ".png")
|
||||
{
|
||||
if (p.path().extension() == ".png")
|
||||
{
|
||||
std::string file_name = p.path().stem().string();
|
||||
textures[file_name]= std::make_shared<RwTexture>(*(Util::LoadTextureFromPngFile(p.path())));
|
||||
}
|
||||
std::string file_name = p.path().stem().string();
|
||||
textures[file_name] = std::make_shared<RwTexture>(*(Util::LoadTextureFromPngFile(p.path())));
|
||||
}
|
||||
};
|
||||
|
||||
Events::vehicleRenderEvent.before += [](CVehicle* veh)
|
||||
}
|
||||
|
||||
Events::vehicleRenderEvent.before += [](CVehicle* veh)
|
||||
{
|
||||
VehData& data = vehdata.Get(veh);
|
||||
|
||||
@ -104,16 +101,11 @@ Paint::Paint()
|
||||
};
|
||||
}
|
||||
|
||||
Paint::~Paint()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void Paint::VehData::setMaterialColor(RpMaterial* material, RpGeometry* geometry, RwRGBA color, bool filter_mat)
|
||||
{
|
||||
auto& matProps = materialProperties[material];
|
||||
|
||||
if ( !filter_mat
|
||||
|
||||
if (!filter_mat
|
||||
|| (material->color.red == 0x3C && material->color.green == 0xFF && material->color.blue == 0x00)
|
||||
|| (material->color.red == 0xFF && material->color.green == 0x00 && material->color.blue == 0xAF))
|
||||
{
|
||||
@ -140,7 +132,7 @@ void Paint::VehData::resetMaterialColor(RpMaterial* material)
|
||||
{
|
||||
auto& matProps = materialProperties[material];
|
||||
matProps._recolor = false;
|
||||
matProps._color = {0, 0, 0, 0};
|
||||
matProps._color = { 0, 0, 0, 0 };
|
||||
}
|
||||
|
||||
void Paint::VehData::resetMaterialTexture(RpMaterial* material)
|
||||
@ -150,15 +142,15 @@ void Paint::VehData::resetMaterialTexture(RpMaterial* material)
|
||||
matProps._texture.reset();
|
||||
}
|
||||
|
||||
void Paint::NodeWrapperRecursive(RwFrame *frame, CVehicle* pVeh, std::function<void(RwFrame*)> func)
|
||||
void Paint::NodeWrapperRecursive(RwFrame* frame, CVehicle* pVeh, std::function<void(RwFrame*)> func)
|
||||
{
|
||||
if (frame)
|
||||
{
|
||||
func(frame);
|
||||
|
||||
if (RwFrame * newFrame = frame->child)
|
||||
if (RwFrame* newFrame = frame->child)
|
||||
NodeWrapperRecursive(newFrame, pVeh, func);
|
||||
if (RwFrame * newFrame = frame->next)
|
||||
if (RwFrame* newFrame = frame->next)
|
||||
NodeWrapperRecursive(newFrame, pVeh, func);
|
||||
}
|
||||
return;
|
||||
@ -166,9 +158,9 @@ void Paint::NodeWrapperRecursive(RwFrame *frame, CVehicle* pVeh, std::function<v
|
||||
|
||||
void Paint::UpdateNodeListRecursive(CVehicle* pVeh)
|
||||
{
|
||||
RwFrame *frame = (RwFrame *)pVeh->m_pRwClump->object.parent;
|
||||
RwFrame* frame = (RwFrame*)pVeh->m_pRwClump->object.parent;
|
||||
|
||||
NodeWrapperRecursive(frame, pVeh, [](RwFrame *frame)
|
||||
NodeWrapperRecursive(frame, pVeh, [](RwFrame* frame)
|
||||
{
|
||||
const std::string name = GetFrameNodeName(frame);
|
||||
|
||||
@ -179,9 +171,9 @@ void Paint::UpdateNodeListRecursive(CVehicle* pVeh)
|
||||
|
||||
void Paint::SetNodeColor(CVehicle* pVeh, std::string node_name, CRGBA color, bool filter_mat)
|
||||
{
|
||||
RwFrame *frame = (RwFrame *)pVeh->m_pRwClump->object.parent;
|
||||
RwFrame* frame = (RwFrame*)pVeh->m_pRwClump->object.parent;
|
||||
|
||||
NodeWrapperRecursive(frame, pVeh, [&](RwFrame *frame)
|
||||
NodeWrapperRecursive(frame, pVeh, [&](RwFrame* frame)
|
||||
{
|
||||
const std::string name = GetFrameNodeName(frame);
|
||||
|
||||
@ -199,7 +191,7 @@ void Paint::SetNodeColor(CVehicle* pVeh, std::string node_name, CRGBA color, boo
|
||||
RwFrameForAllObjects(frame, [](RwObject* object, void* data) -> RwObject* {
|
||||
if (object->type == rpATOMIC)
|
||||
{
|
||||
RpAtomic *atomic = reinterpret_cast<RpAtomic*>(object);
|
||||
RpAtomic* atomic = reinterpret_cast<RpAtomic*>(object);
|
||||
|
||||
ST* st = reinterpret_cast<ST*>(data);
|
||||
CRGBA* color = &st->_color;
|
||||
@ -219,8 +211,8 @@ void Paint::SetNodeColor(CVehicle* pVeh, std::string node_name, CRGBA color, boo
|
||||
|
||||
void Paint::SetNodeTexture(CVehicle* pVeh, std::string node_name, std::string texturename, bool filter_mat)
|
||||
{
|
||||
RwFrame *frame = (RwFrame *)pVeh->m_pRwClump->object.parent;
|
||||
NodeWrapperRecursive(frame, pVeh, [&](RwFrame *frame)
|
||||
RwFrame* frame = (RwFrame*)pVeh->m_pRwClump->object.parent;
|
||||
NodeWrapperRecursive(frame, pVeh, [&](RwFrame* frame)
|
||||
{
|
||||
const std::string name = GetFrameNodeName(frame);
|
||||
|
||||
@ -241,7 +233,7 @@ void Paint::SetNodeTexture(CVehicle* pVeh, std::string node_name, std::string te
|
||||
|
||||
if (object->type == rpATOMIC)
|
||||
{
|
||||
RpAtomic *atomic = reinterpret_cast<RpAtomic*>(object);
|
||||
RpAtomic* atomic = reinterpret_cast<RpAtomic*>(object);
|
||||
|
||||
ST* st = reinterpret_cast<ST*>(data);
|
||||
VehData& data = vehdata.Get(FindPlayerPed()->m_pVehicle);
|
||||
@ -255,11 +247,11 @@ void Paint::SetNodeTexture(CVehicle* pVeh, std::string node_name, std::string te
|
||||
});
|
||||
}
|
||||
|
||||
void Paint::ResetNodeColor(CVehicle *pVeh, std::string node_name)
|
||||
void Paint::ResetNodeColor(CVehicle* pVeh, std::string node_name)
|
||||
{
|
||||
RwFrame *frame = (RwFrame *)pVeh->m_pRwClump->object.parent;
|
||||
RwFrame* frame = (RwFrame*)pVeh->m_pRwClump->object.parent;
|
||||
|
||||
NodeWrapperRecursive(frame, pVeh, [&](RwFrame *frame)
|
||||
NodeWrapperRecursive(frame, pVeh, [&](RwFrame* frame)
|
||||
{
|
||||
const std::string name = GetFrameNodeName(frame);
|
||||
|
||||
@ -268,7 +260,7 @@ void Paint::ResetNodeColor(CVehicle *pVeh, std::string node_name)
|
||||
RwFrameForAllObjects(frame, [](RwObject* object, void* data) -> RwObject* {
|
||||
if (object->type == rpATOMIC)
|
||||
{
|
||||
RpAtomic *atomic = reinterpret_cast<RpAtomic*>(object);
|
||||
RpAtomic* atomic = reinterpret_cast<RpAtomic*>(object);
|
||||
VehData& data = vehdata.Get(FindPlayerPed()->m_pVehicle);
|
||||
|
||||
for (int i = 0; i < atomic->geometry->matList.numMaterials; ++i)
|
||||
@ -280,11 +272,11 @@ void Paint::ResetNodeColor(CVehicle *pVeh, std::string node_name)
|
||||
});
|
||||
}
|
||||
|
||||
void Paint::ResetNodeTexture(CVehicle *pVeh, std::string node_name)
|
||||
void Paint::ResetNodeTexture(CVehicle* pVeh, std::string node_name)
|
||||
{
|
||||
RwFrame *frame = (RwFrame *)pVeh->m_pRwClump->object.parent;
|
||||
RwFrame* frame = (RwFrame*)pVeh->m_pRwClump->object.parent;
|
||||
|
||||
NodeWrapperRecursive(frame, pVeh, [&](RwFrame *frame)
|
||||
NodeWrapperRecursive(frame, pVeh, [&](RwFrame* frame)
|
||||
{
|
||||
const std::string name = GetFrameNodeName(frame);
|
||||
|
||||
@ -294,7 +286,7 @@ void Paint::ResetNodeTexture(CVehicle *pVeh, std::string node_name)
|
||||
|
||||
if (object->type == rpATOMIC)
|
||||
{
|
||||
RpAtomic *atomic = reinterpret_cast<RpAtomic*>(object);
|
||||
RpAtomic* atomic = reinterpret_cast<RpAtomic*>(object);
|
||||
|
||||
VehData& data = vehdata.Get(FindPlayerPed()->m_pVehicle);
|
||||
|
||||
|
15
src/Paint.h
15
src/Paint.h
@ -32,14 +32,14 @@ private:
|
||||
|
||||
// store vehicle specific data
|
||||
struct VehData
|
||||
{
|
||||
{
|
||||
struct MaterialProperties
|
||||
{
|
||||
MaterialProperties() :
|
||||
_color{0, 0, 0, 0},
|
||||
_color{ 0, 0, 0, 0 },
|
||||
_recolor(false),
|
||||
_retexture(false),
|
||||
_originalColor{0, 0, 0, 0},
|
||||
_originalColor{ 0, 0, 0, 0 },
|
||||
_originalTexture(nullptr),
|
||||
_originalGeometryFlags(0),
|
||||
_geometry(nullptr)
|
||||
@ -83,14 +83,13 @@ protected:
|
||||
static std::vector<std::string> names_vec;
|
||||
static std::string selected;
|
||||
};
|
||||
|
||||
|
||||
Paint();
|
||||
~Paint();
|
||||
static void UpdateNodeListRecursive(CVehicle* pVeh);
|
||||
static void NodeWrapperRecursive(RwFrame * frame, CVehicle* pVeh, std::function<void(RwFrame*)> func);
|
||||
static void NodeWrapperRecursive(RwFrame* frame, CVehicle* pVeh, std::function<void(RwFrame*)> func);
|
||||
static void SetNodeColor(CVehicle* pVeh, std::string node_name, CRGBA color, bool filter_mat = false);
|
||||
static void SetNodeTexture(CVehicle* pVeh, std::string node_name, std::string texturename, bool filter_mat = false);
|
||||
static void ResetNodeColor(CVehicle *veh, std::string node_name);
|
||||
static void ResetNodeTexture(CVehicle *pVeh, std::string node_name);
|
||||
static void ResetNodeColor(CVehicle* veh, std::string node_name);
|
||||
static void ResetNodeTexture(CVehicle* pVeh, std::string node_name);
|
||||
};
|
||||
|
||||
|
50
src/Ped.cpp
50
src/Ped.cpp
@ -7,6 +7,7 @@ ImGuiTextFilter Ped::filter = "";
|
||||
std::string Ped::selected_item = "All";
|
||||
std::vector<std::string> Ped::search_categories;
|
||||
std::vector<std::unique_ptr<TextureStructure>> Ped::peds_vec;
|
||||
bool Ped::images_loaded = false;
|
||||
|
||||
CJson Ped::ped_json = CJson("ped");
|
||||
CJson Ped::pedspecial_json = CJson("ped special");
|
||||
@ -25,18 +26,21 @@ bool Ped::spawn_ped::dont_move = false;
|
||||
bool Ped::spawn_ped::ped_bleed = false;
|
||||
int Ped::spawn_ped::weapon_id = 0;
|
||||
|
||||
std::vector<std::string> Ped::spawn_ped::ped_type = {"Civ male","Civ female","Cop","Ballas","Grove Street Families","Los Santos Vagos",
|
||||
std::vector<std::string> 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"};
|
||||
"Gang 9","Medic","Dealer","Criminal","Fireman","Prostitute" };
|
||||
Ped::Ped()
|
||||
{
|
||||
Events::initGameEvent += []
|
||||
{
|
||||
Util::LoadTexturesInDirRecursive(PLUGIN_PATH((char*)"CheatMenu\\peds\\"), ".jpg", search_categories, peds_vec);
|
||||
if (GetModuleHandle("ExGangWars.asi"))
|
||||
exgangwars_installed = true;
|
||||
|
||||
if (LoadLibraryW(L"ExGangWars.asi"))
|
||||
exgangwars_installed = true;
|
||||
|
||||
Events::processScriptsEvent += []
|
||||
{
|
||||
if (!images_loaded)
|
||||
{
|
||||
Util::LoadTexturesInDirRecursive(PLUGIN_PATH((char*)"CheatMenu\\peds\\"), ".jpg", search_categories, peds_vec);
|
||||
images_loaded = true;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@ -59,11 +63,11 @@ void Ped::SpawnPed(std::string& model)
|
||||
|
||||
if (Ped::ped_json.data.contains(model))
|
||||
{
|
||||
CPlayerPed *player = FindPlayerPed();
|
||||
CPlayerPed* player = FindPlayerPed();
|
||||
CVector pos = player->GetPosition();
|
||||
pos.y += 1;
|
||||
|
||||
CPed *ped;
|
||||
CPed* ped;
|
||||
int hplayer;
|
||||
|
||||
if (Ped::pedspecial_json.data.contains(model))
|
||||
@ -81,12 +85,12 @@ void Ped::SpawnPed(std::string& model)
|
||||
CStreaming::SetSpecialCharIsDeletable(291);
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
int imodel = std::stoi(model);
|
||||
CStreaming::RequestModel(imodel, eStreamingFlags::PRIORITY_REQUEST);
|
||||
CStreaming::LoadAllRequestedModels(false);
|
||||
|
||||
Command <Commands::CREATE_CHAR>(spawn_ped::selected_ped_type + 4,imodel,pos.x,pos.y,pos.z+1,&hplayer);
|
||||
Command <Commands::CREATE_CHAR>(spawn_ped::selected_ped_type + 4, imodel, pos.x, pos.y, pos.z + 1, &hplayer);
|
||||
CStreaming::SetModelIsDeletable(imodel);
|
||||
}
|
||||
|
||||
@ -101,7 +105,7 @@ void Ped::SpawnPed(std::string& model)
|
||||
ped->m_nPedFlags.bPedIsBleeding = spawn_ped::ped_bleed;
|
||||
ped->m_nWeaponAccuracy = spawn_ped::accuracy;
|
||||
ped->m_fHealth = spawn_ped::health;
|
||||
|
||||
|
||||
if (spawn_ped::weapon_id != 0)
|
||||
{
|
||||
int model = 0;
|
||||
@ -113,7 +117,7 @@ void Ped::SpawnPed(std::string& model)
|
||||
}
|
||||
}
|
||||
|
||||
void Ped::Main()
|
||||
void Ped::Draw()
|
||||
{
|
||||
if (ImGui::BeginTabBar("Ped", ImGuiTabBarFlags_NoTooltip + ImGuiTabBarFlags_FittingPolicyScroll))
|
||||
{
|
||||
@ -154,9 +158,9 @@ void Ped::Main()
|
||||
CGangWars::StartDefensiveGangWar();
|
||||
else
|
||||
CGangWars::StartOffensiveGangWar();
|
||||
|
||||
|
||||
CGangWars::bGangWarsActive = true;
|
||||
}
|
||||
}
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("End gang war", ImVec2(Ui::GetSize(2))))
|
||||
CGangWars::EndGangWar(true);
|
||||
@ -170,9 +174,9 @@ void Ped::Main()
|
||||
{
|
||||
CVector pos = FindPlayerPed()->GetPosition();
|
||||
CZone szone = CZone();
|
||||
CZone *pZone = &szone;
|
||||
CZone* pZone = &szone;
|
||||
|
||||
CZoneExtraInfo *zone_info = CTheZones::GetZoneInfo(&pos, &pZone);
|
||||
CZoneExtraInfo* zone_info = CTheZones::GetZoneInfo(&pos, &pZone);
|
||||
int density = zone_info->m_nGangDensity[i];
|
||||
|
||||
if (ImGui::SliderInt(Ped::gang_names[i].c_str(), &density, 0, 127))
|
||||
@ -201,7 +205,7 @@ void Ped::Main()
|
||||
|
||||
if (ImGui::CollapsingHeader("Recruit anyone"))
|
||||
{
|
||||
static std::vector<Ui::NamedMemory> select_weapon{ {"9mm", 0x96917C}, { "AK47", 0x96917D }, { "Rockets", 0x96917E }};
|
||||
static std::vector<Ui::NamedMemory> select_weapon{ {"9mm", 0x96917C}, { "AK47", 0x96917D }, { "Rockets", 0x96917E } };
|
||||
Ui::RadioButtonAddress("Select weapon", select_weapon);
|
||||
ImGui::Spacing();
|
||||
ImGui::Separator();
|
||||
@ -210,12 +214,12 @@ void Ped::Main()
|
||||
{
|
||||
ImGui::InputInt("Radius", &ped_remove_radius);
|
||||
ImGui::Spacing();
|
||||
if (ImGui::Button("Remove peds",Ui::GetSize(1)))
|
||||
if (ImGui::Button("Remove peds", Ui::GetSize(1)))
|
||||
{
|
||||
CPlayerPed *player = FindPlayerPed();
|
||||
for (CPed *ped : CPools::ms_pPedPool)
|
||||
CPlayerPed* player = FindPlayerPed();
|
||||
for (CPed* ped : CPools::ms_pPedPool)
|
||||
{
|
||||
if (DistanceBetweenPoints(ped->GetPosition(),player->GetPosition()) < ped_remove_radius
|
||||
if (DistanceBetweenPoints(ped->GetPosition(), player->GetPosition()) < ped_remove_radius
|
||||
&& ped->m_pVehicle == nullptr && ped != player)
|
||||
Command<Commands::DELETE_CHAR>(CPools::GetPedRef(ped));
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ private:
|
||||
static std::string selected_item;
|
||||
static std::vector<std::string> search_categories;
|
||||
static std::vector<std::unique_ptr<TextureStructure>> peds_vec;
|
||||
static bool images_loaded;
|
||||
|
||||
static CJson ped_json;
|
||||
static CJson pedspecial_json;
|
||||
@ -34,7 +35,7 @@ private:
|
||||
public:
|
||||
Ped();
|
||||
~Ped();
|
||||
static void Main();
|
||||
static void Draw();
|
||||
static void SpawnPed(std::string& model);
|
||||
};
|
||||
|
||||
|
106
src/Player.cpp
106
src/Player.cpp
@ -15,6 +15,7 @@ ImGuiTextFilter Player::filter = "";
|
||||
std::vector<std::string> Player::search_categories;
|
||||
std::vector<std::unique_ptr<TextureStructure>> 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<std::string> Player::custom_skins::store_vec;
|
||||
@ -24,51 +25,53 @@ bool Player::modloader_installed = false;
|
||||
|
||||
static void PlayerModelBrokenFix()
|
||||
{
|
||||
CPlayerPed *player = FindPlayerPed();
|
||||
CPlayerPed* player = FindPlayerPed();
|
||||
|
||||
if (player->m_nModelIndex == 0)
|
||||
Call<0x5A81E0>(0, player->m_pPlayerData->m_pPedClothesDesc,0xBC1C78,false);
|
||||
Call<0x5A81E0>(0, player->m_pPlayerData->m_pPedClothesDesc, 0xBC1C78, false);
|
||||
}
|
||||
|
||||
Player::Player()
|
||||
{
|
||||
Events::initGameEvent += []
|
||||
// Fix player model being broken after rebuild
|
||||
patch::RedirectCall(0x5A834D, &PlayerModelBrokenFix);
|
||||
|
||||
aim_skin_changer = config.GetValue("aim_skin_changer", false);
|
||||
|
||||
// Custom skins setup
|
||||
if (GetModuleHandle("modloader.asi"))
|
||||
{
|
||||
// Fix player model being broken after rebuild
|
||||
patch::RedirectCall(0x5A834D,&PlayerModelBrokenFix);
|
||||
|
||||
aim_skin_changer = config.GetValue("aim_skin_changer", false);
|
||||
Util::LoadTexturesInDirRecursive(PLUGIN_PATH((char*)"CheatMenu\\clothes\\"), ".jpg", search_categories, clothes_vec);
|
||||
|
||||
// Custom skins setup
|
||||
if (LoadLibraryW(L"modloader.asi"))
|
||||
if (fs::is_directory(custom_skins::dir))
|
||||
{
|
||||
if (fs::is_directory(custom_skins::dir))
|
||||
for (auto& p : fs::recursive_directory_iterator(custom_skins::dir))
|
||||
{
|
||||
for (auto &p : fs::recursive_directory_iterator(custom_skins::dir))
|
||||
if (p.path().extension() == ".dff")
|
||||
{
|
||||
if (p.path().extension() == ".dff")
|
||||
{
|
||||
std::string file_name = p.path().stem().string();
|
||||
std::string file_name = p.path().stem().string();
|
||||
|
||||
if (file_name.size() < 9)
|
||||
custom_skins::store_vec.push_back(file_name);
|
||||
else
|
||||
flog << "Custom Skin '" << file_name << "' longer than 8 characters" << std::endl;
|
||||
}
|
||||
if (file_name.size() < 9)
|
||||
custom_skins::store_vec.push_back(file_name);
|
||||
else
|
||||
flog << "WARN: Custom Skin longer than 8 characters " << file_name << std::endl;
|
||||
}
|
||||
}
|
||||
else fs::create_directory(custom_skins::dir);
|
||||
|
||||
modloader_installed = true;
|
||||
}
|
||||
};
|
||||
else fs::create_directory(custom_skins::dir);
|
||||
|
||||
modloader_installed = true;
|
||||
}
|
||||
|
||||
Events::processScriptsEvent += []
|
||||
{
|
||||
uint timer = CTimer::m_snTimeInMilliseconds;
|
||||
static CPlayerPed* player = FindPlayerPed();
|
||||
|
||||
if (!images_loaded)
|
||||
{
|
||||
Util::LoadTexturesInDirRecursive(PLUGIN_PATH((char*)"CheatMenu\\clothes\\"), ".jpg", search_categories, clothes_vec);
|
||||
images_loaded = true;
|
||||
}
|
||||
|
||||
if (keep_position::state)
|
||||
{
|
||||
if (!player->IsAlive())
|
||||
@ -79,7 +82,7 @@ Player::Player()
|
||||
{
|
||||
CVector cur_pos = player->GetPosition();
|
||||
|
||||
if (keep_position::pos.x != 0 && keep_position::pos.x != cur_pos.x
|
||||
if (keep_position::pos.x != 0 && keep_position::pos.x != cur_pos.x
|
||||
&& keep_position::pos.y != 0 && keep_position::pos.y != cur_pos.y)
|
||||
{
|
||||
player->Teleport(keep_position::pos, false);
|
||||
@ -97,10 +100,10 @@ Player::Player()
|
||||
player->m_nPhysicalFlags.bFireProof = 1;
|
||||
player->m_nPhysicalFlags.bMeeleProof = 1;
|
||||
}
|
||||
|
||||
|
||||
if (aim_skin_changer && Ui::HotKeyPressed(Menu::hotkeys::aim_skin_changer))
|
||||
{
|
||||
CPed *target_ped = player->m_pPlayerTargettedPed;
|
||||
CPed* target_ped = player->m_pPlayerTargettedPed;
|
||||
if (target_ped)
|
||||
{
|
||||
player->SetModelIndex(target_ped->m_nModelIndex);
|
||||
@ -112,8 +115,8 @@ Player::Player()
|
||||
{
|
||||
if (god_mode)
|
||||
{
|
||||
CHud::SetHelpMessage("God mode disabled",false,false,false);
|
||||
|
||||
CHud::SetHelpMessage("God mode disabled", false, false, false);
|
||||
|
||||
patch::Set<bool>(0x96916D, god_mode, false);
|
||||
player->m_nPhysicalFlags.bBulletProof = false;
|
||||
player->m_nPhysicalFlags.bCollisionProof = false;
|
||||
@ -124,19 +127,14 @@ Player::Player()
|
||||
}
|
||||
else
|
||||
{
|
||||
CHud::SetHelpMessage("God mode enabled",false,false,false);
|
||||
CHud::SetHelpMessage("God mode enabled", false, false, false);
|
||||
god_mode = true;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Player::~Player()
|
||||
{
|
||||
}
|
||||
|
||||
void Player::ChangePlayerCloth(std::string &name)
|
||||
void Player::ChangePlayerCloth(std::string& name)
|
||||
{
|
||||
std::stringstream ss(name);
|
||||
std::string temp;
|
||||
@ -150,7 +148,7 @@ void Player::ChangePlayerCloth(std::string &name)
|
||||
getline(ss, temp, '$');
|
||||
std::string texture9 = temp.c_str();
|
||||
|
||||
CPlayerPed *player = FindPlayerPed();
|
||||
CPlayerPed* player = FindPlayerPed();
|
||||
|
||||
if (texture9 == "cutoffchinosblue")
|
||||
{
|
||||
@ -178,7 +176,7 @@ void Player::ChangePlayerModel(std::string& model)
|
||||
bool custom_skin = std::find(custom_skins::store_vec.begin(), custom_skins::store_vec.end(), model) != custom_skins::store_vec.end();
|
||||
if (Ped::ped_json.data.contains(model) || custom_skin)
|
||||
{
|
||||
CPlayerPed *player = FindPlayerPed();
|
||||
CPlayerPed* player = FindPlayerPed();
|
||||
if (Ped::pedspecial_json.data.contains(model) || custom_skin)
|
||||
{
|
||||
std::string name;
|
||||
@ -198,7 +196,7 @@ void Player::ChangePlayerModel(std::string& model)
|
||||
{
|
||||
int imodel = std::stoi(model);
|
||||
|
||||
CStreaming::RequestModel(imodel,eStreamingFlags::PRIORITY_REQUEST);
|
||||
CStreaming::RequestModel(imodel, eStreamingFlags::PRIORITY_REQUEST);
|
||||
CStreaming::LoadAllRequestedModels(false);
|
||||
player->SetModelIndex(imodel);
|
||||
CStreaming::SetModelIsDeletable(imodel);
|
||||
@ -206,7 +204,7 @@ void Player::ChangePlayerModel(std::string& model)
|
||||
}
|
||||
}
|
||||
|
||||
void Player::Main()
|
||||
void Player::Draw()
|
||||
{
|
||||
static CPlayerPed* player = FindPlayerPed();
|
||||
static int hplayer = CPools::GetPedRef(player);
|
||||
@ -223,7 +221,7 @@ void Player::Main()
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("Suicide", ImVec2(Ui::GetSize(2))))
|
||||
player->m_fHealth = 0.0;
|
||||
|
||||
|
||||
ImGui::Spacing();
|
||||
|
||||
if (ImGui::BeginTabBar("Player", ImGuiTabBarFlags_NoTooltip + ImGuiTabBarFlags_FittingPolicyScroll))
|
||||
@ -252,7 +250,7 @@ void Player::Main()
|
||||
Ui::CheckboxAddress("Infinite run", 0xB7CEE4);
|
||||
if (Ui::CheckboxBitFlag("Invisible player", player->m_nPedFlags.bDontRender))
|
||||
player->m_nPedFlags.bDontRender = (player->m_nPedFlags.bDontRender == 1) ? 0 : 1;
|
||||
|
||||
|
||||
ImGui::NextColumn();
|
||||
|
||||
Ui::CheckboxWithHint("Keep position", &keep_position::state, "Teleport to the position you died from");
|
||||
@ -263,10 +261,10 @@ void Player::Main()
|
||||
Ui::CheckboxAddress("Mega punch", 0x969173);
|
||||
Ui::CheckboxAddress("Never get hungry", 0x969174);
|
||||
|
||||
bool never_wanted = patch::Get<bool>(0x969171, false);
|
||||
bool never_wanted = patch::Get<bool>(0x969171, false);
|
||||
if (Ui::CheckboxWithHint("Never wanted", &never_wanted))
|
||||
CCheat::NotWantedCheat();
|
||||
|
||||
|
||||
ImGui::Columns(1);
|
||||
|
||||
ImGui::EndChild();
|
||||
@ -317,7 +315,7 @@ void Player::Main()
|
||||
Ui::EditStat("Fat", STAT_FAT);
|
||||
Ui::EditReference("Health", player->m_fHealth, 0, 100, static_cast<int>(player->m_fMaxHealth));
|
||||
Ui::EditStat("Lung capacity", STAT_LUNG_CAPACITY);
|
||||
Ui::EditStat("Max health", STAT_MAX_HEALTH,0,569,1450);
|
||||
Ui::EditStat("Max health", STAT_MAX_HEALTH, 0, 569, 1450);
|
||||
Ui::EditAddress<int>("Money", 0xB7CE50, -99999999, 0, 99999999);
|
||||
Ui::EditStat("Muscle", STAT_MUSCLE);
|
||||
Ui::EditStat("Respect", STAT_RESPECT);
|
||||
@ -332,14 +330,14 @@ void Player::Main()
|
||||
ImGui::NextColumn();
|
||||
ImGui::Text("Def: 0");
|
||||
ImGui::NextColumn();
|
||||
ImGui::Text("Max: %d",max_wl);
|
||||
ImGui::Text("Max: %d", max_wl);
|
||||
ImGui::Columns(1);
|
||||
|
||||
ImGui::Spacing();
|
||||
|
||||
if (ImGui::InputInt("Set value##Wanted level", &val))
|
||||
player->CheatWantedLevel(val);
|
||||
|
||||
|
||||
ImGui::Spacing();
|
||||
if (ImGui::Button("Minimum##Wanted level", Ui::GetSize(3)))
|
||||
player->CheatWantedLevel(0);
|
||||
@ -365,7 +363,7 @@ void Player::Main()
|
||||
if (ImGui::BeginTabItem("Appearance"))
|
||||
{
|
||||
ImGui::Spacing();
|
||||
if (Ui::CheckboxWithHint("Aim skin changer", &aim_skin_changer,(("Activate using Aim ped + ") + Ui::GetHotKeyNameString(Menu::hotkeys::aim_skin_changer)).c_str()))
|
||||
if (Ui::CheckboxWithHint("Aim skin changer", &aim_skin_changer, (("Activate using Aim ped + ") + Ui::GetHotKeyNameString(Menu::hotkeys::aim_skin_changer)).c_str()))
|
||||
config.SetValue("aim_skin_changer", aim_skin_changer);
|
||||
|
||||
if (ImGui::BeginTabBar("AppearanceTabBar"))
|
||||
@ -378,7 +376,7 @@ void Player::Main()
|
||||
{
|
||||
if (ImGui::Button("Remove clothes", ImVec2(Ui::GetSize())))
|
||||
{
|
||||
CPlayerPed *player = FindPlayerPed();
|
||||
CPlayerPed* player = FindPlayerPed();
|
||||
|
||||
int temp = 0;
|
||||
for (uint i = 0; i < 18; i++)
|
||||
@ -389,7 +387,7 @@ void Player::Main()
|
||||
ImGui::Spacing();
|
||||
|
||||
Ui::DrawImages(clothes_vec, ImVec2(70, 100), search_categories, selected_item, filter, ChangePlayerCloth, nullptr,
|
||||
[](std::string str)
|
||||
[](std::string str)
|
||||
{
|
||||
std::stringstream ss(str);
|
||||
std::string temp;
|
||||
@ -422,9 +420,9 @@ void Player::Main()
|
||||
if (ImGui::BeginTabItem("Custom skins"))
|
||||
{
|
||||
ImGui::Spacing();
|
||||
|
||||
|
||||
if (modloader_installed)
|
||||
{
|
||||
{
|
||||
Ui::FilterWithHint("Search", filter, std::string("Total skins: " + std::to_string(custom_skins::store_vec.size())).c_str());
|
||||
Ui::ShowTooltip("Place your dff & txd files inside 'modloader/Custom Skins'");
|
||||
ImGui::Spacing();
|
||||
@ -434,7 +432,7 @@ void Player::Main()
|
||||
{
|
||||
if (custom_skins::filter.PassFilter(name.c_str()))
|
||||
{
|
||||
if (ImGui::MenuItem(name.c_str()))
|
||||
if (ImGui::MenuItem(name.c_str()))
|
||||
{
|
||||
ChangePlayerModel(name);
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ private:
|
||||
static std::string selected_item;
|
||||
static std::vector<std::string> search_categories;
|
||||
static std::vector<std::unique_ptr<TextureStructure>> clothes_vec;
|
||||
static bool images_loaded;
|
||||
|
||||
struct custom_skins
|
||||
{
|
||||
@ -27,7 +28,6 @@ public:
|
||||
static void ChangePlayerCloth(std::string& model);
|
||||
static void ChangePlayerModel(std::string& model);
|
||||
Player();
|
||||
~Player();
|
||||
static void Main();
|
||||
static void Draw();
|
||||
};
|
||||
|
||||
|
@ -56,12 +56,7 @@ void Teleport::FetchRadarSpriteData()
|
||||
Teleport::Teleport()
|
||||
{
|
||||
json.LoadData(search_categories, selected_item);
|
||||
|
||||
Events::initGameEvent += []
|
||||
{
|
||||
// Load config data
|
||||
quick_teleport = config.GetValue("quick_teleport", false);
|
||||
};
|
||||
quick_teleport = config.GetValue("quick_teleport", false);
|
||||
|
||||
Events::processScriptsEvent += []
|
||||
{
|
||||
@ -182,7 +177,7 @@ void Teleport::RemoveTeleportEntry(std::string& category, std::string& key, std:
|
||||
else CHud::SetHelpMessage("You can only remove custom location", false, false, false);
|
||||
}
|
||||
|
||||
void Teleport::Main()
|
||||
void Teleport::Draw()
|
||||
{
|
||||
if (ImGui::BeginTabBar("Teleport",ImGuiTabBarFlags_NoTooltip+ImGuiTabBarFlags_FittingPolicyScroll))
|
||||
{
|
||||
|
@ -33,8 +33,8 @@ protected:
|
||||
Teleport();
|
||||
public:
|
||||
|
||||
static void Main();
|
||||
static void TeleportPlayer(bool get_marker = false, CVector pos = CVector(0,0,0), short interior_id = 0);
|
||||
static void Draw();
|
||||
static void TeleportPlayer(bool get_marker = false, CVector pos = CVector(0, 0, 0), short interior_id = 0);
|
||||
static void TeleportToLocation(std::string& rootkey, std::string& loc_name, std::string& loc);
|
||||
static void RemoveTeleportEntry(std::string& rootkey, std::string& key, std::string& val);
|
||||
|
||||
|
@ -1,47 +1,47 @@
|
||||
#include "plugin.h"
|
||||
|
||||
uchar* m_nDirectionalMult = (uchar*)0x55F7C7; //m_nDirectionalMult[184]
|
||||
|
||||
|
||||
uchar* m_nWaterFogAlpha = (uchar*)0x55F7B8; //m_nWaterFogAlpha[184]
|
||||
|
||||
|
||||
uchar* m_nHighLightMinIntensity = (uchar*)0x55F7A9; //m_nHighLightMinIntensity[184]
|
||||
|
||||
|
||||
uchar* m_fCloudAlpha = (uchar*)0x55F793; //m_fCloudAlpha[184]
|
||||
|
||||
|
||||
uchar* m_fPostFx2Alpha = (uchar*)0x55F77D; //m_fPostFx2Alpha[184]
|
||||
|
||||
|
||||
uchar* m_fPostFx2Blue = (uchar*)0x55F767; //m_fPostFx2Blue[184]
|
||||
|
||||
|
||||
uchar* m_fPostFx2Green = (uchar*)0x55F751; //m_fPostFx2Green[184]
|
||||
|
||||
|
||||
uchar* m_fPostFx2Red = (uchar*)0x55F73B; //m_fPostFx2Red[184]
|
||||
|
||||
|
||||
uchar* m_fPostFx1Alpha = (uchar*)0x55F725; //m_fPostFx1Alpha[184]
|
||||
|
||||
|
||||
uchar* m_fPostFx1Blue = (uchar*)0x55F70F; //m_fPostFx1Blue[184]
|
||||
|
||||
|
||||
uchar* m_fPostFx1Green = (uchar*)0x55F6FC; //m_fPostFx1Green[184]
|
||||
|
||||
|
||||
uchar* m_fPostFx1Red = (uchar*)0x55F6E9; //m_fPostFx1Red[184]
|
||||
|
||||
|
||||
uchar* m_fWaterAlpha = (uchar*)0x55F6D6; //m_fWaterAlpha[184]
|
||||
|
||||
|
||||
uchar* m_fWaterBlue = (uchar*)0x55F6C3; //m_fWaterBlue[184]
|
||||
|
||||
|
||||
uchar* m_fWaterGreen = (uchar*)0x55F6B0; //m_fWaterGreen[184]
|
||||
|
||||
|
||||
uchar* m_fWaterRed = (uchar*)0x55F69C; //m_fWaterRed[184]
|
||||
|
||||
|
||||
uchar* m_nFluffyCloudsBottomBlue = (uchar*)0x55F690; //m_nFluffyCloudsBottomBlue[184]
|
||||
|
||||
|
||||
uchar* m_nFluffyCloudsBottomGreen = (uchar*)0x55F683;//m_nFluffyCloudsBottomGreen[184]
|
||||
|
||||
|
||||
uchar* m_nFluffyCloudsBottomRed = (uchar*)0x55F677; //m_nFluffyCloudsBottomRed[184]
|
||||
|
||||
|
||||
uchar* m_nLowCloudsBlue = (uchar*)0x55F66B; //m_nLowCloudsBlue[184]
|
||||
|
||||
|
||||
uchar* m_nLowCloudsGreen = (uchar*)0x55F65F; //m_nLowCloudsGreen[184]
|
||||
|
||||
|
||||
uchar* m_nLowCloudsRed = (uchar*)0x55F653; //m_nLowCloudsRed[184]
|
||||
|
||||
uchar* m_fLightsOnGroundBrightness = (uchar*)0x55F640;//m_fLightsOnGroundBrightness[184]
|
||||
|
124
src/Ui.cpp
124
src/Ui.cpp
@ -21,7 +21,7 @@ bool Ui::ListBox(const char* label, std::vector<std::string>& all_items, int& se
|
||||
rtn = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
return rtn;
|
||||
@ -49,14 +49,14 @@ bool Ui::ListBoxStr(const char* label, std::vector<std::string>& all_items, std:
|
||||
return rtn;
|
||||
}
|
||||
|
||||
ImVec2 Ui::GetSize(short count,bool spacing)
|
||||
ImVec2 Ui::GetSize(short count, bool spacing)
|
||||
{
|
||||
if (count == 1)
|
||||
spacing = false;
|
||||
|
||||
float factor = ImGui::GetStyle().ItemSpacing.x / 2.0f;
|
||||
float x;
|
||||
|
||||
|
||||
if (count == 3)
|
||||
factor = ImGui::GetStyle().ItemSpacing.x / 1.403f;
|
||||
|
||||
@ -65,14 +65,14 @@ ImVec2 Ui::GetSize(short count,bool spacing)
|
||||
else
|
||||
x = ImGui::GetWindowContentRegionWidth() / count;
|
||||
|
||||
return ImVec2(x, ImGui::GetFrameHeight()*1.3f);
|
||||
return ImVec2(x, ImGui::GetFrameHeight() * 1.3f);
|
||||
}
|
||||
|
||||
void Ui::CenterdText(const std::string& text)
|
||||
void Ui::CenterdText(const std::string& text)
|
||||
{
|
||||
float font_size = ImGui::GetFontSize() * text.size() / 2;
|
||||
ImGui::NewLine();
|
||||
ImGui::SameLine(ImGui::GetWindowSize().x / 2 -font_size + (font_size / 1.8));
|
||||
ImGui::SameLine(ImGui::GetWindowSize().x / 2 - font_size + (font_size / 1.8));
|
||||
ImGui::Text(text.c_str());
|
||||
}
|
||||
|
||||
@ -138,7 +138,7 @@ void Ui::DrawHeaders(unsortedMap& data)
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( func != nullptr && ImGui::BeginChild("TABSBAR"))
|
||||
if (func != nullptr && ImGui::BeginChild("TABSBAR"))
|
||||
{
|
||||
((void(*)(void))func)();
|
||||
ImGui::EndChild();
|
||||
@ -159,14 +159,14 @@ void Ui::ShowTooltip(const char* text)
|
||||
}
|
||||
}
|
||||
|
||||
bool Ui::CheckboxWithHint(const char* label, bool *v, const char * hint, bool is_disabled)
|
||||
bool Ui::CheckboxWithHint(const char* label, bool* v, const char* hint, bool is_disabled)
|
||||
{
|
||||
// set things up
|
||||
bool pressed = false;
|
||||
const ImGuiStyle& style = ImGui::GetStyle();
|
||||
const ImVec2 text_size = ImGui::CalcTextSize(label, NULL, true);
|
||||
float square_sz = ImGui::GetFrameHeight();
|
||||
ImDrawList *drawlist = ImGui::GetWindowDrawList();
|
||||
ImDrawList* drawlist = ImGui::GetWindowDrawList();
|
||||
ImU32 color = ImGui::GetColorU32(ImGuiCol_FrameBg);
|
||||
std::string slabel = "##InvCheckboxBtn" + std::string(label);
|
||||
|
||||
@ -241,14 +241,14 @@ bool Ui::CheckboxWithHint(const char* label, bool *v, const char * hint, bool is
|
||||
|
||||
if (is_disabled)
|
||||
ImGui::PopStyleVar();
|
||||
|
||||
|
||||
return pressed;
|
||||
}
|
||||
|
||||
bool Ui::CheckboxAddress(const char* label, const int addr, const char* hint)
|
||||
{
|
||||
bool rtn = false;
|
||||
bool state = patch::Get<bool>(addr,false);
|
||||
bool state = patch::Get<bool>(addr, false);
|
||||
|
||||
if (CheckboxWithHint(label, &state, hint) && addr != NULL)
|
||||
{
|
||||
@ -312,7 +312,7 @@ bool Ui::CheckboxAddressVarEx(const char* label, bool val, int addr, int enabled
|
||||
return rtn;
|
||||
}
|
||||
|
||||
bool Ui::CheckboxBitFlag(const char* label,uint flag, const char* hint)
|
||||
bool Ui::CheckboxBitFlag(const char* label, uint flag, const char* hint)
|
||||
{
|
||||
bool rtn = false;
|
||||
bool state = (flag == 1) ? true : false;
|
||||
@ -325,16 +325,16 @@ bool Ui::CheckboxBitFlag(const char* label,uint flag, const char* hint)
|
||||
return rtn;
|
||||
}
|
||||
|
||||
void Ui::DrawJSON(CJson& json, std::vector<std::string>& combo_items, std::string& selected_item, ImGuiTextFilter& filter , std::function<void(std::string&, std::string&, std::string&)> func_left_click, std::function<void(std::string&, std::string&, std::string&)> func_right_click)
|
||||
void Ui::DrawJSON(CJson& json, std::vector<std::string>& combo_items, std::string& selected_item, ImGuiTextFilter& filter, std::function<void(std::string&, std::string&, std::string&)> func_left_click, std::function<void(std::string&, std::string&, std::string&)> func_right_click)
|
||||
{
|
||||
ImGui::PushItemWidth(ImGui::GetContentRegionAvailWidth()/2 - 5);
|
||||
ImGui::PushItemWidth(ImGui::GetContentRegionAvailWidth() / 2 - 5);
|
||||
ListBoxStr("##Categories", combo_items, selected_item);
|
||||
ImGui::SameLine();
|
||||
|
||||
filter.Draw("##Filter");
|
||||
if (strlen(filter.InputBuf) == 0)
|
||||
{
|
||||
ImDrawList *drawlist = ImGui::GetWindowDrawList();
|
||||
ImDrawList* drawlist = ImGui::GetWindowDrawList();
|
||||
|
||||
ImVec2 min = ImGui::GetItemRectMin();
|
||||
min.x += ImGui::GetStyle().FramePadding.x;
|
||||
@ -342,7 +342,7 @@ void Ui::DrawJSON(CJson& json, std::vector<std::string>& combo_items, std::strin
|
||||
|
||||
drawlist->AddText(min, ImGui::GetColorU32(ImGuiCol_TextDisabled), "Search");
|
||||
}
|
||||
|
||||
|
||||
ImGui::PopItemWidth();
|
||||
|
||||
ImGui::Spacing();
|
||||
@ -358,7 +358,7 @@ void Ui::DrawJSON(CJson& json, std::vector<std::string>& combo_items, std::strin
|
||||
{
|
||||
for (auto _data : root.value().items())
|
||||
{
|
||||
|
||||
|
||||
std::string name = _data.key();
|
||||
if (filter.PassFilter(name.c_str()))
|
||||
{
|
||||
@ -368,7 +368,7 @@ void Ui::DrawJSON(CJson& json, std::vector<std::string>& combo_items, std::strin
|
||||
std::string data_key = _data.key();
|
||||
std::string data_val = _data.value();
|
||||
|
||||
func_left_click(root_key,data_key,data_val);
|
||||
func_left_click(root_key, data_key, data_val);
|
||||
}
|
||||
|
||||
if (ImGui::IsItemClicked(1) && func_right_click != nullptr)
|
||||
@ -390,7 +390,7 @@ void Ui::DrawJSON(CJson& json, std::vector<std::string>& combo_items, std::strin
|
||||
ImGui::Text(json_popup.key.c_str());
|
||||
ImGui::Separator();
|
||||
if (ImGui::MenuItem("Remove"))
|
||||
json_popup.function(json_popup.root_key,json_popup.key,json_popup.value);
|
||||
json_popup.function(json_popup.root_key, json_popup.key, json_popup.value);
|
||||
|
||||
|
||||
if (ImGui::MenuItem("Close"))
|
||||
@ -403,7 +403,7 @@ void Ui::DrawJSON(CJson& json, std::vector<std::string>& combo_items, std::strin
|
||||
}
|
||||
|
||||
|
||||
void Ui::EditStat(const char *label, const int stat_id, const int min, const int def, const int max)
|
||||
void Ui::EditStat(const char* label, const int stat_id, const int min, const int def, const int max)
|
||||
{
|
||||
if (ImGui::CollapsingHeader(label))
|
||||
{
|
||||
@ -448,7 +448,7 @@ void Ui::FilterWithHint(const char* label, ImGuiTextFilter& filter, const char*
|
||||
|
||||
if (strlen(filter.InputBuf) == 0)
|
||||
{
|
||||
ImDrawList *drawlist = ImGui::GetWindowDrawList();
|
||||
ImDrawList* drawlist = ImGui::GetWindowDrawList();
|
||||
|
||||
ImVec2 min = ImGui::GetItemRectMin();
|
||||
min.x += ImGui::GetStyle().FramePadding.x;
|
||||
@ -459,8 +459,8 @@ void Ui::FilterWithHint(const char* label, ImGuiTextFilter& filter, const char*
|
||||
}
|
||||
|
||||
// clean up the code someday
|
||||
void Ui::DrawImages(std::vector<std::unique_ptr<TextureStructure>> &img_vec, ImVec2 image_size,
|
||||
std::vector<std::string>& category_vec,std::string& selected_item, ImGuiTextFilter& filter,
|
||||
void Ui::DrawImages(std::vector<std::unique_ptr<TextureStructure>>& img_vec, ImVec2 image_size,
|
||||
std::vector<std::string>& category_vec, std::string& selected_item, ImGuiTextFilter& filter,
|
||||
std::function<void(std::string&)> on_left_click, std::function<void(std::string&)> on_right_click,
|
||||
std::function<std::string(std::string&)> get_name_func, std::function<bool(std::string&)> verify_func)
|
||||
{
|
||||
@ -468,9 +468,9 @@ void Ui::DrawImages(std::vector<std::unique_ptr<TextureStructure>> &img_vec, ImV
|
||||
// scale image size
|
||||
image_size.x *= screen::GetScreenWidth() / 1366.0f;
|
||||
image_size.y *= screen::GetScreenHeight() / 768.0f;
|
||||
|
||||
|
||||
int images_in_row = static_cast<int>(ImGui::GetWindowContentRegionWidth() / image_size.x);
|
||||
image_size.x = ImGui::GetWindowContentRegionWidth() / images_in_row - int(ImGuiStyleVar_ItemSpacing)*0.65f;
|
||||
image_size.x = ImGui::GetWindowContentRegionWidth() / images_in_row - int(ImGuiStyleVar_ItemSpacing) * 0.65f;
|
||||
|
||||
int images_count = 1;
|
||||
|
||||
@ -508,7 +508,7 @@ void Ui::DrawImages(std::vector<std::unique_ptr<TextureStructure>> &img_vec, ImV
|
||||
|
||||
if (ImGui::IsItemHovered())
|
||||
{
|
||||
ImDrawList *drawlist = ImGui::GetWindowDrawList();
|
||||
ImDrawList* drawlist = ImGui::GetWindowDrawList();
|
||||
|
||||
ImVec2 btn_min = ImGui::GetItemRectMin();
|
||||
ImVec2 btn_max = ImGui::GetItemRectMax();
|
||||
@ -525,7 +525,7 @@ void Ui::DrawImages(std::vector<std::unique_ptr<TextureStructure>> &img_vec, ImV
|
||||
{
|
||||
std::string buff = "";
|
||||
|
||||
std::stringstream ss(model_name);
|
||||
std::stringstream ss(model_name);
|
||||
short count = 1;
|
||||
|
||||
while (ss >> buff)
|
||||
@ -535,7 +535,7 @@ void Ui::DrawImages(std::vector<std::unique_ptr<TextureStructure>> &img_vec, ImV
|
||||
drawlist->AddText(ImVec2(btn_min.x + offsetX, btn_min.y + 10 * count), ImGui::GetColorU32(ImGuiCol_Text), buff.c_str());
|
||||
++count;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -565,9 +565,9 @@ void Ui::DrawImages(std::vector<std::unique_ptr<TextureStructure>> &img_vec, ImV
|
||||
ImGui::EndChild();
|
||||
}
|
||||
|
||||
void Ui::RadioButtonAddress(const char* label, std::vector<NamedMemory> &named_mem)
|
||||
void Ui::RadioButtonAddress(const char* label, std::vector<NamedMemory>& named_mem)
|
||||
{
|
||||
size_t btn_in_column = named_mem.size() / 2 -1;
|
||||
size_t btn_in_column = named_mem.size() / 2 - 1;
|
||||
|
||||
ImGui::Text(label);
|
||||
ImGui::Columns(2, 0, false);
|
||||
@ -580,7 +580,7 @@ void Ui::RadioButtonAddress(const char* label, std::vector<NamedMemory> &named_m
|
||||
state = false;
|
||||
}
|
||||
|
||||
if (ImGui::RadioButton((std::string("None##") + label).c_str(), state))
|
||||
if (ImGui::RadioButton((std::string("None##") + label).c_str(), state))
|
||||
{
|
||||
for (size_t i = 0; i < named_mem.size(); i++)
|
||||
patch::Set<bool>(named_mem[i].addr, false);
|
||||
@ -604,7 +604,7 @@ void Ui::RadioButtonAddress(const char* label, std::vector<NamedMemory> &named_m
|
||||
ImGui::Columns(1);
|
||||
}
|
||||
|
||||
void Ui::RadioButtonAddressEx(const char* label, int addr, std::vector<NamedValue> &named_val)
|
||||
void Ui::RadioButtonAddressEx(const char* label, int addr, std::vector<NamedValue>& named_val)
|
||||
{
|
||||
size_t btn_in_column = named_val.size() / 2;
|
||||
|
||||
@ -625,7 +625,7 @@ void Ui::RadioButtonAddressEx(const char* label, int addr, std::vector<NamedValu
|
||||
ImGui::Columns(1);
|
||||
}
|
||||
|
||||
void Ui::EditRadioButtonAddress(const char* label, std::vector<NamedMemory> &named_mem)
|
||||
void Ui::EditRadioButtonAddress(const char* label, std::vector<NamedMemory>& named_mem)
|
||||
{
|
||||
if (ImGui::CollapsingHeader(label))
|
||||
{
|
||||
@ -635,11 +635,11 @@ void Ui::EditRadioButtonAddress(const char* label, std::vector<NamedMemory> &nam
|
||||
}
|
||||
}
|
||||
|
||||
void Ui::EditRadioButtonAddressEx(const char* label, int addr, std::vector<NamedValue> &named_val)
|
||||
void Ui::EditRadioButtonAddressEx(const char* label, int addr, std::vector<NamedValue>& named_val)
|
||||
{
|
||||
if (ImGui::CollapsingHeader(label))
|
||||
{
|
||||
RadioButtonAddressEx(label,addr,named_val);
|
||||
RadioButtonAddressEx(label, addr, named_val);
|
||||
ImGui::Spacing();
|
||||
ImGui::Separator();
|
||||
}
|
||||
@ -647,13 +647,13 @@ void Ui::EditRadioButtonAddressEx(const char* label, int addr, std::vector<Named
|
||||
|
||||
void Ui::ColorPickerAddress(const char* label, int base_addr, ImVec4&& default_color)
|
||||
{
|
||||
if (ImGui::CollapsingHeader(label))
|
||||
if (ImGui::CollapsingHeader(label))
|
||||
{
|
||||
float cur_color[4];
|
||||
cur_color[0] = patch::Get<BYTE>(base_addr, false);
|
||||
cur_color[1] = patch::Get<BYTE>(base_addr + 1, false);
|
||||
cur_color[2] = patch::Get<BYTE>(base_addr + 2, false);
|
||||
cur_color[3] = patch::Get<BYTE>(base_addr + 3,false);
|
||||
cur_color[3] = patch::Get<BYTE>(base_addr + 3, false);
|
||||
|
||||
// 0-255 -> 0-1
|
||||
cur_color[0] /= 255;
|
||||
@ -670,9 +670,9 @@ void Ui::ColorPickerAddress(const char* label, int base_addr, ImVec4&& default_c
|
||||
cur_color[3] *= 255;
|
||||
|
||||
patch::Set<BYTE>(base_addr, cur_color[0], false);
|
||||
patch::Set<BYTE>(base_addr+1, cur_color[1], false);
|
||||
patch::Set<BYTE>(base_addr+2, cur_color[2], false);
|
||||
patch::Set<BYTE>(base_addr+3, cur_color[3], false);
|
||||
patch::Set<BYTE>(base_addr + 1, cur_color[1], false);
|
||||
patch::Set<BYTE>(base_addr + 2, cur_color[2], false);
|
||||
patch::Set<BYTE>(base_addr + 3, cur_color[3], false);
|
||||
}
|
||||
ImGui::Spacing();
|
||||
|
||||
@ -689,9 +689,9 @@ void Ui::ColorPickerAddress(const char* label, int base_addr, ImVec4&& default_c
|
||||
}
|
||||
}
|
||||
|
||||
void Ui::EditBits(const char *label, const int address, const std::vector<std::string>& names)
|
||||
void Ui::EditBits(const char* label, const int address, const std::vector<std::string>& names)
|
||||
{
|
||||
int *mem_val = (int*)address;
|
||||
int* mem_val = (int*)address;
|
||||
|
||||
if (ImGui::CollapsingHeader(label))
|
||||
{
|
||||
@ -715,12 +715,12 @@ void Ui::EditBits(const char *label, const int address, const std::vector<std::s
|
||||
}
|
||||
}
|
||||
|
||||
void Ui::EditFloat(const char *label, const int address, const float min, const float def, const float max, const float mul)
|
||||
void Ui::EditFloat(const char* label, const int address, const float min, const float def, const float max, const float mul)
|
||||
{
|
||||
if (ImGui::CollapsingHeader(label))
|
||||
{
|
||||
float val = patch::Get<float>(address, false)*mul;
|
||||
|
||||
float val = patch::Get<float>(address, false) * mul;
|
||||
|
||||
int items = 3;
|
||||
|
||||
if (min == def)
|
||||
@ -735,7 +735,7 @@ void Ui::EditFloat(const char *label, const int address, const float min, const
|
||||
ImGui::NextColumn();
|
||||
ImGui::Text(("Def: " + std::to_string(def)).c_str());
|
||||
}
|
||||
|
||||
|
||||
ImGui::NextColumn();
|
||||
ImGui::Text(("Max: " + std::to_string(max)).c_str());
|
||||
ImGui::Columns(1);
|
||||
@ -746,15 +746,15 @@ void Ui::EditFloat(const char *label, const int address, const float min, const
|
||||
|
||||
if (ImGui::InputFloat(("##" + std::string(label)).c_str(), &val))
|
||||
patch::SetFloat(address, val / mul, false);
|
||||
|
||||
|
||||
ImGui::SameLine(0.0, 4.0);
|
||||
if (ImGui::Button("-",ImVec2(size, size)) && val > min)
|
||||
if (ImGui::Button("-", ImVec2(size, size)) && val > min)
|
||||
{
|
||||
val -= 1;
|
||||
patch::SetFloat(address, val / mul, false);
|
||||
}
|
||||
ImGui::SameLine(0.0, 4.0);
|
||||
if (ImGui::Button("+",ImVec2(size, size)) && val < max)
|
||||
if (ImGui::Button("+", ImVec2(size, size)) && val < max)
|
||||
{
|
||||
val += 1;
|
||||
patch::SetFloat(address, val / mul, false);
|
||||
@ -766,20 +766,20 @@ void Ui::EditFloat(const char *label, const int address, const float min, const
|
||||
ImGui::Spacing();
|
||||
|
||||
if (ImGui::Button(("Minimum##" + std::string(label)).c_str(), Ui::GetSize(items)))
|
||||
patch::Set<float>(address, min/mul, false);
|
||||
patch::Set<float>(address, min / mul, false);
|
||||
|
||||
if (items == 3)
|
||||
{
|
||||
ImGui::SameLine();
|
||||
|
||||
if (ImGui::Button(("Default##" + std::string(label)).c_str(), Ui::GetSize(items)))
|
||||
patch::Set<float>(address, def/mul, false);
|
||||
patch::Set<float>(address, def / mul, false);
|
||||
}
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
if (ImGui::Button(("Maximum##" + std::string(label)).c_str(), Ui::GetSize(items)))
|
||||
patch::Set<float>(address, max/mul, false);
|
||||
patch::Set<float>(address, max / mul, false);
|
||||
|
||||
ImGui::Spacing();
|
||||
ImGui::Separator();
|
||||
@ -814,18 +814,18 @@ bool Ui::HotKey(const char* label, HotKeyData& key_data)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
std::string text;
|
||||
|
||||
if (key_data.key1 != VK_NONE)
|
||||
text = key_names[key_data.key1-1];
|
||||
text = key_names[key_data.key1 - 1];
|
||||
else
|
||||
text = "None";
|
||||
|
||||
if (key_data.key1 != key_data.key2)
|
||||
text += (" + " + key_names[key_data.key2-1]);
|
||||
|
||||
text += (" + " + key_names[key_data.key2 - 1]);
|
||||
|
||||
if (ImGui::Button((text + std::string("##") + std::string(label)).c_str(), ImVec2(ImGui::GetWindowContentRegionWidth() / 3.5, ImGui::GetFrameHeight())))
|
||||
if (!active)
|
||||
current_hotkey = label;
|
||||
@ -845,16 +845,16 @@ bool Ui::HotKey(const char* label, HotKeyData& key_data)
|
||||
}
|
||||
else
|
||||
current_hotkey = "";
|
||||
|
||||
|
||||
state = true;
|
||||
}
|
||||
|
||||
|
||||
ImGui::SameLine();
|
||||
ImGui::Text(label);
|
||||
|
||||
if (active)
|
||||
ImGui::PopStyleColor(2);
|
||||
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
@ -878,7 +878,7 @@ std::string Ui::GetHotKeyNameString(HotKeyData& hotkey)
|
||||
std::string text;
|
||||
|
||||
if (hotkey.key1 != VK_NONE)
|
||||
text = key_names[hotkey.key1-1];
|
||||
text = key_names[hotkey.key1 - 1];
|
||||
else
|
||||
text = "None";
|
||||
|
||||
@ -888,7 +888,7 @@ std::string Ui::GetHotKeyNameString(HotKeyData& hotkey)
|
||||
return text;
|
||||
}
|
||||
|
||||
bool Ui::ColorButton(int color_id, std::vector<float> &color, ImVec2 size)
|
||||
bool Ui::ColorButton(int color_id, std::vector<float>& color, ImVec2 size)
|
||||
{
|
||||
bool rtn = false;
|
||||
std::string label = "Color " + std::to_string(color_id);
|
||||
@ -898,7 +898,7 @@ bool Ui::ColorButton(int color_id, std::vector<float> &color, ImVec2 size)
|
||||
|
||||
if (ImGui::IsItemHovered())
|
||||
{
|
||||
ImDrawList *drawlist = ImGui::GetWindowDrawList();
|
||||
ImDrawList* drawlist = ImGui::GetWindowDrawList();
|
||||
drawlist->AddRectFilled(ImGui::GetItemRectMin(), ImGui::GetItemRectMax(), ImGui::GetColorU32(ImGuiCol_ModalWindowDimBg));
|
||||
}
|
||||
|
||||
|
34
src/Ui.h
34
src/Ui.h
@ -31,7 +31,7 @@ public:
|
||||
std::string value;
|
||||
};
|
||||
static void CenterdText(const std::string& text);
|
||||
static bool ColorButton(int color_id, std::vector<float> &color, ImVec2 size);
|
||||
static bool ColorButton(int color_id, std::vector<float>& color, ImVec2 size);
|
||||
static bool CheckboxAddress(const char* label, const int addr = NULL, const char* hint = nullptr);
|
||||
static bool CheckboxAddressEx(const char* label, const int addr = NULL, int enabled_val = 1, int disabled_val = 0, const char* hint = nullptr);
|
||||
static bool CheckboxAddressVar(const char* label, bool val, int addr, const char* hint = nullptr);
|
||||
@ -42,20 +42,20 @@ public:
|
||||
|
||||
static void DrawJSON(CJson& json, std::vector<std::string>& combo_items, std::string& selected_item, ImGuiTextFilter& filter,
|
||||
std::function<void(std::string&, std::string&, std::string&)> func_left_click, std::function<void(std::string&, std::string&, std::string&)> func_right_click);
|
||||
static void DrawImages(std::vector<std::unique_ptr<TextureStructure>> &img_vec, ImVec2 image_size,
|
||||
static void DrawImages(std::vector<std::unique_ptr<TextureStructure>>& img_vec, ImVec2 image_size,
|
||||
std::vector<std::string>& category_vec, std::string& selected_item, ImGuiTextFilter& filter,
|
||||
std::function<void(std::string&)> on_left_click, std::function<void(std::string&)> on_right_click,
|
||||
std::function<std::string(std::string&)> get_name_func, std::function<bool(std::string&)> verify_func = nullptr);
|
||||
|
||||
template <typename T>
|
||||
static void EditAddress(const char *label,const int address, const int min = 0, const int def = 0, const int max = 100);
|
||||
static void EditBits(const char *label, const int address, const std::vector<std::string>& names);
|
||||
static void EditFloat(const char *label, const int address, const float min, const float def, const float max, const float mul = 1);
|
||||
static void EditAddress(const char* label, const int address, const int min = 0, const int def = 0, const int max = 100);
|
||||
static void EditBits(const char* label, const int address, const std::vector<std::string>& names);
|
||||
static void EditFloat(const char* label, const int address, const float min, const float def, const float max, const float mul = 1);
|
||||
template <typename T>
|
||||
static void EditReference(const char *label,T &address, const int min = 0, const int def = 0, const int max = 100);
|
||||
static void EditRadioButtonAddress(const char* label, std::vector<NamedMemory> &named_mem);
|
||||
static void EditRadioButtonAddressEx(const char* label, int addr, std::vector<NamedValue> &named_val);
|
||||
static void EditStat(const char *label, const int stat_id, const int min = 0, const int def = 0, const int max = 1000);
|
||||
static void EditReference(const char* label, T& address, const int min = 0, const int def = 0, const int max = 100);
|
||||
static void EditRadioButtonAddress(const char* label, std::vector<NamedMemory>& named_mem);
|
||||
static void EditRadioButtonAddressEx(const char* label, int addr, std::vector<NamedValue>& named_val);
|
||||
static void EditStat(const char* label, const int stat_id, const int min = 0, const int def = 0, const int max = 1000);
|
||||
|
||||
static void FilterWithHint(const char* label, ImGuiTextFilter& filter, const char* hint);
|
||||
|
||||
@ -68,15 +68,15 @@ public:
|
||||
static bool ListBox(const char* label, std::vector<std::string>& all_items, int& selected);
|
||||
static bool ListBoxStr(const char* label, std::vector<std::string>& all_items, std::string& selected);
|
||||
|
||||
static void RadioButtonAddress(const char* label, std::vector<NamedMemory> &named_mem);
|
||||
static void RadioButtonAddressEx(const char* label, int addr, std::vector<NamedValue> &named_val);
|
||||
static void RadioButtonAddress(const char* label, std::vector<NamedMemory>& named_mem);
|
||||
static void RadioButtonAddressEx(const char* label, int addr, std::vector<NamedValue>& named_val);
|
||||
|
||||
static void ColorPickerAddress(const char* label, int base_addr, ImVec4&& default_color);
|
||||
static void ShowTooltip(const char* text);
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
void Ui::EditAddress(const char *label, const int address, const int min, const int def, const int max)
|
||||
void Ui::EditAddress(const char* label, const int address, const int min, const int def, const int max)
|
||||
{
|
||||
if (ImGui::CollapsingHeader(label))
|
||||
{
|
||||
@ -87,15 +87,15 @@ void Ui::EditAddress(const char *label, const int address, const int min, const
|
||||
if (min == def)
|
||||
items = 2;
|
||||
|
||||
ImGui::Columns(items,0,false);
|
||||
ImGui::Columns(items, 0, false);
|
||||
ImGui::Text(("Min: " + std::to_string(min)).c_str());
|
||||
|
||||
|
||||
if (items == 3)
|
||||
{
|
||||
ImGui::NextColumn();
|
||||
ImGui::Text(("Def: " + std::to_string(def)).c_str());
|
||||
}
|
||||
|
||||
|
||||
ImGui::NextColumn();
|
||||
ImGui::Text(("Max: " + std::to_string(max)).c_str());
|
||||
ImGui::Columns(1);
|
||||
@ -109,7 +109,7 @@ void Ui::EditAddress(const char *label, const int address, const int min, const
|
||||
|
||||
if (val < min)
|
||||
val = min;
|
||||
|
||||
|
||||
if (val > max)
|
||||
val = max;
|
||||
|
||||
@ -135,7 +135,7 @@ void Ui::EditAddress(const char *label, const int address, const int min, const
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void Ui::EditReference(const char *label,T &address, const int min, const int def, const int max)
|
||||
void Ui::EditReference(const char* label, T& address, const int min, const int def, const int max)
|
||||
{
|
||||
if (ImGui::CollapsingHeader(label))
|
||||
{
|
||||
|
57
src/Util.cpp
57
src/Util.cpp
@ -23,10 +23,10 @@ void Util::ClearCharTasksVehCheck(CPed* ped)
|
||||
}
|
||||
}
|
||||
|
||||
void Util::LoadTexturesInDirRecursive(const char *path, const char *file_ext,std::vector<std::string>& category_vec, std::vector<std::unique_ptr<TextureStructure>> &store_vec)
|
||||
void Util::LoadTexturesInDirRecursive(const char* path, const char* file_ext, std::vector<std::string>& category_vec, std::vector<std::unique_ptr<TextureStructure>>& store_vec)
|
||||
{
|
||||
std::string folder = "";
|
||||
for (auto &p : fs::recursive_directory_iterator(path))
|
||||
for (auto& p : fs::recursive_directory_iterator(path))
|
||||
{
|
||||
if (p.path().extension() == file_ext)
|
||||
{
|
||||
@ -41,7 +41,6 @@ void Util::LoadTexturesInDirRecursive(const char *path, const char *file_ext,std
|
||||
hr = S_OK;
|
||||
}
|
||||
|
||||
|
||||
if (hr == S_OK)
|
||||
{
|
||||
store_vec.back().get()->file_name = p.path().stem().string();
|
||||
@ -49,7 +48,7 @@ void Util::LoadTexturesInDirRecursive(const char *path, const char *file_ext,std
|
||||
}
|
||||
else
|
||||
{
|
||||
flog << "Couldn't load image " << p.path().stem().string() << std::endl;
|
||||
flog << "WARN: Failed to load " << p.path().stem().string() << std::endl;
|
||||
store_vec.pop_back();
|
||||
}
|
||||
}
|
||||
@ -83,7 +82,7 @@ bool Util::LoadTextureFromFileDx11(const char* filename, ID3D11ShaderResourceVie
|
||||
desc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
|
||||
desc.CPUAccessFlags = 0;
|
||||
|
||||
ID3D11Texture2D *pTexture = NULL;
|
||||
ID3D11Texture2D* pTexture = NULL;
|
||||
D3D11_SUBRESOURCE_DATA subResource;
|
||||
subResource.pSysMem = image_data;
|
||||
subResource.SysMemPitch = desc.Width * 4;
|
||||
@ -111,7 +110,7 @@ bool Util::IsOnMission()
|
||||
return FindPlayerPed()->CanPlayerStartMission() && !*(patch::Get<char*>(0x5D5380, false) + CTheScripts::OnAMissionFlag);
|
||||
}
|
||||
|
||||
std::string Util::GetLocationName(CVector *pos)
|
||||
std::string Util::GetLocationName(CVector* pos)
|
||||
{
|
||||
int hplayer = CPools::GetPedRef(FindPlayerPed());
|
||||
int interior = 0;
|
||||
@ -123,18 +122,18 @@ std::string Util::GetLocationName(CVector *pos)
|
||||
|
||||
switch (city)
|
||||
{
|
||||
case 0:
|
||||
town = "CS";
|
||||
break;
|
||||
case 1:
|
||||
town = "LS";
|
||||
break;
|
||||
case 2:
|
||||
town = "SF";
|
||||
break;
|
||||
case 3:
|
||||
town = "LV";
|
||||
break;
|
||||
case 0:
|
||||
town = "CS";
|
||||
break;
|
||||
case 1:
|
||||
town = "LS";
|
||||
break;
|
||||
case 2:
|
||||
town = "SF";
|
||||
break;
|
||||
case 3:
|
||||
town = "LV";
|
||||
break;
|
||||
}
|
||||
|
||||
if (interior == 0)
|
||||
@ -151,9 +150,9 @@ int Util::GetLargestGangInZone()
|
||||
for (int i = 0; i != 10; ++i)
|
||||
{
|
||||
CVector pos = FindPlayerPed()->GetPosition();
|
||||
CZone *zone = new CZone();
|
||||
|
||||
CZoneExtraInfo *zone_info = CTheZones::GetZoneInfo(&pos, &zone);
|
||||
CZone* zone = new CZone();
|
||||
|
||||
CZoneExtraInfo* zone_info = CTheZones::GetZoneInfo(&pos, &zone);
|
||||
int density = zone_info->m_nGangDensity[i];
|
||||
|
||||
if (density > max_density)
|
||||
@ -171,11 +170,11 @@ int Util::GetLargestGangInZone()
|
||||
// https://github.com/cleolibrary/CLEO4/blob/916d400f4a731ba1dd0ff16e52bdb056f42b7038/source/CCustomOpcodeSystem.cpp#L1671
|
||||
CVehicle* Util::GetClosestVehicle()
|
||||
{
|
||||
CPlayerPed *player = FindPlayerPed();
|
||||
CPedIntelligence *pedintel;
|
||||
CPlayerPed* player = FindPlayerPed();
|
||||
CPedIntelligence* pedintel;
|
||||
if (player && (pedintel = player->m_pIntelligence))
|
||||
{
|
||||
CVehicle *veh = nullptr;
|
||||
CVehicle* veh = nullptr;
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
veh = (CVehicle*)pedintel->m_vehicleScanner.m_apEntities[i];
|
||||
@ -191,11 +190,11 @@ CVehicle* Util::GetClosestVehicle()
|
||||
|
||||
CPed* Util::GetClosestPed()
|
||||
{
|
||||
CPlayerPed *player = FindPlayerPed();
|
||||
CPedIntelligence * pedintel;
|
||||
CPlayerPed* player = FindPlayerPed();
|
||||
CPedIntelligence* pedintel;
|
||||
if (player && (pedintel = player->m_pIntelligence))
|
||||
{
|
||||
CPed *ped = nullptr;
|
||||
CPed* ped = nullptr;
|
||||
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
@ -210,9 +209,9 @@ CPed* Util::GetClosestPed()
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void Util::RainbowValues(int &r, int&g, int &b, float speed)
|
||||
void Util::RainbowValues(int& r, int& g, int& b, float speed)
|
||||
{
|
||||
int timer = CTimer::m_snTimeInMilliseconds/150;
|
||||
int timer = CTimer::m_snTimeInMilliseconds / 150;
|
||||
r = sin(timer * speed) * 127 + 128;
|
||||
g = sin(timer * speed + 2) * 127 + 128;
|
||||
b = sin(timer * speed + 4) * 127 + 128;
|
||||
|
25
src/Util.h
25
src/Util.h
@ -14,31 +14,6 @@ public:
|
||||
static bool IsOnMission();
|
||||
static std::string GetLocationName(CVector *pos);
|
||||
static void RainbowValues(int &r, int&g, int &b, float speed);
|
||||
|
||||
// This below source is taken from MoonAdditions https://github.com/THE-FYP/MoonAdditions
|
||||
// MIT License
|
||||
|
||||
// Copyright (c) 2012 DK22Pac
|
||||
// Copyright (c) 2017 FYP
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
static RwTexture* LoadTextureFromPngFile(fs::path path);
|
||||
static void UnloadTexture(RwTexture* texture9);
|
||||
};
|
||||
|
@ -206,5 +206,5 @@ static std::string key_names[]
|
||||
"LCtrl",
|
||||
"RCtrl",
|
||||
"LMenu",
|
||||
"RMenu"
|
||||
"RMenu"
|
||||
};
|
304
src/Vehicle.cpp
304
src/Vehicle.cpp
@ -42,6 +42,7 @@ ImGuiTextFilter Vehicle::tune::filter = "";
|
||||
std::vector<std::string> Vehicle::tune::search_categories;
|
||||
std::vector<std::unique_ptr<TextureStructure>> 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;
|
||||
@ -57,7 +58,7 @@ static std::vector<std::string>(handling_flag_names) = // 32 flags
|
||||
"1G_BOOST","2G_BOOST","NPC_ANTI_ROLL","NPC_NEUTRAL_HANDL","NO_HANDBRAKE","STEER_REARWHEELS","HB_REARWHEEL_STEER","ALT_STEER_OPT",
|
||||
"WHEEL_F_NARROW2","WHEEL_F_NARROW","WHEEL_F_WIDE","WHEEL_F_WIDE2","WHEEL_R_NARROW2","WHEEL_R_NARROW","WHEEL_R_WIDE","WHEEL_R_WIDE2",
|
||||
"HYDRAULIC_GEOM","HYDRAULIC_INST","HYDRAULIC_NONE","NOS_INST","OFFROAD_ABILITY","OFFROAD_ABILITY2","HALOGEN_LIGHTS","PROC_REARWHEEL_1ST",
|
||||
"USE_MAXSP_LIMIT","LOW_RIDER","STREET_RACER","SWINGING_CHASSIS","Unused 1","Unused 2","Unused 3","Unused 4"
|
||||
"USE_MAXSP_LIMIT","LOW_RIDER","STREET_RACER","SWINGING_CHASSIS","Unused 1","Unused 2","Unused 3","Unused 4"
|
||||
};
|
||||
|
||||
static std::vector<std::string>(model_flag_names) = // 32 flags
|
||||
@ -70,27 +71,28 @@ static std::vector<std::string>(model_flag_names) = // 32 flags
|
||||
|
||||
Vehicle::Vehicle()
|
||||
{
|
||||
Events::initGameEvent += []
|
||||
{
|
||||
Util::LoadTexturesInDirRecursive(PLUGIN_PATH((char*)"CheatMenu\\vehicles\\images\\"), ".jpg", spawner::search_categories, spawner::image_vec);
|
||||
Util::LoadTexturesInDirRecursive(PLUGIN_PATH((char*)"CheatMenu\\vehicles\\components\\"), ".jpg", tune::search_categories, tune::image_vec);
|
||||
Util::LoadTexturesInDirRecursive(PLUGIN_PATH((char*)"CheatMenu\\vehicles\\paintjobs\\"), ".png", texture9::search_categories, texture9::image_vec);
|
||||
|
||||
ParseVehiclesIDE();
|
||||
ParseCarcolsDAT();
|
||||
};
|
||||
ParseVehiclesIDE();
|
||||
ParseCarcolsDAT();
|
||||
|
||||
Events::processScriptsEvent += [this]
|
||||
{
|
||||
uint timer = CTimer::m_snTimeInMilliseconds;
|
||||
if (!images_loaded)
|
||||
{
|
||||
Util::LoadTexturesInDirRecursive(PLUGIN_PATH((char*)"CheatMenu\\vehicles\\images\\"), ".jpg", spawner::search_categories, spawner::image_vec);
|
||||
Util::LoadTexturesInDirRecursive(PLUGIN_PATH((char*)"CheatMenu\\vehicles\\components\\"), ".jpg", tune::search_categories, tune::image_vec);
|
||||
Util::LoadTexturesInDirRecursive(PLUGIN_PATH((char*)"CheatMenu\\vehicles\\paintjobs\\"), ".png", texture9::search_categories, texture9::image_vec);
|
||||
|
||||
CPlayerPed *player = FindPlayerPed();
|
||||
CVehicle *veh = player->m_pVehicle;
|
||||
images_loaded = true;
|
||||
}
|
||||
|
||||
uint timer = CTimer::m_snTimeInMilliseconds;
|
||||
CPlayerPed* player = FindPlayerPed();
|
||||
CVehicle* veh = player->m_pVehicle;
|
||||
|
||||
if (player && veh)
|
||||
{
|
||||
int hveh = CPools::GetVehicleRef(veh);
|
||||
|
||||
|
||||
if (Ui::HotKeyPressed(Menu::hotkeys::flip_veh))
|
||||
{
|
||||
float roll;
|
||||
@ -104,7 +106,7 @@ Vehicle::Vehicle()
|
||||
{
|
||||
player->m_pVehicle->Fix();
|
||||
player->m_pVehicle->m_fHealth = 1000.0f;
|
||||
CHud::SetHelpMessage("Vehicle fixed",false,false,false);
|
||||
CHud::SetHelpMessage("Vehicle fixed", false, false, false);
|
||||
}
|
||||
|
||||
if (Ui::HotKeyPressed(Menu::hotkeys::veh_engine))
|
||||
@ -112,9 +114,9 @@ Vehicle::Vehicle()
|
||||
bool state = !veh->m_nVehicleFlags.bEngineBroken || veh->m_nVehicleFlags.bEngineOn;
|
||||
|
||||
if (state)
|
||||
CHud::SetHelpMessage("Vehicle engine off",false,false,false);
|
||||
CHud::SetHelpMessage("Vehicle engine off", false, false, false);
|
||||
else
|
||||
CHud::SetHelpMessage("Vehicle engine on",false,false,false);
|
||||
CHud::SetHelpMessage("Vehicle engine on", false, false, false);
|
||||
|
||||
veh->m_nVehicleFlags.bEngineBroken = state;
|
||||
veh->m_nVehicleFlags.bEngineOn = !state;
|
||||
@ -125,7 +127,7 @@ Vehicle::Vehicle()
|
||||
|
||||
if (Ui::HotKeyPressed(Menu::hotkeys::veh_instant_stop))
|
||||
Command<Commands::SET_CAR_FORWARD_SPEED>(hveh, 0);
|
||||
|
||||
|
||||
if (veh_nodmg)
|
||||
{
|
||||
veh->m_nPhysicalFlags.bBulletProof = true;
|
||||
@ -133,10 +135,10 @@ Vehicle::Vehicle()
|
||||
veh->m_nPhysicalFlags.bFireProof = true;
|
||||
veh->m_nPhysicalFlags.bCollisionProof = true;
|
||||
veh->m_nPhysicalFlags.bMeeleProof = true;
|
||||
veh->m_nVehicleFlags.bCanBeDamaged = true;
|
||||
veh->m_nVehicleFlags.bCanBeDamaged = true;
|
||||
}
|
||||
|
||||
player->m_nPedFlags.CantBeKnockedOffBike = dont_fall_bike ? 1 : 2;
|
||||
player->m_nPedFlags.CantBeKnockedOffBike = dont_fall_bike ? 1 : 2;
|
||||
Command<Commands::SET_CAR_HEAVY>(hveh, veh_heavy);
|
||||
Command<Commands::SET_CAR_WATERTIGHT>(hveh, veh_watertight);
|
||||
|
||||
@ -179,34 +181,34 @@ Vehicle::Vehicle()
|
||||
// Traffic neons
|
||||
if (neon::traffic && timer - neon::traffic_timer > 1000)
|
||||
{
|
||||
for (CVehicle *veh : CPools::ms_pVehiclePool)
|
||||
for (CVehicle* veh : CPools::ms_pVehiclePool)
|
||||
{
|
||||
int chance = 0;
|
||||
|
||||
if (veh->m_nVehicleClass == CLASS_NORMAL) // Normal
|
||||
chance = Random(1,20);
|
||||
chance = Random(1, 20);
|
||||
|
||||
if (veh->m_nVehicleClass == CLASS_RICHFAMILY) // Rich family
|
||||
chance = Random(1,4);
|
||||
chance = Random(1, 4);
|
||||
|
||||
if (veh->m_nVehicleClass == CLASS_EXECUTIVE) // Executive
|
||||
chance = Random(1,3);
|
||||
chance = Random(1, 3);
|
||||
|
||||
if (chance == 1 && !IsNeonInstalled(veh) && veh->m_pDriver != player)
|
||||
InstallNeon(veh, Random(0,255), Random(0,255), Random(0,255));
|
||||
InstallNeon(veh, Random(0, 255), Random(0, 255), Random(0, 255));
|
||||
}
|
||||
neon::traffic_timer = timer;
|
||||
}
|
||||
|
||||
|
||||
if (bike_fly && veh && veh->IsDriver(player))
|
||||
{
|
||||
if (veh->m_nVehicleSubClass == VEHICLE_BIKE || veh->m_nVehicleSubClass == VEHICLE_BMX)
|
||||
{
|
||||
if (sqrt( veh->m_vecMoveSpeed.x * veh->m_vecMoveSpeed.x
|
||||
+ veh->m_vecMoveSpeed.y * veh->m_vecMoveSpeed.y
|
||||
+ veh->m_vecMoveSpeed.z * veh->m_vecMoveSpeed.z
|
||||
) > 0.0
|
||||
&& CTimer::ms_fTimeStep > 0.0)
|
||||
if (sqrt(veh->m_vecMoveSpeed.x * veh->m_vecMoveSpeed.x
|
||||
+ veh->m_vecMoveSpeed.y * veh->m_vecMoveSpeed.y
|
||||
+ veh->m_vecMoveSpeed.z * veh->m_vecMoveSpeed.z
|
||||
) > 0.0
|
||||
&& CTimer::ms_fTimeStep > 0.0)
|
||||
{
|
||||
veh->FlyingControl(3, -9999.9902f, -9999.9902f, -9999.9902f, -9999.9902f);
|
||||
}
|
||||
@ -218,11 +220,11 @@ Vehicle::Vehicle()
|
||||
void Vehicle::AddComponent(const std::string& component, const bool display_message)
|
||||
{
|
||||
try {
|
||||
CPlayerPed *player = FindPlayerPed();
|
||||
CPlayerPed* player = FindPlayerPed();
|
||||
int icomp = std::stoi(component);
|
||||
int hveh = CPools::GetVehicleRef(player->m_pVehicle);
|
||||
|
||||
CStreaming::RequestModel(icomp,eStreamingFlags::PRIORITY_REQUEST);
|
||||
CStreaming::RequestModel(icomp, eStreamingFlags::PRIORITY_REQUEST);
|
||||
CStreaming::LoadAllRequestedModels(true);
|
||||
player->m_pVehicle->AddVehicleUpgrade(icomp);
|
||||
CStreaming::SetModelIsDeletable(icomp);
|
||||
@ -240,7 +242,7 @@ void Vehicle::AddComponent(const std::string& component, const bool display_mess
|
||||
void Vehicle::RemoveComponent(const std::string& component, const bool display_message)
|
||||
{
|
||||
try {
|
||||
CPlayerPed *player = FindPlayerPed();
|
||||
CPlayerPed* player = FindPlayerPed();
|
||||
int icomp = std::stoi(component);
|
||||
int hveh = CPools::GetVehicleRef(player->m_pVehicle);
|
||||
|
||||
@ -267,23 +269,23 @@ int Vehicle::GetRandomTrainIdForModel(int model)
|
||||
|
||||
switch (model)
|
||||
{
|
||||
case 449:
|
||||
_start = 0;
|
||||
_end = 1;
|
||||
break;
|
||||
case 537:
|
||||
_start = 2;
|
||||
_end = 7;
|
||||
break;
|
||||
case 538:
|
||||
_start = 8;
|
||||
_end = 10;
|
||||
break;
|
||||
default:
|
||||
CHud::SetHelpMessage("Invalid train model", false, false, false);
|
||||
return -1;
|
||||
case 449:
|
||||
_start = 0;
|
||||
_end = 1;
|
||||
break;
|
||||
case 537:
|
||||
_start = 2;
|
||||
_end = 7;
|
||||
break;
|
||||
case 538:
|
||||
_start = 8;
|
||||
_end = 10;
|
||||
break;
|
||||
default:
|
||||
CHud::SetHelpMessage("Invalid train model", false, false, false);
|
||||
return -1;
|
||||
}
|
||||
int id = Random(_start,_end);
|
||||
int id = Random(_start, _end);
|
||||
return train_ids[id];
|
||||
}
|
||||
|
||||
@ -311,7 +313,7 @@ void Vehicle::ParseVehiclesIDE()
|
||||
getline(ss, temp, ',');
|
||||
|
||||
int model = std::stoi(temp);
|
||||
|
||||
|
||||
// modelname, txd, type, handlingId
|
||||
getline(ss, temp, ',');
|
||||
getline(ss, temp, ',');
|
||||
@ -406,11 +408,11 @@ void Vehicle::ParseCarcolsDAT()
|
||||
|
||||
getline(ss, temp, ',');
|
||||
std::string name = temp;
|
||||
while (getline(ss, temp, ','))
|
||||
while (getline(ss, temp, ','))
|
||||
{
|
||||
try
|
||||
{
|
||||
std::for_each(name.begin(), name.end(), [](char & c) {
|
||||
std::for_each(name.begin(), name.end(), [](char& c) {
|
||||
c = ::toupper(c);
|
||||
});
|
||||
|
||||
@ -431,16 +433,16 @@ void Vehicle::ParseCarcolsDAT()
|
||||
else flog << "Vehicle.ide file not found";
|
||||
}
|
||||
|
||||
void Vehicle::SpawnVehicle(std::string &smodel)
|
||||
void Vehicle::SpawnVehicle(std::string& smodel)
|
||||
{
|
||||
CPlayerPed *player = FindPlayerPed();
|
||||
CPlayerPed* player = FindPlayerPed();
|
||||
int hplayer = CPools::GetPedRef(player);
|
||||
|
||||
int imodel = std::stoi(smodel);
|
||||
CVehicle *veh = nullptr;
|
||||
CVehicle* veh = nullptr;
|
||||
|
||||
int interior = player->m_nAreaCode;
|
||||
|
||||
|
||||
if (Command<Commands::IS_MODEL_AVAILABLE>(imodel))
|
||||
{
|
||||
CVector pos = player->GetPosition();
|
||||
@ -450,7 +452,7 @@ void Vehicle::SpawnVehicle(std::string &smodel)
|
||||
{
|
||||
int hveh = 0;
|
||||
Command<Commands::GET_CAR_CHAR_IS_USING>(hplayer, &hveh);
|
||||
CVehicle *pveh = CPools::GetVehicle(hveh);
|
||||
CVehicle* pveh = CPools::GetVehicle(hveh);
|
||||
pos = pveh->GetPosition();
|
||||
|
||||
Command<Commands::GET_CAR_SPEED>(hveh, &speed);
|
||||
@ -466,10 +468,10 @@ void Vehicle::SpawnVehicle(std::string &smodel)
|
||||
if (interior == 0)
|
||||
if (spawner::spawn_in_air && (CModelInfo::IsHeliModel(imodel) || CModelInfo::IsPlaneModel(imodel)))
|
||||
pos.z = 400;
|
||||
else
|
||||
pos.z -= 5;
|
||||
else
|
||||
pos.z -= 5;
|
||||
|
||||
|
||||
|
||||
if (CModelInfo::IsTrainModel(imodel))
|
||||
{
|
||||
int train_id = GetRandomTrainIdForModel(imodel);
|
||||
@ -489,11 +491,11 @@ void Vehicle::SpawnVehicle(std::string &smodel)
|
||||
|
||||
CStreaming::LoadAllRequestedModels(false);
|
||||
|
||||
CTrain *train = nullptr;
|
||||
CTrain *carraige = nullptr;
|
||||
int track = Random(0,1);
|
||||
int node = CTrain::FindClosestTrackNode(pos,&track);
|
||||
CTrain::CreateMissionTrain(pos,(Random(0,1)) == 1 ? true : false,train_id,&train,&carraige,node,track,false);
|
||||
CTrain* train = nullptr;
|
||||
CTrain* carraige = nullptr;
|
||||
int track = Random(0, 1);
|
||||
int node = CTrain::FindClosestTrackNode(pos, &track);
|
||||
CTrain::CreateMissionTrain(pos, (Random(0, 1)) == 1 ? true : false, train_id, &train, &carraige, node, track, false);
|
||||
|
||||
veh = (CVehicle*)train;
|
||||
hveh = CPools::GetVehicleRef(veh);
|
||||
@ -532,12 +534,12 @@ void Vehicle::SpawnVehicle(std::string &smodel)
|
||||
Command<Commands::SET_CAR_FORWARD_SPEED>(hveh, speed);
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
player->TransformFromObjectSpace(pos, CVector(0, 10, 0));
|
||||
|
||||
Command<Commands::CREATE_CAR>(imodel, pos.x, pos.y, pos.z + 3.0f, &hveh);
|
||||
veh = CPools::GetVehicle(hveh);
|
||||
veh->SetHeading(player->GetHeading()+55.0f);
|
||||
veh->SetHeading(player->GetHeading() + 55.0f);
|
||||
}
|
||||
veh->m_nDoorLock = CARLOCK_UNLOCKED;
|
||||
veh->m_nAreaCode = interior;
|
||||
@ -550,7 +552,7 @@ void Vehicle::SpawnVehicle(std::string &smodel)
|
||||
|
||||
std::string Vehicle::GetNameFromModel(int model)
|
||||
{
|
||||
CBaseModelInfo *info = CModelInfo::GetModelInfo(model);
|
||||
CBaseModelInfo* info = CModelInfo::GetModelInfo(model);
|
||||
|
||||
return (const char*)info + 0x32;
|
||||
}
|
||||
@ -558,7 +560,7 @@ std::string Vehicle::GetNameFromModel(int model)
|
||||
int Vehicle::GetModelFromName(const char* name)
|
||||
{
|
||||
int model = 0;
|
||||
CBaseModelInfo* model_info = CModelInfo::GetModelInfo((char*)name,&model);
|
||||
CBaseModelInfo* model_info = CModelInfo::GetModelInfo((char*)name, &model);
|
||||
|
||||
if (model > 0 && model < 1000000 && GetNameFromModel(model) != "")
|
||||
return model;
|
||||
@ -573,7 +575,7 @@ Vehicle::~Vehicle()
|
||||
|
||||
void Vehicle::GenerateHandlingDataFile(int phandling)
|
||||
{
|
||||
FILE *fp = fopen("handling.txt", "w");
|
||||
FILE* fp = fopen("handling.txt", "w");
|
||||
|
||||
std::string handlingId = vehicle_ide[FindPlayerPed()->m_pVehicle->m_nModelIndex];
|
||||
float fMass = patch::Get<float>(phandling + 0x4);
|
||||
@ -604,7 +606,7 @@ void Vehicle::GenerateHandlingDataFile(int phandling)
|
||||
float fCollisionDamageMultiplier = patch::Get<float>(phandling + 0xC8) * 0.338;
|
||||
int nMonetaryValue = patch::Get<int>(phandling + 0xD8);
|
||||
|
||||
int MaxVelocity = patch::Get<float>(phandling + 0x84);
|
||||
int MaxVelocity = patch::Get<float>(phandling + 0x84);
|
||||
MaxVelocity = MaxVelocity * 206 + (MaxVelocity - 0.918668) * 1501;
|
||||
|
||||
int modelFlags = patch::Get<int>(phandling + 0xCC);
|
||||
@ -626,10 +628,10 @@ void Vehicle::GenerateHandlingDataFile(int phandling)
|
||||
}
|
||||
|
||||
|
||||
void Vehicle::Main()
|
||||
void Vehicle::Draw()
|
||||
{
|
||||
ImGui::Spacing();
|
||||
static CPlayerPed *player = FindPlayerPed();
|
||||
static CPlayerPed* player = FindPlayerPed();
|
||||
static int hplayer = CPools::GetPedRef(player);
|
||||
|
||||
if (ImGui::Button("Blow up cars", ImVec2(Ui::GetSize(3))))
|
||||
@ -667,9 +669,9 @@ void Vehicle::Main()
|
||||
|
||||
if (ImGui::BeginTabBar("Vehicle", ImGuiTabBarFlags_NoTooltip + ImGuiTabBarFlags_FittingPolicyScroll))
|
||||
{
|
||||
CVehicle *pVeh = player->m_pVehicle;
|
||||
CVehicle* pVeh = player->m_pVehicle;
|
||||
bool is_driver = pVeh && player->m_pVehicle->IsDriver(player);
|
||||
|
||||
|
||||
ImGui::Spacing();
|
||||
|
||||
if (ImGui::BeginTabItem("Checkboxes"))
|
||||
@ -699,7 +701,7 @@ void Vehicle::Main()
|
||||
}
|
||||
}
|
||||
Ui::CheckboxAddress("Decreased traffic", 0x96917A);
|
||||
|
||||
|
||||
ImGui::NextColumn();
|
||||
|
||||
Ui::CheckboxWithHint("Don't fall off bike", &dont_fall_bike);
|
||||
@ -747,7 +749,7 @@ void Vehicle::Main()
|
||||
{
|
||||
pVeh->m_nVehicleFlags.bEngineBroken = !state;
|
||||
pVeh->m_nVehicleFlags.bEngineOn = state;
|
||||
}
|
||||
}
|
||||
state = pVeh->m_nPhysicalFlags.bExplosionProof;
|
||||
if (Ui::CheckboxWithHint("Explosion proof", &state, nullptr, veh_nodmg))
|
||||
pVeh->m_nPhysicalFlags.bExplosionProof = state;
|
||||
@ -755,7 +757,7 @@ void Vehicle::Main()
|
||||
state = pVeh->m_nPhysicalFlags.bFireProof;
|
||||
if (Ui::CheckboxWithHint("Fire proof", &state, nullptr, veh_nodmg))
|
||||
pVeh->m_nPhysicalFlags.bFireProof = state;
|
||||
|
||||
|
||||
ImGui::NextColumn();
|
||||
|
||||
state = pVeh->m_nVehicleFlags.bVehicleCanBeTargettedByHS;
|
||||
@ -787,14 +789,14 @@ void Vehicle::Main()
|
||||
if (Ui::CheckboxWithHint("Petrol tank blow", &state, "Vehicle will blow up if petrol tank is shot"))
|
||||
pVeh->m_nVehicleFlags.bPetrolTankIsWeakPoint = state;
|
||||
|
||||
state = pVeh->m_nVehicleFlags.bSirenOrAlarm;
|
||||
state = pVeh->m_nVehicleFlags.bSirenOrAlarm;
|
||||
if (Ui::CheckboxWithHint("Siren", &state))
|
||||
pVeh->m_nVehicleFlags.bSirenOrAlarm = state;
|
||||
|
||||
state = pVeh->m_nVehicleFlags.bTakeLessDamage;
|
||||
if (Ui::CheckboxWithHint("Take less dmg", &state, nullptr))
|
||||
pVeh->m_nVehicleFlags.bTakeLessDamage = state;
|
||||
|
||||
|
||||
ImGui::Columns(1);
|
||||
}
|
||||
|
||||
@ -808,9 +810,9 @@ void Vehicle::Main()
|
||||
Ui::EditFloat("Density multiplier", 0x8A5B20, 0, 1, 10);
|
||||
if (ImGui::CollapsingHeader("Enter nearest vehicle as"))
|
||||
{
|
||||
CPlayerPed *player = FindPlayerPed();
|
||||
CPlayerPed* player = FindPlayerPed();
|
||||
int hplayer = CPools::GetPedRef(player);
|
||||
CVehicle *veh = Util::GetClosestVehicle();
|
||||
CVehicle* veh = Util::GetClosestVehicle();
|
||||
|
||||
if (veh)
|
||||
{
|
||||
@ -832,7 +834,7 @@ void Vehicle::Main()
|
||||
{
|
||||
if (i % 2 != 1)
|
||||
ImGui::SameLine();
|
||||
|
||||
|
||||
if (ImGui::Button((std::string("Passenger ") + std::to_string(i + 1)).c_str(), ImVec2(Ui::GetSize(2))))
|
||||
Command<Commands::WARP_CHAR_INTO_CAR_AS_PASSENGER>(hplayer, veh, i);
|
||||
}
|
||||
@ -847,12 +849,12 @@ void Vehicle::Main()
|
||||
{
|
||||
ImGui::InputInt("Radius", &veh_remove_radius);
|
||||
ImGui::Spacing();
|
||||
if (ImGui::Button("Remove vehicles",Ui::GetSize(1)))
|
||||
if (ImGui::Button("Remove vehicles", Ui::GetSize(1)))
|
||||
{
|
||||
CPlayerPed *player = FindPlayerPed();
|
||||
for (CVehicle *veh : CPools::ms_pVehiclePool)
|
||||
CPlayerPed* player = FindPlayerPed();
|
||||
for (CVehicle* veh : CPools::ms_pVehiclePool)
|
||||
{
|
||||
if (DistanceBetweenPoints(veh->GetPosition(),player->GetPosition()) < veh_remove_radius
|
||||
if (DistanceBetweenPoints(veh->GetPosition(), player->GetPosition()) < veh_remove_radius
|
||||
&& player->m_pVehicle != veh)
|
||||
Command<Commands::DELETE_CAR>(CPools::GetVehicleRef(veh));
|
||||
}
|
||||
@ -874,7 +876,7 @@ void Vehicle::Main()
|
||||
|
||||
if (player && player->m_pVehicle)
|
||||
{
|
||||
CVehicle *veh = player->m_pVehicle;
|
||||
CVehicle* veh = player->m_pVehicle;
|
||||
int hveh = CPools::GetVehicleRef(veh);
|
||||
|
||||
Ui::EditFloat("Dirt level", (int)veh + 0x4B0, 0, 7.5, 15);
|
||||
@ -899,20 +901,20 @@ void Vehicle::Main()
|
||||
{
|
||||
switch (door_menu_button)
|
||||
{
|
||||
case 0:
|
||||
Command<Commands::DAMAGE_CAR_DOOR>(hveh, i);
|
||||
break;
|
||||
case 1:
|
||||
Command<Commands::FIX_CAR_DOOR>(hveh, i);
|
||||
break;
|
||||
case 2:
|
||||
Command<Commands::OPEN_CAR_DOOR>(hveh, i);
|
||||
break;
|
||||
case 3:
|
||||
Command<Commands::POP_CAR_DOOR>(hveh, i);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case 0:
|
||||
Command<Commands::DAMAGE_CAR_DOOR>(hveh, i);
|
||||
break;
|
||||
case 1:
|
||||
Command<Commands::FIX_CAR_DOOR>(hveh, i);
|
||||
break;
|
||||
case 2:
|
||||
Command<Commands::OPEN_CAR_DOOR>(hveh, i);
|
||||
break;
|
||||
case 3:
|
||||
Command<Commands::POP_CAR_DOOR>(hveh, i);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -923,20 +925,20 @@ void Vehicle::Main()
|
||||
{
|
||||
switch (door_menu_button)
|
||||
{
|
||||
case 0:
|
||||
Command<Commands::DAMAGE_CAR_DOOR>(hveh, i);
|
||||
break;
|
||||
case 1:
|
||||
Command<Commands::FIX_CAR_DOOR>(hveh, i);
|
||||
break;
|
||||
case 2:
|
||||
Command<Commands::OPEN_CAR_DOOR>(hveh, i);
|
||||
break;
|
||||
case 3:
|
||||
Command<Commands::POP_CAR_DOOR>(hveh, i);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case 0:
|
||||
Command<Commands::DAMAGE_CAR_DOOR>(hveh, i);
|
||||
break;
|
||||
case 1:
|
||||
Command<Commands::FIX_CAR_DOOR>(hveh, i);
|
||||
break;
|
||||
case 2:
|
||||
Command<Commands::OPEN_CAR_DOOR>(hveh, i);
|
||||
break;
|
||||
case 3:
|
||||
Command<Commands::POP_CAR_DOOR>(hveh, i);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -978,7 +980,7 @@ void Vehicle::Main()
|
||||
ImGui::NextColumn();
|
||||
Ui::CheckboxWithHint("Spawn aircraft in air", &spawner::spawn_in_air);
|
||||
ImGui::Columns(1);
|
||||
|
||||
|
||||
|
||||
ImGui::Spacing();
|
||||
ImGui::SetNextItemWidth(ImGui::GetWindowContentRegionWidth() - 2.5);
|
||||
@ -994,7 +996,7 @@ void Vehicle::Main()
|
||||
}
|
||||
if (player->m_pVehicle && player->m_nPedFlags.bInVehicle)
|
||||
{
|
||||
CVehicle *veh = FindPlayerPed()->m_pVehicle;
|
||||
CVehicle* veh = FindPlayerPed()->m_pVehicle;
|
||||
int hveh = CPools::GetVehicleRef(veh);
|
||||
if (ImGui::BeginTabItem("Color"))
|
||||
{
|
||||
@ -1036,15 +1038,15 @@ void Vehicle::Main()
|
||||
|
||||
ImVec2 size = Ui::GetSize();
|
||||
int btns_in_row = ImGui::GetWindowContentRegionWidth() / (size.y * 2);
|
||||
int btn_size = (ImGui::GetWindowContentRegionWidth() - int(ImGuiStyleVar_ItemSpacing)*(btns_in_row - 0.6*btns_in_row)) / btns_in_row;
|
||||
int btn_size = (ImGui::GetWindowContentRegionWidth() - int(ImGuiStyleVar_ItemSpacing) * (btns_in_row - 0.6 * btns_in_row)) / btns_in_row;
|
||||
|
||||
ImGui::BeginChild("Colorss");
|
||||
|
||||
if (color::show_all)
|
||||
for (int color_id = 0; color_id < count; ++color_id)
|
||||
{
|
||||
if (Ui::ColorButton(color_id, carcols_color_values[color_id], ImVec2(btn_size,btn_size)))
|
||||
*(uint8_replacement *)(int(veh) + 0x433 + color::radio_btn) = color_id;
|
||||
if (Ui::ColorButton(color_id, carcols_color_values[color_id], ImVec2(btn_size, btn_size)))
|
||||
*(uint8_replacement*)(int(veh) + 0x433 + color::radio_btn) = color_id;
|
||||
|
||||
if ((color_id + 1) % btns_in_row != 0)
|
||||
ImGui::SameLine(0.0, 4.0);
|
||||
@ -1060,13 +1062,13 @@ void Vehicle::Main()
|
||||
for (int color_id : entry.second)
|
||||
{
|
||||
if (Ui::ColorButton(color_id, carcols_color_values[color_id], ImVec2(btn_size, btn_size)))
|
||||
*(uint8_replacement *)(int(veh) + 0x433 + color::radio_btn) = color_id;
|
||||
*(uint8_replacement*)(int(veh) + 0x433 + color::radio_btn) = color_id;
|
||||
|
||||
if (count % btns_in_row != 0)
|
||||
ImGui::SameLine(0.0, 4.0);
|
||||
++count;
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1086,17 +1088,17 @@ void Vehicle::Main()
|
||||
|
||||
ImGui::Spacing();
|
||||
ImGui::Columns(2, NULL, false);
|
||||
|
||||
|
||||
bool pulsing = IsPulsingEnabled(veh);
|
||||
if (Ui::CheckboxWithHint("Pulsing neons", &pulsing))
|
||||
SetPulsing(veh,pulsing);
|
||||
SetPulsing(veh, pulsing);
|
||||
|
||||
Ui::CheckboxWithHint("Rainbow neons", &neon::rainbow, "Rainbow effect to neon lights");
|
||||
ImGui::NextColumn();
|
||||
Ui::CheckboxWithHint("Traffic neons", &neon::traffic, "Adds neon lights to traffic vehicles.\n\
|
||||
Only some vehicles will have them.");
|
||||
ImGui::Columns(1);
|
||||
|
||||
|
||||
ImGui::Spacing();
|
||||
|
||||
if (ImGui::ColorEdit3("Color picker", neon::color_picker))
|
||||
@ -1108,7 +1110,7 @@ Only some vehicles will have them.");
|
||||
int count = (int)carcols_color_values.size();
|
||||
ImVec2 size = Ui::GetSize();
|
||||
int btns_in_row = ImGui::GetWindowContentRegionWidth() / (size.y * 2);
|
||||
int btn_size = (ImGui::GetWindowContentRegionWidth() - int(ImGuiStyleVar_ItemSpacing)*(btns_in_row - 0.6*btns_in_row)) / btns_in_row;
|
||||
int btn_size = (ImGui::GetWindowContentRegionWidth() - int(ImGuiStyleVar_ItemSpacing) * (btns_in_row - 0.6 * btns_in_row)) / btns_in_row;
|
||||
|
||||
ImGui::BeginChild("Neonss");
|
||||
|
||||
@ -1116,8 +1118,8 @@ Only some vehicles will have them.");
|
||||
{
|
||||
if (Ui::ColorButton(color_id, carcols_color_values[color_id], ImVec2(btn_size, btn_size)))
|
||||
{
|
||||
std::vector<float> &color = carcols_color_values[color_id];
|
||||
InstallNeon(veh, color[0]*255, color[1]*255, color[2]*255);
|
||||
std::vector<float>& color = carcols_color_values[color_id];
|
||||
InstallNeon(veh, color[0] * 255, color[1] * 255, color[2] * 255);
|
||||
}
|
||||
|
||||
if ((color_id + 1) % btns_in_row != 0)
|
||||
@ -1154,39 +1156,39 @@ Only some vehicles will have them.");
|
||||
if (curpjob > maxpjob)
|
||||
curpjob = -1;
|
||||
if (curpjob < -1)
|
||||
curpjob = maxpjob-1;
|
||||
curpjob = maxpjob - 1;
|
||||
|
||||
Command<Commands::GIVE_VEHICLE_PAINTJOB>(hveh, curpjob);
|
||||
}
|
||||
|
||||
ImGui::Spacing();
|
||||
}
|
||||
|
||||
|
||||
ImGui::Spacing();
|
||||
ImGui::SameLine();
|
||||
ImGui::Checkbox("Material filter", &color::material_filter);
|
||||
ImGui::Spacing();
|
||||
Ui::DrawImages(texture9::image_vec, ImVec2(100, 80), texture9::search_categories, texture9::selected_item, texture9::filter,
|
||||
[](std::string& str)
|
||||
[](std::string& str)
|
||||
{
|
||||
Paint::SetNodeTexture(FindPlayerPed()->m_pVehicle, Paint::veh_nodes::selected, str, color::material_filter);
|
||||
},
|
||||
nullptr,
|
||||
[](std::string& str) {return str;
|
||||
});
|
||||
[](std::string& str) {return str;
|
||||
});
|
||||
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
if (ImGui::BeginTabItem("Tune"))
|
||||
{
|
||||
ImGui::Spacing();
|
||||
Ui::DrawImages(tune::image_vec, ImVec2(100, 80), tune::search_categories, tune::selected_item, tune::filter,
|
||||
Ui::DrawImages(tune::image_vec, ImVec2(100, 80), tune::search_categories, tune::selected_item, tune::filter,
|
||||
[](std::string& str) {AddComponent(str);},
|
||||
[](std::string& str) {RemoveComponent(str); },
|
||||
[](std::string& str){return str;},
|
||||
[](std::string& str) {return str;},
|
||||
[](std::string& str)
|
||||
{
|
||||
return ((bool(*)(int,CVehicle*))0x49B010)(std::stoi(str), player->m_pVehicle);
|
||||
return ((bool(*)(int, CVehicle*))0x49B010)(std::stoi(str), player->m_pVehicle);
|
||||
}
|
||||
);
|
||||
|
||||
@ -1195,9 +1197,9 @@ Only some vehicles will have them.");
|
||||
if (ImGui::BeginTabItem("Handling"))
|
||||
{
|
||||
ImGui::Spacing();
|
||||
|
||||
CBaseModelInfo *info = CModelInfo::GetModelInfo(player->m_pVehicle->m_nModelIndex);
|
||||
int phandling = patch::Get<WORD>((int)info+0x4A,false);
|
||||
|
||||
CBaseModelInfo* info = CModelInfo::GetModelInfo(player->m_pVehicle->m_nModelIndex);
|
||||
int phandling = patch::Get<WORD>((int)info + 0x4A, false);
|
||||
phandling *= 0xE0;
|
||||
phandling += 0xC2B9DC;
|
||||
|
||||
@ -1221,32 +1223,32 @@ Only some vehicles will have them.");
|
||||
ShellExecute(NULL, "open", "https://projectcerbera.com/gta/sa/tutorials/handling", NULL, NULL, SW_SHOWNORMAL);
|
||||
|
||||
ImGui::Spacing();
|
||||
|
||||
|
||||
ImGui::BeginChild("HandlingChild");
|
||||
|
||||
static std::vector<Ui::NamedValue> abs{{ "On", 1 }, { "Off", 0 }};
|
||||
static std::vector<Ui::NamedValue> abs{ { "On", 1 }, { "Off", 0 } };
|
||||
Ui::EditRadioButtonAddressEx("Abs", phandling + 0x9C, abs);
|
||||
|
||||
Ui::EditFloat("Anti dive multiplier", phandling + 0xC4, 0.0f, 0.0f, 1.0f);
|
||||
Ui::EditFloat("Brake bias", phandling + 0x98, 0.0f, 0.0f, 1.0f);
|
||||
Ui::EditFloat("Brake deceleration", phandling + 0x94, 0.0f, 0.0f, 20.0f, 2500.0f);
|
||||
Ui::EditFloat("Centre of mass X", phandling + 0x14,-10.0f,-10.0f, 10.0f);
|
||||
Ui::EditFloat("Centre of mass Y", phandling + 0x18,-10.0f,-10.0f, 10.0f);
|
||||
Ui::EditFloat("Centre of mass Z", phandling + 0x1C,-10.0f,-10.0f, 10.0f);
|
||||
Ui::EditFloat("Centre of mass X", phandling + 0x14, -10.0f, -10.0f, 10.0f);
|
||||
Ui::EditFloat("Centre of mass Y", phandling + 0x18, -10.0f, -10.0f, 10.0f);
|
||||
Ui::EditFloat("Centre of mass Z", phandling + 0x1C, -10.0f, -10.0f, 10.0f);
|
||||
Ui::EditFloat("Collision damage multiplier", phandling + 0xC8, 0.0f, 0.0f, 1.0f, 0.3381f);
|
||||
Ui::EditFloat("Damping level", phandling + 0xB0, -10.0f, -10.0f, 10.0f); // test later
|
||||
Ui::EditFloat("Drag mult", phandling + 0x10, 0.0f, 0.0f, 30.0f);
|
||||
|
||||
static std::vector<Ui::NamedValue> drive_type{ { "Front wheel drive", 70 }, { "Rear wheel drive", 82 }, { "Four wheel drive", 52 }};
|
||||
static std::vector<Ui::NamedValue> drive_type{ { "Front wheel drive", 70 }, { "Rear wheel drive", 82 }, { "Four wheel drive", 52 } };
|
||||
Ui::EditRadioButtonAddressEx("Drive type", phandling + 0x74, drive_type);
|
||||
|
||||
Ui::EditFloat("Engine acceleration", phandling + 0x7C, 0.0f, 0.0f, 49.0f, 12500.0f);
|
||||
Ui::EditFloat("Engine inertia", phandling + 0x80, 0.0f, 0.0f, 400.0f);
|
||||
|
||||
static std::vector<Ui::NamedValue> engine_type{ { "Petrol", 80 }, { "Diseal", 68 }, { "Electric", 69 }};
|
||||
static std::vector<Ui::NamedValue> engine_type{ { "Petrol", 80 }, { "Diseal", 68 }, { "Electric", 69 } };
|
||||
Ui::EditRadioButtonAddressEx("Engine type", phandling + 0x75, engine_type);
|
||||
|
||||
std::vector<Ui::NamedValue> front_lights{ { "Long", 0 }, { "Small", 1 }, { "Big", 2 }, { "Tall", 3 }};
|
||||
std::vector<Ui::NamedValue> front_lights{ { "Long", 0 }, { "Small", 1 }, { "Big", 2 }, { "Tall", 3 } };
|
||||
Ui::EditRadioButtonAddressEx("Front lights", phandling + 0xDC, front_lights);
|
||||
|
||||
Ui::EditFloat("Force level", phandling + 0xAC, -10.0f, -10.0f, 10.0f); // test later
|
||||
@ -1265,7 +1267,7 @@ Only some vehicles will have them.");
|
||||
Ui::EditAddress<BYTE>("Number of gears", phandling + 0x76, 1, 1, 10);
|
||||
Ui::EditAddress<BYTE>("Percent submerged", phandling + 0x20, 10, 10, 120);
|
||||
|
||||
static std::vector<Ui::NamedValue> rear_lights{ { "Long", 0 }, { "Small", 1 }, { "Big", 2 }, { "Tall", 3 }};
|
||||
static std::vector<Ui::NamedValue> rear_lights{ { "Long", 0 }, { "Small", 1 }, { "Big", 2 }, { "Tall", 3 } };
|
||||
Ui::EditRadioButtonAddressEx("Rear lights", phandling + 0xDD, rear_lights);
|
||||
|
||||
Ui::EditFloat("Seat offset distance", phandling + 0xD4, 0.0f, 0.0f, 1.0f);
|
||||
@ -1279,7 +1281,7 @@ Only some vehicles will have them.");
|
||||
Ui::EditAddress<BYTE>("Vehicle anim group", phandling + 0xDE, 0, 0, 20);
|
||||
|
||||
ImGui::EndChild();
|
||||
|
||||
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ private:
|
||||
static uint traffic_timer;
|
||||
};
|
||||
|
||||
struct spawner
|
||||
struct spawner
|
||||
{
|
||||
static ImGuiTextFilter filter;
|
||||
static std::string selected_item;
|
||||
@ -56,6 +56,7 @@ private:
|
||||
static std::vector<std::string> search_categories;
|
||||
static std::vector<std::unique_ptr<TextureStructure>> image_vec;
|
||||
};
|
||||
static bool images_loaded;
|
||||
|
||||
struct tune
|
||||
{
|
||||
@ -75,13 +76,13 @@ public:
|
||||
static void RemoveComponent(const std::string& component, const bool display_message = true);
|
||||
static std::string GetNameFromModel(int model);
|
||||
static int GetModelFromName(const char* name);
|
||||
static void SpawnVehicle(std::string &name);
|
||||
static void SpawnVehicle(std::string& name);
|
||||
static int GetRandomTrainIdForModel(int model);
|
||||
static void ParseVehiclesIDE();
|
||||
static void ParseCarcolsDAT();
|
||||
static void GenerateHandlingDataFile(int phandling);
|
||||
Vehicle();
|
||||
~Vehicle();
|
||||
static void Main();
|
||||
static void Draw();
|
||||
};
|
||||
|
||||
|
@ -28,15 +28,12 @@ static bool init_patches = false;
|
||||
|
||||
Visual::Visual()
|
||||
{
|
||||
Events::initGameEvent += []
|
||||
{
|
||||
if (LoadLibraryW(L"timecycle24.asi"))
|
||||
timecyc_hour = 24;
|
||||
};
|
||||
if (GetModuleHandle("timecycle24.asi"))
|
||||
timecyc_hour = 24;
|
||||
|
||||
Events::processScriptsEvent += []
|
||||
{
|
||||
// Improve this later
|
||||
// TODO: Needs improvement
|
||||
if (lock_weather)
|
||||
{
|
||||
CWeather::OldWeatherType = weather_type_backup;
|
||||
@ -190,7 +187,7 @@ void Visual::GenerateTimecycFile()
|
||||
}
|
||||
}
|
||||
|
||||
void Visual::Main()
|
||||
void Visual::Draw()
|
||||
{
|
||||
if (ImGui::BeginTabBar("Visual", ImGuiTabBarFlags_NoTooltip + ImGuiTabBarFlags_FittingPolicyScroll))
|
||||
{
|
||||
@ -271,7 +268,7 @@ void Visual::Main()
|
||||
|
||||
Ui::ColorPickerAddress("Armour bar", *(int*)0x5890FC, ImVec4(180,25,29,255));
|
||||
Ui::ColorPickerAddress("Health bar", *(int*)0x589331, ImVec4(180,25,29,255));
|
||||
Ui::ColorPickerAddress("Main menu title border color", 0xBAB240, ImVec4(0,0,0,255));
|
||||
Ui::ColorPickerAddress("Draw menu title border color", 0xBAB240, ImVec4(0,0,0,255));
|
||||
Ui::ColorPickerAddress("Money color", 0xBAB230, ImVec4(54,104,44,255));
|
||||
static std::vector<Ui::NamedValue> font_outline{{ "No outline", 0 }, { "Thin outline" ,1 }, { "Default outline" ,2 }};
|
||||
Ui::EditRadioButtonAddressEx("Money font outline", 0x58F58D, font_outline);
|
||||
|
@ -11,21 +11,21 @@ private:
|
||||
|
||||
static void GenerateTimecycFile();
|
||||
static int GetCurrentHourTimeId();
|
||||
static bool TimeCycColorEdit3(const char* label, uchar *r, uchar *g, uchar *b, ImGuiColorEditFlags flags = 0);
|
||||
static bool TimeCycColorEdit4(const char* label, uchar *r, uchar *g, uchar *b, uchar *a, ImGuiColorEditFlags flags = 0);
|
||||
static bool TimeCycColorEdit3(const char* label, uchar* r, uchar* g, uchar* b, ImGuiColorEditFlags flags = 0);
|
||||
static bool TimeCycColorEdit4(const char* label, uchar* r, uchar* g, uchar* b, uchar* a, ImGuiColorEditFlags flags = 0);
|
||||
template<typename T>
|
||||
static void TimecycSlider(const char* label, T* data, int min, int max);
|
||||
public:
|
||||
Visual();
|
||||
~Visual();
|
||||
static void Main();
|
||||
static void Draw();
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
void Visual::TimecycSlider(const char* label, T* ptr, int min, int max)
|
||||
{
|
||||
int val = 23 * GetCurrentHourTimeId() + CWeather::OldWeatherType;
|
||||
T *arr = (T*)patch::GetPointer(int(ptr));
|
||||
T* arr = (T*)patch::GetPointer(int(ptr));
|
||||
int a = arr[val];
|
||||
|
||||
if (ImGui::SliderInt(label, &a, min, max))
|
||||
|
@ -7,6 +7,7 @@ ImGuiTextFilter Weapon::filter = "";
|
||||
std::string Weapon::selected_item = "All";
|
||||
std::vector<std::string> Weapon::search_categories;
|
||||
std::vector<std::unique_ptr<TextureStructure>> Weapon::weapon_vec;
|
||||
bool Weapon::images_loaded = false;
|
||||
|
||||
CJson Weapon::weapon_json = CJson("weapon");
|
||||
bool Weapon::auto_aim = false;
|
||||
@ -40,13 +41,14 @@ int Weapon::gang_weapons[10][3] =
|
||||
|
||||
Weapon::Weapon()
|
||||
{
|
||||
Events::initGameEvent += []
|
||||
{
|
||||
Util::LoadTexturesInDirRecursive(PLUGIN_PATH((char*)"CheatMenu\\weapons\\"), ".jpg", Weapon::search_categories, Weapon::weapon_vec);
|
||||
};
|
||||
|
||||
Events::processScriptsEvent += []
|
||||
{
|
||||
if (!images_loaded)
|
||||
{
|
||||
Util::LoadTexturesInDirRecursive(PLUGIN_PATH((char*)"CheatMenu\\weapons\\"), ".jpg", Weapon::search_categories, Weapon::weapon_vec);
|
||||
images_loaded = true;
|
||||
}
|
||||
|
||||
CPlayerPed *player = FindPlayerPed();
|
||||
if (auto_aim)
|
||||
{
|
||||
@ -134,7 +136,7 @@ void Weapon::GiveWeaponToPlayer(std::string& weapon_type)
|
||||
}
|
||||
}
|
||||
|
||||
void Weapon::Main()
|
||||
void Weapon::Draw()
|
||||
{
|
||||
CPlayerPed *player = FindPlayerPed();
|
||||
uint hplayer = CPools::GetPedRef(player);
|
||||
|
@ -7,9 +7,10 @@ private:
|
||||
static std::string selected_item;
|
||||
static std::vector<std::string> search_categories;
|
||||
static std::vector<std::unique_ptr<TextureStructure>> weapon_vec;
|
||||
|
||||
static CJson weapon_json;
|
||||
static bool images_loaded;
|
||||
|
||||
static CJson weapon_json;
|
||||
|
||||
static bool auto_aim;
|
||||
static bool fast_reload;
|
||||
static bool huge_damage;
|
||||
@ -32,7 +33,7 @@ public:
|
||||
Weapon();
|
||||
~Weapon();
|
||||
|
||||
static void Main();
|
||||
static void Draw();
|
||||
static void GiveWeaponToPlayer(std::string& weapon_type);
|
||||
static void SetGangWeapon(std::string& weapon_type);
|
||||
};
|
||||
|
@ -1,12 +1,13 @@
|
||||
#include "pch.h"
|
||||
|
||||
std::string Globals::header_id = "";
|
||||
ImVec2 Globals::menu_size = ImVec2(screen::GetScreenWidth()/4, screen::GetScreenHeight()/1.2);
|
||||
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;
|
||||
void* Globals::device = nullptr;
|
||||
bool Globals::game_init = false;
|
||||
|
||||
std::ofstream flog = std::ofstream("CheatMenu.log");
|
||||
CJson config = CJson("config");
|
||||
|
@ -56,7 +56,6 @@
|
||||
#include "imgui/imgui_internal.h"
|
||||
#include "imgui/imgui_impl_dx9.h"
|
||||
#include "imgui/imgui_impl_dx11.h"
|
||||
// #include "imgui/imgui_impl_vulkan.h"
|
||||
#include "imgui/imgui_impl_win32.h"
|
||||
|
||||
#include "Events.h"
|
||||
@ -86,6 +85,7 @@ struct Globals
|
||||
static ImVec2 screen_size;
|
||||
static bool show_menu;
|
||||
static bool init_done;
|
||||
static bool game_init;
|
||||
static Renderer renderer;
|
||||
static void* device;
|
||||
};
|
||||
@ -94,7 +94,7 @@ struct TextureStructure
|
||||
{
|
||||
std::string file_name;
|
||||
std::string category_name;
|
||||
void *texture = nullptr;
|
||||
void* texture = nullptr;
|
||||
};
|
||||
|
||||
struct HotKeyData
|
||||
|
Loading…
Reference in New Issue
Block a user