mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-16 01:11:28 +00:00
- added accessors to RXBUCKET to match EventObject and renamed some of its members.
As a first preparation for replacement.
This commit is contained in:
parent
5787ec9618
commit
546dee2724
4 changed files with 31 additions and 22 deletions
|
@ -1493,7 +1493,7 @@ DBloodActor* getNextIncarnation(DBloodActor* actor)
|
||||||
for (int i = bucketHead[pXSprite->txID]; i < bucketHead[pXSprite->txID + 1]; i++)
|
for (int i = bucketHead[pXSprite->txID]; i < bucketHead[pXSprite->txID + 1]; i++)
|
||||||
{
|
{
|
||||||
if (rxBucket[i].type != SS_SPRITE) continue;
|
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;
|
if (actor != rxactor && rxactor->s().statnum == kStatInactive) return rxactor;
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
|
@ -73,7 +73,7 @@ static int GetBucketChannel(const RXBUCKET* pBucket)
|
||||||
}
|
}
|
||||||
|
|
||||||
case SS_SPRITE:
|
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);
|
Printf(PRINT_HIGH, "Unexpected rxBucket type %d", pBucket->type);
|
||||||
|
@ -311,7 +311,7 @@ void evInit()
|
||||||
assert(nCount < kChannelMax);
|
assert(nCount < kChannelMax);
|
||||||
rxBucket[nCount].type = SS_SPRITE;
|
rxBucket[nCount].type = SS_SPRITE;
|
||||||
rxBucket[nCount].rxindex = 0;
|
rxBucket[nCount].rxindex = 0;
|
||||||
rxBucket[nCount].actor = actor;
|
rxBucket[nCount].rxactor = actor;
|
||||||
nCount++;
|
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++)
|
for (int i = bucketHead[rxId]; i < bucketHead[rxId + 1]; i++)
|
||||||
{
|
{
|
||||||
EventObject eo;
|
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))
|
if (!event.event_isObject(eo))
|
||||||
{
|
{
|
||||||
switch (rxBucket[i].type)
|
switch (rxBucket[i].type)
|
||||||
|
@ -499,7 +499,7 @@ void evSend(const EventObject& eob, int rxId, COMMAND_ID command)
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
{
|
{
|
||||||
auto actor = rxBucket[i].GetActor();
|
auto actor = rxBucket[i].actor();
|
||||||
|
|
||||||
if (actor && actor->hasX() && !(actor->s().flags & 32))
|
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);
|
arc("type", w.type);
|
||||||
if (w.type != SS_SPRITE) arc("index", w.rxindex);
|
if (w.type != SS_SPRITE) arc("index", w.rxindex);
|
||||||
else arc("index", w.actor);
|
else arc("index", w.rxactor);
|
||||||
arc.EndObject();
|
arc.EndObject();
|
||||||
}
|
}
|
||||||
return arc;
|
return arc;
|
||||||
|
|
|
@ -123,10 +123,19 @@ enum {
|
||||||
|
|
||||||
struct RXBUCKET
|
struct RXBUCKET
|
||||||
{
|
{
|
||||||
DBloodActor* GetActor() const { return actor; }
|
DBloodActor* actor() const { return rxactor; }
|
||||||
DBloodActor* actor;
|
DBloodActor* rxactor;
|
||||||
int rxindex;
|
int rxindex;
|
||||||
uint8_t type;
|
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 RXBUCKET rxBucket[];
|
||||||
extern unsigned short bucketHead[];
|
extern unsigned short bucketHead[];
|
||||||
|
|
|
@ -4980,7 +4980,7 @@ DBloodActor* aiFightGetMateTargets(DBloodActor* actor)
|
||||||
{
|
{
|
||||||
if (rxBucket[i].type == OBJ_SPRITE)
|
if (rxBucket[i].type == OBJ_SPRITE)
|
||||||
{
|
{
|
||||||
auto mate = rxBucket[i].GetActor();
|
auto mate = rxBucket[i].actor();
|
||||||
if (!mate || !mate->hasX() || mate == actor || !mate->IsDudeActor())
|
if (!mate || !mate->hasX() || mate == actor || !mate->IsDudeActor())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -5009,7 +5009,7 @@ bool aiFightMatesHaveSameTarget(DBloodActor* leaderactor, DBloodActor* targetact
|
||||||
{
|
{
|
||||||
if (rxBucket[i].type != OBJ_SPRITE) continue;
|
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())
|
if (!mate || !mate->hasX() || mate == leaderactor || !mate->IsDudeActor())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -5066,7 +5066,7 @@ void aiFightActivateDudes(int rx)
|
||||||
for (int i = bucketHead[rx]; i < bucketHead[rx + 1]; i++)
|
for (int i = bucketHead[rx]; i < bucketHead[rx + 1]; i++)
|
||||||
{
|
{
|
||||||
if (rxBucket[i].type != OBJ_SPRITE) continue;
|
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;
|
if (!dudeactor || !dudeactor->hasX() || !dudeactor->IsDudeActor() || dudeactor->x().aiState->stateType != kAiStateGenIdle) continue;
|
||||||
aiInitSprite(dudeactor);
|
aiInitSprite(dudeactor);
|
||||||
}
|
}
|
||||||
|
@ -5101,8 +5101,8 @@ void aiFightFreeAllTargets(DBloodActor* sourceactor)
|
||||||
if (txID <= 0) return;
|
if (txID <= 0) return;
|
||||||
for (int i = bucketHead[txID]; i < bucketHead[txID + 1]; i++)
|
for (int i = bucketHead[txID]; i < bucketHead[txID + 1]; i++)
|
||||||
{
|
{
|
||||||
if (rxBucket[i].type == OBJ_SPRITE && rxBucket[i].actor && rxBucket[i].actor->hasX())
|
if (rxBucket[i].type == OBJ_SPRITE && rxBucket[i].rxactor && rxBucket[i].rxactor->hasX())
|
||||||
aiFightFreeTargets(rxBucket[i].actor);
|
aiFightFreeTargets(rxBucket[i].rxactor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5126,7 +5126,7 @@ bool aiFightDudeIsAffected(DBloodActor* dudeactor)
|
||||||
{
|
{
|
||||||
if (rxBucket[i].type != OBJ_SPRITE) continue;
|
if (rxBucket[i].type != OBJ_SPRITE) continue;
|
||||||
|
|
||||||
auto rxactor = rxBucket[i].actor;
|
auto rxactor = rxBucket[i].rxactor;
|
||||||
if (!rxactor || !rxactor->hasX() || !rxactor->IsDudeActor()) continue;
|
if (!rxactor || !rxactor->hasX() || !rxactor->IsDudeActor()) continue;
|
||||||
else if (rxactor == dudeactor) return true;
|
else if (rxactor == dudeactor) return true;
|
||||||
}
|
}
|
||||||
|
@ -5146,7 +5146,7 @@ bool aiFightGetDudesForBattle(DBloodActor* actor)
|
||||||
for (int i = bucketHead[txID]; i < bucketHead[txID + 1]; i++)
|
for (int i = bucketHead[txID]; i < bucketHead[txID + 1]; i++)
|
||||||
{
|
{
|
||||||
if (rxBucket[i].type != OBJ_SPRITE) continue;
|
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 || !actor->hasX() || !actor->IsDudeActor()) continue;
|
||||||
if (actor->x().health > 0) return true;
|
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++)
|
for (int i = bucketHead[rx]; i < bucketHead[rx + 1]; i++)
|
||||||
{
|
{
|
||||||
if (rxBucket[i].type != OBJ_SPRITE) continue;
|
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 || !actor->hasX() || !actor->IsDudeActor()) continue;
|
||||||
if (actor->x().health > 0) return true;
|
if (actor->x().health > 0) return true;
|
||||||
}
|
}
|
||||||
|
@ -7169,7 +7169,7 @@ void playerQavSceneProcess(PLAYER* pPlayer, QAVSCENE* pQavScene)
|
||||||
{
|
{
|
||||||
if (rxBucket[i].type == OBJ_SPRITE)
|
if (rxBucket[i].type == OBJ_SPRITE)
|
||||||
{
|
{
|
||||||
auto rxactor = rxBucket[i].GetActor();
|
auto rxactor = rxBucket[i].actor();
|
||||||
if (!rxactor || !rxactor->hasX() || rxactor == initiator) continue;
|
if (!rxactor || !rxactor->hasX() || rxactor == initiator) continue;
|
||||||
|
|
||||||
spritetype* pSpr = &rxactor->s();
|
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++)
|
for (int i = bucketHead[id]; i < bucketHead[id + 1]; i++)
|
||||||
{
|
{
|
||||||
if (rxBucket[i].type != OBJ_SPRITE) continue;
|
if (rxBucket[i].type != OBJ_SPRITE) continue;
|
||||||
auto pXSpr = evrIsRedirector(rxBucket[i].actor);
|
auto pXSpr = evrIsRedirector(rxBucket[i].rxactor);
|
||||||
if (!pXSpr) continue;
|
if (!pXSpr) continue;
|
||||||
else if (prevFound || pXRedir == nullptr)
|
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++)
|
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++)
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9021,7 +9021,7 @@ bool incDecGoalValueIsReached(DBloodActor* actor)
|
||||||
{
|
{
|
||||||
for (int a = 0; a < len; a++)
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue