Skip to content

Commit

Permalink
Added reset for trigger_hurt and func_pushable (Fixes #64)
Browse files Browse the repository at this point in the history
  • Loading branch information
s1lentq committed Oct 7, 2016
1 parent 084512e commit 9a6c46c
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 1 deletion.
28 changes: 28 additions & 0 deletions regamedll/dlls/func_break.cpp
Expand Up @@ -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;
Expand All @@ -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"))
Expand Down
6 changes: 5 additions & 1 deletion regamedll/dlls/func_break.h
Expand Up @@ -148,11 +148,15 @@ class CPushable: public CBreakable
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_();
Expand Down
7 changes: 7 additions & 0 deletions regamedll/dlls/triggers.cpp
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions regamedll/dlls/triggers.h
Expand Up @@ -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_();
Expand Down
1 change: 1 addition & 0 deletions regamedll/extra/cssdk/dlls/func_break.h
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions regamedll/extra/cssdk/dlls/triggers.h
Expand Up @@ -150,6 +150,8 @@ class CBaseTrigger: public CBaseToggle {
class CTriggerHurt: public CBaseTrigger {
public:
virtual void Spawn() = 0;
virtual void Restart() = 0;
virtual int ObjectCaps() = 0;
};

class CTriggerMonsterJump: public CBaseTrigger {
Expand Down

0 comments on commit 9a6c46c

Please sign in to comment.