mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-24 21:11:39 +00:00
- fixed: The portal link table was not created when there were no sector portals.
- fixed: P_TryMove could loop endlessly over a list of static portals when there was an error during portal creation. # Conflicts: # src/gl/models/gl_models.cpp # src/gl/scene/gl_sprite.cpp
This commit is contained in:
parent
651817fad7
commit
0a92138edf
2 changed files with 29 additions and 25 deletions
|
@ -2287,9 +2287,12 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y,
|
|||
{
|
||||
fixed_t bestfrac = FIXED_MAX;
|
||||
spechit_t besthit;
|
||||
int besthitnum;
|
||||
// find the portal nearest to the crossing actor
|
||||
for (auto &spec : portalhit)
|
||||
for (unsigned i = 0; i < portalhit.Size();i++)
|
||||
{
|
||||
auto &spec = portalhit[i];
|
||||
|
||||
line_t *ld = spec.line;
|
||||
if (ld->frontsector->PortalGroup != thing->Sector->PortalGroup) continue; // must be in the same group to be considered valid.
|
||||
|
||||
|
@ -2305,12 +2308,14 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y,
|
|||
{
|
||||
besthit = spec;
|
||||
bestfrac = frac;
|
||||
besthitnum = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (bestfrac < FIXED_MAX)
|
||||
{
|
||||
portalhit.Delete(besthitnum);
|
||||
line_t *ld = besthit.line;
|
||||
FLinePortal *port = ld->getPortal();
|
||||
if (port->mType == PORTT_LINKED)
|
||||
|
@ -2370,7 +2375,10 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y,
|
|||
}
|
||||
R_AddInterpolationPoint(hit);
|
||||
}
|
||||
if (port->mType == PORTT_LINKED) continue;
|
||||
if (port->mType == PORTT_LINKED)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -933,7 +933,7 @@ void P_CreateLinkedPortals()
|
|||
TThinkerIterator<AStackPoint> it;
|
||||
AStackPoint *mo;
|
||||
TArray<AStackPoint *> orgs;
|
||||
int id = 0;
|
||||
int id = 1;
|
||||
bool bogus = false;
|
||||
|
||||
while ((mo = it.Next()))
|
||||
|
@ -952,36 +952,32 @@ void P_CreateLinkedPortals()
|
|||
}
|
||||
}
|
||||
}
|
||||
if (orgs.Size() == 0)
|
||||
if (orgs.Size() != 0)
|
||||
{
|
||||
// Create the 0->0 translation which is always needed.
|
||||
Displacements.Create(1);
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < numsectors; i++)
|
||||
{
|
||||
for (int j = 0; j < 2; j++)
|
||||
for (int i = 0; i < numsectors; i++)
|
||||
{
|
||||
AActor *box = sectors[i].SkyBoxes[j];
|
||||
if (box != NULL && box->special1 == SKYBOX_LINKEDPORTAL)
|
||||
for (int j = 0; j < 2; j++)
|
||||
{
|
||||
secplane_t &plane = j == 0 ? sectors[i].floorplane : sectors[i].ceilingplane;
|
||||
if (plane.a || plane.b)
|
||||
AActor *box = sectors[i].SkyBoxes[j];
|
||||
if (box != NULL && box->special1 == SKYBOX_LINKEDPORTAL)
|
||||
{
|
||||
// The engine cannot deal with portals on a sloped plane.
|
||||
sectors[i].SkyBoxes[j] = NULL;
|
||||
Printf("Portal on %s of sector %d is sloped and will be disabled\n", j==0? "floor":"ceiling", i);
|
||||
secplane_t &plane = j == 0 ? sectors[i].floorplane : sectors[i].ceilingplane;
|
||||
if (plane.a || plane.b)
|
||||
{
|
||||
// The engine cannot deal with portals on a sloped plane.
|
||||
sectors[i].SkyBoxes[j] = NULL;
|
||||
Printf("Portal on %s of sector %d is sloped and will be disabled\n", j == 0 ? "floor" : "ceiling", i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Group all sectors, starting at each portal origin.
|
||||
id = 1;
|
||||
for (unsigned i = 0; i < orgs.Size(); i++)
|
||||
{
|
||||
if (CollectSectors(id, orgs[i]->Sector)) id++;
|
||||
if (CollectSectors(id, orgs[i]->Mate->Sector)) id++;
|
||||
// Group all sectors, starting at each portal origin.
|
||||
for (unsigned i = 0; i < orgs.Size(); i++)
|
||||
{
|
||||
if (CollectSectors(id, orgs[i]->Sector)) id++;
|
||||
if (CollectSectors(id, orgs[i]->Mate->Sector)) id++;
|
||||
}
|
||||
}
|
||||
for (unsigned i = 0; i < linePortals.Size(); i++)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue