- 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
parent 0f96ec4a32
commit 321ab2f686
5 changed files with 29 additions and 10 deletions

View File

@ -1,4 +1,8 @@
October 29, 2009
- Make TranslateToStartSpot() set the new sector references for a polyobj's
walls so that P_CheckSwitchRange() will work with them.
- Fixed: If P_ActivateLine() failed in P_UseTraverse() it would not play
the *usefail sound.
- Fixed: An unspecified save_dir will now save to the program directory on
Windows. (Other operating systems already use the user's home directory
instead.)

View File

@ -293,7 +293,10 @@ bool P_TestActivateLine (line_t *line, AActor *mo, int side, int activationType)
}
if (activationType == SPAC_Use)
{
if (!P_CheckSwitchRange(mo, line, side)) return false;
if (!P_CheckSwitchRange(mo, line, side))
{
return false;
}
}
if ((lineActivation & activationType) == 0)
@ -392,7 +395,6 @@ bool P_TestActivateLine (line_t *line, AActor *mo, int side, int activationType)
//
void P_PlayerInSpecialSector (player_t *player, sector_t * sector)
{
if (sector == NULL)
{
// Falling, not all the way down yet?

View File

@ -466,7 +466,8 @@ bool P_CheckSwitchRange(AActor *user, line_t *line, int sideno)
{
// Activated from an empty side -> always succeed
side_t *side = line->sidedef[sideno];
if (side == NULL) return true;
if (side == NULL)
return true;
fixed_t checktop;
fixed_t checkbot;
@ -474,7 +475,8 @@ bool P_CheckSwitchRange(AActor *user, line_t *line, int sideno)
FLineOpening open;
// 3DMIDTEX forces CHECKSWITCHRANGE because otherwise it might cause problems.
if (!(line->flags & (ML_3DMIDTEX|ML_CHECKSWITCHRANGE))) return true;
if (!(line->flags & (ML_3DMIDTEX|ML_CHECKSWITCHRANGE)))
return true;
// calculate the point where the user would touch the wall.
divline_t dll, dlu;
@ -502,7 +504,8 @@ bool P_CheckSwitchRange(AActor *user, line_t *line, int sideno)
// Now get the information from the line.
P_LineOpening(open, NULL, line, checkx, checky, user->x, user->y);
if (open.range <= 0) goto onesided;
if (open.range <= 0)
goto onesided;
if ((TryFindSwitch (side, side_t::top)) != -1)
{
@ -516,7 +519,8 @@ bool P_CheckSwitchRange(AActor *user, line_t *line, int sideno)
{
// 3DMIDTEX lines will force a mid texture check if no switch is found on this line
// to keep compatibility with Eternity's implementation.
if (!P_GetMidTexturePosition(line, sideno, &checktop, &checkbot)) return false;
if (!P_GetMidTexturePosition(line, sideno, &checktop, &checkbot))
return false;
return user->z < checktop || user->z + user->height > checkbot;
}
else

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;
}
}
//==========================================================================

View File

@ -871,7 +871,7 @@ struct line_t
DWORD flags;
DWORD activation; // activation type
int special;
fixed_t Alpha; // <--- translucency (0-255/255=opaque)
fixed_t Alpha; // <--- translucency (0=invisibile, FRACUNIT=opaque)
int id; // <--- same as tag or set with Line_SetIdentification
int args[5]; // <--- hexen-style arguments (expanded to ZDoom's full width)
int firstid, nextid;