Overhaul to how reloading works, not much else has happened.

Addition to HUD for showing clip counts (kinda cheap-looking, but still better than what Oldskool did).
Charge for some weapons and loaded rockets for eightball also use the clipcount display, like in Doom Tournament.
Small fixups for dual wielding logic.
This commit is contained in:
Marisa the Magician 2019-09-17 02:47:13 +02:00
commit 225ffcc1e9
28 changed files with 307 additions and 123 deletions

View file

@ -1,13 +1,26 @@
U083Digits
{
0 Zero083
1 One083
2 Two083
3 Three083
4 Four083
5 Five083
6 Six083
7 Seven083
8 Eight083
9 Nine083
0 "graphics/hud083/font/Zero083.png"
1 "graphics/hud083/font/One083.png"
2 "graphics/hud083/font/Two083.png"
3 "graphics/hud083/font/Three083.png"
4 "graphics/hud083/font/Four083.png"
5 "graphics/hud083/font/Five083.png"
6 "graphics/hud083/font/Six083.png"
7 "graphics/hud083/font/Seven083.png"
8 "graphics/hud083/font/Eight083.png"
9 "graphics/hud083/font/Nine083.png"
}
U083DigitsSmall
{
0 "graphics/hud083/font/sZero083.png"
1 "graphics/hud083/font/sOne083.png"
2 "graphics/hud083/font/sTwo083.png"
3 "graphics/hud083/font/sThree083.png"
4 "graphics/hud083/font/sFour083.png"
5 "graphics/hud083/font/sFive083.png"
6 "graphics/hud083/font/sSix083.png"
7 "graphics/hud083/font/sSeven083.png"
8 "graphics/hud083/font/sEight083.png"
9 "graphics/hud083/font/sNine083.png"
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4 KiB

After

Width:  |  Height:  |  Size: 4 KiB

Before After
Before After

Binary file not shown.

After

Width:  |  Height:  |  Size: 580 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 569 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 570 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 579 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 519 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 556 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 581 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 583 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 561 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 581 B

View file

@ -310,6 +310,11 @@ Class ASMDHitbox : ShockHitbox
}
}
}
Default
{
Radius 6;
Height 12;
}
}
Class ASMDBall : Actor

View file

@ -29,6 +29,11 @@ Class Automag : UnrealWeapon
property ClipCount : ClipCount;
property SlaveClipCount : SlaveClipCount;
override int, int, bool, bool GetClipAmount()
{
if ( Amount > 1 ) return ClipCount, SlaveClipCount, (ClipCount<5), (SlaveClipCount<5);
return ClipCount, -1, (ClipCount<5), false;
}
override bool HandlePickup( Inventory item )
{
if ( sting_automags && (item.GetClass() == GetClass()) )
@ -72,7 +77,7 @@ Class Automag : UnrealWeapon
if ( slave )
{
if ( invoker.slaveclipcount < 5 ) A_PlaySound("automag/click",CHAN_ITEM,!Dampener.Active(self)?1.:.35);
if ( (invoker.slaveclipcount <= 0) || (weap.Ammo1.Amount <= 0) )
if ( invoker.slaveclipcount <= 0 )
{
invoker.slaverefire = 0;
return;
@ -81,25 +86,21 @@ Class Automag : UnrealWeapon
if ( (player.cmd.buttons&BT_ATTACK) && !invoker.slavealtfire && !pending && (player.health > 0) )
{
invoker.slaverefire++;
if ( player.ReadyWeapon.CheckAmmo(Weapon.PrimaryFire,true) )
if ( invoker.slaveclipcount > 0 )
player.setpsprite(2,flash?ResolveState(flash):ResolveState("LeftHold"));
}
else if ( (player.cmd.buttons&BT_ALTATTACK) && invoker.slavealtfire && !pending && (player.health > 0) )
{
invoker.slaverefire++;
if ( player.ReadyWeapon.CheckAmmo(Weapon.AltFire,true) )
if ( invoker.slaveclipcount > 0 )
player.setpsprite(2,flash?ResolveState(flash):ResolveState("LeftAltHold"));
}
else
{
invoker.slaverefire = 0;
player.ReadyWeapon.CheckAmmo(invoker.slavealtfire?Weapon.AltFire:Weapon.PrimaryFire,true);
}
else invoker.slaverefire = 0;
}
else
{
if ( invoker.clipcount < 5 ) A_PlaySound("automag/click",CHAN_ITEM,!Dampener.Active(self)?1.:.35);
if ( (invoker.clipcount <= 0) || (weap.Ammo1.Amount <= 0) )
if ( invoker.clipcount <= 0 )
{
A_ClearRefire();
return;
@ -113,9 +114,11 @@ Class Automag : UnrealWeapon
if ( !weap || !player ) return;
if ( player.cmd.buttons&BT_ATTACK && !player.ReadyWeapon.bAltFire )
{
if ( (invoker.slaveclipcount <= 0) && (weap.Ammo1.Amount > 0) )
if ( invoker.slaveclipcount <= 0 )
{
player.setpsprite(2,ResolveState("LeftReload"));
let psp = player.FindPSprite(PSP_WEAPON);
if ( (weap.Ammo1.Amount > 0) && !psp.CurState.InStateSequence(ResolveState("Reload")) )
player.setpsprite(2,ResolveState("LeftReload"));
return;
}
invoker.slaverefire = 0;
@ -124,9 +127,11 @@ Class Automag : UnrealWeapon
}
else if ( player.cmd.buttons&BT_ALTATTACK && player.ReadyWeapon.bAltFire )
{
if ( (invoker.slaveclipcount <= 0) && (weap.Ammo1.Amount > 0) )
if ( invoker.slaveclipcount <= 0 )
{
player.setpsprite(2,ResolveState("LeftReload"));
let psp = player.FindPSprite(PSP_WEAPON);
if ( (weap.Ammo1.Amount > 0) && !psp.CurState.InStateSequence(ResolveState("Reload")) )
player.setpsprite(2,ResolveState("LeftReload"));
return;
}
invoker.slaverefire = 0;
@ -138,10 +143,16 @@ Class Automag : UnrealWeapon
{
Weapon weap = Weapon(invoker);
if ( !weap ) return;
if ( weap.Ammo1.Amount <= 0 ) return;
if ( !weap.DepleteAmmo(weap.bAltFire,true,1) ) return;
if ( slave ) invoker.slaveclipcount--;
else invoker.clipcount--;
if ( slave )
{
if ( invoker.slaveclipcount <= 0 ) return;
invoker.slaveclipcount--;
}
else
{
if ( invoker.clipcount <= 0 ) return;
invoker.clipcount--;
}
invoker.FireEffect();
UTMainHandler.DoFlash(self,Color(32,255,128,0),1);
A_PlaySound("automag/fire",slave?CHAN_6:CHAN_WEAPON,!Dampener.Active(self)?1.:.2);
@ -263,6 +274,11 @@ Class Automag : UnrealWeapon
}
Amount = 1;
}
override bool CheckAmmo( int fireMode, bool autoSwitch, bool requireAmmo, int ammocount )
{
if ( (ClipCount > 0) || ((Amount>1) && (SlaveClipCount > 0)) ) return true;
return Super.CheckAmmo(firemode,autoswitch,requireammo,ammocount);
}
Default
{
Tag "$T_AUTOMAG";
@ -329,8 +345,9 @@ Class Automag : UnrealWeapon
Dummy:
TNT1 A 1
{
if ( (invoker.clipcount <= 0) && (invoker.Ammo1.Amount > 0) ) A_Overlay(PSP_WEAPON,"Reload");
else if ( ((invoker.clipcount < min(20,invoker.Ammo1.Amount)) || (invoker.slaveclipcount < min(20,invoker.Ammo1.Amount))) ) A_WeaponReady(WRF_ALLOWRELOAD|WRF_ALLOWZOOM);
A_CheckReload();
if ( (invoker.clipcount <= 0) && (invoker.Ammo1.Amount > 0) ) player.SetPSprite(PSP_WEAPON,ResolveState("Reload"));
else if ( ((invoker.clipcount < min(invoker.default.clipcount,invoker.Ammo1.Amount)) || (invoker.slaveclipcount < min(invoker.default.slaveclipcount,invoker.Ammo1.Amount))) ) A_WeaponReady(WRF_ALLOWRELOAD|WRF_ALLOWZOOM);
else A_WeaponReady(WRF_ALLOWZOOM);
if ( !invoker.slaveactive && (CountInv("Automag") > 1) ) A_Overlay(2,"LeftReady");
}
@ -341,11 +358,11 @@ Class Automag : UnrealWeapon
if ( health <= 0 )
{
invoker.slaveactive = false;
A_Overlay(2,"LeftDeselect");
player.SetPSprite(2,ResolveState("LeftDeselect"));
}
else if ( invoker.slavereload ) A_Overlay(2,"LeftReload");
else if ( invoker.slavedown ) A_Overlay(2,"LeftDeselect");
else if ( invoker.slavespin ) A_Overlay(2,"LeftZoom");
else if ( invoker.slavereload ) player.SetPSprite(2,ResolveState("LeftReload"));
else if ( invoker.slavedown ) player.SetPSprite(2,ResolveState("LeftDeselect"));
else if ( invoker.slavespin ) player.SetPSprite(2,ResolveState("LeftZoom"));
else A_LeftWeaponReady();
}
Wait;
@ -457,41 +474,57 @@ Class Automag : UnrealWeapon
Reload:
AUTR A 0
{
invoker.slavereload = ((player.cmd.buttons&BT_RELOAD)&&invoker.slaveactive&&(invoker.slaveclipcount < min(20,invoker.Ammo1.Amount)))||(invoker.slaveclipcount <= 0);
return A_JumpIf(invoker.clipcount>=min(20,invoker.Ammo1.Amount),"Idle");
if ( invoker.clipcount>=min(invoker.default.clipcount,invoker.Ammo1.Amount) )
{
invoker.slavereload = (invoker.slaveactive&&(invoker.slaveclipcount < min(invoker.default.slaveclipcount,invoker.Ammo1.Amount)))||(invoker.slaveclipcount <= 0);
return ResolveState("Idle");
}
return ResolveState(null);
}
AUTR A 0
{
invoker.clipcount = Min(20,invoker.Ammo1.Amount);
invoker.special1 = min(invoker.default.clipcount,invoker.Ammo1.Amount)-invoker.clipcount;
invoker.clipcount = -1;
A_Overlay(-9999,null);
A_WeaponOffset(0,32); // fix sudden psprite lowering
A_PlaySound("automag/click",CHAN_WEAPON,!Dampener.Active(self)?1.:.1);
}
AUTR ABCDEFGHIJKLMNOPQRSTUVWXY 1;
AUTD ABCD 1;
AUTD E 30
{
invoker.clipcount = Min(invoker.default.clipcount,invoker.Ammo1.Amount);
invoker.Ammo1.Amount -= invoker.special1;
A_PlaySound("automag/reload",CHAN_WEAPON,!Dampener.Active(self)?1.:.1);
if ( self is 'UTPlayer' )
UTPlayer(self).PlayReloading();
invoker.slavereload = (invoker.slaveactive&&(invoker.slaveclipcount < min(invoker.default.slaveclipcount,invoker.Ammo1.Amount)))||(invoker.slaveclipcount <= 0);
}
AUTS A 0 A_PlaySound("automag/select",CHAN_WEAPON,!Dampener.Active(self)?1.:.1);
Goto Ready;
LeftReload:
2UTR A 0
{
invoker.slaveclipcount = Min(20,invoker.Ammo1.Amount);
invoker.slavereload = false;
if ( invoker.slaveclipcount>=min(invoker.default.slaveclipcount,invoker.Ammo1.Amount) )
{
invoker.slavereload = 0;
return ResolveState("LeftIdle");
}
invoker.special2 = min(invoker.default.slaveclipcount,invoker.Ammo1.Amount)-invoker.slaveclipcount;
invoker.slaveclipcount = -1;
A_Overlay(-9998,null);
A_PlaySound("automag/click",CHAN_6,!Dampener.Active(self)?1.:.1);
return ResolveState(null);
}
2UTR ABCDEFGHIJKLMNOPQRSTUVWXY 1;
2UTD ABCD 1;
2UTD E 30
{
invoker.slaveclipcount = Min(invoker.default.slaveclipcount,invoker.Ammo1.Amount);
invoker.Ammo1.Amount -= invoker.special2;
A_PlaySound("automag/reload",CHAN_6,!Dampener.Active(self)?1.:.1);
if ( self is 'UTPlayer' )
UTPlayer(self).PlayReloading();
invoker.slavereload = false;
}
2UTS A 0 A_PlaySound("automag/select",CHAN_6,!Dampener.Active(self)?1.:.1);
Goto LeftReady;
@ -530,11 +563,17 @@ Class Automag : UnrealWeapon
2UT3 C 0;
Goto LeftZoomLoop;
Deselect:
AUTI A 1 { invoker.slavedown = true; }
AUTD A 0 A_Overlay(-9999,null);
AUTD A 0 A_JumpIf(invoker.slaveactive,"Deselect");
AUTD A 0
{
A_Overlay(-9999,null);
invoker.slavedown = true;
}
AUTD ABCD 1;
AUTD E 1 A_Lower(int.max);
AUTD E 1
{
if ( !player.FindPSprite(2) )
A_Lower(int.max);
}
Wait;
LeftDeselect:
2UTD A 0

View file

@ -446,7 +446,7 @@ Class Betamag : UnrealWeapon
LeftReloadHold:
2UTI A 0
{
if ( !(player.cmd.buttons&BT_RELOAD) ) return ResolveState("LeftIdle");
if ( !((invoker.Ammo1.Amount<=0) && (player.cmd.buttons&(BT_ATTACK|BT_ALTATTACK))) && !(player.cmd.buttons&BT_RELOAD) ) return ResolveState("LeftIdle");
invoker.slavewhip = false;
A_Overlay(-9998,null);
UTMainHandler.DoSwing(self,(FRandom[Betamag](0.4,0.5),FRandom[Betamag](0.2,0.3)),4,0,8,SWING_Spring,5);
@ -468,7 +468,7 @@ Class Betamag : UnrealWeapon
2UTW N 0 A_BetamagWhip();
2UTW NOPQR 1;
2UTW STUVWXYZ[\ 2;
2UTI A 0 A_JumpIf(player.cmd.buttons&BT_RELOAD,"LeftReloadHold");
2UTI A 0 A_JumpIf((invoker.Ammo1.Amount<=0)&&(player.cmd.buttons&(BT_ATTACK|BT_ALTATTACK))||(player.cmd.buttons&BT_RELOAD),"LeftReloadHold");
Goto LeftIdle;
Zoom:
AUTR A 1
@ -497,11 +497,17 @@ Class Betamag : UnrealWeapon
2UR2 ABCDEFGHIJK 1;
Goto LeftIdle;
Deselect:
AUTI A 1 { invoker.slavedown = true; }
AUTD A 0 A_Overlay(-9999,null);
AUTD A 0 A_JumpIf(invoker.slaveactive,"Deselect");
AUTD A 0
{
A_Overlay(-9999,null);
invoker.slavedown = true;
}
AUTD ABCDEFG 1;
AUTD G 1 A_Lower(int.max);
AUTD G 1
{
if ( !player.FindPSprite(2) )
A_Lower(int.max);
}
Wait;
LeftDeselect:
2UTD A 0

View file

@ -479,6 +479,10 @@ Class DispersionPistol : UnrealWeapon
bool bCharging;
int MainUse, ChargeUse;
override int, int, bool, bool GetClipAmount()
{
return bCharging?min(5,int(chargesize+0.1)):-1, -1, false, false;
}
override void Tick()
{
Super.Tick();
@ -714,15 +718,15 @@ Class DispersionPistol : UnrealWeapon
{
A_CheckReload();
let weap = Weapon(invoker);
if ( weap && weap.Ammo1.Amount > 0 ) A_WeaponReady();
if ( invoker.pendingupgrade > invoker.upgradelevel )
player.SetPSprite(PSP_WEAPON,ResolveState("Upgrade"));
else if ( weap && weap.Ammo1.Amount > 0 ) A_WeaponReady();
else A_WeaponReady(WRF_NOFIRE);
}
Wait;
Idle:
#### # 0
{
if ( invoker.pendingupgrade > invoker.upgradelevel )
return ResolveState("Upgrade");
A_Overlay(-9999,"Dummy");
if ( invoker.upgradelevel == 0 ) return ResolveState("Idle1");
else if ( invoker.upgradelevel == 1 ) return ResolveState("Idle2");
@ -851,22 +855,22 @@ Class DispersionPistol : UnrealWeapon
Upgrade1:
#### # 0 A_PlaySound("dpistol/up1",CHAN_6,Dampener.Active(self)?.2:1.);
DPU1 ABCD 9;
DPI2 A 4;
DPI2 A 4 A_JumpIf(invoker.pendingupgrade>invoker.upgradelevel,"Upgrade");
Goto Idle;
Upgrade2:
#### # 0 A_PlaySound("dpistol/up2",CHAN_6,Dampener.Active(self)?.2:1.);
DPU2 ABCDEFGHI 9;
DPI3 A 4;
DPI3 A 4 A_JumpIf(invoker.pendingupgrade>invoker.upgradelevel,"Upgrade");
Goto Idle;
Upgrade3:
#### # 0 A_PlaySound("dpistol/up3",CHAN_6,Dampener.Active(self)?.2:1.);
DPU3 ABCDEFGHI 9;
DPI4 A 4;
DPI4 A 4 A_JumpIf(invoker.pendingupgrade>invoker.upgradelevel,"Upgrade");
Goto Idle;
Upgrade4:
#### # 0 A_PlaySound("dpistol/up4",CHAN_6,Dampener.Active(self)?.2:1.);
DPU4 ABCDEFGHI 9;
DPI5 A 4;
DPI5 A 4 A_JumpIf(invoker.pendingupgrade>invoker.upgradelevel,"Upgrade");
Goto Idle;
Select:
DPS1 A 1 A_Raise(int.max);

View file

@ -31,28 +31,49 @@ Class ImpalerAmmo2 : ImpalerAmmo
}
}
Class ImpalerCharge : Ammo
{
Default
{
Inventory.Amount 100;
Inventory.MaxAmount 100;
Ammo.BackpackAmount 0;
Ammo.BackpackMaxAmount 100;
+INVENTORY.IGNORESKILL;
}
}
Class Impaler : UnrealWeapon
{
int ClipCount;
bool HasGem;
Actor beam;
property ClipCount : ClipCount;
override int, int, bool, bool GetClipAmount()
{
return ClipCount, -1, (ClipCount<10), false;
}
action void A_ImpalerFire()
{
A_Overlay(-9999,"Null");
A_Overlay(-3,"Null");
A_Overlay(-2,"Null");
A_PlaySound("impaler/fire",CHAN_WEAPON);
invoker.HasGem = false;
invoker.ClipCount = -1;
}
action void A_StartBeam()
{
}
action void A_DrainAmmo()
{
}
action void A_StopBeam()
{
}
override void DoEffect()
{
Super.DoEffect();
if ( Owner.player.ReadyWeapon != self ) return;
if ( (Owner.waterlevel > 2) && !(level.maptime%5) )
ClipCount = max(0,ClipCount-1);
let psp = Owner.player.FindPSprite(-2);
if ( psp ) psp.alpha = clamp(Ammo2.Amount/double(Ammo2.MaxAmount),0.,1.);
if ( psp ) psp.alpha = clamp(ClipCount/double(default.ClipCount),0.,1.);
}
override bool CheckAmmo( int fireMode, bool autoSwitch, bool requireAmmo, int ammocount )
{
if ( ClipCount > 0 ) return true;
return Super.CheckAmmo(firemode,autoswitch,requireammo,ammocount);
}
Default
{
@ -64,13 +85,11 @@ Class Impaler : UnrealWeapon
Weapon.SlotPriority 0.9;
Weapon.AmmoType "ImpalerAmmo";
Weapon.AmmoUse 1;
Weapon.AmmoType2 "ImpalerCharge";
Weapon.AmmoType2 "ImpalerAmmo";
Weapon.AmmoUse2 1;
Weapon.AmmoGive1 60;
Weapon.AmmoGive2 0;
UTWeapon.DropAmmo 30;
+WEAPON.AMMO_OPTIONAL;
+WEAPON.ALT_AMMO_OPTIONAL;
Weapon.AmmoGive 6;
UTWeapon.DropAmmo 3;
Impaler.ClipCount 30;
}
States
{
@ -84,15 +103,21 @@ Class Impaler : UnrealWeapon
Wait;
Ready:
IMPS ABCDEF 3 A_WeaponReady(WRF_NOFIRE);
IMPI A 0 A_JumpIfNoAmmo("Idle");
Goto Reload;
IMPI A 0
{
let weap = Weapon(invoker);
if ( (invoker.ClipCount>=0) || (weap.Ammo1.Amount > 0) )
return ResolveState("Reload");
return ResolveState("Idle");
}
Goto Idle;
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;
if ( invoker.HasGem && (invoker.ClipCount <= 0) ) flags |= WRF_NOSECONDARY;
A_WeaponReady(flags);
}
Wait;
@ -109,11 +134,7 @@ Class Impaler : UnrealWeapon
{
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;
A_ImpalerFire();
return ResolveState(null);
}
IMPF ABCDEFGHI 2;
@ -151,6 +172,12 @@ Class Impaler : UnrealWeapon
invoker.HasGem = !invoker.HasGem;
if ( invoker.HasGem )
{
let weap = Weapon(invoker);
if ( invoker.ClipCount < 0 )
{
weap.DepleteAmmo(false,true,1);
invoker.ClipCount = invoker.default.ClipCount;
}
A_Overlay(-3,"GemUp");
A_Overlay(-2,"ZapUp");
A_OverlayFlags(-2,PSPF_RenderStyle|PSPF_Alpha,true);

View file

@ -266,7 +266,7 @@ Class VoiceBox : UnrealInventory
Tag "$T_VOICEBOX";
Inventory.PickupMessage "$I_VOICEBOX";
Inventory.Icon "I_VoiceB";
Inventory.MaxAmount 3;
Inventory.MaxAmount 2;
UnrealInventory.Charge 600;
}
override void DoEffect()
@ -1117,7 +1117,7 @@ Class Forcefield : UnrealInventory
Tag "$T_FORCEFIELD";
Inventory.PickupMessage "$I_FORCEFIELD";
Inventory.Icon "I_ForceF";
Inventory.MaxAmount 5;
Inventory.MaxAmount 3;
}
override bool Use( bool pickup )
{
@ -2082,8 +2082,8 @@ Class MinigunSentryBase : Actor
Tag "$T_SENTRY";
Health sentryhealth;
Mass int.max;
Radius 12;
Height 48;
Radius 8;
Height 46;
+SOLID;
+SHOOTABLE;
+NOBLOOD;
@ -2245,7 +2245,7 @@ Class SentryGunItem : UnrealInventory
{
Tag "$T_OSENTRY";
Inventory.Icon "I_OSntry";
Inventory.MaxAmount 3;
Inventory.MaxAmount 2;
Inventory.PickupMessage "$I_OSENTRY";
Inventory.RespawnTics 1050;
}
@ -2363,8 +2363,8 @@ Class SentryGun : Actor
Tag "$T_OSENTRY";
Health 50;
Mass int.max;
Radius 10;
Height 24;
Radius 6;
Height 18;
+SOLID;
+SHOOTABLE;
+NOBLOOD;

View file

@ -68,6 +68,10 @@ Class OLSMP : UnrealWeapon
property ClipCount : ClipCount;
override int, int, bool, bool GetClipAmount()
{
return ClipCount, -1, (ClipCount<35), false;
}
override void PlayUpSound( Actor origin )
{
origin.A_PlaySound(upsound,CHAN_WEAPON,Dampener.Active(origin)?.1:1.,pitch:0.8);
@ -119,7 +123,7 @@ Class OLSMP : UnrealWeapon
if ( !weap || !player ) return;
if ( invoker.altaccuracy < 0.2 ) invoker.altaccuracy += 0.01;
if ( invoker.clipcount < 35 ) A_PlaySound("automag/click",CHAN_ITEM,!Dampener.Active(self)?1.:.35,pitch:1.6);
if ( (invoker.clipcount <= 0) || (weap.Ammo1.Amount <= 0) )
if ( invoker.clipcount <= 0 )
{
A_ClearRefire();
return;
@ -130,8 +134,7 @@ Class OLSMP : UnrealWeapon
{
Weapon weap = Weapon(invoker);
if ( !weap ) return;
if ( weap.Ammo1.Amount <= 0 ) return;
if ( !weap.DepleteAmmo(weap.bAltFire,true,1) ) return;
if ( invoker.clipcount <= 0 ) return;
invoker.clipcount--;
invoker.FireEffect();
UTMainHandler.DoFlash(self,Color(32,255,128,0),1);
@ -214,6 +217,11 @@ Class OLSMP : UnrealWeapon
let c = Spawn("UCasing",origin);
c.vel = x*FRandom[Junk](-1.5,1.5)+y*FRandom[Junk](2,4)+z*FRandom[Junk](2,3);
}
override bool CheckAmmo( int fireMode, bool autoSwitch, bool requireAmmo, int ammocount )
{
if ( ClipCount > 0 ) return true;
return Super.CheckAmmo(firemode,autoswitch,requireammo,ammocount);
}
Default
{
Tag "$T_OLSMP";
@ -254,6 +262,7 @@ Class OLSMP : UnrealWeapon
Dummy:
TNT1 A 1
{
A_CheckReload();
if ( (invoker.clipcount <= 0) && (invoker.Ammo1.Amount > 0) ) A_Overlay(PSP_WEAPON,"Reload");
else if ( invoker.clipcount < min(invoker.default.clipcount,invoker.Ammo1.Amount) ) A_WeaponReady(WRF_ALLOWRELOAD);
else A_WeaponReady();
@ -318,7 +327,8 @@ Class OLSMP : UnrealWeapon
AUTR A 0 A_JumpIf(invoker.clipcount>=min(invoker.default.clipcount,invoker.Ammo1.Amount),"Idle");
AUTR A 0
{
invoker.clipcount = Min(invoker.default.clipcount,invoker.Ammo1.Amount);
invoker.special1 = min(invoker.default.clipcount,invoker.Ammo1.Amount)-invoker.clipcount;
invoker.clipcount = -1;
A_Overlay(-9999,null);
A_WeaponOffset(0,32); // fix sudden psprite lowering
A_PlaySound("automag/click",CHAN_WEAPON,!Dampener.Active(self)?1.:.1,pitch:0.8);
@ -327,6 +337,9 @@ Class OLSMP : UnrealWeapon
AUTD ABCD 1;
AUTD E 30
{
invoker.clipcount = Min(invoker.default.clipcount,invoker.Ammo1.Amount);
invoker.Ammo1.Amount -= invoker.special1;
A_PlaySound("automag/reload",CHAN_WEAPON,!Dampener.Active(self)?1.:.1,pitch:0.8);
if ( self is 'UTPlayer' )
UTPlayer(self).PlayReloading();

View file

@ -81,9 +81,16 @@ Class QuadshotTracer : LineTracer
Class QuadShot : UnrealWeapon
{
int clipcount;
int ClipCount;
QuadshotTracer t;
property ClipCount : ClipCount;
override int, int, bool, bool GetClipAmount()
{
return ClipCount, -1, (ClipCount<2), false;
}
action void ProcessTraceHit( Linetracer t )
{
if ( t.Results.HitType == TRACE_HitActor )
@ -135,8 +142,8 @@ Class QuadShot : UnrealWeapon
{
Weapon weap = Weapon(invoker);
if ( !weap ) return;
if ( weap.Ammo1.Amount <= 0 ) return;
if ( bAlt && (invoker.clipcount > 2) )
if ( invoker.clipcount <= 0 ) return;
if ( bAlt && (invoker.clipcount <= 1) )
{
// fall back to normal fire strength
player.SetPSprite(PSP_WEAPON,invoker.FindState("Fire"));
@ -152,14 +159,14 @@ Class QuadShot : UnrealWeapon
if ( bAlt )
{
A_QuakeEx(1,1,1,6,0,1,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:0.12);
A_PlaySound("quadshot/alt",CHAN_WEAPON,!Dampener.Active(self)?1.:.2);
A_PlaySound("quadshot/alt",CHAN_7,!Dampener.Active(self)?1.:.2);
double spread = (4-invoker.clipcount);
for ( int i=invoker.clipcount; i<4; i++ )
double blend = invoker.clipcount/4.;
A_PlaySound("quadshot/alt",CHAN_WEAPON,(!Dampener.Active(self)?1.:.2)*blend);
A_PlaySound("quadshot/fire",CHAN_7,(!Dampener.Active(self)?1.:.2)*(1.-blend));
double spread = invoker.clipcount;
for ( int i=0; i<invoker.clipcount; i++ )
{
for ( int i=0; i<3; i++ )
UTMainHandler.DoSwing(self,(FRandom[Quadshot](-0.04,-0.2),FRandom[Quadshot](-0.2,0.2)),FRandom[Quadshot](2,4),FRandom[Quadshot](-0.2,0.5),Random[Quadshot](3,4),SWING_Spring,Random[Quadshot](1,6),FRandom[Quadshot](0.8,1.4));
weap.DepleteAmmo(weap.bAltFire,true,1);
for ( int i=0; i<10; i++ )
{
a = FRandom[Quadshot](0,360);
@ -172,16 +179,14 @@ Class QuadShot : UnrealWeapon
}
}
vel += (0,0,(0.3+0.3*spread))-x*(1.5+1.1*spread);
invoker.clipcount = 4;
invoker.clipcount = 0;
}
else
{
A_QuakeEx(1,1,1,4,0,1,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:0.12);
A_PlaySound("quadshot/fire",CHAN_WEAPON,!Dampener.Active(self)?1.:.2);
A_PlaySound("quadshot/fire",CHAN_7,!Dampener.Active(self)?1.:.2);
for ( int i=0; i<3; i++ )
UTMainHandler.DoSwing(self,(FRandom[Quadshot](-0.04,-0.2),FRandom[Quadshot](-0.2,0.2)),FRandom[Quadshot](2,3),FRandom[Quadshot](-0.2,0.5),Random[Quadshot](2,3),SWING_Spring,Random[Quadshot](0,3),FRandom[Quadshot](0.8,1.4));
weap.DepleteAmmo(weap.bAltFire,true,1);
for ( int i=0; i<10; i++ )
{
a = FRandom[Quadshot](0,360);
@ -193,7 +198,7 @@ Class QuadShot : UnrealWeapon
ProcessTraceHit(invoker.t);
}
vel += (0,0,0.3)-x*1.5;
invoker.clipcount++;
invoker.clipcount--;
}
if ( bAlt ) A_Overlay(-2,"MuzzleFlashAlt");
else A_Overlay(-2,"MuzzleFlash");
@ -218,7 +223,7 @@ Class QuadShot : UnrealWeapon
Vector3 x, y, z;
[x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll);
Vector3 origin = level.Vec3Offset(Vec2OffsetZ(0,0,player.viewz),-x*4-y*8-z*8);
for ( int i=0; i<4; i++ )
for ( int i=0; i<(4-invoker.clipcount); i++ )
{
let c = Spawn("QCasing",origin);
c.vel = x*FRandom[Junk](-1.5,0.25)-y*FRandom[Junk](1,4)-z*FRandom[Junk](1,4);
@ -227,7 +232,7 @@ Class QuadShot : UnrealWeapon
action bool A_QuadshotCheckForReload( bool bDryFire = false )
{
let weap = Weapon(invoker);
if ( invoker.clipcount > 3 )
if ( invoker.clipcount <= 0 )
{
if ( weap.Ammo1.Amount > 0 )
{
@ -242,6 +247,11 @@ Class QuadShot : UnrealWeapon
}
return false;
}
override bool CheckAmmo( int fireMode, bool autoSwitch, bool requireAmmo, int ammocount )
{
if ( ClipCount > 0 ) return true;
return Super.CheckAmmo(firemode,autoswitch,requireammo,ammocount);
}
Default
{
Tag "$T_QUADSHOT";
@ -257,6 +267,7 @@ Class QuadShot : UnrealWeapon
Weapon.AmmoGive 20;
Weapon.Kickback 320;
UTWeapon.DropAmmo 10;
QuadShot.ClipCount 4;
}
States
{
@ -278,7 +289,7 @@ Class QuadShot : UnrealWeapon
if ( !A_QuadshotCheckForReload() )
{
let weap = Weapon(invoker);
if ( (invoker.clipcount > 0) && (weap.Ammo1.Amount > 4-invoker.clipcount) )
if ( invoker.clipcount < min(weap.Ammo1.Amount,invoker.default.clipcount) )
A_WeaponReady(WRF_ALLOWRELOAD);
else A_WeaponReady();
}
@ -347,12 +358,28 @@ Class QuadShot : UnrealWeapon
UTPlayer(self).PlayAttacking3();
}
QUAR LMNOPQRSTU 1;
QUAR V 0 A_DropShells();
QUAR V 0
{
A_DropShells();
let weap = Weapon(invoker);
invoker.special1 = min(weap.Ammo1.Amount,invoker.default.clipcount);
invoker.special2 = invoker.special1-invoker.clipcount;
invoker.clipcount = -1;
}
QUAR VWXYZ[\] 1;
QUR2 ABCDEFGHIJKLMNOPQR 1;
QUR2 S 0
{
A_PlaySound("quadshot/load",CHAN_6,Dampener.Active(self)?.1:1.);
let weap = Weapon(invoker);
invoker.clipcount = 0;
if ( invoker.special1 > 0 )
{
weap.Ammo1.Amount -= min(2,invoker.special2);
invoker.clipcount += min(2,invoker.special1);
invoker.special1 = max(0,invoker.special1-2);
invoker.special2 = max(0,invoker.special2-2);
}
if ( self is 'UTPlayer' )
UTPlayer(self).PlayReloading();
}
@ -361,6 +388,14 @@ Class QuadShot : UnrealWeapon
QUR3 P 0
{
A_PlaySound("quadshot/load",CHAN_6,Dampener.Active(self)?.1:1.);
let weap = Weapon(invoker);
if ( invoker.special1 > 0 )
{
weap.Ammo1.Amount -= min(2,invoker.special2);
invoker.clipcount += min(2,invoker.special1);
invoker.special1 = max(0,invoker.special1-2);
invoker.special2 = max(0,invoker.special2-2);
}
if ( self is 'UTPlayer' )
UTPlayer(self).PlayReloading();
}
@ -372,11 +407,6 @@ Class QuadShot : UnrealWeapon
if ( self is 'UTPlayer' ) UTPlayer(self).PlayAttacking3();
}
QUR4 FGHIJKLMNOPQ 1;
QUAI A 0
{
let weap = Weapon(invoker);
invoker.clipcount = max(0,4-weap.Ammo1.Amount);
}
Goto Idle;
Deselect:
#### # 1 A_Overlay(-9999,"Null");

View file

@ -35,6 +35,10 @@ Class Stunner : UnrealWeapon
double chargesize, count;
bool bCharging;
override int, int, bool, bool GetClipAmount()
{
return bCharging?min(6,int(chargesize)):-1, -1, false, false;
}
action void A_StunnerFire()
{
Weapon weap = Weapon(invoker);

View file

@ -579,6 +579,10 @@ Class UBioRifle : UnrealWeapon
double chargesize, count;
bool bCharging;
override int, int, bool, bool GetClipAmount()
{
return bCharging?min(5,int(chargesize+0.1)):-1, -1, false, false;
}
action void A_BioFire( bool bAlt = false )
{
Weapon weap = Weapon(invoker);
@ -588,6 +592,7 @@ Class UBioRifle : UnrealWeapon
if ( weap.Ammo1.Amount <= 0 ) return;
if ( !weap.DepleteAmmo(weap.bAltFire,true,1) ) return;
}
invoker.bCharging = false;
invoker.chargesize = min(invoker.chargesize,4.9);
if ( bAlt ) A_PlaySound("ges/fire",CHAN_WEAPON,Dampener.Active(self)?.17:1.,pitch:max(.5,1.35-invoker.chargesize/8.));
else A_PlaySound("ges/fire",CHAN_WEAPON,Dampener.Active(self)?.17:1.);
@ -642,10 +647,7 @@ Class UBioRifle : UnrealWeapon
}
}
if ( !(player.cmd.buttons&BT_ALTATTACK) )
{
invoker.bCharging = false;
player.SetPSPrite(PSP_WEAPON,invoker.FindState("AltRelease"));
}
}
action void A_BeginCharge()
{

View file

@ -297,6 +297,10 @@ Class Eightball : UnrealWeapon
int locktics;
bool bSingleRocket;
override int, int, bool, bool GetClipAmount()
{
return special1?special1:-1, -1, false, false;
}
override void PostBeginPlay()
{
Super.PostBeginPlay();

View file

@ -761,6 +761,11 @@ Class UnrealWeapon : UTWeapon
{
origin.A_PlaySound(upsound,CHAN_WEAPON,Dampener.Active(origin)?.1:1.);
}
// For clips
virtual clearscope int, int, bool, bool GetClipAmount() const
{
return -1, -1, false, false;
}
}
Class UnrealStaticHandler : StaticEventHandler

View file

@ -41,7 +41,7 @@ Class UnrealHUD : BaseStatusBar
String OldArmor[6];
Class<Inventory> OldArmorType[6];
String OldKeys[7];
HUDFont mOldDigits;
HUDFont mOldDigits, mOldDigitsSmall;
Font OldLargeFont, OldSmallFont;
// Translations
@ -85,6 +85,7 @@ Class UnrealHUD : BaseStatusBar
KeyIcons[5] = TexMan.CheckForTexture("I_SkullY",TexMan.Type_Any);
KeyIcons[6] = TexMan.CheckForTexture("I_KeyG",TexMan.Type_Any);
mOldDigits = HUDFont.Create(Font.GetFont('U083Digits'),26,Mono_CellLeft);
mOldDigitsSmall = HUDFont.Create(Font.GetFont('U083DigitsSmall'),13,Mono_CellLeft);
mMapFont = HUDFont.Create(WhiteFont);
OldLargeFont = Font.GetFont('UOldLargeFont');
OldSmallFont = Font.GetFont('UOldSmallFont');
@ -448,12 +449,26 @@ Class UnrealHUD : BaseStatusBar
if ( !CPlayer.ReadyWeapon || !CPlayer.ReadyWeapon.Ammo1 ) return;
Font cfont = LargeFont;
if ( CPlayer.ReadyWeapon.Ammo1.Amount <= min(9,CPlayer.ReadyWeapon.Ammo1.MaxAmount/3) ) cfont = LargeRedFont;
int sec = -1, sec2 = -1;
bool red = false, red2 = false;
if ( CPlayer.ReadyWeapon is 'UnrealWeapon' )
[sec, sec2, red, red2] = UnrealWeapon(CPlayer.ReadyWeapon).GetClipAmount();
if ( !HudMode )
{
CurX -= cfont.StringWidth(String.Format("%d",CPlayer.ReadyWeapon.Ammo1.Amount))+2;
Screen.DrawText(cfont,Font.CR_UNTRANSLATED,CurX,CurY,String.Format("%d",CPlayer.ReadyWeapon.Ammo1.Amount),DTA_VirtualWidthF,ClipX,DTA_VirtualHeightF,ClipY,DTA_KeepRatio,true);
double bx = CurX;
CurX = bx-MedFont.StringWidth(String.Format("%d",sec))-2;
CurY += cfont.GetHeight()-MedFont.GetHeight()-4;
if ( sec != -1 )
Screen.DrawText(MedFont,red?Font.CR_RED:Font.CR_UNTRANSLATED,CurX,CurY,String.Format("%d",sec),DTA_VirtualWidthF,ClipX,DTA_VirtualHeightF,ClipY,DTA_KeepRatio,true);
CurX = bx-MedFont.StringWidth(String.Format("%d",sec2))-2;
CurY -= MedFont.GetHeight()+2;
if ( sec2 != -1 )
Screen.DrawText(MedFont,red2?Font.CR_RED:Font.CR_UNTRANSLATED,CurX,CurY,String.Format("%d",sec2),DTA_VirtualWidthF,ClipX,DTA_VirtualHeightF,ClipY,DTA_KeepRatio,true);
}
CurX = x;
CurY = y;
Screen.DrawTexture(IconBase,false,CurX,CurY,DTA_VirtualWidthF,ClipX,DTA_VirtualHeightF,ClipY,DTA_KeepRatio,true);
TextureID icon = CPlayer.ReadyWeapon.Icon.IsNull()?CPlayer.ReadyWeapon.Ammo1.Icon:CPlayer.ReadyWeapon.Icon;
// scale to fit
@ -469,7 +484,16 @@ Class UnrealHUD : BaseStatusBar
CurY = Y+29;
if ( (HudMode != 1) && (HudMode != 2) && (HudMode != 4) )
Screen.DrawTexture(HudLine,false,CurX,CurY,DTA_VirtualWidthF,ClipX,DTA_VirtualHeightF,ClipY,DTA_KeepRatio,true,DTA_WindowRightF,Min(28.*(CPlayer.ReadyWeapon.Ammo1.Amount/double(CPlayer.ReadyWeapon.Ammo1.MaxAmount)),28.));
// TODO secondary ammo display
if ( HudMode )
{
CurX = (x+30)-TinyFont.StringWidth(String.Format("%d",sec));
CurY = y+2;
if ( sec != -1 )
Screen.DrawText(red?TinyRedFont:TinyFont,Font.CR_UNTRANSLATED,CurX,CurY,String.Format("%d",sec),DTA_VirtualWidthF,ClipX,DTA_VirtualHeightF,ClipY,DTA_KeepRatio,true);
CurX = x+3;
if ( sec2 != -1 )
Screen.DrawText(red2?TinyRedFont:TinyFont,Font.CR_UNTRANSLATED,CurX,CurY,String.Format("%d",sec2),DTA_VirtualWidthF,ClipX,DTA_VirtualHeightF,ClipY,DTA_KeepRatio,true);
}
}
private void DrawHealth( double x, double y )
@ -660,6 +684,13 @@ Class UnrealHUD : BaseStatusBar
break;
}
}
int sec = -1, sec2 = -1;
if ( CPlayer.ReadyWeapon && (CPlayer.ReadyWeapon is 'UnrealWeapon') )
[sec, sec2] = UnrealWeapon(CPlayer.ReadyWeapon).GetClipAmount();
if ( sec != -1 )
DrawString(mOldDigitsSmall,FormatNumber(sec,3),(633,378),DI_TEXT_ALIGN_RIGHT);
if ( sec2 != -1 )
DrawString(mOldDigitsSmall,FormatNumber(sec2,3),(556,378),DI_TEXT_ALIGN_LEFT);
for ( int i=0; i<6; i++ )
{
if ( !CPlayer.mo.CheckKeys(i+1,false,true) ) continue;

View file

@ -9,7 +9,7 @@ Class UInvisibility : UnrealInventory
Inventory.Icon "I_Invis";
Inventory.PickupMessage "$I_INVISIBILITY";
Inventory.RespawnTics 3500;
Inventory.MaxAmount 2;
Inventory.MaxAmount 1;
UnrealInventory.Charge 100;
}
override bool Use( bool pickup )
@ -97,7 +97,7 @@ Class Amplifier : UnrealInventory
Inventory.Icon "I_Amp";
Inventory.PickupMessage "$I_AMPLIFIER";
Inventory.RespawnTics 3150;
Inventory.MaxAmount 2;
Inventory.MaxAmount 1;
UnrealInventory.Charge 1000;
}
static double GetMult( Actor Owner, int val )
@ -194,10 +194,10 @@ Class UJumpBoots : UnrealInventory
+COUNTITEM;
+INVENTORY.BIGPOWERUP;
+INVENTORY.ALWAYSPICKUP;
Inventory.MaxAmount 3;
Inventory.Icon "I_Boots";
Inventory.PickupMessage "$I_LBOOTS";
Inventory.RespawnTics 1050;
Inventory.MaxAmount 1;
UnrealInventory.Charge 3;
}
override bool Use( bool pickup )

View file

@ -55,6 +55,7 @@ Class UTranslocatorModule : Actor
return;
}
b = Spawn("ModuleHitbox",pos);
b.A_SetSize(6,6);
b.master = self;
anglevel = FRandom[TeleHand](3,5)*RandomPick[TeleHand](-1,1);
}