mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 17:01:28 +00:00
- first batch of rxBucket refactoring.
This commit is contained in:
parent
5d0086cb49
commit
1d04ce90e4
4 changed files with 16 additions and 19 deletions
|
@ -7434,6 +7434,8 @@ void aiSetTarget_(XSPRITE* pXSprite, int x, int y, int z)
|
|||
aiSetTarget(&bloodActors[pXSprite->reference], x, y, z);
|
||||
}
|
||||
|
||||
DBloodActor* RXBUCKET::GetActor() const { return &bloodActors[rxindex]; }
|
||||
|
||||
|
||||
|
||||
END_BLD_NS
|
||||
|
|
|
@ -1512,13 +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].rxindex == pXSprite->reference)
|
||||
continue;
|
||||
|
||||
if (sprite[rxBucket[i].rxindex].statnum == kStatInactive)
|
||||
return &bloodActors[sprite[rxBucket[i].rxindex].index];
|
||||
if (rxBucket[i].type != OBJ_SPRITE) continue;
|
||||
auto rxactor = rxBucket[i].GetActor();
|
||||
if (actor != rxactor && rxactor->s().statnum == kStatInactive) return rxactor;
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool dudeIsMelee(DBloodActor* actor)
|
||||
|
|
|
@ -62,9 +62,7 @@ static int GetBucketChannel(const RXBUCKET* pBucket)
|
|||
return xwall[nXIndex].rxID;
|
||||
|
||||
case SS_SPRITE:
|
||||
nXIndex = sprite[pBucket->rxindex].extra;
|
||||
assert(nXIndex > 0);
|
||||
return xsprite[nXIndex].rxID;
|
||||
return pBucket->GetActor()? pBucket->GetActor()->x().rxID : 0;
|
||||
}
|
||||
|
||||
Printf(PRINT_HIGH, "Unexpected rxBucket type %d", pBucket->type);
|
||||
|
@ -368,6 +366,7 @@ void evSend(int nIndex, int nType, int rxId, COMMAND_ID command)
|
|||
}
|
||||
|
||||
EVENT event;
|
||||
event.actor = nType == SS_SPRITE? &bloodActors[nIndex] : nullptr;
|
||||
event.index = nIndex;
|
||||
event.type = nType;
|
||||
event.cmd = command;
|
||||
|
@ -482,7 +481,7 @@ 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].rxindex)
|
||||
if (event.type != rxBucket[i].type || (event.type != OBJ_SPRITE && event.index != rxBucket[i].rxindex) || (event.type == OBJ_SPRITE && event.actor != rxBucket[i].GetActor()))
|
||||
{
|
||||
switch (rxBucket[i].type)
|
||||
{
|
||||
|
@ -494,16 +493,13 @@ void evSend(int nIndex, int nType, int rxId, COMMAND_ID command)
|
|||
break;
|
||||
case 3:
|
||||
{
|
||||
int nSprite = rxBucket[i].rxindex;
|
||||
spritetype* pSprite = &sprite[nSprite];
|
||||
if (pSprite->flags & 32)
|
||||
continue;
|
||||
int nXSprite = pSprite->extra;
|
||||
if (nXSprite > 0)
|
||||
auto actor = rxBucket[i].GetActor();
|
||||
|
||||
if (actor && actor->hasX() && !(actor->s().flags & 32))
|
||||
{
|
||||
XSPRITE* pXSprite = &xsprite[nXSprite];
|
||||
if (pXSprite->rxID > 0)
|
||||
trMessageSprite(nSprite, event);
|
||||
XSPRITE* pXSprite = &actor->x();
|
||||
if (actor->x().rxID > 0)
|
||||
trMessageSprite(actor->s().index, event);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -73,6 +73,7 @@ enum {
|
|||
|
||||
struct RXBUCKET
|
||||
{
|
||||
DBloodActor* GetActor() const;
|
||||
DBloodActor* actor;
|
||||
int rxindex;
|
||||
uint8_t type;
|
||||
|
|
Loading…
Reference in a new issue