- make XSPRITE::target a pointer

This commit is contained in:
Christoph Oelckers 2021-11-19 20:54:13 +01:00
parent d576e8f438
commit bee70155d2
3 changed files with 6 additions and 5 deletions

View file

@ -168,13 +168,12 @@ public:
void SetTarget(DBloodActor* own)
{
x().target_i = own ? own->GetSpriteIndex() : -1;
x().target = own;
}
DBloodActor* GetTarget()
{
if (x().target_i <= -1 || x().target_i == kMaxSprites - 1) return nullptr;
return base() + x().target_i;
return x().target;
}
bool ValidateTarget(const char* func)

View file

@ -94,6 +94,9 @@ struct XSPRITE {
unsigned int unused2 : 1; // (new) patrol state
};
};
DBloodActor* target; // target sprite
int32_t targetX; // target x
int32_t targetY; // target y
int32_t targetZ; // target z
@ -107,7 +110,6 @@ struct XSPRITE {
int16_t data1; // Data 1
int16_t data2; // Data 2
int16_t data3; // Data 3
int16_t target_i; // target sprite
int16_t burnSource;
uint16_t txID; // TX ID
uint16_t rxID; // RX ID

View file

@ -623,7 +623,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, XSPRITE& w, XSPRIT
("targetX", w.targetX, def->targetX)
("targetY", w.targetY, def->targetY)
("targetZ", w.targetZ, def->targetZ)
("target", w.target_i, def->target_i)
("target", w.target, def->target)
("sysdata1", w.sysData1, def->sysData1)
("sysdata2", w.sysData2, def->sysData2)
("scale", w.scale, def->scale)