Modified source engine (2017) developed by valve and leaked in 2020. Not for commercial purporses
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

92 lines
2.9 KiB

5 years ago
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: Base class for object upgrading objects
//
//=============================================================================//
#include "cbase.h"
#include "baseobject_shared.h"
#include "tf_obj_basedrivergun_shared.h"
#include "basetfvehicle.h"
IMPLEMENT_NETWORKCLASS_ALIASED( BaseObjectDriverGun, DT_BaseObjectDriverGun )
BEGIN_NETWORK_TABLE( CBaseObjectDriverGun, DT_BaseObjectDriverGun )
#if !defined( CLIENT_DLL )
SendPropVector( SENDINFO(m_vecGunAngles), -1, SPROP_COORD ),
#else
RecvPropVector( RECVINFO(m_vecGunAngles) ),
#endif
END_NETWORK_TABLE()
BEGIN_PREDICTION_DATA( CBaseObjectDriverGun )
DEFINE_PRED_FIELD_TOL( m_vecGunAngles, FIELD_VECTOR, FTYPEDESC_INSENDTABLE, 1.0f ),
END_PREDICTION_DATA()
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
CBaseObjectDriverGun::CBaseObjectDriverGun()
{
m_vecGunAngles = QAngle(0,0,0);
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CBaseObjectDriverGun::Spawn()
{
BaseClass::Spawn();
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CBaseObjectDriverGun::FinishedBuilding( void )
{
#if !defined( CLIENT_DLL )
BaseClass::FinishedBuilding();
CBaseTFVehicle *pVehicle = dynamic_cast<CBaseTFVehicle*>(GetParentObject());
Assert( pVehicle );
pVehicle->SetDriverGun( this );
#endif
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CBaseObjectDriverGun::SetTargetAngles( const QAngle &vecAngles )
{
m_vecGunAngles = vecAngles;
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
const QAngle &CBaseObjectDriverGun::GetCurrentAngles( void )
{
return m_vecGunAngles.Get();
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
Vector CBaseObjectDriverGun::GetFireOrigin( void )
{
return GetAbsOrigin();
}
#ifdef CLIENT_DLL
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
bool CBaseObjectDriverGun::ShouldPredict( void )
{
CBaseTFVehicle *pVehicle = dynamic_cast<CBaseTFVehicle*>(GetParentObject());
if ( pVehicle && pVehicle->GetDriverPlayer() == C_BasePlayer::GetLocalPlayer() )
return true;
return BaseClass::ShouldPredict();
}
#endif