Move functions into their own methods, add new features to menu.

This commit is contained in:
kelson8 2024-06-16 01:59:24 -04:00
parent b9a832f15d
commit 8f469d1c9e
Signed by: kelson8
GPG Key ID: 3D738D9DD7239E13
8 changed files with 607 additions and 214 deletions

View File

@ -47,6 +47,7 @@
//Test
#include "CGame.h"
#include "CWaterLevel.h"
#include "CWeather.h"
#endif
#define _TEST
@ -65,6 +66,7 @@
#include "test_vehicle.h"
#include "test_hud.h"
#include "test_ped.h"
#include "test_world.h"
// Well I had this working but then broke it 6-14-2024 @ 3:51PM...
// I fixed it 3:53PM.
@ -122,12 +124,8 @@ void PlayerTestFeatures()
CVector pos = player->GetPosition();
}
bool test = false;
//bool toggleHud = true;
//bool toggleRadar = true;
bool enterCrane = false;
//bool playerCanDrown = true;
void TestPage::Draw()
{
@ -147,10 +145,20 @@ void TestPage::Draw()
ImGui::EndTabItem();
}
if (ImGui::BeginTabItem(TEXT("Test.TestFeatures")))
// TEXT(Test.TestPlayerMenu) - Test Player Menu
if (ImGui::BeginTabItem("Player"))
{
// Incomplete
PedTestPage::PlayerTestMenu();
// This is needed, I think it should fix a crash.
ImGui::EndTabItem();
}
if (ImGui::BeginTabItem(TEXT("Test.TestFeatures")))
{
// Incomplete
/*PedTestPage::PlayerTestMenu();*/
//
//if (ImGui::Button("Suicide"))
//{
@ -205,8 +213,6 @@ void TestPage::Draw()
//}
//ImGui::Columns(2, NULL, false);
#ifdef GTASA
//ImGui::NextColumn();
// https://github.com/JuniorDjjr/CLEOPlus/blob/main/CLEOPlus/Misc.cpp#L261-L266
@ -225,8 +231,6 @@ void TestPage::Draw()
//CPickup::GiveUsAPickUpObject(CObject::, -1);
//CPickups::CreatePickupCoorsCloseToCoors(playerPos.x, playerPos.y, playerPos.z);
}
//ImGui::SameLine();
ImGui::Text("Spawn 50k near your position");
@ -242,19 +246,19 @@ void TestPage::Draw()
// Not sure how this one works
//CCheckpoints::PlaceMarker();
if (ImGui::Button("Create Checkpoint"))
{
//if (ImGui::Button("Create Checkpoint"))
//{
}
ImGui::SameLine();
ImGui::Text("Doesn't work!");
//}
//ImGui::SameLine();
//ImGui::Text("Doesn't work!");
if (ImGui::Button("Remove checkpoint"))
{
}
ImGui::SameLine();
ImGui::Text("Doesn't work!");
//if (ImGui::Button("Remove checkpoint"))
//{
//
//}
//ImGui::SameLine();
//ImGui::Text("Doesn't work!");
// Hud functions
HudTestPage::HudTestMenu();
@ -275,22 +279,6 @@ void TestPage::Draw()
}
}
// This seems to work fine.
//if (ImGui::Checkbox("Player drowns", &playerCanDrown))
//{
// int hPlayer = CPools::GetPedRef(player);
// if (!playerCanDrown) {
// Command<Commands::SET_CHAR_DROWNS_IN_WATER>(hPlayer, false);
// Util::SetMessage("You can no longer drown!");
// }
// else
// {
// Command<Commands::SET_CHAR_DROWNS_IN_WATER>(hPlayer, true);
// Util::SetMessage("You can now drown again!");
// }
//}
// This works
if (ImGui::Button("Play Mission Passed"))
{
@ -299,129 +287,100 @@ void TestPage::Draw()
//bool isFlyingActive = CCheat::m_aCheatsActive);
//Util::SetMessage(std::format("Is Flying Active: {}", isFlyingActive).c_str());
}
// Doesn't work
// if (ImGui::Button("Show corona"))
// {
// I wonder How I would use this?
// I would need to define it somehow
//CCorona
//CCoronas::RegisterCorona();
// }
/*
* void PedPage::AddNewPed()
Example for what i'm trying to do spawning in a ped.
Command<Commands::REQUEST_MODEL>(model);
Command<Commands::LOAD_ALL_MODELS_NOW>();
if (Command<Commands::IS_MODEL_AVAILABLE>(model))
{
std::string key = std::format("Custom.{} (Added)", name);
m_PedData.m_pData->Set(key.c_str(), std::to_string(model));
m_PedData.m_pData->Save();
Util::SetMessage(TEXT("Ped.AddPedMSG"));
Command<Commands::MARK_MODEL_AS_NO_LONGER_NEEDED>(model);
}
else
{
Util::SetMessage(TEXT("Vehicle.InvalidID"));
}
*/
// First request the model
// Then load all models
// Lastly check if the model is available.
// If not say "Invalid model"
//
//if (ImGui::Button("Spawn Ped"))
//{
// //CPed* pPed = new CPed::;
// //CWaterLevel::
// //CWorld::Add()
//}
// Clothes
// World functions
WorldTestPage::WorldTestMenu();
#endif
//if (ImGui::Button("Spawn ped to attack vehicle"))
//{
// Util::SetMessage("Not setup!");
//}
//#ifdef GTASA
// // Weather
// // Will these work?
//
// int defaultWeatherType;
// //eWeatherType defaultWeatherType = WEATHER_CLOUDY_COUNTRYSIDE;
// //std::string defaultWeatherType = "WEATHER_CLOUDY_COUNTRYSIDE";
//
// //static std::vector<eWeatherType> cloudyWeatherTypes = {
// // WEATHER_CLOUDY_COUNTRYSIDE, WEATHER_CLOUDY_LA, WEATHER_CLOUDY_SF,
// // WEATHER_CLOUDY_VEGAS
// //};
//
// static std::vector<std::string> allWeatherTypes = {
// "Extra Sunny LA", "Sunny LA", "Smog LA", "Sunny Smog LA",
// "Cloudy LA", "Sunny SF", "Extra Sunny SF", "Cloudy SF", "Rainy SF",
// "Foggy SF", "Sunny LV", "Cloudy LV", "Extra Sunny Countryside", "Cloudy Countryside",
// "Rainy Countryside", "Extra Sunny Desert", "Sunny Desert", "Sandstorm Desert",
// "Underwater", "Extra Colors 1", "Extra Colors 2"
//
// //"WEATHER_EXTRASUNNY_COUNTRYSIDE", "WEATHER_EXTRASUNNY_SMOG_LA", "WEATHER_EXTRASUNNY_SMOG_LA",
// //"WEATHER_EXTRASUNNY_VEGAS", "WEATHER_EXTRACOLOURS_1", "WEATHER_EXTRACOLOURS_2",
// //"WEATHER_RAINY_COUNTRYSIDE", "WEATHER_RAINY_SF", "WEATHER_FOGGY_SF",
// //"WEATHER_REGION_DEFAULT", "WEATHER_REGION_DESERT",
// //"WEATHER_REGION_LA", "WEATHER_REGION_LV", "WEATHER_REGION_SF",
// };
//
// static std::vector<std::string> cloudyWeatherTypes = {
// "WEATHER_CLOUDY_COUNTRYSIDE", "WEATHER_CLOUDY_LA", "WEATHER_CLOUDY_SF",
// "WEATHER_CLOUDY_VEGAS", "WEATHER_EXTRASUNNY_LA", "WEATHER_EXTRASUNNY_DESERT", "WEATHER_EXTRASUNNY_LA",
// "WEATHER_EXTRASUNNY_COUNTRYSIDE", "WEATHER_EXTRASUNNY_SMOG_LA", "WEATHER_EXTRASUNNY_SMOG_LA",
// "WEATHER_EXTRASUNNY_VEGAS", "WEATHER_EXTRACOLOURS_1", "WEATHER_EXTRACOLOURS_2"
// };
//
// static std::vector<eWeatherType> sunnyWeatherTypes = {
// WEATHER_EXTRASUNNY_LA, WEATHER_EXTRASUNNY_DESERT, WEATHER_EXTRASUNNY_LA,
// WEATHER_EXTRASUNNY_COUNTRYSIDE, WEATHER_EXTRASUNNY_SMOG_LA, WEATHER_EXTRASUNNY_SMOG_LA,
// WEATHER_EXTRASUNNY_VEGAS, WEATHER_EXTRACOLOURS_1, WEATHER_EXTRACOLOURS_2
// };
//
// static std::vector<eWeatherType> rainyWeatherTypes = {
// WEATHER_RAINY_COUNTRYSIDE, WEATHER_RAINY_SF,
// };
//
// //static std::vector<eWeatherType> otherWeatherTypes = {
// // WEATHER_FOGGY_SF, WEATHER_REGION_DEFAULT, WEATHER_REGION_DESERT,
// // WEATHER_REGION_LA, WEATHER_REGION_LV, WEATHER_REGION_SF,
// //};
//
// //
//
//
//
// // TODO Setup to where this sets the Las Venturas weather instaed of the LA weather in the Los Venturas area.
// // TODO Setup drop down menu for this.
// // Get players current zone if possible, I know it's in the code somewhere.
// ImGui::Separator();
// ImGui::Text("Weather");
//
// if (ImGui::Button("Rain")) {
// // Will this work?
// CWeather::ForceWeatherNow(WEATHER_RAINY_COUNTRYSIDE);
// Util::SetMessage("Weather set to rain.");
// }
//
// if (ImGui::Button("Clear")) {
// // Will this work?
// CWeather::ForceWeatherNow(WEATHER_EXTRASUNNY_LA);
// Util::SetMessage("Weather set to rain.");
// }
//
// // This seems to work but the weather types aren't the right ones that I have listed.
// // They are out of order.
// //if (ImGui::Combo("Cloudy Weather", &defaultWeatherType, cloudyWeatherTypes))
// if (Widget::ListBox("Cloudy Weather", allWeatherTypes, defaultWeatherType))
// {
// CWeather::ForceWeatherNow(defaultWeatherType);
// }
//
// //if (ImGui::Combo("Cloudy Weather", &defaultWeatherType, cloudyWeatherTypes))
// {
// // How would I store the value for this?
// //CWeather::ForceWeatherNow();
// }
//
//#endif //GTASA
/*
if (ImGui::CollapsingHeader("Spawner"))
{
// PedPage::AddNewPed
// This doesn't work yet.
//#define _DISABLED_CODE
#ifdef _DISABLED_CODE
static char name[8];
static int model = 0;
ImGui::InputTextWithHint(TEXT("Menu.Name"), "PEDNAME", name, 7);
Widget::InputInt(TEXT("Ped.Model"), &model, 0, 999999);
ImGui::Spacing();
ImVec2 sz = Widget::CalcSize(2);
if (ImGui::Button(TEXT("Ped.AddPed"), sz))
{
Command<Commands::REQUEST_MODEL>(model);
Command<Commands::LOAD_ALL_MODELS_NOW>();
if (Command<Commands::IS_MODEL_AVAILABLE>(model))
{
std::string key = std::format("Custom.{} (Added)", name);
// This part doesn't want to work.
//m_PedData.m_pData->Set(key.c_str(), std::to_string(model));
pedPage.m_PedData.m_pData->Set(key.c_str(), std::to_string(model));
pedPage.m_PedData.m_pData->Save();
//
Util::SetMessage(TEXT("Ped.AddPedMSG"));
Command<Commands::MARK_MODEL_AS_NO_LONGER_NEEDED>(model);
}
else
{
Util::SetMessage(TEXT("Vehicle.InvalidID"));
}
}
ImGui::SameLine();
if (ImGui::Button(TEXT("Ped.GetPlayerModel"), sz))
{
model = FindPlayerPed()->m_nModelIndex;
}
#endif //_DISABLED_CODE
//
// https://library.sannybuilder.com/#/sa/default/0672
//Command<Commands::TASK_DESTROY_CAR>(pPed);
} //End
//ImGui::EndChild();
*
}
// This seems to work for printing text, idea came from imgui_demo.cpp line 5819
static char text[64] = "text";
static int bufTest[2];
if(ImGui::InputText("Test", text, IM_ARRAYSIZE(text)))
// Not sure how to get this to work
//if (ImGui::InputInt("Clock", bufTest, IM_ARRAYSIZE(bufTest)))
{
//CClock::ms_nGameClockHours = hours;
//CClock::SetGameClock(hours)
}
if (ImGui::Button("Print Text"))
{
Util::SetMessage(text);
}
ImGui::Text("Test Items");
//CWorld::
*/
ImGui::EndTabItem();
}

View File

@ -4,24 +4,9 @@
bool toggleHud = true;
bool toggleRadar = true;
void HudTestPage::HudTestMenu()
static void ToggleRadarMenu()
{
// GTA SA Specific memory addresses, will most likely crash 3 and vc.
#ifdef GTASA
if (ImGui::Checkbox("Toggle hud", &toggleHud))
{
// hudModeAddress = 0xBA6769;
if (!toggleHud)
{
patch::Set(0xBA6769, 0, true);
}
else
{
patch::Set(0xBA6769, 1, true);
}
}
if (ImGui::Checkbox("Toggle Radar", &toggleRadar))
{
// radarModeAddress = 0xBA676C
@ -34,5 +19,41 @@ void HudTestPage::HudTestMenu()
patch::Set(0xBA676C, 0, true);
}
}
}
static void ToggleHudMenu()
{
if (ImGui::Checkbox("Toggle hud", &toggleHud))
{
// hudModeAddress = 0xBA6769;
if (!toggleHud)
{
patch::Set(0xBA6769, 0, true);
}
else
{
patch::Set(0xBA6769, 1, true);
}
}
}
void HudTestPage::HudTestMenu()
{
// GTA SA Specific memory addresses, will most likely crash 3 and vc.
// What are these doing? From scene.cpp on lines 172-177.
// Is Nop setting the value to zero? I think that is what it's doing.
// patch::Set<DWORD>(0x609A4E, 0x4D48689);
// patch::Set<WORD>(0x609A52, 0);
// patch::Nop(0x609A4E, 6);
// patch::Set
// patch::Set(Address, value, true);
#ifdef GTASA
ToggleHudMenu();
ToggleRadarMenu();
#endif //GTASA
}

21
src/test/test_markers.cpp Normal file
View File

@ -0,0 +1,21 @@
#include "pch.h"
#include "test_markers.h"
static void CoronasMenu()
{
// Doesn't work
// if (ImGui::Button("Show corona"))
// {
// I wonder How I would use this?
// I would need to define it somehow
//CCorona
//CCoronas::RegisterCorona();
// }
}
void MarkersTestPage::MarkersTestMenu()
{
#ifdef _TEST
CoronasMenu();
#endif //_TEST
}

12
src/test/test_markers.h Normal file
View File

@ -0,0 +1,12 @@
#pragma once
//#include "pch.h"
class MarkersTestPage
{
private:
MarkersTestPage();
MarkersTestPage(const MarkersTestPage&);
void Draw();
public:
static void MarkersTestMenu();
};

View File

@ -6,24 +6,30 @@
#endif
// Incomplete.
// https://library.sannybuilder.com/#/sa/default/0672
//Command<Commands::TASK_DESTROY_CAR>(pPed);
bool playerCanDrown = true;
void PedTestPage::PlayerTestMenu()
static void SuicideMenu()
{
#ifdef GTASA
CPlayerPed* player = FindPlayerPed();
if (ImGui::Button("Suicide"))
{
//CPlayerPed* player = FindPlayerPed();
CPlayerPed* player = FindPlayerPed();
int hplayer = CPools::GetPedRef(player);
Command<Commands::EXPLODE_CHAR_HEAD>(hplayer);
}
#else
CPlayerPed* player = FindPlayerPed();
#endif //GTASA
}
static void BombMenu()
{
#ifdef GTASA
CPlayerPed* player = FindPlayerPed();
//TODO Test these in the other games, 3 and vc later!
if (ImGui::Button("Bomb")) {
CPlayerPed* player = FindPlayerPed();
@ -36,8 +42,12 @@ void PedTestPage::PlayerTestMenu()
Command<Commands::ADD_EXPLOSION>(playerPos.x, playerPos.y, playerPos.z, EXPLOSION_CAR);
}
#endif //GTASA
}
static void ShowCoordsMenu()
{
#ifdef GTASA
CPlayerPed* player = FindPlayerPed();
if (ImGui::Button("Show coords"))
{
CVector playerCoords = player->GetPosition();
@ -60,6 +70,12 @@ void PedTestPage::PlayerTestMenu()
}
#endif //GTASA
}
static void ShowMarkerCoordsMenu()
{
#ifdef GTASA
CPlayerPed* player = FindPlayerPed();
//if (ImGui::Button("Show Marker Coords"))
//{
@ -73,9 +89,14 @@ void PedTestPage::PlayerTestMenu()
// //Command<Commands::BLIP>(playerPos.x, playerPos.y, playerPos.z, EXPLOSION_CAR);
//}
//ImGui::Columns(2, NULL, false);
#ifdef GTASA
#endif //GTASA
}
static void TogglePlayerDrownMenu()
{
#ifdef GTASA
CPlayerPed* player = FindPlayerPed();
// This seems to work fine.
if (ImGui::Checkbox("Player drowns", &playerCanDrown))
{
int hPlayer = CPools::GetPedRef(player);
@ -90,4 +111,140 @@ void PedTestPage::PlayerTestMenu()
}
}
#endif //GTASA
}
static void GravityValuesMenu()
{
CPlayerPed* player = FindPlayerPed();
#ifdef GTASA
ImGui::Separator();
ImGui::Text("Gravity Values");
//ImGui::Columns(4);
if (ImGui::Button("Space Gravity")) {
GAME_GRAVITY = 0.0;
Util::SetMessage("Gravity set to space.");
}
ImGui::SameLine();
if (ImGui::Button("Moon Gravity")) {
GAME_GRAVITY = 0.001;
Util::SetMessage("Gravity set to moon.");
}
ImGui::SameLine();
if (ImGui::Button("Normal Gravity")) {
GAME_GRAVITY = 0.008;
Util::SetMessage("Gravity set to normal.");
}
ImGui::Separator();
if (ImGui::Button("Strong Gravity")) {
GAME_GRAVITY = 0.015;
Util::SetMessage("Gravity set to strong.");
}
ImGui::SameLine();
if (ImGui::Button("Maniac Gravity")) {
GAME_GRAVITY = 0.9;
Util::SetMessage("Gravity set to maniac. Chaos will occur!");
}
#endif //GTASA
}
// Very WIP and incomplete.
static void SpawnPedMenu()
{
CPlayerPed* player = FindPlayerPed();
/*
* void PedPage::AddNewPed()
Example for what i'm trying to do spawning in a ped.
Command<Commands::REQUEST_MODEL>(model);
Command<Commands::LOAD_ALL_MODELS_NOW>();
if (Command<Commands::IS_MODEL_AVAILABLE>(model))
{
std::string key = std::format("Custom.{} (Added)", name);
m_PedData.m_pData->Set(key.c_str(), std::to_string(model));
m_PedData.m_pData->Save();
Util::SetMessage(TEXT("Ped.AddPedMSG"));
Command<Commands::MARK_MODEL_AS_NO_LONGER_NEEDED>(model);
}
else
{
Util::SetMessage(TEXT("Vehicle.InvalidID"));
}
*/
// First request the model
// Then load all models
// Lastly check if the model is available.
// If not say "Invalid model"
//
//if (ImGui::Button("Spawn Ped"))
//{
// //CPed* pPed = new CPed::;
// //CWaterLevel::
// //CWorld::Add()
//}
//if (ImGui::Button("Spawn ped to attack vehicle"))
//{
// Util::SetMessage("Not setup!");
//}
/*
if (ImGui::CollapsingHeader("Spawner"))
{
// PedPage::AddNewPed
// This doesn't work yet.
//#define _DISABLED_CODE
#ifdef _DISABLED_CODE
static char name[8];
static int model = 0;
ImGui::InputTextWithHint(TEXT("Menu.Name"), "PEDNAME", name, 7);
Widget::InputInt(TEXT("Ped.Model"), &model, 0, 999999);
ImGui::Spacing();
ImVec2 sz = Widget::CalcSize(2);
if (ImGui::Button(TEXT("Ped.AddPed"), sz))
{
Command<Commands::REQUEST_MODEL>(model);
Command<Commands::LOAD_ALL_MODELS_NOW>();
if (Command<Commands::IS_MODEL_AVAILABLE>(model))
{
std::string key = std::format("Custom.{} (Added)", name);
// This part doesn't want to work.
//m_PedData.m_pData->Set(key.c_str(), std::to_string(model));
pedPage.m_PedData.m_pData->Set(key.c_str(), std::to_string(model));
pedPage.m_PedData.m_pData->Save();
//
Util::SetMessage(TEXT("Ped.AddPedMSG"));
Command<Commands::MARK_MODEL_AS_NO_LONGER_NEEDED>(model);
}
else
{
Util::SetMessage(TEXT("Vehicle.InvalidID"));
}
}
ImGui::SameLine();
if (ImGui::Button(TEXT("Ped.GetPlayerModel"), sz))
{
model = FindPlayerPed()->m_nModelIndex;
}
#endif //_DISABLED_CODE
*/
}
void PedTestPage::PlayerTestMenu()
{
SuicideMenu();
BombMenu();
ShowCoordsMenu();
ShowMarkerCoordsMenu();
TogglePlayerDrownMenu();
GravityValuesMenu();
}

View File

@ -44,7 +44,8 @@ bool bFlyingCars = false;
bool bSearchLight = false;
bool bVehGodMode = false;
void VehicleTestPage::VehicleTestMenu() {
static void BlowUpAllCarsMenu()
{
#ifdef GTASA
CPlayerPed* player = FindPlayerPed();
int hplayer = CPools::GetPedRef(player);
@ -56,11 +57,17 @@ void VehicleTestPage::VehicleTestMenu() {
CCheat::BlowUpCarsCheat();
Util::SetMessage("All cars have been exterminated!");
#else
Util::SetMessage("Only works for SA!");
#endif
}
Util::SetMessage("Only works for SA!");
}
#endif //GTASA
}
}
static void SearchLightMenu()
{
#ifdef GTASA
CPlayerPed* player = FindPlayerPed();
// Try to toggle the search lights in police helicopters, is it toggleable in SA? I think I did it in FiveM.
if (ImGui::Checkbox("Search Light", &bSearchLight))
{
@ -76,13 +83,15 @@ void VehicleTestPage::VehicleTestMenu() {
//CHeli::AddHeliSearchLight();
}
}
ImGui::SameLine();
ImGui::Text("Doesn't work!");
#endif //GTASA
// https://github.com/JuniorDjjr/CLEOPlus/blob/main/CLEOPlus/Misc.cpp#L261-L266
/*
reinterpret_cast<CRunningScript*>(thread)->UpdateCompareFlag(CCheat::m_aCheatsActive[i]);
*/
}
static void BlowUpVehicleMenu()
{
#ifdef GTASA
CPlayerPed* player = FindPlayerPed();
if (ImGui::Button("Blow up Current Car"))
{
@ -101,8 +110,12 @@ void VehicleTestPage::VehicleTestMenu() {
}
#endif //GTASA
}
static void CloseDoorsMenu()
{
#ifdef GTASA
CPlayerPed* player = FindPlayerPed();
// Works for closing the doors, not the trunk or hood though.
if (ImGui::Button("Close doors"))
{
@ -119,9 +132,13 @@ void VehicleTestPage::VehicleTestMenu() {
Command<Commands::CLOSE_ALL_CAR_DOORS>(hVeh);
}
}
#endif //GTASA
}
#endif
static void LockDoorsMenu()
{
#ifdef GTASA
CPlayerPed* player = FindPlayerPed();
// This works for locking the car doors.
if (ImGui::Button("Lock doors"))
{
@ -159,42 +176,49 @@ void VehicleTestPage::VehicleTestMenu() {
}
}
#endif //GTASA
//}
}
// This works
static void FlyingCarsMenu()
{
// This works
#ifdef GTASA
if (ImGui::Checkbox("Flying cars", &bFlyingCars))
{
// In cleo redux I can read and write to memory addresses, not sure how on here.
// I figured it out in the below code using a function in this menu.
// Example:
/*
* (Written in JavaScript)
player.clearWantedLevel();
Memory.Write(0x969171, 1, 1, false);
// Flying cars cheat.
*/
// Idea for this game from game.cpp on line 359
if (bFlyingCars)
CPlayerPed* player = FindPlayerPed();
if (ImGui::Checkbox("Flying cars", &bFlyingCars))
{
patch::Set<byte>(0x969160, 1, true);
Util::SetMessage("Cars can now fly!");
// In cleo redux I can read and write to memory addresses, not sure how on here.
// I figured it out in the below code using a function in this menu.
// Example:
/*
* (Written in JavaScript)
player.clearWantedLevel();
Memory.Write(0x969171, 1, 1, false);
// Flying cars cheat.
*/
// Idea for this game from game.cpp on line 359
if (bFlyingCars)
{
patch::Set<byte>(0x969160, 1, true);
Util::SetMessage("Cars can now fly!");
}
else
{
patch::Set<byte>(0x969160, 0, true);
Util::SetMessage("Cars can no longer fly!");
}
// CallDynGlobal seems to be what they are using for cheats in the plugin-sdk
//CallDynGlobal<0x969160>;
// Gives an error though
}
else
{
patch::Set<byte>(0x969160, 0, true);
Util::SetMessage("Cars can no longer fly!");
}
// CallDynGlobal seems to be what they are using for cheats in the plugin-sdk
//CallDynGlobal<0x969160>;
// Gives an error though
}
#endif //GTASA
}
static void InvincibleCarsMenu()
{
#ifdef GTASA
CPlayerPed* player = FindPlayerPed();
// This works, this was a quick test I came up with.
if (ImGui::Checkbox("Invincible car", &bVehGodMode))
{
@ -226,8 +250,13 @@ void VehicleTestPage::VehicleTestMenu() {
}
}
#endif //GTASA
}
static void IsCarInWaterMenu()
{
#ifdef GTASA
CPlayerPed* player = FindPlayerPed();
// Working
if (ImGui::Button("Is car in water"))
{
@ -258,6 +287,33 @@ void VehicleTestPage::VehicleTestMenu() {
}
#endif //GTASA
void VehicleTestPage::VehicleTestMenu() {
//#ifdef GTASA
// CPlayerPed* player = FindPlayerPed();
// int hplayer = CPools::GetPedRef(player);
// CVehicle* pVeh = nullptr;
// CVector pos = player->GetPosition();
//
// if (ImGui::Button("Blow up all cars")) {
//
// CCheat::BlowUpCarsCheat();
// Util::SetMessage("All cars have been exterminated!");
//#else
// Util::SetMessage("Only works for SA!");
//
// }
//#endif //GTASA
BlowUpAllCarsMenu();
SearchLightMenu();
BlowUpVehicleMenu();
CloseDoorsMenu();
LockDoorsMenu();
FlyingCarsMenu();
InvincibleCarsMenu();
IsCarInWaterMenu();
}
// void VehiclePage::Draw()

155
src/test/test_world.cpp Normal file
View File

@ -0,0 +1,155 @@
#include "pch.h"
#include "test_world.h"
#include "utils/widget.h"
void WeatherMenu()
{
// Weather
// Will these work?
// Will giving this a default value fix the crashing? I think the weather is crashing it.
int defaultWeatherType = 0;
//eWeatherType defaultWeatherType = WEATHER_CLOUDY_COUNTRYSIDE;
//std::string defaultWeatherType = "WEATHER_CLOUDY_COUNTRYSIDE";
//static std::vector<eWeatherType> cloudyWeatherTypes = {
// WEATHER_CLOUDY_COUNTRYSIDE, WEATHER_CLOUDY_LA, WEATHER_CLOUDY_SF,
// WEATHER_CLOUDY_VEGAS
//};
static std::vector<std::string> allWeatherTypes = {
"Extra Sunny LA", "Sunny LA", "Smog LA", "Sunny Smog LA",
"Cloudy LA", "Sunny SF", "Extra Sunny SF", "Cloudy SF", "Rainy SF",
"Foggy SF", "Sunny LV", "Cloudy LV", "Extra Sunny Countryside", "Cloudy Countryside",
"Rainy Countryside", "Extra Sunny Desert", "Sunny Desert", "Sandstorm Desert",
"Underwater", "Extra Colors 1", "Extra Colors 2"
//"WEATHER_EXTRASUNNY_COUNTRYSIDE", "WEATHER_EXTRASUNNY_SMOG_LA", "WEATHER_EXTRASUNNY_SMOG_LA",
//"WEATHER_EXTRASUNNY_VEGAS", "WEATHER_EXTRACOLOURS_1", "WEATHER_EXTRACOLOURS_2",
//"WEATHER_RAINY_COUNTRYSIDE", "WEATHER_RAINY_SF", "WEATHER_FOGGY_SF",
//"WEATHER_REGION_DEFAULT", "WEATHER_REGION_DESERT",
//"WEATHER_REGION_LA", "WEATHER_REGION_LV", "WEATHER_REGION_SF",
};
static std::vector<std::string> cloudyWeatherTypes = {
"WEATHER_CLOUDY_COUNTRYSIDE", "WEATHER_CLOUDY_LA", "WEATHER_CLOUDY_SF",
"WEATHER_CLOUDY_VEGAS", "WEATHER_EXTRASUNNY_LA", "WEATHER_EXTRASUNNY_DESERT", "WEATHER_EXTRASUNNY_LA",
"WEATHER_EXTRASUNNY_COUNTRYSIDE", "WEATHER_EXTRASUNNY_SMOG_LA", "WEATHER_EXTRASUNNY_SMOG_LA",
"WEATHER_EXTRASUNNY_VEGAS", "WEATHER_EXTRACOLOURS_1", "WEATHER_EXTRACOLOURS_2"
};
static std::vector<eWeatherType> sunnyWeatherTypes = {
WEATHER_EXTRASUNNY_LA, WEATHER_EXTRASUNNY_DESERT, WEATHER_EXTRASUNNY_LA,
WEATHER_EXTRASUNNY_COUNTRYSIDE, WEATHER_EXTRASUNNY_SMOG_LA, WEATHER_EXTRASUNNY_SMOG_LA,
WEATHER_EXTRASUNNY_VEGAS, WEATHER_EXTRACOLOURS_1, WEATHER_EXTRACOLOURS_2
};
static std::vector<eWeatherType> rainyWeatherTypes = {
WEATHER_RAINY_COUNTRYSIDE, WEATHER_RAINY_SF,
};
//static std::vector<eWeatherType> otherWeatherTypes = {
// WEATHER_FOGGY_SF, WEATHER_REGION_DEFAULT, WEATHER_REGION_DESERT,
// WEATHER_REGION_LA, WEATHER_REGION_LV, WEATHER_REGION_SF,
//};
//
// TODO Setup to where this sets the Las Venturas weather instaed of the LA weather in the Los Venturas area.
// TODO Setup drop down menu for this.
// Get players current zone if possible, I know it's in the code somewhere.
ImGui::Separator();
ImGui::Text("Weather");
if (ImGui::Button("Rain")) {
// Will this work?
CWeather::ForceWeatherNow(WEATHER_RAINY_COUNTRYSIDE);
Util::SetMessage("Weather set to rain.");
}
if (ImGui::Button("Clear")) {
// Will this work?
CWeather::ForceWeatherNow(WEATHER_EXTRASUNNY_LA);
Util::SetMessage("Weather set to rain.");
}
// This seems to work but the weather types aren't the right ones that I have listed.
// They are out of order.
//if (ImGui::Combo("Cloudy Weather", &defaultWeatherType, cloudyWeatherTypes))
if (Widget::ListBox("Cloudy Weather", allWeatherTypes, defaultWeatherType))
{
defaultWeatherType = defaultWeatherType;
CWeather::ForceWeatherNow(defaultWeatherType);
}
//if (ImGui::Combo("Cloudy Weather", &defaultWeatherType, cloudyWeatherTypes))
{
// How would I store the value for this?
//CWeather::ForceWeatherNow();
}
}
static void CreateCheckpointMenu()
{
// Not sure how this one works
//CCheckpoints::PlaceMarker();
if (ImGui::Button("Create Checkpoint"))
{
}
ImGui::SameLine();
ImGui::Text("Doesn't work!");
}
static void RemoveCheckpointMenu()
{
if (ImGui::Button("Remove checkpoint"))
{
}
ImGui::SameLine();
ImGui::Text("Doesn't work!");
}
void WorldTestPage::WorldTestMenu()
{
/*
Refactor these to have the tabs in each file instead of in the test.cpp file
// TEXT(Test.TestWorldMenu) - Test World Menu
if (ImGui::BeginTabItem("World"))
{
WeatherMenu();
ImGui::EndTabItem();
}
*/
// Not sure how this one works
//CCheckpoints::PlaceMarker();
//if (ImGui::Button("Create Checkpoint"))
//{
//}
//ImGui::SameLine();
//ImGui::Text("Doesn't work!");
//if (ImGui::Button("Remove checkpoint"))
//{
//}
//ImGui::SameLine();
//ImGui::Text("Doesn't work!");
#ifdef GTASA
CreateCheckpointMenu();
RemoveCheckpointMenu();
// Weather
WeatherMenu();
#endif
// Not implemented yet!
}

12
src/test/test_world.h Normal file
View File

@ -0,0 +1,12 @@
#pragma once
//#include "pch.h"
class WorldTestPage
{
private:
WorldTestPage();
WorldTestPage(const WorldTestPage&);
void Draw();
public:
static void WorldTestMenu();
};