diff options
author | Christopher Schwarz <lakitu7@gmail.com> | 2009-10-14 18:57:42 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2013-01-03 00:16:50 +0000 |
commit | a85a677ab302b0dec0cb716e5c071305825df666 (patch) | |
tree | 2242121b83be2c3385789058beb39b0b68387176 /src/cgame/cg_drawtools.c | |
parent | 17db07ae8addfb0952875e3af929ca83a08ba481 (diff) |
* (bug 2991) Add teamoverlay, an optional hud display showing names, health, class/equipment, and locations of teammates
- Disable with cg_drawTeamOverlay 0 or remove it from your hud
- Control number of teammates to show with cg_teamOverlayMaxPlayers
- When teamoverlay is enabled, show health of teammates next to their name when the crosshair is over them
- Servers who dislike gameplay effects or want to save on bandwidth use can use g_allowTeamOverlay 0 to disable the feature for players
- Special thanks to Risujin for bring this idea and the original patch to Tremulous
* Cache teaminfo on the server and send only when needed (Undeference)
* Increase frequency of sending updated teaminfo (Undeference)
Diffstat (limited to 'src/cgame/cg_drawtools.c')
-rw-r--r-- | src/cgame/cg_drawtools.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/cgame/cg_drawtools.c b/src/cgame/cg_drawtools.c index 7d32fa1d..17eb7ac6 100644 --- a/src/cgame/cg_drawtools.c +++ b/src/cgame/cg_drawtools.c @@ -403,3 +403,30 @@ char *CG_KeyBinding( const char *bind ) } return key; } + +/* +================= +CG_GetColorCharForHealth +================= +*/ +char CG_GetColorCharForHealth( int clientnum ) +{ + char health_char = '2'; + int healthPercent; + int maxHealth; + int curWeaponClass = cgs.clientinfo[ clientnum ].curWeaponClass; + + if( cgs.clientinfo[ clientnum ].team == TEAM_ALIENS ) + maxHealth = BG_Class( curWeaponClass )->health; + else + maxHealth = BG_Class( PCL_HUMAN )->health; + + healthPercent = (int) ( 100.0f * (float) cgs.clientinfo[ clientnum ].health + / (float) maxHealth ); + + if( healthPercent < 33 ) + health_char = '1'; + else if( healthPercent < 67 ) + health_char = '3'; + return health_char; +} |