- 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) void DSWActor::Serialize(FSerializer& arc)
{ {
Super::Serialize(arc); Super::Serialize(arc);
arc("hasuser", hasUser); arc("hasuser", hasUser)
("owner", ownerActor);
if (hasUser) arc("user", user); // only write if defined. 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[]; extern VOC_INFO voc[];
END_SW_NS END_SW_NS

View file

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

View file

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