[renderer] Move r_ambient and r_drawflat to client code

It makes more sense for these cvars to be under client control via
r_refdef. Completely disabled in qw, and currently ignored in nq.
This commit is contained in:
Bill Currie 2022-03-09 22:51:21 +09:00
parent 5477352e93
commit 3414eb12a3
6 changed files with 12 additions and 15 deletions

View file

@ -208,6 +208,7 @@ typedef struct {
vec4f_t viewrotation;
int ambientlight;
int drawflat;
float fov_x, fov_y;
} refdef_t;

View file

@ -48,12 +48,10 @@ extern struct cvar_s *gl_vector_light;
extern struct cvar_s *r_aliasstats;
extern struct cvar_s *r_aliastransadj;
extern struct cvar_s *r_aliastransbase;
extern struct cvar_s *r_ambient;
extern struct cvar_s *r_clearcolor;
extern struct cvar_s *r_dlight_lightmap;
extern struct cvar_s *r_drawentities;
extern struct cvar_s *r_drawexplosions;
extern struct cvar_s *r_drawflat;
extern struct cvar_s *r_drawviewmodel;
extern struct cvar_s *r_dspeeds;
extern struct cvar_s *r_dynamic;

View file

@ -53,13 +53,11 @@ cvar_t *d_mipscale;
cvar_t *r_aliasstats;
cvar_t *r_aliastransadj;
cvar_t *r_aliastransbase;
cvar_t *r_ambient;
cvar_t *r_clearcolor;
cvar_t *r_dlight_lightmap;
cvar_t *r_dlight_max;
cvar_t *r_drawentities;
cvar_t *r_drawexplosions;
cvar_t *r_drawflat;
cvar_t *r_drawviewmodel;
cvar_t *r_dspeeds;
cvar_t *r_dynamic;
@ -230,8 +228,6 @@ R_Init_Cvars (void)
r_aliastransbase = Cvar_Get ("r_aliastransbase", "200", CVAR_NONE, NULL,
"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");
@ -245,8 +241,6 @@ R_Init_Cvars (void)
"everything but the world)");
r_drawexplosions = Cvar_Get ("r_drawexplosions", "1", CVAR_ARCHIVE, NULL,
"Draw explosions.");
r_drawflat = Cvar_Get ("r_drawflat", "0", CVAR_NONE, NULL,
"Toggles the drawing of textures");
r_drawviewmodel = Cvar_Get ("r_drawviewmodel", "1", CVAR_ARCHIVE, NULL,
"Toggles view model drawing (your weapons)");
r_dspeeds = Cvar_Get ("r_dspeeds", "0", CVAR_NONE, NULL,

View file

@ -158,7 +158,7 @@ D_DrawSurfaces (void)
VectorCopy (transformed_modelorg, world_transformed_modelorg);
// TODO: could preset a lot of this at mode set time
if (r_drawflat->int_val) {
if (r_refdef.drawflat) {
for (s = &surfaces[1]; s < surface_p; s++) {
if (!s->spans)
continue;

View file

@ -194,10 +194,6 @@ R_SetupFrame (void)
vrect_t vrect;
float w, h;
// don't allow cheats in multiplayer
Cvar_SetValue (r_ambient, 0);
Cvar_SetValue (r_drawflat, 0);
if (r_numsurfs->int_val) {
if ((surface_p - surfaces) > r_maxsurfsseen)
r_maxsurfsseen = surface_p - surfaces;
@ -217,8 +213,6 @@ R_SetupFrame (void)
r_numallocatededges, r_maxedgesseen);
}
r_refdef.ambientlight = max (r_ambient->value, 0);
R_CheckVariables ();
R_AnimateLight ();

View file

@ -81,6 +81,9 @@ cvar_t *cl_nolerp;
cvar_t *hud_fps;
cvar_t *hud_time;
static cvar_t *r_ambient;
static cvar_t *r_drawflat;
int fps_count;
client_static_t cls;
@ -182,6 +185,13 @@ CL_InitCvars (void)
Cvar_MakeAlias ("show_fps", hud_fps);
hud_time = Cvar_Get ("hud_time", "0", CVAR_ARCHIVE, NULL,
"display the current time");
//FIXME not hooked up (don't do anything), but should not work in
//multi-player
r_ambient = Cvar_Get ("r_ambient", "0", CVAR_NONE, NULL,
"Determines the ambient lighting for a level");
r_drawflat = Cvar_Get ("r_drawflat", "0", CVAR_NONE, NULL,
"Toggles the drawing of textures");
}
void