Redo r_wateralpha so that it doesn't force its value based on the watervis

serverinfo. Instead, create a new cl_wateralpha float variable that is set to
r_wateralpha->value in Host_Frame, and use that float during rendering.
This commit is contained in:
Jeff Teunissen 2002-04-25 12:51:04 +00:00
parent cd6217bd21
commit 5b069de40c
5 changed files with 17 additions and 9 deletions

View file

@ -55,7 +55,6 @@ typedef struct
#define CSHIFT_POWERUP 3
#define NUM_CSHIFTS 4
// viewmodel lighting =======================================================
typedef struct {
@ -97,6 +96,8 @@ extern struct cvar_s *r_reportedgeout;
extern struct cvar_s *r_maxedges;
extern struct cvar_s *r_numedges;
extern float cl_wateralpha;
#define XCENTERING (1.0 / 2.0)
#define YCENTERING (1.0 / 2.0)

View file

@ -560,9 +560,9 @@ static void
GL_WaterSurface (msurface_t *s)
{
qfglBindTexture (GL_TEXTURE_2D, s->texinfo->texture->gl_texturenum);
if (r_wateralpha->value < 1.0) {
if (cl_wateralpha < 1.0) {
qfglDepthMask (GL_FALSE);
color_white[3] = r_wateralpha->value * 255;
color_white[3] = cl_wateralpha * 255;
qfglColor4ubv (color_white);
EmitWaterPolys (s);
qfglColor3ubv (color_white);
@ -583,9 +583,9 @@ R_DrawWaterSurfaces (void)
// go back to the world matrix
qfglLoadMatrixf (r_world_matrix);
if (r_wateralpha->value < 1.0) {
if (cl_wateralpha < 1.0) {
qfglDepthMask (GL_FALSE);
color_white[3] = r_wateralpha->value * 255;
color_white[3] = cl_wateralpha * 255;
qfglColor4ubv (color_white);
}
@ -601,7 +601,7 @@ R_DrawWaterSurfaces (void)
waterchain = NULL;
waterchain_tail = &waterchain;
if (r_wateralpha->value < 1.0) {
if (cl_wateralpha < 1.0) {
qfglDepthMask (GL_TRUE);
qfglColor3ubv (color_white);
}
@ -798,7 +798,7 @@ R_RecursiveWorldNode (mnode_t *node)
continue; // wrong side
if (surf->flags & SURF_DRAWTURB) {
// if (r_wateralpha->value < 1.0) // FIXME: DESPAIR
// if (cl_wateralpha < 1.0) // FIXME: DESPAIR
CHAIN_SURF_B2F (surf, waterchain);
// else
// CHAIN_SURF (surf, waterchain);

View file

@ -131,6 +131,7 @@ cvar_t *scr_showram;
cvar_t *scr_showturtle;
cvar_t *scr_viewsize;
float cl_wateralpha;
static void
r_particles_f (cvar_t *var)

View file

@ -660,6 +660,8 @@ _Host_Frame (float time)
r_view_model = &cl.viewent;
r_frametime = host_frametime;
cl_wateralpha = r_wateralpha->value;
CL_UpdateScreen (cl.time);
if (host_speeds->int_val)

View file

@ -1551,8 +1551,12 @@ Host_Frame (float time)
r_frametime = host_frametime;
// don't allow cheats in multiplayer
if (r_active && !cl.watervis && r_wateralpha->value != 1.0)
Cvar_SetValue (r_wateralpha, 1);
if (r_active) {
if (!cl.watervis)
cl_wateralpha = r_wateralpha->value;
else
cl_wateralpha = 1.0;
}
CL_UpdateScreen (realtime);