2
0
mirror of https://github.com/s1lentq/ReGameDLL_CS.git synced 2025-05-24 04:28:06 +03:00

Fix reset CRotDoor::Restart

Minor refactor
This commit is contained in:
s1lent 2017-11-27 21:51:23 +07:00
parent 7f9cf53c49
commit 0318c364dd
No known key found for this signature in database
GPG Key ID: 0FE401DC73916B5C
2 changed files with 14 additions and 6 deletions
regamedll/dlls

@ -522,7 +522,7 @@ void CBaseDoor::DoorGoUp()
// BUGBUG: Triggered doors don't work with this yet // BUGBUG: Triggered doors don't work with this yet
if (FClassnameIs(pev, "func_door_rotating")) if (FClassnameIs(pev, "func_door_rotating"))
{ {
float sign = 1.0; float sign = 1.0f;
if (m_hActivator) if (m_hActivator)
{ {
@ -614,7 +614,9 @@ void CBaseDoor::DoorGoUp()
AngularMove(m_vecAngle2 * sign, pev->speed); AngularMove(m_vecAngle2 * sign, pev->speed);
} }
else else
{
LinearMove(m_vecPosition2, pev->speed); LinearMove(m_vecPosition2, pev->speed);
}
} }
// The door has reached the "up" position. Either go back down, or wait for another activation. // The door has reached the "up" position. Either go back down, or wait for another activation.
@ -697,7 +699,9 @@ void CBaseDoor::DoorGoDown()
AngularMove(m_vecAngle1, pev->speed); AngularMove(m_vecAngle1, pev->speed);
} }
else else
{
LinearMove(m_vecPosition1, pev->speed); LinearMove(m_vecPosition1, pev->speed);
}
} }
// The door has reached the "down" position. Back to quiescence. // The door has reached the "down" position. Back to quiescence.
@ -869,11 +873,11 @@ void CRotDoor::Restart()
if (pev->speed == 0) if (pev->speed == 0)
pev->speed = 100; pev->speed = 100;
// DOOR_START_OPEN is to allow an entity to be lighted in the closed position
// but spawn in the open position
if (pev->spawnflags & SF_DOOR_START_OPEN) if (pev->spawnflags & SF_DOOR_START_OPEN)
{ {
#ifdef REGAMEDLL_FIXES #ifndef REGAMEDLL_FIXES
pev->angles = m_vecAngle1;
#else
pev->angles = m_vecAngle2; pev->angles = m_vecAngle2;
Vector vecSav = m_vecAngle1; Vector vecSav = m_vecAngle1;
@ -884,6 +888,10 @@ void CRotDoor::Restart()
pev->movedir = pev->movedir * -1; pev->movedir = pev->movedir * -1;
} }
#ifdef REGAMEDLL_FIXES
pev->angles = m_vecAngle1;
#endif
m_toggle_state = TS_AT_BOTTOM; m_toggle_state = TS_AT_BOTTOM;
DoorGoDown(); DoorGoDown();
} }

@ -108,7 +108,7 @@ void CBaseDelay::KeyValue(KeyValueData *pkvd)
// //
// Search for (string)targetname in all entities that // Search for (string)targetname in all entities that
// match (string)self.target and call their .use function (if they have one) // match (string)self.target and call their .use function (if they have one)
void CBaseEntity::SUB_UseTargets(CBaseEntity *pActivator, USE_TYPE useType, float value) NOINLINE void CBaseEntity::SUB_UseTargets(CBaseEntity *pActivator, USE_TYPE useType, float value)
{ {
// fire targets // fire targets
if (!FStringNull(pev->target)) if (!FStringNull(pev->target))
@ -367,7 +367,7 @@ void CBaseToggle::AngularMove(Vector vecDestAngle, float flSpeed)
m_vecFinalAngle = vecDestAngle; m_vecFinalAngle = vecDestAngle;
// Already there? // Already there?
if (vecDestAngle == pev->angles) if (pev->angles == vecDestAngle)
{ {
AngularMoveDone(); AngularMoveDone();
return; return;