mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 08:51:24 +00:00
- rest of rotator.cpp.
This commit is contained in:
parent
1388794032
commit
cfebfbca8a
2 changed files with 29 additions and 52 deletions
|
@ -38,12 +38,12 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
|
|||
|
||||
BEGIN_SW_NS
|
||||
|
||||
short DoRotatorMatch(PLAYERp pp, short match, bool);
|
||||
void DoRotatorMatch(PLAYERp pp, short match, bool);
|
||||
bool TestRotatorMatchActive(short match);
|
||||
void InterpSectorSprites(short sectnum, bool state);
|
||||
void DoMatchEverything(PLAYERp pp, short match, short state);
|
||||
void DoRotatorSetInterp(short SpriteNum);
|
||||
void DoRotatorStopInterp(short SpriteNum);
|
||||
void DoRotatorSetInterp(DSWActor*);
|
||||
void DoRotatorStopInterp(DSWActor*);
|
||||
|
||||
void ReverseRotator(DSWActor* actor)
|
||||
{
|
||||
|
@ -101,7 +101,7 @@ void SetRotatorActive(DSWActor* actor)
|
|||
|
||||
r = u->rotator.Data();
|
||||
|
||||
DoRotatorSetInterp(actor->GetSpriteIndex());
|
||||
DoRotatorSetInterp(actor);
|
||||
|
||||
// play activate sound
|
||||
DoSoundSpotMatch(SP_TAG2(sp), 1, SOUND_OBJECT_TYPE);
|
||||
|
@ -116,12 +116,12 @@ void SetRotatorActive(DSWActor* actor)
|
|||
VatorSwitch(SP_TAG2(sp), ON);
|
||||
}
|
||||
|
||||
void SetRotatorInactive(short SpriteNum)
|
||||
void SetRotatorInactive(DSWActor* actor)
|
||||
{
|
||||
USERp u = User[SpriteNum].Data();
|
||||
SPRITEp sp = u->SpriteP;
|
||||
USERp u = actor->u();
|
||||
SPRITEp sp = &actor->s();
|
||||
|
||||
DoRotatorStopInterp(SpriteNum);
|
||||
DoRotatorStopInterp(actor);
|
||||
|
||||
// play inactivate sound
|
||||
DoSoundSpotMatch(SP_TAG2(sp), 2, SOUND_OBJECT_TYPE);
|
||||
|
@ -130,27 +130,20 @@ void SetRotatorInactive(short SpriteNum)
|
|||
}
|
||||
|
||||
// called for operation from the space bar
|
||||
short DoRotatorOperate(PLAYERp pp, short sectnum)
|
||||
void DoRotatorOperate(PLAYERp pp, short sectnum)
|
||||
{
|
||||
short match;
|
||||
|
||||
match = sector[sectnum].hitag;
|
||||
short match = sector[sectnum].hitag;
|
||||
|
||||
if (match > 0)
|
||||
{
|
||||
if (TestRotatorMatchActive(match))
|
||||
return -1;
|
||||
else
|
||||
return DoRotatorMatch(pp, match, true);
|
||||
if (!TestRotatorMatchActive(match))
|
||||
DoRotatorMatch(pp, match, true);
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
// called from switches and triggers
|
||||
// returns first vator found
|
||||
short
|
||||
DoRotatorMatch(PLAYERp pp, short match, bool manual)
|
||||
void DoRotatorMatch(PLAYERp pp, short match, bool manual)
|
||||
{
|
||||
USERp fu;
|
||||
SPRITEp fsp;
|
||||
|
@ -197,7 +190,7 @@ DoRotatorMatch(PLAYERp pp, short match, bool manual)
|
|||
|
||||
{
|
||||
PutStringInfo(pp, quoteMgr.GetQuote(QUOTE_DOORMSG + key_num - 1));
|
||||
return -1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -210,27 +203,22 @@ DoRotatorMatch(PLAYERp pp, short match, bool manual)
|
|||
SetRotatorActive(actor);
|
||||
}
|
||||
}
|
||||
|
||||
return firstVator->GetSpriteIndex();
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
TestRotatorMatchActive(short match)
|
||||
bool TestRotatorMatchActive(short match)
|
||||
{
|
||||
USERp fu;
|
||||
SPRITEp fsp;
|
||||
|
||||
int i;
|
||||
|
||||
StatIterator it(STAT_ROTATOR);
|
||||
while ((i = it.NextIndex()) >= 0)
|
||||
SWStatIterator it(STAT_ROTATOR);
|
||||
while (auto actor = it.Next())
|
||||
{
|
||||
fsp = &sprite[i];
|
||||
fsp = &actor->s();
|
||||
|
||||
if (SP_TAG1(fsp) == SECT_ROTATOR && SP_TAG2(fsp) == match)
|
||||
{
|
||||
fu = User[i].Data();
|
||||
fu = actor->u();
|
||||
|
||||
// Does not have to be inactive to be operated
|
||||
if (TEST_BOOL6(fsp))
|
||||
|
@ -245,9 +233,9 @@ TestRotatorMatchActive(short match)
|
|||
}
|
||||
|
||||
|
||||
void DoRotatorSetInterp(short SpriteNum)
|
||||
void DoRotatorSetInterp(DSWActor* actor)
|
||||
{
|
||||
SPRITEp sp = &sprite[SpriteNum];
|
||||
SPRITEp sp = &actor->s();
|
||||
short w,startwall,endwall;
|
||||
|
||||
startwall = sector[sp->sectnum].wallptr;
|
||||
|
@ -268,9 +256,9 @@ void DoRotatorSetInterp(short SpriteNum)
|
|||
}
|
||||
}
|
||||
|
||||
void DoRotatorStopInterp(short SpriteNum)
|
||||
void DoRotatorStopInterp(DSWActor* actor)
|
||||
{
|
||||
SPRITEp sp = &sprite[SpriteNum];
|
||||
SPRITEp sp = &actor->s();
|
||||
short w,startwall,endwall;
|
||||
|
||||
startwall = sector[sp->sectnum].wallptr;
|
||||
|
@ -291,9 +279,8 @@ void DoRotatorStopInterp(short SpriteNum)
|
|||
}
|
||||
}
|
||||
|
||||
int DoRotatorMove(short SpriteNum)
|
||||
int DoRotator(DSWActor* actor)
|
||||
{
|
||||
auto actor = &swActors[SpriteNum];
|
||||
USERp u = actor->u();
|
||||
SPRITEp sp = &actor->s();
|
||||
ROTATORp r;
|
||||
|
@ -339,7 +326,7 @@ int DoRotatorMove(short SpriteNum)
|
|||
// new tgt is CLOSED (0)
|
||||
r->tgt = 0;
|
||||
r->vel = -r->vel;
|
||||
SetRotatorInactive(SpriteNum);
|
||||
SetRotatorInactive(actor);
|
||||
|
||||
if (SP_TAG6(sp))
|
||||
DoMatchEverything(nullptr, SP_TAG6(sp), -1);
|
||||
|
@ -359,7 +346,7 @@ int DoRotatorMove(short SpriteNum)
|
|||
r->speed = r->orig_speed;
|
||||
r->vel = labs(r->vel);
|
||||
|
||||
SetRotatorInactive(SpriteNum);
|
||||
SetRotatorInactive(actor);
|
||||
|
||||
// set owner swith back to OFF
|
||||
// only if ALL vators are inactive
|
||||
|
@ -409,7 +396,7 @@ int DoRotatorMove(short SpriteNum)
|
|||
|
||||
if (kill)
|
||||
{
|
||||
SetRotatorInactive(SpriteNum);
|
||||
SetRotatorInactive(actor);
|
||||
KillActor(actor);
|
||||
return 0;
|
||||
}
|
||||
|
@ -417,16 +404,6 @@ int DoRotatorMove(short SpriteNum)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int DoRotator(DSWActor* actor)
|
||||
{
|
||||
USER* u = actor->u();
|
||||
int SpriteNum = u->SpriteNum;
|
||||
|
||||
// could move this inside sprite control
|
||||
DoRotatorMove(SpriteNum);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include "saveable.h"
|
||||
|
||||
|
|
|
@ -64,8 +64,8 @@ bool TestSlidorMatchActive(short match);
|
|||
int PlayerCheckDeath(PLAYERp, short);
|
||||
short DoVatorOperate(PLAYERp, short);
|
||||
short DoVatorMatch(PLAYERp pp, short match);
|
||||
short DoRotatorOperate(PLAYERp, short);
|
||||
short DoRotatorMatch(PLAYERp pp, short match, bool);
|
||||
void DoRotatorOperate(PLAYERp, short);
|
||||
void DoRotatorMatch(PLAYERp pp, short match, bool);
|
||||
short DoSlidorOperate(PLAYERp, short);
|
||||
short DoSlidorMatch(PLAYERp pp, short match, bool);
|
||||
|
||||
|
|
Loading…
Reference in a new issue