All misc items implemented. Enhanced Shock Rifle implemented.

Going to focus on the HUD now while at the same time doing the remaining weapons.
This commit is contained in:
Marisa the Magician 2018-05-21 20:28:17 +02:00
commit d3da87cefe
310 changed files with 2236 additions and 77 deletions

View file

@ -1,9 +1,43 @@
Class UTArmorBonus : ArmorBonus replaces ArmorBonus
Class UTArmor : Armor
{
int absorb;
Property ArmorAbsorption : absorb;
Default
{
+INVENTORY.AUTOACTIVATE;
+INVENTORY.UNTOSSABLE;
}
override void AbsorbDamage( int damage, Name damageType, out int newdamage )
{
int saved;
if ( (amount > 0) && !DamageTypeDefinition.IgnoreArmor(damageType) )
{
saved = damage*absorb/100.;
if ( amount <= saved ) saved = amount;
newdamage -= saved;
amount -= saved;
damage = newdamage;
}
if ( damage > 0 ) newdamage = ApplyDamageFactors(GetClass(),damageType,damage,damage);
if ( amount <= 0 ) Destroy();
}
}
Class UTArmorBonus : UTArmor replaces ArmorBonus
{
Default
{
Tag "Armor Bonus";
Armor.SaveAmount 5;
+COUNTITEM;
+INVENTORY.AUTOACTIVATE;
+INVENTORY.UNTOSSABLE;
+INVENTORY.ALWAYSPICKUP;
Inventory.Amount 5;
Inventory.MaxAmount 50;
Inventory.InterHubAmount 50;
UTArmor.ArmorAbsorption 25;
Inventory.PickupMessage "You picked up an Armor Bonus.";
Inventory.PickupSound "misc/ut_shard";
}
@ -15,18 +49,15 @@ Class UTArmorBonus : ArmorBonus replaces ArmorBonus
}
}
// TODO system for separating the 4 armor pickups (like Hexen's, but not as strict)
Class UTArmor : Inventory
{
}
Class UTThighPads : BasicArmorPickup replaces GreenArmor
Class UTThighPads : UTArmor replaces GreenArmor
{
Default
{
Tag "Thigh Pads";
Armor.SaveAmount 50;
Armor.SavePercent 50;
Inventory.Amount 50;
Inventory.MaxAmount 50;
Inventory.InterHubAmount 50;
UTArmor.ArmorAbsorption 50;
Inventory.PickupMessage "You got the Thigh Pads.";
Inventory.PickupSound "misc/ut_armor";
}
@ -38,13 +69,15 @@ Class UTThighPads : BasicArmorPickup replaces GreenArmor
}
}
Class UTBodyArmor : BasicArmorPickup replaces BlueArmor
Class UTBodyArmor : UTArmor replaces BlueArmor
{
Default
{
Tag "Body Armor";
Armor.SaveAmount 100;
Armor.SavePercent 75;
Inventory.Amount 100;
Inventory.MaxAmount 100;
Inventory.InterHubAmount 100;
UTArmor.ArmorAbsorption 75;
Inventory.PickupMessage "You got the Body Armor.";
Inventory.PickupSound "misc/ut_armor";
}
@ -56,29 +89,43 @@ Class UTBodyArmor : BasicArmorPickup replaces BlueArmor
}
}
Class UTShieldBelt : Inventory replaces Megasphere
Class UTShieldBelt : UTArmor replaces Megasphere
{
override void ModifyDamage( int damage, Name damageType, out int newdamage, bool passive )
override void AbsorbDamage( int damage, Name damageType, out int newdamage )
{
if ( !passive || (damage <= 0) ) return;
newdamage = max(0,damage-Amount);
Owner.A_PlaySound("belt/absorb");
if ( amount-damage <= 0 ) Owner.A_Print("The Shield Belt has depleted.");
Owner.TakeInventory("UTShieldBelt",min(amount,damage));
if ( (amount > 0) && !DamageTypeDefinition.IgnoreArmor(damageType) ) Owner.A_PlaySound("belt/absorb");
Super.AbsorbDamage(damage,damageType,newdamage);
}
override void OnDestroy()
{
Super.OnDestroy();
if ( amount <= 0 && Owner ) PrintPickupMessage(true,"The Shield Belt has depleted.");
}
override bool Use( bool pickup )
{
// removes thigh pads and body armor like in UT
Owner.TakeInventory("UTThighPads",50);
Owner.TakeInventory("UTBodyArmor",150);
return false;
}
override bool HandlePickup( Inventory item )
{
if ( (item is 'UTThighPads') || (item is 'UTBodyArmor') ) return true;
return Super.HandlePickup(item);
}
Default
{
Tag "Shield Belt";
+COUNTITEM;
+INVENTORY.AUTOACTIVATE;
+Inventory.UNTOSSABLE;
+INVENTORY.ALWAYSPICKUP;
+INVENTORY.BIGPOWERUP;
Inventory.Amount 150;
Inventory.MaxAmount 150;
Inventory.InterHubAmount 150;
UTArmor.ArmorAbsorption 100;
Inventory.PickupMessage "You got the Shield Belt.";
Inventory.PickupSound "belt/pickup";
Inventory.RespawnTics 2100;
}
States
{

View file

@ -17,7 +17,7 @@ Class Tier3Weapon : RandomSpawner replaces Shotgun
}
Class Tier3Weapon2 : Tier3Weapon replaces SuperShotgun {}
Class BioAmmo : Ammo
Class BioAmmo : UTAmmo
{
Default
{
@ -28,6 +28,7 @@ Class BioAmmo : Ammo
Ammo.BackpackAmount 50;
Ammo.BackpackMaxAmount 200;
Ammo.DropAmount 25;
UTAmmo.UsedInSlot AMMO_SLOT3;
}
States
{

11
zscript/chainsaw.zsc Normal file
View file

@ -0,0 +1,11 @@
Class UTChainsaw : Weapon replaces Chainsaw
{
Default
{
Tag "Chainsaw";
Inventory.PickupMessage "It's been twenty five years since I've seen one of these."; // was five years in UT99
Weapon.UpSound "";
Weapon.SlotNumber 1;
+WEAPON.MELEEWEAPON;
}
}

54
zscript/eightball.zsc Normal file
View file

@ -0,0 +1,54 @@
Class UTRocketAmmo : UTAmmo
{
Default
{
Tag "Rocket Pack";
Inventory.PickupMessage "You picked up a Rocket Pack.";
Inventory.Amount 12;
Inventory.MaxAmount 48;
Ammo.BackpackAmount 12;
Ammo.BackpackMaxAmount 96;
Ammo.DropAmount 12;
UTAmmo.UsedInSlot AMMO_SLOT9;
}
States
{
Spawn:
RPAK A -1;
Stop;
}
}
// There was no single rocket ammo in UT, so this one is also just improvised like the Redeemer ammo pickup
Class UTRocketAmmo2 : UTRocketAmmo
{
Default
{
Tag "Single Rocket";
Inventory.PickupMessage "You picked up a Single Rocket.";
Inventory.Amount 1;
Ammo.DropAmount 1;
}
States
{
Spawn:
RCKT A -1;
Stop;
}
}
Class UTRocketLauncher : UTWeapon
{
Default
{
Tag "Rocket Launcher";
Inventory.PickupMessage "You got the Rocket Launcher.";
Weapon.UpSound "";
Weapon.SlotNumber 9;
Weapon.AmmoType "UTRocketAmmo";
Weapon.AmmoUse 1;
Weapon.AmmoType2 "UTRocketAmmo";
Weapon.AmmoUse2 1;
Weapon.AmmoGive 6;
}
}

61
zscript/enforcer.zsc Normal file
View file

@ -0,0 +1,61 @@
Class EClip : MiniAmmo replaces Clip
{
Default
{
Tag "Clip"; // "Large Bullets" in UT, but I think that's an oversight, since it's the same as the Minigun ammo
Inventory.PickupMessage "You picked up a Clip.";
Inventory.Amount 20;
Ammo.DropAmount 20;
}
States
{
Spawn:
ECLP A -1;
Stop;
}
}
Class Enforcer : UTWeapon replaces Pistol
{
bool Akimbo;
override string PickupMessage()
{
if ( Owner.CountInv(GetClass()) ) return "You picked up another Enforcer!";
else return PickupMsg;
}
override bool HandlePickup (Inventory item)
{
if (item.GetClass() == GetClass())
{
if ( !Enforcer(item).Akimbo )
{
Enforcer(item).Akimbo = true;
item.bPickupGood = true;
item.SetTag("Dual Enforcers");
}
return Super.HandlePickup(item);
}
return false;
}
override Inventory CreateTossable( int amt )
{
// TODO separate drops
return Super.CreateTossable(amt);
}
Default
{
Tag "Enforcer";
Inventory.PickupMessage "You picked up an Enforcer.";
Weapon.UpSound "";
Weapon.SlotNumber 2;
Weapon.AmmoType "MiniAmmo";
Weapon.AmmoUse 1;
Weapon.AmmoType2 "MiniAmmo";
Weapon.AmmoUse2 1;
Weapon.AmmoGive 30;
}
}

View file

@ -3,7 +3,7 @@ Class Tier5Ammo : RandomSpawner replaces RocketAmmo
Default
{
DropItem "FlakAmmo2", 255, 1;
//DropItem "UTRocketAmmo2", 255, 1;
DropItem "UTRocketAmmo2", 255, 1;
}
}
Class Tier5Ammo2 : RandomSpawner replaces RocketBox
@ -11,7 +11,7 @@ Class Tier5Ammo2 : RandomSpawner replaces RocketBox
Default
{
DropItem "FlakAmmo", 255, 1;
//DropItem "UTRocketAmmo", 255, 1;
DropItem "UTRocketAmmo", 255, 1;
}
}
@ -20,11 +20,11 @@ Class Tier5Weapon : RandomSpawner replaces RocketLauncher
Default
{
DropItem "FlakCannon", 255, 1;
//DropItem "UTRocketLauncher", 255, 1;
DropItem "UTRocketLauncher", 255, 1;
}
}
Class FlakAmmo : Ammo
Class FlakAmmo : UTAmmo
{
Default
{
@ -32,9 +32,10 @@ Class FlakAmmo : Ammo
Inventory.PickupMessage "You picked up 10 Flak Shells.";
Inventory.Amount 10;
Inventory.MaxAmount 50;
Ammo.BackpackAmount 50;
Ammo.BackpackAmount 20;
Ammo.BackpackMaxAmount 100;
Ammo.DropAmount 10;
UTAmmo.UsedInSlot AMMO_SLOT8;
}
States
{

View file

@ -11,6 +11,7 @@ Class UTHealthPack : Health replaces Soulsphere
Inventory.MaxAmount 200;
Inventory.PickupMessage "You picked up the Big Keg O' Health.";
Inventory.PickupSound "misc/ut_keg";
Inventory.RespawnTics 3500;
}
States
{
@ -46,6 +47,7 @@ Class UTMedBox : Health replaces Stimpack
Inventory.Amount 20;
Inventory.PickupMessage "You picked up a Health Pack.";
Inventory.PickupSound "misc/ut_heal";
Inventory.RespawnTics 700;
}
States
{

12
zscript/impacthammer.zsc Normal file
View file

@ -0,0 +1,12 @@
Class ImpactHammer : UTWeapon replaces Fist
{
Default
{
Tag "Impact Hammer";
Inventory.PickupMessage "You got the Impact Hammer.";
Weapon.UpSound "";
Weapon.SlotNumber 1;
+WEAPON.MELEEWEAPON;
+INVENTORY.UNTOSSABLE;
}
}

62
zscript/minigun.zsc Normal file
View file

@ -0,0 +1,62 @@
Class Tier6Ammo : RandomSpawner replaces Cell
{
Default
{
DropItem "EClip", 255, 1;
DropItem "RifleAmmo2", 255, 1;
}
}
Class Tier6Ammo2 : RandomSpawner replaces CellPack
{
Default
{
DropItem "MiniAmmo", 255, 1;
DropItem "RifleAmmo", 255, 1;
}
}
Class Tier6Weapon : RandomSpawner replaces PlasmaRifle
{
Default
{
DropItem "Minigun", 255, 1;
DropItem "SniperRifle", 255, 1;
}
}
Class MiniAmmo : UTAmmo
{
Default
{
Tag "Large Bullets";
Inventory.PickupMessage "You picked up 50 bullets.";
Inventory.Amount 50;
Inventory.MaxAmount 200;
Ammo.BackpackAmount 100;
Ammo.BackpackMaxAmount 400;
Ammo.DropAmount 50;
UTAmmo.UsedInSlot AMMO_SLOT2|AMMO_SLOT7;
}
States
{
Spawn:
MAMO A -1;
Stop;
}
}
Class Minigun : UTWeapon
{
Default
{
Tag "Minigun";
Inventory.PickupMessage "You got the Minigun.";
Weapon.UpSound "";
Weapon.SlotNumber 7;
Weapon.AmmoType "MiniAmmo";
Weapon.AmmoUse 1;
Weapon.AmmoType2 "MiniAmmo";
Weapon.AmmoUse2 1;
Weapon.AmmoGive 50;
}
}

View file

@ -1,4 +1,4 @@
Class UDamage : PowerupGiver replaces InvulnerabilitySphere
Class UDamage : PowerupGiver replaces Berserk
{
Default
{
@ -11,6 +11,7 @@ Class UDamage : PowerupGiver replaces InvulnerabilitySphere
Inventory.MaxAmount 0;
Powerup.Type "DamageAmplifier";
Inventory.PickupSound "udamage/pickup";
Inventory.RespawnTics 4200;
}
action void A_CheckSkin()
{
@ -74,6 +75,12 @@ Class DamageAmplifier : Powerup
Owner.A_PlaySound("udamage/drain",CHAN_6,1.0,false,0.25);
}
override void EndEffect()
{
Super.EndEffect();
PrintPickupMessage(true,"Damage Amplifier has worn off.");
}
override bool isBlinking()
{
return ((EffectTics <= 175) && (EffectTics%35 >= 30));
@ -92,3 +99,373 @@ Class DamageAmplifier : Powerup
if ( !(Owner.player.ReadyWeapon is 'UTWeapon') ) FireEffect();
}
}
// Backpack that handles UT ammo types
Class UTBackpack : BackpackItem replaces Backpack
{
override Inventory CreateCopy( Actor other )
{
// Find every unique type of ammoitem. Give it to the player if
// he doesn't have it already, and double its maximum capacity.
for ( int i=0; i<AllActorClasses.Size(); i++ )
{
let type = (class<Ammo>)(AllActorClasses[i]);
if ( !type || ((type.GetParentClass() != 'Ammo') && (type.GetParentClass() != 'UTAmmo')) ) continue;
// check that it's for a valid weapon
bool isvalid = false;
for ( int j=0; j<AllActorClasses.Size(); j++ )
{
let type2 = (class<Weapon>)(AllActorClasses[j]);
if ( !type2 ) continue;
let rep = GetReplacement(type2);
if ( (rep != type2) && !(rep is "DehackedPickup") ) continue;
readonly<Weapon> weap = GetDefaultByType(type2);
if ( !other.player || !other.player.weapons.LocateWeapon(type2) || weap.bCheatNotWeapon ) continue;
if ( (weap.AmmoType1 == type) || (weap.AmmoType2 == type) )
{
isvalid = true;
break;
}
}
if ( !isvalid ) continue;
let ammoitem = Ammo(other.FindInventory(type));
int amount = GetDefaultByType(type).BackpackAmount;
// extra ammo in baby mode and nightmare mode
if ( !bIgnoreSkill ) amount = int(amount*G_SkillPropertyFloat(SKILLP_AmmoFactor));
if ( amount < 0 ) amount = 0;
if ( !ammoitem )
{
// The player did not have the ammoitem. Add it.
ammoitem = Ammo(Spawn(type));
ammoitem.Amount = bDepleted?0:amount;
if ( ammoitem.BackpackMaxAmount > ammoitem.MaxAmount )
ammoitem.MaxAmount = ammoitem.BackpackMaxAmount;
if ( ammoitem.Amount > ammoitem.MaxAmount )
ammoitem.Amount = ammoitem.MaxAmount;
ammoitem.AttachToOwner(other);
}
else
{
// The player had the ammoitem. Give some more.
if ( ammoitem.MaxAmount < ammoitem.BackpackMaxAmount )
ammoitem.MaxAmount = ammoitem.BackpackMaxAmount;
if ( !bDepleted && (ammoitem.Amount < ammoitem.MaxAmount) )
{
ammoitem.Amount += amount;
if ( ammoitem.Amount > ammoitem.MaxAmount )
ammoitem.Amount = ammoitem.MaxAmount;
}
}
}
return Inventory.CreateCopy(other);
}
override bool HandlePickup (Inventory item)
{
// Since you already have a backpack, that means you already have every
// kind of ammo in your inventory, so we don't need to look at the
// entire PClass list to discover what kinds of ammo exist, and we don't
// have to alter the MaxAmount either.
if ( item is 'BackpackItem' )
{
for ( let probe = Owner.Inv; probe; probe = probe.Inv )
{
if ( (probe.GetParentClass() != 'Ammo') && (probe.GetParentClass() != 'UTAmmo') ) continue;
if ( probe.Amount >= probe.MaxAmount && !sv_unlimited_pickup ) continue;
int amount = Ammo(probe).Default.BackpackAmount;
// extra ammo in baby mode and nightmare mode
if ( !bIgnoreSkill )
amount = int(amount*G_SkillPropertyFloat(SKILLP_AmmoFactor));
probe.Amount += amount;
if ( (probe.Amount > probe.MaxAmount) && !sv_unlimited_pickup )
probe.Amount = probe.MaxAmount;
}
// The pickup always succeeds, even if you didn't get anything
item.bPickupGood = true;
return true;
}
return false;
}
Default
{
Tag "Backpack";
Inventory.PickupMessage "You got a Backpack.";
Inventory.RespawnTics 2100;
}
States
{
Spawn:
BPAK A -1;
Stop;
}
}
Class PowerUTInvisibility : PowerInvisibility
{
Default
{
Powerup.Duration -50;
Powerup.Strength 95;
Powerup.Mode "Translucent";
Powerup.Color "FFFFFF", 0.15;
}
override void EndEffect()
{
Super.EndEffect();
PrintPickupMessage(true,"Invisibility has worn off.");
}
}
Class UTInvisibility : PowerupGiver replaces BlurSphere
{
Default
{
Tag "Invisibility";
+COUNTITEM;
+INVENTORY.AUTOACTIVATE;
+INVENTORY.ALWAYSPICKUP;
+INVENTORY.BIGPOWERUP;
Inventory.MaxAmount 0;
Powerup.Type "PowerUTInvisibility";
Inventory.PickupMessage "You have Invisibility.";
Inventory.PickupSound "invis/pickup";
Inventory.RespawnTics 4200;
}
override void PostBeginPlay()
{
Super.PostBeginPlay();
tracer = Spawn("UTInvisibilityX",pos);
tracer.angle = angle;
tracer.target = self;
}
States
{
Spawn:
INVS A -1 Bright;
Stop;
}
}
Class UTInvisibilityX : Actor
{
Default
{
RenderStyle "Add";
+NOGRAVITY;
+NOCLIP;
+DONTSPLASH;
}
override void Tick()
{
Super.Tick();
if ( !target )
{
Destroy();
return;
}
SetOrigin(target.pos,true);
A_SetAngle(target.angle,SPF_INTERPOLATE);
bInvisible = target.bInvisible;
}
States
{
Spawn:
INVS A -1 Bright;
Stop;
}
}
Class UTMapRevealer : MapRevealer replaces Allmap
{
Default
{
+COUNTITEM;
+INVENTORY.FANCYPICKUPSOUND;
+INVENTORY.ALWAYSPICKUP;
Inventory.MaxAmount 0;
Inventory.PickupSound "trans/pickup";
Inventory.PickupMessage "You got the Computer Map.";
}
States
{
Spawn:
TRNS A -1;
Stop;
}
}
Class ShieldingSuit : PowerupGiver replaces RadSuit
{
Default
{
Tag "Shielding Suit";
+INVENTORY.AUTOACTIVATE;
+INVENTORY.ALWAYSPICKUP;
Inventory.MaxAmount 0;
Powerup.Type "PowerShieldingSuit";
Inventory.PickupMessage "You got the Shielding Suit.";
Inventory.PickupSound "suit/pickup";
Inventory.RespawnTics 2100;
}
States
{
Spawn:
SSUT A -1;
Stop;
}
}
Class PowerShieldingSuit : PowerIronFeet
{
Default
{
Powerup.Duration -60;
Powerup.Color "C0FFEE", 0.35;
}
override void AbsorbDamage( int damage, Name damageType, out int newdamage )
{
if ( (damageType == 'Slime') || (damageType == 'Fire') || (damageType == 'Ice') || (damageType == 'Poison') )
newdamage = 0;
}
override void EndEffect()
{
PrintPickupMessage(true,"Air supply in the Shielding Suit has expired.");
}
}
Class Searchlight : Inventory replaces Infrared
{
Actor lt[3];
int ticcnt;
Default
{
Tag "Searchligh";
+COUNTITEM;
+INVENTORY.UNTOSSABLE;
+INVENTORY.FANCYPICKUPSOUND;
+INVENTORY.AUTOACTIVATE;
+INVENTORY.ALWAYSPICKUP;
Inventory.Amount 200;
Inventory.MaxAmount 200;
Inventory.InterHubAmount 0;
Inventory.PickupMessage "You picked up the Searchlight.";
}
override bool Use( bool pickup )
{
if ( !lt[0] ) lt[0] = Spawn("mkLight");
lt[0].target = owner;
lt[0].master = self;
if ( !lt[1] ) lt[1] = Spawn("mkLight2");
lt[1].target = owner;
lt[1].master = self;
if ( !lt[2] ) lt[2] = Spawn("mkLight3");
lt[2].target = owner;
lt[2].master = self;
return Super.Use(pickup);
}
override void DetachFromOwner()
{
Super.DetachFromOwner();
if ( lt[0] ) lt[0].Destroy();
if ( lt[1] ) lt[1].Destroy();
if ( lt[2] ) lt[2].Destroy();
}
override void DoEffect()
{
Super.DoEffect();
if ( !Owner ) return;
if ( ticcnt++ < TICRATE ) return;
ticcnt = 0;
if ( --Amount <= 0 )
{
PrintPickupMessage(true,"Searchlight batteries have died.");
DepleteOrDestroy();
}
}
States
{
Spawn:
SLIT A -1;
Stop;
}
}
/* hello, Soundless Mound copypasted lights */
Class mkLight : DynamicLight
{
Default
{
DynamicLight.Type "Point";
+DynamicLight.SPOT;
+DynamicLight.ATTENUATE;
+DynamicLight.DONTLIGHTSELF;
args 255,224,160,350;
DynamicLight.SpotInnerAngle 20;
DynamicLight.SpotOuterAngle 35;
}
override void Tick()
{
Super.Tick();
if ( !target || !Inventory(master) )
{
Destroy();
return;
}
if ( target.player ) SetOrigin((target.pos.x,target.pos.y,target.player.viewz),true);
else SetOrigin(target.vec3Offset(0,0,target.height*0.75),true);
A_SetAngle(target.angle,SPF_INTERPOLATE);
A_SetPitch(target.pitch,SPF_INTERPOLATE);
args[LIGHT_RED] = GetDefaultByType(GetClass()).args[LIGHT_RED]*clamp(Inventory(master).amount/40.,0.,1.);
args[LIGHT_GREEN] = GetDefaultByType(GetClass()).args[LIGHT_GREEN]*clamp(Inventory(master).amount/40.,0.,1.);
args[LIGHT_BLUE] = GetDefaultByType(GetClass()).args[LIGHT_BLUE]*clamp(Inventory(master).amount/40.,0.,1.);
bDORMANT = (target.health <= 0);
if ( Inventory(target) && target.bInvisible ) bDORMANT = true;
// alert monsters hit by the light
if ( GetClass() != "mkLight" ) return;
if ( !bDORMANT && target.player && (target.health > 0) )
{
BlockThingsIterator bt = BlockThingsIterator.Create(target,args[LIGHT_INTENSITY]);
while ( bt.Next() )
{
if ( !bt.Thing || (Distance3D(bt.Thing) > args[LIGHT_INTENSITY]) ) continue;
Vector3 aimdir = (cos(angle)*cos(pitch),sin(angle)*cos(pitch),-sin(pitch));
Vector3 reldir = Vec3To(bt.Thing).unit();
if ( (acos(aimdir dot reldir) < SpotOuterAngle+5) && bt.Thing.CheckSight(target) ) bt.Thing.LastHeard = target;
}
}
}
}
Class mkLight2 : mkLight
{
Default
{
args 128,112,96,450;
DynamicLight.SpotInnerAngle 0;
DynamicLight.SpotOuterAngle 50;
}
}
Class mkLight3 : DynamicLight
{
Default
{
DynamicLight.Type "Point";
+DynamicLight.ATTENUATE;
args 32,28,24,0;
}
override void Tick()
{
Super.Tick();
if ( !target || Inventory(target) || !Inventory(master) )
{
Destroy();
return;
}
args[LIGHT_RED] = GetDefaultByType(GetClass()).args[LIGHT_RED]*clamp(Inventory(master).amount/40,0.,1.);
args[LIGHT_GREEN] = GetDefaultByType(GetClass()).args[LIGHT_GREEN]*clamp(Inventory(master).amount/40,0.,1.);
args[LIGHT_BLUE] = GetDefaultByType(GetClass()).args[LIGHT_BLUE]*clamp(Inventory(master).amount/40,0.,1.);
SetOrigin(target.vec3Offset(0,0,target.height*0.5),true);
}
}

View file

@ -3,7 +3,7 @@ Class Tier4Ammo : RandomSpawner replaces ClipBox
Default
{
DropItem "PulseAmmo", 255, 1;
//DropItem "RipperAmmo", 255, 1;
DropItem "RipperAmmo", 255, 1;
}
}
@ -12,11 +12,11 @@ Class Tier4Weapon : RandomSpawner replaces Chaingun
Default
{
DropItem "PulseGun", 255, 1;
//DropItem "Ripper", 255, 1;
DropItem "Ripper2", 255, 1;
}
}
Class PulseAmmo : Ammo
Class PulseAmmo : UTAmmo
{
Default
{
@ -27,6 +27,7 @@ Class PulseAmmo : Ammo
Ammo.BackpackAmount 50;
Ammo.BackpackMaxAmount 400;
Ammo.DropAmount 25;
UTAmmo.UsedInSlot AMMO_SLOT5;
}
States
{
@ -486,7 +487,7 @@ Class PulseGun : UTWeapon
Release:
PGNC A 0 A_PlaySound("pulse/down",CHAN_WEAPON);
PGNC ABCDEFGHIJKLMNOPQRSTUVWXY 1;
PGNI A 1;
PGNC Y 0;
Goto Idle;
AltFire:
PGBS ABCDE 1;
@ -526,7 +527,8 @@ Class PulseGun : UTWeapon
PGBE ABCDE 1;
Goto Idle;
Reload:
PGNI A 1 A_JumpIf(invoker.clipcount >= 50,"Idle");
PGNI A 1;
PGNI A 0 A_JumpIf(invoker.clipcount >= 50,"Idle");
PGNR A 1 A_Reloading();
PGNR BCDEFGHIJKLMNOPQRSTUVWXYZ 1;
PGR2 ABCDEFGHIJKLMNOPQRSTUVWX 1;

36
zscript/ripper.zsc Normal file
View file

@ -0,0 +1,36 @@
Class RipperAmmo : UTAmmo
{
Default
{
Tag "Razor Blades";
Inventory.PickupMessage "You picked up Razor Blades.";
Inventory.Amount 25;
Inventory.MaxAmount 75;
Ammo.BackpackAmount 50;
Ammo.BackpackMaxAmount 150;
Ammo.DropAmount 25;
UTAmmo.UsedInSlot AMMO_SLOT6;
}
States
{
Spawn:
BHOP A -1;
Stop;
}
}
Class Ripper2 : UTWeapon
{
Default
{
Tag "Ripper";
Inventory.PickupMessage "You got the Ripper.";
Weapon.UpSound "";
Weapon.SlotNumber 6;
Weapon.AmmoType "RipperAmmo";
Weapon.AmmoUse 1;
Weapon.AmmoType2 "RipperAmmo";
Weapon.AmmoUse2 1;
Weapon.AmmoGive 15;
}
}

View file

@ -1,14 +1,15 @@
Class ShockAmmo : Ammo
Class ShockAmmo : UTAmmo
{
Default
{
Tag "ShockCore";
Tag "Shock Core";
Inventory.PickupMessage "You picked up a Shock Core.";
Inventory.Amount 10;
Inventory.MaxAmount 50;
Ammo.BackpackAmount 50;
Ammo.BackpackAmount 20;
Ammo.BackpackMaxAmount 100;
Ammo.DropAmount 10;
UTAmmo.UsedInSlot AMMO_SLOT4;
}
States
{
@ -20,13 +21,13 @@ Class ShockAmmo : Ammo
Class ShockBeamTracer : LineTracer
{
Actor owner, ignore;
Actor owner, ignore, lasthit;
override ETraceStatus TraceCallback()
{
if ( Results.HitType == TRACE_HitActor )
{
if ( (Results.HitActor == owner) || (Results.HitActor == ignore) ) return TRACE_Skip;
if ( (Results.HitActor == owner) || (Results.HitActor == ignore) || (Results.HitActor == lasthit) ) return TRACE_Skip;
if ( Results.HitActor.bSHOOTABLE || Results.HitActor is 'ShockHitbox' ) return TRACE_Stop;
return TRACE_Skip;
}
@ -67,6 +68,33 @@ Class ShockRifleWave : Actor
}
}
Class SuperShockRifleWave : Actor
{
Default
{
RenderStyle "Add";
Radius 0.1;
Height 0;
Scale 1.2;
+NOBLOCKMAP;
+NOGRAVITY;
+DONTSPLASH;
}
override void Tick()
{
Super.Tick();
if ( globalfreeze || level.frozen ) return;
alpha -= 1/50.;
}
States
{
Spawn:
SWAV A 50 Bright;
SWAV B 0 Bright;
Stop;
}
}
Class ShockBeamRing : Actor
{
Default
@ -94,6 +122,33 @@ Class ShockBeamRing : Actor
}
}
Class SuperShockBeamRing : Actor
{
Default
{
RenderStyle "Add";
Radius 0.1;
Height 0;
Scale 0.9;
ReactionTime 18;
+NOBLOCKMAP;
+NOGRAVITY;
+DONTSPLASH;
}
override void Tick()
{
Super.Tick();
if ( globalfreeze || level.frozen ) return;
alpha -= 1./ReactionTime;
}
States
{
Spawn:
SRNG ABCDEFGHI 2 Bright;
Stop;
}
}
Class ShockBlastRing : ShockBeamRing
{
Default
@ -109,6 +164,21 @@ Class ShockBlastRing : ShockBeamRing
}
}
Class SuperShockBlastRing : ShockBeamRing
{
Default
{
Scale 5.0;
ReactionTime 45;
}
States
{
Spawn:
SRNG ABCDEFGHI 5 Bright;
Stop;
}
}
Class ShockBeam : Actor
{
ShockBeamTracer t;
@ -267,6 +337,168 @@ Class ShockBeam : Actor
}
}
Class SuperShockBeam : Actor
{
ShockBeamTracer t;
Vector3 tracedir;
bool moving;
double totaldist;
Default
{
Obituary "%k electrified %o with the Enhanced Shock Rifle.";
DamageType 'jolted';
RenderStyle "Add";
Radius 0.1;
Height 0;
Scale 0.7;
+NOGRAVITY;
+NOCLIP;
+DONTSPLASH;
+FORCEXYBILLBOARD;
+EXTREMEDEATH;
}
override void PostBeginPlay()
{
Super.PostBeginPlay();
t = new("ShockBeamTracer");
t.owner = target;
t.ignore = self;
moving = true;
}
override void Tick()
{
Super.Tick();
if ( globalfreeze || level.frozen ) return;
if ( !moving ) return;
// step trace
tracedir = (cos(angle)*cos(pitch),sin(angle)*cos(pitch),-sin(pitch));
t.Trace(pos,cursector,tracedir,2000,0);
totaldist += t.Results.Distance;
// spawn particles
for ( int i=0; i<t.Results.Distance; i+=80 )
Spawn("SuperShockBeamLight",Vec3Offset(tracedir.x*i,tracedir.y*i,tracedir.z*i));
for ( int i=0; i<t.Results.Distance; i++ )
{
Vector3 pofs = Level.Vec3Diff(pos,pos+tracedir*FRandom[ASMD](0,1)+(FRandom[ASMD](-.5,.5),FRandom[ASMD](-.5,.5),FRandom[ASMD](-.5,.5)));
A_SpawnParticle("FFFFFF",SPF_FULLBRIGHT,30,2,0,tracedir.x*i+pofs.x,tracedir.y*i+pofs.y,tracedir.z*i+pofs.z,FRandom[ASMD](-.03,.03),FRandom[ASMD](-.03,.03),FRandom[ASMD](-.03,.03),startalphaf:1,sizestep:-.1);
A_SpawnParticle("FF5020",SPF_FULLBRIGHT,45,4,0,tracedir.x*i+pofs.x,tracedir.y*i+pofs.y,tracedir.z*i+pofs.z,FRandom[ASMD](-.03,.03),FRandom[ASMD](-.03,.03),FRandom[ASMD](-.03,.03),startalphaf:.5,sizestep:-.1);
A_SpawnParticle("804020",SPF_FULLBRIGHT,60,8,0,tracedir.x*i+pofs.x,tracedir.y*i+pofs.y,tracedir.z*i+pofs.z,FRandom[ASMD](-.03,.03),FRandom[ASMD](-.03,.03),FRandom[ASMD](-.03,.03),startalphaf:.25,sizestep:-.1);
}
if ( totaldist >= 10000.0 )
{
// reposition and explode on air
SetOrigin(t.Results.HitPos-t.Results.HitVector*4,true);
ExplodeMissile(t.Results.HitLine,null);
moving = false;
let r = Spawn("SuperShockBeamRing",pos);
r.angle = atan2(t.Results.HitVector.y,t.Results.HitVector.x);
r.pitch = asin(-t.Results.HitVector.z);
}
else if ( t.Results.HitType == TRACE_HitNone )
{
// reposition
SetOrigin(t.Results.HitPos+t.Results.HitVector,true);
angle = atan2(t.Results.HitVector.y,t.Results.HitVector.x);
pitch = asin(-t.Results.HitVector.z);
}
else if ( t.Results.HitType == TRACE_HitActor )
{
// reposition and explode on actor
SetOrigin(t.Results.HitPos-t.Results.HitVector*4,true);
ExplodeMissile(null,t.Results.HitActor);
if ( t.Results.HitActor is 'ShockHitbox' )
{
if ( target ) target.TakeInventory('EnhancedShockAmmo',2);
let b = t.Results.HitActor.target;
b.ExplodeMissile(null,self);
b.A_Explode(Random[ASMD](15000,16000),400);
b.A_QuakeEx(9,9,9,60,0,2400,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:0.4);
b.A_SprayDecal("BigShockMark1",100);
b.A_SprayDecal("SBigShockMark2",100);
Spawn("SuperShockRifleWave",b.pos);
Spawn("SuperShockBlastLight",b.pos);
let r = Spawn("SuperShockBlastRing",b.pos);
r.angle = atan2(t.Results.HitVector.y,t.Results.HitVector.x);
r.pitch = asin(-t.Results.HitVector.z);
A_PlaySound("shock/blast",CHAN_WEAPON,attenuation:0.5);
A_PlaySound("sshock/blast",CHAN_6,attenuation:0.5);
int numpt = Random[ASMD](400,600);
for ( int i=0; i<numpt; i++ )
{
Vector3 pvel = (FRandom[ASMD](-1,1),FRandom[ASMD](-1,1),FRandom[ASMD](-1,1)).unit()*FRandom[ASMD](2,8);
A_SpawnParticle("FFFFFF",SPF_FULLBRIGHT,Random[ASMD](20,80),FRandom[ASMD](1.6,9.6),0,0,0,0,pvel.x,pvel.y,pvel.z,0,0,0,1,-1,-.05);
pvel = (FRandom[ASMD](-1,1),FRandom[ASMD](-1,1),FRandom[ASMD](-1,1)).unit()*FRandom[ASMD](3,12);
A_SpawnParticle("FF5020",SPF_FULLBRIGHT,Random[ASMD](40,120),FRandom[ASMD](4.8,22.4),0,0,0,0,pvel.x,pvel.y,pvel.z,0,0,0,.5,-1,-.05);
pvel = (FRandom[ASMD](-1,1),FRandom[ASMD](-1,1),FRandom[ASMD](-1,1)).unit()*FRandom[ASMD](3,12);
A_SpawnParticle("804020",SPF_FULLBRIGHT,Random[ASMD](50,140),FRandom[ASMD](5.6,25.6),0,0,0,0,pvel.x,pvel.y,pvel.z,0,0,0,.25,-1,-.05);
}
}
else
{
t.Results.HitActor.DamageMobj(self,target,Random[ASMD](3500,5000),'jolted');
let r = Spawn("SuperShockBeamRing",pos);
r.angle = atan2(t.Results.HitVector.y,t.Results.HitVector.x);
r.pitch = asin(-t.Results.HitVector.z);
}
t.lasthit = t.Results.HitActor;
}
else
{
// reposition and explode on wall
SetOrigin(t.Results.HitPos-t.Results.HitVector*4,true);
A_SprayDecal("ShockMark",16);
ExplodeMissile(t.Results.HitLine,null);
moving = false;
Vector3 HitNormal = t.Results.HitVector;
if ( t.Results.HitType == TRACE_HitWall )
{
t.Results.HitLine.RemoteActivate(target,t.Results.Side,SPAC_Impact,pos);
// calculate normal
HitNormal = (-t.Results.HitLine.delta.y,t.Results.HitLine.delta.x,0).unit();
if ( t.Results.Side == 1 ) HitNormal *= -1;
}
else if ( t.Results.HitType == TRACE_HitFloor )
HitNormal = t.Results.HitSector.floorplane.Normal;
else if ( t.Results.HitType == TRACE_HitCeiling )
HitNormal = t.Results.HitSector.ceilingplane.Normal;
let r = Spawn("SuperShockBeamRing",pos);
r.angle = atan2(HitNormal.y,HitNormal.x);
r.pitch = asin(-HitNormal.z);
}
}
action void A_BeamExplode()
{
Spawn("SuperShockBeamLight",pos);
A_Explode(Random[ASMD](500,800),120);
A_QuakeEx(6,6,6,5,0,200,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:0.2);
A_PlaySound("shock/hit",CHAN_VOICE,attenuation:0.5);
A_PlaySound("sshock/blast",CHAN_6,attenuation:0.5);
A_AlertMonsters();
int numpt = Random[ASMD](40,100);
for ( int i=0; i<numpt; i++ )
{
Vector3 pvel = (FRandom[ASMD](-1,1),FRandom[ASMD](-1,1),FRandom[ASMD](-1,1)).unit()*FRandom[ASMD](3,12);
A_SpawnParticle("FFFFFF",SPF_FULLBRIGHT,Random[ASMD](20,40),FRandom[ASMD](1.6,4.8),0,0,0,0,pvel.x,pvel.y,pvel.z,0,0,0,1,-1,-.1);
pvel = (FRandom[ASMD](-1,1),FRandom[ASMD](-1,1),FRandom[ASMD](-1,1)).unit()*FRandom[ASMD](3,12);
A_SpawnParticle("FF5020",SPF_FULLBRIGHT,Random[ASMD](40,60),FRandom[ASMD](4.8,11.2),0,0,0,0,pvel.x,pvel.y,pvel.z,0,0,0,.5,-1,-.1);
pvel = (FRandom[ASMD](-1,1),FRandom[ASMD](-1,1),FRandom[ASMD](-1,1)).unit()*FRandom[ASMD](3,12);
A_SpawnParticle("804020",SPF_FULLBRIGHT,Random[ASMD](50,70),FRandom[ASMD](5.6,12.8),0,0,0,0,pvel.x,pvel.y,pvel.z,0,0,0,.25,-1,-.1);
}
}
States
{
Spawn:
TNT1 A 1;
Wait;
Death:
TNT1 A 0 A_BeamExplode();
SEXP ABCDEFGHIJKL 1 Bright;
TNT1 A 100;
Stop;
}
}
Class ShockBallLight : DynamicLight
{
Default
@ -291,6 +523,15 @@ Class ShockBallLight : DynamicLight
}
}
Class SuperShockBallLight : ShockBallLight
{
Default
{
DynamicLight.Type "Point";
Args 255,160,128,120;
}
}
Class ShockBeamLight : ShockExplLight
{
Default
@ -301,6 +542,16 @@ Class ShockBeamLight : ShockExplLight
}
}
Class SuperShockBeamLight : SuperShockExplLight
{
Default
{
+DYNAMICLIGHT.ATTENUATE;
ReactionTime 15;
Args 0,0,0,100;
}
}
Class ShockBeamHitLight : ShockExplLight
{
Default
@ -310,6 +561,15 @@ Class ShockBeamHitLight : ShockExplLight
}
}
Class SuperShockBeamHitLight : SuperShockExplLight
{
Default
{
ReactionTime 24;
Args 0,0,0,150;
}
}
Class ShockBlastLight : ShockExplLight
{
Default
@ -319,6 +579,15 @@ Class ShockBlastLight : ShockExplLight
}
}
Class SuperShockBlastLight : SuperShockExplLight
{
Default
{
ReactionTime 50;
Args 0,0,0,400;
}
}
Class ShockExplLight : DynamicLight
{
double lifetime;
@ -345,12 +614,38 @@ Class ShockExplLight : DynamicLight
}
}
Class SuperShockExplLight : DynamicLight
{
double lifetime;
Default
{
DynamicLight.Type "Point";
ReactionTime 30;
Args 255,160,128,200;
}
override void PostBeginPlay()
{
Super.PostBeginPlay();
lifetime = 1.0;
}
override void Tick()
{
Super.Tick();
if ( globalfreeze || level.frozen ) return;
args[LIGHT_RED] = 255*lifetime;
args[LIGHT_GREEN] = 160*lifetime;
args[LIGHT_BLUE] = 128*lifetime;
lifetime -= 1./ReactionTime;
if ( lifetime <= 0 ) Destroy();
}
}
Class ShockHitbox : Actor
{
Default
{
Radius 16;
Height 16;
Radius 24;
Height 24;
+NOGRAVITY;
+NOCLIP;
+DONTSPLASH;
@ -431,6 +726,72 @@ Class ShockBall : Actor
}
}
Class SuperShockBall : Actor
{
Actor l, b;
override void PostBeginPlay()
{
Super.PostBeginPlay();
l = Spawn("SuperShockBallLight",pos);
l.target = self;
b = Spawn("ShockHitbox",pos);
b.target = self;
}
action void A_BallExplode()
{
A_Explode(Random[ASMD](5000,6000),120);
A_SprayDecal("ShockMarkBig",16);
Spawn("SuperShockExplLight",pos);
A_SetScale(1.5);
let r = Spawn("SuperShockBeamRing",pos);
r.angle = angle;
r.pitch = pitch;
r.scale *= 1.5;
A_PlaySound("shock/hit",CHAN_VOICE,attenuation:0.5);
A_PlaySound("shock/ball",CHAN_WEAPON,attenuation:0.5);
A_PlaySound("sshock/blast",CHAN_6,attenuation:0.5);
A_QuakeEx(8,8,8,30,0,300,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:0.25);
A_AlertMonsters();
int numpt = Random[ASMD](100,200);
for ( int i=0; i<numpt; i++ )
{
Vector3 pvel = (FRandom[ASMD](-1,1),FRandom[ASMD](-1,1),FRandom[ASMD](-1,1)).unit()*FRandom[ASMD](3,12);
A_SpawnParticle("FFFFFF",SPF_FULLBRIGHT,Random[ASMD](20,40),FRandom[ASMD](1.6,4.8),0,0,0,0,pvel.x,pvel.y,pvel.z,0,0,0,1,-1,-.1);
pvel = (FRandom[ASMD](-1,1),FRandom[ASMD](-1,1),FRandom[ASMD](-1,1)).unit()*FRandom[ASMD](3,12);
A_SpawnParticle("FF5020",SPF_FULLBRIGHT,Random[ASMD](40,60),FRandom[ASMD](4.8,11.2),0,0,0,0,pvel.x,pvel.y,pvel.z,0,0,0,.5,-1,-.1);
pvel = (FRandom[ASMD](-1,1),FRandom[ASMD](-1,1),FRandom[ASMD](-1,1)).unit()*FRandom[ASMD](3,12);
A_SpawnParticle("804020",SPF_FULLBRIGHT,Random[ASMD](50,70),FRandom[ASMD](5.6,12.8),0,0,0,0,pvel.x,pvel.y,pvel.z,0,0,0,.25,-1,-.1);
}
}
Default
{
Obituary "%k electrified %o with the Enhanced Shock Rifle.";
RenderStyle "Add";
DamageType 'jolted';
Radius 4;
Height 4;
Scale 0.5;
Speed 25;
PROJECTILE;
+FORCEXYBILLBOARD;
+SKYEXPLODE;
+FORCERADIUSDMG;
+EXTREMEDEATH;
}
States
{
Spawn:
SBAL ABCD 2 Bright;
Loop;
Death:
TNT1 A 0 A_BallExplode();
SEXP ABCDEFGHIJKL 2 Bright;
TNT1 A 300;
Stop;
}
}
Class ShockRifle : UTWeapon
{
action void A_ShockFire()
@ -516,3 +877,110 @@ Class ShockRifle : UTWeapon
Wait;
}
}
Class EnhancedShockAmmo : UTAmmo
{
Default
{
Tag "Enhanced Shock Core";
Inventory.PickupMessage "You picked up an Enhanced Shock Core.";
Inventory.Amount 5;
Inventory.MaxAmount 25;
Ammo.BackpackAmount 0;
Ammo.BackpackMaxAmount 25;
Ammo.DropAmount 5;
UTAmmo.UsedInSlot AMMO_SLOT4;
}
States
{
Spawn:
SHOA A -1;
Stop;
}
}
Class EnhancedShockRifle : UTWeapon replaces InvulnerabilitySphere
{
action void A_SShockFire()
{
Weapon weap = Weapon(invoker);
if ( !weap ) return;
if ( weap.Ammo1.Amount <= 0 ) return;
if ( !weap.DepleteAmmo(weap.bAltFire,true,1) ) return;
A_PlaySound("shock/fire",CHAN_WEAPON);
invoker.FireEffect();
A_AlertMonsters();
A_QuakeEx(8,8,8,12,0,96,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:0.25);
Vector3 x, y, z;
[x, y, z] = Matrix4.GetAxes(pitch,angle,roll);
Vector3 origin = (pos.x,pos.y,player.viewz)+10.0*x+3.0*y-4.0*z;
Actor p = Spawn("SuperShockBeam",origin);
p.angle = angle;
p.pitch = BulletSlope();
p.target = self;
}
action void A_SShockAlt()
{
Weapon weap = Weapon(invoker);
if ( !weap ) return;
if ( weap.Ammo1.Amount <= 0 ) return;
if ( !weap.DepleteAmmo(weap.bAltFire,true,1) ) return;
A_PlaySound("shock/altfire",CHAN_WEAPON);
invoker.FireEffect();
A_AlertMonsters();
A_QuakeEx(8,8,8,16,0,96,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:0.25);
Vector3 x, y, z;
[x, y, z] = Matrix4.GetAxes(pitch,angle,roll);
Vector3 origin = (pos.x,pos.y,player.viewz)+10.0*x+3.0*y-4.0*z;
Actor p = Spawn("SuperShockBall",origin);
p.angle = angle;
p.pitch = BulletSlope();
p.vel = (cos(p.angle)*cos(p.pitch),sin(p.angle)*cos(p.pitch),-sin(p.pitch))*p.speed;
p.target = self;
}
Default
{
Tag "Enhanced Shock Rifle";
Inventory.PickupMessage "You got an Enhanced Shock Rifle!";
Weapon.UpSound "shock/select";
Weapon.SlotNumber 4;
+INVENTORY.ALWAYSPICKUP;
Weapon.AmmoType "EnhancedShockAmmo";
Weapon.AmmoUse 1;
Weapon.AmmoType2 "EnhancedShockAmmo";
Weapon.AmmoUse2 1;
Weapon.AmmoGive 25;
}
States
{
Spawn:
ASMP A -1;
Stop;
ASMP B -1;
Stop;
Ready:
ASMS ABCDEFGHIJKLMNO 1;
Idle:
ASMI A 1
{
A_CheckReload();
A_WeaponReady();
}
Wait;
Fire:
ASMF A 1 A_SShockFire();
ASMF BCDEFGHIJ 2;
Goto Idle;
AltFire:
ASMA A 1 A_SShockAlt();
ASMA BCDEFGHIJ 2;
Goto Idle;
Deselect:
ASMD ABCDEFG 1;
ASMD G 1 A_Lower(int.max);
Wait;
Select:
ASMS A 1 A_Raise(int.max);
Wait;
}
}

53
zscript/sniperrifle.zsc Normal file
View file

@ -0,0 +1,53 @@
Class RifleAmmo : UTAmmo
{
Default
{
Tag "Box of Rifle Rounds";
Inventory.PickupMessage "You picked up a Box of Rifle Rounds.";
Inventory.Amount 10;
Inventory.MaxAmount 50;
Ammo.BackpackAmount 20;
Ammo.BackpackMaxAmount 100;
Ammo.DropAmount 10;
UTAmmo.UsedInSlot AMMO_SLOT10;
}
States
{
Spawn:
SBOX A -1;
Stop;
}
}
Class RifleAmmo2 : RifleAmmo
{
Default
{
Tag "Rifle Round";
Inventory.PickupMessage "You got a Rifle Round.";
Inventory.Amount 1;
Ammo.DropAmount 1;
}
States
{
Spawn:
SRND A -1;
Stop;
}
}
Class SniperRifle : UTWeapon
{
Default
{
Tag "Sniper Rifle";
Inventory.PickupMessage "You got the Sniper Rifle.";
Weapon.UpSound "";
Weapon.SlotNumber 0;
Weapon.AmmoType "RifleAmmo";
Weapon.AmmoUse 1;
Weapon.AmmoType2 "RifleAmmo";
Weapon.AmmoUse2 1;
Weapon.AmmoGive 8;
}
}

10
zscript/translocator.zsc Normal file
View file

@ -0,0 +1,10 @@
Class Translocator : UTWeapon
{
Default
{
Tag "Translocator";
Inventory.PickupMessage "You got the Translocator Source Module.";
Weapon.SlotNumber 1;
+INVENTORY.UNTOSSABLE;
}
}

View file

@ -1,3 +1,189 @@
Class UTPlayer : DoomPlayer
{
Default
{
Player.StartItem "ImpactHammer";
Player.StartItem "Translocator";
Player.StartItem "Enforcer";
}
// Have to modify the give cheat to recognize UT ammo and handle UT armor
override void CheatGive( String name, int amount )
{
if ( PlayerNumber() != consoleplayer )
A_Log(String.Format("%s is a cheater: give %s\n",player.GetUserName(),name));
if ( !player.mo || (player.health <= 0) ) return;
int giveall = ALL_NO;
if ( name ~== "all" ) giveall = ALL_YES;
else if (name ~== "everything") giveall = ALL_YESYES;
if ( name ~== "health" )
{
if ( amount > 0 )
{
health += amount;
player.health = health;
}
else player.health = health = GetMaxHealth(true);
}
if ( giveall || (name ~== "backpack") )
{
// Select the correct type of backpack based on the game
let type = (class<Inventory>)(gameinfo.backpacktype);
if ( type ) GiveInventory(type,1,true);
if ( !giveall ) return;
}
if ( giveall || (name ~== "ammo") )
{
// Find every unique type of ammo. Give it to the player if
// he doesn't have it already, and set each to its maximum.
for ( int i=0; i<AllActorClasses.Size(); i++ )
{
let type = (class<Ammo>)(AllActorClasses[i]);
if ( !type || ((type.GetParentClass() != "Ammo") && (type.GetParentClass() != "UTAmmo")) )
continue;
// Only give if it's for a valid weapon, unless using "give everything"
bool isvalid = false;
for ( int j=0; j<AllActorClasses.Size(); j++ )
{
let type2 = (class<Weapon>)(AllActorClasses[j]);
if ( !type2 ) continue;
let rep = GetReplacement(type2);
if ( (rep != type2) && !(rep is "DehackedPickup") ) continue;
readonly<Weapon> weap = GetDefaultByType(type2);
if ( !player.weapons.LocateWeapon(type2) || (weap.bCheatNotWeapon && (giveall != ALL_YESYES)) ) continue;
if ( (weap.AmmoType1 == type) || (weap.AmmoType2 == type) )
{
isvalid = true;
break;
}
}
if ( !isvalid ) continue;
let ammoitem = FindInventory(type);
if ( !ammoitem )
{
ammoitem = Inventory(Spawn(type));
ammoitem.AttachToOwner(self);
ammoitem.Amount = ammoitem.MaxAmount;
}
else if ( ammoitem.Amount < ammoitem.MaxAmount )
ammoitem.Amount = ammoitem.MaxAmount;
}
if ( !giveall ) return;
}
if ( giveall || (name ~== "armor") )
{
// Doom Tournament just gives the player a shield belt and maximum bonuses
let belt = Inventory(Spawn("UTShieldBelt"));
if ( !belt.CallTryPickup(self) ) belt.Destroy();
let bonus = Inventory(Spawn("UTArmorBonus"));
bonus.Amount = bonus.MaxAmount;
if ( !bonus.CallTryPickup(self) ) bonus.Destroy();
level.total_items -= 2; // spawning them in raises item count
if ( !giveall ) return;
}
if ( giveall || (name ~== "keys") )
{
for ( int i=0; i<AllActorClasses.Size(); i++ )
{
if ( !(AllActorClasses[i] is "Key") ) continue;
let keyitem = GetDefaultByType(AllActorClasses[i]);
if ( keyitem.special1 )
{
let item = Inventory(Spawn(AllActorClasses[i]));
if ( !item.CallTryPickup(self) ) item.Destroy();
}
}
if ( !giveall ) return;
}
if ( giveall || (name ~== "weapons") )
{
let savedpending = player.PendingWeapon;
for ( int i=0; i<AllActorClasses.Size(); i++ )
{
let type = (class<Weapon>)(AllActorClasses[i]);
if ( !type || (type == "Weapon") ) continue;
// Don't give replaced weapons unless the replacement was done by Dehacked.
let rep = GetReplacement(type);
if ( (rep == type) || (rep is "DehackedPickup") )
{
// Give the weapon only if it is set in a weapon slot.
if ( !player.weapons.LocateWeapon(type) ) continue;
readonly<Weapon> def = GetDefaultByType(type);
if ( (giveall == ALL_YESYES) || !def.bCheatNotWeapon )
GiveInventory(type,1,true);
}
}
player.PendingWeapon = savedpending;
if ( !giveall ) return;
}
if ( giveall || (name ~== "artifacts") )
{
for ( int i=0; i<AllActorClasses.Size(); i++ )
{
let type = (class<Inventory>)(AllActorClasses[i]);
if ( !type ) continue;
let def = GetDefaultByType (type);
if ( def.Icon.isValid() && (def.MaxAmount > 1) &&
!(type is "PuzzleItem") && !(type is "Powerup") && !(type is "Ammo") && !(type is "Armor"))
{
// Do not give replaced items unless using "give everything"
if ( (giveall == ALL_YESYES) || (GetReplacement(type) == type) )
GiveInventory(type,(amount<=0)?def.MaxAmount:amount,true);
}
}
if ( !giveall ) return;
}
if ( giveall || (name ~== "puzzlepieces") )
{
for ( int i=0; i<AllActorClasses.Size(); i++ )
{
let type = (class<PuzzleItem>)(AllActorClasses[i]);
if ( !type ) continue;
let def = GetDefaultByType(type);
if ( !def.Icon.isValid() ) continue;
// Do not give replaced items unless using "give everything"
if ( (giveall == ALL_YESYES) || (GetReplacement(type) == type) )
GiveInventory(type,(amount<=0)?def.MaxAmount:amount,true);
}
if ( !giveall ) return;
}
if ( giveall ) return;
let type = name;
if ( !type )
{
if ( PlayerNumber() == consoleplayer )
A_Log(String.Format("Unknown item \"%s\"\n",name));
}
else GiveInventory(type,amount,true);
}
}
enum EAmmoSlot
{
AMMO_SLOT10 = 1,
AMMO_SLOT1 = 2,
AMMO_SLOT2 = 4,
AMMO_SLOT3 = 8,
AMMO_SLOT4 = 16,
AMMO_SLOT5 = 32,
AMMO_SLOT6 = 64,
AMMO_SLOT7 = 128,
AMMO_SLOT8 = 256,
AMMO_SLOT9 = 512,
};
Class UTAmmo : Ammo
{
int usedinslot; // bitfield indicating which weapon slots use this ammo
Property UsedInSlot : usedinslot;
Default
{
UTAmmo.UsedInSlot 0;
}
}
Class UTWeapon : Weapon
{
override Inventory CreateTossable( int amt )
@ -61,6 +247,29 @@ Class UTTeleportLight : DynamicLight
}
}
Class UTItemLight : DynamicLight
{
Default
{
DynamicLight.Type "Point";
Args 255,224,160,48;
}
override void Tick()
{
Super.Tick();
if ( alpha <= 0 )
{
Destroy();
return;
}
args[LIGHT_RED] = 255*alpha;
args[LIGHT_GREEN] = 224*alpha;
args[LIGHT_BLUE] = 160*alpha;
args[LIGHT_INTENSITY] = Random[Tele](6,8)*8;
alpha -= 3./35;
}
}
Class UTTeleportFog : Actor replaces TeleportFog
{
Default
@ -85,6 +294,28 @@ Class UTTeleportFog : Actor replaces TeleportFog
}
}
Class UTItemFog : Actor replaces ItemFog
{
Default
{
+NOBLOCKMAP;
+NOTELEPORT;
+NOGRAVITY;
RenderStyle "Add";
}
override void PostBeginPlay()
{
Super.PostBeginPlay();
Spawn("UTItemLight",pos+(0,0,16));
}
States
{
Spawn:
TNT1 A 1;
Stop;
}
}
Class UTRedSkull : RedSkull replaces RedSkull
{
Default
@ -174,6 +405,17 @@ Class UTMenuHandler : StaticEventHandler
{
ui TextureID tex;
override void WorldLoaded( WorldEvent e )
{
if ( gamestate != GS_LEVEL || e.IsSaveGame ) return;
if ( level.levelname ~== "Modder Test Map" )
{
TexMan.ReplaceTextures("-noflat-","-kinsie-",0);
TextureID skytx = TexMan.CheckForTexture("BlueSky",TexMan.Type_Any);
level.ChangeSky(skytx,skytx);
}
}
ui void StartMenu()
{
if ( gamestate != GS_TITLELEVEL ) return;

23
zscript/uthud.zsc Normal file
View file

@ -0,0 +1,23 @@
// An almost 1:1 recreation of the UT HUD, uses player color for tinting
Class UTHud : BaseStatusBar
{
override void Init()
{
Super.Init();
SetSize(0,1280,960);
}
override void Draw( int state, double TicFrac )
{
Super.Draw(state,TicFrac);
if ( (state == HUD_StatusBar) || (state == HUD_Fullscreen) )
{
BeginHUD();
DrawUTHUD(TicFrac);
}
}
private void DrawUTHUD( double TicFrac )
{
}
}

View file

@ -1,5 +1,5 @@
// shouldn't be placed in the world (it wasn't in UT99)
Class WarheadAmmo : Ammo
Class WarheadAmmo : UTAmmo
{
Default
{
@ -10,6 +10,8 @@ Class WarheadAmmo : Ammo
Ammo.BackpackAmount 0;
Ammo.BackpackMaxAmount 2;
Ammo.DropAmount 1;
Inventory.RespawnTics 2100;
UTAmmo.UsedInSlot AMMO_SLOT10;
}
States
{
@ -379,6 +381,12 @@ Class MidTracer : LineTracer
}
}
Class TargetActor
{
Vector2 vpos;
String diststr;
}
Class RedeemerHUD : HUDMessageBase
{
Actor Camera;
@ -388,6 +396,7 @@ Class RedeemerHUD : HUDMessageBase
Font whfont;
ThinkerIterator t;
MidTracer tr;
Array<TargetActor> ta;
RedeemerHUD Init()
{
@ -401,16 +410,11 @@ Class RedeemerHUD : HUDMessageBase
}
override bool Tick()
{
return !Camera;
}
override void Draw( int bottom, int visibility )
{
if ( visibility != StatusBar.HUDMSGLayer_UnderHUD ) return;
Screen.Dim("Red",0.5,0,0,Screen.GetWidth(),Screen.GetHeight());
// shootable targetting
if ( CVar.GetCVar('flak_redeemerreadout',players[consoleplayer]).GetBool() )
{
t.Reinit();
ta.Clear();
Actor a;
Vector3 vdir = (cos(ViewAngle)*cos(ViewPitch),sin(ViewAngle)*cos(ViewPitch),-sin(ViewPitch));
while ( a = Actor(t.Next()) )
@ -420,11 +424,26 @@ Class RedeemerHUD : HUDMessageBase
Vector3 wpos = ViewPos+tdir;
Vector3 spos = mkCoordUtil.WorldToScreen(wpos,ViewPos,ViewPitch,ViewAngle,ViewRoll,players[consoleplayer].FOV);
if ( spos.z > 1.0 ) continue;
Vector2 vpos = mkCoordUtil.ToViewport(spos);
Screen.DrawTexture(mark,false,vpos.x,vpos.y);
String diststr = String.Format("%f",tdir.length());
diststr.Replace(".","");
Screen.DrawText(whfont,Font.CR_UNTRANSLATED,(vpos.x-whfont.StringWidth(diststr)/2)-12,vpos.y+8,diststr);
TargetActor te = new("TargetActor");
te.vpos = mkCoordUtil.ToViewport(spos);
te.diststr = String.Format("%f",tdir.length());
te.diststr.Replace(".","");
ta.Push(te);
}
}
return !Camera;
}
override void Draw( int bottom, int visibility )
{
if ( visibility != StatusBar.HUDMSGLayer_UnderHUD ) return;
Screen.Dim("Red",0.5,0,0,Screen.GetWidth(),Screen.GetHeight());
// shootable targetting
if ( CVar.GetCVar('flak_redeemerreadout',players[consoleplayer]).GetBool() )
{
for ( int i=0; i<ta.Size(); i++ )
{
Screen.DrawTexture(mark,false,ta[i].vpos.x,ta[i].vpos.y);
Screen.DrawText(whfont,Font.CR_UNTRANSLATED,(ta[i].vpos.x-whfont.StringWidth(ta[i].diststr)/2)-12,ta[i].vpos.y+8,ta[i].diststr);
}
}
// other stuff
@ -570,6 +589,8 @@ Class WarheadLauncher : UTWeapon replaces BFG9000
Weapon.AmmoType2 "WarheadAmmo";
Weapon.AmmoUse2 1;
Weapon.AmmoGive 1;
Inventory.RespawnTics 2100;
+INVENTORY.ALWAYSPICKUP;
}
States
{