diff --git a/cathook/src/entitycache.cpp b/cathook/src/entitycache.cpp index e00d6dd3..17307288 100644 --- a/cathook/src/entitycache.cpp +++ b/cathook/src/entitycache.cpp @@ -214,6 +214,7 @@ void CachedEntity::AddESPString(const char* fmt, ...) { if (m_Strings[m_nESPStrings].m_String) { delete m_Strings[m_nESPStrings].m_String; } + m_Strings[m_nESPStrings].m_bColored = false; char* buffer = new char[1024](); va_list list; va_start(list, fmt); diff --git a/cathook/src/gui/CCVarContainer.cpp b/cathook/src/gui/CCVarContainer.cpp index d801579b..930207ac 100644 --- a/cathook/src/gui/CCVarContainer.cpp +++ b/cathook/src/gui/CCVarContainer.cpp @@ -43,6 +43,7 @@ CCVarContainer::CCVarContainer(IWidget* parent, CatVar* var) : CBaseContainer((" dd->SetCallback([this](CDropdown*, int value) { m_pVar->SetValue(value); }); + dd->Props()->SetInt("offset", var->GetEnum()->Minimum()); m_pControl = dd; } break; case CatVar_t::CV_FLOAT: { diff --git a/cathook/src/gui/CDropdown.cpp b/cathook/src/gui/CDropdown.cpp index 789d4e43..75c313be 100644 --- a/cathook/src/gui/CDropdown.cpp +++ b/cathook/src/gui/CDropdown.cpp @@ -42,10 +42,10 @@ std::string CDropdown::ValueName(int idx) { void CDropdown::Draw(int x, int y) { auto size = GetSize(); - auto ssize = draw::GetStringLength(fonts::MENU, ValueName(Value())); + auto ssize = draw::GetStringLength(fonts::MENU, ValueName(Value() - Props()->GetInt("offset"))); draw::DrawRect(x, y, size.first, size.second, colors::Transparent(colors::black)); draw::OutlineRect(x, y, size.first, size.second, colors::pink); - draw::String(fonts::MENU, x + (size.first - ssize.first) / 2, y + (size.second - ssize.second) / 2, colors::pink, 1, ValueName(Value())); + draw::String(fonts::MENU, x + (size.first - ssize.first) / 2, y + (size.second - ssize.second) / 2, colors::pink, 1, ValueName(Value() - Props()->GetInt("offset"))); auto asize = draw::GetStringLength(fonts::MENU, ">"); draw::String(fonts::MENU, x + size.first - asize.first - 2, y + (size.second - asize.second) / 2, colors::pink, 1, ">"); } @@ -55,9 +55,9 @@ void CDropdown::OnFocusLose() { } void CDropdown::SetValueInternal(int value) { - Props()->SetInt("value", value); + Props()->SetInt("value", value + Props()->GetInt("offset")); if (m_pDropdownCallback) - m_pDropdownCallback(this, value); + m_pDropdownCallback(this, value + Props()->GetInt("offset")); } void CDropdown::SetValue(int value) { diff --git a/cathook/src/gui/CDropdownList.cpp b/cathook/src/gui/CDropdownList.cpp index b829ae89..d073ceaf 100644 --- a/cathook/src/gui/CDropdownList.cpp +++ b/cathook/src/gui/CDropdownList.cpp @@ -12,7 +12,7 @@ #include "../common.h" #include "../sdk.h" -CDropdownList::CDropdownList(std::string name, CDropdown* menu) : CBaseContainer(name, nullptr) { +CDropdownList::CDropdownList(std::string name, CDropdown* menu, int offset) : CBaseContainer(name, nullptr) { m_pMenu = menu; Hide(); SetZIndex(5); diff --git a/cathook/src/gui/CDropdownList.h b/cathook/src/gui/CDropdownList.h index 5aa35d10..c5bbc9a4 100644 --- a/cathook/src/gui/CDropdownList.h +++ b/cathook/src/gui/CDropdownList.h @@ -15,7 +15,7 @@ class CDropdownEntry; class CDropdownList : public CBaseContainer { public: - CDropdownList(std::string name = "unnamed", CDropdown* menu = nullptr); + CDropdownList(std::string name = "unnamed", CDropdown* menu = nullptr, int offset = 0); ~CDropdownList(); virtual void Draw(int x, int y); diff --git a/cathook/src/gui/CMenuWindow.cpp b/cathook/src/gui/CMenuWindow.cpp index ff51295b..9f7571a5 100644 --- a/cathook/src/gui/CMenuWindow.cpp +++ b/cathook/src/gui/CMenuWindow.cpp @@ -115,12 +115,13 @@ void CMenuWindow::AddElements() { } AddTab("misc", "Misc"); tab = GetTab("misc"); - tab->AddChild(new CBaseButton("ach_unlock", tab, "Unlock Achievements (DO NOT USE INGAME)", [this](CBaseButton*) { + //ADDLABEL("To lock/unlock achievements use cat_achievement_ commands!"); + /*tab->AddChild(new CBaseButton("ach_unlock", tab, "Unlock Achievements (DO NOT USE INGAME)", [this](CBaseButton*) { Achievements_Unlock(); })); tab->AddChild(new CBaseButton("ach_lock", tab, "Lock Achievements", [this](CBaseButton*) { Achievements_Lock(); - })); + }));*/ if (TF) ADDCVAR(g_phAutoHeal->v_bEnabled); if (TF) ADDCVAR(g_phAntiDisguise->v_bEnabled); ADDCVAR(g_Settings.bCleanScreenshots); diff --git a/cathook/src/gui/CSlider.cpp b/cathook/src/gui/CSlider.cpp index 2d620072..0a964204 100644 --- a/cathook/src/gui/CSlider.cpp +++ b/cathook/src/gui/CSlider.cpp @@ -43,7 +43,7 @@ void CSlider::SetValue(float value) { m_pCallback(this, old, value); } } - m_nSliderPos = (GetSize().first) * (float)value / (float)(Props()->GetFloat("value_max") - Props()->GetFloat("value_min")); + m_nSliderPos = (GetSize().first) * (float)(value - Props()->GetFloat("value_min")) / (float)(Props()->GetFloat("value_max") - Props()->GetFloat("value_min")); } float CSlider::Value() { diff --git a/cathook/src/hacks/AntiAim.cpp b/cathook/src/hacks/AntiAim.cpp index 66341206..3210ccd4 100644 --- a/cathook/src/hacks/AntiAim.cpp +++ b/cathook/src/hacks/AntiAim.cpp @@ -21,8 +21,8 @@ AntiAim::AntiAim() { this->v_flPitch = new CatVar(CV_FLOAT, "aa_pitch", "-89.0", "Pitch", NULL, "Static pitch (up/down)", true, 89.0, -89.0); this->v_flYaw = new CatVar(CV_FLOAT, "aa_yaw", "0.0", "Yaw", NULL, "Static yaw (left/right)", true, 360.0); this->v_flSpinSpeed = new CatVar(CV_FLOAT, "aa_spin", "10.0", "Spin speed", NULL, "Spin speed (in deg/sec)"); - this->v_PitchMode = new CatVar(CV_ENUM, "aa_pitch_mode", "1", "Pitch mode", new CatEnum({ "KEEP", "STATIC", "RANDOM", "SPIN" }), "Pitch mode"); - this->v_YawMode = new CatVar(CV_ENUM, "aa_yaw_mode", "3", "Yaw mode", new CatEnum({ "KEEP", "STATIC", "RANDOM" }), "Yaw mode"); + this->v_PitchMode = new CatVar(CV_ENUM, "aa_pitch_mode", "1", "Pitch mode", new CatEnum({ "KEEP", "STATIC", "RANDOM" }), "Pitch mode"); + this->v_YawMode = new CatVar(CV_ENUM, "aa_yaw_mode", "3", "Yaw mode", new CatEnum({ "KEEP", "STATIC", "RANDOM", "SPIN" }), "Yaw mode"); } float yaw = -180; diff --git a/cathook/src/hooks/PaintTraverse.cpp b/cathook/src/hooks/PaintTraverse.cpp index ab77db63..0f2eb938 100644 --- a/cathook/src/hooks/PaintTraverse.cpp +++ b/cathook/src/hooks/PaintTraverse.cpp @@ -103,12 +103,6 @@ void PaintTraverse_hook(void* p, unsigned int vp, bool fr, bool ar) { if (!draw_flag) return; draw_flag = false; -#if GUI_ENABLED == true - /*g_pGUI->UpdateKeys(); - g_pGUI->UpdateMouse(); - g_pGUI->Draw();*/ - g_pGUI->Update(); -#endif if (g_Settings.bShowLogo->GetBool()) { AddSideString(colors::RainbowCurrent(), "cathook by d4rkc4t"); #if _DEVELOPER @@ -160,6 +154,13 @@ void PaintTraverse_hook(void* p, unsigned int vp, bool fr, bool ar) { } } +#if GUI_ENABLED == true + /*g_pGUI->UpdateKeys(); + g_pGUI->UpdateMouse(); + g_pGUI->Draw();*/ + g_pGUI->Update(); +#endif + DrawStrings(); SEGV_END; }