diff --git a/src/test/test.cpp b/src/test/test.cpp
index 33918f5..d3c6f79 100644
--- a/src/test/test.cpp
+++ b/src/test/test.cpp
@@ -18,10 +18,22 @@
https://github.com/user-grinch/Cheat-Menu
*/
+// TODO Figure out how to get the coordniates of where the player is looking at, I think that should be possible.
+// TODO Try to get this working on VC and 3 sometime, the menu normally works on those games I would just have to make sure I don't have any SA specific
+// memory addresses or anything in it.
// Well this was working with the Visual Studio 2022 debugger now it says cannot find gta_sa.exe or gta-vc.exe.
// It still seems to work if I launch the games directly though.
+// 6-17-2024 @ 2:51AM
+// I fixed it to work with the Visual Studio 2022 debugger again
+// Useful functions:
+// Force all cars to be the specified model: https://library.sannybuilder.com/#/sa/default/09BF
+// Set ped density multiplier: https://library.sannybuilder.com/#/sa/default/03DE
+// Set ped vehicle multipler: https://library.sannybuilder.com/#/sa/default/01EB
+//
+
+
#ifdef GTASA
#include "CExplosion.h"
// New
@@ -48,6 +60,13 @@
#include "CGame.h"
#include "CWaterLevel.h"
#include "CWeather.h"
+
+// Radio Test
+#include "CAERadioTrackManager.h"
+#include "CAudioEngine.h"
+// I can disable the radio and change its type using this
+#include "CAEVehicleAudioEntity.h"
+
#endif
#define _TEST
@@ -67,11 +86,13 @@
#include "test_hud.h"
#include "test_ped.h"
#include "test_world.h"
+#include "player_functions.h"
// Well I had this working but then broke it 6-14-2024 @ 3:51PM...
// I fixed it 3:53PM.
// TODO Fix this to use translations from the English.toml file instead of hardcoding the values.
+// TODO Seperate these out into multiple tabs within my test tab, so have a Player, Vehicle, Sounds, World, Misc, Test Features and more tabs.
TestPage& testPage = TestPage::Get();
TestPage::TestPage()
@@ -79,7 +100,10 @@ TestPage::TestPage()
}
-
+// Booleans
+bool test = false;
+bool enterCrane = false;
+bool toggleRadio = true;
//void TestPage::PlayerTest() {
// CPlayerPed* player = FindPlayerPed();
@@ -88,6 +112,27 @@ TestPage::TestPage()
//}
+///
+/// Train test functions.
+///
+static void TrainTestMenu()
+{
+
+ ImGui::Text("Train testing.");
+ // This works.
+ if (ImGui::Button("Are you in a train?"))
+ {
+ if (PlayerFunctions::IsPlayerInTrain())
+ {
+ Util::SetMessage("You are in a train.");
+ }
+ else
+ {
+ Util::SetMessage("You are not in a train.");
+ }
+ }
+}
+
void PlayerTestFeatures()
{
CPlayerPed* player = FindPlayerPed();
@@ -124,24 +169,41 @@ void PlayerTestFeatures()
CVector pos = player->GetPosition();
}
-bool test = false;
-bool enterCrane = false;
void TestPage::Draw()
{
+ // I am testing moving everything from static to not using static.
+#ifdef _TEST
+ // Init for the menu
+ WorldTestPage* worldTestPage = new WorldTestPage();
+ HudTestPage* hudTestPage = new HudTestPage();
+ PedTestPage* pedTestPage = new PedTestPage();
+ VehicleTestPage* vehicleTestPage = new VehicleTestPage();
+
+ // Misc items
+#ifdef GTASA
+ CAERadioTrackManager* cAERadioTrackManager = new CAERadioTrackManager();
+ CAudioEngine* cAudioEngine = new CAudioEngine();
+ CAEVehicleAudioEntity* cAEVehicleAudioEntity = new CAEVehicleAudioEntity();
+#endif // GTASA
+#endif //_TEST
CPlayerPed* player = FindPlayerPed();
//ImGui::BeginChild("Test");
+
+ // Test
+ ImGui::Text("Hello from KCNet");
+
if (ImGui::BeginTabBar("Test", ImGuiTabBarFlags_NoTooltip + ImGuiTabBarFlags_FittingPolicyScroll))
{
+
+ ImGui::Separator();
if (ImGui::BeginTabItem(TEXT("Test.TestVehicle")))
{
// This works for seperating out the menus!
// 6-15-2024 @ 2:05PM
- ImGui::Text("Hello from KCNet");
+ //ImGui::Text("Hello from KCNet");
ImGui::Text("Vehicle Tab");
- VehicleTestPage::VehicleTestMenu();
- //static int selected = Locale::GetCurrentLocaleIndex();
- //static std::vector& vec = Locale::GetLocaleList();
+ vehicleTestPage->VehicleTestMenu();
ImGui::EndTabItem();
}
@@ -149,7 +211,12 @@ void TestPage::Draw()
if (ImGui::BeginTabItem("Player"))
{
// Incomplete
+#ifdef _TEST
+ pedTestPage->PlayerTestMenu();
+#else
PedTestPage::PlayerTestMenu();
+#endif //_TEST
+
// This is needed, I think it should fix a crash.
ImGui::EndTabItem();
@@ -159,45 +226,6 @@ void TestPage::Draw()
{
// Incomplete
/*PedTestPage::PlayerTestMenu();*/
- //
- //if (ImGui::Button("Suicide"))
- //{
- // //CPlayerPed* player = FindPlayerPed();
- // int hplayer = CPools::GetPedRef(player);
- // Command(hplayer);
- //}
-
- //if (ImGui::Button("Bomb")) {
- // CPlayerPed* player = FindPlayerPed();
- // int hplayer = CPools::GetPedRef(player);
-
- // CVector playerPos = player->GetPosition();
-
- // // https://library.sannybuilder.com/#/sa/default/020C
- // // x, y, z, EXPLOSION_CAR
- // Command(playerPos.x, playerPos.y, playerPos.z, EXPLOSION_CAR);
- //}
-
- //if (ImGui::Button("Show coords"))
- //{
- // CVector playerCoords = player->GetPosition();
- // //std::string text = std::to_string(pos.x) + ", " + std::to_string(pos.y) + ", " + std::to_string(pos.z);
- // //int playerX = playerCoords.x;
- // //int playerY = playerCoords.y;
- // //int playerZ = playerCoords.z;
-
- // std::string playerX = std::to_string(playerCoords.x);
- // std::string playerY = std::to_string(playerCoords.y);
- // std::string playerZ = std::to_string(playerCoords.z);
-
- // // This works for showing just the X coord, I cannot concatenate these values though
- // //Util::SetMessage(playerXChar);
- // // Taken idea from freecam_sa.cpp on line 156
- // // This works!!
- // // 6-14-2024 @ 2:34PM
- // Util::SetMessage(std::format("X: {} Y: {} Z: {}", playerX, playerY, playerZ).c_str());
- // //Util::SetMessage("X: " + playerXChar + " Y: " + playerYChar + " Z: " + playerZChar);
- //}
//if (ImGui::Button("Show Marker Coords"))
//{
@@ -217,7 +245,7 @@ void TestPage::Draw()
//ImGui::NextColumn();
// https://github.com/JuniorDjjr/CLEOPlus/blob/main/CLEOPlus/Misc.cpp#L261-L266
// reinterpret_cast(thread)->UpdateCompareFlag(CCheat::m_aCheatsActive[i]);
-
+
// I wonder how to spawn a different pickup
if (ImGui::Button("Health pickup"))
@@ -244,30 +272,11 @@ void TestPage::Draw()
}
ImGui::Separator();
- // 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!");
-
- // Hud functions
- HudTestPage::HudTestMenu();
-
// Not sure how these work.
// https://library.sannybuilder.com/#/sa/classes/Crane
if (ImGui::Checkbox("Enter Crane", &enterCrane))
{
- if(enterCrane)
+ if (enterCrane)
{
// https://library.sannybuilder.com/#/sa/default/079D
Command();
@@ -287,201 +296,76 @@ void TestPage::Draw()
//bool isFlyingActive = CCheat::m_aCheatsActive);
//Util::SetMessage(std::format("Is Flying Active: {}", isFlyingActive).c_str());
}
+
+ // Move into vehicle functions.
+ if (ImGui::Button("Current Radio Station"))
+ {
+ int hplayer = CPools::GetPedRef(player);
+ CVehicle* pVeh = nullptr;
+ bool bInVehicle = Command(hplayer);
+
+ if (bInVehicle) {
+ CVehicle* pVeh = player->m_pVehicle;
+ if (cAERadioTrackManager->IsVehicleRadioActive())
+ {
+ // How would I set this to get the current radio station?
+ // I'll just use the command version of it for now instead of the cAERadioTrackManager
+
+
+ // Wow this works fine, I noticed the method was using char* so I decided to put it into it's own field.
+ const char* currentRadioStationName = cAERadioTrackManager->GetRadioStationName(cAudioEngine->GetCurrentRadioStationID());
+ //int radioChannel = 0;
+ //Command();
+
+ //Util::SetMessage(cAERadioTrackManager->GetRadioStationName(Command()));
+ // This works!! I figured it out
+ // 6-17-2024 @ 12:27AM
+ //Util::SetMessage(cAERadioTrackManager->GetRadioStationName(cAudioEngine->GetCurrentRadioStationID()));
+ Util::SetMessage(currentRadioStationName);
+
+ //
+ }
+ }
+ }
+
+ //////
+ // New
+ ImGui::Separator();
+ TrainTestMenu();
+ //////
+
// Clothes
- // World functions
- WorldTestPage::WorldTestMenu();
-
#endif
-
-//#ifdef GTASA
-// // Weather
-// // Will these work?
-//
-// int defaultWeatherType;
-// //eWeatherType defaultWeatherType = WEATHER_CLOUDY_COUNTRYSIDE;
-// //std::string defaultWeatherType = "WEATHER_CLOUDY_COUNTRYSIDE";
-//
-// //static std::vector cloudyWeatherTypes = {
-// // WEATHER_CLOUDY_COUNTRYSIDE, WEATHER_CLOUDY_LA, WEATHER_CLOUDY_SF,
-// // WEATHER_CLOUDY_VEGAS
-// //};
-//
-// static std::vector 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 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 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 rainyWeatherTypes = {
-// WEATHER_RAINY_COUNTRYSIDE, WEATHER_RAINY_SF,
-// };
-//
-// //static std::vector 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
-
ImGui::EndTabItem();
}
- //ImGui::EndChild();
-
- ImGui::EndTabBar();
- }
-
-}
-
-
-// This doesn't do anything yet, I would like to add a custom tab to the Cheat menu
+// Hud menu and Hud functions.
+// Comment out this define if this crashes.
+#ifdef _TEST
+ if (ImGui::BeginTabItem("Hud")) {
+ hudTestPage->HudTestMenu();
+ ImGui::EndTabItem();
+ }
+ #else
+ HudTestPage::HudTestMenu();
#endif //_TEST
-#ifdef _DISABLED_CODE
-// These weren't needed, leaving here for future reference.
-// //////////////
-// https://www.geeksforgeeks.org/convert-string-char-array-cpp/
-//const char* playerXChar = playerX.c_str();
-//const char* playerYChar = playerY.c_str();
-//const char* playerZChar = playerZ.c_str();
-//const char* playerXTest = static_cast(char_array);
-
-//https://www.tutorialspoint.com/How-to-convert-an-std-string-to-const-char-or-char-in-Cplusplus
-//const char* test = new char[playerCoords.x];
-//
-
-//https://cplusplus.com/forum/general/268793/
-//const char* s = new[std::strlen(playerXChar) + std::strlen(playerYChar) + 1];
-
-//https://stackoverflow.com/questions/347949/how-to-convert-a-stdstring-to-const-char-or-char
-//
-//const char* playerMessage = std::to_string(playerCoords.x) + ", " + std::to_string(playerCoords.y) + ", " + std::to_string(playerCoords.z);
-//const char* playerMessage = std::to_string(playerXChar) + ", " + std::to_string(playerCoords.y) + ", " + std::to_string(playerCoords.z);
-//const char* playerMessage(test);
-
-
-//Util::SetMessage("X: " + *playerXChar);
-//Util::SetMessage(std::to_string(playerCoords.x));
-//Util::SetMessage(playerMessage);
-//////////////////
-
-
-
-// Old
-/*
- if (ImGui::BeginTabBar("Test", ImGuiTabBarFlags_NoTooltip + ImGuiTabBarFlags_FittingPolicyScroll))
- {
- if (ImGui::BeginTabItem(TEXT("Test.TestVehicle")))
- {
- ImGui::Text("Vehicle Tab");
- //static int selected = Locale::GetCurrentLocaleIndex();
- //static std::vector& vec = Locale::GetLocaleList();
-
- ImGui::Text("Hello from KCNet");
- //}
- ImGui::EndTabItem();
+// World Menu & World Functions
+#ifdef _TEST
+
+ if (ImGui::BeginTabItem("World")) {
+ worldTestPage->WorldTestMenu();
+ ImGui::EndTabItem();
+ // Use original code.
+#else
+ WorldTestPage::WorldTestMenu();
+#endif //TEST
}
-
- if (ImGui::BeginTabItem(TEXT("Test.TestFeatures")))
- {
- ImGui::Text("Test Features");
- // ImGui::Text("Test Features");
- // //if (ImGui::BeginChild("CommandsChild"))
- // //{
- // // ImGui::Text("Hello from KCNet");
- // // //
- // // //if (ImGui::CollapsingHeader(TEXT("Menu.QuickVehSpawnerCMD")))
- // // //{
- // // // ImGui::Spacing();
- // // // ImGui::TextWrapped(TEXT("Menu.QuickVehSpawnerCMDText"));
- // // // ImGui::Spacing();
- // // // ImGui::Separator();
- // // //}
- // // //if (ImGui::CollapsingHeader(TEXT("Menu.QuickWepSpawnerCMD")))
- // // //{
- // // // ImGui::Spacing();
- // // // ImGui::TextWrapped(TEXT("Menu.QuickWepSpawnerCMDText"));
- // // // ImGui::Spacing();
- // // // ImGui::Separator();
- //}
- // // //
-
-
- ImGui::EndChild();
- ImGui::EndTabItem();
- ImGui::EndTabBar();
- }
-
- */
- //}
-
-
-// Get config data
-/*
-Events::initGameEvent += [this]()
- {
- };
-
-*/
-
-#endif //_DISABLED_CODE
\ No newline at end of file
+ ImGui::EndTabBar();
+ }
+
+}
+#endif //_TEST
diff --git a/src/test/test_world.cpp b/src/test/test_world.cpp
index d16245d..ab51201 100644
--- a/src/test/test_world.cpp
+++ b/src/test/test_world.cpp
@@ -2,11 +2,23 @@
#include "test_world.h"
#include "utils/widget.h"
+
+#ifdef GTASA
+#include "CCoronas.h"
+#include "CGeneral.h"
+#endif //GTASA
+
+// This is needed so it doesn't get unresvoled external symbol errors without using static.
+WorldTestPage::WorldTestPage()
+{
+
+}
+
void WeatherMenu()
{
// Weather
// Will these work?
-
+#ifdef GTASA
// Will giving this a default value fix the crashing? I think the weather is crashing it.
int defaultWeatherType = 0;
//eWeatherType defaultWeatherType = WEATHER_CLOUDY_COUNTRYSIDE;
@@ -17,6 +29,7 @@ void WeatherMenu()
// WEATHER_CLOUDY_VEGAS
//};
+
static std::vector allWeatherTypes = {
"Extra Sunny LA", "Sunny LA", "Smog LA", "Sunny Smog LA",
"Cloudy LA", "Sunny SF", "Extra Sunny SF", "Cloudy SF", "Rainy SF",
@@ -89,6 +102,7 @@ void WeatherMenu()
// How would I store the value for this?
//CWeather::ForceWeatherNow();
}
+#endif //GTASA
}
static void CreateCheckpointMenu()
@@ -115,8 +129,69 @@ static void RemoveCheckpointMenu()
+
+void CreateCoronaTestMenu()
+{
+ CPlayerPed* player = FindPlayerPed();
+ CVector playerCoords = player->GetPosition();
+
+ // Obtained from Entity.cpp on lines 580-602 in the Reversed gta sa project.
+ // This doesn't work at all.
+#ifdef _TEST
+ //auto fRand = static_cast(CGeneral::GetRandomNumberInRange() % 16) / 16.0F;
+ // CVector vecPos = CPlaceable::GetPosition();
+ //fRand = std::max(fRand, 0.5F);
+ int fRand = rand();
+ CCoronas::RegisterCorona(
+ // Idk how to use this.
+ reinterpret_cast(this),
+ nullptr,
+ static_cast(fRand * 255.0F),
+ static_cast(fRand * 220.0F),
+ static_cast(fRand * 190.0F),
+ 255,
+ playerCoords,
+ fRand * 6.0F,
+ 300.0F,
+ gpCoronaTexture[0],
+ eCoronaFlareType::FLARETYPE_NONE,
+ true,
+ false,
+ 0,
+ 0.0F,
+ false,
+ 1.5F,
+ 0,
+ 15.0F,
+ false,
+ false
+ );
+#endif //_TEST
+}
+
+static void RemoveCoronaTestMenu()
+{
+
+}
+
+
+///
+/// Main code for WorldTestMenu
+///
void WorldTestPage::WorldTestMenu()
{
+ // This doesn't seem to crash it being empty in here.
+ Events::initScriptsEvent += [this]()
+ {
+
+ };
+
+ /*
+ Events::processScriptsEvent += [this]()
+ {
+
+ };
+ */
/*
Refactor these to have the tabs in each file instead of in the test.cpp file
// TEXT(Test.TestWorldMenu) - Test World Menu
diff --git a/src/test/test_world.h b/src/test/test_world.h
index 8e5a64d..1162706 100644
--- a/src/test/test_world.h
+++ b/src/test/test_world.h
@@ -4,9 +4,12 @@
class WorldTestPage
{
private:
- WorldTestPage();
- WorldTestPage(const WorldTestPage&);
void Draw();
public:
- static void WorldTestMenu();
+ // I had to change these two values to public for this to work, even though they arent in use.
+ WorldTestPage();
+ WorldTestPage(const WorldTestPage&);
+ //
+ //static void WorldTestMenu();
+ void WorldTestMenu();
};