Skip to content

Commit

Permalink
tiny tees and more rainbow options
Browse files Browse the repository at this point in the history
  • Loading branch information
sjrc6 committed Jan 3, 2025
1 parent 55bb5d7 commit 5140adf
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 6 deletions.
6 changes: 6 additions & 0 deletions src/engine/shared/tater_variables.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ MACRO_CONFIG_INT(ClRenderCursorSpecAlpha, tc_cursor_in_spec_alpha, 100, 0, 100,

MACRO_CONFIG_INT(ClRenderNameplateSpec, tc_render_nameplate_spec, 0, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Render nameplates when spectating")

MACRO_CONFIG_INT(ClTinyTees, tc_tiny_tees, 0, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Render tees smaller")
MACRO_CONFIG_INT(ClTinyTeesOthers, tc_tiny_tees_others, 1, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Render other tees smaller")

//Profiles
MACRO_CONFIG_INT(ClApplyProfileSkin, tc_profile_skin, 1, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Apply skin in profiles")
MACRO_CONFIG_INT(ClApplyProfileName, tc_profile_name, 0, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Apply name in profiles")
Expand All @@ -134,6 +137,9 @@ MACRO_CONFIG_INT(ClAutoVerify, tc_auto_verify, 0, 0, 1, CFGFLAG_CLIENT | CFGFLAG

// Rainbow
MACRO_CONFIG_INT(ClRainbow, tc_rainbow, 0, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Turn on rainbow client side")
MACRO_CONFIG_INT(ClRainbowHook, tc_rainbow_hook, 0, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Rainbow hook")
MACRO_CONFIG_INT(ClRainbowWeapon, tc_rainbow_weapon, 0, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Rainbow Weapons")

MACRO_CONFIG_INT(ClRainbowOthers, tc_rainbow_others, 0, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Turn on rainbow client side for others")
MACRO_CONFIG_INT(ClRainbowMode, tc_rainbow_mode, 1, 1, 4, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Rainbow mode (1: rainbow, 2: pulse, 3: darkness, 4: random)")
MACRO_CONFIG_INT(ClRainbowSpeed, tc_rainbow_speed, 100, 0, 10000, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Rainbow speed as a percentage (50 = half speed, 200 = double speed)")
Expand Down
24 changes: 22 additions & 2 deletions src/game/client/components/players.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ void CPlayers::RenderHand6(const CTeeRenderInfo *pInfo, vec2 CenterPos, vec2 Dir

const CSkin::SSkinTextures *pSkinTextures = pInfo->m_CustomColoredSkin ? &pInfo->m_ColorableRenderSkin : &pInfo->m_OriginalRenderSkin;

if(!(g_Config.m_ClRainbow == 1 || g_Config.m_ClRainbowOthers == 1))
if(!g_Config.m_ClRainbow)
{
Graphics()->SetColor(pInfo->m_ColorBody.r, pInfo->m_ColorBody.g, pInfo->m_ColorBody.b, Alpha);
}
Expand Down Expand Up @@ -374,6 +374,7 @@ void CPlayers::RenderHook(
if(Prev.m_HookState > 0 && Player.m_HookState > 0)
{
Graphics()->SetColor(1.0f, 1.0f, 1.0f, 1.0f);

if(ClientId < 0)
Graphics()->SetColor(1.0f, 1.0f, 1.0f, 0.5f);

Expand All @@ -399,6 +400,12 @@ void CPlayers::RenderHook(
// render head
int QuadOffset = NUM_WEAPONS * 2 + 2;
Graphics()->SetColor(1.0f, 1.0f, 1.0f, Alpha);

bool Local = m_pClient->m_Snap.m_LocalClientId == ClientId;
bool DontOthers = !g_Config.m_ClRainbowOthers && !Local;
if(g_Config.m_ClRainbow && g_Config.m_ClRainbowHook && !DontOthers)
Graphics()->SetColor(GameClient()->m_Rainbow.m_RainbowColor.WithAlpha(Alpha));

Graphics()->RenderQuadContainerAsSprite(m_WeaponEmoteQuadContainerIndex, QuadOffset, HookPos.x, HookPos.y);

// render chain
Expand All @@ -419,6 +426,9 @@ void CPlayers::RenderHook(
Graphics()->QuadsSetRotation(0);
Graphics()->SetColor(1.0f, 1.0f, 1.0f, 1.0f);

if(g_Config.m_ClRainbow && g_Config.m_ClRainbowHook && !DontOthers)
Graphics()->SetColor(GameClient()->m_Rainbow.m_RainbowColor.WithAlpha(Alpha));

RenderHand(&RenderInfo, Position, normalize(HookPos - Pos), -pi / 2, vec2(20, 0), Alpha);
}
}
Expand All @@ -442,6 +452,8 @@ void CPlayers::RenderPlayer(
// float Alpha = (OtherTeam || ClientId < 0) ? g_Config.m_ClShowOthersAlpha / 100.0f : 1.0f;
bool Spec = m_pClient->m_Snap.m_SpecInfo.m_Active;

RenderTools()->m_LocalTeeRender = Local; // TClient

float Alpha = 1.0f;
if(OtherTeam || ClientId < 0)
Alpha = g_Config.m_ClShowOthersAlpha / 100.0f;
Expand Down Expand Up @@ -603,6 +615,10 @@ void CPlayers::RenderPlayer(

Graphics()->SetColor(1.0f, 1.0f, 1.0f, Alpha);

bool DontOthers = !g_Config.m_ClRainbowOthers && !Local;
if(g_Config.m_ClRainbow && g_Config.m_ClRainbowWeapon && !DontOthers)
Graphics()->SetColor(GameClient()->m_Rainbow.m_RainbowColor.WithAlpha(Alpha));

vec2 Dir = Direction;
float Recoil = 0.0f;
vec2 WeaponPosition;
Expand Down Expand Up @@ -764,6 +780,9 @@ void CPlayers::RenderPlayer(
Graphics()->SetColor(1.0f, 1.0f, 1.0f, 1.0f);
Graphics()->QuadsSetRotation(0);

if(g_Config.m_ClRainbow && !DontOthers)
Graphics()->SetColor(GameClient()->m_Rainbow.m_RainbowColor.WithAlpha(Alpha));

switch(Player.m_Weapon)
{
case WEAPON_GUN: RenderHand(&RenderInfo, WeaponPosition, Direction, -3 * pi / 4, vec2(-15, 4), Alpha); break;
Expand All @@ -788,7 +807,6 @@ void CPlayers::RenderPlayer(
RenderTools()->RenderTee(&State, &Shadow, Player.m_Emote, Direction, ShadowPosition, 0.5f); // render ghost
}
RenderTools()->RenderTee(&State, &RenderInfo, Player.m_Emote, Direction, Position, Alpha);

float TeeAnimScale, TeeBaseSize;
CRenderTools::GetRenderTeeAnimScaleAndBaseSize(&RenderInfo, TeeAnimScale, TeeBaseSize);
vec2 BodyPos = Position + vec2(State.GetBody()->m_X, State.GetBody()->m_Y) * TeeAnimScale;
Expand Down Expand Up @@ -883,6 +901,8 @@ void CPlayers::RenderPlayerGhost(
bool OtherTeam = m_pClient->IsOtherTeam(ClientId);
float Alpha = 1.0f;

RenderTools()->m_LocalTeeRender = Local; // TClient

bool FrozenSwappingHide = (m_pClient->m_aClients[ClientId].m_FreezeEnd > 0) && g_Config.m_ClHideFrozenGhosts && g_Config.m_ClSwapGhosts;

if(OtherTeam || ClientId < 0)
Expand Down
4 changes: 4 additions & 0 deletions src/game/client/components/tclient/menus_tclient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,8 @@ void CMenus::RenderSettingsTClientSettngs(CUIRect MainView)
DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClFreezeStars, Localize("Freeze stars"), &g_Config.m_ClFreezeStars, &Column, LineSize);
DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClColorFreeze, Localize("Color frozen tee skins"), &g_Config.m_ClColorFreeze, &Column, LineSize);
DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClHammerRotatesWithCursor, Localize("Make hammer rotate with cursor"), &g_Config.m_ClHammerRotatesWithCursor, &Column, LineSize);
DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClTinyTees, Localize("Tiny tees"), &g_Config.m_ClTinyTees, &Column, LineSize);
DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClTinyTeesOthers, Localize("Tiny tees others"), &g_Config.m_ClTinyTeesOthers, &Column, LineSize);
DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClWhiteFeet, Localize("Render all custom colored feet as white feet skin"), &g_Config.m_ClWhiteFeet, &Column, LineSize);
CUIRect FeetBox;
Column.HSplitTop(LineSize + MarginExtraSmall, &FeetBox, &Column);
Expand Down Expand Up @@ -948,6 +950,8 @@ void CMenus::RenderSettingsTClientSettngs(CUIRect MainView)
s_RainbowDropDownState.m_SelectionPopupContext.m_pScrollRegion = &s_RainbowDropDownScrollRegion;
int RainbowSelectedOld = g_Config.m_ClRainbowMode - 1;
DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClRainbow, Localize("Rainbow"), &g_Config.m_ClRainbow, &Column, LineSize);
DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClRainbowWeapon, Localize("Rainbow weapons"), &g_Config.m_ClRainbowWeapon, &Column, LineSize);
DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClRainbowHook, Localize("Rainbow hook"), &g_Config.m_ClRainbowHook, &Column, LineSize);
DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClRainbowOthers, Localize("Rainbow others"), &g_Config.m_ClRainbowOthers, &Column, LineSize);
Column.HSplitTop(MarginExtraSmall, nullptr, &Column);
CUIRect DropDownRect;
Expand Down
9 changes: 5 additions & 4 deletions src/game/client/components/tclient/rainbow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@

#include "rainbow.h"

template <typename T>
T color_lerp(T a, T b, float c) {
template<typename T>
T color_lerp(T a, T b, float c)
{
T result;
for(size_t i = 0; i < 4; ++i)
result[i] = a[i] + c * (b[i] - a[i]);
Expand All @@ -20,7 +21,6 @@ T color_lerp(T a, T b, float c) {

void CRainbow::OnRender()
{

if(!g_Config.m_ClRainbow && !g_Config.m_ClRainbowOthers)
return;
if(g_Config.m_ClRainbowMode == 0)
Expand Down Expand Up @@ -57,11 +57,12 @@ void CRainbow::OnRender()
break;
}

m_RainbowColor = Col;

for(int i = 0; i < MAX_CLIENTS; i++)
{
if(!m_pClient->m_Snap.m_aCharacters[i].m_Active)
continue;

// check if local player
bool Local = m_pClient->m_Snap.m_LocalClientId == i;
CTeeRenderInfo *RenderInfo = &m_pClient->m_aClients[i].m_RenderInfo;
Expand Down
2 changes: 2 additions & 0 deletions src/game/client/components/tclient/rainbow.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ class CRainbow : public CComponent
COLORMODE_DARKNESS,
COLORMODE_RANDOM
};

ColorRGBA m_RainbowColor = ColorRGBA(1,1,1,1);
};

#endif
25 changes: 25 additions & 0 deletions src/game/client/render.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,12 @@ void CRenderTools::RenderTee6(const CAnimState *pAnim, const CTeeRenderInfo *pIn
vec2 Direction = Dir;
vec2 Position = Pos;

const float TinyBodyScale = 0.7f;
const float TinyFeetScale = 0.85f;
bool TinyTee = g_Config.m_ClTinyTees;
if(!m_LocalTeeRender && !g_Config.m_ClTinyTeesOthers)
TinyTee = false;

const CSkin::SSkinTextures *pSkinTextures = pInfo->m_CustomColoredSkin ? &pInfo->m_ColorableRenderSkin : &pInfo->m_OriginalRenderSkin;

// first pass we draw the outline
Expand All @@ -529,6 +535,13 @@ void CRenderTools::RenderTee6(const CAnimState *pAnim, const CTeeRenderInfo *pIn
{
float AnimScale, BaseSize;
GetRenderTeeAnimScaleAndBaseSize(pInfo, AnimScale, BaseSize);

if(TinyTee)
{
BaseSize *= TinyBodyScale;
AnimScale *= TinyBodyScale;
}

if(Filling == 1)
{
Graphics()->QuadsSetRotation(pAnim->GetBody()->m_Angle * pi * 2);
Expand Down Expand Up @@ -582,12 +595,24 @@ void CRenderTools::RenderTee6(const CAnimState *pAnim, const CTeeRenderInfo *pIn
}
}

if(TinyTee)
{
BaseSize /= TinyBodyScale;
AnimScale /= TinyBodyScale;
}

// draw feet
const CAnimKeyframe *pFoot = Filling ? pAnim->GetFrontFoot() : pAnim->GetBackFoot();

float w = BaseSize;
float h = BaseSize / 2;

if(TinyTee)
{
w *= TinyFeetScale;
h *= TinyFeetScale;
}

int QuadOffset = 7;
if(Dir.x < 0 && pInfo->m_FeetFlipped)
{
Expand Down
2 changes: 2 additions & 0 deletions src/game/client/render.h
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,8 @@ class CRenderTools
class ITextRender *TextRender() const { return m_pTextRender; }
class CGameClient *GameClient() const { return m_pGameClient; }

bool m_LocalTeeRender = false; // TClient

void Init(class IGraphics *pGraphics, class ITextRender *pTextRender, class CGameClient *pGameClient);

void SelectSprite(int Id, int Flags = 0) const;
Expand Down

0 comments on commit 5140adf

Please sign in to comment.