NSProjectile: Quick support for light_color/light_radius
This commit is contained in:
parent
73bec53034
commit
29b6a200b8
2 changed files with 104 additions and 7 deletions
|
@ -44,7 +44,9 @@ Objects such as rockets, grenades, bolts etc. should ideally be this. */
|
|||
class NSProjectile:NSSurfacePropEntity
|
||||
{
|
||||
private:
|
||||
PREDICTED_FLOAT_N(traileffectnum)
|
||||
NETWORKED_FLOAT_N(traileffectnum)
|
||||
NETWORKED_VECTOR(m_vecLightColor)
|
||||
NETWORKED_FLOAT(m_flLightRadius)
|
||||
|
||||
#ifdef SERVER
|
||||
/* sprite animation gubbins */
|
||||
|
@ -82,8 +84,7 @@ private:
|
|||
string m_partSmokeFuse;
|
||||
string m_defProjectileDebris;
|
||||
int m_iDebrisCount;
|
||||
vector m_vecLightColor; /* TODO */
|
||||
float m_flLightRadius; /* TODO */
|
||||
|
||||
float m_flLightOffset; /* TODO */
|
||||
vector m_vecExplodeLightColor; /* TODO */
|
||||
float m_fExplodelLightRadius; /* TODO */
|
||||
|
@ -119,6 +120,7 @@ public:
|
|||
|
||||
#ifdef CLIENT
|
||||
virtual void ReceiveEntity(float, float);
|
||||
virtual float predraw(void);
|
||||
#endif
|
||||
|
||||
#ifdef SERVER
|
||||
|
@ -150,6 +152,18 @@ public:
|
|||
|
||||
/* launch the projectile into the world */
|
||||
nonvirtual void Launch(vector, vector, float, float, float);
|
||||
|
||||
nonvirtual void SetLightColor(vector);
|
||||
nonvirtual void SetLightRadius(float);
|
||||
|
||||
nonvirtual void EnableDetonateOnFuse(bool);
|
||||
nonvirtual void EnableDetonateOnDeath(bool);
|
||||
nonvirtual void EnableDetonateOnWorld(bool);
|
||||
nonvirtual void EnableDetonateOnActor(bool);
|
||||
nonvirtual void EnableStickToWorld(bool);
|
||||
nonvirtual void EnableStickToActor(bool);
|
||||
nonvirtual void EnableThrustHoming(bool);
|
||||
nonvirtual void EnableInheritVelocity(bool);
|
||||
#endif
|
||||
};
|
||||
|
||||
|
|
|
@ -34,10 +34,10 @@ NSProjectile::NSProjectile(void)
|
|||
m_flMass = 0.0f;
|
||||
m_flGravity = 0.0f;
|
||||
m_flFuse = 0.0f;
|
||||
m_bDetonateOnFuse = 0.0f;
|
||||
m_bDetonateOnDeath = 0.0f;
|
||||
m_bDetonateOnWorld = 0.0f;
|
||||
m_bDetonateOnActor = 0.0f;
|
||||
m_bDetonateOnFuse = false;
|
||||
m_bDetonateOnDeath = true;
|
||||
m_bDetonateOnWorld = true;
|
||||
m_bDetonateOnActor = true;
|
||||
m_bImpactEffect = false;
|
||||
m_bImpactGib = false;
|
||||
m_matDetonate = __NULL__;
|
||||
|
@ -524,6 +524,66 @@ NSProjectile::Death(void)
|
|||
Destroy();
|
||||
}
|
||||
|
||||
void
|
||||
NSProjectile::SetLightColor(vector newColor)
|
||||
{
|
||||
m_vecLightColor = newColor;
|
||||
}
|
||||
|
||||
void
|
||||
NSProjectile::SetLightRadius(float newRadius)
|
||||
{
|
||||
m_flLightRadius = newRadius;
|
||||
}
|
||||
|
||||
void
|
||||
NSProjectile::EnableDetonateOnFuse(bool enabled)
|
||||
{
|
||||
m_bDetonateOnFuse = enabled;
|
||||
}
|
||||
|
||||
void
|
||||
NSProjectile::EnableDetonateOnDeath(bool enabled)
|
||||
{
|
||||
m_bDetonateOnDeath = enabled;
|
||||
}
|
||||
|
||||
void
|
||||
NSProjectile::EnableDetonateOnWorld(bool enabled)
|
||||
{
|
||||
m_bDetonateOnWorld = enabled;
|
||||
}
|
||||
|
||||
void
|
||||
NSProjectile::EnableDetonateOnActor(bool enabled)
|
||||
{
|
||||
m_bDetonateOnActor = enabled;
|
||||
}
|
||||
|
||||
void
|
||||
NSProjectile::EnableStickToWorld(bool enabled)
|
||||
{
|
||||
m_bStickToWorld = enabled;
|
||||
}
|
||||
|
||||
void
|
||||
NSProjectile::EnableStickToActor(bool enabled)
|
||||
{
|
||||
m_bStickToActor = enabled;
|
||||
}
|
||||
|
||||
void
|
||||
NSProjectile::EnableThrustHoming(bool enabled)
|
||||
{
|
||||
m_bThrustHoming = enabled;
|
||||
}
|
||||
|
||||
void
|
||||
NSProjectile::EnableInheritVelocity(bool enabled)
|
||||
{
|
||||
m_bInheritVelocity = enabled;
|
||||
}
|
||||
|
||||
void
|
||||
NSProjectile::SetImpact(void(entity a,entity b) func)
|
||||
{
|
||||
|
@ -778,6 +838,10 @@ NSProjectile::EvaluateEntity(void)
|
|||
EVALUATE_VECTOR(m_vecRenderColor, 1, PROJ_CHANGED_RENDERCOLOR)
|
||||
EVALUATE_VECTOR(m_vecRenderColor, 2, PROJ_CHANGED_RENDERCOLOR)
|
||||
EVALUATE_FIELD(m_flRenderAmt, PROJ_CHANGED_RENDERAMT)
|
||||
EVALUATE_VECTOR(m_vecLightColor, 0, PROJ_CHANGED_RENDERCOLOR)
|
||||
EVALUATE_VECTOR(m_vecLightColor, 1, PROJ_CHANGED_RENDERCOLOR)
|
||||
EVALUATE_VECTOR(m_vecLightColor, 2, PROJ_CHANGED_RENDERCOLOR)
|
||||
EVALUATE_FIELD(m_flLightRadius, PROJ_CHANGED_RENDERAMT)
|
||||
}
|
||||
|
||||
/* Make sure StartFrame calls this */
|
||||
|
@ -810,6 +874,10 @@ NSProjectile::SendEntity(entity ePEnt, float flChanged)
|
|||
SENDENTITY_COLOR(m_vecRenderColor[1], PROJ_CHANGED_RENDERCOLOR)
|
||||
SENDENTITY_COLOR(m_vecRenderColor[2], PROJ_CHANGED_RENDERCOLOR)
|
||||
SENDENTITY_COLOR(m_flRenderAmt, PROJ_CHANGED_RENDERAMT)
|
||||
SENDENTITY_COLOR(m_vecLightColor[0], PROJ_CHANGED_RENDERCOLOR)
|
||||
SENDENTITY_COLOR(m_vecLightColor[1], PROJ_CHANGED_RENDERCOLOR)
|
||||
SENDENTITY_COLOR(m_vecLightColor[2], PROJ_CHANGED_RENDERCOLOR)
|
||||
SENDENTITY_FLOAT(m_flLightRadius, PROJ_CHANGED_RENDERAMT)
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
@ -835,7 +903,22 @@ NSProjectile::ReceiveEntity(float flNew, float flChanged)
|
|||
READENTITY_COLOR(m_vecRenderColor[1], PROJ_CHANGED_RENDERCOLOR)
|
||||
READENTITY_COLOR(m_vecRenderColor[2], PROJ_CHANGED_RENDERCOLOR)
|
||||
READENTITY_COLOR(m_flRenderAmt, PROJ_CHANGED_RENDERAMT)
|
||||
READENTITY_COLOR(m_vecLightColor[0], PROJ_CHANGED_RENDERCOLOR)
|
||||
READENTITY_COLOR(m_vecLightColor[1], PROJ_CHANGED_RENDERCOLOR)
|
||||
READENTITY_COLOR(m_vecLightColor[2], PROJ_CHANGED_RENDERCOLOR)
|
||||
READENTITY_FLOAT(m_flLightRadius, PROJ_CHANGED_RENDERAMT)
|
||||
setmodelindex(this, modelindex);
|
||||
drawmask = MASK_ENGINE;
|
||||
}
|
||||
|
||||
float
|
||||
NSProjectile::predraw(void)
|
||||
{
|
||||
if (m_flLightRadius > 0.0f) {
|
||||
dynamiclight_add(origin, m_flLightRadius, m_vecLightColor);
|
||||
}
|
||||
|
||||
return super::predraw();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in a new issue