- 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 (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)
{
@ -5396,12 +5396,12 @@ int MoveMissile(DBloodActor* actor)
if (cliptype == 4)
{
walltype* pWall = &wall[gHitInfo.hitwall];
if (pWall->extra > 0)
if (pWall->hasX())
{
XWALL* pXWall = &pWall->xw();
if (pXWall->triggerVector)
{
trTriggerWall(gHitInfo.hitwall, pXWall, kCmdWallImpact);
trTriggerWall(pWall, kCmdWallImpact);
if (!(pWall->cstat & 64))
{
cliptype = -1;
@ -5938,8 +5938,7 @@ static void actCheckExplosion()
for (auto& nWall : affectedXWalls)
{
XWALL* pXWall = &wall[nWall].xw();
trTriggerWall(nWall, pXWall, kCmdWallImpact);
trTriggerWall(&wall[nWall], kCmdWallImpact);
}
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;
assert(nWall >= 0 && nWall < kMaxWalls);
nSurf = surfType[wall[nWall].overpicnum];
if (wall[nWall].hasX())
auto pWall = &wall[nWall];
nSurf = surfType[pWall->overpicnum];
if (pWall->hasX())
{
XWALL* pXWall = &wall->xw();
if (pXWall->triggerVector)
trTriggerWall(nWall, pXWall, kCmdWallImpact);
if (pWall->xw().triggerVector)
trTriggerWall(pWall, kCmdWallImpact);
}
break;
}

View file

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

View file

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

View file

@ -56,10 +56,6 @@ extern int gBusyCount;
void trTriggerSector(unsigned int nSector, XSECTOR *pXSector, int command);
void trMessageSector(unsigned int nSector, EVENT event);
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 trTriggerSprite(DBloodActor* actor, int command);
void trMessageSprite(DBloodActor* actor, EVENT event);