mirror of
https://github.com/ZDoom/Raze.git
synced 2025-05-31 01:11:15 +00:00
- final cleanup of sectnum related stuff.
Made sure that remaining uses of sector indices are safe to be kept and deleted a few redundant functions.
This commit is contained in:
parent
6d432fca0a
commit
838bed7800
10 changed files with 38 additions and 63 deletions
|
@ -300,6 +300,21 @@ void checkRotatedWalls()
|
|||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// check if two sectors share a wall connection
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
bool sectorsConnected(int sect1, int sect2)
|
||||
{
|
||||
for (auto& wal : wallsofsector(sect1))
|
||||
{
|
||||
if (wal.nextsector == sect2) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// vector serializers
|
||||
|
|
|
@ -128,6 +128,7 @@ void GetWallSpritePosition(const tspritetype* spr, vec2_t pos, vec2_t* out, bool
|
|||
void GetFlatSpritePosition(const tspritetype* spr, vec2_t pos, vec2_t* out, bool render = false);
|
||||
void GetFlatSpritePosition(const spritetype* spr, vec2_t pos, vec2_t* out, bool render = false);
|
||||
void checkRotatedWalls();
|
||||
bool sectorsConnected(int sect1, int sect2);
|
||||
|
||||
// y is negated so that the orientation is the same as in GZDoom, in order to use its utilities.
|
||||
// The render code should NOT use Build coordinates for anything!
|
||||
|
@ -319,11 +320,6 @@ inline double SquareDistToWall(double px, double py, const walltype* wal)
|
|||
return SquareDist(px, py, lx1 + t * (lx2 - lx1), ly1 + t * (ly2 - ly1));
|
||||
}
|
||||
|
||||
inline int inside(int x, int y, sectortype* sect)
|
||||
{
|
||||
return inside(x, y, sectnum(sect));
|
||||
}
|
||||
|
||||
inline void dragpoint(walltype* pointhighlight, int32_t dax, int32_t day)
|
||||
{
|
||||
dragpoint(wallnum(pointhighlight), dax, day);
|
||||
|
@ -344,10 +340,3 @@ inline void updatesectorneighbor(int32_t const x, int32_t const y, sectortype* *
|
|||
updatesectorneighbor(x, y, §no, maxDistance);
|
||||
*sect = sectno < 0? nullptr : §or[sectno];
|
||||
}
|
||||
|
||||
|
||||
|
||||
inline int findwallbetweensectors(sectortype* sect1, sectortype* sect2)
|
||||
{
|
||||
return findwallbetweensectors(sectnum(sect1), sectnum(sect2));
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ void hw_BuildSections()
|
|||
{
|
||||
// Fix maps which do not set their wallptr to the first wall. Lo Wang In Time's map 11 is such a case.
|
||||
int wp = sector[i].wallptr;
|
||||
while (wp > 0 && wall[wp - 1].nextwall >= 0 && wall[wall[wp - 1].nextwall].nextsector == i)
|
||||
while (wp > 0 && wall[wp - 1].nextwall >= 0 && wall[wp - 1].nextWall()->nextsector == i)
|
||||
{
|
||||
sector[i].wallptr--;
|
||||
sector[i].wallnum++;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#pragma once
|
||||
#include "build.h"
|
||||
#include "gamefuncs.h"
|
||||
|
||||
class FSerializer;
|
||||
struct IntRect;
|
||||
|
@ -56,7 +57,7 @@ inline void mergePortals()
|
|||
{
|
||||
for (unsigned t = 0; t < pt2.targets.Size(); t++)
|
||||
{
|
||||
if (findwallbetweensectors(pt1.targets[s], pt2.targets[t]) >= 0)
|
||||
if (sectorsConnected(pt1.targets[s], pt2.targets[t]))
|
||||
{
|
||||
pt1.targets.Append(pt2.targets);
|
||||
pt2.targets.Reset();
|
||||
|
|
|
@ -54,7 +54,7 @@ static FVector3 CalcNormal(sectortype* sector, int plane)
|
|||
{
|
||||
FVector3 pt[3];
|
||||
|
||||
auto wal = &wall[sector->wallptr];
|
||||
auto wal = sector->firstWall();
|
||||
auto wal2 = wal->point2Wall();
|
||||
|
||||
pt[0] = { (float)WallStartX(wal), (float)WallStartY(wal), 0 };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue