Skip to content

Commit

Permalink
fix some stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
sjrc6 committed Sep 19, 2024
1 parent f86aa86 commit bc44ee7
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 71 deletions.
1 change: 1 addition & 0 deletions src/engine/shared/config_variables.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ MACRO_CONFIG_INT(ClShowChatTeamMembersOnly, cl_show_chat_team_members_only, 0, 0
MACRO_CONFIG_INT(ClShowChatSystem, cl_show_chat_system, 1, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Show chat messages from the server")
MACRO_CONFIG_INT(ClShowKillMessages, cl_showkillmessages, 1, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Show kill messages")
MACRO_CONFIG_INT(ClShowFinishMessages, cl_show_finish_messages, 1, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Show finish messages")
MACRO_CONFIG_INT(ClShowVotesAfterVoting, cl_show_votes_after_voting, 0, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Show votes window after voting")
MACRO_CONFIG_INT(ClShowLocalTimeAlways, cl_show_local_time_always, 0, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Always show local time")
MACRO_CONFIG_INT(ClShowfps, cl_showfps, 0, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Show ingame FPS counter")
MACRO_CONFIG_INT(ClShowpred, cl_showpred, 0, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Show ingame prediction time in milliseconds")
Expand Down
6 changes: 6 additions & 0 deletions src/game/client/components/controls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,12 @@ bool CControls::CheckNewInput()
NewInput = true;
if(m_FastInput.m_Jump != TestInput.m_Jump)
NewInput = true;
if(m_FastInput.m_NextWeapon != TestInput.m_NextWeapon)
NewInput = true;
if(m_FastInput.m_PrevWeapon != TestInput.m_PrevWeapon)
NewInput = true;
if(m_FastInput.m_WantedWeapon != TestInput.m_WantedWeapon)
NewInput = true;

if(g_Config.m_ClSubTickAiming)
{
Expand Down
8 changes: 3 additions & 5 deletions src/game/client/components/outlines.cpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
#include <engine/graphics.h>
#include <engine/shared/config.h>

#include <game/client/gameclient.h>
#include <game/client/animstate.h>
#include <game/client/gameclient.h>
#include <game/client/render.h>
#include <game/generated/client_data.h>
#include <game/generated/protocol.h>
#include <game/mapitems.h>


#include "outlines.h"

void COutlines::OnRender()
Expand All @@ -25,7 +24,6 @@ void COutlines::OnRender()

continue;


CTile *pGameTiles = NULL;

for(int l = 0; l < pGroup->m_NumLayers; l++)
Expand All @@ -40,7 +38,7 @@ void COutlines::OnRender()
IsTeleLayer = true;
if(pLayer == (CMapItemLayer *)GameClient()->Layers()->GameLayer())
{
IsGameLayer = true;
IsGameLayer = true;
}

if(g_Config.m_ClOutline && IsGameLayer)
Expand Down Expand Up @@ -87,4 +85,4 @@ void COutlines::OnRender()
}
}
}
}
}
126 changes: 63 additions & 63 deletions src/game/client/components/player_indicator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,84 +32,84 @@ void CPlayerIndicator::OnRender()

vec2 Position = m_pClient->m_aClients[m_pClient->m_Snap.m_LocalClientId].m_RenderPos;

if (g_Config.m_ClPlayerIndicator != 1)
return;


if(g_Config.m_ClPlayerIndicator != 1)
return;

Graphics()->TextureClear();
ColorRGBA col = ColorRGBA(0.0f, 0.0f, 0.0f, 1.0f);
if(!(m_pClient->m_Teams.Team(m_pClient->m_Snap.m_LocalClientId) == 0 && g_Config.m_ClIndicatorTeamOnly))
Graphics()->TextureClear();
ColorRGBA col = ColorRGBA(0.0f, 0.0f, 0.0f, 1.0f);
if(!(m_pClient->m_Teams.Team(m_pClient->m_Snap.m_LocalClientId) == 0 && g_Config.m_ClIndicatorTeamOnly))
{
for(int i = 0; i < MAX_CLIENTS; ++i)
{
for(int i = 0; i < MAX_CLIENTS; ++i)
if(!m_pClient->m_Snap.m_apPlayerInfos[i] || i == m_pClient->m_Snap.m_LocalClientId)
continue;

CGameClient::CClientData OtherTee = m_pClient->m_aClients[i];
CCharacterCore *pOtherCharacter = &m_pClient->m_aClients[i].m_Predicted;
if(
OtherTee.m_Team == m_pClient->m_aClients[m_pClient->m_Snap.m_LocalClientId].m_Team &&
!OtherTee.m_Spec &&
m_pClient->m_Snap.m_aCharacters[i].m_Active)
{
if(!m_pClient->m_Snap.m_apPlayerInfos[i] || i == m_pClient->m_Snap.m_LocalClientId)
if(g_Config.m_ClPlayerIndicatorFreeze && !(OtherTee.m_FreezeEnd > 0 || OtherTee.m_DeepFrozen))
continue;

CGameClient::CClientData OtherTee = m_pClient->m_aClients[i];
CCharacterCore *pOtherCharacter = &m_pClient->m_aClients[i].m_Predicted;
if(
OtherTee.m_Team == m_pClient->m_aClients[m_pClient->m_Snap.m_LocalClientId].m_Team &&
!OtherTee.m_Spec &&
m_pClient->m_Snap.m_aCharacters[i].m_Active)
{
if(g_Config.m_ClPlayerIndicatorFreeze && !(OtherTee.m_FreezeEnd > 0 || OtherTee.m_DeepFrozen))
continue;

vec2 norm = NormalizedDirection(m_pClient->m_aClients[i].m_RenderPos, m_pClient->m_aClients[m_pClient->m_Snap.m_LocalClientId].m_RenderPos) * (-1);
vec2 norm = NormalizedDirection(m_pClient->m_aClients[i].m_RenderPos, m_pClient->m_aClients[m_pClient->m_Snap.m_LocalClientId].m_RenderPos) * (-1);

float Offset = g_Config.m_ClIndicatorOffset;
if(g_Config.m_ClIndicatorVariableDistance)
{
Offset = mix((float)g_Config.m_ClIndicatorOffset, (float)g_Config.m_ClIndicatorOffsetMax,
std::min(DistanceBetweenTwoPoints(Position, OtherTee.m_RenderPos) / g_Config.m_ClIndicatorMaxDistance, 1.0f));
}
float Offset = g_Config.m_ClIndicatorOffset;
if(g_Config.m_ClIndicatorVariableDistance)
{
Offset = mix((float)g_Config.m_ClIndicatorOffset, (float)g_Config.m_ClIndicatorOffsetMax,
std::min(DistanceBetweenTwoPoints(Position, OtherTee.m_RenderPos) / g_Config.m_ClIndicatorMaxDistance, 1.0f));
}

vec2 IndicatorPos(norm.x * Offset + Position.x, norm.y * Offset + Position.y);
CTeeRenderInfo TeeInfo = OtherTee.m_RenderInfo;
float Alpha = g_Config.m_ClIndicatorOpacity / 100.0f;
if(OtherTee.m_FreezeEnd > 0 || OtherTee.m_DeepFrozen)
vec2 IndicatorPos(norm.x * Offset + Position.x, norm.y * Offset + Position.y);
CTeeRenderInfo TeeInfo = OtherTee.m_RenderInfo;
float Alpha = g_Config.m_ClIndicatorOpacity / 100.0f;
if(OtherTee.m_FreezeEnd > 0 || OtherTee.m_DeepFrozen)
{
// check if player is frozen or is getting saved
if(pOtherCharacter->m_IsInFreeze == 0)
{
// check if player is frozen or is getting saved
if(pOtherCharacter->m_IsInFreeze == 0)
{
// player is on the way to get free again
col = color_cast<ColorRGBA>(ColorHSLA(g_Config.m_ClIndicatorSaved));
}else{
// player is frozen
col = color_cast<ColorRGBA>(ColorHSLA(g_Config.m_ClIndicatorFreeze));
}
if(g_Config.m_ClIndicatorTees)
{
TeeInfo.m_ColorBody.r *= 0.4;
TeeInfo.m_ColorBody.g *= 0.4;
TeeInfo.m_ColorBody.b *= 0.4;
TeeInfo.m_ColorFeet.r *= 0.4;
TeeInfo.m_ColorFeet.g *= 0.4;
TeeInfo.m_ColorFeet.b *= 0.4;
Alpha *= 0.8;
}
// player is on the way to get free again
col = color_cast<ColorRGBA>(ColorHSLA(g_Config.m_ClIndicatorSaved));
}
else
{
col = color_cast<ColorRGBA>(ColorHSLA(g_Config.m_ClIndicatorAlive));
// player is frozen
col = color_cast<ColorRGBA>(ColorHSLA(g_Config.m_ClIndicatorFreeze));
}
col.a = Alpha;

TeeInfo.m_Size = g_Config.m_ClIndicatorRadius * 4.f;

if(g_Config.m_ClIndicatorTees)
{
RenderTools()->RenderTee(CAnimState::GetIdle(), &TeeInfo, OtherTee.m_RenderCur.m_Emote, vec2(1.0f, 0.0f), IndicatorPos, col.a);
}
else
{
Graphics()->QuadsBegin();
Graphics()->SetColor(col);
Graphics()->DrawCircle(IndicatorPos.x, IndicatorPos.y, g_Config.m_ClIndicatorRadius, 16);
Graphics()->QuadsEnd();
TeeInfo.m_ColorBody.r *= 0.4;
TeeInfo.m_ColorBody.g *= 0.4;
TeeInfo.m_ColorBody.b *= 0.4;
TeeInfo.m_ColorFeet.r *= 0.4;
TeeInfo.m_ColorFeet.g *= 0.4;
TeeInfo.m_ColorFeet.b *= 0.4;
Alpha *= 0.8;
}
}
else
{
col = color_cast<ColorRGBA>(ColorHSLA(g_Config.m_ClIndicatorAlive));
}
col.a = Alpha;

TeeInfo.m_Size = g_Config.m_ClIndicatorRadius * 4.f;

if(g_Config.m_ClIndicatorTees)
{
RenderTools()->RenderTee(CAnimState::GetIdle(), &TeeInfo, OtherTee.m_RenderCur.m_Emote, vec2(1.0f, 0.0f), IndicatorPos, col.a);
}
else
{
Graphics()->QuadsBegin();
Graphics()->SetColor(col);
Graphics()->DrawCircle(IndicatorPos.x, IndicatorPos.y, g_Config.m_ClIndicatorRadius, 16);
Graphics()->QuadsEnd();
}
}
}
}
}
}
2 changes: 0 additions & 2 deletions src/game/client/components/players.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1409,8 +1409,6 @@ void CPlayers::OnRender()
if(RenderGhost && g_Config.m_ClShowOthersGhosts && !Spec && Client()->State() != IClient::STATE_DEMOPLAYBACK)
RenderPlayerGhost(&m_pClient->m_aClients[ClientId].m_RenderPrev, &m_pClient->m_aClients[ClientId].m_RenderCur, &aRenderInfo[ClientId], ClientId);

if(RenderRegular || Spec)
RenderPlayer(&m_pClient->m_aClients[ClientId].m_RenderPrev, &m_pClient->m_aClients[ClientId].m_RenderCur, &aRenderInfo[ClientId], ClientId);
RenderPlayer(&m_pClient->m_aClients[ClientId].m_RenderPrev, &m_pClient->m_aClients[ClientId].m_RenderCur, &aRenderInfo[ClientId], ClientId);
}
if(RenderLastId != -1 && m_pClient->m_Snap.m_aCharacters[RenderLastId].m_Active && IsPlayerInfoAvailable(RenderLastId))
Expand Down
2 changes: 1 addition & 1 deletion src/game/client/components/voting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ void CVoting::OnMessage(int MsgType, void *pRawMsg)

void CVoting::Render()
{
if((!m_pClient->m_Scoreboard.Active() && TakenChoice()) || !IsVoting() || Client()->State() == IClient::STATE_DEMOPLAYBACK)
if((!g_Config.m_ClShowVotesAfterVoting && !m_pClient->m_Scoreboard.Active() && TakenChoice()) || !IsVoting() || Client()->State() == IClient::STATE_DEMOPLAYBACK)
return;
const int Seconds = SecondsLeft();
if(Seconds < 0)
Expand Down

0 comments on commit bc44ee7

Please sign in to comment.