/* ================== 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; }
/* ================== 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; }
void Draw_CenterAltString (int y, char *str) { Draw_Alt_String((vid.width-(8*strlen(str)))/2, y, str); }