- cleanup of trTriggerWall's API.

This commit is contained in:
Christoph Oelckers 2021-11-19 15:46:20 +01:00
parent 59312c42bb
commit c182900425
5 changed files with 14 additions and 18 deletions

View file

@ -4909,7 +4909,7 @@ void MoveDude(DBloodActor* actor)
if (pHitWall->extra > 0) pHitXWall = &pHitWall->xw(); if (pHitWall->extra > 0) pHitXWall = &pHitWall->xw();
if (pDudeInfo->lockOut && pHitXWall && pHitXWall->triggerPush && !pHitXWall->key && !pHitXWall->dudeLockout && !pHitXWall->state && !pHitXWall->busy && !pPlayer) if (pDudeInfo->lockOut && pHitXWall && pHitXWall->triggerPush && !pHitXWall->key && !pHitXWall->dudeLockout && !pHitXWall->state && !pHitXWall->busy && !pPlayer)
trTriggerWall(nHitWall, pHitXWall, kCmdWallPush); trTriggerWall(pHitWall, kCmdWallPush);
if (pHitWall->nextsector != -1) if (pHitWall->nextsector != -1)
{ {
@ -5396,12 +5396,12 @@ int MoveMissile(DBloodActor* actor)
if (cliptype == 4) if (cliptype == 4)
{ {
walltype* pWall = &wall[gHitInfo.hitwall]; walltype* pWall = &wall[gHitInfo.hitwall];
if (pWall->extra > 0) if (pWall->hasX())
{ {
XWALL* pXWall = &pWall->xw(); XWALL* pXWall = &pWall->xw();
if (pXWall->triggerVector) if (pXWall->triggerVector)
{ {
trTriggerWall(gHitInfo.hitwall, pXWall, kCmdWallImpact); trTriggerWall(pWall, kCmdWallImpact);
if (!(pWall->cstat & 64)) if (!(pWall->cstat & 64))
{ {
cliptype = -1; cliptype = -1;
@ -5938,8 +5938,7 @@ static void actCheckExplosion()
for (auto& nWall : affectedXWalls) for (auto& nWall : affectedXWalls)
{ {
XWALL* pXWall = &wall[nWall].xw(); trTriggerWall(&wall[nWall], kCmdWallImpact);
trTriggerWall(nWall, pXWall, kCmdWallImpact);
} }
BloodStatIterator it1(kStatDude); BloodStatIterator it1(kStatDude);
@ -6949,12 +6948,12 @@ void actFireVector(DBloodActor* shooter, int a2, int a3, int a4, int a5, int a6,
{ {
int nWall = gHitInfo.hitwall; int nWall = gHitInfo.hitwall;
assert(nWall >= 0 && nWall < kMaxWalls); assert(nWall >= 0 && nWall < kMaxWalls);
nSurf = surfType[wall[nWall].overpicnum]; auto pWall = &wall[nWall];
if (wall[nWall].hasX()) nSurf = surfType[pWall->overpicnum];
if (pWall->hasX())
{ {
XWALL* pXWall = &wall->xw(); if (pWall->xw().triggerVector)
if (pXWall->triggerVector) trTriggerWall(pWall, kCmdWallImpact);
trTriggerWall(nWall, pXWall, kCmdWallImpact);
} }
break; break;
} }

View file

@ -461,8 +461,7 @@ void nnExtTriggerObject(int objType, int objIndex, DBloodActor* objActor, int co
trTriggerSector(objIndex, &xsector[sector[objIndex].extra], command); trTriggerSector(objIndex, &xsector[sector[objIndex].extra], command);
break; break;
case OBJ_WALL: case OBJ_WALL:
if (wall[objIndex].hasX()) trTriggerWall(&wall[objIndex], command);
trTriggerWall(objIndex, &wall[objIndex].xw(), command);
break; break;
case OBJ_SPRITE: case OBJ_SPRITE:
if (!objActor || !objActor->hasX()) break; if (!objActor || !objActor->hasX()) break;

View file

@ -1531,7 +1531,8 @@ void ProcessInput(PLAYER *pPlayer)
break; break;
case 0: case 0:
{ {
XWALL *pXWall = &xwall[a3]; auto pWall = &wall[a2];
auto pXWall = &pWall->xw();
int key = pXWall->key; int key = pXWall->key;
if (pXWall->locked && pPlayer == gMe) if (pXWall->locked && pPlayer == gMe)
{ {
@ -1542,7 +1543,7 @@ void ProcessInput(PLAYER *pPlayer)
sndStartSample(snd, 255, 2, 0); sndStartSample(snd, 255, 2, 0);
} }
if (!key || pPlayer->hasKey[key]) if (!key || pPlayer->hasKey[key])
trTriggerWall(a2, pXWall, kCmdWallPush); trTriggerWall(pWall, kCmdWallPush);
else if (pPlayer == gMe) else if (pPlayer == gMe)
{ {
viewSetMessage(GStrings("TXTB_KEY")); viewSetMessage(GStrings("TXTB_KEY"));

View file

@ -1738,6 +1738,7 @@ void trTriggerSector(unsigned int nSector, XSECTOR *pXSector, int command) {
void trTriggerWall(walltype* pWall, int command) void trTriggerWall(walltype* pWall, int command)
{ {
if (!pWall->hasX()) return;
auto pXWall = &pWall->xw(); auto pXWall = &pWall->xw();
if (!pXWall->locked && !pXWall->isTriggered) { if (!pXWall->locked && !pXWall->isTriggered) {

View file

@ -56,10 +56,6 @@ extern int gBusyCount;
void trTriggerSector(unsigned int nSector, XSECTOR *pXSector, int command); void trTriggerSector(unsigned int nSector, XSECTOR *pXSector, int command);
void trMessageSector(unsigned int nSector, EVENT event); void trMessageSector(unsigned int nSector, EVENT event);
void trTriggerWall(walltype*, int command); void trTriggerWall(walltype*, int command);
inline void trTriggerWall(unsigned int nWall, XWALL* pXWall, int command)
{
trTriggerWall(&wall[nWall], command);
}
void trMessageWall(unsigned int nWall, EVENT event); void trMessageWall(unsigned int nWall, EVENT event);
void trTriggerSprite(DBloodActor* actor, int command); void trTriggerSprite(DBloodActor* actor, int command);
void trMessageSprite(DBloodActor* actor, EVENT event); void trMessageSprite(DBloodActor* actor, EVENT event);