Skip to content
This repository has been archived by the owner on Nov 30, 2024. It is now read-only.

Commit

Permalink
Fixed rainbow
Browse files Browse the repository at this point in the history
  • Loading branch information
StormAxs committed Dec 15, 2023
1 parent 26e6670 commit 5bdc35a
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 18 deletions.
5 changes: 3 additions & 2 deletions src/engine/shared/config_variables.h
Original file line number Diff line number Diff line change
Expand Up @@ -737,5 +737,6 @@ MACRO_CONFIG_COL(ClOutlineColorFreeze, sc_outline_color_freeze, 0, CFGFLAG_CLIEN
MACRO_CONFIG_COL(ClOutlineColorTele, sc_outline_color_tele, 0, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Tele outline color") //0 0 0
MACRO_CONFIG_COL(ClOutlineColorUnfreeze, sc_outline_color_unfreeze, 0, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Unfreeze outline color") //0 0 0

MACRO_CONFIG_INT(ClRainbow, sc_rainbow, 0, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Draws outline around hook and unhook")
MACRO_CONFIG_INT(ClRainbowSpeed, sc_rainbow_speed, 20, 0, 100, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Draws outline around hook and unhook")
MACRO_CONFIG_INT(ClRainbow, sc_rainbow, 0, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Rainbow urself")
MACRO_CONFIG_INT(ClRainbowSpeed, sc_rainbow_speed, 20, 0, 100, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Rainbow speed")
MACRO_CONFIG_INT(ClRainbowEveryone, sc_rainbow_all, 0, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Rainbow all")
27 changes: 19 additions & 8 deletions src/game/client/components/menus_ingame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -910,6 +910,7 @@ void CMenus::RenderStats(CUIRect MainView)
MP1.VMargin(1.0f, &MP1);
MP2.VMargin(1.0f, &MP2);


const float LineMargin = 22.0f;
char *pSkinName = g_Config.m_ClPlayerSkin;
int *pUseCustomColor = &g_Config.m_ClPlayerUseCustomColor;
Expand Down Expand Up @@ -948,16 +949,26 @@ void CMenus::RenderStats(CUIRect MainView)
LF.Draw(vec4(1, 1, 1, 0.25f), IGraphics::CORNER_ALL, 2.0f);
LP.Draw(vec4(1, 1, 1, 0.25f), IGraphics::CORNER_ALL, 2.0f);
rank.Draw(vec4(1, 1, 1, 0.25f), IGraphics::CORNER_ALL, 2.0f);
MP1.Draw(vec4(1, 1, 1, 0.25f), IGraphics::CORNER_ALL, 0.0f);
MP1.Draw(vec4(1, 1, 1, 0.25f), IGraphics::CORNER_T, 2.0f);
PointsS.Draw(vec4(1, 1, 1, 0.25f), IGraphics::CORNER_ALL, 2.0f);
MP2.Draw(vec4(1, 1, 1, 0.25f), IGraphics::CORNER_ALL, 0.0f);
MP2.Draw(vec4(1, 1, 1, 0.25f), IGraphics::CORNER_B, 2.0f);

char Welcome [128];
str_format(Welcome, sizeof(Welcome), " Welcome Back, %s", Client()->PlayerName());
UI()->DoLabel(&WB, Welcome, 40.0f, TEXTALIGN_ML);
if (strcmp(Client()->PlayerName(), "-StormAx") == 0)
{
ColorRGBA col = color_cast<ColorRGBA>(ColorHSVA(round_to_int(LocalTime() * 15.f) % 255 /255.f, 1.f, 1.f));
TextRender()->TextColor(col);
return;
}
}
else if(s_StatsPage == 1)
{

}

else if (s_StatsPage ==2)
else if (s_StatsPage ==2) //only uses DDstats!
{
//test
static CStatsPlayer s_StatsPlayer;
Expand Down Expand Up @@ -993,17 +1004,17 @@ void CMenus::RenderStats(CUIRect MainView)
m_pClient->m_Stats.FetchPlayer(&s_StatsPlayer, m_StatsPlayerInput.GetString());
}

if(!s_StatsPlayer.m_pGetStats)
if(!s_StatsPlayer.m_pGetStatsDDStats)
return;

if(s_StatsPlayer.m_pGetStats->State() == s_StatsPlayer.m_pGetStats->STATE_PENDING)
if(s_StatsPlayer.m_pGetStatsDDStats->State() == s_StatsPlayer.m_pGetStatsDDStats->STATE_PENDING)
return;

if(!s_StatsPlayer.StatsParsed && s_StatsPlayer.m_pGetStats->State() == s_StatsPlayer.m_pGetStats->STATE_DONE)
if(!s_StatsPlayer.StatsParsed && s_StatsPlayer.m_pGetStatsDDStats->State() == s_StatsPlayer.m_pGetStatsDDStats->STATE_DONE)
return m_pClient->m_Stats.ParseJSON(&s_StatsPlayer);

MainView.HSplitTop(20.0f, &Label, &MainView);
if(s_StatsPlayer.m_pGetStats->State() == -1) // error (404)
if(s_StatsPlayer.m_pGetStatsDDStats->State() == -1) // error (404)
{
UI()->DoLabel(&Label, "No player found.", 14.0f, TEXTALIGN_ML);
return;
Expand Down Expand Up @@ -1430,4 +1441,4 @@ void CMenus::RenderIngameHint()
TextRender()->TextColor(1, 1, 1, 1);
TextRender()->Text(5, 280, 5, Localize("Menu opened. Press Esc key again to close menu."), -1.0f);
UI()->MapScreen();
}
}
21 changes: 14 additions & 7 deletions src/game/client/components/players.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -473,14 +473,20 @@ void CPlayers::RenderPlayer(
Alpha);
}

// ass
// rainbow
bool IsRainbowBody = g_Config.m_ClRainbow,
IsRainbowFeet = g_Config.m_ClRainbow;

bool IsRainbowBody = false;
bool IsRainbowFeet = false;
bool Rainbow = IsRainbowBody || IsRainbowFeet;
Rainbow = g_Config.m_ClRainbow;
if (g_Config.m_ClRainbowEveryone == 1)
{
g_Config.m_ClRainbow = 1;
}
else
{
g_Config.m_ClRainbow = Local == 1;
}

if(Rainbow == 1)
if(g_Config.m_ClRainbow == 1)
{
IsRainbowBody = true;
IsRainbowFeet = true;
Expand Down Expand Up @@ -710,7 +716,8 @@ void CPlayers::RenderPlayer(
if(IsRainbowBody)
RenderInfo.m_ColorBody = color_cast<ColorRGBA>(ColorHSVA(round_to_int(LocalTime() * g_Config.m_ClRainbowSpeed) % 255 / 255.f, 1.f, 1.f));
if(IsRainbowFeet)
RenderInfo.m_ColorFeet = color_cast<ColorRGBA>(ColorHSVA(round_to_int(LocalTime() * 20.f) % 255 / 255.f, 1.f, 1.f));
RenderInfo.m_ColorFeet = color_cast<ColorRGBA>(ColorHSVA(round_to_int(LocalTime() * g_Config.m_ClRainbowSpeed) % 255 / 255.f, 1.f, 1.f));


RenderTools()->RenderTee(&State, &RenderInfo, Player.m_Emote, Direction, Position, Alpha, true, ClientID, InAir);

Expand Down
2 changes: 1 addition & 1 deletion src/game/server/player.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
/* If you are missing that file, acquire a complete release at teeworlds.com. */
#include "player.h"
#include "entities/character.h"
Expand Down

0 comments on commit 5bdc35a

Please sign in to comment.