- fixed inconsistent use of line_t::portaltransferred.

Some parts used 0 as 'nothing' others used UINT_MAX. 0 should refer to the map's default sky, not to nothing.
This commit is contained in:
Christoph Oelckers 2017-01-08 14:59:31 +01:00
parent 71d1138376
commit cb89a1a81a
5 changed files with 23 additions and 2 deletions

View file

@ -1547,7 +1547,7 @@ void GLWall::Process(seg_t *seg, sector_t * frontsector, sector_t * backsector)
zbottom[1] = zfloor[1]; zbottom[1] = zfloor[1];
PutPortal(PORTALTYPE_LINETOLINE); PutPortal(PORTALTYPE_LINETOLINE);
} }
else if (seg->linedef->portaltransferred > 0) else if (seg->linedef->GetTransferredPortal())
{ {
SkyLine(frontsector, seg->linedef); SkyLine(frontsector, seg->linedef);
} }

View file

@ -1772,6 +1772,19 @@ DEFINE_ACTION_FUNCTION(_Sector, NextLowestFloorAt)
ACTION_RETURN_FLOAT(self->CenterCeiling()); ACTION_RETURN_FLOAT(self->CenterCeiling());
} }
DEFINE_ACTION_FUNCTION(_Sector, Index)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
unsigned ndx = self->Index();
if (ndx >= level.sectors.Size())
{
// This qualifies as an array out of bounds exception. Normally it can only happen when a sector copy is concerned which scripts should not be able to create.
va_list ap;
throw CVMAbortException(X_ARRAY_OUT_OF_BOUNDS, "Accessed invalid sector", ap);
}
ACTION_RETURN_INT(ndx);
}
//=========================================================================== //===========================================================================
// //
// //
@ -2100,6 +2113,7 @@ DEFINE_FIELD_X(Line, line_t, backsector)
DEFINE_FIELD_X(Line, line_t, validcount) DEFINE_FIELD_X(Line, line_t, validcount)
DEFINE_FIELD_X(Line, line_t, locknumber) DEFINE_FIELD_X(Line, line_t, locknumber)
DEFINE_FIELD_X(Line, line_t, portalindex) DEFINE_FIELD_X(Line, line_t, portalindex)
DEFINE_FIELD_X(Line, line_t, portaltransferred)
DEFINE_FIELD_X(Secplane, secplane_t, normal) DEFINE_FIELD_X(Secplane, secplane_t, normal)
DEFINE_FIELD_X(Secplane, secplane_t, D) DEFINE_FIELD_X(Secplane, secplane_t, D)

View file

@ -2156,6 +2156,7 @@ void P_LoadLineDefs (MapData * map)
{ {
ld->alpha = 1.; // [RH] Opaque by default ld->alpha = 1.; // [RH] Opaque by default
ld->portalindex = UINT_MAX; ld->portalindex = UINT_MAX;
ld->portaltransferred = UINT_MAX;
// [RH] Translate old linedef special and flags to be // [RH] Translate old linedef special and flags to be
// compatible with the new format. // compatible with the new format.
@ -2249,6 +2250,7 @@ void P_LoadLineDefs2 (MapData * map)
int j; int j;
ld->portalindex = UINT_MAX; ld->portalindex = UINT_MAX;
ld->portaltransferred = UINT_MAX;
for (j = 0; j < 5; j++) for (j = 0; j < 5; j++)
ld->args[j] = mld->args[j]; ld->args[j] = mld->args[j];

View file

@ -1824,6 +1824,9 @@ public:
{ {
short tempalpha[2] = { SHRT_MIN, SHRT_MIN }; short tempalpha[2] = { SHRT_MIN, SHRT_MIN };
lines[line].portalindex = UINT_MAX;
lines[line].portaltransferred = UINT_MAX;
lines[line] = ParsedLines[line]; lines[line] = ParsedLines[line];
for(int sd = 0; sd < 2; sd++) for(int sd = 0; sd < 2; sd++)

View file

@ -226,7 +226,7 @@ struct Line native
}; };
//native readonly vertex v1, v2; // vertices, from v1 to v2 native readonly vertex v1, v2; // vertices, from v1 to v2
native readonly Vector2 delta; // precalculated v2 - v1 for side checking native readonly Vector2 delta; // precalculated v2 - v1 for side checking
native uint flags; native uint flags;
native uint activation; // activation type native uint activation; // activation type
@ -239,6 +239,7 @@ struct Line native
native int validcount; // if == validcount, already checked native int validcount; // if == validcount, already checked
native int locknumber; // [Dusk] lock number for special native int locknumber; // [Dusk] lock number for special
native readonly uint portalindex; native readonly uint portalindex;
native readonly uint portaltransferred;
} }
struct SecPlane native struct SecPlane native
@ -378,6 +379,7 @@ struct Sector native
native readonly int sectornum; native readonly int sectornum;
native int Index();
native double, Sector, F3DFloor NextHighestCeilingAt(double x, double y, double bottomz, double topz, int flags = 0); native double, Sector, F3DFloor NextHighestCeilingAt(double x, double y, double bottomz, double topz, int flags = 0);
native double, Sector, F3DFloor NextLowestFloorAt(double x, double y, double z, int flags = 0, double steph = 0); native double, Sector, F3DFloor NextLowestFloorAt(double x, double y, double z, int flags = 0, double steph = 0);