- scriptified the Mauler, completing Strife.

This commit is contained in:
Christoph Oelckers 2016-11-29 14:32:49 +01:00
parent b625156df6
commit e01f680b72
8 changed files with 296 additions and 383 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_strifeweapons.cpp
g_shared/sbarinfo_commands.cpp
xlat/xlat_parser.y
xlat_parser.c
@ -1111,7 +1110,6 @@ set (PCH_SOURCES
wi_stuff.cpp
zstrformat.cpp
g_hexen/a_hexenmisc.cpp
g_strife/a_strifestuff.cpp
g_strife/strife_sbar.cpp
g_shared/a_action.cpp
g_shared/a_armor.cpp

View file

@ -1,7 +0,0 @@
#ifndef __A_STRIFEGLOBAL_H__
#define __A_STRIFEGLOBAL_H__
#include "info.h"
#include "a_pickups.h"
#endif

View file

@ -1,35 +0,0 @@
#include "actor.h"
#include "g_level.h"
#include "gi.h"
#include "m_random.h"
#include "s_sound.h"
#include "d_player.h"
#include "a_action.h"
#include "p_local.h"
#include "p_enemy.h"
#include "p_lnspec.h"
#include "c_console.h"
#include "vm.h"
#include "doomstat.h"
#include "gstrings.h"
#include "a_keys.h"
#include "a_sharedglobal.h"
#include "templates.h"
#include "d_event.h"
#include "v_font.h"
#include "serializer.h"
#include "p_spec.h"
#include "portal.h"
#include "vm.h"
// Include all the other Strife stuff here to reduce compile time
#include "a_strifeweapons.cpp"
// Notes so I don't forget them:
//
// When shooting missiles at something, if MF_SHADOW is set, the angle is adjusted with the formula:
// angle += pr_spawnmissile.Random2() << 21
// When MF_STRIFEx4000000 is set, the angle is adjusted similarly:
// angle += pr_spawnmissile.Random2() << 22
// Note that these numbers are different from those used by all the other Doom engine games.

View file

@ -1,165 +0,0 @@
/*
#include "a_pickups.h"
#include "p_local.h"
#include "m_random.h"
#include "a_strifeglobal.h"
#include "s_sound.h"
#include "p_enemy.h"
#include "templates.h"
#include "vm.h"
#include "doomstat.h"
*/
// Note: Strife missiles do 1-4 times their damage amount.
// Doom missiles do 1-8 times their damage amount, so to
// make the strife missiles do proper damage without
// hacking more stuff in the executable, be sure to give
// all Strife missiles the MF4_STRIFEDAMAGE flag.
static FRandom pr_electric ("FireElectric");
static FRandom pr_sgunshot ("StrifeGunShot");
static FRandom pr_minimissile ("MiniMissile");
static FRandom pr_flamethrower ("FlameThrower");
static FRandom pr_flamedie ("FlameDie");
static FRandom pr_mauler1 ("Mauler1");
static FRandom pr_mauler2 ("Mauler2");
static FRandom pr_phburn ("PhBurn");
void A_LoopActiveSound (AActor *);
void A_Countdown (AActor *);
// Assault Gun --------------------------------------------------------------
// Mini-Missile Launcher ----------------------------------------------------
// Flame Thrower ------------------------------------------------------------
// Mauler -------------------------------------------------------------------
//============================================================================
//
// A_FireMauler1
//
// Hey! This is exactly the same as a super shotgun except for the sound
// and the bullet puffs and the disintegration death.
//
//============================================================================
DEFINE_ACTION_FUNCTION(AActor, A_FireMauler1)
{
PARAM_ACTION_PROLOGUE(AActor);
if (self->player != NULL)
{
AWeapon *weapon = self->player->ReadyWeapon;
if (weapon != NULL)
{
if (!weapon->DepleteAmmo (weapon->bAltFire))
return 0;
}
// Strife apparently didn't show the player shooting. Let's fix that.
self->player->mo->PlayAttacking2 ();
}
S_Sound (self, CHAN_WEAPON, "weapons/mauler1", 1, ATTN_NORM);
DAngle bpitch = P_BulletSlope (self);
for (int i = 0; i < 20; ++i)
{
int damage = 5 * (pr_mauler1() % 3 + 1);
DAngle angle = self->Angles.Yaw + pr_mauler1.Random2() * (11.25 / 256);
DAngle pitch = bpitch + pr_mauler1.Random2() * (7.097 / 256);
// Strife used a range of 2112 units for the mauler to signal that
// it should use a different puff. ZDoom's default range is longer
// than this, so let's not handicap it by being too faithful to the
// original.
P_LineAttack (self, angle, PLAYERMISSILERANGE, pitch, damage, NAME_Hitscan, NAME_MaulerPuff);
}
return 0;
}
//============================================================================
//
// A_FireMauler2Pre
//
// Makes some noise and moves the psprite.
//
//============================================================================
DEFINE_ACTION_FUNCTION(AActor, A_FireMauler2Pre)
{
PARAM_ACTION_PROLOGUE(AActor);
S_Sound (self, CHAN_WEAPON, "weapons/mauler2charge", 1, ATTN_NORM);
if (self->player != nullptr)
{
self->player->GetPSprite(PSP_WEAPON)->x += pr_mauler2.Random2() / 64.;
self->player->GetPSprite(PSP_WEAPON)->y += pr_mauler2.Random2() / 64.;
}
return 0;
}
//============================================================================
//
// A_FireMauler2Pre
//
// Fires the torpedo.
//
//============================================================================
DEFINE_ACTION_FUNCTION(AActor, A_FireMauler2)
{
PARAM_ACTION_PROLOGUE(AActor);
if (self->player != NULL)
{
AWeapon *weapon = self->player->ReadyWeapon;
if (weapon != NULL)
{
if (!weapon->DepleteAmmo (weapon->bAltFire))
return 0;
}
self->player->mo->PlayAttacking2 ();
}
P_SpawnPlayerMissile (self, PClass::FindActor("MaulerTorpedo"));
P_DamageMobj (self, self, NULL, 20, self->DamageType);
self->Thrust(self->Angles.Yaw+180., 7.8125);
return 0;
}
//============================================================================
//
// A_MaulerTorpedoWave
//
// Launches lots of balls when the torpedo hits something.
//
//============================================================================
DEFINE_ACTION_FUNCTION(AActor, A_MaulerTorpedoWave)
{
PARAM_SELF_PROLOGUE(AActor);
AActor *wavedef = GetDefaultByName("MaulerTorpedoWave");
double savedz;
self->Angles.Yaw += 180.;
// If the torpedo hit the ceiling, it should still spawn the wave
savedz = self->Z();
if (wavedef && self->ceilingz < self->Z() + wavedef->Height)
{
self->SetZ(self->ceilingz - wavedef->Height);
}
for (int i = 0; i < 80; ++i)
{
self->Angles.Yaw += 4.5;
P_SpawnSubMissile (self, PClass::FindActor("MaulerTorpedoWave"), self->target);
}
self->SetZ(savedz);
return 0;
}

View file

@ -195,6 +195,7 @@ zscript/strife/weaponassault.txt
zscript/strife/weaponmissile.txt
zscript/strife/weaponflamer.txt
zscript/strife/weapongrenade.txt
zscript/strife/weaponmauler.txt
zscript/strife/sigil.txt
zscript/chex/chexmonsters.txt

View file

@ -1,3 +1,12 @@
// Notes so I don't forget them:
//
// When shooting missiles at something, if MF_SHADOW is set, the angle is adjusted with the formula:
// angle += pr_spawnmissile.Random2() << 21
// When MF_STRIFEx4000000 is set, the angle is adjusted similarly:
// angle += pr_spawnmissile.Random2() << 22
// Note that these numbers are different from those used by all the other Doom engine games.
// Tank 1 Huge ------------------------------------------------------------
class Tank1 : Actor

View file

@ -50,177 +50,3 @@ class StrifeSpark : StrifePuff
}
}
// Mauler -------------------------------------------------------------------
// The scatter version
class Mauler : StrifeWeapon
{
Default
{
+FLOORCLIP
Weapon.SelectionOrder 300;
Weapon.AmmoUse1 20;
Weapon.AmmoGive1 40;
Weapon.AmmoType1 "EnergyPod";
Weapon.SisterWeapon "Mauler2";
Inventory.Icon "TRPDA0";
Tag "$TAG_MAULER1";
Inventory.PickupMessage "$TXT_MAULER";
Obituary "$OB_MPMAULER1";
}
action native void A_FireMauler1 ();
States
{
Ready:
MAUL FGHA 6 A_WeaponReady;
Loop;
Deselect:
MAUL A 1 A_Lower;
Loop;
Select:
MAUL A 1 A_Raise;
Loop;
Fire:
BLSF A 5 Bright A_FireMauler1;
MAUL B 3 Bright A_Light1;
MAUL C 2 A_Light2;
MAUL DE 2;
MAUL A 7 A_Light0;
MAUL H 7;
MAUL G 7 A_CheckReload;
Goto Ready;
Spawn:
TRPD A -1;
Stop;
}
}
// Mauler Torpedo version ---------------------------------------------------
class Mauler2 : Mauler
{
Default
{
Weapon.SelectionOrder 3300;
Weapon.AmmoUse1 30;
Weapon.AmmoGive1 0;
Weapon.AmmoType1 "EnergyPod";
Weapon.SisterWeapon "Mauler";
Tag "$TAG_MAULER2";
}
action native void A_FireMauler2Pre ();
action native void A_FireMauler2 ();
States
{
Ready:
MAUL IJKL 7 A_WeaponReady;
Loop;
Deselect:
MAUL I 1 A_Lower;
Loop;
Select:
MAUL I 1 A_Raise;
Loop;
Fire:
MAUL I 20 A_FireMauler2Pre;
MAUL J 10 A_Light1;
BLSF A 10 Bright A_FireMauler2;
MAUL B 10 Bright A_Light2;
MAUL C 2;
MAUL D 2 A_Light0;
MAUL E 2 A_ReFire;
Goto Ready;
}
}
// Mauler "Bullet" Puff -----------------------------------------------------
class MaulerPuff : Actor
{
Default
{
+NOBLOCKMAP
+NOGRAVITY
+PUFFONACTORS
RenderStyle "Add";
DamageType "Disintegrate";
}
States
{
Spawn:
MPUF AB 5;
POW1 ABCDE 4;
Stop;
}
}
// The Mauler's Torpedo -----------------------------------------------------
class MaulerTorpedo : Actor
{
Default
{
Speed 20;
Height 8;
Radius 13;
Damage 1;
DamageType "Disintegrate";
Projectile;
+STRIFEDAMAGE
MaxStepHeight 4;
RenderStyle "Add";
SeeSound "weapons/mauler2fire";
DeathSound "weapons/mauler2hit";
Obituary "$OB_MPMAULER";
}
native void A_MaulerTorpedoWave ();
States
{
Spawn:
TORP ABCD 4 Bright;
Loop;
Death:
THIT AB 8 Bright;
THIT C 8 Bright A_MaulerTorpedoWave;
THIT DE 8 Bright;
Stop;
}
}
// The mini torpedoes shot by the big torpedo --------------------------------
class MaulerTorpedoWave : Actor
{
Default
{
Speed 35;
Radius 13;
Height 13;
Damage 10;
DamageType "Disintegrate";
Projectile;
+STRIFEDAMAGE
MaxStepHeight 4;
RenderStyle "Add";
Obituary "$OB_MPMAULER";
}
States
{
Spawn:
TWAV AB 9 Bright;
Death:
TWAV C 9 Bright;
Stop;
}
}

View file

@ -0,0 +1,286 @@
// Mauler -------------------------------------------------------------------
// The scatter version
class Mauler : StrifeWeapon
{
Default
{
+FLOORCLIP
Weapon.SelectionOrder 300;
Weapon.AmmoUse1 20;
Weapon.AmmoGive1 40;
Weapon.AmmoType1 "EnergyPod";
Weapon.SisterWeapon "Mauler2";
Inventory.Icon "TRPDA0";
Tag "$TAG_MAULER1";
Inventory.PickupMessage "$TXT_MAULER";
Obituary "$OB_MPMAULER1";
}
States
{
Ready:
MAUL FGHA 6 A_WeaponReady;
Loop;
Deselect:
MAUL A 1 A_Lower;
Loop;
Select:
MAUL A 1 A_Raise;
Loop;
Fire:
BLSF A 5 Bright A_FireMauler1;
MAUL B 3 Bright A_Light1;
MAUL C 2 A_Light2;
MAUL DE 2;
MAUL A 7 A_Light0;
MAUL H 7;
MAUL G 7 A_CheckReload;
Goto Ready;
Spawn:
TRPD A -1;
Stop;
}
//============================================================================
//
// A_FireMauler1
//
// Hey! This is exactly the same as a super shotgun except for the sound
// and the bullet puffs and the disintegration death.
//
//============================================================================
action void A_FireMauler1()
{
if (player == null)
{
return;
}
A_PlaySound ("weapons/mauler1", CHAN_WEAPON);
Weapon weap = player.ReadyWeapon;
if (weap != null)
{
if (!weap.DepleteAmmo (weap.bAltFire, true, 2))
return;
}
player.mo.PlayAttacking2 ();
double pitch = BulletSlope ();
for (int i = 0 ; i < 20 ; i++)
{
int damage = 5 * random[Mauler1](1, 3);
double ang = angle + Random2[Mauler1]() * (11.25 / 256);
// Strife used a range of 2112 units for the mauler to signal that
// it should use a different puff. ZDoom's default range is longer
// than this, so let's not handicap it by being too faithful to the
// original.
LineAttack (ang, PLAYERMISSILERANGE, pitch + Random2[Mauler1]() * (7.097 / 256), damage, 'Hitscan', "MaulerPuff");
}
}
}
// Mauler Torpedo version ---------------------------------------------------
class Mauler2 : Mauler
{
Default
{
Weapon.SelectionOrder 3300;
Weapon.AmmoUse1 30;
Weapon.AmmoGive1 0;
Weapon.AmmoType1 "EnergyPod";
Weapon.SisterWeapon "Mauler";
Tag "$TAG_MAULER2";
}
States
{
Ready:
MAUL IJKL 7 A_WeaponReady;
Loop;
Deselect:
MAUL I 1 A_Lower;
Loop;
Select:
MAUL I 1 A_Raise;
Loop;
Fire:
MAUL I 20 A_FireMauler2Pre;
MAUL J 10 A_Light1;
BLSF A 10 Bright A_FireMauler2;
MAUL B 10 Bright A_Light2;
MAUL C 2;
MAUL D 2 A_Light0;
MAUL E 2 A_ReFire;
Goto Ready;
}
//============================================================================
//
// A_FireMauler2Pre
//
// Makes some noise and moves the psprite.
//
//============================================================================
action void A_FireMauler2Pre ()
{
A_PlaySound ("weapons/mauler2charge", CHAN_WEAPON);
if (player != null)
{
PSprite psp = player.GetPSprite(PSP_WEAPON);
psp.x += Random2[Mauler2]() / 64.;
psp.y += Random2[Mauler2]() / 64.;
}
}
//============================================================================
//
// A_FireMauler2Pre
//
// Fires the torpedo.
//
//============================================================================
action void A_FireMauler2 ()
{
if (player == null)
{
return;
}
Weapon weapon = player.ReadyWeapon;
if (weapon != null)
{
if (!weapon.DepleteAmmo (weapon.bAltFire))
return;
}
player.mo.PlayAttacking2 ();
SpawnPlayerMissile ("MaulerTorpedo");
DamageMobj (self, null, 20, 'Disintegrate');
Thrust(7.8125, Angle+180.);
}
}
// Mauler "Bullet" Puff -----------------------------------------------------
class MaulerPuff : Actor
{
Default
{
+NOBLOCKMAP
+NOGRAVITY
+PUFFONACTORS
RenderStyle "Add";
DamageType "Disintegrate";
}
States
{
Spawn:
MPUF AB 5;
POW1 ABCDE 4;
Stop;
}
}
// The Mauler's Torpedo -----------------------------------------------------
class MaulerTorpedo : Actor
{
Default
{
Speed 20;
Height 8;
Radius 13;
Damage 1;
DamageType "Disintegrate";
Projectile;
+STRIFEDAMAGE
MaxStepHeight 4;
RenderStyle "Add";
SeeSound "weapons/mauler2fire";
DeathSound "weapons/mauler2hit";
Obituary "$OB_MPMAULER";
}
States
{
Spawn:
TORP ABCD 4 Bright;
Loop;
Death:
THIT AB 8 Bright;
THIT C 8 Bright A_MaulerTorpedoWave;
THIT DE 8 Bright;
Stop;
}
//============================================================================
//
// A_MaulerTorpedoWave
//
// Launches lots of balls when the torpedo hits something.
//
//============================================================================
action void A_MaulerTorpedoWave()
{
readonly<Actor> wavedef = GetDefaultByType("MaulerTorpedoWave");
double savedz = pos.z;
angle += 180.;
// If the torpedo hit the ceiling, it should still spawn the wave
if (wavedef && ceilingz < pos.z + wavedef.Height)
{
SetZ(ceilingz - wavedef.Height);
}
for (int i = 0; i < 80; ++i)
{
Angle += 4.5;
SpawnSubMissile ("MaulerTorpedoWave", target);
}
SetZ(savedz);
}
}
// The mini torpedoes shot by the big torpedo --------------------------------
class MaulerTorpedoWave : Actor
{
Default
{
Speed 35;
Radius 13;
Height 13;
Damage 10;
DamageType "Disintegrate";
Projectile;
+STRIFEDAMAGE
MaxStepHeight 4;
RenderStyle "Add";
Obituary "$OB_MPMAULER";
}
States
{
Spawn:
TWAV AB 9 Bright;
Death:
TWAV C 9 Bright;
Stop;
}
}