trigger_push, func_rotating: reset on new round
This commit is contained in:
s1lent 2017-06-11 17:53:53 +07:00
parent 2026a64ccc
commit 969a4ab85b
No known key found for this signature in database
GPG Key ID: 0FE401DC73916B5C
7 changed files with 67 additions and 32 deletions

View File

@ -252,6 +252,10 @@ void CFuncRotating::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
// REVERSE will cause the it to rotate in the opposite direction.
void CFuncRotating::__MAKE_VHOOK(Spawn)()
{
#ifdef REGAMEDLL_FIXES
m_angles = pev->angles;
#endif
// set final pitch. Must not be PITCH_NORM, since we
// plan on pitch shifting later.
m_pitch = PITCH_NORM - 1;
@ -550,6 +554,19 @@ void CFuncRotating::Rotate()
pev->nextthink = pev->ltime + 10;
}
#ifdef REGAMEDLL_FIXES
void CFuncRotating::Restart()
{
// fan is spinning, so stop it.
SetThink(&CFuncRotating::SpinDown);
pev->nextthink = pev->ltime + 0.1;
// restore angles
pev->angles = m_angles;
pev->avelocity = g_vecZero;
}
#endif
// Rotating Use - when a rotating brush is triggered
void CFuncRotating::RotatingUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)
{

View File

@ -162,9 +162,13 @@ 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; }
virtual int ObjectCaps() { return (CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION) | FCAP_MUST_RESET; }
virtual void Blocked(CBaseEntity *pOther);
#ifdef REGAMEDLL_FIXES
virtual void Restart();
#endif
#ifdef HOOK_GAMEDLL
void Spawn_();
@ -192,6 +196,11 @@ public:
float m_flVolume;
float m_pitch;
int m_sounds;
#ifdef REGAMEDLL_FIXES
Vector m_angles;
#endif
};
class CPendulum: public CBaseEntity

View File

@ -1591,6 +1591,29 @@ void CTriggerPush::__MAKE_VHOOK(Spawn)()
UTIL_SetOrigin(pev, pev->origin);
}
#ifdef REGAMEDLL_FIXES
void CTriggerPush::Restart()
{
InitTrigger();
if (pev->speed == 0)
{
pev->speed = 100;
}
// if flagged to Start Turned Off, make trigger nonsolid.
if (pev->spawnflags & SF_TRIGGER_PUSH_START_OFF)
{
pev->solid = SOLID_NOT;
}
SetUse(&CTriggerPush::ToggleUse);
// Link into the list
UTIL_SetOrigin(pev, pev->origin);
}
#endif
void CTriggerPush::__MAKE_VHOOK(Touch)(CBaseEntity *pOther)
{
entvars_t *pevToucher = pOther->pev;
@ -1727,8 +1750,8 @@ void CBuyZone::BuyTouch(CBaseEntity *pOther)
#ifdef REGAMEDLL_ADD
if (buytime.value == 0.0f)
return;
#endif
#endif
if (!pOther->IsPlayer())
return;

View File

@ -518,6 +518,11 @@ public:
virtual void KeyValue(KeyValueData *pkvd);
virtual void Touch(CBaseEntity *pOther);
#ifdef REGAMEDLL_FIXES
virtual void Restart();
virtual int ObjectCaps() { return (CBaseEntity::ObjectCaps() | FCAP_MUST_RESET); }
#endif
#ifdef HOOK_GAMEDLL
void Spawn_();
@ -526,6 +531,10 @@ public:
#endif
#ifdef REGAMEDLL_FIXES
private:
Vector m_vecAngles;
#endif
};
class CTriggerTeleport: public CBaseTrigger

View File

@ -1189,44 +1189,16 @@
@PointClass base(Targetname) = env_fog : "Global Fog Properties"
[
fadein(integer) : "Fade in time" : 0
holdtime(string) : "Hold time (0 = permanent)" : "0"
fadeout(integer) : "Fade out time" : 0
startdist(integer) : "Fog start position" : 0
enddist(integer) : "Fog end position" : 1000
density(string) : "Fog density" : "0.0005"
rendercolor(color255) : "Fog Color (R G B)" : "255 255 255"
spawnflags(flags) =
[
1 : "Start active" : 0
]
]
@PointClass base(Targetname) iconsprite("sprites/CS/env_rain.spr") = env_rain : "rain Properties"
[
fadein(integer) : "Fade in time" : 0
holdtime(string) : "Hold time (0 = permanent)" : "0"
fadeout(integer) : "Fade out time" : 0
startdist(integer) : "snow start position" : 0
enddist(integer) : "rain end position" : 1000
rendercolor(color255) : "rain Color (R G B)" : "255 255 255"
spawnflags(flags) =
[
1 : "Start active" : 0
]
]
@PointClass base(Targetname) = env_snow : "snow Properties"
[
fadein(integer) : "Fade in time" : 0
holdtime(string) : "Hold time (0 = permanent)" : "0"
fadeout(integer) : "Fade out time" : 0
startdist(integer) : "snow start position" : 0
enddist(integer) : "snow end position" : 1000
rendercolor(color255) : "snow Color (R G B)" : "255 255 255"
spawnflags(flags) =
[
1 : "Start active" : 0
]
]
@PointClass base(Targetname) = env_lighting : "lightning Properties"

View File

@ -95,6 +95,7 @@ public:
// basic functions
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;
@ -107,6 +108,8 @@ public:
float m_flVolume;
float m_pitch;
int m_sounds;
Vector m_angles;
};
class CPendulum: public CBaseEntity {

View File

@ -264,7 +264,9 @@ public:
class CTriggerPush: public CBaseTrigger {
public:
virtual void Spawn() = 0;
virtual void Restart() = 0;
virtual void KeyValue(KeyValueData *pkvd) = 0;
virtual int ObjectCaps() = 0;
virtual void Touch(CBaseEntity *pOther) = 0;
};