mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2025-01-31 13:20:34 +00:00
make cppcheck little more happy
This commit is contained in:
parent
0f9e3cc69a
commit
025764db79
12 changed files with 52 additions and 50 deletions
|
@ -1559,7 +1559,7 @@ static const char *idcredits[] = {
|
|||
"Marty Stratton",
|
||||
"Henk Hartong",
|
||||
"",
|
||||
"+Patches authors:"
|
||||
"+Patches authors:",
|
||||
"PGM",
|
||||
"PMM",
|
||||
"eliasm",
|
||||
|
|
|
@ -65,7 +65,7 @@ typedef struct image_s
|
|||
int width, height;
|
||||
qboolean transparent; // true if any 255 pixels in image
|
||||
int registration_sequence; // 0 = free
|
||||
byte *pixels[NUM_MIPS]; // mip levels
|
||||
byte *pixels[NUM_MIPS]; // mip levels
|
||||
} image_t;
|
||||
|
||||
|
||||
|
|
|
@ -118,7 +118,7 @@ typedef struct msurface_s
|
|||
#define CONTENTS_NODE -1
|
||||
typedef struct mnode_s
|
||||
{
|
||||
// common with leaf
|
||||
// common with leaf
|
||||
int contents; // CONTENTS_NODE, to differentiate from leafs
|
||||
int visframe; // node needs to be traversed if current
|
||||
|
||||
|
|
|
@ -38,14 +38,10 @@ typedef enum {touchessolid, drawnode, nodrawnode} solidstate_t;
|
|||
#define MAX_BMODEL_VERTS 500 // 6K
|
||||
#define MAX_BMODEL_EDGES 1000 // 12K
|
||||
|
||||
static mvertex_t *pbverts;
|
||||
static bedge_t *pbedges;
|
||||
static int numbverts, numbedges;
|
||||
static mvertex_t bverts[MAX_BMODEL_VERTS];
|
||||
static bedge_t bedges[MAX_BMODEL_EDGES];
|
||||
|
||||
static mvertex_t *pfrontenter, *pfrontexit;
|
||||
|
||||
//===========================================================================
|
||||
|
||||
/*
|
||||
|
@ -157,12 +153,11 @@ R_RecursiveClipBPoly(entity_t *currententity, bedge_t *pedges, mnode_t *pnode, m
|
|||
{
|
||||
bedge_t *psideedges[2], *pnextedge, *ptedge;
|
||||
int i, side, lastside;
|
||||
float frac;
|
||||
mplane_t *splitplane, tplane;
|
||||
mvertex_t *pvert, *plastvert, *ptvert;
|
||||
mnode_t *pn;
|
||||
int area;
|
||||
qboolean makeclippededge;
|
||||
mvertex_t *pfrontenter = bverts, *pfrontexit = bverts;
|
||||
|
||||
psideedges[0] = psideedges[1] = NULL;
|
||||
|
||||
|
@ -206,13 +201,15 @@ R_RecursiveClipBPoly(entity_t *currententity, bedge_t *pedges, mnode_t *pnode, m
|
|||
|
||||
if (side != lastside)
|
||||
{
|
||||
float frac;
|
||||
|
||||
// clipped
|
||||
if (numbverts >= MAX_BMODEL_VERTS)
|
||||
return;
|
||||
|
||||
// generate the clipped vertex
|
||||
frac = lastdist / (lastdist - dist);
|
||||
ptvert = &pbverts[numbverts++];
|
||||
ptvert = &bverts[numbverts++];
|
||||
ptvert->position[0] = plastvert->position[0] +
|
||||
frac * (pvert->position[0] -
|
||||
plastvert->position[0]);
|
||||
|
@ -232,13 +229,13 @@ R_RecursiveClipBPoly(entity_t *currententity, bedge_t *pedges, mnode_t *pnode, m
|
|||
return;
|
||||
}
|
||||
|
||||
ptedge = &pbedges[numbedges];
|
||||
ptedge = &bedges[numbedges];
|
||||
ptedge->pnext = psideedges[lastside];
|
||||
psideedges[lastside] = ptedge;
|
||||
ptedge->v[0] = plastvert;
|
||||
ptedge->v[1] = ptvert;
|
||||
|
||||
ptedge = &pbedges[numbedges + 1];
|
||||
ptedge = &bedges[numbedges + 1];
|
||||
ptedge->pnext = psideedges[side];
|
||||
psideedges[side] = ptedge;
|
||||
ptedge->v[0] = ptvert;
|
||||
|
@ -267,7 +264,7 @@ R_RecursiveClipBPoly(entity_t *currententity, bedge_t *pedges, mnode_t *pnode, m
|
|||
|
||||
// if anything was clipped, reconstitute and add the edges along the clip
|
||||
// plane to both sides (but in opposite directions)
|
||||
if (makeclippededge)
|
||||
if (makeclippededge && pfrontexit != pfrontenter)
|
||||
{
|
||||
if (numbedges >= (MAX_BMODEL_EDGES - 2))
|
||||
{
|
||||
|
@ -275,13 +272,13 @@ R_RecursiveClipBPoly(entity_t *currententity, bedge_t *pedges, mnode_t *pnode, m
|
|||
return;
|
||||
}
|
||||
|
||||
ptedge = &pbedges[numbedges];
|
||||
ptedge = &bedges[numbedges];
|
||||
ptedge->pnext = psideedges[0];
|
||||
psideedges[0] = ptedge;
|
||||
ptedge->v[0] = pfrontexit;
|
||||
ptedge->v[1] = pfrontenter;
|
||||
|
||||
ptedge = &pbedges[numbedges + 1];
|
||||
ptedge = &bedges[numbedges + 1];
|
||||
ptedge->pnext = psideedges[1];
|
||||
psideedges[1] = ptedge;
|
||||
ptedge->v[0] = pfrontenter;
|
||||
|
@ -308,6 +305,8 @@ R_RecursiveClipBPoly(entity_t *currententity, bedge_t *pedges, mnode_t *pnode, m
|
|||
{
|
||||
if (r_newrefdef.areabits)
|
||||
{
|
||||
int area;
|
||||
|
||||
area = ((mleaf_t *)pn)->area;
|
||||
if (! (r_newrefdef.areabits[area>>3] & (1<<(area&7)) ) )
|
||||
continue; // not visible
|
||||
|
@ -337,12 +336,10 @@ Bmodel crosses multiple leafs
|
|||
void
|
||||
R_DrawSolidClippedSubmodelPolygons(entity_t *currententity, const model_t *currentmodel, mnode_t *topnode)
|
||||
{
|
||||
int i, j, lindex;
|
||||
vec_t dot;
|
||||
int i;
|
||||
msurface_t *psurf;
|
||||
int numsurfaces;
|
||||
bedge_t *pbedge;
|
||||
medge_t *pedge, *pedges;
|
||||
int numsurfaces;
|
||||
medge_t *pedges;
|
||||
|
||||
// FIXME: use bounding-box-based frustum clipping info?
|
||||
psurf = ¤tmodel->surfaces[currentmodel->firstmodelsurface];
|
||||
|
@ -352,6 +349,10 @@ R_DrawSolidClippedSubmodelPolygons(entity_t *currententity, const model_t *curre
|
|||
for (i=0 ; i<numsurfaces ; i++, psurf++)
|
||||
{
|
||||
mplane_t *pplane;
|
||||
bedge_t *pbedge;
|
||||
medge_t *pedge;
|
||||
vec_t dot;
|
||||
int j;
|
||||
|
||||
// find which side of the node we are on
|
||||
pplane = psurf->plane;
|
||||
|
@ -369,14 +370,14 @@ R_DrawSolidClippedSubmodelPolygons(entity_t *currententity, const model_t *curre
|
|||
// clockwise winding
|
||||
// FIXME: if edges and vertices get caches, these assignments must move
|
||||
// outside the loop, and overflow checking must be done here
|
||||
pbverts = bverts;
|
||||
pbedges = bedges;
|
||||
numbverts = numbedges = 0;
|
||||
pbedge = &bedges[numbedges];
|
||||
numbedges += psurf->numedges;
|
||||
|
||||
for (j=0 ; j<psurf->numedges ; j++)
|
||||
{
|
||||
int lindex;
|
||||
|
||||
lindex = currentmodel->surfedges[psurf->firstedge+j];
|
||||
|
||||
if (lindex > 0)
|
||||
|
|
|
@ -35,19 +35,15 @@ RE_Draw_FindPic
|
|||
image_t *
|
||||
RE_Draw_FindPic (char *name)
|
||||
{
|
||||
image_t *image;
|
||||
|
||||
if (name[0] != '/' && name[0] != '\\')
|
||||
{
|
||||
char fullname[MAX_QPATH];
|
||||
|
||||
Com_sprintf (fullname, sizeof(fullname), "pics/%s.pcx", name);
|
||||
image = R_FindImage (fullname, it_pic);
|
||||
return R_FindImage (fullname, it_pic);
|
||||
}
|
||||
else
|
||||
image = R_FindImage (name+1, it_pic);
|
||||
|
||||
return image;
|
||||
return R_FindImage (name+1, it_pic);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -174,6 +174,9 @@ R_LoadPic (char *name, byte *pic, int width, int height, imagetype_t type)
|
|||
image_t *image;
|
||||
size_t i, size, full_size;
|
||||
|
||||
if (!pic)
|
||||
return NULL;
|
||||
|
||||
image = R_FindFreeImage();
|
||||
if (strlen(name) >= sizeof(image->name))
|
||||
ri.Sys_Error(ERR_DROP, "%s: '%s' is too long", __func__, name);
|
||||
|
|
|
@ -48,9 +48,9 @@ R_MarkLights (dlight_t *light, int bit, mnode_t *node, int r_dlightframecount)
|
|||
splitplane = node->plane;
|
||||
dist = DotProduct (light->origin, splitplane->normal) - splitplane->dist;
|
||||
|
||||
i=light->intensity;
|
||||
if(i<0)
|
||||
i=-i;
|
||||
i = light->intensity;
|
||||
if( i< 0)
|
||||
i = -i;
|
||||
|
||||
if (dist > i) // (dist > light->intensity)
|
||||
{
|
||||
|
|
|
@ -20,6 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
// sw_main.c
|
||||
#include <stdint.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include <SDL2/SDL.h>
|
||||
#include <SDL2/SDL_video.h>
|
||||
|
@ -782,8 +783,8 @@ RotatedBBox (const vec3_t mins, const vec3_t maxs, vec3_t angles, vec3_t tmins,
|
|||
|
||||
for (i=0 ; i<3 ; i++)
|
||||
{
|
||||
tmins[i] = 99999;
|
||||
tmaxs[i] = -99999;
|
||||
tmins[i] = INT_MAX; // Set maximum values for world range
|
||||
tmaxs[i] = INT_MIN; // Set minimal values for world range
|
||||
}
|
||||
|
||||
AngleVectors (angles, forward, right, up);
|
||||
|
@ -1469,6 +1470,9 @@ static int RE_PrepareForWindow(void)
|
|||
return flags;
|
||||
}
|
||||
|
||||
// Declared in vid/header/ref.h
|
||||
refexport_t re;
|
||||
|
||||
/*
|
||||
===============
|
||||
GetRefAPI
|
||||
|
@ -1477,8 +1481,6 @@ GetRefAPI
|
|||
Q2_DLL_EXPORTED refexport_t
|
||||
GetRefAPI(refimport_t imp)
|
||||
{
|
||||
refexport_t re;
|
||||
|
||||
memset(&re, 0, sizeof(refexport_t));
|
||||
ri = imp;
|
||||
|
||||
|
|
|
@ -203,7 +203,7 @@ R_SetUpFrustumIndexes (void)
|
|||
}
|
||||
}
|
||||
|
||||
// FIXME: do just once at start
|
||||
// FIXME: do just once at start
|
||||
pfrustum_indexes[i] = pindex;
|
||||
pindex += 6;
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
// models are the only shared resource between a client and server running
|
||||
// on the same machine.
|
||||
|
||||
#include <limits.h>
|
||||
#include "header/local.h"
|
||||
|
||||
model_t *loadmodel;
|
||||
|
@ -366,7 +367,7 @@ Mod_LoadVertexes (lump_t *l)
|
|||
count = l->filelen / sizeof(*in);
|
||||
out = Hunk_Alloc((count+8)*sizeof(*out)); // extra for skybox
|
||||
/*
|
||||
* This patch fixes the problem where the games dumped core
|
||||
* Fix for the problem where the games dumped core
|
||||
* when changing levels.
|
||||
*/
|
||||
memset( out, 0, (count + 6) * sizeof( *out ) );
|
||||
|
@ -509,7 +510,7 @@ Mod_LoadTexinfo (lump_t *l)
|
|||
if (next > 0)
|
||||
out->next = loadmodel->texinfo + next;
|
||||
/*
|
||||
* This patch fixes the problem where the game
|
||||
* Fix for the problem where the game
|
||||
* domed core when loading a new level.
|
||||
*/
|
||||
else {
|
||||
|
@ -550,8 +551,8 @@ CalcSurfaceExtents (msurface_t *s)
|
|||
mtexinfo_t *tex;
|
||||
int bmins[2], bmaxs[2];
|
||||
|
||||
mins[0] = mins[1] = 999999;
|
||||
maxs[0] = maxs[1] = -99999;
|
||||
mins[0] = mins[1] = INT_MAX; // Set maximum values for world range
|
||||
maxs[0] = maxs[1] = INT_MIN; // Set minimal values for world range
|
||||
|
||||
tex = s->texinfo;
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
#include <assert.h>
|
||||
#include <limits.h>
|
||||
#include "header/local.h"
|
||||
|
||||
#define AFFINE_SPANLET_SIZE 16
|
||||
|
@ -48,7 +49,7 @@ static emitpoint_t outverts[MAXWORKINGVERTS+3];
|
|||
|
||||
static int s_minindex, s_maxindex;
|
||||
|
||||
static void R_DrawPoly(int iswater);
|
||||
static void R_DrawPoly(int iswater, espan_t *spans);
|
||||
|
||||
/*
|
||||
** R_DrawSpanletOpaque
|
||||
|
@ -1019,7 +1020,7 @@ R_ClipAndDrawPoly ( float alpha, int isturbulent, qboolean textured )
|
|||
r_polydesc.nump = nump;
|
||||
r_polydesc.pverts = outverts;
|
||||
|
||||
R_DrawPoly(isturbulent);
|
||||
R_DrawPoly(isturbulent, vid_polygon_spans);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1151,18 +1152,16 @@ R_PolygonCalculateGradients (void)
|
|||
*/
|
||||
// iswater was qboolean. changed to support passing more flags
|
||||
static void
|
||||
R_DrawPoly(int iswater)
|
||||
R_DrawPoly(int iswater, espan_t *spans)
|
||||
{
|
||||
int i, nump;
|
||||
float ymin, ymax;
|
||||
emitpoint_t *pverts;
|
||||
espan_t *spans;
|
||||
spans = vid_polygon_spans;
|
||||
|
||||
// find the top and bottom vertices, and make sure there's at least one scan to
|
||||
// draw
|
||||
ymin = 999999.9;
|
||||
ymax = -999999.9;
|
||||
ymin = INT_MAX; // Set maximum values for world range
|
||||
ymax = INT_MIN; // Set minimal values for world range
|
||||
pverts = r_polydesc.pverts;
|
||||
|
||||
for (i=0 ; i<r_polydesc.nump ; i++)
|
||||
|
@ -1198,8 +1197,8 @@ R_DrawPoly(int iswater)
|
|||
pverts[nump] = pverts[0];
|
||||
|
||||
R_PolygonCalculateGradients();
|
||||
R_PolygonScanLeftEdge(vid_polygon_spans);
|
||||
R_PolygonScanRightEdge(vid_polygon_spans);
|
||||
R_PolygonScanLeftEdge(spans);
|
||||
R_PolygonScanRightEdge(spans);
|
||||
|
||||
R_PolygonDrawSpans(spans, iswater);
|
||||
}
|
||||
|
|
|
@ -411,7 +411,7 @@ R_ClipEdge (mvertex_t *pv0, mvertex_t *pv1, clipplane_t *clip)
|
|||
// point 0 is unclipped
|
||||
if (d1 >= 0)
|
||||
{
|
||||
// both points are unclipped
|
||||
// both points are unclipped
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue