summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Nazarov <skuller@skuller.net>2013-03-16 17:52:43 +0400
committerAndrey Nazarov <skuller@skuller.net>2013-03-19 03:44:50 +0400
commit8339e8a8bb4c7eb036a027ed41d54c4eaa5b8e46 (patch)
tree39a7b9a804c3d9c8312c63ac505c6bbba7b7262b
parent3d42e612e1eb3bcee520b2fb626cedd025a75861 (diff)
Make more variables and functions static.
-rw-r--r--src/client/main.c3
-rw-r--r--src/refresh/sw/alias.c29
-rw-r--r--src/refresh/sw/bsp.c12
-rw-r--r--src/refresh/sw/edge.c105
-rw-r--r--src/refresh/sw/light.c2
-rw-r--r--src/refresh/sw/main.c18
-rw-r--r--src/refresh/sw/misc.c2
-rw-r--r--src/refresh/sw/polyset.c75
-rw-r--r--src/refresh/sw/raster.c32
-rw-r--r--src/refresh/sw/sird.c8
-rw-r--r--src/refresh/sw/surf.c6
-rw-r--r--src/refresh/sw/sw.h47
12 files changed, 135 insertions, 204 deletions
diff --git a/src/client/main.c b/src/client/main.c
index 23261f0..1190130 100644
--- a/src/client/main.c
+++ b/src/client/main.c
@@ -979,7 +979,8 @@ CL_ParseInfoMessage
Handle a reply from a ping
=================
*/
-void CL_ParseInfoMessage(void) {
+static void CL_ParseInfoMessage(void)
+{
char string[MAX_QPATH];
request_t *r;
diff --git a/src/refresh/sw/alias.c b/src/refresh/sw/alias.c
index 3555f80..54fa024 100644
--- a/src/refresh/sw/alias.c
+++ b/src/refresh/sw/alias.c
@@ -26,22 +26,21 @@ int r_amodels_drawn;
affinetridesc_t r_affinetridesc;
-vec3_t r_plightvec;
-vec3_t r_lerped[1024];
-vec3_t r_lerp_frontv, r_lerp_backv, r_lerp_move;
-
-int r_ambientlight;
-fixed8_t r_aliasblendcolor[3];
-float r_shadelight;
-
int r_alias_alpha;
int r_alias_one_minus_alpha;
+fixed8_t r_aliasblendcolor[3];
+
+static vec3_t r_plightvec;
+static vec3_t r_lerp_frontv, r_lerp_backv, r_lerp_move;
+
+static int r_ambientlight;
+static float r_shadelight;
-maliasframe_t *r_thisframe, *r_lastframe;
+static maliasframe_t *r_thisframe, *r_lastframe;
-float aliastransform[3][4];
-float aliasworldtransform[3][4];
-float aliasoldworldtransform[3][4];
+static float aliastransform[3][4];
+static float aliasworldtransform[3][4];
+static float aliasoldworldtransform[3][4];
static float s_ziscale;
static vec3_t s_alias_forward, s_alias_right, s_alias_up;
@@ -56,7 +55,7 @@ static vec3_t s_alias_forward, s_alias_right, s_alias_up;
R_AliasTransformVector
================
*/
-void R_AliasTransformVector(vec3_t in, vec3_t out, float xf[3][4])
+static void R_AliasTransformVector(vec3_t in, vec3_t out, float xf[3][4])
{
out[0] = DotProduct(in, xf[0]) + xf[0][3];
out[1] = DotProduct(in, xf[1]) + xf[1][3];
@@ -69,7 +68,7 @@ void R_AliasTransformVector(vec3_t in, vec3_t out, float xf[3][4])
**
** Checks a specific alias frame bounding box
*/
-unsigned long R_AliasCheckFrameBBox(maliasframe_t *frame, float worldxf[3][4])
+static unsigned long R_AliasCheckFrameBBox(maliasframe_t *frame, float worldxf[3][4])
{
unsigned long aggregate_and_clipcode = ~0U,
aggregate_or_clipcode = 0;
@@ -155,7 +154,7 @@ unsigned long R_AliasCheckFrameBBox(maliasframe_t *frame, float worldxf[3][4])
R_AliasCheckBBox
================
*/
-qboolean R_AliasCheckBBox(void)
+static qboolean R_AliasCheckBBox(void)
{
unsigned long ccodes[2] = { 0, 0 };
diff --git a/src/refresh/sw/bsp.c b/src/refresh/sw/bsp.c
index e39fdec..cff04fd 100644
--- a/src/refresh/sw/bsp.c
+++ b/src/refresh/sw/bsp.c
@@ -25,11 +25,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,
qboolean insubmodel;
entity_t *currententity;
vec3_t modelorg; // modelorg is the viewpoint reletive to
-// the currently rendering entity
+ // the currently rendering entity
vec3_t r_entorigin; // the currently rendering entity in world
-// coordinates
+ // coordinates
-float entity_rotation[3][3];
+static float entity_rotation[3][3];
int r_currentbkey;
@@ -52,7 +52,7 @@ static qboolean makeclippededge;
R_EntityRotate
================
*/
-void R_EntityRotate(vec3_t vec)
+static void R_EntityRotate(vec3_t vec)
{
vec3_t tvec;
@@ -149,7 +149,7 @@ R_RecursiveClipBPoly
Clip a bmodel poly down the world bsp tree
================
*/
-void R_RecursiveClipBPoly(bedge_t *pedges, mnode_t *pnode, mface_t *psurf)
+static void R_RecursiveClipBPoly(bedge_t *pedges, mnode_t *pnode, mface_t *psurf)
{
bedge_t *psideedges[2], *pnextedge, *ptedge;
int i, side, lastside;
@@ -401,7 +401,7 @@ int c_drawnode;
R_RecursiveWorldNode
================
*/
-void R_RecursiveWorldNode(mnode_t *node, int clipflags)
+static void R_RecursiveWorldNode(mnode_t *node, int clipflags)
{
int i, c, side, *pindex;
vec3_t acceptpt, rejectpt;
diff --git a/src/refresh/sw/edge.c b/src/refresh/sw/edge.c
index f4b2e61..da51a57 100644
--- a/src/refresh/sw/edge.c
+++ b/src/refresh/sw/edge.c
@@ -41,40 +41,29 @@ surf_t *surfaces, *surface_p, *surf_max;
edge_t *newedges[MAXHEIGHT];
edge_t *removeedges[MAXHEIGHT];
-espan_t *span_p, *max_span_p;
+static espan_t *span_p, *max_span_p;
int r_currentkey;
-int current_iv;
+static int current_iv;
-int edge_head_u_shift20, edge_tail_u_shift20;
+static int edge_head_u_shift20, edge_tail_u_shift20;
-static void (*pdrawfunc)(void);
+static void (*pdrawfunc)(void);
-edge_t edge_head;
-edge_t edge_tail;
-edge_t edge_aftertail;
-edge_t edge_sentinel;
+static edge_t edge_head;
+static edge_t edge_tail;
+static edge_t edge_aftertail;
+static edge_t edge_sentinel;
-float fv;
+static float fv;
static int miplevel;
float scale_for_mip;
-int ubasestep, errorterm, erroradjustup, erroradjustdown;
-// FIXME: should go away
-extern void R_RotateBmodel(void);
-extern void R_TransformFrustum(void);
-
-
-
-void R_GenerateSpans(void);
-void R_GenerateSpansBackward(void);
-
-void R_LeadingEdge(edge_t *edge);
-void R_LeadingEdgeBackwards(edge_t *edge);
-void R_TrailingEdge(surf_t *surf, edge_t *edge);
+static void R_GenerateSpans(void);
+static void R_GenerateSpansBackward(void);
/*
@@ -125,12 +114,13 @@ void R_BeginEdgeFrame(void)
R_InsertNewEdges
Adds the edges in the linked list edgestoadd, adding them to the edges in the
-linked list edgelist. edgestoadd is assumed to be sorted on u, and non-empty (this is actually newedges[v]). edgelist is assumed to be sorted on u, with a
+linked list edgelist. edgestoadd is assumed to be sorted on u, and non-empty
+(this is actually newedges[v]). edgelist is assumed to be sorted on u, with a
sentinel at the end (actually, this is the active edge table starting at
edge_head.next).
==============
*/
-void R_InsertNewEdges(edge_t *edgestoadd, edge_t *edgelist)
+static void R_InsertNewEdges(edge_t *edgestoadd, edge_t *edgelist)
{
edge_t *next_edge;
@@ -165,7 +155,7 @@ addedge:
R_RemoveEdges
==============
*/
-void R_RemoveEdges(edge_t *pedge)
+static void R_RemoveEdges(edge_t *pedge)
{
do {
@@ -179,7 +169,7 @@ void R_RemoveEdges(edge_t *pedge)
R_StepActiveU
==============
*/
-void R_StepActiveU(edge_t *pedge)
+static void R_StepActiveU(edge_t *pedge)
{
edge_t *pnext_edge, *pwedge;
@@ -243,7 +233,7 @@ pushback:
R_CleanupSpan
==============
*/
-void R_CleanupSpan(void)
+static void R_CleanupSpan(void)
{
surf_t *surf;
int iu;
@@ -275,7 +265,7 @@ void R_CleanupSpan(void)
R_LeadingEdgeBackwards
==============
*/
-void R_LeadingEdgeBackwards(edge_t *edge)
+static void R_LeadingEdgeBackwards(edge_t *edge)
{
espan_t *span;
surf_t *surf, *surf2;
@@ -350,7 +340,7 @@ gotposition:
R_TrailingEdge
==============
*/
-void R_TrailingEdge(surf_t *surf, edge_t *edge)
+static void R_TrailingEdge(surf_t *surf, edge_t *edge)
{
espan_t *span;
int iu;
@@ -386,7 +376,7 @@ void R_TrailingEdge(surf_t *surf, edge_t *edge)
R_LeadingEdge
==============
*/
-void R_LeadingEdge(edge_t *edge)
+static void R_LeadingEdge(edge_t *edge)
{
espan_t *span;
surf_t *surf, *surf2;
@@ -499,7 +489,7 @@ gotposition:
R_GenerateSpans
==============
*/
-void R_GenerateSpans(void)
+static void R_GenerateSpans(void)
{
edge_t *edge;
surf_t *surf;
@@ -532,7 +522,7 @@ void R_GenerateSpans(void)
R_GenerateSpansBackward
==============
*/
-void R_GenerateSpansBackward(void)
+static void R_GenerateSpansBackward(void)
{
edge_t *edge;
@@ -668,18 +658,16 @@ SURFACE FILLING
=========================================================================
*/
-mface_t *pface;
-surfcache_t *pcurrentcache;
-vec3_t transformed_modelorg;
-vec3_t world_transformed_modelorg;
-vec3_t local_modelorg;
+static vec3_t transformed_modelorg;
+static vec3_t world_transformed_modelorg;
+static vec3_t local_modelorg;
/*
=============
D_MipLevelForScale
=============
*/
-int D_MipLevelForScale(float scale)
+static int D_MipLevelForScale(float scale)
{
int lmiplevel;
@@ -706,7 +694,7 @@ D_FlatFillSurface
Simple single color fill with no texture mapping
==============
*/
-void D_FlatFillSurface(surf_t *surf, uint32_t color)
+static void D_FlatFillSurface(surf_t *surf, uint32_t color)
{
espan_t *span;
byte *pdest;
@@ -730,7 +718,7 @@ void D_FlatFillSurface(surf_t *surf, uint32_t color)
D_CalcGradients
==============
*/
-void D_CalcGradients(mface_t *pface)
+static void D_CalcGradients(mface_t *pface)
{
float mipscale;
vec3_t p_temp1;
@@ -765,14 +753,12 @@ void D_CalcGradients(mface_t *pface)
((pface->texturemins[1] << 16) >> miplevel)
+ pface->texinfo->offset[1] * t;
- // PGM - changing flow speed for non-warping textures.
if (pface->texinfo->c.flags & SURF_FLOWING) {
if (pface->texinfo->c.flags & SURF_WARP)
sadjust += 0x10000 * (-128 * ((r_newrefdef.time * 0.25) - (int)(r_newrefdef.time * 0.25)));
else
sadjust += 0x10000 * (-128 * ((r_newrefdef.time * 0.77) - (int)(r_newrefdef.time * 0.77)));
}
- // PGM
//
// -1 (-epsilon) so we never wander off the edge of the texture
@@ -789,7 +775,7 @@ D_BackgroundSurf
The grey background filler seen when there is a hole in the map
==============
*/
-void D_BackgroundSurf(surf_t *s)
+static void D_BackgroundSurf(surf_t *s)
{
// set up a gradient for the background surface that places it
// effectively at infinity distance from the viewpoint
@@ -806,8 +792,10 @@ void D_BackgroundSurf(surf_t *s)
D_TurbulentSurf
=================
*/
-void D_TurbulentSurf(surf_t *s)
+static void D_TurbulentSurf(surf_t *s)
{
+ mface_t *pface;
+
d_zistepu = s->d_zistepu;
d_zistepv = s->d_zistepv;
d_ziorigin = s->d_ziorigin;
@@ -820,14 +808,14 @@ void D_TurbulentSurf(surf_t *s)
if (s->insubmodel) {
// FIXME: we don't want to do all this for every polygon!
// TODO: store once at start of frame
- currententity = s->entity; //FIXME: make this passed in to
- // R_RotateBmodel ()
+ currententity = s->entity; // FIXME: make this passed in to
+ // R_RotateBmodel ()
VectorSubtract(r_origin, currententity->origin,
local_modelorg);
R_TransformVector(local_modelorg, transformed_modelorg);
R_RotateBmodel(); // FIXME: don't mess with the frustum,
- // make entity passed in
+ // make entity passed in
}
D_CalcGradients(pface);
@@ -861,8 +849,10 @@ void D_TurbulentSurf(surf_t *s)
D_SkySurf
==============
*/
-void D_SkySurf(surf_t *s)
+static void D_SkySurf(surf_t *s)
{
+ mface_t *pface;
+
pface = s->msurf;
miplevel = 0;
@@ -897,8 +887,11 @@ D_SolidSurf
Normal surface cached, texture mapped surface
==============
*/
-void D_SolidSurf(surf_t *s)
+static void D_SolidSurf(surf_t *s)
{
+ surfcache_t *pcurrentcache;
+ mface_t *pface;
+
d_zistepu = s->d_zistepu;
d_zistepv = s->d_zistepv;
d_ziorigin = s->d_ziorigin;
@@ -906,21 +899,21 @@ void D_SolidSurf(surf_t *s)
if (s->insubmodel) {
// FIXME: we don't want to do all this for every polygon!
// TODO: store once at start of frame
- currententity = s->entity; //FIXME: make this passed in to
- // R_RotateBmodel ()
+ currententity = s->entity; // FIXME: make this passed in to
+ // R_RotateBmodel ()
VectorSubtract(r_origin, currententity->origin, local_modelorg);
R_TransformVector(local_modelorg, transformed_modelorg);
R_RotateBmodel(); // FIXME: don't mess with the frustum,
- // make entity passed in
- } else
+ // make entity passed in
+ } else {
currententity = &r_worldentity;
+ }
pface = s->msurf;
miplevel = D_MipLevelForScale(s->nearzi * scale_for_mip * pface->texinfo->mipadjust);
-
// FIXME: make this passed in to D_CacheSurface
pcurrentcache = D_CacheSurface(pface, miplevel);
@@ -956,7 +949,7 @@ D_DrawflatSurfaces
To allow developers to see the polygon carving of the world
=============
*/
-void D_DrawflatSurfaces(void)
+static void D_DrawflatSurfaces(void)
{
surf_t *s;
@@ -981,7 +974,7 @@ D_DrawZSurfaces
=============
*/
-void D_DrawZSurfaces(void)
+static void D_DrawZSurfaces(void)
{
surf_t *s;
diff --git a/src/refresh/sw/light.c b/src/refresh/sw/light.c
index 208b180..a42a4d4 100644
--- a/src/refresh/sw/light.c
+++ b/src/refresh/sw/light.c
@@ -35,7 +35,7 @@ DYNAMIC LIGHTS
R_MarkLights
=============
*/
-void R_MarkLights(dlight_t *light, int bit, mnode_t *node)
+static void R_MarkLights(dlight_t *light, int bit, mnode_t *node)
{
cplane_t *splitplane;
float dist;
diff --git a/src/refresh/sw/main.c b/src/refresh/sw/main.c
index 5b483af..7b59f57 100644
--- a/src/refresh/sw/main.c
+++ b/src/refresh/sw/main.c
@@ -85,8 +85,6 @@ int r_frustum_indexes[4 * 6];
mleaf_t *r_viewleaf;
int r_viewcluster, r_oldviewcluster;
-void R_MarkLeaves(void);
-
cvar_t *sw_aliasstats;
cvar_t *sw_allow_modex;
cvar_t *sw_clearcolor;
@@ -167,7 +165,7 @@ void R_InitTurb(void)
void D_SCDump_f(void);
-void R_Register(void)
+static void R_Register(void)
{
sw_aliasstats = Cvar_Get("sw_polymodelstats", "0", 0);
sw_allow_modex = Cvar_Get("sw_allow_modex", "1", CVAR_ARCHIVE);
@@ -206,7 +204,7 @@ void R_Register(void)
}
-void R_UnRegister(void)
+static void R_UnRegister(void)
{
Cmd_RemoveCommand("scdump");
}
@@ -393,7 +391,7 @@ Mark the leaves and nodes that are in the PVS for the current
cluster
===============
*/
-void R_MarkLeaves(void)
+static void R_MarkLeaves(void)
{
byte vis[VIS_MAX_BYTES];
mnode_t *node;
@@ -524,7 +522,7 @@ static void R_DrawEntitiesOnList(void)
R_BmodelCheckBBox
=============
*/
-int R_BmodelCheckBBox(float *minmaxs)
+static int R_BmodelCheckBBox(float *minmaxs)
{
int i, *pindex, clipflags;
vec3_t acceptpt, rejectpt;
@@ -571,7 +569,7 @@ R_FindTopnode
Find the first node that splits the given box
===================
*/
-mnode_t *R_FindTopnode(vec3_t mins, vec3_t maxs)
+static mnode_t *R_FindTopnode(vec3_t mins, vec3_t maxs)
{
int sides;
mnode_t *node;
@@ -609,7 +607,7 @@ RotatedBBox
Returns an axially aligned box that contains the input box at the given rotation
=============
*/
-void RotatedBBox(vec3_t mins, vec3_t maxs, vec3_t angles,
+static void RotatedBBox(vec3_t mins, vec3_t maxs, vec3_t angles,
vec3_t tmins, vec3_t tmaxs)
{
vec3_t tmp, v;
@@ -664,7 +662,7 @@ void RotatedBBox(vec3_t mins, vec3_t maxs, vec3_t angles,
R_DrawBEntitiesOnList
=============
*/
-void R_DrawBEntitiesOnList(void)
+static void R_DrawBEntitiesOnList(void)
{
int i, index, clipflags;
vec3_t oldorigin;
@@ -749,7 +747,7 @@ void R_DrawBEntitiesOnList(void)
R_EdgeDrawing
================
*/
-void R_EdgeDrawing(void)
+static void R_EdgeDrawing(void)
{
edge_t ledges[NUMSTACKEDGES +
((CACHE_SIZE - 1) / sizeof(edge_t)) + 1];
diff --git a/src/refresh/sw/misc.c b/src/refresh/sw/misc.c
index e1b0964..c5c3c88 100644
--- a/src/refresh/sw/misc.c
+++ b/src/refresh/sw/misc.c
@@ -174,7 +174,7 @@ void R_TransformPlane(cplane_t *p, float *normal, float *dist)
R_SetUpFrustumIndexes
===============
*/
-void R_SetUpFrustumIndexes(void)
+static void R_SetUpFrustumIndexes(void)
{
int i, j, *pindex;
diff --git a/src/refresh/sw/polyset.c b/src/refresh/sw/polyset.c
index 73d1d04..b75f3b9 100644
--- a/src/refresh/sw/polyset.c
+++ b/src/refresh/sw/polyset.c
@@ -46,9 +46,9 @@ typedef struct {
aliastriangleparms_t aliastriangleparms;
-int r_p0[6], r_p1[6], r_p2[6];
+static int r_p0[6], r_p1[6], r_p2[6];
-int d_xdenom;
+static int d_xdenom;
static const edgetable_t *pedgetable;
@@ -67,23 +67,24 @@ static const edgetable_t edgetables[12] = {
{0, 1, r_p0, r_p2, NULL, 1, r_p0, r_p1, NULL},
};
-// FIXME: some of these can become statics
-int a_sstepxfrac, a_tstepxfrac, r_lstepx, a_ststepxwhole;
-int r_sstepx, r_tstepx, r_lstepy, r_sstepy, r_tstepy;
-int r_zistepx, r_zistepy;
-int d_aspancount, d_countextrastep;
-
-spanpackage_t *a_spans;
-spanpackage_t *d_pedgespanpackage;
-byte *d_pdest, *d_ptex;
-short *d_pz;
-int d_sfrac, d_tfrac, d_light, d_zi;
-int d_ptexextrastep, d_sfracextrastep;
-int d_tfracextrastep, d_lightextrastep, d_pdestextrastep;
-int d_lightbasestep, d_pdestbasestep, d_ptexbasestep;
-int d_sfracbasestep, d_tfracbasestep;
-int d_ziextrastep, d_zibasestep;
-int d_pzextrastep, d_pzbasestep;
+static int a_sstepxfrac, a_tstepxfrac, r_lstepx, a_ststepxwhole;
+static int r_sstepx, r_tstepx, r_lstepy, r_sstepy, r_tstepy;
+static int r_zistepx, r_zistepy;
+static int d_aspancount, d_countextrastep;
+
+static int ubasestep, errorterm, erroradjustup, erroradjustdown;
+
+static spanpackage_t *a_spans;
+static spanpackage_t *d_pedgespanpackage;
+static byte *d_pdest, *d_ptex;
+static short *d_pz;
+static int d_sfrac, d_tfrac, d_light, d_zi;
+static int d_ptexextrastep, d_sfracextrastep;
+static int d_tfracextrastep, d_lightextrastep, d_pdestextrastep;
+static int d_lightbasestep, d_pdestbasestep, d_ptexbasestep;
+static int d_sfracbasestep, d_tfracbasestep;
+static int d_ziextrastep, d_zibasestep;
+static int d_pzextrastep, d_pzbasestep;
typedef struct {
int quotient;
@@ -94,9 +95,9 @@ static const adivtab_t adivtab[32 * 32] = {
#include "adivtab.h"
};
-byte *skintable[MAX_LBM_HEIGHT];
-int skinwidth;
-byte *skinstart;
+static byte *skintable[MAX_LBM_HEIGHT];
+static int skinwidth;
+static byte *skinstart;
void (*d_pdrawspans)(spanpackage_t *pspanpackage);
@@ -104,11 +105,8 @@ void R_PolysetDrawSpansConstant8_Blended(spanpackage_t *pspanpackage);
void R_PolysetDrawSpans8_Blended(spanpackage_t *pspanpackage);
void R_PolysetDrawSpans8_Opaque(spanpackage_t *pspanpackage);
-void R_PolysetCalcGradients(int skinwidth);
-void R_PolysetSetEdgeTable(void);
-void R_RasterizeAliasPolySmooth(void);
-void R_PolysetScanLeftEdge(int height);
-void R_PolysetScanLeftEdge_C(int height);
+static void R_PolysetSetEdgeTable(void);
+static void R_RasterizeAliasPolySmooth(void);
/*
================
@@ -139,15 +137,9 @@ R_DrawTriangle
void R_DrawTriangle(void)
{
spanpackage_t spans[DPS_MAXSPANS];
-
int dv1_ab, dv0_ac;
int dv0_ab, dv1_ac;
- /*
- d_xdenom = (aliastriangleparms.a->v[1] - aliastriangleparms.b->v[1]) * (aliastriangleparms.a->v[0] - aliastriangleparms.c->v[0]) -
- (aliastriangleparms.a->v[0] - aliastriangleparms.b->v[0]) * (aliastriangleparms.a->v[1] - aliastriangleparms.c->v[1]);
- */
-
dv0_ab = aliastriangleparms.a->u - aliastriangleparms.b->u;
dv1_ab = aliastriangleparms.a->v - aliastriangleparms.b->v;
@@ -261,14 +253,12 @@ quotient must fit in 32 bits.
FIXME: GET RID OF THIS! (FloorDivMod)
====================
*/
-void FloorDivMod(float numer, float denom, int *quotient,
- int *rem)
+static void FloorDivMod(float numer, float denom, int *quotient, int *rem)
{
int q, r;
float x;
if (numer >= 0.0) {
-
x = floor(numer / denom);
q = (int)x;
r = (int)floor(numer - (x * denom));
@@ -295,15 +285,13 @@ void FloorDivMod(float numer, float denom, int *quotient,
R_PolysetSetUpForLineScan
====================
*/
-void R_PolysetSetUpForLineScan(fixed8_t startvertu, fixed8_t startvertv,
- fixed8_t endvertu, fixed8_t endvertv)
+static void R_PolysetSetUpForLineScan(fixed8_t startvertu, fixed8_t startvertv,
+ fixed8_t endvertu, fixed8_t endvertv)
{
float dm, dn;
int tm, tn;
const adivtab_t *ptemp;
-// TODO: implement x86 version
-
errorterm = -1;
tm = endvertu - startvertu;
@@ -330,8 +318,7 @@ void R_PolysetSetUpForLineScan(fixed8_t startvertu, fixed8_t startvertv,
R_PolysetCalcGradients
================
*/
-
-void R_PolysetCalcGradients(int skinwidth)
+static void R_PolysetCalcGradients(int skinwidth)
{
float xstepdenominv, ystepdenominv, t0, t1;
float p01_minus_p21, p11_minus_p21, p00_minus_p20, p10_minus_p20;
@@ -761,12 +748,12 @@ void R_RasterizeAliasPolySmooth(void)
R_PolysetSetEdgeTable
================
*/
-void R_PolysetSetEdgeTable(void)
+static void R_PolysetSetEdgeTable(void)
{
int edgetableindex;
edgetableindex = 0; // assume the vertices are already in
- // top to bottom order
+ // top to bottom order
//
// determine which edges are right & left, and the order in which
diff --git a/src/refresh/sw/raster.c b/src/refresh/sw/raster.c
index dce9b03..aed4312 100644
--- a/src/refresh/sw/raster.c
+++ b/src/refresh/sw/raster.c
@@ -30,30 +30,26 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#define FRAMECOUNT_MASK 0x7FFFFFFFUL
#endif
-uintptr_t cacheoffset;
+static uintptr_t cacheoffset;
int c_faceclip; // number of faces clipped
-
-clipplane_t *entity_clipplanes;
clipplane_t view_clipplanes[4];
-clipplane_t world_clipplanes[16];
-
-medge_t *r_pedge;
-qboolean r_leftclipped, r_rightclipped;
-qboolean r_nearzionly;
+static medge_t *r_pedge;
-mvertex_t r_leftenter, r_leftexit;
-mvertex_t r_rightenter, r_rightexit;
+static qboolean r_leftclipped, r_rightclipped;
+static qboolean r_nearzionly;
-int r_emitted;
-float r_nearzi;
-float r_u1, r_v1, r_lzi1;
-int r_ceilv1;
+static mvertex_t r_leftenter, r_leftexit;
+static mvertex_t r_rightenter, r_rightexit;
-qboolean r_lastvertvalid;
+static int r_emitted;
+static float r_nearzi;
+static float r_u1, r_v1, r_lzi1;
+static int r_ceilv1;
+static qboolean r_lastvertvalid;
/*
@@ -61,7 +57,7 @@ qboolean r_lastvertvalid;
R_EmitEdge
================
*/
-void R_EmitEdge(mvertex_t *pv0, mvertex_t *pv1)
+static void R_EmitEdge(mvertex_t *pv0, mvertex_t *pv1)
{
edge_t *edge, *pcheck;
int u_check;
@@ -229,7 +225,7 @@ void R_EmitEdge(mvertex_t *pv0, mvertex_t *pv1)
R_ClipEdge
================
*/
-void R_ClipEdge(mvertex_t *pv0, mvertex_t *pv1, clipplane_t *clip)
+static void R_ClipEdge(mvertex_t *pv0, mvertex_t *pv1, clipplane_t *clip)
{
float d0, d1, f;
mvertex_t clipvert;
@@ -306,7 +302,7 @@ void R_ClipEdge(mvertex_t *pv0, mvertex_t *pv1, clipplane_t *clip)
R_EmitCachedEdge
================
*/
-void R_EmitCachedEdge(void)
+static void R_EmitCachedEdge(void)
{
edge_t *pedge_t;
diff --git a/src/refresh/sw/sird.c b/src/refresh/sw/sird.c
index ec236c1..ce02dab 100644
--- a/src/refresh/sw/sird.c
+++ b/src/refresh/sw/sird.c
@@ -64,10 +64,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#define R_SIRDnumRand 103
//this hold the background pattern
-byte r_SIRDBackground[R_SIRDw * R_SIRDh * VID_BYTES];
+static byte r_SIRDBackground[R_SIRDw * R_SIRDh * VID_BYTES];
//these are the actual random numbers
-byte r_SIRDrandValues[] = {
+static const byte r_SIRDrandValues[] = {
#include "rand1k.h"
};
@@ -78,7 +78,7 @@ byte r_SIRDrandValues[] = {
//You could also expand the loop 4 times to remove
// the 'while'
#if !id386 || !(defined _MSC_VER)
-int UShortLog(int val)
+static int UShortLog(int val)
{
int mask = 0xff00;
int p = 0;
@@ -98,7 +98,7 @@ int UShortLog(int val)
}
#endif
-int R_SIRDZFunc(int sub)
+static int R_SIRDZFunc(int sub)
{
int e;
diff --git a/src/refresh/sw/surf.c b/src/refresh/sw/surf.c
index 335bad0..e73f2b7 100644
--- a/src/refresh/sw/surf.c
+++ b/src/refresh/sw/surf.c
@@ -53,7 +53,7 @@ R_TextureAnimation
Returns the proper texture for a given time and base texture
===============
*/
-image_t *R_TextureAnimation(mtexinfo_t *tex)
+static image_t *R_TextureAnimation(mtexinfo_t *tex)
{
int c;
@@ -74,7 +74,7 @@ image_t *R_TextureAnimation(mtexinfo_t *tex)
R_DrawSurface
===============
*/
-void R_DrawSurface(void)
+static void R_DrawSurface(void)
{
byte *basetptr;
int smax, tmax, twidth;
@@ -239,7 +239,7 @@ void D_FlushCaches(void)
D_SCAlloc
=================
*/
-surfcache_t *D_SCAlloc(int width, int size)
+static surfcache_t *D_SCAlloc(int width, int size)
{
surfcache_t *new;
diff --git a/src/refresh/sw/sw.h b/src/refresh/sw/sw.h
index 4a8643f..701bb76 100644
--- a/src/refresh/sw/sw.h
+++ b/src/refresh/sw/sw.h
@@ -364,8 +364,6 @@ void R_PolysetUpdateTables(void);
extern drawsurf_t r_drawsurf;
-void R_DrawSurface(void);
-
extern int c_surf;
extern byte r_warpbuffer[WARP_WIDTH * WARP_HEIGHT * VID_BYTES];
@@ -434,10 +432,6 @@ extern float xscaleinv, yscaleinv;
extern float xscaleshrink, yscaleshrink;
extern void R_TransformVector(vec3_t in, vec3_t out);
-extern void SetUpForLineScan(fixed8_t startvertu, fixed8_t startvertv,
- fixed8_t endvertu, fixed8_t endvertv);
-
-extern int ubasestep, errorterm, erroradjustup, erroradjustdown;
//===========================================================================
@@ -499,9 +493,6 @@ extern mface_t *r_alpha_surfaces;
//=============================================================================
-void R_ClearPolyList(void);
-void R_DrawPolyList(void);
-
//
// current entity info
//
@@ -519,44 +510,25 @@ void R_TransformFrustum(void);
void R_DrawSurfaceBlock16(void);
void R_DrawSurfaceBlock8(void);
-void R_Surf8Patch(void);
-void R_Surf16Patch(void);
void R_DrawSubmodelPolygons(mmodel_t *pmodel, int clipflags, mnode_t *topnode);
void R_DrawSolidClippedSubmodelPolygons(mmodel_t *pmodel, mnode_t *topnode);
-void R_AddPolygonEdges(emitpoint_t *pverts, int numverts, int miplevel);
-surf_t *R_GetSurf(void);
void R_AliasDrawModel(void);
void R_BeginEdgeFrame(void);
void R_ScanEdges(void);
-void D_DrawSurfaces(void);
-void R_InsertNewEdges(edge_t *edgestoadd, edge_t *edgelist);
-void R_StepActiveU(edge_t *pedge);
-void R_RemoveEdges(edge_t *pedge);
void R_PushDlights(mnode_t *headnode);
-extern void R_Surf8Start(void);
-extern void R_Surf8End(void);
-extern void R_Surf16Start(void);
-extern void R_Surf16End(void);
-extern void R_EdgeCodeStart(void);
-extern void R_EdgeCodeEnd(void);
-
-extern void R_RotateBmodel(void);
+void R_RotateBmodel(void);
extern int c_faceclip;
extern int r_polycount;
extern int r_wholepolycount;
-extern int ubasestep, errorterm, erroradjustup, erroradjustdown;
-
extern fixed16_t sadjust, tadjust;
extern fixed16_t bbextents, bbextentt;
extern mvertex_t *r_ptverts, *r_ptvertsmax;
-extern float entity_rotation[3][3];
-
extern int r_currentkey;
extern int r_currentbkey;
@@ -572,11 +544,6 @@ extern edge_t *r_edges, *edge_p, *edge_max;
extern edge_t *newedges[MAXHEIGHT];
extern edge_t *removeedges[MAXHEIGHT];
-// FIXME: make stack vars when debugging done
-extern edge_t edge_head;
-extern edge_t edge_tail;
-extern edge_t edge_aftertail;
-
extern fixed8_t r_aliasblendcolor[3];
extern int r_alias_alpha;
@@ -616,12 +583,8 @@ extern blocklight_t blocklights[MAX_BLOCKLIGHTS * LIGHTMAP_BYTES]; // allo
void R_PrintAliasStats(void);
void R_PrintTimes(void);
-void R_PrintDSpeeds(void);
-void R_AnimateLight(void);
void R_LightPoint(vec3_t p, vec3_t color);
void R_SetupFrame(void);
-void R_EmitEdge(mvertex_t *pv0, mvertex_t *pv1);
-void R_ClipEdge(mvertex_t *pv0, mvertex_t *pv1, clipplane_t *clip);
void R_BuildLightMap(void);
extern refdef_t r_newrefdef;
@@ -636,14 +599,8 @@ void R_ConcatTransforms(float in1[3][4], float in2[3][4], float out[3][4]);
void ProjectPointOnPlane(vec3_t dst, const vec3_t p, const vec3_t normal);
void PerpendicularVector(vec3_t dst, const vec3_t src);
-float R_DLightPoint(vec3_t p);
-
void R_NewMap(void);
-void R_Register(void);
-void R_UnRegister(void);
-void Draw_Init(void);
-qboolean R_Init(qboolean total);
-void R_Shutdown(qboolean total);
+
void R_InitCaches(void);
void R_FreeCaches(void);
void D_FlushCaches(void);