reduce gl_rmain's dependency on cl*.h

This commit is contained in:
Bill Currie 2001-05-21 00:22:35 +00:00
parent 1aef81e9ef
commit ece576ed4b
9 changed files with 51 additions and 32 deletions

View file

@ -172,7 +172,9 @@ extern int reinit_surfcache; // if 1, surface cache is currently empty
extern qboolean r_cache_thrash; // set if thrashing the surface cache
extern qboolean r_inhibit_viewmodel;
extern qboolean r_force_fullscreen;
extern qboolean r_paused;
extern entity_t *r_view_model;
extern entity_t *r_player_entity;
void *D_SurfaceCacheAddress (void);
int D_SurfaceCacheForRes (int width, int height);

View file

@ -505,6 +505,8 @@ CL_RelinkEntities (void)
vec3_t delta;
float bobjrotate;
dlight_t *dl;
r_player_entity = &cl_entities[cl.viewentity];
// determine partial update time
frac = CL_LerpPoint ();
@ -650,8 +652,9 @@ CL_RelinkEntities (void)
ent->forcelink = false;
if (i == cl.viewentity && !chase_active->int_val)
if (i == cl.viewentity && !chase_active->int_val) {
continue;
}
#ifdef QUAKE2
if (ent->effects & EF_NODRAW)
continue;

View file

@ -45,12 +45,12 @@
#include "QF/locs.h"
#include "QF/mathlib.h"
#include "QF/qargs.h"
#include "QF/render.h"
#include "QF/skin.h"
#include "QF/sound.h"
#include "QF/sys.h"
#include "QF/vid.h"
#include "chase.h"
#include "client.h"
#include "glquake.h"
#include "r_cvar.h"
@ -585,7 +585,7 @@ R_SetupAliasBlendedFrame (int frame, aliashdr_t *paliashdr, entity_t *e, qboolea
}
// wierd things start happening if blend passes 1
if (cl.paused || blend > 1)
if (r_paused || blend > 1)
blend = 1;
GL_DrawAliasBlendedFrame (paliashdr, e->pose1, e->pose2, blend, fb);
@ -635,7 +635,7 @@ R_DrawAliasModel (entity_t *e)
shadelight = R_LightPoint (currententity->origin);
// always give the gun some light
if (e == &cl.viewent)
if (e == r_view_model)
shadelight = max (shadelight, 24);
for (lnum = 0; lnum < MAX_DLIGHTS; lnum++) {
@ -832,7 +832,7 @@ R_DrawEntitiesOnList (void)
currententity = r_visedicts[i];
modelalpha = currententity->alpha;
if (currententity == &cl_entities[cl.viewentity])
if (currententity == r_player_entity)
currententity->angles[PITCH] *= 0.3;
R_DrawAliasModel (currententity);
@ -852,12 +852,12 @@ R_DrawEntitiesOnList (void)
static void
R_DrawViewModel (void)
{
currententity = &cl.viewent;
if (!r_drawviewmodel->int_val || chase_active->int_val
currententity = r_view_model;
if (r_inhibit_viewmodel
|| !r_drawviewmodel->int_val
|| envmap
|| !r_drawentities->int_val
|| (cl.stats[STAT_ITEMS] & IT_INVISIBILITY)
|| cl.stats[STAT_HEALTH] <= 0 || !currententity->model)
|| !currententity->model)
return;
// this is a HACK! --KB
@ -1103,7 +1103,7 @@ R_Mirror (void)
ent = R_NewEntity();
if (ent)
*ent = &cl_entities[cl.viewentity];
*ent = r_player_entity;
gldepthmin = 0.5;
gldepthmax = 1;

View file

@ -709,6 +709,7 @@ _Host_Frame (float time)
|| (cl.stats[STAT_ITEMS] & IT_INVISIBILITY)
|| cl.stats[STAT_HEALTH] <= 0);
r_force_fullscreen = cl.intermission;
r_paused = cl.paused;
r_view_model = &cl.viewent;
SCR_UpdateScreen (cl.time);

View file

@ -5,9 +5,11 @@
qboolean r_inhibit_viewmodel;
qboolean r_force_fullscreen;
qboolean r_paused;
double r_realtime;
dlight_t r_dlights[MAX_DLIGHTS];
entity_t *r_view_model;
entity_t *r_player_entity;
dlight_t *
R_AllocDlight (int key)

View file

@ -36,16 +36,18 @@
# include <strings.h>
#endif
#include "QF/compat.h"
#include "QF/console.h"
#include "QF/msg.h"
#include "QF/render.h"
#include "cl_cam.h"
#include "cl_ents.h"
#include "cl_main.h"
#include "cl_pred.h"
#include "cl_tent.h"
#include "QF/compat.h"
#include "QF/console.h"
#include "d_iface.h"
#include "host.h"
#include "QF/msg.h"
#include "msg_ucmd.h"
#include "pmove.h"
#include "r_dynamic.h"
@ -794,8 +796,10 @@ CL_LinkPlayers (void)
CL_NewDlight (j, org, state->effects);
// the player object never gets added
if (j == cl.playernum)
if (j == cl.playernum) {
r_player_entity = &cl_player_ents[state - frame->playerstate];
continue;
}
if (!state->modelindex)
continue;

View file

@ -96,6 +96,7 @@
#include "host.h"
#include "net.h"
#include "pmove.h"
#include "r_cvar.h"
#include "sbar.h"
#include "view.h"
@ -1484,8 +1485,13 @@ Host_Frame (float time)
|| (cl.stats[STAT_ITEMS] & IT_INVISIBILITY)
|| cl.stats[STAT_HEALTH] <= 0);
r_force_fullscreen = cl.intermission;
r_paused = cl.paused;
r_view_model = &cl.viewent;
// don't allow cheats in multiplayer
if (!atoi (Info_ValueForKey (cl.serverinfo, "watervis")))
Cvar_SetValue (r_wateralpha, 1);
SCR_UpdateScreen (realtime);
if (host_speeds->int_val)

View file

@ -45,16 +45,14 @@
#include "QF/locs.h"
#include "QF/mathlib.h"
#include "QF/qargs.h"
#include "QF/render.h"
#include "QF/skin.h"
#include "QF/sound.h"
#include "QF/sys.h"
#include "QF/vid.h"
#include "bothdefs.h"
#include "cl_cam.h"
#include "cl_main.h"
#include "cl_parse.h" //FIXME CL_NewTranslation
#include "cl_tent.h" // only for mirror support
#include "cl_parse.h"
#include "client.h"
#include "glquake.h"
#include "r_cvar.h"
#include "r_dynamic.h"
@ -63,6 +61,8 @@
entity_t r_worldentity;
qboolean r_cache_thrash; // compatability
vec3_t modelorg, r_entorigin;
entity_t *currententity;
@ -586,7 +586,7 @@ R_SetupAliasBlendedFrame (int frame, aliashdr_t *paliashdr, entity_t *e, qboolea
}
// wierd things start happening if blend passes 1
if (cl.paused || blend > 1)
if (r_paused || blend > 1)
blend = 1;
GL_DrawAliasBlendedFrame (paliashdr, e->pose1, e->pose2, blend, fb);
@ -636,7 +636,7 @@ R_DrawAliasModel (entity_t *e)
shadelight = R_LightPoint (currententity->origin);
// always give the gun some light
if (e == &cl.viewent)
if (e == r_view_model)
shadelight = max (shadelight, 24);
for (lnum = 0; lnum < MAX_DLIGHTS; lnum++) {
@ -846,6 +846,9 @@ R_DrawEntitiesOnList (void)
currententity = r_visedicts[i];
modelalpha = currententity->alpha;
if (currententity == r_player_entity)
currententity->angles[PITCH] *= 0.3;
R_DrawAliasModel (currententity);
}
@ -863,12 +866,12 @@ R_DrawEntitiesOnList (void)
static void
R_DrawViewModel (void)
{
currententity = &cl.viewent;
if (!r_drawviewmodel->int_val || !Cam_DrawViewModel ()
currententity = r_view_model;
if (r_inhibit_viewmodel
|| !r_drawviewmodel->int_val
|| envmap
|| !r_drawentities->int_val
|| (cl.stats[STAT_ITEMS] & IT_INVISIBILITY)
|| cl.stats[STAT_HEALTH] <= 0 || !currententity->model)
|| !currententity->model)
return;
// this is a HACK! --KB
@ -937,10 +940,6 @@ R_SetFrustum (void)
void
R_SetupFrame (void)
{
// don't allow cheats in multiplayer
if (!atoi (Info_ValueForKey (cl.serverinfo, "watervis")))
Cvar_SetValue (r_wateralpha, 1);
R_AnimateLight ();
r_framecount++;
@ -957,6 +956,8 @@ R_SetupFrame (void)
V_SetContentsColor (r_viewleaf->contents);
V_CalcBlend ();
r_cache_thrash = false;
c_brush_polys = 0;
c_alias_polys = 0;
@ -1094,7 +1095,6 @@ void R_RenderBrushPoly (msurface_t *fa);
void
R_Mirror (void)
{
#if 0
float d;
msurface_t *s;
entity_t **ent;
@ -1117,7 +1117,7 @@ R_Mirror (void)
ent = R_NewEntity();
if (ent)
*ent = &cl_entities[cl.viewentity];
*ent = r_player_entity;
gldepthmin = 0.5;
gldepthmax = 1;
@ -1149,7 +1149,6 @@ R_Mirror (void)
R_RenderBrushPoly (s);
r_worldentity.model->textures[mirrortexturenum]->texturechain = NULL;
glColor4f (1, 1, 1, 1);
#endif
}

View file

@ -5,9 +5,11 @@
qboolean r_inhibit_viewmodel;
qboolean r_force_fullscreen;
qboolean r_paused;
double r_realtime;
dlight_t r_dlights[MAX_DLIGHTS];
entity_t *r_view_model;
entity_t *r_player_entity;
dlight_t *
R_AllocDlight (int key)