From f0c74981fe0daa3d13818b3812f705e7244b00eb Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 23 Nov 2021 18:19:25 +0100 Subject: [PATCH] - use the new RXBUCKET interface for nnext's wind code. --- source/games/blood/src/aiunicult.cpp | 2 +- source/games/blood/src/nnexts.cpp | 30 +++++++++++++++------------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/source/games/blood/src/aiunicult.cpp b/source/games/blood/src/aiunicult.cpp index 01c9f0f38..7abaf5f53 100644 --- a/source/games/blood/src/aiunicult.cpp +++ b/source/games/blood/src/aiunicult.cpp @@ -1492,7 +1492,7 @@ DBloodActor* getNextIncarnation(DBloodActor* actor) XSPRITE* pXSprite = &actor->x(); for (int i = bucketHead[pXSprite->txID]; i < bucketHead[pXSprite->txID + 1]; i++) { - if (rxBucket[i].type != SS_SPRITE) continue; + if (!rxBucket[i].isActor()) continue; auto rxactor = rxBucket[i].actor(); if (actor != rxactor && rxactor->s().statnum == kStatInactive) return rxactor; } diff --git a/source/games/blood/src/nnexts.cpp b/source/games/blood/src/nnexts.cpp index 8d1e59b07..95ad477e5 100644 --- a/source/games/blood/src/nnexts.cpp +++ b/source/games/blood/src/nnexts.cpp @@ -1157,13 +1157,12 @@ void nnExtProcessSuperSprites() rx = pXWind->txID; for (j = bucketHead[rx]; j < bucketHead[rx + 1]; j++) { - if (rxBucket[j].type != OBJ_SECTOR) - continue; + if (!rxBucket[j].isSector()) continue; + auto pSector = rxBucket[j].sector(); + XSECTOR* pXSector = &pSector->xs(); - int index = rxBucket[j].rxindex; - XSECTOR* pXSector = §or[index].xs(); if ((!pXSector->locked) && (fWindAlways || pXSector->windAlways || pXSector->busy)) - windGenDoVerticalWind(pXWind->sysData2, index); + windGenDoVerticalWind(pXWind->sysData2, sectnum(pSector)); } DBloodActor* pXRedir = nullptr; // check redirected TX buckets @@ -1171,13 +1170,12 @@ void nnExtProcessSuperSprites() { for (j = bucketHead[rx]; j < bucketHead[rx + 1]; j++) { - if (rxBucket[j].type != OBJ_SECTOR) - continue; + if (!rxBucket[j].isSector()) continue; + auto pSector = rxBucket[j].sector(); + XSECTOR* pXSector = &pSector->xs(); - int index = rxBucket[j].rxindex; - XSECTOR* pXSector = §or[index].xs(); if ((!pXSector->locked) && (fWindAlways || pXSector->windAlways || pXSector->busy)) - windGenDoVerticalWind(pXWind->sysData2, index); + windGenDoVerticalWind(pXWind->sysData2, sectnum(pSector)); } } @@ -1976,8 +1974,10 @@ void windGenStopWindOnSectors(DBloodActor* sourceactor) for (int i = bucketHead[pXSource->txID]; i < bucketHead[pXSource->txID + 1]; i++) { - if (rxBucket[i].type != OBJ_SECTOR) continue; - XSECTOR* pXSector = §or[rxBucket[i].rxindex].xs(); + if (!rxBucket[i].isSector()) continue; + auto pSector = rxBucket[i].sector(); + XSECTOR* pXSector = &pSector->xs(); + if ((pXSector->state == 1 && !pXSector->windAlways) || ((pSource->flags & kModernTypeFlag1) && !(pSource->flags & kModernTypeFlag2))) { @@ -1992,8 +1992,10 @@ void windGenStopWindOnSectors(DBloodActor* sourceactor) { for (int i = bucketHead[rx]; i < bucketHead[rx + 1]; i++) { - if (rxBucket[i].type != OBJ_SECTOR) continue; - XSECTOR* pXSector = §or[rxBucket[i].rxindex].xs(); + if (!rxBucket[i].isSector()) continue; + auto pSector = rxBucket[i].sector(); + XSECTOR* pXSector = &pSector->xs(); + if ((pXSector->state == 1 && !pXSector->windAlways) || (pSource->flags & kModernTypeFlag2)) pXSector->windVel = 0; }