Partially implemented Stunner and Impaler (very unfinished).

Switched Impaler fire sound to something more appropriate (proto Skaarj fire).
Add slot priorities to all weapons, final weapons come first.
Adjust hud behavior to properly draw ammo bars by the order of their weapons.
This commit is contained in:
Marisa the Magician 2019-09-16 00:38:38 +02:00
commit fae4f6d50b
31 changed files with 738 additions and 17 deletions

View file

@ -741,6 +741,7 @@ Class ASMD : UnrealWeapon
Weapon.UpSound "shock/select";
Weapon.SlotNumber 4;
Weapon.SelectionOrder 4;
Weapon.SlotPriority 1;
Weapon.AmmoType "ASMDAmmo";
Weapon.AmmoUse 1;
Weapon.AmmoType2 "ASMDAmmo";

View file

@ -273,6 +273,7 @@ Class Automag : UnrealWeapon
Weapon.UpSound "automag/select";
Weapon.SlotNumber 2;
Weapon.SelectionOrder 2;
Weapon.SlotPriority 1;
Weapon.AmmoType "UMiniAmmo";
Weapon.AmmoUse 1;
Weapon.AmmoType2 "UMiniAmmo";

View file

@ -276,6 +276,7 @@ Class Betamag : UnrealWeapon
Weapon.UpSound "betamag/select";
Weapon.SlotNumber 2;
Weapon.SelectionOrder 1;
Weapon.SlotPriority 0.9;
Weapon.AmmoType "UMiniAmmo";
Weapon.AmmoUse 1;
Weapon.AmmoType2 "UMiniAmmo";

View file

@ -165,6 +165,7 @@ Class BigGun : UnrealWeapon
Weapon.UpSound "big/select";
Weapon.SlotNumber 9;
Weapon.SelectionOrder 0;
Weapon.SlotPriority 0.8;
Weapon.AmmoType "BigAmmo";
Weapon.AmmoUse 1;
Weapon.AmmoType2 "BigAmmo";

View file

@ -48,6 +48,7 @@ Class Bonesaw : UnrealWeapon
Weapon.UpSound "bonesaw/select";
Weapon.SlotNumber 1;
Weapon.SelectionOrder 9;
Weapon.SlotPriority 0.9;
+WEAPON.MELEEWEAPON;
+FORCEPAIN;
+NOEXTREMEDEATH;

View file

@ -73,8 +73,7 @@ Class DefaultAmmo : Ammo
{
Super.Tick();
if ( !Owner ) return;
if ( Amount < 10 ) rechargespeed = 1.1;
else rechargespeed = 0.11*Amount;
rechargespeed = max(1.1,0.11*Amount);
rechargephase += 1./rechargespeed;
if ( rechargephase < 35 ) return;
rechargephase = 0;
@ -664,7 +663,8 @@ Class DispersionPistol : UnrealWeapon
Inventory.PickupMessage "$I_DPISTOL";
Weapon.UpSound "dpistol/select";
Weapon.SlotNumber 1;
Weapon.SelectionOrder 1;
Weapon.SelectionOrder 2;
Weapon.SlotPriority 1;
Weapon.AmmoType "DefaultAmmo";
Weapon.AmmoUse 1;
Weapon.AmmoType2 "DefaultAmmo";

View file

@ -15,6 +15,7 @@ Class FlameGun : UnrealWeapon
Weapon.UpSound "flamegun/select";
Weapon.SlotNumber 5;
Weapon.SelectionOrder 2;
Weapon.SlotPriority 0.9;
Weapon.AmmoType "FlameAmmo";
Weapon.AmmoUse 10;
Weapon.AmmoType2 "FlameAmmo";

View file

@ -76,6 +76,7 @@ Class SMiniGun : UnrealWeapon
Weapon.UpSound "smini/select";
Weapon.SlotNumber 0;
Weapon.SelectionOrder 1;
Weapon.SlotPriority 0.9;
Weapon.AmmoType "SMiniAmmo";
Weapon.AmmoUse 1;
Weapon.AmmoType2 "SMiniAmmo";

View file

@ -45,6 +45,15 @@ Class ImpalerCharge : Ammo
Class Impaler : UnrealWeapon
{
bool HasGem;
override void DoEffect()
{
Super.DoEffect();
if ( Owner.player.ReadyWeapon != self ) return;
let psp = Owner.player.FindPSprite(-2);
if ( psp ) psp.alpha = clamp(Ammo2.Amount/double(Ammo2.MaxAmount),0.,1.);
}
Default
{
Tag "$T_IMPALER";
@ -52,6 +61,7 @@ Class Impaler : UnrealWeapon
Weapon.UpSound "impaler/select";
Weapon.SlotNumber 7;
Weapon.SelectionOrder 0;
Weapon.SlotPriority 0.9;
Weapon.AmmoType "ImpalerAmmo";
Weapon.AmmoUse 1;
Weapon.AmmoType2 "ImpalerCharge";
@ -69,5 +79,144 @@ Class Impaler : UnrealWeapon
Stop;
IMPP B -1;
Stop;
Select:
IMPS A 1 A_Raise(int.max);
Wait;
Ready:
IMPS ABCDEF 3 A_WeaponReady(WRF_NOFIRE);
IMPI A 0 A_JumpIfNoAmmo("Idle");
Goto Reload;
Dummy:
TNT1 A 1
{
let weap = Weapon(invoker);
int flags = 0;
if ( weap.Ammo1.Amount > 0 ) flags |= WRF_ALLOWRELOAD;
if ( weap.Ammo2.Amount <= 0 ) flags |= WRF_NOSECONDARY;
A_WeaponReady(flags);
}
Wait;
Idle:
IMPI A 0 A_Overlay(-9999,"Dummy");
IMPI ABCDEFGH 10;
Goto Idle+1;
Melee:
IMPM A 0 A_Overlay(-9999,"Null");
IMPM ABCDEFGHIJ 2;
Goto Idle;
Fire:
IMPF A 0
{
if ( !invoker.HasGem )
return ResolveState("Melee");
A_Overlay(-9999,"Null");
A_Overlay(-3,"Null");
A_Overlay(-2,"Null");
A_PlaySound("impaler/fire",CHAN_WEAPON);
invoker.HasGem = false;
return ResolveState(null);
}
IMPF ABCDEFGHI 2;
IMPI A 0 A_JumpIfNoAmmo("Idle");
Goto Reload;
AltFire:
IMPA A 0
{
if ( !invoker.HasGem )
return ResolveState("Melee");
A_Overlay(-9999,"Null");
A_Overlay(-3,"GemAltFire");
A_Overlay(-2,"ZapAltFire");
A_PlaySound("impaler/altfire",CHAN_WEAPON,looping:true);
return ResolveState(null);
}
IMPA ABCDEFGH 2;
Goto AltHold;
AltHold:
IMPA IJKLMNOP 2;
Goto AltRelease;
AltRelease:
IMPA Q 0
{
A_Overlay(-3,"GemAltRelease");
A_Overlay(-2,"ZapAltRelease");
A_PlaySound("impaler/gem",CHAN_WEAPON,looping:true);
}
IMPA QRSTUVWX 2;
Goto Idle;
Reload:
IMPG A 0
{
A_Overlay(-9999,"Null");
invoker.HasGem = !invoker.HasGem;
if ( invoker.HasGem )
{
A_Overlay(-3,"GemUp");
A_Overlay(-2,"ZapUp");
A_OverlayFlags(-2,PSPF_RenderStyle|PSPF_Alpha,true);
A_OverlayRenderStyle(-2,STYLE_Add);
A_PlaySound("impaler/gem",CHAN_WEAPON,looping:true);
}
else
{
A_Overlay(-3,"GemDown");
A_Overlay(-2,"ZapDown");
A_PlaySound("impaler/gemdown",CHAN_WEAPON);
}
}
IMPG ABCDE 2;
Goto Idle;
Deselect:
IMPD A 0 A_Overlay(-9999,"Null");
IMPD A 0 A_JumpIf(!invoker.HasGem,"FullDeselect");
IMPG A 0
{
invoker.HasGem = false;
A_Overlay(-3,"GemDown");
A_Overlay(-2,"ZapDown");
A_PlaySound("impaler/gemdown",CHAN_WEAPON);
}
IMPG ABCDE 2;
Goto FullDeselect;
FullDeselect:
IMPD ABCDEF 2;
IMPD F 1 A_Lower(int.max);
Wait;
GemUp:
IMGS ABCDE 2;
Goto GemIdle;
GemIdle:
IMGI ABCDEFGH 10;
Loop;
GemDown:
IMGD ABCDE 2;
Stop;
GemAltFire:
IMGA ABCDEFGH 2;
Goto GemAltHold;
GemAltHold:
IMGA IJKLMNOP 2;
Loop;
GemAltRelease:
IMGA QRSTUVWX 2;
Goto GemIdle;
ZapUp:
IMZS ABCDE 2 Bright;
Goto ZapIdle;
ZapIdle:
IMZI ABCDEFGH 10 Bright;
Loop;
ZapDown:
IMZD ABCDE 2 Bright;
Stop;
ZapAltFire:
IMZA ABCDEFGH 2 Bright;
Goto ZapAltHold;
ZapAltHold:
IMZA IJKLMNOP 2 Bright;
Loop;
ZapAltRelease:
IMZA QRSTUVWX 2 Bright;
Goto ZapIdle;
}
}

View file

@ -36,6 +36,7 @@ Class UFlamethrower : UnrealWeapon
Weapon.UpSound "flamet/select";
Weapon.SlotNumber 6;
Weapon.SelectionOrder 4;
Weapon.SlotPriority 0.9;
Weapon.AmmoType "FlameAmmo";
Weapon.AmmoUse 1;
Weapon.AmmoType2 "FlameAmmo";

View file

@ -221,6 +221,7 @@ Class OLSMP : UnrealWeapon
Weapon.UpSound "automag/select";
Weapon.SlotNumber 0;
Weapon.SelectionOrder 9;
Weapon.SlotPriority 0.95;
Weapon.AmmoType "OLSMPAmmo";
Weapon.AmmoUse 1;
Weapon.AmmoType2 "OLSMPAmmo";

View file

@ -446,6 +446,7 @@ Class Peacemaker : UnrealWeapon
Weapon.UpSound "peace/select";
Weapon.SlotNumber 8;
Weapon.SelectionOrder 1;
Weapon.SlotPriority 0.9;
Weapon.AmmoType "PeaceAmmo";
Weapon.AmmoUse 1;
Weapon.AmmoType2 "PeaceAmmo";

View file

@ -249,6 +249,7 @@ Class QuadShot : UnrealWeapon
Weapon.UpSound "quadshot/select";
Weapon.SlotNumber 3;
Weapon.SelectionOrder 2;
Weapon.SlotPriority 0.9;
Weapon.AmmoType "UShells";
Weapon.AmmoUse 1;
Weapon.AmmoType2 "UShells";

View file

@ -246,6 +246,7 @@ Class Razorjack : UnrealWeapon
Weapon.UpSound "ripper/select";
Weapon.SlotNumber 7;
Weapon.SelectionOrder 7;
Weapon.SlotPriority 1;
Weapon.AmmoType "RazorAmmo";
Weapon.AmmoUse 1;
Weapon.AmmoType2 "RazorAmmo";

View file

@ -224,6 +224,7 @@ Class URifle : UnrealWeapon
Weapon.UpSound "sniper/select";
Weapon.SlotNumber 9;
Weapon.SelectionOrder 9;
Weapon.SlotPriority 1;
Weapon.AmmoType "URifleAmmo";
Weapon.AmmoUse 1;
Weapon.AmmoType2 "URifleAmmo";

View file

@ -494,6 +494,7 @@ Class Stinger : UnrealWeapon
Weapon.UpSound "stinger/select";
Weapon.SlotNumber 3;
Weapon.SelectionOrder 7;
Weapon.SlotPriority 1;
Weapon.AmmoType "StingerAmmo";
Weapon.AmmoUse 1;
Weapon.AmmoType2 "StingerAmmo";

View file

@ -14,8 +14,7 @@ Class StunnerAmmo : Ammo
{
Super.Tick();
if ( !Owner ) return;
if ( Amount < 10 ) rechargespeed = 1.1;
else rechargespeed = 0.11*Amount;
rechargespeed = max(2.,.2*Amount);
rechargephase += 1./rechargespeed;
if ( rechargephase < 7 ) return;
rechargephase = 0;
@ -33,6 +32,66 @@ Class StunProj : Actor
Class Stunner : UnrealWeapon
{
double chargesize, count;
bool bCharging;
action void A_StunnerFire()
{
Weapon weap = Weapon(invoker);
if ( !weap ) return;
A_WeaponOffset(0,32);
invoker.bCharging = false;
if ( self is 'UTPlayer' )
UTPlayer(self).PlayAttacking3();
StunnerAmmo(weap.Ammo1).rechargephase = 0;
A_PlaySound("stun/fire",CHAN_WEAPON,Dampener.Active(self)?.4:1.);
double mult = Amplifier.GetMult(self,int(invoker.ChargeSize*50)+50);
invoker.FireEffect();
A_Overlay(-2,"Null");
}
action void A_BeginCharge()
{
let weap = Weapon(invoker);
invoker.bCharging = true;
weap.DepleteAmmo(weap.bAltFire,true,1);
invoker.count = 0;
invoker.chargesize = .6;
A_PlaySound("stun/charge",CHAN_WEAPON,Dampener.Active(self)?.15:1.);
A_Overlay(-2,"Sparks");
A_OverlayFlags(-2,PSPF_RenderStyle,true);
A_OverlayRenderStyle(-2,STYLE_Add);
StunnerAmmo(weap.Ammo1).rechargephase = 0;
if ( !Dampener.Active(self) ) A_AlertMonsters();
}
action State A_ChargeUp()
{
if ( !(player.cmd.buttons&(BT_ATTACK|BT_ALTATTACK)) )
return ResolveState("Release");
Weapon weap = Weapon(invoker);
if ( !weap ) return ResolveState(null);
StunnerAmmo(weap.Ammo1).rechargephase = 0;
UTMainHandler.DoSwing(self,(FRandom[Stunner](-1,1),FRandom[Stunner](-1,1)),0.02*invoker.chargesize,0,2,SWING_Spring);
A_WeaponOffset(FRandom[Stunner](-1,1)*1.2*invoker.chargesize,32+FRandom[Stunner](-1,1)*1.2*invoker.chargesize);
if ( !Dampener.Active(self) ) A_AlertMonsters();
if ( invoker.chargesize >= 6. )
{
invoker.count += 1./35.;
if ( invoker.count > 1.5 ) return ResolveState("Release");
return ResolveState(null);
}
invoker.chargesize += 2./35.;
invoker.count += 1./35.;
if ( invoker.count < 0.14 ) return ResolveState(null);
invoker.count = 0;
if ( !(sv_infiniteammo || (FindInventory('PowerInfiniteAmmo',true))) )
{
if ( weap.Ammo1.Amount < 1 )
return ResolveState("Release");
weap.Ammo1.Amount--;
}
return ResolveState(null);
}
Default
{
Tag "$T_STUNNER";
@ -40,6 +99,7 @@ Class Stunner : UnrealWeapon
Weapon.UpSound "stun/select";
Weapon.SlotNumber 4;
Weapon.SelectionOrder 9;
Weapon.SlotPriority 0.9;
Weapon.AmmoType "StunnerAmmo";
Weapon.AmmoUse 1;
Weapon.AmmoType2 "StunnerAmmo";
@ -54,5 +114,46 @@ Class Stunner : UnrealWeapon
Stop;
STNP B -1;
Stop;
Select:
STNS A 1 A_Raise(int.max);
Wait;
Ready:
STNS ABCDEFGHIJKLMNOPQRSTUVWX 2 A_WeaponReady(WRF_NOFIRE);
Goto Idle;
Idle:
STNI A 1
{
A_CheckReload();
let weap = Weapon(invoker);
if ( weap && weap.Ammo1.Amount > 0 ) A_WeaponReady();
else A_WeaponReady(WRF_NOFIRE);
}
Wait;
Fire:
AltFire:
#### # 2 A_BeginCharge();
STNF ABCDEFGHIJKLMNOPQRST 2 A_ChargeUp();
Goto Hold;
Hold:
STNH R 1 A_ChargeUp();
Wait;
Release:
#### # 2;
STNR A 0 A_StunnerFire();
STNR ABC 1;
STR2 ABCDE 2;
STNF TRPNLJHFDB 1 A_WeaponReady(WRF_NOSWITCH|WRF_DISABLESWITCH);
Goto Idle;
Deselect:
STND ABCDEFGHIJKL 1;
STND L 1 A_Lower(int.max);
Wait;
Sparks:
TNT1 A 8;
STFF ABCDEFGHIJKLMNOPQRS 2 Bright;
STFF J 0 A_JumpIf(invoker.chargesize>=5.,1);
Goto Sparks+10;
STFF JIHGFEDCBA 2 Bright;
Stop;
}
}

View file

@ -668,6 +668,7 @@ Class UBioRifle : UnrealWeapon
Weapon.UpSound "ges/select";
Weapon.SlotNumber 8;
Weapon.SelectionOrder 8;
Weapon.SlotPriority 1;
Weapon.AmmoType "UBioAmmo";
Weapon.AmmoUse 1;
Weapon.AmmoType2 "UBioAmmo";

View file

@ -495,6 +495,7 @@ Class Eightball : UnrealWeapon
Weapon.UpSound "utrl/select";
Weapon.SlotNumber 5;
Weapon.SelectionOrder 5;
Weapon.SlotPriority 1;
Weapon.AmmoType "URocketAmmo";
Weapon.AmmoUse 1;
Weapon.AmmoType2 "URocketAmmo";

View file

@ -291,6 +291,7 @@ Class UFlakCannon : UnrealWeapon
Weapon.UpSound "flak/select";
Weapon.SlotNumber 6;
Weapon.SelectionOrder 4;
Weapon.SlotPriority 1;
Weapon.AmmoType "UFlakBox";
Weapon.AmmoUse 1;
Weapon.AmmoType2 "UFlakBox";

View file

@ -150,6 +150,7 @@ Class UMinigun : UnrealWeapon
Weapon.UpSound "minigun/select";
Weapon.SlotNumber 0;
Weapon.SelectionOrder 10;
Weapon.SlotPriority 1;
Weapon.AmmoType "UMiniAmmo";
Weapon.AmmoUse 1;
Weapon.AmmoType2 "UMiniAmmo";

View file

@ -176,7 +176,37 @@ Class UPlayer : UTPlayer
if ( !player.weapons.LocateWeapon(type) ) continue;
readonly<Weapon> def = GetDefaultByType(type);
if ( (giveall == ALL_YESYES) || !def.bCheatNotWeapon )
{
GiveInventory(type,1,true);
if ( (type is 'Automag') && sting_automags )
{
// force akimbo
let t = FindInventory(type);
if ( t ) t.Amount = 2;
}
else if ( (type is 'Betamag') && sting_protomags )
{
// force akimbo
let t = FindInventory(type);
if ( t ) t.Amount = 2;
}
else if ( type is 'DispersionPistol' )
{
// force upgrade
let dsp = DispersionPistol(FindInventory('DispersionPistol'));
if ( dsp )
{
dsp.Ammo1.MaxAmount = 90;
if ( player.ReadyWeapon == dsp )
dsp.pendingupgrade = 4;
else
{
dsp.upgradelevel = 4;
dsp.MainUse = min(6,dsp.upgradelevel+1);
}
}
}
}
}
}
player.PendingWeapon = savedpending;
@ -1154,6 +1184,14 @@ Class UnrealMainHandler : EventHandler
if ( t ) t.Use(false);
}
}
private static bool CmpWeapon( Class<Weapon> a, Class <Weapon> b )
{
let defa = GetDefaultByType(a);
let defb = GetDefaultByType(b);
if ( defa.SlotPriority <= defb.SlotPriority ) return true;
if ( defa.SlotNumber > defb.SlotNumber ) return true;
return false;
}
override void WorldLoaded( WorldEvent e )
{
// More "authentic" Unreal flavor of these edits
@ -1167,8 +1205,9 @@ Class UnrealMainHandler : EventHandler
level.ReplaceTextures("uAlnWl2b","C_WAL19A",0);
level.ReplaceTextures("xAlnWl2b","C_WAL19F",0);
}
// populate ammo-by-slot array
AmmoSlots.Clear();
// populate weapons array
Array<Class<Weapon> > SortedWeapons;
SortedWeapons.Clear();
for ( int i=0; i<AllActorClasses.Size(); i++ )
{
let type = (class<Weapon>)(AllActorClasses[i]);
@ -1179,6 +1218,31 @@ Class UnrealMainHandler : EventHandler
int wslot = def.SlotNumber;
if ( wslot == -1 ) continue;
if ( !def.AmmoType1 ) continue;
SortedWeapons.Push(type);
}
// sort weapons array
for ( int i=0; i<SortedWeapons.Size(); i++ )
{
int j = 1;
while ( j < SortedWeapons.Size() )
{
int k = j;
while ( (k > 0) && CmpWeapon(SortedWeapons[k-1],SortedWeapons[k]) )
{
Class<Weapon> tmp = SortedWeapons[k];
SortedWeapons[k] = SortedWeapons[k-1];
SortedWeapons[k-1] = tmp;
k--;
}
j++;
}
}
// populate ammo-by-slot array
AmmoSlots.Clear();
for ( int i=0; i<SortedWeapons.Size(); i++ )
{
readonly<Weapon> def = GetDefaultByType(SortedWeapons[i]);
int wslot = def.SlotNumber;
int found = -1;
for ( int j=0; j<AmmoSlots.Size(); j++ )
{

View file

@ -225,7 +225,8 @@ Class UTranslocator : UnrealWeapon
Tag "$T_TELEGUN";
Inventory.PickupMessage "$I_TELEGUN";
Weapon.SlotNumber 1;
Weapon.SelectionOrder 10;
Weapon.SelectionOrder 1;
Weapon.SlotPriority 0.1;
Weapon.AmmoType1 "UTranslocatorAmmo";
Weapon.AmmoUse1 1;
Weapon.AmmoType2 "UTranslocatorAmmo";