DarkPlaces
Game engine based on the Quake 1 engine by id Software, developed by LadyHavoc
 
cl_screen.c
Go to the documentation of this file.
1
2#include "quakedef.h"
3#include "cl_video.h"
4#include "image.h"
5#include "jpeg.h"
6#include "image_png.h"
7#include "cl_collision.h"
8#include "libcurl.h"
9#include "csprogs.h"
10#include "r_stats.h"
11#ifdef CONFIG_VIDEO_CAPTURE
12#include "cap_avi.h"
13#include "cap_ogg.h"
14#endif
15
16// we have to include snd_main.h here only to get access to snd_renderbuffer->format.speed when writing the AVI headers
17#include "snd_main.h"
18
19cvar_t scr_viewsize = {CF_CLIENT | CF_ARCHIVE, "viewsize","100", "how large the view should be, 110 disables inventory bar, 120 disables status bar"};
20cvar_t scr_fov = {CF_CLIENT | CF_ARCHIVE, "fov","90", "field of vision, 1-170 degrees, default 90, some players use 110-130"};
21cvar_t scr_conalpha = {CF_CLIENT | CF_ARCHIVE, "scr_conalpha", "0.9", "opacity of console background gfx/conback (when console isn't forced fullscreen)"};
22cvar_t scr_conalphafactor = {CF_CLIENT | CF_ARCHIVE, "scr_conalphafactor", "1", "opacity of console background gfx/conback relative to scr_conalpha; when 0, gfx/conback is not drawn"};
23cvar_t scr_conalpha2factor = {CF_CLIENT | CF_ARCHIVE, "scr_conalpha2factor", "0", "opacity of console background gfx/conback2 relative to scr_conalpha; when 0, gfx/conback2 is not drawn"};
24cvar_t scr_conalpha3factor = {CF_CLIENT | CF_ARCHIVE, "scr_conalpha3factor", "0", "opacity of console background gfx/conback3 relative to scr_conalpha; when 0, gfx/conback3 is not drawn"};
25cvar_t scr_conbrightness = {CF_CLIENT | CF_ARCHIVE, "scr_conbrightness", "1", "brightness of console background (0 = black, 1 = image)"};
26cvar_t scr_conforcewhiledisconnected = {CF_CLIENT, "scr_conforcewhiledisconnected", "1", "1 forces fullscreen console while disconnected, 2 also forces it when the listen server has started but the client is still loading"};
27cvar_t scr_conheight = {CF_CLIENT | CF_ARCHIVE, "scr_conheight", "0.5", "fraction of screen height occupied by console (reduced as necessary for visibility of loading progress and infobar)"};
28cvar_t scr_conscroll_x = {CF_CLIENT | CF_ARCHIVE, "scr_conscroll_x", "0", "scroll speed of gfx/conback in x direction"};
29cvar_t scr_conscroll_y = {CF_CLIENT | CF_ARCHIVE, "scr_conscroll_y", "0", "scroll speed of gfx/conback in y direction"};
30cvar_t scr_conscroll2_x = {CF_CLIENT | CF_ARCHIVE, "scr_conscroll2_x", "0", "scroll speed of gfx/conback2 in x direction"};
31cvar_t scr_conscroll2_y = {CF_CLIENT | CF_ARCHIVE, "scr_conscroll2_y", "0", "scroll speed of gfx/conback2 in y direction"};
32cvar_t scr_conscroll3_x = {CF_CLIENT | CF_ARCHIVE, "scr_conscroll3_x", "0", "scroll speed of gfx/conback3 in x direction"};
33cvar_t scr_conscroll3_y = {CF_CLIENT | CF_ARCHIVE, "scr_conscroll3_y", "0", "scroll speed of gfx/conback3 in y direction"};
34#ifdef CONFIG_MENU
35cvar_t scr_menuforcewhiledisconnected = {CF_CLIENT, "scr_menuforcewhiledisconnected", "0", "forces menu while disconnected"};
36#endif
37cvar_t scr_centertime = {CF_CLIENT, "scr_centertime","2", "how long centerprint messages show"};
38cvar_t scr_showram = {CF_CLIENT | CF_ARCHIVE, "showram","1", "show ram icon if low on surface cache memory (not used)"};
39cvar_t scr_showturtle = {CF_CLIENT | CF_ARCHIVE, "showturtle","0", "show turtle icon when framerate is too low"};
40cvar_t scr_showpause = {CF_CLIENT | CF_ARCHIVE, "showpause","1", "show pause icon when game is paused"};
41cvar_t scr_showbrand = {CF_CLIENT, "showbrand","0", "shows gfx/brand.tga in a corner of the screen (different values select different positions, including centered)"};
42cvar_t scr_printspeed = {CF_CLIENT, "scr_printspeed","0", "speed of intermission printing (episode end texts), a value of 0 disables the slow printing"};
43cvar_t scr_loadingscreen_background = {CF_CLIENT, "scr_loadingscreen_background","0", "show the last visible background during loading screen (costs one screenful of video memory)"};
44cvar_t scr_loadingscreen_scale = {CF_CLIENT, "scr_loadingscreen_scale","1", "scale factor of the background"};
45cvar_t scr_loadingscreen_scale_base = {CF_CLIENT, "scr_loadingscreen_scale_base","0", "0 = console pixels, 1 = video pixels"};
46cvar_t scr_loadingscreen_scale_limit = {CF_CLIENT, "scr_loadingscreen_scale_limit","0", "0 = no limit, 1 = until first edge hits screen edge, 2 = until last edge hits screen edge, 3 = until width hits screen width, 4 = until height hits screen height"};
47cvar_t scr_loadingscreen_picture = {CF_CLIENT, "scr_loadingscreen_picture", "gfx/loading", "picture shown during loading"};
48cvar_t scr_loadingscreen_count = {CF_CLIENT, "scr_loadingscreen_count","1", "number of loading screen files to use randomly (named loading.tga, loading2.tga, loading3.tga, ...)"};
49cvar_t scr_loadingscreen_firstforstartup = {CF_CLIENT, "scr_loadingscreen_firstforstartup","0", "remove loading.tga from random scr_loadingscreen_count selection and only display it on client startup, 0 = normal, 1 = firstforstartup"};
50cvar_t scr_loadingscreen_barcolor = {CF_CLIENT, "scr_loadingscreen_barcolor", "0 0 1", "rgb color of loadingscreen progress bar"};
51cvar_t scr_loadingscreen_barheight = {CF_CLIENT, "scr_loadingscreen_barheight", "8", "the height of the loadingscreen progress bar"};
52cvar_t scr_loadingscreen_maxfps = {CF_CLIENT, "scr_loadingscreen_maxfps", "20", "maximum FPS for loading screen so it will not update very often (this reduces loading time with lots of models)"};
53cvar_t scr_infobar_height = {CF_CLIENT, "scr_infobar_height", "8", "the height of the infobar items"};
54cvar_t scr_sbarscale = {CF_CLIENT | CF_READONLY, "scr_sbarscale", "1", "current vid_height/vid_conheight, for compatibility with csprogs that read this cvar (found in Fitzquake-derived engines and FTEQW; despite the name it's not specific to the status bar)"};
55cvar_t vid_conwidthauto = {CF_CLIENT | CF_ARCHIVE, "vid_conwidthauto", "1", "automatically update vid_conwidth to match aspect ratio"};
56cvar_t vid_conwidth = {CF_CLIENT | CF_ARCHIVE, "vid_conwidth", "640", "virtual width of 2D graphics system (note: changes may be overwritten, see vid_conwidthauto)"};
57cvar_t vid_conheight = {CF_CLIENT | CF_ARCHIVE, "vid_conheight", "480", "virtual height of 2D graphics system"};
58cvar_t vid_pixelheight = {CF_CLIENT | CF_ARCHIVE, "vid_pixelheight", "1", "adjusts vertical field of vision to account for non-square pixels (1280x1024 on a CRT monitor for example)"};
59cvar_t scr_screenshot_jpeg = {CF_CLIENT | CF_ARCHIVE, "scr_screenshot_jpeg","1", "save jpeg instead of targa or PNG"};
60cvar_t scr_screenshot_jpeg_quality = {CF_CLIENT | CF_ARCHIVE, "scr_screenshot_jpeg_quality","0.9", "image quality of saved jpeg"};
61cvar_t scr_screenshot_png = {CF_CLIENT | CF_ARCHIVE, "scr_screenshot_png","0", "save png instead of targa"};
62cvar_t scr_screenshot_gammaboost = {CF_CLIENT | CF_ARCHIVE, "scr_screenshot_gammaboost","1", "gamma correction on saved screenshots and videos, 1.0 saves unmodified images"};
63cvar_t scr_screenshot_alpha = {CF_CLIENT, "scr_screenshot_alpha","0", "try to write an alpha channel to screenshots (debugging feature)"};
64cvar_t scr_screenshot_timestamp = {CF_CLIENT | CF_ARCHIVE, "scr_screenshot_timestamp", "1", "use a timestamp based number of the type YYYYMMDDHHMMSSsss instead of sequential numbering"};
65// scr_screenshot_name is defined in fs.c
66#ifdef CONFIG_VIDEO_CAPTURE
67cvar_t cl_capturevideo = {CF_CLIENT, "cl_capturevideo", "0", "enables saving of video to a .avi file using uncompressed I420 colorspace and PCM audio, note that scr_screenshot_gammaboost affects the brightness of the output)"};
68cvar_t cl_capturevideo_demo_stop = {CF_CLIENT | CF_ARCHIVE, "cl_capturevideo_demo_stop", "1", "automatically stops video recording when demo ends"};
69cvar_t cl_capturevideo_printfps = {CF_CLIENT | CF_ARCHIVE, "cl_capturevideo_printfps", "1", "prints the frames per second captured in capturevideo (is only written to stdout and any log file, not to the console as that would be visible on the video), value is seconds of wall time between prints"};
70cvar_t cl_capturevideo_width = {CF_CLIENT | CF_ARCHIVE, "cl_capturevideo_width", "0", "scales all frames to this resolution before saving the video"};
71cvar_t cl_capturevideo_height = {CF_CLIENT | CF_ARCHIVE, "cl_capturevideo_height", "0", "scales all frames to this resolution before saving the video"};
72cvar_t cl_capturevideo_realtime = {CF_CLIENT, "cl_capturevideo_realtime", "0", "causes video saving to operate in realtime (mostly useful while playing, not while capturing demos), this can produce a much lower quality video due to poor sound/video sync and will abort saving if your machine stalls for over a minute"};
73cvar_t cl_capturevideo_fps = {CF_CLIENT | CF_ARCHIVE, "cl_capturevideo_fps", "30", "how many frames per second to save (29.97 for NTSC, 30 for typical PC video, 15 can be useful)"};
74cvar_t cl_capturevideo_nameformat = {CF_CLIENT | CF_ARCHIVE, "cl_capturevideo_nameformat", "dpvideo", "prefix for saved videos (the date is encoded using strftime escapes)"};
75cvar_t cl_capturevideo_number = {CF_CLIENT | CF_ARCHIVE, "cl_capturevideo_number", "1", "number to append to video filename, incremented each time a capture begins"};
76cvar_t cl_capturevideo_ogg = {CF_CLIENT | CF_ARCHIVE, "cl_capturevideo_ogg", "1", "save captured video data as Ogg/Vorbis/Theora streams"};
77cvar_t cl_capturevideo_framestep = {CF_CLIENT | CF_ARCHIVE, "cl_capturevideo_framestep", "1", "when set to n >= 1, render n frames to capture one (useful for motion blur like effects)"};
78#endif
79cvar_t r_letterbox = {CF_CLIENT, "r_letterbox", "0", "reduces vertical height of view to simulate a letterboxed movie effect (can be used by mods for cutscenes)"};
80cvar_t r_stereo_separation = {CF_CLIENT, "r_stereo_separation", "4", "separation distance of eyes in the world (negative values are only useful for cross-eyed viewing)"};
81cvar_t r_stereo_sidebyside = {CF_CLIENT, "r_stereo_sidebyside", "0", "side by side views for those who can't afford glasses but can afford eye strain (note: use a negative r_stereo_separation if you want cross-eyed viewing)"};
82cvar_t r_stereo_horizontal = {CF_CLIENT, "r_stereo_horizontal", "0", "aspect skewed side by side view for special decoder/display hardware"};
83cvar_t r_stereo_vertical = {CF_CLIENT, "r_stereo_vertical", "0", "aspect skewed top and bottom view for special decoder/display hardware"};
84cvar_t r_stereo_redblue = {CF_CLIENT, "r_stereo_redblue", "0", "red/blue anaglyph stereo glasses (note: most of these glasses are actually red/cyan, try that one too)"};
85cvar_t r_stereo_redcyan = {CF_CLIENT, "r_stereo_redcyan", "0", "red/cyan anaglyph stereo glasses, the kind given away at drive-in movies like Creature From The Black Lagoon In 3D"};
86cvar_t r_stereo_redgreen = {CF_CLIENT, "r_stereo_redgreen", "0", "red/green anaglyph stereo glasses (for those who don't mind yellow)"};
87cvar_t r_stereo_angle = {CF_CLIENT, "r_stereo_angle", "0", "separation angle of eyes (makes the views look different directions, as an example, 90 gives a 90 degree separation where the views are 45 degrees left and 45 degrees right)"};
88cvar_t scr_stipple = {CF_CLIENT, "scr_stipple", "0", "interlacing-like stippling of the display"};
89cvar_t scr_refresh = {CF_CLIENT, "scr_refresh", "1", "allows you to completely shut off rendering for benchmarking purposes"};
90cvar_t scr_screenshot_name_in_mapdir = {CF_CLIENT | CF_ARCHIVE, "scr_screenshot_name_in_mapdir", "0", "if set to 1, screenshots are placed in a subdirectory named like the map they are from"};
91cvar_t net_graph = {CF_CLIENT | CF_ARCHIVE, "net_graph", "0", "shows a graph of packet sizes and other information, 0 = off, 1 = show client netgraph, 2 = show client and server netgraphs (when hosting a server)"};
92cvar_t cl_demo_mousegrab = {CF_CLIENT, "cl_demo_mousegrab", "0", "Allows reading the mouse input while playing demos. Useful for camera mods developed in csqc. (0: never, 1: always)"};
93cvar_t timedemo_screenshotframelist = {CF_CLIENT, "timedemo_screenshotframelist", "", "when performing a timedemo, take screenshots of each frame in this space-separated list - example: 1 201 401"};
94cvar_t vid_touchscreen_outlinealpha = {CF_CLIENT, "vid_touchscreen_outlinealpha", "0", "opacity of touchscreen area outlines"};
95cvar_t vid_touchscreen_overlayalpha = {CF_CLIENT, "vid_touchscreen_overlayalpha", "0.25", "opacity of touchscreen area icons"};
96
98extern cvar_t r_fog_clear;
99
100int jpeg_supported = false;
101
102qbool scr_initialized; // ready to draw
103
104qbool scr_loading = false; // we are in a loading screen
105
106unsigned int scr_con_current;
107static unsigned int scr_con_margin_bottom;
108
109extern int con_vislines;
110
111extern int cl_punchangle_applied;
112
113static void SCR_ScreenShot_f(cmd_state_t *cmd);
114static void R_Envmap_f(cmd_state_t *cmd);
115
116// backend
117void R_ClearScreen(qbool fogcolor);
118
119/*
120===============================================================================
121
122CENTER PRINTING
123
124===============================================================================
125*/
126
128float scr_centertime_start; // for slow victory printing
135
136/*
137==============
138SCR_CenterPrint
139
140Called for important messages that should stay in the center of the screen
141for a few moments
142==============
143*/
144void SCR_CenterPrint(const char *str)
145{
148
149 // Print the message to the console and update the scr buffer
150 // but only if it's different to the previous message
151 if (strcmp(str, scr_centerstring) == 0)
152 return;
155 if (str[0] == '\0') // happens when stepping out of a centreprint trigger on alk1.2 start.bsp
156 return;
157 Con_CenterPrint(str);
158
159// count the number of lines for centering
160 while (*str)
161 {
162 if (*str == '\n')
164 str++;
165 }
166}
167
168/*
169============
170SCR_Centerprint_f
171
172Print something to the center of the screen using SCR_Centerprint
173============
174*/
176{
177 char msg[MAX_INPUTLINE];
178 unsigned int i, c, p;
179
180 c = Cmd_Argc(cmd);
181 if(c >= 2)
182 {
183 // Merge all the cprint arguments into one string
184 dp_strlcpy(msg, Cmd_Argv(cmd,1), sizeof(msg));
185 for(i = 2; i < c; ++i)
186 {
187 dp_strlcat(msg, " ", sizeof(msg));
188 dp_strlcat(msg, Cmd_Argv(cmd, i), sizeof(msg));
189 }
190
191 c = (unsigned int)strlen(msg);
192 for(p = 0, i = 0; i < c; ++i)
193 {
194 if(msg[i] == '\\')
195 {
196 if(msg[i+1] == 'n')
197 msg[p++] = '\n';
198 else if(msg[i+1] == '\\')
199 msg[p++] = '\\';
200 else {
201 msg[p++] = '\\';
202 msg[p++] = msg[i+1];
203 }
204 ++i;
205 } else {
206 msg[p++] = msg[i];
207 }
208 }
209 msg[p] = '\0';
210 SCR_CenterPrint(msg);
211 }
212}
213
214static void SCR_DrawCenterString (void)
215{
216 char *start;
217 int x, y;
218 int remaining;
219 int color;
220
221 if(cl.intermission == 2) // in finale,
222 if(sb_showscores) // make TAB hide the finale message (sb_showscores overrides finale in sbar.c)
223 return;
224
226 return;
227
228// the finale prints the characters one at a time, except if printspeed is an absurdly high value
229 if (cl.intermission && scr_printspeed.value > 0 && scr_printspeed.value < 1000000)
230 remaining = (int)(scr_printspeed.value * (cl.time - scr_centertime_start));
231 else
232 remaining = 9999;
233
235 start = scr_centerstring;
236
237 if (remaining < 1)
238 return;
239
240 if (scr_center_lines <= 4)
241 y = (int)(vid_conheight.integer*0.35);
242 else
243 y = 48;
244
245 color = -1;
246 do
247 {
248 // scan the number of characters on the line, not counting color codes
249 char *newline = strchr(start, '\n');
250 int l = newline ? (newline - start) : (int)strlen(start);
251 float width = DrawQ_TextWidth(start, l, 8, 8, false, FONT_CENTERPRINT);
252
253 x = (int) (vid_conwidth.integer - width)/2;
254 if (l > 0)
255 {
256 if (remaining < l)
257 l = remaining;
258 DrawQ_String(x, y, start, l, 8, 8, 1, 1, 1, 1, 0, &color, false, FONT_CENTERPRINT);
259 remaining -= l;
260 if (remaining <= 0)
261 return;
262 }
263 y += 8;
264
265 if (!newline)
266 break;
267 start = newline + 1; // skip the \n
268 } while (1);
269}
270
272{
275
276 if (cl.time > cl.oldtime)
278
279 // don't draw if this is a normal stats-screen intermission,
280 // only if it is not an intermission, or a finale intermission
281 if (cl.intermission == 1)
282 return;
284 return;
285 if (key_dest != key_game)
286 return;
287
289}
290
291static void SCR_DrawNetGraph_DrawGraph (int graphx, int graphy, int graphwidth, int graphheight, float graphscale, int graphlimit, const char *label, float textsize, int packetcounter, netgraphitem_t *netgraph)
292{
293 netgraphitem_t *graph;
294 int j, x, y;
295 int totalbytes = 0;
296 char bytesstring[128];
297 float g[NETGRAPH_PACKETS][7];
298 float *a;
299 float *b;
300 DrawQ_Fill(graphx, graphy, graphwidth, graphheight + textsize * 2, 0, 0, 0, 0.5, 0);
301 // draw the bar graph itself
302 memset(g, 0, sizeof(g));
303 for (j = 0;j < NETGRAPH_PACKETS;j++)
304 {
305 graph = netgraph + j;
306 g[j][0] = 1.0f - 0.25f * (host.realtime - graph->time);
307 g[j][1] = 1.0f;
308 g[j][2] = 1.0f;
309 g[j][3] = 1.0f;
310 g[j][4] = 1.0f;
311 g[j][5] = 1.0f;
312 g[j][6] = 1.0f;
314 g[j][1] = 0.00f;
315 else if (graph->unreliablebytes == NETGRAPH_CHOKEDPACKET)
316 g[j][2] = 0.90f;
317 else
318 {
319 if(netgraph[j].time >= netgraph[(j+NETGRAPH_PACKETS-1)%NETGRAPH_PACKETS].time)
320 if(graph->unreliablebytes + graph->reliablebytes + graph->ackbytes >= graphlimit * (netgraph[j].time - netgraph[(j+NETGRAPH_PACKETS-1)%NETGRAPH_PACKETS].time))
321 g[j][2] = 0.98f;
322 g[j][3] = 1.0f - graph->unreliablebytes * graphscale;
323 g[j][4] = g[j][3] - graph->reliablebytes * graphscale;
324 g[j][5] = g[j][4] - graph->ackbytes * graphscale;
325 // count bytes in the last second
326 if (host.realtime - graph->time < 1.0f)
327 totalbytes += graph->unreliablebytes + graph->reliablebytes + graph->ackbytes;
328 }
329 if(graph->cleartime >= 0)
330 g[j][6] = 0.5f + 0.5f * (2.0 / M_PI) * atan((M_PI / 2.0) * (graph->cleartime - graph->time));
331 g[j][1] = bound(0.0f, g[j][1], 1.0f);
332 g[j][2] = bound(0.0f, g[j][2], 1.0f);
333 g[j][3] = bound(0.0f, g[j][3], 1.0f);
334 g[j][4] = bound(0.0f, g[j][4], 1.0f);
335 g[j][5] = bound(0.0f, g[j][5], 1.0f);
336 g[j][6] = bound(0.0f, g[j][6], 1.0f);
337 }
338 // render the lines for the graph
339 for (j = 0;j < NETGRAPH_PACKETS;j++)
340 {
341 a = g[j];
342 b = g[(j+1)%NETGRAPH_PACKETS];
343 if (a[0] < 0.0f || b[0] > 1.0f || b[0] < a[0])
344 continue;
345 DrawQ_Line(1, graphx + graphwidth * a[0], graphy + graphheight * a[2], graphx + graphwidth * b[0], graphy + graphheight * b[2], 1.0f, 1.0f, 1.0f, 1.0f, 0);
346 DrawQ_Line(1, graphx + graphwidth * a[0], graphy + graphheight * a[1], graphx + graphwidth * b[0], graphy + graphheight * b[1], 1.0f, 0.0f, 0.0f, 1.0f, 0);
347 DrawQ_Line(1, graphx + graphwidth * a[0], graphy + graphheight * a[5], graphx + graphwidth * b[0], graphy + graphheight * b[5], 0.0f, 1.0f, 0.0f, 1.0f, 0);
348 DrawQ_Line(1, graphx + graphwidth * a[0], graphy + graphheight * a[4], graphx + graphwidth * b[0], graphy + graphheight * b[4], 1.0f, 1.0f, 1.0f, 1.0f, 0);
349 DrawQ_Line(1, graphx + graphwidth * a[0], graphy + graphheight * a[3], graphx + graphwidth * b[0], graphy + graphheight * b[3], 1.0f, 0.5f, 0.0f, 1.0f, 0);
350 DrawQ_Line(1, graphx + graphwidth * a[0], graphy + graphheight * a[6], graphx + graphwidth * b[0], graphy + graphheight * b[6], 0.0f, 0.0f, 1.0f, 1.0f, 0);
351 }
352 x = graphx;
353 y = graphy + graphheight;
354 dpsnprintf(bytesstring, sizeof(bytesstring), "%i", totalbytes);
355 DrawQ_String(x, y, label , 0, textsize, textsize, 1.0f, 1.0f, 1.0f, 1.0f, 0, NULL, false, FONT_DEFAULT);y += textsize;
356 DrawQ_String(x, y, bytesstring, 0, textsize, textsize, 1.0f, 1.0f, 1.0f, 1.0f, 0, NULL, false, FONT_DEFAULT);y += textsize;
357}
358
359/*
360==============
361SCR_DrawNetGraph
362==============
363*/
364static void SCR_DrawNetGraph (void)
365{
366 int i, separator1, separator2, graphwidth, graphheight, netgraph_x, netgraph_y, textsize, index, netgraphsperrow, graphlimit;
367 float graphscale;
368 netconn_t *c;
369 char vabuf[1024];
370
371 if (cls.state != ca_connected)
372 return;
373 if (!cls.netcon)
374 return;
375 if (!net_graph.integer)
376 return;
377
378 separator1 = 2;
379 separator2 = 4;
380 textsize = 8;
381 graphwidth = 120;
382 graphheight = 70;
383 graphscale = 1.0f / 1500.0f;
384 graphlimit = cl_rate.integer;
385
386 netgraphsperrow = (vid_conwidth.integer + separator2) / (graphwidth * 2 + separator1 + separator2);
387 netgraphsperrow = max(netgraphsperrow, 1);
388
389 index = 0;
390 netgraph_x = (vid_conwidth.integer + separator2) - (1 + (index % netgraphsperrow)) * (graphwidth * 2 + separator1 + separator2);
391 netgraph_y = (vid_conheight.integer - 48 - sbar_info_pos.integer + separator2) - (1 + (index / netgraphsperrow)) * (graphheight + textsize + separator2);
392 c = cls.netcon;
393 SCR_DrawNetGraph_DrawGraph(netgraph_x , netgraph_y, graphwidth, graphheight, graphscale, graphlimit, "incoming", textsize, c->incoming_packetcounter, c->incoming_netgraph);
394 SCR_DrawNetGraph_DrawGraph(netgraph_x + graphwidth + separator1, netgraph_y, graphwidth, graphheight, graphscale, graphlimit, "outgoing", textsize, c->outgoing_packetcounter, c->outgoing_netgraph);
395 index++;
396
397 if (sv.active && net_graph.integer >= 2)
398 {
399 for (i = 0;i < svs.maxclients;i++)
400 {
401 c = svs.clients[i].netconnection;
402 if (!c)
403 continue;
404 netgraph_x = (vid_conwidth.integer + separator2) - (1 + (index % netgraphsperrow)) * (graphwidth * 2 + separator1 + separator2);
405 netgraph_y = (vid_conheight.integer - 48 + separator2) - (1 + (index / netgraphsperrow)) * (graphheight + textsize + separator2);
406 SCR_DrawNetGraph_DrawGraph(netgraph_x , netgraph_y, graphwidth, graphheight, graphscale, graphlimit, va(vabuf, sizeof(vabuf), "%s", svs.clients[i].name), textsize, c->outgoing_packetcounter, c->outgoing_netgraph);
407 SCR_DrawNetGraph_DrawGraph(netgraph_x + graphwidth + separator1, netgraph_y, graphwidth, graphheight, graphscale, graphlimit, "" , textsize, c->incoming_packetcounter, c->incoming_netgraph);
408 index++;
409 }
410 }
411}
412
413/*
414==============
415SCR_DrawTurtle
416==============
417*/
418static void SCR_DrawTurtle (void)
419{
420 static int count;
421
422 if (cls.state != ca_connected)
423 return;
424
426 return;
427
428 if (cl.realframetime < 0.1)
429 {
430 count = 0;
431 return;
432 }
433
434 count++;
435 if (count < 3)
436 return;
437
438 DrawQ_Pic (0, 0, Draw_CachePic ("gfx/turtle"), 0, 0, 1, 1, 1, 1, 0);
439}
440
441/*
442==============
443SCR_DrawNet
444==============
445*/
446static void SCR_DrawNet (void)
447{
448 if (cls.state != ca_connected)
449 return;
451 return;
452 if (cls.demoplayback)
453 return;
454
455 DrawQ_Pic (64, 0, Draw_CachePic ("gfx/net"), 0, 0, 1, 1, 1, 1, 0);
456}
457
458/*
459==============
460DrawPause
461==============
462*/
463static void SCR_DrawPause (void)
464{
465 cachepic_t *pic;
466
467 if (cls.state != ca_connected)
468 return;
469
470 if (!scr_showpause.integer) // turn off for screenshots
471 return;
472
473 if (!cl.paused)
474 return;
475
476 pic = Draw_CachePic ("gfx/pause");
477 DrawQ_Pic ((vid_conwidth.integer - Draw_GetPicWidth(pic))/2, (vid_conheight.integer - Draw_GetPicHeight(pic))/2, pic, 0, 0, 1, 1, 1, 1, 0);
478}
479
480/*
481==============
482SCR_DrawBrand
483==============
484*/
485static void SCR_DrawBrand (void)
486{
487 cachepic_t *pic;
488 float x, y;
489
490 if (!scr_showbrand.value)
491 return;
492
493 pic = Draw_CachePic ("gfx/brand");
494
495 switch ((int)scr_showbrand.value)
496 {
497 case 1: // bottom left
498 x = 0;
500 break;
501 case 2: // bottom centre
502 x = (vid_conwidth.integer - Draw_GetPicWidth(pic)) / 2;
504 break;
505 case 3: // bottom right
508 break;
509 case 4: // centre right
512 break;
513 case 5: // top right
515 y = 0;
516 break;
517 case 6: // top centre
518 x = (vid_conwidth.integer - Draw_GetPicWidth(pic)) / 2;
519 y = 0;
520 break;
521 case 7: // top left
522 x = 0;
523 y = 0;
524 break;
525 case 8: // centre left
526 x = 0;
528 break;
529 default:
530 return;
531 }
532
533 DrawQ_Pic (x, y, pic, 0, 0, 1, 1, 1, 1, 0);
534}
535
536/*
537==============
538SCR_DrawQWDownload
539==============
540*/
542{
543 // sync with SCR_InfobarHeight
544 int len;
545 float x, y;
547 char temp[256];
548
549 if (!cls.qw_downloadname[0])
550 {
554 return 0;
555 }
557 {
561 }
563 dpsnprintf(temp, sizeof(temp), "Downloading %s %3i%% (%i) at %i bytes/s", cls.qw_downloadname, cls.qw_downloadpercent, cls.qw_downloadmemorycursize, cls.qw_downloadspeedrate);
564 else
565 dpsnprintf(temp, sizeof(temp), "Downloading %s %3i%% (%i/%i) at %i bytes/s", cls.qw_downloadname, cls.qw_downloadpercent, cls.qw_downloadmemorycursize, cls.qw_downloadmemorymaxsize, cls.qw_downloadspeedrate);
566 len = (int)strlen(temp);
567 x = (vid_conwidth.integer - DrawQ_TextWidth(temp, len, size, size, true, FONT_INFOBAR)) / 2;
569 DrawQ_Fill(0, y, vid_conwidth.integer, size, 0, 0, 0, cls.signon == SIGNONS ? 0.5 : 1, 0);
570 DrawQ_String(x, y, temp, len, size, size, 1, 1, 1, 1, 0, NULL, true, FONT_INFOBAR);
571 return size;
572}
573/*
574==============
575SCR_DrawInfobarString
576==============
577*/
579{
580 int len;
581 float x, y;
583
587 DrawQ_Fill(0, y, vid_conwidth.integer, size, 0, 0, 0, cls.signon == SIGNONS ? 0.5 : 1, 0);
588 DrawQ_String(x, y, scr_infobarstring, len, size, size, 1, 1, 1, 1, 0, NULL, false, FONT_INFOBAR);
589 return size;
590}
591
592/*
593==============
594SCR_DrawCurlDownload
595==============
596*/
598{
599 // sync with SCR_InfobarHeight
600 int len;
601 int nDownloads;
602 int i;
603 float x, y;
605 Curl_downloadinfo_t *downinfo;
606 char temp[256];
607 char addinfobuf[128];
608 const char *addinfo;
609
610 downinfo = Curl_GetDownloadInfo(&nDownloads, &addinfo, addinfobuf, sizeof(addinfobuf));
611 if(!downinfo)
612 return 0;
613
614 y = vid_conheight.integer - size * nDownloads - offset;
615
616 if(addinfo)
617 {
618 len = (int)strlen(addinfo);
619 x = (vid_conwidth.integer - DrawQ_TextWidth(addinfo, len, size, size, true, FONT_INFOBAR)) / 2;
620 DrawQ_Fill(0, y - size, vid_conwidth.integer, size, 1, 1, 1, cls.signon == SIGNONS ? 0.8 : 1, 0);
621 DrawQ_String(x, y - size, addinfo, len, size, size, 0, 0, 0, 1, 0, NULL, true, FONT_INFOBAR);
622 }
623
624 for(i = 0; i != nDownloads; ++i)
625 {
626 if(downinfo[i].queued)
627 dpsnprintf(temp, sizeof(temp), "Still in queue: %s", downinfo[i].filename);
628 else if(downinfo[i].progress <= 0)
629 dpsnprintf(temp, sizeof(temp), "Downloading %s ... ???.?%% @ %.1f KiB/s", downinfo[i].filename, downinfo[i].speed / 1024.0);
630 else
631 dpsnprintf(temp, sizeof(temp), "Downloading %s ... %5.1f%% @ %.1f KiB/s", downinfo[i].filename, 100.0 * downinfo[i].progress, downinfo[i].speed / 1024.0);
632 len = (int)strlen(temp);
633 x = (vid_conwidth.integer - DrawQ_TextWidth(temp, len, size, size, true, FONT_INFOBAR)) / 2;
634 DrawQ_Fill(0, y + i * size, vid_conwidth.integer, size, 0, 0, 0, cls.signon == SIGNONS ? 0.5 : 1, 0);
635 DrawQ_String(x, y + i * size, temp, len, size, size, 1, 1, 1, 1, 0, NULL, true, FONT_INFOBAR);
636 }
637
638 Z_Free(downinfo);
639
640 return size * (nDownloads + (addinfo ? 1 : 0));
641}
642
643/*
644==============
645SCR_DrawInfobar
646==============
647*/
648static void SCR_DrawInfobar(void)
649{
650 unsigned int offset = 0;
653 if(scr_infobartime_off > 0)
655 if(!offset && scr_loading)
658 Con_DPrintf("broken console margin calculation: %d != %d\n", offset, scr_con_margin_bottom);
659}
660
661static int SCR_InfobarHeight(void)
662{
663 int offset = 0;
664 Curl_downloadinfo_t *downinfo;
665 const char *addinfo;
666 int nDownloads;
667 char addinfobuf[128];
668
669 if (cl.time > cl.oldtime)
671 if(scr_infobartime_off > 0)
672 offset += 1;
673 if(cls.qw_downloadname[0])
674 offset += 1;
675
676 downinfo = Curl_GetDownloadInfo(&nDownloads, &addinfo, addinfobuf, sizeof(addinfobuf));
677 if(downinfo)
678 {
679 offset += (nDownloads + (addinfo ? 1 : 0));
680 Z_Free(downinfo);
681 }
683
684 return offset;
685}
686
687/*
688==============
689SCR_InfoBar_f
690==============
691*/
693{
694 if(Cmd_Argc(cmd) == 3)
695 {
696 scr_infobartime_off = atof(Cmd_Argv(cmd, 1));
698 }
699 else
700 {
701 Con_Printf("usage:\ninfobar expiretime \"string\"\n");
702 }
703}
704//=============================================================================
705
706/*
707==================
708SCR_SetUpToDrawConsole
709==================
710*/
711static void SCR_SetUpToDrawConsole (void)
712{
713#ifdef CONFIG_MENU
714 static int framecounter = 0;
715#endif
716
718
719#ifdef CONFIG_MENU
720 if (scr_menuforcewhiledisconnected.integer && key_dest == key_game && cls.state == ca_disconnected)
721 {
722 if (framecounter >= 2)
723 MR_ToggleMenu(1);
724 else
725 framecounter++;
726 }
727 else
728 framecounter = 0;
729#endif
730
735 else
736 key_consoleactive &= ~KEY_CONSOLEACTIVE_FORCED;
737
738 // decide on the height of the console
741 else
742 scr_con_current = 0; // none visible
743}
744
745/*
746==================
747SCR_DrawConsole
748==================
749*/
751{
752 // infobar and loading progress are not drawn simultaneously
757 {
758 // full screen
760 }
761 else if (scr_con_current)
763 else
764 con_vislines = 0;
765}
766
767//=============================================================================
768
769/*
770=================
771SCR_SizeUp_f
772
773Keybinding command
774=================
775*/
780
781
782/*
783=================
784SCR_SizeDown_f
785
786Keybinding command
787=================
788*/
793
794#ifdef CONFIG_VIDEO_CAPTURE
795void SCR_CaptureVideo_EndVideo(void);
796#endif
798{
799#ifdef CONFIG_VIDEO_CAPTURE
800 SCR_CaptureVideo_EndVideo();
801#endif
802}
803
805{
806 int i;
822#ifdef CONFIG_MENU
823 Cvar_RegisterVariable (&scr_menuforcewhiledisconnected);
824#endif
854#ifdef CONFIG_VIDEO_CAPTURE
855 Cvar_RegisterVariable (&cl_capturevideo);
856 Cvar_RegisterVariable (&cl_capturevideo_demo_stop);
857 Cvar_RegisterVariable (&cl_capturevideo_printfps);
858 Cvar_RegisterVariable (&cl_capturevideo_width);
859 Cvar_RegisterVariable (&cl_capturevideo_height);
860 Cvar_RegisterVariable (&cl_capturevideo_realtime);
861 Cvar_RegisterVariable (&cl_capturevideo_fps);
862 Cvar_RegisterVariable (&cl_capturevideo_nameformat);
863 Cvar_RegisterVariable (&cl_capturevideo_number);
864 Cvar_RegisterVariable (&cl_capturevideo_ogg);
865 Cvar_RegisterVariable (&cl_capturevideo_framestep);
866#endif
879 Cvar_RegisterVirtual(&net_graph, "shownetgraph");
885 for (i = 0;i < (int)(sizeof(r_speeds_graph_filter)/sizeof(r_speeds_graph_filter[0]));i++)
895
896 // if we want no console, turn it off here too
897 if (Sys_CheckParm ("-noconsole"))
899
900 Cmd_AddCommand(CF_CLIENT, "cprint", SCR_Centerprint_f, "print something at the screen center");
901 Cmd_AddCommand(CF_CLIENT, "sizeup",SCR_SizeUp_f, "increase view size (increases viewsize cvar)");
902 Cmd_AddCommand(CF_CLIENT, "sizedown",SCR_SizeDown_f, "decrease view size (decreases viewsize cvar)");
903 Cmd_AddCommand(CF_CLIENT, "screenshot",SCR_ScreenShot_f, "takes a screenshot of the next rendered frame");
904 Cmd_AddCommand(CF_CLIENT, "envmap", R_Envmap_f, "render a cubemap (skybox) of the current scene");
905 Cmd_AddCommand(CF_CLIENT, "infobar", SCR_InfoBar_f, "display a text in the infobar (usage: infobar expiretime string)");
906
907#ifdef CONFIG_VIDEO_CAPTURE
909#endif
910
911 scr_initialized = true;
912}
913
914/*
915==================
916SCR_ScreenShot_f
917==================
918*/
920{
921 static int shotnumber;
922 static char old_prefix_name[MAX_QPATH];
923 char prefix_name[MAX_QPATH];
924 char filename[MAX_QPATH];
925 unsigned char *buffer1;
926 unsigned char *buffer2;
927 qbool jpeg = (scr_screenshot_jpeg.integer != 0);
928 qbool png = (scr_screenshot_png.integer != 0) && !jpeg;
929 char vabuf[1024];
930
931 if (Cmd_Argc(cmd) == 2)
932 {
933 const char *ext;
934 dp_strlcpy(filename, Cmd_Argv(cmd, 1), sizeof(filename));
935 ext = FS_FileExtension(filename);
936 if (!strcasecmp(ext, "jpg"))
937 {
938 jpeg = true;
939 png = false;
940 }
941 else if (!strcasecmp(ext, "tga"))
942 {
943 jpeg = false;
944 png = false;
945 }
946 else if (!strcasecmp(ext, "png"))
947 {
948 jpeg = false;
949 png = true;
950 }
951 else
952 {
953 Con_Printf("screenshot: supplied filename must end in .jpg or .tga or .png\n");
954 return;
955 }
956 }
958 {
959 int shotnumber100;
960
961 // TODO maybe make capturevideo and screenshot use similar name patterns?
962 Sys_TimeString(vabuf, sizeof(vabuf), "%Y%m%d%H%M%S");
964 dpsnprintf(prefix_name, sizeof(prefix_name), "%s/%s%s", cl.worldbasename, scr_screenshot_name.string, vabuf);
965 else
966 dpsnprintf(prefix_name, sizeof(prefix_name), "%s%s", scr_screenshot_name.string, vabuf);
967
968 // find a file name to save it to
969 for (shotnumber100 = 0;shotnumber100 < 100;shotnumber100++)
970 if (!FS_SysFileExists(va(vabuf, sizeof(vabuf), "%s/screenshots/%s-%02d.tga", fs_gamedir, prefix_name, shotnumber100))
971 && !FS_SysFileExists(va(vabuf, sizeof(vabuf), "%s/screenshots/%s-%02d.jpg", fs_gamedir, prefix_name, shotnumber100))
972 && !FS_SysFileExists(va(vabuf, sizeof(vabuf), "%s/screenshots/%s-%02d.png", fs_gamedir, prefix_name, shotnumber100)))
973 break;
974 if (shotnumber100 >= 100)
975 {
976 Con_Print("Couldn't create the image file - already 100 shots taken this second!\n");
977 return;
978 }
979
980 dpsnprintf(filename, sizeof(filename), "screenshots/%s-%02d.%s", prefix_name, shotnumber100, jpeg ? "jpg" : png ? "png" : "tga");
981 }
982 else
983 {
984 // TODO maybe make capturevideo and screenshot use similar name patterns?
985 Sys_TimeString(vabuf, sizeof(vabuf), scr_screenshot_name.string);
987 dpsnprintf(prefix_name, sizeof(prefix_name), "%s/%s", cl.worldbasename, vabuf);
988 else
989 dpsnprintf(prefix_name, sizeof(prefix_name), "%s", vabuf);
990
991 // if prefix changed, gamedir or map changed, reset the shotnumber so
992 // we scan again
993 // FIXME: should probably do this whenever FS_Rescan or something like that occurs?
994 if (strcmp(old_prefix_name, prefix_name))
995 {
996 dpsnprintf(old_prefix_name, sizeof(old_prefix_name), "%s", prefix_name );
997 shotnumber = 0;
998 }
999
1000 // find a file name to save it to
1001 for (;shotnumber < 1000000;shotnumber++)
1002 if (!FS_SysFileExists(va(vabuf, sizeof(vabuf), "%s/screenshots/%s%06d.tga", fs_gamedir, prefix_name, shotnumber))
1003 && !FS_SysFileExists(va(vabuf, sizeof(vabuf), "%s/screenshots/%s%06d.jpg", fs_gamedir, prefix_name, shotnumber))
1004 && !FS_SysFileExists(va(vabuf, sizeof(vabuf), "%s/screenshots/%s%06d.png", fs_gamedir, prefix_name, shotnumber)))
1005 break;
1006 if (shotnumber >= 1000000)
1007 {
1008 Con_Print("Couldn't create the image file - you already have 1000000 screenshots!\n");
1009 return;
1010 }
1011
1012 dpsnprintf(filename, sizeof(filename), "screenshots/%s%06d.%s", prefix_name, shotnumber, jpeg ? "jpg" : png ? "png" : "tga");
1013
1014 shotnumber++;
1015 }
1016
1017 buffer1 = (unsigned char *)Mem_Alloc(tempmempool, vid.mode.width * vid.mode.height * 4);
1018 buffer2 = (unsigned char *)Mem_Alloc(tempmempool, vid.mode.width * vid.mode.height * (scr_screenshot_alpha.integer ? 4 : 3));
1019
1020 if (SCR_ScreenShot (filename, buffer1, buffer2, 0, 0, vid.mode.width, vid.mode.height, false, false, false, jpeg, png, true, scr_screenshot_alpha.integer != 0))
1021 Con_Printf("Wrote %s\n", filename);
1022 else
1023 {
1024 Con_Printf(CON_ERROR "Unable to write %s\n", filename);
1025 if(jpeg || png)
1026 {
1027 if(SCR_ScreenShot (filename, buffer1, buffer2, 0, 0, vid.mode.width, vid.mode.height, false, false, false, false, false, true, scr_screenshot_alpha.integer != 0))
1028 {
1029 dp_strlcpy(filename + strlen(filename) - 3, "tga", 4);
1030 Con_Printf("Wrote %s\n", filename);
1031 }
1032 }
1033 }
1034
1035 Mem_Free (buffer1);
1036 Mem_Free (buffer2);
1037}
1038
1039#ifdef CONFIG_VIDEO_CAPTURE
1040static void SCR_CaptureVideo_BeginVideo(void)
1041{
1042 double r, g, b;
1043 unsigned int i;
1044 int width = cl_capturevideo_width.integer, height = cl_capturevideo_height.integer;
1045 char timestring[128];
1046
1047 if (cls.capturevideo.active)
1048 return;
1049 memset(&cls.capturevideo, 0, sizeof(cls.capturevideo));
1050 // soundrate is figured out on the first SoundFrame
1051
1052 if(width == 0 && height != 0)
1053 width = (int) (height * (double)vid.mode.width / ((double)vid.mode.height * vid_pixelheight.value)); // keep aspect
1054 if(width != 0 && height == 0)
1055 height = (int) (width * ((double)vid.mode.height * vid_pixelheight.value) / (double)vid.mode.width); // keep aspect
1056
1057 if(width < 2 || width > vid.mode.width) // can't scale up
1058 width = vid.mode.width;
1059 if(height < 2 || height > vid.mode.height) // can't scale up
1061
1062 // ensure it's all even; if not, scale down a little
1063 if(width % 1)
1064 --width;
1065 if(height % 1)
1066 --height;
1067
1068 cls.capturevideo.width = width;
1069 cls.capturevideo.height = height;
1070 cls.capturevideo.active = true;
1071 cls.capturevideo.framerate = bound(1, cl_capturevideo_fps.value, 1001) * bound(1, cl_capturevideo_framestep.integer, 64);
1072 cls.capturevideo.framestep = cl_capturevideo_framestep.integer;
1073 cls.capturevideo.soundrate = S_GetSoundRate();
1074 cls.capturevideo.soundchannels = S_GetSoundChannels();
1075 cls.capturevideo.startrealtime = host.realtime;
1076 cls.capturevideo.frame = cls.capturevideo.lastfpsframe = 0;
1077 cls.capturevideo.starttime = cls.capturevideo.lastfpstime = host.realtime;
1078 cls.capturevideo.soundsampleframe = 0;
1079 cls.capturevideo.realtime = cl_capturevideo_realtime.integer != 0;
1080 cls.capturevideo.outbuffer = (unsigned char *)Mem_Alloc(tempmempool, width * height * 4 + 18); // +18 ?
1081 Sys_TimeString(timestring, sizeof(timestring), cl_capturevideo_nameformat.string);
1082 dpsnprintf(cls.capturevideo.basename, sizeof(cls.capturevideo.basename), "video/%s%03i", timestring, cl_capturevideo_number.integer);
1083 Cvar_SetValueQuick(&cl_capturevideo_number, cl_capturevideo_number.integer + 1);
1084
1085 // capture demos as fast as possible
1086 host.restless = !cls.capturevideo.realtime;
1087
1088 /*
1089 for (i = 0;i < 256;i++)
1090 {
1091 unsigned char j = (unsigned char)bound(0, 255*pow(i/255.0, gamma), 255);
1092 cls.capturevideo.rgbgammatable[0][i] = j;
1093 cls.capturevideo.rgbgammatable[1][i] = j;
1094 cls.capturevideo.rgbgammatable[2][i] = j;
1095 }
1096 */
1097/*
1098R = Y + 1.4075 * (Cr - 128);
1099G = Y + -0.3455 * (Cb - 128) + -0.7169 * (Cr - 128);
1100B = Y + 1.7790 * (Cb - 128);
1101Y = R * .299 + G * .587 + B * .114;
1102Cb = R * -.169 + G * -.332 + B * .500 + 128.;
1103Cr = R * .500 + G * -.419 + B * -.0813 + 128.;
1104*/
1105
1106 // identity gamma table
1107 BuildGammaTable16(1.0f, 1.0f, 1.0f, 0.0f, 1.0f, cls.capturevideo.vidramp, 256);
1108 BuildGammaTable16(1.0f, 1.0f, 1.0f, 0.0f, 1.0f, cls.capturevideo.vidramp + 256, 256);
1109 BuildGammaTable16(1.0f, 1.0f, 1.0f, 0.0f, 1.0f, cls.capturevideo.vidramp + 256*2, 256);
1111 {
1112 double igamma = 1 / scr_screenshot_gammaboost.value;
1113 for (i = 0;i < 256 * 3;i++)
1114 cls.capturevideo.vidramp[i] = (unsigned short) (0.5 + pow(cls.capturevideo.vidramp[i] * (1.0 / 65535.0), igamma) * 65535.0);
1115 }
1116
1117 for (i = 0;i < 256;i++)
1118 {
1119 r = 255*cls.capturevideo.vidramp[i]/65535.0;
1120 g = 255*cls.capturevideo.vidramp[i+256]/65535.0;
1121 b = 255*cls.capturevideo.vidramp[i+512]/65535.0;
1122 // NOTE: we have to round DOWN here, or integer overflows happen. Sorry for slightly wrong looking colors sometimes...
1123 // Y weights from RGB
1124 cls.capturevideo.rgbtoyuvscaletable[0][0][i] = (short)(r * 0.299);
1125 cls.capturevideo.rgbtoyuvscaletable[0][1][i] = (short)(g * 0.587);
1126 cls.capturevideo.rgbtoyuvscaletable[0][2][i] = (short)(b * 0.114);
1127 // Cb weights from RGB
1128 cls.capturevideo.rgbtoyuvscaletable[1][0][i] = (short)(r * -0.169);
1129 cls.capturevideo.rgbtoyuvscaletable[1][1][i] = (short)(g * -0.332);
1130 cls.capturevideo.rgbtoyuvscaletable[1][2][i] = (short)(b * 0.500);
1131 // Cr weights from RGB
1132 cls.capturevideo.rgbtoyuvscaletable[2][0][i] = (short)(r * 0.500);
1133 cls.capturevideo.rgbtoyuvscaletable[2][1][i] = (short)(g * -0.419);
1134 cls.capturevideo.rgbtoyuvscaletable[2][2][i] = (short)(b * -0.0813);
1135 // range reduction of YCbCr to valid signal range
1136 cls.capturevideo.yuvnormalizetable[0][i] = 16 + i * (236-16) / 256;
1137 cls.capturevideo.yuvnormalizetable[1][i] = 16 + i * (240-16) / 256;
1138 cls.capturevideo.yuvnormalizetable[2][i] = 16 + i * (240-16) / 256;
1139 }
1140
1142
1143 if (cl_capturevideo_ogg.integer)
1144 {
1146 {
1148 return;
1149 }
1150 else
1151 Con_Print("cl_capturevideo_ogg: libraries not available. Capturing in AVI instead.\n");
1152 }
1153
1155}
1156
1157void SCR_CaptureVideo_EndVideo(void)
1158{
1159 if (!cls.capturevideo.active)
1160 return;
1161 cls.capturevideo.active = false;
1162 host.restless = false;
1163
1164 Con_Printf("Finishing capture of %s.%s (%d frames, %d audio frames)\n", cls.capturevideo.basename, cls.capturevideo.formatextension, cls.capturevideo.frame, cls.capturevideo.soundsampleframe);
1165
1166 GL_CaptureVideo_EndVideo(); // must be called before writeEndVideo !
1167
1168 if (cls.capturevideo.videofile)
1169 cls.capturevideo.writeEndVideo();
1170
1171 if (cls.capturevideo.outbuffer)
1172 {
1173 Mem_Free (cls.capturevideo.outbuffer);
1174 cls.capturevideo.outbuffer = NULL;
1175 }
1176
1177 // If demo capture failed don't leave the demo playing.
1178 // CL_StopPlayback shuts down when demo capture finishes successfully.
1179 if (cls.capturevideo.error && Sys_CheckParm("-capturedemo"))
1181
1182 memset(&cls.capturevideo, 0, sizeof(cls.capturevideo));
1183}
1184
1186{
1187 cls.capturevideo.soundsampleframe += (int)length;
1188 cls.capturevideo.writeSoundFrame(paintbuffer, length);
1189}
1190
1191static void SCR_CaptureVideo(void)
1192{
1193 int newframenum;
1194 int newframestepframenum;
1195
1196 if (cl_capturevideo.integer)
1197 {
1198 if (!cls.capturevideo.active)
1199 SCR_CaptureVideo_BeginVideo();
1200 if (cls.capturevideo.error)
1201 {
1202 // specific error message was printed already
1203 Cvar_SetValueQuick(&cl_capturevideo, 0);
1204 SCR_CaptureVideo_EndVideo();
1205 return;
1206 }
1207
1208 if (cls.capturevideo.framerate != cl_capturevideo_fps.value * cl_capturevideo_framestep.integer)
1209 {
1210 Con_Printf(CON_WARN "You can not change the video framerate while recording a video.\n");
1211 Cvar_SetValueQuick(&cl_capturevideo_fps, cls.capturevideo.framerate / (double) cl_capturevideo_framestep.integer);
1212 }
1213 // for AVI saving we have to make sure that sound is saved before video
1214 if (cls.capturevideo.soundrate && !cls.capturevideo.soundsampleframe)
1215 return;
1216 if (cls.capturevideo.realtime)
1217 {
1218 // preserve sound sync by duplicating frames when running slow
1219 newframenum = (int)((host.realtime - cls.capturevideo.startrealtime) * cls.capturevideo.framerate);
1220 }
1221 else
1222 newframenum = cls.capturevideo.frame + 1;
1223 // if falling behind more than one second, stop
1224 if (newframenum - cls.capturevideo.frame > 60 * (int)ceil(cls.capturevideo.framerate))
1225 {
1226 Cvar_SetValueQuick(&cl_capturevideo, 0);
1227 Con_Printf(CON_ERROR "video saving failed on frame %i, your machine is too slow for this capture speed.\n", cls.capturevideo.frame);
1228 SCR_CaptureVideo_EndVideo();
1229 return;
1230 }
1231 // write frames
1232 newframestepframenum = newframenum / cls.capturevideo.framestep;
1233 if (newframestepframenum != cls.capturevideo.framestepframe)
1234 GL_CaptureVideo_VideoFrame(newframestepframenum);
1235 cls.capturevideo.framestepframe = newframestepframenum;
1236 // report progress
1237 if(cl_capturevideo_printfps.value && host.realtime > cls.capturevideo.lastfpstime + cl_capturevideo_printfps.value)
1238 {
1239 double fps1 = (cls.capturevideo.frame - cls.capturevideo.lastfpsframe) / (host.realtime - cls.capturevideo.lastfpstime + 0.0000001);
1240 double fps = (cls.capturevideo.frame ) / (host.realtime - cls.capturevideo.starttime + 0.0000001);
1241 Sys_Printf("captured %.1fs of video, last second %.3ffps (%.1fx), total %.3ffps (%.1fx)\n",
1242 cls.capturevideo.frame / cls.capturevideo.framerate,
1243 fps1, fps1 / cls.capturevideo.framerate,
1244 fps, fps / cls.capturevideo.framerate);
1245 cls.capturevideo.lastfpstime = host.realtime;
1246 cls.capturevideo.lastfpsframe = cls.capturevideo.frame;
1247 }
1248 cls.capturevideo.frame = newframenum;
1249 if (cls.capturevideo.error)
1250 {
1251 Cvar_SetValueQuick(&cl_capturevideo, 0);
1252 Con_Printf(CON_ERROR "video saving failed on frame %i, out of disk space? stopping video capture.\n", cls.capturevideo.frame);
1253 SCR_CaptureVideo_EndVideo();
1254 }
1255 }
1256 else if (cls.capturevideo.active)
1257 SCR_CaptureVideo_EndVideo();
1258}
1259#endif
1260
1261/*
1262===============
1263R_Envmap_f
1264
1265Grab six views for environment mapping tests
1266===============
1267*/
1269{
1270 float angles[3];
1271 const char *name;
1273}
1274envmapinfo[12] =
1275{
1276 {{ 0, 0, 0}, "rt", false, false, false},
1277 {{ 0, 270, 0}, "ft", false, false, false},
1278 {{ 0, 180, 0}, "lf", false, false, false},
1279 {{ 0, 90, 0}, "bk", false, false, false},
1280 {{-90, 180, 0}, "up", true, true, false},
1281 {{ 90, 180, 0}, "dn", true, true, false},
1282
1283 {{ 0, 0, 0}, "px", true, true, true},
1284 {{ 0, 90, 0}, "py", false, true, false},
1285 {{ 0, 180, 0}, "nx", false, false, true},
1286 {{ 0, 270, 0}, "ny", true, false, false},
1287 {{-90, 180, 0}, "pz", false, false, true},
1288 {{ 90, 180, 0}, "nz", false, false, true}
1290
1292{
1293 int j, size;
1294 char filename[MAX_QPATH], basename[MAX_QPATH];
1295 unsigned char *buffer1;
1296 unsigned char *buffer2;
1297 r_rendertarget_t *rt;
1298
1299 if (Cmd_Argc(cmd) != 3)
1300 {
1301 Con_Print("envmap <basename> <size>: save out 6 cubic environment map images, usable with loadsky, note that size must one of 128, 256, 512, or 1024 and can't be bigger than your current resolution\n");
1302 return;
1303 }
1304
1305 if(cls.state != ca_connected) {
1306 Con_Printf("envmap: No map loaded\n");
1307 return;
1308 }
1309
1310 dp_strlcpy (basename, Cmd_Argv(cmd, 1), sizeof (basename));
1311 size = atoi(Cmd_Argv(cmd, 2));
1312 if (size != 128 && size != 256 && size != 512 && size != 1024)
1313 {
1314 Con_Print("envmap: size must be one of 128, 256, 512, or 1024\n");
1315 return;
1316 }
1317 if (size > vid.mode.width || size > vid.mode.height)
1318 {
1319 Con_Print("envmap: your resolution is not big enough to render that size\n");
1320 return;
1321 }
1322
1323 r_refdef.envmap = true;
1324
1326
1327 r_refdef.view.x = 0;
1328 r_refdef.view.y = 0;
1329 r_refdef.view.z = 0;
1332 r_refdef.view.depth = 1;
1334 r_refdef.view.isoverlay = false;
1335 r_refdef.view.ismain = true;
1336
1337 r_refdef.view.frustum_x = 1; // tan(45 * M_PI / 180.0);
1338 r_refdef.view.frustum_y = 1; // tan(45 * M_PI / 180.0);
1339 r_refdef.view.ortho_x = 90; // abused as angle by VM_CL_R_SetView
1340 r_refdef.view.ortho_y = 90; // abused as angle by VM_CL_R_SetView
1341
1342 buffer1 = (unsigned char *)Mem_Alloc(tempmempool, size * size * 4);
1343 buffer2 = (unsigned char *)Mem_Alloc(tempmempool, size * size * 3);
1344
1345 // TODO: use TEXTYPE_COLORBUFFER16F and output to .exr files as well?
1348 for (j = 0;j < 12;j++)
1349 {
1350 dpsnprintf(filename, sizeof(filename), "env/%s%s.tga", basename, envmapinfo[j].name);
1352 r_refdef.view.quality = 1;
1353 r_refdef.view.clear = true;
1354 R_Mesh_Start();
1355 R_RenderView(rt->fbo, rt->depthtexture, rt->colortexture[0], 0, 0, size, size);
1356 R_Mesh_Finish();
1357 SCR_ScreenShot(filename, buffer1, buffer2, 0, vid.mode.height - (r_refdef.view.y + r_refdef.view.height), size, size, envmapinfo[j].flipx, envmapinfo[j].flipy, envmapinfo[j].flipdiagonaly, false, false, false, false);
1358 }
1359
1360 Mem_Free (buffer1);
1361 Mem_Free (buffer2);
1362
1363 r_refdef.envmap = false;
1364}
1365
1366//=============================================================================
1367
1369{
1370 int i;
1371 char *lmplabel;
1373 for (i = 0;i < cl.num_showlmps;i++)
1374 if (cl.showlmps[i].isactive && strcmp(cl.showlmps[i].label, lmplabel) == 0)
1375 {
1376 cl.showlmps[i].isactive = false;
1377 return;
1378 }
1379}
1380
1382{
1383 int k;
1384 char lmplabel[256], picname[256];
1385 float x, y;
1386 dp_strlcpy (lmplabel,MSG_ReadString(&cl_message, cl_readstring, sizeof(cl_readstring)), sizeof (lmplabel));
1387 dp_strlcpy (picname, MSG_ReadString(&cl_message, cl_readstring, sizeof(cl_readstring)), sizeof (picname));
1388 if (gamemode == GAME_NEHAHRA) // LadyHavoc: nasty old legacy junk
1389 {
1392 }
1393 else
1394 {
1397 }
1399 {
1400 showlmp_t *oldshowlmps = cl.showlmps;
1401 cl.max_showlmps += 16;
1403 if (oldshowlmps)
1404 {
1405 if (cl.num_showlmps)
1406 memcpy(cl.showlmps, oldshowlmps, cl.num_showlmps * sizeof(showlmp_t));
1407 Mem_Free(oldshowlmps);
1408 }
1409 }
1410 for (k = 0;k < cl.max_showlmps;k++)
1411 if (cl.showlmps[k].isactive && !strcmp(cl.showlmps[k].label, lmplabel))
1412 break;
1413 if (k == cl.max_showlmps)
1414 for (k = 0;k < cl.max_showlmps;k++)
1415 if (!cl.showlmps[k].isactive)
1416 break;
1417 cl.showlmps[k].isactive = true;
1418 dp_strlcpy (cl.showlmps[k].label, lmplabel, sizeof (cl.showlmps[k].label));
1419 dp_strlcpy (cl.showlmps[k].pic, picname, sizeof (cl.showlmps[k].pic));
1420 cl.showlmps[k].x = x;
1421 cl.showlmps[k].y = y;
1422 cl.num_showlmps = max(cl.num_showlmps, k + 1);
1423}
1424
1426{
1427 int i;
1428 for (i = 0;i < cl.num_showlmps;i++)
1429 if (cl.showlmps[i].isactive)
1431}
1432
1433/*
1434==============================================================================
1435
1436 SCREEN SHOTS
1437
1438==============================================================================
1439*/
1440
1441// buffer1: 4*w*h
1442// buffer2: 3*w*h (or 4*w*h if screenshotting alpha too)
1443qbool SCR_ScreenShot(char *filename, unsigned char *buffer1, unsigned char *buffer2, int x, int y, int width, int height, qbool flipx, qbool flipy, qbool flipdiagonal, qbool jpeg, qbool png, qbool gammacorrect, qbool keep_alpha)
1444{
1445 int indices[4] = {0,1,2,3}; // BGRA
1446 qbool ret;
1447
1448 GL_ReadPixelsBGRA(x, y, width, height, buffer1);
1449
1450 if(gammacorrect && (scr_screenshot_gammaboost.value != 1))
1451 {
1452 int i;
1453 double igamma = 1.0 / scr_screenshot_gammaboost.value;
1454 unsigned short vidramp[256 * 3];
1455 // identity gamma table
1456 BuildGammaTable16(1.0f, 1.0f, 1.0f, 0.0f, 1.0f, vidramp, 256);
1457 BuildGammaTable16(1.0f, 1.0f, 1.0f, 0.0f, 1.0f, vidramp + 256, 256);
1458 BuildGammaTable16(1.0f, 1.0f, 1.0f, 0.0f, 1.0f, vidramp + 256*2, 256);
1460 {
1461 for (i = 0;i < 256 * 3;i++)
1462 vidramp[i] = (unsigned short) (0.5 + pow(vidramp[i] * (1.0 / 65535.0), igamma) * 65535.0);
1463 }
1464 for (i = 0;i < width*height*4;i += 4)
1465 {
1466 buffer1[i] = (unsigned char) (vidramp[buffer1[i] + 512] * 255.0 / 65535.0 + 0.5); // B
1467 buffer1[i+1] = (unsigned char) (vidramp[buffer1[i+1] + 256] * 255.0 / 65535.0 + 0.5); // G
1468 buffer1[i+2] = (unsigned char) (vidramp[buffer1[i+2]] * 255.0 / 65535.0 + 0.5); // R
1469 // A
1470 }
1471 }
1472
1473 if(keep_alpha && !jpeg)
1474 {
1475 if(!png)
1476 flipy = !flipy; // TGA: not preflipped
1477 Image_CopyMux (buffer2, buffer1, width, height, flipx, flipy, flipdiagonal, 4, 4, indices);
1478 if (png)
1479 ret = PNG_SaveImage_preflipped (filename, width, height, true, buffer2);
1480 else
1481 ret = Image_WriteTGABGRA(filename, width, height, buffer2);
1482 }
1483 else
1484 {
1485 if(jpeg)
1486 {
1487 indices[0] = 2;
1488 indices[2] = 0; // RGB
1489 }
1490 Image_CopyMux (buffer2, buffer1, width, height, flipx, flipy, flipdiagonal, 3, 4, indices);
1491 if (jpeg)
1492 ret = JPEG_SaveImage_preflipped (filename, width, height, buffer2);
1493 else if (png)
1494 ret = PNG_SaveImage_preflipped (filename, width, height, false, buffer2);
1495 else
1496 ret = Image_WriteTGABGR_preflipped (filename, width, height, buffer2);
1497 }
1498
1499 return ret;
1500}
1501
1502//=============================================================================
1503
1506
1508{
1509 int i;
1511 cachepic_t *pic;
1512 for (i = 0, a = scr_touchscreenareas;i < scr_numtouchscreenareas;i++, a++)
1513 {
1514 if (vid_touchscreen_outlinealpha.value > 0 && a->rect[0] >= 0 && a->rect[1] >= 0 && a->rect[2] >= 4 && a->rect[3] >= 4)
1515 {
1516 DrawQ_Fill(a->rect[0] + 2, a->rect[1] , a->rect[2] - 4, 1 , 1, 1, 1, vid_touchscreen_outlinealpha.value * (0.5f + 0.5f * a->active), 0);
1517 DrawQ_Fill(a->rect[0] + 1, a->rect[1] + 1, a->rect[2] - 2, 1 , 1, 1, 1, vid_touchscreen_outlinealpha.value * (0.5f + 0.5f * a->active), 0);
1518 DrawQ_Fill(a->rect[0] , a->rect[1] + 2, 2 , a->rect[3] - 2, 1, 1, 1, vid_touchscreen_outlinealpha.value * (0.5f + 0.5f * a->active), 0);
1519 DrawQ_Fill(a->rect[0] + a->rect[2] - 2, a->rect[1] + 2, 2 , a->rect[3] - 2, 1, 1, 1, vid_touchscreen_outlinealpha.value * (0.5f + 0.5f * a->active), 0);
1520 DrawQ_Fill(a->rect[0] + 1, a->rect[1] + a->rect[3] - 2, a->rect[2] - 2, 1 , 1, 1, 1, vid_touchscreen_outlinealpha.value * (0.5f + 0.5f * a->active), 0);
1521 DrawQ_Fill(a->rect[0] + 2, a->rect[1] + a->rect[3] - 1, a->rect[2] - 4, 1 , 1, 1, 1, vid_touchscreen_outlinealpha.value * (0.5f + 0.5f * a->active), 0);
1522 }
1524 if (Draw_IsPicLoaded(pic))
1525 DrawQ_Pic(a->rect[0], a->rect[1], pic, a->rect[2], a->rect[3], 1, 1, 1, vid_touchscreen_overlayalpha.value * (0.5f + 0.5f * a->active), 0);
1526 if (a->text && a->text[0])
1527 {
1528 int textwidth = DrawQ_TextWidth(a->text, 0, a->textheight, a->textheight, false, FONT_CHAT);
1529 DrawQ_String(a->rect[0] + (a->rect[2] - textwidth) * 0.5f, a->rect[1] + (a->rect[3] - a->textheight) * 0.5f, a->text, 0, a->textheight, a->textheight, 1.0f, 1.0f, 1.0f, vid_touchscreen_overlayalpha.value, 0, NULL, false, FONT_CHAT);
1530 }
1531 }
1532}
1533
1534void R_ClearScreen(qbool fogcolor)
1535{
1536 float clearcolor[4];
1538 // clear to transparency (so png screenshots can contain alpha channel, useful for building model pictures)
1539 Vector4Set(clearcolor, 0.0f, 0.0f, 0.0f, 0.0f);
1540 else
1541 // clear to opaque black (if we're being composited it might otherwise render as transparent)
1542 Vector4Set(clearcolor, 0.0f, 0.0f, 0.0f, 1.0f);
1543 if (fogcolor && r_fog_clear.integer)
1544 {
1545 R_UpdateFog();
1546 VectorCopy(r_refdef.fogcolor, clearcolor);
1547 }
1548 // clear depth is 1.0
1549 // clear the screen
1551}
1552
1554extern cvar_t v_isometric;
1556
1557typedef struct loadingscreenstack_s
1558{
1559 struct loadingscreenstack_s *prev;
1560 char msg[MAX_QPATH];
1561 float absolute_loading_amount_min; // this corresponds to relative completion 0 of this item
1562 float absolute_loading_amount_len; // this corresponds to relative completion 1 of this item
1563 float relative_completion; // 0 .. 1
1564}
1567rtexture_t *loadingscreentexture = NULL; // last framebuffer before loading screen, kept for the background
1573char cl_connect_status[MAX_QPATH]; // should match size of loadingscreenstack_t msg[]
1574
1575static void SCR_DrawLoadingScreen(void);
1576static void SCR_DrawScreen (void)
1577{
1578 Draw_Frame();
1579 DrawQ_Start();
1580 R_Mesh_Start();
1582
1583 // Quake uses clockwise winding, so these are swapped
1586
1587 if (!scr_loading && cls.signon == SIGNONS)
1588 {
1589 float size;
1590
1591 size = scr_viewsize.value * (1.0 / 100.0);
1592 size = min(size, 1);
1593
1595 {
1596 r_refdef.view.width = (int)(vid.mode.width * size / 2.5);
1597 r_refdef.view.height = (int)(vid.mode.height * size / 2.5 * (1 - bound(0, r_letterbox.value, 100) / 100));
1598 r_refdef.view.depth = 1;
1599 r_refdef.view.x = (int)((vid.mode.width - r_refdef.view.width * 2.5) * 0.5);
1601 r_refdef.view.z = 0;
1602 if (r_stereo_side)
1603 r_refdef.view.x += (int)(r_refdef.view.width * 1.5);
1604 }
1606 {
1607 r_refdef.view.width = (int)(vid.mode.width * size / 2);
1608 r_refdef.view.height = (int)(vid.mode.height * size * (1 - bound(0, r_letterbox.value, 100) / 100));
1609 r_refdef.view.depth = 1;
1610 r_refdef.view.x = (int)((vid.mode.width - r_refdef.view.width * 2.0)/2);
1612 r_refdef.view.z = 0;
1613 if (r_stereo_side)
1615 }
1616 else if (r_stereo_vertical.integer)
1617 {
1619 r_refdef.view.height = (int)(vid.mode.height * size * (1 - bound(0, r_letterbox.value, 100) / 100) / 2);
1620 r_refdef.view.depth = 1;
1622 r_refdef.view.y = (int)((vid.mode.height - r_refdef.view.height * 2.0)/2);
1623 r_refdef.view.z = 0;
1624 if (r_stereo_side)
1626 }
1627 else
1628 {
1630 r_refdef.view.height = (int)(vid.mode.height * size * (1 - bound(0, r_letterbox.value, 100) / 100));
1631 r_refdef.view.depth = 1;
1634 r_refdef.view.z = 0;
1635 }
1636
1637 // LadyHavoc: viewzoom (zoom in for sniper rifles, etc)
1638 // LadyHavoc: this is designed to produce widescreen fov values
1639 // when the screen is wider than 4/3 width/height aspect, to do
1640 // this it simply assumes the requested fov is the vertical fov
1641 // for a 4x3 display, if the ratio is not 4x3 this makes the fov
1642 // higher/lower according to the ratio
1644 r_refdef.view.frustum_y = tan(scr_fov.value * M_PI / 360.0) * (3.0 / 4.0) * cl.viewzoom;
1646
1649 r_refdef.view.ortho_x = atan(r_refdef.view.frustum_x) * (360.0 / M_PI); // abused as angle by VM_CL_R_SetView
1650 r_refdef.view.ortho_y = atan(r_refdef.view.frustum_y) * (360.0 / M_PI); // abused as angle by VM_CL_R_SetView
1651
1652 r_refdef.view.ismain = true;
1653
1654 // if CSQC is loaded, it is required to provide the CSQC_UpdateView function,
1655 // and won't render a view if it does not call that.
1656 if (CLVM_prog->loaded && !(CLVM_prog->flag & PRVM_CSQC_SIMPLE))
1658 else
1659 {
1660 // Prepare the scene mesh for rendering - this is lightning beams and other effects rendered as normal surfaces
1662
1665 }
1666 }
1667
1668 // Don't apply debugging stuff like r_showsurfaces to the UI
1669 r_refdef.view.showdebug = false;
1670
1672 {
1675 r_refdef.view.depth = 1;
1676 r_refdef.view.x = 0;
1677 r_refdef.view.y = 0;
1678 r_refdef.view.z = 0;
1680 }
1681
1683 {
1684 const char *t;
1685 int framenum;
1687 while (*t)
1688 {
1689 while (*t == ' ')
1690 t++;
1691 if (!*t)
1692 break;
1693 framenum = atof(t);
1694 if (framenum == cls.td_frames)
1695 break;
1696 while (*t && *t != ' ')
1697 t++;
1698 }
1699 if (*t)
1700 {
1701 // we need to take a screenshot of this frame...
1702 char filename[MAX_QPATH];
1703 unsigned char *buffer1;
1704 unsigned char *buffer2;
1705 dpsnprintf(filename, sizeof(filename), "timedemoscreenshots/%s%06d.tga", cls.demoname, cls.td_frames);
1706 buffer1 = (unsigned char *)Mem_Alloc(tempmempool, vid.mode.width * vid.mode.height * 4);
1707 buffer2 = (unsigned char *)Mem_Alloc(tempmempool, vid.mode.width * vid.mode.height * 3);
1708 SCR_ScreenShot(filename, buffer1, buffer2, 0, 0, vid.mode.width, vid.mode.height, false, false, false, false, false, true, false);
1709 Mem_Free(buffer1);
1710 Mem_Free(buffer2);
1711 }
1712 }
1713
1714 // draw 2D stuff
1715
1718 Con_DrawNotify (); // only draw notify in game
1719
1721 host.paused = true;
1722 else
1723 host.paused = false;
1724
1725 if (!scr_loading && cls.signon == SIGNONS)
1726 {
1727 SCR_DrawNet ();
1728 SCR_DrawTurtle ();
1729 SCR_DrawPause ();
1730 if (!r_letterbox.value)
1731 {
1732 Sbar_Draw();
1733 if (CLVM_prog->loaded && CLVM_prog->flag & PRVM_CSQC_SIMPLE)
1734 CL_VM_DrawHud(r_stereo_side ? 0.0 : max(0.0, cl.time - cl.oldtime));
1735 }
1738 }
1740#ifdef CONFIG_MENU
1741 if(!scr_loading)
1742 MR_Draw();
1743#endif
1744 CL_DrawVideo();
1746
1747 if (scr_loading)
1748 {
1749 // connect_status replaces any dummy_status
1750 if ((!loadingscreenstack || loadingscreenstack->msg[0] == '\0') && cl_connect_status[0] != '\0')
1751 {
1752 loadingscreenstack_t connect_status, *og_ptr = loadingscreenstack;
1753
1754 connect_status.absolute_loading_amount_min = 0;
1755 dp_strlcpy(connect_status.msg, cl_connect_status, sizeof(cl_connect_status));
1756 loadingscreenstack = &connect_status;
1758 loadingscreenstack = og_ptr;
1759 }
1760 else
1762 }
1763
1766
1767 if (!scr_loading)
1768 {
1769 SCR_DrawBrand();
1771 }
1773 R_TimeReport("2d");
1774
1777
1778 if(!scr_loading)
1779 Sbar_ShowFPS();
1780
1781 R_Mesh_Finish();
1782 DrawQ_Finish();
1784}
1785
1792
1795{
1796 int w, h;
1797 float loadingscreentexture_w;
1798 float loadingscreentexture_h;
1799
1801
1802 w = vid.mode.width; h = vid.mode.height;
1803 loadingscreentexture_w = loadingscreentexture_h = 1;
1804
1807
1813 loadingscreentexture_texcoord2f[0] = 0;loadingscreentexture_texcoord2f[1] = loadingscreentexture_h;
1814 loadingscreentexture_texcoord2f[2] = loadingscreentexture_w;loadingscreentexture_texcoord2f[3] = loadingscreentexture_h;
1815 loadingscreentexture_texcoord2f[4] = loadingscreentexture_w;loadingscreentexture_texcoord2f[5] = 0;
1817}
1818
1831
1832/*
1833===============
1834SCR_BeginLoadingPlaque
1835
1836================
1837*/
1839{
1840 loadingscreenstack_t dummy_status;
1841
1842 // we need to push a dummy status so CL_UpdateScreen knows we have things to load...
1843 if (!loadingscreenstack)
1844 {
1845 dummy_status.msg[0] = '\0';
1846 dummy_status.absolute_loading_amount_min = 0;
1847 loadingscreenstack = &dummy_status;
1848 }
1849
1850 SCR_DeferLoadingPlaque(startup);
1854
1855 if (loadingscreenstack == &dummy_status)
1857}
1858
1860{
1861 SCR_ChooseLoadingPic(startup);
1862 scr_loading = true;
1863}
1864
1866{
1867 scr_loading = false;
1869}
1870
1871//=============================================================================
1872
1873void SCR_PushLoadingScreen (const char *msg, float len_in_parent)
1874{
1878
1879 dp_strlcpy(s->msg, msg, sizeof(s->msg));
1880 s->relative_completion = 0;
1881
1882 if(s->prev)
1883 {
1884 s->absolute_loading_amount_min = s->prev->absolute_loading_amount_min + s->prev->absolute_loading_amount_len * s->prev->relative_completion;
1885 s->absolute_loading_amount_len = s->prev->absolute_loading_amount_len * len_in_parent;
1886 if(s->absolute_loading_amount_len > s->prev->absolute_loading_amount_min + s->prev->absolute_loading_amount_len - s->absolute_loading_amount_min)
1887 s->absolute_loading_amount_len = s->prev->absolute_loading_amount_min + s->prev->absolute_loading_amount_len - s->absolute_loading_amount_min;
1888 }
1889 else
1890 {
1893 }
1894
1895 if (scr_loading)
1897}
1898
1900{
1902
1903 if(!s)
1904 {
1905 Con_DPrintf("Popping a loading screen item from an empty stack!\n");
1906 return;
1907 }
1908
1910 if(s->prev)
1911 s->prev->relative_completion = (s->absolute_loading_amount_min + s->absolute_loading_amount_len - s->prev->absolute_loading_amount_min) / s->prev->absolute_loading_amount_len;
1912 Z_Free(s);
1913
1914 if (scr_loading && redraw)
1916}
1917
1919{
1920 while(loadingscreenstack)
1922}
1923
1925{
1926 float x;
1927 size_t len;
1928 float total;
1929
1930 total = 0;
1931#if 0
1932 if(s)
1933 {
1934 total += SCR_DrawLoadingStack_r(s->prev, y, 8);
1935 y -= total;
1936 if(!s->prev || strcmp(s->msg, s->prev->msg))
1937 {
1938 len = strlen(s->msg);
1939 x = (vid_conwidth.integer - DrawQ_TextWidth(s->msg, len, size, size, true, FONT_INFOBAR)) / 2;
1940 y -= size;
1941 DrawQ_String(x, y, s->msg, len, size, size, 1, 1, 1, 1, 0, NULL, true, FONT_INFOBAR);
1942 total += size;
1943 }
1944 }
1945#else
1946 if(s)
1947 {
1948 len = strlen(s->msg);
1949 x = (vid_conwidth.integer - DrawQ_TextWidth(s->msg, len, size, size, true, FONT_INFOBAR)) / 2;
1950 y -= size;
1951 DrawQ_String(x, y, s->msg, len, size, size, 1, 1, 1, 1, 0, NULL, true, FONT_INFOBAR);
1952 total += size;
1953 }
1954#endif
1955 return total;
1956}
1957
1958static void SCR_DrawLoadingStack(void)
1959{
1960 float verts[12];
1961 float colors[16];
1962
1965 {
1966 // height = 32; // sorry, using the actual one is ugly
1968 GL_DepthRange(0, 1);
1969 GL_PolygonOffset(0, 0);
1970 GL_DepthTest(false);
1971 //R_Mesh_ResetTextureState();
1972 verts[2] = verts[5] = verts[8] = verts[11] = 0;
1973 verts[0] = verts[9] = 0;
1976 verts[7] = verts[10] = vid_conheight.integer;
1977
1978#if _MSC_VER >= 1400
1979#define sscanf sscanf_s
1980#endif
1981 colors[0] = 0; colors[1] = 0; colors[2] = 0; colors[3] = 1;
1982 colors[4] = 0; colors[5] = 0; colors[6] = 0; colors[7] = 1;
1983 sscanf(scr_loadingscreen_barcolor.string, "%f %f %f", &colors[8], &colors[9], &colors[10]); colors[11] = 1;
1984 sscanf(scr_loadingscreen_barcolor.string, "%f %f %f", &colors[12], &colors[13], &colors[14]); colors[15] = 1;
1985
1989 }
1990}
1991
1992static void SCR_DrawLoadingScreen (void)
1993{
1994 cachepic_t *loadingscreenpic;
1995 float loadingscreenpic_vertex3f[12];
1996 float loadingscreenpic_texcoord2f[8];
1997 float x, y, w, h, sw, sh, f;
1998 char vabuf[1024];
1999
2001 GL_DepthRange(0, 1);
2002 GL_PolygonOffset(0, 0);
2003 GL_DepthTest(false);
2004 GL_Color(1,1,1,1);
2005
2007 {
2009 R_SetupShader_Generic(loadingscreentexture, false, true, true);
2011 }
2012
2014 w = Draw_GetPicWidth(loadingscreenpic);
2015 h = Draw_GetPicHeight(loadingscreenpic);
2016
2017 // apply scale
2020
2021 // apply scale base
2023 {
2026 }
2027
2028 // apply scale limit
2030 sh = h / vid_conheight.integer;
2031 f = 1;
2033 {
2034 case 1:
2035 f = max(sw, sh);
2036 break;
2037 case 2:
2038 f = min(sw, sh);
2039 break;
2040 case 3:
2041 f = sw;
2042 break;
2043 case 4:
2044 f = sh;
2045 break;
2046 }
2047 if(f > 1)
2048 {
2049 w /= f;
2050 h /= f;
2051 }
2052
2053 x = (vid_conwidth.integer - w)/2;
2054 y = (vid_conheight.integer - h)/2;
2055 loadingscreenpic_vertex3f[2] = loadingscreenpic_vertex3f[5] = loadingscreenpic_vertex3f[8] = loadingscreenpic_vertex3f[11] = 0;
2056 loadingscreenpic_vertex3f[0] = loadingscreenpic_vertex3f[9] = x;
2057 loadingscreenpic_vertex3f[1] = loadingscreenpic_vertex3f[4] = y;
2058 loadingscreenpic_vertex3f[3] = loadingscreenpic_vertex3f[6] = x + w;
2059 loadingscreenpic_vertex3f[7] = loadingscreenpic_vertex3f[10] = y + h;
2060 loadingscreenpic_texcoord2f[0] = 0;loadingscreenpic_texcoord2f[1] = 0;
2061 loadingscreenpic_texcoord2f[2] = 1;loadingscreenpic_texcoord2f[3] = 0;
2062 loadingscreenpic_texcoord2f[4] = 1;loadingscreenpic_texcoord2f[5] = 1;
2063 loadingscreenpic_texcoord2f[6] = 0;loadingscreenpic_texcoord2f[7] = 1;
2064
2065 R_Mesh_PrepareVertices_Generic_Arrays(4, loadingscreenpic_vertex3f, NULL, loadingscreenpic_texcoord2f);
2066 R_SetupShader_Generic(Draw_GetPicTexture(loadingscreenpic), true, true, false);
2068
2070}
2071
2076
2081
2082static void SCR_UpdateVars(void)
2083{
2084 float conwidth = bound(160, vid_conwidth.value, 32768);
2085 float conheight = bound(90, vid_conheight.value, 24576);
2086 float conscale = vid.mode.height / vid_conheight.value;
2088 conwidth = floor(conheight * vid.mode.width / (vid.mode.height * vid_pixelheight.value));
2089 if (vid_conwidth.value != conwidth)
2090 Cvar_SetValueQuick(&vid_conwidth, conwidth);
2091 if (vid_conheight.value != conheight)
2092 Cvar_SetValueQuick(&vid_conheight, conheight);
2093 if (scr_sbarscale.value != conscale)
2095
2096 // bound viewsize
2097 if (scr_viewsize.value < 30)
2099 if (scr_viewsize.value > 120)
2101
2102 // bound field of view
2103 if (scr_fov.value < 1)
2105 if (scr_fov.value > 170)
2107
2108 // intermission is always full screen
2109 if (cl.intermission)
2110 sb_lines = 0;
2111 else
2112 {
2113 if (scr_viewsize.value >= 120)
2114 sb_lines = 0; // no status bar at all
2115 else if (scr_viewsize.value >= 110)
2116 sb_lines = 24; // no inventory
2117 else
2118 sb_lines = 24 + 16 + 8;
2119 }
2120}
2121
2122extern cvar_t cl_minfps;
2123extern cvar_t cl_minfps_fade;
2129extern cvar_t cl_minfps_force;
2131{
2132 static double cl_updatescreen_quality = 1;
2133
2134 vec3_t vieworigin;
2135 static double drawscreenstart = 0.0;
2136 double drawscreendelta;
2137 r_viewport_t viewport;
2138
2139 // TODO: Move to a better place.
2141
2142 if(drawscreenstart)
2143 {
2144 drawscreendelta = Sys_DirtyTime() - drawscreenstart;
2145#ifdef CONFIG_VIDEO_CAPTURE
2146 if (cl_minfps.value > 0 && (cl_minfps_force.integer || !(cls.timedemo || (cls.capturevideo.active && !cls.capturevideo.realtime))) && drawscreendelta >= 0 && drawscreendelta < 60)
2147#else
2148 if (cl_minfps.value > 0 && (cl_minfps_force.integer || !cls.timedemo) && drawscreendelta >= 0 && drawscreendelta < 60)
2149#endif
2150 {
2151 // quality adjustment according to render time
2152 double actualframetime;
2153 double targetframetime;
2154 double adjust;
2155 double f;
2156 double h;
2157
2158 // fade lastdrawscreentime
2160
2161 // find actual and target frame times
2162 actualframetime = r_refdef.lastdrawscreentime;
2163 targetframetime = (1.0 / cl_minfps.value);
2164
2165 // we scale hysteresis by quality
2166 h = cl_updatescreen_quality * cl_minfps_qualityhysteresis.value;
2167
2168 // calculate adjustment assuming linearity
2169 f = cl_updatescreen_quality / actualframetime * cl_minfps_qualitymultiply.value;
2170 adjust = (targetframetime - actualframetime) * f;
2171
2172 // one sided hysteresis
2173 if(adjust > 0)
2174 adjust = max(0, adjust - h);
2175
2176 // adjust > 0 if:
2177 // (targetframetime - actualframetime) * f > h
2178 // ((1.0 / cl_minfps.value) - actualframetime) * (cl_updatescreen_quality / actualframetime * cl_minfps_qualitymultiply.value) > (cl_updatescreen_quality * cl_minfps_qualityhysteresis.value)
2179 // ((1.0 / cl_minfps.value) - actualframetime) * (cl_minfps_qualitymultiply.value / actualframetime) > cl_minfps_qualityhysteresis.value
2180 // (1.0 / cl_minfps.value) * (cl_minfps_qualitymultiply.value / actualframetime) - cl_minfps_qualitymultiply.value > cl_minfps_qualityhysteresis.value
2181 // (1.0 / cl_minfps.value) * (cl_minfps_qualitymultiply.value / actualframetime) > cl_minfps_qualityhysteresis.value + cl_minfps_qualitymultiply.value
2182 // (1.0 / cl_minfps.value) / actualframetime > (cl_minfps_qualityhysteresis.value + cl_minfps_qualitymultiply.value) / cl_minfps_qualitymultiply.value
2183 // (1.0 / cl_minfps.value) / actualframetime > 1.0 + cl_minfps_qualityhysteresis.value / cl_minfps_qualitymultiply.value
2184 // cl_minfps.value * actualframetime < 1.0 / (1.0 + cl_minfps_qualityhysteresis.value / cl_minfps_qualitymultiply.value)
2185 // actualframetime < 1.0 / cl_minfps.value / (1.0 + cl_minfps_qualityhysteresis.value / cl_minfps_qualitymultiply.value)
2186 // actualfps > cl_minfps.value * (1.0 + cl_minfps_qualityhysteresis.value / cl_minfps_qualitymultiply.value)
2187
2188 // adjust < 0 if:
2189 // (targetframetime - actualframetime) * f < 0
2190 // ((1.0 / cl_minfps.value) - actualframetime) * (cl_updatescreen_quality / actualframetime * cl_minfps_qualitymultiply.value) < 0
2191 // ((1.0 / cl_minfps.value) - actualframetime) < 0
2192 // -actualframetime) < -(1.0 / cl_minfps.value)
2193 // actualfps < cl_minfps.value
2194
2195 /*
2196 Con_Printf("adjust UP if fps > %f, adjust DOWN if fps < %f\n",
2197 cl_minfps.value * (1.0 + cl_minfps_qualityhysteresis.value / cl_minfps_qualitymultiply.value),
2198 cl_minfps.value);
2199 */
2200
2201 // don't adjust too much at once
2203
2204 // adjust!
2205 cl_updatescreen_quality += adjust;
2206 cl_updatescreen_quality = bound(max(0.01, cl_minfps_qualitymin.value), cl_updatescreen_quality, cl_minfps_qualitymax.value);
2207 }
2208 else
2209 {
2210 cl_updatescreen_quality = 1;
2212 }
2213 }
2214
2215 drawscreenstart = Sys_DirtyTime();
2216
2218
2220 return; // not initialized yet
2221
2223 {
2224 // play a bit with the palette (experimental)
2225 palette_rgb_pantscolormap[15][0] = (unsigned char) (128 + 127 * sin(cl.time / exp(1.0f) + 0.0f*M_PI/3.0f));
2226 palette_rgb_pantscolormap[15][1] = (unsigned char) (128 + 127 * sin(cl.time / exp(1.0f) + 2.0f*M_PI/3.0f));
2227 palette_rgb_pantscolormap[15][2] = (unsigned char) (128 + 127 * sin(cl.time / exp(1.0f) + 4.0f*M_PI/3.0f));
2228 palette_rgb_shirtcolormap[15][0] = (unsigned char) (128 + 127 * sin(cl.time / M_PI + 5.0f*M_PI/3.0f));
2229 palette_rgb_shirtcolormap[15][1] = (unsigned char) (128 + 127 * sin(cl.time / M_PI + 3.0f*M_PI/3.0f));
2230 palette_rgb_shirtcolormap[15][2] = (unsigned char) (128 + 127 * sin(cl.time / M_PI + 1.0f*M_PI/3.0f));
2233 }
2234
2235#ifdef CONFIG_VIDEO_CAPTURE
2236 if (vid_hidden && !cls.capturevideo.active
2237 && !cl_capturevideo.integer) // so we can start capturing while hidden
2238#else
2239 if (vid_hidden)
2240#endif
2241 {
2242 VID_Finish();
2243 return;
2244 }
2245
2246 if (scr_loading)
2247 {
2250 else if (scr_loadingscreen_maxfps.value > 0)
2251 {
2252 static double lastupdate;
2253 if (host.realtime - lastupdate < min(1.0f / scr_loadingscreen_maxfps.value, 0.1))
2254 return;
2255 lastupdate = host.realtime;
2256 }
2257 }
2258
2260
2263
2265 R_HDR_UpdateIrisAdaptation(vieworigin);
2266
2267 r_refdef.view.colormask[0] = 1;
2268 r_refdef.view.colormask[1] = 1;
2269 r_refdef.view.colormask[2] = 1;
2270
2272
2273#ifndef USE_GLES2
2275 qglDrawBuffer(GL_BACK);CHECKGLERROR
2276#endif
2277
2280 R_SetViewport(&viewport);
2281 GL_ScissorTest(false);
2282 GL_ColorMask(1,1,1,1);
2283 GL_DepthMask(true);
2284
2285 R_ClearScreen(false);
2286 r_refdef.view.clear = false;
2287 r_refdef.view.isoverlay = false;
2288
2289 // calculate r_refdef.view.quality
2290 r_refdef.view.quality = cl_updatescreen_quality;
2291
2293 {
2294 Con_Print("FIXME: scr_stipple not implemented\n");
2296 }
2297
2298#ifndef USE_GLES2
2299 if (R_Stereo_Active())
2300 {
2301 r_stereo_side = 0;
2302
2304 {
2305 r_refdef.view.colormask[0] = 1;
2306 r_refdef.view.colormask[1] = 0;
2307 r_refdef.view.colormask[2] = 0;
2308 }
2309
2310 if (vid.mode.stereobuffer)
2311 qglDrawBuffer(GL_BACK_RIGHT);
2312
2314
2315 r_stereo_side = 1;
2316 r_refdef.view.clear = true;
2317
2319 {
2320 r_refdef.view.colormask[0] = 0;
2323 }
2324
2325 if (vid.mode.stereobuffer)
2326 qglDrawBuffer(GL_BACK_LEFT);
2327
2329 r_stereo_side = 0;
2330 }
2331 else
2332#endif
2333 {
2334 r_stereo_side = 0;
2336 }
2337
2338#ifdef CONFIG_VIDEO_CAPTURE
2339 SCR_CaptureVideo();
2340#endif
2341
2342 qglFlush(); // ensure that the commands are submitted to the GPU before we do other things
2343 VID_Finish();
2344}
2345
2347{
2348}
void SCR_CaptureVideo_Avi_BeginVideo(void)
Definition cap_avi.c:496
void SCR_CaptureVideo_Ogg_Init(void)
Definition cap_ogg.c:577
void SCR_CaptureVideo_Ogg_BeginVideo(void)
Definition cap_ogg.c:921
qbool SCR_CaptureVideo_Ogg_Available(void)
Definition cap_ogg.c:593
cvar_t cl_rate
Definition cl_cmd.c:33
void CL_MeshEntities_Scene_FinalizeRenderEntity(void)
Definition cl_main.c:2605
client_state_t cl
Definition cl_main.c:117
client_static_t cls
Definition cl_main.c:116
void CL_UpdateEntityShading(void)
Definition cl_main.c:2777
char scr_infobarstring[MAX_INPUTLINE]
Definition cl_screen.c:133
cvar_t r_stereo_redcyan
Definition cl_screen.c:85
rtexturepool_t * r_main_texturepool
Definition gl_rmain.c:43
static void R_Envmap_f(cmd_state_t *cmd)
Definition cl_screen.c:1291
cvar_t scr_conscroll2_y
Definition cl_screen.c:31
void CL_Screen_NewMap(void)
Definition cl_screen.c:2346
static void SCR_DrawScreen(void)
Definition cl_screen.c:1576
cvar_t cl_minfps_qualitystepmax
Definition cl_main.c:106
qbool scr_initialized
Definition cl_screen.c:102
void SCR_BeginLoadingPlaque(qbool startup)
Definition cl_screen.c:1838
int r_stereo_side
Definition cl_screen.c:1553
cvar_t cl_minfps_qualitymin
Definition cl_main.c:103
unsigned int scr_con_current
Definition cl_screen.c:106
int cl_punchangle_applied
Definition view.c:149
static void SCR_ClearLoadingScreenTexture(void)
Definition cl_screen.c:1786
float scr_centertime_start
Definition cl_screen.c:128
cvar_t r_stereo_angle
Definition cl_screen.c:87
cvar_t scr_loadingscreen_barcolor
Definition cl_screen.c:50
static void SCR_UpdateVars(void)
Definition cl_screen.c:2082
cvar_t r_stereo_redgreen
Definition cl_screen.c:86
void SCR_CenterPrint(const char *str)
Definition cl_screen.c:144
cvar_t v_isometric_verticalfov
Definition view.c:98
static void SCR_DrawLoadingStack(void)
Definition cl_screen.c:1958
cvar_t scr_loadingscreen_scale
Definition cl_screen.c:44
qbool R_Stereo_ColorMasking(void)
Definition cl_screen.c:2072
void R_ClearScreen(qbool fogcolor)
Definition cl_screen.c:1534
struct envmapinfo_s envmapinfo[12]
static void SCR_ChooseLoadingPic(qbool startup)
Definition cl_screen.c:1819
cvar_t scr_loadingscreen_background
Definition cl_screen.c:43
cvar_t scr_screenshot_name_in_mapdir
Definition cl_screen.c:90
cvar_t scr_loadingscreen_picture
Definition cl_screen.c:47
cvar_t cl_minfps
Definition cl_main.c:100
qbool R_Stereo_Active(void)
Definition cl_screen.c:2077
static void SCR_DrawBrand(void)
Definition cl_screen.c:485
cvar_t scr_screenshot_timestamp
Definition cl_screen.c:64
static void SCR_DrawInfobar(void)
Definition cl_screen.c:648
cvar_t r_stereo_separation
Definition cl_screen.c:80
cvar_t scr_conbrightness
Definition cl_screen.c:25
cvar_t r_stereo_redblue
Definition cl_screen.c:84
void SCR_EndLoadingPlaque(void)
Definition cl_screen.c:1865
static void SCR_ScreenShot_f(cmd_state_t *cmd)
Definition cl_screen.c:919
cvar_t scr_conscroll2_x
Definition cl_screen.c:30
static void SCR_DrawTurtle(void)
Definition cl_screen.c:418
cvar_t scr_fov
Definition cl_screen.c:20
cvar_t scr_stipple
Definition cl_screen.c:88
int scr_center_lines
Definition cl_screen.c:130
void CL_Screen_Init(void)
Definition cl_screen.c:804
cvar_t cl_minfps_qualitymax
Definition cl_main.c:102
cvar_t scr_refresh
Definition cl_screen.c:89
static float loadingscreentexture_texcoord2f[8]
Definition cl_screen.c:1569
static void SCR_SizeDown_f(cmd_state_t *cmd)
Definition cl_screen.c:789
static unsigned int scr_con_margin_bottom
Definition cl_screen.c:107
void SHOWLMP_decodehide(void)
Definition cl_screen.c:1368
static void SCR_DrawNetGraph(void)
Definition cl_screen.c:364
static float loadingscreentexture_vertex3f[12]
Definition cl_screen.c:1568
void SCR_PopLoadingScreen(qbool redraw)
Definition cl_screen.c:1899
void CL_UpdateScreen(void)
Definition cl_screen.c:2130
cvar_t scr_loadingscreen_scale_base
Definition cl_screen.c:45
cvar_t scr_centertime
Definition cl_screen.c:37
cvar_t scr_conscroll3_y
Definition cl_screen.c:33
cvar_t v_isometric
Definition view.c:97
cvar_t scr_loadingscreen_barheight
Definition cl_screen.c:51
cvar_t scr_conforcewhiledisconnected
Definition cl_screen.c:26
static void SCR_SetLoadingScreenTexture(void)
Definition cl_screen.c:1794
void SCR_DrawConsole(void)
Definition cl_screen.c:750
void SHOWLMP_decodeshow(void)
Definition cl_screen.c:1381
cvar_t scr_screenshot_alpha
Definition cl_screen.c:63
cvar_t scr_conalphafactor
Definition cl_screen.c:22
cvar_t scr_screenshot_jpeg
Definition cl_screen.c:59
void SCR_PushLoadingScreen(const char *msg, float len_in_parent)
Definition cl_screen.c:1873
cvar_t cl_demo_mousegrab
Definition cl_screen.c:92
static void SCR_CheckDrawCenterString(void)
Definition cl_screen.c:271
cvar_t scr_conalpha
Definition cl_screen.c:21
float scr_infobartime_off
Definition cl_screen.c:134
static int SCR_InfobarHeight(void)
Definition cl_screen.c:661
int scr_numtouchscreenareas
Definition cl_screen.c:1504
cvar_t scr_showturtle
Definition cl_screen.c:39
void SCR_ClearLoadingScreen(qbool redraw)
Definition cl_screen.c:1918
cvar_t vid_touchscreen_outlinealpha
Definition cl_screen.c:94
cvar_t scr_viewsize
Definition cl_screen.c:19
static void SCR_DrawLoadingScreen(void)
Definition cl_screen.c:1992
cvar_t scr_loadingscreen_count
Definition cl_screen.c:48
cvar_t vid_conwidthauto
Definition cl_screen.c:55
cvar_t r_letterbox
Definition cl_screen.c:79
cvar_t scr_infobar_height
Definition cl_screen.c:53
cvar_t sbar_info_pos
Definition sbar.c:108
cvar_t vid_pixelheight
Definition cl_screen.c:58
cvar_t scr_conheight
Definition cl_screen.c:27
cvar_t scr_conscroll_x
Definition cl_screen.c:28
cvar_t net_graph
Definition cl_screen.c:91
static int SCR_DrawQWDownload(int offset)
Definition cl_screen.c:541
cvar_t scr_conscroll3_x
Definition cl_screen.c:32
void SHOWLMP_drawall(void)
Definition cl_screen.c:1425
int scr_erase_center
Definition cl_screen.c:132
void CL_Screen_Shutdown(void)
Definition cl_screen.c:797
cvar_t r_fog_clear
Definition gl_rmain.c:138
static void SCR_DrawNet(void)
Definition cl_screen.c:446
char scr_centerstring[MAX_INPUTLINE]
Definition cl_screen.c:127
cvar_t scr_conalpha2factor
Definition cl_screen.c:23
cvar_t scr_conscroll_y
Definition cl_screen.c:29
cvar_t scr_sbarscale
Definition cl_screen.c:54
cvar_t scr_showpause
Definition cl_screen.c:40
static void SCR_SetUpToDrawConsole(void)
Definition cl_screen.c:711
cvar_t scr_screenshot_gammaboost
Definition cl_screen.c:62
int con_vislines
Definition console.c:95
qbool SCR_ScreenShot(char *filename, unsigned char *buffer1, unsigned char *buffer2, int x, int y, int width, int height, qbool flipx, qbool flipy, qbool flipdiagonal, qbool jpeg, qbool png, qbool gammacorrect, qbool keep_alpha)
Definition cl_screen.c:1443
cvar_t r_stereo_vertical
Definition cl_screen.c:83
static float SCR_DrawLoadingStack_r(loadingscreenstack_t *s, float y, float size)
Definition cl_screen.c:1924
scr_touchscreenarea_t scr_touchscreenareas[128]
Definition cl_screen.c:1505
cvar_t scr_conalpha3factor
Definition cl_screen.c:24
cvar_t vid_conheight
Definition cl_screen.c:57
static void SCR_InfoBar_f(cmd_state_t *cmd)
Definition cl_screen.c:692
void SCR_DeferLoadingPlaque(qbool startup)
Definition cl_screen.c:1859
cvar_t scr_printspeed
Definition cl_screen.c:42
static int SCR_DrawInfobarString(int offset)
Definition cl_screen.c:578
rtexture_t * loadingscreentexture
Definition cl_screen.c:1567
qbool scr_loading
Definition cl_screen.c:104
static void SCR_DrawTouchscreenOverlay(void)
Definition cl_screen.c:1507
char cl_connect_status[MAX_QPATH]
User-friendly connection status for the menu and/or loading screen, colours and not supported.
Definition cl_screen.c:1573
cvar_t cl_minfps_force
Definition cl_main.c:107
cvar_t r_stereo_sidebyside
Definition cl_screen.c:81
cvar_t vid_touchscreen_overlayalpha
Definition cl_screen.c:95
cvar_t scr_screenshot_jpeg_quality
Definition cl_screen.c:60
cvar_t cl_minfps_fade
Definition cl_main.c:101
cvar_t scr_loadingscreen_maxfps
Definition cl_screen.c:52
cvar_t scr_loadingscreen_firstforstartup
Definition cl_screen.c:49
cvar_t vid_conwidth
Definition cl_screen.c:56
static loadingscreenstack_t * loadingscreenstack
Definition cl_screen.c:1566
cvar_t scr_loadingscreen_scale_limit
Definition cl_screen.c:46
int scr_erase_lines
Definition cl_screen.c:131
cvar_t timedemo_screenshotframelist
Definition cl_screen.c:93
static void SCR_DrawNetGraph_DrawGraph(int graphx, int graphy, int graphwidth, int graphheight, float graphscale, int graphlimit, const char *label, float textsize, int packetcounter, netgraphitem_t *netgraph)
Definition cl_screen.c:291
static void SCR_DrawPause(void)
Definition cl_screen.c:463
cvar_t scr_showbrand
Definition cl_screen.c:41
float scr_centertime_off
Definition cl_screen.c:129
static void SCR_SizeUp_f(cmd_state_t *cmd)
Definition cl_screen.c:776
cvar_t cl_minfps_qualityhysteresis
Definition cl_main.c:105
static void SCR_DrawCenterString(void)
Definition cl_screen.c:214
static int loadingscreenpic_number
Definition cl_screen.c:1570
cvar_t cl_minfps_qualitymultiply
Definition cl_main.c:104
int jpeg_supported
Definition cl_screen.c:100
cvar_t r_stereo_horizontal
Definition cl_screen.c:82
static int SCR_DrawCurlDownload(int offset)
Definition cl_screen.c:597
cvar_t scr_showram
Definition cl_screen.c:38
cvar_t scr_screenshot_png
Definition cl_screen.c:61
static void SCR_Centerprint_f(cmd_state_t *cmd)
Definition cl_screen.c:175
struct cvar_s scr_screenshot_name
Definition fs.c:455
void CL_DrawVideo(void)
Definition cl_video.c:460
qbool sb_showscores
Definition sbar.c:56
@ ca_connected
Definition client.h:532
@ ca_disconnected
Definition client.h:531
#define SIGNONS
Definition client.h:525
void Cmd_AddCommand(unsigned flags, const char *cmd_name, xcommand_t function, const char *description)
called by the init functions of other parts of the program to register commands and functions to call...
Definition cmd.c:1661
#define CF_READONLY
cvar cannot be changed from the console or the command buffer, and is considered CF_PERSISTENT
Definition cmd.h:54
static int Cmd_Argc(cmd_state_t *cmd)
Definition cmd.h:249
static const char * Cmd_Argv(cmd_state_t *cmd, int arg)
Cmd_Argv(cmd, ) will return an empty string (not a NULL) if arg > argc, so string operations are alwa...
Definition cmd.h:254
#define CF_CLIENT
cvar/command that only the client can change/execute
Definition cmd.h:48
#define CF_ARCHIVE
cvar should have its set value saved to config.cfg and persist across sessions
Definition cmd.h:53
gamemode_t gamemode
Definition com_game.c:26
#define IS_NEXUIZ_DERIVED(g)
Definition com_game.h:71
@ GAME_NEHAHRA
Definition com_game.h:32
char * MSG_ReadString(sizebuf_t *sb, char *string, size_t maxstring)
Definition com_msg.c:341
char * va(char *buf, size_t buflen, const char *format,...)
Definition common.c:972
int dpsnprintf(char *buffer, size_t buffersize, const char *format,...)
Returns the number of printed characters, excluding the final '\0' or returns -1 if the buffer isn't ...
Definition common.c:997
#define MSG_ReadShort
Definition common.h:191
@ PROTOCOL_QUAKEWORLD
quakeworld protocol
Definition common.h:145
#define dp_strlcat(dst, src, dsize)
Definition common.h:304
#define dp_strlcpy(dst, src, dsize)
Definition common.h:303
#define MSG_ReadByte(sb)
Definition common.h:188
void Con_CenterPrint(const char *str)
Prints a center-aligned message to the console.
Definition console.c:1655
void Con_Print(const char *msg)
Prints to all appropriate console targets, and adds timestamps.
Definition console.c:1504
void Con_DPrintf(const char *fmt,...)
A Con_Printf that only shows up if the "developer" cvar is set.
Definition console.c:1544
void Con_DrawNotify(void)
Definition console.c:1945
void Con_Printf(const char *fmt,...)
Prints to all appropriate console targets.
Definition console.c:1514
void Con_DrawConsole(int lines, qbool forcedfullscreen)
Definition console.c:2138
qbool con_initialized
Definition console.c:97
void Con_CheckResize(void)
If the line width has changed, reformat the buffer.
Definition console.c:763
#define CON_WARN
Definition console.h:101
#define CON_ERROR
Definition console.h:102
void CL_VM_DrawHud(double frametime)
Definition csprogs.c:541
qbool CL_VM_UpdateView(double frametime)
Definition csprogs.c:484
vector size
float time
void Cvar_SetValueQuick(cvar_t *var, float value)
Definition cvar.c:473
void Cvar_SetQuick(cvar_t *var, const char *value)
Definition cvar.c:436
void Cvar_RegisterVariable(cvar_t *variable)
registers a cvar that already has the name, string, and optionally the archive elements set.
Definition cvar.c:599
void Cvar_RegisterVirtual(cvar_t *variable, const char *name)
Definition cvar.c:513
vector color
cachepic_t * Draw_CachePic(const char *path)
Definition gl_draw.c:185
@ CACHEPICFLAG_FAILONMISSING
Definition draw.h:44
@ CACHEPICFLAG_NOTPERSISTENT
Definition draw.h:36
void DrawQ_Fill(float x, float y, float width, float height, float red, float green, float blue, float alpha, int flags)
Definition gl_draw.c:847
void DrawQ_Pic(float x, float y, cachepic_t *pic, float width, float height, float red, float green, float blue, float alpha, int flags)
Definition gl_draw.c:797
#define FONT_DEFAULT
Definition draw.h:128
void Draw_Frame(void)
Definition gl_draw.c:237
void DrawQ_Start(void)
Definition gl_draw.c:789
#define FONT_CHAT
Definition draw.h:132
void DrawQ_Finish(void)
Definition gl_draw.c:1456
float DrawQ_String(float x, float y, const char *text, size_t maxlen, float scalex, float scaley, float basered, float basegreen, float baseblue, float basealpha, int flags, int *outcolor, qbool ignorecolorcodes, const dp_font_t *fnt)
Definition gl_draw.c:1320
void DrawQ_Line(float width, float x1, float y1, float x2, float y2, float r, float g, float b, float alpha, int flags)
Definition gl_draw.c:1402
#define FONT_INFOBAR
Definition draw.h:134
cachepic_t * Draw_CachePic_Flags(const char *path, unsigned int cachepicflags)
Definition gl_draw.c:86
int Draw_GetPicWidth(cachepic_t *pic)
Definition gl_draw.c:197
float DrawQ_TextWidth(const char *text, size_t maxlen, float w, float h, qbool ignorecolorcodes, const dp_font_t *fnt)
Definition gl_draw.c:1330
rtexture_t * Draw_GetPicTexture(cachepic_t *pic)
Definition gl_draw.c:224
#define FONT_CENTERPRINT
Definition draw.h:133
int Draw_GetPicHeight(cachepic_t *pic)
Definition gl_draw.c:204
qbool Draw_IsPicLoaded(cachepic_t *pic)
Definition gl_draw.c:211
const char * FS_FileExtension(const char *in)
Definition fs.c:1403
char fs_gamedir[MAX_OSPATH]
Definition fs.c:443
static int(ZEXPORT *qz_inflate)(z_stream *strm
qbool FS_SysFileExists(const char *path)
Look for a file in the filesystem only.
Definition fs.c:3744
void R_Mesh_Start(void)
void GL_Clear(int mask, const float *colorvalue, float depthvalue, int stencilvalue)
void R_Mesh_CopyToTexture(rtexture_t *tex, int tx, int ty, int sx, int sy, int width, int height)
void GL_ColorMask(int r, int g, int b, int a)
unsigned short polygonelement3s[(POLYGONELEMENTS_MAXPOINTS-2) *3]
Definition gl_backend.c:241
void GL_DepthMask(int state)
void GL_ReadPixelsBGRA(int x, int y, int width, int height, unsigned char *outpixels)
void R_Mesh_Finish(void)
int polygonelement3i[(POLYGONELEMENTS_MAXPOINTS-2) *3]
Definition gl_backend.c:240
void R_Mesh_Draw(int firstvertex, int numvertices, int firsttriangle, int numtriangles, const int *element3i, const r_meshbuffer_t *element3i_indexbuffer, int element3i_bufferoffset, const unsigned short *element3s, const r_meshbuffer_t *element3s_indexbuffer, int element3s_bufferoffset)
void GL_DepthTest(int state)
void GL_DepthRange(float nearfrac, float farfrac)
void R_Mesh_SetRenderTargets(int fbo)
void GL_PolygonOffset(float planeoffset, float depthoffset)
void R_SetViewport(const r_viewport_t *v)
Definition gl_backend.c:897
void R_Viewport_InitOrtho(r_viewport_t *v, const matrix4x4_t *cameramatrix, int x, int y, int width, int height, float x1, float y1, float x2, float y2, float nearclip, float farclip, const float *nearplane)
Definition gl_backend.c:587
void GL_Color(float cr, float cg, float cb, float ca)
void GL_BlendFunc(int blendfunc1, int blendfunc2)
void R_Mesh_PrepareVertices_Generic_Arrays(int numvertices, const float *vertex3f, const float *color4f, const float *texcoord2f)
void GL_ScissorTest(int state)
void GL_CaptureVideo_BeginVideo(void)
void GL_CaptureVideo_EndVideo(void)
void GL_CaptureVideo_VideoFrame(int newframestepframenum)
void R_SetupShader_Generic_NoTexture(qbool usegamma, qbool notrippy)
Definition gl_rmain.c:1488
void R_RenderView(int fbo, rtexture_t *depthtexture, rtexture_t *colortexture, int x, int y, int width, int height)
Definition gl_rmain.c:5637
r_rendertarget_t * R_RenderTarget_Get(int texturewidth, int textureheight, textype_t depthtextype, qbool depthisrenderbuffer, textype_t colortextype0, textype_t colortextype1, textype_t colortextype2, textype_t colortextype3)
Definition gl_rmain.c:4564
void R_SetupShader_Generic(rtexture_t *t, qbool usegamma, qbool notrippy, qbool suppresstexalpha)
Definition gl_rmain.c:1461
void R_BufferData_NewFrame(void)
begin a new frame (recycle old buffers)
Definition gl_rmain.c:3678
void R_UpdateFog(void)
Definition gl_rmain.c:5396
void R_HDR_UpdateIrisAdaptation(const vec3_t point)
Definition gl_rmain.c:4144
void R_UpdateVariables(void)
Definition gl_rmain.c:5483
void R_RenderTarget_FreeUnused(qbool force)
Definition gl_rmain.c:4523
void R_FrameData_NewFrame(void)
prepare for a new frame, recycles old buffers if a resize occurred previously
Definition gl_rmain.c:3521
r_refdef_t r_refdef
Definition gl_rmain.c:57
void R_FreeTexture(rtexture_t *rt)
rtexture_t * R_LoadTexture2D(rtexturepool_t *rtexturepool, const char *identifier, int width, int height, const unsigned char *data, textype_t textype, int flags, int miplevel, const unsigned int *palette)
GLenum GLsizei width
Definition glquake.h:622
GLenum GLsizei GLsizei height
Definition glquake.h:622
#define CHECKGLERROR
Definition glquake.h:1059
GLubyte GLubyte GLubyte GLubyte w
Definition glquake.h:782
GLenum GLuint GLenum GLsizei length
Definition glquake.h:657
GLenum GLenum GLsizei count
Definition glquake.h:656
#define GL_SRC_ALPHA
Definition glquake.h:79
GLint GLenum GLint GLint y
Definition glquake.h:651
#define GL_BACK_LEFT
Definition glquake.h:130
#define GL_BACK
Definition glquake.h:133
GLint GLenum GLint x
Definition glquake.h:651
#define GL_COLOR_BUFFER_BIT
Definition glquake.h:171
GLsizei GLenum const GLvoid * indices
Definition glquake.h:674
GLuint GLuint GLintptr offset
Definition glquake.h:632
#define GL_ONE_MINUS_SRC_ALPHA
Definition glquake.h:80
#define GL_ONE
Definition glquake.h:74
#define GL_STENCIL_BUFFER_BIT
Definition glquake.h:170
const GLchar * name
Definition glquake.h:601
#define GL_FRONT
Definition glquake.h:132
#define GL_DEPTH_BUFFER_BIT
Definition glquake.h:169
GLuint index
Definition glquake.h:629
#define GL_BACK_RIGHT
Definition glquake.h:131
host_static_t host
Definition host.c:41
@ host_shutdown
states >= host_shutdown cause graceful shutdown, see Sys_HandleCrash() comments
Definition host.h:27
qbool Image_WriteTGABGR_preflipped(const char *filename, int width, int height, const unsigned char *data)
Definition image.c:1412
void Image_CopyMux(unsigned char *outpixels, const unsigned char *inpixels, int inputwidth, int inputheight, qbool inputflipx, qbool inputflipy, qbool inputflipdiagonal, int numoutputcomponents, int numinputcomponents, int *outputinputcomponentindices)
Definition image.c:24
qbool Image_WriteTGABGRA(const char *filename, int width, int height, const unsigned char *data)
Definition image.c:1436
qbool PNG_SaveImage_preflipped(const char *filename, int width, int height, qbool has_alpha, unsigned char *data)
Definition image_png.c:477
qbool JPEG_SaveImage_preflipped(const char *filename, int width, int height, unsigned char *data)
Definition jpeg.c:818
keydest_t key_dest
Definition keys.c:37
int key_consoleactive
Definition keys.c:38
#define KEY_CONSOLEACTIVE_USER
Definition keys.h:380
@ key_game
Definition keys.h:372
@ key_message
Definition keys.h:372
#define KEY_CONSOLEACTIVE_FORCED
Definition keys.h:382
Curl_downloadinfo_t * Curl_GetDownloadInfo(int *nDownloads, const char **additional_info, char *addinfo, size_t addinfolength)
Definition libcurl.c:1612
#define max(A, B)
Definition mathlib.h:38
#define min(A, B)
Definition mathlib.h:37
#define bound(min, num, max)
Definition mathlib.h:34
#define Vector4Set(vec, r, g, b, a)
Definition mathlib.h:86
#define VectorCopy(in, out)
Definition mathlib.h:101
#define M_PI
Definition mathlib.h:28
void Matrix4x4_CreateFromQuakeEntity(matrix4x4_t *out, double x, double y, double z, double pitch, double yaw, double roll, double scale)
Definition matrixlib.c:715
const matrix4x4_t identitymatrix
Definition matrixlib.c:9
void Matrix4x4_OriginFromMatrix(const matrix4x4_t *in, float *out)
Definition matrixlib.c:1792
void(* MR_ToggleMenu)(int mode)
Definition menu.c:5480
void(* MR_Draw)(void)
Definition menu.c:5479
float pow(float a, float b)
float ceil(float f)
float strlen(string s)
void cmd(string command,...)
float sin(float f)
float floor(float f)
sizebuf_t cl_message
Definition netconn.c:71
char cl_readstring[MAX_INPUTLINE]
Definition netconn.c:75
#define NETGRAPH_PACKETS
Definition netconn.h:222
#define NETGRAPH_CHOKEDPACKET
Definition netconn.h:225
#define NETGRAPH_LOSTPACKET
Definition netconn.h:224
unsigned char palette_rgb_pantscolormap[16][3]
Definition palette.c:8
unsigned char palette_rgb_pantsscoreboard[16][3]
Definition palette.c:10
unsigned char palette_rgb_shirtcolormap[16][3]
Definition palette.c:9
unsigned char palette_rgb_shirtscoreboard[16][3]
Definition palette.c:11
void BuildGammaTable16(float prescale, float gamma, float scale, float base, float contrastboost, unsigned short *out, int rampsize)
Definition palette.c:240
#define CLVM_prog
Definition progsvm.h:767
#define PRVM_CSQC_SIMPLE
Definition progsvm.h:239
int i
#define MAX_INPUTLINE
maximum size of console commandline, QuakeC strings, and many other text processing buffers
Definition qdefs.h:94
#define MAX_QPATH
max length of a quake game pathname
Definition qdefs.h:169
#define NULL
Definition qtypes.h:12
vec_t vec3_t[3]
Definition qtypes.h:71
bool qbool
Definition qtypes.h:9
void R_Shadow_EditLights_DrawSelectedLightProperties(void)
Definition r_shadow.c:5713
cvar_t r_speeds_graph_maxtimedelta
Definition r_stats.c:22
cvar_t r_speeds_graph_length
Definition r_stats.c:16
cvar_t r_speeds_graph_maxdefault
Definition r_stats.c:23
cvar_t r_speeds_graph
Definition r_stats.c:4
int r_timereport_active
Definition r_stats.c:189
cvar_t r_speeds_graph_filter[8]
Definition r_stats.c:5
void R_TimeReport(const char *desc)
Definition r_stats.c:193
cvar_t r_speeds_graph_width
Definition r_stats.c:20
cvar_t r_speeds_graph_height
Definition r_stats.c:21
cvar_t r_speeds_graph_seconds
Definition r_stats.c:17
void R_TimeReport_BeginFrame(void)
Definition r_stats.c:228
cvar_t r_speeds_graph_y
Definition r_stats.c:19
void R_TimeReport_EndFrame(void)
Definition r_stats.c:255
cvar_t r_speeds_graph_x
Definition r_stats.c:18
#define TEXF_FORCENEAREST
Definition r_textures.h:17
@ TEXTYPE_COLORBUFFER
Definition r_textures.h:84
@ TEXTYPE_UNUSED
Definition r_textures.h:46
@ TEXTYPE_DEPTHBUFFER24STENCIL8
Definition r_textures.h:94
#define TEXF_CLAMP
Definition r_textures.h:15
#define TEXF_RENDERTARGET
Definition r_textures.h:37
void Sbar_ShowFPS(void)
Definition sbar.c:1099
void Sbar_Draw(void)
called every frame by screen
Definition sbar.c:1372
int sb_lines
scan lines to draw
Definition sbar.c:58
void Sbar_ShowFPS_Update(void)
Definition sbar.c:1082
void SCR_CaptureVideo_SoundFrame(const struct portable_samplepair_s *paintbuffer, size_t length)
server_t sv
local server
Definition sv_main.c:223
server_static_t svs
persistant server info
Definition sv_main.c:224
dp_FragColor r
return ret
dp_FragColor g
precision highp float
Definition shader_glsl.h:53
float f
dp_FragColor b
vec4 sw
ret a
int S_GetSoundRate(void)
Definition snd_main.c:377
int S_GetSoundChannels(void)
Definition snd_main.c:382
static portable_sampleframe_t paintbuffer[PAINTBUFFER_SIZE]
Definition snd_mix.c:26
double oldtime
Definition client.h:868
int max_showlmps
Definition client.h:989
float last_received_message
Definition client.h:885
qbool paused
Definition client.h:842
char worldbasename[MAX_QPATH]
Definition client.h:898
int intermission
Definition client.h:856
double realframetime
Definition client.h:871
int islocalgame
Definition client.h:746
double time
Definition client.h:868
vec_t viewzoom
Definition client.h:794
showlmp_t * showlmps
Definition client.h:1001
qbool demoplayback
Definition client.h:587
int qw_downloadpercent
Definition client.h:653
qbool connect_trying
Definition client.h:609
qbool timedemo
Definition client.h:589
int qw_downloadspeedcount
Definition client.h:657
cactive_t state
Definition client.h:568
int qw_downloadspeedrate
Definition client.h:658
int qw_downloadmemorymaxsize
Definition client.h:651
netconn_t * netcon
Definition client.h:630
mempool_t * levelmempool
Definition client.h:571
int qw_downloadmemorycursize
Definition client.h:650
double qw_downloadspeedtime
Definition client.h:656
protocolversion_t protocol
Definition client.h:617
char qw_downloadname[MAX_QPATH]
Definition client.h:648
char demoname[MAX_QPATH]
Definition client.h:580
command interpreter state - the tokenizing and execution of commands, as well as pointers to which cv...
Definition cmd.h:127
Definition cvar.h:66
float value
Definition cvar.h:74
int integer
Definition cvar.h:73
const char * string
Definition cvar.h:71
float angles[3]
Definition cl_screen.c:1270
const char * name
Definition cl_screen.c:1271
qbool flipdiagonaly
Definition cl_screen.c:1272
qbool restless
don't sleep
Definition host.h:49
int state
Definition host.h:44
double realtime
the accumulated mainloop time since application started (with filtering), without any slowmo or clamp...
Definition host.h:46
qbool paused
global paused state, pauses both client and server
Definition host.h:50
float absolute_loading_amount_min
Definition cl_screen.c:1561
float absolute_loading_amount_len
Definition cl_screen.c:1562
char msg[MAX_QPATH]
Definition cl_screen.c:1560
struct loadingscreenstack_s * prev
Definition cl_screen.c:1559
int incoming_packetcounter
Definition netconn.h:226
int outgoing_packetcounter
Definition netconn.h:228
netgraphitem_t incoming_netgraph[NETGRAPH_PACKETS]
Definition netconn.h:227
netgraphitem_t outgoing_netgraph[NETGRAPH_PACKETS]
Definition netconn.h:229
double time
Definition netconn.h:134
double cleartime
Definition netconn.h:138
int unreliablebytes
Definition netconn.h:136
int reliablebytes
Definition netconn.h:135
exported for capturevideo so ogg can see all channels
Definition snd_main.h:196
float frustumscale_y
Definition render.h:403
double lastdrawscreentime
Definition render.h:462
r_refdef_view_t view
Definition render.h:406
float fogcolor[3]
Definition render.h:424
float frustumscale_x
Definition render.h:403
qbool envmap
Definition render.h:455
float frustum_y
Definition render.h:277
qbool clear
whether to call R_ClearScreen before rendering stuff
Definition render.h:305
qbool showdebug
Definition render.h:314
float quality
render quality (0 to 1) - affects r_drawparticles_drawdistance and others
Definition render.h:321
int cullface_back
Definition render.h:318
float frustum_x
Definition render.h:277
vec3_t origin
Definition render.h:267
int useperspective
if turned off it renders an ortho view
Definition render.h:280
qbool isoverlay
if true, don't clear or do any post process effects (bloom, etc)
Definition render.h:307
float ortho_x
Definition render.h:287
qbool ismain
if true, this is the MAIN view (which is, after CSQC, copied into the scene for use e....
Definition render.h:309
int colormask[4]
which color components to allow (for anaglyph glasses)
Definition render.h:299
matrix4x4_t matrix
Definition render.h:266
int cullface_front
Definition render.h:317
float ortho_y
Definition render.h:287
rtexture_t * depthtexture
Definition render.h:835
rtexture_t * colortexture[4]
Definition render.h:834
struct client_s * clients
client slots
Definition server.h:30
int maxclients
number of svs.clients slots (updated by maxplayers command)
Definition server.h:28
qbool active
false if only a net client
Definition server.h:66
qbool isactive
Definition client.h:731
float x
Definition client.h:732
char label[32]
Definition client.h:734
float y
Definition client.h:733
char pic[128]
Definition client.h:735
qbool stereobuffer
Definition vid.h:64
int width
Definition vid.h:60
int height
Definition vid.h:61
qbool stencil
Definition vid.h:74
viddef_mode_t mode
currently active video mode
Definition vid.h:73
size_t Sys_TimeString(char buf[], size_t bufsize, const char *timeformat)
Definition sys_shared.c:45
void Sys_Printf(const char *fmt,...)
used to report failures inside Con_Printf()
Definition sys_shared.c:652
double Sys_DirtyTime(void)
Definition sys_shared.c:417
int Sys_CheckParm(const char *parm)
Definition sys_shared.c:327
void VID_Finish(void)
Definition vid_null.c:32
viddef_t vid
global video state
Definition vid_shared.c:64
qbool vid_hidden
Definition vid_shared.c:74
mempool_t * tempmempool
Definition zone.c:794
#define Mem_Free(mem)
Definition zone.h:96
#define Mem_Alloc(pool, size)
Definition zone.h:92
#define Z_Malloc(size)
Definition zone.h:161
#define Z_Free(data)
Definition zone.h:164