- Scriptified Heretic's knight.

This commit is contained in:
Christoph Oelckers 2016-11-11 22:14:29 +01:00
commit a5f9eb5be1
7 changed files with 55 additions and 78 deletions

View file

@ -857,7 +857,6 @@ set( NOT_COMPILED_SOURCE_FILES
g_heretic/a_hereticartifacts.cpp
g_heretic/a_hereticweaps.cpp
g_heretic/a_ironlich.cpp
g_heretic/a_knight.cpp
g_heretic/a_wizard.cpp
g_hexen/a_bats.cpp
g_hexen/a_bishop.cpp

View file

@ -26,7 +26,6 @@
#include "a_hereticartifacts.cpp"
#include "a_hereticweaps.cpp"
#include "a_ironlich.cpp"
#include "a_knight.cpp"
#include "a_wizard.cpp"

View file

@ -1,70 +0,0 @@
/*
#include "actor.h"
#include "info.h"
#include "m_random.h"
#include "s_sound.h"
#include "p_local.h"
#include "a_action.h"
#include "a_sharedglobal.h"
#include "gstrings.h"
#include "vm.h"
*/
static FRandom pr_dripblood ("DripBlood");
static FRandom pr_knightatk ("KnightAttack");
//----------------------------------------------------------------------------
//
// PROC A_DripBlood
//
//----------------------------------------------------------------------------
DEFINE_ACTION_FUNCTION(AActor, A_DripBlood)
{
PARAM_SELF_PROLOGUE(AActor);
AActor *mo;
double xo = pr_dripblood.Random2() / 32.;
double yo = pr_dripblood.Random2() / 32.;
mo = Spawn ("Blood", self->Vec3Offset(xo, yo, 0.), ALLOW_REPLACE);
mo->Vel.X = pr_dripblood.Random2 () / 64.;
mo->Vel.Y = pr_dripblood.Random2() / 64.;
mo->Gravity = 1./8;
return 0;
}
//----------------------------------------------------------------------------
//
// PROC A_KnightAttack
//
//----------------------------------------------------------------------------
DEFINE_ACTION_FUNCTION(AActor, A_KnightAttack)
{
PARAM_SELF_PROLOGUE(AActor);
if (!self->target)
{
return 0;
}
if (self->CheckMeleeRange ())
{
int damage = pr_knightatk.HitDice (3);
int newdam = P_DamageMobj (self->target, self, self, damage, NAME_Melee);
P_TraceBleed (newdam > 0 ? newdam : damage, self->target, self);
S_Sound (self, CHAN_BODY, "hknight/melee", 1, ATTN_NORM);
return 0;
}
// Throw axe
S_Sound (self, CHAN_BODY, self->AttackSound, 1, ATTN_NORM);
if (self->flags & MF_SHADOW || pr_knightatk () < 40)
{ // Red axe
P_SpawnMissileZ (self, self->Z() + 36, self->target, PClass::FindActor("RedAxe"));
return 0;
}
// Green axe
P_SpawnMissileZ (self, self->Z() + 36, self->target, PClass::FindActor("KnightAxe"));
return 0;
}

View file

@ -6077,6 +6077,15 @@ AActor *P_SpawnMissileZ (AActor *source, double z, AActor *dest, PClassActor *ty
return P_SpawnMissileXYZ (source->PosAtZ(z), source, dest, type);
}
DEFINE_ACTION_FUNCTION(AActor, SpawnMissileZ)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_FLOAT(z);
PARAM_OBJECT(dest, AActor);
PARAM_CLASS(type, AActor);
ACTION_RETURN_OBJECT(P_SpawnMissileZ(self, z, dest, type));
}
AActor *P_SpawnMissileXYZ (DVector3 pos, AActor *source, AActor *dest, PClassActor *type, bool checkspawn, AActor *owner)
{
if (source == NULL)

View file

@ -7000,7 +7000,7 @@ FxExpression *FxSequence::Resolve(FCompileContext &ctx)
{
fail = true;
}
if (Expressions[i]->ValueType == TypeError)
else if (Expressions[i]->ValueType == TypeError)
{
ScriptPosition.Message(MSG_ERROR, "Invalid statement");
fail = true;