Fix crash with weatherID changer

This commit is contained in:
Grinch_ 2022-03-18 13:23:43 +06:00
parent 9b5a5d3be9
commit 488035483c
10 changed files with 50 additions and 34 deletions

View File

@ -125,6 +125,7 @@
"GitHubRepo": "GitHub repo",
"GodModeKey": "Toggle god mode",
"Hotkeys": "Hotkeys",
"InvalidValue": "Invalid value",
"Language": "Language",
"LanguageChangeFailed": "Failed to change language!",
"Name": "Name",
@ -460,6 +461,12 @@
"Watertight": "Watertight car",
"WatertightTip": "Peds inside won't drown if the vehicle\nis submerged in water"
},
"Updater":
{
"Failed" : "Failed to check for updates",
"Found" : "Update found",
"NotFound" : "No update found"
},
"Visual": {
"Ambient": "Ambient",
"AmbientBl": "Ambient bl",

View File

@ -23,7 +23,7 @@ void Animation::PlayCutscene(std::string& rootKey, std::string& cutsceneId, std:
{
if (Util::IsOnCutscene())
{
SetHelpMessage(TEXT("Animation.CutsceneRunning"), false, false, false);
SetHelpMessage(TEXT("Animation.CutsceneRunning"));
return;
}

View File

@ -93,7 +93,7 @@ void CheatMenu::ProcessPages()
{
/*
* We don't want to be annoying and
* show anniversary screen on every game start
* show anniversary screen on game start
*/
bool flag = gConfig.GetValue("window.anniversaryShown", false);
@ -200,17 +200,15 @@ void CheatMenu::Init()
return;
}
ApplyStyle();
// Load menu settings
m_nMenuPage = (eMenuPages)gConfig.GetValue("window.page", (size_t)eMenuPages::WELCOME);
m_fMenuSize.x = gConfig.GetValue("window.sizeX", screen::GetScreenWidth() / 4.0f);
m_fMenuSize.y = gConfig.GetValue("window.sizeY", screen::GetScreenHeight() / 1.2f);
srand(CTimer::m_snTimeInMilliseconds);
ApplyStyle();
Locale::Init("CheatMenu/locale/", "English", "English");
CheatMenu::GenHeaderList();
GenHeaderList();
// Init menu parts
Animation::Init();

View File

@ -683,6 +683,15 @@ void Game::ShowPage()
static int weatherID = 0;
if (ImGui::InputInt(TEXT("Game.WeatherID"), &weatherID))
{
if (weatherID < 0)
{
weatherID = 255;
}
if (weatherID > 255)
{
weatherID = 0;
}
CWeather::OldWeatherType = weatherID;
CWeather::NewWeatherType = weatherID;
}

View File

@ -262,7 +262,7 @@ void Menu::ProcessCommands()
}
catch (...)
{
SetHelpMessage("Invalid value", false, false, false);
SetHelpMessage(TEXT("Menu.InvalidValue"));
}
}
@ -279,7 +279,7 @@ void Menu::ProcessCommands()
}
catch (...)
{
SetHelpMessage("Invalid value", false, false, false);
SetHelpMessage(TEXT("Menu.InvalidValue"));
}
}
@ -304,7 +304,7 @@ void Menu::ProcessCommands()
}
catch (...)
{
SetHelpMessage("Invalid location", false, false, false);
SetHelpMessage("Invalid location");
}
}
@ -317,7 +317,7 @@ void Menu::ProcessCommands()
{
std::string weapon = "-1";
Weapon::GiveWeaponToPlayer(weapon);
SetHelpMessage("Weapon given", false, false, false);
SetHelpMessage("Weapon given");
}
else
{
@ -328,10 +328,10 @@ void Menu::ProcessCommands()
if (wep_name != "" && pweaponinfo->m_nModelId1 != -1)
{
Weapon::GiveWeaponToPlayer(weapon_name);
SetHelpMessage("Weapon given", false, false, false);
SetHelpMessage("Weapon given");
}
else
SetHelpMessage("Invalid command", false, false, false);
SetHelpMessage("Invalid command");
}
return;
@ -346,10 +346,10 @@ void Menu::ProcessCommands()
{
std::string smodel = std::to_string(model);
Vehicle::SpawnVehicle(smodel);
SetHelpMessage("Vehicle spawned", false, false, false);
SetHelpMessage("Vehicle spawned");
}
else
SetHelpMessage("Invalid command", false, false, false);
SetHelpMessage("Invalid command");
}
#endif
}

View File

@ -43,7 +43,7 @@ void Updater::Process()
if (res == E_OUTOFMEMORY || res == INET_E_DOWNLOAD_FAILURE)
{
SetHelpMessage("Failed to check for updates", false, false, false);
SetHelpMessage(TEXT("Updater.Failed"));
return;
}
@ -61,12 +61,12 @@ void Updater::Process()
if (latestVer > MENU_VERSION_NUMBER)
{
SetHelpMessage("Update found", false, false, false);
SetHelpMessage(TEXT("Updater.Found"));
curState = States::FOUND;
}
else
{
SetHelpMessage("No update found.", false, false, false);
SetHelpMessage(TEXT("Updater.NotFound"));
Updater::curState = States::IDLE;
}
}

View File

@ -26,9 +26,11 @@ public:
static bool IsUpdateAvailable();
/*
Just downloading file from a click counter site
Redirects to the versioninfo.json file of github
This probably shouldn't impose any privacy concerns?
Just downloading counter.info file from GitHub repository
Initial plan was to add google analytics but people will freak
out about that (though every site has it in some form)
Pretty barebones but this shouldn't raise any concerns (i hope)
*/
static void IncrementDailyUsageCounter();

View File

@ -42,7 +42,7 @@ void Vehicle::Init()
if (fixVeh.Pressed())
{
Util::FixVehicle(pVeh);
SetHelpMessage("Vehicle fixed", false, false, false);
SetHelpMessage("Vehicle fixed");
}
if (vehEngine.Pressed())
@ -51,11 +51,11 @@ void Vehicle::Init()
if (state)
{
SetHelpMessage("Vehicle engine off", false, false, false);
SetHelpMessage("Vehicle engine off");
}
else
{
SetHelpMessage("Vehicle engine on", false, false, false);
SetHelpMessage("Vehicle engine on");
}
#ifdef GTASA
pVeh->m_nVehicleFlags.bEngineBroken = state;
@ -207,7 +207,7 @@ void Vehicle::AddComponent(const std::string& component, const bool display_mess
CStreaming::SetModelIsDeletable(icomp);
if (display_message)
SetHelpMessage("Component added", false, false, false);
SetHelpMessage("Component added");
}
catch (...)
{
@ -228,7 +228,7 @@ void Vehicle::RemoveComponent(const std::string& component, const bool display_m
if (display_message)
{
SetHelpMessage("Component removed", false, false, false);
SetHelpMessage("Component removed");
}
}
catch (...)
@ -263,7 +263,7 @@ int Vehicle::GetRandomTrainIdForModel(int model)
_end = 10;
break;
default:
SetHelpMessage("Invalid train model", false, false, false);
SetHelpMessage("Invalid train model");
return -1;
}
int id = Random(_start, _end);
@ -1028,7 +1028,7 @@ void Vehicle::ShowPage()
if (ImGui::Button(TEXT("Vehicle.ResetColor"), ImVec2(Ui::GetSize())))
{
Paint::ResetNodeColor(veh, m_Paint::m_Selected);
SetHelpMessage(TEXT("Vehicle.ResetColorMSG"), false, false, false);
SetHelpMessage(TEXT("Vehicle.ResetColorMSG"));
}
ImGui::Spacing();
@ -1098,7 +1098,7 @@ void Vehicle::ShowPage()
if (ImGui::Button(TEXT("Vehicle.RemoveNeon"), ImVec2(Ui::GetSize())))
{
Neon::Remove(veh);
SetHelpMessage(TEXT("Vehicle.RemoveNeonMSG"), false, false, false);
SetHelpMessage(TEXT("Vehicle.RemoveNeonMSG"));
}
ImGui::Spacing();
@ -1160,7 +1160,7 @@ void Vehicle::ShowPage()
if (ImGui::Button(TEXT("Vehicle.ResetTexture"), ImVec2(Ui::GetSize())))
{
Paint::ResetNodeTexture(veh, m_Paint::m_Selected);
SetHelpMessage(TEXT("Vehicle.ResetTextureMSG"), false, false, false);
SetHelpMessage(TEXT("Vehicle.ResetTextureMSG"));
}
ImGui::Spacing();
@ -1242,7 +1242,7 @@ void Vehicle::ShowPage()
if (ImGui::Button(TEXT("Vehicle.ResetHandling"), ImVec2(Ui::GetSize(3))))
{
gHandlingDataMgr.LoadHandlingData();
SetHelpMessage(TEXT("Vehicle.ResetHandlingMSG"), false, false, false);
SetHelpMessage(TEXT("Vehicle.ResetHandlingMSG"));
}
ImGui::SameLine();
@ -1250,7 +1250,7 @@ void Vehicle::ShowPage()
if (ImGui::Button(TEXT("Vehicle.SaveFile"), ImVec2(Ui::GetSize(3))))
{
FileHandler::GenerateHandlingFile(pHandlingData, m_VehicleIDE);
SetHelpMessage(TEXT("Vehicle.SaveFileMSG"), false, false, false);
SetHelpMessage(TEXT("Vehicle.SaveFileMSG"));
}
ImGui::SameLine();

View File

@ -2,5 +2,5 @@
#define MENU_NAME "Cheat Menu"
#define MENU_VERSION_NUMBER "3.2"
#define MENU_VERSION MENU_VERSION_NUMBER"-beta"
#define BUILD_NUMBER "20220316"
#define BUILD_NUMBER "20220317"
#define MENU_TITLE MENU_NAME " v" MENU_VERSION

View File

@ -625,7 +625,7 @@ void Visual::ShowPage()
if (ImGui::Button(TEXT("Visual.ResetTimecyc"), Ui::GetSize(2)))
{
CTimeCycle::Initialise();
SetHelpMessage(TEXT("Visual.TimecycReset"), false, false, false);
SetHelpMessage(TEXT("Visual.TimecycReset"));
}
ImGui::Spacing();