From aa74075e3f0a3202f5508a93afa689b54ee7505b Mon Sep 17 00:00:00 2001 From: jgk Date: Tue, 9 Mar 2021 01:36:30 +0100 Subject: [PATCH] Fix weapon scroll bug --- src/Dodge/Rendering.hs | 2 +- src/Dodge/Weapons.hs | 19 ++++++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/Dodge/Rendering.hs b/src/Dodge/Rendering.hs index 51ab6ae2d..d61b188aa 100644 --- a/src/Dodge/Rendering.hs +++ b/src/Dodge/Rendering.hs @@ -89,7 +89,7 @@ closeObjectTexts w = pictures $ (zipWith ren [0..] $ map toTs $ _closeActiveObje let textWidth = 9 * fromIntegral (length theText) let col = fromMaybe white $ fmap (_itInvColor . _flIt) mayIt let p = case freeSlot of - Just i -> ( pushout - halfWidth w + textWidth + Just i -> ( textWidth + xtran 0 + pushout - halfWidth w , halfHeight w - 20* (fromIntegral i +1) + 2.5 ) Nothing -> ( 0.25*_windowX w diff --git a/src/Dodge/Weapons.hs b/src/Dodge/Weapons.hs index 029142817..e627e3e4f 100644 --- a/src/Dodge/Weapons.hs +++ b/src/Dodge/Weapons.hs @@ -77,6 +77,7 @@ pistol = Weapon , _itInvColor = white } defaultGun = pistol +defaultAutoGun = autoGun {_itScrollUp = const id, _itScrollDown = const id} basicWeaponDisplay :: Item -> String basicWeaponDisplay it = _itName it ++ " " ++ aIfLoaded ++ "/" ++ availableAmmo where @@ -95,7 +96,7 @@ effectGun name eff = defaultGun , _wpFire = eff } autoEffectGun :: String -> (Int -> World -> World) -> Item -autoEffectGun name eff = autoGun +autoEffectGun name eff = defaultAutoGun { _itName = name ++ "Gun" , _wpFire = eff } @@ -190,7 +191,7 @@ rezGun = defaultGun ,polygon $ rectNESW (-1) 3 (-7) (-3) ] } -teslaGun = autoGun +teslaGun = defaultAutoGun { _itName = "TESLAGUN" , _itIdentity = TeslaGun , _wpMaxAmmo = 200 @@ -216,7 +217,7 @@ teslaGun = autoGun ,polygon $ rectNESW (-1) 3 (-7) (-3) ] } -lasGun = autoGun +lasGun = defaultAutoGun { _itName = "LASGUN ////" , _itIdentity = LasGun , _wpMaxAmmo = 200 @@ -310,7 +311,7 @@ forceFieldGun = defaultGun -- , _itAimingSpeed = 1 -- , _itAimingRange = 0.5 -- } -tractorGun = autoGun +tractorGun = defaultAutoGun { _itName = "TRACTORGUN" , _itIdentity = TractorGun , _wpMaxAmmo = 10000 @@ -373,7 +374,7 @@ remoteLauncher = defaultGun , _itEquipPict = drawWeapon $ color cyan $ polygon $ rectNESW 5 5 (-5) (-5) , _itAttachment = Just $ ItScope (0,0) 0 1 True } -hvAutoGun = autoGun +hvAutoGun = defaultAutoGun { _itName = "HVMACHINEGUN" , _itIdentity = HvAutoGun , _wpMaxAmmo = 100 @@ -400,7 +401,7 @@ hvAutoGun = autoGun $ threeEff' hvBulHitCr' hvBulHitWall' bulHitFF' -ltAutoGun = autoGun +ltAutoGun = defaultAutoGun { _itName = "AUTOPISTOL" , _itIdentity = LtAutoGun , _wpMaxAmmo = 25 @@ -425,7 +426,7 @@ ltAutoGun = autoGun ,circleSolid 4 ] } -miniGun = autoGun +miniGun = defaultAutoGun { _itName = "MINIGUN" , _itIdentity = MiniGun , _wpMaxAmmo = 150 @@ -562,7 +563,7 @@ startZoomOutLongGun _ w = w & creatures . ix 0 . crInv . ix (_crInvSel (_creatu -- (\x -> - 10) -poisonSprayer = autoGun +poisonSprayer = defaultAutoGun { _itName = "POISONSPRAYER" , _itIdentity = PoisonSprayer , _wpMaxAmmo = 500 @@ -584,7 +585,7 @@ poisonSprayer = autoGun , _itEquipPict = drawWeapon $ color yellow $ polygon $ rectNESW 4 4 (-4) (-4) } -flamer = autoGun +flamer = defaultAutoGun { _itName = "FLAMETHROWER" , _itIdentity = Flamethrower , _wpMaxAmmo = 250