/* ============== SCR_DrawLoading ============== */ void SCR_DrawLoading (void) { qpic_t *pic; if (!scr_drawloading) return; pic = Draw_CachePic ("gfx/loading.lmp"); Draw_Pic ( (vid.width - pic->width)/2, (vid.height - 48 - pic->height)/2, pic); }
/* SCR_DrawNet */ void SCR_DrawNet (void) { if (cls.netchan.outgoing_sequence - cls.netchan.incoming_acknowledged < UPDATE_BACKUP - 1) return; if (cls.demoplayback) return; Draw_Pic (scr_vrect.x + 64, scr_vrect.y, scr_net); }
/* ============== SCR_DrawNet ============== */ void SCR_DrawNet (void) { if (realtime - cl.last_received_message < 0.3) return; if (cls.demoplayback) return; GL_SetCanvas (CANVAS_DEFAULT); //johnfitz Draw_Pic (scr_vrect.x+64, scr_vrect.y, scr_net); }
/* SCR_DrawRam */ void SCR_DrawRam (void) { if (!scr_showram->int_val) return; if (!r_cache_thrash) return; Draw_Pic (scr_vrect.x + 32, scr_vrect.y, scr_ram); }
/* ============== SCR_DrawRam ============== */ void SCR_DrawRam (void) { if (!scr_showram.value) return; if (!r_cache_thrash) return; GL_SetCanvas (CANVAS_DEFAULT); //johnfitz Draw_Pic (scr_vrect.x+32, scr_vrect.y, scr_ram); }
/* ============== SCR_DrawPause ============== */ void SCR_DrawPause (void) { int w, h; if (!scr_showpause->value) // turn off for screenshots return; if (!cl_paused->value) return; Draw_GetPicSize (&w, &h, "pause"); Draw_Pic ((viddef.width-w)/2, viddef.height/2 + 8, "pause"); }
/* ============== DrawPause ============== */ void SCR_DrawPause (void) { qpic_t *pic; if (!scr_showpause.value) // turn off for screenshots return; if (!cl.paused) return; pic = Draw_CachePic ("gfx/pause.lmp"); Draw_Pic ( (vid.width - pic->width)/2, (vid.height - 48 - pic->height)/2, pic); }
/* ========================================================================= */ void VID_MenuDraw ( void ) { q_int32_t w, h; /* draw the banner */ Draw_GetPicSize ( &w, &h, "m_banner_video" ); Draw_Pic ( viddef.width / 2 - w / 2, viddef.height / 2 - 110, "m_banner_video" ); /* move cursor to a reasonable starting position */ Menu_AdjustCursor ( &s_opengl_menu, 1 ); /* draw the menu */ Menu_Draw ( &s_opengl_menu ); }
void SCR_DrawField(int x, int y, int color, int width, int value) { char num[16], *ptr; int l; int frame; if (width < 1) { return; } /* draw number string */ if (width > 5) { width = 5; } SCR_AddDirtyPoint(x, y); SCR_AddDirtyPoint(x + width * CHAR_WIDTH + 2, y + 23); Com_sprintf(num, sizeof(num), "%i", value); l = (int)strlen(num); if (l > width) { l = width; } x += 2 + CHAR_WIDTH * (width - l); ptr = num; while (*ptr && l) { if (*ptr == '-') { frame = STAT_MINUS; } else { frame = *ptr - '0'; } Draw_Pic(x, y, sb_nums[color][frame]); x += CHAR_WIDTH; ptr++; l--; } }
/* ============== DrawPause ============== */ void SCR_DrawPause (void) { quake::sprite pic; if (!scr_showpause.to_bool()) // turn off for screenshots return; if (!cl.paused) return; pic = Draw_CachePic ("gfx/pause.lmp"); Draw_Pic ( (vid.width - pic.width)/2, (vid.height - 48 - pic.height)/2, pic); }
/* ============== SCR_DrawLoading ============== */ void SCR_DrawLoading (void) { qpic_t *pic; if (!scr_drawloading) return; GL_SetCanvas (CANVAS_MENU); //johnfitz pic = Draw_CachePic ("gfx/loading.lmp"); Draw_Pic ( (320 - pic->width)/2, (240 - 48 - pic->height)/2, pic); //johnfitz -- stretched menus scr_tileclear_updates = 0; //johnfitz }
void SCR_DrawLoading(void) { int w, h; if (!scr_draw_loading) { return; } scr_draw_loading = false; Draw_GetPicSize(&w, &h, "loading"); Draw_Pic((viddef.width - w) / 2, (viddef.height - h) / 2, "loading"); }
/* ============= Draw_TransPicTranslate -- johnfitz -- rewritten to use texmgr to do translation Only used for the player color selection menu ============= */ void Draw_TransPicTranslate (int x, int y, qpic_t *pic, int top, int bottom) { static int oldtop = -2; static int oldbottom = -2; if (top != oldtop || bottom != oldbottom) { glpic_t *p = (glpic_t *)pic->data; gltexture_t *glt = p->gltexture; oldtop = top; oldbottom = bottom; TexMgr_ReloadImage (glt, top, bottom); } Draw_Pic (x, y, pic); }
/* ============== DrawPause ============== */ void SCR_DrawPause (void) { qpic_t *pic; if (!cl.paused) return; if (!scr_showpause.value) // turn off for screenshots return; GL_SetCanvas (CANVAS_MENU); //johnfitz pic = Draw_CachePic ("gfx/pause.lmp"); Draw_Pic ( (320 - pic->width)/2, (240 - 48 - pic->height)/2, pic); //johnfitz -- stretched menus scr_tileclear_updates = 0; //johnfitz }
/* ============== SCR_DrawTurtle ============== */ void SCR_DrawTurtle (void) { static int count; if (!scr_showturtle.value) return; if (host_frametime < 0.1) { count = 0; return; } count++; if (count < 3) return; Draw_Pic (scr_vrect.x, scr_vrect.y, scr_turtle); }
/* ================ VID_MenuDraw ================ */ void VID_MenuDraw (menuframework_s *self) { int w, h; /* ** draw the banner */ Draw_GetPicSize( &w, &h, "m_banner_video" ); Draw_Pic( viddef.width / 2 - w / 2, viddef.height /2 - 110, "m_banner_video", 1 ); /* ** move cursor to a reasonable starting position */ Menu_AdjustCursor( self, 1 ); /* ** draw the menu */ Menu_Draw( self ); }
/* ============== SCR_DrawTurtle ============== */ void SCR_DrawTurtle (void) { static int count; if (!scr_showturtle.value) return; if (host_frametime < 0.1) { count = 0; return; } count++; if (count < 3) return; GL_SetCanvas (CANVAS_DEFAULT); //johnfitz Draw_Pic (scr_vrect.x, scr_vrect.y, scr_turtle); }
/* ============== SCR_DrawTurtle ============== */ void SCR_DrawTurtle (void) { static int count; if (!scr_showturtle->value) return; // 2001-10-20 TIMESCALE extension by Tomaz/Maddes start // if (host_frametime < 0.1) if (host_cpu_frametime < 0.1) // 2001-10-20 TIMESCALE extension by Tomaz/Maddes end { count = 0; return; } count++; if (count < 3) return; Draw_Pic (scr_vrect.x, scr_vrect.y, scr_turtle); }
void Draw_ScaledPic (int x, int y, float scale, const char *pic, float red, float green, float blue, float alpha) { Draw_Pic (x, y, pic, 1); }
/* ================ SCR_ExecuteLayoutString ================ */ void SCR_ExecuteLayoutString (char *s) { int x, y; int value; char *token; int width; int index; clientinfo_t *ci; if (cls.state != ca_active || !cl.refresh_prepped) return; if (!s[0]) return; x = 0; y = 0; width = 3; while (s) { token = COM_Parse (&s); if (!strcmp(token, "xl")) { token = COM_Parse (&s); x = atoi(token); continue; } if (!strcmp(token, "xr")) { token = COM_Parse (&s); x = viddef.width + atoi(token); continue; } if (!strcmp(token, "xv")) { token = COM_Parse (&s); x = viddef.width/2 - 160 + atoi(token); continue; } if (!strcmp(token, "yt")) { token = COM_Parse (&s); y = atoi(token); continue; } if (!strcmp(token, "yb")) { token = COM_Parse (&s); y = viddef.height + atoi(token); continue; } if (!strcmp(token, "yv")) { token = COM_Parse (&s); y = viddef.height/2 - 120 + atoi(token); continue; } if (!strcmp(token, "pic")) { // draw a pic from a stat number token = COM_Parse (&s); value = cl.frame.playerstate.stats[atoi(token)]; if (value >= MAX_IMAGES) Com_Error (ERR_DROP, "Pic >= MAX_IMAGES"); if (cl.configstrings[CS_IMAGES+value]) { SCR_AddDirtyPoint (x, y); SCR_AddDirtyPoint (x+23, y+23); Draw_Pic (x, y, cl.configstrings[CS_IMAGES+value]); } continue; } if (!strcmp(token, "client")) { // draw a deathmatch client block int score, ping, time; token = COM_Parse (&s); x = viddef.width/2 - 160 + atoi(token); token = COM_Parse (&s); y = viddef.height/2 - 120 + atoi(token); SCR_AddDirtyPoint (x, y); SCR_AddDirtyPoint (x+159, y+31); token = COM_Parse (&s); value = atoi(token); if (value >= MAX_CLIENTS || value < 0) Com_Error (ERR_DROP, "client >= MAX_CLIENTS"); ci = &cl.clientinfo[value]; token = COM_Parse (&s); score = atoi(token); token = COM_Parse (&s); ping = atoi(token); token = COM_Parse (&s); time = atoi(token); DrawAltString (x+32, y, ci->name); DrawString (x+32, y+8, "Score: "); DrawAltString (x+32+7*8, y+8, va("%i", score)); DrawString (x+32, y+16, va("Ping: %i", ping)); DrawString (x+32, y+24, va("Time: %i", time)); if (!ci->icon) ci = &cl.baseclientinfo; Draw_Pic (x, y, ci->iconname); continue; } if (!strcmp(token, "ctf")) { // draw a ctf client block int score, ping; char block[80]; token = COM_Parse (&s); x = viddef.width/2 - 160 + atoi(token); token = COM_Parse (&s); y = viddef.height/2 - 120 + atoi(token); SCR_AddDirtyPoint (x, y); SCR_AddDirtyPoint (x+159, y+31); token = COM_Parse (&s); value = atoi(token); if (value >= MAX_CLIENTS || value < 0) Com_Error (ERR_DROP, "client >= MAX_CLIENTS"); ci = &cl.clientinfo[value]; token = COM_Parse (&s); score = atoi(token); token = COM_Parse (&s); ping = atoi(token); if (ping > 999) ping = 999; sprintf(block, "%3d %3d %-12.12s", score, ping, ci->name); if (value == cl.playernum) DrawAltString (x, y, block); else DrawString (x, y, block); continue; } if (!strcmp(token, "picn")) { // draw a pic from a name token = COM_Parse (&s); SCR_AddDirtyPoint (x, y); SCR_AddDirtyPoint (x+23, y+23); Draw_Pic (x, y, token); continue; } if (!strcmp(token, "num")) { // draw a number token = COM_Parse (&s); width = atoi(token); token = COM_Parse (&s); value = cl.frame.playerstate.stats[atoi(token)]; SCR_DrawField (x, y, 0, width, value); continue; } if (!strcmp(token, "hnum")) { // health number int color; width = 3; value = cl.frame.playerstate.stats[STAT_HEALTH]; if (value > 25) color = 0; // green else if (value > 0) color = (cl.frame.serverframe>>2) & 1; // flash else color = 1; if (cl.frame.playerstate.stats[STAT_FLASHES] & 1) Draw_Pic (x, y, "field_3"); SCR_DrawField (x, y, color, width, value); continue; }
void SCR_ExecuteLayoutString(char *s) { int x, y; int value; char *token; int width; int index; clientinfo_t *ci; if ((cls.state != ca_active) || !cl.refresh_prepped) { return; } if (!s[0]) { return; } x = 0; y = 0; while (s) { token = COM_Parse(&s); if (!strcmp(token, "xl")) { token = COM_Parse(&s); x = (int)strtol(token, (char **)NULL, 10); continue; } if (!strcmp(token, "xr")) { token = COM_Parse(&s); x = viddef.width + (int)strtol(token, (char **)NULL, 10); continue; } if (!strcmp(token, "xv")) { token = COM_Parse(&s); x = viddef.width / 2 - 160 + (int)strtol(token, (char **)NULL, 10); continue; } if (!strcmp(token, "yt")) { token = COM_Parse(&s); y = (int)strtol(token, (char **)NULL, 10); continue; } if (!strcmp(token, "yb")) { token = COM_Parse(&s); y = viddef.height + (int)strtol(token, (char **)NULL, 10); continue; } if (!strcmp(token, "yv")) { token = COM_Parse(&s); y = viddef.height / 2 - 120 + (int)strtol(token, (char **)NULL, 10); continue; } if (!strcmp(token, "pic")) { /* draw a pic from a stat number */ token = COM_Parse(&s); index = (int)strtol(token, (char **)NULL, 10); if ((index < 0) || (index >= sizeof(cl.frame.playerstate.stats))) { Com_Error(ERR_DROP, "bad stats index %d (0x%x)", index, index); } value = cl.frame.playerstate.stats[index]; if (value >= MAX_IMAGES) { Com_Error(ERR_DROP, "Pic >= MAX_IMAGES"); } if (cl.configstrings[CS_IMAGES + value]) { SCR_AddDirtyPoint(x, y); SCR_AddDirtyPoint(x + 23, y + 23); Draw_Pic(x, y, cl.configstrings[CS_IMAGES + value]); } continue; } if (!strcmp(token, "client")) { /* draw a deathmatch client block */ int score, ping, time; token = COM_Parse(&s); x = viddef.width / 2 - 160 + (int)strtol(token, (char **)NULL, 10); token = COM_Parse(&s); y = viddef.height / 2 - 120 + (int)strtol(token, (char **)NULL, 10); SCR_AddDirtyPoint(x, y); SCR_AddDirtyPoint(x + 159, y + 31); token = COM_Parse(&s); value = (int)strtol(token, (char **)NULL, 10); if ((value >= MAX_CLIENTS) || (value < 0)) { Com_Error(ERR_DROP, "client >= MAX_CLIENTS"); } ci = &cl.clientinfo[value]; token = COM_Parse(&s); score = (int)strtol(token, (char **)NULL, 10); token = COM_Parse(&s); ping = (int)strtol(token, (char **)NULL, 10); token = COM_Parse(&s); time = (int)strtol(token, (char **)NULL, 10); DrawAltString(x + 32, y, ci->name); DrawString(x + 32, y + 8, "Score: "); DrawAltString(x + 32 + 7 * 8, y + 8, va("%i", score)); DrawString(x + 32, y + 16, va("Ping: %i", ping)); DrawString(x + 32, y + 24, va("Time: %i", time)); if (!ci->icon) { ci = &cl.baseclientinfo; } Draw_Pic(x, y, ci->iconname); continue; } if (!strcmp(token, "ctf")) { /* draw a ctf client block */ int score, ping; char block[80]; token = COM_Parse(&s); x = viddef.width / 2 - 160 + (int)strtol(token, (char **)NULL, 10); token = COM_Parse(&s); y = viddef.height / 2 - 120 + (int)strtol(token, (char **)NULL, 10); SCR_AddDirtyPoint(x, y); SCR_AddDirtyPoint(x + 159, y + 31); token = COM_Parse(&s); value = (int)strtol(token, (char **)NULL, 10); if ((value >= MAX_CLIENTS) || (value < 0)) { Com_Error(ERR_DROP, "client >= MAX_CLIENTS"); } ci = &cl.clientinfo[value]; token = COM_Parse(&s); score = (int)strtol(token, (char **)NULL, 10); token = COM_Parse(&s); ping = (int)strtol(token, (char **)NULL, 10); if (ping > 999) { ping = 999; } sprintf(block, "%3d %3d %-12.12s", score, ping, ci->name); if (value == cl.playernum) { DrawAltString(x, y, block); } else { DrawString(x, y, block); } continue; } if (!strcmp(token, "picn")) { /* draw a pic from a name */ token = COM_Parse(&s); SCR_AddDirtyPoint(x, y); SCR_AddDirtyPoint(x + 23, y + 23); Draw_Pic(x, y, (char *)token); continue; } if (!strcmp(token, "num")) { /* draw a number */ token = COM_Parse(&s); width = (int)strtol(token, (char **)NULL, 10); token = COM_Parse(&s); value = cl.frame.playerstate.stats[(int)strtol(token, (char **)NULL, 10)]; SCR_DrawField(x, y, 0, width, value); continue; } if (!strcmp(token, "hnum")) { /* health number */ int color; width = 3; value = cl.frame.playerstate.stats[STAT_HEALTH]; if (value > 25) { color = 0; /* green */ } else if (value > 0) { color = (cl.frame.serverframe >> 2) & 1; /* flash */ } else {
/* ================== 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; }
/* ================== 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); }
/* ============= Sbar_DrawPic ============= */ void Sbar_DrawPic(int x, int y, const qpic_t *pic) { Draw_Pic(x /* + ((vid.width - 320)>>1) */ , y + (vid.height - SBAR_HEIGHT), pic); }