[SA] Add new features

This commit is contained in:
Grinch_ 2022-06-24 23:32:43 +06:00
parent d57c12e1a2
commit 582864cbda
10 changed files with 158 additions and 33 deletions

View File

@ -100,6 +100,7 @@ Missions = "Missions"
MissionStartFailed = "Can't start mission now"
MovementSpeed = "Movement speed"
Ninja = "Ninja"
NoWaterPhysics = "No water physics"
Overcast = "Overcast"
PlayerTeleported = "Player teleported"
ProgressBar = "Progress bar"
@ -122,6 +123,7 @@ Sunny = "Sunny"
SyncSystemTime = "Sync system time"
Themes = "Themes"
Thunderstorm = "Thunderstorm"
TotalMinutesDay = "Total minutes per day"
VerySunny = "Very sunny"
Weather = "Weather"
WeatherID = "Weather ID"
@ -456,6 +458,8 @@ FireProof = "Fire proof"
Fix = "Fix"
FixCar = "Fix vehicle"
FlipCar = "Flip vehicle"
FlipNoBurn = "No burn on flipped"
FlipNoBurnTip = "Vehicle won't burn when fliiped"
FloatOnHit = "Float away when hit"
ForceLevel = "Force level"
ForCurVeh = "For current vehicle,"
@ -485,7 +489,6 @@ LessTraffic = "Decreased traffic"
LightsOn = "Lights on"
LockDoor = "Lock doors"
LockSpeed = "Lock speed"
LockTrainCam = "Lock train camera"
Long = "Long"
LowerLimit = "Lower limit"
Mass = "Mass"
@ -494,10 +497,12 @@ MaxVelocity = "Max velocity"
MeleeProof = "Melee proof"
ModelFlags = "Model flags"
MonValue = "Monetary value"
LockTrainCam = "Lock train cam"
NeonsTab = "Neons"
NoColl = "Disable collisions"
NoNearVeh = "No nearby vehicles"
NoParticles = "Disable particles"
NoDerail = "No train derail"
NumGears = "Number of gears"
Off = "Off"
On = "On"
@ -587,6 +592,7 @@ BreathbarPosX = "Breath bar X"
BreathbarPosY = "Breath bar Y"
BreathBorder = "Breath border"
BreathPercentage = "Breath percentage"
CCTVEffect = "CCTV effect"
ClockColor = "Clock color"
ClockPosX = "Clock X"
ClockPosY = "Clock Y"
@ -596,6 +602,7 @@ CloudsLow = "Clouds low"
CloudsTop = "Clouds top"
ColorsTab = "Colors"
CurrentWeather = "Current weather"
DarknessFilter = "Darkness filter"
DefaultBorder = "Default border"
DefaultOutline = "Default outline"
DefaultStyle = "Default Style"
@ -603,12 +610,15 @@ DirectionalLight = "Directional light"
DirectionalMult = "Directional mult"
DisableHydrant = "Disable hydrant splash"
DrawMenuTitle = "Draw menu title border color"
UnderwaterEffect = "Underwater effect"
FarClip = "Far clip"
FileGenerated = "File generated"
FluffyClouds = "Fluffy clouds"
FogEffect = "Fog effect"
FogStart = "Fog start"
FreezeGameTime = "Freeze game time"
GenerateFile = "Generate timecyc file"
GrainEffect = "GrainEffect"
GrayRadar = "Gray radar"
GreenScanlines = "Green scanlines"
HealthbarColor = "Health bar color"
@ -616,6 +626,7 @@ HealthbarPosX = "Health bar X"
HealthbarPosY = "Health bar Y"
HealthBorder = "Health border"
HealthPercentage = "Health percentage"
HeatHazeEffect = "Heathaze effect"
HideAreaNames = "Hide area names"
HideHud = "Hide HUD"
HideRadar = "Hide radar"
@ -629,6 +640,7 @@ IncompatibleModsText = """
3. MobileHud
And others that change HUD drastically"""
InfraredVision = "Infrared vision"
InvisibleWater = "Invisible water"
LightBrightness = "Light on ground brightness"
LightIntensity = "High light min intensity"
@ -641,8 +653,12 @@ MoneyFontStyle = "Money font style"
MoneyPosX = "Money X"
MoneyPosY = "Money Y"
NextWeather = "Next weather"
NightVision = "Night vision"
NoBorder = "No border"
NoMoneyZeros = "No money zeros"
NoOutline = "No outline"
NoParticles = "No particle effects"
NoPostFX = "No postfx"
NoWater = "No water"
PoleShadowStrength = "Pole shadow strength"
PostFX1 = "PostFX 1"

View File

@ -532,7 +532,17 @@ void Game::ShowPage()
}
}
#ifdef GTASA
if (Ui::CheckboxWithHint(TEXT("Game.NoWaterPhysics"), &m_bNoWaterPhysics))
{
if (m_bNoWaterPhysics)
{
patch::Set<uint8_t>(0x6C2759, 1, true);
}
else
{
patch::Set<uint8_t>(0x6C2759, 0, true);
}
}
if (Ui::CheckboxWithHint(TEXT("Game.KeepStuff"), &m_bKeepStuff, TEXT("Game.KeepStuffText")))
{
Command<Commands::SWITCH_ARREST_PENALTIES>(m_bKeepStuff);
@ -626,6 +636,20 @@ void Game::ShowPage()
{TEXT("Game.Beach"), 0x969159}, {TEXT("Game.Country"), 0x96917D}, {TEXT("Game.FunHouse"), 0x969176}, {TEXT("Game.Ninja"), 0x96915C}
};
Ui::EditRadioButtonAddress(TEXT("Game.Themes"), themes);
if (ImGui::CollapsingHeader(TEXT("Game.TotalMinutesDay")))
{
static int min = 24;
if (ImGui::InputInt(TEXT("Game.Minute"), &min))
{
int val = min * 41.666666667f;
patch::Set<uint32_t>(0x5BA35F, val, true);
patch::Set<uint32_t>(0x53BDEC, val, true);
}
ImGui::Spacing();
ImGui::Separator();
}
#endif
if (ImGui::CollapsingHeader(TEXT("Game.Weather")))
{

View File

@ -34,6 +34,7 @@ private:
#ifdef GTASA
static inline bool m_bForbiddenArea = true; // wanted level when going outside playable aea
static inline bool m_bSolidWater; // walk on water hack
static inline bool m_bNoWaterPhysics;
static inline bool m_bScreenShot;
static inline bool m_bKeepStuff;
static inline ResourceStore m_StatData{ "stats", eResourceType::TYPE_TEXT };

View File

@ -31,11 +31,11 @@ public:
Log() = delete;
Log(Log&) = delete;
static void SetName(const char* logName) noexcept;
static inline void SetName(const char* logName) noexcept;
// Prints to log with current log level
template <eLogLevel T, typename... Args>
static void Print(std::string&& fmt, Args&&... args) noexcept
static inline void Print(std::string&& fmt, Args&&... args) noexcept
{
SetLogLevel(T);
if(!pLog)
@ -51,7 +51,7 @@ public:
}
template <eLogLevel T>
static void Print(const char* text) noexcept
static inline void Print(const char* text) noexcept
{
SetLogLevel(T);
if (!pLog)

View File

@ -357,28 +357,6 @@ bool Ui::CheckboxAddressVar(const char* label, bool val, int addr, const char* h
return rtn;
}
bool Ui::CheckboxAddressVarEx(const char* label, bool val, int addr, int enabled_val, int disabled_val,
const char* hint)
{
bool rtn = false;
bool state = val;
if (CheckboxWithHint(label, &state, hint))
{
if (state)
{
patch::SetRaw(addr, &enabled_val, 1, false);
}
else
{
patch::SetRaw(addr, &disabled_val, 1, false);
}
rtn = true;
}
return rtn;
}
bool Ui::CheckboxBitFlag(const char* label, uint flag, const char* hint)
{
bool rtn = false;

View File

@ -44,8 +44,8 @@ public:
static bool CheckboxAddressEx(const char* label, 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);
static bool CheckboxAddressVarEx(const char* label, bool val, int addr, int enabled_val, int disabled_val,
const char* hint = nullptr);
template <typename T>
static bool CheckboxAddressVarEx(const char* label, int addr, T enabled_val, T disabled_val, const char* hint = nullptr);
static bool CheckboxBitFlag(const char* label, uint flag, const char* hint = nullptr);
static bool CheckboxWithHint(const char* label, bool* state, const char* hint = nullptr, bool is_disabled = false);
@ -86,6 +86,27 @@ public:
static void ShowTooltip(const char* text);
};
template <typename T>
bool Ui::CheckboxAddressVarEx(const char* label, int addr, T enabled_val, T disabled_val, const char* hint)
{
bool rtn = false;
bool state = (patch::Get<T>(addr) == enabled_val);
if (CheckboxWithHint(label, &state, hint))
{
if (state)
{
patch::Set<T>(addr, enabled_val, false);
}
else
{
patch::Set<T>(addr, disabled_val, false);
}
rtn = true;
}
return rtn;
}
template <typename T>
void Ui::EditAddress(const char* label, const int address, const int min, const int def, const int max)
{

View File

@ -24,6 +24,10 @@ void Vehicle::Init()
FileHandler::FetchColorData(m_CarcolsColorData);
// Get config data
m_Spawner::m_bSpawnInAir = gConfig.Get("Features.SpawnAircraftInAir", true);
m_Spawner::m_bSpawnInside = gConfig.Get("Features.SpawnInsideVehicle", true);
Events::processScriptsEvent += []
{
uint timer = CTimer::m_snTimeInMilliseconds;
@ -579,7 +583,21 @@ void Vehicle::ShowPage()
}
}
#ifdef GTASA
Ui::CheckboxAddressEx(TEXT("Vehicle.LockTrainCam"), 0x52A52F, 171, 6);
Ui::CheckboxAddress(TEXT("Vehicle.LessTraffic"), 0x96917A);
if (Ui::CheckboxWithHint(TEXT("Vehicle.NoDerail"), &m_bNoDerail))
{
if (m_bNoDerail)
{
patch::Set<uint32_t>(0x6F8C2A, 0x00441F0F, true); // nop dword ptr [eax+eax*1+00h]
patch::Set<uint8_t>(0x6F8C2E, 0x00, true);
patch::Set<uint16_t>(0x6F8C41, 0xE990, true); // jmp near
}
else
{
patch::SetRaw(0x6F8C2A, (void*)"\x8A\x46\x36\xA8\xF8\xD8\x8E", 7);
}
}
// if (Ui::CheckboxWithHint(TEXT("Vehicle.NoColl"), &m_bDisableColDetection))
// {
// if (m_bDisableColDetection)
@ -632,7 +650,6 @@ void Vehicle::ShowPage()
Ui::CheckboxAddress(TEXT("Vehicle.DriveWater"), BY_GAME(0x969152, 0xA10B81, NULL));
#endif
#ifdef GTASA
Ui::CheckboxAddressEx(TEXT("Vehicle.LockTrainCam"), 0x52A52F, 171, 6);
Ui::CheckboxAddress(TEXT("Vehicle.FloatOnHit"), 0x969166);
#endif
#ifndef GTA3
@ -643,6 +660,25 @@ void Vehicle::ShowPage()
Ui::CheckboxAddress(TEXT("Vehicle.TankMode"), 0x969164);
Ui::CheckboxWithHint(TEXT("Vehicle.InfNitro"), &m_UnlimitedNitro::m_bEnabled, TEXT("Vehicle.InfNitroTip"));
if (Ui::CheckboxWithHint(TEXT("Vehicle.FlipNoBurn"), &m_bVehFlipNoBurn, TEXT("Vehicle.FlipNoBurnTip")))
{
// MixSets (Link2012)
if (m_bVehFlipNoBurn)
{
// Patch ped vehicles damage when flipped
patch::SetRaw(0x6A776B, (void*)"\xD8\xDD\x00\x00\x00\x00", 6); // fstp st0, nop 4
// Patch player vehicle damage when flipped
patch::SetRaw(0x570E7F, (void*)"\xD8\xDD\x00\x00\x00\x00", 6); // fstp st0, nop 4
}
else
{
// restore patches
patch::SetRaw(0x6A776B, (void*)"\xD9\x9E\xC0\x04\x00\x00", 6);
patch::SetRaw(0x570E7F, (void*)"\xD9\x99\xC0\x04\x00\x00", 6); // fstp dword ptr [ecx+4C0h]
}
}
#elif GTA3
Ui::CheckboxAddress(TEXT("Vehicle.PerfectHandling"), 0x95CD66);
#endif
@ -982,9 +1018,15 @@ void Vehicle::ShowPage()
{
ImGui::Spacing();
ImGui::Columns(2, 0, false);
Ui::CheckboxWithHint(TEXT("Vehicle.SpawnInside"), &m_Spawner::m_bSpawnInside);
if (Ui::CheckboxWithHint(TEXT("Vehicle.SpawnInside"), &m_Spawner::m_bSpawnInside))
{
gConfig.Set("Features.SpawnInsideVehicle", m_Spawner::m_bSpawnInside);
}
ImGui::NextColumn();
Ui::CheckboxWithHint(TEXT("Vehicle.SpawnInAir"), &m_Spawner::m_bSpawnInAir);
if( Ui::CheckboxWithHint(TEXT("Vehicle.SpawnInAir"), &m_Spawner::m_bSpawnInAir))
{
gConfig.Set("Features.SpawnAircraftInAir", m_Spawner::m_bSpawnInAir);
}
ImGui::Columns(1);
ImGui::Spacing();

View File

@ -27,6 +27,9 @@ private:
#ifdef GTASA
static inline bool m_bDisableColDetection;
static inline bool m_bVehFlipNoBurn;
static inline bool m_bMoreTrainCams;
static inline bool m_bNoDerail;
static inline std::map<int, std::string> m_VehicleIDE;
struct m_Neon
{

View File

@ -360,6 +360,8 @@ void Visual::ShowPage()
Ui::CheckboxAddress(TEXT("Visual.ArmourPercentage"), 0x589125);
Ui::CheckboxAddress(TEXT("Visual.BreathBorder"), 0x589207);
Ui::CheckboxAddress(TEXT("Visual.BreathPercentage"), 0x589209);
Ui::CheckboxAddress(TEXT("Visual.CCTVEffect"), 0xC402C5);
Ui::CheckboxAddress(TEXT("Visual.DarknessFilter"), 0xC402C4);
if (Ui::CheckboxWithHint(TEXT("Visual.DisableHydrant"), &m_bDisableHydrant))
{
if (m_bDisableHydrant)
@ -372,9 +374,14 @@ void Visual::ShowPage()
plugin::patch::SetRaw(0x4A0D70, (char*)"\xE9\x94\x3F\xF6\xFF", 5);
}
}
Ui::CheckboxAddress(TEXT("Visual.FogEffect"), 0xC402C6);
Ui::CheckboxAddress(TEXT("Visual.GrainEffect"), 0xC402B4);
Ui::CheckboxAddress(TEXT("Visual.GrayRadar"), 0xA444A4);
Ui::CheckboxAddress(TEXT("Visual.HealthBorder"), 0x589353);
Ui::CheckboxAddress(TEXT("Visual.HealthPercentage"), 0x589355);
Ui::CheckboxAddress(TEXT("Visual.HeatHazeEffect"), 0xC402BA);
if (Ui::CheckboxWithHint(TEXT("Visual.HideAreaNames"), &CHud::bScriptDontDisplayAreaName))
{
Command<Commands::DISPLAY_ZONE_NAMES>(!CHud::bScriptDontDisplayAreaName);
@ -388,7 +395,7 @@ void Visual::ShowPage()
}
Ui::CheckboxAddressEx(TEXT("Visual.HideWantedLevel"), 0x58DD1B, 0x90, 1);
Ui::CheckboxAddress(TEXT("Visual.InfraredVision"), 0xC402B9);
if (Ui::CheckboxWithHint(TEXT("Visual.InvisibleWater"), &m_bInvisibleWater))
{
if (!m_bNoWater)
@ -408,6 +415,34 @@ void Visual::ShowPage()
}
}
Ui::CheckboxWithHint(TEXT("Visual.LockWeather"), &m_bLockWeather);
Ui::CheckboxAddress(TEXT("Visual.NightVision"), 0xC402B8);
if (Ui::CheckboxWithHint(TEXT("Visual.NoMoneyZeros"), &m_bNoMoneyZeros))
{
static const char *pos = "$%d", *neg = "-$%d";
if(m_bNoMoneyZeros)
{
patch::Set<const char*>(0x58F4C8, pos, true); //positive
patch::Set<const char*>(0x58F50A, neg, true); //negative
}
else
{
patch::SetRaw(0x58F4C8, (void*)"\x94\x6C\x86\x00", 4);
patch::SetRaw(0x58F50A, (void*)"\x8C\x6C\x86\x00", 4);
}
}
if (Ui::CheckboxWithHint(TEXT("Visual.NoParticles"), &m_bNoPartciles))
{
if(m_bNoPartciles)
{
patch::Set<uint32_t>(0x4AA440, 0x000020C2, true);
}
else
{
patch::Set<uint32_t>(0x4AA440, 0x5608EC83, true);
}
}
Ui::CheckboxAddress(TEXT("Visual.NoPostFX"), 0xC402CF);
if (Ui::CheckboxWithHint(TEXT("Visual.NoWater"), &m_bNoWater))
{
if (m_bNoWater)
@ -437,6 +472,7 @@ void Visual::ShowPage()
}
Ui::CheckboxAddress(TEXT("Visual.ShowHud"), 0xBA6769);
Ui::CheckboxAddress(TEXT("Visual.UnderwaterEffect"), 0xC402D3);
Ui::CheckboxAddressEx(TEXT("Visual.UnfogMap"), 0xBA372C, 0x50, 0x0, TEXT("Visual.UnfogMapText"));
#elif GTAVC
Ui::CheckboxAddress(TEXT("Visual.HideRadar"), 0xA10AB6);

View File

@ -10,6 +10,10 @@ private:
static inline bool m_bInvisibleWater;
static inline bool m_bNoWater;
static inline bool m_bDisableHydrant;
static inline bool m_bNoMoneyZeros;
static inline bool m_bNoPartciles;
static inline bool m_bNoPostFX;
static inline bool m_bNoTextures;
#endif
// Timecyc stuff