From 81e39ddfda112305a07f7794d9a324eae1ba583a Mon Sep 17 00:00:00 2001 From: Grinch_ Date: Wed, 6 Jul 2022 06:04:03 +0600 Subject: [PATCH] Minor bug fixes --- resource/common/locale/English.toml | 20 ++++++++++---------- src/widget.cpp | 24 +++++++++++++++++------- src/widget.h | 19 +++++++++---------- 3 files changed, 36 insertions(+), 27 deletions(-) diff --git a/resource/common/locale/English.toml b/resource/common/locale/English.toml index a937d44..9198e7e 100644 --- a/resource/common/locale/English.toml +++ b/resource/common/locale/English.toml @@ -591,21 +591,21 @@ AmbientBl = "Ambient bl" AmbientObj = "Ambient object" AmbientObjBl = "Ambient object bl" ArmourbarColor = "Armour bar color" -ArmourbarPosX = "Armour bar X" -ArmourbarPosY = "Armour bar Y" +ArmourbarPosX = "Armour bar posX" +ArmourbarPosY = "Armour bar posY" ArmourBorder = "Armour border" ArmourPercentage = "Armour percentage" Blur = "Blur" BoldBorder = "Bold border" BreathbarColor = "Breath bar color" -BreathbarPosX = "Breath bar X" -BreathbarPosY = "Breath bar Y" +BreathbarPosX = "Breath bar posX" +BreathbarPosY = "Breath bar posY" BreathBorder = "Breath border" BreathPercentage = "Breath percentage" CCTVEffect = "CCTV effect" ClockColor = "Clock color" -ClockPosX = "Clock X" -ClockPosY = "Clock Y" +ClockPosX = "Clock posX" +ClockPosY = "Clock posY" CloudAlpha = "Cloud alpha" CloudsBottom = "Clouds bottom" CloudsLow = "Clouds low" @@ -634,8 +634,8 @@ GrainEffect = "Grain Effect" GrayRadar = "Gray radar" GreenScanlines = "Green scanlines" HealthbarColor = "Health bar color" -HealthbarPosX = "Health bar X" -HealthbarPosY = "Health bar Y" +HealthbarPosX = "Health bar posX" +HealthbarPosY = "Health bar posY" HealthBorder = "Health border" HealthPercentage = "Health percentage" HeatHazeEffect = "Heathaze effect" @@ -662,8 +662,8 @@ Minute = "Minute" MoneyColor = "Money color" MoneyFontOutline = "Money font outline" MoneyFontStyle = "Money font style" -MoneyPosX = "Money X" -MoneyPosY = "Money Y" +MoneyPosX = "Money posX" +MoneyPosY = "Money posY" NextWeather = "Next weather" NightVision = "Night vision" NoBorder = "No border" diff --git a/src/widget.cpp b/src/widget.cpp index 9da6a2b..0385447 100644 --- a/src/widget.cpp +++ b/src/widget.cpp @@ -608,7 +608,7 @@ void Widget::EditAddr(const char* label, uint address, float min, float def, flo { if (ImGui::CollapsingHeader(label)) { - float val = patch::Get(address, false) * mul; + float val = patch::Get(address) * mul; int items = 3; @@ -637,20 +637,30 @@ void Widget::EditAddr(const char* label, uint address, float min, float def, flo if (ImGui::InputFloat(("##" + std::string(label)).c_str(), &val)) { - patch::SetFloat(address, val / mul, false); + if (val < min) + { + val = min; + } + + if (val > max) + { + val = max; + } + patch::SetFloat(address, val / mul); } ImGui::SameLine(0.0, 4.0); if (ImGui::Button("-", ImVec2(size, size)) && (val - change) > min) { val -= change; - patch::SetFloat(address, val / mul, false); + if (val < min) + patch::SetFloat(address, val / mul); } ImGui::SameLine(0.0, 4.0); if (ImGui::Button("+", ImVec2(size, size)) && (val + change) < max) { val += change; - patch::SetFloat(address, val / mul, false); + patch::SetFloat(address, val / mul); } ImGui::SameLine(0.0, 4.0); ImGui::Text("Set"); @@ -660,7 +670,7 @@ void Widget::EditAddr(const char* label, uint address, float min, float def, flo if (ImGui::Button(("Minimum##" + std::string(label)).c_str(), CalcSize(items))) { - patch::Set(address, min / mul, false); + patch::Set(address, min / mul); } if (items == 3) @@ -669,7 +679,7 @@ void Widget::EditAddr(const char* label, uint address, float min, float def, flo if (ImGui::Button(("Default##" + std::string(label)).c_str(), CalcSize(items))) { - patch::Set(address, def / mul, false); + patch::Set(address, def / mul); } } @@ -677,7 +687,7 @@ void Widget::EditAddr(const char* label, uint address, float min, float def, flo if (ImGui::Button(("Maximum##" + std::string(label)).c_str(), CalcSize(items))) { - patch::Set(address, max / mul, false); + patch::Set(address, max / mul); } ImGui::Spacing(); diff --git a/src/widget.h b/src/widget.h index f4085d6..bd3485a 100644 --- a/src/widget.h +++ b/src/widget.h @@ -110,21 +110,20 @@ void Widget::EditAddr(const char* label, uint address, int min, int def, int max if (ImGui::InputInt(("Set value##" + std::string(label)).c_str(), &val)) { + if (val < min) + { + val = min; + } + + if (val > max) + { + val = max; + } patch::Set(address, val, false); } ImGui::Spacing(); - if (val < min) - { - val = min; - } - - if (val > max) - { - val = max; - } - if (ImGui::Button(("Minimum##" + std::string(label)).c_str(), CalcSize(items))) { patch::Set(address, min, false);