本文整理汇总了C++中CBaseEntity::GetBaseAnimating方法的典型用法代码示例。如果您正苦于以下问题:C++ CBaseEntity::GetBaseAnimating方法的具体用法?C++ CBaseEntity::GetBaseAnimating怎么用?C++ CBaseEntity::GetBaseAnimating使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBaseEntity
的用法示例。
在下文中一共展示了CBaseEntity::GetBaseAnimating方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: StartCommand
//-----------------------------------------------------------------------------
// Purpose: We're about to run this usercmd for the specified player. We can set up groupinfo and masking here, etc.
// This is the time to examine the usercmd for anything extra. This call happens even if think does not.
// Input : *player -
// *cmd -
//-----------------------------------------------------------------------------
void CPlayerMove::StartCommand( CBasePlayer *player, CUserCmd *cmd )
{
VPROF( "CPlayerMove::StartCommand" );
#if !defined( NO_ENTITY_PREDICTION )
CPredictableId::ResetInstanceCounters();
#endif
player->m_pCurrentCommand = cmd;
CBaseEntity::SetPredictionRandomSeed( cmd );
CBaseEntity::SetPredictionPlayer( player );
#if defined (HL2_DLL)
// pull out backchannel data and move this out
int i;
for (i = 0; i < cmd->entitygroundcontact.Count(); i++)
{
int entindex = cmd->entitygroundcontact[i].entindex;
CBaseEntity *pEntity = CBaseEntity::Instance( engine->PEntityOfEntIndex( entindex) );
if (pEntity)
{
CBaseAnimating *pAnimating = pEntity->GetBaseAnimating();
if (pAnimating)
{
pAnimating->SetIKGroundContactInfo( cmd->entitygroundcontact[i].minheight, cmd->entitygroundcontact[i].maxheight );
}
}
}
#endif
}
示例2: SpawnAllEntities
void SpawnAllEntities( int nEntities, HierarchicalSpawn_t *pSpawnList, bool bActivateEntities )
{
int nEntity;
for (nEntity = 0; nEntity < nEntities; nEntity++)
{
VPROF( "MapEntity_ParseAllEntities_Spawn");
CBaseEntity *pEntity = pSpawnList[nEntity].m_pEntity;
if ( pSpawnList[nEntity].m_pDeferredParent )
{
// UNDONE: Promote this up to the root of this function?
MDLCACHE_CRITICAL_SECTION();
CBaseEntity *pParent = pSpawnList[nEntity].m_pDeferredParent;
int iAttachment = -1;
CBaseAnimating *pAnim = pParent->GetBaseAnimating();
if ( pAnim )
{
iAttachment = pAnim->LookupAttachment(pSpawnList[nEntity].m_pDeferredParentAttachment);
}
pEntity->SetParent( pParent, iAttachment );
}
if ( pEntity )
{
if (DispatchSpawn(pEntity) < 0)
{
for ( int i = nEntity+1; i < nEntities; i++ )
{
// this is a child object that will be deleted now
if ( pSpawnList[i].m_pEntity && pSpawnList[i].m_pEntity->IsMarkedForDeletion() )
{
pSpawnList[i].m_pEntity = NULL;
}
}
// Spawn failed.
gEntList.CleanupDeleteList();
// Remove the entity from the spawn list
pSpawnList[nEntity].m_pEntity = NULL;
}
}
}
if ( bActivateEntities )
{
VPROF( "MapEntity_ParseAllEntities_Activate");
bool bAsyncAnims = mdlcache->SetAsyncLoad( MDLCACHE_ANIMBLOCK, false );
for (nEntity = 0; nEntity < nEntities; nEntity++)
{
CBaseEntity *pEntity = pSpawnList[nEntity].m_pEntity;
if ( pEntity )
{
MDLCACHE_CRITICAL_SECTION();
pEntity->Activate();
}
}
mdlcache->SetAsyncLoad( MDLCACHE_ANIMBLOCK, bAsyncAnims );
}
}
示例3: InputDissolve
//-----------------------------------------------------------------------------
// Purpose:
// Input : inputdata -
//-----------------------------------------------------------------------------
void CEntityDissolve::InputDissolve( inputdata_t &inputdata )
{
string_t strTarget = inputdata.value.StringID();
if (strTarget == NULL_STRING)
{
strTarget = m_target;
}
CBaseEntity *pTarget = NULL;
while ((pTarget = gEntList.FindEntityGeneric(pTarget, STRING(strTarget), this, inputdata.pActivator)) != NULL)
{
CBaseAnimating *pBaseAnim = pTarget->GetBaseAnimating();
if (pBaseAnim)
{
pBaseAnim->Dissolve( NULL, gpGlobals->curtime, false, m_nDissolveType, GetAbsOrigin(), m_nMagnitude );
}
}
}
示例4: PropBreakableCreateAll
void PropBreakableCreateAll( int modelindex, IPhysicsObject *pPhysics, const breakablepropparams_t ¶ms, CBaseEntity *pEntity, int iPrecomputedBreakableCount, bool bIgnoreGibLimit, bool defaultLocation )
{
// Check for prop breakable count reset.
int nPropCount = props_break_max_pieces_perframe.GetInt();
if ( nPropCount != -1 )
{
if ( nFrameNumber != gpGlobals->framecount )
{
nPropBreakablesPerFrameCount = 0;
nFrameNumber = gpGlobals->framecount;
}
// Check for max breakable count for the frame.
if ( nPropBreakablesPerFrameCount >= nPropCount )
return;
}
int iMaxBreakCount = bIgnoreGibLimit ? -1 : props_break_max_pieces.GetInt();
if ( iMaxBreakCount != -1 )
{
if ( iPrecomputedBreakableCount != -1 )
{
iPrecomputedBreakableCount = MIN( iMaxBreakCount, iPrecomputedBreakableCount );
}
else
{
iPrecomputedBreakableCount = iMaxBreakCount;
}
}
#ifdef GAME_DLL
// On server limit break model creation
if ( !PropBreakableCapEdictsOnCreateAll(modelindex, pPhysics, params, pEntity, iPrecomputedBreakableCount ) )
{
DevMsg( "Failed to create PropBreakable: would exceed MAX_EDICTS\n" );
return;
}
#endif
vcollide_t *pCollide = modelinfo->GetVCollide( modelindex );
if ( !pCollide )
return;
int nSkin = 0;
CBaseEntity *pOwnerEntity = pEntity;
CBaseAnimating *pOwnerAnim = NULL;
if ( pPhysics )
{
pOwnerEntity = static_cast<CBaseEntity *>(pPhysics->GetGameData());
}
if ( pOwnerEntity )
{
pOwnerAnim = pOwnerEntity->GetBaseAnimating();
if ( pOwnerAnim )
{
nSkin = pOwnerAnim->m_nSkin;
}
}
matrix3x4_t localToWorld;
CStudioHdr studioHdr;
const model_t *model = modelinfo->GetModel( modelindex );
if ( model )
{
studioHdr.Init( modelinfo->GetStudiomodel( model ) );
}
Vector parentOrigin = vec3_origin;
int parentAttachment = Studio_FindAttachment( &studioHdr, "placementOrigin" ) + 1;
if ( parentAttachment > 0 )
{
GetAttachmentLocalSpace( &studioHdr, parentAttachment-1, localToWorld );
MatrixGetColumn( localToWorld, 3, parentOrigin );
}
else
{
AngleMatrix( vec3_angle, localToWorld );
}
CUtlVector<breakmodel_t> list;
BreakModelList( list, modelindex, params.defBurstScale, params.defCollisionGroup );
if ( list.Count() )
{
for ( int i = 0; i < list.Count(); i++ )
{
int modelIndex = modelinfo->GetModelIndex( list[i].modelName );
if ( modelIndex <= 0 )
continue;
// Skip multiplayer pieces that should be spawning on the other dll
#ifdef GAME_DLL
if ( gpGlobals->maxClients > 1 && breakable_multiplayer.GetBool() )
#else
if ( gpGlobals->maxClients > 1 )
#endif
{
#ifdef GAME_DLL
if ( list[i].mpBreakMode == MULTIPLAYER_BREAK_CLIENTSIDE )
//.........这里部分代码省略.........
示例5: IsPointInControllingObjectHitBox
bool CParticleSystemQuery::IsPointInControllingObjectHitBox(
CParticleCollection *pParticles,
int nControlPointNumber, Vector vecPos, bool bBBoxOnly )
{
bool bSuccess = false;
#ifndef GAME_DLL
EHANDLE *phMoveParent = reinterpret_cast<EHANDLE *> ( pParticles->m_ControlPoints[nControlPointNumber].m_pObject );
CBaseEntity *pMoveParent = NULL;
if ( phMoveParent )
{
pMoveParent = *( phMoveParent );
}
if ( pMoveParent )
{
s_BoneMutex.Lock();
C_BaseAnimating *pAnimating = pMoveParent->GetBaseAnimating();
bool bInBBox = false;
Vector vecBBoxMin;
Vector vecBBoxMax;
Vector vecOrigin;
vecBBoxMin = pMoveParent->CollisionProp()->OBBMins();
vecBBoxMax = pMoveParent->CollisionProp()->OBBMaxs();
matrix3x4_t matOrientation;
matOrientation = pMoveParent->EntityToWorldTransform();
Vector vecLocalPos;
VectorITransform( vecPos, matOrientation, vecLocalPos );
if ( IsPointInBox( vecLocalPos, vecBBoxMin, vecBBoxMax ) )
bInBBox = true;
if ( bInBBox && bBBoxOnly )
bSuccess = true;
else if ( pAnimating && bInBBox )
{
matrix3x4_t *hitboxbones[MAXSTUDIOBONES];
if ( pAnimating->HitboxToWorldTransforms( hitboxbones ) )
{
studiohdr_t *pStudioHdr = modelinfo->GetStudiomodel( pAnimating->GetModel() );
if ( pStudioHdr )
{
mstudiohitboxset_t *set = pStudioHdr->pHitboxSet( pAnimating->GetHitboxSet() );
if ( set )
{
// do a point in solid test
Ray_t ray;
trace_t tr;
ray.Init( vecPos, vecPos );
enginetrace->ClipRayToEntity( ray, MASK_ALL, pMoveParent, &tr );
if ( tr.startsolid )
bSuccess = true;
}
}
}
}
else if ( pMoveParent->IsBrushModel() && bInBBox )
{
// do a point in solid test
Ray_t ray;
trace_t tr;
ray.Init( vecPos, vecPos );
enginetrace->ClipRayToEntity( ray, MASK_ALL, pMoveParent, &tr );
if ( tr.startsolid )
bSuccess = true;
}
s_BoneMutex.Unlock();
}
#endif
return bSuccess;
}
示例6: GetControllingObjectHitBoxInfo
int CParticleSystemQuery::GetControllingObjectHitBoxInfo(
CParticleCollection *pParticles,
int nControlPointNumber,
int nBufSize, // # of output slots available
ModelHitBoxInfo_t *pHitBoxOutputBuffer )
{
int nRet = 0;
#ifndef GAME_DLL
s_BoneMutex.Lock();
EHANDLE *phMoveParent = reinterpret_cast<EHANDLE *> ( pParticles->m_ControlPoints[nControlPointNumber].m_pObject );
CBaseEntity *pMoveParent = NULL;
if ( phMoveParent )
{
pMoveParent = *( phMoveParent );
}
if ( pMoveParent )
{
C_BaseAnimating *pAnimating = pMoveParent->GetBaseAnimating();
if ( pAnimating )
{
matrix3x4_t *hitboxbones[MAXSTUDIOBONES];
if ( pAnimating->HitboxToWorldTransforms( hitboxbones ) )
{
studiohdr_t *pStudioHdr = modelinfo->GetStudiomodel( pAnimating->GetModel() );
if ( pStudioHdr )
{
mstudiohitboxset_t *set = pStudioHdr->pHitboxSet( pAnimating->GetHitboxSet() );
if ( set )
{
nRet = min( nBufSize, set->numhitboxes );
for( int i=0 ; i < nRet; i++ )
{
mstudiobbox_t *pBox = set->pHitbox( i );
pHitBoxOutputBuffer[i].m_vecBoxMins.x = pBox->bbmin.x;
pHitBoxOutputBuffer[i].m_vecBoxMins.y = pBox->bbmin.y;
pHitBoxOutputBuffer[i].m_vecBoxMins.z = pBox->bbmin.z;
pHitBoxOutputBuffer[i].m_vecBoxMaxes.x = pBox->bbmax.x;
pHitBoxOutputBuffer[i].m_vecBoxMaxes.y = pBox->bbmax.y;
pHitBoxOutputBuffer[i].m_vecBoxMaxes.z = pBox->bbmax.z;
pHitBoxOutputBuffer[i].m_Transform = *hitboxbones[pBox->bone];
}
}
}
}
}
if ( pMoveParent->IsBrushModel() )
{
Vector vecMin;
Vector vecMax;
matrix3x4_t matOrientation;
pMoveParent->GetRenderBounds( vecMin, vecMax );
matOrientation = pMoveParent->EntityToWorldTransform();
pHitBoxOutputBuffer[0].m_vecBoxMins = vecMin;
pHitBoxOutputBuffer[0].m_vecBoxMaxes = vecMax;
pHitBoxOutputBuffer[0].m_Transform = matOrientation;
nRet = 1;
}
}
s_BoneMutex.Unlock();
#endif
return nRet;
}
示例7: GetRandomPointsOnControllingObjectHitBox
void CParticleSystemQuery::GetRandomPointsOnControllingObjectHitBox(
CParticleCollection *pParticles,
int nControlPointNumber,
int nNumPtsOut,
float flBBoxScale,
int nNumTrysToGetAPointInsideTheModel,
Vector *pPntsOut,
Vector vecDirectionalBias,
Vector *pHitBoxRelativeCoordOut,
int *pHitBoxIndexOut
)
{
bool bSucesss = false;
#ifndef GAME_DLL
EHANDLE *phMoveParent = reinterpret_cast<EHANDLE *> ( pParticles->m_ControlPoints[nControlPointNumber].m_pObject );
CBaseEntity *pMoveParent = NULL;
if ( phMoveParent )
{
pMoveParent = *( phMoveParent );
}
if ( pMoveParent )
{
float flRandMax = flBBoxScale;
float flRandMin = 1.0 - flBBoxScale;
Vector vecBasePos;
pParticles->GetControlPointAtTime( nControlPointNumber, pParticles->m_flCurTime, &vecBasePos );
s_BoneMutex.Lock();
C_BaseAnimating *pAnimating = pMoveParent->GetBaseAnimating();
if ( pAnimating )
{
matrix3x4_t *hitboxbones[MAXSTUDIOBONES];
if ( pAnimating->HitboxToWorldTransforms( hitboxbones ) )
{
studiohdr_t *pStudioHdr = modelinfo->GetStudiomodel( pAnimating->GetModel() );
if ( pStudioHdr )
{
mstudiohitboxset_t *set = pStudioHdr->pHitboxSet( pAnimating->GetHitboxSet() );
if ( set )
{
bSucesss = true;
Vector vecWorldPosition;
float u = 0, v = 0, w = 0;
int nHitbox = 0;
int nNumIters = nNumTrysToGetAPointInsideTheModel;
if (! vecDirectionalBias.IsZero( 0.0001 ) )
nNumIters = max( nNumIters, 5 );
for( int i=0 ; i < nNumPtsOut; i++)
{
int nTryCnt = nNumIters;
float flBestPointGoodness = -1.0e20;
do
{
int nTryHitbox = pParticles->RandomInt( 0, set->numhitboxes - 1 );
mstudiobbox_t *pBox = set->pHitbox(nTryHitbox);
float flTryU = pParticles->RandomFloat( flRandMin, flRandMax );
float flTryV = pParticles->RandomFloat( flRandMin, flRandMax );
float flTryW = pParticles->RandomFloat( flRandMin, flRandMax );
Vector vecLocalPosition;
vecLocalPosition.x = GetSurfaceCoord( flTryU, pBox->bbmin.x, pBox->bbmax.x );
vecLocalPosition.y = GetSurfaceCoord( flTryV, pBox->bbmin.y, pBox->bbmax.y );
vecLocalPosition.z = GetSurfaceCoord( flTryW, pBox->bbmin.z, pBox->bbmax.z );
Vector vecTryWorldPosition;
VectorTransform( vecLocalPosition, *hitboxbones[pBox->bone], vecTryWorldPosition );
float flPointGoodness = pParticles->RandomFloat( 0, 72 )
+ DotProduct( vecTryWorldPosition - vecBasePos,
vecDirectionalBias );
if ( nNumTrysToGetAPointInsideTheModel )
{
// do a point in solid test
Ray_t ray;
trace_t tr;
ray.Init( vecTryWorldPosition, vecTryWorldPosition );
enginetrace->ClipRayToEntity( ray, MASK_ALL, pMoveParent, &tr );
if ( tr.startsolid )
flPointGoodness += 1000.; // got a point inside!
}
if ( flPointGoodness > flBestPointGoodness )
{
u = flTryU;
v = flTryV;
w = flTryW;
//.........这里部分代码省略.........
示例8: FireBullet
//.........这里部分代码省略.........
if( bDoEffects )
{
// See if the bullet ended up underwater + started out of the water
if ( enginetrace->GetPointContents( tr.endpos ) & (CONTENTS_WATER|CONTENTS_SLIME) )
{
trace_t waterTrace;
UTIL_TraceLine( vecSrc, tr.endpos, (MASK_SHOT|CONTENTS_WATER|CONTENTS_SLIME), pIgnore, COLLISION_GROUP_NONE, &waterTrace );
if( waterTrace.allsolid != 1 )
{
CEffectData data;
data.m_vOrigin = waterTrace.endpos;
data.m_vNormal = waterTrace.plane.normal;
data.m_flScale = random->RandomFloat( 8, 12 );
if ( waterTrace.contents & CONTENTS_SLIME )
{
data.m_fFlags |= FX_WATER_IN_SLIME;
}
DispatchEffect( "gunshotsplash", data );
}
}
else
{
//Do Regular hit effects
// Don't decal nodraw surfaces
if ( !( tr.surface.flags & (SURF_SKY|SURF_NODRAW|SURF_HINT|SURF_SKIP) ) )
{
CBaseEntity *pEntity = tr.m_pEnt;
//Tony; only while using teams do we check for friendly fire.
if ( pEntity && pEntity->IsPlayer() && (pEntity->GetBaseAnimating() && !pEntity->GetBaseAnimating()->IsRagdoll()) )
{
#if defined ( SDK_USE_TEAMS )
if ( pEntity->GetTeamNumber() == GetTeamNumber() )
{
if ( !friendlyfire.GetBool() )
UTIL_ImpactTrace( &tr, iDamageType );
}
#else
UTIL_ImpactTrace( &tr, iDamageType );
#endif
}
//Tony; non player, just go nuts,
else
{
UTIL_ImpactTrace( &tr, iDamageType );
}
}
}
} // bDoEffects
// add damage to entity that we hit
#ifdef GAME_DLL
float flBulletDamage = iDamage * flDistanceMultiplier / (i+1); // Each iteration the bullet drops in strength
ClearMultiDamage();
CTakeDamageInfo info( pevAttacker, pevAttacker, flBulletDamage, iDamageType );
CalculateBulletDamageForce( &info, iBulletType, vecDir, tr.endpos );
tr.m_pEnt->DispatchTraceAttack( info, vecDir, &tr );
TraceAttackToTriggers( info, tr.startpos, tr.endpos, vecDir );
示例9: GetControllingObjectHitBoxInfo
int CParticleSystemQuery::GetControllingObjectHitBoxInfo(
CParticleCollection *pParticles,
int nControlPointNumber,
int nBufSize, // # of output slots available
ModelHitBoxInfo_t *pHitBoxOutputBuffer )
{
int nRet = 0;
#ifndef GAME_DLL
s_BoneMutex.Lock();
EHANDLE *phMoveParent = reinterpret_cast<EHANDLE *> ( pParticles->ControlPoint( nControlPointNumber ).m_pObject );
CBaseEntity *pMoveParent = NULL;
if ( phMoveParent )
{
pMoveParent = *( phMoveParent );
}
if ( pMoveParent )
{
C_BaseAnimating *pAnimating = pMoveParent->GetBaseAnimating();
if ( pAnimating )
{
matrix3x4_t *hitboxbones[MAXSTUDIOBONES];
if ( pAnimating->HitboxToWorldTransforms( hitboxbones ) )
{
studiohdr_t *pStudioHdr = modelinfo->GetStudiomodel( pAnimating->GetModel() );
if ( pStudioHdr )
{
// Try to get the "effects" set first, otherwise use their current set
int nEffectsHitboxSet = FindHitboxSetByName( pAnimating->GetModelPtr(), "effects" );
mstudiohitboxset_t *set = pStudioHdr->pHitboxSet( nEffectsHitboxSet != -1 ? nEffectsHitboxSet : pAnimating->GetHitboxSet() );
if ( set )
{
for( int i=0 ; i < set->numhitboxes; i++ )
{
mstudiobbox_t *pBox = set->pHitbox( i );
// E3 HACK - check for hitboxes at the origin and ignore those
if ( fabs( (*hitboxbones[pBox->bone])[0][3] ) < POINT_AT_ORIGIN_EPSILON && fabs( (*hitboxbones[pBox->bone])[1][3] ) < POINT_AT_ORIGIN_EPSILON && fabs( (*hitboxbones[pBox->bone])[2][3] ) < POINT_AT_ORIGIN_EPSILON )
{
continue;
}
pHitBoxOutputBuffer[nRet].m_vecBoxMins.x = pBox->bbmin.x;
pHitBoxOutputBuffer[nRet].m_vecBoxMins.y = pBox->bbmin.y;
pHitBoxOutputBuffer[nRet].m_vecBoxMins.z = pBox->bbmin.z;
pHitBoxOutputBuffer[nRet].m_vecBoxMaxes.x = pBox->bbmax.x;
pHitBoxOutputBuffer[nRet].m_vecBoxMaxes.y = pBox->bbmax.y;
pHitBoxOutputBuffer[nRet].m_vecBoxMaxes.z = pBox->bbmax.z;
pHitBoxOutputBuffer[nRet].m_Transform = *hitboxbones[pBox->bone];
nRet++;
if ( nRet >= nBufSize )
{
break;
}
}
}
}
}
}
if ( pMoveParent->IsBrushModel() )
{
Vector vecMin;
Vector vecMax;
matrix3x4_t matOrientation;
pMoveParent->GetRenderBounds( vecMin, vecMax );
matOrientation = pMoveParent->EntityToWorldTransform();
pHitBoxOutputBuffer[0].m_vecBoxMins = vecMin;
pHitBoxOutputBuffer[0].m_vecBoxMaxes = vecMax;
pHitBoxOutputBuffer[0].m_Transform = matOrientation;
nRet = 1;
}
}
s_BoneMutex.Unlock();
#endif
return nRet;
}
示例10: FireBullet
//.........这里部分代码省略.........
return; // we didn't hit anything, stop tracing shoot
if ( sv_showimpacts.GetBool() )
{
#ifdef CLIENT_DLL
// draw red client impact markers
debugoverlay->AddBoxOverlay( tr.endpos, Vector(-2,-2,-2), Vector(2,2,2), QAngle( 0, 0, 0), 255,0,0,127, 4 );
if ( tr.m_pEnt && tr.m_pEnt->IsPlayer() )
{
C_BasePlayer *player = ToBasePlayer( tr.m_pEnt );
player->DrawClientHitboxes( 4, true );
}
#else
// draw blue server impact markers
NDebugOverlay::Box( tr.endpos, Vector(-2,-2,-2), Vector(2,2,2), 0,0,255,127, 4 );
if ( tr.m_pEnt && tr.m_pEnt->IsPlayer() )
{
CBasePlayer *player = ToBasePlayer( tr.m_pEnt );
player->DrawServerHitboxes( 4, true );
}
#endif
}
//calculate the damage based on the distance the bullet travelled.
flCurrentDistance += tr.fraction * flMaxRange;
// damage get weaker of distance
fCurrentDamage *= pow ( 0.85f, (flCurrentDistance / 500));
int iDamageType = DMG_BULLET | DMG_NEVERGIB;
if( bDoEffects )
{
// See if the bullet ended up underwater + started out of the water
if ( enginetrace->GetPointContents( tr.endpos ) & (CONTENTS_WATER|CONTENTS_SLIME) )
{
trace_t waterTrace;
UTIL_TraceLine( vecSrc, tr.endpos, (MASK_SHOT|CONTENTS_WATER|CONTENTS_SLIME), this, COLLISION_GROUP_NONE, &waterTrace );
if( waterTrace.allsolid != 1 )
{
CEffectData data;
data.m_vOrigin = waterTrace.endpos;
data.m_vNormal = waterTrace.plane.normal;
data.m_flScale = random->RandomFloat( 8, 12 );
if ( waterTrace.contents & CONTENTS_SLIME )
{
data.m_fFlags |= FX_WATER_IN_SLIME;
}
DispatchEffect( "gunshotsplash", data );
}
}
else
{
//Do Regular hit effects
// Don't decal nodraw surfaces
if ( !( tr.surface.flags & (SURF_SKY|SURF_NODRAW|SURF_HINT|SURF_SKIP) ) )
{
CBaseEntity *pEntity = tr.m_pEnt;
//Tony; only while using teams do we check for friendly fire.
if ( pEntity && pEntity->IsPlayer() && (pEntity->GetBaseAnimating() && !pEntity->GetBaseAnimating()->IsRagdoll()) )
{
#if defined ( SDK_USE_TEAMS )
if ( pEntity->GetTeamNumber() == GetTeamNumber() )
{
if ( !friendlyfire.GetBool() )
UTIL_ImpactTrace( &tr, iDamageType );
}
#else
UTIL_ImpactTrace( &tr, iDamageType );
#endif
}
//Tony; non player, just go nuts,
else
{
UTIL_ImpactTrace( &tr, iDamageType );
}
}
}
} // bDoEffects
// add damage to entity that we hit
#ifdef GAME_DLL
ClearMultiDamage();
CTakeDamageInfo info( pevAttacker, pevAttacker, fCurrentDamage, iDamageType );
CalculateBulletDamageForce( &info, iBulletType, vecDir, tr.endpos );
tr.m_pEnt->DispatchTraceAttack( info, vecDir, &tr );
TraceAttackToTriggers( info, tr.startpos, tr.endpos, vecDir );
ApplyMultiDamage();
#endif
}
示例11: SimulateBullet
//.........这里部分代码省略.........
if ( enginetrace->GetPointContents( tr.endpos ) & (CONTENTS_WATER|CONTENTS_SLIME) )
{
CBaseEntity* pIgnore;
if (oBullet.m_ahObjectsHit.Count())
pIgnore = oBullet.m_ahObjectsHit.Tail();
else
pIgnore = oBullet.m_hShooter;
trace_t waterTrace;
UTIL_TraceLine( oBullet.m_vecOrigin, tr.endpos, (MASK_SHOT|CONTENTS_WATER|CONTENTS_SLIME), pIgnore, COLLISION_GROUP_NONE, &waterTrace );
if( waterTrace.allsolid != 1 )
{
CEffectData data;
data.m_vOrigin = waterTrace.endpos;
data.m_vNormal = waterTrace.plane.normal;
data.m_flScale = random->RandomFloat( 8, 12 );
if ( waterTrace.contents & CONTENTS_SLIME )
data.m_fFlags |= FX_WATER_IN_SLIME;
DispatchEffect( "gunshotsplash", data );
}
}
else
{
//Do Regular hit effects
// Don't decal nodraw surfaces
if ( !( tr.surface.flags & (SURF_SKY|SURF_NODRAW|SURF_HINT|SURF_SKIP) ) )
{
CBaseEntity *pEntity = tr.m_pEnt;
//Tony; only while using teams do we check for friendly fire.
if ( DAGameRules()->IsTeamplay() && pEntity && pEntity->IsPlayer() && (pEntity->GetBaseAnimating() && !pEntity->GetBaseAnimating()->IsRagdoll()) )
{
if ( pEntity->GetTeamNumber() != oBullet.m_hShooter->GetTeamNumber() )
UTIL_ImpactTrace( &tr, iDamageType );
}
//Tony; non player, just go nuts,
else
UTIL_ImpactTrace( &tr, iDamageType );
}
}
} // bDoEffects
// add damage to entity that we hit
#ifdef GAME_DLL
float flBulletDamage = oBullet.m_iBulletDamage * flDistanceMultiplier / (i+1); // Each iteration the bullet drops in strength
if (oBullet.m_hShooter->IsStyleSkillActive(SKILL_MARKSMAN))
flBulletDamage = oBullet.m_iBulletDamage * flDistanceMultiplier / (i/2+1); // Each iteration the bullet drops in strength but not nearly as much.
ClearMultiDamage();
CTakeDamageInfo info( oBullet.m_hShooter, oBullet.m_hShooter, oBullet.m_hWeapon, flBulletDamage, iDamageType );
CalculateBulletDamageForce( &info, oBullet.m_iBulletType, oBullet.m_vecDirection, tr.endpos );
tr.m_pEnt->DispatchTraceAttack( info, oBullet.m_vecDirection, &tr );
oBullet.m_hShooter->TraceAttackToTriggers( info, tr.startpos, tr.endpos, oBullet.m_vecDirection );
ApplyMultiDamage();
#else
flDistanceMultiplier = flDistanceMultiplier; // Silence warning.
#endif
if (tr.m_pEnt && !FStrEq(tr.m_pEnt->GetClassname(), "worldspawn"))