mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-28 06:53:58 +00:00
- scriptified the IceGuy.
This commit is contained in:
parent
69d4d36429
commit
ab03b016e9
6 changed files with 113 additions and 141 deletions
|
@ -857,10 +857,8 @@ set( NOT_COMPILED_SOURCE_FILES
|
|||
sc_man_scanner.re
|
||||
g_hexen/a_flechette.cpp
|
||||
g_hexen/a_flies.cpp
|
||||
g_hexen/a_healingradius.cpp
|
||||
g_hexen/a_heresiarch.cpp
|
||||
g_hexen/a_hexenspecialdecs.cpp
|
||||
g_hexen/a_iceguy.cpp
|
||||
g_hexen/a_magecone.cpp
|
||||
g_hexen/a_magelightning.cpp
|
||||
g_hexen/a_magestaff.cpp
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
#include "a_flies.cpp"
|
||||
#include "a_heresiarch.cpp"
|
||||
#include "a_hexenspecialdecs.cpp"
|
||||
#include "a_iceguy.cpp"
|
||||
#include "a_magecone.cpp"
|
||||
#include "a_magelightning.cpp"
|
||||
#include "a_magestaff.cpp"
|
||||
|
|
|
@ -1,132 +0,0 @@
|
|||
/*
|
||||
#include "actor.h"
|
||||
#include "info.h"
|
||||
#include "p_local.h"
|
||||
#include "s_sound.h"
|
||||
#include "p_enemy.h"
|
||||
#include "a_action.h"
|
||||
#include "m_random.h"
|
||||
#include "vm.h"
|
||||
*/
|
||||
|
||||
static FRandom pr_iceguylook ("IceGuyLook");
|
||||
static FRandom pr_iceguychase ("IceGuyChase");
|
||||
|
||||
static const char *WispTypes[2] =
|
||||
{
|
||||
"IceGuyWisp1",
|
||||
"IceGuyWisp2",
|
||||
};
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
// A_IceGuyLook
|
||||
//
|
||||
//============================================================================
|
||||
|
||||
DEFINE_ACTION_FUNCTION(AActor, A_IceGuyLook)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(AActor);
|
||||
|
||||
double dist;
|
||||
DAngle an;
|
||||
|
||||
CALL_ACTION(A_Look, self);
|
||||
if (pr_iceguylook() < 64)
|
||||
{
|
||||
dist = (pr_iceguylook() - 128) * self->radius / 128.;
|
||||
an = self->Angles.Yaw + 90;
|
||||
Spawn(WispTypes[pr_iceguylook() & 1], self->Vec3Angle(dist, an, 60.), ALLOW_REPLACE);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
// A_IceGuyChase
|
||||
//
|
||||
//============================================================================
|
||||
|
||||
DEFINE_ACTION_FUNCTION(AActor, A_IceGuyChase)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(AActor);
|
||||
|
||||
double dist;
|
||||
DAngle an;
|
||||
AActor *mo;
|
||||
|
||||
A_Chase(stack, self);
|
||||
if (pr_iceguychase() < 128)
|
||||
{
|
||||
dist = (pr_iceguychase() - 128) * self->radius / 128.;
|
||||
an = self->Angles.Yaw + 90;
|
||||
mo = Spawn(WispTypes[pr_iceguylook() & 1], self->Vec3Angle(dist, an, 60.), ALLOW_REPLACE);
|
||||
if (mo)
|
||||
{
|
||||
mo->Vel = self->Vel;
|
||||
mo->target = self;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
// A_IceGuyAttack
|
||||
//
|
||||
//============================================================================
|
||||
|
||||
DEFINE_ACTION_FUNCTION(AActor, A_IceGuyAttack)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(AActor);
|
||||
|
||||
if(!self->target)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
P_SpawnMissileXYZ(self->Vec3Angle(self->radius / 2, self->Angles.Yaw + 90, 40.), self, self->target, PClass::FindActor("IceGuyFX"));
|
||||
P_SpawnMissileXYZ(self->Vec3Angle(self->radius / 2, self->Angles.Yaw - 90, 40.), self, self->target, PClass::FindActor("IceGuyFX"));
|
||||
S_Sound (self, CHAN_WEAPON, self->AttackSound, 1, ATTN_NORM);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
// A_IceGuyDie
|
||||
//
|
||||
//============================================================================
|
||||
|
||||
DEFINE_ACTION_FUNCTION(AActor, A_IceGuyDie)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(AActor);
|
||||
|
||||
self->Vel.Zero();
|
||||
self->Height = self->GetDefault()->Height;
|
||||
CALL_ACTION(A_FreezeDeathChunks, self);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
// A_IceGuyMissileExplode
|
||||
//
|
||||
//============================================================================
|
||||
|
||||
DEFINE_ACTION_FUNCTION(AActor, A_IceGuyMissileExplode)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(AActor);
|
||||
|
||||
AActor *mo;
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < 8; i++)
|
||||
{
|
||||
mo = P_SpawnMissileAngleZ (self, self->Z()+3, PClass::FindActor("IceGuyFX2"), DAngle(i*45.), -0.3);
|
||||
if (mo)
|
||||
{
|
||||
mo->target = self->target;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -6375,6 +6375,20 @@ AActor *P_SpawnMissileXYZ (DVector3 pos, AActor *source, AActor *dest, PClassAct
|
|||
return (!checkspawn || P_CheckMissileSpawn (th, source->radius)) ? th : NULL;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(AActor, SpawnMissileXYZ)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(AActor);
|
||||
PARAM_FLOAT(x);
|
||||
PARAM_FLOAT(y);
|
||||
PARAM_FLOAT(z);
|
||||
PARAM_OBJECT(dest, AActor);
|
||||
PARAM_CLASS(type, AActor);
|
||||
PARAM_BOOL_DEF(check);
|
||||
PARAM_OBJECT_DEF(owner, AActor);
|
||||
ACTION_RETURN_OBJECT(P_SpawnMissileXYZ(DVector3(x,y,z), self, dest, type, check, owner));
|
||||
}
|
||||
|
||||
|
||||
AActor *P_OldSpawnMissile(AActor *source, AActor *owner, AActor *dest, PClassActor *type)
|
||||
{
|
||||
if (source == NULL)
|
||||
|
|
|
@ -296,6 +296,7 @@ class Actor : Thinker native
|
|||
native bool TestMobjLocation();
|
||||
native static Actor Spawn(class<Actor> type, vector3 pos = (0,0,0), int replace = NO_REPLACE);
|
||||
native Actor SpawnMissile(Actor dest, class<Actor> type, Actor owner = null);
|
||||
native Actor SpawnMissileXYZ(Vector3 pos, Actor dest, Class<Actor> type, bool checkspawn = true, Actor owner = null);
|
||||
native Actor SpawnMissileZ (double z, Actor dest, class<Actor> type);
|
||||
native Actor SpawnMissileAngleZSpeed (double z, class<Actor> type, double angle, double vz, double speed, Actor owner = null, bool checkspawn = true);
|
||||
native Actor, Actor SpawnPlayerMissile(class<Actor> type, double angle = 0, double x = 0, double y = 0, double z = 0, out FTranslatedLineTarget pLineTarget = null, bool nofreeaim = false, bool noautoaim = false, int aimflags = 0);
|
||||
|
@ -592,7 +593,6 @@ class Actor : Thinker native
|
|||
native void A_FreezeDeath();
|
||||
native void A_FreezeDeathChunks();
|
||||
native void A_GenericFreezeDeath();
|
||||
native void A_IceGuyDie();
|
||||
native void A_PlayerScream();
|
||||
native void A_SkullPop(class<PlayerChunk> skulltype = "BloodySkull");
|
||||
native void A_CheckPlayerDone();
|
||||
|
|
|
@ -22,9 +22,6 @@ class IceGuy : Actor
|
|||
Obituary "$OB_ICEGUY";
|
||||
}
|
||||
|
||||
native void A_IceGuyLook();
|
||||
native void A_IceGuyChase();
|
||||
native void A_IceGuyAttack();
|
||||
|
||||
States
|
||||
{
|
||||
|
@ -51,6 +48,84 @@ class IceGuy : Actor
|
|||
ICEY A -1;
|
||||
Goto See;
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
// SpawnWisp
|
||||
//
|
||||
//============================================================================
|
||||
|
||||
private void SpawnWisp()
|
||||
{
|
||||
static const class<Actor> WispTypes[] = { "IceGuyWisp1", "IceGuyWisp2" };
|
||||
|
||||
double dist = (random[IceGuyLook]() - 128) * radius / 128.;
|
||||
double an = angle + 90;
|
||||
Actor mo = Spawn(WispTypes[random[IceGuyLook]() & 1], Vec3Angle(dist, an, 60.), ALLOW_REPLACE);
|
||||
if (mo)
|
||||
{
|
||||
mo.Vel = Vel;
|
||||
mo.target = self;
|
||||
}
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
// A_IceGuyLook
|
||||
//
|
||||
//============================================================================
|
||||
|
||||
void A_IceGuyLook()
|
||||
{
|
||||
A_Look();
|
||||
if (random[IceGuyLook]() < 64) SpawnWisp();
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
// A_IceGuyChase
|
||||
//
|
||||
//============================================================================
|
||||
|
||||
void A_IceGuyChase()
|
||||
{
|
||||
A_Chase();
|
||||
if (random[IceGuyLook]() < 128) SpawnWisp();
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
// A_IceGuyAttack
|
||||
//
|
||||
//============================================================================
|
||||
|
||||
void A_IceGuyAttack()
|
||||
{
|
||||
if(!target)
|
||||
{
|
||||
return;
|
||||
}
|
||||
SpawnMissileXYZ(Vec3Angle(radius / 2, angle + 90, 40.), target, "IceGuyFX");
|
||||
SpawnMissileXYZ(Vec3Angle(radius / 2, angle - 90, 40.), target, "IceGuyFX");
|
||||
A_PlaySound (AttackSound, CHAN_WEAPON);
|
||||
}
|
||||
}
|
||||
|
||||
extend class Actor
|
||||
{
|
||||
//============================================================================
|
||||
//
|
||||
// A_IceGuyDie (globally accessible)
|
||||
//
|
||||
//============================================================================
|
||||
|
||||
void A_IceGuyDie()
|
||||
{
|
||||
Vel = (0,0,0);
|
||||
Height = Default.Height;
|
||||
A_FreezeDeathChunks();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Ice Guy Projectile -------------------------------------------------------
|
||||
|
@ -69,8 +144,6 @@ class IceGuyFX : Actor
|
|||
DeathSound "IceGuyMissileExplode";
|
||||
}
|
||||
|
||||
native void A_IceGuyMissileExplode();
|
||||
|
||||
States
|
||||
{
|
||||
Spawn:
|
||||
|
@ -83,6 +156,25 @@ class IceGuyFX : Actor
|
|||
ICPR H 3 Bright;
|
||||
Stop;
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
// A_IceGuyMissileExplode
|
||||
//
|
||||
//============================================================================
|
||||
|
||||
void A_IceGuyMissileExplode()
|
||||
{
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
Actor mo = SpawnMissileAngleZ (pos.z+3, "IceGuyFX2", i*45., -0.3);
|
||||
if (mo)
|
||||
{
|
||||
mo.target = target;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Ice Guy Projectile's Puff ------------------------------------------------
|
||||
|
@ -183,3 +275,4 @@ class IceGuyWisp2 : IceGuyWisp1
|
|||
Stop;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue