Made visual recoil toggleable (and with configurable strength, too).

Cleaned up some code (mostly related to server CVars).
Proper angle interpolation.
Snap player to floor when walking down steps like UE does (looks kinda twitchy due to lack of view height smoothing).
This commit is contained in:
Marisa the Magician 2018-09-24 15:00:02 +02:00
commit 957f976b29
14 changed files with 80 additions and 75 deletions

View file

@ -101,6 +101,7 @@ Class UTCasing : Actor
+MOVEWITHSECTOR;
+THRUACTORS;
+USEBOUNCESTATE;
+INTERPOLATEANGLES;
BounceType "Doom";
BounceFactor 0.65;
BounceSound "bullet/casing";
@ -133,8 +134,8 @@ Class UTCasing : Actor
Spawn:
PCAS A 1
{
A_SetAngle(angle+anglevel,SPF_INTERPOLATE);
A_SetPitch(pitch+pitchvel,SPF_INTERPOLATE);
angle += anglevel;
pitch += pitchvel;
}
Loop;
Bounce:
@ -148,8 +149,8 @@ Class UTCasing : Actor
Death:
PCAS A -1
{
A_SetPitch(0);
A_SetRoll(FRandom[Junk](0,360));
pitch = 0;
roll = FRandom[Junk](0,360);
}
Stop;
}
@ -166,7 +167,7 @@ Class Enforcer : UTWeapon
override void PostRender( double lbottom )
{
if ( !CVar.GetCVar('flak_enforcerreload').GetBool() ) return;
if ( !flak_enforcerreload ) return;
if ( Amount > 1 ) Screen.DrawText(confont,Font.CR_GREEN,Screen.GetWidth()*0.01,lbottom-Screen.GetHeight()*0.01-confont.GetHeight()*2,String.Format("L Clip: %2d / 20\nR Clip: %2d / 20",slaveclipcount,clipcount));
else Screen.DrawText(confont,Font.CR_GREEN,Screen.GetWidth()*0.01,lbottom-Screen.GetHeight()*0.01-confont.GetHeight(),String.Format("Clip: %2d / 20",clipcount));
}
@ -209,7 +210,7 @@ Class Enforcer : UTWeapon
if ( !weap || !player ) return;
if ( slave )
{
if ( CVar.GetCVar('flak_enforcerreload').GetBool() && (invoker.slaveclipcount < 5) ) A_PlaySound("enforcer/click",CHAN_6);
if ( flak_enforcerreload && (invoker.slaveclipcount < 5) ) A_PlaySound("enforcer/click",CHAN_6);
if ( (invoker.slaveclipcount <= 0) || (weap.Ammo1.Amount <= 0) )
{
invoker.slaverefire = 0;
@ -236,7 +237,7 @@ Class Enforcer : UTWeapon
}
else
{
if ( CVar.GetCVar('flak_enforcerreload').GetBool() && (invoker.clipcount < 5) ) A_PlaySound("enforcer/click",CHAN_WEAPON);
if ( flak_enforcerreload && (invoker.clipcount < 5) ) A_PlaySound("enforcer/click",CHAN_WEAPON);
if ( (invoker.clipcount <= 0) || (weap.Ammo1.Amount <= 0) )
{
A_ClearRefire();
@ -273,12 +274,12 @@ Class Enforcer : UTWeapon
if ( slave )
{
invoker.slaveclipcount--;
if ( !CVar.GetCVar('flak_enforcerreload').GetBool() && (invoker.slaveclipcount <=0) ) invoker.slaveclipcount = (weap.Ammo1.Amount>0)?Min(20,weap.Ammo1.Amount):20;
if ( !flak_enforcerreload && (invoker.slaveclipcount <=0) ) invoker.slaveclipcount = (weap.Ammo1.Amount>0)?Min(20,weap.Ammo1.Amount):20;
}
else
{
invoker.clipcount--;
if ( !CVar.GetCVar('flak_enforcerreload').GetBool() && (invoker.clipcount <=0) ) invoker.clipcount = (weap.Ammo1.Amount>0)?Min(20,weap.Ammo1.Amount):20;
if ( !flak_enforcerreload && (invoker.clipcount <=0) ) invoker.clipcount = (weap.Ammo1.Amount>0)?Min(20,weap.Ammo1.Amount):20;
}
invoker.FireEffect();
UTMainHandler.DoFlash(self,Color(32,255,128,0),1);
@ -441,7 +442,7 @@ Class Enforcer : UTWeapon
TNT1 A 1
{
if ( (invoker.clipcount <= 0) && (invoker.Ammo1.Amount > 0) ) A_Overlay(PSP_WEAPON,"Reload");
else if ( CVar.GetCVar('flak_enforcerreload').GetBool() && ((invoker.clipcount < min(20,invoker.Ammo1.Amount)) || (invoker.slaveclipcount < min(20,invoker.Ammo1.Amount))) ) A_WeaponReady(WRF_ALLOWRELOAD);
else if ( flak_enforcerreload && ((invoker.clipcount < min(20,invoker.Ammo1.Amount)) || (invoker.slaveclipcount < min(20,invoker.Ammo1.Amount))) ) A_WeaponReady(WRF_ALLOWRELOAD);
else A_WeaponReady();
if ( !invoker.slaveactive && (CountInv("Enforcer") > 1) ) A_Overlay(2,"LeftReady");
}
@ -454,7 +455,7 @@ Class Enforcer : UTWeapon
invoker.slaveactive = false;
A_Overlay(2,"LeftDeselect");
}
else if ( CVar.GetCVar('flak_enforcerreload').GetBool() && (invoker.slavereload || (invoker.slaveclipcount < 0)) ) A_Overlay(2,"LeftReload");
else if ( flak_enforcerreload && (invoker.slavereload || (invoker.slaveclipcount < 0)) ) A_Overlay(2,"LeftReload");
else if ( invoker.slavedown ) A_Overlay(2,"LeftDeselect");
else A_LeftWeaponReady();
}