about summary refs log tree commit diff
path: root/src/game/client/components
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/client/components')
-rw-r--r--src/game/client/components/effects.cpp12
-rw-r--r--src/game/client/components/menus_settings.cpp11
-rw-r--r--src/game/client/components/skins.cpp7
-rw-r--r--src/game/client/components/skins.h3
4 files changed, 23 insertions, 10 deletions
diff --git a/src/game/client/components/effects.cpp b/src/game/client/components/effects.cpp
index 79117d30..45dd856e 100644
--- a/src/game/client/components/effects.cpp
+++ b/src/game/client/components/effects.cpp
@@ -1,6 +1,7 @@
 /* (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 <engine/demo.h>
+#include <engine/shared/config.h>
 
 #include <game/generated/client_data.h>
 
@@ -153,9 +154,14 @@ void CEffects::PlayerDeath(vec2 Pos, int Cid)
 
 	if(Cid >= 0)	
 	{
-		const CSkins::CSkin *s = m_pClient->m_pSkins->Get(m_pClient->m_aClients[Cid].m_SkinId);
-		if(s)
-			BloodColor = s->m_BloodColor;
+		if(g_Config.m_PlayerUseCustomColor)
+			BloodColor = m_pClient->m_pSkins->GetColorV3(g_Config.m_PlayerColorBody);
+		else
+		{
+			const CSkins::CSkin *s = m_pClient->m_pSkins->Get(m_pClient->m_aClients[Cid].m_SkinId);
+			if(s)
+				BloodColor = s->m_BloodColor;
+		}
 	}
 	
 	for(int i = 0; i < 64; i++)
diff --git a/src/game/client/components/menus_settings.cpp b/src/game/client/components/menus_settings.cpp
index 3c134cce..119dc2f5 100644
--- a/src/game/client/components/menus_settings.cpp
+++ b/src/game/client/components/menus_settings.cpp
@@ -116,8 +116,8 @@ void CMenus::RenderSettingsPlayer(CUIRect MainView)
 
             if(g_Config.m_PlayerUseCustomColor)
             {
-                OwnSkinInfo.m_ColorBody = m_pClient->m_pSkins->GetColor(g_Config.m_PlayerColorBody);
-                OwnSkinInfo.m_ColorFeet = m_pClient->m_pSkins->GetColor(g_Config.m_PlayerColorFeet);
+                OwnSkinInfo.m_ColorBody = m_pClient->m_pSkins->GetColorV4(g_Config.m_PlayerColorBody);
+                OwnSkinInfo.m_ColorFeet = m_pClient->m_pSkins->GetColorV4(g_Config.m_PlayerColorFeet);
                 OwnSkinInfo.m_Texture = pOwnSkin->m_ColorTexture;
             }
 
@@ -250,8 +250,8 @@ void CMenus::RenderSettingsPlayer(CUIRect MainView)
 
 				if(g_Config.m_PlayerUseCustomColor)
 				{
-					Info.m_ColorBody = m_pClient->m_pSkins->GetColor(g_Config.m_PlayerColorBody);
-					Info.m_ColorFeet = m_pClient->m_pSkins->GetColor(g_Config.m_PlayerColorFeet);
+					Info.m_ColorBody = m_pClient->m_pSkins->GetColorV4(g_Config.m_PlayerColorBody);
+					Info.m_ColorFeet = m_pClient->m_pSkins->GetColorV4(g_Config.m_PlayerColorFeet);
 					Info.m_Texture = s->m_ColorTexture;
 				}
 
@@ -261,9 +261,10 @@ void CMenus::RenderSettingsPlayer(CUIRect MainView)
 
 				if(g_Config.m_Debug)
 				{
+					vec3 BloodColor = g_Config.m_PlayerUseCustomColor ? m_pClient->m_pSkins->GetColorV3(g_Config.m_PlayerColorBody) : s->m_BloodColor;
 					Graphics()->TextureSet(-1);
 					Graphics()->QuadsBegin();
-					Graphics()->SetColor(s->m_BloodColor.r, s->m_BloodColor.g, s->m_BloodColor.b, 1.0f);
+					Graphics()->SetColor(BloodColor.r, BloodColor.g, BloodColor.b, 1.0f);
 					IGraphics::CQuadItem QuadItem(Item.m_Rect.x, Item.m_Rect.y, 12, 12);
 					Graphics()->QuadsDrawTL(&QuadItem, 1);
 					Graphics()->QuadsEnd();
diff --git a/src/game/client/components/skins.cpp b/src/game/client/components/skins.cpp
index 638baeae..9c39e9ad 100644
--- a/src/game/client/components/skins.cpp
+++ b/src/game/client/components/skins.cpp
@@ -179,7 +179,12 @@ static vec3 HslToRgb(vec3 in)
 	return Out;
 }
 
-vec4 CSkins::GetColor(int v)
+vec3 CSkins::GetColorV3(int v)
+{
+	return HslToRgb(vec3(((v>>16)&0xff)/255.0f, ((v>>8)&0xff)/255.0f, 0.5f+(v&0xff)/255.0f*0.5f));
+}
+
+vec4 CSkins::GetColorV4(int v)
 {
 	vec3 r = HslToRgb(vec3(((v>>16)&0xff)/255.0f, ((v>>8)&0xff)/255.0f, 0.5f+(v&0xff)/255.0f*0.5f));
 	return vec4(r.r, r.g, r.b, 1.0f);
diff --git a/src/game/client/components/skins.h b/src/game/client/components/skins.h
index 519f2e73..9e20ba37 100644
--- a/src/game/client/components/skins.h
+++ b/src/game/client/components/skins.h
@@ -22,7 +22,8 @@ public:
 	
 	void Init();
 	
-	vec4 GetColor(int v);
+	vec3 GetColorV3(int v);
+	vec4 GetColorV4(int v);
 	int Num();
 	const CSkin *Get(int Index);
 	int Find(const char *pName);