- use a real pointer in DSWActor for owner tracking.

This commit is contained in:
Christoph Oelckers 2021-12-05 10:51:38 +01:00
parent ca10495d7c
commit fa05cfbaf1
4 changed files with 6 additions and 37 deletions

View file

@ -1112,7 +1112,8 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, TRACK& w, TRACK* d
void DSWActor::Serialize(FSerializer& arc)
{
Super::Serialize(arc);
arc("hasuser", hasUser);
arc("hasuser", hasUser)
("owner", ownerActor);
if (hasUser) arc("user", user); // only write if defined.
}

View file

@ -147,35 +147,6 @@ struct VOCstruct
};
// JIMSOUND3D(tm) variables section //////////////////////////////////////////
#if 0
struct VOC3Dstruct
{
VOC_INFOp vp; // Pointer to the sound
int *x; // Pointer to x coordinate
int *y; // Pointer to y coordinate
int *z; // Pointer to z coordinate
int fx, fy, fz; // Non-Follow literal values
Voc3D_Flags flags; // 3d voc sound flags
int handle; // Current handle to the voc
short doplr_delta; // Change in distance since last call
VOC3D_INFOp prev, next; // Linked voc list
short owner; // Hold index into user array to
// delete looping sounds
int num; // Digital Entry number used for
// callback of looping sounds
// If sound is active but user == 0, stop the sound
short dist; // Current distance of sound from player
uint8_t priority; // Used to force a higher priority based on distance
int tics; // Tics used to count to next sound occurance
int maxtics; // Tics until next sound occurance
// for intermittent sounds
bool deleted; // Has sound been marked for deletion?
bool FX_Ok; // Did this sound play ok?
};
#endif
extern VOC_INFO voc[];
END_SW_NS

View file

@ -581,26 +581,22 @@ STATE s_IconFlag[] =
void SetOwner(DSWActor* ownr, DSWActor* child, bool flag)
{
SPRITEp cp = &child->s();
if (flag && ownr != nullptr && ownr->hasU())
{
SET(ownr->u()->Flags2, SPR2_CHILDREN);
}
cp->owner = ownr? ownr->GetSpriteIndex() : -1;
child->ownerActor = ownr;
}
DSWActor* GetOwner(DSWActor* child)
{
if (!child || child->s().owner < 0) return nullptr;
return &swActors[child->s().owner];
return child ? child->ownerActor : nullptr;
}
void ClearOwner(DSWActor* child)
{
if (child) child->s().owner = -1;
if (child) child->ownerActor = nullptr;
}
void SetAttach(DSWActor* ownr, DSWActor* child)

View file

@ -16,6 +16,7 @@ public:
bool hasUser;
USER user;
walltype* tempwall; // transient, to replace a hack using a 16 bit sprite field.
DSWActor* ownerActor;
DSWActor()
{