97 lines
3.1 KiB
C++
97 lines
3.1 KiB
C++
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
|
|
//
|
|
// Purpose: Client's C_BaseCombatCharacter entity
|
|
//
|
|
// $Workfile: $
|
|
// $Date: $
|
|
//
|
|
//-----------------------------------------------------------------------------
|
|
// $Log: $
|
|
//
|
|
// $NoKeywords: $
|
|
//=============================================================================//
|
|
#include "cbase.h"
|
|
#include "c_basecombatcharacter.h"
|
|
// memdbgon must be the last include file in a .cpp file!!!
|
|
#include "tier0/memdbgon.h"
|
|
|
|
#if defined( CBaseCombatCharacter )
|
|
#undef CBaseCombatCharacter
|
|
#endif
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// Purpose:
|
|
//-----------------------------------------------------------------------------
|
|
C_BaseCombatCharacter::C_BaseCombatCharacter()
|
|
{
|
|
for ( int i=0; i < m_iAmmo.Count(); i++ )
|
|
m_iAmmo.Set( i, 0 );
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// Purpose:
|
|
//-----------------------------------------------------------------------------
|
|
C_BaseCombatCharacter::~C_BaseCombatCharacter()
|
|
{
|
|
}
|
|
|
|
/*
|
|
//-----------------------------------------------------------------------------
|
|
// Purpose: Returns the amount of ammunition of the specified type the character's carrying
|
|
//-----------------------------------------------------------------------------
|
|
int C_BaseCombatCharacter::GetAmmoCount( char *szName ) const
|
|
{
|
|
return GetAmmoCount( g_pGameRules->GetAmmoDef()->Index(szName) );
|
|
}
|
|
*/
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// Purpose: Overload our muzzle flash and send it to any actively held weapon
|
|
//-----------------------------------------------------------------------------
|
|
void C_BaseCombatCharacter::DoMuzzleFlash()
|
|
{
|
|
// Our weapon takes our muzzle flash command
|
|
C_BaseCombatWeapon *pWeapon = GetActiveWeapon();
|
|
if ( pWeapon )
|
|
{
|
|
pWeapon->DoMuzzleFlash();
|
|
//NOTENOTE: We do not chain to the base here
|
|
}
|
|
else
|
|
{
|
|
BaseClass::DoMuzzleFlash();
|
|
}
|
|
}
|
|
IMPLEMENT_CLIENTCLASS(C_BaseCombatCharacter, DT_BaseCombatCharacter, CBaseCombatCharacter);
|
|
|
|
// Only send active weapon index to local player
|
|
BEGIN_RECV_TABLE_NOBASE( C_BaseCombatCharacter, DT_BCCLocalPlayerExclusive )
|
|
RecvPropTime( RECVINFO( m_flNextAttack ) ),
|
|
|
|
|
|
RecvPropArray3( RECVINFO_ARRAY(m_hMyWeapons), RecvPropEHandle( RECVINFO( m_hMyWeapons[0] ) ) ),
|
|
|
|
|
|
END_RECV_TABLE();
|
|
|
|
|
|
BEGIN_RECV_TABLE(C_BaseCombatCharacter, DT_BaseCombatCharacter)
|
|
RecvPropDataTable( "bcc_localdata", 0, 0, &REFERENCE_RECV_TABLE(DT_BCCLocalPlayerExclusive) ),
|
|
RecvPropEHandle( RECVINFO( m_hActiveWeapon ) ),
|
|
|
|
|
|
|
|
|
|
|
|
END_RECV_TABLE()
|
|
|
|
|
|
BEGIN_PREDICTION_DATA( C_BaseCombatCharacter )
|
|
|
|
DEFINE_PRED_ARRAY( m_iAmmo, FIELD_INTEGER, MAX_AMMO_TYPES, FTYPEDESC_INSENDTABLE ),
|
|
DEFINE_PRED_FIELD( m_flNextAttack, FIELD_FLOAT, FTYPEDESC_INSENDTABLE ),
|
|
DEFINE_PRED_FIELD( m_hActiveWeapon, FIELD_EHANDLE, FTYPEDESC_INSENDTABLE ),
|
|
DEFINE_PRED_ARRAY( m_hMyWeapons, FIELD_EHANDLE, MAX_WEAPONS, FTYPEDESC_INSENDTABLE ),
|
|
|
|
END_PREDICTION_DATA()
|