mirror of
https://github.com/celisej567/source-engine.git
synced 2026-01-05 22:09:59 +03:00
upload "kind" alien swarm
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose: Client side view model implementation. Responsible for drawing
|
||||
// the view model.
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//=============================================================================//
|
||||
//===========================================================================//
|
||||
#include "cbase.h"
|
||||
#include "c_baseviewmodel.h"
|
||||
#include "model_types.h"
|
||||
@@ -18,34 +18,43 @@
|
||||
#include "tools/bonelist.h"
|
||||
#include <KeyValues.h>
|
||||
#include "hltvcamera.h"
|
||||
|
||||
#include "r_efx.h"
|
||||
#include "dlight.h"
|
||||
#include "clientalphaproperty.h"
|
||||
#include "iinput.h"
|
||||
#if defined( REPLAY_ENABLED )
|
||||
#include "replay/replaycamera.h"
|
||||
#include "replay/ireplaysystem.h"
|
||||
#include "replay/ienginereplay.h"
|
||||
#include "replaycamera.h"
|
||||
#endif
|
||||
|
||||
// NVNT haptics system interface
|
||||
#include "haptics/ihaptics.h"
|
||||
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
#ifdef CSTRIKE_DLL
|
||||
ConVar cl_righthand( "cl_righthand", "1", FCVAR_ARCHIVE, "Use right-handed view models." );
|
||||
#endif
|
||||
|
||||
#ifdef TF_CLIENT_DLL
|
||||
ConVar cl_flipviewmodels( "cl_flipviewmodels", "0", FCVAR_USERINFO | FCVAR_ARCHIVE | FCVAR_NOT_CONNECTED, "Flip view models." );
|
||||
#endif
|
||||
ConVar vm_debug( "vm_debug", "0", FCVAR_CHEAT );
|
||||
ConVar vm_draw_always( "vm_draw_always", "0" );
|
||||
|
||||
void PostToolMessage( HTOOLHANDLE hEntity, KeyValues *msg );
|
||||
extern float g_flMuzzleFlashScale;
|
||||
|
||||
void FormatViewModelAttachment( Vector &vOrigin, bool bInverse )
|
||||
void FormatViewModelAttachment( C_BasePlayer *pPlayer, Vector &vOrigin, bool bInverse )
|
||||
{
|
||||
int nSlot = 0;
|
||||
if ( pPlayer )
|
||||
{
|
||||
int nPlayerSlot = C_BasePlayer::GetSplitScreenSlotForPlayer( pPlayer );
|
||||
if ( nPlayerSlot == -1 )
|
||||
{
|
||||
nSlot = GET_ACTIVE_SPLITSCREEN_SLOT();
|
||||
}
|
||||
else
|
||||
{
|
||||
nSlot = nPlayerSlot;
|
||||
}
|
||||
}
|
||||
|
||||
Assert( nSlot != -1 );
|
||||
|
||||
// Presumably, SetUpView has been called so we know our FOV and render origin.
|
||||
const CViewSetup *pViewSetup = view->GetPlayerViewSetup();
|
||||
const CViewSetup *pViewSetup = view->GetPlayerViewSetup( nSlot );
|
||||
|
||||
float worldx = tan( pViewSetup->fov * M_PI/360.0 );
|
||||
float viewx = tan( pViewSetup->fovViewmodel * M_PI/360.0 );
|
||||
@@ -59,7 +68,7 @@ void FormatViewModelAttachment( Vector &vOrigin, bool bInverse )
|
||||
|
||||
// Get the coordinates in the viewer's space.
|
||||
Vector tmp = vOrigin - pViewSetup->origin;
|
||||
Vector vTransformed( MainViewRight().Dot( tmp ), MainViewUp().Dot( tmp ), MainViewForward().Dot( tmp ) );
|
||||
Vector vTransformed( MainViewRight(nSlot).Dot( tmp ), MainViewUp(nSlot).Dot( tmp ), MainViewForward(nSlot).Dot( tmp ) );
|
||||
|
||||
// Now squash X and Y.
|
||||
if ( bInverse )
|
||||
@@ -84,39 +93,35 @@ void FormatViewModelAttachment( Vector &vOrigin, bool bInverse )
|
||||
|
||||
|
||||
// Transform back to world space.
|
||||
Vector vOut = (MainViewRight() * vTransformed.x) + (MainViewUp() * vTransformed.y) + (MainViewForward() * vTransformed.z);
|
||||
Vector vOut = (MainViewRight(nSlot) * vTransformed.x) + (MainViewUp(nSlot) * vTransformed.y) + (MainViewForward(nSlot) * vTransformed.z);
|
||||
vOrigin = pViewSetup->origin + vOut;
|
||||
}
|
||||
|
||||
|
||||
void C_BaseViewModel::FormatViewModelAttachment( int nAttachment, matrix3x4_t &attachmentToWorld )
|
||||
{
|
||||
C_BasePlayer *pPlayer = ToBasePlayer( GetOwner() );
|
||||
Vector vecOrigin;
|
||||
MatrixPosition( attachmentToWorld, vecOrigin );
|
||||
::FormatViewModelAttachment( vecOrigin, false );
|
||||
::FormatViewModelAttachment( pPlayer, vecOrigin, false );
|
||||
PositionMatrix( vecOrigin, attachmentToWorld );
|
||||
}
|
||||
|
||||
|
||||
bool C_BaseViewModel::IsViewModel() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void C_BaseViewModel::UncorrectViewModelAttachment( Vector &vOrigin )
|
||||
{
|
||||
C_BasePlayer *pPlayer = ToBasePlayer( GetOwner() );
|
||||
// Unformat the attachment.
|
||||
::FormatViewModelAttachment( vOrigin, true );
|
||||
::FormatViewModelAttachment( pPlayer, vOrigin, true );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose
|
||||
//-----------------------------------------------------------------------------
|
||||
void C_BaseViewModel::FireEvent( const Vector& origin, const QAngle& angles, int event, const char *options )
|
||||
void C_BaseViewModel::FireEvent( const Vector& origin, const QAngle& angles, int eventNum, const char *options )
|
||||
{
|
||||
// We override sound requests so that we can play them locally on the owning player
|
||||
if ( ( event == AE_CL_PLAYSOUND ) || ( event == CL_EVENT_SOUND ) )
|
||||
if ( ( eventNum == AE_CL_PLAYSOUND ) || ( eventNum == CL_EVENT_SOUND ) )
|
||||
{
|
||||
// Only do this if we're owned by someone
|
||||
if ( GetOwner() != NULL )
|
||||
@@ -127,18 +132,23 @@ void C_BaseViewModel::FireEvent( const Vector& origin, const QAngle& angles, int
|
||||
}
|
||||
}
|
||||
|
||||
C_BasePlayer *pOwner = ToBasePlayer( GetOwner() );
|
||||
if ( !pOwner )
|
||||
return;
|
||||
|
||||
ACTIVE_SPLITSCREEN_PLAYER_GUARD_ENT( pOwner );
|
||||
|
||||
// Otherwise pass the event to our associated weapon
|
||||
C_BaseCombatWeapon *pWeapon = GetActiveWeapon();
|
||||
C_BaseCombatWeapon *pWeapon = pOwner->GetActiveWeapon();
|
||||
if ( pWeapon )
|
||||
{
|
||||
// NVNT notify the haptics system of our viewmodel's event
|
||||
if ( haptics )
|
||||
haptics->ProcessHapticEvent(4,"Weapons",pWeapon->GetName(),"AnimationEvents",VarArgs("%i",event));
|
||||
|
||||
bool bResult = pWeapon->OnFireEvent( this, origin, angles, event, options );
|
||||
bool bResult = pWeapon->OnFireEvent( this, origin, angles, eventNum, options );
|
||||
if ( !bResult )
|
||||
{
|
||||
BaseClass::FireEvent( origin, angles, event, options );
|
||||
if ( eventNum == AE_CLIENT_EFFECT_ATTACH && ::input->CAM_IsThirdPerson() )
|
||||
return;
|
||||
|
||||
BaseClass::FireEvent( origin, angles, eventNum, options );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -153,7 +163,7 @@ bool C_BaseViewModel::Interpolate( float currentTime )
|
||||
|
||||
// Hack to extrapolate cycle counter for view model
|
||||
float elapsed_time = currentTime - m_flAnimTime;
|
||||
C_BasePlayer *pPlayer = C_BasePlayer::GetLocalPlayer();
|
||||
C_BasePlayer *pPlayer = ToBasePlayer( GetOwner() );
|
||||
|
||||
// Predicted viewmodels have fixed up interval
|
||||
if ( GetPredictable() || IsClientCreated() )
|
||||
@@ -162,10 +172,7 @@ bool C_BaseViewModel::Interpolate( float currentTime )
|
||||
float curtime = pPlayer ? pPlayer->GetFinalPredictedTime() : gpGlobals->curtime;
|
||||
elapsed_time = curtime - m_flAnimTime;
|
||||
// Adjust for interpolated partial frame
|
||||
if ( !engine->IsPaused() )
|
||||
{
|
||||
elapsed_time += ( gpGlobals->interpolation_amount * TICK_INTERVAL );
|
||||
}
|
||||
elapsed_time += ( gpGlobals->interpolation_amount * TICK_INTERVAL );
|
||||
}
|
||||
|
||||
// Prediction errors?
|
||||
@@ -174,7 +181,7 @@ bool C_BaseViewModel::Interpolate( float currentTime )
|
||||
elapsed_time = 0;
|
||||
}
|
||||
|
||||
float dt = elapsed_time * GetSequenceCycleRate( pStudioHdr, GetSequence() ) * GetPlaybackRate();
|
||||
float dt = elapsed_time * GetSequenceCycleRate( pStudioHdr, GetSequence() );
|
||||
if ( dt >= 1.0f )
|
||||
{
|
||||
if ( !IsSequenceLooping( GetSequence() ) )
|
||||
@@ -194,24 +201,6 @@ bool C_BaseViewModel::Interpolate( float currentTime )
|
||||
|
||||
inline bool C_BaseViewModel::ShouldFlipViewModel()
|
||||
{
|
||||
#ifdef CSTRIKE_DLL
|
||||
// If cl_righthand is set, then we want them all right-handed.
|
||||
CBaseCombatWeapon *pWeapon = m_hWeapon.Get();
|
||||
if ( pWeapon )
|
||||
{
|
||||
const FileWeaponInfo_t *pInfo = &pWeapon->GetWpnData();
|
||||
return pInfo->m_bAllowFlipping && pInfo->m_bBuiltRightHanded != cl_righthand.GetBool();
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef TF_CLIENT_DLL
|
||||
CBaseCombatWeapon *pWeapon = m_hWeapon.Get();
|
||||
if ( pWeapon )
|
||||
{
|
||||
return pWeapon->m_bFlipViewModel != cl_flipviewmodels.GetBool();
|
||||
}
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -220,6 +209,8 @@ void C_BaseViewModel::ApplyBoneMatrixTransform( matrix3x4_t& transform )
|
||||
{
|
||||
if ( ShouldFlipViewModel() )
|
||||
{
|
||||
ACTIVE_SPLITSCREEN_PLAYER_GUARD_ENT( GetOwner() );
|
||||
|
||||
matrix3x4_t viewMatrix, viewMatrixInverse;
|
||||
|
||||
// We could get MATERIAL_VIEW here, but this is called sometimes before the renderer
|
||||
@@ -256,13 +247,13 @@ void C_BaseViewModel::ApplyBoneMatrixTransform( matrix3x4_t& transform )
|
||||
//-----------------------------------------------------------------------------
|
||||
bool C_BaseViewModel::ShouldDraw()
|
||||
{
|
||||
if ( engine->IsHLTV() )
|
||||
if ( g_bEngineIsHLTV )
|
||||
{
|
||||
return ( HLTVCamera()->GetMode() == OBS_MODE_IN_EYE &&
|
||||
HLTVCamera()->GetPrimaryTarget() == GetOwner() );
|
||||
}
|
||||
#if defined( REPLAY_ENABLED )
|
||||
else if ( g_pEngineClientReplay->IsPlayingReplayDemo() )
|
||||
else if ( engine->IsReplay() )
|
||||
{
|
||||
return ( ReplayCamera()->GetMode() == OBS_MODE_IN_EYE &&
|
||||
ReplayCamera()->GetPrimaryTarget() == GetOwner() );
|
||||
@@ -270,6 +261,14 @@ bool C_BaseViewModel::ShouldDraw()
|
||||
#endif
|
||||
else
|
||||
{
|
||||
Assert( !IsEffectActive( EF_NODRAW ) );
|
||||
Assert( GetRenderMode() != kRenderNone );
|
||||
|
||||
if ( vm_draw_always.GetBool() )
|
||||
return true;
|
||||
if ( GetOwner() != C_BasePlayer::GetLocalPlayer() )
|
||||
return false;
|
||||
|
||||
return BaseClass::ShouldDraw();
|
||||
}
|
||||
}
|
||||
@@ -278,7 +277,7 @@ bool C_BaseViewModel::ShouldDraw()
|
||||
// Purpose: Render the weapon. Draw the Viewmodel if the weapon's being carried
|
||||
// by this player, otherwise draw the worldmodel.
|
||||
//-----------------------------------------------------------------------------
|
||||
int C_BaseViewModel::DrawModel( int flags )
|
||||
int C_BaseViewModel::DrawModel( int flags, const RenderableInstance_t &instance )
|
||||
{
|
||||
if ( !m_bReadyToDraw )
|
||||
return 0;
|
||||
@@ -286,7 +285,7 @@ int C_BaseViewModel::DrawModel( int flags )
|
||||
if ( flags & STUDIO_RENDER )
|
||||
{
|
||||
// Determine blending amount and tell engine
|
||||
float blend = (float)( GetFxBlend() / 255.0f );
|
||||
float blend = (float)( instance.m_nAlpha / 255.0f );
|
||||
|
||||
// Totally gone
|
||||
if ( blend <= 0.0f )
|
||||
@@ -299,24 +298,32 @@ int C_BaseViewModel::DrawModel( int flags )
|
||||
GetColorModulation( color );
|
||||
render->SetColorModulation( color );
|
||||
}
|
||||
|
||||
|
||||
CMatRenderContextPtr pRenderContext( materials );
|
||||
|
||||
if ( ShouldFlipViewModel() )
|
||||
pRenderContext->CullMode( MATERIAL_CULLMODE_CW );
|
||||
|
||||
int ret = 0;
|
||||
C_BasePlayer *pPlayer = C_BasePlayer::GetLocalPlayer();
|
||||
C_BaseCombatWeapon *pWeapon = GetOwningWeapon();
|
||||
int ret;
|
||||
|
||||
// If the local player's overriding the viewmodel rendering, let him do it
|
||||
if ( pPlayer && pPlayer->IsOverridingViewmodel() )
|
||||
{
|
||||
ret = pPlayer->DrawOverriddenViewmodel( this, flags );
|
||||
ret = pPlayer->DrawOverriddenViewmodel( this, flags, instance );
|
||||
}
|
||||
else if ( pWeapon && pWeapon->IsOverridingViewmodel() )
|
||||
{
|
||||
ret = pWeapon->DrawOverriddenViewmodel( this, flags );
|
||||
ret = pWeapon->DrawOverriddenViewmodel( this, flags, instance );
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = BaseClass::DrawModel( flags );
|
||||
ret = BaseClass::DrawModel( flags, instance );
|
||||
}
|
||||
|
||||
pRenderContext->CullMode( MATERIAL_CULLMODE_CCW );
|
||||
|
||||
// Now that we've rendered, reset the animation restart flag
|
||||
if ( flags & STUDIO_RENDER )
|
||||
{
|
||||
@@ -324,111 +331,120 @@ int C_BaseViewModel::DrawModel( int flags )
|
||||
{
|
||||
m_nOldAnimationParity = m_nAnimationParity;
|
||||
}
|
||||
|
||||
// Tell the weapon itself that we've rendered, in case it wants to do something
|
||||
if ( pWeapon )
|
||||
{
|
||||
pWeapon->ViewModelDrawn( this );
|
||||
}
|
||||
|
||||
if ( vm_debug.GetBool() )
|
||||
{
|
||||
MDLCACHE_CRITICAL_SECTION();
|
||||
|
||||
int line = 16;
|
||||
CStudioHdr *hdr = GetModelPtr();
|
||||
engine->Con_NPrintf( line++, "%s: %s(%d), cycle: %.2f cyclerate: %.2f playbackrate: %.2f\n",
|
||||
(hdr)?hdr->pszName():"(null)",
|
||||
GetSequenceName( GetSequence() ),
|
||||
GetSequence(),
|
||||
GetCycle(),
|
||||
GetSequenceCycleRate( hdr, GetSequence() ),
|
||||
GetPlaybackRate()
|
||||
);
|
||||
if ( hdr )
|
||||
{
|
||||
for( int i=0; i < hdr->GetNumPoseParameters(); ++i )
|
||||
{
|
||||
const mstudioposeparamdesc_t &Pose = hdr->pPoseParameter( i );
|
||||
engine->Con_NPrintf( line++, "pose_param %s: %f",
|
||||
Pose.pszName(), GetPoseParameter( i ) );
|
||||
}
|
||||
}
|
||||
|
||||
// Determine blending amount and tell engine
|
||||
float blend = (float)( instance.m_nAlpha / 255.0f );
|
||||
float color[3];
|
||||
GetColorModulation( color );
|
||||
engine->Con_NPrintf( line++, "blend=%f, color=%f,%f,%f", blend, color[0], color[1], color[2] );
|
||||
engine->Con_NPrintf( line++, "GetRenderMode()=%d", GetRenderMode() );
|
||||
engine->Con_NPrintf( line++, "m_nRenderFX=0x%8.8X", GetRenderFX() );
|
||||
|
||||
color24 c = GetRenderColor();
|
||||
unsigned char a = GetRenderAlpha();
|
||||
engine->Con_NPrintf( line++, "rendercolor=%d,%d,%d,%d", c.r, c.g, c.b, a );
|
||||
|
||||
engine->Con_NPrintf( line++, "origin=%f, %f, %f", GetRenderOrigin().x, GetRenderOrigin().y, GetRenderOrigin().z );
|
||||
engine->Con_NPrintf( line++, "angles=%f, %f, %f", GetRenderAngles()[0], GetRenderAngles()[1], GetRenderAngles()[2] );
|
||||
|
||||
if ( IsEffectActive( EF_NODRAW ) )
|
||||
{
|
||||
engine->Con_NPrintf( line++, "EF_NODRAW" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//-----------------------------------------------------------------------------
|
||||
int C_BaseViewModel::InternalDrawModel( int flags )
|
||||
{
|
||||
CMatRenderContextPtr pRenderContext( materials );
|
||||
if ( ShouldFlipViewModel() )
|
||||
pRenderContext->CullMode( MATERIAL_CULLMODE_CW );
|
||||
|
||||
int ret = BaseClass::InternalDrawModel( flags );
|
||||
|
||||
pRenderContext->CullMode( MATERIAL_CULLMODE_CCW );
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Called by the player when the player's overriding the viewmodel drawing. Avoids infinite recursion.
|
||||
//-----------------------------------------------------------------------------
|
||||
int C_BaseViewModel::DrawOverriddenViewmodel( int flags )
|
||||
int C_BaseViewModel::DrawOverriddenViewmodel( int flags, const RenderableInstance_t &instance )
|
||||
{
|
||||
return BaseClass::DrawModel( flags );
|
||||
return BaseClass::DrawModel( flags, instance );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
// Output : int
|
||||
//-----------------------------------------------------------------------------
|
||||
int C_BaseViewModel::GetFxBlend( void )
|
||||
uint8 C_BaseViewModel::OverrideAlphaModulation( uint8 nAlpha )
|
||||
{
|
||||
ACTIVE_SPLITSCREEN_PLAYER_GUARD_ENT( GetOwner() );
|
||||
|
||||
// See if the local player wants to override the viewmodel's rendering
|
||||
C_BasePlayer *pPlayer = C_BasePlayer::GetLocalPlayer();
|
||||
if ( pPlayer && pPlayer->IsOverridingViewmodel() )
|
||||
{
|
||||
pPlayer->ComputeFxBlend();
|
||||
return pPlayer->GetFxBlend();
|
||||
}
|
||||
|
||||
return pPlayer->AlphaProp()->ComputeRenderAlpha();
|
||||
|
||||
C_BaseCombatWeapon *pWeapon = GetOwningWeapon();
|
||||
if ( pWeapon && pWeapon->IsOverridingViewmodel() )
|
||||
{
|
||||
pWeapon->ComputeFxBlend();
|
||||
return pWeapon->GetFxBlend();
|
||||
}
|
||||
return pWeapon->AlphaProp()->ComputeRenderAlpha();
|
||||
|
||||
return nAlpha;
|
||||
|
||||
return BaseClass::GetFxBlend();
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
// Output : Returns true on success, false on failure.
|
||||
//-----------------------------------------------------------------------------
|
||||
bool C_BaseViewModel::IsTransparent( void )
|
||||
RenderableTranslucencyType_t C_BaseViewModel::ComputeTranslucencyType( void )
|
||||
{
|
||||
ACTIVE_SPLITSCREEN_PLAYER_GUARD_ENT( GetOwner() );
|
||||
|
||||
// See if the local player wants to override the viewmodel's rendering
|
||||
C_BasePlayer *pPlayer = C_BasePlayer::GetLocalPlayer();
|
||||
if ( pPlayer && pPlayer->IsOverridingViewmodel() )
|
||||
{
|
||||
return pPlayer->ViewModel_IsTransparent();
|
||||
}
|
||||
return pPlayer->ComputeTranslucencyType();
|
||||
|
||||
C_BaseCombatWeapon *pWeapon = GetOwningWeapon();
|
||||
if ( pWeapon && pWeapon->IsOverridingViewmodel() )
|
||||
return pWeapon->ViewModel_IsTransparent();
|
||||
return pWeapon->ComputeTranslucencyType();
|
||||
|
||||
return BaseClass::ComputeTranslucencyType();
|
||||
|
||||
return BaseClass::IsTransparent();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//-----------------------------------------------------------------------------
|
||||
bool C_BaseViewModel::UsesPowerOfTwoFrameBufferTexture( void )
|
||||
{
|
||||
// See if the local player wants to override the viewmodel's rendering
|
||||
C_BasePlayer *pPlayer = C_BasePlayer::GetLocalPlayer();
|
||||
if ( pPlayer && pPlayer->IsOverridingViewmodel() )
|
||||
{
|
||||
return pPlayer->ViewModel_IsUsingFBTexture();
|
||||
}
|
||||
|
||||
C_BaseCombatWeapon *pWeapon = GetOwningWeapon();
|
||||
if ( pWeapon && pWeapon->IsOverridingViewmodel() )
|
||||
{
|
||||
return pWeapon->ViewModel_IsUsingFBTexture();
|
||||
}
|
||||
|
||||
return BaseClass::UsesPowerOfTwoFrameBufferTexture();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: If the animation parity of the weapon has changed, we reset cycle to avoid popping
|
||||
//-----------------------------------------------------------------------------
|
||||
void C_BaseViewModel::UpdateAnimationParity( void )
|
||||
{
|
||||
C_BasePlayer *pPlayer = C_BasePlayer::GetLocalPlayer();
|
||||
C_BasePlayer *pPlayer = ToBasePlayer( GetOwner() );
|
||||
|
||||
// If we're predicting, then we don't use animation parity because we change the animations on the clientside
|
||||
// while predicting. When not predicting, only the server changes the animations, so a parity mismatch
|
||||
@@ -450,27 +466,26 @@ void C_BaseViewModel::UpdateAnimationParity( void )
|
||||
//-----------------------------------------------------------------------------
|
||||
void C_BaseViewModel::OnDataChanged( DataUpdateType_t updateType )
|
||||
{
|
||||
if ( updateType == DATA_UPDATE_CREATED )
|
||||
{
|
||||
AlphaProp()->EnableAlphaModulationOverride( true );
|
||||
}
|
||||
|
||||
SetPredictionEligible( true );
|
||||
BaseClass::OnDataChanged(updateType);
|
||||
}
|
||||
|
||||
void C_BaseViewModel::PostDataUpdate( DataUpdateType_t updateType )
|
||||
{
|
||||
BaseClass::PostDataUpdate(updateType);
|
||||
OnLatchInterpolatedVariables( LATCH_ANIMATION_VAR );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Add entity to visible view models list
|
||||
// Purpose: Return the player who will predict this entity
|
||||
//-----------------------------------------------------------------------------
|
||||
void C_BaseViewModel::AddEntity( void )
|
||||
CBasePlayer *C_BaseViewModel::GetPredictionOwner()
|
||||
{
|
||||
// Server says don't interpolate this frame, so set previous info to new info.
|
||||
if ( IsNoInterpolationFrame() )
|
||||
{
|
||||
ResetLatched();
|
||||
}
|
||||
return ToBasePlayer( GetOwner() );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -481,18 +496,14 @@ void C_BaseViewModel::GetBoneControllers(float controllers[MAXSTUDIOBONECTRLS])
|
||||
BaseClass::GetBoneControllers( controllers );
|
||||
|
||||
// Tell the weapon itself that we've rendered, in case it wants to do something
|
||||
C_BaseCombatWeapon *pWeapon = GetActiveWeapon();
|
||||
C_BasePlayer *pPlayer = ToBasePlayer( GetOwner() );
|
||||
if ( !pPlayer )
|
||||
return;
|
||||
|
||||
C_BaseCombatWeapon *pWeapon = pPlayer->GetActiveWeapon();
|
||||
if ( pWeapon )
|
||||
{
|
||||
pWeapon->GetViewmodelBoneControllers( this, controllers );
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
// Output : RenderGroup_t
|
||||
//-----------------------------------------------------------------------------
|
||||
RenderGroup_t C_BaseViewModel::GetRenderGroup()
|
||||
{
|
||||
return RENDER_GROUP_VIEW_MODEL_OPAQUE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user