- actually use the newly added indices.

This commit is contained in:
Christoph Oelckers 2019-01-06 00:46:09 +01:00
parent 8b18ed4759
commit b445c6fabc
3 changed files with 8 additions and 43 deletions

View file

@ -252,46 +252,11 @@ struct FLevelLocals : public FLevelData
extern FLevelLocals level; extern FLevelLocals level;
inline int vertex_t::Index() const
{
return int(this - &level.vertexes[0]);
}
inline int side_t::Index() const
{
return int(this - &level.sides[0]);
}
inline int line_t::Index() const
{
return int(this - &level.lines[0]);
}
inline int seg_t::Index() const
{
return int(this - &level.segs[0]);
}
inline int subsector_t::Index() const
{
return int(this - &level.subsectors[0]);
}
inline int node_t::Index() const
{
return int(this - &level.nodes[0]);
}
inline FSectorPortal *line_t::GetTransferredPortal() inline FSectorPortal *line_t::GetTransferredPortal()
{ {
return portaltransferred >= level.sectorPortals.Size() ? (FSectorPortal*)nullptr : &level.sectorPortals[portaltransferred]; return portaltransferred >= level.sectorPortals.Size() ? (FSectorPortal*)nullptr : &level.sectorPortals[portaltransferred];
} }
inline int sector_t::Index() const
{
return int(this - &level.sectors[0]);
}
inline FSectorPortal *sector_t::GetPortal(int plane) inline FSectorPortal *sector_t::GetPortal(int plane)
{ {
return &level.sectorPortals[Portals[plane]]; return &level.sectorPortals[Portals[plane]];

View file

@ -229,7 +229,7 @@ void HWDrawInfo::UnclipSubsector(subsector_t *sub)
void HWDrawInfo::AddLine (seg_t *seg, bool portalclip) void HWDrawInfo::AddLine (seg_t *seg, bool portalclip)
{ {
#ifdef _DEBUG #ifdef _DEBUG
if (seg->linedef->Index() == 38) if (seg->linedef && seg->linedef->Index() == 38)
{ {
int a = 0; int a = 0;
} }

View file

@ -148,7 +148,7 @@ struct vertex_t
return p; return p;
} }
int Index() const; int Index() const { return vertexnum; }
void RecalcVertexHeights(); void RecalcVertexHeights();
@ -776,7 +776,7 @@ public:
sector_t *NextSpecialSector (int type, sector_t *prev) const; // [RH] sector_t *NextSpecialSector (int type, sector_t *prev) const; // [RH]
void RemoveForceField(); void RemoveForceField();
int Index() const; int Index() const { return sectornum; }
void AdjustFloorClip () const; void AdjustFloorClip () const;
void SetColor(PalEntry pe, int desat); void SetColor(PalEntry pe, int desat);
@ -1346,7 +1346,7 @@ struct side_t
vertex_t *V1() const; vertex_t *V1() const;
vertex_t *V2() const; vertex_t *V2() const;
int Index() const; int Index() const { return sidenum; }
}; };
enum AutomapLineStyle : int enum AutomapLineStyle : int
@ -1415,7 +1415,7 @@ struct line_t
inline int getPortalAlignment() const; inline int getPortalAlignment() const;
inline bool hitSkyWall(AActor* mo) const; inline bool hitSkyWall(AActor* mo) const;
int Index() const; int Index() const { return linenum; }
}; };
inline vertex_t *side_t::V1() const inline vertex_t *side_t::V1() const
@ -1491,7 +1491,7 @@ struct seg_t
float sidefrac; // relative position of seg's ending vertex on owning sidedef float sidefrac; // relative position of seg's ending vertex on owning sidedef
int segnum; int segnum;
int Index() const; int Index() const { return segnum; }
}; };
//extern seg_t *segs; //extern seg_t *segs;
@ -1538,7 +1538,7 @@ struct subsector_t
char hacked; // 1: is part of a render hack char hacked; // 1: is part of a render hack
void BuildPolyBSP(); void BuildPolyBSP();
int Index() const; int Index() const { return subsectornum; }
// 2: has one-sided walls // 2: has one-sided walls
FPortalCoverage portalcoverage[2]; FPortalCoverage portalcoverage[2];
}; };
@ -1569,7 +1569,7 @@ struct node_t
int intchildren[2]; // Used by nodebuilder. int intchildren[2]; // Used by nodebuilder.
}; };
int Index() const; int Index() const { return nodenum; }
}; };