- some simple xwall[] replacements.

This commit is contained in:
Christoph Oelckers 2021-11-19 01:13:33 +01:00
parent 70da9e2526
commit 4cfc1577e2
9 changed files with 45 additions and 45 deletions

View file

@ -4906,7 +4906,7 @@ void MoveDude(DBloodActor* actor)
int nHitWall = coll.index;
walltype* pHitWall = &wall[nHitWall];
XWALL* pHitXWall = nullptr;
if (pHitWall->extra > 0) pHitXWall = &xwall[pHitWall->extra];
if (pHitWall->extra > 0) pHitXWall = &pHitWall->xw();
if (pDudeInfo->lockOut && pHitXWall && pHitXWall->triggerPush && !pHitXWall->key && !pHitXWall->dudeLockout && !pHitXWall->state && !pHitXWall->busy && !pPlayer)
trTriggerWall(nHitWall, pHitXWall, kCmdWallPush);
@ -5398,7 +5398,7 @@ int MoveMissile(DBloodActor* actor)
walltype* pWall = &wall[gHitInfo.hitwall];
if (pWall->extra > 0)
{
XWALL* pXWall = &xwall[pWall->extra];
XWALL* pXWall = &pWall->xw();
if (pXWall->triggerVector)
{
trTriggerWall(gHitInfo.hitwall, pXWall, kCmdWallImpact);
@ -5938,7 +5938,7 @@ static void actCheckExplosion()
for (auto& nWall : affectedXWalls)
{
XWALL* pXWall = &xwall[wall[nWall].extra];
XWALL* pXWall = &wall[nWall].xw();
trTriggerWall(nWall, pXWall, kCmdWallImpact);
}
@ -6950,10 +6950,9 @@ void actFireVector(DBloodActor* shooter, int a2, int a3, int a4, int a5, int a6,
int nWall = gHitInfo.hitwall;
assert(nWall >= 0 && nWall < kMaxWalls);
nSurf = surfType[wall[nWall].overpicnum];
int nXWall = wall[nWall].extra;
if (nXWall > 0)
if (wall[nWall].hasX())
{
XWALL* pXWall = &xwall[nXWall];
XWALL* pXWall = &wall->xw();
if (pXWall->triggerVector)
trTriggerWall(nWall, pXWall, kCmdWallImpact);
}

View file

@ -804,7 +804,7 @@ static void unicultThinkChase(DBloodActor* actor)
case 0:
case 4:
pHWall = &wall[gHitInfo.hitwall];
if (xwallRangeIsFine(pHWall->extra)) pXHWall = &xwall[pHWall->extra];
if (pHWall->hasX()) pXHWall = &pHWall->xw();
hscn = (pHWall->cstat & CSTAT_WALL_BLOCK_HITSCAN); blck = (pHWall->cstat & CSTAT_WALL_BLOCK);
break;
}

View file

@ -52,14 +52,17 @@ static int GetBucketChannel(const RXBUCKET* pBucket)
switch (pBucket->type)
{
case SS_SECTOR:
nXIndex = sector[pBucket->rxindex].extra;
assert(nXIndex > 0);
return xsector[nXIndex].rxID;
{
auto pSector = &sector[pBucket->rxindex];
assert(pSector->hasX());
return pSector->xs().rxID;
}
case SS_WALL:
nXIndex = wall[pBucket->rxindex].extra;
assert(nXIndex > 0);
return xwall[nXIndex].rxID;
{
auto pWall = &wall[pBucket->rxindex];
assert(pWall->hasX());
return pWall->xw().rxID;
}
case SS_SPRITE:
return pBucket->GetActor()? pBucket->GetActor()->x().rxID : 0;

View file

@ -796,7 +796,7 @@ BitArray GetClosestSpriteSectors(int nSector, int x, int y, int nDist, TArray<in
search.Add(nNextSector);
if (pWalls && wal.extra > 0)
{
XWALL *pXWall = &xwall[wal.extra];
XWALL* pXWall = &wal.xw();
if (pXWall->triggerVector && !pXWall->isTriggered && !pXWall->state)
pWalls->Push(wallnum(&wal));
}

View file

@ -62,7 +62,7 @@ void InitMirrors(void)
mirror[mirrorcnt].wallnum = i;
mirror[mirrorcnt].type = 0;
wall[i].cstat |= 32;
int tmp = xwall[wall[i].extra].data;
int tmp = wall[i].xw().data;
int j;
for (j = numwalls - 1; j >= 0; j--)
{
@ -70,7 +70,7 @@ void InitMirrors(void)
continue;
if (wall[j].extra > 0 && GetWallType(i) == kWallStack)
{
if (tmp != xwall[wall[j].extra].data)
if (tmp != wall[j].xw().data)
continue;
wall[i].hitag = j;
wall[j].hitag = i;

View file

@ -461,8 +461,8 @@ void nnExtTriggerObject(int objType, int objIndex, DBloodActor* objActor, int co
trTriggerSector(objIndex, &xsector[sector[objIndex].extra], command);
break;
case OBJ_WALL:
if (!xwallRangeIsFine(wall[objIndex].extra)) break;
trTriggerWall(objIndex, &xwall[wall[objIndex].extra], command);
if (wall[objIndex].hasX())
trTriggerWall(objIndex, &wall[objIndex].xw(), command);
break;
case OBJ_SPRITE:
if (!objActor || !objActor->hasX()) break;
@ -860,13 +860,12 @@ void nnExtInitModernStuff()
pCond->obj[count++].cmd = xsector[i].command;
}
for (int i = 0; i < kMaxXWalls; i++)
for(auto& wal : walls())
{
if (!wallRangeIsFine(xwall[i].reference) || xwall[i].txID != pXSprite->rxID)
if (!wal.hasX() || wal.xw().txID != pXSprite->rxID)
continue;
walltype* pWall = &wall[xwall[i].reference];
switch (pWall->type) {
switch (wal.type) {
case kSwitchToggle: // exceptions
case kSwitchOneWay: // exceptions
continue;
@ -876,9 +875,9 @@ void nnExtInitModernStuff()
condError(iactor, "Max(%d) objects to track reached for condition #%d, RXID: %d!");
pCond->obj[count].type = OBJ_WALL;
pCond->obj[count].index_ = xwall[i].reference;
pCond->obj[count].index_ = wallnum(&wal);
pCond->obj[count].actor = nullptr;
pCond->obj[count++].cmd = xwall[i].command;
pCond->obj[count++].cmd = wal.xw().command;
}
if (pXSprite->data1 > kCondGameMax && count == 0)
@ -3939,7 +3938,7 @@ bool condCheckMixed(DBloodActor* aCond, const EVENT& event, int cmpOp, bool PUSH
return condCmp(0, arg1, arg2, cmpOp);
auto pObj = &wall[objIndex];
XWALL* pXObj = &xwall[pObj->extra];
XWALL* pXObj = &pObj->xw();
switch (cond)
{
case 41: return condCmp(pXObj->data, arg1, arg2, cmpOp);
@ -4159,7 +4158,6 @@ bool condCheckWall(DBloodActor* aCond, int cmpOp, bool PUSH)
condError(aCond, "Object #%d (objType: %d) is not a wall!", objIndex, objType);
walltype* pWall = &wall[objIndex];
//XWALL* pXWall = (xwallRangeIsFine(pWall->extra)) ? &xwall[pWall->extra] : NULL;
if (cond < (kCondRange >> 1))
{
@ -7439,8 +7437,8 @@ int getDataFieldOfObject(int objType, int objIndex, DBloodActor* actor, int data
case 4: return actor->x().data4;
default: return data;
}
case OBJ_SECTOR: return xsector[sector[objIndex].extra].data;
case OBJ_WALL: return xwall[wall[objIndex].extra].data;
case OBJ_SECTOR: return sector[objIndex].xs().data;
case OBJ_WALL: return wall[objIndex].xw().data;
default: return data;
}
}
@ -7522,10 +7520,10 @@ bool setDataValueOfObject(int objType, int objIndex, DBloodActor* objActor, int
}
}
case OBJ_SECTOR:
xsector[sector[objIndex].extra].data = value;
sector[objIndex].xs().data = value;
return true;
case OBJ_WALL:
xwall[wall[objIndex].extra].data = value;
wall[objIndex].xw().data = value;
return true;
default:
return false;

View file

@ -1288,7 +1288,7 @@ int ActionScan(PLAYER *pPlayer, int *pIndex, int *pXIndex, DBloodActor** pAct)
case 4:
*pIndex = gHitInfo.hitwall;
*pXIndex = wall[*pIndex].extra;
if (*pXIndex > 0 && xwall[*pXIndex].triggerPush)
if (*pXIndex > 0 && wall[*pIndex].xw().triggerPush)
return 0;
if (wall[*pIndex].nextsector >= 0)
{

View file

@ -353,17 +353,17 @@ void InitSectorFX(void)
}
}
}
for (int i = 0; i < numwalls; i++)
for(auto& wal : walls())
{
int nXWall = wall[i].extra;
int nXWall = wal.extra;
if (nXWall > 0)
{
XWALL *pXWall = &xwall[nXWall];
if (pXWall->panXVel || pXWall->panYVel)
{
wallPanList[wallPanCount++] = nXWall;
if (pXWall->panXVel) StartInterpolation(i, Interp_Wall_PanX);
if (pXWall->panXVel) StartInterpolation(i, Interp_Wall_PanY);
if (pXWall->panXVel) StartInterpolation(wallnum(&wal), Interp_Wall_PanX);
if (pXWall->panXVel) StartInterpolation(wallnum(&wal), Interp_Wall_PanY);
}
}
}

View file

@ -1800,11 +1800,13 @@ void trMessageSector(unsigned int nSector, EVENT event) {
}
}
void trMessageWall(unsigned int nWall, EVENT event) {
assert(nWall < (unsigned int)numwalls);
assert(wall[nWall].extra > 0 && wall[nWall].extra < kMaxXWalls);
void trMessageWall(unsigned int nWall, EVENT event)
{
assert(validWallIndex(nWall));
auto pWall = &wall[nWall];
assert(pWall->hasX());
XWALL *pXWall = &xwall[wall[nWall].extra];
XWALL *pXWall = &pWall->xw();
if (!pXWall->locked || event.cmd == kCmdUnlock || event.cmd == kCmdToggleLock) {
switch (event.cmd) {
case kCmdLink:
@ -2012,13 +2014,11 @@ void trInit(void)
actor->basePoint = spr->pos;
}
}
for (int i = 0; i < numwalls; i++)
for(auto& wal : walls())
{
int nXWall = wall[i].extra;
assert(nXWall < kMaxXWalls);
if (nXWall > 0)
if (wal.hasX())
{
XWALL *pXWall = &xwall[nXWall];
XWALL *pXWall = &wal.xw();
if (pXWall->state)
pXWall->busy = 65536;
}