Fix weapon scroll bug

This commit is contained in:
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 textWidth = 9 * fromIntegral (length theText)
let col = fromMaybe white $ fmap (_itInvColor . _flIt) mayIt let col = fromMaybe white $ fmap (_itInvColor . _flIt) mayIt
let p = case freeSlot of 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 , halfHeight w - 20* (fromIntegral i +1) + 2.5
) )
Nothing -> ( 0.25*_windowX w Nothing -> ( 0.25*_windowX w
+10 -9
View File
@@ -77,6 +77,7 @@ pistol = Weapon
, _itInvColor = white , _itInvColor = white
} }
defaultGun = pistol defaultGun = pistol
defaultAutoGun = autoGun {_itScrollUp = const id, _itScrollDown = const id}
basicWeaponDisplay :: Item -> String basicWeaponDisplay :: Item -> String
basicWeaponDisplay it = _itName it ++ " " ++ aIfLoaded ++ "/" ++ availableAmmo basicWeaponDisplay it = _itName it ++ " " ++ aIfLoaded ++ "/" ++ availableAmmo
where where
@@ -95,7 +96,7 @@ effectGun name eff = defaultGun
, _wpFire = eff , _wpFire = eff
} }
autoEffectGun :: String -> (Int -> World -> World) -> Item autoEffectGun :: String -> (Int -> World -> World) -> Item
autoEffectGun name eff = autoGun autoEffectGun name eff = defaultAutoGun
{ _itName = name ++ "Gun" { _itName = name ++ "Gun"
, _wpFire = eff , _wpFire = eff
} }
@@ -190,7 +191,7 @@ rezGun = defaultGun
,polygon $ rectNESW (-1) 3 (-7) (-3) ,polygon $ rectNESW (-1) 3 (-7) (-3)
] ]
} }
teslaGun = autoGun teslaGun = defaultAutoGun
{ _itName = "TESLAGUN" { _itName = "TESLAGUN"
, _itIdentity = TeslaGun , _itIdentity = TeslaGun
, _wpMaxAmmo = 200 , _wpMaxAmmo = 200
@@ -216,7 +217,7 @@ teslaGun = autoGun
,polygon $ rectNESW (-1) 3 (-7) (-3) ,polygon $ rectNESW (-1) 3 (-7) (-3)
] ]
} }
lasGun = autoGun lasGun = defaultAutoGun
{ _itName = "LASGUN ////" { _itName = "LASGUN ////"
, _itIdentity = LasGun , _itIdentity = LasGun
, _wpMaxAmmo = 200 , _wpMaxAmmo = 200
@@ -310,7 +311,7 @@ forceFieldGun = defaultGun
-- , _itAimingSpeed = 1 -- , _itAimingSpeed = 1
-- , _itAimingRange = 0.5 -- , _itAimingRange = 0.5
-- } -- }
tractorGun = autoGun tractorGun = defaultAutoGun
{ _itName = "TRACTORGUN" { _itName = "TRACTORGUN"
, _itIdentity = TractorGun , _itIdentity = TractorGun
, _wpMaxAmmo = 10000 , _wpMaxAmmo = 10000
@@ -373,7 +374,7 @@ remoteLauncher = defaultGun
, _itEquipPict = drawWeapon $ color cyan $ polygon $ rectNESW 5 5 (-5) (-5) , _itEquipPict = drawWeapon $ color cyan $ polygon $ rectNESW 5 5 (-5) (-5)
, _itAttachment = Just $ ItScope (0,0) 0 1 True , _itAttachment = Just $ ItScope (0,0) 0 1 True
} }
hvAutoGun = autoGun hvAutoGun = defaultAutoGun
{ _itName = "HVMACHINEGUN" { _itName = "HVMACHINEGUN"
, _itIdentity = HvAutoGun , _itIdentity = HvAutoGun
, _wpMaxAmmo = 100 , _wpMaxAmmo = 100
@@ -400,7 +401,7 @@ hvAutoGun = autoGun
$ threeEff' $ threeEff'
hvBulHitCr' hvBulHitWall' bulHitFF' hvBulHitCr' hvBulHitWall' bulHitFF'
ltAutoGun = autoGun ltAutoGun = defaultAutoGun
{ _itName = "AUTOPISTOL" { _itName = "AUTOPISTOL"
, _itIdentity = LtAutoGun , _itIdentity = LtAutoGun
, _wpMaxAmmo = 25 , _wpMaxAmmo = 25
@@ -425,7 +426,7 @@ ltAutoGun = autoGun
,circleSolid 4 ,circleSolid 4
] ]
} }
miniGun = autoGun miniGun = defaultAutoGun
{ _itName = "MINIGUN" { _itName = "MINIGUN"
, _itIdentity = MiniGun , _itIdentity = MiniGun
, _wpMaxAmmo = 150 , _wpMaxAmmo = 150
@@ -562,7 +563,7 @@ startZoomOutLongGun _ w = w & creatures . ix 0 . crInv . ix (_crInvSel (_creatu
-- (\x -> - 10) -- (\x -> - 10)
poisonSprayer = autoGun poisonSprayer = defaultAutoGun
{ _itName = "POISONSPRAYER" { _itName = "POISONSPRAYER"
, _itIdentity = PoisonSprayer , _itIdentity = PoisonSprayer
, _wpMaxAmmo = 500 , _wpMaxAmmo = 500
@@ -584,7 +585,7 @@ poisonSprayer = autoGun
, _itEquipPict = drawWeapon $ color yellow $ polygon $ rectNESW 4 4 (-4) (-4) , _itEquipPict = drawWeapon $ color yellow $ polygon $ rectNESW 4 4 (-4) (-4)
} }
flamer = autoGun flamer = defaultAutoGun
{ _itName = "FLAMETHROWER" { _itName = "FLAMETHROWER"
, _itIdentity = Flamethrower , _itIdentity = Flamethrower
, _wpMaxAmmo = 250 , _wpMaxAmmo = 250