mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-12-01 00:12:27 +00:00
- fixed: Line_SetPortal crashed with one-way portals.
This commit is contained in:
parent
c5204f34ca
commit
2f1b5c375e
1 changed files with 12 additions and 12 deletions
|
@ -225,7 +225,7 @@ static line_t *FindDestination(line_t *src, int tag)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -275,7 +275,7 @@ static void SetRotation(FLinePortal *port)
|
||||||
void P_SpawnLinePortal(line_t* line)
|
void P_SpawnLinePortal(line_t* line)
|
||||||
{
|
{
|
||||||
// portal destination is special argument #0
|
// portal destination is special argument #0
|
||||||
line_t* dst = NULL;
|
line_t* dst = nullptr;
|
||||||
|
|
||||||
if (line->args[2] >= PORTT_VISUAL && line->args[2] <= PORTT_LINKED)
|
if (line->args[2] >= PORTT_VISUAL && line->args[2] <= PORTT_LINKED)
|
||||||
{
|
{
|
||||||
|
@ -304,7 +304,7 @@ void P_SpawnLinePortal(line_t* line)
|
||||||
port->mType = PORTT_TELEPORT;
|
port->mType = PORTT_TELEPORT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (port->mDestination != NULL)
|
if (port->mDestination != nullptr)
|
||||||
{
|
{
|
||||||
port->mDefFlags = port->mType == PORTT_VISUAL ? PORTF_VISIBLE : port->mType == PORTT_TELEPORT ? PORTF_TYPETELEPORT : PORTF_TYPEINTERACTIVE;
|
port->mDefFlags = port->mType == PORTT_VISUAL ? PORTF_VISIBLE : port->mType == PORTT_TELEPORT ? PORTF_TYPETELEPORT : PORTF_TYPEINTERACTIVE;
|
||||||
}
|
}
|
||||||
|
@ -357,7 +357,7 @@ void P_SpawnLinePortal(line_t* line)
|
||||||
|
|
||||||
void P_UpdatePortal(FLinePortal *port)
|
void P_UpdatePortal(FLinePortal *port)
|
||||||
{
|
{
|
||||||
if (port->mDestination == NULL)
|
if (port->mDestination == nullptr)
|
||||||
{
|
{
|
||||||
// Portal has no destination: switch it off
|
// Portal has no destination: switch it off
|
||||||
port->mFlags = 0;
|
port->mFlags = 0;
|
||||||
|
@ -442,16 +442,16 @@ static bool ChangePortalLine(line_t *line, int destid)
|
||||||
if (line->portalindex >= linePortals.Size()) return false;
|
if (line->portalindex >= linePortals.Size()) return false;
|
||||||
FLinePortal *port = &linePortals[line->portalindex];
|
FLinePortal *port = &linePortals[line->portalindex];
|
||||||
if (port->mType == PORTT_LINKED) return false; // linked portals cannot be changed.
|
if (port->mType == PORTT_LINKED) return false; // linked portals cannot be changed.
|
||||||
if (destid == 0) port->mDestination = NULL;
|
if (destid == 0) port->mDestination = nullptr;
|
||||||
port->mDestination = FindDestination(line, destid);
|
port->mDestination = FindDestination(line, destid);
|
||||||
if (port->mDestination == NULL)
|
if (port->mDestination == nullptr)
|
||||||
{
|
{
|
||||||
port->mFlags = 0;
|
port->mFlags = 0;
|
||||||
}
|
}
|
||||||
else if (port->mType == PORTT_INTERACTIVE)
|
else if (port->mType == PORTT_INTERACTIVE)
|
||||||
{
|
{
|
||||||
FLinePortal *portd = &linePortals[port->mDestination->portalindex];
|
FLinePortal *portd = port->mDestination->portalindex < linePortals.Size()? &linePortals[port->mDestination->portalindex] : nullptr;
|
||||||
if (portd != NULL && portd->mType == PORTT_INTERACTIVE && portd->mDestination == line)
|
if (portd != nullptr && portd->mType == PORTT_INTERACTIVE && portd->mDestination == line)
|
||||||
{
|
{
|
||||||
// this is a 2-way interactive portal
|
// this is a 2-way interactive portal
|
||||||
port->mFlags = port->mDefFlags | PORTF_INTERACTIVE;
|
port->mFlags = port->mDefFlags | PORTF_INTERACTIVE;
|
||||||
|
@ -662,7 +662,7 @@ void P_TranslatePortalZ(line_t* src, double& z)
|
||||||
|
|
||||||
unsigned P_GetSkyboxPortal(AActor *actor)
|
unsigned P_GetSkyboxPortal(AActor *actor)
|
||||||
{
|
{
|
||||||
if (actor == NULL) return 1; // this means a regular sky.
|
if (actor == nullptr) return 1; // this means a regular sky.
|
||||||
for (unsigned i = 0;i<level.sectorPortals.Size();i++)
|
for (unsigned i = 0;i<level.sectorPortals.Size();i++)
|
||||||
{
|
{
|
||||||
if (level.sectorPortals[i].mSkybox == actor) return i;
|
if (level.sectorPortals[i].mSkybox == actor) return i;
|
||||||
|
@ -820,7 +820,7 @@ static bool CollectSectors(int groupid, sector_t *origin)
|
||||||
for (auto line : sec->Lines)
|
for (auto line : sec->Lines)
|
||||||
{
|
{
|
||||||
sector_t *other = line->frontsector == sec ? line->backsector : line->frontsector;
|
sector_t *other = line->frontsector == sec ? line->backsector : line->frontsector;
|
||||||
if (other != NULL && other != sec && other->PortalGroup != groupid)
|
if (other != nullptr && other != sec && other->PortalGroup != groupid)
|
||||||
{
|
{
|
||||||
other->PortalGroup = groupid;
|
other->PortalGroup = groupid;
|
||||||
list.Push(other);
|
list.Push(other);
|
||||||
|
@ -1098,10 +1098,10 @@ void P_CreateLinkedPortals()
|
||||||
}
|
}
|
||||||
|
|
||||||
// reject would just get in the way when checking sight through portals.
|
// reject would just get in the way when checking sight through portals.
|
||||||
if (Displacements.size > 1 && rejectmatrix != NULL)
|
if (Displacements.size > 1 && rejectmatrix != nullptr)
|
||||||
{
|
{
|
||||||
delete[] rejectmatrix;
|
delete[] rejectmatrix;
|
||||||
rejectmatrix = NULL;
|
rejectmatrix = nullptr;
|
||||||
}
|
}
|
||||||
// finally we must flag all planes which are obstructed by the sector's own ceiling or floor.
|
// finally we must flag all planes which are obstructed by the sector's own ceiling or floor.
|
||||||
for (auto &sec : level.sectors)
|
for (auto &sec : level.sectors)
|
||||||
|
|
Loading…
Reference in a new issue