mirror of
https://github.com/rehlds/rehlds.git
synced 2024-12-27 23:25:45 +03:00
CalcSurfaceExtents: more info in extents error message
This commit is contained in:
parent
df862d9bb6
commit
6e6368da30
@ -854,6 +854,7 @@ void CalcSurfaceExtents(msurface_t *s)
|
|||||||
int i, j, e;
|
int i, j, e;
|
||||||
mvertex_t *v;
|
mvertex_t *v;
|
||||||
mtexinfo_t *tex;
|
mtexinfo_t *tex;
|
||||||
|
vec3_t middle{};
|
||||||
int bmins[2], bmaxs[2];
|
int bmins[2], bmaxs[2];
|
||||||
|
|
||||||
mins[0] = mins[1] = 999999;
|
mins[0] = mins[1] = 999999;
|
||||||
@ -869,6 +870,8 @@ void CalcSurfaceExtents(msurface_t *s)
|
|||||||
else
|
else
|
||||||
v = &loadmodel->vertexes[loadmodel->edges[-e].v[1]];
|
v = &loadmodel->vertexes[loadmodel->edges[-e].v[1]];
|
||||||
|
|
||||||
|
VectorAdd(middle, v->position, middle);
|
||||||
|
|
||||||
for (j = 0; j < 2; j++)
|
for (j = 0; j < 2; j++)
|
||||||
{
|
{
|
||||||
// FIXED: loss of floating point
|
// FIXED: loss of floating point
|
||||||
@ -884,6 +887,8 @@ void CalcSurfaceExtents(msurface_t *s)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VectorScale(middle, 1.0f / s->numedges, middle);
|
||||||
|
|
||||||
for (i = 0; i < 2; i++)
|
for (i = 0; i < 2; i++)
|
||||||
{
|
{
|
||||||
bmins[i] = (int) floor(mins[i] / 16);
|
bmins[i] = (int) floor(mins[i] / 16);
|
||||||
@ -891,8 +896,16 @@ void CalcSurfaceExtents(msurface_t *s)
|
|||||||
|
|
||||||
s->texturemins[i] = bmins[i] * 16;
|
s->texturemins[i] = bmins[i] * 16;
|
||||||
s->extents[i] = (bmaxs[i] - bmins[i]) * 16;
|
s->extents[i] = (bmaxs[i] - bmins[i]) * 16;
|
||||||
|
|
||||||
if (!(tex->flags & TEX_SPECIAL) && s->extents[i] > MAX_SURFACE_TEXTURE_SIZE)
|
if (!(tex->flags & TEX_SPECIAL) && s->extents[i] > MAX_SURFACE_TEXTURE_SIZE)
|
||||||
Sys_Error("%s: Bad surface extents", __func__);
|
{
|
||||||
|
int surfID = s - loadmodel->surfaces;
|
||||||
|
Sys_Error("%s: Bad #%d surface extents %d/%d on %s at position (%d,%d,%d)",
|
||||||
|
__func__, surfID, s->extents[0], s->extents[1],
|
||||||
|
tex->texture->name,
|
||||||
|
(int)middle[0], (int)middle[1], (int)middle[2]
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user