- scriptified PowerBuddha and PowerFrightener.

This commit is contained in:
Christoph Oelckers 2017-01-03 21:03:05 +01:00
parent 15f30886cd
commit b132782c49
4 changed files with 66 additions and 120 deletions

View file

@ -1890,16 +1890,16 @@ static int PatchMisc (int dummy)
"Minotaur",
NULL
};
static const PClass * const *types[] =
static const char *const types[] =
{
&RUNTIME_CLASS_CASTLESS(APowerInvulnerable),
&RUNTIME_CLASS_CASTLESS(APowerStrength),
&RUNTIME_CLASS_CASTLESS(APowerInvisibility),
&RUNTIME_CLASS_CASTLESS(APowerIronFeet),
&RUNTIME_CLASS_CASTLESS(APowerLightAmp),
&RUNTIME_CLASS_CASTLESS(APowerWeaponLevel2),
&RUNTIME_CLASS_CASTLESS(APowerSpeed),
&RUNTIME_CLASS_CASTLESS(APowerMinotaur)
"PowerInvulnerable",
"PowerStrength",
"PowerInvisibility",
"PowerIronFeet",
"PowerLightAmp",
"PowerWeaponLevel2",
"PowerSpeed",
"PowerMinotaur"
};
int i;
@ -1925,7 +1925,7 @@ static int PatchMisc (int dummy)
}
else if (a > 0)
{
static_cast<APowerup *>(GetDefaultByType (*types[i]))->BlendColor = PalEntry(
static_cast<APowerup *>(GetDefaultByName (types[i]))->BlendColor = PalEntry(
BYTE(clamp(a,0.f,1.f)*255.f),
clamp(r,0,255),
clamp(g,0,255),
@ -1933,7 +1933,7 @@ static int PatchMisc (int dummy)
}
else
{
static_cast<APowerup *>(GetDefaultByType (*types[i]))->BlendColor = 0;
static_cast<APowerup *>(GetDefaultByName (types[i]))->BlendColor = 0;
}
}
}

View file

@ -1290,10 +1290,6 @@ void APowerSpeed::DoEffect ()
}
}
// Minotaur (aka Dark Servant) powerup ---------------------------------------
IMPLEMENT_CLASS(APowerMinotaur, false, false)
// Targeter powerup ---------------------------------------------------------
IMPLEMENT_CLASS(APowerTargeter, false, false)
@ -1409,78 +1405,6 @@ void APowerTargeter::PositionAccuracy ()
}
}
// Frightener Powerup --------------------------------
IMPLEMENT_CLASS(APowerFrightener, false, false)
//===========================================================================
//
// APowerFrightener :: InitEffect
//
//===========================================================================
void APowerFrightener::InitEffect ()
{
Super::InitEffect();
if (Owner== NULL || Owner->player == NULL)
return;
Owner->player->cheats |= CF_FRIGHTENING;
}
//===========================================================================
//
// APowerFrightener :: EndEffect
//
//===========================================================================
void APowerFrightener::EndEffect ()
{
Super::EndEffect();
if (Owner== NULL || Owner->player == NULL)
return;
Owner->player->cheats &= ~CF_FRIGHTENING;
}
// Buddha Powerup --------------------------------
IMPLEMENT_CLASS(APowerBuddha, false, false)
//===========================================================================
//
// APowerBuddha :: InitEffect
//
//===========================================================================
void APowerBuddha::InitEffect ()
{
Super::InitEffect();
if (Owner== NULL || Owner->player == NULL)
return;
Owner->player->cheats |= CF_BUDDHA;
}
//===========================================================================
//
// APowerBuddha :: EndEffect
//
//===========================================================================
void APowerBuddha::EndEffect ()
{
Super::EndEffect();
if (Owner== NULL || Owner->player == NULL)
return;
Owner->player->cheats &= ~CF_BUDDHA;
}
// Morph powerup ------------------------------------------------------
IMPLEMENT_CLASS(APowerMorph, false, true)

View file

@ -160,11 +160,6 @@ public:
#define PSF_NOTRAIL 1
class APowerMinotaur : public APowerup
{
DECLARE_CLASS (APowerMinotaur, APowerup)
};
class APowerTargeter : public APowerup
{
DECLARE_CLASS (APowerTargeter, APowerup)
@ -178,31 +173,6 @@ protected:
virtual bool HandlePickup(AInventory *item) override;
};
class APowerFrightener : public APowerup
{
DECLARE_CLASS (APowerFrightener, APowerup)
protected:
virtual void InitEffect () override;
virtual void EndEffect () override;
};
class APowerBuddha : public APowerup
{
DECLARE_CLASS (APowerBuddha, APowerup)
protected:
virtual void InitEffect () override;
virtual void EndEffect () override;
};
class APowerTimeFreezer : public APowerup
{
DECLARE_CLASS( APowerTimeFreezer, APowerup )
protected:
virtual void InitEffect() override;
virtual void DoEffect() override;
virtual void EndEffect() override;
};
class APowerMorph : public APowerup
{
DECLARE_CLASS( APowerMorph, APowerup )

View file

@ -169,7 +169,7 @@ class PlayerSpeedTrail : Actor
}
}
class PowerMinotaur : Powerup native
class PowerMinotaur : Powerup
{
Default
{
@ -197,20 +197,72 @@ class PowerTargeter : Powerup native
}
}
class PowerFrightener : Powerup native
//===========================================================================
//
// Frightener
//
//===========================================================================
class PowerFrightener : Powerup
{
Default
{
Powerup.Duration -60;
}
override void InitEffect ()
{
Super.InitEffect();
if (Owner== null || Owner.player == null)
return;
Owner.player.cheats |= CF_FRIGHTENING;
}
override void EndEffect ()
{
Super.EndEffect();
if (Owner== null || Owner.player == null)
return;
Owner.player.cheats &= ~CF_FRIGHTENING;
}
}
class PowerBuddha : Powerup native
//===========================================================================
//
// Buddha
//
//===========================================================================
class PowerBuddha : Powerup
{
Default
{
Powerup.Duration -60;
}
override void InitEffect ()
{
Super.InitEffect();
if (Owner== null || Owner.player == null)
return;
Owner.player.cheats |= CF_BUDDHA;
}
override void EndEffect ()
{
Super.EndEffect();
if (Owner== null || Owner.player == null)
return;
Owner.player.cheats &= ~CF_BUDDHA;
}
}
//===========================================================================