mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 08:52:00 +00:00
- store owner outside the sprite.
This commit is contained in:
parent
10e6486744
commit
b9602bbb05
2 changed files with 8 additions and 6 deletions
|
@ -120,6 +120,7 @@ public:
|
|||
SPRITEMASS spriteMass;
|
||||
GENDUDEEXTRA genDudeExtra;
|
||||
DBloodActor* prevmarker; // needed by the nnext marker code. This originally hijacked targetX in XSPRITE
|
||||
DBloodActor* ownerActor; // was previously stored in the sprite's owner field.
|
||||
POINT3D basePoint;
|
||||
ConditionElement condition[2];
|
||||
bool explosionhackflag; // this originally hijacked the target field which is not safe when working with pointers.
|
||||
|
@ -157,13 +158,12 @@ public:
|
|||
|
||||
void SetOwner(DBloodActor* own)
|
||||
{
|
||||
s().owner = own ? own->GetSpriteIndex() : -1;
|
||||
ownerActor = own;
|
||||
}
|
||||
|
||||
DBloodActor* GetOwner()
|
||||
{
|
||||
if (s().owner == -1 || s().owner == kMaxSprites - 1) return nullptr;
|
||||
return base() + s().owner;
|
||||
return ownerActor;
|
||||
}
|
||||
|
||||
void SetTarget(DBloodActor* own)
|
||||
|
@ -200,12 +200,13 @@ public:
|
|||
|
||||
void SetSpecialOwner() // nnext hackery
|
||||
{
|
||||
ownerActor = nullptr;
|
||||
s().owner = kMaxSprites - 1;
|
||||
}
|
||||
|
||||
bool GetSpecialOwner()
|
||||
{
|
||||
return (s().owner == kMaxSprites - 1);
|
||||
return ownerActor == nullptr && (s().owner == kMaxSprites - 1);
|
||||
}
|
||||
|
||||
bool IsPlayerActor()
|
||||
|
|
|
@ -491,12 +491,13 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, DBloodActor& w, DB
|
|||
// The rest is only relevant if the actor has an xsprite.
|
||||
if (w.hasX())
|
||||
{
|
||||
arc ("xsprite", w.xsprite, def->xsprite)
|
||||
arc("xsprite", w.xsprite, def->xsprite)
|
||||
("dudeslope", w.dudeSlope, def->dudeSlope)
|
||||
("dudeextra", w.dudeExtra, def->dudeExtra)
|
||||
("explosionflag", w.explosionhackflag, def->explosionhackflag)
|
||||
("spritehit", w.hit, def->hit)
|
||||
("basepoint", w.basePoint, def->basePoint);
|
||||
("basepoint", w.basePoint, def->basePoint)
|
||||
("owneractor", w.ownerActor, def->ownerActor);
|
||||
|
||||
#ifdef NOONE_EXTENSIONS
|
||||
if (gModernMap)
|
||||
|
|
Loading…
Reference in a new issue