Added reset for trigger_hurt and func_pushable (Fixes #64)

This commit is contained in:
s1lentq 2016-10-08 03:57:07 +07:00
parent 084512e267
commit 9a6c46c674
6 changed files with 48 additions and 1 deletions

View File

@ -884,6 +884,10 @@ void CPushable::__MAKE_VHOOK(Spawn)()
pev->origin.z += 1;
UTIL_SetOrigin(pev, pev->origin);
#ifdef REGAMEDLL_FIXES
pev->oldorigin = pev->origin;
#endif
// Multiply by area of the box's cross-section (assume 1000 units^3 standard volume)
pev->skin = int((pev->skin * (pev->maxs.x - pev->mins.x) * (pev->maxs.y - pev->mins.y)) * 0.0005);
m_soundTime = 0;
@ -902,6 +906,30 @@ void CPushable::__MAKE_VHOOK(Precache)()
}
}
#ifdef REGAMEDLL_FIXES
void CPushable::Restart()
{
if (pev->spawnflags & SF_PUSH_BREAKABLE)
CBreakable::Restart();
pev->movetype = MOVETYPE_PUSHSTEP;
pev->solid = SOLID_BBOX;
SET_MODEL(ENT(pev), STRING(pev->model));
if (pev->friction > 399)
pev->friction = 399;
m_soundTime = 0;
m_maxSpeed = 400 - pev->friction;
pev->flags |= FL_FLOAT;
pev->friction = 0;
UTIL_SetOrigin(pev, pev->oldorigin);
}
#endif
void CPushable::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
{
if (FStrEq(pkvd->szKeyName, "size"))

View File

@ -148,11 +148,15 @@ public:
virtual void KeyValue(KeyValueData *pkvd);
virtual int Save(CSave &save);
virtual int Restore(CRestore &restore);
virtual int ObjectCaps() { return (CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION) | FCAP_CONTINUOUS_USE; }
virtual int ObjectCaps() { return (CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION) | FCAP_CONTINUOUS_USE | FCAP_MUST_RESET; }
virtual BOOL TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
virtual void Touch(CBaseEntity *pOther);
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
#ifdef REGAMEDLL_FIXES
virtual void Restart();
#endif
#ifdef HOOK_GAMEDLL
void Spawn_();

View File

@ -720,6 +720,13 @@ void CTriggerHurt::__MAKE_VHOOK(Spawn)()
UTIL_SetOrigin(pev, pev->origin);
}
#ifdef REGAMEDLL_FIXES
void CTriggerHurt::Restart()
{
Spawn();
}
#endif
// trigger hurt that causes radiation will do a radius
// check and set the player's geiger counter level
// according to distance from center of trigger

View File

@ -275,6 +275,11 @@ class CTriggerHurt: public CBaseTrigger
public:
virtual void Spawn();
#ifdef REGAMEDLL_FIXES
virtual void Restart();
virtual int ObjectCaps() { return (CBaseTrigger::ObjectCaps() | FCAP_MUST_RESET); }
#endif
#ifdef HOOK_GAMEDLL
void Spawn_();

View File

@ -101,6 +101,7 @@ class CPushable: public CBreakable {
public:
virtual void Spawn() = 0;
virtual void Precache() = 0;
virtual void Restart() = 0;
virtual void KeyValue(KeyValueData *pkvd) = 0;
virtual int Save(CSave &save) = 0;
virtual int Restore(CRestore &restore) = 0;

View File

@ -150,6 +150,8 @@ public:
class CTriggerHurt: public CBaseTrigger {
public:
virtual void Spawn() = 0;
virtual void Restart() = 0;
virtual int ObjectCaps() = 0;
};
class CTriggerMonsterJump: public CBaseTrigger {