mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-10 23:01:59 +00:00
- scriptified Strife's assault gun and missile launcher.
This commit is contained in:
parent
be5ba70ed2
commit
5beebb83b7
10 changed files with 260 additions and 284 deletions
|
@ -1717,7 +1717,6 @@ bool AInventory::CallTryPickup (AActor *toucher, AActor **toucher_return)
|
|||
bool res;
|
||||
if (CanPickup(toucher))
|
||||
{
|
||||
bool res;
|
||||
IFVIRTUAL(AInventory, TryPickup)
|
||||
{
|
||||
VMValue params[2] = { (DObject*)this, (void*)&toucher };
|
||||
|
|
|
@ -30,117 +30,8 @@ void A_Countdown (AActor *);
|
|||
|
||||
// Assault Gun --------------------------------------------------------------
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
// P_StrifeGunShot
|
||||
//
|
||||
//============================================================================
|
||||
|
||||
void P_StrifeGunShot (AActor *mo, bool accurate, DAngle pitch)
|
||||
{
|
||||
DAngle angle;
|
||||
int damage;
|
||||
|
||||
damage = 4*(pr_sgunshot()%3+1);
|
||||
angle = mo->Angles.Yaw;
|
||||
|
||||
if (mo->player != NULL && !accurate)
|
||||
{
|
||||
angle += pr_sgunshot.Random2() * (22.5 / 256) * mo->player->mo->AccuracyFactor();
|
||||
}
|
||||
|
||||
P_LineAttack (mo, angle, PLAYERMISSILERANGE, pitch, damage, NAME_Hitscan, NAME_StrifePuff);
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
// A_FireAssaultGun
|
||||
//
|
||||
//============================================================================
|
||||
|
||||
DEFINE_ACTION_FUNCTION(AActor, A_FireAssaultGun)
|
||||
{
|
||||
PARAM_ACTION_PROLOGUE(AActor);
|
||||
|
||||
bool accurate;
|
||||
|
||||
S_Sound (self, CHAN_WEAPON, "weapons/assaultgun", 1, ATTN_NORM);
|
||||
|
||||
if (self->player != NULL)
|
||||
{
|
||||
AWeapon *weapon = self->player->ReadyWeapon;
|
||||
if (weapon != NULL)
|
||||
{
|
||||
if (!weapon->DepleteAmmo (weapon->bAltFire))
|
||||
return 0;
|
||||
}
|
||||
self->player->mo->PlayAttacking2 ();
|
||||
accurate = !self->player->refire;
|
||||
}
|
||||
else
|
||||
{
|
||||
accurate = true;
|
||||
}
|
||||
|
||||
P_StrifeGunShot (self, accurate, P_BulletSlope (self));
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Mini-Missile Launcher ----------------------------------------------------
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
// A_FireMiniMissile
|
||||
//
|
||||
//============================================================================
|
||||
|
||||
DEFINE_ACTION_FUNCTION(AActor, A_FireMiniMissile)
|
||||
{
|
||||
PARAM_ACTION_PROLOGUE(AActor);
|
||||
|
||||
player_t *player = self->player;
|
||||
DAngle savedangle;
|
||||
|
||||
if (self->player == NULL)
|
||||
return 0;
|
||||
|
||||
AWeapon *weapon = self->player->ReadyWeapon;
|
||||
if (weapon != NULL)
|
||||
{
|
||||
if (!weapon->DepleteAmmo (weapon->bAltFire))
|
||||
return 0;
|
||||
}
|
||||
|
||||
savedangle = self->Angles.Yaw;
|
||||
self->Angles.Yaw += pr_minimissile.Random2() * (11.25 / 256) * player->mo->AccuracyFactor();
|
||||
player->mo->PlayAttacking2 ();
|
||||
P_SpawnPlayerMissile (self, PClass::FindActor("MiniMissile"));
|
||||
self->Angles.Yaw = savedangle;
|
||||
return 0;
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
// A_RocketInFlight
|
||||
//
|
||||
//============================================================================
|
||||
|
||||
DEFINE_ACTION_FUNCTION(AActor, A_RocketInFlight)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(AActor);
|
||||
|
||||
AActor *trail;
|
||||
|
||||
S_Sound (self, CHAN_VOICE, "misc/missileinflight", 1, ATTN_NORM);
|
||||
P_SpawnPuff (self, PClass::FindActor("MiniMissilePuff"), self->Pos(), self->Angles.Yaw - 180, self->Angles.Yaw - 180, 2, PF_HITTHING);
|
||||
trail = Spawn("RocketTrail", self->Vec3Offset(-self->Vel.X, -self->Vel.Y, 0.), ALLOW_REPLACE);
|
||||
if (trail != NULL)
|
||||
{
|
||||
trail->Vel.Z = 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Flame Thrower ------------------------------------------------------------
|
||||
|
||||
//============================================================================
|
||||
|
|
|
@ -191,6 +191,8 @@ zscript/strife/templar.txt
|
|||
zscript/strife/zombie.txt
|
||||
zscript/strife/weapondagger.txt
|
||||
zscript/strife/weaponcrossbow.txt
|
||||
zscript/strife/weaponassault.txt
|
||||
zscript/strife/weaponmissile.txt
|
||||
zscript/strife/sigil.txt
|
||||
|
||||
zscript/chex/chexmonsters.txt
|
||||
|
|
|
@ -694,7 +694,6 @@ class Actor : Thinker native
|
|||
native void A_ClearLastHeard();
|
||||
native bool A_SelectWeapon(class<Weapon> whichweapon, int flags = 0);
|
||||
native void A_ClassBossHealth();
|
||||
native void A_RocketInFlight();
|
||||
native void A_SetAngle(double angle = 0, int flags = 0, int ptr = AAPTR_DEFAULT);
|
||||
native void A_SetPitch(double pitch, int flags = 0, int ptr = AAPTR_DEFAULT);
|
||||
native void A_SetRoll(double roll, int flags = 0, int ptr = AAPTR_DEFAULT);
|
||||
|
|
|
@ -1037,3 +1037,12 @@ enum EGameAction
|
|||
ga_togglemap,
|
||||
ga_fullconsole,
|
||||
};
|
||||
|
||||
enum EPuffFlags
|
||||
{
|
||||
PF_HITTHING = 1,
|
||||
PF_MELEERANGE = 2,
|
||||
PF_TEMPORARY = 4,
|
||||
PF_HITTHINGBLEED = 8,
|
||||
PF_NORANDOMZ = 16
|
||||
};
|
||||
|
|
|
@ -83,7 +83,6 @@ class StateProvider : Inventory native
|
|||
action native void A_ClearReFire();
|
||||
action native void A_CheckReload();
|
||||
action native void A_GunFlash(statelabel flash = null, int flags = 0);
|
||||
action native void A_FireAssaultGun();
|
||||
action native state A_CheckForReload(int counter, statelabel label, bool dontincrement = false);
|
||||
action native void A_ResetReloadCounter();
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// common Strife action functions.
|
||||
// common Strife action functions that are used by multiple different actors
|
||||
|
||||
extend class Actor
|
||||
{
|
||||
|
@ -177,5 +177,22 @@ extend class Actor
|
|||
}
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
// A_RocketInFlight
|
||||
//
|
||||
//============================================================================
|
||||
|
||||
void A_RocketInFlight()
|
||||
{
|
||||
A_PlaySound ("misc/missileinflight", CHAN_VOICE);
|
||||
SpawnPuff ("MiniMissilePuff", Pos, Angle - 180, Angle - 180, 2, PF_HITTHING);
|
||||
Actor trail = Spawn("RocketTrail", Vec3Offset(-Vel.X, -Vel.Y, 0.), ALLOW_REPLACE);
|
||||
if (trail != null)
|
||||
{
|
||||
trail.Vel.Z = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -50,177 +50,6 @@ class StrifeSpark : StrifePuff
|
|||
}
|
||||
}
|
||||
|
||||
// Assault Gun --------------------------------------------------------------
|
||||
|
||||
class AssaultGun : StrifeWeapon
|
||||
{
|
||||
Default
|
||||
{
|
||||
+FLOORCLIP
|
||||
Weapon.SelectionOrder 600;
|
||||
Weapon.AmmoUse1 1;
|
||||
Weapon.AmmoGive1 20;
|
||||
Weapon.AmmoType1 "ClipOfBullets";
|
||||
Inventory.Icon "RIFLA0";
|
||||
Tag "$TAG_ASSAULTGUN";
|
||||
Inventory.PickupMessage "$TXT_ASSAULTGUN";
|
||||
Obituary "$OB_MPASSAULTGUN";
|
||||
}
|
||||
States
|
||||
{
|
||||
Spawn:
|
||||
RIFL A -1;
|
||||
Stop;
|
||||
Ready:
|
||||
RIFG A 1 A_WeaponReady;
|
||||
Loop;
|
||||
Deselect:
|
||||
RIFG B 1 A_Lower;
|
||||
Loop;
|
||||
Select:
|
||||
RIFG A 1 A_Raise;
|
||||
Loop;
|
||||
Fire:
|
||||
RIFF AB 3 A_FireAssaultGun;
|
||||
RIFG D 3 A_FireAssaultGun;
|
||||
RIFG C 0 A_ReFire;
|
||||
RIFG B 2 A_Light0;
|
||||
Goto Ready;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Standing variant of the assault gun --------------------------------------
|
||||
|
||||
class AssaultGunStanding : WeaponGiver
|
||||
{
|
||||
Default
|
||||
{
|
||||
DropItem "AssaultGun";
|
||||
Inventory.PickupMessage "$TXT_ASSAULTGUN";
|
||||
}
|
||||
States
|
||||
{
|
||||
Spawn:
|
||||
RIFL B -1;
|
||||
Stop;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Mini-Missile Launcher ----------------------------------------------------
|
||||
|
||||
|
||||
class MiniMissileLauncher : StrifeWeapon
|
||||
{
|
||||
Default
|
||||
{
|
||||
+FLOORCLIP
|
||||
Weapon.SelectionOrder 1800;
|
||||
Weapon.AmmoUse1 1;
|
||||
Weapon.AmmoGive1 8;
|
||||
Weapon.AmmoType1 "MiniMissiles";
|
||||
Inventory.Icon "MMSLA0";
|
||||
Tag "$TAG_MMLAUNCHER";
|
||||
Inventory.PickupMessage "$TXT_MMLAUNCHER";
|
||||
}
|
||||
|
||||
action native void A_FireMiniMissile ();
|
||||
|
||||
States
|
||||
{
|
||||
Spawn:
|
||||
MMSL A -1;
|
||||
Stop;
|
||||
Ready:
|
||||
MMIS A 1 A_WeaponReady;
|
||||
Loop;
|
||||
Deselect:
|
||||
MMIS A 1 A_Lower;
|
||||
Loop;
|
||||
Select:
|
||||
MMIS A 1 A_Raise;
|
||||
Loop;
|
||||
Fire:
|
||||
MMIS A 4 A_FireMiniMissile;
|
||||
MMIS B 4 A_Light1;
|
||||
MMIS C 5 Bright;
|
||||
MMIS D 2 Bright A_Light2;
|
||||
MMIS E 2 Bright;
|
||||
MMIS F 2 Bright A_Light0;
|
||||
MMIS F 0 A_ReFire;
|
||||
Goto Ready;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Rocket Trail -------------------------------------------------------------
|
||||
|
||||
class RocketTrail : Actor
|
||||
{
|
||||
Default
|
||||
{
|
||||
+NOBLOCKMAP
|
||||
+NOGRAVITY
|
||||
RenderStyle "Translucent";
|
||||
Alpha 0.25;
|
||||
SeeSound "misc/missileinflight";
|
||||
}
|
||||
States
|
||||
{
|
||||
Spawn:
|
||||
PUFY BCBCD 4;
|
||||
Stop;
|
||||
}
|
||||
}
|
||||
|
||||
// Rocket Puff --------------------------------------------------------------
|
||||
|
||||
class MiniMissilePuff : StrifePuff
|
||||
{
|
||||
Default
|
||||
{
|
||||
-ALLOWPARTICLES
|
||||
}
|
||||
States
|
||||
{
|
||||
Spawn:
|
||||
Goto Crash;
|
||||
}
|
||||
}
|
||||
|
||||
// Mini Missile -------------------------------------------------------------
|
||||
|
||||
class MiniMissile : Actor
|
||||
{
|
||||
Default
|
||||
{
|
||||
Speed 20;
|
||||
Radius 10;
|
||||
Height 14;
|
||||
Damage 10;
|
||||
Projectile;
|
||||
+STRIFEDAMAGE
|
||||
MaxStepHeight 4;
|
||||
SeeSound "weapons/minimissile";
|
||||
DeathSound "weapons/minimissilehit";
|
||||
Obituary "$OB_MPMINIMISSILELAUNCHER";
|
||||
}
|
||||
States
|
||||
{
|
||||
Spawn:
|
||||
MICR A 6 Bright A_RocketInFlight;
|
||||
Loop;
|
||||
Death:
|
||||
SMIS A 0 Bright A_SetRenderStyle(1, STYLE_Normal);
|
||||
SMIS A 5 Bright A_Explode(64, 64, alert:true);
|
||||
SMIS B 5 Bright;
|
||||
SMIS C 4 Bright;
|
||||
SMIS DEFG 2 Bright;
|
||||
Stop;
|
||||
}
|
||||
}
|
||||
|
||||
// Flame Thrower ------------------------------------------------------------
|
||||
|
||||
class FlameThrower : StrifeWeapon
|
||||
|
|
94
wadsrc/static/zscript/strife/weaponassault.txt
Normal file
94
wadsrc/static/zscript/strife/weaponassault.txt
Normal file
|
@ -0,0 +1,94 @@
|
|||
// Assault Gun --------------------------------------------------------------
|
||||
|
||||
class AssaultGun : StrifeWeapon
|
||||
{
|
||||
Default
|
||||
{
|
||||
+FLOORCLIP
|
||||
Weapon.SelectionOrder 600;
|
||||
Weapon.AmmoUse1 1;
|
||||
Weapon.AmmoGive1 20;
|
||||
Weapon.AmmoType1 "ClipOfBullets";
|
||||
Inventory.Icon "RIFLA0";
|
||||
Tag "$TAG_ASSAULTGUN";
|
||||
Inventory.PickupMessage "$TXT_ASSAULTGUN";
|
||||
Obituary "$OB_MPASSAULTGUN";
|
||||
}
|
||||
States
|
||||
{
|
||||
Spawn:
|
||||
RIFL A -1;
|
||||
Stop;
|
||||
Ready:
|
||||
RIFG A 1 A_WeaponReady;
|
||||
Loop;
|
||||
Deselect:
|
||||
RIFG B 1 A_Lower;
|
||||
Loop;
|
||||
Select:
|
||||
RIFG A 1 A_Raise;
|
||||
Loop;
|
||||
Fire:
|
||||
RIFF AB 3 A_FireAssaultGun;
|
||||
RIFG D 3 A_FireAssaultGun;
|
||||
RIFG C 0 A_ReFire;
|
||||
RIFG B 2 A_Light0;
|
||||
Goto Ready;
|
||||
}
|
||||
}
|
||||
|
||||
extend class StateProvider
|
||||
{
|
||||
//============================================================================
|
||||
//
|
||||
// A_FireAssaultGun
|
||||
//
|
||||
//============================================================================
|
||||
|
||||
void A_FireAssaultGun()
|
||||
{
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
A_PlaySound ("weapons/assaultgun", CHAN_WEAPON);
|
||||
|
||||
Weapon weapon = player.ReadyWeapon;
|
||||
if (weapon != null)
|
||||
{
|
||||
if (!weapon.DepleteAmmo (weapon.bAltFire))
|
||||
return;
|
||||
}
|
||||
player.mo.PlayAttacking2 ();
|
||||
|
||||
int damage = 4*(random[StrifeGun]() % 3 + 1);
|
||||
double ang = angle;
|
||||
|
||||
if (player.refire)
|
||||
{
|
||||
ang += Random2[StrifeGun]() * (22.5 / 256) * AccuracyFactor();
|
||||
}
|
||||
LineAttack (ang, PLAYERMISSILERANGE, BulletSlope (), damage, 'Hitscan', "StrifePuff");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Standing variant of the assault gun --------------------------------------
|
||||
|
||||
class AssaultGunStanding : WeaponGiver
|
||||
{
|
||||
Default
|
||||
{
|
||||
DropItem "AssaultGun";
|
||||
Inventory.PickupMessage "$TXT_ASSAULTGUN";
|
||||
}
|
||||
States
|
||||
{
|
||||
Spawn:
|
||||
RIFL B -1;
|
||||
Stop;
|
||||
}
|
||||
}
|
||||
|
||||
|
137
wadsrc/static/zscript/strife/weaponmissile.txt
Normal file
137
wadsrc/static/zscript/strife/weaponmissile.txt
Normal file
|
@ -0,0 +1,137 @@
|
|||
// Mini-Missile Launcher ----------------------------------------------------
|
||||
|
||||
class MiniMissileLauncher : StrifeWeapon
|
||||
{
|
||||
Default
|
||||
{
|
||||
+FLOORCLIP
|
||||
Weapon.SelectionOrder 1800;
|
||||
Weapon.AmmoUse1 1;
|
||||
Weapon.AmmoGive1 8;
|
||||
Weapon.AmmoType1 "MiniMissiles";
|
||||
Inventory.Icon "MMSLA0";
|
||||
Tag "$TAG_MMLAUNCHER";
|
||||
Inventory.PickupMessage "$TXT_MMLAUNCHER";
|
||||
}
|
||||
|
||||
States
|
||||
{
|
||||
Spawn:
|
||||
MMSL A -1;
|
||||
Stop;
|
||||
Ready:
|
||||
MMIS A 1 A_WeaponReady;
|
||||
Loop;
|
||||
Deselect:
|
||||
MMIS A 1 A_Lower;
|
||||
Loop;
|
||||
Select:
|
||||
MMIS A 1 A_Raise;
|
||||
Loop;
|
||||
Fire:
|
||||
MMIS A 4 A_FireMiniMissile;
|
||||
MMIS B 4 A_Light1;
|
||||
MMIS C 5 Bright;
|
||||
MMIS D 2 Bright A_Light2;
|
||||
MMIS E 2 Bright;
|
||||
MMIS F 2 Bright A_Light0;
|
||||
MMIS F 0 A_ReFire;
|
||||
Goto Ready;
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
// A_FireMiniMissile
|
||||
//
|
||||
//============================================================================
|
||||
|
||||
action void A_FireMiniMissile ()
|
||||
{
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Weapon weapon = player.ReadyWeapon;
|
||||
if (weapon != null)
|
||||
{
|
||||
if (!weapon.DepleteAmmo (weapon.bAltFire))
|
||||
return;
|
||||
}
|
||||
|
||||
double savedangle = angle;
|
||||
angle += Random2[MiniMissile]() * (11.25 / 256) * AccuracyFactor();
|
||||
player.mo.PlayAttacking2 ();
|
||||
SpawnPlayerMissile ("MiniMissile");
|
||||
angle = savedangle;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Rocket Trail -------------------------------------------------------------
|
||||
|
||||
class RocketTrail : Actor
|
||||
{
|
||||
Default
|
||||
{
|
||||
+NOBLOCKMAP
|
||||
+NOGRAVITY
|
||||
RenderStyle "Translucent";
|
||||
Alpha 0.25;
|
||||
SeeSound "misc/missileinflight";
|
||||
}
|
||||
States
|
||||
{
|
||||
Spawn:
|
||||
PUFY BCBCD 4;
|
||||
Stop;
|
||||
}
|
||||
}
|
||||
|
||||
// Rocket Puff --------------------------------------------------------------
|
||||
|
||||
class MiniMissilePuff : StrifePuff
|
||||
{
|
||||
Default
|
||||
{
|
||||
-ALLOWPARTICLES
|
||||
}
|
||||
States
|
||||
{
|
||||
Spawn:
|
||||
Goto Crash;
|
||||
}
|
||||
}
|
||||
|
||||
// Mini Missile -------------------------------------------------------------
|
||||
|
||||
class MiniMissile : Actor
|
||||
{
|
||||
Default
|
||||
{
|
||||
Speed 20;
|
||||
Radius 10;
|
||||
Height 14;
|
||||
Damage 10;
|
||||
Projectile;
|
||||
+STRIFEDAMAGE
|
||||
MaxStepHeight 4;
|
||||
SeeSound "weapons/minimissile";
|
||||
DeathSound "weapons/minimissilehit";
|
||||
Obituary "$OB_MPMINIMISSILELAUNCHER";
|
||||
}
|
||||
States
|
||||
{
|
||||
Spawn:
|
||||
MICR A 6 Bright A_RocketInFlight;
|
||||
Loop;
|
||||
Death:
|
||||
SMIS A 0 Bright A_SetRenderStyle(1, STYLE_Normal);
|
||||
SMIS A 5 Bright A_Explode(64, 64, alert:true);
|
||||
SMIS B 5 Bright;
|
||||
SMIS C 4 Bright;
|
||||
SMIS DEFG 2 Bright;
|
||||
Stop;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in a new issue