/* JPG - draw frames per second
==============
SCR_DrawFPS
==============
*/
void SCR_DrawFPS (void)
{
	int x;
	static double last_realtime = 0.0;
	static int last_framecount = 0;
	static int fps = 0;
	char buff[10];
	char *ch;

	if (realtime - last_realtime > 1.0)
	{
		fps = (host_framecount - last_framecount) / (realtime - last_realtime) + 0.5;
		last_framecount = host_framecount;
		last_realtime = realtime;
	}

	if (!pq_drawfps.value)
		return;

	snprintf (buff, sizeof(buff), "%3d", fps);
	x = vid.width - 48;

	ch = buff;

	while (*ch)
	{
		Draw_Character(x, (!show_speed.value ? 8 : 16), *ch);
		x += 8;
		ch++;
	}
}
Ejemplo n.º 2
0
void SCR_DrawNotifyString (void)
{
	const char	*start;
	int		l;
	int		j;
	int		x, y;

	GL_SetCanvas (CANVAS_MENU); //johnfitz

	start = scr_notifystring;

	y = 200 * 0.35; //johnfitz -- stretched overlays

	do
	{
	// scan the width of the line
		for (l=0 ; l<40 ; l++)
			if (start[l] == '\n' || !start[l])
				break;
		x = (320 - l*8)/2; //johnfitz -- stretched overlays
		for (j=0 ; j<l ; j++, x+=8)
			Draw_Character (x, y, start[j]);

		y += 8;

		while (*start && *start != '\n')
			start++;

		if (!*start)
			break;
		start++;		// skip the \n
	} while (1);
}
Ejemplo n.º 3
0
void SCR_DrawNotifyString (void)
{
	char	*start;
	int		l;
	int		j;
	int		x, y;

	start = scr_notifystring;

	y = vid.height*0.35;

	do
	{
	// scan the width of the line
		for (l=0 ; l<40 ; l++)
			if (start[l] == '\n' || !start[l])
				break;
		x = (vid.width - l*8)/2;
		for (j=0 ; j<l ; j++, x+=8)
			Draw_Character (x, y, start[j]);

		y += 8;

		while (*start && *start != '\n')
			start++;

		if (!*start)
			break;
		start++;		// skip the \n
	} while (1);
}
Ejemplo n.º 4
0
void SCR_DrawCenterString (void)
{
	/*
	//JAMES
	VertexAttribute vattr[2] = {		
		{gVtx->vbo_handle, POSITION_LOCATION, 2, STREAM_FLOAT, 0, sizeof(float)*4, sizeof(float)*0, 0},		
		{gVtx->vbo_handle, UV_LOCATION0, 2, STREAM_FLOAT, 0, sizeof(float)*4, sizeof(float)*2, 0}
	};*/
	//END
	char	*start;
	int		l;
	int		j;
	int		x, y;
	int		remaining;

// the finale prints the characters one at a time
	if (cl.intermission)
		remaining = scr_printspeed.value * (cl.time - scr_centertime_start);
	else
		remaining = 9999;

	scr_erase_center = 0;
	start = scr_centerstring;

	if (scr_center_lines <= 4)
		y = vid.height*0.35;
	else
		y = 48;

	//JAMES
	//SetAttributeFormat( vattr, 2, 0);
	//END

	do	
	{
	// scan the width of the line
		for (l=0 ; l<40 ; l++)
			if (start[l] == '\n' || !start[l])
				break;
		x = (vid.width - l*8)/2;
		for (j=0 ; j<l ; j++, x+=8)
		{
			Draw_Character (x, y, start[j]);	
			if (!remaining--)
			{				
				return;
			}
		}
			
		y += 8;

		while (*start && *start != '\n')
			start++;

		if (!*start)
			break;
		start++;		// skip the \n
	} while (1);
}
Ejemplo n.º 5
0
/*
==============
SCR_DrawCrosshair -- johnfitz
==============
*/
void SCR_DrawCrosshair (void)
{
	if (!crosshair.value)
		return;

	GL_SetCanvas (CANVAS_CROSSHAIR);
	Draw_Character (-4, -4, '+'); //0,0 is center of viewport
}
Ejemplo n.º 6
0
void MS_Draw_Content_Slider (struct menu_ct	*content){
	float	check = 0;
	float	draw;
	int		px;
	int		py = 8;
	int		i;
	
	px = content->width * 8 + 16;

	if (content->subtype == 1)
		check = content->variable->value;
	if (content->subtype == 2)
	{
		if (content->iptr != NULL)
			check = **content->iptr;
		if (content->fptr != NULL)
			check = **content->fptr;
		if (content->dptr != NULL)
			check = **content->dptr;
	}


	//if (content->lx + px < content->rx)
	//{
		Draw_Character(content->lx,content->ly,128);
		for (i=1;i<=content->width ;i++)
			Draw_Character(content->lx + i *8,content->ly,129);
		Draw_Character (content->lx +i *8, content->ly, 130);

		if (check < content->limit[0])
			draw = 0;
		if (check > content->limit[1])
			draw = 1;
		draw = (check - content->limit[0])/(content->limit[1] - content->limit[0]);
		Draw_Character (content->lx + (content->width-1)*8 * draw + 8, content->ly, 131);
		
		content->rx = content->lx + px;
		content->ry = content->ly + py;
	//}
}
Ejemplo n.º 7
0
void SCR_DrawCenterString (void) //actually do the drawing
{
	char	*start;
	int		l;
	int		j;
	int		x, y;
	int		remaining;

	GL_SetCanvas (CANVAS_MENU); //johnfitz

// the finale prints the characters one at a time
	if (cl.intermission)
		remaining = scr_printspeed.value * (cl.time - scr_centertime_start);
	else
		remaining = 9999;

	scr_erase_center = 0;
	start = scr_centerstring;

	if (scr_center_lines <= 4)
		y = 200*0.35;	//johnfitz -- 320x200 coordinate system
	else
		y = 48;
	if (crosshair.value)
		y -= 8;

	do
	{
	// scan the width of the line
		for (l=0 ; l<40 ; l++)
			if (start[l] == '\n' || !start[l])
				break;
		x = (320 - l*8)/2;	//johnfitz -- 320x200 coordinate system
		for (j=0 ; j<l ; j++, x+=8)
		{
			Draw_Character (x, y, start[j]);	//johnfitz -- stretch overlays
			if (!remaining--)
				return;
		}

		y += 8;

		while (*start && *start != '\n')
			start++;

		if (!*start)
			break;
		start++;		// skip the \n
	} while (1);
}
Ejemplo n.º 8
0
/*
==================
SCR_DrawDemoStatus
draws demo name, status and progress
==================
*/
int SCR_DrawDemoStatus(void)
{
    extern cvar_t demo_statustime;
    char st[128];
    int x, y;
    int w, i;
    int mins, secs;

    if (cls.timedemo  ||  !cls.demoplayback)
        return 0;

    if (!cls.demopaused  &&  (realtime - cls.demobartime > demo_statustime.value  ||  cls.demobartime < 0))
        return 0;

    w = min(((vid.width / 2) / 16) * 2, 40);
    //w = 20;

    x = vid.width / 2 - (w*8/2);
    y = vid.height - sb_lines - 8;

    // status
    if (cls.demopaused)
        Draw_String(vid.width/2-4*6, y-16, "paused");

    // speed
    snprintf (st, sizeof (st), "%d%%", cls.demospeed);
    Draw_String(x+8, y-16, st);

    // status - time
    mins = ((int)(hosttime-cls.demostarttime)) / 60;
    secs = ((int)(hosttime-cls.demostarttime)) % 60;
    snprintf (st, sizeof (st), "%d:%02d", mins, secs);
    Draw_String(x+8*(w-strlen(st)-1), y-16, st);

    // progress bar
    memset(st, '\x81', w);
    st[0] = '\x80';
    st[w-1] = '\x82';
    st[w] = 0;
    Draw_String(x, y-24, st);
    Draw_Character((int)(x + 8*((cls.demopos / cls.demolength)*(w-3)+1)), y-24, '\x83');

    // demo name
    strlcpy (st, cls.demoname, sizeof (st));
    st[vid.width/8] = 0;
    Draw_Alt_String(vid.width/2 - 4*strlen(st), y-4, st);

    return 1;
}
Ejemplo n.º 9
0
void SCR_DrawCenterString (void)
{
	char	*start;
	int		l;
	int		j;
	int		x, y;
	int		remaining;

// the finale prints the characters one at a time
	if (cl.intermission)
		remaining = scr_printspeed.value * (cl.time - scr_centertime_start);
	else
		remaining = 9999;

	scr_erase_center = 0;
	start = scr_centerstring;

	if (scr_center_lines <= 4)
		y = vid.height*0.35;
	else
		y = 48;

	do	
	{
	// scan the width of the line
		for (l=0 ; l<40 ; l++)
			if (start[l] == '\n' || !start[l])
				break;
		x = (vid.width - l*8)/2;
		for (j=0 ; j<l ; j++, x+=8)
		{
			Draw_Character (x, y, start[j]);	
			if (!remaining--)
				return;
		}
			
		y += 8;

		if (y >= (int)vid.height)
			break; // Outside screen

		while (*start && *start != '\n')
			start++;

		if (!*start)
			break;
		start++;		// skip the \n
	} while (1);
}
/*
==============
SCR_DrawSpeed - Baker 3.67 from JoeQuake
==============
*/
void SCR_DrawSpeed (void)
{
	int		x;
	char buff[10];
	char *ch;
	float		speed, vspeed;
	vec3_t		vel;
	static	float	maxspeed = 0, display_speed = -1;
	static	double	lastrealtime = 0;

	if (!show_speed.value)
		return;

	if (lastrealtime > realtime)
	{
		lastrealtime = 0;
		display_speed = -1;
		maxspeed = 0;
	}

	VectorCopy (cl.velocity, vel);
	vspeed = vel[2];
	vel[2] = 0;
	speed = VectorLength (vel);

	if (speed > maxspeed)
		maxspeed = speed;

	if (display_speed >= 0)
	{
		snprintf(buff, sizeof(buff), "%3d", (int)display_speed);
	ch = buff;
	x = vid.width - 48;
	while (*ch)
	{
			Draw_Character(x, 8, (*ch)+128);
		x += 8;
		ch++;
	}
}

	if (realtime - lastrealtime >= 0.1)
	{
		lastrealtime = realtime;
		display_speed = maxspeed;
		maxspeed = 0;
	}
}
Ejemplo n.º 11
0
void CEditBox_Draw(CEditBox *e, int x, int y, qbool active)
{
	while (e->pos > e->disp + e->width - 1)
		e->disp ++;
	if (e->disp  >  e->pos)
		e->disp = e->pos;
	if (e->disp  >  strlen(e->text) - e->width + 1)
		e->disp = strlen(e->text) - e->width + 1;
//	if (e->disp  <  0)
//		e->disp = 0;

	snprintf(buf, sizeof (buf), "%-*.*s", e->width, e->width, active ? e->text+e->disp : e->text);
	Draw_String(x, y, buf);

	if (active)
		Draw_Character(x+8*(e->pos-e->disp), y, 10+((int)(cls.realtime*4)&1));
}
/*
==============
SCR_DrawWebPercent
==============
*/
void SCR_DrawWebPercent (void)
{
	int x;
	char buff[20];
	char *ch;

	snprintf (buff, sizeof(buff), "download: %2.1f%%", (float)(cls.download.percent*100));
	x = vid.width - (16*8); //64; // 16 x 3 = 48 ... we need 16 x 4 = 64

	Draw_Fill (0, 20, vid.width, 2, 0);
	Draw_Fill (0, 0, vid.width, 20, 98);
	Draw_Fill (0, 8, (int)((vid.width - (18*8)) * cls.download.percent), 8, 8);

	ch = buff;

	while (*ch)
	{
		Draw_Character(x, 8, (*ch)+128);
		x += 8;
		ch++;
	}
}
Ejemplo n.º 13
0
/*
==================
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;
    }

}
Ejemplo n.º 14
0
void SCR_DrawCenterString (void)
{
	char	*start;
	int		l;
	int		j;
	int		x, y;
	int		remaining;
	float	fade;

// the finale prints the characters one at a time
	if (cl.intermission)
		remaining = scr_printspeed.value * (cl.time - scr_centertime_start);
	else
		remaining = 9999;

	scr_erase_center = 0;
	start = scr_centerstring;

	if (scr_center_lines <= 4)
		y = vid.height*0.35;
	else
		y = 48;

	if (!cl.intermission && scr_centerfade.value)
	{
		fade = -(cl.time - scr_centertime_start) + 2;

		if (fade < 0.5)
			fade = 0.5;

		glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
		glEnable(GL_BLEND);
	}
	else
	{
		fade = 1;
	}

	do	
	{
	// scan the width of the line
		for (l=0 ; l<40 ; l++)
			if (start[l] == '\n' || !start[l])
				break;
		x = (vid.width - l*8)/2;
		for (j=0 ; j<l ; j++, x+=8)
		{
			if (!cl.intermission && scr_centerfade.value)
				glColor4f(1,1,1,fade);
			Draw_Character (x, y, start[j]);	
			if (!remaining--)
			{
				glColor4f(1,1,1,1);
				return;
			}
		}
			
		y += 8;

		while (*start && *start != '\n')
			start++;

		if (!*start)
			break;
		start++;		// skip the \n
	} while (1);

	glDisable(GL_BLEND);
}
Ejemplo n.º 15
0
/*
==================
SCR_UpdateScreen

This is called every frame, and can also be called explicitly to flush
text to the screen.

WARNING: be very careful calling this from elsewhere, because the refresh
needs almost the entire 256k of stack space!
==================
*/
void SCR_UpdateScreen (void)
{
	static float	oldscr_viewsize;
	vrect_t		vrect;

	if (block_drawing)
		return;

	vid.numpages = 2 + gl_triplebuffer.value;

	scr_copytop = 0;
	scr_copyeverything = 0;

	if (scr_disabled_for_loading)
	{
		if (realtime - scr_disabled_time > 60)
		{
			scr_disabled_for_loading = false;
			Con_Printf ("load failed.\n");
		}
		else
			return;
	}

	if (!scr_initialized || !con_initialized)
		return;				// not initialized yet


	GX_BeginRendering (&gxx, &gxy, &gxwidth, &gxheight);
	
	//
	// determine size of refresh window
	//
	if (oldfov != scr_fov.value)
	{
		oldfov = scr_fov.value;
		vid.recalc_refdef = true;
	}

	if (oldscreensize != scr_viewsize.value)
	{
		oldscreensize = scr_viewsize.value;
		vid.recalc_refdef = true;
	}

	if (vid.recalc_refdef)
		SCR_CalcRefdef ();

//
// do 3D refresh drawing, and then update the screen
//
	SCR_SetUpToDrawConsole ();
	
	V_RenderView ();

	GX_Set2D ();

	//
	// draw any areas not covered by the refresh
	//
	SCR_TileClear ();

	if (scr_drawdialog)
	{
		Sbar_Draw ();
		Draw_FadeScreen ();
		SCR_DrawNotifyString ();
		scr_copyeverything = true;
	}
	else if (scr_drawloading)
	{
		SCR_DrawLoading ();
		Sbar_Draw ();
	}
	else if (cl.intermission == 1 && key_dest == key_game)
	{
		Sbar_IntermissionOverlay ();
	}
	else if (cl.intermission == 2 && key_dest == key_game)
	{
		Sbar_FinaleOverlay ();
		SCR_CheckDrawCenterString ();
	}
	else
	{
		if (crosshair.value)
			Draw_Character (scr_vrect.x + scr_vrect.width/2, scr_vrect.y + scr_vrect.height/2, '+');
		
		SCR_DrawRam ();
		SCR_DrawNet ();
		SCR_DrawTurtle ();
		SCR_DrawPause ();
		SCR_CheckDrawCenterString ();
		Sbar_Draw ();
		SCR_DrawConsole ();	
		M_Draw ();
	}

	V_UpdatePalette ();

	GX_EndRendering ();

	VID_DrawWmoteGuide ();
}
Ejemplo n.º 16
0
/*
==================
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;
}
Ejemplo n.º 17
0
/*
==================
Sbar_TeamOverlay

team frags
added by Zoid
==================
*/
void
Sbar_TeamOverlay(void)
{
    const qpic_t *pic;
    int i, k;
    int x, y;
    char num[12];
    int teamplay;
    char team[5];
    team_t *tm;
    int plow, phigh, pavg;

// request new ping times every two second
    teamplay = atoi(Info_ValueForKey(cl.serverinfo, "teamplay"));

    if (!teamplay) {
	Sbar_DeathmatchOverlay(0);
	return;
    }

    scr_copyeverything = 1;
    scr_fullupdate = 0;

    pic = Draw_CachePic("gfx/ranking.lmp");
    Draw_Pic(160 - pic->width / 2, 0, pic);

    y = 24;
    x = 36;
    Draw_String(x, y, "low/avg/high team total players");
    y += 8;
//      Draw_String(x, y, "------------ ---- ----- -------");
    Draw_String(x, y,
		"\x1d\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1f \x1d\x1e\x1e\x1f \x1d\x1e\x1e\x1e\x1f \x1d\x1e\x1e\x1e\x1e\x1e\x1f");
    y += 8;

// sort the teams
    Sbar_SortTeams();

// draw the text
    for (i = 0; i < scoreboardteams && y <= vid.height - 10; i++) {
	k = teamsort[i];
	tm = teams + k;

	// draw pings
	plow = tm->plow;
	if (plow < 0 || plow > 999)
	    plow = 999;
	phigh = tm->phigh;
	if (phigh < 0 || phigh > 999)
	    phigh = 999;
	if (!tm->players)
	    pavg = 999;
	else
	    pavg = tm->ptotal / tm->players;
	if (pavg < 0 || pavg > 999)
	    pavg = 999;

	sprintf(num, "%3i/%3i/%3i", plow, pavg, phigh);
	Draw_String(x, y, num);

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

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

	// draw players
	sprintf(num, "%5i", tm->players);
	Draw_String(x + 104 + 88, y, num);

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

	y += 8;
    }
    y += 8;
    Sbar_DeathmatchOverlay(y);
}
Ejemplo n.º 18
0
/*
================
Sbar_DrawCharacter

Draws one solid graphics character
================
*/
void
Sbar_DrawCharacter(int x, int y, int num)
{
    Draw_Character(x /*+ ((vid.width - 320)>>1) */  + 4,
		   y + vid.height - SBAR_HEIGHT, num);
}
Ejemplo n.º 19
0
/*
==================
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;
    }
}