- scriptified A_HeadAttack, A_CyberAttack and A_Hoof.

This commit is contained in:
Christoph Oelckers 2016-10-24 00:50:28 +02:00
parent 9f8a5dae21
commit 3f1673f34f
7 changed files with 55 additions and 69 deletions

View File

@ -1,35 +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 "s_sound.h"
#include "vm.h"
*/
static FRandom pr_headattack ("HeadAttack");
DEFINE_ACTION_FUNCTION(AActor, A_HeadAttack)
{
PARAM_SELF_PROLOGUE(AActor);
if (!self->target)
return 0;
A_FaceTarget (self);
if (self->CheckMeleeRange ())
{
int damage = (pr_headattack()%6+1)*10;
S_Sound (self, CHAN_WEAPON, self->AttackSound, 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("CacodemonBall"));
return 0;
}

View File

@ -1,29 +0,0 @@
/*
#include "actor.h"
#include "p_local.h"
#include "s_sound.h"
#include "p_enemy.h"
#include "a_action.h"
#include "vm.h"
*/
DEFINE_ACTION_FUNCTION(AActor, A_CyberAttack)
{
PARAM_SELF_PROLOGUE(AActor);
if (!self->target)
return 0;
A_FaceTarget (self);
P_SpawnMissile (self, self->target, PClass::FindActor("Rocket"));
return 0;
}
DEFINE_ACTION_FUNCTION(AActor, A_Hoof)
{
PARAM_SELF_PROLOGUE(AActor);
S_Sound (self, CHAN_BODY, "cyber/hoof", 1, ATTN_IDLE);
A_Chase (stack, self);
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_cacodemon.cpp"
#include "a_cyberdemon.cpp"
#include "a_demon.cpp"
#include "a_doomimp.cpp"
#include "a_doomweaps.cpp"

View File

@ -676,6 +676,7 @@ void InitThingdef()
symt.AddSymbol(new PField(NAME_VisibleStartPitch, TypeFloat64, VARF_Native, myoffsetof(AActor, VisibleStartPitch)));
symt.AddSymbol(new PField(NAME_VisibleEndAngle, TypeFloat64, VARF_Native, myoffsetof(AActor, VisibleEndAngle)));
symt.AddSymbol(new PField(NAME_VisibleEndPitch, TypeFloat64, VARF_Native, myoffsetof(AActor, VisibleEndPitch)));
symt.AddSymbol(new PField("AttackSound", TypeSound, VARF_Native, myoffsetof(AActor, AttackSound)));
symt.AddSymbol(new PField(NAME_Target, TypeActor, VARF_Native, myoffsetof(AActor, target)));
symt.AddSymbol(new PField(NAME_Master, TypeActor, VARF_Native, myoffsetof(AActor, master)));
symt.AddSymbol(new PField(NAME_Tracer, TypeActor, VARF_Native, myoffsetof(AActor, tracer)));

View File

@ -112,13 +112,10 @@ class Actor : Thinker native
native void A_CPosRefire();
native void A_TroopAttack();
native void A_SargAttack();
native void A_HeadAttack();
native void A_SkullAttack(float speed = 20);
native void A_BetaSkullAttack();
native void A_Metal();
native void A_SpidRefire();
native void A_Hoof();
native void A_CyberAttack();
native void A_PainAttack(class<Actor> spawntype = "LostSoul", float angle = 0, int flags = 0, int limit = -1);
native void A_DualPainAttack(class<Actor> spawntype = "LostSoul");
native void A_PainDie(class<Actor> spawntype = "LostSoul");

View File

@ -86,3 +86,32 @@ class CacodemonBall : Actor
Stop;
}
}
//===========================================================================
//
// Code (must be attached to Actor)
//
//===========================================================================
extend class Actor
{
void A_HeadAttack()
{
if (target)
{
if (CheckMeleeRange())
{
int damage = random[pr_headattack](1, 6) * 10;
A_PlaySound (AttackSound, CHAN_WEAPON);
int newdam = target.DamageMobj (self, self, damage, "Melee");
target.TraceBleed (newdam > 0 ? newdam : damage, self);
}
else
{
// launch a missile
SpawnMissile (target, "CacodemonBall");
}
}
}
}

View File

@ -62,3 +62,28 @@ class Cyberdemon : Actor
}
}
//===========================================================================
//
// Code (must be attached to Actor)
//
//===========================================================================
extend class Actor
{
void A_CyberAttack()
{
if (target)
{
A_FaceTarget();
SpawnMissile (target, "Rocket");
}
}
void A_Hoof()
{
A_PlaySound("cyber/hoof", CHAN_BODY, 1, false, ATTN_IDLE);
A_Chase();
}
}