Add nospread, auto unflip, lockCamZoom

This commit is contained in:
Grinch_ 2022-07-17 00:29:32 +06:00
parent 4615338c9e
commit 1305f85382
12 changed files with 108 additions and 15 deletions

View File

@ -42,6 +42,10 @@ WalkingStyleSet = "Walking style set"
ActivateTimer = "Activate cheat timer"
ActivateTimerText = "Time for the next cheat activation"
Beach = "Beach"
CameraZoom = "Camera zoom"
CameraZoomLock = "Lock camera zoom"
CameraZoomLockFreecam = "Freecam is enabled. Camera zoom can't work together with freecam mode"
CameraZoomLockInfo = "Note: This will permanently lock camera zoom. Snipers or scopes won't work properly!"
Cloudy = "Cloudy"
Country = "Country"
CurrentDay = "Current day"
@ -99,6 +103,7 @@ PlayerTeleported = "Player teleported"
ProgressBar = "Progress bar"
Rainy = "Rainy"
RandomCheats = "Random cheats"
ResetDefault = "Reset to default"
Sandstorm = "Sandstorm"
SaveGame = "Save game (might cause game bugs)"
Screenshot = "Screenshot shortcut"
@ -132,6 +137,7 @@ TranslatorName = "Grinch_"
[Menu]
About = "About"
Author = "Author"
AutoCheckUpdate = "Check for updates"
BugDisclaimer = "If you find bugs or have suggestions, let me know on discord."
Build = "Build"
CheatMenuNoDir = "Failed to find CheatMenu directory!"
@ -220,7 +226,7 @@ Teleports player to specified coordinates.
Example: tp x y z"""
TextColor = "Text color"
TextOnlyMode = "Text only"
TextOnlyModeHint = "Disables all images and shows only text"
TextOnlyModeHint = "Replace images with their appropriate texts"
TPMarkerKey = "Teleport to marker"
Usage = "Usage"
UpdaterInfo1 = "It's highly recommanded to update to the latest version. Newer version contains new features and bug fixes."
@ -417,6 +423,7 @@ All = "All"
AllNitro = "All cars have nitro"
AllTaxiNitro = "All taxis have nitro"
AnimGroup = "Anim group"
AutoUnflip = "Auto unflip"
Big = "Big"
BikeFly = "Bikes fly"
Black = "Black"
@ -743,6 +750,7 @@ InfiniteAmmo = "Infinite ammo"
LongRange = "Long range"
MoveWhenAiming = "Move when aiming"
MoveWhenFiring = "Move when firing"
NoSpread = "No spread"
RapidFire = "Rapid fire"
SelectGang = "Select gang"
Weapon1 = "Weapon 1"

View File

@ -195,7 +195,15 @@ void Freecam::Clear()
Command<Commands::DELETE_CHAR>(m_nPed);
m_pPed = nullptr;
Command<Commands::CAMERA_PERSIST_FOV>(false);
// restore lock camera zoom here
if (Game::m_bLockCameraZoom)
{
TheCamera.LerpFOV(TheCamera.FindCamFOV(), Game::m_nCameraZoom, 250, true);
}
else
{
Command<Commands::CAMERA_PERSIST_FOV>(false);
}
Command<Commands::RESTORE_CAMERA_JUMPCUT>();
}
@ -304,6 +312,7 @@ static void RealTimeClock()
void Game::Init()
{
#ifdef GTASA
Events::drawMenuBackgroundEvent += []()
{
if (bSaveGameFlag)
@ -605,8 +614,55 @@ void Game::ShowPage()
}
if (ImGui::BeginTabItem(TEXT("Window.MenusTab")))
{
ImGui::Spacing();
ImGui::BeginChild("##Menus");
#ifdef GTASA
if (ImGui::CollapsingHeader(TEXT("Game.CameraZoom")))
{
ImGui::Spacing();
if (Freecam::m_bEnabled)
{
ImGui::TextWrapped(TEXT("Game.CameraZoomLockFreecam"));
}
else
{
if (Widget::Checkbox(TEXT("Game.CameraZoomLock"), &m_bLockCameraZoom))
{
if (!m_bLockCameraZoom)
{
Command<Commands::CAMERA_PERSIST_FOV>(false);
}
}
ImGui::Spacing();
if (!m_bLockCameraZoom)
{
ImGui::BeginDisabled();
}
if (ImGui::SliderInt(TEXT("Game.CameraZoom"), &m_nCameraZoom, 5, 120))
{
TheCamera.LerpFOV(TheCamera.FindCamFOV(), m_nCameraZoom, 250, true);
Command<Commands::CAMERA_PERSIST_FOV>(true);
}
ImGui::Spacing();
if (ImGui::Button(TEXT("Game.ResetDefault"), Widget::CalcSize()))
{
m_nCameraZoom = 70.0f;
TheCamera.LerpFOV(TheCamera.FindCamFOV(), 70.0f, 250, true);
Command<Commands::CAMERA_PERSIST_FOV>(true);
}
if (m_bLockCameraZoom)
{
ImGui::TextWrapped(TEXT("Game.CameraZoomLockInfo"));
}
else
{
ImGui::EndDisabled();
}
}
ImGui::Spacing();
ImGui::Separator();
}
if (ImGui::CollapsingHeader(TEXT("Game.CurrentDay")))
{
int day = CClock::CurrentDay - 1;
@ -617,7 +673,7 @@ void Game::ShowPage()
ImGui::Spacing();
ImGui::Separator();
}//0xC17040
}
#endif
Widget::EditAddr<int>(TEXT("Game.DaysPassed"), BY_GAME(0xB79038, 0x97F1F4, 0x8F2BB8), 0, 9999);
Widget::EditAddr<int>(TEXT("Game.FPSLimit"), (uint)&(RsGlobal.maxFPS), 1, 30, 999);
@ -774,7 +830,10 @@ void Game::ShowPage()
}
ImGui::Spacing();
ImGui::SliderFloat(TEXT("Game.FieldOfView"), &Freecam::m_fFOV, 5.0f, 120.0f);
if (ImGui::SliderFloat(TEXT("Game.FieldOfView"), &Freecam::m_fFOV, 5.0f, 120.0f) && Freecam::m_bEnabled)
{
TheCamera.LerpFOV(TheCamera.FindCamFOV(), Freecam::m_fFOV, 250, true);
}
ImGui::SliderInt(TEXT("Game.MovementSpeed"), &Freecam::m_nMul, 1, 10);
ImGui::Dummy(ImVec2(0.0f, 20.0f));

View File

@ -68,6 +68,11 @@ public:
static inline bool m_bFreezeTime;
static inline bool m_bSyncTime;
#ifdef GTASA
static inline int m_nCameraZoom = 70.0f;
static inline bool m_bLockCameraZoom;
#endif
Game() = delete;
Game(const Game&) = delete;

View File

@ -474,7 +474,7 @@ void Menu::ShowPage()
ImGui::Dummy(ImVec2(0, 10));
fixVeh.DrawUI(TEXT("Menu.FixVehKey"));
flipVeh.DrawUI(TEXT("Menu.FlipVehKey"));
unflipVeh.DrawUI(TEXT("Menu.FlipVehKey"));
godMode.DrawUI(TEXT("Menu.GodModeKey"));
vehEngine.DrawUI(TEXT("Menu.VehEngineKey"));
vehInstantStart.DrawUI(TEXT("Menu.VehStartKey"));

View File

@ -12,7 +12,7 @@ Hotkey freeCamRight {VK_KEY_D, VK_KEY_D, "Freecam.Right"};
Hotkey freeCamTeleport {VK_RETURN, VK_RETURN, "Freecam.Teleport"};
Hotkey commandWindow {VK_LCONTROL, VK_KEY_C, "CommandWindowToggle"};;
Hotkey fixVeh {VK_NONE, VK_NONE, "Vehicle.Fix"};
Hotkey flipVeh {VK_NONE, VK_NONE, "Vehicle.Flip"};
Hotkey unflipVeh {VK_NONE, VK_NONE, "Vehicle.Flip"};
Hotkey godMode {VK_NONE, VK_NONE, "GodMode"};
Hotkey menuOpen {VK_LCONTROL, VK_KEY_M, "MenuToggle"};
Hotkey quickSceenShot {VK_F5, VK_F5, "QuickScreenshot"};

View File

@ -107,7 +107,7 @@ extern Hotkey freeCamRight;
extern Hotkey freeCamTeleport;
extern Hotkey commandWindow;
extern Hotkey fixVeh;
extern Hotkey flipVeh;
extern Hotkey unflipVeh;
extern Hotkey godMode;
extern Hotkey menuOpen;
extern Hotkey quickSceenShot;

View File

@ -42,7 +42,7 @@ void Util::FixVehicle(CVehicle *pVeh)
pVeh->m_fHealth = 1000.0f;
}
void Util::FlipVehicle(CVehicle *pVeh)
void Util::UnFlipVehicle(CVehicle *pVeh)
{
#ifdef GTASA
int hveh = CPools::GetVehicleRef(pVeh);

View File

@ -24,7 +24,7 @@ public:
static bool IsOnMission();
#endif
static void FlipVehicle(CVehicle *pVeh);
static void UnFlipVehicle(CVehicle *pVeh);
static void FixVehicle(CVehicle *pVeh);
static CPed* GetClosestPed();
static CVehicle* GetClosestVehicle();

View File

@ -37,10 +37,15 @@ void Vehicle::Init()
if (pPlayer && Util::IsInVehicle())
{
int hveh = CPools::GetVehicleRef(pVeh);
if (flipVeh.Pressed())
float speed = pVeh->m_vecMoveSpeed.Magnitude() * 50.0f;
if (m_bAutoUnflip && pVeh->IsUpsideDown() && speed < 2.0f)
{
Util::FlipVehicle(pVeh);
Util::UnFlipVehicle(pVeh);
}
if (unflipVeh.Pressed())
{
Util::UnFlipVehicle(pVeh);
}
if (fixVeh.Pressed())
@ -525,13 +530,13 @@ void Vehicle::ShowPage()
if (ImGui::Button(TEXT("Vehicle.FlipCar"), ImVec2(Widget::CalcSize(3))) && Util::IsInVehicle())
{
Util::FlipVehicle(pVeh);
Util::UnFlipVehicle(pVeh);
}
ImGui::Spacing();
if (ImGui::BeginTabBar("Vehicle", ImGuiTabBarFlags_NoTooltip + ImGuiTabBarFlags_FittingPolicyScroll))
{
{
CVehicle* pVeh = pPlayer->m_pVehicle;
bool is_driver = pVeh && (pPlayer->m_pVehicle->m_pDriver == pPlayer);
@ -547,6 +552,8 @@ void Vehicle::ShowPage()
Widget::CheckboxAddr(TEXT("Vehicle.AllNitro"), 0x969165);
#endif
Widget::Checkbox(TEXT("Vehicle.AutoUnflip"), &m_bAutoUnflip);
#ifndef GTA3
Widget::CheckboxAddr(TEXT("Vehicle.AggroDriver"), BY_GAME(0x96914F,0xA10B47, NULL));
Widget::CheckboxAddr(TEXT("Vehicle.AllTaxiNitro"), BY_GAME(0x96918B,0xA10B3A, NULL));

View File

@ -4,6 +4,7 @@
class Vehicle
{
private:
static inline bool m_bAutoUnflip;
static inline bool m_bBikeFly;
static inline bool m_bDontFallBike;
static inline bool m_bVehHeavy;

View File

@ -78,6 +78,11 @@ void Weapon::Init()
pWeaponInfo->m_nFlags.bMoveAim = true;
}
if (m_bNoSpread)
{
pWeaponInfo->m_fAccuracy = 100.0f;
}
if (m_bMoveFire)
{
pWeaponInfo->m_nFlags.bMoveFire = true;
@ -326,6 +331,13 @@ void Weapon::ShowPage()
CWeaponInfo::LoadWeaponData();
}
}
if (Widget::Checkbox(TEXT("Weapon.NoSpread"), &m_bNoSpread))
{
if (!m_bNoSpread)
{
CWeaponInfo::LoadWeaponData();
}
}
if (Widget::Checkbox(TEXT("Weapon.RapidFire"), &m_bRapidFire))
{
if (!m_bRapidFire)

View File

@ -16,6 +16,7 @@ private:
static inline bool m_bDualWeild;
static inline bool m_bMoveAim;
static inline bool m_bMoveFire;
static inline bool m_bNoSpread;
static inline int m_nSelectedGang;
static inline int m_nGangWeaponList[10][3] =
{