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); } }
void CHUDRadar::UpdateNamePositions() { float fx = (float)(m_NamePos.x) * g_pInterfaceResMgr->GetXRatio(); float fy = (float)(m_NamePos.y) * g_pInterfaceResMgr->GetYRatio(); if( IsTeamGameType() ) { CClientInfoMgr* pCIMgr = g_pInterfaceMgr->GetClientInfoMgr(); CLIENT_INFO *pLocalCI = pCIMgr->GetLocalClient(); uint8 nTeam = 0; if( pLocalCI) { nTeam = pLocalCI->nTeamID; } g_pDrawPrim->SetRGBA4( &teamPoly, nTeamColors[nTeam][1], nTeamColors[nTeam][0], nTeamColors[nTeam][1], nTeamColors[nTeam][2] ); float fw = 90.0f * g_pInterfaceResMgr->GetXRatio(); float fh = 90.0f * g_pInterfaceResMgr->GetYRatio(); g_pDrawPrim->SetXYWH( &teamPoly, fx-fw, fy, fw, fh); } RadarPlayerList::iterator iter = m_Players.begin(); while (iter != m_Players.end()) { CUIFormattedPolyString* pStr = (*iter)->pName; if (pStr->GetLength()) { uint8 nSize = (uint8)(12.0f * g_pInterfaceResMgr->GetXRatio()); pStr->SetCharScreenHeight(nSize); pStr->SetPosition(fx,fy); fy += (float)pStr->GetHeight(); } iter++; } }
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(); }