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

@ -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");