More hotkeys, hard mode

This commit is contained in:
Grinch_ 2021-02-02 13:59:01 +06:00
parent 9810ff2edf
commit 30ea854c7c
7 changed files with 83 additions and 7 deletions

View File

@ -1,6 +1,6 @@
#include "pch.h"
#include "Game.h"
#include "Menu.h"
#include "Game.h"
#include "Ui.h"
#include "Util.h"
#include "CIplStore.h"
@ -33,6 +33,12 @@ float Game::freecam::mouseY = 0;
int Game::freecam::hped = -1;
CPed *Game::freecam::ped = nullptr;
bool Game::hard_mode::state = false;
float Game::hard_mode::prev_armour = 0.0f;
float Game::hard_mode::prev_health = 0.0f;
float Game::hard_mode::prev_max_health = 0.0f;
float Game::hard_mode::prev_stamina = 0.0f;
bool Game::disable_cheats = false;
bool Game::disable_replay = false;
bool Game::forbidden_area_wl = true;
@ -107,6 +113,16 @@ Game::Game()
}
}
if (hard_mode::state)
{
if (player->m_fHealth > 50.0f)
player->m_fHealth = 50.0f;
player->m_fArmour = 0.0f;
CStats::SetStatValue(STAT_MAX_HEALTH, 350.0f);
CStats::SetStatValue(STAT_STAMINA, 0.0f);
}
if (solid_water)
{
CVector pos = player->GetPosition();
@ -353,11 +369,34 @@ of LS without completing missions"))
Ui::CheckboxAddress("Free pay n spray", 0x96C009);
ImGui::NextColumn();
if (ImGui::Checkbox("Freeze misson timer", &freeze_mission_timer))
Command<Commands::FREEZE_ONSCREEN_TIMER>(freeze_mission_timer);
ImGui::NextColumn();
if (Ui::CheckboxWithHint("Hard mode", &hard_mode::state, "Makes the game more challanging to play. "
"Lowers\narmour, health, stamina etc."))
{
CPlayerPed *player = FindPlayerPed();
if (hard_mode::state)
{
hard_mode::prev_armour = player->m_fArmour;
hard_mode::prev_health = player->m_fHealth;
hard_mode::prev_max_health = CStats::GetStatValue(STAT_MAX_HEALTH);
hard_mode::prev_stamina = CStats::GetStatValue(STAT_STAMINA);
player->m_fHealth = 50.0f;
}
else
{
player->m_fArmour = hard_mode::prev_armour;
CStats::SetStatValue(STAT_STAMINA,hard_mode::prev_stamina);
CStats::SetStatValue(STAT_MAX_HEALTH, hard_mode::prev_max_health);
player->m_fHealth = hard_mode::prev_health;
CWeaponInfo::LoadWeaponData();
}
}
if (Ui::CheckboxWithHint("Keep stuff", &keep_stuff, "Keep stuff after arrest/death"))
{
Command<Commands::SWITCH_ARREST_PENALTIES>(keep_stuff);

View File

@ -29,6 +29,15 @@ public:
static float mouseX, mouseY, tmouseX, tmouseY;
};
struct hard_mode
{
static bool state;
static float prev_health;
static float prev_max_health;
static float prev_armour;
static float prev_stamina;
};
static bool disable_cheats;
static bool disable_replay;
static bool forbidden_area_wl;

View File

@ -28,6 +28,8 @@ HotKeyData Menu::hotkeys::menu_open{};
HotKeyData Menu::hotkeys::quick_ss{};
HotKeyData Menu::hotkeys::quick_tp{};
HotKeyData Menu::hotkeys::veh_engine{};
HotKeyData Menu::hotkeys::veh_instant_start{};
HotKeyData Menu::hotkeys::veh_instant_stop{};
bool Menu::commands::show_menu = false;
char Menu::commands::input_buffer[INPUT_BUFFER_SIZE] = "";
@ -78,6 +80,12 @@ Menu::Menu()
hotkeys::veh_engine.key1 = config.GetValue("hotkey.veh_engine.key1", VK_NONE);
hotkeys::veh_engine.key2 = config.GetValue("hotkey.veh_engine.key2", VK_NONE);
hotkeys::veh_instant_start.key1 = config.GetValue("hotkey.veh_instant_start.key1", VK_NONE);
hotkeys::veh_instant_start.key2 = config.GetValue("hotkey.veh_instant_start.key2", VK_NONE);
hotkeys::veh_instant_stop.key1 = config.GetValue("hotkey.veh_instant_stop.key1", VK_NONE);
hotkeys::veh_instant_stop.key2 = config.GetValue("hotkey.veh_instant_stop.key2", VK_NONE);
};
}
@ -396,6 +404,18 @@ void Menu::Main()
config.SetValue("hotkey.veh_engine.key2", hotkeys::veh_engine.key2);
}
if (Ui::HotKey("Vehicle instant start", hotkeys::veh_instant_start))
{
config.SetValue("hotkey.veh_instant_start.key1", hotkeys::veh_instant_start.key1);
config.SetValue("hotkey.veh_instant_start.key2", hotkeys::veh_instant_start.key2);
}
if (Ui::HotKey("Vehicle instant stop", hotkeys::veh_instant_stop))
{
config.SetValue("hotkey.veh_instant_stop.key1", hotkeys::veh_instant_stop.key1);
config.SetValue("hotkey.veh_instant_stop.key2", hotkeys::veh_instant_stop.key2);
}
ImGui::Dummy(ImVec2(0, 10));
ImGui::EndChild();

View File

@ -29,6 +29,8 @@ public:
static HotKeyData quick_ss;
static HotKeyData quick_tp;
static HotKeyData veh_engine;
static HotKeyData veh_instant_start;
static HotKeyData veh_instant_stop;
};
struct commands
{

View File

@ -741,19 +741,19 @@ void Ui::EditFloat(const char *label, const int address, const float min, const
int size = ImGui::GetFrameHeight();
if (ImGui::InputFloat(("##" + std::string(label)).c_str(), &val))
patch::Set<float>(address, val/mul, false);
patch::SetFloat(address, val / mul, false);
ImGui::SameLine(0.0, 4.0);
if (ImGui::Button("-",ImVec2(size, size)) && val > min)
{
val -= 1;
patch::Set<float>(address, val / mul, false);
patch::SetFloat(address, val / mul, false);
}
ImGui::SameLine(0.0, 4.0);
if (ImGui::Button("+",ImVec2(size, size)) && val < max)
{
val += 1;
patch::Set<float>(address, val / mul, false);
patch::SetFloat(address, val / mul, false);
}
ImGui::SameLine(0.0, 4.0);
ImGui::Text("Set");

View File

@ -119,6 +119,12 @@ Vehicle::Vehicle()
veh->m_nVehicleFlags.bEngineBroken = state;
veh->m_nVehicleFlags.bEngineOn = !state;
}
if (Ui::HotKeyPressed(Menu::hotkeys::veh_instant_start))
Command<Commands::SET_CAR_FORWARD_SPEED>(hveh, 40.0f);
if (Ui::HotKeyPressed(Menu::hotkeys::veh_instant_stop))
Command<Commands::SET_CAR_FORWARD_SPEED>(hveh, 0);
if (veh_nodmg)
{

View File

@ -368,7 +368,7 @@ void Visual::Main()
TimecycSlider("Cloud alpha", m_fCloudAlpha, 0, 255);
TimecycSlider("Directional mult", m_nDirectionalMult , 0, 255);
TimecycSlider("Far clip", m_fFarClip, 0, 2000);
TimecycSlider("Fog start", m_fFogStart, 0, 2000);
TimecycSlider("Fog start", m_fFogStart, 0, 1500);
TimecycSlider("High light min intensity", m_nHighLightMinIntensity, 0, 255);
TimecycSlider("Light on ground brightness", m_fLightsOnGroundBrightness, 0, 255);
TimecycSlider("Light shadow strength", m_nLightShadowStrength, 0, 255);