本文整理汇总了C++中IVehicleSeat类的典型用法代码示例。如果您正苦于以下问题:C++ IVehicleSeat类的具体用法?C++ IVehicleSeat怎么用?C++ IVehicleSeat使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IVehicleSeat类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
//------------------------------------------------------------------------
int CVehicleUsableActionEnter::OnEvent(int eventType, SVehicleEventParams& eventParams)
{
if (eventType == eVAE_IsUsable)
{
EntityId& userId = eventParams.entityId;
for (TVehicleSeatIdVector::iterator ite = m_seatIds.begin(), end = m_seatIds.end(); ite != end; ++ite)
{
TVehicleSeatId seatId = *ite;
IVehicleSeat* pSeat = m_pVehicle->GetSeatById(seatId);
if (IsSeatAvailable(pSeat, userId))
{
eventParams.iParam = seatId;
return 1;
}
}
return 0;
}
else if (eventType == eVAE_OnUsed)
{
EntityId& userId = eventParams.entityId;
IVehicleSeat* pSeat = m_pVehicle->GetSeatById(eventParams.iParam);
if (IsSeatAvailable(pSeat, userId))
return pSeat->Enter(userId);
return -1;
}
return 0;
}
示例2: PlaySound
void CHUD::IndicateHit(bool enemyIndicator,IEntity *pEntity, bool explosionFeedback)
{
CPlayer *pPlayer = static_cast<CPlayer *>(gEnv->pGame->GetIGameFramework()->GetClientActor());
if(!pPlayer)
return;
if(explosionFeedback)
PlaySound(ESound_SpecialHitFeedback);
if(!pPlayer->GetLinkedVehicle())
m_pHUDCrosshair->GetFlashAnim()->Invoke("indicateHit");
else
{
IVehicleSeat *pSeat = pPlayer->GetLinkedVehicle()->GetSeatForPassenger(pPlayer->GetEntityId());
if(pSeat && !pSeat->IsDriver())
m_pHUDCrosshair->GetFlashAnim()->Invoke("indicateHit");
else
{
m_pHUDVehicleInterface->m_animMainWindow.Invoke("indicateHit", enemyIndicator);
if(pEntity && !gEnv->bMultiplayer)
{
float r = ((unsigned char) ((g_pGameCVars->hud_colorLine >> 16) & 0xFF)) / 255.0f;
float g = ((unsigned char) ((g_pGameCVars->hud_colorLine >> 8) & 0xFF)) / 255.0f;
float b = ((unsigned char) ((g_pGameCVars->hud_colorLine >> 0) & 0xFF)) / 255.0f;
// It should be useless to test if pEntity is an enemy (it's already done by caller func)
IActor *pActor = gEnv->pGame->GetIGameFramework()->GetIActorSystem()->GetActor(pEntity->GetId());
if(pActor)
m_pHUDSilhouettes->SetSilhouette(pActor,r,g,b,1.0f,5.0f,true);
else if(IVehicle *pVehicle = gEnv->pGame->GetIGameFramework()->GetIVehicleSystem()->GetVehicle(pEntity->GetId()))
m_pHUDSilhouettes->SetSilhouette(pVehicle,r,g,b,1.0f,5.0f);
}
}
}
示例3: LockSeats
void CVTOLVehicleManager::LockSeats(IVehicle* pVehicle, bool lock)
{
EVehicleSeatLockStatus newStatus = lock ? eVSLS_LockedForPlayers : eVSLS_Unlocked;
const int numSeats = pVehicle->GetSeatCount();
for(int i = 1; i <= numSeats; ++i)
{
IVehicleSeat* pSeat = pVehicle->GetSeatById(i);
if(pSeat && pSeat->GetLockedStatus() != eVSLS_Locked)
{
pSeat->SetLocked(newStatus);
}
}
}
示例4: GetVehicle
//------------------------------------------------------------------------
int CScriptBind_Vehicle::EnterVehicle(IFunctionHandler* pH, ScriptHandle actorHandle, int seatId, bool isAnimationEnabled)
{
CVehicle* pVehicle = GetVehicle(pH);
if (!pVehicle || !actorHandle.n)
return pH->EndFunction(0);
IVehicleSeat* pSeat = pVehicle->GetSeatById(seatId);
bool ret = false;
if (pSeat)
ret = pSeat->Enter((EntityId)actorHandle.n, isAnimationEnabled);
return pH->EndFunction(ret);
}
开发者ID:NightOwlsEntertainment,项目名称:PetBox_A_Journey_to_Conquer_Elementary_Algebra,代码行数:16,代码来源:ScriptBind_Vehicle.cpp
示例5: GetVehicle
//------------------------------------------------------------------------
bool CVehicleWeapon::CanZoom() const
{
if (!CWeapon::CanZoom())
return false;
if (!m_bOwnerInSeat)
return false;
IVehicle *pVehicle = GetVehicle();
if(!pVehicle)
return false;
IActor* pActor = GetOwnerActor();
IVehicleSeat* pSeat = pActor ? pVehicle->GetSeatForPassenger(pActor->GetEntityId()) : NULL;
IVehicleView* pView = pSeat ? pSeat->GetCurrentView() : NULL;
if (pView && pView->IsThirdPerson())
return false;
return true;
}
示例6: GetActor
//------------------------------------------------------------------------
int CScriptBind_Actor::IsGhostPit(IFunctionHandler *pH)
{
CActor *pActor = GetActor(pH);
if (!pActor)
return pH->EndFunction();
bool hidden = false;
if (IVehicle* pVehicle = pActor->GetLinkedVehicle())
{
IVehicleSeat* pSeat = pVehicle->GetSeatForPassenger(pActor->GetEntityId());
if (pSeat)
{
if (IVehicleView* pView = pSeat->GetView(pSeat->GetCurrentView()))
hidden = pView->IsPassengerHidden();
}
}
return pH->EndFunction(hidden);
}
示例7: GetOwnerActor
//------------------------------------------------------------------------
bool CVehicleMountedWeapon::CanZoom() const
{
if (!CHeavyMountedWeapon::CanZoom())
return false;
IVehicle *pVehicle = gEnv->pGame->GetIGameFramework()->GetIVehicleSystem()->GetVehicle(m_vehicleId);
if(pVehicle && !IsRippedOff())
{
if (m_pSeatUser != m_pOwnerSeat)
return false;
IActor* pActor = GetOwnerActor();
IVehicleSeat* pSeat = pActor ? pVehicle->GetSeatForPassenger(pActor->GetEntityId()) : NULL;
IVehicleView* pView = pSeat ? pSeat->GetCurrentView() : NULL;
if (pView && pView->IsThirdPerson())
return false;
}
return true;
}
示例8: SetActive
void SetActive(const bool bActive)
{
if (m_bActive == bActive)
return;
m_bActive = bActive;
IVehicle* pVehicle;
pVehicle = gEnv->pGame->GetIGameFramework()->GetIVehicleSystem()->GetVehicle(m_entityId);
if (bActive)
{
CRY_ASSERT(pVehicle);
m_fStartedTime = gEnv->pTimer->GetFrameStartTime().GetSeconds();
m_actInfo.pGraph->SetRegularlyUpdated(m_actInfo.myID, true);
if (pVehicle)
{
pVehicle->RegisterVehicleEventListener(this, "CFlowVehicleDriveForward");
}
ActivateOutput(&m_actInfo, EOP_Started, true);
}
else
{
m_bNeedsCleanup = true; // To ensure event listener gets cleaned up when its safe to do so
if (pVehicle)
{
if (pVehicle->GetSeatCount() != 0) // Restore back
{
IVehicleSeat* pSeat = pVehicle->GetSeatById(1);
if (pSeat)
{
pSeat->SetLocked(m_prevSeatLockStatus);
//pSeat->ExitRemotely();
}
}
}
}
}
示例9: UpdateLight
//-----------------------------------------------------------------------
void CVehiclePartLight::UpdateLight(const float frameTime)
{
if (m_slot == -1)
return;
// move to vehicle event change view?
if (m_diffuseMult[0] != m_diffuseMult[1])
{
SEntitySlotInfo info;
if (m_pVehicle->GetEntity()->GetSlotInfo(m_slot, info) && info.pLight)
{
CDLight& light = info.pLight->GetLightProperties();
IActor* pActor = CCryAction::GetCryAction()->GetClientActor();
bool localPlayer = (pActor != NULL) && (pActor->GetLinkedVehicle() == m_pVehicle);
IVehicleSeat* pSeat = pActor ? m_pVehicle->GetSeatForPassenger(pActor->GetEntityId()) : NULL;
IVehicleView* pView = pSeat? pSeat->GetView(pSeat->GetCurrentView()) : NULL;
bool isThirdPersonView = pView? pView->IsThirdPerson() : true;
if (localPlayer && !isThirdPersonView)
light.SetLightColor(ColorF(m_diffuseCol * m_diffuseMult[0], 1.f));
else
light.SetLightColor(ColorF(m_diffuseCol * m_diffuseMult[1], 1.f));
}
}
if (m_pHelper)
{
const static Matrix33 rot(Matrix33::CreateRotationXYZ(Ang3(0.f, 0.f, DEG2RAD(90.f))));
Matrix34 helperTM;
m_pHelper->GetVehicleTM(helperTM);
Matrix34 localTM = Matrix33(helperTM) * rot;
localTM.SetTranslation(helperTM.GetTranslation());
GetEntity()->SetSlotLocalTM(m_slot, localTM);
}
}
示例10: OccupyWeaponSeats
void CVehicleMovementHelicopter::OccupyWeaponSeats()
{
uint32 seatCount = m_pVehicle->GetSeatCount();
for (uint32 seatId = 1; !(seatId > seatCount); ++seatId)
{
IVehicleSeat *pSeat = m_pVehicle->GetSeatById(seatId);
if (pSeat)
{
IVehicleSeatAction *pWeaponAction = pSeat->GetISeatActionWeapons();
if (pWeaponAction)
{
pWeaponAction->ForceUsage();
}
}
}
m_pVehicle->GetGameObject()->EnableUpdateSlot(m_pVehicle, IVehicle::eVUS_AIControlled);
}
示例11: ProcessEvent
virtual void ProcessEvent(EFlowEvent flowEvent, SActivationInfo* pActivationInfo)
{
if (flowEvent == eFE_Activate && IsPortActive(pActivationInfo, EIP_StartDriving))
{
IEntity* pEntity = pActivationInfo->pEntity;
if(!pEntity)
return;
IVehicle* pVehicle;
pVehicle = gEnv->pGame->GetIGameFramework()->GetIVehicleSystem()->GetVehicle( pEntity->GetId() );
if(!pVehicle || pVehicle->IsDestroyed())
{
return;
}
IVehicleMovement* pMovement = pVehicle->GetMovement();
if (!pMovement)
return;
CVehicleMovementBase* pMovementBase = StaticCast_CVehicleMovementBase(pMovement);
if (!pMovementBase)
return;
IActor* pPlayer = g_pGame->GetIGameFramework()->GetClientActor();
if (!pPlayer)
return;
const EntityId localPlayer = pPlayer->GetEntityId();
if (pVehicle->GetSeatCount() == 0) // Don't need to remotely enter
{
pMovement->StartDriving(localPlayer);
}
else
{
pVehicle->EvictAllPassengers();
IVehicleSeat* pSeat = pVehicle->GetSeatById(1);
if (pSeat)
{
// Can't use remote entering to control otherwise if vehicle blows up, player dies
//pSeat->EnterRemotely(localPlayer);
pMovement->StartDriving(localPlayer);
m_prevSeatLockStatus = pSeat->GetLockedStatus();
pSeat->SetLocked(eVSLS_Locked);
}
}
m_fDuration = GetPortFloat(pActivationInfo, EIP_Time);
m_fSpeed = GetPortFloat(pActivationInfo, EIP_Speed);
m_actInfo = *pActivationInfo;
m_entityId = pEntity->GetId();
SetActive(true);
}
else if (flowEvent == eFE_Update)
{
if (!m_bActive)
{
if (m_bNeedsCleanup)
{
Cleanup();
}
return;
}
IEntity* pEntity = pActivationInfo->pEntity;
if(!pEntity)
{
SetActive(false);
return;
}
IVehicle* pVehicle;
pVehicle = gEnv->pGame->GetIGameFramework()->GetIVehicleSystem()->GetVehicle( pEntity->GetId() );
if(!pVehicle || pVehicle->IsDestroyed())
{
SetActive(false);
return;
}
const float curTime = gEnv->pTimer->GetFrameStartTime().GetSeconds();
if ((curTime - m_fStartedTime) >= m_fDuration)
{
SetActive(false);
ActivateOutput(pActivationInfo, EOP_TimeComplete, true);
}
else // Update every frame
{
IVehicleMovement* pMovement = pVehicle->GetMovement();
if (pMovement)
{
// prevent full pedal being kept pressed, but give it a bit
pMovement->OnAction(eVAI_MoveForward, eAAM_OnPress, 1.0f);
}
}
}
}
示例12: CRY_ASSERT
void CHUDTagNames::DrawTagName(IVehicle *pVehicle)
{
CRY_ASSERT(pVehicle);
if(!pVehicle)
return;
CActor *pClientActor = static_cast<CActor *>(g_pGame->GetIGameFramework()->GetClientActor());
CGameRules *pGameRules = g_pGame->GetGameRules();
int iClientTeam = pGameRules->GetTeam(pClientActor->GetEntityId());
bool bThirdPerson = pClientActor->IsThirdPerson();
bool bDrawSeatTagNames = false;
if(pClientActor->GetSpectatorMode() == CActor::eASM_Follow)
{
IActor *pFollowedActor = g_pGame->GetIGameFramework()->GetIActorSystem()->GetActor(pClientActor->GetSpectatorTarget());
if(pFollowedActor)
bDrawSeatTagNames = (pVehicle == pFollowedActor->GetLinkedVehicle());
}
else
bDrawSeatTagNames = (pVehicle == pClientActor->GetLinkedVehicle());
if(bDrawSeatTagNames)
{
// When this is local player vehicle, we always display all passengers name above their head so that he can identify them
for(int iSeatId=1; iSeatId<=pVehicle->GetLastSeatId(); iSeatId++)
{
IVehicleSeat *pVehicleSeat = pVehicle->GetSeatById(iSeatId);
if(!pVehicleSeat)
continue;
IActor *pActor = g_pGame->GetIGameFramework()->GetIActorSystem()->GetActor(pVehicleSeat->GetPassenger());
if(!pActor || (pActor == pClientActor && !bThirdPerson))
continue;
DrawTagName(pActor,true);
}
return;
}
ColorF rgbTagName = COLOR_ENEMY;
// Driver seat is always 1
IVehicleSeat *pVehicleSeat = pVehicle->GetSeatById(1);
if(!pVehicleSeat)
return;
IVehicleHelper *pVehicleHelper = pVehicleSeat->GetSitHelper();
if(!pVehicleHelper)
return;
Vec3 vWorldPos = pVehicleHelper->GetWorldTM().GetTranslation();
// Add some offset to be above the driver/pilot
vWorldPos.z += 1.2f;
AABB box;
pVehicle->GetEntity()->GetWorldBounds(box);
bool bDrawOnTop = false;
if(ProjectOnSphere(vWorldPos,box))
{
bDrawOnTop = true;
}
m_tagNamesVector.resize(0);
for(int iSeatId=1; iSeatId<=pVehicle->GetLastSeatId(); iSeatId++)
{
IVehicleSeat *pVehicleSeat = pVehicle->GetSeatById(iSeatId);
if(!pVehicleSeat)
continue;
EntityId uiEntityId = pVehicleSeat->GetPassenger();
IActor *pActor = g_pGame->GetIGameFramework()->GetIActorSystem()->GetActor(uiEntityId);
if(!pActor)
continue;
const char *szRank = GetPlayerRank(uiEntityId);
IEntity *pEntity = pActor->GetEntity();
if(!pEntity)
continue;
char szText[HUD_MAX_STRING_SIZE];
if(szRank)
{
sprintf(szText,"%s %s",szRank,pEntity->GetName());
}
else
{
sprintf(szText,"%s",pEntity->GetName());
}
if(0 == iClientTeam)
{
if(uiEntityId && IsFriendlyToClient(uiEntityId))
//.........这里部分代码省略.........
示例13: assert
//------------------------------------------------------------------------
void CVehicleClient::OnAction(IVehicle* pVehicle, EntityId actorId, const ActionId& actionId, int activationMode, float value)
{
assert(pVehicle);
if (!pVehicle)
return;
TActionNameIdMap::const_iterator ite = m_actionNameIds.find(actionId);
if (ite == m_actionNameIds.end())
return;
IVehicleMovement *pMovement = pVehicle->GetMovement();
const bool isAir = pMovement && pMovement->GetMovementType()==IVehicleMovement::eVMT_Air;
IVehicleSeat* pCurrentSeat = pVehicle->GetSeatForPassenger(actorId);
const bool isThirdPerson = pCurrentSeat && pCurrentSeat->GetView(pCurrentSeat->GetCurrentView())->IsThirdPerson();
const bool isDriver = pCurrentSeat && pCurrentSeat->IsDriver();
switch (ite->second)
{
case (eVAI_XIMoveX):
{
if(pMovement && pMovement->GetMovementType() == IVehicleMovement::eVMT_Air)
{
//strafe instead of turning for air vehicles
if(value>0.f)
{
pVehicle->OnAction(eVAI_StrafeRight, eAAM_OnPress, value, actorId);
m_bMovementFlagRight = true;
}
else if(value==0.f)
{
if(m_bMovementFlagRight)
{
pVehicle->OnAction(eVAI_StrafeRight, eAAM_OnRelease, 0.f, actorId);
m_bMovementFlagRight = false;
}
else if(m_bMovementFlagLeft)
{
pVehicle->OnAction(eVAI_StrafeLeft, eAAM_OnRelease, 0.f, actorId);
m_bMovementFlagLeft = false;
}
}
else//value<0
{
pVehicle->OnAction(eVAI_StrafeLeft, eAAM_OnPress, -value, actorId);
m_bMovementFlagLeft = true;
}
}
else
{
if(value>0.f)
{
pVehicle->OnAction(eVAI_TurnRight, eAAM_OnPress, value, actorId);
m_bMovementFlagRight = true;
}
else if(value==0.f)
{
if(m_bMovementFlagRight)
{
pVehicle->OnAction(eVAI_TurnRight, eAAM_OnRelease, 0.f, actorId);
m_bMovementFlagRight = false;
}
else if(m_bMovementFlagLeft)
{
pVehicle->OnAction(eVAI_TurnLeft, eAAM_OnRelease, 0.f, actorId);
m_bMovementFlagLeft = false;
}
}
else//value<0
{
pVehicle->OnAction(eVAI_TurnLeft, eAAM_OnPress, -value, actorId);
m_bMovementFlagLeft = true;
}
}
break;
}
case (eVAI_XIMoveY):
{
EVehicleActionIds eForward = eVAI_MoveForward;
EVehicleActionIds eBack = eVAI_MoveBack;
if(!strcmp("Asian_helicopter",pVehicle->GetEntity()->GetClass()->GetName()))
{
eForward = eVAI_MoveUp;
eBack = eVAI_MoveDown;
}
if(value>0.f)
{
pVehicle->OnAction(eForward, eAAM_OnPress, value, actorId);
m_bMovementFlagForward = true;
}
else if(value==0.f)
{
if(m_bMovementFlagForward)
{
pVehicle->OnAction(eForward, eAAM_OnRelease, 0.f, actorId);
m_bMovementFlagForward = false;
}
else if(m_bMovementFlagBack)
//.........这里部分代码省略.........
示例14: abs
//.........这里部分代码省略.........
explHit.targetId = entity->GetId();
explHit.weaponId = explosionInfo.weaponId;
explHit.shooterId = explosionInfo.shooterId;
explHit.projectileId = explosionInfo.projectileId;
explHit.projectileClassId = explosionInfo.projectileClassId;
uint16 weaponClass = ~uint16(0);
const IEntity* pWeaponEntity = gEnv->pEntitySystem->GetEntity(explosionInfo.weaponId);
if (pWeaponEntity)
{
g_pGame->GetIGameFramework()->GetNetworkSafeClassId(weaponClass, pWeaponEntity->GetClass()->GetName());
}
explHit.weaponClassId = weaponClass;
explHit.material = 0;
explHit.damage = damage;
explHit.type = explosionInfo.type;
explHit.hitViaProxy = explosionInfo.explosionViaProxy;
explHit.dir = dir;
explHit.normal = -dir; //set normal to reverse of direction to avoid backface cull of damage
if (explHit.damage > 0.0f || explosionInfo.damage == 0.f)
{
CActor* pActor = static_cast<CActor*>(pActorSystem->GetActor(entity->GetId()));
if (pActor)
{
const float damageMultiplier = pActor->GetBodyExplosionDamageMultiplier(explHit);
explHit.damage *= damageMultiplier;
// Protect players who are currently shielded
if(pActor->IsPlayer() && static_cast<CPlayer*>(pActor)->ShouldFilterOutExplosion(explHit))
{
explHit.damage = 0.0f;
}
}
else
{
CInteractiveObjectEx* pInteractiveObject = static_cast<CInteractiveObjectEx*>(g_pGame->GetIGameFramework()->QueryGameObjectExtension(entity->GetId(), "InteractiveObjectEx"));
if(pInteractiveObject)
{
pInteractiveObject->OnExploded(explHit.pos);
}
}
if(!explosionInfo.explosionViaProxy)
{
if(pActor)
{
if(!pActor->IsFriendlyEntity(explHit.shooterId))
{
totalDamage += damage;
}
}
else
{
IVehicle* pVehicle = g_pGame->GetIGameFramework()->GetIVehicleSystem()->GetVehicle(entity->GetId());
if(pVehicle)
{
IActor* pDriver = pVehicle->GetDriver();
int seatNum = 0;
int numSeats = pVehicle->GetSeatCount();
while(!pDriver && seatNum < numSeats)
{
IVehicleSeat* pSeat = pVehicle->GetSeatById(seatNum++);
EntityId passengerId = pSeat ? pSeat->GetPassenger(true) : 0;
pDriver = pActorSystem->GetActor(passengerId);
}
if(pDriver)
{
CActor* pDriverActor = static_cast<CActor*>(pDriver);
if(!pDriverActor->IsFriendlyEntity(explHit.shooterId))
{
totalDamage += damage;
}
}
}
}
}
m_pGameRules->ServerHit(explHit);
}
}
}
if (totalDamage > 0.f)
{
IGameRulesPlayerStatsModule* pPlayStatsMod = m_pGameRules->GetPlayerStatsModule();
if(pPlayStatsMod)
{
pPlayStatsMod->ProcessSuccessfulExplosion(explosionInfo.shooterId, totalDamage, explosionInfo.projectileClassId);
}
}
}
示例15: DrawTagName
void CHUDTagNames::Update()
{
CActor *pClientActor = static_cast<CActor *>(g_pGame->GetIGameFramework()->GetClientActor());
CGameRules *pGameRules = g_pGame->GetGameRules();
if(!pClientActor || !pGameRules || !gEnv->bMultiplayer)
return;
int iClientTeam = pGameRules->GetTeam(pClientActor->GetEntityId());
// Skip enemies, they need to be added only when shot
// (except in spectator mode when we display everyone)
for(int iTeam = 0; iTeam < pGameRules->GetTeamCount() + 1; ++iTeam)
{
if((iTeam == iClientTeam) || (pClientActor->GetSpectatorMode() != CActor::eASM_None))
{
int iTeamPlayerCount = pGameRules->GetTeamPlayerCount(iTeam);
for(int iPlayer=0; iPlayer<iTeamPlayerCount; iPlayer++)
{
IActor *pActor = g_pGame->GetIGameFramework()->GetIActorSystem()->GetActor(pGameRules->GetTeamPlayer(iTeam,iPlayer));
if(!pActor)
continue;
// Never display the local player
if(pActor == pClientActor)
continue;
// never display other spectators
if(static_cast<CActor*>(pActor)->GetSpectatorMode() != CActor::eASM_None)
continue;
// never display the name of the player we're spectating (it's shown separately with their current health)
if(pClientActor->GetSpectatorMode() == CActor::eASM_Follow && pClientActor->GetSpectatorTarget() == pActor->GetEntityId())
continue;
DrawTagName(pActor);
}
}
}
IVehicleSystem *pVehicleSystem = gEnv->pGame->GetIGameFramework()->GetIVehicleSystem();
if(!pVehicleSystem)
return;
IVehicleIteratorPtr pVehicleIter = pVehicleSystem->CreateVehicleIterator();
while(IVehicle *pVehicle=pVehicleIter->Next())
{
SVehicleStatus rVehicleStatus = pVehicle->GetStatus();
if(0 == rVehicleStatus.passengerCount)
continue;
// Skip enemy vehicles, they need to be added only when shot (except in spectator mode...)
bool bEnemyVehicle = true;
for(int iSeatId=1; iSeatId<=pVehicle->GetLastSeatId(); iSeatId++)
{
IVehicleSeat *pVehicleSeat = pVehicle->GetSeatById(iSeatId);
if(!pVehicleSeat)
continue;
EntityId uiEntityId = pVehicleSeat->GetPassenger();
if(0 == iClientTeam)
{
if(uiEntityId && IsFriendlyToClient(uiEntityId))
{
bEnemyVehicle = false;
}
}
else if(uiEntityId && pGameRules->GetTeam(uiEntityId) == iClientTeam)
{
bEnemyVehicle = false;
}
}
if(bEnemyVehicle && (pClientActor->GetSpectatorMode() == CActor::eASM_None)) // again, draw enemies in spectator mode
continue;
DrawTagName(pVehicle);
}
// don't need to do any of this if we're in spectator mode - all player names will have been drawn above.
if(pClientActor->GetSpectatorMode() == CActor::eASM_None)
{
for(TEnemyTagNamesList::iterator iter=m_enemyTagNamesList.begin(); iter!=m_enemyTagNamesList.end(); ++iter)
{
SEnemyTagName *pEnemyTagName = &(*iter);
if(gEnv->pTimer->GetAsyncTime().GetSeconds() >= pEnemyTagName->fSpawnTime+((float) g_pGameCVars->hud_mpNamesDuration))
{
// Note: iter=my_list.erase(iter) may not be standard/safe
TEnemyTagNamesList::iterator iterNext = iter;
++iterNext;
m_enemyTagNamesList.erase(iter);
iter = iterNext;
}
else
{
IActor *pActor = g_pGame->GetIGameFramework()->GetIActorSystem()->GetActor(pEnemyTagName->uiEntityId);
if(pActor)
DrawTagName(pActor);
IVehicle *pVehicle = gEnv->pGame->GetIGameFramework()->GetIVehicleSystem()->GetVehicle(pEnemyTagName->uiEntityId);
//.........这里部分代码省略.........