soft: add const to functions parameters

This commit is contained in:
Denis Pauk 2022-01-12 22:11:00 +02:00
parent 68ad03aac9
commit da4bbd64d6
11 changed files with 58 additions and 52 deletions

View file

@ -411,7 +411,7 @@ extern float xscale, yscale;
extern float xscaleinv, yscaleinv;
extern float xscaleshrink, yscaleshrink;
extern void TransformVector(vec3_t in, vec3_t out);
extern void TransformVector(const vec3_t in, vec3_t out);
//===========================================================================
@ -532,7 +532,7 @@ extern qboolean r_outedgebasespans;
extern mvertex_t *r_pcurrentvertbase;
void R_DrawTriangle(const entity_t *currententity, const finalvert_t *a, const finalvert_t *b, const finalvert_t *c);
void R_AliasClipTriangle(const entity_t *currententity, const finalvert_t *index0, const finalvert_t *index1, finalvert_t *index2);
void R_AliasClipTriangle(const entity_t *currententity, const finalvert_t *index0, const finalvert_t *index1, const finalvert_t *index2);
extern float r_time1;
@ -590,7 +590,7 @@ void R_FreeUnusedImages(void);
qboolean R_ImageHasFreeSpace(void);
void R_InitSkyBox(model_t *loadmodel);
void R_IMFlatShadedQuad( vec3_t a, vec3_t b, vec3_t c, vec3_t d, int color, float alpha );
void R_IMFlatShadedQuad( const vec3_t a, const vec3_t b, const vec3_t c, const vec3_t d, int color, float alpha );
// VID Buffer damage
void VID_DamageBuffer(int u, int v);

View file

@ -222,7 +222,6 @@ typedef struct model_s
void Mod_Init(void);
mleaf_t *Mod_PointInLeaf(vec3_t p, const model_t *model);
const byte *Mod_ClusterPVS(int cluster, const model_t *model);
void Mod_Modellist_f(void);

View file

@ -221,7 +221,7 @@ R_AliasClipTriangle
================
*/
void
R_AliasClipTriangle(const entity_t *currententity, const finalvert_t *index0, const finalvert_t *index1, finalvert_t *index2)
R_AliasClipTriangle(const entity_t *currententity, const finalvert_t *index0, const finalvert_t *index1, const finalvert_t *index2)
{
int i, k, pingpong;
unsigned clipflags;

View file

@ -167,7 +167,7 @@ Clip a bmodel poly down the world bsp tree
static void
R_RecursiveClipBPoly(entity_t *currententity, bedge_t *pedges, mnode_t *pnode, msurface_t *psurf)
{
bedge_t *psideedges[2], *pnextedge, *ptedge;
bedge_t *psideedges[2], *pnextedge;
int i, side, lastside;
cplane_t *splitplane, tplane;
mvertex_t *pvert, *plastvert, *ptvert;
@ -192,6 +192,7 @@ R_RecursiveClipBPoly(entity_t *currententity, bedge_t *pedges, mnode_t *pnode, m
for (; pedges; pedges = pnextedge)
{
float dist, lastdist;
bedge_t *ptedge;
pnextedge = pedges->pnext;
@ -280,6 +281,8 @@ R_RecursiveClipBPoly(entity_t *currententity, bedge_t *pedges, mnode_t *pnode, m
// plane to both sides (but in opposite directions)
if (makeclippededge && pfrontexit != pfrontenter)
{
bedge_t *ptedge;
ptedge = &bedges[numbedges++];
ptedge->pnext = psideedges[0];
psideedges[0] = ptedge;
@ -358,7 +361,6 @@ R_DrawSolidClippedSubmodelPolygons(entity_t *currententity, const model_t *curre
{
cplane_t *pplane;
bedge_t *pbedge;
medge_t *pedge;
vec_t dot;
int j;
@ -390,12 +392,16 @@ R_DrawSolidClippedSubmodelPolygons(entity_t *currententity, const model_t *curre
if (lindex > 0)
{
medge_t *pedge;
pedge = &pedges[lindex];
pbedge[j].v[0] = &r_pcurrentvertbase[pedge->v[0]];
pbedge[j].v[1] = &r_pcurrentvertbase[pedge->v[1]];
}
else
{
medge_t *pedge;
lindex = -lindex;
pedge = &pedges[lindex];
pbedge[j].v[0] = &r_pcurrentvertbase[pedge->v[1]];
@ -410,6 +416,9 @@ R_DrawSolidClippedSubmodelPolygons(entity_t *currententity, const model_t *curre
if ( !( psurf->texinfo->flags & ( SURF_TRANS66 | SURF_TRANS33 ) ))
{
// FIXME: Fan broken in borehole
// teleport: 1231.000000 770.250000 -579.375000
// map: maps/mine2.bsp
// model texture: textures/e2u1/metal6_1.wal
R_RecursiveClipBPoly(currententity, pbedge, topnode, psurf);
}
else
@ -431,7 +440,6 @@ void
R_DrawSubmodelPolygons(entity_t *currententity, const model_t *currentmodel, int clipflags, mnode_t *topnode)
{
int i;
vec_t dot;
msurface_t *psurf;
int numsurfaces;
@ -441,6 +449,8 @@ R_DrawSubmodelPolygons(entity_t *currententity, const model_t *currentmodel, int
for (i=0 ; i<numsurfaces ; i++, psurf++)
{
vec_t dot;
cplane_t *pplane;
// find which side of the node we are on
pplane = psurf->plane;

View file

@ -990,7 +990,7 @@ To allow developers to see the polygon carving of the world
=============
*/
static void
D_DrawflatSurfaces (surf_t *surface)
D_DrawflatSurfaces (const surf_t *surface)
{
surf_t *s;
int color = 0;

View file

@ -325,7 +325,7 @@ R_LoadWal (char *name, imagetype_t type)
static unsigned char *d_16to8table; // 16 to 8 bit conversion table
static void
R_Convert32To8bit(unsigned char* pic_in, unsigned char* pic_out, size_t size)
R_Convert32To8bit(const unsigned char* pic_in, unsigned char* pic_out, size_t size)
{
size_t i;

View file

@ -1280,7 +1280,7 @@ R_SetLightLevel (const entity_t *currententity)
}
static int
VectorCompareRound(vec3_t v1, vec3_t v2)
VectorCompareRound(const vec3_t v1, const vec3_t v2)
{
if ((int)(v1[0] - v2[0]) || (int)(v1[1] - v2[1]) || (int)(v1[2] - v2[2]))
{
@ -1580,13 +1580,12 @@ R_GammaCorrectAndSetPalette( const unsigned char *palette )
static void
RE_SetPalette(const unsigned char *palette)
{
byte palette32[1024];
// clear screen to black to avoid any palette flash
RE_CleanFrame();
if (palette)
{
byte palette32[1024];
int i;
for ( i = 0; i < 256; i++ )

View file

@ -166,7 +166,7 @@ TransformVector
================
*/
void
TransformVector (vec3_t in, vec3_t out)
TransformVector (const vec3_t in, vec3_t out)
{
out[0] = DotProduct(in,vright);
out[1] = DotProduct(in,vup);
@ -216,7 +216,7 @@ Guaranteed to be called before the first refresh
===============
*/
static void
R_ViewChanged (vrect_t *vr)
R_ViewChanged (const vrect_t *vr)
{
int i;
float xOrigin, yOrigin;
@ -306,6 +306,39 @@ R_ViewChanged (vrect_t *vr)
D_ViewChanged ();
}
/*
===============
Mod_PointInLeaf
===============
*/
static mleaf_t *
Mod_PointInLeaf (const vec3_t p, const model_t *model)
{
mnode_t *node;
if (!model || !model->nodes)
{
ri.Sys_Error(ERR_DROP, "%s: bad model", __func__);
return NULL;
}
node = model->nodes;
while (node->contents == -1)
{
float d;
cplane_t *plane;
plane = node->plane;
d = DotProduct (p,plane->normal) - plane->dist;
if (d > 0)
node = node->children[0];
else
node = node->children[1];
}
return (mleaf_t *)node;
}
/*
===============

View file

@ -223,41 +223,6 @@ Mod_ForName (char *name, model_t *parent_model, qboolean crash)
return mod;
}
/*
===============
Mod_PointInLeaf
===============
*/
mleaf_t *
Mod_PointInLeaf (vec3_t p, const model_t *model)
{
mnode_t *node;
if (!model || !model->nodes)
{
ri.Sys_Error(ERR_DROP, "%s: bad model", __func__);
return NULL;
}
node = model->nodes;
while (node->contents == -1)
{
float d;
cplane_t *plane;
plane = node->plane;
d = DotProduct (p,plane->normal) - plane->dist;
if (d > 0)
node = node->children[0];
else
node = node->children[1];
}
return (mleaf_t *)node;
}
/*
==============
Mod_ClusterPVS

View file

@ -1248,7 +1248,7 @@ R_DrawAlphaSurfaces(const entity_t *currententity)
** R_IMFlatShadedQuad
*/
void
R_IMFlatShadedQuad( vec3_t a, vec3_t b, vec3_t c, vec3_t d, int color, float alpha )
R_IMFlatShadedQuad( const vec3_t a, const vec3_t b, const vec3_t c, const vec3_t d, int color, float alpha )
{
vec3_t s0, s1;

View file

@ -164,7 +164,7 @@ D_DrawTurbulentSpan (pixel_t *pdest, const pixel_t *pbase,
int s, int t,
int sstep, int tstep,
int spancount,
int *turb)
const int *turb)
{
do
{