mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-29 15:51:45 +00:00
soft: fix cppcheck warnings, remove unused isflattop
This commit is contained in:
parent
344f132044
commit
2b9c4e88fe
12 changed files with 102 additions and 99 deletions
25
README.md
25
README.md
|
@ -29,22 +29,21 @@ State:
|
|||
|
||||
Monsters:
|
||||
* incorrect dead animation for Arachnid,
|
||||
* broken fire effect for Guardian,
|
||||
* incorrect skin in soft render for Wizard mdl model.
|
||||
* broken fire effect for Guardian.
|
||||
|
||||
Models support:
|
||||
|
||||
| Format | Original Game | Frame vertex | Comments |
|
||||
| ------ | --------------- | ------------ | ------------------------------------------------- |
|
||||
| mdl | Quake 1 | 8 bit | unsupported grouped textures |
|
||||
| md2 | Quake 2 | 8 bit | full support |
|
||||
| md2 | Anachronox | 8/10/16 bit | does no suport tagged surfaces |
|
||||
| mdx | Kingpin | 8 bit | unchecked with game |
|
||||
| fm | Heretic 2 | 8 bit | show all meshes |
|
||||
| dkm | Daikatana DKM1 | 8 bit | unchecked with game |
|
||||
| dkm | Daikatana DKM2 | 10 bit | unchecked with game |
|
||||
| md3 | Quake 3 | 16 bit | show all meshes, no tags support, unchecked |
|
||||
| md5 | Doom 3/Quake 4 | float | requires md2 for skins, show all meshes |
|
||||
| Format | Original Game | Frame vertex | Meshes | Comments |
|
||||
| ------ | --------------- | ------------ | ------ | --------------------------------------- |
|
||||
| mdl | Quake 1 | 8 bit | Single | Unsupported grouped textures |
|
||||
| md2 | Quake 2 | 8 bit | Single | |
|
||||
| md2 | Anachronox | 8/10/16 bit | Single | No tagged surfaces, unchecked with game |
|
||||
| mdx | Kingpin | 8 bit | Many | No sfx support, unchecked with game |
|
||||
| fm | Heretic 2 | 8 bit | Many | |
|
||||
| dkm | Daikatana DKM1 | 8 bit | Many | Unchecked with game |
|
||||
| dkm | Daikatana DKM2 | 10 bit | Many | Unchecked with game |
|
||||
| md3 | Quake 3 | 16 bit | Many | No tags support |
|
||||
| md5 | Doom 3/Quake 4 | float | Many | Requires md2 for skins |
|
||||
|
||||
All models support only single texture for all meshes and only up to 255 frames.
|
||||
|
||||
|
|
|
@ -415,10 +415,10 @@ Mod_LoadDKMTriangleList(dmdx_t *pheader, const dkmtriangle_t *pintri)
|
|||
|
||||
for (i = 0; i < pheader->num_tris; i++)
|
||||
{
|
||||
int j;
|
||||
|
||||
if (pintri[i].mesh_id == m)
|
||||
{
|
||||
int j;
|
||||
|
||||
for (j = 0; j < 3; j++)
|
||||
{
|
||||
pouttri->index_xyz[j] = LittleShort(pintri[i].index_xyz[j]);
|
||||
|
|
|
@ -476,7 +476,7 @@ R_AliasPreparePoints(const entity_t *currententity, finalvert_t *verts, const fi
|
|||
|
||||
for (i = 0; i < num_mesh_nodes; i++)
|
||||
{
|
||||
dtriangle_t *ptri;
|
||||
const dtriangle_t *ptri;
|
||||
int num_tris;
|
||||
|
||||
num_tris = Q_min(s_pmdl->num_tris - mesh_nodes[i].ofs_tris, mesh_nodes[i].num_tris);
|
||||
|
|
|
@ -486,10 +486,13 @@ R_RecursiveWorldNode (entity_t *currententity, const model_t *currentmodel, mnod
|
|||
int i;
|
||||
for (i=0 ; i<4 ; i++)
|
||||
{
|
||||
int *pindex;
|
||||
const int *pindex;
|
||||
float d;
|
||||
if (! (clipflags & (1<<i)) )
|
||||
|
||||
if (!(clipflags & (1<<i)))
|
||||
{
|
||||
continue; // don't need to clip against it
|
||||
}
|
||||
|
||||
// generate accept and reject points
|
||||
// FIXME: do with fast look-ups or integer tests based on the sign bit
|
||||
|
|
|
@ -72,10 +72,10 @@ smoothly scrolled off.
|
|||
void
|
||||
RE_Draw_CharScaled(int x, int y, int c, float scale)
|
||||
{
|
||||
pixel_t *dest;
|
||||
byte *source, *pic_pixels;
|
||||
int drawline;
|
||||
int row, col, v, iscale, sscale, width, height;
|
||||
int drawline, row, col, v, iscale, sscale, width, height;
|
||||
const byte *source;
|
||||
byte *pic_pixels;
|
||||
pixel_t *dest;
|
||||
|
||||
iscale = (int) scale;
|
||||
|
||||
|
@ -149,9 +149,9 @@ RE_Draw_GetPicSize
|
|||
=============
|
||||
*/
|
||||
void
|
||||
RE_Draw_GetPicSize (int *w, int *h, const char *name)
|
||||
RE_Draw_GetPicSize(int *w, int *h, const char *name)
|
||||
{
|
||||
image_t *image;
|
||||
const image_t *image;
|
||||
|
||||
image = R_FindPic (name, (findimage_t)R_FindImage);
|
||||
if (!image)
|
||||
|
@ -159,6 +159,7 @@ RE_Draw_GetPicSize (int *w, int *h, const char *name)
|
|||
*w = *h = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
*w = image->asset_width;
|
||||
*h = image->asset_height;
|
||||
}
|
||||
|
@ -237,11 +238,14 @@ RE_Draw_StretchPicImplementation (int x, int y, int w, int h, const image_t *pic
|
|||
dest[u] = source[f>>16];
|
||||
f += fstep;
|
||||
}
|
||||
|
||||
if (picupscale > 1)
|
||||
{
|
||||
int i;
|
||||
int pu = Q_min(height-v, picupscale);
|
||||
pixel_t *dest_orig = dest;
|
||||
const pixel_t *dest_orig;
|
||||
int pu, i;
|
||||
|
||||
pu = Q_min(height-v, picupscale);
|
||||
dest_orig = dest;
|
||||
|
||||
// copy first line to fill whole sector
|
||||
for (i=1; i < pu; i++)
|
||||
|
@ -309,7 +313,7 @@ RE_Draw_StretchPic
|
|||
void
|
||||
RE_Draw_StretchPic (int x, int y, int w, int h, const char *name)
|
||||
{
|
||||
image_t *pic;
|
||||
const image_t *pic;
|
||||
|
||||
pic = R_FindPic (name, (findimage_t)R_FindImage);
|
||||
if (!pic)
|
||||
|
@ -317,6 +321,7 @@ RE_Draw_StretchPic (int x, int y, int w, int h, const char *name)
|
|||
R_Printf(PRINT_ALL, "Can't find pic: %s\n", name);
|
||||
return;
|
||||
}
|
||||
|
||||
RE_Draw_StretchPicImplementation (x, y, w, h, pic);
|
||||
}
|
||||
|
||||
|
@ -387,7 +392,7 @@ Draw_Pic
|
|||
void
|
||||
RE_Draw_PicScaled(int x, int y, const char *name, float scale)
|
||||
{
|
||||
image_t *pic;
|
||||
const image_t *pic;
|
||||
|
||||
pic = R_FindPic (name, (findimage_t)R_FindImage);
|
||||
if (!pic)
|
||||
|
@ -413,11 +418,10 @@ refresh window.
|
|||
void
|
||||
RE_Draw_TileClear (int x, int y, int w, int h, const char *name)
|
||||
{
|
||||
int i, j;
|
||||
byte *psrc;
|
||||
pixel_t *pdest;
|
||||
image_t *pic;
|
||||
int x2;
|
||||
const byte *psrc;
|
||||
pixel_t *pdest;
|
||||
int i, j, x2;
|
||||
image_t *pic;
|
||||
|
||||
if (x < 0)
|
||||
{
|
||||
|
|
|
@ -60,7 +60,7 @@ float scale_for_mip;
|
|||
static void R_GenerateSpans (void);
|
||||
static void R_GenerateSpansBackward (void);
|
||||
|
||||
static void R_TrailingEdge (surf_t *surf, edge_t *edge);
|
||||
static void R_TrailingEdge (surf_t *surf, const edge_t *edge);
|
||||
|
||||
/*
|
||||
===============================================================================
|
||||
|
@ -328,7 +328,7 @@ R_TrailingEdge
|
|||
==============
|
||||
*/
|
||||
static void
|
||||
R_TrailingEdge (surf_t *surf, edge_t *edge)
|
||||
R_TrailingEdge(surf_t *surf, const edge_t *edge)
|
||||
{
|
||||
// don't generate a span if this is an inverted span, with the end
|
||||
// edge preceding the start edge (that is, we haven't seen the
|
||||
|
@ -582,7 +582,7 @@ R_GenerateSpansBackward (void)
|
|||
R_CleanupSpan ();
|
||||
}
|
||||
|
||||
static void D_DrawSurfaces (entity_t *currententity, surf_t *surface);
|
||||
static void D_DrawSurfaces (entity_t *currententity, const surf_t *surface);
|
||||
|
||||
/*
|
||||
==============
|
||||
|
@ -1029,7 +1029,7 @@ May be called more than once a frame if the surf list overflows (higher res)
|
|||
==============
|
||||
*/
|
||||
static void
|
||||
D_DrawSurfaces (entity_t *currententity, surf_t *surface)
|
||||
D_DrawSurfaces(entity_t *currententity, const surf_t *surface)
|
||||
{
|
||||
VectorSubtract (r_origin, vec3_origin, modelorg);
|
||||
TransformVector (modelorg, transformed_modelorg);
|
||||
|
|
|
@ -88,7 +88,7 @@ R_ImageList_f (void)
|
|||
//=======================================================
|
||||
|
||||
static image_t *
|
||||
R_FindFreeImage(char *name)
|
||||
R_FindFreeImage(const char *name)
|
||||
{
|
||||
image_t *image;
|
||||
int i;
|
||||
|
@ -256,7 +256,7 @@ R_LoadPic8
|
|||
================
|
||||
*/
|
||||
static image_t *
|
||||
R_LoadPic8 (char *name, byte *pic, int width, int realwidth, int height, int realheight,
|
||||
R_LoadPic8(const char *name, const byte *pic, int width, int realwidth, int height, int realheight,
|
||||
size_t data_size, imagetype_t type)
|
||||
{
|
||||
image_t *image;
|
||||
|
@ -340,7 +340,7 @@ R_LoadPic(char *name, byte *pic, int width, int realwidth, int height, int realh
|
|||
realheight = height;
|
||||
}
|
||||
|
||||
if (data_size <= 0 || !width || !height)
|
||||
if (!data_size || !width || !height)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -768,10 +768,10 @@ R_PolygonDrawSpans(espan_t *pspan, int iswater, float d_ziorigin, float d_zistep
|
|||
static void
|
||||
R_PolygonScanLeftEdge (espan_t *s_polygon_spans)
|
||||
{
|
||||
int i, lmaxindex;
|
||||
emitpoint_t *pvert, *pnext;
|
||||
espan_t *pspan;
|
||||
float du, dv, vtop, u_step;
|
||||
const emitpoint_t *pvert, *pnext;
|
||||
float du, dv, vtop, u_step;
|
||||
int i, lmaxindex;
|
||||
espan_t *pspan;
|
||||
|
||||
pspan = s_polygon_spans;
|
||||
i = s_minindex;
|
||||
|
@ -837,10 +837,11 @@ R_PolygonScanLeftEdge (espan_t *s_polygon_spans)
|
|||
static void
|
||||
R_PolygonScanRightEdge(espan_t *s_polygon_spans)
|
||||
{
|
||||
int i;
|
||||
emitpoint_t *pvert, *pnext;
|
||||
espan_t *pspan;
|
||||
float du, dv, vtop, u_step, uvert, unext, vvert;
|
||||
float du, dv, vtop, u_step, uvert, unext, vvert;
|
||||
const emitpoint_t *pnext;
|
||||
emitpoint_t *pvert;
|
||||
espan_t *pspan;
|
||||
int i;
|
||||
|
||||
pspan = s_polygon_spans;
|
||||
i = s_minindex;
|
||||
|
@ -1037,11 +1038,11 @@ R_ClipAndDrawPoly ( float alpha, int isturbulent, qboolean textured )
|
|||
static void
|
||||
R_BuildPolygonFromSurface(const entity_t *currententity, const model_t *currentmodel, msurface_t *fa)
|
||||
{
|
||||
int i, lnumverts;
|
||||
medge_t *pedges, *r_pedge;
|
||||
float *vec;
|
||||
vec5_t *pverts;
|
||||
float tmins[2] = { 0, 0 };
|
||||
medge_t *pedges, *r_pedge;
|
||||
float tmins[2] = { 0, 0 };
|
||||
int i, lnumverts;
|
||||
const float *vec;
|
||||
vec5_t *pverts;
|
||||
|
||||
r_polydesc.nump = 0;
|
||||
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#include <limits.h>
|
||||
|
||||
typedef struct {
|
||||
int isflattop;
|
||||
int numleftedges;
|
||||
compactvert_t *pleftedgevert0;
|
||||
compactvert_t *pleftedgevert1;
|
||||
|
@ -46,18 +45,18 @@ static int d_xdenom;
|
|||
static edgetable *pedgetable;
|
||||
|
||||
static edgetable edgetables[12] = {
|
||||
{0, 1, &r_p0, &r_p2, NULL, 2, &r_p0, &r_p1, &r_p2},
|
||||
{0, 2, &r_p1, &r_p0, &r_p2, 1, &r_p1, &r_p2, NULL},
|
||||
{1, 1, &r_p0, &r_p2, NULL, 1, &r_p1, &r_p2, NULL},
|
||||
{0, 1, &r_p1, &r_p0, NULL, 2, &r_p1, &r_p2, &r_p0},
|
||||
{0, 2, &r_p0, &r_p2, &r_p1, 1, &r_p0, &r_p1, NULL},
|
||||
{0, 1, &r_p2, &r_p1, NULL, 1, &r_p2, &r_p0, NULL},
|
||||
{0, 1, &r_p2, &r_p1, NULL, 2, &r_p2, &r_p0, &r_p1},
|
||||
{0, 2, &r_p2, &r_p1, &r_p0, 1, &r_p2, &r_p0, NULL},
|
||||
{0, 1, &r_p1, &r_p0, NULL, 1, &r_p1, &r_p2, NULL},
|
||||
{1, 1, &r_p2, &r_p1, NULL, 1, &r_p0, &r_p1, NULL},
|
||||
{1, 1, &r_p1, &r_p0, NULL, 1, &r_p2, &r_p0, NULL},
|
||||
{0, 1, &r_p0, &r_p2, NULL, 1, &r_p0, &r_p1, NULL},
|
||||
{1, &r_p0, &r_p2, NULL, 2, &r_p0, &r_p1, &r_p2},
|
||||
{2, &r_p1, &r_p0, &r_p2, 1, &r_p1, &r_p2, NULL},
|
||||
{1, &r_p0, &r_p2, NULL, 1, &r_p1, &r_p2, NULL},
|
||||
{1, &r_p1, &r_p0, NULL, 2, &r_p1, &r_p2, &r_p0},
|
||||
{2, &r_p0, &r_p2, &r_p1, 1, &r_p0, &r_p1, NULL},
|
||||
{1, &r_p2, &r_p1, NULL, 1, &r_p2, &r_p0, NULL},
|
||||
{1, &r_p2, &r_p1, NULL, 2, &r_p2, &r_p0, &r_p1},
|
||||
{2, &r_p2, &r_p1, &r_p0, 1, &r_p2, &r_p0, NULL},
|
||||
{1, &r_p1, &r_p0, NULL, 1, &r_p1, &r_p2, NULL},
|
||||
{1, &r_p2, &r_p1, NULL, 1, &r_p0, &r_p1, NULL},
|
||||
{1, &r_p1, &r_p0, NULL, 1, &r_p2, &r_p0, NULL},
|
||||
{1, &r_p0, &r_p2, NULL, 1, &r_p0, &r_p1, NULL},
|
||||
};
|
||||
|
||||
// FIXME: some of these can become statics
|
||||
|
@ -778,12 +777,12 @@ R_RasterizeAliasPolySmooth
|
|||
static void
|
||||
R_RasterizeAliasPolySmooth(const entity_t *currententity)
|
||||
{
|
||||
int initialleftheight, initialrightheight;
|
||||
compactvert_t *plefttop, *prighttop, *pleftbottom, *prightbottom;
|
||||
light3_t working_lstepx;
|
||||
int originalcount;
|
||||
int u, v;
|
||||
pixel_t *d_ptex;
|
||||
const compactvert_t *pleftbottom, *prightbottom;
|
||||
int initialleftheight, initialrightheight;
|
||||
const compactvert_t *plefttop, *prighttop;
|
||||
light3_t working_lstepx;
|
||||
int originalcount, u, v;
|
||||
pixel_t *d_ptex;
|
||||
|
||||
plefttop = pedgetable->pleftedgevert0;
|
||||
prighttop = pedgetable->prightedgevert0;
|
||||
|
@ -995,7 +994,7 @@ R_PolysetSetEdgeTable
|
|||
================
|
||||
*/
|
||||
static void
|
||||
R_PolysetSetEdgeTable (void)
|
||||
R_PolysetSetEdgeTable(void)
|
||||
{
|
||||
int edgetableindex;
|
||||
|
||||
|
|
|
@ -205,14 +205,11 @@ R_EmitEdge
|
|||
static void
|
||||
R_EmitEdge (mvertex_t *pv0, mvertex_t *pv1, medge_t *r_pedge, qboolean r_nearzionly)
|
||||
{
|
||||
edge_t *edge, *pcheck;
|
||||
int u_check;
|
||||
float u, u_step;
|
||||
vec3_t local, transformed;
|
||||
float *world;
|
||||
int v, v2, ceilv0;
|
||||
float scale, lzi0, u0, v0;
|
||||
int side;
|
||||
float u, u_step, scale, lzi0, u0, v0;
|
||||
int u_check, v, v2, ceilv0, side;
|
||||
vec3_t local, transformed;
|
||||
edge_t *edge, *pcheck;
|
||||
const float *world;
|
||||
|
||||
if (r_lastvertvalid)
|
||||
{
|
||||
|
|
|
@ -40,11 +40,10 @@ the sine warp, to keep the edges from wrapping
|
|||
void
|
||||
D_WarpScreen (void)
|
||||
{
|
||||
int w, h;
|
||||
int u,v;
|
||||
pixel_t *dest;
|
||||
int *turb;
|
||||
byte **row;
|
||||
const int *turb;
|
||||
int w, h, u,v;
|
||||
pixel_t *dest;
|
||||
byte **row;
|
||||
|
||||
static int cached_width, cached_height;
|
||||
|
||||
|
@ -79,7 +78,7 @@ D_WarpScreen (void)
|
|||
|
||||
for (v=0 ; v<h ; v++, dest += vid_buffer_width)
|
||||
{
|
||||
int *col;
|
||||
const int *col;
|
||||
|
||||
col = warp_column + turb[v];
|
||||
row = warp_rowptr + v;
|
||||
|
@ -184,13 +183,13 @@ TurbulentPow2
|
|||
=============
|
||||
*/
|
||||
void
|
||||
TurbulentPow2 (espan_t *pspan, float d_ziorigin, float d_zistepu, float d_zistepv)
|
||||
TurbulentPow2(espan_t *pspan, float d_ziorigin, float d_zistepu, float d_zistepv)
|
||||
{
|
||||
float spancountminus1;
|
||||
float sdivzpow2stepu, tdivzpow2stepu, zipow2stepu;
|
||||
pixel_t *r_turb_pbase;
|
||||
int *r_turb_turb;
|
||||
int spanstep_shift, spanstep_value;
|
||||
float sdivzpow2stepu, tdivzpow2stepu, zipow2stepu;
|
||||
int spanstep_shift, spanstep_value;
|
||||
const pixel_t *r_turb_pbase;
|
||||
const int *r_turb_turb;
|
||||
float spancountminus1;
|
||||
|
||||
spanstep_shift = D_DrawSpanGetStep(d_zistepu, d_zistepv);
|
||||
spanstep_value = (1 << spanstep_shift);
|
||||
|
@ -340,11 +339,11 @@ NonTurbulentPow2 - this is for drawing scrolling textures. they're warping water
|
|||
void
|
||||
NonTurbulentPow2 (espan_t *pspan, float d_ziorigin, float d_zistepu, float d_zistepv)
|
||||
{
|
||||
float spancountminus1;
|
||||
float sdivzpow2stepu, tdivzpow2stepu, zipow2stepu;
|
||||
pixel_t *r_turb_pbase;
|
||||
int *r_turb_turb;
|
||||
int spanstep_shift, spanstep_value;
|
||||
int spanstep_shift, spanstep_value;
|
||||
const pixel_t *r_turb_pbase;
|
||||
const int *r_turb_turb;
|
||||
float spancountminus1;
|
||||
|
||||
spanstep_shift = D_DrawSpanGetStep(d_zistepu, d_zistepv);
|
||||
spanstep_value = (1 << spanstep_shift);
|
||||
|
|
|
@ -71,7 +71,8 @@ R_DrawSurfaceBlock_Light (pixel_t *prowdest, pixel_t *psource, size_t size,
|
|||
// Full same light from both side
|
||||
if (light_masked_right != LIGHTMASK && light_masked_left == light_masked_right)
|
||||
{
|
||||
pixel_t *dest, *dest_max, *src;
|
||||
const pixel_t *dest_max;
|
||||
pixel_t *dest, *src;
|
||||
|
||||
dest = prowdest;
|
||||
dest_max = prowdest + size;
|
||||
|
|
Loading…
Reference in a new issue