cvar_t scr_stipple = {0, "scr_stipple", "0", "interlacing-like stippling of the display"};
cvar_t scr_refresh = {0, "scr_refresh", "1", "allows you to completely shut off rendering for benchmarking purposes"};
cvar_t shownetgraph = {CVAR_SAVE, "shownetgraph", "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)"};
+cvar_t cl_demo_mousegrab = {0, "cl_demo_mousegrab", "0", "Allows reading the mouse input while playing demos. Useful for camera mods developed in csqc. (0: never, 1: always)"};
#define AVI_MASTER_INDEX_SIZE 640 // GB ought to be enough for anyone
int scr_center_lines;
int scr_erase_lines;
int scr_erase_center;
+char scr_infobarstring[MAX_INPUTLINE];
+float scr_infobartime_off;
/*
==============
int l = newline ? (newline - start) : (int)strlen(start);
float width = DrawQ_TextWidth_Font(start, l, false, FONT_CENTERPRINT) * 8;
- x = (vid_conwidth.integer - width)/2;
+ x = (int) (vid_conwidth.integer - width)/2;
if (l > 0)
{
if (remaining < l)
*/
static int SCR_DrawQWDownload(int offset)
{
- // sync with SCR_DownloadHeight
+ // sync with SCR_InfobarHeight
int len;
float x, y;
float size = 8;
else
dpsnprintf(temp, sizeof(temp), "Downloading %s %3i%% (%i/%i) at %i bytes/s\n", cls.qw_downloadname, cls.qw_downloadpercent, cls.qw_downloadmemorycursize, cls.qw_downloadmemorymaxsize, cls.qw_downloadspeedrate);
len = (int)strlen(temp);
- x = (vid_conwidth.integer - DrawQ_TextWidth_Font(temp, len, 0, FONT_INFOBAR) * size) / 2;
+ x = (vid_conwidth.integer - DrawQ_TextWidth_Font(temp, len, true, FONT_INFOBAR) * size) / 2;
y = vid_conheight.integer - size - offset;
DrawQ_Fill(0, y, vid_conwidth.integer, size, 0, 0, 0, cls.signon == SIGNONS ? 0.5 : 1, 0);
DrawQ_String_Font(x, y, temp, len, size, size, 1, 1, 1, 1, 0, NULL, true, FONT_INFOBAR);
return 8;
}
+/*
+==============
+SCR_DrawInfobarString
+==============
+*/
+static int SCR_DrawInfobarString(int offset)
+{
+ int len;
+ float x, y;
+ float size = 8;
+
+ len = (int)strlen(scr_infobarstring);
+ x = (vid_conwidth.integer - DrawQ_TextWidth_Font(scr_infobarstring, len, false, FONT_INFOBAR) * size) / 2;
+ y = vid_conheight.integer - size - offset;
+ DrawQ_Fill(0, y, vid_conwidth.integer, size, 0, 0, 0, cls.signon == SIGNONS ? 0.5 : 1, 0);
+ DrawQ_String_Font(x, y, scr_infobarstring, len, size, size, 1, 1, 1, 1, 0, NULL, false, FONT_INFOBAR);
+ return 8;
+}
/*
==============
*/
static int SCR_DrawCurlDownload(int offset)
{
- // sync with SCR_DownloadHeight
+ // sync with SCR_InfobarHeight
int len;
int nDownloads;
int i;
if(addinfo)
{
len = (int)strlen(addinfo);
- x = (vid_conwidth.integer - DrawQ_TextWidth_Font(addinfo, len, false, FONT_INFOBAR) * size) / 2;
+ x = (vid_conwidth.integer - DrawQ_TextWidth_Font(addinfo, len, true, FONT_INFOBAR) * size) / 2;
DrawQ_Fill(0, y - size, vid_conwidth.integer, size, 1, 1, 1, cls.signon == SIGNONS ? 0.8 : 1, 0);
DrawQ_String_Font(x, y - size, addinfo, len, size, size, 0, 0, 0, 1, 0, NULL, true, FONT_INFOBAR);
}
else
dpsnprintf(temp, sizeof(temp), "Downloading %s ... %5.1f%% @ %.1f KiB/s\n", downinfo[i].filename, 100.0 * downinfo[i].progress, downinfo[i].speed / 1024.0);
len = (int)strlen(temp);
- x = (vid_conwidth.integer - DrawQ_TextWidth_Font(temp, len, false, FONT_INFOBAR) * size) / 2;
+ x = (vid_conwidth.integer - DrawQ_TextWidth_Font(temp, len, true, FONT_INFOBAR) * size) / 2;
DrawQ_Fill(0, y + i * size, vid_conwidth.integer, size, 0, 0, 0, cls.signon == SIGNONS ? 0.5 : 1, 0);
DrawQ_String_Font(x, y + i * size, temp, len, size, size, 1, 1, 1, 1, 0, NULL, true, FONT_INFOBAR);
}
/*
==============
-SCR_DrawDownload
+SCR_DrawInfobar
==============
*/
-static void SCR_DrawDownload()
+static void SCR_DrawInfobar()
{
int offset = 0;
+ if(scr_infobartime_off > 0)
+ offset += SCR_DrawInfobarString(offset);
offset += SCR_DrawQWDownload(offset);
offset += SCR_DrawCurlDownload(offset);
if(offset != scr_con_margin_bottom)
Con_DPrintf("broken console margin calculation: %d != %d\n", offset, scr_con_margin_bottom);
}
-static int SCR_DownloadHeight()
+static int SCR_InfobarHeight()
{
int offset = 0;
Curl_downloadinfo_t *downinfo;
const char *addinfo;
int nDownloads;
+ if (cl.time > cl.oldtime)
+ scr_infobartime_off -= cl.time - cl.oldtime;
+ if(scr_infobartime_off > 0)
+ offset += 8;
+
if(cls.qw_downloadname[0])
- offset += 0;
+ offset += 8;
downinfo = Curl_GetDownloadInfo(&nDownloads, &addinfo);
if(downinfo)
return offset;
}
+/*
+==============
+SCR_InfoBar_f
+==============
+*/
+void SCR_InfoBar_f(void)
+{
+ if(Cmd_Argc() == 3)
+ {
+ scr_infobartime_off = atof(Cmd_Argv(1));
+ strlcpy(scr_infobarstring, Cmd_Argv(2), sizeof(scr_infobarstring));
+ }
+ else
+ {
+ Con_Printf("usage:\ninfobar expiretime \"string\"\n");
+ }
+}
//=============================================================================
/*
*/
void SCR_DrawConsole (void)
{
- scr_con_margin_bottom = SCR_DownloadHeight();
+ scr_con_margin_bottom = SCR_InfobarHeight();
if (key_consoleactive & KEY_CONSOLEACTIVE_FORCED)
{
// full screen
Cvar_RegisterVariable(&scr_stipple);
Cvar_RegisterVariable(&scr_refresh);
Cvar_RegisterVariable(&shownetgraph);
+ Cvar_RegisterVariable(&cl_demo_mousegrab);
Cmd_AddCommand ("sizeup",SCR_SizeUp_f, "increase view size (increases viewsize cvar)");
Cmd_AddCommand ("sizedown",SCR_SizeDown_f, "decrease view size (decreases viewsize cvar)");
Cmd_AddCommand ("screenshot",SCR_ScreenShot_f, "takes a screenshot of the next rendered frame");
Cmd_AddCommand ("envmap", R_Envmap_f, "render a cubemap (skybox) of the current scene");
+ Cmd_AddCommand ("infobar", SCR_InfoBar_f, "display a text in the infobar (usage: infobar expiretime string)");
scr_initialized = true;
}
unsigned char *olddata;
olddata = buf->data;
buf->maxsize = max(buf->maxsize * 2, 4096);
- buf->data = Mem_Alloc(tempmempool, buf->maxsize);
+ buf->data = (unsigned char *) Mem_Alloc(tempmempool, buf->maxsize);
if(olddata)
{
memcpy(buf->data, olddata, oldsize);
for(i = 1; i <= denomMax; ++i)
{
- int inum = floor(0.5 + val * i);
+ int inum = (int) floor(0.5 + val * i);
double diff = fabs(val - inum / (double)i);
if(diff < bestdiff)
{
//else
{
cls.capturevideo.format = CAPTUREVIDEOFORMAT_AVI_I420;
- cls.capturevideo.videofile = FS_Open (va("%s.avi", cls.capturevideo.basename), "wb", false, true);
+ cls.capturevideo.videofile = FS_OpenRealFile(va("%s.avi", cls.capturevideo.basename), "wb", false);
SCR_CaptureVideo_RIFF_Start();
// enclosing RIFF chunk (there can be multiple of these in >1GB files, the later ones are "AVIX" instead of "AVI " and have no header/stream info)
SCR_CaptureVideo_RIFF_Push("RIFF", "AVI ");
area = (float)outw * (float)outh / (float)inw / (float)inh;
for(y = 0; y < outh; ++y)
{
- float iny0 = y / (float)outh * inh; int iny0_i = floor(iny0);
- float iny1 = (y+1) / (float)outh * inh; int iny1_i = ceil(iny1);
+ float iny0 = y / (float)outh * inh; int iny0_i = (int) floor(iny0);
+ float iny1 = (y+1) / (float)outh * inh; int iny1_i = (int) ceil(iny1);
for(x = 0; x < outw; ++x)
{
- float inx0 = x / (float)outw * inw; int inx0_i = floor(inx0);
- float inx1 = (x+1) / (float)outw * inw; int inx1_i = ceil(inx1);
+ float inx0 = x / (float)outw * inw; int inx0_i = (int) floor(inx0);
+ float inx1 = (x+1) / (float)outw * inw; int inx1_i = (int) ceil(inx1);
float r = 0, g = 0, b = 0, alpha = 0;
int xx, yy;
}
}
- out[4*(x + outw * y)+0] = r * area;
- out[4*(x + outw * y)+1] = g * area;
- out[4*(x + outw * y)+2] = b * area;
- out[4*(x + outw * y)+3] = alpha * area;
+ out[4*(x + outw * y)+0] = (unsigned char) (r * area);
+ out[4*(x + outw * y)+1] = (unsigned char) (g * area);
+ out[4*(x + outw * y)+2] = (unsigned char) (b * area);
+ out[4*(x + outw * y)+3] = (unsigned char) (alpha * area);
}
}
}
{
showlmp_t *oldshowlmps = cl.showlmps;
cl.max_showlmps += 16;
- cl.showlmps = Mem_Alloc(cls.levelmempool, cl.max_showlmps * sizeof(showlmp_t));
+ cl.showlmps = (showlmp_t *) Mem_Alloc(cls.levelmempool, cl.max_showlmps * sizeof(showlmp_t));
if (cl.num_showlmps)
memcpy(cl.showlmps, oldshowlmps, cl.num_showlmps * sizeof(showlmp_t));
if (oldshowlmps)
SCR_DrawBrand();
- SCR_DrawDownload();
+ SCR_DrawInfobar();
if (r_timereport_active)
R_TimeReport("2d");
if(gamemode == GAME_NEXUIZ)
{
// play a bit with the palette (experimental)
- palette_rgb_pantscolormap[15][0] = 128 + 127 * sin(cl.time / exp(1) + 0*M_PI/3);
- palette_rgb_pantscolormap[15][1] = 128 + 127 * sin(cl.time / exp(1) + 2*M_PI/3);
- palette_rgb_pantscolormap[15][2] = 128 + 127 * sin(cl.time / exp(1) + 4*M_PI/3);
- palette_rgb_shirtcolormap[15][0] = 128 + 127 * sin(cl.time / M_PI + 5*M_PI/3);
- palette_rgb_shirtcolormap[15][1] = 128 + 127 * sin(cl.time / M_PI + 3*M_PI/3);
- palette_rgb_shirtcolormap[15][2] = 128 + 127 * sin(cl.time / M_PI + 1*M_PI/3);
+ palette_rgb_pantscolormap[15][0] = (unsigned char) (128 + 127 * sin(cl.time / exp(1) + 0*M_PI/3));
+ palette_rgb_pantscolormap[15][1] = (unsigned char) (128 + 127 * sin(cl.time / exp(1) + 2*M_PI/3));
+ palette_rgb_pantscolormap[15][2] = (unsigned char) (128 + 127 * sin(cl.time / exp(1) + 4*M_PI/3));
+ palette_rgb_shirtcolormap[15][0] = (unsigned char) (128 + 127 * sin(cl.time / M_PI + 5*M_PI/3));
+ palette_rgb_shirtcolormap[15][1] = (unsigned char) (128 + 127 * sin(cl.time / M_PI + 3*M_PI/3));
+ palette_rgb_shirtcolormap[15][2] = (unsigned char) (128 + 127 * sin(cl.time / M_PI + 1*M_PI/3));
memcpy(palette_rgb_pantsscoreboard[15], palette_rgb_pantscolormap[15], sizeof(*palette_rgb_pantscolormap));
memcpy(palette_rgb_shirtscoreboard[15], palette_rgb_shirtcolormap[15], sizeof(*palette_rgb_shirtcolormap));
}
else if (key_consoleactive)
VID_SetMouse(vid.fullscreen, false, false);
else if (key_dest == key_menu_grabbed)
- VID_SetMouse(true, !in_client_mouse, true);
+ VID_SetMouse(true, vid_mouse.integer && !in_client_mouse, true);
else if (key_dest == key_menu)
- VID_SetMouse(vid.fullscreen, !in_client_mouse, true);
+ VID_SetMouse(vid.fullscreen, vid_mouse.integer && !in_client_mouse, true);
else
- VID_SetMouse(vid.fullscreen, vid_mouse.integer && !cls.demoplayback && !cl.csqc_wantsmousemove, true);
+ VID_SetMouse(vid.fullscreen, vid_mouse.integer && !cl.csqc_wantsmousemove && (!cls.demoplayback || cl_demo_mousegrab.integer), true);
VID_Finish();
}