From 225ffcc1e9f93907a94f137786a2113d03463672 Mon Sep 17 00:00:00 2001 From: Marisa Kirisame Date: Tue, 17 Sep 2019 02:47:13 +0200 Subject: [PATCH] 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. --- fontdefs.txt | 33 ++++++--- graphics/hud083/ammo/Smini083.png | Bin 2823 -> 2823 bytes graphics/hud083/ammo/Stun083.png | Bin 4124 -> 4124 bytes graphics/hud083/font/sEight083.png | Bin 0 -> 580 bytes graphics/hud083/font/sFive083.png | Bin 0 -> 569 bytes graphics/hud083/font/sFour083.png | Bin 0 -> 570 bytes graphics/hud083/font/sNine083.png | Bin 0 -> 579 bytes graphics/hud083/font/sOne083.png | Bin 0 -> 519 bytes graphics/hud083/font/sSeven083.png | Bin 0 -> 556 bytes graphics/hud083/font/sSix083.png | Bin 0 -> 581 bytes graphics/hud083/font/sThree083.png | Bin 0 -> 583 bytes graphics/hud083/font/sTwo083.png | Bin 0 -> 561 bytes graphics/hud083/font/sZero083.png | Bin 0 -> 581 bytes zscript/asmd.zsc | 5 ++ zscript/automag.zsc | 105 ++++++++++++++++++++--------- zscript/betamag.zsc | 18 +++-- zscript/dispersionpistol.zsc | 18 +++-- zscript/impaler.zsc | 81 ++++++++++++++-------- zscript/miscitems.zsc | 14 ++-- zscript/olsmp.zsc | 21 ++++-- zscript/quadshot.zsc | 72 ++++++++++++++------ zscript/stunner.zsc | 4 ++ zscript/ubiorifle.zsc | 8 ++- zscript/ueightball.zsc | 4 ++ zscript/unrealcommon.zsc | 5 ++ zscript/unrealhud.zsc | 35 +++++++++- zscript/upowerups.zsc | 6 +- zscript/utranslocator.zsc | 1 + 28 files changed, 307 insertions(+), 123 deletions(-) create mode 100644 graphics/hud083/font/sEight083.png create mode 100644 graphics/hud083/font/sFive083.png create mode 100644 graphics/hud083/font/sFour083.png create mode 100644 graphics/hud083/font/sNine083.png create mode 100644 graphics/hud083/font/sOne083.png create mode 100644 graphics/hud083/font/sSeven083.png create mode 100644 graphics/hud083/font/sSix083.png create mode 100644 graphics/hud083/font/sThree083.png create mode 100644 graphics/hud083/font/sTwo083.png create mode 100644 graphics/hud083/font/sZero083.png diff --git a/fontdefs.txt b/fontdefs.txt index 1973abc..868d227 100644 --- a/fontdefs.txt +++ b/fontdefs.txt @@ -1,13 +1,26 @@ U083Digits { - 0 Zero083 - 1 One083 - 2 Two083 - 3 Three083 - 4 Four083 - 5 Five083 - 6 Six083 - 7 Seven083 - 8 Eight083 - 9 Nine083 + 0 "graphics/hud083/font/Zero083.png" + 1 "graphics/hud083/font/One083.png" + 2 "graphics/hud083/font/Two083.png" + 3 "graphics/hud083/font/Three083.png" + 4 "graphics/hud083/font/Four083.png" + 5 "graphics/hud083/font/Five083.png" + 6 "graphics/hud083/font/Six083.png" + 7 "graphics/hud083/font/Seven083.png" + 8 "graphics/hud083/font/Eight083.png" + 9 "graphics/hud083/font/Nine083.png" +} +U083DigitsSmall +{ + 0 "graphics/hud083/font/sZero083.png" + 1 "graphics/hud083/font/sOne083.png" + 2 "graphics/hud083/font/sTwo083.png" + 3 "graphics/hud083/font/sThree083.png" + 4 "graphics/hud083/font/sFour083.png" + 5 "graphics/hud083/font/sFive083.png" + 6 "graphics/hud083/font/sSix083.png" + 7 "graphics/hud083/font/sSeven083.png" + 8 "graphics/hud083/font/sEight083.png" + 9 "graphics/hud083/font/sNine083.png" } diff --git a/graphics/hud083/ammo/Smini083.png b/graphics/hud083/ammo/Smini083.png index ef9a99944acb01f35d12d3c7d5dff037ba1ed884..46a6a5c726473794a20dd29e102ce5eb97102c7b 100644 GIT binary patch delta 20 ZcmZn{YZsfK!^r>wO?z_FHkw}I0suA{1=9ck delta 20 bcmZn{YZsfK!^zCRz`$@+Mts{w(@R_cGlT_m diff --git a/graphics/hud083/ammo/Stun083.png b/graphics/hud083/ammo/Stun083.png index 06d4784e54bd674a6d6d6fa266d7d6f9e113cd0c..2d2a88778befa3dc3387c17e44afa6e6d8cdc03f 100644 GIT binary patch delta 20 ZcmbQEFh^m64krT$H0{Yv+i3cn9{@Ve1}gvn delta 20 bcmbQEFh^m64kr@>0|Ud48auX)rqB5SIo<`- diff --git a/graphics/hud083/font/sEight083.png b/graphics/hud083/font/sEight083.png new file mode 100644 index 0000000000000000000000000000000000000000..ed15f5a53e8850c27e15a55f711c169434cc420f GIT binary patch literal 580 zcmeAS@N?(olHy`uVBq!ia0y~yU=RRd4rT@h1`S>QU4i#DpY-_(b@4gm^gkxY)SZSU6aiSeWRT=xFF@sA#AtD9A|2 zfD9Jk;o;%nU_myV;m@B7E2f;7({W%*&5n+OEe#nfDiY=tL`+Eu>4@>E32`Y2aLDkm zNN_NTurUZQ(eW|RaM4k5&`_{Ykugz_(2wEU9prQ{XTq$EG92q9MklBEp~`L?^{ZBgRD~z(&EtM8?5D z!bV5LLPNwrMLj&zcsIQgOlga!%W_ zOBc(p>E3Q!c1dtM=km(HmuBVa*=wIp(wEhnYQL9pGq=2NS7g|A1_lNOPgg&ebxsLQ E0PoSxkN^Mx literal 0 HcmV?d00001 diff --git a/graphics/hud083/font/sFive083.png b/graphics/hud083/font/sFive083.png new file mode 100644 index 0000000000000000000000000000000000000000..623c735c6fa04fd2f91ccb5405a00fcd7a85dd62 GIT binary patch literal 569 zcmeAS@N?(olHy`uVBq!ia0y~yU=RRd4rT@h1`S>QU;Rt-R|W-!J9q9}xpL*i zi4zA79N4mD%bGQ77A#mWWy+L}j*f4i#DpY-_(b@4gm^gkxY)SZSU6aiSeWRT=xFF@sA#AtD9A|2 zfD9Jk;o;%nU_myV;m@B7E2f;7({W%*&5n+OEe#nfDiY=tL`+Eu>4@>E32`Y2aLDkm zNN_NTurUZQ(eW|RaM4k5&`_{Ykugz_(2wEU9prQ{XTq$EG92q9MklBEp~`L?^{ZBgRD~z(&EtM8?5D z!bV5LLPNwrML%BdDwu5^}>GVB+aAFOUhUb?=DIaRCKxUGOWc)jc@k^Vvi_>&1>$;cs;= z6c$cDF;UsbN=&`-LH8ZcEj~TBHyy8(J722XQU4i#DpY-_(b@4gm^gkxY)SZSU6aiSeWRT=xFF@sA#AtD9A|2 zfD9Jk;o;%nU_myV;m@B7E2f;7({W%*&5n+OEe#nfDiY=tL`+Eu>4@>E32`Y2aLDkm zNN_NTurUZQ(eW|RaM4k5&`_{Ykugz_(2wEU9prQ{XTq$EG92q9MklBEp~`L?^{ZBgRD~z(&EtM8?5D z!bV5LLPNwrML9-Mp*G{B=ahW!Xc*Sx2S_ z&2@6=ooOG$_t2s6YLBx3%hY{y&a)(}h}aZ&sAO$`;2qZ#=Be2(t)_>zuk7BMxYlvY uRlQ?#x3SDW{{J@PJG=Y;zsFP@=WjQaU-SM4Qv(A71B0ilpUXO@geCxlM$SC| literal 0 HcmV?d00001 diff --git a/graphics/hud083/font/sNine083.png b/graphics/hud083/font/sNine083.png new file mode 100644 index 0000000000000000000000000000000000000000..51333dec6d00af664f97777b209e62ac6739a912 GIT binary patch literal 579 zcmeAS@N?(olHy`uVBq!ia0y~yU=RRd4rT@h1`S>QU4i#DpY-_(b@4gm^gkxY)SZSU6aiSeWRT=xFF@sA#AtD9A|2 zfD9Jk;o;%nU_myV;m@B7E2f;7({W%*&5n+OEe#nfDiY=tL`+Eu>4@>E32`Y2aLDkm zNN_NTurUZQ(eW|RaM4k5&`_{Ykugz_(2wEU9prQ{XTq$EG92q9MklBEp~`L?^{ZBgRD~z(&EtM8?5D z!bV5LLPNwrMLgPMzB^WD$us2mc&xg#_`jo|;A57!sR3S>r<~nzRI~Jmgi6gp;ldR% z8y?Iow$zf&n9tjA@u8zdxD20hU_$-+>yIVBr`zSr%Xn~TaY!>TFfe$!`njxgN@xNA Dc>2u3 literal 0 HcmV?d00001 diff --git a/graphics/hud083/font/sOne083.png b/graphics/hud083/font/sOne083.png new file mode 100644 index 0000000000000000000000000000000000000000..3b163551332ad826653dd479f12a526a6af7660c GIT binary patch literal 519 zcmeAS@N?(olHy`uVBq!ia0y~yU=RRd4rT@h1`S>QU4i#DpY-_(b@4gm^gkxY)SZSU6aiSeWRT=xFF@sA#AtD9A|2 zfD9Jk;o;%nU_myV;m@B7E2f;7({W%*&5n+OEe#nfDiY=tL`+Eu>4@>E32`Y2aLDkm zNN_NTurUZQ(eW|RaM4k5&`_{Ykugz_(2wEU9prQ{XTq$EG92q9MklBEp~`L?^{ZBgRD~z(&EtM8?5D z!bV5LLPNwrMLqDNz z)<;~8E{_*hr}Qgb`kR@5@lx>r+rKXa*)iX_v@WOlQQoU!#w%)iyBNw%6Z`dV^ro}C tNaOrcvh!1G7F!+TtrG<{f>ZC`_08pf_MrL0N(Kf722WQ%mvv4FO#t`HzJmY& literal 0 HcmV?d00001 diff --git a/graphics/hud083/font/sSeven083.png b/graphics/hud083/font/sSeven083.png new file mode 100644 index 0000000000000000000000000000000000000000..9ce40003da03b8eb4d8de80ebb2a9ba6dc085f89 GIT binary patch literal 556 zcmeAS@N?(olHy`uVBq!ia0y~yU=RRd4rT@h1`S>QU4i#DpY-_(b@4gm^gkxY)SZSU6aiSeWRT=xFF@sA#AtD9A|2 zfD9Jk;o;%nU_myV;m@B7E2f;7({W%*&5n+OEe#nfDiY=tL`+Eu>4@>E32`Y2aLDkm zNN_NTurUZQ(eW|RaM4k5&`_{Ykugz_(2wEU9prQ{XTq$EG92q9MklBEp~`L?^{ZBgRD~z(&EtM8?5D z!bV5LLPNwrML zdb&7|jg&CEB3VDChT54<;q@R#r4De%CYRKZ+uY8)JMBcH%%UIv_>xyj& eY1QU4i#DpY-_(b@4gm^gkxY)SZSU6aiSeWRT=xFF@sA#AtD9A|2 zfD9Jk;o;%nU_myV;m@B7E2f;7({W%*&5n+OEe#nfDiY=tL`+Eu>4@>E32`Y2aLDkm zNN_NTurUZQ(eW|RaM4k5&`_{Ykugz_(2wEU9prQ{XTq$EG92q9MklBEp~`L?^{ZBgRD~z(&EtM8?5D z!bV5LLPNwrMLQU4i#DpY-_(b@4gm^gkxY)SZSU6aiSeWRT=xFF@sA#AtD9A|2 zfD9Jk;o;%nU_myV;m@B7E2f;7({W%*&5n+OEe#nfDiY=tL`+Eu>4@>E32`Y2aLDkm zNN_NTurUZQ(eW|RaM4k5&`_{Ykugz_(2wEU9prQ{XTq$EG92q9MklBEp~`L?^{ZBgRD~z(&EtM8?5D z!bV5LLPNwrMLb`vAk!L_Vi_$u1cMy zlbjRotM;0tOm$|Rq3CuX)K63KrojR8oj!41fx52$zA*A}C|AV4x~<2+z`)??>gTe~ HDWM4fgv`+5 literal 0 HcmV?d00001 diff --git a/graphics/hud083/font/sTwo083.png b/graphics/hud083/font/sTwo083.png new file mode 100644 index 0000000000000000000000000000000000000000..3f70e090ffcc09e2367b8513dc1d3af21a412bbf GIT binary patch literal 561 zcmeAS@N?(olHy`uVBq!ia0y~yU=RRd4rT@h1`S>QU;Rt-R|W-!J9q9}xpL*i zi4zA79N4mD%bGQ77A#mWWy+L}j*f4i#DpY-_(b@4gm^gkxY)SZSU6aiSeWRT=xFF@sA#AtD9A|2 zfD9Jk;o;%nU_myV;m@B7E2f;7({W%*&5n+OEe#nfDiY=tL`+Eu>4@>E32`Y2aLDkm zNN_NTurUZQ(eW|RaM4k5&`_{Ykugz_(2wEU9prQ{XTq$EG92q9MklBEp~`L?^{ZBgRD~z(&EtM8?5D z!bV5LLPNwrML%Bdssn$<-l9UoSqn#onP%b3AzfzL{h!`Vl517-T$l~zu?v`y7# l(UQw?e=Urb{W=hTuj`$Z@g{>cb_@&*44$rjF6*2UngEeY&XxcG literal 0 HcmV?d00001 diff --git a/graphics/hud083/font/sZero083.png b/graphics/hud083/font/sZero083.png new file mode 100644 index 0000000000000000000000000000000000000000..a250b8d2b6e2ad401b20723873ce0b9ac98bfe5a GIT binary patch literal 581 zcmeAS@N?(olHy`uVBq!ia0y~yU=RRd4rT@h1`S>QU4i#DpY-_(b@4gm^gkxY)SZSU6aiSeWRT=xFF@sA#AtD9A|2 zfD9Jk;o;%nU_myV;m@B7E2f;7({W%*&5n+OEe#nfDiY=tL`+Eu>4@>E32`Y2aLDkm zNN_NTurUZQ(eW|RaM4k5&`_{Ykugz_(2wEU9prQ{XTq$EG92q9MklBEp~`L?^{ZBgRD~z(&EtM8?5D z!bV5LLPNwrMLiTw26z0ah=uhNYd|ht^gu=3!*@^5gI0)d<`) z;hOZhjP*JOZx=T*ol6g0`}cOR=$6-U_K&mP_|$)56}qg@o$g;O#K6G7;OXk;vd$@? F2>|L1&r<*Z literal 0 HcmV?d00001 diff --git a/zscript/asmd.zsc b/zscript/asmd.zsc index b82ed12..c378b85 100644 --- a/zscript/asmd.zsc +++ b/zscript/asmd.zsc @@ -310,6 +310,11 @@ Class ASMDHitbox : ShockHitbox } } } + Default + { + Radius 6; + Height 12; + } } Class ASMDBall : Actor diff --git a/zscript/automag.zsc b/zscript/automag.zsc index 38d5e82..bdf2770 100644 --- a/zscript/automag.zsc +++ b/zscript/automag.zsc @@ -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 diff --git a/zscript/betamag.zsc b/zscript/betamag.zsc index 68c62ac..04dbcd9 100644 --- a/zscript/betamag.zsc +++ b/zscript/betamag.zsc @@ -446,7 +446,7 @@ Class Betamag : UnrealWeapon LeftReloadHold: 2UTI A 0 { - if ( !(player.cmd.buttons&BT_RELOAD) ) return ResolveState("LeftIdle"); + if ( !((invoker.Ammo1.Amount<=0) && (player.cmd.buttons&(BT_ATTACK|BT_ALTATTACK))) && !(player.cmd.buttons&BT_RELOAD) ) return ResolveState("LeftIdle"); invoker.slavewhip = false; A_Overlay(-9998,null); UTMainHandler.DoSwing(self,(FRandom[Betamag](0.4,0.5),FRandom[Betamag](0.2,0.3)),4,0,8,SWING_Spring,5); @@ -468,7 +468,7 @@ Class Betamag : UnrealWeapon 2UTW N 0 A_BetamagWhip(); 2UTW NOPQR 1; 2UTW STUVWXYZ[\ 2; - 2UTI A 0 A_JumpIf(player.cmd.buttons&BT_RELOAD,"LeftReloadHold"); + 2UTI A 0 A_JumpIf((invoker.Ammo1.Amount<=0)&&(player.cmd.buttons&(BT_ATTACK|BT_ALTATTACK))||(player.cmd.buttons&BT_RELOAD),"LeftReloadHold"); Goto LeftIdle; Zoom: AUTR A 1 @@ -497,11 +497,17 @@ Class Betamag : UnrealWeapon 2UR2 ABCDEFGHIJK 1; Goto LeftIdle; 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 ABCDEFG 1; - AUTD G 1 A_Lower(int.max); + AUTD G 1 + { + if ( !player.FindPSprite(2) ) + A_Lower(int.max); + } Wait; LeftDeselect: 2UTD A 0 diff --git a/zscript/dispersionpistol.zsc b/zscript/dispersionpistol.zsc index d196804..1080043 100644 --- a/zscript/dispersionpistol.zsc +++ b/zscript/dispersionpistol.zsc @@ -479,6 +479,10 @@ Class DispersionPistol : UnrealWeapon bool bCharging; int MainUse, ChargeUse; + override int, int, bool, bool GetClipAmount() + { + return bCharging?min(5,int(chargesize+0.1)):-1, -1, false, false; + } override void Tick() { Super.Tick(); @@ -714,15 +718,15 @@ Class DispersionPistol : UnrealWeapon { A_CheckReload(); let weap = Weapon(invoker); - if ( weap && weap.Ammo1.Amount > 0 ) A_WeaponReady(); + if ( invoker.pendingupgrade > invoker.upgradelevel ) + player.SetPSprite(PSP_WEAPON,ResolveState("Upgrade")); + else if ( weap && weap.Ammo1.Amount > 0 ) A_WeaponReady(); else A_WeaponReady(WRF_NOFIRE); } Wait; Idle: #### # 0 { - if ( invoker.pendingupgrade > invoker.upgradelevel ) - return ResolveState("Upgrade"); A_Overlay(-9999,"Dummy"); if ( invoker.upgradelevel == 0 ) return ResolveState("Idle1"); else if ( invoker.upgradelevel == 1 ) return ResolveState("Idle2"); @@ -851,22 +855,22 @@ Class DispersionPistol : UnrealWeapon Upgrade1: #### # 0 A_PlaySound("dpistol/up1",CHAN_6,Dampener.Active(self)?.2:1.); DPU1 ABCD 9; - DPI2 A 4; + DPI2 A 4 A_JumpIf(invoker.pendingupgrade>invoker.upgradelevel,"Upgrade"); Goto Idle; Upgrade2: #### # 0 A_PlaySound("dpistol/up2",CHAN_6,Dampener.Active(self)?.2:1.); DPU2 ABCDEFGHI 9; - DPI3 A 4; + DPI3 A 4 A_JumpIf(invoker.pendingupgrade>invoker.upgradelevel,"Upgrade"); Goto Idle; Upgrade3: #### # 0 A_PlaySound("dpistol/up3",CHAN_6,Dampener.Active(self)?.2:1.); DPU3 ABCDEFGHI 9; - DPI4 A 4; + DPI4 A 4 A_JumpIf(invoker.pendingupgrade>invoker.upgradelevel,"Upgrade"); Goto Idle; Upgrade4: #### # 0 A_PlaySound("dpistol/up4",CHAN_6,Dampener.Active(self)?.2:1.); DPU4 ABCDEFGHI 9; - DPI5 A 4; + DPI5 A 4 A_JumpIf(invoker.pendingupgrade>invoker.upgradelevel,"Upgrade"); Goto Idle; Select: DPS1 A 1 A_Raise(int.max); diff --git a/zscript/impaler.zsc b/zscript/impaler.zsc index fa673f2..f816760 100644 --- a/zscript/impaler.zsc +++ b/zscript/impaler.zsc @@ -31,28 +31,49 @@ Class ImpalerAmmo2 : ImpalerAmmo } } -Class ImpalerCharge : Ammo -{ - Default - { - Inventory.Amount 100; - Inventory.MaxAmount 100; - Ammo.BackpackAmount 0; - Ammo.BackpackMaxAmount 100; - +INVENTORY.IGNORESKILL; - } -} - Class Impaler : UnrealWeapon { + int ClipCount; bool HasGem; + Actor beam; + property ClipCount : ClipCount; + + override int, int, bool, bool GetClipAmount() + { + return ClipCount, -1, (ClipCount<10), false; + } + action void A_ImpalerFire() + { + A_Overlay(-9999,"Null"); + A_Overlay(-3,"Null"); + A_Overlay(-2,"Null"); + A_PlaySound("impaler/fire",CHAN_WEAPON); + invoker.HasGem = false; + invoker.ClipCount = -1; + } + action void A_StartBeam() + { + } + action void A_DrainAmmo() + { + } + action void A_StopBeam() + { + } override void DoEffect() { Super.DoEffect(); if ( Owner.player.ReadyWeapon != self ) return; + if ( (Owner.waterlevel > 2) && !(level.maptime%5) ) + ClipCount = max(0,ClipCount-1); let psp = Owner.player.FindPSprite(-2); - if ( psp ) psp.alpha = clamp(Ammo2.Amount/double(Ammo2.MaxAmount),0.,1.); + if ( psp ) psp.alpha = clamp(ClipCount/double(default.ClipCount),0.,1.); + } + override bool CheckAmmo( int fireMode, bool autoSwitch, bool requireAmmo, int ammocount ) + { + if ( ClipCount > 0 ) return true; + return Super.CheckAmmo(firemode,autoswitch,requireammo,ammocount); } Default { @@ -64,13 +85,11 @@ Class Impaler : UnrealWeapon Weapon.SlotPriority 0.9; Weapon.AmmoType "ImpalerAmmo"; Weapon.AmmoUse 1; - Weapon.AmmoType2 "ImpalerCharge"; + Weapon.AmmoType2 "ImpalerAmmo"; Weapon.AmmoUse2 1; - Weapon.AmmoGive1 60; - Weapon.AmmoGive2 0; - UTWeapon.DropAmmo 30; - +WEAPON.AMMO_OPTIONAL; - +WEAPON.ALT_AMMO_OPTIONAL; + Weapon.AmmoGive 6; + UTWeapon.DropAmmo 3; + Impaler.ClipCount 30; } States { @@ -84,15 +103,21 @@ Class Impaler : UnrealWeapon Wait; Ready: IMPS ABCDEF 3 A_WeaponReady(WRF_NOFIRE); - IMPI A 0 A_JumpIfNoAmmo("Idle"); - Goto Reload; + IMPI A 0 + { + let weap = Weapon(invoker); + if ( (invoker.ClipCount>=0) || (weap.Ammo1.Amount > 0) ) + return ResolveState("Reload"); + return ResolveState("Idle"); + } + Goto Idle; Dummy: TNT1 A 1 { let weap = Weapon(invoker); int flags = 0; if ( weap.Ammo1.Amount > 0 ) flags |= WRF_ALLOWRELOAD; - if ( weap.Ammo2.Amount <= 0 ) flags |= WRF_NOSECONDARY; + if ( invoker.HasGem && (invoker.ClipCount <= 0) ) flags |= WRF_NOSECONDARY; A_WeaponReady(flags); } Wait; @@ -109,11 +134,7 @@ Class Impaler : UnrealWeapon { if ( !invoker.HasGem ) return ResolveState("Melee"); - A_Overlay(-9999,"Null"); - A_Overlay(-3,"Null"); - A_Overlay(-2,"Null"); - A_PlaySound("impaler/fire",CHAN_WEAPON); - invoker.HasGem = false; + A_ImpalerFire(); return ResolveState(null); } IMPF ABCDEFGHI 2; @@ -151,6 +172,12 @@ Class Impaler : UnrealWeapon invoker.HasGem = !invoker.HasGem; if ( invoker.HasGem ) { + let weap = Weapon(invoker); + if ( invoker.ClipCount < 0 ) + { + weap.DepleteAmmo(false,true,1); + invoker.ClipCount = invoker.default.ClipCount; + } A_Overlay(-3,"GemUp"); A_Overlay(-2,"ZapUp"); A_OverlayFlags(-2,PSPF_RenderStyle|PSPF_Alpha,true); diff --git a/zscript/miscitems.zsc b/zscript/miscitems.zsc index 3abe7a6..05ed3c8 100644 --- a/zscript/miscitems.zsc +++ b/zscript/miscitems.zsc @@ -266,7 +266,7 @@ Class VoiceBox : UnrealInventory Tag "$T_VOICEBOX"; Inventory.PickupMessage "$I_VOICEBOX"; Inventory.Icon "I_VoiceB"; - Inventory.MaxAmount 3; + Inventory.MaxAmount 2; UnrealInventory.Charge 600; } override void DoEffect() @@ -1117,7 +1117,7 @@ Class Forcefield : UnrealInventory Tag "$T_FORCEFIELD"; Inventory.PickupMessage "$I_FORCEFIELD"; Inventory.Icon "I_ForceF"; - Inventory.MaxAmount 5; + Inventory.MaxAmount 3; } override bool Use( bool pickup ) { @@ -2082,8 +2082,8 @@ Class MinigunSentryBase : Actor Tag "$T_SENTRY"; Health sentryhealth; Mass int.max; - Radius 12; - Height 48; + Radius 8; + Height 46; +SOLID; +SHOOTABLE; +NOBLOOD; @@ -2245,7 +2245,7 @@ Class SentryGunItem : UnrealInventory { Tag "$T_OSENTRY"; Inventory.Icon "I_OSntry"; - Inventory.MaxAmount 3; + Inventory.MaxAmount 2; Inventory.PickupMessage "$I_OSENTRY"; Inventory.RespawnTics 1050; } @@ -2363,8 +2363,8 @@ Class SentryGun : Actor Tag "$T_OSENTRY"; Health 50; Mass int.max; - Radius 10; - Height 24; + Radius 6; + Height 18; +SOLID; +SHOOTABLE; +NOBLOOD; diff --git a/zscript/olsmp.zsc b/zscript/olsmp.zsc index 42a41e0..ffe692e 100644 --- a/zscript/olsmp.zsc +++ b/zscript/olsmp.zsc @@ -68,6 +68,10 @@ Class OLSMP : UnrealWeapon property ClipCount : ClipCount; + override int, int, bool, bool GetClipAmount() + { + return ClipCount, -1, (ClipCount<35), false; + } override void PlayUpSound( Actor origin ) { origin.A_PlaySound(upsound,CHAN_WEAPON,Dampener.Active(origin)?.1:1.,pitch:0.8); @@ -119,7 +123,7 @@ Class OLSMP : UnrealWeapon if ( !weap || !player ) return; if ( invoker.altaccuracy < 0.2 ) invoker.altaccuracy += 0.01; if ( invoker.clipcount < 35 ) A_PlaySound("automag/click",CHAN_ITEM,!Dampener.Active(self)?1.:.35,pitch:1.6); - if ( (invoker.clipcount <= 0) || (weap.Ammo1.Amount <= 0) ) + if ( invoker.clipcount <= 0 ) { A_ClearRefire(); return; @@ -130,8 +134,7 @@ Class OLSMP : UnrealWeapon { Weapon weap = Weapon(invoker); if ( !weap ) return; - if ( weap.Ammo1.Amount <= 0 ) return; - if ( !weap.DepleteAmmo(weap.bAltFire,true,1) ) return; + if ( invoker.clipcount <= 0 ) return; invoker.clipcount--; invoker.FireEffect(); UTMainHandler.DoFlash(self,Color(32,255,128,0),1); @@ -214,6 +217,11 @@ Class OLSMP : UnrealWeapon let c = Spawn("UCasing",origin); c.vel = x*FRandom[Junk](-1.5,1.5)+y*FRandom[Junk](2,4)+z*FRandom[Junk](2,3); } + 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_OLSMP"; @@ -254,6 +262,7 @@ Class OLSMP : UnrealWeapon Dummy: TNT1 A 1 { + A_CheckReload(); if ( (invoker.clipcount <= 0) && (invoker.Ammo1.Amount > 0) ) A_Overlay(PSP_WEAPON,"Reload"); else if ( invoker.clipcount < min(invoker.default.clipcount,invoker.Ammo1.Amount) ) A_WeaponReady(WRF_ALLOWRELOAD); else A_WeaponReady(); @@ -318,7 +327,8 @@ Class OLSMP : UnrealWeapon AUTR A 0 A_JumpIf(invoker.clipcount>=min(invoker.default.clipcount,invoker.Ammo1.Amount),"Idle"); AUTR A 0 { - invoker.clipcount = Min(invoker.default.clipcount,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,pitch:0.8); @@ -327,6 +337,9 @@ Class OLSMP : UnrealWeapon 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,pitch:0.8); if ( self is 'UTPlayer' ) UTPlayer(self).PlayReloading(); diff --git a/zscript/quadshot.zsc b/zscript/quadshot.zsc index aea3734..7e8c104 100644 --- a/zscript/quadshot.zsc +++ b/zscript/quadshot.zsc @@ -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 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"); diff --git a/zscript/stunner.zsc b/zscript/stunner.zsc index 19ef1c1..174caf3 100644 --- a/zscript/stunner.zsc +++ b/zscript/stunner.zsc @@ -35,6 +35,10 @@ Class Stunner : UnrealWeapon double chargesize, count; bool bCharging; + override int, int, bool, bool GetClipAmount() + { + return bCharging?min(6,int(chargesize)):-1, -1, false, false; + } action void A_StunnerFire() { Weapon weap = Weapon(invoker); diff --git a/zscript/ubiorifle.zsc b/zscript/ubiorifle.zsc index b2b5f44..fd97727 100644 --- a/zscript/ubiorifle.zsc +++ b/zscript/ubiorifle.zsc @@ -579,6 +579,10 @@ Class UBioRifle : UnrealWeapon double chargesize, count; bool bCharging; + override int, int, bool, bool GetClipAmount() + { + return bCharging?min(5,int(chargesize+0.1)):-1, -1, false, false; + } action void A_BioFire( bool bAlt = false ) { Weapon weap = Weapon(invoker); @@ -588,6 +592,7 @@ Class UBioRifle : UnrealWeapon if ( weap.Ammo1.Amount <= 0 ) return; if ( !weap.DepleteAmmo(weap.bAltFire,true,1) ) return; } + invoker.bCharging = false; invoker.chargesize = min(invoker.chargesize,4.9); if ( bAlt ) A_PlaySound("ges/fire",CHAN_WEAPON,Dampener.Active(self)?.17:1.,pitch:max(.5,1.35-invoker.chargesize/8.)); else A_PlaySound("ges/fire",CHAN_WEAPON,Dampener.Active(self)?.17:1.); @@ -642,10 +647,7 @@ Class UBioRifle : UnrealWeapon } } if ( !(player.cmd.buttons&BT_ALTATTACK) ) - { - invoker.bCharging = false; player.SetPSPrite(PSP_WEAPON,invoker.FindState("AltRelease")); - } } action void A_BeginCharge() { diff --git a/zscript/ueightball.zsc b/zscript/ueightball.zsc index 32daa05..fbfe0b9 100644 --- a/zscript/ueightball.zsc +++ b/zscript/ueightball.zsc @@ -297,6 +297,10 @@ Class Eightball : UnrealWeapon int locktics; bool bSingleRocket; + override int, int, bool, bool GetClipAmount() + { + return special1?special1:-1, -1, false, false; + } override void PostBeginPlay() { Super.PostBeginPlay(); diff --git a/zscript/unrealcommon.zsc b/zscript/unrealcommon.zsc index da202a2..cd7fb3b 100644 --- a/zscript/unrealcommon.zsc +++ b/zscript/unrealcommon.zsc @@ -761,6 +761,11 @@ Class UnrealWeapon : UTWeapon { origin.A_PlaySound(upsound,CHAN_WEAPON,Dampener.Active(origin)?.1:1.); } + // For clips + virtual clearscope int, int, bool, bool GetClipAmount() const + { + return -1, -1, false, false; + } } Class UnrealStaticHandler : StaticEventHandler diff --git a/zscript/unrealhud.zsc b/zscript/unrealhud.zsc index 5ea3a8a..2b3aa8b 100644 --- a/zscript/unrealhud.zsc +++ b/zscript/unrealhud.zsc @@ -41,7 +41,7 @@ Class UnrealHUD : BaseStatusBar String OldArmor[6]; Class OldArmorType[6]; String OldKeys[7]; - HUDFont mOldDigits; + HUDFont mOldDigits, mOldDigitsSmall; Font OldLargeFont, OldSmallFont; // Translations @@ -85,6 +85,7 @@ Class UnrealHUD : BaseStatusBar KeyIcons[5] = TexMan.CheckForTexture("I_SkullY",TexMan.Type_Any); KeyIcons[6] = TexMan.CheckForTexture("I_KeyG",TexMan.Type_Any); mOldDigits = HUDFont.Create(Font.GetFont('U083Digits'),26,Mono_CellLeft); + mOldDigitsSmall = HUDFont.Create(Font.GetFont('U083DigitsSmall'),13,Mono_CellLeft); mMapFont = HUDFont.Create(WhiteFont); OldLargeFont = Font.GetFont('UOldLargeFont'); OldSmallFont = Font.GetFont('UOldSmallFont'); @@ -448,12 +449,26 @@ Class UnrealHUD : BaseStatusBar if ( !CPlayer.ReadyWeapon || !CPlayer.ReadyWeapon.Ammo1 ) return; Font cfont = LargeFont; if ( CPlayer.ReadyWeapon.Ammo1.Amount <= min(9,CPlayer.ReadyWeapon.Ammo1.MaxAmount/3) ) cfont = LargeRedFont; + int sec = -1, sec2 = -1; + bool red = false, red2 = false; + if ( CPlayer.ReadyWeapon is 'UnrealWeapon' ) + [sec, sec2, red, red2] = UnrealWeapon(CPlayer.ReadyWeapon).GetClipAmount(); if ( !HudMode ) { CurX -= cfont.StringWidth(String.Format("%d",CPlayer.ReadyWeapon.Ammo1.Amount))+2; Screen.DrawText(cfont,Font.CR_UNTRANSLATED,CurX,CurY,String.Format("%d",CPlayer.ReadyWeapon.Ammo1.Amount),DTA_VirtualWidthF,ClipX,DTA_VirtualHeightF,ClipY,DTA_KeepRatio,true); + double bx = CurX; + CurX = bx-MedFont.StringWidth(String.Format("%d",sec))-2; + CurY += cfont.GetHeight()-MedFont.GetHeight()-4; + if ( sec != -1 ) + Screen.DrawText(MedFont,red?Font.CR_RED:Font.CR_UNTRANSLATED,CurX,CurY,String.Format("%d",sec),DTA_VirtualWidthF,ClipX,DTA_VirtualHeightF,ClipY,DTA_KeepRatio,true); + CurX = bx-MedFont.StringWidth(String.Format("%d",sec2))-2; + CurY -= MedFont.GetHeight()+2; + if ( sec2 != -1 ) + Screen.DrawText(MedFont,red2?Font.CR_RED:Font.CR_UNTRANSLATED,CurX,CurY,String.Format("%d",sec2),DTA_VirtualWidthF,ClipX,DTA_VirtualHeightF,ClipY,DTA_KeepRatio,true); } CurX = x; + CurY = y; Screen.DrawTexture(IconBase,false,CurX,CurY,DTA_VirtualWidthF,ClipX,DTA_VirtualHeightF,ClipY,DTA_KeepRatio,true); TextureID icon = CPlayer.ReadyWeapon.Icon.IsNull()?CPlayer.ReadyWeapon.Ammo1.Icon:CPlayer.ReadyWeapon.Icon; // scale to fit @@ -469,7 +484,16 @@ Class UnrealHUD : BaseStatusBar CurY = Y+29; if ( (HudMode != 1) && (HudMode != 2) && (HudMode != 4) ) Screen.DrawTexture(HudLine,false,CurX,CurY,DTA_VirtualWidthF,ClipX,DTA_VirtualHeightF,ClipY,DTA_KeepRatio,true,DTA_WindowRightF,Min(28.*(CPlayer.ReadyWeapon.Ammo1.Amount/double(CPlayer.ReadyWeapon.Ammo1.MaxAmount)),28.)); - // TODO secondary ammo display + if ( HudMode ) + { + CurX = (x+30)-TinyFont.StringWidth(String.Format("%d",sec)); + CurY = y+2; + if ( sec != -1 ) + Screen.DrawText(red?TinyRedFont:TinyFont,Font.CR_UNTRANSLATED,CurX,CurY,String.Format("%d",sec),DTA_VirtualWidthF,ClipX,DTA_VirtualHeightF,ClipY,DTA_KeepRatio,true); + CurX = x+3; + if ( sec2 != -1 ) + Screen.DrawText(red2?TinyRedFont:TinyFont,Font.CR_UNTRANSLATED,CurX,CurY,String.Format("%d",sec2),DTA_VirtualWidthF,ClipX,DTA_VirtualHeightF,ClipY,DTA_KeepRatio,true); + } } private void DrawHealth( double x, double y ) @@ -660,6 +684,13 @@ Class UnrealHUD : BaseStatusBar break; } } + int sec = -1, sec2 = -1; + if ( CPlayer.ReadyWeapon && (CPlayer.ReadyWeapon is 'UnrealWeapon') ) + [sec, sec2] = UnrealWeapon(CPlayer.ReadyWeapon).GetClipAmount(); + if ( sec != -1 ) + DrawString(mOldDigitsSmall,FormatNumber(sec,3),(633,378),DI_TEXT_ALIGN_RIGHT); + if ( sec2 != -1 ) + DrawString(mOldDigitsSmall,FormatNumber(sec2,3),(556,378),DI_TEXT_ALIGN_LEFT); for ( int i=0; i<6; i++ ) { if ( !CPlayer.mo.CheckKeys(i+1,false,true) ) continue; diff --git a/zscript/upowerups.zsc b/zscript/upowerups.zsc index b1f14a7..54ba53b 100644 --- a/zscript/upowerups.zsc +++ b/zscript/upowerups.zsc @@ -9,7 +9,7 @@ Class UInvisibility : UnrealInventory Inventory.Icon "I_Invis"; Inventory.PickupMessage "$I_INVISIBILITY"; Inventory.RespawnTics 3500; - Inventory.MaxAmount 2; + Inventory.MaxAmount 1; UnrealInventory.Charge 100; } override bool Use( bool pickup ) @@ -97,7 +97,7 @@ Class Amplifier : UnrealInventory Inventory.Icon "I_Amp"; Inventory.PickupMessage "$I_AMPLIFIER"; Inventory.RespawnTics 3150; - Inventory.MaxAmount 2; + Inventory.MaxAmount 1; UnrealInventory.Charge 1000; } static double GetMult( Actor Owner, int val ) @@ -194,10 +194,10 @@ Class UJumpBoots : UnrealInventory +COUNTITEM; +INVENTORY.BIGPOWERUP; +INVENTORY.ALWAYSPICKUP; - Inventory.MaxAmount 3; Inventory.Icon "I_Boots"; Inventory.PickupMessage "$I_LBOOTS"; Inventory.RespawnTics 1050; + Inventory.MaxAmount 1; UnrealInventory.Charge 3; } override bool Use( bool pickup ) diff --git a/zscript/utranslocator.zsc b/zscript/utranslocator.zsc index 7d27cd5..23a5a82 100644 --- a/zscript/utranslocator.zsc +++ b/zscript/utranslocator.zsc @@ -55,6 +55,7 @@ Class UTranslocatorModule : Actor return; } b = Spawn("ModuleHitbox",pos); + b.A_SetSize(6,6); b.master = self; anglevel = FRandom[TeleHand](3,5)*RandomPick[TeleHand](-1,1); }