From f975a94c740669254cec3155d48f83eecaf40f87 Mon Sep 17 00:00:00 2001 From: Denis Pauk Date: Thu, 17 Dec 2020 00:05:45 +0200 Subject: [PATCH] Add farsee flag to ref_soft --- src/client/refresh/soft/header/local.h | 1 + src/client/refresh/soft/sw_main.c | 14 ++++++++++---- src/client/refresh/soft/sw_surf.c | 3 +++ 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/client/refresh/soft/header/local.h b/src/client/refresh/soft/header/local.h index c8a5056b..c3439dbc 100644 --- a/src/client/refresh/soft/header/local.h +++ b/src/client/refresh/soft/header/local.h @@ -423,6 +423,7 @@ extern cvar_t *sw_retexturing; extern cvar_t *r_fullbright; extern cvar_t *r_lefthand; extern cvar_t *r_gunfov; +extern cvar_t *r_farsee; extern cvar_t *r_drawworld; extern cvar_t *r_lerpmodels; extern cvar_t *r_lightlevel; diff --git a/src/client/refresh/soft/sw_main.c b/src/client/refresh/soft/sw_main.c index e6faaa6b..6c631e2c 100644 --- a/src/client/refresh/soft/sw_main.c +++ b/src/client/refresh/soft/sw_main.c @@ -135,6 +135,7 @@ float se_time1, se_time2, de_time1, de_time2; cvar_t *r_lefthand; cvar_t *r_gunfov; +cvar_t *r_farsee; static cvar_t *sw_aliasstats; cvar_t *sw_clearcolor; cvar_t *sw_drawflat; @@ -389,6 +390,7 @@ R_RegisterVariables (void) r_lefthand = ri.Cvar_Get( "hand", "0", CVAR_USERINFO | CVAR_ARCHIVE ); r_gunfov = ri.Cvar_Get( "r_gunfov", "80", CVAR_ARCHIVE ); + r_farsee = ri.Cvar_Get("r_farsee", "0", CVAR_LATCH | CVAR_ARCHIVE); r_speeds = ri.Cvar_Get ("r_speeds", "0", 0); r_fullbright = ri.Cvar_Get ("r_fullbright", "0", 0); r_drawentities = ri.Cvar_Get ("r_drawentities", "1", 0); @@ -543,7 +545,9 @@ R_ReallocateMapBuffers (void) r_outofsurfaces = false; } - if (r_cnumsurfs < NUMSTACKSURFACES) + if ((r_farsee->value > 0) && (r_cnumsurfs < NUMSTACKSURFACES)) + r_cnumsurfs = NUMSTACKSURFACES * 2; + else if (r_cnumsurfs < NUMSTACKSURFACES) r_cnumsurfs = NUMSTACKSURFACES; // edge_t->surf limited size to short @@ -618,7 +622,9 @@ R_ReallocateMapBuffers (void) r_outofedges = false; } - if (r_numallocatededges < NUMSTACKEDGES) + if ((r_farsee->value > 0) && (r_numallocatededges < NUMSTACKEDGES * 2)) + r_numallocatededges = NUMSTACKEDGES * 2; + else if (r_numallocatededges < NUMSTACKEDGES) r_numallocatededges = NUMSTACKEDGES; r_edges = malloc (r_numallocatededges * sizeof(edge_t)); @@ -1077,12 +1083,12 @@ R_DrawBEntitiesOnList (void) { entity_t *currententity = &r_newrefdef.entities[i]; const model_t *currentmodel = currententity->model; + if ( currententity->flags & RF_BEAM ) + continue; if (!currentmodel) continue; if (currentmodel->nummodelsurfaces == 0) continue; // clip brush only - if ( currententity->flags & RF_BEAM ) - continue; if (currentmodel->type != mod_brush) continue; // see if the bounding box lets us trivially reject, also sets diff --git a/src/client/refresh/soft/sw_surf.c b/src/client/refresh/soft/sw_surf.c index e9114654..ca79b63a 100644 --- a/src/client/refresh/soft/sw_surf.c +++ b/src/client/refresh/soft/sw_surf.c @@ -221,6 +221,9 @@ R_InitCaches (void) if (pix > 64000) size += (pix-64000)*3; + if (r_farsee->value > 0) + size *= 2; + if (sw_surfcacheoverride->value > size) { size = sw_surfcacheoverride->value;