mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 17:01:28 +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
|
BEGIN_SW_NS
|
||||||
|
|
||||||
short DoRotatorMatch(PLAYERp pp, short match, bool);
|
void DoRotatorMatch(PLAYERp pp, short match, bool);
|
||||||
bool TestRotatorMatchActive(short match);
|
bool TestRotatorMatchActive(short match);
|
||||||
void InterpSectorSprites(short sectnum, bool state);
|
void InterpSectorSprites(short sectnum, bool state);
|
||||||
void DoMatchEverything(PLAYERp pp, short match, short state);
|
void DoMatchEverything(PLAYERp pp, short match, short state);
|
||||||
void DoRotatorSetInterp(short SpriteNum);
|
void DoRotatorSetInterp(DSWActor*);
|
||||||
void DoRotatorStopInterp(short SpriteNum);
|
void DoRotatorStopInterp(DSWActor*);
|
||||||
|
|
||||||
void ReverseRotator(DSWActor* actor)
|
void ReverseRotator(DSWActor* actor)
|
||||||
{
|
{
|
||||||
|
@ -101,7 +101,7 @@ void SetRotatorActive(DSWActor* actor)
|
||||||
|
|
||||||
r = u->rotator.Data();
|
r = u->rotator.Data();
|
||||||
|
|
||||||
DoRotatorSetInterp(actor->GetSpriteIndex());
|
DoRotatorSetInterp(actor);
|
||||||
|
|
||||||
// play activate sound
|
// play activate sound
|
||||||
DoSoundSpotMatch(SP_TAG2(sp), 1, SOUND_OBJECT_TYPE);
|
DoSoundSpotMatch(SP_TAG2(sp), 1, SOUND_OBJECT_TYPE);
|
||||||
|
@ -116,12 +116,12 @@ void SetRotatorActive(DSWActor* actor)
|
||||||
VatorSwitch(SP_TAG2(sp), ON);
|
VatorSwitch(SP_TAG2(sp), ON);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetRotatorInactive(short SpriteNum)
|
void SetRotatorInactive(DSWActor* actor)
|
||||||
{
|
{
|
||||||
USERp u = User[SpriteNum].Data();
|
USERp u = actor->u();
|
||||||
SPRITEp sp = u->SpriteP;
|
SPRITEp sp = &actor->s();
|
||||||
|
|
||||||
DoRotatorStopInterp(SpriteNum);
|
DoRotatorStopInterp(actor);
|
||||||
|
|
||||||
// play inactivate sound
|
// play inactivate sound
|
||||||
DoSoundSpotMatch(SP_TAG2(sp), 2, SOUND_OBJECT_TYPE);
|
DoSoundSpotMatch(SP_TAG2(sp), 2, SOUND_OBJECT_TYPE);
|
||||||
|
@ -130,27 +130,20 @@ void SetRotatorInactive(short SpriteNum)
|
||||||
}
|
}
|
||||||
|
|
||||||
// called for operation from the space bar
|
// called for operation from the space bar
|
||||||
short DoRotatorOperate(PLAYERp pp, short sectnum)
|
void DoRotatorOperate(PLAYERp pp, short sectnum)
|
||||||
{
|
{
|
||||||
short match;
|
short match = sector[sectnum].hitag;
|
||||||
|
|
||||||
match = sector[sectnum].hitag;
|
|
||||||
|
|
||||||
if (match > 0)
|
if (match > 0)
|
||||||
{
|
{
|
||||||
if (TestRotatorMatchActive(match))
|
if (!TestRotatorMatchActive(match))
|
||||||
return -1;
|
DoRotatorMatch(pp, match, true);
|
||||||
else
|
|
||||||
return DoRotatorMatch(pp, match, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// called from switches and triggers
|
// called from switches and triggers
|
||||||
// returns first vator found
|
// returns first vator found
|
||||||
short
|
void DoRotatorMatch(PLAYERp pp, short match, bool manual)
|
||||||
DoRotatorMatch(PLAYERp pp, short match, bool manual)
|
|
||||||
{
|
{
|
||||||
USERp fu;
|
USERp fu;
|
||||||
SPRITEp fsp;
|
SPRITEp fsp;
|
||||||
|
@ -197,7 +190,7 @@ DoRotatorMatch(PLAYERp pp, short match, bool manual)
|
||||||
|
|
||||||
{
|
{
|
||||||
PutStringInfo(pp, quoteMgr.GetQuote(QUOTE_DOORMSG + key_num - 1));
|
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);
|
SetRotatorActive(actor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return firstVator->GetSpriteIndex();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool TestRotatorMatchActive(short match)
|
||||||
TestRotatorMatchActive(short match)
|
|
||||||
{
|
{
|
||||||
USERp fu;
|
USERp fu;
|
||||||
SPRITEp fsp;
|
SPRITEp fsp;
|
||||||
|
|
||||||
int i;
|
SWStatIterator it(STAT_ROTATOR);
|
||||||
|
while (auto actor = it.Next())
|
||||||
StatIterator it(STAT_ROTATOR);
|
|
||||||
while ((i = it.NextIndex()) >= 0)
|
|
||||||
{
|
{
|
||||||
fsp = &sprite[i];
|
fsp = &actor->s();
|
||||||
|
|
||||||
if (SP_TAG1(fsp) == SECT_ROTATOR && SP_TAG2(fsp) == match)
|
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
|
// Does not have to be inactive to be operated
|
||||||
if (TEST_BOOL6(fsp))
|
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;
|
short w,startwall,endwall;
|
||||||
|
|
||||||
startwall = sector[sp->sectnum].wallptr;
|
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;
|
short w,startwall,endwall;
|
||||||
|
|
||||||
startwall = sector[sp->sectnum].wallptr;
|
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();
|
USERp u = actor->u();
|
||||||
SPRITEp sp = &actor->s();
|
SPRITEp sp = &actor->s();
|
||||||
ROTATORp r;
|
ROTATORp r;
|
||||||
|
@ -339,7 +326,7 @@ int DoRotatorMove(short SpriteNum)
|
||||||
// new tgt is CLOSED (0)
|
// new tgt is CLOSED (0)
|
||||||
r->tgt = 0;
|
r->tgt = 0;
|
||||||
r->vel = -r->vel;
|
r->vel = -r->vel;
|
||||||
SetRotatorInactive(SpriteNum);
|
SetRotatorInactive(actor);
|
||||||
|
|
||||||
if (SP_TAG6(sp))
|
if (SP_TAG6(sp))
|
||||||
DoMatchEverything(nullptr, SP_TAG6(sp), -1);
|
DoMatchEverything(nullptr, SP_TAG6(sp), -1);
|
||||||
|
@ -359,7 +346,7 @@ int DoRotatorMove(short SpriteNum)
|
||||||
r->speed = r->orig_speed;
|
r->speed = r->orig_speed;
|
||||||
r->vel = labs(r->vel);
|
r->vel = labs(r->vel);
|
||||||
|
|
||||||
SetRotatorInactive(SpriteNum);
|
SetRotatorInactive(actor);
|
||||||
|
|
||||||
// set owner swith back to OFF
|
// set owner swith back to OFF
|
||||||
// only if ALL vators are inactive
|
// only if ALL vators are inactive
|
||||||
|
@ -409,7 +396,7 @@ int DoRotatorMove(short SpriteNum)
|
||||||
|
|
||||||
if (kill)
|
if (kill)
|
||||||
{
|
{
|
||||||
SetRotatorInactive(SpriteNum);
|
SetRotatorInactive(actor);
|
||||||
KillActor(actor);
|
KillActor(actor);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -417,16 +404,6 @@ int DoRotatorMove(short SpriteNum)
|
||||||
return 0;
|
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"
|
#include "saveable.h"
|
||||||
|
|
||||||
|
|
|
@ -64,8 +64,8 @@ bool TestSlidorMatchActive(short match);
|
||||||
int PlayerCheckDeath(PLAYERp, short);
|
int PlayerCheckDeath(PLAYERp, short);
|
||||||
short DoVatorOperate(PLAYERp, short);
|
short DoVatorOperate(PLAYERp, short);
|
||||||
short DoVatorMatch(PLAYERp pp, short match);
|
short DoVatorMatch(PLAYERp pp, short match);
|
||||||
short DoRotatorOperate(PLAYERp, short);
|
void DoRotatorOperate(PLAYERp, short);
|
||||||
short DoRotatorMatch(PLAYERp pp, short match, bool);
|
void DoRotatorMatch(PLAYERp pp, short match, bool);
|
||||||
short DoSlidorOperate(PLAYERp, short);
|
short DoSlidorOperate(PLAYERp, short);
|
||||||
short DoSlidorMatch(PLAYERp pp, short match, bool);
|
short DoSlidorMatch(PLAYERp pp, short match, bool);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue