make r_dlightframecount and surfrowbytes local

This commit is contained in:
Denis Pauk 2018-07-25 17:06:23 +03:00
parent fcae2fcbcd
commit aec8f3fc8b
5 changed files with 24 additions and 30 deletions

View file

@ -545,7 +545,6 @@ extern float se_time1, se_time2, de_time1, de_time2, dv_time1, dv_time2;
extern int r_viewcluster, r_oldviewcluster; extern int r_viewcluster, r_oldviewcluster;
extern int r_clipflags; extern int r_clipflags;
extern int r_dlightframecount;
extern image_t *r_notexture_mip; extern image_t *r_notexture_mip;
extern model_t *r_worldmodel; extern model_t *r_worldmodel;

View file

@ -21,13 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "header/local.h" #include "header/local.h"
static finalvert_t fv[2][8];
void R_AliasProjectAndClipTestFinalVert (finalvert_t *fv); void R_AliasProjectAndClipTestFinalVert (finalvert_t *fv);
static void R_Alias_clip_top (finalvert_t *pfv0, finalvert_t *pfv1, finalvert_t *out);
static void R_Alias_clip_bottom (finalvert_t *pfv0, finalvert_t *pfv1, finalvert_t *out);
static void R_Alias_clip_left (finalvert_t *pfv0, finalvert_t *pfv1, finalvert_t *out);
static void R_Alias_clip_right (finalvert_t *pfv0, finalvert_t *pfv1, finalvert_t *out);
/* /*
================ ================
@ -226,6 +220,7 @@ void R_AliasClipTriangle (finalvert_t *index0, finalvert_t *index1, finalvert_t
{ {
int i, k, pingpong; int i, k, pingpong;
unsigned clipflags; unsigned clipflags;
finalvert_t fv[2][8];
// copy vertexes and fix seam texture coordinates // copy vertexes and fix seam texture coordinates
fv[0][0] = *index0; fv[0][0] = *index0;

View file

@ -21,9 +21,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "header/local.h" #include "header/local.h"
int r_dlightframecount;
/* /*
============================================================================= =============================================================================
@ -38,7 +35,7 @@ R_MarkLights
============= =============
*/ */
static void static void
R_MarkLights (dlight_t *light, int bit, mnode_t *node) R_MarkLights (dlight_t *light, int bit, mnode_t *node, int r_dlightframecount)
{ {
mplane_t *splitplane; mplane_t *splitplane;
float dist; float dist;
@ -61,12 +58,12 @@ R_MarkLights (dlight_t *light, int bit, mnode_t *node)
if (dist > i) // PGM (dist > light->intensity) if (dist > i) // PGM (dist > light->intensity)
{ {
R_MarkLights (light, bit, node->children[0]); R_MarkLights (light, bit, node->children[0], r_dlightframecount);
return; return;
} }
if (dist < -i) // PGM (dist < -light->intensity) if (dist < -i) // PGM (dist < -light->intensity)
{ {
R_MarkLights (light, bit, node->children[1]); R_MarkLights (light, bit, node->children[1], r_dlightframecount);
return; return;
} }
@ -82,8 +79,8 @@ R_MarkLights (dlight_t *light, int bit, mnode_t *node)
surf->dlightbits |= bit; surf->dlightbits |= bit;
} }
R_MarkLights (light, bit, node->children[0]); R_MarkLights (light, bit, node->children[0], r_dlightframecount);
R_MarkLights (light, bit, node->children[1]); R_MarkLights (light, bit, node->children[1], r_dlightframecount);
} }
@ -97,11 +94,11 @@ void R_PushDlights (model_t *model)
int i; int i;
dlight_t *l; dlight_t *l;
r_dlightframecount = r_framecount;
for (i=0, l = r_newrefdef.dlights ; i<r_newrefdef.num_dlights ; i++, l++) for (i=0, l = r_newrefdef.dlights ; i<r_newrefdef.num_dlights ; i++, l++)
{ {
R_MarkLights ( l, 1<<i, R_MarkLights ( l, 1<<i,
model->nodes + model->firstnode); model->nodes + model->firstnode,
r_framecount);
} }
} }

View file

@ -866,7 +866,6 @@ R_DrawBEntitiesOnList (void)
VectorCopy (modelorg, oldorigin); VectorCopy (modelorg, oldorigin);
insubmodel = true; insubmodel = true;
r_dlightframecount = r_framecount;
for (i=0 ; i<r_newrefdef.num_entities ; i++) for (i=0 ; i<r_newrefdef.num_entities ; i++)
{ {

View file

@ -26,14 +26,13 @@ static int lightleft, blocksize, sourcetstep;
static int lightright, lightleftstep, lightrightstep, blockdivshift; static int lightright, lightleftstep, lightrightstep, blockdivshift;
static void *prowdestbase; static void *prowdestbase;
static unsigned char *pbasesource; static unsigned char *pbasesource;
static int surfrowbytes; // used by ASM files
static int r_stepback; static int r_stepback;
static int r_lightwidth; static int r_lightwidth;
static int r_numhblocks, r_numvblocks; static int r_numhblocks, r_numvblocks;
static unsigned char *r_source, *r_sourcemax; static unsigned char *r_source, *r_sourcemax;
static unsigned *r_lightptr; static unsigned *r_lightptr;
static void R_DrawSurfaceBlock8_anymip (int level); static void R_DrawSurfaceBlock8_anymip (int level, int surfrowbytes);
void R_BuildLightMap (void); void R_BuildLightMap (void);
extern unsigned blocklights[1024]; // allow some very large lightmaps extern unsigned blocklights[1024]; // allow some very large lightmaps
@ -51,7 +50,8 @@ R_TextureAnimation
Returns the proper texture for a given time and base texture Returns the proper texture for a given time and base texture
=============== ===============
*/ */
static image_t *R_TextureAnimation (mtexinfo_t *tex) static image_t *
R_TextureAnimation (mtexinfo_t *tex)
{ {
int c; int c;
@ -74,7 +74,8 @@ static image_t *R_TextureAnimation (mtexinfo_t *tex)
R_DrawSurface R_DrawSurface
=============== ===============
*/ */
static void R_DrawSurface (void) static void
R_DrawSurface (void)
{ {
unsigned char *basetptr; unsigned char *basetptr;
int smax, tmax, twidth; int smax, tmax, twidth;
@ -84,8 +85,6 @@ static void R_DrawSurface (void)
unsigned char *pcolumndest; unsigned char *pcolumndest;
image_t *mt; image_t *mt;
surfrowbytes = r_drawsurf.rowbytes;
mt = r_drawsurf.image; mt = r_drawsurf.image;
r_source = mt->pixels[r_drawsurf.surfmip]; r_source = mt->pixels[r_drawsurf.surfmip];
@ -134,7 +133,7 @@ static void R_DrawSurface (void)
pbasesource = basetptr + soffset; pbasesource = basetptr + soffset;
R_DrawSurfaceBlock8_anymip(NUM_MIPS - r_drawsurf.surfmip); R_DrawSurfaceBlock8_anymip(NUM_MIPS - r_drawsurf.surfmip, r_drawsurf.rowbytes);
soffset = soffset + blocksize; soffset = soffset + blocksize;
if (soffset >= smax) if (soffset >= smax)
@ -152,7 +151,8 @@ static void R_DrawSurface (void)
R_DrawSurfaceBlock8_anymip R_DrawSurfaceBlock8_anymip
================ ================
*/ */
static void R_DrawSurfaceBlock8_anymip (int level) static void
R_DrawSurfaceBlock8_anymip (int level, int surfrowbytes)
{ {
int v, i, b, lightstep, lighttemp, light, size; int v, i, b, lightstep, lighttemp, light, size;
unsigned char pix, *psource, *prowdest; unsigned char pix, *psource, *prowdest;
@ -206,7 +206,8 @@ R_InitCaches
================ ================
*/ */
void R_InitCaches (void) void
R_InitCaches (void)
{ {
int size; int size;
@ -245,7 +246,8 @@ void R_InitCaches (void)
D_FlushCaches D_FlushCaches
================== ==================
*/ */
void D_FlushCaches (void) void
D_FlushCaches (void)
{ {
surfcache_t *c; surfcache_t *c;
@ -269,7 +271,8 @@ void D_FlushCaches (void)
D_SCAlloc D_SCAlloc
================= =================
*/ */
static surfcache_t *D_SCAlloc (int width, int size) static surfcache_t *
D_SCAlloc (int width, int size)
{ {
surfcache_t *new; surfcache_t *new;
@ -340,7 +343,8 @@ static surfcache_t *D_SCAlloc (int width, int size)
D_CacheSurface D_CacheSurface
================ ================
*/ */
surfcache_t *D_CacheSurface (msurface_t *surface, int miplevel) surfcache_t *
D_CacheSurface (msurface_t *surface, int miplevel)
{ {
surfcache_t *cache; surfcache_t *cache;