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 class prop_vehicle_driveable_wheel
{ {
void() prop_vehicle_driveable_wheel; void() prop_vehicle_driveable_wheel;
float m_flSuspension; float m_flSuspension;
float m_flSuspensionForce; float m_flSuspensionForce;
@ -123,6 +124,50 @@ class prop_vehicle_driveable:NSVehicle
#endif #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 #ifdef CLIENT
bool bool
prop_vehicle_driveable::HideViewWeapon(void) prop_vehicle_driveable::HideViewWeapon(void)
@ -853,50 +898,6 @@ prop_vehicle_driveable::Spawned(void)
#endif #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 #ifdef CLIENT
void void
prop_vehicle_driveable_readentity(float isnew) prop_vehicle_driveable_readentity(float isnew)

View File

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

View File

@ -55,14 +55,21 @@ public:
that are part of NSIO. */ that are part of NSIO. */
virtual void SpawnKey(string,string); 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 #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 */ /* helper functions to allocate outputs */
/** Triggers an output field that has been created beforehand */ /** Triggers an output field that has been created beforehand */
nonvirtual void UseOutput(entity,string); nonvirtual void UseOutput(entity,string);
@ -80,16 +87,6 @@ public:
Input/Output specification. */ Input/Output specification. */
nonvirtual string CreateOutput(string); 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 */ /* save game related methods */
/** Saves a floating point key/value pair to a filehandle. */ /** Saves a floating point key/value pair to a filehandle. */
nonvirtual void SaveFloat(float,string,float); nonvirtual void SaveFloat(float,string,float);
@ -117,10 +114,14 @@ public:
nonvirtual bool ReadBool(string); nonvirtual bool ReadBool(string);
/** read an entity id, converted to entity, from a string */ /** read an entity id, converted to entity, from a string */
nonvirtual entity ReadEntity(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 #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; .bool _mapspawned;

View File

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

View File

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

View File

@ -139,6 +139,10 @@ public:
virtual void MakeStatic(void); 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 */ /* set */
/** Sets the bodygroup of the entity. */ /** Sets the bodygroup of the entity. */
nonvirtual void SetBody(int); nonvirtual void SetBody(int);
@ -181,10 +185,6 @@ public:
/** Returns the value of the entity's bone controller #5. */ /** Returns the value of the entity's bone controller #5. */
nonvirtual float GetBoneControl5(void); 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 #ifdef CLIENT
/** Called by predraw(); and will set the appropriate rendering specific fields. */ /** Called by predraw(); and will set the appropriate rendering specific fields. */
nonvirtual void RenderFXPass(void); nonvirtual void RenderFXPass(void);

View File

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

View File

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

View File

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

View File

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

View File

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