Spraylogo: Handle both monochrome (BMP) and colored spraylogos.
This commit is contained in:
parent
a9b25c2f6f
commit
128404d5d3
2 changed files with 36 additions and 9 deletions
|
@ -97,22 +97,26 @@ class CSpraylogo
|
||||||
string m_strName;
|
string m_strName;
|
||||||
string m_m_strPath;
|
string m_m_strPath;
|
||||||
int m_iInitialized;
|
int m_iInitialized;
|
||||||
|
bool m_bMonochrome;
|
||||||
|
|
||||||
|
void(void) CSpraylogo;
|
||||||
virtual float(void) predraw;
|
virtual float(void) predraw;
|
||||||
|
virtual void(void) RendererRestarted;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef WASTES
|
|
||||||
const string g_spray_mat = \
|
const string g_spray_mat_1 = \
|
||||||
"{\n" \
|
"{\n" \
|
||||||
"cull disable\n" \
|
"cull disable\n" \
|
||||||
"polygonOffset\n" \
|
"polygonOffset\n" \
|
||||||
"{\n" \
|
"{\n" \
|
||||||
"map $rt:%s\n" \
|
"map $rt:%s\n" \
|
||||||
"blendfunc GL_DST_COLOR GL_ONE\n" \
|
"blendfunc GL_SRC_COLOR GL_ONE_MINUS_SRC_COLOR\n" \
|
||||||
"rgbGen vertex\n" \
|
"rgbGen vertex\n" \
|
||||||
"}\n" \
|
"}\n" \
|
||||||
"}";
|
"}";
|
||||||
#else
|
|
||||||
const string g_spray_mat = \
|
const string g_spray_mat_0 = \
|
||||||
"{\n" \
|
"{\n" \
|
||||||
"cull disable\n" \
|
"cull disable\n" \
|
||||||
"polygonOffset\n" \
|
"polygonOffset\n" \
|
||||||
|
@ -122,7 +126,12 @@ const string g_spray_mat = \
|
||||||
"rgbGen vertex\n" \
|
"rgbGen vertex\n" \
|
||||||
"}\n" \
|
"}\n" \
|
||||||
"}";
|
"}";
|
||||||
#endif
|
|
||||||
|
void
|
||||||
|
CSpraylogo::RendererRestarted(void)
|
||||||
|
{
|
||||||
|
m_iInitialized = false;
|
||||||
|
}
|
||||||
|
|
||||||
float
|
float
|
||||||
CSpraylogo::predraw(void)
|
CSpraylogo::predraw(void)
|
||||||
|
@ -147,7 +156,10 @@ CSpraylogo::predraw(void)
|
||||||
memfree(image);
|
memfree(image);
|
||||||
|
|
||||||
/* push the material into memory */
|
/* push the material into memory */
|
||||||
shaderforname(m_strName, sprintf(g_spray_mat, m_m_strPath));
|
if (m_bMonochrome == true)
|
||||||
|
shaderforname(m_strName, sprintf(g_spray_mat_1, m_m_strPath));
|
||||||
|
else
|
||||||
|
shaderforname(m_strName, sprintf(g_spray_mat_0, m_m_strPath));
|
||||||
} else {
|
} else {
|
||||||
vector width;
|
vector width;
|
||||||
vector height;
|
vector height;
|
||||||
|
@ -171,6 +183,14 @@ CSpraylogo::predraw(void)
|
||||||
return (PREDRAW_NEXT);
|
return (PREDRAW_NEXT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CSpraylogo::CSpraylogo(void)
|
||||||
|
{
|
||||||
|
// boo
|
||||||
|
m_vecColor = [1,1,1];
|
||||||
|
m_bMonochrome = false;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Spray_Parse(void)
|
Spray_Parse(void)
|
||||||
{
|
{
|
||||||
|
@ -185,8 +205,9 @@ Spray_Parse(void)
|
||||||
spSelf.m_vecAngles[2] = readcoord();
|
spSelf.m_vecAngles[2] = readcoord();
|
||||||
spSelf.m_iInitialized = FALSE;
|
spSelf.m_iInitialized = FALSE;
|
||||||
spSelf.m_iOwnerID = readentitynum() - 1;
|
spSelf.m_iOwnerID = readentitynum() - 1;
|
||||||
spSelf.m_strName = sprintf("spray_%i", spSelf.m_iOwnerID);
|
spSelf.m_bMonochrome = getplayerkeyfloat(spSelf.m_iOwnerID, "spraytype");
|
||||||
spSelf.m_m_strPath = sprintf("simg_%i", spSelf.m_iOwnerID);
|
spSelf.m_strName = sprintf("spray_%i_%d", spSelf.m_iOwnerID, spSelf.m_bMonochrome);
|
||||||
|
spSelf.m_m_strPath = sprintf("simg_%i_%d", spSelf.m_iOwnerID, spSelf.m_bMonochrome);
|
||||||
spSelf.m_vecColor = stov(getplayerkeyvalue(spSelf.m_iOwnerID, "spraycolor"));
|
spSelf.m_vecColor = stov(getplayerkeyvalue(spSelf.m_iOwnerID, "spraycolor"));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -90,6 +90,12 @@ cz_cbSprayChanged(void)
|
||||||
string mdl = cz_psSpray.GetPic();
|
string mdl = cz_psSpray.GetPic();
|
||||||
localcmd(sprintf("seta _cl_playerspray %s\n", mdl));
|
localcmd(sprintf("seta _cl_playerspray %s\n", mdl));
|
||||||
localcmd(sprintf("setinfoblob spray %s\n", mdl));
|
localcmd(sprintf("setinfoblob spray %s\n", mdl));
|
||||||
|
|
||||||
|
/* bmp are always monochrome */
|
||||||
|
if (substring(mdl, strlen(mdl) - 3, 3) == "bmp")
|
||||||
|
localcmd("setinfo spraytype 1\n");
|
||||||
|
else
|
||||||
|
localcmd("setinfo spraytype 0\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in a new issue