- scriptified the sector actions.

This commit is contained in:
Christoph Oelckers 2017-01-13 13:51:47 +01:00
commit d338ca3ec1
13 changed files with 141 additions and 187 deletions

View file

@ -2457,45 +2457,3 @@ void S_ParseMusInfo()
}
//==========================================================================
//
// Music changer. Uses the sector action class to do its job
//
//==========================================================================
class AMusicChanger : public ASectorAction
{
DECLARE_CLASS (AMusicChanger, ASectorAction)
public:
virtual bool DoTriggerAction (AActor *triggerer, int activationType);
virtual void PostBeginPlay();
};
IMPLEMENT_CLASS(AMusicChanger, false, false)
bool AMusicChanger::DoTriggerAction (AActor *triggerer, int activationType)
{
if (activationType & SECSPAC_Enter && triggerer->player != NULL)
{
if (triggerer->player->MUSINFOactor != this)
{
triggerer->player->MUSINFOactor = this;
triggerer->player->MUSINFOtics = 30;
}
}
return false;
}
void AMusicChanger::PostBeginPlay()
{
// The music changer should consider itself activated if the player
// spawns in its sector as well as if it enters the sector during a P_TryMove.
Super::PostBeginPlay();
for (int i = 0; i < MAXPLAYERS; ++i)
{
if (playeringame[i] && players[i].mo && players[i].mo->Sector == this->Sector)
{
DoTriggerAction(players[i].mo, SECSPAC_Enter);
}
}
}