- ActionScan internals cleaned up.

This commit is contained in:
Christoph Oelckers 2021-11-29 17:40:35 +01:00
parent 1a8cf9b2f9
commit 2e8e5544c5

View file

@ -1238,7 +1238,6 @@ void CheckPickUp(PLAYER *pPlayer)
int ActionScan(PLAYER *pPlayer, int *pIndex, DBloodActor** pAct) int ActionScan(PLAYER *pPlayer, int *pIndex, DBloodActor** pAct)
{ {
int xx = 0; int* pXIndex = &xx;
*pIndex = 0; *pIndex = 0;
*pAct = nullptr; *pAct = nullptr;
spritetype *pSprite = pPlayer->pSprite; spritetype *pSprite = pPlayer->pSprite;
@ -1286,30 +1285,33 @@ int ActionScan(PLAYER *pPlayer, int *pIndex, DBloodActor** pAct)
} }
case 0: case 0:
case 4: case 4:
{
auto pWall = &wall[gHitInfo.hitwall];
*pIndex = gHitInfo.hitwall; *pIndex = gHitInfo.hitwall;
*pXIndex = wall[*pIndex].extra; if (pWall->hasX() && pWall->xw().triggerPush)
if (*pXIndex > 0 && wall[*pIndex].xw().triggerPush)
return 0; return 0;
if (wall[*pIndex].nextsector >= 0) if (pWall->twoSided())
{ {
*pIndex = wall[*pIndex].nextsector; auto sect = pWall->nextSector();
*pXIndex = sector[*pIndex].extra; *pIndex = sectnum(sect);
if (*pXIndex > 0 && xsector[*pXIndex].Wallpush) if (sect->hasX() && sect->xs().Wallpush)
return 6; return 6;
} }
break; break;
}
case 1: case 1:
case 2: case 2:
{
auto pSector = &sector[gHitInfo.hitsect];
*pIndex = gHitInfo.hitsect; *pIndex = gHitInfo.hitsect;
*pXIndex = sector[*pIndex].extra; if (pSector->hasX() && pSector->xs().Push)
if (*pXIndex > 0 && xsector[*pXIndex].Push)
return 6; return 6;
break; break;
} }
}
} }
*pIndex = pSprite->sectnum; *pIndex = pSprite->sectnum;
*pXIndex = sector[*pIndex].extra; if (pSprite->sector()->hasX() && pSprite->sector()->xs().Push)
if (*pXIndex > 0 && xsector[*pXIndex].Push)
return 6; return 6;
return -1; return -1;
} }