NoFog.cpp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #include "NoFog.h"
  2. namespace cheat {
  3. static void onUpdate_5(app::GameManager* __this, app::MethodInfo* method);
  4. NoFog::NoFog() : Function() {
  5. f_Enabled = config::getValue("functions:NoFog", "enabled", false);
  6. f_Hotkey = Hotkey("functions:NoFog");
  7. HookManager::install(app::GameManager_Update, onUpdate_5);
  8. }
  9. NoFog& NoFog::getInstance() {
  10. static NoFog instance;
  11. return instance;
  12. }
  13. void NoFog::GUI() {
  14. ConfigCheckbox(_("NO_FOG_TITLE"), f_Enabled, _("NO_FOG_DESCRIPTION"));
  15. if (f_Enabled.getValue()) {
  16. ImGui::Indent();
  17. f_Hotkey.Draw();
  18. ImGui::Unindent();
  19. }
  20. }
  21. void NoFog::Outer() {
  22. if (f_Hotkey.IsPressed())
  23. f_Enabled.setValue(!f_Enabled.getValue());
  24. }
  25. void NoFog::Status() {
  26. if (f_Enabled.getValue())
  27. ImGui::Text(_("NO_FOG_TITLE"));
  28. }
  29. std::string NoFog::getModule() {
  30. return _("MODULE_VISUALS");
  31. }
  32. static bool _prevEnabledState = false;
  33. void onUpdate_5(app::GameManager* __this, app::MethodInfo* method) {
  34. auto& noFog = NoFog::getInstance();
  35. bool enabled = noFog.f_Enabled.getValue();
  36. if (_prevEnabledState != enabled) {
  37. app::RenderSettings_set_fog(!enabled);
  38. _prevEnabledState = enabled;
  39. }
  40. CALL_ORIGIN(onUpdate_5, __this, method);
  41. }
  42. }