- handle u-> in rotator.cpp

This commit is contained in:
Christoph Oelckers 2021-12-25 23:16:26 +01:00
parent be1d53db56
commit 65b9841666

View file

@ -46,15 +46,14 @@ void DoRotatorStopInterp(DSWActor*);
void ReverseRotator(DSWActor* actor) void ReverseRotator(DSWActor* actor)
{ {
USERp u = actor->u();
ROTATORp r; ROTATORp r;
r = u->rotator.Data(); r = actor->user.rotator.Data();
// if paused go ahead and start it up again // if paused go ahead and start it up again
if (u->Tics) if (actor->user.Tics)
{ {
u->Tics = 0; actor->user.Tics = 0;
SetRotatorActive(actor); SetRotatorActive(actor);
return; return;
} }
@ -91,18 +90,17 @@ bool RotatorSwitch(short match, short setting)
void SetRotatorActive(DSWActor* actor) void SetRotatorActive(DSWActor* actor)
{ {
USERp u = actor->u();
ROTATORp r; ROTATORp r;
r = u->rotator.Data(); r = actor->user.rotator.Data();
DoRotatorSetInterp(actor); DoRotatorSetInterp(actor);
// play activate sound // play activate sound
DoSoundSpotMatch(SP_TAG2(actor), 1, SOUND_OBJECT_TYPE); DoSoundSpotMatch(SP_TAG2(actor), 1, SOUND_OBJECT_TYPE);
SET(u->Flags, SPR_ACTIVE); SET(actor->user.Flags, SPR_ACTIVE);
u->Tics = 0; actor->user.Tics = 0;
// moving to the OFF position // moving to the OFF position
if (r->tgt == 0) if (r->tgt == 0)
@ -113,14 +111,12 @@ void SetRotatorActive(DSWActor* actor)
void SetRotatorInactive(DSWActor* actor) void SetRotatorInactive(DSWActor* actor)
{ {
USERp u = actor->u();
DoRotatorStopInterp(actor); DoRotatorStopInterp(actor);
// play inactivate sound // play inactivate sound
DoSoundSpotMatch(SP_TAG2(actor), 2, SOUND_OBJECT_TYPE); DoSoundSpotMatch(SP_TAG2(actor), 2, SOUND_OBJECT_TYPE);
RESET(u->Flags, SPR_ACTIVE); RESET(actor->user.Flags, SPR_ACTIVE);
} }
// called for operation from the space bar // called for operation from the space bar
@ -139,7 +135,6 @@ void DoRotatorOperate(PLAYERp pp, sectortype* sect)
// returns first vator found // returns first vator found
void DoRotatorMatch(PLAYERp pp, short match, bool manual) void DoRotatorMatch(PLAYERp pp, short match, bool manual)
{ {
USERp fu;
DSWActor* firstVator = nullptr; DSWActor* firstVator = nullptr;
//RotatorSwitch(match, ON); //RotatorSwitch(match, ON);
@ -149,8 +144,6 @@ void DoRotatorMatch(PLAYERp pp, short match, bool manual)
{ {
if (SP_TAG1(actor) == SECT_ROTATOR && SP_TAG2(actor) == match) if (SP_TAG1(actor) == SECT_ROTATOR && SP_TAG2(actor) == match)
{ {
fu = actor->u();
// single play only vator // single play only vator
// bool 8 must be set for message to display // bool 8 must be set for message to display
if (TEST_BOOL4(actor) && (gNet.MultiGameType == MULTI_GAME_COMMBAT || gNet.MultiGameType == MULTI_GAME_AI_BOTS)) if (TEST_BOOL4(actor) && (gNet.MultiGameType == MULTI_GAME_COMMBAT || gNet.MultiGameType == MULTI_GAME_AI_BOTS))
@ -182,7 +175,7 @@ void DoRotatorMatch(PLAYERp pp, short match, bool manual)
} }
} }
if (TEST(fu->Flags, SPR_ACTIVE)) if (TEST(actor->user.Flags, SPR_ACTIVE))
{ {
ReverseRotator(actor); ReverseRotator(actor);
continue; continue;
@ -196,7 +189,6 @@ void DoRotatorMatch(PLAYERp pp, short match, bool manual)
bool TestRotatorMatchActive(short match) bool TestRotatorMatchActive(short match)
{ {
USERp fu;
SPRITEp fsp; SPRITEp fsp;
SWStatIterator it(STAT_ROTATOR); SWStatIterator it(STAT_ROTATOR);
@ -204,13 +196,11 @@ bool TestRotatorMatchActive(short match)
{ {
if (SP_TAG1(actor) == SECT_ROTATOR && SP_TAG2(actor) == match) if (SP_TAG1(actor) == SECT_ROTATOR && SP_TAG2(actor) == match)
{ {
fu = actor->u();
// Does not have to be inactive to be operated // Does not have to be inactive to be operated
if (TEST_BOOL6(actor)) if (TEST_BOOL6(actor))
continue; continue;
if (TEST(fu->Flags, SPR_ACTIVE) || fu->Tics) if (TEST(actor->user.Flags, SPR_ACTIVE) || actor->user.Tics)
return true; return true;
} }
} }
@ -253,7 +243,6 @@ void DoRotatorStopInterp(DSWActor* actor)
int DoRotator(DSWActor* actor) int DoRotator(DSWActor* actor)
{ {
USERp u = actor->u();
ROTATORp r; ROTATORp r;
short ndx,w,startwall,endwall; short ndx,w,startwall,endwall;
DSWActor* pivot = nullptr; DSWActor* pivot = nullptr;
@ -261,7 +250,7 @@ int DoRotator(DSWActor* actor)
int dist,closest; int dist,closest;
bool kill = false; bool kill = false;
r = u->rotator.Data(); r = actor->user.rotator.Data();
// Example - ang pos moves from 0 to 512 <<OR>> from 0 to -512 // Example - ang pos moves from 0 to 512 <<OR>> from 0 to -512
@ -302,8 +291,8 @@ int DoRotator(DSWActor* actor)
DoMatchEverything(nullptr, SP_TAG6(actor), -1); DoMatchEverything(nullptr, SP_TAG6(actor), -1);
// wait a bit and close it // wait a bit and close it
if (u->WaitTics) if (actor->user.WaitTics)
u->Tics = u->WaitTics; actor->user.Tics = actor->user.WaitTics;
} }
else else
// If ang is CLOSED then // If ang is CLOSED then