Fix gravity changer toggles being too sensitive

This commit is contained in:
Grinch_ 2021-07-24 23:21:52 +06:00
parent 61d9d52125
commit 9166fec6d2
5 changed files with 22 additions and 8 deletions

14
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,14 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "(Windows) Attach",
"type": "cppvsdbg",
"request": "attach",
"processId": "${command:pickProcess}"
},
]
}

View File

@ -433,7 +433,7 @@ Lowers armour, health, stamina etc."))
ImGui::Separator();
}
Ui::EditReference("Game speed", CTimer::ms_fTimeScale, 1, 1, 10);
Ui::EditFloat("Gravity", 0x863984, -1.0f, 0.008f, 1.0f);
Ui::EditFloat("Gravity", 0x863984, -1.0f, 0.008f, 1.0f, 1.0f, 0.01f);
if (ImGui::CollapsingHeader("Set time"))
{

View File

@ -125,7 +125,7 @@ void Menu::DrawOverlay()
if (m_bShowMenu && ImGui::Begin("Overlay", nullptr, window_flags))
{
CVector pos;
CVector pos{0,0,0};
if (player)
{
pos = player->GetPosition();

View File

@ -752,7 +752,7 @@ void Ui::EditBits(const char* label, const int address, const std::vector<std::s
}
void Ui::EditFloat(const char* label, const int address, const float min, const float def, const float max,
const float mul)
const float mul, const float change)
{
if (ImGui::CollapsingHeader(label))
{
@ -785,15 +785,15 @@ void Ui::EditFloat(const char* label, const int address, const float min, const
patch::SetFloat(address, val / mul, false);
ImGui::SameLine(0.0, 4.0);
if (ImGui::Button("-", ImVec2(size, size)) && val > min)
if (ImGui::Button("-", ImVec2(size, size)) && (val - change) > min)
{
val -= 1;
val -= change;
patch::SetFloat(address, val / mul, false);
}
ImGui::SameLine(0.0, 4.0);
if (ImGui::Button("+", ImVec2(size, size)) && val < max)
if (ImGui::Button("+", ImVec2(size, size)) && (val + change) < max)
{
val += 1;
val += change;
patch::SetFloat(address, val / mul, false);
}
ImGui::SameLine(0.0, 4.0);

View File

@ -63,7 +63,7 @@ public:
template <typename T>
static void EditAddress(const char* label, int address, int min = 0, int def = 0, int max = 100);
static void EditBits(const char* label, int address, const std::vector<std::string>& names);
static void EditFloat(const char* label, int address, float min, float def, float max, float mul = 1);
static void EditFloat(const char* label, int address, float min, float def, float max, float mul = 1, float change = 1.0f);
template <typename T>
static void EditReference(const char* label, T& address, int min = 0, int def = 0, int max = 100);
static void EditRadioButtonAddress(const char* label, std::vector<NamedMemory>& named_mem);