diff --git a/engine/client/r_surf.c b/engine/client/r_surf.c index d4c067006..7cc4fa3cc 100644 --- a/engine/client/r_surf.c +++ b/engine/client/r_surf.c @@ -3947,9 +3947,6 @@ void Surf_BuildLightmaps (void) lightmap[numlightmaps] = NULL; } - r_oldviewcluster = -1; - r_oldviewcluster2 = -1; - //FIXME: unload stuff that's no longer relevant somehow. for (i = 0; i < mod_numknown; i++) { @@ -4004,9 +4001,7 @@ void Surf_NewMap (void) Surf_DeInit(); r_viewcluster = -1; - r_oldviewcluster = -5; r_viewcluster2 = -1; - r_oldviewcluster2 = -4; #ifdef BEF_PUSHDEPTH r_pushdepth = false; for (s = r_polygonoffset_submodel_maps.string; s && *s; ) @@ -4095,9 +4090,7 @@ void Surf_PreNewMap(void) r_loadbumpmapping |= r_shadow_realtime_world.ival || r_shadow_realtime_dlight.ival; #endif r_viewcluster = -1; - r_oldviewcluster = -1; r_viewcluster2 = -1; - r_oldviewcluster2 = -1; Shader_DoReload(); } diff --git a/engine/client/render.h b/engine/client/render.h index 52bc7d8a1..a37fb5765 100644 --- a/engine/client/render.h +++ b/engine/client/render.h @@ -613,9 +613,6 @@ void Media_VideoRestarted(void); void MYgluPerspective(double fovx, double fovy, double zNear, double zFar); void R_PushDlights (void); -qbyte *R_CalcVis_Q1 (void); -qbyte *R_MarkLeaves_Q2 (void); -qbyte *R_MarkLeaves_Q3 (void); void R_SetFrustum (float projmat[16], float viewmat[16]); void R_SetRenderer(rendererinfo_t *ri); qboolean R_RegisterRenderer(void *module, rendererinfo_t *ri); diff --git a/engine/client/renderer.c b/engine/client/renderer.c index 936a7b4ec..462b73485 100644 --- a/engine/client/renderer.c +++ b/engine/client/renderer.c @@ -2661,7 +2661,7 @@ unsigned int r_viewcontents; //mleaf_t *r_viewleaf, *r_oldviewleaf; //mleaf_t *r_viewleaf2, *r_oldviewleaf2; int r_viewarea; -int r_viewcluster, r_viewcluster2, r_oldviewcluster, r_oldviewcluster2; +int r_viewcluster, r_viewcluster2; /* diff --git a/engine/common/gl_q2bsp.c b/engine/common/gl_q2bsp.c index b6eb27af9..11b26c2e7 100644 --- a/engine/common/gl_q2bsp.c +++ b/engine/common/gl_q2bsp.c @@ -385,6 +385,11 @@ typedef struct cminfo_s int numfaces; #endif +#ifdef HAVE_CLIENT + int oldclusters[2]; + qbyte *oldvis; +#endif + // struct bihnode_s *bihnodes; } cminfo_t; @@ -4931,7 +4936,8 @@ static cmodel_t *CM_LoadMap (model_t *mod, qbyte *filein, size_t filelen, qboole mod->rootnode = prv->cmodels[0].headnode; mod->nummodelsurfaces = prv->cmodels[0].numsurfaces; -#ifndef SERVERONLY +#ifdef HAVE_CLIENT + prv->oldclusters[0] = prv->oldclusters[1] = -1; if (qrenderer != QR_NONE) { builddata_t *bd = NULL; @@ -7352,10 +7358,9 @@ R_MarkLeaves =============== */ #ifdef Q3BSPS -qbyte *R_MarkLeaves_Q3 (void) +qbyte *R_MarkLeaves_Q3 (model_t *mod, int clusters[2]) { static pvsbuffer_t curframevis[R_MAX_RECURSE]; - static qbyte *cvis[R_MAX_RECURSE]; qbyte *vis; int i; @@ -7363,11 +7368,12 @@ qbyte *R_MarkLeaves_Q3 (void) mleaf_t *leaf; mnode_t *node; int portal = r_refdef.recurse; + cminfo_t *prv = mod->meshinfo; if (!portal) { - if (r_oldviewcluster == r_viewcluster && !r_novis.value && r_viewcluster != -1) - return cvis[portal]; + if (prv->oldclusters[0] == clusters[0] && !r_novis.value && clusters[0] != -1) + return prv->oldvis; } // development aid to let you run around and see exactly where @@ -7376,13 +7382,13 @@ qbyte *R_MarkLeaves_Q3 (void) // return; vissequence++; - r_oldviewcluster = r_viewcluster; + prv->oldclusters[0] = clusters[0]; - if (r_novis.ival || r_viewcluster == -1 || !cl.worldmodel->vis ) + if (r_novis.ival || clusters[0] == -1 || !mod->vis ) { vis = NULL; // mark everything - for (i=0,leaf=cl.worldmodel->leafs ; inumleafs ; i++, leaf++) + for (i=0,leaf=mod->leafs ; inumleafs ; i++, leaf++) { // if (!leaf->nummarksurfaces) // { @@ -7405,8 +7411,8 @@ qbyte *R_MarkLeaves_Q3 (void) } else { - vis = CM_ClusterPVS (cl.worldmodel, r_viewcluster, &curframevis[portal], PVM_FAST); - for (i=0,leaf=cl.worldmodel->leafs ; inumleafs ; i++, leaf++) + vis = CM_ClusterPVS (mod, clusters[0], &curframevis[portal], PVM_FAST); + for (i=0,leaf=mod->leafs ; inumleafs ; i++, leaf++) { cluster = leaf->cluster; if (cluster == -1)// || !leaf->nummarksurfaces) @@ -7429,8 +7435,8 @@ qbyte *R_MarkLeaves_Q3 (void) #endif } } - cvis[portal] = vis; } + prv->oldvis = vis; return vis; } @@ -7526,7 +7532,7 @@ start: #endif #ifdef Q2BSPS -qbyte *R_MarkLeaves_Q2 (void) +qbyte *R_MarkLeaves_Q2 (model_t *mod, int viewclusters[2]) { static pvsbuffer_t curframevis[R_MAX_RECURSE]; static qbyte *cvis[R_MAX_RECURSE]; @@ -7538,57 +7544,58 @@ qbyte *R_MarkLeaves_Q2 (void) qbyte *vis; int portal = r_refdef.recurse; + cminfo_t *prv = mod->meshinfo; if (r_refdef.forcevis) { vis = cvis[portal] = r_refdef.forcedvis; - r_oldviewcluster = -1; - r_oldviewcluster2 = -1; + prv->oldclusters[0] = -1; + prv->oldclusters[1] = -1; } else { vis = cvis[portal]; if (!portal) { - if (r_oldviewcluster == r_viewcluster && r_oldviewcluster2 == r_viewcluster2) + if (prv->oldclusters[0] == viewclusters[0] && prv->oldclusters[1] == viewclusters[1]) return vis; - r_oldviewcluster = r_viewcluster; - r_oldviewcluster2 = r_viewcluster2; + prv->oldclusters[0] = viewclusters[0]; + prv->oldclusters[1] = viewclusters[1]; } else { - r_oldviewcluster = -1; - r_oldviewcluster2 = -1; + prv->oldclusters[0] = -1; + prv->oldclusters[1] = -1; } if (r_novis.ival == 2) return vis; - if (r_novis.ival || r_viewcluster == -1 || !cl.worldmodel->vis) + if (r_novis.ival || r_viewcluster == -1 || !mod->vis) { // mark everything - for (i=0 ; inumleafs ; i++) - cl.worldmodel->leafs[i].visframe = vissequence; - for (i=0 ; inumnodes ; i++) - cl.worldmodel->nodes[i].visframe = vissequence; + for (i=0 ; inumleafs ; i++) + mod->leafs[i].visframe = vissequence; + for (i=0 ; inumnodes ; i++) + mod->nodes[i].visframe = vissequence; return vis; } - if (r_viewcluster2 != r_viewcluster) // may have to combine two clusters because of solid water boundaries + if (viewclusters[1] != viewclusters[0]) // may have to combine two clusters because of solid water boundaries { - vis = CM_ClusterPVS (cl.worldmodel, r_viewcluster, &curframevis[portal], PVM_REPLACE); - vis = CM_ClusterPVS (cl.worldmodel, r_viewcluster2, &curframevis[portal], PVM_MERGE); + vis = CM_ClusterPVS (mod, viewclusters[0], &curframevis[portal], PVM_REPLACE); + vis = CM_ClusterPVS (mod, viewclusters[1], &curframevis[portal], PVM_MERGE); } else - vis = CM_ClusterPVS (cl.worldmodel, r_viewcluster, &curframevis[portal], PVM_FAST); + vis = CM_ClusterPVS (mod, viewclusters[0], &curframevis[portal], PVM_FAST); cvis[portal] = vis; } vissequence++; - for (i=0,leaf=cl.worldmodel->leafs ; inumleafs ; i++, leaf++) + for (i=0,leaf=mod->leafs ; inumleafs ; i++, leaf++) { cluster = leaf->cluster; if (cluster == -1) @@ -7724,18 +7731,18 @@ static void CM_PrepareFrame(model_t *mod, refdef_t *refdef, int area, int viewcl scenesequence++; #ifdef Q3BSPS - if (currentmodel->fromgame == fg_quake3) + if (mod->fromgame == fg_quake3) { - entvis = surfvis = R_MarkLeaves_Q3 (); - Surf_RecursiveQ3WorldNode (currentmodel->nodes, (1<nodes, (1<fromgame == fg_quake2) + if (mod->fromgame == fg_quake2) { - entvis = surfvis = R_MarkLeaves_Q2 (); - Surf_RecursiveQ2WorldNode (currentmodel->nodes); + entvis = surfvis = R_MarkLeaves_Q2 (mod, viewclusters); + Surf_RecursiveQ2WorldNode (mod->nodes); } else #endif diff --git a/engine/common/q1bsp.c b/engine/common/q1bsp.c index b8dda4404..5a9dee228 100644 --- a/engine/common/q1bsp.c +++ b/engine/common/q1bsp.c @@ -2530,8 +2530,8 @@ void Q1BSP_SetModelFuncs(model_t *mod) { struct q1bspprv_s *prv = mod->meshinfo = ZG_Malloc(&mod->memgroup, sizeof(struct q1bspprv_s)); - prv->oldviewclusters[0] = -2; //make sure its reset properly. - prv->oldviewclusters[1] = -3; + prv->oldviewclusters[0] = -1; //make sure its reset properly. + prv->oldviewclusters[1] = -1; } #endif } diff --git a/engine/gl/gl_model.c b/engine/gl/gl_model.c index 97aa8f26e..26a3d6a91 100644 --- a/engine/gl/gl_model.c +++ b/engine/gl/gl_model.c @@ -1012,11 +1012,7 @@ void Mod_ModelLoaded(void *ctx, void *data, size_t a, size_t b) #endif #ifndef SERVERONLY if (mod->type == mod_brush) - { Surf_BuildModelLightmaps(mod); - r_oldviewcluster = -1; //just in case. - r_oldviewcluster2 = -2; - } if (mod->type == mod_sprite) { Mod_LoadSpriteShaders(mod); diff --git a/engine/gl/glquake.h b/engine/gl/glquake.h index 02ef4c6be..05ce2d9d8 100644 --- a/engine/gl/glquake.h +++ b/engine/gl/glquake.h @@ -297,7 +297,7 @@ extern vec3_t r_origin; extern refdef_t r_refdef; extern unsigned int r_viewcontents; extern int r_viewarea; -extern int r_viewcluster, r_viewcluster2, r_oldviewcluster, r_oldviewcluster2; //q2 +extern int r_viewcluster, r_viewcluster2; extern texture_t *r_notexture_mip; extern texid_t netgraphtexture; // netgraph texture diff --git a/engine/server/sv_ccmds.c b/engine/server/sv_ccmds.c index fffb8c609..3fab304c2 100644 --- a/engine/server/sv_ccmds.c +++ b/engine/server/sv_ccmds.c @@ -2121,10 +2121,10 @@ static void SV_Status_f (void) if (net_enable_rtcbroker.ival) Con_Printf(" RTC"); if (net_enable_websockets.ival) - Con_Printf(" WS"); + Con_Printf(" WebSocket"); #endif if (net_enable_qizmo.ival) - Con_Printf(" QZ"); + Con_Printf(" Qizmo"); if (net_enable_qtv.ival) Con_Printf(" QTV"); #endif