- scriptified the Loremaster.

This commit is contained in:
Christoph Oelckers 2016-11-28 18:59:57 +01:00
parent bf1c2a7e51
commit 119bcb924d
6 changed files with 31 additions and 50 deletions

View file

@ -861,7 +861,6 @@ set( NOT_COMPILED_SOURCE_FILES
sc_man_scanner.re
g_hexen/a_heresiarch.cpp
g_hexen/a_spike.cpp
g_strife/a_loremaster.cpp
g_strife/a_oracle.cpp
g_strife/a_programmer.cpp
g_strife/a_rebels.cpp

View file

@ -1,43 +0,0 @@
/*
#include "actor.h"
#include "a_action.h"
#include "a_strifeglobal.h"
#include "m_random.h"
#include "p_local.h"
#include "s_sound.h"
#include "vm.h"
*/
// Loremaster (aka Priest) --------------------------------------------------
class ALoreShot : public AActor
{
DECLARE_CLASS (ALoreShot, AActor)
public:
int DoSpecialDamage (AActor *victim, int damage, FName damagetype);
};
IMPLEMENT_CLASS(ALoreShot, false, false)
int ALoreShot::DoSpecialDamage (AActor *victim, int damage, FName damagetype)
{
if (victim != NULL && target != NULL && !(victim->flags7 & MF7_DONTTHRUST))
{
DVector3 thrust = victim->Vec3To(target);
thrust.MakeResize(255. * 50 / MAX<int>(victim->Mass, 1));
victim->Vel += thrust;
}
return damage;
}
DEFINE_ACTION_FUNCTION(AActor, A_LoremasterChain)
{
PARAM_SELF_PROLOGUE(AActor);
S_Sound (self, CHAN_BODY, "loremaster/active", 1, ATTN_NORM);
Spawn("LoreShot2", self->Pos(), ALLOW_REPLACE);
Spawn("LoreShot2", self->Vec3Offset(-self->Vel/2.), ALLOW_REPLACE);
Spawn("LoreShot2", self->Vec3Offset(-self->Vel), ALLOW_REPLACE);
return 0;
}

View file

@ -24,7 +24,6 @@
#include "vm.h"
// Include all the other Strife stuff here to reduce compile time
#include "a_loremaster.cpp"
#include "a_oracle.cpp"
#include "a_programmer.cpp"
#include "a_rebels.cpp"

View file

@ -7509,13 +7509,20 @@ DEFINE_ACTION_FUNCTION(AActor, Vec2Angle)
}
DEFINE_ACTION_FUNCTION(AActor, Vec3To)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_OBJECT(t, AActor)
ACTION_RETURN_VEC3(self->Vec3To(t));
}
DEFINE_ACTION_FUNCTION(AActor, Vec3Angle)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_FLOAT(length)
PARAM_ANGLE(angle);
PARAM_ANGLE(angle);
PARAM_FLOAT(z);
PARAM_BOOL_DEF(absolute);
PARAM_BOOL_DEF(absolute);
ACTION_RETURN_VEC3(self->Vec3Angle(length, angle, z, absolute));
}

View file

@ -354,6 +354,7 @@ class Actor : Thinker native
native double AngleTo(Actor target, bool absolute = false);
native void AddZ(double zadd, bool moving = true);
native void SetZ(double z);
native vector3 Vec3To(Actor other);
native vector3 Vec3Offset(double x, double y, double z, bool absolute = false);
native vector3 Vec3Angle(double length, double angle, double z = 0, bool absolute = false);
native vector2 Vec2Angle(double length, double angle, bool absolute = false);

View file

@ -76,7 +76,7 @@ class Loremaster : Actor
// Loremaster Projectile ----------------------------------------------------
class LoreShot : Actor native
class LoreShot : Actor
{
Default
{
@ -91,8 +91,6 @@ class LoreShot : Actor native
ActiveSound "loremaster/swish";
}
native void A_LoremasterChain ();
States
{
Spawn:
@ -102,6 +100,26 @@ class LoreShot : Actor native
OCLW A 6;
Stop;
}
override int DoSpecialDamage (Actor victim, int damage, Name damagetype)
{
if (victim != NULL && target != NULL && !victim.bDontThrust)
{
Vector3 thrust = victim.Vec3To(target);
victim.Vel += thrust.Unit() * (255. * 50 / max(victim.Mass, 1));
}
return damage;
}
void A_LoremasterChain ()
{
A_PlaySound ("loremaster/active", CHAN_BODY);
Spawn("LoreShot2", Pos, ALLOW_REPLACE);
Spawn("LoreShot2", Vec3Offset(-Vel.x/2., -Vel.y/2., -Vel.z/2.), ALLOW_REPLACE);
Spawn("LoreShot2", Vec3Offset(-Vel.x, -Vel.y, -Vel.z), ALLOW_REPLACE);
}
}
// Loremaster Subprojectile -------------------------------------------------