fix wrong FindTexinfo call

fix Lightmap_ForStyle call
change M_PI to Q_PI
switch to Q_strncasecmp
This commit is contained in:
Eric Wasylishen 2016-02-15 01:36:52 -07:00
parent 1630b8756e
commit 1f05b7976a
4 changed files with 12 additions and 11 deletions

View File

@ -624,7 +624,7 @@ void Matrix4x4_CM_Projection_Inf(float *proj, float fovx, float fovy, float near
float nudge = 1;
//proj
ymax = neard * tan( fovy * M_PI / 360.0 );
ymax = neard * tan( fovy * Q_PI / 360.0 );
ymin = -ymax;
if (fovx == fovy)
@ -634,7 +634,7 @@ void Matrix4x4_CM_Projection_Inf(float *proj, float fovx, float fovy, float near
}
else
{
xmax = neard * tan( fovx * M_PI / 360.0 );
xmax = neard * tan( fovx * Q_PI / 360.0 );
xmin = -xmax;
}
@ -660,8 +660,8 @@ void Matrix4x4_CM_Projection_Inf(float *proj, float fovx, float fovy, float near
}
float *Matrix4x4_CM_NewRotation(float ret[16], float a, float x, float y, float z)
{
float c = cos(a* M_PI / 180.0);
float s = sin(a* M_PI / 180.0);
float c = cos(a* Q_PI / 180.0);
float s = sin(a* Q_PI / 180.0);
ret[0] = x*x*(1-c)+c;
ret[4] = x*y*(1-c)-z*s;
@ -776,13 +776,13 @@ float CalcFov (float fov_x, float width, float height)
if (fov_x < 1 || fov_x > 179)
Error ("Bad fov: %f", fov_x);
x = fov_x/360*M_PI;
x = fov_x/360*Q_PI;
x = tan(x);
x = width/x;
a = atan (height/x);
a = a*360/M_PI;
a = a*360/Q_PI;
return a;
}

View File

@ -1351,7 +1351,7 @@ LightFace_Min(const lightsample_t *light,
if ((*entity)->formula != LF_LOCALMIN)
continue;
lightmap = Lightmap_ForStyle(lightmaps, (*entity)->style, lightsurf);
lightmap = Lightmap_ForStyle(lightmaps, (*entity)->style, lightsurf->numpoints);
hit = false;
sample = lightmap->samples;
@ -1807,11 +1807,11 @@ LightFace(bsp2_dface_t *face, facesup_t *facesup, const modelinfo_t *modelinfo,
if (*miptex->name != '*')
return; //non-water surfaces should still not be lit
//texture name starts with a *, so light it anyway.
if (!strncasecmp(miptex->name, "*tele", 5))
if (!Q_strncasecmp(miptex->name, "*tele", 5))
turbtype = 3;
else if (!strncasecmp(miptex->name, "*lava", 5))
else if (!Q_strncasecmp(miptex->name, "*lava", 5))
turbtype = 2;
else if (!strncasecmp(miptex->name, "*slime", 6))
else if (!Q_strncasecmp(miptex->name, "*slime", 6))
turbtype = 1;
else
turbtype = 0;

View File

@ -576,7 +576,7 @@ ParseBrushFace(parser_t *parser, mapface_t *face, mapentity_t *entity)
}
face->texinfo = FindTexinfo(&tx, entity);
face->texinfo = FindTexinfoEnt(&tx, entity);
return true;
}

View File

@ -562,6 +562,7 @@ void LoadMapFile(void);
int FindMiptex(const char *name);
int FindTexinfo(texinfo_t *texinfo, unsigned int flags);
int FindTexinfoEnt(texinfo_t *texinfo, mapentity_t *entity);
void PrintEntity(const mapentity_t *entity);
const char *ValueForKey(const mapentity_t *entity, const char *key);