diff --git a/source/games/blood/src/aiunicult.cpp b/source/games/blood/src/aiunicult.cpp index f1a1a0a6a..01c9f0f38 100644 --- a/source/games/blood/src/aiunicult.cpp +++ b/source/games/blood/src/aiunicult.cpp @@ -1493,7 +1493,7 @@ DBloodActor* getNextIncarnation(DBloodActor* actor) for (int i = bucketHead[pXSprite->txID]; i < bucketHead[pXSprite->txID + 1]; i++) { if (rxBucket[i].type != SS_SPRITE) continue; - auto rxactor = rxBucket[i].GetActor(); + auto rxactor = rxBucket[i].actor(); if (actor != rxactor && rxactor->s().statnum == kStatInactive) return rxactor; } return nullptr; diff --git a/source/games/blood/src/eventq.cpp b/source/games/blood/src/eventq.cpp index 54ef0bd5b..b46684a9d 100644 --- a/source/games/blood/src/eventq.cpp +++ b/source/games/blood/src/eventq.cpp @@ -73,7 +73,7 @@ static int GetBucketChannel(const RXBUCKET* pBucket) } case SS_SPRITE: - return pBucket->GetActor()? pBucket->GetActor()->x().rxID : 0; + return pBucket->actor()? pBucket->actor()->x().rxID : 0; } Printf(PRINT_HIGH, "Unexpected rxBucket type %d", pBucket->type); @@ -311,7 +311,7 @@ void evInit() assert(nCount < kChannelMax); rxBucket[nCount].type = SS_SPRITE; rxBucket[nCount].rxindex = 0; - rxBucket[nCount].actor = actor; + rxBucket[nCount].rxactor = actor; nCount++; } } @@ -486,7 +486,7 @@ void evSend(const EventObject& eob, int rxId, COMMAND_ID command) for (int i = bucketHead[rxId]; i < bucketHead[rxId + 1]; i++) { EventObject eo; - eo.fromElements(rxBucket[i].type, rxBucket[i].rxindex, rxBucket[i].actor); + eo.fromElements(rxBucket[i].type, rxBucket[i].rxindex, rxBucket[i].rxactor); if (!event.event_isObject(eo)) { switch (rxBucket[i].type) @@ -499,7 +499,7 @@ void evSend(const EventObject& eob, int rxId, COMMAND_ID command) break; case 3: { - auto actor = rxBucket[i].GetActor(); + auto actor = rxBucket[i].actor(); if (actor && actor->hasX() && !(actor->s().flags & 32)) { @@ -721,7 +721,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, RXBUCKET& w, RXBUC { arc("type", w.type); if (w.type != SS_SPRITE) arc("index", w.rxindex); - else arc("index", w.actor); + else arc("index", w.rxactor); arc.EndObject(); } return arc; diff --git a/source/games/blood/src/eventq.h b/source/games/blood/src/eventq.h index e2bbff2dc..dcc7e8ae2 100644 --- a/source/games/blood/src/eventq.h +++ b/source/games/blood/src/eventq.h @@ -123,10 +123,19 @@ enum { struct RXBUCKET { - DBloodActor* GetActor() const { return actor; } - DBloodActor* actor; + DBloodActor* actor() const { return rxactor; } + DBloodActor* rxactor; int rxindex; uint8_t type; + + bool isActor() const { return type == 3/*OBJ_SPRITE*/; } + bool isSector() const { return type == 6/*OBJ_SECTOR*/; } + bool isWall() const { return type == 0/*OBJ_WALL*/; } + + sectortype* sector() const { assert(isSector()); return &::sector[rxindex]; } + walltype* wall() const { assert(isWall()); return &::wall[rxindex]; } + FString description() const { return "placeholder"; } // Just to have the method. No need to implement it. + }; extern RXBUCKET rxBucket[]; extern unsigned short bucketHead[]; diff --git a/source/games/blood/src/nnexts.cpp b/source/games/blood/src/nnexts.cpp index bd2d362fd..8d1e59b07 100644 --- a/source/games/blood/src/nnexts.cpp +++ b/source/games/blood/src/nnexts.cpp @@ -4980,7 +4980,7 @@ DBloodActor* aiFightGetMateTargets(DBloodActor* actor) { if (rxBucket[i].type == OBJ_SPRITE) { - auto mate = rxBucket[i].GetActor(); + auto mate = rxBucket[i].actor(); if (!mate || !mate->hasX() || mate == actor || !mate->IsDudeActor()) continue; @@ -5009,7 +5009,7 @@ bool aiFightMatesHaveSameTarget(DBloodActor* leaderactor, DBloodActor* targetact { if (rxBucket[i].type != OBJ_SPRITE) continue; - auto mate = rxBucket[i].actor; + auto mate = rxBucket[i].rxactor; if (!mate || !mate->hasX() || mate == leaderactor || !mate->IsDudeActor()) continue; @@ -5066,7 +5066,7 @@ void aiFightActivateDudes(int rx) for (int i = bucketHead[rx]; i < bucketHead[rx + 1]; i++) { if (rxBucket[i].type != OBJ_SPRITE) continue; - auto dudeactor = rxBucket[i].GetActor(); + auto dudeactor = rxBucket[i].actor(); if (!dudeactor || !dudeactor->hasX() || !dudeactor->IsDudeActor() || dudeactor->x().aiState->stateType != kAiStateGenIdle) continue; aiInitSprite(dudeactor); } @@ -5101,8 +5101,8 @@ void aiFightFreeAllTargets(DBloodActor* sourceactor) if (txID <= 0) return; for (int i = bucketHead[txID]; i < bucketHead[txID + 1]; i++) { - if (rxBucket[i].type == OBJ_SPRITE && rxBucket[i].actor && rxBucket[i].actor->hasX()) - aiFightFreeTargets(rxBucket[i].actor); + if (rxBucket[i].type == OBJ_SPRITE && rxBucket[i].rxactor && rxBucket[i].rxactor->hasX()) + aiFightFreeTargets(rxBucket[i].rxactor); } } @@ -5126,7 +5126,7 @@ bool aiFightDudeIsAffected(DBloodActor* dudeactor) { if (rxBucket[i].type != OBJ_SPRITE) continue; - auto rxactor = rxBucket[i].actor; + auto rxactor = rxBucket[i].rxactor; if (!rxactor || !rxactor->hasX() || !rxactor->IsDudeActor()) continue; else if (rxactor == dudeactor) return true; } @@ -5146,7 +5146,7 @@ bool aiFightGetDudesForBattle(DBloodActor* actor) for (int i = bucketHead[txID]; i < bucketHead[txID + 1]; i++) { if (rxBucket[i].type != OBJ_SPRITE) continue; - auto actor = rxBucket[i].GetActor(); + auto actor = rxBucket[i].actor(); if (!actor || !actor->hasX() || !actor->IsDudeActor()) continue; if (actor->x().health > 0) return true; } @@ -5159,7 +5159,7 @@ bool aiFightGetDudesForBattle(DBloodActor* actor) for (int i = bucketHead[rx]; i < bucketHead[rx + 1]; i++) { if (rxBucket[i].type != OBJ_SPRITE) continue; - auto actor = rxBucket[i].GetActor(); + auto actor = rxBucket[i].actor(); if (!actor || !actor->hasX() || !actor->IsDudeActor()) continue; if (actor->x().health > 0) return true; } @@ -7169,7 +7169,7 @@ void playerQavSceneProcess(PLAYER* pPlayer, QAVSCENE* pQavScene) { if (rxBucket[i].type == OBJ_SPRITE) { - auto rxactor = rxBucket[i].GetActor(); + auto rxactor = rxBucket[i].actor(); if (!rxactor || !rxactor->hasX() || rxactor == initiator) continue; spritetype* pSpr = &rxactor->s(); @@ -7182,7 +7182,7 @@ void playerQavSceneProcess(PLAYER* pPlayer, QAVSCENE* pQavScene) } } - nnExtTriggerObject(rxBucket[i].type, rxBucket[i].rxindex, rxBucket[i].actor, pXSprite->command); + nnExtTriggerObject(rxBucket[i].type, rxBucket[i].rxindex, rxBucket[i].rxactor, pXSprite->command); } } @@ -8974,7 +8974,7 @@ DBloodActor* evrListRedirectors(int objType, int objIndex, DBloodActor* objActor for (int i = bucketHead[id]; i < bucketHead[id + 1]; i++) { if (rxBucket[i].type != OBJ_SPRITE) continue; - auto pXSpr = evrIsRedirector(rxBucket[i].actor); + auto pXSpr = evrIsRedirector(rxBucket[i].rxactor); if (!pXSpr) continue; else if (prevFound || pXRedir == nullptr) { @@ -9006,10 +9006,10 @@ bool incDecGoalValueIsReached(DBloodActor* actor) for (int i = bucketHead[pXSprite->txID]; i < bucketHead[pXSprite->txID + 1]; i++) { - if (rxBucket[i].type == OBJ_SPRITE && evrIsRedirector(rxBucket[i].actor)) continue; + if (rxBucket[i].type == OBJ_SPRITE && evrIsRedirector(rxBucket[i].rxactor)) continue; for (int a = 0; a < len; a++) { - if (getDataFieldOfObject(rxBucket[i].type, rxBucket[i].rxindex, rxBucket[i].actor, (buffer[a] - 52) + 4) != pXSprite->data3) + if (getDataFieldOfObject(rxBucket[i].type, rxBucket[i].rxindex, rxBucket[i].rxactor, (buffer[a] - 52) + 4) != pXSprite->data3) return false; } } @@ -9021,7 +9021,7 @@ bool incDecGoalValueIsReached(DBloodActor* actor) { for (int a = 0; a < len; a++) { - if (getDataFieldOfObject(rxBucket[i].type, rxBucket[i].rxindex, rxBucket[i].actor, (buffer[a] - 52) + 4) != pXSprite->data3) + if (getDataFieldOfObject(rxBucket[i].type, rxBucket[i].rxindex, rxBucket[i].rxactor, (buffer[a] - 52) + 4) != pXSprite->data3) return false; } }