mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-06 13:01:03 +00:00
062574b726
- made some tests about calling script code from native functions. * scriptified A_SkullAttack to have something to test * changed the A_SkullAttack call in A_PainShootSkull. * use a macro to declare the function pointer. Using local static variable init directly results in hideous code for the need of being thread-safe (which, even if the engine was made multithreaded is not needed here.) * Importsnt node here: Apparently passing an actor pointer to the VMValue constructor results in the void * version being called, not the DObject * version.
121 lines
2.1 KiB
Text
121 lines
2.1 KiB
Text
//===========================================================================
|
|
//
|
|
// Lost Soul
|
|
//
|
|
//===========================================================================
|
|
class LostSoul : Actor
|
|
{
|
|
Default
|
|
{
|
|
Health 100;
|
|
Radius 16;
|
|
Height 56;
|
|
Mass 50;
|
|
Speed 8;
|
|
Damage 3;
|
|
PainChance 256;
|
|
Monster;
|
|
+FLOAT +NOGRAVITY +MISSILEMORE +DONTFALL +NOICEDEATH;
|
|
AttackSound "skull/melee";
|
|
PainSound "skull/pain";
|
|
DeathSound "skull/death";
|
|
ActiveSound "skull/active";
|
|
RenderStyle "SoulTrans";
|
|
Obituary "$OB_SKULL";
|
|
}
|
|
States
|
|
{
|
|
Spawn:
|
|
SKUL AB 10 BRIGHT A_Look;
|
|
Loop;
|
|
See:
|
|
SKUL AB 6 BRIGHT A_Chase;
|
|
Loop;
|
|
Missile:
|
|
SKUL C 10 BRIGHT A_FaceTarget;
|
|
SKUL D 4 BRIGHT A_SkullAttack;
|
|
SKUL CD 4 BRIGHT;
|
|
Goto Missile+2;
|
|
Pain:
|
|
SKUL E 3 BRIGHT;
|
|
SKUL E 3 BRIGHT A_Pain;
|
|
Goto See;
|
|
Death:
|
|
SKUL F 6 BRIGHT;
|
|
SKUL G 6 BRIGHT A_Scream;
|
|
SKUL H 6 BRIGHT;
|
|
SKUL I 6 BRIGHT A_NoBlocking;
|
|
SKUL J 6;
|
|
SKUL K 6;
|
|
Stop;
|
|
}
|
|
}
|
|
|
|
class BetaSkull : LostSoul
|
|
{
|
|
States
|
|
{
|
|
Spawn:
|
|
SKUL A 10 A_Look;
|
|
Loop;
|
|
See:
|
|
SKUL BCDA 5 A_Chase;
|
|
Loop;
|
|
Missile:
|
|
SKUL E 4 A_FaceTarget;
|
|
SKUL F 5 A_BetaSkullAttack;
|
|
SKUL F 4;
|
|
Goto See;
|
|
Pain:
|
|
SKUL G 4;
|
|
SKUL H 2 A_Pain;
|
|
Goto See;
|
|
SKUL I 4;
|
|
Goto See;
|
|
Death:
|
|
SKUL JKLM 5;
|
|
SKUL N 5 A_Scream;
|
|
SKUL O 5;
|
|
SKUL P 5 A_Fall;
|
|
SKUL Q 5 A_Stop;
|
|
Wait;
|
|
}
|
|
}
|
|
|
|
//===========================================================================
|
|
//
|
|
// Code (must be attached to Actor)
|
|
//
|
|
//===========================================================================
|
|
|
|
extend class Actor
|
|
{
|
|
const SKULLSPEED = 20;
|
|
|
|
void A_SkullAttack(float skullspeed = SKULLSPEED)
|
|
{
|
|
if (target == null) return;
|
|
|
|
if (skullspeed <= 0) skullspeed = SKULLSPEED;
|
|
|
|
bSkullfly = true;
|
|
A_PlaySound(AttackSound, CHAN_VOICE);
|
|
A_FaceTarget();
|
|
VelFromAngle(skullspeed);
|
|
Vel.Z = (target.pos.Z + target.Height/2 - Vel.Z) / DistanceBySpeed(target, speed);
|
|
}
|
|
|
|
void A_BetaSkullAttack()
|
|
{
|
|
if (target == null || target.GetSpecies() == self.GetSpecies()) return;
|
|
|
|
A_PlaySound(AttackSound, CHAN_WEAPON);
|
|
A_FaceTarget();
|
|
|
|
int damage = GetMissileDamage(7,1);
|
|
target.DamageMobj(self, self, damage, 'None');
|
|
}
|
|
}
|
|
|
|
|
|
|