- several smaller places.

This gets rid of the less frequent names to look for.
This commit is contained in:
Christoph Oelckers 2021-11-23 23:04:21 +01:00
parent 063e3fb34e
commit 96b6bb21ef
7 changed files with 47 additions and 50 deletions

View file

@ -3840,7 +3840,6 @@ void actHitcodeToData(int a1, HITINFO* pHitInfo, DBloodActor** pActor, walltype*
{
assert(pHitInfo != nullptr);
DBloodActor* actor = nullptr;
int nWall = -1;
walltype* pWall = nullptr;
switch (a1)
{
@ -4899,7 +4898,7 @@ void MoveDude(DBloodActor* actor)
if (pDudeInfo->lockOut && pHitXWall && pHitXWall->triggerPush && !pHitXWall->key && !pHitXWall->dudeLockout && !pHitXWall->state && !pHitXWall->busy && !pPlayer)
trTriggerWall(pHitWall, kCmdWallPush);
if (pHitWall->nextsector != -1)
if (pHitWall->twoSided())
{
sectortype* pHitSector = pHitWall->nextSector();
XSECTOR* pHitXSector = pHitSector->hasX()? &pHitSector->xs() : nullptr;
@ -6821,7 +6820,7 @@ bool actCanSplatWall(walltype* pWall)
int nType = pWall->type;
if (nType >= kWallBase && nType < kWallMax) return 0;
if (pWall->nextsector != -1)
if (pWall->twoSided())
{
sectortype* pSector = pWall->nextSector();
if (pSector->type >= kSectorBase && pSector->type < kSectorMax) return 0;

View file

@ -49,13 +49,13 @@ bool FindSector(int nX, int nY, int nZ, int *nSector)
}
for (auto& wal : wallsofsector(*nSector))
{
int nOSector = wal.nextsector;
if (nOSector >= 0 && inside(nX, nY, nOSector))
auto pOSector = wal.nextSector();
if (pOSector != nullptr && inside(nX, nY, pOSector))
{
getzsofslope(nOSector, nX, nY, &nZCeil, &nZFloor);
getzsofslopeptr(pOSector, nX, nY, &nZCeil, &nZFloor);
if (nZ >= nZCeil && nZ <= nZFloor)
{
*nSector = nOSector;
*nSector = sectnum(pOSector);
return 1;
}
}
@ -84,10 +84,10 @@ bool FindSector(int nX, int nY, int *nSector)
}
for (auto& wal : wallsofsector(*nSector))
{
int nOSector = wal.nextsector;
if (nOSector >= 0 && inside(nX, nY, nOSector))
auto pOSector = wal.nextSector();
if (pOSector != nullptr && inside(nX, nY, pOSector))
{
*nSector = nOSector;
*nSector = sectnum(pOSector);
return 1;
}
}
@ -368,7 +368,7 @@ int HitScan(DBloodActor *actor, int z, int dx, int dy, int dz, unsigned int nMas
{
auto pWall = gHitInfo.hitWall;
if (pWall->nextsector == -1)
if (!pWall->twoSided())
return 0;
int nZCeil, nZFloor;
getzsofslopeptr(pWall->nextSector(), gHitInfo.hitx, gHitInfo.hity, &nZCeil, &nZFloor);
@ -724,19 +724,19 @@ BitArray GetClosestSpriteSectors(int nSector, int x, int y, int nDist, TArray<wa
sectorMap.Set(nSector);
double nDist4sq = 256. * nDist * nDist; // (nDist * 16)^2 - * 16 to account for Build's 28.4 fixed point format.
BFSSearch search(numsectors, nSector);
BFSSectorSearch search(&sector[nSector]);
for (unsigned nCurSector; (nCurSector = search.GetNext()) != BFSSearch::EOL;)
while (auto pCurSector = search.GetNext())
{
for (auto& wal : wallsofsector(nCurSector))
for (auto& wal : wallsofsector(pCurSector))
{
const int nNextSector = wal.nextsector;
if (nNextSector < 0) // if next wall isn't linked to a sector, skip
continue;
if (!wal.twoSided()) continue;
const auto pNextSector = wal.nextSector();
bool withinRange = false;
if (!newSectCheckMethod) // original method
{
if (search.Check(nNextSector)) // if we've already checked this sector, skip. This is bad, therefore only in compat mode.
if (search.Check(pNextSector)) // if we've already checked this sector, skip. This is bad, therefore only in compat mode.
continue;
withinRange = CheckProximityWall(wal.point2Wall(), x, y, nDist);
}
@ -747,8 +747,8 @@ BitArray GetClosestSpriteSectors(int nSector, int x, int y, int nDist, TArray<wa
}
if (withinRange) // if new sector is within range, add it to the processing queue
{
sectorMap.Set(nNextSector);
search.Add(nNextSector);
sectorMap.Set(sectnum(pNextSector));
search.Add(pNextSector);
if (pWalls && wal.hasX())
{
XWALL* pXWall = &wal.xw();

View file

@ -56,7 +56,7 @@ bool FindSector(int nX, int nY, int nZ, int *nSector);
bool FindSector(int nX, int nY, int *nSector);
bool CheckProximity(DBloodActor *pSprite, int nX, int nY, int nZ, int nSector, int nDist);
bool CheckProximityPoint(int nX1, int nY1, int nZ1, int nX2, int nY2, int nZ2, int nDist);
bool CheckProximityWall(walltype* nWall, int x, int y, int nDist);
bool CheckProximityWall(walltype* pWall, int x, int y, int nDist);
int GetWallAngle(walltype* pWall);
void GetWallNormal(walltype* pWall, int *pX, int *pY);
bool IntersectRay(int wx, int wy, int wdx, int wdy, int x1, int y1, int z1, int x2, int y2, int z2, int *ix, int *iy, int *iz);

View file

@ -3550,7 +3550,7 @@ void useSeqSpawnerGen(DBloodActor* sourceactor, int objType, sectortype* pSector
if (pXSource->data3 == 3 || pXSource->data3 == 2) {
if (pWall->nextwall < 0) {
if (!pWall->twoSided()) {
if (pXSource->data3 == 3)
seqSpawn(pXSource->data2, SS_WALL, pWall, -1);
@ -4122,7 +4122,7 @@ bool condCheckWall(DBloodActor* aCond, int cmpOp, bool PUSH)
else if (PUSH) condPush(aCond, pWall->nextSector());
return true;
case 20:
if (!validWallIndex(pWall->nextwall)) return false;
if (!pWall->twoSided()) return false;
else if (PUSH) condPush(aCond, pWall->nextWall());
return true;
case 25: // next wall belongs to sector? (Note: This was 'sector of next wall' which is same as case 15 because we do not allow bad links!)
@ -5974,9 +5974,8 @@ bool modernTypeOperateSprite(DBloodActor* actor, const EVENT& event)
//
//---------------------------------------------------------------------------
bool modernTypeOperateWall(int nWall, walltype* pWall, XWALL* pXWall, EVENT event)
bool modernTypeOperateWall(walltype* pWall, const EVENT& event)
{
switch (pWall->type)
{
case kSwitchOneWay:
@ -5988,7 +5987,7 @@ bool modernTypeOperateWall(int nWall, walltype* pWall, XWALL* pXWall, EVENT even
SetWallState(pWall, 1);
break;
default:
SetWallState(pWall, pXWall->restState ^ 1);
SetWallState(pWall, pWall->xw().restState ^ 1);
break;
}
return true;

View file

@ -334,7 +334,7 @@ void trPlayerCtrlStopScene(PLAYER* pPlayer);
void modernTypeTrigger(int type, sectortype*sect, walltype* wal, DBloodActor* actor, const EVENT& event);
bool modernTypeOperateSector(int nSector, sectortype* pSector, XSECTOR* pXSector, const EVENT& event);
bool modernTypeOperateSprite(DBloodActor*, const EVENT& event);
bool modernTypeOperateWall(int nWall, walltype* pWall, XWALL* pXWall, EVENT event);
bool modernTypeOperateWall(walltype* pWall, const EVENT& event);
void modernTypeSendCommand(DBloodActor* nSprite, int channel, COMMAND_ID command);
// ------------------------------------------------------------------------- //
bool playerSizeShrink(PLAYER* pPlayer, int divider);

View file

@ -402,9 +402,9 @@ static void fakeMoveDude(spritetype *pSprite)
{
int nHitWall = predict.at75.hit.index;
walltype *pHitWall = &wall[nHitWall];
if (pHitWall->nextsector != -1)
if (pHitWall->twoSided())
{
sectortype *pHitSector = &sector[pHitWall->nextsector];
sectortype *pHitSector = &pHitWall->nextSector();
if (top < pHitSector->ceilingz || bottom > pHitSector->floorz)
{
// ???

View file

@ -616,8 +616,8 @@ void OperateSprite(DBloodActor* actor, EVENT event)
void SetupGibWallState(walltype *pWall, XWALL *pXWall)
{
walltype *pWall2 = NULL;
if (pWall->nextwall >= 0)
pWall2 = &wall[pWall->nextwall];
if (pWall->twoSided())
pWall2 = pWall->nextWall();
if (pXWall->state)
{
pWall->cstat &= ~65;
@ -659,7 +659,7 @@ void OperateWall(walltype* pWall, EVENT event) {
}
#ifdef NOONE_EXTENSIONS
if (gModernMap && modernTypeOperateWall(wallnum(pWall), pWall, pXWall, event))
if (gModernMap && modernTypeOperateWall(pWall, event))
return;
#endif
@ -775,7 +775,7 @@ void DragPoint(walltype* pWall, int x, int y)
auto prevWall = pWall;
do
{
if (prevWall->nextwall >= 0)
if (prevWall->twoSided())
{
prevWall = prevWall->nextWall()->point2Wall();
prevWall->sectorp()->dirty = 255;
@ -789,7 +789,7 @@ void DragPoint(walltype* pWall, int x, int y)
do
{
auto lw = lastwall(prevWall);
if (lw->nextwall >= 0)
if (lw->twoSided())
{
prevWall = lw->nextWall();
prevWall->sectorp()->dirty = 255;
@ -1704,12 +1704,12 @@ void LinkSprite(DBloodActor* actor, EVENT event)
}
}
void LinkWall(int nWall, XWALL *pXWall, EVENT event)
void LinkWall(walltype* pWall, const EVENT& event)
{
int nBusy = GetSourceBusy(event);
pXWall->busy = nBusy;
if ((pXWall->busy & 0xffff) == 0)
SetWallState(&wall[nWall], FixedToInt(nBusy));
pWall->xw().busy = nBusy;
if ((pWall->xw().busy & 0xffff) == 0)
SetWallState(pWall, FixedToInt(nBusy));
}
void trTriggerSector(sectortype* pSector, int command)
@ -1806,7 +1806,7 @@ void trMessageWall(walltype* pWall, const EVENT& event)
{
switch (event.cmd) {
case kCmdLink:
LinkWall(wallnum(pWall), pXWall, event);
LinkWall(pWall, event);
break;
#ifdef NOONE_EXTENSIONS
case kCmdModernUse:
@ -1925,22 +1925,21 @@ void ProcessMotion(void)
void AlignSlopes(void)
{
sectortype *pSector;
int nSector;
for (pSector = &sector[0], nSector = 0; nSector < numsectors; nSector++, pSector++)
for(auto& sect : sectors())
{
if (pSector->slopewallofs)
if (sect.slopewallofs)
{
walltype *pWall = &wall[pSector->wallptr+pSector->slopewallofs];
walltype *pWall2 = &wall[pWall->point2];
int nNextSector = pWall->nextsector;
if (nNextSector >= 0)
walltype *pWall = sect.firstWall() + sect.slopewallofs;
walltype *pWall2 = pWall->point2Wall();
if (pWall->twoSided())
{
auto pNextSector = pWall->nextSector();
int x = (pWall->x+pWall2->x)/2;
int y = (pWall->y+pWall2->y)/2;
viewInterpolateSector(pSector);
alignflorslope(nSector, x, y, getflorzofslope(nNextSector, x, y));
alignceilslope(nSector, x, y, getceilzofslope(nNextSector, x, y));
viewInterpolateSector(&sect);
alignflorslope(&sect, x, y, getflorzofslopeptr(pNextSector, x, y));
alignceilslope(&sect, x, y, getceilzofslopeptr(pNextSector, x, y));
}
}
}