Fix slope generation

Physics seem to work at least partially, but no rendering yet (not even in OGL)
This commit is contained in:
RedEnchilada 2015-04-19 16:54:20 -05:00
parent 6e1f7e5f3a
commit 8d35c5064a
2 changed files with 18 additions and 6 deletions

View File

@ -72,6 +72,10 @@
#include "hardware/hw_light.h"
#endif
#ifdef ESLOPE
#include "p_slopes.h"
#endif
//
// Map MD5, calculated on level load.
// Sent to clients in PT_SERVERINFO.
@ -1166,6 +1170,10 @@ static void P_LoadLineDefs(lumpnum_t lumpnum)
#ifdef POLYOBJECTS
ld->polyobj = NULL;
#endif
#ifdef ESLOPE
P_MakeLineNormal(ld);
#endif
}
Z_Free(data);

View File

@ -185,23 +185,27 @@ static float P_GetExtent(sector_t *sector, line_t *line, v3float_t *o, v2float_t
for(i = 0; i < sector->linecount; i++)
{
line_t *li = sector->lines[i];
vertex_t tempv;
float dist;
// Don't compare to the slope line.
if(li == line)
continue;
// ZDoom code in P_AlignPlane
// dist = fabs((double(line->v1->y) - vert->y) * line->dx - (double(line->v1->x) - vert->x) * line->dy);
dist = (float)fabs((FIXED_TO_FLOAT(li->v1->x) - o->x) * d->x + (FIXED_TO_FLOAT(li->v1->y) - o->y) * d->y);
//dist = (float)fabs((FIXED_TO_FLOAT(li->v1->x) - o->x) * d->x + (FIXED_TO_FLOAT(li->v1->y) - o->y) * d->y);
P_ClosestPointOnLine(li->v1->x, li->v1->y, line, &tempv);
dist = FIXED_TO_FLOAT(R_PointToDist2(tempv.x, tempv.y, line->v1->x, line->v1->y));
if(dist > fardist)
fardist = dist;
dist = (float)fabs((FIXED_TO_FLOAT(li->v2->x) - o->x) * d->x + (FIXED_TO_FLOAT(li->v2->y) - o->y) * d->y);
// We shouldn't have to do this for v2... -Red
/*dist = (float)fabs((FIXED_TO_FLOAT(li->v2->x) - o->x) * d->x + (FIXED_TO_FLOAT(li->v2->y) - o->y) * d->y);
if(dist > fardist)
fardist = dist;
fardist = dist;*/
}
return fardist;
}