2009-02-28 14:41:18 +00:00
|
|
|
/*
|
2010-06-18 14:25:50 +00:00
|
|
|
* Copyright (C) 1997-2001 Id Software, Inc.
|
|
|
|
*
|
2010-07-13 18:19:42 +00:00
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or (at
|
|
|
|
* your option) any later version.
|
2010-06-18 14:25:50 +00:00
|
|
|
*
|
2010-07-13 18:19:42 +00:00
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
2010-06-18 14:25:50 +00:00
|
|
|
*
|
|
|
|
* See the GNU General Public License for more details.
|
|
|
|
*
|
2010-07-13 18:19:42 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
|
|
|
* 02111-1307, USA.
|
2010-06-18 14:25:50 +00:00
|
|
|
*
|
2010-06-18 16:41:26 +00:00
|
|
|
* =======================================================================
|
|
|
|
*
|
2010-07-13 18:19:42 +00:00
|
|
|
* This file implements the 2D stuff. For example the HUD and the
|
|
|
|
* networkgraph.
|
2010-06-18 16:41:26 +00:00
|
|
|
*
|
|
|
|
* =======================================================================
|
2010-06-18 14:25:50 +00:00
|
|
|
*/
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2009-03-03 13:43:32 +00:00
|
|
|
#include "header/client.h"
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
float scr_con_current; /* aproaches scr_conlines at scr_conspeed */
|
|
|
|
float scr_conlines; /* 0.0 to 1.0 lines of console to display */
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
qboolean scr_initialized; /* ready to draw */
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
int scr_draw_loading;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
vrect_t scr_vrect; /* position of render window on screen */
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
cvar_t *scr_viewsize;
|
|
|
|
cvar_t *scr_conspeed;
|
|
|
|
cvar_t *scr_centertime;
|
|
|
|
cvar_t *scr_showturtle;
|
|
|
|
cvar_t *scr_showpause;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
cvar_t *scr_netgraph;
|
|
|
|
cvar_t *scr_timegraph;
|
|
|
|
cvar_t *scr_debuggraph;
|
|
|
|
cvar_t *scr_graphheight;
|
|
|
|
cvar_t *scr_graphscale;
|
|
|
|
cvar_t *scr_graphshift;
|
|
|
|
cvar_t *scr_drawall;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2014-05-06 17:45:11 +00:00
|
|
|
cvar_t *gl_hudscale; /* named for consistency with R1Q2 */
|
2014-06-21 16:54:57 +00:00
|
|
|
cvar_t *gl_consolescale;
|
2014-05-06 17:45:11 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
int x1, y1, x2, y2;
|
2009-02-28 14:41:18 +00:00
|
|
|
} dirty_t;
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
dirty_t scr_dirty, scr_old_dirty[2];
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
char crosshair_pic[MAX_QPATH];
|
|
|
|
int crosshair_width, crosshair_height;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2010-06-18 14:25:50 +00:00
|
|
|
extern cvar_t *cl_drawfps;
|
2010-06-18 16:50:27 +00:00
|
|
|
extern cvar_t *crosshair_scale;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
void SCR_TimeRefresh_f(void);
|
|
|
|
void SCR_Loading_f(void);
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
/*
|
2010-06-18 14:25:50 +00:00
|
|
|
* A new packet was just parsed
|
|
|
|
*/
|
2012-07-22 13:34:45 +00:00
|
|
|
void
|
|
|
|
CL_AddNetgraph(void)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
int in;
|
|
|
|
int ping;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
/* if using the debuggraph for something
|
|
|
|
else, don't add the net lines */
|
2009-02-28 14:41:18 +00:00
|
|
|
if (scr_debuggraph->value || scr_timegraph->value)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
return;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
for (i = 0; i < cls.netchan.dropped; i++)
|
|
|
|
{
|
|
|
|
SCR_DebugGraph(30, 0x40);
|
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
for (i = 0; i < cl.surpressCount; i++)
|
|
|
|
{
|
|
|
|
SCR_DebugGraph(30, 0xdf);
|
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2010-06-18 14:25:50 +00:00
|
|
|
/* see what the latency was on this packet */
|
2012-07-22 13:34:45 +00:00
|
|
|
in = cls.netchan.incoming_acknowledged & (CMD_BACKUP - 1);
|
2009-02-28 14:41:18 +00:00
|
|
|
ping = cls.realtime - cl.cmd_time[in];
|
|
|
|
ping /= 30;
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
if (ping > 30)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
ping = 30;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
SCR_DebugGraph((float)ping, 0xd0);
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
float value;
|
|
|
|
int color;
|
2009-02-28 14:41:18 +00:00
|
|
|
} graphsamp_t;
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
static int current;
|
|
|
|
static graphsamp_t values[2024];
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
void
|
|
|
|
SCR_DebugGraph(float value, int color)
|
|
|
|
{
|
|
|
|
values[current & 2023].value = value;
|
|
|
|
values[current & 2023].color = color;
|
2009-02-28 14:41:18 +00:00
|
|
|
current++;
|
|
|
|
}
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
void
|
|
|
|
SCR_DrawDebugGraph(void)
|
|
|
|
{
|
|
|
|
int a, x, y, w, i, h;
|
|
|
|
float v;
|
|
|
|
int color;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2010-06-18 14:25:50 +00:00
|
|
|
/* draw the graph */
|
2009-02-28 14:41:18 +00:00
|
|
|
w = scr_vrect.width;
|
|
|
|
|
|
|
|
x = scr_vrect.x;
|
2012-07-22 13:34:45 +00:00
|
|
|
y = scr_vrect.y + scr_vrect.height;
|
2013-05-01 19:12:38 +00:00
|
|
|
Draw_Fill(x, y - scr_graphheight->value,
|
2012-07-22 13:34:45 +00:00
|
|
|
w, scr_graphheight->value, 8);
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
for (a = 0; a < w; a++)
|
|
|
|
{
|
|
|
|
i = (current - 1 - a + 1024) & 1023;
|
2009-02-28 14:41:18 +00:00
|
|
|
v = values[i].value;
|
|
|
|
color = values[i].color;
|
2012-07-22 13:34:45 +00:00
|
|
|
v = v * scr_graphscale->value + scr_graphshift->value;
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
if (v < 0)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
|
|
|
v += scr_graphheight->value *
|
|
|
|
(1 + (int)(-v / scr_graphheight->value));
|
|
|
|
}
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
h = (int)v % (int)scr_graphheight->value;
|
2013-05-01 19:12:38 +00:00
|
|
|
Draw_Fill(x + w - 1 - a, y - h, 1, h, color);
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
char scr_centerstring[1024];
|
|
|
|
float scr_centertime_start; /* for slow victory printing */
|
|
|
|
float scr_centertime_off;
|
|
|
|
int scr_center_lines;
|
|
|
|
int scr_erase_center;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
/*
|
2010-06-18 14:25:50 +00:00
|
|
|
* Called for important messages that should stay
|
|
|
|
* in the center of the screen for a few moments
|
|
|
|
*/
|
2012-07-22 13:34:45 +00:00
|
|
|
void
|
|
|
|
SCR_CenterPrint(char *str)
|
|
|
|
{
|
|
|
|
char *s;
|
|
|
|
char line[64];
|
|
|
|
int i, j, l;
|
|
|
|
|
2013-05-11 12:44:36 +00:00
|
|
|
Q_strlcpy(scr_centerstring, str, sizeof(scr_centerstring));
|
2009-02-28 14:41:18 +00:00
|
|
|
scr_centertime_off = scr_centertime->value;
|
|
|
|
scr_centertime_start = cl.time;
|
|
|
|
|
2010-06-18 14:25:50 +00:00
|
|
|
/* count the number of lines for centering */
|
2009-02-28 14:41:18 +00:00
|
|
|
scr_center_lines = 1;
|
|
|
|
s = str;
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
while (*s)
|
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
if (*s == '\n')
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
scr_center_lines++;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
s++;
|
|
|
|
}
|
|
|
|
|
2010-06-18 14:25:50 +00:00
|
|
|
/* echo it to the console */
|
2009-02-28 14:41:18 +00:00
|
|
|
Com_Printf("\n\n\35\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\37\n\n");
|
|
|
|
|
|
|
|
s = str;
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
do
|
|
|
|
{
|
2010-06-18 14:25:50 +00:00
|
|
|
/* scan the width of the line */
|
2012-07-22 13:34:45 +00:00
|
|
|
for (l = 0; l < 40; l++)
|
|
|
|
{
|
|
|
|
if ((s[l] == '\n') || !s[l])
|
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
break;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
|
|
|
}
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
for (i = 0; i < (40 - l) / 2; i++)
|
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
line[i] = ' ';
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
for (j = 0; j < l; j++)
|
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
line[i++] = s[j];
|
|
|
|
}
|
|
|
|
|
|
|
|
line[i] = '\n';
|
2012-07-22 13:34:45 +00:00
|
|
|
line[i + 1] = 0;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
Com_Printf("%s", line);
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
while (*s && *s != '\n')
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
s++;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
if (!*s)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
break;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2010-06-18 14:25:50 +00:00
|
|
|
|
|
|
|
s++; /* skip the \n */
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
|
|
|
while (1);
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
Com_Printf("\n\n\35\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\37\n\n");
|
2012-07-22 13:34:45 +00:00
|
|
|
Con_ClearNotify();
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
void
|
|
|
|
SCR_DrawCenterString(void)
|
|
|
|
{
|
|
|
|
char *start;
|
|
|
|
int l;
|
|
|
|
int j;
|
|
|
|
int x, y;
|
|
|
|
int remaining;
|
2014-06-21 16:17:12 +00:00
|
|
|
float scale;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2010-06-18 14:25:50 +00:00
|
|
|
/* the finale prints the characters one at a time */
|
2009-02-28 14:41:18 +00:00
|
|
|
remaining = 9999;
|
|
|
|
|
|
|
|
scr_erase_center = 0;
|
|
|
|
start = scr_centerstring;
|
2014-06-21 16:54:57 +00:00
|
|
|
scale = SCR_GetConsoleScale();
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
if (scr_center_lines <= 4)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2014-06-21 16:17:12 +00:00
|
|
|
y = (viddef.height * 0.35) / scale;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
else
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2014-06-21 16:17:12 +00:00
|
|
|
y = 48 / scale;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
do
|
|
|
|
{
|
2010-06-18 14:25:50 +00:00
|
|
|
/* scan the width of the line */
|
2012-07-22 13:34:45 +00:00
|
|
|
for (l = 0; l < 40; l++)
|
|
|
|
{
|
|
|
|
if ((start[l] == '\n') || !start[l])
|
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
break;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
|
|
|
}
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2014-06-21 16:17:12 +00:00
|
|
|
x = ((viddef.width - l * 8) / 2) / scale;
|
2012-07-22 13:34:45 +00:00
|
|
|
SCR_AddDirtyPoint(x, y);
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
for (j = 0; j < l; j++, x += 8)
|
|
|
|
{
|
2014-06-21 16:17:12 +00:00
|
|
|
Draw_CharScaled(x * scale, y * scale, start[j], scale);
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
if (!remaining--)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
return;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
SCR_AddDirtyPoint(x, y + 8);
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
y += 8;
|
|
|
|
|
|
|
|
while (*start && *start != '\n')
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
start++;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
if (!*start)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
break;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2010-06-18 14:25:50 +00:00
|
|
|
|
|
|
|
start++; /* skip the \n */
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
|
|
|
while (1);
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
void
|
|
|
|
SCR_CheckDrawCenterString(void)
|
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
scr_centertime_off -= cls.frametime;
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
if (scr_centertime_off <= 0)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
return;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
SCR_DrawCenterString();
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2010-06-18 14:25:50 +00:00
|
|
|
* Sets scr_vrect, the coordinates of the rendered window
|
|
|
|
*/
|
2012-07-22 13:34:45 +00:00
|
|
|
static void
|
|
|
|
SCR_CalcVrect(void)
|
|
|
|
{
|
|
|
|
int size;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2010-06-18 14:25:50 +00:00
|
|
|
/* bound viewsize */
|
2009-02-28 14:41:18 +00:00
|
|
|
if (scr_viewsize->value < 40)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
|
|
|
Cvar_Set("viewsize", "40");
|
|
|
|
}
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
if (scr_viewsize->value > 100)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
|
|
|
Cvar_Set("viewsize", "100");
|
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
size = scr_viewsize->value;
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
scr_vrect.width = viddef.width * size / 100;
|
2013-10-12 07:29:19 +00:00
|
|
|
scr_vrect.width &= ~1;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
scr_vrect.height = viddef.height * size / 100;
|
2009-02-28 14:41:18 +00:00
|
|
|
scr_vrect.height &= ~1;
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
scr_vrect.x = (viddef.width - scr_vrect.width) / 2;
|
|
|
|
scr_vrect.y = (viddef.height - scr_vrect.height) / 2;
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2010-06-18 14:25:50 +00:00
|
|
|
* Keybinding command
|
|
|
|
*/
|
2012-07-22 13:34:45 +00:00
|
|
|
void
|
|
|
|
SCR_SizeUp_f(void)
|
|
|
|
{
|
|
|
|
Cvar_SetValue("viewsize", (float)scr_viewsize->value + 10);
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2010-06-18 14:25:50 +00:00
|
|
|
*Keybinding command
|
|
|
|
*/
|
2012-07-22 13:34:45 +00:00
|
|
|
void
|
|
|
|
SCR_SizeDown_f(void)
|
|
|
|
{
|
|
|
|
Cvar_SetValue("viewsize", (float)scr_viewsize->value - 10);
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2010-06-18 14:25:50 +00:00
|
|
|
* Set a specific sky and rotation speed
|
|
|
|
*/
|
2012-07-22 13:34:45 +00:00
|
|
|
void
|
|
|
|
SCR_Sky_f(void)
|
|
|
|
{
|
|
|
|
float rotate;
|
|
|
|
vec3_t axis;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if (Cmd_Argc() < 2)
|
|
|
|
{
|
|
|
|
Com_Printf("Usage: sky <basename> <rotate> <axis x y z>\n");
|
2009-02-28 14:41:18 +00:00
|
|
|
return;
|
|
|
|
}
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
if (Cmd_Argc() > 2)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2012-06-02 08:33:28 +00:00
|
|
|
rotate = (float)strtod(Cmd_Argv(2), (char **)NULL);
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
else
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
rotate = 0;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if (Cmd_Argc() == 6)
|
|
|
|
{
|
2012-06-02 08:33:28 +00:00
|
|
|
axis[0] = (float)strtod(Cmd_Argv(3), (char **)NULL);
|
|
|
|
axis[1] = (float)strtod(Cmd_Argv(4), (char **)NULL);
|
|
|
|
axis[2] = (float)strtod(Cmd_Argv(5), (char **)NULL);
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
axis[0] = 0;
|
|
|
|
axis[1] = 0;
|
|
|
|
axis[2] = 1;
|
|
|
|
}
|
|
|
|
|
2013-05-01 19:12:38 +00:00
|
|
|
R_SetSky(Cmd_Argv(1), rotate, axis);
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
void
|
|
|
|
SCR_Init(void)
|
|
|
|
{
|
|
|
|
scr_viewsize = Cvar_Get("viewsize", "100", CVAR_ARCHIVE);
|
|
|
|
scr_conspeed = Cvar_Get("scr_conspeed", "3", 0);
|
2014-05-06 17:45:11 +00:00
|
|
|
scr_centertime = Cvar_Get("scr_centertime", "2.5", 0);
|
2012-07-22 13:34:45 +00:00
|
|
|
scr_showturtle = Cvar_Get("scr_showturtle", "0", 0);
|
|
|
|
scr_showpause = Cvar_Get("scr_showpause", "1", 0);
|
|
|
|
scr_netgraph = Cvar_Get("netgraph", "0", 0);
|
|
|
|
scr_timegraph = Cvar_Get("timegraph", "0", 0);
|
|
|
|
scr_debuggraph = Cvar_Get("debuggraph", "0", 0);
|
|
|
|
scr_graphheight = Cvar_Get("graphheight", "32", 0);
|
|
|
|
scr_graphscale = Cvar_Get("graphscale", "1", 0);
|
|
|
|
scr_graphshift = Cvar_Get("graphshift", "0", 0);
|
|
|
|
scr_drawall = Cvar_Get("scr_drawall", "0", 0);
|
2014-05-06 17:45:11 +00:00
|
|
|
gl_hudscale = Cvar_Get("gl_hudscale", "1", CVAR_ARCHIVE);
|
2014-06-21 16:54:57 +00:00
|
|
|
gl_consolescale = Cvar_Get("gl_consolescale", "1", CVAR_ARCHIVE);
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2010-06-18 14:25:50 +00:00
|
|
|
/* register our commands */
|
2012-07-22 13:34:45 +00:00
|
|
|
Cmd_AddCommand("timerefresh", SCR_TimeRefresh_f);
|
|
|
|
Cmd_AddCommand("loading", SCR_Loading_f);
|
|
|
|
Cmd_AddCommand("sizeup", SCR_SizeUp_f);
|
|
|
|
Cmd_AddCommand("sizedown", SCR_SizeDown_f);
|
|
|
|
Cmd_AddCommand("sky", SCR_Sky_f);
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
scr_initialized = true;
|
|
|
|
}
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
void
|
|
|
|
SCR_DrawNet(void)
|
|
|
|
{
|
|
|
|
if (cls.netchan.outgoing_sequence - cls.netchan.incoming_acknowledged < CMD_BACKUP - 1)
|
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
return;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2013-05-01 19:12:38 +00:00
|
|
|
Draw_Pic(scr_vrect.x + 64, scr_vrect.y, "net");
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
void
|
|
|
|
SCR_DrawPause(void)
|
|
|
|
{
|
|
|
|
int w, h;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2010-06-18 14:25:50 +00:00
|
|
|
if (!scr_showpause->value) /* turn off for screenshots */
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
return;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
if (!cl_paused->value)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
return;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2013-05-01 19:12:38 +00:00
|
|
|
Draw_GetPicSize(&w, &h, "pause");
|
|
|
|
Draw_Pic((viddef.width - w) / 2, viddef.height / 2 + 8, "pause");
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
void
|
|
|
|
SCR_DrawLoading(void)
|
|
|
|
{
|
|
|
|
int w, h;
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
if (!scr_draw_loading)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
return;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
scr_draw_loading = false;
|
2013-05-01 19:12:38 +00:00
|
|
|
Draw_GetPicSize(&w, &h, "loading");
|
|
|
|
Draw_Pic((viddef.width - w) / 2, (viddef.height - h) / 2, "loading");
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2010-06-18 14:25:50 +00:00
|
|
|
* Scroll it up or down
|
|
|
|
*/
|
2012-07-22 13:34:45 +00:00
|
|
|
void
|
|
|
|
SCR_RunConsole(void)
|
|
|
|
{
|
2010-06-18 14:25:50 +00:00
|
|
|
/* decide on the height of the console */
|
2009-02-28 14:41:18 +00:00
|
|
|
if (cls.key_dest == key_console)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2010-06-18 14:25:50 +00:00
|
|
|
scr_conlines = 0.5; /* half screen */
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
else
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2010-06-18 14:25:50 +00:00
|
|
|
scr_conlines = 0; /* none visible */
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if (scr_conlines < scr_con_current)
|
|
|
|
{
|
|
|
|
scr_con_current -= scr_conspeed->value * cls.frametime;
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
if (scr_conlines > scr_con_current)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
scr_con_current = scr_conlines;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (scr_conlines > scr_con_current)
|
|
|
|
{
|
|
|
|
scr_con_current += scr_conspeed->value * cls.frametime;
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
if (scr_conlines < scr_con_current)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
scr_con_current = scr_conlines;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
void
|
|
|
|
SCR_DrawConsole(void)
|
|
|
|
{
|
|
|
|
Con_CheckResize();
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if ((cls.state == ca_disconnected) || (cls.state == ca_connecting))
|
|
|
|
{
|
2010-06-18 14:25:50 +00:00
|
|
|
/* forced full screen console */
|
2012-07-22 13:34:45 +00:00
|
|
|
Con_DrawConsole(1.0);
|
2009-02-28 14:41:18 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if ((cls.state != ca_active) || !cl.refresh_prepped)
|
|
|
|
{
|
2010-06-18 14:25:50 +00:00
|
|
|
/* connected, but can't render */
|
2012-07-22 13:34:45 +00:00
|
|
|
Con_DrawConsole(0.5);
|
2013-05-01 19:12:38 +00:00
|
|
|
Draw_Fill(0, viddef.height / 2, viddef.width, viddef.height / 2, 0);
|
2009-02-28 14:41:18 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if (scr_con_current)
|
|
|
|
{
|
|
|
|
Con_DrawConsole(scr_con_current);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ((cls.key_dest == key_game) || (cls.key_dest == key_message))
|
|
|
|
{
|
|
|
|
Con_DrawNotify(); /* only draw notify in game */
|
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
void
|
|
|
|
SCR_BeginLoadingPlaque(void)
|
|
|
|
{
|
|
|
|
S_StopAllSounds();
|
2010-06-18 14:25:50 +00:00
|
|
|
cl.sound_prepped = false; /* don't play ambients */
|
2012-04-25 08:53:25 +00:00
|
|
|
#ifdef CDA
|
2012-07-22 13:34:45 +00:00
|
|
|
CDAudio_Stop();
|
2012-04-25 08:53:25 +00:00
|
|
|
#endif
|
2012-04-25 08:24:38 +00:00
|
|
|
#ifdef OGG
|
2009-10-03 16:06:45 +00:00
|
|
|
OGG_Stop();
|
2012-04-25 08:24:38 +00:00
|
|
|
#endif
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
if (cls.disable_screen)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
return;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
if (developer->value)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
return;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
if (cls.state == ca_disconnected)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2010-06-18 14:25:50 +00:00
|
|
|
/* if at console, don't bring up the plaque */
|
|
|
|
return;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
if (cls.key_dest == key_console)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
return;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
if (cl.cinematictime > 0)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2010-06-18 14:25:50 +00:00
|
|
|
scr_draw_loading = 2; /* clear to balack first */
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
else
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
scr_draw_loading = 1;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
SCR_UpdateScreen();
|
2010-02-01 14:56:34 +00:00
|
|
|
SCR_StopCinematic();
|
2012-07-22 13:34:45 +00:00
|
|
|
cls.disable_screen = Sys_Milliseconds();
|
2009-02-28 14:41:18 +00:00
|
|
|
cls.disable_servercount = cl.servercount;
|
|
|
|
}
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
void
|
|
|
|
SCR_EndLoadingPlaque(void)
|
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
cls.disable_screen = 0;
|
2012-07-22 13:34:45 +00:00
|
|
|
Con_ClearNotify();
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
void
|
|
|
|
SCR_Loading_f(void)
|
|
|
|
{
|
|
|
|
SCR_BeginLoadingPlaque();
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
void
|
|
|
|
SCR_TimeRefresh_f(void)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
int start, stop;
|
|
|
|
float time;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if (cls.state != ca_active)
|
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
return;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
start = Sys_Milliseconds();
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if (Cmd_Argc() == 2)
|
|
|
|
{
|
2010-06-18 14:25:50 +00:00
|
|
|
/* run without page flipping */
|
|
|
|
int j;
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
for (j = 0; j < 1000; j++)
|
|
|
|
{
|
2013-05-01 19:12:38 +00:00
|
|
|
R_BeginFrame(0);
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
for (i = 0; i < 128; i++)
|
|
|
|
{
|
|
|
|
cl.refdef.viewangles[1] = i / 128.0f * 360.0f;
|
2013-05-01 19:12:38 +00:00
|
|
|
R_RenderFrame(&cl.refdef);
|
2010-06-18 14:25:50 +00:00
|
|
|
}
|
|
|
|
|
2013-05-01 19:12:38 +00:00
|
|
|
GLimp_EndFrame();
|
2010-06-18 14:25:50 +00:00
|
|
|
}
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for (i = 0; i < 128; i++)
|
|
|
|
{
|
|
|
|
cl.refdef.viewangles[1] = i / 128.0f * 360.0f;
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2013-05-01 19:12:38 +00:00
|
|
|
R_BeginFrame(0);
|
|
|
|
R_RenderFrame(&cl.refdef);
|
|
|
|
GLimp_EndFrame();
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
stop = Sys_Milliseconds();
|
|
|
|
time = (stop - start) / 1000.0f;
|
|
|
|
Com_Printf("%f seconds (%f fps)\n", time, 128 / time);
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
void
|
|
|
|
SCR_AddDirtyPoint(int x, int y)
|
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
if (x < scr_dirty.x1)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
scr_dirty.x1 = x;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
if (x > scr_dirty.x2)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
scr_dirty.x2 = x;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
if (y < scr_dirty.y1)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
scr_dirty.y1 = y;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
if (y > scr_dirty.y2)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
scr_dirty.y2 = y;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
void
|
|
|
|
SCR_DirtyScreen(void)
|
|
|
|
{
|
|
|
|
SCR_AddDirtyPoint(0, 0);
|
|
|
|
SCR_AddDirtyPoint(viddef.width - 1, viddef.height - 1);
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2010-06-18 14:25:50 +00:00
|
|
|
* Clear any parts of the tiled background that were drawn on last frame
|
|
|
|
*/
|
2012-07-22 13:34:45 +00:00
|
|
|
void
|
|
|
|
SCR_TileClear(void)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
int top, bottom, left, right;
|
|
|
|
dirty_t clear;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
if (scr_con_current == 1.0)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2010-06-18 14:25:50 +00:00
|
|
|
return; /* full screen console */
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
if (scr_viewsize->value == 100)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2010-06-18 14:25:50 +00:00
|
|
|
return; /* full screen rendering */
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
if (cl.cinematictime > 0)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2010-06-18 14:25:50 +00:00
|
|
|
return; /* full screen cinematic */
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
/* erase rect will be the union of the past three
|
|
|
|
frames so tripple buffering works properly */
|
2009-02-28 14:41:18 +00:00
|
|
|
clear = scr_dirty;
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
for (i = 0; i < 2; i++)
|
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
if (scr_old_dirty[i].x1 < clear.x1)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
clear.x1 = scr_old_dirty[i].x1;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
if (scr_old_dirty[i].x2 > clear.x2)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
clear.x2 = scr_old_dirty[i].x2;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
if (scr_old_dirty[i].y1 < clear.y1)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
clear.y1 = scr_old_dirty[i].y1;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
if (scr_old_dirty[i].y2 > clear.y2)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
clear.y2 = scr_old_dirty[i].y2;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
scr_old_dirty[1] = scr_old_dirty[0];
|
|
|
|
scr_old_dirty[0] = scr_dirty;
|
|
|
|
|
|
|
|
scr_dirty.x1 = 9999;
|
|
|
|
scr_dirty.x2 = -9999;
|
|
|
|
scr_dirty.y1 = 9999;
|
|
|
|
scr_dirty.y2 = -9999;
|
|
|
|
|
2010-06-18 14:25:50 +00:00
|
|
|
/* don't bother with anything convered by the console */
|
2012-07-22 13:34:45 +00:00
|
|
|
top = (int)(scr_con_current * viddef.height);
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
if (top >= clear.y1)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
clear.y1 = top;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
if (clear.y2 <= clear.y1)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2010-06-18 14:25:50 +00:00
|
|
|
return; /* nothing disturbed */
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
top = scr_vrect.y;
|
2012-07-22 13:34:45 +00:00
|
|
|
bottom = top + scr_vrect.height - 1;
|
2009-02-28 14:41:18 +00:00
|
|
|
left = scr_vrect.x;
|
2012-07-22 13:34:45 +00:00
|
|
|
right = left + scr_vrect.width - 1;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if (clear.y1 < top)
|
|
|
|
{
|
2010-06-18 14:25:50 +00:00
|
|
|
/* clear above view screen */
|
2012-07-22 13:34:45 +00:00
|
|
|
i = clear.y2 < top - 1 ? clear.y2 : top - 1;
|
2013-05-01 19:12:38 +00:00
|
|
|
Draw_TileClear(clear.x1, clear.y1,
|
2012-07-22 13:34:45 +00:00
|
|
|
clear.x2 - clear.x1 + 1, i - clear.y1 + 1, "backtile");
|
2009-02-28 14:41:18 +00:00
|
|
|
clear.y1 = top;
|
|
|
|
}
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if (clear.y2 > bottom)
|
|
|
|
{
|
2010-06-18 14:25:50 +00:00
|
|
|
/* clear below view screen */
|
2012-07-22 13:34:45 +00:00
|
|
|
i = clear.y1 > bottom + 1 ? clear.y1 : bottom + 1;
|
2013-05-01 19:12:38 +00:00
|
|
|
Draw_TileClear(clear.x1, i,
|
2012-07-22 13:34:45 +00:00
|
|
|
clear.x2 - clear.x1 + 1, clear.y2 - i + 1, "backtile");
|
2009-02-28 14:41:18 +00:00
|
|
|
clear.y2 = bottom;
|
|
|
|
}
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if (clear.x1 < left)
|
|
|
|
{
|
2010-06-18 14:25:50 +00:00
|
|
|
/* clear left of view screen */
|
2012-07-22 13:34:45 +00:00
|
|
|
i = clear.x2 < left - 1 ? clear.x2 : left - 1;
|
2013-05-01 19:12:38 +00:00
|
|
|
Draw_TileClear(clear.x1, clear.y1,
|
2012-07-22 13:34:45 +00:00
|
|
|
i - clear.x1 + 1, clear.y2 - clear.y1 + 1, "backtile");
|
2009-02-28 14:41:18 +00:00
|
|
|
clear.x1 = left;
|
|
|
|
}
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if (clear.x2 > right)
|
|
|
|
{
|
2010-06-18 14:25:50 +00:00
|
|
|
/* clear left of view screen */
|
2012-07-22 13:34:45 +00:00
|
|
|
i = clear.x1 > right + 1 ? clear.x1 : right + 1;
|
2013-05-01 19:12:38 +00:00
|
|
|
Draw_TileClear(i, clear.y1,
|
2012-07-22 13:34:45 +00:00
|
|
|
clear.x2 - i + 1, clear.y2 - clear.y1 + 1, "backtile");
|
2009-02-28 14:41:18 +00:00
|
|
|
clear.x2 = right;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
#define STAT_MINUS 10
|
|
|
|
char *sb_nums[2][11] = {
|
2010-06-18 14:25:50 +00:00
|
|
|
{
|
|
|
|
"num_0", "num_1", "num_2", "num_3", "num_4", "num_5",
|
|
|
|
"num_6", "num_7", "num_8", "num_9", "num_minus"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"anum_0", "anum_1", "anum_2", "anum_3", "anum_4", "anum_5",
|
|
|
|
"anum_6", "anum_7", "anum_8", "anum_9", "anum_minus"
|
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
};
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
#define ICON_WIDTH 24
|
|
|
|
#define ICON_HEIGHT 24
|
|
|
|
#define CHAR_WIDTH 16
|
|
|
|
#define ICON_SPACE 8
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
/*
|
2010-06-18 14:25:50 +00:00
|
|
|
* Allow embedded \n in the string
|
|
|
|
*/
|
2012-07-22 13:34:45 +00:00
|
|
|
void
|
|
|
|
SizeHUDString(char *string, int *w, int *h)
|
|
|
|
{
|
|
|
|
int lines, width, current;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
lines = 1;
|
|
|
|
width = 0;
|
|
|
|
|
|
|
|
current = 0;
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
while (*string)
|
|
|
|
{
|
|
|
|
if (*string == '\n')
|
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
lines++;
|
|
|
|
current = 0;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
current++;
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
if (current > width)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
width = current;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
string++;
|
|
|
|
}
|
|
|
|
|
|
|
|
*w = width * 8;
|
|
|
|
*h = lines * 8;
|
|
|
|
}
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
void
|
2014-04-25 19:24:26 +00:00
|
|
|
DrawHUDStringScaled(char *string, int x, int y, int centerwidth, int xor, float factor)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
|
|
|
int margin;
|
|
|
|
char line[1024];
|
|
|
|
int width;
|
|
|
|
int i;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
margin = x;
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
while (*string)
|
|
|
|
{
|
2010-06-18 14:25:50 +00:00
|
|
|
/* scan out one line of text from the string */
|
2009-02-28 14:41:18 +00:00
|
|
|
width = 0;
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
while (*string && *string != '\n')
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
line[width++] = *string++;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
line[width] = 0;
|
|
|
|
|
|
|
|
if (centerwidth)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2014-04-25 19:24:26 +00:00
|
|
|
x = margin + (centerwidth - width * 8)*factor / 2;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
else
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
x = margin;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
for (i = 0; i < width; i++)
|
|
|
|
{
|
2014-04-25 19:24:26 +00:00
|
|
|
Draw_CharScaled(x, y, line[i] ^ xor, factor);
|
|
|
|
x += 8*factor;
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if (*string)
|
|
|
|
{
|
2010-06-18 14:25:50 +00:00
|
|
|
string++; /* skip the \n */
|
2014-04-25 19:24:26 +00:00
|
|
|
y += 8*factor;
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
void
|
2014-04-25 19:24:26 +00:00
|
|
|
DrawHUDString(char *string, int x, int y, int centerwidth, int xor)
|
|
|
|
{
|
|
|
|
DrawHUDStringScaled(string, x, y, centerwidth, xor, 1.0f);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
SCR_DrawFieldScaled(int x, int y, int color, int width, int value, float factor)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
|
|
|
char num[16], *ptr;
|
|
|
|
int l;
|
|
|
|
int frame;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
if (width < 1)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
return;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2010-06-18 14:25:50 +00:00
|
|
|
/* draw number string */
|
2009-02-28 14:41:18 +00:00
|
|
|
if (width > 5)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
width = 5;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
SCR_AddDirtyPoint(x, y);
|
2014-04-25 19:24:26 +00:00
|
|
|
SCR_AddDirtyPoint(x + (width * CHAR_WIDTH + 2)*factor, y + 23);
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
Com_sprintf(num, sizeof(num), "%i", value);
|
2009-03-02 20:41:42 +00:00
|
|
|
l = (int)strlen(num);
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
if (l > width)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
l = width;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2014-04-25 19:24:26 +00:00
|
|
|
x += (2 + CHAR_WIDTH * (width - l)) * factor;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
ptr = num;
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
while (*ptr && l)
|
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
if (*ptr == '-')
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
frame = STAT_MINUS;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
else
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
|
|
|
frame = *ptr - '0';
|
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2014-04-25 19:24:26 +00:00
|
|
|
Draw_PicScaled(x, y, sb_nums[color][frame], factor);
|
|
|
|
x += CHAR_WIDTH*factor;
|
2009-02-28 14:41:18 +00:00
|
|
|
ptr++;
|
|
|
|
l--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-04-25 19:24:26 +00:00
|
|
|
void
|
|
|
|
SCR_DrawField(int x, int y, int color, int width, int value)
|
|
|
|
{
|
|
|
|
SCR_DrawFieldScaled(x, y, color, width, value, 1.0f);
|
|
|
|
}
|
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
/*
|
2010-06-18 14:25:50 +00:00
|
|
|
* Allows rendering code to cache all needed sbar graphics
|
|
|
|
*/
|
2012-07-22 13:34:45 +00:00
|
|
|
void
|
|
|
|
SCR_TouchPics(void)
|
|
|
|
{
|
|
|
|
int i, j;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
for (i = 0; i < 2; i++)
|
|
|
|
{
|
|
|
|
for (j = 0; j < 11; j++)
|
|
|
|
{
|
2013-05-01 19:12:38 +00:00
|
|
|
Draw_FindPic(sb_nums[i][j]);
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if (crosshair->value)
|
|
|
|
{
|
|
|
|
if ((crosshair->value > 3) || (crosshair->value < 0))
|
|
|
|
{
|
2010-06-18 14:25:50 +00:00
|
|
|
crosshair->value = 3;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
Com_sprintf(crosshair_pic, sizeof(crosshair_pic), "ch%i",
|
|
|
|
(int)(crosshair->value));
|
2013-05-01 19:12:38 +00:00
|
|
|
Draw_GetPicSize(&crosshair_width, &crosshair_height, crosshair_pic);
|
2010-06-18 14:25:50 +00:00
|
|
|
|
|
|
|
if (!crosshair_width)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2010-06-18 14:25:50 +00:00
|
|
|
crosshair_pic[0] = 0;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
void
|
|
|
|
SCR_ExecuteLayoutString(char *s)
|
|
|
|
{
|
|
|
|
int x, y;
|
|
|
|
int value;
|
|
|
|
char *token;
|
|
|
|
int width;
|
|
|
|
int index;
|
|
|
|
clientinfo_t *ci;
|
|
|
|
|
2014-05-06 17:45:11 +00:00
|
|
|
float scale = SCR_GetHUDScale();
|
2014-04-25 19:24:26 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if ((cls.state != ca_active) || !cl.refresh_prepped)
|
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
return;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
if (!s[0])
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
return;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
x = 0;
|
|
|
|
y = 0;
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
while (s)
|
|
|
|
{
|
|
|
|
token = COM_Parse(&s);
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if (!strcmp(token, "xl"))
|
|
|
|
{
|
|
|
|
token = COM_Parse(&s);
|
2014-05-04 19:07:23 +00:00
|
|
|
x = scale*(int)strtol(token, (char **)NULL, 10);
|
2009-02-28 14:41:18 +00:00
|
|
|
continue;
|
|
|
|
}
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if (!strcmp(token, "xr"))
|
|
|
|
{
|
|
|
|
token = COM_Parse(&s);
|
2014-04-25 19:24:26 +00:00
|
|
|
x = viddef.width + scale*(int)strtol(token, (char **)NULL, 10);
|
2009-02-28 14:41:18 +00:00
|
|
|
continue;
|
|
|
|
}
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if (!strcmp(token, "xv"))
|
|
|
|
{
|
|
|
|
token = COM_Parse(&s);
|
2014-04-25 19:24:26 +00:00
|
|
|
x = viddef.width / 2 - scale*160 + scale*(int)strtol(token, (char **)NULL, 10);
|
2009-02-28 14:41:18 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if (!strcmp(token, "yt"))
|
|
|
|
{
|
|
|
|
token = COM_Parse(&s);
|
2014-05-04 19:07:23 +00:00
|
|
|
y = scale*(int)strtol(token, (char **)NULL, 10);
|
2009-02-28 14:41:18 +00:00
|
|
|
continue;
|
|
|
|
}
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if (!strcmp(token, "yb"))
|
|
|
|
{
|
|
|
|
token = COM_Parse(&s);
|
2014-04-25 19:24:26 +00:00
|
|
|
y = viddef.height + scale*(int)strtol(token, (char **)NULL, 10);
|
2009-02-28 14:41:18 +00:00
|
|
|
continue;
|
|
|
|
}
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if (!strcmp(token, "yv"))
|
|
|
|
{
|
|
|
|
token = COM_Parse(&s);
|
2014-04-25 19:24:26 +00:00
|
|
|
y = viddef.height / 2 - scale*120 + scale*(int)strtol(token, (char **)NULL, 10);
|
2009-02-28 14:41:18 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if (!strcmp(token, "pic"))
|
|
|
|
{
|
2010-06-18 14:25:50 +00:00
|
|
|
/* draw a pic from a stat number */
|
2012-07-22 13:34:45 +00:00
|
|
|
token = COM_Parse(&s);
|
2012-06-02 07:31:27 +00:00
|
|
|
index = (int)strtol(token, (char **)NULL, 10);
|
2009-03-02 20:41:42 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if ((index < 0) || (index >= sizeof(cl.frame.playerstate.stats)))
|
|
|
|
{
|
|
|
|
Com_Error(ERR_DROP, "bad stats index %d (0x%x)", index, index);
|
|
|
|
}
|
2010-06-18 14:25:50 +00:00
|
|
|
|
|
|
|
value = cl.frame.playerstate.stats[index];
|
2009-03-02 20:41:42 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
if (value >= MAX_IMAGES)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
|
|
|
Com_Error(ERR_DROP, "Pic >= MAX_IMAGES");
|
|
|
|
}
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if (cl.configstrings[CS_IMAGES + value])
|
|
|
|
{
|
|
|
|
SCR_AddDirtyPoint(x, y);
|
2014-04-25 19:24:26 +00:00
|
|
|
SCR_AddDirtyPoint(x + 23*scale, y + 23*scale);
|
|
|
|
Draw_PicScaled(x, y, cl.configstrings[CS_IMAGES + value], scale);
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if (!strcmp(token, "client"))
|
|
|
|
{
|
2010-06-18 14:25:50 +00:00
|
|
|
/* draw a deathmatch client block */
|
2012-07-22 13:34:45 +00:00
|
|
|
int score, ping, time;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
token = COM_Parse(&s);
|
2014-04-25 19:24:26 +00:00
|
|
|
x = viddef.width / 2 - scale*160 + scale*(int)strtol(token, (char **)NULL, 10);
|
2012-07-22 13:34:45 +00:00
|
|
|
token = COM_Parse(&s);
|
2014-04-25 19:24:26 +00:00
|
|
|
y = viddef.height / 2 - scale*120 + scale*(int)strtol(token, (char **)NULL, 10);
|
2012-07-22 13:34:45 +00:00
|
|
|
SCR_AddDirtyPoint(x, y);
|
2014-04-25 19:24:26 +00:00
|
|
|
SCR_AddDirtyPoint(x + scale*159, y + scale*31);
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
token = COM_Parse(&s);
|
2012-06-02 07:31:27 +00:00
|
|
|
value = (int)strtol(token, (char **)NULL, 10);
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if ((value >= MAX_CLIENTS) || (value < 0))
|
|
|
|
{
|
|
|
|
Com_Error(ERR_DROP, "client >= MAX_CLIENTS");
|
|
|
|
}
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
ci = &cl.clientinfo[value];
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
token = COM_Parse(&s);
|
2012-06-02 07:31:27 +00:00
|
|
|
score = (int)strtol(token, (char **)NULL, 10);
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
token = COM_Parse(&s);
|
2012-06-02 07:31:27 +00:00
|
|
|
ping = (int)strtol(token, (char **)NULL, 10);
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
token = COM_Parse(&s);
|
2012-06-02 07:31:27 +00:00
|
|
|
time = (int)strtol(token, (char **)NULL, 10);
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2014-04-25 19:24:26 +00:00
|
|
|
DrawAltStringScaled(x + scale*32, y, ci->name, scale);
|
|
|
|
DrawAltStringScaled(x + scale*32, y + scale*8, "Score: ", scale);
|
|
|
|
DrawAltStringScaled(x + scale*(32 + 7 * 8), y + scale*8, va("%i", score), scale);
|
|
|
|
DrawStringScaled(x + scale*32, y + scale*16, va("Ping: %i", ping), scale);
|
|
|
|
DrawStringScaled(x + scale*32, y + scale*24, va("Time: %i", time), scale);
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
if (!ci->icon)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
ci = &cl.baseclientinfo;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2014-04-25 19:24:26 +00:00
|
|
|
Draw_PicScaled(x, y, ci->iconname, scale);
|
2009-02-28 14:41:18 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if (!strcmp(token, "ctf"))
|
|
|
|
{
|
2010-06-18 14:25:50 +00:00
|
|
|
/* draw a ctf client block */
|
2012-07-22 13:34:45 +00:00
|
|
|
int score, ping;
|
|
|
|
char block[80];
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
token = COM_Parse(&s);
|
2014-04-25 19:24:26 +00:00
|
|
|
x = viddef.width / 2 - scale*160 + scale*(int)strtol(token, (char **)NULL, 10);
|
2012-07-22 13:34:45 +00:00
|
|
|
token = COM_Parse(&s);
|
2014-04-25 19:24:26 +00:00
|
|
|
y = viddef.height / 2 - scale*120 + scale*(int)strtol(token, (char **)NULL, 10);
|
2012-07-22 13:34:45 +00:00
|
|
|
SCR_AddDirtyPoint(x, y);
|
2014-04-25 19:24:26 +00:00
|
|
|
SCR_AddDirtyPoint(x + scale*159, y + scale*31);
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
token = COM_Parse(&s);
|
2012-06-02 07:31:27 +00:00
|
|
|
value = (int)strtol(token, (char **)NULL, 10);
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if ((value >= MAX_CLIENTS) || (value < 0))
|
|
|
|
{
|
|
|
|
Com_Error(ERR_DROP, "client >= MAX_CLIENTS");
|
|
|
|
}
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
ci = &cl.clientinfo[value];
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
token = COM_Parse(&s);
|
2012-06-02 07:31:27 +00:00
|
|
|
score = (int)strtol(token, (char **)NULL, 10);
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
token = COM_Parse(&s);
|
2012-06-02 07:31:27 +00:00
|
|
|
ping = (int)strtol(token, (char **)NULL, 10);
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
if (ping > 999)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
ping = 999;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2013-05-18 16:59:12 +00:00
|
|
|
sprintf(block, "%3d %3d %-12.12s", score, ping, ci->name);
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
if (value == cl.playernum)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2014-04-25 19:24:26 +00:00
|
|
|
DrawAltStringScaled(x, y, block, scale);
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
else
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2014-04-25 19:24:26 +00:00
|
|
|
DrawAltStringScaled(x, y, block, scale);
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if (!strcmp(token, "picn"))
|
|
|
|
{
|
2010-06-18 14:25:50 +00:00
|
|
|
/* draw a pic from a name */
|
2012-07-22 13:34:45 +00:00
|
|
|
token = COM_Parse(&s);
|
|
|
|
SCR_AddDirtyPoint(x, y);
|
2014-04-25 19:24:26 +00:00
|
|
|
SCR_AddDirtyPoint(x + scale*23, y + scale*23);
|
|
|
|
Draw_PicScaled(x, y, (char *)token, scale);
|
2009-02-28 14:41:18 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if (!strcmp(token, "num"))
|
|
|
|
{
|
2010-06-18 14:25:50 +00:00
|
|
|
/* draw a number */
|
2012-07-22 13:34:45 +00:00
|
|
|
token = COM_Parse(&s);
|
2012-06-02 07:31:27 +00:00
|
|
|
width = (int)strtol(token, (char **)NULL, 10);
|
2012-07-22 13:34:45 +00:00
|
|
|
token = COM_Parse(&s);
|
2012-06-02 07:31:27 +00:00
|
|
|
value = cl.frame.playerstate.stats[(int)strtol(token, (char **)NULL, 10)];
|
2014-04-25 19:24:26 +00:00
|
|
|
SCR_DrawFieldScaled(x, y, 0, width, value, scale);
|
2009-02-28 14:41:18 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if (!strcmp(token, "hnum"))
|
|
|
|
{
|
2010-06-18 14:25:50 +00:00
|
|
|
/* health number */
|
2012-07-22 13:34:45 +00:00
|
|
|
int color;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
width = 3;
|
|
|
|
value = cl.frame.playerstate.stats[STAT_HEALTH];
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
if (value > 25)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
|
|
|
color = 0; /* green */
|
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
else if (value > 0)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
|
|
|
color = (cl.frame.serverframe >> 2) & 1; /* flash */
|
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
else
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
color = 1;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
if (cl.frame.playerstate.stats[STAT_FLASHES] & 1)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2014-04-25 19:24:26 +00:00
|
|
|
Draw_PicScaled(x, y, "field_3", scale);
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2014-04-25 19:24:26 +00:00
|
|
|
SCR_DrawFieldScaled(x, y, color, width, value, scale);
|
2009-02-28 14:41:18 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if (!strcmp(token, "anum"))
|
|
|
|
{
|
2010-06-18 14:25:50 +00:00
|
|
|
/* ammo number */
|
2012-07-22 13:34:45 +00:00
|
|
|
int color;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
width = 3;
|
|
|
|
value = cl.frame.playerstate.stats[STAT_AMMO];
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
if (value > 5)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2010-06-18 14:25:50 +00:00
|
|
|
color = 0; /* green */
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
else if (value >= 0)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
|
|
|
color = (cl.frame.serverframe >> 2) & 1; /* flash */
|
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
else
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2010-06-18 14:25:50 +00:00
|
|
|
continue; /* negative number = don't show */
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
if (cl.frame.playerstate.stats[STAT_FLASHES] & 4)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2014-04-25 19:24:26 +00:00
|
|
|
Draw_PicScaled(x, y, "field_3", scale);
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2014-04-25 19:24:26 +00:00
|
|
|
SCR_DrawFieldScaled(x, y, color, width, value, scale);
|
2009-02-28 14:41:18 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if (!strcmp(token, "rnum"))
|
|
|
|
{
|
2010-06-18 14:25:50 +00:00
|
|
|
/* armor number */
|
2012-07-22 13:34:45 +00:00
|
|
|
int color;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
width = 3;
|
|
|
|
value = cl.frame.playerstate.stats[STAT_ARMOR];
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
if (value < 1)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
continue;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2010-06-18 14:25:50 +00:00
|
|
|
color = 0; /* green */
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
if (cl.frame.playerstate.stats[STAT_FLASHES] & 2)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2014-04-25 19:24:26 +00:00
|
|
|
Draw_PicScaled(x, y, "field_3", scale);
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2014-04-25 19:24:26 +00:00
|
|
|
SCR_DrawFieldScaled(x, y, color, width, value, scale);
|
2009-02-28 14:41:18 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if (!strcmp(token, "stat_string"))
|
|
|
|
{
|
|
|
|
token = COM_Parse(&s);
|
2012-06-02 07:31:27 +00:00
|
|
|
index = (int)strtol(token, (char **)NULL, 10);
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if ((index < 0) || (index >= MAX_CONFIGSTRINGS))
|
|
|
|
{
|
|
|
|
Com_Error(ERR_DROP, "Bad stat_string index");
|
|
|
|
}
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
index = cl.frame.playerstate.stats[index];
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if ((index < 0) || (index >= MAX_CONFIGSTRINGS))
|
|
|
|
{
|
|
|
|
Com_Error(ERR_DROP, "Bad stat_string index");
|
|
|
|
}
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2014-04-25 19:24:26 +00:00
|
|
|
DrawStringScaled(x, y, cl.configstrings[index], scale);
|
2009-02-28 14:41:18 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if (!strcmp(token, "cstring"))
|
|
|
|
{
|
|
|
|
token = COM_Parse(&s);
|
2014-04-25 19:24:26 +00:00
|
|
|
DrawHUDStringScaled(token, x, y, 320, 0, scale); // FIXME: or scale 320 here?
|
2009-02-28 14:41:18 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if (!strcmp(token, "string"))
|
|
|
|
{
|
|
|
|
token = COM_Parse(&s);
|
2014-04-25 19:24:26 +00:00
|
|
|
DrawStringScaled(x, y, token, scale);
|
2009-02-28 14:41:18 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if (!strcmp(token, "cstring2"))
|
|
|
|
{
|
|
|
|
token = COM_Parse(&s);
|
2014-04-25 19:24:26 +00:00
|
|
|
DrawHUDStringScaled(token, x, y, 320, 0x80, scale); // FIXME: or scale 320 here?
|
2009-02-28 14:41:18 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if (!strcmp(token, "string2"))
|
|
|
|
{
|
|
|
|
token = COM_Parse(&s);
|
2014-04-25 19:24:26 +00:00
|
|
|
DrawAltStringScaled(x, y, token, scale);
|
2009-02-28 14:41:18 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if (!strcmp(token, "if"))
|
|
|
|
{
|
2010-06-18 14:25:50 +00:00
|
|
|
/* draw a number */
|
2012-07-22 13:34:45 +00:00
|
|
|
token = COM_Parse(&s);
|
2012-06-02 07:31:27 +00:00
|
|
|
value = cl.frame.playerstate.stats[(int)strtol(token, (char **)NULL, 10)];
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if (!value)
|
|
|
|
{
|
2010-06-18 14:25:50 +00:00
|
|
|
/* skip to endif */
|
2012-07-22 13:34:45 +00:00
|
|
|
while (s && strcmp(token, "endif"))
|
|
|
|
{
|
|
|
|
token = COM_Parse(&s);
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2010-06-18 14:25:50 +00:00
|
|
|
* The status bar is a small layout program that
|
|
|
|
* is based on the stats array
|
|
|
|
*/
|
2012-07-22 13:34:45 +00:00
|
|
|
void
|
|
|
|
SCR_DrawStats(void)
|
|
|
|
{
|
|
|
|
SCR_ExecuteLayoutString(cl.configstrings[CS_STATUSBAR]);
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
#define STAT_LAYOUTS 13
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
void
|
|
|
|
SCR_DrawLayout(void)
|
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
if (!cl.frame.playerstate.stats[STAT_LAYOUTS])
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
return;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
SCR_ExecuteLayoutString(cl.layout);
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2013-05-01 19:12:38 +00:00
|
|
|
* This is called every frame, and can also be called
|
2012-07-22 13:34:45 +00:00
|
|
|
* explicitly to flush text to the screen.
|
2010-06-18 14:25:50 +00:00
|
|
|
*/
|
2012-07-22 13:34:45 +00:00
|
|
|
void
|
|
|
|
SCR_UpdateScreen(void)
|
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
int numframes;
|
|
|
|
int i;
|
2012-07-22 13:34:45 +00:00
|
|
|
float separation[2] = {0, 0};
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2013-05-01 19:12:38 +00:00
|
|
|
/* if the screen is disabled (loading plaque is
|
2012-07-22 13:34:45 +00:00
|
|
|
up, or vid mode changing) do nothing at all */
|
|
|
|
if (cls.disable_screen)
|
|
|
|
{
|
|
|
|
if (Sys_Milliseconds() - cls.disable_screen > 120000)
|
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
cls.disable_screen = 0;
|
2012-07-22 13:34:45 +00:00
|
|
|
Com_Printf("Loading plaque timed out.\n");
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!scr_initialized || !con.initialized)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2010-06-18 14:25:50 +00:00
|
|
|
return; /* not initialized yet */
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2010-06-18 15:52:39 +00:00
|
|
|
separation[0] = 0;
|
|
|
|
separation[1] = 0;
|
|
|
|
numframes = 1;
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
for (i = 0; i < numframes; i++)
|
|
|
|
{
|
2013-05-01 19:12:38 +00:00
|
|
|
R_BeginFrame(separation[i]);
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if (scr_draw_loading == 2)
|
|
|
|
{
|
2010-06-18 14:25:50 +00:00
|
|
|
/* loading plaque over black screen */
|
2012-07-22 13:34:45 +00:00
|
|
|
int w, h;
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2013-05-01 19:12:38 +00:00
|
|
|
R_SetPalette(NULL);
|
2010-06-18 14:25:50 +00:00
|
|
|
scr_draw_loading = false;
|
2013-05-01 19:12:38 +00:00
|
|
|
Draw_GetPicSize(&w, &h, "loading");
|
|
|
|
Draw_Pic((viddef.width - w) / 2, (viddef.height - h) / 2, "loading");
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
2010-06-18 14:25:50 +00:00
|
|
|
|
|
|
|
/* if a cinematic is supposed to be running,
|
|
|
|
handle menus and console specially */
|
2012-07-22 13:34:45 +00:00
|
|
|
else if (cl.cinematictime > 0)
|
|
|
|
{
|
|
|
|
if (cls.key_dest == key_menu)
|
|
|
|
{
|
|
|
|
if (cl.cinematicpalette_active)
|
|
|
|
{
|
2013-05-01 19:12:38 +00:00
|
|
|
R_SetPalette(NULL);
|
2010-06-18 14:25:50 +00:00
|
|
|
cl.cinematicpalette_active = false;
|
|
|
|
}
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
M_Draw();
|
|
|
|
}
|
|
|
|
else if (cls.key_dest == key_console)
|
|
|
|
{
|
|
|
|
if (cl.cinematicpalette_active)
|
|
|
|
{
|
2013-05-01 19:12:38 +00:00
|
|
|
R_SetPalette(NULL);
|
2010-06-18 14:25:50 +00:00
|
|
|
cl.cinematicpalette_active = false;
|
|
|
|
}
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
SCR_DrawConsole();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-06-18 14:25:50 +00:00
|
|
|
SCR_DrawCinematic();
|
|
|
|
}
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-06-18 14:25:50 +00:00
|
|
|
/* make sure the game palette is active */
|
2012-07-22 13:34:45 +00:00
|
|
|
if (cl.cinematicpalette_active)
|
|
|
|
{
|
2013-05-01 19:12:38 +00:00
|
|
|
R_SetPalette(NULL);
|
2010-06-18 14:25:50 +00:00
|
|
|
cl.cinematicpalette_active = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* do 3D refresh drawing, and then update the screen */
|
2012-07-22 13:34:45 +00:00
|
|
|
SCR_CalcVrect();
|
2010-06-18 14:25:50 +00:00
|
|
|
|
|
|
|
/* clear any dirty part of the background */
|
2012-07-22 13:34:45 +00:00
|
|
|
SCR_TileClear();
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
V_RenderView(separation[i]);
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
SCR_DrawStats();
|
2010-06-18 14:25:50 +00:00
|
|
|
|
|
|
|
if (cl.frame.playerstate.stats[STAT_LAYOUTS] & 1)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
|
|
|
SCR_DrawLayout();
|
|
|
|
}
|
2010-06-18 14:25:50 +00:00
|
|
|
|
|
|
|
if (cl.frame.playerstate.stats[STAT_LAYOUTS] & 2)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
|
|
|
CL_DrawInventory();
|
|
|
|
}
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
SCR_DrawNet();
|
|
|
|
SCR_CheckDrawCenterString();
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if (cl_drawfps->value)
|
|
|
|
{
|
2010-06-18 14:25:50 +00:00
|
|
|
char s[8];
|
2013-05-18 16:59:12 +00:00
|
|
|
sprintf(s, "%3.0ffps", 1 / cls.frametime);
|
2012-07-22 13:34:45 +00:00
|
|
|
DrawString(viddef.width - 64, 0, s);
|
2010-06-18 14:25:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (scr_timegraph->value)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
|
|
|
SCR_DebugGraph(cls.frametime * 300, 0);
|
|
|
|
}
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if (scr_debuggraph->value || scr_timegraph->value ||
|
|
|
|
scr_netgraph->value)
|
|
|
|
{
|
|
|
|
SCR_DrawDebugGraph();
|
|
|
|
}
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
SCR_DrawPause();
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
SCR_DrawConsole();
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
M_Draw();
|
2010-06-18 14:25:50 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
SCR_DrawLoading();
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
|
|
|
}
|
2012-07-22 13:34:45 +00:00
|
|
|
|
2013-05-01 19:12:38 +00:00
|
|
|
GLimp_EndFrame();
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
2010-06-18 16:41:26 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
void
|
|
|
|
SCR_DrawCrosshair(void)
|
|
|
|
{
|
2010-06-18 16:50:27 +00:00
|
|
|
if (!crosshair->value)
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2010-06-18 16:50:27 +00:00
|
|
|
return;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2010-06-18 16:50:27 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if (crosshair->modified)
|
|
|
|
{
|
2010-06-18 16:50:27 +00:00
|
|
|
crosshair->modified = false;
|
2012-07-22 13:34:45 +00:00
|
|
|
SCR_TouchPics();
|
2010-06-18 16:50:27 +00:00
|
|
|
}
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if (crosshair_scale->modified)
|
|
|
|
{
|
|
|
|
crosshair_scale->modified = false;
|
2010-06-18 16:50:27 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if (crosshair_scale->value > 5)
|
|
|
|
{
|
2010-06-18 16:50:27 +00:00
|
|
|
Cvar_SetValue("crosshair_scale", 5);
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2010-06-18 16:50:27 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
else if (crosshair_scale->value < 0.25)
|
|
|
|
{
|
2010-06-18 16:50:27 +00:00
|
|
|
Cvar_SetValue("crosshair_scale", 0.25);
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2010-06-18 16:50:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!crosshair_pic[0])
|
2012-07-22 13:34:45 +00:00
|
|
|
{
|
2010-06-18 16:50:27 +00:00
|
|
|
return;
|
2012-07-22 13:34:45 +00:00
|
|
|
}
|
2010-06-18 16:50:27 +00:00
|
|
|
|
2013-05-01 19:12:38 +00:00
|
|
|
Draw_Pic(scr_vrect.x + ((scr_vrect.width - crosshair_width) >> 1),
|
2012-07-22 13:34:45 +00:00
|
|
|
scr_vrect.y + ((scr_vrect.height - crosshair_height) >> 1),
|
|
|
|
crosshair_pic);
|
2010-06-18 16:50:27 +00:00
|
|
|
}
|
2012-07-22 13:34:45 +00:00
|
|
|
|
2014-05-06 17:45:11 +00:00
|
|
|
float
|
2014-06-21 16:54:57 +00:00
|
|
|
SCR_GetScale(void)
|
2014-05-06 17:45:11 +00:00
|
|
|
{
|
|
|
|
float scale;
|
|
|
|
|
|
|
|
if (gl_hudscale->value < 0)
|
|
|
|
{
|
|
|
|
int i = viddef.width / 640;
|
2014-05-08 02:12:39 +00:00
|
|
|
int j = viddef.height / 240;
|
2014-05-06 17:45:11 +00:00
|
|
|
|
2014-05-08 02:12:39 +00:00
|
|
|
if (i > j)
|
2014-05-06 17:45:11 +00:00
|
|
|
{
|
2014-05-08 02:12:39 +00:00
|
|
|
i = j;
|
2014-05-06 17:45:11 +00:00
|
|
|
}
|
|
|
|
if (i < 1)
|
|
|
|
{
|
|
|
|
i = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
scale = i;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
scale = gl_hudscale->value;
|
|
|
|
}
|
|
|
|
|
|
|
|
return scale;
|
|
|
|
}
|
|
|
|
|
2014-06-21 16:54:57 +00:00
|
|
|
float
|
|
|
|
SCR_GetHUDScale(void)
|
|
|
|
{
|
|
|
|
float scale;
|
|
|
|
|
|
|
|
if (gl_hudscale->value < 0)
|
|
|
|
{
|
|
|
|
scale = SCR_GetScale();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
scale = gl_hudscale->value;
|
|
|
|
}
|
|
|
|
|
|
|
|
return scale;
|
|
|
|
}
|
|
|
|
|
|
|
|
float
|
|
|
|
SCR_GetConsoleScale(void)
|
|
|
|
{
|
|
|
|
float scale;
|
|
|
|
|
|
|
|
if (gl_consolescale->value < 0)
|
|
|
|
{
|
|
|
|
scale = SCR_GetScale();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
scale = gl_consolescale->value;
|
|
|
|
}
|
|
|
|
|
|
|
|
return scale;
|
|
|
|
}
|