mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
apply custom colour to blood colour. Closes #314
This commit is contained in:
parent
bc5f3fc839
commit
e6698b1118
|
@ -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++)
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -708,8 +708,8 @@ void CGameClient::OnNewSnapshot()
|
|||
if(m_aClients[Cid].m_aSkinName[0] == 'x' || m_aClients[Cid].m_aSkinName[1] == '_')
|
||||
str_copy(m_aClients[Cid].m_aSkinName, "default", 64);
|
||||
|
||||
m_aClients[Cid].m_SkinInfo.m_ColorBody = m_pSkins->GetColor(m_aClients[Cid].m_ColorBody);
|
||||
m_aClients[Cid].m_SkinInfo.m_ColorFeet = m_pSkins->GetColor(m_aClients[Cid].m_ColorFeet);
|
||||
m_aClients[Cid].m_SkinInfo.m_ColorBody = m_pSkins->GetColorV4(m_aClients[Cid].m_ColorBody);
|
||||
m_aClients[Cid].m_SkinInfo.m_ColorFeet = m_pSkins->GetColorV4(m_aClients[Cid].m_ColorFeet);
|
||||
m_aClients[Cid].m_SkinInfo.m_Size = 64;
|
||||
|
||||
// find new skin
|
||||
|
@ -948,8 +948,8 @@ void CGameClient::CClientData::UpdateRenderInfo()
|
|||
if(m_Team >= 0 && m_Team <= 1)
|
||||
{
|
||||
m_RenderInfo.m_Texture = g_GameClient.m_pSkins->Get(m_SkinId)->m_ColorTexture;
|
||||
m_RenderInfo.m_ColorBody = g_GameClient.m_pSkins->GetColor(TeamColors[m_Team]);
|
||||
m_RenderInfo.m_ColorFeet = g_GameClient.m_pSkins->GetColor(TeamColors[m_Team]);
|
||||
m_RenderInfo.m_ColorBody = g_GameClient.m_pSkins->GetColorV4(TeamColors[m_Team]);
|
||||
m_RenderInfo.m_ColorFeet = g_GameClient.m_pSkins->GetColorV4(TeamColors[m_Team]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue