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:
parent
fae4f6d50b
commit
225ffcc1e9
28 changed files with 307 additions and 123 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue