Re-enabled NPC gesture turning with a cvar to toggle it

This commit is contained in:
Blixibon 2021-10-27 17:05:19 -05:00
parent 2eb12bcd5d
commit 0e8b870e7d
2 changed files with 17 additions and 0 deletions

View File

@ -4317,6 +4317,15 @@ void CAI_BaseNPC::SetTurnActivity ( void )
float flYD; float flYD;
flYD = GetMotor()->DeltaIdealYaw(); flYD = GetMotor()->DeltaIdealYaw();
#ifdef MAPBASE
// Allow AddTurnGesture() to decide this
if (GetMotor()->AddTurnGesture( flYD ))
{
SetIdealActivity( ACT_IDLE );
Remember( bits_MEMORY_TURNING );
return;
}
#else
// FIXME: unknown case, update yaw should catch these // FIXME: unknown case, update yaw should catch these
/* /*
if (GetMotor()->AddTurnGesture( flYD )) if (GetMotor()->AddTurnGesture( flYD ))
@ -4326,6 +4335,7 @@ void CAI_BaseNPC::SetTurnActivity ( void )
return; return;
} }
*/ */
#endif
if( flYD <= -80 && flYD >= -100 && SelectWeightedSequence( ACT_90_RIGHT ) != ACTIVITY_NOT_AVAILABLE ) if( flYD <= -80 && flYD >= -100 && SelectWeightedSequence( ACT_90_RIGHT ) != ACTIVITY_NOT_AVAILABLE )
{ {

View File

@ -1640,10 +1640,17 @@ void CAI_BlendedMotor::MaintainTurnActivity( void )
ConVar scene_flatturn( "scene_flatturn", "1" ); ConVar scene_flatturn( "scene_flatturn", "1" );
#ifdef MAPBASE
ConVar ai_turning_enabled( "ai_turning_enabled", "1", FCVAR_NONE, "Enables NPC turning, which was previously disabled by Valve at some point after 2004 due to a now-unknown major issue." );
#endif
bool CAI_BlendedMotor::AddTurnGesture( float flYD ) bool CAI_BlendedMotor::AddTurnGesture( float flYD )
{ {
// some funky bug with human turn gestures, disable for now // some funky bug with human turn gestures, disable for now
#ifdef MAPBASE
if (!ai_turning_enabled.GetBool())
#endif
return false; return false;
// try using a turn gesture // try using a turn gesture