soft: directly copy r_ambientlight

This commit is contained in:
Denis Pauk 2022-03-19 19:20:35 +02:00
parent 6c80d9b987
commit 480f278045
2 changed files with 20 additions and 13 deletions

View File

@ -399,7 +399,6 @@ R_AliasTransformFinalVerts(const entity_t *currententity, int numpoints, finalve
for ( i = 0; i < numpoints; i++, fv++, oldv++, newv++ )
{
int j;
float lightcos;
const float *plightnormal;
vec3_t lerped_vert;
@ -427,24 +426,28 @@ R_AliasTransformFinalVerts(const entity_t *currententity, int numpoints, finalve
// lighting
lightcos = DotProduct (plightnormal, r_plightvec);
if (lightcos < 0)
{
int j;
for(j=0; j<3; j++)
{
int temp;
temp = r_ambientlight[j];
if (lightcos < 0)
{
temp += (int)(r_shadelight[j] * lightcos);
temp += (r_shadelight[j] * lightcos);
// clamp; because we limited the minimum ambient and shading light, we
// don't have to clamp low light, just bright
if (temp < 0)
temp = 0;
}
fv->l[j] = temp;
}
}
else
memcpy(fv->l, r_ambientlight, sizeof(int) * 3); // light;
if ( fv->xyz[2] < ALIAS_Z_CLIP_PLANE )
{
@ -540,7 +543,7 @@ R_AliasSetupLighting
static void
R_AliasSetupLighting(entity_t *currententity)
{
float lightvec[3] = {-1, 0, 0};
const float lightvec[3] = {-1, 0, 0};
vec3_t light;
int i;

View File

@ -215,11 +215,12 @@ R_LoadPic (char *name, byte *pic, int width, int realwidth, int height, int real
size_t data_size, imagetype_t type)
{
image_t *image;
size_t i, size, full_size;
size_t size, full_size;
size = width * height;
if (!pic || data_size <= 0 || width <= 0 || height <= 0 || size <= 0)
/* data_size/size are unsigned */
if (!pic || data_size == 0 || width <= 0 || height <= 0 || size == 0)
return NULL;
image = R_FindFreeImage();
@ -246,6 +247,8 @@ R_LoadPic (char *name, byte *pic, int width, int realwidth, int height, int real
image->transparent = false;
if (type != it_wall)
{
size_t i;
for (i=0 ; i<size ; i++)
{
if (pic[i] == 255)
@ -305,7 +308,8 @@ R_LoadWal (char *name, imagetype_t type)
height = LittleLong (mt->height);
ofs = LittleLong(mt->offsets[0]);
if ((ofs <= 0) || (width <= 0) || (height <= 0) ||
/* width/height are unsigned */
if ((ofs <= 0) || (width == 0) || (height == 0) ||
((file_size - ofs) / width < height))
{
R_Printf(PRINT_ALL, "%s: can't load %s, small body\n", __func__, name);