- renamed RXBUCKET.index to rxindex.

This will be needed for refactoring for easier lookup.
This commit is contained in:
Christoph Oelckers 2021-09-01 19:29:48 +02:00
parent 93e909dd58
commit 5d0086cb49
4 changed files with 37 additions and 37 deletions

View file

@ -1512,11 +1512,11 @@ DBloodActor* getNextIncarnation(DBloodActor* actor)
XSPRITE* pXSprite = &actor->x();
for (int i = bucketHead[pXSprite->txID]; i < bucketHead[pXSprite->txID + 1]; i++)
{
if (rxBucket[i].type != OBJ_SPRITE || rxBucket[i].index == pXSprite->reference)
if (rxBucket[i].type != OBJ_SPRITE || rxBucket[i].rxindex == pXSprite->reference)
continue;
if (sprite[rxBucket[i].index].statnum == kStatInactive)
return &bloodActors[sprite[rxBucket[i].index].index];
if (sprite[rxBucket[i].rxindex].statnum == kStatInactive)
return &bloodActors[sprite[rxBucket[i].rxindex].index];
}
return NULL;
}

View file

@ -52,17 +52,17 @@ static int GetBucketChannel(const RXBUCKET* pBucket)
switch (pBucket->type)
{
case SS_SECTOR:
nXIndex = sector[pBucket->index].extra;
nXIndex = sector[pBucket->rxindex].extra;
assert(nXIndex > 0);
return xsector[nXIndex].rxID;
case SS_WALL:
nXIndex = wall[pBucket->index].extra;
nXIndex = wall[pBucket->rxindex].extra;
assert(nXIndex > 0);
return xwall[nXIndex].rxID;
case SS_SPRITE:
nXIndex = sprite[pBucket->index].extra;
nXIndex = sprite[pBucket->rxindex].extra;
assert(nXIndex > 0);
return xsprite[nXIndex].rxID;
}
@ -279,7 +279,7 @@ void evInit()
{
assert(nCount < kChannelMax);
rxBucket[nCount].type = SS_SECTOR;
rxBucket[nCount].index = i;
rxBucket[nCount].rxindex = i;
nCount++;
}
}
@ -291,7 +291,7 @@ void evInit()
{
assert(nCount < kChannelMax);
rxBucket[nCount].type = SS_WALL;
rxBucket[nCount].index = i;
rxBucket[nCount].rxindex = i;
nCount++;
}
}
@ -305,7 +305,7 @@ void evInit()
{
assert(nCount < kChannelMax);
rxBucket[nCount].type = SS_SPRITE;
rxBucket[nCount].index = i;
rxBucket[nCount].rxindex = i;
nCount++;
}
}
@ -482,19 +482,19 @@ void evSend(int nIndex, int nType, int rxId, COMMAND_ID command)
#endif
for (int i = bucketHead[rxId]; i < bucketHead[rxId + 1]; i++)
{
if (event.type != rxBucket[i].type || event.index != rxBucket[i].index)
if (event.type != rxBucket[i].type || event.index != rxBucket[i].rxindex)
{
switch (rxBucket[i].type)
{
case 6:
trMessageSector(rxBucket[i].index, event);
trMessageSector(rxBucket[i].rxindex, event);
break;
case 0:
trMessageWall(rxBucket[i].index, event);
trMessageWall(rxBucket[i].rxindex, event);
break;
case 3:
{
int nSprite = rxBucket[i].index;
int nSprite = rxBucket[i].rxindex;
spritetype* pSprite = &sprite[nSprite];
if (pSprite->flags & 32)
continue;
@ -650,7 +650,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, RXBUCKET& w, RXBUC
{
if (arc.BeginObject(keyname))
{
arc("index", w.index)
arc("index", w.rxindex)
("type", w.type)
.EndObject();
}

View file

@ -74,7 +74,7 @@ enum {
struct RXBUCKET
{
DBloodActor* actor;
int index;
int rxindex;
uint8_t type;
};
extern RXBUCKET rxBucket[];

View file

@ -1096,9 +1096,9 @@ void nnExtProcessSuperSprites() {
if (rxBucket[j].type != OBJ_SECTOR)
continue;
XSECTOR* pXSector = &xsector[sector[rxBucket[j].index].extra];
XSECTOR* pXSector = &xsector[sector[rxBucket[j].rxindex].extra];
if ((!pXSector->locked) && (fWindAlways || pXSector->windAlways || pXSector->busy))
windGenDoVerticalWind(pXWind, rxBucket[j].index);
windGenDoVerticalWind(pXWind, rxBucket[j].rxindex);
}
XSPRITE* pXRedir = NULL; // check redirected TX buckets
@ -1107,9 +1107,9 @@ void nnExtProcessSuperSprites() {
if (rxBucket[j].type != OBJ_SECTOR)
continue;
XSECTOR* pXSector = &xsector[sector[rxBucket[j].index].extra];
XSECTOR* pXSector = &xsector[sector[rxBucket[j].rxindex].extra];
if ((!pXSector->locked) && (fWindAlways || pXSector->windAlways || pXSector->busy))
windGenDoVerticalWind(pXWind, rxBucket[j].index);
windGenDoVerticalWind(pXWind, rxBucket[j].rxindex);
}
}
@ -1814,7 +1814,7 @@ void windGenStopWindOnSectors(XSPRITE* pXSource) {
for (int i = bucketHead[pXSource->txID]; i < bucketHead[pXSource->txID + 1]; i++) {
if (rxBucket[i].type != OBJ_SECTOR) continue;
XSECTOR* pXSector = &xsector[sector[rxBucket[i].index].extra];
XSECTOR* pXSector = &xsector[sector[rxBucket[i].rxindex].extra];
if ((pXSector->state == 1 && !pXSector->windAlways)
|| ((pSource->flags & kModernTypeFlag1) && !(pSource->flags & kModernTypeFlag2))) {
pXSector->windVel = 0;
@ -1826,7 +1826,7 @@ void windGenStopWindOnSectors(XSPRITE* pXSource) {
while ((pXRedir = evrListRedirectors(OBJ_SPRITE, sprite[pXSource->reference].extra, pXRedir, &rx)) != NULL) {
for (int i = bucketHead[rx]; i < bucketHead[rx + 1]; i++) {
if (rxBucket[i].type != OBJ_SECTOR) continue;
XSECTOR* pXSector = &xsector[sector[rxBucket[i].index].extra];
XSECTOR* pXSector = &xsector[sector[rxBucket[i].rxindex].extra];
if ((pXSector->state == 1 && !pXSector->windAlways) || (pSource->flags & kModernTypeFlag2))
pXSector->windVel = 0;
}
@ -4378,7 +4378,7 @@ spritetype* aiFightGetMateTargets(XSPRITE* pXSprite) {
for (int i = bucketHead[rx]; i < bucketHead[rx + 1]; i++) {
if (rxBucket[i].type == OBJ_SPRITE) {
pMate = &sprite[rxBucket[i].index];
pMate = &sprite[rxBucket[i].rxindex];
if (pMate->extra < 0 || pMate->index == sprite[pXSprite->reference].index || !IsDudeSprite(pMate))
continue;
@ -4402,7 +4402,7 @@ bool aiFightMatesHaveSameTarget(XSPRITE* pXLeader, spritetype* pTarget, int allo
if (rxBucket[i].type != OBJ_SPRITE)
continue;
pMate = &sprite[rxBucket[i].index];
pMate = &sprite[rxBucket[i].rxindex];
if (pMate->extra < 0 || pMate->index == sprite[pXLeader->reference].index || !IsDudeSprite(pMate))
continue;
@ -4444,7 +4444,7 @@ bool aiFightDudeCanSeeTarget(XSPRITE* pXDude, DUDEINFO* pDudeInfo, spritetype* p
void aiFightActivateDudes(int rx) {
for (int i = bucketHead[rx]; i < bucketHead[rx + 1]; i++) {
if (rxBucket[i].type != OBJ_SPRITE) continue;
spritetype* pDude = &sprite[rxBucket[i].index]; XSPRITE* pXDude = &xsprite[pDude->extra];
spritetype* pDude = &sprite[rxBucket[i].rxindex]; XSPRITE* pXDude = &xsprite[pDude->extra];
if (!IsDudeSprite(pDude) || pXDude->aiState->stateType != kAiStateGenIdle) continue;
aiInitSprite(&bloodActors[pDude->index]);
}
@ -4469,8 +4469,8 @@ void aiFightFreeTargets(int nSprite) {
void aiFightFreeAllTargets(XSPRITE* pXSource) {
if (pXSource->txID <= 0) return;
for (int i = bucketHead[pXSource->txID]; i < bucketHead[pXSource->txID + 1]; i++) {
if (rxBucket[i].type == OBJ_SPRITE && sprite[rxBucket[i].index].extra >= 0)
aiFightFreeTargets(rxBucket[i].index);
if (rxBucket[i].type == OBJ_SPRITE && sprite[rxBucket[i].rxindex].extra >= 0)
aiFightFreeTargets(rxBucket[i].rxindex);
}
return;
@ -4488,7 +4488,7 @@ bool aiFightDudeIsAffected(XSPRITE* pXDude) {
for (int i = bucketHead[pXSprite->txID]; i < bucketHead[pXSprite->txID + 1]; i++) {
if (rxBucket[i].type != OBJ_SPRITE) continue;
spritetype* pSprite = &sprite[rxBucket[i].index];
spritetype* pSprite = &sprite[rxBucket[i].rxindex];
if (pSprite->extra < 0 || !IsDudeSprite(pSprite)) continue;
else if (pSprite->index == sprite[pXDude->reference].index) return true;
}
@ -4505,8 +4505,8 @@ bool aiFightGetDudesForBattle(XSPRITE* pXSprite) {
for (int i = bucketHead[pXSprite->txID]; i < bucketHead[pXSprite->txID + 1]; i++) {
if (rxBucket[i].type != OBJ_SPRITE) continue;
else if (IsDudeSprite(&sprite[rxBucket[i].index]) &&
xsprite[sprite[rxBucket[i].index].extra].health > 0) return true;
else if (IsDudeSprite(&sprite[rxBucket[i].rxindex]) &&
xsprite[sprite[rxBucket[i].rxindex].extra].health > 0) return true;
}
// check redirected TX buckets
@ -4514,8 +4514,8 @@ bool aiFightGetDudesForBattle(XSPRITE* pXSprite) {
while ((pXRedir = evrListRedirectors(OBJ_SPRITE, sprite[pXSprite->reference].extra, pXRedir, &rx)) != NULL) {
for (int i = bucketHead[rx]; i < bucketHead[rx + 1]; i++) {
if (rxBucket[i].type != OBJ_SPRITE) continue;
else if (IsDudeSprite(&sprite[rxBucket[i].index]) &&
xsprite[sprite[rxBucket[i].index].extra].health > 0) return true;
else if (IsDudeSprite(&sprite[rxBucket[i].rxindex]) &&
xsprite[sprite[rxBucket[i].rxindex].extra].health > 0) return true;
}
}
return false;
@ -6186,7 +6186,7 @@ void playerQavSceneProcess(PLAYER* pPlayer, QAVSCENE* pQavScene) {
for (int i = bucketHead[pXSprite->txID]; i < bucketHead[pXSprite->txID + 1]; i++) {
if (rxBucket[i].type == OBJ_SPRITE) {
spritetype* pSpr = &sprite[rxBucket[i].index];
spritetype* pSpr = &sprite[rxBucket[i].rxindex];
if (pSpr->index == nIndex || !xspriRangeIsFine(pSpr->extra))
continue;
@ -6199,7 +6199,7 @@ void playerQavSceneProcess(PLAYER* pPlayer, QAVSCENE* pQavScene) {
}
nnExtTriggerObject(rxBucket[i].type, rxBucket[i].index, pXSprite->command);
nnExtTriggerObject(rxBucket[i].type, rxBucket[i].rxindex, pXSprite->command);
}
} //else {
@ -7772,7 +7772,7 @@ XSPRITE* evrListRedirectors(int objType, int objXIndex, XSPRITE* pXRedir, int* t
int nIndex = (pXRedir) ? pXRedir->reference : -1; bool prevFound = false;
for (int i = bucketHead[id]; i < bucketHead[id + 1]; i++) {
if (rxBucket[i].type != OBJ_SPRITE) continue;
XSPRITE* pXSpr = evrIsRedirector(rxBucket[i].index);
XSPRITE* pXSpr = evrIsRedirector(rxBucket[i].rxindex);
if (!pXSpr) continue;
else if (prevFound || nIndex == -1) { *tx = listTx(pXSpr, *tx); return pXSpr; }
else if (nIndex != pXSpr->reference) continue;
@ -7789,9 +7789,9 @@ bool incDecGoalValueIsReached(XSPRITE* pXSprite) {
if (pXSprite->data3 != pXSprite->sysData1) return false;
char buffer[5]; sprintf(buffer, "%d", abs(pXSprite->data1)); int len = int(strlen(buffer)); int rx = -1;
for (int i = bucketHead[pXSprite->txID]; i < bucketHead[pXSprite->txID + 1]; i++) {
if (rxBucket[i].type == OBJ_SPRITE && evrIsRedirector(rxBucket[i].index)) continue;
if (rxBucket[i].type == OBJ_SPRITE && evrIsRedirector(rxBucket[i].rxindex)) continue;
for (int a = 0; a < len; a++) {
if (getDataFieldOfObject(rxBucket[i].type, rxBucket[i].index, (buffer[a] - 52) + 4) != pXSprite->data3)
if (getDataFieldOfObject(rxBucket[i].type, rxBucket[i].rxindex, (buffer[a] - 52) + 4) != pXSprite->data3)
return false;
}
}
@ -7800,7 +7800,7 @@ bool incDecGoalValueIsReached(XSPRITE* pXSprite) {
while ((pXRedir = evrListRedirectors(OBJ_SPRITE, sprite[pXSprite->reference].extra, pXRedir, &rx)) != NULL) {
for (int i = bucketHead[rx]; i < bucketHead[rx + 1]; i++) {
for (int a = 0; a < len; a++) {
if (getDataFieldOfObject(rxBucket[i].type, rxBucket[i].index, (buffer[a] - 52) + 4) != pXSprite->data3)
if (getDataFieldOfObject(rxBucket[i].type, rxBucket[i].rxindex, (buffer[a] - 52) + 4) != pXSprite->data3)
return false;
}
}