Skip to content

Commit

Permalink
chaos_draw_as_overlay
Browse files Browse the repository at this point in the history
  • Loading branch information
ScriptedSnark committed Apr 5, 2024
1 parent ffe6ca6 commit 87a8483
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 3 deletions.
2 changes: 2 additions & 0 deletions GSChaos/CChaos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down Expand Up @@ -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++)
{
Expand Down
1 change: 1 addition & 0 deletions GSChaos/CChaos.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ struct TwitchVoter
};

extern cvar_t* chaos_dmca_safe;
extern cvar_t* chaos_draw_as_overlay;

class CChaos
{
Expand Down
11 changes: 10 additions & 1 deletion GSChaos/GSChaos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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);
}

Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down
3 changes: 2 additions & 1 deletion gamedir/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
==============
Expand Down

0 comments on commit 87a8483

Please sign in to comment.