|
|
#1 |
![]() Join Date: Apr 2008
Reputation: 35
Posts: 923
|
Multiple Icons on screen part of one HUD element possible?
Got me a HUD element that will display an icon over a players head, only one can be shown at a time atm, however now I want to increase the usefull of it by showing at least 3 icons at once.
Everything works fine with the one, however I'm unsure if it's possible with just the one hud element. Currently done all the messing around I could regarding that in the code for the HUD element itself, to do more I would have to mess with logic of selecting who to show the icon on which is in hl2mp_player.cpp, I can easily replace an old backup of the hud file if needed but if I do it for hl2mp_player I might be losing other progress. So is this possible with one HUD element or would I need to make one HUD element for each "target" player that an icon has to be shown for? Right now I've just tried a simple for loop and making an array of my handle that takes care of fetching the coördinates from the targetted player, this didn't seem to work though and I'd like to know for sure if it's possible before digging in deeper. |
|
|
|
|
|
#2 |
![]() Join Date: Jun 2008
Reputation: 351
Posts: 1,804
|
You could create a panel for every client playerclass spawned (I did this with sunflares for every env_sun used, so it will work).
But in this case it might be more efficient to prepare structarrays (with information about the position and if they are supposed to draw) and then draw them, if a player exists and if he's onscreen. |
|
|
|
|
|
#3 |
|
Guest
Posts: n/a
|
lol..
Just use one hud element... looping through all the clients. Here's some old code (before i moved onto editing the voice thing instead - search for DoD style player icons to find the post) Code:
void CSDKPlayerIcons::Paint()
{
C_SDKPlayer *pLocalPlayer = C_SDKPlayer::GetLocalSDKPlayer();
if ( !pLocalPlayer )
return;
int xpos(0), ypos(0);
surface()->DrawSetColor( SDKGameResources()->GetTeamColor( pLocalPlayer->GetTeamNumber() )/*m_CPProgressColor*/ );
surface()->DrawSetTextFont(m_hFont);
for( int iClient = 1; iClient <= gpGlobals->maxClients; ++iClient )
{
C_BasePlayer *pPlayer = UTIL_PlayerByIndex( iClient );
if (pPlayer && (pPlayer->GetTeamNumber() == pLocalPlayer->GetTeamNumber()) && pPlayer->IsAlive() )
{
Vector vecPos(pPlayer->WorldSpaceCenter());
vecPos.z += (pPlayer->GetViewOffset().z / 2);
//vecPos.z += 40.0f;
GetVectorInScreenSpace( vecPos, xpos, ypos );
surface()->DrawSetTextPos(xpos, ypos);
surface()->DrawSetColor( SDKGameResources()->GetTeamColor( pPlayer->GetTeamNumber() ) );
if (pPlayer->IsDowned() )
{
Vector vecPos(pPlayer->WorldSpaceCenter());
GetVectorInScreenSpace( vecPos, xpos, ypos );
surface()->DrawSetTextPos(xpos, ypos);
surface()->DrawPrintText(L"+", wcslen(L"+"));
}
else
surface()->DrawPrintText(L"C", wcslen(L"C"));
}
}//for each client in our PVS
}
|
|
|
|
#4 |
![]() Join Date: Apr 2008
Reputation: 35
Posts: 923
|
|
|
|
|
![]() |
|
||||||
| Thread Tools | |
| Display Modes | |
|
|