本文整理汇总了C++中CClientVehicle::GetGameVehicle方法的典型用法代码示例。如果您正苦于以下问题:C++ CClientVehicle::GetGameVehicle方法的具体用法?C++ CClientVehicle::GetGameVehicle怎么用?C++ CClientVehicle::GetGameVehicle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CClientVehicle
的用法示例。
在下文中一共展示了CClientVehicle::GetGameVehicle方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DoPulse
void CClientVehicleManager::DoPulse ( void )
{
CClientVehicle * pVehicle = NULL;
// Loop through our streamed-in vehicles
vector < CClientVehicle * > cloneList = m_StreamedIn;
vector < CClientVehicle* > ::iterator iter = cloneList.begin ();
for ( ; iter != cloneList.end (); ++iter )
{
pVehicle = *iter;
// We should have a game vehicle here
assert ( pVehicle->GetGameVehicle () );
pVehicle->StreamedInPulse ();
}
}
示例2:
CClientVehicle * CStreamer::GetVehicleFromGameVehicle(IVVehicle * pGameVehicle)
{
// Get the streamed in vehicles list
std::list <CStreamableEntity *> * m_streamedVehicles = &m_streamedElements[ENTITY_TYPE_VEHICLE];
// Loop through the streamed in vehicles list
for(std::list<CStreamableEntity *>::iterator iter = m_streamedVehicles->begin(); iter != m_streamedVehicles->end(); iter++)
{
// Get the vehicle pointer
CClientVehicle * pTestVehicle = reinterpret_cast<CClientVehicle *>(*iter);
// Is this the vehicle we are looking for?
if(pTestVehicle->GetGameVehicle()->GetVehicle() == pGameVehicle)
return pTestVehicle;
}
// No vehicle found
return NULL;
}
示例3: Test
//.........这里部分代码省略.........
//
else if ( strnicmp ( szString, "interr", 6 ) == 0 )
{
if ( pVehicleManager->Count () > 0 )
{
CClientVehicle* pVehicle = *pVehicleManager->IterBegin ();
CVector vecT;
pVehicle->GetRotationDegrees ( vecT );
vecT.fZ = atof ( szString + 7 );
pVehicle->SetTargetRotation ( vecT, TICK_RATE );
g_pCore->ChatPrintf ( "Done %f", false, atof ( szString + 7 ) );
static_cast < CDeathmatchVehicle* > ( pVehicle )->SetIsSyncing ( false );
}
}
else if ( stricmp ( szString, "choke" ) == 0 )
{
g_pClientGame->GetLocalPlayer ()->SetChoking ( true );
}
//
else if ( strnicmp ( szString, "static", 6 ) == 0 )
{
if ( pVehicleManager->Count () > 0 )
{
CClientVehicle* pVehicle = *pVehicleManager->IterBegin ();
pVehicle->GetGameVehicle ()->SetRemap ( atoi ( szString + 7 ) );
g_pCore->ChatPrintf ( "Set %i", false, atoi ( szString + 7 ) );
}
}
//
else if ( strnicmp ( szString, "getmass", 7 ) == 0 )
{
CClientVehicle* pVehicle = pLocal->GetOccupiedVehicle ();
if ( pVehicle )
{
g_pCore->ChatPrintf ( "Mass == %f", false, pVehicle->GetGameVehicle ()->GetMass () );
}
}
else if ( strnicmp ( szString, "setmass", 7 ) == 0 )
{
CClientVehicle* pVehicle = pLocal->GetOccupiedVehicle ();
if ( pVehicle )
{
pVehicle->GetGameVehicle ()->SetMass ( atof ( szString + 8 ) );
g_pCore->ChatPrintf ( "Set mass to %f", false, pVehicle->GetGameVehicle ()->GetMass () );
}
}
//
/*
else if ( strnicmp ( szString, "setmm", 5 ) == 0 )
{
CClientVehicle* pVehicle = pLocal->GetOccupiedVehicle ();
if ( pVehicle )
示例4: DrawDefault
void CNametags::DrawDefault()
{
// Grab the resolution width and height
static float fResWidth = static_cast<float>(g_pCore->GetGraphics()->GetViewportWidth());
static float fResHeight = static_cast<float>(g_pCore->GetGraphics()->GetViewportHeight());
// Got any players that are not local?
if (m_pPlayerManager->Count() <= 1)
return;
list<CClientPlayer*> playerTags;
// Grab the local player
CClientPlayer* pLocalPlayer = m_pPlayerManager->GetLocalPlayer();
if (!pLocalPlayer)
return;
CClientVehicle* pSniperTargetedVehicle = NULL;
CClientPlayer* pSniperTargetedPlayer = NULL;
// Grab our current weapon slot. Use screen center if melee or none
eWeaponSlot eSlot = pLocalPlayer->GetCurrentWeaponSlot();
if (eSlot >= WEAPONSLOT_TYPE_HANDGUN && eSlot <= WEAPONSLOT_TYPE_RIFLE)
{
CVector vecOrigin, vecTarget;
pLocalPlayer->GetShotData(&vecOrigin, &vecTarget);
// Ignore the local player for this
pLocalPlayer->WorldIgnore(true);
// Do the raycast
CColPoint* pColPoint = NULL;
CEntity* pEntity = NULL;
SLineOfSightFlags flags;
flags.bCheckBuildings = true;
flags.bCheckVehicles = true;
flags.bCheckPeds = true;
flags.bCheckObjects = true;
flags.bCheckDummies = true;
flags.bSeeThroughStuff = true;
flags.bIgnoreSomeObjectsForCamera = false;
flags.bShootThroughStuff = true;
g_pGame->GetWorld()->ProcessLineOfSight(&vecOrigin, &vecTarget, &pColPoint, &pEntity, flags);
if (pColPoint)
pColPoint->Destroy();
// Un-ignore the local player
pLocalPlayer->WorldIgnore(false);
// Did we find an entity?
if (pEntity)
{
// Grab the CClientEntity belonging to this game_sa entity
CClientEntity* pClientEntity = reinterpret_cast<CClientEntity*>(pEntity->GetStoredPointer());
if (pClientEntity)
{
// Is it a vehicle? Is it a ped?
eClientEntityType EntityType = pClientEntity->GetType();
switch (EntityType)
{
case CCLIENTVEHICLE:
{
pSniperTargetedVehicle = static_cast<CClientVehicle*>(pClientEntity);
break;
}
case CCLIENTPLAYER:
{
pSniperTargetedPlayer = static_cast<CClientPlayer*>(pClientEntity);
break;
}
default:
break;
}
}
}
}
// Grab the local player vehicle
CClientVehicle* pLocalVehicle = pLocalPlayer->GetOccupiedVehicle();
CVehicle* pLocalGameVehicle = NULL;
if (pLocalVehicle)
pLocalGameVehicle = pLocalVehicle->GetGameVehicle();
CMatrix CameraMatrix;
g_pGame->GetCamera()->GetMatrix(&CameraMatrix);
// Remove collision from our local vehicle (if we have one)
if (pLocalVehicle)
pLocalVehicle->WorldIgnore(true);
// Draw the nametags we need to
CVector vecPlayerPosition;
CClientVehicle* pPlayerVehicle = NULL;
float fDistanceExp;
bool bCollision;
CColPoint* pColPoint = NULL;
CEntity* pGameEntity = NULL;
CClientEntity* pEntity = NULL;
CClientPlayer* pPlayer;
CClientStreamElement* pElement;
//.........这里部分代码省略.........
示例5: Fire
void CClientWeapon::Fire ( bool bServerFire )
{
if ( !m_pWeapon || !m_pObject || ( !IsLocalEntity ( ) && m_pOwner != g_pClientGame->GetLocalPlayer ( ) && bServerFire == false ) ) return;
switch ( m_Type )
{
case WEAPONTYPE_PISTOL:
case WEAPONTYPE_PISTOL_SILENCED:
case WEAPONTYPE_DESERT_EAGLE:
#ifdef SHOTGUN_TEST
case WEAPONTYPE_SHOTGUN:
case WEAPONTYPE_SAWNOFF_SHOTGUN:
case WEAPONTYPE_SPAS12_SHOTGUN:
#endif
case WEAPONTYPE_MICRO_UZI:
case WEAPONTYPE_MP5:
case WEAPONTYPE_AK47:
case WEAPONTYPE_M4:
case WEAPONTYPE_TEC9:
case WEAPONTYPE_COUNTRYRIFLE:
case WEAPONTYPE_SNIPERRIFLE:
case WEAPONTYPE_MINIGUN:
{
CMatrix matOrigin;
GetMatrix ( matOrigin );
CVector vecTarget;
float fDistance = m_pWeaponInfo->GetWeaponRange ();
if ( m_targetType == TARGET_TYPE_ENTITY )
{
if ( m_pTarget )
{
if ( m_pTarget->GetType ( ) == CCLIENTPED || m_pTarget->GetType ( ) == CCLIENTPLAYER )
{
CClientPed * pPed = (CClientPed *) (CClientEntity *) m_pTarget;
pPed->GetBonePosition( m_targetBone, vecTarget );
}
else
{
if ( m_pTarget->GetType() == CCLIENTVEHICLE )
{
if ( m_itargetWheel <= MAX_WHEELS )
{
CClientVehicle * pTarget = (CClientVehicle*)(CClientEntity *)m_pTarget;
vecTarget = pTarget->GetGameVehicle()->GetWheelPosition ( (eWheels)m_itargetWheel );
}
else
m_pTarget->GetPosition( vecTarget );
}
else
m_pTarget->GetPosition( vecTarget );
}
if ( m_weaponConfig.bShootIfTargetOutOfRange == false && (matOrigin.GetPosition() - vecTarget).Length() >= fDistance )
{
return;
}
}
else
{
ResetWeaponTarget ( );
}
}
else if ( m_targetType == TARGET_TYPE_VECTOR )
{
vecTarget = m_vecTarget;
if ( m_weaponConfig.bShootIfTargetOutOfRange == false && (matOrigin.GetPosition() - vecTarget).Length() >= fDistance )
{
return;
}
}
else
{
#ifndef SHOTGUN_TEST
CVector vecFireOffset = *m_pWeaponInfo->GetFireOffset ();
matOrigin = CMatrix( vecFireOffset, m_vecFireRotationNoTarget ) * matOrigin;
#endif
CVector vecDirection ( 1, 0, 0 );
vecDirection *= fDistance;
vecTarget = matOrigin.TransformVector( vecDirection );
}
// Save
short sDamage = m_pWeaponInfo->GetDamagePerHit ( );
float fAccuracy = m_pWeaponInfo->GetAccuracy ( );
float fTargetRange = m_pWeaponInfo->GetTargetRange ( );
float fRange = m_pWeaponInfo->GetWeaponRange ( );
// Set new
m_pWeaponInfo->SetDamagePerHit ( m_pWeaponStat->GetDamagePerHit ( ) );
m_pWeaponInfo->SetAccuracy ( m_pWeaponStat->GetAccuracy ( ) );
m_pWeaponInfo->SetTargetRange ( m_pWeaponStat->GetTargetRange ( ) );
m_pWeaponInfo->SetWeaponRange ( m_pWeaponStat->GetWeaponRange ( ) );
#ifdef SHOTGUN_TEST
CVector vecFireOffset = *m_pWeaponInfo->GetFireOffset ();
CMatrix matTemp = CMatrix( vecFireOffset ) * matOrigin;
#ifdef MARKER_DEBUG
// Process
m_pMarker->SetPosition ( matOrigin.GetPosition() );
//.........这里部分代码省略.........
示例6: Fire
void CClientWeapon::Fire ( void )
{
if ( !m_pWeapon || !m_pObject ) return;
switch ( m_Type )
{
case WEAPONTYPE_PISTOL:
case WEAPONTYPE_PISTOL_SILENCED:
case WEAPONTYPE_DESERT_EAGLE:
#ifdef SHOTGUN_TEST
case WEAPONTYPE_SHOTGUN:
case WEAPONTYPE_SAWNOFF_SHOTGUN:
case WEAPONTYPE_SPAS12_SHOTGUN:
#endif
case WEAPONTYPE_MICRO_UZI:
case WEAPONTYPE_MP5:
case WEAPONTYPE_AK47:
case WEAPONTYPE_M4:
case WEAPONTYPE_TEC9:
case WEAPONTYPE_COUNTRYRIFLE:
case WEAPONTYPE_SNIPERRIFLE:
case WEAPONTYPE_MINIGUN:
{
CVector vecOrigin, vecRotation;
GetPosition ( vecOrigin );
if ( m_pAttachedToEntity )
{
GetRotationRadians ( vecRotation );
}
else
{
GetRotationRadians ( vecRotation );
vecRotation = -vecRotation;
}
CVector vecTarget;
float fDistance = m_pWeaponInfo->GetWeaponRange ();
if ( m_targetType == TARGET_TYPE_ENTITY )
{
if ( m_pTarget )
{
if ( m_pTarget->GetType ( ) == CCLIENTPED || m_pTarget->GetType ( ) == CCLIENTPLAYER )
{
CClientPed * pPed = (CClientPed *) (CClientEntity *) m_pTarget;
pPed->GetBonePosition( m_targetBone, vecTarget );
}
else
{
if ( m_pTarget->GetType() == CCLIENTVEHICLE )
{
if ( m_itargetWheel <= MAX_WHEELS )
{
CClientVehicle * pTarget = (CClientVehicle*)(CClientEntity *)m_pTarget;
vecTarget = pTarget->GetGameVehicle()->GetWheelPosition ( (eWheels)m_itargetWheel );
}
else
m_pTarget->GetPosition( vecTarget );
}
else
m_pTarget->GetPosition( vecTarget );
}
if ( m_weaponConfig.bShootIfTargetOutOfRange == false && (vecOrigin - vecTarget).Length() >= fDistance )
{
return;
}
}
else
{
ResetWeaponTarget ( );
}
}
else if ( m_targetType == TARGET_TYPE_VECTOR )
{
vecTarget = m_vecTarget;
if ( m_weaponConfig.bShootIfTargetOutOfRange == false && (vecOrigin - vecTarget).Length() >= fDistance )
{
return;
}
}
else
{
CVector vecFireOffset = *m_pWeaponInfo->GetFireOffset ();
RotateVector ( vecFireOffset, vecRotation );
#ifndef SHOTGUN_TEST
vecOrigin += vecFireOffset;
#endif
CVector vecDirection ( 1, 0, 0 );
vecDirection *= fDistance;
RotateVector ( vecDirection, vecRotation );
vecTarget = vecOrigin + vecDirection;
}
// Save
short sDamage = m_pWeaponInfo->GetDamagePerHit ( );
float fAccuracy = m_pWeaponInfo->GetAccuracy ( );
float fTargetRange = m_pWeaponInfo->GetTargetRange ( );
//.........这里部分代码省略.........