本文整理汇总了C++中CAmmoDef::TracerType方法的典型用法代码示例。如果您正苦于以下问题:C++ CAmmoDef::TracerType方法的具体用法?C++ CAmmoDef::TracerType怎么用?C++ CAmmoDef::TracerType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CAmmoDef
的用法示例。
在下文中一共展示了CAmmoDef::TracerType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FireBullets
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CUnitBase::FireBullets( const FireBulletsInfo_t &info )
{
VPROF_BUDGET( "CUnitBase::FireBullets", VPROF_BUDGETGROUP_UNITS );
static int tracerCount;
trace_t tr;
CAmmoDef* pAmmoDef = GetAmmoDef();
int nDamageType = pAmmoDef->DamageType(info.m_iAmmoType);
//int nAmmoFlags = pAmmoDef->Flags(info.m_iAmmoType);
int iNumShots;
float flActualDamage;
// the default attacker is ourselves
CBaseEntity *pAttacker = info.m_pAttacker ? info.m_pAttacker : this;
ClearMultiDamage();
g_MultiDamage.SetDamageType( nDamageType | DMG_NEVERGIB );
Vector vecDir;
Vector vecEnd;
// Adjust spread to accuracy
Vector vecSpread( info.m_vecSpread );
//vecSpread.x = sin( ( (asin( info.m_vecSpread.x ) * 2.0f) * m_fAccuracy ) / 2.0f );
//vecSpread.y = sin( ( (asin( info.m_vecSpread.y ) * 2.0f) * m_fAccuracy ) / 2.0f );
//vecSpread.z = sin( ( (asin( info.m_vecSpread.z ) * 2.0f) * m_fAccuracy ) / 2.0f );
// Skip multiple entities when tracing
CWarsBulletsFilter traceFilter( this, COLLISION_GROUP_NONE );
traceFilter.SetPassEntity( this ); // Standard pass entity for THIS so that it can be easily removed from the list after passing through a portal
traceFilter.AddEntityToIgnore( info.m_pAdditionalIgnoreEnt );
CShotManipulator Manipulator( info.m_vecDirShooting );
iNumShots = info.m_iShots;
flActualDamage = info.m_flDamage;
if ( flActualDamage == 0.0 )
{
flActualDamage = g_pGameRules->GetAmmoDamage( pAttacker, tr.m_pEnt, info.m_iAmmoType );
}
flActualDamage *= m_fAccuracy; // Pretty much a damage modifier
for (int iShot = 0; iShot < iNumShots; iShot++)
{
//vecDir = info.m_vecDirShooting;
vecDir = Manipulator.ApplySpread( vecSpread );
vecEnd = info.m_vecSrc + vecDir * info.m_flDistance;
AI_TraceLine(info.m_vecSrc, vecEnd, MASK_SHOT, &traceFilter, &tr);
if( unit_debugfirebullets.GetBool() )
{
#ifdef CLIENT_DLL
NDebugOverlay::Line(info.m_vecSrc, vecEnd, 255, 0, 0, 255, 0.1f);
NDebugOverlay::Line(info.m_vecSrc, tr.endpos, 0, 255, 0, 255, 0.1f);
#else
NDebugOverlay::Line(info.m_vecSrc, vecEnd, 255, 255, 0, 255, 0.1f);
NDebugOverlay::Line(info.m_vecSrc, tr.endpos, 0, 255, 255, 255, 0.1f);
#endif // CLIENT_DLL
}
// Make sure given a valid bullet type
if (info.m_iAmmoType == -1)
{
DevMsg("ERROR: Undefined ammo type!\n");
return;
}
Vector vecTracerDest = tr.endpos;
// do damage, paint decals
if (tr.fraction != 1.0)
{
CTakeDamageInfo dmgInfo( pAttacker, pAttacker, flActualDamage, nDamageType );
CalculateBulletDamageForce( &dmgInfo, info.m_iAmmoType, vecDir, tr.endpos );
dmgInfo.ScaleDamageForce( info.m_flDamageForceScale );
dmgInfo.SetAmmoType( info.m_iAmmoType );
(dynamic_cast<CBaseEntity *>(tr.m_pEnt))->DispatchTraceAttack( dmgInfo, vecDir, &tr );
// Effects only, FireBullets should be called on the client.
// Dispatching on the server generates far too many events/data!
#ifdef CLIENT_DLL
DoImpactEffect( tr, nDamageType );
Vector vecTracerSrc = vec3_origin;
ComputeTracerStartPosition( info.m_vecSrc, &vecTracerSrc );
trace_t Tracer;
Tracer = tr;
Tracer.endpos = vecTracerDest;
MakeTracer( vecTracerSrc, Tracer, pAmmoDef->TracerType(info.m_iAmmoType) );
#endif // CLIENT_DLL
}
//.........这里部分代码省略.........