- added option to ASectorAction to remove itself upon triggering by setting the STANDSTILL flag on the map thing.

This commit is contained in:
Christoph Oelckers 2014-05-13 21:26:51 +02:00
parent 30f57c0b8e
commit e49e926bd9
2 changed files with 51 additions and 38 deletions

View file

@ -82,10 +82,22 @@ void ASectorAction::Deactivate (AActor *source)
flags2 |= MF2_DORMANT; // Projectiles can trigger flags2 |= MF2_DORMANT; // Projectiles can trigger
} }
bool ASectorAction::TriggerAction (AActor *triggerer, int activationType) bool ASectorAction::TriggerAction(AActor *triggerer, int activationType)
{
if (DoTriggerAction(triggerer, activationType))
{
if (flags4 & MF4_STANDSTILL)
{
Destroy();
}
}
return false;
}
bool ASectorAction::DoTriggerAction (AActor *triggerer, int activationType)
{ {
if (tracer != NULL) if (tracer != NULL)
return barrier_cast<ASectorAction *>(tracer)->TriggerAction (triggerer, activationType); return barrier_cast<ASectorAction *>(tracer)->DoTriggerAction (triggerer, activationType);
else else
return false; return false;
} }
@ -93,7 +105,7 @@ bool ASectorAction::TriggerAction (AActor *triggerer, int activationType)
bool ASectorAction::CheckTrigger (AActor *triggerer) const bool ASectorAction::CheckTrigger (AActor *triggerer) const
{ {
if (special && if (special &&
(triggerer->player || ((triggerer->player && !(flags & MF_FRIENDLY)) ||
((flags & MF_AMBUSH) && (triggerer->flags2 & MF2_MCROSS)) || ((flags & MF_AMBUSH) && (triggerer->flags2 & MF2_MCROSS)) ||
((flags2 & MF2_DORMANT) && (triggerer->flags2 & MF2_PCROSS)))) ((flags2 & MF2_DORMANT) && (triggerer->flags2 & MF2_PCROSS))))
{ {
@ -110,16 +122,16 @@ class ASecActEnter : public ASectorAction
{ {
DECLARE_CLASS (ASecActEnter, ASectorAction) DECLARE_CLASS (ASecActEnter, ASectorAction)
public: public:
bool TriggerAction (AActor *triggerer, int activationType); bool DoTriggerAction (AActor *triggerer, int activationType);
}; };
IMPLEMENT_CLASS (ASecActEnter) IMPLEMENT_CLASS (ASecActEnter)
bool ASecActEnter::TriggerAction (AActor *triggerer, int activationType) bool ASecActEnter::DoTriggerAction (AActor *triggerer, int activationType)
{ {
bool didit = (activationType & SECSPAC_Enter) ? CheckTrigger (triggerer) : false; bool didit = (activationType & SECSPAC_Enter) ? CheckTrigger (triggerer) : false;
return didit | Super::TriggerAction (triggerer, activationType); return didit | Super::DoTriggerAction (triggerer, activationType);
} }
// Triggered when leaving sector -------------------------------------------- // Triggered when leaving sector --------------------------------------------
@ -128,16 +140,16 @@ class ASecActExit : public ASectorAction
{ {
DECLARE_CLASS (ASecActExit, ASectorAction) DECLARE_CLASS (ASecActExit, ASectorAction)
public: public:
bool TriggerAction (AActor *triggerer, int activationType); bool DoTriggerAction (AActor *triggerer, int activationType);
}; };
IMPLEMENT_CLASS (ASecActExit) IMPLEMENT_CLASS (ASecActExit)
bool ASecActExit::TriggerAction (AActor *triggerer, int activationType) bool ASecActExit::DoTriggerAction (AActor *triggerer, int activationType)
{ {
bool didit = (activationType & SECSPAC_Exit) ? CheckTrigger (triggerer) : false; bool didit = (activationType & SECSPAC_Exit) ? CheckTrigger (triggerer) : false;
return didit | Super::TriggerAction (triggerer, activationType); return didit | Super::DoTriggerAction (triggerer, activationType);
} }
// Triggered when hitting sector's floor ------------------------------------ // Triggered when hitting sector's floor ------------------------------------
@ -146,7 +158,7 @@ class ASecActHitFloor : public ASectorAction
{ {
DECLARE_CLASS (ASecActHitFloor, ASectorAction) DECLARE_CLASS (ASecActHitFloor, ASectorAction)
public: public:
bool TriggerAction (AActor *triggerer, int activationType); bool DoTriggerAction (AActor *triggerer, int activationType);
}; };
// Skull Tag uses 9999 for a special that is triggered whenever // Skull Tag uses 9999 for a special that is triggered whenever
@ -154,10 +166,10 @@ public:
IMPLEMENT_CLASS (ASecActHitFloor) IMPLEMENT_CLASS (ASecActHitFloor)
bool ASecActHitFloor::TriggerAction (AActor *triggerer, int activationType) bool ASecActHitFloor::DoTriggerAction (AActor *triggerer, int activationType)
{ {
bool didit = (activationType & SECSPAC_HitFloor) ? CheckTrigger (triggerer) : false; bool didit = (activationType & SECSPAC_HitFloor) ? CheckTrigger (triggerer) : false;
return didit | Super::TriggerAction (triggerer, activationType); return didit | Super::DoTriggerAction (triggerer, activationType);
} }
// Triggered when hitting sector's ceiling ---------------------------------- // Triggered when hitting sector's ceiling ----------------------------------
@ -166,16 +178,16 @@ class ASecActHitCeil : public ASectorAction
{ {
DECLARE_CLASS (ASecActHitCeil, ASectorAction) DECLARE_CLASS (ASecActHitCeil, ASectorAction)
public: public:
bool TriggerAction (AActor *triggerer, int activationType); bool DoTriggerAction (AActor *triggerer, int activationType);
}; };
IMPLEMENT_CLASS (ASecActHitCeil) IMPLEMENT_CLASS (ASecActHitCeil)
bool ASecActHitCeil::TriggerAction (AActor *triggerer, int activationType) bool ASecActHitCeil::DoTriggerAction (AActor *triggerer, int activationType)
{ {
bool didit = (activationType & SECSPAC_HitCeiling) ? CheckTrigger (triggerer) : false; bool didit = (activationType & SECSPAC_HitCeiling) ? CheckTrigger (triggerer) : false;
return didit | Super::TriggerAction (triggerer, activationType); return didit | Super::DoTriggerAction (triggerer, activationType);
} }
// Triggered when using inside sector --------------------------------------- // Triggered when using inside sector ---------------------------------------
@ -184,16 +196,16 @@ class ASecActUse : public ASectorAction
{ {
DECLARE_CLASS (ASecActUse, ASectorAction) DECLARE_CLASS (ASecActUse, ASectorAction)
public: public:
bool TriggerAction (AActor *triggerer, int activationType); bool DoTriggerAction (AActor *triggerer, int activationType);
}; };
IMPLEMENT_CLASS (ASecActUse) IMPLEMENT_CLASS (ASecActUse)
bool ASecActUse::TriggerAction (AActor *triggerer, int activationType) bool ASecActUse::DoTriggerAction (AActor *triggerer, int activationType)
{ {
bool didit = (activationType & SECSPAC_Use) ? CheckTrigger (triggerer) : false; bool didit = (activationType & SECSPAC_Use) ? CheckTrigger (triggerer) : false;
return didit | Super::TriggerAction (triggerer, activationType); return didit | Super::DoTriggerAction (triggerer, activationType);
} }
// Triggered when using a sector's wall ------------------------------------- // Triggered when using a sector's wall -------------------------------------
@ -202,16 +214,16 @@ class ASecActUseWall : public ASectorAction
{ {
DECLARE_CLASS (ASecActUseWall, ASectorAction) DECLARE_CLASS (ASecActUseWall, ASectorAction)
public: public:
bool TriggerAction (AActor *triggerer, int activationType); bool DoTriggerAction (AActor *triggerer, int activationType);
}; };
IMPLEMENT_CLASS (ASecActUseWall) IMPLEMENT_CLASS (ASecActUseWall)
bool ASecActUseWall::TriggerAction (AActor *triggerer, int activationType) bool ASecActUseWall::DoTriggerAction (AActor *triggerer, int activationType)
{ {
bool didit = (activationType & SECSPAC_UseWall) ? CheckTrigger (triggerer) : false; bool didit = (activationType & SECSPAC_UseWall) ? CheckTrigger (triggerer) : false;
return didit | Super::TriggerAction (triggerer, activationType); return didit | Super::DoTriggerAction (triggerer, activationType);
} }
// Triggered when eyes go below fake floor ---------------------------------- // Triggered when eyes go below fake floor ----------------------------------
@ -220,16 +232,16 @@ class ASecActEyesDive : public ASectorAction
{ {
DECLARE_CLASS (ASecActEyesDive, ASectorAction) DECLARE_CLASS (ASecActEyesDive, ASectorAction)
public: public:
bool TriggerAction (AActor *triggerer, int activationType); bool DoTriggerAction (AActor *triggerer, int activationType);
}; };
IMPLEMENT_CLASS (ASecActEyesDive) IMPLEMENT_CLASS (ASecActEyesDive)
bool ASecActEyesDive::TriggerAction (AActor *triggerer, int activationType) bool ASecActEyesDive::DoTriggerAction (AActor *triggerer, int activationType)
{ {
bool didit = (activationType & SECSPAC_EyesDive) ? CheckTrigger (triggerer) : false; bool didit = (activationType & SECSPAC_EyesDive) ? CheckTrigger (triggerer) : false;
return didit | Super::TriggerAction (triggerer, activationType); return didit | Super::DoTriggerAction (triggerer, activationType);
} }
// Triggered when eyes go above fake floor ---------------------------------- // Triggered when eyes go above fake floor ----------------------------------
@ -238,16 +250,16 @@ class ASecActEyesSurface : public ASectorAction
{ {
DECLARE_CLASS (ASecActEyesSurface, ASectorAction) DECLARE_CLASS (ASecActEyesSurface, ASectorAction)
public: public:
bool TriggerAction (AActor *triggerer, int activationType); bool DoTriggerAction (AActor *triggerer, int activationType);
}; };
IMPLEMENT_CLASS (ASecActEyesSurface) IMPLEMENT_CLASS (ASecActEyesSurface)
bool ASecActEyesSurface::TriggerAction (AActor *triggerer, int activationType) bool ASecActEyesSurface::DoTriggerAction (AActor *triggerer, int activationType)
{ {
bool didit = (activationType & SECSPAC_EyesSurface) ? CheckTrigger (triggerer) : false; bool didit = (activationType & SECSPAC_EyesSurface) ? CheckTrigger (triggerer) : false;
return didit | Super::TriggerAction (triggerer, activationType); return didit | Super::DoTriggerAction (triggerer, activationType);
} }
// Triggered when eyes go below fake floor ---------------------------------- // Triggered when eyes go below fake floor ----------------------------------
@ -256,16 +268,16 @@ class ASecActEyesBelowC : public ASectorAction
{ {
DECLARE_CLASS (ASecActEyesBelowC, ASectorAction) DECLARE_CLASS (ASecActEyesBelowC, ASectorAction)
public: public:
bool TriggerAction (AActor *triggerer, int activationType); bool DoTriggerAction (AActor *triggerer, int activationType);
}; };
IMPLEMENT_CLASS (ASecActEyesBelowC) IMPLEMENT_CLASS (ASecActEyesBelowC)
bool ASecActEyesBelowC::TriggerAction (AActor *triggerer, int activationType) bool ASecActEyesBelowC::DoTriggerAction (AActor *triggerer, int activationType)
{ {
bool didit = (activationType & SECSPAC_EyesBelowC) ? CheckTrigger (triggerer) : false; bool didit = (activationType & SECSPAC_EyesBelowC) ? CheckTrigger (triggerer) : false;
return didit | Super::TriggerAction (triggerer, activationType); return didit | Super::DoTriggerAction (triggerer, activationType);
} }
// Triggered when eyes go above fake floor ---------------------------------- // Triggered when eyes go above fake floor ----------------------------------
@ -274,16 +286,16 @@ class ASecActEyesAboveC : public ASectorAction
{ {
DECLARE_CLASS (ASecActEyesAboveC, ASectorAction) DECLARE_CLASS (ASecActEyesAboveC, ASectorAction)
public: public:
bool TriggerAction (AActor *triggerer, int activationType); bool DoTriggerAction (AActor *triggerer, int activationType);
}; };
IMPLEMENT_CLASS (ASecActEyesAboveC) IMPLEMENT_CLASS (ASecActEyesAboveC)
bool ASecActEyesAboveC::TriggerAction (AActor *triggerer, int activationType) bool ASecActEyesAboveC::DoTriggerAction (AActor *triggerer, int activationType)
{ {
bool didit = (activationType & SECSPAC_EyesAboveC) ? CheckTrigger (triggerer) : false; bool didit = (activationType & SECSPAC_EyesAboveC) ? CheckTrigger (triggerer) : false;
return didit | Super::TriggerAction (triggerer, activationType); return didit | Super::DoTriggerAction (triggerer, activationType);
} }
// Triggered when eyes go below fake floor ---------------------------------- // Triggered when eyes go below fake floor ----------------------------------
@ -292,14 +304,14 @@ class ASecActHitFakeFloor : public ASectorAction
{ {
DECLARE_CLASS (ASecActHitFakeFloor, ASectorAction) DECLARE_CLASS (ASecActHitFakeFloor, ASectorAction)
public: public:
bool TriggerAction (AActor *triggerer, int activationType); bool DoTriggerAction (AActor *triggerer, int activationType);
}; };
IMPLEMENT_CLASS (ASecActHitFakeFloor) IMPLEMENT_CLASS (ASecActHitFakeFloor)
bool ASecActHitFakeFloor::TriggerAction (AActor *triggerer, int activationType) bool ASecActHitFakeFloor::DoTriggerAction (AActor *triggerer, int activationType)
{ {
bool didit = (activationType & SECSPAC_HitFakeFloor) ? CheckTrigger (triggerer) : false; bool didit = (activationType & SECSPAC_HitFakeFloor) ? CheckTrigger (triggerer) : false;
return didit | Super::TriggerAction (triggerer, activationType); return didit | Super::DoTriggerAction (triggerer, activationType);
} }

View file

@ -198,9 +198,10 @@ public:
void BeginPlay (); void BeginPlay ();
void Activate (AActor *source); void Activate (AActor *source);
void Deactivate (AActor *source); void Deactivate (AActor *source);
virtual bool TriggerAction (AActor *triggerer, int activationType); bool TriggerAction(AActor *triggerer, int activationType);
protected: protected:
bool CheckTrigger (AActor *triggerer) const; virtual bool DoTriggerAction(AActor *triggerer, int activationType);
bool CheckTrigger(AActor *triggerer) const;
}; };
class ASkyViewpoint; class ASkyViewpoint;