Merge branch 'polyobject-more-fixes' into 'next'

Polyobject more fixes

Extra fixes related to polyobjects; actually properly putting their flats alongside them in the draw list, and making them able to use single-waypoint zoom tube sequences. Also threw in a smoothness fix for swinging chains while I was there.

See merge request !8
This commit is contained in:
Furyhunter 2015-04-14 20:13:16 -04:00
commit 63089c885e
5 changed files with 27 additions and 6 deletions

View file

@ -5024,7 +5024,7 @@ void A_MaceRotate(mobj_t *actor)
actor->movecount += actor->target->lastlook;
actor->movecount &= FINEMASK;
actor->threshold = FixedMul(FINECOSINE(actor->movecount), actor->target->lastlook);
actor->threshold = FixedMul(FINECOSINE(actor->movecount), actor->target->lastlook << FRACBITS);
v[0] = FRACUNIT;
v[1] = 0;
@ -5032,7 +5032,7 @@ void A_MaceRotate(mobj_t *actor)
v[3] = FRACUNIT;
// Calculate the angle matrixes for the link.
res = VectorMatrixMultiply(v, *RotateXMatrix(FixedAngle(actor->threshold << FRACBITS)));
res = VectorMatrixMultiply(v, *RotateXMatrix(FixedAngle(actor->threshold)));
M_Memcpy(&v, res, sizeof(v));
res = VectorMatrixMultiply(v, *RotateZMatrix(actor->target->health << ANGLETOFINESHIFT));
M_Memcpy(&v, res, sizeof(v));

View file

@ -2503,6 +2503,10 @@ INT32 EV_DoPolyObjWaypoint(polywaypointdata_t *pwdata)
return 0;
}
// Hotfix to not crash on single-waypoint sequences -Red
if (!last)
last = first;
// Set diffx, diffy, diffz
// Put these at 0 for now...might not be needed after all.
th->diffx = 0;//first->x - po->centerPt.x;

View file

@ -100,6 +100,8 @@ typedef struct polyobj_s
UINT8 isBad; // a bad polyobject: should not be rendered/manipulated
INT32 translucency; // index to translucency tables
struct visplane_s *visplane; // polyobject's visplane, for ease of putting into the list later
// these are saved for netgames, so do not let Lua touch these!
INT32 spawnflags; // Flags the polyobject originally spawned with
} polyobj_t;

View file

@ -978,11 +978,12 @@ static void R_Subsector(size_t num)
polysec->floorpic_angle-po->angle,
NULL,
NULL);
ffloor[numffloors].plane->polyobj = po;
//ffloor[numffloors].plane->polyobj = po;
ffloor[numffloors].height = polysec->floorheight;
ffloor[numffloors].polyobj = po;
// ffloor[numffloors].ffloor = rover;
po->visplane = ffloor[numffloors].plane;
numffloors++;
}
@ -1014,11 +1015,12 @@ static void R_Subsector(size_t num)
ffloor[numffloors].plane = R_FindPlane(polysec->ceilingheight, polysec->ceilingpic,
polysec->lightlevel, xoff, yoff, polysec->ceilingpic_angle-po->angle,
NULL, NULL);
ffloor[numffloors].plane->polyobj = po;
//ffloor[numffloors].plane->polyobj = po;
ffloor[numffloors].polyobj = po;
ffloor[numffloors].height = polysec->ceilingheight;
// ffloor[numffloors].ffloor = rover;
po->visplane = ffloor[numffloors].plane;
numffloors++;
}

View file

@ -1682,6 +1682,19 @@ static void R_CreateDrawNodes(void)
}
if (ds->maskedtexturecol)
{
#ifdef POLYOBJECTS_PLANES
// Check for a polyobject plane, but only if this is a front line
if (ds->curline->polyseg && ds->curline->polyseg->visplane && !ds->curline->side) {
// Put it in!
entry = R_CreateDrawNode(&nodehead);
entry->plane = ds->curline->polyseg->visplane;
entry->seg = ds;
ds->curline->polyseg->visplane->polyobj = ds->curline->polyseg;
ds->curline->polyseg->visplane = NULL;
}
#endif
entry = R_CreateDrawNode(&nodehead);
entry->seg = ds;
}
@ -1698,7 +1711,7 @@ static void R_CreateDrawNodes(void)
plane = ds->ffloorplanes[p];
R_PlaneBounds(plane);
if (plane->low < con_clipviewtop || plane->high > vid.height || plane->high > plane->low)
if (plane->low < con_clipviewtop || plane->high > vid.height || plane->high > plane->low || plane->polyobj)
{
ds->ffloorplanes[p] = NULL;
continue;
@ -1809,7 +1822,7 @@ static void R_CreateDrawNodes(void)
}
else if (r2->seg)
{
#ifdef POLYOBJECTS_PLANES
#if 0 //#ifdef POLYOBJECTS_PLANES
if (r2->seg->curline->polyseg && rover->mobj && P_MobjInsidePolyobj(r2->seg->curline->polyseg, rover->mobj)) {
// Determine if we need to sort in front of the polyobj, based on the planes. This fixes the issue where
// polyobject planes render above the object standing on them. (A bit hacky... but it works.) -Red