NSSurfacePropEntity: add SetCanBleed() and CanBleed() methods to abstract the old iBleeds field.
This commit is contained in:
parent
f00d49e6ca
commit
3a755aaba7
|
@ -14,6 +14,17 @@
|
||||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
string
|
||||||
|
Event_DataToMuzzleflash(string dataString)
|
||||||
|
{
|
||||||
|
float id = stof(substring(dataString, 0, 1)) - 1;
|
||||||
|
|
||||||
|
if (id)
|
||||||
|
return strcat("sprites/muzzleflash", ftos(id), ".spr");
|
||||||
|
else
|
||||||
|
return "sprites/muzzleflash.spr";
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
====================
|
====================
|
||||||
Event_ProcessModel
|
Event_ProcessModel
|
||||||
|
@ -48,23 +59,27 @@ Event_ProcessModel(float flTimeStamp, int iCode, string strData)
|
||||||
break;
|
break;
|
||||||
case 5001: /* muzzle flash on attachment 0 */
|
case 5001: /* muzzle flash on attachment 0 */
|
||||||
pSeat->m_eMuzzleflash.alpha = 1.0f;
|
pSeat->m_eMuzzleflash.alpha = 1.0f;
|
||||||
pSeat->m_eMuzzleflash.scale = 0.5;
|
pSeat->m_eMuzzleflash.scale = 0.35;
|
||||||
pSeat->m_eMuzzleflash.skin = pSeat->m_iVMBones;
|
pSeat->m_eMuzzleflash.skin = pSeat->m_iVMBones;
|
||||||
|
setmodel(pSeat->m_eMuzzleflash, Event_DataToMuzzleflash(strData));
|
||||||
break;
|
break;
|
||||||
case 5011: /* muzzle flash on attachment 1 */
|
case 5011: /* muzzle flash on attachment 1 */
|
||||||
pSeat->m_eMuzzleflash.alpha = 1.0f;
|
pSeat->m_eMuzzleflash.alpha = 1.0f;
|
||||||
pSeat->m_eMuzzleflash.scale = 0.5;
|
pSeat->m_eMuzzleflash.scale = 0.35;
|
||||||
pSeat->m_eMuzzleflash.skin = pSeat->m_iVMBones + 1;
|
pSeat->m_eMuzzleflash.skin = pSeat->m_iVMBones + 1;
|
||||||
|
setmodel(pSeat->m_eMuzzleflash, Event_DataToMuzzleflash(strData));
|
||||||
break;
|
break;
|
||||||
case 5021: /* muzzle flash on attachment 2 */
|
case 5021: /* muzzle flash on attachment 2 */
|
||||||
pSeat->m_eMuzzleflash.alpha = 1.0f;
|
pSeat->m_eMuzzleflash.alpha = 1.0f;
|
||||||
pSeat->m_eMuzzleflash.scale = 0.5;
|
pSeat->m_eMuzzleflash.scale = 0.35;
|
||||||
pSeat->m_eMuzzleflash.skin = pSeat->m_iVMBones + 2;
|
pSeat->m_eMuzzleflash.skin = pSeat->m_iVMBones + 2;
|
||||||
|
setmodel(pSeat->m_eMuzzleflash, Event_DataToMuzzleflash(strData));
|
||||||
break;
|
break;
|
||||||
case 5031: /* muzzle flash on attachment 3 */
|
case 5031: /* muzzle flash on attachment 3 */
|
||||||
pSeat->m_eMuzzleflash.alpha = 1.0f;
|
pSeat->m_eMuzzleflash.alpha = 1.0f;
|
||||||
pSeat->m_eMuzzleflash.scale = 0.5;
|
pSeat->m_eMuzzleflash.scale = 0.35;
|
||||||
pSeat->m_eMuzzleflash.skin = pSeat->m_iVMBones + 3;
|
pSeat->m_eMuzzleflash.skin = pSeat->m_iVMBones + 3;
|
||||||
|
setmodel(pSeat->m_eMuzzleflash, Event_DataToMuzzleflash(strData));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
print(sprintf("Unknown model event: %f %i %S\n", flTimeStamp, iCode, strData));
|
print(sprintf("Unknown model event: %f %i %S\n", flTimeStamp, iCode, strData));
|
||||||
|
|
|
@ -138,9 +138,9 @@ muzzleflash, dynamic lights and so on appear
|
||||||
void
|
void
|
||||||
View_DrawViewModel(void)
|
View_DrawViewModel(void)
|
||||||
{
|
{
|
||||||
NSRenderableEntity m_eViewModel = pSeat->m_eViewModel;
|
NSRenderableEntity m_eViewModel = (NSRenderableEntity)pSeat->m_eViewModel;
|
||||||
entity m_eMuzzleflash = pSeat->m_eMuzzleflash;
|
entity m_eMuzzleflash = pSeat->m_eMuzzleflash;
|
||||||
NSRenderableEntity m_eViewModelL = pSeat->m_eViewModelL;
|
NSRenderableEntity m_eViewModelL = (NSRenderableEntity)pSeat->m_eViewModelL;
|
||||||
entity m_eMuzzleflashL = pSeat->m_eMuzzleflashL;
|
entity m_eMuzzleflashL = pSeat->m_eMuzzleflashL;
|
||||||
|
|
||||||
player pl = __NULL__;
|
player pl = __NULL__;
|
||||||
|
|
|
@ -66,6 +66,6 @@ monster_generic::Respawn(void)
|
||||||
if (HasSpawnFlags(MGF_NONSOLID)) {
|
if (HasSpawnFlags(MGF_NONSOLID)) {
|
||||||
takedamage = DAMAGE_NO;
|
takedamage = DAMAGE_NO;
|
||||||
SetSolid(SOLID_NOT);
|
SetSolid(SOLID_NOT);
|
||||||
iBleeds = FALSE;
|
SetCanBleed(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ NSTraceAttack:NSIO
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
/* multi-part damage */
|
/* multi-part damage */
|
||||||
entity m_eMultiTarget;
|
NSSurfacePropEntity m_eMultiTarget;
|
||||||
int m_iMultiValue;
|
int m_iMultiValue;
|
||||||
int m_iMultiBody;
|
int m_iMultiBody;
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ NSTraceAttack::Restore(string strKey, string strValue)
|
||||||
{
|
{
|
||||||
switch (strKey) {
|
switch (strKey) {
|
||||||
case "m_eMultiTarget":
|
case "m_eMultiTarget":
|
||||||
m_eMultiTarget = ReadEntity(strValue);
|
m_eMultiTarget = (NSSurfacePropEntity)ReadEntity(strValue);
|
||||||
break;
|
break;
|
||||||
case "m_iMultiValue":
|
case "m_iMultiValue":
|
||||||
m_iMultiValue = ReadInt(strValue);
|
m_iMultiValue = ReadInt(strValue);
|
||||||
|
@ -123,7 +123,7 @@ NSTraceAttack::_ApplyDamage(void)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* the location _could_ be more accurate... */
|
/* the location _could_ be more accurate... */
|
||||||
if (m_eMultiTarget.iBleeds == 1) {
|
if (m_eMultiTarget.CanBleed() == true) {
|
||||||
FX_Blood(trace_endpos, [0.5,0,0]);
|
FX_Blood(trace_endpos, [0.5,0,0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -235,7 +235,7 @@ NSTraceAttack::_FireSingle(vector vecPos, vector vecAngles, float flDamage, floa
|
||||||
if (trace_ent.takedamage == DAMAGE_YES) {
|
if (trace_ent.takedamage == DAMAGE_YES) {
|
||||||
if (trace_ent != m_eMultiTarget) {
|
if (trace_ent != m_eMultiTarget) {
|
||||||
_ApplyDamage();
|
_ApplyDamage();
|
||||||
m_eMultiTarget = trace_ent;
|
m_eMultiTarget = (NSSurfacePropEntity)trace_ent;
|
||||||
m_iMultiValue = flDamage;
|
m_iMultiValue = flDamage;
|
||||||
} else {
|
} else {
|
||||||
m_iMultiValue += flDamage;
|
m_iMultiValue += flDamage;
|
||||||
|
|
|
@ -832,7 +832,7 @@ NSClientPlayer::Death(void)
|
||||||
SetVelocity([0,0,0]);
|
SetVelocity([0,0,0]);
|
||||||
SetGravity(1.0f);
|
SetGravity(1.0f);
|
||||||
customphysics = Empty;
|
customphysics = Empty;
|
||||||
iBleeds = FALSE;
|
SetCanBleed(false);
|
||||||
setsize(this, [0,0,0], [0,0,0]);
|
setsize(this, [0,0,0], [0,0,0]);
|
||||||
forceinfokey(this, "*deaths", ftos(deaths));
|
forceinfokey(this, "*deaths", ftos(deaths));
|
||||||
forceinfokey(this, "*dead", "1");
|
forceinfokey(this, "*dead", "1");
|
||||||
|
@ -867,7 +867,7 @@ NSClientPlayer::MakePlayer(void)
|
||||||
SetGravity(1.0f);
|
SetGravity(1.0f);
|
||||||
SendFlags = UPDATE_ALL;
|
SendFlags = UPDATE_ALL;
|
||||||
customphysics = Empty;
|
customphysics = Empty;
|
||||||
iBleeds = TRUE;
|
SetCanBleed(true);
|
||||||
scale = 1.0f;
|
scale = 1.0f;
|
||||||
SetSize(VEC_HULL_MIN, VEC_HULL_MAX);
|
SetSize(VEC_HULL_MIN, VEC_HULL_MAX);
|
||||||
forceinfokey(this, "*spectator", "0");
|
forceinfokey(this, "*spectator", "0");
|
||||||
|
|
|
@ -886,7 +886,7 @@ NSMonster::Respawn(void)
|
||||||
SetHealth(base_health);
|
SetHealth(base_health);
|
||||||
m_eEnemy = __NULL__;
|
m_eEnemy = __NULL__;
|
||||||
m_iFlags = 0x0;
|
m_iFlags = 0x0;
|
||||||
iBleeds = TRUE;
|
SetCanBleed(true);
|
||||||
customphysics = Physics;
|
customphysics = Physics;
|
||||||
|
|
||||||
SetAngles(v_angle);
|
SetAngles(v_angle);
|
||||||
|
|
|
@ -109,6 +109,11 @@ public:
|
||||||
/** Returns whether or not the entity is alive. */
|
/** Returns whether or not the entity is alive. */
|
||||||
virtual bool IsAlive(void);
|
virtual bool IsAlive(void);
|
||||||
|
|
||||||
|
/** Sets whether the entity can bleed. */
|
||||||
|
nonvirtual void SetCanBleed(bool);
|
||||||
|
/** Returns whether the entity can bleed. */
|
||||||
|
nonvirtual bool CanBleed(void);
|
||||||
|
|
||||||
/* Generic Damage */
|
/* Generic Damage */
|
||||||
/** Sets whether the entity can take damage */
|
/** Sets whether the entity can take damage */
|
||||||
nonvirtual void SetTakedamage(float);
|
nonvirtual void SetTakedamage(float);
|
||||||
|
|
|
@ -64,6 +64,18 @@ NSSurfacePropEntity::IsAlive(void)
|
||||||
return (health > 0) ? true : false;
|
return (health > 0) ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
NSSurfacePropEntity::SetCanBleed(bool bleedValue)
|
||||||
|
{
|
||||||
|
iBleeds = bleedValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
NSSurfacePropEntity::CanBleed(void)
|
||||||
|
{
|
||||||
|
return iBleeds;
|
||||||
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue