- re-fixed polyobject CheckSwitchRange so that it doesn't have to alter the polyobject's linedefs.

SVN r1954 (trunk)
This commit is contained in:
Christoph Oelckers 2009-10-30 07:03:26 +00:00
parent da3daa0721
commit a4f4994e18
3 changed files with 20 additions and 12 deletions

View file

@ -490,11 +490,25 @@ bool P_CheckSwitchRange(AActor *user, line_t *line, int sideno)
dlu.dy = finesine[user->angle >> ANGLETOFINESHIFT]; dlu.dy = finesine[user->angle >> ANGLETOFINESHIFT];
inter = P_InterceptVector(&dll, &dlu); inter = P_InterceptVector(&dll, &dlu);
checkx = dll.x + FixedMul(dll.dx, inter);
checky = dll.y + FixedMul(dll.dy, inter);
// one sided line // Polyobjects must test the containing sector, not the one they originate from.
if (line->sidedef[1] == NULL) if (line->sidedef[0]->Flags & WALLF_POLYOBJ)
{
// Get a check point slightly inside the polyobject so that this still works
// if the polyobject lies directly on a sector boundary
checkx = dll.x + FixedMul(dll.dx, inter + (FRACUNIT/100));
checky = dll.y + FixedMul(dll.dy, inter + (FRACUNIT/100));
front = P_PointInSector(checkx, checky);
}
else
{
checkx = dll.x + FixedMul(dll.dx, inter);
checky = dll.y + FixedMul(dll.dy, inter);
}
// one sided line or polyobject
if (line->sidedef[1] == NULL || (line->sidedef[0]->Flags & WALLF_POLYOBJ))
{ {
onesided: onesided:
fixed_t sectorc = front->ceilingplane.ZatPoint(checkx, checky); fixed_t sectorc = front->ceilingplane.ZatPoint(checkx, checky);

View file

@ -1545,6 +1545,7 @@ static void TranslateToStartSpot (int tag, int originX, int originY)
validcount++; validcount++;
for (i = 0; i < po->numsegs; i++, tempSeg++, tempPt++) for (i = 0; i < po->numsegs; i++, tempSeg++, tempPt++)
{ {
(*tempSeg)->sidedef->Flags |= WALLF_POLYOBJ;
if ((*tempSeg)->linedef->validcount != validcount) if ((*tempSeg)->linedef->validcount != validcount)
{ {
(*tempSeg)->linedef->bbox[BOXTOP] -= deltaY; (*tempSeg)->linedef->bbox[BOXTOP] -= deltaY;
@ -1581,14 +1582,6 @@ static void TranslateToStartSpot (int tag, int originX, int originY)
I_Error ("PO_TranslateToStartSpot: Multiple polyobjs in a single subsector.\n"); I_Error ("PO_TranslateToStartSpot: Multiple polyobjs in a single subsector.\n");
} }
sub->poly = po; 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;
}
} }
//========================================================================== //==========================================================================

View file

@ -725,6 +725,7 @@ enum
WALLF_SMOOTHLIGHTING = 8, // Similar to autocontrast but applies to all angles. WALLF_SMOOTHLIGHTING = 8, // Similar to autocontrast but applies to all angles.
WALLF_CLIP_MIDTEX = 16, // Like the line counterpart, but only for this side. WALLF_CLIP_MIDTEX = 16, // Like the line counterpart, but only for this side.
WALLF_WRAP_MIDTEX = 32, // Like the line counterpart, but only for this side. WALLF_WRAP_MIDTEX = 32, // Like the line counterpart, but only for this side.
WALLF_POLYOBJ = 64, // This wall belongs to a polyobject.
}; };
struct side_t struct side_t