CBaseEntity: Mark some methods as nonvirtual, fix some regressions with
func_healthcharger/recharger, trigger_gravity
This commit is contained in:
parent
451beedb0c
commit
5439bfb59b
5 changed files with 68 additions and 54 deletions
|
@ -44,6 +44,7 @@ class func_healthcharger:CBaseTrigger
|
|||
virtual void(void) OnPlayerUse;
|
||||
virtual void(string, string) SpawnKey;
|
||||
virtual void(void) ResetHealth;
|
||||
virtual void(void) Respawn;
|
||||
};
|
||||
|
||||
void
|
||||
|
@ -154,6 +155,17 @@ func_healthcharger::SpawnKey(string strKey, string strValue)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
func_healthcharger::Respawn(void)
|
||||
{
|
||||
SetSolid(SOLID_BSP);
|
||||
SetMovetype(MOVETYPE_PUSH);
|
||||
SetOrigin(GetSpawnOrigin());
|
||||
SetModel(GetSpawnModel());
|
||||
PlayerUse = OnPlayerUse;
|
||||
ResetHealth();
|
||||
}
|
||||
|
||||
void
|
||||
func_healthcharger::func_healthcharger(void)
|
||||
{
|
||||
|
@ -166,11 +178,4 @@ func_healthcharger::func_healthcharger(void)
|
|||
precache_sound(m_strSndFirst);
|
||||
precache_sound(m_strSndCharging);
|
||||
precache_sound(m_strSndDone);
|
||||
|
||||
SetSolid(SOLID_BSP);
|
||||
SetMovetype(MOVETYPE_PUSH);
|
||||
SetOrigin(origin);
|
||||
SetModel(model);
|
||||
PlayerUse = OnPlayerUse;
|
||||
ResetHealth();
|
||||
}
|
||||
|
|
|
@ -44,6 +44,7 @@ class func_recharge:CBaseTrigger
|
|||
virtual void(void) OnPlayerUse;
|
||||
virtual void(string, string) SpawnKey;
|
||||
virtual void(void) ResetHealth;
|
||||
virtual void(void) Respawn;
|
||||
};
|
||||
|
||||
void
|
||||
|
@ -160,6 +161,17 @@ func_recharge::SpawnKey(string strKey, string strValue)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
func_recharge::Respawn(void)
|
||||
{
|
||||
SetSolid(SOLID_BSP);
|
||||
SetMovetype(MOVETYPE_PUSH);
|
||||
SetOrigin(GetSpawnOrigin());
|
||||
SetModel(GetSpawnModel());
|
||||
PlayerUse = OnPlayerUse;
|
||||
ResetHealth();
|
||||
}
|
||||
|
||||
void
|
||||
func_recharge::func_recharge(void)
|
||||
{
|
||||
|
@ -172,11 +184,4 @@ func_recharge::func_recharge(void)
|
|||
precache_sound(m_strSndFirst);
|
||||
precache_sound(m_strSndCharging);
|
||||
precache_sound(m_strSndDone);
|
||||
|
||||
SetSolid(SOLID_BSP);
|
||||
SetMovetype(MOVETYPE_PUSH);
|
||||
SetOrigin(origin);
|
||||
SetModel(model);
|
||||
PlayerUse = OnPlayerUse;
|
||||
ResetHealth();
|
||||
}
|
||||
|
|
|
@ -61,12 +61,12 @@ class CBaseEntity
|
|||
string m_parent;
|
||||
|
||||
/* Reliable APIs */
|
||||
virtual vector(void) GetSpawnOrigin;
|
||||
virtual vector(void) GetSpawnAngles;
|
||||
virtual string(void) GetSpawnModel;
|
||||
virtual float(void) GetSpawnHealth;
|
||||
virtual int(void) HasPropData;
|
||||
virtual __variant(int) GetPropData;
|
||||
nonvirtual vector(void) GetSpawnOrigin;
|
||||
nonvirtual vector(void) GetSpawnAngles;
|
||||
nonvirtual string(void) GetSpawnModel;
|
||||
nonvirtual float(void) GetSpawnHealth;
|
||||
nonvirtual int(void) HasPropData;
|
||||
nonvirtual __variant(int) GetPropData;
|
||||
|
||||
/* Input/Output System */
|
||||
string m_strOnTrigger;
|
||||
|
@ -74,37 +74,37 @@ class CBaseEntity
|
|||
string m_strOnUser2;
|
||||
string m_strOnUser3;
|
||||
string m_strOnUser4;
|
||||
virtual void(entity, string) UseOutput;
|
||||
virtual string(string) CreateOutput;
|
||||
nonvirtual void(entity, string) UseOutput;
|
||||
nonvirtual string(string) CreateOutput;
|
||||
virtual void(entity, string, string) Input;
|
||||
|
||||
void(void) CBaseEntity;
|
||||
virtual void(void) Respawn;
|
||||
virtual void(void) Hide;
|
||||
virtual void(void) ParentUpdate;
|
||||
virtual void(void) EvaluateEntity;
|
||||
virtual float(entity, float) SendEntity;
|
||||
virtual void(void) Pain;
|
||||
virtual void(void) Death;
|
||||
virtual void(void) SpawnInit;
|
||||
nonvirtual void(void) SpawnInit;
|
||||
nonvirtual void(void) ParentUpdate;
|
||||
#endif
|
||||
|
||||
/* we only provide these for networked keys, so we can send updates */
|
||||
virtual void(float) SetSendFlags;
|
||||
virtual void(float) SetEffects;
|
||||
virtual void(float) SetFrame;
|
||||
virtual void(string) SetModel;
|
||||
virtual void(float) SetModelindex;
|
||||
virtual void(float) SetMovetype;
|
||||
virtual void(float) SetSkin;
|
||||
virtual void(float) SetSolid;
|
||||
virtual void(int) SetBody;
|
||||
virtual void(float) SetScale;
|
||||
nonvirtual void(float) SetSendFlags;
|
||||
nonvirtual void(float) SetEffects;
|
||||
nonvirtual void(float) SetFrame;
|
||||
nonvirtual void(string) SetModel;
|
||||
nonvirtual void(float) SetModelindex;
|
||||
nonvirtual void(float) SetMovetype;
|
||||
nonvirtual void(float) SetSkin;
|
||||
nonvirtual void(float) SetSolid;
|
||||
nonvirtual void(int) SetBody;
|
||||
nonvirtual void(float) SetScale;
|
||||
|
||||
/* these are monitored at all times */
|
||||
virtual void(vector) SetAngles;
|
||||
virtual void(vector) SetOrigin;
|
||||
virtual void(vector, vector) SetSize;
|
||||
nonvirtual void(vector) SetAngles;
|
||||
nonvirtual void(vector) SetOrigin;
|
||||
nonvirtual void(vector, vector) SetSize;
|
||||
|
||||
virtual void(string, string) SpawnKey;
|
||||
|
||||
|
@ -115,13 +115,13 @@ class CBaseEntity
|
|||
vector m_vecRenderColor;
|
||||
|
||||
/* set */
|
||||
virtual void(int) SetRenderFX;
|
||||
virtual void(float) SetRenderMode;
|
||||
virtual void(float) SetRenderAmt;
|
||||
virtual void(vector) SetRenderColor;
|
||||
nonvirtual void(int) SetRenderFX;
|
||||
nonvirtual void(float) SetRenderMode;
|
||||
nonvirtual void(float) SetRenderAmt;
|
||||
nonvirtual void(vector) SetRenderColor;
|
||||
|
||||
#ifdef CLIENT
|
||||
virtual void(void) RenderFXPass;
|
||||
nonvirtual void(void) RenderFXPass;
|
||||
#else
|
||||
/* respawn */
|
||||
int m_oldiRenderFX;
|
||||
|
|
|
@ -32,17 +32,15 @@ Other than that gravity will naturally reset when the entity respawns.
|
|||
This entity was introduced in Quake II (1997).
|
||||
*/
|
||||
|
||||
#ifdef CLIENT
|
||||
class trigger_gravity:CBaseEntity
|
||||
#else
|
||||
class trigger_gravity:CBaseTrigger
|
||||
#endif
|
||||
{
|
||||
float m_flGravity;
|
||||
|
||||
void(void) trigger_gravity;
|
||||
|
||||
virtual void(void) touch;
|
||||
virtual void(string, string) SpawnKey;
|
||||
virtual void(void) Respawn;
|
||||
|
||||
#ifdef CLIENT
|
||||
virtual void(void) Initialized;
|
||||
|
@ -55,6 +53,19 @@ trigger_gravity::touch(void)
|
|||
other.gravity = m_flGravity;
|
||||
}
|
||||
|
||||
void
|
||||
trigger_gravity::Respawn(void)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
setmodel(this, model);
|
||||
movetype = MOVETYPE_NONE;
|
||||
solid = SOLID_BSPTRIGGER;
|
||||
#else
|
||||
SetModel(GetSpawnModel());
|
||||
SetSolid(SOLID_BSPTRIGGER);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
trigger_gravity::SpawnKey(string strField, string strKey)
|
||||
{
|
||||
|
@ -73,7 +84,6 @@ trigger_gravity::trigger_gravity(void)
|
|||
#ifdef SERVER
|
||||
CBaseEntity::CBaseEntity();
|
||||
CBaseTrigger::InitBrushTrigger();
|
||||
SetSolid(SOLID_BSPTRIGGER);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -81,8 +91,6 @@ trigger_gravity::trigger_gravity(void)
|
|||
void
|
||||
trigger_gravity::Initialized(void)
|
||||
{
|
||||
setmodel(this, model);
|
||||
movetype = MOVETYPE_NONE;
|
||||
solid = SOLID_BSPTRIGGER;
|
||||
Respawn();
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -200,7 +200,6 @@ PropData_ForModel(string modelname)
|
|||
if (PropData_Parse(index, line, modelname) == TRUE) {
|
||||
fclose(fh);
|
||||
hash_add(g_hashpropdata, modelname, (int)index);
|
||||
print(sprintf("adding propdata %s at %i\n", modelname, index));
|
||||
return index;
|
||||
}
|
||||
}
|
||||
|
@ -331,14 +330,12 @@ PropData_ParseLine(string line)
|
|||
g_propdata[i_p].name = strtolower(key);
|
||||
t_name = g_propdata[i_p].name;
|
||||
hash_add(g_hashpropdata, g_propdata[i_p].name, (int)i_p);
|
||||
print(sprintf("Parsed propdata %s at index %i\n", key, i_p));
|
||||
}
|
||||
} else if (braced == 2 && inmodel == TRUE) {
|
||||
i_b++;
|
||||
g_breakmodel[i_b].name = strtolower(key);
|
||||
t_name = g_breakmodel[i_b].name;
|
||||
hash_add(g_hashbreakmodel, g_breakmodel[i_b].name, (int)i_b);
|
||||
print(sprintf("Parsed breakmodel %s at index %i\n", key, i_b));
|
||||
}
|
||||
}
|
||||
return (0);
|
||||
|
@ -395,7 +392,6 @@ PropData_Init(void)
|
|||
void
|
||||
PropData_SetStage(string type)
|
||||
{
|
||||
print("Setting propdata\n");
|
||||
g_curPropData = type;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue