- Make TranslateToStartSpot() set the new sector references for a polyobj's

walls so that P_CheckSwitchRange() will work with them.


SVN r1951 (trunk)
This commit is contained in:
Randy Heit 2009-10-30 03:29:15 +00:00
commit 321ab2f686
5 changed files with 29 additions and 10 deletions

View file

@ -1565,21 +1565,30 @@ static void TranslateToStartSpot (int tag, int originX, int originY)
(*tempSeg)->v1->x -= deltaX;
(*tempSeg)->v1->y -= deltaY;
}
avg.x += (*tempSeg)->v1->x>>FRACBITS;
avg.y += (*tempSeg)->v1->y>>FRACBITS;
avg.x += (*tempSeg)->v1->x >> FRACBITS;
avg.y += (*tempSeg)->v1->y >> FRACBITS;
// the original Pts are based off the startSpot Pt, and are
// unique to each seg, not each linedef
tempPt->x = (*tempSeg)->v1->x-po->startSpot[0];
tempPt->y = (*tempSeg)->v1->y-po->startSpot[1];
}
// Put polyobj in its subsector.
avg.x /= po->numsegs;
avg.y /= po->numsegs;
sub = R_PointInSubsector (avg.x<<FRACBITS, avg.y<<FRACBITS);
sub = R_PointInSubsector (avg.x << FRACBITS, avg.y << FRACBITS);
if (sub->poly != NULL)
{
I_Error ("PO_TranslateToStartSpot: Multiple polyobjs in a single subsector.\n");
}
sub->poly = po;
// Reassign the sides of the polyobj to its new sector.
sector_t *sec = P_PointInSector (avg.x << FRACBITS, avg.y << FRACBITS);
for (i = 0; i < po->numsegs; ++i)
{
po->segs[i]->linedef->frontsector = sec;
po->segs[i]->linedef->sidedef[0]->sector = sec;
po->segs[i]->frontsector = sec;
}
}
//==========================================================================