cl_dll/c_baseviewmodel.cpp
18192021222324
#include "tools/bonelist.h"
#include
#include "hltvcamera.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
18192021222324252627
#include "tools/bonelist.h"
#include
#include "hltvcamera.h"
#include "iinput.h"
#include "c_ff_player.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
9899100101102103
//-----------------------------------------------------------------------------
void C_BaseViewModel::FireEvent( const Vector& origin, const QAngle& angles, int event, 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 ) )
{
101102103104105106107108109110
//-----------------------------------------------------------------------------
void C_BaseViewModel::FireEvent( const Vector& origin, const QAngle& angles, int event, const char *options )
{
// Mirv: Don't do any viewmodel stuff in third person
if (input->CAM_IsThirdPerson())
return;
// We override sound requests so that we can play them locally on the owning player
if ( ( event == AE_CL_PLAYSOUND ) || ( event == CL_EVENT_SOUND ) )
{
264265266267268269270271272273
if ( ShouldFlipViewModel() )
materials->CullMode( MATERIAL_CULLMODE_CW );
C_BasePlayer *pPlayer = C_BasePlayer::GetLocalPlayer();
int ret;
// If the local player's overriding the viewmodel rendering, let him do it
if ( pPlayer && pPlayer->IsOverridingViewmodel() )
{
ret = pPlayer->DrawOverriddenViewmodel( this, flags );
}
271272273274275276277278279280281282283
if ( ShouldFlipViewModel() )
materials->CullMode( MATERIAL_CULLMODE_CW );
// use the owner of the weapon instead of the local player so it works universally (for spectators, etc)
C_FFPlayer *pPlayer = ToFFPlayer( GetOwner() );
int ret;
// If the local player's overriding the viewmodel rendering, let him do it
// Jon: override if we have an override material
//if ( pPlayer && pPlayer->IsOverridingViewmodel() )
if ( (pPlayer && pPlayer->IsOverridingViewmodel()) || (pPlayer && m_pOverrideMaterial) )
{
ret = pPlayer->DrawOverriddenViewmodel( this, flags );
}
301302303304305306
//-----------------------------------------------------------------------------
int C_BaseViewModel::DrawOverriddenViewmodel( int flags )
{
return BaseClass::DrawModel( flags );
}
311312313314315316317318319320321322323324325326327328329330331332333
//-----------------------------------------------------------------------------
int C_BaseViewModel::DrawOverriddenViewmodel( int flags )
{
C_FFPlayer *pPlayer = ToFFPlayer( GetOwner() );
if( pPlayer )
{
if( !pPlayer->IsCloaked() )
{
ReleaseOverrideMaterial(FF_CLOAK_MATERIAL);
}
else
{
// don't draw if cloaked and basically not moving
if ( pPlayer->GetLocalVelocity().Length() < 1.0f )
return 1;
FindOverrideMaterial(FF_CLOAK_MATERIAL, FF_CLOAK_TEXTURE_GROUP);
}
}
return BaseClass::DrawModel( flags );
}
311312313314315316317318319320321
int C_BaseViewModel::GetFxBlend( 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->GetFxBlend();
}
return BaseClass::GetFxBlend();
}
338339340341342343344345346347348349350
int C_BaseViewModel::GetFxBlend( 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->GetFxBlend();
}
*/
return BaseClass::GetFxBlend();
}