diff --git a/.gitignore b/.gitignore index 5d12dbd..43c42d1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ # Added by kelson8 Main - Copy.cpp old/** +asm/ # ---> C++ # Prerequisites diff --git a/KCNet-ImGui-Test.vcxproj b/KCNet-ImGui-Test.vcxproj index f5cbdea..5b035f6 100644 --- a/KCNet-ImGui-Test.vcxproj +++ b/KCNet-ImGui-Test.vcxproj @@ -180,8 +180,8 @@ _DEBUG;_CONSOLE;_OPENGL;%(PreprocessorDefinitions) true stdcpplatest - lib\imgui\;lib\imgui\backends;include\;.\src;%(AdditionalIncludeDirectories) - stdc17 + lib\imgui\;lib\imgui\backends;include\;.\src;.\src\util;.\src\functions;.\src\menus;.\src\test;%(AdditionalIncludeDirectories) + stdclatest AssemblyCode $(SolutionDir)asm\ diff --git a/src/menus/main_menu.cpp b/src/menus/main_menu.cpp index 58624f1..ca000cd 100644 --- a/src/menus/main_menu.cpp +++ b/src/menus/main_menu.cpp @@ -37,6 +37,8 @@ // Boolean values // DirectX9Test +// TODO Make this file compatible with DirectX9 and OpenGL. +#ifdef _DIRECTX9 bool DirectX9Test::show_demo_window = false; bool DirectX9Test::button1_clicked = false; bool DirectX9Test::show_app_main_menu_bar = false; @@ -415,3 +417,4 @@ void MainMenu::MainMenuTest() { //} } +#endif \ No newline at end of file diff --git a/src/menus/vice_city_menu.cpp b/src/menus/vice_city_menu.cpp index c081814..1433a9f 100644 --- a/src/menus/vice_city_menu.cpp +++ b/src/menus/vice_city_menu.cpp @@ -22,8 +22,16 @@ bool showMainMenuBar = false; bool pedsEnabled = true; bool vehiclesEnabled = true; +bool neverWanted = false; +// Vehicle +bool infiniteHealth = false; +bool highVehicleMass = false; +bool vehicleInvincible = false; + int vehicleMin = 130; +// Test for code in here. +int wantedLevel = 0; enum Vehicles { Rhino = 0, @@ -31,6 +39,95 @@ enum Vehicles { Infernus = 2 }; +/// +/// Toggle infinite health, moved out of main menu +/// and refactored the checkbox to be under an if statement. +/// +void +toggleInfiniteHealth() +{ + if (infiniteHealth) { + std::cout << "Infinite health enabled" << std::endl; + } + else { + std::cout << "Infinite health disabled" << std::endl; + } +} + +void +toggleVehicleInvincible() +{ + //CPlayerPed* pPed = FindPlayerPed(); + //VehicleFunctions vehicleFunctions = VehicleFunctions(); + + //if (vehicleFunctions.IsPlayerInVehicle()) { + //CVehicle* currentVeh = pPed->m_pMyVehicle; + + if (vehicleInvincible) { + std::cout << "Vehicle invincibility enabled" << std::endl; + //VehicleCheats::EnableVehicleInvincibility(currentVeh); + } + else { + std::cout << "Vehicle invincibility disabled" << std::endl; + //VehicleCheats::DisableVehicleInvincibility(currentVeh); + } + + //} + +} + +/// +/// Well, I created a bug with the high mass. I made a fun effect +/// TODO Figure out how to reset this back to default +/// TODO Figure out how to get these values from lua... Use my lua_test.cpp +/// This is fun, although it does crash after a minute since I can't turn it off. +/// +void +toggleHighVehicleMass() +{ + // This makes the vehicle super strong + float vehicleMass = 30000.0f; + + // Well I created the spinny effect but sadly it crashes after a minute. + // This creates the spinny effect like from the reddit post I saw. + float vehicleTurnMass = 4.0f; + + //VehicleFunctions vehicleFunctions = VehicleFunctions(); + + //if (vehicleFunctions.IsPlayerInVehicle()) { + //CVehicle* currentVeh = pPed->m_pMyVehicle; + + if (highVehicleMass) + { + std::cout << "Vehicle mass set to " << vehicleMass << std::endl; + std::cout << "Vehicle turn mass set to " << vehicleTurnMass << std::endl; + + //currentVeh->m_fMass = 10000000.0f; + //currentVeh->m_fMass = 10000.0f; + + + // This makes the vehicle super strong + //currentVeh->m_fMass = vehicleMass; + + // Spinny effect + //currentVeh->m_fTurnMass = vehicleTurnMass; + } + + //} + +} + +void toggleNeverWanted() +{ + //neverWanted = !neverWanted; + if (neverWanted) { + std::cout << "Never wanted enabled" << std::endl; + } + else { + std::cout << "Never wanted disabled" << std::endl; + } +} + void VC::Menus::MainMenu() { @@ -56,6 +153,12 @@ void VC::Menus::MainMenu() //PlayerCheats::SuicideCheat(); } + if (ImGui::Checkbox("Infinite health", &infiniteHealth)) { + toggleInfiniteHealth(); + } + + + // TODO Come up with a solution for this. // Possibly use ImGui::ListBox, need to test it some more and mess around with it. //ImGui::Text("Warps"); @@ -120,10 +223,33 @@ void VC::Menus::MainMenu() ImGui::EndListBox(); } } + + // ReVC specific functions that I have created. + if (ImGui::Button("Spawn Vehicle")) { + if (spawnInCar) { + std::cout << "Cheetah spawned, removed old vehicle and warped player into it." << std::endl; + //VehicleFunctions::SpawnVehicle(VehicleModels::CHEETAH, true, true); + + } + else { + std::cout << "Cheetah spawned." << std::endl; + //VehicleFunctions::SpawnVehicle(VehicleModels::CHEETAH, false, false); + } + } + + if (ImGui::Checkbox("Toggle high mass", &highVehicleMass)) { + toggleHighVehicleMass(); + } + + if (ImGui::Checkbox("Toggle invincibility", &vehicleInvincible)) { + toggleVehicleInvincible(); + } + + // - // Moved to above + // Moved to above, this is the original function //if (showVehicleListBox) //{ // ImGui::ListBox("Vehicles", ¤tItem, vehicles, 3); @@ -151,6 +277,43 @@ void VC::Menus::MainMenu() std::cout << "Weapon set 3 given" << std::endl; } + + // Police cheats + ImGui::Text("Police"); + + if (ImGui::Button("Raise Wanted Level")) { + //PlayerCheats::RaiseWantedLevel(); + if (wantedLevel < 1 || wantedLevel > 6) { + std::cout << "Error, wanted level cannot be less then 1 or more then 6" << std::endl; + } + else { + wantedLevel++; + std::cout << "Wanted level raised by 1, new wanted level: " << wantedLevel << std::endl; + } + + std::cout << "Wanted level raised by 1, new wanted level: " << wantedLevel << std::endl; + } + + if (ImGui::Button("Lower Wanted Level")) { + //PlayerCheats::LowerWantedLevel(); + if (wantedLevel < 1 || wantedLevel > 6) { + std::cout << "Error, wanted level cannot be less then 1 or more then 6" << std::endl; + } + else { + wantedLevel--; + std::cout << "Wanted level lowered by 1, new wanted level: " << wantedLevel << std::endl; + } + + + } + + //ImGui::Checkbox("Never wanted", &neverWanted); + if (ImGui::Checkbox("Never wanted", &neverWanted)) { + toggleNeverWanted(); + } + + + // // These two below mimic the change that happens in ReVC with my ImGui menu. if (ImGui::Button("Toggle peds")) { pedsEnabled = !pedsEnabled; diff --git a/src/test/defines.h b/src/test/defines.h index fe59347..95a74be 100644 --- a/src/test/defines.h +++ b/src/test/defines.h @@ -5,6 +5,7 @@ #endif // +// TODO Fix this to work in the OpenGL test #ifdef _WIN32 class Defines { private: diff --git a/src/test/directx9_test.cpp b/src/test/directx9_test.cpp index d79fca3..d1738d7 100644 --- a/src/test/directx9_test.cpp +++ b/src/test/directx9_test.cpp @@ -19,6 +19,13 @@ #ifdef _TEST // Dear ImGui: standalone example application for DirectX 9 +// Modified by kelson8, now mostly everything is separated into it's own file to make this cleaner. +// I have moved most imgui functions into imgui_functions.cpp, and most Directx stuff into helpers.cpp. +// Most of this code came from the example here: +// https://github.com/ocornut/imgui/blob/master/examples/example_win32_directx9/main.cpp + +// You can use that example above for an ImGui base like I did in this project. + // Learn about Dear ImGui: // - FAQ https://dearimgui.com/faq // - Getting Started https://dearimgui.com/getting-started diff --git a/src/test/directx9_test.h b/src/test/directx9_test.h index 1f6e320..0b5e37e 100644 --- a/src/test/directx9_test.h +++ b/src/test/directx9_test.h @@ -2,11 +2,9 @@ #ifdef _WIN32 #include + #ifdef _DIRECTX9 #include -#endif - -#endif class DirectX9Test { public: @@ -30,4 +28,7 @@ public: static LPDIRECT3DDEVICE9 g_pd3dDevice; static UINT g_ResizeWidth, g_ResizeHeight; static D3DPRESENT_PARAMETERS g_d3dpp; -}; \ No newline at end of file +}; + +#endif // _DIRECTX9 +#endif //_WIN32 \ No newline at end of file