Fix a bunch of nonvirtual/virtual mismatching going on that's been caught by the new compiler.

This commit is contained in:
Marco Cawthorne 2022-11-16 14:04:10 -08:00
parent ecf5988584
commit 2265047bfe
Signed by: eukara
GPG Key ID: CE2032F0A2882A22
12 changed files with 473 additions and 668 deletions

View File

@ -48,6 +48,7 @@ enumflags
class prop_vehicle_driveable_wheel
{
void() prop_vehicle_driveable_wheel;
float m_flSuspension;
float m_flSuspensionForce;
@ -123,6 +124,50 @@ class prop_vehicle_driveable:NSVehicle
#endif
};
void
prop_vehicle_driveable::prop_vehicle_driveable(void)
{
m_eDriver = __NULL__;
m_flBounceFactor = 1.25f;
m_flAcceleration = 600.0f;
m_flSkidSpeed = 256.0f;
m_flTraction = 5.0f;
m_flBreakFactor = 2.0f;
m_flSteerFactor = 1.0f;
m_flStraightenFactor = 1.0f;
m_vecGravityDir = [0,0,-1];
m_iVehicleFlags |= VHF_FROZEN;
hitcontentsmaski = CONTENTBIT_BODY | CONTENTBITS_POINTSOLID | CONTENTBIT_VEHICLECLIP;
if (!m_eCollBox1)
m_eCollBox1 = spawn(NSEntity);
if (!m_eCollBox2)
m_eCollBox2 = spawn(NSEntity);
{
m_eCollBox1.SetSize([-32,-32,0], [32,32,32]);
m_eCollBox2.SetSize([-32,-32,0], [32,32,32]);
}
m_eCollBox1.hitcontentsmaski = hitcontentsmaski;
m_eCollBox2.hitcontentsmaski = hitcontentsmaski;
if (!m_wlFL)
m_wlFL = spawn(prop_vehicle_driveable_wheel);
if (!m_wlFR)
m_wlFR = spawn(prop_vehicle_driveable_wheel);
if (!m_wlBL)
m_wlBL = spawn(prop_vehicle_driveable_wheel);
if (!m_wlBR)
m_wlBR = spawn(prop_vehicle_driveable_wheel);
m_eCollBox1.owner = m_eCollBox2.owner = \
m_wlFL.owner = m_wlFR.owner = \
m_wlBL.owner = m_wlBR.owner = this;
customphysics = Physics;
}
#ifdef CLIENT
bool
prop_vehicle_driveable::HideViewWeapon(void)
@ -853,50 +898,6 @@ prop_vehicle_driveable::Spawned(void)
#endif
}
void
prop_vehicle_driveable::prop_vehicle_driveable(void)
{
m_eDriver = __NULL__;
m_flBounceFactor = 1.25f;
m_flAcceleration = 600.0f;
m_flSkidSpeed = 256.0f;
m_flTraction = 5.0f;
m_flBreakFactor = 2.0f;
m_flSteerFactor = 1.0f;
m_flStraightenFactor = 1.0f;
m_vecGravityDir = [0,0,-1];
m_iVehicleFlags |= VHF_FROZEN;
hitcontentsmaski = CONTENTBIT_BODY | CONTENTBITS_POINTSOLID | CONTENTBIT_VEHICLECLIP;
if (!m_eCollBox1)
m_eCollBox1 = spawn(NSEntity);
if (!m_eCollBox2)
m_eCollBox2 = spawn(NSEntity);
{
m_eCollBox1.SetSize([-32,-32,0], [32,32,32]);
m_eCollBox2.SetSize([-32,-32,0], [32,32,32]);
}
m_eCollBox1.hitcontentsmaski = hitcontentsmaski;
m_eCollBox2.hitcontentsmaski = hitcontentsmaski;
if (!m_wlFL)
m_wlFL = spawn(prop_vehicle_driveable_wheel);
if (!m_wlFR)
m_wlFR = spawn(prop_vehicle_driveable_wheel);
if (!m_wlBL)
m_wlBL = spawn(prop_vehicle_driveable_wheel);
if (!m_wlBR)
m_wlBR = spawn(prop_vehicle_driveable_wheel);
m_eCollBox1.owner = m_eCollBox2.owner = \
m_wlFL.owner = m_wlFR.owner = \
m_wlBL.owner = m_wlBR.owner = this;
customphysics = Physics;
}
#ifdef CLIENT
void
prop_vehicle_driveable_readentity(float isnew)

View File

@ -115,6 +115,9 @@ public:
virtual void Save(float);
virtual void Restore(string,string);
/** Called when we need to re-align the entity to our parent entity. */
virtual void ParentUpdate(void);
/** Called when the entity has been successfully restored from a savegame file. */
virtual void RestoreComplete(void);
@ -136,9 +139,6 @@ public:
/** Call this on an entity to remove the connection to its parent. */
nonvirtual void ClearParent(void);
/** Called when we need to re-align the entity to our parent entity. */
virtual void ParentUpdate(void);
/** Restore the entity's angles to the value they spawned with. */
nonvirtual void RestoreAngles(void);
@ -172,7 +172,7 @@ public:
/** Sets the collision type of the entity. Check the solid_t enum for available types. */
nonvirtual void SetSolid(float);
/** Sets the 3D model representation of the entity from a file path and name. */
nonvirtual void SetModel(string);
virtual void SetModel(string);
/** Sets the 3D model representation of the entity from an already precached resource id. */
nonvirtual void SetModelindex(float);
/** Sets the movement type of the entity. Check the movetype_t enum for available types. */

View File

@ -21,18 +21,14 @@ NSEntity::NSEntity
client doesn't have to do a whole lot here
============
*/
void
NSEntity::NSEntity(void)
{
void NSEntity::NSEntity( void ) {
#ifdef SERVER
identity = 1;
#endif
}
void
NSEntity::Spawned(void)
{
void NSEntity::Spawned( void ) {
super::Spawned();
m_oldAngle = angles;
@ -47,49 +43,39 @@ NSEntity::Spawned(void)
precache_model( GetSpawnModel() );
}
if (m_strOnTrigger)
if ( m_strOnTrigger ) {
m_strOnTrigger = CreateOutput( m_strOnTrigger );
}
#endif
}
float
NSEntity::EntIndex(void)
{
float NSEntity::EntIndex( void ) {
return ( num_for_edict( this ) );
}
void
droptofloorwrapper(entity foo)
{
void droptofloorwrapper( entity foo ) {
entity old_self = self;
self = foo;
droptofloor();
self = old_self;
}
void
NSEntity::DropToFloor(void)
{
void NSEntity::DropToFloor( void ) {
droptofloorwrapper( this );
}
vector
NSEntity::GetForward(void)
{
vector NSEntity::GetForward( void ) {
makevectors( angles );
return ( v_forward );
}
vector
NSEntity::GetRight(void)
{
vector NSEntity::GetRight( void ) {
makevectors( angles );
return ( v_right );
}
vector
NSEntity::GetUp(void)
{
vector NSEntity::GetUp( void ) {
makevectors( angles );
return ( v_up );
}
@ -102,9 +88,7 @@ Returns the center of an entity's bounding boxes.
Useful on brush entities that have no real 'origin' defined.
============
*/
vector
NSEntity::WorldSpaceCenter(void)
{
vector NSEntity::WorldSpaceCenter( void ) {
return ( absmin + ( 0.5 * ( absmax - absmin ) ) );
}
@ -115,9 +99,7 @@ NSEntity::WaterLevel
Returns whether or not the entity is able to see a given position
============
*/
float
NSEntity::WaterLevel(void)
{
float NSEntity::WaterLevel( void ) {
return ( waterlevel );
}
@ -128,9 +110,7 @@ NSEntity::VisibleVec
Returns whether or not the entity is able to see a given position
============
*/
bool
NSEntity::VisibleVec(vector org)
{
bool NSEntity::VisibleVec( vector org ) {
vector flDelta;
float flFoV;
@ -154,9 +134,7 @@ NSEntity::Visible
Returns whether or not the entity is able to see a given entity
============
*/
bool
NSEntity::Visible(entity ent)
{
bool NSEntity::Visible( entity ent ) {
vector flDelta;
float flFoV;
@ -176,33 +154,23 @@ NSEntity::Visible(entity ent)
return ( false );
}
bool
NSEntity::HasSpawnFlags(float sf)
{
bool NSEntity::HasSpawnFlags( float sf ) {
return ( spawnflags & sf ) ? true : false;
}
bool
NSEntity::IsOnGround(void)
{
bool NSEntity::IsOnGround( void ) {
return ( flags & FL_ONGROUND ) ? true : false;
}
bool
NSEntity::IsSolid(void)
{
bool NSEntity::IsSolid( void ) {
return ( solid != SOLID_NOT ) ? true : false;
}
entity
NSEntity::GetGroundEntity(void)
{
entity NSEntity::GetGroundEntity( void ) {
return ( groundentity );
}
bool
NSEntity::CreatedByMap(void)
{
bool NSEntity::CreatedByMap( void ) {
return ( _mapspawned );
}
@ -217,9 +185,7 @@ make sure any child-classes precache their assets in here
for vid_reload calls or other sudden deaths (driver restarts)
============
*/
void
NSEntity::RendererRestarted(void)
{
void NSEntity::RendererRestarted( void ) {
}
@ -228,9 +194,7 @@ NSEntity::RendererRestarted(void)
NSEntity::ReceiveEntity
============
*/
void
NSEntity::ReceiveEntity(float flNew, float flChanged)
{
void NSEntity::ReceiveEntity( float flNew, float flChanged ) {
READENTITY_COORD( origin[0], BASEFL_CHANGED_ORIGIN_X )
READENTITY_COORD( origin[1], BASEFL_CHANGED_ORIGIN_Y )
READENTITY_COORD( origin[2], BASEFL_CHANGED_ORIGIN_Z )
@ -257,7 +221,6 @@ NSEntity::ReceiveEntity(float flNew, float flChanged)
READENTITY_COORD( avelocity[0], BASEFL_CHANGED_ANGULARVELOCITY )
READENTITY_COORD( avelocity[1], BASEFL_CHANGED_ANGULARVELOCITY )
READENTITY_COORD( avelocity[2], BASEFL_CHANGED_ANGULARVELOCITY )
if ( modelindex ) {
drawmask = MASK_ENGINE;
} else {
@ -278,17 +241,13 @@ NSEntity::ReceiveEntity(float flNew, float flChanged)
NSEntity::postdraw
============
*/
void
NSEntity::postdraw(void)
{
void NSEntity::postdraw( void ) {
}
#else
/* Make sure StartFrame calls this */
float
NSEntity::SendEntity(entity ePEnt, float flChanged)
{
float NSEntity::SendEntity( entity ePEnt, float flChanged ) {
if ( !modelindex )
return ( 0 );
@ -328,13 +287,10 @@ NSEntity::SendEntity(entity ePEnt, float flChanged)
SENDENTITY_COORD( avelocity[0], BASEFL_CHANGED_ANGULARVELOCITY )
SENDENTITY_COORD( avelocity[1], BASEFL_CHANGED_ANGULARVELOCITY )
SENDENTITY_COORD( avelocity[2], BASEFL_CHANGED_ANGULARVELOCITY )
return ( 1 );
}
void
NSEntity::EvaluateEntity(void)
{
void NSEntity::EvaluateEntity( void ) {
EVALUATE_VECTOR( origin, 0, BASEFL_CHANGED_ORIGIN_X )
EVALUATE_VECTOR( origin, 1, BASEFL_CHANGED_ORIGIN_Y )
EVALUATE_VECTOR( origin, 2, BASEFL_CHANGED_ORIGIN_Z )
@ -364,9 +320,7 @@ NSEntity::EvaluateEntity(void)
}
/* Make sure StartFrame calls this */
void
NSEntity::ParentUpdate(void)
{
void NSEntity::ParentUpdate( void ) {
EvaluateEntity();
frame1time += frametime;
@ -379,6 +333,7 @@ NSEntity::ParentUpdate(void)
if ( !m_parent_attachment ) {
parent = ( NSEntity ) p;
vector ofs = parent.origin - parent.GetSpawnOrigin();
SetOrigin( GetSpawnOrigin() + ofs );
} else if ( m_parent_attachment == "origin" ) {
SetOrigin( p.origin );
@ -395,53 +350,37 @@ NSEntity::ParentUpdate(void)
}
}
entity
NSEntity::GetParent(void)
{
entity NSEntity::GetParent( void ) {
return ( find( world, ::targetname, m_parent ) );
}
void
NSEntity::SetParent(string name)
{
void NSEntity::SetParent( string name ) {
m_parent = name;
}
void
NSEntity::SetParentAttachment(string name)
{
void NSEntity::SetParentAttachment( string name ) {
m_parent_attachment = name;
}
void
NSEntity::ClearParent(void)
{
void NSEntity::ClearParent( void ) {
m_parent = __NULL__;
m_parent_attachment = __NULL__;
}
void
NSEntity::RestoreAngles(void)
{
void NSEntity::RestoreAngles( void ) {
angles = GetSpawnAngles();
}
void
NSEntity::ClearAngles(void)
{
void NSEntity::ClearAngles( void ) {
angles =[0, 0, 0];
}
#endif
void
NSEntity::SetEffects(float newEffects)
{
void NSEntity::SetEffects( float newEffects ) {
effects = newEffects;
}
void
NSEntity::SetFrame(float newFrame)
{
void NSEntity::SetFrame( float newFrame ) {
if ( newFrame == frame )
return;
@ -449,62 +388,44 @@ NSEntity::SetFrame(float newFrame)
frame1time = 0.0f;
}
void
NSEntity::SetSkin(float newSkin)
{
void NSEntity::SetSkin( float newSkin ) {
skin = newSkin;
}
void
NSEntity::SetOwner(entity newOwner)
{
void NSEntity::SetOwner( entity newOwner ) {
owner = newOwner;
}
void
NSEntity::SetVelocity(vector vecNew)
{
void NSEntity::SetVelocity( vector vecNew ) {
velocity = vecNew;
}
void
NSEntity::SetTouch(void() newTouch)
{
void NSEntity::SetTouch( void ()newTouch ) {
touch = newTouch;
}
/* we want to really use those set functions because they'll notify of any
* networking related changes. otherwise we'll have to keep track of copies
* that get updated every frame */
void
NSEntity::SetSendFlags(float flSendFlags)
{
void NSEntity::SetSendFlags( float flSendFlags ) {
#ifdef SERVER
SendFlags |= flSendFlags;
#endif
}
void
NSEntity::SetMovetype(float newMovetype)
{
void NSEntity::SetMovetype( float newMovetype ) {
movetype = newMovetype;
}
void
NSEntity::SetGravity(float newGrav)
{
void NSEntity::SetGravity( float newGrav ) {
gravity = newGrav;
}
void
NSEntity::SetSolid(float newSolid)
{
void NSEntity::SetSolid( float newSolid ) {
solid = newSolid;
}
void
NSEntity::SetScale(float newScale)
{
void NSEntity::SetScale( float newScale ) {
if ( newScale == scale )
return;
@ -512,9 +433,7 @@ NSEntity::SetScale(float newScale)
setsize( this, m_vecMins * scale, m_vecMaxs * scale );
}
void
NSEntity::UpdateBounds(void)
{
void NSEntity::UpdateBounds( void ) {
vector newMins, newMaxs;
float flScale = 1.0f;
@ -525,6 +444,7 @@ NSEntity::UpdateBounds(void)
if ( angles !=[0, 0, 0] ) {
/* adjust bbox according to rotation */
vector vecCorner[8];
newMins = newMaxs =[0, 0, 0];
for ( int i = 0; i < 8; i++ ) {
vecCorner[i][0] = ( i & 1 ) ? m_vecMins[0] : m_vecMaxs[0];
@ -557,21 +477,15 @@ NSEntity::UpdateBounds(void)
setsize( this, newMins * flScale, newMaxs * flScale );
}
void
NSEntity::SetAngles(vector newAngles)
{
void NSEntity::SetAngles( vector newAngles ) {
angles = newAngles;
}
void
NSEntity::SetAngularVelocity(vector newAvel)
{
void NSEntity::SetAngularVelocity( vector newAvel ) {
avelocity = newAvel;
}
void
NSEntity::SetSize(vector newMins, vector newMaxs)
{
void NSEntity::SetSize( vector newMins, vector newMaxs ) {
float flScale = 1.0f;
m_vecMins = newMins;
@ -584,24 +498,18 @@ NSEntity::SetSize(vector newMins, vector newMaxs)
setsize( this, newMins * flScale, newMaxs * flScale );
}
void
NSEntity::SetOrigin(vector newOrigin)
{
void NSEntity::SetOrigin( vector newOrigin ) {
setorigin( this, newOrigin );
}
void
NSEntity::SetModel(string newModel)
{
void NSEntity::SetModel( string newModel ) {
model = newModel;
setmodel( this, newModel );
/* mins/maxs have been updated by setmodel */
SetSize( mins, maxs );
}
void
NSEntity::SetModelindex(float newModelIndex)
{
void NSEntity::SetModelindex( float newModelIndex ) {
if ( newModelIndex == modelindex )
return;
@ -609,40 +517,28 @@ NSEntity::SetModelindex(float newModelIndex)
SetSize( mins, maxs );
}
void
NSEntity::AddEffects(float fl)
{
void NSEntity::AddEffects( float fl ) {
effects |= fl;
}
void
NSEntity::RemoveEffects(float fl)
{
void NSEntity::RemoveEffects( float fl ) {
effects &= ~fl;
}
void
NSEntity::AddFlags(float fl)
{
void NSEntity::AddFlags( float fl ) {
flags |= fl;
}
void
NSEntity::RemoveFlags(float fl)
{
void NSEntity::RemoveFlags( float fl ) {
flags &= ~fl;
}
void
NSEntity::SetThink(void(void) func)
{
void NSEntity::SetThink( void ( void ) func ) {
think = func;
}
void
NSEntity::SetNextThink(float fl)
{
void NSEntity::SetNextThink( float fl ) {
float flTime = GetTime();
/* HACK: to make sure things happen post-spawn */
@ -655,186 +551,126 @@ NSEntity::SetNextThink(float fl)
NSLog( "%s sets bogus nextthink value %f\n", classname, fl );
}
void
NSEntity::ScheduleThink(void(void) func, float fl)
{
void NSEntity::ScheduleThink( void ( void ) func, float fl ) {
SetThink( func );
SetNextThink( fl );
}
vector
NSEntity::GetSpawnOrigin(void)
{
vector NSEntity::GetSpawnOrigin( void ) {
return ( m_oldOrigin );
}
vector
NSEntity::GetSpawnAngles(void)
{
vector NSEntity::GetSpawnAngles( void ) {
return ( m_oldAngle );
}
string
NSEntity::GetSpawnModel(void)
{
string NSEntity::GetSpawnModel( void ) {
return ( m_oldModel );
}
float
NSEntity::GetEffects(void)
{
float NSEntity::GetEffects( void ) {
return ( effects );
}
float
NSEntity::GetFrame(void)
{
float NSEntity::GetFrame( void ) {
return ( frame );
}
float
NSEntity::GetSkin(void)
{
float NSEntity::GetSkin( void ) {
return ( skin );
}
float
NSEntity::GetScale(void)
{
float NSEntity::GetScale( void ) {
return ( scale );
}
entity
NSEntity::GetOwner(void)
{
entity NSEntity::GetOwner( void ) {
return ( owner );
}
vector
NSEntity::GetVelocity(void)
{
vector NSEntity::GetVelocity( void ) {
return ( velocity );
}
float
NSEntity::GetSolid(void)
{
float NSEntity::GetSolid( void ) {
return ( solid );
}
string
NSEntity::GetModel(void)
{
string NSEntity::GetModel( void ) {
return ( model );
}
float
NSEntity::GetModelindex(void)
{
float NSEntity::GetModelindex( void ) {
return ( modelindex );
}
float
NSEntity::GetMovetype(void)
{
float NSEntity::GetMovetype( void ) {
return ( movetype );
}
float
NSEntity::GetGravity(void)
{
float NSEntity::GetGravity( void ) {
return ( gravity );
}
vector
NSEntity::GetAngles(void)
{
vector NSEntity::GetAngles( void ) {
return ( angles );
}
vector
NSEntity::GetAngularVelocity(void)
{
vector NSEntity::GetAngularVelocity( void ) {
return ( avelocity );
}
vector
NSEntity::GetOrigin(void)
{
vector NSEntity::GetOrigin( void ) {
return ( origin );
}
vector
NSEntity::GetMins(void)
{
vector NSEntity::GetMins( void ) {
return ( mins );
}
vector
NSEntity::GetMaxs(void)
{
vector NSEntity::GetMaxs( void ) {
return ( maxs );
}
vector
NSEntity::GetRealMins(void)
{
vector NSEntity::GetRealMins( void ) {
return ( m_vecMins );
}
vector
NSEntity::GetRealMaxs(void)
{
vector NSEntity::GetRealMaxs( void ) {
return ( m_vecMaxs );
}
vector
NSEntity::GetAbsoluteMins(void)
{
vector NSEntity::GetAbsoluteMins( void ) {
return ( absmin );
}
vector
NSEntity::GetAbsoluteMaxs(void)
{
vector NSEntity::GetAbsoluteMaxs( void ) {
return ( absmax );
}
float
NSEntity::GetFlags(void)
{
float NSEntity::GetFlags( void ) {
return ( flags );
}
float
NSEntity::GetNextThinkTime(void)
{
float NSEntity::GetNextThinkTime( void ) {
return ( nextthink );
}
bool
NSEntity::IsThinking(void)
{
bool NSEntity::IsThinking( void ) {
return ( nextthink > GetTime() )? true : false;
}
void
NSEntity::ReleaseThink(void)
{
void NSEntity::ReleaseThink( void ) {
think = __NULL__;
nextthink = 0.0f;
}
void
NSEntity::ClearVelocity(void)
{
void NSEntity::ClearVelocity( void ) {
velocity = avelocity =[0.0f, 0.0f, 0.0f];
}
#ifdef SERVER
void
NSEntity::Respawn(void)
{
void NSEntity::Respawn( void ) {
NSTrigger::Respawn();
SetSolid( m_oldSolid );
@ -844,9 +680,7 @@ NSEntity::Respawn(void)
SetTriggerTarget( m_oldstrTarget ); /* FIXME: Move into NSTrigger::Respawn */
}
void
NSEntity::Save(float handle)
{
void NSEntity::Save( float handle ) {
super::Save( handle );
SaveFloat( handle, "pvsflags", pvsflags );
SaveFloat( handle, "_mapspawned", _mapspawned );
@ -864,9 +698,7 @@ NSEntity::Save(float handle)
SaveString( handle, "m_parent_attachment", m_parent_attachment );
}
void
NSEntity::Restore(string strKey, string strValue)
{
void NSEntity::Restore( string strKey, string strValue ) {
switch ( strKey ) {
case "pvsflags":
pvsflags = stof( strValue );
@ -916,15 +748,11 @@ NSEntity::Restore(string strKey, string strValue)
}
}
void
NSEntity::RestoreComplete(void)
{
void NSEntity::RestoreComplete( void ) {
/* this is where we can handle anything post-loading */
}
void
NSEntity::Input(entity eAct, string strInput, string strData)
{
void NSEntity::Input( entity eAct, string strInput, string strData ) {
switch ( strInput ) {
case "Kill":
Destroy();
@ -933,6 +761,7 @@ NSEntity::Input(entity eAct, string strInput, string strData)
/* this works because ents are basically just entnums */
for ( entity e = world; ( e = findfloat( e, ::owner, this ) ); ) {
NSEntity ent = ( NSEntity ) e;
ent.Destroy();
}
Destroy();
@ -967,9 +796,7 @@ pairs on its own, but we can at least undo some of that in
here if needed
============
*/
void
NSEntity::SpawnKey(string strKey, string strValue)
{
void NSEntity::SpawnKey( string strKey, string strValue ) {
/* we do re-read a lot of the builtin fields in case we want to set
defaults. just in case anybody is wondering. */
switch ( strKey ) {
@ -1016,9 +843,7 @@ OnRemoveEntity
Empty method, meant for sub-classes to clean up their contents
============
*/
void
NSEntity::OnRemoveEntity(void)
{
void NSEntity::OnRemoveEntity( void ) {
}
/*
@ -1030,47 +855,33 @@ If you want an entity to be purged immediately, you'll have to jump
through your own hoops. This however will be sufficient 99,99% of the time.
============
*/
void
NSEntity::Destroy(void)
{
void NSEntity::Destroy( void ) {
OnRemoveEntity();
ScheduleThink( Util_Destroy, 0.0f );
}
void
NSEntity::Show(void)
{
void NSEntity::Show( void ) {
effects &= ~EF_NODRAW;
}
void
NSEntity::Hide(void)
{
void NSEntity::Hide( void ) {
effects |= EF_NODRAW;
}
bool
NSEntity::IsHidden(void)
{
bool NSEntity::IsHidden( void ) {
return ( effects & EF_NODRAW ) ? true : false;
}
void
NSEntity::Disappear(void)
{
void NSEntity::Disappear( void ) {
modelindex = 0;
solid = SOLID_NOT;
}
void
NSEntity::MakeStatic(void)
{
void NSEntity::MakeStatic( void ) {
makestatic( this );
}
bool
NSEntity::WithinBounds(entity check)
{
bool NSEntity::WithinBounds( entity check ) {
if not ( check.absmin[0] >= absmin[0] && check.absmax[0] <= absmax[0] )
return ( false );
if not ( check.absmin[1] >= absmin[1] && check.absmax[1] <= absmax[1] )
@ -1081,15 +892,13 @@ NSEntity::WithinBounds(entity check)
return ( true );
}
bool
NSEntity::StartSound(string strSample, float channel, float flags, bool broadcast)
{
bool NSEntity::StartSound( string strSample, float channel, float flags, bool broadcast ) {
if not ( whichpack( strcat( "sound/", strSample ) ) )
return ( false );
if (broadcast)
if ( broadcast ) {
sound( this, channel, strSample, 1.0, ATTN_NORM );
else {
} else {
#ifdef SERVER
msg_entity = this;
sound( this, channel, strSample, 1.0, ATTN_NORM, 0, SOUNDFLAG_UNICAST );
@ -1101,23 +910,17 @@ NSEntity::StartSound(string strSample, float channel, float flags, bool broadcas
return ( true );
}
bool
NSEntity::StartSoundDef(string strSample, float channel, bool broadcast)
{
bool NSEntity::StartSoundDef( string strSample, float channel, bool broadcast ) {
NSLog( "StartSoundDef: %s %d %d", strSample, channel, broadcast );
Sound_Play( this, channel, strSample );
return ( true );
}
void
NSEntity::StopSound(float channel, bool broadcast)
{
void NSEntity::StopSound( float channel, bool broadcast ) {
sound( this, channel, "common/null.wav", 0.1f, ATTN_NORM );
}
void
NSEntity::HandleThink(void)
{
void NSEntity::HandleThink( void ) {
/* support for think/nextthink */
if ( think && nextthink > 0.0f ) {
if ( nextthink < time ) {

View File

@ -55,14 +55,21 @@ public:
that are part of NSIO. */
virtual void SpawnKey(string,string);
/** Get the level time the entity finds itself in.
Always use this instead of the `time` global. The `time` global may not
be valid on every type of entity. Specifically, MOVETYPE_PUSH entities only
update upon movement (so that any think timers the entity may have are not triggered
when it is at rest. */
nonvirtual float GetTime(void);
#ifdef SERVER
/** Handles saving a copy of this entity to a given filehandle.
Within you want to use the ::SaveFloat() etc. methods to write
the internal member attributes to the specified file handle. */
virtual void Save(float);
/** Similar to `::SpawnKey` but for save-game fields.
Whatever you write into file handles within your `::Save()` method
needs to be read back in here. */
virtual void Restore(string,string);
/** Called when we are being prompted by another object/function with an input message. */
virtual void Input(entity,string,string);
/* helper functions to allocate outputs */
/** Triggers an output field that has been created beforehand */
nonvirtual void UseOutput(entity,string);
@ -80,16 +87,6 @@ public:
Input/Output specification. */
nonvirtual string CreateOutput(string);
/** Handles saving a copy of this entity to a given filehandle.
Within you want to use the ::SaveFloat() etc. methods to write
the internal member attributes to the specified file handle. */
virtual void Save(float);
/** Similar to `::SpawnKey` but for save-game fields.
Whatever you write into file handles within your `::Save()` method
needs to be read back in here. */
virtual void Restore(string,string);
/* save game related methods */
/** Saves a floating point key/value pair to a filehandle. */
nonvirtual void SaveFloat(float,string,float);
@ -117,10 +114,14 @@ public:
nonvirtual bool ReadBool(string);
/** read an entity id, converted to entity, from a string */
nonvirtual entity ReadEntity(string);
/** Called when we are being prompted by another object/function with an input message. */
virtual void Input(entity,string,string);
#endif
/** Get the level time the entity finds itself in.
Always use this instead of the `time` global. The `time` global may not
be valid on every type of entity. Specifically, MOVETYPE_PUSH entities only
update upon movement (so that any think timers the entity may have are not triggered
when it is at rest. */
nonvirtual float GetTime(void);
};
.bool _mapspawned;

View File

@ -272,7 +272,7 @@ public:
virtual void EvaluateEntity(void);
virtual float SendEntity(entity,float);
virtual void Touch(entity);
virtual void Hide(void);
//virtual void Hide(void);
virtual void Respawn(void);
virtual void Pain(void);
virtual void Death(void);

View File

@ -815,6 +815,7 @@ NSMonster::Death(void)
TriggerTargets();
}
#if 0
void
NSMonster::Hide(void)
{
@ -823,6 +824,7 @@ NSMonster::Hide(void)
SetMovetype(MOVETYPE_NONE);
customphysics = __NULL__;
}
#endif
void
NSMonster::Respawn(void)

View File

@ -139,6 +139,10 @@ public:
virtual void MakeStatic(void);
/* model events */
/** Callback for any model event that gets triggered while playing a framegroup. */
virtual void HandleAnimEvent(float, int,string);
/* set */
/** Sets the bodygroup of the entity. */
nonvirtual void SetBody(int);
@ -181,10 +185,6 @@ public:
/** Returns the value of the entity's bone controller #5. */
nonvirtual float GetBoneControl5(void);
/* model events */
/** Callback for any model event that gets triggered while playing a framegroup. */
virtual void HandleAnimEvent(float, int,string);
#ifdef CLIENT
/** Called by predraw(); and will set the appropriate rendering specific fields. */
nonvirtual void RenderFXPass(void);

View File

@ -109,7 +109,7 @@ public:
virtual void PanicFrame(void);
virtual void OnPlayerUse(void);
virtual void Hide(void);
//virtual void Hide(void);
virtual void Respawn(void);
virtual void SpawnKey(string,string);
virtual float SendEntity(entity,float);

View File

@ -644,12 +644,14 @@ NSTalkMonster::SpawnKey(string strKey, string strValue)
}
}
#if 0
void
NSTalkMonster::Hide(void)
{
m_eFollowing = world;
NSMonster::Hide();
}
#endif
float
NSTalkMonster::SendEntity(entity ePEnt, float flChanged)

View File

@ -77,7 +77,15 @@ public:
/** Called when we stopped touching the last touched entity. */
virtual void EndTouch(entity);
/* override */
virtual void SpawnKey(string,string);
#ifdef SERVER
/* overrides */
virtual void Save(float);
virtual void Restore(string,string);
virtual void Input(entity,string,string);
/** Called whenever we're legacy triggered by another object or function. */
virtual void Trigger(entity,int);
@ -89,7 +97,8 @@ public:
/* master feature */
/** Returns what we will pass onto other's `::GetMaster()` calls if we're their master. */
nonvirtual int GetValue(void);
/* multisource overrides this, so keep virtual */
virtual int GetValue(void);
/** Returns whether our master allows us to be triggered. */
nonvirtual int GetMaster(void);
@ -112,13 +121,7 @@ public:
/** Retrives the team value of a given entity. */
nonvirtual float GetTeam(void);
/* overrides */
virtual void Save(float);
virtual void Restore(string,string);
virtual void Input(entity,string,string);
#endif
virtual void SpawnKey(string,string);
};
enum

View File

@ -41,8 +41,7 @@ public:
virtual string GetObituaryMessage(void);
/** Returns the weapon type. Check weapontype_t for details. */
virtual int GetType(void);
/** Returns the owner/wielder of the weapon. */
virtual entity GetOwner(void);
/** Returns primary attack clip */
virtual int GetClip1(void);
/** Returns secondary attack clip */

View File

@ -117,12 +117,6 @@ NSWeapon::GetType(void)
return 0;
}
entity
NSWeapon::GetOwner(void)
{
return m_owner;
}
int
NSWeapon::GetClip1(void)
{