diff --git a/src/p_enemy.c b/src/p_enemy.c index ee244d3cc..8b7af9318 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -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)); diff --git a/src/p_polyobj.c b/src/p_polyobj.c index e98c469b6..1ff5ec72f 100644 --- a/src/p_polyobj.c +++ b/src/p_polyobj.c @@ -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; diff --git a/src/p_polyobj.h b/src/p_polyobj.h index 71cf965e3..3d6576cc6 100644 --- a/src/p_polyobj.h +++ b/src/p_polyobj.h @@ -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; diff --git a/src/r_bsp.c b/src/r_bsp.c index e967e28ce..fb25b8e4d 100644 --- a/src/r_bsp.c +++ b/src/r_bsp.c @@ -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++; } diff --git a/src/r_things.c b/src/r_things.c index d64b6bd13..f1b2e7199 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -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