Separate Health/Armor flashes so they're non-cumulative.
Fine-tune the weapon bob so it's a bit smoother when moving around.
This commit is contained in:
parent
9c06e76acd
commit
ff1971b92c
3 changed files with 48 additions and 12 deletions
|
|
@ -1394,9 +1394,26 @@ Class SWWMHandler : EventHandler
|
|||
int lastitemcount[MAXPLAYERS];
|
||||
bool allkills, allitems, allsecrets;
|
||||
|
||||
// heal/armor flashes need to be handled here so they don't stack
|
||||
transient int hflash[MAXPLAYERS], aflash[MAXPLAYERS];
|
||||
|
||||
transient CVar mutevoice;
|
||||
transient ui CVar useshaders;
|
||||
|
||||
static void HealthFlash( int p )
|
||||
{
|
||||
let hnd = SWWMHandler(EventHandler.Find("SWWMHandler"));
|
||||
if ( !hnd || (p == -1) ) return;
|
||||
hnd.hflash[p] = gametic+5;
|
||||
}
|
||||
|
||||
static void ArmorFlash( int p )
|
||||
{
|
||||
let hnd = SWWMHandler(EventHandler.Find("SWWMHandler"));
|
||||
if ( !hnd || (p == -1) ) return;
|
||||
hnd.aflash[p] = gametic+5;
|
||||
}
|
||||
|
||||
static int AddOneliner( String type, int level, int delay = 5 )
|
||||
{
|
||||
let hnd = SWWMHandler(EventHandler.Find("SWWMHandler"));
|
||||
|
|
@ -2369,6 +2386,21 @@ Class SWWMHandler : EventHandler
|
|||
// stuff for hud
|
||||
override void RenderUnderlay( RenderEvent e )
|
||||
{
|
||||
// armor/health flashes
|
||||
int camplayer = players[consoleplayer].Camera.PlayerNumber();
|
||||
if ( camplayer != -1 )
|
||||
{
|
||||
if ( gametic < hflash[camplayer] )
|
||||
{
|
||||
double fstr = (hflash[camplayer]-(gametic+e.FracTic))/5.;
|
||||
Screen.Dim(Color(64,128,255),.1875*fstr,0,0,Screen.GetWidth(),Screen.GetHeight());
|
||||
}
|
||||
if ( gametic < aflash[camplayer] )
|
||||
{
|
||||
double fstr = (aflash[camplayer]-(gametic+e.FracTic))/5.;
|
||||
Screen.Dim(Color(96,255,64),.1875*fstr,0,0,Screen.GetWidth(),Screen.GetHeight());
|
||||
}
|
||||
}
|
||||
if ( !statusbar || !(statusbar is 'SWWMStatusBar') ) return;
|
||||
SWWMStatusBar(statusbar).viewpos = e.viewpos;
|
||||
SWWMStatusBar(statusbar).viewrot = (e.viewangle,e.viewpitch,e.viewroll);
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ Class SWWMSpareArmor : Inventory abstract
|
|||
{
|
||||
if ( pickup && ((Owner.player == players[consoleplayer]) || bBigPowerup) ) Owner.A_StartSound(UseSound,CHAN_ITEMEXTRA);
|
||||
Owner.GiveInventory(giveme,GetDefaultByType(giveme).Amount);
|
||||
SWWMHandler.DoFlash(Owner,Color(48,96,255,64),5);
|
||||
SWWMHandler.ArmorFlash(Owner.PlayerNumber());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
@ -149,7 +149,7 @@ Class SWWMHealth : Inventory abstract
|
|||
if ( pickup && !shouldautouse ) return false;
|
||||
if ( Owner.Health >= GetDefaultByType(giveme).MaxAmount ) return false;
|
||||
if ( pickup && ((Owner.player == players[consoleplayer]) || bBigPowerup) ) Owner.A_StartSound(UseSound,CHAN_ITEMEXTRA);
|
||||
SWWMHandler.DoFlash(Owner,Color(48,64,128,255),5);
|
||||
SWWMHandler.HealthFlash(Owner.PlayerNumber());
|
||||
Owner.GiveInventory(giveme,GetDefaultByType(giveme).Amount);
|
||||
SWWMScoreObj.Spawn(GetDefaultByType(giveme).Amount,Owner.Vec3Offset(FRandom[ScoreBits](-8,8),FRandom[ScoreBits](-8,8),FRandom[ScoreBits](-8,8)+Owner.Height/2),Font.CR_GREEN);
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -391,8 +391,12 @@ Class Demolitionist : PlayerPawn
|
|||
player.WeaponState |= WF_WEAPONBOBBING; // always bob
|
||||
Vector2 cur = Super.BobWeapon(ticfrac);
|
||||
if ( !oldbob ) player.WeaponState &= ~WF_WEAPONBOBBING;
|
||||
double diffang = (oldangle*(1.-ticfrac)+angle*ticfrac)-(oldlagangle*(1.-ticfrac)+lagangle*ticfrac);
|
||||
double diffpitch = (oldpitch*(1.-ticfrac)+pitch*ticfrac)-(oldlagpitch*(1.-ticfrac)+lagpitch*ticfrac);
|
||||
double fangle = oldangle*(1.-ticfrac)+angle*ticfrac;
|
||||
double fpitch = (oldpitch*(1.-ticfrac)+pitch*ticfrac);
|
||||
double flagangle = (oldlagangle*(1.-ticfrac)+lagangle*ticfrac);
|
||||
double flagpitch = (oldlagpitch*(1.-ticfrac)+lagpitch*ticfrac);
|
||||
double diffang = fangle-flagangle;
|
||||
double diffpitch = fpitch-flagpitch;
|
||||
if ( abs(diffang) > 1. )
|
||||
{
|
||||
int sgn = (diffang>0)?1:-1;
|
||||
|
|
@ -405,9 +409,9 @@ Class Demolitionist : PlayerPawn
|
|||
}
|
||||
cur.x += diffang;
|
||||
cur.y -= diffpitch;
|
||||
Vector3 diffvel = oldlagvel*(1.-ticfrac)+lagvel*ticfrac;
|
||||
double diffx = diffvel dot (cos(angle+90),sin(angle+90),0);
|
||||
double diffy = diffvel dot (0,0,1);
|
||||
Vector3 flagvel = oldlagvel*(1.-ticfrac)+lagvel*ticfrac;
|
||||
double diffx = flagvel dot (cos(flagangle+90),sin(flagangle+90),0);
|
||||
double diffy = flagvel dot (0,0,1);
|
||||
if ( abs(diffx) > 1. )
|
||||
{
|
||||
int sgn = (diffx>0)?1:-1;
|
||||
|
|
@ -427,17 +431,17 @@ Class Demolitionist : PlayerPawn
|
|||
oldangle = angle;
|
||||
oldpitch = pitch;
|
||||
Super.PlayerThink();
|
||||
oldlagangle = lagangle;
|
||||
oldlagpitch = lagpitch;
|
||||
lagangle = lagangle*.8+angle*.2;
|
||||
lagpitch = lagpitch*.8+pitch*.2;
|
||||
}
|
||||
override void Tick()
|
||||
{
|
||||
Super.Tick();
|
||||
if ( !player ) return;
|
||||
oldlagangle = lagangle;
|
||||
oldlagpitch = lagpitch;
|
||||
oldlagready = lagready;
|
||||
oldlagvel = lagvel;
|
||||
lagangle = lagangle*.8+angle*.2;
|
||||
lagpitch = lagpitch*.8+pitch*.2;
|
||||
oldlagready = lagready;
|
||||
if ( player.weaponstate&WF_WEAPONBOBBING ) lagready = lagready*.9+.1;
|
||||
else lagready = lagready*.4;
|
||||
lagvel = lagvel*.8+vel*.2;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue