From 87a848334b917f12f2866435fffd943fa304b336 Mon Sep 17 00:00:00 2001 From: ScriptedSnark <51358194+ScriptedSnark@users.noreply.github.com> Date: Fri, 5 Apr 2024 21:19:56 +0500 Subject: [PATCH] chaos_draw_as_overlay --- GSChaos/CChaos.cpp | 2 ++ GSChaos/CChaos.h | 1 + GSChaos/GSChaos.cpp | 11 ++++++++++- README.md | 3 ++- gamedir/README.txt | 3 ++- 5 files changed, 17 insertions(+), 3 deletions(-) diff --git a/GSChaos/CChaos.cpp b/GSChaos/CChaos.cpp index 92feed91..70820653 100644 --- a/GSChaos/CChaos.cpp +++ b/GSChaos/CChaos.cpp @@ -9,6 +9,7 @@ cvar_t* chaos_effectname_ypos; cvar_t* chaos_dmca_safe; cvar_t* chaos_show_voting; cvar_t* chaos_timer; +cvar_t* chaos_draw_as_overlay; void ActivateChaosFeatureW() { @@ -67,6 +68,7 @@ void CChaos::Init() chaos_dmca_safe = pEngfuncs->pfnRegisterVariable("chaos_dmca_safe", "1", 0); chaos_show_voting = pEngfuncs->pfnRegisterVariable("chaos_show_voting", "0", 0); chaos_timer = pEngfuncs->pfnRegisterVariable("chaos_timer", "30.0", 0); + chaos_draw_as_overlay = pEngfuncs->pfnRegisterVariable("chaos_draw_as_overlay", "0", 0); for (int i = 0; i < 3; i++) { diff --git a/GSChaos/CChaos.h b/GSChaos/CChaos.h index c2352abe..0978bb07 100644 --- a/GSChaos/CChaos.h +++ b/GSChaos/CChaos.h @@ -34,6 +34,7 @@ struct TwitchVoter }; extern cvar_t* chaos_dmca_safe; +extern cvar_t* chaos_draw_as_overlay; class CChaos { diff --git a/GSChaos/GSChaos.cpp b/GSChaos/GSChaos.cpp index 62920811..9927375b 100644 --- a/GSChaos/GSChaos.cpp +++ b/GSChaos/GSChaos.cpp @@ -111,7 +111,13 @@ int __stdcall HOOKED_wglSwapBuffers(HDC a1) initialized = true; } - gImGui.Draw(); + if (chaos_draw_as_overlay) + { + if (chaos_draw_as_overlay->value > 0.0f) + gImGui.Draw(); + } + else + gImGui.Draw(); return ORIG_wglSwapBuffers(a1); } @@ -132,6 +138,9 @@ void HOOKED_HUD_Frame(double time) int HOOKED_HUD_Redraw(float time, int intermission) { + if (chaos_draw_as_overlay && chaos_draw_as_overlay->value <= 0.0f) + gImGui.Draw(); + return g_bDrawHUD ? 1 : ORIG_HUD_Redraw(time, intermission); } diff --git a/README.md b/README.md index 8548b0f1..38b98fbf 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Supports builds `9920` (HL25), `8684` (steam_legacy), `4554` (GoldSrc Package, 2 **Download via Github: [CLICK](https://github.com/ScriptedSnark/GSChaos/releases/tag/continuous)** Additional info: -- Chaos UI rendering is not visible in OBS scene if third-party overlays checkbox is unchecked (doesn't matter if you capture hl.exe as a window, not game) +- Chaos UI rendering is not visible in OBS scene (if chaos_draw_as_overlay is enabled) if third-party overlays checkbox is unchecked (doesn't matter if you capture hl.exe as a window, not game) - Save your game more often because of potential softlocks/crashes ## CVars and commands @@ -23,6 +23,7 @@ Additional info: - `chaos_effectname_ypos` - sets position of effect name text by vertical (Y coord) - `chaos_show_voting` - draw voting progress in Chaos UI so you can see it without checking OBS - `chaos_timer` - sets time until the next effect +- `chaos_draw_as_overlay` - if enabled, it draws Chaos UI as overlay and requires enabling 3rd-party overlays in OBS ## Twitch voting integration (WIP) GSChaos supports Twitch chat voting. If you want to use it, then do some steps: diff --git a/gamedir/README.txt b/gamedir/README.txt index 9299440a..22d3d12e 100644 --- a/gamedir/README.txt +++ b/gamedir/README.txt @@ -23,7 +23,7 @@ INSTALLATION (FOR WON 2005) ADDITIONAL INFO ============== -- !!!Chaos UI rendering is not visible in OBS scene if third-party overlays checkbox is unchecked (doesn't matter if you capture hl.exe as a window, not game)!!! +- !!!Chaos UI rendering is not visible in OBS scene (if chaos_draw_as_overlay is enabled) if third-party overlays checkbox is unchecked (doesn't matter if you capture hl.exe as a window, not game)!!! - Save your game more often because of potential softlocks/crashes CVARS AND COMMANDS @@ -35,6 +35,7 @@ CVARS AND COMMANDS - `chaos_effectname_ypos` - sets position of effect name text by vertical (Y coord) - `chaos_show_voting` - draw voting progress in Chaos UI so you can see it without checking OBS - `chaos_timer` - sets time until the next effect +- `chaos_draw_as_overlay` - if enabled, it draws Chaos UI as overlay and requires enabling 3rd-party overlays in OBS TWITCH CHAT VOTING INTEGRATION ==============