for ogc 9.** hack base
Code:
// in HUD_Redraw:
if (cvar.alivelist) { DrawAliveList(); }
//above hud_redraw
void DrawAliveList(void)
{
ColorEntry *color;
char tmpchar, *plname;
int length, i, index;
int alx = cvar.alivelist_x;
int aly = cvar.alivelist_y;
if (cvar.alivelist == 1)
DrawHudString(alx,aly-16,122,122,222,"- Alive List (Enemies) -");
else if (cvar.alivelist == 2)
DrawHudString(alx,aly-16,122,122,222,"- Alive List (All Players) -");
for (index=0,i=0;index<vPlayers.size();index++)
{
if (vPlayers[index].getAlive() && ( cvar.alivelist == 2 || (cvar.alivelist == 1 && isEnemy(index))))
{
plname = vPlayers[index].entinfo.name;
length = strlen(plname);
color = PlayerColor(index);
if (!cvar.alivelist_size || length <= cvar.alivelist_size)
DrawHudString(alx,aly + 15 * i,color->r,color->g,color->b,"%02d. %s", i + 1, plname);
else
{
tmpchar = plname[cvar.alivelist_size];
plname[cvar.alivelist_size] = 0;
DrawHudString(alx, aly + 15 * i, color->r, color->g, color->b, "%02d. %s", i + 1, plname);
plname[cvar.alivelist_size] = tmpchar;
}
i++;
}
}
}
//register the cvars in .cpp
REGISTER_CVAR_INT( alivelist ,1)
REGISTER_CVAR_INT( alivelist_size ,31)
REGISTER_CVAR_INT( alivelist_x ,900)
REGISTER_CVAR_INT( alivelist_y ,160)
//and in .h
int alivelist;
int alivelist_size;
int alivelist_x;
int alivelist_y;