- fixed: P_CollectConnectedGroups could crash when being called before P_FinalizePortals.

- fixed: Entering a sector portal did not properly set up the starting sector of the cloned trace.
This commit is contained in:
Christoph Oelckers 2016-03-02 22:26:47 +01:00
parent f5fd0df077
commit 63d838c0a7
2 changed files with 11 additions and 3 deletions

View file

@ -3674,15 +3674,15 @@ struct aim_t
else if (position == sector_t::floor && portal->threshold > limitz) return;
aim_t newtrace = Clone();
Printf("-----Entering %s portal\n", position ? "ceiling" : "floor");
newtrace.toppitch = newtoppitch;
newtrace.bottompitch = newbottompitch;
newtrace.aimdir = position == sector_t::ceiling? aim_t::aim_up : aim_t::aim_down;
newtrace.startpos = { startpos.x + portal->scaleX, startpos.y + portal->scaleY, startpos.z };
newtrace.lastsector = P_PointInSector(startpos.x, startpos.y);
newtrace.startfrac = frac + FixedDiv(FRACUNIT, attackrange); // this is to skip the transition line to the portal which will produce a bogus opening
newtrace.lastsector = P_PointInSector(newtrace.startpos.x + FixedMul(aimtrace.x, newtrace.startfrac) , newtrace.startpos.y + FixedMul(aimtrace.y, newtrace.startfrac));
newtrace.limitz = portal->threshold;
Printf("-----Entering %s portal from sector %d to sector %d\n", position ? "ceiling" : "floor", lastsector->sectornum, newtrace.lastsector->sectornum);
newtrace.AimTraverse();
SetResult(linetarget, newtrace.linetarget);
SetResult(thing_friend, newtrace.thing_friend);
@ -3798,6 +3798,7 @@ struct aim_t
sector_t *entersec = frontflag ? li->frontsector : li->backsector;
sector_t *exitsec = frontflag ? li->backsector : li->frontsector;
lastsector = entersec;
// check portal in backsector when aiming up/downward is possible, the line doesn't have portals on both sides and there's actually a portal in the backsector
if ((planestocheck & aim_up) && toppitch < 0 && open.top != FIXED_MAX && !entersec->PortalBlocksMovement(sector_t::ceiling))
{

View file

@ -1108,9 +1108,16 @@ bool P_CollectConnectedGroups(int startgroup, const fixedvec3 &position, fixed_t
bool retval = false;
out.inited = true;
processMask.setSize(Displacements.size);
if (Displacements.size == 1)
{
processMask.setBit(startgroup);
return false;
}
if (linkedPortals.Size() != 0)
{
processMask.setSize(linkedPortals.Size());
processMask.clear();
foundPortals.Clear();