Spraylogos: Illuminate them with getlight()

This commit is contained in:
Marco Cawthorne 2019-09-05 18:11:01 +02:00
parent 396e811850
commit 98e7bdef03
3 changed files with 21 additions and 13 deletions

View file

@ -140,9 +140,13 @@ void w_chainsaw_hudpic(int s, vector pos)
{
#ifdef CSQC
if (s) {
drawsubpic(pos, [170,45], "sprites/chainsaw.spr_0.tga", [0,48/256], [170/256,45/256], g_hud_color, 1, DRAWFLAG_ADDITIVE);
drawsubpic(pos, [170,45], "sprites/chainsaw.spr_0.tga",
[0,48/256], [170/256,45/256],
g_hud_color, 1, DRAWFLAG_ADDITIVE);
} else {
drawsubpic(pos, [170,45], "sprites/chainsaw.spr_0.tga", [0,0], [170/256,45/256], g_hud_color, 1, DRAWFLAG_ADDITIVE);
drawsubpic(pos, [170,45], "sprites/chainsaw.spr_0.tga",
[0,0], [170/256,45/256],
g_hud_color, 1, DRAWFLAG_ADDITIVE);
}
#endif
}

View file

@ -59,14 +59,14 @@ void CSEv_Spraylogo(void)
vector vSprayAngles = self.v_angle;
vSprayAngles[0] *= -1;
makevectors(vSprayAngles);
vector vecCoplanar = v_forward -(v_forward * trace_plane_normal)
* trace_plane_normal;
if (trace_plane_normal[2] == 0) {
vecCoplanar = '0 0 1';
}
eSpray.angles = vectoangles(vecCoplanar, trace_plane_normal);
eSpray.SendEntity = Spray_SendEntity;
eSpray.SendFlags = 1;
@ -104,15 +104,16 @@ float CSpraylogo::predraw(void)
memfree(image);
print(sprintf("[CLIENT] Spray from player: %s\n",
getplayerkeyvalue(m_iOwnerID, "name")));
getplayerkeyvalue(m_iOwnerID, "name")));
shaderforname(m_strLogoname,
sprintf("{\ncull disable\npolygonOffset\n{\nmap $rt:%s\nblendfunc blend\n}\n}",
sprintf("{\ncull disable\npolygonOffset\n{\nmap $rt:%s\nblendfunc gl_one gl_one_minus_src_alpha\nrgbGen vertex\n}\n}",
m_strLogopath));
} else {
vector light = getlight(m_vecPosition) / 255;
makevectors(m_vecAngles);
adddecal(m_strLogoname, m_vecPosition,
v_up / 64, v_forward / 64, '1 0 0', 1.0f);
v_up / 64, v_forward / 64, light, 1.0f);
addentity(this);
}
return PREDRAW_NEXT;
@ -132,8 +133,8 @@ void Spraylogo_Parse(void)
spSelf.m_iInitialized = FALSE;
spSelf.m_iOwnerID = readentitynum() - 1;
spSelf.m_strLogoname = sprintf("spray_%i",
spSelf.m_iOwnerID);
spSelf.m_iOwnerID);
spSelf.m_strLogopath = sprintf("simg_%i",
spSelf.m_iOwnerID);
spSelf.m_iOwnerID);
}
#endif

View file

@ -155,11 +155,10 @@ void w_snark_primary(void)
w_snark_deploy();
pl.ammo_snark--;
Weapons_UpdateAmmo(pl, __NULL__, pl.ammo_snark, __NULL__);
if (pl.a_ammo2 <= 0) {
Weapons_RemoveItem(pl, WEAPON_SNARK);
}
#endif
pl.w_idle_next = 1.0f;
@ -248,9 +247,13 @@ void w_snark_hudpic(int s, vector pos)
{
#ifdef CSQC
if (s) {
drawsubpic(pos, [170,45], "sprites/640hud6.spr_0.tga", [0,135/256], [170/256,45/256], g_hud_color, 1, DRAWFLAG_ADDITIVE);
drawsubpic(pos, [170,45], "sprites/640hud6.spr_0.tga",
[0,135/256], [170/256,45/256],
g_hud_color, 1, DRAWFLAG_ADDITIVE);
} else {
drawsubpic(pos, [170,45], "sprites/640hud3.spr_0.tga", [0,135/256], [170/256,45/256], g_hud_color, 1, DRAWFLAG_ADDITIVE);
drawsubpic(pos, [170,45], "sprites/640hud3.spr_0.tga",
[0,135/256], [170/256,45/256],
g_hud_color, 1, DRAWFLAG_ADDITIVE);
}
#endif
}