mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-12-11 21:10:50 +00:00
- added initialization for line and sector portals
Resizing of portal arrays during serialization could lead to processing of junk data https://forum.zdoom.org/viewtopic.php?t=67494 # Conflicts: # src/maploader/specials.cpp # src/portal.cpp # Conflicts: # src/portal.h
This commit is contained in:
parent
36210acc28
commit
643cba776b
2 changed files with 10 additions and 4 deletions
|
@ -274,7 +274,6 @@ void P_SpawnLinePortal(line_t* line)
|
|||
line->portalindex = linePortals.Reserve(1);
|
||||
FLinePortal *port = &linePortals.Last();
|
||||
|
||||
memset(port, 0, sizeof(FLinePortal));
|
||||
port->mOrigin = line;
|
||||
port->mDestination = dst;
|
||||
port->mType = uint8_t(line->args[2]); // range check is done above.
|
||||
|
@ -669,7 +668,6 @@ unsigned P_GetSkyboxPortal(AActor *actor)
|
|||
if (level.sectorPortals[i].mSkybox == actor) return i;
|
||||
}
|
||||
unsigned i = level.sectorPortals.Reserve(1);
|
||||
memset(&level.sectorPortals[i], 0, sizeof(level.sectorPortals[i]));
|
||||
level.sectorPortals[i].mType = PORTS_SKYVIEWPOINT;
|
||||
level.sectorPortals[i].mFlags = actor->GetClass()->IsDescendantOf("SkyCamCompat") ? 0 : PORTSF_SKYFLATONLY;
|
||||
level.sectorPortals[i].mSkybox = actor;
|
||||
|
@ -694,7 +692,6 @@ DEFINE_ACTION_FUNCTION(FSectorPortal, GetSkyboxPortal)
|
|||
unsigned P_GetPortal(int type, int plane, sector_t *from, sector_t *to, const DVector2 &displacement)
|
||||
{
|
||||
unsigned i = level.sectorPortals.Reserve(1);
|
||||
memset(&level.sectorPortals[i], 0, sizeof(level.sectorPortals[i]));
|
||||
level.sectorPortals[i].mType = type;
|
||||
level.sectorPortals[i].mPlane = plane;
|
||||
level.sectorPortals[i].mOrigin = from;
|
||||
|
@ -715,7 +712,6 @@ unsigned P_GetPortal(int type, int plane, sector_t *from, sector_t *to, const DV
|
|||
unsigned P_GetStackPortal(AActor *point, int plane)
|
||||
{
|
||||
unsigned i = level.sectorPortals.Reserve(1);
|
||||
memset(&level.sectorPortals[i], 0, sizeof(level.sectorPortals[i]));
|
||||
level.sectorPortals[i].mType = PORTS_STACKEDSECTORTHING;
|
||||
level.sectorPortals[i].mPlane = plane;
|
||||
level.sectorPortals[i].mOrigin = point->target->Sector;
|
||||
|
|
10
src/portal.h
10
src/portal.h
|
@ -191,6 +191,11 @@ struct FLinePortal
|
|||
double mSinRot;
|
||||
double mCosRot;
|
||||
portnode_t *lineportal_thinglist;
|
||||
|
||||
FLinePortal()
|
||||
{
|
||||
memset(this, 0, sizeof *this);
|
||||
}
|
||||
};
|
||||
|
||||
extern TArray<FLinePortal> linePortals;
|
||||
|
@ -229,6 +234,11 @@ struct FSectorPortal
|
|||
double mPlaneZ;
|
||||
TObjPtr<AActor*> mSkybox;
|
||||
|
||||
FSectorPortal()
|
||||
{
|
||||
memset(this, 0, sizeof * this);
|
||||
}
|
||||
|
||||
bool MergeAllowed() const
|
||||
{
|
||||
// For thing based stack sectors and regular skies the portal has no relevance for merging visplanes.
|
||||
|
|
Loading…
Reference in a new issue