Semi-fixed cs hostages
This commit is contained in:
parent
0fbddc051d
commit
4377aa7b81
11 changed files with 29 additions and 36 deletions
|
@ -24,9 +24,6 @@ END_RECV_TABLE()
|
|||
//-----------------------------------------------------------------------------
|
||||
C_NextBotCombatCharacter::C_NextBotCombatCharacter()
|
||||
{
|
||||
// Left4Dead have surfaces too steep for IK to work properly
|
||||
m_EntClientFlags |= ENTCLIENTFLAG_DONTUSEIK;
|
||||
|
||||
m_shadowType = SHADOWS_SIMPLE;
|
||||
m_forcedShadowType = SHADOWS_NONE;
|
||||
m_bForceShadowType = false;
|
||||
|
|
|
@ -181,7 +181,8 @@ IMPLEMENT_CLIENTCLASS_DT(C_BaseAnimating, DT_BaseAnimating, CBaseAnimating)
|
|||
|
||||
RecvPropFloat( RECVINFO( m_fadeMinDist ) ),
|
||||
RecvPropFloat( RECVINFO( m_fadeMaxDist ) ),
|
||||
RecvPropFloat( RECVINFO( m_flFadeScale ) )
|
||||
RecvPropFloat( RECVINFO( m_flFadeScale ) ),
|
||||
RecvPropBool( RECVINFO(m_bUseIks) )
|
||||
|
||||
END_RECV_TABLE()
|
||||
|
||||
|
@ -2877,12 +2878,12 @@ bool C_BaseAnimating::SetupBones( matrix3x4_t *pBoneToWorldOut, int nMaxBones, i
|
|||
AddFlag( EFL_SETTING_UP_BONES );
|
||||
|
||||
// NOTE: For model scaling, we need to opt out of IK because it will mark the bones as already being calculated
|
||||
if ( !IsModelScaled() )
|
||||
if ( !IsModelScaled() && m_bUseIks )
|
||||
{
|
||||
// only allocate an ik block if the npc can use it
|
||||
// The flag is now completely ignored to match server bones!
|
||||
// If it doesn't work well, blame models.
|
||||
if ( !m_pIk && hdr->numikchains() > 0 && !(m_EntClientFlags & ENTCLIENTFLAG_DONTUSEIK) )
|
||||
if ( !m_pIk && hdr->numikchains() > 0 )
|
||||
{
|
||||
m_pIk = new CIKContext;
|
||||
}
|
||||
|
|
|
@ -178,7 +178,6 @@ struct thinkfunc_t
|
|||
|
||||
// Entity flags that only exist on the client.
|
||||
#define ENTCLIENTFLAG_GETTINGSHADOWRENDERBOUNDS 0x0001 // Tells us if we're getting the real ent render bounds or the shadow render bounds.
|
||||
#define ENTCLIENTFLAG_DONTUSEIK 0x0002 // Don't use IK on this entity even if its model has IK.
|
||||
#define ENTCLIENTFLAG_ALWAYS_INTERPOLATE 0x0004 // Used by view models.
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -1286,6 +1285,7 @@ public:
|
|||
|
||||
// Entity flags that are only for the client (ENTCLIENTFLAG_ defines).
|
||||
unsigned short m_EntClientFlags;
|
||||
bool m_bUseIks;
|
||||
|
||||
CNetworkColor32( m_clrRender );
|
||||
|
||||
|
|
|
@ -202,16 +202,6 @@ C_CHostage::C_CHostage()
|
|||
m_flDeadOrRescuedTime = 0.0;
|
||||
m_flLastBodyYaw = 0;
|
||||
m_createdLowViolenceRagdoll = false;
|
||||
|
||||
// TODO: Get IK working on the steep slopes CS has, then enable it on characters.
|
||||
// Breaks server side setup bones !
|
||||
// m_EntClientFlags |= ENTCLIENTFLAG_DONTUSEIK;
|
||||
|
||||
// set the model so the PlayerAnimState uses the Hostage activities/sequences
|
||||
SetModelName( "models/Characters/Hostage_01.mdl" );
|
||||
|
||||
m_PlayerAnimState = CreateHostageAnimState( this, this, LEGANIM_8WAY, false );
|
||||
|
||||
m_leader = NULL;
|
||||
m_blinkTimer.Invalidate();
|
||||
m_seq = -1;
|
||||
|
@ -234,7 +224,6 @@ C_CHostage::C_CHostage()
|
|||
C_CHostage::~C_CHostage()
|
||||
{
|
||||
g_Hostages.FindAndRemove( this );
|
||||
m_PlayerAnimState->Release();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -439,8 +428,6 @@ void C_CHostage::UpdateClientSideAnimation()
|
|||
return;
|
||||
}
|
||||
|
||||
m_PlayerAnimState->Update( GetAbsAngles()[YAW], GetAbsAngles()[PITCH] );
|
||||
|
||||
// initialize pose parameters
|
||||
char *setToZero[] =
|
||||
{
|
||||
|
|
|
@ -65,8 +65,6 @@ private:
|
|||
int m_OldLifestate;
|
||||
int m_iMaxHealth;
|
||||
|
||||
ICSPlayerAnimState *m_PlayerAnimState;
|
||||
|
||||
CNetworkVar( EHANDLE, m_leader ); // who we are following, or NULL
|
||||
|
||||
CNetworkVar( bool, m_isRescued );
|
||||
|
|
|
@ -54,7 +54,7 @@ C_HL2MP_Player::C_HL2MP_Player() : m_PlayerAnimState( this ), m_iv_angEyeAngles(
|
|||
|
||||
AddVar( &m_angEyeAngles, &m_iv_angEyeAngles, LATCH_SIMULATION_VAR );
|
||||
|
||||
m_EntClientFlags |= ENTCLIENTFLAG_DONTUSEIK;
|
||||
DisableServerIK();
|
||||
m_blinkTimer.Invalidate();
|
||||
|
||||
m_pFlashlightBeam = NULL;
|
||||
|
|
|
@ -324,7 +324,7 @@ C_Portal_Player::C_Portal_Player()
|
|||
|
||||
AddVar( &m_angEyeAngles, &m_iv_angEyeAngles, LATCH_SIMULATION_VAR );
|
||||
|
||||
m_EntClientFlags |= ENTCLIENTFLAG_DONTUSEIK;
|
||||
DisableServerIK();
|
||||
m_blinkTimer.Invalidate();
|
||||
|
||||
m_CCDeathHandle = INVALID_CLIENT_CCHANDLE;
|
||||
|
|
|
@ -215,6 +215,9 @@ NextBotCombatCharacter::NextBotCombatCharacter( void )
|
|||
{
|
||||
m_lastAttacker = NULL;
|
||||
m_didModelChange = false;
|
||||
|
||||
// Left4Dead have surfaces too steep for IK to work properly
|
||||
DisableServerIK();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
//
|
||||
//=============================================================================//
|
||||
|
||||
#include "ai_activity.h"
|
||||
#include "cbase.h"
|
||||
#include "baseanimating.h"
|
||||
#include "animation.h"
|
||||
|
@ -261,7 +262,8 @@ IMPLEMENT_SERVERCLASS_ST(CBaseAnimating, DT_BaseAnimating)
|
|||
// Fading
|
||||
SendPropFloat( SENDINFO( m_fadeMinDist ), 0, SPROP_NOSCALE ),
|
||||
SendPropFloat( SENDINFO( m_fadeMaxDist ), 0, SPROP_NOSCALE ),
|
||||
SendPropFloat( SENDINFO( m_flFadeScale ), 0, SPROP_NOSCALE )
|
||||
SendPropFloat( SENDINFO( m_flFadeScale ), 0, SPROP_NOSCALE ),
|
||||
SendPropBool( SENDINFO( m_bUseIks ) )
|
||||
END_SEND_TABLE()
|
||||
|
||||
|
||||
|
@ -289,6 +291,14 @@ CBaseAnimating::CBaseAnimating()
|
|||
m_fadeMaxDist = 0;
|
||||
m_flFadeScale = 0.0f;
|
||||
m_fBoneCacheFlags = 0;
|
||||
m_bUseIks = true;
|
||||
|
||||
int sequence = SelectWeightedSequence( ACT_IDLE );
|
||||
|
||||
if (GetSequence() != sequence)
|
||||
{
|
||||
SetSequence( sequence );
|
||||
}
|
||||
}
|
||||
|
||||
CBaseAnimating::~CBaseAnimating()
|
||||
|
@ -387,7 +397,7 @@ void CBaseAnimating::Spawn()
|
|||
//-----------------------------------------------------------------------------
|
||||
void CBaseAnimating::UseClientSideAnimation()
|
||||
{
|
||||
m_bClientSideAnimation = false;
|
||||
m_bClientSideAnimation = true;
|
||||
}
|
||||
|
||||
#define MAX_ANIMTIME_INTERVAL 0.2f
|
||||
|
@ -3499,17 +3509,12 @@ int CBaseAnimating::GetHitboxesFrontside( int *boxList, int boxMax, const Vector
|
|||
|
||||
void CBaseAnimating::EnableServerIK()
|
||||
{
|
||||
if (!m_pIk)
|
||||
{
|
||||
m_pIk = new CIKContext;
|
||||
m_iIKCounter = 0;
|
||||
}
|
||||
m_bUseIks = true;
|
||||
}
|
||||
|
||||
void CBaseAnimating::DisableServerIK()
|
||||
{
|
||||
delete m_pIk;
|
||||
m_pIk = NULL;
|
||||
m_bUseIks = false;
|
||||
}
|
||||
|
||||
Activity CBaseAnimating::GetSequenceActivity( int iSequence )
|
||||
|
|
|
@ -424,6 +424,7 @@ protected:
|
|||
|
||||
public:
|
||||
COutputEvent m_OnIgnite;
|
||||
CNetworkVar( bool, m_bUseIks );
|
||||
|
||||
protected:
|
||||
CStudioHdr *m_pStudioHdr;
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
#define HOSTAGE_THINK_INTERVAL 0.1f
|
||||
#define HOSTAGE_THINK_INTERVAL gpGlobals->interval_per_tick
|
||||
|
||||
#define DrawLine( from, to, duration, red, green, blue ) NDebugOverlay::Line( from, to, red, green, blue, true, 0.1f )
|
||||
#define HOSTAGE_PUSHAWAY_THINK_CONTEXT "HostagePushawayThink"
|
||||
|
@ -75,8 +75,7 @@ BEGIN_DATADESC( CHostage )
|
|||
|
||||
DEFINE_INPUTFUNC( FIELD_VOID, "OnRescueZoneTouch", HostageRescueZoneTouch ),
|
||||
|
||||
DEFINE_USEFUNC( HostageUse ),
|
||||
DEFINE_THINKFUNC( HostageThink ),
|
||||
DEFINE_USEFUNC( HostageUse )
|
||||
|
||||
END_DATADESC()
|
||||
|
||||
|
@ -104,6 +103,8 @@ CHostage::CHostage()
|
|||
g_Hostages.AddToTail( this );
|
||||
m_PlayerAnimState = CreateHostageAnimState( this, this, LEGANIM_8WAY, false );
|
||||
SetBloodColor( BLOOD_COLOR_RED );
|
||||
// TODO_ENHANCED: Get IK working on the steep slopes CS has, then enable it on characters.
|
||||
DisableServerIK();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in a new issue