2001-05-31 05:33:13 +00:00
|
|
|
/*
|
|
|
|
r_cvar.c
|
|
|
|
|
|
|
|
renderer cvar definitions
|
|
|
|
|
|
|
|
Copyright (C) 2000 Bill Currie
|
|
|
|
Ragnvald Maartmann-Moe IV
|
|
|
|
|
|
|
|
Author: Bill Currie
|
|
|
|
Ragnvald Maartmann-Moe IV
|
|
|
|
Date: 2001/5/17
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to:
|
|
|
|
|
|
|
|
Free Software Foundation, Inc.
|
|
|
|
59 Temple Place - Suite 330
|
|
|
|
Boston, MA 02111-1307, USA
|
|
|
|
|
|
|
|
*/
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
2001-08-02 02:18:04 +00:00
|
|
|
|
2001-05-11 19:21:48 +00:00
|
|
|
#include "QF/cvar.h"
|
2002-05-28 04:11:40 +00:00
|
|
|
#include "QF/model.h"
|
2002-06-26 22:20:12 +00:00
|
|
|
#include "QF/qendian.h"
|
2003-01-06 18:28:13 +00:00
|
|
|
#include "QF/render.h"
|
2001-05-11 19:21:48 +00:00
|
|
|
|
2002-06-26 22:20:12 +00:00
|
|
|
#include "compat.h"
|
2012-02-14 08:28:09 +00:00
|
|
|
#include "r_internal.h"
|
2001-09-05 00:08:54 +00:00
|
|
|
|
2001-12-11 22:37:30 +00:00
|
|
|
cvar_t *easter_eggs;
|
|
|
|
|
2001-05-11 19:21:48 +00:00
|
|
|
cvar_t *cl_crossx;
|
|
|
|
cvar_t *cl_crossy;
|
2012-05-21 23:23:22 +00:00
|
|
|
cvar_t *cl_verstring;
|
2001-05-11 19:21:48 +00:00
|
|
|
cvar_t *crosshair;
|
|
|
|
cvar_t *crosshaircolor;
|
|
|
|
|
|
|
|
cvar_t *d_mipcap;
|
|
|
|
cvar_t *d_mipscale;
|
|
|
|
|
|
|
|
cvar_t *r_aliasstats;
|
|
|
|
cvar_t *r_aliastransadj;
|
|
|
|
cvar_t *r_aliastransbase;
|
|
|
|
cvar_t *r_ambient;
|
|
|
|
cvar_t *r_clearcolor;
|
2001-08-25 23:23:14 +00:00
|
|
|
cvar_t *r_dlight_lightmap;
|
2001-10-09 20:35:17 +00:00
|
|
|
cvar_t *r_dlight_max;
|
2001-05-11 19:21:48 +00:00
|
|
|
cvar_t *r_drawentities;
|
2001-12-03 08:55:46 +00:00
|
|
|
cvar_t *r_drawexplosions;
|
2001-05-11 19:21:48 +00:00
|
|
|
cvar_t *r_drawflat;
|
|
|
|
cvar_t *r_drawviewmodel;
|
|
|
|
cvar_t *r_dspeeds;
|
|
|
|
cvar_t *r_dynamic;
|
2001-12-03 08:55:46 +00:00
|
|
|
cvar_t *r_explosionclip;
|
2002-05-20 05:11:12 +00:00
|
|
|
cvar_t *r_farclip;
|
2001-06-29 02:43:04 +00:00
|
|
|
cvar_t *r_firecolor;
|
2012-05-26 02:06:21 +00:00
|
|
|
cvar_t *r_flatlightstyles;
|
2001-05-11 19:21:48 +00:00
|
|
|
cvar_t *r_graphheight;
|
2001-08-25 23:23:14 +00:00
|
|
|
cvar_t *r_lightmap_components;
|
2001-05-11 19:21:48 +00:00
|
|
|
cvar_t *r_maxedges;
|
|
|
|
cvar_t *r_maxsurfs;
|
|
|
|
cvar_t *r_mirroralpha;
|
2002-06-26 22:20:12 +00:00
|
|
|
cvar_t *r_nearclip;
|
2001-05-11 19:21:48 +00:00
|
|
|
cvar_t *r_norefresh;
|
|
|
|
cvar_t *r_novis;
|
|
|
|
cvar_t *r_numedges;
|
|
|
|
cvar_t *r_numsurfs;
|
|
|
|
cvar_t *r_particles;
|
2002-01-04 03:32:59 +00:00
|
|
|
cvar_t *r_particles_style;
|
2001-12-03 08:55:46 +00:00
|
|
|
cvar_t *r_particles_max;
|
2002-06-26 22:20:12 +00:00
|
|
|
cvar_t *r_particles_nearclip;
|
2001-05-11 19:21:48 +00:00
|
|
|
cvar_t *r_reportedgeout;
|
|
|
|
cvar_t *r_reportsurfout;
|
|
|
|
cvar_t *r_shadows;
|
|
|
|
cvar_t *r_skyname;
|
|
|
|
cvar_t *r_speeds;
|
|
|
|
cvar_t *r_timegraph;
|
|
|
|
cvar_t *r_wateralpha;
|
|
|
|
cvar_t *r_waterripple;
|
|
|
|
cvar_t *r_waterwarp;
|
2001-05-16 17:08:56 +00:00
|
|
|
cvar_t *r_zgraph;
|
2001-05-11 19:21:48 +00:00
|
|
|
|
|
|
|
cvar_t *scr_fov;
|
2003-01-15 16:53:34 +00:00
|
|
|
cvar_t *scr_fisheye;
|
|
|
|
cvar_t *scr_fviews;
|
|
|
|
cvar_t *scr_ffov;
|
2001-05-11 19:21:48 +00:00
|
|
|
cvar_t *scr_showpause;
|
|
|
|
cvar_t *scr_showram;
|
|
|
|
cvar_t *scr_showturtle;
|
|
|
|
cvar_t *scr_viewsize;
|
|
|
|
|
2003-02-11 21:24:27 +00:00
|
|
|
int r_viewsize;
|
|
|
|
|
2011-12-28 00:04:26 +00:00
|
|
|
quat_t crosshair_color;
|
2001-09-22 02:37:45 +00:00
|
|
|
|
2011-12-28 00:04:26 +00:00
|
|
|
static void
|
|
|
|
crosshaircolor_f (cvar_t *var)
|
|
|
|
{
|
|
|
|
byte *color;
|
|
|
|
color = (byte *) &d_8to24table[bound (0, var->int_val, 255)];
|
|
|
|
QuatScale (color, 1.0 / 255, crosshair_color);
|
|
|
|
}
|
2003-03-24 20:21:24 +00:00
|
|
|
|
2002-05-28 04:11:40 +00:00
|
|
|
static void
|
|
|
|
r_lightmap_components_f (cvar_t *var)
|
|
|
|
{
|
|
|
|
switch (var->int_val) {
|
|
|
|
case 1:
|
|
|
|
mod_lightmap_bytes = 1;
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
case 4:
|
|
|
|
default:
|
|
|
|
mod_lightmap_bytes = 3;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-06-26 22:20:12 +00:00
|
|
|
static void
|
|
|
|
r_farclip_f (cvar_t *var)
|
|
|
|
{
|
|
|
|
Cvar_SetValue (r_farclip, bound (8.0, var->value, Q_MAXFLOAT));
|
|
|
|
if (r_particles_nearclip && r_nearclip)
|
|
|
|
Cvar_SetValue (r_particles_nearclip,
|
2002-07-08 00:05:33 +00:00
|
|
|
bound (r_nearclip->value, r_particles_nearclip->value,
|
2002-06-26 22:20:12 +00:00
|
|
|
r_farclip->value));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
r_nearclip_f (cvar_t *var)
|
|
|
|
{
|
|
|
|
Cvar_SetValue (r_nearclip, bound (0.01, var->value, 4.0));
|
|
|
|
if (r_particles_nearclip && r_farclip)
|
|
|
|
Cvar_SetValue (r_particles_nearclip,
|
2002-07-08 00:05:33 +00:00
|
|
|
bound (r_nearclip->value, r_particles_nearclip->value,
|
2002-06-26 22:20:12 +00:00
|
|
|
r_farclip->value));
|
|
|
|
}
|
|
|
|
|
2003-01-15 16:53:34 +00:00
|
|
|
static void
|
|
|
|
scr_fisheye_f (cvar_t *var)
|
|
|
|
{
|
|
|
|
if (var->int_val)
|
|
|
|
Cvar_Set (scr_fov, "90");
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
scr_ffov_f (cvar_t *var)
|
|
|
|
{
|
|
|
|
if (var->value < 130)
|
|
|
|
Cvar_Set (scr_fviews, "3");
|
|
|
|
else if (var->value < 220)
|
|
|
|
Cvar_Set (scr_fviews, "5");
|
|
|
|
else
|
|
|
|
Cvar_Set (scr_fviews, "6");
|
|
|
|
}
|
|
|
|
|
2003-02-11 21:24:27 +00:00
|
|
|
static void
|
|
|
|
viewsize_f (cvar_t *var)
|
|
|
|
{
|
2009-12-23 06:28:11 +00:00
|
|
|
if (var->int_val < 30 || var->int_val > 120) {
|
2003-02-11 21:24:27 +00:00
|
|
|
Cvar_SetValue (var, bound (30, var->int_val, 120));
|
|
|
|
} else {
|
|
|
|
vid.recalc_refdef = true;
|
|
|
|
r_viewsize = bound (0, var->int_val, 100);
|
2012-02-14 08:28:09 +00:00
|
|
|
if (vr_data.viewsize_callback)
|
|
|
|
vr_data.viewsize_callback (var);
|
2003-02-11 21:24:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-05-11 19:21:48 +00:00
|
|
|
void
|
|
|
|
R_Init_Cvars (void)
|
|
|
|
{
|
2001-05-13 00:28:50 +00:00
|
|
|
cl_crossx = Cvar_Get ("cl_crossx", "0", CVAR_ARCHIVE, NULL,
|
|
|
|
"Sets the position of the crosshair on the X-axis.");
|
|
|
|
cl_crossy = Cvar_Get ("cl_crossy", "0", CVAR_ARCHIVE, NULL,
|
|
|
|
"Sets the position of the crosshair on the Y-axis.");
|
2010-08-19 06:01:43 +00:00
|
|
|
cl_verstring = Cvar_Get ("cl_verstring", PACKAGE_VERSION, CVAR_NONE,
|
2001-05-13 00:28:50 +00:00
|
|
|
NULL, "Client version string");
|
2001-05-14 01:22:58 +00:00
|
|
|
crosshair = Cvar_Get ("crosshair", "0", CVAR_ARCHIVE, NULL, "Crosshair "
|
|
|
|
"type. 0 off, 1 old white, 2 new with colors");
|
2011-12-28 00:04:26 +00:00
|
|
|
crosshaircolor = Cvar_Get ("crosshaircolor", "79", CVAR_ARCHIVE,
|
|
|
|
crosshaircolor_f, "Color of the new crosshair");
|
2001-05-13 00:28:50 +00:00
|
|
|
d_mipcap = Cvar_Get ("d_mipcap", "0", CVAR_NONE, NULL,
|
|
|
|
"Detail level. 0 is highest, 3 is lowest.");
|
2001-05-14 01:22:58 +00:00
|
|
|
d_mipscale = Cvar_Get ("d_mipscale", "1", CVAR_NONE, NULL, "Detail level "
|
2001-05-18 21:05:38 +00:00
|
|
|
"of objects. 0 is highest, 3 is lowest.");
|
2001-05-15 02:19:36 +00:00
|
|
|
r_aliasstats = Cvar_Get ("r_polymodelstats", "0", CVAR_NONE, NULL,
|
|
|
|
"Toggles the displays of number of polygon "
|
|
|
|
"models current being viewed");
|
2001-05-14 01:22:58 +00:00
|
|
|
r_aliastransadj = Cvar_Get ("r_aliastransadj", "100", CVAR_NONE, NULL,
|
2001-05-15 02:19:36 +00:00
|
|
|
"Determines how much of an alias model is "
|
|
|
|
"clipped away and how much is viewable.");
|
2001-05-14 01:22:58 +00:00
|
|
|
r_aliastransbase = Cvar_Get ("r_aliastransbase", "200", CVAR_NONE, NULL,
|
2001-05-15 02:19:36 +00:00
|
|
|
"Determines how much of an alias model is "
|
|
|
|
"clipped away and how much is viewable");
|
|
|
|
r_ambient = Cvar_Get ("r_ambient", "0", CVAR_NONE, NULL,
|
|
|
|
"Determines the ambient lighting for a level");
|
|
|
|
r_clearcolor = Cvar_Get ("r_clearcolor", "2", CVAR_NONE, NULL,
|
|
|
|
"This sets the color for areas outside of the "
|
|
|
|
"current map");
|
2001-08-25 23:23:14 +00:00
|
|
|
r_dlight_lightmap = Cvar_Get ("r_dlight_lightmap", "1", CVAR_ARCHIVE,
|
|
|
|
NULL, "Set to 1 for high quality dynamic "
|
|
|
|
"lighting.");
|
2001-10-09 20:35:17 +00:00
|
|
|
r_dlight_max = Cvar_Get ("r_dlight_max", "32", CVAR_ARCHIVE,
|
|
|
|
R_MaxDlightsCheck, "Number of dynamic lights.");
|
2001-05-15 02:19:36 +00:00
|
|
|
r_drawentities = Cvar_Get ("r_drawentities", "1", CVAR_NONE, NULL,
|
|
|
|
"Toggles drawing of entities (almost "
|
|
|
|
"everything but the world)");
|
2001-09-24 17:52:13 +00:00
|
|
|
r_drawexplosions = Cvar_Get ("r_drawexplosions", "1", CVAR_ARCHIVE, NULL,
|
2001-12-03 08:55:46 +00:00
|
|
|
"Draw explosions.");
|
2001-05-15 02:19:36 +00:00
|
|
|
r_drawflat = Cvar_Get ("r_drawflat", "0", CVAR_NONE, NULL,
|
|
|
|
"Toggles the drawing of textures");
|
2001-05-18 21:05:38 +00:00
|
|
|
r_drawviewmodel = Cvar_Get ("r_drawviewmodel", "1", CVAR_ARCHIVE, NULL,
|
2001-05-15 02:19:36 +00:00
|
|
|
"Toggles view model drawing (your weapons)");
|
|
|
|
r_dspeeds = Cvar_Get ("r_dspeeds", "0", CVAR_NONE, NULL,
|
|
|
|
"Toggles the display of drawing speed information");
|
|
|
|
r_dynamic = Cvar_Get ("r_dynamic", "1", CVAR_NONE, NULL,
|
|
|
|
"Set to 0 to disable lightmap changes");
|
2001-09-24 17:52:13 +00:00
|
|
|
r_explosionclip = Cvar_Get ("r_explosionclip", "0", CVAR_ARCHIVE, NULL,
|
2001-12-03 08:55:46 +00:00
|
|
|
"Clip explosions.");
|
2002-06-26 22:20:12 +00:00
|
|
|
r_farclip = Cvar_Get ("r_farclip", "4096", CVAR_ARCHIVE, r_farclip_f,
|
|
|
|
"Distance of the far clipping plane from the "
|
|
|
|
"player.");
|
2002-06-12 04:37:33 +00:00
|
|
|
r_firecolor = Cvar_Get ("r_firecolor", "0.9 0.7 0.0", CVAR_ARCHIVE, NULL,
|
2001-06-29 02:43:04 +00:00
|
|
|
"color of rocket and lava ball fires");
|
2012-05-26 02:06:21 +00:00
|
|
|
r_flatlightstyles = Cvar_Get ("r_flatlightstyles", "0", CVAR_NONE, NULL,
|
|
|
|
"Disable animated lightmaps. 2 = use peak, "
|
|
|
|
"1 = use average, anything else = normal");
|
2001-05-18 21:05:38 +00:00
|
|
|
r_graphheight = Cvar_Get ("r_graphheight", "32", CVAR_NONE, NULL,
|
2001-05-15 02:19:36 +00:00
|
|
|
"Set the number of lines displayed in the "
|
|
|
|
"various graphs");
|
2001-11-05 10:11:21 +00:00
|
|
|
r_lightmap_components = Cvar_Get ("r_lightmap_components", "3", CVAR_ROM,
|
2002-05-28 04:11:40 +00:00
|
|
|
r_lightmap_components_f,
|
|
|
|
"Lightmap texture components. 1 "
|
2001-08-25 23:23:14 +00:00
|
|
|
"is greyscale, 3 is RGB, 4 is RGBA.");
|
2001-05-15 02:19:36 +00:00
|
|
|
r_maxedges = Cvar_Get ("r_maxedges", "0", CVAR_NONE, NULL,
|
|
|
|
"Sets the maximum number of edges");
|
|
|
|
r_maxsurfs = Cvar_Get ("r_maxsurfs", "0", CVAR_NONE, NULL,
|
|
|
|
"Sets the maximum number of surfaces");
|
2001-05-11 19:21:48 +00:00
|
|
|
r_mirroralpha = Cvar_Get ("r_mirroralpha", "1", CVAR_NONE, NULL, "None");
|
2002-06-26 22:20:12 +00:00
|
|
|
r_nearclip = Cvar_Get ("r_nearclip", "4", CVAR_ARCHIVE, r_nearclip_f,
|
|
|
|
"Distance of the near clipping plane from the "
|
|
|
|
"player.");
|
2004-04-16 03:24:10 +00:00
|
|
|
r_norefresh = Cvar_Get ("r_norefresh_", "0", CVAR_NONE, NULL,
|
2001-05-15 02:19:36 +00:00
|
|
|
"Set to 1 to disable display refresh");
|
|
|
|
r_novis = Cvar_Get ("r_novis", "0", CVAR_NONE, NULL, "Set to 1 to enable "
|
|
|
|
"runtime visibility checking (SLOW)");
|
|
|
|
r_numedges = Cvar_Get ("r_numedges", "0", CVAR_NONE, NULL,
|
|
|
|
"Toggles the displaying of number of edges "
|
|
|
|
"currently being viewed");
|
|
|
|
r_numsurfs = Cvar_Get ("r_numsurfs", "0", CVAR_NONE, NULL,
|
|
|
|
"Toggles the displaying of number of surfaces "
|
|
|
|
"currently being viewed");
|
2001-05-14 01:22:58 +00:00
|
|
|
r_reportedgeout = Cvar_Get ("r_reportedgeout", "0", CVAR_NONE, NULL,
|
2001-05-15 02:19:36 +00:00
|
|
|
"Toggle the display of how many edges were "
|
|
|
|
"not displayed");
|
2001-05-14 01:22:58 +00:00
|
|
|
r_reportsurfout = Cvar_Get ("r_reportsurfout", "0", CVAR_NONE, NULL,
|
2001-05-15 02:19:36 +00:00
|
|
|
"Toggle the display of how many surfaces "
|
|
|
|
"were not displayed");
|
2001-05-18 21:05:38 +00:00
|
|
|
r_shadows = Cvar_Get ("r_shadows", "0", CVAR_ARCHIVE, NULL,
|
2001-05-15 02:19:36 +00:00
|
|
|
"Set to 1 to enable shadows for entities");
|
2001-05-14 01:22:58 +00:00
|
|
|
r_skyname = Cvar_Get ("r_skyname", "none", CVAR_NONE, NULL,
|
|
|
|
"name of the current skybox");
|
2001-05-15 02:19:36 +00:00
|
|
|
r_speeds = Cvar_Get ("r_speeds", "0", CVAR_NONE, NULL, "Display drawing "
|
|
|
|
"time and statistics of what is being viewed");
|
|
|
|
r_timegraph = Cvar_Get ("r_timegraph", "0", CVAR_NONE, NULL,
|
|
|
|
"Toggle the display of a performance graph");
|
2002-04-25 14:34:15 +00:00
|
|
|
r_wateralpha = Cvar_Get ("r_wateralpha", "1", CVAR_ARCHIVE, NULL,
|
|
|
|
"Determine the opacity of liquids. 1 = opaque, "
|
2001-05-15 02:19:36 +00:00
|
|
|
"0 = transparent, otherwise translucent.");
|
|
|
|
r_waterripple = Cvar_Get ("r_waterripple", "0", CVAR_NONE, NULL,
|
|
|
|
"Set to make liquids ripple, try setting to 5");
|
|
|
|
r_waterwarp = Cvar_Get ("r_waterwarp", "1", CVAR_NONE, NULL,
|
|
|
|
"Toggles whether surfaces are warped in liquid.");
|
2001-05-16 17:08:56 +00:00
|
|
|
r_zgraph = Cvar_Get ("r_zgraph", "0", CVAR_NONE, NULL,
|
2001-05-18 21:05:38 +00:00
|
|
|
"Toggle the graph that reports the changes of "
|
|
|
|
"z-axis position");
|
2001-05-15 02:19:36 +00:00
|
|
|
scr_fov = Cvar_Get ("fov", "90", CVAR_NONE, NULL, "Your field of view in "
|
2003-01-15 16:53:34 +00:00
|
|
|
"degrees. Smaller than 90 zooms in. Don't touch in "
|
|
|
|
"fisheye mode, use ffov instead.");
|
|
|
|
scr_fisheye = Cvar_Get ("fisheye", "0", CVAR_NONE, scr_fisheye_f,
|
|
|
|
"Toggles fisheye mode.");
|
|
|
|
scr_fviews = Cvar_Get ("fviews", "6", CVAR_NONE, NULL, "The number of "
|
|
|
|
"fisheye views.");
|
|
|
|
scr_ffov = Cvar_Get ("ffov", "180", CVAR_NONE, scr_ffov_f, "Your field of "
|
|
|
|
"view in degrees in fisheye mode.");
|
2001-05-14 01:22:58 +00:00
|
|
|
scr_showpause = Cvar_Get ("showpause", "1", CVAR_NONE, NULL,
|
|
|
|
"Toggles display of pause graphic");
|
|
|
|
scr_showram = Cvar_Get ("showram", "1", CVAR_NONE, NULL,
|
2001-05-18 21:05:38 +00:00
|
|
|
"Show RAM icon if game is running low on memory");
|
2001-05-14 01:22:58 +00:00
|
|
|
scr_showturtle = Cvar_Get ("showturtle", "0", CVAR_NONE, NULL,
|
2001-05-18 21:05:38 +00:00
|
|
|
"Show a turtle icon if your fps is below 10");
|
2003-02-11 21:24:27 +00:00
|
|
|
scr_viewsize = Cvar_Get ("viewsize", "100", CVAR_ARCHIVE, viewsize_f,
|
2001-05-14 01:22:58 +00:00
|
|
|
"Set the screen size 30 minimum, 120 maximum");
|
2012-02-23 12:17:32 +00:00
|
|
|
|
|
|
|
vr_data.graphheight = r_graphheight;
|
|
|
|
vr_data.scr_viewsize = scr_viewsize;
|
2001-05-11 19:21:48 +00:00
|
|
|
}
|