Fix weapon scroll bug

This commit is contained in:
jgk
2021-03-09 01:36:30 +01:00
parent 2310bd1b09
commit aa74075e3f
2 changed files with 11 additions and 10 deletions
+1 -1
View File
@@ -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
+10 -9
View File
@@ -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