- Converted all action functions be directly callable by the VM (though they are not yet

usable).

SVN r2154 (scripting)
This commit is contained in:
Randy Heit 2010-02-12 06:04:57 +00:00
commit 739e684549
108 changed files with 2827 additions and 1295 deletions

View file

@ -164,17 +164,19 @@ void AScriptedMarine::Tick ()
DEFINE_ACTION_FUNCTION(AActor, A_M_Refire)
{
PARAM_ACTION_PROLOGUE;
if (self->target == NULL || self->target->health <= 0)
{
if (self->MissileState && pr_m_refire() < 160)
{ // Look for a new target most of the time
if (P_LookForPlayers (self, true, NULL) && P_CheckMissileRange (self))
{ // Found somebody new and in range, so don't stop shooting
return;
return 0;
}
}
self->SetState (self->state + 1);
return;
return 0;
}
if ((self->MissileState == NULL && !self->CheckMeleeRange ()) ||
!P_CheckSight (self, self->target) ||
@ -182,6 +184,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_M_Refire)
{
self->SetState (self->state + 1);
}
return 0;
}
//============================================================================
@ -192,15 +195,18 @@ DEFINE_ACTION_FUNCTION(AActor, A_M_Refire)
DEFINE_ACTION_FUNCTION(AActor, A_M_SawRefire)
{
PARAM_ACTION_PROLOGUE;
if (self->target == NULL || self->target->health <= 0)
{
self->SetState (self->state + 1);
return;
return 0;
}
if (!self->CheckMeleeRange ())
{
self->SetState (self->state + 1);
}
return 0;
}
//============================================================================
@ -211,10 +217,13 @@ DEFINE_ACTION_FUNCTION(AActor, A_M_SawRefire)
DEFINE_ACTION_FUNCTION(AActor, A_MarineNoise)
{
PARAM_ACTION_PROLOGUE;
if (static_cast<AScriptedMarine *>(self)->CurrentWeapon == AScriptedMarine::WEAPON_Chainsaw)
{
S_Sound (self, CHAN_WEAPON, "weapons/sawidle", 1, ATTN_NORM);
}
return 0;
}
//============================================================================
@ -225,8 +234,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_MarineNoise)
DEFINE_ACTION_FUNCTION(AActor, A_MarineChase)
{
PARAM_ACTION_PROLOGUE;
CALL_ACTION(A_MarineNoise, self);
A_Chase (self);
A_Chase (stack, self);
return 0;
}
//============================================================================
@ -237,8 +248,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_MarineChase)
DEFINE_ACTION_FUNCTION(AActor, A_MarineLook)
{
PARAM_ACTION_PROLOGUE;
CALL_ACTION(A_MarineNoise, self);
CALL_ACTION(A_Look, self);
return 0;
}
//============================================================================
@ -249,14 +262,14 @@ DEFINE_ACTION_FUNCTION(AActor, A_MarineLook)
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_M_Saw)
{
ACTION_PARAM_START(4);
ACTION_PARAM_SOUND(fullsound, 0);
ACTION_PARAM_SOUND(hitsound, 1);
ACTION_PARAM_INT(damage, 2);
ACTION_PARAM_CLASS(pufftype, 3);
PARAM_ACTION_PROLOGUE;
PARAM_SOUND_OPT (fullsound) { fullsound = "weapons/sawfull"; }
PARAM_SOUND_OPT (hitsound) { hitsound = "weapons/sawhit"; }
PARAM_INT_OPT (damage) { damage = 2; }
PARAM_CLASS_OPT (pufftype, AActor) { pufftype = NULL; }
if (self->target == NULL)
return;
return 0;
if (pufftype == NULL) pufftype = PClass::FindClass(NAME_BulletPuff);
if (damage == 0) damage = 2;
@ -277,7 +290,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_M_Saw)
if (!linetarget)
{
S_Sound (self, CHAN_WEAPON, fullsound, 1, ATTN_NORM);
return;
return 0;
}
S_Sound (self, CHAN_WEAPON, hitsound, 1, ATTN_NORM);
@ -303,6 +316,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_M_Saw)
S_Sound (self, CHAN_WEAPON, fullsound, 1, ATTN_NORM);
}
//A_Chase (self);
return 0;
}
//============================================================================
@ -338,10 +352,11 @@ static void MarinePunch(AActor *self, int damagemul)
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_M_Punch)
{
ACTION_PARAM_START(1);
ACTION_PARAM_INT(mult, 0);
PARAM_ACTION_PROLOGUE;
PARAM_INT(mult);
MarinePunch(self, mult);
return 0;
}
//============================================================================
@ -374,16 +389,17 @@ void P_GunShot2 (AActor *mo, bool accurate, int pitch, const PClass *pufftype)
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_M_FirePistol)
{
if (self->target == NULL)
return;
PARAM_ACTION_PROLOGUE;
PARAM_BOOL(accurate);
ACTION_PARAM_START(1);
ACTION_PARAM_BOOL(accurate, 0);
if (self->target == NULL)
return 0;
S_Sound (self, CHAN_WEAPON, "weapons/pistol", 1, ATTN_NORM);
A_FaceTarget (self);
P_GunShot2 (self, accurate, P_AimLineAttack (self, self->angle, MISSILERANGE),
PClass::FindClass(NAME_BulletPuff));
return 0;
}
//============================================================================
@ -394,10 +410,12 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_M_FirePistol)
DEFINE_ACTION_FUNCTION(AActor, A_M_FireShotgun)
{
PARAM_ACTION_PROLOGUE;
int pitch;
if (self->target == NULL)
return;
return 0;
S_Sound (self, CHAN_WEAPON, "weapons/shotgf", 1, ATTN_NORM);
A_FaceTarget (self);
@ -407,6 +425,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_M_FireShotgun)
P_GunShot2 (self, false, pitch, PClass::FindClass(NAME_BulletPuff));
}
self->special1 = level.maptime + 27;
return 0;
}
//============================================================================
@ -417,6 +436,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_M_FireShotgun)
DEFINE_ACTION_FUNCTION(AActor, A_M_CheckAttack)
{
PARAM_ACTION_PROLOGUE;
if (self->special1 != 0 || self->target == NULL)
{
self->SetState (self->FindState("SkipAttack"));
@ -425,6 +446,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_M_CheckAttack)
{
A_FaceTarget (self);
}
return 0;
}
//============================================================================
@ -435,10 +457,12 @@ DEFINE_ACTION_FUNCTION(AActor, A_M_CheckAttack)
DEFINE_ACTION_FUNCTION(AActor, A_M_FireShotgun2)
{
PARAM_ACTION_PROLOGUE;
int pitch;
if (self->target == NULL)
return;
return 0;
S_Sound (self, CHAN_WEAPON, "weapons/sshotf", 1, ATTN_NORM);
A_FaceTarget (self);
@ -453,6 +477,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_M_FireShotgun2)
NAME_None, PClass::FindClass(NAME_BulletPuff));
}
self->special1 = level.maptime;
return 0;
}
//============================================================================
@ -463,16 +488,17 @@ DEFINE_ACTION_FUNCTION(AActor, A_M_FireShotgun2)
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_M_FireCGun)
{
if (self->target == NULL)
return;
PARAM_ACTION_PROLOGUE;
PARAM_BOOL(accurate);
ACTION_PARAM_START(1);
ACTION_PARAM_BOOL(accurate, 0);
if (self->target == NULL)
return 0;
S_Sound (self, CHAN_WEAPON, "weapons/chngun", 1, ATTN_NORM);
A_FaceTarget (self);
P_GunShot2 (self, accurate, P_AimLineAttack (self, self->angle, MISSILERANGE),
PClass::FindClass(NAME_BulletPuff));
return 0;
}
//============================================================================
@ -487,8 +513,10 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_M_FireCGun)
DEFINE_ACTION_FUNCTION(AActor, A_M_FireMissile)
{
PARAM_ACTION_PROLOGUE;
if (self->target == NULL)
return;
return 0;
if (self->CheckMeleeRange ())
{ // If too close, punch it
@ -499,6 +527,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_M_FireMissile)
A_FaceTarget (self);
P_SpawnMissile (self, self->target, PClass::FindClass("Rocket"));
}
return 0;
}
//============================================================================
@ -509,11 +538,14 @@ DEFINE_ACTION_FUNCTION(AActor, A_M_FireMissile)
DEFINE_ACTION_FUNCTION(AActor, A_M_FireRailgun)
{
PARAM_ACTION_PROLOGUE;
if (self->target == NULL)
return;
return 0;
CALL_ACTION(A_MonsterRail, self);
self->special1 = level.maptime + 50;
return 0;
}
//============================================================================
@ -524,12 +556,15 @@ DEFINE_ACTION_FUNCTION(AActor, A_M_FireRailgun)
DEFINE_ACTION_FUNCTION(AActor, A_M_FirePlasma)
{
PARAM_ACTION_PROLOGUE;
if (self->target == NULL)
return;
return 0;
A_FaceTarget (self);
P_SpawnMissile (self, self->target, PClass::FindClass("PlasmaBall"));
self->special1 = level.maptime + 20;
return 0;
}
//============================================================================
@ -540,8 +575,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_M_FirePlasma)
DEFINE_ACTION_FUNCTION(AActor, A_M_BFGsound)
{
PARAM_ACTION_PROLOGUE;
if (self->target == NULL)
return;
return 0;
if (self->special1 != 0)
{
@ -554,6 +591,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_M_BFGsound)
// Don't interrupt the firing sequence
self->PainChance = 0;
}
return 0;
}
//============================================================================
@ -564,13 +602,16 @@ DEFINE_ACTION_FUNCTION(AActor, A_M_BFGsound)
DEFINE_ACTION_FUNCTION(AActor, A_M_FireBFG)
{
PARAM_ACTION_PROLOGUE;
if (self->target == NULL)
return;
return 0;
A_FaceTarget (self);
P_SpawnMissile (self, self->target, PClass::FindClass("BFGBall"));
self->special1 = level.maptime + 30;
self->PainChance = MARINE_PAIN_CHANCE;
return 0;
}
//---------------------------------------------------------------------------