Mapbase v4.2

- Added keyvalue to use random bounds on logic_timer to limit AddToTimer/SubtractFromTimer inputs (suggested by White_Red_Dragons)
- Fixed inconsistent env_projectedtexture state on save/load
- Added code to allow skybox to use a direct entity handle instead of a stored origin and angles in order to take advantage of entity interpolation while moving (less jittering)
- Moved map-specific file manifest parsing to happen after other entities are created (highly experimental)
- Added various misc. code improvements related to debug build and MP branch
- Fixed some VScript ammo type-related code forgotten in the previous update
- Added more VScript functions to CBaseAnimating, including pose parameter functions and the ability to look up bones and get bone position
- Added more origin and angles functions for VScript (suggested by krassell)
This commit is contained in:
Blixibon
2020-07-01 19:32:49 +00:00
parent bc6a35a99c
commit f636089003
24 changed files with 380 additions and 120 deletions

View File

@@ -412,6 +412,9 @@ public:
int m_iUseRandomTime;
float m_flLowerRandomBound;
float m_flUpperRandomBound;
#ifdef MAPBASE
bool m_bUseBoundsForTimerInputs;
#endif
// methods
void ResetTimer( void );
@@ -430,6 +433,10 @@ BEGIN_DATADESC( CTimerEntity )
DEFINE_FIELD( m_bUpDownState, FIELD_BOOLEAN ),
#ifdef MAPBASE
DEFINE_KEYFIELD( m_bUseBoundsForTimerInputs, FIELD_BOOLEAN, "UseBoundsForTimerInputs" ),
#endif
// Inputs
DEFINE_INPUTFUNC( FIELD_FLOAT, "RefireTime", InputRefireTime ),
DEFINE_INPUTFUNC( FIELD_VOID, "FireTimer", InputFireTimer ),
@@ -650,7 +657,24 @@ void CTimerEntity::InputAddToTimer( inputdata_t &inputdata )
// Add time to timer
float flNextThink = GetNextThink();
#ifdef MAPBASE
if (m_bUseBoundsForTimerInputs)
{
// Make sure it's not above our min or max bounds
if (flNextThink - gpGlobals->curtime > m_flUpperRandomBound)
return;
flNextThink += inputdata.value.Float();
flNextThink = clamp( flNextThink - gpGlobals->curtime, m_flLowerRandomBound, m_flUpperRandomBound );
SetNextThink( gpGlobals->curtime + flNextThink );
}
else
{
SetNextThink( flNextThink + inputdata.value.Float() );
}
#else
SetNextThink( flNextThink += inputdata.value.Float() );
#endif
}
//-----------------------------------------------------------------------------
@@ -665,6 +689,23 @@ void CTimerEntity::InputSubtractFromTimer( inputdata_t &inputdata )
// Subtract time from the timer but don't let the timer go negative
float flNextThink = GetNextThink();
#ifdef MAPBASE
if (m_bUseBoundsForTimerInputs)
{
// Make sure it's not above our min or max bounds
if (flNextThink - gpGlobals->curtime < m_flLowerRandomBound)
return;
flNextThink -= inputdata.value.Float();
flNextThink = clamp( flNextThink - gpGlobals->curtime, m_flLowerRandomBound, m_flUpperRandomBound );
SetNextThink( gpGlobals->curtime + flNextThink );
}
else
{
flNextThink -= inputdata.value.Float();
SetNextThink( (flNextThink <= gpGlobals->curtime) ? gpGlobals->curtime : flNextThink );
}
#else
if ( ( flNextThink - gpGlobals->curtime ) <= inputdata.value.Float() )
{
SetNextThink( gpGlobals->curtime );
@@ -673,6 +714,7 @@ void CTimerEntity::InputSubtractFromTimer( inputdata_t &inputdata )
{
SetNextThink( flNextThink -= inputdata.value.Float() );
}
#endif
}
//-----------------------------------------------------------------------------