mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-14 00:41:03 +00:00
Merge pull request #449 from 0lvin/for_review
Make static C code analysis tool little more happy(#426)
This commit is contained in:
commit
9132d36df7
8 changed files with 51 additions and 27 deletions
|
@ -358,8 +358,8 @@ extern float d_sdivzstepu, d_tdivzstepu;
|
|||
extern float d_sdivzstepv, d_tdivzstepv;
|
||||
extern float d_sdivzorigin, d_tdivzorigin;
|
||||
|
||||
void D_DrawSpansPow2(espan_t *pspans, float d_ziorigin, float d_zistepu, float d_zistepv);
|
||||
void D_DrawZSpans(espan_t *pspans, float d_ziorigin, float d_zistepu, float d_zistepv);
|
||||
void D_DrawSpansPow2(espan_t *pspan, float d_ziorigin, float d_zistepu, float d_zistepv);
|
||||
void D_DrawZSpans(espan_t *pspan, float d_ziorigin, float d_zistepu, float d_zistepv);
|
||||
void TurbulentPow2(espan_t *pspan, float d_ziorigin, float d_zistepu, float d_zistepv);
|
||||
void NonTurbulentPow2(espan_t *pspan, float d_ziorigin, float d_zistepu, float d_zistepv);
|
||||
|
||||
|
@ -557,14 +557,14 @@ void Draw_InitLocal(void);
|
|||
void R_InitCaches(void);
|
||||
void D_FlushCaches(void);
|
||||
|
||||
void RE_BeginRegistration (char *map);
|
||||
struct model_s *RE_RegisterModel (char *name);
|
||||
void RE_BeginRegistration (char *model);
|
||||
struct model_s *RE_RegisterModel (char *name);
|
||||
void RE_EndRegistration (void);
|
||||
|
||||
struct image_s *RE_Draw_FindPic (char *name);
|
||||
|
||||
void RE_Draw_GetPicSize (int *w, int *h, char *name);
|
||||
void RE_Draw_PicScaled (int x, int y, char *name, float factor);
|
||||
void RE_Draw_PicScaled (int x, int y, char *name, float scale);
|
||||
void RE_Draw_StretchPic (int x, int y, int w, int h, char *name);
|
||||
void RE_Draw_StretchRaw (int x, int y, int w, int h, int cols, int rows, byte *data);
|
||||
void RE_Draw_CharScaled (int x, int y, int c, float scale);
|
||||
|
|
|
@ -177,7 +177,7 @@ R_AliasClip (const finalvert_t *in, finalvert_t *out, int flag, int count,
|
|||
|
||||
j = count-1;
|
||||
k = 0;
|
||||
for (i=0 ; i<count ; j = i, i++)
|
||||
for (i=0 ; i<count ; i++)
|
||||
{
|
||||
int flags, oldflags;
|
||||
|
||||
|
@ -185,7 +185,10 @@ R_AliasClip (const finalvert_t *in, finalvert_t *out, int flag, int count,
|
|||
flags = in[i].flags & flag;
|
||||
|
||||
if (flags && oldflags)
|
||||
{
|
||||
j = i;
|
||||
continue;
|
||||
}
|
||||
if (oldflags ^ flags)
|
||||
{
|
||||
clip (&in[j], &in[i], &out[k]);
|
||||
|
@ -205,6 +208,7 @@ R_AliasClip (const finalvert_t *in, finalvert_t *out, int flag, int count,
|
|||
out[k] = in[i];
|
||||
k++;
|
||||
}
|
||||
j = i;
|
||||
}
|
||||
|
||||
return k;
|
||||
|
|
|
@ -58,7 +58,7 @@ static const float r_avertexnormals[NUMVERTEXNORMALS][3] = {
|
|||
};
|
||||
|
||||
|
||||
static void R_AliasTransformVector(const vec3_t in, vec3_t out, const float m[3][4]);
|
||||
static void R_AliasTransformVector(const vec3_t in, vec3_t out, const float xf[3][4]);
|
||||
static void R_AliasTransformFinalVerts(const entity_t *currententity, int numpoints, finalvert_t *fv, dtrivertx_t *oldv, dtrivertx_t *newv );
|
||||
|
||||
void R_AliasProjectAndClipTestFinalVert(finalvert_t *fv);
|
||||
|
|
|
@ -75,7 +75,7 @@ smoothly scrolled off.
|
|||
================
|
||||
*/
|
||||
void
|
||||
RE_Draw_CharScaled(int x, int y, int num, float scale)
|
||||
RE_Draw_CharScaled(int x, int y, int c, float scale)
|
||||
{
|
||||
pixel_t *dest;
|
||||
byte *source;
|
||||
|
@ -87,9 +87,9 @@ RE_Draw_CharScaled(int x, int y, int num, float scale)
|
|||
if (iscale < 1)
|
||||
return;
|
||||
|
||||
num &= 255;
|
||||
c &= 255;
|
||||
|
||||
if (num == 32 || num == 32+128)
|
||||
if (c == 32 || c == 32+128)
|
||||
return;
|
||||
|
||||
if (y <= -8)
|
||||
|
@ -98,8 +98,8 @@ RE_Draw_CharScaled(int x, int y, int num, float scale)
|
|||
if ( ( y + 8 ) > vid.height ) // status text was missing in sw...
|
||||
return;
|
||||
|
||||
row = num>>4;
|
||||
col = num&15;
|
||||
row = c>>4;
|
||||
col = c&15;
|
||||
source = draw_chars->pixels[0] + (row<<10) + (col<<3);
|
||||
|
||||
if (y < 0)
|
||||
|
@ -146,11 +146,11 @@ RE_Draw_GetPicSize
|
|||
=============
|
||||
*/
|
||||
void
|
||||
RE_Draw_GetPicSize (int *w, int *h, char *pic)
|
||||
RE_Draw_GetPicSize (int *w, int *h, char *name)
|
||||
{
|
||||
image_t *gl;
|
||||
|
||||
gl = RE_Draw_FindPic (pic);
|
||||
gl = RE_Draw_FindPic (name);
|
||||
if (!gl)
|
||||
{
|
||||
*w = *h = -1;
|
||||
|
@ -170,7 +170,6 @@ RE_Draw_StretchPicImplementation (int x, int y, int w, int h, const image_t *pic
|
|||
{
|
||||
pixel_t *dest;
|
||||
byte *source;
|
||||
int v, u;
|
||||
int height;
|
||||
int skip;
|
||||
|
||||
|
@ -198,6 +197,8 @@ RE_Draw_StretchPicImplementation (int x, int y, int w, int h, const image_t *pic
|
|||
|
||||
if (w == pic->width)
|
||||
{
|
||||
int v;
|
||||
|
||||
for (v=0 ; v<height ; v++, dest += vid.width)
|
||||
{
|
||||
int sv = (skip + v)*pic->height/h;
|
||||
|
@ -207,9 +208,10 @@ RE_Draw_StretchPicImplementation (int x, int y, int w, int h, const image_t *pic
|
|||
}
|
||||
else
|
||||
{
|
||||
int v;
|
||||
for (v=0 ; v<height ; v++, dest += vid.width)
|
||||
{
|
||||
int f, fstep;
|
||||
int f, fstep, u;
|
||||
int sv = (skip + v)*pic->height/h;
|
||||
source = pic->pixels[0] + sv*pic->width;
|
||||
f = 0;
|
||||
|
|
|
@ -190,6 +190,12 @@ R_LoadPic (char *name, byte *pic, int width, int height, imagetype_t type)
|
|||
size = width * height;
|
||||
full_size = R_GetImageMipsSize(size);
|
||||
image->pixels[0] = malloc(full_size);
|
||||
if (!image->pixels[0])
|
||||
{
|
||||
ri.Sys_Error(ERR_FATAL, "%s: Can't allocate image.", __func__);
|
||||
// code never returns after ERR_FATAL
|
||||
return NULL;
|
||||
}
|
||||
image->transparent = false;
|
||||
for (i=0 ; i<size ; i++)
|
||||
{
|
||||
|
@ -363,7 +369,7 @@ R_LoadHiColorImage(char *name, const char* namewe, const char *ext, imagetype_t
|
|||
}
|
||||
}
|
||||
|
||||
if (!pic)
|
||||
if (pic)
|
||||
{
|
||||
free(pic);
|
||||
}
|
||||
|
@ -398,10 +404,7 @@ R_LoadImage(char *name, const char* namewe, const char *ext, imagetype_t type)
|
|||
{
|
||||
free(palette);
|
||||
}
|
||||
if (!pic)
|
||||
{
|
||||
free(pic);
|
||||
}
|
||||
free(pic);
|
||||
}
|
||||
else if (strcmp(ext, "wal") == 0)
|
||||
{
|
||||
|
@ -560,6 +563,8 @@ R_InitImages (void)
|
|||
if ( !table16to8 )
|
||||
{
|
||||
ri.Sys_Error(ERR_FATAL, "%s: Couldn't load pics/16to8.dat", __func__);
|
||||
// code never returns after ERR_FATAL
|
||||
return;
|
||||
}
|
||||
d_16to8table = malloc(0x10000);
|
||||
memcpy(d_16to8table, table16to8, 0x10000);
|
||||
|
|
|
@ -1159,7 +1159,7 @@ R_EdgeDrawing (void)
|
|||
|
||||
//=======================================================================
|
||||
|
||||
static void R_GammaCorrectAndSetPalette(const unsigned char *pal);
|
||||
static void R_GammaCorrectAndSetPalette(const unsigned char *palette);
|
||||
|
||||
/*
|
||||
=============
|
||||
|
@ -1267,7 +1267,7 @@ RE_RenderFrame (refdef_t *fd)
|
|||
VectorCopy (fd->vieworg, r_refdef.vieworg);
|
||||
VectorCopy (fd->viewangles, r_refdef.viewangles);
|
||||
|
||||
// compare current possition with old
|
||||
// compare current position with old
|
||||
if (!VectorCompareRound(fd->vieworg, lastvieworg) ||
|
||||
!VectorCompare(fd->viewangles, lastviewangles))
|
||||
{
|
||||
|
@ -1278,7 +1278,7 @@ RE_RenderFrame (refdef_t *fd)
|
|||
fastmoving = false;
|
||||
}
|
||||
|
||||
// save possition for next check
|
||||
// save position for next check
|
||||
VectorCopy (fd->vieworg, lastvieworg);
|
||||
VectorCopy (fd->viewangles, lastviewangles);
|
||||
|
||||
|
@ -1340,10 +1340,10 @@ RE_RenderFrame (refdef_t *fd)
|
|||
D_WarpScreen ();
|
||||
|
||||
if (r_dspeeds->value)
|
||||
{
|
||||
da_time1 = SDL_GetTicks();
|
||||
|
||||
if (r_dspeeds->value)
|
||||
da_time2 = SDL_GetTicks();
|
||||
}
|
||||
|
||||
// Modify the palette (when taking hit or pickup item) so all colors are modified
|
||||
R_CalcPalette ();
|
||||
|
@ -2172,6 +2172,12 @@ SWimp_CreateRender(void)
|
|||
{
|
||||
swap_current = 0;
|
||||
swap_buffers = malloc(vid.height * vid.width * sizeof(pixel_t) * 2);
|
||||
if (!swap_buffers)
|
||||
{
|
||||
ri.Sys_Error(ERR_FATAL, "%s: Can't allocate swapbuffer.", __func__);
|
||||
// code never returns after ERR_FATAL
|
||||
return;
|
||||
}
|
||||
swap_frames[0] = swap_buffers;
|
||||
swap_frames[1] = swap_buffers + vid.height * vid.width * sizeof(pixel_t);
|
||||
vid_buffer = swap_frames[swap_current&1];
|
||||
|
|
|
@ -210,6 +210,7 @@ Mod_PointInLeaf (vec3_t p, model_t *model)
|
|||
if (!model || !model->nodes)
|
||||
{
|
||||
ri.Sys_Error(ERR_DROP, "%s: bad model", __func__);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
node = model->nodes;
|
||||
|
@ -982,7 +983,7 @@ Mod_LoadBrushModel(model_t *mod, void *buffer, int modfilelen)
|
|||
int hunkSize = 0;
|
||||
hunkSize += calcLumpHunkSize(&header->lumps[LUMP_VERTEXES], sizeof(dvertex_t), sizeof(mvertex_t), 8);
|
||||
hunkSize += calcLumpHunkSize(&header->lumps[LUMP_EDGES], sizeof(dedge_t), sizeof(medge_t), 13);
|
||||
float surfEdgeCount = header->lumps[LUMP_SURFEDGES].filelen/sizeof(int);
|
||||
float surfEdgeCount = (float)header->lumps[LUMP_SURFEDGES].filelen / sizeof(int);
|
||||
if(surfEdgeCount < MAX_MAP_SURFEDGES) // else it errors out later anyway
|
||||
hunkSize += calcLumpHunkSize(&header->lumps[LUMP_SURFEDGES], sizeof(int), sizeof(int), 24);
|
||||
|
||||
|
|
|
@ -234,6 +234,12 @@ R_InitCaches (void)
|
|||
|
||||
sc_size = size;
|
||||
sc_base = (surfcache_t *)malloc(size);
|
||||
if (!sc_base)
|
||||
{
|
||||
ri.Sys_Error(ERR_FATAL, "%s: Can't allocate cache.", __func__);
|
||||
// code never returns after ERR_FATAL
|
||||
return;
|
||||
}
|
||||
sc_rover = sc_base;
|
||||
|
||||
sc_base->next = NULL;
|
||||
|
|
Loading…
Reference in a new issue