Minor bug fixes

This commit is contained in:
Grinch_ 2022-07-06 06:04:03 +06:00
parent fa3d257c81
commit 81e39ddfda
3 changed files with 36 additions and 27 deletions

View File

@ -591,21 +591,21 @@ AmbientBl = "Ambient bl"
AmbientObj = "Ambient object" AmbientObj = "Ambient object"
AmbientObjBl = "Ambient object bl" AmbientObjBl = "Ambient object bl"
ArmourbarColor = "Armour bar color" ArmourbarColor = "Armour bar color"
ArmourbarPosX = "Armour bar X" ArmourbarPosX = "Armour bar posX"
ArmourbarPosY = "Armour bar Y" ArmourbarPosY = "Armour bar posY"
ArmourBorder = "Armour border" ArmourBorder = "Armour border"
ArmourPercentage = "Armour percentage" ArmourPercentage = "Armour percentage"
Blur = "Blur" Blur = "Blur"
BoldBorder = "Bold border" BoldBorder = "Bold border"
BreathbarColor = "Breath bar color" BreathbarColor = "Breath bar color"
BreathbarPosX = "Breath bar X" BreathbarPosX = "Breath bar posX"
BreathbarPosY = "Breath bar Y" BreathbarPosY = "Breath bar posY"
BreathBorder = "Breath border" BreathBorder = "Breath border"
BreathPercentage = "Breath percentage" BreathPercentage = "Breath percentage"
CCTVEffect = "CCTV effect" CCTVEffect = "CCTV effect"
ClockColor = "Clock color" ClockColor = "Clock color"
ClockPosX = "Clock X" ClockPosX = "Clock posX"
ClockPosY = "Clock Y" ClockPosY = "Clock posY"
CloudAlpha = "Cloud alpha" CloudAlpha = "Cloud alpha"
CloudsBottom = "Clouds bottom" CloudsBottom = "Clouds bottom"
CloudsLow = "Clouds low" CloudsLow = "Clouds low"
@ -634,8 +634,8 @@ GrainEffect = "Grain Effect"
GrayRadar = "Gray radar" GrayRadar = "Gray radar"
GreenScanlines = "Green scanlines" GreenScanlines = "Green scanlines"
HealthbarColor = "Health bar color" HealthbarColor = "Health bar color"
HealthbarPosX = "Health bar X" HealthbarPosX = "Health bar posX"
HealthbarPosY = "Health bar Y" HealthbarPosY = "Health bar posY"
HealthBorder = "Health border" HealthBorder = "Health border"
HealthPercentage = "Health percentage" HealthPercentage = "Health percentage"
HeatHazeEffect = "Heathaze effect" HeatHazeEffect = "Heathaze effect"
@ -662,8 +662,8 @@ Minute = "Minute"
MoneyColor = "Money color" MoneyColor = "Money color"
MoneyFontOutline = "Money font outline" MoneyFontOutline = "Money font outline"
MoneyFontStyle = "Money font style" MoneyFontStyle = "Money font style"
MoneyPosX = "Money X" MoneyPosX = "Money posX"
MoneyPosY = "Money Y" MoneyPosY = "Money posY"
NextWeather = "Next weather" NextWeather = "Next weather"
NightVision = "Night vision" NightVision = "Night vision"
NoBorder = "No border" NoBorder = "No border"

View File

@ -608,7 +608,7 @@ void Widget::EditAddr(const char* label, uint address, float min, float def, flo
{ {
if (ImGui::CollapsingHeader(label)) if (ImGui::CollapsingHeader(label))
{ {
float val = patch::Get<float>(address, false) * mul; float val = patch::Get<float>(address) * mul;
int items = 3; 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)) 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); ImGui::SameLine(0.0, 4.0);
if (ImGui::Button("-", ImVec2(size, size)) && (val - change) > min) if (ImGui::Button("-", ImVec2(size, size)) && (val - change) > min)
{ {
val -= change; val -= change;
patch::SetFloat(address, val / mul, false); if (val < min)
patch::SetFloat(address, val / mul);
} }
ImGui::SameLine(0.0, 4.0); ImGui::SameLine(0.0, 4.0);
if (ImGui::Button("+", ImVec2(size, size)) && (val + change) < max) if (ImGui::Button("+", ImVec2(size, size)) && (val + change) < max)
{ {
val += change; val += change;
patch::SetFloat(address, val / mul, false); patch::SetFloat(address, val / mul);
} }
ImGui::SameLine(0.0, 4.0); ImGui::SameLine(0.0, 4.0);
ImGui::Text("Set"); 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))) if (ImGui::Button(("Minimum##" + std::string(label)).c_str(), CalcSize(items)))
{ {
patch::Set<float>(address, min / mul, false); patch::Set<float>(address, min / mul);
} }
if (items == 3) 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))) if (ImGui::Button(("Default##" + std::string(label)).c_str(), CalcSize(items)))
{ {
patch::Set<float>(address, def / mul, false); patch::Set<float>(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))) if (ImGui::Button(("Maximum##" + std::string(label)).c_str(), CalcSize(items)))
{ {
patch::Set<float>(address, max / mul, false); patch::Set<float>(address, max / mul);
} }
ImGui::Spacing(); ImGui::Spacing();

View File

@ -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 (ImGui::InputInt(("Set value##" + std::string(label)).c_str(), &val))
{ {
if (val < min)
{
val = min;
}
if (val > max)
{
val = max;
}
patch::Set<T>(address, val, false); patch::Set<T>(address, val, false);
} }
ImGui::Spacing(); ImGui::Spacing();
if (val < min)
{
val = min;
}
if (val > max)
{
val = max;
}
if (ImGui::Button(("Minimum##" + std::string(label)).c_str(), CalcSize(items))) if (ImGui::Button(("Minimum##" + std::string(label)).c_str(), CalcSize(items)))
{ {
patch::Set<T>(address, min, false); patch::Set<T>(address, min, false);