Fix a self assignment bug in Weapons_AddItem(), added userinfo spraycolor support, fix accidentally double-drawing p_ models and add cvar sv_friendlyFire
This commit is contained in:
parent
1c58be4cdb
commit
c24c8b2435
5 changed files with 29 additions and 9 deletions
|
@ -186,6 +186,8 @@ Weapons_Draw(player pl)
|
|||
|
||||
if (g_weapons[i].updateammo != __NULL__)
|
||||
g_weapons[i].updateammo(pl);
|
||||
|
||||
pl.gflags |= GF_SEMI_TOGGLED;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -204,6 +206,9 @@ Weapons_Primary(player pl)
|
|||
|
||||
if (pl.flags & FL_NOATTACK)
|
||||
return;
|
||||
|
||||
if (pl.gflags & GF_SEMI_TOGGLED)
|
||||
return;
|
||||
|
||||
if (g_weapons[i].primary != __NULL__)
|
||||
g_weapons[i].primary(pl);
|
||||
|
|
|
@ -71,8 +71,8 @@ player::predraw(void)
|
|||
if (autocvar_cl_thirdperson == TRUE || !this_us) {
|
||||
Voice_Draw3D(this);
|
||||
Player_PreDraw(this, TRUE);
|
||||
if (p_model)
|
||||
addentity(p_model);
|
||||
//if (p_model)
|
||||
// addentity(p_model);
|
||||
//addentity(this);
|
||||
} else {
|
||||
Player_PreDraw(this, FALSE);
|
||||
|
|
|
@ -89,6 +89,7 @@ CSEv_Spraylogo(void)
|
|||
#ifdef CLIENT
|
||||
class CSpraylogo
|
||||
{
|
||||
vector m_vecColor;
|
||||
vector m_vecPosition;
|
||||
vector m_vecAngles;
|
||||
int m_iOwnerID;
|
||||
|
@ -104,7 +105,7 @@ const string g_spray_mat = \
|
|||
"polygonOffset\n" \
|
||||
"{\n" \
|
||||
"map $rt:%s\n" \
|
||||
"blendfunc blendFunc GL_DST_COLOR GL_ZERO\n" \
|
||||
"blendfunc GL_DST_COLOR GL_ZERO\n" \
|
||||
"rgbGen vertex\n" \
|
||||
"}\n" \
|
||||
"}";
|
||||
|
@ -137,14 +138,21 @@ CSpraylogo::predraw(void)
|
|||
vector width;
|
||||
vector height;
|
||||
vector light;
|
||||
vector color;
|
||||
vector combined;
|
||||
color = stov(getplayerkeyvalue(m_iOwnerID, "spraycolor"));
|
||||
light = (getlight(m_vecPosition) / 255);
|
||||
|
||||
light = getlight(m_vecPosition) / 255;
|
||||
/* unrolling this because the compiler spat out garbage */
|
||||
combined[0] = m_vecColor[0] * light[0];
|
||||
combined[1] = m_vecColor[1] * light[1];
|
||||
combined[2] = m_vecColor[2] * light[2];
|
||||
|
||||
/* TODO: handle spray dimensions independently */
|
||||
makevectors(m_vecAngles);
|
||||
width = v_up / 64;
|
||||
height = v_forward / 64;
|
||||
adddecal(m_strName, m_vecPosition, width, height, light, 1.0f);
|
||||
adddecal(m_strName, m_vecPosition, width, height, combined, 1.0f);
|
||||
}
|
||||
return (PREDRAW_NEXT);
|
||||
}
|
||||
|
@ -165,5 +173,6 @@ Spray_Parse(void)
|
|||
spSelf.m_iOwnerID = readentitynum() - 1;
|
||||
spSelf.m_strName = sprintf("spray_%i", spSelf.m_iOwnerID);
|
||||
spSelf.m_m_strPath = sprintf("simg_%i", spSelf.m_iOwnerID);
|
||||
spSelf.m_vecColor = stov(getplayerkeyvalue(spSelf.m_iOwnerID, "spraycolor"));
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
var bool autocvar_sv_friendlyFire = false;
|
||||
|
||||
/* init */
|
||||
void
|
||||
CGameRules::InitPostEnts(void)
|
||||
|
@ -210,6 +212,14 @@ CGameRules::DamageApply(entity t, entity c, float dmg, int w, damageType_t type)
|
|||
if (eTarget.flags & FL_CLIENT && eTarget.flags & FL_GODMODE)
|
||||
return;
|
||||
|
||||
/* friendly fire */
|
||||
if (autocvar_sv_friendlyFire == false)
|
||||
if (IsTeamPlay()) {
|
||||
if (t.flags & FL_CLIENT && c.flags & FL_CLIENT)
|
||||
if (t.team == c.team)
|
||||
return;
|
||||
}
|
||||
|
||||
/* already dead, please avoid recursion */
|
||||
if (eTarget.GetHealth() <= 0)
|
||||
return;
|
||||
|
|
|
@ -123,8 +123,6 @@ int
|
|||
Weapons_AddItem(base_player pl, int w, int startammo)
|
||||
{
|
||||
int value;
|
||||
entity oldself = self;
|
||||
self = pl;
|
||||
|
||||
/* let's check if we've got a limit */
|
||||
int maxit;
|
||||
|
@ -139,7 +137,6 @@ Weapons_AddItem(base_player pl, int w, int startammo)
|
|||
|
||||
/* we're over the slot limit. */
|
||||
if (c >= maxit) {
|
||||
self = oldself;
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
|
@ -194,7 +191,6 @@ Weapons_AddItem(base_player pl, int w, int startammo)
|
|||
}
|
||||
|
||||
Weapons_RefreshAmmo(pl);
|
||||
self = oldself;
|
||||
return value;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue