本文整理汇总了C++中CClientPlayer::GetLastNametagShow方法的典型用法代码示例。如果您正苦于以下问题:C++ CClientPlayer::GetLastNametagShow方法的具体用法?C++ CClientPlayer::GetLastNametagShow怎么用?C++ CClientPlayer::GetLastNametagShow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CClientPlayer
的用法示例。
在下文中一共展示了CClientPlayer::GetLastNametagShow方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawFromAim
//.........这里部分代码省略.........
flags.bCheckDummies = true;
flags.bSeeThroughStuff = true;
flags.bIgnoreSomeObjectsForCamera = false;
flags.bShootThroughStuff = true;
g_pGame->GetWorld()->ProcessLineOfSight(&vecStart, &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();
if (EntityType == CCLIENTVEHICLE)
{
CClientVehicle* pClientVehicle = static_cast<CClientVehicle*>(pClientEntity);
// Set the current time as the last draw time for all players inside
CClientPed* pPed;
int i;
for (i = 0; i < 8; i++)
{
// Grab this seat's occupant and set its last nametag show time to now
pPed = pClientVehicle->GetOccupant(i);
if (pPed && pPed->GetType() == CCLIENTPLAYER)
{
static_cast<CClientPlayer*>(pPed)->SetLastNametagShow(ulCurrentTime);
}
}
}
else if (EntityType == CCLIENTPLAYER)
{
// Grab the player this entity is
CClientPlayer* pClientPlayer = static_cast<CClientPlayer*>(pClientEntity);
if (pClientPlayer)
{
// Set now as the last time we had the cursor above him
pClientPlayer->SetLastNametagShow(ulCurrentTime);
}
}
}
}
// Grab the local player vehicle
CClientVehicle* pLocalVehicle = pLocalPlayer->GetOccupiedVehicle();
// Draw the nametags we need to
CClientPlayer* pPlayer;
CClientStreamElement* pElement;
list<CClientStreamElement*>::const_iterator iter = m_pPlayerStreamer->ActiveElementsBegin();
for (; iter != m_pPlayerStreamer->ActiveElementsEnd(); ++iter)
{
pElement = *iter;
if (!pElement->IsStreamedIn())
continue;
if (pElement->GetType() != CCLIENTPLAYER)
continue;
pPlayer = static_cast<CClientPlayer*>(pElement);
if (pPlayer->IsLocalPlayer())
continue;
// Is he in the same vehicle as the local player?
if (pLocalVehicle && pPlayer->GetOccupiedVehicle() == pLocalVehicle)
{
pPlayer->SetLastNametagShow(ulCurrentTime);
}
// Can we show this player's nametag
unsigned long ulLastNametagShow = pPlayer->GetLastNametagShow();
if (ulLastNametagShow != 0 && ulCurrentTime <= ulLastNametagShow + NAMETAG_END_FADE_TIME)
{
unsigned long ulLastNametagShow = pPlayer->GetLastNametagShow();
// Calculate the alpha modifier
float fAlphaTimeModifier;
if (ulCurrentTime < ulLastNametagShow + NAMETAG_BEGIN_FADE_TIME)
{
fAlphaTimeModifier = 1.0f;
}
else
{
fAlphaTimeModifier = 1.0f - (ulCurrentTime - ulLastNametagShow - NAMETAG_BEGIN_FADE_TIME) / 1000.0f;
}
// Calculate the alpha for the nametag
unsigned char ucAlpha = static_cast<unsigned char>(180.0f * fAlphaTimeModifier);
// Draw it
DrawTagForPlayer(pPlayer, ucAlpha);
}
}
}
}
}