Missing PVS Studio fixes for soft renderer.

Mod of the problems were already done by @0lvin in 129da805.
This commit is contained in:
Yamagi 2020-02-10 18:21:29 +01:00
parent b3f61f20d4
commit e0067e90a8
3 changed files with 24 additions and 20 deletions

View file

@ -89,7 +89,7 @@ R_AliasCheckFrameBBox( daliasframe_t *frame, float worldxf[3][4] )
int i;
vec3_t mins, maxs;
vec3_t transformed_min, transformed_max;
qboolean zclipped = false, zfullyclipped = true;
qboolean zfullyclipped = true;
/*
** get the exact frame bounding box
@ -115,10 +115,6 @@ R_AliasCheckFrameBBox( daliasframe_t *frame, float worldxf[3][4] )
{
return BBOX_TRIVIAL_REJECT;
}
if ( zclipped )
{
return ( BBOX_MUST_CLIP_XY | BBOX_MUST_CLIP_Z );
}
/*
** build a transformed bounding box from the given min and max
@ -594,9 +590,6 @@ R_AliasSetupLighting(entity_t *currententity)
r_ambientlight = (255 - r_ambientlight) << VID_CBITS;
if (r_ambientlight < LIGHT_MIN)
r_ambientlight = LIGHT_MIN;
r_shadelight = lighting.shadelight;
if (r_shadelight < 0)

View file

@ -341,6 +341,13 @@ R_LoadHiColorImage(char *name, const char* namewe, const char *ext, imagetype_t
size8 = R_GetImageMipsSize(width * height);
pic8 = malloc(size8);
if (!pic8)
{
ri.Sys_Error(ERR_FATAL, "%s: Can't allocate image.", __func__);
// code never returns after ERR_FATAL
return NULL;
}
if (width != realwidth || height != realheight)
{
// temporary place for shrinked image
@ -566,7 +573,14 @@ R_InitImages (void)
// code never returns after ERR_FATAL
return;
}
d_16to8table = malloc(0x10000);
if ( !d_16to8table )
{
ri.Sys_Error(ERR_FATAL, "%s: Couldn't allocate memory for d_16to8table", __func__);
// code never returns after ERR_FATAL
return;
}
memcpy(d_16to8table, table16to8, 0x10000);
ri.FS_FreeFile((void *)table16to8);

View file

@ -185,19 +185,16 @@ RecursiveLightPoint (mnode_t *node, vec3_t start, vec3_t end)
lightmap = surf->samples;
VectorCopy (vec3_origin, pointcolor);
if (lightmap)
{
lightmap += dt * ((surf->extents[0]>>4)+1) + ds;
lightmap += dt * ((surf->extents[0]>>4)+1) + ds;
for (maps = 0 ; maps < MAXLIGHTMAPS && surf->styles[maps] != 255 ;
maps++)
{
samp = *lightmap * r_modulate->value * (1.0/255); // adjust for gl scale
scales = r_newrefdef.lightstyles[surf->styles[maps]].rgb;
VectorMA (pointcolor, samp, scales, pointcolor);
lightmap += ((surf->extents[0]>>4)+1) *
((surf->extents[1]>>4)+1);
}
for (maps = 0 ; maps < MAXLIGHTMAPS && surf->styles[maps] != 255 ;
maps++)
{
samp = *lightmap * r_modulate->value * (1.0/255); // adjust for gl scale
scales = r_newrefdef.lightstyles[surf->styles[maps]].rgb;
VectorMA (pointcolor, samp, scales, pointcolor);
lightmap += ((surf->extents[0]>>4)+1) *
((surf->extents[1]>>4)+1);
}
return 1;