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(void) OnPlayerUse;
|
||||||
virtual void(string, string) SpawnKey;
|
virtual void(string, string) SpawnKey;
|
||||||
virtual void(void) ResetHealth;
|
virtual void(void) ResetHealth;
|
||||||
|
virtual void(void) Respawn;
|
||||||
};
|
};
|
||||||
|
|
||||||
void
|
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
|
void
|
||||||
func_healthcharger::func_healthcharger(void)
|
func_healthcharger::func_healthcharger(void)
|
||||||
{
|
{
|
||||||
|
@ -166,11 +178,4 @@ func_healthcharger::func_healthcharger(void)
|
||||||
precache_sound(m_strSndFirst);
|
precache_sound(m_strSndFirst);
|
||||||
precache_sound(m_strSndCharging);
|
precache_sound(m_strSndCharging);
|
||||||
precache_sound(m_strSndDone);
|
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(void) OnPlayerUse;
|
||||||
virtual void(string, string) SpawnKey;
|
virtual void(string, string) SpawnKey;
|
||||||
virtual void(void) ResetHealth;
|
virtual void(void) ResetHealth;
|
||||||
|
virtual void(void) Respawn;
|
||||||
};
|
};
|
||||||
|
|
||||||
void
|
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
|
void
|
||||||
func_recharge::func_recharge(void)
|
func_recharge::func_recharge(void)
|
||||||
{
|
{
|
||||||
|
@ -172,11 +184,4 @@ func_recharge::func_recharge(void)
|
||||||
precache_sound(m_strSndFirst);
|
precache_sound(m_strSndFirst);
|
||||||
precache_sound(m_strSndCharging);
|
precache_sound(m_strSndCharging);
|
||||||
precache_sound(m_strSndDone);
|
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;
|
string m_parent;
|
||||||
|
|
||||||
/* Reliable APIs */
|
/* Reliable APIs */
|
||||||
virtual vector(void) GetSpawnOrigin;
|
nonvirtual vector(void) GetSpawnOrigin;
|
||||||
virtual vector(void) GetSpawnAngles;
|
nonvirtual vector(void) GetSpawnAngles;
|
||||||
virtual string(void) GetSpawnModel;
|
nonvirtual string(void) GetSpawnModel;
|
||||||
virtual float(void) GetSpawnHealth;
|
nonvirtual float(void) GetSpawnHealth;
|
||||||
virtual int(void) HasPropData;
|
nonvirtual int(void) HasPropData;
|
||||||
virtual __variant(int) GetPropData;
|
nonvirtual __variant(int) GetPropData;
|
||||||
|
|
||||||
/* Input/Output System */
|
/* Input/Output System */
|
||||||
string m_strOnTrigger;
|
string m_strOnTrigger;
|
||||||
|
@ -74,37 +74,37 @@ class CBaseEntity
|
||||||
string m_strOnUser2;
|
string m_strOnUser2;
|
||||||
string m_strOnUser3;
|
string m_strOnUser3;
|
||||||
string m_strOnUser4;
|
string m_strOnUser4;
|
||||||
virtual void(entity, string) UseOutput;
|
nonvirtual void(entity, string) UseOutput;
|
||||||
virtual string(string) CreateOutput;
|
nonvirtual string(string) CreateOutput;
|
||||||
virtual void(entity, string, string) Input;
|
virtual void(entity, string, string) Input;
|
||||||
|
|
||||||
void(void) CBaseEntity;
|
void(void) CBaseEntity;
|
||||||
virtual void(void) Respawn;
|
virtual void(void) Respawn;
|
||||||
virtual void(void) Hide;
|
virtual void(void) Hide;
|
||||||
virtual void(void) ParentUpdate;
|
|
||||||
virtual void(void) EvaluateEntity;
|
virtual void(void) EvaluateEntity;
|
||||||
virtual float(entity, float) SendEntity;
|
virtual float(entity, float) SendEntity;
|
||||||
virtual void(void) Pain;
|
virtual void(void) Pain;
|
||||||
virtual void(void) Death;
|
virtual void(void) Death;
|
||||||
virtual void(void) SpawnInit;
|
nonvirtual void(void) SpawnInit;
|
||||||
|
nonvirtual void(void) ParentUpdate;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* we only provide these for networked keys, so we can send updates */
|
/* we only provide these for networked keys, so we can send updates */
|
||||||
virtual void(float) SetSendFlags;
|
nonvirtual void(float) SetSendFlags;
|
||||||
virtual void(float) SetEffects;
|
nonvirtual void(float) SetEffects;
|
||||||
virtual void(float) SetFrame;
|
nonvirtual void(float) SetFrame;
|
||||||
virtual void(string) SetModel;
|
nonvirtual void(string) SetModel;
|
||||||
virtual void(float) SetModelindex;
|
nonvirtual void(float) SetModelindex;
|
||||||
virtual void(float) SetMovetype;
|
nonvirtual void(float) SetMovetype;
|
||||||
virtual void(float) SetSkin;
|
nonvirtual void(float) SetSkin;
|
||||||
virtual void(float) SetSolid;
|
nonvirtual void(float) SetSolid;
|
||||||
virtual void(int) SetBody;
|
nonvirtual void(int) SetBody;
|
||||||
virtual void(float) SetScale;
|
nonvirtual void(float) SetScale;
|
||||||
|
|
||||||
/* these are monitored at all times */
|
/* these are monitored at all times */
|
||||||
virtual void(vector) SetAngles;
|
nonvirtual void(vector) SetAngles;
|
||||||
virtual void(vector) SetOrigin;
|
nonvirtual void(vector) SetOrigin;
|
||||||
virtual void(vector, vector) SetSize;
|
nonvirtual void(vector, vector) SetSize;
|
||||||
|
|
||||||
virtual void(string, string) SpawnKey;
|
virtual void(string, string) SpawnKey;
|
||||||
|
|
||||||
|
@ -115,13 +115,13 @@ class CBaseEntity
|
||||||
vector m_vecRenderColor;
|
vector m_vecRenderColor;
|
||||||
|
|
||||||
/* set */
|
/* set */
|
||||||
virtual void(int) SetRenderFX;
|
nonvirtual void(int) SetRenderFX;
|
||||||
virtual void(float) SetRenderMode;
|
nonvirtual void(float) SetRenderMode;
|
||||||
virtual void(float) SetRenderAmt;
|
nonvirtual void(float) SetRenderAmt;
|
||||||
virtual void(vector) SetRenderColor;
|
nonvirtual void(vector) SetRenderColor;
|
||||||
|
|
||||||
#ifdef CLIENT
|
#ifdef CLIENT
|
||||||
virtual void(void) RenderFXPass;
|
nonvirtual void(void) RenderFXPass;
|
||||||
#else
|
#else
|
||||||
/* respawn */
|
/* respawn */
|
||||||
int m_oldiRenderFX;
|
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).
|
This entity was introduced in Quake II (1997).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef CLIENT
|
|
||||||
class trigger_gravity:CBaseEntity
|
|
||||||
#else
|
|
||||||
class trigger_gravity:CBaseTrigger
|
class trigger_gravity:CBaseTrigger
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
float m_flGravity;
|
float m_flGravity;
|
||||||
|
|
||||||
void(void) trigger_gravity;
|
void(void) trigger_gravity;
|
||||||
|
|
||||||
virtual void(void) touch;
|
virtual void(void) touch;
|
||||||
virtual void(string, string) SpawnKey;
|
virtual void(string, string) SpawnKey;
|
||||||
|
virtual void(void) Respawn;
|
||||||
|
|
||||||
#ifdef CLIENT
|
#ifdef CLIENT
|
||||||
virtual void(void) Initialized;
|
virtual void(void) Initialized;
|
||||||
|
@ -55,6 +53,19 @@ trigger_gravity::touch(void)
|
||||||
other.gravity = m_flGravity;
|
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
|
void
|
||||||
trigger_gravity::SpawnKey(string strField, string strKey)
|
trigger_gravity::SpawnKey(string strField, string strKey)
|
||||||
{
|
{
|
||||||
|
@ -73,7 +84,6 @@ trigger_gravity::trigger_gravity(void)
|
||||||
#ifdef SERVER
|
#ifdef SERVER
|
||||||
CBaseEntity::CBaseEntity();
|
CBaseEntity::CBaseEntity();
|
||||||
CBaseTrigger::InitBrushTrigger();
|
CBaseTrigger::InitBrushTrigger();
|
||||||
SetSolid(SOLID_BSPTRIGGER);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,8 +91,6 @@ trigger_gravity::trigger_gravity(void)
|
||||||
void
|
void
|
||||||
trigger_gravity::Initialized(void)
|
trigger_gravity::Initialized(void)
|
||||||
{
|
{
|
||||||
setmodel(this, model);
|
Respawn();
|
||||||
movetype = MOVETYPE_NONE;
|
|
||||||
solid = SOLID_BSPTRIGGER;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -200,7 +200,6 @@ PropData_ForModel(string modelname)
|
||||||
if (PropData_Parse(index, line, modelname) == TRUE) {
|
if (PropData_Parse(index, line, modelname) == TRUE) {
|
||||||
fclose(fh);
|
fclose(fh);
|
||||||
hash_add(g_hashpropdata, modelname, (int)index);
|
hash_add(g_hashpropdata, modelname, (int)index);
|
||||||
print(sprintf("adding propdata %s at %i\n", modelname, index));
|
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -331,14 +330,12 @@ PropData_ParseLine(string line)
|
||||||
g_propdata[i_p].name = strtolower(key);
|
g_propdata[i_p].name = strtolower(key);
|
||||||
t_name = g_propdata[i_p].name;
|
t_name = g_propdata[i_p].name;
|
||||||
hash_add(g_hashpropdata, g_propdata[i_p].name, (int)i_p);
|
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) {
|
} else if (braced == 2 && inmodel == TRUE) {
|
||||||
i_b++;
|
i_b++;
|
||||||
g_breakmodel[i_b].name = strtolower(key);
|
g_breakmodel[i_b].name = strtolower(key);
|
||||||
t_name = g_breakmodel[i_b].name;
|
t_name = g_breakmodel[i_b].name;
|
||||||
hash_add(g_hashbreakmodel, g_breakmodel[i_b].name, (int)i_b);
|
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);
|
return (0);
|
||||||
|
@ -395,7 +392,6 @@ PropData_Init(void)
|
||||||
void
|
void
|
||||||
PropData_SetStage(string type)
|
PropData_SetStage(string type)
|
||||||
{
|
{
|
||||||
print("Setting propdata\n");
|
|
||||||
g_curPropData = type;
|
g_curPropData = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue