Cleanup
This commit is contained in:
@@ -1,39 +1,29 @@
|
||||
--{-# LANGUAGE TupleSections #-}
|
||||
module Dodge.Inventory (
|
||||
selSecSelPos,
|
||||
checkInvSlotsYou,
|
||||
rmSelectedInvItem,
|
||||
selNumTextEndPos,
|
||||
selSecSelCol,
|
||||
selNumEndMidHeight,
|
||||
rmInvItem,
|
||||
updateCloseObjects,
|
||||
updateRBList,
|
||||
checkTermDist,
|
||||
closeObjScrollDir,
|
||||
changeSwapSel,
|
||||
scrollAugInvSel,
|
||||
crNumFreeSlots,
|
||||
crInvSize,
|
||||
selectedCloseObject,
|
||||
invDimColor,
|
||||
setInvPosFromSS,
|
||||
) where
|
||||
|
||||
import Control.Monad
|
||||
import Color
|
||||
import Control.Applicative
|
||||
import qualified Data.Map.Strict as M
|
||||
import Data.Maybe
|
||||
import Dodge.Base
|
||||
import Dodge.Data.Config
|
||||
import Dodge.Data.SelectionList
|
||||
import Dodge.Data.World
|
||||
import Dodge.DisplayInventory
|
||||
import Dodge.Euse
|
||||
import Dodge.Inventory.CheckSlots
|
||||
import Dodge.Inventory.CloseObject
|
||||
import Dodge.Inventory.Color
|
||||
import Dodge.ItEffect
|
||||
import Dodge.Reloading
|
||||
import Dodge.SelectionSections
|
||||
@@ -110,52 +100,6 @@ rmSelectedInvItem cid w = case w ^? cWorld . lWorld . creatures . ix cid . crMan
|
||||
Just i -> rmInvItem cid i w
|
||||
Nothing -> w
|
||||
|
||||
-- there are still more ListDisplayParams to integrate here
|
||||
selNumTextEndPos :: Configuration -> ListDisplayParams -> SelectionSections a -> Int -> Int -> Maybe Point2
|
||||
selNumTextEndPos cfig ldp sss i j = do
|
||||
ipos <- selSecSelPos i j sss
|
||||
return $ V2 (150 - hw) (hh - ((s * 10 + ygap) * (fromIntegral ipos + 1)))
|
||||
where
|
||||
s = _ldpScale ldp
|
||||
ygap = _ldpVerticalGap ldp
|
||||
hh = halfHeight cfig
|
||||
hw = halfWidth cfig
|
||||
|
||||
selNumEndMidHeight ::
|
||||
Configuration ->
|
||||
ListDisplayParams ->
|
||||
SelectionSections a ->
|
||||
Int ->
|
||||
Int ->
|
||||
Maybe Point2
|
||||
selNumEndMidHeight cfig ldp sss i j = do
|
||||
ipos <- selSecSelPos i j sss
|
||||
size <- selSecSelSize i j sss
|
||||
--let bump = negate $ (10 * s + ygap) * fromIntegral size
|
||||
return $ V2 (150 - hw) (hh - ((10 * s + ygap) * (fromIntegral ipos + fromIntegral size * 0.5)))
|
||||
where
|
||||
s = _ldpScale ldp
|
||||
ygap = _ldpVerticalGap ldp
|
||||
hh = halfHeight cfig
|
||||
hw = halfWidth cfig
|
||||
|
||||
selSecSelCol :: Int -> Int -> SelectionSections a -> Maybe Color
|
||||
selSecSelCol i j sss = sss ^? sssSections . ix i . ssItems . ix j . siColor
|
||||
|
||||
checkTermDist :: World -> World
|
||||
--checkTermDist w = case w ^? hud . hudElement . subInventory . termID of
|
||||
-- Just tmid -> fromMaybe (w & hud . hudElement . subInventory .~ NoSubInventory) $ do
|
||||
-- btid <- w ^? cWorld . lWorld . terminals . ix tmid . tmButtonID
|
||||
-- btpos <- w ^? cWorld . lWorld . buttons . ix btid . btPos
|
||||
-- guard $ dist btpos (_crPos $ you w) < 40
|
||||
-- return w
|
||||
-- Nothing -> w
|
||||
checkTermDist w = fromMaybe w $ do
|
||||
tmid <- w ^? hud . hudElement . subInventory . termID
|
||||
btid <- w ^? cWorld . lWorld . terminals . ix tmid . tmButtonID
|
||||
btpos <- w ^? cWorld . lWorld . buttons . ix btid . btPos
|
||||
guard $ dist btpos (_crPos $ you w) > 40
|
||||
return (w & hud . hudElement . subInventory .~ NoSubInventory)
|
||||
|
||||
-- this looks ugly...
|
||||
updateCloseObjects :: World -> World
|
||||
@@ -209,7 +153,6 @@ updateRBList w
|
||||
mcurrentitemid = do
|
||||
i <- cr ^? crManipulation . manObject . inInventory . ispItem
|
||||
cr ^? crInv . ix i . itID
|
||||
--curinvid = crSel cr
|
||||
cr = you w
|
||||
|
||||
chooseEquipmentPosition :: Creature -> [EquipPosition] -> Int
|
||||
|
||||
Reference in New Issue
Block a user