From 6afb99e3dff88536dd7503b0f1d1c2eeda62504b Mon Sep 17 00:00:00 2001 From: Tater Date: Thu, 12 Sep 2024 02:32:09 -0500 Subject: [PATCH] Add client side freeze stars --- src/engine/shared/config_variables.h | 1 + src/game/client/gameclient.cpp | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/src/engine/shared/config_variables.h b/src/engine/shared/config_variables.h index 02849f17c50..b1e1b126876 100644 --- a/src/engine/shared/config_variables.h +++ b/src/engine/shared/config_variables.h @@ -73,6 +73,7 @@ MACRO_CONFIG_INT(ClShowfps, cl_showfps, 0, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, MACRO_CONFIG_INT(ClShowpred, cl_showpred, 0, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Show ingame prediction time in milliseconds") MACRO_CONFIG_INT(ClEyeWheel, cl_eye_wheel, 1, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Show eye wheel along together with emotes") MACRO_CONFIG_INT(ClEyeDuration, cl_eye_duration, 999999, 1, 999999, CFGFLAG_CLIENT | CFGFLAG_SAVE, "How long the eyes emotes last") +MACRO_CONFIG_INT(ClFreezeStars, cl_freeze_stars, 0, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Show old star particles for frozen tees") MACRO_CONFIG_INT(ClAirjumpindicator, cl_airjumpindicator, 1, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Show the air jump indicator") MACRO_CONFIG_INT(ClThreadsoundloading, cl_threadsoundloading, 1, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Load sound files threaded") diff --git a/src/game/client/gameclient.cpp b/src/game/client/gameclient.cpp index 5ac98249a97..13bca8358fe 100644 --- a/src/game/client/gameclient.cpp +++ b/src/game/client/gameclient.cpp @@ -2071,6 +2071,33 @@ void CGameClient::OnNewSnapshot() m_Effects.AirJump(Pos, Alpha); } + if(g_Config.m_ClFreezeStars) + { + for(int i = 0; i < MAX_CLIENTS; i++) + { + if(m_Snap.m_aCharacters[i].m_Active && m_Snap.m_aCharacters[i].m_HasExtendedData && m_Snap.m_aCharacters[i].m_PrevExtendedData) + { + int FreezeTimeNow = m_Snap.m_aCharacters[i].m_ExtendedData.m_FreezeEnd - Client()->GameTick(g_Config.m_ClDummy); + int FreezeTimePrev = m_Snap.m_aCharacters[i].m_PrevExtendedData->m_FreezeEnd - Client()->PrevGameTick(g_Config.m_ClDummy); + vec2 Pos = vec2(m_Snap.m_aCharacters[i].m_Cur.m_X, m_Snap.m_aCharacters[i].m_Cur.m_Y); + int StarsNow = (FreezeTimeNow + 1) / Client()->GameTickSpeed(); + int StarsPrev = (FreezeTimePrev + 1) / Client()->GameTickSpeed(); + if(StarsNow < StarsPrev || (StarsPrev == 0 && StarsNow > 0)) + { + int Amount = StarsNow + 1; + float a = 3 * pi / 2; + float s = a - pi / 3; + float e = a + pi / 3; + for(int j = 0; j < Amount; j++) + { + float f = mix(s, e, (j + 1) / (float)(Amount + 2)); + vec2 Dir = vec2(std::cos(f), std::cos(f)); + m_Effects.DamageIndicator(Pos, Dir); + } + } + } + } + } if(m_Snap.m_LocalClientId != m_PrevLocalId) m_PredictedDummyId = m_PrevLocalId; m_PrevLocalId = m_Snap.m_LocalClientId;