예제 #1
0
파일: sbar.c 프로젝트: dommul/super8
/*
===============
Sbar_DrawFrags
===============
*/
void Sbar_DrawFrags (void)
{
    int				i, k, l;
    int				top, bottom;
    int				x, y, f;
    int				xofs;
    char			num[12];
    scoreboard_t	*s;

    if (cl.maxclients == 1) // mankrip
        return; // mankrip

    Sbar_SortFrags ();

// draw the text
    l = scoreboardlines <= 4 ? scoreboardlines : 4;

    x = 23;
    xofs = 202;
    y = 200 - SBAR_HEIGHT  + 23; // mankrip - edited

    for (i=0 ; i<l ; i++)
    {
        k = fragsort[i];
        s = &cl.scores[k];
        if (!s->name[0])
            continue;

        // draw background
        top = s->colors & 0xf0;
        bottom = (s->colors & 15)<<4;
        top = Sbar_ColorForMap (top);
        bottom = Sbar_ColorForMap (bottom);

        //qb: fixme - needs its own special function for scalable hud...
       // M_Draw_Fill (xofs - (xofs *scr_2d_scale_h)/4 + 220, y - (y * scr_2d_scale_v)/2 + 228, 28, 4, top); //qb: adjust for scaling - mankrip - edited
        //M_Draw_Fill (xofs - (xofs *scr_2d_scale_h)/4 + 220, y - (y * scr_2d_scale_v)/2 + 232, 28, 3, bottom); //qb: adjust for scaling -  mankrip - edited

        // draw number
        f = s->frags;
        sprintf (num, "%3i",f);

        Sbar_DrawCharacter ( (x+1)*8 , -24, num[0]);
        Sbar_DrawCharacter ( (x+2)*8 , -24, num[1]);
        Sbar_DrawCharacter ( (x+3)*8 , -24, num[2]);

        if (k == cl.viewentity - 1)
        {
            Sbar_DrawCharacter (x*8+2, -24, 16);
            Sbar_DrawCharacter ( (x+4)*8-4, -24, 17);
        }
        x+=4;
    }
}
예제 #2
0
파일: sbar.c 프로젝트: CatalystG/tyrquake
/*
===============
Sbar_DrawFrags
===============
*/
void
Sbar_DrawFrags(void)
{
    int i, k, l;
    int top, bottom;
    int x, y, f;
    char num[12];
    player_info_t *s;

    Sbar_SortFrags(false);

// draw the text
    l = scoreboardlines <= 4 ? scoreboardlines : 4;

    x = 23;
//      xofs = (vid.width - 320)>>1;
    y = vid.height - SBAR_HEIGHT - 23;

    for (i = 0; i < l; i++) {
	k = fragsort[i];
	s = &cl.players[k];
	if (!s->name[0])
	    continue;
	if (s->spectator)
	    continue;

	// draw background
	top = Sbar_ColorForMap(s->topcolor);
	bottom = Sbar_ColorForMap(s->bottomcolor);

//              Draw_Fill (xofs + x*8 + 10, y, 28, 4, top);
//              Draw_Fill (xofs + x*8 + 10, y+4, 28, 3, bottom);
	Draw_Fill(x * 8 + 10, y, 28, 4, top);
	Draw_Fill(x * 8 + 10, y + 4, 28, 3, bottom);

	// draw number
	f = s->frags;
	sprintf(num, "%3i", f);

	Sbar_DrawCharacter((x + 1) * 8, -24, num[0]);
	Sbar_DrawCharacter((x + 2) * 8, -24, num[1]);
	Sbar_DrawCharacter((x + 3) * 8, -24, num[2]);

	if (k == cl.playernum) {
	    Sbar_DrawCharacter(x * 8 + 2, -24, 16);
	    Sbar_DrawCharacter((x + 4) * 8 - 4, -24, 17);
	}
	x += 4;
    }
}
예제 #3
0
파일: sbar.c 프로젝트: dommul/super8
/*
===============
Sbar_UpdateScoreboard
===============
*/
void Sbar_UpdateScoreboard (void)
{
    int		i, k;
    int		top, bottom;
    scoreboard_t	*s;

    Sbar_SortFrags ();

// draw the text
    memset (scoreboardtext, 0, sizeof(scoreboardtext));

    for (i=0 ; i<scoreboardlines; i++)
    {
        k = fragsort[i];
        s = &cl.scores[k];
        sprintf (&scoreboardtext[i][1], "%3i %s", s->frags, s->name);

        top = s->colors & 0xf0;
        bottom = (s->colors & 15) <<4;
        scoreboardtop[i] = Sbar_ColorForMap (top);
        scoreboardbottom[i] = Sbar_ColorForMap (bottom);
    }
}
예제 #4
0
void Parse_Serverinfo(server_data *s, char *info)
{
    int i, j;
    char *pinfo;
    char *tmp;

    s->passed_filters = 1;
    s->support_teams = false; // by default server does't support team info per player

    if (strncmp(info, "\xFF\xFF\xFF\xFFn", 5))
    {
        SetPing(s, -1);
        return;
    }

    pinfo = strchr(info, '\n');
    if (pinfo != NULL)
        *(pinfo++) = 0;

    info += 5;

    while (*info == '\\'  &&  s->keysn < MAX_KEYS)
    {
        char *i2, *i3;
        i2 = strchr(info+1, '\\');
        if (i2 == NULL)
            break;
        i3 = strchr(i2+1, '\\');
        if (i3 == NULL)
            i3 = info + strlen(info);

        s->keys[s->keysn] = (char *) Q_malloc(i2-info);
        strlcpy(s->keys[s->keysn], info+1, i2-info);

        s->values[s->keysn] = (char *) Q_malloc(i3-i2);
        strlcpy(s->values[s->keysn], i2+1, i3-i2);

        s->keysn++;

        info = i3;
    }

    // read players

    for (i = s->spectatorsn = s->playersn = 0; pinfo  &&  strchr(pinfo, '\n'); i++)
    {
        qbool spec;
        int id, frags, time, ping, slen;
        char name[100], skin[100], team[100];
        char *nameptr = name;
        int top, bottom;
        int pos;

        if (s->playersn + s->spectatorsn >= MAX_PLAYERS)
            break;  // man

        pos = 0;
        pos += ReadInt(pinfo+pos, &id);
        pos += ReadInt(pinfo+pos, &frags);
        pos += ReadInt(pinfo+pos, &time);
        pos += ReadInt(pinfo+pos, &ping);
        pos += ReadString(pinfo+pos, name);
        pos += ReadString(pinfo+pos, skin);
        pos += ReadInt(pinfo+pos, &top);
        pos += ReadInt(pinfo+pos, &bottom);
        pos += ReadString(pinfo+pos, team);

        if (team[0])
            s->support_teams = true; // seems server support team info per player

        if (ping > 0) { // seems player if relay on ping
            spec = false;
            s->playersn++;
        }
        else // spec
        {
            spec = true;
            slen = strlen(name);
            s->spectatorsn++;
            ping = -ping;

            if (name[0] == '\\' && name[1] == 's' && name[2] == '\\')
                nameptr = name+3; // strip \s\<name>
            else if (slen > 3 && name[slen-3] == '(' && name[slen-2] == 's' && name[slen-1] == ')')
                name[slen-3] = 0; // strip <name>(s) for old servers
        }

        s->players[i] = (playerinfo *)Q_malloc(sizeof(playerinfo));
        s->players[i]->id = id;
        s->players[i]->frags = frags;
        s->players[i]->time = time;
        s->players[i]->ping = ping;
        s->players[i]->spec = spec;

        s->players[i]->top = Sbar_ColorForMap(top);
        s->players[i]->bottom = Sbar_ColorForMap(bottom);

        strlcpy(s->players[i]->name, nameptr, sizeof(s->players[0]->name));
        strlcpy(s->players[i]->skin, skin, sizeof(s->players[0]->skin));
        strlcpy(s->players[i]->team, team, sizeof(s->players[0]->team));

        pinfo = strchr(pinfo, '\n') + 1;
    }

    {
    void *swap;
    int n;
    // sort players by frags
    n = s->playersn + s->spectatorsn - 2;
    for (i = 0; i <= n; i++)
        for (j = n; j >= i; j--)
            if (s->players[j] && s->players[j+1] && s->players[j]->frags < s->players[j+1]->frags)
            {
                swap = (void*)s->players[j];
                s->players[j] = s->players[j+1];
                s->players[j+1] = (playerinfo*)swap;
            }
    // sort keys
    n = s->keysn - 2;
    for (i = 0; i <= n; i++)
        for (j = n; j >= i; j--)
            if (strcasecmp(s->keys[j], s->keys[j+1]) > 0)
            {
                swap = (void*)s->keys[j];
                s->keys[j] = s->keys[j+1];
                s->keys[j+1] = (char*)swap;
                swap = (void*)s->values[j];
                s->values[j] = s->values[j+1];
                s->values[j+1] = (char*)swap;
            }
    }

    // fill-in display
	s->qwfwd = SB_IsServerQWfwd(s);

    tmp = ValueForKey(s, "hostname");
    if (tmp != NULL)
        snprintf (s->display.name, sizeof (s->display.name),"%-.*s", COL_NAME, tmp);
    else
        return;

    tmp = ValueForKey(s, "fraglimit");
    if (tmp != NULL)
        snprintf(s->display.fraglimit, sizeof (s->display.fraglimit), "%*.*s", COL_FRAGLIMIT, COL_FRAGLIMIT, strlen(tmp) > COL_FRAGLIMIT ? "999" : tmp);

    tmp = ValueForKey(s, "timelimit");
    if (tmp != NULL)
        snprintf(s->display.timelimit, sizeof (s->display.timelimit), "%*.*s", COL_TIMELIMIT, COL_TIMELIMIT, strlen(tmp) > COL_TIMELIMIT ? "99" : tmp);

    tmp = ValueForKey(s, "*gamedir");
    s->qizmo = false;
    if (tmp != NULL)
        snprintf(s->display.gamedir, sizeof (s->display.gamedir) ,"%.*s", COL_GAMEDIR, tmp==NULL ? "" : tmp);
    else
    {
        tmp = ValueForKey(s, "*progs");
        if (tmp != NULL  &&  !strcmp(tmp, "666"))
        {
            snprintf(s->display.gamedir, sizeof (s->display.gamedir), "qizmo");
            s->qizmo = true;
        }
    }

    tmp = ValueForKey(s, "map");
    if (tmp != NULL)
        snprintf(s->display.map, sizeof (s->display.map), "%-.*s", COL_MAP, tmp==NULL ? "" : tmp);

    tmp = ValueForKey(s, "maxclients");
    if (!tmp || strlen(tmp) > 2)
        tmp = "99";
    i = s->playersn > 99 ? 99 : s->playersn;
    if (i < 1) { s->occupancy = SERVER_EMPTY; }
    else if (i > 0 && i < atoi(tmp)) { s->occupancy = SERVER_NONEMPTY; }
    else { s->occupancy = SERVER_FULL; }
    if (tmp != NULL)
        snprintf(s->display.players, sizeof (s->display.players), "%2d/%-2s", i, tmp==NULL ? "" : tmp);
}
예제 #5
0
파일: sbar.c 프로젝트: CatalystG/tyrquake
/*
==================
Sbar_DeathmatchOverlay

ping time frags name
==================
*/
void
Sbar_DeathmatchOverlay(int start)
{
    const qpic_t *pic;
    int i, k, l;
    int top, bottom;
    int x, y, f;
    char num[12];
    player_info_t *s;
    int total;
    int minutes;
    int p;
    int teamplay;
    char team[5];
    int skip = 10;

    if (largegame)
	skip = 8;

// request new ping times every two second
    if (realtime - cl.last_ping_request > 2) {
	cl.last_ping_request = realtime;
	MSG_WriteByte(&cls.netchan.message, clc_stringcmd);
	MSG_WriteString(&cls.netchan.message, "pings");
    }

    teamplay = atoi(Info_ValueForKey(cl.serverinfo, "teamplay"));

    scr_copyeverything = 1;
    scr_fullupdate = 0;

    if (!start) {
	pic = Draw_CachePic("gfx/ranking.lmp");
	Draw_Pic(160 - pic->width / 2, 0, pic);
    }
// scores
    Sbar_SortFrags(true);

// draw the text
    l = scoreboardlines;

    if (start)
	y = start;
    else
	y = 24;
    if (teamplay) {
	x = 4;
//                            0    40 64   104   152  192
	Draw_String(x, y, "ping pl time frags team name");
	y += 8;
//              Draw_String ( x , y, "---- -- ---- ----- ---- ----------------");
	Draw_String(x, y,
		    "\x1d\x1e\x1e\x1f \x1d\x1f \x1d\x1e\x1e\x1f \x1d\x1e\x1e\x1e\x1f \x1d\x1e\x1e\x1f \x1d\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1f");
	y += 8;
    } else {
	x = 16;
//                            0    40 64   104   152
	Draw_String(x, y, "ping pl time frags name");
	y += 8;
//              Draw_String ( x , y, "---- -- ---- ----- ----------------");
	Draw_String(x, y,
		    "\x1d\x1e\x1e\x1f \x1d\x1f \x1d\x1e\x1e\x1f \x1d\x1e\x1e\x1e\x1f \x1d\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1f");
	y += 8;
    }

    for (i = 0; i < l && y <= vid.height - 10; i++) {
	k = fragsort[i];
	s = &cl.players[k];
	if (!s->name[0])
	    continue;

	// draw ping
	p = s->ping;
	if (p < 0 || p > 999)
	    p = 999;
	sprintf(num, "%4i", p);
	Draw_String(x, y, num);

	// draw pl
	p = s->pl;
	sprintf(num, "%3i", p);
	if (p > 25)
	    Draw_Alt_String(x + 32, y, num);
	else
	    Draw_String(x + 32, y, num);

	if (s->spectator) {
	    Draw_String(x + 40, y, "(spectator)");
	    // draw name
	    if (teamplay)
		Draw_String(x + 152 + 40, y, s->name);
	    else
		Draw_String(x + 152, y, s->name);
	    y += skip;
	    continue;
	}
	// draw time
	if (cl.intermission)
	    total = cl.completed_time - s->entertime;
	else
	    total = realtime - s->entertime;
	minutes = (int)total / 60;
	sprintf(num, "%4i", minutes);
	Draw_String(x + 64, y, num);

	// draw background
	top = Sbar_ColorForMap(s->topcolor);
	bottom = Sbar_ColorForMap(s->bottomcolor);

	if (largegame)
	    Draw_Fill(x + 104, y + 1, 40, 3, top);
	else
	    Draw_Fill(x + 104, y, 40, 4, top);
	Draw_Fill(x + 104, y + 4, 40, 4, bottom);

	// draw number
	f = s->frags;
	sprintf(num, "%3i", f);

	Draw_Character(x + 112, y, num[0]);
	Draw_Character(x + 120, y, num[1]);
	Draw_Character(x + 128, y, num[2]);

	if (k == cl.playernum) {
	    Draw_Character(x + 104, y, 16);
	    Draw_Character(x + 136, y, 17);
	}
	// team
	if (teamplay) {
	    team[4] = 0;
	    strncpy(team, Info_ValueForKey(s->userinfo, "team"), 4);
	    Draw_String(x + 152, y, team);
	}
	// draw name
	if (teamplay)
	    Draw_String(x + 152 + 40, y, s->name);
	else
	    Draw_String(x + 152, y, s->name);

	y += skip;
    }

    if (y >= vid.height - 10)	// we ran over the screen size, squish
	largegame = true;
}
예제 #6
0
파일: sbar.c 프로젝트: CatalystG/tyrquake
/*
==================
Sbar_MiniDeathmatchOverlay

frags name
frags team name
displayed to right of status bar if there's room
==================
*/
void
Sbar_MiniDeathmatchOverlay(void)
{
    int i, k;
    int top, bottom;
    int x, y, f;
    char num[12];
    player_info_t *s;
    int teamplay;
    char team[5];
    int numlines;
    char name[16 + 1];
    team_t *tm;

    if (vid.width < 512 || !sb_lines)
	return;			// not enuff room

    teamplay = atoi(Info_ValueForKey(cl.serverinfo, "teamplay"));

    scr_copyeverything = 1;
    scr_fullupdate = 0;

// scores
    Sbar_SortFrags(false);
    if (vid.width >= 640)
	Sbar_SortTeams();

    if (!scoreboardlines)
	return;			// no one there?

// draw the text
    y = vid.height - sb_lines - 1;
    numlines = sb_lines / 8;
    if (numlines < 3)
	return;			// not enough room

    // find us
    for (i = 0; i < scoreboardlines; i++)
	if (fragsort[i] == cl.playernum)
	    break;

    if (i == scoreboardlines)	// we're not there, we are probably a spectator, just display top
	i = 0;
    else			// figure out start
	i = i - numlines / 2;

    if (i > scoreboardlines - numlines)
	i = scoreboardlines - numlines;
    if (i < 0)
	i = 0;

    x = 324;

    for ( /* */ ; i < scoreboardlines && y < vid.height - 8 + 1; i++) {
	k = fragsort[i];
	s = &cl.players[k];
	if (!s->name[0])
	    continue;

	// draw ping
	top = Sbar_ColorForMap(s->topcolor);
	bottom = Sbar_ColorForMap(s->bottomcolor);

	Draw_Fill(x, y + 1, 40, 3, top);
	Draw_Fill(x, y + 4, 40, 4, bottom);

	// draw number
	f = s->frags;
	sprintf(num, "%3i", f);

	Draw_Character(x + 8, y, num[0]);
	Draw_Character(x + 16, y, num[1]);
	Draw_Character(x + 24, y, num[2]);

	if (k == cl.playernum) {
	    Draw_Character(x, y, 16);
	    Draw_Character(x + 32, y, 17);
	}
	// team
	if (teamplay) {
	    team[4] = 0;
	    strncpy(team, Info_ValueForKey(s->userinfo, "team"), 4);
	    Draw_String(x + 48, y, team);
	}
	// draw name
	name[16] = 0;
	strncpy(name, s->name, 16);
	if (teamplay)
	    Draw_String(x + 48 + 40, y, name);
	else
	    Draw_String(x + 48, y, name);
	y += 8;
    }

    // draw teams if room
    if (vid.width < 640 || !teamplay)
	return;

    // draw seperator
    x += 208;
    for (y = vid.height - sb_lines; y < vid.height - 6; y += 2)
	Draw_Character(x, y, 14);

    x += 16;

    y = vid.height - sb_lines;
    for (i = 0; i < scoreboardteams && y <= vid.height; i++) {
	k = teamsort[i];
	tm = teams + k;

	// draw pings
	team[4] = 0;
	strncpy(team, tm->team, 4);
	Draw_String(x, y, team);

	// draw total
	sprintf(num, "%5i", tm->frags);
	Draw_String(x + 40, y, num);

	if (!strncmp(Info_ValueForKey(cl.players[cl.playernum].userinfo,
				      "team"), tm->team, 16)) {
	    Draw_Character(x - 8, y, 16);
	    Draw_Character(x + 32, y, 17);
	}

	y += 8;
    }

}
예제 #7
0
파일: sbar.c 프로젝트: RetroPie/tyrquake
/*
==================
Sbar_MiniDeathmatchOverlay

frags name
frags team name
displayed to right of status bar if there's room
==================
*/
void
Sbar_MiniDeathmatchOverlay(void)
{
    int x, y, line, numlines, top, bottom;
    int teamplay;

    /* Don't bother if not enough room */
    if (vid.width < 512 || !sb_lines)
	return;

    teamplay = atoi(Info_ValueForKey(cl.serverinfo, "teamplay"));

    scr_copyeverything = 1;
    scr_fullupdate = 0;

    Sbar_SortFrags(false);
    if (vid.width >= 640)
	Sbar_SortTeams();
    if (!scoreboardlines)
	return;

    /* Check for space to draw the text */
    y = vid.height - sb_lines - 1;
    numlines = sb_lines / 8;
    if (numlines < 3)
	return;

    /* Find client in the scoreboard, if not there (spectator) display top */
    for (line = 0; line < scoreboardlines; line++)
	if (fragsort[line] == cl.playernum)
	    break;
    if (line == scoreboardlines)
	line = 0;

    /* Put the client in the centre of the displayed lines */
    line = qclamp(line - numlines / 2, 0, scoreboardlines - numlines);

    x = 324;
    while (line < scoreboardlines && y < vid.height - 8 + 1) {
	const int playernum = fragsort[line++];
	const player_info_t *player = &cl.players[playernum];
	if (!player->name[0])
	    continue;

	/* draw background */
	top = Sbar_ColorForMap(player->topcolor);
	bottom = Sbar_ColorForMap(player->bottomcolor);
	Draw_Fill(x, y + 1, 40, 3, top);
	Draw_Fill(x, y + 4, 40, 4, bottom);

	/* draw frags */
	char frags[4];
	snprintf(frags, sizeof(frags), "%3d", player->frags);
	Draw_Character(x + 8, y, frags[0]);
	Draw_Character(x + 16, y, frags[1]);
	Draw_Character(x + 24, y, frags[2]);
	if (playernum == cl.playernum) {
	    Draw_Character(x, y, 16);
	    Draw_Character(x + 32, y, 17);
	}

	/* draw team name */
	if (teamplay) {
	    const char *playerteam = Info_ValueForKey(player->userinfo, "team");
	    char short_team[5];
	    snprintf(short_team, sizeof(short_team), "%-4s", playerteam);
	    Draw_String(x + 48, y, short_team);
	}

	/* draw name */
	char name[17];
	snprintf(name, sizeof(name), "%-16s", player->name);
	if (teamplay)
	    Draw_String(x + 48 + 40, y, name);
	else
	    Draw_String(x + 48, y, name);

	y += 8;
    }

    /* draw teams if room */
    if (vid.width < 640 || !teamplay)
	return;

    /* draw seperator */
    x += 208;
    for (y = vid.height - sb_lines; y < vid.height - 6; y += 2)
	Draw_Character(x, y, 14);

    const player_info_t *player = &cl.players[cl.playernum];
    const char *playerteam = Info_ValueForKey(player->userinfo, "team");

    x += 16;
    y = vid.height - sb_lines;
    line = 0;
    while (line < scoreboardteams && y <= vid.height) {
	const team_t *team = teams + teamsort[line++];

	/* draw teamname */
	char short_team[5];
	snprintf(short_team, sizeof(short_team), "%-4s", team->team);
	Draw_String(x, y, short_team);

	/* draw frags */
	char frags[4];
	snprintf(frags, sizeof(frags), "%3d", team->frags);
	Draw_String(x + 40, y, frags);
	if (!strncmp(team->team, playerteam, 16)) {
	    Draw_Character(x - 8, y, 16);
	    Draw_Character(x + 32, y, 17);
	}

	y += 8;
    }
}
예제 #8
0
파일: sbar.c 프로젝트: dommul/super8
/*
===============
Sbar_DrawFace
===============
*/
void Sbar_DrawFace (int x, int y) // default 112, 0
{
    int		f, anim;

// PGM 01/19/97 - team color drawing
// PGM 03/02/97 - fixed so color swatch only appears in CTF modes
    if (rogue && (cl.maxclients != 1) && (teamplay.value>3) && (teamplay.value<7))
    {
        int				top, bottom;
        int				xofs;
        char			num[12];
        scoreboard_t	*s;

        s = &cl.scores[cl.viewentity - 1];
        // draw background
        top = s->colors & 0xf0;
        bottom = (s->colors & 15)<<4;
        top = Sbar_ColorForMap (top);
        bottom = Sbar_ColorForMap (bottom);

        xofs = x + 2; // 113 mankrip - edited

        Sbar_DrawTransPic (x, 0, rsb_teambord); // 112 mankrip - edited
        M_Draw_Fill (xofs, 200 - SBAR_HEIGHT +  3, 20, 9, top   ); // mankrip - edited
        M_Draw_Fill (xofs, 200 - SBAR_HEIGHT + 12, 20, 9, bottom); // mankrip - edited

        // draw number
        f = s->frags;
        sprintf (num, "%3i",f);

        if (top==8)
        {
            if (num[0] != ' ')
                Sbar_DrawCharacter(x - 3, 3, 18 + num[0] - '0'); // 109 mankrip - edited
            if (num[1] != ' ')
                Sbar_DrawCharacter(x + 4, 3, 18 + num[1] - '0'); // 116 mankrip - edited
            if (num[2] != ' ')
                Sbar_DrawCharacter(x + 11, 3, 18 + num[2] - '0'); // 123 mankrip - edited
        }
        else
        {
            Sbar_DrawCharacter ( x - 3, 3, num[0]); // 109 mankrip - edited
            Sbar_DrawCharacter ( x + 4, 3, num[1]); // 116 mankrip - edited
            Sbar_DrawCharacter ( x + 11, 3, num[2]); // 123 mankrip - edited
        }
        return;
    }
// PGM 01/19/97 - team color drawing

    // mankrip - begin
    if (cl.stats[STAT_HEALTH] <= 0)
    {
        Sbar_DrawTransPic (x, y, sb_faces[0][0]);
        return;
    }
    // mankrip - end

    if ( (cl.items & (IT_INVISIBILITY | IT_INVULNERABILITY)) ==
            (IT_INVISIBILITY | IT_INVULNERABILITY) )
    {
        Sbar_DrawTransPic (x, y, sb_face_invis_invuln); // mankrip - edited
        return;
    }
    if (cl.items & IT_QUAD)
    {
        Sbar_DrawTransPic (x, y, sb_face_quad ); // mankrip - edited
        return;
    }
    if (cl.items & IT_INVISIBILITY)
    {
        Sbar_DrawTransPic (x, y, sb_face_invis ); // mankrip - edited
        return;
    }
    if (cl.items & IT_INVULNERABILITY)
    {
        Sbar_DrawTransPic (x, y, sb_face_invuln); // mankrip - edited
        return;
    }

    if (cl.stats[STAT_HEALTH] >= 100)
        f = 4;
    else
        f = cl.stats[STAT_HEALTH] / 20;

    if (cl.time <= cl.faceanimtime)
        anim = 1;
    else
        anim = 0;
    Sbar_DrawTransPic (x, y, sb_faces[f][anim]); // mankrip - edited
}
예제 #9
0
파일: sbar.c 프로젝트: dommul/super8
/*
==================
Sbar_DeathmatchOverlay

==================
*/
void Sbar_DeathmatchOverlay (void)
{
    int				i, k, l;
    int				top, bottom;
    int				x, y, f;
    char			num[12];
    float           oldsbarscale; //qb: do it big
    scoreboard_t	*s;

    //qb: big and sort of lazy..
    oldsbarscale = sbar_scale.value;
    sbar_scale.value = 1.0;
    scr_2d_scale_h = vid.width * sbar_scale.value / (200.0 * 1.8);
    scr_2d_scale_v = vid.height / (MIN_VID_HEIGHT/sbar_scale.value);

    scr_copyeverything = 1;
    scr_fullupdate = 0;


    M_DrawPlaque ("gfx/ranking.lmp", false); // mankrip

// scores
    Sbar_SortFrags ();

// draw the text
    l = scoreboardlines;

    x = 80; // mankrip - edited
    y = 36; //qb: also edited, was 36 - mankrip - edited
    for (i=0 ; i<l ; i++)
    {
        k = fragsort[i];
        s = &cl.scores[k];
        if (!s->name[0])
            continue;

        // draw background
        top = s->colors & 0xf0;
        bottom = (s->colors & 15)<<4;
        top = Sbar_ColorForMap (top);
        bottom = Sbar_ColorForMap (bottom);

        M_Draw_Fill (x+20, y + 1    , 40, 4, top);
        M_Draw_Fill (x+20, y + 1 + 4, 40, 4, bottom);

        // draw number
        f = s->frags;
        sprintf (num, "%3i",f);

        M_DrawCharacter ( x+8 , y, num[0], true);
        M_DrawCharacter ( x+16 , y, num[1], true);
        M_DrawCharacter ( x+24 , y, num[2], true);

        if (k == cl.viewentity - 1)
            M_DrawCharacter ( x - 8, y, 12, true);

#if 0
        {
            int				total;
            int				n, minutes, tens, units;

            // draw time
            total = cl.completed_time - s->entertime;
            minutes = (int)total/60;
            n = total - minutes*60;
            tens = n/10;
            units = n%10;

            sprintf (num, "%3i:%i%i", minutes, tens, units);

            Draw_String ( x+48 , y, num);
        }
#endif

        // draw name
        Draw_String (x+64, y, s->name, true);

        y += 10;
    }
    sbar_scale.value =oldsbarscale;
    scr_2d_scale_h = vid.width * sbar_scale.value / (200.0 * nativeaspect);
    if (scr_2d_scale_h < 1)
        scr_2d_scale_h = 1;
    scr_2d_scale_v =  vid.height / (200.0/sbar_scale.value);
    if (scr_2d_scale_v < 1)
        scr_2d_scale_v = 1;
}