From e4c93e892bf78311838f86512a9e57abeedd64f5 Mon Sep 17 00:00:00 2001 From: Marisa Kirisame Date: Fri, 20 Sep 2019 13:37:05 +0200 Subject: [PATCH] Adjustments and bugfixes. --- GunLore.md | 2 -- zscript/biggun.zsc | 2 ++ zscript/dispersionpistol.zsc | 37 +++++++++++++++++++----------------- zscript/impaler.zsc | 1 + zscript/stinger.zsc | 1 + zscript/unrealcommon.zsc | 7 +++---- zscript/unrealmenus.zsc | 12 ++++++++++++ 7 files changed, 39 insertions(+), 23 deletions(-) diff --git a/GunLore.md b/GunLore.md index 360459c..32c9db8 100644 --- a/GunLore.md +++ b/GunLore.md @@ -303,8 +303,6 @@ projectile. Secondary fire: A slowly charged fireball costing 20 units of napalm. Deals more splash damage. -Reload: Toggle between single shot and three-round burst fire for primary fire. - Like its predecessor, the Fireblaster is obviously completely useless when water is involved. A very clever human scientist would eventually solve this, but that's a story for another time (and mod). diff --git a/zscript/biggun.zsc b/zscript/biggun.zsc index ec96745..42cdc33 100644 --- a/zscript/biggun.zsc +++ b/zscript/biggun.zsc @@ -526,6 +526,7 @@ Class BigGun : UnrealWeapon invoker.clipcount = -1; A_QuakeEx(2,2,2,5,0,1,"",QF_RELATIVE|QF_SCALEDOWN,rollintensity:0.18); A_PlaySound("big/punch",CHAN_WEAPON,Dampener.Active(self)?.3:1.); + if ( self is 'UTPlayer' ) UTPlayer(self).PlayReloading(); } BIGR NOPQRSTUVWXYZ[\] 2; BIR2 ABCDEF 2; @@ -536,6 +537,7 @@ Class BigGun : UnrealWeapon invoker.Ammo1.Amount -= invoker.special1; A_QuakeEx(1,1,1,3,0,1,"",QF_RELATIVE|QF_SCALEDOWN,rollintensity:0.12); A_PlaySound("big/reload",CHAN_WEAPON,Dampener.Active(self)?.3:1.); + if ( self is 'UTPlayer' ) UTPlayer(self).PlayReloading(); } BIR2 HIJKL 2; BIR2 M 2 diff --git a/zscript/dispersionpistol.zsc b/zscript/dispersionpistol.zsc index 1080043..058205d 100644 --- a/zscript/dispersionpistol.zsc +++ b/zscript/dispersionpistol.zsc @@ -21,13 +21,8 @@ Class WeaponPowerUp : Inventory if ( dpis && (dpis.pendingupgrade < 4) ) { dpis.pendingupgrade++; - if ( toucher.player && (toucher.player.ReadyWeapon == dpis) && (toucher.player.PendingWeapon == WP_NOCHANGE) ) - { - let psp = toucher.player.FindPSprite(PSP_Weapon); - if ( toucher.player.WeaponState&WF_WEAPONREADY ) - psp.SetState(dpis.FindState("Upgrade")); - } - else ScriptUtil.SetWeapon(toucher,"DispersionPistol"); + if ( toucher.player && ((toucher.player.ReadyWeapon != dpis) || (player.PendingWeapon != WP_NOCHANGE)) ) + ScriptUtil.SetWeapon(toucher,"DispersionPistol"); } GoAwayAndDie(); return true; @@ -694,30 +689,38 @@ Class DispersionPistol : UnrealWeapon return ResolveState("Ready5"); } Ready1: - DPS1 ABCDEFGHIJK 2; - DPI1 A 5; + DPS1 ABCDEFGHIJK 2 A_WeaponReady(WRF_NOFIRE); + DPI1 A 5 A_WeaponReady(WRF_NOFIRE); Goto Idle; Ready2: - DPS2 ABCDEFGHIJK 2; - DPI2 A 5; + DPS2 ABCDEFGHIJK 2 A_WeaponReady(WRF_NOFIRE); + DPI2 A 5 A_WeaponReady(WRF_NOFIRE); Goto Idle; Ready3: - DPS3 ABCDEFGHIJK 2; - DPI3 A 5; + DPS3 ABCDEFGHIJK 2 A_WeaponReady(WRF_NOFIRE); + DPI3 A 5 A_WeaponReady(WRF_NOFIRE); Goto Idle; Ready4: - DPS4 ABCDEFGHIJK 2; - DPI4 A 5; + DPS4 ABCDEFGHIJK 2 A_WeaponReady(WRF_NOFIRE); + DPI4 A 5 A_WeaponReady(WRF_NOFIRE); Goto Idle; Ready5: - DPS5 ABCDEFGHIJK 2; - DPI5 A 5; + DPS5 ABCDEFGHIJK 2 A_WeaponReady(WRF_NOFIRE); + DPI5 A 5 A_WeaponReady(WRF_NOFIRE); Goto Idle; Dummy: TNT1 A 1 { A_CheckReload(); let weap = Weapon(invoker); + if ( weap && weap.Ammo1.Amount > 0 ) A_WeaponReady(); + else A_WeaponReady(WRF_NOFIRE); + } + TNT1 A 1 + { + A_CheckReload(); + let weap = Weapon(invoker); + // doing this on the first tic breaks the whole animation for some unexplainable reason if ( invoker.pendingupgrade > invoker.upgradelevel ) player.SetPSprite(PSP_WEAPON,ResolveState("Upgrade")); else if ( weap && weap.Ammo1.Amount > 0 ) A_WeaponReady(); diff --git a/zscript/impaler.zsc b/zscript/impaler.zsc index f816760..a68ec80 100644 --- a/zscript/impaler.zsc +++ b/zscript/impaler.zsc @@ -190,6 +190,7 @@ Class Impaler : UnrealWeapon A_Overlay(-2,"ZapDown"); A_PlaySound("impaler/gemdown",CHAN_WEAPON); } + if ( self is 'UTPlayer' ) UTPlayer(self).PlayReloading(); } IMPG ABCDE 2; Goto Idle; diff --git a/zscript/stinger.zsc b/zscript/stinger.zsc index 53abc0b..c5aff17 100644 --- a/zscript/stinger.zsc +++ b/zscript/stinger.zsc @@ -653,6 +653,7 @@ Class Stinger : UnrealWeapon invoker.flashnum = (invoker.flashnum+1)%4; } STNH BCDEFG 1; + STNH A 0 A_JumpIfNoAmmo(1); STNH A 0 A_Refire(); STNH A 2 A_PlaySound("stinger/release",CHAN_WEAPON,Dampener.Active(self)?.1:1.); Goto Idle; diff --git a/zscript/unrealcommon.zsc b/zscript/unrealcommon.zsc index 0d68008..02a7361 100644 --- a/zscript/unrealcommon.zsc +++ b/zscript/unrealcommon.zsc @@ -197,7 +197,7 @@ Class UPlayer : UTPlayer if ( dsp ) { dsp.Ammo1.MaxAmount = 90; - if ( player.ReadyWeapon == dsp ) + if ( (player.ReadyWeapon == dsp) && (player.PendingWeapon == WP_NOCHANGE) ) dsp.pendingupgrade = 4; else { @@ -261,8 +261,7 @@ Class UPlayer : UTPlayer if ( ((player.ReadyWeapon is 'URifle') && !sting_rifle && (player.buttons&BT_ALTATTACK)) || ((player.ReadyWeapon is 'Peacemaker') && player.buttons&BT_ALTATTACK) ) return; let psp = player.FindPSprite(PSP_WEAPON); - if ( ((player.ReadyWeapon is 'UBioRifle') && (player.buttons&BT_ALTATTACK)) - || (player.ReadyWeapon is 'Eightball') + if ( (player.ReadyWeapon is 'Eightball') || ((player.ReadyWeapon is 'DispersionPistol') && DispersionPistol(player.ReadyWeapon).bCharging) || ((player.ReadyWeapon is 'UBioRifle') && UBioRifle(player.ReadyWeapon).bCharging) || (player.ReadyWeapon is 'Razorjack') ) @@ -274,7 +273,7 @@ Class UPlayer : UTPlayer && psp.CurState.InStateSequence(player.ReadyWeapon.FindState("Hold"))) || (player.ReadyWeapon is 'UFlamethrower') || (player.ReadyWeapon is 'UMinigun') || ((player.ReadyWeapon is 'Bonesaw') && player.buttons&BT_ATTACK) - || ((player.ReadyWeapon is 'Impaler') && psp.CurState.InStateSequence(player.ReadyWeapon.FindState("AltHold"))) ) + || ((player.ReadyWeapon is 'Impaler') && player.buttons&BT_ALTATTACK) ) { if ( !InStateSequence(CurState,FindState("MissileRep")) ) SetStateLabel("MissileRep"); diff --git a/zscript/unrealmenus.zsc b/zscript/unrealmenus.zsc index 819f072..be4667e 100644 --- a/zscript/unrealmenus.zsc +++ b/zscript/unrealmenus.zsc @@ -65,6 +65,18 @@ Class ListMenuItemUnrealTextItem : ListMenuItemSelectable return max(1,fnt.StringWidth(StringTable.Localize(mText))); } + override bool CheckCoordinate( int x, int y ) + { + /*String str = StringTable.Localize(mText); + let fnt = (generic_ui||!mFont.CanPrint(str))?NewSmallFont:mFont; + int w = fnt.StringWidth(str); + int h = fnt.GetHeight(); + double basex = floor(0.5*(CleanWidth_1-w)); + double basey = floor(0.25*(CleanHeight_1-mSpacing*5)); + return (mEnabled && (x >= basex) && (x < basex+w) && (y >= basey) && (y < basey+h));*/ + return false; // since we can't change the main menu class, this won't work anyway + } + override void DrawSelector( double xofs, double yofs, TextureID tex ) { // nothing