- replaced numwalls with wall.Size in several places.

This commit is contained in:
Christoph Oelckers 2021-12-21 09:54:21 +01:00
parent 65bc6e6aef
commit f1c0298825
9 changed files with 14 additions and 17 deletions

View file

@ -79,7 +79,7 @@ static int32_t LoadMapHack(const char *filename, SpawnSpriteDef& sprites)
auto validateWall = [&]()
{
if (currentwall < 0 || currentwall >= numwalls)
if (currentwall < 0 || currentwall >= (int)wall.Size())
{
sc.ScriptMessage("Using %s without a valid wall", token.GetChars());
return false;
@ -89,7 +89,7 @@ static int32_t LoadMapHack(const char *filename, SpawnSpriteDef& sprites)
auto validateSector = [&]()
{
if (currentsector < 0 || currentsector >= numsectors)
if (currentsector < 0 || currentsector >= (int)sector.Size())
{
sc.ScriptMessage("Using %s without a valid sector", token.GetChars());
return false;

View file

@ -394,7 +394,7 @@ void allocateMapArrays(int numsprites)
sector.Resize(numsectors);
memset(sector.Data(), 0, sizeof(sectortype) * numsectors);
wall.Resize(numwalls);
memset(wall.Data(), 0, sizeof(walltype) * numwalls);
memset(wall.Data(), 0, sizeof(walltype) * wall.Size());
ClearAutomap();
}
@ -466,7 +466,7 @@ void loadMap(const char* filename, int flags, vec3_t* pos, int16_t* ang, int* cu
}
fr.Seek(wallpos, FileReader::SeekSet);
for (int i = 0; i < numwalls; i++)
for (unsigned i = 0; i < wall.Size(); i++)
{
switch (mapversion)
{

View file

@ -311,8 +311,6 @@ public:
HWLineToSpritePortal(FPortalSceneState* state, walltype* from, spritetype* to)
: HWLinePortal(state, &wall[numwalls]), origin(from), camera(to)
{
// todo: set up two fake walls at the end of the walls array to be used for backside clipping.
// Not really needed for vanilla support but maybe later for feature enhancement.
}
};

View file

@ -209,7 +209,7 @@ void DrawMirrors(int x, int y, int z, fixed_t a, fixed_t horiz, int smooth, int
{
case 0:
{
numwalls += 4; // hack alert. Blood adds some dummy walls and sectors that must not be among the counter, but here they have to be valid.
numwalls += 4; // hack alert. Blood adds some dummy walls and sectors that must not be among the counted, but here they have to be valid.
numsectors++;
int nWall = mirror[i].link;
walltype* pWall = &wall[nWall];
@ -328,14 +328,14 @@ void InitPolymostMirrorHack()
mirrorsector = numsectors;
for (int i = 0; i < 4; i++)
{
mirrorwall[i] = numwalls + i;
mirrorwall[i] = wall.Size() + i;
auto pWall = &(wall.Data()[mirrorwall[i]]);
pWall->picnum = 504;
pWall->overpicnum = 504;
pWall->cstat = 0;
pWall->nextsector = -1;
pWall->nextwall = -1;
pWall->point2 = numwalls + i + 1;
pWall->point2 = wall.Size() + i + 1;
}
wall.Data()[mirrorwall[3]].point2 = mirrorwall[0];
sector.Data()[mirrorsector].ceilingpicnum = 504;

View file

@ -272,7 +272,7 @@ void dbLoadMap(const char* pPath, int* pX, int* pY, int* pZ, short* pAngle, sect
if (encrypted)
{
fr.Read(&byte_19AE44, 128);
dbCrypt((char*)&byte_19AE44, 128, numwalls);
dbCrypt((char*)&byte_19AE44, 128, wall.Size());
byte_19AE44.numxsprites = LittleLong(byte_19AE44.numxsprites);
byte_19AE44.numxwalls = LittleLong(byte_19AE44.numxwalls);
@ -431,7 +431,7 @@ void dbLoadMap(const char* pPath, int* pX, int* pY, int* pZ, short* pAngle, sect
}
}
for (int i = 0; i < numwalls; i++)
for (unsigned i = 0; i < wall.Size(); i++)
{
walltype* pWall = &wall[i];
walltypedisk load;

View file

@ -65,7 +65,7 @@ void InitMirrors(void)
pWalli->cstat |= CSTAT_WALL_1WAY;
int tmp = pWalli->xw().data;
int j;
for (j = numwalls - 1; j >= 0; j--)
for (j = (int)wall.Size() - 1; j >= 0; j--)
{
if (j == i)
continue;

View file

@ -762,7 +762,7 @@ void DragPoint(walltype* pWall, int x, int y)
viewInterpolateWall(pWall);
pWall->move(x, y);
int vsi = numwalls;
int vsi = wall.Size();
auto prevWall = pWall;
do
{
@ -1965,7 +1965,6 @@ void trInit(TArray<DBloodActor*>& actors)
{
gBusy.Clear();
for(auto& wal : wall)
for (int i = 0; i < numwalls; i++)
{
wal.baseWall.x = wal.x;
wal.baseWall.y = wal.y;

View file

@ -951,9 +951,9 @@ void DoWall(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor, i
{
auto lValue = GetGameVarID(lVar2, sActor, sPlayer).safeValue();
auto vWall = GetGameVarID(lVar1, sActor, sPlayer);
auto iWall = vWall.safeValue();
iWall = vWall.safeValue();
if (iWall < 0 || iWall >= numwalls || vWall.isActor())
if (iWall < 0 || iWall >= (int)wall.Size() || vWall.isActor())
{
if (!bSet) SetGameVarID(lVar2, 0, sActor, sPlayer);
return;

View file

@ -335,7 +335,7 @@ void DrawView(double smoothRatio, bool sceneonly)
if (nFreeze != 3)
{
TArray<uint8_t> paldata(numsectors * 2 + numwalls, true);
TArray<uint8_t> paldata(sector.Size() * 2 + wall.Size(), true);
int const viewingRange = viewingrange;
int const vr = xs_CRoundToInt(65536. * tan(r_fov * (pi::pi() / 360.)));