void SCR_DrawNet(void) { float scale = SCR_GetMenuScale(); if (cls.netchan.outgoing_sequence - cls.netchan.incoming_acknowledged < CMD_BACKUP - 1) { return; } Draw_PicScaled(scr_vrect.x + 64 * scale, scr_vrect.y, "net", scale); }
void SCR_DrawFieldScaled(int x, int y, int color, int width, int value, float factor) { 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)*factor, y + 23); Com_sprintf(num, sizeof(num), "%i", value); l = (int)strlen(num); if (l > width) { l = width; } x += (2 + CHAR_WIDTH * (width - l)) * factor; ptr = num; while (*ptr && l) { if (*ptr == '-') { frame = STAT_MINUS; } else { frame = *ptr - '0'; } Draw_PicScaled(x, y, sb_nums[color][frame], factor); x += CHAR_WIDTH*factor; ptr++; l--; } }
void SCR_DrawLoading(void) { int w, h; float scale = SCR_GetMenuScale(); if (!scr_draw_loading) { return; } Draw_GetPicSize(&w, &h, "loading"); Draw_PicScaled((viddef.width - w * scale) / 2, (viddef.height - h * scale) / 2, "loading", scale); }
void VID_MenuDraw(void) { int w, h; float scale = SCR_GetMenuScale(); /* draw the banner */ Draw_GetPicSize(&w, &h, "m_banner_video"); Draw_PicScaled(viddef.width / 2 - (w * scale) / 2, viddef.height / 2 - (110 * scale), "m_banner_video", scale); /* move cursor to a reasonable starting position */ Menu_AdjustCursor(&s_opengl_menu, 1); /* draw the menu */ Menu_Draw(&s_opengl_menu); }
void SCR_DrawPause(void) { int w, h; float scale = SCR_GetMenuScale(); if (!scr_showpause->value) /* turn off for screenshots */ { return; } if (!cl_paused->value) { return; } Draw_GetPicSize(&w, &h, "pause"); Draw_PicScaled((viddef.width - w * scale) / 2, viddef.height / 2 + 8 * scale, "pause", scale); }
void SCR_ExecuteLayoutString(char *s) { int x, y; int value; char *token; int width; int index; clientinfo_t *ci; float scale = gl_hudscale->value; 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 + scale*(int)strtol(token, (char **)NULL, 10); continue; } if (!strcmp(token, "xv")) { token = COM_Parse(&s); x = viddef.width / 2 - scale*160 + scale*(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 + scale*(int)strtol(token, (char **)NULL, 10); continue; } if (!strcmp(token, "yv")) { token = COM_Parse(&s); y = viddef.height / 2 - scale*120 + scale*(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*scale, y + 23*scale); Draw_PicScaled(x, y, cl.configstrings[CS_IMAGES + value], scale); } continue; } if (!strcmp(token, "client")) { /* draw a deathmatch client block */ int score, ping, time; token = COM_Parse(&s); x = viddef.width / 2 - scale*160 + scale*(int)strtol(token, (char **)NULL, 10); token = COM_Parse(&s); y = viddef.height / 2 - scale*120 + scale*(int)strtol(token, (char **)NULL, 10); SCR_AddDirtyPoint(x, y); SCR_AddDirtyPoint(x + scale*159, y + scale*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); // TODO: scale* DrawAltStringScaled(x + scale*32, y, ci->name, scale); DrawAltStringScaled(x + scale*32, y + scale*8, "Score: ", scale); DrawAltStringScaled(x + scale*(32 + 7 * 8), y + scale*8, va("%i", score), scale); DrawStringScaled(x + scale*32, y + scale*16, va("Ping: %i", ping), scale); DrawStringScaled(x + scale*32, y + scale*24, va("Time: %i", time), scale); if (!ci->icon) { ci = &cl.baseclientinfo; } Draw_PicScaled(x, y, ci->iconname, scale); continue; } if (!strcmp(token, "ctf")) { /* draw a ctf client block */ int score, ping; char block[80]; token = COM_Parse(&s); x = viddef.width / 2 - scale*160 + scale*(int)strtol(token, (char **)NULL, 10); token = COM_Parse(&s); y = viddef.height / 2 - scale*120 + scale*(int)strtol(token, (char **)NULL, 10); SCR_AddDirtyPoint(x, y); SCR_AddDirtyPoint(x + scale*159, y + scale*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) { DrawAltStringScaled(x, y, block, scale); } else { DrawAltStringScaled(x, y, block, scale); } continue; } if (!strcmp(token, "picn")) { /* draw a pic from a name */ token = COM_Parse(&s); SCR_AddDirtyPoint(x, y); SCR_AddDirtyPoint(x + scale*23, y + scale*23); Draw_PicScaled(x, y, (char *)token, scale); 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_DrawFieldScaled(x, y, 0, width, value, scale); 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 {