- scriptified the code for the Demon and DoomImp.

This commit is contained in:
Christoph Oelckers 2016-10-25 14:41:58 +02:00
parent 576fc0c237
commit 6d0dad3b38
7 changed files with 46 additions and 73 deletions

View file

@ -837,8 +837,6 @@ set( NOT_COMPILED_SOURCE_FILES
sc_man_scanner.re
g_doom/a_archvile.cpp
g_doom/a_bossbrain.cpp
g_doom/a_demon.cpp
g_doom/a_doomimp.cpp
g_doom/a_doomweaps.cpp
g_doom/a_fatso.cpp
g_doom/a_keen.cpp

View file

@ -1,29 +0,0 @@
/*
#include "actor.h"
#include "info.h"
#include "m_random.h"
#include "p_local.h"
#include "p_enemy.h"
#include "gstrings.h"
#include "a_action.h"
#include "vm.h"
*/
static FRandom pr_sargattack ("SargAttack");
DEFINE_ACTION_FUNCTION(AActor, A_SargAttack)
{
PARAM_SELF_PROLOGUE(AActor);
if (!self->target)
return 0;
A_FaceTarget (self);
if (self->CheckMeleeRange ())
{
int damage = ((pr_sargattack()%10)+1)*4;
int newdam = P_DamageMobj (self->target, self, self, damage, NAME_Melee);
P_TraceBleed (newdam > 0 ? newdam : damage, self->target, self);
}
return 0;
}

View file

@ -1,38 +0,0 @@
/*
#include "actor.h"
#include "info.h"
#include "m_random.h"
#include "s_sound.h"
#include "p_local.h"
#include "p_enemy.h"
#include "gstrings.h"
#include "a_action.h"
#include "vm.h"
*/
static FRandom pr_troopattack ("TroopAttack");
//
// A_TroopAttack
//
DEFINE_ACTION_FUNCTION(AActor, A_TroopAttack)
{
PARAM_SELF_PROLOGUE(AActor);
if (!self->target)
return 0;
A_FaceTarget (self);
if (self->CheckMeleeRange ())
{
int damage = (pr_troopattack()%8+1)*3;
S_Sound (self, CHAN_WEAPON, "imp/melee", 1, ATTN_NORM);
int newdam = P_DamageMobj (self->target, self, self, damage, NAME_Melee);
P_TraceBleed (newdam > 0 ? newdam : damage, self->target, self);
return 0;
}
// launch a missile
P_SpawnMissile (self, self->target, PClass::FindActor("DoomImpBall"));
return 0;
}

View file

@ -24,8 +24,6 @@
// Include all the other Doom stuff here to reduce compile time
#include "a_archvile.cpp"
#include "a_bossbrain.cpp"
#include "a_demon.cpp"
#include "a_doomimp.cpp"
#include "a_doomweaps.cpp"
#include "a_fatso.cpp"
#include "a_keen.cpp"

View file

@ -110,8 +110,6 @@ class Actor : Thinker native
native void A_BossDeath();
native void A_CPosAttack();
native void A_CPosRefire();
native void A_TroopAttack();
native void A_SargAttack();
native void A_SkullAttack(float speed = 20);
native void A_BetaSkullAttack();
native void A_Metal();

View file

@ -75,3 +75,21 @@ class Spectre : Demon
}
//===========================================================================
//
// Code (must be attached to Actor)
//
//===========================================================================
extend class Actor
{
void A_SargAttack()
{
if (target && CheckMeleeRange())
{
int damage = random[pr_sargattack](1, 10) * 4;
int newdam = target.DamageMobj (self, self, damage, "Melee");
target.TraceBleed (newdam > 0 ? newdam : damage, self);
}
}
}

View file

@ -92,3 +92,31 @@ class DoomImpBall : Actor
Stop;
}
}
//===========================================================================
//
// Code (must be attached to Actor)
//
//===========================================================================
extend class Actor
{
void A_TroopAttack()
{
if (target)
{
if (CheckMeleeRange())
{
int damage = random[pr_troopattack](1, 8) * 3;
A_PlaySound ("imp/melee", CHAN_WEAPON);
int newdam = target.DamageMobj (self, self, damage, "Melee");
target.TraceBleed (newdam > 0 ? newdam : damage, self);
}
else
{
// launch a missile
SpawnMissile (target, "DoomImpBall");
}
}
}
}