mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2024-11-15 16:51:31 +00:00
- scriptified the Inquisitor.
This commit is contained in:
parent
b8cf377d9e
commit
bf1c2a7e51
4 changed files with 104 additions and 148 deletions
|
@ -861,8 +861,6 @@ set( NOT_COMPILED_SOURCE_FILES
|
|||
sc_man_scanner.re
|
||||
g_hexen/a_heresiarch.cpp
|
||||
g_hexen/a_spike.cpp
|
||||
g_strife/a_crusader.cpp
|
||||
g_strife/a_inquisitor.cpp
|
||||
g_strife/a_loremaster.cpp
|
||||
g_strife/a_oracle.cpp
|
||||
g_strife/a_programmer.cpp
|
||||
|
|
|
@ -1,136 +0,0 @@
|
|||
/*
|
||||
#include "actor.h"
|
||||
#include "m_random.h"
|
||||
#include "a_action.h"
|
||||
#include "p_local.h"
|
||||
#include "p_enemy.h"
|
||||
#include "s_sound.h"
|
||||
#include "vm.h"
|
||||
*/
|
||||
|
||||
static FRandom pr_inq ("Inquisitor");
|
||||
|
||||
DEFINE_ACTION_FUNCTION(AActor, A_InquisitorWalk)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(AActor);
|
||||
|
||||
S_Sound (self, CHAN_BODY, "inquisitor/walk", 1, ATTN_NORM);
|
||||
A_Chase (stack, self);
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool InquisitorCheckDistance (AActor *self)
|
||||
{
|
||||
if (self->reactiontime == 0 && P_CheckSight (self, self->target))
|
||||
{
|
||||
return self->Distance2D (self->target) < 264.;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(AActor, A_InquisitorDecide)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(AActor);
|
||||
|
||||
if (self->target == NULL)
|
||||
return 0;
|
||||
|
||||
A_FaceTarget (self);
|
||||
if (!InquisitorCheckDistance (self))
|
||||
{
|
||||
self->SetState (self->FindState("Grenade"));
|
||||
}
|
||||
if (self->target->Z() != self->Z())
|
||||
{
|
||||
if (self->Top() + 54 < self->ceilingz)
|
||||
{
|
||||
self->SetState (self->FindState("Jump"));
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(AActor, A_InquisitorAttack)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(AActor);
|
||||
|
||||
AActor *proj;
|
||||
|
||||
if (self->target == NULL)
|
||||
return 0;
|
||||
|
||||
A_FaceTarget (self);
|
||||
|
||||
self->AddZ(32);
|
||||
self->Angles.Yaw -= 45./32;
|
||||
proj = P_SpawnMissileZAimed (self, self->Z(), self->target, PClass::FindActor("InquisitorShot"));
|
||||
if (proj != NULL)
|
||||
{
|
||||
proj->Vel.Z += 9;
|
||||
}
|
||||
self->Angles.Yaw += 45./16;
|
||||
proj = P_SpawnMissileZAimed (self, self->Z(), self->target, PClass::FindActor("InquisitorShot"));
|
||||
if (proj != NULL)
|
||||
{
|
||||
proj->Vel.Z += 16;
|
||||
}
|
||||
self->AddZ(-32);
|
||||
return 0;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(AActor, A_InquisitorJump)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(AActor);
|
||||
|
||||
double dist;
|
||||
double speed;
|
||||
|
||||
if (self->target == NULL)
|
||||
return 0;
|
||||
|
||||
S_Sound (self, CHAN_ITEM|CHAN_LOOP, "inquisitor/jump", 1, ATTN_NORM);
|
||||
self->AddZ(64);
|
||||
A_FaceTarget (self);
|
||||
speed = self->Speed * (2./3);
|
||||
self->VelFromAngle(speed);
|
||||
dist = self->DistanceBySpeed(self->target, speed);
|
||||
self->Vel.Z = (self->target->Z() - self->Z()) / dist;
|
||||
self->reactiontime = 60;
|
||||
self->flags |= MF_NOGRAVITY;
|
||||
return 0;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(AActor, A_InquisitorCheckLand)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(AActor);
|
||||
|
||||
self->reactiontime--;
|
||||
if (self->reactiontime < 0 ||
|
||||
self->Vel.X == 0 ||
|
||||
self->Vel.Y == 0 ||
|
||||
self->Z() <= self->floorz)
|
||||
{
|
||||
self->SetState (self->SeeState);
|
||||
self->reactiontime = 0;
|
||||
self->flags &= ~MF_NOGRAVITY;
|
||||
S_StopSound (self, CHAN_ITEM);
|
||||
return 0;
|
||||
}
|
||||
if (!S_IsActorPlayingSomething (self, CHAN_ITEM, -1))
|
||||
{
|
||||
S_Sound (self, CHAN_ITEM|CHAN_LOOP, "inquisitor/jump", 1, ATTN_NORM);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(AActor, A_TossArm)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(AActor);
|
||||
|
||||
AActor *foo = Spawn("InquisitorArm", self->PosPlusZ(24.), ALLOW_REPLACE);
|
||||
foo->Angles.Yaw = self->Angles.Yaw - 90. + pr_inq.Random2() * (360./1024.);
|
||||
foo->VelFromAngle(foo->Speed / 8);
|
||||
foo->Vel.Z = pr_inq() / 64.;
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -24,9 +24,7 @@
|
|||
#include "vm.h"
|
||||
|
||||
// Include all the other Strife stuff here to reduce compile time
|
||||
#include "a_inquisitor.cpp"
|
||||
#include "a_loremaster.cpp"
|
||||
//#include "a_macil.cpp"
|
||||
#include "a_oracle.cpp"
|
||||
#include "a_programmer.cpp"
|
||||
#include "a_rebels.cpp"
|
||||
|
|
|
@ -25,13 +25,6 @@ class Inquisitor : Actor
|
|||
Obituary "$OB_INQUISITOR";
|
||||
}
|
||||
|
||||
native void A_InquisitorWalk ();
|
||||
native void A_InquisitorDecide ();
|
||||
native void A_InquisitorAttack ();
|
||||
native void A_InquisitorJump ();
|
||||
native void A_InquisitorCheckLand ();
|
||||
native void A_TossArm ();
|
||||
|
||||
States
|
||||
{
|
||||
Spawn:
|
||||
|
@ -81,6 +74,109 @@ class Inquisitor : Actor
|
|||
RBB3 E -1;
|
||||
Stop;
|
||||
}
|
||||
|
||||
|
||||
// Inquisitor ---------------------------------------------------------------
|
||||
|
||||
void A_InquisitorWalk ()
|
||||
{
|
||||
A_PlaySound ("inquisitor/walk", CHAN_BODY);
|
||||
A_Chase ();
|
||||
}
|
||||
|
||||
private bool InquisitorCheckDistance ()
|
||||
{
|
||||
if (reactiontime == 0 && CheckSight (target))
|
||||
{
|
||||
return Distance2D (target) < 264.;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void A_InquisitorDecide ()
|
||||
{
|
||||
if (target == null)
|
||||
return;
|
||||
|
||||
A_FaceTarget ();
|
||||
if (!InquisitorCheckDistance ())
|
||||
{
|
||||
SetStateLabel("Grenade");
|
||||
}
|
||||
if (target.pos.z != pos.z)
|
||||
{
|
||||
if (pos.z + height + 54 < ceilingz)
|
||||
{
|
||||
SetStateLabel("Jump");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void A_InquisitorAttack ()
|
||||
{
|
||||
if (target == null)
|
||||
return;
|
||||
|
||||
A_FaceTarget ();
|
||||
|
||||
AddZ(32);
|
||||
angle -= 45./32;
|
||||
Actor proj = SpawnMissileZAimed (pos.z, target, "InquisitorShot");
|
||||
if (proj != null)
|
||||
{
|
||||
proj.Vel.Z += 9;
|
||||
}
|
||||
angle += 45./16;
|
||||
proj = SpawnMissileZAimed (pos.z, target, "InquisitorShot");
|
||||
if (proj != null)
|
||||
{
|
||||
proj.Vel.Z += 16;
|
||||
}
|
||||
AddZ(-32);
|
||||
}
|
||||
|
||||
void A_InquisitorJump ()
|
||||
{
|
||||
if (target == null)
|
||||
return;
|
||||
|
||||
A_PlaySound ("inquisitor/jump", CHAN_ITEM, 1, true);
|
||||
AddZ(64);
|
||||
A_FaceTarget ();
|
||||
speed = Speed * (2./3);
|
||||
VelFromAngle(speed);
|
||||
double dist = DistanceBySpeed(target, speed);
|
||||
Vel.Z = (target.pos.z - pos.z) / dist;
|
||||
reactiontime = 60;
|
||||
bNoGravity = true;
|
||||
}
|
||||
|
||||
void A_InquisitorCheckLand ()
|
||||
{
|
||||
reactiontime--;
|
||||
if (reactiontime < 0 ||
|
||||
Vel.X == 0 ||
|
||||
Vel.Y == 0 ||
|
||||
pos.z <= floorz)
|
||||
{
|
||||
SetState (SeeState);
|
||||
reactiontime = 0;
|
||||
bNoGravity = false;
|
||||
A_StopSound (CHAN_ITEM);
|
||||
return;
|
||||
}
|
||||
A_PlaySound ("inquisitor/jump", CHAN_ITEM, 1, true);
|
||||
}
|
||||
|
||||
void A_TossArm ()
|
||||
{
|
||||
Actor foo = Spawn("InquisitorArm", Pos + (0,0,24), ALLOW_REPLACE);
|
||||
foo.angle = angle - 90. + Random2[Inquisitor]() * (360./1024.);
|
||||
foo.VelFromAngle(foo.Speed / 8);
|
||||
foo.Vel.Z = random[Inquisitor]() / 64.;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Inquisitor Shot ----------------------------------------------------------
|
||||
|
@ -109,7 +205,7 @@ class InquisitorShot : Actor
|
|||
UBAM AB 3 A_Countdown;
|
||||
Loop;
|
||||
Death:
|
||||
BNG2 A 0 Bright A_SetTranslucent(1,1);
|
||||
BNG2 A 0 Bright A_SetRenderStyle(1, STYLE_Normal);
|
||||
BNG2 A 4 Bright A_Explode(192, 192, 1, 1);
|
||||
BNG2 B 4 Bright;
|
||||
BNG2 C 4 Bright;
|
||||
|
|
Loading…
Reference in a new issue