From 5755ed1319b5a8389574174f7037e3402dfa8947 Mon Sep 17 00:00:00 2001 From: Marisa Kirisame Date: Sun, 7 Mar 2021 17:37:55 +0100 Subject: [PATCH] Smol things. --- language.version | 4 ++-- zscript/hud/swwm_hud.zsc | 17 +++++++++-------- zscript/weapons/swwm_baseweapon_melee.zsc | 13 +++++++++---- 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/language.version b/language.version index f2aaf561a..d0d43bb00 100644 --- a/language.version +++ b/language.version @@ -1,3 +1,3 @@ [default] -SWWM_MODVER="\chSWWM \czGZ\c- \cw0.9.11b-pre r329 \cu(Sun 7 Mar 13:51:24 CET 2021)\c-"; -SWWM_SHORTVER="\cw0.9.11b-pre r329 \cu(2021-03-07 13:51:24)\c-"; +SWWM_MODVER="\chSWWM \czGZ\c- \cw0.9.11b-pre r329 \cu(Sun 7 Mar 17:37:55 CET 2021)\c-"; +SWWM_SHORTVER="\cw0.9.11b-pre r329 \cu(2021-03-07 17:37:55)\c-"; diff --git a/zscript/hud/swwm_hud.zsc b/zscript/hud/swwm_hud.zsc index ba6576063..ef0bb37e4 100644 --- a/zscript/hud/swwm_hud.zsc +++ b/zscript/hud/swwm_hud.zsc @@ -1606,9 +1606,9 @@ Class SWWMStatusBar : BaseStatusBar } } - private void DrawInvIcon( Inventory i, double xx, double yy, double alpha = 1., bool forceamt = false, bool aspowerup = false ) + private bool DrawInvIcon( Inventory i, double xx, double yy, double alpha = 1., bool forceamt = false, bool aspowerup = false ) { - if ( !i || !i.Icon.IsValid() ) return; + if ( !i || !i.Icon.IsValid() ) return false; Vector2 scl = TexMan.GetScaledSize(i.Icon); double mscl = min(1.,30./max(scl.x,scl.y)); double dw = (ss.x/mscl), dh = (ss.y/mscl); @@ -1619,7 +1619,7 @@ Class SWWMStatusBar : BaseStatusBar String nstr = String.Format("%ds",Powerup(i).EffectTics/GameTicRate); int len = mTewiFont.mFont.StringWidth(nstr); Screen.DrawText(mTewiFont.mFont,Font.CR_FIRE,(xx+30)-len,(yy+30)-11,nstr,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,Powerup(i).IsBlinking()?alpha*.5:alpha); - return; + return true; } if ( (i is 'SWWMLamp') && aspowerup ) { @@ -1627,7 +1627,7 @@ Class SWWMStatusBar : BaseStatusBar String nstr = String.Format("%d%%",SWWMLamp(i).Charge); int len = mTewiFont.mFont.StringWidth(nstr); Screen.DrawText(mTewiFont.mFont,Font.CR_FIRE,(xx+30)-len,(yy+30)-11,nstr,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,SWWMLamp(i).isBlinking()?alpha*.5:alpha); - return; + return true; } Screen.DrawTexture(i.Icon,false,dx,dy,DTA_VirtualWidthF,dw,DTA_VirtualHeightF,dh,DTA_KeepRatio,true,DTA_Alpha,alpha,DTA_TopOffset,0,DTA_LeftOffset,0); if ( (i.Amount > 1) || forceamt ) @@ -1638,6 +1638,7 @@ Class SWWMStatusBar : BaseStatusBar int len = mTewiFont.mFont.StringWidth(nstr); Screen.DrawText(mTewiFont.mFont,Font.CR_FIRE,(xx+30)-len,(yy+30)-11,nstr,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,alpha); } + return true; } private void DrawInventory() @@ -1650,7 +1651,7 @@ Class SWWMStatusBar : BaseStatusBar for ( Inventory i=CPlayer.mo.Inv; i; i=i.Inv ) { if ( (i.Amount <= 0) || (!(i is 'SWWMArmor') && !(i is 'BasicArmor')) ) continue; - DrawInvIcon(i,xx,yy,forceamt:true); + if ( !DrawInvIcon(i,xx,yy,forceamt:true) ) continue; yy -= 34; drewarmor = true; } @@ -1666,8 +1667,8 @@ Class SWWMStatusBar : BaseStatusBar continue; } if ( !(i is 'Powerup') || (Powerup(i).EffectTics <= 0) || !(Powerup(i).Icon) ) continue; - DrawInvIcon(i,xx,yy); - yy -= 34; + if ( DrawInvIcon(i,xx,yy) ) + yy -= 34; } // inventory box / bar if ( !CPlayer.mo.InvSel ) return; @@ -1774,7 +1775,7 @@ Class SWWMStatusBar : BaseStatusBar // for SWWM weapons I made a function for this at least if ( (inv is 'SWWMWeapon') && SWWMWeapon(inv).ReportHUDAmmo() ) hasammo = true; - else if ( !(inv is 'SWWMWeapon') && ((!Weapon(inv).Ammo1 || (Weapon(inv).Ammo1.Amount > 0)) || (Weapon(inv).Ammo2 && (Weapon(inv).Ammo2.Amount > 0))) ) + else if ( !(inv is 'SWWMWeapon') && ((!Weapon(inv).Ammo1 || (Weapon(inv).Ammo1.Amount > 0) || Weapon(inv).bAMMO_OPTIONAL) || (Weapon(inv).Ammo2 && ((Weapon(inv).Ammo2.Amount > 0) || Weapon(inv).bALT_AMMO_OPTIONAL))) ) hasammo = true; } if ( !hasammo ) ncolor = Font.CR_RED; diff --git a/zscript/weapons/swwm_baseweapon_melee.zsc b/zscript/weapons/swwm_baseweapon_melee.zsc index e1aa84150..bf3256269 100644 --- a/zscript/weapons/swwm_baseweapon_melee.zsc +++ b/zscript/weapons/swwm_baseweapon_melee.zsc @@ -129,6 +129,8 @@ Class ParryField : Actor [x, y, z] = swwm_CoordUtil.GetAxes(master.pitch,master.angle,master.roll); origin = level.Vec3Offset(master.Vec2OffsetZ(0,0,master.player.viewz),x*20); SetOrigin(origin,false); + let raging = RagekitPower(master.FindInventory("RagekitPower")); + let s = Demolitionist(master).mystats; // check for projectiles to deflect let ti = ThinkerIterator.Create("Actor"); Actor a; @@ -152,13 +154,16 @@ Class ParryField : Actor a.target = master; } if ( a.bSKULLFLY ) a.bBLASTED = true; // blast lost souls - a.GiveInventory("ParriedBuff",1); let buff = a.FindInventory("ParriedBuff"); + if ( !buff ) + { + buff = Inventory(Spawn("ParriedBuff")); + buff.AttachToOwner(a); + } double mvel = a.vel.length(); double nspeed = min(100,mvel*FRandom[Parry](1.2,1.4)+20); a.angle = atan2(dir.y,dir.x); a.pitch = asin(-dir.z); - let raging = RagekitPower(master.FindInventory("RagekitPower")); if ( raging ) { buff.special1 = 2; @@ -174,7 +179,6 @@ Class ParryField : Actor i.bAMBUSH = true; A_QuakeEx(3,3,3,10,0,64,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:.2); A_StartSound("demolitionist/parry",CHAN_WEAPON); - let s = Demolitionist(master).mystats; if ( special1 >= special2 ) // perfect parry { // increased homing @@ -362,6 +366,8 @@ extend Class SWWMWeapon } action void A_Melee( int dmg = 40, String hitsound = "", double rangemul = 1. ) { + let raging = RagekitPower(FindInventory("RagekitPower")); + if ( raging ) rangemul += .2; Vector3 origin = Vec3Offset(0,0,player.viewheight); Vector3 dir = (cos(angle)*cos(pitch),sin(angle)*cos(pitch),sin(-pitch)); // check for usables @@ -390,7 +396,6 @@ extend Class SWWMWeapon invoker.wallponch = false; // check for shootables SWWMBulletTrail.DoTrail(self,origin,dir,DEFMELEERANGE*rangemul,0); - let raging = RagekitPower(FindInventory("RagekitPower")); int maxang = raging?18:12; for ( int i=0; i