本文整理汇总了C++中CClientInfoMgr::GetClientByID方法的典型用法代码示例。如果您正苦于以下问题:C++ CClientInfoMgr::GetClientByID方法的具体用法?C++ CClientInfoMgr::GetClientByID怎么用?C++ CClientInfoMgr::GetClientByID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CClientInfoMgr
的用法示例。
在下文中一共展示了CClientInfoMgr::GetClientByID方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateMarker
void CBodyFX::UpdateMarker()
{
if (!m_pClientDE || !m_hServerObject) return;
CClientInfoMgr *pClientMgr = g_pInterfaceMgr->GetClientInfoMgr();
if (!pClientMgr) return;
CLIENT_INFO* pLocalInfo = pClientMgr->GetLocalClient();
CLIENT_INFO* pInfo = pClientMgr->GetClientByID(m_bs.nClientId);
if (!pInfo || !pLocalInfo) return;
LTBOOL bSame = (pInfo->team == pLocalInfo->team);
if (bSame)
{
if (m_hMarker)
RemoveMarker();
return;
}
uint32 dwFlags = g_pLTClient->GetObjectFlags(m_hServerObject);
if (!(dwFlags & FLAG_VISIBLE))
{
RemoveMarker();
return;
}
LTVector vU, vR, vF, vTemp, vDims, vPos;
LTRotation rRot;
ILTPhysics* pPhysics = m_pClientDE->Physics();
m_pClientDE->GetObjectPos(m_hServerObject, &vPos);
pPhysics->GetObjectDims(m_hServerObject, &vDims);
vPos.y += (vDims.y + 20.0f);
if (!m_hMarker)
{
CreateMarker(vPos,bSame);
}
if (m_hMarker)
{
m_pClientDE->SetObjectPos(m_hMarker, &vPos);
}
}
示例2: UpdatePlayerID
void CHUDRadar::UpdatePlayerID(HOBJECT hObj, uint32 nId)
{
if (!hObj) return;
CClientInfoMgr* pCIMgr = g_pInterfaceMgr->GetClientInfoMgr();
CLIENT_INFO* pCI = pCIMgr->GetClientByID(nId);
RadarPlayerList::iterator iter = m_Players.begin();
while (iter != m_Players.end() && (*iter)->hObj != hObj )
{
iter++;
}
if (iter != m_Players.end())
{
(*iter)->nID = nId;
if (pCI)
{
(*iter)->pName->SetText(pCI->sName.c_str());
UpdateNamePositions();
}
}
}
示例3: AddPlayer
void CHUDRadar::AddPlayer(HOBJECT hObj, uint32 nId)
{
if (!hObj) return;
CClientInfoMgr* pCIMgr = g_pInterfaceMgr->GetClientInfoMgr();
CLIENT_INFO* pCI = pCIMgr->GetClientByID(nId);
HOBJECT hLocalObj = g_pLTClient->GetClientObject();
uint8 nTeamID = INVALID_TEAM;
// Check for teams and only display players of the same team...
if( IsTeamGameType() && hLocalObj != hObj)
{
CLIENT_INFO *pLocalCI = pCIMgr->GetLocalClient();
if( !pLocalCI || !pCI )
return;
if( pLocalCI->nTeamID != pCI->nTeamID )
return;
nTeamID = pCI->nTeamID;
}
bool bDead = false;
if (hLocalObj != hObj)
{
AddObject( hObj, RADAR_PLAYER_ALIVE_TYPE, nTeamID );
}
CCharacterFX *pCharacter = g_pGameClientShell->GetSFXMgr()->GetCharacterFX(hObj);
if (pCharacter && pCharacter->IsPlayerDead())
{
bDead = true;
}
RadarPlayerList::iterator iter = m_Players.begin();
while (iter != m_Players.end() && ( (*iter)->hObj != hObj ) )
{
iter++;
}
RADAR_PLAYER_OBJ* pPlayer = NULL;
//new player...
if (iter == m_Players.end())
{
pPlayer = debug_new(RADAR_PLAYER_OBJ);
m_Players.push_back(pPlayer);
}
else
{
pPlayer = (*iter);
}
pPlayer->nID = nId;
pPlayer->hObj = hObj;
if (!pPlayer->pName)
{
uint8 nFont = 0;
CUIFont* pFont = g_pInterfaceResMgr->GetFont(nFont);
pPlayer->pName = g_pFontManager->CreateFormattedPolyString(pFont,"",0.0f,0.0f);
pPlayer->pName->SetAlignmentH(CUI_HALIGN_RIGHT);
}
if (pCI)
{
pPlayer->pName->SetText(pCI->sName.c_str());
}
SetPlayerDead(hObj,bDead);
UpdateNamePositions();
}
示例4: Update
//.........这里部分代码省略.........
uint32 dwUserFlags = 0;
g_pCommonLT->GetObjectFlags(m_hTarget, OFT_User, dwUserFlags);
// If we're on a vehicle (or if we are dead) all we care about is other players in a multiplayer game...
// Some vehicles (like the PlayerLure) let you activate, so we'll just check if the
// vehicle will let us show a crosshair to see if we're on a "true" vehicle or not...
// It would be great if we didn't have to do all these checks, but such is life...
bool bPlayersOnly = g_pPlayerMgr->IsPlayerDead() || (g_pPlayerMgr->GetMoveMgr()->GetVehicleMgr()->CanShowCrosshair() ? false : true);
if (!bPlayersOnly)
{
//special case handling for bodies
if (pBody || pCharacter)
{
bool bCanSearch = !!(dwUserFlags & USRFLG_CAN_SEARCH);
if (pBody)
{
if (fDistAway <= g_vtActivationDistance.GetFloat())
{
// Make target glow, so it stands out more...
g_pCommonLT->SetObjectFlags(m_hTarget, OFT_User, USRFLG_GLOW, USRFLG_GLOW);
}
if (pBody->CanBeRevived() && fDistAway <= g_vtReviveDistance.GetFloat() && IsRevivePlayerGameType( ))
{
// Get the client information of the body and us.
uint32 nId = pBody->GetClientId();
CClientInfoMgr* pCIMgr = g_pInterfaceMgr->GetClientInfoMgr();
CLIENT_INFO* pCI = pCIMgr->GetClientByID(nId);
CLIENT_INFO *pLocalCI = g_pInterfaceMgr->GetClientInfoMgr()->GetLocalClient();
// Only allow us to revive people on the same team. For non-team games,
// the teamid will be set to the same invalid value anyway.
if( pCI && pLocalCI )
{
if (pCI->nTeamID == pLocalCI->nTeamID)
{
m_nString = 0;
FormatString(IDS_TARGET_REVIVE, m_szString, ARRAY_LEN(m_szString), pCI->sName.c_str());
LTVector vObjPos, vDims;
g_pLTClient->GetObjectPos(pBody->GetServerObj(), &vObjPos);
g_pPhysicsLT->GetObjectDims(pBody->GetServerObj(), &vDims);
// Players are non-solid to each other so you can revive right on top of them.
m_bCanActivate = true; //!CheckForCharacters(vObjPos, vDims, pBody->GetClientId());
m_bMoveTarget = true;
m_ActivationData.m_nType = MID_ACTIVATE_REVIVE;
}
else
{
m_nString = 0;
m_bCanActivate = false;
m_bMoveTarget = false;
LTStrCpy(m_szString, pCI->sName.c_str(), ARRAY_LEN(m_szString));
}
return;
}
示例5: GenerateCharArray
// ----------------------------------------------------------------------- //
//
// ROUTINE: CAutoTargetMgr::GenerateCharArray()
//
// PURPOSE: Fill array with list of chars sorted by distance
//
// ----------------------------------------------------------------------- //
void CAutoTargetMgr::GenerateCharArray()
{
//clear our target array
m_Targets.resize(0);
CSFXMgr* psfxMgr = g_pGameClientShell->GetSFXMgr();
//step through the chars
CSpecialFXList* const pCharList = psfxMgr->GetFXList(SFX_CHARACTER_ID);
int nNumSFX = pCharList->GetSize();
for (int nChar=0; nChar < nNumSFX; nChar++)
{
CCharacterFX* pChar = (CCharacterFX*)(*pCharList)[nChar];
if (pChar)
{
if (pChar->m_cs.bIsPlayer)
{
//filter out local player
HLOCALOBJ hPlayerObj = g_pLTClient->GetClientObject();
if (hPlayerObj == pChar->GetServerObj())
continue;
if(pChar->IsPlayerDead())
continue;
//if this is a team game filter out our teammates
if (GameModeMgr::Instance( ).m_grbUseTeams )
{
// Get the client information of the body and us.
uint32 nId = pChar->m_cs.nClientID;
CClientInfoMgr* pCIMgr = g_pInterfaceMgr->GetClientInfoMgr();
CLIENT_INFO* pCI = pCIMgr->GetClientByID(nId);
CLIENT_INFO *pLocalCI = g_pInterfaceMgr->GetClientInfoMgr()->GetLocalClient();
// Only allow us to auto-target people on the other team.
if( pCI && pLocalCI )
{
if (pCI->nTeamID == pLocalCI->nTeamID)
continue;
}
}
}
else
{
// Check alignment of non-players
if(pChar->m_cs.eCrosshairPlayerStance != kCharStance_Hate)
continue;
}
//filter out anyone outside the cone
LTVector vTargetPos;
g_pLTClient->GetObjectPos(pChar->GetServerObj(), &vTargetPos);
LTVector vOffset(0.0f,32.0f,0.0f);
// we check both upper and lower parts of the body and if either is in the cone, we're good
if (IsPointInCone( vTargetPos - vOffset) || IsPointInCone( vTargetPos + vOffset) )
{
// we only care about the n closest characters, so...
// if the new one farther away than the n-th one, drop it,
// otherwise drop the n-th one and insert the new one
//step through the chars we already know about...
CharFXArray::iterator iter = m_Targets.begin();
bool bInserted = false;
while (iter != m_Targets.end() && !bInserted)
{
//figure out how far away this one is
CCharacterFX* pTestChar = (CCharacterFX*)(*iter);
LTVector vTestPos;
g_pLTClient->GetObjectPos(pTestChar->GetServerObj(), &vTestPos);
float fTestDistSqr = m_vFirePos.DistSqr(vTestPos);
//if this char is farther away than the one we're inserting
if (fTestDistSqr > m_fRangeSqr)
{
//if our list is full, pop off the last one...
if (m_Targets.size() >= MAX_AUTOTARGET_CHARACTERS)
m_Targets.pop_back();
m_Targets.insert(iter,pChar);
bInserted = true;
}
iter++;
}
//if we haven't inseted it yet, and we have room, add it to the back
if (!bInserted && m_Targets.size() < MAX_AUTOTARGET_CHARACTERS)
m_Targets.push_back(pChar);
}
}
//.........这里部分代码省略.........
示例6: Update
//.........这里部分代码省略.........
CCharacterFX* const pFX = (CCharacterFX*)g_pGameClientShell->GetSFXMgr()->FindSpecialFX(SFX_CHARACTER_ID, m_hTarget);
// All we care about if we're on a vehicle (or if we are dead) is the Multiplayer check below...
if (!bPlayersOnly)
{
//display debug info if we have any
if( pFX && pFX->GetInfoString() && *pFX->GetInfoString() )
{
g_pHUDDebug->SetTargetDebugString(pFX->GetInfoString());
}
else
{
g_pHUDDebug->SetTargetDebugString(L"");
}
// is this a person we can talk to?
if (dwUserFlags & USRFLG_CAN_ACTIVATE)
{
if (fDistAway <= g_vtActivationDistance.GetFloat())
{
// SetTargetStringID(IDS_TARGET_TALK);
return;
}
}
}
// This is the only thing we care about if we're dead or on a vehicle...(we care
// if we're off a vehicle too)
if (IsMultiplayerGameClient() && pFX && pFX->m_cs.bIsPlayer )
{
uint32 nId = pFX->m_cs.nClientID;
CClientInfoMgr* pCIMgr = g_pInterfaceMgr->GetClientInfoMgr();
CLIENT_INFO* pCI = pCIMgr->GetClientByID(nId);
if (pCI)
{
m_szStringID = NULL;
LTStrCpy(m_wszString, pCI->sName.c_str(), LTARRAYSIZE(m_wszString));
if (GameModeMgr::Instance( ).m_grbUseTeams)
{
m_nTargetTeam = pCI->nTeamID;
}
}
return;
}
// All we care about if we're dead or on a vehicle is the Multiplayer check above...
if (!bPlayersOnly)
{
if(pFX)
{
if (fDistAway <= g_vtTargetDistance.GetFloat())
{
// If a nameid was specified for the model display the name...
const char* szNameId = g_pModelsDB->GetModelNameId( pFX->m_cs.hModel );
if( szNameId && (szNameId[0] != '\0') )
{
//SetTargetStringID( nNameId );
return;
}
}
}
}
}
// See if this object is part of the activate object list with it's own string ID's...
if( fDistAway <= g_vtActivationDistance.GetFloat() )
{
const CActivateObjectHandler *pActivateObj = CActivateObjectHandler::FindActivateObject( m_hTarget );
if( pActivateObj )
{
// See whether or not it's disabled
m_bCanActivate = !pActivateObj->m_bDisabled;
// Fetch the proper string from the database depending on the state...
HRECORD hRecord = DATABASE_CATEGORY( Activate ).GetRecordByIndex( pActivateObj->m_nId );
HATTRIBUTE hStates = DATABASE_CATEGORY( Activate ).GETRECORDSTRUCT( hRecord, States );
const char* pszStringID = DATABASE_CATEGORY( Activate ).GETSTRUCTATTRIB( States, hStates, pActivateObj->m_eState, HudText );
if( !LTStrEmpty( pszStringID ) )
{
SetTargetStringID( pszStringID );
}
return;
}
}
// All we care about if we're dead or on a vehicle is the above Multiplayer check...
if (bPlayersOnly)
{
// Didn't see another player in Multiplayer, so we have no target...
ClearTargetInfo();
return;
}
}