This commit is contained in:
GreYFoXGTi 2010-11-24 02:28:01 +02:00
commit ae4aebd365
7 changed files with 31 additions and 17 deletions

View file

@ -280,7 +280,7 @@ public:
return false;
char aBuffer[MAX_PATH_LENGTH];
return remove(GetPath(Type, pFilename, aBuffer, sizeof(aBuffer)));
return !remove(GetPath(Type, pFilename, aBuffer, sizeof(aBuffer)));
}
virtual bool CreateFolder(const char *pFoldername, int Type)
@ -289,7 +289,7 @@ public:
return false;
char aBuffer[MAX_PATH_LENGTH];
return fs_makedir(GetPath(Type, pFoldername, aBuffer, sizeof(aBuffer)));
return !fs_makedir(GetPath(Type, pFoldername, aBuffer, sizeof(aBuffer)));
}
static IStorage *Create(const char *pApplicationName, int NumArgs, const char **ppArguments)

View file

@ -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++)

View file

@ -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();

View file

@ -50,7 +50,8 @@ void CParticles::Add(int Group, CParticle *pPart)
// remove from the free list
int Id = m_FirstFree;
m_FirstFree = m_aParticles[Id].m_NextPart;
m_aParticles[m_FirstFree].m_PrevPart = -1;
if(m_FirstFree != -1)
m_aParticles[m_FirstFree].m_PrevPart = -1;
// copy data
m_aParticles[Id] = *pPart;

View file

@ -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);

View file

@ -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);

View file

@ -745,8 +745,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
@ -993,8 +993,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]);
}
}
}